import { PartySocket } from "partysocket";

//#region src/index.d.ts
declare const generateId: () => string;
type GameState = Record<string, any> & {
  _players?: Record<string, {
    id: string;
    [key: string]: any;
  }>;
};
type PartialDeep<T> = { [P in keyof T]?: T[P] extends object ? PartialDeep<T[P]> : T[P] };
type Lab13ClientApi = ReturnType<typeof Lab13Client>;
type Lab13ClientEventMap = {
  'player-id-updated': CustomEvent<string>;
  'client-connected': CustomEvent<string>;
  'client-disconnected': CustomEvent<string>;
  'client-ids-updated': CustomEvent<string[]>;
  'player-ids-updated': CustomEvent<string[]>;
  'bot-ids-updated': CustomEvent<string[]>;
  'state-updated': CustomEvent<{
    state: Record<string, any>;
    delta: Record<string, any>;
  }>;
} & WebSocketEventMap;
type Lab13ClientOptions = {
  bot: boolean;
};
type ClientType = 'player' | 'bot';
declare const Lab13Client: <T extends GameState>(socket: PartySocket, options?: Partial<Lab13ClientOptions>) => {
  queryPlayerIds: () => void;
  on<K extends keyof Lab13ClientEventMap>(event: K, callback: (event: Lab13ClientEventMap[K] extends Event ? Lab13ClientEventMap[K] : never) => Lab13ClientEventMap[K] extends Event ? void : never): void;
  off<K extends keyof Lab13ClientEventMap>(event: K, callback: (event: Lab13ClientEventMap[K] extends Event ? Lab13ClientEventMap[K] : never) => Lab13ClientEventMap[K] extends Event ? void : never): void;
  playerId: () => string | null;
  clientIds: () => string[];
  playerIds: () => string[];
  botIds: () => string[];
  clientType: () => ClientType;
  sendToPlayer: (playerId: string, message: string) => void;
  sendToAll: (message: string) => void;
  state: () => T;
  mutateState: (delta: PartialDeep<T>) => void;
  generateId: () => string;
};
declare global {
  interface Window {
    Lab13Client: typeof Lab13Client;
  }
}
//#endregion
export { ClientType, GameState, Lab13Client, Lab13ClientApi, Lab13ClientEventMap, Lab13ClientOptions, PartialDeep, generateId };
//# sourceMappingURL=index.d.ts.map