@cupcodev/ui 1.2.3 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/index.cjs +265 -95
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +364 -195
- package/dist/styles.css +1 -1
- package/package.json +4 -2
- package/postinstall.cjs +20 -0
- package/styles/base.css +0 -4
- package/styles/global.css +0 -4
package/dist/index.js
CHANGED
|
@@ -862,6 +862,31 @@ var isRuntimeDev = () => {
|
|
|
862
862
|
return mode === "development";
|
|
863
863
|
};
|
|
864
864
|
|
|
865
|
+
// src/utils/parseAssetId.ts
|
|
866
|
+
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
867
|
+
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
868
|
+
var isUuid = (value) => {
|
|
869
|
+
if (typeof value !== "string") return false;
|
|
870
|
+
return UUID_REGEX.test(value.trim());
|
|
871
|
+
};
|
|
872
|
+
function parseAssetId(input) {
|
|
873
|
+
var _a65, _b5, _c, _d;
|
|
874
|
+
const raw = input == null ? void 0 : input.trim();
|
|
875
|
+
if (!raw) return void 0;
|
|
876
|
+
if (UUID_REGEX.test(raw)) return raw;
|
|
877
|
+
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
878
|
+
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
879
|
+
try {
|
|
880
|
+
const url = new URL(raw);
|
|
881
|
+
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
882
|
+
if (isUuid(queryParamId)) return queryParamId;
|
|
883
|
+
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
884
|
+
if (isUuid(matchFromPath)) return matchFromPath;
|
|
885
|
+
} catch (e) {
|
|
886
|
+
}
|
|
887
|
+
return void 0;
|
|
888
|
+
}
|
|
889
|
+
|
|
865
890
|
// src/hooks/useTelescupAsset.ts
|
|
866
891
|
var getApiBase = () => getRuntimeEnvOr("VITE_TELESCUP_API_BASE", "https://cdn.cupcode.com.br").replace(/\/+$/, "");
|
|
867
892
|
function buildTelescupImageURL(options) {
|
|
@@ -874,6 +899,25 @@ function buildTelescupImageURL(options) {
|
|
|
874
899
|
params.set("q", quality.toString());
|
|
875
900
|
return `${getApiBase()}/i?${params.toString()}`;
|
|
876
901
|
}
|
|
902
|
+
function resolveTelescupImageURL(value, options) {
|
|
903
|
+
const raw = value == null ? void 0 : value.trim();
|
|
904
|
+
if (!raw) return void 0;
|
|
905
|
+
const parsedId = parseAssetId(raw);
|
|
906
|
+
if (parsedId) {
|
|
907
|
+
return buildTelescupImageURL({
|
|
908
|
+
id: parsedId,
|
|
909
|
+
width: options == null ? void 0 : options.width,
|
|
910
|
+
height: options == null ? void 0 : options.height,
|
|
911
|
+
fit: options == null ? void 0 : options.fit,
|
|
912
|
+
format: options == null ? void 0 : options.format,
|
|
913
|
+
quality: options == null ? void 0 : options.quality
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
917
|
+
return raw;
|
|
918
|
+
}
|
|
919
|
+
return void 0;
|
|
920
|
+
}
|
|
877
921
|
function buildTelescupVideoURL(id) {
|
|
878
922
|
return `${getApiBase()}/i/v?id=${id}`;
|
|
879
923
|
}
|
|
@@ -908,31 +952,6 @@ function useTelescupImage(options, lang) {
|
|
|
908
952
|
return { url, meta, loading };
|
|
909
953
|
}
|
|
910
954
|
|
|
911
|
-
// src/utils/parseAssetId.ts
|
|
912
|
-
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
913
|
-
var UUID_IN_TEXT_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
914
|
-
var isUuid = (value) => {
|
|
915
|
-
if (typeof value !== "string") return false;
|
|
916
|
-
return UUID_REGEX.test(value.trim());
|
|
917
|
-
};
|
|
918
|
-
function parseAssetId(input) {
|
|
919
|
-
var _a65, _b5, _c, _d;
|
|
920
|
-
const raw = input == null ? void 0 : input.trim();
|
|
921
|
-
if (!raw) return void 0;
|
|
922
|
-
if (UUID_REGEX.test(raw)) return raw;
|
|
923
|
-
const matchFromRaw = (_a65 = raw.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _a65[0];
|
|
924
|
-
if (isUuid(matchFromRaw)) return matchFromRaw;
|
|
925
|
-
try {
|
|
926
|
-
const url = new URL(raw);
|
|
927
|
-
const queryParamId = (_c = (_b5 = url.searchParams.get("id")) != null ? _b5 : url.searchParams.get("asset_id")) != null ? _c : url.searchParams.get("assetId");
|
|
928
|
-
if (isUuid(queryParamId)) return queryParamId;
|
|
929
|
-
const matchFromPath = (_d = url.pathname.match(UUID_IN_TEXT_REGEX)) == null ? void 0 : _d[0];
|
|
930
|
-
if (isUuid(matchFromPath)) return matchFromPath;
|
|
931
|
-
} catch (e) {
|
|
932
|
-
}
|
|
933
|
-
return void 0;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
955
|
// src/components/cupcode/DockWrapper.tsx
|
|
937
956
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
938
957
|
var getImageUrl = (rawId, width = 60, height = 60, format = "avif", quality = 60) => {
|
|
@@ -2275,7 +2294,7 @@ ModalDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
2275
2294
|
|
|
2276
2295
|
// src/components/cupcode/NavbarCupcode.tsx
|
|
2277
2296
|
import * as React10 from "react";
|
|
2278
|
-
import { Menu
|
|
2297
|
+
import { Menu } from "lucide-react";
|
|
2279
2298
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2280
2299
|
var NavbarCupcode = ({
|
|
2281
2300
|
logo,
|
|
@@ -2284,9 +2303,54 @@ var NavbarCupcode = ({
|
|
|
2284
2303
|
className
|
|
2285
2304
|
}) => {
|
|
2286
2305
|
const [isOpen, setIsOpen] = React10.useState(false);
|
|
2306
|
+
const navRef = React10.useRef(null);
|
|
2307
|
+
const mobileMenuId = React10.useId();
|
|
2308
|
+
React10.useEffect(() => {
|
|
2309
|
+
if (!isOpen) return;
|
|
2310
|
+
const handlePointerDown = (event) => {
|
|
2311
|
+
var _a65;
|
|
2312
|
+
const target = event.target;
|
|
2313
|
+
if (!(target instanceof Node)) return;
|
|
2314
|
+
if (!((_a65 = navRef.current) == null ? void 0 : _a65.contains(target))) {
|
|
2315
|
+
setIsOpen(false);
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
const handleEscape = (event) => {
|
|
2319
|
+
if (event.key === "Escape") {
|
|
2320
|
+
setIsOpen(false);
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
2324
|
+
document.addEventListener("keydown", handleEscape);
|
|
2325
|
+
return () => {
|
|
2326
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
2327
|
+
document.removeEventListener("keydown", handleEscape);
|
|
2328
|
+
};
|
|
2329
|
+
}, [isOpen]);
|
|
2330
|
+
React10.useEffect(() => {
|
|
2331
|
+
if (!isOpen) return;
|
|
2332
|
+
const { style } = document.body;
|
|
2333
|
+
const previousOverflow = style.overflow;
|
|
2334
|
+
style.overflow = "hidden";
|
|
2335
|
+
return () => {
|
|
2336
|
+
style.overflow = previousOverflow;
|
|
2337
|
+
};
|
|
2338
|
+
}, [isOpen]);
|
|
2339
|
+
React10.useEffect(() => {
|
|
2340
|
+
const handleResize = () => {
|
|
2341
|
+
if (window.innerWidth >= 768) {
|
|
2342
|
+
setIsOpen(false);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
window.addEventListener("resize", handleResize);
|
|
2346
|
+
return () => {
|
|
2347
|
+
window.removeEventListener("resize", handleResize);
|
|
2348
|
+
};
|
|
2349
|
+
}, []);
|
|
2287
2350
|
return /* @__PURE__ */ jsx21(
|
|
2288
2351
|
"nav",
|
|
2289
2352
|
{
|
|
2353
|
+
ref: navRef,
|
|
2290
2354
|
className: cn(
|
|
2291
2355
|
"fixed top-0 left-0 right-0 z-[200] pointer-events-auto",
|
|
2292
2356
|
"glass border-b border-border",
|
|
@@ -2345,45 +2409,56 @@ var NavbarCupcode = ({
|
|
|
2345
2409
|
/* @__PURE__ */ jsx21(
|
|
2346
2410
|
"button",
|
|
2347
2411
|
{
|
|
2412
|
+
type: "button",
|
|
2348
2413
|
onClick: () => setIsOpen(!isOpen),
|
|
2349
|
-
|
|
2350
|
-
|
|
2414
|
+
"aria-controls": mobileMenuId,
|
|
2415
|
+
"aria-expanded": isOpen,
|
|
2416
|
+
"aria-label": isOpen ? "Fechar menu de navega\xE7\xE3o" : "Abrir menu de navega\xE7\xE3o",
|
|
2417
|
+
className: "md:hidden inline-flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
2418
|
+
children: /* @__PURE__ */ jsx21(Menu, { className: cn("h-6 w-6 text-foreground", isOpen && "text-primary") })
|
|
2351
2419
|
}
|
|
2352
2420
|
)
|
|
2353
2421
|
] }),
|
|
2354
|
-
isOpen && /* @__PURE__ */ jsxs17(
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2422
|
+
isOpen && /* @__PURE__ */ jsxs17(
|
|
2423
|
+
"div",
|
|
2424
|
+
{
|
|
2425
|
+
id: mobileMenuId,
|
|
2426
|
+
className: "md:hidden max-h-[calc(100dvh-4rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
|
|
2427
|
+
children: [
|
|
2428
|
+
items.map((item, index) => {
|
|
2429
|
+
const key = `${item.label}-${index}`;
|
|
2430
|
+
const isActive = item.isActive;
|
|
2431
|
+
const classes = cn(
|
|
2432
|
+
"flex min-h-11 items-center gap-2 rounded-lg px-4 py-2.5 text-sm font-semibold text-foreground transition-colors hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
2433
|
+
isActive && "text-primary"
|
|
2434
|
+
);
|
|
2435
|
+
const handleClick = (event) => {
|
|
2436
|
+
var _a65;
|
|
2437
|
+
(_a65 = item.onClick) == null ? void 0 : _a65.call(item, event);
|
|
2438
|
+
setIsOpen(false);
|
|
2439
|
+
};
|
|
2440
|
+
if (item.href.startsWith("#")) {
|
|
2441
|
+
return /* @__PURE__ */ jsxs17("a", { href: item.href, className: classes, onClick: handleClick, children: [
|
|
2442
|
+
item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
|
|
2443
|
+
item.label
|
|
2444
|
+
] }, key);
|
|
2445
|
+
}
|
|
2446
|
+
return /* @__PURE__ */ jsxs17("a", { href: item.href, className: classes, onClick: handleClick, children: [
|
|
2447
|
+
item.icon && /* @__PURE__ */ jsx21("span", { children: item.icon }),
|
|
2448
|
+
item.label
|
|
2449
|
+
] }, key);
|
|
2450
|
+
}),
|
|
2451
|
+
actions && /* @__PURE__ */ jsx21("div", { className: "px-4 pb-[max(env(safe-area-inset-bottom),0.5rem)] pt-2", children: actions })
|
|
2452
|
+
]
|
|
2453
|
+
}
|
|
2454
|
+
)
|
|
2380
2455
|
] })
|
|
2381
2456
|
}
|
|
2382
2457
|
);
|
|
2383
2458
|
};
|
|
2384
2459
|
|
|
2385
2460
|
// src/components/cupcode/MainNavbar.tsx
|
|
2386
|
-
import { useCallback as useCallback6, useEffect as
|
|
2461
|
+
import { useCallback as useCallback6, useEffect as useEffect16, useMemo as useMemo8, useRef as useRef12, useState as useState13 } from "react";
|
|
2387
2462
|
|
|
2388
2463
|
// src/components/cupcode/TelescupImage.tsx
|
|
2389
2464
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
@@ -2471,13 +2546,13 @@ import {
|
|
|
2471
2546
|
UserRound,
|
|
2472
2547
|
UsersRound,
|
|
2473
2548
|
Volume2,
|
|
2474
|
-
X as
|
|
2549
|
+
X as X4
|
|
2475
2550
|
} from "lucide-react";
|
|
2476
2551
|
import {
|
|
2477
2552
|
useCallback as useCallback5,
|
|
2478
|
-
useEffect as
|
|
2553
|
+
useEffect as useEffect14,
|
|
2479
2554
|
useMemo as useMemo7,
|
|
2480
|
-
useRef as
|
|
2555
|
+
useRef as useRef11,
|
|
2481
2556
|
useState as useState11
|
|
2482
2557
|
} from "react";
|
|
2483
2558
|
|
|
@@ -2818,7 +2893,7 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
|
2818
2893
|
// src/components/ui/dialog.tsx
|
|
2819
2894
|
import * as React16 from "react";
|
|
2820
2895
|
import * as DialogPrimitive2 from "@radix-ui/react-dialog";
|
|
2821
|
-
import { X as
|
|
2896
|
+
import { X as X3 } from "lucide-react";
|
|
2822
2897
|
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2823
2898
|
var Dialog = DialogPrimitive2.Root;
|
|
2824
2899
|
var DialogTrigger = DialogPrimitive2.Trigger;
|
|
@@ -2850,7 +2925,7 @@ var DialogContent = React16.forwardRef(({ className, children, ...props }, ref)
|
|
|
2850
2925
|
children: [
|
|
2851
2926
|
children,
|
|
2852
2927
|
/* @__PURE__ */ jsxs21(DialogPrimitive2.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
|
|
2853
|
-
/* @__PURE__ */ jsx28(
|
|
2928
|
+
/* @__PURE__ */ jsx28(X3, { className: "h-4 w-4" }),
|
|
2854
2929
|
/* @__PURE__ */ jsx28("span", { className: "sr-only", children: "Close" })
|
|
2855
2930
|
] })
|
|
2856
2931
|
]
|
|
@@ -3017,7 +3092,7 @@ function useToast() {
|
|
|
3017
3092
|
}
|
|
3018
3093
|
|
|
3019
3094
|
// src/components/cupcode/TelescupUpload.tsx
|
|
3020
|
-
import React27, { useCallback as useCallback4, useEffect as
|
|
3095
|
+
import React27, { useCallback as useCallback4, useEffect as useEffect13, useMemo as useMemo6, useState as useState10 } from "react";
|
|
3021
3096
|
|
|
3022
3097
|
// src/lib/telescupClient.ts
|
|
3023
3098
|
var TelescupClientError = class extends Error {
|
|
@@ -4305,7 +4380,7 @@ var createTelescupClient = (config) => ({
|
|
|
4305
4380
|
import React21, { useCallback as useCallback2, useMemo as useMemo3, useState as useState7 } from "react";
|
|
4306
4381
|
|
|
4307
4382
|
// src/hooks/useTelescupAssets.ts
|
|
4308
|
-
import { useCallback, useEffect as
|
|
4383
|
+
import { useCallback, useEffect as useEffect11, useMemo as useMemo2, useRef as useRef8, useState as useState6 } from "react";
|
|
4309
4384
|
var DEFAULT_CACHE_MS = 3e4;
|
|
4310
4385
|
var listCache = /* @__PURE__ */ new Map();
|
|
4311
4386
|
var inFlight = /* @__PURE__ */ new Map();
|
|
@@ -4340,8 +4415,8 @@ function useTelescupAssets(options) {
|
|
|
4340
4415
|
const [isLoading, setIsLoading] = useState6(false);
|
|
4341
4416
|
const [isLoadingMore, setIsLoadingMore] = useState6(false);
|
|
4342
4417
|
const [error, setError] = useState6(null);
|
|
4343
|
-
const aliveRef =
|
|
4344
|
-
const requestSeqRef =
|
|
4418
|
+
const aliveRef = useRef8(true);
|
|
4419
|
+
const requestSeqRef = useRef8(0);
|
|
4345
4420
|
const fetchFirst = useCallback(
|
|
4346
4421
|
async (skipCache = false) => {
|
|
4347
4422
|
if (!enabled) return;
|
|
@@ -4420,7 +4495,7 @@ function useTelescupAssets(options) {
|
|
|
4420
4495
|
if (aliveRef.current && requestSeq === requestSeqRef.current) setIsLoadingMore(false);
|
|
4421
4496
|
}
|
|
4422
4497
|
}, [cacheKey, filters, isLoading, isLoadingMore, pageSize, resolvedClient, state.facets, state.items, state.nextCursor, state.total]);
|
|
4423
|
-
|
|
4498
|
+
useEffect11(() => {
|
|
4424
4499
|
aliveRef.current = true;
|
|
4425
4500
|
setState({ items: [] });
|
|
4426
4501
|
setIsLoadingMore(false);
|
|
@@ -4782,10 +4857,10 @@ var TelescupAssetPicker = ({
|
|
|
4782
4857
|
};
|
|
4783
4858
|
|
|
4784
4859
|
// src/components/cupcode/TelescupUploader.tsx
|
|
4785
|
-
import { useMemo as useMemo5, useRef as
|
|
4860
|
+
import { useMemo as useMemo5, useRef as useRef10, useState as useState9 } from "react";
|
|
4786
4861
|
|
|
4787
4862
|
// src/hooks/useTelescupUploadQueue.tsx
|
|
4788
|
-
import { useCallback as useCallback3, useEffect as
|
|
4863
|
+
import { useCallback as useCallback3, useEffect as useEffect12, useMemo as useMemo4, useRef as useRef9, useState as useState8 } from "react";
|
|
4789
4864
|
var DEFAULT_CONCURRENCY = 3;
|
|
4790
4865
|
var TELESCUP_UPLOAD_MODE = getRuntimeEnvOr("VITE_TELESCUP_UPLOAD_MODE", "standard").trim().toLowerCase();
|
|
4791
4866
|
var makeId = () => Math.random().toString(36).slice(2, 10);
|
|
@@ -4841,9 +4916,9 @@ function useTelescupUploadQueue(options) {
|
|
|
4841
4916
|
onItemError
|
|
4842
4917
|
} = options;
|
|
4843
4918
|
const [queue, setQueue] = useState8([]);
|
|
4844
|
-
const queueRef =
|
|
4845
|
-
const activeRef =
|
|
4846
|
-
|
|
4919
|
+
const queueRef = useRef9(queue);
|
|
4920
|
+
const activeRef = useRef9(0);
|
|
4921
|
+
useEffect12(() => {
|
|
4847
4922
|
queueRef.current = queue;
|
|
4848
4923
|
}, [queue]);
|
|
4849
4924
|
const enqueueFiles = useCallback3(
|
|
@@ -4972,7 +5047,7 @@ function useTelescupUploadQueue(options) {
|
|
|
4972
5047
|
};
|
|
4973
5048
|
void run();
|
|
4974
5049
|
}, [client, conflictPolicy, concurrency, folderId, onItemComplete, onItemError, updateItem]);
|
|
4975
|
-
|
|
5050
|
+
useEffect12(() => {
|
|
4976
5051
|
processQueue();
|
|
4977
5052
|
}, [processQueue, queue]);
|
|
4978
5053
|
const removeItem = useCallback3((id) => {
|
|
@@ -5050,7 +5125,7 @@ var TelescupUploader = ({
|
|
|
5050
5125
|
onAssetUploaded
|
|
5051
5126
|
}) => {
|
|
5052
5127
|
var _a65;
|
|
5053
|
-
const inputRef =
|
|
5128
|
+
const inputRef = useRef10(null);
|
|
5054
5129
|
const [dragActive, setDragActive] = useState9(false);
|
|
5055
5130
|
const {
|
|
5056
5131
|
queue,
|
|
@@ -5432,7 +5507,7 @@ var TelescupMetaEditor = ({
|
|
|
5432
5507
|
const [drafts, setDrafts] = useState10({});
|
|
5433
5508
|
const [saving, setSaving] = useState10(false);
|
|
5434
5509
|
const [aiLoading, setAiLoading] = useState10(false);
|
|
5435
|
-
|
|
5510
|
+
useEffect13(() => {
|
|
5436
5511
|
if (!assets.length) {
|
|
5437
5512
|
setActiveAssetId("");
|
|
5438
5513
|
return;
|
|
@@ -5660,7 +5735,7 @@ var TelescupUpload = ({
|
|
|
5660
5735
|
const [stagedSelection, setStagedSelection] = useState10(null);
|
|
5661
5736
|
const [assetRevision, setAssetRevision] = useState10(0);
|
|
5662
5737
|
const assetMapRef = React27.useRef(/* @__PURE__ */ new Map());
|
|
5663
|
-
|
|
5738
|
+
useEffect13(() => {
|
|
5664
5739
|
if (value) {
|
|
5665
5740
|
setInternalSelection(value);
|
|
5666
5741
|
}
|
|
@@ -5709,7 +5784,7 @@ var TelescupUpload = ({
|
|
|
5709
5784
|
if (!isControlled) setInternalOpen(false);
|
|
5710
5785
|
onClose == null ? void 0 : onClose();
|
|
5711
5786
|
}, [isControlled, onClose]);
|
|
5712
|
-
|
|
5787
|
+
useEffect13(() => {
|
|
5713
5788
|
if (isOpen) return;
|
|
5714
5789
|
setStagedSelection(null);
|
|
5715
5790
|
}, [isOpen]);
|
|
@@ -6339,21 +6414,13 @@ var extractSharedFilesFromMessages = (messages) => {
|
|
|
6339
6414
|
};
|
|
6340
6415
|
var resolveTelescupImageUrl = (value, options) => {
|
|
6341
6416
|
var _a65, _b5, _c;
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
if (parsedId2) {
|
|
6350
|
-
return buildTelescupImageURL({ id: parsedId2, width, height, fit: "cover", format: "avif", quality });
|
|
6351
|
-
}
|
|
6352
|
-
return raw;
|
|
6353
|
-
}
|
|
6354
|
-
const parsedId = parseAssetId(raw);
|
|
6355
|
-
if (!parsedId) return void 0;
|
|
6356
|
-
return buildTelescupImageURL({ id: parsedId, width, height, fit: "cover", format: "avif", quality });
|
|
6417
|
+
return resolveTelescupImageURL(value, {
|
|
6418
|
+
width: (_a65 = options == null ? void 0 : options.width) != null ? _a65 : 96,
|
|
6419
|
+
height: (_b5 = options == null ? void 0 : options.height) != null ? _b5 : 96,
|
|
6420
|
+
fit: "cover",
|
|
6421
|
+
format: "avif",
|
|
6422
|
+
quality: (_c = options == null ? void 0 : options.quality) != null ? _c : 72
|
|
6423
|
+
});
|
|
6357
6424
|
};
|
|
6358
6425
|
var resolveGroupAvatarFromTelescup = (asset, fallbackId) => {
|
|
6359
6426
|
var _a65, _b5;
|
|
@@ -6555,21 +6622,21 @@ var UserMenuCupcode = ({
|
|
|
6555
6622
|
const [pendingLatestMessagesCount, setPendingLatestMessagesCount] = useState11(0);
|
|
6556
6623
|
const [activeReactionPicker, setActiveReactionPicker] = useState11(null);
|
|
6557
6624
|
const [internalStatus, setInternalStatus] = useState11(defaultStatus);
|
|
6558
|
-
const emojiPickerRef =
|
|
6559
|
-
const reactionPickerRef =
|
|
6560
|
-
const chatMessagesPaneRef =
|
|
6561
|
-
const pendingReadRequestsRef =
|
|
6562
|
-
const seenIncomingMessageIdsRef =
|
|
6563
|
-
const hasBootstrappedIncomingMessagesRef =
|
|
6564
|
-
const wasFocusModeActiveRef =
|
|
6565
|
-
const previousChatUnreadCountRef =
|
|
6566
|
-
const chatIndicatorHideTimeoutRef =
|
|
6567
|
-
const chatIndicatorIntroTimeoutRef =
|
|
6568
|
-
const chatBadgePulseTimeoutRef =
|
|
6569
|
-
const activeConversationIdRef =
|
|
6570
|
-
const activeConversationMessageIdsRef =
|
|
6571
|
-
const shouldAutoScrollToBottomRef =
|
|
6572
|
-
const autoScrollArmTimeoutRef =
|
|
6625
|
+
const emojiPickerRef = useRef11(null);
|
|
6626
|
+
const reactionPickerRef = useRef11(null);
|
|
6627
|
+
const chatMessagesPaneRef = useRef11(null);
|
|
6628
|
+
const pendingReadRequestsRef = useRef11(/* @__PURE__ */ new Set());
|
|
6629
|
+
const seenIncomingMessageIdsRef = useRef11(/* @__PURE__ */ new Set());
|
|
6630
|
+
const hasBootstrappedIncomingMessagesRef = useRef11(false);
|
|
6631
|
+
const wasFocusModeActiveRef = useRef11(false);
|
|
6632
|
+
const previousChatUnreadCountRef = useRef11(0);
|
|
6633
|
+
const chatIndicatorHideTimeoutRef = useRef11(null);
|
|
6634
|
+
const chatIndicatorIntroTimeoutRef = useRef11(null);
|
|
6635
|
+
const chatBadgePulseTimeoutRef = useRef11(null);
|
|
6636
|
+
const activeConversationIdRef = useRef11(null);
|
|
6637
|
+
const activeConversationMessageIdsRef = useRef11(/* @__PURE__ */ new Set());
|
|
6638
|
+
const shouldAutoScrollToBottomRef = useRef11(false);
|
|
6639
|
+
const autoScrollArmTimeoutRef = useRef11(null);
|
|
6573
6640
|
const isChatMessagesControlled = typeof chatMessages !== "undefined";
|
|
6574
6641
|
const isChatReactionsControlled = typeof chatReactions !== "undefined";
|
|
6575
6642
|
const initials = useMemo7(() => buildInitials(displayName, email), [displayName, email]);
|
|
@@ -6808,7 +6875,7 @@ var UserMenuCupcode = ({
|
|
|
6808
6875
|
});
|
|
6809
6876
|
return unreadByUser;
|
|
6810
6877
|
}, [conversationMetaByUserId]);
|
|
6811
|
-
|
|
6878
|
+
useEffect14(() => {
|
|
6812
6879
|
if (!normalizedNotificationFeed.length) return;
|
|
6813
6880
|
setNotificationReadMap((current) => {
|
|
6814
6881
|
let changed = false;
|
|
@@ -6955,37 +7022,37 @@ var UserMenuCupcode = ({
|
|
|
6955
7022
|
});
|
|
6956
7023
|
return normalized;
|
|
6957
7024
|
}, [resolvedAllChatReactions, resolvedCurrentChatUserId]);
|
|
6958
|
-
|
|
7025
|
+
useEffect14(() => {
|
|
6959
7026
|
if (!isChatMessagesControlled) return;
|
|
6960
7027
|
setInternalChatMessages(chatMessages != null ? chatMessages : []);
|
|
6961
7028
|
}, [chatMessages, isChatMessagesControlled]);
|
|
6962
|
-
|
|
7029
|
+
useEffect14(() => {
|
|
6963
7030
|
if (!isChatReactionsControlled) return;
|
|
6964
7031
|
setInternalChatReactions(chatReactions != null ? chatReactions : []);
|
|
6965
7032
|
}, [chatReactions, isChatReactionsControlled]);
|
|
6966
|
-
|
|
7033
|
+
useEffect14(() => {
|
|
6967
7034
|
setProfileAvatarUrl(avatarUrl);
|
|
6968
7035
|
}, [avatarUrl]);
|
|
6969
|
-
|
|
7036
|
+
useEffect14(() => {
|
|
6970
7037
|
if (!isLanguageControlled) return;
|
|
6971
7038
|
setInternalLanguage(normalizeLanguage(language));
|
|
6972
7039
|
}, [isLanguageControlled, language]);
|
|
6973
|
-
|
|
7040
|
+
useEffect14(() => {
|
|
6974
7041
|
persistChatSettings(chatSettings);
|
|
6975
7042
|
}, [chatSettings]);
|
|
6976
|
-
|
|
7043
|
+
useEffect14(() => {
|
|
6977
7044
|
persistExperienceSettings(experienceSettings);
|
|
6978
7045
|
}, [experienceSettings]);
|
|
6979
|
-
|
|
7046
|
+
useEffect14(() => {
|
|
6980
7047
|
persistIntegrationConnections(integrationConnections);
|
|
6981
7048
|
}, [integrationConnections]);
|
|
6982
|
-
|
|
7049
|
+
useEffect14(() => {
|
|
6983
7050
|
applyThemePreference(experienceSettings.theme);
|
|
6984
7051
|
}, [experienceSettings.theme]);
|
|
6985
|
-
|
|
7052
|
+
useEffect14(() => {
|
|
6986
7053
|
applyAccessibilityAttributes(experienceSettings);
|
|
6987
7054
|
}, [experienceSettings]);
|
|
6988
|
-
|
|
7055
|
+
useEffect14(() => {
|
|
6989
7056
|
if (experienceSettings.theme !== "system" || typeof window === "undefined") return;
|
|
6990
7057
|
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
6991
7058
|
const onSystemThemeChange = () => applyThemePreference("system");
|
|
@@ -6996,13 +7063,13 @@ var UserMenuCupcode = ({
|
|
|
6996
7063
|
media.addListener(onSystemThemeChange);
|
|
6997
7064
|
return () => media.removeListener(onSystemThemeChange);
|
|
6998
7065
|
}, [experienceSettings.theme]);
|
|
6999
|
-
|
|
7066
|
+
useEffect14(() => {
|
|
7000
7067
|
persistNotificationPreferences(notificationPreferences);
|
|
7001
7068
|
}, [notificationPreferences]);
|
|
7002
|
-
|
|
7069
|
+
useEffect14(() => {
|
|
7003
7070
|
setNotificationPermission(resolveNotificationPermission());
|
|
7004
7071
|
}, []);
|
|
7005
|
-
|
|
7072
|
+
useEffect14(() => {
|
|
7006
7073
|
if (typeof window === "undefined") return;
|
|
7007
7074
|
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
7008
7075
|
const syncPreference = () => setPrefersReducedMotion(mediaQuery.matches);
|
|
@@ -7014,7 +7081,7 @@ var UserMenuCupcode = ({
|
|
|
7014
7081
|
mediaQuery.addListener(syncPreference);
|
|
7015
7082
|
return () => mediaQuery.removeListener(syncPreference);
|
|
7016
7083
|
}, []);
|
|
7017
|
-
|
|
7084
|
+
useEffect14(() => {
|
|
7018
7085
|
const previousCount = previousChatUnreadCountRef.current;
|
|
7019
7086
|
const nextCount = visibleChatUnreadCount;
|
|
7020
7087
|
const hadUnread = previousCount > 0;
|
|
@@ -7064,7 +7131,7 @@ var UserMenuCupcode = ({
|
|
|
7064
7131
|
}
|
|
7065
7132
|
previousChatUnreadCountRef.current = nextCount;
|
|
7066
7133
|
}, [prefersReducedMotion, visibleChatUnreadCount]);
|
|
7067
|
-
|
|
7134
|
+
useEffect14(() => {
|
|
7068
7135
|
return () => {
|
|
7069
7136
|
if (chatIndicatorHideTimeoutRef.current) window.clearTimeout(chatIndicatorHideTimeoutRef.current);
|
|
7070
7137
|
if (chatIndicatorIntroTimeoutRef.current) window.clearTimeout(chatIndicatorIntroTimeoutRef.current);
|
|
@@ -7072,7 +7139,7 @@ var UserMenuCupcode = ({
|
|
|
7072
7139
|
if (autoScrollArmTimeoutRef.current) window.clearTimeout(autoScrollArmTimeoutRef.current);
|
|
7073
7140
|
};
|
|
7074
7141
|
}, []);
|
|
7075
|
-
|
|
7142
|
+
useEffect14(() => {
|
|
7076
7143
|
if (!isAuthenticated) {
|
|
7077
7144
|
seenIncomingMessageIdsRef.current.clear();
|
|
7078
7145
|
hasBootstrappedIncomingMessagesRef.current = false;
|
|
@@ -7106,15 +7173,15 @@ var UserMenuCupcode = ({
|
|
|
7106
7173
|
}
|
|
7107
7174
|
}
|
|
7108
7175
|
}, [isAuthenticated]);
|
|
7109
|
-
|
|
7176
|
+
useEffect14(() => {
|
|
7110
7177
|
if (activeTab === "notifications") return;
|
|
7111
7178
|
if (!isNotificationsPreferencesBackVisible) return;
|
|
7112
7179
|
setIsNotificationsPreferencesBackVisible(false);
|
|
7113
7180
|
}, [activeTab, isNotificationsPreferencesBackVisible]);
|
|
7114
|
-
|
|
7181
|
+
useEffect14(() => {
|
|
7115
7182
|
setIsNotificationsExpanded(false);
|
|
7116
7183
|
}, [activeTab, notificationReadFilter, notificationTypeFilter, notificationPreferences.grouping]);
|
|
7117
|
-
|
|
7184
|
+
useEffect14(() => {
|
|
7118
7185
|
if (!notificationPreferences.focusUntil) return;
|
|
7119
7186
|
const deadline = new Date(notificationPreferences.focusUntil).getTime();
|
|
7120
7187
|
if (Number.isNaN(deadline) || deadline <= Date.now()) {
|
|
@@ -7128,7 +7195,7 @@ var UserMenuCupcode = ({
|
|
|
7128
7195
|
window.clearTimeout(timer);
|
|
7129
7196
|
};
|
|
7130
7197
|
}, [notificationPreferences.focusUntil]);
|
|
7131
|
-
|
|
7198
|
+
useEffect14(() => {
|
|
7132
7199
|
const wasFocusModeActive = wasFocusModeActiveRef.current;
|
|
7133
7200
|
if (wasFocusModeActive && !isFocusModeActive && suppressedFocusNotifications.length) {
|
|
7134
7201
|
const byType = suppressedFocusNotifications.reduce((acc, notification) => {
|
|
@@ -7158,7 +7225,7 @@ var UserMenuCupcode = ({
|
|
|
7158
7225
|
}
|
|
7159
7226
|
wasFocusModeActiveRef.current = isFocusModeActive;
|
|
7160
7227
|
}, [isFocusModeActive, suppressedFocusNotifications]);
|
|
7161
|
-
|
|
7228
|
+
useEffect14(() => {
|
|
7162
7229
|
if (!chatUsersList.length) {
|
|
7163
7230
|
setActiveChatUserId("");
|
|
7164
7231
|
return;
|
|
@@ -7169,18 +7236,18 @@ var UserMenuCupcode = ({
|
|
|
7169
7236
|
return (_b5 = (_a66 = filteredAndSortedChatUsers[0]) == null ? void 0 : _a66.id) != null ? _b5 : chatUsersList[0].id;
|
|
7170
7237
|
});
|
|
7171
7238
|
}, [chatUsersList, filteredAndSortedChatUsers]);
|
|
7172
|
-
|
|
7239
|
+
useEffect14(() => {
|
|
7173
7240
|
if (activeTab === "chat" && open) return;
|
|
7174
7241
|
setIsChatSidebarExpanded(false);
|
|
7175
7242
|
setIsChatSidebarPinned(false);
|
|
7176
7243
|
}, [activeTab, open]);
|
|
7177
|
-
|
|
7244
|
+
useEffect14(() => {
|
|
7178
7245
|
if (!(chatOpenRequest == null ? void 0 : chatOpenRequest.userId)) return;
|
|
7179
7246
|
setOpen(true);
|
|
7180
7247
|
setActiveTab("chat");
|
|
7181
7248
|
setActiveChatUserId(chatOpenRequest.userId);
|
|
7182
7249
|
}, [chatOpenRequest == null ? void 0 : chatOpenRequest.at, chatOpenRequest == null ? void 0 : chatOpenRequest.userId]);
|
|
7183
|
-
|
|
7250
|
+
useEffect14(() => {
|
|
7184
7251
|
if (!showEmojiPicker && !activeReactionPickerMessageId) return;
|
|
7185
7252
|
const onPointerDown = (event) => {
|
|
7186
7253
|
const target = event.target;
|
|
@@ -7197,7 +7264,7 @@ var UserMenuCupcode = ({
|
|
|
7197
7264
|
document.removeEventListener("mousedown", onPointerDown);
|
|
7198
7265
|
};
|
|
7199
7266
|
}, [activeReactionPickerMessageId, showEmojiPicker]);
|
|
7200
|
-
|
|
7267
|
+
useEffect14(() => {
|
|
7201
7268
|
if (!activeReactionPickerMessageId) return;
|
|
7202
7269
|
const closePicker = () => setActiveReactionPicker(null);
|
|
7203
7270
|
window.addEventListener("resize", closePicker);
|
|
@@ -7207,7 +7274,7 @@ var UserMenuCupcode = ({
|
|
|
7207
7274
|
document.removeEventListener("scroll", closePicker, true);
|
|
7208
7275
|
};
|
|
7209
7276
|
}, [activeReactionPickerMessageId]);
|
|
7210
|
-
|
|
7277
|
+
useEffect14(() => {
|
|
7211
7278
|
var _a66;
|
|
7212
7279
|
if (!hasBootstrappedIncomingMessagesRef.current && isChatLoading) return;
|
|
7213
7280
|
const knownIncomingIds = seenIncomingMessageIdsRef.current;
|
|
@@ -7378,7 +7445,7 @@ var UserMenuCupcode = ({
|
|
|
7378
7445
|
});
|
|
7379
7446
|
return items;
|
|
7380
7447
|
}, [activeChatMessages]);
|
|
7381
|
-
|
|
7448
|
+
useEffect14(() => {
|
|
7382
7449
|
var _a66;
|
|
7383
7450
|
const conversationId = (_a66 = activeChatUser == null ? void 0 : activeChatUser.id) != null ? _a66 : null;
|
|
7384
7451
|
if (!conversationId) {
|
|
@@ -7437,31 +7504,31 @@ var UserMenuCupcode = ({
|
|
|
7437
7504
|
if (!replyToMessageId) return null;
|
|
7438
7505
|
return (_a66 = activeChatMessagesMap.get(replyToMessageId)) != null ? _a66 : null;
|
|
7439
7506
|
}, [activeChatMessagesMap, replyToMessageId]);
|
|
7440
|
-
|
|
7507
|
+
useEffect14(() => {
|
|
7441
7508
|
if (!replyToMessageId) return;
|
|
7442
7509
|
if (!activeChatMessagesMap.has(replyToMessageId)) {
|
|
7443
7510
|
setReplyToMessageId(null);
|
|
7444
7511
|
}
|
|
7445
7512
|
}, [activeChatMessagesMap, replyToMessageId]);
|
|
7446
|
-
|
|
7513
|
+
useEffect14(() => {
|
|
7447
7514
|
if (!activeReactionPickerMessageId) return;
|
|
7448
7515
|
if (!activeChatMessagesMap.has(activeReactionPickerMessageId)) {
|
|
7449
7516
|
setActiveReactionPicker(null);
|
|
7450
7517
|
}
|
|
7451
7518
|
}, [activeChatMessagesMap, activeReactionPickerMessageId]);
|
|
7452
|
-
|
|
7519
|
+
useEffect14(() => {
|
|
7453
7520
|
if (!editingMessageId) return;
|
|
7454
7521
|
if (!activeChatMessagesMap.has(editingMessageId)) {
|
|
7455
7522
|
setEditingMessageId(null);
|
|
7456
7523
|
setEditingDraft("");
|
|
7457
7524
|
}
|
|
7458
7525
|
}, [activeChatMessagesMap, editingMessageId]);
|
|
7459
|
-
|
|
7526
|
+
useEffect14(() => {
|
|
7460
7527
|
if (!activeChatUser) {
|
|
7461
7528
|
setIsChatLogsDialogOpen(false);
|
|
7462
7529
|
}
|
|
7463
7530
|
}, [activeChatUser]);
|
|
7464
|
-
|
|
7531
|
+
useEffect14(() => {
|
|
7465
7532
|
var _a66;
|
|
7466
7533
|
if (!open || activeTab !== "chat" || !activeChatUser || activeChatUser.isGroup) return;
|
|
7467
7534
|
const unreadCount = (_a66 = resolvedChatUnreadByUser[activeChatUser.id]) != null ? _a66 : 0;
|
|
@@ -8158,7 +8225,7 @@ var UserMenuCupcode = ({
|
|
|
8158
8225
|
!hasTelescupAvatarSupport ? /* @__PURE__ */ jsx42("p", { className: "text-center text-xs text-muted-foreground", children: "Telescup indispon\xEDvel neste ambiente." }) : null
|
|
8159
8226
|
] }),
|
|
8160
8227
|
/* @__PURE__ */ jsxs27(DialogPrimitive3.Close, { className: "absolute right-3 top-3 inline-flex h-8 w-8 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-all hover:bg-background hover:text-foreground", children: [
|
|
8161
|
-
/* @__PURE__ */ jsx42(
|
|
8228
|
+
/* @__PURE__ */ jsx42(X4, { className: "h-4 w-4" }),
|
|
8162
8229
|
/* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Fechar" })
|
|
8163
8230
|
] })
|
|
8164
8231
|
] })
|
|
@@ -8373,7 +8440,7 @@ var UserMenuCupcode = ({
|
|
|
8373
8440
|
onClick: () => setIsNotificationsPreferencesBackVisible(false),
|
|
8374
8441
|
className: "inline-flex h-7 items-center gap-1 rounded-md border border-border/70 px-2 text-xs font-semibold text-foreground transition-all hover:bg-muted/45",
|
|
8375
8442
|
children: [
|
|
8376
|
-
/* @__PURE__ */ jsx42(
|
|
8443
|
+
/* @__PURE__ */ jsx42(X4, { className: "h-3 w-3" }),
|
|
8377
8444
|
"Voltar"
|
|
8378
8445
|
]
|
|
8379
8446
|
}
|
|
@@ -9063,7 +9130,7 @@ var UserMenuCupcode = ({
|
|
|
9063
9130
|
onClick: () => setReplyToMessageId(null),
|
|
9064
9131
|
className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-md border border-transparent text-muted-foreground transition-all hover:border-border/70 hover:bg-background/45 hover:text-foreground",
|
|
9065
9132
|
"aria-label": "Cancelar resposta",
|
|
9066
|
-
children: /* @__PURE__ */ jsx42(
|
|
9133
|
+
children: /* @__PURE__ */ jsx42(X4, { className: "h-3 w-3" })
|
|
9067
9134
|
}
|
|
9068
9135
|
)
|
|
9069
9136
|
] }) : null,
|
|
@@ -9777,7 +9844,7 @@ var UserMenuCupcode = ({
|
|
|
9777
9844
|
type: "button",
|
|
9778
9845
|
onClick: () => openChatPanel(),
|
|
9779
9846
|
className: cn(
|
|
9780
|
-
"relative z-0 inline-flex h-9 min-w-[2.55rem] origin-right items-center justify-center rounded-[12px] border border-border/70 bg-background/80 px-2.5 text-foreground shadow-[0_10px_22px_-18px_rgba(0,0,0,0.75)] transition-[transform,opacity] duration
|
|
9847
|
+
"relative z-0 inline-flex h-9 min-w-[2.55rem] origin-right items-center justify-center rounded-[12px] border border-border/70 bg-background/80 px-2.5 text-foreground shadow-[0_10px_22px_-18px_rgba(0,0,0,0.75)] transition-[transform,opacity] [transition-duration:260ms] will-change-transform",
|
|
9781
9848
|
prefersReducedMotion ? isChatIndicatorVisible ? "opacity-100" : "opacity-0" : isChatIndicatorVisible ? "translate-x-0 opacity-100" : "translate-x-[10px] opacity-0"
|
|
9782
9849
|
),
|
|
9783
9850
|
style: {
|
|
@@ -9790,7 +9857,7 @@ var UserMenuCupcode = ({
|
|
|
9790
9857
|
"span",
|
|
9791
9858
|
{
|
|
9792
9859
|
className: cn(
|
|
9793
|
-
"relative inline-flex transition-[transform,opacity] duration
|
|
9860
|
+
"relative inline-flex transition-[transform,opacity] [transition-duration:220ms]",
|
|
9794
9861
|
prefersReducedMotion ? isChatIndicatorVisible ? "scale-100 opacity-100" : "scale-100 opacity-0" : isChatIndicatorVisible ? isChatIndicatorIntroAnimating ? "scale-[1.08] opacity-100" : "scale-100 opacity-100" : "scale-[0.84] opacity-0"
|
|
9795
9862
|
),
|
|
9796
9863
|
style: {
|
|
@@ -9803,7 +9870,7 @@ var UserMenuCupcode = ({
|
|
|
9803
9870
|
"span",
|
|
9804
9871
|
{
|
|
9805
9872
|
className: cn(
|
|
9806
|
-
"absolute -right-1 -top-1 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full border border-background bg-destructive px-1 text-[9px] font-bold text-destructive-foreground transition-[transform,opacity] duration
|
|
9873
|
+
"absolute -right-1 -top-1 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full border border-background bg-destructive px-1 text-[9px] font-bold text-destructive-foreground transition-[transform,opacity] [transition-duration:180ms]",
|
|
9807
9874
|
prefersReducedMotion ? isChatIndicatorVisible ? "scale-100 opacity-100" : "scale-100 opacity-0" : isChatIndicatorVisible ? isChatBadgePulsing ? "scale-[1.14] opacity-100" : "scale-100 opacity-100" : "scale-[0.72] opacity-0"
|
|
9808
9875
|
),
|
|
9809
9876
|
style: {
|
|
@@ -9844,7 +9911,7 @@ var UserMenuCupcode = ({
|
|
|
9844
9911
|
/* @__PURE__ */ jsx42(DialogPrimitive3.Title, { className: "sr-only", children: "Menu do usu\xE1rio" }),
|
|
9845
9912
|
/* @__PURE__ */ jsx42(DialogPrimitive3.Description, { className: "sr-only", children: "Painel lateral com perfil, notifica\xE7\xF5es, chat e configura\xE7\xF5es." }),
|
|
9846
9913
|
/* @__PURE__ */ jsxs27(DialogPrimitive3.Close, { className: "absolute right-3 top-3 z-10 flex h-10 w-10 items-center justify-center rounded-full border border-border/70 bg-background/40 text-foreground transition-all hover:bg-muted/60 sm:-right-[58px]", children: [
|
|
9847
|
-
/* @__PURE__ */ jsx42(
|
|
9914
|
+
/* @__PURE__ */ jsx42(X4, { className: "h-5 w-5" }),
|
|
9848
9915
|
/* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Fechar menu" })
|
|
9849
9916
|
] }),
|
|
9850
9917
|
/* @__PURE__ */ jsxs27("div", { className: "relative flex h-full flex-col p-3 sm:p-4", children: [
|
|
@@ -22166,8 +22233,22 @@ var buildHandle2 = (value, email, fallbackId) => {
|
|
|
22166
22233
|
var resolveCurrentUserId = (user) => {
|
|
22167
22234
|
const sub = toStringOrUndefined(user == null ? void 0 : user.sub);
|
|
22168
22235
|
if (sub) return sub;
|
|
22236
|
+
const id = toStringOrUndefined(user == null ? void 0 : user.id);
|
|
22237
|
+
if (id) return id;
|
|
22238
|
+
const userId = toStringOrUndefined(user == null ? void 0 : user.userId);
|
|
22239
|
+
if (userId) return userId;
|
|
22169
22240
|
return null;
|
|
22170
22241
|
};
|
|
22242
|
+
var resolveUserIdFromClaims = (claims) => {
|
|
22243
|
+
var _a65, _b5, _c, _d, _e;
|
|
22244
|
+
return (_e = (_d = (_c = (_b5 = (_a65 = toStringOrUndefined(claims.sub)) != null ? _a65 : toStringOrUndefined(claims.user_id)) != null ? _b5 : toStringOrUndefined(claims.userId)) != null ? _c : toStringOrUndefined(claims.uid)) != null ? _d : toStringOrUndefined(claims.id)) != null ? _e : toStringOrUndefined(claims["https://cupcode.com/user_id"]);
|
|
22245
|
+
};
|
|
22246
|
+
var resolveEmailFromClaims = (claims) => {
|
|
22247
|
+
var _a65, _b5;
|
|
22248
|
+
const candidate = (_b5 = (_a65 = toStringOrUndefined(claims.email)) != null ? _a65 : toStringOrUndefined(claims["https://cupcode.com/email"])) != null ? _b5 : toStringOrUndefined(claims.preferred_username);
|
|
22249
|
+
if (!candidate || !candidate.includes("@")) return void 0;
|
|
22250
|
+
return candidate.toLowerCase();
|
|
22251
|
+
};
|
|
22171
22252
|
var formatMessageTime = (rawTimestamp) => {
|
|
22172
22253
|
if (!rawTimestamp) return "";
|
|
22173
22254
|
const parsed = new Date(rawTimestamp);
|
|
@@ -22175,18 +22256,7 @@ var formatMessageTime = (rawTimestamp) => {
|
|
|
22175
22256
|
return parsed.toLocaleTimeString("pt-BR", { hour: "2-digit", minute: "2-digit" });
|
|
22176
22257
|
};
|
|
22177
22258
|
var resolveChatAvatarUrl = (value) => {
|
|
22178
|
-
|
|
22179
|
-
if (!raw) return void 0;
|
|
22180
|
-
if (raw.startsWith("http://") || raw.startsWith("https://") || raw.startsWith("data:") || raw.startsWith("blob:")) {
|
|
22181
|
-
const parsedId2 = parseAssetId(raw);
|
|
22182
|
-
if (parsedId2) {
|
|
22183
|
-
return buildTelescupImageURL({ id: parsedId2, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22184
|
-
}
|
|
22185
|
-
return raw;
|
|
22186
|
-
}
|
|
22187
|
-
const parsedId = parseAssetId(raw);
|
|
22188
|
-
if (!parsedId) return void 0;
|
|
22189
|
-
return buildTelescupImageURL({ id: parsedId, width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22259
|
+
return resolveTelescupImageURL(value, { width: 72, height: 72, fit: "cover", format: "avif", quality: 70 });
|
|
22190
22260
|
};
|
|
22191
22261
|
var isGenericRecord = (value) => typeof value === "object" && value !== null;
|
|
22192
22262
|
var buildExternalUrl = (baseUrl, target) => {
|
|
@@ -22432,7 +22502,7 @@ var MainNavbar = ({
|
|
|
22432
22502
|
ctaHref = "/login",
|
|
22433
22503
|
pathname,
|
|
22434
22504
|
onNavigate,
|
|
22435
|
-
authStatus
|
|
22505
|
+
authStatus,
|
|
22436
22506
|
authUser,
|
|
22437
22507
|
presenceStatus,
|
|
22438
22508
|
onPresenceStatusChange,
|
|
@@ -22449,12 +22519,14 @@ var MainNavbar = ({
|
|
|
22449
22519
|
const [isChatSending, setIsChatSending] = useState13(false);
|
|
22450
22520
|
const [chatError, setChatError] = useState13(null);
|
|
22451
22521
|
const [resolvedSenderId, setResolvedSenderId] = useState13(null);
|
|
22522
|
+
const [tokenDerivedUserId, setTokenDerivedUserId] = useState13(null);
|
|
22523
|
+
const [tokenDerivedEmail, setTokenDerivedEmail] = useState13(void 0);
|
|
22452
22524
|
const [persistedProfileAvatarValue, setPersistedProfileAvatarValue] = useState13(void 0);
|
|
22453
22525
|
const [accountsLanguage, setAccountsLanguage] = useState13("pt-BR");
|
|
22454
22526
|
const [accountsRecentActivity, setAccountsRecentActivity] = useState13([]);
|
|
22455
22527
|
const [isAccountsActivityLoading, setIsAccountsActivityLoading] = useState13(false);
|
|
22456
|
-
const chatMessagesRef =
|
|
22457
|
-
const chatFeatureFlagsRef =
|
|
22528
|
+
const chatMessagesRef = useRef12([]);
|
|
22529
|
+
const chatFeatureFlagsRef = useRef12(readStoredChatFeatureFlags());
|
|
22458
22530
|
const updateChatFeatureFlags = useCallback6((partial) => {
|
|
22459
22531
|
const nextFlags = {
|
|
22460
22532
|
...chatFeatureFlagsRef.current,
|
|
@@ -22468,8 +22540,17 @@ var MainNavbar = ({
|
|
|
22468
22540
|
if (typeof window !== "undefined") return window.location.pathname || "/";
|
|
22469
22541
|
return "/";
|
|
22470
22542
|
}, [pathname]);
|
|
22471
|
-
const currentUserId = useMemo8(() =>
|
|
22472
|
-
|
|
22543
|
+
const currentUserId = useMemo8(() => {
|
|
22544
|
+
var _a66;
|
|
22545
|
+
return (_a66 = resolveCurrentUserId(authUser)) != null ? _a66 : tokenDerivedUserId;
|
|
22546
|
+
}, [authUser, tokenDerivedUserId]);
|
|
22547
|
+
const authEmail = useMemo8(
|
|
22548
|
+
() => {
|
|
22549
|
+
var _a66, _b6;
|
|
22550
|
+
return (_b6 = (_a66 = toStringOrUndefined(authUser == null ? void 0 : authUser.email)) == null ? void 0 : _a66.toLowerCase()) != null ? _b6 : tokenDerivedEmail;
|
|
22551
|
+
},
|
|
22552
|
+
[authUser == null ? void 0 : authUser.email, tokenDerivedEmail]
|
|
22553
|
+
);
|
|
22473
22554
|
const isChatSuperAdmin = useMemo8(() => {
|
|
22474
22555
|
var _a66, _b6;
|
|
22475
22556
|
const roleTokens = `${(_a66 = authUser == null ? void 0 : authUser.role) != null ? _a66 : ""} ${(_b6 = authUser == null ? void 0 : authUser.jobTitle) != null ? _b6 : ""}`.toLowerCase();
|
|
@@ -22483,8 +22564,78 @@ var MainNavbar = ({
|
|
|
22483
22564
|
}, []);
|
|
22484
22565
|
const resolvedProfileAvatarUrl = (_b5 = (_a65 = resolveChatAvatarUrl(persistedProfileAvatarValue)) != null ? _a65 : authUser == null ? void 0 : authUser.picture) != null ? _b5 : void 0;
|
|
22485
22566
|
const effectiveCurrentUserId = resolvedSenderId != null ? resolvedSenderId : currentUserId;
|
|
22486
|
-
const
|
|
22487
|
-
|
|
22567
|
+
const hasStoredAccessToken = (() => {
|
|
22568
|
+
if (typeof window === "undefined") return false;
|
|
22569
|
+
try {
|
|
22570
|
+
return Boolean(sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY));
|
|
22571
|
+
} catch (e) {
|
|
22572
|
+
return false;
|
|
22573
|
+
}
|
|
22574
|
+
})();
|
|
22575
|
+
const resolvedAuthStatus = useMemo8(() => {
|
|
22576
|
+
if (authStatus) return authStatus;
|
|
22577
|
+
if ((authUser == null ? void 0 : authUser.sub) || (authUser == null ? void 0 : authUser.id) || (authUser == null ? void 0 : authUser.userId) || (authUser == null ? void 0 : authUser.email)) {
|
|
22578
|
+
return "authenticated";
|
|
22579
|
+
}
|
|
22580
|
+
if (tokenDerivedUserId || tokenDerivedEmail || hasStoredAccessToken) {
|
|
22581
|
+
return "authenticated";
|
|
22582
|
+
}
|
|
22583
|
+
return "unauthenticated";
|
|
22584
|
+
}, [
|
|
22585
|
+
authStatus,
|
|
22586
|
+
authUser == null ? void 0 : authUser.email,
|
|
22587
|
+
authUser == null ? void 0 : authUser.id,
|
|
22588
|
+
authUser == null ? void 0 : authUser.sub,
|
|
22589
|
+
authUser == null ? void 0 : authUser.userId,
|
|
22590
|
+
hasStoredAccessToken,
|
|
22591
|
+
tokenDerivedEmail,
|
|
22592
|
+
tokenDerivedUserId
|
|
22593
|
+
]);
|
|
22594
|
+
const isAuthenticated = resolvedAuthStatus === "authenticated";
|
|
22595
|
+
useEffect16(() => {
|
|
22596
|
+
if (authStatus === "unauthenticated") {
|
|
22597
|
+
setTokenDerivedUserId(null);
|
|
22598
|
+
setTokenDerivedEmail(void 0);
|
|
22599
|
+
return;
|
|
22600
|
+
}
|
|
22601
|
+
let canceled = false;
|
|
22602
|
+
const resolveIdentityFromToken = async () => {
|
|
22603
|
+
var _a66, _b6;
|
|
22604
|
+
try {
|
|
22605
|
+
let token = null;
|
|
22606
|
+
if (typeof window !== "undefined") {
|
|
22607
|
+
try {
|
|
22608
|
+
token = sessionStorage.getItem(ACCESS_TOKEN_STORAGE_KEY);
|
|
22609
|
+
} catch (e) {
|
|
22610
|
+
token = null;
|
|
22611
|
+
}
|
|
22612
|
+
}
|
|
22613
|
+
if (!token && getAccessToken) {
|
|
22614
|
+
token = await getAccessToken();
|
|
22615
|
+
}
|
|
22616
|
+
if (!token) {
|
|
22617
|
+
if (!canceled) {
|
|
22618
|
+
setTokenDerivedUserId(null);
|
|
22619
|
+
setTokenDerivedEmail(void 0);
|
|
22620
|
+
}
|
|
22621
|
+
return;
|
|
22622
|
+
}
|
|
22623
|
+
const claims = (_a66 = decodeJwt(token)) != null ? _a66 : {};
|
|
22624
|
+
if (canceled) return;
|
|
22625
|
+
setTokenDerivedUserId((_b6 = resolveUserIdFromClaims(claims)) != null ? _b6 : null);
|
|
22626
|
+
setTokenDerivedEmail(resolveEmailFromClaims(claims));
|
|
22627
|
+
} catch (error) {
|
|
22628
|
+
if (isRuntimeDev()) {
|
|
22629
|
+
console.warn("[chat] Falha ao resolver identidade via access token:", error.message);
|
|
22630
|
+
}
|
|
22631
|
+
}
|
|
22632
|
+
};
|
|
22633
|
+
void resolveIdentityFromToken();
|
|
22634
|
+
return () => {
|
|
22635
|
+
canceled = true;
|
|
22636
|
+
};
|
|
22637
|
+
}, [authStatus, getAccessToken]);
|
|
22638
|
+
useEffect16(() => {
|
|
22488
22639
|
if (!isAuthenticated) {
|
|
22489
22640
|
setResolvedSenderId(null);
|
|
22490
22641
|
setPersistedProfileAvatarValue(void 0);
|
|
@@ -22563,7 +22714,7 @@ var MainNavbar = ({
|
|
|
22563
22714
|
canceled = true;
|
|
22564
22715
|
};
|
|
22565
22716
|
}, [authEmail, currentUserId, isAuthenticated]);
|
|
22566
|
-
|
|
22717
|
+
useEffect16(() => {
|
|
22567
22718
|
if (!isAuthenticated) return;
|
|
22568
22719
|
if (typeof window === "undefined") return;
|
|
22569
22720
|
const controller = new AbortController();
|
|
@@ -22639,10 +22790,10 @@ var MainNavbar = ({
|
|
|
22639
22790
|
controller.abort();
|
|
22640
22791
|
};
|
|
22641
22792
|
}, [getAccessToken, isAuthenticated, currentUserId]);
|
|
22642
|
-
|
|
22793
|
+
useEffect16(() => {
|
|
22643
22794
|
chatMessagesRef.current = chatMessages;
|
|
22644
22795
|
}, [chatMessages]);
|
|
22645
|
-
|
|
22796
|
+
useEffect16(() => {
|
|
22646
22797
|
if (!isAuthenticated) {
|
|
22647
22798
|
setChatUsers([]);
|
|
22648
22799
|
setChatMessages([]);
|
|
@@ -23015,7 +23166,7 @@ var MainNavbar = ({
|
|
|
23015
23166
|
canceled = true;
|
|
23016
23167
|
};
|
|
23017
23168
|
}, [effectiveCurrentUserId, isAuthenticated, isChatSuperAdmin, updateChatFeatureFlags]);
|
|
23018
|
-
|
|
23169
|
+
useEffect16(() => {
|
|
23019
23170
|
if (!isAuthenticated || !effectiveCurrentUserId) return;
|
|
23020
23171
|
const supabase = getSupabase();
|
|
23021
23172
|
if (!supabase) return;
|
|
@@ -23844,8 +23995,8 @@ var MainNavbar = ({
|
|
|
23844
23995
|
actions: /* @__PURE__ */ jsx45("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx45(
|
|
23845
23996
|
UserMenuCupcode,
|
|
23846
23997
|
{
|
|
23847
|
-
isAuthenticated:
|
|
23848
|
-
isLoading:
|
|
23998
|
+
isAuthenticated: resolvedAuthStatus === "authenticated",
|
|
23999
|
+
isLoading: resolvedAuthStatus === "loading",
|
|
23849
24000
|
loginLabel: ctaLabel,
|
|
23850
24001
|
displayName: authUser == null ? void 0 : authUser.name,
|
|
23851
24002
|
username: (_c = authUser == null ? void 0 : authUser.preferredUsername) != null ? _c : authUser == null ? void 0 : authUser.nickname,
|
|
@@ -23894,15 +24045,15 @@ var MainNavbar = ({
|
|
|
23894
24045
|
};
|
|
23895
24046
|
|
|
23896
24047
|
// src/components/cupcode/ParticleSystem.tsx
|
|
23897
|
-
import { useEffect as
|
|
24048
|
+
import { useEffect as useEffect17, useRef as useRef13 } from "react";
|
|
23898
24049
|
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
23899
24050
|
function ParticleSystem({
|
|
23900
24051
|
count: count2 = 50,
|
|
23901
24052
|
variant = "stars",
|
|
23902
24053
|
className
|
|
23903
24054
|
}) {
|
|
23904
|
-
const canvasRef =
|
|
23905
|
-
|
|
24055
|
+
const canvasRef = useRef13(null);
|
|
24056
|
+
useEffect17(() => {
|
|
23906
24057
|
const canvas = canvasRef.current;
|
|
23907
24058
|
if (!canvas) return;
|
|
23908
24059
|
const ctx = canvas.getContext("2d");
|
|
@@ -24549,7 +24700,7 @@ function Timeline({ items, variant = "vertical", className }) {
|
|
|
24549
24700
|
}
|
|
24550
24701
|
|
|
24551
24702
|
// src/components/cupcode/ToastCupcode.tsx
|
|
24552
|
-
import { X as
|
|
24703
|
+
import { X as X5, CheckCircle, AlertCircle, Info as Info2, AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
24553
24704
|
import { jsx as jsx56, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
24554
24705
|
var variantStyles2 = {
|
|
24555
24706
|
success: {
|
|
@@ -24608,7 +24759,7 @@ var ToastCupcode = ({
|
|
|
24608
24759
|
{
|
|
24609
24760
|
onClick: onClose,
|
|
24610
24761
|
className: "shrink-0 rounded-md p-1 hover:bg-cupcode-ink/10 transition-colors",
|
|
24611
|
-
children: /* @__PURE__ */ jsx56(
|
|
24762
|
+
children: /* @__PURE__ */ jsx56(X5, { className: "h-4 w-4 text-cupcode-ink/50" })
|
|
24612
24763
|
}
|
|
24613
24764
|
)
|
|
24614
24765
|
] })
|
|
@@ -25986,7 +26137,7 @@ Separator5.displayName = SeparatorPrimitive.Root.displayName;
|
|
|
25986
26137
|
// src/components/ui/sheet.tsx
|
|
25987
26138
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
25988
26139
|
import { cva as cva6 } from "class-variance-authority";
|
|
25989
|
-
import { X as
|
|
26140
|
+
import { X as X6 } from "lucide-react";
|
|
25990
26141
|
import * as React56 from "react";
|
|
25991
26142
|
import { jsx as jsx79, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
25992
26143
|
var Sheet = SheetPrimitive.Root;
|
|
@@ -26022,14 +26173,31 @@ var sheetVariants = cva6(
|
|
|
26022
26173
|
}
|
|
26023
26174
|
);
|
|
26024
26175
|
var SheetContent = React56.forwardRef(
|
|
26025
|
-
({
|
|
26176
|
+
({
|
|
26177
|
+
side = "right",
|
|
26178
|
+
className,
|
|
26179
|
+
children,
|
|
26180
|
+
showCloseButton = false,
|
|
26181
|
+
closeButtonClassName,
|
|
26182
|
+
closeButtonLabel = "Close",
|
|
26183
|
+
...props
|
|
26184
|
+
}, ref) => /* @__PURE__ */ jsxs47(SheetPortal, { children: [
|
|
26026
26185
|
/* @__PURE__ */ jsx79(SheetOverlay, {}),
|
|
26027
26186
|
/* @__PURE__ */ jsxs47(SheetPrimitive.Content, { ref, className: cn(sheetVariants({ side }), className), ...props, children: [
|
|
26028
26187
|
children,
|
|
26029
|
-
/* @__PURE__ */ jsxs47(
|
|
26030
|
-
|
|
26031
|
-
|
|
26032
|
-
|
|
26188
|
+
showCloseButton ? /* @__PURE__ */ jsxs47(
|
|
26189
|
+
SheetPrimitive.Close,
|
|
26190
|
+
{
|
|
26191
|
+
className: cn(
|
|
26192
|
+
"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",
|
|
26193
|
+
closeButtonClassName
|
|
26194
|
+
),
|
|
26195
|
+
children: [
|
|
26196
|
+
/* @__PURE__ */ jsx79(X6, { className: "h-4 w-4" }),
|
|
26197
|
+
/* @__PURE__ */ jsx79("span", { className: "sr-only", children: closeButtonLabel })
|
|
26198
|
+
]
|
|
26199
|
+
}
|
|
26200
|
+
) : null
|
|
26033
26201
|
] })
|
|
26034
26202
|
] })
|
|
26035
26203
|
);
|
|
@@ -26160,7 +26328,7 @@ var Sidebar = React58.forwardRef(({ side = "left", variant = "sidebar", collapsi
|
|
|
26160
26328
|
{
|
|
26161
26329
|
"data-sidebar": "sidebar",
|
|
26162
26330
|
"data-mobile": "true",
|
|
26163
|
-
className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground
|
|
26331
|
+
className: "w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground",
|
|
26164
26332
|
style: {
|
|
26165
26333
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
26166
26334
|
},
|
|
@@ -26632,7 +26800,7 @@ TableCaption.displayName = "TableCaption";
|
|
|
26632
26800
|
import * as React61 from "react";
|
|
26633
26801
|
import * as ToastPrimitives from "@radix-ui/react-toast";
|
|
26634
26802
|
import { cva as cva8 } from "class-variance-authority";
|
|
26635
|
-
import { X as
|
|
26803
|
+
import { X as X7 } from "lucide-react";
|
|
26636
26804
|
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
26637
26805
|
var ToastProvider = ToastPrimitives.Provider;
|
|
26638
26806
|
var ToastViewport = React61.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx83(
|
|
@@ -26691,7 +26859,7 @@ var ToastClose = React61.forwardRef(({ className, onClick, ...props }, ref) => /
|
|
|
26691
26859
|
},
|
|
26692
26860
|
"toast-close": "",
|
|
26693
26861
|
...props,
|
|
26694
|
-
children: /* @__PURE__ */ jsx83(
|
|
26862
|
+
children: /* @__PURE__ */ jsx83(X7, { className: "h-4 w-4" })
|
|
26695
26863
|
}
|
|
26696
26864
|
));
|
|
26697
26865
|
ToastClose.displayName = ToastPrimitives.Close.displayName;
|
|
@@ -26778,11 +26946,11 @@ var ToggleGroupItem = React63.forwardRef(({ className, children, variant, size,
|
|
|
26778
26946
|
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
26779
26947
|
|
|
26780
26948
|
// src/hooks/useActiveSection.ts
|
|
26781
|
-
import { useEffect as
|
|
26949
|
+
import { useEffect as useEffect23, useState as useState18 } from "react";
|
|
26782
26950
|
var useActiveSection = (sectionIds, offset = 180) => {
|
|
26783
26951
|
var _a65;
|
|
26784
26952
|
const [activeId, setActiveId] = useState18((_a65 = sectionIds[0]) != null ? _a65 : "");
|
|
26785
|
-
|
|
26953
|
+
useEffect23(() => {
|
|
26786
26954
|
if (!sectionIds.length || typeof window === "undefined") return;
|
|
26787
26955
|
const update = () => {
|
|
26788
26956
|
let nextActive = sectionIds[0];
|
|
@@ -26809,7 +26977,7 @@ var useActiveSection = (sectionIds, offset = 180) => {
|
|
|
26809
26977
|
};
|
|
26810
26978
|
|
|
26811
26979
|
// src/lib/auth.tsx
|
|
26812
|
-
import { createContext as createContext6, useCallback as useCallback9, useContext as useContext7, useEffect as
|
|
26980
|
+
import { createContext as createContext6, useCallback as useCallback9, useContext as useContext7, useEffect as useEffect24, useMemo as useMemo11, useRef as useRef14, useState as useState19 } from "react";
|
|
26813
26981
|
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
26814
26982
|
var STORAGE_KEYS = {
|
|
26815
26983
|
accessToken: "cc_access_token",
|
|
@@ -26912,13 +27080,13 @@ var AuthProvider = ({ children }) => {
|
|
|
26912
27080
|
const [accessToken, setAccessToken] = useState19(null);
|
|
26913
27081
|
const [user, setUser] = useState19(null);
|
|
26914
27082
|
const [presenceStatus, setPresenceStatusState] = useState19(() => readStoredPresence());
|
|
26915
|
-
const presenceStatusRef =
|
|
26916
|
-
const presenceSourceRef =
|
|
26917
|
-
const lastManualPresenceRef =
|
|
27083
|
+
const presenceStatusRef = useRef14(readStoredPresence());
|
|
27084
|
+
const presenceSourceRef = useRef14(readStoredPresenceSource());
|
|
27085
|
+
const lastManualPresenceRef = useRef14(
|
|
26918
27086
|
readStoredPresence() === "offline" ? DEFAULT_PRESENCE_STATUS : readStoredPresence()
|
|
26919
27087
|
);
|
|
26920
|
-
const lastActivityAtRef =
|
|
26921
|
-
const lastActivityBroadcastAtRef =
|
|
27088
|
+
const lastActivityAtRef = useRef14(Date.now());
|
|
27089
|
+
const lastActivityBroadcastAtRef = useRef14(0);
|
|
26922
27090
|
const storePresenceStatus = useCallback9((nextStatus) => {
|
|
26923
27091
|
setPresenceStatusState(nextStatus);
|
|
26924
27092
|
presenceStatusRef.current = nextStatus;
|
|
@@ -27038,7 +27206,7 @@ var AuthProvider = ({ children }) => {
|
|
|
27038
27206
|
});
|
|
27039
27207
|
return true;
|
|
27040
27208
|
}, [startAuthorization]);
|
|
27041
|
-
|
|
27209
|
+
useEffect24(() => {
|
|
27042
27210
|
let cancelled = false;
|
|
27043
27211
|
const initializeAuth = async () => {
|
|
27044
27212
|
var _a65;
|
|
@@ -27075,11 +27243,11 @@ var AuthProvider = ({ children }) => {
|
|
|
27075
27243
|
cancelled = true;
|
|
27076
27244
|
};
|
|
27077
27245
|
}, [attemptSilentLogin]);
|
|
27078
|
-
|
|
27246
|
+
useEffect24(() => {
|
|
27079
27247
|
if (status !== "authenticated") return;
|
|
27080
27248
|
void loadPresenceFromDatabase(user);
|
|
27081
27249
|
}, [loadPresenceFromDatabase, status, user]);
|
|
27082
|
-
|
|
27250
|
+
useEffect24(() => {
|
|
27083
27251
|
var _a65;
|
|
27084
27252
|
if (status !== "authenticated") return;
|
|
27085
27253
|
const initialFromStorage = Number((_a65 = localStorage.getItem(LOCAL_STORAGE_KEYS.lastActivityAt)) != null ? _a65 : "0");
|
|
@@ -27626,6 +27794,7 @@ export {
|
|
|
27626
27794
|
parseAssetId,
|
|
27627
27795
|
reducer,
|
|
27628
27796
|
resolveOidcEndpoints,
|
|
27797
|
+
resolveTelescupImageURL,
|
|
27629
27798
|
responsiveSizeClasses,
|
|
27630
27799
|
setCupcodeRuntimeEnv,
|
|
27631
27800
|
toast2 as sonnerToast,
|