@cmdoss/walrus-site-builder-react 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +256 -0
- package/dist/index.css +1442 -0
- package/dist/index.d.ts +484 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4908 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,4908 @@
|
|
|
1
|
+
import { TransactionExecutorService, WalrusSiteBuilderSdk, getSHA256Hash, mainPackage, objectIdToWalrusSiteUrl, sha256ToU256, suinsDomainToWalrusSiteUrl } from "@cmdoss/walrus-site-builder";
|
|
2
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
3
|
+
import { ALLOWED_METADATA, SuinsClient, SuinsTransaction, mainPackage as mainPackage$1 } from "@mysten/suins";
|
|
4
|
+
import { MAINNET_WALRUS_PACKAGE_CONFIG, TESTNET_WALRUS_PACKAGE_CONFIG } from "@mysten/walrus";
|
|
5
|
+
import { useStore } from "@nanostores/react";
|
|
6
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { useQueries, useQuery } from "@tanstack/react-query";
|
|
8
|
+
import { atom, computed } from "nanostores";
|
|
9
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
10
|
+
import { AlertCircle, AlertTriangle, Calendar, CalendarClock, CheckCircle, CheckCircle2, Clock, ExternalLink, Globe2, Info, Link2, Loader2, Pencil, Search, Upload, X, XCircle } from "lucide-react";
|
|
11
|
+
import { AggregatorClient, Env } from "@cetusprotocol/aggregator-sdk";
|
|
12
|
+
import BN from "bn.js";
|
|
13
|
+
import { ZenFsFileManager } from "@cmdoss/file-manager";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
16
|
+
//#region rolldown:runtime
|
|
17
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/lib/nonNull.ts
|
|
21
|
+
function nonNull(value) {
|
|
22
|
+
return value !== null && value !== void 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/queries/keys.ts
|
|
27
|
+
const queryKeys = {
|
|
28
|
+
suinsDomains: (address, network) => [
|
|
29
|
+
"suins-domains",
|
|
30
|
+
address,
|
|
31
|
+
network
|
|
32
|
+
],
|
|
33
|
+
suinsDomainDetail: (name, network) => [
|
|
34
|
+
"suins-domain-detail",
|
|
35
|
+
name,
|
|
36
|
+
network
|
|
37
|
+
],
|
|
38
|
+
walrusSite: (siteId) => ["walrus-site", siteId],
|
|
39
|
+
walrusSites: (address, network) => [
|
|
40
|
+
"walrus-sites",
|
|
41
|
+
address,
|
|
42
|
+
network
|
|
43
|
+
],
|
|
44
|
+
storageCost: (fileSize, epochs) => [
|
|
45
|
+
"storage-cost",
|
|
46
|
+
fileSize,
|
|
47
|
+
epochs
|
|
48
|
+
]
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/queries/suins-domains.query.ts
|
|
53
|
+
function useSuiNsDomainsQuery(currentAccount, clients) {
|
|
54
|
+
const { suiClient, queryClient } = clients;
|
|
55
|
+
const { network } = suiClient;
|
|
56
|
+
const suinsClient = useMemo(() => new SuinsClient({
|
|
57
|
+
network: suiClient.network === "mainnet" ? "mainnet" : "testnet",
|
|
58
|
+
client: suiClient
|
|
59
|
+
}), [suiClient]);
|
|
60
|
+
const onchainDataQuery = useQuery({
|
|
61
|
+
queryKey: queryKeys.suinsDomains(currentAccount?.address, network),
|
|
62
|
+
queryFn: async () => {
|
|
63
|
+
if (!currentAccount?.address) return [];
|
|
64
|
+
try {
|
|
65
|
+
let allDomains = [];
|
|
66
|
+
let hasNextPage = true;
|
|
67
|
+
let cursor;
|
|
68
|
+
const suinsPackageId = mainPackage$1[network]?.packageIdV1;
|
|
69
|
+
if (!suinsPackageId) {
|
|
70
|
+
console.warn(`SuiNS not supported on network: ${network}`);
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
console.log("suinsPackageId", suinsPackageId);
|
|
74
|
+
console.log("suinsPackageId", `${suinsPackageId}::suins_registration::SuinsRegistration`);
|
|
75
|
+
while (hasNextPage) {
|
|
76
|
+
const response = await suiClient.getOwnedObjects({
|
|
77
|
+
owner: currentAccount.address,
|
|
78
|
+
filter: { StructType: `${suinsPackageId}::suins_registration::SuinsRegistration` },
|
|
79
|
+
options: {
|
|
80
|
+
showContent: true,
|
|
81
|
+
showType: true,
|
|
82
|
+
showDisplay: true
|
|
83
|
+
},
|
|
84
|
+
cursor
|
|
85
|
+
});
|
|
86
|
+
console.log("response", response);
|
|
87
|
+
const domains$1 = response.data.filter((obj) => obj.data?.content?.dataType === "moveObject").map((obj) => {
|
|
88
|
+
const content$5 = obj.data?.content;
|
|
89
|
+
const fields = content$5 && "fields" in content$5 ? content$5.fields : {};
|
|
90
|
+
return {
|
|
91
|
+
name: fields?.domain_name || "",
|
|
92
|
+
objectId: obj.data?.objectId || "",
|
|
93
|
+
expiresAt: fields?.expiration_timestamp_ms ? Number(fields.expiration_timestamp_ms) : void 0
|
|
94
|
+
};
|
|
95
|
+
}).filter((domain) => domain.name);
|
|
96
|
+
allDomains = [...allDomains, ...domains$1];
|
|
97
|
+
hasNextPage = response.hasNextPage;
|
|
98
|
+
cursor = response.nextCursor;
|
|
99
|
+
}
|
|
100
|
+
return allDomains;
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error("Error fetching SuiNS domains:", error);
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
enabled: !!currentAccount?.address,
|
|
107
|
+
staleTime: 1e3 * 60 * 5,
|
|
108
|
+
retry: 2,
|
|
109
|
+
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4)
|
|
110
|
+
}, queryClient);
|
|
111
|
+
const domains = useQueries({ queries: onchainDataQuery.data?.map((domain) => ({
|
|
112
|
+
queryKey: queryKeys.suinsDomainDetail(domain.name, network),
|
|
113
|
+
queryFn: async () => await suinsClient?.getNameRecord(domain.name),
|
|
114
|
+
enabled: !!suinsClient && !!domain.name
|
|
115
|
+
})) ?? [] }, queryClient);
|
|
116
|
+
return {
|
|
117
|
+
isLoading: useMemo(() => onchainDataQuery.isLoading || domains.some((d) => d.isLoading), [onchainDataQuery.isLoading, domains]),
|
|
118
|
+
isError: useMemo(() => onchainDataQuery.isError || domains.some((d) => d.isError), [onchainDataQuery.isError, domains]),
|
|
119
|
+
data: useMemo(() => domains.map((d) => d.data).filter(nonNull).map((r) => ({
|
|
120
|
+
name: r.name.slice(0, -4),
|
|
121
|
+
avatar: r.avatar,
|
|
122
|
+
expirationTimestampMs: Number(r.expirationTimestampMs),
|
|
123
|
+
nftId: r.nftId,
|
|
124
|
+
walrusSiteId: r.walrusSiteId,
|
|
125
|
+
targetAddr: r.targetAddress,
|
|
126
|
+
walrusSiteUrl: network === "mainnet" ? `https://${r.name.slice(0, -4)}.wal.app` : `http://${r.name.slice(0, -4)}.localhost:3003`
|
|
127
|
+
})), [domains, network])
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/queries/walrus-site.query.ts
|
|
133
|
+
function handleError(error) {
|
|
134
|
+
switch (error.code) {
|
|
135
|
+
case "deleted": throw new Error("Walrus site has been deleted");
|
|
136
|
+
case "notExists": throw new Error("Walrus site does not exist");
|
|
137
|
+
case "displayError": throw new Error("Failed to fetch Walrus site display data");
|
|
138
|
+
case "dynamicFieldNotFound": throw new Error("Walrus site dynamic field not found");
|
|
139
|
+
default: throw new Error(`Unknown error when fetching Walrus site!`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async function fetchSiteDynamicFields(suiClient, siteId) {
|
|
143
|
+
const dynamicFields = [];
|
|
144
|
+
let cursor = null;
|
|
145
|
+
while (true) {
|
|
146
|
+
const page = await suiClient.getDynamicFields({
|
|
147
|
+
parentId: siteId,
|
|
148
|
+
cursor
|
|
149
|
+
});
|
|
150
|
+
cursor = page.nextCursor;
|
|
151
|
+
dynamicFields.push(...page.data);
|
|
152
|
+
if (!page.hasNextPage) break;
|
|
153
|
+
}
|
|
154
|
+
return dynamicFields;
|
|
155
|
+
}
|
|
156
|
+
async function fetchSiteResources(suiClient, siteId, packageId) {
|
|
157
|
+
const resourcePaths = (await fetchSiteDynamicFields(suiClient, siteId)).filter((f) => f.objectType === `${packageId}::site::Resource`).filter((r) => r.name.type === `${packageId}::site::ResourcePath`);
|
|
158
|
+
const resources = [];
|
|
159
|
+
for (const rp of resourcePaths) {
|
|
160
|
+
const resObj = await suiClient.getObject({
|
|
161
|
+
id: rp.objectId,
|
|
162
|
+
options: { showContent: true }
|
|
163
|
+
});
|
|
164
|
+
if (resObj.data?.content?.dataType !== "moveObject") throw new Error("Invalid resource object data type");
|
|
165
|
+
const fields = resObj.data?.content?.fields;
|
|
166
|
+
if (Array.isArray(fields)) throw new Error("Invalid resource object fields");
|
|
167
|
+
if (!("value" in fields)) throw new Error("Invalid resource object fields value");
|
|
168
|
+
const resourceValue = fields.value;
|
|
169
|
+
const result = {
|
|
170
|
+
blob_hash: resourceValue.fields.blob_hash,
|
|
171
|
+
blob_id: resourceValue.fields.blob_id,
|
|
172
|
+
headers: resourceValue.fields.headers.fields.contents.map((c) => c.fields),
|
|
173
|
+
path: resourceValue.fields.path
|
|
174
|
+
};
|
|
175
|
+
resources.push(result);
|
|
176
|
+
}
|
|
177
|
+
return resources;
|
|
178
|
+
}
|
|
179
|
+
async function fetchWalrusSiteData(suiClient, id, packageId) {
|
|
180
|
+
const objRes = await suiClient.getObject({
|
|
181
|
+
id,
|
|
182
|
+
options: { showDisplay: true }
|
|
183
|
+
});
|
|
184
|
+
const error = objRes.data?.display?.error ?? objRes.error;
|
|
185
|
+
if (error) handleError(error);
|
|
186
|
+
const data = objRes.data?.display?.data;
|
|
187
|
+
if (!data) throw new Error("No data returned for Walrus site");
|
|
188
|
+
const siteData = data;
|
|
189
|
+
const resources = await fetchSiteResources(suiClient, id, packageId);
|
|
190
|
+
return {
|
|
191
|
+
id,
|
|
192
|
+
...siteData,
|
|
193
|
+
resources
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function useWalrusSiteQuery(id, clients) {
|
|
197
|
+
const { network } = clients.suiClient;
|
|
198
|
+
const packageId = useMemo(() => mainPackage[network].packageId, [network]);
|
|
199
|
+
return useQuery({
|
|
200
|
+
queryKey: queryKeys.walrusSite(id),
|
|
201
|
+
queryFn: async () => {
|
|
202
|
+
if (!id) throw new Error("No site ID provided");
|
|
203
|
+
return fetchWalrusSiteData(clients.suiClient, id, packageId);
|
|
204
|
+
},
|
|
205
|
+
enabled: !!id
|
|
206
|
+
}, clients.queryClient);
|
|
207
|
+
}
|
|
208
|
+
async function fetchWalrusSitesListPaginated(suiClient, address, packageId, limit, cursorParam) {
|
|
209
|
+
try {
|
|
210
|
+
const response = await suiClient.getOwnedObjects({
|
|
211
|
+
owner: address,
|
|
212
|
+
filter: { StructType: `${packageId}::site::Site` },
|
|
213
|
+
options: {
|
|
214
|
+
showDisplay: true,
|
|
215
|
+
showType: true
|
|
216
|
+
},
|
|
217
|
+
cursor: cursorParam,
|
|
218
|
+
limit: limit || 50
|
|
219
|
+
});
|
|
220
|
+
if (!response.data || response.data.length === 0) return {
|
|
221
|
+
sites: [],
|
|
222
|
+
nextCursor: response.nextCursor || null,
|
|
223
|
+
hasNextPage: response.hasNextPage
|
|
224
|
+
};
|
|
225
|
+
return {
|
|
226
|
+
sites: response.data.filter((obj) => {
|
|
227
|
+
if (!obj.data) {
|
|
228
|
+
console.warn("Object missing data:", obj);
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
if (obj.data.display?.error) {
|
|
232
|
+
console.warn("Display error for site:", obj.data.objectId, obj.data.display.error);
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
const type = obj.data.type;
|
|
236
|
+
if (!type || type !== `${packageId}::site::Site`) return false;
|
|
237
|
+
if (!obj.data.objectId) {
|
|
238
|
+
console.warn("Object missing objectId:", obj);
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
return true;
|
|
242
|
+
}).map((obj) => {
|
|
243
|
+
if (!obj.data) return null;
|
|
244
|
+
const display = obj.data.display?.data;
|
|
245
|
+
if (!display) {
|
|
246
|
+
console.warn("No display data for site:", obj.data.objectId);
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
const displayData = display;
|
|
250
|
+
if (!displayData.name) {
|
|
251
|
+
console.warn("Site missing name:", obj.data.objectId);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
id: obj.data.objectId,
|
|
256
|
+
name: displayData.name,
|
|
257
|
+
description: displayData.description || "",
|
|
258
|
+
image_url: displayData.image_url || "",
|
|
259
|
+
link: displayData.link || "",
|
|
260
|
+
project_url: displayData.project_url || "",
|
|
261
|
+
creator: displayData.creator || "",
|
|
262
|
+
resources: []
|
|
263
|
+
};
|
|
264
|
+
}).filter((site) => site !== null),
|
|
265
|
+
nextCursor: response.nextCursor || null,
|
|
266
|
+
hasNextPage: response.hasNextPage
|
|
267
|
+
};
|
|
268
|
+
} catch (error) {
|
|
269
|
+
console.error("Error fetching Walrus sites list:", error);
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function useWalrusSitesQuery(address, options, clients) {
|
|
274
|
+
const { suiClient, queryClient } = clients;
|
|
275
|
+
const { network } = suiClient;
|
|
276
|
+
const packageId = useMemo(() => mainPackage[network].packageId, [network]);
|
|
277
|
+
console.log("🔍 Fetching Walrus sites list for address:", address, packageId);
|
|
278
|
+
const sitesListQuery = useQuery({
|
|
279
|
+
queryKey: [
|
|
280
|
+
...queryKeys.walrusSites(address, network),
|
|
281
|
+
options?.cursor,
|
|
282
|
+
options?.limit
|
|
283
|
+
],
|
|
284
|
+
queryFn: async () => {
|
|
285
|
+
if (!address) return {
|
|
286
|
+
sites: [],
|
|
287
|
+
nextCursor: null,
|
|
288
|
+
hasNextPage: false
|
|
289
|
+
};
|
|
290
|
+
return fetchWalrusSitesListPaginated(suiClient, address, packageId, options?.limit, options?.cursor);
|
|
291
|
+
},
|
|
292
|
+
enabled: !!address,
|
|
293
|
+
staleTime: 1e3 * 60 * 5,
|
|
294
|
+
retry: 2,
|
|
295
|
+
retryDelay: (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4)
|
|
296
|
+
}, queryClient);
|
|
297
|
+
return {
|
|
298
|
+
data: sitesListQuery.data?.sites ?? [],
|
|
299
|
+
nextCursor: sitesListQuery.data?.nextCursor ?? null,
|
|
300
|
+
hasNextPage: sitesListQuery.data?.hasNextPage ?? false,
|
|
301
|
+
isLoading: sitesListQuery.isLoading,
|
|
302
|
+
isError: sitesListQuery.isError,
|
|
303
|
+
error: sitesListQuery.error
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/queries/zenfs-files.query.ts
|
|
309
|
+
function useZenfsFilesQuery(fm, clients) {
|
|
310
|
+
const { queryClient } = clients;
|
|
311
|
+
return useQuery({
|
|
312
|
+
queryKey: ["zenfs-files", fm?.workspaceDir],
|
|
313
|
+
queryFn: async () => {
|
|
314
|
+
if (!fm) return [];
|
|
315
|
+
const files = await fm.listFiles();
|
|
316
|
+
const assets = [];
|
|
317
|
+
for (const path of files) {
|
|
318
|
+
const content$5 = await fm?.readFile(path);
|
|
319
|
+
if (!content$5) continue;
|
|
320
|
+
const hashU256 = sha256ToU256(await getSHA256Hash(content$5));
|
|
321
|
+
assets.push({
|
|
322
|
+
path,
|
|
323
|
+
content: content$5,
|
|
324
|
+
hashU256
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
return assets;
|
|
328
|
+
},
|
|
329
|
+
enabled: !!fm,
|
|
330
|
+
staleTime: 300 * 1e3
|
|
331
|
+
}, queryClient);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
//#endregion
|
|
335
|
+
//#region src/stores/site-domain.store.ts
|
|
336
|
+
const isDomainDialogOpen = atom(false);
|
|
337
|
+
const isAssigningDomain = atom(false);
|
|
338
|
+
const isRegisterSuiNSDomainDialogOpen = atom(false);
|
|
339
|
+
const isExtendTimeDialogOpen = atom(false);
|
|
340
|
+
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/stores/site-metadata.store.ts
|
|
343
|
+
const DEFAULT_TITLE = "wal-0";
|
|
344
|
+
const DEFAULT_DESCRIPTION = "WAL-0 Generated Project";
|
|
345
|
+
var SiteMetadata = class {
|
|
346
|
+
title = atom(DEFAULT_TITLE);
|
|
347
|
+
description = atom(DEFAULT_DESCRIPTION);
|
|
348
|
+
imageUrl = atom("https://www.walrus.xyz/walrus-site");
|
|
349
|
+
link = atom("");
|
|
350
|
+
projectUrl = atom("");
|
|
351
|
+
epochs = atom(5);
|
|
352
|
+
deletable = atom(false);
|
|
353
|
+
loading = atom(false);
|
|
354
|
+
suiNSUrl = atom([]);
|
|
355
|
+
originalTitle = atom(DEFAULT_TITLE);
|
|
356
|
+
originalDescription = atom(DEFAULT_DESCRIPTION);
|
|
357
|
+
originalImageUrl = atom("https://www.walrus.xyz/walrus-site");
|
|
358
|
+
originalLink = atom("");
|
|
359
|
+
originalProjectUrl = atom("");
|
|
360
|
+
originalEpochs = atom(5);
|
|
361
|
+
originalSuiNSUrl = atom([]);
|
|
362
|
+
isDirty = computed([
|
|
363
|
+
this.title,
|
|
364
|
+
this.description,
|
|
365
|
+
this.imageUrl,
|
|
366
|
+
this.link,
|
|
367
|
+
this.projectUrl,
|
|
368
|
+
this.epochs,
|
|
369
|
+
this.suiNSUrl,
|
|
370
|
+
this.originalTitle,
|
|
371
|
+
this.originalDescription,
|
|
372
|
+
this.originalImageUrl,
|
|
373
|
+
this.originalLink,
|
|
374
|
+
this.originalProjectUrl,
|
|
375
|
+
this.originalEpochs,
|
|
376
|
+
this.originalSuiNSUrl
|
|
377
|
+
], (title$5, description$5, iconUrl, link$3, projectUrl, epochs, suiNSUrl, originalTitle, originalDescription, originalIcon, originalLink, originalProjectUrl, originalEpochs, originalSuiNSUrl) => title$5 !== originalTitle || description$5 !== originalDescription || (iconUrl ?? null) !== (originalIcon ?? null) || link$3 !== originalLink || projectUrl !== originalProjectUrl || epochs !== originalEpochs || JSON.stringify(suiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))) !== JSON.stringify(originalSuiNSUrl.sort((a, b) => a.nftId.localeCompare(b.nftId))));
|
|
378
|
+
/**
|
|
379
|
+
* Computed URL for displaying the image preview
|
|
380
|
+
*/
|
|
381
|
+
imageDisplayUrl = computed([this.imageUrl], (imageUrl) => {
|
|
382
|
+
if (!imageUrl) return null;
|
|
383
|
+
if (typeof imageUrl === "string") return imageUrl;
|
|
384
|
+
return URL.createObjectURL(imageUrl);
|
|
385
|
+
});
|
|
386
|
+
commitChanges() {
|
|
387
|
+
this.originalTitle.set(this.title.get());
|
|
388
|
+
this.originalDescription.set(this.description.get());
|
|
389
|
+
this.originalImageUrl.set(this.imageUrl.get());
|
|
390
|
+
this.originalLink.set(this.link.get());
|
|
391
|
+
this.originalProjectUrl.set(this.projectUrl.get());
|
|
392
|
+
this.originalEpochs.set(this.epochs.get());
|
|
393
|
+
this.originalSuiNSUrl.set(this.suiNSUrl.get().map((item$1) => ({ ...item$1 })));
|
|
394
|
+
}
|
|
395
|
+
reset() {
|
|
396
|
+
this.title.set(this.originalTitle.get());
|
|
397
|
+
this.description.set(this.originalDescription.get());
|
|
398
|
+
this.imageUrl.set(this.originalImageUrl.get());
|
|
399
|
+
this.link.set(this.originalLink.get());
|
|
400
|
+
this.projectUrl.set(this.originalProjectUrl.get());
|
|
401
|
+
this.epochs.set(this.originalEpochs.get());
|
|
402
|
+
this.suiNSUrl.set(this.originalSuiNSUrl.get().map((item$1) => ({ ...item$1 })));
|
|
403
|
+
this.loading.set(false);
|
|
404
|
+
}
|
|
405
|
+
cancelEdit = () => this.reset();
|
|
406
|
+
};
|
|
407
|
+
const siteMetadataStore = new SiteMetadata();
|
|
408
|
+
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/lib/result.ts
|
|
411
|
+
function ok(data) {
|
|
412
|
+
return {
|
|
413
|
+
ok: true,
|
|
414
|
+
data
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
function failed(error) {
|
|
418
|
+
return {
|
|
419
|
+
ok: false,
|
|
420
|
+
error
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/stores/site-publishing.store.ts
|
|
426
|
+
let DeploySteps = /* @__PURE__ */ function(DeploySteps$1) {
|
|
427
|
+
DeploySteps$1[DeploySteps$1["Idle"] = 0] = "Idle";
|
|
428
|
+
DeploySteps$1[DeploySteps$1["Prepared"] = 1] = "Prepared";
|
|
429
|
+
DeploySteps$1[DeploySteps$1["Uploaded"] = 2] = "Uploaded";
|
|
430
|
+
DeploySteps$1[DeploySteps$1["Certified"] = 3] = "Certified";
|
|
431
|
+
DeploySteps$1[DeploySteps$1["Deployed"] = 4] = "Deployed";
|
|
432
|
+
return DeploySteps$1;
|
|
433
|
+
}({});
|
|
434
|
+
let DeploymentStatus = /* @__PURE__ */ function(DeploymentStatus$1) {
|
|
435
|
+
DeploymentStatus$1[DeploymentStatus$1["Idle"] = 0] = "Idle";
|
|
436
|
+
/** Preparing assets for upload */
|
|
437
|
+
DeploymentStatus$1[DeploymentStatus$1["Preparing"] = 1] = "Preparing";
|
|
438
|
+
/** Assets have been prepared */
|
|
439
|
+
DeploymentStatus$1[DeploymentStatus$1["Prepared"] = 2] = "Prepared";
|
|
440
|
+
/** Uploading assets to the network */
|
|
441
|
+
DeploymentStatus$1[DeploymentStatus$1["Uploading"] = 3] = "Uploading";
|
|
442
|
+
/** Assets have been uploaded */
|
|
443
|
+
DeploymentStatus$1[DeploymentStatus$1["Uploaded"] = 4] = "Uploaded";
|
|
444
|
+
/** Certify uploaded assets */
|
|
445
|
+
DeploymentStatus$1[DeploymentStatus$1["Certifying"] = 5] = "Certifying";
|
|
446
|
+
/** Assets have been certified */
|
|
447
|
+
DeploymentStatus$1[DeploymentStatus$1["Certified"] = 6] = "Certified";
|
|
448
|
+
/** Deploy site metadata */
|
|
449
|
+
DeploymentStatus$1[DeploymentStatus$1["Deploying"] = 7] = "Deploying";
|
|
450
|
+
/** Site has been deployed */
|
|
451
|
+
DeploymentStatus$1[DeploymentStatus$1["Deployed"] = 8] = "Deployed";
|
|
452
|
+
return DeploymentStatus$1;
|
|
453
|
+
}({});
|
|
454
|
+
var SitePublishingStore = class {
|
|
455
|
+
deployStatus = atom(DeploymentStatus.Idle);
|
|
456
|
+
deploymentStepIndex = computed([this.deployStatus], (s) => {
|
|
457
|
+
switch (s) {
|
|
458
|
+
case DeploymentStatus.Idle:
|
|
459
|
+
case DeploymentStatus.Preparing: return 0;
|
|
460
|
+
case DeploymentStatus.Prepared:
|
|
461
|
+
case DeploymentStatus.Uploading: return 1;
|
|
462
|
+
case DeploymentStatus.Uploaded:
|
|
463
|
+
case DeploymentStatus.Certifying: return 2;
|
|
464
|
+
case DeploymentStatus.Certified:
|
|
465
|
+
case DeploymentStatus.Deploying: return 3;
|
|
466
|
+
case DeploymentStatus.Deployed: return 4;
|
|
467
|
+
default: return 0;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
isPublishDialogOpen = atom(false);
|
|
471
|
+
certifiedBlobs = atom([]);
|
|
472
|
+
isWorking = computed([this.deployStatus], (deployStatus) => deployStatus !== DeploymentStatus.Idle && deployStatus !== DeploymentStatus.Prepared && deployStatus !== DeploymentStatus.Uploaded && deployStatus !== DeploymentStatus.Certified && deployStatus !== DeploymentStatus.Deployed);
|
|
473
|
+
deployStatusText = computed([this.deployStatus], (s) => {
|
|
474
|
+
switch (s) {
|
|
475
|
+
case DeploymentStatus.Idle: return "Start Deployment";
|
|
476
|
+
case DeploymentStatus.Preparing: return "Preparing assets...";
|
|
477
|
+
case DeploymentStatus.Prepared: return "Upload assets";
|
|
478
|
+
case DeploymentStatus.Uploading: return "Uploading assets...";
|
|
479
|
+
case DeploymentStatus.Uploaded: return "Certify assets";
|
|
480
|
+
case DeploymentStatus.Certifying: return "Certifying assets...";
|
|
481
|
+
case DeploymentStatus.Certified: return "Update Site Metadata";
|
|
482
|
+
case DeploymentStatus.Deploying: return "Updating site metadata...";
|
|
483
|
+
case DeploymentStatus.Deployed: return "Customize Domain";
|
|
484
|
+
default: return "Unknown status";
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
currentFlow;
|
|
488
|
+
siteId;
|
|
489
|
+
async runDeploymentStep(sdk, assets, site) {
|
|
490
|
+
if (this.isWorking.get()) return failed("Another operation is in progress");
|
|
491
|
+
switch (this.deployStatus.get()) {
|
|
492
|
+
case DeploymentStatus.Idle:
|
|
493
|
+
this.deployStatus.set(DeploymentStatus.Preparing);
|
|
494
|
+
try {
|
|
495
|
+
this.currentFlow = sdk.executeSiteUpdateFlow(assets, {
|
|
496
|
+
object_id: site.id,
|
|
497
|
+
site_name: site.title,
|
|
498
|
+
metadata: {
|
|
499
|
+
link: site.link,
|
|
500
|
+
description: site.description,
|
|
501
|
+
project_url: site.projectUrl,
|
|
502
|
+
image_url: site.imageUrl,
|
|
503
|
+
creator: site.creator ?? "CommandOSS Site Builder"
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
const diff = await this.currentFlow.prepareResources();
|
|
507
|
+
if (diff.resources.every((r) => r.op === "unchanged")) if (diff.site_name.op === "noop" && diff.metadata.op === "noop") {
|
|
508
|
+
this.deployStatus.set(DeploymentStatus.Idle);
|
|
509
|
+
return failed("No changes detected");
|
|
510
|
+
} else this.deployStatus.set(DeploymentStatus.Certified);
|
|
511
|
+
else this.deployStatus.set(DeploymentStatus.Prepared);
|
|
512
|
+
return this.runDeploymentStep(sdk, assets, site);
|
|
513
|
+
} catch (e) {
|
|
514
|
+
console.error("Failed to prepare assets:", e);
|
|
515
|
+
const msg = e instanceof Error ? e.message : "Failed to prepare assets";
|
|
516
|
+
this.deployStatus.set(DeploymentStatus.Idle);
|
|
517
|
+
return failed(msg);
|
|
518
|
+
}
|
|
519
|
+
case DeploymentStatus.Prepared: {
|
|
520
|
+
if (!this.currentFlow) return failed("Invalid deployment flow");
|
|
521
|
+
this.deployStatus.set(DeploymentStatus.Uploading);
|
|
522
|
+
const epochs = siteMetadataStore.epochs.get();
|
|
523
|
+
const deletable = siteMetadataStore.deletable.get();
|
|
524
|
+
try {
|
|
525
|
+
await this.currentFlow.writeResources(epochs, deletable);
|
|
526
|
+
} catch (e) {
|
|
527
|
+
console.error("Failed to upload assets:", e);
|
|
528
|
+
this.deployStatus.set(DeploymentStatus.Prepared);
|
|
529
|
+
return failed("Failed to upload assets");
|
|
530
|
+
}
|
|
531
|
+
this.deployStatus.set(DeploymentStatus.Uploaded);
|
|
532
|
+
return this.runDeploymentStep(sdk, assets, site);
|
|
533
|
+
}
|
|
534
|
+
case DeploymentStatus.Uploaded:
|
|
535
|
+
if (!this.currentFlow) return failed("Invalid deployment flow");
|
|
536
|
+
this.deployStatus.set(DeploymentStatus.Certifying);
|
|
537
|
+
try {
|
|
538
|
+
await this.currentFlow.certifyResources();
|
|
539
|
+
this.deployStatus.set(DeploymentStatus.Certified);
|
|
540
|
+
return this.runDeploymentStep(sdk, assets, site);
|
|
541
|
+
} catch (e) {
|
|
542
|
+
console.error("Failed to certify assets:", e);
|
|
543
|
+
this.deployStatus.set(DeploymentStatus.Uploaded);
|
|
544
|
+
return failed(e instanceof Error ? e.message : "Failed to certify assets");
|
|
545
|
+
}
|
|
546
|
+
case DeploymentStatus.Certified:
|
|
547
|
+
if (!this.currentFlow) return failed("Invalid deployment flow");
|
|
548
|
+
this.deployStatus.set(DeploymentStatus.Deploying);
|
|
549
|
+
try {
|
|
550
|
+
const { siteId } = await this.currentFlow.writeSite();
|
|
551
|
+
if (!siteId) throw new Error("No site ID returned");
|
|
552
|
+
this.deployStatus.set(DeploymentStatus.Deployed);
|
|
553
|
+
this.siteId = siteId;
|
|
554
|
+
return ok(siteId);
|
|
555
|
+
} catch (e) {
|
|
556
|
+
console.error("Failed to deploy site:", e);
|
|
557
|
+
this.deployStatus.set(DeploymentStatus.Certified);
|
|
558
|
+
return failed(e instanceof Error ? e.message : "Failed to deploy site");
|
|
559
|
+
}
|
|
560
|
+
case DeploymentStatus.Deployed:
|
|
561
|
+
if (!this.siteId) return failed("Invalid state");
|
|
562
|
+
this.reset();
|
|
563
|
+
this.closePublishDialog();
|
|
564
|
+
this.openCustomDomainDialog();
|
|
565
|
+
return ok(this.siteId);
|
|
566
|
+
default: return failed("Invalid deployment step");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
reset() {
|
|
570
|
+
this.deployStatus.set(DeploymentStatus.Idle);
|
|
571
|
+
this.certifiedBlobs.set([]);
|
|
572
|
+
this.currentFlow = void 0;
|
|
573
|
+
}
|
|
574
|
+
closePublishDialog = () => this.isPublishDialogOpen.set(false);
|
|
575
|
+
openCustomDomainDialog = () => isDomainDialogOpen.set(true);
|
|
576
|
+
};
|
|
577
|
+
const sitePublishingStore = new SitePublishingStore();
|
|
578
|
+
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/hooks/useTransactionExecutor.ts
|
|
581
|
+
/**
|
|
582
|
+
* React hook to create a TransactionExecutorService instance.
|
|
583
|
+
* Automatically handles sponsor configuration and wallet changes.
|
|
584
|
+
*/
|
|
585
|
+
function useTransactionExecutor({ suiClient, walletAddress, signAndExecuteTransaction, sponsorConfig }) {
|
|
586
|
+
return useMemo(() => {
|
|
587
|
+
if (!walletAddress) return null;
|
|
588
|
+
return new TransactionExecutorService({
|
|
589
|
+
suiClient,
|
|
590
|
+
walletAddress,
|
|
591
|
+
signAndExecuteTransaction,
|
|
592
|
+
sponsorConfig
|
|
593
|
+
});
|
|
594
|
+
}, [
|
|
595
|
+
suiClient,
|
|
596
|
+
walletAddress,
|
|
597
|
+
signAndExecuteTransaction,
|
|
598
|
+
sponsorConfig
|
|
599
|
+
]);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/hooks/useSitePublishing.ts
|
|
604
|
+
function useSitePublishing({ siteId, assets, onUpdateSiteMetadata, onAssociatedDomain, onError, onExtendedBlobs, currentAccount, signAndExecuteTransaction, sponsorConfig, portalDomain, portalHttps, clients: { suiClient, queryClient, suinsClient, walrusClient } }) {
|
|
605
|
+
const [isExtending, setIsExtending] = useState(false);
|
|
606
|
+
const txExecutor = useTransactionExecutor({
|
|
607
|
+
suiClient,
|
|
608
|
+
walletAddress: currentAccount?.address,
|
|
609
|
+
signAndExecuteTransaction,
|
|
610
|
+
sponsorConfig
|
|
611
|
+
});
|
|
612
|
+
const sdk = useMemo(() => {
|
|
613
|
+
if (!suiClient || !walrusClient || !currentAccount) return;
|
|
614
|
+
return new WalrusSiteBuilderSdk(walrusClient, suiClient, currentAccount.address, signAndExecuteTransaction, sponsorConfig);
|
|
615
|
+
}, [
|
|
616
|
+
suiClient,
|
|
617
|
+
walrusClient,
|
|
618
|
+
currentAccount,
|
|
619
|
+
signAndExecuteTransaction,
|
|
620
|
+
sponsorConfig
|
|
621
|
+
]);
|
|
622
|
+
const { data: nsDomains, isLoading: isLoadingNsDomains, isError: isErrorNsDomains } = useSuiNsDomainsQuery(currentAccount, {
|
|
623
|
+
suiClient,
|
|
624
|
+
queryClient
|
|
625
|
+
});
|
|
626
|
+
const { data: walrusSiteData } = useWalrusSiteQuery(siteId, {
|
|
627
|
+
suiClient,
|
|
628
|
+
queryClient
|
|
629
|
+
});
|
|
630
|
+
const isPublishDialogOpen = useStore(sitePublishingStore.isPublishDialogOpen);
|
|
631
|
+
const isWorking = useStore(sitePublishingStore.isWorking);
|
|
632
|
+
const certifiedBlobs = useStore(sitePublishingStore.certifiedBlobs);
|
|
633
|
+
const deployStatus = useStore(sitePublishingStore.deployStatus);
|
|
634
|
+
const deployStatusText = useStore(sitePublishingStore.deployStatusText);
|
|
635
|
+
const deployStepIndex = useStore(sitePublishingStore.deploymentStepIndex);
|
|
636
|
+
const epochs = useStore(siteMetadataStore.epochs);
|
|
637
|
+
const title$5 = useStore(siteMetadataStore.title);
|
|
638
|
+
const imageUrl = useStore(siteMetadataStore.imageUrl);
|
|
639
|
+
const link$3 = useStore(siteMetadataStore.link);
|
|
640
|
+
const description$5 = useStore(siteMetadataStore.description);
|
|
641
|
+
const isEditingSiteMetadata = useStore(siteMetadataStore.isDirty);
|
|
642
|
+
const isSavingSiteMetadata = useStore(siteMetadataStore.loading);
|
|
643
|
+
const isAssigning = useStore(isAssigningDomain);
|
|
644
|
+
const isDeployed = !!siteId;
|
|
645
|
+
const walrusSiteUrl = useMemo(() => {
|
|
646
|
+
if (!siteId) return null;
|
|
647
|
+
return objectIdToWalrusSiteUrl(siteId, portalDomain, portalHttps);
|
|
648
|
+
}, [
|
|
649
|
+
siteId,
|
|
650
|
+
portalDomain,
|
|
651
|
+
portalHttps
|
|
652
|
+
]);
|
|
653
|
+
const associatedDomains = nsDomains.filter((d) => d.walrusSiteId === siteId);
|
|
654
|
+
useEffect(() => {
|
|
655
|
+
if (!walrusSiteData) return;
|
|
656
|
+
console.log("🔄 Syncing Walrus site data to store", walrusSiteData);
|
|
657
|
+
siteMetadataStore.originalTitle.set(walrusSiteData.name ?? "");
|
|
658
|
+
siteMetadataStore.originalDescription.set(walrusSiteData.description ?? "");
|
|
659
|
+
siteMetadataStore.originalImageUrl.set(walrusSiteData.image_url ?? null);
|
|
660
|
+
siteMetadataStore.originalProjectUrl.set(walrusSiteData.project_url ?? null);
|
|
661
|
+
siteMetadataStore.originalLink.set(walrusSiteData.link ?? "");
|
|
662
|
+
siteMetadataStore.reset();
|
|
663
|
+
}, [walrusSiteData]);
|
|
664
|
+
const handleRunDeploymentStep = async () => {
|
|
665
|
+
if (!sdk) return onError?.("SDK not initialized");
|
|
666
|
+
if (imageUrl instanceof File) return onError?.("Please upload image first.");
|
|
667
|
+
const siteMetadata = {
|
|
668
|
+
id: siteId,
|
|
669
|
+
title: title$5,
|
|
670
|
+
description: description$5,
|
|
671
|
+
imageUrl: imageUrl ?? void 0,
|
|
672
|
+
link: siteMetadataStore.link.get() ?? void 0,
|
|
673
|
+
projectUrl: siteMetadataStore.projectUrl.get() ?? void 0
|
|
674
|
+
};
|
|
675
|
+
const result = await sitePublishingStore.runDeploymentStep(sdk, assets, siteMetadata);
|
|
676
|
+
if (!result.ok) return onError?.(result.error || "Deployment failed");
|
|
677
|
+
siteMetadata.id = result.data;
|
|
678
|
+
await onUpdateSiteMetadata?.(siteMetadata);
|
|
679
|
+
siteMetadataStore.commitChanges();
|
|
680
|
+
};
|
|
681
|
+
const handleSaveSiteMetadata = async () => {
|
|
682
|
+
if (!onUpdateSiteMetadata) {
|
|
683
|
+
siteMetadataStore.commitChanges();
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
siteMetadataStore.loading.set(true);
|
|
687
|
+
try {
|
|
688
|
+
const result = await onUpdateSiteMetadata({
|
|
689
|
+
id: siteId,
|
|
690
|
+
title: siteMetadataStore.title.get(),
|
|
691
|
+
description: siteMetadataStore.description.get(),
|
|
692
|
+
imageUrl: siteMetadataStore.imageUrl.get() ?? void 0,
|
|
693
|
+
link: siteMetadataStore.link.get() ?? void 0,
|
|
694
|
+
projectUrl: siteMetadataStore.projectUrl.get() ?? void 0
|
|
695
|
+
});
|
|
696
|
+
if (!result) throw new Error("Failed to save site metadata");
|
|
697
|
+
if (result.title) siteMetadataStore.title.set(result.title);
|
|
698
|
+
if (result.description) siteMetadataStore.description.set(result.description);
|
|
699
|
+
if (result.imageUrl) siteMetadataStore.imageUrl.set(result.imageUrl);
|
|
700
|
+
siteMetadataStore.link.set(result.link ?? "");
|
|
701
|
+
siteMetadataStore.projectUrl.set(result.projectUrl ?? "");
|
|
702
|
+
siteMetadataStore.commitChanges();
|
|
703
|
+
} finally {
|
|
704
|
+
siteMetadataStore.loading.set(false);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
const handleAssociateDomain = async (nftId, siteId$1, suiNSName) => {
|
|
708
|
+
if (!suinsClient) return onError?.("SuiNS client not available");
|
|
709
|
+
if (!nftId) return onError?.("No domain selected");
|
|
710
|
+
if (!txExecutor) return onError?.("Transaction executor not available");
|
|
711
|
+
isAssigningDomain.set(true);
|
|
712
|
+
try {
|
|
713
|
+
try {
|
|
714
|
+
const transaction = new Transaction();
|
|
715
|
+
new SuinsTransaction(suinsClient, transaction).setUserData({
|
|
716
|
+
nft: nftId,
|
|
717
|
+
key: ALLOWED_METADATA.walrusSiteId,
|
|
718
|
+
value: siteId$1
|
|
719
|
+
});
|
|
720
|
+
const digest = await txExecutor.execute({
|
|
721
|
+
transaction,
|
|
722
|
+
description: "Associate domain with Walrus site"
|
|
723
|
+
});
|
|
724
|
+
await suiClient.waitForTransaction({ digest });
|
|
725
|
+
await queryClient.invalidateQueries({ predicate: (query) => {
|
|
726
|
+
const key = query.queryKey[0];
|
|
727
|
+
return key === "suins-domains" || key === "suins-domain-detail";
|
|
728
|
+
} });
|
|
729
|
+
const currentDomains = siteMetadataStore.suiNSUrl.get();
|
|
730
|
+
const domainEntry = {
|
|
731
|
+
suins: suiNSName,
|
|
732
|
+
nftId
|
|
733
|
+
};
|
|
734
|
+
if (!currentDomains.some((d) => d.nftId === nftId)) siteMetadataStore.suiNSUrl.set([...currentDomains, domainEntry]);
|
|
735
|
+
await onAssociatedDomain?.(nftId, siteId$1, suiNSName);
|
|
736
|
+
} catch (e) {
|
|
737
|
+
console.error("🚨 Failed to update SuiNS metadata:", e);
|
|
738
|
+
onError?.("Failed to update SuiNS metadata");
|
|
739
|
+
}
|
|
740
|
+
} finally {
|
|
741
|
+
isAssigningDomain.set(false);
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
function handleOpenDomainDialog() {
|
|
745
|
+
isDomainDialogOpen.set(true);
|
|
746
|
+
}
|
|
747
|
+
function handleOpenPublishingDialog() {
|
|
748
|
+
sitePublishingStore.isPublishDialogOpen.set(true);
|
|
749
|
+
}
|
|
750
|
+
const handleExtendBlobs = async (extendEpochs) => {
|
|
751
|
+
if (!walrusClient || !currentAccount || !walrusSiteData?.resources || walrusSiteData.resources.length === 0) {
|
|
752
|
+
onError?.("Cannot extend blobs: missing required data");
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
if (!extendEpochs || extendEpochs <= 0 || extendEpochs > 365) {
|
|
756
|
+
onError?.("Invalid epoch count. Must be between 1 and 365");
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (!txExecutor) {
|
|
760
|
+
onError?.("Transaction executor not available");
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setIsExtending(true);
|
|
764
|
+
try {
|
|
765
|
+
const blobType = await walrusClient.getBlobType();
|
|
766
|
+
const walCoinType = mainPackage[suiClient.network].walrusCoinType;
|
|
767
|
+
const walrusPackageId = mainPackage[suiClient.network].walrusPackageId;
|
|
768
|
+
const systemObjectId = suiClient.network === "mainnet" ? MAINNET_WALRUS_PACKAGE_CONFIG.systemObjectId : TESTNET_WALRUS_PACKAGE_CONFIG.systemObjectId;
|
|
769
|
+
const blobIdToObjectIdMap = /* @__PURE__ */ new Map();
|
|
770
|
+
let cursor = null;
|
|
771
|
+
let hasNextPage = true;
|
|
772
|
+
while (hasNextPage) {
|
|
773
|
+
const ownedObjects = await suiClient.getOwnedObjects({
|
|
774
|
+
owner: currentAccount.address,
|
|
775
|
+
filter: { StructType: blobType },
|
|
776
|
+
options: { showContent: true },
|
|
777
|
+
cursor
|
|
778
|
+
});
|
|
779
|
+
console.log("walrusSiteData.resources", walrusSiteData.resources);
|
|
780
|
+
for (const resource of walrusSiteData.resources) {
|
|
781
|
+
const blobId = resource.blob_id;
|
|
782
|
+
for (const obj of ownedObjects.data) if (obj.data?.content && "fields" in obj.data.content) {
|
|
783
|
+
const fields = obj.data.content.fields;
|
|
784
|
+
if ("blob_id" in fields) {
|
|
785
|
+
if (String(fields.blob_id) === blobId && !blobIdToObjectIdMap.has(blobId)) {
|
|
786
|
+
blobIdToObjectIdMap.set(blobId, obj.data.objectId);
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
hasNextPage = ownedObjects.hasNextPage;
|
|
793
|
+
cursor = ownedObjects.nextCursor;
|
|
794
|
+
}
|
|
795
|
+
if (blobIdToObjectIdMap.size === 0) throw new Error("No blob objects found for this site. Make sure you own the blob objects.");
|
|
796
|
+
const tx = new Transaction();
|
|
797
|
+
tx.setSender(currentAccount.address);
|
|
798
|
+
const walCoin = await suiClient.getCoins({
|
|
799
|
+
owner: currentAccount.address,
|
|
800
|
+
coinType: walCoinType
|
|
801
|
+
});
|
|
802
|
+
if (walCoin.data.length === 0) throw new Error(`No WAL coins found in wallet. Please acquire WAL tokens first.`);
|
|
803
|
+
if (walCoin.data.length > 1) tx.mergeCoins(tx.object(walCoin.data[0].coinObjectId), walCoin.data.slice(1).map((coin) => tx.object(coin.coinObjectId)));
|
|
804
|
+
for (const [_blobId, objectId] of blobIdToObjectIdMap.entries()) tx.moveCall({
|
|
805
|
+
package: walrusPackageId,
|
|
806
|
+
module: "system",
|
|
807
|
+
function: "extend_blob",
|
|
808
|
+
arguments: [
|
|
809
|
+
tx.object(systemObjectId),
|
|
810
|
+
tx.object(objectId),
|
|
811
|
+
tx.pure.u32(extendEpochs),
|
|
812
|
+
tx.object(walCoin.data[0].coinObjectId)
|
|
813
|
+
]
|
|
814
|
+
});
|
|
815
|
+
const digest = await txExecutor.execute({
|
|
816
|
+
transaction: tx,
|
|
817
|
+
description: `Extending ${blobIdToObjectIdMap.size} blob(s) by ${extendEpochs} epoch(s)`
|
|
818
|
+
});
|
|
819
|
+
await suiClient.waitForTransaction({ digest });
|
|
820
|
+
await queryClient.invalidateQueries({ predicate: (query) => {
|
|
821
|
+
const key = query.queryKey;
|
|
822
|
+
return Array.isArray(key) && (key[0] === "walrus-site" || key[0] === "walrus-sites") || false;
|
|
823
|
+
} });
|
|
824
|
+
onExtendedBlobs?.(`Successfully extended ${blobIdToObjectIdMap.size} blob(s) by ${extendEpochs} epoch(s)`, digest);
|
|
825
|
+
} catch (error) {
|
|
826
|
+
console.error("Error extending blobs:", error);
|
|
827
|
+
onError?.(`Failed to extend blobs: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
828
|
+
} finally {
|
|
829
|
+
setIsExtending(false);
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
return {
|
|
833
|
+
state: {
|
|
834
|
+
isDeployed,
|
|
835
|
+
isAssigning,
|
|
836
|
+
isExtending,
|
|
837
|
+
isPublishDialogOpen,
|
|
838
|
+
isWorking,
|
|
839
|
+
certifiedBlobs,
|
|
840
|
+
epochs,
|
|
841
|
+
title: title$5,
|
|
842
|
+
iconUrl: imageUrl,
|
|
843
|
+
description: description$5,
|
|
844
|
+
link: link$3,
|
|
845
|
+
isEditingSiteMetadata,
|
|
846
|
+
deployStatus,
|
|
847
|
+
deployStatusText,
|
|
848
|
+
deployStepIndex,
|
|
849
|
+
walrusSiteUrl,
|
|
850
|
+
nsDomains,
|
|
851
|
+
isLoadingNsDomains,
|
|
852
|
+
isErrorNsDomains,
|
|
853
|
+
isSavingSiteMetadata,
|
|
854
|
+
associatedDomains
|
|
855
|
+
},
|
|
856
|
+
actions: {
|
|
857
|
+
handleRunDeploymentStep,
|
|
858
|
+
handleSaveSiteMetadata,
|
|
859
|
+
handleAssociateDomain,
|
|
860
|
+
handleExtendBlobs,
|
|
861
|
+
handleOpenDomainDialog,
|
|
862
|
+
handleOpenPublishingDialog,
|
|
863
|
+
handleCancelEditingSiteMetadata: siteMetadataStore.reset
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
//#endregion
|
|
869
|
+
//#region src/hooks/useEpochDuration.ts
|
|
870
|
+
function useEpochDuration(walrusClient) {
|
|
871
|
+
const [epochDurationMs, setEpochDurationMs] = useState(null);
|
|
872
|
+
useEffect(() => {
|
|
873
|
+
const fetchEpochDuration = async () => {
|
|
874
|
+
if (!walrusClient) return;
|
|
875
|
+
try {
|
|
876
|
+
const stakingState = await walrusClient.stakingState();
|
|
877
|
+
setEpochDurationMs(Number(stakingState.epoch_duration));
|
|
878
|
+
} catch (error) {
|
|
879
|
+
console.error("Error fetching epoch duration:", error);
|
|
880
|
+
setEpochDurationMs(1440 * 60 * 1e3);
|
|
881
|
+
}
|
|
882
|
+
};
|
|
883
|
+
fetchEpochDuration();
|
|
884
|
+
}, [walrusClient]);
|
|
885
|
+
const getExpirationDate = useMemo(() => {
|
|
886
|
+
return (epochs) => {
|
|
887
|
+
if (!epochDurationMs || !epochs || epochs <= 0) return null;
|
|
888
|
+
const now = Date.now();
|
|
889
|
+
return new Date(now + epochs * epochDurationMs);
|
|
890
|
+
};
|
|
891
|
+
}, [epochDurationMs]);
|
|
892
|
+
const formatDate = (date) => {
|
|
893
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
894
|
+
year: "numeric",
|
|
895
|
+
month: "short",
|
|
896
|
+
day: "numeric",
|
|
897
|
+
hour: "2-digit",
|
|
898
|
+
minute: "2-digit"
|
|
899
|
+
}).format(date);
|
|
900
|
+
};
|
|
901
|
+
return {
|
|
902
|
+
epochDurationMs,
|
|
903
|
+
getExpirationDate,
|
|
904
|
+
formatDate
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/hooks/useSuiNsRegistration.ts
|
|
910
|
+
function useSuiNsRegistration({ currentAccount, clients: { suiClient, queryClient, suinsClient }, signAndExecuteTransaction, sponsorConfig }) {
|
|
911
|
+
const txExecutor = useTransactionExecutor({
|
|
912
|
+
suiClient,
|
|
913
|
+
walletAddress: currentAccount?.address,
|
|
914
|
+
signAndExecuteTransaction,
|
|
915
|
+
sponsorConfig
|
|
916
|
+
});
|
|
917
|
+
const [searchName, setSearchName] = useState("");
|
|
918
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
919
|
+
const [isAvailable, setIsAvailable] = useState(null);
|
|
920
|
+
const [isRegistering, setIsRegistering] = useState(false);
|
|
921
|
+
const [isSwapping, setIsSwapping] = useState(false);
|
|
922
|
+
const [estimatedPrice, setEstimatedPrice] = useState(null);
|
|
923
|
+
const [error, setError] = useState(null);
|
|
924
|
+
const normalizedName = searchName.toLowerCase().trim();
|
|
925
|
+
const fullName = normalizedName ? `${normalizedName}.sui` : "";
|
|
926
|
+
const network = suiClient.network;
|
|
927
|
+
const isMainnet = network === "mainnet";
|
|
928
|
+
const isTestnet = network === "testnet";
|
|
929
|
+
const WAL_COIN_TYPE = mainPackage[network]?.walrusCoinType;
|
|
930
|
+
const aggregatorClient = useMemo(() => {
|
|
931
|
+
if (!suiClient || !currentAccount || !isMainnet) return null;
|
|
932
|
+
return new AggregatorClient({
|
|
933
|
+
signer: currentAccount.address,
|
|
934
|
+
client: suiClient,
|
|
935
|
+
env: Env.Mainnet
|
|
936
|
+
});
|
|
937
|
+
}, [
|
|
938
|
+
suiClient,
|
|
939
|
+
currentAccount,
|
|
940
|
+
isMainnet
|
|
941
|
+
]);
|
|
942
|
+
return {
|
|
943
|
+
searchName,
|
|
944
|
+
setSearchName,
|
|
945
|
+
isSearching,
|
|
946
|
+
isAvailable,
|
|
947
|
+
isRegistering,
|
|
948
|
+
isSwapping,
|
|
949
|
+
estimatedPrice,
|
|
950
|
+
error,
|
|
951
|
+
normalizedName,
|
|
952
|
+
fullName,
|
|
953
|
+
handleSearch: useCallback(async () => {
|
|
954
|
+
if (!normalizedName || !suinsClient) return;
|
|
955
|
+
if (normalizedName.length < 3) {
|
|
956
|
+
setError("Domain name must be at least 3 characters");
|
|
957
|
+
setIsAvailable(null);
|
|
958
|
+
setEstimatedPrice(null);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
setIsSearching(true);
|
|
962
|
+
setError(null);
|
|
963
|
+
setIsAvailable(null);
|
|
964
|
+
setEstimatedPrice(null);
|
|
965
|
+
try {
|
|
966
|
+
const available = !(await suinsClient.getNameRecord(fullName))?.nftId;
|
|
967
|
+
setIsAvailable(available);
|
|
968
|
+
if (available && currentAccount && isMainnet && WAL_COIN_TYPE && aggregatorClient) try {
|
|
969
|
+
const priceList = await suinsClient.getPriceList();
|
|
970
|
+
const nameLength = normalizedName.length;
|
|
971
|
+
let pricePerYear = 0;
|
|
972
|
+
for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
|
|
973
|
+
pricePerYear = price;
|
|
974
|
+
break;
|
|
975
|
+
}
|
|
976
|
+
if (pricePerYear > 0) {
|
|
977
|
+
const totalPrice = pricePerYear * 1;
|
|
978
|
+
const requiredAmount = BigInt(Math.floor(totalPrice * 1.05));
|
|
979
|
+
const usdcBalance = (await suiClient.getCoins({
|
|
980
|
+
owner: currentAccount.address,
|
|
981
|
+
coinType: suinsClient.config.coins.USDC.type
|
|
982
|
+
})).data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
|
|
983
|
+
const missingUsdc = usdcBalance < requiredAmount ? requiredAmount - usdcBalance : requiredAmount;
|
|
984
|
+
const baseWalAtomic = 1000000000n;
|
|
985
|
+
const rateRouter = await aggregatorClient.findRouters({
|
|
986
|
+
from: WAL_COIN_TYPE,
|
|
987
|
+
target: suinsClient.config.coins.USDC.type,
|
|
988
|
+
amount: new BN(baseWalAtomic.toString()),
|
|
989
|
+
byAmountIn: true,
|
|
990
|
+
providers: ["CETUS"]
|
|
991
|
+
});
|
|
992
|
+
if (rateRouter && !rateRouter.error && rateRouter.amountOut) {
|
|
993
|
+
const rawAmountOut = rateRouter.amountOut;
|
|
994
|
+
const usdcOutForOneWal = BigInt(rawAmountOut instanceof BN ? rawAmountOut.toString() : new BN(String(rawAmountOut)).toString());
|
|
995
|
+
if (usdcOutForOneWal > 0n) {
|
|
996
|
+
const exchangeRate = Number(baseWalAtomic) / Number(usdcOutForOneWal);
|
|
997
|
+
const estimatedWalNeeded = missingUsdc * BigInt(Math.ceil(exchangeRate));
|
|
998
|
+
setEstimatedPrice(`~${(Number(estimatedWalNeeded) / 1e9).toFixed(4)} WAL`);
|
|
999
|
+
} else setEstimatedPrice(`~${(Number(requiredAmount) / 1e6).toFixed(2)} USDC`);
|
|
1000
|
+
} else setEstimatedPrice(`~${(Number(requiredAmount) / 1e6).toFixed(2)} USDC`);
|
|
1001
|
+
}
|
|
1002
|
+
} catch (priceError) {
|
|
1003
|
+
console.error("Error estimating price:", priceError);
|
|
1004
|
+
}
|
|
1005
|
+
} catch (error$1) {
|
|
1006
|
+
console.error("Error checking name:", error$1);
|
|
1007
|
+
setIsAvailable(true);
|
|
1008
|
+
} finally {
|
|
1009
|
+
setIsSearching(false);
|
|
1010
|
+
}
|
|
1011
|
+
}, [
|
|
1012
|
+
normalizedName,
|
|
1013
|
+
fullName,
|
|
1014
|
+
suinsClient,
|
|
1015
|
+
currentAccount,
|
|
1016
|
+
isMainnet,
|
|
1017
|
+
WAL_COIN_TYPE,
|
|
1018
|
+
aggregatorClient,
|
|
1019
|
+
suiClient
|
|
1020
|
+
]),
|
|
1021
|
+
handleRegister: useCallback(async () => {
|
|
1022
|
+
if (!suinsClient || !currentAccount || !isAvailable || !normalizedName) return;
|
|
1023
|
+
if (!txExecutor) {
|
|
1024
|
+
setError("Transaction executor not available");
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
setIsRegistering(true);
|
|
1028
|
+
setError(null);
|
|
1029
|
+
try {
|
|
1030
|
+
const priceList = await suinsClient.getPriceList();
|
|
1031
|
+
const nameLength = normalizedName.length;
|
|
1032
|
+
let pricePerYear = 0;
|
|
1033
|
+
for (const [[from, to], price] of priceList.entries()) if (nameLength >= from && nameLength <= to) {
|
|
1034
|
+
pricePerYear = price;
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
if (pricePerYear === 0) throw new Error("Unable to determine price for this domain");
|
|
1038
|
+
const years = 1;
|
|
1039
|
+
const totalPrice = pricePerYear * years;
|
|
1040
|
+
const coinType = isTestnet ? "SUI" : "USDC";
|
|
1041
|
+
const coinConfig = suinsClient.config.coins[coinType];
|
|
1042
|
+
const [usdcCoins, walCoins] = await Promise.all([isMainnet ? suiClient.getCoins({
|
|
1043
|
+
owner: currentAccount.address,
|
|
1044
|
+
coinType: suinsClient.config.coins.USDC.type
|
|
1045
|
+
}) : Promise.resolve({ data: [] }), isMainnet && WAL_COIN_TYPE ? suiClient.getCoins({
|
|
1046
|
+
owner: currentAccount.address,
|
|
1047
|
+
coinType: WAL_COIN_TYPE
|
|
1048
|
+
}) : Promise.resolve({ data: [] })]);
|
|
1049
|
+
const usdcBalance = usdcCoins.data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
|
|
1050
|
+
const walBalance = walCoins.data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n;
|
|
1051
|
+
const requiredAmount = BigInt(Math.floor(totalPrice * 1.05));
|
|
1052
|
+
if (isMainnet && coinType === "USDC") {
|
|
1053
|
+
if (usdcBalance < requiredAmount) {
|
|
1054
|
+
if (!aggregatorClient || !WAL_COIN_TYPE) throw new Error("Swap client not ready. Please try again in a few seconds.");
|
|
1055
|
+
if (walBalance === 0n) throw new Error(`Insufficient USDC balance. Need approximately ${(Number(requiredAmount) / 1e6).toFixed(2)} USDC, but have ${(Number(usdcBalance) / 1e6).toFixed(2)} USDC. No WAL available to swap.`);
|
|
1056
|
+
const missingUsdc = requiredAmount - usdcBalance;
|
|
1057
|
+
const baseWalAtomic = 1000000000n;
|
|
1058
|
+
const rateRouter = await aggregatorClient.findRouters({
|
|
1059
|
+
from: WAL_COIN_TYPE,
|
|
1060
|
+
target: suinsClient.config.coins.USDC.type,
|
|
1061
|
+
amount: new BN(baseWalAtomic.toString()),
|
|
1062
|
+
byAmountIn: true,
|
|
1063
|
+
providers: ["CETUS"]
|
|
1064
|
+
});
|
|
1065
|
+
if (!rateRouter || rateRouter.error || !rateRouter.amountOut) {
|
|
1066
|
+
const msg = rateRouter?.error?.msg || "Failed to fetch WAL → USDC rate from aggregator.";
|
|
1067
|
+
throw new Error(msg);
|
|
1068
|
+
}
|
|
1069
|
+
const rawAmountOut = rateRouter.amountOut;
|
|
1070
|
+
if (!rawAmountOut) throw new Error("Failed to get amount out from rate router");
|
|
1071
|
+
const usdcOutForOneWal = BigInt(rawAmountOut instanceof BN ? rawAmountOut.toString() : new BN(String(rawAmountOut)).toString());
|
|
1072
|
+
if (usdcOutForOneWal === 0n) throw new Error("Aggregator returned zero USDC for 1 WAL.");
|
|
1073
|
+
const exchangeRate = Number(baseWalAtomic) / Number(usdcOutForOneWal);
|
|
1074
|
+
const estimatedWalNeeded = missingUsdc * BigInt(Math.ceil(exchangeRate));
|
|
1075
|
+
if (walBalance < estimatedWalNeeded) throw new Error(`Insufficient WAL balance. Need approximately ${(Number(estimatedWalNeeded) / 1e9).toFixed(4)} WAL to swap for USDC.`);
|
|
1076
|
+
setIsSwapping(true);
|
|
1077
|
+
try {
|
|
1078
|
+
const amountWalBN = new BN(estimatedWalNeeded.toString());
|
|
1079
|
+
const routerResult = await aggregatorClient.findRouters({
|
|
1080
|
+
from: WAL_COIN_TYPE,
|
|
1081
|
+
target: suinsClient.config.coins.USDC.type,
|
|
1082
|
+
amount: amountWalBN,
|
|
1083
|
+
byAmountIn: true,
|
|
1084
|
+
providers: ["CETUS"]
|
|
1085
|
+
});
|
|
1086
|
+
if (!routerResult || routerResult.error) {
|
|
1087
|
+
const msg = routerResult?.error?.msg || "Failed to find route to swap WAL to USDC for registration.";
|
|
1088
|
+
throw new Error(msg);
|
|
1089
|
+
}
|
|
1090
|
+
if (routerResult.insufficientLiquidity) throw new Error("Insufficient liquidity to swap WAL to USDC for this registration amount.");
|
|
1091
|
+
const swapTx = new Transaction();
|
|
1092
|
+
swapTx.setSenderIfNotSet(currentAccount.address);
|
|
1093
|
+
await aggregatorClient.fastRouterSwap({
|
|
1094
|
+
router: routerResult,
|
|
1095
|
+
txb: swapTx,
|
|
1096
|
+
slippage: .005
|
|
1097
|
+
});
|
|
1098
|
+
swapTx.setGasBudget(5e7);
|
|
1099
|
+
const swapDigest = await txExecutor.execute({
|
|
1100
|
+
transaction: swapTx,
|
|
1101
|
+
description: "Swap WAL to USDC for SuiNS registration"
|
|
1102
|
+
});
|
|
1103
|
+
await suiClient.waitForTransaction({ digest: swapDigest });
|
|
1104
|
+
if (((await suiClient.getCoins({
|
|
1105
|
+
owner: currentAccount.address,
|
|
1106
|
+
coinType: suinsClient.config.coins.USDC.type
|
|
1107
|
+
})).data?.reduce((sum, coin) => sum + BigInt(coin.balance), 0n) ?? 0n) < requiredAmount) throw new Error("Swap completed but still insufficient USDC balance. Please try again.");
|
|
1108
|
+
} finally {
|
|
1109
|
+
setIsSwapping(false);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
const coins = await suiClient.getCoins({
|
|
1114
|
+
owner: currentAccount.address,
|
|
1115
|
+
coinType: coinConfig.type
|
|
1116
|
+
});
|
|
1117
|
+
if (coins.data.length === 0) throw new Error(`No ${coinType} coins found in your wallet`);
|
|
1118
|
+
const maxPaymentAmount = Math.floor(totalPrice * 1.05);
|
|
1119
|
+
const totalBalance = coins.data.reduce((sum, coin) => sum + BigInt(coin.balance), 0n);
|
|
1120
|
+
const requiredBalance = BigInt(maxPaymentAmount) + 10000000n;
|
|
1121
|
+
if (totalBalance < requiredBalance) throw new Error(`Insufficient balance. Need approximately ${(Number(requiredBalance) / 1e9).toFixed(4)} ${coinType}`);
|
|
1122
|
+
const transaction = new Transaction();
|
|
1123
|
+
transaction.setSenderIfNotSet(currentAccount.address);
|
|
1124
|
+
const suinsTransaction = new SuinsTransaction(suinsClient, transaction);
|
|
1125
|
+
let paymentCoin;
|
|
1126
|
+
if (coinType === "SUI") paymentCoin = transaction.gas;
|
|
1127
|
+
else {
|
|
1128
|
+
const suiCoins = await suiClient.getCoins({
|
|
1129
|
+
owner: currentAccount.address,
|
|
1130
|
+
coinType: "0x2::sui::SUI"
|
|
1131
|
+
});
|
|
1132
|
+
if (suiCoins.data.length === 0) throw new Error("No SUI coins found for gas fees");
|
|
1133
|
+
const primaryCoin = coins.data[0].coinObjectId;
|
|
1134
|
+
if (coins.data.length > 1) transaction.mergeCoins(transaction.object(primaryCoin), coins.data.slice(1).map((coin) => transaction.object(coin.coinObjectId)));
|
|
1135
|
+
paymentCoin = transaction.object(primaryCoin);
|
|
1136
|
+
if (suiCoins.data.length > 1) transaction.mergeCoins(transaction.object(suiCoins.data[0].coinObjectId), suiCoins.data.slice(1).map((coin) => transaction.object(coin.coinObjectId)));
|
|
1137
|
+
}
|
|
1138
|
+
const registerParams = {
|
|
1139
|
+
domain: fullName,
|
|
1140
|
+
years,
|
|
1141
|
+
coinConfig,
|
|
1142
|
+
coin: paymentCoin
|
|
1143
|
+
};
|
|
1144
|
+
if (coinConfig.feed) registerParams.priceInfoObjectId = (await suinsClient.getPriceInfoObject(transaction, coinConfig.feed))[0];
|
|
1145
|
+
const nft = suinsTransaction.register(registerParams);
|
|
1146
|
+
suinsTransaction.setTargetAddress({
|
|
1147
|
+
nft,
|
|
1148
|
+
address: currentAccount.address
|
|
1149
|
+
});
|
|
1150
|
+
transaction.transferObjects([nft], currentAccount.address);
|
|
1151
|
+
transaction.setGasBudget(5e7);
|
|
1152
|
+
if (!txExecutor) throw new Error("Transaction executor not available");
|
|
1153
|
+
const digest = await txExecutor.execute({
|
|
1154
|
+
transaction,
|
|
1155
|
+
description: "Register SuiNS domain"
|
|
1156
|
+
});
|
|
1157
|
+
await suiClient.waitForTransaction({ digest });
|
|
1158
|
+
if (currentAccount?.address) queryClient.invalidateQueries({ queryKey: [
|
|
1159
|
+
"suins-domains",
|
|
1160
|
+
currentAccount.address,
|
|
1161
|
+
network
|
|
1162
|
+
] });
|
|
1163
|
+
return true;
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
console.error("Error registering domain:", err);
|
|
1166
|
+
setError(err instanceof Error ? err.message : "Failed to register domain");
|
|
1167
|
+
return false;
|
|
1168
|
+
} finally {
|
|
1169
|
+
setIsRegistering(false);
|
|
1170
|
+
}
|
|
1171
|
+
}, [
|
|
1172
|
+
suinsClient,
|
|
1173
|
+
currentAccount,
|
|
1174
|
+
isAvailable,
|
|
1175
|
+
normalizedName,
|
|
1176
|
+
fullName,
|
|
1177
|
+
txExecutor,
|
|
1178
|
+
isTestnet,
|
|
1179
|
+
isMainnet,
|
|
1180
|
+
WAL_COIN_TYPE,
|
|
1181
|
+
aggregatorClient,
|
|
1182
|
+
suiClient,
|
|
1183
|
+
queryClient,
|
|
1184
|
+
network
|
|
1185
|
+
]),
|
|
1186
|
+
reset: useCallback(() => {
|
|
1187
|
+
setSearchName("");
|
|
1188
|
+
setIsAvailable(null);
|
|
1189
|
+
setEstimatedPrice(null);
|
|
1190
|
+
setError(null);
|
|
1191
|
+
setIsSearching(false);
|
|
1192
|
+
setIsRegistering(false);
|
|
1193
|
+
setIsSwapping(false);
|
|
1194
|
+
}, [])
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region src/hooks/useZenFsWorkspace.ts
|
|
1200
|
+
function useZenFsWorkspace(workspaceDir = "/workspace", mountDir = "/workspace", queryClient) {
|
|
1201
|
+
const [loading, setLoading] = useState(true);
|
|
1202
|
+
const [fileManager, setFileManager] = useState(null);
|
|
1203
|
+
useEffect(() => {
|
|
1204
|
+
setLoading(true);
|
|
1205
|
+
console.log("Initializing ZenFS FileManager at", workspaceDir);
|
|
1206
|
+
const fm = new ZenFsFileManager(workspaceDir, mountDir);
|
|
1207
|
+
setFileManager(fm);
|
|
1208
|
+
fm.initialize().catch(() => {}).then(async () => {
|
|
1209
|
+
await queryClient.invalidateQueries({ queryKey: ["zenfs", workspaceDir] });
|
|
1210
|
+
}).finally(() => setLoading(false));
|
|
1211
|
+
}, [
|
|
1212
|
+
workspaceDir,
|
|
1213
|
+
mountDir,
|
|
1214
|
+
queryClient
|
|
1215
|
+
]);
|
|
1216
|
+
return {
|
|
1217
|
+
loading,
|
|
1218
|
+
fileManager
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
//#endregion
|
|
1223
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.18.0/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-166334d7.cjs.prod.js
|
|
1224
|
+
var require_createRuntimeFn_166334d7_cjs_prod = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1225
|
+
function toPrimitive(t, r) {
|
|
1226
|
+
if ("object" != typeof t || !t) return t;
|
|
1227
|
+
var e = t[Symbol.toPrimitive];
|
|
1228
|
+
if (void 0 !== e) {
|
|
1229
|
+
var i = e.call(t, r || "default");
|
|
1230
|
+
if ("object" != typeof i) return i;
|
|
1231
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1232
|
+
}
|
|
1233
|
+
return ("string" === r ? String : Number)(t);
|
|
1234
|
+
}
|
|
1235
|
+
function toPropertyKey(t) {
|
|
1236
|
+
var i = toPrimitive(t, "string");
|
|
1237
|
+
return "symbol" == typeof i ? i : String(i);
|
|
1238
|
+
}
|
|
1239
|
+
function _defineProperty(obj, key, value) {
|
|
1240
|
+
key = toPropertyKey(key);
|
|
1241
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
1242
|
+
value,
|
|
1243
|
+
enumerable: true,
|
|
1244
|
+
configurable: true,
|
|
1245
|
+
writable: true
|
|
1246
|
+
});
|
|
1247
|
+
else obj[key] = value;
|
|
1248
|
+
return obj;
|
|
1249
|
+
}
|
|
1250
|
+
function ownKeys(e, r) {
|
|
1251
|
+
var t = Object.keys(e);
|
|
1252
|
+
if (Object.getOwnPropertySymbols) {
|
|
1253
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1254
|
+
r && (o = o.filter(function(r$1) {
|
|
1255
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
1256
|
+
})), t.push.apply(t, o);
|
|
1257
|
+
}
|
|
1258
|
+
return t;
|
|
1259
|
+
}
|
|
1260
|
+
function _objectSpread2(e) {
|
|
1261
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1262
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1263
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
1264
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
1265
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
1266
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
return e;
|
|
1270
|
+
}
|
|
1271
|
+
function mapValues(input$1, fn) {
|
|
1272
|
+
var result = {};
|
|
1273
|
+
for (var _key in input$1) result[_key] = fn(input$1[_key], _key);
|
|
1274
|
+
return result;
|
|
1275
|
+
}
|
|
1276
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
1277
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
1278
|
+
var _selections$key;
|
|
1279
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) return false;
|
|
1280
|
+
}
|
|
1281
|
+
return true;
|
|
1282
|
+
};
|
|
1283
|
+
var createRuntimeFn = (config) => {
|
|
1284
|
+
var runtimeFn = (options) => {
|
|
1285
|
+
var className = config.defaultClassName;
|
|
1286
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
1287
|
+
for (var variantName in selections) {
|
|
1288
|
+
var _selections$variantNa;
|
|
1289
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
1290
|
+
if (variantSelection != null) {
|
|
1291
|
+
var selection = variantSelection;
|
|
1292
|
+
if (typeof selection === "boolean") selection = selection === true ? "true" : "false";
|
|
1293
|
+
var selectionClassName = config.variantClassNames[variantName][selection];
|
|
1294
|
+
if (selectionClassName) className += " " + selectionClassName;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) className += " " + compoundClassName;
|
|
1298
|
+
return className;
|
|
1299
|
+
};
|
|
1300
|
+
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
1301
|
+
runtimeFn.classNames = {
|
|
1302
|
+
get base() {
|
|
1303
|
+
return config.defaultClassName.split(" ")[0];
|
|
1304
|
+
},
|
|
1305
|
+
get variants() {
|
|
1306
|
+
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
return runtimeFn;
|
|
1310
|
+
};
|
|
1311
|
+
exports.createRuntimeFn = createRuntimeFn;
|
|
1312
|
+
exports.mapValues = mapValues;
|
|
1313
|
+
}));
|
|
1314
|
+
|
|
1315
|
+
//#endregion
|
|
1316
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.18.0/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.prod.js
|
|
1317
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs_prod = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1318
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1319
|
+
var createRuntimeFn_dist_vanillaExtractRecipesCreateRuntimeFn = require_createRuntimeFn_166334d7_cjs_prod();
|
|
1320
|
+
exports.createRuntimeFn = createRuntimeFn_dist_vanillaExtractRecipesCreateRuntimeFn.createRuntimeFn;
|
|
1321
|
+
}));
|
|
1322
|
+
|
|
1323
|
+
//#endregion
|
|
1324
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.18.0/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-2f250aaf.cjs.dev.js
|
|
1325
|
+
var require_createRuntimeFn_2f250aaf_cjs_dev = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1326
|
+
function toPrimitive(t, r) {
|
|
1327
|
+
if ("object" != typeof t || !t) return t;
|
|
1328
|
+
var e = t[Symbol.toPrimitive];
|
|
1329
|
+
if (void 0 !== e) {
|
|
1330
|
+
var i = e.call(t, r || "default");
|
|
1331
|
+
if ("object" != typeof i) return i;
|
|
1332
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1333
|
+
}
|
|
1334
|
+
return ("string" === r ? String : Number)(t);
|
|
1335
|
+
}
|
|
1336
|
+
function toPropertyKey(t) {
|
|
1337
|
+
var i = toPrimitive(t, "string");
|
|
1338
|
+
return "symbol" == typeof i ? i : String(i);
|
|
1339
|
+
}
|
|
1340
|
+
function _defineProperty(obj, key, value) {
|
|
1341
|
+
key = toPropertyKey(key);
|
|
1342
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
1343
|
+
value,
|
|
1344
|
+
enumerable: true,
|
|
1345
|
+
configurable: true,
|
|
1346
|
+
writable: true
|
|
1347
|
+
});
|
|
1348
|
+
else obj[key] = value;
|
|
1349
|
+
return obj;
|
|
1350
|
+
}
|
|
1351
|
+
function ownKeys(e, r) {
|
|
1352
|
+
var t = Object.keys(e);
|
|
1353
|
+
if (Object.getOwnPropertySymbols) {
|
|
1354
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1355
|
+
r && (o = o.filter(function(r$1) {
|
|
1356
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
1357
|
+
})), t.push.apply(t, o);
|
|
1358
|
+
}
|
|
1359
|
+
return t;
|
|
1360
|
+
}
|
|
1361
|
+
function _objectSpread2(e) {
|
|
1362
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1363
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1364
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
|
|
1365
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
1366
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
1367
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
return e;
|
|
1371
|
+
}
|
|
1372
|
+
function mapValues(input$1, fn) {
|
|
1373
|
+
var result = {};
|
|
1374
|
+
for (var _key in input$1) result[_key] = fn(input$1[_key], _key);
|
|
1375
|
+
return result;
|
|
1376
|
+
}
|
|
1377
|
+
var shouldApplyCompound = (compoundCheck, selections, defaultVariants) => {
|
|
1378
|
+
for (var key of Object.keys(compoundCheck)) {
|
|
1379
|
+
var _selections$key;
|
|
1380
|
+
if (compoundCheck[key] !== ((_selections$key = selections[key]) !== null && _selections$key !== void 0 ? _selections$key : defaultVariants[key])) return false;
|
|
1381
|
+
}
|
|
1382
|
+
return true;
|
|
1383
|
+
};
|
|
1384
|
+
var createRuntimeFn = (config) => {
|
|
1385
|
+
var runtimeFn = (options) => {
|
|
1386
|
+
var className = config.defaultClassName;
|
|
1387
|
+
var selections = _objectSpread2(_objectSpread2({}, config.defaultVariants), options);
|
|
1388
|
+
for (var variantName in selections) {
|
|
1389
|
+
var _selections$variantNa;
|
|
1390
|
+
var variantSelection = (_selections$variantNa = selections[variantName]) !== null && _selections$variantNa !== void 0 ? _selections$variantNa : config.defaultVariants[variantName];
|
|
1391
|
+
if (variantSelection != null) {
|
|
1392
|
+
var selection = variantSelection;
|
|
1393
|
+
if (typeof selection === "boolean") selection = selection === true ? "true" : "false";
|
|
1394
|
+
var selectionClassName = config.variantClassNames[variantName][selection];
|
|
1395
|
+
if (selectionClassName) className += " " + selectionClassName;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
for (var [compoundCheck, compoundClassName] of config.compoundVariants) if (shouldApplyCompound(compoundCheck, selections, config.defaultVariants)) className += " " + compoundClassName;
|
|
1399
|
+
return className;
|
|
1400
|
+
};
|
|
1401
|
+
runtimeFn.variants = () => Object.keys(config.variantClassNames);
|
|
1402
|
+
runtimeFn.classNames = {
|
|
1403
|
+
get base() {
|
|
1404
|
+
return config.defaultClassName.split(" ")[0];
|
|
1405
|
+
},
|
|
1406
|
+
get variants() {
|
|
1407
|
+
return mapValues(config.variantClassNames, (classNames) => mapValues(classNames, (className) => className.split(" ")[0]));
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
return runtimeFn;
|
|
1411
|
+
};
|
|
1412
|
+
exports.createRuntimeFn = createRuntimeFn;
|
|
1413
|
+
exports.mapValues = mapValues;
|
|
1414
|
+
}));
|
|
1415
|
+
|
|
1416
|
+
//#endregion
|
|
1417
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.18.0/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.dev.js
|
|
1418
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs_dev = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1419
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1420
|
+
var createRuntimeFn_dist_vanillaExtractRecipesCreateRuntimeFn = require_createRuntimeFn_2f250aaf_cjs_dev();
|
|
1421
|
+
exports.createRuntimeFn = createRuntimeFn_dist_vanillaExtractRecipesCreateRuntimeFn.createRuntimeFn;
|
|
1422
|
+
}));
|
|
1423
|
+
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region ../../node_modules/.pnpm/@vanilla-extract+recipes@0.5.7_@vanilla-extract+css@1.18.0/node_modules/@vanilla-extract/recipes/createRuntimeFn/dist/vanilla-extract-recipes-createRuntimeFn.cjs.js
|
|
1426
|
+
var require_vanilla_extract_recipes_createRuntimeFn_cjs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1427
|
+
if (process.env.NODE_ENV === "production") module.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_prod();
|
|
1428
|
+
else module.exports = require_vanilla_extract_recipes_createRuntimeFn_cjs_dev();
|
|
1429
|
+
}));
|
|
1430
|
+
|
|
1431
|
+
//#endregion
|
|
1432
|
+
//#region src/components/ui/Banner.css.ts
|
|
1433
|
+
var import_vanilla_extract_recipes_createRuntimeFn_cjs = require_vanilla_extract_recipes_createRuntimeFn_cjs();
|
|
1434
|
+
var banner = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1435
|
+
defaultClassName: "Banner_banner__z4crwg0",
|
|
1436
|
+
variantClassNames: { variant: {
|
|
1437
|
+
info: "Banner_banner_variant_info__z4crwg1",
|
|
1438
|
+
success: "Banner_banner_variant_success__z4crwg2",
|
|
1439
|
+
warning: "Banner_banner_variant_warning__z4crwg3",
|
|
1440
|
+
alert: "Banner_banner_variant_alert__z4crwg4",
|
|
1441
|
+
error: "Banner_banner_variant_error__z4crwg5"
|
|
1442
|
+
} },
|
|
1443
|
+
defaultVariants: { variant: "info" },
|
|
1444
|
+
compoundVariants: []
|
|
1445
|
+
});
|
|
1446
|
+
var closeButton$1 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1447
|
+
defaultClassName: "Banner_closeButton__z4crwgx",
|
|
1448
|
+
variantClassNames: { variant: {
|
|
1449
|
+
info: "Banner_closeButton_variant_info__z4crwgy",
|
|
1450
|
+
success: "Banner_closeButton_variant_success__z4crwgz",
|
|
1451
|
+
warning: "Banner_closeButton_variant_warning__z4crwg10",
|
|
1452
|
+
alert: "Banner_closeButton_variant_alert__z4crwg11",
|
|
1453
|
+
error: "Banner_closeButton_variant_error__z4crwg12"
|
|
1454
|
+
} },
|
|
1455
|
+
defaultVariants: {},
|
|
1456
|
+
compoundVariants: []
|
|
1457
|
+
});
|
|
1458
|
+
var closeIcon = "Banner_closeIcon__z4crwg13";
|
|
1459
|
+
var content$4 = "Banner_content__z4crwg7";
|
|
1460
|
+
var description$4 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1461
|
+
defaultClassName: "Banner_description__z4crwgr",
|
|
1462
|
+
variantClassNames: { variant: {
|
|
1463
|
+
info: "Banner_description_variant_info__z4crwgs",
|
|
1464
|
+
success: "Banner_description_variant_success__z4crwgt",
|
|
1465
|
+
warning: "Banner_description_variant_warning__z4crwgu",
|
|
1466
|
+
alert: "Banner_description_variant_alert__z4crwgv",
|
|
1467
|
+
error: "Banner_description_variant_error__z4crwgw"
|
|
1468
|
+
} },
|
|
1469
|
+
defaultVariants: {},
|
|
1470
|
+
compoundVariants: []
|
|
1471
|
+
});
|
|
1472
|
+
var gridPattern = "Banner_gridPattern__z4crwg6";
|
|
1473
|
+
var icon = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1474
|
+
defaultClassName: "Banner_icon__z4crwge",
|
|
1475
|
+
variantClassNames: { variant: {
|
|
1476
|
+
info: "Banner_icon_variant_info__z4crwgf",
|
|
1477
|
+
success: "Banner_icon_variant_success__z4crwgg",
|
|
1478
|
+
warning: "Banner_icon_variant_warning__z4crwgh",
|
|
1479
|
+
alert: "Banner_icon_variant_alert__z4crwgi",
|
|
1480
|
+
error: "Banner_icon_variant_error__z4crwgj"
|
|
1481
|
+
} },
|
|
1482
|
+
defaultVariants: {},
|
|
1483
|
+
compoundVariants: []
|
|
1484
|
+
});
|
|
1485
|
+
var iconContainer = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1486
|
+
defaultClassName: "Banner_iconContainer__z4crwg8",
|
|
1487
|
+
variantClassNames: { variant: {
|
|
1488
|
+
info: "Banner_iconContainer_variant_info__z4crwg9",
|
|
1489
|
+
success: "Banner_iconContainer_variant_success__z4crwga",
|
|
1490
|
+
warning: "Banner_iconContainer_variant_warning__z4crwgb",
|
|
1491
|
+
alert: "Banner_iconContainer_variant_alert__z4crwgc",
|
|
1492
|
+
error: "Banner_iconContainer_variant_error__z4crwgd"
|
|
1493
|
+
} },
|
|
1494
|
+
defaultVariants: {},
|
|
1495
|
+
compoundVariants: []
|
|
1496
|
+
});
|
|
1497
|
+
var link$2 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1498
|
+
defaultClassName: "Banner_link__z4crwg14",
|
|
1499
|
+
variantClassNames: { variant: {
|
|
1500
|
+
info: "Banner_link_variant_info__z4crwg15",
|
|
1501
|
+
success: "Banner_link_variant_success__z4crwg16",
|
|
1502
|
+
warning: "Banner_link_variant_warning__z4crwg17",
|
|
1503
|
+
alert: "Banner_link_variant_alert__z4crwg18",
|
|
1504
|
+
error: "Banner_link_variant_error__z4crwg19"
|
|
1505
|
+
} },
|
|
1506
|
+
defaultVariants: {},
|
|
1507
|
+
compoundVariants: []
|
|
1508
|
+
});
|
|
1509
|
+
var textContainer = "Banner_textContainer__z4crwgk";
|
|
1510
|
+
var title$4 = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1511
|
+
defaultClassName: "Banner_title__z4crwgl",
|
|
1512
|
+
variantClassNames: { variant: {
|
|
1513
|
+
info: "Banner_title_variant_info__z4crwgm",
|
|
1514
|
+
success: "Banner_title_variant_success__z4crwgn",
|
|
1515
|
+
warning: "Banner_title_variant_warning__z4crwgo",
|
|
1516
|
+
alert: "Banner_title_variant_alert__z4crwgp",
|
|
1517
|
+
error: "Banner_title_variant_error__z4crwgq"
|
|
1518
|
+
} },
|
|
1519
|
+
defaultVariants: {},
|
|
1520
|
+
compoundVariants: []
|
|
1521
|
+
});
|
|
1522
|
+
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region src/components/ui/Banner.tsx
|
|
1525
|
+
const defaultIcons = {
|
|
1526
|
+
info: /* @__PURE__ */ jsx(Link2, {
|
|
1527
|
+
style: {
|
|
1528
|
+
width: "1rem",
|
|
1529
|
+
height: "1rem"
|
|
1530
|
+
},
|
|
1531
|
+
strokeWidth: 1.5
|
|
1532
|
+
}),
|
|
1533
|
+
success: /* @__PURE__ */ jsx(CheckCircle, {
|
|
1534
|
+
style: {
|
|
1535
|
+
width: "1rem",
|
|
1536
|
+
height: "1rem"
|
|
1537
|
+
},
|
|
1538
|
+
strokeWidth: 1.5
|
|
1539
|
+
}),
|
|
1540
|
+
warning: /* @__PURE__ */ jsx(AlertTriangle, {
|
|
1541
|
+
style: {
|
|
1542
|
+
width: "1rem",
|
|
1543
|
+
height: "1rem"
|
|
1544
|
+
},
|
|
1545
|
+
strokeWidth: 1.5
|
|
1546
|
+
}),
|
|
1547
|
+
alert: /* @__PURE__ */ jsx(AlertCircle, {
|
|
1548
|
+
style: {
|
|
1549
|
+
width: "1rem",
|
|
1550
|
+
height: "1rem"
|
|
1551
|
+
},
|
|
1552
|
+
strokeWidth: 1.5
|
|
1553
|
+
}),
|
|
1554
|
+
error: /* @__PURE__ */ jsx(XCircle, {
|
|
1555
|
+
style: {
|
|
1556
|
+
width: "1rem",
|
|
1557
|
+
height: "1rem"
|
|
1558
|
+
},
|
|
1559
|
+
strokeWidth: 1.5
|
|
1560
|
+
})
|
|
1561
|
+
};
|
|
1562
|
+
const Banner = ({ title: titleText, description: descriptionText, icon: customIcon, showIcon = true, className = "", variant = "info", onClose, url, urlName }) => {
|
|
1563
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1564
|
+
className: `${banner({ variant })} ${className}`,
|
|
1565
|
+
children: [
|
|
1566
|
+
/* @__PURE__ */ jsxs("svg", {
|
|
1567
|
+
className: gridPattern,
|
|
1568
|
+
width: "100%",
|
|
1569
|
+
height: "100%",
|
|
1570
|
+
"aria-hidden": "true",
|
|
1571
|
+
children: [/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
|
|
1572
|
+
id: `grid-pattern-${variant}`,
|
|
1573
|
+
x: "-1",
|
|
1574
|
+
y: "-2",
|
|
1575
|
+
width: "13",
|
|
1576
|
+
height: "13",
|
|
1577
|
+
patternUnits: "userSpaceOnUse",
|
|
1578
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1579
|
+
d: "M 13 0 L 0 0 0 13",
|
|
1580
|
+
fill: "transparent",
|
|
1581
|
+
stroke: "currentColor",
|
|
1582
|
+
strokeWidth: "1",
|
|
1583
|
+
children: /* @__PURE__ */ jsx("title", { children: "Grid pattern" })
|
|
1584
|
+
})
|
|
1585
|
+
}) }), /* @__PURE__ */ jsx("rect", {
|
|
1586
|
+
fill: `url(#grid-pattern-${variant})`,
|
|
1587
|
+
width: "100%",
|
|
1588
|
+
height: "100%"
|
|
1589
|
+
})]
|
|
1590
|
+
}),
|
|
1591
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1592
|
+
className: content$4,
|
|
1593
|
+
children: [showIcon && /* @__PURE__ */ jsx("div", {
|
|
1594
|
+
className: iconContainer({ variant }),
|
|
1595
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1596
|
+
className: icon({ variant }),
|
|
1597
|
+
children: customIcon || defaultIcons[variant]
|
|
1598
|
+
})
|
|
1599
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1600
|
+
className: textContainer,
|
|
1601
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1602
|
+
className: title$4({ variant }),
|
|
1603
|
+
children: titleText
|
|
1604
|
+
}), descriptionText && /* @__PURE__ */ jsxs("p", {
|
|
1605
|
+
className: description$4({ variant }),
|
|
1606
|
+
children: [descriptionText, url && urlName && /* @__PURE__ */ jsxs(Fragment, { children: [" ", /* @__PURE__ */ jsx("a", {
|
|
1607
|
+
href: url,
|
|
1608
|
+
target: "_blank",
|
|
1609
|
+
rel: "noopener noreferrer",
|
|
1610
|
+
className: link$2({ variant }),
|
|
1611
|
+
children: urlName
|
|
1612
|
+
})] })]
|
|
1613
|
+
})]
|
|
1614
|
+
})]
|
|
1615
|
+
}),
|
|
1616
|
+
onClose && /* @__PURE__ */ jsx("button", {
|
|
1617
|
+
type: "button",
|
|
1618
|
+
onClick: onClose,
|
|
1619
|
+
className: closeButton$1({ variant }),
|
|
1620
|
+
"aria-label": "Close banner",
|
|
1621
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
1622
|
+
className: closeIcon,
|
|
1623
|
+
fill: "none",
|
|
1624
|
+
stroke: "currentColor",
|
|
1625
|
+
viewBox: "0 0 24 24",
|
|
1626
|
+
"aria-hidden": "true",
|
|
1627
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1628
|
+
strokeLinecap: "round",
|
|
1629
|
+
strokeLinejoin: "round",
|
|
1630
|
+
strokeWidth: 2,
|
|
1631
|
+
d: "M6 18L18 6M6 6l12 12",
|
|
1632
|
+
children: /* @__PURE__ */ jsx("title", { children: "Close icon" })
|
|
1633
|
+
})
|
|
1634
|
+
})
|
|
1635
|
+
})
|
|
1636
|
+
]
|
|
1637
|
+
});
|
|
1638
|
+
};
|
|
1639
|
+
|
|
1640
|
+
//#endregion
|
|
1641
|
+
//#region src/components/ui/Button.css.ts
|
|
1642
|
+
var button = (0, import_vanilla_extract_recipes_createRuntimeFn_cjs.createRuntimeFn)({
|
|
1643
|
+
defaultClassName: "Button_button__1267jvj0",
|
|
1644
|
+
variantClassNames: {
|
|
1645
|
+
variant: {
|
|
1646
|
+
"default": "Button_button_variant_default__1267jvj1",
|
|
1647
|
+
outline: "Button_button_variant_outline__1267jvj2",
|
|
1648
|
+
ghost: "Button_button_variant_ghost__1267jvj3",
|
|
1649
|
+
destructive: "Button_button_variant_destructive__1267jvj4",
|
|
1650
|
+
gradient: "Button_button_variant_gradient__1267jvj5"
|
|
1651
|
+
},
|
|
1652
|
+
size: {
|
|
1653
|
+
"default": "Button_button_size_default__1267jvj6",
|
|
1654
|
+
sm: "Button_button_size_sm__1267jvj7",
|
|
1655
|
+
lg: "Button_button_size_lg__1267jvj8",
|
|
1656
|
+
icon: "Button_button_size_icon__1267jvj9"
|
|
1657
|
+
}
|
|
1658
|
+
},
|
|
1659
|
+
defaultVariants: {
|
|
1660
|
+
variant: "default",
|
|
1661
|
+
size: "default"
|
|
1662
|
+
},
|
|
1663
|
+
compoundVariants: []
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
//#endregion
|
|
1667
|
+
//#region src/components/ui/Button.tsx
|
|
1668
|
+
const Button = ({ variant = "default", size = "default", className = "", children, ...props }) => {
|
|
1669
|
+
return /* @__PURE__ */ jsx("button", {
|
|
1670
|
+
className: `${button({
|
|
1671
|
+
variant,
|
|
1672
|
+
size
|
|
1673
|
+
})} ${className}`,
|
|
1674
|
+
...props,
|
|
1675
|
+
children
|
|
1676
|
+
});
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
//#endregion
|
|
1680
|
+
//#region src/components/ui/FlickeringGrid.css.ts
|
|
1681
|
+
var canvas = "FlickeringGrid_canvas__1e33elw1";
|
|
1682
|
+
var container = "FlickeringGrid_container__1e33elw0";
|
|
1683
|
+
|
|
1684
|
+
//#endregion
|
|
1685
|
+
//#region src/components/ui/FlickeringGrid.tsx
|
|
1686
|
+
const FlickeringGrid = ({ squareSize = 4, gridGap = 6, flickerChance = .3, color = "rgb(0, 0, 0)", width, height, className = "", maxOpacity = .3, ...props }) => {
|
|
1687
|
+
const canvasRef = useRef(null);
|
|
1688
|
+
const containerRef = useRef(null);
|
|
1689
|
+
const [isInView, setIsInView] = useState(false);
|
|
1690
|
+
const [canvasSize, setCanvasSize] = useState({
|
|
1691
|
+
width: 0,
|
|
1692
|
+
height: 0
|
|
1693
|
+
});
|
|
1694
|
+
const memoizedColor = useMemo(() => {
|
|
1695
|
+
const toRGBA = (color$1) => {
|
|
1696
|
+
if (typeof window === "undefined") return "rgba(0, 0, 0,";
|
|
1697
|
+
const canvasEl = document.createElement("canvas");
|
|
1698
|
+
canvasEl.width = canvasEl.height = 1;
|
|
1699
|
+
const ctx = canvasEl.getContext("2d");
|
|
1700
|
+
if (!ctx) return "rgba(255, 0, 0,";
|
|
1701
|
+
ctx.fillStyle = color$1;
|
|
1702
|
+
ctx.fillRect(0, 0, 1, 1);
|
|
1703
|
+
const [r, g, b] = Array.from(ctx.getImageData(0, 0, 1, 1).data);
|
|
1704
|
+
return `rgba(${r}, ${g}, ${b},`;
|
|
1705
|
+
};
|
|
1706
|
+
return toRGBA(color);
|
|
1707
|
+
}, [color]);
|
|
1708
|
+
const setupCanvas = useCallback((canvasEl, width$1, height$1) => {
|
|
1709
|
+
const dpr = window.devicePixelRatio || 1;
|
|
1710
|
+
canvasEl.width = width$1 * dpr;
|
|
1711
|
+
canvasEl.height = height$1 * dpr;
|
|
1712
|
+
canvasEl.style.width = `${width$1}px`;
|
|
1713
|
+
canvasEl.style.height = `${height$1}px`;
|
|
1714
|
+
const cols = Math.floor(width$1 / (squareSize + gridGap));
|
|
1715
|
+
const rows = Math.floor(height$1 / (squareSize + gridGap));
|
|
1716
|
+
const squares = new Float32Array(cols * rows);
|
|
1717
|
+
for (let i = 0; i < squares.length; i++) squares[i] = Math.random() * maxOpacity;
|
|
1718
|
+
return {
|
|
1719
|
+
cols,
|
|
1720
|
+
rows,
|
|
1721
|
+
squares,
|
|
1722
|
+
dpr
|
|
1723
|
+
};
|
|
1724
|
+
}, [
|
|
1725
|
+
squareSize,
|
|
1726
|
+
gridGap,
|
|
1727
|
+
maxOpacity
|
|
1728
|
+
]);
|
|
1729
|
+
const updateSquares = useCallback((squares, deltaTime) => {
|
|
1730
|
+
for (let i = 0; i < squares.length; i++) if (Math.random() < flickerChance * deltaTime) squares[i] = Math.random() * maxOpacity;
|
|
1731
|
+
}, [flickerChance, maxOpacity]);
|
|
1732
|
+
const drawGrid = useCallback((ctx, width$1, height$1, cols, rows, squares, dpr) => {
|
|
1733
|
+
ctx.clearRect(0, 0, width$1, height$1);
|
|
1734
|
+
ctx.fillStyle = "transparent";
|
|
1735
|
+
ctx.fillRect(0, 0, width$1, height$1);
|
|
1736
|
+
for (let i = 0; i < cols; i++) for (let j = 0; j < rows; j++) {
|
|
1737
|
+
ctx.fillStyle = `${memoizedColor}${squares[i * rows + j]})`;
|
|
1738
|
+
ctx.fillRect(i * (squareSize + gridGap) * dpr, j * (squareSize + gridGap) * dpr, squareSize * dpr, squareSize * dpr);
|
|
1739
|
+
}
|
|
1740
|
+
}, [
|
|
1741
|
+
memoizedColor,
|
|
1742
|
+
squareSize,
|
|
1743
|
+
gridGap
|
|
1744
|
+
]);
|
|
1745
|
+
useEffect(() => {
|
|
1746
|
+
const canvasEl = canvasRef.current;
|
|
1747
|
+
const container$1 = containerRef.current;
|
|
1748
|
+
if (!canvasEl || !container$1) return;
|
|
1749
|
+
const ctx = canvasEl.getContext("2d");
|
|
1750
|
+
if (!ctx) return;
|
|
1751
|
+
let animationFrameId;
|
|
1752
|
+
let gridParams;
|
|
1753
|
+
const updateCanvasSize = () => {
|
|
1754
|
+
const newWidth = width || container$1.clientWidth;
|
|
1755
|
+
const newHeight = height || container$1.clientHeight;
|
|
1756
|
+
setCanvasSize({
|
|
1757
|
+
width: newWidth,
|
|
1758
|
+
height: newHeight
|
|
1759
|
+
});
|
|
1760
|
+
gridParams = setupCanvas(canvasEl, newWidth, newHeight);
|
|
1761
|
+
};
|
|
1762
|
+
updateCanvasSize();
|
|
1763
|
+
let lastTime = 0;
|
|
1764
|
+
const animate = (time) => {
|
|
1765
|
+
if (!isInView) return;
|
|
1766
|
+
const deltaTime = (time - lastTime) / 1e3;
|
|
1767
|
+
lastTime = time;
|
|
1768
|
+
updateSquares(gridParams.squares, deltaTime);
|
|
1769
|
+
drawGrid(ctx, canvasEl.width, canvasEl.height, gridParams.cols, gridParams.rows, gridParams.squares, gridParams.dpr);
|
|
1770
|
+
animationFrameId = requestAnimationFrame(animate);
|
|
1771
|
+
};
|
|
1772
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
1773
|
+
updateCanvasSize();
|
|
1774
|
+
});
|
|
1775
|
+
resizeObserver.observe(container$1);
|
|
1776
|
+
const intersectionObserver = new IntersectionObserver(([entry]) => {
|
|
1777
|
+
setIsInView(entry.isIntersecting);
|
|
1778
|
+
}, { threshold: 0 });
|
|
1779
|
+
intersectionObserver.observe(canvasEl);
|
|
1780
|
+
if (isInView) animationFrameId = requestAnimationFrame(animate);
|
|
1781
|
+
return () => {
|
|
1782
|
+
cancelAnimationFrame(animationFrameId);
|
|
1783
|
+
resizeObserver.disconnect();
|
|
1784
|
+
intersectionObserver.disconnect();
|
|
1785
|
+
};
|
|
1786
|
+
}, [
|
|
1787
|
+
setupCanvas,
|
|
1788
|
+
updateSquares,
|
|
1789
|
+
drawGrid,
|
|
1790
|
+
width,
|
|
1791
|
+
height,
|
|
1792
|
+
isInView
|
|
1793
|
+
]);
|
|
1794
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1795
|
+
ref: containerRef,
|
|
1796
|
+
className: `${container} ${className}`,
|
|
1797
|
+
...props,
|
|
1798
|
+
children: /* @__PURE__ */ jsx("canvas", {
|
|
1799
|
+
ref: canvasRef,
|
|
1800
|
+
className: canvas,
|
|
1801
|
+
style: {
|
|
1802
|
+
width: canvasSize.width,
|
|
1803
|
+
height: canvasSize.height
|
|
1804
|
+
}
|
|
1805
|
+
})
|
|
1806
|
+
});
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
//#endregion
|
|
1810
|
+
//#region src/components/ui/Input.css.ts
|
|
1811
|
+
var input = "Input_input__50i2wa0";
|
|
1812
|
+
var label = "Input_label__50i2wa1";
|
|
1813
|
+
var textarea = "Input_textarea__50i2wa2";
|
|
1814
|
+
|
|
1815
|
+
//#endregion
|
|
1816
|
+
//#region src/components/ui/Input.tsx
|
|
1817
|
+
const Input = forwardRef(({ className = "", ...props }, ref) => {
|
|
1818
|
+
return /* @__PURE__ */ jsx("input", {
|
|
1819
|
+
ref,
|
|
1820
|
+
className: `${input} ${className}`,
|
|
1821
|
+
...props
|
|
1822
|
+
});
|
|
1823
|
+
});
|
|
1824
|
+
Input.displayName = "Input";
|
|
1825
|
+
const Label = ({ className = "", children, ...props }) => {
|
|
1826
|
+
return /* @__PURE__ */ jsx("label", {
|
|
1827
|
+
className: `${label} ${className}`,
|
|
1828
|
+
...props,
|
|
1829
|
+
children
|
|
1830
|
+
});
|
|
1831
|
+
};
|
|
1832
|
+
const Textarea = ({ className = "", ...props }) => {
|
|
1833
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
1834
|
+
className: `${textarea} ${className}`,
|
|
1835
|
+
...props
|
|
1836
|
+
});
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region src/components/ui/Stepper.css.ts
|
|
1841
|
+
var stepContainer = "Stepper_stepContainer__e4qgi3";
|
|
1842
|
+
var stepDot = "Stepper_stepDot__e4qgie";
|
|
1843
|
+
var stepIndicator = "Stepper_stepIndicator__e4qgi4";
|
|
1844
|
+
var stepIndicatorActive = "Stepper_stepIndicatorActive__e4qgi6";
|
|
1845
|
+
var stepIndicatorCompleted = "Stepper_stepIndicatorCompleted__e4qgi5";
|
|
1846
|
+
var stepIndicatorPending = "Stepper_stepIndicatorPending__e4qgi7";
|
|
1847
|
+
var stepLabel = "Stepper_stepLabel__e4qgib";
|
|
1848
|
+
var stepLabelActive = "Stepper_stepLabelActive__e4qgic";
|
|
1849
|
+
var stepLabelInactive = "Stepper_stepLabelInactive__e4qgid";
|
|
1850
|
+
var stepLine = "Stepper_stepLine__e4qgi8";
|
|
1851
|
+
var stepLineCompleted = "Stepper_stepLineCompleted__e4qgi9";
|
|
1852
|
+
var stepLinePending = "Stepper_stepLinePending__e4qgia";
|
|
1853
|
+
var stepSpinner = "Stepper_stepSpinner__e4qgif";
|
|
1854
|
+
var stepperContainer = "Stepper_stepperContainer__e4qgi1";
|
|
1855
|
+
var stepperWrapper = "Stepper_stepperWrapper__e4qgi2";
|
|
1856
|
+
|
|
1857
|
+
//#endregion
|
|
1858
|
+
//#region src/components/ui/Stepper.tsx
|
|
1859
|
+
const Step = ({ title: title$5, isLoading, isCompleted, isActive, isLast }) => {
|
|
1860
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1861
|
+
className: stepContainer,
|
|
1862
|
+
children: [
|
|
1863
|
+
/* @__PURE__ */ jsx("div", {
|
|
1864
|
+
className: `${stepIndicator} ${isCompleted ? stepIndicatorCompleted : isActive ? stepIndicatorActive : stepIndicatorPending}`,
|
|
1865
|
+
children: isCompleted ? /* @__PURE__ */ jsxs("svg", {
|
|
1866
|
+
width: "16",
|
|
1867
|
+
height: "16",
|
|
1868
|
+
fill: "none",
|
|
1869
|
+
stroke: "currentColor",
|
|
1870
|
+
viewBox: "0 0 24 24",
|
|
1871
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Check" }), /* @__PURE__ */ jsx("path", {
|
|
1872
|
+
strokeLinecap: "round",
|
|
1873
|
+
strokeLinejoin: "round",
|
|
1874
|
+
strokeWidth: 2,
|
|
1875
|
+
d: "M5 13l4 4L19 7"
|
|
1876
|
+
})]
|
|
1877
|
+
}) : isLoading ? /* @__PURE__ */ jsx("div", { className: stepSpinner }) : /* @__PURE__ */ jsx("div", { className: stepDot })
|
|
1878
|
+
}),
|
|
1879
|
+
!isLast && /* @__PURE__ */ jsx("div", { className: `${stepLine} ${isCompleted ? stepLineCompleted : stepLinePending}` }),
|
|
1880
|
+
/* @__PURE__ */ jsx("span", {
|
|
1881
|
+
className: `${stepLabel} ${isActive || isCompleted ? stepLabelActive : stepLabelInactive}`,
|
|
1882
|
+
children: title$5
|
|
1883
|
+
})
|
|
1884
|
+
]
|
|
1885
|
+
});
|
|
1886
|
+
};
|
|
1887
|
+
const Stepper = ({ steps, currentStep, isLoading }) => {
|
|
1888
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1889
|
+
className: stepperContainer,
|
|
1890
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1891
|
+
className: stepperWrapper,
|
|
1892
|
+
children: steps.map((step, index) => /* @__PURE__ */ jsx(Step, {
|
|
1893
|
+
title: step.title,
|
|
1894
|
+
description: step.description,
|
|
1895
|
+
isCompleted: index < currentStep,
|
|
1896
|
+
isLoading: isLoading && index === currentStep,
|
|
1897
|
+
isActive: index === currentStep,
|
|
1898
|
+
isLast: index === steps.length - 1
|
|
1899
|
+
}, step.title))
|
|
1900
|
+
})
|
|
1901
|
+
});
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
//#endregion
|
|
1905
|
+
//#region src/components/extend-time-dialog/ExtendTimeDialog.css.ts
|
|
1906
|
+
var body$1 = "ExtendTimeDialog_body__1augvc0a";
|
|
1907
|
+
var closeButton = "ExtendTimeDialog_closeButton__1augvc09";
|
|
1908
|
+
var content$3 = "ExtendTimeDialog_content__1augvc02";
|
|
1909
|
+
var dateInputWrapper = "ExtendTimeDialog_dateInputWrapper__1augvc0d";
|
|
1910
|
+
var description$3 = "ExtendTimeDialog_description__1augvc08";
|
|
1911
|
+
var errorText = "ExtendTimeDialog_errorText__1augvc0h";
|
|
1912
|
+
var fieldGroup = "ExtendTimeDialog_fieldGroup__1augvc0c";
|
|
1913
|
+
var footer$1 = "ExtendTimeDialog_footer__1augvc0r";
|
|
1914
|
+
var formSection = "ExtendTimeDialog_formSection__1augvc0b";
|
|
1915
|
+
var header$2 = "ExtendTimeDialog_header__1augvc06";
|
|
1916
|
+
var infoText = "ExtendTimeDialog_infoText__1augvc0g";
|
|
1917
|
+
var inputError = "ExtendTimeDialog_inputError__1augvc0f";
|
|
1918
|
+
var loadingContent = "ExtendTimeDialog_loadingContent__1augvc04";
|
|
1919
|
+
var loadingOverlay = "ExtendTimeDialog_loadingOverlay__1augvc03";
|
|
1920
|
+
var overlay$2 = "ExtendTimeDialog_overlay__1augvc01";
|
|
1921
|
+
var spinner$1 = "ExtendTimeDialog_spinner__1augvc05";
|
|
1922
|
+
var summaryCard = "ExtendTimeDialog_summaryCard__1augvc0j";
|
|
1923
|
+
var summaryContent = "ExtendTimeDialog_summaryContent__1augvc0l";
|
|
1924
|
+
var summaryError = "ExtendTimeDialog_summaryError__1augvc0o";
|
|
1925
|
+
var summaryGrid = "ExtendTimeDialog_summaryGrid__1augvc0i";
|
|
1926
|
+
var summaryHeader = "ExtendTimeDialog_summaryHeader__1augvc0k";
|
|
1927
|
+
var summarySubtext = "ExtendTimeDialog_summarySubtext__1augvc0n";
|
|
1928
|
+
var summaryValue = "ExtendTimeDialog_summaryValue__1augvc0m";
|
|
1929
|
+
var title$3 = "ExtendTimeDialog_title__1augvc07";
|
|
1930
|
+
|
|
1931
|
+
//#endregion
|
|
1932
|
+
//#region src/components/extend-time-dialog/ExtendTimeDialog.tsx
|
|
1933
|
+
const ExtendTimeDialog = ({ siteId, currentAccount, clients: { suiClient, queryClient, walrusClient }, signAndExecuteTransaction, sponsorConfig, onSuccess }) => {
|
|
1934
|
+
const isOpen = useStore(isExtendTimeDialogOpen);
|
|
1935
|
+
const [selectedDate, setSelectedDate] = useState("");
|
|
1936
|
+
const [epochs, setEpochs] = useState(1);
|
|
1937
|
+
const [isExtending, setIsExtending] = useState(false);
|
|
1938
|
+
const [dateError, setDateError] = useState(null);
|
|
1939
|
+
const [currentEpochsRemaining, setCurrentEpochsRemaining] = useState(null);
|
|
1940
|
+
const [expirationDates, setExpirationDates] = useState(/* @__PURE__ */ new Map());
|
|
1941
|
+
const { epochDurationMs, formatDate } = useEpochDuration(walrusClient);
|
|
1942
|
+
const txExecutor = useTransactionExecutor({
|
|
1943
|
+
suiClient,
|
|
1944
|
+
walletAddress: currentAccount?.address,
|
|
1945
|
+
signAndExecuteTransaction,
|
|
1946
|
+
sponsorConfig
|
|
1947
|
+
});
|
|
1948
|
+
const { data: siteData } = useWalrusSiteQuery(siteId, {
|
|
1949
|
+
suiClient,
|
|
1950
|
+
queryClient
|
|
1951
|
+
});
|
|
1952
|
+
const fetchExpirationDates = useCallback(async () => {
|
|
1953
|
+
if (!siteId || !walrusClient || !currentAccount || !siteData?.resources) return;
|
|
1954
|
+
try {
|
|
1955
|
+
const blobType = await walrusClient.getBlobType();
|
|
1956
|
+
const datesMap = /* @__PURE__ */ new Map();
|
|
1957
|
+
const stakingState = await walrusClient.stakingState();
|
|
1958
|
+
const currentEpoch = Number(stakingState.epoch);
|
|
1959
|
+
const epochDuration = Number(stakingState.epoch_duration);
|
|
1960
|
+
let cursor = null;
|
|
1961
|
+
let hasNextPage = true;
|
|
1962
|
+
while (hasNextPage) {
|
|
1963
|
+
const ownedObjects = await suiClient.getOwnedObjects({
|
|
1964
|
+
owner: currentAccount.address,
|
|
1965
|
+
filter: { StructType: blobType },
|
|
1966
|
+
options: { showContent: true },
|
|
1967
|
+
cursor
|
|
1968
|
+
});
|
|
1969
|
+
for (const resource of siteData.resources) {
|
|
1970
|
+
const blobId = resource.blob_id;
|
|
1971
|
+
if (datesMap.has(blobId)) continue;
|
|
1972
|
+
for (const obj of ownedObjects.data) if (obj.data?.content && "fields" in obj.data.content) {
|
|
1973
|
+
const fields = obj.data.content.fields;
|
|
1974
|
+
if ("blob_id" in fields) {
|
|
1975
|
+
if (String(fields.blob_id) === blobId) {
|
|
1976
|
+
const storage = fields.storage;
|
|
1977
|
+
if (storage?.fields?.end_epoch !== void 0) {
|
|
1978
|
+
const remainingEpochs = Number(storage.fields.end_epoch) - currentEpoch;
|
|
1979
|
+
const expirationTime = Date.now() + remainingEpochs * epochDuration;
|
|
1980
|
+
datesMap.set(blobId, new Date(expirationTime));
|
|
1981
|
+
break;
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
hasNextPage = ownedObjects.hasNextPage;
|
|
1988
|
+
cursor = ownedObjects.nextCursor;
|
|
1989
|
+
}
|
|
1990
|
+
setExpirationDates(datesMap);
|
|
1991
|
+
} catch (error) {
|
|
1992
|
+
console.error("Error fetching expiration dates:", error);
|
|
1993
|
+
}
|
|
1994
|
+
}, [
|
|
1995
|
+
siteId,
|
|
1996
|
+
walrusClient,
|
|
1997
|
+
currentAccount,
|
|
1998
|
+
suiClient,
|
|
1999
|
+
siteData
|
|
2000
|
+
]);
|
|
2001
|
+
useEffect(() => {
|
|
2002
|
+
if (isOpen && siteId) fetchExpirationDates();
|
|
2003
|
+
}, [
|
|
2004
|
+
isOpen,
|
|
2005
|
+
siteId,
|
|
2006
|
+
fetchExpirationDates
|
|
2007
|
+
]);
|
|
2008
|
+
const currentExpiredDateMemo = useMemo(() => {
|
|
2009
|
+
if (!siteData?.resources || siteData.resources.length === 0) return null;
|
|
2010
|
+
const timestamps = siteData.resources.map((resource) => expirationDates.get(resource.blob_id)?.getTime()).filter((timestamp) => typeof timestamp === "number");
|
|
2011
|
+
if (timestamps.length === 0) return null;
|
|
2012
|
+
return new Date(Math.min(...timestamps));
|
|
2013
|
+
}, [siteData?.resources, expirationDates]);
|
|
2014
|
+
useEffect(() => {
|
|
2015
|
+
if (!currentExpiredDateMemo || !epochDurationMs) {
|
|
2016
|
+
setCurrentEpochsRemaining(null);
|
|
2017
|
+
return;
|
|
2018
|
+
}
|
|
2019
|
+
const now = Date.now();
|
|
2020
|
+
if (currentExpiredDateMemo.getTime() <= now) {
|
|
2021
|
+
setCurrentEpochsRemaining(0);
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
setCurrentEpochsRemaining(Math.ceil((currentExpiredDateMemo.getTime() - now) / epochDurationMs));
|
|
2025
|
+
}, [currentExpiredDateMemo, epochDurationMs]);
|
|
2026
|
+
const minDate = useMemo(() => {
|
|
2027
|
+
if (!epochDurationMs || !currentExpiredDateMemo) return "";
|
|
2028
|
+
const now = Date.now();
|
|
2029
|
+
const currentExpiration = currentExpiredDateMemo.getTime();
|
|
2030
|
+
const minFromNow = now + 1 * epochDurationMs;
|
|
2031
|
+
const minTimestamp = Math.max(currentExpiration, minFromNow);
|
|
2032
|
+
return new Date(minTimestamp).toISOString().slice(0, 10);
|
|
2033
|
+
}, [epochDurationMs, currentExpiredDateMemo]);
|
|
2034
|
+
const maxDate = useMemo(() => {
|
|
2035
|
+
if (!epochDurationMs || !currentExpiredDateMemo) return "";
|
|
2036
|
+
const maxTimestamp = currentExpiredDateMemo.getTime() + 365 * epochDurationMs;
|
|
2037
|
+
return new Date(maxTimestamp).toISOString().slice(0, 10);
|
|
2038
|
+
}, [epochDurationMs, currentExpiredDateMemo]);
|
|
2039
|
+
const calculateEpochsFromDate = (dateString) => {
|
|
2040
|
+
if (!epochDurationMs || !dateString || !currentExpiredDateMemo) return 1;
|
|
2041
|
+
const diffMs = new Date(dateString).getTime() - currentExpiredDateMemo.getTime();
|
|
2042
|
+
if (diffMs <= 0) return 1;
|
|
2043
|
+
const exactEpochs = diffMs / epochDurationMs;
|
|
2044
|
+
const roundedEpochs = Math.ceil(exactEpochs);
|
|
2045
|
+
return Math.max(1, Math.min(365, roundedEpochs));
|
|
2046
|
+
};
|
|
2047
|
+
const handleDateChange = (e) => {
|
|
2048
|
+
const newDate = e.target.value;
|
|
2049
|
+
setSelectedDate(newDate);
|
|
2050
|
+
setDateError(null);
|
|
2051
|
+
if (!newDate) {
|
|
2052
|
+
setEpochs(1);
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
setEpochs(calculateEpochsFromDate(newDate));
|
|
2056
|
+
};
|
|
2057
|
+
const projectedDate = useMemo(() => {
|
|
2058
|
+
if (!epochDurationMs || !currentExpiredDateMemo) return null;
|
|
2059
|
+
const projectedTimestamp = currentExpiredDateMemo.getTime() + epochs * epochDurationMs;
|
|
2060
|
+
return new Date(projectedTimestamp);
|
|
2061
|
+
}, [
|
|
2062
|
+
epochs,
|
|
2063
|
+
currentExpiredDateMemo,
|
|
2064
|
+
epochDurationMs
|
|
2065
|
+
]);
|
|
2066
|
+
useEffect(() => {
|
|
2067
|
+
if (isOpen && epochDurationMs && currentExpiredDateMemo) {
|
|
2068
|
+
const defaultTimestamp = currentExpiredDateMemo.getTime() + epochDurationMs;
|
|
2069
|
+
setSelectedDate(new Date(defaultTimestamp).toISOString().slice(0, 10));
|
|
2070
|
+
setEpochs(1);
|
|
2071
|
+
setDateError(null);
|
|
2072
|
+
}
|
|
2073
|
+
}, [
|
|
2074
|
+
isOpen,
|
|
2075
|
+
epochDurationMs,
|
|
2076
|
+
currentExpiredDateMemo
|
|
2077
|
+
]);
|
|
2078
|
+
const handleExtend = useCallback(async () => {
|
|
2079
|
+
if (!walrusClient || !currentAccount || !siteData?.resources || siteData.resources.length === 0 || !siteId) {
|
|
2080
|
+
setDateError("Cannot extend blobs: missing required data");
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
if (!epochs || epochs <= 0 || epochs > 365) {
|
|
2084
|
+
setDateError("Invalid epoch count. Must be between 1 and 365");
|
|
2085
|
+
return;
|
|
2086
|
+
}
|
|
2087
|
+
if (!selectedDate) {
|
|
2088
|
+
setDateError("Please select an expiration date");
|
|
2089
|
+
return;
|
|
2090
|
+
}
|
|
2091
|
+
if (!txExecutor) {
|
|
2092
|
+
setDateError("Transaction executor not available");
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
setIsExtending(true);
|
|
2096
|
+
setDateError(null);
|
|
2097
|
+
try {
|
|
2098
|
+
const blobType = await walrusClient.getBlobType();
|
|
2099
|
+
const network = suiClient.network;
|
|
2100
|
+
const walCoinType = mainPackage[network]?.walrusCoinType;
|
|
2101
|
+
const walrusPackageId = mainPackage[network]?.walrusPackageId;
|
|
2102
|
+
const systemObjectId = network === "mainnet" ? MAINNET_WALRUS_PACKAGE_CONFIG.systemObjectId : TESTNET_WALRUS_PACKAGE_CONFIG.systemObjectId;
|
|
2103
|
+
if (!walCoinType || !walrusPackageId) throw new Error("Network configuration not found");
|
|
2104
|
+
const blobIdToObjectIdMap = /* @__PURE__ */ new Map();
|
|
2105
|
+
let cursor = null;
|
|
2106
|
+
let hasNextPage = true;
|
|
2107
|
+
while (hasNextPage) {
|
|
2108
|
+
const ownedObjects = await suiClient.getOwnedObjects({
|
|
2109
|
+
owner: currentAccount.address,
|
|
2110
|
+
filter: { StructType: blobType },
|
|
2111
|
+
options: { showContent: true },
|
|
2112
|
+
cursor
|
|
2113
|
+
});
|
|
2114
|
+
for (const resource of siteData.resources) {
|
|
2115
|
+
const blobId = resource.blob_id;
|
|
2116
|
+
if (blobIdToObjectIdMap.has(blobId)) continue;
|
|
2117
|
+
for (const obj of ownedObjects.data) if (obj.data?.content && "fields" in obj.data.content) {
|
|
2118
|
+
const fields = obj.data.content.fields;
|
|
2119
|
+
if ("blob_id" in fields) {
|
|
2120
|
+
if (String(fields.blob_id) === blobId) {
|
|
2121
|
+
blobIdToObjectIdMap.set(blobId, obj.data.objectId);
|
|
2122
|
+
break;
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
hasNextPage = ownedObjects.hasNextPage;
|
|
2128
|
+
cursor = ownedObjects.nextCursor;
|
|
2129
|
+
}
|
|
2130
|
+
if (blobIdToObjectIdMap.size === 0) throw new Error("No blob objects found for this site. Make sure you own the blob objects.");
|
|
2131
|
+
const tx = new Transaction();
|
|
2132
|
+
tx.setSender(currentAccount.address);
|
|
2133
|
+
const walCoin = await suiClient.getCoins({
|
|
2134
|
+
owner: currentAccount.address,
|
|
2135
|
+
coinType: walCoinType
|
|
2136
|
+
});
|
|
2137
|
+
if (walCoin.data.length === 0) throw new Error("No WAL coins found in wallet. Please acquire WAL tokens first.");
|
|
2138
|
+
if (walCoin.data.length > 1) tx.mergeCoins(tx.object(walCoin.data[0].coinObjectId), walCoin.data.slice(1).map((coin) => tx.object(coin.coinObjectId)));
|
|
2139
|
+
for (const [_blobId, objectId] of blobIdToObjectIdMap.entries()) tx.moveCall({
|
|
2140
|
+
package: walrusPackageId,
|
|
2141
|
+
module: "system",
|
|
2142
|
+
function: "extend_blob",
|
|
2143
|
+
arguments: [
|
|
2144
|
+
tx.object(systemObjectId),
|
|
2145
|
+
tx.object(objectId),
|
|
2146
|
+
tx.pure.u32(epochs),
|
|
2147
|
+
tx.object(walCoin.data[0].coinObjectId)
|
|
2148
|
+
]
|
|
2149
|
+
});
|
|
2150
|
+
const digest = await txExecutor.execute({
|
|
2151
|
+
transaction: tx,
|
|
2152
|
+
description: `Extending ${blobIdToObjectIdMap.size} blob(s) by ${epochs} epoch(s)`
|
|
2153
|
+
});
|
|
2154
|
+
await suiClient.waitForTransaction({ digest });
|
|
2155
|
+
await queryClient.invalidateQueries({ predicate: (query) => {
|
|
2156
|
+
const key = query.queryKey;
|
|
2157
|
+
return Array.isArray(key) && (key[0] === "walrus-site" || key[0] === "walrus-sites") || false;
|
|
2158
|
+
} });
|
|
2159
|
+
await fetchExpirationDates();
|
|
2160
|
+
const successMessage = `Successfully extended ${blobIdToObjectIdMap.size} blob(s) by ${epochs} epoch(s)`;
|
|
2161
|
+
onSuccess?.(successMessage, digest);
|
|
2162
|
+
isExtendTimeDialogOpen.set(false);
|
|
2163
|
+
setSelectedDate("");
|
|
2164
|
+
setEpochs(1);
|
|
2165
|
+
setDateError(null);
|
|
2166
|
+
} catch (error) {
|
|
2167
|
+
console.error("Error extending blobs:", error);
|
|
2168
|
+
setDateError(`Failed to extend: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2169
|
+
} finally {
|
|
2170
|
+
setIsExtending(false);
|
|
2171
|
+
}
|
|
2172
|
+
}, [
|
|
2173
|
+
walrusClient,
|
|
2174
|
+
currentAccount,
|
|
2175
|
+
siteData,
|
|
2176
|
+
siteId,
|
|
2177
|
+
epochs,
|
|
2178
|
+
selectedDate,
|
|
2179
|
+
txExecutor,
|
|
2180
|
+
suiClient,
|
|
2181
|
+
queryClient,
|
|
2182
|
+
onSuccess,
|
|
2183
|
+
fetchExpirationDates
|
|
2184
|
+
]);
|
|
2185
|
+
const handleClose = () => {
|
|
2186
|
+
isExtendTimeDialogOpen.set(false);
|
|
2187
|
+
setSelectedDate("");
|
|
2188
|
+
setEpochs(1);
|
|
2189
|
+
setDateError(null);
|
|
2190
|
+
};
|
|
2191
|
+
if (!siteId || !siteData) return null;
|
|
2192
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
2193
|
+
open: isOpen,
|
|
2194
|
+
onOpenChange: (open) => !open && handleClose(),
|
|
2195
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$2 }), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
2196
|
+
className: content$3,
|
|
2197
|
+
children: [
|
|
2198
|
+
isExtending && /* @__PURE__ */ jsx("div", {
|
|
2199
|
+
className: loadingOverlay,
|
|
2200
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2201
|
+
className: loadingContent,
|
|
2202
|
+
children: [/* @__PURE__ */ jsx(Loader2, { className: spinner$1 }), /* @__PURE__ */ jsx("p", { children: "Extending storage time..." })]
|
|
2203
|
+
})
|
|
2204
|
+
}),
|
|
2205
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2206
|
+
className: header$2,
|
|
2207
|
+
children: [
|
|
2208
|
+
/* @__PURE__ */ jsxs(Dialog.Title, {
|
|
2209
|
+
className: title$3,
|
|
2210
|
+
children: ["Extend Time for ", siteData.name]
|
|
2211
|
+
}),
|
|
2212
|
+
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
2213
|
+
className: description$3,
|
|
2214
|
+
children: "Add epochs to extend the storage time for blobs in this site. Epochs will be added to the current expiration time."
|
|
2215
|
+
}),
|
|
2216
|
+
/* @__PURE__ */ jsx(Dialog.Close, {
|
|
2217
|
+
asChild: true,
|
|
2218
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
2219
|
+
type: "button",
|
|
2220
|
+
className: closeButton,
|
|
2221
|
+
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
2222
|
+
})
|
|
2223
|
+
})
|
|
2224
|
+
]
|
|
2225
|
+
}),
|
|
2226
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2227
|
+
className: body$1,
|
|
2228
|
+
children: [
|
|
2229
|
+
currentEpochsRemaining === 0 && /* @__PURE__ */ jsx(Banner, {
|
|
2230
|
+
title: "Site Expired",
|
|
2231
|
+
description: "This site has expired and cannot be extended. The blobs are no longer available on the Walrus network.",
|
|
2232
|
+
variant: "warning"
|
|
2233
|
+
}),
|
|
2234
|
+
currentEpochsRemaining !== 0 && /* @__PURE__ */ jsx(Banner, {
|
|
2235
|
+
title: "How Extension Works",
|
|
2236
|
+
description: "Select a target expiration date. The system will calculate the required epochs to extend your blobs to that date. Duration is rounded up to the nearest epoch.",
|
|
2237
|
+
variant: "info"
|
|
2238
|
+
}),
|
|
2239
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2240
|
+
className: formSection,
|
|
2241
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2242
|
+
className: fieldGroup,
|
|
2243
|
+
children: [
|
|
2244
|
+
/* @__PURE__ */ jsx(Label, {
|
|
2245
|
+
htmlFor: "expiration-date",
|
|
2246
|
+
children: "Target Expiration Date"
|
|
2247
|
+
}),
|
|
2248
|
+
/* @__PURE__ */ jsx("div", {
|
|
2249
|
+
className: dateInputWrapper,
|
|
2250
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
2251
|
+
id: "expiration-date",
|
|
2252
|
+
type: "date",
|
|
2253
|
+
value: selectedDate,
|
|
2254
|
+
min: minDate,
|
|
2255
|
+
max: maxDate,
|
|
2256
|
+
onChange: handleDateChange,
|
|
2257
|
+
disabled: currentEpochsRemaining === 0 || isExtending,
|
|
2258
|
+
className: dateError ? inputError : ""
|
|
2259
|
+
})
|
|
2260
|
+
}),
|
|
2261
|
+
epochDurationMs && /* @__PURE__ */ jsxs("div", {
|
|
2262
|
+
className: infoText,
|
|
2263
|
+
children: [/* @__PURE__ */ jsx(Info, { size: 14 }), /* @__PURE__ */ jsxs("span", { children: [
|
|
2264
|
+
"1 epoch ≈",
|
|
2265
|
+
" ",
|
|
2266
|
+
(epochDurationMs / (1e3 * 60 * 60 * 24)).toFixed(1),
|
|
2267
|
+
" ",
|
|
2268
|
+
"days • Duration rounded up. Maximum 365 epochs per extend."
|
|
2269
|
+
] })]
|
|
2270
|
+
}),
|
|
2271
|
+
dateError && /* @__PURE__ */ jsx("p", {
|
|
2272
|
+
className: errorText,
|
|
2273
|
+
children: dateError
|
|
2274
|
+
})
|
|
2275
|
+
]
|
|
2276
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2277
|
+
className: summaryGrid,
|
|
2278
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2279
|
+
className: summaryCard,
|
|
2280
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2281
|
+
className: summaryHeader,
|
|
2282
|
+
children: [/* @__PURE__ */ jsx(Calendar, { size: 14 }), /* @__PURE__ */ jsx("span", { children: "Current Expiration" })]
|
|
2283
|
+
}), currentExpiredDateMemo ? /* @__PURE__ */ jsxs("div", {
|
|
2284
|
+
className: summaryContent,
|
|
2285
|
+
children: [
|
|
2286
|
+
/* @__PURE__ */ jsx("div", {
|
|
2287
|
+
className: summaryValue,
|
|
2288
|
+
children: formatDate(currentExpiredDateMemo)
|
|
2289
|
+
}),
|
|
2290
|
+
currentEpochsRemaining !== null && currentEpochsRemaining > 0 && /* @__PURE__ */ jsxs("div", {
|
|
2291
|
+
className: summarySubtext,
|
|
2292
|
+
children: [
|
|
2293
|
+
currentEpochsRemaining,
|
|
2294
|
+
" epoch",
|
|
2295
|
+
currentEpochsRemaining !== 1 ? "s" : "",
|
|
2296
|
+
" remaining"
|
|
2297
|
+
]
|
|
2298
|
+
}),
|
|
2299
|
+
currentEpochsRemaining === 0 && /* @__PURE__ */ jsx("div", {
|
|
2300
|
+
className: summaryError,
|
|
2301
|
+
children: "Expired"
|
|
2302
|
+
})
|
|
2303
|
+
]
|
|
2304
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
2305
|
+
className: summaryValue,
|
|
2306
|
+
children: "Unavailable"
|
|
2307
|
+
})]
|
|
2308
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2309
|
+
className: summaryCard,
|
|
2310
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2311
|
+
className: summaryHeader,
|
|
2312
|
+
children: [/* @__PURE__ */ jsx(Clock, { size: 14 }), /* @__PURE__ */ jsx("span", { children: "New Expiration Date" })]
|
|
2313
|
+
}), projectedDate ? /* @__PURE__ */ jsxs("div", {
|
|
2314
|
+
className: summaryContent,
|
|
2315
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2316
|
+
className: summaryValue,
|
|
2317
|
+
children: formatDate(projectedDate)
|
|
2318
|
+
}), currentEpochsRemaining !== null && /* @__PURE__ */ jsxs("div", {
|
|
2319
|
+
className: summarySubtext,
|
|
2320
|
+
children: [
|
|
2321
|
+
currentEpochsRemaining,
|
|
2322
|
+
" →",
|
|
2323
|
+
" ",
|
|
2324
|
+
currentEpochsRemaining + epochs,
|
|
2325
|
+
" epochs (+",
|
|
2326
|
+
epochs,
|
|
2327
|
+
" ",
|
|
2328
|
+
"epoch",
|
|
2329
|
+
epochs !== 1 ? "s" : "",
|
|
2330
|
+
")"
|
|
2331
|
+
]
|
|
2332
|
+
})]
|
|
2333
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
2334
|
+
className: summaryValue,
|
|
2335
|
+
children: "Select a date"
|
|
2336
|
+
})]
|
|
2337
|
+
})]
|
|
2338
|
+
})]
|
|
2339
|
+
})
|
|
2340
|
+
]
|
|
2341
|
+
}),
|
|
2342
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2343
|
+
className: footer$1,
|
|
2344
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
2345
|
+
variant: "outline",
|
|
2346
|
+
onClick: handleClose,
|
|
2347
|
+
disabled: isExtending,
|
|
2348
|
+
children: "Cancel"
|
|
2349
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
2350
|
+
onClick: handleExtend,
|
|
2351
|
+
disabled: isExtending || !epochs || !selectedDate || !!dateError || currentEpochsRemaining === 0,
|
|
2352
|
+
children: isExtending ? "Extending..." : "Extend Time"
|
|
2353
|
+
})]
|
|
2354
|
+
})
|
|
2355
|
+
]
|
|
2356
|
+
})] })
|
|
2357
|
+
});
|
|
2358
|
+
};
|
|
2359
|
+
var ExtendTimeDialog_default = ExtendTimeDialog;
|
|
2360
|
+
|
|
2361
|
+
//#endregion
|
|
2362
|
+
//#region src/components/publish-menu/PublishMenu.css.ts
|
|
2363
|
+
var buttonGroup$1 = "PublishMenu_buttonGroup__13o2p6d7";
|
|
2364
|
+
var content$2 = "PublishMenu_content__13o2p6d0";
|
|
2365
|
+
var description$2 = "PublishMenu_description__13o2p6d4";
|
|
2366
|
+
var footer = "PublishMenu_footer__13o2p6d6";
|
|
2367
|
+
var header$1 = "PublishMenu_header__13o2p6d2";
|
|
2368
|
+
var item = "PublishMenu_item__13o2p6d1";
|
|
2369
|
+
var link$1 = "PublishMenu_link__13o2p6d5";
|
|
2370
|
+
var separator = "PublishMenu_separator__13o2p6d8";
|
|
2371
|
+
var title$2 = "PublishMenu_title__13o2p6d3";
|
|
2372
|
+
|
|
2373
|
+
//#endregion
|
|
2374
|
+
//#region src/components/publish-menu/PublishMenu.tsx
|
|
2375
|
+
const PublishMenu = ({ children, siteId, onPublishClick, onDomainClick, portalDomain, portalHttps, network = "testnet", clients, currentAccount }) => {
|
|
2376
|
+
const isDeployed = !!siteId;
|
|
2377
|
+
const walrusSiteUrl = siteId ? objectIdToWalrusSiteUrl(siteId, portalDomain, portalHttps) : void 0;
|
|
2378
|
+
const { data: nsDomains } = useSuiNsDomainsQuery(currentAccount, {
|
|
2379
|
+
suiClient: clients.suiClient,
|
|
2380
|
+
queryClient: clients.queryClient
|
|
2381
|
+
});
|
|
2382
|
+
const associatedDomains = nsDomains.filter((d) => d.walrusSiteId === siteId);
|
|
2383
|
+
const suiNSUrlArray = useStore(siteMetadataStore.suiNSUrl);
|
|
2384
|
+
const suiNSUrl = suiNSUrlArray.length > 0 ? suiNSUrlArray[0].suins : void 0;
|
|
2385
|
+
return /* @__PURE__ */ jsxs(DropdownMenu.Root, { children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, {
|
|
2386
|
+
asChild: true,
|
|
2387
|
+
children
|
|
2388
|
+
}), /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, {
|
|
2389
|
+
className: content$2,
|
|
2390
|
+
children: [
|
|
2391
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2392
|
+
className: header$1,
|
|
2393
|
+
children: [/* @__PURE__ */ jsx("h4", {
|
|
2394
|
+
className: title$2,
|
|
2395
|
+
children: isDeployed ? "Update your Site" : "Publish your Site"
|
|
2396
|
+
}), isDeployed && walrusSiteUrl ? associatedDomains.length > 0 && suiNSUrl ? /* @__PURE__ */ jsxs("p", {
|
|
2397
|
+
className: description$2,
|
|
2398
|
+
children: [
|
|
2399
|
+
"Your site is live at",
|
|
2400
|
+
" ",
|
|
2401
|
+
/* @__PURE__ */ jsx("a", {
|
|
2402
|
+
href: suiNSUrl,
|
|
2403
|
+
target: "_blank",
|
|
2404
|
+
rel: "noopener noreferrer",
|
|
2405
|
+
className: link$1,
|
|
2406
|
+
children: suiNSUrl
|
|
2407
|
+
}),
|
|
2408
|
+
". You can update your site to reflect the latest changes."
|
|
2409
|
+
]
|
|
2410
|
+
}) : /* @__PURE__ */ jsxs("p", {
|
|
2411
|
+
className: description$2,
|
|
2412
|
+
children: [
|
|
2413
|
+
"Your site is live at",
|
|
2414
|
+
" ",
|
|
2415
|
+
/* @__PURE__ */ jsxs("a", {
|
|
2416
|
+
href: network === "testnet" ? `https://testnet.suivision.xyz/object/${siteId}` : `https://suivision.xyz/object/${siteId}`,
|
|
2417
|
+
target: "_blank",
|
|
2418
|
+
rel: "noopener noreferrer",
|
|
2419
|
+
className: link$1,
|
|
2420
|
+
children: ["Explorer", /* @__PURE__ */ jsx(ExternalLink, { style: {
|
|
2421
|
+
display: "inline",
|
|
2422
|
+
width: "0.75rem",
|
|
2423
|
+
height: "0.75rem",
|
|
2424
|
+
marginLeft: "0.25rem"
|
|
2425
|
+
} })]
|
|
2426
|
+
}),
|
|
2427
|
+
". You can link SuiNS domains to view your site in the portal."
|
|
2428
|
+
]
|
|
2429
|
+
}) : /* @__PURE__ */ jsxs("p", {
|
|
2430
|
+
className: description$2,
|
|
2431
|
+
children: [
|
|
2432
|
+
"Deploy your app to",
|
|
2433
|
+
" ",
|
|
2434
|
+
/* @__PURE__ */ jsx("a", {
|
|
2435
|
+
href: "https://www.walrus.xyz/",
|
|
2436
|
+
target: "_blank",
|
|
2437
|
+
rel: "noopener noreferrer",
|
|
2438
|
+
className: link$1,
|
|
2439
|
+
children: "Walrus Sites"
|
|
2440
|
+
}),
|
|
2441
|
+
", a decentralized web hosting platform. After publishing, you can customize your domain and feature it in the community."
|
|
2442
|
+
]
|
|
2443
|
+
})]
|
|
2444
|
+
}),
|
|
2445
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, { className: separator }),
|
|
2446
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
2447
|
+
className: item,
|
|
2448
|
+
onSelect: onDomainClick,
|
|
2449
|
+
disabled: !siteId,
|
|
2450
|
+
children: [
|
|
2451
|
+
/* @__PURE__ */ jsx(Globe2, { style: {
|
|
2452
|
+
width: "1rem",
|
|
2453
|
+
height: "1rem"
|
|
2454
|
+
} }),
|
|
2455
|
+
/* @__PURE__ */ jsx("span", {
|
|
2456
|
+
style: { flex: 1 },
|
|
2457
|
+
children: "Customize Domain"
|
|
2458
|
+
}),
|
|
2459
|
+
!siteId && /* @__PURE__ */ jsx("span", {
|
|
2460
|
+
style: {
|
|
2461
|
+
fontSize: "0.75rem",
|
|
2462
|
+
color: "var(--muted-foreground)"
|
|
2463
|
+
},
|
|
2464
|
+
children: "Not Published Yet"
|
|
2465
|
+
})
|
|
2466
|
+
]
|
|
2467
|
+
}),
|
|
2468
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Item, {
|
|
2469
|
+
className: item,
|
|
2470
|
+
onSelect: () => {
|
|
2471
|
+
isExtendTimeDialogOpen.set(true);
|
|
2472
|
+
},
|
|
2473
|
+
disabled: !siteId,
|
|
2474
|
+
children: [
|
|
2475
|
+
/* @__PURE__ */ jsx(CalendarClock, { style: {
|
|
2476
|
+
width: "1rem",
|
|
2477
|
+
height: "1rem"
|
|
2478
|
+
} }),
|
|
2479
|
+
/* @__PURE__ */ jsx("span", {
|
|
2480
|
+
style: { flex: 1 },
|
|
2481
|
+
children: "Extend Time"
|
|
2482
|
+
}),
|
|
2483
|
+
!siteId && /* @__PURE__ */ jsx("span", {
|
|
2484
|
+
style: {
|
|
2485
|
+
fontSize: "0.75rem",
|
|
2486
|
+
color: "var(--muted-foreground)"
|
|
2487
|
+
},
|
|
2488
|
+
children: "Not Published Yet"
|
|
2489
|
+
})
|
|
2490
|
+
]
|
|
2491
|
+
}),
|
|
2492
|
+
/* @__PURE__ */ jsx(DropdownMenu.Separator, { className: separator }),
|
|
2493
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2494
|
+
className: footer,
|
|
2495
|
+
children: [isDeployed && walrusSiteUrl ? /* @__PURE__ */ jsxs("div", {
|
|
2496
|
+
className: buttonGroup$1,
|
|
2497
|
+
children: [suiNSUrl ? /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
2498
|
+
className: button({
|
|
2499
|
+
variant: "outline",
|
|
2500
|
+
size: "default"
|
|
2501
|
+
}),
|
|
2502
|
+
style: { width: "100%" },
|
|
2503
|
+
onSelect: () => {
|
|
2504
|
+
window.open(suinsDomainToWalrusSiteUrl(suiNSUrl, portalDomain, portalHttps), "_blank", "noopener,noreferrer");
|
|
2505
|
+
},
|
|
2506
|
+
children: "Visit Site"
|
|
2507
|
+
}) : /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
2508
|
+
className: button({
|
|
2509
|
+
variant: "outline",
|
|
2510
|
+
size: "default"
|
|
2511
|
+
}),
|
|
2512
|
+
style: { width: "100%" },
|
|
2513
|
+
onSelect: () => {
|
|
2514
|
+
isDomainDialogOpen.set(true);
|
|
2515
|
+
},
|
|
2516
|
+
children: "Link SuiNS"
|
|
2517
|
+
}), /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
2518
|
+
className: button({
|
|
2519
|
+
variant: "gradient",
|
|
2520
|
+
size: "default"
|
|
2521
|
+
}),
|
|
2522
|
+
onSelect: onPublishClick,
|
|
2523
|
+
children: "Update Site"
|
|
2524
|
+
})]
|
|
2525
|
+
}) : /* @__PURE__ */ jsx(DropdownMenu.Item, {
|
|
2526
|
+
className: button({
|
|
2527
|
+
variant: "gradient",
|
|
2528
|
+
size: "default"
|
|
2529
|
+
}),
|
|
2530
|
+
style: { width: "100%" },
|
|
2531
|
+
onSelect: onPublishClick,
|
|
2532
|
+
children: "Publish to Walrus"
|
|
2533
|
+
}), network === "testnet" && /* @__PURE__ */ jsx(Banner, {
|
|
2534
|
+
title: "You are publishing to the testnet",
|
|
2535
|
+
description: "You must run a local Walrus Site Portal to view published site.",
|
|
2536
|
+
variant: "info",
|
|
2537
|
+
url: "https://docs.wal.app/walrus-sites/portal.html",
|
|
2538
|
+
urlName: "Portal Documentation"
|
|
2539
|
+
})]
|
|
2540
|
+
})
|
|
2541
|
+
]
|
|
2542
|
+
}) })] });
|
|
2543
|
+
};
|
|
2544
|
+
var PublishMenu_default = PublishMenu;
|
|
2545
|
+
|
|
2546
|
+
//#endregion
|
|
2547
|
+
//#region src/queries/storage-cost.query.ts
|
|
2548
|
+
function useStorageCostQuery(fileSize, epochs, clients) {
|
|
2549
|
+
const { walrusClient, queryClient } = clients;
|
|
2550
|
+
return useQuery({
|
|
2551
|
+
queryKey: queryKeys.storageCost(fileSize, epochs),
|
|
2552
|
+
queryFn: async () => {
|
|
2553
|
+
if (!walrusClient) throw new Error("Walrus client not available");
|
|
2554
|
+
if (fileSize === null) throw new Error("Invalid file size");
|
|
2555
|
+
const storageCost = await walrusClient.storageCost(fileSize, epochs);
|
|
2556
|
+
return {
|
|
2557
|
+
storageCost: storageCost.storageCost.toString(),
|
|
2558
|
+
writeCost: storageCost.writeCost.toString(),
|
|
2559
|
+
totalCost: storageCost.totalCost.toString()
|
|
2560
|
+
};
|
|
2561
|
+
},
|
|
2562
|
+
enabled: !!walrusClient && fileSize !== null && fileSize > 0 && epochs > 0,
|
|
2563
|
+
staleTime: 300 * 1e3
|
|
2564
|
+
}, queryClient);
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
//#endregion
|
|
2568
|
+
//#region src/components/publish-modal/PublishModal.css.ts
|
|
2569
|
+
var buttonGroup = "PublishModal_buttonGroup__m8gxhre";
|
|
2570
|
+
var charCount = "PublishModal_charCount__m8gxhr11";
|
|
2571
|
+
var content$1 = "PublishModal_content__m8gxhr2";
|
|
2572
|
+
var description$1 = "PublishModal_description__m8gxhr4";
|
|
2573
|
+
var dialogBodyTwoColumn = "PublishModal_dialogBodyTwoColumn__m8gxhru";
|
|
2574
|
+
var dialogContent = "PublishModal_dialogContent__m8gxhrr";
|
|
2575
|
+
var dialogFooter = "PublishModal_dialogFooter__m8gxhrw";
|
|
2576
|
+
var dialogHeader = "PublishModal_dialogHeader__m8gxhrs";
|
|
2577
|
+
var dialogOverlay = "PublishModal_dialogOverlay__m8gxhrq";
|
|
2578
|
+
var dialogRightColumn = "PublishModal_dialogRightColumn__m8gxhrv";
|
|
2579
|
+
var editButton = "PublishModal_editButton__m8gxhro";
|
|
2580
|
+
var fieldLabel = "PublishModal_fieldLabel__m8gxhr10";
|
|
2581
|
+
var flickeringGrid = "PublishModal_flickeringGrid__m8gxhri";
|
|
2582
|
+
var leftColumn = "PublishModal_leftColumn__m8gxhr8";
|
|
2583
|
+
var maskLayer = "PublishModal_maskLayer__m8gxhrj";
|
|
2584
|
+
var metadataFields = "PublishModal_metadataFields__m8gxhra";
|
|
2585
|
+
var overlay$1 = "PublishModal_overlay__m8gxhr1";
|
|
2586
|
+
var placeholderContent = "PublishModal_placeholderContent__m8gxhrk";
|
|
2587
|
+
var placeholderIcon = "PublishModal_placeholderIcon__m8gxhrn";
|
|
2588
|
+
var previewArea = "PublishModal_previewArea__m8gxhrh";
|
|
2589
|
+
var previewContainer = "PublishModal_previewContainer__m8gxhrg";
|
|
2590
|
+
var previewImage = "PublishModal_previewImage__m8gxhrm";
|
|
2591
|
+
var previewImageWrapper = "PublishModal_previewImageWrapper__m8gxhrl";
|
|
2592
|
+
var rightColumn = "PublishModal_rightColumn__m8gxhr9";
|
|
2593
|
+
var section$1 = "PublishModal_section__m8gxhr6";
|
|
2594
|
+
var spinner = "PublishModal_spinner__m8gxhr1e";
|
|
2595
|
+
var storageCostLabel = "PublishModal_storageCostLabel__m8gxhr1a";
|
|
2596
|
+
var storageCostSection = "PublishModal_storageCostSection__m8gxhr18";
|
|
2597
|
+
var storageCostSummary = "PublishModal_storageCostSummary__m8gxhr19";
|
|
2598
|
+
var storageCostValue = "PublishModal_storageCostValue__m8gxhr1b";
|
|
2599
|
+
var storageDetailsBox = "PublishModal_storageDetailsBox__m8gxhr1d";
|
|
2600
|
+
var title$1 = "PublishModal_title__m8gxhr3";
|
|
2601
|
+
var twoColumnSection = "PublishModal_twoColumnSection__m8gxhr7";
|
|
2602
|
+
var uploadAreaSquare = "PublishModal_uploadAreaSquare__m8gxhry";
|
|
2603
|
+
var uploadPlaceholder = "PublishModal_uploadPlaceholder__m8gxhrz";
|
|
2604
|
+
|
|
2605
|
+
//#endregion
|
|
2606
|
+
//#region src/components/publish-modal/PublishModal.tsx
|
|
2607
|
+
const PublishModal = ({ siteId, assets, onDeploy, onSaveMetadata, onExtendBlobs, clients: { queryClient, walrusClient } }) => {
|
|
2608
|
+
const [isMetadataDialogOpen, setIsMetadataDialogOpen] = useState(false);
|
|
2609
|
+
const [isStorageDetailsExpanded, setIsStorageDetailsExpanded] = useState(false);
|
|
2610
|
+
const [isExtending, setIsExtending] = useState(false);
|
|
2611
|
+
const [previousEpochs, setPreviousEpochs] = useState(0);
|
|
2612
|
+
const [pendingEpochs, setPendingEpochs] = useState(0);
|
|
2613
|
+
const isOpen = useStore(sitePublishingStore.isPublishDialogOpen);
|
|
2614
|
+
const isWorking = useStore(sitePublishingStore.isWorking);
|
|
2615
|
+
const deployStatusText = useStore(sitePublishingStore.deployStatusText);
|
|
2616
|
+
const deployStepIndex = useStore(sitePublishingStore.deploymentStepIndex);
|
|
2617
|
+
const imageDisplayUrl = useStore(siteMetadataStore.imageDisplayUrl);
|
|
2618
|
+
const projectUrl = useStore(siteMetadataStore.projectUrl);
|
|
2619
|
+
const epochs = useStore(siteMetadataStore.epochs);
|
|
2620
|
+
const isDirty = useStore(siteMetadataStore.isDirty);
|
|
2621
|
+
const isLoading = useStore(siteMetadataStore.loading);
|
|
2622
|
+
const title$5 = useStore(siteMetadataStore.title);
|
|
2623
|
+
const description$5 = useStore(siteMetadataStore.description);
|
|
2624
|
+
const { epochDurationMs, getExpirationDate } = useEpochDuration(walrusClient);
|
|
2625
|
+
useEffect(() => {
|
|
2626
|
+
if (siteId && epochs && previousEpochs === 0) setPreviousEpochs(epochs);
|
|
2627
|
+
}, [
|
|
2628
|
+
siteId,
|
|
2629
|
+
epochs,
|
|
2630
|
+
previousEpochs
|
|
2631
|
+
]);
|
|
2632
|
+
const assetsSize = useMemo(() => assets.reduce((sum, a) => sum + a.content.byteLength, 0), [assets]);
|
|
2633
|
+
const minDate = useMemo(() => {
|
|
2634
|
+
if (!epochDurationMs) return "";
|
|
2635
|
+
const minDateTime = Date.now() + 5 * epochDurationMs;
|
|
2636
|
+
return new Date(minDateTime).toISOString().slice(0, 10);
|
|
2637
|
+
}, [epochDurationMs]);
|
|
2638
|
+
const maxDate = useMemo(() => {
|
|
2639
|
+
if (!epochDurationMs) return "";
|
|
2640
|
+
const maxDateTime = Date.now() + 30 * epochDurationMs;
|
|
2641
|
+
return new Date(maxDateTime).toISOString().slice(0, 10);
|
|
2642
|
+
}, [epochDurationMs]);
|
|
2643
|
+
const calculateEpochsFromDate = (selectedDate$1) => {
|
|
2644
|
+
if (!epochDurationMs || !selectedDate$1) return 5;
|
|
2645
|
+
const now = Date.now();
|
|
2646
|
+
const diffMs = new Date(selectedDate$1).getTime() - now;
|
|
2647
|
+
if (diffMs <= 0) return 5;
|
|
2648
|
+
const exactEpochs = diffMs / epochDurationMs;
|
|
2649
|
+
const roundedEpochs = Math.ceil(exactEpochs);
|
|
2650
|
+
return Math.max(5, Math.min(30, roundedEpochs));
|
|
2651
|
+
};
|
|
2652
|
+
const handleDateChange = (e) => {
|
|
2653
|
+
const selectedDate$1 = e.target.value;
|
|
2654
|
+
if (!selectedDate$1) return;
|
|
2655
|
+
const calculatedEpochs = calculateEpochsFromDate(selectedDate$1);
|
|
2656
|
+
if (siteId && previousEpochs > 0) setPendingEpochs(calculatedEpochs);
|
|
2657
|
+
siteMetadataStore.epochs.set(calculatedEpochs);
|
|
2658
|
+
};
|
|
2659
|
+
const handleSaveMetadataWithExtend = async () => {
|
|
2660
|
+
if (!onSaveMetadata) return;
|
|
2661
|
+
await onSaveMetadata();
|
|
2662
|
+
if (siteId && onExtendBlobs && previousEpochs > 0 && pendingEpochs > previousEpochs) {
|
|
2663
|
+
const extensionEpochs = pendingEpochs - previousEpochs;
|
|
2664
|
+
if (extensionEpochs > 0) {
|
|
2665
|
+
setIsExtending(true);
|
|
2666
|
+
try {
|
|
2667
|
+
await onExtendBlobs(extensionEpochs);
|
|
2668
|
+
setPreviousEpochs(pendingEpochs);
|
|
2669
|
+
setPendingEpochs(0);
|
|
2670
|
+
} catch (error) {
|
|
2671
|
+
console.error("Failed to extend blobs:", error);
|
|
2672
|
+
} finally {
|
|
2673
|
+
setIsExtending(false);
|
|
2674
|
+
}
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
};
|
|
2678
|
+
const selectedDate = useMemo(() => {
|
|
2679
|
+
if (!epochDurationMs || !epochs) return "";
|
|
2680
|
+
const targetTime = Date.now() + epochs * epochDurationMs;
|
|
2681
|
+
return new Date(targetTime).toISOString().slice(0, 10);
|
|
2682
|
+
}, [epochs, epochDurationMs]);
|
|
2683
|
+
const { data: storageCost = {
|
|
2684
|
+
storageCost: "0",
|
|
2685
|
+
writeCost: "0",
|
|
2686
|
+
totalCost: "0"
|
|
2687
|
+
}, isLoading: storageCostLoading, isError: storageCostError } = useStorageCostQuery(assetsSize, epochs, {
|
|
2688
|
+
walrusClient,
|
|
2689
|
+
queryClient
|
|
2690
|
+
});
|
|
2691
|
+
const deploymentSteps = [
|
|
2692
|
+
{
|
|
2693
|
+
title: "Prepare",
|
|
2694
|
+
description: "Build and register blobs for deployment"
|
|
2695
|
+
},
|
|
2696
|
+
{
|
|
2697
|
+
title: "Upload",
|
|
2698
|
+
description: "Upload assets to Walrus network"
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
title: "Certify",
|
|
2702
|
+
description: "Certify the uploaded assets"
|
|
2703
|
+
},
|
|
2704
|
+
{
|
|
2705
|
+
title: "Deploy",
|
|
2706
|
+
description: "Deploy and update the site"
|
|
2707
|
+
}
|
|
2708
|
+
];
|
|
2709
|
+
const expirationDate = getExpirationDate(epochs);
|
|
2710
|
+
return /* @__PURE__ */ jsxs(Dialog.Root, {
|
|
2711
|
+
open: isOpen,
|
|
2712
|
+
onOpenChange: sitePublishingStore.closePublishDialog,
|
|
2713
|
+
children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay$1 }), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
2714
|
+
className: content$1,
|
|
2715
|
+
children: [
|
|
2716
|
+
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
2717
|
+
className: title$1,
|
|
2718
|
+
children: siteId ? "Edit Site" : "Publish New Site"
|
|
2719
|
+
}),
|
|
2720
|
+
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
2721
|
+
className: description$1,
|
|
2722
|
+
children: "Make your project live in the Walrus network."
|
|
2723
|
+
}),
|
|
2724
|
+
/* @__PURE__ */ jsx(Stepper, {
|
|
2725
|
+
steps: deploymentSteps,
|
|
2726
|
+
currentStep: deployStepIndex,
|
|
2727
|
+
isLoading: isWorking
|
|
2728
|
+
}),
|
|
2729
|
+
/* @__PURE__ */ jsxs("section", {
|
|
2730
|
+
className: twoColumnSection,
|
|
2731
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2732
|
+
className: leftColumn,
|
|
2733
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2734
|
+
className: previewContainer,
|
|
2735
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2736
|
+
className: previewArea,
|
|
2737
|
+
children: imageDisplayUrl ? /* @__PURE__ */ jsxs("div", {
|
|
2738
|
+
className: previewImageWrapper,
|
|
2739
|
+
children: [
|
|
2740
|
+
/* @__PURE__ */ jsx("img", {
|
|
2741
|
+
src: imageDisplayUrl,
|
|
2742
|
+
alt: "Site preview",
|
|
2743
|
+
className: previewImage
|
|
2744
|
+
}),
|
|
2745
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
2746
|
+
position: "absolute",
|
|
2747
|
+
inset: 0,
|
|
2748
|
+
background: "linear-gradient(to bottom, transparent 0%, transparent 50%, rgba(0, 0, 0, 0.7) 100%)",
|
|
2749
|
+
pointerEvents: "none"
|
|
2750
|
+
} }),
|
|
2751
|
+
(title$5 || description$5) && /* @__PURE__ */ jsxs("div", {
|
|
2752
|
+
style: {
|
|
2753
|
+
position: "absolute",
|
|
2754
|
+
bottom: 0,
|
|
2755
|
+
left: 0,
|
|
2756
|
+
right: 0,
|
|
2757
|
+
padding: "1rem",
|
|
2758
|
+
color: "white",
|
|
2759
|
+
pointerEvents: "none"
|
|
2760
|
+
},
|
|
2761
|
+
children: [title$5 && /* @__PURE__ */ jsx("h3", {
|
|
2762
|
+
style: {
|
|
2763
|
+
fontSize: "0.875rem",
|
|
2764
|
+
fontWeight: 600,
|
|
2765
|
+
marginBottom: "0.25rem",
|
|
2766
|
+
lineHeight: 1.3,
|
|
2767
|
+
overflow: "hidden",
|
|
2768
|
+
textOverflow: "ellipsis",
|
|
2769
|
+
display: "-webkit-box",
|
|
2770
|
+
WebkitLineClamp: 2,
|
|
2771
|
+
WebkitBoxOrient: "vertical"
|
|
2772
|
+
},
|
|
2773
|
+
children: title$5
|
|
2774
|
+
}), description$5 && /* @__PURE__ */ jsx("p", {
|
|
2775
|
+
style: {
|
|
2776
|
+
fontSize: "0.75rem",
|
|
2777
|
+
opacity: .9,
|
|
2778
|
+
lineHeight: 1.4,
|
|
2779
|
+
overflow: "hidden",
|
|
2780
|
+
textOverflow: "ellipsis",
|
|
2781
|
+
display: "-webkit-box",
|
|
2782
|
+
WebkitLineClamp: 2,
|
|
2783
|
+
WebkitBoxOrient: "vertical"
|
|
2784
|
+
},
|
|
2785
|
+
children: description$5
|
|
2786
|
+
})]
|
|
2787
|
+
})
|
|
2788
|
+
]
|
|
2789
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2790
|
+
/* @__PURE__ */ jsx(FlickeringGrid, {
|
|
2791
|
+
className: flickeringGrid,
|
|
2792
|
+
squareSize: 2,
|
|
2793
|
+
gridGap: 6,
|
|
2794
|
+
color: "rgb(0, 0, 0)",
|
|
2795
|
+
maxOpacity: .3,
|
|
2796
|
+
flickerChance: .3
|
|
2797
|
+
}),
|
|
2798
|
+
/* @__PURE__ */ jsx("div", { className: maskLayer }),
|
|
2799
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2800
|
+
className: placeholderContent,
|
|
2801
|
+
children: [
|
|
2802
|
+
/* @__PURE__ */ jsx("div", {
|
|
2803
|
+
className: placeholderIcon,
|
|
2804
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
2805
|
+
width: "32",
|
|
2806
|
+
height: "32",
|
|
2807
|
+
fill: "none",
|
|
2808
|
+
stroke: "currentColor",
|
|
2809
|
+
viewBox: "0 0 24 24",
|
|
2810
|
+
children: [/* @__PURE__ */ jsx("title", { children: "Image placeholder icon" }), /* @__PURE__ */ jsx("path", {
|
|
2811
|
+
strokeLinecap: "round",
|
|
2812
|
+
strokeLinejoin: "round",
|
|
2813
|
+
strokeWidth: 2,
|
|
2814
|
+
d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
2815
|
+
})]
|
|
2816
|
+
})
|
|
2817
|
+
}),
|
|
2818
|
+
/* @__PURE__ */ jsx("p", {
|
|
2819
|
+
style: {
|
|
2820
|
+
fontWeight: 500,
|
|
2821
|
+
color: "var(--foreground)",
|
|
2822
|
+
textAlign: "center"
|
|
2823
|
+
},
|
|
2824
|
+
children: "Add a preview image"
|
|
2825
|
+
}),
|
|
2826
|
+
/* @__PURE__ */ jsx("p", {
|
|
2827
|
+
style: {
|
|
2828
|
+
color: "var(--muted-foreground)",
|
|
2829
|
+
textAlign: "center",
|
|
2830
|
+
fontSize: "0.875rem"
|
|
2831
|
+
},
|
|
2832
|
+
children: "Click the edit button to customize"
|
|
2833
|
+
})
|
|
2834
|
+
]
|
|
2835
|
+
})
|
|
2836
|
+
] })
|
|
2837
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
2838
|
+
type: "button",
|
|
2839
|
+
className: editButton,
|
|
2840
|
+
onClick: () => setIsMetadataDialogOpen(true),
|
|
2841
|
+
children: /* @__PURE__ */ jsx(Pencil, { size: 20 })
|
|
2842
|
+
})]
|
|
2843
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
2844
|
+
className: storageCostSection,
|
|
2845
|
+
style: { marginTop: "0.5rem" },
|
|
2846
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2847
|
+
className: storageCostSummary,
|
|
2848
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2849
|
+
className: storageCostLabel,
|
|
2850
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2851
|
+
style: { fontWeight: 500 },
|
|
2852
|
+
children: "Storage Cost"
|
|
2853
|
+
}), assetsSize !== null && /* @__PURE__ */ jsx("button", {
|
|
2854
|
+
type: "button",
|
|
2855
|
+
onClick: () => setIsStorageDetailsExpanded(!isStorageDetailsExpanded),
|
|
2856
|
+
style: {
|
|
2857
|
+
padding: "0.25rem",
|
|
2858
|
+
cursor: "pointer",
|
|
2859
|
+
border: "none",
|
|
2860
|
+
background: "transparent",
|
|
2861
|
+
color: "var(--muted-foreground)",
|
|
2862
|
+
borderRadius: "0.25rem",
|
|
2863
|
+
transition: "background-color 0.2s"
|
|
2864
|
+
},
|
|
2865
|
+
onMouseEnter: (e) => {
|
|
2866
|
+
e.currentTarget.style.backgroundColor = "var(--muted)";
|
|
2867
|
+
},
|
|
2868
|
+
onMouseLeave: (e) => {
|
|
2869
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
2870
|
+
},
|
|
2871
|
+
"aria-label": "View storage cost details",
|
|
2872
|
+
children: /* @__PURE__ */ jsx(Info, { size: 16 })
|
|
2873
|
+
})]
|
|
2874
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2875
|
+
className: storageCostValue,
|
|
2876
|
+
children: assetsSize === null ? /* @__PURE__ */ jsxs("span", {
|
|
2877
|
+
style: {
|
|
2878
|
+
color: "var(--warning, #f59e0b)",
|
|
2879
|
+
display: "flex",
|
|
2880
|
+
alignItems: "center",
|
|
2881
|
+
gap: "0.375rem"
|
|
2882
|
+
},
|
|
2883
|
+
children: [/* @__PURE__ */ jsx(Info, { size: 14 }), "Assets not prepared yet"]
|
|
2884
|
+
}) : storageCostLoading ? /* @__PURE__ */ jsx("span", {
|
|
2885
|
+
style: { color: "var(--muted-foreground)" },
|
|
2886
|
+
children: "Calculating..."
|
|
2887
|
+
}) : storageCostError ? /* @__PURE__ */ jsx("span", {
|
|
2888
|
+
style: { color: "var(--destructive)" },
|
|
2889
|
+
children: "Cost unavailable"
|
|
2890
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
2891
|
+
style: {
|
|
2892
|
+
fontSize: "0.875rem",
|
|
2893
|
+
color: "var(--muted-foreground)"
|
|
2894
|
+
},
|
|
2895
|
+
children: [
|
|
2896
|
+
(assetsSize / 1024).toFixed(2),
|
|
2897
|
+
" KB •",
|
|
2898
|
+
" "
|
|
2899
|
+
]
|
|
2900
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
2901
|
+
style: {
|
|
2902
|
+
fontWeight: 600,
|
|
2903
|
+
color: "var(--foreground)"
|
|
2904
|
+
},
|
|
2905
|
+
children: [
|
|
2906
|
+
((Number(storageCost.storageCost) + Number(storageCost.writeCost)) / 1e9).toFixed(9),
|
|
2907
|
+
" ",
|
|
2908
|
+
"WAL"
|
|
2909
|
+
]
|
|
2910
|
+
})] })
|
|
2911
|
+
})]
|
|
2912
|
+
}), isStorageDetailsExpanded && /* @__PURE__ */ jsx("div", {
|
|
2913
|
+
className: storageDetailsBox,
|
|
2914
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2915
|
+
style: {
|
|
2916
|
+
display: "flex",
|
|
2917
|
+
flexDirection: "column",
|
|
2918
|
+
gap: "0.2rem"
|
|
2919
|
+
},
|
|
2920
|
+
children: [
|
|
2921
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2922
|
+
style: { fontSize: "0.875rem" },
|
|
2923
|
+
children: [
|
|
2924
|
+
/* @__PURE__ */ jsx("span", {
|
|
2925
|
+
style: { fontWeight: 500 },
|
|
2926
|
+
children: "Storage Cost:"
|
|
2927
|
+
}),
|
|
2928
|
+
" ",
|
|
2929
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2930
|
+
style: { color: "#10b981" },
|
|
2931
|
+
children: [
|
|
2932
|
+
(Number(storageCost.storageCost) / 1e9).toFixed(9),
|
|
2933
|
+
" ",
|
|
2934
|
+
"WAL"
|
|
2935
|
+
]
|
|
2936
|
+
})
|
|
2937
|
+
]
|
|
2938
|
+
}),
|
|
2939
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2940
|
+
style: { fontSize: "0.875rem" },
|
|
2941
|
+
children: [
|
|
2942
|
+
/* @__PURE__ */ jsx("span", {
|
|
2943
|
+
style: { fontWeight: 500 },
|
|
2944
|
+
children: "Write Cost:"
|
|
2945
|
+
}),
|
|
2946
|
+
" ",
|
|
2947
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2948
|
+
style: { color: "#f97316" },
|
|
2949
|
+
children: [
|
|
2950
|
+
(Number(storageCost.writeCost) / 1e9).toFixed(9),
|
|
2951
|
+
" ",
|
|
2952
|
+
"WAL"
|
|
2953
|
+
]
|
|
2954
|
+
})
|
|
2955
|
+
]
|
|
2956
|
+
}),
|
|
2957
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2958
|
+
style: {
|
|
2959
|
+
fontSize: "0.875rem",
|
|
2960
|
+
borderTop: "1px solid var(--border)",
|
|
2961
|
+
paddingTop: "0.1rem",
|
|
2962
|
+
marginTop: "0.1rem"
|
|
2963
|
+
},
|
|
2964
|
+
children: [
|
|
2965
|
+
/* @__PURE__ */ jsx("span", {
|
|
2966
|
+
style: { fontWeight: 500 },
|
|
2967
|
+
children: "Total Cost:"
|
|
2968
|
+
}),
|
|
2969
|
+
" ",
|
|
2970
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2971
|
+
style: {
|
|
2972
|
+
color: "#3b82f6",
|
|
2973
|
+
fontWeight: 600
|
|
2974
|
+
},
|
|
2975
|
+
children: [
|
|
2976
|
+
((Number(storageCost.storageCost) + Number(storageCost.writeCost)) / 1e9).toFixed(9),
|
|
2977
|
+
" ",
|
|
2978
|
+
"WAL"
|
|
2979
|
+
]
|
|
2980
|
+
})
|
|
2981
|
+
]
|
|
2982
|
+
})
|
|
2983
|
+
]
|
|
2984
|
+
})
|
|
2985
|
+
})]
|
|
2986
|
+
})]
|
|
2987
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2988
|
+
className: rightColumn,
|
|
2989
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2990
|
+
className: metadataFields,
|
|
2991
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2992
|
+
className: dialogRightColumn,
|
|
2993
|
+
children: [
|
|
2994
|
+
/* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
|
|
2995
|
+
className: fieldLabel,
|
|
2996
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "Title" }), /* @__PURE__ */ jsxs("span", {
|
|
2997
|
+
className: charCount,
|
|
2998
|
+
children: [siteMetadataStore.title.get().length, "/120"]
|
|
2999
|
+
})]
|
|
3000
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
3001
|
+
value: siteMetadataStore.title.get(),
|
|
3002
|
+
onChange: (e) => siteMetadataStore.title.set(e.target.value.slice(0, 120)),
|
|
3003
|
+
placeholder: "Add a title..."
|
|
3004
|
+
})] }),
|
|
3005
|
+
/* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs("div", {
|
|
3006
|
+
className: fieldLabel,
|
|
3007
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "Description" }), /* @__PURE__ */ jsxs("span", {
|
|
3008
|
+
className: charCount,
|
|
3009
|
+
children: [siteMetadataStore.description.get().length, "/150"]
|
|
3010
|
+
})]
|
|
3011
|
+
}), /* @__PURE__ */ jsx(Textarea, {
|
|
3012
|
+
value: siteMetadataStore.description.get(),
|
|
3013
|
+
onChange: (e) => siteMetadataStore.description.set(e.target.value.slice(0, 150)),
|
|
3014
|
+
placeholder: "Add a description...",
|
|
3015
|
+
rows: 4
|
|
3016
|
+
})] }),
|
|
3017
|
+
/* @__PURE__ */ jsxs("fieldset", { children: [/* @__PURE__ */ jsxs(Label, { children: ["Project URL", /* @__PURE__ */ jsx("span", {
|
|
3018
|
+
style: {
|
|
3019
|
+
fontSize: "0.75rem",
|
|
3020
|
+
color: "var(--muted-foreground)"
|
|
3021
|
+
},
|
|
3022
|
+
children: "(Optional)"
|
|
3023
|
+
})] }), /* @__PURE__ */ jsx(Input, {
|
|
3024
|
+
value: projectUrl,
|
|
3025
|
+
onChange: (e) => siteMetadataStore.projectUrl.set(e.target.value),
|
|
3026
|
+
placeholder: "https://github.com/username/project"
|
|
3027
|
+
})] }),
|
|
3028
|
+
!siteId && /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
3029
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3030
|
+
className: fieldLabel,
|
|
3031
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "Storage Duration" }), epochs > 0 && /* @__PURE__ */ jsxs("span", {
|
|
3032
|
+
style: {
|
|
3033
|
+
fontSize: "0.75rem",
|
|
3034
|
+
color: "var(--muted-foreground)",
|
|
3035
|
+
display: "flex",
|
|
3036
|
+
alignItems: "center",
|
|
3037
|
+
gap: "0.25rem"
|
|
3038
|
+
},
|
|
3039
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3040
|
+
style: {
|
|
3041
|
+
fontWeight: 600,
|
|
3042
|
+
color: "var(--foreground)"
|
|
3043
|
+
},
|
|
3044
|
+
children: epochs
|
|
3045
|
+
}), "epochs"]
|
|
3046
|
+
})]
|
|
3047
|
+
}),
|
|
3048
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3049
|
+
style: { position: "relative" },
|
|
3050
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
3051
|
+
type: "date",
|
|
3052
|
+
value: selectedDate,
|
|
3053
|
+
min: minDate,
|
|
3054
|
+
max: maxDate,
|
|
3055
|
+
onChange: handleDateChange,
|
|
3056
|
+
disabled: isWorking,
|
|
3057
|
+
style: {
|
|
3058
|
+
paddingLeft: "2.5rem",
|
|
3059
|
+
cursor: isWorking ? "wait" : "pointer"
|
|
3060
|
+
}
|
|
3061
|
+
}), /* @__PURE__ */ jsx(CalendarClock, {
|
|
3062
|
+
size: 18,
|
|
3063
|
+
style: {
|
|
3064
|
+
position: "absolute",
|
|
3065
|
+
left: "0.75rem",
|
|
3066
|
+
top: "50%",
|
|
3067
|
+
transform: "translateY(-50%)",
|
|
3068
|
+
color: "var(--muted-foreground)",
|
|
3069
|
+
pointerEvents: "none"
|
|
3070
|
+
}
|
|
3071
|
+
})]
|
|
3072
|
+
}),
|
|
3073
|
+
expirationDate && epochDurationMs && /* @__PURE__ */ jsxs("div", {
|
|
3074
|
+
style: {
|
|
3075
|
+
display: "flex",
|
|
3076
|
+
alignItems: "center",
|
|
3077
|
+
gap: "0.5rem",
|
|
3078
|
+
fontSize: "0.75rem",
|
|
3079
|
+
color: "var(--muted-foreground)",
|
|
3080
|
+
marginTop: "0.5rem"
|
|
3081
|
+
},
|
|
3082
|
+
children: [/* @__PURE__ */ jsx(Info, {
|
|
3083
|
+
size: 14,
|
|
3084
|
+
style: { flexShrink: 0 }
|
|
3085
|
+
}), /* @__PURE__ */ jsxs("span", { children: [
|
|
3086
|
+
"1 epoch ≈",
|
|
3087
|
+
" ",
|
|
3088
|
+
(epochDurationMs / (1e3 * 60 * 60 * 24)).toFixed(1),
|
|
3089
|
+
" ",
|
|
3090
|
+
"days",
|
|
3091
|
+
" • ",
|
|
3092
|
+
"Duration rounded up. Can be extended later."
|
|
3093
|
+
] })]
|
|
3094
|
+
})
|
|
3095
|
+
] })
|
|
3096
|
+
]
|
|
3097
|
+
})
|
|
3098
|
+
})
|
|
3099
|
+
})]
|
|
3100
|
+
}),
|
|
3101
|
+
isDirty ? /* @__PURE__ */ jsx("section", {
|
|
3102
|
+
className: section$1,
|
|
3103
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3104
|
+
className: buttonGroup,
|
|
3105
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
3106
|
+
variant: "outline",
|
|
3107
|
+
style: { flex: 1 },
|
|
3108
|
+
onClick: siteMetadataStore.cancelEdit,
|
|
3109
|
+
disabled: isLoading,
|
|
3110
|
+
children: "Cancel"
|
|
3111
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
3112
|
+
style: {
|
|
3113
|
+
flex: 1,
|
|
3114
|
+
display: "flex",
|
|
3115
|
+
alignItems: "center",
|
|
3116
|
+
justifyContent: "center",
|
|
3117
|
+
gap: "0.5rem"
|
|
3118
|
+
},
|
|
3119
|
+
onClick: handleSaveMetadataWithExtend,
|
|
3120
|
+
disabled: isLoading || isExtending,
|
|
3121
|
+
children: isLoading || isExtending ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Loader2, {
|
|
3122
|
+
size: 16,
|
|
3123
|
+
className: spinner
|
|
3124
|
+
}), isExtending ? "Extending Storage..." : "Saving..."] }) : "Save"
|
|
3125
|
+
})]
|
|
3126
|
+
})
|
|
3127
|
+
}) : /* @__PURE__ */ jsxs("section", {
|
|
3128
|
+
className: section$1,
|
|
3129
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3130
|
+
className: buttonGroup,
|
|
3131
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
3132
|
+
variant: "gradient",
|
|
3133
|
+
style: {
|
|
3134
|
+
width: "100%",
|
|
3135
|
+
display: "flex",
|
|
3136
|
+
alignItems: "center",
|
|
3137
|
+
justifyContent: "center",
|
|
3138
|
+
gap: "0.5rem"
|
|
3139
|
+
},
|
|
3140
|
+
onClick: onDeploy,
|
|
3141
|
+
disabled: isWorking,
|
|
3142
|
+
children: [isWorking && /* @__PURE__ */ jsx(Loader2, {
|
|
3143
|
+
size: 16,
|
|
3144
|
+
className: spinner
|
|
3145
|
+
}), deployStatusText]
|
|
3146
|
+
})
|
|
3147
|
+
}), /* @__PURE__ */ jsx(Banner, {
|
|
3148
|
+
title: "Warning",
|
|
3149
|
+
description: "Please don't close the website\n until the deployment is complete.",
|
|
3150
|
+
variant: "warning"
|
|
3151
|
+
})]
|
|
3152
|
+
})
|
|
3153
|
+
]
|
|
3154
|
+
})] }), /* @__PURE__ */ jsx(MetadataEditDialog, {
|
|
3155
|
+
isOpen: isMetadataDialogOpen,
|
|
3156
|
+
onClose: () => setIsMetadataDialogOpen(false)
|
|
3157
|
+
})]
|
|
3158
|
+
});
|
|
3159
|
+
};
|
|
3160
|
+
function MetadataEditDialog({ isOpen, onClose }) {
|
|
3161
|
+
const imageDisplayUrl = useStore(siteMetadataStore.imageDisplayUrl);
|
|
3162
|
+
const isDirty = useStore(siteMetadataStore.isDirty);
|
|
3163
|
+
const isLoading = useStore(siteMetadataStore.loading);
|
|
3164
|
+
const [uploadMode, setUploadMode] = useState("file");
|
|
3165
|
+
const [imageUrl, setImageUrl] = useState("");
|
|
3166
|
+
const [urlError, setUrlError] = useState("");
|
|
3167
|
+
const [fileSizeError, setFileSizeError] = useState("");
|
|
3168
|
+
const fileInputRef = useRef(null);
|
|
3169
|
+
const MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
3170
|
+
const handleImageChange = (e) => {
|
|
3171
|
+
const file = e.target.files?.[0];
|
|
3172
|
+
if (!file) return;
|
|
3173
|
+
if (file.size > MAX_FILE_SIZE) {
|
|
3174
|
+
setFileSizeError(`File size exceeds 5MB limit (${(file.size / 1024 / 1024).toFixed(2)}MB)`);
|
|
3175
|
+
e.target.value = "";
|
|
3176
|
+
return;
|
|
3177
|
+
}
|
|
3178
|
+
setFileSizeError("");
|
|
3179
|
+
siteMetadataStore.imageUrl.set(file);
|
|
3180
|
+
};
|
|
3181
|
+
const handleUrlSubmit = () => {
|
|
3182
|
+
if (!imageUrl.trim()) {
|
|
3183
|
+
setUrlError("Please enter a valid URL");
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
3186
|
+
try {
|
|
3187
|
+
new URL(imageUrl);
|
|
3188
|
+
siteMetadataStore.imageUrl.set(imageUrl);
|
|
3189
|
+
setImageUrl("");
|
|
3190
|
+
setUrlError("");
|
|
3191
|
+
setUploadMode("file");
|
|
3192
|
+
} catch {
|
|
3193
|
+
setUrlError("Please enter a valid URL");
|
|
3194
|
+
}
|
|
3195
|
+
};
|
|
3196
|
+
const handleCancel = () => {
|
|
3197
|
+
siteMetadataStore.cancelEdit();
|
|
3198
|
+
setUploadMode("file");
|
|
3199
|
+
setImageUrl("");
|
|
3200
|
+
setUrlError("");
|
|
3201
|
+
setFileSizeError("");
|
|
3202
|
+
onClose();
|
|
3203
|
+
};
|
|
3204
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
3205
|
+
open: isOpen,
|
|
3206
|
+
onOpenChange: onClose,
|
|
3207
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: dialogOverlay }), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
3208
|
+
className: dialogContent,
|
|
3209
|
+
children: [
|
|
3210
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3211
|
+
className: dialogHeader,
|
|
3212
|
+
children: [/* @__PURE__ */ jsx(Dialog.Title, {
|
|
3213
|
+
style: {
|
|
3214
|
+
fontSize: "1.125rem",
|
|
3215
|
+
fontWeight: 600,
|
|
3216
|
+
color: "var(--foreground)"
|
|
3217
|
+
},
|
|
3218
|
+
children: "Edit Site Image"
|
|
3219
|
+
}), /* @__PURE__ */ jsx(Dialog.Close, {
|
|
3220
|
+
asChild: true,
|
|
3221
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
3222
|
+
type: "button",
|
|
3223
|
+
style: {
|
|
3224
|
+
padding: "0.25rem",
|
|
3225
|
+
cursor: "pointer",
|
|
3226
|
+
border: "none",
|
|
3227
|
+
background: "transparent",
|
|
3228
|
+
color: "var(--foreground)",
|
|
3229
|
+
borderRadius: "0.5rem",
|
|
3230
|
+
transition: "background-color 0.2s"
|
|
3231
|
+
},
|
|
3232
|
+
onMouseEnter: (e) => {
|
|
3233
|
+
e.currentTarget.style.backgroundColor = "var(--muted)";
|
|
3234
|
+
},
|
|
3235
|
+
onMouseLeave: (e) => {
|
|
3236
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
3237
|
+
},
|
|
3238
|
+
children: /* @__PURE__ */ jsx(X, { size: 20 })
|
|
3239
|
+
})
|
|
3240
|
+
})]
|
|
3241
|
+
}),
|
|
3242
|
+
/* @__PURE__ */ jsx("div", {
|
|
3243
|
+
className: dialogBodyTwoColumn,
|
|
3244
|
+
children: /* @__PURE__ */ jsxs("div", { children: [
|
|
3245
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3246
|
+
className: fieldLabel,
|
|
3247
|
+
children: [/* @__PURE__ */ jsx(Label, { children: "Preview Image" }), /* @__PURE__ */ jsx("span", {
|
|
3248
|
+
style: {
|
|
3249
|
+
fontSize: "0.75rem",
|
|
3250
|
+
color: "var(--muted-foreground)"
|
|
3251
|
+
},
|
|
3252
|
+
children: "Max 5MB"
|
|
3253
|
+
})]
|
|
3254
|
+
}),
|
|
3255
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3256
|
+
style: {
|
|
3257
|
+
display: "flex",
|
|
3258
|
+
gap: "0.5rem",
|
|
3259
|
+
marginBottom: "1rem",
|
|
3260
|
+
padding: "0.25rem",
|
|
3261
|
+
backgroundColor: "var(--muted)",
|
|
3262
|
+
borderRadius: "0.5rem"
|
|
3263
|
+
},
|
|
3264
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
3265
|
+
type: "button",
|
|
3266
|
+
onClick: () => {
|
|
3267
|
+
setUploadMode("file");
|
|
3268
|
+
setUrlError("");
|
|
3269
|
+
},
|
|
3270
|
+
style: {
|
|
3271
|
+
flex: 1,
|
|
3272
|
+
padding: "0.5rem 1rem",
|
|
3273
|
+
fontSize: "0.875rem",
|
|
3274
|
+
fontWeight: 500,
|
|
3275
|
+
border: "none",
|
|
3276
|
+
borderRadius: "0.375rem",
|
|
3277
|
+
cursor: "pointer",
|
|
3278
|
+
transition: "all 0.2s",
|
|
3279
|
+
backgroundColor: uploadMode === "file" ? "var(--background)" : "transparent",
|
|
3280
|
+
color: uploadMode === "file" ? "var(--foreground)" : "var(--muted-foreground)",
|
|
3281
|
+
boxShadow: uploadMode === "file" ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none"
|
|
3282
|
+
},
|
|
3283
|
+
children: "Upload File"
|
|
3284
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3285
|
+
type: "button",
|
|
3286
|
+
onClick: () => {
|
|
3287
|
+
setUploadMode("url");
|
|
3288
|
+
setFileSizeError("");
|
|
3289
|
+
},
|
|
3290
|
+
style: {
|
|
3291
|
+
flex: 1,
|
|
3292
|
+
padding: "0.5rem 1rem",
|
|
3293
|
+
fontSize: "0.875rem",
|
|
3294
|
+
fontWeight: 500,
|
|
3295
|
+
border: "none",
|
|
3296
|
+
borderRadius: "0.375rem",
|
|
3297
|
+
cursor: "pointer",
|
|
3298
|
+
transition: "all 0.2s",
|
|
3299
|
+
backgroundColor: uploadMode === "url" ? "var(--background)" : "transparent",
|
|
3300
|
+
color: uploadMode === "url" ? "var(--foreground)" : "var(--muted-foreground)",
|
|
3301
|
+
boxShadow: uploadMode === "url" ? "0 1px 3px rgba(0, 0, 0, 0.1)" : "none"
|
|
3302
|
+
},
|
|
3303
|
+
children: "From URL"
|
|
3304
|
+
})]
|
|
3305
|
+
}),
|
|
3306
|
+
uploadMode === "file" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3307
|
+
/* @__PURE__ */ jsx("div", {
|
|
3308
|
+
className: uploadAreaSquare,
|
|
3309
|
+
onClick: () => !isLoading && fileInputRef.current?.click(),
|
|
3310
|
+
style: {
|
|
3311
|
+
cursor: isLoading ? "wait" : "pointer",
|
|
3312
|
+
opacity: isLoading ? .6 : 1
|
|
3313
|
+
},
|
|
3314
|
+
children: isLoading ? /* @__PURE__ */ jsxs("div", {
|
|
3315
|
+
className: uploadPlaceholder,
|
|
3316
|
+
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
3317
|
+
width: "32px",
|
|
3318
|
+
height: "32px",
|
|
3319
|
+
border: "3px solid var(--muted)",
|
|
3320
|
+
borderTop: "3px solid var(--foreground)",
|
|
3321
|
+
borderRadius: "50%",
|
|
3322
|
+
animation: "spin 1s linear infinite",
|
|
3323
|
+
marginBottom: "0.75rem"
|
|
3324
|
+
} }), /* @__PURE__ */ jsx("p", {
|
|
3325
|
+
style: {
|
|
3326
|
+
fontWeight: 500,
|
|
3327
|
+
color: "var(--foreground)",
|
|
3328
|
+
textAlign: "center"
|
|
3329
|
+
},
|
|
3330
|
+
children: "Uploading..."
|
|
3331
|
+
})]
|
|
3332
|
+
}) : imageDisplayUrl ? /* @__PURE__ */ jsx("img", {
|
|
3333
|
+
src: imageDisplayUrl,
|
|
3334
|
+
alt: "Preview",
|
|
3335
|
+
style: {
|
|
3336
|
+
width: "100%",
|
|
3337
|
+
height: "100%",
|
|
3338
|
+
objectFit: "cover",
|
|
3339
|
+
borderRadius: "0.5rem"
|
|
3340
|
+
}
|
|
3341
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
3342
|
+
className: uploadPlaceholder,
|
|
3343
|
+
children: [
|
|
3344
|
+
/* @__PURE__ */ jsx(Upload, {
|
|
3345
|
+
size: 32,
|
|
3346
|
+
style: {
|
|
3347
|
+
marginBottom: "0.75rem",
|
|
3348
|
+
color: "var(--muted-foreground)"
|
|
3349
|
+
}
|
|
3350
|
+
}),
|
|
3351
|
+
/* @__PURE__ */ jsx("p", {
|
|
3352
|
+
style: {
|
|
3353
|
+
fontWeight: 500,
|
|
3354
|
+
color: "var(--foreground)",
|
|
3355
|
+
textAlign: "center"
|
|
3356
|
+
},
|
|
3357
|
+
children: "Click to upload"
|
|
3358
|
+
}),
|
|
3359
|
+
/* @__PURE__ */ jsx("p", {
|
|
3360
|
+
style: {
|
|
3361
|
+
fontSize: "0.875rem",
|
|
3362
|
+
color: "var(--muted-foreground)",
|
|
3363
|
+
textAlign: "center",
|
|
3364
|
+
marginTop: "0.25rem"
|
|
3365
|
+
},
|
|
3366
|
+
children: "Square image recommended"
|
|
3367
|
+
})
|
|
3368
|
+
]
|
|
3369
|
+
})
|
|
3370
|
+
}),
|
|
3371
|
+
/* @__PURE__ */ jsx("input", {
|
|
3372
|
+
ref: fileInputRef,
|
|
3373
|
+
type: "file",
|
|
3374
|
+
accept: "image/*",
|
|
3375
|
+
onChange: handleImageChange,
|
|
3376
|
+
style: { display: "none" }
|
|
3377
|
+
}),
|
|
3378
|
+
fileSizeError && /* @__PURE__ */ jsxs("p", {
|
|
3379
|
+
style: {
|
|
3380
|
+
fontSize: "0.75rem",
|
|
3381
|
+
color: "var(--destructive)",
|
|
3382
|
+
marginTop: "0.5rem",
|
|
3383
|
+
display: "flex",
|
|
3384
|
+
alignItems: "center",
|
|
3385
|
+
gap: "0.25rem"
|
|
3386
|
+
},
|
|
3387
|
+
children: [/* @__PURE__ */ jsx(Info, { size: 14 }), fileSizeError]
|
|
3388
|
+
})
|
|
3389
|
+
] }) : /* @__PURE__ */ jsxs("div", {
|
|
3390
|
+
style: {
|
|
3391
|
+
display: "flex",
|
|
3392
|
+
flexDirection: "column",
|
|
3393
|
+
gap: "1rem"
|
|
3394
|
+
},
|
|
3395
|
+
children: [imageDisplayUrl && /* @__PURE__ */ jsx("div", {
|
|
3396
|
+
style: {
|
|
3397
|
+
width: "100%",
|
|
3398
|
+
aspectRatio: "1",
|
|
3399
|
+
borderRadius: "0.5rem",
|
|
3400
|
+
overflow: "hidden",
|
|
3401
|
+
border: "1px solid var(--border)"
|
|
3402
|
+
},
|
|
3403
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
3404
|
+
src: imageDisplayUrl,
|
|
3405
|
+
alt: "Preview",
|
|
3406
|
+
style: {
|
|
3407
|
+
width: "100%",
|
|
3408
|
+
height: "100%",
|
|
3409
|
+
objectFit: "cover"
|
|
3410
|
+
}
|
|
3411
|
+
})
|
|
3412
|
+
}), /* @__PURE__ */ jsxs("div", { children: [
|
|
3413
|
+
/* @__PURE__ */ jsx(Label, { children: "Image URL" }),
|
|
3414
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3415
|
+
style: {
|
|
3416
|
+
display: "flex",
|
|
3417
|
+
gap: "0.5rem",
|
|
3418
|
+
marginTop: "0.5rem"
|
|
3419
|
+
},
|
|
3420
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
3421
|
+
value: imageUrl,
|
|
3422
|
+
onChange: (e) => {
|
|
3423
|
+
setImageUrl(e.target.value);
|
|
3424
|
+
setUrlError("");
|
|
3425
|
+
},
|
|
3426
|
+
onKeyDown: (e) => {
|
|
3427
|
+
if (e.key === "Enter") handleUrlSubmit();
|
|
3428
|
+
},
|
|
3429
|
+
placeholder: "https://example.com/image.png",
|
|
3430
|
+
style: { flex: 1 }
|
|
3431
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
3432
|
+
onClick: handleUrlSubmit,
|
|
3433
|
+
style: { flexShrink: 0 },
|
|
3434
|
+
children: "Apply"
|
|
3435
|
+
})]
|
|
3436
|
+
}),
|
|
3437
|
+
urlError && /* @__PURE__ */ jsxs("p", {
|
|
3438
|
+
style: {
|
|
3439
|
+
fontSize: "0.75rem",
|
|
3440
|
+
color: "var(--destructive)",
|
|
3441
|
+
marginTop: "0.5rem",
|
|
3442
|
+
display: "flex",
|
|
3443
|
+
alignItems: "center",
|
|
3444
|
+
gap: "0.25rem"
|
|
3445
|
+
},
|
|
3446
|
+
children: [/* @__PURE__ */ jsx(Info, { size: 14 }), urlError]
|
|
3447
|
+
})
|
|
3448
|
+
] })]
|
|
3449
|
+
})
|
|
3450
|
+
] })
|
|
3451
|
+
}),
|
|
3452
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3453
|
+
className: dialogFooter,
|
|
3454
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
3455
|
+
type: "button",
|
|
3456
|
+
onClick: () => {
|
|
3457
|
+
siteMetadataStore.imageUrl.set("https://www.walrus.xyz/walrus-site");
|
|
3458
|
+
onClose();
|
|
3459
|
+
},
|
|
3460
|
+
style: {
|
|
3461
|
+
fontSize: "0.875rem",
|
|
3462
|
+
fontWeight: 500,
|
|
3463
|
+
color: "var(--muted-foreground)",
|
|
3464
|
+
cursor: "pointer",
|
|
3465
|
+
border: "none",
|
|
3466
|
+
background: "transparent",
|
|
3467
|
+
transition: "color 0.2s"
|
|
3468
|
+
},
|
|
3469
|
+
onMouseEnter: (e) => {
|
|
3470
|
+
e.currentTarget.style.color = "var(--foreground)";
|
|
3471
|
+
},
|
|
3472
|
+
onMouseLeave: (e) => {
|
|
3473
|
+
e.currentTarget.style.color = "var(--muted-foreground)";
|
|
3474
|
+
},
|
|
3475
|
+
children: "Reset to default"
|
|
3476
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3477
|
+
style: {
|
|
3478
|
+
display: "flex",
|
|
3479
|
+
gap: "0.75rem"
|
|
3480
|
+
},
|
|
3481
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
3482
|
+
onClick: handleCancel,
|
|
3483
|
+
variant: "outline",
|
|
3484
|
+
children: "Close"
|
|
3485
|
+
}), /* @__PURE__ */ jsx(Dialog.Close, {
|
|
3486
|
+
asChild: true,
|
|
3487
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
3488
|
+
disabled: !isDirty || isLoading,
|
|
3489
|
+
children: isLoading ? "Saving..." : "Save Changes"
|
|
3490
|
+
})
|
|
3491
|
+
})]
|
|
3492
|
+
})]
|
|
3493
|
+
})
|
|
3494
|
+
]
|
|
3495
|
+
})] })
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
var PublishModal_default = PublishModal;
|
|
3499
|
+
|
|
3500
|
+
//#endregion
|
|
3501
|
+
//#region src/components/suins-modal/DomainCardSvg.tsx
|
|
3502
|
+
const CardBackground = () => {
|
|
3503
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("g", {
|
|
3504
|
+
clipPath: "url(#clip0_2_8065)",
|
|
3505
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
3506
|
+
width: "440",
|
|
3507
|
+
height: "440",
|
|
3508
|
+
rx: "24.6939",
|
|
3509
|
+
fill: "#221C36"
|
|
3510
|
+
}), /* @__PURE__ */ jsx("g", {
|
|
3511
|
+
clipPath: "url(#clip1_2_8065)",
|
|
3512
|
+
children: /* @__PURE__ */ jsxs("g", {
|
|
3513
|
+
style: { mixBlendMode: "plus-lighter" },
|
|
3514
|
+
children: [/* @__PURE__ */ jsx("mask", {
|
|
3515
|
+
id: "mask0_2_8065",
|
|
3516
|
+
style: { maskType: "alpha" },
|
|
3517
|
+
maskUnits: "userSpaceOnUse",
|
|
3518
|
+
x: "-371",
|
|
3519
|
+
y: "-402",
|
|
3520
|
+
width: "1183",
|
|
3521
|
+
height: "685",
|
|
3522
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
3523
|
+
x: "-370.026",
|
|
3524
|
+
y: "-401.408",
|
|
3525
|
+
width: "1181.24",
|
|
3526
|
+
height: "684.133",
|
|
3527
|
+
fill: "url(#paint0_linear_2_8065)"
|
|
3528
|
+
})
|
|
3529
|
+
}), /* @__PURE__ */ jsxs("g", {
|
|
3530
|
+
mask: "url(#mask0_2_8065)",
|
|
3531
|
+
children: [/* @__PURE__ */ jsxs("g", {
|
|
3532
|
+
opacity: "0.3",
|
|
3533
|
+
children: [
|
|
3534
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3535
|
+
clipPath: "url(#clip2_2_8065)",
|
|
3536
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3537
|
+
d: "M55.6533 284.621C54.582 285.692 54.5918 287.425 55.6562 288.489L99.9621 332.795C106.892 339.724 106.906 350.929 100.015 357.821C93.1228 364.712 81.9185 364.697 74.989 357.768L30.6831 313.462C15.7599 298.539 15.7201 274.398 30.5751 259.543C45.4302 244.688 69.5712 244.727 84.4945 259.651L114.326 289.482C115.39 290.546 117.123 290.556 118.194 289.485C119.265 288.414 119.255 286.681 118.191 285.617L73.8851 241.311C66.9557 234.381 66.9408 223.177 73.8326 216.285C80.7244 209.393 91.9287 209.408 98.8582 216.338L143.164 260.644C158.087 275.567 158.127 299.708 143.272 314.563C128.417 329.418 104.276 329.378 89.3527 314.455L59.5214 284.624C58.4571 283.559 56.7247 283.55 55.6533 284.621Z",
|
|
3538
|
+
stroke: "url(#paint1_linear_2_8065)",
|
|
3539
|
+
strokeWidth: "3.36735",
|
|
3540
|
+
strokeMiterlimit: "10",
|
|
3541
|
+
strokeLinecap: "round"
|
|
3542
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3543
|
+
d: "M142.429 198.7C141.359 199.77 141.361 201.504 142.429 202.572C143.497 203.64 145.231 203.642 146.301 202.573L176.132 172.741C191.05 157.823 215.251 157.833 230.185 172.767C245.119 187.7 245.128 211.901 230.21 226.819L185.904 271.125C178.98 278.049 167.747 278.046 160.814 271.113C153.881 264.18 153.877 252.946 160.801 246.022L205.107 201.716C206.177 200.647 206.175 198.913 205.107 197.845C204.039 196.777 202.305 196.774 201.235 197.844L171.404 227.675C156.486 242.593 132.285 242.584 117.351 227.65C102.417 212.716 102.408 188.516 117.326 173.598L161.632 129.292C168.556 122.368 179.789 122.371 186.722 129.304C193.655 136.237 193.659 147.47 186.735 154.395L142.429 198.7Z",
|
|
3544
|
+
stroke: "url(#paint2_linear_2_8065)",
|
|
3545
|
+
strokeWidth: "3.36735",
|
|
3546
|
+
strokeMiterlimit: "10",
|
|
3547
|
+
strokeLinecap: "round"
|
|
3548
|
+
})]
|
|
3549
|
+
}),
|
|
3550
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3551
|
+
clipPath: "url(#clip3_2_8065)",
|
|
3552
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3553
|
+
d: "M230.049 110.225C228.978 111.297 228.988 113.029 230.052 114.094L274.358 158.399C281.288 165.329 281.303 176.533 274.411 183.425C267.519 190.317 256.315 190.302 249.385 183.373L205.079 139.067C190.156 124.143 190.116 100.002 204.971 85.1473C219.826 70.2923 243.967 70.332 258.891 85.2553L288.722 115.087C289.786 116.151 291.519 116.161 292.59 115.089C293.661 114.018 293.651 112.286 292.587 111.221L248.281 66.9155C241.352 59.986 241.337 48.7817 248.229 41.8899C255.121 34.998 266.325 35.013 273.254 41.9424L317.56 86.2483C332.483 101.172 332.523 125.313 317.668 140.168C302.813 155.023 278.672 154.983 263.749 140.06L233.918 110.228C232.853 109.164 231.121 109.154 230.049 110.225Z",
|
|
3554
|
+
stroke: "url(#paint3_linear_2_8065)",
|
|
3555
|
+
strokeWidth: "3.36735",
|
|
3556
|
+
strokeMiterlimit: "10",
|
|
3557
|
+
strokeLinecap: "round"
|
|
3558
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3559
|
+
d: "M316.825 24.3051C315.755 25.3747 315.757 27.1086 316.825 28.1767C317.893 29.2447 319.627 29.247 320.697 28.1773L350.528 -1.65402C365.446 -16.572 389.647 -16.5627 404.581 -1.62882C419.515 13.305 419.524 37.5057 404.606 52.4236L360.3 96.7295C353.376 103.654 342.143 103.65 335.21 96.7173C328.277 89.7844 328.273 78.551 335.197 71.6268L379.503 27.3209C380.573 26.2513 380.571 24.5174 379.503 23.4494C378.435 22.3813 376.701 22.3791 375.631 23.4487L345.8 53.28C330.882 68.198 306.681 68.1887 291.747 53.2548C276.813 38.321 276.804 14.1203 291.722 -0.797645L336.028 -45.1035C342.952 -52.0277 354.186 -52.0242 361.118 -45.0913C368.051 -38.1583 368.055 -26.925 361.131 -20.0008L316.825 24.3051Z",
|
|
3560
|
+
stroke: "url(#paint4_linear_2_8065)",
|
|
3561
|
+
strokeWidth: "3.36735",
|
|
3562
|
+
strokeMiterlimit: "10",
|
|
3563
|
+
strokeLinecap: "round"
|
|
3564
|
+
})]
|
|
3565
|
+
}),
|
|
3566
|
+
/* @__PURE__ */ jsx("g", {
|
|
3567
|
+
clipPath: "url(#clip4_2_8065)",
|
|
3568
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3569
|
+
d: "M404.445 -64.1706C403.374 -63.0993 403.384 -61.3669 404.448 -60.3026L448.754 -15.9967C455.684 -9.06721 455.699 2.13713 448.807 9.02895C441.915 15.9208 430.711 15.9059 423.781 8.9764L379.475 -35.3295C364.552 -50.2527 364.512 -74.3938 379.367 -89.2488C394.222 -104.104 418.363 -104.064 433.287 -89.1409L463.118 -59.3095C464.182 -58.2452 465.915 -58.2353 466.986 -59.3067C468.057 -60.378 468.048 -62.1104 466.983 -63.1747L422.677 -107.481C415.748 -114.41 415.733 -125.614 422.625 -132.506C429.517 -139.398 440.721 -139.383 447.65 -132.454L491.956 -88.1478C506.879 -73.2246 506.919 -49.0835 492.064 -34.2285C477.209 -19.3735 453.068 -19.4132 438.145 -34.3365L408.314 -64.1678C407.249 -65.2321 405.517 -65.242 404.445 -64.1706Z",
|
|
3570
|
+
stroke: "url(#paint5_linear_2_8065)",
|
|
3571
|
+
strokeWidth: "3.36735",
|
|
3572
|
+
strokeMiterlimit: "10",
|
|
3573
|
+
strokeLinecap: "round"
|
|
3574
|
+
})
|
|
3575
|
+
}),
|
|
3576
|
+
/* @__PURE__ */ jsx("g", {
|
|
3577
|
+
clipPath: "url(#clip5_2_8065)",
|
|
3578
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3579
|
+
d: "M230.586 286.856C229.516 287.926 229.518 289.66 230.586 290.728C231.654 291.796 233.388 291.798 234.458 290.729L264.289 260.897C279.207 245.979 303.408 245.989 318.342 260.923C333.276 275.856 333.285 300.057 318.367 314.975L274.061 359.281C267.137 366.205 255.903 366.202 248.971 359.269C242.038 352.336 242.034 341.102 248.958 334.178L293.264 289.872C294.334 288.803 294.332 287.069 293.263 286.001C292.195 284.933 290.462 284.93 289.392 286L259.561 315.831C244.643 330.749 220.442 330.74 205.508 315.806C190.574 300.872 190.565 276.672 205.483 261.754L249.789 217.448C256.713 210.524 267.946 210.527 274.879 217.46C281.812 224.393 281.816 235.626 274.892 242.551L230.586 286.856Z",
|
|
3580
|
+
stroke: "url(#paint6_linear_2_8065)",
|
|
3581
|
+
strokeWidth: "3.36735",
|
|
3582
|
+
strokeMiterlimit: "10",
|
|
3583
|
+
strokeLinecap: "round"
|
|
3584
|
+
})
|
|
3585
|
+
}),
|
|
3586
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3587
|
+
clipPath: "url(#clip6_2_8065)",
|
|
3588
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3589
|
+
d: "M318.205 198.382C317.133 199.453 317.143 201.186 318.208 202.25L362.513 246.556C369.443 253.485 369.458 264.69 362.566 271.581C355.674 278.473 344.47 278.458 337.54 271.529L293.234 227.223C278.311 212.3 278.271 188.159 293.126 173.304C307.981 158.449 332.123 158.488 347.046 173.412L376.877 203.243C377.941 204.307 379.674 204.317 380.745 203.246C381.817 202.174 381.807 200.442 380.742 199.378L336.436 155.072C329.507 148.142 329.492 136.938 336.384 130.046C343.276 123.154 354.48 123.169 361.41 130.099L405.715 174.405C420.639 189.328 420.678 213.469 405.823 228.324C390.968 243.179 366.827 243.139 351.904 228.216L322.073 198.385C321.008 197.32 319.276 197.31 318.205 198.382Z",
|
|
3590
|
+
stroke: "url(#paint7_linear_2_8065)",
|
|
3591
|
+
strokeWidth: "3.36735",
|
|
3592
|
+
strokeMiterlimit: "10",
|
|
3593
|
+
strokeLinecap: "round"
|
|
3594
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3595
|
+
d: "M404.98 112.461C403.91 113.531 403.913 115.265 404.981 116.333C406.049 117.401 407.783 117.403 408.852 116.334L438.684 86.5023C453.602 71.5843 477.802 71.5936 492.736 86.5275C507.67 101.461 507.679 125.662 492.761 140.58L448.455 184.886C441.531 191.81 430.298 191.807 423.365 184.874C416.432 177.941 416.428 166.707 423.353 159.783L467.659 115.477C468.728 114.408 468.726 112.674 467.658 111.606C466.59 110.538 464.856 110.535 463.786 111.605L433.955 141.436C419.037 156.354 394.836 156.345 379.902 141.411C364.969 126.477 364.959 102.277 379.877 87.3587L424.183 43.0528C431.107 36.1286 442.341 36.1321 449.274 43.065C456.207 49.998 456.21 61.2313 449.286 68.1555L404.98 112.461Z",
|
|
3596
|
+
stroke: "url(#paint8_linear_2_8065)",
|
|
3597
|
+
strokeWidth: "3.36735",
|
|
3598
|
+
strokeMiterlimit: "10",
|
|
3599
|
+
strokeLinecap: "round"
|
|
3600
|
+
})]
|
|
3601
|
+
}),
|
|
3602
|
+
/* @__PURE__ */ jsx("g", {
|
|
3603
|
+
clipPath: "url(#clip7_2_8065)",
|
|
3604
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3605
|
+
d: "M492.601 23.9857C491.529 25.0571 491.539 26.7895 492.604 27.8538L536.91 72.1597C543.839 79.0892 543.854 90.2935 536.962 97.1853C530.07 104.077 518.866 104.062 511.936 97.1328L467.631 52.8269C452.707 37.9036 452.668 13.7626 467.523 -1.09245C482.378 -15.9475 506.519 -15.9077 521.442 -0.984478L551.273 28.8469C552.338 29.9112 554.07 29.9211 555.141 28.8497C556.213 27.7783 556.203 26.046 555.138 24.9816L510.833 -19.3243C503.903 -26.2537 503.888 -37.4581 510.78 -44.3499C517.672 -51.2417 528.876 -51.2268 535.806 -44.2973L580.112 0.00856119C595.035 14.9318 595.075 39.0729 580.22 53.9279C565.364 68.7829 541.223 68.7432 526.3 53.8199L496.469 23.9886C495.405 22.9242 493.672 22.9144 492.601 23.9857Z",
|
|
3606
|
+
stroke: "url(#paint9_linear_2_8065)",
|
|
3607
|
+
strokeWidth: "3.36735",
|
|
3608
|
+
strokeMiterlimit: "10",
|
|
3609
|
+
strokeLinecap: "round"
|
|
3610
|
+
})
|
|
3611
|
+
}),
|
|
3612
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3613
|
+
clipPath: "url(#clip8_2_8065)",
|
|
3614
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3615
|
+
d: "M406.362 286.537C405.29 287.608 405.3 289.34 406.365 290.405L450.67 334.71C457.6 341.64 457.615 352.844 450.723 359.736C443.831 366.628 432.627 366.613 425.697 359.684L381.392 315.378C366.468 300.454 366.429 276.313 381.284 261.458C396.139 246.603 420.28 246.643 435.203 261.566L465.034 291.398C466.099 292.462 467.831 292.472 468.902 291.4C469.974 290.329 469.964 288.597 468.899 287.532L424.594 243.227C417.664 236.297 417.649 225.093 424.541 218.201C431.433 211.309 442.637 211.324 449.567 218.253L493.872 262.559C508.796 277.483 508.835 301.624 493.98 316.479C479.125 331.334 454.984 331.294 440.061 316.371L410.23 286.539C409.165 285.475 407.433 285.465 406.362 286.537Z",
|
|
3616
|
+
stroke: "url(#paint10_linear_2_8065)",
|
|
3617
|
+
strokeWidth: "3.36735",
|
|
3618
|
+
strokeMiterlimit: "10",
|
|
3619
|
+
strokeLinecap: "round"
|
|
3620
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3621
|
+
d: "M493.137 200.616C492.067 201.686 492.07 203.42 493.138 204.488C494.206 205.556 495.94 205.558 497.009 204.488L526.841 174.657C541.759 159.739 565.959 159.748 580.893 174.682C595.827 189.616 595.836 213.817 580.918 228.735L536.612 273.041C529.688 279.965 518.455 279.961 511.522 273.028C504.589 266.095 504.586 254.862 511.51 247.938L555.816 203.632C556.885 202.562 556.883 200.828 555.815 199.76C554.747 198.692 553.013 198.69 551.943 199.76L522.112 229.591C507.194 244.509 482.993 244.5 468.06 229.566C453.126 214.632 453.116 190.431 468.034 175.513L512.34 131.207C519.264 124.283 530.498 124.287 537.431 131.22C544.364 138.153 544.367 149.386 537.443 156.31L493.137 200.616Z",
|
|
3622
|
+
stroke: "url(#paint11_linear_2_8065)",
|
|
3623
|
+
strokeWidth: "3.36735",
|
|
3624
|
+
strokeMiterlimit: "10",
|
|
3625
|
+
strokeLinecap: "round"
|
|
3626
|
+
})]
|
|
3627
|
+
})
|
|
3628
|
+
]
|
|
3629
|
+
}), /* @__PURE__ */ jsxs("g", {
|
|
3630
|
+
opacity: "0.3",
|
|
3631
|
+
children: [
|
|
3632
|
+
/* @__PURE__ */ jsx("g", {
|
|
3633
|
+
clipPath: "url(#clip9_2_8065)",
|
|
3634
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3635
|
+
d: "M-33.3645 22.9074C-34.4342 23.977 -34.4319 25.7109 -33.3638 26.7789C-32.2958 27.847 -30.5619 27.8493 -29.4923 26.7796L0.339089 -3.05172C15.257 -17.9697 39.4577 -17.9604 54.3916 -3.02652C69.3254 11.9073 69.3347 36.108 54.4168 51.0259L10.1109 95.3318C3.18672 102.256 -8.04665 102.252 -14.9796 95.3196C-21.9125 88.3866 -21.916 77.1533 -14.9918 70.2291L29.3141 25.9232C30.3837 24.8536 30.3814 23.1197 29.3134 22.0517C28.2454 20.9836 26.5114 20.9814 25.4418 22.051L-4.38954 51.8823C-19.3075 66.8003 -43.5082 66.791 -58.442 51.8571C-73.3759 36.9233 -73.3852 12.7226 -58.4672 -2.19535L-14.1613 -46.5012C-7.23718 -53.4254 3.99619 -53.4219 10.9291 -46.489C17.862 -39.556 17.8655 -28.3227 10.9414 -21.3985L-33.3645 22.9074Z",
|
|
3636
|
+
stroke: "url(#paint12_linear_2_8065)",
|
|
3637
|
+
strokeWidth: "3.36735",
|
|
3638
|
+
strokeMiterlimit: "10",
|
|
3639
|
+
strokeLinecap: "round"
|
|
3640
|
+
})
|
|
3641
|
+
}),
|
|
3642
|
+
/* @__PURE__ */ jsx("g", {
|
|
3643
|
+
clipPath: "url(#clip10_2_8065)",
|
|
3644
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
3645
|
+
d: "M54.2562 -65.5677C53.1849 -64.4964 53.1947 -62.764 54.2591 -61.6997L98.565 -17.3938C105.494 -10.4643 105.509 0.740023 98.6175 7.63184C91.7257 14.5237 80.5214 14.5088 73.5919 7.57929L29.286 -36.7266C14.3628 -51.6498 14.323 -75.7909 29.1781 -90.6459C44.0331 -105.501 68.1741 -105.461 83.0974 -90.5379L112.929 -60.7066C113.993 -59.6423 115.725 -59.6324 116.797 -60.7038C117.868 -61.7751 117.858 -63.5075 116.794 -64.5718L72.488 -108.878C65.5586 -115.807 65.5437 -127.012 72.4355 -133.903C79.3273 -140.795 90.5317 -140.78 97.4611 -133.851L141.767 -89.5449C156.69 -74.6217 156.73 -50.4806 141.875 -35.6256C127.02 -20.7706 102.879 -20.8103 87.9556 -35.7336L58.1243 -65.5649C57.06 -66.6292 55.3276 -66.6391 54.2562 -65.5677Z",
|
|
3646
|
+
stroke: "url(#paint13_linear_2_8065)",
|
|
3647
|
+
strokeWidth: "3.36735",
|
|
3648
|
+
strokeMiterlimit: "10",
|
|
3649
|
+
strokeLinecap: "round"
|
|
3650
|
+
})
|
|
3651
|
+
}),
|
|
3652
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3653
|
+
clipPath: "url(#clip11_2_8065)",
|
|
3654
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3655
|
+
d: "M-31.983 196.985C-33.0543 198.056 -33.0445 199.788 -31.9801 200.853L12.3258 245.159C19.2552 252.088 19.2701 263.292 12.3783 270.184C5.4865 277.076 -5.71784 277.061 -12.6473 270.132L-56.9532 225.826C-71.8764 210.902 -71.9162 186.761 -57.0611 171.906C-42.2061 157.051 -18.0651 157.091 -3.14183 172.014L26.6895 201.846C27.7538 202.91 29.4862 202.92 30.5576 201.849C31.629 200.777 31.6191 199.045 30.5547 197.98L-13.7512 153.675C-20.6806 146.745 -20.6955 135.541 -13.8037 128.649C-6.91189 121.757 4.29245 121.772 11.2219 128.702L55.5278 173.007C70.451 187.931 70.4908 212.072 55.6358 226.927C40.7807 241.782 16.6397 241.742 1.71644 226.819L-28.1149 196.987C-29.1792 195.923 -30.9116 195.913 -31.983 196.985Z",
|
|
3656
|
+
stroke: "url(#paint14_linear_2_8065)",
|
|
3657
|
+
strokeWidth: "3.36735",
|
|
3658
|
+
strokeMiterlimit: "10",
|
|
3659
|
+
strokeLinecap: "round"
|
|
3660
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3661
|
+
d: "M54.7925 111.064C53.7228 112.134 53.7251 113.868 54.7931 114.936C55.8611 116.004 57.5951 116.006 58.6647 114.936L88.4961 85.1051C103.414 70.1871 127.615 70.1964 142.549 85.1303C157.482 100.064 157.492 124.265 142.574 139.183L98.2678 183.489C91.3437 190.413 80.1103 190.409 73.1774 183.476C66.2445 176.543 66.241 165.31 73.1651 158.386L117.471 114.08C118.541 113.01 118.538 111.276 117.47 110.208C116.402 109.14 114.668 109.138 113.599 110.208L83.7674 140.039C68.8495 154.957 44.6488 154.948 29.715 140.014C14.7811 125.08 14.7718 100.879 29.6898 85.9614L73.9956 41.6556C80.9198 34.7314 92.1532 34.7349 99.0861 41.6678C106.019 48.6008 106.023 59.8341 99.0984 66.7583L54.7925 111.064Z",
|
|
3662
|
+
stroke: "url(#paint15_linear_2_8065)",
|
|
3663
|
+
strokeWidth: "3.36735",
|
|
3664
|
+
strokeMiterlimit: "10",
|
|
3665
|
+
strokeLinecap: "round"
|
|
3666
|
+
})]
|
|
3667
|
+
}),
|
|
3668
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3669
|
+
clipPath: "url(#clip12_2_8065)",
|
|
3670
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3671
|
+
d: "M142.413 22.5881C141.342 23.6595 141.352 25.3918 142.416 26.4562L186.722 70.762C193.651 77.6915 193.666 88.8958 186.774 95.7877C179.883 102.679 168.678 102.665 161.749 95.7351L117.443 51.4292C102.52 36.506 102.48 12.3649 117.335 -2.49009C132.19 -17.3451 156.331 -17.3054 171.254 -2.38212L201.086 27.4492C202.15 28.5135 203.882 28.5234 204.954 27.4521C206.025 26.3807 206.015 24.6483 204.951 23.584L160.645 -20.7219C153.715 -27.6514 153.701 -38.8557 160.592 -45.7475C167.484 -52.6393 178.689 -52.6244 185.618 -45.695L229.924 -1.38908C244.847 13.5342 244.887 37.6752 230.032 52.5302C215.177 67.3853 191.036 67.3455 176.113 52.4223L146.281 22.5909C145.217 21.5266 143.484 21.5167 142.413 22.5881Z",
|
|
3672
|
+
stroke: "url(#paint16_linear_2_8065)",
|
|
3673
|
+
strokeWidth: "3.36735",
|
|
3674
|
+
strokeMiterlimit: "10",
|
|
3675
|
+
strokeLinecap: "round"
|
|
3676
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3677
|
+
d: "M229.189 -63.3323C228.119 -62.2627 228.121 -60.5287 229.189 -59.4607C230.257 -58.3927 231.991 -58.3904 233.061 -59.4601L262.892 -89.2914C277.81 -104.209 302.011 -104.2 316.945 -89.2662C331.878 -74.3323 331.888 -50.1317 316.97 -35.2137L272.664 9.09215C265.74 16.0163 254.506 16.0128 247.573 9.07988C240.641 2.14696 240.637 -9.08641 247.561 -16.0106L291.867 -60.3164C292.937 -61.3861 292.934 -63.12 291.866 -64.188C290.798 -65.2561 289.064 -65.2583 287.995 -64.1887L258.163 -34.3574C243.246 -19.4394 219.045 -19.4487 204.111 -34.3826C189.177 -49.3164 189.168 -73.5171 204.086 -88.435L248.392 -132.741C255.316 -139.665 266.549 -139.662 273.482 -132.729C280.415 -125.796 280.419 -114.562 273.494 -107.638L229.189 -63.3323Z",
|
|
3678
|
+
stroke: "url(#paint17_linear_2_8065)",
|
|
3679
|
+
strokeWidth: "3.36735",
|
|
3680
|
+
strokeMiterlimit: "10",
|
|
3681
|
+
strokeLinecap: "round"
|
|
3682
|
+
})]
|
|
3683
|
+
})
|
|
3684
|
+
]
|
|
3685
|
+
})]
|
|
3686
|
+
})]
|
|
3687
|
+
})
|
|
3688
|
+
})]
|
|
3689
|
+
}), /* @__PURE__ */ jsx("rect", {
|
|
3690
|
+
x: "1.12245",
|
|
3691
|
+
y: "1.12245",
|
|
3692
|
+
width: "437.755",
|
|
3693
|
+
height: "437.755",
|
|
3694
|
+
rx: "23.5714",
|
|
3695
|
+
stroke: "url(#paint18_linear_2_8065)",
|
|
3696
|
+
strokeWidth: "2.2449"
|
|
3697
|
+
})] });
|
|
3698
|
+
};
|
|
3699
|
+
const SuiNSLogo = () => {
|
|
3700
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3701
|
+
/* @__PURE__ */ jsxs("g", {
|
|
3702
|
+
clipPath: "url(#clip13_2_8065)",
|
|
3703
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3704
|
+
fillRule: "evenodd",
|
|
3705
|
+
clipRule: "evenodd",
|
|
3706
|
+
d: "M330.479 342.088C330.237 342.088 330.041 342.285 330.041 342.527V368.61C330.041 373.074 326.429 376.692 321.974 376.692C317.518 376.692 313.906 373.074 313.906 368.61V342.527C313.906 333.357 321.326 325.923 330.479 325.923C339.632 325.923 347.052 333.357 347.052 342.527V360.088C347.052 360.331 347.248 360.527 347.49 360.527C347.731 360.527 347.927 360.331 347.927 360.088V334.006C347.927 329.542 351.539 325.923 355.995 325.923C360.45 325.923 364.062 329.542 364.062 334.006V360.088C364.062 369.258 356.642 376.692 347.49 376.692C338.337 376.692 330.917 369.258 330.917 360.088V342.527C330.917 342.285 330.721 342.088 330.479 342.088Z",
|
|
3707
|
+
fill: "#DAD0FF"
|
|
3708
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3709
|
+
fillRule: "evenodd",
|
|
3710
|
+
clipRule: "evenodd",
|
|
3711
|
+
d: "M381.32 342.348C381.079 342.348 380.883 342.544 380.883 342.786C380.883 343.028 381.079 343.225 381.32 343.225H398.849C408.002 343.225 415.422 350.659 415.422 359.828C415.422 368.998 408.002 376.432 398.849 376.432H372.815C368.359 376.432 364.747 372.813 364.747 368.35C364.747 363.886 368.359 360.267 372.815 360.267H398.849C399.091 360.267 399.287 360.07 399.287 359.828C399.287 359.586 399.091 359.39 398.849 359.39H381.32C372.168 359.39 364.747 351.956 364.747 342.786C364.747 333.616 372.168 326.182 381.32 326.182H407.355C411.81 326.182 415.422 329.801 415.422 334.265C415.422 338.729 411.81 342.348 407.355 342.348H381.32Z",
|
|
3712
|
+
fill: "#DAD0FF"
|
|
3713
|
+
})]
|
|
3714
|
+
}),
|
|
3715
|
+
/* @__PURE__ */ jsx("rect", {
|
|
3716
|
+
x: "287.089",
|
|
3717
|
+
y: "351.359",
|
|
3718
|
+
width: "25.156",
|
|
3719
|
+
height: "25.1977",
|
|
3720
|
+
rx: "12.578",
|
|
3721
|
+
fill: "#DAD0FF"
|
|
3722
|
+
}),
|
|
3723
|
+
/* @__PURE__ */ jsx("path", {
|
|
3724
|
+
fillRule: "evenodd",
|
|
3725
|
+
clipRule: "evenodd",
|
|
3726
|
+
d: "M303.198 362.795V362.796C303.812 363.575 304.178 364.563 304.178 365.637C304.178 366.711 303.801 367.728 303.171 368.513L303.116 368.58L303.102 368.494C303.09 368.421 303.075 368.347 303.059 368.273C302.744 366.869 301.716 365.665 300.025 364.69C298.883 364.034 298.229 363.243 298.058 362.345C297.947 361.764 298.029 361.181 298.189 360.681C298.348 360.182 298.585 359.763 298.786 359.511L299.444 358.696C299.559 358.553 299.775 358.553 299.89 358.696L303.199 362.795L303.198 362.795ZM304.239 361.981V361.98L299.83 356.517C299.746 356.413 299.588 356.413 299.504 356.517L295.095 361.981V361.981L295.08 361.999C294.269 363.019 293.784 364.316 293.784 365.727C293.784 369.014 296.418 371.679 299.667 371.679C302.916 371.679 305.55 369.014 305.55 365.727C305.55 364.316 305.065 363.019 304.253 361.999L304.239 361.981H304.239ZM296.15 362.777L296.544 362.289L296.556 362.379C296.566 362.45 296.577 362.522 296.591 362.594C296.846 363.951 297.757 365.082 299.281 365.959C300.606 366.722 301.377 367.601 301.6 368.565C301.692 368.967 301.709 369.363 301.669 369.708L301.666 369.73L301.647 369.739C301.049 370.035 300.377 370.202 299.667 370.202C297.175 370.202 295.155 368.158 295.155 365.637C295.155 364.555 295.527 363.56 296.15 362.778L296.15 362.777Z",
|
|
3727
|
+
fill: "#221C36"
|
|
3728
|
+
})
|
|
3729
|
+
] });
|
|
3730
|
+
};
|
|
3731
|
+
const DomainCardSvg = ({ className }) => {
|
|
3732
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
3733
|
+
viewBox: "0 0 440 440",
|
|
3734
|
+
fill: "none",
|
|
3735
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3736
|
+
role: "img",
|
|
3737
|
+
"aria-label": "Domain card background",
|
|
3738
|
+
className,
|
|
3739
|
+
children: [
|
|
3740
|
+
/* @__PURE__ */ jsx(CardBackground, {}),
|
|
3741
|
+
/* @__PURE__ */ jsx(SuiNSLogo, {}),
|
|
3742
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
3743
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3744
|
+
id: "gradient",
|
|
3745
|
+
x1: "0%",
|
|
3746
|
+
y1: "0%",
|
|
3747
|
+
x2: "100%",
|
|
3748
|
+
y2: "0%",
|
|
3749
|
+
children: [
|
|
3750
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3751
|
+
offset: "0%",
|
|
3752
|
+
stopColor: "#4bffa6"
|
|
3753
|
+
}),
|
|
3754
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3755
|
+
offset: "56%",
|
|
3756
|
+
stopColor: "#ff794b"
|
|
3757
|
+
}),
|
|
3758
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3759
|
+
offset: "100%",
|
|
3760
|
+
stopColor: "#d962ff"
|
|
3761
|
+
})
|
|
3762
|
+
]
|
|
3763
|
+
}),
|
|
3764
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3765
|
+
id: "paint0_linear_2_8065",
|
|
3766
|
+
x1: "220.592",
|
|
3767
|
+
y1: "-52.8804",
|
|
3768
|
+
x2: "220.592",
|
|
3769
|
+
y2: "282.725",
|
|
3770
|
+
gradientUnits: "userSpaceOnUse",
|
|
3771
|
+
children: [/* @__PURE__ */ jsx("stop", { stopColor: "white" }), /* @__PURE__ */ jsx("stop", {
|
|
3772
|
+
offset: "1",
|
|
3773
|
+
stopColor: "white",
|
|
3774
|
+
stopOpacity: "0"
|
|
3775
|
+
})]
|
|
3776
|
+
}),
|
|
3777
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3778
|
+
id: "paint1_linear_2_8065",
|
|
3779
|
+
x1: "13.27",
|
|
3780
|
+
y1: "274.467",
|
|
3781
|
+
x2: "134.549",
|
|
3782
|
+
y2: "215.647",
|
|
3783
|
+
gradientUnits: "userSpaceOnUse",
|
|
3784
|
+
children: [
|
|
3785
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3786
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3787
|
+
offset: "0.345634",
|
|
3788
|
+
stopColor: "#EB8865"
|
|
3789
|
+
}),
|
|
3790
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3791
|
+
offset: "0.554579",
|
|
3792
|
+
stopColor: "#D34BFF"
|
|
3793
|
+
}),
|
|
3794
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3795
|
+
offset: "1",
|
|
3796
|
+
stopColor: "#4CA2FF"
|
|
3797
|
+
})
|
|
3798
|
+
]
|
|
3799
|
+
}),
|
|
3800
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3801
|
+
id: "paint2_linear_2_8065",
|
|
3802
|
+
x1: "100.083",
|
|
3803
|
+
y1: "188.459",
|
|
3804
|
+
x2: "223.203",
|
|
3805
|
+
y2: "129.859",
|
|
3806
|
+
gradientUnits: "userSpaceOnUse",
|
|
3807
|
+
children: [
|
|
3808
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3809
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3810
|
+
offset: "0.345634",
|
|
3811
|
+
stopColor: "#EB8865"
|
|
3812
|
+
}),
|
|
3813
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3814
|
+
offset: "0.554579",
|
|
3815
|
+
stopColor: "#D34BFF"
|
|
3816
|
+
}),
|
|
3817
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3818
|
+
offset: "1",
|
|
3819
|
+
stopColor: "#4CA2FF"
|
|
3820
|
+
})
|
|
3821
|
+
]
|
|
3822
|
+
}),
|
|
3823
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3824
|
+
id: "paint3_linear_2_8065",
|
|
3825
|
+
x1: "187.666",
|
|
3826
|
+
y1: "100.071",
|
|
3827
|
+
x2: "308.945",
|
|
3828
|
+
y2: "41.2512",
|
|
3829
|
+
gradientUnits: "userSpaceOnUse",
|
|
3830
|
+
children: [
|
|
3831
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3832
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3833
|
+
offset: "0.345634",
|
|
3834
|
+
stopColor: "#EB8865"
|
|
3835
|
+
}),
|
|
3836
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3837
|
+
offset: "0.554579",
|
|
3838
|
+
stopColor: "#D34BFF"
|
|
3839
|
+
}),
|
|
3840
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3841
|
+
offset: "1",
|
|
3842
|
+
stopColor: "#4CA2FF"
|
|
3843
|
+
})
|
|
3844
|
+
]
|
|
3845
|
+
}),
|
|
3846
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3847
|
+
id: "paint4_linear_2_8065",
|
|
3848
|
+
x1: "274.479",
|
|
3849
|
+
y1: "14.064",
|
|
3850
|
+
x2: "397.599",
|
|
3851
|
+
y2: "-44.5362",
|
|
3852
|
+
gradientUnits: "userSpaceOnUse",
|
|
3853
|
+
children: [
|
|
3854
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3855
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3856
|
+
offset: "0.345634",
|
|
3857
|
+
stopColor: "#EB8865"
|
|
3858
|
+
}),
|
|
3859
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3860
|
+
offset: "0.554579",
|
|
3861
|
+
stopColor: "#D34BFF"
|
|
3862
|
+
}),
|
|
3863
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3864
|
+
offset: "1",
|
|
3865
|
+
stopColor: "#4CA2FF"
|
|
3866
|
+
})
|
|
3867
|
+
]
|
|
3868
|
+
}),
|
|
3869
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3870
|
+
id: "paint5_linear_2_8065",
|
|
3871
|
+
x1: "362.062",
|
|
3872
|
+
y1: "-74.3248",
|
|
3873
|
+
x2: "483.341",
|
|
3874
|
+
y2: "-133.145",
|
|
3875
|
+
gradientUnits: "userSpaceOnUse",
|
|
3876
|
+
children: [
|
|
3877
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3878
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3879
|
+
offset: "0.345634",
|
|
3880
|
+
stopColor: "#EB8865"
|
|
3881
|
+
}),
|
|
3882
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3883
|
+
offset: "0.554579",
|
|
3884
|
+
stopColor: "#D34BFF"
|
|
3885
|
+
}),
|
|
3886
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3887
|
+
offset: "1",
|
|
3888
|
+
stopColor: "#4CA2FF"
|
|
3889
|
+
})
|
|
3890
|
+
]
|
|
3891
|
+
}),
|
|
3892
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3893
|
+
id: "paint6_linear_2_8065",
|
|
3894
|
+
x1: "188.24",
|
|
3895
|
+
y1: "276.615",
|
|
3896
|
+
x2: "311.36",
|
|
3897
|
+
y2: "218.015",
|
|
3898
|
+
gradientUnits: "userSpaceOnUse",
|
|
3899
|
+
children: [
|
|
3900
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3901
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3902
|
+
offset: "0.345634",
|
|
3903
|
+
stopColor: "#EB8865"
|
|
3904
|
+
}),
|
|
3905
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3906
|
+
offset: "0.554579",
|
|
3907
|
+
stopColor: "#D34BFF"
|
|
3908
|
+
}),
|
|
3909
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3910
|
+
offset: "1",
|
|
3911
|
+
stopColor: "#4CA2FF"
|
|
3912
|
+
})
|
|
3913
|
+
]
|
|
3914
|
+
}),
|
|
3915
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3916
|
+
id: "paint7_linear_2_8065",
|
|
3917
|
+
x1: "275.821",
|
|
3918
|
+
y1: "188.228",
|
|
3919
|
+
x2: "397.1",
|
|
3920
|
+
y2: "129.408",
|
|
3921
|
+
gradientUnits: "userSpaceOnUse",
|
|
3922
|
+
children: [
|
|
3923
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3924
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3925
|
+
offset: "0.345634",
|
|
3926
|
+
stopColor: "#EB8865"
|
|
3927
|
+
}),
|
|
3928
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3929
|
+
offset: "0.554579",
|
|
3930
|
+
stopColor: "#D34BFF"
|
|
3931
|
+
}),
|
|
3932
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3933
|
+
offset: "1",
|
|
3934
|
+
stopColor: "#4CA2FF"
|
|
3935
|
+
})
|
|
3936
|
+
]
|
|
3937
|
+
}),
|
|
3938
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3939
|
+
id: "paint8_linear_2_8065",
|
|
3940
|
+
x1: "362.634",
|
|
3941
|
+
y1: "102.22",
|
|
3942
|
+
x2: "485.754",
|
|
3943
|
+
y2: "43.6201",
|
|
3944
|
+
gradientUnits: "userSpaceOnUse",
|
|
3945
|
+
children: [
|
|
3946
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3947
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3948
|
+
offset: "0.345634",
|
|
3949
|
+
stopColor: "#EB8865"
|
|
3950
|
+
}),
|
|
3951
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3952
|
+
offset: "0.554579",
|
|
3953
|
+
stopColor: "#D34BFF"
|
|
3954
|
+
}),
|
|
3955
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3956
|
+
offset: "1",
|
|
3957
|
+
stopColor: "#4CA2FF"
|
|
3958
|
+
})
|
|
3959
|
+
]
|
|
3960
|
+
}),
|
|
3961
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3962
|
+
id: "paint9_linear_2_8065",
|
|
3963
|
+
x1: "450.217",
|
|
3964
|
+
y1: "13.8316",
|
|
3965
|
+
x2: "571.496",
|
|
3966
|
+
y2: "-44.9885",
|
|
3967
|
+
gradientUnits: "userSpaceOnUse",
|
|
3968
|
+
children: [
|
|
3969
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3970
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3971
|
+
offset: "0.345634",
|
|
3972
|
+
stopColor: "#EB8865"
|
|
3973
|
+
}),
|
|
3974
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3975
|
+
offset: "0.554579",
|
|
3976
|
+
stopColor: "#D34BFF"
|
|
3977
|
+
}),
|
|
3978
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3979
|
+
offset: "1",
|
|
3980
|
+
stopColor: "#4CA2FF"
|
|
3981
|
+
})
|
|
3982
|
+
]
|
|
3983
|
+
}),
|
|
3984
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
3985
|
+
id: "paint10_linear_2_8065",
|
|
3986
|
+
x1: "363.978",
|
|
3987
|
+
y1: "276.382",
|
|
3988
|
+
x2: "485.257",
|
|
3989
|
+
y2: "217.562",
|
|
3990
|
+
gradientUnits: "userSpaceOnUse",
|
|
3991
|
+
children: [
|
|
3992
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
3993
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3994
|
+
offset: "0.345634",
|
|
3995
|
+
stopColor: "#EB8865"
|
|
3996
|
+
}),
|
|
3997
|
+
/* @__PURE__ */ jsx("stop", {
|
|
3998
|
+
offset: "0.554579",
|
|
3999
|
+
stopColor: "#D34BFF"
|
|
4000
|
+
}),
|
|
4001
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4002
|
+
offset: "1",
|
|
4003
|
+
stopColor: "#4CA2FF"
|
|
4004
|
+
})
|
|
4005
|
+
]
|
|
4006
|
+
}),
|
|
4007
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4008
|
+
id: "paint11_linear_2_8065",
|
|
4009
|
+
x1: "450.792",
|
|
4010
|
+
y1: "190.375",
|
|
4011
|
+
x2: "573.912",
|
|
4012
|
+
y2: "131.775",
|
|
4013
|
+
gradientUnits: "userSpaceOnUse",
|
|
4014
|
+
children: [
|
|
4015
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4016
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4017
|
+
offset: "0.345634",
|
|
4018
|
+
stopColor: "#EB8865"
|
|
4019
|
+
}),
|
|
4020
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4021
|
+
offset: "0.554579",
|
|
4022
|
+
stopColor: "#D34BFF"
|
|
4023
|
+
}),
|
|
4024
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4025
|
+
offset: "1",
|
|
4026
|
+
stopColor: "#4CA2FF"
|
|
4027
|
+
})
|
|
4028
|
+
]
|
|
4029
|
+
}),
|
|
4030
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4031
|
+
id: "paint12_linear_2_8065",
|
|
4032
|
+
x1: "-75.71",
|
|
4033
|
+
y1: "12.6663",
|
|
4034
|
+
x2: "47.41",
|
|
4035
|
+
y2: "-45.9339",
|
|
4036
|
+
gradientUnits: "userSpaceOnUse",
|
|
4037
|
+
children: [
|
|
4038
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4039
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4040
|
+
offset: "0.345634",
|
|
4041
|
+
stopColor: "#EB8865"
|
|
4042
|
+
}),
|
|
4043
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4044
|
+
offset: "0.554579",
|
|
4045
|
+
stopColor: "#D34BFF"
|
|
4046
|
+
}),
|
|
4047
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4048
|
+
offset: "1",
|
|
4049
|
+
stopColor: "#4CA2FF"
|
|
4050
|
+
})
|
|
4051
|
+
]
|
|
4052
|
+
}),
|
|
4053
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4054
|
+
id: "paint13_linear_2_8065",
|
|
4055
|
+
x1: "11.8729",
|
|
4056
|
+
y1: "-75.7219",
|
|
4057
|
+
x2: "133.151",
|
|
4058
|
+
y2: "-134.542",
|
|
4059
|
+
gradientUnits: "userSpaceOnUse",
|
|
4060
|
+
children: [
|
|
4061
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4062
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4063
|
+
offset: "0.345634",
|
|
4064
|
+
stopColor: "#EB8865"
|
|
4065
|
+
}),
|
|
4066
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4067
|
+
offset: "0.554579",
|
|
4068
|
+
stopColor: "#D34BFF"
|
|
4069
|
+
}),
|
|
4070
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4071
|
+
offset: "1",
|
|
4072
|
+
stopColor: "#4CA2FF"
|
|
4073
|
+
})
|
|
4074
|
+
]
|
|
4075
|
+
}),
|
|
4076
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4077
|
+
id: "paint14_linear_2_8065",
|
|
4078
|
+
x1: "-74.3663",
|
|
4079
|
+
y1: "186.83",
|
|
4080
|
+
x2: "46.9122",
|
|
4081
|
+
y2: "128.01",
|
|
4082
|
+
gradientUnits: "userSpaceOnUse",
|
|
4083
|
+
children: [
|
|
4084
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4085
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4086
|
+
offset: "0.345634",
|
|
4087
|
+
stopColor: "#EB8865"
|
|
4088
|
+
}),
|
|
4089
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4090
|
+
offset: "0.554579",
|
|
4091
|
+
stopColor: "#D34BFF"
|
|
4092
|
+
}),
|
|
4093
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4094
|
+
offset: "1",
|
|
4095
|
+
stopColor: "#4CA2FF"
|
|
4096
|
+
})
|
|
4097
|
+
]
|
|
4098
|
+
}),
|
|
4099
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4100
|
+
id: "paint15_linear_2_8065",
|
|
4101
|
+
x1: "12.447",
|
|
4102
|
+
y1: "100.823",
|
|
4103
|
+
x2: "135.567",
|
|
4104
|
+
y2: "42.2229",
|
|
4105
|
+
gradientUnits: "userSpaceOnUse",
|
|
4106
|
+
children: [
|
|
4107
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4108
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4109
|
+
offset: "0.345634",
|
|
4110
|
+
stopColor: "#EB8865"
|
|
4111
|
+
}),
|
|
4112
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4113
|
+
offset: "0.554579",
|
|
4114
|
+
stopColor: "#D34BFF"
|
|
4115
|
+
}),
|
|
4116
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4117
|
+
offset: "1",
|
|
4118
|
+
stopColor: "#4CA2FF"
|
|
4119
|
+
})
|
|
4120
|
+
]
|
|
4121
|
+
}),
|
|
4122
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4123
|
+
id: "paint16_linear_2_8065",
|
|
4124
|
+
x1: "100.03",
|
|
4125
|
+
y1: "12.434",
|
|
4126
|
+
x2: "221.308",
|
|
4127
|
+
y2: "-46.3862",
|
|
4128
|
+
gradientUnits: "userSpaceOnUse",
|
|
4129
|
+
children: [
|
|
4130
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4131
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4132
|
+
offset: "0.345634",
|
|
4133
|
+
stopColor: "#EB8865"
|
|
4134
|
+
}),
|
|
4135
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4136
|
+
offset: "0.554579",
|
|
4137
|
+
stopColor: "#D34BFF"
|
|
4138
|
+
}),
|
|
4139
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4140
|
+
offset: "1",
|
|
4141
|
+
stopColor: "#4CA2FF"
|
|
4142
|
+
})
|
|
4143
|
+
]
|
|
4144
|
+
}),
|
|
4145
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4146
|
+
id: "paint17_linear_2_8065",
|
|
4147
|
+
x1: "186.843",
|
|
4148
|
+
y1: "-73.5734",
|
|
4149
|
+
x2: "309.963",
|
|
4150
|
+
y2: "-132.174",
|
|
4151
|
+
gradientUnits: "userSpaceOnUse",
|
|
4152
|
+
children: [
|
|
4153
|
+
/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }),
|
|
4154
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4155
|
+
offset: "0.345634",
|
|
4156
|
+
stopColor: "#EB8865"
|
|
4157
|
+
}),
|
|
4158
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4159
|
+
offset: "0.554579",
|
|
4160
|
+
stopColor: "#D34BFF"
|
|
4161
|
+
}),
|
|
4162
|
+
/* @__PURE__ */ jsx("stop", {
|
|
4163
|
+
offset: "1",
|
|
4164
|
+
stopColor: "#4CA2FF"
|
|
4165
|
+
})
|
|
4166
|
+
]
|
|
4167
|
+
}),
|
|
4168
|
+
/* @__PURE__ */ jsxs("linearGradient", {
|
|
4169
|
+
id: "paint18_linear_2_8065",
|
|
4170
|
+
x1: "541.75",
|
|
4171
|
+
y1: "220",
|
|
4172
|
+
x2: "134.237",
|
|
4173
|
+
y2: "-134.348",
|
|
4174
|
+
gradientUnits: "userSpaceOnUse",
|
|
4175
|
+
children: [/* @__PURE__ */ jsx("stop", { stopColor: "#4BFFA6" }), /* @__PURE__ */ jsx("stop", {
|
|
4176
|
+
offset: "1",
|
|
4177
|
+
stopColor: "#D34BFF"
|
|
4178
|
+
})]
|
|
4179
|
+
}),
|
|
4180
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4181
|
+
id: "clip0_2_8065",
|
|
4182
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4183
|
+
width: "440",
|
|
4184
|
+
height: "440",
|
|
4185
|
+
rx: "24.6939",
|
|
4186
|
+
fill: "white"
|
|
4187
|
+
})
|
|
4188
|
+
}),
|
|
4189
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4190
|
+
id: "clip1_2_8065",
|
|
4191
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4192
|
+
width: "440",
|
|
4193
|
+
height: "440",
|
|
4194
|
+
fill: "white"
|
|
4195
|
+
})
|
|
4196
|
+
}),
|
|
4197
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4198
|
+
id: "clip2_2_8065",
|
|
4199
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4200
|
+
width: "243.923",
|
|
4201
|
+
height: "121.961",
|
|
4202
|
+
fill: "white",
|
|
4203
|
+
transform: "translate(1.28839 286.448) rotate(-45)"
|
|
4204
|
+
})
|
|
4205
|
+
}),
|
|
4206
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4207
|
+
id: "clip3_2_8065",
|
|
4208
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4209
|
+
width: "243.923",
|
|
4210
|
+
height: "121.961",
|
|
4211
|
+
fill: "white",
|
|
4212
|
+
transform: "translate(175.685 112.053) rotate(-45)"
|
|
4213
|
+
})
|
|
4214
|
+
}),
|
|
4215
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4216
|
+
id: "clip4_2_8065",
|
|
4217
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4218
|
+
width: "243.923",
|
|
4219
|
+
height: "121.961",
|
|
4220
|
+
fill: "white",
|
|
4221
|
+
transform: "translate(350.081 -62.3431) rotate(-45)"
|
|
4222
|
+
})
|
|
4223
|
+
}),
|
|
4224
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4225
|
+
id: "clip5_2_8065",
|
|
4226
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4227
|
+
width: "243.923",
|
|
4228
|
+
height: "121.961",
|
|
4229
|
+
fill: "white",
|
|
4230
|
+
transform: "translate(89.4453 374.604) rotate(-45)"
|
|
4231
|
+
})
|
|
4232
|
+
}),
|
|
4233
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4234
|
+
id: "clip6_2_8065",
|
|
4235
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4236
|
+
width: "243.923",
|
|
4237
|
+
height: "121.961",
|
|
4238
|
+
fill: "white",
|
|
4239
|
+
transform: "translate(263.84 200.209) rotate(-45)"
|
|
4240
|
+
})
|
|
4241
|
+
}),
|
|
4242
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4243
|
+
id: "clip7_2_8065",
|
|
4244
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4245
|
+
width: "243.923",
|
|
4246
|
+
height: "121.961",
|
|
4247
|
+
fill: "white",
|
|
4248
|
+
transform: "translate(438.236 25.8132) rotate(-45)"
|
|
4249
|
+
})
|
|
4250
|
+
}),
|
|
4251
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4252
|
+
id: "clip8_2_8065",
|
|
4253
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4254
|
+
width: "243.923",
|
|
4255
|
+
height: "121.961",
|
|
4256
|
+
fill: "white",
|
|
4257
|
+
transform: "translate(351.997 288.364) rotate(-45)"
|
|
4258
|
+
})
|
|
4259
|
+
}),
|
|
4260
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4261
|
+
id: "clip9_2_8065",
|
|
4262
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4263
|
+
width: "243.923",
|
|
4264
|
+
height: "121.961",
|
|
4265
|
+
fill: "white",
|
|
4266
|
+
transform: "translate(-174.505 110.655) rotate(-45)"
|
|
4267
|
+
})
|
|
4268
|
+
}),
|
|
4269
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4270
|
+
id: "clip10_2_8065",
|
|
4271
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4272
|
+
width: "243.923",
|
|
4273
|
+
height: "121.961",
|
|
4274
|
+
fill: "white",
|
|
4275
|
+
transform: "translate(-0.108704 -63.7402) rotate(-45)"
|
|
4276
|
+
})
|
|
4277
|
+
}),
|
|
4278
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4279
|
+
id: "clip11_2_8065",
|
|
4280
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4281
|
+
width: "243.923",
|
|
4282
|
+
height: "121.961",
|
|
4283
|
+
fill: "white",
|
|
4284
|
+
transform: "translate(-86.3479 198.812) rotate(-45)"
|
|
4285
|
+
})
|
|
4286
|
+
}),
|
|
4287
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4288
|
+
id: "clip12_2_8065",
|
|
4289
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4290
|
+
width: "243.923",
|
|
4291
|
+
height: "121.961",
|
|
4292
|
+
fill: "white",
|
|
4293
|
+
transform: "translate(88.0482 24.4156) rotate(-45)"
|
|
4294
|
+
})
|
|
4295
|
+
}),
|
|
4296
|
+
/* @__PURE__ */ jsx("clipPath", {
|
|
4297
|
+
id: "clip13_2_8065",
|
|
4298
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
4299
|
+
width: "101.516",
|
|
4300
|
+
height: "50.7692",
|
|
4301
|
+
fill: "white",
|
|
4302
|
+
transform: "translate(313.906 325.923)"
|
|
4303
|
+
})
|
|
4304
|
+
})
|
|
4305
|
+
] })
|
|
4306
|
+
]
|
|
4307
|
+
});
|
|
4308
|
+
};
|
|
4309
|
+
var DomainCardSvg_default = DomainCardSvg;
|
|
4310
|
+
|
|
4311
|
+
//#endregion
|
|
4312
|
+
//#region src/components/suins-modal/SuiNsModal.css.ts
|
|
4313
|
+
var body = "SuiNsModal_body__lh8k8k5";
|
|
4314
|
+
var content = "SuiNsModal_content__lh8k8k1";
|
|
4315
|
+
var description = "SuiNsModal_description__lh8k8k4";
|
|
4316
|
+
var domainCard = "SuiNsModal_domainCard__lh8k8kb";
|
|
4317
|
+
var domainCardBg = "SuiNsModal_domainCardBg__lh8k8kc";
|
|
4318
|
+
var domainCardGrid = "SuiNsModal_domainCardGrid__lh8k8ka";
|
|
4319
|
+
var domainExpiry = "SuiNsModal_domainExpiry__lh8k8ke";
|
|
4320
|
+
var domainItem = "SuiNsModal_domainItem__lh8k8k9";
|
|
4321
|
+
var domainList = "SuiNsModal_domainList__lh8k8k8";
|
|
4322
|
+
var domainName = "SuiNsModal_domainName__lh8k8kd";
|
|
4323
|
+
var header = "SuiNsModal_header__lh8k8k2";
|
|
4324
|
+
var link = "SuiNsModal_link__lh8k8kg";
|
|
4325
|
+
var loadingSpinner = "SuiNsModal_loadingSpinner__lh8k8kh";
|
|
4326
|
+
var overlay = "SuiNsModal_overlay__lh8k8k0";
|
|
4327
|
+
var section = "SuiNsModal_section__lh8k8k6";
|
|
4328
|
+
var sectionTitle = "SuiNsModal_sectionTitle__lh8k8k7";
|
|
4329
|
+
var title = "SuiNsModal_title__lh8k8k3";
|
|
4330
|
+
|
|
4331
|
+
//#endregion
|
|
4332
|
+
//#region src/components/suins-modal/RegisterSuiNsDialog.tsx
|
|
4333
|
+
const RegisterSuiNsDialog = ({ isOpen, onClose, onRegistered, currentAccount, clients: { suiClient, queryClient, suinsClient }, signAndExecuteTransaction, sponsorConfig }) => {
|
|
4334
|
+
const { searchName, setSearchName, isSearching, isAvailable, isRegistering, isSwapping, estimatedPrice, error, normalizedName, fullName, handleSearch, handleRegister: handleRegisterInternal, reset } = useSuiNsRegistration({
|
|
4335
|
+
currentAccount,
|
|
4336
|
+
clients: {
|
|
4337
|
+
suiClient,
|
|
4338
|
+
queryClient,
|
|
4339
|
+
suinsClient
|
|
4340
|
+
},
|
|
4341
|
+
signAndExecuteTransaction,
|
|
4342
|
+
sponsorConfig
|
|
4343
|
+
});
|
|
4344
|
+
const handleRegister = async () => {
|
|
4345
|
+
if (await handleRegisterInternal()) {
|
|
4346
|
+
if (onRegistered) onRegistered();
|
|
4347
|
+
handleClose();
|
|
4348
|
+
}
|
|
4349
|
+
};
|
|
4350
|
+
const handleClose = () => {
|
|
4351
|
+
reset();
|
|
4352
|
+
onClose();
|
|
4353
|
+
};
|
|
4354
|
+
if (!currentAccount) return null;
|
|
4355
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
4356
|
+
open: isOpen,
|
|
4357
|
+
onOpenChange: (open) => !open && handleClose(),
|
|
4358
|
+
children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, {
|
|
4359
|
+
className: overlay,
|
|
4360
|
+
style: {
|
|
4361
|
+
zIndex: 51,
|
|
4362
|
+
backgroundColor: "rgba(0, 0, 0, 0.7)"
|
|
4363
|
+
}
|
|
4364
|
+
}), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
4365
|
+
className: content,
|
|
4366
|
+
style: {
|
|
4367
|
+
maxWidth: "32rem",
|
|
4368
|
+
zIndex: 52
|
|
4369
|
+
},
|
|
4370
|
+
children: [
|
|
4371
|
+
(isRegistering || isSwapping) && /* @__PURE__ */ jsx("div", {
|
|
4372
|
+
style: {
|
|
4373
|
+
position: "absolute",
|
|
4374
|
+
inset: 0,
|
|
4375
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
4376
|
+
backdropFilter: "blur(4px)",
|
|
4377
|
+
display: "flex",
|
|
4378
|
+
alignItems: "center",
|
|
4379
|
+
justifyContent: "center",
|
|
4380
|
+
zIndex: 100,
|
|
4381
|
+
borderRadius: "0.75rem"
|
|
4382
|
+
},
|
|
4383
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4384
|
+
style: {
|
|
4385
|
+
display: "flex",
|
|
4386
|
+
flexDirection: "column",
|
|
4387
|
+
alignItems: "center",
|
|
4388
|
+
gap: "0.75rem"
|
|
4389
|
+
},
|
|
4390
|
+
children: [/* @__PURE__ */ jsx(Loader2, { style: {
|
|
4391
|
+
width: "2rem",
|
|
4392
|
+
height: "2rem",
|
|
4393
|
+
animation: "spin 1s linear infinite",
|
|
4394
|
+
color: "white"
|
|
4395
|
+
} }), /* @__PURE__ */ jsx("p", {
|
|
4396
|
+
style: {
|
|
4397
|
+
fontSize: "0.875rem",
|
|
4398
|
+
color: "white"
|
|
4399
|
+
},
|
|
4400
|
+
children: isSwapping ? "Swapping WAL to USDC..." : "Registering domain..."
|
|
4401
|
+
})]
|
|
4402
|
+
})
|
|
4403
|
+
}),
|
|
4404
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4405
|
+
className: header,
|
|
4406
|
+
children: [
|
|
4407
|
+
/* @__PURE__ */ jsx(Dialog.Title, {
|
|
4408
|
+
className: title,
|
|
4409
|
+
children: "Register SuiNS Domain"
|
|
4410
|
+
}),
|
|
4411
|
+
/* @__PURE__ */ jsx(Dialog.Description, {
|
|
4412
|
+
className: description,
|
|
4413
|
+
children: "Search and register a new .sui domain name"
|
|
4414
|
+
}),
|
|
4415
|
+
/* @__PURE__ */ jsx(Dialog.Close, {
|
|
4416
|
+
asChild: true,
|
|
4417
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
4418
|
+
type: "button",
|
|
4419
|
+
onClick: handleClose,
|
|
4420
|
+
disabled: isRegistering,
|
|
4421
|
+
style: {
|
|
4422
|
+
position: "absolute",
|
|
4423
|
+
right: "1rem",
|
|
4424
|
+
top: "1rem",
|
|
4425
|
+
padding: "0.5rem",
|
|
4426
|
+
borderRadius: "0.375rem",
|
|
4427
|
+
border: "none",
|
|
4428
|
+
background: "transparent",
|
|
4429
|
+
cursor: "pointer",
|
|
4430
|
+
display: "flex",
|
|
4431
|
+
alignItems: "center",
|
|
4432
|
+
justifyContent: "center"
|
|
4433
|
+
},
|
|
4434
|
+
children: /* @__PURE__ */ jsx(X, { style: {
|
|
4435
|
+
width: "1rem",
|
|
4436
|
+
height: "1rem"
|
|
4437
|
+
} })
|
|
4438
|
+
})
|
|
4439
|
+
})
|
|
4440
|
+
]
|
|
4441
|
+
}),
|
|
4442
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4443
|
+
className: body,
|
|
4444
|
+
children: [
|
|
4445
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4446
|
+
style: { marginBottom: "1rem" },
|
|
4447
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
4448
|
+
htmlFor: "domain-search",
|
|
4449
|
+
style: {
|
|
4450
|
+
display: "block",
|
|
4451
|
+
fontSize: "0.875rem",
|
|
4452
|
+
fontWeight: 500,
|
|
4453
|
+
marginBottom: "0.5rem"
|
|
4454
|
+
},
|
|
4455
|
+
children: "Search for a domain"
|
|
4456
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4457
|
+
style: {
|
|
4458
|
+
display: "flex",
|
|
4459
|
+
gap: "0.5rem"
|
|
4460
|
+
},
|
|
4461
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4462
|
+
style: {
|
|
4463
|
+
position: "relative",
|
|
4464
|
+
flex: 1
|
|
4465
|
+
},
|
|
4466
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
4467
|
+
id: "domain-search",
|
|
4468
|
+
type: "text",
|
|
4469
|
+
value: searchName,
|
|
4470
|
+
onChange: (e) => {
|
|
4471
|
+
setSearchName(e.target.value);
|
|
4472
|
+
},
|
|
4473
|
+
onKeyDown: (e) => {
|
|
4474
|
+
if (e.key === "Enter" && normalizedName) handleSearch();
|
|
4475
|
+
},
|
|
4476
|
+
placeholder: "Enter domain name",
|
|
4477
|
+
disabled: isSearching || isRegistering,
|
|
4478
|
+
style: { paddingRight: "3rem" }
|
|
4479
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4480
|
+
style: {
|
|
4481
|
+
position: "absolute",
|
|
4482
|
+
right: "0.75rem",
|
|
4483
|
+
top: "50%",
|
|
4484
|
+
transform: "translateY(-50%)",
|
|
4485
|
+
fontSize: "0.875rem",
|
|
4486
|
+
color: "var(--muted-foreground)",
|
|
4487
|
+
pointerEvents: "none"
|
|
4488
|
+
},
|
|
4489
|
+
children: ".sui"
|
|
4490
|
+
})]
|
|
4491
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
4492
|
+
onClick: handleSearch,
|
|
4493
|
+
disabled: isSearching || isRegistering || !normalizedName,
|
|
4494
|
+
size: "default",
|
|
4495
|
+
children: isSearching ? /* @__PURE__ */ jsx(Loader2, { style: {
|
|
4496
|
+
width: "1rem",
|
|
4497
|
+
height: "1rem",
|
|
4498
|
+
animation: "spin 1s linear infinite"
|
|
4499
|
+
} }) : /* @__PURE__ */ jsx(Search, { style: {
|
|
4500
|
+
width: "1rem",
|
|
4501
|
+
height: "1rem"
|
|
4502
|
+
} })
|
|
4503
|
+
})]
|
|
4504
|
+
})]
|
|
4505
|
+
}),
|
|
4506
|
+
isAvailable !== null && /* @__PURE__ */ jsxs("div", {
|
|
4507
|
+
style: {
|
|
4508
|
+
display: "flex",
|
|
4509
|
+
alignItems: "center",
|
|
4510
|
+
gap: "0.625rem",
|
|
4511
|
+
padding: "0.875rem",
|
|
4512
|
+
borderRadius: "0.5rem",
|
|
4513
|
+
border: `1px solid ${isAvailable ? "rgba(34, 197, 94, 0.2)" : "rgba(239, 68, 68, 0.2)"}`,
|
|
4514
|
+
backgroundColor: isAvailable ? "rgba(34, 197, 94, 0.1)" : "rgba(239, 68, 68, 0.1)",
|
|
4515
|
+
color: isAvailable ? "rgb(22, 163, 74)" : "rgb(220, 38, 38)",
|
|
4516
|
+
marginBottom: "1rem"
|
|
4517
|
+
},
|
|
4518
|
+
children: [/* @__PURE__ */ jsx(CheckCircle2, { style: {
|
|
4519
|
+
width: "1.25rem",
|
|
4520
|
+
height: "1.25rem",
|
|
4521
|
+
flexShrink: 0
|
|
4522
|
+
} }), /* @__PURE__ */ jsxs("div", {
|
|
4523
|
+
style: {
|
|
4524
|
+
flex: 1,
|
|
4525
|
+
minWidth: 0
|
|
4526
|
+
},
|
|
4527
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
4528
|
+
style: {
|
|
4529
|
+
fontSize: "0.875rem",
|
|
4530
|
+
fontWeight: 600
|
|
4531
|
+
},
|
|
4532
|
+
children: isAvailable ? `${fullName} is available!` : `${fullName} is already taken`
|
|
4533
|
+
}), isAvailable && estimatedPrice && /* @__PURE__ */ jsxs("p", {
|
|
4534
|
+
style: {
|
|
4535
|
+
fontSize: "0.75rem",
|
|
4536
|
+
opacity: .8,
|
|
4537
|
+
marginTop: "0.125rem"
|
|
4538
|
+
},
|
|
4539
|
+
children: ["Estimated cost: ", estimatedPrice]
|
|
4540
|
+
})]
|
|
4541
|
+
})]
|
|
4542
|
+
}),
|
|
4543
|
+
error && /* @__PURE__ */ jsx("div", {
|
|
4544
|
+
style: {
|
|
4545
|
+
padding: "0.75rem",
|
|
4546
|
+
borderRadius: "0.5rem",
|
|
4547
|
+
backgroundColor: "rgba(239, 68, 68, 0.1)",
|
|
4548
|
+
color: "rgb(220, 38, 38)",
|
|
4549
|
+
fontSize: "0.875rem",
|
|
4550
|
+
marginBottom: "1rem"
|
|
4551
|
+
},
|
|
4552
|
+
children: error
|
|
4553
|
+
}),
|
|
4554
|
+
isAvailable && /* @__PURE__ */ jsx(Button, {
|
|
4555
|
+
onClick: handleRegister,
|
|
4556
|
+
disabled: isRegistering || isSwapping || !normalizedName,
|
|
4557
|
+
variant: "gradient",
|
|
4558
|
+
size: "default",
|
|
4559
|
+
style: { width: "100%" },
|
|
4560
|
+
children: isSwapping ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Loader2, { style: {
|
|
4561
|
+
width: "1rem",
|
|
4562
|
+
height: "1rem",
|
|
4563
|
+
animation: "spin 1s linear infinite",
|
|
4564
|
+
marginRight: "0.5rem"
|
|
4565
|
+
} }), "Swapping WAL to USDC..."] }) : isRegistering ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Loader2, { style: {
|
|
4566
|
+
width: "1rem",
|
|
4567
|
+
height: "1rem",
|
|
4568
|
+
animation: "spin 1s linear infinite",
|
|
4569
|
+
marginRight: "0.5rem"
|
|
4570
|
+
} }), "Registering..."] }) : `Register ${fullName}`
|
|
4571
|
+
})
|
|
4572
|
+
]
|
|
4573
|
+
})
|
|
4574
|
+
]
|
|
4575
|
+
})] })
|
|
4576
|
+
});
|
|
4577
|
+
};
|
|
4578
|
+
|
|
4579
|
+
//#endregion
|
|
4580
|
+
//#region src/components/suins-modal/SuiNsModal.tsx
|
|
4581
|
+
const SuiNsModal = ({ siteId, onAssociateDomain, currentAccount, portalDomain, portalHttps, clients: { suiClient, queryClient, suinsClient }, signAndExecuteTransaction, sponsorConfig }) => {
|
|
4582
|
+
const isOpen = useStore(isDomainDialogOpen);
|
|
4583
|
+
const isAssigning = useStore(isAssigningDomain);
|
|
4584
|
+
const isRegisterSuiNSDomainDialog = useStore(isRegisterSuiNSDomainDialogOpen);
|
|
4585
|
+
const suiNSUrlArray = useStore(siteMetadataStore.suiNSUrl);
|
|
4586
|
+
const { network } = suiClient;
|
|
4587
|
+
const { data: nsDomains, isLoading: isLoadingDomains, isError: isErrorDomains } = useSuiNsDomainsQuery(currentAccount, {
|
|
4588
|
+
suiClient,
|
|
4589
|
+
queryClient
|
|
4590
|
+
});
|
|
4591
|
+
const connectedDomains = nsDomains.filter((domain) => {
|
|
4592
|
+
console.log("[1]domain", domain);
|
|
4593
|
+
console.log("[1]suiNSUrlArray", suiNSUrlArray);
|
|
4594
|
+
return suiNSUrlArray.some((entry) => entry.nftId === domain.nftId);
|
|
4595
|
+
});
|
|
4596
|
+
const explorerUrl = siteId ? network === "testnet" ? `https://testnet.suivision.xyz/object/${siteId}` : `https://suivision.xyz/object/${siteId}` : void 0;
|
|
4597
|
+
const handleAssociate = (nftId, suiNSName) => {
|
|
4598
|
+
if (siteId && onAssociateDomain) onAssociateDomain(nftId, siteId, suiNSName);
|
|
4599
|
+
};
|
|
4600
|
+
const handleRemoveAssociation = (nftId) => {
|
|
4601
|
+
if (onAssociateDomain) onAssociateDomain(nftId, "", "");
|
|
4602
|
+
};
|
|
4603
|
+
const formatExpiryDate = (timestamp) => {
|
|
4604
|
+
if (!timestamp) return null;
|
|
4605
|
+
return new Date(timestamp).toLocaleDateString("en-US", {
|
|
4606
|
+
month: "short",
|
|
4607
|
+
day: "2-digit",
|
|
4608
|
+
year: "numeric"
|
|
4609
|
+
});
|
|
4610
|
+
};
|
|
4611
|
+
return /* @__PURE__ */ jsxs(Dialog.Root, {
|
|
4612
|
+
open: isOpen,
|
|
4613
|
+
onOpenChange: isDomainDialogOpen.set,
|
|
4614
|
+
children: [/* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: overlay }), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
4615
|
+
className: content,
|
|
4616
|
+
children: [
|
|
4617
|
+
isAssigning && /* @__PURE__ */ jsx("div", {
|
|
4618
|
+
style: {
|
|
4619
|
+
position: "absolute",
|
|
4620
|
+
inset: 0,
|
|
4621
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
4622
|
+
backdropFilter: "blur(4px)",
|
|
4623
|
+
display: "flex",
|
|
4624
|
+
alignItems: "center",
|
|
4625
|
+
justifyContent: "center",
|
|
4626
|
+
zIndex: 100,
|
|
4627
|
+
borderRadius: "0.75rem"
|
|
4628
|
+
},
|
|
4629
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4630
|
+
style: {
|
|
4631
|
+
display: "flex",
|
|
4632
|
+
flexDirection: "column",
|
|
4633
|
+
alignItems: "center",
|
|
4634
|
+
gap: "0.75rem"
|
|
4635
|
+
},
|
|
4636
|
+
children: [/* @__PURE__ */ jsx(Loader2, { style: {
|
|
4637
|
+
width: "2rem",
|
|
4638
|
+
height: "2rem",
|
|
4639
|
+
animation: "spin 1s linear infinite",
|
|
4640
|
+
color: "white"
|
|
4641
|
+
} }), /* @__PURE__ */ jsx("p", {
|
|
4642
|
+
style: {
|
|
4643
|
+
fontSize: "0.875rem",
|
|
4644
|
+
color: "white"
|
|
4645
|
+
},
|
|
4646
|
+
children: "Updating domain association..."
|
|
4647
|
+
})]
|
|
4648
|
+
})
|
|
4649
|
+
}),
|
|
4650
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4651
|
+
className: header,
|
|
4652
|
+
children: [/* @__PURE__ */ jsx(Dialog.Title, {
|
|
4653
|
+
className: title,
|
|
4654
|
+
children: "Customize Domain"
|
|
4655
|
+
}), /* @__PURE__ */ jsx(Dialog.Description, {
|
|
4656
|
+
className: description,
|
|
4657
|
+
children: "Associate your website with a SuiNS domain for easy access"
|
|
4658
|
+
})]
|
|
4659
|
+
}),
|
|
4660
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4661
|
+
className: body,
|
|
4662
|
+
children: [
|
|
4663
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4664
|
+
className: section,
|
|
4665
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
4666
|
+
className: sectionTitle,
|
|
4667
|
+
children: "Currently Associated Domains"
|
|
4668
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4669
|
+
className: domainList,
|
|
4670
|
+
children: [explorerUrl && /* @__PURE__ */ jsx("div", {
|
|
4671
|
+
className: domainItem,
|
|
4672
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4673
|
+
style: {
|
|
4674
|
+
flex: 1,
|
|
4675
|
+
width: "100%"
|
|
4676
|
+
},
|
|
4677
|
+
children: [/* @__PURE__ */ jsxs("a", {
|
|
4678
|
+
href: explorerUrl,
|
|
4679
|
+
target: "_blank",
|
|
4680
|
+
rel: "noreferrer",
|
|
4681
|
+
className: link,
|
|
4682
|
+
style: {
|
|
4683
|
+
fontSize: "0.875rem",
|
|
4684
|
+
fontWeight: 500
|
|
4685
|
+
},
|
|
4686
|
+
children: ["Explorer", /* @__PURE__ */ jsx(ExternalLink, { style: {
|
|
4687
|
+
display: "inline",
|
|
4688
|
+
width: "0.75rem",
|
|
4689
|
+
height: "0.75rem",
|
|
4690
|
+
marginLeft: "0.25rem"
|
|
4691
|
+
} })]
|
|
4692
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
4693
|
+
style: {
|
|
4694
|
+
marginTop: "0.1rem",
|
|
4695
|
+
fontSize: "0.75rem",
|
|
4696
|
+
color: "var(--muted-foreground)"
|
|
4697
|
+
},
|
|
4698
|
+
children: "Sui Explorer"
|
|
4699
|
+
})]
|
|
4700
|
+
})
|
|
4701
|
+
}), connectedDomains.length > 0 && connectedDomains.map((domain) => {
|
|
4702
|
+
const linkedEntry = suiNSUrlArray.find((entry) => entry.nftId === domain.nftId);
|
|
4703
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4704
|
+
className: domainItem,
|
|
4705
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4706
|
+
style: {
|
|
4707
|
+
flex: 1,
|
|
4708
|
+
minWidth: 0
|
|
4709
|
+
},
|
|
4710
|
+
children: [/* @__PURE__ */ jsxs("a", {
|
|
4711
|
+
href: suinsDomainToWalrusSiteUrl(linkedEntry?.suins || "", portalDomain, portalHttps) || domain.walrusSiteUrl,
|
|
4712
|
+
target: "_blank",
|
|
4713
|
+
rel: "noreferrer",
|
|
4714
|
+
className: link,
|
|
4715
|
+
style: {
|
|
4716
|
+
fontSize: "0.875rem",
|
|
4717
|
+
fontWeight: 500
|
|
4718
|
+
},
|
|
4719
|
+
children: ["@", domain.name]
|
|
4720
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
4721
|
+
style: {
|
|
4722
|
+
fontSize: "0.75rem",
|
|
4723
|
+
color: "var(--muted-foreground)"
|
|
4724
|
+
},
|
|
4725
|
+
children: "SuiNS Linked Domain"
|
|
4726
|
+
})]
|
|
4727
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
4728
|
+
variant: "ghost",
|
|
4729
|
+
size: "icon",
|
|
4730
|
+
onClick: () => handleRemoveAssociation(domain.nftId),
|
|
4731
|
+
disabled: isAssigning,
|
|
4732
|
+
title: "Remove domain association",
|
|
4733
|
+
children: /* @__PURE__ */ jsx(X, { style: {
|
|
4734
|
+
width: "1rem",
|
|
4735
|
+
height: "1rem"
|
|
4736
|
+
} })
|
|
4737
|
+
})]
|
|
4738
|
+
}, domain.nftId);
|
|
4739
|
+
})]
|
|
4740
|
+
})]
|
|
4741
|
+
}),
|
|
4742
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4743
|
+
className: section,
|
|
4744
|
+
style: { marginTop: "0.5rem" },
|
|
4745
|
+
children: [
|
|
4746
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4747
|
+
className: sectionTitle,
|
|
4748
|
+
children: [/* @__PURE__ */ jsx("span", { children: "Select a domain to associate with your website" }), /* @__PURE__ */ jsx(Button, {
|
|
4749
|
+
size: "sm",
|
|
4750
|
+
type: "button",
|
|
4751
|
+
onClick: () => isRegisterSuiNSDomainDialogOpen.set(true),
|
|
4752
|
+
children: "Buy a domain"
|
|
4753
|
+
})]
|
|
4754
|
+
}),
|
|
4755
|
+
isLoadingDomains && /* @__PURE__ */ jsx("div", {
|
|
4756
|
+
className: loadingSpinner,
|
|
4757
|
+
children: /* @__PURE__ */ jsx(Loader2, { style: {
|
|
4758
|
+
width: "1.5rem",
|
|
4759
|
+
height: "1.5rem",
|
|
4760
|
+
animation: "spin 1s linear infinite"
|
|
4761
|
+
} })
|
|
4762
|
+
}),
|
|
4763
|
+
isErrorDomains && /* @__PURE__ */ jsx("p", {
|
|
4764
|
+
style: {
|
|
4765
|
+
fontSize: "0.75rem",
|
|
4766
|
+
color: "var(--destructive)",
|
|
4767
|
+
padding: "1rem 0"
|
|
4768
|
+
},
|
|
4769
|
+
children: "Failed to load your domains. Please try again."
|
|
4770
|
+
}),
|
|
4771
|
+
!isLoadingDomains && !isErrorDomains && !nsDomains.length && /* @__PURE__ */ jsx(Banner, {
|
|
4772
|
+
title: "You don't own any SuiNS domains yet.",
|
|
4773
|
+
description: "Buy a domain to continue.",
|
|
4774
|
+
variant: "warning"
|
|
4775
|
+
}),
|
|
4776
|
+
!isLoadingDomains && !isErrorDomains && nsDomains.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
4777
|
+
className: domainCardGrid,
|
|
4778
|
+
children: nsDomains.map((domain) => {
|
|
4779
|
+
const isConnectedToThisSite = suiNSUrlArray.some((entry) => entry.nftId === domain.nftId);
|
|
4780
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
4781
|
+
type: "button",
|
|
4782
|
+
className: domainCard,
|
|
4783
|
+
onClick: () => handleAssociate(domain.nftId, domain.name),
|
|
4784
|
+
disabled: isConnectedToThisSite,
|
|
4785
|
+
title: isConnectedToThisSite ? "Already connected to this site" : "Click to connect",
|
|
4786
|
+
children: [
|
|
4787
|
+
/* @__PURE__ */ jsx("div", {
|
|
4788
|
+
className: domainCardBg,
|
|
4789
|
+
children: /* @__PURE__ */ jsx(DomainCardSvg_default, {})
|
|
4790
|
+
}),
|
|
4791
|
+
/* @__PURE__ */ jsxs("div", {
|
|
4792
|
+
className: domainName,
|
|
4793
|
+
children: ["@", domain.name || "Unknown"]
|
|
4794
|
+
}),
|
|
4795
|
+
/* @__PURE__ */ jsx("div", {
|
|
4796
|
+
className: domainExpiry,
|
|
4797
|
+
children: formatExpiryDate(domain.expirationTimestampMs)
|
|
4798
|
+
})
|
|
4799
|
+
]
|
|
4800
|
+
}, domain.nftId);
|
|
4801
|
+
})
|
|
4802
|
+
})
|
|
4803
|
+
]
|
|
4804
|
+
}),
|
|
4805
|
+
network === "testnet" && /* @__PURE__ */ jsx(Banner, {
|
|
4806
|
+
title: "You are publishing to the testnet",
|
|
4807
|
+
description: "You must run a local Walrus Site Portal to view published site.",
|
|
4808
|
+
variant: "info",
|
|
4809
|
+
url: "https://docs.wal.app/walrus-sites/portal.html",
|
|
4810
|
+
urlName: "Portal Documentation"
|
|
4811
|
+
})
|
|
4812
|
+
]
|
|
4813
|
+
})
|
|
4814
|
+
]
|
|
4815
|
+
})] }), signAndExecuteTransaction && /* @__PURE__ */ jsx(RegisterSuiNsDialog, {
|
|
4816
|
+
isOpen: isRegisterSuiNSDomainDialog,
|
|
4817
|
+
onClose: () => isRegisterSuiNSDomainDialogOpen.set(false),
|
|
4818
|
+
onRegistered: () => {
|
|
4819
|
+
if (currentAccount?.address) queryClient.invalidateQueries({ queryKey: [
|
|
4820
|
+
"suins-domains",
|
|
4821
|
+
currentAccount.address,
|
|
4822
|
+
network
|
|
4823
|
+
] });
|
|
4824
|
+
},
|
|
4825
|
+
currentAccount,
|
|
4826
|
+
clients: {
|
|
4827
|
+
suiClient,
|
|
4828
|
+
queryClient,
|
|
4829
|
+
suinsClient
|
|
4830
|
+
},
|
|
4831
|
+
signAndExecuteTransaction,
|
|
4832
|
+
sponsorConfig
|
|
4833
|
+
})]
|
|
4834
|
+
});
|
|
4835
|
+
};
|
|
4836
|
+
var SuiNsModal_default = SuiNsModal;
|
|
4837
|
+
|
|
4838
|
+
//#endregion
|
|
4839
|
+
//#region src/components/ThemeProvider.tsx
|
|
4840
|
+
const ThemeProvider = ({ children, themeOverrides: _ }) => {
|
|
4841
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
4842
|
+
};
|
|
4843
|
+
|
|
4844
|
+
//#endregion
|
|
4845
|
+
//#region src/components/PublishButton.tsx
|
|
4846
|
+
const PublishButton = ({ children, siteId, assets, onUpdateSiteMetadata, onAssociatedDomain, onError, onExtendedBlobs, currentAccount, signAndExecuteTransaction, sponsorConfig, portalDomain, portalHttps, clients }) => {
|
|
4847
|
+
const { actions: { handleOpenPublishingDialog, handleOpenDomainDialog, handleRunDeploymentStep, handleSaveSiteMetadata, handleAssociateDomain, handleExtendBlobs } } = useSitePublishing({
|
|
4848
|
+
siteId,
|
|
4849
|
+
assets,
|
|
4850
|
+
onUpdateSiteMetadata,
|
|
4851
|
+
onAssociatedDomain,
|
|
4852
|
+
onError,
|
|
4853
|
+
onExtendedBlobs,
|
|
4854
|
+
currentAccount,
|
|
4855
|
+
signAndExecuteTransaction,
|
|
4856
|
+
sponsorConfig,
|
|
4857
|
+
clients,
|
|
4858
|
+
portalDomain,
|
|
4859
|
+
portalHttps
|
|
4860
|
+
});
|
|
4861
|
+
const network = clients.suiClient.network;
|
|
4862
|
+
return /* @__PURE__ */ jsxs(ThemeProvider, { children: [
|
|
4863
|
+
/* @__PURE__ */ jsx(PublishMenu_default, {
|
|
4864
|
+
siteId,
|
|
4865
|
+
onPublishClick: handleOpenPublishingDialog,
|
|
4866
|
+
onDomainClick: handleOpenDomainDialog,
|
|
4867
|
+
network: network === "mainnet" ? "mainnet" : "testnet",
|
|
4868
|
+
portalDomain,
|
|
4869
|
+
portalHttps,
|
|
4870
|
+
clients,
|
|
4871
|
+
currentAccount,
|
|
4872
|
+
children: children || /* @__PURE__ */ jsx(Button, { children: "Publish" })
|
|
4873
|
+
}),
|
|
4874
|
+
/* @__PURE__ */ jsx(PublishModal_default, {
|
|
4875
|
+
siteId,
|
|
4876
|
+
assets,
|
|
4877
|
+
onDeploy: handleRunDeploymentStep,
|
|
4878
|
+
onSaveMetadata: handleSaveSiteMetadata,
|
|
4879
|
+
onExtendBlobs: handleExtendBlobs,
|
|
4880
|
+
clients
|
|
4881
|
+
}),
|
|
4882
|
+
/* @__PURE__ */ jsx(SuiNsModal_default, {
|
|
4883
|
+
siteId,
|
|
4884
|
+
onAssociateDomain: handleAssociateDomain,
|
|
4885
|
+
currentAccount,
|
|
4886
|
+
portalDomain,
|
|
4887
|
+
portalHttps,
|
|
4888
|
+
clients,
|
|
4889
|
+
signAndExecuteTransaction,
|
|
4890
|
+
sponsorConfig
|
|
4891
|
+
}),
|
|
4892
|
+
/* @__PURE__ */ jsx(ExtendTimeDialog_default, {
|
|
4893
|
+
siteId,
|
|
4894
|
+
currentAccount,
|
|
4895
|
+
clients,
|
|
4896
|
+
signAndExecuteTransaction,
|
|
4897
|
+
sponsorConfig,
|
|
4898
|
+
onSuccess: (message, digest) => {
|
|
4899
|
+
onExtendedBlobs?.(message, digest);
|
|
4900
|
+
}
|
|
4901
|
+
})
|
|
4902
|
+
] });
|
|
4903
|
+
};
|
|
4904
|
+
var PublishButton_default = PublishButton;
|
|
4905
|
+
|
|
4906
|
+
//#endregion
|
|
4907
|
+
export { Banner, Button, DeploySteps, DeploymentStatus, FlickeringGrid, Input, Label, PublishButton_default as PublishButton, PublishMenu_default as PublishMenu, PublishModal_default as PublishModal, Stepper, SuiNsModal_default as SuiNsModal, Textarea, isAssigningDomain, isDomainDialogOpen, isExtendTimeDialogOpen, isRegisterSuiNSDomainDialogOpen, siteMetadataStore, sitePublishingStore, useEpochDuration, useSitePublishing, useSuiNsDomainsQuery, useSuiNsRegistration, useTransactionExecutor, useWalrusSiteQuery, useWalrusSitesQuery, useZenFsWorkspace, useZenfsFilesQuery };
|
|
4908
|
+
//# sourceMappingURL=index.js.map
|