locust-cloud 1.4.5__py3-none-any.whl → 1.5.0__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/__init__.py CHANGED
@@ -3,11 +3,15 @@ import os
3
3
  os.environ["LOCUST_SKIP_MONKEY_PATCH"] = "1"
4
4
 
5
5
  import argparse
6
+ import sys
6
7
 
8
+ import psycopg
7
9
  from locust import events
8
10
  from locust.argument_parser import LocustArgumentParser
9
11
  from locust_cloud.auth import register_auth
10
- from locust_cloud.timescale.exporter import Timescale
12
+ from locust_cloud.timescale.exporter import Exporter
13
+ from locust_cloud.timescale.query import register_query
14
+ from psycopg_pool import ConnectionPool
11
15
 
12
16
  PG_USER = os.environ.get("PG_USER")
13
17
  PG_HOST = os.environ.get("PG_HOST")
@@ -47,21 +51,39 @@ def add_arguments(parser: LocustArgumentParser):
47
51
  )
48
52
 
49
53
 
54
+ def set_autocommit(conn: psycopg.Connection):
55
+ conn.autocommit = True
56
+
57
+
58
+ def create_connection_pool(pg_user, pg_host, pg_password, pg_database, pg_port):
59
+ try:
60
+ return ConnectionPool(
61
+ conninfo=f"postgres://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_database}?sslmode=require",
62
+ min_size=1,
63
+ max_size=5,
64
+ configure=set_autocommit,
65
+ )
66
+ except Exception:
67
+ sys.stderr.write(f"Could not connect to postgres ({pg_user}@{pg_host}:{pg_port}).")
68
+ sys.exit(1)
69
+
70
+
50
71
  @events.init.add_listener
51
72
  def on_locust_init(environment, **_args):
52
73
  if not (PG_HOST or GRAPH_VIEWER):
53
74
  return
54
75
 
76
+ pool = create_connection_pool(
77
+ pg_user=PG_USER,
78
+ pg_host=PG_HOST,
79
+ pg_password=PG_PASSWORD,
80
+ pg_database=PG_DATABASE,
81
+ pg_port=PG_PORT,
82
+ )
83
+
55
84
  if not GRAPH_VIEWER and environment.parsed_options.exporter:
56
- Timescale(
57
- environment,
58
- pg_user=PG_USER,
59
- pg_host=PG_HOST,
60
- pg_password=PG_PASSWORD,
61
- pg_database=PG_DATABASE,
62
- pg_port=PG_PORT,
63
- )
85
+ Exporter(environment, pool)
64
86
 
65
87
  if environment.web_ui:
66
88
  register_auth(environment)
67
- environment.web_ui.template_args["apiBaseUrl"] = os.environ.get("LOCUST_API_BASE_URL")
89
+ register_query(environment, pool)
@@ -12,7 +12,6 @@ import locust.env
12
12
  import psycopg
13
13
  import psycopg.types.json
14
14
  from locust.exception import CatchResponseError
15
- from psycopg_pool import ConnectionPool
16
15
 
17
16
 
18
17
  def safe_serialize(obj):
@@ -22,8 +21,8 @@ def safe_serialize(obj):
22
21
  return json.dumps(obj, default=default)
23
22
 
24
23
 
25
- class Timescale:
26
- def __init__(self, environment: locust.env.Environment, pg_user, pg_host, pg_password, pg_database, pg_port):
24
+ class Exporter:
25
+ def __init__(self, environment: locust.env.Environment, pool):
27
26
  self.env = environment
28
27
  self._run_id = None
29
28
  self._samples: list[dict] = []
@@ -31,20 +30,7 @@ class Timescale:
31
30
  self._hostname = socket.gethostname()
32
31
  self._finished = False
33
32
  self._pid = os.getpid()
34
-
35
- def set_autocommit(conn: psycopg.Connection):
36
- conn.autocommit = True
37
-
38
- try:
39
- self.pool = ConnectionPool(
40
- conninfo=f"postgres://{pg_user}:{pg_password}@{pg_host}:{pg_port}/{pg_database}?sslmode=require",
41
- min_size=1,
42
- max_size=5,
43
- configure=set_autocommit,
44
- )
45
- except Exception:
46
- sys.stderr.write(f"Could not connect to postgres ({pg_user}@{pg_host}:{pg_port}).")
47
- sys.exit(1)
33
+ self.pool = pool
48
34
 
49
35
  events = self.env.events
50
36
  events.test_start.add_listener(self.on_test_start)
@@ -0,0 +1,276 @@
1
+ from typing import LiteralString
2
+
3
+ requests_query = """
4
+ SELECT
5
+ name,
6
+ request_type as method,
7
+ SUM(average * count) / SUM(count) as average,
8
+ SUM(count) as requests,
9
+ SUM(failed_count) as failed,
10
+ MIN(min),
11
+ MAX(max),
12
+ SUM(failed_count) / SUM(count) * 100 as "errorPercentage"
13
+ FROM requests_summary
14
+ WHERE bucket BETWEEN %(start)s AND %(end)s
15
+ AND run_id = %(testrun)s
16
+ GROUP BY name, method
17
+ """
18
+
19
+
20
+ failures_query = """
21
+ SELECT
22
+ name as name,
23
+ left(exception,300) as exception,
24
+ count(*)
25
+ FROM requests
26
+ WHERE time BETWEEN %(start)s AND %(end)s AND
27
+ exception is not null
28
+ AND run_id = %(testrun)s
29
+ GROUP BY "name",left(exception,300)
30
+ """
31
+
32
+
33
+ requests_per_second = """
34
+ WITH request_count_agg AS (
35
+ SELECT
36
+ time_bucket_gapfill('%(resolution)ss', bucket) AS time,
37
+ COALESCE(SUM(count)/%(resolution)s, 0) as rps
38
+ FROM requests_summary
39
+ WHERE bucket BETWEEN %(start)s AND %(end)s
40
+ AND run_id = %(testrun)s
41
+ GROUP BY 1
42
+ ORDER BY 1
43
+ ),
44
+ user_count_agg AS (
45
+ SELECT
46
+ time_bucket_gapfill('%(resolution)ss', time) AS time,
47
+ COALESCE(avg(user_count), 0) as users
48
+ FROM number_of_users
49
+ WHERE time BETWEEN %(start)s AND %(end)s
50
+ AND run_id = %(testrun)s
51
+ GROUP BY 1
52
+ ORDER BY 1
53
+ ),
54
+ errors_per_s_agg AS (
55
+ SELECT
56
+ time_bucket_gapfill('%(resolution)ss', bucket) AS time,
57
+ COALESCE(SUM(failed_count)/%(resolution)s, 0) as error_rate
58
+ FROM requests_summary
59
+ WHERE bucket BETWEEN %(start)s AND %(end)s
60
+ AND run_id = %(testrun)s
61
+ GROUP BY 1
62
+ ORDER BY 1
63
+ )
64
+ SELECT
65
+ r.time,
66
+ u.users,
67
+ r.rps,
68
+ e.error_rate as "errorRate"
69
+ FROM request_count_agg r
70
+ LEFT JOIN user_count_agg u ON r.time = u.time
71
+ LEFT JOIN errors_per_s_agg e on r.time = e.time
72
+ ORDER BY r.time;
73
+ """
74
+
75
+
76
+ total_requests = """
77
+ SELECT
78
+ SUM(count) as "totalRequests"
79
+ FROM requests_summary
80
+ WHERE bucket BETWEEN %(start)s AND %(end)s
81
+ AND run_id = %(testrun)s
82
+ """
83
+
84
+
85
+ total_failed = """
86
+ SELECT
87
+ SUM(failed_count) as "totalFailures"
88
+ FROM requests_summary
89
+ WHERE bucket BETWEEN %(start)s AND %(end)s
90
+ AND run_id = %(testrun)s
91
+ """
92
+
93
+
94
+ error_percentage = """
95
+ SELECT
96
+ SUM(failed_count) / SUM(count) * 100 "errorPercentage"
97
+ FROM requests_summary
98
+ WHERE bucket BETWEEN %(start)s AND %(end)s
99
+ AND run_id = %(testrun)s
100
+ """
101
+
102
+ rps_per_request = """
103
+ SELECT
104
+ time_bucket_gapfill('%(resolution)ss', bucket) AS time,
105
+ name,
106
+ COALESCE(SUM(count)/%(resolution)s, 0) as throughput
107
+ FROM requests_summary
108
+ WHERE bucket BETWEEN %(start)s AND %(end)s
109
+ AND run_id = %(testrun)s
110
+ GROUP BY 1, name
111
+ ORDER BY 1,2
112
+ """
113
+
114
+
115
+ avg_response_times = """
116
+ SELECT
117
+ time_bucket_gapfill('%(resolution)ss', bucket) as time,
118
+ name,
119
+ avg(average) as "responseTime"
120
+ FROM requests_summary
121
+ WHERE bucket BETWEEN %(start)s AND %(end)s
122
+ AND run_id = %(testrun)s
123
+ GROUP BY 1, name
124
+ ORDER BY 1, 2
125
+ """
126
+
127
+ errors_per_request = """
128
+ SELECT
129
+ time_bucket_gapfill('%(resolution)ss', bucket) AS time,
130
+ name,
131
+ SUM(failed_count)/%(resolution)s as "errorRate"
132
+ FROM requests_summary
133
+ WHERE bucket BETWEEN %(start)s AND %(end)s
134
+ AND run_id = %(testrun)s
135
+ GROUP BY 1, name
136
+ ORDER BY 1
137
+ """
138
+
139
+
140
+ perc99_response_times = """
141
+ SELECT time_bucket('%(resolution)ss', bucket) AS time,
142
+ name,
143
+ perc99
144
+ FROM requests_summary
145
+ WHERE bucket BETWEEN %(start)s AND %(end)s
146
+ AND run_id = %(testrun)s
147
+ GROUP BY 1, name, perc99
148
+ """
149
+
150
+
151
+ response_length = """
152
+ SELECT
153
+ time_bucket('%(resolution)ss', bucket) as time,
154
+ response_length as "responseLength",
155
+ name
156
+ FROM requests_summary
157
+ WHERE bucket BETWEEN %(start)s AND %(end)s
158
+ AND run_id = %(testrun)s
159
+ ORDER BY 1
160
+ """
161
+
162
+
163
+ request_names = """
164
+ SELECT DISTINCT name
165
+ FROM requests_summary
166
+ WHERE bucket BETWEEN %(start)s AND %(end)s
167
+ AND run_id = %(testrun)s
168
+ """
169
+
170
+ scatterplot = """
171
+ SELECT
172
+ time,
173
+ name,
174
+ response_time as "responseTime"
175
+ FROM requests
176
+ WHERE time BETWEEN %(start)s AND %(end)s
177
+ AND run_id = %(testrun)s
178
+ ORDER BY 1,2
179
+ """
180
+
181
+ testruns = """
182
+ SELECT
183
+ id as "runId",
184
+ end_time as "endTime"
185
+ FROM testruns
186
+ ORDER BY id DESC
187
+ """
188
+
189
+ testruns_table = """
190
+ SELECT
191
+ id as "runId",
192
+ num_users as "numUsers",
193
+ round(rps_avg, 1) as "rpsAvg",
194
+ round(resp_time_avg, 1) as "respTime",
195
+ fail_ratio as "failRatio",
196
+ requests,
197
+ date_trunc('second', end_time - id) AS "runTime",
198
+ description,
199
+ exit_code as "exitCode"
200
+ FROM testruns
201
+ ORDER BY id DESC
202
+ """
203
+
204
+ testruns_rps = """
205
+ WITH avg_rps AS (
206
+ SELECT
207
+ id AS time,
208
+ rps_avg AS avg_rps
209
+ FROM testruns
210
+ ORDER BY id
211
+ ),
212
+ avg_rps_failed AS (
213
+ SELECT
214
+ id AS time,
215
+ CASE
216
+ WHEN exit_code > 0 THEN rps_avg
217
+ ELSE 0
218
+ END AS avg_rps_failed
219
+ FROM testruns
220
+ ORDER BY id
221
+ )
222
+ SELECT
223
+ a.time,
224
+ a.avg_rps as "avgRps",
225
+ f.avg_rps_failed as "avgRpsFailed"
226
+ FROM avg_rps a
227
+ JOIN avg_rps_failed f ON a.time = f.time
228
+ ORDER BY a.time
229
+ """
230
+
231
+ testruns_response_time = """
232
+ WITH avg_response_time AS (
233
+ SELECT
234
+ id AS time,
235
+ resp_time_avg AS avg_response_time
236
+ FROM testruns
237
+ ORDER BY id
238
+ ),
239
+ avg_response_time_failed AS (
240
+ SELECT
241
+ id AS time,
242
+ CASE
243
+ WHEN exit_code > 0 THEN resp_time_avg
244
+ ELSE 0
245
+ END AS avg_response_time_failed
246
+ FROM testruns
247
+ ORDER BY id
248
+ )
249
+ SELECT
250
+ a.time,
251
+ a.avg_response_time as "avgResponseTime",
252
+ f.avg_response_time_failed as "avgResponseTimeFailed"
253
+ FROM avg_response_time a
254
+ JOIN avg_response_time_failed f ON a.time = f.time
255
+ ORDER BY a.time
256
+ """
257
+
258
+ queries: dict["str", LiteralString] = {
259
+ "request-names": request_names,
260
+ "requests": requests_query,
261
+ "failures": failures_query,
262
+ "rps": requests_per_second,
263
+ "total-requests": total_requests,
264
+ "total-failures": total_failed,
265
+ "error-percentage": error_percentage,
266
+ "rps-per-request": rps_per_request,
267
+ "avg-response-times": avg_response_times,
268
+ "errors-per-request": errors_per_request,
269
+ "perc99-response-times": perc99_response_times,
270
+ "response-length": response_length,
271
+ "scatterplot": scatterplot,
272
+ "testruns": testruns,
273
+ "testruns-table": testruns_table,
274
+ "testruns-rps": testruns_rps,
275
+ "testruns-response-time": testruns_response_time,
276
+ }
@@ -0,0 +1,60 @@
1
+ import json
2
+ import logging
3
+ import time
4
+
5
+ from flask import make_response, request
6
+ from locust_cloud.timescale.queries import queries
7
+
8
+ logger = logging.getLogger(__name__)
9
+
10
+
11
+ def adapt_timestamp(result):
12
+ return {key: str(value) if value else None for key, value in result.items()}
13
+
14
+
15
+ def register_query(environment, pool):
16
+ @environment.web_ui.app.route("/cloud-stats/<query>", methods=["POST"])
17
+ def query(query):
18
+ print(query)
19
+ results = []
20
+
21
+ try:
22
+ if query and queries[query]:
23
+ start_time = time.perf_counter()
24
+ with pool.connection() as conn:
25
+ get_conn_time = (time.perf_counter() - start_time) * 1000
26
+ sql_params = request.get_json()
27
+ start_time = time.perf_counter()
28
+ cursor = conn.execute(queries[query], sql_params)
29
+ exec_time = (time.perf_counter() - start_time) * 1000
30
+ assert cursor
31
+ start_time = time.perf_counter()
32
+ results = [
33
+ adapt_timestamp(
34
+ dict(
35
+ zip(
36
+ [column[0] for column in cursor.description],
37
+ row,
38
+ )
39
+ )
40
+ )
41
+ for row in cursor.fetchall()
42
+ ]
43
+ fetch_time = (time.perf_counter() - start_time) * 1000
44
+
45
+ logger.info(
46
+ f"Executed query '{query}' with params {sql_params}. It took {round(get_conn_time)}+{round(exec_time)}+{round(fetch_time)}ms"
47
+ )
48
+ try:
49
+ json.dumps(results)
50
+ except TypeError:
51
+ logger.error(f"Could not serialize result: {str(results)[:500]}")
52
+ return make_response(f"Could not serialize result: {str(results)[:500]}", 400)
53
+ return results
54
+ else:
55
+ logger.warning(f"Received invalid query key: '{query}'")
56
+ return make_response("Invalid query key", 401)
57
+ except Exception as e:
58
+ print(e)
59
+ logger.error(f"Error executing query '{query}': {e}", exc_info=True)
60
+ return make_response("Error executing query", 401)
@@ -267,7 +267,7 @@ PERFORMANCE OF THIS SOFTWARE.
267
267
  <span style="color:${f};">
268
268
  ${h}:&nbsp${Ept({chartValueFormatter:i,value:d})}
269
269
  </span>
270
- `,""):"No data",borderWidth:0},xAxis:{type:"time",startValue:(e.time||[""])[0],axisLabel:{formatter:Rpt}},grid:{left:60,right:40},yAxis:Lpt({splitAxis:a,yAxisLabels:o}),series:hbe({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"}}}}}}),Npt=(e,t)=>({symbol:"none",label:{formatter:r=>`Run #${r.dataIndex+1}`,padding:[0,0,8,0]},lineStyle:{color:t?YA.DARK.axisColor:YA.LIGHT.axisColor},data:(e.markers||[]).map(r=>({xAxis:r}))}),zpt=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 Ll({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s}){const[l,u]=F.useState(null),c=hs(({theme:{isDarkMode:h}})=>h),f=F.useRef(null);return F.useEffect(()=>{if(!f.current)return;const h=_Je(f.current);h.setOption(Opt({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s})),h.on("datazoom",zpt(h));const d=()=>h.resize();return window.addEventListener("resize",d),h.group="swarmCharts",bJe("swarmCharts"),u(h),()=>{SJe(h),window.removeEventListener("resize",d)}},[f]),F.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:Npt(e,c)}:{}}))})},[e,l,r,c]),F.useEffect(()=>{if(l){const{textColor:h,axisColor:d,backgroundColor:p,splitLine:v}=c?YA.DARK:YA.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]),F.useEffect(()=>{l&&l.setOption({series:hbe({charts:e,lines:r,scatterplot:s})})},[r]),H.jsx("div",{ref:f,style:{width:"100%",height:"300px"}})}const Bpt=tu.percentilesToChart?tu.percentilesToChart.map(e=>({name:`${e*100}th percentile`,key:`responseTimePercentile${e}`})):[],Fpt=["#ff9f00","#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],Vpt=[{title:"Total Requests per Second",lines:[{name:"RPS",key:"currentRps"},{name:"Failures/s",key:"currentFailPerSec"}],colors:["#00ca5a","#ff6d6d"]},{title:"Response Times (ms)",lines:Bpt,colors:Fpt},{title:"Number of Users",lines:[{name:"Number of Users",key:"userCount"}],colors:["#0099ff"]}];function $pt({charts:e}){return H.jsx("div",{children:Vpt.map((t,r)=>H.jsx(Ll,{...t,charts:e},`swarm-chart-${r}`))})}const Gpt=({ui:{charts:e}})=>({charts:e}),Wpt=Oa(Gpt)($pt);function Hpt(e){return(e*100).toFixed(1)+"%"}function wF({classRatio:e}){return H.jsx("ul",{children:Object.entries(e).map(([t,{ratio:r,tasks:n}])=>H.jsxs("li",{children:[`${Hpt(r)} ${t}`,n&&H.jsx(wF,{classRatio:n})]},`nested-ratio-${t}`))})}function jpt({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(wF,{classRatio:e})]}),t&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Total Ratio"}),H.jsx(wF,{classRatio:t})]})]})}const Upt=({ui:{ratios:e}})=>({ratios:e}),Ypt=Oa(Upt)(jpt),Xpt=[{key:"id",title:"Worker"},{key:"state",title:"State"},{key:"userCount",title:"# users"},{key:"cpuUsage",title:"CPU usage"},{key:"memoryUsage",title:"Memory usage",formatter:tWe}];function qpt({workers:e=[]}){return H.jsx(bh,{defaultSortKey:"id",rows:e,structure:Xpt})}const Zpt=({ui:{workers:e}})=>({workers:e}),Kpt=Oa(Zpt)(qpt),Os={stats:{component:LUe,key:"stats",title:"Statistics"},charts:{component:Wpt,key:"charts",title:"Charts"},failures:{component:pUe,key:"failures",title:"Failures"},exceptions:{component:cUe,key:"exceptions",title:"Exceptions"},ratios:{component:Ypt,key:"ratios",title:"Current Ratio"},reports:{component:bUe,key:"reports",title:"Download Data"},logs:{component:mUe,key:$pe,title:"Logs"},workers:{component:Kpt,key:"workers",title:"Workers",shouldDisplayTab:e=>e.swarm.isDistributed}},dbe=[Os.stats,Os.charts,Os.failures,Os.exceptions,Os.ratios,Os.reports,Os.logs,Os.workers],Qpt=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)},Jpt=()=>window.location.search?eWe(window.location.search):null,evt={query:Jpt()},pbe=Bo({name:"url",initialState:evt,reducers:{setUrl:v1}}),tvt=pbe.actions,rvt=pbe.reducer;function nvt({hasNotification:e,title:t}){return H.jsxs(jt,{sx:{display:"flex",alignItems:"center"},children:[e&&H.jsx(NG,{color:"secondary"}),H.jsx("span",{children:t})]})}function ivt({currentTabIndexFromQuery:e,notification:t,setNotification:r,setUrl:n,tabs:i}){const[a,o]=F.useState(e),s=(l,u)=>{const c=i[u].key;t[c]&&r({[c]:!1}),Qpt({tab:c}),n({query:{tab:c}}),o(u)};return F.useEffect(()=>{o(e)},[e]),H.jsxs(Fv,{maxWidth:"xl",children:[H.jsx(jt,{sx:{mb:2},children:H.jsx(BFe,{onChange:s,value:a,children:i.map(({key:l,title:u},c)=>H.jsx(F4e,{label:H.jsx(nvt,{hasNotification:t[l],title:u})},`tab-${c}`))})}),i.map(({component:l=oUe},u)=>a===u&&H.jsx(l,{},`tabpabel-${u}`))]})}const avt=(e,{tabs:t,extendedTabs:r})=>{const{notification:n,swarm:{extendedTabs:i},url:{query:a}}=e,o=(t||[...dbe,...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}},ovt={setNotification:Wpe.setNotification,setUrl:tvt.setUrl},vbe=Oa(avt,ovt)(ivt),svt=e=>Y$({palette:{mode:e,primary:{main:"#15803d"},success:{main:"#00C853"}},components:{MuiCssBaseline:{styleOverrides:{":root":{"--footer-height":"40px"}}}}});function gbe(){const e=hs(({theme:{isDarkMode:t}})=>t);return F.useMemo(()=>svt(e?eu.DARK:eu.LIGHT),[e])}var Xte;const lvt={totalRps:0,failRatio:0,startTime:"",stats:[],errors:[],exceptions:[],charts:(Xte=tu.history)==null?void 0:Xte.reduce(pP,{}),ratios:{},userCount:0};var qte;const uvt=(qte=tu.percentilesToChart)==null?void 0:qte.reduce((e,t)=>({...e,[`responseTimePercentile${t}`]:{value:null}}),{}),cvt=e=>pP(e,{...uvt,currentRps:{value:null},currentFailPerSec:{value:null},totalAvgResponseTime:{value:null},userCount:{value:null},time:""}),ybe=Bo({name:"ui",initialState:lvt,reducers:{setUi:v1,updateCharts:(e,{payload:t})=>({...e,charts:pP(e.charts,t)}),updateChartMarkers:(e,{payload:t})=>({...e,charts:{...cvt(e.charts),markers:e.charts.markers?[...e.charts.markers,t]:[(e.charts.time||[""])[0],t]}})}}),jb=ybe.actions,fvt=ybe.reducer;function mbe(){const{data:e,refetch:t}=QWe(),r=Hu(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;F.useEffect(()=>{e&&r({exceptions:e.exceptions})},[e]),gc(t,5e3,{shouldRunInterval:i})}const Zte=2e3;function xbe(){const e=Hu(vP.setSwarm),t=Hu(jb.setUi),r=Hu(jb.updateCharts),n=Hu(jb.updateChartMarkers),i=hs(({swarm:h})=>h),a=F.useRef(i.state),[o,s]=F.useState(!1),{data:l,refetch:u}=ZWe(),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)};F.useEffect(()=>{l&&e({state:l.state})},[l&&l.state]),gc(f,Zte,{shouldRunInterval:!!l&&c}),gc(u,Zte,{shouldRunInterval:c}),F.useEffect(()=>{i.state===ur.RUNNING&&a.current===ur.STOPPED&&s(!0),a.current=i.state},[i.state,a])}function _be(){const{data:e,refetch:t}=KWe(),r=Hu(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;F.useEffect(()=>{e&&r({ratios:e})},[e]),gc(t,5e3,{shouldRunInterval:i})}function hvt({swarmState:e,tabs:t,extendedTabs:r}){xbe(),mbe(),_be(),Upe();const n=gbe();return H.jsxs(b6e,{theme:n,children:[H.jsx(y6e,{}),H.jsx(IHe,{children:e===ur.READY?H.jsx(EG,{}):H.jsx(vbe,{extendedTabs:r,tabs:t})})]})}const dvt=({swarm:{state:e}})=>({swarmState:e});Oa(dvt)(hvt);const pvt=xG({[YI.reducerPath]:YI.reducer,logViewer:RHe,notification:kHe,swarm:rHe,theme:ZGe,ui:fvt,url:rvt}),vvt=MGe({reducer:pvt,middleware:e=>e().concat(YI.middleware)});var CF={},Kte=F6;CF.createRoot=Kte.createRoot,CF.hydrateRoot=Kte.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 gvt=typeof Symbol=="function"&&Symbol.observable||"@@observable",Qte=gvt,LN=()=>Math.random().toString(36).substring(7).split("").join("."),yvt={INIT:`@@redux/INIT${LN()}`,REPLACE:`@@redux/REPLACE${LN()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${LN()}`},XA=yvt;function n8(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 bbe(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(bbe)(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(!n8(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:XA.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)}},[Qte](){return this}}}return h({type:XA.INIT}),{dispatch:h,subscribe:f,getState:c,replaceReducer:d,[Qte]:p}}function mvt(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:XA.INIT})>"u")throw new Error(ti(12));if(typeof r(void 0,{type:XA.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ti(13))})}function Sbe(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{mvt(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 qA(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function xvt(...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=qA(...s)(i.dispatch),{...i,dispatch:a}}}function _vt(e){return n8(e)&&"type"in e&&typeof e.type=="string"}var wbe=Symbol.for("immer-nothing"),Jte=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 Tc(e){var t;return e?Cbe(e)||Array.isArray(e)||!!e[Jte]||!!((t=e.constructor)!=null&&t[Jte])||lL(e)||uL(e):!1}var bvt=Object.prototype.constructor.toString();function Cbe(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)===bvt}function ZA(e,t){sL(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function sL(e){const t=e[oo];return t?t.type_:Array.isArray(e)?1:lL(e)?2:uL(e)?3:0}function TF(e,t){return sL(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tbe(e,t,r){const n=sL(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Svt(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function lL(e){return e instanceof Map}function uL(e){return e instanceof Set}function rp(e){return e.copy_||e.base_}function MF(e,t){if(lL(e))return new Map(e);if(uL(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Cbe(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 i8(e,t=!1){return cL(e)||Mv(e)||!Tc(e)||(sL(e)>1&&(e.set=e.add=e.clear=e.delete=wvt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>i8(n,!0))),e}function wvt(){Fs(2)}function cL(e){return Object.isFrozen(e)}var Cvt={};function Iv(e){const t=Cvt[e];return t||Fs(0,e),t}var _w;function Mbe(){return _w}function Tvt(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ere(e,t){t&&(Iv("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function IF(e){AF(e),e.drafts_.forEach(Mvt),e.drafts_=null}function AF(e){e===_w&&(_w=e.parent_)}function tre(e){return _w=Tvt(_w,e)}function Mvt(e){const t=e[oo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function rre(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[oo].modified_&&(IF(t),Fs(4)),Tc(e)&&(e=KA(t,e),t.parent_||QA(t,e)),t.patches_&&Iv("Patches").generateReplacementPatches_(r[oo].base_,e,t.patches_,t.inversePatches_)):e=KA(t,r,[]),IF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wbe?e:void 0}function KA(e,t,r){if(cL(t))return t;const n=t[oo];if(!n)return ZA(t,(i,a)=>nre(e,n,t,i,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return QA(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),ZA(a,(s,l)=>nre(e,n,i,s,l,r,o)),QA(e,i,!1),r&&e.patches_&&Iv("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function nre(e,t,r,n,i,a,o){if(Mv(i)){const s=a&&t&&t.type_!==3&&!TF(t.assigned_,n)?a.concat(n):void 0,l=KA(e,i,s);if(Tbe(r,n,l),Mv(l))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(Tc(i)&&!cL(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;KA(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&QA(e,i)}}function QA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&i8(t,r)}function Ivt(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Mbe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=a8;r&&(i=[n],a=bw);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var a8={get(e,t){if(t===oo)return e;const r=rp(e);if(!TF(r,t))return Avt(e,r,t);const n=r[t];return e.finalized_||!Tc(n)?n:n===RN(e.base_,t)?(EN(e),e.copy_[t]=DF(n,e)):n},has(e,t){return t in rp(e)},ownKeys(e){return Reflect.ownKeys(rp(e))},set(e,t,r){const n=Ibe(rp(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=RN(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(Svt(r,i)&&(r!==void 0||TF(e.base_,t)))return!0;EN(e),kF(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 RN(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,EN(e),kF(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={};ZA(a8,(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 a8.set.call(this,e[0],t,r,e[0])};function RN(e,t){const r=e[oo];return(r?rp(r):e)[t]}function Avt(e,t,r){var i;const n=Ibe(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Ibe(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 kF(e){e.modified_||(e.modified_=!0,e.parent_&&kF(e.parent_))}function EN(e){e.copy_||(e.copy_=MF(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kvt=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(Tc(t)){const a=tre(this),o=DF(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?IF(a):AF(a)}return ere(a,n),rre(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===wbe&&(i=void 0),this.autoFreeze_&&i8(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){Tc(e)||Fs(8),Mv(e)&&(e=Dvt(e));const t=tre(this),r=DF(e,void 0);return r[oo].isManual_=!0,AF(t),r}finishDraft(e,t){const r=e&&e[oo];(!r||!r.isManual_)&&Fs(9);const{scope_:n}=r;return ere(n,t),rre(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 DF(e,t){const r=lL(e)?Iv("MapSet").proxyMap_(e,t):uL(e)?Iv("MapSet").proxySet_(e,t):Ivt(e,t);return(t?t.scope_:Mbe()).drafts_.push(r),r}function Dvt(e){return Mv(e)||Fs(10,e),Abe(e)}function Abe(e){if(!Tc(e)||cL(e))return e;const t=e[oo];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=MF(e,t.scope_.immer_.useStrictShallowCopy_)}else r=MF(e,!0);return ZA(r,(n,i)=>{Tbe(r,n,Abe(i))}),t&&(t.finalized_=!1),r}var so=new kvt,kbe=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 Dbe(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var Pvt=Dbe(),Lvt=Dbe,Rvt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qA:qA.apply(null,arguments)};function ire(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=>_vt(n)&&n.type===e,r}var Pbe=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 are(e){return Tc(e)?kbe(e,()=>{}):e}function ore(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 Evt(e){return typeof e=="boolean"}var Ovt=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Pbe;return r&&(Evt(r)?o.push(Pvt):o.push(Lvt(r.extraArgument))),o},Nvt="RTK_autoBatch",Lbe=e=>t=>{setTimeout(t,e)},zvt=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Lbe(10),Bvt=(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"?zvt:e.type==="callback"?e.queueNotification:Lbe(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[Nvt]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},Fvt=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Pbe(e);return n&&i.push(Bvt(typeof n=="object"?n:void 0)),i};function Vvt(e){const t=Ovt(),{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(n8(r))s=Sbe(r);else throw new Error(Xs(1));let l;typeof n=="function"?l=n(t):l=t();let u=qA;i&&(u=Rvt({trace:!1,...typeof i=="object"&&i}));const c=xvt(...l),f=Fvt(c);let h=typeof o=="function"?o(f):f();const d=u(...h);return bbe(s,a,d)}function Rbe(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 $vt(e){return typeof e=="function"}function Gvt(e,t){let[r,n,i]=Rbe(t),a;if($vt(e))a=()=>are(e());else{const s=are(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(Tc(c))return kbe(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 Wvt=Symbol.for("rtk-slice-createasyncthunk");function Hvt(e,t){return`${e}/${t}`}function jvt({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Wvt];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(Yvt()):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:Hvt(a,x),createNotation:typeof i.reducers=="function"};qvt(_)?Kvt(S,_,c,t):Xvt(S,_,c)});function f(){const[x={},_=[],S=void 0]=typeof i.extraReducers=="function"?Rbe(i.extraReducers):[i.extraReducers],b={...x,...u.sliceCaseReducersByType};return Gvt(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=ore(d,_,{insert:()=>new WeakMap});return ore(C,w,{insert:()=>{const T={};for(const[M,I]of Object.entries(i.selectors??{}))T[M]=Uvt(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 Uvt(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 o8=jvt();function Yvt(){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 Xvt({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Zvt(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?ire(e,o):ire(e))}function qvt(e){return e._reducerDefinitionType==="asyncThunk"}function Zvt(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Kvt({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 s8(e,{payload:t}){return{...e,...t}}const Qvt={message:null},Ebe=o8({name:"snackbar",initialState:Qvt,reducers:{setSnackbar:s8}}),z0=Ebe.actions,Jvt=Ebe.reducer,egt={resolution:5,testruns:{},currentTestrunIndex:0,testrunsForDisplay:[]},Obe=o8({name:"toolbar",initialState:egt,reducers:{setToolbar:s8}}),Nbe=Obe.actions,tgt=Obe.reducer,cm={CLOUD:"CLOUD",CLASSIC:"CLASSIC"},rgt={viewType:cm.CLOUD},zbe=o8({name:"ui",initialState:rgt,reducers:{setUi:s8}}),ngt=zbe.actions,igt=zbe.reducer,Bbe=F.createContext(null),agt=Sbe({snackbar:Jvt,toolbar:tgt,ui:igt}),Fbe=Vvt({reducer:agt,middleware:e=>e()}),Dh=Zk,Tu=Iue(Bbe),ogt=()=>e=>Fbe.dispatch(e);function Mc(e,t){const r=ogt();return F.useCallback(n=>{r(e(n))},[e,r])}function sgt(){const e=Dh(({swarm:r})=>r.state),t=Tu(({ui:r})=>r.viewType);return e===ur.READY?null:W.jsxs(jt,{sx:{display:"flex",columnGap:2,marginY:"auto",height:"50px"},children:[e===ur.STOPPED?W.jsx(zpe,{}):W.jsxs(W.Fragment,{children:[W.jsx(Ope,{}),W.jsx(Fpe,{})]}),t==cm.CLASSIC&&W.jsx(Bpe,{})]})}function lgt(){return W.jsx(Khe,{position:"static",children:W.jsx(Fv,{maxWidth:"xl",children:W.jsxs(Lde,{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(tpe,{})}),W.jsxs(jt,{sx:{display:"flex",columnGap:6},children:[!window.templateArgs.isGraphViewer&&W.jsxs(W.Fragment,{children:[W.jsx(Tpe,{}),W.jsx(sgt,{})]}),W.jsx(_pe,{})]})]})})})}function ugt(){const e=Mc(ngt.setUi),{viewType:t}=Tu(({ui:n})=>n),r=t===cm.CLOUD?cm.CLASSIC:cm.CLOUD;return W.jsx(Fv,{maxWidth:"xl",sx:{position:"relative"},children:W.jsx(_u,{onClick:()=>e({viewType:r}),sx:{position:"absolute",mt:"4px",right:16,zIndex:1},children:r})})}function cgt({children:e}){const t=Dh(({swarm:r})=>r.state);return W.jsxs(W.Fragment,{children:[W.jsx(lgt,{}),!window.templateArgs.isGraphViewer&&t!==ur.READY&&W.jsx(ugt,{}),W.jsx("main",{children:e})]})}function fgt(){const e=F.useCallback(()=>r({message:null}),[]),t=Tu(({snackbar:n})=>n.message),r=Mc(z0.setSnackbar);return W.jsx(m4e,{autoHideDuration:5e3,onClose:e,open:!!t,children:W.jsx(Zhe,{onClose:e,severity:"error",sx:{width:"100%"},variant:"filled",children:t})})}const Vbe="5",hgt=["1","2",Vbe,"10","30"],dgt=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 l8({onSelectTestRun:e}){const t=Mc(Nbe.setToolbar),{testruns:r,testrunsForDisplay:n}=Tu(({toolbar:a})=>a),i=a=>{e&&e(a.target.value);const o=r[a.target.value];t({currentTestrun:o.runId,currentTestrunIndex:o.index}),dgt({testrun:a.target.value})};return W.jsxs(jt,{sx:{display:"flex",columnGap:2,mb:1},children:[W.jsx(jS,{defaultValue:Vbe,label:"Resolution",name:"resolution",onChange:a=>t({resolution:Number(a.target.value)}),options:hgt,size:"small",sx:{width:"150px"}}),!!n.length&&W.jsx(jS,{label:"Test Run",name:"testrun",onChange:i,options:n,size:"small",sx:{width:"250px"}})]})}const pgt=e=>e?e.split(";").map(t=>t.trim().split("=")).reduce((t,[r,n])=>({...t,[r]:n}),{}):{},vgt=e=>typeof document<"u"&&pgt(document.cookie)[e];function Un(e,t,r,n){const i=window.templateArgs.apiBaseUrl;fetch(`${i}${e}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vgt("cognito_token")}`},body:JSON.stringify(t)}).then(a=>a.json()).then(a=>r(a)).catch(a=>console.error(a))}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:[]},ggt={time:[]},Vg={RPS:["#00ca5a","#0099ff","#ff6d6d"],PER_REQUEST:["#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],ERROR:["#ff8080","#ff4d4d","#ff1a1a","#e60000","#b30000","#800000"]},ygt=["Users","RPS"],mgt=[{name:"Users",key:"users",yAxisIndex:0},{name:"Requests per Second",key:"rps",yAxisIndex:1,areaStyle:{}},{name:"Errors per Second",key:"errorRate",yAxisIndex:1,areaStyle:{}}],xgt=e=>e?e[e.length-1][1]:"0";function $be(){const{state:e}=Dh(({swarm:R})=>R),{resolution:t,currentTestrunIndex:r,currentTestrun:n,testruns:i}=Tu(({toolbar:R})=>R);Mc(z0.setSnackbar);const[a,o]=F.useState(!0),[s,l]=F.useState(!1),[u,c]=F.useState(new Date().toISOString()),[f,h]=F.useState([]),[d,p]=F.useState(ggt),[v,g]=F.useState(e_),[y,m]=F.useState(e_),[x,_]=F.useState(e_),[S,b]=F.useState(e_),[w,C]=F.useState(e_),T=R=>Un("/cloud-stats/request-names",R,B=>{(r!==0&&!B.length||r===0&&e!==ur.RUNNING&&!B.length)&&l(!0),h(B.map(({name:E})=>({name:`${E}`,key:E})))}),M=R=>Un("/cloud-stats/rps",R,B=>p(B.reduce((E,{users:G,rps:j,errorRate:V,time:U})=>({users:[...E.users||[],[U,G||xgt(E.users)]],rps:[...E.rps||[],[U,j||"0"]],errorRate:[...E.errorRate||[],[U,V||"0"]],time:[...E.time||[],U]}),{}))),I=R=>Un("/cloud-stats/rps-per-request",R,B=>g(yy(B,"throughput"))),A=R=>Un("/cloud-stats/avg-response-times",R,B=>{m(yy(B,"responseTime")),a&&o(!1)}),k=R=>Un("/cloud-stats/errors-per-request",R,B=>_(yy(B,"errorRate"))),D=R=>Un("/cloud-stats/perc99-response-times",R,B=>b(yy(B,"perc99"))),P=R=>Un("/cloud-stats/response-length",R,B=>C(yy(B,"responseLength"))),L=R=>{if(n){const B=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(B)}};gc(L,1e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING,immediate:!0}),F.useEffect(()=>{if(n){const{endTime:R}=i[new Date(n).toLocaleString()];L(R)}else L()},[n,t]),F.useEffect(()=>{e===ur.RUNNING&&o(!0)},[e]);const O=F.useCallback(()=>{o(!0),l(!1)},[]);return W.jsxs(W.Fragment,{children:[W.jsx(l8,{onSelectTestRun:O}),s&&W.jsx(Zhe,{severity:"error",children:"There was a problem loading some graphs for this testrun."}),W.jsxs(jt,{sx:{position:"relative"},children:[a&&W.jsx(jt,{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(Ize,{})}),W.jsx(Ll,{chartValueFormatter:kf,charts:d,colors:Vg.RPS,lines:mgt,splitAxis:!0,title:"Throughput / active users",yAxisLabels:ygt}),(!s||s&&!!f.length)&&W.jsxs(W.Fragment,{children:[W.jsx(Ll,{chartValueFormatter:R=>`${Of(Number(R[1]),2)}ms`,charts:y,colors:Vg.PER_REQUEST,lines:f,title:"Average Response Times"}),W.jsx(Ll,{chartValueFormatter:kf,charts:v,colors:Vg.PER_REQUEST,lines:f,title:"RPS per Request"}),W.jsx(Ll,{chartValueFormatter:kf,charts:x,colors:Vg.ERROR,lines:f,title:"Errors per Request"}),W.jsx(Ll,{chartValueFormatter:kf,charts:S,colors:Vg.PER_REQUEST,lines:f,title:"99th Percentile Response Times"}),W.jsx(Ll,{chartValueFormatter:kf,charts:w,colors:Vg.PER_REQUEST,lines:f,title:"Response Length"})]})]})]})}function Gbe(){const e=Dh(({swarm:f})=>f.state),{currentTestrun:t}=Tu(({toolbar:f})=>f);Mc(z0.setSnackbar);const[r,n]=F.useState(new Date().toISOString()),[i,a]=F.useState({time:[]}),[o,s]=F.useState([]),l=f=>Un("/cloud-stats/scatterplot",f,h=>a(yy(h,"responseTime"))),u=f=>Un("/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 gc(()=>{c()},5e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING}),F.useEffect(()=>{c()},[t]),W.jsxs(W.Fragment,{children:[W.jsx(l8,{}),W.jsx(Ll,{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:Rpt}},grid:{left:60,right:40},yAxis:Lpt({splitAxis:a,yAxisLabels:o}),series:hbe({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"}}}}}}),Npt=(e,t)=>({symbol:"none",label:{formatter:r=>`Run #${r.dataIndex+1}`,padding:[0,0,8,0]},lineStyle:{color:t?YA.DARK.axisColor:YA.LIGHT.axisColor},data:(e.markers||[]).map(r=>({xAxis:r}))}),zpt=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 Ll({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s}){const[l,u]=F.useState(null),c=hs(({theme:{isDarkMode:h}})=>h),f=F.useRef(null);return F.useEffect(()=>{if(!f.current)return;const h=_Je(f.current);h.setOption(Opt({charts:e,title:t,lines:r,colors:n,chartValueFormatter:i,splitAxis:a,yAxisLabels:o,scatterplot:s})),h.on("datazoom",zpt(h));const d=()=>h.resize();return window.addEventListener("resize",d),h.group="swarmCharts",bJe("swarmCharts"),u(h),()=>{SJe(h),window.removeEventListener("resize",d)}},[f]),F.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:Npt(e,c)}:{}}))})},[e,l,r,c]),F.useEffect(()=>{if(l){const{textColor:h,axisColor:d,backgroundColor:p,splitLine:v}=c?YA.DARK:YA.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]),F.useEffect(()=>{l&&l.setOption({series:hbe({charts:e,lines:r,scatterplot:s})})},[r]),H.jsx("div",{ref:f,style:{width:"100%",height:"300px"}})}const Bpt=tu.percentilesToChart?tu.percentilesToChart.map(e=>({name:`${e*100}th percentile`,key:`responseTimePercentile${e}`})):[],Fpt=["#ff9f00","#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],Vpt=[{title:"Total Requests per Second",lines:[{name:"RPS",key:"currentRps"},{name:"Failures/s",key:"currentFailPerSec"}],colors:["#00ca5a","#ff6d6d"]},{title:"Response Times (ms)",lines:Bpt,colors:Fpt},{title:"Number of Users",lines:[{name:"Number of Users",key:"userCount"}],colors:["#0099ff"]}];function $pt({charts:e}){return H.jsx("div",{children:Vpt.map((t,r)=>H.jsx(Ll,{...t,charts:e},`swarm-chart-${r}`))})}const Gpt=({ui:{charts:e}})=>({charts:e}),Wpt=Oa(Gpt)($pt);function Hpt(e){return(e*100).toFixed(1)+"%"}function wF({classRatio:e}){return H.jsx("ul",{children:Object.entries(e).map(([t,{ratio:r,tasks:n}])=>H.jsxs("li",{children:[`${Hpt(r)} ${t}`,n&&H.jsx(wF,{classRatio:n})]},`nested-ratio-${t}`))})}function jpt({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(wF,{classRatio:e})]}),t&&H.jsxs(H.Fragment,{children:[H.jsx("h3",{children:"Total Ratio"}),H.jsx(wF,{classRatio:t})]})]})}const Upt=({ui:{ratios:e}})=>({ratios:e}),Ypt=Oa(Upt)(jpt),Xpt=[{key:"id",title:"Worker"},{key:"state",title:"State"},{key:"userCount",title:"# users"},{key:"cpuUsage",title:"CPU usage"},{key:"memoryUsage",title:"Memory usage",formatter:tWe}];function qpt({workers:e=[]}){return H.jsx(bh,{defaultSortKey:"id",rows:e,structure:Xpt})}const Zpt=({ui:{workers:e}})=>({workers:e}),Kpt=Oa(Zpt)(qpt),Os={stats:{component:LUe,key:"stats",title:"Statistics"},charts:{component:Wpt,key:"charts",title:"Charts"},failures:{component:pUe,key:"failures",title:"Failures"},exceptions:{component:cUe,key:"exceptions",title:"Exceptions"},ratios:{component:Ypt,key:"ratios",title:"Current Ratio"},reports:{component:bUe,key:"reports",title:"Download Data"},logs:{component:mUe,key:$pe,title:"Logs"},workers:{component:Kpt,key:"workers",title:"Workers",shouldDisplayTab:e=>e.swarm.isDistributed}},dbe=[Os.stats,Os.charts,Os.failures,Os.exceptions,Os.ratios,Os.reports,Os.logs,Os.workers],Qpt=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)},Jpt=()=>window.location.search?eWe(window.location.search):null,evt={query:Jpt()},pbe=Bo({name:"url",initialState:evt,reducers:{setUrl:v1}}),tvt=pbe.actions,rvt=pbe.reducer;function nvt({hasNotification:e,title:t}){return H.jsxs(jt,{sx:{display:"flex",alignItems:"center"},children:[e&&H.jsx(NG,{color:"secondary"}),H.jsx("span",{children:t})]})}function ivt({currentTabIndexFromQuery:e,notification:t,setNotification:r,setUrl:n,tabs:i}){const[a,o]=F.useState(e),s=(l,u)=>{const c=i[u].key;t[c]&&r({[c]:!1}),Qpt({tab:c}),n({query:{tab:c}}),o(u)};return F.useEffect(()=>{o(e)},[e]),H.jsxs(Fv,{maxWidth:"xl",children:[H.jsx(jt,{sx:{mb:2},children:H.jsx(BFe,{onChange:s,value:a,children:i.map(({key:l,title:u},c)=>H.jsx(F4e,{label:H.jsx(nvt,{hasNotification:t[l],title:u})},`tab-${c}`))})}),i.map(({component:l=oUe},u)=>a===u&&H.jsx(l,{},`tabpabel-${u}`))]})}const avt=(e,{tabs:t,extendedTabs:r})=>{const{notification:n,swarm:{extendedTabs:i},url:{query:a}}=e,o=(t||[...dbe,...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}},ovt={setNotification:Wpe.setNotification,setUrl:tvt.setUrl},vbe=Oa(avt,ovt)(ivt),svt=e=>Y$({palette:{mode:e,primary:{main:"#15803d"},success:{main:"#00C853"}},components:{MuiCssBaseline:{styleOverrides:{":root":{"--footer-height":"40px"}}}}});function gbe(){const e=hs(({theme:{isDarkMode:t}})=>t);return F.useMemo(()=>svt(e?eu.DARK:eu.LIGHT),[e])}var Xte;const lvt={totalRps:0,failRatio:0,startTime:"",stats:[],errors:[],exceptions:[],charts:(Xte=tu.history)==null?void 0:Xte.reduce(pP,{}),ratios:{},userCount:0};var qte;const uvt=(qte=tu.percentilesToChart)==null?void 0:qte.reduce((e,t)=>({...e,[`responseTimePercentile${t}`]:{value:null}}),{}),cvt=e=>pP(e,{...uvt,currentRps:{value:null},currentFailPerSec:{value:null},totalAvgResponseTime:{value:null},userCount:{value:null},time:""}),ybe=Bo({name:"ui",initialState:lvt,reducers:{setUi:v1,updateCharts:(e,{payload:t})=>({...e,charts:pP(e.charts,t)}),updateChartMarkers:(e,{payload:t})=>({...e,charts:{...cvt(e.charts),markers:e.charts.markers?[...e.charts.markers,t]:[(e.charts.time||[""])[0],t]}})}}),jb=ybe.actions,fvt=ybe.reducer;function mbe(){const{data:e,refetch:t}=QWe(),r=Hu(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;F.useEffect(()=>{e&&r({exceptions:e.exceptions})},[e]),gc(t,5e3,{shouldRunInterval:i})}const Zte=2e3;function xbe(){const e=Hu(vP.setSwarm),t=Hu(jb.setUi),r=Hu(jb.updateCharts),n=Hu(jb.updateChartMarkers),i=hs(({swarm:h})=>h),a=F.useRef(i.state),[o,s]=F.useState(!1),{data:l,refetch:u}=ZWe(),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)};F.useEffect(()=>{l&&e({state:l.state})},[l&&l.state]),gc(f,Zte,{shouldRunInterval:!!l&&c}),gc(u,Zte,{shouldRunInterval:c}),F.useEffect(()=>{i.state===ur.RUNNING&&a.current===ur.STOPPED&&s(!0),a.current=i.state},[i.state,a])}function _be(){const{data:e,refetch:t}=KWe(),r=Hu(jb.setUi),n=hs(({swarm:a})=>a.state),i=n===ur.SPAWNING||n==ur.RUNNING;F.useEffect(()=>{e&&r({ratios:e})},[e]),gc(t,5e3,{shouldRunInterval:i})}function hvt({swarmState:e,tabs:t,extendedTabs:r}){xbe(),mbe(),_be(),Upe();const n=gbe();return H.jsxs(b6e,{theme:n,children:[H.jsx(y6e,{}),H.jsx(IHe,{children:e===ur.READY?H.jsx(EG,{}):H.jsx(vbe,{extendedTabs:r,tabs:t})})]})}const dvt=({swarm:{state:e}})=>({swarmState:e});Oa(dvt)(hvt);const pvt=xG({[YI.reducerPath]:YI.reducer,logViewer:RHe,notification:kHe,swarm:rHe,theme:ZGe,ui:fvt,url:rvt}),vvt=MGe({reducer:pvt,middleware:e=>e().concat(YI.middleware)});var CF={},Kte=F6;CF.createRoot=Kte.createRoot,CF.hydrateRoot=Kte.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 gvt=typeof Symbol=="function"&&Symbol.observable||"@@observable",Qte=gvt,LN=()=>Math.random().toString(36).substring(7).split("").join("."),yvt={INIT:`@@redux/INIT${LN()}`,REPLACE:`@@redux/REPLACE${LN()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${LN()}`},XA=yvt;function n8(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 bbe(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(bbe)(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(!n8(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:XA.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)}},[Qte](){return this}}}return h({type:XA.INIT}),{dispatch:h,subscribe:f,getState:c,replaceReducer:d,[Qte]:p}}function mvt(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:XA.INIT})>"u")throw new Error(ti(12));if(typeof r(void 0,{type:XA.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ti(13))})}function Sbe(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{mvt(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 qA(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function xvt(...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=qA(...s)(i.dispatch),{...i,dispatch:a}}}function _vt(e){return n8(e)&&"type"in e&&typeof e.type=="string"}var wbe=Symbol.for("immer-nothing"),Jte=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 Tc(e){var t;return e?Cbe(e)||Array.isArray(e)||!!e[Jte]||!!((t=e.constructor)!=null&&t[Jte])||lL(e)||uL(e):!1}var bvt=Object.prototype.constructor.toString();function Cbe(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)===bvt}function ZA(e,t){sL(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function sL(e){const t=e[oo];return t?t.type_:Array.isArray(e)?1:lL(e)?2:uL(e)?3:0}function TF(e,t){return sL(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Tbe(e,t,r){const n=sL(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Svt(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function lL(e){return e instanceof Map}function uL(e){return e instanceof Set}function rp(e){return e.copy_||e.base_}function MF(e,t){if(lL(e))return new Map(e);if(uL(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Cbe(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 i8(e,t=!1){return cL(e)||Mv(e)||!Tc(e)||(sL(e)>1&&(e.set=e.add=e.clear=e.delete=wvt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>i8(n,!0))),e}function wvt(){Fs(2)}function cL(e){return Object.isFrozen(e)}var Cvt={};function Iv(e){const t=Cvt[e];return t||Fs(0,e),t}var _w;function Mbe(){return _w}function Tvt(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ere(e,t){t&&(Iv("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function IF(e){AF(e),e.drafts_.forEach(Mvt),e.drafts_=null}function AF(e){e===_w&&(_w=e.parent_)}function tre(e){return _w=Tvt(_w,e)}function Mvt(e){const t=e[oo];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function rre(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[oo].modified_&&(IF(t),Fs(4)),Tc(e)&&(e=KA(t,e),t.parent_||QA(t,e)),t.patches_&&Iv("Patches").generateReplacementPatches_(r[oo].base_,e,t.patches_,t.inversePatches_)):e=KA(t,r,[]),IF(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wbe?e:void 0}function KA(e,t,r){if(cL(t))return t;const n=t[oo];if(!n)return ZA(t,(i,a)=>nre(e,n,t,i,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return QA(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),ZA(a,(s,l)=>nre(e,n,i,s,l,r,o)),QA(e,i,!1),r&&e.patches_&&Iv("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function nre(e,t,r,n,i,a,o){if(Mv(i)){const s=a&&t&&t.type_!==3&&!TF(t.assigned_,n)?a.concat(n):void 0,l=KA(e,i,s);if(Tbe(r,n,l),Mv(l))e.canAutoFreeze_=!1;else return}else o&&r.add(i);if(Tc(i)&&!cL(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;KA(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&QA(e,i)}}function QA(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&i8(t,r)}function Ivt(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Mbe(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=a8;r&&(i=[n],a=bw);const{revoke:o,proxy:s}=Proxy.revocable(i,a);return n.draft_=s,n.revoke_=o,s}var a8={get(e,t){if(t===oo)return e;const r=rp(e);if(!TF(r,t))return Avt(e,r,t);const n=r[t];return e.finalized_||!Tc(n)?n:n===RN(e.base_,t)?(EN(e),e.copy_[t]=DF(n,e)):n},has(e,t){return t in rp(e)},ownKeys(e){return Reflect.ownKeys(rp(e))},set(e,t,r){const n=Ibe(rp(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=RN(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(Svt(r,i)&&(r!==void 0||TF(e.base_,t)))return!0;EN(e),kF(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 RN(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,EN(e),kF(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={};ZA(a8,(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 a8.set.call(this,e[0],t,r,e[0])};function RN(e,t){const r=e[oo];return(r?rp(r):e)[t]}function Avt(e,t,r){var i;const n=Ibe(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function Ibe(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 kF(e){e.modified_||(e.modified_=!0,e.parent_&&kF(e.parent_))}function EN(e){e.copy_||(e.copy_=MF(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var kvt=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(Tc(t)){const a=tre(this),o=DF(t,void 0);let s=!0;try{i=r(o),s=!1}finally{s?IF(a):AF(a)}return ere(a,n),rre(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===wbe&&(i=void 0),this.autoFreeze_&&i8(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){Tc(e)||Fs(8),Mv(e)&&(e=Dvt(e));const t=tre(this),r=DF(e,void 0);return r[oo].isManual_=!0,AF(t),r}finishDraft(e,t){const r=e&&e[oo];(!r||!r.isManual_)&&Fs(9);const{scope_:n}=r;return ere(n,t),rre(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 DF(e,t){const r=lL(e)?Iv("MapSet").proxyMap_(e,t):uL(e)?Iv("MapSet").proxySet_(e,t):Ivt(e,t);return(t?t.scope_:Mbe()).drafts_.push(r),r}function Dvt(e){return Mv(e)||Fs(10,e),Abe(e)}function Abe(e){if(!Tc(e)||cL(e))return e;const t=e[oo];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=MF(e,t.scope_.immer_.useStrictShallowCopy_)}else r=MF(e,!0);return ZA(r,(n,i)=>{Tbe(r,n,Abe(i))}),t&&(t.finalized_=!1),r}var so=new kvt,kbe=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 Dbe(e){return({dispatch:r,getState:n})=>i=>a=>typeof a=="function"?a(r,n,e):i(a)}var Pvt=Dbe(),Lvt=Dbe,Rvt=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?qA:qA.apply(null,arguments)};function ire(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=>_vt(n)&&n.type===e,r}var Pbe=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 are(e){return Tc(e)?kbe(e,()=>{}):e}function ore(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 Evt(e){return typeof e=="boolean"}var Ovt=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:i=!0,actionCreatorCheck:a=!0}=t??{};let o=new Pbe;return r&&(Evt(r)?o.push(Pvt):o.push(Lvt(r.extraArgument))),o},Nvt="RTK_autoBatch",Lbe=e=>t=>{setTimeout(t,e)},zvt=typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Lbe(10),Bvt=(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"?zvt:e.type==="callback"?e.queueNotification:Lbe(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[Nvt]),a=!i,a&&(o||(o=!0,l(u))),n.dispatch(c)}finally{i=!0}}})},Fvt=e=>function(r){const{autoBatch:n=!0}=r??{};let i=new Pbe(e);return n&&i.push(Bvt(typeof n=="object"?n:void 0)),i};function Vvt(e){const t=Ovt(),{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(n8(r))s=Sbe(r);else throw new Error(Xs(1));let l;typeof n=="function"?l=n(t):l=t();let u=qA;i&&(u=Rvt({trace:!1,...typeof i=="object"&&i}));const c=xvt(...l),f=Fvt(c);let h=typeof o=="function"?o(f):f();const d=u(...h);return bbe(s,a,d)}function Rbe(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 $vt(e){return typeof e=="function"}function Gvt(e,t){let[r,n,i]=Rbe(t),a;if($vt(e))a=()=>are(e());else{const s=are(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(Tc(c))return kbe(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 Wvt=Symbol.for("rtk-slice-createasyncthunk");function Hvt(e,t){return`${e}/${t}`}function jvt({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[Wvt];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(Yvt()):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:Hvt(a,x),createNotation:typeof i.reducers=="function"};qvt(_)?Kvt(S,_,c,t):Xvt(S,_,c)});function f(){const[x={},_=[],S=void 0]=typeof i.extraReducers=="function"?Rbe(i.extraReducers):[i.extraReducers],b={...x,...u.sliceCaseReducersByType};return Gvt(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=ore(d,_,{insert:()=>new WeakMap});return ore(C,w,{insert:()=>{const T={};for(const[M,I]of Object.entries(i.selectors??{}))T[M]=Uvt(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 Uvt(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 o8=jvt();function Yvt(){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 Xvt({type:e,reducerName:t,createNotation:r},n,i){let a,o;if("reducer"in n){if(r&&!Zvt(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?ire(e,o):ire(e))}function qvt(e){return e._reducerDefinitionType==="asyncThunk"}function Zvt(e){return e._reducerDefinitionType==="reducerWithPrepare"}function Kvt({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 s8(e,{payload:t}){return{...e,...t}}const Qvt={message:null},Ebe=o8({name:"snackbar",initialState:Qvt,reducers:{setSnackbar:s8}}),z0=Ebe.actions,Jvt=Ebe.reducer,egt={resolution:5,testruns:{},currentTestrunIndex:0,testrunsForDisplay:[]},Obe=o8({name:"toolbar",initialState:egt,reducers:{setToolbar:s8}}),Nbe=Obe.actions,tgt=Obe.reducer,cm={CLOUD:"CLOUD",CLASSIC:"CLASSIC"},rgt={viewType:cm.CLOUD},zbe=o8({name:"ui",initialState:rgt,reducers:{setUi:s8}}),ngt=zbe.actions,igt=zbe.reducer,Bbe=F.createContext(null),agt=Sbe({snackbar:Jvt,toolbar:tgt,ui:igt}),Fbe=Vvt({reducer:agt,middleware:e=>e()}),Dh=Zk,Tu=Iue(Bbe),ogt=()=>e=>Fbe.dispatch(e);function Mc(e,t){const r=ogt();return F.useCallback(n=>{r(e(n))},[e,r])}function sgt(){const e=Dh(({swarm:r})=>r.state),t=Tu(({ui:r})=>r.viewType);return e===ur.READY?null:W.jsxs(jt,{sx:{display:"flex",columnGap:2,marginY:"auto",height:"50px"},children:[e===ur.STOPPED?W.jsx(zpe,{}):W.jsxs(W.Fragment,{children:[W.jsx(Ope,{}),W.jsx(Fpe,{})]}),t==cm.CLASSIC&&W.jsx(Bpe,{})]})}function lgt(){return W.jsx(Khe,{position:"static",children:W.jsx(Fv,{maxWidth:"xl",children:W.jsxs(Lde,{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(tpe,{})}),W.jsxs(jt,{sx:{display:"flex",columnGap:6},children:[!window.templateArgs.isGraphViewer&&W.jsxs(W.Fragment,{children:[W.jsx(Tpe,{}),W.jsx(sgt,{})]}),W.jsx(_pe,{})]})]})})})}function ugt(){const e=Mc(ngt.setUi),{viewType:t}=Tu(({ui:n})=>n),r=t===cm.CLOUD?cm.CLASSIC:cm.CLOUD;return W.jsx(Fv,{maxWidth:"xl",sx:{position:"relative"},children:W.jsx(_u,{onClick:()=>e({viewType:r}),sx:{position:"absolute",mt:"4px",right:16,zIndex:1},children:r})})}function cgt({children:e}){const t=Dh(({swarm:r})=>r.state);return W.jsxs(W.Fragment,{children:[W.jsx(lgt,{}),!window.templateArgs.isGraphViewer&&t!==ur.READY&&W.jsx(ugt,{}),W.jsx("main",{children:e})]})}function fgt(){const e=F.useCallback(()=>r({message:null}),[]),t=Tu(({snackbar:n})=>n.message),r=Mc(z0.setSnackbar);return W.jsx(m4e,{autoHideDuration:5e3,onClose:e,open:!!t,children:W.jsx(Zhe,{onClose:e,severity:"error",sx:{width:"100%"},variant:"filled",children:t})})}const Vbe="5",hgt=["1","2",Vbe,"10","30"],dgt=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 l8({onSelectTestRun:e}){const t=Mc(Nbe.setToolbar),{testruns:r,testrunsForDisplay:n}=Tu(({toolbar:a})=>a),i=a=>{e&&e(a.target.value);const o=r[a.target.value];t({currentTestrun:o.runId,currentTestrunIndex:o.index}),dgt({testrun:a.target.value})};return W.jsxs(jt,{sx:{display:"flex",columnGap:2,mb:1},children:[W.jsx(jS,{defaultValue:Vbe,label:"Resolution",name:"resolution",onChange:a=>t({resolution:Number(a.target.value)}),options:hgt,size:"small",sx:{width:"150px"}}),!!n.length&&W.jsx(jS,{label:"Test Run",name:"testrun",onChange:i,options:n,size:"small",sx:{width:"250px"}})]})}const pgt=e=>e?e.split(";").map(t=>t.trim().split("=")).reduce((t,[r,n])=>({...t,[r]:n}),{}):{},vgt=e=>typeof document<"u"&&pgt(document.cookie)[e];function Un(e,t,r,n){fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${vgt("cognito_token")}`},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:[]},ggt={time:[]},Vg={RPS:["#00ca5a","#0099ff","#ff6d6d"],PER_REQUEST:["#9966CC","#8A2BE2","#8E4585","#E0B0FF","#C8A2C8","#E6E6FA"],ERROR:["#ff8080","#ff4d4d","#ff1a1a","#e60000","#b30000","#800000"]},ygt=["Users","RPS"],mgt=[{name:"Users",key:"users",yAxisIndex:0},{name:"Requests per Second",key:"rps",yAxisIndex:1,areaStyle:{}},{name:"Errors per Second",key:"errorRate",yAxisIndex:1,areaStyle:{}}],xgt=e=>e?e[e.length-1][1]:"0";function $be(){const{state:e}=Dh(({swarm:R})=>R),{resolution:t,currentTestrunIndex:r,currentTestrun:n,testruns:i}=Tu(({toolbar:R})=>R);Mc(z0.setSnackbar);const[a,o]=F.useState(!0),[s,l]=F.useState(!1),[u,c]=F.useState(new Date().toISOString()),[f,h]=F.useState([]),[d,p]=F.useState(ggt),[v,g]=F.useState(e_),[y,m]=F.useState(e_),[x,_]=F.useState(e_),[S,b]=F.useState(e_),[w,C]=F.useState(e_),T=R=>Un("/cloud-stats/request-names",R,B=>{(r!==0&&!B.length||r===0&&e!==ur.RUNNING&&!B.length)&&l(!0),h(B.map(({name:E})=>({name:`${E}`,key:E})))}),M=R=>Un("/cloud-stats/rps",R,B=>p(B.reduce((E,{users:G,rps:j,errorRate:V,time:U})=>({users:[...E.users||[],[U,G||xgt(E.users)]],rps:[...E.rps||[],[U,j||"0"]],errorRate:[...E.errorRate||[],[U,V||"0"]],time:[...E.time||[],U]}),{}))),I=R=>Un("/cloud-stats/rps-per-request",R,B=>g(yy(B,"throughput"))),A=R=>Un("/cloud-stats/avg-response-times",R,B=>{m(yy(B,"responseTime")),a&&o(!1)}),k=R=>Un("/cloud-stats/errors-per-request",R,B=>_(yy(B,"errorRate"))),D=R=>Un("/cloud-stats/perc99-response-times",R,B=>b(yy(B,"perc99"))),P=R=>Un("/cloud-stats/response-length",R,B=>C(yy(B,"responseLength"))),L=R=>{if(n){const B=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(B)}};gc(L,1e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING,immediate:!0}),F.useEffect(()=>{if(n){const{endTime:R}=i[new Date(n).toLocaleString()];L(R)}else L()},[n,t]),F.useEffect(()=>{e===ur.RUNNING&&o(!0)},[e]);const O=F.useCallback(()=>{o(!0),l(!1)},[]);return W.jsxs(W.Fragment,{children:[W.jsx(l8,{onSelectTestRun:O}),s&&W.jsx(Zhe,{severity:"error",children:"There was a problem loading some graphs for this testrun."}),W.jsxs(jt,{sx:{position:"relative"},children:[a&&W.jsx(jt,{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(Ize,{})}),W.jsx(Ll,{chartValueFormatter:kf,charts:d,colors:Vg.RPS,lines:mgt,splitAxis:!0,title:"Throughput / active users",yAxisLabels:ygt}),(!s||s&&!!f.length)&&W.jsxs(W.Fragment,{children:[W.jsx(Ll,{chartValueFormatter:R=>`${Of(Number(R[1]),2)}ms`,charts:y,colors:Vg.PER_REQUEST,lines:f,title:"Average Response Times"}),W.jsx(Ll,{chartValueFormatter:kf,charts:v,colors:Vg.PER_REQUEST,lines:f,title:"RPS per Request"}),W.jsx(Ll,{chartValueFormatter:kf,charts:x,colors:Vg.ERROR,lines:f,title:"Errors per Request"}),W.jsx(Ll,{chartValueFormatter:kf,charts:S,colors:Vg.PER_REQUEST,lines:f,title:"99th Percentile Response Times"}),W.jsx(Ll,{chartValueFormatter:kf,charts:w,colors:Vg.PER_REQUEST,lines:f,title:"Response Length"})]})]})]})}function Gbe(){const e=Dh(({swarm:f})=>f.state),{currentTestrun:t}=Tu(({toolbar:f})=>f);Mc(z0.setSnackbar);const[r,n]=F.useState(new Date().toISOString()),[i,a]=F.useState({time:[]}),[o,s]=F.useState([]),l=f=>Un("/cloud-stats/scatterplot",f,h=>a(yy(h,"responseTime"))),u=f=>Un("/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 gc(()=>{c()},5e3,{shouldRunInterval:e===ur.SPAWNING||e==ur.RUNNING}),F.useEffect(()=>{c()},[t]),W.jsxs(W.Fragment,{children:[W.jsx(l8,{}),W.jsx(Ll,{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-AJUA6nFW.js"></script>
11
+ <script type="module" crossorigin src="./assets/index-B-CH83Zq.js"></script>
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>