/**
 * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
 */
import React from 'react';
import type { EventInfo, Editor, EditorConfig, EditorWatchdog, WatchdogConfig, ContextWatchdog } from 'ckeditor5';
import { type CKEditorConfigContextMetadata } from './context/setCKEditorReactContextMetadata.js';
import { EditorWatchdogAdapter } from './EditorWatchdogAdapter.js';
import { type EditorRelaxedConstructor } from '@ckeditor/ckeditor5-integrations-common';
export default class CKEditor<TEditor extends Editor> extends React.Component<Props<TEditor>> {
    /**
     * After mounting the editor, the variable will contain a reference to the created editor.
     * @see: https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editor-Editor.html
     */
    private domContainer;
    /**
     * Unlocks element in editor semaphore after destroy editor instance.
     */
    private editorSemaphore;
    static contextType: React.Context<import("./index.js").ContextWatchdogValue<import("ckeditor5").Context> | null>;
    constructor(props: Props<TEditor>);
    private get _semaphoreValue();
    /**
     * An watchdog instance.
     */
    get watchdog(): EditorWatchdog<TEditor> | EditorWatchdogAdapter<TEditor> | null;
    /**
     * An editor instance.
     */
    get editor(): Editor | null;
    /**
     * The CKEditor component should not be updated by React itself.
     * However, if the component identifier changes, the whole structure should be created once again.
     */
    shouldComponentUpdate(nextProps: Readonly<Props<TEditor>>): boolean;
    /**
     * Initialize the editor when the component is mounted.
     */
    componentDidMount(): void;
    /**
     * Re-render the entire component once again. The old editor will be destroyed and the new one will be created.
     */
    componentDidUpdate(): void;
    /**
     * Destroy the editor before unmounting the component.
     */
    componentWillUnmount(): void;
    /**
     * Async destroy attached editor and unlock element semaphore.
     */
    private _unlockLifeCycleSemaphore;
    /**
     * Unlocks previous editor semaphore and creates new one..
     */
    private _initLifeCycleSemaphore;
    /**
     * Render a <div> element which will be replaced by CKEditor.
     */
    render(): React.ReactNode;
    /**
     * Initializes the editor by creating a proper watchdog and initializing it with the editor's configuration.
     */
    private _initializeEditor;
    /**
     * Creates editor in watchdog context.
     *
     * @param watchdog Watchdog adapter.
     * @param config Editor configuration.
     * @returns Editor instance.
     */
    private _watchdogCreateEditor;
    /**
     * Creates an editor from the element and configuration.
     *
     * @param config CKEditor 5 editor configuration.
     * @returns Editor instance.
     */
    private _createEditor;
    /**
     * It gets an extended configuration containing the entries required for the integration configuration.
     *
     * @param resetData Assigns `data` prop value to the configuration if true.
     * @param config The configuration of the editor.
     * @returns Shallow copy of config.
     */
    private _getMergedConfig;
    /**
     * Destroys the editor by destroying the watchdog.
     */
    private _destroyEditor;
}
export interface Props<TEditor extends Editor> {
    editor: EditorRelaxedConstructor<TEditor> & {
        EditorWatchdog: typeof EditorWatchdog;
        ContextWatchdog: typeof ContextWatchdog;
    };
    contextItemMetadata?: CKEditorConfigContextMetadata;
    config?: EditorConfig;
    watchdogConfig?: WatchdogConfig;
    disableWatchdog?: boolean;
    onReady?: (editor: TEditor) => void;
    onAfterDestroy?: (editor: TEditor) => void;
    onError?: (error: Error, details: EditorErrorDetails) => void;
    onChange?: (event: EventInfo, editor: TEditor) => void;
    onFocus?: (event: EventInfo, editor: TEditor) => void;
    onBlur?: (event: EventInfo, editor: TEditor) => void;
    data?: string;
    disabled?: boolean;
    id?: any;
}
/**
 * Error thrown by editor watchdog.
 */
export type EditorErrorDetails = {
    phase: 'initialization' | 'runtime';
    willEditorRestart?: boolean;
};
