@cobaltcore-dev/aurora 1.1.0 → 1.2.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 (183) hide show
  1. package/README.md +59 -9
  2. package/dist/client/App.d.ts +2 -2
  3. package/dist/client/AuroraApp.d.ts +33 -13
  4. package/dist/client/{AuthProvider-BS5OVv8n.mjs → AuthProvider-CVSAwW9f.mjs} +22 -8
  5. package/dist/client/AuthProvider-CVSAwW9f.mjs.map +1 -0
  6. package/dist/client/{ContentHeader-BHMUzd9H.mjs → ContentHeader-CPJbgYWn.mjs} +18 -18
  7. package/dist/client/{ContentHeader-BHMUzd9H.mjs.map → ContentHeader-CPJbgYWn.mjs.map} +1 -1
  8. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs +773 -0
  9. package/dist/client/DeleteFlavorModal-V44QCJBd.mjs.map +1 -0
  10. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs +26 -0
  11. package/dist/client/DynamicBreadcrumbContext-CVcUQFou.mjs.map +1 -0
  12. package/dist/client/{FiltersInput-B8CNBg1L.mjs → FiltersInput-CKI6zWnm.mjs} +18 -18
  13. package/dist/client/{FiltersInput-B8CNBg1L.mjs.map → FiltersInput-CKI6zWnm.mjs.map} +1 -1
  14. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs +460 -0
  15. package/dist/client/FloatingIpActionModals-CwEC5GR-.mjs.map +1 -0
  16. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs +1152 -0
  17. package/dist/client/ImageToastNotifications-m6c3tVPb.mjs.map +1 -0
  18. package/dist/client/SortInput-4g7nSTHW.mjs +34 -0
  19. package/dist/client/SortInput-4g7nSTHW.mjs.map +1 -0
  20. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs → TwoColumnDescriptionList-NvgvErua.mjs} +2 -2
  21. package/dist/client/{TwoColumnDescriptionList-DiDx3PnH.mjs.map → TwoColumnDescriptionList-NvgvErua.mjs.map} +1 -1
  22. package/dist/client/_-CAsCx-Ay.mjs +6 -0
  23. package/dist/client/_-CAsCx-Ay.mjs.map +1 -0
  24. package/dist/client/_auth-SrDjHL6j.mjs +12 -0
  25. package/dist/client/_auth-SrDjHL6j.mjs.map +1 -0
  26. package/dist/client/_flavorId-9PcBBW52.mjs +231 -0
  27. package/dist/client/_flavorId-9PcBBW52.mjs.map +1 -0
  28. package/dist/client/{_flavorId-BN_qessZ.mjs → _flavorId-a9Gu66R1.mjs} +3 -9
  29. package/dist/client/_flavorId-a9Gu66R1.mjs.map +1 -0
  30. package/dist/client/_floatingIpId-AE9Fu8l6.mjs +210 -0
  31. package/dist/client/_floatingIpId-AE9Fu8l6.mjs.map +1 -0
  32. package/dist/client/{_floatingIpId-CwDGHkWm.mjs → _floatingIpId-AZ11Ksmu.mjs} +3 -9
  33. package/dist/client/_floatingIpId-AZ11Ksmu.mjs.map +1 -0
  34. package/dist/client/{_imageId-BtJ7GmYB.mjs → _imageId-BtAql2Kr.mjs} +104 -92
  35. package/dist/client/_imageId-BtAql2Kr.mjs.map +1 -0
  36. package/dist/client/_imageId-D76BxvFY.mjs +39 -0
  37. package/dist/client/_imageId-D76BxvFY.mjs.map +1 -0
  38. package/dist/client/{_projectId-Byt3GQDW.mjs → _projectId-7Nl1MQTJ.mjs} +5 -5
  39. package/dist/client/_projectId-7Nl1MQTJ.mjs.map +1 -0
  40. package/dist/client/_projectId-B3wmSala.mjs +281 -0
  41. package/dist/client/_projectId-B3wmSala.mjs.map +1 -0
  42. package/dist/client/_projectId-DPzv0CCp.mjs +77 -0
  43. package/dist/client/_projectId-DPzv0CCp.mjs.map +1 -0
  44. package/dist/client/_projectId-DfeVJy0G.mjs +30 -0
  45. package/dist/client/_projectId-DfeVJy0G.mjs.map +1 -0
  46. package/dist/client/_securityGroupId-C5huJNfO.mjs +1810 -0
  47. package/dist/client/_securityGroupId-C5huJNfO.mjs.map +1 -0
  48. package/dist/client/{_securityGroupId-BcbkRhsN.mjs → _securityGroupId-D85mSigA.mjs} +3 -9
  49. package/dist/client/_securityGroupId-D85mSigA.mjs.map +1 -0
  50. package/dist/client/_serviceType-DS8DxsrP.mjs +20 -0
  51. package/dist/client/_serviceType-DS8DxsrP.mjs.map +1 -0
  52. package/dist/client/_serviceType-M8d9rOT6.mjs +6 -0
  53. package/dist/client/_serviceType-M8d9rOT6.mjs.map +1 -0
  54. package/dist/client/_storageType-BRWWJtow.mjs +14 -0
  55. package/dist/client/_storageType-BRWWJtow.mjs.map +1 -0
  56. package/dist/client/_storageType-CzZ4u9x_.mjs +12 -0
  57. package/dist/client/_storageType-CzZ4u9x_.mjs.map +1 -0
  58. package/dist/client/_storageType-Dy9uCVXr.mjs +845 -0
  59. package/dist/client/_storageType-Dy9uCVXr.mjs.map +1 -0
  60. package/dist/client/_storageType-zeSZe--V.mjs.map +1 -1
  61. package/dist/client/{about-_73VmpTB.mjs → about-BmQTyLWc.mjs} +2 -2
  62. package/dist/client/{about-_73VmpTB.mjs.map → about-BmQTyLWc.mjs.map} +1 -1
  63. package/dist/client/{aurora-EbwGRLLf.mjs → aurora-CIml-f2f.mjs} +2 -2
  64. package/dist/client/{aurora-EbwGRLLf.mjs.map → aurora-CIml-f2f.mjs.map} +1 -1
  65. package/dist/client/{build-C_4vRMCq.mjs → build-WuxXRAqf.mjs} +121 -24
  66. package/dist/client/{build-C_4vRMCq.mjs.map → build-WuxXRAqf.mjs.map} +1 -1
  67. package/dist/client/components/Breadcrumbs.d.ts +1 -0
  68. package/dist/client/components/ListToolbar/SortInput.d.ts +3 -0
  69. package/dist/client/context/BreadcrumbExtensionContext.d.ts +9 -0
  70. package/dist/client/context/DynamicBreadcrumbContext.d.ts +9 -0
  71. package/dist/client/{flavors-CiHCYrtZ.mjs → flavors-B0rbqffG.mjs} +3 -5
  72. package/dist/client/flavors-B0rbqffG.mjs.map +1 -0
  73. package/dist/client/flavors-DWMZ6TuJ.mjs.map +1 -1
  74. package/dist/client/flavors-Rl20bxVU.mjs +628 -0
  75. package/dist/client/flavors-Rl20bxVU.mjs.map +1 -0
  76. package/dist/client/floatingips-Cz9k80cc.mjs +8 -0
  77. package/dist/client/floatingips-Cz9k80cc.mjs.map +1 -0
  78. package/dist/client/floatingips-xbO_mu4f.mjs +576 -0
  79. package/dist/client/floatingips-xbO_mu4f.mjs.map +1 -0
  80. package/dist/client/hooks/useBreadcrumbs.d.ts +16 -0
  81. package/dist/client/hooks/usePushBreadcrumbs.d.ts +10 -0
  82. package/dist/client/hooks/useSetBreadcrumb.d.ts +11 -0
  83. package/dist/client/{hooks-LutR2Yg3.mjs → hooks-D0yKIumu.mjs} +2 -2
  84. package/dist/client/{hooks-LutR2Yg3.mjs.map → hooks-D0yKIumu.mjs.map} +1 -1
  85. package/dist/client/images-BGQv9kKT.mjs +1983 -0
  86. package/dist/client/images-BGQv9kKT.mjs.map +1 -0
  87. package/dist/client/{images-CS4kZQyu.mjs → images-CPmMa4SQ.mjs} +3 -5
  88. package/dist/client/images-CPmMa4SQ.mjs.map +1 -0
  89. package/dist/client/images-NBf2bV43.mjs.map +1 -1
  90. package/dist/client/index.d.ts +7 -3
  91. package/dist/client/index.js +549 -535
  92. package/dist/client/index.js.map +1 -1
  93. package/dist/client/{objects-C3azvW8m.mjs → objects-BE_u5yRt.mjs} +7087 -4211
  94. package/dist/client/objects-BE_u5yRt.mjs.map +1 -0
  95. package/dist/client/objects-BN-59Th0.mjs +66 -0
  96. package/dist/client/objects-BN-59Th0.mjs.map +1 -0
  97. package/dist/client/objects-D9Luf9KB.mjs +66 -0
  98. package/dist/client/objects-D9Luf9KB.mjs.map +1 -0
  99. package/dist/client/projects-yiK0HGSA.mjs.map +1 -1
  100. package/dist/client/routeInfo-DP3v74Wg.mjs +19 -0
  101. package/dist/client/routeInfo-DP3v74Wg.mjs.map +1 -0
  102. package/dist/client/router.d.ts +2 -2
  103. package/dist/client/{routes-CdDm-hhO.mjs → routes-CJj7SR_K.mjs} +2 -2
  104. package/dist/client/routes-CJj7SR_K.mjs.map +1 -0
  105. package/dist/client/routes-xofA3ksU.mjs +110 -0
  106. package/dist/client/routes-xofA3ksU.mjs.map +1 -0
  107. package/dist/client/securitygroups-BjhgLBHm.mjs +620 -0
  108. package/dist/client/securitygroups-BjhgLBHm.mjs.map +1 -0
  109. package/dist/client/securitygroups-CtKne8UQ.mjs +8 -0
  110. package/dist/client/securitygroups-CtKne8UQ.mjs.map +1 -0
  111. package/dist/client/{securitygroups-Byte-iSp.mjs → securitygroups-DEJQBcxm.mjs} +3 -5
  112. package/dist/client/securitygroups-DEJQBcxm.mjs.map +1 -0
  113. package/dist/client/trpcClient.d.ts +135 -3
  114. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs +54 -0
  115. package/dist/client/useBreadcrumbs-ha3IlaxX.mjs.map +1 -0
  116. package/dist/client/useModalTracking-BcOKTYRN.mjs +33 -0
  117. package/dist/client/useModalTracking-BcOKTYRN.mjs.map +1 -0
  118. package/dist/client/{useSecurityGroupPermissions-C29mzb3b.mjs → useSecurityGroupPermissions-BOyLQLdC.mjs} +85 -19
  119. package/dist/client/useSecurityGroupPermissions-BOyLQLdC.mjs.map +1 -0
  120. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs +19 -0
  121. package/dist/client/useSetBreadcrumb-tn7lBaQV.mjs.map +1 -0
  122. package/dist/client/utils/formatSwiftDate.d.ts +30 -0
  123. package/dist/server/index.d.ts +136 -4
  124. package/dist/server/index.js +845 -260
  125. package/package.json +37 -36
  126. package/dist/client/AuthProvider-BS5OVv8n.mjs.map +0 -1
  127. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs +0 -721
  128. package/dist/client/DeleteFlavorModal-BP83t9zX.mjs.map +0 -1
  129. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs +0 -417
  130. package/dist/client/FloatingIpActionModals-BraiJWBi.mjs.map +0 -1
  131. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs +0 -1131
  132. package/dist/client/ImageToastNotifications-BXMHJaIH.mjs.map +0 -1
  133. package/dist/client/RouteError-hAF8_jbe.mjs +0 -25
  134. package/dist/client/RouteError-hAF8_jbe.mjs.map +0 -1
  135. package/dist/client/SortInput-Cqs2poV3.mjs +0 -34
  136. package/dist/client/SortInput-Cqs2poV3.mjs.map +0 -1
  137. package/dist/client/StatusError-C5KodQOq.mjs +0 -39
  138. package/dist/client/StatusError-C5KodQOq.mjs.map +0 -1
  139. package/dist/client/_auth-DJ9wHZaj.mjs +0 -11
  140. package/dist/client/_auth-DJ9wHZaj.mjs.map +0 -1
  141. package/dist/client/_flavorId-BN_qessZ.mjs.map +0 -1
  142. package/dist/client/_flavorId-CJjEB_Ao.mjs +0 -210
  143. package/dist/client/_flavorId-CJjEB_Ao.mjs.map +0 -1
  144. package/dist/client/_floatingIpId-CwDGHkWm.mjs.map +0 -1
  145. package/dist/client/_floatingIpId-foMIwbE4.mjs +0 -215
  146. package/dist/client/_floatingIpId-foMIwbE4.mjs.map +0 -1
  147. package/dist/client/_imageId-BtJ7GmYB.mjs.map +0 -1
  148. package/dist/client/_projectId-BmtCuzJu.mjs +0 -29
  149. package/dist/client/_projectId-BmtCuzJu.mjs.map +0 -1
  150. package/dist/client/_projectId-Byt3GQDW.mjs.map +0 -1
  151. package/dist/client/_projectId-NYk1IN_a.mjs +0 -291
  152. package/dist/client/_projectId-NYk1IN_a.mjs.map +0 -1
  153. package/dist/client/_projectId-QueiFczy.mjs +0 -46
  154. package/dist/client/_projectId-QueiFczy.mjs.map +0 -1
  155. package/dist/client/_securityGroupId-BcbkRhsN.mjs.map +0 -1
  156. package/dist/client/_securityGroupId-pPtJsCoe.mjs +0 -1797
  157. package/dist/client/_securityGroupId-pPtJsCoe.mjs.map +0 -1
  158. package/dist/client/_storageType-BmqrU06i.mjs +0 -2202
  159. package/dist/client/_storageType-BmqrU06i.mjs.map +0 -1
  160. package/dist/client/components/Error/StatusError.d.ts +0 -11
  161. package/dist/client/components/ProjectView/ProjectInfoBox.d.ts +0 -12
  162. package/dist/client/flavors-CiHCYrtZ.mjs.map +0 -1
  163. package/dist/client/flavors-DY-bDc8l.mjs +0 -650
  164. package/dist/client/flavors-DY-bDc8l.mjs.map +0 -1
  165. package/dist/client/floatingips-Ci4jHkaG.mjs +0 -591
  166. package/dist/client/floatingips-Ci4jHkaG.mjs.map +0 -1
  167. package/dist/client/images-91U7tr9Y2.mjs +0 -1976
  168. package/dist/client/images-91U7tr9Y2.mjs.map +0 -1
  169. package/dist/client/images-CS4kZQyu.mjs.map +0 -1
  170. package/dist/client/objects-C3azvW8m.mjs.map +0 -1
  171. package/dist/client/objects-CM265S6b.mjs +0 -56
  172. package/dist/client/objects-CM265S6b.mjs.map +0 -1
  173. package/dist/client/objects-EE9Cd1wI.mjs +0 -56
  174. package/dist/client/objects-EE9Cd1wI.mjs.map +0 -1
  175. package/dist/client/routeInfo-DXqB2HCf.mjs +0 -32
  176. package/dist/client/routeInfo-DXqB2HCf.mjs.map +0 -1
  177. package/dist/client/routes-CBd8CCuM.mjs +0 -115
  178. package/dist/client/routes-CBd8CCuM.mjs.map +0 -1
  179. package/dist/client/routes-CdDm-hhO.mjs.map +0 -1
  180. package/dist/client/securitygroups-Bd_uV4S9.mjs +0 -595
  181. package/dist/client/securitygroups-Bd_uV4S9.mjs.map +0 -1
  182. package/dist/client/securitygroups-Byte-iSp.mjs.map +0 -1
  183. package/dist/client/useSecurityGroupPermissions-C29mzb3b.mjs.map +0 -1
@@ -0,0 +1,1983 @@
1
+ import { C as e, D as t, K as n, L as r, O as i, Q as a, R as o, S as s, T as c, U as l, V as u, X as d, a as f, c as p, ft as m, g as h, h as g, i as _, it as v, l as y, m as b, o as ee, ot as x, p as S, rt as C, st as te, t as w, x as T } from "./build-WuxXRAqf.mjs";
2
+ import { a as E, i as D } from "./trpcClient-D7gpR7YG.mjs";
3
+ import { t as O } from "./cn-DM4Cy3jv.mjs";
4
+ import { t as k } from "./images-CPmMa4SQ.mjs";
5
+ import { t as A } from "./useProjectId-DBc5lpoU.mjs";
6
+ import { t as j } from "./SortInput-4g7nSTHW.mjs";
7
+ import { t as ne } from "./useModalTracking-BcOKTYRN.mjs";
8
+ import { t as M } from "./ContentHeader-CPJbgYWn.mjs";
9
+ import "./hooks-D0yKIumu.mjs";
10
+ import { A as N, C as re, D as ie, E as ae, F as P, I as oe, M as F, N as I, O as L, P as R, S as z, T as B, _ as se, a as ce, b as le, c as ue, d as V, f as H, g as U, h as de, i as W, j as G, k as fe, l as pe, m as me, n as he, o as ge, p as _e, r as ve, s as ye, t as be, u as xe, v as Se, w as Ce, x as we, y as Te } from "./ImageToastNotifications-m6c3tVPb.mjs";
11
+ import { n as Ee, t as De } from "./FiltersInput-CKI6zWnm.mjs";
12
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
13
+ import { Suspense as Oe, startTransition as ke, use as Ae, useCallback as je, useEffect as Y, useMemo as X, useRef as Me, useState as Z } from "react";
14
+ import { useNavigate as Ne, useParams as Pe, useSearch as Fe } from "@tanstack/react-router";
15
+ import { TRPCClientError as Ie } from "@trpc/client";
16
+ import { Trans as Q, useLingui as $ } from "@lingui/react";
17
+ import { z as Le } from "zod";
18
+ import { ErrorBoundary as Re } from "react-error-boundary";
19
+ import { useForm as ze, useStore as Be } from "@tanstack/react-form";
20
+ import "@trpc/server";
21
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/ImageTableRow.tsx
22
+ function Ve({ image: e, isSelected: r, isPending: i, isAccepted: a, permissions: o, onEditDetails: s, onEditMetadata: l, onDelete: u, onSelect: d, onActivationStatusChange: f, onManageAccess: p, onUpdateVisibility: m, uploadId: g, uploadProgressPercent: _, onMemberStatusChanged: v, showSelectColumn: y = !1 }) {
23
+ let { i18n: b, _: ee } = $(), { id: S, name: C, status: D, visibility: O, size: k, disk_format: A, created_at: j, owner: ne } = e, M = C || b._({ id: "MEIAzV" }), { projectId: N } = Pe({ from: "/_auth/projects/$projectId/compute/images/" }), re = Ne(), ie = E.useUtils(), ae = E.compute.updateImageMember.useMutation({ onSuccess: () => {
24
+ ie.compute.listImagesWithPagination.invalidate(), ie.compute.listSharedImagesByMemberStatus.invalidate();
25
+ } }), F = async (e) => {
26
+ try {
27
+ await ae.mutateAsync({
28
+ project_id: N,
29
+ imageId: S,
30
+ memberId: N,
31
+ status: e
32
+ });
33
+ let { message: t, ...n } = V(e);
34
+ x.info(t, n), v?.();
35
+ } catch (e) {
36
+ let t = e?.message, { message: n, ...r } = xe(t);
37
+ x.error(n, r);
38
+ }
39
+ }, L = N === ne, z = i || a, B = ae.isPending;
40
+ return /*#__PURE__*/ J(c, {
41
+ "data-testid": `image-row-${S}`,
42
+ onClick: () => re({
43
+ to: "/projects/$projectId/compute/images/$imageId",
44
+ params: {
45
+ projectId: N,
46
+ imageId: S
47
+ }
48
+ }),
49
+ children: [
50
+ y && /*#__PURE__*/ q(w, {
51
+ onClick: (e) => e.stopPropagation(),
52
+ children: /*#__PURE__*/ q(te, {
53
+ checked: r,
54
+ onChange: () => d(e)
55
+ })
56
+ }),
57
+ /*#__PURE__*/ q(w, { children: D }),
58
+ /*#__PURE__*/ q(w, { children: M }),
59
+ /*#__PURE__*/ q(w, { children: O }),
60
+ /*#__PURE__*/ q(w, { children: e.protected ? b._({ id: "l75CjT" }) : b._({ id: "1UzENP" }) }),
61
+ /*#__PURE__*/ q(w, { children: g && g === S ? `${_}%` : /*#__PURE__*/ q(oe, { size: k }) }),
62
+ /*#__PURE__*/ q(w, { children: A || b._({ id: "fj5byd" }) }),
63
+ /*#__PURE__*/ q(w, { children: j ? new Date(j).toLocaleDateString() : b._({ id: "fj5byd" }) }),
64
+ /*#__PURE__*/ q(w, {
65
+ onClick: (e) => e.stopPropagation(),
66
+ children: B ? /*#__PURE__*/ q(n, {
67
+ variant: "primary",
68
+ size: "small"
69
+ }) : /*#__PURE__*/ q(t, { children: /*#__PURE__*/ J(h, { children: [
70
+ /*#__PURE__*/ q(T, {
71
+ label: b._({ id: "v0hPHE" }),
72
+ onClick: () => re({
73
+ to: "/projects/$projectId/compute/images/$imageId",
74
+ params: {
75
+ projectId: N,
76
+ imageId: S
77
+ }
78
+ })
79
+ }),
80
+ z && o.canUpdateMember && /*#__PURE__*/ J(K, { children: [i && /*#__PURE__*/ q(T, {
81
+ label: b._({ id: "g3UF2V" }),
82
+ onClick: () => F(P.ACCEPTED)
83
+ }), /*#__PURE__*/ q(T, {
84
+ label: b._({ id: "1t/NnN" }),
85
+ onClick: () => F(P.REJECTED)
86
+ })] }),
87
+ !z && o.canUpdate && /*#__PURE__*/ J(K, { children: [
88
+ /*#__PURE__*/ q(T, {
89
+ label: b._({ id: "Y1YKad" }),
90
+ onClick: () => s(e)
91
+ }),
92
+ /*#__PURE__*/ q(T, {
93
+ label: b._({ id: "SIfYq6" }),
94
+ onClick: () => l(e)
95
+ }),
96
+ /*#__PURE__*/ q(T, {
97
+ label: e.status === I.DEACTIVATED ? b._({ id: "FQBaXG" }) : b._({ id: "5y3O+A" }),
98
+ onClick: () => f(e)
99
+ }),
100
+ e.visibility === R.SHARED && L && (o.canCreateMember || o.canDeleteMember) && /*#__PURE__*/ q(T, {
101
+ label: b._({ id: "cWbW6w" }),
102
+ onClick: () => p(e)
103
+ }),
104
+ e.visibility === R.PRIVATE && /*#__PURE__*/ q(T, {
105
+ label: b._({ id: "gMYsdZ" }),
106
+ onClick: () => m(e.id, R.SHARED, M)
107
+ })
108
+ ] }),
109
+ !z && o.canDelete && !e.protected && /*#__PURE__*/ q(T, {
110
+ label: b._({ id: "cnGeoo" }),
111
+ onClick: () => u(e)
112
+ })
113
+ ] }) })
114
+ })
115
+ ]
116
+ }, S);
117
+ }
118
+ //#endregion
119
+ //#region src/server/Compute/helpers/imageHelpers.ts
120
+ var He = {
121
+ qcow2: [
122
+ "bare",
123
+ "ova",
124
+ "docker"
125
+ ],
126
+ raw: [
127
+ "bare",
128
+ "ova",
129
+ "docker"
130
+ ],
131
+ vmdk: ["bare", "ova"],
132
+ vhd: ["bare", "ova"],
133
+ vhdx: ["bare", "ova"],
134
+ vdi: ["bare", "ova"],
135
+ iso: ["bare"],
136
+ ami: ["ami"],
137
+ aki: ["aki"],
138
+ ari: ["ari"],
139
+ ploop: ["bare"]
140
+ }, Ue = {
141
+ qcow2: "bare",
142
+ raw: "bare",
143
+ vmdk: "bare",
144
+ vhd: "bare",
145
+ vhdx: "bare",
146
+ vdi: "bare",
147
+ iso: "bare",
148
+ ami: "ami",
149
+ aki: "aki",
150
+ ari: "ari",
151
+ ploop: "bare"
152
+ };
153
+ function We(e) {
154
+ return He[e] || [];
155
+ }
156
+ function Ge(e) {
157
+ return Ue[e] || "";
158
+ }
159
+ function Ke(e, t) {
160
+ return We(e).includes(t);
161
+ }
162
+ //#endregion
163
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/CreateImageModal.tsx
164
+ var qe = {
165
+ name: "",
166
+ tags: [],
167
+ visibility: R.PRIVATE,
168
+ disk_format: void 0,
169
+ container_format: void 0,
170
+ protected: !1,
171
+ min_disk: 0,
172
+ min_ram: 0
173
+ }, Je = ({ isOpen: e, onClose: t, onCreate: i, isLoading: s = !1, isUploadPending: c = !1, uploadProgressPercent: u }) => {
174
+ let { i18n: f, _: p } = $(), [h, y] = Z({ ...qe }), [ee, x] = Z(""), [C, w] = Z(null), [T, E] = Z({}), [D, k] = Z(!1), [A, j] = Z(null), ne = h.name.trim() !== "" && C !== null && h.disk_format !== void 0 && h.disk_format.trim() !== "" && h.container_format !== void 0 && h.container_format.trim() !== "" && h.min_disk >= 0 && h.min_ram >= 0, M = X(() => h.disk_format ? We(h.disk_format) : [], [h.disk_format]), N = [
175
+ ".qcow2",
176
+ ".raw",
177
+ ".vmdk",
178
+ ".vhd",
179
+ ".vhdx",
180
+ ".vdi",
181
+ ".ami",
182
+ ".ari",
183
+ ".aki",
184
+ ".iso",
185
+ ".ploop",
186
+ ".img"
187
+ ], re = N.join(", "), ie = (e) => {
188
+ let { name: t, value: n, type: r, checked: i } = e.target;
189
+ y((e) => ({
190
+ ...e,
191
+ [t]: r === "checkbox" ? i : n
192
+ })), T[t] && E((e) => {
193
+ let n = { ...e };
194
+ return delete n[t], n;
195
+ });
196
+ }, ae = (e) => {
197
+ let { name: t, value: n } = e.target;
198
+ t === "name" && (!n || n.trim() === "") && E((e) => ({
199
+ ...e,
200
+ name: f._({ id: "wyIOMP" })
201
+ }));
202
+ }, P = (e, t) => {
203
+ if (e === "disk_format") {
204
+ let e = t, n = Ge(e);
205
+ y((t) => ({
206
+ ...t,
207
+ disk_format: e,
208
+ container_format: n
209
+ }));
210
+ } else y((n) => ({
211
+ ...n,
212
+ [e]: t
213
+ }));
214
+ T[e] && E((t) => {
215
+ let n = { ...t };
216
+ return delete n[e], n;
217
+ });
218
+ }, oe = (e, t) => {
219
+ let n = t === "" ? 0 : parseInt(t, 10);
220
+ isNaN(n) || (y((t) => ({
221
+ ...t,
222
+ [e]: n
223
+ })), T[e] && E((t) => {
224
+ let n = { ...t };
225
+ return delete n[e], n;
226
+ }));
227
+ }, I = (e, t) => {
228
+ t < 0 && (e === "min_disk" ? E((e) => ({
229
+ ...e,
230
+ min_disk: f._({ id: "K3bUTE" })
231
+ })) : e === "min_ram" && E((e) => ({
232
+ ...e,
233
+ min_ram: f._({ id: "PEGvy+" })
234
+ })));
235
+ }, L = (e) => {
236
+ let t = e.name.toLowerCase();
237
+ N.some((e) => t.endsWith(e)) ? (w(e), T.file && E((e) => {
238
+ let t = { ...e };
239
+ return delete t.file, t;
240
+ })) : E((e) => ({
241
+ ...e,
242
+ file: f._({
243
+ id: "qzIZOL",
244
+ values: { supportedFileFormats: re }
245
+ })
246
+ }));
247
+ }, z = (e) => {
248
+ let t = e.target.files?.[0];
249
+ t && L(t);
250
+ }, B = (e) => {
251
+ e.preventDefault(), e.stopPropagation(), k(!0);
252
+ }, se = (e) => {
253
+ e.preventDefault(), e.stopPropagation(), k(!1);
254
+ }, ce = (e) => {
255
+ e.preventDefault(), e.stopPropagation(), k(!1);
256
+ let t = e.dataTransfer.files;
257
+ t && t.length > 0 && L(t[0]);
258
+ }, le = (e) => {
259
+ x(e.target.value);
260
+ }, ue = () => {
261
+ let e = ee.trim();
262
+ if (e !== "") {
263
+ if (h.tags.includes(e)) {
264
+ x("");
265
+ return;
266
+ }
267
+ y((t) => ({
268
+ ...t,
269
+ tags: [...t.tags, e]
270
+ })), x("");
271
+ }
272
+ }, V = (e) => {
273
+ e.key === "Enter" && (e.preventDefault(), ue());
274
+ }, H = (e) => {
275
+ y((t) => ({
276
+ ...t,
277
+ tags: t.tags.filter((t) => t !== e)
278
+ }));
279
+ }, U = () => {
280
+ let e = {};
281
+ return (!h.name || h.name.trim() === "") && (e.name = f._({ id: "wyIOMP" })), C || (e.file = f._({ id: "aTqCTq" })), (!h.disk_format || h.disk_format.trim() === "") && (e.disk_format = f._({ id: "LK0pQN" })), (!h.container_format || h.container_format.trim() === "") && (e.container_format = f._({ id: "J4DKSM" })), h.disk_format && h.container_format && (Ke(h.disk_format, h.container_format) || (e.container_format = f._({ id: "BgMp/T" }))), h.min_disk < 0 && (e.min_disk = f._({ id: "K3bUTE" })), h.min_ram < 0 && (e.min_ram = f._({ id: "PEGvy+" })), E(e), Object.keys(e).length === 0;
282
+ }, de = async (e) => {
283
+ if (e.preventDefault(), j(null), !U()) {
284
+ j(f._({ id: "CBFSfX" }));
285
+ return;
286
+ }
287
+ try {
288
+ await i({
289
+ name: h.name.trim(),
290
+ tags: h.tags,
291
+ visibility: h.visibility,
292
+ disk_format: h.disk_format,
293
+ container_format: h.container_format,
294
+ protected: h.protected,
295
+ min_disk: h.min_disk,
296
+ min_ram: h.min_ram
297
+ }, C), W();
298
+ } catch (e) {
299
+ let t = e instanceof Error ? e.message : f._({ id: "TQn3hH" });
300
+ j(t);
301
+ }
302
+ }, W = () => {
303
+ y({ ...qe }), x(""), w(null), E({}), j(null), t();
304
+ };
305
+ return /*#__PURE__*/ J(d, {
306
+ open: e,
307
+ onCancel: s ? void 0 : W,
308
+ size: "large",
309
+ title: f._({ id: "xw2UtT" }),
310
+ onConfirm: de,
311
+ confirmButtonLabel: f._({ id: "a/nTb8" }),
312
+ cancelButtonLabel: f._({ id: "dEgA5A" }),
313
+ disableConfirmButton: s || !ne,
314
+ closeable: !s,
315
+ closeOnEsc: !s,
316
+ children: [
317
+ s && !u && /*#__PURE__*/ J(a, {
318
+ distribution: "center",
319
+ alignment: "center",
320
+ className: "mt-4",
321
+ children: [
322
+ /*#__PURE__*/ q(n, { variant: "primary" }),
323
+ !c && /*#__PURE__*/ q(Q, { id: "98Fs4G" }),
324
+ c && /*#__PURE__*/ q(Q, { id: "3q1GLx" })
325
+ ]
326
+ }),
327
+ s && !!u && /*#__PURE__*/ q("div", {
328
+ className: "bg-neutral-quaternary mt-4 w-full rounded-full",
329
+ children: /*#__PURE__*/ J("div", {
330
+ className: "bg-theme-info flex h-4 items-center justify-center rounded-full p-0.5 text-center text-xs leading-none font-medium text-white",
331
+ style: { width: `${u}%` },
332
+ children: [u, "%"]
333
+ })
334
+ }),
335
+ !s && /*#__PURE__*/ J(m, {
336
+ className: "mb-6",
337
+ children: [
338
+ A && /*#__PURE__*/ q(r, {
339
+ variant: "error",
340
+ className: "mb-6",
341
+ children: A
342
+ }),
343
+ /*#__PURE__*/ q(S, {
344
+ className: "mb-6",
345
+ children: /*#__PURE__*/ q(g, { children: /*#__PURE__*/ J("div", {
346
+ className: "w-full",
347
+ children: [
348
+ /*#__PURE__*/ J("label", {
349
+ htmlFor: "image-file",
350
+ className: "mb-2 block text-sm font-medium text-gray-900",
351
+ children: [f._({ id: "UKwOYH" }), /*#__PURE__*/ q("span", {
352
+ className: "ml-1 text-red-500",
353
+ children: "*"
354
+ })]
355
+ }),
356
+ /*#__PURE__*/ q("div", {
357
+ className: "flex w-full items-center justify-center",
358
+ children: /*#__PURE__*/ J("label", {
359
+ htmlFor: "image-file",
360
+ onDragOver: B,
361
+ onDragLeave: se,
362
+ onDrop: ce,
363
+ className: O("flex h-24 w-full cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed transition-all", D ? "border-blue-500 bg-blue-50" : "border-gray-300 bg-gray-50 hover:bg-gray-100"),
364
+ children: [/*#__PURE__*/ J("div", {
365
+ className: "flex flex-col items-center justify-center pt-3 pb-3",
366
+ children: [
367
+ /*#__PURE__*/ q("svg", {
368
+ className: O("mb-1 h-6 w-6 transition-colors", D ? "text-blue-500" : "text-gray-500"),
369
+ "aria-hidden": "true",
370
+ xmlns: "http://www.w3.org/2000/svg",
371
+ fill: "none",
372
+ viewBox: "0 0 20 16",
373
+ children: /*#__PURE__*/ q("path", {
374
+ stroke: "currentColor",
375
+ strokeLinecap: "round",
376
+ strokeLinejoin: "round",
377
+ strokeWidth: "2",
378
+ d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 5.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
379
+ })
380
+ }),
381
+ /*#__PURE__*/ q("p", {
382
+ className: O("text-xs transition-colors", D ? "font-semibold text-blue-600" : "text-gray-500"),
383
+ children: D ? /*#__PURE__*/ q("span", { children: f._({ id: "vXmL4D" }) }) : /*#__PURE__*/ J(K, { children: [
384
+ /*#__PURE__*/ q("span", {
385
+ className: "font-semibold",
386
+ children: f._({ id: "gYe+hC" })
387
+ }),
388
+ " ",
389
+ f._({ id: "Np28ib" })
390
+ ] })
391
+ }),
392
+ /*#__PURE__*/ q("p", {
393
+ className: "text-xs text-gray-400",
394
+ children: f._({ id: "jBIkmi" })
395
+ })
396
+ ]
397
+ }), /*#__PURE__*/ q("input", {
398
+ id: "image-file",
399
+ type: "file",
400
+ className: "hidden",
401
+ onChange: z,
402
+ accept: re,
403
+ disabled: s
404
+ })]
405
+ })
406
+ }),
407
+ C && /*#__PURE__*/ J("div", {
408
+ className: "mt-2 flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-2 text-xs",
409
+ children: [/*#__PURE__*/ J("div", {
410
+ className: "flex items-center",
411
+ children: [/*#__PURE__*/ q("svg", {
412
+ className: "mr-2 h-4 w-4 text-green-600",
413
+ fill: "currentColor",
414
+ viewBox: "0 0 20 20",
415
+ children: /*#__PURE__*/ q("path", {
416
+ fillRule: "evenodd",
417
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",
418
+ clipRule: "evenodd"
419
+ })
420
+ }), /*#__PURE__*/ q("span", {
421
+ className: "text-gray-700",
422
+ children: C.name
423
+ })]
424
+ }), /*#__PURE__*/ q("button", {
425
+ type: "button",
426
+ onClick: () => {
427
+ w(null), T.file && E((e) => {
428
+ let t = { ...e };
429
+ return delete t.file, t;
430
+ });
431
+ },
432
+ className: "font-medium text-red-600 hover:text-red-800",
433
+ disabled: s,
434
+ children: f._({ id: "t/YqKh" })
435
+ })]
436
+ }),
437
+ T.file && /*#__PURE__*/ q("p", {
438
+ className: "text-theme-error mt-1 text-xs text-red-600",
439
+ children: T.file
440
+ })
441
+ ]
442
+ }) })
443
+ }),
444
+ /*#__PURE__*/ J(S, {
445
+ className: "mb-6",
446
+ children: [
447
+ /*#__PURE__*/ q(g, {
448
+ className: "mb-6",
449
+ children: /*#__PURE__*/ q(b, {
450
+ id: "name",
451
+ name: "name",
452
+ label: f._({ id: "ExLULX" }),
453
+ value: h.name,
454
+ onChange: ie,
455
+ onBlur: ae,
456
+ required: !0,
457
+ errortext: T.name,
458
+ placeholder: f._({ id: "PsEGri" }),
459
+ disabled: s
460
+ })
461
+ }),
462
+ /*#__PURE__*/ q(g, {
463
+ className: "mb-6",
464
+ children: /*#__PURE__*/ J("div", {
465
+ className: "w-full",
466
+ children: [/*#__PURE__*/ J(a, {
467
+ gap: "1",
468
+ direction: "horizontal",
469
+ alignment: "start",
470
+ children: [/*#__PURE__*/ q("div", {
471
+ className: "flex-1",
472
+ children: /*#__PURE__*/ q(b, {
473
+ id: "tags",
474
+ name: "tags",
475
+ label: f._({ id: "OYHzN1" }),
476
+ value: ee,
477
+ onChange: le,
478
+ onKeyDown: V,
479
+ helptext: f._({ id: "AN0DBJ" }),
480
+ placeholder: f._({ id: "tmpGvt" }),
481
+ disabled: s
482
+ })
483
+ }), /*#__PURE__*/ q(_, {
484
+ variant: "primary",
485
+ onClick: ue,
486
+ disabled: s || ee.trim() === "",
487
+ children: /*#__PURE__*/ q(Q, { id: "m16xKo" })
488
+ })]
489
+ }), h.tags.length > 0 && /*#__PURE__*/ q(a, {
490
+ gap: "1",
491
+ wrap: !0,
492
+ alignment: "center",
493
+ className: "mt-1",
494
+ children: h.tags.map((e) => /*#__PURE__*/ q(l, {
495
+ closeable: !0,
496
+ pillKey: "",
497
+ pillValue: e,
498
+ onClose: () => H(e)
499
+ }, e))
500
+ })]
501
+ })
502
+ }),
503
+ /*#__PURE__*/ q(g, {
504
+ className: "mb-6",
505
+ children: /*#__PURE__*/ J(v, {
506
+ id: "visibility",
507
+ name: "visibility",
508
+ label: f._({ id: "2q/Q7x" }),
509
+ value: h.visibility,
510
+ onChange: (e) => P("visibility", e),
511
+ disabled: s,
512
+ loading: s,
513
+ children: [
514
+ /*#__PURE__*/ q(o, {
515
+ value: R.PUBLIC,
516
+ label: f._({ id: "7d1a0d" })
517
+ }),
518
+ /*#__PURE__*/ q(o, {
519
+ value: R.PRIVATE,
520
+ label: f._({ id: "zwBp5t" })
521
+ }),
522
+ /*#__PURE__*/ q(o, {
523
+ value: R.SHARED,
524
+ label: f._({ id: "0Gd0NU" })
525
+ }),
526
+ /*#__PURE__*/ q(o, {
527
+ value: R.COMMUNITY,
528
+ label: f._({ id: "chL5IG" })
529
+ })
530
+ ]
531
+ })
532
+ }),
533
+ /*#__PURE__*/ q(g, {
534
+ className: "mb-6",
535
+ children: /*#__PURE__*/ J(a, {
536
+ direction: "horizontal",
537
+ gap: "3",
538
+ distribution: "evenly",
539
+ className: "w-full",
540
+ children: [/*#__PURE__*/ q("div", {
541
+ className: "flex-1",
542
+ children: /*#__PURE__*/ J(v, {
543
+ id: "disk_format",
544
+ name: "disk_format",
545
+ label: f._({ id: "NopYGU" }),
546
+ value: h.disk_format,
547
+ onChange: (e) => P("disk_format", e),
548
+ disabled: s,
549
+ loading: s,
550
+ required: !0,
551
+ errortext: T.disk_format,
552
+ children: [
553
+ /*#__PURE__*/ q(o, {
554
+ value: F.QCOW2,
555
+ label: "QCOW2 - QEMU Emulator"
556
+ }),
557
+ /*#__PURE__*/ q(o, {
558
+ value: F.RAW,
559
+ label: "Raw"
560
+ }),
561
+ /*#__PURE__*/ q(o, {
562
+ value: F.VMDK,
563
+ label: "VMDK - Virtual Machine Disk"
564
+ }),
565
+ /*#__PURE__*/ q(o, {
566
+ value: F.VHD,
567
+ label: "VHD - Virtual Hard Disk"
568
+ }),
569
+ /*#__PURE__*/ q(o, {
570
+ value: F.VHDX,
571
+ label: "VHDX - Virtual Hard Disk Extended"
572
+ }),
573
+ /*#__PURE__*/ q(o, {
574
+ value: F.VDI,
575
+ label: "VDI - Virtual Disk Image"
576
+ }),
577
+ /*#__PURE__*/ q(o, {
578
+ value: F.AMI,
579
+ label: "AMI - Amazon Machine Image"
580
+ }),
581
+ /*#__PURE__*/ q(o, {
582
+ value: F.ARI,
583
+ label: "ARI - Amazon Ramdisk Image"
584
+ }),
585
+ /*#__PURE__*/ q(o, {
586
+ value: F.AKI,
587
+ label: "AKI - Amazon Kernel Image"
588
+ }),
589
+ /*#__PURE__*/ q(o, {
590
+ value: F.ISO,
591
+ label: "ISO - Optical Disk Image"
592
+ }),
593
+ /*#__PURE__*/ q(o, {
594
+ value: F.PLOOP,
595
+ label: "PLOOP - Virtuozzo/Parallels Loopback Disk"
596
+ })
597
+ ]
598
+ })
599
+ }), /*#__PURE__*/ q("div", {
600
+ className: "flex-1",
601
+ children: /*#__PURE__*/ q(v, {
602
+ id: "container_format",
603
+ name: "container_format",
604
+ label: f._({ id: "6/xipy" }),
605
+ value: h.container_format,
606
+ onChange: (e) => P("container_format", e),
607
+ disabled: s || !h.disk_format || !M.length,
608
+ required: !0,
609
+ errortext: T.container_format,
610
+ helptext: !M.length && f._({ id: "A7CVME" }),
611
+ children: M.map((e) => /*#__PURE__*/ q(o, {
612
+ value: e,
613
+ label: e.toUpperCase()
614
+ }, e))
615
+ })
616
+ })]
617
+ })
618
+ }),
619
+ /*#__PURE__*/ q(g, {
620
+ className: "mb-0",
621
+ children: /*#__PURE__*/ q(te, {
622
+ id: "protected",
623
+ name: "protected",
624
+ label: f._({ id: "644xgx" }),
625
+ checked: h.protected,
626
+ onChange: ie,
627
+ helptext: f._({ id: "aV6KPH" }),
628
+ disabled: s
629
+ })
630
+ })
631
+ ]
632
+ }),
633
+ /*#__PURE__*/ q(S, {
634
+ className: "mb-6",
635
+ children: /*#__PURE__*/ q(g, {
636
+ className: "mb-0",
637
+ children: /*#__PURE__*/ J(a, {
638
+ direction: "horizontal",
639
+ gap: "3",
640
+ distribution: "evenly",
641
+ className: "w-full",
642
+ children: [/*#__PURE__*/ q("div", {
643
+ className: "flex-1",
644
+ children: /*#__PURE__*/ q(b, {
645
+ id: "min_disk",
646
+ name: "min_disk",
647
+ label: f._({ id: "NixRmA" }),
648
+ type: "number",
649
+ value: String(h.min_disk),
650
+ onChange: (e) => oe("min_disk", e.target.value),
651
+ onBlur: () => I("min_disk", h.min_disk),
652
+ helptext: f._({ id: "4fh0Wj" }),
653
+ errortext: T.min_disk,
654
+ disabled: s
655
+ })
656
+ }), /*#__PURE__*/ q("div", {
657
+ className: "flex-1",
658
+ children: /*#__PURE__*/ q(b, {
659
+ id: "min_ram",
660
+ name: "min_ram",
661
+ label: f._({ id: "CgZxr7" }),
662
+ type: "number",
663
+ value: String(h.min_ram),
664
+ onChange: (e) => oe("min_ram", e.target.value),
665
+ onBlur: () => I("min_ram", h.min_ram),
666
+ helptext: f._({ id: "KsIM0b" }),
667
+ errortext: T.min_ram,
668
+ disabled: s
669
+ })
670
+ })]
671
+ })
672
+ })
673
+ })
674
+ ]
675
+ })
676
+ ]
677
+ });
678
+ }, Ye = 20, Xe = 100, Ze = ({ deletableImages: e, protectedImages: t, isOpen: n, isLoading: r, onClose: i, onDelete: o }) => {
679
+ let { i18n: s, _: c } = $(), [l, u] = Z(null), { trackClose: f, markSubmitted: p, resetTracking: h } = ne({
680
+ isOpen: n,
681
+ actionPrefix: "compute.images.delete"
682
+ }), g = Le.object({ confirm: Le.string().refine((e) => e === "delete", { message: s._({ id: "QytzQr" }) }) }), _ = ze({
683
+ defaultValues: { confirm: "" },
684
+ validators: { onSubmit: g },
685
+ onSubmit: async () => {
686
+ l === null && !r ? (p(), o(e)) : x();
687
+ }
688
+ }), v = Be(_.store, (e) => e.isSubmitting || e.values.confirm !== "delete"), y = e.length, ee = t.length, x = () => {
689
+ f(), u(null), _.reset(), h(), i();
690
+ };
691
+ if (l !== null) {
692
+ let e = l.errors.slice(0, Xe), t = l.errors.length - e.length;
693
+ return /*#__PURE__*/ q(d, {
694
+ open: n,
695
+ onCancel: x,
696
+ title: /*#__PURE__*/ q(Q, { id: "ExvQL2" }),
697
+ size: "large",
698
+ confirmButtonLabel: s._({ id: "DPfwMq" }),
699
+ onConfirm: _.handleSubmit,
700
+ children: /*#__PURE__*/ J(a, {
701
+ direction: "vertical",
702
+ gap: "4",
703
+ children: [(() => {
704
+ let e = l.deletedCount, t = l.errorCount;
705
+ return /*#__PURE__*/ q("p", {
706
+ className: "text-theme-default",
707
+ children: /*#__PURE__*/ q(Q, {
708
+ id: "deleteResults.summary",
709
+ values: {
710
+ deletedCount: e,
711
+ errorCount: t
712
+ }
713
+ })
714
+ });
715
+ })(), l.errors.length > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
716
+ className: "text-theme-light mb-2 text-sm",
717
+ children: /*#__PURE__*/ q(Q, { id: "SDohXA" })
718
+ }), /*#__PURE__*/ q("div", {
719
+ className: "bg-theme-background-lvl-2 max-h-96 overflow-y-auto rounded p-4",
720
+ children: /*#__PURE__*/ J(a, {
721
+ direction: "vertical",
722
+ gap: "2",
723
+ children: [e.map((e) => /*#__PURE__*/ J("div", {
724
+ className: "border-theme-background-lvl-3 border-b pb-2 last:border-0 last:pb-0",
725
+ children: [/*#__PURE__*/ q("div", {
726
+ className: "overflow-x-hidden font-medium [overflow-wrap:anywhere]",
727
+ title: e.imageId,
728
+ children: e.imageId
729
+ }), e.message && /*#__PURE__*/ q("div", {
730
+ className: "text-juno-red mt-1 text-sm",
731
+ children: e.message
732
+ })]
733
+ }, e.imageId)), t > 0 && /*#__PURE__*/ q("div", {
734
+ className: "text-theme-light pt-2 text-sm",
735
+ children: /*#__PURE__*/ q(Q, {
736
+ id: "K4EkxW",
737
+ values: { hiddenErrorCount: t }
738
+ })
739
+ })]
740
+ })
741
+ })] })]
742
+ })
743
+ });
744
+ }
745
+ let C = e.slice(0, Ye), te = e.length - C.length, w = t.slice(0, Ye), T = t.length - w.length, E = r ? s._({ id: "EF2EU9" }) : y === 1 ? s._({ id: "KWa0gi" }) : s._({ id: "JtHgVz" });
746
+ return /*#__PURE__*/ q(d, {
747
+ open: n,
748
+ onCancel: x,
749
+ title: /*#__PURE__*/ q(Q, {
750
+ id: "FZc7ea",
751
+ values: { deletableCount: y }
752
+ }),
753
+ size: "large",
754
+ confirmButtonLabel: E,
755
+ confirmButtonVariant: "primary-danger",
756
+ onConfirm: _.handleSubmit,
757
+ cancelButtonLabel: s._({ id: "dEgA5A" }),
758
+ disableConfirmButton: v || r,
759
+ disableCancelButton: r,
760
+ disableCloseButton: r,
761
+ children: /*#__PURE__*/ J(a, {
762
+ direction: "vertical",
763
+ gap: "4",
764
+ children: [
765
+ /*#__PURE__*/ q("p", {
766
+ className: "text-theme-default",
767
+ children: /*#__PURE__*/ q(Q, { id: "V89FyE" })
768
+ }),
769
+ /*#__PURE__*/ J("div", {
770
+ className: "space-y-3",
771
+ children: [y > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
772
+ className: "text-sm font-semibold",
773
+ children: /*#__PURE__*/ q(Q, { id: "MJtNLd" })
774
+ }), /*#__PURE__*/ q("div", {
775
+ className: "bg-theme-background-lvl-2 mt-2 max-h-48 overflow-y-auto rounded p-3",
776
+ children: /*#__PURE__*/ J(a, {
777
+ direction: "vertical",
778
+ gap: "1",
779
+ children: [C.map((e) => /*#__PURE__*/ q("div", {
780
+ className: "text-theme-default overflow-x-hidden text-sm [overflow-wrap:anywhere]",
781
+ children: e
782
+ }, e)), te > 0 && /*#__PURE__*/ q("div", {
783
+ className: "text-theme-light pt-2 text-sm",
784
+ children: /*#__PURE__*/ q(Q, {
785
+ id: "0TREPo",
786
+ values: { hiddenDeletableCount: te }
787
+ })
788
+ })]
789
+ })
790
+ })] }), ee > 0 && /*#__PURE__*/ J("div", { children: [/*#__PURE__*/ q("p", {
791
+ className: "text-sm font-semibold",
792
+ children: /*#__PURE__*/ q(Q, { id: "8tFjKD" })
793
+ }), /*#__PURE__*/ q("div", {
794
+ className: "bg-theme-warning/10 mt-2 max-h-48 overflow-y-auto rounded border border-yellow-500/20 p-3",
795
+ children: /*#__PURE__*/ J(a, {
796
+ direction: "vertical",
797
+ gap: "1",
798
+ children: [w.map((e) => /*#__PURE__*/ q("div", {
799
+ className: "text-theme-default overflow-x-hidden text-sm [overflow-wrap:anywhere]",
800
+ children: e
801
+ }, e)), T > 0 && /*#__PURE__*/ q("div", {
802
+ className: "text-theme-light pt-2 text-sm",
803
+ children: /*#__PURE__*/ q(Q, {
804
+ id: "yZrrKY",
805
+ values: { hiddenProtectedCount: T }
806
+ })
807
+ })]
808
+ })
809
+ })] })]
810
+ }),
811
+ /*#__PURE__*/ q(m, {
812
+ className: "mb-0",
813
+ id: "delete-images-form",
814
+ onSubmit: (e) => {
815
+ e.preventDefault(), _.handleSubmit();
816
+ },
817
+ children: /*#__PURE__*/ q(S, { children: /*#__PURE__*/ q(_.Field, {
818
+ name: "confirm",
819
+ children: (e) => /*#__PURE__*/ q(b, {
820
+ label: s._({ id: "QytzQr" }),
821
+ id: e.name,
822
+ name: e.name,
823
+ value: e.state.value,
824
+ onChange: (t) => e.handleChange(t.target.value),
825
+ invalid: e.state.meta.errors.length > 0,
826
+ errortext: e.state.meta.errors.map((e) => typeof e == "string" ? e : e?.message).join(", ") || void 0,
827
+ placeholder: "delete",
828
+ autoFocus: !0,
829
+ disabled: r,
830
+ required: !0
831
+ })
832
+ }) })
833
+ })
834
+ ]
835
+ })
836
+ });
837
+ }, Qe = ({ activeImages: e, deactivatedImages: t, isOpen: r, isLoading: i, onClose: o, onDeactivate: s }) => {
838
+ let { i18n: c, _: l } = $(), u = e.length, f = t.length, p = (t) => {
839
+ t.preventDefault(), s(e);
840
+ };
841
+ return /*#__PURE__*/ J(d, {
842
+ onCancel: o,
843
+ size: "small",
844
+ title: c._({ id: "+9CXS9" }),
845
+ open: r,
846
+ onConfirm: (e) => {
847
+ p(e), o();
848
+ },
849
+ confirmButtonLabel: c._({ id: "5y3O+A" }),
850
+ cancelButtonLabel: c._({ id: "dEgA5A" }),
851
+ disableConfirmButton: i,
852
+ children: [i && /*#__PURE__*/ q(a, {
853
+ distribution: "center",
854
+ alignment: "center",
855
+ children: /*#__PURE__*/ q(n, { variant: "primary" })
856
+ }), !i && /*#__PURE__*/ J("div", {
857
+ className: "my-6",
858
+ children: [u > 0 && /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q("p", {
859
+ className: "mb-6",
860
+ children: /*#__PURE__*/ q(Q, {
861
+ id: "zm7+/D",
862
+ values: { activeCount: u },
863
+ components: { 0: /*#__PURE__*/ q("strong", {}) }
864
+ })
865
+ }), /*#__PURE__*/ J("div", {
866
+ className: "mb-6",
867
+ children: [/*#__PURE__*/ q("p", {
868
+ className: "text-sm font-semibold",
869
+ children: /*#__PURE__*/ q(Q, { id: "rD9yV1" })
870
+ }), /*#__PURE__*/ q("div", {
871
+ className: "jn:bg-theme-background-lvl-1 mt-2 max-h-24 overflow-y-auto rounded p-4",
872
+ children: /*#__PURE__*/ q("ul", {
873
+ className: "space-y-2",
874
+ children: e.map((e) => /*#__PURE__*/ q("li", {
875
+ className: "jn:text-theme-default",
876
+ children: e
877
+ }, e))
878
+ })
879
+ })]
880
+ })] }), f > 0 && /*#__PURE__*/ J("div", {
881
+ className: "mb-6",
882
+ children: [/*#__PURE__*/ q("p", {
883
+ className: "text-sm font-semibold",
884
+ children: /*#__PURE__*/ q(Q, { id: "NH2fsP" })
885
+ }), /*#__PURE__*/ q("div", {
886
+ className: "jn:bg-theme-background-lvl-1 mt-2 max-h-24 overflow-y-auto rounded p-4",
887
+ children: /*#__PURE__*/ q("ul", {
888
+ className: "space-y-2",
889
+ children: t.map((e) => /*#__PURE__*/ q("li", {
890
+ className: "jn:text-theme-default",
891
+ children: e
892
+ }, e))
893
+ })
894
+ })]
895
+ })]
896
+ })]
897
+ });
898
+ }, $e = ({ deactivatedImages: e, activeImages: t, isOpen: r, isLoading: i, onClose: o, onActivate: s }) => {
899
+ let { i18n: c, _: l } = $(), u = e.length, f = t.length;
900
+ return /*#__PURE__*/ J(d, {
901
+ onCancel: o,
902
+ size: "small",
903
+ title: c._({ id: "UdcGJu" }),
904
+ open: r,
905
+ onConfirm: (t) => {
906
+ t.preventDefault(), s(e);
907
+ },
908
+ confirmButtonLabel: c._({ id: "FQBaXG" }),
909
+ cancelButtonLabel: c._({ id: "dEgA5A" }),
910
+ disableConfirmButton: i,
911
+ children: [i && /*#__PURE__*/ q(a, {
912
+ distribution: "center",
913
+ alignment: "center",
914
+ children: /*#__PURE__*/ q(n, { variant: "primary" })
915
+ }), !i && /*#__PURE__*/ J("div", {
916
+ className: "my-6",
917
+ children: [
918
+ u > 0 && /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q("p", {
919
+ className: "mb-6",
920
+ children: /*#__PURE__*/ q(Q, {
921
+ id: "MgZyuJ",
922
+ values: { deactivatedCount: u },
923
+ components: { 0: /*#__PURE__*/ q("strong", {}) }
924
+ })
925
+ }), /*#__PURE__*/ J("div", {
926
+ className: "mb-6",
927
+ children: [/*#__PURE__*/ q("h3", {
928
+ className: "jn:text-theme-high mb-3 font-semibold",
929
+ children: /*#__PURE__*/ q(Q, {
930
+ id: "shKIZu",
931
+ values: { deactivatedCount: u }
932
+ })
933
+ }), /*#__PURE__*/ q("div", {
934
+ className: "jn:bg-theme-background-lvl-1 max-h-24 overflow-y-auto rounded p-4",
935
+ children: /*#__PURE__*/ q("ul", {
936
+ className: "space-y-2",
937
+ children: e.map((e) => /*#__PURE__*/ q("li", {
938
+ className: "jn:text-theme-default",
939
+ children: e
940
+ }, e))
941
+ })
942
+ })]
943
+ })] }),
944
+ f > 0 && /*#__PURE__*/ J("div", {
945
+ className: "mb-6",
946
+ children: [/*#__PURE__*/ q("h3", {
947
+ className: "jn:text-theme-high mb-3 font-semibold",
948
+ children: /*#__PURE__*/ q(Q, { id: "pOPvlj" })
949
+ }), /*#__PURE__*/ q("div", {
950
+ className: "jn:bg-theme-warning/10 max-h-24 overflow-y-auto rounded border border-yellow-500/20 p-4",
951
+ children: /*#__PURE__*/ q("ul", {
952
+ className: "space-y-2",
953
+ children: t.map((e) => /*#__PURE__*/ q("li", {
954
+ className: "jn:text-theme-default",
955
+ children: e
956
+ }, e))
957
+ })
958
+ })]
959
+ }),
960
+ /*#__PURE__*/ J("div", {
961
+ className: "jn:bg-theme-background-lvl-2 mb-6 rounded p-4",
962
+ children: [u > 0 && /*#__PURE__*/ J("div", {
963
+ className: "mb-2 flex justify-between",
964
+ children: [/*#__PURE__*/ q("span", {
965
+ className: "jn:text-theme-default",
966
+ children: /*#__PURE__*/ q(Q, { id: "4fvDRe" })
967
+ }), /*#__PURE__*/ q("span", {
968
+ className: "jn:text-theme-highest font-semibold",
969
+ children: u
970
+ })]
971
+ }), f > 0 && /*#__PURE__*/ J("div", {
972
+ className: "flex justify-between",
973
+ children: [/*#__PURE__*/ q("span", {
974
+ className: "jn:text-theme-default",
975
+ children: /*#__PURE__*/ q(Q, { id: "x5l/TK" })
976
+ }), /*#__PURE__*/ q("span", {
977
+ className: "jn:text-theme-warning font-semibold",
978
+ children: f
979
+ })]
980
+ })]
981
+ })
982
+ ]
983
+ })]
984
+ });
985
+ }, et = ({ isOpen: e, onClose: t, image: n, permissions: { canCreateMember: i, canDeleteMember: a } }) => {
986
+ let { i18n: o, _: s } = $(), c = A(), [l, u] = Z(null), [f, p] = Z(!1), { data: m, isLoading: h } = E.compute.listImageMembers.useQuery({
987
+ project_id: c,
988
+ imageId: n?.id || ""
989
+ }, { enabled: e && !!n?.id }), g = () => {
990
+ u(null), p(!1), t();
991
+ };
992
+ if (!e || !n) return null;
993
+ let _ = n.name || n.id;
994
+ return /*#__PURE__*/ q(d, {
995
+ onCancel: g,
996
+ title: o._({
997
+ id: "UQ7Wyv",
998
+ values: { imageName: _ }
999
+ }),
1000
+ open: e,
1001
+ size: "xl",
1002
+ children: /*#__PURE__*/ J("div", { children: [l && /*#__PURE__*/ q(r, {
1003
+ onDismiss: () => u(null),
1004
+ text: l.text,
1005
+ variant: l.type,
1006
+ className: "mb-4"
1007
+ }), /*#__PURE__*/ q(N, {
1008
+ projectId: c,
1009
+ image: n,
1010
+ imageMembers: m,
1011
+ isMembersLoading: h,
1012
+ canAdd: i,
1013
+ canRemove: a,
1014
+ isAddingMember: f,
1015
+ setIsAddingMember: p,
1016
+ setMessage: u
1017
+ })] })
1018
+ });
1019
+ };
1020
+ //#endregion
1021
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/ImageListView.tsx
1022
+ function tt({ images: e, suggestedImages: t, acceptedImages: n, permissions: r, isFetching: i, currentPage: a = 1, totalPages: o = 1, onPageChange: l, children: d, selectedImages: f, setSelectedImages: p, deleteAllModalOpen: m, setDeleteAllModalOpen: h, deactivateAllModalOpen: g, setDeactivateAllModalOpen: _, activateAllModalOpen: v, setActivateAllModalOpen: y, createModalOpen: b, setCreateModalOpen: S, deletableImages: te, protectedImages: T, activeImages: O, deactivatedImages: k, onImageUpdated: j, onImageDeleted: ne, onMemberStatusChanged: M, hasAnyBulkAction: N }) {
1023
+ let P = A(), [oe, F] = Z(!1), [R, V] = Z(!1), [G, xe] = Z(!1), [Ee, De] = Z(!1), [Oe, ke] = Z(!1), [Ae, je] = Z(!1), [Y, X] = Z(null), [Me, Ne] = Z(!1), [Pe, Fe] = Z(null), [Le, Re] = Z(!1), { i18n: ze, _: Be } = $(), He = E.useUtils(), Ue = E.compute.deleteImage.useMutation(), We = E.compute.deactivateImage.useMutation({ onSuccess: () => {
1024
+ He.compute.getImageById.invalidate();
1025
+ } }), Ge = E.compute.reactivateImage.useMutation({ onSuccess: () => {
1026
+ He.compute.getImageById.invalidate();
1027
+ } }), Ke = E.compute.deleteImages.useMutation({ onSuccess: () => {
1028
+ p([]);
1029
+ } }), qe = E.compute.activateImages.useMutation({ onSuccess: () => {
1030
+ p([]);
1031
+ } }), Ye = E.compute.deactivateImages.useMutation({ onSuccess: () => {
1032
+ p([]);
1033
+ } }), Xe = E.compute.updateImage.useMutation({ onSuccess: (e) => {
1034
+ He.compute.getImageById.setData({
1035
+ project_id: P,
1036
+ imageId: e.id
1037
+ }, e);
1038
+ } }), tt = E.compute.createImage.useMutation(), nt = E.compute.updateImageVisibility.useMutation(), { data: rt } = E.compute.watchUploadProgress.useSubscription({
1039
+ project_id: P,
1040
+ uploadId: Pe || ""
1041
+ }, { enabled: !!Pe && Le }), it = Ue.isPending || We.isPending || Ge.isPending || Ke.isPending || qe.isPending || Ye.isPending || Xe.isPending, at = async (e, t, n) => {
1042
+ try {
1043
+ j(await nt.mutateAsync({
1044
+ project_id: P,
1045
+ imageId: e,
1046
+ visibility: t
1047
+ }));
1048
+ let { message: r, ...i } = Ce(n, t);
1049
+ x.success(r, i);
1050
+ } catch (e) {
1051
+ let r = e?.message || ze._({
1052
+ id: "J9cmxx",
1053
+ values: { newVisibility: t }
1054
+ }), { message: i, ...a } = re(n, r);
1055
+ x.error(i, a);
1056
+ }
1057
+ }, ot = (e, t) => {
1058
+ let n = [];
1059
+ return Object.entries(e).forEach(([e, r]) => {
1060
+ let i = `/${e}`;
1061
+ r == null ? e in t && n.push({
1062
+ op: "remove",
1063
+ path: i
1064
+ }) : e in t ? n.push({
1065
+ op: "replace",
1066
+ path: i,
1067
+ value: r
1068
+ }) : n.push({
1069
+ op: "add",
1070
+ path: i,
1071
+ value: r
1072
+ });
1073
+ }), n;
1074
+ }, st = async (e) => {
1075
+ if (!Y) return !1;
1076
+ let t = Y.id, n = e.name || Y.name || t;
1077
+ try {
1078
+ let r = ot(e, Y), i = await Xe.mutateAsync({
1079
+ project_id: P,
1080
+ imageId: t,
1081
+ operations: r
1082
+ });
1083
+ F(!1);
1084
+ let { message: a, ...o } = z(n);
1085
+ return x.success(a, o), X(i), j(i), !0;
1086
+ } catch (e) {
1087
+ let t = e?.message ?? "", { message: r, ...i } = we(n, t);
1088
+ return x.error(r, i), X(null), !1;
1089
+ }
1090
+ }, ct = async (e, t) => {
1091
+ let n = e.name || "Unnamed";
1092
+ try {
1093
+ Ne(!0);
1094
+ let r = await tt.mutateAsync({
1095
+ project_id: P,
1096
+ ...e
1097
+ });
1098
+ Fe(r.id), Re(!0), await D.compute.uploadImage.mutate(t, { context: { headers: {
1099
+ "x-project-id": P,
1100
+ "x-upload-id": r.id,
1101
+ "x-upload-size": String(t.size)
1102
+ } } });
1103
+ let { message: i, ...a } = de(n);
1104
+ x.success(i, a), j(r), M();
1105
+ } catch (e) {
1106
+ if (e instanceof Ie && e.data?.path === "compute.createImage") {
1107
+ let { message: t, ...r } = me(n, e.message);
1108
+ x.error(t, r);
1109
+ } else {
1110
+ let n = e?.message ?? "", { message: r, ...i } = le(t.name, n);
1111
+ x.error(r, i);
1112
+ }
1113
+ } finally {
1114
+ Ne(!1), S(!1), Re(!1), Fe(null);
1115
+ }
1116
+ }, lt = async (e) => {
1117
+ F(!1), V(!1);
1118
+ let t = e.name || e.id, n = e.id;
1119
+ try {
1120
+ await Ue.mutateAsync({
1121
+ project_id: P,
1122
+ imageId: n
1123
+ });
1124
+ let { message: e, ...r } = Te(t);
1125
+ x.success(e, r), ne(n);
1126
+ } catch (e) {
1127
+ let t = e?.message ?? "", { message: r, ...i } = Se(n, t);
1128
+ x.error(r, i);
1129
+ }
1130
+ X(null);
1131
+ }, ut = async (e) => {
1132
+ e.status === I.DEACTIVATED ? (X(e), ke(!0)) : (X(e), De(!0));
1133
+ }, dt = async (e) => {
1134
+ let t = e.name || e.id, n = e.id;
1135
+ try {
1136
+ await Ge.mutateAsync({
1137
+ project_id: P,
1138
+ imageId: n
1139
+ }), j({
1140
+ ...e,
1141
+ status: I.ACTIVE
1142
+ }), ke(!1), X(null);
1143
+ let { message: r, ...i } = H(t);
1144
+ x.success(r, i);
1145
+ } catch (e) {
1146
+ let t = e?.message ?? "", { message: r, ...i } = _e(n, t);
1147
+ x.error(r, i);
1148
+ }
1149
+ }, ft = async (e) => {
1150
+ let t = e.name || e.id, n = e.id;
1151
+ try {
1152
+ await We.mutateAsync({
1153
+ project_id: P,
1154
+ imageId: n
1155
+ }), j({
1156
+ ...e,
1157
+ status: I.DEACTIVATED
1158
+ }), De(!1), X(null);
1159
+ let { message: r, ...i } = U(t);
1160
+ x.success(r, i);
1161
+ } catch (e) {
1162
+ let t = e?.message ?? "", { message: r, ...i } = se(n, t);
1163
+ x.error(r, i);
1164
+ }
1165
+ }, pt = (e) => {
1166
+ X(e), F(!0);
1167
+ }, mt = (e) => {
1168
+ X(e), V(!0);
1169
+ }, ht = (e) => {
1170
+ X(e), xe(!0);
1171
+ }, gt = (e) => {
1172
+ X(e), je(!0);
1173
+ }, _t = () => {
1174
+ X(null), F(!1);
1175
+ }, vt = () => {
1176
+ X(null), V(!1);
1177
+ }, yt = () => {
1178
+ X(null), xe(!1);
1179
+ }, bt = () => {
1180
+ X(null), De(!1);
1181
+ }, xt = () => {
1182
+ X(null), ke(!1);
1183
+ }, St = () => {
1184
+ X(null), je(!1);
1185
+ }, Ct = async (e) => {
1186
+ h(!1);
1187
+ try {
1188
+ let t = await Ke.mutateAsync({
1189
+ project_id: P,
1190
+ imageIds: e
1191
+ }), n = t.successful.length, r = t.failed.length, i = e.length;
1192
+ if (r === 0) {
1193
+ let { message: e, ...t } = pe(n, i);
1194
+ x.success(e, t);
1195
+ } else if (n === 0) {
1196
+ let { message: e, ...t } = ye(r, i);
1197
+ x.error(e, t);
1198
+ } else {
1199
+ let { message: e, ...t } = ue(n, r);
1200
+ x.warning(e, t);
1201
+ }
1202
+ t.successful.length > 0 && ne(t.successful);
1203
+ } catch (t) {
1204
+ let n = t?.message ?? "";
1205
+ console.log("Bulk delete error: ", n);
1206
+ let { message: r, ...i } = ye(e.length, e.length);
1207
+ x.error(r, i);
1208
+ }
1209
+ }, wt = async (t) => {
1210
+ y(!1);
1211
+ try {
1212
+ let n = await qe.mutateAsync({
1213
+ project_id: P,
1214
+ imageIds: t
1215
+ }), r = n.successful.length, i = n.failed.length, a = t.length;
1216
+ if (n.successful.forEach((t) => {
1217
+ let n = e.find((e) => e.id === t);
1218
+ n && j({
1219
+ ...n,
1220
+ status: I.ACTIVE
1221
+ });
1222
+ }), i === 0) {
1223
+ let { message: e, ...t } = ve(r, a);
1224
+ x.success(e, t);
1225
+ } else if (r === 0) {
1226
+ let { message: e, ...t } = be(i, a);
1227
+ x.error(e, t);
1228
+ } else {
1229
+ let { message: e, ...t } = he(r, i);
1230
+ x.warning(e, t);
1231
+ }
1232
+ } catch (e) {
1233
+ let n = e?.message ?? "";
1234
+ console.log("Bulk activate error: ", n);
1235
+ let { message: r, ...i } = be(t.length, t.length);
1236
+ x.error(r, i);
1237
+ }
1238
+ }, Tt = async (t) => {
1239
+ _(!1);
1240
+ try {
1241
+ let n = await Ye.mutateAsync({
1242
+ project_id: P,
1243
+ imageIds: t
1244
+ }), r = n.successful.length, i = n.failed.length, a = t.length;
1245
+ if (n.successful.forEach((t) => {
1246
+ let n = e.find((e) => e.id === t);
1247
+ n && j({
1248
+ ...n,
1249
+ status: I.DEACTIVATED
1250
+ });
1251
+ }), i === 0) {
1252
+ let { message: e, ...t } = ge(r, a);
1253
+ x.success(e, t);
1254
+ } else if (r === 0) {
1255
+ let { message: e, ...t } = W(i, a);
1256
+ x.error(e, t);
1257
+ } else {
1258
+ let { message: e, ...t } = ce(r, i);
1259
+ x.warning(e, t);
1260
+ }
1261
+ } catch (e) {
1262
+ let n = e?.message ?? "";
1263
+ console.log("Bulk deactivate error: ", n);
1264
+ let { message: r, ...i } = W(t.length, t.length);
1265
+ x.error(r, i);
1266
+ }
1267
+ }, Et = (e) => {
1268
+ e >= 1 && e <= o && l?.(e);
1269
+ };
1270
+ return it ? /*#__PURE__*/ q("div", {
1271
+ "data-testid": "loading",
1272
+ children: /*#__PURE__*/ q(c, { children: /*#__PURE__*/ q(w, {
1273
+ colSpan: 3,
1274
+ children: /*#__PURE__*/ q(C, {
1275
+ status: "progress",
1276
+ title: ze._({ id: "Z3FXyt" })
1277
+ })
1278
+ }) })
1279
+ }) : /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q(K, { children: d }), /*#__PURE__*/ J("div", {
1280
+ className: "relative",
1281
+ children: [
1282
+ i && /*#__PURE__*/ q("div", {
1283
+ className: "bg-theme-background-lvl-0/50 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",
1284
+ children: /*#__PURE__*/ q(C, {
1285
+ status: "progress",
1286
+ title: ze._({ id: "HBpi4q" })
1287
+ })
1288
+ }),
1289
+ /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ J(ee, {
1290
+ columns: N ? 9 : 8,
1291
+ minContentColumns: N ? [0, 8] : [7],
1292
+ className: "images",
1293
+ "data-testid": "images-table",
1294
+ children: [/*#__PURE__*/ J(c, { children: [
1295
+ N && /*#__PURE__*/ q(s, {}),
1296
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "uAQUqI" }) }),
1297
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "ExLULX" }) }),
1298
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "2q/Q7x" }) }),
1299
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "644xgx" }) }),
1300
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "Cj2Gtd" }) }),
1301
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "NopYGU" }) }),
1302
+ /*#__PURE__*/ q(s, { children: /*#__PURE__*/ q(Q, { id: "d+F6q9" }) }),
1303
+ /*#__PURE__*/ q(s, {})
1304
+ ] }), e.length > 0 ? e.map((e) => /*#__PURE__*/ q(Ve, {
1305
+ image: e,
1306
+ isSelected: f.includes(e.id),
1307
+ isPending: !!t.find(({ id: t }) => t === e.id),
1308
+ isAccepted: !!n.find(({ id: t }) => t === e.id),
1309
+ permissions: r,
1310
+ onEditDetails: pt,
1311
+ onEditMetadata: mt,
1312
+ onDelete: ht,
1313
+ onManageAccess: gt,
1314
+ showSelectColumn: N,
1315
+ onSelect: (e) => {
1316
+ if (f.includes(e.id)) return p(f.filter((t) => t !== e.id));
1317
+ p([...f, e.id]);
1318
+ },
1319
+ onActivationStatusChange: ut,
1320
+ onUpdateVisibility: at,
1321
+ uploadId: Pe,
1322
+ uploadProgressPercent: rt?.percent,
1323
+ onMemberStatusChanged: M
1324
+ }, e.id)) : /*#__PURE__*/ q(c, { children: /*#__PURE__*/ q(w, {
1325
+ colSpan: N ? 9 : 8,
1326
+ children: /*#__PURE__*/ q(C, {
1327
+ status: "empty",
1328
+ title: ze._({ id: "eYlnXt" }),
1329
+ body: ze._({ id: "qvF2D8" })
1330
+ })
1331
+ }) })]
1332
+ }), o > 1 && /*#__PURE__*/ q("div", {
1333
+ className: "flex justify-center py-4",
1334
+ children: /*#__PURE__*/ q(u, {
1335
+ variant: "input",
1336
+ currentPage: a,
1337
+ pages: o,
1338
+ onPressPrevious: () => Et(Math.max(a - 1, 1)),
1339
+ onPressNext: () => Et(Math.min(a + 1, o)),
1340
+ onSelectChange: (e) => {
1341
+ Et(e);
1342
+ },
1343
+ onInputChange: () => {},
1344
+ onKeyDown: (e) => {
1345
+ if (e.key === "Enter") {
1346
+ let t = e.target.value;
1347
+ if (t !== "") {
1348
+ let e = parseInt(t, 10);
1349
+ !isNaN(e) && e >= 1 && e <= o && Et(e);
1350
+ }
1351
+ }
1352
+ }
1353
+ })
1354
+ })] }),
1355
+ Y && /*#__PURE__*/ J(K, { children: [
1356
+ /*#__PURE__*/ q(fe, {
1357
+ isOpen: oe,
1358
+ onClose: _t,
1359
+ image: Y,
1360
+ onSave: st,
1361
+ isLoading: Xe.isPending
1362
+ }),
1363
+ /*#__PURE__*/ q(L, {
1364
+ isOpen: R,
1365
+ onClose: vt,
1366
+ image: Y,
1367
+ onSave: st,
1368
+ isLoading: Xe.isPending
1369
+ }),
1370
+ /*#__PURE__*/ q(ie, {
1371
+ image: Y,
1372
+ isOpen: G,
1373
+ isLoading: it,
1374
+ isDisabled: Y.protected || !r.canDelete,
1375
+ onClose: yt,
1376
+ onDelete: lt
1377
+ }),
1378
+ /*#__PURE__*/ q(B, {
1379
+ image: Y,
1380
+ isOpen: Ee,
1381
+ isLoading: We.isPending,
1382
+ onClose: bt,
1383
+ onDeactivate: ft
1384
+ }),
1385
+ /*#__PURE__*/ q(ae, {
1386
+ image: Y,
1387
+ isOpen: Oe,
1388
+ isLoading: Ge.isPending,
1389
+ onClose: xt,
1390
+ onActivate: dt
1391
+ }),
1392
+ /*#__PURE__*/ q(et, {
1393
+ image: Y,
1394
+ isOpen: Ae,
1395
+ onClose: St,
1396
+ permissions: r
1397
+ })
1398
+ ] }),
1399
+ /*#__PURE__*/ q(Ze, {
1400
+ isOpen: m,
1401
+ deletableImages: te,
1402
+ protectedImages: T,
1403
+ isLoading: it,
1404
+ onClose: () => h(!1),
1405
+ onDelete: Ct
1406
+ }),
1407
+ /*#__PURE__*/ q(Qe, {
1408
+ isOpen: g,
1409
+ activeImages: O,
1410
+ deactivatedImages: k,
1411
+ isLoading: it,
1412
+ onClose: () => _(!1),
1413
+ onDeactivate: Tt
1414
+ }),
1415
+ /*#__PURE__*/ q($e, {
1416
+ isOpen: v,
1417
+ deactivatedImages: k,
1418
+ activeImages: O,
1419
+ isLoading: it,
1420
+ onClose: () => y(!1),
1421
+ onActivate: wt
1422
+ }),
1423
+ /*#__PURE__*/ q(Je, {
1424
+ isOpen: b,
1425
+ onClose: () => S(!1),
1426
+ onCreate: ct,
1427
+ isLoading: tt.isPending || Le || Me,
1428
+ isUploadPending: Le && !!Pe,
1429
+ uploadProgressPercent: rt?.percent
1430
+ })
1431
+ ]
1432
+ })] });
1433
+ }
1434
+ //#endregion
1435
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/urlHelpers.ts
1436
+ var nt = (e) => {
1437
+ let t = [];
1438
+ return e.status && (e.status.startsWith("in:") ? e.status.replace("in:", "").split(",") : [e.status]).forEach((e) => {
1439
+ t.push({
1440
+ name: "status",
1441
+ value: e
1442
+ });
1443
+ }), e.visibility && t.push({
1444
+ name: "visibility",
1445
+ value: e.visibility
1446
+ }), e.disk_format && (e.disk_format.startsWith("in:") ? e.disk_format.replace("in:", "").split(",") : [e.disk_format]).forEach((e) => {
1447
+ t.push({
1448
+ name: "disk_format",
1449
+ value: e
1450
+ });
1451
+ }), e.container_format && (e.container_format.startsWith("in:") ? e.container_format.replace("in:", "").split(",") : [e.container_format]).forEach((e) => {
1452
+ t.push({
1453
+ name: "container_format",
1454
+ value: e
1455
+ });
1456
+ }), e.protected && t.push({
1457
+ name: "protected",
1458
+ value: e.protected
1459
+ }), t;
1460
+ }, rt = (e, t) => {
1461
+ let n = {};
1462
+ if (!e?.length) return n;
1463
+ let r = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
1464
+ return Object.entries(r).forEach(([e, r]) => {
1465
+ t.find((t) => t.filterName === e)?.supportsMultiValue && r.length > 1 ? n[e] = `in:${r.join(",")}` : n[e] = r[0];
1466
+ }), n;
1467
+ }, it = (e, t, n) => e.some((e) => e.name === t.name && e.value === t.value) ? e : n.find((e) => e.filterName === t.name)?.supportsMultiValue ? [...e, t] : [...e.filter((e) => e.name !== t.name), t], at = (e, t, n) => {
1468
+ let r = {
1469
+ search: n.search,
1470
+ sortBy: n.sortBy,
1471
+ sortDirection: n.sortDirection,
1472
+ memberStatus: n.memberStatus === "all" ? void 0 : n.memberStatus
1473
+ };
1474
+ if (!e?.length) return r;
1475
+ let i = e.filter((e) => !e.inactive).reduce((e, t) => (e[t.name] || (e[t.name] = []), e[t.name].push(t.value), e), {});
1476
+ return Object.entries(i).forEach(([e, n]) => {
1477
+ t.find((t) => t.filterName === e)?.supportsMultiValue && n.length > 1 ? r[e] = `in:${n.join(",")}` : r[e] = n[0];
1478
+ }), r;
1479
+ }, ot = {
1480
+ images: [],
1481
+ first: void 0,
1482
+ next: void 0,
1483
+ schema: "/v2/schemas/images",
1484
+ listError: void 0
1485
+ }, st = (e, t, n, r, i, a, o) => a.member_status && a.member_status !== "all" ? e.compute.listSharedImagesByMemberStatus.query({
1486
+ project_id: t,
1487
+ memberStatus: a.member_status,
1488
+ name: i || void 0,
1489
+ status: a.status,
1490
+ disk_format: a.disk_format,
1491
+ container_format: a.container_format,
1492
+ protected: a.protected,
1493
+ sort: `${n}:${r}`
1494
+ }).then((e) => ({
1495
+ ...ot,
1496
+ images: e
1497
+ })).catch((e) => {
1498
+ if (e instanceof Ie && e.data?.code === "FORBIDDEN") return {
1499
+ ...ot,
1500
+ listError: e.message
1501
+ };
1502
+ throw e;
1503
+ }) : e.compute.listImagesWithSearch.query({
1504
+ project_id: t,
1505
+ sort: `${n}:${r}`,
1506
+ name: i || void 0,
1507
+ ...a,
1508
+ member_status: void 0,
1509
+ marker: o
1510
+ }).then((e) => ({
1511
+ ...e,
1512
+ listError: void 0
1513
+ })).catch((e) => {
1514
+ if (e instanceof Ie && e.data?.code === "FORBIDDEN") return {
1515
+ ...ot,
1516
+ listError: e.message
1517
+ };
1518
+ throw e;
1519
+ }), ct = (e, t) => e.compute.canUser.query({
1520
+ project_id: t,
1521
+ permission: [
1522
+ "images:create",
1523
+ "images:delete",
1524
+ "images:update",
1525
+ "images:create_member",
1526
+ "images:delete_member",
1527
+ "images:update_member"
1528
+ ]
1529
+ }).then(([e, t, n, r, i, a]) => ({
1530
+ canCreate: e,
1531
+ canDelete: t,
1532
+ canUpdate: n,
1533
+ canCreateMember: r,
1534
+ canDeleteMember: i,
1535
+ canUpdateMember: a ?? !1
1536
+ }));
1537
+ //#endregion
1538
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/-components/List.tsx
1539
+ function lt(e) {
1540
+ if (e) return e.includes("?") ? new URL(e, "http://dummy.com").searchParams.get("marker") || void 0 : e;
1541
+ }
1542
+ function ut({ imagesPromise: n, imageOverrides: r, deletedImageIds: o, permissionsPromise: s, searchTerm: c, setSearchTerm: l, sortSettings: u, handleSortChange: d, filterSettings: m, handleFilterChange: g, selectedImages: v, setSelectedImages: b, createModalOpen: ee, setCreateModalOpen: x, deleteAllModalOpen: S, setDeleteAllModalOpen: C, deactivateAllModalOpen: w, setDeactivateAllModalOpen: E, activateAllModalOpen: D, setActivateAllModalOpen: O, memberStatusView: k, setMemberStatusView: A, isFetching: ne, currentPage: M, onPageChange: N, onImageUpdated: re, onImageDeleted: ie, onMemberStatusChanged: ae }) {
1543
+ let { i18n: P, _: oe } = $(), F = Ae(n), L = Ae(s), [R, z] = Z(c), B = Me(void 0);
1544
+ if (Y(() => () => clearTimeout(B.current), []), F.listError) return /*#__PURE__*/ q("p", { children: F.listError });
1545
+ let se = F.images.filter((e) => !o.has(e.id)).map((e) => r.get(e.id) ?? e), ce = !!F.next, le = F.totalCount ?? (ce ? 50 * (M + 1) : se.length), ue = Math.max(1, Math.ceil(le / 50)), V = Math.min(M, ue);
1546
+ Y(() => {
1547
+ M !== V && N(V);
1548
+ }, [
1549
+ M,
1550
+ V,
1551
+ N
1552
+ ]);
1553
+ let H = k === "pending" || k === "accepted" ? {
1554
+ ...m,
1555
+ filters: m.filters.filter((e) => e.filterName !== "visibility"),
1556
+ selectedFilters: (m.selectedFilters || []).filter((e) => e.name !== "visibility")
1557
+ } : m, U = F.totalCount === void 0 ? se.slice((V - 1) * 50, V * 50) : se, de = new Set(U.map((e) => e.id)), W = v.filter((e) => de.has(e)), G = U, fe = W.filter((e) => {
1558
+ let t = U.find((t) => t.id === e);
1559
+ return t && !t.protected;
1560
+ }), pe = W.filter((e) => {
1561
+ let t = U.find((t) => t.id === e);
1562
+ return t && t.protected;
1563
+ }), me = W.filter((e) => {
1564
+ let t = U.find((t) => t.id === e);
1565
+ return t && t.status === I.ACTIVE;
1566
+ }), he = W.filter((e) => {
1567
+ let t = U.find((t) => t.id === e);
1568
+ return t && t.status === I.DEACTIVATED;
1569
+ }), ge = !L.canDelete || W.length === 0 || U.filter((e) => W.includes(e.id)).every((e) => e.protected), _e = !L.canUpdate || W.length === 0 || U.filter((e) => W.includes(e.id)).every((e) => e.status === I.DEACTIVATED), ve = !L.canUpdate || W.length === 0 || U.filter((e) => W.includes(e.id)).every((e) => e.status === I.ACTIVE), ye = {
1570
+ items: [
1571
+ {
1572
+ label: P._({ id: "SFo0kK" }),
1573
+ value: "all"
1574
+ },
1575
+ {
1576
+ label: P._({ id: "thHAVL" }),
1577
+ value: "accepted"
1578
+ },
1579
+ {
1580
+ label: P._({ id: "E4QYe7" }),
1581
+ value: "pending"
1582
+ }
1583
+ ],
1584
+ activeItem: k,
1585
+ onActiveItemChange: (e) => A(e)
1586
+ };
1587
+ return /*#__PURE__*/ J(K, { children: [
1588
+ /*#__PURE__*/ J(a, {
1589
+ distribution: "between",
1590
+ alignment: "center",
1591
+ gap: "2",
1592
+ className: "pb-2",
1593
+ children: [/*#__PURE__*/ q(i, {
1594
+ activeItem: k,
1595
+ onActiveItemChange: ye.onActiveItemChange,
1596
+ children: ye.items.map((e) => /*#__PURE__*/ q(f, {
1597
+ label: e.label,
1598
+ value: e.value
1599
+ }, e.value))
1600
+ }), /*#__PURE__*/ J(a, {
1601
+ gap: "2",
1602
+ alignment: "center",
1603
+ children: [/*#__PURE__*/ q(j, {
1604
+ options: u.options,
1605
+ sortBy: u.sortBy,
1606
+ sortDirection: u.sortDirection ?? "desc",
1607
+ selectClassName: "min-w-40",
1608
+ onSortByChange: (e) => d({
1609
+ ...u,
1610
+ sortBy: e,
1611
+ sortDirection: u.sortDirection
1612
+ }),
1613
+ onSortDirectionChange: (e) => d({
1614
+ ...u,
1615
+ sortDirection: e
1616
+ })
1617
+ }), L.canCreate && /*#__PURE__*/ q(_, {
1618
+ onClick: () => x(!0),
1619
+ variant: "primary",
1620
+ children: /*#__PURE__*/ q(Q, { id: "a/nTb8" })
1621
+ })]
1622
+ })]
1623
+ }),
1624
+ /*#__PURE__*/ q(y, { children: /*#__PURE__*/ J(a, {
1625
+ direction: "vertical",
1626
+ gap: "2",
1627
+ children: [/*#__PURE__*/ J(a, {
1628
+ distribution: "between",
1629
+ alignment: "center",
1630
+ children: [/*#__PURE__*/ q(De, {
1631
+ filters: H.filters,
1632
+ selectClassName: "sm:min-w-40",
1633
+ comboboxClassName: "sm:min-w-40",
1634
+ onChange: (e) => {
1635
+ let t = it(H.selectedFilters || [], e, H.filters);
1636
+ t !== (H.selectedFilters || []) && g({
1637
+ ...m,
1638
+ selectedFilters: t
1639
+ });
1640
+ }
1641
+ }), /*#__PURE__*/ q(e, {
1642
+ placeholder: P._({ id: "0cl0a5" }),
1643
+ "data-testid": "searchbar",
1644
+ value: R,
1645
+ onInput: (e) => {
1646
+ let t = e.currentTarget.value;
1647
+ z(t), clearTimeout(B.current), B.current = window.setTimeout(() => l(t), 500);
1648
+ },
1649
+ onSearch: (e) => {
1650
+ clearTimeout(B.current), l(typeof e == "string" ? e : "");
1651
+ },
1652
+ onClear: () => {
1653
+ clearTimeout(B.current), z(""), l("");
1654
+ }
1655
+ })]
1656
+ }), H.selectedFilters && H.selectedFilters.length > 0 && /*#__PURE__*/ q(Ee, {
1657
+ selectedFilters: H.selectedFilters,
1658
+ onDelete: (e) => g({
1659
+ ...m,
1660
+ selectedFilters: (m.selectedFilters || []).filter((t) => t.name !== e.name || t.value !== e.value)
1661
+ }),
1662
+ onClear: () => g({
1663
+ ...m,
1664
+ selectedFilters: []
1665
+ })
1666
+ })]
1667
+ }) }),
1668
+ (L.canDelete || L.canUpdate) && /*#__PURE__*/ q(y, { children: /*#__PURE__*/ q(a, {
1669
+ distribution: "between",
1670
+ alignment: "center",
1671
+ children: /*#__PURE__*/ J(a, {
1672
+ gap: "2",
1673
+ alignment: "center",
1674
+ children: [/*#__PURE__*/ q(te, {
1675
+ checked: W.length > 0 && G.every((e) => W.includes(e.id)),
1676
+ indeterminate: W.length > 0 && !G.every((e) => W.includes(e.id)),
1677
+ onChange: () => {
1678
+ let e = G.map((e) => e.id);
1679
+ e.every((e) => W.includes(e)) ? b(W.filter((t) => !e.includes(t))) : b([.../* @__PURE__ */ new Set([...W, ...e])]);
1680
+ }
1681
+ }), /*#__PURE__*/ J(t, { children: [/*#__PURE__*/ q(p, {
1682
+ as: "div",
1683
+ children: /*#__PURE__*/ q(_, {
1684
+ size: "small",
1685
+ icon: "moreVert",
1686
+ label: P._({ id: "7L01XJ" })
1687
+ })
1688
+ }), /*#__PURE__*/ J(h, { children: [
1689
+ L.canDelete && /*#__PURE__*/ q(T, {
1690
+ disabled: ge,
1691
+ label: P._({ id: "c6b6fz" }),
1692
+ onClick: () => C(!0)
1693
+ }),
1694
+ L.canUpdate && /*#__PURE__*/ q(T, {
1695
+ disabled: _e,
1696
+ label: P._({ id: "UmQ3/m" }),
1697
+ onClick: () => E(!0)
1698
+ }),
1699
+ L.canUpdate && /*#__PURE__*/ q(T, {
1700
+ disabled: ve,
1701
+ label: P._({ id: "d/I0J3" }),
1702
+ onClick: () => O(!0)
1703
+ })
1704
+ ] })] })]
1705
+ })
1706
+ }) }),
1707
+ /*#__PURE__*/ q(tt, {
1708
+ images: G,
1709
+ suggestedImages: k === "pending" ? G : [],
1710
+ acceptedImages: k === "accepted" ? G : [],
1711
+ permissions: L,
1712
+ isFetching: ne,
1713
+ currentPage: V,
1714
+ totalPages: ue,
1715
+ onPageChange: N,
1716
+ selectedImages: v,
1717
+ setSelectedImages: b,
1718
+ deleteAllModalOpen: S,
1719
+ setDeleteAllModalOpen: C,
1720
+ deactivateAllModalOpen: w,
1721
+ setDeactivateAllModalOpen: E,
1722
+ activateAllModalOpen: D,
1723
+ setActivateAllModalOpen: O,
1724
+ createModalOpen: ee,
1725
+ setCreateModalOpen: x,
1726
+ deletableImages: fe,
1727
+ protectedImages: pe,
1728
+ activeImages: me,
1729
+ deactivatedImages: he,
1730
+ onImageUpdated: re,
1731
+ onImageDeleted: ie,
1732
+ onMemberStatusChanged: ae,
1733
+ hasAnyBulkAction: L.canDelete || L.canUpdate
1734
+ })
1735
+ ] });
1736
+ }
1737
+ var dt = ({ client: e, project: t }) => {
1738
+ let { i18n: n, _: i } = $(), a = Ne(), o = Fe({ strict: !1 }), [s, c] = Z({
1739
+ options: [
1740
+ {
1741
+ label: n._({ id: "88kg0+" }),
1742
+ value: "created_at"
1743
+ },
1744
+ {
1745
+ label: n._({ id: "Llcakz" }),
1746
+ value: "updated_at"
1747
+ },
1748
+ {
1749
+ label: n._({ id: "6YtxFj" }),
1750
+ value: "name"
1751
+ },
1752
+ {
1753
+ label: n._({ id: "Cj2Gtd" }),
1754
+ value: "size"
1755
+ },
1756
+ {
1757
+ label: n._({ id: "uAQUqI" }),
1758
+ value: "status"
1759
+ }
1760
+ ],
1761
+ sortBy: o.sortBy || "created_at",
1762
+ sortDirection: o.sortDirection || "desc"
1763
+ }), [l, u] = Z({
1764
+ filters: [
1765
+ {
1766
+ displayName: n._({ id: "uAQUqI" }),
1767
+ filterName: "status",
1768
+ values: Object.values(I),
1769
+ supportsMultiValue: !0
1770
+ },
1771
+ {
1772
+ displayName: n._({ id: "2q/Q7x" }),
1773
+ filterName: "visibility",
1774
+ values: Object.values(R),
1775
+ supportsMultiValue: !1
1776
+ },
1777
+ {
1778
+ displayName: n._({ id: "NopYGU" }),
1779
+ filterName: "disk_format",
1780
+ values: Object.values(F),
1781
+ supportsMultiValue: !0
1782
+ },
1783
+ {
1784
+ displayName: n._({ id: "6/xipy" }),
1785
+ filterName: "container_format",
1786
+ values: Object.values(G),
1787
+ supportsMultiValue: !0
1788
+ },
1789
+ {
1790
+ displayName: n._({ id: "644xgx" }),
1791
+ filterName: "protected",
1792
+ values: ["true", "false"],
1793
+ supportsMultiValue: !1
1794
+ }
1795
+ ],
1796
+ selectedFilters: nt(o)
1797
+ }), [d, f] = Z(o.search || ""), p = o.page ?? 1, [m, h] = Z([]), [g, _] = Z(!1), [v, y] = Z(!1), [b, ee] = Z(!1), [x, S] = Z(!1), te = o.memberStatus ?? "all", [w, T] = Z(!0), [E, D] = Z(/* @__PURE__ */ new Map()), [O, k] = Z(/* @__PURE__ */ new Set()), [A, j] = Z(/* @__PURE__ */ new Map([[1, void 0]])), [ne, M] = Z(() => new Promise(() => {})), [N] = Z(() => ct(e, t)), re = je((e) => {
1798
+ D((t) => new Map(t).set(e.id, e));
1799
+ }, []), ie = je((e) => {
1800
+ k((t) => {
1801
+ let n = new Set(t);
1802
+ return Array.isArray(e) ? e.forEach((e) => n.add(e)) : n.add(e), n;
1803
+ });
1804
+ }, []), ae = je(() => {
1805
+ D(/* @__PURE__ */ new Map()), T(!0);
1806
+ let n = o.memberStatus ?? "all", r = n === "all" ? void 0 : n;
1807
+ ke(() => {
1808
+ let i = n === "pending" || n === "accepted" ? (l.selectedFilters || []).filter((e) => e.name !== "visibility") : l.selectedFilters || [], a = A.get(p), o = st(e, t, s.sortBy, s.sortDirection, d, {
1809
+ ...rt(i, l.filters),
1810
+ member_status: r
1811
+ }, a);
1812
+ o.then((e) => {
1813
+ j((t) => {
1814
+ if (!e.next) return t;
1815
+ let n = p + 1;
1816
+ return t.has(n) ? t : new Map(t).set(n, lt(e.next));
1817
+ });
1818
+ }).catch(() => {}).finally(() => T(!1)), M(o);
1819
+ });
1820
+ }, [
1821
+ e,
1822
+ s,
1823
+ d,
1824
+ l,
1825
+ o.memberStatus,
1826
+ p,
1827
+ A
1828
+ ]);
1829
+ Y(() => {
1830
+ let n = nt(o), r = o.sortBy || "created_at", i = o.sortDirection || "desc", s = o.search || "", d = o.page ?? 1;
1831
+ u((e) => ({
1832
+ ...e,
1833
+ selectedFilters: n
1834
+ })), c((e) => ({
1835
+ ...e,
1836
+ sortBy: r,
1837
+ sortDirection: i
1838
+ })), f(s), h([]), D(/* @__PURE__ */ new Map()), T(!0);
1839
+ let p = o.memberStatus ?? "all", m = p === "all" ? void 0 : p;
1840
+ ke(() => {
1841
+ let o = p === "pending" || p === "accepted" ? (n || []).filter((e) => e.name !== "visibility") : n || [], c = A.get(d);
1842
+ if (!c && d > 1) {
1843
+ a({ search: (e) => ({
1844
+ ...e,
1845
+ page: void 0
1846
+ }) }), T(!1);
1847
+ return;
1848
+ }
1849
+ let u = st(e, t, r, i, s, {
1850
+ ...rt(o, l.filters),
1851
+ member_status: m
1852
+ }, c);
1853
+ u.then((e) => {
1854
+ j((t) => {
1855
+ if (!e.next) return t;
1856
+ let n = d + 1;
1857
+ return t.has(n) ? t : new Map(t).set(n, lt(e.next));
1858
+ });
1859
+ }).catch(() => {}).finally(() => T(!1)), M(u);
1860
+ });
1861
+ }, [
1862
+ o.status,
1863
+ o.visibility,
1864
+ o.disk_format,
1865
+ o.container_format,
1866
+ o.protected,
1867
+ o.sortBy,
1868
+ o.sortDirection,
1869
+ o.search,
1870
+ o.memberStatus,
1871
+ o.page
1872
+ ]);
1873
+ let P = (e) => {
1874
+ let t = {
1875
+ options: e.options,
1876
+ sortBy: e.sortBy?.toString() || "created_at",
1877
+ sortDirection: e.sortDirection || "desc"
1878
+ };
1879
+ c(t), j(/* @__PURE__ */ new Map([[1, void 0]])), a({
1880
+ search: (e) => ({
1881
+ ...e,
1882
+ sortBy: t.sortBy,
1883
+ sortDirection: t.sortDirection,
1884
+ page: void 0
1885
+ }),
1886
+ replace: !0
1887
+ });
1888
+ }, oe = (e) => {
1889
+ u(e), j(/* @__PURE__ */ new Map([[1, void 0]])), a({
1890
+ search: (t) => at(e.selectedFilters || [], e.filters, {
1891
+ search: t.search,
1892
+ sortBy: t.sortBy,
1893
+ sortDirection: t.sortDirection,
1894
+ memberStatus: t.memberStatus
1895
+ }),
1896
+ replace: !0
1897
+ });
1898
+ }, L = (e) => {
1899
+ let t = typeof e == "string" ? e : "";
1900
+ f(t), j(/* @__PURE__ */ new Map([[1, void 0]])), a({
1901
+ search: (e) => ({
1902
+ ...e,
1903
+ search: t || void 0,
1904
+ page: void 0
1905
+ }),
1906
+ replace: !0
1907
+ });
1908
+ }, z = (e) => {
1909
+ j(/* @__PURE__ */ new Map([[1, void 0]])), a({ search: (t) => ({
1910
+ sortBy: t.sortBy,
1911
+ sortDirection: t.sortDirection,
1912
+ search: t.search,
1913
+ memberStatus: e === "all" ? void 0 : e
1914
+ }) });
1915
+ }, B = je((e) => {
1916
+ a({ search: (t) => ({
1917
+ ...t,
1918
+ page: e === 1 ? void 0 : e
1919
+ }) });
1920
+ }, [a]);
1921
+ return /*#__PURE__*/ q("div", {
1922
+ className: "relative",
1923
+ children: /*#__PURE__*/ q(Re, {
1924
+ fallbackRender: ({ error: e }) => /*#__PURE__*/ q(r, {
1925
+ variant: "error",
1926
+ text: e instanceof Error ? e.message : n._({ id: "W5A0Ly" })
1927
+ }),
1928
+ children: /*#__PURE__*/ q(Oe, {
1929
+ fallback: /*#__PURE__*/ q(C, {
1930
+ status: "progress",
1931
+ title: n._({ id: "HBpi4q" })
1932
+ }),
1933
+ children: /*#__PURE__*/ q(ut, {
1934
+ imagesPromise: ne,
1935
+ imageOverrides: E,
1936
+ deletedImageIds: O,
1937
+ permissionsPromise: N,
1938
+ searchTerm: d,
1939
+ setSearchTerm: L,
1940
+ sortSettings: s,
1941
+ handleSortChange: P,
1942
+ filterSettings: l,
1943
+ handleFilterChange: oe,
1944
+ selectedImages: m,
1945
+ setSelectedImages: h,
1946
+ createModalOpen: g,
1947
+ setCreateModalOpen: _,
1948
+ deleteAllModalOpen: v,
1949
+ setDeleteAllModalOpen: y,
1950
+ deactivateAllModalOpen: b,
1951
+ setDeactivateAllModalOpen: ee,
1952
+ activateAllModalOpen: x,
1953
+ setActivateAllModalOpen: S,
1954
+ memberStatusView: te,
1955
+ setMemberStatusView: z,
1956
+ isFetching: w,
1957
+ currentPage: p,
1958
+ onPageChange: B,
1959
+ onImageUpdated: re,
1960
+ onImageDeleted: ie,
1961
+ onMemberStatusChanged: ae
1962
+ })
1963
+ })
1964
+ })
1965
+ });
1966
+ };
1967
+ //#endregion
1968
+ //#region src/client/routes/_auth/projects/$projectId/compute/images/index.tsx?tsr-split=component
1969
+ function ft() {
1970
+ let { i18n: e, _: t } = $(), { projectId: n } = k.useParams(), { trpcClient: r } = k.useRouteContext();
1971
+ if (!r) throw Error("trpcClient is not available in route context");
1972
+ return /*#__PURE__*/ J(K, { children: [/*#__PURE__*/ q(M, {
1973
+ title: e._({ id: "an5hVd" }),
1974
+ projectId: n
1975
+ }), /*#__PURE__*/ q(dt, {
1976
+ client: r,
1977
+ project: n
1978
+ })] });
1979
+ }
1980
+ //#endregion
1981
+ export { ft as component };
1982
+
1983
+ //# sourceMappingURL=images-BGQv9kKT.mjs.map