@livo-tv/blocks 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +301 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -1
- package/dist/index.d.ts +82 -1
- package/dist/index.js +238 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React5 = 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 React5__namespace = /*#__PURE__*/_interopNamespace(React5);
|
|
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 = React5.createContext(null);
|
|
46
46
|
function useLanguageContext() {
|
|
47
|
-
return
|
|
47
|
+
return React5.useContext(LanguageContext);
|
|
48
48
|
}
|
|
49
49
|
function cn(...inputs) {
|
|
50
50
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
@@ -478,20 +478,20 @@ function useEditableSection({
|
|
|
478
478
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
479
479
|
...labels
|
|
480
480
|
};
|
|
481
|
-
const [mode, setMode] =
|
|
482
|
-
const [status, setStatus] =
|
|
483
|
-
const [confirmOpen, setConfirmOpen] =
|
|
484
|
-
const [minHeightPx, setMinHeightPx] =
|
|
485
|
-
const contentRef =
|
|
486
|
-
const editButtonRef =
|
|
487
|
-
const measuredHeightRef =
|
|
488
|
-
const shouldFocusEditRef =
|
|
489
|
-
const shouldFocusFirstFieldRef =
|
|
490
|
-
const editButtonId =
|
|
491
|
-
const contentFormId =
|
|
481
|
+
const [mode, setMode] = React5.useState("reading");
|
|
482
|
+
const [status, setStatus] = React5.useState(null);
|
|
483
|
+
const [confirmOpen, setConfirmOpen] = React5.useState(false);
|
|
484
|
+
const [minHeightPx, setMinHeightPx] = React5.useState(void 0);
|
|
485
|
+
const contentRef = React5.useRef(null);
|
|
486
|
+
const editButtonRef = React5.useRef(null);
|
|
487
|
+
const measuredHeightRef = React5.useRef(0);
|
|
488
|
+
const shouldFocusEditRef = React5.useRef(false);
|
|
489
|
+
const shouldFocusFirstFieldRef = React5.useRef(false);
|
|
490
|
+
const editButtonId = React5.useId();
|
|
491
|
+
const contentFormId = React5.useId();
|
|
492
492
|
const isEditing = mode === "editing" || mode === "saving";
|
|
493
493
|
const isSaving = mode === "saving";
|
|
494
|
-
|
|
494
|
+
React5.useEffect(() => {
|
|
495
495
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
496
496
|
shouldFocusEditRef.current = false;
|
|
497
497
|
editButtonRef.current?.focus();
|
|
@@ -509,18 +509,18 @@ function useEditableSection({
|
|
|
509
509
|
focusFirstField(contentRef.current);
|
|
510
510
|
}
|
|
511
511
|
}, [mode]);
|
|
512
|
-
const exitToReading =
|
|
512
|
+
const exitToReading = React5.useCallback(() => {
|
|
513
513
|
setConfirmOpen(false);
|
|
514
514
|
shouldFocusEditRef.current = true;
|
|
515
515
|
setMode("reading");
|
|
516
516
|
onDiscard?.();
|
|
517
517
|
}, [onDiscard]);
|
|
518
|
-
const startEdit =
|
|
518
|
+
const startEdit = React5.useCallback(() => {
|
|
519
519
|
setStatus(null);
|
|
520
520
|
shouldFocusFirstFieldRef.current = true;
|
|
521
521
|
setMode("editing");
|
|
522
522
|
}, []);
|
|
523
|
-
const requestCancel =
|
|
523
|
+
const requestCancel = React5.useCallback(() => {
|
|
524
524
|
if (isSaving) return;
|
|
525
525
|
if (isDirty) {
|
|
526
526
|
setConfirmOpen(true);
|
|
@@ -528,7 +528,7 @@ function useEditableSection({
|
|
|
528
528
|
}
|
|
529
529
|
exitToReading();
|
|
530
530
|
}, [exitToReading, isDirty, isSaving]);
|
|
531
|
-
const handleSubmit =
|
|
531
|
+
const handleSubmit = React5.useCallback(
|
|
532
532
|
(event) => {
|
|
533
533
|
event.preventDefault();
|
|
534
534
|
if (isSaving) return;
|
|
@@ -548,7 +548,7 @@ function useEditableSection({
|
|
|
548
548
|
},
|
|
549
549
|
[isSaving, onSave, resolvedLabels.saved]
|
|
550
550
|
);
|
|
551
|
-
const handleFormKeyDown =
|
|
551
|
+
const handleFormKeyDown = React5.useCallback(
|
|
552
552
|
(event) => {
|
|
553
553
|
if (event.key !== "Escape") return;
|
|
554
554
|
event.preventDefault();
|
|
@@ -556,7 +556,7 @@ function useEditableSection({
|
|
|
556
556
|
},
|
|
557
557
|
[requestCancel]
|
|
558
558
|
);
|
|
559
|
-
|
|
559
|
+
React5.useEffect(() => {
|
|
560
560
|
if (!stableHeight || !isEditing) return;
|
|
561
561
|
const el = contentRef.current;
|
|
562
562
|
if (!el) return;
|
|
@@ -795,13 +795,13 @@ function SafeImage({
|
|
|
795
795
|
onError,
|
|
796
796
|
...imgProps
|
|
797
797
|
}) {
|
|
798
|
-
const [failed, setFailed] =
|
|
799
|
-
const imgRef =
|
|
798
|
+
const [failed, setFailed] = React5.useState(false);
|
|
799
|
+
const imgRef = React5.useRef(null);
|
|
800
800
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
801
|
-
|
|
801
|
+
React5.useLayoutEffect(() => {
|
|
802
802
|
setFailed(false);
|
|
803
803
|
}, [resolvedSrc]);
|
|
804
|
-
|
|
804
|
+
React5.useLayoutEffect(() => {
|
|
805
805
|
const img = imgRef.current;
|
|
806
806
|
if (img && isBrokenImage(img)) {
|
|
807
807
|
setFailed(true);
|
|
@@ -931,18 +931,18 @@ function ThemeSwitcher({
|
|
|
931
931
|
labels: userLabels
|
|
932
932
|
}) {
|
|
933
933
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
934
|
-
const [mounted, setMounted] =
|
|
934
|
+
const [mounted, setMounted] = React5.useState(false);
|
|
935
935
|
const reduceMotion = framerMotion.useReducedMotion();
|
|
936
936
|
const sizes = sizeClasses[size];
|
|
937
937
|
const shapeClass = shapeClasses[shape];
|
|
938
938
|
const labels = { ...defaultLabels, ...userLabels };
|
|
939
|
-
const handleThemeClick =
|
|
939
|
+
const handleThemeClick = React5.useCallback(
|
|
940
940
|
(themeKey) => {
|
|
941
941
|
setTheme(themeKey);
|
|
942
942
|
},
|
|
943
943
|
[setTheme]
|
|
944
944
|
);
|
|
945
|
-
|
|
945
|
+
React5.useEffect(() => {
|
|
946
946
|
setMounted(true);
|
|
947
947
|
}, []);
|
|
948
948
|
if (!mounted) {
|
|
@@ -1222,7 +1222,7 @@ function Slider({
|
|
|
1222
1222
|
max = 100,
|
|
1223
1223
|
...props
|
|
1224
1224
|
}) {
|
|
1225
|
-
const _values =
|
|
1225
|
+
const _values = React5__namespace.useMemo(
|
|
1226
1226
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1227
1227
|
[value, defaultValue, min, max]
|
|
1228
1228
|
);
|
|
@@ -1333,18 +1333,18 @@ function AvatarEditor({
|
|
|
1333
1333
|
labels
|
|
1334
1334
|
}) {
|
|
1335
1335
|
const t = { ...DEFAULT_LABELS, ...labels };
|
|
1336
|
-
const canvasRef =
|
|
1337
|
-
const fileInputRef =
|
|
1338
|
-
const containerRef =
|
|
1339
|
-
const [image, setImage] =
|
|
1340
|
-
const [imageLoaded, setImageLoaded] =
|
|
1341
|
-
const [zoom, setZoom] =
|
|
1342
|
-
const [rotation, setRotation] =
|
|
1343
|
-
const [position, setPosition] =
|
|
1344
|
-
const [isDragging, setIsDragging] =
|
|
1345
|
-
const [dragStart, setDragStart] =
|
|
1346
|
-
const [showGrid, setShowGrid] =
|
|
1347
|
-
const generateOutput =
|
|
1336
|
+
const canvasRef = React5.useRef(null);
|
|
1337
|
+
const fileInputRef = React5.useRef(null);
|
|
1338
|
+
const containerRef = React5.useRef(null);
|
|
1339
|
+
const [image, setImage] = React5.useState(null);
|
|
1340
|
+
const [imageLoaded, setImageLoaded] = React5.useState(false);
|
|
1341
|
+
const [zoom, setZoom] = React5.useState(1);
|
|
1342
|
+
const [rotation, setRotation] = React5.useState(0);
|
|
1343
|
+
const [position, setPosition] = React5.useState({ x: 0, y: 0 });
|
|
1344
|
+
const [isDragging, setIsDragging] = React5.useState(false);
|
|
1345
|
+
const [dragStart, setDragStart] = React5.useState({ x: 0, y: 0 });
|
|
1346
|
+
const [showGrid, setShowGrid] = React5.useState(initialShowGrid);
|
|
1347
|
+
const generateOutput = React5.useCallback(() => {
|
|
1348
1348
|
if (!canvasRef.current || !image) return null;
|
|
1349
1349
|
const outputCanvas = document.createElement("canvas");
|
|
1350
1350
|
outputCanvas.width = outputSize;
|
|
@@ -1355,7 +1355,7 @@ function AvatarEditor({
|
|
|
1355
1355
|
const mimeType = `image/${outputFormat}`;
|
|
1356
1356
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
1357
1357
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
1358
|
-
|
|
1358
|
+
React5.useEffect(() => {
|
|
1359
1359
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
1360
1360
|
const canvas = canvasRef.current;
|
|
1361
1361
|
const ctx = canvas.getContext("2d");
|
|
@@ -1399,12 +1399,12 @@ function AvatarEditor({
|
|
|
1399
1399
|
generateOutput,
|
|
1400
1400
|
onChange
|
|
1401
1401
|
]);
|
|
1402
|
-
const resetTransforms =
|
|
1402
|
+
const resetTransforms = React5.useCallback(() => {
|
|
1403
1403
|
setZoom(1);
|
|
1404
1404
|
setRotation(0);
|
|
1405
1405
|
setPosition({ x: 0, y: 0 });
|
|
1406
1406
|
}, []);
|
|
1407
|
-
const handleFileSelect =
|
|
1407
|
+
const handleFileSelect = React5.useCallback(
|
|
1408
1408
|
(e) => {
|
|
1409
1409
|
const file = e.target.files?.[0];
|
|
1410
1410
|
if (!file) return;
|
|
@@ -1423,7 +1423,7 @@ function AvatarEditor({
|
|
|
1423
1423
|
},
|
|
1424
1424
|
[resetTransforms]
|
|
1425
1425
|
);
|
|
1426
|
-
const handleMouseDown =
|
|
1426
|
+
const handleMouseDown = React5.useCallback(
|
|
1427
1427
|
(e) => {
|
|
1428
1428
|
if (!imageLoaded) return;
|
|
1429
1429
|
setIsDragging(true);
|
|
@@ -1431,7 +1431,7 @@ function AvatarEditor({
|
|
|
1431
1431
|
},
|
|
1432
1432
|
[imageLoaded, position]
|
|
1433
1433
|
);
|
|
1434
|
-
const handleMouseMove =
|
|
1434
|
+
const handleMouseMove = React5.useCallback(
|
|
1435
1435
|
(e) => {
|
|
1436
1436
|
if (!isDragging) return;
|
|
1437
1437
|
setPosition({
|
|
@@ -1441,10 +1441,10 @@ function AvatarEditor({
|
|
|
1441
1441
|
},
|
|
1442
1442
|
[isDragging, dragStart]
|
|
1443
1443
|
);
|
|
1444
|
-
const handleMouseUp =
|
|
1444
|
+
const handleMouseUp = React5.useCallback(() => {
|
|
1445
1445
|
setIsDragging(false);
|
|
1446
1446
|
}, []);
|
|
1447
|
-
const handleTouchStart =
|
|
1447
|
+
const handleTouchStart = React5.useCallback(
|
|
1448
1448
|
(e) => {
|
|
1449
1449
|
if (!imageLoaded) return;
|
|
1450
1450
|
const touch = e.touches[0];
|
|
@@ -1456,7 +1456,7 @@ function AvatarEditor({
|
|
|
1456
1456
|
},
|
|
1457
1457
|
[imageLoaded, position]
|
|
1458
1458
|
);
|
|
1459
|
-
const handleTouchMove =
|
|
1459
|
+
const handleTouchMove = React5.useCallback(
|
|
1460
1460
|
(e) => {
|
|
1461
1461
|
if (!isDragging) return;
|
|
1462
1462
|
const touch = e.touches[0];
|
|
@@ -1467,7 +1467,7 @@ function AvatarEditor({
|
|
|
1467
1467
|
},
|
|
1468
1468
|
[isDragging, dragStart]
|
|
1469
1469
|
);
|
|
1470
|
-
const handleDiscard =
|
|
1470
|
+
const handleDiscard = React5.useCallback(() => {
|
|
1471
1471
|
setImage(null);
|
|
1472
1472
|
setImageLoaded(false);
|
|
1473
1473
|
resetTransforms();
|
|
@@ -2035,8 +2035,8 @@ function DrawerTitle({
|
|
|
2035
2035
|
);
|
|
2036
2036
|
}
|
|
2037
2037
|
function useMediaQuery(query) {
|
|
2038
|
-
const [matches, setMatches] =
|
|
2039
|
-
|
|
2038
|
+
const [matches, setMatches] = React5.useState(false);
|
|
2039
|
+
React5.useEffect(() => {
|
|
2040
2040
|
const media = window.matchMedia(query);
|
|
2041
2041
|
if (media.matches !== matches) {
|
|
2042
2042
|
setMatches(media.matches);
|
|
@@ -2066,17 +2066,17 @@ function AvatarEditorDialog({
|
|
|
2066
2066
|
className,
|
|
2067
2067
|
editorLabels
|
|
2068
2068
|
}) {
|
|
2069
|
-
const [isOpen, setIsOpen] =
|
|
2070
|
-
const [editedValue, setEditedValue] =
|
|
2071
|
-
const [displaySrc, setDisplaySrc] =
|
|
2072
|
-
const [isSaving, setIsSaving] =
|
|
2073
|
-
const [feedback, setFeedback] =
|
|
2074
|
-
|
|
2069
|
+
const [isOpen, setIsOpen] = React5.useState(false);
|
|
2070
|
+
const [editedValue, setEditedValue] = React5.useState(value ?? null);
|
|
2071
|
+
const [displaySrc, setDisplaySrc] = React5.useState(value ?? null);
|
|
2072
|
+
const [isSaving, setIsSaving] = React5.useState(false);
|
|
2073
|
+
const [feedback, setFeedback] = React5.useState(null);
|
|
2074
|
+
React5.useEffect(() => {
|
|
2075
2075
|
setDisplaySrc(value ?? null);
|
|
2076
2076
|
}, [value]);
|
|
2077
2077
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
2078
2078
|
const caption = (placeholder ?? "").trim();
|
|
2079
|
-
const handleOpenChange =
|
|
2079
|
+
const handleOpenChange = React5.useCallback(
|
|
2080
2080
|
(open) => {
|
|
2081
2081
|
if (open) {
|
|
2082
2082
|
setEditedValue(value ?? null);
|
|
@@ -2086,7 +2086,7 @@ function AvatarEditorDialog({
|
|
|
2086
2086
|
},
|
|
2087
2087
|
[value]
|
|
2088
2088
|
);
|
|
2089
|
-
const handleAccept =
|
|
2089
|
+
const handleAccept = React5.useCallback(async () => {
|
|
2090
2090
|
if (!editedValue) return;
|
|
2091
2091
|
setIsSaving(true);
|
|
2092
2092
|
setFeedback(null);
|
|
@@ -2258,6 +2258,177 @@ function AvatarEditorDialog({
|
|
|
2258
2258
|
] }) })
|
|
2259
2259
|
] });
|
|
2260
2260
|
}
|
|
2261
|
+
function usePrefersReducedMotion() {
|
|
2262
|
+
const [reduced, setReduced] = React5__namespace.useState(false);
|
|
2263
|
+
React5__namespace.useEffect(() => {
|
|
2264
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
2265
|
+
const sync = () => setReduced(media.matches);
|
|
2266
|
+
sync();
|
|
2267
|
+
media.addEventListener("change", sync);
|
|
2268
|
+
return () => media.removeEventListener("change", sync);
|
|
2269
|
+
}, []);
|
|
2270
|
+
return reduced;
|
|
2271
|
+
}
|
|
2272
|
+
function CurtainStage({
|
|
2273
|
+
kind,
|
|
2274
|
+
url,
|
|
2275
|
+
alt = "",
|
|
2276
|
+
className,
|
|
2277
|
+
reducedMotion
|
|
2278
|
+
}) {
|
|
2279
|
+
const prefersReduced = usePrefersReducedMotion();
|
|
2280
|
+
const freeze = reducedMotion ?? prefersReduced;
|
|
2281
|
+
if (kind === "video" && !freeze) {
|
|
2282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2283
|
+
"video",
|
|
2284
|
+
{
|
|
2285
|
+
src: url,
|
|
2286
|
+
className: cn("h-full w-full object-cover", className),
|
|
2287
|
+
autoPlay: true,
|
|
2288
|
+
muted: true,
|
|
2289
|
+
loop: true,
|
|
2290
|
+
playsInline: true,
|
|
2291
|
+
"aria-hidden": alt ? void 0 : true
|
|
2292
|
+
}
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
if (kind === "video" && freeze) {
|
|
2296
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2297
|
+
"video",
|
|
2298
|
+
{
|
|
2299
|
+
src: url,
|
|
2300
|
+
className: cn("h-full w-full object-cover", className),
|
|
2301
|
+
muted: true,
|
|
2302
|
+
playsInline: true,
|
|
2303
|
+
preload: "metadata",
|
|
2304
|
+
"aria-hidden": alt ? void 0 : true
|
|
2305
|
+
}
|
|
2306
|
+
);
|
|
2307
|
+
}
|
|
2308
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2309
|
+
"img",
|
|
2310
|
+
{
|
|
2311
|
+
src: url,
|
|
2312
|
+
alt,
|
|
2313
|
+
className: cn("h-full w-full object-cover", className)
|
|
2314
|
+
}
|
|
2315
|
+
);
|
|
2316
|
+
}
|
|
2317
|
+
function formatCountdown(ms) {
|
|
2318
|
+
if (ms <= 0) return "0:00";
|
|
2319
|
+
const total = Math.floor(ms / 1e3);
|
|
2320
|
+
const h = Math.floor(total / 3600);
|
|
2321
|
+
const m = Math.floor(total % 3600 / 60);
|
|
2322
|
+
const s = total % 60;
|
|
2323
|
+
const mm = String(m).padStart(2, "0");
|
|
2324
|
+
const ss = String(s).padStart(2, "0");
|
|
2325
|
+
return h > 0 ? `${h}:${mm}:${ss}` : `${m}:${ss}`;
|
|
2326
|
+
}
|
|
2327
|
+
function WaitingRoom({
|
|
2328
|
+
title,
|
|
2329
|
+
organizationName,
|
|
2330
|
+
organizationImage,
|
|
2331
|
+
startsAt,
|
|
2332
|
+
durationSeconds,
|
|
2333
|
+
curtain,
|
|
2334
|
+
nowMs,
|
|
2335
|
+
labels,
|
|
2336
|
+
className
|
|
2337
|
+
}) {
|
|
2338
|
+
const [now, setNow] = React5__namespace.useState(nowMs ?? Date.now());
|
|
2339
|
+
React5__namespace.useEffect(() => {
|
|
2340
|
+
if (nowMs != null) {
|
|
2341
|
+
setNow(nowMs);
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
2345
|
+
return () => window.clearInterval(timer);
|
|
2346
|
+
}, [nowMs]);
|
|
2347
|
+
const remaining = startsAt != null ? startsAt - now : null;
|
|
2348
|
+
const durationMinutes = durationSeconds != null ? Math.max(1, Math.round(durationSeconds / 60)) : null;
|
|
2349
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2350
|
+
"div",
|
|
2351
|
+
{
|
|
2352
|
+
className: cn(
|
|
2353
|
+
"relative flex min-h-[16rem] w-full overflow-hidden rounded-lg bg-zinc-950 text-white",
|
|
2354
|
+
className
|
|
2355
|
+
),
|
|
2356
|
+
children: [
|
|
2357
|
+
curtain ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2358
|
+
CurtainStage,
|
|
2359
|
+
{
|
|
2360
|
+
kind: curtain.kind,
|
|
2361
|
+
url: curtain.url,
|
|
2362
|
+
className: "absolute inset-0"
|
|
2363
|
+
}
|
|
2364
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-zinc-900 to-zinc-950" }),
|
|
2365
|
+
/* @__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: [
|
|
2366
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2367
|
+
organizationImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2368
|
+
"img",
|
|
2369
|
+
{
|
|
2370
|
+
src: organizationImage,
|
|
2371
|
+
alt: "",
|
|
2372
|
+
className: "size-10 rounded-lg object-cover"
|
|
2373
|
+
}
|
|
2374
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-white/15 text-sm font-semibold", children: (organizationName ?? title).slice(0, 1).toUpperCase() }),
|
|
2375
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2376
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
|
|
2377
|
+
organizationName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
|
|
2378
|
+
] })
|
|
2379
|
+
] }),
|
|
2380
|
+
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,
|
|
2381
|
+
durationMinutes != null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-white/70", children: labels?.duration ? labels.duration(durationMinutes) : `${durationMinutes} min` }) : null
|
|
2382
|
+
] })
|
|
2383
|
+
]
|
|
2384
|
+
}
|
|
2385
|
+
);
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// src/components/video/castHls.ts
|
|
2389
|
+
var CAST_SENDER_SRC = "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
|
|
2390
|
+
var DEFAULT_RECEIVER_ID = "CC1AD845";
|
|
2391
|
+
var loadPromise = null;
|
|
2392
|
+
function loadCastSender() {
|
|
2393
|
+
if (typeof window === "undefined") return Promise.resolve();
|
|
2394
|
+
if (window.cast?.framework && window.chrome?.cast) return Promise.resolve();
|
|
2395
|
+
if (loadPromise) return loadPromise;
|
|
2396
|
+
loadPromise = new Promise((resolve, reject) => {
|
|
2397
|
+
window.__onGCastApiAvailable = (available) => {
|
|
2398
|
+
if (available) resolve();
|
|
2399
|
+
else reject(new Error("Cast API unavailable"));
|
|
2400
|
+
};
|
|
2401
|
+
const existing = document.querySelector(`script[src="${CAST_SENDER_SRC}"]`);
|
|
2402
|
+
if (existing) return;
|
|
2403
|
+
const script = document.createElement("script");
|
|
2404
|
+
script.src = CAST_SENDER_SRC;
|
|
2405
|
+
script.async = true;
|
|
2406
|
+
script.onerror = () => reject(new Error("Cast sender failed to load"));
|
|
2407
|
+
document.head.appendChild(script);
|
|
2408
|
+
});
|
|
2409
|
+
return loadPromise;
|
|
2410
|
+
}
|
|
2411
|
+
async function castHlsUrl(hlsUrl) {
|
|
2412
|
+
await loadCastSender();
|
|
2413
|
+
const framework = window.cast?.framework;
|
|
2414
|
+
const chromeCast = window.chrome?.cast;
|
|
2415
|
+
if (!framework || !chromeCast) {
|
|
2416
|
+
throw new Error("Cast API unavailable");
|
|
2417
|
+
}
|
|
2418
|
+
const context = framework.CastContext.getInstance();
|
|
2419
|
+
context.setOptions({
|
|
2420
|
+
receiverApplicationId: chromeCast.media.DEFAULT_MEDIA_RECEIVER_APP_ID || DEFAULT_RECEIVER_ID,
|
|
2421
|
+
autoJoinPolicy: chromeCast.AutoJoinPolicy?.ORIGIN_SCOPED
|
|
2422
|
+
});
|
|
2423
|
+
if (!context.getCurrentSession()) {
|
|
2424
|
+
await context.requestSession();
|
|
2425
|
+
}
|
|
2426
|
+
const session = context.getCurrentSession();
|
|
2427
|
+
if (!session) throw new Error("No Cast session");
|
|
2428
|
+
const media = new chromeCast.media.MediaInfo(hlsUrl, "application/x-mpegURL");
|
|
2429
|
+
const request = new chromeCast.media.LoadRequest(media);
|
|
2430
|
+
await session.loadMedia(request);
|
|
2431
|
+
}
|
|
2261
2432
|
|
|
2262
2433
|
// src/components/video/hls-config.ts
|
|
2263
2434
|
function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
|
|
@@ -2437,27 +2608,27 @@ function useHlsPlayback({
|
|
|
2437
2608
|
onError,
|
|
2438
2609
|
onPlayingChange
|
|
2439
2610
|
}) {
|
|
2440
|
-
const videoRef =
|
|
2441
|
-
const hlsRef =
|
|
2442
|
-
const [state, setState] =
|
|
2443
|
-
const [qualities, setQualities] =
|
|
2444
|
-
const [activeLevel, setActiveLevel] =
|
|
2445
|
-
const [autoplayState, setAutoplayState] =
|
|
2446
|
-
const [error, setError] =
|
|
2447
|
-
const [reloadKey, setReloadKey] =
|
|
2448
|
-
const onErrorRef =
|
|
2449
|
-
const onPlayingChangeRef =
|
|
2450
|
-
|
|
2611
|
+
const videoRef = React5__namespace.useRef(null);
|
|
2612
|
+
const hlsRef = React5__namespace.useRef(null);
|
|
2613
|
+
const [state, setState] = React5__namespace.useState("idle");
|
|
2614
|
+
const [qualities, setQualities] = React5__namespace.useState([]);
|
|
2615
|
+
const [activeLevel, setActiveLevel] = React5__namespace.useState(-1);
|
|
2616
|
+
const [autoplayState, setAutoplayState] = React5__namespace.useState("none");
|
|
2617
|
+
const [error, setError] = React5__namespace.useState(null);
|
|
2618
|
+
const [reloadKey, setReloadKey] = React5__namespace.useState(0);
|
|
2619
|
+
const onErrorRef = React5__namespace.useRef(onError);
|
|
2620
|
+
const onPlayingChangeRef = React5__namespace.useRef(onPlayingChange);
|
|
2621
|
+
React5__namespace.useEffect(() => {
|
|
2451
2622
|
onErrorRef.current = onError;
|
|
2452
2623
|
onPlayingChangeRef.current = onPlayingChange;
|
|
2453
2624
|
}, [onError, onPlayingChange]);
|
|
2454
|
-
const retry =
|
|
2625
|
+
const retry = React5__namespace.useCallback(() => {
|
|
2455
2626
|
setError(null);
|
|
2456
2627
|
setState("loading");
|
|
2457
2628
|
setAutoplayState("none");
|
|
2458
2629
|
setReloadKey((k) => k + 1);
|
|
2459
2630
|
}, []);
|
|
2460
|
-
|
|
2631
|
+
React5__namespace.useEffect(() => {
|
|
2461
2632
|
const media = videoRef.current;
|
|
2462
2633
|
if (!media || !src || !active) {
|
|
2463
2634
|
setState("idle");
|
|
@@ -2727,7 +2898,7 @@ function useHlsPlayback({
|
|
|
2727
2898
|
destroyHls();
|
|
2728
2899
|
};
|
|
2729
2900
|
}, [src, mode, active, autoPlay, muted, reloadKey]);
|
|
2730
|
-
const setLevel =
|
|
2901
|
+
const setLevel = React5__namespace.useCallback((index) => {
|
|
2731
2902
|
const hls = hlsRef.current;
|
|
2732
2903
|
if (!hls) return;
|
|
2733
2904
|
hls.nextLevel = index;
|
|
@@ -2752,6 +2923,7 @@ var DEFAULT_LABELS2 = {
|
|
|
2752
2923
|
enterFullscreen: "Fullscreen",
|
|
2753
2924
|
exitFullscreen: "Exit fullscreen",
|
|
2754
2925
|
pictureInPicture: "Picture in picture",
|
|
2926
|
+
cast: "Cast",
|
|
2755
2927
|
settings: "Settings",
|
|
2756
2928
|
quality: "Quality",
|
|
2757
2929
|
auto: "Auto",
|
|
@@ -2812,12 +2984,12 @@ function VideoPlayer({
|
|
|
2812
2984
|
className
|
|
2813
2985
|
}) {
|
|
2814
2986
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
2815
|
-
const containerRef =
|
|
2816
|
-
const firstPlayFiredRef =
|
|
2817
|
-
const [userStarted, setUserStarted] =
|
|
2987
|
+
const containerRef = React5__namespace.useRef(null);
|
|
2988
|
+
const firstPlayFiredRef = React5__namespace.useRef(false);
|
|
2989
|
+
const [userStarted, setUserStarted] = React5__namespace.useState(false);
|
|
2818
2990
|
const active = autoPlay || !poster || userStarted;
|
|
2819
2991
|
const autoplayActive = autoPlay || userStarted;
|
|
2820
|
-
const handlePlayingChange =
|
|
2992
|
+
const handlePlayingChange = React5__namespace.useCallback(
|
|
2821
2993
|
(playing) => {
|
|
2822
2994
|
setIsPlaying(playing);
|
|
2823
2995
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -2846,25 +3018,25 @@ function VideoPlayer({
|
|
|
2846
3018
|
onError,
|
|
2847
3019
|
onPlayingChange: handlePlayingChange
|
|
2848
3020
|
});
|
|
2849
|
-
const [isPlaying, setIsPlaying] =
|
|
2850
|
-
const [isMuted, setIsMuted] =
|
|
2851
|
-
const [volume, setVolume] =
|
|
2852
|
-
const [currentTime, setCurrentTime] =
|
|
2853
|
-
const [duration, setDuration] =
|
|
2854
|
-
const [buffered, setBuffered] =
|
|
2855
|
-
const [isFullscreen, setIsFullscreen] =
|
|
2856
|
-
const [pipActive, setPipActive] =
|
|
2857
|
-
const [controlsVisible, setControlsVisible] =
|
|
2858
|
-
const [playbackRate, setPlaybackRate] =
|
|
2859
|
-
const [openMenu, setOpenMenu] =
|
|
3021
|
+
const [isPlaying, setIsPlaying] = React5__namespace.useState(false);
|
|
3022
|
+
const [isMuted, setIsMuted] = React5__namespace.useState(muted);
|
|
3023
|
+
const [volume, setVolume] = React5__namespace.useState(1);
|
|
3024
|
+
const [currentTime, setCurrentTime] = React5__namespace.useState(0);
|
|
3025
|
+
const [duration, setDuration] = React5__namespace.useState(0);
|
|
3026
|
+
const [buffered, setBuffered] = React5__namespace.useState(0);
|
|
3027
|
+
const [isFullscreen, setIsFullscreen] = React5__namespace.useState(false);
|
|
3028
|
+
const [pipActive, setPipActive] = React5__namespace.useState(false);
|
|
3029
|
+
const [controlsVisible, setControlsVisible] = React5__namespace.useState(true);
|
|
3030
|
+
const [playbackRate, setPlaybackRate] = React5__namespace.useState(1);
|
|
3031
|
+
const [openMenu, setOpenMenu] = React5__namespace.useState(
|
|
2860
3032
|
null
|
|
2861
3033
|
);
|
|
2862
|
-
const [behindLive, setBehindLive] =
|
|
2863
|
-
const [webkitFullscreenSupported, setWebkitFullscreenSupported] =
|
|
2864
|
-
const hideTimerRef =
|
|
3034
|
+
const [behindLive, setBehindLive] = React5__namespace.useState(false);
|
|
3035
|
+
const [webkitFullscreenSupported, setWebkitFullscreenSupported] = React5__namespace.useState(false);
|
|
3036
|
+
const hideTimerRef = React5__namespace.useRef(null);
|
|
2865
3037
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
2866
3038
|
const fullscreenSupported = hasStandardFullscreen() || webkitFullscreenSupported;
|
|
2867
|
-
|
|
3039
|
+
React5__namespace.useEffect(() => {
|
|
2868
3040
|
const video = videoRef.current;
|
|
2869
3041
|
if (!video || !active) return;
|
|
2870
3042
|
const onTimeUpdate = () => {
|
|
@@ -2897,20 +3069,21 @@ function VideoPlayer({
|
|
|
2897
3069
|
video.removeEventListener("ratechange", onRate);
|
|
2898
3070
|
};
|
|
2899
3071
|
}, [videoRef, active, mode]);
|
|
2900
|
-
|
|
3072
|
+
React5__namespace.useEffect(() => {
|
|
2901
3073
|
const video = videoRef.current;
|
|
2902
3074
|
if (!paused || !video || !isPlaying) return;
|
|
2903
3075
|
video.pause();
|
|
2904
3076
|
}, [paused, videoRef, isPlaying]);
|
|
2905
|
-
|
|
3077
|
+
React5__namespace.useEffect(() => {
|
|
2906
3078
|
setWebkitFullscreenSupported(hasWebkitVideoFullscreen(videoRef.current));
|
|
3079
|
+
videoRef.current?.setAttribute("x-webkit-airplay", "allow");
|
|
2907
3080
|
}, [videoRef, active]);
|
|
2908
|
-
|
|
3081
|
+
React5__namespace.useEffect(() => {
|
|
2909
3082
|
const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
2910
3083
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
2911
3084
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
2912
3085
|
}, []);
|
|
2913
|
-
|
|
3086
|
+
React5__namespace.useEffect(() => {
|
|
2914
3087
|
const video = asWebkitVideo(videoRef.current);
|
|
2915
3088
|
if (!video) return;
|
|
2916
3089
|
const onBegin = () => setIsFullscreen(true);
|
|
@@ -2922,7 +3095,7 @@ function VideoPlayer({
|
|
|
2922
3095
|
video.removeEventListener("webkitendfullscreen", onEnd);
|
|
2923
3096
|
};
|
|
2924
3097
|
}, [videoRef, active]);
|
|
2925
|
-
|
|
3098
|
+
React5__namespace.useEffect(() => {
|
|
2926
3099
|
const video = videoRef.current;
|
|
2927
3100
|
if (!video) return;
|
|
2928
3101
|
const onEnter = () => setPipActive(true);
|
|
@@ -2934,18 +3107,18 @@ function VideoPlayer({
|
|
|
2934
3107
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
2935
3108
|
};
|
|
2936
3109
|
}, [videoRef]);
|
|
2937
|
-
const scheduleHide =
|
|
3110
|
+
const scheduleHide = React5__namespace.useCallback(() => {
|
|
2938
3111
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
2939
3112
|
hideTimerRef.current = setTimeout(() => {
|
|
2940
3113
|
setControlsVisible(false);
|
|
2941
3114
|
setOpenMenu(null);
|
|
2942
3115
|
}, CONTROLS_HIDE_MS);
|
|
2943
3116
|
}, []);
|
|
2944
|
-
const revealControls =
|
|
3117
|
+
const revealControls = React5__namespace.useCallback(() => {
|
|
2945
3118
|
setControlsVisible(true);
|
|
2946
3119
|
scheduleHide();
|
|
2947
3120
|
}, [scheduleHide]);
|
|
2948
|
-
|
|
3121
|
+
React5__namespace.useEffect(() => {
|
|
2949
3122
|
return () => {
|
|
2950
3123
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
2951
3124
|
};
|
|
@@ -3316,6 +3489,16 @@ function VideoPlayer({
|
|
|
3316
3489
|
]
|
|
3317
3490
|
}
|
|
3318
3491
|
),
|
|
3492
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3493
|
+
ControlButton,
|
|
3494
|
+
{
|
|
3495
|
+
label: t.cast,
|
|
3496
|
+
onClick: () => {
|
|
3497
|
+
void castHlsUrl(src).catch(() => void 0);
|
|
3498
|
+
},
|
|
3499
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Cast, { className: "size-5" })
|
|
3500
|
+
}
|
|
3501
|
+
),
|
|
3319
3502
|
pipSupported && /* @__PURE__ */ jsxRuntime.jsx(ControlButton, { label: t.pictureInPicture, onClick: togglePip, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3320
3503
|
lucideReact.PictureInPicture2,
|
|
3321
3504
|
{
|
|
@@ -3438,16 +3621,16 @@ function videoInPictureInPicture(container) {
|
|
|
3438
3621
|
return container.contains(pip);
|
|
3439
3622
|
}
|
|
3440
3623
|
function useFeedExclusivePlayback(playbackId) {
|
|
3441
|
-
const containerRef =
|
|
3442
|
-
const [forcePaused, setForcePaused] =
|
|
3443
|
-
const requestPause =
|
|
3624
|
+
const containerRef = React5__namespace.useRef(null);
|
|
3625
|
+
const [forcePaused, setForcePaused] = React5__namespace.useState(false);
|
|
3626
|
+
const requestPause = React5__namespace.useCallback(() => {
|
|
3444
3627
|
if (videoInPictureInPicture(containerRef.current)) return;
|
|
3445
3628
|
setForcePaused(true);
|
|
3446
3629
|
}, []);
|
|
3447
|
-
|
|
3630
|
+
React5__namespace.useEffect(() => {
|
|
3448
3631
|
return registerFeedPlayer(playbackId, requestPause);
|
|
3449
3632
|
}, [playbackId, requestPause]);
|
|
3450
|
-
|
|
3633
|
+
React5__namespace.useEffect(() => {
|
|
3451
3634
|
const node = containerRef.current;
|
|
3452
3635
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
3453
3636
|
const observer = new IntersectionObserver(
|
|
@@ -3463,14 +3646,14 @@ function useFeedExclusivePlayback(playbackId) {
|
|
|
3463
3646
|
observer.observe(node);
|
|
3464
3647
|
return () => observer.disconnect();
|
|
3465
3648
|
}, [requestPause]);
|
|
3466
|
-
|
|
3649
|
+
React5__namespace.useEffect(() => {
|
|
3467
3650
|
const onVisibility = () => {
|
|
3468
3651
|
if (document.hidden) requestPause();
|
|
3469
3652
|
};
|
|
3470
3653
|
document.addEventListener("visibilitychange", onVisibility);
|
|
3471
3654
|
return () => document.removeEventListener("visibilitychange", onVisibility);
|
|
3472
3655
|
}, [requestPause]);
|
|
3473
|
-
const onPlayingChange =
|
|
3656
|
+
const onPlayingChange = React5__namespace.useCallback(
|
|
3474
3657
|
(playing) => {
|
|
3475
3658
|
if (!playing) return;
|
|
3476
3659
|
setForcePaused(false);
|
|
@@ -3497,7 +3680,7 @@ function FeedVideoPlayer({
|
|
|
3497
3680
|
paused: exclusivePaused,
|
|
3498
3681
|
onPlayingChange: onExclusivePlayingChange
|
|
3499
3682
|
} = useFeedExclusivePlayback(playbackId);
|
|
3500
|
-
const handlePlayingChange =
|
|
3683
|
+
const handlePlayingChange = React5__namespace.useCallback(
|
|
3501
3684
|
(playing) => {
|
|
3502
3685
|
onExclusivePlayingChange(playing);
|
|
3503
3686
|
onPlayingChange?.(playing);
|
|
@@ -3524,8 +3707,8 @@ function FeedVideoPlayer({
|
|
|
3524
3707
|
);
|
|
3525
3708
|
}
|
|
3526
3709
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
3527
|
-
const [stats, setStats] =
|
|
3528
|
-
|
|
3710
|
+
const [stats, setStats] = React5__namespace.useState({});
|
|
3711
|
+
React5__namespace.useEffect(() => {
|
|
3529
3712
|
if (!statsUrl || !enabled) return;
|
|
3530
3713
|
let cancelled = false;
|
|
3531
3714
|
const controller = new AbortController();
|
|
@@ -3555,8 +3738,8 @@ function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {})
|
|
|
3555
3738
|
return stats;
|
|
3556
3739
|
}
|
|
3557
3740
|
function useMediaQuery2(query) {
|
|
3558
|
-
const [matches, setMatches] =
|
|
3559
|
-
|
|
3741
|
+
const [matches, setMatches] = React5.useState(false);
|
|
3742
|
+
React5.useEffect(() => {
|
|
3560
3743
|
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
3561
3744
|
const mql = window.matchMedia(query);
|
|
3562
3745
|
const onChange = () => setMatches(mql.matches);
|
|
@@ -3651,6 +3834,7 @@ function avatarFallbackStyle(name) {
|
|
|
3651
3834
|
exports.AvatarEditor = AvatarEditor;
|
|
3652
3835
|
exports.AvatarEditorDialog = AvatarEditorDialog;
|
|
3653
3836
|
exports.ConfirmDestructiveDialog = ConfirmDestructiveDialog;
|
|
3837
|
+
exports.CurtainStage = CurtainStage;
|
|
3654
3838
|
exports.DEFAULT_EDITABLE_SECTION_LABELS = DEFAULT_EDITABLE_SECTION_LABELS;
|
|
3655
3839
|
exports.DataList = DataList;
|
|
3656
3840
|
exports.DataListItem = DataListItem;
|
|
@@ -3671,7 +3855,9 @@ exports.LoadingState = LoadingState;
|
|
|
3671
3855
|
exports.SafeImage = SafeImage;
|
|
3672
3856
|
exports.ThemeSwitcher = ThemeSwitcher;
|
|
3673
3857
|
exports.VideoPlayer = VideoPlayer;
|
|
3858
|
+
exports.WaitingRoom = WaitingRoom;
|
|
3674
3859
|
exports.avatarFallbackStyle = avatarFallbackStyle;
|
|
3860
|
+
exports.castHlsUrl = castHlsUrl;
|
|
3675
3861
|
exports.cn = cn;
|
|
3676
3862
|
exports.createLiveHlsConfig = createLiveHlsConfig;
|
|
3677
3863
|
exports.createVodHlsConfig = createVodHlsConfig;
|
|
@@ -3680,6 +3866,7 @@ exports.describeAvResync = describeAvResync;
|
|
|
3680
3866
|
exports.describePlaybackError = describePlaybackError;
|
|
3681
3867
|
exports.getAvatarColors = getAvatarColors;
|
|
3682
3868
|
exports.getInitials = getInitials;
|
|
3869
|
+
exports.loadCastSender = loadCastSender;
|
|
3683
3870
|
exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
|
|
3684
3871
|
exports.useEditableSection = useEditableSection;
|
|
3685
3872
|
exports.useFeedExclusivePlayback = useFeedExclusivePlayback;
|