import { g as DevToolsDockEntry, h as DevToolsDockEntriesGrouped, k as RemoteConnectionInfo, q as DevToolsMessagesClient, x as DevToolsDockUserEntry } from "./vite-augment-B0rA_vwL.js";
import { i as DevToolsCommandEntry, n as DevToolsClientCommand, o as DevToolsCommandKeybinding, t as DevToolsDocksUserSettings } from "./settings-DfhMlk_9.js";
import { WhenContext } from "devframe/utils/when";
import { SharedState } from "devframe/utils/shared-state";
import { DevToolsClientRpcHost, DevToolsRpcClient, DevToolsRpcClientOptions, DevToolsRpcContext, RpcClientEvents } from "devframe/client";
import { EventEmitter } from "devframe/types";
export * from "devframe/client";

//#region src/client/docks.d.ts
interface DockPanelStorage {
  mode: 'float' | 'edge';
  width: number;
  height: number;
  top: number;
  left: number;
  position: 'left' | 'right' | 'bottom' | 'top';
  open: boolean;
  inactiveTimeout: number;
}
type DockClientType = 'embedded' | 'standalone';
interface DocksContext extends DevToolsRpcContext {
  /**
   * Type of the client environment
   *
   * 'embedded' - running inside an embedded floating panel
   * 'standalone' - running inside a standalone window (no user app)
   */
  readonly clientType: 'embedded' | 'standalone';
  /**
   * The panel context
   */
  readonly panel: DocksPanelContext;
  /**
   * The docks entries context
   */
  readonly docks: DocksEntriesContext;
  /**
   * The commands context for command palette and shortcuts
   */
  readonly commands: CommandsContext;
  /**
   * The when-clause context for conditional visibility
   */
  readonly when: WhenClauseContext;
}
interface WhenClauseContext {
  /**
   * Get the current when-clause context snapshot.
   * Returns a reactive object with built-in variables and any custom plugin variables.
   */
  readonly context: WhenContext;
}
type DevToolsClientContext = DocksContext;
interface DocksPanelContext {
  store: DockPanelStorage;
  isDragging: boolean;
  isResizing: boolean;
  readonly isVertical: boolean;
}
interface DocksEntriesContext {
  selectedId: string | null;
  readonly selected: DevToolsDockEntry | null;
  entries: DevToolsDockEntry[];
  entryToStateMap: Map<string, DockEntryState>;
  groupedEntries: DevToolsDockEntriesGrouped;
  settings: SharedState<DevToolsDocksUserSettings>;
  /**
   * Get the state of a dock entry by its ID
   */
  getStateById: (id: string) => DockEntryState | undefined;
  /**
   * Switch to the selected dock entry, pass `null` to clear the selection
   *
   * @returns Whether the selection was changed successfully
   */
  switchEntry: (id?: string | null) => Promise<boolean>;
  /**
   * Toggle the selected dock entry
   *
   * @returns Whether the selection was changed successfully
   */
  toggleEntry: (id: string) => Promise<boolean>;
}
interface DockEntryState {
  entryMeta: DevToolsDockEntry;
  readonly isActive: boolean;
  domElements: {
    iframe?: HTMLIFrameElement | null;
    panel?: HTMLDivElement | null;
  };
  events: EventEmitter<DockEntryStateEvents>;
}
interface DockEntryStateEvents {
  'entry:activated': () => void;
  'entry:deactivated': () => void;
  'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
  'dom:panel:mounted': (panel: HTMLDivElement) => void;
  'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
}
interface CommandsContext {
  /**
   * All commands (server + client)
   */
  readonly commands: DevToolsCommandEntry[];
  /**
   * Palette-visible commands only (filtered by `showInPalette !== false`)
   */
  readonly paletteCommands: DevToolsCommandEntry[];
  /**
   * Register client-side command(s). Returns cleanup function.
   */
  register: (cmd: DevToolsClientCommand | DevToolsClientCommand[]) => () => void;
  /**
   * Execute a command by ID. Delegates to RPC for server commands.
   */
  execute: (id: string, ...args: any[]) => Promise<unknown>;
  /**
   * Get effective keybindings for a command (defaults merged with overrides)
   */
  getKeybindings: (id: string) => DevToolsCommandKeybinding[];
  /**
   * User settings store (persisted, includes command shortcuts)
   */
  settings: SharedState<DevToolsDocksUserSettings>;
  /**
   * Whether the command palette is open
   */
  paletteOpen: boolean;
}
//#endregion
//#region src/client/client-script.d.ts
/**
 * Context for client scripts running in dock entries
 */
interface DockClientScriptContext extends DocksContext {
  /**
   * The state of the current dock entry
   */
  current: DockEntryState;
  /**
   * Messages client scoped to this dock entry's source
   */
  messages: DevToolsMessagesClient;
  /**
   * @deprecated Use `messages` instead. Will be removed in a future release.
   */
  readonly logs: DevToolsMessagesClient;
}
//#endregion
//#region src/client/context.d.ts
declare const CLIENT_CONTEXT_KEY = "__VITE_DEVTOOLS_CLIENT_CONTEXT__";
/**
 * Get the global DevTools client context, or `undefined` if not yet initialized.
 */
declare function getDevToolsClientContext(): DevToolsClientContext | undefined;
//#endregion
//#region src/client/remote.d.ts
type ConnectRemoteDevToolsOptions = Omit<DevToolsRpcClientOptions, 'connectionMeta' | 'authToken'>;
/**
 * Parse a {@link RemoteConnectionInfo} descriptor from the current page's URL
 * (or a provided URL/string). Checks the URL fragment first, then the query.
 *
 * Returns `null` if no descriptor is present.
 * Throws if the descriptor is malformed or its schema version is unsupported.
 */
declare function parseRemoteConnection(input?: string): RemoteConnectionInfo | null;
/**
 * One-liner for a hosted DevTools page: reads the connection descriptor from
 * the current URL and returns a connected {@link DevToolsRpcClient}.
 *
 * Pairs with `remote: true` on a `DevToolsViewIframe` registered on the node
 * side — the core injects the descriptor into the iframe URL.
 *
 * @throws if no descriptor is present in the URL.
 */
declare function connectRemoteDevTools(options?: ConnectRemoteDevToolsOptions): Promise<DevToolsRpcClient>;
//#endregion
export { CLIENT_CONTEXT_KEY, CommandsContext, ConnectRemoteDevToolsOptions, DevToolsClientContext, type DevToolsClientRpcHost, DockClientScriptContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DocksContext, DocksEntriesContext, DocksPanelContext, type RpcClientEvents, WhenClauseContext, connectRemoteDevTools, getDevToolsClientContext, parseRemoteConnection };