@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,1143 @@
1
+ import { jsx as n, jsxs as b, Fragment as Re } from "react/jsx-runtime";
2
+ import { c as ie } from "react/compiler-runtime";
3
+ import { useState as G, useMemo as ne, useEffect as be, useCallback as Le, useRef as Nt } from "react";
4
+ import { Stack as C, Form as ee, TextField as se, IconButton as rt, Button as J, Typography as B, MenuItem as dt, Select as jt, FormHelperText as ft, FormControl as Dt, Switch as $t, Chip as ut, Accordion as He, AccordionSummary as Qe, AccordionDetails as Ue, Box as ve, Card as ht, Skeleton as oe, Alert as pt, SearchBar as It, CardContent as zt, Avatar as Tt, Tooltip as Xe, ListingTable as ge } from "@wso2/oxygen-ui";
5
+ import { Trash2 as mt, Plus as qe, ChevronDown as Ze, ShieldAlert as Je, Check as St, Circle as Ot, Search as Pt, ArrowLeft as Ge, ShieldCheck as Lt, Trash as Rt } from "@wso2/oxygen-ui-icons-react";
6
+ import { bp as qt, cO as Vt, x as Bt, t as Ft, D as Wt, s as kt, cP as Mt, N as _t } from "./index-ByEInFlf.js";
7
+ import "@tanstack/react-query";
8
+ import { j as Kt } from "./js-yaml-CvhD-clg.js";
9
+ function nt(t, e = "", r = 0, s = []) {
10
+ const i = [];
11
+ if (t.type === "object" && t.properties) {
12
+ const a = t.required || [];
13
+ Object.entries(t.properties).forEach(([o, l]) => {
14
+ const d = e ? `${e}.${o}` : o, c = a.includes(o) || s.includes(o), u = {
15
+ id: d,
16
+ path: d,
17
+ name: o,
18
+ schema: l,
19
+ depth: r,
20
+ isRequired: c,
21
+ isExpanded: !1
22
+ };
23
+ l.type === "object" && l.properties ? u.children = nt(l, d, r + 1, l.required || []) : l.type === "array" && (u.isArrayContainer = !0), i.push(u);
24
+ });
25
+ }
26
+ return i;
27
+ }
28
+ function te(t, e) {
29
+ if (!e) return t;
30
+ const r = e.split(".");
31
+ let s = t;
32
+ for (const i of r) {
33
+ if (s == null) return;
34
+ if (typeof s == "object")
35
+ s = s[i];
36
+ else
37
+ return;
38
+ }
39
+ return s;
40
+ }
41
+ function Ye(t, e, r) {
42
+ if (!e) return r;
43
+ const s = e.split("."), i = {
44
+ ...t
45
+ };
46
+ let a = i;
47
+ for (let l = 0; l < s.length - 1; l++) {
48
+ const d = s[l], c = s[l + 1], u = /^\d+$/.test(c), f = a[d];
49
+ f == null || typeof f != "object" ? a[d] = u ? [] : {} : Array.isArray(f) ? a[d] = [...f] : a[d] = {
50
+ ...f
51
+ }, a = a[d];
52
+ }
53
+ const o = s[s.length - 1];
54
+ return a[o] = r, i;
55
+ }
56
+ function Gt(t, e) {
57
+ const r = e.anyOf ?? e.oneOf ?? [];
58
+ return r.length === 0 ? !1 : r.some((s) => s.properties?.[t]?.const === !1 && s.required?.includes(t));
59
+ }
60
+ function Yt(t, e) {
61
+ return (e.anyOf ?? e.oneOf ?? []).some((s) => s.required?.includes(t));
62
+ }
63
+ function xe(t) {
64
+ return t == null || t === "" || typeof t == "string" && t.trim().length === 0 ? !1 : Array.isArray(t) ? t.some(xe) : typeof t == "object" ? Object.values(t).some(xe) : !0;
65
+ }
66
+ function Ae(t, e) {
67
+ const r = e ? {
68
+ ...e
69
+ } : {};
70
+ return t.type === "object" && t.properties && Object.entries(t.properties).forEach(([s, i]) => {
71
+ if (r[s] === void 0)
72
+ if (s === "jsonPath")
73
+ r[s] = "";
74
+ else if (i.type === "boolean" && Gt(s, t))
75
+ r[s] = !1;
76
+ else if (i.default !== void 0)
77
+ r[s] = i.default;
78
+ else if (i.type === "object" && i.properties) {
79
+ if (Yt(s, t))
80
+ return;
81
+ r[s] = Ae(i);
82
+ } else i.type === "array" ? r[s] = [] : i.type === "boolean" ? r[s] = !1 : i.type === "number" || i.type === "integer" ? r[s] = i.minimum ?? i.maximum ?? "" : r[s] = "";
83
+ else i.type === "object" && i.properties && typeof r[s] == "object" && (r[s] = Ae(i, r[s]));
84
+ }), r;
85
+ }
86
+ function ot(t, e) {
87
+ if (t == null || typeof t == "string" && /\$\{.+\}/.test(t)) return t;
88
+ switch (e.type) {
89
+ case "boolean": {
90
+ if (typeof t == "boolean") return t;
91
+ if (typeof t == "string") {
92
+ if (t.toLowerCase() === "true") return !0;
93
+ if (t.toLowerCase() === "false") return !1;
94
+ }
95
+ return t;
96
+ }
97
+ case "number": {
98
+ if (typeof t == "number") return t;
99
+ if (typeof t == "string" && t !== "") {
100
+ const r = parseFloat(t);
101
+ if (!Number.isNaN(r)) return r;
102
+ }
103
+ return t;
104
+ }
105
+ case "integer": {
106
+ if (typeof t == "number") return t;
107
+ if (typeof t == "string" && t !== "") {
108
+ const r = parseInt(t, 10);
109
+ if (!Number.isNaN(r)) return r;
110
+ }
111
+ return t;
112
+ }
113
+ case "object":
114
+ return typeof t == "object" && !Array.isArray(t) ? t : typeof t == "string" && t === "" ? {} : t;
115
+ default:
116
+ return t;
117
+ }
118
+ }
119
+ function Ht(t, e) {
120
+ if (t.length === 0) return;
121
+ const r = t.map((i) => new Set(i.required ?? []));
122
+ let s = -1;
123
+ r.forEach((i, a) => {
124
+ if (s >= 0) return;
125
+ let o = i.size > 0;
126
+ i.forEach((l) => {
127
+ const d = e[l];
128
+ xe(d) || (o = !1);
129
+ }), o && (s = a);
130
+ }), r.forEach((i, a) => {
131
+ a !== s && i.forEach((o) => {
132
+ const l = e[o];
133
+ xe(l) || delete e[o];
134
+ });
135
+ });
136
+ }
137
+ function et(t, e) {
138
+ if (t.type !== "object" || !t.properties) return e;
139
+ const r = {
140
+ ...e
141
+ };
142
+ Object.entries(t.properties).forEach(([i, a]) => {
143
+ const o = r[i];
144
+ o !== void 0 && (a.type === "object" && a.properties && typeof o == "object" && o !== null && !Array.isArray(o) ? r[i] = et(a, o) : a.type === "array" && Array.isArray(o) && a.items ? r[i] = o.map((l) => a.items.type === "object" && a.items.properties && typeof l == "object" && l !== null ? et(a.items, l) : ot(l, a.items)) : r[i] = ot(o, a));
145
+ });
146
+ const s = t.oneOf ?? t.anyOf ?? [];
147
+ return s.length > 0 && Ht(s, r), r;
148
+ }
149
+ function Qt(t) {
150
+ return t.type === "object" && t.properties ? Ae(t) : t.type === "string" ? t.default ?? "" : t.type === "boolean" ? t.default ?? !1 : t.type === "number" || t.type === "integer" ? t.default !== void 0 ? t.default : t.minimum ?? t.maximum ?? "" : t.type === "array" ? [] : null;
151
+ }
152
+ const Ut = /* @__PURE__ */ new Set(["object", "array", "string", "boolean", "number", "integer"]);
153
+ function yt(t) {
154
+ return typeof t == "object" && t !== null && !Array.isArray(t);
155
+ }
156
+ function Xt() {
157
+ return {
158
+ type: "object",
159
+ properties: {}
160
+ };
161
+ }
162
+ function it(t) {
163
+ if (!yt(t) || typeof t.type != "string" || !Ut.has(t.type))
164
+ return;
165
+ const e = {
166
+ ...t,
167
+ type: t.type
168
+ };
169
+ if (t.properties !== void 0 || t.type === "object" ? e.properties = Zt(t.properties) : delete e.properties, t.items !== void 0) {
170
+ const r = it(t.items);
171
+ r ? e.items = r : delete e.items;
172
+ }
173
+ return e;
174
+ }
175
+ function Zt(t) {
176
+ return yt(t) ? Object.entries(t).reduce((e, [r, s]) => {
177
+ const i = it(s);
178
+ return i && (e[r] = i), e;
179
+ }, {}) : {};
180
+ }
181
+ function at(t) {
182
+ return it(t) ?? Xt();
183
+ }
184
+ function Jt(t) {
185
+ const e = Kt.load(t);
186
+ if (!e || typeof e != "object" || Array.isArray(e))
187
+ throw new Error("Policy definition YAML must be an object");
188
+ const r = e;
189
+ if (typeof r.name != "string" || !r.name)
190
+ throw new Error("Policy definition must have a name");
191
+ if (typeof r.version != "string" || !r.version)
192
+ throw new Error("Policy definition must have a version. eg: 1.0.0");
193
+ const s = at(r.parameters), i = at(r.systemParameters);
194
+ return {
195
+ name: r.name,
196
+ version: r.version,
197
+ description: typeof r.description == "string" ? r.description : "",
198
+ parameters: s,
199
+ systemParameters: i
200
+ };
201
+ }
202
+ function er(t) {
203
+ return t.replace(/([A-Z])/g, " $1").replace(/[_-]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase());
204
+ }
205
+ function Ee(t) {
206
+ const e = er(t.name);
207
+ return t.isRequired ? `* ${e}` : e;
208
+ }
209
+ const tr = ({
210
+ value: t,
211
+ onChange: e,
212
+ placeholder: r,
213
+ disabled: s,
214
+ error: i,
215
+ helperText: a
216
+ }) => {
217
+ const [o, l] = G(""), d = ne(() => t.map((f) => f.trim()).filter(Boolean), [t]), c = (f) => {
218
+ const p = f.trim();
219
+ !p || d.includes(p) || e([...d, p]);
220
+ }, u = (f) => {
221
+ if (f.key === "Enter" || f.key === ",") {
222
+ f.preventDefault(), c(o), l("");
223
+ return;
224
+ }
225
+ f.key === "Backspace" && o === "" && t.length > 0 && e(d.slice(0, -1));
226
+ };
227
+ return /* @__PURE__ */ b(C, { spacing: 0.75, pt: 1, children: [
228
+ d.length > 0 && /* @__PURE__ */ n(C, { direction: "row", flexWrap: "wrap", spacing: 0.5, useFlexGap: !0, children: d.map((f) => /* @__PURE__ */ n(ut, { label: f, size: "small", onDelete: s ? void 0 : () => e(d.filter((p) => p !== f)) }, f)) }),
229
+ /* @__PURE__ */ n(se, { value: o, onChange: (f) => l(f.target.value), onKeyDown: u, disabled: s, placeholder: r, size: "small", error: !!i }),
230
+ a && /* @__PURE__ */ n(ft, { error: !!i, children: a })
231
+ ] });
232
+ }, lt = (t) => {
233
+ const e = ie(38), {
234
+ node: r,
235
+ value: s,
236
+ onChange: i,
237
+ error: a,
238
+ disabled: o
239
+ } = t;
240
+ let l;
241
+ e[0] !== r ? (l = Ee(r), e[0] = r, e[1] = l) : l = e[1];
242
+ const d = l, c = a || r.schema.description;
243
+ if (r.schema.enum && r.schema.enum.length > 0) {
244
+ const v = r.path, N = !!a, j = s || "";
245
+ let D;
246
+ e[2] !== r.path || e[3] !== i ? (D = ($) => i(r.path, $.target.value), e[2] = r.path, e[3] = i, e[4] = D) : D = e[4];
247
+ let x;
248
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(dt, { value: "", children: /* @__PURE__ */ n("em", { children: "Select..." }) }), e[5] = x) : x = e[5];
249
+ let w;
250
+ e[6] !== r.schema.enum ? (w = r.schema.enum.map(ar), e[6] = r.schema.enum, e[7] = w) : w = e[7];
251
+ let A;
252
+ e[8] !== j || e[9] !== D || e[10] !== w ? (A = /* @__PURE__ */ b(jt, { value: j, onChange: D, displayEmpty: !0, variant: "outlined", children: [
253
+ x,
254
+ w
255
+ ] }), e[8] = j, e[9] = D, e[10] = w, e[11] = A) : A = e[11];
256
+ let S;
257
+ e[12] !== a || e[13] !== c ? (S = c && /* @__PURE__ */ n(ft, { error: !!a, children: c }), e[12] = a, e[13] = c, e[14] = S) : S = e[14];
258
+ let O;
259
+ e[15] !== o || e[16] !== N || e[17] !== A || e[18] !== S ? (O = /* @__PURE__ */ b(Dt, { fullWidth: !0, size: "small", error: N, disabled: o, children: [
260
+ A,
261
+ S
262
+ ] }), e[15] = o, e[16] = N, e[17] = A, e[18] = S, e[19] = O) : O = e[19];
263
+ let k;
264
+ return e[20] !== d || e[21] !== r.path || e[22] !== O ? (k = /* @__PURE__ */ n(C, { pb: 2, children: /* @__PURE__ */ n(ee.ElementWrapper, { label: d, name: v, children: O }) }), e[20] = d, e[21] = r.path, e[22] = O, e[23] = k) : k = e[23], k;
265
+ }
266
+ const u = s || "";
267
+ let f;
268
+ e[24] !== r.path || e[25] !== i ? (f = (v) => i(r.path, v.target.value), e[24] = r.path, e[25] = i, e[26] = f) : f = e[26];
269
+ const p = !!a, h = r.schema.default ? String(r.schema.default) : "";
270
+ let y;
271
+ e[27] !== o || e[28] !== c || e[29] !== u || e[30] !== f || e[31] !== p || e[32] !== h ? (y = /* @__PURE__ */ n(se, { value: u, onChange: f, disabled: o, error: p, helperText: c, fullWidth: !0, size: "small", placeholder: h }), e[27] = o, e[28] = c, e[29] = u, e[30] = f, e[31] = p, e[32] = h, e[33] = y) : y = e[33];
272
+ let m;
273
+ return e[34] !== d || e[35] !== r.path || e[36] !== y ? (m = /* @__PURE__ */ n(C, { spacing: 0.75, pb: 2, children: /* @__PURE__ */ n(ee.ElementWrapper, { label: d, name: r.path, children: y }) }), e[34] = d, e[35] = r.path, e[36] = y, e[37] = m) : m = e[37], m;
274
+ }, rr = (t) => {
275
+ const e = ie(21), {
276
+ node: r,
277
+ value: s,
278
+ onChange: i,
279
+ error: a,
280
+ disabled: o
281
+ } = t;
282
+ let l;
283
+ e[0] !== r ? (l = Ee(r), e[0] = r, e[1] = l) : l = e[1];
284
+ const d = l, c = s === !0 || s === "true";
285
+ let u;
286
+ e[2] !== r.path || e[3] !== i ? (u = (v) => i(r.path, v.target.checked), e[2] = r.path, e[3] = i, e[4] = u) : u = e[4];
287
+ let f;
288
+ e[5] !== c || e[6] !== o || e[7] !== u ? (f = /* @__PURE__ */ n($t, { checked: c, onChange: u, disabled: o }), e[5] = c, e[6] = o, e[7] = u, e[8] = f) : f = e[8];
289
+ let p;
290
+ e[9] !== r.schema.description ? (p = r.schema.description && /* @__PURE__ */ n(B, { variant: "caption", color: "text.secondary", children: r.schema.description }), e[9] = r.schema.description, e[10] = p) : p = e[10];
291
+ let h;
292
+ e[11] !== f || e[12] !== p ? (h = /* @__PURE__ */ b(C, { direction: "row", alignItems: "center", spacing: 1, children: [
293
+ f,
294
+ p
295
+ ] }), e[11] = f, e[12] = p, e[13] = h) : h = e[13];
296
+ let y;
297
+ e[14] !== a ? (y = a && /* @__PURE__ */ n(B, { variant: "caption", color: "error", children: a }), e[14] = a, e[15] = y) : y = e[15];
298
+ let m;
299
+ return e[16] !== d || e[17] !== r.path || e[18] !== h || e[19] !== y ? (m = /* @__PURE__ */ n(C, { spacing: 0.75, pb: 2, children: /* @__PURE__ */ b(ee.ElementWrapper, { label: d, name: r.path, children: [
300
+ h,
301
+ y
302
+ ] }) }), e[16] = d, e[17] = r.path, e[18] = h, e[19] = y, e[20] = m) : m = e[20], m;
303
+ }, nr = (t) => {
304
+ const e = ie(22), {
305
+ node: r,
306
+ value: s,
307
+ onChange: i,
308
+ error: a,
309
+ disabled: o
310
+ } = t;
311
+ let l;
312
+ e[0] !== r ? (l = Ee(r), e[0] = r, e[1] = l) : l = e[1];
313
+ const d = l, c = r.schema.type === "integer", u = a || r.schema.description;
314
+ let f;
315
+ e[2] !== c || e[3] !== r.path || e[4] !== i ? (f = (x) => {
316
+ const w = x.target.value;
317
+ if (w === "") {
318
+ i(r.path, "");
319
+ return;
320
+ }
321
+ const A = c ? parseInt(w, 10) : parseFloat(w);
322
+ Number.isNaN(A) || i(r.path, A);
323
+ }, e[2] = c, e[3] = r.path, e[4] = i, e[5] = f) : f = e[5];
324
+ const p = f, h = s !== void 0 && s !== "" ? String(s) : "", y = !!a, m = r.schema.default !== void 0 ? String(r.schema.default) : "", v = c ? 1 : "any";
325
+ let N;
326
+ e[6] !== r.schema.maximum || e[7] !== r.schema.minimum || e[8] !== v ? (N = {
327
+ htmlInput: {
328
+ min: r.schema.minimum,
329
+ max: r.schema.maximum,
330
+ step: v
331
+ }
332
+ }, e[6] = r.schema.maximum, e[7] = r.schema.minimum, e[8] = v, e[9] = N) : N = e[9];
333
+ let j;
334
+ e[10] !== o || e[11] !== p || e[12] !== u || e[13] !== h || e[14] !== y || e[15] !== m || e[16] !== N ? (j = /* @__PURE__ */ n(se, { type: "number", value: h, onChange: p, disabled: o, error: y, helperText: u, fullWidth: !0, size: "small", placeholder: m, slotProps: N }), e[10] = o, e[11] = p, e[12] = u, e[13] = h, e[14] = y, e[15] = m, e[16] = N, e[17] = j) : j = e[17];
335
+ let D;
336
+ return e[18] !== d || e[19] !== r.path || e[20] !== j ? (D = /* @__PURE__ */ n(C, { spacing: 0.75, pb: 2, children: /* @__PURE__ */ n(ee.ElementWrapper, { label: d, name: r.path, children: j }) }), e[18] = d, e[19] = r.path, e[20] = j, e[21] = D) : D = e[21], D;
337
+ }, ir = (t) => {
338
+ const e = ie(18), {
339
+ node: r,
340
+ value: s,
341
+ onChange: i,
342
+ error: a,
343
+ disabled: o
344
+ } = t;
345
+ let l;
346
+ e[0] !== r ? (l = Ee(r), e[0] = r, e[1] = l) : l = e[1];
347
+ const d = l, c = r.schema.items?.type;
348
+ let u;
349
+ e[2] !== s ? (u = Array.isArray(s) ? s.map(String) : [], e[2] = s, e[3] = u) : u = e[3];
350
+ const f = u;
351
+ let p;
352
+ e[4] !== c || e[5] !== r.path || e[6] !== i ? (p = (j) => {
353
+ if (c === "number" || c === "integer") {
354
+ const D = j.map(lr);
355
+ i(r.path, D);
356
+ return;
357
+ }
358
+ i(r.path, j);
359
+ }, e[4] = c, e[5] = r.path, e[6] = i, e[7] = p) : p = e[7];
360
+ const h = p, y = a || r.schema.description, m = !!a;
361
+ let v;
362
+ e[8] !== f || e[9] !== o || e[10] !== h || e[11] !== y || e[12] !== m ? (v = /* @__PURE__ */ n(tr, { placeholder: "Type a value and press Enter", value: f, onChange: h, helperText: y, error: m, disabled: o }), e[8] = f, e[9] = o, e[10] = h, e[11] = y, e[12] = m, e[13] = v) : v = e[13];
363
+ let N;
364
+ return e[14] !== d || e[15] !== r.path || e[16] !== v ? (N = /* @__PURE__ */ n(C, { spacing: 0.75, pb: 2, children: /* @__PURE__ */ n(ee.ElementWrapper, { label: d, name: r.path, children: v }) }), e[14] = d, e[15] = r.path, e[16] = v, e[17] = N) : N = e[17], N;
365
+ }, sr = ({
366
+ node: t,
367
+ value: e,
368
+ onChange: r,
369
+ disabled: s
370
+ }) => {
371
+ const i = Ee(t), [a, o] = G(""), [l, d] = G(""), c = e && typeof e == "object" && !Array.isArray(e) ? e : {}, u = Object.entries(c), f = () => {
372
+ a.trim() && (r(t.path, {
373
+ ...c,
374
+ [a.trim()]: l
375
+ }), o(""), d(""));
376
+ }, p = (h) => {
377
+ h.key === "Enter" && (h.preventDefault(), f());
378
+ };
379
+ return /* @__PURE__ */ n(C, { spacing: 0.75, pb: 2, children: /* @__PURE__ */ n(ee.ElementWrapper, { label: i, name: t.path, children: /* @__PURE__ */ b(C, { spacing: 1, children: [
380
+ u.map(([h, y]) => /* @__PURE__ */ b(C, { direction: "row", spacing: 1, alignItems: "center", children: [
381
+ /* @__PURE__ */ n(se, { value: h, disabled: s, size: "small", sx: {
382
+ width: "40%"
383
+ } }),
384
+ /* @__PURE__ */ n(se, { value: y, onChange: (m) => r(t.path, {
385
+ ...c,
386
+ [h]: m.target.value
387
+ }), sx: {
388
+ width: "40%"
389
+ }, disabled: s, size: "small" }),
390
+ /* @__PURE__ */ n(rt, { size: "small", color: "error", onClick: () => {
391
+ const m = {
392
+ ...c
393
+ };
394
+ delete m[h], r(t.path, m);
395
+ }, disabled: s, children: /* @__PURE__ */ n(mt, { size: 14 }) })
396
+ ] }, h)),
397
+ /* @__PURE__ */ b(C, { direction: "row", spacing: 1, alignItems: "center", children: [
398
+ /* @__PURE__ */ n(se, { value: a, onChange: (h) => o(h.target.value), placeholder: "Key", disabled: s, size: "small", sx: {
399
+ width: "40%"
400
+ }, onKeyDown: p }),
401
+ /* @__PURE__ */ n(se, { value: l, onChange: (h) => d(h.target.value), placeholder: "Value", disabled: s, size: "small", sx: {
402
+ width: "40%"
403
+ }, onKeyDown: p }),
404
+ /* @__PURE__ */ n(J, { variant: "outlined", size: "small", onClick: f, disabled: s || !a.trim(), startIcon: /* @__PURE__ */ n(qe, { size: 14 }), children: "Add" })
405
+ ] }),
406
+ t.schema.description && /* @__PURE__ */ n(B, { variant: "caption", color: "text.secondary", children: t.schema.description })
407
+ ] }) }) });
408
+ }, or = (t) => {
409
+ const {
410
+ schema: e
411
+ } = t;
412
+ switch (e.type) {
413
+ case "string":
414
+ return lt;
415
+ case "boolean":
416
+ return rr;
417
+ case "number":
418
+ case "integer":
419
+ return nr;
420
+ case "array":
421
+ return e.items?.type === "string" || e.items?.type === "number" || e.items?.type === "integer" ? ir : null;
422
+ case "object":
423
+ return e.additionalProperties && !e.properties ? sr : null;
424
+ default:
425
+ return lt;
426
+ }
427
+ };
428
+ function ar(t) {
429
+ return /* @__PURE__ */ n(dt, { value: t, children: t }, t);
430
+ }
431
+ function lr(t) {
432
+ const e = Number(t);
433
+ return Number.isNaN(e) ? t : e;
434
+ }
435
+ function gt(t) {
436
+ if (!t.some((i) => i.schema["x-wso2-policy-advanced-param"] !== void 0))
437
+ return {
438
+ mainNodes: t,
439
+ advancedNodes: []
440
+ };
441
+ const r = [], s = [];
442
+ return t.forEach((i) => {
443
+ const a = i.schema["x-wso2-policy-advanced-param"];
444
+ if (a === !1) {
445
+ r.push(i);
446
+ return;
447
+ }
448
+ if (a === !0) {
449
+ s.push(i);
450
+ return;
451
+ }
452
+ const o = i.schema.type === "object" && i.schema.properties !== void 0 && (i.schema.required?.length ?? 0) > 0;
453
+ i.isRequired || o ? r.push(i) : s.push(i);
454
+ }), {
455
+ mainNodes: r,
456
+ advancedNodes: s
457
+ };
458
+ }
459
+ const Ce = ({
460
+ node: t,
461
+ values: e,
462
+ onChange: r,
463
+ onAddArrayItem: s,
464
+ onDeleteArrayItem: i,
465
+ errors: a,
466
+ disabled: o
467
+ }) => {
468
+ const l = te(e, t.path), d = t.schema.type === "array" && t.schema.items?.type === "object", c = ne(() => Array.isArray(l) ? l : [], [l]), u = or(t), f = u !== null, p = ne(() => {
469
+ const x = t.path + ".";
470
+ return Object.keys(a).some((w) => w.startsWith(x));
471
+ }, [a, t.path]), [h, y] = G(t.isExpanded ?? !1);
472
+ be(() => {
473
+ p && y(!0);
474
+ }, [p]);
475
+ const m = Le((x, w) => {
476
+ s(x, w);
477
+ }, [s]), v = Nt(c.length), N = c.length > v.current ? c.length - 1 : -1, j = ne(() => d ? c.map((x, w) => {
478
+ const A = `${t.path}.${w}`;
479
+ return {
480
+ id: A,
481
+ path: A,
482
+ name: `Item ${w + 1}`,
483
+ schema: t.schema.items,
484
+ depth: t.depth + 1,
485
+ isRequired: !1,
486
+ isExpanded: w === N,
487
+ isArrayItem: !0,
488
+ arrayIndex: w,
489
+ parentArrayPath: t.path,
490
+ children: t.schema.items?.type === "object" && t.schema.items?.properties ? nt(t.schema.items, A, t.depth + 2, t.schema.items.required || []) : void 0
491
+ };
492
+ }) : [], [d, c, t, N]);
493
+ if (be(() => {
494
+ v.current = c.length;
495
+ }), f)
496
+ return /* @__PURE__ */ n(u, { node: t, value: l, onChange: r, error: a[t.path], disabled: o });
497
+ const D = /* @__PURE__ */ b(C, { direction: "row", alignItems: "center", spacing: 1, sx: {
498
+ flex: 1
499
+ }, children: [
500
+ /* @__PURE__ */ n(B, { variant: "h6", children: t.name }),
501
+ !t.isRequired && /* @__PURE__ */ n(B, { variant: "caption", color: "text.secondary", children: "(Optional)" }),
502
+ t.isArrayItem && t.parentArrayPath !== void 0 && /* @__PURE__ */ n(rt, { size: "small", color: "error", onClick: (x) => {
503
+ x.stopPropagation(), i(t.parentArrayPath, t.arrayIndex);
504
+ }, disabled: o, "aria-label": `Delete ${t.name}`, sx: {
505
+ ml: "auto"
506
+ }, children: /* @__PURE__ */ n(mt, { size: 14 }) })
507
+ ] });
508
+ return /* @__PURE__ */ b(He, { expanded: h, onChange: (x, w) => y(w), disableGutters: !0, children: [
509
+ /* @__PURE__ */ n(Qe, { expandIcon: /* @__PURE__ */ n(Ze, { size: 16 }), children: D }),
510
+ /* @__PURE__ */ b(Ue, { children: [
511
+ t.schema.description && /* @__PURE__ */ n(B, { variant: "body2", color: "text.secondary", sx: {
512
+ mb: 2
513
+ }, children: t.schema.description }),
514
+ t.children && t.children.length > 0 && !d && (() => {
515
+ const {
516
+ mainNodes: x,
517
+ advancedNodes: w
518
+ } = gt(t.children);
519
+ return /* @__PURE__ */ b(Re, { children: [
520
+ x.length > 0 && /* @__PURE__ */ n(C, { children: x.map((A) => /* @__PURE__ */ n(Ce, { node: A, values: e, onChange: r, onAddArrayItem: m, onDeleteArrayItem: i, errors: a, disabled: o }, A.id)) }),
521
+ w.length > 0 && /* @__PURE__ */ b(He, { disableGutters: !0, sx: {
522
+ mt: 1
523
+ }, children: [
524
+ /* @__PURE__ */ n(Qe, { expandIcon: /* @__PURE__ */ n(Ze, { size: 16 }), children: /* @__PURE__ */ n(B, { variant: "body2", children: "Advanced Settings" }) }),
525
+ /* @__PURE__ */ n(Ue, { children: /* @__PURE__ */ n(C, { children: w.map((A) => /* @__PURE__ */ n(Ce, { node: A, values: e, onChange: r, onAddArrayItem: m, onDeleteArrayItem: i, errors: a, disabled: o }, A.id)) }) })
526
+ ] })
527
+ ] });
528
+ })(),
529
+ d && /* @__PURE__ */ b(C, { spacing: 1.5, children: [
530
+ /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(J, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(qe, { size: 14 }), onClick: () => m(t.path, t.schema.items), disabled: o, children: "Add Item" }) }),
531
+ /* @__PURE__ */ n(C, { children: j.map((x) => /* @__PURE__ */ n(Ce, { node: x, values: e, onChange: r, onAddArrayItem: m, onDeleteArrayItem: i, errors: a, disabled: o }, x.id)) })
532
+ ] })
533
+ ] })
534
+ ] });
535
+ }, cr = ({
536
+ schema: t,
537
+ values: e,
538
+ onChange: r,
539
+ onAddArrayItem: s,
540
+ onDeleteArrayItem: i,
541
+ errors: a,
542
+ disabled: o
543
+ }) => {
544
+ const l = ne(() => nt(t, "", 0, t.required || []), [t]), {
545
+ mainNodes: d,
546
+ advancedNodes: c
547
+ } = ne(() => gt(l), [l]);
548
+ return /* @__PURE__ */ b(C, { spacing: 2, children: [
549
+ d.length > 0 && /* @__PURE__ */ b(Re, { children: [
550
+ /* @__PURE__ */ n(B, { variant: "h6", children: "Parameters" }),
551
+ /* @__PURE__ */ n(C, { children: d.map((u) => /* @__PURE__ */ n(Ce, { node: u, values: e, onChange: r, onAddArrayItem: s, onDeleteArrayItem: i, errors: a, disabled: o }, u.id)) })
552
+ ] }),
553
+ c.length > 0 && /* @__PURE__ */ n(C, { spacing: 4, children: /* @__PURE__ */ b(He, { children: [
554
+ /* @__PURE__ */ n(Qe, { expandIcon: /* @__PURE__ */ n(Ze, { size: 16 }), children: /* @__PURE__ */ n(B, { variant: "h6", children: "Advanced Settings" }) }),
555
+ /* @__PURE__ */ n(Ue, { children: /* @__PURE__ */ n(C, { children: c.map((u) => /* @__PURE__ */ n(Ce, { node: u, values: e, onChange: r, onAddArrayItem: s, onDeleteArrayItem: i, errors: a, disabled: o }, u.id)) }) })
556
+ ] }) })
557
+ ] });
558
+ }, ct = 5, dr = (t) => {
559
+ const e = ie(23), {
560
+ text: r
561
+ } = t, [s, i] = G(!1);
562
+ let a, o, l, d, c, u, f;
563
+ if (e[0] !== s || e[1] !== r) {
564
+ const m = r.trim().split(`
565
+ `);
566
+ o = m.length > ct;
567
+ const v = s ? m : m.slice(0, ct);
568
+ a = B, l = "body2", d = "text.secondary", c = "div", e[9] === Symbol.for("react.memo_cache_sentinel") ? (u = {
569
+ whiteSpace: "pre-wrap"
570
+ }, e[9] = u) : u = e[9], f = v.join(`
571
+ `), e[0] = s, e[1] = r, e[2] = a, e[3] = o, e[4] = l, e[5] = d, e[6] = c, e[7] = u, e[8] = f;
572
+ } else
573
+ a = e[2], o = e[3], l = e[4], d = e[5], c = e[6], u = e[7], f = e[8];
574
+ let p;
575
+ e[10] !== a || e[11] !== l || e[12] !== d || e[13] !== c || e[14] !== u || e[15] !== f ? (p = /* @__PURE__ */ n(a, { variant: l, color: d, component: c, sx: u, children: f }), e[10] = a, e[11] = l, e[12] = d, e[13] = c, e[14] = u, e[15] = f, e[16] = p) : p = e[16];
576
+ let h;
577
+ e[17] !== s || e[18] !== o ? (h = o && /* @__PURE__ */ n(J, { variant: "text", size: "small", "aria-expanded": s, sx: {
578
+ alignSelf: "flex-start",
579
+ px: 0,
580
+ minWidth: 0
581
+ }, onClick: () => i(pr), children: s ? "Show less" : "Show more" }), e[17] = s, e[18] = o, e[19] = h) : h = e[19];
582
+ let y;
583
+ return e[20] !== p || e[21] !== h ? (y = /* @__PURE__ */ b(Re, { children: [
584
+ p,
585
+ h
586
+ ] }), e[20] = p, e[21] = h, e[22] = y) : y = e[22], y;
587
+ };
588
+ function tt(t, e, r = "") {
589
+ const s = [];
590
+ if (t.type === "object" && t.properties) {
591
+ const i = t.required || [];
592
+ Object.entries(t.properties).forEach(([o, l]) => {
593
+ const d = r ? `${r}.${o}` : o, c = te(e, d);
594
+ i.includes(o) && (c == null || c === "" || Array.isArray(c) && c.length === 0) && s.push({
595
+ path: d,
596
+ message: "This field is required"
597
+ }), l.type === "object" && l.properties && (i.includes(o) || xe(c)) && s.push(...tt(l, e, d)), l.type === "array" && l.items && Array.isArray(c) && c.forEach((u, f) => {
598
+ const p = `${d}.${f}`;
599
+ l.items.type === "object" && s.push(...tt(l.items, e, p));
600
+ });
601
+ });
602
+ const a = t.anyOf ?? t.oneOf ?? [];
603
+ if (a.length > 0 && !bt(a, e, r)) {
604
+ const o = fr(a, e, r);
605
+ if (o)
606
+ for (const l of o.required || []) {
607
+ const d = r ? `${r}.${l}` : l, c = te(e, d);
608
+ (c == null || c === "" || Array.isArray(c) && c.length === 0) && !s.find((f) => f.path === d) && s.push({
609
+ path: d,
610
+ message: "This field is required"
611
+ });
612
+ }
613
+ else {
614
+ const l = /* @__PURE__ */ new Set();
615
+ a.forEach((d) => {
616
+ (d.required || []).forEach((c) => l.add(c)), Object.keys(d.properties || {}).forEach((c) => l.add(c));
617
+ }), l.forEach((d) => {
618
+ const c = r ? `${r}.${d}` : d;
619
+ s.find((u) => u.path === c) || s.push({
620
+ path: c,
621
+ message: "At least one of these fields is required"
622
+ });
623
+ });
624
+ }
625
+ }
626
+ }
627
+ return s;
628
+ }
629
+ function fr(t, e, r = "") {
630
+ for (const s of t) {
631
+ const i = s.properties || {}, a = Object.entries(i).filter(([, l]) => l.const !== void 0);
632
+ if (a.length === 0) continue;
633
+ if (a.every(([l, d]) => {
634
+ const c = r ? `${r}.${l}` : l;
635
+ return te(e, c) === d.const;
636
+ })) return s;
637
+ }
638
+ return t.find((s) => {
639
+ const i = s.properties || {};
640
+ return Object.values(i).every((a) => a.const === void 0);
641
+ }) ?? null;
642
+ }
643
+ function bt(t, e, r = "") {
644
+ return t.length === 0 ? !0 : t.some((s) => {
645
+ for (const i of s.required || []) {
646
+ const a = r ? `${r}.${i}` : i, o = te(e, a);
647
+ if (!xe(o)) return !1;
648
+ const l = s.properties?.[i]?.const;
649
+ if (l !== void 0 && o !== l) return !1;
650
+ }
651
+ for (const [i, a] of Object.entries(s.properties || {}))
652
+ if (!(s.required || []).includes(i) && a.const !== void 0) {
653
+ const o = r ? `${r}.${i}` : i;
654
+ if (te(e, o) !== a.const) return !1;
655
+ }
656
+ return !0;
657
+ });
658
+ }
659
+ function ur(t, e) {
660
+ if (t.type !== "object" || !t.properties) return !0;
661
+ for (const s of t.required || []) {
662
+ const i = te(e, s);
663
+ if (i == null || i === "" || Array.isArray(i) && i.length === 0) return !1;
664
+ }
665
+ const r = t.anyOf ?? t.oneOf ?? [];
666
+ return !!bt(r, e);
667
+ }
668
+ const hr = (t) => {
669
+ const e = ie(44), {
670
+ policyDefinition: r,
671
+ policyDisplayName: s,
672
+ existingValues: i,
673
+ onCancel: a,
674
+ onSubmit: o,
675
+ isEditMode: l,
676
+ disabled: d
677
+ } = t, c = l === void 0 ? !1 : l, u = d === void 0 ? !1 : d, {
678
+ name: f,
679
+ description: p,
680
+ parameters: h
681
+ } = r, y = s || f;
682
+ let m;
683
+ e[0] !== i || e[1] !== h ? (m = () => Ae(h, i), e[0] = i, e[1] = h, e[2] = m) : m = e[2];
684
+ const [v, N] = G(m);
685
+ let j;
686
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (j = {}, e[3] = j) : j = e[3];
687
+ const [D, x] = G(j), w = ur(h, v);
688
+ let A, S;
689
+ e[4] !== i || e[5] !== h ? (A = () => {
690
+ i && N(Ae(h, i));
691
+ }, S = [i, h], e[4] = i, e[5] = h, e[6] = A, e[7] = S) : (A = e[6], S = e[7]), be(A, S);
692
+ let O;
693
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (O = (z, H) => {
694
+ N((K) => Ye(K, z, H)), x((K) => {
695
+ if (!K[z])
696
+ return K;
697
+ const X = {
698
+ ...K
699
+ };
700
+ return delete X[z], X;
701
+ });
702
+ }, e[8] = O) : O = e[8];
703
+ const k = O;
704
+ let $;
705
+ e[9] === Symbol.for("react.memo_cache_sentinel") ? ($ = (z, H) => {
706
+ N((K) => {
707
+ const X = te(K, z) || [];
708
+ return Ye(K, z, [...X, Qt(H)]);
709
+ });
710
+ }, e[9] = $) : $ = e[9];
711
+ const L = $;
712
+ let I;
713
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (I = (z, H) => {
714
+ N((K) => {
715
+ const X = te(K, z) || [];
716
+ return Ye(K, z, X.filter((st, ae) => ae !== H));
717
+ });
718
+ }, e[10] = I) : I = e[10];
719
+ const R = I;
720
+ let P;
721
+ e[11] !== o || e[12] !== h || e[13] !== v ? (P = () => {
722
+ const z = tt(h, v);
723
+ if (z.length > 0) {
724
+ const H = {};
725
+ z.forEach((K) => {
726
+ H[K.path] = K.message;
727
+ }), x(H);
728
+ return;
729
+ }
730
+ x({}), o(et(h, v));
731
+ }, e[11] = o, e[12] = h, e[13] = v, e[14] = P) : P = e[14];
732
+ const F = P;
733
+ let Z;
734
+ e[15] !== y ? (Z = /* @__PURE__ */ n(B, { variant: "h6", gutterBottom: !0, children: y }), e[15] = y, e[16] = Z) : Z = e[16];
735
+ let U;
736
+ e[17] !== p ? (U = p && /* @__PURE__ */ n(dr, { text: p }), e[17] = p, e[18] = U) : U = e[18];
737
+ let M;
738
+ e[19] !== Z || e[20] !== U ? (M = /* @__PURE__ */ b(ve, { children: [
739
+ Z,
740
+ U
741
+ ] }), e[19] = Z, e[20] = U, e[21] = M) : M = e[21];
742
+ let Q;
743
+ e[22] !== u || e[23] !== D || e[24] !== h || e[25] !== v ? (Q = /* @__PURE__ */ n(cr, { schema: h, values: v, onChange: k, onAddArrayItem: L, onDeleteArrayItem: R, errors: D, disabled: u }), e[22] = u, e[23] = D, e[24] = h, e[25] = v, e[26] = Q) : Q = e[26];
744
+ let _;
745
+ e[27] !== u || e[28] !== a ? (_ = /* @__PURE__ */ n(J, { variant: "outlined", onClick: a, disabled: u, children: "Cancel" }), e[27] = u, e[28] = a, e[29] = _) : _ = e[29];
746
+ const V = u || !w;
747
+ let Y;
748
+ e[30] !== c ? (Y = c ? void 0 : /* @__PURE__ */ n(qe, { size: 16 }), e[30] = c, e[31] = Y) : Y = e[31];
749
+ const W = c ? "Save" : "Add";
750
+ let g;
751
+ e[32] !== F || e[33] !== V || e[34] !== Y || e[35] !== W ? (g = /* @__PURE__ */ n(J, { variant: "contained", color: "primary", onClick: F, disabled: V, startIcon: Y, children: W }), e[32] = F, e[33] = V, e[34] = Y, e[35] = W, e[36] = g) : g = e[36];
752
+ let E;
753
+ e[37] !== _ || e[38] !== g ? (E = /* @__PURE__ */ b(C, { direction: "row", justifyContent: "flex-end", spacing: 1, children: [
754
+ _,
755
+ g
756
+ ] }), e[37] = _, e[38] = g, e[39] = E) : E = e[39];
757
+ let re;
758
+ return e[40] !== M || e[41] !== Q || e[42] !== E ? (re = /* @__PURE__ */ b(C, { spacing: 2.5, children: [
759
+ M,
760
+ Q,
761
+ E
762
+ ] }), e[40] = M, e[41] = Q, e[42] = E, e[43] = re) : re = e[43], re;
763
+ };
764
+ function pr(t) {
765
+ return !t;
766
+ }
767
+ const mr = (t) => {
768
+ const e = ie(41), {
769
+ policy: r,
770
+ existingSettings: s,
771
+ getPolicyDefinitionVersion: i,
772
+ policyNoun: a,
773
+ onBack: o,
774
+ onSubmit: l
775
+ } = t, d = a === void 0 ? "policy" : a;
776
+ let c;
777
+ e[0] !== i || e[1] !== r ? (c = i?.(r) ?? r.version, e[0] = i, e[1] = r, e[2] = c) : c = e[2];
778
+ const {
779
+ data: u,
780
+ isLoading: f,
781
+ error: p
782
+ } = Mt(r.name, c), [h, y] = G(null), [m, v] = G(null);
783
+ let N, j;
784
+ if (e[3] !== u ? (N = () => {
785
+ if (u)
786
+ try {
787
+ y(Jt(u)), v(null);
788
+ } catch {
789
+ v("Failed to parse policy definition.");
790
+ }
791
+ }, j = [u], e[3] = u, e[4] = N, e[5] = j) : (N = e[4], j = e[5]), be(N, j), f) {
792
+ let $;
793
+ return e[6] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ b(C, { spacing: 2, sx: {
794
+ mt: 1
795
+ }, children: [
796
+ /* @__PURE__ */ n(B, { variant: "body2", color: "text.secondary", children: "Loading definition..." }),
797
+ /* @__PURE__ */ n(oe, { variant: "text", width: "60%", height: 28 }),
798
+ /* @__PURE__ */ n(oe, { variant: "text", width: "90%", height: 16 }),
799
+ /* @__PURE__ */ n(oe, { variant: "rounded", width: "100%", height: 48 }),
800
+ /* @__PURE__ */ n(oe, { variant: "rounded", width: "100%", height: 48 })
801
+ ] }), e[6] = $) : $ = e[6], $;
802
+ }
803
+ if (p || m) {
804
+ let $;
805
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? ($ = {
806
+ py: 2
807
+ }, e[7] = $) : $ = e[7];
808
+ const L = m || p?.message || `Failed to load ${d} definition.`;
809
+ let I;
810
+ e[8] !== L ? (I = /* @__PURE__ */ n(pt, { severity: "error", children: L }), e[8] = L, e[9] = I) : I = e[9];
811
+ let R;
812
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(Ge, { size: 16 }), e[10] = R) : R = e[10];
813
+ let P;
814
+ e[11] !== o ? (P = /* @__PURE__ */ n(J, { variant: "text", startIcon: R, onClick: o, children: "Back" }), e[11] = o, e[12] = P) : P = e[12];
815
+ let F;
816
+ return e[13] !== I || e[14] !== P ? (F = /* @__PURE__ */ b(C, { spacing: 2, sx: $, children: [
817
+ I,
818
+ P
819
+ ] }), e[13] = I, e[14] = P, e[15] = F) : F = e[15], F;
820
+ }
821
+ if (!h) {
822
+ let $;
823
+ e[16] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ n(Je, { size: 64 }), e[16] = $) : $ = e[16];
824
+ const L = `This ${d} does not have a configuration schema.`;
825
+ let I;
826
+ e[17] !== L ? (I = /* @__PURE__ */ n(ge.Container, { children: /* @__PURE__ */ n(ge.EmptyState, { illustration: $, title: "No definition available", description: L }) }), e[17] = L, e[18] = I) : I = e[18];
827
+ let R;
828
+ e[19] === Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(Ge, { size: 16 }), e[19] = R) : R = e[19];
829
+ let P;
830
+ e[20] !== o ? (P = /* @__PURE__ */ n(J, { variant: "text", startIcon: R, onClick: o, children: "Back" }), e[20] = o, e[21] = P) : P = e[21];
831
+ let F;
832
+ return e[22] !== I || e[23] !== P ? (F = /* @__PURE__ */ b(C, { spacing: 2, children: [
833
+ I,
834
+ P
835
+ ] }), e[22] = I, e[23] = P, e[24] = F) : F = e[24], F;
836
+ }
837
+ let D;
838
+ e[25] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ n(Ge, { size: 16 }), e[25] = D) : D = e[25];
839
+ let x;
840
+ e[26] !== o ? (x = /* @__PURE__ */ n(ve, { children: /* @__PURE__ */ n(J, { variant: "text", size: "small", startIcon: D, onClick: o, children: "Back" }) }), e[26] = o, e[27] = x) : x = e[27];
841
+ const w = r.displayName || r.name, A = !!s;
842
+ let S;
843
+ e[28] !== l || e[29] !== r ? (S = ($) => l(r, $), e[28] = l, e[29] = r, e[30] = S) : S = e[30];
844
+ let O;
845
+ e[31] !== s || e[32] !== o || e[33] !== h || e[34] !== w || e[35] !== A || e[36] !== S ? (O = /* @__PURE__ */ n(hr, { policyDefinition: h, policyDisplayName: w, existingValues: s, isEditMode: A, onCancel: o, onSubmit: S }), e[31] = s, e[32] = o, e[33] = h, e[34] = w, e[35] = A, e[36] = S, e[37] = O) : O = e[37];
846
+ let k;
847
+ return e[38] !== O || e[39] !== x ? (k = /* @__PURE__ */ b(C, { spacing: 2, children: [
848
+ x,
849
+ O
850
+ ] }), e[38] = O, e[39] = x, e[40] = k) : k = e[40], k;
851
+ };
852
+ function yr({
853
+ open: t,
854
+ onClose: e,
855
+ onSubmit: r,
856
+ catalogData: s,
857
+ isLoadingCatalog: i,
858
+ catalogError: a,
859
+ filterPolicies: o,
860
+ getPolicyDefinitionVersion: l,
861
+ disabledPolicyNames: d = [],
862
+ disabledPolicyKeys: c = [],
863
+ existingSettings: u,
864
+ editPolicyKey: f,
865
+ title: p = "Policies",
866
+ subtitle: h = "Choose a policy to configure advanced options.",
867
+ policyNoun: y = "policy",
868
+ loadingLabel: m = "Loading policies...",
869
+ searchPlaceholder: v = "Search policies...",
870
+ catalogErrorLabel: N = "Failed to load policies.",
871
+ emptySearchTitle: j = "No policies match your search",
872
+ emptySearchDescription: D = "Try a different keyword or clear the search filter.",
873
+ emptyCatalogTitle: x = "No policies available",
874
+ emptyCatalogDescription: w = "No policies are available in the catalog.",
875
+ minWidth: A = 600,
876
+ maxWidth: S = 800
877
+ }) {
878
+ const {
879
+ data: O,
880
+ isLoading: k,
881
+ error: $
882
+ } = qt(!s && i === void 0 && a === void 0 && !o), [L, I] = G(null), [R, P] = G(""), F = s ?? O, Z = i ?? k, U = a ?? $, M = ne(() => {
883
+ const g = F?.data ?? [];
884
+ return o ? o(g) : Vt(g, Bt?.guardrailCapabilities);
885
+ }, [F, o]), Q = Le((g, E) => c.length > 0 ? c.includes(`${g}@${E}`) : d.includes(g), [c, d]), _ = ne(() => {
886
+ const g = R.trim().toLowerCase();
887
+ return g ? M.filter((E) => (E.displayName || E.name).toLowerCase().includes(g) || E.name.toLowerCase().includes(g) || E.description?.toLowerCase().includes(g)) : M;
888
+ }, [M, R]), V = Le(() => {
889
+ I(null), P(""), e();
890
+ }, [e]), Y = Le((g, E) => {
891
+ r(g, E), I(null);
892
+ }, [r]);
893
+ be(() => {
894
+ t || (I(null), P(""));
895
+ }, [t]), be(() => {
896
+ if (t && f && M.length > 0) {
897
+ const g = M.find((E) => `${E.name}@${E.version}` === f);
898
+ g && I(g);
899
+ }
900
+ }, [t, f, M]);
901
+ const W = L ? L.displayName || L.name : p;
902
+ return /* @__PURE__ */ b(Ft, { open: t, onClose: V, minWidth: A, maxWidth: S, children: [
903
+ /* @__PURE__ */ n(Wt, { icon: /* @__PURE__ */ n(Je, { size: 24 }), title: W, onClose: V }),
904
+ /* @__PURE__ */ b(kt, { children: [
905
+ !L && /* @__PURE__ */ n(B, { variant: "body2", color: "text.secondary", sx: {
906
+ mb: 2
907
+ }, children: h }),
908
+ Z ? /* @__PURE__ */ b(C, { spacing: 1.5, sx: {
909
+ mt: 1
910
+ }, children: [
911
+ /* @__PURE__ */ n(B, { variant: "body2", color: "text.secondary", children: m }),
912
+ Array.from({
913
+ length: 5
914
+ }).map((g, E) => /* @__PURE__ */ n(ht, { variant: "outlined", children: /* @__PURE__ */ n(ve, { sx: {
915
+ p: 1.5
916
+ }, children: /* @__PURE__ */ b(C, { spacing: 0.75, children: [
917
+ /* @__PURE__ */ n(oe, { variant: "text", width: "45%", height: 20 }),
918
+ /* @__PURE__ */ n(oe, { variant: "text", width: "85%", height: 16 }),
919
+ /* @__PURE__ */ n(oe, { variant: "text", width: "65%", height: 16 })
920
+ ] }) }) }, E))
921
+ ] }) : U ? /* @__PURE__ */ b(pt, { severity: "error", sx: {
922
+ mt: 1
923
+ }, children: [
924
+ N,
925
+ " ",
926
+ U?.message
927
+ ] }) : L ? /* @__PURE__ */ n(mr, { policy: L, existingSettings: u, getPolicyDefinitionVersion: l, policyNoun: y, onBack: f ? V : () => I(null), onSubmit: Y }) : /* @__PURE__ */ b(C, { spacing: 2, children: [
928
+ /* @__PURE__ */ n(It, { placeholder: v, value: R, onChange: (g) => P(g.target.value), size: "small", fullWidth: !0 }),
929
+ /* @__PURE__ */ b(C, { spacing: 1.25, children: [
930
+ _.map((g) => {
931
+ const E = Q(g.name, g.version);
932
+ return /* @__PURE__ */ n(ee.CardButton, { selected: E, disabled: E, onClick: () => !E && I(g), sx: {
933
+ width: "100%",
934
+ justifyContent: "flex-start"
935
+ }, children: /* @__PURE__ */ n(zt, { children: /* @__PURE__ */ b(C, { spacing: 1, children: [
936
+ /* @__PURE__ */ b(C, { direction: "row", spacing: 0.5, alignItems: "center", children: [
937
+ /* @__PURE__ */ n(Tt, { sx: {
938
+ height: 32,
939
+ width: 32,
940
+ backgroundColor: E ? "primary.main" : "secondary.main",
941
+ color: E ? "common.white" : "text.secondary"
942
+ }, children: E ? /* @__PURE__ */ n(St, { size: 16 }) : /* @__PURE__ */ n(Ot, { size: 16 }) }),
943
+ /* @__PURE__ */ n(B, { variant: "body2", fontWeight: 500, children: g.displayName || g.name }),
944
+ /* @__PURE__ */ n(ut, { label: g.version, size: "small", variant: "outlined" })
945
+ ] }),
946
+ g.description && /* @__PURE__ */ n(Xe, { title: g.description, children: /* @__PURE__ */ b(B, { variant: "caption", color: "text.secondary", children: [
947
+ g.description.substring(0, 200),
948
+ g.description.length > 200 ? "..." : ""
949
+ ] }) })
950
+ ] }) }) }, `${g.name}@${g.version}`);
951
+ }),
952
+ _.length === 0 && R && /* @__PURE__ */ n(ge.Container, { children: /* @__PURE__ */ n(ge.EmptyState, { illustration: /* @__PURE__ */ n(Pt, { size: 64 }), title: j, description: D }) }),
953
+ _.length === 0 && !R && /* @__PURE__ */ n(ge.Container, { children: /* @__PURE__ */ n(ge.EmptyState, { illustration: /* @__PURE__ */ n(Je, { size: 64 }), title: x, description: w }) })
954
+ ] })
955
+ ] })
956
+ ] })
957
+ ] });
958
+ }
959
+ const Dr = (t) => {
960
+ const e = ie(73), {
961
+ policies: r,
962
+ onAdd: s,
963
+ onEdit: i,
964
+ onRemove: a,
965
+ onReorder: o,
966
+ catalogData: l,
967
+ isLoadingCatalog: d,
968
+ catalogError: c,
969
+ filterPolicies: u,
970
+ getPolicyDefinitionVersion: f,
971
+ title: p,
972
+ description: h,
973
+ addButtonLabel: y,
974
+ drawerAddTitle: m,
975
+ drawerEditTitle: v,
976
+ drawerAddSubtitle: N,
977
+ drawerEditSubtitle: j,
978
+ policyNoun: D,
979
+ loadingLabel: x,
980
+ searchPlaceholder: w,
981
+ catalogErrorLabel: A,
982
+ emptySearchTitle: S,
983
+ emptySearchDescription: O,
984
+ emptyCatalogTitle: k,
985
+ emptyCatalogDescription: $
986
+ } = t, L = p === void 0 ? "Policies" : p, I = h === void 0 ? "Add policies to enforce consistent protections." : h, R = y === void 0 ? "Add Policy" : y, P = m === void 0 ? "Add Policy" : m, F = v === void 0 ? "Edit Policy" : v, Z = N === void 0 ? "Choose a policy to configure advanced options." : N, U = j === void 0 ? "Update the policy configuration." : j, M = D === void 0 ? "policy" : D, [Q, _] = G(!1), [V, Y] = G(null), [W, g] = G(null), [E, re] = G(null), z = !!o;
987
+ let H;
988
+ e[0] !== s ? (H = (T, q) => {
989
+ s({
990
+ name: T.name,
991
+ version: T.version,
992
+ displayName: T.displayName,
993
+ settings: q
994
+ }), _(!1), Y(null);
995
+ }, e[0] = s, e[1] = H) : H = e[1];
996
+ const K = H;
997
+ let X;
998
+ e[2] !== i ? (X = (T, q) => {
999
+ i({
1000
+ name: T.name,
1001
+ version: T.version,
1002
+ displayName: T.displayName,
1003
+ settings: q
1004
+ }), _(!1), Y(null);
1005
+ }, e[2] = i, e[3] = X) : X = e[3];
1006
+ const st = X;
1007
+ let ae;
1008
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (ae = (T) => {
1009
+ Y(T), _(!0);
1010
+ }, e[4] = ae) : ae = e[4];
1011
+ const vt = ae;
1012
+ let Ne;
1013
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (Ne = () => {
1014
+ _(!1), Y(null);
1015
+ }, e[5] = Ne) : Ne = e[5];
1016
+ const xt = Ne;
1017
+ let je;
1018
+ e[6] !== z ? (je = (T) => (q) => {
1019
+ z && (g(T), q.dataTransfer.effectAllowed = "move", q.dataTransfer.setData("text/plain", String(T)));
1020
+ }, e[6] = z, e[7] = je) : je = e[7];
1021
+ const Ve = je;
1022
+ let De;
1023
+ e[8] !== E || e[9] !== W || e[10] !== z ? (De = (T) => (q) => {
1024
+ !z || W === null || (q.preventDefault(), q.dataTransfer.dropEffect = "move", E !== T && re(T));
1025
+ }, e[8] = E, e[9] = W, e[10] = z, e[11] = De) : De = e[11];
1026
+ const Be = De;
1027
+ let $e;
1028
+ e[12] !== W || e[13] !== o || e[14] !== r || e[15] !== z ? ($e = (T) => (q) => {
1029
+ if (q.preventDefault(), !(!z || W === null)) {
1030
+ if (W !== T) {
1031
+ const we = [...r], [Pe] = we.splice(W, 1);
1032
+ we.splice(T, 0, Pe), o?.(we);
1033
+ }
1034
+ g(null), re(null);
1035
+ }
1036
+ }, e[12] = W, e[13] = o, e[14] = r, e[15] = z, e[16] = $e) : $e = e[16];
1037
+ const Fe = $e;
1038
+ let Ie;
1039
+ e[17] === Symbol.for("react.memo_cache_sentinel") ? (Ie = () => {
1040
+ g(null), re(null);
1041
+ }, e[17] = Ie) : Ie = e[17];
1042
+ const wt = Ie;
1043
+ let ze;
1044
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (ze = {
1045
+ flex: 1,
1046
+ minWidth: 0
1047
+ }, e[18] = ze) : ze = e[18];
1048
+ let le;
1049
+ e[19] !== L ? (le = /* @__PURE__ */ n(ee.Subheader, { children: L }), e[19] = L, e[20] = le) : le = e[20];
1050
+ let ce;
1051
+ e[21] !== I ? (ce = /* @__PURE__ */ n(B, { variant: "body2", color: "text.secondary", children: I }), e[21] = I, e[22] = ce) : ce = e[22];
1052
+ let de;
1053
+ e[23] !== le || e[24] !== ce ? (de = /* @__PURE__ */ b(C, { spacing: 0.5, sx: ze, children: [
1054
+ le,
1055
+ ce
1056
+ ] }), e[23] = le, e[24] = ce, e[25] = de) : de = e[25];
1057
+ let Te, Se;
1058
+ e[26] === Symbol.for("react.memo_cache_sentinel") ? (Te = /* @__PURE__ */ n(qe, { size: 16 }), Se = () => _(!0), e[26] = Te, e[27] = Se) : (Te = e[26], Se = e[27]);
1059
+ let fe;
1060
+ e[28] !== R ? (fe = /* @__PURE__ */ n(J, { variant: "outlined", size: "small", startIcon: Te, onClick: Se, children: R }), e[28] = R, e[29] = fe) : fe = e[29];
1061
+ let ue;
1062
+ e[30] !== de || e[31] !== fe ? (ue = /* @__PURE__ */ b(C, { direction: "row", justifyContent: "space-between", alignItems: "flex-start", spacing: 2, children: [
1063
+ de,
1064
+ fe
1065
+ ] }), e[30] = de, e[31] = fe, e[32] = ue) : ue = e[32];
1066
+ let he;
1067
+ e[33] !== E || e[34] !== W || e[35] !== Be || e[36] !== Ve || e[37] !== Fe || e[38] !== a || e[39] !== r || e[40] !== z || e[41] !== L ? (he = r.length === 0 ? /* @__PURE__ */ n(ve, { sx: {
1068
+ mt: 2,
1069
+ border: "1px dashed",
1070
+ borderColor: "divider",
1071
+ borderRadius: 1
1072
+ }, children: /* @__PURE__ */ n(_t, { disableBackground: !0, icon: /* @__PURE__ */ n(Lt, { size: 48 }), message: `No ${L.toLowerCase()} added yet` }) }) : /* @__PURE__ */ n(C, { spacing: 1.25, mt: 2, children: r.map((T, q) => {
1073
+ const we = `${T.name}@${T.version}`, Pe = T.displayName || T.name, Ct = W === q, At = E === q && W !== q;
1074
+ return /* @__PURE__ */ b(ht, { variant: "outlined", draggable: z, onDragStart: Ve(q), onDragOver: Be(q), onDrop: Fe(q), onDragEnd: wt, onClick: () => vt(T), sx: {
1075
+ display: "flex",
1076
+ alignItems: "center",
1077
+ gap: 1,
1078
+ px: 1.5,
1079
+ py: 1.25,
1080
+ cursor: "pointer",
1081
+ opacity: Ct ? 0.5 : 1,
1082
+ borderColor: At ? "primary.main" : void 0,
1083
+ transition: "border-color 120ms ease, opacity 120ms ease",
1084
+ "&:hover": {
1085
+ bgcolor: "action.hover"
1086
+ }
1087
+ }, children: [
1088
+ z && /* @__PURE__ */ n(Xe, { title: "Drag to reorder", placement: "top", arrow: !0, children: /* @__PURE__ */ n(ve, { "aria-label": `Position ${q + 1}. Drag to reorder.`, onClick: gr, sx: {
1089
+ flexShrink: 0,
1090
+ width: 24,
1091
+ height: 24,
1092
+ borderRadius: 1,
1093
+ display: "flex",
1094
+ alignItems: "center",
1095
+ justifyContent: "center",
1096
+ bgcolor: "action.selected",
1097
+ color: "text.secondary",
1098
+ cursor: "grab",
1099
+ "&:active": {
1100
+ cursor: "grabbing"
1101
+ }
1102
+ }, children: /* @__PURE__ */ n(B, { variant: "caption", fontWeight: 700, sx: {
1103
+ fontVariantNumeric: "tabular-nums"
1104
+ }, children: q + 1 }) }) }),
1105
+ /* @__PURE__ */ n(B, { variant: "body2", fontWeight: 600, sx: {
1106
+ flex: 1,
1107
+ minWidth: 0,
1108
+ overflow: "hidden",
1109
+ textOverflow: "ellipsis",
1110
+ whiteSpace: "nowrap"
1111
+ }, children: Pe }),
1112
+ /* @__PURE__ */ n(Xe, { title: "Remove", placement: "top", arrow: !0, children: /* @__PURE__ */ n(rt, { size: "small", color: "error", "aria-label": `Remove ${Pe}`, onClick: (Et) => {
1113
+ Et.stopPropagation(), a(T.name, T.version);
1114
+ }, children: /* @__PURE__ */ n(Rt, { size: 14 }) }) })
1115
+ ] }, we);
1116
+ }) }), e[33] = E, e[34] = W, e[35] = Be, e[36] = Ve, e[37] = Fe, e[38] = a, e[39] = r, e[40] = z, e[41] = L, e[42] = he) : he = e[42];
1117
+ let pe;
1118
+ e[43] !== ue || e[44] !== he ? (pe = /* @__PURE__ */ b(ee.Section, { children: [
1119
+ ue,
1120
+ he
1121
+ ] }), e[43] = ue, e[44] = he, e[45] = pe) : pe = e[45];
1122
+ const We = V ? st : K;
1123
+ let me;
1124
+ e[46] !== V || e[47] !== r ? (me = V ? [] : r.map(br), e[46] = V, e[47] = r, e[48] = me) : me = e[48];
1125
+ const ke = V ? V.settings : void 0, Me = V ? `${V.name}@${V.version}` : void 0, _e = V ? F : P, Ke = V ? U : Z;
1126
+ let ye;
1127
+ e[49] !== l || e[50] !== c || e[51] !== A || e[52] !== Q || e[53] !== $ || e[54] !== k || e[55] !== O || e[56] !== S || e[57] !== u || e[58] !== f || e[59] !== d || e[60] !== x || e[61] !== M || e[62] !== w || e[63] !== We || e[64] !== me || e[65] !== ke || e[66] !== Me || e[67] !== _e || e[68] !== Ke ? (ye = /* @__PURE__ */ n(yr, { open: Q, onClose: xt, onSubmit: We, catalogData: l, isLoadingCatalog: d, catalogError: c, filterPolicies: u, getPolicyDefinitionVersion: f, disabledPolicyKeys: me, existingSettings: ke, editPolicyKey: Me, title: _e, subtitle: Ke, policyNoun: M, loadingLabel: x, searchPlaceholder: w, catalogErrorLabel: A, emptySearchTitle: S, emptySearchDescription: O, emptyCatalogTitle: k, emptyCatalogDescription: $, minWidth: 800, maxWidth: 800 }), e[49] = l, e[50] = c, e[51] = A, e[52] = Q, e[53] = $, e[54] = k, e[55] = O, e[56] = S, e[57] = u, e[58] = f, e[59] = d, e[60] = x, e[61] = M, e[62] = w, e[63] = We, e[64] = me, e[65] = ke, e[66] = Me, e[67] = _e, e[68] = Ke, e[69] = ye) : ye = e[69];
1128
+ let Oe;
1129
+ return e[70] !== pe || e[71] !== ye ? (Oe = /* @__PURE__ */ b(Re, { children: [
1130
+ pe,
1131
+ ye
1132
+ ] }), e[70] = pe, e[71] = ye, e[72] = Oe) : Oe = e[72], Oe;
1133
+ };
1134
+ function gr(t) {
1135
+ return t.stopPropagation();
1136
+ }
1137
+ function br(t) {
1138
+ return `${t.name}@${t.version}`;
1139
+ }
1140
+ export {
1141
+ Dr as P,
1142
+ yr as a
1143
+ };