@xmaxai/sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/README.md +9 -5
  3. package/dist/{chunk-V4NR6CPP.js → chunk-F567ONBH.js} +7 -184
  4. package/dist/chunk-F567ONBH.js.map +1 -0
  5. package/dist/{chunk-LCPC56BK.js → chunk-TFGYBN3Q.js} +493 -136
  6. package/dist/chunk-TFGYBN3Q.js.map +1 -0
  7. package/dist/index.cjs +30 -272
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +369 -8
  10. package/dist/index.d.ts +369 -8
  11. package/dist/index.js +1003 -9
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/index.cjs +9 -271
  14. package/dist/react/index.cjs.map +1 -1
  15. package/dist/react/index.d.cts +1 -3
  16. package/dist/react/index.d.ts +1 -3
  17. package/dist/react/index.js +6 -26
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/{rtc-manager-gYDkADGw.d.ts → rtc-manager-DnQoznIg.d.cts} +2 -17
  20. package/dist/{rtc-manager-gYDkADGw.d.cts → rtc-manager-DnQoznIg.d.ts} +2 -17
  21. package/dist/video-file-stream-4TAGKL2Q.js +3 -0
  22. package/dist/{video-file-stream-K7GQMIJ5.js.map → video-file-stream-4TAGKL2Q.js.map} +1 -1
  23. package/package.json +1 -6
  24. package/dist/chunk-4YHBCQ2C.js +0 -432
  25. package/dist/chunk-4YHBCQ2C.js.map +0 -1
  26. package/dist/chunk-LCPC56BK.js.map +0 -1
  27. package/dist/chunk-V4NR6CPP.js.map +0 -1
  28. package/dist/chunk-VLJZ56PT.js +0 -997
  29. package/dist/chunk-VLJZ56PT.js.map +0 -1
  30. package/dist/experimental/index.cjs +0 -3897
  31. package/dist/experimental/index.cjs.map +0 -1
  32. package/dist/experimental/index.d.cts +0 -2
  33. package/dist/experimental/index.d.ts +0 -2
  34. package/dist/experimental/index.js +0 -5
  35. package/dist/experimental/index.js.map +0 -1
  36. package/dist/index-Cw8C8LbO.d.ts +0 -367
  37. package/dist/index-Dg1ElHAj.d.cts +0 -367
  38. package/dist/video-file-stream-K7GQMIJ5.js +0 -4
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { S as SDKLocale, a as SDKI18n, b as XmaxOpenClient } from './rtc-manager-gYDkADGw.js';
2
- export { A as ACTIVE_STATUS, C as ClientOptions, c as CosSts, L as LocalPublishReadyResult, M as MEDIA_TIME_EPSILON_S, d as MEDIA_TIME_LOOP_JUMP_S, e as MOBILE_PUBLISH_MAX_WIDTH_PX, f as ModelExtra, P as PUBLISH_COLD_FRAME_TIMEOUT_MS, g as PUBLISH_COLD_MIN_FRAMES, h as PUBLISH_COLD_WARMUP_MS, i as PUBLISH_START_FRAME_TIMEOUT_MS, j as PUBLISH_START_MIN_FRAMES, k as PUBLISH_WARM_SKIP_MS, l as RTC_PUBLISH_FPS, m as RTC_PUBLISH_FPS_MOBILE, n as RTC_PUBLISH_FPS_WEB, o as RTC_PUBLISH_FRAME_INTERVAL_MS, p as RTC_PUBLISH_FRAME_INTERVAL_S, q as RemoteSeiReceivedPayload, r as ResolveRtcPublishFpsOptions, s as RtcJoinInfo, t as RtcLogEntry, u as RtcManager, R as RtcStateSnapshot, v as SDKMessages, w as Session, x as StsCredentials, U as UploadImageResult, y as UploadVideoResult, z as XMAX_OPEN_API_BASE_URLS, B as XMAX_OPEN_API_PRODUCTION_BASE_URL, D as XmaxLogEntry, E as XmaxSdkRegion, F as createSDKI18n, G as getDefaultMessages, H as isMobilePublishEnvironment, I as resolveRtcPublishFps, J as resolveRtcPublishFrameIntervalS } from './rtc-manager-gYDkADGw.js';
3
- export { D as DragTrackController, a as DragTrackControllerOptions, N as NativeCameraStream, O as OpenNativeCameraStreamOptions, R as RealtimeConnectOptions, b as RealtimeInitialState, c as RealtimeModel, d as RealtimePrewarmHandle, e as RealtimePromptState, f as RealtimeRestartOptions, g as RealtimeSession, h as RealtimeSetImageOptions, i as RealtimeSetInput, j as RealtimeSetModeOptions, k as RemoteViewHost, X as XmaxClient, l as XmaxClientFiles, m as XmaxClientOptions, n as XmaxRealtimeSession, o as createDragTrackController, p as createNativeCameraStream, q as createRemoteViewHost, r as createXmaxClient, s as getContentRect, t as mapTargetPointToCanvas, u as mapViewportPointToCoordinateSpace, v as models, w as observeDragSurfaceVideoSync, x as openNativeCameraStream, y as syncDragSurfaceToVideo } from './index-Cw8C8LbO.js';
1
+ import { S as SDKLocale, a as SDKI18n, X as XmaxOpenClient, R as RtcManager, b as XmaxErrorNotifier, U as UploadImageResult, c as UploadVideoResult } from './rtc-manager-DnQoznIg.js';
2
+ export { A as ACTIVE_STATUS, C as ClientOptions, d as CosSts, L as LocalPublishReadyResult, M as MEDIA_TIME_EPSILON_S, e as MEDIA_TIME_LOOP_JUMP_S, f as MOBILE_PUBLISH_MAX_WIDTH_PX, g as ModelExtra, P as PUBLISH_COLD_FRAME_TIMEOUT_MS, h as PUBLISH_COLD_MIN_FRAMES, i as PUBLISH_COLD_WARMUP_MS, j as PUBLISH_START_FRAME_TIMEOUT_MS, k as PUBLISH_START_MIN_FRAMES, l as PUBLISH_WARM_SKIP_MS, m as RTC_PUBLISH_FPS_MOBILE, n as RTC_PUBLISH_FPS_WEB, o as RTC_PUBLISH_FRAME_INTERVAL_MS, p as RTC_PUBLISH_FRAME_INTERVAL_S, q as RemoteSeiReceivedPayload, r as ResolveRtcPublishFpsOptions, s as RtcJoinInfo, t as RtcLogEntry, u as RtcStateSnapshot, v as SDKMessages, w as Session, x as StsCredentials, y as XMAX_OPEN_API_BASE_URLS, z as XMAX_OPEN_API_PRODUCTION_BASE_URL, B as XmaxLogEntry, D as XmaxSdkRegion, E as createSDKI18n, F as getDefaultMessages, G as isMobilePublishEnvironment, H as resolveRtcPublishFps, I as resolveRtcPublishFrameIntervalS } from './rtc-manager-DnQoznIg.js';
4
3
 
5
4
  /**
6
5
  * Open API business error codes (46xxx) mapped to user-facing messages.
@@ -86,16 +85,14 @@ type VideoFileStreamOptions = {
86
85
  loop?: boolean;
87
86
  muted?: boolean;
88
87
  playbackRate?: number;
89
- /** @deprecated Upload video is playback-driven; fps is measured from the source file. */
88
+ /** Optional fps override; when omitted, fps is measured from the source file. */
90
89
  fps?: number;
91
- /** @deprecated Mobile/web publish fps is derived from the uploaded file. */
90
+ /** Optional hint; publish fps is still derived from the uploaded file when applicable. */
92
91
  mobile?: boolean;
93
92
  targetSize?: [number, number];
94
93
  i18n?: SDKI18n;
95
94
  onHealthReport?: (health: VideoInputHealth) => void;
96
95
  healthIntervalMs?: number;
97
- /** Log each canvas draw (proxy for frames fed to RTC captureStream). */
98
- logPublishFrames?: boolean;
99
96
  };
100
97
  type VideoFileStream = {
101
98
  url: string;
@@ -122,6 +119,27 @@ declare function isImageMediaFile(file: File | string): boolean;
122
119
  declare function isVideoMediaFile(file: File | string): boolean;
123
120
  declare function createMediaFileStream(fileOrUrl: File | string, options?: ImageFileStreamOptions): Promise<VideoFileStream>;
124
121
 
122
+ type NativeCameraStream = {
123
+ sourceStream: MediaStream;
124
+ previewStream: MediaStream;
125
+ videoTrack: MediaStreamTrack;
126
+ videoEl: HTMLVideoElement;
127
+ width: number;
128
+ height: number;
129
+ destroy: () => void;
130
+ };
131
+ type OpenNativeCameraStreamOptions = {
132
+ width?: number;
133
+ height?: number;
134
+ frameRate?: number;
135
+ facingMode?: ConstrainDOMString;
136
+ i18n?: SDKI18n;
137
+ };
138
+ declare function openNativeCameraStream(options?: OpenNativeCameraStreamOptions): Promise<NativeCameraStream>;
139
+ declare function createNativeCameraStream(sourceStream: MediaStream, options?: {
140
+ i18n?: SDKI18n;
141
+ }): Promise<NativeCameraStream>;
142
+
125
143
  type MirroredCameraStream = {
126
144
  /** Original camera stream from getUserMedia. */
127
145
  sourceStream: MediaStream;
@@ -237,4 +255,347 @@ declare const PREVIEW_COVER_ATTR = "data-preview-cover";
237
255
  declare function applyUploadPreviewMediaLayout(container: HTMLElement): void;
238
256
  declare function observeUploadPreviewMediaLayout(container: HTMLElement): () => void;
239
257
 
240
- export { API_ERROR_MESSAGES, type CameraAccessErrorKind, type CameraCaptureOptions, type CameraEnvironmentIssue, type CameraTrackCapabilities, type CameraTrackSettings, DEFAULT_SESSION_TARGET_SIZE, type ImageFileStreamOptions, type MirroredCameraStream, type MirroredCameraStreamOptions, type OpenMirroredCameraStreamOptions, PREVIEW_CONTAINER_ASPECT_RATIO, PREVIEW_CONTAIN_ATTR, PREVIEW_COVER_ATTR, PREVIEW_OUTPUT_LAYOUT_ATTR, PREVIEW_UPLOAD_FIT_ATTR, PREVIEW_UPLOAD_LAYOUT_ATTR, type RtcRoomEvent, SDKI18n, SDKLocale, type StartRtcRoomEvent, type StopRtcRoomEvent, type TracksRtcRoomEvent, type VideoFileStream, type VideoFileStreamOptions, XmaxOpenClient, applyUploadPreviewMediaLayout, classifyCameraAccessError, createImageFileStream, createMediaFileStream, createMirroredCameraStreamFromMediaStream, createPublishCameraStream, createStartRtcRoomEvent, createStopRtcRoomEvent, createTaskUid, createTracksRtcRoomEvent, createVideoFileStream, getCameraEnvironmentIssue, isCameraAccessError, isImageMediaFile, isVideoMediaFile, observeUploadPreviewMediaLayout, openMirroredCameraStream, requestCameraMediaStream, resolveAdaptiveRtcVideoSize, resolveApiErrorMessage, resolvePreviewAspectRatio, resolveRefImageUrl, resolveSessionTargetSize, resolveUploadPublishSize, resolveUploadVideoSize, stabilizeCameraVideoTrack };
258
+ type PrewarmedRoomResources = {
259
+ client: XmaxOpenClient;
260
+ rtc: RtcManager;
261
+ sessionUid: string;
262
+ };
263
+ /** Holds a joined RTC room before camera input is attached — iOS enterRoom-at-launch equivalent. */
264
+ declare class RealtimePrewarmHandle {
265
+ readonly client: XmaxOpenClient;
266
+ readonly rtc: RtcManager;
267
+ readonly sessionUid: string;
268
+ readonly modelName: string;
269
+ private consumed;
270
+ private disposed;
271
+ private constructor();
272
+ static create(model: RealtimeModel, clientOptions: XmaxClientOptions): Promise<RealtimePrewarmHandle>;
273
+ consume(expectedModelName: string): PrewarmedRoomResources | null;
274
+ cancel(): Promise<void>;
275
+ }
276
+
277
+ type RealtimeModel = {
278
+ name: string;
279
+ width: number;
280
+ height: number;
281
+ fps?: number;
282
+ };
283
+ type RealtimePromptState = {
284
+ text: string;
285
+ enhance?: boolean;
286
+ };
287
+ type RemoteSeiReceivedPayload = {
288
+ sei: string;
289
+ userId: string;
290
+ };
291
+ type SeiGateState = {
292
+ expectedSei: string | null;
293
+ sei: string | null;
294
+ userId: string | null;
295
+ matched: boolean;
296
+ };
297
+ type XmaxClientOptions = {
298
+ apiKey: string;
299
+ /** @default {@link XMAX_OPEN_API_PRODUCTION_BASE_URL} */
300
+ baseUrl?: string;
301
+ authToken?: string;
302
+ heartbeatIntervalMs?: number;
303
+ onError?: XmaxErrorNotifier;
304
+ onLog?: (entry: {
305
+ scope: 'client' | 'rtc';
306
+ level: 'info' | 'success' | 'warn' | 'error';
307
+ message: string;
308
+ data?: unknown;
309
+ }) => void;
310
+ /** Fired when H.264 SEI is received on the remote backend/bot output stream (not local publish). */
311
+ onRemoteSei?: (payload: RemoteSeiReceivedPayload) => void;
312
+ /** Fired when remote SEI gate state changes. */
313
+ onSeiGateChange?: (state: SeiGateState) => void;
314
+ /** Cleared when generation start completes; used to reset host loading state set before connect. */
315
+ onPublishPipelineWaitChange?: (waiting: boolean) => void;
316
+ };
317
+ type RealtimeInitialState = {
318
+ /** Legacy string prompt or Decart-style `{ text, enhance? }`. */
319
+ prompt?: string | RealtimePromptState;
320
+ /** Legacy reference image path or URL. */
321
+ refImage?: string;
322
+ /** Decart-style reference image (path, URL, File, or Blob). */
323
+ image?: string | File | Blob;
324
+ /** When true, send a start event immediately after connect. */
325
+ autoStart?: boolean;
326
+ /** @internal Business model label in RTC start params; optional — SDK uses a default when omitted. */
327
+ model?: string;
328
+ /** MoX instant — when `true`, sent as `static_generate` on connect start only (never cached). */
329
+ staticGenerate?: boolean;
330
+ /**
331
+ * MoX instant — uploaded source still URL (COS). Sent as `static_image_path` on connect
332
+ * start only (never cached). Local RTC publish is still used for preview / room compatibility.
333
+ */
334
+ staticImagePath?: string;
335
+ };
336
+ /** Why a successfully established realtime session was torn down. */
337
+ type RealtimeDisconnectReason = 'client' | 'session_inactive' | 'heartbeat_error';
338
+ type RealtimeConnectOptions = {
339
+ model: RealtimeModel;
340
+ localElement?: HTMLElement;
341
+ remoteElement?: HTMLElement;
342
+ onRemoteStream?: (stream: MediaStream) => void;
343
+ /**
344
+ * Session-scoped error handler (Decart-style). Prefer over {@link XmaxClientOptions.onError}
345
+ * when both are set.
346
+ */
347
+ onError?: XmaxErrorNotifier;
348
+ /**
349
+ * Fired once after a successfully established session disconnects.
350
+ * Not called when `connect()` itself fails before returning a session.
351
+ */
352
+ onDisconnect?: (reason: RealtimeDisconnectReason) => void;
353
+ initialState?: RealtimeInitialState;
354
+ size?: [number, number];
355
+ /** Mobile H5 uses 24fps publish; web uses 30fps. Auto-detected from viewport when omitted. */
356
+ mobile?: boolean;
357
+ /** `file` = pre-processed canvas stream (upload). `camera` = normalize via crop/mirror pipeline. */
358
+ inputKind?: 'camera' | 'file';
359
+ /** Pre-flip input video: `false` (default), `"auto"`, or `true`. */
360
+ mirror?: 'auto' | boolean;
361
+ /** Reuse an already prepared camera publish pipeline (mirror/crop canvas). */
362
+ prebuiltCameraStream?: NativeCameraStream;
363
+ /**
364
+ * Enable drag on {@link RealtimeConnectOptions.remoteElement} after generation starts.
365
+ * Defaults to `true` when `remoteElement` is provided; `false` for `onRemoteStream`-only connects.
366
+ */
367
+ drag?: boolean;
368
+ /** Reuse a prewarmed RTC room from {@link XmaxClient.realtime.prewarm}. */
369
+ prewarmed?: RealtimePrewarmHandle;
370
+ };
371
+ type RealtimeRestartOptions = {
372
+ /** Pass `null` or `''` to clear the stored reference image. */
373
+ refImage?: string | null;
374
+ prompt?: string;
375
+ /** @internal Optional business model label; SDK uses a default when omitted. */
376
+ model?: string;
377
+ size?: [number, number];
378
+ /**
379
+ * MoX instant — when `true`, sent as `static_generate` on this start only (never cached).
380
+ * Omit on non-Instant starts.
381
+ */
382
+ staticGenerate?: boolean;
383
+ /**
384
+ * MoX instant — COS URL sent as `static_image_path` on this start only (never cached).
385
+ * Omit on non-Instant starts.
386
+ */
387
+ staticImagePath?: string;
388
+ /** Keep the last rendered remote frame visible while waiting for the next start output. */
389
+ preserveRemoteOutput?: boolean;
390
+ };
391
+ type RealtimeSetInput = {
392
+ prompt?: string | RealtimePromptState;
393
+ image?: string | File | Blob | null;
394
+ enhance?: boolean;
395
+ };
396
+ type RealtimeSetImageOptions = {
397
+ prompt?: string | RealtimePromptState;
398
+ enhance?: boolean;
399
+ };
400
+ type RealtimeDisconnectOptions = {};
401
+ type XmaxRealtimeSession = {
402
+ setPrompt: (prompt: string | RealtimePromptState, options?: {
403
+ enhance?: boolean;
404
+ }) => Promise<void>;
405
+ set: (input: RealtimeSetInput) => Promise<void>;
406
+ setImage: (image: string | File | Blob, options?: RealtimeSetImageOptions) => Promise<void>;
407
+ restart: (options?: RealtimeRestartOptions) => Promise<void>;
408
+ setRefImage: (input: File | string) => Promise<string>;
409
+ sendTracks: (tracks: Array<[number, number]>) => Promise<void>;
410
+ /** Re-bind the remote output container (call after output should be visible). */
411
+ refreshRemoteOutput: (options?: {
412
+ force?: boolean;
413
+ }) => Promise<void>;
414
+ /** Re-bind local preview (call after PiP container is visible). */
415
+ refreshLocalPreview: () => void;
416
+ /** Processed canvas stream for local PiP (camera pipeline); null for file input. */
417
+ getInputPreviewStream: () => MediaStream | null;
418
+ /** Detach remote output from the RTC player. */
419
+ detachRemoteOutput: () => void;
420
+ /** Active server session uid, if connected. */
421
+ getSessionUid: () => string | null;
422
+ stop: () => Promise<void>;
423
+ disconnect: (options?: RealtimeDisconnectOptions) => Promise<void>;
424
+ };
425
+ type XmaxClientFiles = {
426
+ uploadImage: (file: File) => Promise<UploadImageResult>;
427
+ uploadVideo: (file: File) => Promise<UploadVideoResult>;
428
+ /** Decart-style alias for {@link XmaxClientFiles.uploadImage}. */
429
+ upload: (file: File) => Promise<UploadImageResult>;
430
+ };
431
+ type XmaxClient = {
432
+ files: XmaxClientFiles;
433
+ realtime: {
434
+ /** Join RTC room before camera input — call on explicit user action to avoid idle billing. */
435
+ prewarm: (options: {
436
+ model: RealtimeModel;
437
+ }) => Promise<RealtimePrewarmHandle>;
438
+ connect: (stream: MediaStream, options: RealtimeConnectOptions) => Promise<XmaxRealtimeSession>;
439
+ };
440
+ };
441
+
442
+ declare const models: {
443
+ realtime(name: string, options?: {
444
+ width?: number;
445
+ height?: number;
446
+ fps?: number;
447
+ }): RealtimeModel;
448
+ };
449
+
450
+ declare class RealtimeSession implements XmaxRealtimeSession {
451
+ private readonly client;
452
+ private readonly rtc;
453
+ private readonly reportError;
454
+ private readonly remoteElement;
455
+ private readonly onRemoteStream?;
456
+ private readonly onDisconnect?;
457
+ private readonly onPublishPipelineWaitChange?;
458
+ private sessionUid;
459
+ private taskUid;
460
+ private localVideoSize;
461
+ private currentPrompt;
462
+ private currentGenerationModel;
463
+ private disconnected;
464
+ /** True only after `connect()` bootstrap succeeds — gates `onDisconnect`. */
465
+ private sessionEstablished;
466
+ private disconnectNotified;
467
+ private pendingDisconnectReason;
468
+ private remoteViewHost;
469
+ private dragController;
470
+ private dragTrackFitMode;
471
+ private sessionTargetSize;
472
+ private sessionSizeOverride;
473
+ private mirroredInputStream;
474
+ private hiddenRemoteElement;
475
+ private remoteStreamNotifyTimer;
476
+ private lastNotifiedRemoteStream;
477
+ private dragOption;
478
+ constructor(client: XmaxOpenClient, rtc: RtcManager, reportError: (error: unknown, fallbackMessage?: string) => never, options: Pick<RealtimeConnectOptions, 'remoteElement' | 'onRemoteStream' | 'onDisconnect' | 'drag'>, clientOptions?: Pick<XmaxClientOptions, 'onPublishPipelineWaitChange'>);
479
+ private get remoteVideoContainer();
480
+ static connect(stream: MediaStream, options: RealtimeConnectOptions, clientOptions: XmaxClientOptions): Promise<RealtimeSession>;
481
+ private bootstrap;
482
+ setPrompt(prompt: string | RealtimePromptState, _options?: {
483
+ enhance?: boolean;
484
+ }): Promise<void>;
485
+ set(input: RealtimeSetInput): Promise<void>;
486
+ setImage(image: string | File | Blob, options?: RealtimeSetImageOptions): Promise<void>;
487
+ setRefImage(input: File | string): Promise<string>;
488
+ restart(options?: RealtimeRestartOptions): Promise<void>;
489
+ refreshRemoteOutput(options?: {
490
+ force?: boolean;
491
+ }): Promise<void>;
492
+ refreshLocalPreview(): void;
493
+ getInputPreviewStream(): MediaStream | null;
494
+ detachRemoteOutput(): void;
495
+ sendTracks(tracks: Array<[number, number]>): Promise<void>;
496
+ stop(options?: {
497
+ preserveRemoteDom?: boolean;
498
+ }): Promise<void>;
499
+ disconnect(options?: RealtimeDisconnectOptions): Promise<void>;
500
+ getSessionUid(): string | null;
501
+ private runStart;
502
+ private isDragEnabled;
503
+ private updateDragController;
504
+ private scheduleNotifyRemoteStream;
505
+ private notifyRemoteStreamOnce;
506
+ private clearRemoteStreamNotifyTimer;
507
+ private emitDisconnect;
508
+ private safeDisconnect;
509
+ }
510
+
511
+ declare function createXmaxClient(options: XmaxClientOptions): XmaxClient;
512
+
513
+ type DragTrackControllerOptions = {
514
+ targetSize: [number, number];
515
+ fitMode?: 'contain' | 'cover';
516
+ mirrored?: boolean;
517
+ enabled?: boolean;
518
+ onTracks: (tracks: Array<[number, number]>) => void | Promise<void>;
519
+ /** Fired once when a real drag stroke begins (first pointer down). */
520
+ onStrokeStart?: () => void | Promise<void>;
521
+ /** Fired once when a real drag stroke ends (pointer up/cancel), not on disable/destroy. */
522
+ onStrokeEnd?: () => void | Promise<void>;
523
+ };
524
+ declare class DragTrackController {
525
+ private readonly container;
526
+ private readonly canvas;
527
+ private readonly onTracks;
528
+ private readonly onStrokeStart;
529
+ private readonly onStrokeEnd;
530
+ private strokeActive;
531
+ private targetSize;
532
+ private fitMode;
533
+ private mirrored;
534
+ private enabled;
535
+ private readonly activePointers;
536
+ private readonly lastTargetPoints;
537
+ private readonly segQueue;
538
+ private sampleTimer;
539
+ private sampleInFlight;
540
+ private rafId;
541
+ private resizeObserver;
542
+ private readonly onWindowResize;
543
+ private readonly onPointerDown;
544
+ private readonly onPointerMove;
545
+ private readonly onPointerUp;
546
+ private readonly onPointerCancel;
547
+ constructor(container: HTMLElement, options: DragTrackControllerOptions);
548
+ setEnabled(enabled: boolean): void;
549
+ setTargetSize(targetSize: [number, number]): void;
550
+ setFitMode(fitMode: 'contain' | 'cover'): void;
551
+ setMirrored(mirrored: boolean): void;
552
+ destroy(): void;
553
+ private applyInteractionStyle;
554
+ private bindResizeObserver;
555
+ private unbindResizeObserver;
556
+ private bindPointerEvents;
557
+ private unbindPointerEvents;
558
+ private clearCanvas;
559
+ private resizeCanvas;
560
+ private toTargetPoint;
561
+ private stopDrawLoop;
562
+ private startDrawLoop;
563
+ private stopSampling;
564
+ private collectCurrentTracks;
565
+ private flushTracks;
566
+ private startSampling;
567
+ private finishStroke;
568
+ private handlePointerDown;
569
+ private handlePointerMove;
570
+ private handlePointerUp;
571
+ private handlePointerCancel;
572
+ }
573
+ declare function createDragTrackController(container: HTMLElement, options: DragTrackControllerOptions): DragTrackController;
574
+
575
+ type MapViewportOptions = {
576
+ fitMode?: 'contain' | 'cover';
577
+ /** Flip X when the output video is horizontally mirrored in CSS (xmax-open-sdk remote overlay). */
578
+ mirrored?: boolean;
579
+ };
580
+ declare function mapViewportPointToCoordinateSpace(e: Pick<PointerEvent, 'clientX' | 'clientY'>, container: HTMLElement, targetSize: [number, number], options?: MapViewportOptions): [number, number] | null;
581
+ /** Inverse of mapViewportPointToCoordinateSpace — target coords to canvas pixels (CSS space × dpr). */
582
+ declare function mapTargetPointToCanvas(point: [number, number], container: HTMLElement, targetSize: [number, number], dpr: number, options?: MapViewportOptions): [number, number] | null;
583
+
584
+ type RemoteViewHost = {
585
+ wrapper: HTMLElement;
586
+ videoHost: HTMLElement;
587
+ dragHost: HTMLElement;
588
+ };
589
+ declare function createRemoteViewHost(wrapper: HTMLElement): RemoteViewHost;
590
+
591
+ type DragVideoSyncOptions = {
592
+ getTargetSize: () => [number, number];
593
+ getFitMode: () => 'contain' | 'cover';
594
+ onSync?: () => void;
595
+ };
596
+ /** Align app-layer drag overlay to the painted RTC media region (xmax-open-sdk track surface). */
597
+ declare function syncDragSurfaceToVideo(dragSurface: HTMLElement, targetSize: [number, number], fitMode: 'contain' | 'cover'): boolean;
598
+ /** Keep an app-layer drag surface aligned with remote output video layout. */
599
+ declare function observeDragSurfaceVideoSync(dragSurface: HTMLElement, options: DragVideoSyncOptions): () => void;
600
+
601
+ export { API_ERROR_MESSAGES, type CameraAccessErrorKind, type CameraCaptureOptions, type CameraEnvironmentIssue, type CameraTrackCapabilities, type CameraTrackSettings, DEFAULT_SESSION_TARGET_SIZE, DragTrackController, type DragTrackControllerOptions, type ImageFileStreamOptions, type MirroredCameraStream, type MirroredCameraStreamOptions, type NativeCameraStream, type OpenMirroredCameraStreamOptions, type OpenNativeCameraStreamOptions, PREVIEW_CONTAINER_ASPECT_RATIO, PREVIEW_CONTAIN_ATTR, PREVIEW_COVER_ATTR, PREVIEW_OUTPUT_LAYOUT_ATTR, PREVIEW_UPLOAD_FIT_ATTR, PREVIEW_UPLOAD_LAYOUT_ATTR, type RealtimeConnectOptions, type RealtimeDisconnectReason, type RealtimeInitialState, type RealtimeModel, RealtimePrewarmHandle, type RealtimePromptState, type RealtimeRestartOptions, RealtimeSession, type RealtimeSetImageOptions, type RealtimeSetInput, type RemoteViewHost, RtcManager, type RtcRoomEvent, SDKI18n, SDKLocale, type StartRtcRoomEvent, type StopRtcRoomEvent, type TracksRtcRoomEvent, UploadImageResult, UploadVideoResult, type VideoFileStream, type VideoFileStreamOptions, type XmaxClient, type XmaxClientFiles, type XmaxClientOptions, XmaxOpenClient, type XmaxRealtimeSession, applyUploadPreviewMediaLayout, classifyCameraAccessError, createDragTrackController, createImageFileStream, createMediaFileStream, createMirroredCameraStreamFromMediaStream, createNativeCameraStream, createPublishCameraStream, createRemoteViewHost, createStartRtcRoomEvent, createStopRtcRoomEvent, createTaskUid, createTracksRtcRoomEvent, createVideoFileStream, createXmaxClient, getCameraEnvironmentIssue, isCameraAccessError, isImageMediaFile, isVideoMediaFile, mapTargetPointToCanvas, mapViewportPointToCoordinateSpace, models, observeDragSurfaceVideoSync, observeUploadPreviewMediaLayout, openMirroredCameraStream, openNativeCameraStream, requestCameraMediaStream, resolveAdaptiveRtcVideoSize, resolveApiErrorMessage, resolvePreviewAspectRatio, resolveRefImageUrl, resolveSessionTargetSize, resolveUploadPublishSize, resolveUploadVideoSize, stabilizeCameraVideoTrack, syncDragSurfaceToVideo };