
import { i as RecceInstanceInfo } from "./flag-CiR2E5oz.js";
import * as _tanstack_react_query6 from "@tanstack/react-query";
import { Dispatch, ReactNode, SetStateAction } from "react";
import * as react_jsx_runtime131 from "react/jsx-runtime";

//#region src/contexts/action/types.d.ts
/**
 * Query parameters for API requests
 */
type AxiosQueryParams = Record<string, string | string[] | number | number[] | undefined>;
/**
 * Explore action sources - matches EXPLORE_SOURCE in track.ts
 */
type ExploreSource = "lineage_view_top_bar" | "lineage_view_context_menu" | "node_kebab_menu" | "node_sidebar_single_env" | "node_sidebar_multi_env" | "schema_row_count_button" | "schema_column_menu" | "lineage_model_node" | "lineage_column_node";
/**
 * Explore action types - matches EXPLORE_ACTION in track.ts
 */
type ExploreAction = "row_count" | "row_count_diff" | "profile" | "profile_diff" | "value_diff" | "schema_diff" | "lineage_diff" | "query" | "histogram_diff" | "top_k_diff";
/**
 * Tracking properties for run submissions
 */
interface SubmitRunTrackProps {
  /** The explore action type being performed */
  action?: ExploreAction;
  /** The source UI element triggering the action */
  source?: ExploreSource;
  /** Number of nodes involved in the action */
  node_count?: number;
  /** Whether breaking change analysis is enabled */
  breaking_change_analysis?: boolean;
  /** Additional tracking properties */
  [key: string]: unknown;
}
/**
 * Options for running an action
 */
interface RecceActionOptions {
  /** Whether to show a form before executing */
  showForm: boolean;
  /** Whether to show the last run with matching params */
  showLast?: boolean;
  /** Tracking properties for analytics */
  trackProps?: SubmitRunTrackProps;
}
/**
 * Context type for run actions.
 *
 * This context manages run execution, run result display,
 * and history panel state.
 */
interface RecceActionContextType {
  /**
   * Execute a run action.
   * @param type - The run type (e.g., "row_count_diff", "value_diff")
   * @param params - Query parameters for the run
   * @param actionOptions - Action options (showForm, trackProps)
   */
  runAction: (type: string, params?: AxiosQueryParams, actionOptions?: RecceActionOptions) => void;
  /** Currently displayed run ID */
  runId?: string;
  /**
   * Show a specific run result.
   * @param runId - The run ID to display
   * @param refreshHistory - Whether to refresh the history list
   */
  showRunId: (runId: string, refreshHistory?: boolean) => void;
  /** Whether the run result pane is open */
  isRunResultOpen: boolean;
  /** Close the run result pane */
  closeRunResult: () => void;
  /** Whether the history panel is open */
  isHistoryOpen: boolean;
  /** Close the history panel */
  closeHistory: () => void;
  /** Open the history panel */
  showHistory: () => void;
  /** Set the history panel open state */
  setHistoryOpen: Dispatch<SetStateAction<boolean>>;
  /** Clear the current run result and close the pane */
  clearRunResult: () => void;
}
//#endregion
//#region src/contexts/action/RecceActionContext.d.ts
/**
 * Props for RecceActionProvider
 *
 * This is a props-driven provider - pass your own run execution handler.
 * The provider manages UI state (result pane, history panel) internally.
 */
interface RecceActionProviderProps {
  children: ReactNode;
  /**
   * Handler called when a run action is requested.
   * Implement this to submit runs to your backend.
   *
   * @param type - The run type (e.g., "row_count_diff", "value_diff")
   * @param params - Query parameters for the run
   * @param options - Action options (showForm, trackProps)
   * @returns Promise that resolves to the run ID, or void if handled differently
   */
  onRunAction?: (type: string, params?: AxiosQueryParams, options?: RecceActionOptions) => Promise<string | undefined> | string | undefined;
  /**
   * Handler called when a run result should be shown.
   * Called by showRunId when displaying a specific run.
   *
   * @param runId - The run ID to display
   * @param refreshHistory - Whether to refresh the history list
   */
  onShowRunId?: (runId: string, refreshHistory?: boolean) => void;
  /** Initial run ID to display (optional) */
  initialRunId?: string;
  /** Initial state for history panel (default: false) */
  initialHistoryOpen?: boolean;
}
/**
 * Provider for run action context.
 *
 * This is a props-driven provider designed for library consumers.
 * Pass your own `onRunAction` handler to execute runs.
 *
 * @example
 * ```tsx
 * const handleRunAction = async (type, params, options) => {
 *   const response = await api.submitRun(type, params);
 *   return response.run_id;
 * };
 *
 * <RecceActionProvider onRunAction={handleRunAction}>
 *   <LineageView />
 * </RecceActionProvider>
 * ```
 */
declare function RecceActionProvider({
  children,
  onRunAction,
  onShowRunId,
  initialRunId,
  initialHistoryOpen
}: RecceActionProviderProps): react_jsx_runtime131.JSX.Element;
/**
 * Hook to access the RecceAction context.
 *
 * @returns RecceActionContextType with run action methods and state
 */
declare function useRecceActionContext(): RecceActionContextType;
//#endregion
//#region src/contexts/idle/types.d.ts
/**
 * Context for sharing idle timeout state across components
 *
 * IMPORTANT: The countdown is based on the last SUCCESSFUL keep-alive API call,
 * NOT on user activity. This ensures the countdown accurately reflects the
 * server's idle timeout state.
 */
interface IdleTimeoutContextType {
  /** Remaining seconds until timeout (null if idle timeout not enabled) */
  remainingSeconds: number | null;
  /** Idle timeout value from server in seconds (null if not configured) */
  idleTimeout: number | null;
  /** Whether idle timeout is enabled */
  isEnabled: boolean;
  /** Mark as disconnected - stops countdown and keep-alive */
  setDisconnected: () => void;
  /** Reset connection state - restarts countdown and keep-alive after successful reconnect */
  resetConnection: () => void;
  /** Whether the connection is disconnected */
  isDisconnected: boolean;
}
/**
 * Hook to access idle timeout context, returns null if outside provider
 * Used internally by useIdleDetection to avoid circular dependency
 */
declare function useIdleTimeoutSafe(): IdleTimeoutContextType | null;
//#endregion
//#region src/contexts/idle/IdleTimeoutContext.d.ts
/**
 * Provider for idle timeout state
 *
 * The countdown is based on lastServerSyncTime (when keep-alive API was last
 * successfully sent), not on user activity. This provides accurate server state.
 */
declare function IdleTimeoutProvider({
  children
}: {
  children: ReactNode;
}): react_jsx_runtime131.JSX.Element;
/**
 * Hook to access idle timeout context
 * @throws Error if used outside IdleTimeoutProvider
 */
declare function useIdleTimeout(): IdleTimeoutContextType;
//#endregion
//#region src/contexts/idle/useIdleDetection.d.ts
/**
 * Hook to detect user activity and send keep-alive signals to prevent server idle timeout.
 *
 * This hook:
 * - Listens for user activities (focus, mouse, keyboard, scroll)
 * - Sends keep-alive requests (throttled at axios layer to minimum 3 seconds)
 * - Pauses when the tab is inactive (using Page Visibility API)
 * - Immediately sends a keep-alive when tab becomes active
 * - Only activates when idle_timeout is configured on the server
 *
 * Note: The countdown in IdleTimeoutContext is based on successful keep-alive
 * API calls, not on user activity. This ensures accurate server state tracking.
 */
declare function useIdleDetection(): void;
//#endregion
//#region src/contexts/instance/types.d.ts
/**
 * Feature mode for the Recce instance.
 * - "read only": No modifications allowed
 * - "metadata only": Database queries disabled
 * - null: Full functionality enabled
 */
type RecceFeatureMode = "read only" | "metadata only" | null;
/**
 * Feature toggles that control what actions are available in the UI.
 * These are derived from the server's instance info based on server mode.
 */
interface RecceFeatureToggles {
  /** Current feature mode based on server_mode */
  mode: RecceFeatureMode;
  /** Disable saving state to file */
  disableSaveToFile: boolean;
  /** Disable exporting state file */
  disableExportStateFile: boolean;
  /** Disable importing state file */
  disableImportStateFile: boolean;
  /** Disable updating checklist */
  disableUpdateChecklist: boolean;
  /** Disable database query execution */
  disableDatabaseQuery: boolean;
  /** Disable view action dropdown menu */
  disableViewActionDropdown: boolean;
  /** Disable node action dropdown menu */
  disableNodeActionDropdown: boolean;
  /** Disable share functionality */
  disableShare: boolean;
}
/**
 * Instance information exposed through the RecceInstanceContext.
 * Contains feature toggles and session information.
 */
interface InstanceInfoType {
  /** Whether running in single environment mode */
  singleEnv: boolean;
  /** Whether user is authenticated */
  authed: boolean;
  /** Feature toggles based on server mode */
  featureToggles: RecceFeatureToggles;
  /** When the instance lifetime expires */
  lifetimeExpiredAt?: Date;
  /** URL for sharing the instance */
  shareUrl?: string;
  /** Current session ID */
  sessionId?: string;
}
/**
 * Default feature toggles with all features enabled.
 */
declare const defaultFeatureToggles: RecceFeatureToggles;
/**
 * Default instance info values.
 */
declare const defaultInstanceInfo: InstanceInfoType;
//#endregion
//#region src/contexts/instance/RecceInstanceContext.d.ts
/**
 * Provider that fetches and processes Recce instance information.
 *
 * This provider:
 * 1. Fetches instance info from the server using useRecceInstanceInfo
 * 2. Computes feature toggles based on server_mode
 * 3. Provides the processed data through context
 *
 * Feature toggles are computed based on:
 * - server_mode: "read-only" disables all modifications
 * - server_mode: "preview" disables database queries but allows metadata operations
 * - single_env: disables checklist updates and sharing
 * - cloud_instance: disables sharing
 *
 * @example
 * ```tsx
 * function App() {
 *   return (
 *     <RecceProvider api={{ baseUrl: "/api" }}>
 *       <RecceInstanceInfoProvider>
 *         <MyComponent />
 *       </RecceInstanceInfoProvider>
 *     </RecceProvider>
 *   );
 * }
 * ```
 */
declare function RecceInstanceInfoProvider({
  children
}: {
  children: ReactNode;
}): react_jsx_runtime131.JSX.Element;
/**
 * Hook to access the Recce instance context.
 *
 * Returns the current instance information including feature toggles,
 * authentication status, and session information.
 *
 * @returns InstanceInfoType with feature toggles and session info
 *
 * @example
 * ```tsx
 * function FeatureGate() {
 *   const { featureToggles } = useRecceInstanceContext();
 *
 *   if (featureToggles.disableDatabaseQuery) {
 *     return <div>Database queries are disabled</div>;
 *   }
 *
 *   return <QueryEditor />;
 * }
 * ```
 */
declare function useRecceInstanceContext(): InstanceInfoType;
//#endregion
//#region src/contexts/instance/useRecceInstanceInfo.d.ts
/**
 * Hook to fetch Recce instance information from the server.
 *
 * Uses TanStack Query to cache the response and the configured API client.
 * Works both inside RecceProvider (uses configured client) and outside (uses default axios).
 *
 * @returns Query result with RecceInstanceInfo data
 *
 * @example
 * ```tsx
 * function InstanceStatus() {
 *   const { data, isLoading, error } = useRecceInstanceInfo();
 *
 *   if (isLoading) return <div>Loading...</div>;
 *   if (error) return <div>Error loading instance info</div>;
 *
 *   return <div>Server mode: {data?.server_mode}</div>;
 * }
 * ```
 */
declare function useRecceInstanceInfo(): _tanstack_react_query6.UseQueryResult<RecceInstanceInfo, Error>;
//#endregion
export { AxiosQueryParams as _, RecceFeatureMode as a, SubmitRunTrackProps as b, defaultInstanceInfo as c, useIdleTimeout as d, IdleTimeoutContextType as f, useRecceActionContext as g, RecceActionProviderProps as h, InstanceInfoType as i, useIdleDetection as l, RecceActionProvider as m, RecceInstanceInfoProvider as n, RecceFeatureToggles as o, useIdleTimeoutSafe as p, useRecceInstanceContext as r, defaultFeatureToggles as s, useRecceInstanceInfo as t, IdleTimeoutProvider as u, RecceActionContextType as v, RecceActionOptions as y };
//# sourceMappingURL=index-C-GvORS_.d.ts.map