@flapsdk/vault-runtime 0.1.33 → 0.1.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/chunk-22KTLOYH.js +73 -0
- package/chunk-22KTLOYH.js.map +1 -0
- package/chunk-3CP5VSNK.js +948 -0
- package/chunk-3CP5VSNK.js.map +1 -0
- package/{chunk-T6XKFZLH.js → chunk-AGLB72HK.js} +3 -71
- package/chunk-AGLB72HK.js.map +1 -0
- package/{chunk-SH35MEPP.js → chunk-XFA3GRXH.js} +119 -115
- package/chunk-XFA3GRXH.js.map +1 -0
- package/host-client.d.mts +23 -0
- package/host-client.js +12 -0
- package/host-client.js.map +1 -0
- package/host.d.mts +6 -4
- package/host.js +5 -3
- package/host.js.map +1 -1
- package/{hostRuntimeConfig-BC459T5W.d.mts → hostRuntimeConfig-Dl9t_R9u.d.mts} +1 -1
- package/package.json +2 -2
- package/runtime-contract.json +7 -1
- package/sdk.d.mts +9 -19
- package/sdk.js +10 -478
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/server.js +1 -1
- package/{txError-CJnmiLnM.d.mts → txError-uPZICnzz.d.mts} +1 -1
- package/{types-BfzRFcjZ.d.mts → types-_ifYbddY.d.mts} +98 -4
- package/ui.d.mts +1 -1
- package/ui.js +1 -1
- package/chunk-SH35MEPP.js.map +0 -1
- package/chunk-T6XKFZLH.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
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 React11 from 'react';
|
|
5
|
+
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
4
6
|
import { Loader2, ExternalLink, AlertTriangle, CheckCircle2, Info, X, ShieldCheck, Play, Pause, VolumeX, Volume2, Maximize, SkipBack, ChevronLeft, ChevronRight, SkipForward } from 'lucide-react';
|
|
5
7
|
import { clsx } from 'clsx';
|
|
6
8
|
import { twMerge } from 'tailwind-merge';
|
|
7
|
-
import * as React5 from 'react';
|
|
8
|
-
import { createContext, useState, useEffect, useMemo, useContext } from 'react';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
@@ -65,6 +65,21 @@ async function readVideoSessionSlice(sdk, consumer, start, count) {
|
|
|
65
65
|
function createConsumerVideoSessionReader(sdk, consumer) {
|
|
66
66
|
return { readLength: () => readVideoSessionLength(sdk, consumer), readSlice: (start, count) => readVideoSessionSlice(sdk, consumer, start, count) };
|
|
67
67
|
}
|
|
68
|
+
var RuntimeContext = createContext(null);
|
|
69
|
+
function useFlapSdk() {
|
|
70
|
+
const sdk = useContext(RuntimeContext);
|
|
71
|
+
if (!sdk) throw new Error("useFlapSdk must be used within VaultRuntimeProvider.");
|
|
72
|
+
return sdk;
|
|
73
|
+
}
|
|
74
|
+
function useVaultContext() {
|
|
75
|
+
return useFlapSdk().context;
|
|
76
|
+
}
|
|
77
|
+
function useFlapI18n() {
|
|
78
|
+
return useFlapSdk().i18n;
|
|
79
|
+
}
|
|
80
|
+
function useFlapNotify() {
|
|
81
|
+
return useFlapSdk().notify;
|
|
82
|
+
}
|
|
68
83
|
function AddressLink({ address, explorerBaseUrl, label }) {
|
|
69
84
|
if (!address) return /* @__PURE__ */ React.createElement("span", null, "-");
|
|
70
85
|
const href = explorerBaseUrl ? `${explorerBaseUrl.replace(/\/$/, "")}/address/${address}` : void 0;
|
|
@@ -116,13 +131,13 @@ var buttonVariants = cva(
|
|
|
116
131
|
}
|
|
117
132
|
}
|
|
118
133
|
);
|
|
119
|
-
var Button =
|
|
134
|
+
var Button = React11.forwardRef(
|
|
120
135
|
({ className, variant, size, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
121
136
|
const Comp = asChild ? Slot : "button";
|
|
122
137
|
if (asChild) {
|
|
123
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ React11.createElement(Comp, { "data-flap-ui": "button", className: cn(buttonVariants({ variant, size, className })), ref, ...props }, children);
|
|
124
139
|
}
|
|
125
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ React11.createElement(
|
|
126
141
|
Comp,
|
|
127
142
|
{
|
|
128
143
|
"data-flap-ui": "button",
|
|
@@ -131,8 +146,8 @@ var Button = React5.forwardRef(
|
|
|
131
146
|
disabled: disabled || loading,
|
|
132
147
|
...props
|
|
133
148
|
},
|
|
134
|
-
loading ? /* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
149
|
+
loading ? /* @__PURE__ */ React11.createElement(Loader2, { className: "relative z-10 h-4 w-4 animate-spin" }) : null,
|
|
150
|
+
/* @__PURE__ */ React11.createElement("span", { className: "relative z-10 inline-flex min-w-0 items-center justify-center gap-2" }, children)
|
|
136
151
|
);
|
|
137
152
|
}
|
|
138
153
|
);
|
|
@@ -158,8 +173,8 @@ function normalizeBinanceImageUrl(value) {
|
|
|
158
173
|
|
|
159
174
|
// src/ui/BinanceImage.tsx
|
|
160
175
|
function BinanceImage({ alt, src, fallback = null, className, onError, ...props }) {
|
|
161
|
-
const safeSrc =
|
|
162
|
-
const [failedSrc, setFailedSrc] =
|
|
176
|
+
const safeSrc = React11.useMemo(() => normalizeBinanceImageUrl(src), [src]);
|
|
177
|
+
const [failedSrc, setFailedSrc] = React11.useState(null);
|
|
163
178
|
const {
|
|
164
179
|
alt: _unsafeAlt,
|
|
165
180
|
decoding: _unsafeDecoding,
|
|
@@ -170,11 +185,11 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
170
185
|
...imageProps
|
|
171
186
|
} = props;
|
|
172
187
|
if (!safeSrc || failedSrc === safeSrc) {
|
|
173
|
-
return /* @__PURE__ */
|
|
188
|
+
return /* @__PURE__ */ React11.createElement("span", { className: cn("block", className), "data-flap-binance-image-state": safeSrc ? "error" : "invalid" }, fallback);
|
|
174
189
|
}
|
|
175
190
|
return (
|
|
176
191
|
// eslint-disable-next-line @next/next/no-img-element -- BinanceImage owns the exact-host runtime boundary and browser loading policy.
|
|
177
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ React11.createElement(
|
|
178
193
|
"img",
|
|
179
194
|
{
|
|
180
195
|
...imageProps,
|
|
@@ -193,7 +208,7 @@ function BinanceImage({ alt, src, fallback = null, className, onError, ...props
|
|
|
193
208
|
)
|
|
194
209
|
);
|
|
195
210
|
}
|
|
196
|
-
var Card =
|
|
211
|
+
var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
197
212
|
"div",
|
|
198
213
|
{
|
|
199
214
|
"data-flap-ui": "card",
|
|
@@ -206,20 +221,20 @@ var Card = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ R
|
|
|
206
221
|
}
|
|
207
222
|
));
|
|
208
223
|
Card.displayName = "Card";
|
|
209
|
-
var CardHeader =
|
|
210
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
224
|
+
var CardHeader = React11.forwardRef(
|
|
225
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("div", { "data-flap-ui": "card-header", ref, className: cn("flex flex-col gap-1.5 p-4 sm:p-5", className), ...props })
|
|
211
226
|
);
|
|
212
227
|
CardHeader.displayName = "CardHeader";
|
|
213
|
-
var CardTitle =
|
|
214
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
228
|
+
var CardTitle = React11.forwardRef(
|
|
229
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.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 })
|
|
215
230
|
);
|
|
216
231
|
CardTitle.displayName = "CardTitle";
|
|
217
|
-
var CardDescription =
|
|
218
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
232
|
+
var CardDescription = React11.forwardRef(
|
|
233
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("p", { "data-flap-ui": "card-description", ref, className: cn("text-sm leading-6 text-[#84888C]", className), ...props })
|
|
219
234
|
);
|
|
220
235
|
CardDescription.displayName = "CardDescription";
|
|
221
|
-
var CardContent =
|
|
222
|
-
({ className, ...props }, ref) => /* @__PURE__ */
|
|
236
|
+
var CardContent = React11.forwardRef(
|
|
237
|
+
({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement("div", { "data-flap-ui": "card-content", ref, className: cn("p-4 pt-0 sm:p-5 sm:pt-0", className), ...props })
|
|
223
238
|
);
|
|
224
239
|
CardContent.displayName = "CardContent";
|
|
225
240
|
function formatMs(ms) {
|
|
@@ -297,23 +312,23 @@ function normalizeExternalUrl(url) {
|
|
|
297
312
|
}
|
|
298
313
|
}
|
|
299
314
|
function WarningIcon({ className }) {
|
|
300
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ React11.createElement("svg", { viewBox: "0 0 80 80", fill: "currentColor", "aria-hidden": "true", shapeRendering: "crispEdges", className }, /* @__PURE__ */ React11.createElement("rect", { x: "32.4395", y: "11.7969", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 47.5605 11.7969)" }), /* @__PURE__ */ React11.createElement("rect", { x: "35.0693", y: "9.16699", width: "2.62997", height: "5.25994" }), /* @__PURE__ */ React11.createElement("rect", { x: "37.6982", y: "9.16699", width: "4.60245", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "6.66699", width: "3.33333", height: "2.5" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.25994", transform: "matrix(-1 0 0 1 44.9307 9.16699)" }), /* @__PURE__ */ React11.createElement("rect", { x: "29.8086", y: "16.3989", width: "2.62997", height: "6.57492" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "6.57492", transform: "matrix(-1 0 0 1 50.1914 16.3989)" }), /* @__PURE__ */ React11.createElement("rect", { x: "27.1787", y: "21.6592", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 52.8213 21.6592)" }), /* @__PURE__ */ React11.createElement("rect", { x: "24.5488", y: "24.2891", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 55.4512 24.2891)" }), /* @__PURE__ */ React11.createElement("rect", { x: "21.9189", y: "29.5488", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 58.0811 29.5488)" }), /* @__PURE__ */ React11.createElement("rect", { x: "19.2891", y: "34.8086", width: "2.62997", height: "7.23242" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "7.23242", transform: "matrix(-1 0 0 1 60.7109 34.8086)" }), /* @__PURE__ */ React11.createElement("rect", { x: "16.6592", y: "40.0693", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 63.3408 40.0693)" }), /* @__PURE__ */ React11.createElement("rect", { x: "14.0293", y: "44.6709", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 65.9707 44.6709)" }), /* @__PURE__ */ React11.createElement("rect", { x: "11.3984", y: "48.6165", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 68.6016 48.6165)" }), /* @__PURE__ */ React11.createElement("rect", { x: "8.76855", y: "53.8762", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 71.2314 53.8762)" }), /* @__PURE__ */ React11.createElement("rect", { x: "6.13965", y: "58.4783", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 73.8604 58.4783)" }), /* @__PURE__ */ React11.createElement("rect", { x: "4.16699", y: "62.4236", width: "2.62997", height: "5.91743" }), /* @__PURE__ */ React11.createElement("rect", { width: "2.62997", height: "5.91743", transform: "matrix(-1 0 0 1 75.833 62.4236)" }), /* @__PURE__ */ React11.createElement("rect", { x: "6.79688", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "70.5742", y: "68.3406", width: "2.62997", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "9.42578", y: "70.9709", width: "61.1468", height: "2.62997" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "30.833", width: "4.16667", height: "22.5" }), /* @__PURE__ */ React11.createElement("rect", { x: "38.333", y: "57.5", width: "4.16667", height: "4.16667" }));
|
|
301
316
|
}
|
|
302
317
|
function ExternalLink2({ url, children, locale, className, copy }) {
|
|
303
|
-
const [open, setOpen] =
|
|
304
|
-
const [acknowledged, setAcknowledged] =
|
|
305
|
-
const [mounted, setMounted] =
|
|
318
|
+
const [open, setOpen] = React11.useState(false);
|
|
319
|
+
const [acknowledged, setAcknowledged] = React11.useState(false);
|
|
320
|
+
const [mounted, setMounted] = React11.useState(false);
|
|
306
321
|
const text = { ...COPY[resolveLocale(locale)], ...copy };
|
|
307
|
-
const safeUrl =
|
|
322
|
+
const safeUrl = React11.useMemo(() => normalizeExternalUrl(url), [url]);
|
|
308
323
|
const canProceed = acknowledged && Boolean(safeUrl);
|
|
309
|
-
|
|
324
|
+
React11.useEffect(() => {
|
|
310
325
|
setMounted(true);
|
|
311
326
|
}, []);
|
|
312
|
-
const close =
|
|
327
|
+
const close = React11.useCallback(() => {
|
|
313
328
|
setOpen(false);
|
|
314
329
|
setAcknowledged(false);
|
|
315
330
|
}, []);
|
|
316
|
-
|
|
331
|
+
React11.useEffect(() => {
|
|
317
332
|
if (!open) return;
|
|
318
333
|
const onKey = (event) => {
|
|
319
334
|
if (event.key === "Escape") close();
|
|
@@ -331,7 +346,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
331
346
|
window.open(safeUrl, "_blank", "noopener,noreferrer");
|
|
332
347
|
close();
|
|
333
348
|
};
|
|
334
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
|
|
335
350
|
"button",
|
|
336
351
|
{
|
|
337
352
|
type: "button",
|
|
@@ -339,17 +354,17 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
339
354
|
onClick: () => setOpen(true),
|
|
340
355
|
className: cn("inline-flex min-w-0 items-center gap-1 text-[#d0ff00] hover:underline", className)
|
|
341
356
|
},
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
/* @__PURE__ */
|
|
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" })
|
|
344
359
|
), open && mounted ? createPortal(
|
|
345
|
-
/* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ React11.createElement(
|
|
346
361
|
"div",
|
|
347
362
|
{
|
|
348
363
|
className: "fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",
|
|
349
364
|
style: { zIndex: 2147483647 },
|
|
350
365
|
onClick: close
|
|
351
366
|
},
|
|
352
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ React11.createElement(
|
|
353
368
|
"div",
|
|
354
369
|
{
|
|
355
370
|
role: "dialog",
|
|
@@ -365,22 +380,22 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
365
380
|
},
|
|
366
381
|
className: "flex w-[min(540px,100%)] max-h-[calc(100vh-2rem)] flex-col overflow-hidden rounded-[4px] text-white shadow-panel"
|
|
367
382
|
},
|
|
368
|
-
/* @__PURE__ */
|
|
383
|
+
/* @__PURE__ */ React11.createElement(
|
|
369
384
|
"div",
|
|
370
385
|
{
|
|
371
386
|
className: "flex items-center justify-between border-b border-[#484b51] px-6 py-[14px]",
|
|
372
387
|
style: { boxSizing: "border-box", height: "49px", lineHeight: 1 }
|
|
373
388
|
},
|
|
374
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ React11.createElement(
|
|
375
390
|
"span",
|
|
376
391
|
{
|
|
377
392
|
className: "truncate text-[18px] font-medium uppercase leading-none tracking-[-0.4px]",
|
|
378
393
|
style: { lineHeight: 1 }
|
|
379
394
|
},
|
|
380
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ React11.createElement("span", { className: "text-[#d0ff00]" }, "//"),
|
|
381
396
|
text.title
|
|
382
397
|
),
|
|
383
|
-
/* @__PURE__ */
|
|
398
|
+
/* @__PURE__ */ React11.createElement(
|
|
384
399
|
"button",
|
|
385
400
|
{
|
|
386
401
|
type: "button",
|
|
@@ -388,10 +403,10 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
388
403
|
"aria-label": text.cancel,
|
|
389
404
|
className: "flex size-5 shrink-0 items-center justify-center border border-[#484b51] text-white/80 hover:text-white"
|
|
390
405
|
},
|
|
391
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ React11.createElement(X, { className: "h-3.5 w-3.5" })
|
|
392
407
|
)
|
|
393
408
|
),
|
|
394
|
-
/* @__PURE__ */
|
|
409
|
+
/* @__PURE__ */ React11.createElement("div", { className: "flex flex-col gap-6 overflow-y-auto p-6" }, /* @__PURE__ */ React11.createElement("div", { className: "flex flex-col items-center gap-5" }, /* @__PURE__ */ React11.createElement(WarningIcon, { className: "h-20 w-20 text-[#f68f15]" }), /* @__PURE__ */ React11.createElement("h2", { className: "text-center text-[18px] font-medium uppercase leading-[1.4] tracking-[-0.4px]" }, text.heading)), /* @__PURE__ */ React11.createElement("p", { className: "text-[14px] leading-[1.4] tracking-[-0.4px] text-[#a0a3a7]" }, text.description), /* @__PURE__ */ React11.createElement("div", { className: "min-w-0 border border-[#262626] bg-[#0a0a0a] px-3 py-2 text-[13px]" }, /* @__PURE__ */ React11.createElement("div", { className: "mb-1 uppercase tracking-[-0.4px] text-[#6b7280]" }, text.destinationLabel), /* @__PURE__ */ React11.createElement("div", { className: "truncate text-[#d4d4d4]", title: safeUrl ?? url }, safeUrl ? new URL(safeUrl).host : text.invalidDestination)), /* @__PURE__ */ React11.createElement("label", { className: "flex cursor-pointer items-center gap-2 text-[14px] leading-[1.4] tracking-[-0.4px] text-white" }, /* @__PURE__ */ React11.createElement(
|
|
395
410
|
"input",
|
|
396
411
|
{
|
|
397
412
|
type: "checkbox",
|
|
@@ -399,7 +414,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
399
414
|
onChange: (event) => setAcknowledged(event.target.checked),
|
|
400
415
|
className: "sr-only"
|
|
401
416
|
}
|
|
402
|
-
), /* @__PURE__ */
|
|
417
|
+
), /* @__PURE__ */ React11.createElement(
|
|
403
418
|
"span",
|
|
404
419
|
{
|
|
405
420
|
"aria-hidden": "true",
|
|
@@ -408,8 +423,8 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
408
423
|
acknowledged ? "border-[#d0ff00] bg-[#d0ff00] text-[#070808]" : "border-[#a0a3a7] bg-transparent"
|
|
409
424
|
)
|
|
410
425
|
},
|
|
411
|
-
acknowledged ? /* @__PURE__ */
|
|
412
|
-
), /* @__PURE__ */
|
|
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(
|
|
413
428
|
"button",
|
|
414
429
|
{
|
|
415
430
|
type: "button",
|
|
@@ -417,7 +432,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
417
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"
|
|
418
433
|
},
|
|
419
434
|
text.cancel
|
|
420
|
-
), /* @__PURE__ */
|
|
435
|
+
), /* @__PURE__ */ React11.createElement(
|
|
421
436
|
"button",
|
|
422
437
|
{
|
|
423
438
|
type: "button",
|
|
@@ -433,7 +448,7 @@ function ExternalLink2({ url, children, locale, className, copy }) {
|
|
|
433
448
|
document.body
|
|
434
449
|
) : null);
|
|
435
450
|
}
|
|
436
|
-
var Input =
|
|
451
|
+
var Input = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React11.createElement(
|
|
437
452
|
"input",
|
|
438
453
|
{
|
|
439
454
|
"data-flap-ui": "input",
|
|
@@ -447,16 +462,16 @@ var Input = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
447
462
|
));
|
|
448
463
|
Input.displayName = "Input";
|
|
449
464
|
function IpfsImage({ alt, cid, path, validationPath, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
450
|
-
const urls =
|
|
451
|
-
const [urlIndex, setUrlIndex] =
|
|
465
|
+
const urls = React11.useMemo(() => resolveIpfsImageUrls(cid, 56, path), [cid, path]);
|
|
466
|
+
const [urlIndex, setUrlIndex] = React11.useState(0);
|
|
452
467
|
const src = urls[urlIndex];
|
|
453
|
-
|
|
468
|
+
React11.useEffect(() => {
|
|
454
469
|
setUrlIndex(0);
|
|
455
470
|
}, [cid, path]);
|
|
456
471
|
if (!src) return null;
|
|
457
472
|
return (
|
|
458
473
|
// eslint-disable-next-line @next/next/no-img-element -- IpfsImage owns CID-to-gateway fallback; next/image cannot represent this boundary.
|
|
459
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ React11.createElement(
|
|
460
475
|
"img",
|
|
461
476
|
{
|
|
462
477
|
...props,
|
|
@@ -477,28 +492,13 @@ function IpfsImage({ alt, cid, path, validationPath, className, decoding = "asyn
|
|
|
477
492
|
);
|
|
478
493
|
}
|
|
479
494
|
function IpfsBackground({ cid, className, imageClassName, overlayClassName, ...props }) {
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
}
|
|
482
|
-
var RuntimeContext = createContext(null);
|
|
483
|
-
function useFlapSdk() {
|
|
484
|
-
const sdk = useContext(RuntimeContext);
|
|
485
|
-
if (!sdk) throw new Error("useFlapSdk must be used within VaultRuntimeProvider.");
|
|
486
|
-
return sdk;
|
|
487
|
-
}
|
|
488
|
-
function useVaultContext() {
|
|
489
|
-
return useFlapSdk().context;
|
|
490
|
-
}
|
|
491
|
-
function useFlapI18n() {
|
|
492
|
-
return useFlapSdk().i18n;
|
|
493
|
-
}
|
|
494
|
-
function useFlapNotify() {
|
|
495
|
-
return useFlapSdk().notify;
|
|
495
|
+
return /* @__PURE__ */ React11.createElement("div", { ...props, "aria-hidden": "true", className: cn("pointer-events-none absolute inset-0 overflow-hidden", className) }, /* @__PURE__ */ React11.createElement(IpfsImage, { alt: "", cid, className: cn("h-full w-full object-cover", imageClassName), loading: "eager" }), overlayClassName ? /* @__PURE__ */ React11.createElement("div", { className: cn("absolute inset-0", overlayClassName) }) : null);
|
|
496
496
|
}
|
|
497
497
|
function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding = "async", loading = "lazy", onError, ...props }) {
|
|
498
498
|
const sdk = useFlapSdk();
|
|
499
|
-
const [metadata, setMetadata] =
|
|
500
|
-
const [state, setState] =
|
|
501
|
-
|
|
499
|
+
const [metadata, setMetadata] = React11.useState(null);
|
|
500
|
+
const [state, setState] = React11.useState("loading");
|
|
501
|
+
React11.useEffect(() => {
|
|
502
502
|
let cancelled = false;
|
|
503
503
|
setState("loading");
|
|
504
504
|
setMetadata(null);
|
|
@@ -514,11 +514,11 @@ function NftMetadataImage({ alt, tokenId, fallback = null, className, decoding =
|
|
|
514
514
|
};
|
|
515
515
|
}, [sdk, sdk.refetchNonce, tokenId]);
|
|
516
516
|
if (state !== "ready" || !metadata) {
|
|
517
|
-
return /* @__PURE__ */
|
|
517
|
+
return /* @__PURE__ */ React11.createElement("span", { "data-flap-nft-media-state": state, className: cn("block", className) }, fallback);
|
|
518
518
|
}
|
|
519
519
|
return (
|
|
520
520
|
// eslint-disable-next-line @next/next/no-img-element -- shared runtime resolves tokenURI metadata to a validated, size-limited data image.
|
|
521
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ React11.createElement(
|
|
522
522
|
"img",
|
|
523
523
|
{
|
|
524
524
|
...props,
|
|
@@ -566,7 +566,7 @@ function ReviewedFrame({ className, frameId, provider, src, title, ...props }) {
|
|
|
566
566
|
title: _title,
|
|
567
567
|
...safeProps
|
|
568
568
|
} = props;
|
|
569
|
-
return /* @__PURE__ */
|
|
569
|
+
return /* @__PURE__ */ React11.createElement(
|
|
570
570
|
"iframe",
|
|
571
571
|
{
|
|
572
572
|
...safeProps,
|
|
@@ -1351,34 +1351,38 @@ var clock = (seconds) => `${Math.floor(seconds / 60)}:${Math.floor(seconds % 60)
|
|
|
1351
1351
|
function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1352
1352
|
const sdk = useFlapSdk();
|
|
1353
1353
|
const { chainId } = sdk.context;
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
const
|
|
1361
|
-
const
|
|
1354
|
+
const readContractRef = React11.useRef(sdk.readContract);
|
|
1355
|
+
readContractRef.current = sdk.readContract;
|
|
1356
|
+
const reader = React11.useMemo(() => createConsumerVideoSessionReader({
|
|
1357
|
+
context: { chainId },
|
|
1358
|
+
readContract: (request) => readContractRef.current(request)
|
|
1359
|
+
}, consumer), [chainId, consumer]);
|
|
1360
|
+
const sessionRef = React11.useRef(null);
|
|
1361
|
+
const controllerRef = React11.useRef(null);
|
|
1362
|
+
const videoRef = React11.useRef(null);
|
|
1363
|
+
const frameRef = React11.useRef(null);
|
|
1364
|
+
const playIntent = React11.useRef(autoPlay);
|
|
1365
|
+
const autoPlayRef = React11.useRef(autoPlay);
|
|
1362
1366
|
autoPlayRef.current = autoPlay;
|
|
1363
|
-
const [snapshot, setSnapshot] =
|
|
1364
|
-
const [mediaState, setMediaState] =
|
|
1365
|
-
const [time, setTime] =
|
|
1366
|
-
const [paused, setPaused] =
|
|
1367
|
-
const [isMuted, setIsMuted] =
|
|
1368
|
-
const [volume, setVolume] =
|
|
1369
|
-
|
|
1367
|
+
const [snapshot, setSnapshot] = React11.useState(initialSnapshot);
|
|
1368
|
+
const [mediaState, setMediaState] = React11.useState("loading");
|
|
1369
|
+
const [time, setTime] = React11.useState(0);
|
|
1370
|
+
const [paused, setPaused] = React11.useState(true);
|
|
1371
|
+
const [isMuted, setIsMuted] = React11.useState(muted);
|
|
1372
|
+
const [volume, setVolume] = React11.useState(1);
|
|
1373
|
+
React11.useEffect(() => {
|
|
1370
1374
|
setIsMuted(muted);
|
|
1371
1375
|
}, [muted]);
|
|
1372
|
-
const [buffering, setBuffering] =
|
|
1373
|
-
const [page, setPage] =
|
|
1374
|
-
const [jump, setJump] =
|
|
1376
|
+
const [buffering, setBuffering] = React11.useState(false);
|
|
1377
|
+
const [page, setPage] = React11.useState(0);
|
|
1378
|
+
const [jump, setJump] = React11.useState("");
|
|
1375
1379
|
const position = videoClipPosition(snapshot.clips, time, snapshot.mediaStartPtsMs);
|
|
1376
1380
|
const duration = Number(snapshot.endPtsMs - snapshot.firstPtsMs) / 1e3;
|
|
1377
1381
|
const globalTime = Math.max(0, Math.min(duration, Number(snapshot.mediaStartPtsMs - snapshot.firstPtsMs) / 1e3 + time));
|
|
1378
1382
|
const activeIndex = position?.index ?? snapshot.start;
|
|
1379
1383
|
const strings = videoPlayerMessages[sdk.i18n.locale.split("-")[0]] ?? videoPlayerMessages.en;
|
|
1380
1384
|
const text = (key, params) => sdk.i18n.t(`runtime.video.${key}`, strings[key], params);
|
|
1381
|
-
|
|
1385
|
+
React11.useEffect(() => {
|
|
1382
1386
|
const session = new ConsumerVideoSession(reader, setSnapshot);
|
|
1383
1387
|
sessionRef.current = session;
|
|
1384
1388
|
setSnapshot(initialSnapshot);
|
|
@@ -1395,7 +1399,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1395
1399
|
sessionRef.current = null;
|
|
1396
1400
|
};
|
|
1397
1401
|
}, [reader, startClip]);
|
|
1398
|
-
|
|
1402
|
+
React11.useEffect(() => {
|
|
1399
1403
|
if (!videoRef.current) return;
|
|
1400
1404
|
const controller = new VideoSessionController(videoRef.current, async () => (await import('./mpegts-536UQHCG.js')).default, setMediaState);
|
|
1401
1405
|
controllerRef.current = controller;
|
|
@@ -1404,7 +1408,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1404
1408
|
controllerRef.current = null;
|
|
1405
1409
|
};
|
|
1406
1410
|
}, []);
|
|
1407
|
-
|
|
1411
|
+
React11.useEffect(() => {
|
|
1408
1412
|
const controller = controllerRef.current;
|
|
1409
1413
|
const session = sessionRef.current;
|
|
1410
1414
|
if (!controller || !session) return;
|
|
@@ -1423,7 +1427,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1423
1427
|
playIntent: () => playIntent.current
|
|
1424
1428
|
}, snapshot.play, snapshot.resumeAt);
|
|
1425
1429
|
}, [snapshot.sessionId, snapshot.revision, snapshot.state]);
|
|
1426
|
-
|
|
1430
|
+
React11.useEffect(() => {
|
|
1427
1431
|
setPage(Math.floor(activeIndex / VIDEO_PICKER_PAGE_SIZE));
|
|
1428
1432
|
}, [activeIndex]);
|
|
1429
1433
|
const advance = () => {
|
|
@@ -1433,7 +1437,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1433
1437
|
void sessionRef.current?.advance(current.index);
|
|
1434
1438
|
}
|
|
1435
1439
|
};
|
|
1436
|
-
|
|
1440
|
+
React11.useEffect(() => {
|
|
1437
1441
|
const video = videoRef.current;
|
|
1438
1442
|
const current = videoClipPosition(snapshot.clips, video?.currentTime ?? 0, snapshot.mediaStartPtsMs);
|
|
1439
1443
|
if (video && current && (current.index >= snapshot.start + snapshot.clips.length - 2 || video.ended)) void sessionRef.current?.advance(current.index);
|
|
@@ -1447,7 +1451,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1447
1451
|
const showVideo = state === "loading" || state === "ready";
|
|
1448
1452
|
const first = page * VIDEO_PICKER_PAGE_SIZE;
|
|
1449
1453
|
const count = Math.max(0, Math.min(VIDEO_PICKER_PAGE_SIZE, snapshot.total - first));
|
|
1450
|
-
return /* @__PURE__ */
|
|
1454
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1451
1455
|
"div",
|
|
1452
1456
|
{
|
|
1453
1457
|
className: cn("w-full min-w-0 space-y-3", className),
|
|
@@ -1480,7 +1484,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1480
1484
|
}
|
|
1481
1485
|
}
|
|
1482
1486
|
},
|
|
1483
|
-
/* @__PURE__ */
|
|
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(
|
|
1484
1488
|
"video",
|
|
1485
1489
|
{
|
|
1486
1490
|
ref: videoRef,
|
|
@@ -1516,23 +1520,23 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1516
1520
|
onCanPlay: () => setBuffering(false),
|
|
1517
1521
|
onPlaying: () => setBuffering(false)
|
|
1518
1522
|
}
|
|
1519
|
-
), (state === "loading" || buffering && showVideo) && /* @__PURE__ */
|
|
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: () => {
|
|
1520
1524
|
const video = videoRef.current;
|
|
1521
1525
|
if (video) {
|
|
1522
1526
|
if (video.paused) void video.play().catch(() => void 0);
|
|
1523
1527
|
else video.pause();
|
|
1524
1528
|
}
|
|
1525
|
-
} }, paused ? /* @__PURE__ */
|
|
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: () => {
|
|
1526
1530
|
if (videoRef.current) videoRef.current.muted = !videoRef.current.muted;
|
|
1527
|
-
} }, isMuted ? /* @__PURE__ */
|
|
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) => {
|
|
1528
1532
|
if (videoRef.current) {
|
|
1529
1533
|
videoRef.current.volume = Number(event.target.value);
|
|
1530
1534
|
videoRef.current.muted = Number(event.target.value) === 0;
|
|
1531
1535
|
}
|
|
1532
|
-
} }), /* @__PURE__ */
|
|
1536
|
+
} }), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", "aria-label": text("fullscreen"), onClick: () => {
|
|
1533
1537
|
if (document.fullscreenElement) void document.exitFullscreen().catch(() => void 0);
|
|
1534
1538
|
else void frameRef.current?.requestFullscreen?.().catch(() => void 0);
|
|
1535
|
-
} }, /* @__PURE__ */
|
|
1539
|
+
} }, /* @__PURE__ */ React11.createElement(Maximize, { "aria-hidden": "true", className: "h-4 w-4" }))), /* @__PURE__ */ React11.createElement(
|
|
1536
1540
|
"input",
|
|
1537
1541
|
{
|
|
1538
1542
|
type: "range",
|
|
@@ -1550,7 +1554,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1550
1554
|
}
|
|
1551
1555
|
}
|
|
1552
1556
|
))),
|
|
1553
|
-
snapshot.total > 0 && /* @__PURE__ */
|
|
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(
|
|
1554
1558
|
"input",
|
|
1555
1559
|
{
|
|
1556
1560
|
type: "range",
|
|
@@ -1570,7 +1574,7 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1570
1574
|
}
|
|
1571
1575
|
}
|
|
1572
1576
|
}
|
|
1573
|
-
), /* @__PURE__ */
|
|
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(
|
|
1574
1578
|
"button",
|
|
1575
1579
|
{
|
|
1576
1580
|
key: index,
|
|
@@ -1581,12 +1585,12 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1581
1585
|
onClick: () => seek(index)
|
|
1582
1586
|
},
|
|
1583
1587
|
index + 1
|
|
1584
|
-
))), /* @__PURE__ */
|
|
1588
|
+
))), /* @__PURE__ */ React11.createElement("form", { className: "flex flex-wrap items-end gap-2", onSubmit: (event) => {
|
|
1585
1589
|
event.preventDefault();
|
|
1586
1590
|
if (Number.isSafeInteger(Number(jump)) && Number(jump) >= 1 && Number(jump) <= snapshot.total) seek(Number(jump) - 1);
|
|
1587
|
-
} }, /* @__PURE__ */
|
|
1588
|
-
snapshot.refreshFailed && /* @__PURE__ */
|
|
1589
|
-
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */
|
|
1591
|
+
} }, /* @__PURE__ */ React11.createElement("label", { className: "min-w-0 flex-1 space-y-1 text-xs text-[#84888C]" }, /* @__PURE__ */ React11.createElement("span", null, text("jump")), /* @__PURE__ */ React11.createElement(Input, { type: "number", min: 1, max: snapshot.total, step: 1, value: jump, onChange: (event) => setJump(event.target.value) })), /* @__PURE__ */ React11.createElement(Button, { type: "submit", variant: "outline", disabled: !Number.isSafeInteger(Number(jump)) || Number(jump) < 1 || Number(jump) > snapshot.total }, text("go"))), snapshot.total > VIDEO_PICKER_PAGE_SIZE && /* @__PURE__ */ React11.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", disabled: page === 0, onClick: () => setPage((value) => value - 1), "aria-label": text("previousPage") }, /* @__PURE__ */ React11.createElement(ChevronLeft, { "aria-hidden": "true", className: "h-4 w-4" })), /* @__PURE__ */ React11.createElement("span", { className: "text-xs text-[#84888C]" }, text("page", { first: first + 1, last: first + count, total: snapshot.total })), /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "ghost", disabled: first + count >= snapshot.total, onClick: () => setPage((value) => value + 1), "aria-label": text("nextPage") }, /* @__PURE__ */ React11.createElement(ChevronRight, { "aria-hidden": "true", className: "h-4 w-4" })))),
|
|
1592
|
+
snapshot.refreshFailed && /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-[#FFB35C]", role: "status" }, text("refreshFailed")),
|
|
1593
|
+
(snapshot.refreshFailed || state === "error" || state === "invalid") && /* @__PURE__ */ React11.createElement(Button, { type: "button", variant: "outline", onClick: () => {
|
|
1590
1594
|
if (snapshot.total) seek(activeIndex);
|
|
1591
1595
|
else void sessionRef.current?.refresh(startClip, playIntent.current);
|
|
1592
1596
|
} }, text("retry"))
|
|
@@ -1595,16 +1599,16 @@ function ConsumerVideoSessionPlayer({ consumer, startClip = 0, label, fallback =
|
|
|
1595
1599
|
|
|
1596
1600
|
// src/ui/VideoSessionPlayer.tsx
|
|
1597
1601
|
function VideoSessionPlayer(props) {
|
|
1598
|
-
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */
|
|
1602
|
+
return "consumer" in props && props.consumer !== void 0 ? /* @__PURE__ */ React11.createElement(ConsumerVideoSessionPlayer, { ...props }) : /* @__PURE__ */ React11.createElement(VideoClipSessionPlayer, { ...props });
|
|
1599
1603
|
}
|
|
1600
1604
|
async function loadMpegts() {
|
|
1601
1605
|
return (await import('./mpegts-536UQHCG.js')).default;
|
|
1602
1606
|
}
|
|
1603
1607
|
function VideoClipSessionPlayer({ clips, label, fallback = null, className, autoPlay = false, muted = false }) {
|
|
1604
|
-
const videoRef =
|
|
1605
|
-
const controllerRef =
|
|
1606
|
-
const [state, setState] =
|
|
1607
|
-
|
|
1608
|
+
const videoRef = React11.useRef(null);
|
|
1609
|
+
const controllerRef = React11.useRef(null);
|
|
1610
|
+
const [state, setState] = React11.useState("loading");
|
|
1611
|
+
React11.useEffect(() => {
|
|
1608
1612
|
if (!videoRef.current) return;
|
|
1609
1613
|
const controller = new VideoSessionController(videoRef.current, loadMpegts, setState);
|
|
1610
1614
|
controllerRef.current = controller;
|
|
@@ -1613,11 +1617,11 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1613
1617
|
controllerRef.current = null;
|
|
1614
1618
|
};
|
|
1615
1619
|
}, []);
|
|
1616
|
-
|
|
1620
|
+
React11.useEffect(() => {
|
|
1617
1621
|
void controllerRef.current?.update(clips, autoPlay);
|
|
1618
1622
|
}, [clips, autoPlay]);
|
|
1619
1623
|
const showVideo = state === "loading" || state === "ready";
|
|
1620
|
-
return /* @__PURE__ */
|
|
1624
|
+
return /* @__PURE__ */ React11.createElement("div", { className: cn("w-full", className), "data-flap-video-session-state": state }, /* @__PURE__ */ React11.createElement(
|
|
1621
1625
|
"video",
|
|
1622
1626
|
{
|
|
1623
1627
|
ref: videoRef,
|
|
@@ -1634,5 +1638,5 @@ function VideoClipSessionPlayer({ clips, label, fallback = null, className, auto
|
|
|
1634
1638
|
}
|
|
1635
1639
|
|
|
1636
1640
|
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 };
|
|
1637
|
-
//# sourceMappingURL=chunk-
|
|
1638
|
-
//# sourceMappingURL=chunk-
|
|
1641
|
+
//# sourceMappingURL=chunk-XFA3GRXH.js.map
|
|
1642
|
+
//# sourceMappingURL=chunk-XFA3GRXH.js.map
|