This commit is contained in:
babayaga 2026-01-20 12:14:45 +01:00
parent 62b6fed0e6
commit 7f63b07df5
165 changed files with 106515 additions and 0 deletions

28
packages/ui/.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
# Logs
logs
systems
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
ref
*.local
playwright-report
test-results
dist
dist-in
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,12 @@
interface EditImageModalProps {
open: boolean;
onOpenChange: (open: boolean) => void;
pictureId: string;
currentTitle: string;
currentDescription: string | null;
currentVisible: boolean;
imageUrl?: string;
onUpdateSuccess: () => void;
}
declare const EditImageModal: ({ open, onOpenChange, pictureId, currentTitle, currentDescription, currentVisible, imageUrl, onUpdateSuccess }: EditImageModalProps) => import("react/jsx-runtime").JSX.Element;
export default EditImageModal;

View File

@ -0,0 +1,11 @@
interface EditVideoModalProps {
open: boolean;
onOpenChange: (open: boolean) => void;
videoId: string;
currentTitle: string;
currentDescription: string | null;
currentVisible: boolean;
onUpdateSuccess: () => void;
}
declare const EditVideoModal: ({ open, onOpenChange, videoId, currentTitle, currentDescription, currentVisible, onUpdateSuccess }: EditVideoModalProps) => import("react/jsx-runtime").JSX.Element;
export default EditVideoModal;

View File

@ -0,0 +1,8 @@
import { default as React } from 'react';
interface HashtagTextProps {
children: string;
className?: string;
onTagClick?: (tag: string) => void;
}
declare const HashtagText: React.FC<HashtagTextProps>;
export default HashtagText;

View File

@ -0,0 +1,44 @@
import { QuickAction } from '../constants';
interface ImageLightboxProps {
isOpen: boolean;
onClose: () => void;
imageUrl: string;
imageTitle: string;
originalImageId?: string;
onPromptSubmit?: (prompt: string) => void;
onPublish?: (option: 'overwrite' | 'new' | 'version', imageUrl: string, title: string, description?: string, parentId?: string, collectionIds?: string[]) => void;
isGenerating?: boolean;
isPublishing?: boolean;
showPrompt?: boolean;
showPublish?: boolean;
generatedImageUrl?: string;
currentIndex?: number;
totalCount?: number;
onNavigate?: (direction: 'prev' | 'next') => void;
onPreload?: (direction: 'prev' | 'next') => void;
showWizardFeatures?: boolean;
promptTemplates?: Array<{
name: string;
template: string;
}>;
onApplyTemplate?: (template: string) => void;
onSaveTemplate?: () => void;
onDeleteTemplate?: (index: number) => void;
onOptimizePrompt?: () => void;
isOptimizing?: boolean;
onMicrophoneToggle?: () => void;
isRecording?: boolean;
isTranscribing?: boolean;
showQuickPublish?: boolean;
onQuickPublish?: () => void;
prompt?: string;
onPromptChange?: (value: string) => void;
quickActions?: QuickAction[];
promptHistory?: string[];
historyIndex?: number;
onNavigateHistory?: (direction: 'up' | 'down') => void;
onManualPromptEdit?: () => void;
onOpenInWizard?: () => void;
}
export default function ImageLightbox({ isOpen, onClose, imageUrl, imageTitle, originalImageId, onPromptSubmit, onPublish, isGenerating, isPublishing, showPrompt, showPublish, generatedImageUrl, currentIndex, totalCount, onNavigate, onPreload, showWizardFeatures, promptTemplates, onApplyTemplate, onSaveTemplate, onDeleteTemplate, onOptimizePrompt, isOptimizing, onMicrophoneToggle, isRecording, isTranscribing, showQuickPublish, onQuickPublish, prompt: externalPrompt, onPromptChange, promptHistory, historyIndex, onNavigateHistory, onManualPromptEdit, onOpenInWizard, quickActions }: ImageLightboxProps): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -0,0 +1,14 @@
import { default as React } from 'react';
interface MagicWizardButtonProps {
imageUrl: string;
imageTitle: string;
className?: string;
size?: "sm" | "default" | "lg" | "icon";
variant?: "default" | "ghost" | "outline";
onClick?: (e: React.MouseEvent) => void;
editingPostId?: string | null;
pictureId?: string;
children?: React.ReactNode;
}
declare const MagicWizardButton: React.FC<MagicWizardButtonProps>;
export default MagicWizardButton;

View File

@ -0,0 +1,10 @@
import { default as React } from 'react';
interface MarkdownEditorProps {
value: string;
onChange: (value: string) => void;
placeholder?: string;
className?: string;
onKeyDown?: (e: React.KeyboardEvent) => void;
}
declare const _default: React.NamedExoticComponent<MarkdownEditorProps>;
export default _default;

View File

@ -0,0 +1,7 @@
import { default as React } from 'react';
interface MarkdownRendererProps {
content: string;
className?: string;
}
declare const MarkdownRenderer: React.MemoExoticComponent<({ content, className }: MarkdownRendererProps) => import("react/jsx-runtime").JSX.Element>;
export default MarkdownRenderer;

View File

@ -0,0 +1,30 @@
import { default as React } from 'react';
import { MediaType } from '../lib/mediaRegistry';
interface MediaCardProps {
id: string;
pictureId?: string;
url: string;
thumbnailUrl?: string | null;
title: string;
author: string;
authorId: string;
likes: number;
comments: number;
isLiked?: boolean;
description?: string | null;
type: MediaType;
meta?: any;
responsive?: any;
onClick?: (id: string) => void;
onLike?: () => void;
onDelete?: () => void;
onEdit?: (id: string) => void;
created_at?: string;
authorAvatarUrl?: string | null;
showContent?: boolean;
job?: any;
variant?: 'grid' | 'feed';
apiUrl?: string;
}
declare const MediaCard: React.FC<MediaCardProps>;
export default MediaCard;

View File

@ -0,0 +1,12 @@
import { default as React } from 'react';
import { MediaRendererProps } from '../lib/mediaRegistry';
interface PageCardProps extends Omit<MediaRendererProps, 'created_at'> {
variant?: 'grid' | 'feed';
responsive?: any;
showContent?: boolean;
authorAvatarUrl?: string | null;
created_at?: string;
apiUrl?: string;
}
declare const PageCard: React.FC<PageCardProps>;
export default PageCard;

View File

@ -0,0 +1,24 @@
interface PhotoCardProps {
pictureId: string;
image: string;
title: string;
author: string;
authorId: string;
likes: number;
comments: number;
isLiked?: boolean;
description?: string | null;
onClick?: (pictureId: string) => void;
onLike?: () => void;
onDelete?: () => void;
isVid?: boolean;
onEdit?: (pictureId: string) => void;
createdAt?: string;
authorAvatarUrl?: string | null;
showContent?: boolean;
responsive?: any;
variant?: 'grid' | 'feed';
apiUrl?: string;
}
declare const PhotoCard: ({ pictureId, image, title, author, authorId, likes, comments, isLiked, description, onClick, onLike, onDelete, isVid, onEdit, createdAt, authorAvatarUrl, showContent, responsive, variant, apiUrl }: PhotoCardProps) => import("react/jsx-runtime").JSX.Element;
export default PhotoCard;

View File

@ -0,0 +1,38 @@
import { UserProfile } from '../pages/Post/types';
import { MediaType } from '../types';
import { FeedSortOption } from '../hooks/useFeedData';
export interface MediaItemType {
id: string;
picture_id?: string;
title: string;
description: string | null;
image_url: string;
thumbnail_url: string | null;
type: MediaType;
meta: any | null;
likes_count: number;
created_at: string;
user_id: string;
comments: {
count: number;
}[];
author_profile?: UserProfile;
job?: any;
responsive?: any;
}
interface MediaGridProps {
customPictures?: MediaItemType[];
customLoading?: boolean;
navigationSource?: 'home' | 'collection' | 'tag' | 'user' | 'widget';
navigationSourceId?: string;
isOwner?: boolean;
onFilesDrop?: (files: File[]) => void;
showVideos?: boolean;
sortBy?: FeedSortOption;
supabaseClient?: any;
apiUrl?: string;
}
declare const MediaGrid: ({ customPictures, customLoading, navigationSource, navigationSourceId, isOwner, onFilesDrop, showVideos, sortBy, supabaseClient, apiUrl }: MediaGridProps) => import("react/jsx-runtime").JSX.Element;
export default MediaGrid;
export { MediaGrid };
export declare const PhotoGrid: ({ customPictures, customLoading, navigationSource, navigationSourceId, isOwner, onFilesDrop, showVideos, sortBy, supabaseClient, apiUrl }: MediaGridProps) => import("react/jsx-runtime").JSX.Element;

View File

@ -0,0 +1,11 @@
interface PublishDialogProps {
isOpen: boolean;
onClose: () => void;
onPublish: (option: 'overwrite' | 'new' | 'version' | 'add-to-post', title?: string, description?: string, parentId?: string, collectionIds?: string[]) => void;
originalTitle: string;
originalImageId?: string;
isPublishing?: boolean;
editingPostId?: string;
}
export default function PublishDialog({ isOpen, onClose, onPublish, originalTitle, originalImageId, isPublishing, editingPostId }: PublishDialogProps): import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -0,0 +1,28 @@
import { default as React } from 'react';
interface ResponsiveImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> {
src: string | File;
sizes?: string;
className?: string;
imgClassName?: string;
responsiveSizes?: number[];
formats?: string[];
alt: string;
onDataLoaded?: (data: ResponsiveData) => void;
rootMargin?: string;
data?: ResponsiveData;
apiUrl?: string;
}
export interface ResponsiveData {
img: {
src: string;
width: number;
height: number;
format: string;
};
sources?: {
srcset: string;
type: string;
}[];
}
declare const ResponsiveImage: React.FC<ResponsiveImageProps>;
export default ResponsiveImage;

View File

@ -0,0 +1,12 @@
import { default as React } from 'react';
import { QuickAction } from '../constants';
interface StylePresetSelectorProps {
presets: QuickAction[];
onSelect: (preset: QuickAction) => void;
disabled?: boolean;
activeId?: string;
className?: string;
variant?: 'default' | 'minimal' | 'compact';
}
export declare const StylePresetSelector: React.FC<StylePresetSelectorProps>;
export {};

View File

@ -0,0 +1,14 @@
import { default as React } from 'react';
interface UserAvatarBlockProps {
userId: string;
avatarUrl?: string | null;
displayName?: string | null;
createdAt?: string;
className?: string;
showDate?: boolean;
onClick?: (e: React.MouseEvent) => void;
hoverStyle?: boolean;
textSize?: "xs" | "sm" | "base";
}
declare const UserAvatarBlock: React.FC<UserAvatarBlockProps>;
export default UserAvatarBlock;

View File

@ -0,0 +1,7 @@
import { default as React } from 'react';
interface VersionSelectorProps {
currentPictureId: string;
onVersionSelect: (selectedVersionId: string) => void;
}
declare const VersionSelector: React.FC<VersionSelectorProps>;
export default VersionSelector;

View File

@ -0,0 +1,26 @@
import { MuxResolution } from '../types';
interface VideoCardProps {
videoId: string;
videoUrl: string;
thumbnailUrl?: string;
title: string;
author: string;
authorId: string;
likes: number;
comments: number;
isLiked?: boolean;
description?: string | null;
onClick?: (videoId: string) => void;
onLike?: () => void;
onDelete?: () => void;
maxResolution?: MuxResolution;
authorAvatarUrl?: string | null;
showContent?: boolean;
created_at?: string;
job?: any;
variant?: 'grid' | 'feed';
showPlayButton?: boolean;
apiUrl?: string;
}
declare const VideoCard: ({ videoId, videoUrl, thumbnailUrl, title, author, authorId, likes, comments, isLiked, description, onClick, onLike, onDelete, maxResolution, authorAvatarUrl, showContent, showPlayButton, created_at, job, variant, apiUrl }: VideoCardProps) => import("react/jsx-runtime").JSX.Element;
export default VideoCard;

View File

@ -0,0 +1,8 @@
import { default as React } from 'react';
interface MilkdownEditorInternalProps {
value: string;
onChange: (value: string) => void;
className?: string;
}
declare const MilkdownEditorInternal: React.FC<MilkdownEditorInternalProps>;
export default MilkdownEditorInternal;

View File

@ -0,0 +1,20 @@
import * as React from "react";
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
declare const AlertDialogOverlay: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const AlertDialogContent: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const AlertDialogHeader: {
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
declare const AlertDialogFooter: {
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
declare const AlertDialogTitle: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
declare const AlertDialogDescription: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
declare const AlertDialogAction: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
declare const AlertDialogCancel: React.ForwardRefExoticComponent<Omit<AlertDialogPrimitive.AlertDialogCancelProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
export { AlertDialog, AlertDialogPortal, AlertDialogOverlay, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogFooter, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };

View File

@ -0,0 +1,6 @@
import * as React from "react";
import * as AvatarPrimitive from "@radix-ui/react-avatar";
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
export { Avatar, AvatarImage, AvatarFallback };

View File

@ -0,0 +1,9 @@
import { VariantProps } from 'class-variance-authority';
import * as React from "react";
declare const badgeVariants: (props?: {
variant?: "default" | "destructive" | "outline" | "secondary";
} & import('class-variance-authority/types').ClassProp) => string;
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
}
declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
export { Badge, badgeVariants };

View File

@ -0,0 +1,11 @@
import { VariantProps } from 'class-variance-authority';
import * as React from "react";
declare const buttonVariants: (props?: {
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost";
size?: "icon" | "default" | "sm" | "lg";
} & import('class-variance-authority/types').ClassProp) => string;
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
asChild?: boolean;
}
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
export { Button, buttonVariants };

View File

@ -0,0 +1,8 @@
import * as React from "react";
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };

View File

@ -0,0 +1,4 @@
import * as React from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
export { Checkbox };

View File

@ -0,0 +1,19 @@
import * as React from "react";
import * as DialogPrimitive from "@radix-ui/react-dialog";
declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DialogHeader: {
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
declare const DialogFooter: {
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };

View File

@ -0,0 +1,27 @@
import * as React from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
declare const DropdownMenuSub: React.FC<DropdownMenuPrimitive.DropdownMenuSubProps>;
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
inset?: boolean;
} & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
inset?: boolean;
} & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
inset?: boolean;
} & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const DropdownMenuShortcut: {
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };

View File

@ -0,0 +1,23 @@
import { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';
import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import('react-hook-form').FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
declare const useFormField: () => {
invalid: boolean;
isDirty: boolean;
isTouched: boolean;
isValidating: boolean;
error?: import('react-hook-form').FieldError;
id: string;
name: string;
formItemId: string;
formDescriptionId: string;
formMessageId: string;
};
declare const FormItem: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
declare const FormControl: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-slot').SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };

View File

@ -0,0 +1,3 @@
import * as React from "react";
declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
export { Input };

View File

@ -0,0 +1,5 @@
import { VariantProps } from 'class-variance-authority';
import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: import('class-variance-authority/types').ClassProp) => string> & React.RefAttributes<HTMLLabelElement>>;
export { Label };

View File

@ -0,0 +1,5 @@
import * as React from "react";
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
export { RadioGroup, RadioGroupItem };

View File

@ -0,0 +1,4 @@
import * as React from "react";
import * as SwitchPrimitives from "@radix-ui/react-switch";
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
export { Switch };

View File

@ -0,0 +1,7 @@
import * as React from "react";
import * as TabsPrimitive from "@radix-ui/react-tabs";
declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
export { Tabs, TabsList, TabsTrigger, TabsContent };

View File

@ -0,0 +1,5 @@
import * as React from "react";
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
}
declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
export { Textarea };

View File

@ -0,0 +1,23 @@
import { default as React } from 'react';
interface ImagePickerDialogProps {
isOpen: boolean;
onClose: () => void;
onSelect?: (pictureId: string) => void;
onMultiSelect?: (pictureIds: string[]) => void;
onMultiSelectPictures?: (pictures: Picture[]) => void;
currentValue?: string | null;
currentValues?: string[];
multiple?: boolean;
}
interface Picture {
id: string;
title: string;
image_url: string;
thumbnail_url?: string;
type?: string;
user_id: string;
tags: string[] | null;
meta: any;
}
export declare const ImagePickerDialog: React.FC<ImagePickerDialogProps>;
export {};

61
packages/ui/dist-lib/constants.d.ts vendored Normal file
View File

@ -0,0 +1,61 @@
export declare const ENABLE_ZOOM = true;
export declare enum TauriCommand {
SUBMIT_PROMPT = "submit_prompt",
LOG_ERROR = "log_error_to_console",
RESOLVE_PATH = "resolve_path_relative_to_home",
ADD_DEBUG_MESSAGE = "add_debug_message",
SEND_IPC_MESSAGE = "send_ipc_message",
REQUEST_CONFIG = "request_config_from_images",
GENERATE_IMAGE = "generate_image_via_backend",
REQUEST_FILE_DELETION = "request_file_deletion"
}
export declare enum TauriEvent {
CONFIG_RECEIVED = "config-received",
IMAGE_RECEIVED = "image-received",
GENERATION_ERROR = "generation-error",
GENERATION_COMPLETE = "generation-complete",
FILE_DELETED_SUCCESSFULLY = "file-deleted-successfully",
FILE_DELETION_ERROR = "file-deletion-error"
}
export declare const QUICK_STYLES: readonly ["cartoon style", "photorealistic", "noir style", "product mockup", "watercolor painting", "digital art", "minimalist design", "vintage poster", "cyberpunk aesthetic"];
export declare const QUICK_ACTIONS: readonly [{
readonly name: "Remove Background";
readonly prompt: "remove the background, make it transparent";
readonly iconName: "Eraser";
}, {
readonly name: "Cleanup";
readonly prompt: "clean up and enhance the image, remove noise and artifacts";
readonly iconName: "Sparkles";
}, {
readonly name: "Crop Foreground";
readonly prompt: "crop to focus on the main subject, remove unnecessary background";
readonly iconName: "Crop";
}, {
readonly name: "Improve Colors";
readonly prompt: "enhance colors, improve saturation and contrast";
readonly iconName: "Palette";
}, {
readonly name: "Product Presentation";
readonly prompt: "professional product photography style, clean background, studio lighting";
readonly iconName: "Package";
}];
export declare const AI_IMAGE_ANALYSIS_PROMPT: "Analyze this image and provide: 1) A creative, engaging title (max 50 characters), and 2) A detailed description. Format your response with 'Title: [your title]' on the first line, followed by the description on the next lines.";
export declare const PHOTO_GRID_THUMBNAIL_WIDTH = 600;
export declare const PHOTO_GRID_IMAGE_FORMAT: "jpg";
export declare const FEED_PAGE_SIZE = 30;
export declare const FEED_API_ENDPOINT = "/api/feed";
export declare const MAX_SPLIT_PROMPTS = 10;
/**
* Split a prompt into multiple lines for sequential generation
* @param prompt The full prompt text
* @param maxLines Maximum number of lines to accept (default: 10)
* @returns Array of prompt lines, trimmed and filtered for empty lines
*/
export declare const splitPromptByLines: (prompt: string, maxLines?: number) => string[];
export interface QuickAction {
id: string;
name: string;
prompt: string;
icon: string;
}
export declare const DEFAULT_QUICK_ACTIONS: QuickAction[];

View File

@ -0,0 +1,19 @@
import { default as React } from 'react';
import { FeedPost } from '../lib/db';
interface FeedCacheState {
posts: FeedPost[];
page: number;
hasMore: boolean;
scrollY: number;
timestamp: number;
}
interface FeedCacheContextType {
saveCache: (key: string, state: Omit<FeedCacheState, 'timestamp'>) => void;
getCache: (key: string) => FeedCacheState | null;
clearCache: (key?: string) => void;
}
export declare const FeedCacheProvider: React.FC<{
children: React.ReactNode;
}>;
export declare const useFeedCache: () => FeedCacheContextType;
export {};

View File

@ -0,0 +1,10 @@
import { ReactNode } from 'react';
interface OrganizationContextType {
orgSlug: string | null;
isOrgContext: boolean;
}
export declare const useOrganization: () => OrganizationContextType;
export declare const OrganizationProvider: ({ children }: {
children: ReactNode;
}) => import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -0,0 +1,14 @@
import { ReactNode } from 'react';
import { PostNavigationData } from '../types';
interface PostNavigationContextType {
navigationData: PostNavigationData | null;
setNavigationData: (data: PostNavigationData | null) => void;
preloadedImages: Map<string, boolean>;
preloadImage: (imageUrl: string) => void;
}
export declare const usePostNavigation: () => PostNavigationContextType;
interface PostNavigationProviderProps {
children: ReactNode;
}
export declare const PostNavigationProvider: ({ children }: PostNavigationProviderProps) => import("react/jsx-runtime").JSX.Element;
export {};

View File

@ -0,0 +1,13 @@
import { default as React } from 'react';
import { UserProfile } from '../pages/Post/types';
interface ProfilesContextType {
profiles: Record<string, UserProfile>;
fetchProfile: (userId: string) => Promise<UserProfile | null>;
fetchProfiles: (userIds: string[]) => Promise<void>;
isLoading: boolean;
}
export declare const ProfilesProvider: React.FC<{
children: React.ReactNode;
}>;
export declare const useProfiles: () => ProfilesContextType;
export {};

View File

@ -0,0 +1,71 @@
import { P as a, c as t } from "./prod-DTLJXtPo.js";
const i = {
r() {
return new a({
code: t.BadSignature,
reason: "missing WEBVTT file header",
line: 1
});
},
s(n, e) {
return new a({
code: t.BadTimestamp,
reason: `cue start timestamp \`${n}\` is invalid on line ${e}`,
line: e
});
},
t(n, e) {
return new a({
code: t.BadTimestamp,
reason: `cue end timestamp \`${n}\` is invalid on line ${e}`,
line: e
});
},
u(n, e, r) {
return new a({
code: t.BadTimestamp,
reason: `cue end timestamp \`${e}\` is greater than start \`${n}\` on line ${r}`,
line: r
});
},
y(n, e, r) {
return new a({
code: t.BadSettingValue,
reason: `invalid value for cue setting \`${n}\` on line ${r} (value: ${e})`,
line: r
});
},
x(n, e, r) {
return new a({
code: t.UnknownSetting,
reason: `unknown cue setting \`${n}\` on line ${r} (value: ${e})`,
line: r
});
},
w(n, e, r) {
return new a({
code: t.BadSettingValue,
reason: `invalid value for region setting \`${n}\` on line ${r} (value: ${e})`,
line: r
});
},
v(n, e, r) {
return new a({
code: t.UnknownSetting,
reason: `unknown region setting \`${n}\` on line ${r} (value: ${e})`,
line: r
});
},
// SSA-specific errors
T(n, e) {
return new a({
code: t.BadFormat,
reason: `format missing for \`${n}\` block on line ${e}`,
line: e
});
}
};
export {
i as ParseErrorBuilder
};
//# sourceMappingURL=errors-DCJKAXTz.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"errors-DCJKAXTz.js","sources":["../node_modules/media-captions/dist/prod/errors.js"],"sourcesContent":["import { P as ParseError, c as ParseErrorCode } from './index.js';\n\nconst ParseErrorBuilder = {\n r() {\n return new ParseError({\n code: ParseErrorCode.BadSignature,\n reason: \"missing WEBVTT file header\",\n line: 1\n });\n },\n s(startTime, line) {\n return new ParseError({\n code: ParseErrorCode.BadTimestamp,\n reason: `cue start timestamp \\`${startTime}\\` is invalid on line ${line}`,\n line\n });\n },\n t(endTime, line) {\n return new ParseError({\n code: ParseErrorCode.BadTimestamp,\n reason: `cue end timestamp \\`${endTime}\\` is invalid on line ${line}`,\n line\n });\n },\n u(startTime, endTime, line) {\n return new ParseError({\n code: ParseErrorCode.BadTimestamp,\n reason: `cue end timestamp \\`${endTime}\\` is greater than start \\`${startTime}\\` on line ${line}`,\n line\n });\n },\n y(name, value, line) {\n return new ParseError({\n code: ParseErrorCode.BadSettingValue,\n reason: `invalid value for cue setting \\`${name}\\` on line ${line} (value: ${value})`,\n line\n });\n },\n x(name, value, line) {\n return new ParseError({\n code: ParseErrorCode.UnknownSetting,\n reason: `unknown cue setting \\`${name}\\` on line ${line} (value: ${value})`,\n line\n });\n },\n w(name, value, line) {\n return new ParseError({\n code: ParseErrorCode.BadSettingValue,\n reason: `invalid value for region setting \\`${name}\\` on line ${line} (value: ${value})`,\n line\n });\n },\n v(name, value, line) {\n return new ParseError({\n code: ParseErrorCode.UnknownSetting,\n reason: `unknown region setting \\`${name}\\` on line ${line} (value: ${value})`,\n line\n });\n },\n // SSA-specific errors\n T(type, line) {\n return new ParseError({\n code: ParseErrorCode.BadFormat,\n reason: `format missing for \\`${type}\\` block on line ${line}`,\n line\n });\n }\n};\n\nexport { ParseErrorBuilder };\n"],"names":["ParseErrorBuilder","ParseError","ParseErrorCode","startTime","line","endTime","name","value","type"],"mappings":";AAEK,MAACA,IAAoB;AAAA,EACxB,IAAI;AACF,WAAO,IAAIC,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ;AAAA,MACR,MAAM;AAAA,IACZ,CAAK;AAAA,EACH;AAAA,EACA,EAAEC,GAAWC,GAAM;AACjB,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,yBAAyBC,CAAS,yBAAyBC,CAAI;AAAA,MACvE,MAAAA;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAEC,GAASD,GAAM;AACf,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,uBAAuBG,CAAO,yBAAyBD,CAAI;AAAA,MACnE,MAAAA;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAED,GAAWE,GAASD,GAAM;AAC1B,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,uBAAuBG,CAAO,8BAA8BF,CAAS,cAAcC,CAAI;AAAA,MAC/F,MAAAA;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAEE,GAAMC,GAAOH,GAAM;AACnB,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,mCAAmCI,CAAI,cAAcF,CAAI,YAAYG,CAAK;AAAA,MAClF,MAAAH;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAEE,GAAMC,GAAOH,GAAM;AACnB,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,yBAAyBI,CAAI,cAAcF,CAAI,YAAYG,CAAK;AAAA,MACxE,MAAAH;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAEE,GAAMC,GAAOH,GAAM;AACnB,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,sCAAsCI,CAAI,cAAcF,CAAI,YAAYG,CAAK;AAAA,MACrF,MAAAH;AAAA,IACN,CAAK;AAAA,EACH;AAAA,EACA,EAAEE,GAAMC,GAAOH,GAAM;AACnB,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,4BAA4BI,CAAI,cAAcF,CAAI,YAAYG,CAAK;AAAA,MAC3E,MAAAH;AAAA,IACN,CAAK;AAAA,EACH;AAAA;AAAA,EAEA,EAAEI,GAAMJ,GAAM;AACZ,WAAO,IAAIH,EAAW;AAAA,MACpB,MAAMC,EAAe;AAAA,MACrB,QAAQ,wBAAwBM,CAAI,oBAAoBJ,CAAI;AAAA,MAC5D,MAAAA;AAAA,IACN,CAAK;AAAA,EACH;AACF;","x_google_ignoreList":[0]}

View File

@ -0,0 +1,44 @@
import { ToastActionElement, ToastProps } from '../components/ui/toast';
import * as React from "react";
type ToasterToast = ToastProps & {
id: string;
title?: React.ReactNode;
description?: React.ReactNode;
action?: ToastActionElement;
};
declare const actionTypes: {
readonly ADD_TOAST: "ADD_TOAST";
readonly UPDATE_TOAST: "UPDATE_TOAST";
readonly DISMISS_TOAST: "DISMISS_TOAST";
readonly REMOVE_TOAST: "REMOVE_TOAST";
};
type ActionType = typeof actionTypes;
type Action = {
type: ActionType["ADD_TOAST"];
toast: ToasterToast;
} | {
type: ActionType["UPDATE_TOAST"];
toast: Partial<ToasterToast>;
} | {
type: ActionType["DISMISS_TOAST"];
toastId?: ToasterToast["id"];
} | {
type: ActionType["REMOVE_TOAST"];
toastId?: ToasterToast["id"];
};
interface State {
toasts: ToasterToast[];
}
export declare const reducer: (state: State, action: Action) => State;
type Toast = Omit<ToasterToast, "id">;
declare function toast({ ...props }: Toast): {
id: string;
dismiss: () => void;
update: (props: ToasterToast) => void;
};
declare function useToast(): {
toast: typeof toast;
dismiss: (toastId?: string) => void;
toasts: ToasterToast[];
};
export { useToast, toast };

26
packages/ui/dist-lib/hooks/useAuth.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
import { User, Session } from '@supabase/supabase-js';
interface AuthContextType {
user: User | null;
session: Session | null;
roles: string[];
loading: boolean;
signUp: (email: string, password: string, username: string, displayName: string) => Promise<{
data: any;
error: any;
}>;
signIn: (email: string, password: string) => Promise<{
error: any;
}>;
signInWithGithub: () => Promise<{
error: any;
}>;
signInWithGoogle: () => Promise<{
error: any;
}>;
signOut: () => Promise<void>;
}
export declare const AuthProvider: ({ children }: {
children: React.ReactNode;
}) => import("react/jsx-runtime").JSX.Element;
export declare const useAuth: () => AuthContextType;
export {};

View File

@ -0,0 +1,20 @@
import { FeedPost } from '../lib/db';
export type FeedSortOption = 'latest' | 'top';
interface UseFeedDataProps {
source?: 'home' | 'collection' | 'tag' | 'user';
sourceId?: string;
isOrgContext?: boolean;
orgSlug?: string;
enabled?: boolean;
sortBy?: FeedSortOption;
supabaseClient?: any;
}
export declare const useFeedData: ({ source, sourceId, isOrgContext, orgSlug, enabled, sortBy, supabaseClient }: UseFeedDataProps) => {
posts: FeedPost[];
loading: boolean;
error: Error;
hasMore: boolean;
loadMore: () => void;
isFetchingMore: boolean;
};
export {};

View File

@ -0,0 +1,13 @@
/**
* usePostNavigation Hook
*
* Compatibility wrapper around Zustand navigationStore
* Provides same API as old PostNavigationContext for easy migration
*/
export declare const usePostNavigation: () => {
navigationData: import('../stores/navigationStore').NavigationData;
setNavigationData: (data: import('../stores/navigationStore').NavigationData | null) => void;
preloadImage: (url: string) => void;
updateCurrentIndex: (index: number) => void;
};
export default usePostNavigation;

View File

@ -0,0 +1,14 @@
import { ResponsiveData } from '../components/ResponsiveImage';
interface UseResponsiveImageProps {
src: string | File | null;
responsiveSizes?: number[];
formats?: string[];
enabled?: boolean;
apiUrl?: string;
}
export declare const useResponsiveImage: ({ src, responsiveSizes, formats, enabled, apiUrl, }: UseResponsiveImageProps) => {
data: ResponsiveData;
loading: boolean;
error: string;
};
export {};

View File

@ -0,0 +1,16 @@
/**
* useWizardContext Hook
*
* Replaces sessionStorage for wizard initial image and return path
* Uses Zustand store with localStorage persistence
*/
export declare const useWizardContext: () => {
wizardInitialImage: import('../stores/navigationStore').WizardInitialImage;
wizardReturnPath: string;
setWizardImage: (image: import('../stores/navigationStore').WizardInitialImage | null, returnPath?: string) => void;
clearWizardImage: () => void;
creationWizardOpen: boolean;
creationWizardMode: "page" | "default";
setCreationWizardOpen: (open: boolean, mode?: "default" | "page") => void;
};
export default useWizardContext;

23
packages/ui/dist-lib/i18n.d.ts vendored Normal file
View File

@ -0,0 +1,23 @@
import { default as React, ReactNode } from 'react';
type LangCode = 'en' | 'fr' | 'sw' | 'de' | 'es' | 'it' | 'ja' | 'ko' | 'pt' | 'ru' | 'tr' | 'zh' | 'nl';
export declare const supportedLanguages: {
code: string;
name: string;
}[];
export declare const getCurrentLang: () => LangCode;
export declare const setLanguage: (langCode: LangCode) => void;
export declare const translate: (textKey: string, langParam?: LangCode) => string;
interface TProps {
children: ReactNode;
}
declare const T: React.FC<TProps>;
export declare const getTranslationCache: (lang?: LangCode) => Record<string, string> | Record<string, Record<string, string>>;
export declare const downloadTranslations: (lang?: LangCode) => void;
export declare const getTranslationStatus: (lang?: LangCode) => Record<string, {
loaded: boolean;
keysCount: number;
}> | {
loaded: boolean;
keysCount: number;
};
export { T };

40
packages/ui/dist-lib/image-api.d.ts vendored Normal file
View File

@ -0,0 +1,40 @@
export interface ImageGenerationRequest {
prompt: string;
width?: number;
height?: number;
model?: string;
}
export interface ImageGenerationResponse {
success: boolean;
imagePath?: string;
imageUrl?: string;
text?: string;
error?: string;
}
export interface ImageEditRequest {
imagePath: string;
prompt: string;
action: string;
}
interface ImageResult {
imageData: ArrayBuffer;
text?: string;
}
export declare const getGoogleApiKey: () => Promise<string | null>;
export declare const createImage: (prompt: string, model?: string, apiKey?: string, aspectRatio?: string, resolution?: string, enableSearchGrounding?: boolean) => Promise<ImageResult | null>;
export declare const editImage: (prompt: string, imageFiles: File[], model?: string, apiKey?: string, aspectRatio?: string, resolution?: string, enableSearchGrounding?: boolean) => Promise<ImageResult | null>;
export declare const imageApi: {
generateImage: (request: ImageGenerationRequest) => Promise<ImageGenerationResponse>;
editImage: (request: ImageEditRequest) => Promise<ImageGenerationResponse>;
uploadImage: (file: File) => Promise<{
success: boolean;
path?: string;
error?: string;
}>;
downloadImage: (url: string) => Promise<{
success: boolean;
path?: string;
error?: string;
}>;
};
export {};

View File

@ -0,0 +1,897 @@
import { Database } from './types';
export declare const supabase: import('@supabase/supabase-js').SupabaseClient<Database, "public", "public", {
Tables: {
collection_pictures: {
Row: {
added_at: string;
collection_id: string;
id: string;
picture_id: string;
};
Insert: {
added_at?: string;
collection_id: string;
id?: string;
picture_id: string;
};
Update: {
added_at?: string;
collection_id?: string;
id?: string;
picture_id?: string;
};
Relationships: [{
foreignKeyName: "collection_pictures_collection_id_fkey";
columns: ["collection_id"];
isOneToOne: false;
referencedRelation: "collections";
referencedColumns: ["id"];
}, {
foreignKeyName: "collection_pictures_picture_id_fkey";
columns: ["picture_id"];
isOneToOne: false;
referencedRelation: "pictures";
referencedColumns: ["id"];
}];
};
collection_posts: {
Row: {
collection_id: string;
created_at: string;
id: string;
post_id: string;
};
Insert: {
collection_id: string;
created_at?: string;
id?: string;
post_id: string;
};
Update: {
collection_id?: string;
created_at?: string;
id?: string;
post_id?: string;
};
Relationships: [{
foreignKeyName: "collection_posts_collection_id_fkey";
columns: ["collection_id"];
isOneToOne: false;
referencedRelation: "collections";
referencedColumns: ["id"];
}, {
foreignKeyName: "collection_posts_post_id_fkey";
columns: ["post_id"];
isOneToOne: false;
referencedRelation: "posts";
referencedColumns: ["id"];
}];
};
collections: {
Row: {
content: import('./types').Json | null;
created_at: string;
description: string | null;
id: string;
is_public: boolean;
layout: import('./types').Json | null;
name: string;
slug: string;
updated_at: string;
user_id: string;
};
Insert: {
content?: import('./types').Json | null;
created_at?: string;
description?: string | null;
id?: string;
is_public?: boolean;
layout?: import('./types').Json | null;
name: string;
slug: string;
updated_at?: string;
user_id: string;
};
Update: {
content?: import('./types').Json | null;
created_at?: string;
description?: string | null;
id?: string;
is_public?: boolean;
layout?: import('./types').Json | null;
name?: string;
slug?: string;
updated_at?: string;
user_id?: string;
};
Relationships: [];
};
comment_likes: {
Row: {
comment_id: string;
created_at: string;
id: string;
user_id: string;
};
Insert: {
comment_id: string;
created_at?: string;
id?: string;
user_id: string;
};
Update: {
comment_id?: string;
created_at?: string;
id?: string;
user_id?: string;
};
Relationships: [];
};
comments: {
Row: {
content: string;
created_at: string;
id: string;
likes_count: number | null;
parent_comment_id: string | null;
picture_id: string;
updated_at: string;
user_id: string;
};
Insert: {
content: string;
created_at?: string;
id?: string;
likes_count?: number | null;
parent_comment_id?: string | null;
picture_id: string;
updated_at?: string;
user_id: string;
};
Update: {
content?: string;
created_at?: string;
id?: string;
likes_count?: number | null;
parent_comment_id?: string | null;
picture_id?: string;
updated_at?: string;
user_id?: string;
};
Relationships: [{
foreignKeyName: "comments_parent_fk";
columns: ["parent_comment_id"];
isOneToOne: false;
referencedRelation: "comments";
referencedColumns: ["id"];
}];
};
context_definitions: {
Row: {
created_at: string | null;
default_filters: import('./types').Json;
default_templates: import('./types').Json;
description: string | null;
display_name: string;
icon: string | null;
id: string;
is_active: boolean | null;
name: string;
updated_at: string | null;
};
Insert: {
created_at?: string | null;
default_filters?: import('./types').Json;
default_templates?: import('./types').Json;
description?: string | null;
display_name: string;
icon?: string | null;
id?: string;
is_active?: boolean | null;
name: string;
updated_at?: string | null;
};
Update: {
created_at?: string | null;
default_filters?: import('./types').Json;
default_templates?: import('./types').Json;
description?: string | null;
display_name?: string;
icon?: string | null;
id?: string;
is_active?: boolean | null;
name?: string;
updated_at?: string | null;
};
Relationships: [];
};
filter_usage_logs: {
Row: {
context: string;
created_at: string | null;
error_message: string | null;
filters_applied: string[] | null;
id: string;
input_length: number;
model: string;
output_length: number;
processing_time_ms: number;
provider: string;
success: boolean;
template_id: string | null;
user_id: string | null;
};
Insert: {
context: string;
created_at?: string | null;
error_message?: string | null;
filters_applied?: string[] | null;
id?: string;
input_length: number;
model: string;
output_length: number;
processing_time_ms: number;
provider: string;
success: boolean;
template_id?: string | null;
user_id?: string | null;
};
Update: {
context?: string;
created_at?: string | null;
error_message?: string | null;
filters_applied?: string[] | null;
id?: string;
input_length?: number;
model?: string;
output_length?: number;
processing_time_ms?: number;
provider?: string;
success?: boolean;
template_id?: string | null;
user_id?: string | null;
};
Relationships: [{
foreignKeyName: "filter_usage_logs_template_id_fkey";
columns: ["template_id"];
isOneToOne: false;
referencedRelation: "user_templates";
referencedColumns: ["id"];
}];
};
likes: {
Row: {
created_at: string;
id: string;
picture_id: string;
user_id: string;
};
Insert: {
created_at?: string;
id?: string;
picture_id: string;
user_id: string;
};
Update: {
created_at?: string;
id?: string;
picture_id?: string;
user_id?: string;
};
Relationships: [];
};
organizations: {
Row: {
created_at: string;
id: string;
name: string;
slug: string;
updated_at: string;
};
Insert: {
created_at?: string;
id?: string;
name: string;
slug: string;
updated_at?: string;
};
Update: {
created_at?: string;
id?: string;
name?: string;
slug?: string;
updated_at?: string;
};
Relationships: [];
};
page_collaborators: {
Row: {
created_at: string;
id: string;
page_id: string;
role: Database["public"]["Enums"]["collaborator_role"];
user_id: string;
};
Insert: {
created_at?: string;
id?: string;
page_id: string;
role?: Database["public"]["Enums"]["collaborator_role"];
user_id: string;
};
Update: {
created_at?: string;
id?: string;
page_id?: string;
role?: Database["public"]["Enums"]["collaborator_role"];
user_id?: string;
};
Relationships: [{
foreignKeyName: "page_collaborators_page_id_fkey";
columns: ["page_id"];
isOneToOne: false;
referencedRelation: "pages";
referencedColumns: ["id"];
}];
};
pages: {
Row: {
content: import('./types').Json | null;
created_at: string;
id: string;
is_public: boolean;
owner: string;
parent: string | null;
slug: string;
tags: string[] | null;
title: string;
type: string | null;
updated_at: string;
visible: boolean;
};
Insert: {
content?: import('./types').Json | null;
created_at?: string;
id?: string;
is_public?: boolean;
owner: string;
parent?: string | null;
slug: string;
tags?: string[] | null;
title: string;
type?: string | null;
updated_at?: string;
visible?: boolean;
};
Update: {
content?: import('./types').Json | null;
created_at?: string;
id?: string;
is_public?: boolean;
owner?: string;
parent?: string | null;
slug?: string;
tags?: string[] | null;
title?: string;
type?: string | null;
updated_at?: string;
visible?: boolean;
};
Relationships: [{
foreignKeyName: "pages_parent_fkey";
columns: ["parent"];
isOneToOne: false;
referencedRelation: "pages";
referencedColumns: ["id"];
}];
};
pictures: {
Row: {
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('./types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
};
Insert: {
created_at?: string;
description?: string | null;
flags?: string[] | null;
id?: string;
image_url: string;
is_selected?: boolean;
likes_count?: number | null;
meta?: import('./types').Json | null;
organization_id?: string | null;
parent_id?: string | null;
position?: number | null;
post_id?: string | null;
tags?: string[] | null;
thumbnail_url?: string | null;
title: string;
type?: string | null;
updated_at?: string;
user_id: string;
visible?: boolean;
};
Update: {
created_at?: string;
description?: string | null;
flags?: string[] | null;
id?: string;
image_url?: string;
is_selected?: boolean;
likes_count?: number | null;
meta?: import('./types').Json | null;
organization_id?: string | null;
parent_id?: string | null;
position?: number | null;
post_id?: string | null;
tags?: string[] | null;
thumbnail_url?: string | null;
title?: string;
type?: string | null;
updated_at?: string;
user_id?: string;
visible?: boolean;
};
Relationships: [{
foreignKeyName: "pictures_organization_id_fkey";
columns: ["organization_id"];
isOneToOne: false;
referencedRelation: "organizations";
referencedColumns: ["id"];
}, {
foreignKeyName: "pictures_parent_id_fkey";
columns: ["parent_id"];
isOneToOne: false;
referencedRelation: "pictures";
referencedColumns: ["id"];
}, {
foreignKeyName: "pictures_post_id_fkey";
columns: ["post_id"];
isOneToOne: false;
referencedRelation: "posts";
referencedColumns: ["id"];
}];
};
posts: {
Row: {
created_at: string | null;
description: string | null;
id: string;
meta: import('./types').Json | null;
settings: import('./types').Json | null;
title: string;
updated_at: string | null;
user_id: string;
};
Insert: {
created_at?: string | null;
description?: string | null;
id?: string;
meta?: import('./types').Json | null;
settings?: import('./types').Json | null;
title: string;
updated_at?: string | null;
user_id: string;
};
Update: {
created_at?: string | null;
description?: string | null;
id?: string;
meta?: import('./types').Json | null;
settings?: import('./types').Json | null;
title?: string;
updated_at?: string | null;
user_id?: string;
};
Relationships: [];
};
profiles: {
Row: {
aimlapi_api_key: string | null;
avatar_url: string | null;
bio: string | null;
bria_api_key: string | null;
created_at: string;
display_name: string | null;
google_api_key: string | null;
huggingface_api_key: string | null;
id: string;
openai_api_key: string | null;
pages: import('./types').Json | null;
replicate_api_key: string | null;
settings: import('./types').Json | null;
updated_at: string;
user_id: string;
username: string | null;
};
Insert: {
aimlapi_api_key?: string | null;
avatar_url?: string | null;
bio?: string | null;
bria_api_key?: string | null;
created_at?: string;
display_name?: string | null;
google_api_key?: string | null;
huggingface_api_key?: string | null;
id?: string;
openai_api_key?: string | null;
pages?: import('./types').Json | null;
replicate_api_key?: string | null;
settings?: import('./types').Json | null;
updated_at?: string;
user_id: string;
username?: string | null;
};
Update: {
aimlapi_api_key?: string | null;
avatar_url?: string | null;
bio?: string | null;
bria_api_key?: string | null;
created_at?: string;
display_name?: string | null;
google_api_key?: string | null;
huggingface_api_key?: string | null;
id?: string;
openai_api_key?: string | null;
pages?: import('./types').Json | null;
replicate_api_key?: string | null;
settings?: import('./types').Json | null;
updated_at?: string;
user_id?: string;
username?: string | null;
};
Relationships: [];
};
provider_configs: {
Row: {
base_url: string;
created_at: string | null;
display_name: string;
id: string;
is_active: boolean | null;
models: import('./types').Json;
name: string;
rate_limits: import('./types').Json | null;
settings: import('./types').Json | null;
updated_at: string | null;
user_id: string | null;
};
Insert: {
base_url: string;
created_at?: string | null;
display_name: string;
id?: string;
is_active?: boolean | null;
models?: import('./types').Json;
name: string;
rate_limits?: import('./types').Json | null;
settings?: import('./types').Json | null;
updated_at?: string | null;
user_id?: string | null;
};
Update: {
base_url?: string;
created_at?: string | null;
display_name?: string;
id?: string;
is_active?: boolean | null;
models?: import('./types').Json;
name?: string;
rate_limits?: import('./types').Json | null;
settings?: import('./types').Json | null;
updated_at?: string | null;
user_id?: string | null;
};
Relationships: [];
};
role_permissions: {
Row: {
created_at: string;
id: string;
permission: Database["public"]["Enums"]["app_permission"];
role: Database["public"]["Enums"]["app_role"];
};
Insert: {
created_at?: string;
id?: string;
permission: Database["public"]["Enums"]["app_permission"];
role: Database["public"]["Enums"]["app_role"];
};
Update: {
created_at?: string;
id?: string;
permission?: Database["public"]["Enums"]["app_permission"];
role?: Database["public"]["Enums"]["app_role"];
};
Relationships: [];
};
user_filter_configs: {
Row: {
context: string;
created_at: string | null;
custom_filters: import('./types').Json | null;
default_templates: string[] | null;
id: string;
is_default: boolean | null;
model: string;
provider: string;
updated_at: string | null;
user_id: string | null;
variables: import('./types').Json | null;
};
Insert: {
context: string;
created_at?: string | null;
custom_filters?: import('./types').Json | null;
default_templates?: string[] | null;
id?: string;
is_default?: boolean | null;
model?: string;
provider?: string;
updated_at?: string | null;
user_id?: string | null;
variables?: import('./types').Json | null;
};
Update: {
context?: string;
created_at?: string | null;
custom_filters?: import('./types').Json | null;
default_templates?: string[] | null;
id?: string;
is_default?: boolean | null;
model?: string;
provider?: string;
updated_at?: string | null;
user_id?: string | null;
variables?: import('./types').Json | null;
};
Relationships: [];
};
user_organizations: {
Row: {
created_at: string;
id: string;
organization_id: string;
role: string;
updated_at: string;
user_id: string;
};
Insert: {
created_at?: string;
id?: string;
organization_id: string;
role?: string;
updated_at?: string;
user_id: string;
};
Update: {
created_at?: string;
id?: string;
organization_id?: string;
role?: string;
updated_at?: string;
user_id?: string;
};
Relationships: [{
foreignKeyName: "user_organizations_organization_id_fkey";
columns: ["organization_id"];
isOneToOne: false;
referencedRelation: "organizations";
referencedColumns: ["id"];
}];
};
user_roles: {
Row: {
created_at: string;
id: string;
organization_id: string | null;
role: Database["public"]["Enums"]["app_role"];
updated_at: string;
user_id: string;
};
Insert: {
created_at?: string;
id?: string;
organization_id?: string | null;
role: Database["public"]["Enums"]["app_role"];
updated_at?: string;
user_id: string;
};
Update: {
created_at?: string;
id?: string;
organization_id?: string | null;
role?: Database["public"]["Enums"]["app_role"];
updated_at?: string;
user_id?: string;
};
Relationships: [{
foreignKeyName: "user_roles_user_id_fkey";
columns: ["user_id"];
isOneToOne: false;
referencedRelation: "profiles";
referencedColumns: ["user_id"];
}];
};
user_secrets: {
Row: {
aimlapi_api_key: string | null;
bria_api_key: string | null;
created_at: string;
google_api_key: string | null;
huggingface_api_key: string | null;
is_admin: boolean | null;
openai_api_key: string | null;
replicate_api_key: string | null;
settings: import('./types').Json | null;
updated_at: string;
user_id: string;
};
Insert: {
aimlapi_api_key?: string | null;
bria_api_key?: string | null;
created_at?: string;
google_api_key?: string | null;
huggingface_api_key?: string | null;
is_admin?: boolean | null;
openai_api_key?: string | null;
replicate_api_key?: string | null;
settings?: import('./types').Json | null;
updated_at?: string;
user_id: string;
};
Update: {
aimlapi_api_key?: string | null;
bria_api_key?: string | null;
created_at?: string;
google_api_key?: string | null;
huggingface_api_key?: string | null;
is_admin?: boolean | null;
openai_api_key?: string | null;
replicate_api_key?: string | null;
settings?: import('./types').Json | null;
updated_at?: string;
user_id?: string;
};
Relationships: [];
};
user_templates: {
Row: {
context: string;
created_at: string | null;
description: string | null;
filters: string[] | null;
format: string | null;
id: string;
is_public: boolean | null;
model: string;
name: string;
prompt: string;
provider: string;
updated_at: string | null;
usage_count: number | null;
user_id: string | null;
};
Insert: {
context: string;
created_at?: string | null;
description?: string | null;
filters?: string[] | null;
format?: string | null;
id?: string;
is_public?: boolean | null;
model?: string;
name: string;
prompt: string;
provider?: string;
updated_at?: string | null;
usage_count?: number | null;
user_id?: string | null;
};
Update: {
context?: string;
created_at?: string | null;
description?: string | null;
filters?: string[] | null;
format?: string | null;
id?: string;
is_public?: boolean | null;
model?: string;
name?: string;
prompt?: string;
provider?: string;
updated_at?: string | null;
usage_count?: number | null;
user_id?: string | null;
};
Relationships: [];
};
wizard_sessions: {
Row: {
created_at: string;
generated_image_url: string | null;
id: string;
input_images: string[] | null;
prompt: string;
status: string;
updated_at: string;
user_id: string;
};
Insert: {
created_at?: string;
generated_image_url?: string | null;
id?: string;
input_images?: string[] | null;
prompt?: string;
status?: string;
updated_at?: string;
user_id: string;
};
Update: {
created_at?: string;
generated_image_url?: string | null;
id?: string;
input_images?: string[] | null;
prompt?: string;
status?: string;
updated_at?: string;
user_id?: string;
};
Relationships: [];
};
};
Views: { [_ in never]: never; };
Functions: {
authorize: {
Args: {
_role: Database["public"]["Enums"]["app_role"];
_user_id: string;
};
Returns: boolean;
};
has_permission: {
Args: {
_permission: Database["public"]["Enums"]["app_permission"];
_user_id: string;
};
Returns: boolean;
};
is_page_collaborator: {
Args: {
_page_id: string;
};
Returns: boolean;
};
is_page_owner: {
Args: {
_page_id: string;
};
Returns: boolean;
};
};
Enums: {
app_permission: "pictures.read" | "pictures.create" | "pictures.update" | "pictures.delete" | "collections.read" | "collections.create" | "collections.update" | "collections.delete" | "comments.read" | "comments.create" | "comments.update" | "comments.delete" | "organization.manage";
app_role: "owner" | "admin" | "member" | "viewer";
collaborator_role: "viewer" | "editor" | "owner";
};
CompositeTypes: { [_ in never]: never; };
}, {
PostgrestVersion: "13.0.5";
}>;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
packages/ui/dist-lib/lib-export.d.ts vendored Normal file
View File

@ -0,0 +1,4 @@
export { default as ResponsiveImage } from './components/ResponsiveImage';
export type { ResponsiveData } from './components/ResponsiveImage';
export { default as PhotoGrid } from './components/PhotoGrid';
export { MediaGrid } from './components/PhotoGrid';

21
packages/ui/dist-lib/lib/aimlapi.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
declare const logger: {
debug: (message: string, data?: any) => void;
info: (message: string, data?: any) => void;
warn: (message: string, data?: any) => void;
error: (message: string, data?: any) => void;
};
interface ImageResult {
imageData: ArrayBuffer;
text?: string;
}
/**
* Generate image using AIML API text-to-image
* Supports various models including ByteDance SeeDream v4, Flux, Stable Diffusion, etc.
*/
export declare const createImageWithAimlApi: (prompt: string, model?: string, apiKey?: string) => Promise<ImageResult | null>;
/**
* Edit image using AIML API image-to-image
* Supports models like SeeDream v4 Edit, SeedEdit 3.0, Flux i2i, etc.
*/
export declare const editImageWithAimlApi: (prompt: string, imageFiles: File[], model?: string, apiKey?: string) => Promise<ImageResult | null>;
export { logger };

21
packages/ui/dist-lib/lib/bria.d.ts vendored Normal file
View File

@ -0,0 +1,21 @@
declare const logger: {
debug: (message: string, data?: any) => void;
info: (message: string, data?: any) => void;
warn: (message: string, data?: any) => void;
error: (message: string, data?: any) => void;
};
interface ImageResult {
imageData: ArrayBuffer;
text?: string;
}
/**
* Generate image using Bria text-to-image API
* Uses the fast endpoint with model version 3.2 for good balance of speed and quality
*/
export declare const createImageWithBria: (prompt: string, model?: string, apiKey?: string) => Promise<ImageResult | null>;
/**
* Edit image using Bria reimagine API (structure reference)
* Maintains the structure and depth of the input while incorporating new materials, colors, and textures
*/
export declare const editImageWithBria: (prompt: string, imageFiles: File[], model?: string, apiKey?: string) => Promise<ImageResult | null>;
export { logger };

231
packages/ui/dist-lib/lib/db.d.ts vendored Normal file
View File

@ -0,0 +1,231 @@
import { UserProfile, PostMediaItem } from '../pages/Post/types';
import { MediaType, MediaItem } from '../types';
import { SupabaseClient } from '@supabase/supabase-js';
export declare const fetchPostById: (id: string, client?: SupabaseClient) => Promise<{
created_at: string | null;
description: string | null;
id: string;
meta: import('../integrations/supabase/types').Json | null;
settings: import('../integrations/supabase/types').Json | null;
title: string;
updated_at: string | null;
user_id: string;
pictures: {
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}[];
}>;
export declare const fetchPictureById: (id: string, client?: SupabaseClient) => Promise<{
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
post: {
created_at: string | null;
description: string | null;
id: string;
meta: import('../integrations/supabase/types').Json | null;
settings: import('../integrations/supabase/types').Json | null;
title: string;
updated_at: string | null;
user_id: string;
};
}>;
export declare const fetchPageById: (id: string, client?: SupabaseClient) => Promise<{
content: import('../integrations/supabase/types').Json | null;
created_at: string;
id: string;
is_public: boolean;
owner: string;
parent: string | null;
slug: string;
tags: string[] | null;
title: string;
type: string | null;
updated_at: string;
visible: boolean;
}>;
export declare const fetchFullPost: (postId: string, client?: SupabaseClient) => Promise<{
created_at: string | null;
description: string | null;
id: string;
meta: import('../integrations/supabase/types').Json | null;
settings: import('../integrations/supabase/types').Json | null;
title: string;
updated_at: string | null;
user_id: string;
pictures: {
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}[];
}>;
export declare const fetchAuthorProfile: (userId: string, client?: SupabaseClient) => Promise<UserProfile | null>;
export declare const fetchVersions: (mediaItem: PostMediaItem, userId?: string, client?: SupabaseClient) => Promise<{
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}[]>;
export declare const checkLikeStatus: (userId: string, pictureId: string, client?: SupabaseClient) => Promise<boolean>;
export declare const toggleLike: (userId: string, pictureId: string, isLiked: boolean, client?: SupabaseClient) => Promise<boolean>;
export declare const uploadFileToStorage: (userId: string, file: File | Blob, fileName?: string, client?: SupabaseClient) => Promise<string>;
export declare const createPicture: (picture: Partial<PostMediaItem>, client?: SupabaseClient) => Promise<{
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}>;
export declare const updatePostDetails: (postId: string, updates: {
title: string;
description: string;
}, client?: SupabaseClient) => Promise<void>;
export declare const unlinkPictures: (ids: string[], client?: SupabaseClient) => Promise<void>;
export declare const upsertPictures: (pictures: Partial<PostMediaItem>[], client?: SupabaseClient) => Promise<void>;
export declare const getUserSettings: (userId: string, client?: SupabaseClient) => Promise<any>;
export declare const updateUserSettings: (userId: string, settings: any, client?: SupabaseClient) => Promise<void>;
export declare const getUserOpenAIKey: (userId: string, client?: SupabaseClient) => Promise<any>;
export declare const addCollectionPictures: (inserts: {
collection_id: string;
picture_id: string;
}[], client?: SupabaseClient) => Promise<void>;
export declare const updateStorageFile: (path: string, blob: Blob, client?: SupabaseClient) => Promise<void>;
export declare const fetchSelectedVersions: (rootIds: string[], client?: SupabaseClient) => Promise<{
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}[]>;
export declare const fetchRelatedVersions: (rootIds: string[], client?: SupabaseClient) => Promise<{
created_at: string;
description: string | null;
flags: string[] | null;
id: string;
image_url: string;
is_selected: boolean;
likes_count: number | null;
meta: import('../integrations/supabase/types').Json | null;
organization_id: string | null;
parent_id: string | null;
position: number | null;
post_id: string | null;
tags: string[] | null;
thumbnail_url: string | null;
title: string;
type: string | null;
updated_at: string;
user_id: string;
visible: boolean;
}[]>;
export declare const fetchUserRoles: (userId: string, client?: SupabaseClient) => Promise<("viewer" | "owner" | "admin" | "member")[]>;
export declare const fetchUserLikesForPictures: (userId: string, pictureIds: string[], client?: SupabaseClient) => Promise<string[]>;
export interface FeedPost {
id: string;
title: string;
description: string | null;
created_at: string;
user_id: string;
pictures: MediaItem[];
cover: MediaItem;
likes_count: number;
comments_count: number;
type: MediaType;
author_profile?: UserProfile;
}
export declare const fetchFeedPosts: (source?: "home" | "collection" | "tag" | "user", sourceId?: string, isOrgContext?: boolean, orgSlug?: string, client?: SupabaseClient) => Promise<FeedPost[]>;
export declare const fetchFeedPostsPaginated: (source?: "home" | "collection" | "tag" | "user", sourceId?: string, isOrgContext?: boolean, orgSlug?: string, page?: number, pageSize?: number, client?: SupabaseClient) => Promise<FeedPost[]>;
export declare const mapFeedPostsToMediaItems: (posts: FeedPost[], sortBy?: "latest" | "top") => any[];
export declare const augmentFeedPosts: (posts: any[]) => FeedPost[];

View File

@ -0,0 +1,53 @@
/**
* Image Generation Router
* Routes image generation requests to the appropriate AI provider based on the model format.
* Model format: "provider/model-name"
*
* Supported providers:
* - google: Google Generative AI (Gemini models)
* - replicate: Replicate API (various models)
* - bria: Bria.ai (coming soon)
*/
export interface ImageResult {
imageData: ArrayBuffer;
text?: string;
}
export interface ModelInfo {
provider: string;
modelName: string;
displayName: string;
supportsTextToImage: boolean;
supportsImageToImage: boolean;
}
export declare const AVAILABLE_MODELS: ModelInfo[];
/**
* Parse model string into provider and model name
* @param modelString Format: "provider/model-name"
* @returns { provider, modelName }
*/
export declare const parseModelString: (modelString: string) => {
provider: string;
modelName: string;
};
/**
* Get full model string from provider and model name
*/
export declare const getModelString: (provider: string, modelName: string) => string;
/**
* Create/generate a new image from text prompt
* Routes to the appropriate provider based on model string
*/
export declare const createImage: (prompt: string, modelString?: string, apiKey?: string, aspectRatio?: string, resolution?: string, enableSearchGrounding?: boolean) => Promise<ImageResult | null>;
/**
* Edit an existing image with a text prompt
* Routes to the appropriate provider based on model string
*/
export declare const editImage: (prompt: string, imageFiles: File[], modelString?: string, apiKey?: string, aspectRatio?: string, resolution?: string, enableSearchGrounding?: boolean) => Promise<ImageResult | null>;
/**
* Get model info by model string
*/
export declare const getModelInfo: (modelString: string) => ModelInfo | undefined;
/**
* Get all models for a specific provider
*/
export declare const getModelsByProvider: (provider: string) => ModelInfo[];

View File

@ -0,0 +1,54 @@
/**
* Markdown Image Tools
* Tools for generating and embedding images in markdown content
*/
type LogFunction = (level: 'info' | 'warn' | 'error' | 'debug', message: string, data?: any) => void;
/**
* Tool: Generate Markdown Image
* Generates an image and returns markdown with embedded image
*/
export declare const generateMarkdownImageTool: (userId: string, addLog?: LogFunction) => import('openai/lib/RunnableFunction.mjs').RunnableToolFunctionWithParse<{
model?: string;
prompt?: string;
caption?: string;
altText?: string;
}>;
/**
* Tool: Generate Text with Images
* Generates markdown content that can include both text and embedded images
*/
export declare const generateTextWithImagesTool: (userId: string, addLog?: LogFunction) => import('openai/lib/RunnableFunction.mjs').RunnableToolFunctionWithParse<{
content?: string;
model?: string;
imagePrompts?: {
position?: "inline" | "top" | "middle" | "bottom";
prompt?: string;
caption?: string;
altText?: string;
}[];
}>;
/**
* Create markdown-specific tool preset
*/
export declare const createMarkdownToolPreset: (userId: string, model?: string, apiKey?: string, addLog?: LogFunction) => {
name: string;
description: string;
model: string;
tools: (import('openai/lib/RunnableFunction.mjs').RunnableToolFunctionWithParse<{
model?: string;
prompt?: string;
caption?: string;
altText?: string;
}> | import('openai/lib/RunnableFunction.mjs').RunnableToolFunctionWithParse<{
content?: string;
model?: string;
imagePrompts?: {
position?: "inline" | "top" | "middle" | "bottom";
prompt?: string;
caption?: string;
altText?: string;
}[];
}>)[];
systemPrompt: string;
};
export {};

View File

@ -0,0 +1,63 @@
import { default as React } from 'react';
export declare const MEDIA_TYPES: {
readonly SUPABASE_IMAGE: "supabase-image";
readonly MUX_VIDEO: "mux-video";
readonly VIDEO_INTERN: "video-intern";
readonly YOUTUBE: "youtube";
readonly TIKTOK: "tiktok";
readonly PAGE: "page-intern";
readonly PAGE_EXTERNAL: "page-external";
};
export type MediaType = typeof MEDIA_TYPES[keyof typeof MEDIA_TYPES] | null;
export declare function normalizeMediaType(type: string | null | undefined): MediaType;
export declare function isVideoType(type: MediaType): boolean;
export declare function isImageType(type: MediaType): boolean;
export declare function getMediaUrlField(type: MediaType): 'image_url' | 'image_url';
export declare function getThumbnailField(type: MediaType): 'thumbnail_url' | null;
export interface MediaRendererProps {
id: string;
url: string;
thumbnailUrl?: string | null;
title: string;
author: string;
authorId: string;
likes: number;
comments: number;
isLiked?: boolean;
description?: string | null;
type: MediaType;
meta?: any;
onClick?: (id: string) => void;
onLike?: () => void;
onDelete?: () => void;
}
interface MediaTypeConfig {
name: string;
component: React.ComponentType<MediaRendererProps>;
uploadComponent?: React.ComponentType<any>;
}
export declare function registerMediaType(type: MediaType, config: MediaTypeConfig): void;
export declare function getMediaRenderer(type: MediaType): React.ComponentType<MediaRendererProps> | null;
export declare function getMediaTypeConfig(type: MediaType): MediaTypeConfig | null;
export declare function detectMediaType(url: string, meta?: any): MediaType;
declare const _default: {
MEDIA_TYPES: {
readonly SUPABASE_IMAGE: "supabase-image";
readonly MUX_VIDEO: "mux-video";
readonly VIDEO_INTERN: "video-intern";
readonly YOUTUBE: "youtube";
readonly TIKTOK: "tiktok";
readonly PAGE: "page-intern";
readonly PAGE_EXTERNAL: "page-external";
};
normalizeMediaType: typeof normalizeMediaType;
isVideoType: typeof isVideoType;
isImageType: typeof isImageType;
getMediaUrlField: typeof getMediaUrlField;
getThumbnailField: typeof getThumbnailField;
registerMediaType: typeof registerMediaType;
getMediaRenderer: typeof getMediaRenderer;
getMediaTypeConfig: typeof getMediaTypeConfig;
detectMediaType: typeof detectMediaType;
};
export default _default;

154
packages/ui/dist-lib/lib/openai.d.ts vendored Normal file
View File

@ -0,0 +1,154 @@
import { default as OpenAI } from 'openai';
import { z } from 'zod';
import { RunnableToolFunctionWithParse } from 'openai/lib/RunnableFunction';
type LogFunction = (level: string, message: string, data?: any) => void;
/**
* SIMPLE TOOL PRESET MAPPING
*
* This mapping defines common tool combinations:
* - generate-only: [generate]
* - generate-metadata: [generate, metadata]
* - generate-publish: [generate, metadata, publish]
* - metadata-only: [metadata]
* - optimize-generate: [optimize, generate, metadata]
*
* Use these to avoid calling unwanted tools (e.g., publish when user wants manual control)
*/
export type PresetType = 'generate-only' | 'generate-metadata' | 'generate-publish' | 'metadata-only' | 'optimize-generate';
export declare const createOpenAIClient: (apiKey?: string) => Promise<OpenAI | null>;
export declare const isOpenAIAvailable: (apiKey?: string) => Promise<boolean>;
export declare const withOpenAI: <T>(operation: (client: OpenAI) => Promise<T>, fallback?: T, apiKey?: string) => Promise<T | null>;
export declare const generateText: (input: string, model?: string, apiKey?: string, signal?: AbortSignal, onChunk?: (chunk: string) => void, webSearch?: boolean) => Promise<string | null>;
export declare const generateResponse: (input: string, model?: string, apiKey?: string) => Promise<string | null>;
export declare const analyzeImages: (imageFiles: File[], prompt?: string, model?: string, apiKey?: string) => Promise<{
description: string;
title: string;
} | null>;
export declare const generateImageMetadata: (imageFiles: File[], apiKey?: string) => Promise<{
description: string;
title: string;
} | null>;
export declare const transcribeAudio: (audioFile: File, model?: string, apiKey?: string) => Promise<string | null>;
export declare const optimizePrompt: (userPrompt: string, model?: string, apiKey?: string) => Promise<string | null>;
/**
* Helper function to create Zod-validated OpenAI tools
* Based on ref/tools/index.ts
*/
export declare const zodFunction: <T extends object>({ function: fn, schema, description, name, }: {
function: (args: T) => Promise<object>;
schema: z.ZodSchema<T>;
description?: string;
name?: string;
}) => RunnableToolFunctionWithParse<T>;
/**
* Tool: Generate Image
* Creates a new image from a text prompt using the specified AI model
*/
export declare const generateImageTool: (apiKey?: string) => RunnableToolFunctionWithParse<{
model?: string;
prompt?: string;
count?: number;
}>;
/**
* Tool: Transcribe Audio
* Converts speech/audio to text using OpenAI Whisper
*/
export declare const transcribeAudioTool: (apiKey?: string) => RunnableToolFunctionWithParse<{
model?: string;
audioFile?: any;
}>;
/**
* Tool: Optimize Prompt
* Enhances a user's prompt to produce better image generation results
*/
export declare const optimizePromptTool: (apiKey?: string) => RunnableToolFunctionWithParse<{
model?: string;
prompt?: string;
}>;
/**
* Tool: Generate Text
* Generates text completion using GPT models
*/
export declare const generateTextTool: (apiKey?: string) => RunnableToolFunctionWithParse<{
model?: string;
input?: string;
}>;
/**
* Tool: Generate Image Metadata
* Generates title and description for an image based on the prompt or image content
*/
export declare const generateImageMetadataTool: (apiKey?: string) => RunnableToolFunctionWithParse<{
style?: string;
prompt?: string;
}>;
/**
* Tool: Publish Image to Gallery
* Publishes a generated image to the user's gallery with title and description
*/
export declare const publishImageTool: () => RunnableToolFunctionWithParse<{
title?: string;
description?: string;
tags?: string[];
prompt?: string;
imageUrl?: string;
}>;
export interface ToolPreset {
name: string;
description: string;
model: string;
tools: RunnableToolFunctionWithParse<any>[];
systemPrompt?: string;
}
/**
* Create a simple custom preset using the preset type mapping
*/
export declare const createSimplePreset: (type: PresetType, systemPrompt: string, apiKey?: string) => ToolPreset;
/**
* Create tool presets with API key
*/
export declare const createToolPresets: (apiKey?: string, userId?: string, addLog?: LogFunction) => Record<string, ToolPreset>;
export interface RunToolsOptions {
prompt: string;
preset?: string | ToolPreset;
apiKey?: string;
onMessage?: (message: any) => void;
onToolCall?: (toolCall: any) => void;
onContent?: (content: string) => void;
model?: string;
maxIterations?: number;
userId?: string;
images?: string[];
addLog?: LogFunction;
}
export interface RunToolsResult {
success: boolean;
content?: string;
messages: any[];
toolCalls: any[];
error?: string;
}
/**
* Run OpenAI with tools - main orchestration function
* Based on ref/run-tools.ts
*
* @example
* // Use preset
* const result = await runTools({
* prompt: "Create a beautiful sunset over mountains",
* preset: "image-wizard"
* });
*
* @example
* // Custom tools
* const result = await runTools({
* prompt: "Generate an image of a cat",
* preset: {
* name: "custom",
* model: "gpt-4o-mini",
* tools: [generateImageTool()],
* systemPrompt: "You are a helpful assistant"
* }
* });
*/
export declare const runTools: (options: RunToolsOptions) => Promise<RunToolsResult>;
export {};

72
packages/ui/dist-lib/lib/pageTools.d.ts vendored Normal file
View File

@ -0,0 +1,72 @@
type LogFunction = (level: string, message: string, data?: any) => void;
/**
* Creates a URL-friendly slug from a string.
* @param text The text to slugify.
* @returns A URL-friendly slug.
*/
export declare const slugify: (text: string) => string;
/**
* Formats markdown content into the required page JSON structure.
* @param pageId The unique identifier for the page.
* @param pageName The name of the page.
* @param markdownContent The markdown content for the page.
* @returns The structured page content object.
*/
export declare const formatPageContent: (pageId: string, pageName: string, markdownContent: string | undefined | null) => {
pages: {
[x: string]: {
id: string;
name: string;
createdAt: number;
updatedAt: number;
containers: {
id: string;
gap: number;
type: string;
order: number;
columns: number;
widgets: {
id: string;
order: number;
props: {
content: string;
templates: any[];
placeholder: string;
};
widgetId: string;
}[];
children: any[];
}[];
};
};
version: string;
lastUpdated: number;
};
/**
* Shared logic to create a page in the database
*/
export declare const createPageInDb: (userId: string, args: {
title: string;
content: string;
tags?: string[];
is_public?: boolean;
visible?: boolean;
}, addLog?: LogFunction) => Promise<{
success: boolean;
pageId: string;
slug: string;
url: string;
message: string;
}>;
/**
* Tool: Create Page
* Creates a new page with the given title, content, and metadata, and saves it to the database.
*/
export declare const createPageTool: (userId: string, addLog?: LogFunction) => import('openai/lib/RunnableFunction.mjs').RunnableToolFunctionWithParse<{
title?: string;
content?: string;
is_public?: boolean;
tags?: string[];
visible?: boolean;
}>;
export {};

13
packages/ui/dist-lib/lib/replicate.d.ts vendored Normal file
View File

@ -0,0 +1,13 @@
declare const logger: {
debug: (message: string, data?: any) => void;
info: (message: string, data?: any) => void;
warn: (message: string, data?: any) => void;
error: (message: string, data?: any) => void;
};
interface ImageResult {
imageData: ArrayBuffer;
text?: string;
}
export declare const createImageWithReplicate: (prompt: string, model?: string, apiKey?: string) => Promise<ImageResult | null>;
export declare const editImageWithReplicate: (prompt: string, imageFiles: File[], model?: string, apiKey?: string) => Promise<ImageResult | null>;
export { logger };

2
packages/ui/dist-lib/lib/utils.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
import { ClassValue } from 'clsx';
export declare function cn(...inputs: ClassValue[]): string;

View File

@ -0,0 +1 @@
export * from '../../lib/db';

View File

@ -0,0 +1,7 @@
import { U as o, U as s, S as i } from "./lib-export-CI8auKfP.js";
export {
o as MediaGrid,
s as PhotoGrid,
i as ResponsiveImage
};
//# sourceMappingURL=pm-pics-components.es.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"pm-pics-components.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,995 @@
var U = Object.defineProperty;
var tt = (i, t, e) => t in i ? U(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
var h = (i, t, e) => tt(i, typeof t != "symbol" ? t + "" : t, e);
const et = {
LoadFail: 0,
BadSignature: 1,
BadTimestamp: 2,
BadSettingValue: 3,
BadFormat: 4,
UnknownSetting: 5
};
class it extends Error {
constructor(e) {
super(e.reason);
h(this, "code");
h(this, "line");
this.code = e.code, this.line = e.line;
}
}
const j = /\r?\n|\r/gm;
class st {
constructor(t) {
h(this, "writable");
h(this, "readable");
const e = new rt(t);
this.writable = new WritableStream({
write(s) {
e.transform(s);
},
close() {
e.close();
}
}), this.readable = new ReadableStream({
start(s) {
e.onLine = (n) => s.enqueue(n), e.onClose = () => s.close();
}
});
}
}
class rt {
constructor(t) {
h(this, "a", "");
h(this, "b");
h(this, "onLine");
h(this, "onClose");
this.b = new TextDecoder(t);
}
transform(t) {
this.a += this.b.decode(t, { stream: !0 });
const e = this.a.split(j);
this.a = e.pop() || "";
for (let s = 0; s < e.length; s++)
this.onLine(e[s].trim());
}
close() {
this.a && this.onLine(this.a.trim()), this.a = "", this.onClose();
}
}
async function nt(i, t) {
const e = new ReadableStream({
start(s) {
const n = i.split(j);
for (const r of n)
s.enqueue(r);
s.close();
}
});
return C(e, t);
}
async function C(i, t) {
const e = (t == null ? void 0 : t.type) ?? "vtt";
let s;
if (typeof e == "string")
switch (e) {
case "srt":
s = (await import("./srt-parser-CWqahKwO.js")).default;
break;
case "ssa":
case "ass":
s = (await import("./ssa-parser-BqjjKy4M.js")).default;
break;
default:
s = (await Promise.resolve().then(function() {
return St;
})).default;
}
else
s = e;
let n;
const r = i.getReader(), l = s(), a = !!(t != null && t.strict) || !!(t != null && t.errors);
await l.init({
strict: !1,
...t,
errors: a,
type: e,
cancel() {
r.cancel(), n = l.done(!0);
}
});
let o = 1;
for (; ; ) {
const { value: c, done: f } = await r.read();
if (f) {
l.parse("", o), n = l.done(!1);
break;
}
l.parse(c, o), o++;
}
return n;
}
async function at(i, t) {
var l, a;
const e = await i;
if (!e.ok || !e.body)
return {
metadata: {},
cues: [],
regions: [],
errors: [void 0]
};
const s = e.headers.get("content-type") || "", n = (l = s.match(/text\/(.*?)(?:;|$)/)) == null ? void 0 : l[1], r = (a = s.match(/charset=(.*?)(?:;|$)/)) == null ? void 0 : a[1];
return G(e.body, { type: n, encoding: r, ...t });
}
async function G(i, { encoding: t = "utf-8", ...e } = {}) {
const s = i.pipeThrough(new st(t));
return C(s, e);
}
class H extends EventTarget {
constructor(e, s, n) {
super();
/**
* A string that identifies the cue.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/id}
*/
h(this, "id", "");
/**
* A `double` that represents the video time that the cue will start being displayed, in seconds.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/startTime}
*/
h(this, "startTime");
/**
* A `double` that represents the video time that the cue will stop being displayed, in seconds.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/endTime}
*/
h(this, "endTime");
/**
* Returns a string with the contents of the cue.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/text}
*/
h(this, "text");
/**
* A `boolean` for whether the video will pause when this cue stops being displayed.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/TextTrackCue/pauseOnExit}
*/
h(this, "pauseOnExit", !1);
this.startTime = e, this.endTime = s, this.text = n;
}
addEventListener(e, s, n) {
super.addEventListener(e, s, n);
}
removeEventListener(e, s, n) {
super.removeEventListener(e, s, n);
}
}
const R = typeof document > "u", lt = R ? H : window.VTTCue;
class V extends lt {
constructor() {
super(...arguments);
/**
* A `VTTRegion` object describing the video's sub-region that the cue will be drawn onto,
* or `null` if none is assigned.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/region}
*/
h(this, "region", null);
/**
* The cue writing direction.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/vertical}
*/
h(this, "vertical", "");
/**
* Returns `true` if the `VTTCue.line` attribute is an integer number of lines or a percentage
* of the video size.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/snapToLines}
*/
h(this, "snapToLines", !0);
/**
* Returns the line positioning of the cue. This can be the string `'auto'` or a number whose
* interpretation depends on the value of `VTTCue.snapToLines`.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/line}
*/
h(this, "line", "auto");
/**
* Returns an enum representing the alignment of the `VTTCue.line`.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/lineAlign}
*/
h(this, "lineAlign", "start");
/**
* Returns the indentation of the cue within the line. This can be the string `'auto'` or a
* number representing the percentage of the `VTTCue.region`, or the video size if `VTTCue`.region`
* is `null`.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/position}
*/
h(this, "position", "auto");
/**
* Returns an enum representing the alignment of the cue. This is used to determine what
* the `VTTCue.position` is anchored to. The default is `'auto'`.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/positionAlign}
*/
h(this, "positionAlign", "auto");
/**
* Returns a double representing the size of the cue, as a percentage of the video size.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/size}
*/
h(this, "size", 100);
/**
* Returns an enum representing the alignment of all the lines of text within the cue box.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/VTTCue/align}
*/
h(this, "align", "center");
/**
* Additional styles associated with the cue.
*/
h(this, "style");
}
}
class F {
constructor() {
/**
* A string that identifies the region.
*/
h(this, "id", "");
/**
* A `double` representing the width of the region, as a percentage of the video.
*/
h(this, "width", 100);
/**
* A `double` representing the height of the region, in number of lines.
*/
h(this, "lines", 3);
/**
* A `double` representing the region anchor X offset, as a percentage of the region.
*/
h(this, "regionAnchorX", 0);
/**
* A `double` representing the region anchor Y offset, as a percentage of the region.
*/
h(this, "regionAnchorY", 100);
/**
* A `double` representing the viewport anchor X offset, as a percentage of the video.
*/
h(this, "viewportAnchorX", 0);
/**
* A `double` representing the viewport anchor Y offset, as a percentage of the video.
*/
h(this, "viewportAnchorY", 100);
/**
* An enum representing how adding new cues will move existing cues.
*/
h(this, "scroll", "");
}
}
const O = ",", ot = "%";
function ht(i) {
const t = parseInt(i, 10);
return Number.isNaN(t) ? null : t;
}
function b(i) {
const t = parseInt(i.replace(ot, ""), 10);
return !Number.isNaN(t) && t >= 0 && t <= 100 ? t : null;
}
function B(i) {
if (!i.includes(O))
return null;
const [t, e] = i.split(O).map(b);
return t !== null && e !== null ? [t, e] : null;
}
function ct(i) {
const t = parseFloat(i);
return Number.isNaN(t) ? null : t;
}
const ut = "WEBVTT", z = ",", ft = "%", w = /[:=]/, dt = /^[\s\t]*(region|vertical|line|position|size|align)[:=]/, pt = "NOTE", gt = "REGION", mt = /^REGION:?[\s\t]+/, y = /[\s\t]+/, Tt = "-->", wt = /[\s\t]*-->[\s\t]+/, vt = /start|center|end|left|right/, yt = /start|center|end/, bt = /line-(?:left|right)|center|auto/, At = /^(?:(\d{1,2}):)?(\d{2}):(\d{2})(?:\.(\d{1,3}))?$/;
var D = /* @__PURE__ */ ((i) => (i[i.None = 0] = "None", i[i.Header = 1] = "Header", i[i.Cue = 2] = "Cue", i[i.Region = 3] = "Region", i[i.Note = 4] = "Note", i))(D || {});
class W {
constructor() {
h(this, "h");
h(this, "e", 0);
h(this, "i", {});
h(this, "j", {});
h(this, "l", []);
h(this, "c", null);
h(this, "d", null);
h(this, "m", []);
h(this, "f");
h(this, "n", "");
}
async init(t) {
this.h = t, t.strict && (this.e = 1), t.errors && (this.f = (await import("./errors-DCJKAXTz.js")).ParseErrorBuilder);
}
parse(t, e) {
var s, n, r, l, a, o;
if (t === "")
this.c ? (this.l.push(this.c), (n = (s = this.h).onCue) == null || n.call(s, this.c), this.c = null) : this.d ? (this.j[this.d.id] = this.d, (l = (r = this.h).onRegion) == null || l.call(r, this.d), this.d = null) : this.e === 1 && (this.k(t, e), (o = (a = this.h).onHeaderMetadata) == null || o.call(a, this.i)), this.e = 0;
else if (this.e)
switch (this.e) {
case 1:
this.k(t, e);
break;
case 2:
if (this.c) {
const c = this.c.text.length > 0;
!c && dt.test(t) ? this.o(t.split(y), e) : this.c.text += (c ? `
` : "") + t;
}
break;
case 3:
this.p(t.split(y), e);
break;
}
else if (t.startsWith(pt))
this.e = 4;
else if (t.startsWith(gt))
this.e = 3, this.d = new F(), this.p(t.replace(mt, "").split(y), e);
else if (t.includes(Tt)) {
const c = this.q(t, e);
c && (this.c = new V(c[0], c[1], ""), this.c.id = this.n, this.o(c[2], e)), this.e = 2;
} else e === 1 && this.k(t, e);
this.n = t;
}
done() {
return {
metadata: this.i,
cues: this.l,
regions: Object.values(this.j),
errors: this.m
};
}
k(t, e) {
var s;
if (e > 1) {
if (w.test(t)) {
const [n, r] = t.split(w);
n && (this.i[n] = (r || "").replace(y, ""));
}
} else t.startsWith(ut) ? this.e = 1 : this.g((s = this.f) == null ? void 0 : s.r());
}
q(t, e) {
var c, f, u;
const [s, n = ""] = t.split(wt), [r, ...l] = n.split(y), a = E(s), o = E(r);
if (a !== null && o !== null && o > a)
return [a, o, l];
a === null && this.g((c = this.f) == null ? void 0 : c.s(s, e)), o === null && this.g((f = this.f) == null ? void 0 : f.t(r, e)), a != null && o !== null && o > a && this.g((u = this.f) == null ? void 0 : u.u(a, o, e));
}
/**
* @see {@link https://www.w3.org/TR/webvtt1/#region-settings-parsing}
*/
p(t, e) {
var n, r;
let s;
for (let l = 0; l < t.length; l++)
if (w.test(t[l])) {
s = !1;
const [a, o] = t[l].split(w);
switch (a) {
case "id":
this.d.id = o;
break;
case "width":
const c = b(o);
c !== null ? this.d.width = c : s = !0;
break;
case "lines":
const f = ht(o);
f !== null ? this.d.lines = f : s = !0;
break;
case "regionanchor":
const u = B(o);
u !== null ? (this.d.regionAnchorX = u[0], this.d.regionAnchorY = u[1]) : s = !0;
break;
case "viewportanchor":
const d = B(o);
d !== null ? (this.d.viewportAnchorX = d[0], this.d.viewportAnchorY = d[1]) : s = !0;
break;
case "scroll":
o === "up" ? this.d.scroll = "up" : s = !0;
break;
default:
this.g((n = this.f) == null ? void 0 : n.v(a, o, e));
}
s && this.g((r = this.f) == null ? void 0 : r.w(a, o, e));
}
}
/**
* @see {@link https://www.w3.org/TR/webvtt1/#cue-timings-and-settings-parsing}
*/
o(t, e) {
var n, r;
let s;
for (let l = 0; l < t.length; l++)
if (s = !1, w.test(t[l])) {
const [a, o] = t[l].split(w);
switch (a) {
case "region":
const c = this.j[o];
c && (this.c.region = c);
break;
case "vertical":
o === "lr" || o === "rl" ? (this.c.vertical = o, this.c.region = null) : s = !0;
break;
case "line":
const [f, u] = o.split(z);
if (f.includes(ft)) {
const v = b(f);
v !== null ? (this.c.line = v, this.c.snapToLines = !1) : s = !0;
} else {
const v = ct(f);
v !== null ? this.c.line = v : s = !0;
}
yt.test(u) ? this.c.lineAlign = u : u && (s = !0), this.c.line !== "auto" && (this.c.region = null);
break;
case "position":
const [d, g] = o.split(z), P = b(d);
P !== null ? this.c.position = P : s = !0, g && bt.test(g) ? this.c.positionAlign = g : g && (s = !0);
break;
case "size":
const N = b(o);
N !== null ? (this.c.size = N, N < 100 && (this.c.region = null)) : s = !0;
break;
case "align":
vt.test(o) ? this.c.align = o : s = !0;
break;
default:
this.g((n = this.f) == null ? void 0 : n.x(a, o, e));
}
s && this.g((r = this.f) == null ? void 0 : r.y(a, o, e));
}
}
g(t) {
var e, s;
if (t) {
if (this.m.push(t), this.h.strict)
throw this.h.cancel(), t;
(s = (e = this.h).onError) == null || s.call(e, t);
}
}
}
function E(i) {
const t = i.match(At);
if (!t)
return null;
const e = t[1] ? parseInt(t[1], 10) : 0, s = parseInt(t[2], 10), n = parseInt(t[3], 10), r = t[4] ? parseInt(t[4].padEnd(3, "0"), 10) : 0, l = e * 3600 + s * 60 + n + r / 1e3;
return e < 0 || s < 0 || n < 0 || r < 0 || s > 59 || n > 59 ? null : l;
}
function Et() {
return new W();
}
var St = /* @__PURE__ */ Object.freeze({
__proto__: null,
VTTBlock: D,
VTTParser: W,
default: Et,
parseVTTTimestamp: E
});
const kt = /[0-9]/, Nt = /[\s\t]+/, q = {
c: "span",
i: "i",
b: "b",
u: "u",
ruby: "ruby",
rt: "rt",
v: "span",
lang: "span",
timestamp: "span"
}, _t = {
"&amp;": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#39;": "'",
"&nbsp;": " ",
"&lrm;": "",
"&rlm;": ""
}, Ct = /&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g, Rt = /* @__PURE__ */ new Set([
"white",
"lime",
"cyan",
"red",
"yellow",
"magenta",
"blue",
"black"
]), It = /* @__PURE__ */ new Set(Object.keys(q));
function X(i) {
var c, f;
let t = "", e = 1, s = [], n = [], r;
for (let u = 0; u < i.text.length; u++) {
const d = i.text[u];
switch (e) {
case 1:
d === "<" ? (o(), e = 2) : t += d;
break;
case 2:
switch (d) {
case `
`:
case " ":
case " ":
l(), e = 4;
break;
case ".":
l(), e = 3;
break;
case "/":
e = 5;
break;
case ">":
l(), e = 1;
break;
default:
!t && kt.test(d) && (e = 6), t += d;
break;
}
break;
case 3:
switch (d) {
case " ":
case " ":
case `
`:
a(), r && ((c = r.class) == null || c.trim()), e = 4;
break;
case ".":
a();
break;
case ">":
a(), r && ((f = r.class) == null || f.trim()), e = 1;
break;
default:
t += d;
}
break;
case 4:
d === ">" ? (t = t.replace(Nt, " "), (r == null ? void 0 : r.type) === "v" ? r.voice = _(t) : (r == null ? void 0 : r.type) === "lang" && (r.lang = _(t)), t = "", e = 1) : t += d;
break;
case 5:
d === ">" && (t = "", r = n.pop(), e = 1);
break;
case 6:
if (d === ">") {
const g = E(t);
g !== null && g >= i.startTime && g <= i.endTime && (t = "timestamp", l(), r.time = g), t = "", e = 1;
} else
t += d;
break;
}
}
function l() {
if (It.has(t)) {
const u = r;
r = Lt(t), u ? (n[n.length - 1] !== u && n.push(u), u.children.push(r)) : s.push(r);
}
t = "", e = 1;
}
function a() {
if (r && t) {
const u = t.replace("bg_", "");
Rt.has(u) ? r[t.startsWith("bg_") ? "bgColor" : "color"] = u : r.class = r.class ? r.class + " " + t : t;
}
t = "";
}
function o() {
if (!t)
return;
const u = { type: "text", data: _(t) };
r ? r.children.push(u) : s.push(u), t = "";
}
return e === 1 && o(), s;
}
function Lt(i) {
return {
tagName: q[i],
type: i,
children: []
};
}
function _(i) {
return i.replace(Ct, (t) => _t[t] || "'");
}
function p(i, t, e) {
i.style.setProperty(`--${t}`, e + "");
}
function m(i, t, e = !0) {
i.setAttribute(`data-${t}`, e === !0 ? "" : e + "");
}
function S(i, t) {
i.setAttribute("data-part", t);
}
function Mt(i) {
return parseFloat(getComputedStyle(i).lineHeight) || 0;
}
function xt(i) {
if (R)
throw Error(
"[media-captions] called `createVTTCueTemplate` on the server - use `renderVTTCueString`"
);
const t = document.createElement("template");
return t.innerHTML = I(i), { cue: i, content: t.content };
}
function I(i, t = 0) {
return L(X(i), t);
}
function L(i, t = 0) {
let e, s = "";
for (const n of i)
if (n.type === "text")
s += n.data;
else {
const r = n.type === "timestamp";
e = {}, e.class = n.class, e.title = n.type === "v" && n.voice, e.lang = n.type === "lang" && n.lang, e["data-part"] = n.type === "v" && "voice", r && (e["data-part"] = "timed", e["data-time"] = n.time, e["data-future"] = n.time > t, e["data-past"] = n.time < t), e.style = `${n.color ? `color: ${n.color};` : ""}${n.bgColor ? `background-color: ${n.bgColor};` : ""}`;
const l = Object.entries(e).filter((a) => a[1]).map((a) => `${a[0]}="${a[1] === !0 ? "" : a[1]}"`).join(" ");
s += `<${n.tagName}${l ? " " + l : ""}>${L(
n.children
)}</${n.tagName}>`;
}
return s;
}
function Y(i, t) {
if (!R)
for (const e of i.querySelectorAll('[data-part="timed"]')) {
const s = Number(e.getAttribute("data-time"));
Number.isNaN(s) || (s > t ? m(e, "future") : e.removeAttribute("data-future"), s < t ? m(e, "past") : e.removeAttribute("data-past"));
}
}
function Pt(i, t) {
let e = null, s;
function n() {
r(), i(...s), s = void 0;
}
function r() {
clearTimeout(e), e = null;
}
function l() {
s = [].slice.call(arguments), r(), e = setTimeout(n, t);
}
return l;
}
const T = Symbol(0);
function M(i) {
return i instanceof HTMLElement ? {
top: i.offsetTop,
width: i.clientWidth,
height: i.clientHeight,
left: i.offsetLeft,
right: i.offsetLeft + i.clientWidth,
bottom: i.offsetTop + i.clientHeight
} : { ...i };
}
function k(i, t, e) {
switch (t) {
case "+x":
i.left += e, i.right += e;
break;
case "-x":
i.left -= e, i.right -= e;
break;
case "+y":
i.top += e, i.bottom += e;
break;
case "-y":
i.top -= e, i.bottom -= e;
break;
}
}
function Ot(i, t) {
return i.left <= t.right && i.right >= t.left && i.top <= t.bottom && i.bottom >= t.top;
}
function Bt(i, t) {
for (let e = 0; e < t.length; e++)
if (Ot(i, t[e]))
return t[e];
return null;
}
function $(i, t) {
return t.top >= 0 && t.bottom <= i.height && t.left >= 0 && t.right <= i.width;
}
function zt(i, t, e) {
switch (e) {
case "+x":
return t.left < 0;
case "-x":
return t.right > i.width;
case "+y":
return t.top < 0;
case "-y":
return t.bottom > i.height;
}
}
function $t(i, t) {
const e = Math.max(0, Math.min(i.width, t.right) - Math.max(0, t.left)), s = Math.max(0, Math.min(i.height, t.bottom) - Math.max(0, t.top));
return e * s / (i.height * i.width);
}
function x(i, t) {
return {
top: t.top / i.height,
left: t.left / i.width,
right: (i.width - t.right) / i.width,
bottom: (i.height - t.bottom) / i.height
};
}
function K(i, t) {
return t.top = t.top * i.height, t.left = t.left * i.width, t.right = i.width - t.right * i.width, t.bottom = i.height - t.bottom * i.height, t;
}
const J = ["top", "left", "right", "bottom"];
function Q(i, t, e, s) {
const n = x(t, e);
for (const r of J)
p(i, `${s}-${r}`, n[r] * 100 + "%");
}
function Z(i, t, e, s) {
let n = 1, r, l = { ...t };
for (let a = 0; a < s.length; a++) {
for (; zt(i, t, s[a]) || $(i, t) && Bt(t, e); )
k(t, s[a], 1);
if ($(i, t))
return t;
const o = $t(i, t);
n > o && (r = { ...t }, n = o), t = { ...l };
}
return r || l;
}
const A = Symbol(0);
function jt(i, t, e, s) {
let n = e.firstElementChild, r = Vt(t), l, a = [];
if (e[T] || (e[T] = Gt(i, e)), l = K(i, { ...e[T] }), e[A])
a = [e[A] === "top" ? "+y" : "-y", "+x", "-x"];
else if (t.snapToLines) {
let o;
switch (t.vertical) {
case "":
a = ["+y", "-y"], o = "height";
break;
case "rl":
a = ["+x", "-x"], o = "width";
break;
case "lr":
a = ["-x", "+x"], o = "width";
break;
}
let c = Mt(n), f = c * Math.round(r), u = i[o] + c, d = a[0];
Math.abs(f) > u && (f = f < 0 ? -1 : 1, f *= Math.ceil(u / c) * c), r < 0 && (f += t.vertical === "" ? i.height : i.width, a = a.reverse()), k(l, d, f);
} else {
const o = t.vertical === "", c = o ? "+y" : "+x", f = o ? l.height : l.width;
k(
l,
c,
(o ? i.height : i.width) * r / 100
), k(
l,
c,
t.lineAlign === "center" ? f / 2 : t.lineAlign === "end" ? f : 0
), a = o ? ["-y", "+y", "-x", "+x"] : ["-x", "+x", "-y", "+y"];
}
return l = Z(i, l, s, a), Q(e, i, l, "cue"), l;
}
function Gt(i, t) {
const e = M(t), s = Ht(t);
if (t[A] = !1, s.top && (e.top = s.top, e.bottom = s.top + e.height, t[A] = "top"), s.bottom) {
const n = i.height - s.bottom;
e.top = n - e.height, e.bottom = n, t[A] = "bottom";
}
return s.left && (e.left = s.left), s.right && (e.right = i.width - s.right), x(i, e);
}
function Ht(i) {
const t = {};
for (const e of J)
t[e] = parseFloat(i.style.getPropertyValue(`--cue-${e}`));
return t;
}
function Vt(i) {
return i.line === "auto" ? i.snapToLines ? -1 : 100 : i.line;
}
function Ft(i) {
if (i.position === "auto")
switch (i.align) {
case "start":
case "left":
return 0;
case "right":
case "end":
return 100;
default:
return 50;
}
return i.position;
}
function Dt(i, t) {
if (i.positionAlign === "auto")
switch (i.align) {
case "start":
return t === "ltr" ? "line-left" : "line-right";
case "end":
return t === "ltr" ? "line-right" : "line-left";
case "center":
return "center";
default:
return `line-${i.align}`;
}
return i.positionAlign;
}
const Wt = ["-y", "+y", "-x", "+x"];
function qt(i, t, e, s) {
let n = Array.from(e.querySelectorAll('[data-part="cue-display"]')), r = 0, l = Math.max(0, n.length - t.lines);
for (let o = n.length - 1; o >= l; o--)
r += n[o].offsetHeight;
p(e, "region-height", r + "px"), e[T] || (e[T] = x(i, M(e)));
let a = { ...e[T] };
return a = K(i, a), a.width = e.clientWidth, a.height = r, a.right = a.left + a.width, a.bottom = a.top + r, a = Z(i, a, s, Wt), Q(e, i, a, "region"), a;
}
class Xt {
constructor(t, e) {
h(this, "overlay");
h(this, "z");
h(this, "A", 0);
h(this, "C", "ltr");
h(this, "B", []);
h(this, "D", !1);
h(this, "E");
h(this, "j", /* @__PURE__ */ new Map());
h(this, "l", /* @__PURE__ */ new Map());
h(this, "K", Pt(() => {
this.D = !1, this.G();
for (const t of this.j.values())
t[T] = null;
for (const t of this.l.values())
t && (t[T] = null);
this.H(!0);
}, 50));
this.overlay = t, this.dir = (e == null ? void 0 : e.dir) ?? "ltr", t.setAttribute("translate", "yes"), t.setAttribute("aria-live", "off"), t.setAttribute("aria-atomic", "true"), S(t, "captions"), this.G(), this.E = new ResizeObserver(this.I.bind(this)), this.E.observe(t);
}
/* Text direction. */
get dir() {
return this.C;
}
set dir(t) {
this.C = t, m(this.overlay, "dir", t);
}
get currentTime() {
return this.A;
}
set currentTime(t) {
this.A = t, this.update();
}
changeTrack({ regions: t, cues: e }) {
this.reset(), this.J(t);
for (const s of e)
this.l.set(s, null);
this.update();
}
addCue(t) {
this.l.set(t, null), this.update();
}
removeCue(t) {
this.l.delete(t), this.update();
}
update(t = !1) {
this.H(t);
}
reset() {
this.l.clear(), this.j.clear(), this.B = [], this.overlay.textContent = "";
}
destroy() {
this.reset(), this.E.disconnect();
}
I() {
this.D = !0, this.K();
}
G() {
this.z = M(this.overlay), p(this.overlay, "overlay-width", this.z.width + "px"), p(this.overlay, "overlay-height", this.z.height + "px");
}
H(t = !1) {
if (!this.l.size || this.D)
return;
let e, s = [...this.l.keys()].filter((r) => this.A >= r.startTime && this.A <= r.endTime).sort(
(r, l) => r.startTime !== l.startTime ? r.startTime - l.startTime : r.endTime - l.endTime
), n = s.map((r) => r.region);
for (let r = 0; r < this.B.length; r++) {
if (e = this.B[r], s[r] === e)
continue;
if (e.region && !n.includes(e.region)) {
const a = this.j.get(e.region.id);
a && (a.removeAttribute("data-active"), t = !0);
}
const l = this.l.get(e);
l && (l.remove(), t = !0);
}
for (let r = 0; r < s.length; r++) {
e = s[r];
let l = this.l.get(e);
l || this.l.set(e, l = this.L(e));
const a = this.F(e) && this.j.get(e.region.id);
a && !a.hasAttribute("data-active") && (requestAnimationFrame(() => m(a, "active")), t = !0), l.isConnected || ((a || this.overlay).append(l), t = !0);
}
if (t) {
const r = [], l = /* @__PURE__ */ new Set();
for (let a = s.length - 1; a >= 0; a--) {
if (e = s[a], l.has(e.region || e))
continue;
const o = this.F(e), c = o ? this.j.get(e.region.id) : this.l.get(e);
o ? r.push(qt(this.z, e.region, c, r)) : r.push(jt(this.z, e, c, r)), l.add(o ? e.region : e);
}
}
Y(this.overlay, this.A), this.B = s;
}
J(t) {
if (t)
for (const e of t) {
const s = this.M(e);
this.j.set(e.id, s), this.overlay.append(s);
}
}
M(t) {
const e = document.createElement("div");
return S(e, "region"), m(e, "id", t.id), m(e, "scroll", t.scroll), p(e, "region-width", t.width + "%"), p(e, "region-anchor-x", t.regionAnchorX), p(e, "region-anchor-y", t.regionAnchorY), p(e, "region-viewport-anchor-x", t.viewportAnchorX), p(e, "region-viewport-anchor-y", t.viewportAnchorY), p(e, "region-lines", t.lines), e;
}
L(t) {
var l;
const e = document.createElement("div"), s = Ft(t), n = Dt(t, this.C);
if (S(e, "cue-display"), t.vertical !== "" && m(e, "vertical"), p(e, "cue-text-align", t.align), t.style)
for (const a of Object.keys(t.style))
e.style.setProperty(a, t.style[a]);
if (this.F(t))
p(
e,
"cue-offset",
`${s - (n === "line-right" ? 100 : n === "center" ? 50 : 0)}%`
);
else if (p(
e,
"cue-writing-mode",
t.vertical === "" ? "horizontal-tb" : t.vertical === "lr" ? "vertical-lr" : "vertical-rl"
), !((l = t.style) != null && l["--cue-width"])) {
let a = s;
n === "line-left" ? a = 100 - s : n === "center" && s <= 50 ? a = s * 2 : n === "center" && s > 50 && (a = (100 - s) * 2);
const o = t.size < a ? t.size : a;
t.vertical === "" ? p(e, "cue-width", o + "%") : p(e, "cue-height", o + "%");
}
const r = document.createElement("div");
return S(r, "cue"), t.id && m(r, "id", t.id), r.innerHTML = I(t), e.append(r), e;
}
F(t) {
return t.region && t.size === 100 && t.vertical === "" && t.line === "auto";
}
}
const Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
CaptionsRenderer: Xt,
ParseError: it,
ParseErrorCode: et,
TextCue: H,
VTTCue: V,
VTTRegion: F,
createVTTCueTemplate: xt,
parseByteStream: G,
parseResponse: at,
parseText: nt,
parseTextStream: C,
parseVTTTimestamp: E,
renderVTTCueString: I,
renderVTTTokensString: L,
tokenizeVTTCue: X,
updateTimedVTTCueNodes: Y
}, Symbol.toStringTag, { value: "Module" }));
export {
it as P,
W as V,
D as a,
V as b,
et as c,
Kt as d,
E as p
};
//# sourceMappingURL=prod-DTLJXtPo.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
import { V as c, a as i, b as a } from "./prod-DTLJXtPo.js";
const n = /,/g, u = "-->";
class o extends c {
parse(s, e) {
var h, r;
if (s === "")
this.c && (this.l.push(this.c), (r = (h = this.h).onCue) == null || r.call(h, this.c), this.c = null), this.e = i.None;
else if (this.e === i.Cue)
this.c.text += (this.c.text ? `
` : "") + s;
else if (s.includes(u)) {
const t = this.q(s, e);
t && (this.c = new a(t[0], t[1], t[2].join(" ")), this.c.id = this.n, this.e = i.Cue);
}
this.n = s;
}
q(s, e) {
return super.q(s.replace(n, "."), e);
}
}
function l() {
return new o();
}
export {
o as SRTParser,
l as default
};
//# sourceMappingURL=srt-parser-CWqahKwO.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"srt-parser-CWqahKwO.js","sources":["../node_modules/media-captions/dist/prod/srt-parser.js"],"sourcesContent":["import { V as VTTParser, a as VTTBlock, b as VTTCue } from './index.js';\n\nconst MILLISECOND_SEP_RE = /,/g, TIMESTAMP_SEP = \"-->\";\nclass SRTParser extends VTTParser {\n parse(line, lineCount) {\n if (line === \"\") {\n if (this.c) {\n this.l.push(this.c);\n this.h.onCue?.(this.c);\n this.c = null;\n }\n this.e = VTTBlock.None;\n } else if (this.e === VTTBlock.Cue) {\n this.c.text += (this.c.text ? \"\\n\" : \"\") + line;\n } else if (line.includes(TIMESTAMP_SEP)) {\n const result = this.q(line, lineCount);\n if (result) {\n this.c = new VTTCue(result[0], result[1], result[2].join(\" \"));\n this.c.id = this.n;\n this.e = VTTBlock.Cue;\n }\n }\n this.n = line;\n }\n q(line, lineCount) {\n return super.q(line.replace(MILLISECOND_SEP_RE, \".\"), lineCount);\n }\n}\nfunction createSRTParser() {\n return new SRTParser();\n}\n\nexport { SRTParser, createSRTParser as default };\n"],"names":["MILLISECOND_SEP_RE","TIMESTAMP_SEP","SRTParser","VTTParser","line","lineCount","_b","_a","VTTBlock","result","VTTCue","createSRTParser"],"mappings":";AAEA,MAAMA,IAAqB,MAAMC,IAAgB;AACjD,MAAMC,UAAkBC,EAAU;AAAA,EAChC,MAAMC,GAAMC,GAAW;;AACrB,QAAID,MAAS;AACX,MAAI,KAAK,MACP,KAAK,EAAE,KAAK,KAAK,CAAC,IAClBE,KAAAC,IAAA,KAAK,GAAE,UAAP,QAAAD,EAAA,KAAAC,GAAe,KAAK,IACpB,KAAK,IAAI,OAEX,KAAK,IAAIC,EAAS;AAAA,aACT,KAAK,MAAMA,EAAS;AAC7B,WAAK,EAAE,SAAS,KAAK,EAAE,OAAO;AAAA,IAAO,MAAMJ;AAAA,aAClCA,EAAK,SAASH,CAAa,GAAG;AACvC,YAAMQ,IAAS,KAAK,EAAEL,GAAMC,CAAS;AACrC,MAAII,MACF,KAAK,IAAI,IAAIC,EAAOD,EAAO,CAAC,GAAGA,EAAO,CAAC,GAAGA,EAAO,CAAC,EAAE,KAAK,GAAG,CAAC,GAC7D,KAAK,EAAE,KAAK,KAAK,GACjB,KAAK,IAAID,EAAS;AAAA,IAEtB;AACA,SAAK,IAAIJ;AAAA,EACX;AAAA,EACA,EAAEA,GAAMC,GAAW;AACjB,WAAO,MAAM,EAAED,EAAK,QAAQJ,GAAoB,GAAG,GAAGK,CAAS;AAAA,EACjE;AACF;AACA,SAASM,IAAkB;AACzB,SAAO,IAAIT,EAAS;AACtB;","x_google_ignoreList":[0]}

View File

@ -0,0 +1,210 @@
var F = Object.defineProperty;
var A = (c, t, s) => t in c ? F(c, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : c[t] = s;
var u = (c, t, s) => A(c, typeof t != "symbol" ? t + "" : t, s);
import { b as L, p as y } from "./prod-DTLJXtPo.js";
const S = /^Format:[\s\t]*/, O = /^Style:[\s\t]*/, _ = /^Dialogue:[\s\t]*/, d = /[\s\t]*,[\s\t]*/, w = /\{[^}]+\}/g, I = /\\N/g, x = /^\[(.*)[\s\t]?Styles\]$/, k = /^\[(.*)[\s\t]?Events\]$/;
class $ {
constructor() {
u(this, "h");
u(this, "O", 0);
u(this, "c", null);
u(this, "l", []);
u(this, "m", []);
u(this, "N", null);
u(this, "f");
u(this, "P", {});
}
async init(t) {
this.h = t, t.errors && (this.f = (await import("./errors-DCJKAXTz.js")).ParseErrorBuilder);
}
parse(t, s) {
var e, a;
if (this.O)
switch (this.O) {
case 1:
if (t === "")
this.O = 0;
else if (O.test(t))
if (this.N) {
const i = t.replace(O, "").split(d);
this.S(i);
} else
this.g((e = this.f) == null ? void 0 : e.T("Style", s));
else S.test(t) ? this.N = t.replace(S, "").split(d) : k.test(t) && (this.N = null, this.O = 2);
break;
case 2:
if (t === "")
this.Q();
else if (_.test(t))
if (this.Q(), this.N) {
const i = t.replace(_, "").split(d), r = this.U(i, s);
r && (this.c = r);
} else
this.g((a = this.f) == null ? void 0 : a.T("Dialogue", s));
else this.c ? this.c.text += `
` + t.replace(w, "").replace(I, `
`) : S.test(t) ? this.N = t.replace(S, "").split(d) : x.test(t) ? (this.N = null, this.O = 1) : k.test(t) && (this.N = null);
}
else t === "" || (x.test(t) ? (this.N = null, this.O = 1) : k.test(t) && (this.N = null, this.O = 2));
}
done() {
return {
metadata: {},
cues: this.l,
regions: [],
errors: this.m
};
}
Q() {
var t, s;
this.c && (this.l.push(this.c), (s = (t = this.h).onCue) == null || s.call(t, this.c), this.c = null);
}
S(t) {
let s = "Default", e = {}, a, i = "center", r = "bottom", f, n = 1.2, o, p, h = 3, b = [];
for (let g = 0; g < this.N.length; g++) {
const M = this.N[g], l = t[g];
switch (M) {
case "Name":
s = l;
break;
case "Fontname":
e["font-family"] = l;
break;
case "Fontsize":
e["font-size"] = `calc(${l} / var(--overlay-height))`;
break;
case "PrimaryColour":
const E = N(l);
E && (e["--cue-color"] = E);
break;
case "BorderStyle":
h = parseInt(l, 10);
break;
case "BackColour":
p = N(l);
break;
case "OutlineColour":
const R = N(l);
R && (o = R);
break;
case "Bold":
parseInt(l) && (e["font-weight"] = "bold");
break;
case "Italic":
parseInt(l) && (e["font-style"] = "italic");
break;
case "Underline":
parseInt(l) && (e["text-decoration"] = "underline");
break;
case "StrikeOut":
parseInt(l) && (e["text-decoration"] = "line-through");
break;
case "Spacing":
e["letter-spacing"] = l + "px";
break;
case "AlphaLevel":
e.opacity = parseFloat(l);
break;
case "ScaleX":
b.push(`scaleX(${parseFloat(l) / 100})`);
break;
case "ScaleY":
b.push(`scaleY(${parseFloat(l) / 100})`);
break;
case "Angle":
b.push(`rotate(${l}deg)`);
break;
case "Shadow":
n = parseInt(l, 10) * 1.2;
break;
case "MarginL":
e["--cue-width"] = "auto", e["--cue-left"] = parseFloat(l) + "px";
break;
case "MarginR":
e["--cue-width"] = "auto", e["--cue-right"] = parseFloat(l) + "px";
break;
case "MarginV":
f = parseFloat(l);
break;
case "Outline":
a = parseInt(l, 10);
break;
case "Alignment":
const m = parseInt(l, 10);
switch (m >= 4 && (r = m >= 7 ? "top" : "center"), m % 3) {
case 1:
i = "start";
break;
case 2:
i = "center";
break;
case 3:
i = "end";
break;
}
}
}
if (e.R = r, e["--cue-white-space"] = "normal", e["--cue-line-height"] = "normal", e["--cue-text-align"] = i, r === "center" ? (e["--cue-top"] = "50%", b.push("translateY(-50%)")) : e[`--cue-${r}`] = (f || 0) + "px", h === 1 && (e["--cue-padding-y"] = "0"), (h === 1 || p) && (e["--cue-bg-color"] = h === 1 ? "none" : p), h === 3 && o && (e["--cue-outline"] = `${a}px solid ${o}`), h === 1 && typeof a == "number") {
const g = p ?? "#000";
e["--cue-text-shadow"] = [
o && T(a * 1.2, n * 1.2, o),
o ? T(a * (a / 2), n * (a / 2), g) : T(a, n, g)
].filter(Boolean).join(", ");
}
b.length && (e["--cue-transform"] = b.join(" ")), this.P[s] = e;
}
U(t, s) {
const e = this.V(t), a = this.q(e.Start, e.End, s);
if (!a)
return;
const i = new L(a[0], a[1], ""), r = { ...this.P[e.Style] || {} }, f = e.Name ? `<v ${e.Name}>` : "", n = r.R, o = e.MarginL && parseFloat(e.MarginL), p = e.MarginR && parseFloat(e.MarginR), h = e.MarginV && parseFloat(e.MarginV);
return o && (r["--cue-width"] = "auto", r["--cue-left"] = o + "px"), p && (r["--cue-width"] = "auto", r["--cue-right"] = p + "px"), h && n !== "center" && (r[`--cue-${n}`] = h + "px"), i.text = f + t.slice(this.N.length - 1).join(", ").replace(w, "").replace(I, `
`), delete r.R, Object.keys(r).length && (i.style = r), i;
}
V(t) {
const s = {};
for (let e = 0; e < this.N.length; e++)
s[this.N[e]] = t[e];
return s;
}
q(t, s, e) {
var r, f, n;
const a = y(t), i = y(s);
if (a !== null && i !== null && i > a)
return [a, i];
a === null && this.g((r = this.f) == null ? void 0 : r.s(t, e)), i === null && this.g((f = this.f) == null ? void 0 : f.t(s, e)), a != null && i !== null && i > a && this.g((n = this.f) == null ? void 0 : n.u(a, i, e));
}
g(t) {
var s, e;
if (t) {
if (this.m.push(t), this.h.strict)
throw this.h.cancel(), t;
(e = (s = this.h).onError) == null || e.call(s, t);
}
}
}
function N(c) {
const t = parseInt(c.replace("&H", ""), 16);
if (t >= 0) {
const e = (t >> 24 & 255 ^ 255) / 255, a = t >> 16 & 255, i = t >> 8 & 255;
return "rgba(" + [t & 255, i, a, e].join(",") + ")";
}
return null;
}
function T(c, t, s) {
const e = Math.ceil(2 * Math.PI * c);
let a = "";
for (let i = 0; i < e; i++) {
const r = 2 * Math.PI * i / e;
a += c * Math.cos(r) + "px " + t * Math.sin(r) + "px 0 " + s + (i == e - 1 ? "" : ",");
}
return a;
}
function v() {
return new $();
}
export {
$ as SSAParser,
v as default
};
//# sourceMappingURL=ssa-parser-BqjjKy4M.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
export interface NavigationPost {
id: string;
title: string;
image_url: string;
user_id: string;
}
export interface NavigationData {
posts: NavigationPost[];
currentIndex: number;
source: 'home' | 'collection' | 'tag' | 'search' | 'user' | 'photogrid';
sourceId?: string;
}
export interface NavigationHistory {
path: string;
data: NavigationData;
timestamp: number;
}
export interface WizardInitialImage {
id: string;
src: string;
title: string;
realDatabaseId?: string;
selected: boolean;
}
interface NavigationStore {
navigationData: NavigationData | null;
history: NavigationHistory[];
wizardInitialImage: WizardInitialImage | null;
wizardReturnPath: string | null;
creationWizardOpen: boolean;
creationWizardMode: 'default' | 'page';
setNavigationData: (data: NavigationData | null) => void;
updateCurrentIndex: (index: number) => void;
pushHistory: (path: string, data: NavigationData) => void;
popHistory: () => NavigationHistory | null;
clearHistory: () => void;
canGoBack: () => boolean;
setWizardImage: (image: WizardInitialImage | null, returnPath?: string) => void;
clearWizardImage: () => void;
setCreationWizardOpen: (open: boolean, mode?: 'default' | 'page') => void;
preloadImage: (url: string) => void;
reset: () => void;
}
export declare const useNavigationStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<NavigationStore>, "setState" | "persist"> & {
setState(partial: NavigationStore | Partial<NavigationStore> | ((state: NavigationStore) => NavigationStore | Partial<NavigationStore>), replace?: false): unknown;
setState(state: NavigationStore | ((state: NavigationStore) => NavigationStore), replace: true): unknown;
persist: {
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<NavigationStore, unknown, unknown>>) => void;
clearStorage: () => void;
rehydrate: () => Promise<void> | void;
hasHydrated: () => boolean;
onHydrate: (fn: (state: NavigationStore) => void) => () => void;
onFinishHydration: (fn: (state: NavigationStore) => void) => () => void;
getOptions: () => Partial<import('zustand/middleware').PersistOptions<NavigationStore, unknown, unknown>>;
};
}>;
export declare const selectNavigationData: (state: NavigationStore) => NavigationData;
export declare const selectCurrentIndex: (state: NavigationStore) => number;
export declare const selectPosts: (state: NavigationStore) => NavigationPost[];
export declare const selectCanGoBack: (state: NavigationStore) => boolean;
export declare const selectWizardImage: (state: NavigationStore) => WizardInitialImage;
export declare const selectWizardReturnPath: (state: NavigationStore) => string;
export declare const selectCreationWizardOpen: (state: NavigationStore) => boolean;
export declare const selectCreationWizardMode: (state: NavigationStore) => "page" | "default";
export {};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
/**
* Filters out pictures that are only in private collections.
* Pictures that are:
* - Not in any collection: SHOWN
* - In at least one public collection: SHOWN
* - Only in private collections: HIDDEN
*/
export declare function filterPrivateCollectionPictures<T extends {
id: string;
}>(pictures: T[]): Promise<T[]>;

View File

@ -0,0 +1,8 @@
/**
* Download an image from a URL or data URI
*/
export declare const downloadImage: (imageUrl: string, filename?: string) => Promise<void>;
/**
* Generate a filename based on title and timestamp
*/
export declare const generateFilename: (title?: string, extension?: string) => string;

View File

@ -0,0 +1,46 @@
export interface MediaItem {
id: string;
type: 'picture' | 'video' | 'page-external';
title: string;
description: string | null;
url: string;
thumbnail_url: string | null;
likes_count: number;
created_at: string;
user_id: string;
comments_count: number;
meta?: any;
}
interface FetchMediaOptions {
organizationId?: string | null;
includePrivate?: boolean;
limit?: number;
userId?: string;
tag?: string;
}
/**
* Fetches and merges pictures and videos from the database
* Returns a unified array of media items sorted by created_at
*/
export declare function fetchMediaItems(options?: FetchMediaOptions): Promise<MediaItem[]>;
/**
* Fetches user likes for all media (both pictures and videos)
* Note: Videos are also stored in the pictures table with type='mux-video'
*/
export declare function fetchUserMediaLikes(userId: string): Promise<{
pictureLikes: Set<string>;
videoLikes: Set<string>;
}>;
/**
* Checks if a given URL is a TikTok URL
*/
export declare function isTikTokUrl(url: string | null | undefined): boolean;
/**
* Extracts YouTube Video ID from various URL formats
*/
export declare function getYouTubeVideoId(url: string | null | undefined): string | null;
/**
* Extracts TikTok Video ID
*/
export declare function getTikTokVideoId(url: string | null | undefined): string | null;
export {};

View File

@ -0,0 +1,22 @@
import { z } from 'zod';
export declare const tagSchema: z.ZodString;
/**
* Extract hashtags from text content
* @param content - Text content to parse
* @returns Array of unique tags (without # symbol)
*/
export declare function extractHashtags(content: string): string[];
/**
* Parse content into segments with hashtag information
* @param content - Text content with hashtags
* @returns Array of segments with type and content
*/
export interface ContentSegment {
type: 'text' | 'hashtag';
content: string;
}
export declare function parseHashtagContent(content: string): ContentSegment[];
/**
* Clean and normalize tag for URL usage
*/
export declare function normalizeTag(tag: string): string;

View File

@ -0,0 +1,10 @@
/**
* Formats a date string to a relative time (e.g. "5m ago", "2h ago", "3d ago")
* if less than 7 days, otherwise returns a short date (e.g. "Oct 24").
*/
export declare const formatDate: (dateStr?: string) => string;
/**
* Checks if a title string looks like a filename.
* Used to hide titles that aren't meaningful user descriptions.
*/
export declare const isLikelyFilename: (title: string) => boolean;

View File

@ -0,0 +1,324 @@
var rt = Object.defineProperty;
var V = (n) => {
throw TypeError(n);
};
var ot = (n, t, i) => t in n ? rt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[t] = i;
var _ = (n, t, i) => ot(n, typeof t != "symbol" ? t + "" : t, i), R = (n, t, i) => t.has(n) || V("Cannot " + i);
var e = (n, t, i) => (R(n, t, "read from private field"), i ? i.call(n) : t.get(n)), p = (n, t, i) => t.has(n) ? V("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, i), f = (n, t, i, s) => (R(n, t, "write to private field"), s ? s.call(n, i) : t.set(n, i), i), a = (n, t, i) => (R(n, t, "access private method"), i);
import { V as ht, i as at, h as I, k as dt, l as O, Q as q, m as N, n as ut, D as x, q as ct, R as lt, T as pt, r as k, L as $, I as ft, t as M, u as vt, v as yt, w as gt } from "./lib-export-CI8auKfP.js";
import "react";
const Lt = (n) => ct(n);
var T, h, o, D, C, r, E, U, j, F, Q, K, W, B, J, X, Y, z, G, Z, tt;
class St {
constructor(t, i) {
p(this, r);
p(this, T);
p(this, h);
p(this, o, null);
p(this, D, null);
_(this, "config", {});
p(this, C, /* @__PURE__ */ new Set());
f(this, T, t), f(this, h, i);
}
get instance() {
return e(this, o);
}
setup(t) {
const { streamType: i } = e(this, h).$state, s = O(i).includes("live"), c = O(i).includes("ll-");
f(this, o, new t({
lowLatencyMode: c,
backBufferLength: c ? 4 : s ? 8 : void 0,
renderTextTracksNatively: !1,
...this.config
}));
const u = a(this, r, F).bind(this);
for (const l of Object.values(t.Events)) e(this, o).on(l, u);
e(this, o).on(t.Events.ERROR, a(this, r, Y).bind(this));
for (const l of e(this, C)) l(e(this, o));
e(this, h).player.dispatch("hls-instance", {
detail: e(this, o)
}), e(this, o).attachMedia(e(this, T)), e(this, o).on(t.Events.AUDIO_TRACK_SWITCHED, a(this, r, W).bind(this)), e(this, o).on(t.Events.LEVEL_SWITCHED, a(this, r, B).bind(this)), e(this, o).on(t.Events.LEVEL_LOADED, a(this, r, X).bind(this)), e(this, o).on(t.Events.LEVEL_UPDATED, a(this, r, J).bind(this)), e(this, o).on(t.Events.NON_NATIVE_TEXT_TRACKS_FOUND, a(this, r, Q).bind(this)), e(this, o).on(t.Events.CUES_PARSED, a(this, r, K).bind(this)), e(this, h).qualities[q.enableAuto] = a(this, r, G).bind(this), N(e(this, h).qualities, "change", a(this, r, Z).bind(this)), N(e(this, h).audioTracks, "change", a(this, r, tt).bind(this)), f(this, D, ut(a(this, r, U).bind(this)));
}
onInstance(t) {
return e(this, C).add(t), () => e(this, C).delete(t);
}
loadSource(t) {
var i;
I(t.src) && ((i = e(this, o)) == null || i.loadSource(t.src));
}
destroy() {
var t, i;
(t = e(this, o)) == null || t.destroy(), f(this, o, null), (i = e(this, D)) == null || i.call(this), f(this, D, null);
}
}
T = new WeakMap(), h = new WeakMap(), o = new WeakMap(), D = new WeakMap(), C = new WeakMap(), r = new WeakSet(), E = function(t, i) {
return new x(Lt(t), { detail: i });
}, U = function() {
if (!e(this, h).$state.live()) return;
const t = new lt(a(this, r, j).bind(this));
return t.start(), t.stop.bind(t);
}, j = function() {
var t;
e(this, h).$state.liveSyncPosition.set(((t = e(this, o)) == null ? void 0 : t.liveSyncPosition) ?? 1 / 0);
}, F = function(t, i) {
var s;
(s = e(this, h).player) == null || s.dispatch(a(this, r, E).call(this, t, i));
}, Q = function(t, i) {
const s = a(this, r, E).call(this, t, i);
let c = -1;
for (let u = 0; u < i.tracks.length; u++) {
const l = i.tracks[u], d = l.subtitleTrack ?? l.closedCaptions, w = new pt({
id: `hls-${l.kind}-${u}`,
src: d == null ? void 0 : d.url,
label: l.label,
language: d == null ? void 0 : d.lang,
kind: l.kind,
default: l.default
});
w[k.readyState] = 2, w[k.onModeChange] = () => {
w.mode === "showing" ? (e(this, o).subtitleTrack = u, c = u) : c === u && (e(this, o).subtitleTrack = -1, c = -1);
}, e(this, h).textTracks.add(w, s);
}
}, K = function(t, i) {
var l;
const s = (l = e(this, o)) == null ? void 0 : l.subtitleTrack, c = e(this, h).textTracks.getById(`hls-${i.type}-${s}`);
if (!c) return;
const u = a(this, r, E).call(this, t, i);
for (const d of i.cues)
d.positionAlign = "auto", c.addCue(d, u);
}, W = function(t, i) {
const s = e(this, h).audioTracks[i.id];
if (s) {
const c = a(this, r, E).call(this, t, i);
e(this, h).audioTracks[$.select](s, !0, c);
}
}, B = function(t, i) {
const s = e(this, h).qualities[i.level];
if (s) {
const c = a(this, r, E).call(this, t, i);
e(this, h).qualities[$.select](s, !0, c);
}
}, J = function(t, i) {
i.details.totalduration > 0 && e(this, h).$state.inferredLiveDVRWindow.set(i.details.totalduration);
}, X = function(t, i) {
var P;
if (e(this, h).$state.canPlay()) return;
const { type: s, live: c, totalduration: u, targetduration: l } = i.details, d = a(this, r, E).call(this, t, i);
e(this, h).notify(
"stream-type-change",
c ? s === "EVENT" && Number.isFinite(u) && l >= 10 ? "live:dvr" : "live" : "on-demand",
d
), e(this, h).notify("duration-change", u, d);
const w = e(this, o).media;
e(this, o).currentLevel === -1 && e(this, h).qualities[q.setAuto](!0, d);
for (const y of e(this, o).audioTracks) {
const H = {
id: y.id.toString(),
label: y.name,
language: y.lang || "",
kind: "main"
};
e(this, h).audioTracks[$.add](H, d);
}
for (const y of e(this, o).levels) {
const H = {
id: ((P = y.id) == null ? void 0 : P.toString()) ?? y.height + "p",
width: y.width,
height: y.height,
codec: y.codecSet,
bitrate: y.bitrate
};
e(this, h).qualities[$.add](H, d);
}
w.dispatchEvent(new x("canplay", { trigger: d }));
}, Y = function(t, i) {
var s;
if (i.fatal)
switch (i.type) {
case "mediaError":
(s = e(this, o)) == null || s.recoverMediaError();
break;
default:
a(this, r, z).call(this, i.error);
break;
}
}, z = function(t) {
e(this, h).notify("error", {
message: t.message,
code: 1,
error: t
});
}, G = function() {
e(this, o) && (e(this, o).currentLevel = -1);
}, Z = function() {
const { qualities: t } = e(this, h);
!e(this, o) || t.auto || (e(this, o)[t.switch + "Level"] = t.selectedIndex, ft && (e(this, T).currentTime = e(this, T).currentTime));
}, tt = function() {
const { audioTracks: t } = e(this, h);
e(this, o) && e(this, o).audioTrack !== t.selectedIndex && (e(this, o).audioTrack = t.selectedIndex);
};
var m, g, b, L, it, et, st, nt;
class Et {
constructor(t, i, s) {
p(this, L);
p(this, m);
p(this, g);
p(this, b);
f(this, m, t), f(this, g, i), f(this, b, s), a(this, L, it).call(this);
}
}
m = new WeakMap(), g = new WeakMap(), b = new WeakMap(), L = new WeakSet(), it = async function() {
const t = {
onLoadStart: a(this, L, et).bind(this),
onLoaded: a(this, L, st).bind(this),
onLoadError: a(this, L, nt).bind(this)
};
let i = await mt(e(this, m), t);
if (M(i) && !I(e(this, m)) && (i = await Tt(e(this, m), t)), !i) return null;
if (!i.isSupported()) {
const s = "[vidstack] `hls.js` is not supported in this environment";
return e(this, g).player.dispatch(new x("hls-unsupported")), e(this, g).notify("error", { message: s, code: 4 }), null;
}
return i;
}, et = function() {
e(this, g).player.dispatch(new x("hls-lib-load-start"));
}, st = function(t) {
e(this, g).player.dispatch(
new x("hls-lib-loaded", {
detail: t
})
), e(this, b).call(this, t);
}, nt = function(t) {
const i = vt(t);
e(this, g).player.dispatch(
new x("hls-lib-load-error", {
detail: i
})
), e(this, g).notify("error", {
message: i.message,
code: 4,
error: i
});
};
async function Tt(n, t = {}) {
var i, s, c, u, l;
if (!M(n)) {
if ((i = t.onLoadStart) == null || i.call(t), n.prototype && n.prototype !== Function)
return (s = t.onLoaded) == null || s.call(t, n), n;
try {
const d = (c = await n()) == null ? void 0 : c.default;
if (d && d.isSupported)
(u = t.onLoaded) == null || u.call(t, d);
else
throw Error(
""
);
return d;
} catch (d) {
(l = t.onLoadError) == null || l.call(t, d);
}
}
}
async function mt(n, t = {}) {
var i, s, c;
if (I(n)) {
(i = t.onLoadStart) == null || i.call(t);
try {
if (await yt(n), !gt(window.Hls))
throw Error(
""
);
const u = window.Hls;
return (s = t.onLoaded) == null || s.call(t, u), u;
} catch (u) {
(c = t.onLoadError) == null || c.call(t, u);
}
}
}
const wt = "https://cdn.jsdelivr.net";
var A, v, S;
class xt extends ht {
constructor() {
super(...arguments);
_(this, "$$PROVIDER_TYPE", "HLS");
p(this, A, null);
p(this, v, new St(this.video, this.ctx));
p(this, S, `${wt}/npm/hls.js@^1.5.0/dist/hls.min.js`);
}
/**
* The `hls.js` constructor.
*/
get ctor() {
return e(this, A);
}
/**
* The current `hls.js` instance.
*/
get instance() {
return e(this, v).instance;
}
get type() {
return "hls";
}
get canLiveSync() {
return !0;
}
/**
* The `hls.js` configuration object.
*
* @see {@link https://github.com/video-dev/hls.js/blob/master/docs/API.md#fine-tuning}
*/
get config() {
return e(this, v).config;
}
set config(i) {
e(this, v).config = i;
}
/**
* The `hls.js` constructor (supports dynamic imports) or a URL of where it can be found.
*
* @defaultValue `https://cdn.jsdelivr.net/npm/hls.js@^1.0.0/dist/hls.min.js`
*/
get library() {
return e(this, S);
}
set library(i) {
f(this, S, i);
}
preconnect() {
I(e(this, S)) && dt(e(this, S));
}
setup() {
super.setup(), new Et(e(this, S), this.ctx, (i) => {
f(this, A, i), e(this, v).setup(i), this.ctx.notify("provider-setup", this);
const s = O(this.ctx.$state.source);
s && this.loadSource(s);
});
}
async loadSource(i, s) {
if (!I(i.src)) {
this.removeSource();
return;
}
this.media.preload = s || "", this.appendSource(i, "application/x-mpegurl"), e(this, v).loadSource(i), this.currentSrc = i;
}
/**
* The given callback is invoked when a new `hls.js` instance is created and right before it's
* attached to media.
*/
onInstance(i) {
const s = e(this, v).instance;
return s && i(s), e(this, v).onInstance(i);
}
destroy() {
e(this, v).destroy();
}
}
A = new WeakMap(), v = new WeakMap(), S = new WeakMap(), /**
* Whether `hls.js` is supported in this environment.
*/
_(xt, "supported", at());
export {
xt as HLSProvider
};
//# sourceMappingURL=vidstack-BN7_0WI--BfSbBAjt.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,378 @@
var Lt = Object.defineProperty;
var W = (d) => {
throw TypeError(d);
};
var vt = (d, t, s) => t in d ? Lt(d, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : d[t] = s;
var G = (d, t, s) => vt(d, typeof t != "symbol" ? t + "" : t, s), O = (d, t, s) => t.has(d) || W("Cannot " + s);
var e = (d, t, s) => (O(d, t, "read from private field"), s ? s.call(d) : t.get(d)), T = (d, t, s) => t.has(d) ? W("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, s), l = (d, t, s, i) => (O(d, t, "write to private field"), i ? i.call(d, s) : t.set(d, s), s), r = (d, t, s) => (O(d, t, "access private method"), s);
import { x as St, z as L, R as At, N as Z, O as It, D as tt, l as V, m as et, n as Rt, P as bt, L as wt } from "./lib-export-CI8auKfP.js";
import { getCastContext as Mt, getCastSession as Dt, getCastSessionMedia as it, hasActiveCastSession as st, listenCastContextEvent as Nt, getCastErrorMessage as Pt } from "./vidstack-CQQ1xKSy-CZZk6e1l.js";
import "react";
var g, _, at;
class _t {
constructor(t) {
T(this, _);
T(this, g);
l(this, g, new chrome.cast.media.MediaInfo(t.src, t.type));
}
build() {
return e(this, g);
}
setStreamType(t) {
return t.includes("live") ? e(this, g).streamType = chrome.cast.media.StreamType.LIVE : e(this, g).streamType = chrome.cast.media.StreamType.BUFFERED, this;
}
setTracks(t) {
return e(this, g).tracks = t.map(r(this, _, at)), this;
}
setMetadata(t, s) {
return e(this, g).metadata = new chrome.cast.media.GenericMediaMetadata(), e(this, g).metadata.title = t, e(this, g).metadata.images = [{ url: s }], this;
}
}
g = new WeakMap(), _ = new WeakSet(), at = function(t, s) {
const i = new chrome.cast.media.Track(s, chrome.cast.media.TrackType.TEXT);
return i.name = t.label, i.trackContentId = t.src, i.trackContentType = "text/vtt", i.language = t.language, i.subtype = t.kind.toUpperCase(), i;
};
var p, k, M, c, $, A, rt, nt, ot, H, P, U;
class xt {
constructor(t, s, i) {
T(this, c);
T(this, p);
T(this, k);
T(this, M);
l(this, p, t), l(this, k, s), l(this, M, i);
}
setup() {
const t = this.syncRemoteActiveIds.bind(this);
et(e(this, k).audioTracks, "change", t), et(e(this, k).textTracks, "mode-change", t), Rt(r(this, c, nt).bind(this));
}
getLocalTextTracks() {
return e(this, k).$state.textTracks().filter((t) => t.src && t.type === "vtt");
}
syncRemoteTracks(t) {
if (!e(this, p).isMediaLoaded) return;
const s = r(this, c, $).call(this), i = this.getLocalTextTracks(), n = r(this, c, A).call(this, chrome.cast.media.TrackType.AUDIO), m = r(this, c, A).call(this, chrome.cast.media.TrackType.TEXT);
for (const u of n) {
if (r(this, c, H).call(this, s, u)) continue;
const w = {
id: u.trackId.toString(),
label: u.name,
language: u.language,
kind: u.subtype ?? "main",
selected: !1
};
e(this, k).audioTracks[wt.add](w, t);
}
for (const u of m) {
if (r(this, c, H).call(this, i, u)) continue;
const w = {
id: u.trackId.toString(),
src: u.trackContentId,
label: u.name,
language: u.language,
kind: u.subtype.toLowerCase()
};
e(this, k).textTracks.add(w, t);
}
}
syncRemoteActiveIds(t) {
if (!e(this, p).isMediaLoaded) return;
const s = r(this, c, rt).call(this), i = new chrome.cast.media.EditTracksInfoRequest(s);
r(this, c, ot).call(this, i).catch((n) => {
});
}
}
p = new WeakMap(), k = new WeakMap(), M = new WeakMap(), c = new WeakSet(), $ = function() {
return e(this, k).$state.audioTracks();
}, A = function(t) {
var i;
const s = ((i = e(this, p).mediaInfo) == null ? void 0 : i.tracks) ?? [];
return t ? s.filter((n) => n.type === t) : s;
}, rt = function() {
const t = [], s = r(this, c, $).call(this).find((n) => n.selected), i = this.getLocalTextTracks().filter((n) => n.mode === "showing");
if (s) {
const n = r(this, c, A).call(this, chrome.cast.media.TrackType.AUDIO), m = r(this, c, P).call(this, n, s);
m && t.push(m.trackId);
}
if (i != null && i.length) {
const n = r(this, c, A).call(this, chrome.cast.media.TrackType.TEXT);
if (n.length)
for (const m of i) {
const u = r(this, c, P).call(this, n, m);
u && t.push(u.trackId);
}
}
return t;
}, nt = function() {
const t = this.getLocalTextTracks();
if (!e(this, p).isMediaLoaded) return;
const s = r(this, c, A).call(this, chrome.cast.media.TrackType.TEXT);
for (const i of t)
if (!r(this, c, P).call(this, s, i)) {
bt(() => {
var m;
return (m = e(this, M)) == null ? void 0 : m.call(this);
});
break;
}
}, ot = function(t) {
const s = it();
return new Promise((i, n) => s == null ? void 0 : s.editTracksInfo(t, i, n));
}, H = function(t, s) {
return t.find((i) => r(this, c, U).call(this, i, s));
}, P = function(t, s) {
return t.find((i) => r(this, c, U).call(this, s, i));
}, // Note: we can't rely on id matching because they will differ between local/remote. A local
// track id might not even exist.
U = function(t, s) {
return s.name === t.label && s.language === t.language && s.subtype.toLowerCase() === t.kind.toLowerCase();
};
var o, h, C, E, D, I, v, S, R, N, f, b, a, ht, ct, F, dt, q, ut, lt, mt, B, X, Y, K, Tt, ft, gt, z, kt, j, yt, J, y, pt, Ct, Q, Et;
class Ht {
constructor(t, s) {
T(this, a);
G(this, "$$PROVIDER_TYPE", "GOOGLE_CAST");
G(this, "scope", St());
T(this, o);
T(this, h);
T(this, C);
T(this, E, null);
T(this, D, "disconnected");
T(this, I, 0);
T(this, v, 0);
T(this, S, new L(0, 0));
T(this, R, new At(r(this, a, lt).bind(this)));
T(this, N);
T(this, f, null);
T(this, b, !1);
l(this, o, t), l(this, h, s), l(this, C, new xt(t, s, r(this, a, Et).bind(this)));
}
get type() {
return "google-cast";
}
get currentSrc() {
return e(this, E);
}
/**
* The Google Cast remote player.
*
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.RemotePlayer}
*/
get player() {
return e(this, o);
}
/**
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
*/
get cast() {
return Mt();
}
/**
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastSession}
*/
get session() {
return Dt();
}
/**
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/chrome.cast.media.Media}
*/
get media() {
return it();
}
/**
* Whether the current Google Cast session belongs to this provider.
*/
get hasActiveSession() {
return st(e(this, E));
}
setup() {
r(this, a, ht).call(this), r(this, a, ct).call(this), e(this, C).setup(), e(this, h).notify("provider-setup", this);
}
async play() {
var t;
if (!(!e(this, o).isPaused && !e(this, b))) {
if (e(this, b)) {
await r(this, a, Q).call(this, !1, 0);
return;
}
(t = e(this, o).controller) == null || t.playOrPause();
}
}
async pause() {
var t;
e(this, o).isPaused || (t = e(this, o).controller) == null || t.playOrPause();
}
getMediaStatus(t) {
return new Promise((s, i) => {
var n;
(n = this.media) == null || n.getStatus(t, s, i);
});
}
setMuted(t) {
var i;
(t && !e(this, o).isMuted || !t && e(this, o).isMuted) && ((i = e(this, o).controller) == null || i.muteOrUnmute());
}
setCurrentTime(t) {
var s;
e(this, o).currentTime = t, e(this, h).notify("seeking", t), (s = e(this, o).controller) == null || s.seek();
}
setVolume(t) {
var s;
e(this, o).volumeLevel = t, (s = e(this, o).controller) == null || s.setVolumeLevel();
}
async loadSource(t) {
var n;
if (((n = e(this, f)) == null ? void 0 : n.src) !== t && l(this, f, null), st(t)) {
r(this, a, dt).call(this), l(this, E, t);
return;
}
e(this, h).notify("load-start");
const s = r(this, a, Ct).call(this, t), i = await this.session.loadMedia(s);
if (i) {
l(this, E, null), e(this, h).notify("error", Error(Pt(i)));
return;
}
l(this, E, t);
}
destroy() {
r(this, a, F).call(this), r(this, a, q).call(this);
}
}
o = new WeakMap(), h = new WeakMap(), C = new WeakMap(), E = new WeakMap(), D = new WeakMap(), I = new WeakMap(), v = new WeakMap(), S = new WeakMap(), R = new WeakMap(), N = new WeakMap(), f = new WeakMap(), b = new WeakMap(), a = new WeakSet(), ht = function() {
Nt(
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
r(this, a, B).bind(this)
);
}, ct = function() {
const t = cast.framework.RemotePlayerEventType, s = {
[t.IS_CONNECTED_CHANGED]: r(this, a, B),
[t.IS_MEDIA_LOADED_CHANGED]: r(this, a, X),
[t.CAN_CONTROL_VOLUME_CHANGED]: r(this, a, Y),
[t.CAN_SEEK_CHANGED]: r(this, a, K),
[t.DURATION_CHANGED]: r(this, a, gt),
[t.IS_MUTED_CHANGED]: r(this, a, z),
[t.VOLUME_LEVEL_CHANGED]: r(this, a, z),
[t.IS_PAUSED_CHANGED]: r(this, a, kt),
[t.LIVE_SEEKABLE_RANGE_CHANGED]: r(this, a, j),
[t.PLAYER_STATE_CHANGED]: r(this, a, yt)
};
l(this, N, s);
const i = r(this, a, mt).bind(this);
for (const n of Z(s))
e(this, o).controller.addEventListener(n, i);
It(() => {
for (const n of Z(s))
e(this, o).controller.removeEventListener(n, i);
});
}, F = function() {
e(this, f) || (l(this, v, 0), l(this, S, new L(0, 0))), e(this, R).stop(), l(this, I, 0), l(this, f, null);
}, dt = function() {
const t = new tt("resume-session", { detail: this.session });
r(this, a, X).call(this, t);
const { muted: s, volume: i, savedState: n } = e(this, h).$state, m = n();
this.setCurrentTime(Math.max(e(this, o).currentTime, (m == null ? void 0 : m.currentTime) ?? 0)), this.setMuted(s()), this.setVolume(i()), (m == null ? void 0 : m.paused) === !1 && this.play();
}, q = function() {
this.cast.endCurrentSession(!0);
const { remotePlaybackLoader: t } = e(this, h).$state;
t.set(null);
}, ut = function() {
const { savedState: t } = e(this, h).$state;
t.set({
paused: e(this, o).isPaused,
currentTime: e(this, o).currentTime
}), r(this, a, q).call(this);
}, lt = function() {
r(this, a, ft).call(this);
}, mt = function(t) {
e(this, N)[t.type].call(this, t);
}, B = function(t) {
const s = this.cast.getCastState(), i = s === cast.framework.CastState.CONNECTED ? "connected" : s === cast.framework.CastState.CONNECTING ? "connecting" : "disconnected";
if (e(this, D) === i) return;
const n = { type: "google-cast", state: i }, m = r(this, a, y).call(this, t);
l(this, D, i), e(this, h).notify("remote-playback-change", n, m), i === "disconnected" && r(this, a, ut).call(this);
}, X = function(t) {
if (!!!e(this, o).isMediaLoaded) return;
const i = V(e(this, h).$state.source);
Promise.resolve().then(() => {
if (i !== V(e(this, h).$state.source) || !e(this, o).isMediaLoaded) return;
r(this, a, F).call(this);
const n = e(this, o).duration;
l(this, S, new L(0, n));
const m = {
provider: this,
duration: n,
buffered: new L(0, 0),
seekable: r(this, a, J).call(this)
}, u = r(this, a, y).call(this, t);
e(this, h).notify("loaded-metadata", void 0, u), e(this, h).notify("loaded-data", void 0, u), e(this, h).notify("can-play", m, u), r(this, a, Y).call(this), r(this, a, K).call(this, t);
const { volume: x, muted: w } = e(this, h).$state;
this.setVolume(x()), this.setMuted(w()), e(this, R).start(), e(this, C).syncRemoteTracks(u), e(this, C).syncRemoteActiveIds(u);
});
}, Y = function() {
e(this, h).$state.canSetVolume.set(e(this, o).canControlVolume);
}, K = function(t) {
const s = r(this, a, y).call(this, t);
e(this, h).notify("stream-type-change", r(this, a, Tt).call(this), s);
}, Tt = function() {
var s;
return ((s = e(this, o).mediaInfo) == null ? void 0 : s.streamType) === chrome.cast.media.StreamType.LIVE ? e(this, o).canSeek ? "live:dvr" : "live" : "on-demand";
}, ft = function() {
if (e(this, f)) return;
const t = e(this, o).currentTime;
t !== e(this, I) && (e(this, h).notify("time-change", t), t > e(this, v) && (l(this, v, t), r(this, a, j).call(this)), e(this, h).$state.seeking() && e(this, h).notify("seeked", t), l(this, I, t));
}, gt = function(t) {
if (!e(this, o).isMediaLoaded || e(this, f)) return;
const s = e(this, o).duration, i = r(this, a, y).call(this, t);
l(this, S, new L(0, s)), e(this, h).notify("duration-change", s, i);
}, z = function(t) {
if (!e(this, o).isMediaLoaded) return;
const s = {
muted: e(this, o).isMuted,
volume: e(this, o).volumeLevel
}, i = r(this, a, y).call(this, t);
e(this, h).notify("volume-change", s, i);
}, kt = function(t) {
const s = r(this, a, y).call(this, t);
e(this, o).isPaused ? e(this, h).notify("pause", void 0, s) : e(this, h).notify("play", void 0, s);
}, j = function(t) {
const s = {
seekable: r(this, a, J).call(this),
buffered: new L(0, e(this, v))
}, i = t ? r(this, a, y).call(this, t) : void 0;
e(this, h).notify("progress", s, i);
}, yt = function(t) {
const s = e(this, o).playerState, i = chrome.cast.media.PlayerState;
if (l(this, b, s === i.IDLE), s === i.PAUSED) return;
const n = r(this, a, y).call(this, t);
switch (s) {
case i.PLAYING:
e(this, h).notify("playing", void 0, n);
break;
case i.BUFFERING:
e(this, h).notify("waiting", void 0, n);
break;
case i.IDLE:
e(this, R).stop(), e(this, h).notify("pause"), e(this, h).notify("end");
break;
}
}, J = function() {
return e(this, o).liveSeekableRange ? new L(e(this, o).liveSeekableRange.start, e(this, o).liveSeekableRange.end) : e(this, S);
}, y = function(t) {
return t instanceof Event ? t : new tt(t.type, { detail: t });
}, pt = function(t) {
const { streamType: s, title: i, poster: n } = e(this, h).$state;
return new _t(t).setMetadata(i(), n()).setStreamType(s()).setTracks(e(this, C).getLocalTextTracks()).build();
}, Ct = function(t) {
var m, u;
const s = r(this, a, pt).call(this, t), i = new chrome.cast.media.LoadRequest(s), n = e(this, h).$state.savedState();
return i.autoplay = (((m = e(this, f)) == null ? void 0 : m.paused) ?? (n == null ? void 0 : n.paused)) === !1, i.currentTime = ((u = e(this, f)) == null ? void 0 : u.time) ?? (n == null ? void 0 : n.currentTime) ?? 0, i;
}, Q = async function(t, s) {
const i = V(e(this, h).$state.source);
l(this, f, { src: i, paused: t, time: s }), await this.loadSource(i);
}, Et = function() {
r(this, a, Q).call(this, e(this, o).isPaused, e(this, o).currentTime).catch((t) => {
});
};
export {
Ht as GoogleCastProvider
};
//# sourceMappingURL=vidstack-BeT6vBOi-DhlHLgwc.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,435 @@
var ue = Object.defineProperty;
var N = (r) => {
throw TypeError(r);
};
var de = (r, c, e) => c in r ? ue(r, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[c] = e;
var b = (r, c, e) => de(r, typeof c != "symbol" ? c + "" : c, e), S = (r, c, e) => c.has(r) || N("Cannot " + e);
var t = (r, c, e) => (S(r, c, "read from private field"), e ? e.call(r) : c.get(r)), f = (r, c, e) => c.has(r) ? N("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(r) : c.set(r, e), u = (r, c, e, i) => (S(r, c, "write to private field"), i ? i.call(r, e) : c.set(r, e), e), o = (r, c, e) => (S(r, c, "access private method"), e);
import { x as fe, y as U, z as C, R as pe, k as ye, n as q, l as Q, h as be, A as _, L as R, m as ke, B as ve, T as me, Q as z } from "./lib-export-CI8auKfP.js";
import { E as we } from "./vidstack-FldwQc2Q-PD3aMpLc.js";
import { resolveVimeoVideoId as Pe, getVimeoVideoInfo as Te } from "./vidstack-krOAtKMi-B4IZWKdc.js";
import "react";
const Ce = [
"bufferend",
"bufferstart",
// 'cuechange',
"durationchange",
"ended",
"enterpictureinpicture",
"error",
"fullscreenchange",
"leavepictureinpicture",
"loaded",
// 'loadeddata',
// 'loadedmetadata',
// 'loadstart',
"playProgress",
"loadProgress",
"pause",
"play",
"playbackratechange",
// 'progress',
"qualitychange",
"seeked",
"seeking",
// 'texttrackchange',
"timeupdate",
"volumechange",
"waiting"
// 'adstarted',
// 'adcompleted',
// 'aderror',
// 'adskipped',
// 'adallcompleted',
// 'adclicked',
// 'chapterchange',
// 'chromecastconnected',
// 'remoteplaybackavailabilitychange',
// 'remoteplaybackconnecting',
// 'remoteplaybackconnect',
// 'remoteplaybackdisconnect',
// 'liveeventended',
// 'liveeventstarted',
// 'livestreamoffline',
// 'livestreamonline',
];
var a, y, k, w, g, V, v, $, A, P, m, E, s, W, Y, G, H, T, J, K, X, x, Z, ee, te, se, ie, L, ne, ae, oe, F, he, O, re, B, ce, le, l, D, j;
class Re extends we {
constructor(e, i) {
super(e);
f(this, s);
b(this, "$$PROVIDER_TYPE", "VIMEO");
b(this, "scope", fe());
b(this, "fullscreen");
f(this, a);
f(this, y, U(""));
f(this, k, U(!1));
f(this, w, null);
f(this, g, null);
f(this, V, !1);
f(this, v, new C(0, 0));
f(this, $, new pe(o(this, s, H).bind(this)));
f(this, A, null);
f(this, P, null);
f(this, m, /* @__PURE__ */ new Map());
f(this, E, null);
/**
* Whether tracking session data should be enabled on the embed, including cookies and analytics.
* This is turned off by default to be GDPR-compliant.
*
* @defaultValue `false`
*/
b(this, "cookies", !1);
b(this, "title", !0);
b(this, "byline", !0);
b(this, "portrait", !0);
b(this, "color", "00ADEF");
// Embed will sometimes dispatch 0 at end of playback.
f(this, T, !1);
u(this, a, i);
const n = this;
this.fullscreen = {
get active() {
return t(n, V);
},
supported: !0,
enter: () => o(this, s, l).call(this, "requestFullscreen"),
exit: () => o(this, s, l).call(this, "exitFullscreen")
};
}
get type() {
return "vimeo";
}
get currentSrc() {
return t(this, g);
}
get videoId() {
return t(this, y).call(this);
}
get hash() {
return t(this, w);
}
get isPro() {
return t(this, k).call(this);
}
preconnect() {
ye(this.getOrigin());
}
setup() {
super.setup(), q(o(this, s, W).bind(this)), q(o(this, s, Y).bind(this)), q(o(this, s, G).bind(this)), t(this, a).notify("provider-setup", this);
}
destroy() {
o(this, s, D).call(this), this.fullscreen = void 0;
const e = "provider destroyed";
for (const i of t(this, m).values())
for (const { reject: n } of i) n(e);
t(this, m).clear(), o(this, s, l).call(this, "destroy");
}
async play() {
return o(this, s, l).call(this, "play");
}
async pause() {
return o(this, s, l).call(this, "pause");
}
setMuted(e) {
o(this, s, l).call(this, "setMuted", e);
}
setCurrentTime(e) {
o(this, s, l).call(this, "seekTo", e), t(this, a).notify("seeking", e);
}
setVolume(e) {
o(this, s, l).call(this, "setVolume", e), o(this, s, l).call(this, "setMuted", Q(t(this, a).$state.muted));
}
setPlaybackRate(e) {
o(this, s, l).call(this, "setPlaybackRate", e);
}
async loadSource(e) {
if (!be(e.src)) {
u(this, g, null), u(this, w, null), t(this, y).set("");
return;
}
const { videoId: i, hash: n } = Pe(e.src);
t(this, y).set(i ?? ""), u(this, w, n ?? null), u(this, g, e);
}
getOrigin() {
return "https://player.vimeo.com";
}
buildParams() {
const { keyDisabled: e } = t(this, a).$props, { playsInline: i, nativeControls: n } = t(this, a).$state, h = n();
return {
title: this.title,
byline: this.byline,
color: this.color,
portrait: this.portrait,
controls: h,
h: this.hash,
keyboard: h && !e(),
transparent: !0,
playsinline: i(),
dnt: !this.cookies
};
}
onMessage(e, i) {
e.event ? o(this, s, ce).call(this, e.event, e.data, i) : e.method && o(this, s, Z).call(this, e.method, e.value, i);
}
onLoad() {
}
}
a = new WeakMap(), y = new WeakMap(), k = new WeakMap(), w = new WeakMap(), g = new WeakMap(), V = new WeakMap(), v = new WeakMap(), $ = new WeakMap(), A = new WeakMap(), P = new WeakMap(), m = new WeakMap(), E = new WeakMap(), s = new WeakSet(), W = function() {
o(this, s, D).call(this);
const e = t(this, y).call(this);
if (!e) {
this.src.set("");
return;
}
this.src.set(`${this.getOrigin()}/video/${e}`), t(this, a).notify("load-start");
}, Y = function() {
const e = t(this, y).call(this);
if (!e) return;
const i = _(), n = new AbortController();
return u(this, E, i), Te(e, n, t(this, w)).then((h) => {
i.resolve(h);
}).catch((h) => {
i.reject();
}), () => {
i.reject(), n.abort();
};
}, G = function() {
const e = t(this, k).call(this), { $state: i, qualities: n } = t(this, a);
if (i.canSetPlaybackRate.set(e), n[R.setReadonly](!e), e)
return ke(n, "change", () => {
var d;
if (n.auto) return;
const h = (d = n.selected) == null ? void 0 : d.id;
h && o(this, s, l).call(this, "setQuality", h);
});
}, H = function() {
o(this, s, l).call(this, "getCurrentTime");
}, T = new WeakMap(), J = function(e, i) {
if (t(this, T) && e === 0) return;
const { realCurrentTime: n, paused: h, bufferedEnd: d, seekableEnd: p, live: I } = t(this, a).$state;
if (n() === e) return;
const M = n();
t(this, a).notify("time-change", e, i), Math.abs(M - e) > 1.5 && (t(this, a).notify("seeking", e, i), !h() && d() < e && t(this, a).notify("waiting", void 0, i)), !I() && p() - e < 0.01 && (t(this, a).notify("end", void 0, i), u(this, T, !0), setTimeout(() => {
u(this, T, !1);
}, 500));
}, K = function(e, i) {
t(this, a).notify("seeked", e, i);
}, X = function(e) {
var n;
const i = t(this, y).call(this);
(n = t(this, E)) == null || n.promise.then((h) => {
if (!h) return;
const { title: d, poster: p, duration: I, pro: M } = h;
t(this, k).set(M), t(this, a).notify("title-change", d, e), t(this, a).notify("poster-change", p, e), t(this, a).notify("duration-change", I, e), o(this, s, x).call(this, I, e);
}).catch(() => {
i === t(this, y).call(this) && (o(this, s, l).call(this, "getVideoTitle"), o(this, s, l).call(this, "getDuration"));
});
}, x = function(e, i) {
const { nativeControls: n } = t(this, a).$state, h = n();
u(this, v, new C(0, e));
const d = {
buffered: new C(0, 0),
seekable: t(this, v),
duration: e
};
t(this, a).delegate.ready(d, i), h || o(this, s, l).call(this, "_hideOverlay"), o(this, s, l).call(this, "getQualities"), o(this, s, l).call(this, "getChapters");
}, Z = function(e, i, n) {
var h;
switch (e) {
case "getVideoTitle":
const d = i;
t(this, a).notify("title-change", d, n);
break;
case "getDuration":
const p = i;
t(this, a).$state.canPlay() ? t(this, a).notify("duration-change", p, n) : o(this, s, x).call(this, p, n);
break;
case "getCurrentTime":
o(this, s, J).call(this, i, n);
break;
case "getBuffered":
ve(i) && i.length && o(this, s, L).call(this, i[i.length - 1][1], n);
break;
case "setMuted":
o(this, s, F).call(this, Q(t(this, a).$state.volume), i, n);
break;
case "getChapters":
o(this, s, he).call(this, i);
break;
case "getQualities":
o(this, s, re).call(this, i, n);
break;
}
(h = o(this, s, j).call(this, e)) == null || h.resolve();
}, ee = function() {
for (const e of Ce)
o(this, s, l).call(this, "addEventListener", e);
}, te = function(e) {
t(this, $).stop(), t(this, a).notify("pause", void 0, e);
}, se = function(e) {
t(this, $).start(), t(this, a).notify("play", void 0, e);
}, ie = function(e) {
const { paused: i } = t(this, a).$state;
!i() && !t(this, T) && t(this, a).notify("playing", void 0, e);
}, L = function(e, i) {
const n = {
buffered: new C(0, e),
seekable: t(this, v)
};
t(this, a).notify("progress", n, i);
}, ne = function(e) {
t(this, a).notify("waiting", void 0, e);
}, ae = function(e) {
const { paused: i } = t(this, a).$state;
i() || t(this, a).notify("playing", void 0, e);
}, oe = function(e) {
const { paused: i } = t(this, a).$state;
i() && t(this, a).notify("play", void 0, e), t(this, a).notify("waiting", void 0, e);
}, F = function(e, i, n) {
const h = { volume: e, muted: i };
t(this, a).notify("volume-change", h, n);
}, // #onTextTrackChange(track: VimeoTextTrack, trigger: Event) {
// const textTrack = this.#ctx.textTracks.toArray().find((t) => t.language === track.language);
// if (textTrack) textTrack.mode = track.mode;
// }
// #onTextTracksChange(tracks: VimeoTextTrack[], trigger: Event) {
// for (const init of tracks) {
// const textTrack = new TextTrack({
// ...init,
// label: init.label.replace('auto-generated', 'auto'),
// });
// textTrack[TextTrackSymbol.readyState] = 2;
// this.#ctx.textTracks.add(textTrack, trigger);
// textTrack.setMode(init.mode, trigger);
// }
// }
// #onCueChange(cue: VimeoTextCue, trigger: Event) {
// const { textTracks, $state } = this.#ctx,
// { currentTime } = $state,
// track = textTracks.selected;
// if (this.#currentCue) track?.removeCue(this.#currentCue, trigger);
// this.#currentCue = new window.VTTCue(currentTime(), Number.MAX_SAFE_INTEGER, cue.text);
// track?.addCue(this.#currentCue, trigger);
// }
he = function(e) {
if (o(this, s, O).call(this), !e.length) return;
const i = new me({
kind: "chapters",
default: !0
}), { seekableEnd: n } = t(this, a).$state;
for (let h = 0; h < e.length; h++) {
const d = e[h], p = e[h + 1];
i.addCue(
new window.VTTCue(
d.startTime,
(p == null ? void 0 : p.startTime) ?? n(),
d.title
)
);
}
u(this, P, i), t(this, a).textTracks.add(i);
}, O = function() {
t(this, P) && (t(this, a).textTracks.remove(t(this, P)), u(this, P, null));
}, re = function(e, i) {
t(this, a).qualities[z.enableAuto] = e.some((n) => n.id === "auto") ? () => o(this, s, l).call(this, "setQuality", "auto") : void 0;
for (const n of e) {
if (n.id === "auto") continue;
const h = +n.id.slice(0, -1);
isNaN(h) || t(this, a).qualities[R.add](
{
id: n.id,
width: h * (16 / 9),
height: h,
codec: "avc1,h.264",
bitrate: -1
},
i
);
}
o(this, s, B).call(this, e.find((n) => n.active), i);
}, B = function({ id: e } = {}, i) {
if (!e) return;
const n = e === "auto", h = t(this, a).qualities.getById(e);
n ? (t(this, a).qualities[z.setAuto](n, i), t(this, a).qualities[R.select](void 0, !0, i)) : t(this, a).qualities[R.select](h ?? void 0, !0, i);
}, ce = function(e, i, n) {
switch (e) {
case "ready":
o(this, s, ee).call(this);
break;
case "loaded":
o(this, s, X).call(this, n);
break;
case "play":
o(this, s, se).call(this, n);
break;
case "playProgress":
o(this, s, ie).call(this, n);
break;
case "pause":
o(this, s, te).call(this, n);
break;
case "loadProgress":
o(this, s, L).call(this, i.seconds, n);
break;
case "waiting":
o(this, s, oe).call(this, n);
break;
case "bufferstart":
o(this, s, ne).call(this, n);
break;
case "bufferend":
o(this, s, ae).call(this, n);
break;
case "volumechange":
o(this, s, F).call(this, i.volume, Q(t(this, a).$state.muted), n);
break;
case "durationchange":
u(this, v, new C(0, i.duration)), t(this, a).notify("duration-change", i.duration, n);
break;
case "playbackratechange":
t(this, a).notify("rate-change", i.playbackRate, n);
break;
case "qualitychange":
o(this, s, B).call(this, i, n);
break;
case "fullscreenchange":
u(this, V, i.fullscreen), t(this, a).notify("fullscreen-change", i.fullscreen, n);
break;
case "enterpictureinpicture":
t(this, a).notify("picture-in-picture-change", !0, n);
break;
case "leavepictureinpicture":
t(this, a).notify("picture-in-picture-change", !1, n);
break;
case "ended":
t(this, a).notify("end", void 0, n);
break;
case "error":
o(this, s, le).call(this, i, n);
break;
case "seek":
case "seeked":
o(this, s, K).call(this, i.seconds, n);
break;
}
}, le = function(e, i) {
var d;
const { message: n, method: h } = e;
h === "setPlaybackRate" && t(this, k).set(!1), h && ((d = o(this, s, j).call(this, h)) == null || d.reject(n));
}, l = async function(e, i) {
let n = _(), h = t(this, m).get(e);
return h || t(this, m).set(e, h = []), h.push(n), this.postMessage({
method: e,
value: i
}), n.promise;
}, D = function() {
t(this, $).stop(), u(this, v, new C(0, 0)), u(this, E, null), u(this, A, null), t(this, k).set(!1), o(this, s, O).call(this);
}, j = function(e) {
var i;
return (i = t(this, m).get(e)) == null ? void 0 : i.shift();
};
export {
Re as VimeoProvider
};
//# sourceMappingURL=vidstack-BqgQkvb4-BAUzB5A8.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,141 @@
var k = Object.defineProperty;
var w = (t) => {
throw TypeError(t);
};
var A = (t, e, a) => e in t ? k(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
var u = (t, e, a) => A(t, typeof e != "symbol" ? e + "" : e, a), C = (t, e, a) => e.has(t) || w("Cannot " + a);
var c = (t, e, a) => (C(t, e, "read from private field"), a ? a.call(t) : e.get(t)), m = (t, e, a) => e.has(t) ? w("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, a), E = (t, e, a, o) => (C(t, e, "write to private field"), o ? o.call(t, a) : e.set(t, a), a), s = (t, e, a) => (C(t, e, "access private method"), a);
import { m as P, I as O, K as R, M as b, l as D, J as G, v as L } from "./lib-export-CI8auKfP.js";
function M() {
return "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";
}
function N() {
var t;
return !!((t = window.cast) != null && t.framework);
}
function F() {
var t, e;
return !!((e = (t = window.chrome) == null ? void 0 : t.cast) != null && e.isAvailable);
}
function v() {
return g().getCastState() === cast.framework.CastState.CONNECTED;
}
function g() {
return window.cast.framework.CastContext.getInstance();
}
function y() {
return g().getCurrentSession();
}
function T() {
var t;
return (t = y()) == null ? void 0 : t.getSessionObj().media[0];
}
function z(t) {
var a;
return ((a = T()) == null ? void 0 : a.media.contentId) === (t == null ? void 0 : t.src);
}
function U() {
return {
language: "en-US",
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
receiverApplicationId: chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,
resumeSavedSession: !0,
androidReceiverCompatible: !0
};
}
function j(t) {
return `Google Cast Error Code: ${t}`;
}
function q(t, e) {
return P(g(), t, e);
}
var n, r, S, I, _, l, d;
class J {
constructor() {
m(this, r);
u(this, "name", "google-cast");
u(this, "target");
m(this, n);
}
/**
* @see {@link https://developers.google.com/cast/docs/reference/web_sender/cast.framework.CastContext}
*/
get cast() {
return g();
}
mediaType() {
return "video";
}
canPlay(e) {
return O && !b && R(e);
}
async prompt(e) {
var h;
let a, o, i;
try {
a = await s(this, r, S).call(this, e), c(this, n) || (E(this, n, new cast.framework.RemotePlayer()), new cast.framework.RemotePlayerController(c(this, n))), o = e.player.createEvent("google-cast-prompt-open", {
trigger: a
}), e.player.dispatchEvent(o), s(this, r, l).call(this, e, "connecting", o), await s(this, r, I).call(this, D(e.$props.googleCast)), e.$state.remotePlaybackInfo.set({
deviceName: (h = y()) == null ? void 0 : h.getCastDevice().friendlyName
}), v() && s(this, r, l).call(this, e, "connected", o);
} catch (p) {
const f = p instanceof Error ? p : s(this, r, d).call(this, (p + "").toUpperCase(), "Prompt failed.");
throw i = e.player.createEvent("google-cast-prompt-error", {
detail: f,
trigger: o ?? a,
cancelable: !0
}), e.player.dispatch(i), s(this, r, l).call(this, e, v() ? "connected" : "disconnected", i), f;
} finally {
e.player.dispatch("google-cast-prompt-close", {
trigger: i ?? o ?? a
});
}
}
async load(e) {
if (G)
throw Error("[vidstack] can not load google cast provider server-side");
if (!c(this, n))
throw Error("[vidstack] google cast player was not initialized");
return new (await import("./vidstack-BeT6vBOi-DhlHLgwc.js")).GoogleCastProvider(c(this, n), e);
}
}
n = new WeakMap(), r = new WeakSet(), S = async function(e) {
if (N()) return;
const a = e.player.createEvent("google-cast-load-start");
e.player.dispatch(a), await L(M()), await customElements.whenDefined("google-cast-launcher");
const o = e.player.createEvent("google-cast-loaded", { trigger: a });
if (e.player.dispatch(o), !F())
throw s(this, r, d).call(this, "CAST_NOT_AVAILABLE", "Google Cast not available on this platform.");
return o;
}, I = async function(e) {
s(this, r, _).call(this, e);
const a = await this.cast.requestSession();
if (a)
throw s(this, r, d).call(this, a.toUpperCase(), j(a));
}, _ = function(e) {
var a;
(a = this.cast) == null || a.setOptions({
...U(),
...e
});
}, l = function(e, a, o) {
const i = { type: "google-cast", state: a };
e.notify("remote-playback-change", i, o);
}, d = function(e, a) {
const o = Error(a);
return o.code = e, o;
};
var B = /* @__PURE__ */ Object.freeze({
__proto__: null,
GoogleCastLoader: J
});
export {
g as getCastContext,
j as getCastErrorMessage,
y as getCastSession,
T as getCastSessionMedia,
z as hasActiveCastSession,
q as listenCastContextEvent,
B as loader
};
//# sourceMappingURL=vidstack-CQQ1xKSy-CZZk6e1l.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,238 @@
var A = Object.defineProperty;
var D = (r) => {
throw TypeError(r);
};
var N = (r, n, e) => n in r ? A(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
var T = (r, n, e) => N(r, typeof n != "symbol" ? n + "" : n, e), R = (r, n, e) => n.has(r) || D("Cannot " + e);
var s = (r, n, e) => (R(r, n, "read from private field"), e ? e.call(r) : n.get(r)), p = (r, n, e) => n.has(r) ? D("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, e), l = (r, n, e, t) => (R(r, n, "write to private field"), t ? t.call(r, e) : n.set(r, e), e), o = (r, n, e) => (R(r, n, "access private method"), e);
import { x as q, y as G, k as H, n as J, h as K, A as Q, z as M, C as W, E as $, F as X } from "./lib-export-CI8auKfP.js";
import { E as Z } from "./vidstack-FldwQc2Q-PD3aMpLc.js";
import { resolveYouTubeVideoId as ee } from "./vidstack-Dm1xEU9Q-qSXq3AI-.js";
import "react";
const b = {
Ended: 0,
Playing: 1,
Paused: 2,
Buffering: 3,
Cued: 5
};
var a, k, v, S, P, f, y, i, te, se, O, m, j, F, Y, I, C, x, L, _, E, U;
class de extends Z {
constructor(e, t) {
super(e);
p(this, i);
T(this, "$$PROVIDER_TYPE", "YOUTUBE");
T(this, "scope", q());
p(this, a);
p(this, k, G(""));
p(this, v, -1);
p(this, S, null);
p(this, P, -1);
p(this, f, !1);
p(this, y, /* @__PURE__ */ new Map());
/**
* Sets the player's interface language. The parameter value is an ISO 639-1 two-letter
* language code or a fully specified locale. For example, fr and fr-ca are both valid values.
* Other language input codes, such as IETF language tags (BCP 47) might also be handled properly.
*
* The interface language is used for tooltips in the player and also affects the default caption
* track. Note that YouTube might select a different caption track language for a particular
* user based on the user's individual language preferences and the availability of caption tracks.
*
* @defaultValue 'en'
*/
T(this, "language", "en");
T(this, "color", "red");
/**
* Whether cookies should be enabled on the embed. This is turned off by default to be
* GDPR-compliant.
*
* @defaultValue `false`
*/
T(this, "cookies", !1);
l(this, a, t);
}
get currentSrc() {
return s(this, S);
}
get type() {
return "youtube";
}
get videoId() {
return s(this, k).call(this);
}
preconnect() {
H(this.getOrigin());
}
setup() {
super.setup(), J(o(this, i, O).bind(this)), s(this, a).notify("provider-setup", this);
}
destroy() {
o(this, i, _).call(this);
const e = "provider destroyed";
for (const t of s(this, y).values())
for (const { reject: d } of t) d(e);
s(this, y).clear();
}
async play() {
return o(this, i, m).call(this, "playVideo");
}
async pause() {
return o(this, i, m).call(this, "pauseVideo");
}
setMuted(e) {
e ? o(this, i, m).call(this, "mute") : o(this, i, m).call(this, "unMute");
}
setCurrentTime(e) {
o(this, i, m).call(this, "seekTo", e), s(this, a).notify("seeking", e);
}
setVolume(e) {
o(this, i, m).call(this, "setVolume", e * 100);
}
setPlaybackRate(e) {
o(this, i, m).call(this, "setPlaybackRate", e);
}
async loadSource(e) {
if (!K(e.src)) {
l(this, S, null), s(this, k).set("");
return;
}
const t = ee(e.src);
s(this, k).set(t ?? ""), l(this, S, e);
}
getOrigin() {
return this.cookies ? "https://www.youtube.com" : "https://www.youtube-nocookie.com";
}
buildParams() {
const { keyDisabled: e } = s(this, a).$props, { muted: t, playsInline: d, nativeControls: u } = s(this, a).$state, h = u();
return {
rel: 0,
autoplay: 0,
cc_lang_pref: this.language,
cc_load_policy: h ? 1 : void 0,
color: this.color,
controls: h ? 1 : 0,
disablekb: !h || e() ? 1 : 0,
enablejsapi: 1,
fs: 1,
hl: this.language,
iv_load_policy: h ? 1 : 3,
mute: t() ? 1 : 0,
playsinline: d() ? 1 : 0
};
}
onLoad() {
window.setTimeout(() => this.postMessage({ event: "listening" }), 100);
}
onMessage({ info: e }, t) {
var c;
if (!e) return;
const { title: d, intrinsicDuration: u, playbackRate: h } = s(this, a).$state;
if (W(e.videoData) && e.videoData.title !== d() && s(this, a).notify("title-change", e.videoData.title, t), $(e.duration) && e.duration !== u()) {
if ($(e.videoLoadedFraction)) {
const g = ((c = e.progressState) == null ? void 0 : c.loaded) ?? e.videoLoadedFraction * e.duration, w = new M(0, e.duration);
o(this, i, I).call(this, g, w, t);
}
s(this, a).notify("duration-change", e.duration, t);
}
if ($(e.playbackRate) && e.playbackRate !== h() && s(this, a).notify("rate-change", e.playbackRate, t), e.progressState) {
const { current: g, seekableStart: w, seekableEnd: V, loaded: z, duration: B } = e.progressState;
o(this, i, Y).call(this, g, t), o(this, i, I).call(this, z, new M(w, V), t), B !== u() && s(this, a).notify("duration-change", B, t);
}
if ($(e.volume) && X(e.muted) && !s(this, f)) {
const g = {
muted: e.muted,
volume: e.volume / 100
};
s(this, a).notify("volume-change", g, t);
}
$(e.playerState) && e.playerState !== s(this, v) && o(this, i, L).call(this, e.playerState, t);
}
}
a = new WeakMap(), k = new WeakMap(), v = new WeakMap(), S = new WeakMap(), P = new WeakMap(), f = new WeakMap(), y = new WeakMap(), i = new WeakSet(), te = function(e) {
var t;
(t = o(this, i, E).call(this, "playVideo")) == null || t.reject(e);
}, se = function(e) {
var t;
(t = o(this, i, E).call(this, "pauseVideo")) == null || t.reject(e);
}, O = function() {
o(this, i, _).call(this);
const e = s(this, k).call(this);
if (!e) {
this.src.set("");
return;
}
this.src.set(`${this.getOrigin()}/embed/${e}`), s(this, a).notify("load-start");
}, m = function(e, t) {
let d = Q(), u = s(this, y).get(e);
return u || s(this, y).set(e, u = []), u.push(d), this.postMessage({
event: "command",
func: e,
args: t ? [t] : void 0
}), d.promise;
}, j = function(e) {
s(this, a).notify("loaded-metadata"), s(this, a).notify("loaded-data"), s(this, a).delegate.ready(void 0, e);
}, F = function(e) {
var t;
(t = o(this, i, E).call(this, "pauseVideo")) == null || t.resolve(), s(this, a).notify("pause", void 0, e);
}, Y = function(e, t) {
const { duration: d, realCurrentTime: u } = s(this, a).$state, h = s(this, v) === b.Ended, c = h ? d() : e;
s(this, a).notify("time-change", c, t), !h && Math.abs(c - u()) > 1 && s(this, a).notify("seeking", c, t);
}, I = function(e, t, d) {
const u = {
buffered: new M(0, e),
seekable: t
};
s(this, a).notify("progress", u, d);
const { seeking: h, realCurrentTime: c } = s(this, a).$state;
h() && e > c() && o(this, i, C).call(this, d);
}, C = function(e) {
const { paused: t, realCurrentTime: d } = s(this, a).$state;
window.clearTimeout(s(this, P)), l(this, P, window.setTimeout(
() => {
s(this, a).notify("seeked", d(), e), l(this, P, -1);
},
t() ? 100 : 0
));
}, x = function(e) {
const { seeking: t } = s(this, a).$state;
t() && o(this, i, C).call(this, e), s(this, a).notify("pause", void 0, e), s(this, a).notify("end", void 0, e);
}, L = function(e, t) {
var V;
const { paused: d, seeking: u } = s(this, a).$state, h = e === b.Playing, c = e === b.Buffering, g = o(this, i, U).call(this, "playVideo"), w = d() && (c || h);
if (c && s(this, a).notify("waiting", void 0, t), u() && h && o(this, i, C).call(this, t), s(this, f) && h) {
this.pause(), l(this, f, !1), this.setMuted(s(this, a).$state.muted());
return;
}
if (!g && w) {
l(this, f, !0), this.setMuted(!0);
return;
}
switch (w && ((V = o(this, i, E).call(this, "playVideo")) == null || V.resolve(), s(this, a).notify("play", void 0, t)), e) {
case b.Cued:
o(this, i, j).call(this, t);
break;
case b.Playing:
s(this, a).notify("playing", void 0, t);
break;
case b.Paused:
o(this, i, F).call(this, t);
break;
case b.Ended:
o(this, i, x).call(this, t);
break;
}
l(this, v, e);
}, _ = function() {
l(this, v, -1), l(this, P, -1), l(this, f, !1);
}, E = function(e) {
var t;
return (t = s(this, y).get(e)) == null ? void 0 : t.shift();
}, U = function(e) {
var t;
return !!((t = s(this, y).get(e)) != null && t.length);
};
export {
de as YouTubeProvider
};
//# sourceMappingURL=vidstack-DHmfHold-D561ZrLq.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,32 @@
const i = /(?:youtu\.be|youtube|youtube\.com|youtube-nocookie\.com)(?:\/shorts)?\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=|)((?:\w|-){11})/, u = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
function l(e) {
var t;
return (t = e.match(i)) == null ? void 0 : t[1];
}
async function b(e, t) {
if (u.has(e)) return u.get(e);
if (n.has(e)) return n.get(e);
const s = new Promise(async (r) => {
const c = ["maxresdefault", "sddefault", "hqdefault"];
for (const a of c)
for (const f of [!0, !1]) {
const o = p(e, a, f);
if ((await fetch(o, {
mode: "no-cors",
signal: t.signal
})).status < 400) {
u.set(e, o), r(o);
return;
}
}
}).catch(() => "").finally(() => n.delete(e));
return n.set(e, s), s;
}
function p(e, t, s) {
return `https://i.ytimg.com/${s ? "vi_webp" : "vi"}/${e}/${t}.${s ? "webp" : "jpg"}`;
}
export {
b as findYouTubePoster,
l as resolveYouTubeVideoId
};
//# sourceMappingURL=vidstack-Dm1xEU9Q-qSXq3AI-.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"vidstack-Dm1xEU9Q-qSXq3AI-.js","sources":["../node_modules/@vidstack/react/prod/chunks/vidstack-Dm1xEU9Q.js"],"sourcesContent":["\"use client\"\n\nconst videoIdRE = /(?:youtu\\.be|youtube|youtube\\.com|youtube-nocookie\\.com)(?:\\/shorts)?\\/(?:embed\\/|v\\/|watch\\?v=|watch\\?.+&v=|)((?:\\w|-){11})/;\nconst posterCache = /* @__PURE__ */ new Map();\nconst pendingFetch = /* @__PURE__ */ new Map();\nfunction resolveYouTubeVideoId(src) {\n return src.match(videoIdRE)?.[1];\n}\nasync function findYouTubePoster(videoId, abort) {\n if (posterCache.has(videoId)) return posterCache.get(videoId);\n if (pendingFetch.has(videoId)) return pendingFetch.get(videoId);\n const pending = new Promise(async (resolve) => {\n const sizes = [\"maxresdefault\", \"sddefault\", \"hqdefault\"];\n for (const size of sizes) {\n for (const webp of [true, false]) {\n const url = resolveYouTubePosterURL(videoId, size, webp), response = await fetch(url, {\n mode: \"no-cors\",\n signal: abort.signal\n });\n if (response.status < 400) {\n posterCache.set(videoId, url);\n resolve(url);\n return;\n }\n }\n }\n }).catch(() => \"\").finally(() => pendingFetch.delete(videoId));\n pendingFetch.set(videoId, pending);\n return pending;\n}\nfunction resolveYouTubePosterURL(videoId, size, webp) {\n const type = webp ? \"webp\" : \"jpg\";\n return `https://i.ytimg.com/${webp ? \"vi_webp\" : \"vi\"}/${videoId}/${size}.${type}`;\n}\n\nexport { findYouTubePoster, resolveYouTubeVideoId };\n"],"names":["videoIdRE","posterCache","pendingFetch","resolveYouTubeVideoId","src","_a","findYouTubePoster","videoId","abort","pending","resolve","sizes","size","webp","url","resolveYouTubePosterURL"],"mappings":"AAEA,MAAMA,IAAY,gIACZC,IAA8B,oBAAI,IAAG,GACrCC,IAA+B,oBAAI,IAAG;AAC5C,SAASC,EAAsBC,GAAK;AAHpC,MAAAC;AAIE,UAAOA,IAAAD,EAAI,MAAMJ,CAAS,MAAnB,gBAAAK,EAAuB;AAChC;AACA,eAAeC,EAAkBC,GAASC,GAAO;AAC/C,MAAIP,EAAY,IAAIM,CAAO,EAAG,QAAON,EAAY,IAAIM,CAAO;AAC5D,MAAIL,EAAa,IAAIK,CAAO,EAAG,QAAOL,EAAa,IAAIK,CAAO;AAC9D,QAAME,IAAU,IAAI,QAAQ,OAAOC,MAAY;AAC7C,UAAMC,IAAQ,CAAC,iBAAiB,aAAa,WAAW;AACxD,eAAWC,KAAQD;AACjB,iBAAWE,KAAQ,CAAC,IAAM,EAAK,GAAG;AAChC,cAAMC,IAAMC,EAAwBR,GAASK,GAAMC,CAAI;AAIvD,aAJqE,MAAM,MAAMC,GAAK;AAAA,UACpF,MAAM;AAAA,UACN,QAAQN,EAAM;AAAA,QACxB,CAAS,GACY,SAAS,KAAK;AACzB,UAAAP,EAAY,IAAIM,GAASO,CAAG,GAC5BJ,EAAQI,CAAG;AACX;AAAA,QACF;AAAA,MACF;AAAA,EAEJ,CAAC,EAAE,MAAM,MAAM,EAAE,EAAE,QAAQ,MAAMZ,EAAa,OAAOK,CAAO,CAAC;AAC7D,SAAAL,EAAa,IAAIK,GAASE,CAAO,GAC1BA;AACT;AACA,SAASM,EAAwBR,GAASK,GAAMC,GAAM;AAEpD,SAAO,uBAAuBA,IAAO,YAAY,IAAI,IAAIN,CAAO,IAAIK,CAAI,IAD3DC,IAAO,SAAS,KACmD;AAClF;","x_google_ignoreList":[0]}

View File

@ -0,0 +1,61 @@
var y = Object.defineProperty;
var g = (s) => {
throw TypeError(s);
};
var w = (s, t, r) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[t] = r;
var c = (s, t, r) => w(s, typeof t != "symbol" ? t + "" : t, r), h = (s, t, r) => t.has(s) || g("Cannot " + r);
var e = (s, t, r) => (h(s, t, "read from private field"), r ? r.call(s) : t.get(s)), u = (s, t, r) => t.has(s) ? g("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, r), p = (s, t, r, a) => (h(s, t, "write to private field"), a ? a.call(s, r) : t.set(s, r), r), l = (s, t, r) => (h(s, t, "access private method"), r);
import { y as M, m as f, n as A, l as P, G as S, J as E, h as O } from "./lib-export-CI8auKfP.js";
var i, o, b, m;
class W {
constructor(t) {
u(this, o);
u(this, i);
c(this, "src", M(""));
/**
* Defines which referrer is sent when fetching the resource.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy}
*/
c(this, "referrerPolicy", null);
p(this, i, t), t.setAttribute("frameBorder", "0"), t.setAttribute("aria-hidden", "true"), t.setAttribute(
"allow",
"autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope"
), this.referrerPolicy !== null && t.setAttribute("referrerpolicy", this.referrerPolicy);
}
get iframe() {
return e(this, i);
}
setup() {
f(window, "message", l(this, o, m).bind(this)), f(e(this, i), "load", this.onLoad.bind(this)), A(l(this, o, b).bind(this));
}
postMessage(t, r) {
var a;
E || (a = e(this, i).contentWindow) == null || a.postMessage(JSON.stringify(t), r ?? "*");
}
}
i = new WeakMap(), o = new WeakSet(), b = function() {
const t = this.src();
if (!t.length) {
e(this, i).setAttribute("src", "");
return;
}
const r = P(() => this.buildParams());
e(this, i).setAttribute("src", S(t, r));
}, m = function(t) {
var d;
const r = this.getOrigin();
if ((t.source === null || t.source === ((d = e(this, i)) == null ? void 0 : d.contentWindow)) && (!O(r) || r === t.origin)) {
try {
const n = JSON.parse(t.data);
n && this.onMessage(n, t);
return;
} catch {
}
t.data && this.onMessage(t.data, t);
}
};
export {
W as E
};
//# sourceMappingURL=vidstack-FldwQc2Q-PD3aMpLc.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"vidstack-FldwQc2Q-PD3aMpLc.js","sources":["../node_modules/@vidstack/react/prod/chunks/vidstack-FldwQc2Q.js"],"sourcesContent":["\"use client\"\n\nimport { appendParamsToURL, IS_SERVER } from './vidstack-D5Pzx_k5.js';\nimport { signal, listenEvent, effect, peek, isString } from './vidstack-CZgUA94N.js';\n\nclass EmbedProvider {\n #iframe;\n src = signal(\"\");\n /**\n * Defines which referrer is sent when fetching the resource.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy}\n */\n referrerPolicy = null;\n get iframe() {\n return this.#iframe;\n }\n constructor(iframe) {\n this.#iframe = iframe;\n iframe.setAttribute(\"frameBorder\", \"0\");\n iframe.setAttribute(\"aria-hidden\", \"true\");\n iframe.setAttribute(\n \"allow\",\n \"autoplay; fullscreen; encrypted-media; picture-in-picture; accelerometer; gyroscope\"\n );\n if (this.referrerPolicy !== null) {\n iframe.setAttribute(\"referrerpolicy\", this.referrerPolicy);\n }\n }\n setup() {\n listenEvent(window, \"message\", this.#onWindowMessage.bind(this));\n listenEvent(this.#iframe, \"load\", this.onLoad.bind(this));\n effect(this.#watchSrc.bind(this));\n }\n #watchSrc() {\n const src = this.src();\n if (!src.length) {\n this.#iframe.setAttribute(\"src\", \"\");\n return;\n }\n const params = peek(() => this.buildParams());\n this.#iframe.setAttribute(\"src\", appendParamsToURL(src, params));\n }\n postMessage(message, target) {\n if (IS_SERVER) return;\n this.#iframe.contentWindow?.postMessage(JSON.stringify(message), target ?? \"*\");\n }\n #onWindowMessage(event) {\n const origin = this.getOrigin(), isOriginMatch = (event.source === null || event.source === this.#iframe?.contentWindow) && (!isString(origin) || origin === event.origin);\n if (!isOriginMatch) return;\n try {\n const message = JSON.parse(event.data);\n if (message) this.onMessage(message, event);\n return;\n } catch (e) {\n }\n if (event.data) this.onMessage(event.data, event);\n }\n}\n\nexport { EmbedProvider };\n"],"names":["EmbedProvider","iframe","__privateAdd","_EmbedProvider_instances","_iframe","__publicField","signal","__privateSet","__privateGet","listenEvent","__privateMethod","onWindowMessage_fn","effect","watchSrc_fn","message","target","IS_SERVER","_a","src","params","peek","appendParamsToURL","event","origin","isString"],"mappings":";;;;;;;;;AAKA,MAAMA,EAAc;AAAA,EAYlB,YAAYC,GAAQ;AAZtB,IAAAC,EAAA,MAAAC;AACE,IAAAD,EAAA,MAAAE;AACA,IAAAC,EAAA,aAAMC,EAAO,EAAE;AAMf;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAD,EAAA,wBAAiB;AAKf,IAAAE,EAAA,MAAKH,GAAUH,IACfA,EAAO,aAAa,eAAe,GAAG,GACtCA,EAAO,aAAa,eAAe,MAAM,GACzCA,EAAO;AAAA,MACL;AAAA,MACA;AAAA,IACN,GACQ,KAAK,mBAAmB,QAC1BA,EAAO,aAAa,kBAAkB,KAAK,cAAc;AAAA,EAE7D;AAAA,EAdA,IAAI,SAAS;AACX,WAAOO,EAAA,MAAKJ;AAAA,EACd;AAAA,EAaA,QAAQ;AACN,IAAAK,EAAY,QAAQ,WAAWC,EAAA,MAAKP,GAAAQ,GAAiB,KAAK,IAAI,CAAC,GAC/DF,EAAYD,EAAA,MAAKJ,IAAS,QAAQ,KAAK,OAAO,KAAK,IAAI,CAAC,GACxDQ,EAAOF,EAAA,MAAKP,GAAAU,GAAU,KAAK,IAAI,CAAC;AAAA,EAClC;AAAA,EAUA,YAAYC,GAASC,GAAQ;;AAC3B,IAAIC,MACJC,IAAAT,EAAA,MAAKJ,GAAQ,kBAAb,QAAAa,EAA4B,YAAY,KAAK,UAAUH,CAAO,GAAGC,KAAU;AAAA,EAC7E;AAYF;AApDEX,IAAA,eADFD,IAAA,eA6BEU,IAAS,WAAG;AACV,QAAMK,IAAM,KAAK,IAAG;AACpB,MAAI,CAACA,EAAI,QAAQ;AACf,IAAAV,EAAA,MAAKJ,GAAQ,aAAa,OAAO,EAAE;AACnC;AAAA,EACF;AACA,QAAMe,IAASC,EAAK,MAAM,KAAK,YAAW,CAAE;AAC5C,EAAAZ,EAAA,MAAKJ,GAAQ,aAAa,OAAOiB,EAAkBH,GAAKC,CAAM,CAAC;AACjE,GAKAR,IAAgB,SAACW,GAAO;;AACtB,QAAMC,IAAS,KAAK,UAAS;AAC7B,OADkDD,EAAM,WAAW,QAAQA,EAAM,aAAWL,IAAAT,EAAA,MAAKJ,OAAL,gBAAAa,EAAc,oBAAmB,CAACO,EAASD,CAAM,KAAKA,MAAWD,EAAM,SAEnK;AAAA,QAAI;AACF,YAAMR,IAAU,KAAK,MAAMQ,EAAM,IAAI;AACrC,MAAIR,KAAS,KAAK,UAAUA,GAASQ,CAAK;AAC1C;AAAA,IACF,QAAY;AAAA,IACZ;AACA,IAAIA,EAAM,QAAM,KAAK,UAAUA,EAAM,MAAMA,CAAK;AAAA;AAClD;","x_google_ignoreList":[0]}

View File

@ -0,0 +1,33 @@
var a = Object.defineProperty;
var o = (i, e, t) => e in i ? a(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
var r = (i, e, t) => o(i, typeof e != "symbol" ? e + "" : e, t);
import { H as d, d as p, e as u } from "./lib-export-CI8auKfP.js";
import "react";
class y extends d {
constructor(t, s) {
super(t, s);
r(this, "$$PROVIDER_TYPE", "AUDIO");
r(this, "airPlay");
p(() => {
this.airPlay = new u(this.media, s);
}, this.scope);
}
get type() {
return "audio";
}
setup() {
super.setup(), this.type === "audio" && this.ctx.notify("provider-setup", this);
}
/**
* The native HTML `<audio>` element.
*
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}
*/
get audio() {
return this.media;
}
}
export {
y as AudioProvider
};
//# sourceMappingURL=vidstack-R_ot4AhB-HEsIT7bU.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"vidstack-R_ot4AhB-HEsIT7bU.js","sources":["../node_modules/@vidstack/react/prod/chunks/vidstack-R_ot4AhB.js"],"sourcesContent":["\"use client\"\n\nimport { scoped } from './vidstack-CZgUA94N.js';\nimport { HTMLMediaProvider, HTMLAirPlayAdapter } from './vidstack-D5Pzx_k5.js';\nimport 'react';\nimport '@floating-ui/dom';\n\nclass AudioProvider extends HTMLMediaProvider {\n $$PROVIDER_TYPE = \"AUDIO\";\n get type() {\n return \"audio\";\n }\n airPlay;\n constructor(audio, ctx) {\n super(audio, ctx);\n scoped(() => {\n this.airPlay = new HTMLAirPlayAdapter(this.media, ctx);\n }, this.scope);\n }\n setup() {\n super.setup();\n if (this.type === \"audio\") this.ctx.notify(\"provider-setup\", this);\n }\n /**\n * The native HTML `<audio>` element.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement}\n */\n get audio() {\n return this.media;\n }\n}\n\nexport { AudioProvider };\n"],"names":["AudioProvider","HTMLMediaProvider","audio","ctx","__publicField","scoped","HTMLAirPlayAdapter"],"mappings":";;;;;AAOA,MAAMA,UAAsBC,EAAkB;AAAA,EAM5C,YAAYC,GAAOC,GAAK;AACtB,UAAMD,GAAOC,CAAG;AANlB,IAAAC,EAAA,yBAAkB;AAIlB,IAAAA,EAAA;AAGE,IAAAC,EAAO,MAAM;AACX,WAAK,UAAU,IAAIC,EAAmB,KAAK,OAAOH,CAAG;AAAA,IACvD,GAAG,KAAK,KAAK;AAAA,EACf;AAAA,EATA,IAAI,OAAO;AACT,WAAO;AAAA,EACT;AAAA,EAQA,QAAQ;AACN,UAAM,MAAK,GACP,KAAK,SAAS,WAAS,KAAK,IAAI,OAAO,kBAAkB,IAAI;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,QAAQ;AACV,WAAO,KAAK;AAAA,EACd;AACF;","x_google_ignoreList":[0]}

Some files were not shown because too many files have changed in this diff Show More