Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Refactor Capcard + security for svgs (#683)
Ameer Al Ashhabca8315b82970
diff --git a/apps/web/actions/organization/upload-organization-icon.ts b/apps/web/actions/organization/upload-organization-icon.tsindex bb313f29f..45f724505 100644--- a/apps/web/actions/organization/upload-organization-icon.ts+++ b/apps/web/actions/organization/upload-organization-icon.ts@@ -1,13 +1,15 @@"use server";+import { createS3Client, getS3Bucket } from "@/utils/s3";+import { createPresignedPost } from "@aws-sdk/s3-presigned-post";+import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { organizations } from "@cap/database/schema";-import { db } from "@cap/database";+import { serverEnv } from "@cap/env";+import DOMPurify from "dompurify";import { eq } from "drizzle-orm";+import { JSDOM } from "jsdom";import { revalidatePath } from "next/cache";-import { createS3Client, getS3Bucket } from "@/utils/s3";-import { createPresignedPost } from "@aws-sdk/s3-presigned-post";-import { serverEnv } from "@cap/env";export async function uploadOrganizationIcon(formData: FormData,@@ -53,6 +55,20 @@ export async function uploadOrganizationIcon(const fileKey = `organizations/${organizationId}/icon-${Date.now()}.${fileExtension}`;try {+ // Sanitize SVG if applicable+ let uploadFile = file;+ if (file.type === "image/svg+xml") {+ const arrayBuffer = await file.arrayBuffer();+ const svgString = Buffer.from(arrayBuffer).toString("utf-8");+ const dom = new JSDOM(svgString, { contentType: "image/svg+xml" });+ const purify = DOMPurify(dom.window);+ const sanitizedSvg = purify.sanitize(+ dom.window.document.documentElement.outerHTML,+ { USE_PROFILES: { svg: true, svgFilters: true } }+ );+ uploadFile = new File([sanitizedSvg], file.name, { type: file.type });+ }+// Get S3 clientconst [s3Client] = await createS3Client();const bucketName = await getS3Bucket();@@ -62,7 +78,7 @@ export async function uploadOrganizationIcon(Bucket: bucketName,Key: fileKey,Fields: {- "Content-Type": file.type,+ "Content-Type": uploadFile.type,},Expires: 600, // 10 minutes});diff --git a/apps/web/actions/organization/upload-space-icon.ts b/apps/web/actions/organization/upload-space-icon.tsindex 52733afab..831040667 100644--- a/apps/web/actions/organization/upload-space-icon.ts+++ b/apps/web/actions/organization/upload-space-icon.ts@@ -1,14 +1,14 @@"use server";+import { createS3Client, getS3Bucket } from "@/utils/s3";+import { DeleteObjectCommand } from "@aws-sdk/client-s3";+import { createPresignedPost } from "@aws-sdk/s3-presigned-post";+import { db } from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";import { spaces } from "@cap/database/schema";-import { db } from "@cap/database";+import { serverEnv } from "@cap/env";import { eq } from "drizzle-orm";import { revalidatePath } from "next/cache";-import { createS3Client, getS3Bucket } from "@/utils/s3";-import { createPresignedPost } from "@aws-sdk/s3-presigned-post";-import { serverEnv } from "@cap/env";-import { DeleteObjectCommand } from "@aws-sdk/client-s3";export async function uploadSpaceIcon(formData: FormData, spaceId: string) {const user = await getCurrentUser();@@ -47,6 +47,22 @@ export async function uploadSpaceIcon(formData: FormData, spaceId: string) {throw new Error("File size must be less than 2MB");}+ // Sanitize SVG if applicable+ let uploadFile = file;+ if (file.type === "image/svg+xml") {+ const arrayBuffer = await file.arrayBuffer();+ const svgString = Buffer.from(arrayBuffer).toString("utf-8");+ const dom = new (await import("jsdom")).JSDOM(svgString, {+ contentType: "image/svg+xml",+ });+ const purify = (await import("dompurify")).default(dom.window);+ const sanitizedSvg = purify.sanitize(+ dom.window.document.documentElement.outerHTML,+ { USE_PROFILES: { svg: true, svgFilters: true } }+ );+ uploadFile = new File([sanitizedSvg], file.name, { type: file.type });+ }+// Prepare new file keyconst fileExtension = file.name.split(".").pop();const fileKey = `organizations/${diff --git a/apps/web/app/(org)/dashboard/caps/Caps.tsx b/apps/web/app/(org)/dashboard/caps/Caps.tsxindex 701e8ad42..3725858f2 100644--- a/apps/web/app/(org)/dashboard/caps/Caps.tsx+++ b/apps/web/app/(org)/dashboard/caps/Caps.tsx@@ -6,7 +6,7 @@ import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useRef, useState } from "react";import { toast } from "sonner";import { useDashboardContext } from "../Contexts";-import { CapCard } from "./components/CapCard";+import { CapCard } from "./components/CapCard/CapCard";import { CapPagination } from "./components/CapPagination";import { EmptyCapState } from "./components/EmptyCapState";import { SelectedCapsBar } from "./components/SelectedCapsBar";diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsxsimilarity index 53%rename from apps/web/app/(org)/dashboard/caps/components/CapCard.tsxrename to apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsxindex c7773d4c4..757a4bf6b 100644--- a/apps/web/app/(org)/dashboard/caps/components/CapCard.tsx+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCard.tsx@@ -1,19 +1,13 @@import { downloadVideo } from "@/actions/videos/download";-import { editDate } from "@/actions/videos/edit-date";-import { editTitle } from "@/actions/videos/edit-title";import { ConfirmationDialog } from "@/app/(org)/dashboard/_components/ConfirmationDialog";import { useDashboardContext } from "@/app/(org)/dashboard/Contexts";import { Tooltip } from "@/components/Tooltip";import { VideoThumbnail } from "@/components/VideoThumbnail";import { VideoMetadata } from "@cap/database/types";-import { buildEnv, NODE_ENV } from "@cap/env";import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@cap/ui";import {faCheck,- faChevronDown,- faDownload,faEllipsis,- faLink,faLock,faTrash,faUnlock,@@ -21,112 +15,19 @@ import {} from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import clsx from "clsx";-import moment from "moment";import Link from "next/link";import { useRouter } from "next/navigation";-import { PropsWithChildren, ReactNode, useState } from "react";+import { PropsWithChildren, useState } from "react";import { toast } from "sonner";+import { PasswordDialog } from "../PasswordDialog";+import { SharingDialog } from "../SharingDialog";import { CapCardAnalytics } from "./CapCardAnalytics";-import { PasswordDialog } from "./PasswordDialog";-import { SharingDialog } from "./SharingDialog";+import { CapCardButtons } from "./CapCardButtons";+import { CapCardContent } from "./CapCardContent";-interface ButtonConfig {- tooltipContent: string;- onClick: (e: React.MouseEvent) => void;- className: string;- disabled: boolean;- icon: () => ReactNode;-}-// Button configuration function defined before use-const getCapCardButtons = (- cap: {- id: string;- },- copyPressed: boolean,- isDownloading: boolean,- handleCopy: (url: string) => void,- handleDownload: () => void-): ButtonConfig[] => [- {- tooltipContent: "Copy link",- onClick: (e: React.MouseEvent) => {- e.stopPropagation();- handleCopy(- buildEnv.NEXT_PUBLIC_IS_CAP && NODE_ENV === "production"- ? `https://cap.link/${cap.id}`- : `${location.origin}/s/${cap.id}`- );- },- className: "delay-0",- disabled: false,- icon: () => {- return !copyPressed ? (- <FontAwesomeIcon- className="text-gray-12 size-4"- icon={faLink}- />- ) : (- <svg- xmlns="http://www.w3.org/2000/svg"- width="24"- height="24"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- className="text-gray-12 size-5 svgpathanimation"- >- <path d="M20 6 9 17l-5-5" />- </svg>- );- },- },- {- tooltipContent: "Download Cap",- onClick: (e: React.MouseEvent) => {- e.stopPropagation();- handleDownload();- },- className: "delay-25",- disabled: isDownloading,- icon: () => {- return isDownloading ? (- <div className="animate-spin size-3">- <svg- className="size-3"- xmlns="http://www.w3.org/2000/svg"- fill="none"- viewBox="0 0 24 24"- >- <circle- className="opacity-25"- cx="12"- cy="12"- r="10"- stroke="currentColor"- strokeWidth="4"- ></circle>- <path- className="opacity-75"- fill="currentColor"- d="m2 12c0-5.523 4.477-10 10-10v3c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7c0-1.457-.447-2.808-1.208-3.926l2.4-1.6c1.131 1.671 1.808 3.677 1.808 5.526 0 5.523-4.477 10-10 10s-10-4.477-10-10z"- ></path>- </svg>- </div>- ) : (- <FontAwesomeIcon- className="text-gray-12 size-3"- icon={faDownload}- />- );- },- },- ];-interface Props extends PropsWithChildren {+export interface CapCardProps extends PropsWithChildren {cap: {id: string;ownerId: string;@@ -170,50 +71,19 @@ export const CapCard = ({isSelected = false,onSelectToggle,anyCapSelected = false,-}: Props) => {- const effectiveDate = cap.metadata?.customCreatedAt- ? new Date(cap.metadata.customCreatedAt)- : cap.createdAt;-- const [isEditing, setIsEditing] = useState(false);- const [title, setTitle] = useState(cap.name);+}: CapCardProps) => {const [isSharingDialogOpen, setIsSharingDialogOpen] = useState(false);const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState(false);const [isDropdownOpen, setIsDropdownOpen] = useState(false);const [passwordProtected, setPasswordProtected] = useState(cap.hasPassword || false);- const [isDateEditing, setIsDateEditing] = useState(false);const [copyPressed, setCopyPressed] = useState(false);- const [dateValue, setDateValue] = useState(- moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss")- );- const [showFullDate, setShowFullDate] = useState(false);const [isDragging, setIsDragging] = useState(false);const [isDownloading, setIsDownloading] = useState(false);const router = useRouter();const { isSubscribed, setUpgradeModalOpen } = useDashboardContext();- const handleTitleBlur = async (capName: string) => {- if (!title || capName === title) {- setIsEditing(false);- return;- }-- try {- await editTitle(cap.id, title);- toast.success("Video title updated");- setIsEditing(false);- router.refresh();- } catch (error) {- if (error instanceof Error) {- toast.error(error.message);- } else {- toast.error("Failed to update title - please try again.");- }- }- };-const displayCount =analytics === 0? Math.max(cap.totalComments, cap.totalReactions)@@ -235,7 +105,7 @@ export const CapCard = ({setConfirmOpen(false);};- const handleSharingUpdated = (updatedSharedSpaces: string[]) => {+ const handleSharingUpdated = () => {router.refresh();};@@ -281,105 +151,6 @@ export const CapCard = ({setIsDragging(false);};- const renderSharedStatus = () => {- const baseClassName = clsx(- "text-sm text-gray-10 transition-colors duration-200 flex items-center mb-1",- "hover:text-gray-12",- hideSharedStatus ? "pointer-events-none" : "cursor-pointer"- );- if (isOwner && !hideSharedStatus) {- if (- (cap.sharedOrganizations?.length === 0 || !cap.sharedOrganizations) &&- (cap.sharedSpaces?.length === 0 || !cap.sharedSpaces)- ) {- return (- <p- className={baseClassName}- onClick={() => setIsSharingDialogOpen(true)}- >- Not shared{" "}- <FontAwesomeIcon className="ml-2 size-2.5" icon={faChevronDown} />- </p>- );- } else {- return (- <p- className={baseClassName}- onClick={() => setIsSharingDialogOpen(true)}- >- Shared{" "}- <FontAwesomeIcon className="ml-1 size-2.5" icon={faChevronDown} />- </p>- );- }- } else {- return <p className={baseClassName}>Shared with you</p>;- }- };-- const handleDateClick = () => {- if (userId === cap.ownerId) {- if (!isDateEditing) {- setIsDateEditing(true);- }- } else {- setShowFullDate(!showFullDate);- }- };-- const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {- setDateValue(e.target.value);- };-- const handleDateBlur = async () => {- const isValidDate = moment(dateValue).isValid();-- if (!isValidDate) {- toast.error("Invalid date format. Please use YYYY-MM-DD HH:mm:ss");- setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));- setIsDateEditing(false);- return;- }-- const selectedDate = moment(dateValue);- const currentDate = moment();-- if (selectedDate.isAfter(currentDate)) {- toast.error("Cannot set a date in the future");- setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));- setIsDateEditing(false);- return;- }-- if (selectedDate.isSame(effectiveDate)) {- setIsDateEditing(false);- return;- }-- try {- await editDate(cap.id, selectedDate.toISOString());- toast.success("Video date updated");- setIsDateEditing(false);- router.refresh();- } catch (error) {- if (error instanceof Error) {- toast.error(error.message);- } else {- toast.error("Failed to update date - please try again.");- }- }- };-- const handleDateKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {- if (e.key === "Enter") {- e.preventDefault();- handleDateBlur();- } else if (e.key === "Escape") {- setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));- setIsDateEditing(false);- }- };-const handleCopy = (text: string) => {navigator.clipboard.writeText(text);setCopyPressed(true);@@ -430,14 +201,6 @@ export const CapCard = ({}};- const handleTitleKeyDown = (- e: React.KeyboardEvent<HTMLTextAreaElement>,- capName: string- ) => {- if (e.key === "Enter") {- e.preventDefault();- }- };const handleCardClick = (e: React.MouseEvent) => {if (anyCapSelected) {@@ -508,26 +271,13 @@ export const CapCard = ({"top-2 right-2 flex-col gap-2 z-[20]")}>- {getCapCardButtons(- cap,- copyPressed,- isDownloading,- handleCopy,- handleDownload- ).map((button, index) => (- <Tooltip key={index} content={button.tooltipContent}>- <Button- onClick={button.onClick}- disabled={button.disabled}- className={clsx(`!size-8 hover:bg-gray-5 hover:border-gray-7 rounded-full min-w-fit !p-0`, button.className)}- variant="white"- size="sm"- aria-label={button.tooltipContent}- >- {button.icon()}- </Button>- </Tooltip>- ))}+ <CapCardButtons+ capId={cap.id}+ copyPressed={copyPressed}+ isDownloading={isDownloading}+ handleCopy={handleCopy}+ handleDownload={handleDownload}+ /><DropdownMenu modal={false} onOpenChange={setIsDropdownOpen}><Tooltip content="More options">@@ -642,66 +392,14 @@ export const CapCard = ({!sharedCapCard ? "cursor-pointer" : "cursor-default")}>- <div>- <div className="h-[1.25rem] mb-1">- {" "}- {/* Fixed height container */}- {isEditing && !sharedCapCard ? (- <textarea- rows={1}- value={title}- onChange={(e) => setTitle(e.target.value)}- onBlur={() => handleTitleBlur(cap.name)}- onKeyDown={(e) => handleTitleKeyDown(e, cap.name)}- autoFocus- className="text-md resize-none bg-transparent truncate w-full border-0 outline-0 text-gray-12 font-medium p-0 m-0 h-[1.25rem] overflow-hidden leading-[1.25rem] tracking-normal font-[inherit]"- />- ) : (- <p- className="text-md truncate leading-[1.25rem] text-gray-12 font-medium p-0 m-0 h-[1.25rem] tracking-normal"- onClick={() => {- if (!sharedCapCard) {- if (userId === cap.ownerId) {- setIsEditing(true);- }- }- }}- >- {title}- </p>- )}- </div>-- {renderSharedStatus()}- <div className="mb-1 h-[1.5rem]">- {" "}- {isDateEditing && !sharedCapCard ? (- <div className="flex items-center h-full">- <input- type="text"- value={dateValue}- onChange={handleDateChange}- onBlur={handleDateBlur}- onKeyDown={handleDateKeyDown}- autoFocus- className="text-sm w-full truncate text-gray-10 bg-transparent focus:outline-none h-full leading-[1.5rem]"- placeholder="YYYY-MM-DD HH:mm:ss"- />- </div>- ) : (- <Tooltip content={`Cap created at ${effectiveDate}`}>- <p- className="text-sm truncate text-gray-10 cursor-pointer flex items-center h-full leading-[1.5rem]"- onClick={handleDateClick}- >- {showFullDate- ? moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss")- : moment(effectiveDate).fromNow()}- </p>- </Tooltip>- )}- </div>- </div>+ <CapCardContent+ cap={cap}+ userId={userId}+ sharedCapCard={sharedCapCard}+ hideSharedStatus={hideSharedStatus}+ isOwner={isOwner}+ setIsSharingDialogOpen={setIsSharingDialogOpen}+ />{children}<CapCardAnalyticscapId={cap.id}@@ -714,5 +412,3 @@ export const CapCard = ({</>);};--// Function has been moved to the top of the filediff --git a/apps/web/app/(org)/dashboard/caps/components/CapCardAnalytics.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardAnalytics.tsxsimilarity index 100%rename from apps/web/app/(org)/dashboard/caps/components/CapCardAnalytics.tsxrename to apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardAnalytics.tsxdiff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsxnew file mode 100644index 000000000..5cc99e11d--- /dev/null+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardButtons.tsx@@ -0,0 +1,136 @@+import { Tooltip } from "@/components/Tooltip";+import { buildEnv, NODE_ENV } from "@cap/env";+import { Button } from "@cap/ui";+import { faDownload, faLink } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import clsx from "clsx";+import { ReactNode } from "react";++interface ButtonConfig {+ tooltipContent: string;+ onClick: (e: React.MouseEvent) => void;+ className: string;+ disabled: boolean;+ icon: () => ReactNode;+}++export interface CapCardButtonsProps {+ capId: string;+ copyPressed: boolean;+ isDownloading: boolean;+ handleCopy: (url: string) => void;+ handleDownload: () => void;+}++export const CapCardButtons: React.FC<CapCardButtonsProps> = ({+ capId,+ copyPressed,+ isDownloading,+ handleCopy,+ handleDownload,+}) => {+ return (+ <>+ {buttons(capId, copyPressed, isDownloading, handleCopy, handleDownload).map((button, index) => (+ <Tooltip key={index} content={button.tooltipContent}>+ <Button+ onClick={button.onClick}+ disabled={button.disabled}+ className={clsx(`!size-8 hover:bg-gray-5 hover:border-gray-7 rounded-full min-w-fit !p-0`, button.className)}+ variant="white"+ size="sm"+ aria-label={button.tooltipContent}+ >+ {button.icon()}+ </Button>+ </Tooltip>+ ))}+ </>+ );+};+++const buttons = (+ capId: string,+ copyPressed: boolean,+ isDownloading: boolean,+ handleCopy: (url: string) => void,+ handleDownload: () => void+): ButtonConfig[] => [+ {+ tooltipContent: "Copy link",+ onClick: (e: React.MouseEvent) => {+ e.stopPropagation();+ handleCopy(+ buildEnv.NEXT_PUBLIC_IS_CAP && NODE_ENV === "production"+ ? `https://cap.link/${capId}`+ : `${location.origin}/s/${capId}`+ );+ },+ className: "delay-0",+ disabled: false,+ icon: () => {+ return !copyPressed ? (+ <FontAwesomeIcon+ className="text-gray-12 size-4"+ icon={faLink}+ />+ ) : (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ strokeWidth="2"+ strokeLinecap="round"+ strokeLinejoin="round"+ className="text-gray-12 size-5 svgpathanimation"+ >+ <path d="M20 6 9 17l-5-5" />+ </svg>+ );+ },+ },+ {+ tooltipContent: "Download Cap",+ onClick: (e: React.MouseEvent) => {+ e.stopPropagation();+ handleDownload();+ },+ className: "delay-25",+ disabled: isDownloading,+ icon: () => {+ return isDownloading ? (+ <div className="animate-spin size-3">+ <svg+ className="size-3"+ xmlns="http://www.w3.org/2000/svg"+ fill="none"+ viewBox="0 0 24 24"+ >+ <circle+ className="opacity-25"+ cx="12"+ cy="12"+ r="10"+ stroke="currentColor"+ strokeWidth="4"+ ></circle>+ <path+ className="opacity-75"+ fill="currentColor"+ d="m2 12c0-5.523 4.477-10 10-10v3c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7c0-1.457-.447-2.808-1.208-3.926l2.4-1.6c1.131 1.671 1.808 3.677 1.808 5.526 0 5.523-4.477 10-10 10s-10-4.477-10-10z"+ ></path>+ </svg>+ </div>+ ) : (+ <FontAwesomeIcon+ className="text-gray-12 size-3"+ icon={faDownload}+ />+ );+ },+ },+ ]diff --git a/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardContent.tsx b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardContent.tsxnew file mode 100644index 000000000..71a556eb4--- /dev/null+++ b/apps/web/app/(org)/dashboard/caps/components/CapCard/CapCardContent.tsx@@ -0,0 +1,238 @@+import { editDate } from "@/actions/videos/edit-date";+import { editTitle } from "@/actions/videos/edit-title";+import { Tooltip } from "@/components/Tooltip";+import { faChevronDown } from "@fortawesome/free-solid-svg-icons";+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import clsx from "clsx";+import moment from "moment";+import { useRouter } from "next/navigation";+import { useState } from "react";+import { toast } from "sonner";+import { CapCardProps } from "./CapCard";++interface CapContentProps {+ cap: CapCardProps["cap"]+ userId?: string;+ sharedCapCard?: boolean;+ hideSharedStatus?: boolean;+ isOwner: boolean;+ setIsSharingDialogOpen: (isSharingDialogOpen: boolean) => void;+}++export const CapCardContent: React.FC<CapContentProps> = ({+ cap,+ userId,+ sharedCapCard = false,+ hideSharedStatus,+ isOwner,+ setIsSharingDialogOpen,+}) => {++ const router = useRouter();+ const effectiveDate = cap.metadata?.customCreatedAt+ ? new Date(cap.metadata.customCreatedAt)+ : cap.createdAt;++ const [dateValue, setDateValue] = useState(+ moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss")+ );+ const [isDateEditing, setIsDateEditing] = useState(false);+ const [showFullDate, setShowFullDate] = useState(false);+ const [title, setTitle] = useState(cap.name);+ const [isEditing, setIsEditing] = useState(false);++++ const handleTitleBlur = async (capName: string) => {+ if (!title || capName === title) {+ setIsEditing(false);+ return;+ }++ try {+ await editTitle(cap.id, title);+ toast.success("Video title updated");+ setIsEditing(false);+ router.refresh();+ } catch (error) {+ if (error instanceof Error) {+ toast.error(error.message);+ } else {+ toast.error("Failed to update title - please try again.");+ }+ }+ };+++ const handleDateClick = () => {+ if (userId === cap.ownerId) {+ if (!isDateEditing) {+ setIsDateEditing(true);+ }+ } else {+ setShowFullDate(!showFullDate);+ }+ };+++ const handleTitleKeyDown = (+ e: React.KeyboardEvent<HTMLTextAreaElement>,+ ) => {+ if (e.key === "Enter") {+ e.preventDefault();+ }+ };+++ const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ setDateValue(e.target.value);+ };++ const handleDateBlur = async () => {+ const isValidDate = moment(dateValue).isValid();++ if (!isValidDate) {+ toast.error("Invalid date format. Please use YYYY-MM-DD HH:mm:ss");+ setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));+ setIsDateEditing(false);+ return;+ }++ const selectedDate = moment(dateValue);+ const currentDate = moment();++ if (selectedDate.isAfter(currentDate)) {+ toast.error("Cannot set a date in the future");+ setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));+ setIsDateEditing(false);+ return;+ }++ if (selectedDate.isSame(effectiveDate)) {+ setIsDateEditing(false);+ return;+ }++ try {+ await editDate(cap.id, selectedDate.toISOString());+ toast.success("Video date updated");+ setIsDateEditing(false);+ router.refresh();+ } catch (error) {+ if (error instanceof Error) {+ toast.error(error.message);+ } else {+ toast.error("Failed to update date - please try again.");+ }+ }+ };++ const handleDateKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {+ if (e.key === "Enter") {+ e.preventDefault();+ handleDateBlur();+ } else if (e.key === "Escape") {+ setDateValue(moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss"));+ setIsDateEditing(false);+ }+ };++ const renderSharedStatus = () => {+ const baseClassName = clsx(+ "text-sm text-gray-10 transition-colors duration-200 flex items-center mb-1",+ "hover:text-gray-12",+ hideSharedStatus ? "pointer-events-none" : "cursor-pointer"+ );+ if (isOwner && !hideSharedStatus) {+ if (+ (cap.sharedOrganizations?.length === 0 || !cap.sharedOrganizations) &&+ (cap.sharedSpaces?.length === 0 || !cap.sharedSpaces)+ ) {+ return (+ <p+ className={baseClassName}+ onClick={() => setIsSharingDialogOpen(true)}+ >+ Not shared{" "}+ <FontAwesomeIcon className="ml-2 size-2.5" icon={faChevronDown} />+ </p>+ );+ } else {+ return (+ <p+ className={baseClassName}+ onClick={() => setIsSharingDialogOpen(true)}+ >+ Shared{" "}+ <FontAwesomeIcon className="ml-1 size-2.5" icon={faChevronDown} />+ </p>+ );+ }+ } else {+ return <p className={baseClassName}>Shared with you</p>;+ }+ };++ return (+ <div>+ <div className="h-[1.25rem] mb-1">+ {" "}+ {/* Fixed height container */}+ {isEditing && !sharedCapCard ? (+ <textarea+ rows={1}+ value={title}+ onChange={(e) => setTitle(e.target.value)}+ onBlur={() => handleTitleBlur(cap.name)}+ onKeyDown={(e) => handleTitleKeyDown(e)}+ autoFocus+ className="text-md resize-none bg-transparent truncate w-full border-0 outline-0 text-gray-12 font-medium p-0 m-0 h-[1.25rem] overflow-hidden leading-[1.25rem] tracking-normal font-[inherit]"+ />+ ) : (+ <p+ className="text-md truncate leading-[1.25rem] text-gray-12 font-medium p-0 m-0 h-[1.25rem] tracking-normal"+ onClick={() => {+ if (!sharedCapCard) {+ if (userId === cap.ownerId) {+ setIsEditing(true);+ }+ }+ }}+ >+ {title}+ </p>+ )}+ </div>++ {renderSharedStatus()}+ <div className="mb-1 h-[1.5rem]">+ {" "}+ {isDateEditing && !sharedCapCard ? (+ <div className="flex items-center h-full">+ <input+ type="text"+ value={dateValue}+ onChange={handleDateChange}+ onBlur={handleDateBlur}+ onKeyDown={handleDateKeyDown}+ autoFocus+ className="text-sm w-full truncate text-gray-10 bg-transparent focus:outline-none h-full leading-[1.5rem]"+ placeholder="YYYY-MM-DD HH:mm:ss"+ />+ </div>+ ) : (+ <Tooltip content={`Cap created at ${effectiveDate}`}>+ <p+ className="text-sm truncate text-gray-10 cursor-pointer flex items-center h-full leading-[1.5rem]"+ onClick={handleDateClick}+ >+ {showFullDate+ ? moment(effectiveDate).format("YYYY-MM-DD HH:mm:ss")+ : moment(effectiveDate).fromNow()}+ </p>+ </Tooltip>+ )}+ </div>+ </div>+ );+};diff --git a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsxindex 2ec25b186..9c093e643 100644--- a/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx+++ b/apps/web/app/(org)/dashboard/spaces/[spaceId]/components/SharedCapCard.tsx@@ -1,7 +1,7 @@import { VideoMetadata } from "@cap/database/types";import { faBuilding, faUser } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";-import { CapCard } from "../../../caps/components/CapCard";+import { CapCard } from "../../../caps/components/CapCard/CapCard";interface SharedCapCardProps {cap: {diff --git a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsxindex 6c2ca1eb4..fbd86ed5e 100644--- a/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx+++ b/apps/web/app/s/[videoId]/_components/tabs/Activity.tsx@@ -1,7 +1,7 @@"use client";import { getVideoAnalytics } from "@/actions/videos/get-analytics";-import { CapCardAnalytics } from "@/app/(org)/dashboard/caps/components/CapCardAnalytics";+import { CapCardAnalytics } from "@/app/(org)/dashboard/caps/components/CapCard/CapCardAnalytics";import { userSelectProps } from "@cap/database/auth/session";import { comments as commentsSchema } from "@cap/database/schema";import { Avatar, Button } from "@cap/ui";@@ -168,120 +168,119 @@ const Comment: React.FC<{level = 0,onSeek,}) => {- const isReplying = replyingToId === comment.id;- const isOwnComment = user?.id === comment.authorId;- const nestedReplies =- level === 0- ? replies.filter((reply) => {+ const isReplying = replyingToId === comment.id;+ const isOwnComment = user?.id === comment.authorId;+ const nestedReplies =+ level === 0+ ? replies.filter((reply) => {if (reply.parentCommentId === comment.id) return true;const parentComment = replies.find((r) => r.id === reply.parentCommentId);return parentComment && parentComment.parentCommentId === comment.id;})- : [];+ : [];- const handleDelete = () => {- if (window.confirm("Are you sure you want to delete this comment?")) {- onDelete(comment.id);- }- };+ const handleDelete = () => {+ if (window.confirm("Are you sure you want to delete this comment?")) {+ onDelete(comment.id);+ }+ };- const canReply = true;- const commentDate = new Date(comment.createdAt);+ const canReply = true;+ const commentDate = new Date(comment.createdAt);- return (- <motion.div- id={`comment-${comment.id}`}- initial={{ opacity: 0, y: 20 }}- animate={{ opacity: 1, y: 0 }}- exit={{ opacity: 0, y: -20 }}- transition={{ duration: 0.2 }}- className={`space-y-3 ${- level > 0 ? "ml-8 border-l-2 border-gray-100 pl-4" : ""- }`}- >- <div className="flex items-start space-x-3">- <Avatar name={comment.authorName} />- <div className="flex-1">- <div className="flex items-center space-x-2">- <span className="font-medium text-gray-12">- {comment.authorName || "Anonymous"}- </span>- <span- className="text-sm text-gray-8"- data-tooltip-id={`comment-${comment.id}-timestamp`}- data-tooltip-content={formatTimestamp(commentDate)}- >- {formatTimeAgo(commentDate)}- </span>- <Tooltip id={`comment-${comment.id}-timestamp`} />- {comment.timestamp && (- <button- onClick={() => onSeek?.(comment.timestamp!)}- className="text-sm text-blue-500 cursor-pointer hover:text-blue-700"- >- {new Date(comment.timestamp * 1000).toISOString().substr(11, 8)}- </button>- )}- </div>- <p className="mt-1 text-gray-700">{comment.content}</p>- <div className="flex items-center mt-2 space-x-4">- {user && !isReplying && canReply && (- <button- onClick={() => onReply(comment.id)}- className="text-sm text-gray-1 hover:text-gray-700"- >- Reply- </button>- )}- {isOwnComment && (- <button- onClick={handleDelete}- className="text-sm text-red-500 hover:text-red-700"+ return (+ <motion.div+ id={`comment-${comment.id}`}+ initial={{ opacity: 0, y: 20 }}+ animate={{ opacity: 1, y: 0 }}+ exit={{ opacity: 0, y: -20 }}+ transition={{ duration: 0.2 }}+ className={`space-y-3 ${level > 0 ? "ml-8 border-l-2 border-gray-100 pl-4" : ""+ }`}+ >+ <div className="flex items-start space-x-3">+ <Avatar name={comment.authorName} />+ <div className="flex-1">+ <div className="flex items-center space-x-2">+ <span className="font-medium text-gray-12">+ {comment.authorName || "Anonymous"}+ </span>+ <span+ className="text-sm text-gray-8"+ data-tooltip-id={`comment-${comment.id}-timestamp`}+ data-tooltip-content={formatTimestamp(commentDate)}>- Delete- </button>- )}+ {formatTimeAgo(commentDate)}+ </span>+ <Tooltip id={`comment-${comment.id}-timestamp`} />+ {comment.timestamp && (+ <button+ onClick={() => onSeek?.(comment.timestamp!)}+ className="text-sm text-blue-500 cursor-pointer hover:text-blue-700"+ >+ {new Date(comment.timestamp * 1000).toISOString().substr(11, 8)}+ </button>+ )}+ </div>+ <p className="mt-1 text-gray-700">{comment.content}</p>+ <div className="flex items-center mt-2 space-x-4">+ {user && !isReplying && canReply && (+ <button+ onClick={() => onReply(comment.id)}+ className="text-sm text-gray-1 hover:text-gray-700"+ >+ Reply+ </button>+ )}+ {isOwnComment && (+ <button+ onClick={handleDelete}+ className="text-sm text-red-500 hover:text-red-700"+ >+ Delete+ </button>+ )}+ </div></div></div>- </div>- {isReplying && canReply && (- <div className="ml-5">- <CommentInput- onSubmit={handleReply}- onCancel={onCancelReply}- placeholder="Write a reply..."- showCancelButton={true}- user={user}- autoFocus={true}- />- </div>- )}-- {nestedReplies.length > 0 && (- <div className="mt-3 space-y-3">- {nestedReplies.map((reply) => (- <Comment- key={reply.id}- comment={reply}- replies={replies}- onReply={onReply}- replyingToId={replyingToId}- handleReply={handleReply}- onCancelReply={onCancelReply}- onDelete={onDelete}+ {isReplying && canReply && (+ <div className="ml-5">+ <CommentInput+ onSubmit={handleReply}+ onCancel={onCancelReply}+ placeholder="Write a reply..."+ showCancelButton={true}user={user}- level={1}- onSeek={onSeek}+ autoFocus={true}/>- ))}- </div>- )}- </motion.div>- );-};+ </div>+ )}++ {nestedReplies.length > 0 && (+ <div className="mt-3 space-y-3">+ {nestedReplies.map((reply) => (+ <Comment+ key={reply.id}+ comment={reply}+ replies={replies}+ onReply={onReply}+ replyingToId={replyingToId}+ handleReply={handleReply}+ onCancelReply={onCancelReply}+ onDelete={onDelete}+ user={user}+ level={1}+ onSeek={onSeek}+ />+ ))}+ </div>+ )}+ </motion.div>+ );+ };const EmptyState = () => (<div className="flex flex-col justify-center items-center p-8 h-full text-center animate-in fade-in">diff --git a/apps/web/package.json b/apps/web/package.jsonindex 61eb0e9ac..fd087dfad 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -57,6 +57,7 @@"clsx": "^2.1.1","cookies-next": "^4.1.0","date-fns": "^3.2.0",+ "dompurify": "^3.2.6","dotenv": "^16.3.1","drizzle-orm": "0.43.1","dub": "^0.33.1",@@ -67,6 +68,7 @@"hls.js": "^1.5.3","hono": "^4.7.1","js-cookie": "^3.0.5",+ "jsdom": "^26.1.0","jszip": "^3.10.1","lodash": "^4.17.21","lucide-react": "^0.294.0",@@ -101,6 +103,7 @@},"devDependencies": {"@types/file-saver": "^2.0.7",+ "@types/jsdom": "^21.1.7","@types/lodash": "^4.17.5","@types/node": "^20.11.5","@types/react": "^18.2.7",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex ee4181d3a..2e10256d0 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -255,7 +255,7 @@ importers:devDependencies:'@cloudflare/vitest-pool-workers':specifier: ^0.6.4- version: 0.6.16(@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))+ version: 0.6.16(@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected]))'@cloudflare/workers-types':specifier: ^4.20250214.0version: 4.20250507.0@@ -264,7 +264,7 @@ importers:version: 5.8.3vitest:specifier: ~2.1.9- version: 2.1.9(@types/[email protected])([email protected])wrangler:specifier: ^3.109.1version: 3.114.8(@cloudflare/[email protected])@@ -537,6 +537,9 @@ importers:date-fns:specifier: ^3.2.0version: 3.6.0+ dompurify:+ specifier: ^3.2.6+ version: 3.2.6dotenv:specifier: ^16.3.1version: 16.5.0@@ -567,6 +570,9 @@ importers:js-cookie:specifier: ^3.0.5version: 3.0.5+ jsdom:+ specifier: ^26.1.0+ version: 26.1.0jszip:specifier: ^3.10.1version: 3.10.1@@ -664,6 +670,9 @@ importers:'@types/file-saver':specifier: ^2.0.7version: 2.0.7+ '@types/jsdom':+ specifier: ^21.1.7+ version: 21.1.7'@types/lodash':specifier: ^4.17.5version: 4.17.16@@ -1100,6 +1109,9 @@ packages:'@antfu/[email protected]':resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==}+ '@asamuzakjp/[email protected]':+ resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==}+'@aws-crypto/[email protected]':resolution: {integrity: sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==}engines: {node: '>=16.0.0'}@@ -1634,6 +1646,34 @@ packages:resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==}engines: {node: '>=12'}+ '@csstools/[email protected]':+ resolution: {integrity: sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==}+ engines: {node: '>=18'}++ '@csstools/[email protected]':+ resolution: {integrity: sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-parser-algorithms': ^3.0.5+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-parser-algorithms': ^3.0.5+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==}+ engines: {node: '>=18'}+ peerDependencies:+ '@csstools/css-tokenizer': ^3.0.4++ '@csstools/[email protected]':+ resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==}+ engines: {node: '>=18'}+'@dabh/[email protected]':resolution: {integrity: sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==}@@ -5855,6 +5895,9 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-wkw9yd1kEXOPnvEeEV1Go1MmxtBJL0RR79aOTAApecWFVu7w0NNXNqhcWgvw2YgZDYadliXkl14pa3WXw5jlCQ==}+ '@types/[email protected]':+ resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==}+'@types/[email protected]':resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}@@ -5980,9 +6023,15 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-chhaNf2oKHlRkDGt+tiKE2Z5aJ6qalm7Z9rlLdBwmOiAAf09YQvvoLXjWK4HWPF1xU/fqvMgfNfpVoBscA/tKA==}+ '@types/[email protected]':+ resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==}+'@types/[email protected]':resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==}+ '@types/[email protected]':+ resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}+'@types/[email protected]':resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==}@@ -7272,6 +7321,10 @@ packages:engines: {node: '>=4'}hasBin: true+ resolution: {integrity: sha512-/7gw8TGrvH/0g564EnhgFZogTMVe+lifpB7LWU+PEsiq5o83TUXR3fDbzTRXOJhoJwck5IS9ez3Em5LNMMO2aw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==}@@ -7288,6 +7341,10 @@ packages:resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}engines: {node: '>= 12'}+ resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==}engines: {node: '>= 0.4'}@@ -7382,6 +7439,9 @@ packages:resolution: {integrity: sha512-2LPqkLeu8XWHU8qNCS3kcF6sCcb5zIzvWaAHYSvPfwhdd7mHuah29NssMzrTYyHN4F5oFy2ko9OBYxegtU0FEw==}+ resolution: {integrity: sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==}+resolution: {integrity: sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==}@@ -7567,6 +7627,9 @@ packages:resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}engines: {node: '>= 4'}+ resolution: {integrity: sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==}+resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}@@ -8734,6 +8797,10 @@ packages:resolution: {integrity: sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==}engines: {node: ^16.14.0 || >=18.0.0}+ resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==}@@ -9081,6 +9148,9 @@ packages:resolution: {integrity: sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==}engines: {node: '>=12'}+ resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}+resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==}@@ -9407,6 +9477,15 @@ packages:resolution: {integrity: sha512-Hicd6JK5Njt2QB6XYFS7ok9e37O8AYk3jTcppG4YVQnYjOemymvTcmc7OWsmq/Qqj5TdRFO5/x/tIPmBeRtGHg==}engines: {node: '>=12.0.0'}+ resolution: {integrity: sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==}+ engines: {node: '>=18'}+ peerDependencies:+ canvas: ^3.0.0+ peerDependenciesMeta:+ canvas:+ optional: true+resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}engines: {node: '>=6'}@@ -10410,6 +10489,9 @@ packages:resolution: {integrity: sha512-P83Y9rBgN3Xpz5677YDNtuQHZpIldw6WXeWRg0+edrfFthhV7QqRdABas5gtu07QPLvbA8XhfO69rIvbKRzYIg==}+ resolution: {integrity: sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==}+resolution: {integrity: sha512-mn8wBFV9G9+UFHIrq+pZ2r2zL4aPau/by3kJb3cM7+5tQHMt6HGQB8FDIeKFYp8o0D2pnH6nVsO88N4AmUxIWg==}engines: {node: ^14.16.0 || >=16.10.0}@@ -11427,6 +11509,9 @@ packages:resolution: {integrity: sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==}engines: {node: '>= 18'}+ resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==}+resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}@@ -11458,6 +11543,10 @@ packages:resolution: {integrity: sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA==}+ resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==}+ engines: {node: '>=v12.22.7'}+resolution: {integrity: sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==}@@ -12027,6 +12116,9 @@ packages:resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}+resolution: {integrity: sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==}engines: {node: '>=18'}@@ -12140,6 +12232,13 @@ packages:resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==}engines: {node: '>=14.0.0'}+ resolution: {integrity: sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==}++ resolution: {integrity: sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==}+ hasBin: true+resolution: {integrity: sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ==}@@ -12169,9 +12268,17 @@ packages:resolution: {integrity: sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==}hasBin: true+ resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==}+ engines: {node: '>=16'}+resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}+ resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ==}engines: {node: '>=10.0'}@@ -12952,6 +13059,10 @@ packages:jsdom:optional: true+ resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==}@@ -12978,9 +13089,25 @@ packages:resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}+ resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}+ resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}+ engines: {node: '>=18'}++ resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}@@ -13131,6 +13258,10 @@ packages:utf-8-validate:optional: true+ resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==}engines: {node: '>=4.0.0'}@@ -13139,6 +13270,9 @@ packages:resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==}engines: {node: '>=4.0'}+ resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==}+resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}engines: {node: '>=10'}@@ -13265,6 +13399,14 @@ snapshots:'@antfu/[email protected]': {}+ '@asamuzakjp/[email protected]':+ dependencies:+ '@csstools/css-calc': 2.1.4(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-color-parser': 3.0.10(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4+ lru-cache: 10.4.3+'@aws-crypto/[email protected]':dependencies:'@aws-crypto/util': 5.2.0@@ -14075,7 +14217,7 @@ snapshots:'@babel/parser': 7.27.2'@babel/template': 7.27.2'@babel/types': 7.27.1- debug: 4.4.0([email protected])+ debug: 4.4.1globals: 11.12.0transitivePeerDependencies:- supports-color@@ -14141,7 +14283,7 @@ snapshots:optionalDependencies:workerd: 1.20250408.0- '@cloudflare/[email protected](@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected]))':+ '@cloudflare/[email protected](@cloudflare/[email protected])(@vitest/[email protected])(@vitest/[email protected])([email protected](@types/[email protected])([email protected])([email protected]))':dependencies:'@vitest/runner': 2.1.9'@vitest/snapshot': 2.1.9@@ -14151,7 +14293,7 @@ snapshots:esbuild: 0.17.19miniflare: 3.20250204.1semver: 7.7.1- vitest: 2.1.9(@types/[email protected])([email protected])wrangler: 3.109.1(@cloudflare/[email protected])zod: 3.24.4transitivePeerDependencies:@@ -14307,6 +14449,26 @@ snapshots:dependencies:'@jridgewell/trace-mapping': 0.3.9+ '@csstools/[email protected]': {}++ '@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':+ dependencies:+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':+ dependencies:+ '@csstools/color-helpers': 5.0.2+ '@csstools/css-calc': 2.1.4(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])+ '@csstools/css-parser-algorithms': 3.0.5(@csstools/[email protected])+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected](@csstools/[email protected])':+ dependencies:+ '@csstools/css-tokenizer': 3.0.4++ '@csstools/[email protected]': {}+'@dabh/[email protected]':dependencies:colorspace: 1.1.4@@ -14405,7 +14567,7 @@ snapshots:'@esbuild-plugins/[email protected]([email protected])':dependencies:'@types/resolve': 1.20.6- debug: 4.4.0([email protected])+ debug: 4.4.1esbuild: 0.25.5escape-string-regexp: 4.0.0resolve: 1.22.10@@ -18723,6 +18885,12 @@ snapshots:'@types/[email protected]': {}+ '@types/[email protected]':+ dependencies:+ '@types/node': 20.17.43+ '@types/tough-cookie': 4.0.5+ parse5: 7.3.0+'@types/[email protected]': {}'@types/[email protected]': {}@@ -18865,8 +19033,13 @@ snapshots:'@types/[email protected]': {}+ '@types/[email protected]': {}+'@types/[email protected]': {}+ '@types/[email protected]':+ optional: true+'@types/[email protected]': {}'@types/[email protected]': {}@@ -19406,7 +19579,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1transitivePeerDependencies:- supports-color@@ -19861,7 +20034,7 @@ snapshots:dependencies:bytes: 3.1.2content-type: 1.0.5- debug: 4.4.0([email protected])+ debug: 4.4.1http-errors: 2.0.0iconv-lite: 0.6.3on-finished: 2.4.1@@ -20386,6 +20559,11 @@ snapshots:+ dependencies:+ '@asamuzakjp/css-color': 3.2.0+ rrweb-cssom: 0.8.0+@@ -20396,6 +20574,11 @@ snapshots:+ dependencies:+ whatwg-mimetype: 4.0.0+ whatwg-url: 14.2.0+dependencies:call-bound: 1.0.4@@ -20456,6 +20639,8 @@ snapshots:dependencies:callsite: 1.0.0+ [email protected]: {}+dependencies:character-entities: 2.0.2@@ -20629,6 +20814,10 @@ snapshots:dependencies:domelementtype: 2.3.0+ optionalDependencies:+ '@types/trusted-types': 2.0.7+dependencies:dom-serializer: 2.0.0@@ -21663,7 +21852,7 @@ snapshots:content-type: 1.0.5cookie: 0.7.2cookie-signature: 1.2.2- debug: 4.4.0([email protected])+ debug: 4.4.1encodeurl: 2.0.0escape-html: 1.0.3etag: 1.8.1@@ -21697,7 +21886,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1get-stream: 5.2.0yauzl: 2.10.0optionalDependencies:@@ -21806,7 +21995,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1encodeurl: 2.0.0escape-html: 1.0.3on-finished: 2.4.1@@ -22311,6 +22500,10 @@ snapshots:dependencies:lru-cache: 10.4.3+ dependencies:+ whatwg-encoding: 3.1.1+@@ -22347,7 +22540,7 @@ snapshots:dependencies:agent-base: 7.1.3- debug: 4.4.0([email protected])+ debug: 4.4.1transitivePeerDependencies:- supports-color@@ -22369,14 +22562,14 @@ snapshots:dependencies:agent-base: 6.0.2- debug: 4.4.0([email protected])+ debug: 4.4.1transitivePeerDependencies:- supports-colordependencies:agent-base: 7.1.3- debug: 4.4.0([email protected])+ debug: 4.4.1transitivePeerDependencies:- supports-color@@ -22472,7 +22665,7 @@ snapshots:dependencies:'@ioredis/commands': 1.2.0cluster-key-slot: 1.1.2- debug: 4.4.0([email protected])+ debug: 4.4.1denque: 2.1.0lodash.defaults: 4.2.0lodash.isarguments: 3.1.0@@ -22636,6 +22829,8 @@ snapshots:+ [email protected]: {}+@@ -22749,7 +22944,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1istanbul-lib-coverage: 3.2.2source-map: 0.6.1transitivePeerDependencies:@@ -23136,6 +23331,33 @@ snapshots:+ dependencies:+ cssstyle: 4.5.0+ data-urls: 5.0.0+ decimal.js: 10.5.0+ html-encoding-sniffer: 4.0.0+ http-proxy-agent: 7.0.2+ https-proxy-agent: 7.0.6+ is-potential-custom-element-name: 1.0.1+ nwsapi: 2.2.20+ parse5: 7.3.0+ rrweb-cssom: 0.8.0+ saxes: 6.0.0+ symbol-tree: 3.2.4+ tough-cookie: 5.1.2+ w3c-xmlserializer: 5.0.0+ webidl-conversions: 7.0.0+ whatwg-encoding: 3.1.1+ whatwg-mimetype: 4.0.0+ whatwg-url: 14.2.0+ ws: 8.18.2+ xml-name-validator: 5.0.0+ transitivePeerDependencies:+ - bufferutil+ - supports-color+ - utf-8-validate+@@ -23810,7 +24032,7 @@ snapshots:dependencies:'@types/debug': 4.1.12- debug: 4.4.0([email protected])+ debug: 4.4.1decode-named-character-reference: 1.1.0devlop: 1.1.0micromark-core-commonmark: 2.0.3@@ -24487,6 +24709,8 @@ snapshots:dependencies:esm-env: 1.2.2+ [email protected]: {}+dependencies:citty: 0.1.6@@ -25536,7 +25760,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1module-details-from-path: 1.0.4resolve: 1.22.10transitivePeerDependencies:@@ -25647,7 +25871,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1depd: 2.0.0is-promise: 4.0.0parseurl: 1.3.3@@ -25655,6 +25879,8 @@ snapshots:transitivePeerDependencies:- supports-color+ [email protected]: {}+dependencies:queue-microtask: 1.2.3@@ -25688,6 +25914,10 @@ snapshots:+ dependencies:+ xmlchars: 2.2.0+@@ -25728,7 +25958,7 @@ snapshots:dependencies:- debug: 4.4.0([email protected])+ debug: 4.4.1encodeurl: 2.0.0escape-html: 1.0.3etag: 1.8.1@@ -25983,7 +26213,7 @@ snapshots:dependencies:agent-base: 7.1.3- debug: 4.4.0([email protected])+ debug: 4.4.1socks: 2.8.4transitivePeerDependencies:- supports-color@@ -26412,6 +26642,8 @@ snapshots:+ [email protected]: {}+@@ -26591,6 +26823,12 @@ snapshots:+ [email protected]: {}++ dependencies:+ tldts-core: 6.1.86+dependencies:tmp: 0.2.3@@ -26611,8 +26849,16 @@ snapshots:+ dependencies:+ tldts: 6.1.86++ dependencies:+ punycode: 2.3.1+dependencies:tslib: 2.8.1@@ -26719,7 +26965,7 @@ snapshots:dependencies:'@tufjs/models': 2.0.1- debug: 4.4.0([email protected])+ debug: 4.4.1make-fetch-happen: 13.0.1transitivePeerDependencies:- supports-color@@ -27443,7 +27689,7 @@ snapshots:optionalDependencies:dependencies:'@vitest/expect': 2.1.9@@ -27467,6 +27713,7 @@ snapshots:why-is-node-running: 2.3.0optionalDependencies:'@types/node': 22.15.17+ jsdom: 26.1.0transitivePeerDependencies:- less- lightningcss@@ -27478,6 +27725,10 @@ snapshots:- supports-color- terser+ dependencies:+ xml-name-validator: 5.0.0+@@ -27502,8 +27753,21 @@ snapshots:+ [email protected]: {}++ dependencies:+ iconv-lite: 0.6.3++ [email protected]: {}++ dependencies:+ tr46: 5.1.1+ webidl-conversions: 7.0.0+dependencies:tr46: 0.0.3@@ -27693,6 +27957,8 @@ snapshots:+ [email protected]: {}+dependencies:sax: 1.2.1@@ -27700,6 +27966,8 @@ snapshots:+ [email protected]: {}+