import { Attrs, Node } from "@tiptap/pm/model";
import { Editor, JSONContent, Mark, MarkConfig, MarkType, Node as Node$1, NodeConfig, NodeType } from "@tiptap/core";

//#region src/core/event-bus.d.ts
/**
 * Base event map interface for the editor event bus.
 *
 * Components extend this via TypeScript module augmentation:
 * ```ts
 * declare module '@react-email/editor' {
 *   interface EditorEventMap {
 *     'my-component:custom-event': { data: string };
 *   }
 * }
 * ```
 */
interface EditorEventMap {
  'bubble-menu:add-link': undefined;
  'node-clicked': NodeClickedEvent$1;
}
type NodeClickedEvent$1 = {
  nodeType: string;
  nodeAttrs: Attrs;
  nodePos: {
    pos: number;
    inside: number;
  };
};
type EditorEventName = keyof EditorEventMap;
type EditorEventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
interface EditorEventSubscription {
  unsubscribe: () => void;
}
declare class EditorEventBus {
  private prefixEventName;
  dispatch<T extends EditorEventName>(eventName: T, payload: EditorEventMap[T], options?: {
    target?: EventTarget;
  }): void;
  on<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
    target?: EventTarget;
  }): EditorEventSubscription;
}
declare const editorEventBus: EditorEventBus;
declare function useEditorEvent<T extends EditorEventName>(eventName: T, handler: EditorEventHandler<T>, options?: AddEventListenerOptions & {
  target?: EventTarget;
}): void;
//#endregion
//#region src/core/is-document-visually-empty.d.ts
declare function isDocumentVisuallyEmpty(doc: Node): boolean;
//#endregion
//#region src/core/serializer/compose-react-email.d.ts
interface ComposeReactEmailResult {
  html: string;
  text: string;
}
declare const composeReactEmail: ({
  editor,
  preview
}: {
  editor: Editor;
  preview?: string;
}) => Promise<ComposeReactEmailResult>;
//#endregion
//#region src/core/serializer/email-mark.d.ts
type SerializedMark = NonNullable<JSONContent['marks']>[number];
type MarkRendererComponent = (props: {
  mark: SerializedMark;
  node: JSONContent;
  style: React.CSSProperties;
  children?: React.ReactNode;
  extension: EmailMark<any, any>;
}) => React.ReactNode;
interface EmailMarkConfig<Options, Storage> extends MarkConfig<Options, Storage> {
  renderToReactEmail: MarkRendererComponent;
}
type ConfigParameter$1<Options, Storage> = Partial<Omit<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailMarkConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
  name: string;
  options: Options;
  storage: Storage;
  editor: Editor;
  type: MarkType;
  parent: (...args: any[]) => any;
}>;
declare class EmailMark<Options = Record<string, never>, Storage = Record<string, never>> extends Mark<Options, Storage> {
  config: EmailMarkConfig<Options, Storage>;
  constructor(config: ConfigParameter$1<Options, Storage>);
  /**
   * Create a new Mark instance
   * @param config - Mark configuration object or a function that returns a configuration object
   */
  static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter$1<O, S> | (() => ConfigParameter$1<O, S>)): EmailMark<O, S>;
  static from<O, S>(mark: Mark<O, S>, renderToReactEmail: MarkRendererComponent): EmailMark<O, S>;
  configure(options?: Partial<Options>): EmailMark<Options, Storage>;
  extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends MarkConfig<ExtendedOptions, ExtendedStorage> = EmailMarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
    name: string;
    options: ExtendedOptions;
    storage: ExtendedStorage;
    editor: Editor;
    type: MarkType;
  }>)): EmailMark<ExtendedOptions, ExtendedStorage>;
}
//#endregion
//#region src/core/serializer/email-node.d.ts
type NodeRendererComponent = (props: {
  node: JSONContent;
  style: React.CSSProperties;
  children?: React.ReactNode;
  extension: EmailNode<any, any>;
}) => React.ReactNode;
interface EmailNodeConfig<Options, Storage> extends NodeConfig<Options, Storage> {
  renderToReactEmail: NodeRendererComponent;
}
type ConfigParameter<Options, Storage> = Partial<Omit<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'>> & Pick<EmailNodeConfig<Options, Storage>, 'renderToReactEmail'> & ThisType<{
  name: string;
  options: Options;
  storage: Storage;
  editor: Editor;
  type: NodeType;
  parent: (...args: any[]) => any;
}>;
declare class EmailNode<Options = Record<string, never>, Storage = Record<string, never>> extends Node$1<Options, Storage> {
  config: EmailNodeConfig<Options, Storage>;
  constructor(config: ConfigParameter<Options, Storage>);
  /**
   * Create a new Node instance
   * @param config - Node configuration object or a function that returns a configuration object
   */
  static create<O = Record<string, never>, S = Record<string, never>>(config: ConfigParameter<O, S> | (() => ConfigParameter<O, S>)): EmailNode<O, S>;
  static from<O, S>(node: Node$1<O, S>, renderToReactEmail: NodeRendererComponent): EmailNode<O, S>;
  configure(options?: Partial<Options>): EmailNode<Options, Storage>;
  extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig extends NodeConfig<ExtendedOptions, ExtendedStorage> = EmailNodeConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: (() => Partial<ExtendedConfig>) | (Partial<ExtendedConfig> & ThisType<{
    name: string;
    options: ExtendedOptions;
    storage: ExtendedStorage;
    editor: Editor;
    type: NodeType;
  }>)): EmailNode<ExtendedOptions, ExtendedStorage>;
}
//#endregion
//#region src/core/types.d.ts
/**
 * A single placeholder item with all metadata needed for rendering.
 * Used by the event bus and placeholder plugin.
 */
interface PlaceholderItem {
  /** Full placeholder string, e.g., '{{{contact.email}}}' */
  id: string;
  /** Display text shown in the dropdown, e.g., 'contact.email' */
  displayKey: string;
  /** Base key used for updates, e.g., 'contact' or the placeholder name */
  placeholderKey: string;
  /** Fallback value for the variable */
  fallbackValue: string | null;
  /** Category ID this variable belongs to */
  category: string;
  /** Placeholder type (string, number, boolean, object, list) - needed for loop item computation */
  type?: string;
  /** Override fallback warning for this specific item */
  skipFallbackWarning?: boolean;
}
/**
 * Custom placeholder definition used in the placeholders plugin.
 */
type CustomPlaceholder = {
  id: string;
  key: string;
  type: string;
  fallback_value?: string | null;
};
declare module './event-bus' {
  interface EditorEventMap {
    'node-clicked': NodeClickedEvent;
  }
}
/**
 * Event handler function type.
 */
type EventHandler<T extends EditorEventName> = (payload: EditorEventMap[T]) => void | Promise<void>;
/**
 * Subscription handle returned when subscribing to events.
 */
interface EventSubscription {
  unsubscribe: () => void;
}
/**
 * Options for dispatching events.
 */
interface DispatchOptions {
  target?: EventTarget;
}
//#endregion
export { EditorEventName as _, PlaceholderItem as a, editorEventBus as b, NodeRendererComponent as c, MarkRendererComponent as d, SerializedMark as f, EditorEventMap as g, EditorEventHandler as h, EventSubscription as i, EmailMark as l, isDocumentVisuallyEmpty as m, DispatchOptions as n, EmailNode as o, composeReactEmail as p, EventHandler as r, EmailNodeConfig as s, CustomPlaceholder as t, EmailMarkConfig as u, EditorEventSubscription as v, useEditorEvent as x, NodeClickedEvent$1 as y };
//# sourceMappingURL=index-CHAPu71g.d.cts.map