/** Type guard for safe editor access — Tiptap can leave a truthy `editor` with nulled internals (extensionManager, view, state) during teardown. */
export const isActiveTextAreaEditor = (editor) => {
    if (!editor ||
        editor.isDestroyed ||
        !editor.extensionManager ||
        !editor.view ||
        !editor.state)
        return false;
    return true;
};
/** Returns the `placeholder` extension if registered, else `undefined` (safer than `.filter(...)[0]`). */
export const getTextAreaPlaceholderExtension = (extensionManager) => {
    if (!extensionManager?.extensions)
        return undefined;
    return extensionManager.extensions.find(extension => extension.name === 'placeholder');
};
