@sesionario/blocks 1.3.1 → 1.4.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 +314 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -4
- package/dist/index.d.ts +34 -4
- package/dist/index.js +263 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
2
|
+
import * as React6 from 'react';
|
|
3
3
|
import { createContext, useContext, useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
4
|
-
import { ChevronsUpDown, CheckIcon, SearchIcon, Loader2, AlertTriangle, Inbox, Monitor, Sun, Moon, Building2, Check, Plus, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil,
|
|
4
|
+
import { ChevronsUpDown, CheckIcon, Smile, SearchIcon, Search, Clock, Flag, Hash, Lightbulb, Trophy, Plane, Apple, Leaf, Hand, Loader2, AlertTriangle, Inbox, Monitor, Sun, Moon, Building2, Check, Plus, Languages, Upload, Move, ZoomOut, ZoomIn, RotateCcw, RotateCw, Grid3X3, RefreshCw, X, User, Pencil, Play, AlertCircle, VolumeX, Pause, Volume1, Volume2, Settings, PictureInPicture2, Minimize, Maximize, BadgeCheck, ArrowDownIcon, MessageCircleDashedIcon, XIcon } from 'lucide-react';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
-
import {
|
|
8
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
9
9
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
10
10
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
11
|
import { useTheme } from 'next-themes';
|
|
@@ -1131,7 +1131,7 @@ function Slider({
|
|
|
1131
1131
|
max = 100,
|
|
1132
1132
|
...props
|
|
1133
1133
|
}) {
|
|
1134
|
-
const _values =
|
|
1134
|
+
const _values = React6.useMemo(
|
|
1135
1135
|
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1136
1136
|
[value, defaultValue, min, max]
|
|
1137
1137
|
);
|
|
@@ -2258,22 +2258,22 @@ function EmojiPicker({
|
|
|
2258
2258
|
recentLimit = 24,
|
|
2259
2259
|
storageKey = "blocks-emoji"
|
|
2260
2260
|
}) {
|
|
2261
|
-
const strings =
|
|
2261
|
+
const strings = React6.useMemo(
|
|
2262
2262
|
() => ({ ...DEFAULT_LABELS[locale], ...labels }),
|
|
2263
2263
|
[locale, labels]
|
|
2264
2264
|
);
|
|
2265
|
-
const titles =
|
|
2265
|
+
const titles = React6.useMemo(
|
|
2266
2266
|
() => ({ ...DEFAULT_TITLES[locale], ...labels?.categoryTitles }),
|
|
2267
2267
|
[locale, labels]
|
|
2268
2268
|
);
|
|
2269
|
-
const [query, setQuery] =
|
|
2270
|
-
const [skinTone, setSkinTone] =
|
|
2269
|
+
const [query, setQuery] = React6.useState("");
|
|
2270
|
+
const [skinTone, setSkinTone] = React6.useState(() => {
|
|
2271
2271
|
const raw = readStored(storageKey, "tone");
|
|
2272
2272
|
const parsed = raw != null ? Number.parseInt(raw, 10) : 0;
|
|
2273
2273
|
return parsed >= 0 && parsed <= 5 ? parsed : 0;
|
|
2274
2274
|
});
|
|
2275
|
-
const [toneOpen, setToneOpen] =
|
|
2276
|
-
const [recents, setRecents] =
|
|
2275
|
+
const [toneOpen, setToneOpen] = React6.useState(false);
|
|
2276
|
+
const [recents, setRecents] = React6.useState(() => {
|
|
2277
2277
|
const raw = readStored(storageKey, "recent");
|
|
2278
2278
|
if (!raw) return [];
|
|
2279
2279
|
try {
|
|
@@ -2283,13 +2283,13 @@ function EmojiPicker({
|
|
|
2283
2283
|
return [];
|
|
2284
2284
|
}
|
|
2285
2285
|
});
|
|
2286
|
-
const [focusIndex, setFocusIndex] =
|
|
2287
|
-
const scrollRef =
|
|
2288
|
-
const sectionRefs =
|
|
2286
|
+
const [focusIndex, setFocusIndex] = React6.useState(-1);
|
|
2287
|
+
const scrollRef = React6.useRef(null);
|
|
2288
|
+
const sectionRefs = React6.useRef(
|
|
2289
2289
|
/* @__PURE__ */ new Map()
|
|
2290
2290
|
);
|
|
2291
2291
|
const normalizedQuery = normalizeEmojiQuery(query);
|
|
2292
|
-
const sections =
|
|
2292
|
+
const sections = React6.useMemo(() => {
|
|
2293
2293
|
if (normalizedQuery) return [];
|
|
2294
2294
|
const result = [];
|
|
2295
2295
|
if (recents.length > 0) {
|
|
@@ -2308,7 +2308,7 @@ function EmojiPicker({
|
|
|
2308
2308
|
}
|
|
2309
2309
|
return result;
|
|
2310
2310
|
}, [normalizedQuery, recents, titles]);
|
|
2311
|
-
const searchResults =
|
|
2311
|
+
const searchResults = React6.useMemo(() => {
|
|
2312
2312
|
if (!normalizedQuery) return [];
|
|
2313
2313
|
const out = [];
|
|
2314
2314
|
for (const category of EMOJI_CATEGORIES) {
|
|
@@ -2318,21 +2318,21 @@ function EmojiPicker({
|
|
|
2318
2318
|
}
|
|
2319
2319
|
return out;
|
|
2320
2320
|
}, [normalizedQuery]);
|
|
2321
|
-
const flatList =
|
|
2321
|
+
const flatList = React6.useMemo(() => {
|
|
2322
2322
|
if (normalizedQuery) return searchResults;
|
|
2323
2323
|
return sections.flatMap((s) => s.emojis);
|
|
2324
2324
|
}, [normalizedQuery, searchResults, sections]);
|
|
2325
|
-
|
|
2325
|
+
React6.useEffect(() => {
|
|
2326
2326
|
setFocusIndex(-1);
|
|
2327
2327
|
}, [normalizedQuery]);
|
|
2328
|
-
|
|
2328
|
+
React6.useEffect(() => {
|
|
2329
2329
|
if (focusIndex < 0) return;
|
|
2330
2330
|
const el = scrollRef.current?.querySelector(
|
|
2331
2331
|
`[data-emoji-index="${focusIndex}"]`
|
|
2332
2332
|
);
|
|
2333
2333
|
el?.focus();
|
|
2334
2334
|
}, [focusIndex]);
|
|
2335
|
-
const commitRecent =
|
|
2335
|
+
const commitRecent = React6.useCallback(
|
|
2336
2336
|
(glyph) => {
|
|
2337
2337
|
setRecents((prev) => {
|
|
2338
2338
|
const next = [glyph, ...prev.filter((e) => e !== glyph)].slice(
|
|
@@ -2345,14 +2345,14 @@ function EmojiPicker({
|
|
|
2345
2345
|
},
|
|
2346
2346
|
[recentLimit, storageKey]
|
|
2347
2347
|
);
|
|
2348
|
-
const handleSelect =
|
|
2348
|
+
const handleSelect = React6.useCallback(
|
|
2349
2349
|
(glyph) => {
|
|
2350
2350
|
commitRecent(glyph);
|
|
2351
2351
|
onSelect(glyph);
|
|
2352
2352
|
},
|
|
2353
2353
|
[commitRecent, onSelect]
|
|
2354
2354
|
);
|
|
2355
|
-
const chooseTone =
|
|
2355
|
+
const chooseTone = React6.useCallback(
|
|
2356
2356
|
(tone) => {
|
|
2357
2357
|
setSkinTone(tone);
|
|
2358
2358
|
setToneOpen(false);
|
|
@@ -2649,6 +2649,7 @@ function EmojiPickerPopover({
|
|
|
2649
2649
|
onSelect,
|
|
2650
2650
|
triggerLabel,
|
|
2651
2651
|
triggerClassName: triggerClassName2,
|
|
2652
|
+
disabled = false,
|
|
2652
2653
|
side = "top",
|
|
2653
2654
|
align = "end",
|
|
2654
2655
|
open,
|
|
@@ -2657,17 +2658,17 @@ function EmojiPickerPopover({
|
|
|
2657
2658
|
locale = "en",
|
|
2658
2659
|
...pickerProps
|
|
2659
2660
|
}) {
|
|
2660
|
-
const [internalOpen, setInternalOpen] =
|
|
2661
|
+
const [internalOpen, setInternalOpen] = React6.useState(false);
|
|
2661
2662
|
const isControlled = open !== void 0;
|
|
2662
2663
|
const isOpen = isControlled ? open : internalOpen;
|
|
2663
|
-
const setOpen =
|
|
2664
|
+
const setOpen = React6.useCallback(
|
|
2664
2665
|
(next) => {
|
|
2665
2666
|
if (!isControlled) setInternalOpen(next);
|
|
2666
2667
|
onOpenChange?.(next);
|
|
2667
2668
|
},
|
|
2668
2669
|
[isControlled, onOpenChange]
|
|
2669
2670
|
);
|
|
2670
|
-
const handleSelect =
|
|
2671
|
+
const handleSelect = React6.useCallback(
|
|
2671
2672
|
(emoji) => {
|
|
2672
2673
|
onSelect(emoji);
|
|
2673
2674
|
if (!keepOpenOnSelect) setOpen(false);
|
|
@@ -2681,6 +2682,7 @@ function EmojiPickerPopover({
|
|
|
2681
2682
|
type: "button",
|
|
2682
2683
|
variant: "ghost",
|
|
2683
2684
|
size: "icon",
|
|
2685
|
+
disabled,
|
|
2684
2686
|
"aria-label": triggerLabel ?? DEFAULT_TRIGGER_LABEL[locale],
|
|
2685
2687
|
className: cn("text-muted-foreground", triggerClassName2),
|
|
2686
2688
|
children: /* @__PURE__ */ jsx(Smile, { className: "size-5" })
|
|
@@ -2690,6 +2692,196 @@ function EmojiPickerPopover({
|
|
|
2690
2692
|
] });
|
|
2691
2693
|
}
|
|
2692
2694
|
|
|
2695
|
+
// src/lib/insert-at-caret.ts
|
|
2696
|
+
function insertAtCaret(element, value, text) {
|
|
2697
|
+
const start = element?.selectionStart ?? value.length;
|
|
2698
|
+
const end = element?.selectionEnd ?? value.length;
|
|
2699
|
+
return {
|
|
2700
|
+
value: value.slice(0, start) + text + value.slice(end),
|
|
2701
|
+
caret: start + text.length
|
|
2702
|
+
};
|
|
2703
|
+
}
|
|
2704
|
+
var wrapperClassName = "relative w-full rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 has-[[aria-invalid=true]]:border-destructive has-[[aria-invalid=true]]:ring-destructive/20 has-[:disabled]:opacity-50 dark:bg-input/30 dark:has-[[aria-invalid=true]]:ring-destructive/40";
|
|
2705
|
+
var fieldResetClassName = "border-0 bg-transparent shadow-none focus-visible:border-transparent focus-visible:ring-0 dark:bg-transparent";
|
|
2706
|
+
function mergeRefs(...refs) {
|
|
2707
|
+
return (node) => {
|
|
2708
|
+
for (const ref of refs) {
|
|
2709
|
+
if (typeof ref === "function") {
|
|
2710
|
+
ref(node);
|
|
2711
|
+
} else if (ref) {
|
|
2712
|
+
ref.current = node;
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2716
|
+
}
|
|
2717
|
+
function emitChange(element, nextValue, onChange) {
|
|
2718
|
+
const prototype = element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
2719
|
+
const descriptor = Object.getOwnPropertyDescriptor(prototype, "value");
|
|
2720
|
+
descriptor?.set?.call(element, nextValue);
|
|
2721
|
+
const tracker = element._valueTracker;
|
|
2722
|
+
tracker?.setValue?.(nextValue === "" ? " " : "");
|
|
2723
|
+
onChange?.({
|
|
2724
|
+
target: element,
|
|
2725
|
+
currentTarget: element
|
|
2726
|
+
});
|
|
2727
|
+
}
|
|
2728
|
+
function useEmojiInsert(fieldRef, value, onChange) {
|
|
2729
|
+
return React6.useCallback(
|
|
2730
|
+
(emoji) => {
|
|
2731
|
+
const el = fieldRef.current;
|
|
2732
|
+
const current = value !== void 0 && value !== null ? String(value) : el?.value ?? "";
|
|
2733
|
+
const { value: next, caret } = insertAtCaret(el, current, emoji);
|
|
2734
|
+
if (el) {
|
|
2735
|
+
emitChange(el, next, onChange);
|
|
2736
|
+
requestAnimationFrame(() => {
|
|
2737
|
+
el.focus();
|
|
2738
|
+
el.setSelectionRange(caret, caret);
|
|
2739
|
+
});
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
onChange?.({
|
|
2743
|
+
target: { value: next },
|
|
2744
|
+
currentTarget: { value: next }
|
|
2745
|
+
});
|
|
2746
|
+
},
|
|
2747
|
+
[fieldRef, value, onChange]
|
|
2748
|
+
);
|
|
2749
|
+
}
|
|
2750
|
+
var EmojiTextarea = React6.forwardRef(
|
|
2751
|
+
function EmojiTextarea2({
|
|
2752
|
+
className,
|
|
2753
|
+
locale = "en",
|
|
2754
|
+
disabled,
|
|
2755
|
+
readOnly,
|
|
2756
|
+
value,
|
|
2757
|
+
onChange,
|
|
2758
|
+
triggerLabel,
|
|
2759
|
+
keepOpenOnSelect,
|
|
2760
|
+
open,
|
|
2761
|
+
onOpenChange,
|
|
2762
|
+
side = "top",
|
|
2763
|
+
align = "end",
|
|
2764
|
+
labels,
|
|
2765
|
+
recentLimit,
|
|
2766
|
+
storageKey,
|
|
2767
|
+
emojiTriggerClassName,
|
|
2768
|
+
...props
|
|
2769
|
+
}, ref) {
|
|
2770
|
+
const fieldRef = React6.useRef(null);
|
|
2771
|
+
const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
|
|
2772
|
+
const pickerDisabled = Boolean(disabled || readOnly);
|
|
2773
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(wrapperClassName, className), children: [
|
|
2774
|
+
/* @__PURE__ */ jsx(
|
|
2775
|
+
"textarea",
|
|
2776
|
+
{
|
|
2777
|
+
"data-slot": "textarea",
|
|
2778
|
+
ref: mergeRefs(fieldRef, ref),
|
|
2779
|
+
disabled,
|
|
2780
|
+
readOnly,
|
|
2781
|
+
value,
|
|
2782
|
+
onChange,
|
|
2783
|
+
className: cn(
|
|
2784
|
+
"placeholder:text-muted-foreground flex min-h-20 w-full rounded-md px-3 py-2 pb-9 pr-10 text-base outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
2785
|
+
fieldResetClassName,
|
|
2786
|
+
className
|
|
2787
|
+
),
|
|
2788
|
+
...props
|
|
2789
|
+
}
|
|
2790
|
+
),
|
|
2791
|
+
/* @__PURE__ */ jsx("div", { className: "absolute right-1 bottom-1", children: /* @__PURE__ */ jsx(
|
|
2792
|
+
EmojiPickerPopover,
|
|
2793
|
+
{
|
|
2794
|
+
locale,
|
|
2795
|
+
onSelect: handleEmojiSelect,
|
|
2796
|
+
disabled: pickerDisabled,
|
|
2797
|
+
triggerLabel,
|
|
2798
|
+
keepOpenOnSelect,
|
|
2799
|
+
open,
|
|
2800
|
+
onOpenChange,
|
|
2801
|
+
side,
|
|
2802
|
+
align,
|
|
2803
|
+
labels,
|
|
2804
|
+
recentLimit,
|
|
2805
|
+
storageKey,
|
|
2806
|
+
triggerClassName: cn(
|
|
2807
|
+
"size-7 text-muted-foreground",
|
|
2808
|
+
emojiTriggerClassName
|
|
2809
|
+
)
|
|
2810
|
+
}
|
|
2811
|
+
) })
|
|
2812
|
+
] });
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
EmojiTextarea.displayName = "EmojiTextarea";
|
|
2816
|
+
var EmojiInput = React6.forwardRef(
|
|
2817
|
+
function EmojiInput2({
|
|
2818
|
+
className,
|
|
2819
|
+
locale = "en",
|
|
2820
|
+
disabled,
|
|
2821
|
+
readOnly,
|
|
2822
|
+
value,
|
|
2823
|
+
onChange,
|
|
2824
|
+
type = "text",
|
|
2825
|
+
triggerLabel,
|
|
2826
|
+
keepOpenOnSelect,
|
|
2827
|
+
open,
|
|
2828
|
+
onOpenChange,
|
|
2829
|
+
side = "top",
|
|
2830
|
+
align = "end",
|
|
2831
|
+
labels,
|
|
2832
|
+
recentLimit,
|
|
2833
|
+
storageKey,
|
|
2834
|
+
emojiTriggerClassName,
|
|
2835
|
+
...props
|
|
2836
|
+
}, ref) {
|
|
2837
|
+
const fieldRef = React6.useRef(null);
|
|
2838
|
+
const handleEmojiSelect = useEmojiInsert(fieldRef, value, onChange);
|
|
2839
|
+
const pickerDisabled = Boolean(disabled || readOnly);
|
|
2840
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(wrapperClassName, className), children: [
|
|
2841
|
+
/* @__PURE__ */ jsx(
|
|
2842
|
+
"input",
|
|
2843
|
+
{
|
|
2844
|
+
"data-slot": "input",
|
|
2845
|
+
type,
|
|
2846
|
+
ref: mergeRefs(fieldRef, ref),
|
|
2847
|
+
disabled,
|
|
2848
|
+
readOnly,
|
|
2849
|
+
value,
|
|
2850
|
+
onChange,
|
|
2851
|
+
className: cn(
|
|
2852
|
+
"placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md px-3 py-1 pr-10 text-base outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
2853
|
+
fieldResetClassName,
|
|
2854
|
+
className
|
|
2855
|
+
),
|
|
2856
|
+
...props
|
|
2857
|
+
}
|
|
2858
|
+
),
|
|
2859
|
+
/* @__PURE__ */ jsx("div", { className: "absolute top-1/2 right-1 -translate-y-1/2", children: /* @__PURE__ */ jsx(
|
|
2860
|
+
EmojiPickerPopover,
|
|
2861
|
+
{
|
|
2862
|
+
locale,
|
|
2863
|
+
onSelect: handleEmojiSelect,
|
|
2864
|
+
disabled: pickerDisabled,
|
|
2865
|
+
triggerLabel,
|
|
2866
|
+
keepOpenOnSelect,
|
|
2867
|
+
open,
|
|
2868
|
+
onOpenChange,
|
|
2869
|
+
side,
|
|
2870
|
+
align,
|
|
2871
|
+
labels,
|
|
2872
|
+
recentLimit,
|
|
2873
|
+
storageKey,
|
|
2874
|
+
triggerClassName: cn(
|
|
2875
|
+
"size-7 text-muted-foreground",
|
|
2876
|
+
emojiTriggerClassName
|
|
2877
|
+
)
|
|
2878
|
+
}
|
|
2879
|
+
) })
|
|
2880
|
+
] });
|
|
2881
|
+
}
|
|
2882
|
+
);
|
|
2883
|
+
EmojiInput.displayName = "EmojiInput";
|
|
2884
|
+
|
|
2693
2885
|
// src/components/video/hls-config.ts
|
|
2694
2886
|
function shouldRetryLiveEdge404(retryConfig, retryCount, _isTimeout, loaderResponse, defaultRetry) {
|
|
2695
2887
|
if (loaderResponse?.code === 404) {
|
|
@@ -2850,27 +3042,27 @@ function useHlsPlayback({
|
|
|
2850
3042
|
onError,
|
|
2851
3043
|
onPlayingChange
|
|
2852
3044
|
}) {
|
|
2853
|
-
const videoRef =
|
|
2854
|
-
const hlsRef =
|
|
2855
|
-
const [state, setState] =
|
|
2856
|
-
const [qualities, setQualities] =
|
|
2857
|
-
const [activeLevel, setActiveLevel] =
|
|
2858
|
-
const [autoplayState, setAutoplayState] =
|
|
2859
|
-
const [error, setError] =
|
|
2860
|
-
const [reloadKey, setReloadKey] =
|
|
2861
|
-
const onErrorRef =
|
|
2862
|
-
const onPlayingChangeRef =
|
|
2863
|
-
|
|
3045
|
+
const videoRef = React6.useRef(null);
|
|
3046
|
+
const hlsRef = React6.useRef(null);
|
|
3047
|
+
const [state, setState] = React6.useState("idle");
|
|
3048
|
+
const [qualities, setQualities] = React6.useState([]);
|
|
3049
|
+
const [activeLevel, setActiveLevel] = React6.useState(-1);
|
|
3050
|
+
const [autoplayState, setAutoplayState] = React6.useState("none");
|
|
3051
|
+
const [error, setError] = React6.useState(null);
|
|
3052
|
+
const [reloadKey, setReloadKey] = React6.useState(0);
|
|
3053
|
+
const onErrorRef = React6.useRef(onError);
|
|
3054
|
+
const onPlayingChangeRef = React6.useRef(onPlayingChange);
|
|
3055
|
+
React6.useEffect(() => {
|
|
2864
3056
|
onErrorRef.current = onError;
|
|
2865
3057
|
onPlayingChangeRef.current = onPlayingChange;
|
|
2866
3058
|
}, [onError, onPlayingChange]);
|
|
2867
|
-
const retry =
|
|
3059
|
+
const retry = React6.useCallback(() => {
|
|
2868
3060
|
setError(null);
|
|
2869
3061
|
setState("loading");
|
|
2870
3062
|
setAutoplayState("none");
|
|
2871
3063
|
setReloadKey((k) => k + 1);
|
|
2872
3064
|
}, []);
|
|
2873
|
-
|
|
3065
|
+
React6.useEffect(() => {
|
|
2874
3066
|
const media = videoRef.current;
|
|
2875
3067
|
if (!media || !src || !active) {
|
|
2876
3068
|
setState("idle");
|
|
@@ -3082,7 +3274,7 @@ function useHlsPlayback({
|
|
|
3082
3274
|
destroyHls();
|
|
3083
3275
|
};
|
|
3084
3276
|
}, [src, mode, active, autoPlay, muted, reloadKey]);
|
|
3085
|
-
const setLevel =
|
|
3277
|
+
const setLevel = React6.useCallback((index) => {
|
|
3086
3278
|
const hls = hlsRef.current;
|
|
3087
3279
|
if (!hls) return;
|
|
3088
3280
|
hls.nextLevel = index;
|
|
@@ -3152,12 +3344,12 @@ function VideoPlayer({
|
|
|
3152
3344
|
className
|
|
3153
3345
|
}) {
|
|
3154
3346
|
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
3155
|
-
const containerRef =
|
|
3156
|
-
const firstPlayFiredRef =
|
|
3157
|
-
const [userStarted, setUserStarted] =
|
|
3347
|
+
const containerRef = React6.useRef(null);
|
|
3348
|
+
const firstPlayFiredRef = React6.useRef(false);
|
|
3349
|
+
const [userStarted, setUserStarted] = React6.useState(false);
|
|
3158
3350
|
const active = autoPlay || !poster || userStarted;
|
|
3159
3351
|
const autoplayActive = autoPlay || userStarted;
|
|
3160
|
-
const handlePlayingChange =
|
|
3352
|
+
const handlePlayingChange = React6.useCallback(
|
|
3161
3353
|
(playing) => {
|
|
3162
3354
|
setIsPlaying(playing);
|
|
3163
3355
|
if (playing && !firstPlayFiredRef.current) {
|
|
@@ -3186,25 +3378,25 @@ function VideoPlayer({
|
|
|
3186
3378
|
onError,
|
|
3187
3379
|
onPlayingChange: handlePlayingChange
|
|
3188
3380
|
});
|
|
3189
|
-
const [isPlaying, setIsPlaying] =
|
|
3190
|
-
const [isMuted, setIsMuted] =
|
|
3191
|
-
const [volume, setVolume] =
|
|
3192
|
-
const [currentTime, setCurrentTime] =
|
|
3193
|
-
const [duration, setDuration] =
|
|
3194
|
-
const [buffered, setBuffered] =
|
|
3195
|
-
const [isFullscreen, setIsFullscreen] =
|
|
3196
|
-
const [pipActive, setPipActive] =
|
|
3197
|
-
const [controlsVisible, setControlsVisible] =
|
|
3198
|
-
const [playbackRate, setPlaybackRate] =
|
|
3199
|
-
const [openMenu, setOpenMenu] =
|
|
3381
|
+
const [isPlaying, setIsPlaying] = React6.useState(false);
|
|
3382
|
+
const [isMuted, setIsMuted] = React6.useState(muted);
|
|
3383
|
+
const [volume, setVolume] = React6.useState(1);
|
|
3384
|
+
const [currentTime, setCurrentTime] = React6.useState(0);
|
|
3385
|
+
const [duration, setDuration] = React6.useState(0);
|
|
3386
|
+
const [buffered, setBuffered] = React6.useState(0);
|
|
3387
|
+
const [isFullscreen, setIsFullscreen] = React6.useState(false);
|
|
3388
|
+
const [pipActive, setPipActive] = React6.useState(false);
|
|
3389
|
+
const [controlsVisible, setControlsVisible] = React6.useState(true);
|
|
3390
|
+
const [playbackRate, setPlaybackRate] = React6.useState(1);
|
|
3391
|
+
const [openMenu, setOpenMenu] = React6.useState(
|
|
3200
3392
|
null
|
|
3201
3393
|
);
|
|
3202
|
-
const [behindLive, setBehindLive] =
|
|
3203
|
-
const hideTimerRef =
|
|
3394
|
+
const [behindLive, setBehindLive] = React6.useState(false);
|
|
3395
|
+
const hideTimerRef = React6.useRef(null);
|
|
3204
3396
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
3205
3397
|
const fullscreenSupported = typeof document !== "undefined" && (!!document.fullscreenEnabled || // Safari
|
|
3206
3398
|
"webkitFullscreenEnabled" in document);
|
|
3207
|
-
|
|
3399
|
+
React6.useEffect(() => {
|
|
3208
3400
|
const video = videoRef.current;
|
|
3209
3401
|
if (!video || !active) return;
|
|
3210
3402
|
const onTimeUpdate = () => {
|
|
@@ -3237,12 +3429,12 @@ function VideoPlayer({
|
|
|
3237
3429
|
video.removeEventListener("ratechange", onRate);
|
|
3238
3430
|
};
|
|
3239
3431
|
}, [videoRef, active, mode]);
|
|
3240
|
-
|
|
3432
|
+
React6.useEffect(() => {
|
|
3241
3433
|
const onFsChange = () => setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
3242
3434
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
3243
3435
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
3244
3436
|
}, []);
|
|
3245
|
-
|
|
3437
|
+
React6.useEffect(() => {
|
|
3246
3438
|
const video = videoRef.current;
|
|
3247
3439
|
if (!video) return;
|
|
3248
3440
|
const onEnter = () => setPipActive(true);
|
|
@@ -3254,18 +3446,18 @@ function VideoPlayer({
|
|
|
3254
3446
|
video.removeEventListener("leavepictureinpicture", onLeave);
|
|
3255
3447
|
};
|
|
3256
3448
|
}, [videoRef]);
|
|
3257
|
-
const scheduleHide =
|
|
3449
|
+
const scheduleHide = React6.useCallback(() => {
|
|
3258
3450
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3259
3451
|
hideTimerRef.current = setTimeout(() => {
|
|
3260
3452
|
setControlsVisible(false);
|
|
3261
3453
|
setOpenMenu(null);
|
|
3262
3454
|
}, CONTROLS_HIDE_MS);
|
|
3263
3455
|
}, []);
|
|
3264
|
-
const revealControls =
|
|
3456
|
+
const revealControls = React6.useCallback(() => {
|
|
3265
3457
|
setControlsVisible(true);
|
|
3266
3458
|
scheduleHide();
|
|
3267
3459
|
}, [scheduleHide]);
|
|
3268
|
-
|
|
3460
|
+
React6.useEffect(() => {
|
|
3269
3461
|
return () => {
|
|
3270
3462
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3271
3463
|
};
|
|
@@ -3718,8 +3910,8 @@ function MenuItem({
|
|
|
3718
3910
|
);
|
|
3719
3911
|
}
|
|
3720
3912
|
function usePlaybackStats(statsUrl, { intervalMs = 15e3, enabled = true } = {}) {
|
|
3721
|
-
const [stats, setStats] =
|
|
3722
|
-
|
|
3913
|
+
const [stats, setStats] = React6.useState({});
|
|
3914
|
+
React6.useEffect(() => {
|
|
3723
3915
|
if (!statsUrl || !enabled) return;
|
|
3724
3916
|
let cancelled = false;
|
|
3725
3917
|
const controller = new AbortController();
|
|
@@ -4142,7 +4334,7 @@ function ScrollBar({
|
|
|
4142
4334
|
);
|
|
4143
4335
|
}
|
|
4144
4336
|
var phoneInputGroupClass = "flex h-9 w-full gap-0 overflow-hidden rounded-md border border-input bg-transparent shadow-xs transition-[color,box-shadow] [--PhoneInputCountrySelect-marginRight:0] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/50 dark:bg-input/30 [&_.PhoneInputCountry]:mr-0";
|
|
4145
|
-
var PhoneInput =
|
|
4337
|
+
var PhoneInput = React6.forwardRef(
|
|
4146
4338
|
({ className, onChange, value, defaultCountry = "MX", ...props }, ref) => {
|
|
4147
4339
|
return /* @__PURE__ */ jsx(
|
|
4148
4340
|
RPNInput.default,
|
|
@@ -4162,7 +4354,7 @@ var PhoneInput = React5.forwardRef(
|
|
|
4162
4354
|
}
|
|
4163
4355
|
);
|
|
4164
4356
|
PhoneInput.displayName = "PhoneInput";
|
|
4165
|
-
var InputComponent =
|
|
4357
|
+
var InputComponent = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
4166
4358
|
Input,
|
|
4167
4359
|
{
|
|
4168
4360
|
className: cn(
|
|
@@ -4180,9 +4372,9 @@ var CountrySelect = ({
|
|
|
4180
4372
|
options: countryList,
|
|
4181
4373
|
onChange
|
|
4182
4374
|
}) => {
|
|
4183
|
-
const scrollAreaRef =
|
|
4184
|
-
const [searchValue, setSearchValue] =
|
|
4185
|
-
const [isOpen, setIsOpen] =
|
|
4375
|
+
const scrollAreaRef = React6.useRef(null);
|
|
4376
|
+
const [searchValue, setSearchValue] = React6.useState("");
|
|
4377
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
4186
4378
|
return /* @__PURE__ */ jsxs(
|
|
4187
4379
|
Popover,
|
|
4188
4380
|
{
|
|
@@ -4363,8 +4555,8 @@ var MEXICO_STATE_PATHS = {
|
|
|
4363
4555
|
};
|
|
4364
4556
|
function MexicoMap({ selected, onToggle, className }) {
|
|
4365
4557
|
const isInteractive = typeof onToggle === "function";
|
|
4366
|
-
const selectedSet =
|
|
4367
|
-
const handleKeyDown =
|
|
4558
|
+
const selectedSet = React6.useMemo(() => new Set(selected), [selected]);
|
|
4559
|
+
const handleKeyDown = React6.useCallback(
|
|
4368
4560
|
(event, id) => {
|
|
4369
4561
|
if (!onToggle) return;
|
|
4370
4562
|
if (event.key === "Enter" || event.key === " ") {
|
|
@@ -4847,6 +5039,6 @@ function ChatMessageList({
|
|
|
4847
5039
|
] }) });
|
|
4848
5040
|
}
|
|
4849
5041
|
|
|
4850
|
-
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiPicker, EmojiPickerPopover, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
|
5042
|
+
export { AvatarEditor, AvatarEditorDialog, Bubble, BubbleContent, BubbleGroup, BubbleReactions, ChatMessageList, ConfirmDestructiveDialog, EmojiInput, EmojiPicker, EmojiPickerPopover, EmojiTextarea, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyState, EmptyTitle, ErrorState, LanguageContext, LanguageSwitcher, LoadingState, MEXICO_STATES, MEXICO_STATE_PATHS, Marker, MarkerContent, MarkerIcon, Message, MessageAvatar, MessageContent, MessageFooter, MessageGroup, MessageHeader, MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, MexicoMap, OrgSwitcher, PhoneInput, SearchCommand, ThemeSwitcher, VerifiedProfessionalBadge, VideoPlayer, avatarFallbackStyle, bubbleVariants, cn, createLiveHlsConfig, createVodHlsConfig, defaultLanguages, describePlaybackError, fuzzyMatch, getAvatarColors, getInitials, insertAtCaret, markerVariants, normalizeEmojiQuery, shouldRetryLiveEdge404, useDebouncedValue, useDebouncedValueStrict, useHlsPlayback, useLanguageContext, usePlaybackStats, useSearchHotkey };
|
|
4851
5043
|
//# sourceMappingURL=index.js.map
|
|
4852
5044
|
//# sourceMappingURL=index.js.map
|