import url from 'node:url';
import { JWProxy } from '@appium/base-driver';
import type { AppiumLogger, StringRecord } from '@appium/types';
import { NoSessionProxy } from './no-session-proxy';
import { XcodeBuild } from './xcodebuild';
import type { WebDriverAgentArgs, AppleDevice } from './types';
export declare class WebDriverAgent {
    bootstrapPath: string;
    agentPath: string;
    readonly args: WebDriverAgentArgs;
    private readonly log;
    readonly device: AppleDevice;
    readonly platformVersion?: string;
    readonly platformName?: string;
    readonly iosSdkVersion?: string;
    readonly host?: string;
    readonly isRealDevice: boolean;
    private readonly wdaBundlePath?;
    private readonly wdaLocalPort?;
    readonly wdaRemotePort: number;
    readonly wdaBaseUrl: string;
    readonly wdaBindingIP?: string;
    private readonly prebuildWDA?;
    webDriverAgentUrl?: string;
    started: boolean;
    private readonly wdaConnectionTimeout?;
    private readonly useXctestrunFile?;
    private readonly usePrebuiltWDA?;
    private readonly derivedDataPath?;
    private readonly mjpegServerPort?;
    updatedWDABundleId?: string;
    private readonly wdaLaunchTimeout;
    private readonly usePreinstalledWDA?;
    private xctestApiClient?;
    private readonly updatedWDABundleIdSuffix;
    private _xcodebuild?;
    noSessionProxy?: NoSessionProxy;
    jwproxy?: JWProxy;
    proxyReqRes?: any;
    private _url?;
    /**
     * Creates a new WebDriverAgent instance.
     * @param args - Configuration arguments for WebDriverAgent
     * @param log - Optional logger instance
     */
    constructor(args: WebDriverAgentArgs, log?: AppiumLogger | null);
    /**
     * Return true if the session does not need xcodebuild.
     * @returns Whether the session needs/has xcodebuild.
     */
    get canSkipXcodebuild(): boolean;
    /**
     * Get the xcodebuild instance. Throws if not initialized.
     * @returns The XcodeBuild instance
     * @throws Error if xcodebuild is not available
     */
    get xcodebuild(): XcodeBuild;
    /**
     * Return bundle id for WebDriverAgent to launch the WDA.
     * The primary usage is with 'this.usePreinstalledWDA'.
     * It adds `.xctrunner` as suffix by default but 'this.updatedWDABundleIdSuffix'
     * lets skip it.
     *
     * @returns Bundle ID for Xctest.
     */
    get bundleIdForXctest(): string;
    /**
     * Cleans up obsolete cached processes from previous WDA sessions
     * that are listening on the same port but belong to different devices.
     */
    cleanupObsoleteProcesses(): Promise<void>;
    /**
     * Gets the base path for the WebDriverAgent URL.
     * @returns The base path (empty string if root path)
     */
    get basePath(): string;
    /**
     * Return current running WDA's status like below after launching WDA
     * {
     *   "state": "success",
     *   "os": {
     *     "name": "iOS",
     *     "version": "11.4",
     *     "sdkVersion": "11.3"
     *   },
     *   "ios": {
     *     "simulatorVersion": "11.4",
     *     "ip": "172.254.99.34"
     *   },
     *   "build": {
     *     "time": "Jun 24 2018 17:08:21",
     *     "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
     *   }
     * }
     *
     * @param sessionId Launch WDA and establish the session with this sessionId
     */
    launch(sessionId: string): Promise<StringRecord | null>;
    /**
     * Checks if the WebDriverAgent source is fresh by verifying
     * that required resource files exist.
     * @returns `true` if source is fresh (all required files exist), `false` otherwise
     */
    isSourceFresh(): Promise<boolean>;
    private parseBundleId;
    private fetchWDABundle;
    private setupProxies;
    /**
     * Stops the WebDriverAgent session and cleans up resources.
     * Handles both preinstalled WDA and xcodebuild-based sessions.
     */
    quit(): Promise<void>;
    /**
     * Gets the WebDriverAgent URL.
     * Constructs the URL from webDriverAgentUrl if provided, otherwise
     * builds it from wdaBaseUrl, wdaBindingIP, and wdaLocalPort.
     * @returns The parsed URL object
     */
    get url(): url.UrlWithStringQuery;
    /**
     * Sets the WebDriverAgent URL.
     * @param _url - The URL string to parse and set
     */
    set url(_url: string);
    /**
     * Gets whether WebDriverAgent has fully started.
     * @returns `true` if WDA has started, `false` otherwise
     */
    get fullyStarted(): boolean;
    /**
     * Sets whether WebDriverAgent has fully started.
     * @param started - `true` if WDA has started, `false` otherwise
     */
    set fullyStarted(started: boolean);
    /**
     * Retrieves the Xcode derived data path for WebDriverAgent.
     * @returns The derived data path, or `undefined` if xcodebuild is skipped
     */
    retrieveDerivedDataPath(): Promise<string | undefined>;
    /**
     * Reuse running WDA if it has the same bundle id with updatedWDABundleId.
     * Or reuse it if it has the default id without updatedWDABundleId.
     * Uninstall it if the method faces an exception for the above situation.
     */
    setupCaching(): Promise<void>;
    /**
     * Quit and uninstall running WDA.
     */
    quitAndUninstall(): Promise<void>;
    private setWDAPaths;
    private isRunning;
    /**
     * Return current running WDA's status like below
     * {
     *   "state": "success",
     *   "os": {
     *     "name": "iOS",
     *     "version": "11.4",
     *     "sdkVersion": "11.3"
     *   },
     *   "ios": {
     *     "simulatorVersion": "11.4",
     *     "ip": "172.254.99.34"
     *   },
     *   "build": {
     *     "time": "Jun 24 2018 17:08:21",
     *     "productBundleIdentifier": "com.facebook.WebDriverAgentRunner"
     *   }
     * }
     *
     * @param timeoutMs If zero or negative, returns immediately. Otherwise, waits up to timeoutMs.
     */
    private getStatus;
    /**
     * Uninstall WDAs from the test device.
     * Over Xcode 11, multiple WDA can be in the device since Xcode 11 generates different WDA.
     * Appium does not expect multiple WDAs are running on a device.
     */
    private uninstall;
    private _cleanupProjectIfFresh;
    /**
     * Launch WDA with preinstalled package with 'xcrun devicectl device process launch'.
     * The WDA package must be prepared properly like published via
     * https://github.com/appium/WebDriverAgent/releases
     * with proper sign for this case.
     *
     * When we implement launching XCTest service via appium-ios-device,
     * this implementation can be replaced with it.
     *
     * @param opts launching WDA with devicectl command options.
     */
    private _launchViaDevicectl;
    /**
     * Launch WDA with preinstalled package without xcodebuild.
     * @param sessionId Launch WDA and establish the session with this sessionId
     */
    private launchWithPreinstalledWDA;
}
//# sourceMappingURL=webdriveragent.d.ts.map