@wso2/am-core-ui 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  3. package/dist/CodeBlock-B2Ecl916.js +21736 -0
  4. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  5. package/dist/EnvironmentSelector-D8S6nO9u.js +48 -0
  6. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  7. package/dist/LabelChips-7rA7_yre.js +139 -0
  8. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  9. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  10. package/dist/ResourceListShell-DFisKftq.js +463 -0
  11. package/dist/SwaggerSpecViewer-DzjR6U6W.js +106 -0
  12. package/dist/clipboard-YAzStmkw.js +23 -0
  13. package/dist/debounce-D17ObVdG.js +208 -0
  14. package/dist/format-wlHhWjGo.js +29 -0
  15. package/dist/formatDistanceToNow-DyjnT7l9.js +100 -0
  16. package/dist/gatewayScripts-D4ZDEDPS.js +72 -0
  17. package/dist/highlight-BsUzxSR3.js +454 -0
  18. package/dist/{index-CnXsN5I3.js → index-3K-zqdp-.js} +34 -33
  19. package/dist/index-6liAPSDn.js +1564 -0
  20. package/dist/index-B3ASENUJ.js +1290 -0
  21. package/dist/index-B7Pf4oPq.js +3069 -0
  22. package/dist/index-BNO3FhZK.js +2304 -0
  23. package/dist/index-BUZSfCl5.js +335 -0
  24. package/dist/index-BXiG1r_o.js +1409 -0
  25. package/dist/index-BYy7Iaam.js +459 -0
  26. package/dist/index-BbB_yx4V.js +1397 -0
  27. package/dist/index-BjWJ95lH.js +2728 -0
  28. package/dist/index-ByEInFlf.js +26408 -0
  29. package/dist/index-C8WIhzyz.js +123 -0
  30. package/dist/index-CnzvaT6b.js +2368 -0
  31. package/dist/index-CrnCf-hJ.js +763 -0
  32. package/dist/index-Cvsho9xg.js +2346 -0
  33. package/dist/index-CxnAo1_c.js +119 -0
  34. package/dist/{index-DYV1jEai.js → index-Cz7-AZwE.js} +22 -20
  35. package/dist/index-DBdRFjxm.js +1264 -0
  36. package/dist/index-DFsSvmMZ.js +7981 -0
  37. package/dist/index-DslzOSGN.js +2549 -0
  38. package/dist/index-DvpYvchM.js +2341 -0
  39. package/dist/index-PWsNvJB-.js +546 -0
  40. package/dist/index.d.ts +1398 -481
  41. package/dist/index.js +539 -438
  42. package/dist/js-yaml-CvhD-clg.js +1335 -0
  43. package/dist/llmProviderPayload-BPzWDy7n.js +332 -0
  44. package/dist/schemas-DFScWdSL.js +2969 -0
  45. package/package.json +1 -1
  46. package/dist/index-B47EJCom.js +0 -236
  47. package/dist/index-Bl1Y7Sro.js +0 -3037
  48. package/dist/index-DlS9Lybj.js +0 -80691
@@ -0,0 +1,1409 @@
1
+ import { Plus as re, AlertTriangle as ve, GitBranch as He, Search as Ve, Edit as be, Trash as pe, ArrowRight as je, PlusCircle as yn, Server as qe, EyeOff as Ke, Eye as Xe, Copy as Ce, DoorClosedLocked as vn, KeyRound as Te, ServerCrash as bn } from "@wso2/oxygen-ui-icons-react";
2
+ import { jsxs as i, jsx as e, Fragment as te } from "react/jsx-runtime";
3
+ import { c as ae } from "react/compiler-runtime";
4
+ import { useState as D, useMemo as F, useEffect as K, useCallback as _ } from "react";
5
+ import { useParams as oe, useSearchParams as Cn, Route as ie, Routes as Ye, Navigate as Je, useNavigate as Qe, generatePath as he } from "react-router-dom";
6
+ import { F as Ze, G as we, L as wn, cf as xn, O as en, y as xe, cg as Pn, t as le, D as se, s as ce, ch as Nn, P as Pe, M as nn, g as me, ci as En, bF as tn, cj as Tn, x as Se, aw as Sn, ck as kn, w as In, cl as Dn, cm as ke } from "./index-ByEInFlf.js";
7
+ import "@tanstack/react-query";
8
+ import { Stack as b, Box as M, SearchBar as rn, Button as O, ListingTable as s, Alert as B, Skeleton as R, Avatar as ue, Typography as I, Tooltip as L, IconButton as W, TablePagination as an, Chip as ne, Form as $, Menu as zn, MenuItem as ge, FormControl as j, FormLabel as q, TextField as J, Collapse as Rn, FormControlLabel as on, Checkbox as ln, Select as Ie, Grid as Y, Card as sn, CardContent as cn } from "@wso2/oxygen-ui";
9
+ import { f as Ne } from "./formatDistanceToNow-DyjnT7l9.js";
10
+ import { g as fe, a as An } from "./IsolationTierIndicator-cf90kgjL.js";
11
+ import { o as Ee, c as _n, s as V, _ as Ln, b as dn } from "./schemas-DFScWdSL.js";
12
+ import { a as Mn, g as ye, G as Fn } from "./gatewayScripts-D4ZDEDPS.js";
13
+ import { g as On } from "./format-wlHhWjGo.js";
14
+ import { c as Bn } from "./clipboard-YAzStmkw.js";
15
+ function hn(n) {
16
+ if (n.length === 0)
17
+ return {
18
+ valid: !1,
19
+ error: "Pipeline has no promotion paths defined"
20
+ };
21
+ const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
22
+ for (const p of n) {
23
+ const c = p.targetEnvironmentRefs.map((d) => d.name).filter(Boolean);
24
+ c.length !== 0 && (t.set(p.sourceEnvironmentRef, c), c.forEach((d) => r.add(d)));
25
+ }
26
+ if (t.size === 0)
27
+ return {
28
+ valid: !0,
29
+ chain: n.map((p) => p.sourceEnvironmentRef).filter(Boolean)
30
+ };
31
+ const a = new Set(t.keys()), o = [...a].filter((p) => !r.has(p));
32
+ if (o.length === 0)
33
+ return {
34
+ valid: !1,
35
+ error: "Promotion paths contain a cycle — no starting environment found"
36
+ };
37
+ if (o.length > 1)
38
+ return {
39
+ valid: !1,
40
+ error: `Promotion paths are disconnected — ${o.length} separate starting environments (${o.join(", ")})`
41
+ };
42
+ const h = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set();
43
+ function m(p) {
44
+ h.add(p), l.add(p);
45
+ for (const c of t.get(p) ?? [])
46
+ if (h.has(c)) {
47
+ if (l.has(c))
48
+ return !0;
49
+ } else if (m(c)) return !0;
50
+ return l.delete(p), !1;
51
+ }
52
+ if (m(o[0]))
53
+ return {
54
+ valid: !1,
55
+ error: "Promotion paths contain a cycle"
56
+ };
57
+ const g = [...a].filter((p) => !h.has(p));
58
+ if (g.length > 0)
59
+ return {
60
+ valid: !1,
61
+ error: `Promotion paths are disconnected — environments not reachable from root: ${g.join(", ")}`
62
+ };
63
+ const f = [];
64
+ let y = o[0];
65
+ for (; y; )
66
+ f.push(y), y = (t.get(y) ?? [])[0];
67
+ return {
68
+ valid: !0,
69
+ chain: f
70
+ };
71
+ }
72
+ function $n({
73
+ pipeline: n,
74
+ envMap: t
75
+ }) {
76
+ const r = F(() => hn(n.promotionPaths), [n.promotionPaths]);
77
+ if (!r.valid)
78
+ return /* @__PURE__ */ e(L, { title: r.error, children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, alignItems: "center", sx: {
79
+ cursor: "default"
80
+ }, children: [
81
+ /* @__PURE__ */ e(ve, { size: 14, color: "var(--oxygen-palette-warning-main)" }),
82
+ /* @__PURE__ */ e(I, { variant: "body2", color: "warning.main", children: "Invalid paths" })
83
+ ] }) });
84
+ const a = r.chain ?? [];
85
+ return /* @__PURE__ */ e(b, { direction: "row", spacing: 0.5, alignItems: "center", flexWrap: "wrap", children: a.map((o, h) => {
86
+ const l = t.get(o), m = fe(l?.isolationTier), g = m.icon;
87
+ return /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, alignItems: "center", children: [
88
+ /* @__PURE__ */ e(L, { title: m.fullLabel, children: /* @__PURE__ */ e(ne, { icon: /* @__PURE__ */ e(g, { size: 14 }), label: /* @__PURE__ */ i(I, { component: "span", children: [
89
+ /* @__PURE__ */ e(I, { variant: "body2", component: "span", children: l?.displayName ?? o }),
90
+ l?.isProduction && /* @__PURE__ */ e(I, { component: "span", variant: "caption", children: " (Production)" })
91
+ ] }), variant: "outlined", sx: {
92
+ "& .MuiChip-icon": {
93
+ color: m.iconColor
94
+ }
95
+ } }) }),
96
+ h < a.length - 1 && /* @__PURE__ */ e(je, { size: 12 })
97
+ ] }, o);
98
+ }) });
99
+ }
100
+ function Wn({
101
+ onEditPipeline: n,
102
+ onCreatePipeline: t
103
+ }) {
104
+ const {
105
+ orgId: r
106
+ } = oe(), [a, o] = D(""), [h, l] = D(0), [m, g] = D(5), [f, y] = D(null), {
107
+ data: p,
108
+ isLoading: c,
109
+ error: d
110
+ } = Ze({
111
+ orgName: r
112
+ }), {
113
+ data: C
114
+ } = we({
115
+ orgName: r
116
+ }), {
117
+ addConfirmation: P
118
+ } = wn(), {
119
+ mutate: x
120
+ } = xn(), N = F(() => {
121
+ const u = /* @__PURE__ */ new Map();
122
+ return (C ?? []).forEach((E) => {
123
+ u.set(E.name, {
124
+ displayName: E.displayName,
125
+ isProduction: E.isProduction,
126
+ isolationTier: E.isolationTier
127
+ });
128
+ }), u;
129
+ }, [C]), T = F(() => p?.deploymentPipelines ?? [], [p?.deploymentPipelines]), S = F(() => {
130
+ const u = a.toLowerCase();
131
+ return u ? T.filter((E) => E.name.toLowerCase().includes(u) || E.displayName.toLowerCase().includes(u)) : T;
132
+ }, [T, a]);
133
+ K(() => {
134
+ h !== 0 && h * m >= S.length && l(0);
135
+ }, [S.length, h, m]);
136
+ const k = /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
137
+ /* @__PURE__ */ e(M, { flexGrow: 1, children: /* @__PURE__ */ e(rn, { value: a, onChange: (u) => {
138
+ o(u.target.value), l(0);
139
+ }, placeholder: "Search pipelines...", size: "small", fullWidth: !0, disabled: c }) }),
140
+ t && T.length > 0 && /* @__PURE__ */ e(O, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Pipeline" })
141
+ ] });
142
+ if (d)
143
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
144
+ k,
145
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ i(B, { severity: "error", icon: /* @__PURE__ */ e(ve, { size: 18 }), sx: {
146
+ alignSelf: "stretch"
147
+ }, children: [
148
+ "Failed to load pipelines.",
149
+ " ",
150
+ d instanceof Error ? d.message : "Please try again."
151
+ ] }) })
152
+ ] });
153
+ if (c)
154
+ return /* @__PURE__ */ i(te, { children: [
155
+ k,
156
+ /* @__PURE__ */ e(s.Container, { disablePaper: !0, children: /* @__PURE__ */ e(b, { spacing: 1, mt: 1, children: Array.from({
157
+ length: m
158
+ }).map((u, E) => /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, sx: {
159
+ px: 2,
160
+ py: 1.5,
161
+ borderRadius: 1,
162
+ border: "1px solid",
163
+ borderColor: "divider",
164
+ bgcolor: "background.paper"
165
+ }, children: [
166
+ /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1.5, sx: {
167
+ width: 280,
168
+ flexShrink: 0
169
+ }, children: [
170
+ /* @__PURE__ */ e(R, { variant: "circular", width: 36, height: 36 }),
171
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 20 })
172
+ ] }),
173
+ /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, sx: {
174
+ flex: 1
175
+ }, children: [
176
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 72, height: 24 }),
177
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 72, height: 24 })
178
+ ] }),
179
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 100, height: 24, sx: {
180
+ flexShrink: 0,
181
+ ml: "auto"
182
+ } })
183
+ ] }, E)) }) })
184
+ ] });
185
+ if (T.length === 0)
186
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
187
+ k,
188
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(He, { size: 64 }), title: "No deployment pipelines yet", description: "Deployment pipelines define the promotion path for your agents across environments.", action: t && /* @__PURE__ */ e(O, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Pipeline" }) }) })
189
+ ] });
190
+ if (S.length === 0)
191
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
192
+ k,
193
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(Ve, { size: 64 }), title: "No pipelines match your search", description: "Try a different keyword or clear the search filter." }) })
194
+ ] });
195
+ const v = S.slice(h * m, h * m + m);
196
+ return /* @__PURE__ */ i(te, { children: [
197
+ k,
198
+ /* @__PURE__ */ e(b, { pt: 4, children: /* @__PURE__ */ i(s.Container, { disablePaper: !0, children: [
199
+ /* @__PURE__ */ i(s, { variant: "card", children: [
200
+ /* @__PURE__ */ e(s.Head, { children: /* @__PURE__ */ i(s.Row, { children: [
201
+ /* @__PURE__ */ e(s.Cell, { width: "280px", children: "Pipeline" }),
202
+ /* @__PURE__ */ e(s.Cell, { children: "Promotion Chain" }),
203
+ /* @__PURE__ */ e(s.Cell, { align: "right", width: "160px", children: "Created" })
204
+ ] }) }),
205
+ /* @__PURE__ */ e(s.Body, { children: v.map((u) => /* @__PURE__ */ i(s.Row, { variant: "card", hover: !0, onMouseEnter: () => y(u.name), onMouseLeave: () => y(null), onFocus: () => y(u.name), onBlur: () => y(null), children: [
206
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, children: [
207
+ /* @__PURE__ */ e(ue, { sx: {
208
+ bgcolor: "primary.main",
209
+ color: "primary.contrastText",
210
+ fontSize: 16,
211
+ height: 36,
212
+ width: 36,
213
+ flexShrink: 0
214
+ }, children: u.displayName?.charAt(0)?.toUpperCase() ?? "P" }),
215
+ /* @__PURE__ */ e(I, { variant: "body2", fontWeight: 500, noWrap: !0, children: u.displayName })
216
+ ] }) }),
217
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e($n, { pipeline: u, envMap: N }) }),
218
+ /* @__PURE__ */ e(s.Cell, { align: "right", onClick: (E) => E.stopPropagation(), children: /* @__PURE__ */ e(b, { direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1, children: f === u.name ? /* @__PURE__ */ e(en, { children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, children: [
219
+ /* @__PURE__ */ e(L, { title: "Edit pipeline", children: /* @__PURE__ */ e(W, { size: "small", onClick: () => n?.(u), children: /* @__PURE__ */ e(be, { size: 16 }) }) }),
220
+ /* @__PURE__ */ e(L, { title: "Delete pipeline", children: /* @__PURE__ */ e(W, { size: "small", color: "error", onClick: () => P({
221
+ title: "Delete Deployment Pipeline",
222
+ description: `Are you sure you want to delete "${u.displayName}"? This action cannot be undone.`,
223
+ confirmButtonText: "Delete",
224
+ confirmButtonColor: "error",
225
+ confirmButtonIcon: /* @__PURE__ */ e(pe, { size: 16 }),
226
+ onConfirm: () => x({
227
+ orgName: r,
228
+ pipelineName: u.name
229
+ })
230
+ }), children: /* @__PURE__ */ e(pe, { size: 16 }) }) })
231
+ ] }) }) : /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", children: Ne(new Date(u.createdAt), {
232
+ addSuffix: !0
233
+ }) }) }) })
234
+ ] }, u.name)) })
235
+ ] }),
236
+ S.length > 5 && /* @__PURE__ */ e(an, { component: "div", count: S.length, page: h, rowsPerPage: m, onPageChange: (u, E) => l(E), onRowsPerPageChange: (u) => {
237
+ g(parseInt(u.target.value, 10)), l(0);
238
+ }, rowsPerPageOptions: [5, 10, 25] })
239
+ ] }) })
240
+ ] });
241
+ }
242
+ const mn = Ee({
243
+ displayName: V().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
244
+ description: V().optional(),
245
+ chain: _n(V().min(1, "Select an environment")).min(1, "Select at least one environment")
246
+ }), De = mn, ze = mn;
247
+ function pn(n) {
248
+ return n.length === 1 && n[0] ? [{
249
+ sourceEnvironmentRef: n[0],
250
+ targetEnvironmentRefs: []
251
+ }] : n.slice(0, -1).map((t, r) => ({
252
+ sourceEnvironmentRef: t,
253
+ targetEnvironmentRefs: [{
254
+ name: n[r + 1]
255
+ }]
256
+ }));
257
+ }
258
+ function Un(n, t, r) {
259
+ return n.filter((a) => r === "add" ? !t.includes(a.name) : !t.some((o, h) => h !== r && o === a.name));
260
+ }
261
+ function un({
262
+ chain: n,
263
+ envOptions: t,
264
+ onChange: r,
265
+ disabled: a
266
+ }) {
267
+ const [o, h] = D(null), l = _((c, d) => {
268
+ h({
269
+ el: c.currentTarget,
270
+ index: d
271
+ });
272
+ }, []), m = _((c) => {
273
+ if (o !== null) {
274
+ if (o.index === "add")
275
+ r([...n, c]);
276
+ else {
277
+ const d = [...n];
278
+ d[o.index] = c, r(d);
279
+ }
280
+ h(null);
281
+ }
282
+ }, [o, n, r]), g = _((c) => {
283
+ r(n.filter((d, C) => C !== c));
284
+ }, [n, r]), f = F(() => o ? Un(t, n, o.index) : [], [o, t, n]);
285
+ K(() => {
286
+ n.length === 0 && t.length > 0 && r([t[0].name]);
287
+ }, [t, n.length, r]);
288
+ const y = n.length > 1, p = n.length < t.length;
289
+ return /* @__PURE__ */ i($.Section, { children: [
290
+ /* @__PURE__ */ e($.Header, { children: "Promotion Chain" }),
291
+ /* @__PURE__ */ e(M, { sx: {
292
+ overflowX: "auto",
293
+ pb: 1,
294
+ mt: 1.5
295
+ }, children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", sx: {
296
+ minWidth: "max-content"
297
+ }, spacing: 0.5, children: [
298
+ n.map((c, d) => {
299
+ const C = t.find((N) => N.name === c), P = fe(C?.isolationTier), x = P.icon;
300
+ return /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 0.5, children: [
301
+ /* @__PURE__ */ e(L, { title: P.fullLabel, children: /* @__PURE__ */ e(ne, { icon: /* @__PURE__ */ e(x, { size: 14 }), label: /* @__PURE__ */ i(I, { children: [
302
+ /* @__PURE__ */ e(I, { variant: "body2", component: "span", children: C?.displayName ?? c }),
303
+ /* @__PURE__ */ e(I, { component: "span", variant: "caption", children: C?.isProduction ? " (Production)" : "" })
304
+ ] }), variant: "outlined", onClick: (N) => l(N, d), onDelete: y ? () => g(d) : void 0, disabled: a, sx: {
305
+ "& .MuiChip-icon": {
306
+ color: P.iconColor
307
+ }
308
+ } }) }),
309
+ d < n.length - 1 && /* @__PURE__ */ e(je, { size: 14 })
310
+ ] }, d);
311
+ }),
312
+ p && /* @__PURE__ */ e(L, { title: "Add environment", children: /* @__PURE__ */ e(W, { size: "medium", onClick: (c) => l(c, "add"), disabled: a, children: /* @__PURE__ */ e(yn, { size: 18 }) }) })
313
+ ] }) }),
314
+ /* @__PURE__ */ e(zn, { anchorEl: o?.el, open: !!o, onClose: () => h(null), children: f.length === 0 ? /* @__PURE__ */ e(ge, { disabled: !0, children: "No environments available" }) : f.map((c) => {
315
+ const d = fe(c.isolationTier), C = d.icon;
316
+ return /* @__PURE__ */ e(ge, { onClick: () => m(c.name), children: /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
317
+ /* @__PURE__ */ e(M, { display: "inline-flex", alignItems: "center", sx: {
318
+ color: d.iconColor
319
+ }, children: /* @__PURE__ */ e(C, { size: 14 }) }),
320
+ /* @__PURE__ */ i("span", { children: [
321
+ c.displayName ?? c.name,
322
+ " ",
323
+ c.isProduction ? "(Production)" : ""
324
+ ] })
325
+ ] }) }, c.name);
326
+ }) })
327
+ ] });
328
+ }
329
+ function Re(n) {
330
+ if (n.promotionPaths.length === 0) return [""];
331
+ const t = hn(n.promotionPaths);
332
+ if (t.valid && t.chain && t.chain.length >= 1)
333
+ return t.chain;
334
+ const r = n.promotionPaths.map((o) => o.sourceEnvironmentRef), a = n.promotionPaths[n.promotionPaths.length - 1]?.targetEnvironmentRefs[0]?.name ?? "";
335
+ return [...r, a];
336
+ }
337
+ function Gn({
338
+ open: n,
339
+ onClose: t,
340
+ pipeline: r,
341
+ orgId: a
342
+ }) {
343
+ const [o, h] = D(() => ({
344
+ displayName: r.displayName,
345
+ description: r.description ?? "",
346
+ chain: Re(r)
347
+ })), [l, m] = D(null), {
348
+ errors: g,
349
+ validateForm: f,
350
+ setFieldError: y,
351
+ validateField: p
352
+ } = xe(ze), {
353
+ mutateAsync: c,
354
+ isPending: d,
355
+ error: C,
356
+ reset: P
357
+ } = Pn(), {
358
+ data: x
359
+ } = we({
360
+ orgName: a
361
+ }), N = F(() => x ?? [], [x]);
362
+ K(() => {
363
+ n && (h({
364
+ displayName: r.displayName,
365
+ description: r.description ?? "",
366
+ chain: Re(r)
367
+ }), m(null), P());
368
+ }, [n, r, P]);
369
+ const T = _((u, E) => {
370
+ h((w) => {
371
+ const z = {
372
+ ...w,
373
+ [u]: E
374
+ };
375
+ return y(u, p(u, z[u], z)), z;
376
+ });
377
+ }, [y, p]), S = _(async (u) => {
378
+ u.preventDefault(), m(null);
379
+ const E = ze.safeParse(o);
380
+ if (!E.success) {
381
+ f(o);
382
+ return;
383
+ }
384
+ try {
385
+ await c({
386
+ params: {
387
+ orgName: a,
388
+ pipelineName: r.name
389
+ },
390
+ body: {
391
+ displayName: E.data.displayName.trim(),
392
+ description: E.data.description?.trim(),
393
+ promotionPaths: pn(E.data.chain)
394
+ }
395
+ }), t();
396
+ } catch {
397
+ }
398
+ }, [o, f, c, a, r.name, t]), k = F(() => l || (C ? C?.message ?? "Failed to update pipeline" : null), [l, C]), v = o.chain.every((u) => u !== "");
399
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
400
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(be, { size: 24 }), title: "Edit Deployment Pipeline", onClose: t }),
401
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: S, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
402
+ k && /* @__PURE__ */ e(B, { severity: "error", children: /* @__PURE__ */ e(I, { variant: "body2", children: k }) }),
403
+ /* @__PURE__ */ i($.Section, { children: [
404
+ /* @__PURE__ */ e($.Header, { children: "Pipeline Details" }),
405
+ /* @__PURE__ */ i($.Stack, { spacing: 2, children: [
406
+ /* @__PURE__ */ i(j, { fullWidth: !0, error: !!g.displayName, children: [
407
+ /* @__PURE__ */ e(q, { required: !0, children: "Display Name" }),
408
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", value: o.displayName, onChange: (u) => T("displayName", u.target.value), placeholder: "e.g., Production Pipeline", error: !!g.displayName, helperText: g.displayName, disabled: d })
409
+ ] }),
410
+ /* @__PURE__ */ i(j, { fullWidth: !0, children: [
411
+ /* @__PURE__ */ e(q, { children: "Description" }),
412
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: o.description ?? "", onChange: (u) => T("description", u.target.value), placeholder: "Optional description", disabled: d })
413
+ ] })
414
+ ] })
415
+ ] }),
416
+ /* @__PURE__ */ e(un, { chain: o.chain, envOptions: N, onChange: (u) => h((E) => ({
417
+ ...E,
418
+ chain: u
419
+ })), disabled: d }),
420
+ /* @__PURE__ */ i(M, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
421
+ /* @__PURE__ */ e(O, { variant: "outlined", color: "inherit", onClick: t, disabled: d, children: "Cancel" }),
422
+ /* @__PURE__ */ e(O, { type: "submit", variant: "contained", color: "primary", disabled: d || !v, children: d ? "Saving..." : "Save" })
423
+ ] })
424
+ ] }) }) })
425
+ ] });
426
+ }
427
+ const Ae = {
428
+ displayName: "",
429
+ description: "",
430
+ chain: []
431
+ };
432
+ function Hn({
433
+ open: n,
434
+ onClose: t,
435
+ orgId: r
436
+ }) {
437
+ const [a, o] = D(Ae), {
438
+ errors: h,
439
+ validateForm: l,
440
+ setFieldError: m,
441
+ validateField: g
442
+ } = xe(De), {
443
+ mutateAsync: f,
444
+ isPending: y,
445
+ error: p,
446
+ reset: c
447
+ } = Nn(), {
448
+ data: d
449
+ } = we({
450
+ orgName: r
451
+ }), C = F(() => d ?? [], [d]);
452
+ K(() => {
453
+ n && (o(Ae), c());
454
+ }, [n, c]);
455
+ const P = _((T, S) => {
456
+ o((k) => {
457
+ const v = {
458
+ ...k,
459
+ [T]: S
460
+ };
461
+ return m(T, g(T, S, v)), v;
462
+ });
463
+ }, [m, g]), x = _(async (T) => {
464
+ T.preventDefault();
465
+ const S = De.safeParse(a);
466
+ if (!S.success) {
467
+ l(a);
468
+ return;
469
+ }
470
+ try {
471
+ await f({
472
+ params: {
473
+ orgName: r
474
+ },
475
+ body: {
476
+ displayName: S.data.displayName.trim(),
477
+ description: S.data.description?.trim(),
478
+ promotionPaths: pn(S.data.chain)
479
+ }
480
+ }), t();
481
+ } catch {
482
+ }
483
+ }, [a, l, f, r, t]), N = F(() => p ? p?.message ?? "Failed to create pipeline" : null, [p]);
484
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
485
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(He, { size: 24 }), title: "Create Deployment Pipeline", onClose: t }),
486
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: x, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
487
+ N && /* @__PURE__ */ e(B, { severity: "error", children: /* @__PURE__ */ e(I, { variant: "body2", children: N }) }),
488
+ /* @__PURE__ */ i($.Section, { children: [
489
+ /* @__PURE__ */ e($.Header, { children: "Pipeline Details" }),
490
+ /* @__PURE__ */ i($.Stack, { spacing: 2, children: [
491
+ /* @__PURE__ */ i(j, { fullWidth: !0, error: !!h.displayName, children: [
492
+ /* @__PURE__ */ e(q, { required: !0, children: "Display Name" }),
493
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", value: a.displayName, onChange: (T) => P("displayName", T.target.value), placeholder: "e.g., Production Pipeline", error: !!h.displayName, helperText: h.displayName, disabled: y })
494
+ ] }),
495
+ /* @__PURE__ */ i(j, { fullWidth: !0, children: [
496
+ /* @__PURE__ */ e(q, { children: "Description" }),
497
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: a.description ?? "", onChange: (T) => P("description", T.target.value), placeholder: "Optional description", disabled: y })
498
+ ] })
499
+ ] })
500
+ ] }),
501
+ /* @__PURE__ */ e(un, { chain: a.chain, envOptions: C, onChange: (T) => o((S) => ({
502
+ ...S,
503
+ chain: T
504
+ })), disabled: y }),
505
+ /* @__PURE__ */ i(M, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
506
+ /* @__PURE__ */ e(O, { variant: "outlined", color: "inherit", onClick: t, disabled: y, children: "Cancel" }),
507
+ /* @__PURE__ */ e(O, { type: "submit", variant: "contained", color: "primary", disabled: y || a.chain.length === 0, children: y ? "Creating..." : "Create" })
508
+ ] })
509
+ ] }) }) })
510
+ ] });
511
+ }
512
+ function _e() {
513
+ const n = ae(20), {
514
+ orgId: t
515
+ } = oe(), [r, a] = Cn(), [o, h] = D(null), [l, m] = D(!1);
516
+ let g;
517
+ n[0] !== t ? (g = {
518
+ orgName: t
519
+ }, n[0] = t, n[1] = g) : g = n[1];
520
+ const {
521
+ data: f
522
+ } = Ze(g);
523
+ let y, p;
524
+ n[2] !== f || n[3] !== r || n[4] !== a ? (y = () => {
525
+ const T = r.get("edit");
526
+ if (!T || !f?.deploymentPipelines)
527
+ return;
528
+ const S = f.deploymentPipelines.find((k) => k.name === T);
529
+ if (S) {
530
+ h(S);
531
+ const k = new URLSearchParams(r);
532
+ k.delete("edit"), a(k, {
533
+ replace: !0
534
+ });
535
+ }
536
+ }, p = [r, f, a], n[2] = f, n[3] = r, n[4] = a, n[5] = y, n[6] = p) : (y = n[5], p = n[6]), K(y, p);
537
+ let c;
538
+ n[7] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ e(ie, { index: !0, element: /* @__PURE__ */ e(Pe, { title: "Deployment Pipelines", disableIcon: !0, children: /* @__PURE__ */ e(Wn, { onEditPipeline: h, onCreatePipeline: () => m(!0) }) }) }), n[7] = c) : c = n[7];
539
+ const d = `/org/${t}/deployment-pipelines`;
540
+ let C;
541
+ n[8] !== d ? (C = /* @__PURE__ */ i(Ye, { children: [
542
+ c,
543
+ /* @__PURE__ */ e(ie, { path: "*", element: /* @__PURE__ */ e(Je, { to: d, replace: !0 }) })
544
+ ] }), n[8] = d, n[9] = C) : C = n[9];
545
+ let P;
546
+ n[10] !== l || n[11] !== t ? (P = t && /* @__PURE__ */ e(Hn, { open: l, onClose: () => m(!1), orgId: t }), n[10] = l, n[11] = t, n[12] = P) : P = n[12];
547
+ let x;
548
+ n[13] !== t || n[14] !== o ? (x = o && t && /* @__PURE__ */ e(Gn, { open: o !== null, onClose: () => h(null), pipeline: o, orgId: t }), n[13] = t, n[14] = o, n[15] = x) : x = n[15];
549
+ let N;
550
+ return n[16] !== C || n[17] !== P || n[18] !== x ? (N = /* @__PURE__ */ i(te, { children: [
551
+ C,
552
+ P,
553
+ x
554
+ ] }), n[16] = C, n[17] = P, n[18] = x, n[19] = N) : N = n[19], N;
555
+ }
556
+ function Vn({
557
+ onEditEnvironment: n,
558
+ onCreateEnvironment: t,
559
+ onDeleteEnvironment: r
560
+ }) {
561
+ const {
562
+ orgId: a
563
+ } = oe(), o = Qe(), [h, l] = D(""), [m, g] = D(0), [f, y] = D(5), [p, c] = D(null), d = (v) => a ? he(me.children.org.children.environments.children.view.path, {
564
+ orgId: a,
565
+ envName: v
566
+ }) : "#", {
567
+ data: C,
568
+ isLoading: P,
569
+ error: x
570
+ } = we({
571
+ orgName: a
572
+ }), N = F(() => {
573
+ const v = C ?? [], u = h.trim().toLowerCase();
574
+ return u ? v.filter((E) => E.name.toLowerCase().includes(u) || (E.displayName ?? "").toLowerCase().includes(u)) : v;
575
+ }, [C, h]), T = C ?? [];
576
+ K(() => {
577
+ m !== 0 && m * f >= N.length && g(0);
578
+ }, [N.length, m, f]);
579
+ const S = /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
580
+ /* @__PURE__ */ e(M, { flexGrow: 1, children: /* @__PURE__ */ e(rn, { value: h, onChange: (v) => l(v.target.value), placeholder: "Search environments...", size: "small", fullWidth: !0, disabled: P }) }),
581
+ t && T.length > 0 && /* @__PURE__ */ e(O, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Environment" })
582
+ ] });
583
+ if (x)
584
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
585
+ S,
586
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ i(B, { severity: "error", icon: /* @__PURE__ */ e(ve, { size: 18 }), sx: {
587
+ alignSelf: "stretch"
588
+ }, children: [
589
+ "Failed to load environments.",
590
+ " ",
591
+ nn(x) || "Please try again."
592
+ ] }) })
593
+ ] });
594
+ if (P)
595
+ return /* @__PURE__ */ i(te, { children: [
596
+ S,
597
+ /* @__PURE__ */ e(s.Container, { disablePaper: !0, children: /* @__PURE__ */ e(b, { spacing: 1, mt: 1, children: Array.from({
598
+ length: f
599
+ }).map((v, u) => /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, sx: {
600
+ px: 2,
601
+ py: 1.5,
602
+ borderRadius: 1,
603
+ border: "1px solid",
604
+ borderColor: "divider",
605
+ bgcolor: "background.paper"
606
+ }, children: [
607
+ /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1.5, sx: {
608
+ flexShrink: 0
609
+ }, children: [
610
+ /* @__PURE__ */ e(R, { variant: "circular", width: 36, height: 36 }),
611
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 20 })
612
+ ] }),
613
+ /* @__PURE__ */ e(R, { variant: "text", width: 120, height: 20, sx: {
614
+ flexShrink: 0
615
+ } }),
616
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 80, height: 24, sx: {
617
+ flexShrink: 0
618
+ } }),
619
+ /* @__PURE__ */ e(R, { variant: "rounded", width: 100, height: 24, sx: {
620
+ flexShrink: 0,
621
+ ml: "auto"
622
+ } })
623
+ ] }, u)) }) })
624
+ ] });
625
+ if (T.length === 0)
626
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
627
+ S,
628
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(qe, { size: 64 }), title: "No environments yet", description: "Create an environment to define where your agents are deployed.", action: t && /* @__PURE__ */ e(O, { variant: "contained", startIcon: /* @__PURE__ */ e(re, { size: 16 }), onClick: t, children: "Create Environment" }) }) })
629
+ ] });
630
+ if (N.length === 0)
631
+ return /* @__PURE__ */ i(b, { spacing: 1, children: [
632
+ S,
633
+ /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(Ve, { size: 64 }), title: "No environments match your search", description: "Try a different keyword or clear the search filter." }) })
634
+ ] });
635
+ const k = N.slice(m * f, m * f + f);
636
+ return /* @__PURE__ */ i(te, { children: [
637
+ S,
638
+ /* @__PURE__ */ e(b, { pt: 4, children: /* @__PURE__ */ i(s.Container, { disablePaper: !0, children: [
639
+ /* @__PURE__ */ i(s, { variant: "card", children: [
640
+ /* @__PURE__ */ e(s.Head, { children: /* @__PURE__ */ i(s.Row, { children: [
641
+ /* @__PURE__ */ e(s.Cell, { children: "Environment" }),
642
+ /* @__PURE__ */ e(s.Cell, { children: "Data Plane" }),
643
+ /* @__PURE__ */ e(s.Cell, { align: "center", width: "160px", children: "Type" }),
644
+ /* @__PURE__ */ e(s.Cell, { align: "center", width: "160px", children: "Isolation Tier" }),
645
+ /* @__PURE__ */ e(s.Cell, { align: "right", width: "160px", children: "Created" })
646
+ ] }) }),
647
+ /* @__PURE__ */ e(s.Body, { children: k.map((v) => /* @__PURE__ */ i(s.Row, { variant: "card", hover: !0, clickable: !0, onClick: () => o(d(v.name)), onMouseEnter: () => c(v.name), onMouseLeave: () => c(null), onFocus: () => c(v.name), onBlur: () => c(null), children: [
648
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 2, children: [
649
+ /* @__PURE__ */ e(ue, { sx: {
650
+ bgcolor: "primary.main",
651
+ color: "primary.contrastText",
652
+ fontSize: 16,
653
+ height: 36,
654
+ width: 36,
655
+ flexShrink: 0
656
+ }, children: (v.displayName ?? v.name)?.charAt(0)?.toUpperCase() ?? "E" }),
657
+ /* @__PURE__ */ e(I, { variant: "body2", fontWeight: 500, noWrap: !0, children: v.displayName ?? v.name })
658
+ ] }) }),
659
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(I, { variant: "body2", color: "text.secondary", children: v.dataplaneRef || "—" }) }),
660
+ /* @__PURE__ */ e(s.Cell, { align: "center", children: /* @__PURE__ */ e(ne, { label: v.isProduction ? "Production" : "Non-production", size: "small", variant: "outlined", color: v.isProduction ? "primary" : "default" }) }),
661
+ /* @__PURE__ */ e(s.Cell, { align: "center", children: /* @__PURE__ */ e(An, { tier: v.isolationTier }) }),
662
+ /* @__PURE__ */ e(s.Cell, { align: "right", sx: {
663
+ cursor: "default"
664
+ }, onClick: (u) => u.stopPropagation(), children: /* @__PURE__ */ e(b, { direction: "row", justifyContent: "flex-end", alignItems: "center", spacing: 1, children: p === v.name ? /* @__PURE__ */ e(en, { children: /* @__PURE__ */ i(b, { direction: "row", spacing: 0.5, children: [
665
+ /* @__PURE__ */ e(L, { title: "Edit environment", children: /* @__PURE__ */ e(W, { size: "small", onClick: () => n?.(v), children: /* @__PURE__ */ e(be, { size: 16 }) }) }),
666
+ v.name !== "default" && r && /* @__PURE__ */ e(L, { title: "Delete environment", children: /* @__PURE__ */ e(W, { size: "small", color: "error", onClick: () => r(v), children: /* @__PURE__ */ e(pe, { size: 16 }) }) })
667
+ ] }) }) : /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", children: Ne(new Date(v.createdAt), {
668
+ addSuffix: !0
669
+ }) }) }) })
670
+ ] }, v.name)) })
671
+ ] }),
672
+ N.length > 5 && /* @__PURE__ */ e(an, { component: "div", count: N.length, page: m, rowsPerPage: f, onPageChange: (v, u) => g(u), onRowsPerPageChange: (v) => {
673
+ y(parseInt(v.target.value, 10)), g(0);
674
+ }, rowsPerPageOptions: [5, 10, 25] })
675
+ ] }) })
676
+ ] });
677
+ }
678
+ const Le = Ee({
679
+ displayName: V().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
680
+ description: V().nullable().optional(),
681
+ isProduction: dn().optional()
682
+ }), jn = ["runc", "gvisor", "kata"], qn = Ee({
683
+ name: V().min(1, "Name is required").max(64, "Name must be 64 characters or less").regex(/^[a-z0-9-]+$/, "Name must be lowercase alphanumeric with hyphens only"),
684
+ displayName: V().min(1, "Display name is required").max(128, "Display name must be 128 characters or less"),
685
+ description: V().optional(),
686
+ dataplaneRef: V().min(1, "Data plane is required"),
687
+ dnsPrefix: V().min(1, "DNS prefix is required").max(100),
688
+ isProduction: dn().optional(),
689
+ isolationTier: Ln(jn).optional()
690
+ });
691
+ function Kn({
692
+ open: n,
693
+ onClose: t,
694
+ environment: r,
695
+ orgId: a
696
+ }) {
697
+ const [o, h] = D({
698
+ displayName: r.displayName ?? "",
699
+ description: "",
700
+ isProduction: r.isProduction
701
+ }), {
702
+ errors: l,
703
+ validateForm: m,
704
+ setFieldError: g,
705
+ validateField: f
706
+ } = xe(Le), [y, p] = D({}), {
707
+ mutateAsync: c,
708
+ isPending: d,
709
+ error: C,
710
+ reset: P
711
+ } = En();
712
+ K(() => {
713
+ n && (h({
714
+ displayName: r.displayName ?? "",
715
+ description: "",
716
+ isProduction: r.isProduction
717
+ }), p({}), P());
718
+ }, [n, r, P]);
719
+ const x = _((k, v) => {
720
+ h((u) => {
721
+ const E = {
722
+ ...u,
723
+ [k]: v
724
+ }, w = f(k, E[k], E);
725
+ return g(k, w), E;
726
+ });
727
+ }, [g, f]), N = _(async (k) => {
728
+ k.preventDefault();
729
+ const v = Le.safeParse(o);
730
+ if (!v.success) {
731
+ const u = {};
732
+ v.error.issues.forEach((E) => {
733
+ E.path[0] && (u[E.path[0]] = E.message);
734
+ }), p(u), m(o);
735
+ return;
736
+ }
737
+ p({});
738
+ try {
739
+ await c({
740
+ params: {
741
+ orgName: a,
742
+ envName: r.name
743
+ },
744
+ body: {
745
+ displayName: v.data.displayName.trim(),
746
+ description: v.data.description ?? void 0,
747
+ isProduction: v.data.isProduction
748
+ }
749
+ }), t();
750
+ } catch {
751
+ }
752
+ }, [o, m, c, r, t, a]), T = F(() => C ? C?.message ?? "Failed to update environment" : null, [C]), S = Object.values(y).filter(Boolean);
753
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
754
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(be, { size: 24 }), title: "Edit Environment", onClose: t }),
755
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ e("form", { onSubmit: N, children: /* @__PURE__ */ i(b, { spacing: 3, children: [
756
+ T && /* @__PURE__ */ e(B, { severity: "error", children: /* @__PURE__ */ e(I, { variant: "body2", children: T }) }),
757
+ /* @__PURE__ */ e(Rn, { in: S.length > 0, timeout: "auto", unmountOnExit: !0, children: /* @__PURE__ */ e(B, { severity: "error", sx: {
758
+ mb: 2
759
+ }, children: S.map((k, v) => /* @__PURE__ */ e(M, { children: k }, v)) }) }),
760
+ /* @__PURE__ */ i($.Section, { children: [
761
+ /* @__PURE__ */ e($.Header, { children: "Environment Details" }),
762
+ /* @__PURE__ */ i($.Stack, { spacing: 2, children: [
763
+ /* @__PURE__ */ i(j, { fullWidth: !0, error: !!l.displayName, children: [
764
+ /* @__PURE__ */ e(q, { required: !0, children: "Display Name" }),
765
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", value: o.displayName, onChange: (k) => x("displayName", k.target.value), placeholder: "e.g., Production Environment", error: !!l.displayName, helperText: l.displayName, disabled: d })
766
+ ] }),
767
+ /* @__PURE__ */ i(j, { fullWidth: !0, children: [
768
+ /* @__PURE__ */ e(q, { children: "Description" }),
769
+ /* @__PURE__ */ e(J, { fullWidth: !0, size: "small", multiline: !0, rows: 2, value: o.description ?? "", onChange: (k) => x("description", k.target.value), placeholder: "Optional description", disabled: d })
770
+ ] }),
771
+ /* @__PURE__ */ e(on, { control: /* @__PURE__ */ e(ln, { checked: o.isProduction ?? !1, onChange: (k) => x("isProduction", k.target.checked), disabled: d }), label: "Production environment" })
772
+ ] })
773
+ ] }),
774
+ /* @__PURE__ */ i(M, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
775
+ /* @__PURE__ */ e(O, { variant: "outlined", color: "inherit", onClick: t, disabled: d, children: "Cancel" }),
776
+ /* @__PURE__ */ e(O, { type: "submit", variant: "contained", color: "primary", disabled: d, children: d ? "Saving..." : "Save" })
777
+ ] })
778
+ ] }) }) })
779
+ ] });
780
+ }
781
+ const Xn = "•••••••••••••••", Yn = "https://wso2.github.io/agent-manager/docs/administration/isolation-tiers/gvisor", Jn = "https://wso2.github.io/agent-manager/docs/administration/isolation-tiers/kata", Me = [{
782
+ value: "runc",
783
+ label: "Sandbox Level 1 — runc (default)"
784
+ }, {
785
+ value: "gvisor",
786
+ label: "Sandbox Level 2 — gVisor",
787
+ warning: "gVisor environments need a dedicated x86_64 node with the gVisor (runsc) runtime installed before agents can be deployed. Set up the node first — see the ",
788
+ docsUrl: Yn,
789
+ docsLabel: "gVisor setup guide"
790
+ }, {
791
+ value: "kata",
792
+ label: "Sandbox Level 3 — Kata Containers",
793
+ warning: "Kata environments need a dedicated node with KVM support (nested virtualization) and the Kata runtime installed before agents can be deployed. Set up the node first — see the ",
794
+ docsUrl: Jn,
795
+ docsLabel: "Kata setup guide"
796
+ }], Fe = {
797
+ name: "",
798
+ displayName: "",
799
+ description: "",
800
+ dataplaneRef: "",
801
+ dnsPrefix: "",
802
+ isProduction: !1,
803
+ isolationTier: "runc"
804
+ };
805
+ function Oe(n) {
806
+ return n.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
807
+ }
808
+ function Be(n, t, r, a, o) {
809
+ const h = Se.agentManagerInternalBaseUrl?.trim(), l = Se.agentManagerInternalCpHost?.trim(), m = Mn();
810
+ return [`curl -fsSL ${ye("add-environment.sh")} \\`, ` | ENV_NAME=${n || "<env-name>"} \\`, ` DISPLAY_NAME="${t || "<display-name>"}" \\`, ...a !== "runc" ? [` ISOLATION_TIER=${a} \\`] : [], ` AGENT_MANAGER_TOKEN=${o} \\`, ` CHART_VERSION=${m || "<chart-version>"} \\`, ...r ? [" IS_PRODUCTION=true \\"] : [], ...h ? [` AGENT_MANAGER_INTERNAL_BASE_URL=${h} \\`] : [], ...l ? [` AGENT_MANAGER_INTERNAL_CP=${l} \\`] : [], ` THUNDER_SCRIPT_URL=${ye("add-environment-thunder.sh")} \\`, " bash"].join(`
811
+ `);
812
+ }
813
+ function Qn({
814
+ open: n,
815
+ onClose: t,
816
+ orgId: r
817
+ }) {
818
+ const [a, o] = D(Fe), [h, l] = D(!1), [m, g] = D(null), [f, y] = D(!1), {
819
+ errors: p,
820
+ validateField: c,
821
+ setFieldError: d
822
+ } = xe(qn), {
823
+ getToken: C
824
+ } = tn(), {
825
+ data: P
826
+ } = Tn({
827
+ orgName: r
828
+ }), x = P ?? [];
829
+ K(() => {
830
+ n && (o(Fe), l(!1), g(null), y(!1));
831
+ }, [n]), K(() => {
832
+ !a.dataplaneRef && x.length > 0 && o((w) => ({
833
+ ...w,
834
+ dataplaneRef: x[0].name
835
+ }));
836
+ }, [x, a.dataplaneRef]);
837
+ const N = _((w, z) => {
838
+ o((U) => {
839
+ const X = {
840
+ ...U,
841
+ [w]: z
842
+ };
843
+ return d(w, c(w, X[w], X)), X;
844
+ });
845
+ }, [c, d]), T = _((w) => {
846
+ o((z) => {
847
+ const U = Oe(w), G = z.name === "" || z.name === Oe(z.displayName) ? U : z.name, H = {
848
+ ...z,
849
+ displayName: w,
850
+ name: G,
851
+ dnsPrefix: G
852
+ };
853
+ return d("displayName", c("displayName", w, H)), d("name", c("name", G, H)), H;
854
+ });
855
+ }, [c, d]), S = _((w) => {
856
+ o((z) => {
857
+ const U = {
858
+ ...z,
859
+ name: w,
860
+ dnsPrefix: w
861
+ };
862
+ return d("name", c("name", w, U)), U;
863
+ });
864
+ }, [c, d]), k = _(async () => {
865
+ if (h)
866
+ l(!1), g(null);
867
+ else
868
+ try {
869
+ const w = await C();
870
+ g(w), l(!0);
871
+ } catch {
872
+ }
873
+ }, [h, C]), v = _(async () => {
874
+ try {
875
+ const w = m ?? await C(), z = Be(a.name, a.displayName, a.isProduction ?? !1, a.isolationTier ?? "runc", w);
876
+ await navigator.clipboard.writeText(z), y(!0), setTimeout(() => y(!1), 2e3);
877
+ } catch {
878
+ }
879
+ }, [m, C, a.name, a.displayName, a.isProduction, a.isolationTier]), u = F(() => Be(a.name, a.displayName, a.isProduction ?? !1, a.isolationTier ?? "runc", h && m ? m : Xn), [a.name, a.displayName, a.isProduction, a.isolationTier, h, m]), E = Me.find((w) => w.value === (a.isolationTier ?? "runc"));
880
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
881
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(re, { size: 24 }), title: "Create Environment", onClose: t }),
882
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ i(b, { spacing: 3, children: [
883
+ /* @__PURE__ */ i(I, { variant: "body2", color: "text.secondary", children: [
884
+ "Environments are provisioned by a script that creates the environment in Agent Manager, installs its API Platform Gateway, and stands up its dedicated identity (Thunder) instance via Helm. Fill in the details below, then copy and run the command in a terminal with ",
885
+ /* @__PURE__ */ e("code", { children: "kubectl" }),
886
+ " and ",
887
+ /* @__PURE__ */ e("code", { children: "helm" }),
888
+ " configured against your cluster."
889
+ ] }),
890
+ /* @__PURE__ */ i(b, { spacing: 2, children: [
891
+ x.length > 1 && /* @__PURE__ */ i(j, { fullWidth: !0, error: !!p.dataplaneRef, children: [
892
+ /* @__PURE__ */ e(q, { required: !0, children: "Data Plane" }),
893
+ /* @__PURE__ */ e(Ie, { size: "small", value: a.dataplaneRef, onChange: (w) => N("dataplaneRef", w.target.value), error: !!p.dataplaneRef, children: x.map((w) => /* @__PURE__ */ e(ge, { value: w.name, children: w.displayName || w.name }, w.name)) }),
894
+ p.dataplaneRef && /* @__PURE__ */ e(I, { variant: "caption", color: "error", children: p.dataplaneRef })
895
+ ] }),
896
+ /* @__PURE__ */ i(j, { fullWidth: !0, error: !!p.displayName, children: [
897
+ /* @__PURE__ */ e(q, { required: !0, children: "Display Name" }),
898
+ /* @__PURE__ */ e(J, { size: "small", fullWidth: !0, value: a.displayName, onChange: (w) => T(w.target.value), placeholder: "e.g., Production", error: !!p.displayName, helperText: p.displayName })
899
+ ] }),
900
+ /* @__PURE__ */ i(j, { fullWidth: !0, error: !!p.name, children: [
901
+ /* @__PURE__ */ e(q, { children: "Name" }),
902
+ /* @__PURE__ */ e(J, { size: "small", fullWidth: !0, value: a.name, onChange: (w) => S(w.target.value), placeholder: "e.g., production", error: !!p.name, helperText: p.name ?? "The resource name used by the API. Generated automatically and guaranteed unique." })
903
+ ] }),
904
+ /* @__PURE__ */ i(j, { fullWidth: !0, children: [
905
+ /* @__PURE__ */ e(q, { children: "Isolation Tier" }),
906
+ /* @__PURE__ */ e(Ie, { size: "small", value: a.isolationTier ?? "runc", onChange: (w) => N("isolationTier", w.target.value), children: Me.map((w) => {
907
+ const z = fe(w.value).icon;
908
+ return /* @__PURE__ */ e(ge, { value: w.value, children: /* @__PURE__ */ i(b, { direction: "row", spacing: 1, alignItems: "center", children: [
909
+ /* @__PURE__ */ e(z, { size: 14 }),
910
+ /* @__PURE__ */ e("span", { children: w.label })
911
+ ] }) }, w.value);
912
+ }) }),
913
+ /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", children: "Container runtime isolation for agents deployed to this environment." })
914
+ ] }),
915
+ /* @__PURE__ */ e(on, { control: /* @__PURE__ */ e(ln, { checked: a.isProduction ?? !1, onChange: (w) => N("isProduction", w.target.checked) }), label: "Production environment" })
916
+ ] }),
917
+ E?.warning && /* @__PURE__ */ i(B, { severity: "warning", children: [
918
+ E.warning,
919
+ /* @__PURE__ */ e(I, { component: "a", href: E.docsUrl, target: "_blank", rel: "noopener noreferrer", sx: {
920
+ color: "primary.main"
921
+ }, children: E.docsLabel }),
922
+ "."
923
+ ] }),
924
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
925
+ /* @__PURE__ */ e(I, { variant: "body2", children: "Run from the root of your repo clone:" }),
926
+ /* @__PURE__ */ i(M, { sx: {
927
+ position: "relative",
928
+ bgcolor: "grey.900",
929
+ borderRadius: 1,
930
+ p: 2,
931
+ pr: 8,
932
+ fontFamily: "monospace",
933
+ fontSize: "0.8125rem",
934
+ color: "grey.100",
935
+ whiteSpace: "pre",
936
+ overflowX: "auto"
937
+ }, children: [
938
+ /* @__PURE__ */ i(M, { sx: {
939
+ position: "absolute",
940
+ top: 6,
941
+ right: 6,
942
+ display: "flex",
943
+ gap: 0.5
944
+ }, children: [
945
+ /* @__PURE__ */ e(L, { title: h ? "Hide token" : "Show token", children: /* @__PURE__ */ e(W, { size: "small", onClick: k, sx: {
946
+ color: "grey.400"
947
+ }, children: h ? /* @__PURE__ */ e(Ke, { size: 16 }) : /* @__PURE__ */ e(Xe, { size: 16 }) }) }),
948
+ /* @__PURE__ */ e(L, { title: f ? "Copied!" : "Copy", children: /* @__PURE__ */ e(W, { size: "small", onClick: v, sx: {
949
+ color: f ? "success.light" : "grey.400"
950
+ }, children: /* @__PURE__ */ e(Ce, { size: 16 }) }) })
951
+ ] }),
952
+ u
953
+ ] }),
954
+ /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", children: "Your access token will be substituted when you copy." })
955
+ ] }),
956
+ /* @__PURE__ */ e(B, { severity: "info", children: "Once the script completes, the new environment will appear in the list. The script is idempotent — safe to re-run." }),
957
+ /* @__PURE__ */ e(M, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ e(O, { variant: "outlined", color: "inherit", onClick: t, children: "Close" }) })
958
+ ] }) })
959
+ ] });
960
+ }
961
+ const Zn = "•••••••••••••••";
962
+ function $e(n, t) {
963
+ return [`curl -fsSL ${ye("remove-environment.sh")} \\`, ` | ENV_NAME=${n || "<env-name>"} \\`, ` AGENT_MANAGER_TOKEN=${t} \\`, ` THUNDER_SCRIPT_URL=${ye("remove-environment-thunder.sh")} \\`, " bash"].join(`
964
+ `);
965
+ }
966
+ function et({
967
+ open: n,
968
+ onClose: t,
969
+ environment: r
970
+ }) {
971
+ const [a, o] = D(!1), [h, l] = D(null), [m, g] = D(!1), {
972
+ getToken: f
973
+ } = tn();
974
+ K(() => {
975
+ n && (o(!1), l(null), g(!1));
976
+ }, [n]);
977
+ const y = _(async () => {
978
+ if (a)
979
+ o(!1), l(null);
980
+ else
981
+ try {
982
+ const d = await f();
983
+ l(d), o(!0);
984
+ } catch {
985
+ }
986
+ }, [a, f]), p = _(async () => {
987
+ try {
988
+ const d = h ?? await f(), C = $e(r.name, d);
989
+ await navigator.clipboard.writeText(C), g(!0), setTimeout(() => g(!1), 2e3);
990
+ } catch {
991
+ }
992
+ }, [h, f, r.name]), c = F(() => $e(r.name, a && h ? h : Zn), [r.name, a, h]);
993
+ return /* @__PURE__ */ i(le, { open: n, onClose: t, children: [
994
+ /* @__PURE__ */ e(se, { icon: /* @__PURE__ */ e(pe, { size: 24 }), title: "Delete Environment", onClose: t }),
995
+ /* @__PURE__ */ e(ce, { children: /* @__PURE__ */ i(b, { spacing: 3, children: [
996
+ /* @__PURE__ */ i(I, { variant: "body2", color: "text.secondary", children: [
997
+ "Environments are removed by a script that deprovisions the environment's dedicated identity (Thunder) instance, uninstalls its API Platform Gateway via Helm, and then deletes the environment in Agent Manager. Copy and run the command below in a terminal with ",
998
+ /* @__PURE__ */ e("code", { children: "kubectl" }),
999
+ " and ",
1000
+ /* @__PURE__ */ e("code", { children: "helm" }),
1001
+ " configured against your cluster."
1002
+ ] }),
1003
+ /* @__PURE__ */ i(B, { severity: "warning", children: [
1004
+ "This permanently deletes ",
1005
+ /* @__PURE__ */ e("strong", { children: r.displayName ?? r.name }),
1006
+ " ",
1007
+ "and uninstalls its gateway. Agents deployed to this environment will no longer be reachable. This action cannot be undone."
1008
+ ] }),
1009
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
1010
+ /* @__PURE__ */ e(I, { variant: "body2", children: "Run from the root of your repo clone:" }),
1011
+ /* @__PURE__ */ i(M, { sx: {
1012
+ position: "relative",
1013
+ bgcolor: "grey.900",
1014
+ borderRadius: 1,
1015
+ p: 2,
1016
+ pr: 8,
1017
+ fontFamily: "monospace",
1018
+ fontSize: "0.8125rem",
1019
+ color: "grey.100",
1020
+ whiteSpace: "pre",
1021
+ overflowX: "auto"
1022
+ }, children: [
1023
+ /* @__PURE__ */ i(M, { sx: {
1024
+ position: "absolute",
1025
+ top: 6,
1026
+ right: 6,
1027
+ display: "flex",
1028
+ gap: 0.5
1029
+ }, children: [
1030
+ /* @__PURE__ */ e(L, { title: a ? "Hide token" : "Show token", children: /* @__PURE__ */ e(W, { size: "small", onClick: y, sx: {
1031
+ color: "grey.400"
1032
+ }, children: a ? /* @__PURE__ */ e(Ke, { size: 16 }) : /* @__PURE__ */ e(Xe, { size: 16 }) }) }),
1033
+ /* @__PURE__ */ e(L, { title: m ? "Copied!" : "Copy", children: /* @__PURE__ */ e(W, { size: "small", onClick: p, sx: {
1034
+ color: m ? "success.light" : "grey.400"
1035
+ }, children: /* @__PURE__ */ e(Ce, { size: 16 }) }) })
1036
+ ] }),
1037
+ c
1038
+ ] }),
1039
+ /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", children: "Your access token will be substituted when you copy." })
1040
+ ] }),
1041
+ /* @__PURE__ */ e(B, { severity: "info", children: "Once the script completes, the environment will disappear from the list. The script is idempotent — safe to re-run." }),
1042
+ /* @__PURE__ */ e(M, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ e(O, { variant: "outlined", color: "inherit", onClick: t, children: "Close" }) })
1043
+ ] }) })
1044
+ ] });
1045
+ }
1046
+ const We = {
1047
+ fontFamily: "monospace",
1048
+ color: "text.secondary",
1049
+ overflow: "hidden",
1050
+ textOverflow: "ellipsis",
1051
+ whiteSpace: "nowrap",
1052
+ display: "block"
1053
+ }, nt = {
1054
+ ACTIVE: "success",
1055
+ INACTIVE: "default",
1056
+ PROVISIONING: "warning",
1057
+ ERROR: "error"
1058
+ }, tt = {
1059
+ width: 28,
1060
+ height: 28,
1061
+ fontSize: 12,
1062
+ bgcolor: "primary.main",
1063
+ color: "primary.contrastText"
1064
+ };
1065
+ function it(n) {
1066
+ const t = ae(11), {
1067
+ label: r,
1068
+ value: a
1069
+ } = n;
1070
+ let o;
1071
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
1072
+ height: "100%"
1073
+ }, t[0] = o) : o = t[0];
1074
+ let h;
1075
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (h = {
1076
+ p: 2,
1077
+ "&:last-child": {
1078
+ pb: 2
1079
+ }
1080
+ }, t[1] = h) : h = t[1];
1081
+ let l;
1082
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = {
1083
+ fontWeight: 500
1084
+ }, t[2] = l) : l = t[2];
1085
+ let m;
1086
+ t[3] !== r ? (m = /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", sx: l, children: r }), t[3] = r, t[4] = m) : m = t[4];
1087
+ let g;
1088
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (g = {
1089
+ fontFamily: "monospace",
1090
+ wordBreak: "break-all"
1091
+ }, t[5] = g) : g = t[5];
1092
+ let f;
1093
+ t[6] !== a ? (f = /* @__PURE__ */ e(I, { variant: "body2", sx: g, children: a }), t[6] = a, t[7] = f) : f = t[7];
1094
+ let y;
1095
+ return t[8] !== m || t[9] !== f ? (y = /* @__PURE__ */ e(sn, { variant: "outlined", sx: o, children: /* @__PURE__ */ e(cn, { sx: h, children: /* @__PURE__ */ i(b, { spacing: 0.5, children: [
1096
+ m,
1097
+ f
1098
+ ] }) }) }), t[8] = m, t[9] = f, t[10] = y) : y = t[10], y;
1099
+ }
1100
+ function Ue(n) {
1101
+ const t = ae(19), {
1102
+ label: r,
1103
+ scheme: a,
1104
+ endpoint: o,
1105
+ onCopy: h
1106
+ } = n, l = o.host ? `${a}://${o.host}${o.port ? `:${o.port}` : ""}` : void 0, m = l ?? "Not configured";
1107
+ let g;
1108
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (g = {
1109
+ height: "100%"
1110
+ }, t[0] = g) : g = t[0];
1111
+ let f;
1112
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (f = {
1113
+ p: 2,
1114
+ "&:last-child": {
1115
+ pb: 2
1116
+ }
1117
+ }, t[1] = f) : f = t[1];
1118
+ let y;
1119
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (y = {
1120
+ fontWeight: 500
1121
+ }, t[2] = y) : y = t[2];
1122
+ let p;
1123
+ t[3] !== r ? (p = /* @__PURE__ */ e(I, { variant: "caption", color: "text.secondary", sx: y, children: r }), t[3] = r, t[4] = p) : p = t[4];
1124
+ const c = l ? "text.primary" : "text.secondary";
1125
+ let d;
1126
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (d = {
1127
+ fontFamily: "monospace",
1128
+ wordBreak: "break-all",
1129
+ flex: 1,
1130
+ fontSize: "0.8rem"
1131
+ }, t[5] = d) : d = t[5];
1132
+ let C;
1133
+ t[6] !== m || t[7] !== c ? (C = /* @__PURE__ */ e(I, { variant: "body2", color: c, sx: d, children: m }), t[6] = m, t[7] = c, t[8] = C) : C = t[8];
1134
+ let P;
1135
+ t[9] !== r || t[10] !== h || t[11] !== l ? (P = l && /* @__PURE__ */ e(L, { title: `Copy ${r}`, children: /* @__PURE__ */ e(W, { size: "small", "aria-label": `Copy ${r}`, onClick: () => h(l, `${r} copied to clipboard`), sx: {
1136
+ flexShrink: 0
1137
+ }, children: /* @__PURE__ */ e(Ce, { size: 14 }) }) }), t[9] = r, t[10] = h, t[11] = l, t[12] = P) : P = t[12];
1138
+ let x;
1139
+ t[13] !== C || t[14] !== P ? (x = /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1140
+ C,
1141
+ P
1142
+ ] }), t[13] = C, t[14] = P, t[15] = x) : x = t[15];
1143
+ let N;
1144
+ return t[16] !== p || t[17] !== x ? (N = /* @__PURE__ */ e(sn, { variant: "outlined", sx: g, children: /* @__PURE__ */ e(cn, { sx: f, children: /* @__PURE__ */ i(b, { spacing: 0.5, children: [
1145
+ p,
1146
+ x
1147
+ ] }) }) }), t[16] = p, t[17] = x, t[18] = N) : N = t[18], N;
1148
+ }
1149
+ function rt() {
1150
+ const n = ae(51), {
1151
+ orgId: t,
1152
+ envName: r
1153
+ } = oe(), a = Qe(), {
1154
+ pushSnackBar: o
1155
+ } = Sn();
1156
+ let h;
1157
+ n[0] !== r || n[1] !== t ? (h = {
1158
+ orgName: t,
1159
+ envName: r
1160
+ }, n[0] = r, n[1] = t, n[2] = h) : h = n[2];
1161
+ const {
1162
+ data: l,
1163
+ isLoading: m,
1164
+ error: g
1165
+ } = kn(h);
1166
+ let f;
1167
+ n[3] !== t ? (f = {
1168
+ orgName: t
1169
+ }, n[3] = t, n[4] = f) : f = n[4];
1170
+ let y;
1171
+ n[5] !== r ? (y = {
1172
+ environment: r
1173
+ }, n[5] = r, n[6] = y) : y = n[6];
1174
+ const {
1175
+ data: p,
1176
+ isLoading: c
1177
+ } = In(f, y);
1178
+ let d;
1179
+ n[7] !== t ? (d = t ? he(me.children.org.children.environments.path, {
1180
+ orgId: t
1181
+ }) : "#", n[7] = t, n[8] = d) : d = n[8];
1182
+ const C = d;
1183
+ let P;
1184
+ n[9] !== p?.gateways ? (P = p?.gateways ?? [], n[9] = p?.gateways, n[10] = P) : P = n[10];
1185
+ const x = P;
1186
+ let N;
1187
+ n[11] !== t ? (N = {
1188
+ orgName: t
1189
+ }, n[11] = t, n[12] = N) : N = n[12];
1190
+ const {
1191
+ data: T,
1192
+ isLoading: S
1193
+ } = Dn(N);
1194
+ let k;
1195
+ n[13] !== r || n[14] !== T?.thunderInstances ? (k = T?.thunderInstances.find((A) => A.envName === r), n[13] = r, n[14] = T?.thunderInstances, n[15] = k) : k = n[15];
1196
+ const v = k;
1197
+ let u;
1198
+ n[16] !== o ? (u = (A, gn) => {
1199
+ Bn(A).then((fn) => {
1200
+ o(fn ? {
1201
+ message: gn,
1202
+ type: "success"
1203
+ } : {
1204
+ message: "Failed to copy to clipboard",
1205
+ type: "error"
1206
+ });
1207
+ });
1208
+ }, n[16] = o, n[17] = u) : u = n[17];
1209
+ const E = u, w = l?.gateway?.ingress?.external?.http, z = l?.gateway?.ingress?.external?.https, U = l?.displayName ?? l?.name ?? r ?? "", X = l?.createdAt ? `Created ${Ne(new Date(l.createdAt), {
1210
+ addSuffix: !0
1211
+ })}` : void 0;
1212
+ let G;
1213
+ n[18] !== l ? (G = l ? /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1214
+ /* @__PURE__ */ e(ne, { label: l.isProduction ? "Production" : "Non-production", size: "small", variant: "outlined", color: l.isProduction ? "primary" : "default" }),
1215
+ /* @__PURE__ */ e(L, { title: "Data plane reference for this environment", children: /* @__PURE__ */ e(ne, { label: l.dataplaneRef || "—", size: "small", variant: "outlined" }) })
1216
+ ] }) : void 0, n[18] = l, n[19] = G) : G = n[19];
1217
+ let H;
1218
+ n[20] !== g ? (H = g ? /* @__PURE__ */ e(B, { severity: "error", icon: /* @__PURE__ */ e(ve, { size: 18 }), sx: {
1219
+ mb: 2
1220
+ }, children: nn(g) || "Failed to load environment. Please try again." }) : null, n[20] = g, n[21] = H) : H = n[21];
1221
+ let Q;
1222
+ n[22] !== l || n[23] !== g || n[24] !== r || n[25] !== m ? (Q = !m && !l && !g ? /* @__PURE__ */ i(B, { severity: "error", sx: {
1223
+ mb: 2
1224
+ }, children: [
1225
+ "Environment “",
1226
+ r,
1227
+ "” not found."
1228
+ ] }) : null, n[22] = l, n[23] = g, n[24] = r, n[25] = m, n[26] = Q) : Q = n[26];
1229
+ let Z;
1230
+ n[27] !== m ? (Z = m && /* @__PURE__ */ i(b, { spacing: 3, children: [
1231
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1232
+ /* @__PURE__ */ e(R, { variant: "text", width: 120, height: 16 }),
1233
+ /* @__PURE__ */ i(Y, { container: !0, spacing: 2, children: [
1234
+ /* @__PURE__ */ e(Y, { size: {
1235
+ xs: 12,
1236
+ sm: 6,
1237
+ md: 4
1238
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) }),
1239
+ /* @__PURE__ */ e(Y, { size: {
1240
+ xs: 12,
1241
+ sm: 6,
1242
+ md: 4
1243
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) }),
1244
+ /* @__PURE__ */ e(Y, { size: {
1245
+ xs: 12,
1246
+ sm: 6,
1247
+ md: 4
1248
+ }, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 72 }) })
1249
+ ] })
1250
+ ] }),
1251
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1252
+ /* @__PURE__ */ e(R, { variant: "text", width: 90, height: 16 }),
1253
+ /* @__PURE__ */ i(b, { spacing: 1, children: [
1254
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }),
1255
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 })
1256
+ ] })
1257
+ ] }),
1258
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1259
+ /* @__PURE__ */ e(R, { variant: "text", width: 140, height: 16 }),
1260
+ /* @__PURE__ */ e(R, { variant: "rounded", height: 56 })
1261
+ ] })
1262
+ ] }), n[27] = m, n[28] = Z) : Z = n[28];
1263
+ let ee;
1264
+ n[29] !== l || n[30] !== g || n[31] !== x || n[32] !== E || n[33] !== w || n[34] !== z || n[35] !== c || n[36] !== S || n[37] !== a || n[38] !== t || n[39] !== v ? (ee = l && !g && /* @__PURE__ */ i(b, { spacing: 3, children: [
1265
+ /* @__PURE__ */ e(b, { spacing: 1.5, children: l.dnsPrefix || w || z ? /* @__PURE__ */ i(Y, { container: !0, spacing: 2, children: [
1266
+ l.dnsPrefix && /* @__PURE__ */ e(Y, { size: {
1267
+ xs: 12,
1268
+ sm: 6,
1269
+ md: 4
1270
+ }, children: /* @__PURE__ */ e(it, { label: "DNS Prefix", value: l.dnsPrefix }) }),
1271
+ w && /* @__PURE__ */ e(Y, { size: {
1272
+ xs: 12,
1273
+ sm: 6,
1274
+ md: 4
1275
+ }, children: /* @__PURE__ */ e(Ue, { label: "HTTP Endpoint", scheme: "http", endpoint: w, onCopy: E }) }),
1276
+ z && /* @__PURE__ */ e(Y, { size: {
1277
+ xs: 12,
1278
+ sm: 6,
1279
+ md: 4
1280
+ }, children: /* @__PURE__ */ e(Ue, { label: "HTTPS Endpoint", scheme: "https", endpoint: z, onCopy: E }) })
1281
+ ] }) : /* @__PURE__ */ e(I, { variant: "body2", color: "text.secondary", children: "No external ingress configured for this environment." }) }),
1282
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1283
+ /* @__PURE__ */ e(I, { variant: "overline", color: "text.secondary", children: "Gateways" }),
1284
+ c ? /* @__PURE__ */ e(b, { spacing: 1, children: Array.from({
1285
+ length: 3
1286
+ }).map(at) }) : x.length === 0 ? /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(vn, { size: 56 }), title: "No gateways in this environment", description: "Assign a gateway to this environment to see it here." }) }) : /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ i(s, { variant: "table", children: [
1287
+ /* @__PURE__ */ e(s.Head, { children: /* @__PURE__ */ i(s.Row, { children: [
1288
+ /* @__PURE__ */ e(s.Cell, { children: "Gateway" }),
1289
+ /* @__PURE__ */ e(s.Cell, { children: "Type" }),
1290
+ /* @__PURE__ */ e(s.Cell, { children: "Virtual Host" }),
1291
+ /* @__PURE__ */ e(s.Cell, { align: "center", children: "Status" })
1292
+ ] }) }),
1293
+ /* @__PURE__ */ e(s.Body, { children: x.map((A) => /* @__PURE__ */ i(s.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => a(he(me.children.org.children.gateways.children.view.path, {
1294
+ orgId: t ?? "",
1295
+ gatewayId: A.uuid
1296
+ })), children: [
1297
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(s.CellIcon, { icon: /* @__PURE__ */ e(ue, { sx: tt, children: On(A.displayName ?? A.name, {
1298
+ fallback: "G",
1299
+ maxChars: 1
1300
+ }) }), primary: A.displayName ?? A.name }) }),
1301
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(Fn, { type: A.gatewayType }) }),
1302
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(I, { variant: "body2", sx: {
1303
+ fontFamily: "monospace"
1304
+ }, children: A.vhost }) }),
1305
+ /* @__PURE__ */ e(s.Cell, { align: "center", children: /* @__PURE__ */ e(ne, { label: A.status, size: "small", color: nt[A.status], variant: "outlined" }) })
1306
+ ] }, A.uuid)) })
1307
+ ] }) })
1308
+ ] }),
1309
+ /* @__PURE__ */ i(b, { spacing: 1.5, children: [
1310
+ /* @__PURE__ */ e(I, { variant: "overline", color: "text.secondary", children: "Identity Providers" }),
1311
+ S ? /* @__PURE__ */ e(b, { spacing: 1, children: /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }) }) : v ? /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ i(s, { variant: "table", children: [
1312
+ /* @__PURE__ */ e(s.Head, { children: /* @__PURE__ */ i(s.Row, { children: [
1313
+ /* @__PURE__ */ e(s.Cell, { width: "240px", children: "Identity Provider" }),
1314
+ /* @__PURE__ */ e(s.Cell, { children: "Issuer" }),
1315
+ /* @__PURE__ */ e(s.Cell, { children: "Token Endpoint" })
1316
+ ] }) }),
1317
+ /* @__PURE__ */ e(s.Body, { children: /* @__PURE__ */ i(s.Row, { variant: "table", hover: !0, clickable: !0, onClick: () => a(he(me.children.org.children.thunderInstances.children.view.path, {
1318
+ orgId: t ?? "",
1319
+ envName: v.envName
1320
+ })), children: [
1321
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(s.CellIcon, { icon: /* @__PURE__ */ e(ue, { sx: {
1322
+ width: 28,
1323
+ height: 28,
1324
+ bgcolor: "primary.main",
1325
+ color: "primary.contrastText"
1326
+ }, children: /* @__PURE__ */ e(Te, { size: 16 }) }), primary: "Thunder", secondary: "System identity provider" }) }),
1327
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ e(I, { variant: "caption", sx: {
1328
+ ...We,
1329
+ maxWidth: 280
1330
+ }, children: v.issuerUrl }) }),
1331
+ /* @__PURE__ */ e(s.Cell, { children: /* @__PURE__ */ i(b, { direction: "row", alignItems: "center", spacing: 1, children: [
1332
+ /* @__PURE__ */ e(I, { variant: "caption", sx: {
1333
+ ...We,
1334
+ maxWidth: 320
1335
+ }, children: v.tokenUrl }),
1336
+ /* @__PURE__ */ e(L, { title: "Copy token endpoint", children: /* @__PURE__ */ e(W, { size: "small", onClick: (A) => {
1337
+ A.stopPropagation(), E(v.tokenUrl, "Token endpoint copied to clipboard");
1338
+ }, children: /* @__PURE__ */ e(Ce, { size: 14 }) }) })
1339
+ ] }) })
1340
+ ] }) })
1341
+ ] }) }) : /* @__PURE__ */ e(s.Container, { children: /* @__PURE__ */ e(s.EmptyState, { illustration: /* @__PURE__ */ e(Te, { size: 56 }), title: "No identity providers in this environment", description: "Each environment automatically gets a Thunder identity provider." }) })
1342
+ ] })
1343
+ ] }), n[29] = l, n[30] = g, n[31] = x, n[32] = E, n[33] = w, n[34] = z, n[35] = c, n[36] = S, n[37] = a, n[38] = t, n[39] = v, n[40] = ee) : ee = n[40];
1344
+ let de;
1345
+ return n[41] !== C || n[42] !== U || n[43] !== m || n[44] !== H || n[45] !== Q || n[46] !== Z || n[47] !== ee || n[48] !== X || n[49] !== G ? (de = /* @__PURE__ */ i(Pe, { title: U, backHref: C, backLabel: "Back to Environments", description: X, isLoading: m, disableIcon: !0, titleTail: G, children: [
1346
+ H,
1347
+ Q,
1348
+ Z,
1349
+ ee
1350
+ ] }), n[41] = C, n[42] = U, n[43] = m, n[44] = H, n[45] = Q, n[46] = Z, n[47] = ee, n[48] = X, n[49] = G, n[50] = de) : de = n[50], de;
1351
+ }
1352
+ function at(n, t) {
1353
+ return /* @__PURE__ */ e(R, { variant: "rounded", height: 56 }, t);
1354
+ }
1355
+ const ot = "environment-create-drawer", lt = "environment-delete-drawer";
1356
+ function Ge() {
1357
+ const n = ae(20), {
1358
+ orgId: t
1359
+ } = oe(), [r, a] = D(null), [o, h] = D(null), [l, m] = D(!1), g = ke(ot)[0], f = ke(lt)[0], y = g?.component ?? Qn, p = f?.component ?? et;
1360
+ let c;
1361
+ n[0] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ e(ie, { index: !0, element: /* @__PURE__ */ e(Pe, { title: "Environments", disableIcon: !0, children: /* @__PURE__ */ e(Vn, { onEditEnvironment: a, onCreateEnvironment: () => m(!0), onDeleteEnvironment: h }) }) }), n[0] = c) : c = n[0];
1362
+ let d;
1363
+ n[1] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ e(ie, { path: ":envName", element: /* @__PURE__ */ e(rt, {}) }), n[1] = d) : d = n[1];
1364
+ const C = `/org/${t}/environments`;
1365
+ let P;
1366
+ n[2] !== C ? (P = /* @__PURE__ */ i(Ye, { children: [
1367
+ c,
1368
+ d,
1369
+ /* @__PURE__ */ e(ie, { path: "*", element: /* @__PURE__ */ e(Je, { to: C, replace: !0 }) })
1370
+ ] }), n[2] = C, n[3] = P) : P = n[3];
1371
+ let x;
1372
+ n[4] !== y || n[5] !== l || n[6] !== t ? (x = l && t && /* @__PURE__ */ e(y, { open: l, onClose: () => m(!1), orgId: t }), n[4] = y, n[5] = l, n[6] = t, n[7] = x) : x = n[7];
1373
+ let N;
1374
+ n[8] !== r || n[9] !== t ? (N = r && t && /* @__PURE__ */ e(Kn, { open: !0, onClose: () => a(null), environment: r, orgId: t }), n[8] = r, n[9] = t, n[10] = N) : N = n[10];
1375
+ let T;
1376
+ n[11] !== p || n[12] !== o || n[13] !== t ? (T = o && t && /* @__PURE__ */ e(p, { open: !0, onClose: () => h(null), environment: o, orgId: t }), n[11] = p, n[12] = o, n[13] = t, n[14] = T) : T = n[14];
1377
+ let S;
1378
+ return n[15] !== P || n[16] !== x || n[17] !== N || n[18] !== T ? (S = /* @__PURE__ */ i(te, { children: [
1379
+ P,
1380
+ x,
1381
+ N,
1382
+ T
1383
+ ] }), n[15] = P, n[16] = x, n[17] = N, n[18] = T, n[19] = S) : S = n[19], S;
1384
+ }
1385
+ const xt = {
1386
+ title: "Deployment Pipelines",
1387
+ description: "A page component for Deployment Pipeline and Environment management",
1388
+ icon: bn,
1389
+ path: "/deployment-pipelines",
1390
+ component: _e,
1391
+ levels: {
1392
+ organization: _e
1393
+ }
1394
+ }, Pt = {
1395
+ title: "Environments",
1396
+ description: "A page component for Environment management",
1397
+ icon: qe,
1398
+ path: "/environments",
1399
+ component: Ge,
1400
+ levels: {
1401
+ organization: Ge
1402
+ }
1403
+ };
1404
+ export {
1405
+ _e as DeploymentPipelinesOrganization,
1406
+ Ge as EnvironmentsOrganization,
1407
+ Pt as environmentsMetaData,
1408
+ xt as metaData
1409
+ };