import { Object3D } from "three";
import { AssetReference } from "../../engine/engine_addressables.js";
import type { ComponentInit, IGameObject } from "../../engine/engine_types.js";
import { Behaviour, Component } from "../../engine-components/Component.js";
import { EventList } from "../../engine-components/EventList.js";
declare type PlayerSyncWithAsset = PlayerSync & Required<Pick<PlayerSync, "asset">>;
/**
 * This component instantiates an asset for each player that joins a networked room. The asset will be destroyed when the player leaves the room.
 * The asset should have a PlayerState component, and can have other components like SyncedTransform, custom components, etc.
 * @category Networking
 */
export declare class PlayerSync extends Behaviour {
    /**
     * This API is experimental and may change or be removed in the future.
     * Create a PlayerSync instance at runtime from a given URL
     * @example
     * ```typescript
     * const res = await PlayerSync.setupFrom("/assets/demo.glb");
     * addComponent(res.asset?.asset, DragControls);
     * addComponent(res.asset?.asset, SyncedTransform);
     * scene.add(res.gameObject);
     * ```
     */
    static setupFrom(url: string, init?: Omit<ComponentInit<PlayerSync>, "asset">): Promise<PlayerSyncWithAsset>;
    /** when enabled PlayerSync will automatically load and instantiate the assigned asset when joining a networked room */
    autoSync: boolean;
    /** This asset will be loaded and instantiated when PlayerSync becomes active and joins a networked room */
    asset?: AssetReference;
    /** Event called when an instance is spawned */
    onPlayerSpawned?: EventList<Object3D>;
    private _localInstance?;
    awake(): void;
    onEnable(): void;
    onDisable(): void;
    private onJoinedRoom;
    getInstance(): Promise<IGameObject | null | undefined>;
    destroyInstance: () => void;
    private watchTabVisible;
}
export declare enum PlayerStateEvent {
    OwnerChanged = "ownerChanged"
}
export declare interface PlayerStateOwnerChangedArgs {
    playerState: PlayerState;
    oldValue: string;
    newValue: string;
}
export declare type PlayerStateEventCallback = (args: CustomEvent<PlayerStateOwnerChangedArgs>) => void;
export declare class PlayerState extends Behaviour {
    private static _all;
    /** all instances for all players */
    static get all(): PlayerState[];
    private static _local;
    /** all instances for the local player */
    static get local(): PlayerState[];
    static getFor(obj: Object3D | Component): PlayerState | null | undefined;
    static isLocalPlayer(obj: Object3D | Component): boolean;
    private static _callbacks;
    /**
     * Add a callback for a PlayerStateEvent
     */
    static addEventListener(event: PlayerStateEvent, cb: PlayerStateEventCallback): PlayerStateEventCallback;
    static removeEventListener(event: PlayerStateEvent, cb: PlayerStateEventCallback): void;
    private static dispatchEvent;
    onOwnerChangeEvent: EventList<any>;
    onFirstOwnerChangeEvent: EventList<any>;
    hasOwner: boolean;
    owner?: string;
    /** when enabled PlayerSync will not destroy itself when not connected anymore */
    dontDestroy: boolean;
    get isLocalPlayer(): boolean;
    private onOwnerChange;
    awake(): void;
    private onUserLeftRoom;
    start(): Promise<void>;
    /** this tells the server that this client has been destroyed and the networking message for the instantiate will be removed */
    doDestroy(): void;
    onDestroy(): void;
}
export {};
