import { Chess, Square as Square$1, PieceSymbol, Move } from 'chess.js'; import React$1 from 'react'; import { ClassValue } from 'clsx'; type Orientation = "white" | "black"; interface MoveResult { success: boolean; move?: Move; isCapture?: boolean; isCheck?: boolean; isCheckmate?: boolean; isGameOver?: boolean; } interface HighlightSquares { selected?: Square$1; validMoves: Square$1[]; lastMove: Square$1[]; check?: Square$1; } interface UseChessGameOptions { initialFen?: string; orientation?: Orientation; onMove?: (move: Move) => void; onGameOver?: (result: string) => void; } interface UseChessGameReturn { chess: Chess; fen: string; turn: "w" | "b"; gameOver: boolean; winner: "white" | "black" | "draw" | null; status: string; moveHistory: string[]; currentMoveNumber: number; orientation: Orientation; highlights: HighlightSquares; inCheck: boolean; makeMove: (from: Square$1, to: Square$1, promotion?: PieceSymbol) => MoveResult; selectSquare: (square: Square$1) => void; clearSelection: () => void; undoMove: () => boolean; resetGame: () => void; flipBoard: () => void; loadFEN: (fen: string) => boolean; loadPGN: (pgn: string) => boolean; exportPGN: (metadata?: Record) => string; exportFEN: () => string; isValidMove: (from: Square$1, to: Square$1) => boolean; getValidMovesForSquare: (square: Square$1) => Square$1[]; getPieceAt: (square: Square$1) => { type: PieceSymbol; color: "w" | "b"; } | null; } /** * Main chess game hook - encapsulates all game logic */ declare function useChessGame(options?: UseChessGameOptions): UseChessGameReturn; /** * Theme utilities for chess board styling */ type BoardTheme = "default" | "wood" | "marble" | "neon"; interface BoardColors { light: string; dark: string; highlight: string; selected: string; lastMove: string; check: string; validMove: string; validMoveCapture: string; } /** * Board theme definitions */ declare const BOARD_THEMES: Record; /** * Get theme colors */ declare function getThemeColors(theme: BoardTheme): BoardColors; /** * Get square color classes based on square position and theme */ declare function getSquareColorClasses(isLight: boolean, theme: BoardTheme): string; /** * Get highlight color class */ declare function getHighlightClass(type: "selected" | "valid" | "lastMove" | "check" | "validCapture", theme: BoardTheme): string; /** * Get all available themes */ declare function getAllThemes(): BoardTheme[]; /** * Get theme display name */ declare function getThemeDisplayName(theme: BoardTheme): string; /** * Coordinate label styling */ declare function getCoordinateLabelClasses(theme: BoardTheme): string; /** * Get board border classes */ declare function getBoardBorderClasses(theme: BoardTheme): string; interface BoardProps { game: UseChessGameReturn; theme?: BoardTheme; showCoordinates?: boolean; interactive?: boolean; size?: "sm" | "md" | "lg" | "xl"; onMove?: (from: Square$1, to: Square$1) => void; } /** * Main chess board component */ declare const Board: React$1.FC; /** * Chess helper utilities for board state management and move processing */ type ChessColor = "w" | "b"; type ChessPiece = { type: PieceSymbol; color: ChessColor; }; interface BoardPosition { square: Square$1; piece: ChessPiece | null; } interface MoveHighlight { square: Square$1; type: "selected" | "valid" | "lastMove" | "check"; } /** * Convert chess.js board state to a flat array of positions */ declare function getBoardPositions(chess: Chess): BoardPosition[]; /** * Get valid moves for a piece at a given square */ declare function getValidMoves(chess: Chess, square: Square$1): Square$1[]; /** * Check if a square is light or dark */ declare function isLightSquare(square: Square$1): boolean; /** * Get square notation from coordinates */ declare function getSquareFromCoords(row: number, col: number, orientation?: "white" | "black"): Square$1; /** * Get coordinates from square notation */ declare function getCoordsFromSquare(square: Square$1, orientation?: "white" | "black"): { row: number; col: number; }; /** * Get piece image path */ declare function getPieceImagePath(piece: ChessPiece): string; /** * Check if a move is a capture */ declare function isCapture(chess: Chess, move: Move): boolean; /** * Check if a move is castling */ declare function isCastling(move: Move): boolean; /** * Check if a move is en passant */ declare function isEnPassant(move: Move): boolean; /** * Check if a move is promotion */ declare function isPromotion(move: Move): boolean; /** * Get game status message */ declare function getGameStatus(chess: Chess): string; /** * Format move for display (e.g., "e2-e4", "Nf3", etc.) */ declare function formatMoveNotation(move: Move): string; /** * Get opposite color */ declare function getOppositeColor(color: ChessColor): ChessColor; /** * Parse move string and attempt to make move */ declare function tryMakeMove(chess: Chess, from: Square$1, to: Square$1, promotion?: PieceSymbol): Move | null; interface SquareProps { square: Square$1; piece: ChessPiece | null; theme: BoardTheme; selected?: boolean; validMove?: boolean; lastMove?: boolean; check?: boolean; showCoordinates?: boolean; isFileEdge?: boolean; isRankEdge?: boolean; orientation?: "white" | "black"; onClick?: () => void; onDragStart?: (square: Square$1) => void; onDragOver?: (e: React$1.DragEvent) => void; onDrop?: (square: Square$1) => void; } /** * Individual chess board square with piece rendering */ declare const Square: React$1.FC; interface PieceProps { piece: ChessPiece; dragging?: boolean; animate?: boolean; size?: number; } /** * Chess piece component with animation support */ declare const Piece: React.FC; interface ControlsProps { game: UseChessGameReturn; soundEnabled: boolean; onToggleSound: () => void; theme: BoardTheme; onThemeChange: (theme: BoardTheme) => void; className?: string; } /** * Game controls component (reset, undo, flip, settings) */ declare const Controls: React$1.FC; interface MoveHistoryProps { moves: string[]; currentMoveNumber: number; className?: string; } /** * Move history display component */ declare const MoveHistory: React$1.FC; interface TimersProps { whiteTime: number; blackTime: number; currentTurn: "w" | "b"; running: boolean; onTimeUpdate: (color: "w" | "b", time: number) => void; onTimeExpired: (color: "w" | "b") => void; onTogglePause: () => void; className?: string; } /** * Chess clock component with countdown timers */ declare const Timers: React.FC; interface EngineControlsProps { enabled: boolean; thinking: boolean; evaluation?: number; depth?: number; bestMove?: string; onToggle: () => void; onRequestMove: () => void; onDepthChange?: (depth: number) => void; className?: string; } /** * Stockfish engine controls (placeholder for future integration) */ declare const EngineControls: React$1.FC; interface GameEndModalProps { open: boolean; winner: "white" | "black" | "draw" | null; reason?: string; whitePlayer?: string; blackPlayer?: string; onRematch: () => void; onClose: () => void; } /** * Game end modal with animations */ declare const GameEndModal: React$1.FC; /** * Sound types for chess events */ type ChessSoundType = "move" | "capture" | "notify" | "gameEnd"; interface UseSoundOptions { enabled?: boolean; volume?: number; /** * Custom sound file paths or URLs to override default sounds. * You can provide paths for any or all sound types. * @example { gameEnd: "/custom/game-end.mp3" } * @example { move: "https://example.com/move.mp3", capture: "/custom/capture.mp3" } */ sounds?: Partial>; } interface UseSoundReturn { play: (sound: ChessSoundType) => void; enabled: boolean; setEnabled: (enabled: boolean) => void; volume: number; setVolume: (volume: number) => void; } /** * Hook for playing chess sound effects */ declare function useSound(options?: UseSoundOptions): UseSoundReturn; /** * Socket message types for chess multiplayer */ type SocketMessageType = "move" | "chat" | "join" | "leave" | "gameState" | "playerReady" | "rematch" | "draw" | "resign"; interface SocketMessage { type: SocketMessageType; payload: T; timestamp: number; playerId?: string; } interface MovePayload { from: string; to: string; promotion?: string; fen?: string; } interface GameStatePayload { fen: string; pgn?: string; turn: "w" | "b"; isGameOver: boolean; result?: string; } interface UseSocketOptions { url?: string; roomId?: string; playerId?: string; autoConnect?: boolean; reconnectAttempts?: number; reconnectDelay?: number; } interface UseSocketReturn { connected: boolean; send: (type: SocketMessageType, payload: T) => void; subscribe: (type: SocketMessageType, handler: (payload: T) => void) => () => void; connect: () => void; disconnect: () => void; error: string | null; } /** * Hook for WebSocket communication in multiplayer chess * Note: This is a client-side implementation ready for WebSocket integration */ declare function useSocket(options?: UseSocketOptions): UseSocketReturn; /** * FEN (Forsyth-Edwards Notation) utilities for board state serialization */ declare const STARTING_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; declare const EMPTY_BOARD_FEN = "8/8/8/8/8/8/8/8 w - - 0 1"; /** * Common chess positions for testing and examples */ declare const FAMOUS_POSITIONS: { readonly starting: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; readonly empty: "8/8/8/8/8/8/8/8 w - - 0 1"; readonly sicilian: "rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2"; readonly scholarsMate: "r1bqkb1r/pppp1ppp/2n2n2/4p2Q/2B1P3/8/PPPP1PPP/RNB1K1NR w KQkq - 4 4"; readonly kingPawnEndgame: "8/8/8/4k3/4P3/4K3/8/8 w - - 0 1"; readonly backRankMate: "6k1/5ppp/8/8/8/8/5PPP/R5K1 w - - 0 1"; readonly lucena: "1K1k4/1P6/8/8/8/8/r7/2R5 w - - 0 1"; readonly philidor: "3k4/R7/8/8/8/8/r2KP3/8 b - - 0 1"; }; /** * Validate a FEN string */ declare function isValidFEN(fen: string): boolean; /** * Parse FEN and return board details */ declare function parseFEN(fen: string): { valid: boolean; turn: "w" | "b"; castling: string; enPassant: string; halfmove: number; fullmove: number; }; /** * Get simplified board representation from FEN */ declare function getFENPiecePlacement(fen: string): string; /** * Create FEN from parts */ declare function createFEN(piecePlacement: string, turn?: "w" | "b", castling?: string, enPassant?: string, halfmove?: number, fullmove?: number): string; /** * Load FEN into a chess instance safely */ declare function loadFEN(chess: Chess, fen: string): boolean; /** * Get FEN from chess instance */ declare function getFEN(chess: Chess): string; /** * Compare two FEN strings (position only, ignoring move counters) */ declare function compareFENPositions(fen1: string, fen2: string): boolean; /** * Get position key for threefold repetition checking */ declare function getPositionKey(fen: string): string; /** * Reset board to starting position */ declare function resetToStartingPosition(chess: Chess): void; /** * Clear board completely */ declare function clearBoard(chess: Chess): void; /** * PGN (Portable Game Notation) utilities for game import/export */ interface PGNMetadata { Event?: string; Site?: string; Date?: string; Round?: string; White?: string; Black?: string; Result?: string; WhiteElo?: string; BlackElo?: string; TimeControl?: string; ECO?: string; Opening?: string; Annotator?: string; } interface ParsedPGN { metadata: PGNMetadata; moves: string[]; result: string; pgn: string; } /** * Export game to PGN format */ declare function exportPGN(chess: Chess, metadata?: Partial): string; /** * Import PGN and load into chess instance */ declare function importPGN(chess: Chess, pgn: string): boolean; /** * Parse PGN string into metadata and moves */ declare function parsePGN(pgn: string): ParsedPGN | null; /** * Get game result string */ declare function getGameResult(chess: Chess): string; /** * Format move history as numbered list */ declare function formatMoveHistory(moves: string[], startMoveNumber?: number): string; /** * Export game to PGN with move list */ declare function exportPGNWithMoves(moves: string[], metadata?: Partial): string; /** * Validate PGN string */ declare function isValidPGN(pgn: string): boolean; /** * Extract moves from PGN */ declare function extractMovesFromPGN(pgn: string): string[]; /** * Get current position as PGN comment */ declare function addPositionComment(pgn: string, comment: string): string | null; /** * Download PGN as file */ declare function downloadPGN(pgn: string, filename?: string): void; /** * Create shareable game link with PGN data */ declare function createShareableLink(pgn: string, baseUrl: string): string; /** * Load PGN from URL parameter */ declare function loadPGNFromURL(): string | null; declare function cn(...inputs: ClassValue[]): string; export { BOARD_THEMES, Board, type BoardColors, type BoardPosition, type BoardProps, type BoardTheme, type ChessColor, type ChessPiece, type ChessSoundType, Controls, EMPTY_BOARD_FEN, EngineControls, FAMOUS_POSITIONS, GameEndModal, type GameStatePayload, type HighlightSquares, type MoveHighlight, MoveHistory, type MovePayload, type MoveResult, type Orientation, type PGNMetadata, type ParsedPGN, Piece, STARTING_FEN, type SocketMessage, type SocketMessageType, Square, Timers, type UseChessGameReturn, addPositionComment, clearBoard, cn, compareFENPositions, createFEN, createShareableLink, downloadPGN, exportPGN, exportPGNWithMoves, extractMovesFromPGN, formatMoveHistory, formatMoveNotation, getAllThemes, getBoardBorderClasses, getBoardPositions, getCoordinateLabelClasses, getCoordsFromSquare, getFEN, getFENPiecePlacement, getGameResult, getGameStatus, getHighlightClass, getOppositeColor, getPieceImagePath, getPositionKey, getSquareColorClasses, getSquareFromCoords, getThemeColors, getThemeDisplayName, getValidMoves, importPGN, isCapture, isCastling, isEnPassant, isLightSquare, isPromotion, isValidFEN, isValidPGN, loadFEN, loadPGNFromURL, parseFEN, parsePGN, resetToStartingPosition, tryMakeMove, useChessGame, useSocket, useSound };