@flapsdk/vault-runtime 0.1.35 → 0.1.36
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/{chunk-XFA3GRXH.js → chunk-IN34R3DY.js} +476 -326
- package/chunk-IN34R3DY.js.map +1 -0
- package/{chunk-3CP5VSNK.js → chunk-QLVWFL4T.js} +87 -18
- package/chunk-QLVWFL4T.js.map +1 -0
- package/host-client.d.mts +1 -1
- package/host-client.js +2 -2
- package/host.d.mts +4 -4
- package/{hostRuntimeConfig-Dl9t_R9u.d.mts → hostRuntimeConfig-DAz-f577.d.mts} +1 -1
- package/package.json +2 -2
- package/runtime-contract.json +1 -1
- package/sdk.d.mts +3 -3
- package/sdk.js +3 -3
- package/server.d.mts +3 -3
- package/{txError-uPZICnzz.d.mts → txError-DmiNOh9R.d.mts} +1 -1
- package/{types-_ifYbddY.d.mts → types-BbjEsfiD.d.mts} +2 -0
- package/ui.d.mts +1 -1
- package/ui.js +1 -1
- package/chunk-3CP5VSNK.js.map +0 -1
- package/chunk-XFA3GRXH.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { shortenAddress, isValidAddress, ZERO_ADDRESS } from './chunk-B4WKI3EW.js';
|
|
2
2
|
import { isIpfsImageCid, resolveIpfsImageUrls, resolveIpfsImageUrl } from './chunk-SAG36LUR.js';
|
|
3
3
|
import { getTaxVaultHostChainConfig } from './chunk-FUOBTZMQ.js';
|
|
4
|
-
import * as
|
|
4
|
+
import * as React8 from 'react';
|
|
5
5
|
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
6
6
|
import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck, Play, Pause, VolumeX, Volume2, Maximize, SkipBack, ChevronLeft, ChevronRight, SkipForward } from 'lucide-react';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
8
|
import { clsx } from 'clsx';
|
|
8
9
|
import { twMerge } from 'tailwind-merge';
|
|
9
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
@@ -81,16 +82,17 @@ function useFlapNotify() {
|
|
|
81
82
|
return useFlapSdk().notify;
|
|
82
83
|
}
|
|
83
84
|
function AddressLink({ address, explorerBaseUrl, label }) {
|
|
84
|
-
if (!address) return /* @__PURE__ */
|
|
85
|
+
if (!address) return /* @__PURE__ */ jsx("span", { children: "-" });
|
|
85
86
|
const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
|
|
86
|
-
const content = /* @__PURE__ */
|
|
87
|
-
|
|
87
|
+
const content = /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 items-center gap-1 text-primary", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label || shortenAddress(address) }),
|
|
89
|
+
href ? /* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5 shrink-0" }) : null
|
|
90
|
+
] });
|
|
91
|
+
return href ? /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noreferrer", children: content }) : content;
|
|
88
92
|
}
|
|
89
93
|
function cn(...inputs) {
|
|
90
94
|
return twMerge(clsx(inputs));
|
|
91
95
|
}
|
|
92
|
-
|
|
93
|
-
// src/ui/Alert.tsx
|
|
94
96
|
var toneClass = {
|
|
95
97
|
info: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
96
98
|
success: "border-[#D0FF00]/45 bg-[#101400] text-[#D0FF00]",
|
|
@@ -105,7 +107,10 @@ var iconMap = {
|
|
|
105
107
|
};
|
|
106
108
|
function Alert({ children, tone = "info", className }) {
|
|
107
109
|
const Icon = iconMap[tone];
|
|
108
|
-
return /* @__PURE__ */
|
|
110
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "alert", className: cn("flex gap-3 rounded-[6px] border p-3 text-sm font-medium leading-6", toneClass[tone], className), children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Icon, { className: "mt-0.5 h-4 w-4 shrink-0 opacity-90" }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 break-words", children })
|
|
113
|
+
] });
|
|
109
114
|
}
|
|
110
115
|
var buttonVariants = cva(
|
|
111
116
|
"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",
|
|
@@ -131,23 +136,25 @@ var buttonVariants = cva(
|
|
|
131
136
|
}
|
|
132
137
|
}
|
|
133
138
|
);
|
|
134
|
-
var Button =
|
|
139
|
+
var Button = React8.forwardRef(
|
|
135
140
|
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
136
141
|
const Comp = asChild ? Slot : "button";
|
|
137
142
|
if (asChild) {
|
|
138
|
-
return /* @__PURE__ */
|
|
143
|
+
return /* @__PURE__ */ jsx(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props, children });
|
|
139
144
|
}
|
|
140
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
141
146
|
Comp,
|
|
142
147
|
{
|
|
143
148
|
"data-flap-ui": "button",
|
|
144
149
|
className: cn(buttonVariants({ variant, size, className })),
|
|
145
150
|
ref,
|
|
146
151
|
disabled: disabled || loading,
|
|
147
|
-
...props
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
...props,
|
|
153
|
+
children: [
|
|
154
|
+
loading ? /* @__PURE__ */ jsx(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
155
|
+
/* @__PURE__ */ jsx("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2", children })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
151
158
|
);
|
|
152
159
|
}
|
|
153
160
|
);
|
|
@@ -170,11 +177,9 @@ function normalizeBinanceImageUrl(value) {
|
|
|
170
177
|
return null;
|
|
171
178
|
}
|
|
172
179
|
}
|
|
173
|
-
|
|
174
|
-
// src/ui/BinanceImage.tsx
|
|
175
180
|
function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
|
|
176
|
-
const safeSrc =
|
|
177
|
-
const [failedSrc, setFailedSrc] =
|
|
181
|
+
const safeSrc = React8.useMemo(() => normalizeBinanceImageUrl(src), [src]);
|
|
182
|
+
const [failedSrc, setFailedSrc] = React8.useState(null);
|
|
178
183
|
const {
|
|
179
184
|
alt: _unsafeAlt,
|
|
180
185
|
decoding: _unsafeDecoding,
|
|
@@ -185,11 +190,11 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
185
190
|
...imageProps
|
|
186
191
|
} = props;
|
|
187
192
|
if (!safeSrc || failedSrc === safeSrc) {
|
|
188
|
-
return /* @__PURE__ */
|
|
193
|
+
return /* @__PURE__ */ jsx("span", { className: cn("block", className), "data-flap-binance-image-state": safeSrc ? "error" : "invalid", children: fallback });
|
|
189
194
|
}
|
|
190
195
|
return (
|
|
191
196
|
// eslint-disable-next-line @next/next/no-img-element -- BinanceImage owns the exact-host runtime boundary and browser loading policy.
|
|
192
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ jsx(
|
|
193
198
|
"img",
|
|
194
199
|
{
|
|
195
200
|
...imageProps,
|
|
@@ -208,7 +213,7 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
208
213
|
)
|
|
209
214
|
);
|
|
210
215
|
}
|
|
211
|
-
var Card =
|
|
216
|
+
var Card = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
212
217
|
"div",
|
|
213
218
|
{
|
|
214
219
|
"data-flap-ui": "card",
|
|
@@ -221,20 +226,20 @@ var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
221
226
|
}
|
|
222
227
|
));
|
|
223
228
|
Card.displayName = "Card";
|
|
224
|
-
var CardHeader =
|
|
225
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
229
|
+
var CardHeader = React8.forwardRef(
|
|
230
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
226
231
|
);
|
|
227
232
|
CardHeader.displayName = "CardHeader";
|
|
228
|
-
var CardTitle =
|
|
229
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
233
|
+
var CardTitle = React8.forwardRef(
|
|
234
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("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 })
|
|
230
235
|
);
|
|
231
236
|
CardTitle.displayName = "CardTitle";
|
|
232
|
-
var CardDescription =
|
|
233
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
237
|
+
var CardDescription = React8.forwardRef(
|
|
238
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
234
239
|
);
|
|
235
240
|
CardDescription.displayName = "CardDescription";
|
|
236
|
-
var CardContent =
|
|
237
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
241
|
+
var CardContent = React8.forwardRef(
|
|
242
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
238
243
|
);
|
|
239
244
|
CardContent.displayName = "CardContent";
|
|
240
245
|
function formatMs(ms) {
|
|
@@ -258,15 +263,17 @@ function Countdown({ targetTimeMs, fallback = "-" }) {
|
|
|
258
263
|
if (!targetTimeMs) return fallback;
|
|
259
264
|
return formatMs(targetTimeMs - now);
|
|
260
265
|
}, [fallback, now, targetTimeMs]);
|
|
261
|
-
return /* @__PURE__ */
|
|
266
|
+
return /* @__PURE__ */ jsx("span", { children: text });
|
|
262
267
|
}
|
|
263
|
-
|
|
264
|
-
// src/ui/DataRow.tsx
|
|
265
268
|
function DataRow({ label, value, detail, className }) {
|
|
266
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start justify-between gap-4 border-b border-white/8 py-3 last:border-0", className), children: [
|
|
270
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 text-sm text-white/54", children: label }),
|
|
271
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 text-right", children: [
|
|
272
|
+
/* @__PURE__ */ jsx("div", { className: "break-words text-sm font-semibold text-white", children: value }),
|
|
273
|
+
detail ? /* @__PURE__ */ jsx("div", { className: "mt-1 text-xs text-white/42", children: detail }) : null
|
|
274
|
+
] })
|
|
275
|
+
] });
|
|
267
276
|
}
|
|
268
|
-
|
|
269
|
-
// src/ui/DetailTile.tsx
|
|
270
277
|
var toneClass2 = {
|
|
271
278
|
default: "border-[#303236] bg-[#0B0D0E]",
|
|
272
279
|
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
@@ -275,7 +282,14 @@ var toneClass2 = {
|
|
|
275
282
|
muted: "border-[#303236] bg-black"
|
|
276
283
|
};
|
|
277
284
|
function DetailTile({ label, value, detail, icon, tone = "default", className, valueClassName }) {
|
|
278
|
-
return /* @__PURE__ */
|
|
285
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "detail-tile", className: cn("min-w-0 rounded-[6px] border p-3", toneClass2[tone], className), children: [
|
|
286
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2 text-xs font-medium uppercase leading-[1.4] text-[#84888C]", children: [
|
|
287
|
+
icon ? /* @__PURE__ */ jsx("span", { className: "shrink-0 text-[#D0FF00]", children: icon }) : null,
|
|
288
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: label })
|
|
289
|
+
] }),
|
|
290
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-2 min-w-0 break-words text-base font-semibold leading-snug text-white", valueClassName), children: value }),
|
|
291
|
+
detail ? /* @__PURE__ */ jsx("div", { className: "mt-1 min-w-0 break-words text-xs leading-5 text-[#84888C]", children: detail }) : null
|
|
292
|
+
] });
|
|
279
293
|
}
|
|
280
294
|
var COPY = {
|
|
281
295
|
en: {
|
|
@@ -312,23 +326,57 @@ function normalizeExternalUrl(url) {
|
|
|
312
326
|
}
|
|
313
327
|
}
|
|
314
328
|
function WarningIcon({ className }) {
|
|
315
|
-
return /* @__PURE__ */
|
|
329
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className, children: [
|
|
330
|
+
/* @__PURE__ */ jsx("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }),
|
|
331
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }),
|
|
332
|
+
/* @__PURE__ */ jsx("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }),
|
|
333
|
+
/* @__PURE__ */ jsx("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }),
|
|
334
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }),
|
|
335
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }),
|
|
336
|
+
/* @__PURE__ */ jsx("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }),
|
|
337
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }),
|
|
338
|
+
/* @__PURE__ */ jsx("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }),
|
|
339
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }),
|
|
340
|
+
/* @__PURE__ */ jsx("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }),
|
|
341
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }),
|
|
342
|
+
/* @__PURE__ */ jsx("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }),
|
|
343
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }),
|
|
344
|
+
/* @__PURE__ */ jsx("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }),
|
|
345
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }),
|
|
346
|
+
/* @__PURE__ */ jsx("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }),
|
|
347
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }),
|
|
348
|
+
/* @__PURE__ */ jsx("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }),
|
|
349
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }),
|
|
350
|
+
/* @__PURE__ */ jsx("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }),
|
|
351
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }),
|
|
352
|
+
/* @__PURE__ */ jsx("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }),
|
|
353
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }),
|
|
354
|
+
/* @__PURE__ */ jsx("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }),
|
|
355
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }),
|
|
356
|
+
/* @__PURE__ */ jsx("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }),
|
|
357
|
+
/* @__PURE__ */ jsx("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }),
|
|
358
|
+
/* @__PURE__ */ jsx("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }),
|
|
359
|
+
/* @__PURE__ */ jsx("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }),
|
|
360
|
+
/* @__PURE__ */ jsx("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }),
|
|
361
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }),
|
|
362
|
+
/* @__PURE__ */ jsx("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" })
|
|
363
|
+
] });
|
|
316
364
|
}
|
|
317
365
|
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
318
|
-
const [open, setOpen] =
|
|
319
|
-
const [acknowledged, setAcknowledged] =
|
|
320
|
-
const [mounted, setMounted] =
|
|
366
|
+
const [open, setOpen] = React8.useState(false);
|
|
367
|
+
const [acknowledged, setAcknowledged] = React8.useState(false);
|
|
368
|
+
const [mounted, setMounted] = React8.useState(false);
|
|
321
369
|
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
322
|
-
const safeUrl =
|
|
370
|
+
const safeUrl = React8.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
323
371
|
const canProceed = acknowledged && Boolean(safeUrl);
|
|
324
|
-
|
|
372
|
+
React8.useEffect(() => {
|
|
325
373
|
setMounted(true);
|
|
326
374
|
}, []);
|
|
327
|
-
const close =
|
|
375
|
+
const close = React8.useCallback(() => {
|
|
328
376
|
setOpen(false);
|
|
329
377
|
setAcknowledged(false);
|
|
330
378
|
}, []);
|
|
331
|
-
|
|
379
|
+
React8.useEffect(() => {
|
|
332
380
|
if (!open) return;
|
|
333
381
|
const onKey = (event) => {
|
|
334
382
|
if (event.key === "Escape") close();
|
|
@@ -346,109 +394,139 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
346
394
|
window.open(safeUrl, "_blank", "noopener,noreferrer");
|
|
347
395
|
close();
|
|
348
396
|
};
|
|
349
|
-
return /* @__PURE__ */
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
type: "button",
|
|
353
|
-
"data-flap-ui": "external-link",
|
|
354
|
-
onClick: () => setOpen(true),
|
|
355
|
-
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
|
|
356
|
-
},
|
|
357
|
-
/* @__PURE__ */ React11.createElement("span", { className: "truncate" }, children),
|
|
358
|
-
/* @__PURE__ */ React11.createElement(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
359
|
-
), open && mounted ? createPortal(
|
|
360
|
-
/* @__PURE__ */ React11.createElement(
|
|
361
|
-
"div",
|
|
397
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
398
|
+
/* @__PURE__ */ jsxs(
|
|
399
|
+
"button",
|
|
362
400
|
{
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
onClick:
|
|
366
|
-
|
|
367
|
-
|
|
401
|
+
type: "button",
|
|
402
|
+
"data-flap-ui": "external-link",
|
|
403
|
+
onClick: () => setOpen(true),
|
|
404
|
+
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className),
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children }),
|
|
407
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3.5 w-3.5 shrink-0", "aria-hidden": "true" })
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
open && mounted ? createPortal(
|
|
412
|
+
/* @__PURE__ */ jsx(
|
|
368
413
|
"div",
|
|
369
414
|
{
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
width: "min(540px, 100%)",
|
|
376
|
-
maxHeight: "calc(100vh - 2rem)",
|
|
377
|
-
fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
|
|
378
|
-
backgroundColor: "#070808",
|
|
379
|
-
border: "1px solid #414141"
|
|
380
|
-
},
|
|
381
|
-
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
|
|
382
|
-
},
|
|
383
|
-
/* @__PURE__ */ React11.createElement(
|
|
384
|
-
"div",
|
|
385
|
-
{
|
|
386
|
-
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
387
|
-
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
|
|
388
|
-
},
|
|
389
|
-
/* @__PURE__ */ React11.createElement(
|
|
390
|
-
"span",
|
|
415
|
+
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
416
|
+
style: { zIndex: 2147483647 },
|
|
417
|
+
onClick: close,
|
|
418
|
+
children: /* @__PURE__ */ jsxs(
|
|
419
|
+
"div",
|
|
391
420
|
{
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
"
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
421
|
+
role: "dialog",
|
|
422
|
+
"aria-modal": "true",
|
|
423
|
+
"aria-label": text.title,
|
|
424
|
+
onClick: (event) => event.stopPropagation(),
|
|
425
|
+
style: {
|
|
426
|
+
width: "min(540px, 100%)",
|
|
427
|
+
maxHeight: "calc(100vh - 2rem)",
|
|
428
|
+
fontFamily: "'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace",
|
|
429
|
+
backgroundColor: "#070808",
|
|
430
|
+
border: "1px solid #414141"
|
|
431
|
+
},
|
|
432
|
+
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel",
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsxs(
|
|
435
|
+
"div",
|
|
436
|
+
{
|
|
437
|
+
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
438
|
+
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 },
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsxs(
|
|
441
|
+
"span",
|
|
442
|
+
{
|
|
443
|
+
className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
|
|
444
|
+
style: { lineHeight: 1 },
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ jsx("span", { className: "text-[#d0ff00]", children: "//" }),
|
|
447
|
+
text.title
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
/* @__PURE__ */ jsx(
|
|
452
|
+
"button",
|
|
453
|
+
{
|
|
454
|
+
type: "button",
|
|
455
|
+
onClick: close,
|
|
456
|
+
"aria-label": text.cancel,
|
|
457
|
+
className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white",
|
|
458
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
]
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6 overflow-y-auto p-6", children: [
|
|
465
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-5", children: [
|
|
466
|
+
/* @__PURE__ */ jsx(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }),
|
|
467
|
+
/* @__PURE__ */ jsx("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]", children: text.heading })
|
|
468
|
+
] }),
|
|
469
|
+
/* @__PURE__ */ jsx("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]", children: text.description }),
|
|
470
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]", children: [
|
|
471
|
+
/* @__PURE__ */ jsx("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]", children: text.destinationLabel }),
|
|
472
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url, children: safeUrl ? new URL(safeUrl).host : text.invalidDestination })
|
|
473
|
+
] }),
|
|
474
|
+
/* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white", children: [
|
|
475
|
+
/* @__PURE__ */ jsx(
|
|
476
|
+
"input",
|
|
477
|
+
{
|
|
478
|
+
type: "checkbox",
|
|
479
|
+
checked: acknowledged,
|
|
480
|
+
onChange: (event) => setAcknowledged(event.target.checked),
|
|
481
|
+
className: "sr-only"
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ jsx(
|
|
485
|
+
"span",
|
|
486
|
+
{
|
|
487
|
+
"aria-hidden": "true",
|
|
488
|
+
className: cn(
|
|
489
|
+
"flex size-4 shrink-0 items-center justify-center border",
|
|
490
|
+
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
491
|
+
),
|
|
492
|
+
children: acknowledged ? /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" }) }) : null
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0", children: text.acknowledge })
|
|
496
|
+
] }),
|
|
497
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
498
|
+
/* @__PURE__ */ jsx(
|
|
499
|
+
"button",
|
|
500
|
+
{
|
|
501
|
+
type: "button",
|
|
502
|
+
onClick: close,
|
|
503
|
+
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",
|
|
504
|
+
children: text.cancel
|
|
505
|
+
}
|
|
506
|
+
),
|
|
507
|
+
/* @__PURE__ */ jsx(
|
|
508
|
+
"button",
|
|
509
|
+
{
|
|
510
|
+
type: "button",
|
|
511
|
+
onClick: proceed,
|
|
512
|
+
disabled: !canProceed,
|
|
513
|
+
style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
|
|
514
|
+
className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors",
|
|
515
|
+
children: text.proceed
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
] })
|
|
519
|
+
] })
|
|
520
|
+
]
|
|
521
|
+
}
|
|
407
522
|
)
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
checked: acknowledged,
|
|
414
|
-
onChange: (event) => setAcknowledged(event.target.checked),
|
|
415
|
-
className: "sr-only"
|
|
416
|
-
}
|
|
417
|
-
), /* @__PURE__ */ React11.createElement(
|
|
418
|
-
"span",
|
|
419
|
-
{
|
|
420
|
-
"aria-hidden": "true",
|
|
421
|
-
className: cn(
|
|
422
|
-
"flex size-4 shrink-0 items-center justify-center border",
|
|
423
|
-
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
424
|
-
)
|
|
425
|
-
},
|
|
426
|
-
acknowledged ? /* @__PURE__ */ React11.createElement("svg", { viewBox: "0 0 12 12", className: "h-3 w-3", fill: "none", stroke: "currentColor", strokeWidth: 2 }, /* @__PURE__ */ React11.createElement("path", { d: "M2 6.5 L5 9 L10 3", strokeLinecap: "square" })) : null
|
|
427
|
-
), /* @__PURE__ */ React11.createElement("span", { className: "min-w-0" }, text.acknowledge)), /* @__PURE__ */ React11.createElement("div", { className: "flex gap-6" }, /* @__PURE__ */ React11.createElement(
|
|
428
|
-
"button",
|
|
429
|
-
{
|
|
430
|
-
type: "button",
|
|
431
|
-
onClick: close,
|
|
432
|
-
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"
|
|
433
|
-
},
|
|
434
|
-
text.cancel
|
|
435
|
-
), /* @__PURE__ */ React11.createElement(
|
|
436
|
-
"button",
|
|
437
|
-
{
|
|
438
|
-
type: "button",
|
|
439
|
-
onClick: proceed,
|
|
440
|
-
disabled: !canProceed,
|
|
441
|
-
style: { backgroundColor: canProceed ? "#d0ff00" : "#536600", color: "#070808" },
|
|
442
|
-
className: "flex flex-1 items-center justify-center rounded-[2px] py-3 text-[14px] font-bold uppercase tracking-[-0.4px] transition-colors"
|
|
443
|
-
},
|
|
444
|
-
text.proceed
|
|
445
|
-
)))
|
|
446
|
-
)
|
|
447
|
-
),
|
|
448
|
-
document.body
|
|
449
|
-
) : null);
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
document.body
|
|
526
|
+
) : null
|
|
527
|
+
] });
|
|
450
528
|
}
|
|
451
|
-
var Input =
|
|
529
|
+
var Input = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
452
530
|
"input",
|
|
453
531
|
{
|
|
454
532
|
"data-flap-ui": "input",
|
|
@@ -462,16 +540,16 @@ var Input = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
462
540
|
));
|
|
463
541
|
Input.displayName = "Input";
|
|
464
542
|
function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
465
|
-
const urls =
|
|
466
|
-
const [urlIndex, setUrlIndex] =
|
|
543
|
+
const urls = React8.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
|
|
544
|
+
const [urlIndex, setUrlIndex] = React8.useState(0);
|
|
467
545
|
const src = urls[urlIndex];
|
|
468
|
-
|
|
546
|
+
React8.useEffect(() => {
|
|
469
547
|
setUrlIndex(0);
|
|
470
548
|
}, [cid, path]);
|
|
471
549
|
if (!src) return null;
|
|
472
550
|
return (
|
|
473
551
|
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
474
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ jsx(
|
|
475
553
|
"img",
|
|
476
554
|
{
|
|
477
555
|
...props,
|
|
@@ -492,13 +570,16 @@ function IpfsImage({ alt, cid, path, validationPath, className, decoding = "asyn
|
|
|
492
570
|
);
|
|
493
571
|
}
|
|
494
572
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
495
|
-
return /* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ jsxs("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className), children: [
|
|
574
|
+
/* @__PURE__ */ jsx(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }),
|
|
575
|
+
overlayClassName ? /* @__PURE__ */ jsx("div", { className: cn("absolute inset-0", overlayClassName) }) : null
|
|
576
|
+
] });
|
|
496
577
|
}
|
|
497
578
|
function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
498
579
|
const sdk = useFlapSdk();
|
|
499
|
-
const [metadata, setMetadata] =
|
|
500
|
-
const [state, setState] =
|
|
501
|
-
|
|
580
|
+
const [metadata, setMetadata] = React8.useState(null);
|
|
581
|
+
const [state, setState] = React8.useState("loading");
|
|
582
|
+
React8.useEffect(() => {
|
|
502
583
|
let cancelled = false;
|
|
503
584
|
setState("loading");
|
|
504
585
|
setMetadata(null);
|
|
@@ -514,11 +595,11 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
514
595
|
};
|
|
515
596
|
}, [sdk, sdk.refetchNonce, tokenId]);
|
|
516
597
|
if (state !== "ready" || !metadata) {
|
|
517
|
-
return /* @__PURE__ */
|
|
598
|
+
return /* @__PURE__ */ jsx("span", { "data-flap-nft-media-state": state, className: cn("block", className), children: fallback });
|
|
518
599
|
}
|
|
519
600
|
return (
|
|
520
601
|
// eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
|
|
521
|
-
/* @__PURE__ */
|
|
602
|
+
/* @__PURE__ */ jsx(
|
|
522
603
|
"img",
|
|
523
604
|
{
|
|
524
605
|
...props,
|
|
@@ -537,8 +618,6 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
537
618
|
)
|
|
538
619
|
);
|
|
539
620
|
}
|
|
540
|
-
|
|
541
|
-
// src/ui/Metric.tsx
|
|
542
621
|
var toneClass3 = {
|
|
543
622
|
default: "border-[#303236] bg-[#0B0D0E]",
|
|
544
623
|
primary: "border-[#D0FF00]/70 bg-[#101400]",
|
|
@@ -554,7 +633,11 @@ var valueToneClass = {
|
|
|
554
633
|
muted: "text-white"
|
|
555
634
|
};
|
|
556
635
|
function Metric({ label, value, hint, tone = "default", className }) {
|
|
557
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ jsxs("div", { "data-flap-ui": "metric", className: cn("rounded-[6px] border p-3", toneClass3[tone], className), children: [
|
|
637
|
+
/* @__PURE__ */ jsx("div", { className: "truncate text-xs font-medium uppercase leading-[1.4] text-[#84888C]", children: label }),
|
|
638
|
+
/* @__PURE__ */ jsx("div", { className: cn("mt-2 break-words text-xl font-semibold tracking-normal", valueToneClass[tone]), children: value }),
|
|
639
|
+
hint ? /* @__PURE__ */ jsx("div", { className: "mt-1 truncate text-xs text-[#D4D4D4]", children: hint }) : null
|
|
640
|
+
] });
|
|
558
641
|
}
|
|
559
642
|
function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
560
643
|
const {
|
|
@@ -566,7 +649,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
566
649
|
title: _title,
|
|
567
650
|
...safeProps
|
|
568
651
|
} = props;
|
|
569
|
-
return /* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsx(
|
|
570
653
|
"iframe",
|
|
571
654
|
{
|
|
572
655
|
...safeProps,
|
|
@@ -581,8 +664,6 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
581
664
|
}
|
|
582
665
|
);
|
|
583
666
|
}
|
|
584
|
-
|
|
585
|
-
// src/ui/StatusBadge.tsx
|
|
586
667
|
var toneClass4 = {
|
|
587
668
|
neutral: "border-[#303236] bg-black text-[#D4D4D4]",
|
|
588
669
|
success: "border-[#D0FF00]/65 bg-[#101400] text-[#D0FF00]",
|
|
@@ -590,10 +671,8 @@ var toneClass4 = {
|
|
|
590
671
|
danger: "border-[#FF4A55]/65 bg-[#1D0709] text-[#FF8A91]"
|
|
591
672
|
};
|
|
592
673
|
function StatusBadge({ children, tone = "neutral" }) {
|
|
593
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsx("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 });
|
|
594
675
|
}
|
|
595
|
-
|
|
596
|
-
// src/ui/TxButton.tsx
|
|
597
676
|
var labels = {
|
|
598
677
|
idle: "",
|
|
599
678
|
validating: "Validating",
|
|
@@ -607,18 +686,29 @@ var labels = {
|
|
|
607
686
|
};
|
|
608
687
|
function TxButton({ state = "idle", idleLabel, children, ...props }) {
|
|
609
688
|
const loading = ["validating", "approving", "approval_confirming", "simulating", "writing", "confirming"].includes(state);
|
|
610
|
-
return /* @__PURE__ */
|
|
689
|
+
return /* @__PURE__ */ jsx(Button, { loading, ...props, children: children || labels[state] || idleLabel });
|
|
611
690
|
}
|
|
612
691
|
function VaultBanner({ title, description, badges, meta, action, icon, className }) {
|
|
613
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ jsx(
|
|
614
693
|
"section",
|
|
615
694
|
{
|
|
616
695
|
className: cn(
|
|
617
696
|
"rounded-lg border border-[#3b82f6] bg-[#172a5a] p-4 shadow-[inset_0_1px_0_rgba(255,255,255,0.08)]",
|
|
618
697
|
className
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
|
|
698
|
+
),
|
|
699
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
700
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
701
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
702
|
+
/* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[#8fc8ff]", children: icon ?? /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4" }) }),
|
|
703
|
+
/* @__PURE__ */ jsx("h3", { className: "min-w-0 text-base font-semibold leading-tight text-white", children: title }),
|
|
704
|
+
badges
|
|
705
|
+
] }),
|
|
706
|
+
/* @__PURE__ */ jsx("p", { className: "mt-3 max-w-3xl text-sm font-medium leading-6 text-[#d8e2ef]", children: description }),
|
|
707
|
+
meta ? /* @__PURE__ */ jsx("div", { className: "mt-2 text-xs font-medium leading-5 text-[#92a4bd]", children: meta }) : null
|
|
708
|
+
] }),
|
|
709
|
+
action ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: action }) : null
|
|
710
|
+
] })
|
|
711
|
+
}
|
|
622
712
|
);
|
|
623
713
|
}
|
|
624
714
|
|
|
@@ -1344,45 +1434,43 @@ var videoPlayerMessages = {
|
|
|
1344
1434
|
go: "\uC774\uB3D9"
|
|
1345
1435
|
}
|
|
1346
1436
|
};
|
|
1347
|
-
|
|
1348
|
-
// src/ui/ConsumerVideoSessionPlayer.tsx
|
|
1349
1437
|
var initialSnapshot = { sessionId: 0, state: "loading", total: 0, start: 0, clips: [], revision: 0, resumeAt: 0, play: false, refreshFailed: false, preservePosition: false, firstPtsMs: 0n, endPtsMs: 0n, mediaStartPtsMs: 0n, mediaStartIndex: 0, mediaVideoCid: "" };
|
|
1350
1438
|
var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60).toString().padStart(2, "0")}`;
|
|
1351
1439
|
function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1352
1440
|
const sdk = useFlapSdk();
|
|
1353
1441
|
const { chainId } = sdk.context;
|
|
1354
|
-
const readContractRef =
|
|
1442
|
+
const readContractRef = React8.useRef(sdk.readContract);
|
|
1355
1443
|
readContractRef.current = sdk.readContract;
|
|
1356
|
-
const reader =
|
|
1444
|
+
const reader = React8.useMemo(() => createConsumerVideoSessionReader({
|
|
1357
1445
|
context: { chainId },
|
|
1358
1446
|
readContract: (request) => readContractRef.current(request)
|
|
1359
1447
|
}, consumer), [chainId, consumer]);
|
|
1360
|
-
const sessionRef =
|
|
1361
|
-
const controllerRef =
|
|
1362
|
-
const videoRef =
|
|
1363
|
-
const frameRef =
|
|
1364
|
-
const playIntent =
|
|
1365
|
-
const autoPlayRef =
|
|
1448
|
+
const sessionRef = React8.useRef(null);
|
|
1449
|
+
const controllerRef = React8.useRef(null);
|
|
1450
|
+
const videoRef = React8.useRef(null);
|
|
1451
|
+
const frameRef = React8.useRef(null);
|
|
1452
|
+
const playIntent = React8.useRef(autoPlay);
|
|
1453
|
+
const autoPlayRef = React8.useRef(autoPlay);
|
|
1366
1454
|
autoPlayRef.current = autoPlay;
|
|
1367
|
-
const [snapshot, setSnapshot] =
|
|
1368
|
-
const [mediaState, setMediaState] =
|
|
1369
|
-
const [time, setTime] =
|
|
1370
|
-
const [paused, setPaused] =
|
|
1371
|
-
const [isMuted, setIsMuted] =
|
|
1372
|
-
const [volume, setVolume] =
|
|
1373
|
-
|
|
1455
|
+
const [snapshot, setSnapshot] = React8.useState(initialSnapshot);
|
|
1456
|
+
const [mediaState, setMediaState] = React8.useState("loading");
|
|
1457
|
+
const [time, setTime] = React8.useState(0);
|
|
1458
|
+
const [paused, setPaused] = React8.useState(true);
|
|
1459
|
+
const [isMuted, setIsMuted] = React8.useState(muted);
|
|
1460
|
+
const [volume, setVolume] = React8.useState(1);
|
|
1461
|
+
React8.useEffect(() => {
|
|
1374
1462
|
setIsMuted(muted);
|
|
1375
1463
|
}, [muted]);
|
|
1376
|
-
const [buffering, setBuffering] =
|
|
1377
|
-
const [page, setPage] =
|
|
1378
|
-
const [jump, setJump] =
|
|
1464
|
+
const [buffering, setBuffering] = React8.useState(false);
|
|
1465
|
+
const [page, setPage] = React8.useState(0);
|
|
1466
|
+
const [jump, setJump] = React8.useState("");
|
|
1379
1467
|
const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
|
|
1380
1468
|
const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
|
|
1381
1469
|
const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
|
|
1382
1470
|
const activeIndex = position?.index ?? snapshot.start;
|
|
1383
1471
|
const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
|
|
1384
1472
|
const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
|
|
1385
|
-
|
|
1473
|
+
React8.useEffect(() => {
|
|
1386
1474
|
const session = new ConsumerVideoSession(reader, setSnapshot);
|
|
1387
1475
|
sessionRef.current = session;
|
|
1388
1476
|
setSnapshot(initialSnapshot);
|
|
@@ -1399,7 +1487,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1399
1487
|
sessionRef.current = null;
|
|
1400
1488
|
};
|
|
1401
1489
|
}, [reader, startClip]);
|
|
1402
|
-
|
|
1490
|
+
React8.useEffect(() => {
|
|
1403
1491
|
if (!videoRef.current) return;
|
|
1404
1492
|
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-536UQHCG.js')).default, setMediaState);
|
|
1405
1493
|
controllerRef.current = controller;
|
|
@@ -1408,7 +1496,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1408
1496
|
controllerRef.current = null;
|
|
1409
1497
|
};
|
|
1410
1498
|
}, []);
|
|
1411
|
-
|
|
1499
|
+
React8.useEffect(() => {
|
|
1412
1500
|
const controller = controllerRef.current;
|
|
1413
1501
|
const session = sessionRef.current;
|
|
1414
1502
|
if (!controller || !session) return;
|
|
@@ -1427,7 +1515,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1427
1515
|
playIntent: () => playIntent.current
|
|
1428
1516
|
}, snapshot.play, snapshot.resumeAt);
|
|
1429
1517
|
}, [snapshot.sessionId, snapshot.revision, snapshot.state]);
|
|
1430
|
-
|
|
1518
|
+
React8.useEffect(() => {
|
|
1431
1519
|
setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
|
|
1432
1520
|
}, [activeIndex]);
|
|
1433
1521
|
const advance = () => {
|
|
@@ -1437,7 +1525,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1437
1525
|
void sessionRef.current?.advance(current.index);
|
|
1438
1526
|
}
|
|
1439
1527
|
};
|
|
1440
|
-
|
|
1528
|
+
React8.useEffect(() => {
|
|
1441
1529
|
const video = videoRef.current;
|
|
1442
1530
|
const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
|
|
1443
1531
|
if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
|
|
@@ -1451,7 +1539,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1451
1539
|
const showVideo = state === "loading" || state === "ready";
|
|
1452
1540
|
const first = page * VIDEO_PICKER_PAGE_SIZE;
|
|
1453
1541
|
const count = Math.max(0, Math.min(VIDEO_PICKER_PAGE_SIZE, snapshot.total - first));
|
|
1454
|
-
return /* @__PURE__ */
|
|
1542
|
+
return /* @__PURE__ */ jsxs(
|
|
1455
1543
|
"div",
|
|
1456
1544
|
{
|
|
1457
1545
|
className: cn("w-full min-w-0 space-y-3", className),
|
|
@@ -1482,133 +1570,192 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1482
1570
|
event.preventDefault();
|
|
1483
1571
|
seek(Math.max(0, activeIndex - 1));
|
|
1484
1572
|
}
|
|
1485
|
-
}
|
|
1486
|
-
},
|
|
1487
|
-
/* @__PURE__ */ React11.createElement("div", { ref: frameRef, className: "relative overflow-hidden rounded-lg border border-[#303236] bg-black [&:fullscreen]:flex [&:fullscreen]:flex-col [&:fullscreen]:justify-center [&:fullscreen>video]:h-0 [&:fullscreen>video]:min-h-0 [&:fullscreen>video]:flex-1 [&:fullscreen>video]:aspect-auto" }, /* @__PURE__ */ React11.createElement(
|
|
1488
|
-
"video",
|
|
1489
|
-
{
|
|
1490
|
-
ref: videoRef,
|
|
1491
|
-
"aria-label": label,
|
|
1492
|
-
playsInline: true,
|
|
1493
|
-
disablePictureInPicture: true,
|
|
1494
|
-
disableRemotePlayback: true,
|
|
1495
|
-
preload: "metadata",
|
|
1496
|
-
muted: isMuted,
|
|
1497
|
-
tabIndex: 0,
|
|
1498
|
-
className: showVideo ? "block aspect-video w-full object-contain" : "hidden",
|
|
1499
|
-
onTimeUpdate: () => {
|
|
1500
|
-
setTime(videoRef.current?.currentTime ?? 0);
|
|
1501
|
-
advance();
|
|
1502
|
-
},
|
|
1503
|
-
onPlay: () => {
|
|
1504
|
-
playIntent.current = true;
|
|
1505
|
-
setPaused(false);
|
|
1506
|
-
},
|
|
1507
|
-
onPause: () => {
|
|
1508
|
-
setPaused(true);
|
|
1509
|
-
if (!videoRef.current?.ended && mediaState === "ready") playIntent.current = false;
|
|
1510
|
-
},
|
|
1511
|
-
onVolumeChange: () => {
|
|
1512
|
-
if (videoRef.current) {
|
|
1513
|
-
setIsMuted(videoRef.current.muted);
|
|
1514
|
-
setVolume(videoRef.current.volume);
|
|
1515
|
-
}
|
|
1516
|
-
},
|
|
1517
|
-
onEnded: () => advance(),
|
|
1518
|
-
onWaiting: () => setBuffering(true),
|
|
1519
|
-
onStalled: () => setBuffering(true),
|
|
1520
|
-
onCanPlay: () => setBuffering(false),
|
|
1521
|
-
onPlaying: () => setBuffering(false)
|
|
1522
|
-
}
|
|
1523
|
-
), (state === "loading" || buffering && showVideo) && /* @__PURE__ */ React11.createElement("p", { className: "pointer-events-none absolute inset-x-0 top-3 text-center text-sm text-white", role: "status" }, text(state === "loading" ? "loading" : "buffering")), !showVideo && /* @__PURE__ */ React11.createElement("div", { className: "p-4" }, fallback), showVideo && snapshot.total > 0 && /* @__PURE__ */ React11.createElement("div", { className: "space-y-2 border-t border-[#303236] bg-black p-3" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text(paused ? "play" : "pause"), onClick: () => {
|
|
1524
|
-
const video = videoRef.current;
|
|
1525
|
-
if (video) {
|
|
1526
|
-
if (video.paused) void video.play().catch(() => void 0);
|
|
1527
|
-
else video.pause();
|
|
1528
|
-
}
|
|
1529
|
-
} }, paused ? /* @__PURE__ */ React11.createElement(Play, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ React11.createElement(Pause, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("span", { className: "flex-1 text-xs text-white", "aria-label": text("timeline"), "data-flap-video-time": true }, clock(globalTime), " / ", clock(duration)), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text(isMuted ? "unmute" : "mute"), onClick: () => {
|
|
1530
|
-
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1531
|
-
} }, isMuted ? /* @__PURE__ */ React11.createElement(VolumeX, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ React11.createElement(Volume2, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("input", { type: "range", min: 0, max: 1, step: 0.05, value: isMuted ? 0 : volume, "aria-label": text("volume"), className: "w-16 accent-[#D0FF00]", onChange: (event) => {
|
|
1532
|
-
if (videoRef.current) {
|
|
1533
|
-
videoRef.current.volume = Number(event.target.value);
|
|
1534
|
-
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1535
|
-
}
|
|
1536
|
-
} }), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1537
|
-
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1538
|
-
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1539
|
-
} }, /* @__PURE__ */ React11.createElement(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement(
|
|
1540
|
-
"input",
|
|
1541
|
-
{
|
|
1542
|
-
type: "range",
|
|
1543
|
-
min: 0,
|
|
1544
|
-
max: duration,
|
|
1545
|
-
step: 0.05,
|
|
1546
|
-
value: globalTime,
|
|
1547
|
-
disabled: state !== "ready",
|
|
1548
|
-
"aria-label": text("timelineSeek"),
|
|
1549
|
-
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1550
|
-
onChange: (event) => {
|
|
1551
|
-
const video = videoRef.current;
|
|
1552
|
-
const play = video ? !video.paused || video.ended && playIntent.current : playIntent.current;
|
|
1553
|
-
void sessionRef.current?.seekTime(Number(event.target.value), play);
|
|
1554
|
-
}
|
|
1555
|
-
}
|
|
1556
|
-
))),
|
|
1557
|
-
snapshot.total > 0 && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs text-[#D4D4D4]" }, /* @__PURE__ */ React11.createElement("span", { role: "status" }, text("position", { index: activeIndex + 1, total: snapshot.total })), /* @__PURE__ */ React11.createElement("span", null, clock(position?.time ?? 0), " / ", clock(position?.duration ?? 0))), /* @__PURE__ */ React11.createElement(
|
|
1558
|
-
"input",
|
|
1559
|
-
{
|
|
1560
|
-
type: "range",
|
|
1561
|
-
"aria-label": text("time"),
|
|
1562
|
-
min: 0,
|
|
1563
|
-
max: position?.duration ?? 0,
|
|
1564
|
-
step: 0.05,
|
|
1565
|
-
value: position?.time ?? 0,
|
|
1566
|
-
disabled: !position || state !== "ready",
|
|
1567
|
-
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1568
|
-
onChange: (event) => {
|
|
1569
|
-
const video = videoRef.current;
|
|
1570
|
-
const clip = snapshot.clips.find((item) => item.index === activeIndex);
|
|
1571
|
-
if (video && clip) {
|
|
1572
|
-
video.currentTime = Number(clip.startPtsMs - snapshot.mediaStartPtsMs) / 1e3 + Number(event.target.value);
|
|
1573
|
-
setTime(video.currentTime);
|
|
1574
|
-
}
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
), /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(0), "aria-label": text("first") }, /* @__PURE__ */ React11.createElement(SkipBack, { "aria-hidden": "true", className: "h-4 w-4" }), text("first")), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(activeIndex - 1), "aria-label": text("previous") }, /* @__PURE__ */ React11.createElement(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }), text("previous")), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(activeIndex + 1), "aria-label": text("next") }, text("next"), /* @__PURE__ */ React11.createElement(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(-1), "aria-label": text("latest") }, text("latest"), /* @__PURE__ */ React11.createElement(SkipForward, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement("div", { className: "flex flex-wrap gap-1.5", role: "group", "aria-label": label }, Array.from({ length: count }, (_, offset) => first + offset).map((index) => /* @__PURE__ */ React11.createElement(
|
|
1578
|
-
"button",
|
|
1579
|
-
{
|
|
1580
|
-
key: index,
|
|
1581
|
-
type: "button",
|
|
1582
|
-
"aria-label": text("clip", { index: index + 1 }),
|
|
1583
|
-
"aria-pressed": index === activeIndex,
|
|
1584
|
-
className: cn("min-h-11 min-w-11 rounded-md border px-2 text-sm", index === activeIndex ? "border-[#D0FF00] bg-[#D0FF00] text-black" : "border-[#303236] bg-[#171717] text-white hover:border-[#D0FF00]", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#D0FF00]"),
|
|
1585
|
-
onClick: () => seek(index)
|
|
1586
1573
|
},
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1574
|
+
children: [
|
|
1575
|
+
/* @__PURE__ */ jsxs("div", { ref: frameRef, className: "relative overflow-hidden rounded-lg border border-[#303236] bg-black [&:fullscreen]:flex [&:fullscreen]:flex-col [&:fullscreen]:justify-center [&:fullscreen>video]:h-0 [&:fullscreen>video]:min-h-0 [&:fullscreen>video]:flex-1 [&:fullscreen>video]:aspect-auto", children: [
|
|
1576
|
+
/* @__PURE__ */ jsx(
|
|
1577
|
+
"video",
|
|
1578
|
+
{
|
|
1579
|
+
ref: videoRef,
|
|
1580
|
+
"aria-label": label,
|
|
1581
|
+
playsInline: true,
|
|
1582
|
+
disablePictureInPicture: true,
|
|
1583
|
+
disableRemotePlayback: true,
|
|
1584
|
+
preload: "metadata",
|
|
1585
|
+
muted: isMuted,
|
|
1586
|
+
tabIndex: 0,
|
|
1587
|
+
className: showVideo ? "block aspect-video w-full object-contain" : "hidden",
|
|
1588
|
+
onTimeUpdate: () => {
|
|
1589
|
+
setTime(videoRef.current?.currentTime ?? 0);
|
|
1590
|
+
advance();
|
|
1591
|
+
},
|
|
1592
|
+
onPlay: () => {
|
|
1593
|
+
playIntent.current = true;
|
|
1594
|
+
setPaused(false);
|
|
1595
|
+
},
|
|
1596
|
+
onPause: () => {
|
|
1597
|
+
setPaused(true);
|
|
1598
|
+
if (!videoRef.current?.ended && mediaState === "ready") playIntent.current = false;
|
|
1599
|
+
},
|
|
1600
|
+
onVolumeChange: () => {
|
|
1601
|
+
if (videoRef.current) {
|
|
1602
|
+
setIsMuted(videoRef.current.muted);
|
|
1603
|
+
setVolume(videoRef.current.volume);
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
onEnded: () => advance(),
|
|
1607
|
+
onWaiting: () => setBuffering(true),
|
|
1608
|
+
onStalled: () => setBuffering(true),
|
|
1609
|
+
onCanPlay: () => setBuffering(false),
|
|
1610
|
+
onPlaying: () => setBuffering(false)
|
|
1611
|
+
}
|
|
1612
|
+
),
|
|
1613
|
+
(state === "loading" || buffering && showVideo) && /* @__PURE__ */ jsx("p", { className: "pointer-events-none absolute inset-x-0 top-3 text-center text-sm text-white", role: "status", children: text(state === "loading" ? "loading" : "buffering") }),
|
|
1614
|
+
!showVideo && /* @__PURE__ */ jsx("div", { className: "p-4", children: fallback }),
|
|
1615
|
+
showVideo && snapshot.total > 0 && /* @__PURE__ */ jsxs("div", { className: "space-y-2 border-t border-[#303236] bg-black p-3", children: [
|
|
1616
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1617
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(paused ? "play" : "pause"), onClick: () => {
|
|
1618
|
+
const video = videoRef.current;
|
|
1619
|
+
if (video) {
|
|
1620
|
+
if (video.paused) void video.play().catch(() => void 0);
|
|
1621
|
+
else video.pause();
|
|
1622
|
+
}
|
|
1623
|
+
}, children: paused ? /* @__PURE__ */ jsx(Play, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Pause, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1624
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 text-xs text-white", "aria-label": text("timeline"), "data-flap-video-time": true, children: [
|
|
1625
|
+
clock(globalTime),
|
|
1626
|
+
" / ",
|
|
1627
|
+
clock(duration)
|
|
1628
|
+
] }),
|
|
1629
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text(isMuted ? "unmute" : "mute"), onClick: () => {
|
|
1630
|
+
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1631
|
+
}, children: isMuted ? /* @__PURE__ */ jsx(VolumeX, { "aria-hidden": "true", className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Volume2, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1632
|
+
/* @__PURE__ */ jsx("input", { type: "range", min: 0, max: 1, step: 0.05, value: isMuted ? 0 : volume, "aria-label": text("volume"), className: "w-16 accent-[#D0FF00]", onChange: (event) => {
|
|
1633
|
+
if (videoRef.current) {
|
|
1634
|
+
videoRef.current.volume = Number(event.target.value);
|
|
1635
|
+
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1636
|
+
}
|
|
1637
|
+
} }),
|
|
1638
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1639
|
+
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1640
|
+
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1641
|
+
}, children: /* @__PURE__ */ jsx(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1642
|
+
] }),
|
|
1643
|
+
/* @__PURE__ */ jsx(
|
|
1644
|
+
"input",
|
|
1645
|
+
{
|
|
1646
|
+
type: "range",
|
|
1647
|
+
min: 0,
|
|
1648
|
+
max: duration,
|
|
1649
|
+
step: 0.05,
|
|
1650
|
+
value: globalTime,
|
|
1651
|
+
disabled: state !== "ready",
|
|
1652
|
+
"aria-label": text("timelineSeek"),
|
|
1653
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1654
|
+
onChange: (event) => {
|
|
1655
|
+
const video = videoRef.current;
|
|
1656
|
+
const play = video ? !video.paused || video.ended && playIntent.current : playIntent.current;
|
|
1657
|
+
void sessionRef.current?.seekTime(Number(event.target.value), play);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
)
|
|
1661
|
+
] })
|
|
1662
|
+
] }),
|
|
1663
|
+
snapshot.total > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1664
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 text-xs text-[#D4D4D4]", children: [
|
|
1665
|
+
/* @__PURE__ */ jsx("span", { role: "status", children: text("position", { index: activeIndex + 1, total: snapshot.total }) }),
|
|
1666
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1667
|
+
clock(position?.time ?? 0),
|
|
1668
|
+
" / ",
|
|
1669
|
+
clock(position?.duration ?? 0)
|
|
1670
|
+
] })
|
|
1671
|
+
] }),
|
|
1672
|
+
/* @__PURE__ */ jsx(
|
|
1673
|
+
"input",
|
|
1674
|
+
{
|
|
1675
|
+
type: "range",
|
|
1676
|
+
"aria-label": text("time"),
|
|
1677
|
+
min: 0,
|
|
1678
|
+
max: position?.duration ?? 0,
|
|
1679
|
+
step: 0.05,
|
|
1680
|
+
value: position?.time ?? 0,
|
|
1681
|
+
disabled: !position || state !== "ready",
|
|
1682
|
+
className: "block min-h-6 w-full accent-[#D0FF00]",
|
|
1683
|
+
onChange: (event) => {
|
|
1684
|
+
const video = videoRef.current;
|
|
1685
|
+
const clip = snapshot.clips.find((item) => item.index === activeIndex);
|
|
1686
|
+
if (video && clip) {
|
|
1687
|
+
video.currentTime = Number(clip.startPtsMs - snapshot.mediaStartPtsMs) / 1e3 + Number(event.target.value);
|
|
1688
|
+
setTime(video.currentTime);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
),
|
|
1693
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
1694
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(0), "aria-label": text("first"), children: [
|
|
1695
|
+
/* @__PURE__ */ jsx(SkipBack, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1696
|
+
text("first")
|
|
1697
|
+
] }),
|
|
1698
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex === 0, onClick: () => seek(activeIndex - 1), "aria-label": text("previous"), children: [
|
|
1699
|
+
/* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
1700
|
+
text("previous")
|
|
1701
|
+
] }),
|
|
1702
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(activeIndex + 1), "aria-label": text("next"), children: [
|
|
1703
|
+
text("next"),
|
|
1704
|
+
/* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1705
|
+
] }),
|
|
1706
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", disabled: activeIndex >= snapshot.total - 1, onClick: () => seek(-1), "aria-label": text("latest"), children: [
|
|
1707
|
+
text("latest"),
|
|
1708
|
+
/* @__PURE__ */ jsx(SkipForward, { "aria-hidden": "true", className: "h-4 w-4" })
|
|
1709
|
+
] })
|
|
1710
|
+
] }),
|
|
1711
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", role: "group", "aria-label": label, children: Array.from({ length: count }, (_, offset) => first + offset).map((index) => /* @__PURE__ */ jsx(
|
|
1712
|
+
"button",
|
|
1713
|
+
{
|
|
1714
|
+
type: "button",
|
|
1715
|
+
"aria-label": text("clip", { index: index + 1 }),
|
|
1716
|
+
"aria-pressed": index === activeIndex,
|
|
1717
|
+
className: cn("min-h-11 min-w-11 rounded-md border px-2 text-sm", index === activeIndex ? "border-[#D0FF00] bg-[#D0FF00] text-black" : "border-[#303236] bg-[#171717] text-white hover:border-[#D0FF00]", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-[#D0FF00]"),
|
|
1718
|
+
onClick: () => seek(index),
|
|
1719
|
+
children: index + 1
|
|
1720
|
+
},
|
|
1721
|
+
index
|
|
1722
|
+
)) }),
|
|
1723
|
+
/* @__PURE__ */ jsxs("form", { className: "flex flex-wrap items-end gap-2", onSubmit: (event) => {
|
|
1724
|
+
event.preventDefault();
|
|
1725
|
+
if (Number.isSafeInteger(Number(jump)) && Number(jump) >= 1 && Number(jump) <= snapshot.total) seek(Number(jump) - 1);
|
|
1726
|
+
}, children: [
|
|
1727
|
+
/* @__PURE__ */ jsxs("label", { className: "min-w-0 flex-1 space-y-1 text-xs text-[#84888C]", children: [
|
|
1728
|
+
/* @__PURE__ */ jsx("span", { children: text("jump") }),
|
|
1729
|
+
/* @__PURE__ */ jsx(Input, { type: "number", min: 1, max: snapshot.total, step: 1, value: jump, onChange: (event) => setJump(event.target.value) })
|
|
1730
|
+
] }),
|
|
1731
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", variant: "outline", disabled: !Number.isSafeInteger(Number(jump)) || Number(jump) < 1 || Number(jump) > snapshot.total, children: text("go") })
|
|
1732
|
+
] }),
|
|
1733
|
+
snapshot.total > VIDEO_PICKER_PAGE_SIZE && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1734
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: page === 0, onClick: () => setPage((value) => value - 1), "aria-label": text("previousPage"), children: /* @__PURE__ */ jsx(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" }) }),
|
|
1735
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-[#84888C]", children: text("page", { first: first + 1, last: first + count, total: snapshot.total }) }),
|
|
1736
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", disabled: first + count >= snapshot.total, onClick: () => setPage((value) => value + 1), "aria-label": text("nextPage"), children: /* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" }) })
|
|
1737
|
+
] })
|
|
1738
|
+
] }),
|
|
1739
|
+
snapshot.refreshFailed && /* @__PURE__ */ jsx("p", { className: "text-sm text-[#FFB35C]", role: "status", children: text("refreshFailed") }),
|
|
1740
|
+
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
1741
|
+
if (snapshot.total) seek(activeIndex);
|
|
1742
|
+
else void sessionRef.current?.refresh(startClip, playIntent.current);
|
|
1743
|
+
}, children: text("retry") })
|
|
1744
|
+
]
|
|
1745
|
+
}
|
|
1597
1746
|
);
|
|
1598
1747
|
}
|
|
1599
|
-
|
|
1600
|
-
// src/ui/VideoSessionPlayer.tsx
|
|
1601
1748
|
function VideoSessionPlayer(props) {
|
|
1602
|
-
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */
|
|
1749
|
+
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ jsx(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ jsx(VideoClipSessionPlayer, { ...props });
|
|
1603
1750
|
}
|
|
1604
1751
|
async function loadMpegts() {
|
|
1605
1752
|
return (await import('./mpegts-536UQHCG.js')).default;
|
|
1606
1753
|
}
|
|
1607
1754
|
function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1608
|
-
const videoRef =
|
|
1609
|
-
const controllerRef =
|
|
1610
|
-
const [state, setState] =
|
|
1611
|
-
|
|
1755
|
+
const videoRef = React8.useRef(null);
|
|
1756
|
+
const controllerRef = React8.useRef(null);
|
|
1757
|
+
const [state, setState] = React8.useState("loading");
|
|
1758
|
+
React8.useEffect(() => {
|
|
1612
1759
|
if (!videoRef.current) return;
|
|
1613
1760
|
const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
|
|
1614
1761
|
controllerRef.current = controller;
|
|
@@ -1617,26 +1764,29 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1617
1764
|
controllerRef.current = null;
|
|
1618
1765
|
};
|
|
1619
1766
|
}, []);
|
|
1620
|
-
|
|
1767
|
+
React8.useEffect(() => {
|
|
1621
1768
|
void controllerRef.current?.update(clips, autoPlay);
|
|
1622
1769
|
}, [clips, autoPlay]);
|
|
1623
1770
|
const showVideo = state === "loading" || state === "ready";
|
|
1624
|
-
return /* @__PURE__ */
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1771
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), "data-flap-video-session-state": state, children: [
|
|
1772
|
+
/* @__PURE__ */ jsx(
|
|
1773
|
+
"video",
|
|
1774
|
+
{
|
|
1775
|
+
ref: videoRef,
|
|
1776
|
+
"aria-label": label,
|
|
1777
|
+
className: showVideo ? "block w-full" : "hidden",
|
|
1778
|
+
controls: true,
|
|
1779
|
+
playsInline: true,
|
|
1780
|
+
disablePictureInPicture: true,
|
|
1781
|
+
disableRemotePlayback: true,
|
|
1782
|
+
preload: "metadata",
|
|
1783
|
+
muted
|
|
1784
|
+
}
|
|
1785
|
+
),
|
|
1786
|
+
!showVideo && fallback
|
|
1787
|
+
] });
|
|
1638
1788
|
}
|
|
1639
1789
|
|
|
1640
1790
|
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, VideoSessionPlayer, VideoSessionReadError, buttonVariants, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext };
|
|
1641
|
-
//# sourceMappingURL=chunk-
|
|
1642
|
-
//# sourceMappingURL=chunk-
|
|
1791
|
+
//# sourceMappingURL=chunk-IN34R3DY.js.map
|
|
1792
|
+
//# sourceMappingURL=chunk-IN34R3DY.js.map
|