@livo-tv/blocks 1.29.0 → 1.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1324 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -5
- package/dist/index.d.ts +121 -5
- package/dist/index.js +1249 -146
- package/dist/index.js.map +1 -1
- package/package.json +22 -2
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React11 = require('react');
|
|
5
5
|
var lucideReact = require('lucide-react');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -35,16 +35,16 @@ function _interopNamespace(e) {
|
|
|
35
35
|
return Object.freeze(n);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var React11__namespace = /*#__PURE__*/_interopNamespace(React11);
|
|
39
39
|
var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
|
|
40
40
|
var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMenuPrimitive);
|
|
41
41
|
var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
|
|
42
42
|
var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
|
|
43
43
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
|
|
44
44
|
|
|
45
|
-
var LanguageContext =
|
|
45
|
+
var LanguageContext = React11.createContext(null);
|
|
46
46
|
function useLanguageContext() {
|
|
47
|
-
return
|
|
47
|
+
return React11.useContext(LanguageContext);
|
|
48
48
|
}
|
|
49
49
|
function cn(...inputs) {
|
|
50
50
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -651,20 +651,20 @@ function useEditableSection({
|
|
|
651
651
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
652
652
|
...labels
|
|
653
653
|
};
|
|
654
|
-
const [mode, setMode] =
|
|
655
|
-
const [status, setStatus] =
|
|
656
|
-
const [confirmOpen, setConfirmOpen] =
|
|
657
|
-
const [minHeightPx, setMinHeightPx] =
|
|
658
|
-
const contentRef =
|
|
659
|
-
const editButtonRef =
|
|
660
|
-
const measuredHeightRef =
|
|
661
|
-
const shouldFocusEditRef =
|
|
662
|
-
const shouldFocusFirstFieldRef =
|
|
663
|
-
const editButtonId =
|
|
664
|
-
const contentFormId =
|
|
654
|
+
const [mode, setMode] = React11.useState("reading");
|
|
655
|
+
const [status, setStatus] = React11.useState(null);
|
|
656
|
+
const [confirmOpen, setConfirmOpen] = React11.useState(false);
|
|
657
|
+
const [minHeightPx, setMinHeightPx] = React11.useState(void 0);
|
|
658
|
+
const contentRef = React11.useRef(null);
|
|
659
|
+
const editButtonRef = React11.useRef(null);
|
|
660
|
+
const measuredHeightRef = React11.useRef(0);
|
|
661
|
+
const shouldFocusEditRef = React11.useRef(false);
|
|
662
|
+
const shouldFocusFirstFieldRef = React11.useRef(false);
|
|
663
|
+
const editButtonId = React11.useId();
|
|
664
|
+
const contentFormId = React11.useId();
|
|
665
665
|
const isEditing = mode === "editing" || mode === "saving";
|
|
666
666
|
const isSaving = mode === "saving";
|
|
667
|
-
|
|
667
|
+
React11.useEffect(() => {
|
|
668
668
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
669
669
|
shouldFocusEditRef.current = false;
|
|
670
670
|
editButtonRef.current?.focus();
|
|
@@ -682,18 +682,18 @@ function useEditableSection({
|
|
|
682
682
|
focusFirstField(contentRef.current);
|
|
683
683
|
}
|
|
684
684
|
}, [mode]);
|
|
685
|
-
const exitToReading =
|
|
685
|
+
const exitToReading = React11.useCallback(() => {
|
|
686
686
|
setConfirmOpen(false);
|
|
687
687
|
shouldFocusEditRef.current = true;
|
|
688
688
|
setMode("reading");
|
|
689
689
|
onDiscard?.();
|
|
690
690
|
}, [onDiscard]);
|
|
691
|
-
const startEdit =
|
|
691
|
+
const startEdit = React11.useCallback(() => {
|
|
692
692
|
setStatus(null);
|
|
693
693
|
shouldFocusFirstFieldRef.current = true;
|
|
694
694
|
setMode("editing");
|
|
695
695
|
}, []);
|
|
696
|
-
const requestCancel =
|
|
696
|
+
const requestCancel = React11.useCallback(() => {
|
|
697
697
|
if (isSaving) return;
|
|
698
698
|
if (isDirty) {
|
|
699
699
|
setConfirmOpen(true);
|
|
@@ -701,7 +701,7 @@ function useEditableSection({
|
|
|
701
701
|
}
|
|
702
702
|
exitToReading();
|
|
703
703
|
}, [exitToReading, isDirty, isSaving]);
|
|
704
|
-
const handleSubmit =
|
|
704
|
+
const handleSubmit = React11.useCallback(
|
|
705
705
|
(event) => {
|
|
706
706
|
event.preventDefault();
|
|
707
707
|
if (isSaving) return;
|
|
@@ -721,7 +721,7 @@ function useEditableSection({
|
|
|
721
721
|
},
|
|
722
722
|
[isSaving, onSave, resolvedLabels.saved]
|
|
723
723
|
);
|
|
724
|
-
const handleFormKeyDown =
|
|
724
|
+
const handleFormKeyDown = React11.useCallback(
|
|
725
725
|
(event) => {
|
|
726
726
|
if (event.key !== "Escape") return;
|
|
727
727
|
event.preventDefault();
|
|
@@ -729,7 +729,7 @@ function useEditableSection({
|
|
|
729
729
|
},
|
|
730
730
|
[requestCancel]
|
|
731
731
|
);
|
|
732
|
-
|
|
732
|
+
React11.useEffect(() => {
|
|
733
733
|
if (!stableHeight || !isEditing) return;
|
|
734
734
|
const el = contentRef.current;
|
|
735
735
|
if (!el) return;
|
|
@@ -968,13 +968,13 @@ function SafeImage({
|
|
|
968
968
|
onError,
|
|
969
969
|
...imgProps
|
|
970
970
|
}) {
|
|
971
|
-
const [failed, setFailed] =
|
|
972
|
-
const imgRef =
|
|
971
|
+
const [failed, setFailed] = React11.useState(false);
|
|
972
|
+
const imgRef = React11.useRef(null);
|
|
973
973
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
974
|
-
|
|
974
|
+
React11.useLayoutEffect(() => {
|
|
975
975
|
setFailed(false);
|
|
976
976
|
}, [resolvedSrc]);
|
|
977
|
-
|
|
977
|
+
React11.useLayoutEffect(() => {
|
|
978
978
|
const img = imgRef.current;
|
|
979
979
|
if (img && isBrokenImage(img)) {
|
|
980
980
|
setFailed(true);
|
|
@@ -1045,18 +1045,18 @@ function ThemeSwitcher({
|
|
|
1045
1045
|
labels: userLabels
|
|
1046
1046
|
}) {
|
|
1047
1047
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
1048
|
-
const [mounted, setMounted] =
|
|
1048
|
+
const [mounted, setMounted] = React11.useState(false);
|
|
1049
1049
|
const reduceMotion = framerMotion.useReducedMotion();
|
|
1050
1050
|
const sizes = sizeClasses[size];
|
|
1051
1051
|
const shapeClass = shapeClasses[shape];
|
|
1052
1052
|
const labels = { ...defaultLabels, ...userLabels };
|
|
1053
|
-
const handleThemeClick =
|
|
1053
|
+
const handleThemeClick = React11.useCallback(
|
|
1054
1054
|
(themeKey) => {
|
|
1055
1055
|
setTheme(themeKey);
|
|
1056
1056
|
},
|
|
1057
1057
|
[setTheme]
|
|
1058
1058
|
);
|
|
1059
|
-
|
|
1059
|
+
React11.useEffect(() => {
|
|
1060
1060
|
setMounted(true);
|
|
1061
1061
|
}, []);
|
|
1062
1062
|
if (!mounted) {
|
|
@@ -1227,7 +1227,7 @@ function LanguageSwitcher({
|
|
|
1227
1227
|
const sizes = sizeClasses2[size];
|
|
1228
1228
|
const shapeClass = shapeClasses2[shape];
|
|
1229
1229
|
const reduceMotion = framerMotion.useReducedMotion();
|
|
1230
|
-
const layoutId = `${
|
|
1230
|
+
const layoutId = `${React11.useId()}-activeLanguage`;
|
|
1231
1231
|
const defaultLabels2 = {
|
|
1232
1232
|
language: labels.language ?? "Language"
|
|
1233
1233
|
};
|
|
@@ -1337,7 +1337,7 @@ function Slider({
|
|
|
1337
1337
|
max = 100,
|
|
1338
1338
|
...props
|
|
1339
1339
|
}) {
|
|
1340
|
-
const _values =
|
|
1340
|
+
const _values = React11__namespace.useMemo(
|
|
1341
1341
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1342
1342
|
[value, defaultValue, min, max]
|
|
1343
1343
|
);
|
|
@@ -1448,18 +1448,18 @@ function AvatarEditor({
|
|
|
1448
1448
|
labels
|
|
1449
1449
|
}) {
|
|
1450
1450
|
const t = { ...DEFAULT_LABELS, ...labels };
|
|
1451
|
-
const canvasRef =
|
|
1452
|
-
const fileInputRef =
|
|
1453
|
-
const containerRef =
|
|
1454
|
-
const [image, setImage] =
|
|
1455
|
-
const [imageLoaded, setImageLoaded] =
|
|
1456
|
-
const [zoom, setZoom] =
|
|
1457
|
-
const [rotation, setRotation] =
|
|
1458
|
-
const [position, setPosition] =
|
|
1459
|
-
const [isDragging, setIsDragging] =
|
|
1460
|
-
const [dragStart, setDragStart] =
|
|
1461
|
-
const [showGrid, setShowGrid] =
|
|
1462
|
-
const generateOutput =
|
|
1451
|
+
const canvasRef = React11.useRef(null);
|
|
1452
|
+
const fileInputRef = React11.useRef(null);
|
|
1453
|
+
const containerRef = React11.useRef(null);
|
|
1454
|
+
const [image, setImage] = React11.useState(null);
|
|
1455
|
+
const [imageLoaded, setImageLoaded] = React11.useState(false);
|
|
1456
|
+
const [zoom, setZoom] = React11.useState(1);
|
|
1457
|
+
const [rotation, setRotation] = React11.useState(0);
|
|
1458
|
+
const [position, setPosition] = React11.useState({ x: 0, y: 0 });
|
|
1459
|
+
const [isDragging, setIsDragging] = React11.useState(false);
|
|
1460
|
+
const [dragStart, setDragStart] = React11.useState({ x: 0, y: 0 });
|
|
1461
|
+
const [showGrid, setShowGrid] = React11.useState(initialShowGrid);
|
|
1462
|
+
const generateOutput = React11.useCallback(() => {
|
|
1463
1463
|
if (!canvasRef.current || !image) return null;
|
|
1464
1464
|
const outputCanvas = document.createElement("canvas");
|
|
1465
1465
|
outputCanvas.width = outputSize;
|
|
@@ -1470,7 +1470,7 @@ function AvatarEditor({
|
|
|
1470
1470
|
const mimeType = `image/${outputFormat}`;
|
|
1471
1471
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
1472
1472
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
1473
|
-
|
|
1473
|
+
React11.useEffect(() => {
|
|
1474
1474
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
1475
1475
|
const canvas = canvasRef.current;
|
|
1476
1476
|
const ctx = canvas.getContext("2d");
|
|
@@ -1514,12 +1514,12 @@ function AvatarEditor({
|
|
|
1514
1514
|
generateOutput,
|
|
1515
1515
|
onChange
|
|
1516
1516
|
]);
|
|
1517
|
-
const resetTransforms =
|
|
1517
|
+
const resetTransforms = React11.useCallback(() => {
|
|
1518
1518
|
setZoom(1);
|
|
1519
1519
|
setRotation(0);
|
|
1520
1520
|
setPosition({ x: 0, y: 0 });
|
|
1521
1521
|
}, []);
|
|
1522
|
-
const handleFileSelect =
|
|
1522
|
+
const handleFileSelect = React11.useCallback(
|
|
1523
1523
|
(e) => {
|
|
1524
1524
|
const file = e.target.files?.[0];
|
|
1525
1525
|
if (!file) return;
|
|
@@ -1538,7 +1538,7 @@ function AvatarEditor({
|
|
|
1538
1538
|
},
|
|
1539
1539
|
[resetTransforms]
|
|
1540
1540
|
);
|
|
1541
|
-
const handleMouseDown =
|
|
1541
|
+
const handleMouseDown = React11.useCallback(
|
|
1542
1542
|
(e) => {
|
|
1543
1543
|
if (!imageLoaded) return;
|
|
1544
1544
|
setIsDragging(true);
|
|
@@ -1546,7 +1546,7 @@ function AvatarEditor({
|
|
|
1546
1546
|
},
|
|
1547
1547
|
[imageLoaded, position]
|
|
1548
1548
|
);
|
|
1549
|
-
const handleMouseMove =
|
|
1549
|
+
const handleMouseMove = React11.useCallback(
|
|
1550
1550
|
(e) => {
|
|
1551
1551
|
if (!isDragging) return;
|
|
1552
1552
|
setPosition({
|
|
@@ -1556,10 +1556,10 @@ function AvatarEditor({
|
|
|
1556
1556
|
},
|
|
1557
1557
|
[isDragging, dragStart]
|
|
1558
1558
|
);
|
|
1559
|
-
const handleMouseUp =
|
|
1559
|
+
const handleMouseUp = React11.useCallback(() => {
|
|
1560
1560
|
setIsDragging(false);
|
|
1561
1561
|
}, []);
|
|
1562
|
-
const handleTouchStart =
|
|
1562
|
+
const handleTouchStart = React11.useCallback(
|
|
1563
1563
|
(e) => {
|
|
1564
1564
|
if (!imageLoaded) return;
|
|
1565
1565
|
const touch = e.touches[0];
|
|
@@ -1571,7 +1571,7 @@ function AvatarEditor({
|
|
|
1571
1571
|
},
|
|
1572
1572
|
[imageLoaded, position]
|
|
1573
1573
|
);
|
|
1574
|
-
const handleTouchMove =
|
|
1574
|
+
const handleTouchMove = React11.useCallback(
|
|
1575
1575
|
(e) => {
|
|
1576
1576
|
if (!isDragging) return;
|
|
1577
1577
|
const touch = e.touches[0];
|
|
@@ -1582,7 +1582,7 @@ function AvatarEditor({
|
|
|
1582
1582
|
},
|
|
1583
1583
|
[isDragging, dragStart]
|
|
1584
1584
|
);
|
|
1585
|
-
const handleDiscard =
|
|
1585
|
+
const handleDiscard = React11.useCallback(() => {
|
|
1586
1586
|
setImage(null);
|
|
1587
1587
|
setImageLoaded(false);
|
|
1588
1588
|
resetTransforms();
|
|
@@ -2150,8 +2150,8 @@ function DrawerTitle({
|
|
|
2150
2150
|
);
|
|
2151
2151
|
}
|
|
2152
2152
|
function useMediaQuery(query) {
|
|
2153
|
-
const [matches, setMatches] =
|
|
2154
|
-
|
|
2153
|
+
const [matches, setMatches] = React11.useState(false);
|
|
2154
|
+
React11.useEffect(() => {
|
|
2155
2155
|
const media = window.matchMedia(query);
|
|
2156
2156
|
if (media.matches !== matches) {
|
|
2157
2157
|
setMatches(media.matches);
|
|
@@ -2181,17 +2181,17 @@ function AvatarEditorDialog({
|
|
|
2181
2181
|
className,
|
|
2182
2182
|
editorLabels
|
|
2183
2183
|
}) {
|
|
2184
|
-
const [isOpen, setIsOpen] =
|
|
2185
|
-
const [editedValue, setEditedValue] =
|
|
2186
|
-
const [displaySrc, setDisplaySrc] =
|
|
2187
|
-
const [isSaving, setIsSaving] =
|
|
2188
|
-
const [feedback, setFeedback] =
|
|
2189
|
-
|
|
2184
|
+
const [isOpen, setIsOpen] = React11.useState(false);
|
|
2185
|
+
const [editedValue, setEditedValue] = React11.useState(value ?? null);
|
|
2186
|
+
const [displaySrc, setDisplaySrc] = React11.useState(value ?? null);
|
|
2187
|
+
const [isSaving, setIsSaving] = React11.useState(false);
|
|
2188
|
+
const [feedback, setFeedback] = React11.useState(null);
|
|
2189
|
+
React11.useEffect(() => {
|
|
2190
2190
|
setDisplaySrc(value ?? null);
|
|
2191
2191
|
}, [value]);
|
|
2192
2192
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
2193
2193
|
const caption = (placeholder ?? "").trim();
|
|
2194
|
-
const handleOpenChange =
|
|
2194
|
+
const handleOpenChange = React11.useCallback(
|
|
2195
2195
|
(open) => {
|
|
2196
2196
|
if (open) {
|
|
2197
2197
|
setEditedValue(value ?? null);
|
|
@@ -2201,7 +2201,7 @@ function AvatarEditorDialog({
|
|
|
2201
2201
|
},
|
|
2202
2202
|
[value]
|
|
2203
2203
|
);
|
|
2204
|
-
const handleAccept =
|
|
2204
|
+
const handleAccept = React11.useCallback(async () => {
|
|
2205
2205
|
if (!editedValue) return;
|
|
2206
2206
|
setIsSaving(true);
|
|
2207
2207
|
setFeedback(null);
|
|
@@ -2373,6 +2373,424 @@ function AvatarEditorDialog({
|
|
|
2373
2373
|
] }) })
|
|
2374
2374
|
] });
|
|
2375
2375
|
}
|
|
2376
|
+
|
|
2377
|
+
// src/components/video/shader-config.ts
|
|
2378
|
+
var SHADER_CURTAIN_TYPES = ["plane", "sphere", "waterPlane"];
|
|
2379
|
+
var SHADER_VARIANTS = [
|
|
2380
|
+
"defaults",
|
|
2381
|
+
"cosmic",
|
|
2382
|
+
"glass",
|
|
2383
|
+
"positionMix"
|
|
2384
|
+
];
|
|
2385
|
+
var SHADER_LIGHT_TYPES = ["3d", "env"];
|
|
2386
|
+
var SHADER_ENV_PRESETS = ["city", "dawn", "lobby"];
|
|
2387
|
+
var SHADER_ON_OFF = ["on", "off"];
|
|
2388
|
+
var SHADER_RANGE = ["enabled", "disabled"];
|
|
2389
|
+
var DEFAULT_SHADER_CURTAIN_CONFIG = {
|
|
2390
|
+
type: "plane",
|
|
2391
|
+
shader: "defaults",
|
|
2392
|
+
animate: "on",
|
|
2393
|
+
uTime: 0,
|
|
2394
|
+
uSpeed: 0.4,
|
|
2395
|
+
uStrength: 2,
|
|
2396
|
+
uDensity: 1.2,
|
|
2397
|
+
uFrequency: 5.5,
|
|
2398
|
+
uAmplitude: 1,
|
|
2399
|
+
wireframe: false,
|
|
2400
|
+
loop: "on",
|
|
2401
|
+
loopDuration: 10,
|
|
2402
|
+
range: "disabled",
|
|
2403
|
+
rangeStart: 0,
|
|
2404
|
+
rangeEnd: 10,
|
|
2405
|
+
positionX: 0,
|
|
2406
|
+
positionY: 0,
|
|
2407
|
+
positionZ: 0,
|
|
2408
|
+
rotationX: 0,
|
|
2409
|
+
rotationY: 0,
|
|
2410
|
+
rotationZ: 0,
|
|
2411
|
+
color1: "#52ff89",
|
|
2412
|
+
color2: "#dbba95",
|
|
2413
|
+
color3: "#d0bce1",
|
|
2414
|
+
reflection: 0.1,
|
|
2415
|
+
brightness: 1.2,
|
|
2416
|
+
cAzimuthAngle: 180,
|
|
2417
|
+
cPolarAngle: 90,
|
|
2418
|
+
cDistance: 3.6,
|
|
2419
|
+
cameraZoom: 1,
|
|
2420
|
+
fov: 45,
|
|
2421
|
+
zoomOut: false,
|
|
2422
|
+
lightType: "3d",
|
|
2423
|
+
envPreset: "city",
|
|
2424
|
+
grain: "off",
|
|
2425
|
+
grainBlending: 0.3,
|
|
2426
|
+
pixelDensity: 1
|
|
2427
|
+
};
|
|
2428
|
+
var SHADER_CURTAIN_PRESETS = [
|
|
2429
|
+
{ id: "halo", title: "Halo", config: { ...DEFAULT_SHADER_CURTAIN_CONFIG } },
|
|
2430
|
+
{
|
|
2431
|
+
id: "pensive",
|
|
2432
|
+
title: "Pensive",
|
|
2433
|
+
config: {
|
|
2434
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2435
|
+
type: "waterPlane",
|
|
2436
|
+
color1: "#809bd6",
|
|
2437
|
+
color2: "#910aff",
|
|
2438
|
+
color3: "#af38ff",
|
|
2439
|
+
uSpeed: 0.3,
|
|
2440
|
+
uStrength: 0.3,
|
|
2441
|
+
uDensity: 0.8
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
id: "mint",
|
|
2446
|
+
title: "Mint",
|
|
2447
|
+
config: {
|
|
2448
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2449
|
+
type: "waterPlane",
|
|
2450
|
+
color1: "#73bfc4",
|
|
2451
|
+
color2: "#ffcc81",
|
|
2452
|
+
color3: "#c9f5d3",
|
|
2453
|
+
uSpeed: 0.2,
|
|
2454
|
+
uStrength: 1.1
|
|
2455
|
+
}
|
|
2456
|
+
},
|
|
2457
|
+
{
|
|
2458
|
+
id: "interstella",
|
|
2459
|
+
title: "Interstella",
|
|
2460
|
+
config: {
|
|
2461
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2462
|
+
type: "sphere",
|
|
2463
|
+
color1: "#000000",
|
|
2464
|
+
color2: "#0d57c8",
|
|
2465
|
+
color3: "#7a2150",
|
|
2466
|
+
uDensity: 1.8,
|
|
2467
|
+
cDistance: 7.1,
|
|
2468
|
+
cameraZoom: 15
|
|
2469
|
+
}
|
|
2470
|
+
},
|
|
2471
|
+
{
|
|
2472
|
+
id: "nightyNight",
|
|
2473
|
+
title: "Nighty night",
|
|
2474
|
+
config: {
|
|
2475
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2476
|
+
type: "waterPlane",
|
|
2477
|
+
color1: "#1a1a2e",
|
|
2478
|
+
color2: "#16213e",
|
|
2479
|
+
color3: "#0f3460",
|
|
2480
|
+
grain: "on"
|
|
2481
|
+
}
|
|
2482
|
+
},
|
|
2483
|
+
{
|
|
2484
|
+
id: "violaOrientalis",
|
|
2485
|
+
title: "Viola orientalis",
|
|
2486
|
+
config: {
|
|
2487
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2488
|
+
type: "plane",
|
|
2489
|
+
color1: "#611e69",
|
|
2490
|
+
color2: "#ff7eb3",
|
|
2491
|
+
color3: "#c9b1ff",
|
|
2492
|
+
uStrength: 3.2
|
|
2493
|
+
}
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
id: "universe",
|
|
2497
|
+
title: "Universe",
|
|
2498
|
+
config: {
|
|
2499
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2500
|
+
type: "waterPlane",
|
|
2501
|
+
color1: "#0b1026",
|
|
2502
|
+
color2: "#3d5afe",
|
|
2503
|
+
color3: "#00e5ff",
|
|
2504
|
+
uDensity: 2.2,
|
|
2505
|
+
lightType: "env",
|
|
2506
|
+
envPreset: "city"
|
|
2507
|
+
}
|
|
2508
|
+
},
|
|
2509
|
+
{
|
|
2510
|
+
id: "sunset",
|
|
2511
|
+
title: "Sunset",
|
|
2512
|
+
config: {
|
|
2513
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2514
|
+
type: "plane",
|
|
2515
|
+
color1: "#ff6a1a",
|
|
2516
|
+
color2: "#ffb347",
|
|
2517
|
+
color3: "#fd4912",
|
|
2518
|
+
cPolarAngle: 125,
|
|
2519
|
+
cDistance: 5
|
|
2520
|
+
}
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
id: "mandarin",
|
|
2524
|
+
title: "Mandarin",
|
|
2525
|
+
config: {
|
|
2526
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2527
|
+
type: "sphere",
|
|
2528
|
+
color1: "#ff7a33",
|
|
2529
|
+
color2: "#33a0ff",
|
|
2530
|
+
color3: "#ffc53d",
|
|
2531
|
+
uSpeed: 0.1,
|
|
2532
|
+
uStrength: 0.4,
|
|
2533
|
+
uDensity: 1.1,
|
|
2534
|
+
uAmplitude: 1.4
|
|
2535
|
+
}
|
|
2536
|
+
},
|
|
2537
|
+
{
|
|
2538
|
+
id: "cottonCandy",
|
|
2539
|
+
title: "Cotton candy",
|
|
2540
|
+
config: {
|
|
2541
|
+
...DEFAULT_SHADER_CURTAIN_CONFIG,
|
|
2542
|
+
type: "sphere",
|
|
2543
|
+
color1: "#ffd1dc",
|
|
2544
|
+
color2: "#c5e1ff",
|
|
2545
|
+
color3: "#fff5ba",
|
|
2546
|
+
uSpeed: 0.15,
|
|
2547
|
+
grain: "on"
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
];
|
|
2551
|
+
var HEX = /^#([0-9a-fA-F]{6})$/;
|
|
2552
|
+
var ON_OFF = new Set(SHADER_ON_OFF);
|
|
2553
|
+
var TYPES = new Set(SHADER_CURTAIN_TYPES);
|
|
2554
|
+
var VARIANTS = new Set(SHADER_VARIANTS);
|
|
2555
|
+
var LIGHTS = new Set(SHADER_LIGHT_TYPES);
|
|
2556
|
+
var ENVS = new Set(SHADER_ENV_PRESETS);
|
|
2557
|
+
var RANGES = new Set(SHADER_RANGE);
|
|
2558
|
+
function clamp(value, min, max) {
|
|
2559
|
+
return Math.min(max, Math.max(min, value));
|
|
2560
|
+
}
|
|
2561
|
+
function numberParam(raw, fallback, min, max) {
|
|
2562
|
+
if (raw == null || raw === "") return fallback;
|
|
2563
|
+
const parsed = Number(raw);
|
|
2564
|
+
if (!Number.isFinite(parsed)) return fallback;
|
|
2565
|
+
return clamp(parsed, min, max);
|
|
2566
|
+
}
|
|
2567
|
+
function hexParam(raw, fallback) {
|
|
2568
|
+
if (!raw) return fallback;
|
|
2569
|
+
const value = raw.startsWith("#") ? raw : `#${raw}`;
|
|
2570
|
+
return HEX.test(value) ? value : fallback;
|
|
2571
|
+
}
|
|
2572
|
+
function enumParam(raw, allowed, fallback) {
|
|
2573
|
+
if (!raw) return fallback;
|
|
2574
|
+
return allowed.has(raw) ? raw : fallback;
|
|
2575
|
+
}
|
|
2576
|
+
function boolParam(raw, fallback) {
|
|
2577
|
+
if (raw == null) return fallback;
|
|
2578
|
+
if (raw === "true" || raw === "1" || raw === "on") return true;
|
|
2579
|
+
if (raw === "false" || raw === "0" || raw === "off") return false;
|
|
2580
|
+
return fallback;
|
|
2581
|
+
}
|
|
2582
|
+
function mergeShaderCurtainConfig(partial) {
|
|
2583
|
+
return { ...DEFAULT_SHADER_CURTAIN_CONFIG, ...partial };
|
|
2584
|
+
}
|
|
2585
|
+
function parseShaderGradientUrl(input) {
|
|
2586
|
+
const trimmed = input.trim();
|
|
2587
|
+
if (!trimmed) return null;
|
|
2588
|
+
let url;
|
|
2589
|
+
try {
|
|
2590
|
+
url = new URL(trimmed);
|
|
2591
|
+
} catch {
|
|
2592
|
+
try {
|
|
2593
|
+
url = new URL(`https://www.shadergradient.co/customize?${trimmed}`);
|
|
2594
|
+
} catch {
|
|
2595
|
+
return null;
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
const q = url.searchParams;
|
|
2599
|
+
const known = [
|
|
2600
|
+
"type",
|
|
2601
|
+
"shader",
|
|
2602
|
+
"animate",
|
|
2603
|
+
"color1",
|
|
2604
|
+
"uSpeed",
|
|
2605
|
+
"uStrength",
|
|
2606
|
+
"cDistance",
|
|
2607
|
+
"lightType"
|
|
2608
|
+
];
|
|
2609
|
+
if (!known.some((key) => q.has(key))) return null;
|
|
2610
|
+
const base = DEFAULT_SHADER_CURTAIN_CONFIG;
|
|
2611
|
+
return {
|
|
2612
|
+
type: enumParam(q.get("type"), TYPES, base.type),
|
|
2613
|
+
shader: enumParam(q.get("shader"), VARIANTS, base.shader),
|
|
2614
|
+
animate: enumParam(q.get("animate"), ON_OFF, base.animate),
|
|
2615
|
+
uTime: numberParam(q.get("uTime"), base.uTime, 0, 40),
|
|
2616
|
+
uSpeed: numberParam(q.get("uSpeed"), base.uSpeed, 0, 4),
|
|
2617
|
+
uStrength: numberParam(q.get("uStrength"), base.uStrength, 0, 10),
|
|
2618
|
+
uDensity: numberParam(q.get("uDensity"), base.uDensity, 0, 8),
|
|
2619
|
+
uFrequency: numberParam(q.get("uFrequency"), base.uFrequency, 0, 12),
|
|
2620
|
+
uAmplitude: numberParam(q.get("uAmplitude"), base.uAmplitude, 0, 8),
|
|
2621
|
+
wireframe: boolParam(q.get("wireframe"), base.wireframe),
|
|
2622
|
+
loop: enumParam(q.get("loop"), ON_OFF, base.loop),
|
|
2623
|
+
loopDuration: numberParam(q.get("loopDuration"), base.loopDuration, 1, 60),
|
|
2624
|
+
range: enumParam(q.get("range"), RANGES, base.range),
|
|
2625
|
+
rangeStart: numberParam(q.get("rangeStart"), base.rangeStart, 0, 40),
|
|
2626
|
+
rangeEnd: numberParam(q.get("rangeEnd"), base.rangeEnd, 0, 40),
|
|
2627
|
+
positionX: numberParam(q.get("positionX"), base.positionX, -20, 20),
|
|
2628
|
+
positionY: numberParam(q.get("positionY"), base.positionY, -20, 20),
|
|
2629
|
+
positionZ: numberParam(q.get("positionZ"), base.positionZ, -20, 20),
|
|
2630
|
+
rotationX: numberParam(q.get("rotationX"), base.rotationX, 0, 360),
|
|
2631
|
+
rotationY: numberParam(q.get("rotationY"), base.rotationY, 0, 360),
|
|
2632
|
+
rotationZ: numberParam(q.get("rotationZ"), base.rotationZ, 0, 360),
|
|
2633
|
+
color1: hexParam(q.get("color1"), base.color1),
|
|
2634
|
+
color2: hexParam(q.get("color2"), base.color2),
|
|
2635
|
+
color3: hexParam(q.get("color3"), base.color3),
|
|
2636
|
+
reflection: numberParam(q.get("reflection"), base.reflection, 0, 1),
|
|
2637
|
+
brightness: numberParam(q.get("brightness"), base.brightness, 0, 4),
|
|
2638
|
+
cAzimuthAngle: numberParam(
|
|
2639
|
+
q.get("cAzimuthAngle"),
|
|
2640
|
+
base.cAzimuthAngle,
|
|
2641
|
+
0,
|
|
2642
|
+
360
|
|
2643
|
+
),
|
|
2644
|
+
cPolarAngle: numberParam(q.get("cPolarAngle"), base.cPolarAngle, 0, 180),
|
|
2645
|
+
cDistance: numberParam(q.get("cDistance"), base.cDistance, 0.1, 40),
|
|
2646
|
+
cameraZoom: numberParam(q.get("cameraZoom"), base.cameraZoom, 0.1, 50),
|
|
2647
|
+
fov: numberParam(q.get("fov"), base.fov, 10, 120),
|
|
2648
|
+
zoomOut: boolParam(q.get("zoomOut"), base.zoomOut),
|
|
2649
|
+
lightType: enumParam(q.get("lightType"), LIGHTS, base.lightType),
|
|
2650
|
+
envPreset: enumParam(q.get("envPreset"), ENVS, base.envPreset),
|
|
2651
|
+
grain: enumParam(q.get("grain"), ON_OFF, base.grain),
|
|
2652
|
+
grainBlending: numberParam(
|
|
2653
|
+
q.get("grainBlending"),
|
|
2654
|
+
base.grainBlending,
|
|
2655
|
+
0,
|
|
2656
|
+
1
|
|
2657
|
+
),
|
|
2658
|
+
pixelDensity: numberParam(q.get("pixelDensity"), base.pixelDensity, 0.5, 2)
|
|
2659
|
+
};
|
|
2660
|
+
}
|
|
2661
|
+
function toShaderGradientUrl(config) {
|
|
2662
|
+
const params = new URLSearchParams();
|
|
2663
|
+
Object.keys(DEFAULT_SHADER_CURTAIN_CONFIG).forEach((key) => {
|
|
2664
|
+
params.set(key, String(config[key]));
|
|
2665
|
+
});
|
|
2666
|
+
return `https://www.shadergradient.co/customize?${params.toString()}`;
|
|
2667
|
+
}
|
|
2668
|
+
function isShaderCurtainKind(kind) {
|
|
2669
|
+
return kind === "shader";
|
|
2670
|
+
}
|
|
2671
|
+
function webglAvailable() {
|
|
2672
|
+
if (typeof document === "undefined") return false;
|
|
2673
|
+
try {
|
|
2674
|
+
const canvas = document.createElement("canvas");
|
|
2675
|
+
return Boolean(
|
|
2676
|
+
canvas.getContext("webgl") || canvas.getContext("experimental-webgl")
|
|
2677
|
+
);
|
|
2678
|
+
} catch {
|
|
2679
|
+
return false;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
function Poster({
|
|
2683
|
+
url,
|
|
2684
|
+
alt,
|
|
2685
|
+
className
|
|
2686
|
+
}) {
|
|
2687
|
+
if (!url) {
|
|
2688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2689
|
+
"div",
|
|
2690
|
+
{
|
|
2691
|
+
className: cn("h-full w-full bg-zinc-950", className),
|
|
2692
|
+
"aria-hidden": alt ? void 0 : true
|
|
2693
|
+
}
|
|
2694
|
+
);
|
|
2695
|
+
}
|
|
2696
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2697
|
+
"img",
|
|
2698
|
+
{
|
|
2699
|
+
src: url,
|
|
2700
|
+
alt,
|
|
2701
|
+
className: cn("h-full w-full object-cover", className)
|
|
2702
|
+
}
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
function ShaderCurtain({
|
|
2706
|
+
config,
|
|
2707
|
+
posterUrl,
|
|
2708
|
+
envBasePath,
|
|
2709
|
+
className,
|
|
2710
|
+
preserveDrawingBuffer = false,
|
|
2711
|
+
reducedMotion = false,
|
|
2712
|
+
alt = ""
|
|
2713
|
+
}) {
|
|
2714
|
+
const [module, setModule] = React11__namespace.useState(null);
|
|
2715
|
+
const [failed, setFailed] = React11__namespace.useState(false);
|
|
2716
|
+
const resolved = mergeShaderCurtainConfig(config);
|
|
2717
|
+
React11__namespace.useEffect(() => {
|
|
2718
|
+
if (reducedMotion || !webglAvailable()) {
|
|
2719
|
+
setFailed(true);
|
|
2720
|
+
return;
|
|
2721
|
+
}
|
|
2722
|
+
let cancelled = false;
|
|
2723
|
+
void import('@shadergradient/react').then((loaded) => {
|
|
2724
|
+
if (cancelled) return;
|
|
2725
|
+
if (!loaded.ShaderGradientCanvas || !loaded.ShaderGradient) {
|
|
2726
|
+
setFailed(true);
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
setModule(loaded);
|
|
2730
|
+
}).catch(() => {
|
|
2731
|
+
if (!cancelled) setFailed(true);
|
|
2732
|
+
});
|
|
2733
|
+
return () => {
|
|
2734
|
+
cancelled = true;
|
|
2735
|
+
};
|
|
2736
|
+
}, [reducedMotion]);
|
|
2737
|
+
if (failed || reducedMotion || !module) {
|
|
2738
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Poster, { url: posterUrl, alt, className });
|
|
2739
|
+
}
|
|
2740
|
+
const { ShaderGradientCanvas, ShaderGradient } = module;
|
|
2741
|
+
const animate = resolved.animate === "off" || reducedMotion ? "off" : "on";
|
|
2742
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative h-full w-full overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2743
|
+
ShaderGradientCanvas,
|
|
2744
|
+
{
|
|
2745
|
+
style: { position: "absolute", inset: 0 },
|
|
2746
|
+
pixelDensity: resolved.pixelDensity,
|
|
2747
|
+
fov: resolved.fov,
|
|
2748
|
+
envBasePath,
|
|
2749
|
+
preserveDrawingBuffer,
|
|
2750
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2751
|
+
ShaderGradient,
|
|
2752
|
+
{
|
|
2753
|
+
control: "props",
|
|
2754
|
+
type: resolved.type,
|
|
2755
|
+
shader: resolved.shader,
|
|
2756
|
+
animate,
|
|
2757
|
+
uTime: resolved.uTime,
|
|
2758
|
+
uSpeed: resolved.uSpeed,
|
|
2759
|
+
uStrength: resolved.uStrength,
|
|
2760
|
+
uDensity: resolved.uDensity,
|
|
2761
|
+
uFrequency: resolved.uFrequency,
|
|
2762
|
+
uAmplitude: resolved.uAmplitude,
|
|
2763
|
+
wireframe: resolved.wireframe,
|
|
2764
|
+
loop: resolved.loop,
|
|
2765
|
+
loopDuration: resolved.loopDuration,
|
|
2766
|
+
range: resolved.range,
|
|
2767
|
+
rangeStart: resolved.rangeStart,
|
|
2768
|
+
rangeEnd: resolved.rangeEnd,
|
|
2769
|
+
positionX: resolved.positionX,
|
|
2770
|
+
positionY: resolved.positionY,
|
|
2771
|
+
positionZ: resolved.positionZ,
|
|
2772
|
+
rotationX: resolved.rotationX,
|
|
2773
|
+
rotationY: resolved.rotationY,
|
|
2774
|
+
rotationZ: resolved.rotationZ,
|
|
2775
|
+
color1: resolved.color1,
|
|
2776
|
+
color2: resolved.color2,
|
|
2777
|
+
color3: resolved.color3,
|
|
2778
|
+
reflection: resolved.reflection,
|
|
2779
|
+
brightness: resolved.brightness,
|
|
2780
|
+
cAzimuthAngle: resolved.cAzimuthAngle,
|
|
2781
|
+
cPolarAngle: resolved.cPolarAngle,
|
|
2782
|
+
cDistance: resolved.cDistance,
|
|
2783
|
+
cameraZoom: resolved.cameraZoom,
|
|
2784
|
+
zoomOut: resolved.zoomOut,
|
|
2785
|
+
lightType: resolved.lightType,
|
|
2786
|
+
envPreset: resolved.envPreset,
|
|
2787
|
+
grain: resolved.grain,
|
|
2788
|
+
grainBlending: resolved.grainBlending
|
|
2789
|
+
}
|
|
2790
|
+
)
|
|
2791
|
+
}
|
|
2792
|
+
) });
|
|
2793
|
+
}
|
|
2376
2794
|
var DEFAULT_LABELS2 = {
|
|
2377
2795
|
play: "Play",
|
|
2378
2796
|
tapToUnmute: "Tap to unmute",
|
|
@@ -2405,8 +2823,8 @@ function probeVideoAudio(el) {
|
|
|
2405
2823
|
return "unknown";
|
|
2406
2824
|
}
|
|
2407
2825
|
function usePrefersReducedMotion() {
|
|
2408
|
-
const [reduced, setReduced] =
|
|
2409
|
-
|
|
2826
|
+
const [reduced, setReduced] = React11__namespace.useState(false);
|
|
2827
|
+
React11__namespace.useEffect(() => {
|
|
2410
2828
|
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2411
2829
|
const sync = () => setReduced(media.matches);
|
|
2412
2830
|
sync();
|
|
@@ -2423,11 +2841,11 @@ function CurtainVideo({
|
|
|
2423
2841
|
allowSound,
|
|
2424
2842
|
labels
|
|
2425
2843
|
}) {
|
|
2426
|
-
const videoRef =
|
|
2427
|
-
const [playback, setPlayback] =
|
|
2428
|
-
const [muted, setMuted] =
|
|
2429
|
-
const [audio, setAudio] =
|
|
2430
|
-
|
|
2844
|
+
const videoRef = React11__namespace.useRef(null);
|
|
2845
|
+
const [playback, setPlayback] = React11__namespace.useState("pending");
|
|
2846
|
+
const [muted, setMuted] = React11__namespace.useState(true);
|
|
2847
|
+
const [audio, setAudio] = React11__namespace.useState("unknown");
|
|
2848
|
+
React11__namespace.useEffect(() => {
|
|
2431
2849
|
const el = videoRef.current;
|
|
2432
2850
|
if (!el) return;
|
|
2433
2851
|
el.setAttribute("webkit-playsinline", "");
|
|
@@ -2468,7 +2886,7 @@ function CurtainVideo({
|
|
|
2468
2886
|
el.removeEventListener("loadedmetadata", applyAudio);
|
|
2469
2887
|
};
|
|
2470
2888
|
}, [url, freeze]);
|
|
2471
|
-
const startPlayback =
|
|
2889
|
+
const startPlayback = React11__namespace.useCallback(() => {
|
|
2472
2890
|
const el = videoRef.current;
|
|
2473
2891
|
if (!el) return;
|
|
2474
2892
|
el.muted = true;
|
|
@@ -2484,7 +2902,7 @@ function CurtainVideo({
|
|
|
2484
2902
|
}
|
|
2485
2903
|
);
|
|
2486
2904
|
}, []);
|
|
2487
|
-
const setVideoMuted =
|
|
2905
|
+
const setVideoMuted = React11__namespace.useCallback((next) => {
|
|
2488
2906
|
const el = videoRef.current;
|
|
2489
2907
|
if (el) el.muted = next;
|
|
2490
2908
|
setMuted(next);
|
|
@@ -2546,6 +2964,8 @@ function CurtainStage({
|
|
|
2546
2964
|
url,
|
|
2547
2965
|
alt = "",
|
|
2548
2966
|
className,
|
|
2967
|
+
config,
|
|
2968
|
+
envBasePath,
|
|
2549
2969
|
reducedMotion,
|
|
2550
2970
|
allowSound = false,
|
|
2551
2971
|
labels
|
|
@@ -2553,31 +2973,49 @@ function CurtainStage({
|
|
|
2553
2973
|
const prefersReduced = usePrefersReducedMotion();
|
|
2554
2974
|
const freeze = reducedMotion ?? prefersReduced;
|
|
2555
2975
|
const copy = { ...DEFAULT_LABELS2, ...labels };
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2976
|
+
switch (kind) {
|
|
2977
|
+
case "video":
|
|
2978
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2979
|
+
CurtainVideo,
|
|
2980
|
+
{
|
|
2981
|
+
url,
|
|
2982
|
+
alt,
|
|
2983
|
+
className,
|
|
2984
|
+
freeze,
|
|
2985
|
+
allowSound,
|
|
2986
|
+
labels: copy
|
|
2987
|
+
}
|
|
2988
|
+
);
|
|
2989
|
+
case "shader":
|
|
2990
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2991
|
+
ShaderCurtain,
|
|
2992
|
+
{
|
|
2993
|
+
config: mergeShaderCurtainConfig(config),
|
|
2994
|
+
posterUrl: url,
|
|
2995
|
+
envBasePath,
|
|
2996
|
+
reducedMotion: freeze,
|
|
2997
|
+
alt,
|
|
2998
|
+
className
|
|
2999
|
+
}
|
|
3000
|
+
);
|
|
3001
|
+
case "image":
|
|
3002
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3003
|
+
"img",
|
|
3004
|
+
{
|
|
3005
|
+
src: url,
|
|
3006
|
+
alt,
|
|
3007
|
+
className: cn("h-full w-full object-cover", className)
|
|
3008
|
+
}
|
|
3009
|
+
);
|
|
3010
|
+
default: {
|
|
3011
|
+
const _exhaustive = kind;
|
|
3012
|
+
return _exhaustive;
|
|
2575
3013
|
}
|
|
2576
|
-
|
|
3014
|
+
}
|
|
2577
3015
|
}
|
|
2578
3016
|
function useMediaQuery2(query) {
|
|
2579
|
-
const [matches, setMatches] =
|
|
2580
|
-
|
|
3017
|
+
const [matches, setMatches] = React11.useState(false);
|
|
3018
|
+
React11.useEffect(() => {
|
|
2581
3019
|
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
2582
3020
|
const mql = window.matchMedia(query);
|
|
2583
3021
|
const onChange = () => setMatches(mql.matches);
|
|
@@ -2591,9 +3029,9 @@ function isVideoKind(kind) {
|
|
|
2591
3029
|
return kind === "video";
|
|
2592
3030
|
}
|
|
2593
3031
|
function useElementInView(enabled) {
|
|
2594
|
-
const [node, setNode] =
|
|
2595
|
-
const [inView, setInView] =
|
|
2596
|
-
|
|
3032
|
+
const [node, setNode] = React11__namespace.useState(null);
|
|
3033
|
+
const [inView, setInView] = React11__namespace.useState(false);
|
|
3034
|
+
React11__namespace.useEffect(() => {
|
|
2597
3035
|
if (!enabled || !node || typeof IntersectionObserver === "undefined") {
|
|
2598
3036
|
setInView(false);
|
|
2599
3037
|
return;
|
|
@@ -2661,9 +3099,11 @@ var DEFAULT_CURTAIN_PICKER_LABELS = {
|
|
|
2661
3099
|
noneDescription: "Use the default curtain",
|
|
2662
3100
|
defaultBadge: "Default",
|
|
2663
3101
|
makeDefault: "Set as default",
|
|
3102
|
+
edit: "Edit",
|
|
2664
3103
|
delete: "Delete",
|
|
2665
3104
|
image: "Image",
|
|
2666
3105
|
video: "Video",
|
|
3106
|
+
shader: "Shader",
|
|
2667
3107
|
organization: "Organization",
|
|
2668
3108
|
platform: "Catalog",
|
|
2669
3109
|
groupOrganization: "Your curtains",
|
|
@@ -2688,7 +3128,9 @@ function ownerGroup(ownerType) {
|
|
|
2688
3128
|
}
|
|
2689
3129
|
}
|
|
2690
3130
|
function kindLabel(kind, copy) {
|
|
2691
|
-
|
|
3131
|
+
if (kind === "video") return copy.video;
|
|
3132
|
+
if (kind === "shader") return copy.shader;
|
|
3133
|
+
return copy.image;
|
|
2692
3134
|
}
|
|
2693
3135
|
function ownerLabel(ownerType, copy) {
|
|
2694
3136
|
if (ownerType === "organization") return copy.organization;
|
|
@@ -2716,10 +3158,11 @@ function resolvePreviewItem(selectedId, ready, allowNone) {
|
|
|
2716
3158
|
if (allowNone) return null;
|
|
2717
3159
|
return ready[0] ?? null;
|
|
2718
3160
|
}
|
|
2719
|
-
function itemActions(item, onMakeDefault, onDelete, canMakeDefault, canDelete) {
|
|
3161
|
+
function itemActions(item, onMakeDefault, onEdit, onDelete, canMakeDefault, canDelete) {
|
|
2720
3162
|
if (!item) return {};
|
|
2721
3163
|
return {
|
|
2722
3164
|
onMakeDefault: onMakeDefault && (canMakeDefault ? canMakeDefault(item) : !item.isDefault) ? () => onMakeDefault(item) : void 0,
|
|
3165
|
+
onEdit: onEdit ? () => onEdit(item) : void 0,
|
|
2723
3166
|
onDelete: onDelete && (canDelete ? canDelete(item) : true) ? () => onDelete(item) : void 0
|
|
2724
3167
|
};
|
|
2725
3168
|
}
|
|
@@ -2756,6 +3199,7 @@ function CurtainPicker({
|
|
|
2756
3199
|
variant = "default",
|
|
2757
3200
|
groupByOwner = false,
|
|
2758
3201
|
onMakeDefault,
|
|
3202
|
+
onEdit,
|
|
2759
3203
|
onDelete,
|
|
2760
3204
|
canMakeDefault,
|
|
2761
3205
|
canDelete,
|
|
@@ -2765,7 +3209,7 @@ function CurtainPicker({
|
|
|
2765
3209
|
actionsPending = false
|
|
2766
3210
|
}) {
|
|
2767
3211
|
const copy = { ...DEFAULT_CURTAIN_PICKER_LABELS, ...labels };
|
|
2768
|
-
const groupName =
|
|
3212
|
+
const groupName = React11__namespace.useId();
|
|
2769
3213
|
const selectable = typeof onChange === "function";
|
|
2770
3214
|
const compact = variant === "compact";
|
|
2771
3215
|
const selectedId = value === "" ? null : value ?? null;
|
|
@@ -2777,11 +3221,12 @@ function CurtainPicker({
|
|
|
2777
3221
|
const compactActions = compact ? itemActions(
|
|
2778
3222
|
actionTarget,
|
|
2779
3223
|
onMakeDefault,
|
|
3224
|
+
onEdit,
|
|
2780
3225
|
onDelete,
|
|
2781
3226
|
canMakeDefault,
|
|
2782
3227
|
canDelete
|
|
2783
3228
|
) : {};
|
|
2784
|
-
const grouped =
|
|
3229
|
+
const grouped = React11__namespace.useMemo(() => {
|
|
2785
3230
|
if (!groupByOwner) {
|
|
2786
3231
|
return [{ group: null, items: ready }];
|
|
2787
3232
|
}
|
|
@@ -2822,6 +3267,7 @@ function CurtainPicker({
|
|
|
2822
3267
|
disabled,
|
|
2823
3268
|
actionsPending,
|
|
2824
3269
|
onMakeDefault: compactActions.onMakeDefault,
|
|
3270
|
+
onEdit: compactActions.onEdit,
|
|
2825
3271
|
onDelete: compactActions.onDelete
|
|
2826
3272
|
}
|
|
2827
3273
|
) : null,
|
|
@@ -2844,13 +3290,23 @@ function CurtainPicker({
|
|
|
2844
3290
|
onMakeDefault: compact ? void 0 : itemActions(
|
|
2845
3291
|
item,
|
|
2846
3292
|
onMakeDefault,
|
|
3293
|
+
onEdit,
|
|
2847
3294
|
onDelete,
|
|
2848
3295
|
canMakeDefault,
|
|
2849
3296
|
canDelete
|
|
2850
3297
|
).onMakeDefault,
|
|
3298
|
+
onEdit: compact ? void 0 : itemActions(
|
|
3299
|
+
item,
|
|
3300
|
+
onMakeDefault,
|
|
3301
|
+
onEdit,
|
|
3302
|
+
onDelete,
|
|
3303
|
+
canMakeDefault,
|
|
3304
|
+
canDelete
|
|
3305
|
+
).onEdit,
|
|
2851
3306
|
onDelete: compact ? void 0 : itemActions(
|
|
2852
3307
|
item,
|
|
2853
3308
|
onMakeDefault,
|
|
3309
|
+
onEdit,
|
|
2854
3310
|
onDelete,
|
|
2855
3311
|
canMakeDefault,
|
|
2856
3312
|
canDelete
|
|
@@ -2867,6 +3323,7 @@ function SelectedPreview({
|
|
|
2867
3323
|
disabled,
|
|
2868
3324
|
actionsPending,
|
|
2869
3325
|
onMakeDefault,
|
|
3326
|
+
onEdit,
|
|
2870
3327
|
onDelete
|
|
2871
3328
|
}) {
|
|
2872
3329
|
const owner = item ? ownerLabel(item.ownerType, copy) : null;
|
|
@@ -2910,6 +3367,7 @@ function SelectedPreview({
|
|
|
2910
3367
|
actionsPending,
|
|
2911
3368
|
copy,
|
|
2912
3369
|
onMakeDefault,
|
|
3370
|
+
onEdit,
|
|
2913
3371
|
onDelete
|
|
2914
3372
|
}
|
|
2915
3373
|
)
|
|
@@ -2934,9 +3392,10 @@ function ManageActions({
|
|
|
2934
3392
|
actionsPending,
|
|
2935
3393
|
copy,
|
|
2936
3394
|
onMakeDefault,
|
|
3395
|
+
onEdit,
|
|
2937
3396
|
onDelete
|
|
2938
3397
|
}) {
|
|
2939
|
-
if (!onMakeDefault && !onDelete) return null;
|
|
3398
|
+
if (!onMakeDefault && !onEdit && !onDelete) return null;
|
|
2940
3399
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
2941
3400
|
onMakeDefault ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2942
3401
|
Button,
|
|
@@ -2949,6 +3408,17 @@ function ManageActions({
|
|
|
2949
3408
|
children: copy.makeDefault
|
|
2950
3409
|
}
|
|
2951
3410
|
) : null,
|
|
3411
|
+
onEdit ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3412
|
+
Button,
|
|
3413
|
+
{
|
|
3414
|
+
type: "button",
|
|
3415
|
+
size: "sm",
|
|
3416
|
+
variant: "secondary",
|
|
3417
|
+
disabled: disabled || actionsPending,
|
|
3418
|
+
onClick: onEdit,
|
|
3419
|
+
children: copy.edit
|
|
3420
|
+
}
|
|
3421
|
+
) : null,
|
|
2952
3422
|
onDelete ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2953
3423
|
Button,
|
|
2954
3424
|
{
|
|
@@ -3013,6 +3483,7 @@ function CurtainPickerCard({
|
|
|
3013
3483
|
compact,
|
|
3014
3484
|
onSelect,
|
|
3015
3485
|
onMakeDefault,
|
|
3486
|
+
onEdit,
|
|
3016
3487
|
onDelete
|
|
3017
3488
|
}) {
|
|
3018
3489
|
const owner = ownerLabel(item.ownerType, copy);
|
|
@@ -3078,6 +3549,7 @@ function CurtainPickerCard({
|
|
|
3078
3549
|
actionsPending,
|
|
3079
3550
|
copy,
|
|
3080
3551
|
onMakeDefault,
|
|
3552
|
+
onEdit,
|
|
3081
3553
|
onDelete
|
|
3082
3554
|
}
|
|
3083
3555
|
)
|
|
@@ -3102,12 +3574,14 @@ function WaitingRoom({
|
|
|
3102
3574
|
startsAt,
|
|
3103
3575
|
durationSeconds,
|
|
3104
3576
|
curtain,
|
|
3577
|
+
hideBranding = false,
|
|
3578
|
+
hideStatus = false,
|
|
3105
3579
|
nowMs,
|
|
3106
3580
|
labels,
|
|
3107
3581
|
className
|
|
3108
3582
|
}) {
|
|
3109
|
-
const [now, setNow] =
|
|
3110
|
-
|
|
3583
|
+
const [now, setNow] = React11__namespace.useState(nowMs ?? Date.now());
|
|
3584
|
+
React11__namespace.useEffect(() => {
|
|
3111
3585
|
if (nowMs != null) {
|
|
3112
3586
|
setNow(nowMs);
|
|
3113
3587
|
return;
|
|
@@ -3130,12 +3604,18 @@ function WaitingRoom({
|
|
|
3130
3604
|
{
|
|
3131
3605
|
kind: curtain.kind,
|
|
3132
3606
|
url: curtain.url,
|
|
3607
|
+
config: curtain.config,
|
|
3608
|
+
envBasePath: curtain.envBasePath,
|
|
3133
3609
|
allowSound: true,
|
|
3134
3610
|
className: "absolute inset-0"
|
|
3135
3611
|
}
|
|
3136
3612
|
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-zinc-900 to-zinc-950" }),
|
|
3137
|
-
/* @__PURE__ */ jsxRuntime.jsxs("
|
|
3138
|
-
|
|
3613
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sr-only", role: "status", children: [
|
|
3614
|
+
title,
|
|
3615
|
+
remaining != null ? remaining > 0 ? ` ${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : ` ${labels?.started ?? "Starting soon"}` : ""
|
|
3616
|
+
] }),
|
|
3617
|
+
hideBranding && hideStatus ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative z-10 flex w-full flex-col justify-end gap-3 bg-gradient-to-t from-black/70 via-black/30 to-transparent p-6", children: [
|
|
3618
|
+
hideBranding ? null : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3139
3619
|
organizationImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3140
3620
|
"img",
|
|
3141
3621
|
{
|
|
@@ -3149,14 +3629,637 @@ function WaitingRoom({
|
|
|
3149
3629
|
organizationName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
|
|
3150
3630
|
] })
|
|
3151
3631
|
] }),
|
|
3152
|
-
remaining != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm tabular-nums", children: remaining > 0 ? `${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : labels?.started ?? "Starting soon" }) : null,
|
|
3153
|
-
durationMinutes != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
|
|
3632
|
+
hideStatus ? null : remaining != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm tabular-nums", children: remaining > 0 ? `${labels?.startsIn ?? "Starts in"} ${formatCountdown(remaining)}` : labels?.started ?? "Starting soon" }) : null,
|
|
3633
|
+
hideStatus ? null : durationMinutes != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
|
|
3154
3634
|
] })
|
|
3155
3635
|
]
|
|
3156
3636
|
}
|
|
3157
3637
|
);
|
|
3158
3638
|
}
|
|
3159
3639
|
|
|
3640
|
+
// src/components/video/captureShaderPoster.ts
|
|
3641
|
+
function canvasFromRoot(root) {
|
|
3642
|
+
return root.querySelector("canvas");
|
|
3643
|
+
}
|
|
3644
|
+
function captureShaderPoster(root, options = {}) {
|
|
3645
|
+
const canvas = canvasFromRoot(root);
|
|
3646
|
+
if (!canvas) return Promise.resolve(null);
|
|
3647
|
+
const type = options.type ?? "image/jpeg";
|
|
3648
|
+
const quality = options.quality ?? 0.92;
|
|
3649
|
+
return new Promise((resolve) => {
|
|
3650
|
+
canvas.toBlob(
|
|
3651
|
+
(blob) => resolve(blob),
|
|
3652
|
+
type,
|
|
3653
|
+
type === "image/jpeg" ? quality : void 0
|
|
3654
|
+
);
|
|
3655
|
+
});
|
|
3656
|
+
}
|
|
3657
|
+
var DEFAULT_SHADER_CURTAIN_EDITOR_LABELS = {
|
|
3658
|
+
shape: "Shape",
|
|
3659
|
+
colors: "Colors",
|
|
3660
|
+
light: "Light & effects",
|
|
3661
|
+
camera: "Camera",
|
|
3662
|
+
presets: "Presets",
|
|
3663
|
+
importUrl: "Paste a shadergradient.co URL",
|
|
3664
|
+
importApply: "Apply URL",
|
|
3665
|
+
importError: "Could not read that URL"
|
|
3666
|
+
};
|
|
3667
|
+
function NumberField({
|
|
3668
|
+
label,
|
|
3669
|
+
value,
|
|
3670
|
+
min,
|
|
3671
|
+
max,
|
|
3672
|
+
step,
|
|
3673
|
+
onChange
|
|
3674
|
+
}) {
|
|
3675
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
3676
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: label }),
|
|
3677
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3678
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3679
|
+
"input",
|
|
3680
|
+
{
|
|
3681
|
+
type: "range",
|
|
3682
|
+
min,
|
|
3683
|
+
max,
|
|
3684
|
+
step,
|
|
3685
|
+
value,
|
|
3686
|
+
onChange: (event) => onChange(Number(event.target.value)),
|
|
3687
|
+
className: "min-w-0 flex-1"
|
|
3688
|
+
}
|
|
3689
|
+
),
|
|
3690
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3691
|
+
"input",
|
|
3692
|
+
{
|
|
3693
|
+
type: "number",
|
|
3694
|
+
min,
|
|
3695
|
+
max,
|
|
3696
|
+
step,
|
|
3697
|
+
value,
|
|
3698
|
+
onChange: (event) => onChange(Number(event.target.value)),
|
|
3699
|
+
className: "border-input bg-background w-16 shrink-0 rounded-md border px-2 py-1"
|
|
3700
|
+
}
|
|
3701
|
+
)
|
|
3702
|
+
] })
|
|
3703
|
+
] });
|
|
3704
|
+
}
|
|
3705
|
+
function SelectField({
|
|
3706
|
+
label,
|
|
3707
|
+
value,
|
|
3708
|
+
options,
|
|
3709
|
+
onChange
|
|
3710
|
+
}) {
|
|
3711
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
3712
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: label }),
|
|
3713
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3714
|
+
"select",
|
|
3715
|
+
{
|
|
3716
|
+
value,
|
|
3717
|
+
onChange: (event) => onChange(event.target.value),
|
|
3718
|
+
className: "border-input bg-background rounded-md border px-2 py-1",
|
|
3719
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option, children: option }, option))
|
|
3720
|
+
}
|
|
3721
|
+
)
|
|
3722
|
+
] });
|
|
3723
|
+
}
|
|
3724
|
+
function ColorField({
|
|
3725
|
+
label,
|
|
3726
|
+
value,
|
|
3727
|
+
onChange
|
|
3728
|
+
}) {
|
|
3729
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
3730
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: label }),
|
|
3731
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3732
|
+
"input",
|
|
3733
|
+
{
|
|
3734
|
+
type: "color",
|
|
3735
|
+
value,
|
|
3736
|
+
onChange: (event) => onChange(event.target.value),
|
|
3737
|
+
className: "h-9 w-full cursor-pointer rounded-md border"
|
|
3738
|
+
}
|
|
3739
|
+
)
|
|
3740
|
+
] });
|
|
3741
|
+
}
|
|
3742
|
+
var ShaderCurtainEditor = React11__namespace.forwardRef(function ShaderCurtainEditor2({ value, onChange, envBasePath, className, labels }, ref) {
|
|
3743
|
+
const copy = { ...DEFAULT_SHADER_CURTAIN_EDITOR_LABELS, ...labels };
|
|
3744
|
+
const [config, setConfig] = React11__namespace.useState(
|
|
3745
|
+
() => mergeShaderCurtainConfig(value)
|
|
3746
|
+
);
|
|
3747
|
+
const [tab, setTab] = React11__namespace.useState("shape");
|
|
3748
|
+
const [url, setUrl] = React11__namespace.useState("");
|
|
3749
|
+
const [urlError, setUrlError] = React11__namespace.useState(null);
|
|
3750
|
+
const previewRef = React11__namespace.useRef(null);
|
|
3751
|
+
const update = React11__namespace.useCallback(
|
|
3752
|
+
(patch) => {
|
|
3753
|
+
setConfig((current) => {
|
|
3754
|
+
const next = { ...current, ...patch };
|
|
3755
|
+
onChange?.(next);
|
|
3756
|
+
return next;
|
|
3757
|
+
});
|
|
3758
|
+
},
|
|
3759
|
+
[onChange]
|
|
3760
|
+
);
|
|
3761
|
+
const replace = React11__namespace.useCallback(
|
|
3762
|
+
(next) => {
|
|
3763
|
+
setConfig(next);
|
|
3764
|
+
onChange?.(next);
|
|
3765
|
+
},
|
|
3766
|
+
[onChange]
|
|
3767
|
+
);
|
|
3768
|
+
React11__namespace.useImperativeHandle(ref, () => ({
|
|
3769
|
+
getConfig: () => config,
|
|
3770
|
+
capturePoster: async () => {
|
|
3771
|
+
if (!previewRef.current) return null;
|
|
3772
|
+
return captureShaderPoster(previewRef.current);
|
|
3773
|
+
}
|
|
3774
|
+
}));
|
|
3775
|
+
const applyUrl = () => {
|
|
3776
|
+
const parsed = parseShaderGradientUrl(url);
|
|
3777
|
+
if (!parsed) {
|
|
3778
|
+
setUrlError(copy.importError);
|
|
3779
|
+
return;
|
|
3780
|
+
}
|
|
3781
|
+
setUrlError(null);
|
|
3782
|
+
replace(parsed);
|
|
3783
|
+
};
|
|
3784
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3785
|
+
"div",
|
|
3786
|
+
{
|
|
3787
|
+
className: cn(
|
|
3788
|
+
"grid min-h-0 gap-4 md:grid-cols-2 md:items-start",
|
|
3789
|
+
className
|
|
3790
|
+
),
|
|
3791
|
+
children: [
|
|
3792
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3793
|
+
"div",
|
|
3794
|
+
{
|
|
3795
|
+
ref: previewRef,
|
|
3796
|
+
className: "relative aspect-video overflow-hidden rounded-lg bg-zinc-950 md:sticky md:top-0",
|
|
3797
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3798
|
+
ShaderCurtain,
|
|
3799
|
+
{
|
|
3800
|
+
config,
|
|
3801
|
+
envBasePath,
|
|
3802
|
+
preserveDrawingBuffer: true,
|
|
3803
|
+
className: "absolute inset-0"
|
|
3804
|
+
}
|
|
3805
|
+
)
|
|
3806
|
+
}
|
|
3807
|
+
),
|
|
3808
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-col gap-3", children: [
|
|
3809
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: [
|
|
3810
|
+
["shape", copy.shape],
|
|
3811
|
+
["colors", copy.colors],
|
|
3812
|
+
["light", copy.light],
|
|
3813
|
+
["camera", copy.camera]
|
|
3814
|
+
].map(([id, label]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3815
|
+
Button,
|
|
3816
|
+
{
|
|
3817
|
+
type: "button",
|
|
3818
|
+
size: "sm",
|
|
3819
|
+
variant: tab === id ? "default" : "secondary",
|
|
3820
|
+
onClick: () => setTab(id),
|
|
3821
|
+
children: label
|
|
3822
|
+
},
|
|
3823
|
+
id
|
|
3824
|
+
)) }),
|
|
3825
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-0 max-h-[min(22rem,40dvh)] overflow-y-auto pr-1", children: [
|
|
3826
|
+
tab === "shape" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3827
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3828
|
+
SelectField,
|
|
3829
|
+
{
|
|
3830
|
+
label: "Type",
|
|
3831
|
+
value: config.type,
|
|
3832
|
+
options: SHADER_CURTAIN_TYPES,
|
|
3833
|
+
onChange: (type) => update({ type })
|
|
3834
|
+
}
|
|
3835
|
+
),
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3837
|
+
SelectField,
|
|
3838
|
+
{
|
|
3839
|
+
label: "Shader",
|
|
3840
|
+
value: config.shader,
|
|
3841
|
+
options: SHADER_VARIANTS,
|
|
3842
|
+
onChange: (shader) => update({ shader })
|
|
3843
|
+
}
|
|
3844
|
+
),
|
|
3845
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3846
|
+
SelectField,
|
|
3847
|
+
{
|
|
3848
|
+
label: "Animate",
|
|
3849
|
+
value: config.animate,
|
|
3850
|
+
options: ["on", "off"],
|
|
3851
|
+
onChange: (animate) => update({ animate })
|
|
3852
|
+
}
|
|
3853
|
+
),
|
|
3854
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3855
|
+
SelectField,
|
|
3856
|
+
{
|
|
3857
|
+
label: "Loop",
|
|
3858
|
+
value: config.loop,
|
|
3859
|
+
options: ["on", "off"],
|
|
3860
|
+
onChange: (loop) => update({ loop })
|
|
3861
|
+
}
|
|
3862
|
+
),
|
|
3863
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3864
|
+
NumberField,
|
|
3865
|
+
{
|
|
3866
|
+
label: "Speed",
|
|
3867
|
+
value: config.uSpeed,
|
|
3868
|
+
min: 0,
|
|
3869
|
+
max: 4,
|
|
3870
|
+
step: 0.05,
|
|
3871
|
+
onChange: (uSpeed) => update({ uSpeed })
|
|
3872
|
+
}
|
|
3873
|
+
),
|
|
3874
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3875
|
+
NumberField,
|
|
3876
|
+
{
|
|
3877
|
+
label: "Strength",
|
|
3878
|
+
value: config.uStrength,
|
|
3879
|
+
min: 0,
|
|
3880
|
+
max: 10,
|
|
3881
|
+
step: 0.1,
|
|
3882
|
+
onChange: (uStrength) => update({ uStrength })
|
|
3883
|
+
}
|
|
3884
|
+
),
|
|
3885
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3886
|
+
NumberField,
|
|
3887
|
+
{
|
|
3888
|
+
label: "Density",
|
|
3889
|
+
value: config.uDensity,
|
|
3890
|
+
min: 0,
|
|
3891
|
+
max: 8,
|
|
3892
|
+
step: 0.1,
|
|
3893
|
+
onChange: (uDensity) => update({ uDensity })
|
|
3894
|
+
}
|
|
3895
|
+
),
|
|
3896
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3897
|
+
NumberField,
|
|
3898
|
+
{
|
|
3899
|
+
label: "Frequency",
|
|
3900
|
+
value: config.uFrequency,
|
|
3901
|
+
min: 0,
|
|
3902
|
+
max: 12,
|
|
3903
|
+
step: 0.1,
|
|
3904
|
+
onChange: (uFrequency) => update({ uFrequency })
|
|
3905
|
+
}
|
|
3906
|
+
),
|
|
3907
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3908
|
+
NumberField,
|
|
3909
|
+
{
|
|
3910
|
+
label: "Amplitude",
|
|
3911
|
+
value: config.uAmplitude,
|
|
3912
|
+
min: 0,
|
|
3913
|
+
max: 8,
|
|
3914
|
+
step: 0.1,
|
|
3915
|
+
onChange: (uAmplitude) => update({ uAmplitude })
|
|
3916
|
+
}
|
|
3917
|
+
),
|
|
3918
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3919
|
+
NumberField,
|
|
3920
|
+
{
|
|
3921
|
+
label: "Time",
|
|
3922
|
+
value: config.uTime,
|
|
3923
|
+
min: 0,
|
|
3924
|
+
max: 40,
|
|
3925
|
+
step: 0.1,
|
|
3926
|
+
onChange: (uTime) => update({ uTime })
|
|
3927
|
+
}
|
|
3928
|
+
),
|
|
3929
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3930
|
+
NumberField,
|
|
3931
|
+
{
|
|
3932
|
+
label: "Loop duration",
|
|
3933
|
+
value: config.loopDuration,
|
|
3934
|
+
min: 1,
|
|
3935
|
+
max: 60,
|
|
3936
|
+
step: 1,
|
|
3937
|
+
onChange: (loopDuration) => update({ loopDuration })
|
|
3938
|
+
}
|
|
3939
|
+
),
|
|
3940
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3941
|
+
SelectField,
|
|
3942
|
+
{
|
|
3943
|
+
label: "Range",
|
|
3944
|
+
value: config.range,
|
|
3945
|
+
options: ["enabled", "disabled"],
|
|
3946
|
+
onChange: (range) => update({ range })
|
|
3947
|
+
}
|
|
3948
|
+
),
|
|
3949
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3950
|
+
NumberField,
|
|
3951
|
+
{
|
|
3952
|
+
label: "Range start",
|
|
3953
|
+
value: config.rangeStart,
|
|
3954
|
+
min: 0,
|
|
3955
|
+
max: 40,
|
|
3956
|
+
step: 0.1,
|
|
3957
|
+
onChange: (rangeStart) => update({ rangeStart })
|
|
3958
|
+
}
|
|
3959
|
+
),
|
|
3960
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3961
|
+
NumberField,
|
|
3962
|
+
{
|
|
3963
|
+
label: "Range end",
|
|
3964
|
+
value: config.rangeEnd,
|
|
3965
|
+
min: 0,
|
|
3966
|
+
max: 40,
|
|
3967
|
+
step: 0.1,
|
|
3968
|
+
onChange: (rangeEnd) => update({ rangeEnd })
|
|
3969
|
+
}
|
|
3970
|
+
),
|
|
3971
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "col-span-2 flex items-center gap-2 text-xs", children: [
|
|
3972
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3973
|
+
"input",
|
|
3974
|
+
{
|
|
3975
|
+
type: "checkbox",
|
|
3976
|
+
checked: config.wireframe,
|
|
3977
|
+
onChange: (event) => update({ wireframe: event.target.checked })
|
|
3978
|
+
}
|
|
3979
|
+
),
|
|
3980
|
+
"Wireframe"
|
|
3981
|
+
] })
|
|
3982
|
+
] }) : null,
|
|
3983
|
+
tab === "colors" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
3984
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3985
|
+
ColorField,
|
|
3986
|
+
{
|
|
3987
|
+
label: "Color 1",
|
|
3988
|
+
value: config.color1,
|
|
3989
|
+
onChange: (color1) => update({ color1 })
|
|
3990
|
+
}
|
|
3991
|
+
),
|
|
3992
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3993
|
+
ColorField,
|
|
3994
|
+
{
|
|
3995
|
+
label: "Color 2",
|
|
3996
|
+
value: config.color2,
|
|
3997
|
+
onChange: (color2) => update({ color2 })
|
|
3998
|
+
}
|
|
3999
|
+
),
|
|
4000
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4001
|
+
ColorField,
|
|
4002
|
+
{
|
|
4003
|
+
label: "Color 3",
|
|
4004
|
+
value: config.color3,
|
|
4005
|
+
onChange: (color3) => update({ color3 })
|
|
4006
|
+
}
|
|
4007
|
+
),
|
|
4008
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4009
|
+
NumberField,
|
|
4010
|
+
{
|
|
4011
|
+
label: "Reflection",
|
|
4012
|
+
value: config.reflection,
|
|
4013
|
+
min: 0,
|
|
4014
|
+
max: 1,
|
|
4015
|
+
step: 0.05,
|
|
4016
|
+
onChange: (reflection) => update({ reflection })
|
|
4017
|
+
}
|
|
4018
|
+
),
|
|
4019
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4020
|
+
NumberField,
|
|
4021
|
+
{
|
|
4022
|
+
label: "Brightness",
|
|
4023
|
+
value: config.brightness,
|
|
4024
|
+
min: 0,
|
|
4025
|
+
max: 4,
|
|
4026
|
+
step: 0.05,
|
|
4027
|
+
onChange: (brightness) => update({ brightness })
|
|
4028
|
+
}
|
|
4029
|
+
)
|
|
4030
|
+
] }) : null,
|
|
4031
|
+
tab === "light" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4032
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4033
|
+
SelectField,
|
|
4034
|
+
{
|
|
4035
|
+
label: "Light",
|
|
4036
|
+
value: config.lightType,
|
|
4037
|
+
options: SHADER_LIGHT_TYPES,
|
|
4038
|
+
onChange: (lightType) => update({ lightType })
|
|
4039
|
+
}
|
|
4040
|
+
),
|
|
4041
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4042
|
+
SelectField,
|
|
4043
|
+
{
|
|
4044
|
+
label: "Environment",
|
|
4045
|
+
value: config.envPreset,
|
|
4046
|
+
options: SHADER_ENV_PRESETS,
|
|
4047
|
+
onChange: (envPreset) => update({ envPreset })
|
|
4048
|
+
}
|
|
4049
|
+
),
|
|
4050
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4051
|
+
SelectField,
|
|
4052
|
+
{
|
|
4053
|
+
label: "Grain",
|
|
4054
|
+
value: config.grain,
|
|
4055
|
+
options: ["on", "off"],
|
|
4056
|
+
onChange: (grain) => update({ grain })
|
|
4057
|
+
}
|
|
4058
|
+
),
|
|
4059
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4060
|
+
NumberField,
|
|
4061
|
+
{
|
|
4062
|
+
label: "Grain blending",
|
|
4063
|
+
value: config.grainBlending,
|
|
4064
|
+
min: 0,
|
|
4065
|
+
max: 1,
|
|
4066
|
+
step: 0.05,
|
|
4067
|
+
onChange: (grainBlending) => update({ grainBlending })
|
|
4068
|
+
}
|
|
4069
|
+
)
|
|
4070
|
+
] }) : null,
|
|
4071
|
+
tab === "camera" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
4072
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4073
|
+
NumberField,
|
|
4074
|
+
{
|
|
4075
|
+
label: "Azimuth",
|
|
4076
|
+
value: config.cAzimuthAngle,
|
|
4077
|
+
min: 0,
|
|
4078
|
+
max: 360,
|
|
4079
|
+
step: 1,
|
|
4080
|
+
onChange: (cAzimuthAngle) => update({ cAzimuthAngle })
|
|
4081
|
+
}
|
|
4082
|
+
),
|
|
4083
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4084
|
+
NumberField,
|
|
4085
|
+
{
|
|
4086
|
+
label: "Polar",
|
|
4087
|
+
value: config.cPolarAngle,
|
|
4088
|
+
min: 0,
|
|
4089
|
+
max: 180,
|
|
4090
|
+
step: 1,
|
|
4091
|
+
onChange: (cPolarAngle) => update({ cPolarAngle })
|
|
4092
|
+
}
|
|
4093
|
+
),
|
|
4094
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4095
|
+
NumberField,
|
|
4096
|
+
{
|
|
4097
|
+
label: "Distance",
|
|
4098
|
+
value: config.cDistance,
|
|
4099
|
+
min: 0.1,
|
|
4100
|
+
max: 40,
|
|
4101
|
+
step: 0.1,
|
|
4102
|
+
onChange: (cDistance) => update({ cDistance })
|
|
4103
|
+
}
|
|
4104
|
+
),
|
|
4105
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4106
|
+
NumberField,
|
|
4107
|
+
{
|
|
4108
|
+
label: "Zoom",
|
|
4109
|
+
value: config.cameraZoom,
|
|
4110
|
+
min: 0.1,
|
|
4111
|
+
max: 50,
|
|
4112
|
+
step: 0.1,
|
|
4113
|
+
onChange: (cameraZoom) => update({ cameraZoom })
|
|
4114
|
+
}
|
|
4115
|
+
),
|
|
4116
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4117
|
+
NumberField,
|
|
4118
|
+
{
|
|
4119
|
+
label: "FOV",
|
|
4120
|
+
value: config.fov,
|
|
4121
|
+
min: 10,
|
|
4122
|
+
max: 120,
|
|
4123
|
+
step: 1,
|
|
4124
|
+
onChange: (fov) => update({ fov })
|
|
4125
|
+
}
|
|
4126
|
+
),
|
|
4127
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4128
|
+
NumberField,
|
|
4129
|
+
{
|
|
4130
|
+
label: "Pixel density",
|
|
4131
|
+
value: config.pixelDensity,
|
|
4132
|
+
min: 0.5,
|
|
4133
|
+
max: 2,
|
|
4134
|
+
step: 0.1,
|
|
4135
|
+
onChange: (pixelDensity) => update({ pixelDensity })
|
|
4136
|
+
}
|
|
4137
|
+
),
|
|
4138
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4139
|
+
NumberField,
|
|
4140
|
+
{
|
|
4141
|
+
label: "Position X",
|
|
4142
|
+
value: config.positionX,
|
|
4143
|
+
min: -20,
|
|
4144
|
+
max: 20,
|
|
4145
|
+
step: 0.1,
|
|
4146
|
+
onChange: (positionX) => update({ positionX })
|
|
4147
|
+
}
|
|
4148
|
+
),
|
|
4149
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4150
|
+
NumberField,
|
|
4151
|
+
{
|
|
4152
|
+
label: "Position Y",
|
|
4153
|
+
value: config.positionY,
|
|
4154
|
+
min: -20,
|
|
4155
|
+
max: 20,
|
|
4156
|
+
step: 0.1,
|
|
4157
|
+
onChange: (positionY) => update({ positionY })
|
|
4158
|
+
}
|
|
4159
|
+
),
|
|
4160
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4161
|
+
NumberField,
|
|
4162
|
+
{
|
|
4163
|
+
label: "Position Z",
|
|
4164
|
+
value: config.positionZ,
|
|
4165
|
+
min: -20,
|
|
4166
|
+
max: 20,
|
|
4167
|
+
step: 0.1,
|
|
4168
|
+
onChange: (positionZ) => update({ positionZ })
|
|
4169
|
+
}
|
|
4170
|
+
),
|
|
4171
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4172
|
+
NumberField,
|
|
4173
|
+
{
|
|
4174
|
+
label: "Rotation X",
|
|
4175
|
+
value: config.rotationX,
|
|
4176
|
+
min: 0,
|
|
4177
|
+
max: 360,
|
|
4178
|
+
step: 1,
|
|
4179
|
+
onChange: (rotationX) => update({ rotationX })
|
|
4180
|
+
}
|
|
4181
|
+
),
|
|
4182
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4183
|
+
NumberField,
|
|
4184
|
+
{
|
|
4185
|
+
label: "Rotation Y",
|
|
4186
|
+
value: config.rotationY,
|
|
4187
|
+
min: 0,
|
|
4188
|
+
max: 360,
|
|
4189
|
+
step: 1,
|
|
4190
|
+
onChange: (rotationY) => update({ rotationY })
|
|
4191
|
+
}
|
|
4192
|
+
),
|
|
4193
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4194
|
+
NumberField,
|
|
4195
|
+
{
|
|
4196
|
+
label: "Rotation Z",
|
|
4197
|
+
value: config.rotationZ,
|
|
4198
|
+
min: 0,
|
|
4199
|
+
max: 360,
|
|
4200
|
+
step: 1,
|
|
4201
|
+
onChange: (rotationZ) => update({ rotationZ })
|
|
4202
|
+
}
|
|
4203
|
+
),
|
|
4204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "col-span-2 flex items-center gap-2 text-xs", children: [
|
|
4205
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4206
|
+
"input",
|
|
4207
|
+
{
|
|
4208
|
+
type: "checkbox",
|
|
4209
|
+
checked: config.zoomOut,
|
|
4210
|
+
onChange: (event) => update({ zoomOut: event.target.checked })
|
|
4211
|
+
}
|
|
4212
|
+
),
|
|
4213
|
+
"Zoom out"
|
|
4214
|
+
] })
|
|
4215
|
+
] }) : null
|
|
4216
|
+
] }),
|
|
4217
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
4218
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs", children: copy.presets }),
|
|
4219
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: SHADER_CURTAIN_PRESETS.map((preset) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4220
|
+
Button,
|
|
4221
|
+
{
|
|
4222
|
+
type: "button",
|
|
4223
|
+
size: "sm",
|
|
4224
|
+
variant: "secondary",
|
|
4225
|
+
onClick: () => replace(preset.config),
|
|
4226
|
+
children: preset.title
|
|
4227
|
+
},
|
|
4228
|
+
preset.id
|
|
4229
|
+
)) })
|
|
4230
|
+
] }),
|
|
4231
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2", children: [
|
|
4232
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "grid gap-1 text-xs", children: [
|
|
4233
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: copy.importUrl }),
|
|
4234
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
4235
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4236
|
+
"input",
|
|
4237
|
+
{
|
|
4238
|
+
value: url,
|
|
4239
|
+
onChange: (event) => setUrl(event.target.value),
|
|
4240
|
+
className: "border-input bg-background min-w-0 flex-1 rounded-md border px-2 py-1"
|
|
4241
|
+
}
|
|
4242
|
+
),
|
|
4243
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4244
|
+
Button,
|
|
4245
|
+
{
|
|
4246
|
+
type: "button",
|
|
4247
|
+
size: "sm",
|
|
4248
|
+
variant: "secondary",
|
|
4249
|
+
onClick: applyUrl,
|
|
4250
|
+
children: copy.importApply
|
|
4251
|
+
}
|
|
4252
|
+
)
|
|
4253
|
+
] })
|
|
4254
|
+
] }),
|
|
4255
|
+
urlError ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-xs", role: "alert", children: urlError }) : null
|
|
4256
|
+
] })
|
|
4257
|
+
] })
|
|
4258
|
+
]
|
|
4259
|
+
}
|
|
4260
|
+
);
|
|
4261
|
+
});
|
|
4262
|
+
|
|
3160
4263
|
// src/components/video/castHls.ts
|
|
3161
4264
|
var CAST_SENDER_SRC = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
|
|
3162
4265
|
var DEFAULT_RECEIVER_ID = "CC1AD845";
|
|
@@ -3297,22 +4400,22 @@ function SeekBar({
|
|
|
3297
4400
|
onSeek,
|
|
3298
4401
|
formatTime: formatTime2
|
|
3299
4402
|
}) {
|
|
3300
|
-
const trackRef =
|
|
3301
|
-
const [hoverTime, setHoverTime] =
|
|
3302
|
-
const [cues, setCues] =
|
|
3303
|
-
const loadedSrc =
|
|
3304
|
-
|
|
4403
|
+
const trackRef = React11__namespace.useRef(null);
|
|
4404
|
+
const [hoverTime, setHoverTime] = React11__namespace.useState(null);
|
|
4405
|
+
const [cues, setCues] = React11__namespace.useState(null);
|
|
4406
|
+
const loadedSrc = React11__namespace.useRef(null);
|
|
4407
|
+
React11__namespace.useEffect(() => {
|
|
3305
4408
|
setCues(null);
|
|
3306
4409
|
loadedSrc.current = null;
|
|
3307
4410
|
}, [src]);
|
|
3308
|
-
const ensureCues =
|
|
4411
|
+
const ensureCues = React11__namespace.useCallback(() => {
|
|
3309
4412
|
if (loadedSrc.current === src) return;
|
|
3310
4413
|
loadedSrc.current = src;
|
|
3311
4414
|
void loadThumbnailsVtt(src).then((next) => {
|
|
3312
4415
|
setCues(next);
|
|
3313
4416
|
});
|
|
3314
4417
|
}, [src]);
|
|
3315
|
-
const updateHover =
|
|
4418
|
+
const updateHover = React11__namespace.useCallback(
|
|
3316
4419
|
(clientX) => {
|
|
3317
4420
|
const rect = trackRef.current?.getBoundingClientRect();
|
|
3318
4421
|
if (!rect) return;
|
|
@@ -3916,40 +5019,40 @@ function useHlsPlayback({
|
|
|
3916
5019
|
onRebuffer,
|
|
3917
5020
|
onQualityChange
|
|
3918
5021
|
}) {
|
|
3919
|
-
const videoRef =
|
|
3920
|
-
const hlsRef =
|
|
3921
|
-
const [state, setState] =
|
|
3922
|
-
const [qualities, setQualities] =
|
|
3923
|
-
const [activeLevel, setActiveLevel] =
|
|
3924
|
-
const [autoplayState, setAutoplayState] =
|
|
3925
|
-
const [error, setError] =
|
|
3926
|
-
const [reloadKey, setReloadKey] =
|
|
3927
|
-
const [sealed, setSealed] =
|
|
3928
|
-
const modeRef =
|
|
3929
|
-
const lastSrcRef =
|
|
3930
|
-
const sealedRef =
|
|
3931
|
-
const sawLiveRef =
|
|
3932
|
-
const sealedDuringSessionRef =
|
|
3933
|
-
|
|
5022
|
+
const videoRef = React11__namespace.useRef(null);
|
|
5023
|
+
const hlsRef = React11__namespace.useRef(null);
|
|
5024
|
+
const [state, setState] = React11__namespace.useState("idle");
|
|
5025
|
+
const [qualities, setQualities] = React11__namespace.useState([]);
|
|
5026
|
+
const [activeLevel, setActiveLevel] = React11__namespace.useState(-1);
|
|
5027
|
+
const [autoplayState, setAutoplayState] = React11__namespace.useState("none");
|
|
5028
|
+
const [error, setError] = React11__namespace.useState(null);
|
|
5029
|
+
const [reloadKey, setReloadKey] = React11__namespace.useState(0);
|
|
5030
|
+
const [sealed, setSealed] = React11__namespace.useState(false);
|
|
5031
|
+
const modeRef = React11__namespace.useRef(mode);
|
|
5032
|
+
const lastSrcRef = React11__namespace.useRef(src);
|
|
5033
|
+
const sealedRef = React11__namespace.useRef(false);
|
|
5034
|
+
const sawLiveRef = React11__namespace.useRef(false);
|
|
5035
|
+
const sealedDuringSessionRef = React11__namespace.useRef(false);
|
|
5036
|
+
React11__namespace.useEffect(() => {
|
|
3934
5037
|
modeRef.current = mode;
|
|
3935
5038
|
}, [mode]);
|
|
3936
|
-
const onErrorRef =
|
|
3937
|
-
const onPlayingChangeRef =
|
|
3938
|
-
const onRebufferRef =
|
|
3939
|
-
const onQualityChangeRef =
|
|
3940
|
-
|
|
5039
|
+
const onErrorRef = React11__namespace.useRef(onError);
|
|
5040
|
+
const onPlayingChangeRef = React11__namespace.useRef(onPlayingChange);
|
|
5041
|
+
const onRebufferRef = React11__namespace.useRef(onRebuffer);
|
|
5042
|
+
const onQualityChangeRef = React11__namespace.useRef(onQualityChange);
|
|
5043
|
+
React11__namespace.useEffect(() => {
|
|
3941
5044
|
onErrorRef.current = onError;
|
|
3942
5045
|
onPlayingChangeRef.current = onPlayingChange;
|
|
3943
5046
|
onRebufferRef.current = onRebuffer;
|
|
3944
5047
|
onQualityChangeRef.current = onQualityChange;
|
|
3945
5048
|
}, [onError, onPlayingChange, onRebuffer, onQualityChange]);
|
|
3946
|
-
const retry =
|
|
5049
|
+
const retry = React11__namespace.useCallback(() => {
|
|
3947
5050
|
setError(null);
|
|
3948
5051
|
setState("loading");
|
|
3949
5052
|
setAutoplayState("none");
|
|
3950
5053
|
setReloadKey((k) => k + 1);
|
|
3951
5054
|
}, []);
|
|
3952
|
-
|
|
5055
|
+
React11__namespace.useEffect(() => {
|
|
3953
5056
|
const media = videoRef.current;
|
|
3954
5057
|
if (!media || !src || !active) {
|
|
3955
5058
|
setState("idle");
|
|
@@ -4296,7 +5399,7 @@ function useHlsPlayback({
|
|
|
4296
5399
|
destroyHls();
|
|
4297
5400
|
};
|
|
4298
5401
|
}, [src, active, autoPlay, muted, reloadKey]);
|
|
4299
|
-
const setLevel =
|
|
5402
|
+
const setLevel = React11__namespace.useCallback((index) => {
|
|
4300
5403
|
const hls = hlsRef.current;
|
|
4301
5404
|
if (!hls) return;
|
|
4302
5405
|
hls.nextLevel = index;
|
|
@@ -4336,9 +5439,9 @@ function isEmbeddedWindow(win = window) {
|
|
|
4336
5439
|
}
|
|
4337
5440
|
}
|
|
4338
5441
|
function CaptionOverlay({ screen }) {
|
|
4339
|
-
const lastSpeakerRef =
|
|
5442
|
+
const lastSpeakerRef = React11__namespace.useRef(void 0);
|
|
4340
5443
|
const lastSpeaker = lastSpeakerRef.current;
|
|
4341
|
-
|
|
5444
|
+
React11__namespace.useLayoutEffect(() => {
|
|
4342
5445
|
if (screen?.speaker != null) lastSpeakerRef.current = screen.speaker;
|
|
4343
5446
|
}, [screen]);
|
|
4344
5447
|
if (!screen) return null;
|
|
@@ -4531,19 +5634,19 @@ function VideoPlayer({
|
|
|
4531
5634
|
liveCaptionsBaseUrl
|
|
4532
5635
|
}) {
|
|
4533
5636
|
const t = { ...DEFAULT_LABELS3, ...labels };
|
|
4534
|
-
const containerRef =
|
|
4535
|
-
const firstPlayFiredRef =
|
|
4536
|
-
const lastProgressAtRef =
|
|
4537
|
-
const onPlaybackProgressRef =
|
|
5637
|
+
const containerRef = React11__namespace.useRef(null);
|
|
5638
|
+
const firstPlayFiredRef = React11__namespace.useRef(false);
|
|
5639
|
+
const lastProgressAtRef = React11__namespace.useRef(-PROGRESS_THROTTLE_MS);
|
|
5640
|
+
const onPlaybackProgressRef = React11__namespace.useRef(onPlaybackProgress);
|
|
4538
5641
|
onPlaybackProgressRef.current = onPlaybackProgress;
|
|
4539
|
-
const applyingTrackModesRef =
|
|
4540
|
-
const captionLocaleRef =
|
|
4541
|
-
const cssFullscreenRef =
|
|
4542
|
-
const webkitFsRef =
|
|
4543
|
-
const [userStarted, setUserStarted] =
|
|
5642
|
+
const applyingTrackModesRef = React11__namespace.useRef(false);
|
|
5643
|
+
const captionLocaleRef = React11__namespace.useRef("off");
|
|
5644
|
+
const cssFullscreenRef = React11__namespace.useRef(false);
|
|
5645
|
+
const webkitFsRef = React11__namespace.useRef(false);
|
|
5646
|
+
const [userStarted, setUserStarted] = React11__namespace.useState(false);
|
|
4544
5647
|
const active = autoPlay || !poster || userStarted;
|
|
4545
5648
|
const autoplayActive = autoPlay || userStarted;
|
|
4546
|
-
const handlePlayingChange =
|
|
5649
|
+
const handlePlayingChange = React11__namespace.useCallback(
|
|
4547
5650
|
(playing) => {
|
|
4548
5651
|
setIsPlaying(playing);
|
|
4549
5652
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -4575,45 +5678,45 @@ function VideoPlayer({
|
|
|
4575
5678
|
onRebuffer,
|
|
4576
5679
|
onQualityChange
|
|
4577
5680
|
});
|
|
4578
|
-
const [isPlaying, setIsPlaying] =
|
|
4579
|
-
const [isMuted, setIsMuted] =
|
|
4580
|
-
const isMutedRef =
|
|
5681
|
+
const [isPlaying, setIsPlaying] = React11__namespace.useState(false);
|
|
5682
|
+
const [isMuted, setIsMuted] = React11__namespace.useState(muted);
|
|
5683
|
+
const isMutedRef = React11__namespace.useRef(isMuted);
|
|
4581
5684
|
isMutedRef.current = isMuted;
|
|
4582
|
-
const [volume, setVolume] =
|
|
4583
|
-
const [currentTime, setCurrentTime] =
|
|
4584
|
-
const [duration, setDuration] =
|
|
4585
|
-
const [buffered, setBuffered] =
|
|
4586
|
-
const [isFullscreen, setIsFullscreen] =
|
|
4587
|
-
const [pipActive, setPipActive] =
|
|
4588
|
-
const [controlsVisible, setControlsVisible] =
|
|
4589
|
-
const [playbackRate, setPlaybackRate] =
|
|
4590
|
-
const [openMenu, setOpenMenu] =
|
|
4591
|
-
const [morePane, setMorePane] =
|
|
5685
|
+
const [volume, setVolume] = React11__namespace.useState(1);
|
|
5686
|
+
const [currentTime, setCurrentTime] = React11__namespace.useState(0);
|
|
5687
|
+
const [duration, setDuration] = React11__namespace.useState(0);
|
|
5688
|
+
const [buffered, setBuffered] = React11__namespace.useState(0);
|
|
5689
|
+
const [isFullscreen, setIsFullscreen] = React11__namespace.useState(false);
|
|
5690
|
+
const [pipActive, setPipActive] = React11__namespace.useState(false);
|
|
5691
|
+
const [controlsVisible, setControlsVisible] = React11__namespace.useState(true);
|
|
5692
|
+
const [playbackRate, setPlaybackRate] = React11__namespace.useState(1);
|
|
5693
|
+
const [openMenu, setOpenMenu] = React11__namespace.useState(null);
|
|
5694
|
+
const [morePane, setMorePane] = React11__namespace.useState(
|
|
4592
5695
|
"root"
|
|
4593
5696
|
);
|
|
4594
|
-
const [compactChrome, setCompactChrome] =
|
|
4595
|
-
const [captionLocale, setCaptionLocale] =
|
|
4596
|
-
const [captionCues, setCaptionCues] =
|
|
4597
|
-
const [liveCaptionCues, setLiveCaptionCues] =
|
|
4598
|
-
const [livePlayout, setLivePlayout] =
|
|
5697
|
+
const [compactChrome, setCompactChrome] = React11__namespace.useState(false);
|
|
5698
|
+
const [captionLocale, setCaptionLocale] = React11__namespace.useState(defaultCaptionLocale ?? "off");
|
|
5699
|
+
const [captionCues, setCaptionCues] = React11__namespace.useState([]);
|
|
5700
|
+
const [liveCaptionCues, setLiveCaptionCues] = React11__namespace.useState([]);
|
|
5701
|
+
const [livePlayout, setLivePlayout] = React11__namespace.useState(
|
|
4599
5702
|
EMPTY_LIVE_CAPTION_PLAYOUT
|
|
4600
5703
|
);
|
|
4601
|
-
const [liveLagMs, setLiveLagMs] =
|
|
4602
|
-
const [behindLive, setBehindLive] =
|
|
4603
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
4604
|
-
const [embedded, setEmbedded] =
|
|
4605
|
-
const [cssFullscreen, setCssFullscreen] =
|
|
4606
|
-
const [webkitNativeFs, setWebkitNativeFs] =
|
|
4607
|
-
const hideTimerRef =
|
|
4608
|
-
const liveCaptionCuesRef =
|
|
4609
|
-
const liveLagMsRef =
|
|
4610
|
-
const compactChromeRef =
|
|
5704
|
+
const [liveLagMs, setLiveLagMs] = React11__namespace.useState(null);
|
|
5705
|
+
const [behindLive, setBehindLive] = React11__namespace.useState(false);
|
|
5706
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React11__namespace.useState(false);
|
|
5707
|
+
const [embedded, setEmbedded] = React11__namespace.useState(false);
|
|
5708
|
+
const [cssFullscreen, setCssFullscreen] = React11__namespace.useState(false);
|
|
5709
|
+
const [webkitNativeFs, setWebkitNativeFs] = React11__namespace.useState(false);
|
|
5710
|
+
const hideTimerRef = React11__namespace.useRef(null);
|
|
5711
|
+
const liveCaptionCuesRef = React11__namespace.useRef(liveCaptionCues);
|
|
5712
|
+
const liveLagMsRef = React11__namespace.useRef(liveLagMs);
|
|
5713
|
+
const compactChromeRef = React11__namespace.useRef(compactChrome);
|
|
4611
5714
|
liveCaptionCuesRef.current = liveCaptionCues;
|
|
4612
5715
|
liveLagMsRef.current = liveLagMs;
|
|
4613
5716
|
compactChromeRef.current = compactChrome;
|
|
4614
5717
|
cssFullscreenRef.current = cssFullscreen;
|
|
4615
5718
|
captionLocaleRef.current = captionLocale;
|
|
4616
|
-
|
|
5719
|
+
React11__namespace.useEffect(() => {
|
|
4617
5720
|
const el = containerRef.current;
|
|
4618
5721
|
if (!el || typeof ResizeObserver === "undefined") return;
|
|
4619
5722
|
const apply = (width) => {
|
|
@@ -4628,12 +5731,12 @@ function VideoPlayer({
|
|
|
4628
5731
|
observer.observe(el);
|
|
4629
5732
|
return () => observer.disconnect();
|
|
4630
5733
|
}, [active]);
|
|
4631
|
-
|
|
5734
|
+
React11__namespace.useEffect(() => {
|
|
4632
5735
|
if (openMenu !== "more") setMorePane("root");
|
|
4633
5736
|
}, [openMenu]);
|
|
4634
5737
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
4635
5738
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported || !embedded;
|
|
4636
|
-
|
|
5739
|
+
React11__namespace.useEffect(() => {
|
|
4637
5740
|
const video = videoRef.current;
|
|
4638
5741
|
if (!video || !active) return;
|
|
4639
5742
|
const onTimeUpdate = () => {
|
|
@@ -4692,22 +5795,22 @@ function VideoPlayer({
|
|
|
4692
5795
|
video.removeEventListener("playing", onPlaying);
|
|
4693
5796
|
};
|
|
4694
5797
|
}, [videoRef, active, effectiveMode, liveCaptionsBaseUrl]);
|
|
4695
|
-
|
|
5798
|
+
React11__namespace.useLayoutEffect(() => {
|
|
4696
5799
|
const video = videoRef.current;
|
|
4697
5800
|
if (video) video.muted = isMuted;
|
|
4698
5801
|
}, [isMuted, active, videoRef]);
|
|
4699
|
-
|
|
5802
|
+
React11__namespace.useEffect(() => {
|
|
4700
5803
|
const video = videoRef.current;
|
|
4701
5804
|
if (!paused || !video || !isPlaying) return;
|
|
4702
5805
|
video.pause();
|
|
4703
5806
|
}, [paused, videoRef, isPlaying]);
|
|
4704
|
-
|
|
5807
|
+
React11__namespace.useEffect(() => {
|
|
4705
5808
|
setEmbedded(isEmbeddedWindow());
|
|
4706
5809
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
4707
5810
|
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
4708
5811
|
videoRef.current?.setAttribute("webkit-playsinline", "");
|
|
4709
5812
|
}, [videoRef, active]);
|
|
4710
|
-
|
|
5813
|
+
React11__namespace.useEffect(() => {
|
|
4711
5814
|
const onFsChange = () => {
|
|
4712
5815
|
if (document.fullscreenElement === containerRef.current) {
|
|
4713
5816
|
setIsFullscreen(true);
|
|
@@ -4739,7 +5842,7 @@ function VideoPlayer({
|
|
|
4739
5842
|
);
|
|
4740
5843
|
}
|
|
4741
5844
|
}
|
|
4742
|
-
|
|
5845
|
+
React11__namespace.useEffect(() => {
|
|
4743
5846
|
const video = asWebkitVideo(videoRef.current);
|
|
4744
5847
|
if (!video) return;
|
|
4745
5848
|
const onBegin = () => {
|
|
@@ -4761,7 +5864,7 @@ function VideoPlayer({
|
|
|
4761
5864
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
4762
5865
|
};
|
|
4763
5866
|
}, [videoRef, active]);
|
|
4764
|
-
|
|
5867
|
+
React11__namespace.useEffect(() => {
|
|
4765
5868
|
if (!cssFullscreen) return;
|
|
4766
5869
|
const previousOverflow = document.body.style.overflow;
|
|
4767
5870
|
document.body.style.overflow = "hidden";
|
|
@@ -4776,7 +5879,7 @@ function VideoPlayer({
|
|
|
4776
5879
|
document.removeEventListener("keydown", onKey);
|
|
4777
5880
|
};
|
|
4778
5881
|
}, [cssFullscreen]);
|
|
4779
|
-
|
|
5882
|
+
React11__namespace.useEffect(() => {
|
|
4780
5883
|
const video = videoRef.current;
|
|
4781
5884
|
if (!video) return;
|
|
4782
5885
|
const onEnter = () => setPipActive(true);
|
|
@@ -4788,23 +5891,23 @@ function VideoPlayer({
|
|
|
4788
5891
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
4789
5892
|
};
|
|
4790
5893
|
}, [videoRef]);
|
|
4791
|
-
const scheduleHide =
|
|
5894
|
+
const scheduleHide = React11__namespace.useCallback(() => {
|
|
4792
5895
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
4793
5896
|
hideTimerRef.current = setTimeout(() => {
|
|
4794
5897
|
setControlsVisible(false);
|
|
4795
5898
|
setOpenMenu(null);
|
|
4796
5899
|
}, CONTROLS_HIDE_MS);
|
|
4797
5900
|
}, []);
|
|
4798
|
-
const revealControls =
|
|
5901
|
+
const revealControls = React11__namespace.useCallback(() => {
|
|
4799
5902
|
setControlsVisible(true);
|
|
4800
5903
|
scheduleHide();
|
|
4801
5904
|
}, [scheduleHide]);
|
|
4802
|
-
|
|
5905
|
+
React11__namespace.useEffect(() => {
|
|
4803
5906
|
return () => {
|
|
4804
5907
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
4805
5908
|
};
|
|
4806
5909
|
}, []);
|
|
4807
|
-
|
|
5910
|
+
React11__namespace.useEffect(() => {
|
|
4808
5911
|
if (captionLocale === "off") {
|
|
4809
5912
|
setCaptionCues([]);
|
|
4810
5913
|
setLiveCaptionCues([]);
|
|
@@ -4839,7 +5942,7 @@ function VideoPlayer({
|
|
|
4839
5942
|
window.clearInterval(timer);
|
|
4840
5943
|
};
|
|
4841
5944
|
}, [captionLocale, liveCaptionsBaseUrl, src]);
|
|
4842
|
-
|
|
5945
|
+
React11__namespace.useEffect(() => {
|
|
4843
5946
|
if (!liveCaptionsBaseUrl || captionLocale === "off") {
|
|
4844
5947
|
setLivePlayout(EMPTY_LIVE_CAPTION_PLAYOUT);
|
|
4845
5948
|
return;
|
|
@@ -4861,7 +5964,7 @@ function VideoPlayer({
|
|
|
4861
5964
|
}, [liveCaptionsBaseUrl, captionLocale]);
|
|
4862
5965
|
const captionWrapWidth = compactChrome ? CAPTION_COMPACT_CHARS_PER_LINE : CAPTION_MAX_CHARS_PER_LINE;
|
|
4863
5966
|
const captionScreen = liveCaptionsBaseUrl ? livePlayout.screen : captionScreenAtTime(captionCues, currentTime, captionWrapWidth);
|
|
4864
|
-
|
|
5967
|
+
React11__namespace.useEffect(() => {
|
|
4865
5968
|
const video = videoRef.current;
|
|
4866
5969
|
if (!video || !liveCaptionsBaseUrl) return;
|
|
4867
5970
|
try {
|
|
@@ -4883,12 +5986,12 @@ function VideoPlayer({
|
|
|
4883
5986
|
t.captionsEs,
|
|
4884
5987
|
t.captionsPt
|
|
4885
5988
|
]);
|
|
4886
|
-
|
|
5989
|
+
React11__namespace.useEffect(() => {
|
|
4887
5990
|
const video = videoRef.current;
|
|
4888
5991
|
if (!video) return;
|
|
4889
5992
|
applyNativeTrackModes(video, captionLocale, webkitFsRef.current);
|
|
4890
5993
|
}, [videoRef, active, captionLocale, src]);
|
|
4891
|
-
|
|
5994
|
+
React11__namespace.useEffect(() => {
|
|
4892
5995
|
const video = videoRef.current;
|
|
4893
5996
|
if (!video) return;
|
|
4894
5997
|
const onChange = () => {
|
|
@@ -4902,7 +6005,7 @@ function VideoPlayer({
|
|
|
4902
6005
|
};
|
|
4903
6006
|
return listenTextTracksChange(video.textTracks, onChange);
|
|
4904
6007
|
}, [videoRef, active, src, liveCaptionsBaseUrl]);
|
|
4905
|
-
|
|
6008
|
+
React11__namespace.useEffect(() => {
|
|
4906
6009
|
const video = videoRef.current;
|
|
4907
6010
|
if (!video || captionLocale === "off" || !liveCaptionsBaseUrl) return;
|
|
4908
6011
|
const track = findSubtitleTrack(video, captionLocale);
|
|
@@ -5651,16 +6754,16 @@ function videoInPictureInPicture(container) {
|
|
|
5651
6754
|
return container.contains(pip);
|
|
5652
6755
|
}
|
|
5653
6756
|
function useFeedExclusivePlayback(playbackId) {
|
|
5654
|
-
const containerRef =
|
|
5655
|
-
const [forcePaused, setForcePaused] =
|
|
5656
|
-
const requestPause =
|
|
6757
|
+
const containerRef = React11__namespace.useRef(null);
|
|
6758
|
+
const [forcePaused, setForcePaused] = React11__namespace.useState(false);
|
|
6759
|
+
const requestPause = React11__namespace.useCallback(() => {
|
|
5657
6760
|
if (videoInPictureInPicture(containerRef.current)) return;
|
|
5658
6761
|
setForcePaused(true);
|
|
5659
6762
|
}, []);
|
|
5660
|
-
|
|
6763
|
+
React11__namespace.useEffect(() => {
|
|
5661
6764
|
return registerFeedPlayer(playbackId, requestPause);
|
|
5662
6765
|
}, [playbackId, requestPause]);
|
|
5663
|
-
|
|
6766
|
+
React11__namespace.useEffect(() => {
|
|
5664
6767
|
const node = containerRef.current;
|
|
5665
6768
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
5666
6769
|
const observer = new IntersectionObserver(
|
|
@@ -5676,14 +6779,14 @@ function useFeedExclusivePlayback(playbackId) {
|
|
|
5676
6779
|
observer.observe(node);
|
|
5677
6780
|
return () => observer.disconnect();
|
|
5678
6781
|
}, [requestPause]);
|
|
5679
|
-
|
|
6782
|
+
React11__namespace.useEffect(() => {
|
|
5680
6783
|
const onVisibility = () => {
|
|
5681
6784
|
if (document.hidden) requestPause();
|
|
5682
6785
|
};
|
|
5683
6786
|
document.addEventListener("visibilitychange", onVisibility);
|
|
5684
6787
|
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
5685
6788
|
}, [requestPause]);
|
|
5686
|
-
const onPlayingChange =
|
|
6789
|
+
const onPlayingChange = React11__namespace.useCallback(
|
|
5687
6790
|
(playing) => {
|
|
5688
6791
|
if (!playing) return;
|
|
5689
6792
|
setForcePaused(false);
|
|
@@ -5710,7 +6813,7 @@ function FeedVideoPlayer({
|
|
|
5710
6813
|
paused: exclusivePaused,
|
|
5711
6814
|
onPlayingChange: onExclusivePlayingChange
|
|
5712
6815
|
} = useFeedExclusivePlayback(playbackId);
|
|
5713
|
-
const handlePlayingChange =
|
|
6816
|
+
const handlePlayingChange = React11__namespace.useCallback(
|
|
5714
6817
|
(playing) => {
|
|
5715
6818
|
onExclusivePlayingChange(playing);
|
|
5716
6819
|
onPlayingChange?.(playing);
|
|
@@ -5737,8 +6840,8 @@ function FeedVideoPlayer({
|
|
|
5737
6840
|
);
|
|
5738
6841
|
}
|
|
5739
6842
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
5740
|
-
const [stats, setStats] =
|
|
5741
|
-
|
|
6843
|
+
const [stats, setStats] = React11__namespace.useState({});
|
|
6844
|
+
React11__namespace.useEffect(() => {
|
|
5742
6845
|
if (!statsUrl || !enabled) return;
|
|
5743
6846
|
let cancelled = false;
|
|
5744
6847
|
const controller = new AbortController();
|
|
@@ -5861,10 +6964,10 @@ function FileDropzone({
|
|
|
5861
6964
|
className
|
|
5862
6965
|
}) {
|
|
5863
6966
|
const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
|
|
5864
|
-
const inputId =
|
|
5865
|
-
const inputRef =
|
|
5866
|
-
const [dragging, setDragging] =
|
|
5867
|
-
const [message, setMessage] =
|
|
6967
|
+
const inputId = React11.useId();
|
|
6968
|
+
const inputRef = React11.useRef(null);
|
|
6969
|
+
const [dragging, setDragging] = React11.useState(false);
|
|
6970
|
+
const [message, setMessage] = React11.useState(null);
|
|
5868
6971
|
function takeFile(file) {
|
|
5869
6972
|
if (!file || disabled) return;
|
|
5870
6973
|
if (!fileMatchesAccept(file, accept)) {
|
|
@@ -6112,7 +7215,7 @@ function FileUploadMenu({
|
|
|
6112
7215
|
}) {
|
|
6113
7216
|
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
6114
7217
|
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
6115
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
7218
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React11.useState(false);
|
|
6116
7219
|
const isControlled = open !== void 0;
|
|
6117
7220
|
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
6118
7221
|
function setResolvedOpen(next) {
|
|
@@ -6831,6 +7934,8 @@ exports.DEFAULT_FILE_DROPZONE_LABELS = DEFAULT_FILE_DROPZONE_LABELS;
|
|
|
6831
7934
|
exports.DEFAULT_FILE_UPLOAD_LABELS = DEFAULT_FILE_UPLOAD_LABELS;
|
|
6832
7935
|
exports.DEFAULT_FILE_UPLOAD_TRAY_LABELS = DEFAULT_FILE_UPLOAD_TRAY_LABELS;
|
|
6833
7936
|
exports.DEFAULT_NOTIFICATION_BELL_LABELS = DEFAULT_NOTIFICATION_BELL_LABELS;
|
|
7937
|
+
exports.DEFAULT_SHADER_CURTAIN_CONFIG = DEFAULT_SHADER_CURTAIN_CONFIG;
|
|
7938
|
+
exports.DEFAULT_SHADER_CURTAIN_EDITOR_LABELS = DEFAULT_SHADER_CURTAIN_EDITOR_LABELS;
|
|
6834
7939
|
exports.DataList = DataList;
|
|
6835
7940
|
exports.DataListItem = DataListItem;
|
|
6836
7941
|
exports.DimensionBreakdownTable = DimensionBreakdownTable;
|
|
@@ -6855,7 +7960,10 @@ exports.MetricChartCard = MetricChartCard;
|
|
|
6855
7960
|
exports.MetricEmptyState = MetricEmptyState;
|
|
6856
7961
|
exports.MetricSkeleton = MetricSkeleton;
|
|
6857
7962
|
exports.NotificationBell = NotificationBell;
|
|
7963
|
+
exports.SHADER_CURTAIN_PRESETS = SHADER_CURTAIN_PRESETS;
|
|
6858
7964
|
exports.SafeImage = SafeImage;
|
|
7965
|
+
exports.ShaderCurtain = ShaderCurtain;
|
|
7966
|
+
exports.ShaderCurtainEditor = ShaderCurtainEditor;
|
|
6859
7967
|
exports.SparklineStat = SparklineStat;
|
|
6860
7968
|
exports.StatHighlightCard = StatHighlightCard;
|
|
6861
7969
|
exports.TIME_RANGE_OPTIONS = TIME_RANGE_OPTIONS;
|
|
@@ -6865,6 +7973,7 @@ exports.VideoPlayer = VideoPlayer;
|
|
|
6865
7973
|
exports.WaitingRoom = WaitingRoom;
|
|
6866
7974
|
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
6867
7975
|
exports.captionsVttUrlFromPlayback = captionsVttUrlFromPlayback;
|
|
7976
|
+
exports.captureShaderPoster = captureShaderPoster;
|
|
6868
7977
|
exports.castHlsUrl = castHlsUrl;
|
|
6869
7978
|
exports.cn = cn;
|
|
6870
7979
|
exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
@@ -6878,10 +7987,14 @@ exports.fileMatchesAccept = fileMatchesAccept;
|
|
|
6878
7987
|
exports.getAvatarColors = getAvatarColors;
|
|
6879
7988
|
exports.getInitials = getInitials;
|
|
6880
7989
|
exports.isCaptionLocale = isCaptionLocale;
|
|
7990
|
+
exports.isShaderCurtainKind = isShaderCurtainKind;
|
|
6881
7991
|
exports.loadCastSender = loadCastSender;
|
|
7992
|
+
exports.mergeShaderCurtainConfig = mergeShaderCurtainConfig;
|
|
7993
|
+
exports.parseShaderGradientUrl = parseShaderGradientUrl;
|
|
6882
7994
|
exports.partRanges = partRanges;
|
|
6883
7995
|
exports.progressFromBytes = progressFromBytes;
|
|
6884
7996
|
exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
|
|
7997
|
+
exports.toShaderGradientUrl = toShaderGradientUrl;
|
|
6885
7998
|
exports.useEditableSection = useEditableSection;
|
|
6886
7999
|
exports.useFeedExclusivePlayback = useFeedExclusivePlayback;
|
|
6887
8000
|
exports.useHlsPlayback = useHlsPlayback;
|