@cobaltcore-dev/aurora 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +141 -0
  3. package/dist/client/AuroraApp.d.ts +7 -0
  4. package/dist/client/AuthProvider-D-5Jpa6F.mjs +100 -0
  5. package/dist/client/AuthProvider-D-5Jpa6F.mjs.map +1 -0
  6. package/dist/client/ContentHeader-H8KGY3Wd.mjs +81 -0
  7. package/dist/client/ContentHeader-H8KGY3Wd.mjs.map +1 -0
  8. package/dist/client/DeleteFlavorModal-B98oiHWx.mjs +629 -0
  9. package/dist/client/DeleteFlavorModal-B98oiHWx.mjs.map +1 -0
  10. package/dist/client/EditSecurityGroupModal-wQVNIVg1.mjs +137 -0
  11. package/dist/client/EditSecurityGroupModal-wQVNIVg1.mjs.map +1 -0
  12. package/dist/client/FloatingIpActionModals-qu1NMI5a.mjs +417 -0
  13. package/dist/client/FloatingIpActionModals-qu1NMI5a.mjs.map +1 -0
  14. package/dist/client/ImageToastNotifications-wsQDNEh7.mjs +1267 -0
  15. package/dist/client/ImageToastNotifications-wsQDNEh7.mjs.map +1 -0
  16. package/dist/client/ListToolbar-CHlkZrpl.mjs +223 -0
  17. package/dist/client/ListToolbar-CHlkZrpl.mjs.map +1 -0
  18. package/dist/client/RouteError-BwgDIwJE.mjs +25 -0
  19. package/dist/client/RouteError-BwgDIwJE.mjs.map +1 -0
  20. package/dist/client/_auth-CsliQdkJ.mjs +11 -0
  21. package/dist/client/_auth-CsliQdkJ.mjs.map +1 -0
  22. package/dist/client/_flavorId-D_A53VYa.mjs +56 -0
  23. package/dist/client/_flavorId-D_A53VYa.mjs.map +1 -0
  24. package/dist/client/_flavorId-DbhYLFxY.mjs +190 -0
  25. package/dist/client/_flavorId-DbhYLFxY.mjs.map +1 -0
  26. package/dist/client/_floatingIpId-BGgftRBQ.mjs +21 -0
  27. package/dist/client/_floatingIpId-BGgftRBQ.mjs.map +1 -0
  28. package/dist/client/_floatingIpId-D5myuLFz.mjs +228 -0
  29. package/dist/client/_floatingIpId-D5myuLFz.mjs.map +1 -0
  30. package/dist/client/_imageId-BoHX155h.mjs +27 -0
  31. package/dist/client/_imageId-BoHX155h.mjs.map +1 -0
  32. package/dist/client/_imageId-CTa0c3Av.mjs +530 -0
  33. package/dist/client/_imageId-CTa0c3Av.mjs.map +1 -0
  34. package/dist/client/_pcaId-C7Lrv1H_.mjs +242 -0
  35. package/dist/client/_pcaId-C7Lrv1H_.mjs.map +1 -0
  36. package/dist/client/_pcaId-DBgz5V_9.mjs +21 -0
  37. package/dist/client/_pcaId-DBgz5V_9.mjs.map +1 -0
  38. package/dist/client/_projectId-B9fln31N.mjs +8 -0
  39. package/dist/client/_projectId-B9fln31N.mjs.map +1 -0
  40. package/dist/client/_projectId-Be1Erj68.mjs +300 -0
  41. package/dist/client/_projectId-Be1Erj68.mjs.map +1 -0
  42. package/dist/client/_projectId-C-E4NNgo.mjs +84 -0
  43. package/dist/client/_projectId-C-E4NNgo.mjs.map +1 -0
  44. package/dist/client/_projectId-INhedXor.mjs +26 -0
  45. package/dist/client/_projectId-INhedXor.mjs.map +1 -0
  46. package/dist/client/_securityGroupId-DQoRQ-yA.mjs +1647 -0
  47. package/dist/client/_securityGroupId-DQoRQ-yA.mjs.map +1 -0
  48. package/dist/client/_securityGroupId-ihjy8Lcd.mjs +21 -0
  49. package/dist/client/_securityGroupId-ihjy8Lcd.mjs.map +1 -0
  50. package/dist/client/about-oT6ccz8T.mjs +92 -0
  51. package/dist/client/about-oT6ccz8T.mjs.map +1 -0
  52. package/dist/client/aurora-D_NPTbo-.mjs +19 -0
  53. package/dist/client/aurora-D_NPTbo-.mjs.map +1 -0
  54. package/dist/client/build-eu9eg0zF.mjs +14619 -0
  55. package/dist/client/build-eu9eg0zF.mjs.map +1 -0
  56. package/dist/client/buildFilterParams-BDOIRDeD.mjs +15 -0
  57. package/dist/client/buildFilterParams-BDOIRDeD.mjs.map +1 -0
  58. package/dist/client/cn-C3laVXMm.mjs +10 -0
  59. package/dist/client/cn-C3laVXMm.mjs.map +1 -0
  60. package/dist/client/constants-ByHCdNsI.mjs +128 -0
  61. package/dist/client/constants-ByHCdNsI.mjs.map +1 -0
  62. package/dist/client/containers-B_ozmVlx.mjs +74 -0
  63. package/dist/client/containers-B_ozmVlx.mjs.map +1 -0
  64. package/dist/client/containers-Dx7TYruP.mjs +7 -0
  65. package/dist/client/containers-Dx7TYruP.mjs.map +1 -0
  66. package/dist/client/containers-rn_ntCJu.mjs +3029 -0
  67. package/dist/client/containers-rn_ntCJu.mjs.map +1 -0
  68. package/dist/client/flavors-CT4auvLO.mjs +565 -0
  69. package/dist/client/flavors-CT4auvLO.mjs.map +1 -0
  70. package/dist/client/flavors-DRZb9LJP.mjs +8 -0
  71. package/dist/client/flavors-DRZb9LJP.mjs.map +1 -0
  72. package/dist/client/flavors-DtgMd0Ii.mjs +12 -0
  73. package/dist/client/flavors-DtgMd0Ii.mjs.map +1 -0
  74. package/dist/client/floatingips-DG5cFJSZ.mjs +12 -0
  75. package/dist/client/floatingips-DG5cFJSZ.mjs.map +1 -0
  76. package/dist/client/floatingips-iCMR0ZiL.mjs +436 -0
  77. package/dist/client/floatingips-iCMR0ZiL.mjs.map +1 -0
  78. package/dist/client/formatBytes-GYujK0dP.mjs +38 -0
  79. package/dist/client/formatBytes-GYujK0dP.mjs.map +1 -0
  80. package/dist/client/helpers--JWXi40U.mjs +6 -0
  81. package/dist/client/helpers--JWXi40U.mjs.map +1 -0
  82. package/dist/client/hooks-s-I8vWww.mjs +2 -0
  83. package/dist/client/images-BTqRflJv2.mjs +1794 -0
  84. package/dist/client/images-BTqRflJv2.mjs.map +1 -0
  85. package/dist/client/images-DRTfx8k2.mjs +8 -0
  86. package/dist/client/images-DRTfx8k2.mjs.map +1 -0
  87. package/dist/client/images-xBfsjxkX.mjs +12 -0
  88. package/dist/client/images-xBfsjxkX.mjs.map +1 -0
  89. package/dist/client/index.d.ts +1 -0
  90. package/dist/client/index.js +1033 -0
  91. package/dist/client/index.js.map +1 -0
  92. package/dist/client/md-CI9FmfYv.mjs +390 -0
  93. package/dist/client/md-CI9FmfYv.mjs.map +1 -0
  94. package/dist/client/network-DFVVVNS5.mjs +8 -0
  95. package/dist/client/network-DFVVVNS5.mjs.map +1 -0
  96. package/dist/client/objects-CKk6cST_.mjs +4762 -0
  97. package/dist/client/objects-CKk6cST_.mjs.map +1 -0
  98. package/dist/client/objects-DkDKVSmQ.mjs +8 -0
  99. package/dist/client/objects-DkDKVSmQ.mjs.map +1 -0
  100. package/dist/client/objects-r_Vl31oj.mjs +80 -0
  101. package/dist/client/objects-r_Vl31oj.mjs.map +1 -0
  102. package/dist/client/overview-B7pXx6bt.mjs +173 -0
  103. package/dist/client/overview-B7pXx6bt.mjs.map +1 -0
  104. package/dist/client/overview-CKGLIu6W.mjs +12 -0
  105. package/dist/client/overview-CKGLIu6W.mjs.map +1 -0
  106. package/dist/client/overview-Ca8r3SAz.mjs +16 -0
  107. package/dist/client/overview-Ca8r3SAz.mjs.map +1 -0
  108. package/dist/client/overview-DkPM0Od5.mjs +12 -0
  109. package/dist/client/overview-DkPM0Od5.mjs.map +1 -0
  110. package/dist/client/overview-Dxm7Ef3X.mjs +12 -0
  111. package/dist/client/overview-Dxm7Ef3X.mjs.map +1 -0
  112. package/dist/client/overview-ag4Envez.mjs +16 -0
  113. package/dist/client/overview-ag4Envez.mjs.map +1 -0
  114. package/dist/client/pca-BGv7Mprl.mjs +12 -0
  115. package/dist/client/pca-BGv7Mprl.mjs.map +1 -0
  116. package/dist/client/pca-DpULpMu5.mjs +167 -0
  117. package/dist/client/pca-DpULpMu5.mjs.map +1 -0
  118. package/dist/client/projects-BuN69cxO.mjs +144 -0
  119. package/dist/client/projects-BuN69cxO.mjs.map +1 -0
  120. package/dist/client/projects-D1pP0XdA.mjs +12 -0
  121. package/dist/client/projects-D1pP0XdA.mjs.map +1 -0
  122. package/dist/client/projects-MbS1USl2.mjs +7 -0
  123. package/dist/client/projects-MbS1USl2.mjs.map +1 -0
  124. package/dist/client/projects-_Dfn6eQT.mjs +22 -0
  125. package/dist/client/projects-_Dfn6eQT.mjs.map +1 -0
  126. package/dist/client/securitygroups-DURjFfYK.mjs +12 -0
  127. package/dist/client/securitygroups-DURjFfYK.mjs.map +1 -0
  128. package/dist/client/securitygroups-KC2qvmH8.mjs +442 -0
  129. package/dist/client/securitygroups-KC2qvmH8.mjs.map +1 -0
  130. package/dist/client/trpcClient-BxguzNYF.mjs +57 -0
  131. package/dist/client/trpcClient-BxguzNYF.mjs.map +1 -0
  132. package/dist/client/useErrorTranslation-TZVwIAzq.mjs +83 -0
  133. package/dist/client/useErrorTranslation-TZVwIAzq.mjs.map +1 -0
  134. package/dist/client/useListWithFiltering-mMX_EfyI.mjs +32 -0
  135. package/dist/client/useListWithFiltering-mMX_EfyI.mjs.map +1 -0
  136. package/dist/client/useModal-Dg4CBeqL.mjs +12 -0
  137. package/dist/client/useModal-Dg4CBeqL.mjs.map +1 -0
  138. package/dist/client/useProjectId-BWaeJZOy.mjs +11 -0
  139. package/dist/client/useProjectId-BWaeJZOy.mjs.map +1 -0
  140. package/dist/server/index.d.ts +35 -0
  141. package/dist/server/index.js +36514 -0
  142. package/package.json +129 -0
@@ -0,0 +1,1647 @@
1
+ import { $ as e, D as t, H as n, I as r, K as i, N as a, S as o, W as s, Y as c, Z as l, a as u, b as d, g as f, i as p, it as m, j as h, k as g, n as _, nt as v, o as y, q as b, rt as x, s as S, v as C, w, x as T, z as E } from "./build-eu9eg0zF.mjs";
2
+ import { r as D } from "./trpcClient-BxguzNYF.mjs";
3
+ import { t as O } from "./_securityGroupId-ihjy8Lcd.mjs";
4
+ import { t as k } from "./useModal-Dg4CBeqL.mjs";
5
+ import { t as A } from "./ListToolbar-CHlkZrpl.mjs";
6
+ import { t as j } from "./useProjectId-BWaeJZOy.mjs";
7
+ import "./hooks-s-I8vWww.mjs";
8
+ import { t as M } from "./useListWithFiltering-mMX_EfyI.mjs";
9
+ import { t as N } from "./EditSecurityGroupModal-wQVNIVg1.mjs";
10
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
11
+ import { useEffect as L, useMemo as R, useState as z } from "react";
12
+ import { useNavigate as B } from "@tanstack/react-router";
13
+ import { Trans as V, useLingui as H } from "@lingui/react";
14
+ import { z as U } from "zod";
15
+ import { useForm as W, useStore as G } from "@tanstack/react-form";
16
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupHeader.tsx
17
+ function K({ name: e, id: t }) {
18
+ return /* @__PURE__ */ I("div", {
19
+ className: "mb-2",
20
+ children: [/* @__PURE__ */ F(w, { children: `'${e || t}' Details` }), /* @__PURE__ */ F("p", {
21
+ className: "text-theme-secondary mt-2 text-sm",
22
+ children: /* @__PURE__ */ F(V, { id: "kIuDMT" })
23
+ })]
24
+ });
25
+ }
26
+ //#endregion
27
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupBasicInfo.tsx
28
+ function q({ securityGroup: e, onEdit: t, isReadOnly: n = !1 }) {
29
+ let { i18n: i, _: o } = H(), s = ({ value: e }) => /* @__PURE__ */ F("span", { children: e ? i._({ id: "l75CjT" }) : i._({ id: "1UzENP" }) });
30
+ return /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("div", {
31
+ className: "mb-4 flex flex-row-reverse",
32
+ children: t && !n && /* @__PURE__ */ F(f, {
33
+ variant: "primary",
34
+ onClick: t,
35
+ disabled: n,
36
+ children: /* @__PURE__ */ F(V, { id: "ePK91l" })
37
+ })
38
+ }), /* @__PURE__ */ I(g, {
39
+ columns: 4,
40
+ gridColumnTemplate: "15% 35% 15% 35%",
41
+ children: [
42
+ /* @__PURE__ */ I(r, { children: [/* @__PURE__ */ F(m, { children: i._({ id: "Nu4oKW" }) }), /* @__PURE__ */ F(a, {
43
+ colSpan: 3,
44
+ children: /* @__PURE__ */ F("div", {
45
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
46
+ title: e.description || void 0,
47
+ children: e.description || i._({ id: "h47p9L" })
48
+ })
49
+ })] }),
50
+ /* @__PURE__ */ I(r, { children: [
51
+ /* @__PURE__ */ F(m, { children: i._({ id: "S0kLOH" }) }),
52
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F("div", {
53
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
54
+ title: e.id,
55
+ children: e.id
56
+ }) }),
57
+ /* @__PURE__ */ F(m, { children: i._({ id: "OYHzN1" }) }),
58
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F("div", {
59
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
60
+ title: e.tags?.join(", ") || void 0,
61
+ children: e.tags?.join(", ") || i._({ id: "h47p9L" })
62
+ }) })
63
+ ] }),
64
+ /* @__PURE__ */ I(r, { children: [
65
+ /* @__PURE__ */ F(m, { children: i._({ id: "6YtxFj" }) }),
66
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F("div", {
67
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
68
+ title: e.name || void 0,
69
+ children: e.name
70
+ }) }),
71
+ /* @__PURE__ */ F(m, { children: i._({ id: "Jim5X9" }) }),
72
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F(s, { value: e.stateful }) })
73
+ ] }),
74
+ /* @__PURE__ */ I(r, { children: [
75
+ /* @__PURE__ */ F(m, { children: i._({ id: "aI8Tgp" }) }),
76
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F("div", {
77
+ className: "overflow-hidden text-ellipsis whitespace-nowrap",
78
+ title: e.project_id || void 0,
79
+ children: e.project_id || i._({ id: "h47p9L" })
80
+ }) }),
81
+ /* @__PURE__ */ F(m, { children: i._({ id: "0Gd0NU" }) }),
82
+ /* @__PURE__ */ F(a, { children: /* @__PURE__ */ F(s, { value: e.shared }) })
83
+ ] })
84
+ ]
85
+ })] });
86
+ }
87
+ //#endregion
88
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupTabs.tsx
89
+ function J({ activeTab: e, onTabChange: t, showRBACTab: n = !0 }) {
90
+ let r = (t) => `px-6 py-3 font-semibold border-b-2 transition-colors ${e === t ? "border-theme-accent text-theme-highest" : "border-transparent text-theme-secondary hover:text-theme-high"}`;
91
+ return /* @__PURE__ */ F("div", {
92
+ className: "border-theme-background-lvl-3 mt-1 border-b",
93
+ children: /* @__PURE__ */ I(b, {
94
+ direction: "horizontal",
95
+ gap: "0",
96
+ children: [/* @__PURE__ */ F("button", {
97
+ className: r("rules"),
98
+ onClick: () => t("rules"),
99
+ children: /* @__PURE__ */ F(V, { id: "4EZrJN" })
100
+ }), n && /* @__PURE__ */ F("button", {
101
+ className: r("rbac"),
102
+ onClick: () => t("rbac"),
103
+ children: /* @__PURE__ */ F(V, { id: "/eFtWI" })
104
+ })]
105
+ })
106
+ });
107
+ }
108
+ //#endregion
109
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/DeleteRuleDialog.tsx
110
+ function Y({ rule: t, open: n, onClose: r, onConfirm: i, isLoading: a, error: o }) {
111
+ let { i18n: s, _: c } = H(), [l, p] = z(""), m = () => {
112
+ t && l === "delete" && i(t.id);
113
+ }, h = () => {
114
+ p(""), r();
115
+ }, g = l !== "delete" || a;
116
+ return t ? /* @__PURE__ */ F(S, {
117
+ open: n,
118
+ onCancel: h,
119
+ size: "small",
120
+ title: s._({ id: "TM93nK" }),
121
+ modalFooter: /* @__PURE__ */ F(u, {
122
+ className: "flex justify-end",
123
+ children: /* @__PURE__ */ I(C, { children: [/* @__PURE__ */ F(f, {
124
+ variant: "default",
125
+ onClick: h,
126
+ disabled: a,
127
+ children: /* @__PURE__ */ F(V, { id: "dEgA5A" })
128
+ }), /* @__PURE__ */ F(f, {
129
+ variant: "primary-danger",
130
+ onClick: m,
131
+ disabled: g,
132
+ "data-testid": "confirm-delete-rule-button",
133
+ children: a ? /* @__PURE__ */ F(V, { id: "EF2EU9" }) : /* @__PURE__ */ F(V, { id: "lN3xvy" })
134
+ })] })
135
+ }),
136
+ children: /* @__PURE__ */ I("div", { children: [
137
+ o && /* @__PURE__ */ F(d, {
138
+ dismissible: !1,
139
+ variant: "error",
140
+ className: "mt-4",
141
+ children: o
142
+ }),
143
+ /* @__PURE__ */ F(V, { id: "CMVP7y" }),
144
+ /* @__PURE__ */ I("div", {
145
+ className: "bg-theme-background-lvl-1 mt-4 mb-4 rounded p-4",
146
+ children: [/* @__PURE__ */ F("p", {
147
+ className: "mb-2 font-semibold",
148
+ children: /* @__PURE__ */ F(V, { id: "uly9ET" })
149
+ }), /* @__PURE__ */ I("ul", {
150
+ className: "list-inside list-disc space-y-1 text-sm",
151
+ children: [
152
+ /* @__PURE__ */ I("li", { children: [
153
+ /* @__PURE__ */ F(V, { id: "MRB7nI" }),
154
+ ": ",
155
+ t.direction
156
+ ] }),
157
+ t.description && /* @__PURE__ */ I("li", { children: [
158
+ /* @__PURE__ */ F(V, { id: "Nu4oKW" }),
159
+ ": ",
160
+ t.description
161
+ ] }),
162
+ /* @__PURE__ */ I("li", { children: [
163
+ /* @__PURE__ */ F(V, { id: "yp0UjB" }),
164
+ ": ",
165
+ t.ethertype
166
+ ] }),
167
+ t.protocol && /* @__PURE__ */ I("li", { children: [
168
+ /* @__PURE__ */ F(V, { id: "6+OdGi" }),
169
+ ": ",
170
+ t.protocol
171
+ ] }),
172
+ t.port_range_min !== null && t.port_range_max !== null && /* @__PURE__ */ I("li", { children: [
173
+ /* @__PURE__ */ F(V, { id: "tV/Ozb" }),
174
+ ":",
175
+ " ",
176
+ t.port_range_min === t.port_range_max ? t.port_range_min : `${t.port_range_min}-${t.port_range_max}`
177
+ ] }),
178
+ t.remote_ip_prefix && /* @__PURE__ */ I("li", { children: [
179
+ /* @__PURE__ */ F(V, { id: "WoSkGY" }),
180
+ ": ",
181
+ t.remote_ip_prefix
182
+ ] }),
183
+ t.remote_group_id && /* @__PURE__ */ I("li", { children: [
184
+ /* @__PURE__ */ F(V, { id: "i9TIyi" }),
185
+ ": ",
186
+ t.remote_group_id
187
+ ] })
188
+ ]
189
+ })]
190
+ }),
191
+ /* @__PURE__ */ I("div", {
192
+ className: "mt-4",
193
+ children: [/* @__PURE__ */ F("p", {
194
+ className: "mb-2 text-sm",
195
+ children: /* @__PURE__ */ F(V, {
196
+ id: "PHt+EV",
197
+ components: { 0: /* @__PURE__ */ F("strong", {}) }
198
+ })
199
+ }), /* @__PURE__ */ F(e, {
200
+ value: l,
201
+ onChange: (e) => p(e.target.value),
202
+ placeholder: s._({ id: "HNlEFZ" }),
203
+ autoComplete: "off",
204
+ disabled: a,
205
+ "data-testid": "delete-rule-confirmation-input"
206
+ })]
207
+ })
208
+ ] })
209
+ }) : null;
210
+ }
211
+ //#endregion
212
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/validation/validationHelpers.ts
213
+ function ee(e) {
214
+ return e.includes(".") ? "IPv4" : e.includes(":") ? "IPv6" : null;
215
+ }
216
+ function X(e, t, n) {
217
+ if (e != null && isNaN(e) || t != null && isNaN(t)) return {
218
+ valid: !1,
219
+ error: "Port must be a valid number"
220
+ };
221
+ if (n?.toLowerCase() === "tcp" || n?.toLowerCase() === "udp") {
222
+ if (e != null && (e < 1 || e > 65535) || t != null && (t < 1 || t > 65535)) return {
223
+ valid: !1,
224
+ error: "For TCP/UDP: port must be between 1 and 65535"
225
+ };
226
+ } else if (e != null && (e < 0 || e > 65535) || t != null && (t < 0 || t > 65535)) return {
227
+ valid: !1,
228
+ error: "Port must be between 0 and 65535"
229
+ };
230
+ return e != null && t != null && e > t ? {
231
+ valid: !1,
232
+ error: "port_range_min must be less than or equal to port_range_max"
233
+ } : { valid: !0 };
234
+ }
235
+ function te(e, t) {
236
+ return e != null && isNaN(e) ? {
237
+ valid: !1,
238
+ error: "ICMP type must be a valid number"
239
+ } : t != null && isNaN(t) ? {
240
+ valid: !1,
241
+ error: "ICMP code must be a valid number"
242
+ } : e != null && (e < 0 || e > 255) ? {
243
+ valid: !1,
244
+ error: "ICMP type must be between 0 and 255"
245
+ } : t != null && (t < 0 || t > 255) ? {
246
+ valid: !1,
247
+ error: "ICMP code must be between 0 and 255"
248
+ } : { valid: !0 };
249
+ }
250
+ function ne(e) {
251
+ let t = e.split("/");
252
+ if (t.length !== 2) return !1;
253
+ let [n, r] = t;
254
+ if (!/^\d+$/.test(r)) return !1;
255
+ let i = parseInt(r, 10);
256
+ if (isNaN(i) || i < 0) return !1;
257
+ if (n.includes(".")) {
258
+ let e = n.split(".");
259
+ if (e.length !== 4) return !1;
260
+ for (let t of e) {
261
+ let e = parseInt(t, 10);
262
+ if (isNaN(e) || e < 0 || e > 255 || t !== e.toString()) return !1;
263
+ }
264
+ return i <= 32;
265
+ }
266
+ if (n.includes(":")) {
267
+ if (n.includes(":::") || i > 128) return !1;
268
+ let e = n.includes("::"), t = n.split(":").filter((e) => e !== "");
269
+ if (e) {
270
+ if (t.length > 7) return !1;
271
+ } else if (t.length !== 8) return !1;
272
+ for (let e of t) if (e.length === 0 || e.length > 4 || !/^[0-9a-fA-F]+$/.test(e)) return !1;
273
+ return !((n.match(/::/g) || []).length > 1 || n.startsWith(":") && !n.startsWith("::") || n.endsWith(":") && !n.endsWith("::"));
274
+ }
275
+ return !1;
276
+ }
277
+ //#endregion
278
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/constants.ts
279
+ var Z = "0.0.0.0/0", re = "::/0", ie = "other-protocol", ae = U.object({
280
+ ruleType: U.string().min(1, "Rule type is required"),
281
+ direction: U.enum(["ingress", "egress"]),
282
+ ethertype: U.enum(["IPv4", "IPv6"]),
283
+ description: U.string(),
284
+ protocol: U.string().nullable(),
285
+ portFrom: U.string(),
286
+ portTo: U.string(),
287
+ icmpType: U.string(),
288
+ icmpCode: U.string(),
289
+ remoteSourceType: U.enum(["cidr", "security_group"]),
290
+ remoteCidr: U.string(),
291
+ remoteSecurityGroupId: U.string()
292
+ }).superRefine((e, t) => {
293
+ let n = e.protocol === "tcp" || e.protocol === "udp", r = e.protocol === "icmp" || e.protocol === "ipv6-icmp", i = e.ruleType === ie, a = n && ["custom-tcp", "custom-udp"].includes(e.ruleType);
294
+ if (i && !e.protocol && t.addIssue({
295
+ code: U.ZodIssueCode.custom,
296
+ message: "Protocol is required",
297
+ path: ["protocol"]
298
+ }), a) if (!e.portFrom) t.addIssue({
299
+ code: U.ZodIssueCode.custom,
300
+ message: "Port (from) is required",
301
+ path: ["portFrom"]
302
+ });
303
+ else {
304
+ let n = parseInt(e.portFrom, 10);
305
+ if (isNaN(n)) t.addIssue({
306
+ code: U.ZodIssueCode.custom,
307
+ message: "Port must be a valid number",
308
+ path: ["portFrom"]
309
+ });
310
+ else if (e.portTo) {
311
+ let r = parseInt(e.portTo, 10);
312
+ if (isNaN(r)) t.addIssue({
313
+ code: U.ZodIssueCode.custom,
314
+ message: "Port must be a valid number",
315
+ path: ["portTo"]
316
+ });
317
+ else if (n >= r) t.addIssue({
318
+ code: U.ZodIssueCode.custom,
319
+ message: "\"Port (from)\" must be less than \"Port (to)\"",
320
+ path: ["portFrom"]
321
+ });
322
+ else {
323
+ let i = X(n, r, e.protocol);
324
+ i.valid || t.addIssue({
325
+ code: U.ZodIssueCode.custom,
326
+ message: i.error || "Invalid port range",
327
+ path: ["portFrom"]
328
+ });
329
+ }
330
+ } else {
331
+ let r = X(n, n, e.protocol);
332
+ r.valid || t.addIssue({
333
+ code: U.ZodIssueCode.custom,
334
+ message: r.error || "Invalid port",
335
+ path: ["portFrom"]
336
+ });
337
+ }
338
+ }
339
+ if (r) {
340
+ let n = e.icmpType ? parseInt(e.icmpType, 10) : null, r = e.icmpCode ? parseInt(e.icmpCode, 10) : null;
341
+ if (e.icmpType && isNaN(n) && t.addIssue({
342
+ code: U.ZodIssueCode.custom,
343
+ message: "ICMP type must be a valid number",
344
+ path: ["icmpType"]
345
+ }), e.icmpCode && isNaN(r) && t.addIssue({
346
+ code: U.ZodIssueCode.custom,
347
+ message: "ICMP code must be a valid number",
348
+ path: ["icmpCode"]
349
+ }), e.icmpCode && !e.icmpType && t.addIssue({
350
+ code: U.ZodIssueCode.custom,
351
+ message: "ICMP type is required when ICMP code is specified",
352
+ path: ["icmpType"]
353
+ }), n !== null || r !== null) {
354
+ let e = te(n, r);
355
+ e.valid || (e.error?.includes("type") && t.addIssue({
356
+ code: U.ZodIssueCode.custom,
357
+ message: "ICMP type must be between 0 and 255",
358
+ path: ["icmpType"]
359
+ }), e.error?.includes("code") && t.addIssue({
360
+ code: U.ZodIssueCode.custom,
361
+ message: "ICMP code must be between 0 and 255",
362
+ path: ["icmpCode"]
363
+ }));
364
+ }
365
+ }
366
+ if (e.remoteSourceType === "cidr" && e.remoteCidr) if (!ne(e.remoteCidr)) t.addIssue({
367
+ code: U.ZodIssueCode.custom,
368
+ message: "Invalid CIDR format. Examples: 0.0.0.0/0 (IPv4) or ::/0 (IPv6)",
369
+ path: ["remoteCidr"]
370
+ });
371
+ else {
372
+ let n = ee(e.remoteCidr);
373
+ n && n !== e.ethertype && t.addIssue({
374
+ code: U.ZodIssueCode.custom,
375
+ message: `CIDR family (${n}) must match Ethertype (${e.ethertype})`,
376
+ path: ["remoteCidr"]
377
+ });
378
+ }
379
+ }), oe = {
380
+ ruleType: "",
381
+ direction: "ingress",
382
+ ethertype: "IPv4",
383
+ description: "",
384
+ protocol: null,
385
+ portFrom: "",
386
+ portTo: "",
387
+ icmpType: "",
388
+ icmpCode: "",
389
+ remoteSourceType: "cidr",
390
+ remoteCidr: Z,
391
+ remoteSecurityGroupId: ""
392
+ }, Q = [
393
+ {
394
+ value: "",
395
+ label: "",
396
+ protocol: null,
397
+ portRangeMin: null,
398
+ portRangeMax: null
399
+ },
400
+ {
401
+ value: "custom-tcp",
402
+ label: "Custom TCP Rule",
403
+ protocol: "tcp",
404
+ portRangeMin: null,
405
+ portRangeMax: null
406
+ },
407
+ {
408
+ value: "custom-udp",
409
+ label: "Custom UDP Rule",
410
+ protocol: "udp",
411
+ portRangeMin: null,
412
+ portRangeMax: null
413
+ },
414
+ {
415
+ value: "custom-icmp",
416
+ label: "Custom ICMP Rule",
417
+ protocol: "icmp",
418
+ portRangeMin: null,
419
+ portRangeMax: null
420
+ },
421
+ {
422
+ value: "all-tcp",
423
+ label: "All TCP",
424
+ protocol: "tcp",
425
+ portRangeMin: 1,
426
+ portRangeMax: 65535
427
+ },
428
+ {
429
+ value: "all-udp",
430
+ label: "All UDP",
431
+ protocol: "udp",
432
+ portRangeMin: 1,
433
+ portRangeMax: 65535
434
+ },
435
+ {
436
+ value: "all-icmp",
437
+ label: "All ICMP",
438
+ protocol: "icmp",
439
+ portRangeMin: null,
440
+ portRangeMax: null
441
+ },
442
+ {
443
+ value: "other-protocol",
444
+ label: "Other Protocol",
445
+ protocol: null,
446
+ portRangeMin: null,
447
+ portRangeMax: null
448
+ },
449
+ {
450
+ value: "dns",
451
+ label: "DNS",
452
+ protocol: "tcp",
453
+ portRangeMin: 53,
454
+ portRangeMax: 53
455
+ },
456
+ {
457
+ value: "http",
458
+ label: "HTTP",
459
+ protocol: "tcp",
460
+ portRangeMin: 80,
461
+ portRangeMax: 80
462
+ },
463
+ {
464
+ value: "https",
465
+ label: "HTTPS",
466
+ protocol: "tcp",
467
+ portRangeMin: 443,
468
+ portRangeMax: 443
469
+ },
470
+ {
471
+ value: "imap",
472
+ label: "IMAP",
473
+ protocol: "tcp",
474
+ portRangeMin: 143,
475
+ portRangeMax: 143
476
+ },
477
+ {
478
+ value: "imaps",
479
+ label: "IMAPS",
480
+ protocol: "tcp",
481
+ portRangeMin: 993,
482
+ portRangeMax: 993
483
+ },
484
+ {
485
+ value: "ldap",
486
+ label: "LDAP",
487
+ protocol: "tcp",
488
+ portRangeMin: 389,
489
+ portRangeMax: 389
490
+ },
491
+ {
492
+ value: "ms-sql",
493
+ label: "MS SQL",
494
+ protocol: "tcp",
495
+ portRangeMin: 1433,
496
+ portRangeMax: 1433
497
+ },
498
+ {
499
+ value: "mysql",
500
+ label: "MySQL",
501
+ protocol: "tcp",
502
+ portRangeMin: 3306,
503
+ portRangeMax: 3306
504
+ },
505
+ {
506
+ value: "pop3",
507
+ label: "POP3",
508
+ protocol: "tcp",
509
+ portRangeMin: 110,
510
+ portRangeMax: 110
511
+ },
512
+ {
513
+ value: "pop3s",
514
+ label: "POP3S",
515
+ protocol: "tcp",
516
+ portRangeMin: 995,
517
+ portRangeMax: 995
518
+ },
519
+ {
520
+ value: "rdp",
521
+ label: "RDP",
522
+ protocol: "tcp",
523
+ portRangeMin: 3389,
524
+ portRangeMax: 3389
525
+ },
526
+ {
527
+ value: "ssh",
528
+ label: "SSH",
529
+ protocol: "tcp",
530
+ portRangeMin: 22,
531
+ portRangeMax: 22
532
+ },
533
+ {
534
+ value: "smtp",
535
+ label: "SMTP",
536
+ protocol: "tcp",
537
+ portRangeMin: 25,
538
+ portRangeMax: 25
539
+ },
540
+ {
541
+ value: "smtps",
542
+ label: "SMTPS",
543
+ protocol: "tcp",
544
+ portRangeMin: 465,
545
+ portRangeMax: 465
546
+ }
547
+ ];
548
+ //#endregion
549
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/RuleTypeSection.tsx
550
+ function se({ form: e, disabled: t = !1 }) {
551
+ let { i18n: r, _: i } = H();
552
+ return /* @__PURE__ */ F(e.Field, {
553
+ name: "ruleType",
554
+ mode: "value",
555
+ children: (i) => /* @__PURE__ */ F(h, {
556
+ className: "mb-6",
557
+ children: /* @__PURE__ */ F(o, {
558
+ id: "ruleType",
559
+ label: r._({ id: "YuGQWb" }),
560
+ value: i.state.value,
561
+ onChange: (t) => {
562
+ let n = String(t || "");
563
+ if (i.handleChange(n), !n) {
564
+ e.setFieldValue("protocol", null), e.setFieldValue("portFrom", ""), e.setFieldValue("portTo", ""), e.setFieldValue("icmpType", ""), e.setFieldValue("icmpCode", "");
565
+ return;
566
+ }
567
+ let r = Q.find((e) => e.value === n);
568
+ r && (e.setFieldValue("protocol", r.protocol), (r.protocol === "tcp" || r.protocol === "udp") && r.portRangeMin !== null && r.portRangeMax !== null ? (e.setFieldValue("portFrom", String(r.portRangeMin)), e.setFieldValue("portTo", String(r.portRangeMax))) : (e.setFieldValue("portFrom", ""), e.setFieldValue("portTo", "")), r.protocol !== "icmp" && r.protocol !== "ipv6-icmp" && (e.setFieldValue("icmpType", ""), e.setFieldValue("icmpCode", "")));
569
+ },
570
+ disabled: t,
571
+ children: Q.map((e) => e.value === "" ? /* @__PURE__ */ F(n, {
572
+ value: e.value,
573
+ label: r._({ id: "eh/k36" })
574
+ }, e.value) : /* @__PURE__ */ F(n, {
575
+ value: e.value,
576
+ label: e.label
577
+ }, e.value))
578
+ })
579
+ })
580
+ });
581
+ }
582
+ //#endregion
583
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/DirectionEthertypeSection.tsx
584
+ function ce({ form: e, disabled: t = !1 }) {
585
+ let { i18n: n, _: r } = H();
586
+ return /* @__PURE__ */ F(e.Field, {
587
+ name: "direction",
588
+ children: (e) => /* @__PURE__ */ F(h, { children: /* @__PURE__ */ F(l, {
589
+ name: "direction",
590
+ label: n._({ id: "MRB7nI" }),
591
+ selected: e.state.value,
592
+ onChange: (t) => e.handleChange(String(t)),
593
+ required: !0,
594
+ disabled: t,
595
+ children: /* @__PURE__ */ I("div", {
596
+ className: "flex gap-4",
597
+ children: [/* @__PURE__ */ F(y, {
598
+ value: "ingress",
599
+ label: n._({ id: "fzfAAa" })
600
+ }), /* @__PURE__ */ F(y, {
601
+ value: "egress",
602
+ label: n._({ id: "nETBrc" })
603
+ })]
604
+ })
605
+ }) })
606
+ });
607
+ }
608
+ function le({ form: e, disabled: t = !1 }) {
609
+ let { i18n: n, _: r } = H();
610
+ return /* @__PURE__ */ F(e.Field, {
611
+ name: "ethertype",
612
+ children: (e) => /* @__PURE__ */ F(h, { children: /* @__PURE__ */ F(l, {
613
+ name: "ethertype",
614
+ label: n._({ id: "16085O" }),
615
+ selected: e.state.value,
616
+ onChange: (t) => e.handleChange(String(t)),
617
+ required: !0,
618
+ disabled: t,
619
+ children: /* @__PURE__ */ I("div", {
620
+ className: "flex gap-4",
621
+ children: [/* @__PURE__ */ F(y, {
622
+ value: "IPv4",
623
+ label: "IPv4"
624
+ }), /* @__PURE__ */ F(y, {
625
+ value: "IPv6",
626
+ label: "IPv6"
627
+ })]
628
+ })
629
+ }) })
630
+ });
631
+ }
632
+ //#endregion
633
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/ProtocolSection.tsx
634
+ function ue({ form: t, disabled: n = !1 }) {
635
+ let { i18n: r, _: i } = H();
636
+ return /* @__PURE__ */ F(t.Field, {
637
+ name: "protocol",
638
+ children: (t) => /* @__PURE__ */ F(h, {
639
+ className: "mb-6",
640
+ children: /* @__PURE__ */ F(e, {
641
+ id: "protocol",
642
+ name: "protocol",
643
+ label: r._({ id: "6+OdGi" }),
644
+ value: t.state.value || "",
645
+ onChange: (e) => t.handleChange(e.target.value || null),
646
+ errortext: t.state.meta.errors[0]?.message,
647
+ placeholder: r._({ id: "8wdCNd" }),
648
+ disabled: n
649
+ })
650
+ })
651
+ });
652
+ }
653
+ //#endregion
654
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/PortRangeSection.tsx
655
+ function de({ form: t, disabled: n = !1 }) {
656
+ let { i18n: r, _: i } = H(), a = G(t.store, (e) => e.values.portFrom), o = G(t.store, (e) => e.fieldMeta.portFrom?.errors[0]?.message), s = G(t.store, (e) => e.fieldMeta.portTo?.errors[0]?.message), c = n || !a || a.trim() === "";
657
+ return /* @__PURE__ */ I(h, {
658
+ className: "mb-6",
659
+ children: [
660
+ /* @__PURE__ */ I("div", {
661
+ className: "flex items-center gap-4",
662
+ children: [
663
+ /* @__PURE__ */ F(t.Field, {
664
+ name: "portFrom",
665
+ children: (i) => /* @__PURE__ */ F("div", {
666
+ className: "flex-1",
667
+ children: /* @__PURE__ */ F(e, {
668
+ id: "portFrom",
669
+ name: "portFrom",
670
+ label: r._({ id: "LMdsuJ" }),
671
+ value: i.state.value || "",
672
+ onChange: (e) => {
673
+ let n = e.target.value;
674
+ i.handleChange(n), (!n || n.trim() === "") && t.setFieldValue("portTo", ""), t.validateField("portTo", "change");
675
+ },
676
+ invalid: i.state.meta.errors.length > 0,
677
+ disabled: n,
678
+ required: !0
679
+ })
680
+ })
681
+ }),
682
+ /* @__PURE__ */ F("div", {
683
+ className: "text-theme-secondary flex items-center justify-center",
684
+ children: "—"
685
+ }),
686
+ /* @__PURE__ */ F(t.Field, {
687
+ name: "portTo",
688
+ children: (n) => /* @__PURE__ */ F("div", {
689
+ className: "flex-1",
690
+ children: /* @__PURE__ */ F(e, {
691
+ id: "portTo",
692
+ name: "portTo",
693
+ label: r._({ id: "a12lSo" }),
694
+ value: n.state.value || "",
695
+ onChange: (e) => {
696
+ n.handleChange(e.target.value), t.validateField("portFrom", "change");
697
+ },
698
+ invalid: n.state.meta.errors.length > 0,
699
+ placeholder: "",
700
+ disabled: c
701
+ })
702
+ })
703
+ })
704
+ ]
705
+ }),
706
+ (o || s) && /* @__PURE__ */ I("div", {
707
+ className: "text-theme-error mt-2 text-sm",
708
+ children: [o && /* @__PURE__ */ F("div", { children: o }), s && /* @__PURE__ */ F("div", { children: s })]
709
+ }),
710
+ /* @__PURE__ */ F("p", {
711
+ className: "mt-2 text-sm",
712
+ children: r._({ id: "QAUa4B" })
713
+ })
714
+ ]
715
+ });
716
+ }
717
+ //#endregion
718
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/IcmpSection.tsx
719
+ function fe({ form: t, disabled: n = !1 }) {
720
+ let { i18n: r, _: i } = H();
721
+ return /* @__PURE__ */ F(h, {
722
+ className: "mb-6",
723
+ children: /* @__PURE__ */ I("div", {
724
+ className: "flex w-full gap-4",
725
+ children: [/* @__PURE__ */ F(t.Field, {
726
+ name: "icmpType",
727
+ children: (t) => /* @__PURE__ */ F("div", {
728
+ className: "flex-1",
729
+ children: /* @__PURE__ */ F(e, {
730
+ id: "icmpType",
731
+ name: "icmpType",
732
+ label: r._({ id: "yPWFWy" }),
733
+ value: t.state.value,
734
+ onChange: (e) => t.handleChange(e.target.value),
735
+ errortext: t.state.meta.errors[0]?.message,
736
+ placeholder: r._({ id: "GPuCEo" }),
737
+ disabled: n
738
+ })
739
+ })
740
+ }), /* @__PURE__ */ F(t.Field, {
741
+ name: "icmpCode",
742
+ children: (t) => /* @__PURE__ */ F("div", {
743
+ className: "flex-1",
744
+ children: /* @__PURE__ */ F(e, {
745
+ id: "icmpCode",
746
+ name: "icmpCode",
747
+ label: r._({ id: "76RKuS" }),
748
+ value: t.state.value,
749
+ onChange: (e) => t.handleChange(e.target.value),
750
+ errortext: t.state.meta.errors[0]?.message,
751
+ placeholder: r._({ id: "UkVkoq" }),
752
+ disabled: n
753
+ })
754
+ })
755
+ })]
756
+ })
757
+ });
758
+ }
759
+ //#endregion
760
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/RemoteSourceSection.tsx
761
+ function pe({ form: t, disabled: r = !1, availableSecurityGroups: i }) {
762
+ let { i18n: a, _: s } = H();
763
+ return /* @__PURE__ */ I(P, { children: [
764
+ /* @__PURE__ */ F(t.Field, {
765
+ name: "remoteSourceType",
766
+ mode: "value",
767
+ children: (e) => /* @__PURE__ */ F(h, {
768
+ className: "mb-1",
769
+ children: /* @__PURE__ */ F(l, {
770
+ name: "remoteSourceType",
771
+ label: a._({ id: "I5kZVK" }),
772
+ selected: e.state.value,
773
+ onChange: (n) => {
774
+ let r = String(n);
775
+ e.handleChange(r), r !== "security_group" && t.setFieldValue("ethertype", "IPv4");
776
+ },
777
+ disabled: r,
778
+ children: /* @__PURE__ */ I("div", {
779
+ className: "flex gap-4",
780
+ children: [/* @__PURE__ */ F(y, {
781
+ value: "cidr",
782
+ label: a._({ id: "4uXhtt" })
783
+ }), /* @__PURE__ */ F(y, {
784
+ value: "security_group",
785
+ label: a._({ id: "bwhBhT" })
786
+ })]
787
+ })
788
+ })
789
+ })
790
+ }),
791
+ /* @__PURE__ */ F(t.Field, {
792
+ name: "remoteSourceType",
793
+ children: (n) => n.state.value === "cidr" ? /* @__PURE__ */ F(t.Field, {
794
+ name: "remoteCidr",
795
+ children: (n) => /* @__PURE__ */ F(t.Field, {
796
+ name: "ethertype",
797
+ children: (t) => /* @__PURE__ */ F(h, {
798
+ className: "mb-6",
799
+ children: /* @__PURE__ */ F(e, {
800
+ id: "remoteCidr",
801
+ name: "remoteCidr",
802
+ label: a._({ id: "vmYyLY" }),
803
+ value: n.state.value,
804
+ onChange: (e) => n.handleChange(e.target.value),
805
+ errortext: n.state.meta.errors[0]?.message,
806
+ placeholder: t.state.value === "IPv4" ? Z : re,
807
+ disabled: r
808
+ })
809
+ })
810
+ })
811
+ }) : null
812
+ }),
813
+ /* @__PURE__ */ F(t.Field, {
814
+ name: "remoteSourceType",
815
+ children: (e) => e.state.value === "security_group" ? /* @__PURE__ */ F(t.Field, {
816
+ name: "remoteSecurityGroupId",
817
+ children: (e) => /* @__PURE__ */ F(h, {
818
+ className: "mb-6",
819
+ children: /* @__PURE__ */ I(o, {
820
+ id: "remoteSecurityGroupId",
821
+ label: a._({ id: "i9TIyi" }),
822
+ value: e.state.value,
823
+ onChange: (t) => e.handleChange(String(t)),
824
+ errortext: e.state.meta.errors[0]?.message,
825
+ disabled: r,
826
+ children: [/* @__PURE__ */ F(n, {
827
+ value: "",
828
+ label: a._({ id: "ZvIpwi" })
829
+ }), i.map((e) => /* @__PURE__ */ F(n, {
830
+ value: e.id,
831
+ label: e.name || e.id
832
+ }, e.id))]
833
+ })
834
+ })
835
+ }) : null
836
+ })
837
+ ] });
838
+ }
839
+ //#endregion
840
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/sections/DescriptionSection.tsx
841
+ function me({ form: e, disabled: t = !1 }) {
842
+ let { i18n: n, _: r } = H();
843
+ return /* @__PURE__ */ F(e.Field, {
844
+ name: "description",
845
+ children: (e) => /* @__PURE__ */ F(h, {
846
+ className: "mb-0",
847
+ children: /* @__PURE__ */ F(T, {
848
+ id: "description",
849
+ name: "description",
850
+ label: n._({ id: "Nu4oKW" }),
851
+ value: e.state.value,
852
+ onChange: (t) => e.handleChange(t.target.value),
853
+ placeholder: n._({ id: "pbzA+s" }),
854
+ disabled: t,
855
+ rows: 2
856
+ })
857
+ })
858
+ });
859
+ }
860
+ //#endregion
861
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRuleModal/AddRuleModal.tsx
862
+ var he = ({ securityGroupId: e, open: n, onClose: r, onCreate: i, isLoading: a = !1, error: o = null, availableSecurityGroups: c = [] }) => {
863
+ let { i18n: l, _: m } = H(), h = W({
864
+ defaultValues: oe,
865
+ validators: { onSubmit: ae },
866
+ onSubmit: async ({ value: t }) => {
867
+ if (a) return;
868
+ let n = {
869
+ security_group_id: e,
870
+ direction: t.direction,
871
+ ethertype: t.ethertype,
872
+ description: t.description || void 0,
873
+ protocol: t.protocol || null,
874
+ remote_ip_prefix: void 0,
875
+ remote_group_id: void 0,
876
+ remote_address_group_id: void 0
877
+ };
878
+ if ((t.protocol === "tcp" || t.protocol === "udp") && t.portFrom) {
879
+ let e = parseInt(t.portFrom, 10);
880
+ n.port_range_min = e, t.portTo ? n.port_range_max = parseInt(t.portTo, 10) : n.port_range_max = e;
881
+ }
882
+ (t.protocol === "icmp" || t.protocol === "ipv6-icmp") && (t.icmpType && (n.port_range_min = parseInt(t.icmpType, 10)), t.icmpCode && (n.port_range_max = parseInt(t.icmpCode, 10))), t.remoteSourceType === "cidr" && t.remoteCidr ? n.remote_ip_prefix = t.remoteCidr : t.remoteSourceType === "security_group" && t.remoteSecurityGroupId && (n.remote_group_id = t.remoteSecurityGroupId), await i(n), g();
883
+ }
884
+ }), g = () => {
885
+ h.reset(), r();
886
+ };
887
+ return /* @__PURE__ */ I(S, {
888
+ open: n,
889
+ onCancel: g,
890
+ size: "large",
891
+ title: l._({ id: "b2BLBa" }),
892
+ modalFooter: /* @__PURE__ */ F(u, {
893
+ className: "flex justify-end",
894
+ children: /* @__PURE__ */ F(h.Subscribe, { children: (e) => {
895
+ let t = !!e.values.ruleType;
896
+ return /* @__PURE__ */ I(C, { children: [/* @__PURE__ */ F(f, {
897
+ variant: "default",
898
+ onClick: g,
899
+ disabled: a || e.isSubmitting,
900
+ children: /* @__PURE__ */ F(V, { id: "dEgA5A" })
901
+ }), /* @__PURE__ */ F(f, {
902
+ variant: "primary",
903
+ type: "button",
904
+ onClick: () => h.handleSubmit(),
905
+ disabled: a || e.isSubmitting || !t,
906
+ "data-testid": "add-rule-button",
907
+ children: e.isSubmitting || a ? /* @__PURE__ */ F(s, { size: "small" }) : /* @__PURE__ */ F(V, { id: "bmQLn5" })
908
+ })] });
909
+ } })
910
+ }),
911
+ children: [
912
+ o && /* @__PURE__ */ F(d, {
913
+ dismissible: !1,
914
+ variant: "error",
915
+ className: "mb-4",
916
+ children: o
917
+ }),
918
+ a && /* @__PURE__ */ I("div", {
919
+ className: "mb-4 flex items-center justify-center gap-2",
920
+ children: [/* @__PURE__ */ F(s, { variant: "primary" }), /* @__PURE__ */ F("span", {
921
+ className: "text-theme-secondary text-sm",
922
+ children: /* @__PURE__ */ F(V, { id: "gU7JFm" })
923
+ })]
924
+ }),
925
+ /* @__PURE__ */ F(t, {
926
+ className: "mb-6",
927
+ onSubmit: (e) => {
928
+ e.preventDefault(), h.handleSubmit();
929
+ },
930
+ children: /* @__PURE__ */ I(p, {
931
+ className: "mb-6",
932
+ children: [/* @__PURE__ */ F(se, {
933
+ form: h,
934
+ disabled: a
935
+ }), /* @__PURE__ */ F(h.Subscribe, { children: (e) => {
936
+ if (!e.values.ruleType) return null;
937
+ let t = (e.values.protocol === "tcp" || e.values.protocol === "udp") && ["custom-tcp", "custom-udp"].includes(e.values.ruleType), n = e.values.protocol === "icmp" || e.values.protocol === "ipv6-icmp";
938
+ return /* @__PURE__ */ I(P, { children: [
939
+ /* @__PURE__ */ F(ce, {
940
+ form: h,
941
+ disabled: a
942
+ }),
943
+ e.values.ruleType === "other-protocol" && /* @__PURE__ */ F(ue, {
944
+ form: h,
945
+ disabled: a
946
+ }),
947
+ t && /* @__PURE__ */ F(de, {
948
+ form: h,
949
+ disabled: a
950
+ }),
951
+ n && /* @__PURE__ */ F(fe, {
952
+ form: h,
953
+ disabled: a
954
+ }),
955
+ /* @__PURE__ */ F(pe, {
956
+ form: h,
957
+ disabled: a,
958
+ availableSecurityGroups: c
959
+ }),
960
+ e.values.remoteSourceType === "security_group" && /* @__PURE__ */ F(le, {
961
+ form: h,
962
+ disabled: a
963
+ }),
964
+ /* @__PURE__ */ F(me, {
965
+ form: h,
966
+ disabled: a
967
+ })
968
+ ] });
969
+ } })]
970
+ })
971
+ })
972
+ ]
973
+ });
974
+ };
975
+ //#endregion
976
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupRulesTable.tsx
977
+ function ge({ rules: e, totalRulesCount: t, onDeleteRule: n, isDeletingRule: o, deleteError: s, searchTerm: c = "", onSearchChange: l, sortSettings: u, onSortChange: d, filterSettings: p, onFilterChange: h, securityGroupId: v, onCreateRule: y, isCreatingRule: S = !1, createRuleError: C = null, availableSecurityGroups: w = [], readOnly: T = !1 }) {
978
+ let { i18n: E, _: D } = H(), [O, j] = z(null), [M, N] = k(), R = (e) => {
979
+ j(e);
980
+ }, B = (e) => {
981
+ n(e);
982
+ }, U = () => {
983
+ o || j(null);
984
+ };
985
+ L(() => {
986
+ !o && !s && j(null);
987
+ }, [o, s]);
988
+ let W = (e) => {
989
+ if (e.protocol === "icmp" || e.protocol === "ipv6-icmp") {
990
+ if (e.port_range_min !== null && e.port_range_max !== null) {
991
+ let t = e.port_range_min, n = e.port_range_max;
992
+ return E._({
993
+ id: "0p+s6m",
994
+ values: {
995
+ typeValue: t,
996
+ codeValue: n
997
+ }
998
+ });
999
+ }
1000
+ return E._({ id: "eKC+EC" });
1001
+ }
1002
+ return e.port_range_min === null || e.port_range_max === null ? E._({ id: "eKC+EC" }) : e.port_range_min === e.port_range_max ? String(e.port_range_min) : `${e.port_range_min}-${e.port_range_max}`;
1003
+ };
1004
+ return /* @__PURE__ */ I(P, { children: [
1005
+ /* @__PURE__ */ I(b, {
1006
+ direction: "vertical",
1007
+ gap: "4",
1008
+ children: [/* @__PURE__ */ F(A, {
1009
+ totalCount: t ?? e.length,
1010
+ filteredCount: e.length,
1011
+ itemName: E._({ id: "j9hkgJ" }),
1012
+ filterSettings: p,
1013
+ onFilter: h,
1014
+ sortSettings: u,
1015
+ onSort: d,
1016
+ searchTerm: c,
1017
+ onSearch: l,
1018
+ actions: !T && y && /* @__PURE__ */ F(f, {
1019
+ variant: "primary",
1020
+ icon: "addCircle",
1021
+ onClick: N,
1022
+ children: /* @__PURE__ */ F(V, { id: "O8tK4v" })
1023
+ })
1024
+ }), e.length === 0 ? /* @__PURE__ */ F(V, { id: "nnxwBn" }) : /* @__PURE__ */ I(g, {
1025
+ columns: T ? 5 : 6,
1026
+ className: "security-group-rules-table",
1027
+ children: [/* @__PURE__ */ I(r, { children: [
1028
+ /* @__PURE__ */ F(m, { children: E._({ id: "MRB7nI" }) }),
1029
+ /* @__PURE__ */ F(m, { children: E._({ id: "Nu4oKW" }) }),
1030
+ /* @__PURE__ */ F(m, { children: E._({ id: "yp0UjB" }) }),
1031
+ /* @__PURE__ */ F(m, { children: E._({ id: "6+OdGi" }) }),
1032
+ /* @__PURE__ */ F(m, { children: E._({ id: "6jAi8c" }) }),
1033
+ !T && /* @__PURE__ */ F(m, { children: E._({ id: "7L01XJ" }) })
1034
+ ] }), e.map((e) => /* @__PURE__ */ I(r, {
1035
+ "data-testid": `rule-row-${e.id}`,
1036
+ children: [
1037
+ /* @__PURE__ */ F(a, { children: e.direction || E._({ id: "h47p9L" }) }),
1038
+ /* @__PURE__ */ F(a, { children: e.description || E._({ id: "h47p9L" }) }),
1039
+ /* @__PURE__ */ F(a, { children: e.ethertype }),
1040
+ /* @__PURE__ */ F(a, { children: e.protocol || E._({ id: "eKC+EC" }) }),
1041
+ /* @__PURE__ */ F(a, { children: W(e) }),
1042
+ !T && /* @__PURE__ */ F(a, {
1043
+ onClick: (e) => e.stopPropagation(),
1044
+ className: "items-end justify-end pr-0",
1045
+ children: /* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(x, { children: /* @__PURE__ */ F(i, {
1046
+ label: E._({ id: "cnGeoo" }),
1047
+ onClick: () => R(e)
1048
+ }) }) })
1049
+ })
1050
+ ]
1051
+ }, e.id))]
1052
+ })]
1053
+ }),
1054
+ !T && /* @__PURE__ */ F(Y, {
1055
+ rule: O,
1056
+ open: !!O,
1057
+ onClose: U,
1058
+ onConfirm: B,
1059
+ isLoading: o,
1060
+ error: s
1061
+ }),
1062
+ !T && v && y && M && /* @__PURE__ */ F(he, {
1063
+ securityGroupId: v,
1064
+ open: M,
1065
+ onClose: N,
1066
+ onCreate: y,
1067
+ isLoading: S,
1068
+ error: C,
1069
+ availableSecurityGroups: w
1070
+ })
1071
+ ] });
1072
+ }
1073
+ //#endregion
1074
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/RBACPolicyRow.tsx
1075
+ function _e({ policy: e, onDelete: t }) {
1076
+ let { i18n: n, _: o } = H();
1077
+ return /* @__PURE__ */ I(r, { children: [
1078
+ /* @__PURE__ */ F(a, { children: e.target_tenant }),
1079
+ /* @__PURE__ */ F(a, { children: e.action }),
1080
+ /* @__PURE__ */ F(a, {
1081
+ onClick: (e) => e.stopPropagation(),
1082
+ className: "items-end justify-end pr-0",
1083
+ children: /* @__PURE__ */ F(_, { children: /* @__PURE__ */ F(x, { children: /* @__PURE__ */ F(i, {
1084
+ label: n._({ id: "t/YqKh" }),
1085
+ onClick: t
1086
+ }) }) })
1087
+ })
1088
+ ] });
1089
+ }
1090
+ //#endregion
1091
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/AddRBACPolicyModal.tsx
1092
+ var ve = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, ye = /^[0-9a-f]{32}$/i;
1093
+ function $(e) {
1094
+ return ve.test(e) || ye.test(e);
1095
+ }
1096
+ function be({ isOpen: n, onClose: r, securityGroupId: i }) {
1097
+ let { i18n: a, _: o } = H(), s = D.useUtils(), c = j(), [l, u] = z(!1), f = U.object({ targetTenant: U.string().min(1, a._({ id: "1RwosK" })).refine($, { message: a._({ id: "CunRry" }) }) }), m = D.network.rbacPolicy.create.useMutation({ onSuccess: () => {
1098
+ s.network.rbacPolicy.list.invalidate({
1099
+ project_id: c,
1100
+ securityGroupId: i
1101
+ }), s.network.securityGroup.getById.invalidate({
1102
+ project_id: c,
1103
+ securityGroupId: i
1104
+ }), g();
1105
+ } }), h = W({
1106
+ defaultValues: { targetTenant: "" },
1107
+ validators: { onSubmit: f },
1108
+ onSubmit: async ({ value: e }) => {
1109
+ m.isPending || m.mutate({
1110
+ project_id: c,
1111
+ securityGroupId: i,
1112
+ targetTenant: e.targetTenant.trim()
1113
+ });
1114
+ }
1115
+ }), g = () => {
1116
+ h.reset(), m.reset(), u(!1), r();
1117
+ }, _ = async () => {
1118
+ u(!0), await h.handleSubmit();
1119
+ };
1120
+ return /* @__PURE__ */ I(S, {
1121
+ open: n,
1122
+ onCancel: g,
1123
+ title: a._({ id: "vmRPFm" }),
1124
+ size: "large",
1125
+ onConfirm: _,
1126
+ cancelButtonLabel: a._({ id: "dEgA5A" }),
1127
+ confirmButtonLabel: a._({ id: "Z8lGw6" }),
1128
+ disableConfirmButton: m.isPending,
1129
+ children: [
1130
+ m.error && /* @__PURE__ */ F(d, {
1131
+ variant: "error",
1132
+ className: "mb-4",
1133
+ children: (() => {
1134
+ let e = m.error.message.toLowerCase();
1135
+ return e.includes("conflict") || e.includes("409") ? a._({ id: "rbuO5A" }) : e.includes("not found") || e.includes("404") ? a._({ id: "FwSyEp" }) : e.includes("forbidden") || e.includes("403") ? a._({ id: "kqJVBO" }) : m.error.message;
1136
+ })()
1137
+ }),
1138
+ /* @__PURE__ */ F("p", {
1139
+ className: "mb-4",
1140
+ children: /* @__PURE__ */ F(V, { id: "cjEOmc" })
1141
+ }),
1142
+ /* @__PURE__ */ F(t, {
1143
+ className: "mb-0",
1144
+ onSubmit: (e) => {
1145
+ e.preventDefault(), _();
1146
+ },
1147
+ children: /* @__PURE__ */ F(p, { children: /* @__PURE__ */ F(h.Field, {
1148
+ name: "targetTenant",
1149
+ validators: {
1150
+ onBlur: ({ value: e }) => {
1151
+ let t = e.trim();
1152
+ if (!t) return a._({ id: "1RwosK" });
1153
+ if (!$(t)) return a._({ id: "CunRry" });
1154
+ },
1155
+ onChange: ({ value: e }) => {
1156
+ if (!l) return;
1157
+ let t = e.trim();
1158
+ if (!t) return a._({ id: "1RwosK" });
1159
+ if (!$(t)) return a._({ id: "CunRry" });
1160
+ }
1161
+ },
1162
+ children: (t) => {
1163
+ let n = (t.state.meta.isTouched || l) && t.state.meta.errors.length > 0, r = t.state.meta.errors[0], i = n ? typeof r == "string" ? r : r?.message : void 0;
1164
+ return /* @__PURE__ */ F(e, {
1165
+ id: t.name,
1166
+ name: t.name,
1167
+ label: a._({ id: "WzVwU0" }),
1168
+ value: t.state.value,
1169
+ onChange: (e) => t.handleChange(e.target.value),
1170
+ onBlur: t.handleBlur,
1171
+ placeholder: a._({ id: "he4q+i" }),
1172
+ required: !0,
1173
+ helptext: a._({ id: "PkfPsB" }),
1174
+ disabled: m.isPending,
1175
+ errortext: i,
1176
+ invalid: n
1177
+ });
1178
+ }
1179
+ }) })
1180
+ })
1181
+ ]
1182
+ });
1183
+ }
1184
+ //#endregion
1185
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-modals/DeleteRBACPolicyDialog.tsx
1186
+ function xe({ policy: n, open: r, onClose: i, onConfirm: a, isLoading: o, error: s }) {
1187
+ let { i18n: c, _: l } = H(), u = W({
1188
+ defaultValues: { confirmText: "" },
1189
+ validators: { onSubmit: U.object({ confirmText: U.string().refine((e) => e === "remove", { message: c._({ id: "SVLToM" }) }) }) },
1190
+ onSubmit: async () => {
1191
+ o || (a(n.id), m());
1192
+ }
1193
+ }), f = G(u.store, (e) => e.isSubmitting || e.values.confirmText !== "remove"), m = () => {
1194
+ u.reset(), i();
1195
+ };
1196
+ return /* @__PURE__ */ F(S, {
1197
+ open: r,
1198
+ onCancel: m,
1199
+ size: "small",
1200
+ title: c._({ id: "Dt5W9T" }),
1201
+ onConfirm: u.handleSubmit,
1202
+ cancelButtonLabel: c._({ id: "dEgA5A" }),
1203
+ confirmButtonLabel: o ? c._({ id: "M5RhXF" }) : c._({ id: "qh5W8q" }),
1204
+ disableConfirmButton: o || f,
1205
+ children: /* @__PURE__ */ I("div", { children: [
1206
+ s && /* @__PURE__ */ F(d, {
1207
+ dismissible: !1,
1208
+ variant: "error",
1209
+ className: "mt-4",
1210
+ children: s
1211
+ }),
1212
+ /* @__PURE__ */ F(V, { id: "BMTd81" }),
1213
+ /* @__PURE__ */ I("div", {
1214
+ className: "bg-theme-background-lvl-1 mt-4 mb-4 rounded p-4",
1215
+ children: [/* @__PURE__ */ F("p", {
1216
+ className: "mb-2 font-semibold",
1217
+ children: /* @__PURE__ */ F(V, { id: "nLvo6K" })
1218
+ }), /* @__PURE__ */ I("ul", {
1219
+ className: "list-inside list-disc space-y-1 text-sm",
1220
+ children: [
1221
+ /* @__PURE__ */ I("li", { children: [
1222
+ /* @__PURE__ */ F(V, { id: "WzVwU0" }),
1223
+ ": ",
1224
+ n.target_tenant
1225
+ ] }),
1226
+ /* @__PURE__ */ I("li", { children: [
1227
+ /* @__PURE__ */ F(V, { id: "bwRvnp" }),
1228
+ ": ",
1229
+ n.action
1230
+ ] }),
1231
+ /* @__PURE__ */ I("li", { children: [
1232
+ /* @__PURE__ */ F(V, { id: "UGhVPl" }),
1233
+ ": ",
1234
+ n.object_type
1235
+ ] })
1236
+ ]
1237
+ })]
1238
+ }),
1239
+ !o && /* @__PURE__ */ F(t, {
1240
+ className: "mt-4 mb-0",
1241
+ onSubmit: (e) => {
1242
+ e.preventDefault(), u.handleSubmit();
1243
+ },
1244
+ children: /* @__PURE__ */ I(p, { children: [/* @__PURE__ */ F("p", {
1245
+ className: "mb-2 text-sm",
1246
+ children: /* @__PURE__ */ F(V, {
1247
+ id: "Enpdmy",
1248
+ components: { 0: /* @__PURE__ */ F("strong", {}) }
1249
+ })
1250
+ }), /* @__PURE__ */ F(u.Field, {
1251
+ name: "confirmText",
1252
+ children: (t) => /* @__PURE__ */ F(e, {
1253
+ id: t.name,
1254
+ name: t.name,
1255
+ value: t.state.value,
1256
+ onChange: (e) => t.handleChange(e.target.value),
1257
+ placeholder: c._({ id: "tasfos" }),
1258
+ autoComplete: "off",
1259
+ disabled: o,
1260
+ "data-testid": "remove-policy-confirmation-input"
1261
+ })
1262
+ })] })
1263
+ })
1264
+ ] })
1265
+ });
1266
+ }
1267
+ //#endregion
1268
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/-details/SecurityGroupRBACPolicies.tsx
1269
+ function Se({ securityGroupId: e }) {
1270
+ let t = D.useUtils(), { i18n: n, _: i } = H(), a = j(), [o, c] = k(), [l, u] = z(null), [p, h] = z(""), { data: _, isPending: v, isError: y, error: x } = D.network.rbacPolicy.list.useQuery({
1271
+ project_id: a,
1272
+ securityGroupId: e
1273
+ }, { refetchOnWindowFocus: !1 }), S = D.network.rbacPolicy.delete.useMutation({ onSuccess: () => {
1274
+ t.network.rbacPolicy.list.invalidate({
1275
+ project_id: a,
1276
+ securityGroupId: e
1277
+ }), t.network.securityGroup.getById.invalidate({
1278
+ project_id: a,
1279
+ securityGroupId: e
1280
+ });
1281
+ } }), C = (e) => {
1282
+ u(e);
1283
+ }, w = (e) => {
1284
+ S.mutate({
1285
+ project_id: a,
1286
+ policyId: e
1287
+ });
1288
+ }, T = () => {
1289
+ S.isPending || u(null);
1290
+ };
1291
+ L(() => {
1292
+ !S.isPending && !S.error && S.isSuccess && u(null);
1293
+ }, [
1294
+ S.isPending,
1295
+ S.error,
1296
+ S.isSuccess
1297
+ ]);
1298
+ let E = R(() => {
1299
+ if (!_) return [];
1300
+ if (!p) return _;
1301
+ let e = p.toLowerCase();
1302
+ return _.filter((t) => t.target_tenant?.toLowerCase().includes(e) || t.action?.toLowerCase().includes(e));
1303
+ }, [_, p]), O = (e) => {
1304
+ h(typeof e == "string" ? e : "");
1305
+ };
1306
+ if (v) return /* @__PURE__ */ F(b, {
1307
+ distribution: "center",
1308
+ alignment: "center",
1309
+ className: "py-8",
1310
+ children: /* @__PURE__ */ F(s, { variant: "primary" })
1311
+ });
1312
+ if (y) return /* @__PURE__ */ F(d, {
1313
+ variant: "error",
1314
+ className: "mb-4",
1315
+ children: x.message
1316
+ });
1317
+ let M = _?.length || 0, N = E.length;
1318
+ return /* @__PURE__ */ I(P, { children: [
1319
+ /* @__PURE__ */ I(b, {
1320
+ direction: "vertical",
1321
+ gap: "4",
1322
+ children: [/* @__PURE__ */ F(A, {
1323
+ totalCount: M,
1324
+ filteredCount: N,
1325
+ itemName: n._({ id: "M9H+/G" }),
1326
+ searchTerm: p,
1327
+ onSearch: O,
1328
+ actions: /* @__PURE__ */ F(f, {
1329
+ variant: "primary",
1330
+ icon: "addCircle",
1331
+ onClick: c,
1332
+ children: /* @__PURE__ */ F(V, { id: "vmRPFm" })
1333
+ })
1334
+ }), N === 0 ? p ? /* @__PURE__ */ F(V, { id: "qxxo7y" }) : /* @__PURE__ */ F(V, { id: "Dia2Ue" }) : /* @__PURE__ */ I(g, {
1335
+ columns: 3,
1336
+ children: [/* @__PURE__ */ I(r, { children: [
1337
+ /* @__PURE__ */ F(m, { children: /* @__PURE__ */ F(V, { id: "WzVwU0" }) }),
1338
+ /* @__PURE__ */ F(m, { children: /* @__PURE__ */ F(V, { id: "bwRvnp" }) }),
1339
+ /* @__PURE__ */ F(m, { children: /* @__PURE__ */ F(V, { id: "7L01XJ" }) })
1340
+ ] }), E.map((e) => /* @__PURE__ */ F(_e, {
1341
+ policy: e,
1342
+ onDelete: () => C(e)
1343
+ }, e.id))]
1344
+ })]
1345
+ }),
1346
+ !!l && /* @__PURE__ */ F(xe, {
1347
+ policy: l,
1348
+ open: !!l,
1349
+ onClose: T,
1350
+ onConfirm: w,
1351
+ isLoading: S.isPending,
1352
+ error: S.error?.message || null
1353
+ }),
1354
+ o && /* @__PURE__ */ F(be, {
1355
+ isOpen: o,
1356
+ onClose: c,
1357
+ securityGroupId: e
1358
+ })
1359
+ ] });
1360
+ }
1361
+ //#endregion
1362
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-components/SecurityGroupDetailsView.tsx
1363
+ function Ce({ securityGroup: e, filteredAndSortedRules: t, onEdit: n, onDeleteRule: r, isDeletingRule: i = !1, deleteRuleError: a = null, filterControls: o, onCreateRule: s, isCreatingRule: c = !1, createRuleError: l = null, availableSecurityGroups: u = [], currentProjectId: d }) {
1364
+ let [f, p] = z("rules"), m = e.project_id === d, h = !m, g = m;
1365
+ return /* @__PURE__ */ F(E, {
1366
+ px: !1,
1367
+ py: !0,
1368
+ children: /* @__PURE__ */ I(b, {
1369
+ direction: "vertical",
1370
+ gap: "4",
1371
+ children: [
1372
+ /* @__PURE__ */ F(K, {
1373
+ name: e.name,
1374
+ id: e.id
1375
+ }),
1376
+ /* @__PURE__ */ F(q, {
1377
+ securityGroup: e,
1378
+ onEdit: n,
1379
+ isReadOnly: h
1380
+ }),
1381
+ !h && /* @__PURE__ */ F(J, {
1382
+ activeTab: f,
1383
+ onTabChange: p,
1384
+ showRBACTab: g
1385
+ }),
1386
+ /* @__PURE__ */ I("div", {
1387
+ className: "mt-6",
1388
+ children: [f === "rules" && /* @__PURE__ */ F(ge, {
1389
+ rules: t,
1390
+ totalRulesCount: e.security_group_rules?.length,
1391
+ onDeleteRule: r,
1392
+ isDeletingRule: i,
1393
+ deleteError: a,
1394
+ searchTerm: o.searchTerm,
1395
+ onSearchChange: o.onSearchChange,
1396
+ sortSettings: o.sortSettings,
1397
+ onSortChange: o.onSortChange,
1398
+ filterSettings: o.filterSettings,
1399
+ onFilterChange: o.onFilterChange,
1400
+ securityGroupId: e.id,
1401
+ onCreateRule: h ? void 0 : s,
1402
+ isCreatingRule: c,
1403
+ createRuleError: l,
1404
+ availableSecurityGroups: u,
1405
+ readOnly: h
1406
+ }), f === "rbac" && /* @__PURE__ */ F(Se, { securityGroupId: e.id })]
1407
+ })
1408
+ ]
1409
+ })
1410
+ });
1411
+ }
1412
+ //#endregion
1413
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/-hooks/useSecurityGroupDetails.ts
1414
+ function we({ securityGroupId: e, filterControls: t }) {
1415
+ let [n, r] = z(!1), i = j(), a = D.useUtils(), o = D.network.securityGroup.getById.useQuery({
1416
+ project_id: i,
1417
+ securityGroupId: e
1418
+ }, { placeholderData: () => a.network.securityGroup.getById.getData({
1419
+ project_id: i,
1420
+ securityGroupId: e
1421
+ }) }), s = R(() => {
1422
+ let e = o.data?.security_group_rules || [], n = t.filterSettings.selectedFilters?.find((e) => e.name === "direction")?.value, r = t.filterSettings.selectedFilters?.find((e) => e.name === "ethertype")?.value, i = t.filterSettings.selectedFilters?.find((e) => e.name === "protocol")?.value;
1423
+ if (n && n !== "all" && (e = e.filter((e) => e.direction === n)), r && r !== "all" && (e = e.filter((e) => e.ethertype === r)), i && i !== "all" && (e = e.filter((e) => e.protocol === null ? !1 : e.protocol === i)), t.searchTerm) {
1424
+ let n = t.searchTerm.toLowerCase();
1425
+ e = e.filter((e) => e.description?.toLowerCase().includes(n) || e.protocol?.toLowerCase().includes(n) || e.ethertype?.toLowerCase().includes(n));
1426
+ }
1427
+ if (t.sortSettings.sortBy) {
1428
+ let n = t.sortSettings.sortBy;
1429
+ e = [...e].sort((e, r) => {
1430
+ let i = e[n] || "", a = r[n] || "", o = i.localeCompare(a);
1431
+ return t.sortSettings.sortDirection === "asc" ? o : -o;
1432
+ });
1433
+ }
1434
+ return e;
1435
+ }, [o.data?.security_group_rules, t]), c = D.network.securityGroup.update.useMutation({ onSuccess: () => {
1436
+ a.network.securityGroup.getById.invalidate({
1437
+ project_id: i,
1438
+ securityGroupId: e
1439
+ }), a.network.securityGroup.list.invalidate(), r(!1);
1440
+ } }), l = D.network.securityGroupRule.delete.useMutation({ onSuccess: () => {
1441
+ a.network.securityGroup.getById.invalidate({
1442
+ project_id: i,
1443
+ securityGroupId: e
1444
+ }), a.network.securityGroup.list.invalidate();
1445
+ } }), u = D.network.securityGroupRule.create.useMutation({ onSuccess: () => {
1446
+ a.network.securityGroup.getById.invalidate({
1447
+ project_id: i,
1448
+ securityGroupId: e
1449
+ }), a.network.securityGroup.list.invalidate();
1450
+ } });
1451
+ return {
1452
+ securityGroup: o.data,
1453
+ filteredAndSortedRules: s,
1454
+ isLoading: o.isPending,
1455
+ isError: o.isError,
1456
+ error: o.error,
1457
+ isUpdating: c.isPending,
1458
+ updateError: c.error?.message || null,
1459
+ isDeletingRule: l.isPending,
1460
+ deleteRuleError: l.error?.message || null,
1461
+ isCreatingRule: u.isPending,
1462
+ createRuleError: u.error?.message || null,
1463
+ editModalOpen: n,
1464
+ handleEdit: () => {
1465
+ r(!0);
1466
+ },
1467
+ handleCloseEditModal: () => {
1468
+ r(!1);
1469
+ },
1470
+ handleUpdate: async (e, t) => {
1471
+ await c.mutateAsync({
1472
+ project_id: i,
1473
+ securityGroupId: e,
1474
+ ...t
1475
+ });
1476
+ },
1477
+ handleDeleteRule: async (e) => {
1478
+ await l.mutateAsync({
1479
+ project_id: i,
1480
+ ruleId: e
1481
+ });
1482
+ },
1483
+ handleCreateRule: async (e) => {
1484
+ await u.mutateAsync({
1485
+ project_id: i,
1486
+ ...e
1487
+ });
1488
+ }
1489
+ };
1490
+ }
1491
+ //#endregion
1492
+ //#region src/client/routes/_auth/projects/$projectId/network/securitygroups/$securityGroupId/index.tsx?tsr-split=component
1493
+ function Te() {
1494
+ let { securityGroupId: e } = O.useParams(), t = j(), n = B(), { i18n: r, _: i } = H(), { setPageTitle: a } = O.useRouteContext(), { searchTerm: o, sortSettings: l, filterSettings: u, handleSearchChange: d, handleSortChange: p, handleFilterChange: m } = M({
1495
+ defaultSortKey: "direction",
1496
+ defaultSortDir: "asc",
1497
+ sortOptions: [
1498
+ {
1499
+ label: r._({ id: "MRB7nI" }),
1500
+ value: "direction"
1501
+ },
1502
+ {
1503
+ label: r._({ id: "6+OdGi" }),
1504
+ value: "protocol"
1505
+ },
1506
+ {
1507
+ label: r._({ id: "Nu4oKW" }),
1508
+ value: "description"
1509
+ }
1510
+ ],
1511
+ filterSettings: { filters: [
1512
+ {
1513
+ displayName: r._({ id: "MRB7nI" }),
1514
+ filterName: "direction",
1515
+ values: ["ingress", "egress"],
1516
+ supportsMultiValue: !1
1517
+ },
1518
+ {
1519
+ displayName: r._({ id: "yp0UjB" }),
1520
+ filterName: "ethertype",
1521
+ values: ["IPv4", "IPv6"],
1522
+ supportsMultiValue: !1
1523
+ },
1524
+ {
1525
+ displayName: r._({ id: "6+OdGi" }),
1526
+ filterName: "protocol",
1527
+ values: [
1528
+ "tcp",
1529
+ "udp",
1530
+ "icmp",
1531
+ "ipv6-icmp"
1532
+ ],
1533
+ supportsMultiValue: !1
1534
+ }
1535
+ ] }
1536
+ }), h = {
1537
+ searchTerm: o,
1538
+ onSearchChange: d,
1539
+ sortSettings: l,
1540
+ onSortChange: p,
1541
+ filterSettings: u,
1542
+ onFilterChange: m
1543
+ }, { securityGroup: g, filteredAndSortedRules: _, isLoading: y, isError: x, error: S, isUpdating: C, updateError: T, isDeletingRule: E, deleteRuleError: k, isCreatingRule: A, createRuleError: P, editModalOpen: L, handleEdit: z, handleCloseEditModal: U, handleUpdate: W, handleDeleteRule: G, handleCreateRule: K } = we({
1544
+ securityGroupId: e,
1545
+ filterControls: h
1546
+ }), { data: q } = D.network.securityGroup.list.useQuery({ project_id: t }), J = R(() => (q || []).filter((t) => t.id !== e).map((e) => ({
1547
+ id: e.id,
1548
+ name: e.name || e.id
1549
+ })), [q, e]), Y = () => {
1550
+ n({
1551
+ to: "/projects/$projectId/network/securitygroups",
1552
+ params: { projectId: t }
1553
+ });
1554
+ };
1555
+ if (y) return a(r._({ id: "Z3FXyt" })), /* @__PURE__ */ I(b, {
1556
+ className: "fixed inset-0",
1557
+ distribution: "center",
1558
+ alignment: "center",
1559
+ direction: "vertical",
1560
+ children: [/* @__PURE__ */ F(s, {
1561
+ variant: "primary",
1562
+ size: "large",
1563
+ className: "mb-2"
1564
+ }), /* @__PURE__ */ F(V, { id: "3x7Sws" })]
1565
+ });
1566
+ if (x) {
1567
+ let e = S?.message || "Unknown error";
1568
+ return /* @__PURE__ */ I(b, {
1569
+ className: "fixed inset-0",
1570
+ distribution: "center",
1571
+ alignment: "center",
1572
+ direction: "vertical",
1573
+ gap: "5",
1574
+ children: [
1575
+ /* @__PURE__ */ F("p", {
1576
+ className: "text-theme-error font-semibold",
1577
+ children: /* @__PURE__ */ F(V, { id: "FjPnAE" })
1578
+ }),
1579
+ /* @__PURE__ */ F("p", {
1580
+ className: "text-theme-highest",
1581
+ children: e
1582
+ }),
1583
+ /* @__PURE__ */ F(f, {
1584
+ onClick: Y,
1585
+ variant: "primary",
1586
+ children: /* @__PURE__ */ F(V, { id: "U9q4M7" })
1587
+ })
1588
+ ]
1589
+ });
1590
+ }
1591
+ return g ? (a(g.name || g.id), /* @__PURE__ */ I(b, {
1592
+ direction: "vertical",
1593
+ children: [
1594
+ /* @__PURE__ */ F(w, { children: g.name || g.id }),
1595
+ /* @__PURE__ */ I(v, {
1596
+ className: "my-6",
1597
+ children: [/* @__PURE__ */ F(c, {
1598
+ onClick: Y,
1599
+ label: r._({ id: "4opp4r" })
1600
+ }), /* @__PURE__ */ F(c, {
1601
+ active: !0,
1602
+ label: g.id
1603
+ })]
1604
+ }),
1605
+ /* @__PURE__ */ F(Ce, {
1606
+ securityGroup: g,
1607
+ filteredAndSortedRules: _,
1608
+ onEdit: z,
1609
+ onDeleteRule: G,
1610
+ isDeletingRule: E,
1611
+ deleteRuleError: k,
1612
+ filterControls: h,
1613
+ onCreateRule: K,
1614
+ isCreatingRule: A,
1615
+ createRuleError: P,
1616
+ availableSecurityGroups: J,
1617
+ currentProjectId: t
1618
+ }),
1619
+ /* @__PURE__ */ F(N, {
1620
+ securityGroup: g,
1621
+ open: L,
1622
+ onClose: U,
1623
+ onUpdate: W,
1624
+ isLoading: C,
1625
+ error: T
1626
+ })
1627
+ ]
1628
+ })) : /* @__PURE__ */ I(b, {
1629
+ className: "fixed inset-0",
1630
+ distribution: "center",
1631
+ alignment: "center",
1632
+ direction: "vertical",
1633
+ gap: "5",
1634
+ children: [/* @__PURE__ */ F("p", {
1635
+ className: "text-theme-secondary",
1636
+ children: /* @__PURE__ */ F(V, { id: "Zw8Q49" })
1637
+ }), /* @__PURE__ */ F(f, {
1638
+ onClick: Y,
1639
+ variant: "primary",
1640
+ children: /* @__PURE__ */ F(V, { id: "U9q4M7" })
1641
+ })]
1642
+ });
1643
+ }
1644
+ //#endregion
1645
+ export { Te as component };
1646
+
1647
+ //# sourceMappingURL=_securityGroupId-DQoRQ-yA.mjs.map