@flapsdk/vault-runtime 0.1.31 → 0.1.32-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/{chunk-VUIWNFCV.js → chunk-B4WKI3EW.js} +38 -127
  3. package/chunk-B4WKI3EW.js.map +1 -0
  4. package/chunk-BUSYA2B4.js +8 -0
  5. package/chunk-BUSYA2B4.js.map +1 -0
  6. package/chunk-F6QSV3Y7.js +1184 -0
  7. package/chunk-F6QSV3Y7.js.map +1 -0
  8. package/{chunk-CPAMDXX7.js → chunk-FUOBTZMQ.js} +4 -2
  9. package/chunk-FUOBTZMQ.js.map +1 -0
  10. package/{chunk-QCBH6G4Q.js → chunk-PU7VEZWA.js} +67 -3
  11. package/chunk-PU7VEZWA.js.map +1 -0
  12. package/chunk-SAG36LUR.js +35 -0
  13. package/chunk-SAG36LUR.js.map +1 -0
  14. package/{chunk-WX6B7JWO.js → chunk-SDCB3RJS.js} +3 -3
  15. package/{chunk-WX6B7JWO.js.map → chunk-SDCB3RJS.js.map} +1 -1
  16. package/chunk-T6XKFZLH.js +129 -0
  17. package/chunk-T6XKFZLH.js.map +1 -0
  18. package/host.d.mts +4 -4
  19. package/host.js +8 -6
  20. package/host.js.map +1 -1
  21. package/{hostRuntimeConfig-C1sOrw9C.d.mts → hostRuntimeConfig-BC459T5W.d.mts} +3 -1
  22. package/mpegts-536UQHCG.js +5164 -0
  23. package/mpegts-536UQHCG.js.map +1 -0
  24. package/package.json +4 -3
  25. package/runtime-contract.json +1 -1
  26. package/sdk.d.mts +49 -5
  27. package/sdk.js +24 -10
  28. package/sdk.js.map +1 -1
  29. package/server.d.mts +15 -4
  30. package/server.js +162 -5
  31. package/server.js.map +1 -1
  32. package/{txError-CBveO4Df.d.mts → txError-CJnmiLnM.d.mts} +1 -1
  33. package/{types-I7JxlbLk.d.mts → types-BfzRFcjZ.d.mts} +21 -1
  34. package/ui.d.mts +37 -1
  35. package/ui.js +5 -3
  36. package/chunk-4S6TVBHU.js +0 -600
  37. package/chunk-4S6TVBHU.js.map +0 -1
  38. package/chunk-CPAMDXX7.js.map +0 -1
  39. package/chunk-GA5VEHC2.js +0 -40
  40. package/chunk-GA5VEHC2.js.map +0 -1
  41. package/chunk-QCBH6G4Q.js.map +0 -1
  42. package/chunk-VUIWNFCV.js.map +0 -1
package/chunk-4S6TVBHU.js DELETED
@@ -1,600 +0,0 @@
1
- import { shortenAddress } from './chunk-GA5VEHC2.js';
2
- import { getTaxVaultHostChainConfig } from './chunk-CPAMDXX7.js';
3
- import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck } from 'lucide-react';
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
6
- import * as React5 from 'react';
7
- import { createContext, useState, useEffect, useMemo, useContext } from 'react';
8
- import { Slot } from '@radix-ui/react-slot';
9
- import { cva } from 'class-variance-authority';
10
- import { createPortal } from 'react-dom';
11
-
12
- // src/sdk/ipfsImage.ts
13
- var DEFAULT_IPFS_IMAGE_GATEWAY = "https://flap.mypinata.cloud";
14
- var IPFS_IMAGE_GATEWAYS = ["https://flap.mypinata.cloud", "https://magenta-naval-penguin-822.mypinata.cloud"];
15
- var CID_RE = /^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/;
16
- var PATH_SEGMENT_RE = /^[A-Za-z0-9._~-]+$/;
17
- function isIpfsImageCid(value) {
18
- return CID_RE.test(value.trim());
19
- }
20
- function normalizeIpfsImagePath(value) {
21
- if (value === void 0) return "";
22
- const trimmed = value.trim();
23
- if (!trimmed || trimmed.length > 512 || trimmed.startsWith("/") || trimmed.endsWith("/")) return void 0;
24
- const segments = trimmed.split("/");
25
- if (segments.some((segment) => !segment || segment === "." || segment === ".." || !PATH_SEGMENT_RE.test(segment))) return void 0;
26
- return segments.join("/");
27
- }
28
- function resolveIpfsImageUrl(cid, chainId = 56, path) {
29
- const normalizedPath = normalizeIpfsImagePath(path);
30
- if (!isIpfsImageCid(cid) || normalizedPath === void 0) return void 0;
31
- const gateway = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\/+$/, "");
32
- return `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : ""}`;
33
- }
34
- function resolveIpfsImageUrls(cid, chainId = 56, path) {
35
- const normalizedPath = normalizeIpfsImagePath(path);
36
- if (!isIpfsImageCid(cid) || normalizedPath === void 0) return [];
37
- const preferred = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\/+$/, "");
38
- const gateways = [preferred, ...IPFS_IMAGE_GATEWAYS.map((gateway) => gateway.replace(/\/+$/, ""))];
39
- return [...new Set(gateways)].map((gateway) => `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : ""}`);
40
- }
41
- function AddressLink({ address, explorerBaseUrl, label }) {
42
- if (!address) return /* @__PURE__ */ React.createElement("span", null, "-");
43
- const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
44
- const content = /* @__PURE__ */ React.createElement("span", { className: "inline-flex min-w-0 items-center gap-1 text-primary" }, /* @__PURE__ */ React.createElement("span", { className: "truncate" }, label || shortenAddress(address)), href ? /* @__PURE__ */ React.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0" }) : null);
45
- return href ? /* @__PURE__ */ React.createElement("a", { href, target: "_blank", rel: "noreferrer" }, content) : content;
46
- }
47
- function cn(...inputs) {
48
- return twMerge(clsx(inputs));
49
- }
50
-
51
- // src/ui/Alert.tsx
52
- var toneClass = {
53
- info: "border-[#303236] bg-black text-[#D4D4D4]",
54
- success: "border-[#D0FF00]/45 bg-[#101400] text-[#D0FF00]",
55
- warning: "border-[#FFD166]/45 bg-[#1A1305] text-[#FFD166]",
56
- danger: "border-[#FF4A55]/55 bg-[#1D0709] text-[#FF8A91]"
57
- };
58
- var iconMap = {
59
- info: Info,
60
- success: CheckCircle2,
61
- warning: AlertTriangle,
62
- danger: AlertTriangle
63
- };
64
- function Alert({ children, tone = "info", className }) {
65
- const Icon = iconMap[tone];
66
- return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-[6px] border p-3 text-sm font-medium leading-6", toneClass[tone], className) }, /* @__PURE__ */ React.createElement(Icon, { className: "mt-0.5 h-4 w-4 shrink-0 opacity-90" }), /* @__PURE__ */ React.createElement("div", { className: "min-w-0 break-words" }, children));
67
- }
68
- var buttonVariants = cva(
69
- "inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-semibold uppercase leading-[1.4] tracking-normal duration-0 hover:transition-colors hover:duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#D0FF00]/45 disabled:pointer-events-none disabled:opacity-50",
70
- {
71
- variants: {
72
- variant: {
73
- default: "ui20-connect-chamfer text-[#070808] [--ui20-chamfer-bg:#D0FF00] [--ui20-chamfer-border:#D0FF00] hover:[--ui20-chamfer-bg:#BDE800] hover:[--ui20-chamfer-border:#BDE800]",
74
- secondary: "ui20-connect-chamfer text-white [--ui20-chamfer-bg:#262626] [--ui20-chamfer-border:#262626] hover:text-[#D0FF00] hover:[--ui20-chamfer-bg:#303030] hover:[--ui20-chamfer-border:#303030]",
75
- outline: "ui20-connect-chamfer text-[#D4D4D4] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#303236] hover:text-[#D0FF00] hover:[--ui20-chamfer-border:#D0FF00]",
76
- ghost: "rounded-[6px] text-[#D4D4D4] hover:bg-[#131516] hover:text-[#D0FF00]",
77
- destructive: "ui20-connect-chamfer text-[#FF4A55] [--ui20-chamfer-bg:#000000] [--ui20-chamfer-border:#FF4A55] hover:text-black hover:[--ui20-chamfer-bg:#FF4A55]"
78
- },
79
- size: {
80
- default: "h-10 px-4",
81
- sm: "h-8 px-3 text-xs",
82
- lg: "h-12 px-5",
83
- icon: "h-10 w-10 px-0"
84
- }
85
- },
86
- defaultVariants: {
87
- variant: "default",
88
- size: "default"
89
- }
90
- }
91
- );
92
- var Button = React5.forwardRef(
93
- ({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
94
- const Comp = asChild ? Slot : "button";
95
- if (asChild) {
96
- return /* @__PURE__ */ React5.createElement(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props }, children);
97
- }
98
- return /* @__PURE__ */ React5.createElement(
99
- Comp,
100
- {
101
- "data-flap-ui": "button",
102
- className: cn(buttonVariants({ variant, size, className })),
103
- ref,
104
- disabled: disabled || loading,
105
- ...props
106
- },
107
- loading ? /* @__PURE__ */ React5.createElement(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
108
- /* @__PURE__ */ React5.createElement("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2" }, children)
109
- );
110
- }
111
- );
112
- Button.displayName = "Button";
113
-
114
- // src/ui/binanceImageUrl.ts
115
- var BINANCE_IMAGE_HOSTNAME = "bin.bnbstatic.com";
116
- var MAX_BINANCE_IMAGE_URL_LENGTH = 4096;
117
- var CONTROL_CHARACTER_RE = /[\u0000-\u001F\u007F]/u;
118
- function normalizeBinanceImageUrl(value) {
119
- if (typeof value !== "string" || !value || value.length > MAX_BINANCE_IMAGE_URL_LENGTH) return null;
120
- if (value !== value.trim() || CONTROL_CHARACTER_RE.test(value)) return null;
121
- try {
122
- const parsed = new URL(value);
123
- if (parsed.protocol !== "https:") return null;
124
- if (parsed.hostname.toLowerCase() !== BINANCE_IMAGE_HOSTNAME) return null;
125
- if (parsed.username || parsed.password || parsed.port) return null;
126
- return parsed.href;
127
- } catch {
128
- return null;
129
- }
130
- }
131
-
132
- // src/ui/BinanceImage.tsx
133
- function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
134
- const safeSrc = React5.useMemo(() => normalizeBinanceImageUrl(src), [src]);
135
- const [failedSrc, setFailedSrc] = React5.useState(null);
136
- const {
137
- alt: _unsafeAlt,
138
- decoding: _unsafeDecoding,
139
- loading: _unsafeLoading,
140
- referrerPolicy: _unsafeReferrerPolicy,
141
- src: _unsafeSrc,
142
- srcSet: _unsafeSrcSet,
143
- ...imageProps
144
- } = props;
145
- if (!safeSrc || failedSrc === safeSrc) {
146
- return /* @__PURE__ */ React5.createElement("span", { className: cn("block", className), "data-flap-binance-image-state": safeSrc ? "error" : "invalid" }, fallback);
147
- }
148
- return (
149
- // eslint-disable-next-line @next/next/no-img-element -- BinanceImage owns the exact-host runtime boundary and browser loading policy.
150
- /* @__PURE__ */ React5.createElement(
151
- "img",
152
- {
153
- ...imageProps,
154
- alt,
155
- className: cn("block max-w-full", className),
156
- "data-flap-binance-image-state": "ready",
157
- decoding: "async",
158
- loading: "lazy",
159
- onError: (event) => {
160
- setFailedSrc(safeSrc);
161
- onError?.(event);
162
- },
163
- referrerPolicy: "no-referrer",
164
- src: safeSrc
165
- }
166
- )
167
- );
168
- }
169
- var Card = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement(
170
- "div",
171
- {
172
- "data-flap-ui": "card",
173
- ref,
174
- className: cn(
175
- "rounded-[8px] border border-[#303236] bg-[#070808] text-white shadow-[0_18px_60px_-42px_rgba(208,255,0,0.45)]",
176
- className
177
- ),
178
- ...props
179
- }
180
- ));
181
- Card.displayName = "Card";
182
- var CardHeader = React5.forwardRef(
183
- ({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
184
- );
185
- CardHeader.displayName = "CardHeader";
186
- var CardTitle = React5.forwardRef(
187
- ({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement("h3", { "data-flap-ui": "card-title", ref, className: cn("text-base font-semibold uppercase leading-tight tracking-normal text-white sm:text-lg", className), ...props })
188
- );
189
- CardTitle.displayName = "CardTitle";
190
- var CardDescription = React5.forwardRef(
191
- ({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
192
- );
193
- CardDescription.displayName = "CardDescription";
194
- var CardContent = React5.forwardRef(
195
- ({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
196
- );
197
- CardContent.displayName = "CardContent";
198
- function formatMs(ms) {
199
- const safe = Math.max(0, ms);
200
- const totalSeconds = Math.floor(safe / 1e3);
201
- const days = Math.floor(totalSeconds / 86400);
202
- const hours = Math.floor(totalSeconds % 86400 / 3600);
203
- const minutes = Math.floor(totalSeconds % 3600 / 60);
204
- const seconds = totalSeconds % 60;
205
- if (days > 0) return `${days}d ${hours}h ${minutes}m`;
206
- if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
207
- return `${minutes}m ${seconds}s`;
208
- }
209
- function Countdown({ targetTimeMs, fallback = "-" }) {
210
- const [now, setNow] = useState(() => Date.now());
211
- useEffect(() => {
212
- const timer = window.setInterval(() => setNow(Date.now()), 1e3);
213
- return () => window.clearInterval(timer);
214
- }, []);
215
- const text = useMemo(() => {
216
- if (!targetTimeMs) return fallback;
217
- return formatMs(targetTimeMs - now);
218
- }, [fallback, now, targetTimeMs]);
219
- return /* @__PURE__ */ React.createElement("span", null, text);
220
- }
221
-
222
- // src/ui/DataRow.tsx
223
- function DataRow({ label, value, detail, className }) {
224
- return /* @__PURE__ */ React.createElement("div", { className: cn("flex items-start justify-between gap-4 border-b border-white/8 py-3 last:border-0", className) }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0 text-sm text-white/54" }, label), /* @__PURE__ */ React.createElement("div", { className: "min-w-0 text-right" }, /* @__PURE__ */ React.createElement("div", { className: "break-words text-sm font-semibold text-white" }, value), detail ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 text-xs text-white/42" }, detail) : null));
225
- }
226
-
227
- // src/ui/DetailTile.tsx
228
- var toneClass2 = {
229
- default: "border-[#303236] bg-[#0B0D0E]",
230
- primary: "border-[#D0FF00]/70 bg-[#101400]",
231
- success: "border-[#2EDEDB]/45 bg-[#061615]",
232
- warning: "border-[#FFD166]/45 bg-[#1A1305]",
233
- muted: "border-[#303236] bg-black"
234
- };
235
- function DetailTile({ label, value, detail, icon, tone = "default", className, valueClassName }) {
236
- return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-[6px] border p-3", toneClass2[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "flex min-w-0 items-center gap-2 text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, icon ? /* @__PURE__ */ React.createElement("span", { className: "shrink-0 text-[#D0FF00]" }, icon) : null, /* @__PURE__ */ React.createElement("span", { className: "min-w-0 truncate" }, label)), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 min-w-0 break-words text-base font-semibold leading-snug text-white", valueClassName) }, value), detail ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 min-w-0 break-words text-xs leading-5 text-[#84888C]" }, detail) : null);
237
- }
238
- var COPY = {
239
- en: {
240
- title: "THIRD-PARTY WARNING",
241
- heading: "YOU ARE LEAVING FLAP",
242
- description: "You are about to visit a third-party page maintained by an external developer. This site is not operated by FLAP and may contain unknown security or privacy risks.",
243
- destinationLabel: "Destination",
244
- invalidDestination: "Unsupported destination",
245
- acknowledge: "I understand the risks and want to proceed",
246
- cancel: "CLOSE",
247
- proceed: "CONTINUE"
248
- },
249
- zh: {
250
- title: "\u7B2C\u4E09\u65B9\u98CE\u9669\u63D0\u793A",
251
- heading: "\u60A8\u5373\u5C06\u79BB\u5F00 FLAP",
252
- description: "\u60A8\u5373\u5C06\u8BBF\u95EE\u7531\u5916\u90E8\u5F00\u53D1\u8005\u7EF4\u62A4\u7684\u7B2C\u4E09\u65B9\u9875\u9762\u3002\u8BE5\u7AD9\u70B9\u4E0D\u7531 FLAP \u8FD0\u8425\uFF0C\u53EF\u80FD\u5B58\u5728\u672A\u77E5\u7684\u5B89\u5168\u6216\u9690\u79C1\u98CE\u9669\u3002",
253
- destinationLabel: "\u76EE\u6807\u5730\u5740",
254
- invalidDestination: "\u4E0D\u652F\u6301\u7684\u76EE\u6807\u5730\u5740",
255
- acknowledge: "\u6211\u5DF2\u4E86\u89E3\u98CE\u9669\u5E76\u5E0C\u671B\u7EE7\u7EED",
256
- cancel: "\u5173\u95ED",
257
- proceed: "\u7EE7\u7EED"
258
- }
259
- };
260
- function resolveLocale(locale) {
261
- return locale && locale.toLowerCase().startsWith("zh") ? "zh" : "en";
262
- }
263
- function normalizeExternalUrl(url) {
264
- try {
265
- const parsed = new URL(url);
266
- if (parsed.protocol !== "https:" || parsed.username || parsed.password) return null;
267
- return parsed.href;
268
- } catch {
269
- return null;
270
- }
271
- }
272
- function WarningIcon({ className }) {
273
- return /* @__PURE__ */ React5.createElement("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className }, /* @__PURE__ */ React5.createElement("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }), /* @__PURE__ */ React5.createElement("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }), /* @__PURE__ */ React5.createElement("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }), /* @__PURE__ */ React5.createElement("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }), /* @__PURE__ */ React5.createElement("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }), /* @__PURE__ */ React5.createElement("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }), /* @__PURE__ */ React5.createElement("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }), /* @__PURE__ */ React5.createElement("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }), /* @__PURE__ */ React5.createElement("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }), /* @__PURE__ */ React5.createElement("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }), /* @__PURE__ */ React5.createElement("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }), /* @__PURE__ */ React5.createElement("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }), /* @__PURE__ */ React5.createElement("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }), /* @__PURE__ */ React5.createElement("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }), /* @__PURE__ */ React5.createElement("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React5.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }), /* @__PURE__ */ React5.createElement("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React5.createElement("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React5.createElement("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }), /* @__PURE__ */ React5.createElement("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }), /* @__PURE__ */ React5.createElement("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" }));
274
- }
275
- function ExternalLink2({ url, children, locale, className, copy }) {
276
- const [open, setOpen] = React5.useState(false);
277
- const [acknowledged, setAcknowledged] = React5.useState(false);
278
- const [mounted, setMounted] = React5.useState(false);
279
- const text = { ...COPY[resolveLocale(locale)], ...copy };
280
- const safeUrl = React5.useMemo(() => normalizeExternalUrl(url), [url]);
281
- const canProceed = acknowledged && Boolean(safeUrl);
282
- React5.useEffect(() => {
283
- setMounted(true);
284
- }, []);
285
- const close = React5.useCallback(() => {
286
- setOpen(false);
287
- setAcknowledged(false);
288
- }, []);
289
- React5.useEffect(() => {
290
- if (!open) return;
291
- const onKey = (event) => {
292
- if (event.key === "Escape") close();
293
- };
294
- document.addEventListener("keydown", onKey);
295
- const previousOverflow = document.body.style.overflow;
296
- document.body.style.overflow = "hidden";
297
- return () => {
298
- document.removeEventListener("keydown", onKey);
299
- document.body.style.overflow = previousOverflow;
300
- };
301
- }, [open, close]);
302
- const proceed = () => {
303
- if (!canProceed || !safeUrl) return;
304
- window.open(safeUrl, "_blank", "noopener,noreferrer");
305
- close();
306
- };
307
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(
308
- "button",
309
- {
310
- type: "button",
311
- "data-flap-ui": "external-link",
312
- onClick: () => setOpen(true),
313
- className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
314
- },
315
- /* @__PURE__ */ React5.createElement("span", { className: "truncate" }, children),
316
- /* @__PURE__ */ React5.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
317
- ), open && mounted ? createPortal(
318
- /* @__PURE__ */ React5.createElement(
319
- "div",
320
- {
321
- className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
322
- style: { zIndex: 2147483647 },
323
- onClick: close
324
- },
325
- /* @__PURE__ */ React5.createElement(
326
- "div",
327
- {
328
- role: "dialog",
329
- "aria-modal": "true",
330
- "aria-label": text.title,
331
- onClick: (event) => event.stopPropagation(),
332
- style: {
333
- width: "min(540px, 100%)",
334
- maxHeight: "calc(100vh - 2rem)",
335
- fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
336
- backgroundColor: "#070808",
337
- border: "1px solid #414141"
338
- },
339
- className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
340
- },
341
- /* @__PURE__ */ React5.createElement(
342
- "div",
343
- {
344
- className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
345
- style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
346
- },
347
- /* @__PURE__ */ React5.createElement(
348
- "span",
349
- {
350
- className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
351
- style: { lineHeight: 1 }
352
- },
353
- /* @__PURE__ */ React5.createElement("span", { className: "text-[#d0ff00]" }, "//"),
354
- text.title
355
- ),
356
- /* @__PURE__ */ React5.createElement(
357
- "button",
358
- {
359
- type: "button",
360
- onClick: close,
361
- "aria-label": text.cancel,
362
- className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white"
363
- },
364
- /* @__PURE__ */ React5.createElement(X, { className: "h-3.5 w-3.5" })
365
- )
366
- ),
367
- /* @__PURE__ */ React5.createElement("div", { className: "flex flex-col gap-6 overflow-y-auto p-6" }, /* @__PURE__ */ React5.createElement("div", { className: "flex flex-col items-center gap-5" }, /* @__PURE__ */ React5.createElement(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }), /* @__PURE__ */ React5.createElement("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]" }, text.heading)), /* @__PURE__ */ React5.createElement("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]" }, text.description), /* @__PURE__ */ React5.createElement("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]" }, /* @__PURE__ */ React5.createElement("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]" }, text.destinationLabel), /* @__PURE__ */ React5.createElement("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url }, safeUrl ? new URL(safeUrl).host : text.invalidDestination)), /* @__PURE__ */ React5.createElement("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white" }, /* @__PURE__ */ React5.createElement(
368
- "input",
369
- {
370
- type: "checkbox",
371
- checked: acknowledged,
372
- onChange: (event) => setAcknowledged(event.target.checked),
373
- className: "sr-only"
374
- }
375
- ), /* @__PURE__ */ React5.createElement(
376
- "span",
377
- {
378
- "aria-hidden": "true",
379
- className: cn(
380
- "flex size-4 shrink-0 items-center justify-center border",
381
- acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
382
- )
383
- },
384
- acknowledged ? /* @__PURE__ */ React5.createElement("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2 }, /* @__PURE__ */ React5.createElement("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" })) : null
385
- ), /* @__PURE__ */ React5.createElement("span", { className: "min-w-0" }, text.acknowledge)), /* @__PURE__ */ React5.createElement("div", { className: "flex gap-6" }, /* @__PURE__ */ React5.createElement(
386
- "button",
387
- {
388
- type: "button",
389
- onClick: close,
390
- className: "flex flex-1 items-center justify-center rounded-[2px] border border-[#84888c] bg-transparent py-3 text-[14px] font-bold uppercase tracking-[-0.4px] text-white transition-colors hover:border-white"
391
- },
392
- text.cancel
393
- ), /* @__PURE__ */ React5.createElement(
394
- "button",
395
- {
396
- type: "button",
397
- onClick: proceed,
398
- disabled: !canProceed,
399
- style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
400
- className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors"
401
- },
402
- text.proceed
403
- )))
404
- )
405
- ),
406
- document.body
407
- ) : null);
408
- }
409
- var Input = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React5.createElement(
410
- "input",
411
- {
412
- "data-flap-ui": "input",
413
- ref,
414
- className: cn(
415
- "flex h-11 w-full rounded-[6px] border border-[#303236] bg-black px-3 py-2 text-sm font-semibold text-white caret-[#D0FF00] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)] outline-none duration-0 selection:bg-[#D0FF00]/35 selection:text-white placeholder:text-[#84888C] focus:border-[#D0FF00] focus:ring-2 focus:ring-[#D0FF00]/25 disabled:cursor-not-allowed disabled:bg-[#131516] disabled:text-[#84888C] disabled:opacity-80",
416
- className
417
- ),
418
- ...props
419
- }
420
- ));
421
- Input.displayName = "Input";
422
- function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
423
- const urls = React5.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
424
- const [urlIndex, setUrlIndex] = React5.useState(0);
425
- const src = urls[urlIndex];
426
- React5.useEffect(() => {
427
- setUrlIndex(0);
428
- }, [cid, path]);
429
- if (!src) return null;
430
- return (
431
- // eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
432
- /* @__PURE__ */ React5.createElement(
433
- "img",
434
- {
435
- ...props,
436
- alt,
437
- className: cn("block max-w-full", className),
438
- decoding,
439
- loading,
440
- onError: (event) => {
441
- if (urlIndex < urls.length - 1) {
442
- setUrlIndex((index) => Math.min(index + 1, urls.length - 1));
443
- return;
444
- }
445
- onError?.(event);
446
- },
447
- src
448
- }
449
- )
450
- );
451
- }
452
- function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
453
- return /* @__PURE__ */ React5.createElement("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className) }, /* @__PURE__ */ React5.createElement(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }), overlayClassName ? /* @__PURE__ */ React5.createElement("div", { className: cn("absolute inset-0", overlayClassName) }) : null);
454
- }
455
- var RuntimeContext = createContext(null);
456
- function useFlapSdk() {
457
- const sdk = useContext(RuntimeContext);
458
- if (!sdk) throw new Error("useFlapSdk must be used within VaultRuntimeProvider.");
459
- return sdk;
460
- }
461
- function useVaultContext() {
462
- return useFlapSdk().context;
463
- }
464
- function useFlapI18n() {
465
- return useFlapSdk().i18n;
466
- }
467
- function useFlapNotify() {
468
- return useFlapSdk().notify;
469
- }
470
- function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
471
- const sdk = useFlapSdk();
472
- const [metadata, setMetadata] = React5.useState(null);
473
- const [state, setState] = React5.useState("loading");
474
- React5.useEffect(() => {
475
- let cancelled = false;
476
- setState("loading");
477
- setMetadata(null);
478
- sdk.readNftMetadata({ tokenId }).then((nextMetadata) => {
479
- if (cancelled) return;
480
- setMetadata(nextMetadata);
481
- setState("ready");
482
- }).catch(() => {
483
- if (!cancelled) setState("error");
484
- });
485
- return () => {
486
- cancelled = true;
487
- };
488
- }, [sdk, sdk.refetchNonce, tokenId]);
489
- if (state !== "ready" || !metadata) {
490
- return /* @__PURE__ */ React5.createElement("span", { "data-flap-nft-media-state": state, className: cn("block", className) }, fallback);
491
- }
492
- return (
493
- // eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
494
- /* @__PURE__ */ React5.createElement(
495
- "img",
496
- {
497
- ...props,
498
- alt,
499
- className: cn("block max-w-full", className),
500
- "data-flap-nft-media-source": metadata.source,
501
- "data-flap-nft-media-state": state,
502
- decoding,
503
- loading,
504
- onError: (event) => {
505
- setState("error");
506
- onError?.(event);
507
- },
508
- src: metadata.imageDataUrl
509
- }
510
- )
511
- );
512
- }
513
-
514
- // src/ui/Metric.tsx
515
- var toneClass3 = {
516
- default: "border-[#303236] bg-[#0B0D0E]",
517
- primary: "border-[#D0FF00]/70 bg-[#101400]",
518
- success: "border-[#2EDEDB]/45 bg-[#061615]",
519
- warning: "border-[#FFD166]/45 bg-[#1A1305]",
520
- muted: "border-[#303236] bg-black"
521
- };
522
- var valueToneClass = {
523
- default: "text-white",
524
- primary: "text-[#D0FF00]",
525
- success: "text-[#2EDEDB]",
526
- warning: "text-[#FFD166]",
527
- muted: "text-white"
528
- };
529
- function Metric({ label, value, hint, tone = "default", className }) {
530
- return /* @__PURE__ */ React.createElement("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className) }, /* @__PURE__ */ React.createElement("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]" }, label), /* @__PURE__ */ React.createElement("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]) }, value), hint ? /* @__PURE__ */ React.createElement("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]" }, hint) : null);
531
- }
532
- function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
533
- const {
534
- allow: _allow,
535
- referrerPolicy: _referrerPolicy,
536
- sandbox: _sandbox,
537
- src: _src,
538
- srcDoc: _srcDoc,
539
- title: _title,
540
- ...safeProps
541
- } = props;
542
- return /* @__PURE__ */ React5.createElement(
543
- "iframe",
544
- {
545
- ...safeProps,
546
- "data-frame-id": frameId,
547
- "data-frame-provider": provider,
548
- src,
549
- title,
550
- loading: "lazy",
551
- referrerPolicy: "no-referrer",
552
- sandbox: "allow-scripts allow-same-origin",
553
- className: cn("min-h-[360px] w-full rounded-lg border border-[#3a4d66] bg-[#0b111a]", className)
554
- }
555
- );
556
- }
557
-
558
- // src/ui/StatusBadge.tsx
559
- var toneClass4 = {
560
- neutral: "border-[#303236] bg-black text-[#D4D4D4]",
561
- success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
562
- warning: "border-[#FFD166]/55 bg-[#1A1305] text-[#FFD166]",
563
- danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
564
- };
565
- function StatusBadge({ children, tone = "neutral" }) {
566
- return /* @__PURE__ */ React.createElement("span", { "data-flap-ui": "status-badge", className: cn("inline-flex items-center rounded-[6px] border px-2.5 py-1 text-xs font-semibold uppercase leading-none", toneClass4[tone]) }, children);
567
- }
568
-
569
- // src/ui/TxButton.tsx
570
- var labels = {
571
- idle: "",
572
- validating: "Validating",
573
- approving: "Approving",
574
- approval_confirming: "Confirming approval",
575
- simulating: "Simulating",
576
- writing: "Sending",
577
- confirming: "Confirming",
578
- success: "Done",
579
- failed: "Retry"
580
- };
581
- function TxButton({ state = "idle", idleLabel, children, ...props }) {
582
- const loading = ["validating", "approving", "approval_confirming", "simulating", "writing", "confirming"].includes(state);
583
- return /* @__PURE__ */ React.createElement(Button, { loading, ...props }, children || labels[state] || idleLabel);
584
- }
585
- function VaultBanner({ title, description, badges, meta, action, icon, className }) {
586
- return /* @__PURE__ */ React.createElement(
587
- "section",
588
- {
589
- className: cn(
590
- "rounded-lg border border-[#3b82f6] bg-[#172a5a] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
591
- className
592
- )
593
- },
594
- /* @__PURE__ */ React.createElement("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" }, /* @__PURE__ */ React.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React.createElement("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[#8fc8ff]" }, icon ?? /* @__PURE__ */ React.createElement(ShieldCheck, { className: "h-4 w-4" })), /* @__PURE__ */ React.createElement("h3", { className: "min-w-0 text-base font-semibold leading-tight text-white" }, title), badges), /* @__PURE__ */ React.createElement("p", { className: "mt-3 max-w-3xl text-sm font-medium leading-6 text-[#d8e2ef]" }, description), meta ? /* @__PURE__ */ React.createElement("div", { className: "mt-2 text-xs font-medium leading-5 text-[#92a4bd]" }, meta) : null), action ? /* @__PURE__ */ React.createElement("div", { className: "shrink-0" }, action) : null)
595
- );
596
- }
597
-
598
- export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink2 as ExternalLink, Input, IpfsBackground, IpfsImage, Metric, NftMetadataImage, ReviewedFrame, RuntimeContext, StatusBadge, TxButton, VaultBanner, buttonVariants, isIpfsImageCid, normalizeIpfsImagePath, resolveIpfsImageUrl, resolveIpfsImageUrls, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
599
- //# sourceMappingURL=chunk-4S6TVBHU.js.map
600
- //# sourceMappingURL=chunk-4S6TVBHU.js.map