import { Dropzone } from '@mantine/dropzone';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { SerializedEditorState } from 'lexical';
import { SerializedLexicalNode } from 'lexical';

export declare type ActiveUserProfile<DATA extends object> = EditorUser<DATA> & {
    id: string;
};

export declare const DocSpaceStylesProvider: ({ children }: {
    children: React.ReactNode;
}) => JSX_2.Element;

export { Dropzone }

export declare const Editor: <USER_DATA extends object>({ initialContent, onChange, outputFormat, mode, placeholder, maxHeight, onBlur, fetchUploadImage, fetchDeleteImage, maxImageSize, contentModalUploadImage, maxImageSizeError, debounce: debounceMs, disable, ws, excludeNodes, imagePickerSettings }: EditorProps<USER_DATA>) => JSX_2.Element;

declare interface EditorProps<USER_DATA extends object = object> {
    initialContent: Root | string;
    outputFormat: outputFormat;
    onChange: (e: Root | string) => void;
    onBlur?: (e: Root | string) => void;
    onFocus?: (e: Root | string) => void;
    mode?: Mode;
    placeholder?: string;
    maxHeight?: number;
    fetchUploadImage?: FetchUploadImage;
    fetchDeleteImage?: FetchDeleteImage;
    maxImageSize?: number;
    contentModalUploadImage?: React.FunctionComponent;
    maxImageSizeError?: () => void;
    debounce?: number;
    disable?: boolean;
    ws?: EditorWebSocketProps<USER_DATA>;
    excludeNodes?: Record<string, boolean>;
    imagePickerSettings?: ImagePickerSettings;
}

declare type EditorUser<DATA extends object> = {
    color: string;
    name: string;
    awarenessData?: DATA;
};

declare interface EditorWebSocketProps<USER_DATA extends object> {
    url: string;
    id: string;
    user: EditorUser<USER_DATA>;
    getActiveUsers?: (users: ActiveUserProfile<USER_DATA>[]) => void;
}

declare type ErrorDeleteImage = (error?: Error) => void;

declare type FetchDeleteImage = (id: string, success: SuccessDeleteImage, error?: ErrorDeleteImage) => void;

declare type FetchUploadImage = (file: File, success: SuccessUploadImage, error?: ErrorDeleteImage) => void;

declare type ImagePickerSettings = {
    maxUploadFiles?: number;
    unsplashClientId?: string;
    giphyToken?: string;
};

declare type Mode = 'simple' | 'default' | 'full' | 'editor';

declare type outputFormat = 'html' | 'json';

export declare type Root = SerializedEditorState<SerializedLexicalNode>;

declare type SuccessDeleteImage = () => void;

declare type SuccessUploadImage = (url: string, id: string) => void;

export { }


declare global {
    interface DragEvent {
        rangeOffset?: number;
        rangeParent?: Node;
    }
}


declare global {
    interface Navigator {
        userAgentData?: {
            mobile: boolean;
        };
    }
}

declare global {
    interface Document {
        documentMode?: unknown;
    }
    interface Window {
        MSStream?: unknown;
    }
}


declare global {
    interface DragEvent {
        rangeOffset?: number;
        rangeParent?: Node;
    }
}
