/// <reference path="../../src/types/global.d.ts" />
/// <reference types="webxr" />
import { Component, Emitter } from '@wonderlandengine/api';
import { mat4 } from 'gl-matrix';
import { ARProvider, ARSession, ITrackingMode, ImageScanningEvent, TrackingType } from '@wonderlandengine/ar-tracking';
import { loadZappar } from './zappar-module.js';
import type { FaceMesh, FaceTracker, ImageTracker, Pipeline } from '@zappar/zappar';
type ZapparImageTargetType = 'flat' | 'cylindrical' | 'conical';
export interface ZapparImageTargetOptions {
    name: string;
    type?: ZapparImageTargetType;
    physicalWidthInMeters?: number;
    metadata?: unknown;
}
interface ZapparImageTargetDescriptor {
    name: string;
    type: ZapparImageTargetType;
    geometry: ImageScanningEvent['imageTargets'][0]['geometry'];
    properties: ImageScanningEvent['imageTargets'][0]['properties'];
    metadata: unknown;
}
/**
 * ARProvider implementation backed by the Zappar Universal AR JavaScript SDK.
 */
export declare class ZapparProvider extends ARProvider {
    private static _cvWorkerConfigured;
    private static _cvWorker;
    /** Mirror Zappar THREE.js `CameraPoseMode` for SLAM pose output. */
    slamPoseMode: 'default' | 'attitude' | 'anchor-origin';
    private _xrSession;
    private _gl;
    private _zappar;
    private pipeline;
    private cameraSource;
    private instantTracker;
    private _faceTracker;
    private _faceMesh;
    private _faceResourcesPromise;
    private _imageTracker;
    private _preferredCameraUserFacing;
    private _cameraSourceUserFacing;
    private _imageTargetDescriptors;
    private readonly _imageTargetsChanged;
    private cameraStarted;
    private hasInitializedAnchor;
    private _anchorWarmupFramesRemaining;
    private preRenderRegistered;
    private _slamStateValid;
    private readonly _slamProjectionMatrix;
    private readonly _slamAnchorMatrix;
    private _slamFrameNumber;
    private _videoTextureUnit;
    private _videoTextureProgram;
    private _videoTextureUniform;
    private _videoTextureTransformUniform;
    private _videoTextureBindErrorLogged;
    private _missingCameraTextureFrames;
    private _missingCameraTextureWarningLogged;
    private readonly _slamCameraMatrix;
    private readonly _slamCameraPosition;
    private readonly _slamCameraRotation;
    private readonly _debugCameraPosition;
    private readonly _debugAnchorPosition;
    private readonly _debugCameraPositionDelta;
    private readonly _debugAnchorPositionDelta;
    private _debugLastSampleFrameNumber;
    private readonly _debugLastSampleCameraPosition;
    private readonly _debugLastSampleAnchorPosition;
    private _zapparDebugLogIntervalId;
    private _preRenderErrorLogged;
    private get isVerboseDebugLoggingEnabled();
    static Name: string;
    get name(): string;
    get supportsInstantTracking(): boolean;
    get onImageTargetsChanged(): Emitter<void[]>;
    get xrSession(): XRSession | null;
    /**
     * Hint camera facing preference for the next/active session.
     * - `true`: user/front camera
     * - `false`: rear/back camera
     * - `null`: Zappar default
     */
    setPreferredCameraUserFacing(userFacing: boolean | null): void;
    static registerTrackingProviderWithARSession(arSession: ARSession): ZapparProvider;
    private constructor();
    startSession(): Promise<void>;
    private ensurePreRenderRegistered;
    private startZapparDebugLogging;
    private stopZapparDebugLogging;
    private ensureZapparLoaded;
    /** Used by tracking modes that need the Zappar namespace. */
    ensureZapparNamespace(): Promise<Awaited<ReturnType<typeof loadZappar>>>;
    private configureCvWorkerIfNeeded;
    private ensurePipeline;
    private ensureCameraSourcePreference;
    getPipeline(): Pipeline;
    ensureFaceResources(): Promise<void>;
    getFaceTracker(): FaceTracker;
    getFaceMesh(): FaceMesh;
    ensureImageTracker(): ImageTracker;
    registerImageTarget(source: string | ArrayBuffer, options: ZapparImageTargetOptions): Promise<void>;
    private _inferImageTargetType;
    private _buildImageTargetGeometry;
    getImageScanningEvent(): ImageScanningEvent;
    getImageTargetDescriptors(): ReadonlyArray<ZapparImageTargetDescriptor>;
    getImageTargetDescriptor(index: number): ZapparImageTargetDescriptor | undefined;
    private ensureCameraRunning;
    private onVisibilityChange;
    private onPreRender;
    /** Latest projection matrix for the SLAM camera (valid only if {@link hasSlamTrackingState} is true). */
    get slamProjectionMatrix(): Readonly<Float32Array> | null;
    /** Latest camera pose matrix for the SLAM camera (valid only if {@link hasSlamTrackingState} is true). */
    get slamCameraPoseMatrix(): Readonly<mat4> | null;
    /** Latest anchor pose matrix (valid only if {@link hasSlamTrackingState} is true). */
    get slamAnchorPoseMatrix(): Readonly<mat4> | null;
    get hasSlamTrackingState(): boolean;
    get slamFrameNumber(): number;
    private bindVideoTextureForSkyMaterial;
    updateTracking(): void;
    endSession(): Promise<void>;
    load(): Promise<void>;
    /** Whether this provider supports given tracking type */
    supports(type: TrackingType): boolean;
    /** Create a tracking implementation */
    createTracking(type: TrackingType, component: Component): ITrackingMode;
}
export {};
