import { P as PopmeltSubjectAdapter, f as PopmeltSubject, E as ElementInfo, h as PopmeltSubjectCreationSession, g as PopmeltSubjectBounds, i as PopmeltSubjectOutlinePoint, j as PopmeltSubjectTrackingAnchor } from './subjects-BM3Smdow.mjs'; /** Geometry is normalized against the loaded image, not its rendered size. */ type ImageObjectBox = { left: number; top: number; width: number; height: number; }; /** A provider's observation; no inference runtime is required by Core. */ type ImageObjectObservation = { label: string; score: number; box: ImageObjectBox; }; type PersistedImageSubject = { id: string; label: string; detectedLabel?: string; score: number; box: ImageObjectBox; detectedBox?: ImageObjectBox; origin: 'detected' | 'manual'; boundsOverridden?: boolean; }; type PersistedImageSuppression = { detectedLabel: string; detectedBox: ImageObjectBox; }; type PersistedImageAnalysis = { schemaVersion: 1; source: string; imageHash: string; inferenceKey: string; dedupeKey: string; subjects: readonly PersistedImageSubject[]; /** Inferred objects explicitly removed by the user for this image hash. */ suppressions?: readonly PersistedImageSuppression[]; updatedAt: number; }; type ImageSubjectStore = { load(key: string): PersistedImageAnalysis | null | Promise; save(key: string, analysis: PersistedImageAnalysis): void | Promise; remove?(key: string): void | Promise; /** Older content-hash versions retained before the active record changed. */ loadHistory?(key: string): readonly PersistedImageAnalysis[] | Promise; }; type BrowserImageSubjectStoreOptions = { /** Prefix used for browser storage entries. */ namespace?: string; /** Override localStorage, primarily for embedded browsers and tests. */ storage?: Storage; }; declare function createBrowserImageSubjectStore(options?: BrowserImageSubjectStoreOptions): ImageSubjectStore; declare function createMemoryImageSubjectStore(): ImageSubjectStore; type ImageContentHasher = (image: HTMLImageElement) => string | Promise; /** Optional perception boundary. Core keeps media authoring usable without it. */ type ImageRecognitionProvider = { cacheKey: string; configurationKey: string; detect(image: HTMLImageElement): Promise; reconcile(observations: readonly ImageObjectObservation[], previousSubjects: readonly PersistedImageSubject[], suppressions: readonly PersistedImageSuppression[]): readonly PersistedImageSubject[]; dispose?(): void | Promise; }; type ImageSubjectAdapterOptions = { /** Optional perception; omit for manual-only image annotation. */ recognition?: ImageRecognitionProvider; /** Restore saved subjects without hashing or running recognition. */ hydrateOnly?: boolean; /** Images to analyze when the adapter starts. Defaults to every image. */ selector?: string; /** Root to scan and observe. Defaults to document. */ root?: Document | Element; /** Observe added images and src changes. Defaults to true. */ observe?: boolean; /** Override the durable Core adapter id. */ id?: string; /** Persist detections and user overrides. Omit to keep adapter state ephemeral. */ store?: ImageSubjectStore; /** Override content hashing, primarily for authenticated or virtual images. */ imageHasher?: ImageContentHasher; onError?: (error: unknown, image: HTMLImageElement) => void; }; declare class ImageSubjectAdapter implements PopmeltSubjectAdapter { private readonly options; readonly surfaceKind: "image"; readonly id: string; private readonly records; private readonly imageKeys; private readonly analyzedSources; private readonly pending; private readonly analysisMetadata; private readonly suppressions; private readonly writeChains; private readonly pendingWrites; private readonly observer; private refreshQueued; private destroyed; private readyPromise; private manualSequence; constructor(options?: ImageSubjectAdapterOptions); whenReady(): Promise; listSubjects(): readonly PopmeltSubject[]; refresh(): Promise; hitTest(clientPoint: { x: number; y: number; }): PopmeltSubject | null; resolve(key: string): PopmeltSubject | null; restoreSubject(key: string, elementInfo: ElementInfo): PopmeltSubject | null; private imageObjectContext; captureSubject(key: string): Promise; beginCreate(clientPoint: { x: number; y: number; }): PopmeltSubjectCreationSession | null; renameSubject(key: string, label: string): PopmeltSubject | null; updateSubjectBounds(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null; removeSubject(key: string): void; destroy(): Promise; private queueRefresh; private analyze; private replaceImageRecords; private imageIdentity; private matchingImages; private clampedImagePoint; private newObjectId; private persistImage; private saveImage; private imageSubjects; private persistencePayload; private removeImage; } declare function createImageSubjectAdapter(options?: ImageSubjectAdapterOptions): ImageSubjectAdapter; type VideoObjectBox = ImageObjectBox; type VideoTrackingAnchor = PopmeltSubjectTrackingAnchor; type VideoTrackKeyframe = { time: number; box: VideoObjectBox; score: number; source: 'manual' | 'tracked'; /** Optional contour normalized within this frame's box. */ outline?: readonly PopmeltSubjectOutlinePoint[]; }; type VideoSegmentationPoint = { /** Horizontal position normalized within the uncropped video frame. */ x: number; /** Vertical position normalized within the uncropped video frame. */ y: number; }; type VideoSegmentationObservation = { label?: string; score: number; box: VideoObjectBox; /** Contour normalized within `box`. */ outline?: readonly PopmeltSubjectOutlinePoint[]; }; /** Optional point-prompted perception boundary. Core owns the resulting subject. */ type VideoSegmentationProvider = { cacheKey: string; configurationKey: string; segment(video: HTMLVideoElement, time: number, point: VideoSegmentationPoint): Promise; dispose?(): void | Promise; }; type VideoTrackObservation = { time: number; box: VideoObjectBox; score: number; }; type VideoTrackingAttempt = { /** Expand the normal local search crop during reacquisition. */ searchScale?: number; }; type VideoTrackSegment = { /** First media time at which this object is confidently observable. */ start: number; /** Last confidently observable media time. Omitted while the segment is open. */ end?: number; }; type VideoTrackingSeed = { video: HTMLVideoElement; time: number; box: VideoObjectBox; anchors?: readonly VideoTrackingAnchor[]; }; type VideoTrackingSession = { track(video: HTMLVideoElement, time: number, attempt?: VideoTrackingAttempt): Promise; reseed?(seed: VideoTrackingSeed): void | Promise; dispose?(): void | Promise; }; type VideoTrackSmoother = { /** Builds one presentation frame from a chronological durable observation. */ smooth(frame: VideoTrackKeyframe): VideoTrackKeyframe; }; type VideoMotionState = { visible: boolean; misses: number; hits: number; lostAt?: number; }; type VideoMotionPresenceDecision = { state: VideoMotionState; action: 'accept' | 'hold' | 'close' | 'reopen'; }; type VideoMotionAttempt = { framesPerSecond: number; tracking: VideoTrackingAttempt; }; type VideoBackwardAnalysisOptions = { source: HTMLVideoElement; seedTime: number; keyframes: readonly VideoTrackKeyframe[]; anchors: readonly VideoTrackingAnchor[]; maximumFramesPerSecond: number; cancelled: () => boolean; forwardWork: () => Promise | undefined; }; type VideoBackwardAnalysisResult = { earliestTime: number; keyframes: VideoTrackKeyframe[]; }; /** * Pixel-derived motion policy supplied by a perception extension. Core invokes * it, then stores and renders the resulting durable and presentation tracks. */ type VideoMotionPolicy = { createSmoother(): VideoTrackSmoother; attempt(options: { state: VideoMotionState; time: number; maximumFramesPerSecond: number; }): VideoMotionAttempt; observe(options: { state: VideoMotionState; time: number; observation: VideoTrackObservation | null; }): VideoMotionPresenceDecision; analyzeBackward(options: VideoBackwardAnalysisOptions): Promise; }; /** Optional local perception boundary. Core owns tracks and authoring. */ type VideoTrackingProvider = { cacheKey: string; configurationKey: string; motion: VideoMotionPolicy; createSession(seed: VideoTrackingSeed): Promise; dispose?(): void | Promise; }; type PersistedVideoTrack = { id: string; label: string; origin: 'manual' | 'detected'; keyframes: readonly VideoTrackKeyframe[]; /** See-derived display geometry, persisted so Core can replay it alone. */ presentationKeyframes?: readonly VideoTrackKeyframe[]; anchors?: readonly VideoTrackingAnchor[]; /** Explicit visible spans. Missing on schema-v1 tracks, which migrate open-ended. */ segments?: readonly VideoTrackSegment[]; /** Furthest media time already covered by forward inference. */ analyzedThrough?: number; createdAt: number; updatedAt: number; }; type PersistedVideoAnalysis = { schemaVersion: 1 | 2 | 3; source: string; duration: number; tracks: readonly PersistedVideoTrack[]; updatedAt: number; }; type VideoSubjectStore = { load(key: string): PersistedVideoAnalysis | null | Promise; save(key: string, analysis: PersistedVideoAnalysis): void | Promise; remove?(key: string): void | Promise; }; type VideoSubjectAdapterOptions = { segmentation?: VideoSegmentationProvider; tracking?: VideoTrackingProvider; selector?: string; root?: Document | Element; observe?: boolean; id?: string; store?: VideoSubjectStore; maxTrackingFramesPerSecond?: number; onError?: (error: unknown, video: HTMLVideoElement) => void; }; declare class VideoSubjectAdapter implements PopmeltSubjectAdapter { private readonly options; readonly surfaceKind: "video"; readonly id: string; private readonly records; private readonly videoKeys; private readonly metadata; private readonly analyzedSources; private readonly listeners; private readonly frameHandles; private readonly persistTimers; private readonly writeChains; private readonly pendingWrites; private readonly observer; private refreshQueued; private destroyed; private manualSequence; private detectedSequence; private activeTrackingKey; private segmentationGeneration; private readonly transientKeys; private readonly segmentationRequestSignatures; private readonly changeListeners; private readyPromise; constructor(options?: VideoSubjectAdapterOptions); whenReady(): Promise; subscribe(listener: () => void): () => void; listSubjects(): readonly PopmeltSubject[]; refresh(): Promise; hitTest(point: { x: number; y: number; }): PopmeltSubject | null; hitTestAll(point: { x: number; y: number; }): readonly PopmeltSubject[]; promoteSubject(key: string): PopmeltSubject | null; resolve(key: string): PopmeltSubject | null; captureSubject(key: string): Promise; beginCreate(point: { x: number; y: number; }): PopmeltSubjectCreationSession | null; renameSubject(key: string, label: string): PopmeltSubject | null; updateSubjectBounds(key: string, bounds: PopmeltSubjectBounds): PopmeltSubject | null; updateSubjectTrackingAnchors(key: string, anchors: readonly PopmeltSubjectTrackingAnchor[]): PopmeltSubject | null; removeSubject(key: string): void; destroy(): Promise; private scheduleSegmentation; private addDetectedSubject; private clearTransientSubjects; private analyze; private addVideoListeners; private removeVideoListeners; private scheduleFrame; private trackVideo; private startSession; private reseed; private failTracking; private activeRecordFor; private activateMostRecentRecord; private activateTrackingRecord; private scheduleBackwardAnalysis; private cancelBackwardAnalysis; private runBackwardAnalysis; private acceptObservation; private openSegment; private closeSegment; private insertKeyframe; private rebuildPresentationTrack; private clearLiveFrames; private videoObjectContext; private replaceVideoRecords; private persistVideo; private schedulePersistence; private flushScheduledPersistence; private matchingVideos; private videoIdentity; private newObjectId; private removeVideoRecords; private removeVideo; private queueRefresh; } declare function createVideoSubjectAdapter(options?: VideoSubjectAdapterOptions): VideoSubjectAdapter; export { type VideoTrackSmoother as A, type BrowserImageSubjectStoreOptions as B, type VideoTrackingAnchor as C, type VideoTrackingAttempt as D, type VideoTrackingSeed as E, type VideoTrackingSession as F, createBrowserImageSubjectStore as G, createImageSubjectAdapter as H, type ImageSubjectAdapterOptions as I, createMemoryImageSubjectStore as J, createVideoSubjectAdapter as K, type PersistedImageAnalysis as P, type VideoSubjectAdapterOptions as V, type ImageRecognitionProvider as a, type VideoTrackingProvider as b, type VideoSegmentationProvider as c, type ImageObjectBox as d, type VideoSubjectStore as e, type VideoObjectBox as f, type ImageContentHasher as g, type ImageObjectObservation as h, ImageSubjectAdapter as i, type ImageSubjectStore as j, type PersistedImageSubject as k, type PersistedImageSuppression as l, type PersistedVideoAnalysis as m, type PersistedVideoTrack as n, type VideoBackwardAnalysisOptions as o, type VideoBackwardAnalysisResult as p, type VideoMotionAttempt as q, type VideoMotionPolicy as r, type VideoMotionPresenceDecision as s, type VideoMotionState as t, type VideoSegmentationObservation as u, type VideoSegmentationPoint as v, VideoSubjectAdapter as w, type VideoTrackKeyframe as x, type VideoTrackObservation as y, type VideoTrackSegment as z };