@cobaltcore-dev/aurora 0.3.1 → 0.5.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 (168) hide show
  1. package/README.md +73 -77
  2. package/dist/client/AuroraApp.d.ts +15 -0
  3. package/dist/client/{AuthProvider-D-5Jpa6F.mjs → AuthProvider-Co4d0WzB.mjs} +3 -3
  4. package/dist/client/{AuthProvider-D-5Jpa6F.mjs.map → AuthProvider-Co4d0WzB.mjs.map} +1 -1
  5. package/dist/client/{ContentHeader-BXZoN3B9.mjs → ContentHeader-xQVhO2yT.mjs} +20 -20
  6. package/dist/client/{ContentHeader-BXZoN3B9.mjs.map → ContentHeader-xQVhO2yT.mjs.map} +1 -1
  7. package/dist/client/{DeleteFlavorModal-BusYn32r.mjs → DeleteFlavorModal-CHTUZ3YV.mjs} +211 -202
  8. package/dist/client/DeleteFlavorModal-CHTUZ3YV.mjs.map +1 -0
  9. package/dist/client/{EditSecurityGroupModal-Dl6m7wUe.mjs → EditSecurityGroupModal-CWHHx2Xk.mjs} +22 -22
  10. package/dist/client/{EditSecurityGroupModal-Dl6m7wUe.mjs.map → EditSecurityGroupModal-CWHHx2Xk.mjs.map} +1 -1
  11. package/dist/client/{FiltersInput-BgNaHFBt.mjs → FiltersInput-UKJpNFdr.mjs} +11 -11
  12. package/dist/client/FiltersInput-UKJpNFdr.mjs.map +1 -0
  13. package/dist/client/{FloatingIpActionModals-By2hXR9m.mjs → FloatingIpActionModals-caXn6bYo.mjs} +54 -54
  14. package/dist/client/{FloatingIpActionModals-By2hXR9m.mjs.map → FloatingIpActionModals-caXn6bYo.mjs.map} +1 -1
  15. package/dist/client/{ImageToastNotifications-fHI8jB2j.mjs → ImageToastNotifications-BWimIzu_.mjs} +227 -227
  16. package/dist/client/{ImageToastNotifications-fHI8jB2j.mjs.map → ImageToastNotifications-BWimIzu_.mjs.map} +1 -1
  17. package/dist/client/{RouteError-pDEWC_k7.mjs → RouteError-CUj_m3gu.mjs} +6 -6
  18. package/dist/client/{RouteError-pDEWC_k7.mjs.map → RouteError-CUj_m3gu.mjs.map} +1 -1
  19. package/dist/client/{SortInput-DXWSqSny.mjs → SortInput-GQlQBlAj.mjs} +6 -6
  20. package/dist/client/{SortInput-DXWSqSny.mjs.map → SortInput-GQlQBlAj.mjs.map} +1 -1
  21. package/dist/client/{_auth-CJj1Cnbm.mjs → _auth-DXJkv9QO.mjs} +3 -3
  22. package/dist/client/{_auth-CJj1Cnbm.mjs.map → _auth-DXJkv9QO.mjs.map} +1 -1
  23. package/dist/client/_flavorId-C5dc1N_j.mjs +194 -0
  24. package/dist/client/_flavorId-C5dc1N_j.mjs.map +1 -0
  25. package/dist/client/{_flavorId-BoNcxYmF.mjs → _flavorId-sUWG0xuy.mjs} +15 -15
  26. package/dist/client/_flavorId-sUWG0xuy.mjs.map +1 -0
  27. package/dist/client/{_floatingIpId-BpUfL8Im2.mjs → _floatingIpId-COK_TBrz2.mjs} +42 -42
  28. package/dist/client/{_floatingIpId-BpUfL8Im2.mjs.map → _floatingIpId-COK_TBrz2.mjs.map} +1 -1
  29. package/dist/client/{_floatingIpId-CwHiXazi.mjs → _floatingIpId-CT4y-60o.mjs} +3 -3
  30. package/dist/client/{_floatingIpId-CwHiXazi.mjs.map → _floatingIpId-CT4y-60o.mjs.map} +1 -1
  31. package/dist/client/_imageId-n3RcnhAR.mjs +534 -0
  32. package/dist/client/_imageId-n3RcnhAR.mjs.map +1 -0
  33. package/dist/client/_pcaId-B-f_6kqs.mjs +466 -0
  34. package/dist/client/_pcaId-B-f_6kqs.mjs.map +1 -0
  35. package/dist/client/{_pcaId-D1ZEaCdp.mjs → _pcaId-ChnM_t-9.mjs} +3 -3
  36. package/dist/client/{_pcaId-D1ZEaCdp.mjs.map → _pcaId-ChnM_t-9.mjs.map} +1 -1
  37. package/dist/client/_projectId-26bw-_rm.mjs +46 -0
  38. package/dist/client/_projectId-26bw-_rm.mjs.map +1 -0
  39. package/dist/client/{_projectId-DhLpIalx.mjs → _projectId-BK9UqeYw.mjs} +14 -14
  40. package/dist/client/{_projectId-DhLpIalx.mjs.map → _projectId-BK9UqeYw.mjs.map} +1 -1
  41. package/dist/client/{_projectId-D1gGribM.mjs → _projectId-CCtpAQ8m.mjs} +79 -96
  42. package/dist/client/_projectId-CCtpAQ8m.mjs.map +1 -0
  43. package/dist/client/{_projectId-OW2xkK43.mjs → _projectId-Dhb4AyBD.mjs} +3 -3
  44. package/dist/client/{_projectId-OW2xkK43.mjs.map → _projectId-Dhb4AyBD.mjs.map} +1 -1
  45. package/dist/client/{_securityGroupId-B0llWH9A.mjs → _securityGroupId-CR1mKICQ.mjs} +3 -3
  46. package/dist/client/{_securityGroupId-B0llWH9A.mjs.map → _securityGroupId-CR1mKICQ.mjs.map} +1 -1
  47. package/dist/client/{_securityGroupId-gbUnd5Wv.mjs → _securityGroupId-DroYG6cA.mjs} +254 -255
  48. package/dist/client/{_securityGroupId-gbUnd5Wv.mjs.map → _securityGroupId-DroYG6cA.mjs.map} +1 -1
  49. package/dist/client/about-969pIiZ9.mjs +92 -0
  50. package/dist/client/{about-DCe6LsKz.mjs.map → about-969pIiZ9.mjs.map} +1 -1
  51. package/dist/client/aurora-DDzsst74.mjs +19 -0
  52. package/dist/client/{aurora-CRcxVUCo.mjs.map → aurora-DDzsst74.mjs.map} +1 -1
  53. package/dist/client/{build-BJDfnAyi.mjs → build-DracvfrJ.mjs} +5 -5
  54. package/dist/client/{build-BJDfnAyi.mjs.map → build-DracvfrJ.mjs.map} +1 -1
  55. package/dist/client/{buildFilterParams-By33pG59.mjs → buildFilterParams-DoZzMKX9.mjs} +1 -1
  56. package/dist/client/{buildFilterParams-By33pG59.mjs.map → buildFilterParams-DoZzMKX9.mjs.map} +1 -1
  57. package/dist/client/{cn-C3laVXMm.mjs → cn-DM4Cy3jv.mjs} +1 -1
  58. package/dist/client/{cn-C3laVXMm.mjs.map → cn-DM4Cy3jv.mjs.map} +1 -1
  59. package/dist/client/{constants-CAjjRTo_.mjs → constants-4lVQXort.mjs} +22 -22
  60. package/dist/client/{constants-CAjjRTo_.mjs.map → constants-4lVQXort.mjs.map} +1 -1
  61. package/dist/client/{containers-NW7RnHTI.mjs → containers-DGY2hoWw.mjs} +3 -3
  62. package/dist/client/containers-DGY2hoWw.mjs.map +1 -0
  63. package/dist/client/containers-ZMFTRaQL.mjs +3277 -0
  64. package/dist/client/containers-ZMFTRaQL.mjs.map +1 -0
  65. package/dist/client/{containers-Ca5V1EBS.mjs → containers-xfsYgRyf.mjs} +2 -2
  66. package/dist/client/containers-xfsYgRyf.mjs.map +1 -0
  67. package/dist/client/{flavors-D8oElC2K.mjs → flavors-C4GtoybP.mjs} +2 -2
  68. package/dist/client/{flavors-D8oElC2K.mjs.map → flavors-C4GtoybP.mjs.map} +1 -1
  69. package/dist/client/{flavors-qvgPSI7J.mjs → flavors-CpirO_nr.mjs} +167 -148
  70. package/dist/client/flavors-CpirO_nr.mjs.map +1 -0
  71. package/dist/client/{flavors-BXPYAFyQ.mjs → flavors-DWMZ6TuJ.mjs} +2 -2
  72. package/dist/client/{flavors-BXPYAFyQ.mjs.map → flavors-DWMZ6TuJ.mjs.map} +1 -1
  73. package/dist/client/{floatingips-Be3zLoaD.mjs → floatingips-BUf_oLRl.mjs} +74 -75
  74. package/dist/client/{floatingips-Be3zLoaD.mjs.map → floatingips-BUf_oLRl.mjs.map} +1 -1
  75. package/dist/client/{formatBytes-D6oa0wU9.mjs → formatBytes-CZv_XyCY.mjs} +1 -1
  76. package/dist/client/{formatBytes-D6oa0wU9.mjs.map → formatBytes-CZv_XyCY.mjs.map} +1 -1
  77. package/dist/client/{helpers--JWXi40U.mjs → helpers-1PpYf-fC.mjs} +1 -1
  78. package/dist/client/{helpers--JWXi40U.mjs.map → helpers-1PpYf-fC.mjs.map} +1 -1
  79. package/dist/client/hooks-dSArr2Ca.mjs +2 -0
  80. package/dist/client/images-CsonlmFx.mjs +8 -0
  81. package/dist/client/images-CsonlmFx.mjs.map +1 -0
  82. package/dist/client/{images-CCYBAphP2.mjs → images-Da1t5KPh.mjs} +509 -536
  83. package/dist/client/images-Da1t5KPh.mjs.map +1 -0
  84. package/dist/client/{images-DM9I8G0p.mjs → images-NBf2bV43.mjs} +2 -2
  85. package/dist/client/images-NBf2bV43.mjs.map +1 -0
  86. package/dist/client/{images-BiEBENaj.mjs → images-QnWf63uj.mjs} +2 -2
  87. package/dist/client/{images-BiEBENaj.mjs.map → images-QnWf63uj.mjs.map} +1 -1
  88. package/dist/client/index.js +232 -236
  89. package/dist/client/index.js.map +1 -1
  90. package/dist/client/{md-BivyCkGC.mjs → md-sBiSNVSQ.mjs} +7 -7
  91. package/dist/client/{md-BivyCkGC.mjs.map → md-sBiSNVSQ.mjs.map} +1 -1
  92. package/dist/client/{network-nbSbl0X0.mjs → network-DuZm76BZ.mjs} +2 -2
  93. package/dist/client/{network-nbSbl0X0.mjs.map → network-DuZm76BZ.mjs.map} +1 -1
  94. package/dist/client/{objects-CU5ws07o.mjs → objects-B89dYCBq.mjs} +3 -3
  95. package/dist/client/objects-B89dYCBq.mjs.map +1 -0
  96. package/dist/client/{objects-GmuIOaHd.mjs → objects-CuFLUOe1.mjs} +2 -2
  97. package/dist/client/objects-CuFLUOe1.mjs.map +1 -0
  98. package/dist/client/objects-H0NN_Sja.mjs +5460 -0
  99. package/dist/client/objects-H0NN_Sja.mjs.map +1 -0
  100. package/dist/client/{pca-x9if8xU-.mjs → pca-C-UFjicP.mjs} +51 -51
  101. package/dist/client/pca-C-UFjicP.mjs.map +1 -0
  102. package/dist/client/{pca-DSM71LhW.mjs → pca-CtU6REww.mjs} +2 -2
  103. package/dist/client/{pca-DSM71LhW.mjs.map → pca-CtU6REww.mjs.map} +1 -1
  104. package/dist/client/{projects-B6BPo2Ar.mjs → projects-C-sjd9T5.mjs} +3 -3
  105. package/dist/client/{projects-B6BPo2Ar.mjs.map → projects-C-sjd9T5.mjs.map} +1 -1
  106. package/dist/client/{projects-CnmZIB2Q.mjs → projects-DNXsDnJM.mjs} +29 -25
  107. package/dist/client/projects-DNXsDnJM.mjs.map +1 -0
  108. package/dist/client/{projects-Bt0XptpG.mjs → projects-dhnQkuvV.mjs} +2 -2
  109. package/dist/client/{projects-Bt0XptpG.mjs.map → projects-dhnQkuvV.mjs.map} +1 -1
  110. package/dist/client/{projects-BilrmHLu.mjs → projects-yiK0HGSA.mjs} +2 -2
  111. package/dist/client/{projects-BilrmHLu.mjs.map → projects-yiK0HGSA.mjs.map} +1 -1
  112. package/dist/client/{securitygroups-BdzieS7Z.mjs → securitygroups-wHdrxZXd.mjs} +72 -73
  113. package/dist/client/{securitygroups-BdzieS7Z.mjs.map → securitygroups-wHdrxZXd.mjs.map} +1 -1
  114. package/dist/client/{trpcClient-BxguzNYF.mjs → trpcClient-BzPUgiM2.mjs} +1 -1
  115. package/dist/client/{trpcClient-BxguzNYF.mjs.map → trpcClient-BzPUgiM2.mjs.map} +1 -1
  116. package/dist/client/{useErrorTranslation-TZVwIAzq.mjs → useErrorTranslation-Dc0eE8Zt.mjs} +1 -1
  117. package/dist/client/{useErrorTranslation-TZVwIAzq.mjs.map → useErrorTranslation-Dc0eE8Zt.mjs.map} +1 -1
  118. package/dist/client/useListWithFiltering-DrgUwXef.mjs +157 -0
  119. package/dist/client/useListWithFiltering-DrgUwXef.mjs.map +1 -0
  120. package/dist/client/{useModal-DxxlilRm.mjs → useModal-DCs1OJh7.mjs} +1 -1
  121. package/dist/client/{useModal-DxxlilRm.mjs.map → useModal-DCs1OJh7.mjs.map} +1 -1
  122. package/dist/client/{useProjectId-CgOTejka.mjs → useProjectId-DBc5lpoU.mjs} +1 -1
  123. package/dist/client/{useProjectId-CgOTejka.mjs.map → useProjectId-DBc5lpoU.mjs.map} +1 -1
  124. package/dist/server/index.d.ts +7 -1
  125. package/dist/server/index.js +1363 -453
  126. package/package.json +7 -7
  127. package/dist/client/DeleteFlavorModal-BusYn32r.mjs.map +0 -1
  128. package/dist/client/FiltersInput-BgNaHFBt.mjs.map +0 -1
  129. package/dist/client/ListToolbar-BvtCo8dk.mjs +0 -129
  130. package/dist/client/ListToolbar-BvtCo8dk.mjs.map +0 -1
  131. package/dist/client/_flavorId-BRonXvCo.mjs +0 -188
  132. package/dist/client/_flavorId-BRonXvCo.mjs.map +0 -1
  133. package/dist/client/_flavorId-BoNcxYmF.mjs.map +0 -1
  134. package/dist/client/_imageId-CdOOJjw0.mjs +0 -527
  135. package/dist/client/_imageId-CdOOJjw0.mjs.map +0 -1
  136. package/dist/client/_pcaId-CwlH1Kvl.mjs +0 -369
  137. package/dist/client/_pcaId-CwlH1Kvl.mjs.map +0 -1
  138. package/dist/client/_projectId-D1gGribM.mjs.map +0 -1
  139. package/dist/client/_projectId-Dj_InfSc.mjs +0 -26
  140. package/dist/client/_projectId-Dj_InfSc.mjs.map +0 -1
  141. package/dist/client/about-DCe6LsKz.mjs +0 -92
  142. package/dist/client/aurora-CRcxVUCo.mjs +0 -19
  143. package/dist/client/containers-BuXUVb1N.mjs +0 -3031
  144. package/dist/client/containers-BuXUVb1N.mjs.map +0 -1
  145. package/dist/client/containers-Ca5V1EBS.mjs.map +0 -1
  146. package/dist/client/containers-NW7RnHTI.mjs.map +0 -1
  147. package/dist/client/flavors-qvgPSI7J.mjs.map +0 -1
  148. package/dist/client/hooks-D0krAKvo.mjs +0 -2
  149. package/dist/client/images-CCYBAphP2.mjs.map +0 -1
  150. package/dist/client/images-DM9I8G0p.mjs.map +0 -1
  151. package/dist/client/objects-CU5ws07o.mjs.map +0 -1
  152. package/dist/client/objects-FXN0VWLI.mjs +0 -4760
  153. package/dist/client/objects-FXN0VWLI.mjs.map +0 -1
  154. package/dist/client/objects-GmuIOaHd.mjs.map +0 -1
  155. package/dist/client/overview-B3gdnWTG.mjs +0 -15
  156. package/dist/client/overview-B3gdnWTG.mjs.map +0 -1
  157. package/dist/client/overview-DzYBiNfD.mjs +0 -15
  158. package/dist/client/overview-DzYBiNfD.mjs.map +0 -1
  159. package/dist/client/overview-EhfPY8Je.mjs +0 -15
  160. package/dist/client/overview-EhfPY8Je.mjs.map +0 -1
  161. package/dist/client/overview-XueZI4LQ.mjs +0 -173
  162. package/dist/client/overview-XueZI4LQ.mjs.map +0 -1
  163. package/dist/client/pca-x9if8xU-.mjs.map +0 -1
  164. package/dist/client/projects-CnmZIB2Q.mjs.map +0 -1
  165. package/dist/client/useListWithFiltering-CqQbAjEe.mjs +0 -32
  166. package/dist/client/useListWithFiltering-CqQbAjEe.mjs.map +0 -1
  167. package/permission_policies/compute.yaml +0 -975
  168. package/permission_policies/image.yaml +0 -71
@@ -1,4760 +0,0 @@
1
- import { D as e, E as t, G as n, I as r, J as i, M as a, Q as o, T as s, U as c, X as l, Y as u, a as d, c as f, d as p, et as m, i as h, m as g, nt as _, ot as ee, q as v, r as y, w as b } from "./build-BJDfnAyi.mjs";
2
- import { n as x, r as S } from "./trpcClient-BxguzNYF.mjs";
3
- import { t as C } from "./cn-C3laVXMm.mjs";
4
- import { a as w, d as T, f as E, h as D, l as O, m as k, o as A, r as j, t as M, u as N } from "./md-BivyCkGC.mjs";
5
- import { t as P } from "./objects-CU5ws07o.mjs";
6
- import { t as F } from "./formatBytes-D6oa0wU9.mjs";
7
- import { t as te } from "./useProjectId-CgOTejka.mjs";
8
- import { t as I } from "./ListToolbar-BvtCo8dk.mjs";
9
- import { Fragment as L, jsx as R, jsxs as z } from "react/jsx-runtime";
10
- import { startTransition as B, useCallback as V, useEffect as H, useRef as U, useState as W } from "react";
11
- import { useNavigate as G, useParams as K } from "@tanstack/react-router";
12
- import { Trans as q, useLingui as J } from "@lingui/react";
13
- import { ErrorBoundary as Y } from "react-error-boundary";
14
- import { useVirtualizer as ne } from "@tanstack/react-virtual";
15
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/DeleteFolderModal.tsx
16
- var re = ({ isOpen: e, folder: t, onClose: n, onSuccess: r, onError: i }) => {
17
- let { i18n: a, _: s } = J(), c = te(), { containerName: l } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), u = S.useUtils(), d = U(""), f = S.storage.swift.deleteFolder.useMutation({
18
- onSuccess: (e) => {
19
- u.storage.swift.listObjects.invalidate({
20
- project_id: c,
21
- container: l
22
- }), r?.(d.current, e);
23
- },
24
- onError: (e) => {
25
- i?.(d.current, e.message);
26
- },
27
- onSettled: () => {
28
- p();
29
- }
30
- });
31
- H(() => {
32
- e || f.reset();
33
- }, [e]);
34
- let p = () => {
35
- f.reset(), n();
36
- }, m = () => {
37
- t && (d.current = t.displayName, f.mutate({
38
- project_id: c,
39
- container: l,
40
- folderPath: t.name,
41
- recursive: !0
42
- }));
43
- };
44
- if (!e || !t) return null;
45
- let h = t.displayName;
46
- return /* @__PURE__ */ R(ee, {
47
- title: /* @__PURE__ */ z("span", {
48
- className: "flex max-w-[400px] items-center gap-1",
49
- children: [/* @__PURE__ */ R("span", {
50
- className: "shrink-0",
51
- children: /* @__PURE__ */ R(q, { id: "js24f6" })
52
- }), /* @__PURE__ */ R("span", {
53
- className: "truncate font-mono",
54
- title: h,
55
- children: h
56
- })]
57
- }),
58
- open: e,
59
- onCancel: p,
60
- confirmButtonLabel: f.isPending ? a._({ id: "EF2EU9" }) : a._({ id: "cnGeoo" }),
61
- confirmButtonVariant: "primary-danger",
62
- onConfirm: m,
63
- cancelButtonLabel: a._({ id: "dEgA5A" }),
64
- size: "small",
65
- disableConfirmButton: f.isPending,
66
- children: f.isPending ? /* @__PURE__ */ z(_, {
67
- direction: "horizontal",
68
- alignment: "center",
69
- gap: "2",
70
- className: "py-4",
71
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "ao/ZJi" })]
72
- }) : /* @__PURE__ */ z(_, {
73
- direction: "vertical",
74
- gap: "4",
75
- children: [/* @__PURE__ */ R("p", {
76
- className: "text-theme-default",
77
- children: /* @__PURE__ */ R(q, {
78
- id: "hueclm",
79
- values: { folderDisplayName: h },
80
- components: { 0: /* @__PURE__ */ R("span", { className: "font-mono font-semibold" }) }
81
- })
82
- }), /* @__PURE__ */ R("p", {
83
- className: "text-theme-default",
84
- children: /* @__PURE__ */ R(q, {
85
- id: "riR9oD",
86
- components: { 0: /* @__PURE__ */ R("strong", {}) }
87
- })
88
- })]
89
- })
90
- });
91
- }, ie = ({ isOpen: e, object: t, onClose: n, onSuccess: r, onError: i }) => {
92
- let { i18n: a, _: s } = J(), c = te(), { containerName: l } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), u = S.useUtils(), [d, f] = W(!1), p = U(""), { data: m, isLoading: h, error: g } = S.storage.swift.getObjectMetadata.useQuery({
93
- project_id: c,
94
- container: l,
95
- object: t?.name ?? ""
96
- }, { enabled: e && t !== null }), v = m?.staticLargeObject === !0, y = !!m?.objectManifest, x = S.storage.swift.deleteObject.useMutation({
97
- onSuccess: () => {
98
- u.storage.swift.listObjects.invalidate({
99
- project_id: c,
100
- container: l
101
- }), r?.(p.current);
102
- },
103
- onError: (e) => {
104
- i?.(p.current, e.message);
105
- },
106
- onSettled: () => {
107
- C();
108
- }
109
- });
110
- H(() => {
111
- e || (x.reset(), f(!1));
112
- }, [e]);
113
- let C = () => {
114
- x.reset(), n();
115
- }, w = () => {
116
- t && (p.current = t.displayName, x.mutate({
117
- project_id: c,
118
- container: l,
119
- object: t.name,
120
- ...v && !d ? { multipartManifest: "delete" } : {}
121
- }));
122
- };
123
- if (!e || !t) return null;
124
- let T = t.displayName, E = h, D = x.isPending, O = g?.message ?? "";
125
- return /* @__PURE__ */ z(ee, {
126
- title: /* @__PURE__ */ z("span", {
127
- className: "flex max-w-[400px] items-center gap-1",
128
- children: [/* @__PURE__ */ R("span", {
129
- className: "shrink-0",
130
- children: /* @__PURE__ */ R(q, { id: "uAI0yI" })
131
- }), /* @__PURE__ */ R("span", {
132
- className: "truncate font-mono",
133
- title: T,
134
- children: T
135
- })]
136
- }),
137
- open: e,
138
- onCancel: C,
139
- confirmButtonLabel: D ? a._({ id: "EF2EU9" }) : a._({ id: "cnGeoo" }),
140
- confirmButtonVariant: "primary-danger",
141
- onConfirm: w,
142
- cancelButtonLabel: a._({ id: "dEgA5A" }),
143
- size: "small",
144
- disableConfirmButton: E || D || !!g,
145
- children: [g && /* @__PURE__ */ R("p", {
146
- className: "text-theme-error mb-4",
147
- children: /* @__PURE__ */ R(q, {
148
- id: "+p6nHr",
149
- values: { metadataErrorMessage: O }
150
- })
151
- }), D ? /* @__PURE__ */ z(_, {
152
- direction: "horizontal",
153
- alignment: "center",
154
- gap: "2",
155
- className: "py-4",
156
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "EF2EU9" })]
157
- }) : E ? /* @__PURE__ */ z(_, {
158
- direction: "horizontal",
159
- alignment: "center",
160
- gap: "2",
161
- className: "py-4",
162
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "lq/mBZ" })]
163
- }) : g ? null : /* @__PURE__ */ z(_, {
164
- direction: "vertical",
165
- gap: "4",
166
- children: [
167
- /* @__PURE__ */ R("p", {
168
- className: "text-theme-default",
169
- children: /* @__PURE__ */ R(q, {
170
- id: "FgWsFY",
171
- values: { displayName: T },
172
- components: { 0: /* @__PURE__ */ R("span", { className: "font-mono font-semibold" }) }
173
- })
174
- }),
175
- v && /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ R("p", {
176
- className: "text-theme-default",
177
- children: /* @__PURE__ */ R(q, {
178
- id: "bQBMTH",
179
- components: { 0: /* @__PURE__ */ R("strong", {}) }
180
- })
181
- }), /* @__PURE__ */ R(b, {
182
- label: a._({ id: "01/uUD" }),
183
- checked: d,
184
- onChange: (e) => f(e.target.checked)
185
- })] }),
186
- y && /* @__PURE__ */ R("p", {
187
- className: "text-theme-default",
188
- children: /* @__PURE__ */ R(q, {
189
- id: "qEDO1j",
190
- components: {
191
- 0: /* @__PURE__ */ R("strong", {}),
192
- 1: /* @__PURE__ */ R("strong", {})
193
- }
194
- })
195
- })
196
- ]
197
- })]
198
- });
199
- }, ae = 50, oe = ({ isOpen: e, object: t, onClose: n, onSuccess: r, onError: i }) => {
200
- let { i18n: a, _: c } = J(), l = te(), { containerName: u } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), p = S.useUtils(), m = U(""), [h, v] = W(u), [y, b] = W(""), [x, C] = W({}), [T, E] = W(""), [D, k] = W(null), [j, N] = W(!1), [P, F] = W(!0), [I, L] = W(""), [B, G] = W(""), Y = U(null), re = U(null);
201
- H(() => () => {
202
- Y.current && clearTimeout(Y.current);
203
- }, []), H(() => {
204
- e && (b(""), C((e) => {
205
- let t = { ...e };
206
- return delete t[h], t;
207
- }), E(""), k(null), N(!1), L(""), G(""));
208
- }, [e, h]), H(() => {
209
- e || (v(u), b(""), C({}), E(""), k(null), N(!1), L(""), G(""));
210
- }, [e, u]);
211
- let { data: ie, isLoading: oe } = S.storage.swift.listContainers.useQuery({ project_id: l }, { enabled: e }), { data: se, isLoading: ce } = S.storage.swift.listObjects.useQuery({
212
- project_id: l,
213
- container: h,
214
- format: "json",
215
- prefix: y || void 0
216
- }, { enabled: e && !!h }), X = qe(se ?? [], y), Z = (x[h] ?? []).filter((e) => {
217
- let t = e.startsWith(y) ? e.slice(y.length) : null;
218
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
219
- }).filter((e) => !X.some((t) => t.name === e)).map((e) => ({
220
- kind: "folder",
221
- name: e,
222
- displayName: e.slice(y.length).replace(/\/$/, "")
223
- })), Q = [
224
- ...X.filter((e) => e.kind === "folder"),
225
- ...Z,
226
- ...X.filter((e) => e.kind === "object")
227
- ], le = B.trim().length > 0 ? (ie ?? []).filter((e) => e.name.toLowerCase().includes(B.toLowerCase())) : [], ue = le.slice(0, ae), de = le.length - ue.length, fe = S.storage.swift.copyObject.useMutation({
228
- onSuccess: () => {
229
- p.storage.swift.listObjects.invalidate({
230
- project_id: l,
231
- container: h
232
- }), r?.(m.current, h, y), pe();
233
- },
234
- onError: (e) => {
235
- i?.(m.current, e.message);
236
- }
237
- }), pe = () => {
238
- fe.reset(), n();
239
- }, me = V((e) => {
240
- let t = e.target.value;
241
- L(t), Y.current && clearTimeout(Y.current), Y.current = setTimeout(() => G(t), 300);
242
- }, []), he = (e) => {
243
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
244
- t && (v(t), b(""));
245
- }, ge = (e) => {
246
- b(e), N(!1), E(""), k(null);
247
- }, _e = () => {
248
- if (!y) return;
249
- let e = y.replace(/\/$/, "").split("/");
250
- e.pop(), b(e.length > 0 ? e.join("/") + "/" : ""), N(!1), E(""), k(null);
251
- }, ve = V((e) => {
252
- let t = e.trim();
253
- if (!t) return k(a._({ id: "Fzrzfe" })), !1;
254
- if (t.includes("/")) return k(a._({ id: "Vl4XTj" })), !1;
255
- if (t !== e) return k(a._({ id: "gFKJBP" })), !1;
256
- let n = `${y}${t}/`;
257
- return Q.some((e) => e.name === n) ? (k(a._({ id: "/Qox3b" })), !1) : (k(null), !0);
258
- }, [
259
- Q,
260
- y,
261
- c
262
- ]), ye = () => {
263
- if (!ve(T)) return;
264
- let e = `${y}${T.trim()}/`;
265
- C((t) => ({
266
- ...t,
267
- [h]: [...t[h] ?? [], e]
268
- })), E(""), N(!1), k(null), b(e);
269
- }, be = (e) => {
270
- e.key === "Enter" && ye(), e.key === "Escape" && (N(!1), E(""), k(null));
271
- }, xe = () => {
272
- if (!t) return;
273
- m.current = t.displayName;
274
- let e = `/${h}/${y}${t.displayName}`;
275
- fe.mutate({
276
- project_id: l,
277
- container: u,
278
- object: t.name,
279
- destination: e,
280
- freshMetadata: !P
281
- });
282
- }, Se = Q.filter((e) => e.kind === "folder"), Ce = Q.filter((e) => e.kind === "object"), we = [...Se, ...Ce], Te = ne({
283
- count: we.length,
284
- getScrollElement: () => re.current,
285
- estimateSize: () => 32,
286
- overscan: 5
287
- });
288
- if (!e || !t) return null;
289
- let $ = t.displayName, Ee = fe.isPending, De = ce, Oe = `/${h}/${y}${$}`, ke = t.name.endsWith(t.displayName) ? t.name.slice(0, t.name.length - t.displayName.length) : "", Ae = h === u && y === ke;
290
- return /* @__PURE__ */ R(ee, {
291
- title: /* @__PURE__ */ z("span", {
292
- className: "flex max-w-[500px] items-center gap-1",
293
- children: [/* @__PURE__ */ R("span", {
294
- className: "shrink-0",
295
- children: /* @__PURE__ */ R(q, { id: "V7fN5X" })
296
- }), /* @__PURE__ */ R("span", {
297
- className: "truncate font-mono",
298
- title: $,
299
- children: $
300
- })]
301
- }),
302
- open: e,
303
- onCancel: pe,
304
- confirmButtonLabel: Ee ? a._({ id: "OvEjsP" }) : a._({ id: "he3ygx" }),
305
- onConfirm: xe,
306
- cancelButtonLabel: a._({ id: "dEgA5A" }),
307
- size: "large",
308
- disableConfirmButton: Ee || oe || Ae,
309
- children: Ee ? /* @__PURE__ */ z(_, {
310
- direction: "horizontal",
311
- alignment: "center",
312
- gap: "2",
313
- className: "py-8",
314
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "QEtDlS" })]
315
- }) : /* @__PURE__ */ z(_, {
316
- direction: "vertical",
317
- gap: "4",
318
- children: [
319
- fe.isError && (() => {
320
- let e = fe.error.message;
321
- return /* @__PURE__ */ R("p", {
322
- className: "text-theme-error text-sm",
323
- children: /* @__PURE__ */ R(q, {
324
- id: "IOkHLC",
325
- values: { errorMessage: e }
326
- })
327
- });
328
- })(),
329
- /* @__PURE__ */ R(d, {
330
- label: a._({ id: "QvqBQa" }),
331
- value: h,
332
- onChange: he,
333
- onInputChange: me,
334
- placeholder: a._({ id: "a13wDR" }),
335
- helptext: (() => {
336
- if (oe) return a._({ id: "rhaNn7" });
337
- if (I.trim().length === 0) return a._({ id: "c+fUtV" });
338
- if (de > 0) {
339
- let e = ae, t = le.length;
340
- return a._({
341
- id: "qzhUb9",
342
- values: {
343
- maxOptions: e,
344
- totalCount: t
345
- }
346
- });
347
- }
348
- })(),
349
- disabled: oe || Ee,
350
- required: !0,
351
- children: ue.map((e) => /* @__PURE__ */ R(g, {
352
- value: e.name,
353
- children: e.name
354
- }, e.name))
355
- }),
356
- /* @__PURE__ */ z("div", { children: [
357
- /* @__PURE__ */ z("div", {
358
- className: "mb-1 flex items-center justify-between",
359
- children: [/* @__PURE__ */ R("span", {
360
- className: "text-sm font-medium",
361
- children: /* @__PURE__ */ R(q, { id: "Afh/Lb" })
362
- }), /* @__PURE__ */ R(f, {
363
- size: "small",
364
- variant: "subdued",
365
- icon: "addCircle",
366
- onClick: () => {
367
- N(!0), E(""), k(null);
368
- },
369
- disabled: Ee,
370
- title: a._({ id: "mxPfpY" }),
371
- children: /* @__PURE__ */ R(q, { id: "tX5yOZ" })
372
- })]
373
- }),
374
- /* @__PURE__ */ z("div", {
375
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
376
- children: [y ? /* @__PURE__ */ z("button", {
377
- type: "button",
378
- onClick: _e,
379
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
380
- children: [/* @__PURE__ */ R(M, { size: 16 }), /* @__PURE__ */ R(q, { id: "iH8pgl" })]
381
- }) : /* @__PURE__ */ R("span", {
382
- className: "text-theme-light",
383
- children: /* @__PURE__ */ R(q, { id: "eyRsaH" })
384
- }), y && /* @__PURE__ */ z("span", {
385
- className: "text-theme-light truncate font-mono text-xs",
386
- children: ["/ ", y]
387
- })]
388
- }),
389
- /* @__PURE__ */ z("div", {
390
- ref: re,
391
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
392
- children: [De ? /* @__PURE__ */ z(_, {
393
- direction: "horizontal",
394
- alignment: "center",
395
- gap: "2",
396
- className: "py-6",
397
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "Z3FXyt" })]
398
- }) : we.length === 0 && !j ? /* @__PURE__ */ R("div", {
399
- className: "text-theme-light px-4 py-6 text-center text-sm",
400
- children: /* @__PURE__ */ R(q, { id: "vcQSZh" })
401
- }) : /* @__PURE__ */ R("div", {
402
- style: {
403
- height: `${Te.getTotalSize()}px`,
404
- position: "relative"
405
- },
406
- children: Te.getVirtualItems().map((e) => {
407
- let t = we[e.index], n = t.kind === "folder";
408
- return /* @__PURE__ */ R("div", {
409
- "data-index": e.index,
410
- ref: Te.measureElement,
411
- style: {
412
- position: "absolute",
413
- top: 0,
414
- left: 0,
415
- width: "100%",
416
- transform: `translateY(${e.start}px)`
417
- },
418
- children: n ? /* @__PURE__ */ z("button", {
419
- type: "button",
420
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
421
- onClick: () => ge(t.name),
422
- children: [/* @__PURE__ */ R(O, {
423
- size: 16,
424
- className: "text-theme-light shrink-0"
425
- }), /* @__PURE__ */ R("span", {
426
- className: "truncate",
427
- children: t.displayName
428
- })]
429
- }) : /* @__PURE__ */ z("span", {
430
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
431
- children: [/* @__PURE__ */ R(A, {
432
- size: 16,
433
- className: "shrink-0"
434
- }), /* @__PURE__ */ R("span", {
435
- className: "truncate",
436
- children: t.displayName
437
- })]
438
- })
439
- }, t.name);
440
- })
441
- }), j && /* @__PURE__ */ R("div", {
442
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
443
- children: /* @__PURE__ */ R(_, {
444
- direction: "vertical",
445
- gap: "2",
446
- children: /* @__PURE__ */ z(_, {
447
- direction: "horizontal",
448
- gap: "2",
449
- alignment: "center",
450
- children: [
451
- /* @__PURE__ */ R(w, {
452
- size: 16,
453
- className: "text-theme-light shrink-0"
454
- }),
455
- /* @__PURE__ */ R(s, {
456
- value: T,
457
- onChange: (e) => {
458
- E(e.target.value), D && k(null);
459
- },
460
- onKeyDown: be,
461
- placeholder: a._({ id: "KzUd7m" }),
462
- invalid: !!D,
463
- errortext: D ?? void 0,
464
- autoFocus: !0,
465
- className: "flex-1"
466
- }),
467
- /* @__PURE__ */ R(f, {
468
- size: "small",
469
- variant: "primary",
470
- onClick: ye,
471
- disabled: !T.trim(),
472
- children: /* @__PURE__ */ R(q, { id: "hYgDIe" })
473
- }),
474
- /* @__PURE__ */ R(f, {
475
- size: "small",
476
- variant: "subdued",
477
- onClick: () => {
478
- N(!1), E(""), k(null);
479
- },
480
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
481
- })
482
- ]
483
- })
484
- })
485
- })]
486
- })
487
- ] }),
488
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
489
- className: "text-theme-light mb-1",
490
- children: /* @__PURE__ */ R(q, { id: "Z/eWPC" })
491
- }), /* @__PURE__ */ R(s, {
492
- label: a._({ id: "Vh/Uj5" }),
493
- value: Oe,
494
- readOnly: !0,
495
- className: "font-mono"
496
- })] }),
497
- /* @__PURE__ */ z("label", {
498
- className: "flex cursor-pointer items-center gap-2",
499
- children: [/* @__PURE__ */ R("input", {
500
- type: "checkbox",
501
- checked: P,
502
- onChange: (e) => F(e.target.checked),
503
- className: "h-4 w-4"
504
- }), /* @__PURE__ */ R("span", {
505
- className: "text-sm",
506
- children: /* @__PURE__ */ R(q, { id: "mqljvE" })
507
- })]
508
- })
509
- ]
510
- })
511
- });
512
- }, se = 50, ce = ({ isOpen: e, object: t, onClose: n, onSuccess: r, onError: i }) => {
513
- let { i18n: a, _: c } = J(), l = te(), { containerName: u } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), p = S.useUtils(), m = U(""), [h, v] = W(u), [y, b] = W(""), [x, C] = W(""), [T, E] = W(null), [D, k] = W({}), [j, N] = W(""), [P, F] = W(null), [I, L] = W(!1), [B, G] = W(""), [Y, re] = W(""), ie = U(null), ae = U(null);
514
- H(() => () => {
515
- ie.current && clearTimeout(ie.current);
516
- }, []), H(() => {
517
- e && (b(""), k((e) => {
518
- let t = { ...e };
519
- return delete t[h], t;
520
- }), N(""), F(null), L(!1), G(""), re(""), E(null));
521
- }, [e, h]), H(() => {
522
- e && t && C(t.displayName);
523
- }, [e, t]), H(() => {
524
- e || (v(u), b(""), k({}), N(""), F(null), L(!1), G(""), re(""), C(""), E(null));
525
- }, [e, u]);
526
- let { data: oe, isLoading: ce } = S.storage.swift.listContainers.useQuery({ project_id: l }, { enabled: e }), { data: X, isLoading: Z } = S.storage.swift.listObjects.useQuery({
527
- project_id: l,
528
- container: h,
529
- format: "json",
530
- prefix: y || void 0
531
- }, { enabled: e && !!h }), Q = qe(X ?? [], y), le = (D[h] ?? []).filter((e) => {
532
- let t = e.startsWith(y) ? e.slice(y.length) : null;
533
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
534
- }).filter((e) => !Q.some((t) => t.name === e)).map((e) => ({
535
- kind: "folder",
536
- name: e,
537
- displayName: e.slice(y.length).replace(/\/$/, "")
538
- })), ue = [
539
- ...Q.filter((e) => e.kind === "folder"),
540
- ...le,
541
- ...Q.filter((e) => e.kind === "object")
542
- ], de = Y.trim().length > 0 ? (oe ?? []).filter((e) => e.name.toLowerCase().includes(Y.toLowerCase())) : [], fe = de.slice(0, se), pe = de.length - fe.length, me = S.storage.swift.deleteObject.useMutation({
543
- onSuccess: () => {
544
- [...new Set([u, h])].forEach((e) => p.storage.swift.listObjects.invalidate({
545
- project_id: l,
546
- container: e
547
- })), r?.(m.current, h, y);
548
- },
549
- onError: (e) => {
550
- i?.(m.current, e.message);
551
- },
552
- onSettled: () => {
553
- ge();
554
- }
555
- }), he = S.storage.swift.copyObject.useMutation({
556
- onSuccess: () => {
557
- t && me.mutate({
558
- project_id: l,
559
- container: u,
560
- object: t.name
561
- });
562
- },
563
- onError: (e) => {
564
- i?.(m.current, e.message), ge();
565
- }
566
- }), ge = () => {
567
- he.reset(), me.reset(), n();
568
- }, _e = V((e) => {
569
- let t = e.target.value;
570
- G(t), ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => re(t), 300);
571
- }, []), ve = (e) => {
572
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
573
- t && (v(t), b(""));
574
- }, ye = (e) => {
575
- b(e), L(!1), N(""), F(null);
576
- }, be = () => {
577
- if (!y) return;
578
- let e = y.replace(/\/$/, "").split("/");
579
- e.pop(), b(e.length > 0 ? e.join("/") + "/" : ""), L(!1), N(""), F(null);
580
- }, xe = V((e) => {
581
- let t = e.trim();
582
- if (!t) return F(a._({ id: "Fzrzfe" })), !1;
583
- if (t.includes("/")) return F(a._({ id: "Vl4XTj" })), !1;
584
- if (t !== e) return F(a._({ id: "gFKJBP" })), !1;
585
- let n = `${y}${t}/`;
586
- return ue.some((e) => e.name === n) ? (F(a._({ id: "/Qox3b" })), !1) : (F(null), !0);
587
- }, [
588
- ue,
589
- y,
590
- c
591
- ]), Se = V((e) => {
592
- let t = e.trim();
593
- return t ? t.includes("/") ? (E(a._({ id: "NZJhro" })), !1) : t === e ? (E(null), !0) : (E(a._({ id: "Erlvqg" })), !1) : (E(a._({ id: "MtzSbv" })), !1);
594
- }, [c]), Ce = () => {
595
- if (!xe(j)) return;
596
- let e = `${y}${j.trim()}/`;
597
- k((t) => ({
598
- ...t,
599
- [h]: [...t[h] ?? [], e]
600
- })), N(""), L(!1), F(null), b(e);
601
- }, we = (e) => {
602
- e.key === "Enter" && Ce(), e.key === "Escape" && (L(!1), N(""), F(null));
603
- }, Te = () => {
604
- if (!t || !Se(x)) return;
605
- let e = x.trim();
606
- m.current = e;
607
- let n = `/${h}/${y}${e}`;
608
- he.mutate({
609
- project_id: l,
610
- container: u,
611
- object: t.name,
612
- destination: n,
613
- freshMetadata: !1
614
- });
615
- }, $ = ue.filter((e) => e.kind === "folder"), Ee = ue.filter((e) => e.kind === "object"), De = [...$, ...Ee], Oe = ne({
616
- count: De.length,
617
- getScrollElement: () => ae.current,
618
- estimateSize: () => 32,
619
- overscan: 5
620
- });
621
- if (!e || !t) return null;
622
- let ke = he.isPending || me.isPending, Ae = Z, je = `/${h}/${y}${x.trim() || t.displayName}`, Me = t.name.endsWith(t.displayName) ? t.name.slice(0, t.name.length - t.displayName.length) : "", Ne = h === u && y === Me && x.trim() === t.displayName;
623
- return /* @__PURE__ */ R(ee, {
624
- title: /* @__PURE__ */ z("span", {
625
- className: "flex max-w-[500px] items-center gap-1",
626
- children: [/* @__PURE__ */ R("span", {
627
- className: "shrink-0",
628
- children: /* @__PURE__ */ R(q, { id: "J6EOll" })
629
- }), /* @__PURE__ */ R("span", {
630
- className: "truncate font-mono",
631
- title: t.displayName,
632
- children: t.displayName
633
- })]
634
- }),
635
- open: e,
636
- onCancel: ge,
637
- confirmButtonLabel: ke ? a._({ id: "K8Qnlj" }) : a._({ id: "QWdKwH" }),
638
- onConfirm: Te,
639
- cancelButtonLabel: a._({ id: "dEgA5A" }),
640
- size: "large",
641
- disableConfirmButton: ke || ce || Ne,
642
- children: ke ? /* @__PURE__ */ z(_, {
643
- direction: "horizontal",
644
- alignment: "center",
645
- gap: "2",
646
- className: "py-8",
647
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "1H2g6v" })]
648
- }) : /* @__PURE__ */ z(_, {
649
- direction: "vertical",
650
- gap: "4",
651
- children: [
652
- (he.isError || me.isError) && (() => {
653
- let e = he.error?.message ?? "", t = me.error?.message ?? "";
654
- return /* @__PURE__ */ R("p", {
655
- className: "text-theme-error",
656
- children: he.isError ? /* @__PURE__ */ R(q, {
657
- id: "i5MEDc",
658
- values: { copyErrorMessage: e }
659
- }) : /* @__PURE__ */ R(q, {
660
- id: "VoxR3s",
661
- values: { deleteErrorMessage: t }
662
- })
663
- });
664
- })(),
665
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
666
- className: "text-theme-light mb-1",
667
- children: /* @__PURE__ */ R(q, { id: "rAtQcX" })
668
- }), /* @__PURE__ */ R(s, {
669
- label: a._({ id: "f+Uq1E" }),
670
- value: x,
671
- onChange: (e) => {
672
- C(e.target.value), T && E(null);
673
- },
674
- invalid: !!T,
675
- errortext: T ?? void 0,
676
- required: !0
677
- })] }),
678
- /* @__PURE__ */ R(d, {
679
- label: a._({ id: "QvqBQa" }),
680
- value: h,
681
- onChange: ve,
682
- onInputChange: _e,
683
- placeholder: a._({ id: "a13wDR" }),
684
- helptext: (() => {
685
- if (ce) return a._({ id: "rhaNn7" });
686
- if (B.trim().length === 0) return a._({ id: "c+fUtV" });
687
- if (pe > 0) {
688
- let e = se, t = de.length;
689
- return a._({
690
- id: "qzhUb9",
691
- values: {
692
- maxOptions: e,
693
- totalCount: t
694
- }
695
- });
696
- }
697
- })(),
698
- disabled: ce || ke,
699
- required: !0,
700
- children: fe.map((e) => /* @__PURE__ */ R(g, {
701
- value: e.name,
702
- children: e.name
703
- }, e.name))
704
- }),
705
- /* @__PURE__ */ z("div", { children: [
706
- /* @__PURE__ */ z("div", {
707
- className: "mb-1 flex items-center justify-between",
708
- children: [/* @__PURE__ */ R("span", {
709
- className: "text-sm font-medium",
710
- children: /* @__PURE__ */ R(q, { id: "Afh/Lb" })
711
- }), /* @__PURE__ */ R(f, {
712
- size: "small",
713
- variant: "subdued",
714
- icon: "addCircle",
715
- onClick: () => {
716
- L(!0), N(""), F(null);
717
- },
718
- disabled: ke,
719
- title: a._({ id: "mxPfpY" }),
720
- children: /* @__PURE__ */ R(q, { id: "tX5yOZ" })
721
- })]
722
- }),
723
- /* @__PURE__ */ z("div", {
724
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
725
- children: [y ? /* @__PURE__ */ z("button", {
726
- type: "button",
727
- onClick: be,
728
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
729
- children: [/* @__PURE__ */ R(M, { size: 16 }), /* @__PURE__ */ R(q, { id: "iH8pgl" })]
730
- }) : /* @__PURE__ */ R("span", {
731
- className: "text-theme-light",
732
- children: /* @__PURE__ */ R(q, { id: "eyRsaH" })
733
- }), y && /* @__PURE__ */ z("span", {
734
- className: "text-theme-light truncate font-mono text-xs",
735
- children: ["/ ", y]
736
- })]
737
- }),
738
- /* @__PURE__ */ z("div", {
739
- ref: ae,
740
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
741
- children: [Ae ? /* @__PURE__ */ z(_, {
742
- direction: "horizontal",
743
- alignment: "center",
744
- gap: "2",
745
- className: "py-6",
746
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "Z3FXyt" })]
747
- }) : De.length === 0 && !I ? /* @__PURE__ */ R("div", {
748
- className: "text-theme-light px-4 py-6 text-center text-sm",
749
- children: /* @__PURE__ */ R(q, { id: "vcQSZh" })
750
- }) : /* @__PURE__ */ R("div", {
751
- style: {
752
- height: `${Oe.getTotalSize()}px`,
753
- position: "relative"
754
- },
755
- children: Oe.getVirtualItems().map((e) => {
756
- let t = De[e.index], n = t.kind === "folder";
757
- return /* @__PURE__ */ R("div", {
758
- "data-index": e.index,
759
- ref: Oe.measureElement,
760
- style: {
761
- position: "absolute",
762
- top: 0,
763
- left: 0,
764
- width: "100%",
765
- transform: `translateY(${e.start}px)`
766
- },
767
- children: n ? /* @__PURE__ */ z("button", {
768
- type: "button",
769
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
770
- onClick: () => ye(t.name),
771
- children: [/* @__PURE__ */ R(O, {
772
- size: 16,
773
- className: "text-theme-light shrink-0"
774
- }), /* @__PURE__ */ R("span", {
775
- className: "truncate",
776
- children: t.displayName
777
- })]
778
- }) : /* @__PURE__ */ z("span", {
779
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
780
- children: [/* @__PURE__ */ R(A, {
781
- size: 16,
782
- className: "shrink-0"
783
- }), /* @__PURE__ */ R("span", {
784
- className: "truncate",
785
- children: t.displayName
786
- })]
787
- })
788
- }, t.name);
789
- })
790
- }), I && /* @__PURE__ */ R("div", {
791
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
792
- children: /* @__PURE__ */ R(_, {
793
- direction: "vertical",
794
- gap: "2",
795
- children: /* @__PURE__ */ z(_, {
796
- direction: "horizontal",
797
- gap: "2",
798
- alignment: "center",
799
- children: [
800
- /* @__PURE__ */ R(w, {
801
- size: 16,
802
- className: "text-theme-light shrink-0"
803
- }),
804
- /* @__PURE__ */ R(s, {
805
- value: j,
806
- onChange: (e) => {
807
- N(e.target.value), P && F(null);
808
- },
809
- onKeyDown: we,
810
- placeholder: a._({ id: "KzUd7m" }),
811
- invalid: !!P,
812
- errortext: P ?? void 0,
813
- autoFocus: !0,
814
- className: "flex-1"
815
- }),
816
- /* @__PURE__ */ R(f, {
817
- size: "small",
818
- variant: "primary",
819
- onClick: Ce,
820
- disabled: !j.trim(),
821
- children: /* @__PURE__ */ R(q, { id: "hYgDIe" })
822
- }),
823
- /* @__PURE__ */ R(f, {
824
- size: "small",
825
- variant: "subdued",
826
- onClick: () => {
827
- L(!1), N(""), F(null);
828
- },
829
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
830
- })
831
- ]
832
- })
833
- })
834
- })]
835
- })
836
- ] }),
837
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
838
- className: "text-theme-light mb-1",
839
- children: /* @__PURE__ */ R(q, { id: "rlgAtt" })
840
- }), /* @__PURE__ */ R(s, {
841
- label: a._({ id: "Vh/Uj5" }),
842
- value: je,
843
- readOnly: !0,
844
- className: "font-mono"
845
- })] })
846
- ]
847
- })
848
- });
849
- }, X = "custom", Z = ({ isOpen: e, object: t, account: n, onClose: r, onCopySuccess: i }) => {
850
- let { i18n: a, _: c } = J(), l = te(), { containerName: u } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), d = [
851
- {
852
- labelKey: a._({ id: "vp5vfW" }),
853
- seconds: 3600
854
- },
855
- {
856
- labelKey: a._({ id: "VaA9mu" }),
857
- seconds: 86400
858
- },
859
- {
860
- labelKey: a._({ id: "rJe6vw" }),
861
- seconds: 604800
862
- }
863
- ], [f, m] = W(String(d[1].seconds)), [g, v] = W(""), [b, x] = W(null), [C, w] = W(!1), [T, E] = W(null), [D, O] = W(null), [k, A] = W(!1), [j, M] = W(null), [N, P] = W(null), F = U(""), I = U(null), L = U(0), B = (e) => {
864
- E(e.url), O(e.expiresAt), A(!1), M(null);
865
- }, V = (e) => {
866
- e.message.includes("Temp URL key not configured") ? (A(!0), M(null)) : (M(e.message), A(!1));
867
- }, G = S.storage.swift.generateTempUrl.useMutation();
868
- H(() => (e || (L.current += 1, I.current &&= (clearTimeout(I.current), null), G.reset(), E(null), O(null), m(String(d[1].seconds)), v(""), x(null), w(!1), A(!1), M(null), P(null)), () => {
869
- I.current && clearTimeout(I.current);
870
- }), [e]);
871
- let Y = () => {
872
- if (!g.trim()) return null;
873
- let e = Number(g);
874
- return Number.isInteger(e) && e > 0 ? e : null;
875
- }, ne = () => {
876
- if (f === X) {
877
- let e = Y();
878
- return e === null ? null : e * 60;
879
- }
880
- return parseInt(f, 10);
881
- }, re = () => {
882
- if (!t) return;
883
- if (f === X) {
884
- if (Y() === null) {
885
- x(a._({ id: "jSG7wx" }));
886
- return;
887
- }
888
- x(null);
889
- }
890
- let e = ne();
891
- if (e === null) return;
892
- F.current = t.displayName, E(null), O(null), w(!1);
893
- let r = ++L.current;
894
- G.mutate({
895
- project_id: l,
896
- container: u,
897
- object: t.name,
898
- method: "GET",
899
- expiresIn: e,
900
- ...n ? { account: n } : {}
901
- }, {
902
- onSuccess: (e) => {
903
- r === L.current && B(e);
904
- },
905
- onError: (e) => {
906
- r === L.current && V(e);
907
- }
908
- });
909
- }, ie = () => {
910
- T && (P(null), navigator.clipboard.writeText(T).then(() => {
911
- w(!0), i?.(F.current), I.current && clearTimeout(I.current), I.current = setTimeout(() => {
912
- I.current = null, w(!1);
913
- }, 2e3);
914
- }).catch(() => {
915
- P(a._({ id: "go0J2x" }));
916
- }));
917
- }, ae = (e) => {
918
- let t = String(d[1].seconds), n = typeof e == "string" ? e : typeof e == "number" ? String(e) : Array.isArray(e) && typeof e[0] == "string" ? e[0] : "", r = new Set([...d.map((e) => String(e.seconds)), X]), i = n && r.has(n) ? n : t;
919
- m(i), i !== X && (v(""), x(null)), E(null), O(null), w(!1), M(null), P(null), A(!1);
920
- }, oe = (e) => {
921
- v(e.target.value), b && x(null), E(null), O(null), w(!1), M(null), P(null), A(!1);
922
- };
923
- if (!e || !t) return null;
924
- let se = t.displayName, ce = G.isPending, Z = f === X, Q = D ? (/* @__PURE__ */ new Date(D * 1e3)).toLocaleString() : null, le = f === X ? g ? Y() === 1 ? a._({ id: "4mbrAq" }) : a._({
925
- id: "wbqM4L",
926
- values: { customMinutes: g }
927
- }) : null : d.find((e) => String(e.seconds) === f)?.labelKey ?? null;
928
- return /* @__PURE__ */ R(ee, {
929
- title: /* @__PURE__ */ z("span", {
930
- className: "flex max-w-[400px] items-center gap-1",
931
- children: [/* @__PURE__ */ R("span", {
932
- className: "shrink-0",
933
- children: /* @__PURE__ */ R(q, { id: "NRP2uq" })
934
- }), /* @__PURE__ */ R("span", {
935
- className: "truncate font-mono",
936
- title: se,
937
- children: se
938
- })]
939
- }),
940
- open: e,
941
- onCancel: r,
942
- confirmButtonLabel: ce ? a._({ id: "NOdFZR" }) : a._({ id: "vpt8cE" }),
943
- onConfirm: re,
944
- cancelButtonLabel: a._({ id: "yz7wBu" }),
945
- size: "small",
946
- disableConfirmButton: ce || Z && (!g.trim() || !!b),
947
- children: /* @__PURE__ */ z(_, {
948
- direction: "vertical",
949
- gap: "4",
950
- children: [
951
- /* @__PURE__ */ R("p", {
952
- className: "text-theme-default",
953
- children: /* @__PURE__ */ R(q, { id: "n2IuBI" })
954
- }),
955
- k && /* @__PURE__ */ R("p", {
956
- className: "text-theme-default",
957
- children: /* @__PURE__ */ R(q, {
958
- id: "q5sTNZ",
959
- components: {
960
- 0: /* @__PURE__ */ R("strong", {}),
961
- 1: /* @__PURE__ */ R("code", {}),
962
- 2: /* @__PURE__ */ R("code", {})
963
- }
964
- })
965
- }),
966
- j && /* @__PURE__ */ R("p", {
967
- className: "text-theme-error",
968
- role: "alert",
969
- "aria-live": "assertive",
970
- children: /* @__PURE__ */ R(q, {
971
- id: "fxnDd7",
972
- values: { generalError: j }
973
- })
974
- }),
975
- N && /* @__PURE__ */ R("p", {
976
- className: "text-theme-error",
977
- role: "alert",
978
- "aria-live": "assertive",
979
- children: N
980
- }),
981
- /* @__PURE__ */ z(y, {
982
- label: a._({ id: "i9qiyR" }),
983
- value: f,
984
- onChange: ae,
985
- disabled: ce,
986
- children: [d.map((e) => /* @__PURE__ */ R(p, {
987
- value: String(e.seconds),
988
- label: e.labelKey
989
- }, e.seconds)), /* @__PURE__ */ R(p, {
990
- value: X,
991
- label: a._({ id: "8Tg/JR" })
992
- })]
993
- }),
994
- Z && /* @__PURE__ */ R(s, {
995
- label: a._({ id: "3n+vCm" }),
996
- value: g,
997
- onChange: oe,
998
- invalid: !!b,
999
- errortext: b || void 0,
1000
- disabled: ce,
1001
- placeholder: "60",
1002
- type: "number"
1003
- }),
1004
- ce && /* @__PURE__ */ z(_, {
1005
- direction: "horizontal",
1006
- alignment: "center",
1007
- gap: "2",
1008
- className: "py-2",
1009
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "UK2mpr" })]
1010
- }),
1011
- T && /* @__PURE__ */ z(_, {
1012
- direction: "vertical",
1013
- gap: "2",
1014
- children: [/* @__PURE__ */ z("div", {
1015
- className: "relative",
1016
- children: [/* @__PURE__ */ R(s, {
1017
- label: a._({ id: "GSIPwA" }),
1018
- value: T,
1019
- readOnly: !0,
1020
- className: "pr-10 font-mono text-xs"
1021
- }), /* @__PURE__ */ R("button", {
1022
- type: "button",
1023
- onClick: ie,
1024
- title: C ? a._({ id: "PiH3UR" }) : a._({ id: "E6nRW7" }),
1025
- "aria-label": C ? a._({ id: "PiH3UR" }) : a._({ id: "E6nRW7" }),
1026
- className: "text-theme-light hover:text-theme-default absolute top-1/2 right-2 inline-flex items-center transition-colors",
1027
- style: { transform: "translateY(-50%)" },
1028
- children: /* @__PURE__ */ R(h, {
1029
- icon: C ? "checkCircle" : "contentCopy",
1030
- size: "18"
1031
- })
1032
- })]
1033
- }), Q && le && /* @__PURE__ */ R("p", {
1034
- className: "text-theme-light text-xs",
1035
- children: /* @__PURE__ */ R(q, {
1036
- id: "dOevLB",
1037
- values: {
1038
- selectedPresetLabel: le,
1039
- expiresAtFormatted: Q
1040
- }
1041
- })
1042
- })]
1043
- })
1044
- ]
1045
- })
1046
- });
1047
- }, Q = /^[a-zA-Z0-9!#$%&'*+\-.^_`|~]+$/, le = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/, ue = (e) => {
1048
- if (!le.test(e)) return !1;
1049
- let t = /* @__PURE__ */ new Date(e.replace(" ", "T") + "Z");
1050
- if (isNaN(t.getTime())) return !1;
1051
- let [n, r] = e.split(" "), [i, a, o] = n.split("-").map(Number), [s, c, l] = r.split(":").map(Number);
1052
- return t.getUTCFullYear() === i && t.getUTCMonth() + 1 === a && t.getUTCDate() === o && t.getUTCHours() === s && t.getUTCMinutes() === c && t.getUTCSeconds() === l;
1053
- }, de = (e) => e.trim() ? Q.test(e) ? /[a-zA-Z0-9]/.test(e) ? null : "no-alnum" : "invalid-chars" : "required", fe = (e) => {
1054
- let t = new Date(e);
1055
- return isNaN(t.getTime()) ? "—" : t.toLocaleString(void 0, {
1056
- year: "numeric",
1057
- month: "short",
1058
- day: "2-digit",
1059
- hour: "2-digit",
1060
- minute: "2-digit",
1061
- timeZone: "UTC"
1062
- });
1063
- }, pe = (e) => {
1064
- let t = /* @__PURE__ */ new Date(e * 1e3), n = (e) => String(e).padStart(2, "0");
1065
- return `${t.getUTCFullYear()}-${n(t.getUTCMonth() + 1)}-${n(t.getUTCDate())} ${n(t.getUTCHours())}:${n(t.getUTCMinutes())}:${n(t.getUTCSeconds())}`;
1066
- }, me = ({ isOpen: e, object: t, onClose: i, onSuccess: l, onError: u }) => {
1067
- let { i18n: d, _: p } = J(), m = te(), { containerName: h } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), g = S.useUtils(), { data: v, isLoading: y, isError: b, error: x } = S.storage.swift.getObjectMetadata.useQuery({
1068
- project_id: m,
1069
- container: h,
1070
- object: t?.name ?? ""
1071
- }, {
1072
- enabled: e && t !== null,
1073
- refetchOnWindowFocus: !1
1074
- }), C = U(0), w = () => ++C.current, [T, E] = W(""), [D, O] = W(null), [k, A] = W([]), [j, M] = W({}), [N, P] = W(!1), [I, L] = W(""), [B, V] = W(""), [G, Y] = W(null), ne = U(""), re = U([]), ie = U(""), ae = U(""), oe = U(null);
1075
- H(() => {
1076
- if (!v) return;
1077
- let e = v.deleteAt == null ? "" : pe(v.deleteAt);
1078
- E(e), ne.current = e;
1079
- let t = Object.entries(v.customMetadata ?? {}).map(([e, t]) => ({
1080
- uid: w(),
1081
- key: e,
1082
- value: t,
1083
- isEditing: !1,
1084
- originalKey: e,
1085
- originalValue: t
1086
- }));
1087
- A(t), re.current = t.map((e) => ({ ...e }));
1088
- }, [v]), H(() => {
1089
- e || se();
1090
- }, [e]);
1091
- let se = () => {
1092
- oe.current && clearTimeout(oe.current), E(""), O(null), A([]), M({}), P(!1), L(""), V(""), Y(null), Z.reset();
1093
- }, ce = (() => {
1094
- if (T !== ne.current || k.length !== re.current.length) return !0;
1095
- let e = new Map(re.current.map((e) => [e.key, e.value]));
1096
- return k.some((t) => e.get(t.key) !== t.value);
1097
- })(), X = k.some((e) => e.isEditing), Z = S.storage.swift.updateObjectMetadata.useMutation({
1098
- onSuccess: () => {
1099
- g.storage.swift.getObjectMetadata.invalidate({
1100
- project_id: m,
1101
- container: h,
1102
- object: ae.current
1103
- }), g.storage.swift.listObjects.invalidate({
1104
- project_id: m,
1105
- container: h
1106
- }), l?.(ie.current), Q();
1107
- },
1108
- onError: (e) => {
1109
- u?.(ie.current, e.message);
1110
- }
1111
- }), Q = () => {
1112
- se(), i();
1113
- }, le = () => {
1114
- if (!t) return;
1115
- if (T.trim() && !ue(T.trim())) {
1116
- O("invalid");
1117
- return;
1118
- }
1119
- O(null), ie.current = t.displayName, ae.current = t.name;
1120
- let e = {};
1121
- for (let t of k) e[t.key] = t.value;
1122
- Z.mutate({
1123
- project_id: m,
1124
- container: h,
1125
- object: t.name,
1126
- metadata: e,
1127
- ...T.trim() ? { deleteAt: Math.floor((/* @__PURE__ */ new Date(T.trim().replace(" ", "T") + "Z")).getTime() / 1e3) } : {}
1128
- });
1129
- }, me = (e) => {
1130
- A((t) => t.map((t, n) => n === e ? {
1131
- ...t,
1132
- isEditing: !0
1133
- } : t));
1134
- }, he = (e, t) => {
1135
- A((n) => n.map((n, r) => r === e ? {
1136
- ...n,
1137
- key: t
1138
- } : n)), j[`edit-${e}`] && M((t) => {
1139
- let n = { ...t };
1140
- return delete n[`edit-${e}`], n;
1141
- });
1142
- }, ge = (e, t) => {
1143
- A((n) => n.map((n, r) => r === e ? {
1144
- ...n,
1145
- value: t
1146
- } : n));
1147
- }, _e = (e) => {
1148
- let t = k[e], n = de(t.key);
1149
- if (n) {
1150
- let t = n === "required" ? d._({ id: "QV1ZPO" }) : n === "invalid-chars" ? d._({ id: "XYZLy9" }) : d._({ id: "dTNzBI" });
1151
- M((n) => ({
1152
- ...n,
1153
- [`edit-${e}`]: t
1154
- }));
1155
- return;
1156
- }
1157
- if (k.some((n, r) => r !== e && n.key.toLowerCase() === t.key.toLowerCase())) {
1158
- M((t) => ({
1159
- ...t,
1160
- [`edit-${e}`]: d._({ id: "q6K46F" })
1161
- }));
1162
- return;
1163
- }
1164
- A((t) => t.map((t, n) => n === e ? {
1165
- ...t,
1166
- isEditing: !1
1167
- } : t)), M((t) => {
1168
- let n = { ...t };
1169
- return delete n[`edit-${e}`], n;
1170
- });
1171
- }, ve = (e) => {
1172
- let t = re.current[e];
1173
- A(t ? (n) => n.map((n, r) => r === e ? {
1174
- ...t,
1175
- isEditing: !1
1176
- } : n) : (t) => t.filter((t, n) => n !== e)), M((t) => {
1177
- let n = { ...t };
1178
- return delete n[`edit-${e}`], n;
1179
- });
1180
- }, ye = (e) => {
1181
- A((t) => t.filter((t, n) => n !== e));
1182
- }, be = () => {
1183
- let e = de(I);
1184
- if (e) {
1185
- Y(e === "required" ? d._({ id: "QV1ZPO" }) : e === "invalid-chars" ? d._({ id: "XYZLy9" }) : d._({ id: "dTNzBI" }));
1186
- return;
1187
- }
1188
- if (k.some((e) => e.key.toLowerCase() === I.trim().toLowerCase())) {
1189
- Y(d._({ id: "q6K46F" }));
1190
- return;
1191
- }
1192
- A((e) => [...e, {
1193
- uid: w(),
1194
- key: I.trim(),
1195
- value: B,
1196
- isEditing: !1
1197
- }]), L(""), V(""), Y(null), P(!1);
1198
- }, xe = () => {
1199
- L(""), V(""), Y(null), P(!1);
1200
- };
1201
- if (!e || !t) return null;
1202
- let Se = t.displayName, Ce = Z.isPending, we = Ce || y, Te = v?.staticLargeObject === !0, $ = !!v?.objectManifest, Ee = x?.message ?? "", De = Z.error?.message ?? "";
1203
- return /* @__PURE__ */ R(ee, {
1204
- title: /* @__PURE__ */ R("span", {
1205
- className: "flex max-w-[400px] items-center gap-1",
1206
- children: /* @__PURE__ */ R(q, {
1207
- id: "bt0uXd",
1208
- values: { displayName: Se },
1209
- components: {
1210
- 0: /* @__PURE__ */ R("span", { className: "shrink-0" }),
1211
- 1: /* @__PURE__ */ R("span", {
1212
- className: "truncate font-mono",
1213
- title: Se
1214
- })
1215
- }
1216
- })
1217
- }),
1218
- open: e,
1219
- onCancel: Q,
1220
- confirmButtonLabel: Ce ? d._({ id: "XvjC4F" }) : d._({ id: "V/SINY" }),
1221
- onConfirm: le,
1222
- cancelButtonLabel: d._({ id: "dEgA5A" }),
1223
- size: N ? "xl" : "large",
1224
- disableConfirmButton: we || !ce || X || N,
1225
- children: y ? /* @__PURE__ */ z(_, {
1226
- direction: "horizontal",
1227
- alignment: "center",
1228
- gap: "2",
1229
- className: "py-8",
1230
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "O80bQY" })]
1231
- }) : b ? /* @__PURE__ */ R("p", {
1232
- className: "text-theme-error",
1233
- children: /* @__PURE__ */ R(q, {
1234
- id: "+p6nHr",
1235
- values: { metadataErrorMessage: Ee }
1236
- })
1237
- }) : /* @__PURE__ */ z(_, {
1238
- direction: "vertical",
1239
- gap: "6",
1240
- children: [
1241
- Z.isError && /* @__PURE__ */ R("p", {
1242
- className: "text-theme-error",
1243
- children: /* @__PURE__ */ R(q, {
1244
- id: "7ZnTL8",
1245
- values: { mutationErrorMessage: De }
1246
- })
1247
- }),
1248
- Te && /* @__PURE__ */ R("p", {
1249
- className: "text-theme-default",
1250
- children: /* @__PURE__ */ R(q, {
1251
- id: "WCKEqI",
1252
- components: { 0: /* @__PURE__ */ R("strong", {}) }
1253
- })
1254
- }),
1255
- $ && /* @__PURE__ */ R("p", {
1256
- className: "text-theme-default",
1257
- children: /* @__PURE__ */ R(q, {
1258
- id: "Cu6xuZ",
1259
- components: { 0: /* @__PURE__ */ R("strong", {}) }
1260
- })
1261
- }),
1262
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
1263
- className: "text-theme-default mb-3 text-sm font-semibold",
1264
- children: /* @__PURE__ */ R(q, { id: "f0cwjH" })
1265
- }), /* @__PURE__ */ z("div", {
1266
- className: "grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm",
1267
- children: [
1268
- /* @__PURE__ */ R("span", {
1269
- className: "text-theme-light text-right",
1270
- children: /* @__PURE__ */ R(q, { id: "IbYr/u" })
1271
- }),
1272
- /* @__PURE__ */ R("span", {
1273
- className: "font-mono",
1274
- children: v?.contentType ?? "—"
1275
- }),
1276
- /* @__PURE__ */ R("span", {
1277
- className: "text-theme-light text-right",
1278
- children: /* @__PURE__ */ R(q, { id: "BoPocW" })
1279
- }),
1280
- /* @__PURE__ */ R("span", {
1281
- className: "font-mono break-all",
1282
- children: v?.etag ?? "—"
1283
- }),
1284
- /* @__PURE__ */ R("span", {
1285
- className: "text-theme-light text-right",
1286
- children: /* @__PURE__ */ R(q, { id: "Cj2Gtd" })
1287
- }),
1288
- /* @__PURE__ */ R("span", { children: v?.contentLength == null ? "—" : F(v.contentLength) }),
1289
- /* @__PURE__ */ R("span", {
1290
- className: "text-theme-light text-right",
1291
- children: /* @__PURE__ */ R(q, { id: "TfC9O+" })
1292
- }),
1293
- /* @__PURE__ */ R("span", { children: v?.lastModified ? fe(v.lastModified) : t.last_modified ? fe(t.last_modified) : "—" })
1294
- ]
1295
- })] }),
1296
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
1297
- className: "text-theme-light mb-1",
1298
- children: /* @__PURE__ */ R(q, { id: "8Pcsi8" })
1299
- }), /* @__PURE__ */ R(s, {
1300
- label: d._({ id: "eu70nA" }),
1301
- value: T,
1302
- onChange: (e) => {
1303
- let t = e.target.value;
1304
- E(t), oe.current && clearTimeout(oe.current), oe.current = setTimeout(() => {
1305
- t.trim() && !ue(t.trim()) ? O("invalid") : O(null);
1306
- }, 600);
1307
- },
1308
- invalid: !!D,
1309
- errortext: D ? d._({ id: "48QXFO" }) : void 0,
1310
- placeholder: d._({ id: "Mj5iQ0" }),
1311
- disabled: we
1312
- })] }),
1313
- /* @__PURE__ */ z("div", { children: [
1314
- /* @__PURE__ */ z(_, {
1315
- direction: "horizontal",
1316
- alignment: "center",
1317
- distribution: "between",
1318
- children: [/* @__PURE__ */ R("p", {
1319
- className: "text-theme-default text-sm font-semibold",
1320
- children: /* @__PURE__ */ R(q, { id: "6GBt0m" })
1321
- }), /* @__PURE__ */ R("p", {
1322
- className: "text-theme-light text-xs",
1323
- children: /* @__PURE__ */ R(q, { id: "2TtIL2" })
1324
- })]
1325
- }),
1326
- /* @__PURE__ */ R(_, {
1327
- direction: "horizontal",
1328
- className: "jn:bg-theme-background-lvl-1 mb-3 justify-end p-2",
1329
- children: /* @__PURE__ */ R(f, {
1330
- label: d._({ id: "sWBLli" }),
1331
- onClick: () => P(!0),
1332
- variant: "primary",
1333
- size: "small",
1334
- icon: "addCircle",
1335
- disabled: N || X || we
1336
- })
1337
- }),
1338
- /* @__PURE__ */ z(c, {
1339
- columns: 3,
1340
- children: [
1341
- /* @__PURE__ */ z(r, { children: [
1342
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "7sMeHQ" }) }),
1343
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "wMHvYH" }) }),
1344
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "7L01XJ" }) })
1345
- ] }),
1346
- N && /* @__PURE__ */ z(r, { children: [
1347
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R(s, {
1348
- value: I,
1349
- onChange: (e) => {
1350
- L(e.target.value), G && Y(null);
1351
- },
1352
- placeholder: d._({ id: "x9AdZ8" }),
1353
- errortext: G ?? void 0,
1354
- invalid: !!G,
1355
- autoFocus: !0
1356
- }) }),
1357
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R(s, {
1358
- value: B,
1359
- onChange: (e) => V(e.target.value),
1360
- placeholder: d._({ id: "wMHvYH" })
1361
- }) }),
1362
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ z(_, {
1363
- direction: "horizontal",
1364
- gap: "2",
1365
- children: [/* @__PURE__ */ R(f, {
1366
- size: "small",
1367
- variant: "primary",
1368
- onClick: be,
1369
- icon: "check",
1370
- title: d._({ id: "tfDRzk" })
1371
- }), /* @__PURE__ */ R(f, {
1372
- size: "small",
1373
- variant: "subdued",
1374
- onClick: xe,
1375
- icon: "close",
1376
- title: d._({ id: "bzSI52" })
1377
- })]
1378
- }) })
1379
- ] }),
1380
- k.map((e, t) => /* @__PURE__ */ z(r, { children: [
1381
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ R(s, {
1382
- value: e.key,
1383
- onChange: (e) => he(t, e.target.value),
1384
- errortext: j[`edit-${t}`],
1385
- invalid: !!j[`edit-${t}`]
1386
- }) : /* @__PURE__ */ R("span", {
1387
- className: "block max-w-xs truncate font-mono text-sm",
1388
- title: e.key,
1389
- children: e.key
1390
- }) }),
1391
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ R(s, {
1392
- value: e.value,
1393
- onChange: (e) => ge(t, e.target.value)
1394
- }) : /* @__PURE__ */ R("span", {
1395
- className: "block max-w-md truncate text-sm",
1396
- title: e.value,
1397
- children: e.value
1398
- }) }),
1399
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ z(_, {
1400
- direction: "horizontal",
1401
- gap: "2",
1402
- children: [/* @__PURE__ */ R(f, {
1403
- size: "small",
1404
- variant: "primary",
1405
- onClick: () => _e(t),
1406
- icon: "check",
1407
- title: d._({ id: "tfDRzk" })
1408
- }), /* @__PURE__ */ R(f, {
1409
- size: "small",
1410
- variant: "subdued",
1411
- onClick: () => ve(t),
1412
- icon: "close",
1413
- title: d._({ id: "bzSI52" })
1414
- })]
1415
- }) : /* @__PURE__ */ z(_, {
1416
- direction: "horizontal",
1417
- gap: "2",
1418
- children: [/* @__PURE__ */ R(f, {
1419
- size: "small",
1420
- variant: "subdued",
1421
- onClick: () => me(t),
1422
- icon: "edit",
1423
- title: d._({ id: "ePK91l" }),
1424
- disabled: N || X || we
1425
- }), /* @__PURE__ */ R(f, {
1426
- size: "small",
1427
- variant: "default",
1428
- onClick: () => ye(t),
1429
- icon: "deleteForever",
1430
- title: d._({ id: "cnGeoo" }),
1431
- disabled: N || X || we
1432
- })]
1433
- }) })
1434
- ] }, e.uid)),
1435
- k.length === 0 && !N && /* @__PURE__ */ R(r, { children: /* @__PURE__ */ R(a, {
1436
- colSpan: 3,
1437
- className: "py-6 text-center",
1438
- children: /* @__PURE__ */ R(_, {
1439
- alignment: "center",
1440
- children: /* @__PURE__ */ R("span", {
1441
- className: "text-theme-light text-sm",
1442
- children: /* @__PURE__ */ R(q, { id: "F02e8I" })
1443
- })
1444
- })
1445
- }) })
1446
- ]
1447
- })
1448
- ] })
1449
- ]
1450
- })
1451
- });
1452
- }, he = new Set([
1453
- "image/png",
1454
- "image/jpeg",
1455
- "image/gif",
1456
- "image/webp",
1457
- "image/avif",
1458
- "image/bmp",
1459
- "image/x-icon",
1460
- "image/vnd.microsoft.icon",
1461
- "video/mp4",
1462
- "video/webm",
1463
- "video/ogg",
1464
- "audio/mpeg",
1465
- "audio/mp3",
1466
- "audio/ogg",
1467
- "audio/wav",
1468
- "audio/webm",
1469
- "audio/flac",
1470
- "application/pdf",
1471
- "text/plain"
1472
- ]), ge = (e) => {
1473
- if (!e) return !1;
1474
- let t = e.split(";")[0].trim().toLowerCase();
1475
- return he.has(t) ? !0 : t === "image/svg+xml" ? !1 : !!(t.startsWith("image/") || t.startsWith("video/") || t.startsWith("audio/"));
1476
- }, _e = "40px minmax(200px, 3fr) minmax(180px, 2fr) minmax(100px, 1fr) 60px", ve = ({ rows: e, searchTerm: i, container: s, account: l, onFolderClick: d, onDeleteFolderSuccess: f, onDeleteFolderError: p, onDownloadError: h, onDeleteObjectSuccess: g, onDeleteObjectError: _, onCopyObjectSuccess: ee, onCopyObjectError: v, onMoveObjectSuccess: y, onMoveObjectError: C, onTempUrlCopySuccess: w, onEditMetadataSuccess: T, onEditMetadataError: E, selectedObjects: D, setSelectedObjects: k }) => {
1477
- let { i18n: j, _: M } = J(), N = te(), P = U(null), I = U(!0);
1478
- H(() => (I.current = !0, () => {
1479
- I.current = !1;
1480
- }), []);
1481
- let [B, V] = W(0), [G, K] = W(null), [Y, ae] = W(null), [se, X] = W(null), [Q, le] = W(null), [ue, de] = W(null), [fe, pe] = W(null), [he, ve] = W(null), [ye, be] = W(null), [xe, Se] = W(null), { data: Ce } = S.storage.swift.watchDownloadProgress.useSubscription({ downloadId: ye ?? "" }, { enabled: !!ye && he !== null }), we = async (e, t) => {
1482
- let n = e.content_type ?? "application/octet-stream", r = e.displayName, i = await x.storage.swift.downloadObject.mutate({
1483
- project_id: N,
1484
- container: s,
1485
- object: e.name,
1486
- filename: e.displayName,
1487
- downloadId: t,
1488
- ...l ? { account: l } : {}
1489
- }), a = [];
1490
- for await (let { chunk: e, contentType: t, filename: o } of i) t && (n = t), o && (r = o), a.push(Uint8Array.from(atob(e), (e) => e.charCodeAt(0)));
1491
- return {
1492
- blob: new Blob(a, { type: n }),
1493
- filename: r
1494
- };
1495
- }, Te = (e, t) => {
1496
- let n = document.createElement("a");
1497
- n.href = e, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n), setTimeout(() => URL.revokeObjectURL(e), 1e4);
1498
- }, $ = async (e) => {
1499
- let t = `${s}:${e.name}:${crypto.randomUUID()}`;
1500
- ve(e), be(t);
1501
- try {
1502
- let { blob: n, filename: r } = await we(e, t);
1503
- Te(URL.createObjectURL(n), r);
1504
- } catch (t) {
1505
- h(e.displayName, t instanceof Error ? t.message : String(t));
1506
- } finally {
1507
- I.current && (ve(null), be(null));
1508
- }
1509
- }, Ee = async (e) => {
1510
- let t = `${s}:${e.name}:${crypto.randomUUID()}`, n = ge(e.content_type);
1511
- n ? Se(e) : (ve(e), be(t));
1512
- let r = n ? window.open("", "_blank") : null;
1513
- r && (r.opener = null);
1514
- try {
1515
- let { blob: i, filename: a } = await we(e, t), o = URL.createObjectURL(i);
1516
- n ? (r && (r.location.href = o), setTimeout(() => URL.revokeObjectURL(o), 1e4)) : Te(o, a);
1517
- } catch (t) {
1518
- r?.close(), h(e.displayName, t instanceof Error ? t.message : String(t));
1519
- } finally {
1520
- I.current && (Se(null), ve(null), be(null));
1521
- }
1522
- };
1523
- H(() => {
1524
- P.current && V(P.current.offsetWidth - P.current.clientWidth);
1525
- }, [e.length]);
1526
- let De = ne({
1527
- count: e.length,
1528
- getScrollElement: () => P.current,
1529
- estimateSize: () => 48,
1530
- overscan: 10
1531
- }), Oe = (e) => {
1532
- let t = new Date(e);
1533
- return Number.isNaN(t.getTime()) ? j._({ id: "fj5byd" }) : t.toLocaleString();
1534
- }, ke = e.filter((e) => e.kind === "object"), Ae = new Set(D), je = ke.length > 0 && ke.every((e) => Ae.has(e.name)), Me = () => {
1535
- k(je ? [] : ke.map((e) => e.name));
1536
- }, Ne = (e) => {
1537
- D.includes(e) ? k(D.filter((t) => t !== e)) : k([...D, e]);
1538
- };
1539
- if (e.length === 0) return /* @__PURE__ */ R(c, {
1540
- columns: 5,
1541
- className: "objects",
1542
- "data-testid": "no-objects",
1543
- children: /* @__PURE__ */ R(r, { children: /* @__PURE__ */ R(a, {
1544
- colSpan: 5,
1545
- children: /* @__PURE__ */ z("div", {
1546
- className: "py-8 text-center",
1547
- children: [/* @__PURE__ */ R("h3", {
1548
- className: "text-lg font-semibold",
1549
- children: /* @__PURE__ */ R(q, { id: "arel2K" })
1550
- }), /* @__PURE__ */ R("p", {
1551
- className: "text-theme-light mt-2",
1552
- children: i ? /* @__PURE__ */ R(q, { id: "H4Qwmp" }) : /* @__PURE__ */ R(q, { id: "Pkw7J9" })
1553
- })]
1554
- })
1555
- }) })
1556
- });
1557
- let Pe = e.length, Fe = he !== null || xe !== null;
1558
- return /* @__PURE__ */ z(L, { children: [
1559
- /* @__PURE__ */ z("div", {
1560
- className: "relative",
1561
- children: [
1562
- /* @__PURE__ */ R("div", {
1563
- style: { paddingRight: `${B}px` },
1564
- children: /* @__PURE__ */ R(c, {
1565
- columns: 5,
1566
- gridColumnTemplate: _e,
1567
- className: "objects",
1568
- "data-testid": "objects-table-header",
1569
- children: /* @__PURE__ */ z(r, { children: [
1570
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(b, {
1571
- checked: je,
1572
- onChange: Me,
1573
- "data-testid": "select-all-objects"
1574
- }) }),
1575
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "wrXcuy" }) }),
1576
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "sjMCOP" }) }),
1577
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "Cj2Gtd" }) }),
1578
- /* @__PURE__ */ R(n, { style: { marginRight: `-${B}px` } })
1579
- ] })
1580
- })
1581
- }),
1582
- /* @__PURE__ */ R("div", {
1583
- ref: P,
1584
- className: "overflow-auto",
1585
- style: { height: "calc(100vh - 550px)" },
1586
- "data-testid": "objects-table-body",
1587
- children: /* @__PURE__ */ R("div", {
1588
- style: {
1589
- height: `${De.getTotalSize()}px`,
1590
- width: "100%",
1591
- position: "relative"
1592
- },
1593
- children: De.getVirtualItems().map((n) => {
1594
- let r = e[n.index], i = r.kind === "folder", s = !i && he?.name === r.name, c = r.displayName, l = !i && D.includes(r.name);
1595
- return /* @__PURE__ */ z("div", {
1596
- "data-index": n.index,
1597
- ref: De.measureElement,
1598
- className: "juno-datagrid",
1599
- style: {
1600
- position: "absolute",
1601
- top: 0,
1602
- left: 0,
1603
- width: "100%",
1604
- transform: `translateY(${n.start}px)`,
1605
- display: "grid",
1606
- gridTemplateColumns: _e,
1607
- alignItems: "stretch"
1608
- },
1609
- "data-testid": `object-row-${r.name}`,
1610
- children: [
1611
- /* @__PURE__ */ R(a, {
1612
- onClick: (e) => e.stopPropagation(),
1613
- children: !i && /* @__PURE__ */ R(b, {
1614
- checked: l,
1615
- onChange: () => Ne(r.name),
1616
- "data-testid": `select-object-${r.name}`
1617
- })
1618
- }),
1619
- /* @__PURE__ */ R(a, {
1620
- className: "min-w-0 overflow-hidden",
1621
- children: i ? /* @__PURE__ */ z("button", {
1622
- type: "button",
1623
- className: "focus-visible:outline-theme-focus flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2",
1624
- onClick: () => d(r.name),
1625
- "data-testid": `folder-${r.name}`,
1626
- title: r.displayName,
1627
- children: [/* @__PURE__ */ R(O, {
1628
- size: 18,
1629
- className: "text-theme-light shrink-0"
1630
- }), /* @__PURE__ */ R("span", {
1631
- className: "truncate",
1632
- children: r.displayName
1633
- })]
1634
- }) : /* @__PURE__ */ z("button", {
1635
- type: "button",
1636
- className: "focus-visible:outline-theme-focus flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2 disabled:cursor-wait disabled:opacity-60",
1637
- onClick: () => Ee(r),
1638
- disabled: Fe,
1639
- "data-testid": `preview-${r.name}`,
1640
- title: ge(r.content_type) ? j._({
1641
- id: "k7ENJG",
1642
- values: { rowDisplayName: c }
1643
- }) : j._({
1644
- id: "LI8Z2I",
1645
- values: { rowDisplayName: c }
1646
- }),
1647
- children: [xe?.name === r.name ? /* @__PURE__ */ R(o, {
1648
- size: "small",
1649
- className: "shrink-0"
1650
- }) : /* @__PURE__ */ R(A, {
1651
- size: 18,
1652
- className: "text-theme-light shrink-0"
1653
- }), /* @__PURE__ */ R("span", {
1654
- className: "truncate",
1655
- children: r.displayName
1656
- })]
1657
- })
1658
- }),
1659
- /* @__PURE__ */ R(a, { children: s ? /* @__PURE__ */ R("span", {
1660
- className: "flex min-w-0 flex-col gap-1",
1661
- children: (() => {
1662
- let e = Ce?.percent ?? null;
1663
- return /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ z("span", {
1664
- className: "text-theme-light flex items-center gap-2 text-sm",
1665
- children: [/* @__PURE__ */ R(o, { size: "small" }), e === null ? /* @__PURE__ */ R(q, { id: "cCfxH1" }) : /* @__PURE__ */ R(q, {
1666
- id: "Flugry",
1667
- values: { progressPct: e }
1668
- })]
1669
- }), e !== null && /* @__PURE__ */ R("div", {
1670
- className: "bg-theme-background-lvl-2 h-1 w-full overflow-hidden rounded-full",
1671
- children: /* @__PURE__ */ R("div", {
1672
- className: "bg-theme-accent h-1 rounded-full transition-all duration-150",
1673
- style: { width: `${e}%` }
1674
- })
1675
- })] });
1676
- })()
1677
- }) : !i && r.last_modified ? Oe(r.last_modified) : "—" }),
1678
- /* @__PURE__ */ R(a, { children: i ? "—" : F(r.bytes) }),
1679
- /* @__PURE__ */ R(a, {
1680
- onClick: (e) => e.stopPropagation(),
1681
- children: /* @__PURE__ */ R(m, {
1682
- disabled: Fe,
1683
- children: /* @__PURE__ */ R(t, { children: i ? /* @__PURE__ */ R(u, {
1684
- label: j._({ id: "9vSW3U" }),
1685
- onClick: () => K(r),
1686
- "data-testid": `delete-recursively-action-${r.name}`
1687
- }) : /* @__PURE__ */ z(L, { children: [
1688
- /* @__PURE__ */ R(u, {
1689
- label: s ? j._({ id: "cCfxH1" }) : j._({ id: "mzI/c+" }),
1690
- disabled: s,
1691
- onClick: () => $(r),
1692
- "data-testid": `download-action-${r.name}`
1693
- }),
1694
- /* @__PURE__ */ R(u, {
1695
- label: j._({ id: "SIfYq6" }),
1696
- onClick: () => pe(r),
1697
- "data-testid": `edit-metadata-action-${r.name}`
1698
- }),
1699
- /* @__PURE__ */ R(u, {
1700
- label: j._({ id: "he3ygx" }),
1701
- onClick: () => X(r),
1702
- "data-testid": `copy-action-${r.name}`
1703
- }),
1704
- /* @__PURE__ */ R(u, {
1705
- label: j._({ id: "v3djpU" }),
1706
- onClick: () => le(r),
1707
- "data-testid": `move-rename-action-${r.name}`
1708
- }),
1709
- /* @__PURE__ */ R(u, {
1710
- label: j._({ id: "WrUky8" }),
1711
- onClick: () => de(r),
1712
- "data-testid": `temp-url-action-${r.name}`
1713
- }),
1714
- /* @__PURE__ */ R(u, {
1715
- label: j._({ id: "cnGeoo" }),
1716
- onClick: () => ae(r),
1717
- "data-testid": `delete-action-${r.name}`
1718
- })
1719
- ] }) })
1720
- })
1721
- })
1722
- ]
1723
- }, r.name);
1724
- })
1725
- })
1726
- }),
1727
- /* @__PURE__ */ R("div", {
1728
- className: "text-theme-light border-theme-background-lvl-2 border-t px-4 py-2 text-sm",
1729
- children: /* @__PURE__ */ R(q, {
1730
- id: "vg84cD",
1731
- values: { allCount: Pe }
1732
- })
1733
- })
1734
- ]
1735
- }),
1736
- /* @__PURE__ */ R(re, {
1737
- isOpen: G !== null,
1738
- folder: G,
1739
- onClose: () => K(null),
1740
- onSuccess: f,
1741
- onError: p
1742
- }),
1743
- /* @__PURE__ */ R(ie, {
1744
- isOpen: Y !== null,
1745
- object: Y,
1746
- onClose: () => ae(null),
1747
- onSuccess: g,
1748
- onError: _
1749
- }),
1750
- /* @__PURE__ */ R(oe, {
1751
- isOpen: se !== null,
1752
- object: se,
1753
- onClose: () => X(null),
1754
- onSuccess: ee,
1755
- onError: v
1756
- }),
1757
- /* @__PURE__ */ R(ce, {
1758
- isOpen: Q !== null,
1759
- object: Q,
1760
- onClose: () => le(null),
1761
- onSuccess: y,
1762
- onError: C
1763
- }),
1764
- /* @__PURE__ */ R(Z, {
1765
- isOpen: ue !== null,
1766
- object: ue,
1767
- account: l,
1768
- onClose: () => de(null),
1769
- onCopySuccess: w
1770
- }),
1771
- /* @__PURE__ */ R(me, {
1772
- isOpen: fe !== null,
1773
- object: fe,
1774
- onClose: () => pe(null),
1775
- onSuccess: T,
1776
- onError: E
1777
- })
1778
- ] });
1779
- };
1780
- //#endregion
1781
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/ObjectsFileNavigation.tsx
1782
- function ye(e) {
1783
- if (!e) return [];
1784
- let t = e.replace(/\/$/, "").split("/").filter(Boolean);
1785
- return t.map((e, n) => ({
1786
- label: e,
1787
- prefix: t.slice(0, n + 1).join("/") + "/"
1788
- }));
1789
- }
1790
- var be = "bg-theme-background-lvl-4 rounded px-2 py-0.5", xe = ({ containerName: t, currentPrefix: n, onContainersClick: r, onPrefixClick: i }) => {
1791
- let { i18n: a, _: o } = J(), s = ye(n), c = s.length === 0;
1792
- return /* @__PURE__ */ R("div", {
1793
- className: "mb-2 px-2 pt-2",
1794
- children: /* @__PURE__ */ z(l, { children: [
1795
- /* @__PURE__ */ R(e, {
1796
- onClick: r,
1797
- label: /* @__PURE__ */ z("span", {
1798
- className: "flex items-center gap-1",
1799
- children: [/* @__PURE__ */ R(k, {
1800
- size: 15,
1801
- className: "shrink-0"
1802
- }), a._({ id: "PLwzWR" })]
1803
- })
1804
- }),
1805
- /* @__PURE__ */ R(e, {
1806
- onClick: c ? void 0 : () => i(""),
1807
- active: c,
1808
- label: /* @__PURE__ */ z("span", {
1809
- className: `flex items-center gap-1 ${c ? be : ""}`,
1810
- children: [R(c ? E : T, {
1811
- size: 15,
1812
- className: "shrink-0"
1813
- }), t]
1814
- })
1815
- }),
1816
- s.map((t, n) => {
1817
- let r = n === s.length - 1;
1818
- return /* @__PURE__ */ R(e, {
1819
- onClick: r ? void 0 : () => i(t.prefix),
1820
- active: r,
1821
- label: /* @__PURE__ */ z("span", {
1822
- className: `flex items-center gap-1 ${r ? be : ""}`,
1823
- children: [R(r ? N : O, {
1824
- size: 15,
1825
- className: "shrink-0"
1826
- }), t.label]
1827
- })
1828
- }, t.prefix);
1829
- })
1830
- ] })
1831
- });
1832
- }, Se = ({ isOpen: e, currentPrefix: t, onClose: n, onSuccess: r, onError: i }) => {
1833
- let { i18n: a, _: o } = J(), c = te(), { containerName: l } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), [u, d] = W(""), [f, p] = W(null), m = S.useUtils(), h = U(""), g = S.storage.swift.createFolder.useMutation({
1834
- onSuccess: () => {
1835
- m.storage.swift.listObjects.invalidate(), r?.(h.current);
1836
- },
1837
- onError: (e) => {
1838
- i?.(h.current, e.message);
1839
- },
1840
- onSettled: () => {
1841
- v();
1842
- }
1843
- }), v = () => {
1844
- d(""), p(null), g.reset(), n();
1845
- }, y = (e) => {
1846
- let t = e.trim();
1847
- return t ? t.includes("/") ? (p(a._({ id: "Vl4XTj" })), !1) : t === e ? (p(null), !0) : (p(a._({ id: "gFKJBP" })), !1) : (p(a._({ id: "Fzrzfe" })), !1);
1848
- }, b = (e) => {
1849
- let t = e.target.value;
1850
- d(t), f && y(t);
1851
- }, x = () => {
1852
- if (!y(u)) return;
1853
- h.current = u.trim();
1854
- let e = `${t}${h.current}/`;
1855
- g.mutate({
1856
- project_id: c,
1857
- container: l,
1858
- folderPath: e
1859
- });
1860
- }, C = (e) => {
1861
- e.key === "Enter" && x();
1862
- }, w = t || "/";
1863
- return e ? /* @__PURE__ */ R(ee, {
1864
- title: /* @__PURE__ */ z("span", {
1865
- className: "flex max-w-[400px] items-center gap-1",
1866
- children: [/* @__PURE__ */ R("span", {
1867
- className: "shrink-0",
1868
- children: /* @__PURE__ */ R(q, { id: "/Z5n1b" })
1869
- }), /* @__PURE__ */ R("span", {
1870
- className: "truncate font-mono",
1871
- title: w,
1872
- children: w
1873
- })]
1874
- }),
1875
- open: e,
1876
- onCancel: v,
1877
- confirmButtonLabel: a._({ id: "boJ+Y1" }),
1878
- onConfirm: x,
1879
- cancelButtonLabel: a._({ id: "dEgA5A" }),
1880
- size: "small",
1881
- disableConfirmButton: g.isPending || !u.trim(),
1882
- children: /* @__PURE__ */ z(_, {
1883
- direction: "vertical",
1884
- gap: "6",
1885
- children: [/* @__PURE__ */ R("p", {
1886
- className: "text-theme-default",
1887
- children: /* @__PURE__ */ R(q, { id: "Z42tfY" })
1888
- }), /* @__PURE__ */ R(s, {
1889
- label: a._({ id: "cqQyPB" }),
1890
- required: !0,
1891
- value: u,
1892
- onChange: b,
1893
- onKeyDown: C,
1894
- invalid: !!f,
1895
- errortext: f || void 0,
1896
- disabled: g.isPending,
1897
- autoFocus: !0,
1898
- placeholder: a._({ id: "Zw49f9" })
1899
- })]
1900
- })
1901
- }) : null;
1902
- }, Ce = ({ isOpen: e, currentPrefix: t, container: n, projectId: r, account: i, onClose: a, onSuccess: s, onError: c, onCancelled: l }) => {
1903
- let { i18n: u, _: d } = J(), [f, p] = W(null), [m, h] = W(null), [g, v] = W(!1), [y, b] = W(null), [w, T] = W(null), [E, D] = W(!1), O = U(""), k = U(null), A = U(null), M = S.useUtils(), N = () => {
1904
- A.current?.abort();
1905
- }, { data: P } = S.storage.swift.watchUploadProgress.useSubscription({ uploadId: y ?? "" }, { enabled: !!y && E }), te = () => {
1906
- E || I();
1907
- }, I = () => {
1908
- p(null), h(null), v(!1), b(null), T(null), k.current && (k.current.value = ""), a();
1909
- }, B = (e) => {
1910
- let t = e.target.files?.[0];
1911
- t && (h(null), T(null), p(t));
1912
- }, V = (e) => {
1913
- e.preventDefault(), e.stopPropagation(), !E && v(!0);
1914
- }, H = (e) => {
1915
- e.preventDefault(), e.stopPropagation(), !E && v(!1);
1916
- }, G = (e) => {
1917
- if (e.preventDefault(), e.stopPropagation(), v(!1), E) return;
1918
- let t = e.dataTransfer.files?.[0];
1919
- t && (h(null), T(null), p(t));
1920
- }, K = async () => {
1921
- if (!f) {
1922
- h(u._({ id: "AB4Tnl" }));
1923
- return;
1924
- }
1925
- let e = `${t}${f.name}`, a = `${n}:${e}:${crypto.randomUUID()}`;
1926
- O.current = f.name, T(null);
1927
- let o = new AbortController();
1928
- A.current = o, b(a), D(!0);
1929
- try {
1930
- let t = { headers: {
1931
- "x-upload-project-id": r,
1932
- "x-upload-container": n,
1933
- "x-upload-object": e,
1934
- "x-upload-type": f.type || "application/octet-stream",
1935
- "x-upload-size": String(f.size),
1936
- "x-upload-id": a,
1937
- ...i ? { "x-upload-account": i } : {}
1938
- } };
1939
- await x.storage.swift.uploadObject.mutate(f, {
1940
- context: t,
1941
- signal: o.signal
1942
- }), M.storage.swift.listObjects.invalidate({ container: n }), s?.(O.current), I();
1943
- } catch (e) {
1944
- if (e instanceof Error && (e.name === "AbortError" || e.message === "Request canceled" || e.message.includes("signal is aborted") || e.message.includes("aborted"))) {
1945
- l?.(O.current), I();
1946
- return;
1947
- }
1948
- let t = e instanceof Error ? e.message : String(e);
1949
- T(t), c?.(O.current, t);
1950
- } finally {
1951
- D(!1), b(null), A.current = null;
1952
- }
1953
- }, Y = P?.percent ?? null;
1954
- if (!e) return null;
1955
- let ne = t || "/", re = f ? `${t}${f.name}` : "";
1956
- return /* @__PURE__ */ R(ee, {
1957
- title: /* @__PURE__ */ z("span", {
1958
- className: "flex max-w-[400px] items-center gap-1",
1959
- children: [/* @__PURE__ */ R("span", {
1960
- className: "shrink-0",
1961
- children: /* @__PURE__ */ R(q, { id: "SU0uxT" })
1962
- }), /* @__PURE__ */ R("span", {
1963
- className: "truncate font-mono",
1964
- title: ne,
1965
- children: ne
1966
- })]
1967
- }),
1968
- open: e,
1969
- onCancel: E ? N : te,
1970
- confirmButtonLabel: E ? u._({ id: "GxkJXS" }) : u._({ id: "ONWvwQ" }),
1971
- onConfirm: K,
1972
- cancelButtonLabel: E ? u._({ id: "k99j0U" }) : u._({ id: "dEgA5A" }),
1973
- size: "small",
1974
- disableConfirmButton: E || !f,
1975
- disableCloseButton: E,
1976
- children: /* @__PURE__ */ z(_, {
1977
- direction: "vertical",
1978
- gap: "4",
1979
- children: [
1980
- w && /* @__PURE__ */ R("p", {
1981
- className: "text-theme-error",
1982
- children: /* @__PURE__ */ R(q, {
1983
- id: "QetsXP",
1984
- values: { uploadError: w }
1985
- })
1986
- }),
1987
- f && !E && /* @__PURE__ */ R("p", {
1988
- className: "text-theme-default",
1989
- children: /* @__PURE__ */ R(q, {
1990
- id: "4fvcmm",
1991
- values: { selectedObjectName: re },
1992
- components: { 0: /* @__PURE__ */ R("span", { className: "font-mono font-semibold" }) }
1993
- })
1994
- }),
1995
- /* @__PURE__ */ z("div", { children: [
1996
- /* @__PURE__ */ z("label", {
1997
- htmlFor: "upload-object-file",
1998
- className: C("flex flex-col items-center justify-center rounded-lg border-2 border-dashed px-6 py-8 text-center transition-colors", g ? "border-theme-accent bg-theme-background-lvl-2" : E ? "border-theme-background-lvl-4 pointer-events-none cursor-not-allowed opacity-60" : "border-theme-background-lvl-4 hover:border-theme-accent hover:bg-theme-background-lvl-1 cursor-pointer"),
1999
- onDragOver: V,
2000
- onDragLeave: H,
2001
- onDrop: G,
2002
- children: [
2003
- /* @__PURE__ */ R(j, {
2004
- className: "text-theme-light mb-2",
2005
- size: 40
2006
- }),
2007
- /* @__PURE__ */ R("p", {
2008
- className: "text-theme-default text-sm font-medium",
2009
- children: g ? /* @__PURE__ */ R("span", { children: u._({ id: "DvB4XF" }) }) : /* @__PURE__ */ z(L, { children: [
2010
- /* @__PURE__ */ R("span", {
2011
- className: "font-semibold",
2012
- children: u._({ id: "gYe+hC" })
2013
- }),
2014
- " ",
2015
- u._({ id: "Np28ib" })
2016
- ] })
2017
- }),
2018
- /* @__PURE__ */ R("p", {
2019
- className: "text-theme-light mt-1 text-xs",
2020
- children: u._({ id: "x/XQrD" })
2021
- }),
2022
- /* @__PURE__ */ R("input", {
2023
- ref: k,
2024
- id: "upload-object-file",
2025
- type: "file",
2026
- className: "hidden",
2027
- onChange: B,
2028
- disabled: E
2029
- })
2030
- ]
2031
- }),
2032
- f && /* @__PURE__ */ z("div", {
2033
- className: "mt-2 flex items-center justify-between rounded-lg border border-green-200 bg-green-50 p-2 text-xs",
2034
- children: [/* @__PURE__ */ z("div", {
2035
- className: "flex min-w-0 items-center gap-2",
2036
- children: [
2037
- /* @__PURE__ */ R("svg", {
2038
- className: "h-4 w-4 shrink-0 text-green-600",
2039
- fill: "currentColor",
2040
- viewBox: "0 0 20 20",
2041
- children: /* @__PURE__ */ R("path", {
2042
- fillRule: "evenodd",
2043
- 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",
2044
- clipRule: "evenodd"
2045
- })
2046
- }),
2047
- /* @__PURE__ */ R("span", {
2048
- className: "truncate text-gray-700",
2049
- children: f.name
2050
- }),
2051
- /* @__PURE__ */ z("span", {
2052
- className: "shrink-0 text-gray-400",
2053
- children: [
2054
- "(",
2055
- F(f.size),
2056
- ")"
2057
- ]
2058
- })
2059
- ]
2060
- }), !E && /* @__PURE__ */ R("button", {
2061
- type: "button",
2062
- onClick: () => {
2063
- p(null), h(null), T(null), k.current && (k.current.value = "");
2064
- },
2065
- className: "ml-2 shrink-0 font-medium text-red-600 hover:text-red-800",
2066
- children: u._({ id: "t/YqKh" })
2067
- })]
2068
- }),
2069
- m && /* @__PURE__ */ R("p", {
2070
- className: "mt-1 text-xs text-red-600",
2071
- children: m
2072
- })
2073
- ] }),
2074
- E && /* @__PURE__ */ z("div", {
2075
- className: "flex flex-col gap-2",
2076
- children: [/* @__PURE__ */ z("span", {
2077
- className: "text-theme-light flex items-center gap-2 text-sm",
2078
- children: [/* @__PURE__ */ R(o, { size: "small" }), Y === null ? /* @__PURE__ */ R(q, { id: "GxkJXS" }) : /* @__PURE__ */ R(q, {
2079
- id: "oEGiW3",
2080
- values: { progressPct: Y }
2081
- })]
2082
- }), Y !== null && /* @__PURE__ */ R("div", {
2083
- className: "bg-theme-background-lvl-2 h-1.5 w-full overflow-hidden rounded-full",
2084
- children: /* @__PURE__ */ R("div", {
2085
- className: "bg-theme-accent h-1.5 rounded-full transition-all duration-150",
2086
- style: { width: `${Y}%` }
2087
- })
2088
- })]
2089
- })
2090
- ]
2091
- })
2092
- });
2093
- }, we = 20, Te = ({ isOpen: e, objectNames: t, objectKeys: n, container: r, account: i, onClose: a, onSuccess: s, onError: c }) => {
2094
- let { i18n: l, _: u } = J(), d = te(), f = S.useUtils(), p = S.storage.swift.bulkDelete.useMutation({
2095
- onSuccess: (e) => {
2096
- if (f.storage.swift.listObjects.invalidate({ container: r }), e.errors.length > 0) {
2097
- let t = e.errors.map((e) => `${e.path}: ${e.error}`).join("\n"), i = new Set(e.errors.map((e) => e.path)), a = n.filter((e) => !i.has(`/${encodeURIComponent(r)}/${encodeURIComponent(e)}`)), { numberDeleted: o } = e, s = o > 0 ? `${l._({
2098
- id: "Q9f2QF",
2099
- values: { numberDeleted: o }
2100
- })}\n${t}` : t;
2101
- c?.(s, a);
2102
- } else s?.(e.numberDeleted);
2103
- },
2104
- onError: (e) => {
2105
- c?.(e.message, []);
2106
- },
2107
- onSettled: () => {
2108
- m();
2109
- }
2110
- }), m = () => {
2111
- p.reset(), a();
2112
- }, h = () => {
2113
- let e = n.map((e) => `/${encodeURIComponent(r)}/${encodeURIComponent(e)}`);
2114
- p.mutate({
2115
- project_id: d,
2116
- objects: e,
2117
- ...i ? { account: i } : {}
2118
- });
2119
- };
2120
- if (!e || n.length === 0) return null;
2121
- let g = n.length, v = t.slice(0, we), y = g - v.length, b = p.isPending;
2122
- return /* @__PURE__ */ R(ee, {
2123
- title: l._({ id: "p6CSHM" }),
2124
- open: e,
2125
- onCancel: m,
2126
- confirmButtonLabel: b ? l._({ id: "EF2EU9" }) : l._({ id: "cnGeoo" }),
2127
- confirmButtonVariant: "primary-danger",
2128
- cancelButtonLabel: l._({ id: "dEgA5A" }),
2129
- onConfirm: h,
2130
- disableConfirmButton: b,
2131
- disableCancelButton: b,
2132
- disableCloseButton: b,
2133
- size: "small",
2134
- children: b ? /* @__PURE__ */ R(_, {
2135
- distribution: "center",
2136
- alignment: "center",
2137
- className: "py-4",
2138
- children: /* @__PURE__ */ R(o, { variant: "primary" })
2139
- }) : /* @__PURE__ */ z("div", {
2140
- className: "my-6",
2141
- children: [/* @__PURE__ */ R("p", {
2142
- className: "text-theme-default mb-6",
2143
- children: /* @__PURE__ */ R(q, { id: "xYrGVV" })
2144
- }), /* @__PURE__ */ z("div", {
2145
- className: "mb-6",
2146
- children: [/* @__PURE__ */ R("h3", {
2147
- className: "jn:text-theme-high mb-3 font-semibold",
2148
- children: /* @__PURE__ */ R(q, {
2149
- id: "B2i9cQ",
2150
- values: { totalCount: g }
2151
- })
2152
- }), /* @__PURE__ */ z("div", {
2153
- className: "jn:bg-theme-background-lvl-1 max-h-48 overflow-y-auto rounded p-4",
2154
- children: [/* @__PURE__ */ R("ul", {
2155
- className: "space-y-1",
2156
- children: v.map((e) => /* @__PURE__ */ R("li", {
2157
- className: "jn:text-theme-default font-mono text-sm",
2158
- children: e
2159
- }, e))
2160
- }), y > 0 && /* @__PURE__ */ R("p", {
2161
- className: "text-theme-light mt-2 text-xs",
2162
- children: /* @__PURE__ */ R(q, {
2163
- id: "yqPflB",
2164
- values: { hiddenCount: y }
2165
- })
2166
- })]
2167
- })]
2168
- })]
2169
- })
2170
- });
2171
- };
2172
- //#endregion
2173
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Swift/Objects/ObjectToastNotifications.tsx
2174
- function $({ title: e, description: t }) {
2175
- return /* @__PURE__ */ z(_, {
2176
- direction: "vertical",
2177
- gap: "1.5",
2178
- children: [/* @__PURE__ */ R("span", { children: e }), /* @__PURE__ */ R("span", {
2179
- className: "text-theme-light",
2180
- children: t
2181
- })]
2182
- });
2183
- }
2184
- var Ee = (e, t) => ({
2185
- variant: "success",
2186
- autoDismiss: !0,
2187
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2188
- onDismiss: t.onDismiss,
2189
- children: /* @__PURE__ */ R($, {
2190
- title: /* @__PURE__ */ R(q, { id: "6KRclz" }),
2191
- description: /* @__PURE__ */ R(q, {
2192
- id: "KsnZ3m",
2193
- values: { folderName: e }
2194
- })
2195
- })
2196
- }), De = (e, t, n) => ({
2197
- variant: "error",
2198
- autoDismiss: !0,
2199
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2200
- onDismiss: n.onDismiss,
2201
- children: /* @__PURE__ */ R($, {
2202
- title: /* @__PURE__ */ R(q, { id: "q88/6A" }),
2203
- description: /* @__PURE__ */ R(q, {
2204
- id: "NW4PIb",
2205
- values: {
2206
- folderName: e,
2207
- errorMessage: t
2208
- }
2209
- })
2210
- })
2211
- }), Oe = (e, t, n) => ({
2212
- variant: "success",
2213
- autoDismiss: !0,
2214
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2215
- onDismiss: n.onDismiss,
2216
- children: /* @__PURE__ */ R($, {
2217
- title: /* @__PURE__ */ R(q, { id: "J7+bZb" }),
2218
- description: t === 0 ? /* @__PURE__ */ R(q, {
2219
- id: "qUlxA+",
2220
- values: { folderName: e }
2221
- }) : t === 1 ? /* @__PURE__ */ R(q, {
2222
- id: "LQQCas",
2223
- values: {
2224
- folderName: e,
2225
- deletedCount: t
2226
- }
2227
- }) : /* @__PURE__ */ R(q, {
2228
- id: "jK6wqe",
2229
- values: {
2230
- folderName: e,
2231
- deletedCount: t
2232
- }
2233
- })
2234
- })
2235
- }), ke = (e, t, n) => ({
2236
- variant: "error",
2237
- autoDismiss: !0,
2238
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2239
- onDismiss: n.onDismiss,
2240
- children: /* @__PURE__ */ R($, {
2241
- title: /* @__PURE__ */ R(q, { id: "Uj+n/2" }),
2242
- description: /* @__PURE__ */ R(q, {
2243
- id: "2dnZwV",
2244
- values: {
2245
- folderName: e,
2246
- errorMessage: t
2247
- }
2248
- })
2249
- })
2250
- }), Ae = (e, t, n) => ({
2251
- variant: "error",
2252
- autoDismiss: !0,
2253
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2254
- onDismiss: n.onDismiss,
2255
- children: /* @__PURE__ */ R($, {
2256
- title: /* @__PURE__ */ R(q, { id: "hPz54a" }),
2257
- description: /* @__PURE__ */ R(q, {
2258
- id: "/1MfrG",
2259
- values: {
2260
- objectName: e,
2261
- errorMessage: t
2262
- }
2263
- })
2264
- })
2265
- }), je = (e, t) => ({
2266
- variant: "success",
2267
- autoDismiss: !0,
2268
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2269
- onDismiss: t.onDismiss,
2270
- children: /* @__PURE__ */ R($, {
2271
- title: /* @__PURE__ */ R(q, { id: "z9NAjZ" }),
2272
- description: /* @__PURE__ */ R(q, {
2273
- id: "HlwgQN",
2274
- values: { objectName: e }
2275
- })
2276
- })
2277
- }), Me = (e, t, n) => ({
2278
- variant: "error",
2279
- autoDismiss: !0,
2280
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2281
- onDismiss: n.onDismiss,
2282
- children: /* @__PURE__ */ R($, {
2283
- title: /* @__PURE__ */ R(q, { id: "RSg/pq" }),
2284
- description: /* @__PURE__ */ R(q, {
2285
- id: "/LqWNN",
2286
- values: {
2287
- objectName: e,
2288
- errorMessage: t
2289
- }
2290
- })
2291
- })
2292
- }), Ne = (e, t, n, r) => {
2293
- let i = n ? `${t}/${n}` : t;
2294
- return {
2295
- variant: "success",
2296
- autoDismiss: !0,
2297
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
2298
- onDismiss: r.onDismiss,
2299
- children: /* @__PURE__ */ R($, {
2300
- title: /* @__PURE__ */ R(q, { id: "Lylr9Z" }),
2301
- description: /* @__PURE__ */ R(q, {
2302
- id: "5aNQ3F",
2303
- values: {
2304
- objectName: e,
2305
- destination: i
2306
- }
2307
- })
2308
- })
2309
- };
2310
- }, Pe = (e, t, n) => ({
2311
- variant: "error",
2312
- autoDismiss: !0,
2313
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2314
- onDismiss: n.onDismiss,
2315
- children: /* @__PURE__ */ R($, {
2316
- title: /* @__PURE__ */ R(q, { id: "tOkmLM" }),
2317
- description: /* @__PURE__ */ R(q, {
2318
- id: "tlfxPP",
2319
- values: {
2320
- objectName: e,
2321
- errorMessage: t
2322
- }
2323
- })
2324
- })
2325
- }), Fe = (e, t, n, r) => {
2326
- let i = n ? `${t}/${n}` : t;
2327
- return {
2328
- variant: "success",
2329
- autoDismiss: !0,
2330
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
2331
- onDismiss: r.onDismiss,
2332
- children: /* @__PURE__ */ R($, {
2333
- title: /* @__PURE__ */ R(q, { id: "6luZQA" }),
2334
- description: /* @__PURE__ */ R(q, {
2335
- id: "6X/9Di",
2336
- values: {
2337
- objectName: e,
2338
- destination: i
2339
- }
2340
- })
2341
- })
2342
- };
2343
- }, Ie = (e, t, n) => ({
2344
- variant: "error",
2345
- autoDismiss: !0,
2346
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2347
- onDismiss: n.onDismiss,
2348
- children: /* @__PURE__ */ R($, {
2349
- title: /* @__PURE__ */ R(q, { id: "SCY5an" }),
2350
- description: /* @__PURE__ */ R(q, {
2351
- id: "y1GYnY",
2352
- values: {
2353
- objectName: e,
2354
- errorMessage: t
2355
- }
2356
- })
2357
- })
2358
- }), Le = (e, t) => ({
2359
- variant: "success",
2360
- autoDismiss: !0,
2361
- autoDismissTimeout: t.autoDismissTimeout ?? 4e3,
2362
- onDismiss: t.onDismiss,
2363
- children: /* @__PURE__ */ R($, {
2364
- title: /* @__PURE__ */ R(q, { id: "U/oahm" }),
2365
- description: /* @__PURE__ */ R(q, {
2366
- id: "g8Yxlg",
2367
- values: { objectName: e }
2368
- })
2369
- })
2370
- }), Re = (e, t) => ({
2371
- variant: "success",
2372
- autoDismiss: !0,
2373
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2374
- onDismiss: t.onDismiss,
2375
- children: /* @__PURE__ */ R($, {
2376
- title: /* @__PURE__ */ R(q, { id: "YRexkb" }),
2377
- description: /* @__PURE__ */ R(q, {
2378
- id: "sXd+qS",
2379
- values: { objectName: e }
2380
- })
2381
- })
2382
- }), ze = (e, t, n) => ({
2383
- variant: "error",
2384
- autoDismiss: !0,
2385
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2386
- onDismiss: n.onDismiss,
2387
- children: /* @__PURE__ */ R($, {
2388
- title: /* @__PURE__ */ R(q, { id: "4t33sh" }),
2389
- description: /* @__PURE__ */ R(q, {
2390
- id: "HQH8HM",
2391
- values: {
2392
- objectName: e,
2393
- errorMessage: t
2394
- }
2395
- })
2396
- })
2397
- }), Be = (e, t) => ({
2398
- variant: "success",
2399
- autoDismiss: !0,
2400
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2401
- onDismiss: t.onDismiss,
2402
- children: /* @__PURE__ */ R($, {
2403
- title: /* @__PURE__ */ R(q, { id: "xqhyRT" }),
2404
- description: /* @__PURE__ */ R(q, {
2405
- id: "4h3Eyf",
2406
- values: { objectName: e }
2407
- })
2408
- })
2409
- }), Ve = (e, t) => ({
2410
- variant: "warning",
2411
- autoDismiss: !0,
2412
- autoDismissTimeout: t.autoDismissTimeout ?? 4e3,
2413
- onDismiss: t.onDismiss,
2414
- children: /* @__PURE__ */ R($, {
2415
- title: /* @__PURE__ */ R(q, { id: "nZbdB+" }),
2416
- description: /* @__PURE__ */ R(q, {
2417
- id: "pU25+T",
2418
- values: { objectName: e }
2419
- })
2420
- })
2421
- }), He = (e, t, n) => ({
2422
- variant: "error",
2423
- autoDismiss: !0,
2424
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
2425
- onDismiss: n.onDismiss,
2426
- children: /* @__PURE__ */ R($, {
2427
- title: /* @__PURE__ */ R(q, { id: "VakxP/" }),
2428
- description: /* @__PURE__ */ R(q, {
2429
- id: "tfAKBU",
2430
- values: {
2431
- objectName: e,
2432
- errorMessage: t
2433
- }
2434
- })
2435
- })
2436
- }), Ue = (e, t) => ({
2437
- variant: "success",
2438
- autoDismiss: !0,
2439
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2440
- onDismiss: t.onDismiss,
2441
- children: /* @__PURE__ */ R($, {
2442
- title: /* @__PURE__ */ R(q, { id: "W9PZE0" }),
2443
- description: e === 1 ? /* @__PURE__ */ R(q, {
2444
- id: "8ZOb7O",
2445
- values: { numberDeleted: e }
2446
- }) : /* @__PURE__ */ R(q, {
2447
- id: "X70LXS",
2448
- values: { numberDeleted: e }
2449
- })
2450
- })
2451
- }), We = (e, t) => ({
2452
- variant: "error",
2453
- autoDismiss: !0,
2454
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
2455
- onDismiss: t.onDismiss,
2456
- children: /* @__PURE__ */ R($, {
2457
- title: /* @__PURE__ */ R(q, { id: "bYRFNi" }),
2458
- description: /* @__PURE__ */ z("span", { children: [/* @__PURE__ */ R(q, { id: "fCPhho" }), /* @__PURE__ */ R("span", {
2459
- className: "mt-1 block text-xs whitespace-pre-wrap",
2460
- children: e
2461
- })] })
2462
- })
2463
- }), Ge = (e) => {
2464
- let t = new TextEncoder().encode(e), n = Array.from(t, (e) => String.fromCodePoint(e)).join("");
2465
- return btoa(n);
2466
- }, Ke = (e) => {
2467
- if (!e) return "";
2468
- try {
2469
- let t = atob(e), n = Uint8Array.from(t, (e) => e.codePointAt(0));
2470
- return new TextDecoder().decode(n);
2471
- } catch {
2472
- return "";
2473
- }
2474
- };
2475
- function qe(e, t) {
2476
- let n = [], r = [], i = /* @__PURE__ */ new Set();
2477
- for (let a of e) {
2478
- let e = a.name.startsWith(t) ? a.name.slice(t.length) : a.name;
2479
- if (e === "" || e === "/") continue;
2480
- let o = e.indexOf("/");
2481
- if (o > 0) {
2482
- let r = t + e.slice(0, o + 1);
2483
- i.has(r) || (i.add(r), n.push({
2484
- kind: "folder",
2485
- name: r,
2486
- displayName: e.slice(0, o)
2487
- }));
2488
- continue;
2489
- }
2490
- if ((a.content_type === "application/directory" || a.name.endsWith("/")) && (o === -1 || o === e.length - 1)) {
2491
- let t = a.name.endsWith("/") ? a.name : a.name + "/";
2492
- i.has(t) || (i.add(t), n.push({
2493
- kind: "folder",
2494
- name: t,
2495
- displayName: e.replace(/\/$/, "")
2496
- }));
2497
- continue;
2498
- }
2499
- r.push({
2500
- kind: "object",
2501
- name: a.name,
2502
- displayName: e,
2503
- bytes: a.bytes,
2504
- last_modified: a.last_modified,
2505
- content_type: a.content_type
2506
- });
2507
- }
2508
- return [...n, ...r];
2509
- }
2510
- var Je = [
2511
- "name",
2512
- "last_modified",
2513
- "bytes"
2514
- ], Ye = (e) => {
2515
- if (typeof e == "string") return Je.includes(e) ? e : void 0;
2516
- if (typeof e == "number") return Je[e];
2517
- if (Array.isArray(e)) {
2518
- let t = e[0];
2519
- return typeof t == "string" && Je.includes(t) ? t : void 0;
2520
- }
2521
- }, Xe = () => {
2522
- let { i18n: e, _: t } = J(), n = te(), r = G({ from: P.fullPath }), { provider: a, containerName: s } = K({ from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/" }), { prefix: c, sortBy: l, sortDirection: u, search: d = "" } = P.useSearch(), p = Ke(c), [m, h] = W(!1), [g, ee] = W(!1), [v, y] = W(!1), [b, x] = W([]);
2523
- H(() => {
2524
- x([]);
2525
- }, [p]);
2526
- let [C, w] = W(null), T = () => w(null), E = (e) => w(Ee(e, { onDismiss: T })), D = (e, t) => w(De(e, t, { onDismiss: T })), O = (e) => w(Be(e, { onDismiss: T })), k = (e) => w(Ve(e, { onDismiss: T })), A = (e, t) => w(He(e, t, { onDismiss: T })), j = (e, t) => {
2527
- w(Oe(e, Math.max(0, t - 1), { onDismiss: T }));
2528
- }, M = (e, t) => w(ke(e, t, { onDismiss: T })), N = (e, t) => w(Ae(e, t, { onDismiss: T })), F = (e) => {
2529
- x((t) => t.filter((t) => t !== e)), w(je(e, { onDismiss: T }));
2530
- }, L = (e, t) => w(Me(e, t, { onDismiss: T })), V = (e, t, n) => w(Ne(e, t, n, { onDismiss: T })), U = (e, t) => w(Pe(e, t, { onDismiss: T })), Y = (e, t, n) => {
2531
- x((t) => t.filter((t) => t !== e)), w(Fe(e, t, n, { onDismiss: T }));
2532
- }, ne = (e, t) => w(Ie(e, t, { onDismiss: T })), re = (e) => w(Le(e, { onDismiss: T })), ie = (e) => w(Re(e, { onDismiss: T })), ae = (e, t) => w(ze(e, t, { onDismiss: T })), oe = (e) => {
2533
- x([]), w(Ue(e, { onDismiss: T }));
2534
- }, se = (e, t) => {
2535
- t.length > 0 && x((e) => e.filter((e) => !t.includes(e))), w(We(e, { onDismiss: T }));
2536
- }, ce = {
2537
- options: [
2538
- {
2539
- label: e._({ id: "6YtxFj" }),
2540
- value: "name"
2541
- },
2542
- {
2543
- label: e._({ id: "sjMCOP" }),
2544
- value: "last_modified"
2545
- },
2546
- {
2547
- label: e._({ id: "Cj2Gtd" }),
2548
- value: "bytes"
2549
- }
2550
- ],
2551
- sortBy: l ?? void 0,
2552
- sortDirection: u ?? "asc"
2553
- }, { data: X, isLoading: Z, error: Q } = S.storage.swift.listObjects.useQuery({
2554
- project_id: n,
2555
- container: s,
2556
- format: "json",
2557
- prefix: p || void 0
2558
- }), le = () => {
2559
- r({
2560
- to: "/projects/$projectId/storage/$provider/containers",
2561
- params: {
2562
- projectId: n,
2563
- provider: a
2564
- }
2565
- });
2566
- }, ue = (e) => {
2567
- x([]), r({ search: (t) => ({
2568
- ...t,
2569
- prefix: Ge(e)
2570
- }) });
2571
- }, de = qe(X ?? [], p).filter((e) => e.displayName.toLowerCase().includes(d.toLowerCase().trim())), fe = l ? [...de].sort((e, t) => {
2572
- let n = 0;
2573
- switch (l) {
2574
- case "name":
2575
- n = e.displayName.localeCompare(t.displayName);
2576
- break;
2577
- case "last_modified": {
2578
- let r = e.kind === "object" ? e.last_modified : void 0, i = t.kind === "object" ? t.last_modified : void 0;
2579
- if (!r || !i) break;
2580
- n = new Date(r).getTime() - new Date(i).getTime();
2581
- break;
2582
- }
2583
- case "bytes":
2584
- n = (e.kind === "object" ? e.bytes : 0) - (t.kind === "object" ? t.bytes : 0);
2585
- break;
2586
- }
2587
- return (u ?? "asc") === "desc" ? -n : n;
2588
- }) : de, pe = (e) => {
2589
- let t = typeof e == "string" ? e : "";
2590
- B(() => {
2591
- r({ search: (e) => ({
2592
- ...e,
2593
- search: t || void 0
2594
- }) });
2595
- });
2596
- }, me = (e) => {
2597
- let t = Ye(e.sortBy), n = e.sortDirection || "asc";
2598
- B(() => {
2599
- r({ search: (e) => ({
2600
- ...e,
2601
- sortBy: t,
2602
- sortDirection: t ? n : void 0
2603
- }) });
2604
- });
2605
- };
2606
- if (Z) return /* @__PURE__ */ z(_, {
2607
- className: "fixed inset-0",
2608
- distribution: "center",
2609
- alignment: "center",
2610
- direction: "vertical",
2611
- children: [/* @__PURE__ */ R(o, {
2612
- variant: "primary",
2613
- size: "large",
2614
- className: "mb-2"
2615
- }), /* @__PURE__ */ R(q, { id: "GEgjm+" })]
2616
- });
2617
- if (Q) {
2618
- let e = Q.message;
2619
- return /* @__PURE__ */ R(_, {
2620
- className: "fixed inset-0",
2621
- distribution: "center",
2622
- alignment: "center",
2623
- direction: "vertical",
2624
- children: /* @__PURE__ */ R(q, {
2625
- id: "BP4Fwj",
2626
- values: { errorMessage: e }
2627
- })
2628
- });
2629
- }
2630
- let he = b.length > 0, ge = b.length, _e = b.map((e) => fe.find((t) => t.name === e)?.displayName ?? e);
2631
- return /* @__PURE__ */ z("div", {
2632
- className: "relative",
2633
- children: [
2634
- /* @__PURE__ */ R(xe, {
2635
- containerName: s,
2636
- currentPrefix: p,
2637
- onContainersClick: le,
2638
- onPrefixClick: ue
2639
- }),
2640
- /* @__PURE__ */ R(I, {
2641
- sortSettings: ce,
2642
- searchTerm: d,
2643
- onSort: me,
2644
- onSearch: pe,
2645
- actions: /* @__PURE__ */ z(_, {
2646
- direction: "horizontal",
2647
- gap: "2",
2648
- children: [
2649
- /* @__PURE__ */ R(f, {
2650
- variant: "primary",
2651
- onClick: () => h(!0),
2652
- children: /* @__PURE__ */ R(q, { id: "boJ+Y1" })
2653
- }),
2654
- /* @__PURE__ */ R(f, {
2655
- onClick: () => ee(!0),
2656
- children: /* @__PURE__ */ R(q, { id: "MXoA/6" })
2657
- }),
2658
- /* @__PURE__ */ R(f, {
2659
- variant: "primary-danger",
2660
- onClick: () => y(!0),
2661
- disabled: !he,
2662
- children: he ? /* @__PURE__ */ R(q, {
2663
- id: "3AUpb4",
2664
- values: { selectedCount: ge }
2665
- }) : /* @__PURE__ */ R(q, { id: "KZN4Lc" })
2666
- })
2667
- ]
2668
- })
2669
- }),
2670
- /* @__PURE__ */ R(ve, {
2671
- rows: fe,
2672
- searchTerm: d,
2673
- container: s,
2674
- onFolderClick: ue,
2675
- onDeleteFolderSuccess: j,
2676
- onDeleteFolderError: M,
2677
- onDownloadError: N,
2678
- onDeleteObjectSuccess: F,
2679
- onDeleteObjectError: L,
2680
- onCopyObjectSuccess: V,
2681
- onCopyObjectError: U,
2682
- onMoveObjectSuccess: Y,
2683
- onMoveObjectError: ne,
2684
- onTempUrlCopySuccess: re,
2685
- onEditMetadataSuccess: ie,
2686
- onEditMetadataError: ae,
2687
- selectedObjects: b,
2688
- setSelectedObjects: x
2689
- }),
2690
- /* @__PURE__ */ R(Te, {
2691
- isOpen: v,
2692
- objectNames: _e,
2693
- objectKeys: b,
2694
- container: s,
2695
- onClose: () => y(!1),
2696
- onSuccess: oe,
2697
- onError: se
2698
- }),
2699
- /* @__PURE__ */ R(Se, {
2700
- isOpen: m,
2701
- currentPrefix: p,
2702
- onClose: () => h(!1),
2703
- onSuccess: E,
2704
- onError: D
2705
- }),
2706
- /* @__PURE__ */ R(Ce, {
2707
- projectId: n,
2708
- isOpen: g,
2709
- currentPrefix: p,
2710
- container: s,
2711
- onClose: () => ee(!1),
2712
- onSuccess: O,
2713
- onCancelled: k,
2714
- onError: A
2715
- }),
2716
- C && /* @__PURE__ */ R(i, {
2717
- ...C,
2718
- className: "border-theme-light fixed top-5 right-5 z-50 rounded-lg border shadow-lg"
2719
- })
2720
- ]
2721
- });
2722
- };
2723
- //#endregion
2724
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/DeleteObjectModal.tsx
2725
- function Ze({ bucketName: e, objectKey: t, objectSize: n, lastModified: r, isOpen: i, onClose: a, onSuccess: o, onError: c }) {
2726
- let { i18n: l, _: u } = J(), d = te(), [p, m] = W(""), h = S.useUtils(), g = S.storage.ceph.objects.delete.useMutation({
2727
- onSuccess: () => {
2728
- h.storage.ceph.objects.list.invalidate(), o(t), v();
2729
- },
2730
- onError: (e) => {
2731
- c(t, e.message);
2732
- }
2733
- }), v = () => {
2734
- m(""), g.reset(), a();
2735
- }, y = () => {
2736
- d && g.mutate({
2737
- project_id: d,
2738
- containerName: e,
2739
- objectKey: t
2740
- });
2741
- }, b = t.endsWith("/"), x = t.split("/").filter(Boolean).pop() || t, C = p === "DELETE";
2742
- return /* @__PURE__ */ z(ee, {
2743
- open: i,
2744
- onCancel: v,
2745
- title: b ? /* @__PURE__ */ R(q, { id: "97QUV6" }) : /* @__PURE__ */ R(q, { id: "JT+lLV" }),
2746
- size: "large",
2747
- children: [/* @__PURE__ */ z(_, {
2748
- direction: "vertical",
2749
- gap: "4",
2750
- children: [
2751
- /* @__PURE__ */ R("p", { children: b ? /* @__PURE__ */ R(q, { id: "gJKQwG" }) : /* @__PURE__ */ R(q, { id: "uFQALo" }) }),
2752
- /* @__PURE__ */ R("div", {
2753
- className: "bg-theme-background-lvl-2 rounded p-4",
2754
- children: /* @__PURE__ */ z(_, {
2755
- direction: "vertical",
2756
- gap: "2",
2757
- children: [
2758
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("span", {
2759
- className: "text-juno-grey-light-1 text-sm",
2760
- children: /* @__PURE__ */ R(q, { id: "M8er/5" })
2761
- }), /* @__PURE__ */ R("div", {
2762
- className: "mt-1 font-mono text-sm",
2763
- children: x
2764
- })] }),
2765
- !b && n !== void 0 && /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("span", {
2766
- className: "text-juno-grey-light-1 text-sm",
2767
- children: /* @__PURE__ */ R(q, { id: "QdGvPV" })
2768
- }), /* @__PURE__ */ R("div", {
2769
- className: "mt-1 font-mono text-sm",
2770
- children: F(n)
2771
- })] }),
2772
- !b && r && /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("span", {
2773
- className: "text-juno-grey-light-1 text-sm",
2774
- children: /* @__PURE__ */ R(q, { id: "8BjKi0" })
2775
- }), /* @__PURE__ */ R("div", {
2776
- className: "mt-1 font-mono text-sm",
2777
- children: new Date(r).toLocaleString()
2778
- })] }),
2779
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("span", {
2780
- className: "text-juno-grey-light-1 text-sm",
2781
- children: /* @__PURE__ */ R(q, { id: "t/cZdQ" })
2782
- }), /* @__PURE__ */ R("div", {
2783
- className: "mt-1 font-mono text-sm break-all",
2784
- children: t
2785
- })] })
2786
- ]
2787
- })
2788
- }),
2789
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
2790
- className: "text-juno-red mb-2 text-sm",
2791
- children: /* @__PURE__ */ R(q, { id: "2xOCJW" })
2792
- }), /* @__PURE__ */ R(s, {
2793
- label: l._({ id: "sCPiLi" }),
2794
- value: p,
2795
- onChange: (e) => m(e.target.value),
2796
- placeholder: "DELETE",
2797
- autoFocus: !0
2798
- })] }),
2799
- g.error && /* @__PURE__ */ z("p", {
2800
- className: "text-juno-red text-sm",
2801
- children: [
2802
- /* @__PURE__ */ R(q, { id: "4BITzH" }),
2803
- " ",
2804
- g.error.message
2805
- ]
2806
- })
2807
- ]
2808
- }), /* @__PURE__ */ z("div", {
2809
- className: "mt-6 flex justify-end gap-2",
2810
- children: [/* @__PURE__ */ R(f, {
2811
- variant: "subdued",
2812
- onClick: v,
2813
- disabled: g.isPending,
2814
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
2815
- }), /* @__PURE__ */ R(f, {
2816
- variant: "primary-danger",
2817
- onClick: y,
2818
- disabled: !C || g.isPending,
2819
- children: g.isPending ? /* @__PURE__ */ R(q, { id: "EF2EU9" }) : /* @__PURE__ */ R(q, { id: "cnGeoo" })
2820
- })]
2821
- })]
2822
- });
2823
- }
2824
- //#endregion
2825
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/utils/objectValidation.ts
2826
- var Qe = (e, t, n = "") => {
2827
- let r = e.trim();
2828
- if (!r) return {
2829
- type: "required",
2830
- message: { id: "Fzrzfe" }
2831
- };
2832
- if (r.includes("/")) return {
2833
- type: "slashes",
2834
- message: { id: "Vl4XTj" }
2835
- };
2836
- if (r !== e) return {
2837
- type: "whitespace",
2838
- message: { id: "gFKJBP" }
2839
- };
2840
- if (r.length > 255) return {
2841
- type: "too-long",
2842
- message: { id: "4bLttB" }
2843
- };
2844
- let i = `${n}${r}/`;
2845
- return t.includes(i) ? {
2846
- type: "duplicate",
2847
- message: { id: "/Qox3b" }
2848
- } : null;
2849
- }, $e = (e) => {
2850
- let t = e.trim();
2851
- return t ? t.includes("/") ? {
2852
- type: "slashes",
2853
- message: { id: "NZJhro" }
2854
- } : t === e ? null : {
2855
- type: "whitespace",
2856
- message: { id: "Erlvqg" }
2857
- } : {
2858
- type: "required",
2859
- message: { id: "MtzSbv" }
2860
- };
2861
- }, et = (e) => e.trim() ? /^[a-zA-Z0-9_-]+$/.test(e) ? /[a-zA-Z0-9]/.test(e) ? null : {
2862
- type: "invalid-chars",
2863
- message: { id: "dTNzBI" }
2864
- } : {
2865
- type: "invalid-chars",
2866
- message: { id: "BGsuZN" }
2867
- } : {
2868
- type: "required",
2869
- message: { id: "QV1ZPO" }
2870
- }, tt = (e, t) => {
2871
- let { i18n: n, _: r } = J(), [i, a] = W(""), [o, s] = W(""), [c, l] = W(null), [u, d] = W(!1), f = V((e) => {
2872
- a(e), d(!1), s(""), l(null);
2873
- }, []);
2874
- return {
2875
- currentPrefix: i,
2876
- newFolderName: o,
2877
- newFolderError: c,
2878
- showNewFolderInput: u,
2879
- navigateToPrefix: f,
2880
- navigateUp: V(() => {
2881
- if (!i) return;
2882
- let e = i.replace(/\/$/, "").split("/");
2883
- e.pop(), f(e.length > 0 ? e.join("/") + "/" : "");
2884
- }, [i, f]),
2885
- startCreateFolder: V(() => {
2886
- d(!0), s(""), l(null);
2887
- }, []),
2888
- cancelCreateFolder: V(() => {
2889
- d(!1), s(""), l(null);
2890
- }, []),
2891
- setNewFolderName: V((e) => {
2892
- s(e), c && l(null);
2893
- }, [c]),
2894
- createFolder: V(() => {
2895
- let r = Qe(o, e.map((e) => e.name), i);
2896
- if (r) return l(n._(r.message)), null;
2897
- let c = `${i}${o.trim()}/`;
2898
- return t?.(c), s(""), d(!1), l(null), a(c), c;
2899
- }, [
2900
- o,
2901
- e,
2902
- i,
2903
- t,
2904
- r
2905
- ]),
2906
- reset: V(() => {
2907
- a(""), s(""), l(null), d(!1);
2908
- }, [])
2909
- };
2910
- }, nt = 50, rt = (e) => {
2911
- let [t, n] = W(""), [r, i] = W(""), a = U(null);
2912
- H(() => () => {
2913
- a.current && clearTimeout(a.current);
2914
- }, []);
2915
- let o = V((e) => {
2916
- let t = e.target.value;
2917
- n(t), a.current && clearTimeout(a.current), a.current = setTimeout(() => i(t), 300);
2918
- }, []), s = V(() => {
2919
- n(""), i(""), a.current && clearTimeout(a.current);
2920
- }, []), c = r.trim().length > 0 ? (e ?? []).filter((e) => e.name.toLowerCase().includes(r.toLowerCase())) : [], l = c.slice(0, nt);
2921
- return {
2922
- searchTerm: t,
2923
- debouncedSearch: r,
2924
- visibleBuckets: l,
2925
- hiddenCount: c.length - l.length,
2926
- handleSearchChange: o,
2927
- reset: s
2928
- };
2929
- }, it = () => {
2930
- let [e, t] = W({});
2931
- return {
2932
- localFolders: e,
2933
- addFolder: V((e, n) => {
2934
- t((t) => ({
2935
- ...t,
2936
- [e]: [...t[e] ?? [], n]
2937
- }));
2938
- }, []),
2939
- clearForBucket: V((e) => {
2940
- t((t) => {
2941
- let n = { ...t };
2942
- return delete n[e], n;
2943
- });
2944
- }, []),
2945
- reset: V(() => {
2946
- t({});
2947
- }, [])
2948
- };
2949
- }, at = ({ initialBucket: e, allBuckets: t, existingRows: n }) => {
2950
- let r = it(), i = tt(n, (e) => {
2951
- r.addFolder(o, e);
2952
- }), a = rt(t), [o, s] = W(e), c = V((e) => {
2953
- s(e), i.reset(), r.clearForBucket(e);
2954
- }, [i, r]), l = V(() => {
2955
- s(e), i.reset(), a.reset(), r.reset();
2956
- }, [
2957
- e,
2958
- i,
2959
- a,
2960
- r
2961
- ]);
2962
- return {
2963
- targetBucket: o,
2964
- setTargetBucket: c,
2965
- ...i,
2966
- ...a,
2967
- ...r,
2968
- resetAll: l
2969
- };
2970
- }, ot = 50, st = ({ isOpen: e, bucketName: t, objectKey: n, objectSize: r, onClose: i, onSuccess: a, onError: c }) => {
2971
- let { i18n: l, _: u } = J(), p = te(), m = S.useUtils(), h = U(""), [y, b] = W(!0), [x, C] = W(!1), [T, E] = W(!1), D = U(null), { data: k, isLoading: j } = S.storage.ceph.containers.list.useQuery({
2972
- project_id: p ?? "",
2973
- includeMetadata: !1
2974
- }, { enabled: e && !!p }), N = at({
2975
- initialBucket: t,
2976
- allBuckets: k ?? [],
2977
- existingRows: []
2978
- }), { data: P, isLoading: F } = S.storage.ceph.objects.list.useQuery({
2979
- project_id: p ?? "",
2980
- containerName: N.targetBucket,
2981
- prefix: N.currentPrefix || void 0,
2982
- delimiter: "/",
2983
- maxKeys: 1e3
2984
- }, { enabled: e && !!N.targetBucket && !!p });
2985
- H(() => {
2986
- e && N.resetAll();
2987
- }, [e]);
2988
- let I = (() => {
2989
- if (!P) return [];
2990
- let e = P.folders.map((e) => ({
2991
- kind: "folder",
2992
- name: e.prefix,
2993
- displayName: N.currentPrefix ? e.prefix.replace(N.currentPrefix, "").replace(/\/$/, "") : e.prefix.replace(/\/$/, "")
2994
- })), t = P.objects.filter((e) => {
2995
- let t = N.currentPrefix ? e.key.replace(N.currentPrefix, "") : e.key;
2996
- return t !== "" && t !== "/";
2997
- }).map((e) => ({
2998
- kind: "object",
2999
- name: e.key,
3000
- displayName: N.currentPrefix ? e.key.replace(N.currentPrefix, "") : e.key
3001
- }));
3002
- return [...e, ...t];
3003
- })(), L = (N.localFolders[N.targetBucket] ?? []).filter((e) => {
3004
- let t = e.startsWith(N.currentPrefix) ? e.slice(N.currentPrefix.length) : null;
3005
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
3006
- }).filter((e) => !I.some((t) => t.name === e)).map((e) => ({
3007
- kind: "folder",
3008
- name: e,
3009
- displayName: e.slice(N.currentPrefix.length).replace(/\/$/, "")
3010
- })), B = [
3011
- ...I.filter((e) => e.kind === "folder"),
3012
- ...L,
3013
- ...I.filter((e) => e.kind === "object")
3014
- ], G = S.storage.ceph.objects.copy.useMutation({
3015
- onSuccess: () => {
3016
- m.storage.ceph.objects.list.invalidate();
3017
- let e = `${N.currentPrefix}${K}`;
3018
- a?.(h.current, N.targetBucket, e, x), re();
3019
- },
3020
- onError: (e) => {
3021
- c?.(h.current, e.message);
3022
- }
3023
- }), K = n.split("/").filter(Boolean).pop() ?? n, Y = V(async () => {
3024
- if (!p || !N.targetBucket) return;
3025
- let e = `${N.currentPrefix}${K}`;
3026
- if (N.targetBucket === t && e === n) {
3027
- C(!1);
3028
- return;
3029
- }
3030
- E(!0);
3031
- try {
3032
- await m.storage.ceph.objects.getDetails.fetch({
3033
- project_id: p,
3034
- containerName: N.targetBucket,
3035
- objectKey: e
3036
- }), C(!0);
3037
- } catch {
3038
- C(!1);
3039
- } finally {
3040
- E(!1);
3041
- }
3042
- }, [
3043
- p,
3044
- N.targetBucket,
3045
- N.currentPrefix,
3046
- K,
3047
- t,
3048
- n,
3049
- m
3050
- ]);
3051
- H(() => {
3052
- e && Y();
3053
- }, [e, Y]);
3054
- let re = () => {
3055
- G.reset(), i();
3056
- }, ie = (e) => {
3057
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
3058
- t && N.setTargetBucket(t);
3059
- }, ae = (e) => {
3060
- e.key === "Enter" && N.createFolder(), e.key === "Escape" && N.cancelCreateFolder();
3061
- }, oe = () => {
3062
- if (!p) return;
3063
- h.current = n;
3064
- let e = `${N.currentPrefix}${K}`;
3065
- G.mutate({
3066
- project_id: p,
3067
- sourceBucket: t,
3068
- sourceKey: n,
3069
- destinationBucket: N.targetBucket,
3070
- destinationKey: e,
3071
- copyMetadata: y
3072
- });
3073
- }, se = B.filter((e) => e.kind === "folder"), ce = B.filter((e) => e.kind === "object"), X = [...se, ...ce], Z = ne({
3074
- count: X.length,
3075
- getScrollElement: () => D.current,
3076
- estimateSize: () => 32,
3077
- overscan: 5
3078
- });
3079
- if (!e) return null;
3080
- let Q = G.isPending, le = F, ue = `${N.targetBucket}/${N.currentPrefix}${K}`, de = n.endsWith(K) ? n.slice(0, n.length - K.length) : "", fe = N.targetBucket === t && N.currentPrefix === de;
3081
- return /* @__PURE__ */ R(ee, {
3082
- title: /* @__PURE__ */ z("span", {
3083
- className: "flex max-w-[500px] items-center gap-1",
3084
- children: [/* @__PURE__ */ R("span", {
3085
- className: "shrink-0",
3086
- children: /* @__PURE__ */ R(q, { id: "V7fN5X" })
3087
- }), /* @__PURE__ */ R("span", {
3088
- className: "truncate font-mono",
3089
- title: K,
3090
- children: K
3091
- })]
3092
- }),
3093
- open: e,
3094
- onCancel: re,
3095
- confirmButtonLabel: Q ? l._({ id: "OvEjsP" }) : l._({ id: "he3ygx" }),
3096
- onConfirm: oe,
3097
- cancelButtonLabel: l._({ id: "dEgA5A" }),
3098
- size: "large",
3099
- disableConfirmButton: Q || j || fe,
3100
- children: Q ? /* @__PURE__ */ z(_, {
3101
- direction: "horizontal",
3102
- alignment: "center",
3103
- gap: "2",
3104
- className: "py-8",
3105
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "QEtDlS" })]
3106
- }) : /* @__PURE__ */ z(_, {
3107
- direction: "vertical",
3108
- gap: "4",
3109
- children: [
3110
- /* @__PURE__ */ z("div", {
3111
- className: "bg-theme-background-lvl-2 rounded p-3",
3112
- children: [
3113
- /* @__PURE__ */ R("div", {
3114
- className: "text-theme-light text-sm",
3115
- children: /* @__PURE__ */ R(q, { id: "dpGL2Q" })
3116
- }),
3117
- /* @__PURE__ */ R("div", {
3118
- className: "mt-1 font-mono text-sm",
3119
- children: `${t}/${n}`
3120
- }),
3121
- r !== void 0 && /* @__PURE__ */ z("div", {
3122
- className: "text-theme-light mt-1 text-xs",
3123
- children: [(r / 1024).toFixed(2), " KB"]
3124
- })
3125
- ]
3126
- }),
3127
- /* @__PURE__ */ R(d, {
3128
- label: l._({ id: "6EcekU" }),
3129
- value: N.targetBucket,
3130
- onChange: ie,
3131
- onInputChange: N.handleSearchChange,
3132
- placeholder: l._({ id: "0XLPG9" }),
3133
- helptext: (() => {
3134
- if (j) return l._({ id: "WV/4x1" });
3135
- if (N.searchTerm.trim().length === 0) return l._({ id: "WzsMfv" });
3136
- if (N.hiddenCount > 0) {
3137
- let e = N.visibleBuckets.length + N.hiddenCount;
3138
- return l._({
3139
- id: "vIxhHW",
3140
- values: {
3141
- MAX_COMBO_OPTIONS: ot,
3142
- totalBuckets: e
3143
- }
3144
- });
3145
- }
3146
- })(),
3147
- disabled: j || Q,
3148
- required: !0,
3149
- children: N.visibleBuckets.map((e) => /* @__PURE__ */ R(g, {
3150
- value: e.name,
3151
- children: e.name
3152
- }, e.name))
3153
- }),
3154
- /* @__PURE__ */ z("div", { children: [
3155
- /* @__PURE__ */ z("div", {
3156
- className: "mb-1 flex items-center justify-between",
3157
- children: [/* @__PURE__ */ R("span", {
3158
- className: "text-sm font-medium",
3159
- children: /* @__PURE__ */ R(q, { id: "Afh/Lb" })
3160
- }), /* @__PURE__ */ R(f, {
3161
- size: "small",
3162
- variant: "subdued",
3163
- icon: "addCircle",
3164
- onClick: N.startCreateFolder,
3165
- disabled: Q,
3166
- title: l._({ id: "mxPfpY" }),
3167
- children: /* @__PURE__ */ R(q, { id: "tX5yOZ" })
3168
- })]
3169
- }),
3170
- /* @__PURE__ */ z("div", {
3171
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
3172
- children: [N.currentPrefix ? /* @__PURE__ */ z("button", {
3173
- type: "button",
3174
- onClick: N.navigateUp,
3175
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
3176
- children: [/* @__PURE__ */ R(M, { size: 16 }), /* @__PURE__ */ R(q, { id: "iH8pgl" })]
3177
- }) : /* @__PURE__ */ R("span", {
3178
- className: "text-theme-light",
3179
- children: /* @__PURE__ */ R(q, { id: "eyRsaH" })
3180
- }), N.currentPrefix && /* @__PURE__ */ z("span", {
3181
- className: "text-theme-light truncate font-mono text-xs",
3182
- children: ["/ ", N.currentPrefix]
3183
- })]
3184
- }),
3185
- /* @__PURE__ */ z("div", {
3186
- ref: D,
3187
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
3188
- children: [le ? /* @__PURE__ */ z(_, {
3189
- direction: "horizontal",
3190
- alignment: "center",
3191
- gap: "2",
3192
- className: "py-6",
3193
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "Z3FXyt" })]
3194
- }) : X.length === 0 && !N.showNewFolderInput ? /* @__PURE__ */ R("div", {
3195
- className: "text-theme-light px-4 py-6 text-center text-sm",
3196
- children: /* @__PURE__ */ R(q, { id: "vcQSZh" })
3197
- }) : /* @__PURE__ */ R("div", {
3198
- style: {
3199
- height: `${Z.getTotalSize()}px`,
3200
- position: "relative"
3201
- },
3202
- children: Z.getVirtualItems().map((e) => {
3203
- let t = X[e.index], n = t.kind === "folder";
3204
- return /* @__PURE__ */ R("div", {
3205
- "data-index": e.index,
3206
- ref: Z.measureElement,
3207
- style: {
3208
- position: "absolute",
3209
- top: 0,
3210
- left: 0,
3211
- width: "100%",
3212
- transform: `translateY(${e.start}px)`
3213
- },
3214
- children: n ? /* @__PURE__ */ z("button", {
3215
- type: "button",
3216
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
3217
- onClick: () => N.navigateToPrefix(t.name),
3218
- children: [/* @__PURE__ */ R(O, {
3219
- size: 16,
3220
- className: "text-theme-light shrink-0"
3221
- }), /* @__PURE__ */ R("span", {
3222
- className: "truncate",
3223
- children: t.displayName
3224
- })]
3225
- }) : /* @__PURE__ */ z("span", {
3226
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
3227
- children: [/* @__PURE__ */ R(A, {
3228
- size: 16,
3229
- className: "shrink-0"
3230
- }), /* @__PURE__ */ R("span", {
3231
- className: "truncate",
3232
- children: t.displayName
3233
- })]
3234
- })
3235
- }, t.name);
3236
- })
3237
- }), N.showNewFolderInput && /* @__PURE__ */ R("div", {
3238
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
3239
- children: /* @__PURE__ */ R(_, {
3240
- direction: "vertical",
3241
- gap: "2",
3242
- children: /* @__PURE__ */ z(_, {
3243
- direction: "horizontal",
3244
- gap: "2",
3245
- alignment: "center",
3246
- children: [
3247
- /* @__PURE__ */ R(w, {
3248
- size: 16,
3249
- className: "text-theme-light shrink-0"
3250
- }),
3251
- /* @__PURE__ */ R(s, {
3252
- value: N.newFolderName,
3253
- onChange: (e) => N.setNewFolderName(e.target.value),
3254
- onKeyDown: ae,
3255
- placeholder: l._({ id: "KzUd7m" }),
3256
- invalid: !!N.newFolderError,
3257
- errortext: N.newFolderError ?? void 0,
3258
- autoFocus: !0,
3259
- className: "flex-1"
3260
- }),
3261
- /* @__PURE__ */ R(f, {
3262
- size: "small",
3263
- variant: "primary",
3264
- onClick: N.createFolder,
3265
- disabled: !N.newFolderName.trim(),
3266
- children: /* @__PURE__ */ R(q, { id: "hYgDIe" })
3267
- }),
3268
- /* @__PURE__ */ R(f, {
3269
- size: "small",
3270
- variant: "subdued",
3271
- onClick: N.cancelCreateFolder,
3272
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
3273
- })
3274
- ]
3275
- })
3276
- })
3277
- })]
3278
- })
3279
- ] }),
3280
- /* @__PURE__ */ R(s, {
3281
- label: l._({ id: "Vh/Uj5" }),
3282
- value: ue,
3283
- readOnly: !0,
3284
- className: "font-mono",
3285
- helptext: l._({ id: "Z/eWPC" })
3286
- }),
3287
- T ? /* @__PURE__ */ R(v, {
3288
- variant: "info",
3289
- children: /* @__PURE__ */ z(_, {
3290
- direction: "horizontal",
3291
- alignment: "center",
3292
- gap: "2",
3293
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "WIJz7N" })]
3294
- })
3295
- }) : x ? /* @__PURE__ */ R(v, {
3296
- variant: "warning",
3297
- children: /* @__PURE__ */ R(q, { id: "G3pRO8" })
3298
- }) : null,
3299
- /* @__PURE__ */ z("label", {
3300
- className: "flex cursor-pointer items-center gap-2",
3301
- children: [/* @__PURE__ */ R("input", {
3302
- type: "checkbox",
3303
- checked: y,
3304
- onChange: (e) => b(e.target.checked),
3305
- className: "h-4 w-4"
3306
- }), /* @__PURE__ */ R("span", {
3307
- className: "text-sm",
3308
- children: /* @__PURE__ */ R(q, { id: "mqljvE" })
3309
- })]
3310
- }),
3311
- G.isError && (() => {
3312
- let e = G.error.message;
3313
- return /* @__PURE__ */ R(v, {
3314
- variant: "danger",
3315
- children: /* @__PURE__ */ R(q, {
3316
- id: "IOkHLC",
3317
- values: { errorMessage: e }
3318
- })
3319
- });
3320
- })()
3321
- ]
3322
- })
3323
- });
3324
- }, ct = 50, lt = ({ isOpen: e, bucketName: t, objectKey: n, objectSize: r, onClose: i, onSuccess: a, onError: c }) => {
3325
- let { i18n: l, _: u } = J(), p = te(), m = S.useUtils(), h = U(""), y = U(""), b = U(""), [x, C] = W(""), [T, E] = W(null), k = U(null), { data: j, isLoading: N } = S.storage.ceph.containers.list.useQuery({
3326
- project_id: p ?? "",
3327
- includeMetadata: !1
3328
- }, { enabled: e && !!p }), P = at({
3329
- initialBucket: t,
3330
- allBuckets: j ?? [],
3331
- existingRows: []
3332
- }), { data: F, isLoading: I } = S.storage.ceph.objects.list.useQuery({
3333
- project_id: p ?? "",
3334
- containerName: P.targetBucket,
3335
- prefix: P.currentPrefix || void 0,
3336
- delimiter: "/",
3337
- maxKeys: 1e3
3338
- }, { enabled: e && !!P.targetBucket && !!p });
3339
- H(() => {
3340
- e && n && (C(n.split("/").filter(Boolean).pop() ?? n), P.resetAll());
3341
- }, [e, n]), H(() => {
3342
- e || (C(""), E(null));
3343
- }, [e]);
3344
- let L = (() => {
3345
- if (!F) return [];
3346
- let e = F.folders.map((e) => ({
3347
- kind: "folder",
3348
- name: e.prefix,
3349
- displayName: P.currentPrefix ? e.prefix.replace(P.currentPrefix, "").replace(/\/$/, "") : e.prefix.replace(/\/$/, "")
3350
- })), t = F.objects.filter((e) => {
3351
- let t = P.currentPrefix ? e.key.replace(P.currentPrefix, "") : e.key;
3352
- return t !== "" && t !== "/";
3353
- }).map((e) => ({
3354
- kind: "object",
3355
- name: e.key,
3356
- displayName: P.currentPrefix ? e.key.replace(P.currentPrefix, "") : e.key
3357
- }));
3358
- return [...e, ...t];
3359
- })(), B = (P.localFolders[P.targetBucket] ?? []).filter((e) => {
3360
- let t = e.startsWith(P.currentPrefix) ? e.slice(P.currentPrefix.length) : null;
3361
- return t ? t.split("/").filter(Boolean).length === 1 : !1;
3362
- }).filter((e) => !L.some((t) => t.name === e)).map((e) => ({
3363
- kind: "folder",
3364
- name: e,
3365
- displayName: e.slice(P.currentPrefix.length).replace(/\/$/, "")
3366
- })), V = [
3367
- ...L.filter((e) => e.kind === "folder"),
3368
- ...B,
3369
- ...L.filter((e) => e.kind === "object")
3370
- ], G = S.storage.ceph.objects.delete.useMutation({
3371
- onSuccess: () => {
3372
- m.storage.ceph.objects.list.invalidate(), a?.(h.current, b.current, y.current);
3373
- },
3374
- onError: (e) => {
3375
- c?.(h.current, e.message);
3376
- },
3377
- onSettled: () => {
3378
- Y();
3379
- }
3380
- }), K = S.storage.ceph.objects.copy.useMutation({
3381
- onSuccess: () => {
3382
- G.mutate({
3383
- project_id: p ?? "",
3384
- containerName: t,
3385
- objectKey: n
3386
- });
3387
- },
3388
- onError: (e) => {
3389
- c?.(h.current, e.message), Y();
3390
- }
3391
- }), Y = () => {
3392
- K.reset(), G.reset(), i();
3393
- }, re = (e) => {
3394
- let t = Array.isArray(e) ? e[0] : typeof e == "number" ? String(e) : e;
3395
- t && P.setTargetBucket(t);
3396
- }, ie = (e) => {
3397
- e.key === "Enter" && P.createFolder(), e.key === "Escape" && P.cancelCreateFolder();
3398
- }, ae = () => {
3399
- if (!p) return;
3400
- let e = $e(x);
3401
- if (e) {
3402
- E(l._(e.message));
3403
- return;
3404
- }
3405
- let r = x.trim(), i = `${P.currentPrefix}${r}`;
3406
- h.current = n, y.current = i, b.current = P.targetBucket, K.mutate({
3407
- project_id: p,
3408
- sourceBucket: t,
3409
- sourceKey: n,
3410
- destinationBucket: P.targetBucket,
3411
- destinationKey: i,
3412
- copyMetadata: !0
3413
- });
3414
- }, oe = V.filter((e) => e.kind === "folder"), se = V.filter((e) => e.kind === "object"), ce = [...oe, ...se], X = ne({
3415
- count: ce.length,
3416
- getScrollElement: () => k.current,
3417
- estimateSize: () => 32,
3418
- overscan: 5
3419
- });
3420
- if (!e) return null;
3421
- let Z = n.split("/").filter(Boolean).pop() ?? n, Q = K.isPending || G.isPending, le = I, ue = `${P.targetBucket}/${P.currentPrefix}${x.trim() || Z}`, de = n.endsWith(Z) ? n.slice(0, n.length - Z.length) : "", fe = P.targetBucket === t && P.currentPrefix === de && x.trim() === Z;
3422
- return /* @__PURE__ */ R(ee, {
3423
- title: /* @__PURE__ */ z("span", {
3424
- className: "flex max-w-[500px] items-center gap-1",
3425
- children: [/* @__PURE__ */ R("span", {
3426
- className: "shrink-0",
3427
- children: /* @__PURE__ */ R(q, { id: "J6EOll" })
3428
- }), /* @__PURE__ */ R("span", {
3429
- className: "truncate font-mono",
3430
- title: Z,
3431
- children: Z
3432
- })]
3433
- }),
3434
- open: e,
3435
- onCancel: Y,
3436
- confirmButtonLabel: Q ? l._({ id: "K8Qnlj" }) : l._({ id: "QWdKwH" }),
3437
- onConfirm: ae,
3438
- cancelButtonLabel: l._({ id: "dEgA5A" }),
3439
- size: "large",
3440
- disableConfirmButton: Q || N || fe,
3441
- children: Q ? /* @__PURE__ */ z(_, {
3442
- direction: "horizontal",
3443
- alignment: "center",
3444
- gap: "2",
3445
- className: "py-8",
3446
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "1H2g6v" })]
3447
- }) : /* @__PURE__ */ z(_, {
3448
- direction: "vertical",
3449
- gap: "4",
3450
- children: [
3451
- /* @__PURE__ */ R(s, {
3452
- label: l._({ id: "f+Uq1E" }),
3453
- value: x,
3454
- onChange: (e) => {
3455
- C(e.target.value), T && E(null);
3456
- },
3457
- invalid: !!T,
3458
- errortext: T ?? void 0,
3459
- helptext: l._({ id: "rAtQcX" }),
3460
- required: !0
3461
- }),
3462
- /* @__PURE__ */ R(v, {
3463
- variant: "warning",
3464
- children: /* @__PURE__ */ z("div", {
3465
- className: "flex items-start gap-2",
3466
- children: [/* @__PURE__ */ R(D, {
3467
- size: 20,
3468
- className: "shrink-0"
3469
- }), /* @__PURE__ */ z("div", { children: [
3470
- /* @__PURE__ */ R("strong", { children: /* @__PURE__ */ R(q, { id: "5TzHG8" }) }),
3471
- " ",
3472
- /* @__PURE__ */ R(q, { id: "Z8poQH" })
3473
- ] })]
3474
- })
3475
- }),
3476
- /* @__PURE__ */ z("div", {
3477
- className: "bg-theme-background-lvl-2 rounded p-3",
3478
- children: [
3479
- /* @__PURE__ */ R("div", {
3480
- className: "text-theme-light text-sm",
3481
- children: /* @__PURE__ */ R(q, { id: "dpGL2Q" })
3482
- }),
3483
- /* @__PURE__ */ R("div", {
3484
- className: "mt-1 font-mono text-sm",
3485
- children: `${t}/${n}`
3486
- }),
3487
- r !== void 0 && /* @__PURE__ */ z("div", {
3488
- className: "text-theme-light mt-1 text-xs",
3489
- children: [(r / 1024).toFixed(2), " KB"]
3490
- })
3491
- ]
3492
- }),
3493
- /* @__PURE__ */ R(d, {
3494
- label: l._({ id: "6EcekU" }),
3495
- value: P.targetBucket,
3496
- onChange: re,
3497
- onInputChange: P.handleSearchChange,
3498
- placeholder: l._({ id: "0XLPG9" }),
3499
- helptext: (() => {
3500
- if (N) return l._({ id: "WV/4x1" });
3501
- if (P.searchTerm.trim().length === 0) return l._({ id: "WzsMfv" });
3502
- if (P.hiddenCount > 0) {
3503
- let e = P.visibleBuckets.length + P.hiddenCount;
3504
- return l._({
3505
- id: "vIxhHW",
3506
- values: {
3507
- MAX_COMBO_OPTIONS: ct,
3508
- totalBuckets: e
3509
- }
3510
- });
3511
- }
3512
- })(),
3513
- disabled: N || Q,
3514
- required: !0,
3515
- children: P.visibleBuckets.map((e) => /* @__PURE__ */ R(g, {
3516
- value: e.name,
3517
- children: e.name
3518
- }, e.name))
3519
- }),
3520
- /* @__PURE__ */ z("div", { children: [
3521
- /* @__PURE__ */ z("div", {
3522
- className: "mb-1 flex items-center justify-between",
3523
- children: [/* @__PURE__ */ R("span", {
3524
- className: "text-sm font-medium",
3525
- children: /* @__PURE__ */ R(q, { id: "Afh/Lb" })
3526
- }), /* @__PURE__ */ R(f, {
3527
- size: "small",
3528
- variant: "subdued",
3529
- icon: "addCircle",
3530
- onClick: P.startCreateFolder,
3531
- disabled: Q,
3532
- title: l._({ id: "mxPfpY" }),
3533
- children: /* @__PURE__ */ R(q, { id: "tX5yOZ" })
3534
- })]
3535
- }),
3536
- /* @__PURE__ */ z("div", {
3537
- className: "border-theme-background-lvl-2 bg-theme-background-lvl-1 flex items-center gap-2 border-b px-3 py-2 text-sm",
3538
- children: [P.currentPrefix ? /* @__PURE__ */ z("button", {
3539
- type: "button",
3540
- onClick: P.navigateUp,
3541
- className: "text-theme-link hover:text-theme-default flex items-center gap-1",
3542
- children: [/* @__PURE__ */ R(M, { size: 16 }), /* @__PURE__ */ R(q, { id: "iH8pgl" })]
3543
- }) : /* @__PURE__ */ R("span", {
3544
- className: "text-theme-light",
3545
- children: /* @__PURE__ */ R(q, { id: "eyRsaH" })
3546
- }), P.currentPrefix && /* @__PURE__ */ z("span", {
3547
- className: "text-theme-light truncate font-mono text-xs",
3548
- children: ["/ ", P.currentPrefix]
3549
- })]
3550
- }),
3551
- /* @__PURE__ */ z("div", {
3552
- ref: k,
3553
- className: "border-theme-background-lvl-2 max-h-56 overflow-y-auto rounded-b border",
3554
- children: [le ? /* @__PURE__ */ z(_, {
3555
- direction: "horizontal",
3556
- alignment: "center",
3557
- gap: "2",
3558
- className: "py-6",
3559
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "Z3FXyt" })]
3560
- }) : ce.length === 0 && !P.showNewFolderInput ? /* @__PURE__ */ R("div", {
3561
- className: "text-theme-light px-4 py-6 text-center text-sm",
3562
- children: /* @__PURE__ */ R(q, { id: "vcQSZh" })
3563
- }) : /* @__PURE__ */ R("div", {
3564
- style: {
3565
- height: `${X.getTotalSize()}px`,
3566
- position: "relative"
3567
- },
3568
- children: X.getVirtualItems().map((e) => {
3569
- let t = ce[e.index], n = t.kind === "folder";
3570
- return /* @__PURE__ */ R("div", {
3571
- "data-index": e.index,
3572
- ref: X.measureElement,
3573
- style: {
3574
- position: "absolute",
3575
- top: 0,
3576
- left: 0,
3577
- width: "100%",
3578
- transform: `translateY(${e.start}px)`
3579
- },
3580
- children: n ? /* @__PURE__ */ z("button", {
3581
- type: "button",
3582
- className: "hover:bg-theme-background-lvl-2 focus-visible:outline-theme-focus flex w-full items-center gap-2 px-4 py-2 text-left text-sm focus-visible:outline focus-visible:outline-2",
3583
- onClick: () => P.navigateToPrefix(t.name),
3584
- children: [/* @__PURE__ */ R(O, {
3585
- size: 16,
3586
- className: "text-theme-light shrink-0"
3587
- }), /* @__PURE__ */ R("span", {
3588
- className: "truncate",
3589
- children: t.displayName
3590
- })]
3591
- }) : /* @__PURE__ */ z("span", {
3592
- className: "text-theme-light flex items-center gap-2 px-4 py-2 text-sm",
3593
- children: [/* @__PURE__ */ R(A, {
3594
- size: 16,
3595
- className: "shrink-0"
3596
- }), /* @__PURE__ */ R("span", {
3597
- className: "truncate",
3598
- children: t.displayName
3599
- })]
3600
- })
3601
- }, t.name);
3602
- })
3603
- }), P.showNewFolderInput && /* @__PURE__ */ R("div", {
3604
- className: "border-theme-background-lvl-2 border-t px-4 py-3",
3605
- children: /* @__PURE__ */ R(_, {
3606
- direction: "vertical",
3607
- gap: "2",
3608
- children: /* @__PURE__ */ z(_, {
3609
- direction: "horizontal",
3610
- gap: "2",
3611
- alignment: "center",
3612
- children: [
3613
- /* @__PURE__ */ R(w, {
3614
- size: 16,
3615
- className: "text-theme-light shrink-0"
3616
- }),
3617
- /* @__PURE__ */ R(s, {
3618
- value: P.newFolderName,
3619
- onChange: (e) => P.setNewFolderName(e.target.value),
3620
- onKeyDown: ie,
3621
- placeholder: l._({ id: "KzUd7m" }),
3622
- invalid: !!P.newFolderError,
3623
- errortext: P.newFolderError ?? void 0,
3624
- autoFocus: !0,
3625
- className: "flex-1"
3626
- }),
3627
- /* @__PURE__ */ R(f, {
3628
- size: "small",
3629
- variant: "primary",
3630
- onClick: P.createFolder,
3631
- disabled: !P.newFolderName.trim(),
3632
- children: /* @__PURE__ */ R(q, { id: "hYgDIe" })
3633
- }),
3634
- /* @__PURE__ */ R(f, {
3635
- size: "small",
3636
- variant: "subdued",
3637
- onClick: P.cancelCreateFolder,
3638
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
3639
- })
3640
- ]
3641
- })
3642
- })
3643
- })]
3644
- })
3645
- ] }),
3646
- /* @__PURE__ */ R(s, {
3647
- label: l._({ id: "Vh/Uj5" }),
3648
- value: ue,
3649
- readOnly: !0,
3650
- className: "font-mono",
3651
- helptext: fe ? l._({ id: "ZKb0D4" }) : l._({ id: "rlgAtt" }),
3652
- invalid: fe
3653
- }),
3654
- /* @__PURE__ */ R(v, {
3655
- variant: "info",
3656
- children: /* @__PURE__ */ R(q, { id: "TVsqbi" })
3657
- }),
3658
- (K.isError || G.isError) && (() => {
3659
- let e = K.error?.message ?? "", t = G.error?.message ?? "";
3660
- return /* @__PURE__ */ R(v, {
3661
- variant: "danger",
3662
- children: K.isError ? /* @__PURE__ */ R(q, {
3663
- id: "i5MEDc",
3664
- values: { copyErrorMessage: e }
3665
- }) : /* @__PURE__ */ R(q, {
3666
- id: "VoxR3s",
3667
- values: { deleteErrorMessage: t }
3668
- })
3669
- });
3670
- })()
3671
- ]
3672
- })
3673
- });
3674
- }, ut = (e) => {
3675
- let t = new Date(e);
3676
- return isNaN(t.getTime()) ? "—" : t.toLocaleString(void 0, {
3677
- year: "numeric",
3678
- month: "short",
3679
- day: "2-digit",
3680
- hour: "2-digit",
3681
- minute: "2-digit"
3682
- });
3683
- }, dt = (e) => {
3684
- let t = 0;
3685
- for (let n of e) t += 11 + n.key.length + 2 + n.value.length + 2;
3686
- return t;
3687
- }, ft = 2048, pt = ({ isOpen: e, bucketName: t, objectKey: i, onClose: l, onSuccess: u, onError: d }) => {
3688
- let { i18n: p, _: m } = J(), h = te(), g = S.useUtils(), { data: y, isLoading: b, isError: x, error: C } = S.storage.ceph.objects.getDetails.useQuery({
3689
- project_id: h ?? "",
3690
- containerName: t,
3691
- objectKey: i
3692
- }, {
3693
- enabled: e && !!h,
3694
- refetchOnWindowFocus: !1
3695
- }), w = U(0), T = () => ++w.current, [E, D] = W([]), [O, k] = W({}), [A, j] = W(!1), [M, N] = W(""), [P, I] = W(""), [L, B] = W(null), V = U([]), G = U("");
3696
- H(() => {
3697
- if (!y?.metadata) return;
3698
- let e = Object.entries(y.metadata).map(([e, t]) => ({
3699
- uid: T(),
3700
- key: e,
3701
- value: t,
3702
- isEditing: !1,
3703
- originalKey: e,
3704
- originalValue: t
3705
- }));
3706
- D(e), V.current = e.map((e) => ({ ...e }));
3707
- }, [y]), H(() => {
3708
- e || K();
3709
- }, [e]);
3710
- let K = () => {
3711
- D([]), k({}), j(!1), N(""), I(""), B(null), ae.reset();
3712
- }, Y = (() => {
3713
- if (E.length !== V.current.length) return !0;
3714
- let e = new Map(V.current.map((e) => [e.key, e.value]));
3715
- return E.some((t) => e.get(t.key) !== t.value);
3716
- })(), ne = E.some((e) => e.isEditing), re = dt(E), ie = re > ft, ae = S.storage.ceph.objects.updateMetadata.useMutation({
3717
- onSuccess: () => {
3718
- g.storage.ceph.objects.getDetails.invalidate({
3719
- project_id: h ?? "",
3720
- containerName: t,
3721
- objectKey: G.current
3722
- }), g.storage.ceph.objects.list.invalidate(), u?.(G.current), oe();
3723
- },
3724
- onError: (e) => {
3725
- d?.(G.current, e.message);
3726
- }
3727
- }), oe = () => {
3728
- K(), l();
3729
- }, se = () => {
3730
- if (!h || ie) return;
3731
- G.current = i;
3732
- let e = {};
3733
- for (let t of E) e[t.key] = t.value;
3734
- ae.mutate({
3735
- project_id: h,
3736
- containerName: t,
3737
- objectKey: i,
3738
- metadata: e
3739
- });
3740
- }, ce = (e) => {
3741
- D((t) => t.map((t, n) => n === e ? {
3742
- ...t,
3743
- isEditing: !0
3744
- } : t));
3745
- }, X = (e, t) => {
3746
- D((n) => n.map((n, r) => r === e ? {
3747
- ...n,
3748
- key: t
3749
- } : n)), O[`edit-${e}`] && k((t) => {
3750
- let n = { ...t };
3751
- return delete n[`edit-${e}`], n;
3752
- });
3753
- }, Z = (e, t) => {
3754
- D((n) => n.map((n, r) => r === e ? {
3755
- ...n,
3756
- value: t
3757
- } : n));
3758
- }, Q = (e) => {
3759
- let t = E[e], n = et(t.key);
3760
- if (n) {
3761
- k((t) => ({
3762
- ...t,
3763
- [`edit-${e}`]: p._(n.message)
3764
- }));
3765
- return;
3766
- }
3767
- if (E.some((n, r) => r !== e && n.key.toLowerCase() === t.key.toLowerCase())) {
3768
- k((t) => ({
3769
- ...t,
3770
- [`edit-${e}`]: p._({ id: "q6K46F" })
3771
- }));
3772
- return;
3773
- }
3774
- D((t) => t.map((t, n) => n === e ? {
3775
- ...t,
3776
- isEditing: !1
3777
- } : t)), k((t) => {
3778
- let n = { ...t };
3779
- return delete n[`edit-${e}`], n;
3780
- });
3781
- }, le = (e) => {
3782
- let t = E[e], n = V.current.find((e) => e.uid === t.uid);
3783
- D(n ? (t) => t.map((t, r) => r === e ? {
3784
- ...n,
3785
- isEditing: !1
3786
- } : t) : (t) => t.filter((t, n) => n !== e)), k((t) => {
3787
- let n = { ...t };
3788
- return delete n[`edit-${e}`], n;
3789
- });
3790
- }, ue = (e) => {
3791
- D((t) => t.filter((t, n) => n !== e));
3792
- }, de = () => {
3793
- let e = et(M);
3794
- if (e) {
3795
- B(p._(e.message));
3796
- return;
3797
- }
3798
- if (E.some((e) => e.key.toLowerCase() === M.trim().toLowerCase())) {
3799
- B(p._({ id: "q6K46F" }));
3800
- return;
3801
- }
3802
- D((e) => [...e, {
3803
- uid: T(),
3804
- key: M.trim(),
3805
- value: P,
3806
- isEditing: !1
3807
- }]), N(""), I(""), B(null), j(!1);
3808
- }, fe = () => {
3809
- N(""), I(""), B(null), j(!1);
3810
- };
3811
- if (!e) return null;
3812
- let pe = i.split("/").filter(Boolean).pop() ?? i, me = ae.isPending, he = me || b, ge = C?.message ?? "", _e = ae.error?.message ?? "";
3813
- return /* @__PURE__ */ R(ee, {
3814
- title: /* @__PURE__ */ R("span", {
3815
- className: "flex max-w-[400px] items-center gap-1",
3816
- children: /* @__PURE__ */ R(q, {
3817
- id: "2lq0gq",
3818
- values: { displayName: pe },
3819
- components: {
3820
- 0: /* @__PURE__ */ R("span", { className: "shrink-0" }),
3821
- 1: /* @__PURE__ */ R("span", {
3822
- className: "truncate font-mono",
3823
- title: pe
3824
- })
3825
- }
3826
- })
3827
- }),
3828
- open: e,
3829
- onCancel: oe,
3830
- confirmButtonLabel: me ? p._({ id: "XvjC4F" }) : p._({ id: "V/SINY" }),
3831
- onConfirm: se,
3832
- cancelButtonLabel: p._({ id: "dEgA5A" }),
3833
- size: "large",
3834
- disableConfirmButton: he || !Y || ne || A || ie,
3835
- children: b ? /* @__PURE__ */ z(_, {
3836
- direction: "horizontal",
3837
- alignment: "center",
3838
- gap: "2",
3839
- className: "py-8",
3840
- children: [/* @__PURE__ */ R(o, { size: "small" }), /* @__PURE__ */ R(q, { id: "O80bQY" })]
3841
- }) : x ? /* @__PURE__ */ R(v, {
3842
- variant: "danger",
3843
- children: /* @__PURE__ */ R(q, {
3844
- id: "+p6nHr",
3845
- values: { metadataErrorMessage: ge }
3846
- })
3847
- }) : /* @__PURE__ */ z(_, {
3848
- direction: "vertical",
3849
- gap: "6",
3850
- children: [
3851
- /* @__PURE__ */ z("div", { children: [/* @__PURE__ */ R("p", {
3852
- className: "text-theme-default mb-3 text-sm font-semibold",
3853
- children: /* @__PURE__ */ R(q, { id: "f0cwjH" })
3854
- }), /* @__PURE__ */ z("div", {
3855
- className: "grid grid-cols-[max-content_1fr] gap-x-6 gap-y-2 text-sm",
3856
- children: [
3857
- /* @__PURE__ */ R("span", {
3858
- className: "text-theme-light text-right",
3859
- children: /* @__PURE__ */ R(q, { id: "IbYr/u" })
3860
- }),
3861
- /* @__PURE__ */ R("span", {
3862
- className: "font-mono",
3863
- children: y?.contentType ?? "—"
3864
- }),
3865
- /* @__PURE__ */ R("span", {
3866
- className: "text-theme-light text-right",
3867
- children: /* @__PURE__ */ R(q, { id: "lRoPjj" })
3868
- }),
3869
- /* @__PURE__ */ R("span", {
3870
- className: "font-mono break-all",
3871
- children: y?.etag ?? "—"
3872
- }),
3873
- /* @__PURE__ */ R("span", {
3874
- className: "text-theme-light text-right",
3875
- children: /* @__PURE__ */ R(q, { id: "Cj2Gtd" })
3876
- }),
3877
- /* @__PURE__ */ R("span", { children: y?.size == null ? "—" : F(y.size) }),
3878
- /* @__PURE__ */ R("span", {
3879
- className: "text-theme-light text-right",
3880
- children: /* @__PURE__ */ R(q, { id: "x5DnMs" })
3881
- }),
3882
- /* @__PURE__ */ R("span", { children: y?.lastModified ? ut(y.lastModified) : "—" })
3883
- ]
3884
- })] }),
3885
- /* @__PURE__ */ z("div", { children: [
3886
- /* @__PURE__ */ z(_, {
3887
- direction: "horizontal",
3888
- alignment: "center",
3889
- distribution: "between",
3890
- className: "mb-3",
3891
- children: [/* @__PURE__ */ R("p", {
3892
- className: "text-theme-default text-sm font-semibold",
3893
- children: /* @__PURE__ */ R(q, { id: "6GBt0m" })
3894
- }), /* @__PURE__ */ z("div", {
3895
- className: "flex items-center gap-4",
3896
- children: [/* @__PURE__ */ R("p", {
3897
- className: "text-theme-light text-xs",
3898
- children: /* @__PURE__ */ R(q, { id: "6E98zF" })
3899
- }), /* @__PURE__ */ z("p", {
3900
- className: `font-mono text-xs ${ie ? "text-theme-danger font-semibold" : "text-theme-light"}`,
3901
- children: [
3902
- re,
3903
- " / ",
3904
- ft,
3905
- " bytes"
3906
- ]
3907
- })]
3908
- })]
3909
- }),
3910
- ie && /* @__PURE__ */ R(v, {
3911
- variant: "warning",
3912
- className: "mb-3",
3913
- children: /* @__PURE__ */ R(q, { id: "tkRT08" })
3914
- }),
3915
- /* @__PURE__ */ R(_, {
3916
- direction: "horizontal",
3917
- className: "jn:bg-theme-background-lvl-1 mb-3 justify-end p-2",
3918
- children: /* @__PURE__ */ R(f, {
3919
- label: p._({ id: "sWBLli" }),
3920
- onClick: () => j(!0),
3921
- variant: "primary",
3922
- icon: "addCircle",
3923
- disabled: A || ne || he
3924
- })
3925
- }),
3926
- /* @__PURE__ */ z(c, {
3927
- columns: 3,
3928
- children: [
3929
- /* @__PURE__ */ z(r, { children: [
3930
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "7sMeHQ" }) }),
3931
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "wMHvYH" }) }),
3932
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "7L01XJ" }) })
3933
- ] }),
3934
- A && /* @__PURE__ */ z(r, { children: [
3935
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R(s, {
3936
- value: M,
3937
- onChange: (e) => {
3938
- N(e.target.value), L && B(null);
3939
- },
3940
- placeholder: p._({ id: "TSclU4" }),
3941
- errortext: L ?? void 0,
3942
- invalid: !!L,
3943
- autoFocus: !0
3944
- }) }),
3945
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R(s, {
3946
- value: P,
3947
- onChange: (e) => I(e.target.value),
3948
- placeholder: p._({ id: "wMHvYH" })
3949
- }) }),
3950
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ z(_, {
3951
- direction: "horizontal",
3952
- gap: "2",
3953
- children: [/* @__PURE__ */ R(f, {
3954
- size: "small",
3955
- variant: "primary",
3956
- onClick: de,
3957
- icon: "check",
3958
- title: p._({ id: "tfDRzk" })
3959
- }), /* @__PURE__ */ R(f, {
3960
- size: "small",
3961
- variant: "subdued",
3962
- onClick: fe,
3963
- icon: "close",
3964
- title: p._({ id: "bzSI52" })
3965
- })]
3966
- }) })
3967
- ] }),
3968
- E.map((e, t) => /* @__PURE__ */ z(r, { children: [
3969
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ R(s, {
3970
- value: e.key,
3971
- onChange: (e) => X(t, e.target.value),
3972
- errortext: O[`edit-${t}`],
3973
- invalid: !!O[`edit-${t}`]
3974
- }) : /* @__PURE__ */ R("span", {
3975
- className: "block max-w-xs truncate font-mono text-sm",
3976
- title: e.key,
3977
- children: e.key
3978
- }) }),
3979
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ R(s, {
3980
- value: e.value,
3981
- onChange: (e) => Z(t, e.target.value)
3982
- }) : /* @__PURE__ */ R("span", {
3983
- className: "block max-w-md truncate text-sm",
3984
- title: e.value,
3985
- children: e.value
3986
- }) }),
3987
- /* @__PURE__ */ R(a, { children: e.isEditing ? /* @__PURE__ */ z(_, {
3988
- direction: "horizontal",
3989
- gap: "2",
3990
- children: [/* @__PURE__ */ R(f, {
3991
- size: "small",
3992
- variant: "primary",
3993
- onClick: () => Q(t),
3994
- icon: "check",
3995
- title: p._({ id: "tfDRzk" })
3996
- }), /* @__PURE__ */ R(f, {
3997
- size: "small",
3998
- variant: "subdued",
3999
- onClick: () => le(t),
4000
- icon: "close",
4001
- title: p._({ id: "bzSI52" })
4002
- })]
4003
- }) : /* @__PURE__ */ z(_, {
4004
- direction: "horizontal",
4005
- gap: "2",
4006
- children: [/* @__PURE__ */ R(f, {
4007
- size: "small",
4008
- variant: "subdued",
4009
- onClick: () => ce(t),
4010
- icon: "edit",
4011
- title: p._({ id: "ePK91l" }),
4012
- disabled: A || ne || he
4013
- }), /* @__PURE__ */ R(f, {
4014
- size: "small",
4015
- variant: "primary-danger",
4016
- onClick: () => ue(t),
4017
- icon: "deleteForever",
4018
- title: p._({ id: "cnGeoo" }),
4019
- disabled: A || ne || he
4020
- })]
4021
- }) })
4022
- ] }, e.uid)),
4023
- E.length === 0 && !A && /* @__PURE__ */ R(r, { children: /* @__PURE__ */ R(a, {
4024
- colSpan: 3,
4025
- className: "py-6 text-center",
4026
- children: /* @__PURE__ */ R(_, {
4027
- alignment: "center",
4028
- children: /* @__PURE__ */ R("span", {
4029
- className: "text-theme-light text-sm",
4030
- children: /* @__PURE__ */ R(q, { id: "F02e8I" })
4031
- })
4032
- })
4033
- }) })
4034
- ]
4035
- })
4036
- ] }),
4037
- ae.isError && /* @__PURE__ */ R(v, {
4038
- variant: "danger",
4039
- children: /* @__PURE__ */ R(q, {
4040
- id: "7ZnTL8",
4041
- values: { mutationErrorMessage: _e }
4042
- })
4043
- })
4044
- ]
4045
- })
4046
- });
4047
- };
4048
- //#endregion
4049
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectsTableView.tsx
4050
- function mt({ bucketName: e, objects: i, folders: o, currentPrefix: s, onFolderClick: l, onDeleteObjectSuccess: d, onDeleteObjectError: f, onCopyObjectSuccess: p, onCopyObjectError: h, onMoveObjectSuccess: g, onMoveObjectError: _, onEditMetadataSuccess: ee, onEditMetadataError: v }) {
4051
- let { i18n: y, _: b } = J(), [x, S] = W(null), [C, w] = W(null), [T, E] = W(null), [D, k] = W(null), j = (e) => s ? e.replace(s, "") : e;
4052
- return o.length === 0 && i.length === 0 ? /* @__PURE__ */ z(L, { children: [/* @__PURE__ */ z(c, {
4053
- columns: 4,
4054
- children: [/* @__PURE__ */ z(r, { children: [
4055
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "6YtxFj" }) }),
4056
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "Cj2Gtd" }) }),
4057
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "sjMCOP" }) }),
4058
- /* @__PURE__ */ R(n, {})
4059
- ] }), /* @__PURE__ */ R(r, { children: /* @__PURE__ */ R(a, {
4060
- colSpan: 4,
4061
- children: /* @__PURE__ */ R("div", {
4062
- className: "py-8 text-center",
4063
- children: /* @__PURE__ */ R("p", {
4064
- className: "text-theme-light",
4065
- children: /* @__PURE__ */ R(q, { id: "0o0OhW" })
4066
- })
4067
- })
4068
- }) })]
4069
- }), /* @__PURE__ */ R(Ze, {
4070
- bucketName: e,
4071
- objectKey: x?.key ?? "",
4072
- objectSize: x?.size,
4073
- lastModified: x?.lastModified,
4074
- isOpen: x !== null,
4075
- onClose: () => S(null),
4076
- onSuccess: d,
4077
- onError: f
4078
- })] }) : /* @__PURE__ */ z(L, { children: [
4079
- /* @__PURE__ */ z(c, {
4080
- columns: 4,
4081
- children: [
4082
- /* @__PURE__ */ z(r, { children: [
4083
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "6YtxFj" }) }),
4084
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "Cj2Gtd" }) }),
4085
- /* @__PURE__ */ R(n, { children: /* @__PURE__ */ R(q, { id: "sjMCOP" }) }),
4086
- /* @__PURE__ */ R(n, {})
4087
- ] }),
4088
- o.map((e) => {
4089
- let n = j(e.prefix).replace(/\/$/, "");
4090
- return /* @__PURE__ */ z(r, { children: [
4091
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ z("button", {
4092
- type: "button",
4093
- className: "flex min-w-0 items-center gap-2 rounded text-left hover:underline focus-visible:outline focus-visible:outline-2",
4094
- onClick: () => l(e.prefix),
4095
- title: e.prefix,
4096
- children: [/* @__PURE__ */ R(O, {
4097
- size: 18,
4098
- className: "text-theme-light shrink-0"
4099
- }), /* @__PURE__ */ R("span", {
4100
- className: "truncate font-mono text-sm",
4101
- children: n
4102
- })]
4103
- }) }),
4104
- /* @__PURE__ */ R(a, { children: "—" }),
4105
- /* @__PURE__ */ R(a, { children: "—" }),
4106
- /* @__PURE__ */ R(a, {
4107
- onClick: (e) => e.stopPropagation(),
4108
- children: /* @__PURE__ */ R("div", {
4109
- className: "flex justify-end",
4110
- children: /* @__PURE__ */ R(m, { children: /* @__PURE__ */ R(t, { children: /* @__PURE__ */ R(u, {
4111
- label: y._({ id: "cnGeoo" }),
4112
- onClick: () => S({ key: e.prefix })
4113
- }) }) })
4114
- })
4115
- })
4116
- ] }, e.prefix);
4117
- }),
4118
- i.map((e) => {
4119
- let n = j(e.key);
4120
- return /* @__PURE__ */ z(r, { children: [
4121
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ z("div", {
4122
- className: "flex items-center gap-2",
4123
- children: [/* @__PURE__ */ R(A, {
4124
- size: 18,
4125
- className: "text-theme-light shrink-0"
4126
- }), /* @__PURE__ */ R("span", {
4127
- className: "truncate font-mono text-sm",
4128
- children: n
4129
- })]
4130
- }) }),
4131
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R("span", {
4132
- className: "text-juno-grey-light-1 text-sm",
4133
- children: F(e.size)
4134
- }) }),
4135
- /* @__PURE__ */ R(a, { children: /* @__PURE__ */ R("span", {
4136
- className: "text-juno-grey-light-1 text-sm",
4137
- children: e.lastModified ? new Date(e.lastModified).toLocaleString() : "—"
4138
- }) }),
4139
- /* @__PURE__ */ R(a, {
4140
- onClick: (e) => e.stopPropagation(),
4141
- children: /* @__PURE__ */ R("div", {
4142
- className: "flex justify-end",
4143
- children: /* @__PURE__ */ R(m, { children: /* @__PURE__ */ z(t, { children: [
4144
- /* @__PURE__ */ R(u, {
4145
- label: y._({ id: "he3ygx" }),
4146
- onClick: () => w({
4147
- key: e.key,
4148
- size: e.size
4149
- })
4150
- }),
4151
- /* @__PURE__ */ R(u, {
4152
- label: y._({ id: "QWdKwH" }),
4153
- onClick: () => E({
4154
- key: e.key,
4155
- size: e.size
4156
- })
4157
- }),
4158
- /* @__PURE__ */ R(u, {
4159
- label: y._({ id: "SIfYq6" }),
4160
- onClick: () => k(e.key)
4161
- }),
4162
- /* @__PURE__ */ R(u, {
4163
- label: y._({ id: "cnGeoo" }),
4164
- onClick: () => S({
4165
- key: e.key,
4166
- size: e.size,
4167
- lastModified: e.lastModified
4168
- })
4169
- })
4170
- ] }) })
4171
- })
4172
- })
4173
- ] }, e.key);
4174
- })
4175
- ]
4176
- }),
4177
- /* @__PURE__ */ R(Ze, {
4178
- bucketName: e,
4179
- objectKey: x?.key ?? "",
4180
- objectSize: x?.size,
4181
- lastModified: x?.lastModified,
4182
- isOpen: x !== null,
4183
- onClose: () => S(null),
4184
- onSuccess: d,
4185
- onError: f
4186
- }),
4187
- /* @__PURE__ */ R(st, {
4188
- bucketName: e,
4189
- objectKey: C?.key ?? "",
4190
- objectSize: C?.size,
4191
- isOpen: C !== null,
4192
- onClose: () => w(null),
4193
- onSuccess: p,
4194
- onError: h
4195
- }),
4196
- /* @__PURE__ */ R(lt, {
4197
- bucketName: e,
4198
- objectKey: T?.key ?? "",
4199
- objectSize: T?.size,
4200
- isOpen: T !== null,
4201
- onClose: () => E(null),
4202
- onSuccess: g,
4203
- onError: _
4204
- }),
4205
- /* @__PURE__ */ R(pt, {
4206
- bucketName: e,
4207
- objectKey: D ?? "",
4208
- isOpen: D !== null,
4209
- onClose: () => k(null),
4210
- onSuccess: ee,
4211
- onError: v
4212
- })
4213
- ] });
4214
- }
4215
- //#endregion
4216
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectsFileNavigation.tsx
4217
- function ht(e) {
4218
- if (!e) return [];
4219
- let t = e.replace(/\/$/, "").split("/").filter(Boolean);
4220
- return t.map((e, n) => ({
4221
- label: e,
4222
- prefix: t.slice(0, n + 1).join("/") + "/"
4223
- }));
4224
- }
4225
- var gt = "bg-theme-background-lvl-4 rounded px-2 py-0.5";
4226
- function _t({ bucketName: t, prefix: n, onPrefixClick: r }) {
4227
- let i = ht(n), a = i.length === 0;
4228
- return /* @__PURE__ */ R("div", {
4229
- className: "mb-2 px-2 pt-2",
4230
- children: /* @__PURE__ */ z(l, { children: [/* @__PURE__ */ R(e, {
4231
- onClick: a ? void 0 : () => r(""),
4232
- active: a,
4233
- label: /* @__PURE__ */ z("span", {
4234
- className: `flex items-center gap-1 ${a ? gt : ""}`,
4235
- children: [R(a ? E : T, {
4236
- size: 15,
4237
- className: "shrink-0"
4238
- }), t]
4239
- })
4240
- }), i.map((t, n) => {
4241
- let a = n === i.length - 1;
4242
- return /* @__PURE__ */ R(e, {
4243
- onClick: a ? void 0 : () => r(t.prefix),
4244
- active: a,
4245
- label: /* @__PURE__ */ z("span", {
4246
- className: `flex items-center gap-1 ${a ? gt : ""}`,
4247
- children: [R(a ? N : O, {
4248
- size: 15,
4249
- className: "shrink-0"
4250
- }), t.label]
4251
- })
4252
- }, t.prefix);
4253
- })] })
4254
- });
4255
- }
4256
- //#endregion
4257
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/CreateFolderModal.tsx
4258
- function vt({ bucketName: e, currentPrefix: t, isOpen: n, onClose: r, onSuccess: i }) {
4259
- let { i18n: a, _: o } = J(), c = te(), [l, u] = W(""), [d, p] = W(null), m = S.useUtils(), { data: h } = S.storage.ceph.objects.list.useQuery({
4260
- project_id: c ?? "",
4261
- containerName: e,
4262
- prefix: t || void 0,
4263
- delimiter: "/",
4264
- maxKeys: 1e3
4265
- }, { enabled: n && !!c && !!e }), g = S.storage.ceph.objects.createFolder.useMutation({ onSuccess: (e, t) => {
4266
- m.storage.ceph.objects.list.invalidate(), i(t.folderPath.endsWith("/") ? t.folderPath : `${t.folderPath}/`), v();
4267
- } }), v = () => {
4268
- u(""), p(null), g.reset(), r();
4269
- }, y = (e) => {
4270
- u(e);
4271
- let n = Qe(e, h?.folders.map((e) => e.prefix) ?? [], t);
4272
- p(n ? a._(n.message) : null);
4273
- }, b = () => {
4274
- if (!c) return;
4275
- let n = Qe(l, h?.folders.map((e) => e.prefix) ?? [], t);
4276
- if (n) {
4277
- p(a._(n.message));
4278
- return;
4279
- }
4280
- let r = t + l.trim();
4281
- g.mutate({
4282
- project_id: c,
4283
- containerName: e,
4284
- folderPath: r
4285
- });
4286
- }, x = !d && l.trim().length > 0;
4287
- return /* @__PURE__ */ z(ee, {
4288
- open: n,
4289
- onCancel: v,
4290
- title: /* @__PURE__ */ R(q, { id: "sYJvnu" }),
4291
- size: "large",
4292
- children: [/* @__PURE__ */ z(_, {
4293
- direction: "vertical",
4294
- gap: "4",
4295
- children: [
4296
- /* @__PURE__ */ R("p", { children: /* @__PURE__ */ R(q, { id: "2G+7C1" }) }),
4297
- t && /* @__PURE__ */ z("div", {
4298
- className: "bg-theme-background-lvl-2 rounded p-3",
4299
- children: [/* @__PURE__ */ R("span", {
4300
- className: "text-juno-grey-light-1 text-sm",
4301
- children: /* @__PURE__ */ R(q, { id: "Z30x/C" })
4302
- }), /* @__PURE__ */ R("div", {
4303
- className: "mt-1 font-mono text-sm",
4304
- children: t
4305
- })]
4306
- }),
4307
- /* @__PURE__ */ R(s, {
4308
- label: a._({ id: "XXRutf" }),
4309
- value: l,
4310
- onChange: (e) => y(e.target.value),
4311
- placeholder: "my-folder",
4312
- autoFocus: !0,
4313
- invalid: !!d,
4314
- errortext: d || void 0,
4315
- onKeyDown: (e) => {
4316
- e.key === "Enter" && x && !g.isPending && b();
4317
- }
4318
- }),
4319
- /* @__PURE__ */ z("div", {
4320
- className: "bg-theme-background-lvl-1 rounded p-3",
4321
- children: [/* @__PURE__ */ R("span", {
4322
- className: "text-juno-grey-light-1 text-sm",
4323
- children: /* @__PURE__ */ R(q, { id: "oAMLhA" })
4324
- }), /* @__PURE__ */ R("div", {
4325
- className: "mt-1 font-mono text-sm break-all",
4326
- children: t + l.trim() + "/"
4327
- })]
4328
- }),
4329
- g.error && /* @__PURE__ */ z("p", {
4330
- className: "text-juno-red text-sm",
4331
- children: [
4332
- /* @__PURE__ */ R(q, { id: "4BITzH" }),
4333
- " ",
4334
- g.error.message
4335
- ]
4336
- })
4337
- ]
4338
- }), /* @__PURE__ */ z("div", {
4339
- className: "mt-6 flex justify-end gap-2",
4340
- children: [/* @__PURE__ */ R(f, {
4341
- variant: "subdued",
4342
- onClick: v,
4343
- disabled: g.isPending,
4344
- children: /* @__PURE__ */ R(q, { id: "dEgA5A" })
4345
- }), /* @__PURE__ */ R(f, {
4346
- variant: "primary",
4347
- onClick: b,
4348
- disabled: !x || g.isPending,
4349
- children: g.isPending ? /* @__PURE__ */ R(q, { id: "HM56Bx" }) : /* @__PURE__ */ R(q, { id: "boJ+Y1" })
4350
- })]
4351
- })]
4352
- });
4353
- }
4354
- //#endregion
4355
- //#region src/client/routes/_auth/projects/$projectId/storage/-components/Ceph/Objects/ObjectToastNotifications.tsx
4356
- function yt({ title: e, description: t }) {
4357
- return /* @__PURE__ */ z(_, {
4358
- direction: "vertical",
4359
- gap: "1.5",
4360
- children: [/* @__PURE__ */ R("span", { children: e }), /* @__PURE__ */ R("span", {
4361
- className: "text-theme-light",
4362
- children: t
4363
- })]
4364
- });
4365
- }
4366
- var bt = (e, t) => ({
4367
- variant: "success",
4368
- autoDismiss: !0,
4369
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4370
- onDismiss: t.onDismiss,
4371
- children: /* @__PURE__ */ R(yt, {
4372
- title: /* @__PURE__ */ R(q, { id: "6KRclz" }),
4373
- description: /* @__PURE__ */ R(q, {
4374
- id: "7hLLUk",
4375
- values: { folderPath: e }
4376
- })
4377
- })
4378
- }), xt = (e, t) => {
4379
- let n = e.split("/").filter(Boolean).pop() ?? e;
4380
- return {
4381
- variant: "success",
4382
- autoDismiss: !0,
4383
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4384
- onDismiss: t.onDismiss,
4385
- children: /* @__PURE__ */ R(yt, {
4386
- title: /* @__PURE__ */ R(q, { id: "z9NAjZ" }),
4387
- description: /* @__PURE__ */ R(q, {
4388
- id: "LASqRM",
4389
- values: { displayName: n }
4390
- })
4391
- })
4392
- };
4393
- }, St = (e, t, n) => {
4394
- let r = e.split("/").filter(Boolean).pop() ?? e;
4395
- return {
4396
- variant: "error",
4397
- autoDismiss: !0,
4398
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4399
- onDismiss: n.onDismiss,
4400
- children: /* @__PURE__ */ R(yt, {
4401
- title: /* @__PURE__ */ R(q, { id: "RSg/pq" }),
4402
- description: /* @__PURE__ */ R(q, {
4403
- id: "oJVmWq",
4404
- values: {
4405
- displayName: r,
4406
- errorMessage: t
4407
- }
4408
- })
4409
- })
4410
- };
4411
- }, Ct = (e, t, n, r, i) => {
4412
- let a = e.split("/").filter(Boolean).pop() ?? e, o = `${t}/${n}`;
4413
- return {
4414
- variant: "success",
4415
- autoDismiss: !0,
4416
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
4417
- onDismiss: r.onDismiss,
4418
- children: /* @__PURE__ */ R(yt, {
4419
- title: /* @__PURE__ */ R(q, { id: "Lylr9Z" }),
4420
- description: i ? /* @__PURE__ */ R(q, {
4421
- id: "La2LYh",
4422
- values: {
4423
- displayName: a,
4424
- destination: o
4425
- }
4426
- }) : /* @__PURE__ */ R(q, {
4427
- id: "Af8YL/",
4428
- values: {
4429
- displayName: a,
4430
- destination: o
4431
- }
4432
- })
4433
- })
4434
- };
4435
- }, wt = (e, t, n) => {
4436
- let r = e.split("/").filter(Boolean).pop() ?? e;
4437
- return {
4438
- variant: "error",
4439
- autoDismiss: !0,
4440
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4441
- onDismiss: n.onDismiss,
4442
- children: /* @__PURE__ */ R(yt, {
4443
- title: /* @__PURE__ */ R(q, { id: "tOkmLM" }),
4444
- description: /* @__PURE__ */ R(q, {
4445
- id: "tIc6vY",
4446
- values: {
4447
- displayName: r,
4448
- errorMessage: t
4449
- }
4450
- })
4451
- })
4452
- };
4453
- }, Tt = (e, t, n, r) => {
4454
- let i = e.split("/").filter(Boolean).pop() ?? e, a = `${t}/${n}`;
4455
- return {
4456
- variant: "success",
4457
- autoDismiss: !0,
4458
- autoDismissTimeout: r.autoDismissTimeout ?? 5e3,
4459
- onDismiss: r.onDismiss,
4460
- children: /* @__PURE__ */ R(yt, {
4461
- title: /* @__PURE__ */ R(q, { id: "6luZQA" }),
4462
- description: /* @__PURE__ */ R(q, {
4463
- id: "nYab6d",
4464
- values: {
4465
- displayName: i,
4466
- destination: a
4467
- }
4468
- })
4469
- })
4470
- };
4471
- }, Et = (e, t, n) => {
4472
- let r = e.split("/").filter(Boolean).pop() ?? e;
4473
- return {
4474
- variant: "error",
4475
- autoDismiss: !0,
4476
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4477
- onDismiss: n.onDismiss,
4478
- children: /* @__PURE__ */ R(yt, {
4479
- title: /* @__PURE__ */ R(q, { id: "SCY5an" }),
4480
- description: /* @__PURE__ */ R(q, {
4481
- id: "TTX3nV",
4482
- values: {
4483
- displayName: r,
4484
- errorMessage: t
4485
- }
4486
- })
4487
- })
4488
- };
4489
- }, Dt = (e, t) => {
4490
- let n = e.split("/").filter(Boolean).pop() ?? e;
4491
- return {
4492
- variant: "success",
4493
- autoDismiss: !0,
4494
- autoDismissTimeout: t.autoDismissTimeout ?? 5e3,
4495
- onDismiss: t.onDismiss,
4496
- children: /* @__PURE__ */ R(yt, {
4497
- title: /* @__PURE__ */ R(q, { id: "YRexkb" }),
4498
- description: /* @__PURE__ */ R(q, {
4499
- id: "/LXXlY",
4500
- values: { displayName: n }
4501
- })
4502
- })
4503
- };
4504
- }, Ot = (e, t, n) => {
4505
- let r = e.split("/").filter(Boolean).pop() ?? e;
4506
- return {
4507
- variant: "error",
4508
- autoDismiss: !0,
4509
- autoDismissTimeout: n.autoDismissTimeout ?? 5e3,
4510
- onDismiss: n.onDismiss,
4511
- children: /* @__PURE__ */ R(yt, {
4512
- title: /* @__PURE__ */ R(q, { id: "4t33sh" }),
4513
- description: /* @__PURE__ */ R(q, {
4514
- id: "2xbYVD",
4515
- values: {
4516
- displayName: r,
4517
- errorMessage: t
4518
- }
4519
- })
4520
- })
4521
- };
4522
- }, kt = (e) => {
4523
- let t = new TextEncoder().encode(e), n = Array.from(t, (e) => String.fromCodePoint(e)).join("");
4524
- return btoa(n);
4525
- }, At = (e) => {
4526
- if (!e) return "";
4527
- try {
4528
- let t = atob(e), n = Uint8Array.from(t, (e) => e.codePointAt(0));
4529
- return new TextDecoder().decode(n);
4530
- } catch {
4531
- return "";
4532
- }
4533
- };
4534
- function jt({ bucketName: e }) {
4535
- let { i18n: t, _: n } = J(), r = te(), a = G({ from: P.fullPath }), { prefix: s, sortBy: c, sortDirection: l, search: u = "" } = P.useSearch(), d = At(s), [p, m] = W(void 0), [h, g] = W([]), [ee, v] = W([]), [y, b] = W(!1), [x, C] = W(!1), [w, T] = W(null), E = () => T(null), { data: D, isLoading: O, error: k } = S.storage.ceph.objects.list.useQuery({
4536
- project_id: r ?? "",
4537
- containerName: e,
4538
- prefix: d || void 0,
4539
- delimiter: "/",
4540
- maxKeys: 1e3,
4541
- continuationToken: p
4542
- }, { enabled: !!r });
4543
- H(() => {
4544
- if (D) {
4545
- let e = D.objects.filter((e) => {
4546
- let t = d ? e.key.replace(d, "") : e.key;
4547
- return t !== "" && t !== "/";
4548
- });
4549
- p ? (g((t) => [...t, ...e]), v((e) => [...e, ...D.folders])) : (g(e), v(D.folders)), b(D.isTruncated ?? !1);
4550
- }
4551
- }, [
4552
- D,
4553
- p,
4554
- d
4555
- ]);
4556
- let A = (e) => {
4557
- m(void 0), g([]), v([]), b(!1), a({ search: (t) => ({
4558
- ...t,
4559
- prefix: e ? kt(e) : void 0
4560
- }) });
4561
- }, j = () => {
4562
- D?.nextContinuationToken && m(D.nextContinuationToken);
4563
- }, M = (e) => d ? e.replace(d, "") : e, N = h.filter((e) => M(e.key).toLowerCase().includes(u.toLowerCase().trim())), F = ee.filter((e) => M(e.prefix).toLowerCase().includes(u.toLowerCase().trim())), L = c ? [...N].sort((e, t) => {
4564
- let n = 0;
4565
- switch (c) {
4566
- case "name":
4567
- n = M(e.key).localeCompare(M(t.key));
4568
- break;
4569
- case "lastModified":
4570
- case "last_modified": {
4571
- let r = e.lastModified, i = t.lastModified;
4572
- if (!r || !i) break;
4573
- n = new Date(r).getTime() - new Date(i).getTime();
4574
- break;
4575
- }
4576
- case "size":
4577
- case "bytes":
4578
- n = e.size - t.size;
4579
- break;
4580
- }
4581
- return l === "desc" ? -n : n;
4582
- }) : N, V = c ? [...F].sort((e, t) => c === "name" ? l === "desc" ? M(t.prefix).localeCompare(M(e.prefix)) : M(e.prefix).localeCompare(M(t.prefix)) : 0) : F, U = {
4583
- options: [
4584
- {
4585
- label: t._({ id: "6YtxFj" }),
4586
- value: "name"
4587
- },
4588
- {
4589
- label: t._({ id: "sjMCOP" }),
4590
- value: "lastModified"
4591
- },
4592
- {
4593
- label: t._({ id: "Cj2Gtd" }),
4594
- value: "size"
4595
- }
4596
- ],
4597
- sortBy: c ?? void 0,
4598
- sortDirection: l ?? "asc"
4599
- }, K = (e) => {
4600
- let t = typeof e == "string" ? e : "";
4601
- B(() => {
4602
- a({ search: (e) => ({
4603
- ...e,
4604
- search: t || void 0
4605
- }) });
4606
- });
4607
- }, Y = (e) => {
4608
- let t = e.sortBy, n = e.sortDirection || "asc";
4609
- B(() => {
4610
- a({ search: (e) => ({
4611
- ...e,
4612
- sortBy: t,
4613
- sortDirection: t ? n : void 0
4614
- }) });
4615
- });
4616
- };
4617
- if (O && !p) return /* @__PURE__ */ z(_, {
4618
- direction: "horizontal",
4619
- gap: "2",
4620
- alignment: "center",
4621
- className: "mt-8",
4622
- children: [/* @__PURE__ */ R(o, {}), /* @__PURE__ */ R("span", {
4623
- className: "text-juno-grey-light-1 text-sm",
4624
- children: /* @__PURE__ */ R(q, { id: "ujK/QN" })
4625
- })]
4626
- });
4627
- if (k) {
4628
- let e = k.message;
4629
- return /* @__PURE__ */ R("p", {
4630
- className: "text-juno-red mt-4 text-sm",
4631
- children: /* @__PURE__ */ R(q, {
4632
- id: "MuKU9V",
4633
- values: { errorMessage: e }
4634
- })
4635
- });
4636
- }
4637
- return /* @__PURE__ */ z("div", {
4638
- className: "relative",
4639
- children: [
4640
- /* @__PURE__ */ R(_t, {
4641
- bucketName: e,
4642
- prefix: d,
4643
- onPrefixClick: A
4644
- }),
4645
- /* @__PURE__ */ R(I, {
4646
- sortSettings: U,
4647
- searchTerm: u,
4648
- onSort: Y,
4649
- onSearch: K,
4650
- actions: /* @__PURE__ */ R(_, {
4651
- direction: "horizontal",
4652
- gap: "2",
4653
- children: /* @__PURE__ */ R(f, {
4654
- variant: "primary",
4655
- onClick: () => C(!0),
4656
- children: /* @__PURE__ */ R(q, { id: "boJ+Y1" })
4657
- })
4658
- })
4659
- }),
4660
- /* @__PURE__ */ R(mt, {
4661
- bucketName: e,
4662
- objects: L,
4663
- folders: V,
4664
- currentPrefix: d,
4665
- onFolderClick: A,
4666
- onDeleteObjectSuccess: (e) => {
4667
- T(xt(e, { onDismiss: E }));
4668
- },
4669
- onDeleteObjectError: (e, t) => {
4670
- T(St(e, t, { onDismiss: E }));
4671
- },
4672
- onCopyObjectSuccess: (e, t, n, r) => {
4673
- T(Ct(e, t, n, { onDismiss: E }, r));
4674
- },
4675
- onCopyObjectError: (e, t) => {
4676
- T(wt(e, t, { onDismiss: E }));
4677
- },
4678
- onMoveObjectSuccess: (e, t, n) => {
4679
- T(Tt(e, t, n, { onDismiss: E }));
4680
- },
4681
- onMoveObjectError: (e, t) => {
4682
- T(Et(e, t, { onDismiss: E }));
4683
- },
4684
- onEditMetadataSuccess: (e) => {
4685
- T(Dt(e, { onDismiss: E }));
4686
- },
4687
- onEditMetadataError: (e, t) => {
4688
- T(Ot(e, t, { onDismiss: E }));
4689
- }
4690
- }),
4691
- y && /* @__PURE__ */ R("div", {
4692
- className: "mt-4 flex justify-center",
4693
- children: /* @__PURE__ */ R(f, {
4694
- onClick: j,
4695
- disabled: O,
4696
- variant: "subdued",
4697
- children: O ? /* @__PURE__ */ R(q, { id: "tVSmFT" }) : /* @__PURE__ */ R(q, { id: "a4N/Bg" })
4698
- })
4699
- }),
4700
- /* @__PURE__ */ R(vt, {
4701
- bucketName: e,
4702
- currentPrefix: d,
4703
- isOpen: x,
4704
- onClose: () => C(!1),
4705
- onSuccess: (e) => {
4706
- C(!1), T(bt(e, { onDismiss: E })), A(e);
4707
- }
4708
- }),
4709
- w && /* @__PURE__ */ R(i, { ...w })
4710
- ]
4711
- });
4712
- }
4713
- //#endregion
4714
- //#region src/client/routes/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/index.tsx?tsr-split=component
4715
- function Mt() {
4716
- let { project: e, provider: t, containerName: n } = K({
4717
- from: "/_auth/projects/$projectId/storage/$provider/containers/$containerName/objects/",
4718
- select: (e) => ({
4719
- project: e.projectId,
4720
- provider: e.provider,
4721
- containerName: e.containerName
4722
- })
4723
- }), { prefix: r, sortBy: i, sortDirection: a, search: o } = P.useSearch();
4724
- return /* @__PURE__ */ R("div", { children: e ? /* @__PURE__ */ R(Y, {
4725
- resetKeys: [
4726
- e,
4727
- t,
4728
- n,
4729
- r,
4730
- i,
4731
- a,
4732
- o
4733
- ],
4734
- fallback: /* @__PURE__ */ R("div", {
4735
- className: "p-4 text-center",
4736
- children: /* @__PURE__ */ R(q, { id: "diFNkW" })
4737
- }),
4738
- children: (() => {
4739
- switch (t) {
4740
- case "swift": return /* @__PURE__ */ R(Xe, {});
4741
- case "ceph": return /* @__PURE__ */ R(jt, { bucketName: n });
4742
- default: return /* @__PURE__ */ R("div", {
4743
- className: "p-4",
4744
- children: /* @__PURE__ */ R(q, {
4745
- id: "BSaBkZ",
4746
- values: { containerName: n }
4747
- })
4748
- });
4749
- }
4750
- })()
4751
- }) : /* @__PURE__ */ R("div", {
4752
- className: "p-4 text-center",
4753
- children: /* @__PURE__ */ R(q, { id: "Z2fZGD" })
4754
- }) });
4755
- }
4756
- var Nt = () => /* @__PURE__ */ R(Mt, {});
4757
- //#endregion
4758
- export { Nt as component };
4759
-
4760
- //# sourceMappingURL=objects-FXN0VWLI.mjs.map