///
import { t as Serializable } from "./Serializable-BNGC32bH.js";
import { t as nativeHandle } from "./nativeHandle-CEYTezeV.js";
import { T as DeviceCamera, a as ZoomListener, f as FrameSource, o as CameraPosition, p as FrameSourceJSON, s as CameraSettings, t as Camera, v as TorchState } from "./Camera-BKZMXwCV.js";
import { n as PointJSON, t as Point } from "./Point-DEZvlLsO.js";
import { t as Size } from "./Size-DATsFFj9.js";
import { n as RectJSON, t as Rect } from "./Rect-tESibxOU.js";
import { t as INTERNAL_ACCESS } from "./privateAccess-DLrOMEAu.js";
import { r as ProgressInfo } from "./LoadingStatus-D4PQxh_p.js";
import { t as Anchor } from "./Anchor-D6jFSBCQ.js";
import { t as JSONType } from "./JSONType-D3JnZbXu.js";
import { n as MarginsWithUnitJSON, t as MarginsWithUnit } from "./MarginsWithUnit-BwPzUCSK.js";
import { t as Orientation } from "./Orientation-CAIgPVlD.js";
import { n as PointWithUnitJSON, t as PointWithUnit } from "./PointWithUnit-BpvvmGC6.js";
import { t as Quadrilateral } from "./Quadrilateral-BTpxJ2RE.js";
import { c as ZoomGestureJSON, n as FocusGestureJSON, r as LogoStyle, s as ZoomGesture, t as FocusGesture } from "./DataCaptureViewPlusRelated-BFPg6fO1.js";
import { t as AsyncStateMachine } from "./AsyncStateMachine-4VCRyyi0.js";
import { t as ScanditHTMLElement } from "./ScanditHTMLElement-DB_pDIgX.js";
import { t as ScanditIcon } from "./ScanditIcon-Dv_GCY5b.js";
import { t as NotificationConfiguration } from "./NotificationConfiguration-B4IoNMCE.js";
import { t as NotificationPresenter } from "./NotificationPresenter-o8BxCQeV.js";
import { t as AnchorPositions } from "./AnchorPositions-DADBQ-Sd.js";
import { i as StateToRenderDomView, n as DidTapCustomLocationsViewListener, r as StateToRender } from "./CustomLocationsView-D1qIh1CS.js";
import { t as AdditionalLayerPosition } from "./AdditionalLayerPosition-ZVJ4ksB1.js";
import { t as ZoomSwitchOrientation } from "./ZoomSwitchOrientation-C9UiIOws.js";
import { n as DataCaptureContextSettingsJSON, t as DataCaptureContextSettings } from "./DataCaptureContextSettings-P_x5m_9o.js";
import { t as ColorType } from "./ColorType-CVdSJZTi.js";
import { t as WatermarkStack } from "./WatermarkStack-DCr7KooC.js";
import { a as SharedFrameMemAddressSlotPoolBuffers, i as SharedFrameMemAddressSlotPool } from "./SharedFrameMemAddressSlotPool-ys6Hq96w.js";
import { i as MethodSignature, o as Optional } from "./tsHelper-By91zuSr.js";
import { t as BatteryInfo } from "./BatteryInterface-BGkt2WD1.js";
import { t as Logger } from "./logger-rhb8lb4g.js";
import { a as ImagePlane, i as ImageConverter_statics, r as ImageConverterInstance } from "./sdcCoreInternalSdkCommonGeometry-BF4xvjjS.js";
import "./NotificationBuilder-BAbZTNOa.js";
import "./ScanditIconBuilder-BleF6ZE6.js";
import { t as OpenSourceSoftwareLicenseInfo } from "./OpenSourceSoftwareLicenseInfo-DnUG7_wJ.js";
import { n as HTMLElementStateJSON } from "./HtmlElementState-BZurhZTv.js";
//#region src/main/DataCaptureView.d.ts
interface DataCaptureOverlay extends Serializable {
[nativeHandle]?: {
className: string;
id: number;
};
toJSONObject: () => any;
}
interface PrivateDataCaptureOverlay extends DataCaptureOverlay {
onDocumentVisibilityChange?: (visibility: DocumentVisibilityState) => void;
}
interface DataCaptureViewListener {
didChangeSize?: (view: DataCaptureView$1, size: Size, orientation: Orientation) => void;
didChangeScanAreaMargins?: (view: DataCaptureView$1, margins: MarginsWithUnit) => void;
willChangeScanAreaMargins?: (view: DataCaptureView$1, oldMargins: MarginsWithUnit, newMargins: MarginsWithUnit) => void;
}
interface DataCaptureViewJSON {
scanAreaMargins: MarginsWithUnitJSON;
pointOfInterest: PointWithUnitJSON;
logoAnchor: Anchor;
logoOffset: PointWithUnitJSON;
logoHidden: boolean;
logoStyle: LogoStyle;
overlays: ReturnType[];
controls: ReturnType[];
focusGesture: FocusGestureJSON | null;
zoomGestures: ZoomGestureJSON[];
properties: Record;
}
interface DataCaptureViewConnectOptions {
camera?: Camera;
}
declare class DataCaptureView$1 implements Serializable {
focusGesture: FocusGesture | null;
shouldShowZoomNotification: boolean;
private _zoomGestures;
private swipeToZoomGesture;
private pinchToZoomGesture;
private swipeGesturePlugin;
private pinchGesturePlugin;
get zoomGestures(): ZoomGesture[];
set zoomGestures(gestures: ZoomGesture[]);
private _scanAreaMargins;
private _pointOfInterest;
private _logoStyle;
private _logoAnchor;
private _logoOffset;
private _context;
private readonly overlays;
private readonly controlMap;
private gestureRecognizer;
private containerElement;
private cameraPaintboardElement?;
private singleImageUploaderPaintboardElement?;
private frameSourceListener;
private _previewCamera;
private isConnected;
private get videoElement();
private visibilityListener;
private cameraRecoveryListener;
private controlsElement;
private cameraRecoveryElement;
private errorElement;
private canvasElement;
private frozenFrame;
private frozenFrameCanvas;
private _canvasDrawer;
private readonly listeners;
private htmlElement?;
private htmlElementState?;
private lastHtmlElementState;
private isVideoElementDetached;
private loadingOverlay;
private customLocationsView;
private lastFrameSourceState;
private singleImageUploaderView;
private orientation;
private properties;
private orientationObserver;
private onOrientationChangeListener;
private hintPresenter;
private onHintPresenterUpdateHandler;
private onViewFinderUpdateRequestedHandler;
private onWorkerMessageHandler;
private localizationSubscription?;
private htmlElementDidChangeHandler;
private htmlElementDisconnectedHandler;
private notificationPresenter;
private readonly zoomNotificationDuration;
private zoomNotificationTimeout;
[INTERNAL_ACCESS]: {
attachAdditionalLayer: (layer: HTMLElement, position: AdditionalLayerPosition) => void;
freezeFrame: () => void;
unfreezeFrame: () => void;
overlays: Set;
};
constructor();
get scanAreaMargins(): MarginsWithUnit;
set scanAreaMargins(margins: MarginsWithUnit);
/**
* Normalize all MarginsWithUnit values to pixel units using the current CSS dimensions.
* If dimensions are not yet known (width/height === 0), fraction values are kept as-is
* so the intent is preserved until actual layout is available.
*/
private marginsToPixels;
get pointOfInterest(): PointWithUnit;
set pointOfInterest(pointOfInterest: PointWithUnit);
get logoStyle(): LogoStyle;
set logoStyle(logoStyle: LogoStyle);
get logoAnchor(): Anchor;
set logoAnchor(logoAnchor: Anchor);
get logoOffset(): PointWithUnit;
set logoOffset(logoOffset: PointWithUnit);
setProperty(name: string, value: unknown): void;
private get cameraRecoveryText();
private get width();
private get height();
private get canvasDrawer();
private get controls();
/**
* The current context as a PrivateDataCaptureContext
*/
private get privateContext();
static forContext(context: DataCaptureContext | null): Promise;
showProgressBar(): void;
hideProgressBar(): void;
setProgressBarPercentage(percentage: number | null): void;
setProgressBarMessage(message: string): void;
getContext(): DataCaptureContext | null;
setContext(context: DataCaptureContext | null): Promise;
connectToElement(element: HTMLElement, options?: DataCaptureViewConnectOptions): void;
detachFromElement(): void;
addOverlay(overlay: DataCaptureOverlay): Promise;
removeOverlay(overlay: DataCaptureOverlay): Promise;
addListener(listener: DataCaptureViewListener): void;
removeListener(listener: DataCaptureViewListener): void;
/**
* Converts a point in the coordinate system of the last visible frame and maps it to a coordinate in the view.
* It does *not* take into account if the frameSource is mirrored.
*/
viewPointForFramePoint(point: Point): Point;
viewQuadrilateralForFrameQuadrilateral(quadrilateral: Quadrilateral): Quadrilateral;
addControl(control: Control): void;
removeControl(control: Control): void;
toJSONObject(): DataCaptureViewJSON;
isCameraRecoveryVisible(): boolean;
setCameraRecoveryVisible(visible: boolean): void;
allowPictureInPicture(allow: boolean): Promise;
protected viewAnchorPositionsForFrameAnchorPositions(anchorPositions: AnchorPositions): AnchorPositions;
protected setDidTapCustomLocationsViewListener(didTapViewListener: DidTapCustomLocationsViewListener): void;
protected renderCustomLocationsView(state: StateToRender | StateToRenderDomView): void;
getNotificationPresenter(): NotificationPresenter;
private removeStyles;
private onHintPresenterUpdate;
/** Called when the hint presenter requests the viewfinder rect. */
private onViewFinderUpdateRequested;
private clearHtmlElementContent;
private setupHtmlElement;
private setupHtmlElementSingleImageUploader;
private setupHtmlElementVisibility;
private createStyles;
private onOrientationChange;
private htmlElementDidChange;
private htmlElementDisconnected;
private handleVideoDisplay;
private isCanvasDrawerWithMetrics;
private onWorkerMessage;
/**
* Called when the view size has changed and SDC has recalculated everything, including the viewfinder rect.
*/
private onSDCViewSizeChangedCallback;
private updateHintPresenterViewFinderRect;
private drawEngineCommands;
private displayError;
private clearError;
private updateControls;
private onFrameSourceChange;
private onCameraStateChanged;
private setVideoElementOpacity;
private onSingleImageUploaderSettingsChange;
private onVisibilityChange;
private cameraRecovery;
private freezeFrame;
private unfreezeFrame;
private addSwipeToZoomListener;
private removeSwipeToZoomListener;
private addPinchToZoomListener;
private removePinchToZoomListener;
private performZoomIn;
private performZoomOut;
private formatZoomFactor;
}
//#endregion
//#region src/main/controls/common.d.ts
type ControlType = "camera-fov" | "camera" | "shutter" | "torch" | "zoom";
interface SerializedControl {
type: ControlType;
}
interface PrivateBaseControl {
install: (view: DataCaptureView$1) => Promise;
remove: (definitiveRemoval?: boolean) => void;
update?: (view: DataCaptureView$1) => void;
}
interface Control extends Serializable {}
interface PrivateControl extends Control, PrivateBaseControl {
view: DataCaptureView$1 | null;
}
//#endregion
//#region src/main/controls/CameraFOVSwitchControl.d.ts
/**
* @deprecated 8.4.0 Use {@link ZoomSwitchControl} instead with `zoomLevels = [0.5, 1, 2]`.
*/
declare class CameraFOVSwitchControl implements Control {
protected readonly type: ControlType;
private customIcons;
private fovSwitchButton;
private CameraFOVSwitchButtonClass;
private currentFrameSource;
private view;
private onCameraFOVChanged;
private isTransitioning;
get cameraFOVWideImage(): string | null;
set cameraFOVWideImage(cameraFOVWideImage: string | null);
get cameraFOVWidePressedImage(): string | null;
set cameraFOVWidePressedImage(cameraFOVWidePressedImage: string | null);
get cameraFOVUltraWideImage(): string | null;
set cameraFOVUltraWideImage(cameraFOVUltraWideImage: string | null);
get cameraFOVUltraWidePressedImage(): string | null;
set cameraFOVUltraWidePressedImage(cameraFOVUltraWidePressedImage: string | null);
toJSONObject(): {
type: ControlType;
};
private updateButtonMode;
private applyCustomImagesToButton;
private updateButtonVisibility;
private canShow;
private isUltraWideBackCamera;
private handleCameraFOVChanged;
private setInitialWideCamera;
private handleCameraFOVSwitch;
private getAlternativeCamera;
private switchCameras;
}
//#endregion
//#region src/main/controls/CameraSwitchControl.d.ts
declare enum CameraSwitchBehavior {
Cycle = "cycle",
Flip = "flip"
}
declare class CameraSwitchControl implements Control {
private _behavior;
protected readonly type: ControlType;
private customImages;
private cameraSwitchButton;
private CameraSwitchButtonClass;
private currentFrameSource;
private view;
private onCameraSwitched;
private isTransitioning;
get behavior(): CameraSwitchBehavior;
set behavior(behavior: CameraSwitchBehavior);
get idleImage(): string | null;
set idleImage(idleImage: string | null);
get pressedImage(): string | null;
set pressedImage(pressedImage: string | null);
toJSONObject(): {
type: ControlType;
};
private get position();
private updateButtonVisibility;
private updateAriaLabel;
private applyCustomImagesToButton;
private canShow;
private handleCameraSwitched;
private handleCameraSwitch;
private getNextDeviceCamera;
private switchCameras;
}
//#endregion
//#region src/main/controls/TorchSwitchControl.d.ts
declare class TorchSwitchControl implements Control {
protected readonly type: ControlType;
private readonly customImage;
private torchSwitchIconButton;
private TorchSwitchIconButtonClass;
private view;
private onTorchToggled;
private get currentCamera();
get torchOffImage(): string | null;
set torchOffImage(torchOffImage: string | null);
get torchOffPressedImage(): string | null;
set torchOffPressedImage(torchOffPressedImage: string | null);
get torchOnImage(): string | null;
set torchOnImage(torchOnImage: string | null);
get torchOnPressedImage(): string | null;
set torchOnPressedImage(torchOnPressedImage: string | null);
toJSONObject(): {
type: ControlType;
};
private applyCustomImagesToButton;
private updateButtonState;
private handleTorchToggled;
private canShow;
private setTorchState;
}
//#endregion
//#region src/main/controls/ZoomSwitchControl.d.ts
declare class ZoomSwitchControl implements Control, ZoomListener {
private readonly type;
private view?;
private _zoomLevels;
private _orientation;
private _isAlwaysExpanded;
private _selectedZoomLevel;
private _accessibilityLabel;
private zoomSwitchPill?;
private ZoomSwitchPill?;
private isApplyingZoomLevel;
private readonly handlerForZoomStrategy;
private onZoomLevelSelected;
private get currentCamera();
get orientation(): ZoomSwitchOrientation;
set orientation(value: ZoomSwitchOrientation);
get isAlwaysExpanded(): boolean;
set isAlwaysExpanded(value: boolean);
get isExpanded(): boolean;
set isExpanded(value: boolean);
get selectedZoomLevel(): number;
get accessibilityLabel(): string;
set accessibilityLabel(label: string);
/**
* Programmatically select a zoom level.
*
* - If `level` is outside the camera's hardware zoom range, it is clamped to the nearest supported value.
* - If the (clamped) level does not match any of the configured `zoomLevels`, it appears as a temporary
* button in the control. The temporary button disappears as soon as another level is selected.
*
* @returns The zoom level that was actually applied (after hardware clamping).
*/
selectZoomLevel(level: number): Promise;
toJSONObject(): {
type: ControlType;
};
onZoomLevelChanged(camera: Camera, oldLevel: number, newLevel: number): void;
private canShow;
private handleZoomLevelSelected;
/**
* Updates the selected level in the UI, handling the temporary level logic:
* - If `level` matches a configured zoom level → select it, clear temporary
* - If `level` does NOT match → show it as a temporary level
*/
private updateSelectedLevelInUI;
private zoomStrategyForLevel;
private isCameraSwitchingStrategy;
private applyZoomLevelToCamera;
private switchToUltraWideCamera;
private switchToWideCamera;
private switchCameras;
private resolveOrientation;
private syncZoomLevelsFromCamera;
}
//#endregion
//#region src/main/private/FrameReaders/FrameReaderAbstract.d.ts
interface PoolCapacityOptions {
minPoolCapacity: number;
maxPoolCapacity: number;
}
interface SharedFrameMemAddressSlot {
index: number;
view: Uint8ClampedArray;
/**
* The pool this memAddressSlot was claimed from, so a holder can `abandon()` it (if dropped before
* `markReady`) or detect that it's stale (if a renegotiation has since replaced the pool) via
* referential comparison against the current pool, regardless of how long it's held onto.
*/
pool: SharedFrameMemAddressSlotPool;
}
/**
* Given the byte length a frame reader needs, returns a shared-heap memAddressSlot to write pixel data
* directly into, or null when the fast path isn't (yet, or ever) available for that size — in which
* case the caller falls back to its normal buffer pool.
*/
type SharedFrameMemAddressSlotAcquirer = (requiredByteLength: number) => SharedFrameMemAddressSlot | null;
declare abstract class FrameReaderAbstract {
colorType: ColorType;
protected readonly _contextWebGL: WebGLRenderingContext;
protected readonly _maxPoolCapacity: number;
protected readonly _minPoolCapacity: number;
/**
* In mobile applications, particularly on Android, capturing frames at a slow rate can be a common issue,
* especially in scenarios involving barcode tracking. Using a stack becomes valuable in such situations
* because it allows us to capture next frame with pixel data while the engine is still processing the previous one,
* eliminating the need to wait for the engine to finish before capturing the next frame.
*/
protected _framePool: Optional>;
/**
* Expected size of buffers in the pool. Used to validate buffers before recycling.
*/
protected _frameSize: number;
private _sharedFrameMemAddressSlotAcquirer;
constructor(contextWebGL: WebGLRenderingContext, options?: PoolCapacityOptions | undefined);
abstract readFromSource(source: TexImageSource, allowSharedSlot?: boolean): FrameCapture;
abstract setup(): void;
/** Wires (or clears, passing undefined) the zero-copy fast path this reader can use instead of its buffer pool. */
setSharedFrameMemAddressSlotAcquirer(acquirer: Optional): void;
protected acquireSharedMemAddressSlot(requiredByteLength: number): SharedFrameMemAddressSlot | null;
recycle(pixelsData: Uint8ClampedArray): void;
abstract dispose(): void;
}
//#endregion
//#region src/main/private/FrameReaders/FrameReader.d.ts
declare class FrameReader extends FrameReaderAbstract {
colorType: ColorType;
private _framebuffer;
private _texture;
private get _initialized();
readFromSource(source: TexImageSource, allowSharedSlot?: boolean): FrameCapture;
setup(): void;
dispose(): void;
private updateFrameSizeIfNeeded;
}
//#endregion
//#region src/main/private/FrameReaders/GrayScaleFrameReader.d.ts
declare class GrayScaleFrameReader extends FrameReaderAbstract {
colorType: ColorType;
protected _framePool: Optional>;
private _shaderProgram;
private _canvas;
private _ctx;
private _positionBuffer;
private _texture;
private _rgbaFallbackReader;
private _useRgbaFallback;
/**
* When these vertices are connected, they form a full-screen quad that covers the entire viewport.
* This quad is used as the rendering target for the grayscale effect.
* The vertices are specified in normalized device coordinates, where (-1, -1) is the bottom-left corner of the viewport, and (1, 1) is the top-right corner.
* These positions are used in conjunction with the vertex and fragment shaders to apply the grayscale effect to the input RGBA frame across the entire screen.
* The transformation is performed on each pixel within these triangles using the shaders.
* https://www.khronos.org/opengl/wiki/Primitive#Triangle_primitives
*/
private _positions;
constructor(originalGLContext: WebGLRenderingContext, options?: PoolCapacityOptions | undefined);
private get _webglContext();
readFromSource(source: TexImageSource, allowSharedSlot?: boolean): FrameCapture;
setup(): void;
dispose(): void;
private updateCanvasSizeIfNeeded;
private updateFrameSizeIfNeeded;
private initShaderProgram;
private initBuffers;
private initTexture;
}
//#endregion
//#region ../../@shared/wasm-types/src/bridge/coreBridgeTypes.d.ts
interface EmscriptenClassHandle> {
clone: () => Self;
delete: () => void;
isDeleted: () => boolean;
deleteLater: () => void;
isAliasOf: () => Self;
}
interface BatteryData {
percentage: number;
}
declare enum LicensedFeature {
Ocr = 0,
HideLogo = 1,
ShowTestLicenseMessage = 2,
AugmentedReality = 5,
ActivityPingStatsAddon = 8,
ActivityPing = 9,
Registration = 10,
Parser = 11,
BarcodeCapture = 14,
Analytics = 17,
AnalyticsBatchMode = 18,
AnalyticsScanContent = 19,
AnalyticsOnlineVerification = 20,
SparkScan = 21,
AamvaIdBarcodeVerification = 22,
MappingForTracking = 23,
BarcodeFind = 24,
MandatoryRegistration = 25,
FeatureTracking = 26,
IdCaptureViz = 27,
IdCaptureMrz = 28,
IdCaptureBarcode = 29,
BarcodeSelectionAimToScan = 30,
BarcodeSelectionTapToScan = 31,
BarcodeCount = 32,
BarcodePick = 33,
IdVerificationDataComparison = 34,
SmartLabelBarcode = 35,
SmartLabelText = 36,
VoidedIdDetection = 37,
BarcodeArFull = 38,
BarcodeSequence = 39
}
interface DataCaptureContext$1 extends EmscriptenClassHandle {
setCameraProperties: (deviceId: string, isFrontFacing: boolean, hasAutofocus: boolean) => void;
addListener: (function_: unknown) => void;
addFrameListener: (listener: unknown) => void;
dispose: () => void;
setFrameSource: (source: EmscriptenClassHandle) => void;
flushAnalytics: () => void;
isFeatureSupported: (feature: LicensedFeature) => boolean;
}
interface DataCaptureImageBufferFrameSource extends EmscriptenClassHandle {
outputFrame: (address: number, width: number, height: number, format: unknown) => void;
}
interface GestureListener extends EmscriptenClassHandle {
onTap(point: string): void;
}
interface GestureRecognizer extends EmscriptenClassHandle {
setGestureListener(gestureListener: GestureListener, flags: number): void;
}
interface HintPresenterV2 extends EmscriptenClassHandle {
showToast: (toastHint: string) => void;
hideToast: (tag: string) => void;
hideAllToasts: () => void;
showGuidance: (guidanceHint: string) => void;
hideCurrentGuidance: () => void;
update: () => void;
}
interface PlatformHintPresenter extends EmscriptenClassHandle {
setHintPresenter(presenter: HintPresenterV2): void;
showToast(toast: string): void;
hideToast(toast: string): void;
showGuidance(guidanceHint: string): void;
hideGuidance(guidanceHint: string): void;
startUpdateTimer(intervalMs: number): void;
stopUpdateTimer(): void;
}
type OrientationBridgeValue = "landscapeRight" | "portraitUpsideDown" | "landscapeLeft" | "portrait";
interface DataCaptureView extends EmscriptenClassHandle {
setViewSize: (w: number, h: number, orientation: OrientationBridgeValue) => void;
getViewInfo: () => string;
setNeedsRedrawDelegate: (delegate: unknown) => void;
draw: () => void;
getDrawCommands: () => Uint8Array;
isViewRefreshHandlerSet: boolean;
hintPresenterInitialized: () => boolean;
setHintPresenter: (hintPresenter: unknown) => void;
setHintPresenterV2: (hintPresenterV2: HintPresenterV2) => void;
setGestureRecognizer: (recognizer: GestureRecognizer) => void;
isDisplayingViewfinder: () => boolean;
getViewfinderRect: () => string;
addOverlay: (overlay: EmscriptenClassHandle) => void;
removeOverlay: (overlay: EmscriptenClassHandle) => void;
}
interface JSONParseable extends EmscriptenClassHandle {
toJson: () => string;
}
interface DataCaptureContextDeserializerResult extends EmscriptenClassHandle {
getContext: () => DataCaptureContext$1;
getView: () => DataCaptureView | undefined;
}
interface DataCaptureContextDeserializer extends EmscriptenClassHandle {
contextFromJson: (json: string) => DataCaptureContextDeserializerResult | null;
updateContextFromJson: (context: DataCaptureContext$1, view: DataCaptureView | undefined, json: string) => DataCaptureContextDeserializerResult | null;
getLastError: () => string;
}
interface CaptureModeDeserializerInstance extends EmscriptenClassHandle {
setListener: (listener: unknown) => void;
}
interface DeviceInterfaceInstance extends EmscriptenClassHandle {
getBatteryData(): BatteryData | undefined;
isTablet(): boolean;
}
interface WasmFrameData extends EmscriptenClassHandle {
getFrameData: () => Uint8Array;
getWidth: () => number;
getHeight: () => number;
getMirrorAxis: () => {
value: number;
};
getOrientation: () => number;
}
interface WasmFeedback extends EmscriptenClassHandle {
emit: () => void;
}
interface EmscriptenDataCaptureOverlay extends EmscriptenClassHandle {}
//#endregion
//#region ../../@shared/wasm-types/src/bridge/hintTypes.d.ts
declare enum HintFont {
Body = "body",
Footnote = "footnote"
}
declare enum HintTextAlignment {
Start = "start",
Center = "center",
End = "end"
}
declare enum HintWidth {
Normal = "normal",
Wider = "wider",
FitText = "fitText"
}
declare enum HintHeight {
Normal = "normal",
Taller = "taller"
}
declare enum HintCornerStyle {
Square = "square",
Rounded = "rounded"
}
declare enum HintIcon {
None = "none",
Check = "check",
ExclamationMark = "exclamationMark"
}
declare enum HintAnchor {
Top = "top",
Center = "center",
AboveViewFinder = "aboveViewFinder",
BelowViewFinder = "belowViewFinder"
}
interface HintStyle {
textColor: string;
textAlignment: HintTextAlignment;
backgroundColor: string;
hintIcon: HintIcon;
isAnimatedToView: boolean;
hintAnchor: HintAnchor;
hintAnchorOffset: number;
horizontalMargin: number;
maxWidthFraction: number;
textSize: number;
textWeight: number;
lineHeight: number;
iconColor: string;
maxLines: number;
cornerRadius: number;
fitToText: boolean;
}
declare enum GuidanceHintAnchor {
AboveViewFinder = "aboveViewFinder",
BelowViewFinder = "belowViewFinder"
}
declare enum GuidanceHintStyle {
BlackOnWhite = "blackOnWhite",
WhiteOnBlack = "whiteOnBlack",
Transparent = "transparent"
}
interface GuidanceHint {
text: string;
guidanceHintStyle: GuidanceHintStyle;
guidanceHintAnchor: GuidanceHintAnchor;
hintStyle?: HintStyle;
moveCloserAnimation?: boolean;
}
declare enum ToastHintStyle {
Success = "success",
Error = "error",
Warning = "warning",
Info = "info",
Notification = "notification"
}
interface ToastHint {
text: string;
tag: string;
toastHintStyle: ToastHintStyle;
hintStyle?: HintStyle;
}
interface GenericHint {
text: string;
tag?: string;
hintStyle: Omit;
}
//#endregion
//#region ../../@shared/wasm-types/src/bridge/coreModule.d.ts
interface Vector {
push_back: (element: unknown) => void;
get: (index: number) => T;
size: () => number;
}
interface ModuleMirrorAxis {
None: unknown;
X: unknown;
Y: unknown;
}
interface CoreModule extends EmscriptenModule {
ImageConverter: ImageConverter_statics;
ImageConverterInstance: ImageConverterInstance;
callMain: () => void;
canvas: OffscreenCanvas | undefined;
__emscripten_proxy_main?: Record;
mainScriptUrlOrBlob: string | Blob;
DataCaptureContextDeserializer: new (fsFolderPath: string, deviceId: string, deviceModel: string, domain: string, parentDomain: string, modeDeserializer: Vector, highEndBlurryRecognition: boolean, resourcePath: string) => DataCaptureContextDeserializer;
DataCaptureContextListener: {
extend: (target: "DataCaptureContextListener", parameters: {
didChangeStatus: (context: DataCaptureContext$1, contextStatus: {
toJson: () => string;
}) => void;
didStartObservingContext: (context: DataCaptureContext$1) => void;
didStopObservingContext: (context: DataCaptureContext$1) => void;
}) => new () => EmscriptenClassHandle;
};
DataCaptureContextFrameListener: {
extend: (target: "DataCaptureContextFrameListener", parameters: {
onObservationStarted: (context: DataCaptureContext$1) => void;
onObservationStopped: (context: DataCaptureContext$1) => void;
onFrameProcessingStarted: (context: DataCaptureContext$1, frameData: WasmFrameData) => void;
onFrameProcessingFinished: (context: DataCaptureContext$1, frameData: WasmFrameData) => void;
onFrameSkipped: (context: DataCaptureContext$1, frameData: WasmFrameData) => void;
}) => new () => EmscriptenClassHandle;
};
HintPresenter: {
extend: (target: "HintPresenter", parameters: {
showHint: (hint: string, style: string) => void;
updateHint: (style: string) => void;
hideHint: () => void;
}) => new () => EmscriptenClassHandle;
};
PlatformHintPresenter: {
extend: (target: "PlatformHintPresenter", parameters: {
setHintPresenter(presenter: HintPresenterV2): void;
showToast(toastHint: string): void;
hideToast(toastHint: string): void;
showGuidance(guidanceHint: string): void;
hideGuidance(guidanceHint: string): void;
startUpdateTimer(intervalMs: number): void;
stopUpdateTimer(): void;
}) => new () => PlatformHintPresenter;
};
HintPresenterV2: new (platformHintPresenter: PlatformHintPresenter) => HintPresenterV2;
ImageBufferFrameSource: new (mirroredAxis: unknown, isCameraFrameSource: boolean, orientation?: number) => DataCaptureImageBufferFrameSource;
ImageBufferFormat: {
Grayscale8: unknown;
Rgb888: unknown;
Rgba8888: unknown;
};
Axis: ModuleMirrorAxis;
NeedsRedrawDelegate: {
extend: (target: "NeedsRedrawDelegate", parameters: {
setNeedsRedrawIn: (inMs: number) => void;
}) => new () => EmscriptenClassHandle;
};
GestureRecognizer: {
extend: (target: "GestureRecognizer", parameters: {
setGestureListener(gestureListener: GestureListener, flags: number): void;
}) => new () => GestureRecognizer;
};
VectorDataCaptureModeDeserializer: new () => Vector;
allocateUint8Array: (length: number) => number;
deleteUint8Array: (address: number) => void;
DataDecoding: {
extend: (target: "DataDecoding", options: {
decode: (rawData: ArrayBuffer, encodingRanges: string) => string;
}) => new () => EmscriptenClassHandle;
};
setDataDecoding: (decoder: unknown) => void;
BatteryData: new (percentage: number) => BatteryData;
DeviceInterface: {
extend: (target: "DeviceInterface", methods: {
getBatteryData: () => BatteryData | undefined;
isTablet: () => boolean;
}) => new () => DeviceInterfaceInstance;
};
DeviceHolder: {
setCurrentDevice: (device: DeviceInterfaceInstance) => void;
};
LicenseUtils: {
getBlinkIdLicenseKey: (scanditLicense: string) => string;
};
Feedback: {
extend: (target: "Feedback", parameters: {
emit: () => void;
}) => new () => WasmFeedback;
};
dispose: () => void;
LicenseFeature: LicensedFeature;
addBarcodeFindToContext: (context: DataCaptureContext$1, mode: EmscriptenClassHandle) => void;
removeBarcodeFindFromContext: (context: DataCaptureContext$1, mode: EmscriptenClassHandle) => void;
addBarcodeFindBasicOverlayToView: (view: DataCaptureView, overlay: EmscriptenClassHandle) => void;
removeBarcodeFindBasicOverlayFromView: (view: DataCaptureView, overlay: EmscriptenClassHandle) => void;
addBarcodeArToContext: (context: DataCaptureContext$1, mode: EmscriptenClassHandle) => void;
removeBarcodeArFromContext: (context: DataCaptureContext$1, mode: EmscriptenClassHandle) => void;
OpenSourceSoftwareLicenseInfo: {
getLicenseText(): string;
};
InsufficientMultithreadingAnalyticsData: new (mode: string) => EmscriptenClassHandle;
InsufficientMultithreadingAnalyticsHelper: {
storeAnalyticsEvent: (context: DataCaptureContext$1, data: EmscriptenClassHandle) => void;
};
}
//#endregion
//#region src/main/worker/dataCaptureWorkerRelated.d.ts
/**
* MESSAGES (ACTIONS) SENT TO THE WORKER
*/
type DataCaptureActionMessageKey = "convertToJPEGResult" | "createContext" | "deleteFrameData" | "dispose" | "documentVisibility" | "extractCentaurusLicense" | "flushAnalytics" | "isFeatureSupported" | "loadLibrary" | "negotiateSharedFramePath" | "onTap" | "processFrame" | "processFrameFromMemAddressSlot" | "reportCameraProperties" | "requestFrameData" | "setFrameSource" | "setLogLevel" | "updateBatteryInfo" | "updateContext" | "hintPresenterV2update" | "getViewfinderInfo" | "getOpenSourceSoftwareLicenseInfo" | "addNativeOverlay" | "removeNativeOverlay";
interface ExtractCentaurusLicenseResponse {
centaurus: {
licenseKey: string;
};
}
type RequestFrameDataResponse = {
data: Uint8ClampedArray;
colorType: ColorType;
frameId: FrameId;
} | {
data: null;
colorType: null;
frameId: null;
};
interface IsFeatureSupportedResponse {
supported: boolean;
}
interface GetViewfinderInfoResponse {
isDisplayingViewfinder: boolean;
rect: RectJSON;
}
interface GetOpenSourceSoftwareLicenseInfoResponse {
licenseText: string;
}
type WorkerResponse = C extends "processFrame" ? ProcessFrameParameters : C extends "extractCentaurusLicense" ? ExtractCentaurusLicenseResponse : C extends "requestFrameData" ? RequestFrameDataResponse : C extends "isFeatureSupported" ? IsFeatureSupportedResponse : C extends "getViewfinderInfo" ? GetViewfinderInfoResponse : C extends "getOpenSourceSoftwareLicenseInfo" ? GetOpenSourceSoftwareLicenseInfoResponse : C extends "negotiateSharedFramePath" ? SharedFrameMemAddressSlotPoolBuffers | null : undefined;
interface DataCaptureActionMessage {
command: DataCaptureActionMessageKey;
id: number;
}
type LoadLibraryDataCaptureAction = DataCaptureActionMessage & LoadLibraryParameters & {
command: "loadLibrary";
};
type ConvertToJPEGResultDataCaptureAction = DataCaptureActionMessage & {
command: "convertToJPEGResult";
imageId: number;
result: Uint8Array;
};
type CreateContextDataCaptureAction = CreateContextParameters & DataCaptureActionMessage & {
command: "createContext";
};
type SetFrameSourceDataCaptureAction = DataCaptureActionMessage & SetFrameSourceParameters & {
command: "setFrameSource";
};
type ProcessFrameDataCaptureAction = DataCaptureActionMessage & ProcessFrameParameters & {
command: "processFrame";
};
type NegotiateSharedFramePathDataCaptureAction = DataCaptureActionMessage & NegotiateSharedFramePathParameters & {
command: "negotiateSharedFramePath";
};
type ProcessFrameFromMemAddressSlotDataCaptureAction = DataCaptureActionMessage & ProcessFrameFromMemAddressSlotParameters & {
command: "processFrameFromMemAddressSlot";
};
type RequestFrameDataDataCaptureAction = DataCaptureActionMessage & {
command: "requestFrameData";
frameId: FrameId;
};
type DeleteFrameDataDataCaptureAction = DataCaptureActionMessage & {
command: "deleteFrameData";
frameId: FrameId;
};
type VisibilityChangeAction = DataCaptureActionMessage & {
command: "documentVisibility";
state: DocumentVisibilityState;
};
type IsFeatureSupportedAction = DataCaptureActionMessage & {
command: "isFeatureSupported";
feature: LicensedFeature;
};
type UpdateContextDataCaptureAction = DataCaptureActionMessage & {
command: "updateContext";
context: DataCaptureContextJSON;
view: UpdateContextParameters["view"];
};
type DisposeDataCaptureAction = DataCaptureActionMessage & {
command: "dispose";
};
type FlushAnalyticsDataCaptureAction = DataCaptureActionMessage & {
command: "flushAnalytics";
};
type ReportCameraPropertiesDataCaptureAction = DataCaptureActionMessage & ReportCameraPropertiesParameters & {
command: "reportCameraProperties";
};
type SetLogLevelDataCaptureAction = DataCaptureActionMessage & {
command: "setLogLevel";
level: Logger.Level;
};
type UpdateBatteryInfoDataCaptureAction = DataCaptureActionMessage & {
command: "updateBatteryInfo";
batteryInfo: BatteryInfo;
};
type ExtractCentaurusLicenseDataCaptureAction = DataCaptureActionMessage & {
command: "extractCentaurusLicense";
licenseKey: string;
};
type OnTapAction = DataCaptureActionMessage & {
command: "onTap";
point: PointJSON;
};
type HintPresenterV2updateAction = DataCaptureActionMessage & {
command: "hintPresenterV2update";
};
type GetViewfinderInfoAction = DataCaptureActionMessage & {
command: "getViewfinderInfo";
};
type GetOpenSourceSoftwareLicenseInfoAction = DataCaptureActionMessage & {
command: "getOpenSourceSoftwareLicenseInfo";
};
type AddNativeOverlayAction = DataCaptureActionMessage & {
command: "addNativeOverlay";
overlayHandle: {
className: string;
id: number;
};
};
type RemoveNativeOverlayAction = DataCaptureActionMessage & {
command: "removeNativeOverlay";
overlayHandle: {
className: string;
id: number;
};
};
type AnyDataCaptureActionMessage = ConvertToJPEGResultDataCaptureAction | CreateContextDataCaptureAction | DeleteFrameDataDataCaptureAction | DisposeDataCaptureAction | ExtractCentaurusLicenseDataCaptureAction | FlushAnalyticsDataCaptureAction | IsFeatureSupportedAction | LoadLibraryDataCaptureAction | NegotiateSharedFramePathDataCaptureAction | OnTapAction | ProcessFrameDataCaptureAction | ProcessFrameFromMemAddressSlotDataCaptureAction | ReportCameraPropertiesDataCaptureAction | RequestFrameDataDataCaptureAction | SetFrameSourceDataCaptureAction | SetLogLevelDataCaptureAction | UpdateBatteryInfoDataCaptureAction | UpdateContextDataCaptureAction | VisibilityChangeAction | HintPresenterV2updateAction | GetViewfinderInfoAction | GetOpenSourceSoftwareLicenseInfoAction | AddNativeOverlayAction | RemoveNativeOverlayAction;
/**
* MESSAGES EMITTED BY THE WORKER
*/
type DataCaptureCallbackMessageKeys = "contextDidChangeStatus" | "didStartObservingContext" | "draw" | "hideHint" | "isFeatureSupported" | "loadLibraryProgress" | "performanceMetricsReport" | "showHint" | "successFeedback" | "updateHint" | "workerTaskId" | "onFrameProcessingStarted" | "onFrameProcessingFinished" | "onFrameSkipped" | "showToast" | "hideToast" | "showGuidance" | "hideGuidance" | "startUpdateTimer" | "stopUpdateTimer" | "setViewfinderRect" | "viewSizeChanged";
interface BaseDataCaptureCallbackMessage {
type: DataCaptureCallbackMessageKeys;
}
interface LoadLibraryProgressMessage {
type: "loadLibraryProgress";
payload: ProgressInfo;
}
interface ConsoleWorkerMessage {
type: "console";
payload: string;
}
interface ConvertToJPEGMessage {
type: "convertToJPEG";
imageId: number;
width: number;
height: number;
data: Uint8Array;
planes: ImagePlane[];
orientation: number;
quality: number;
}
interface WorkerTaskIdWorkerMessage extends BaseDataCaptureCallbackMessage {
type: "workerTaskId";
command: string;
id: number;
error?: unknown;
payload?: unknown;
}
type DrawWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "draw";
payload: Uint8Array;
};
type DidChangeStatusWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "contextDidChangeStatus";
payload: ContextStatusJSON;
};
type StartObservingContextWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "didStartObservingContext";
};
type SuccessFeedbackWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "successFeedback";
};
type ShowHintWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "showHint";
payload: {
text: string;
style: HintStyle;
};
};
type UpdateHintWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "updateHint";
payload: {
style: HintStyle;
};
};
type IsFeatureSupportedMessage = BaseDataCaptureCallbackMessage & {
type: "isFeatureSupported";
payload: { [key in LicensedFeature]: boolean; };
};
type HideHintWorkerMessage = BaseDataCaptureCallbackMessage & {
type: "hideHint";
payload: Record;
};
type PerformanceMetricsReportMessage = BaseDataCaptureCallbackMessage & {
type: "performanceMetricsReport";
payload: PerformanceMetrics;
};
type DidTapTrackedBarcode = BaseDataCaptureCallbackMessage & {
type: "didTapTrackedBarcode";
payload: any;
};
type OnFrameProcessingStartedMessage = BaseDataCaptureCallbackMessage & {
type: "onFrameProcessingStarted";
};
type OnFrameProcessingFinishedMessage = BaseDataCaptureCallbackMessage & {
type: "onFrameProcessingFinished";
};
type OnFrameSkippedMessage = BaseDataCaptureCallbackMessage & {
type: "onFrameSkipped";
};
type ShowToastMessage = BaseDataCaptureCallbackMessage & {
type: "showToast";
payload: GenericHint;
};
type HideToastMessage = BaseDataCaptureCallbackMessage & {
type: "hideToast";
payload: GenericHint;
};
type ShowGuidanceMessage = BaseDataCaptureCallbackMessage & {
type: "showGuidance";
payload: GenericHint;
};
type HideGuidanceMessage = BaseDataCaptureCallbackMessage & {
type: "hideGuidance";
payload: GenericHint;
};
type StartUpdateTimerMessage = BaseDataCaptureCallbackMessage & {
type: "startUpdateTimer";
payload: {
duration: {
unit: "ms";
value: number;
};
};
};
type StopUpdateTimerMessage = BaseDataCaptureCallbackMessage & {
type: "stopUpdateTimer";
};
interface ViewInfo {
width: number;
height: number;
orientation: T;
viewFinderRect: RectJSON;
}
type ViewSizeChangedMessage = BaseDataCaptureCallbackMessage & {
type: "viewSizeChanged";
payload: ViewInfo | null;
};
type DataCaptureCallbackMessage = ConsoleWorkerMessage | ConvertToJPEGMessage | DidChangeStatusWorkerMessage | DrawWorkerMessage | HideHintWorkerMessage | IsFeatureSupportedMessage | LoadLibraryProgressMessage | PerformanceMetricsReportMessage | ShowHintWorkerMessage | StartObservingContextWorkerMessage | SuccessFeedbackWorkerMessage | UpdateHintWorkerMessage | WorkerTaskIdWorkerMessage | OnFrameProcessingStartedMessage | OnFrameProcessingFinishedMessage | OnFrameSkippedMessage | ShowToastMessage | HideToastMessage | ShowGuidanceMessage | HideGuidanceMessage | StartUpdateTimerMessage | StopUpdateTimerMessage | ViewSizeChangedMessage;
/**
* OTHERS
*/
type PayloadForCommand = A extends {
command: C;
} ? A : never;
interface DataCaptureWorker extends Omit {
onmessage: ((this: Worker, event_: MessageEvent & {
data: unknown;
}) => void) | null;
postMessage: (message: PayloadForCommand, transfer?: Transferable[]) => void;
}
interface PerformanceMetrics {
cameraOutputFrames: number;
redrawRequestsCount: number;
actualRedrawsCount: number;
frameDataPoolSize: number;
frameProcessingStartedCount: number;
frameProcessedCount: number;
frameSkippedCount: number;
/**
* Cumulative wall time (microseconds) spent in the worker-side frame hand-off path (from message
* receipt to outputFrame() completing) this reporting interval, for both processFrame (classic,
* includes the HEAPU8.set memcpy) and processFrameFromMemAddressSlot (zero-copy fast path, no
* memcpy) — same measurement point on both paths, so frameHandoffTotalMicros / frameHandoffCount is
* directly comparable regardless of which path is active.
*/
frameHandoffTotalMicros: number;
/** Count of frames included in frameHandoffTotalMicros this interval. */
frameHandoffCount: number;
}
type AugmentedWorker = Worker & {
Module: M;
OffscreenCanvas: new (w: number, h: number) => OffscreenCanvas;
};
type EngineWorkerResponse = WorkerResponse extends Promise | void ? Promise | void : {
payload: WorkerResponse;
transferables?: Transferable[];
};
interface ModuleHandler {
get: () => M;
set: (v: M) => void;
}
//#endregion
//#region src/main/worker/dataCaptureEngine.d.ts
type TrackingModeName = "BarcodeAr" | "BarcodeBatch" | "BarcodeFind" | "SparkScan" | "LabelCapture";
interface LoadLibraryParameters {
libraryLocation: string;
locationPath: string;
writableDataPathOverride?: string;
indexedDBTimeoutMs: number;
verifyResponseHash: boolean;
onProgress?: (info: ProgressInfo) => void;
referredOrigin?: string;
fixedWasmMemory: number | null;
simdSupport: boolean;
threadsSupport: boolean;
}
interface CreateContextParameters {
context: DataCaptureContextJSON;
deviceId: string;
highEndBlurryRecognition: boolean;
appName: string | null;
parentDomain: string;
isTablet: boolean;
batteryInfo: BatteryInfo;
}
interface UpdateContextParameters {
context: DataCaptureContextJSON;
view: {
width: number;
height: number;
visible: boolean;
orientation: Orientation;
} | null;
}
interface SetFrameSourceParameters {
mirrorAxis: PrivateMirrorAxis;
isCameraFrameSource: boolean;
}
type ProcessFrameParameters = FrameCapture;
interface NegotiateSharedFramePathParameters {
memAddressSlotByteLength: number;
memAddressSlotCount: number;
}
interface ProcessFrameFromMemAddressSlotParameters {
memAddressSlotIndex: number;
width: number;
height: number;
colorType: ColorType;
frameId: FrameId;
}
interface ReportCameraPropertiesParameters {
deviceId: string;
hasAutofocus: boolean;
isFrontFacing: boolean;
}
interface WorkerFunctions {
getOffscreenCanvas: () => OffscreenCanvas | undefined;
postMessage: (message: DataCaptureCallbackMessage, transfer?: Transferable[]) => void;
}
/**
* DataCaptureEngine is an abstraction of the engine, it is created by the engine worker
* and should be used as a singleton. It calls the underlying engine methods directly.
*/
declare class DataCaptureEngine {
private static get3dPartyLicenseKeyMethodName;
context: DataCaptureContext$1;
lastUsedModuleMirrorAxis: unknown;
view: DataCaptureView | undefined;
hintPresenterV2: HintPresenterV2 | null;
protected threadsSupport: boolean;
private insufficientMultithreadingReported;
/**
* Maximum number of frames to keep in the pool.
* Set to 5 to balance between:
* - Providing sufficient buffering for frame listener callbacks that may arrive slightly out-of-order
* - Minimizing memory overhead in the worker thread
* - At 30 fps, 5 frames = ~167ms of retention, sufficient for most listener callbacks
* - For higher frame rates, FIFO eviction prevents unbounded growth
*/
protected readonly MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL: number;
protected readonly moduleHandler: ModuleHandler;
protected readonly redrawInterval: number;
protected readonly redrawRequests: number[];
protected readonly workerFunctions: WorkerFunctions;
protected _isDrawLoopRunning: boolean;
protected contextDeserializer: DataCaptureContextDeserializer | undefined;
/**
* Frame data pool that stores copies of frame data for access by listeners.
* Frame data is stored with frameId as key, typically using performance.now() for high-precision timing.
*
* Frame ID Generation & Management:
* - frameId comes from camera frame sources (typically performance.now() in milliseconds with decimal precision)
* - Frames are stored in insertion order (Map preserves insertion order in JavaScript)
* - Memory is managed through two complementary mechanisms:
* 1. Bounded pool size (MAX_NUMBER_OF_IMAGES_IN_FRAME_DATA_POOL) with FIFO eviction of oldest frames
* 2. Immediate deletion after transfer via requestFrameData() to give callers control over lifetime
* - For the deleteFrameData() API, frames marked for deletion are cleaned up on next prepareFrameForListener call
* - This combination prevents both unbounded memory growth and memory leaks from unrequested frames
*/
protected frameDataPool: Map;
protected lastFrameColorType: ColorType;
protected lastFrameId: FrameId | null;
protected imageFrameSource?: DataCaptureImageBufferFrameSource;
protected libraryLoadingPromise: Promise | undefined;
protected loopTimeoutId?: ReturnType;
protected resourcePath: string;
protected writableDataPath: string;
protected poorMansBenchmarkLogs: boolean;
protected parentDomain: string;
protected readonly writableDataPathStandard: string;
protected readonly resourceFilesSubfolder: string;
protected performanceMetricsReporterTimer: ReturnType | number | undefined;
protected lastMetricsReportTime: number;
protected readonly metricsReportInterval: number;
protected performanceMetrics: PerformanceMetrics;
protected frameProcessingStartedCount: number;
protected frameProcessingFinishedCount: number;
protected gestureRecognizer: GestureRecognizer | null;
private gestureListener;
private webPlatformHintPresenter;
private deviceInstance;
private deviceInfo;
private webImageConverterInstance;
private sharedFrameMemAddressSlotPool;
private lastViewInfo;
constructor(moduleHandler: ModuleHandler, workerFunctions: WorkerFunctions);
get Module(): M;
set isDrawLoopRunning(newValue: boolean);
get isDrawLoopRunning(): boolean;
/**
* Prepares frame data for listener callbacks by pooling it and cleaning up marked frames.
* Called on session update for tracking modes and on didScan for scan modes.
* @param frameData - The frame data to prepare for listener access.
* @returns The loadable frame data metadata.
*/
prepareFrameForListener(frameData: WasmFrameData): PrivateLoadableFrameData;
createContext(createContextJSON: CreateContextParameters): EngineWorkerResponse<"createContext">;
convertToJPEGResult(imageId: number, result: Uint8Array): void;
/**
* Returns the ImageConverterInstance to be used in the worker thread. Depending on the availability of
* OffscreenCanvas, a different implementation is returned.
*/
protected getImageConverterInstance(options: {
quality: number;
}): ImageConverterInstance;
onTap(point: PointJSON): void;
hintPresenterV2Update(): void;
private lastFrameProcessingStartedCount;
private lastFrameProcessingFinishedCount;
startReportingPerformanceMetrics(): void;
private scheduleMetricsReporting;
private checkAndReportMetrics;
reportPerformanceMetrics(): Promise;
deleteFrameData(frameId: FrameId): void;
dispose(): EngineWorkerResponse<"dispose">;
private cleanupMetricsReporting;
flushAnalytics(): void;
/**
* Reports a "web-insufficient-multithreading" debug analytics event the first time a tracking
* mode is used while the browser lacks multithreading support (missing CrossOriginIsolated,
* SharedArrayBuffer, or worker thread support). Deduped once per DataCaptureContext instance.
*/
reportInsufficientMultithreadingIfNeeded(mode: TrackingModeName): void;
extractCentaurusLicense(scanditLicenseKey: string): EngineWorkerResponse<"extractCentaurusLicense">;
getModeDeserializers(): Vector;
loadLibrary(parameters: LoadLibraryParameters): EngineWorkerResponse<"loadLibrary">;
processFrame(parameters: ProcessFrameParameters): EngineWorkerResponse<"processFrame">;
/**
* Sets up (or replaces) the shared-heap frame memAddressSlot pool used by the zero-copy fast path: the main
* thread writes pixel data directly into a memAddressSlot's WASM-heap memory instead of transferring a
* buffer for this worker to `HEAPU8.set`-copy. Returns null when the loaded Module's heap isn't a
* `SharedArrayBuffer` (a non-threads build) — the fast path is unavailable and the caller must fall
* back to the transfer-based `processFrame` path.
*/
negotiateSharedFramePath(parameters: NegotiateSharedFramePathParameters): EngineWorkerResponse<"negotiateSharedFramePath">;
/**
* The zero-copy counterpart of `processFrame`: the pixel data for `memAddressSlotIndex` was already written
* directly into the shared WASM heap by the main thread (see `negotiateSharedFramePath`), so there's
* no buffer to copy in here. The memAddressSlot's address is retired the instant it's handed to `outputFrame`
* (engine takes ownership and frees it on its own schedule) and immediately replaced so the memAddressSlot can
* be claimed again — see `SharedFrameMemAddressSlotPool`'s class doc for why addresses are never reused.
*/
processFrameFromMemAddressSlot(parameters: ProcessFrameFromMemAddressSlotParameters): EngineWorkerResponse<"processFrameFromMemAddressSlot">;
reportCameraProperties(properties: ReportCameraPropertiesParameters): EngineWorkerResponse<"reportCameraProperties">;
/**
* Request frame data from the pool.
* Converts grayscale to RGBA in the worker if needed.
* Frames are immediately deleted after transfer to prevent memory accumulation.
* @param frameId - The ID of the frame to retrieve.
* @returns The frame data, with the frame deleted from the pool immediately after.
*/
requestFrameData(frameId: FrameId): EngineWorkerResponse<"requestFrameData">;
scheduleRedraw(view: DataCaptureView, redrawInMs: number): void;
sendViewRefreshCommands(commands: Uint8Array): void;
setFrameSource(mirrorAxis: PrivateMirrorAxis, isCameraFrameSource: boolean): EngineWorkerResponse<"setFrameSource">;
/**
* The draw loop check at regular interval if any redraw request were made by the engine.
* If a redraw is necessary, it gathers and sends drawing commands to the main thread.
*/
startDrawLoop(view: DataCaptureView): void;
updateContext(contextUpdateParameters: UpdateContextParameters): EngineWorkerResponse<"updateContext">;
notifyMainThreadOnViewInfoChanged(view?: DataCaptureView): void;
protected getViewInfo(view?: DataCaptureView | null): ViewInfo | null;
protected getOrientationFromNumber(orientation: number): Orientation;
/**
* Called before updateContextFromJson
*
* @protected
* @param {UpdateContextParameters} contextUpdateParameters
* @returns {UpdateContextParameters}
*/
protected onBeforeUpdateContextHook(contextUpdateParameters: UpdateContextParameters): UpdateContextParameters;
onDocumentVisibilityChange(state: DocumentVisibilityState): void;
isFeatureSupported(feature: LicensedFeature): EngineWorkerResponse<"isFeatureSupported">;
getViewfinderInfo(): EngineWorkerResponse<"getViewfinderInfo">;
getOpenSourceSoftwareLicenseInfo(): EngineWorkerResponse<"getOpenSourceSoftwareLicenseInfo">;
protected getWasmDynamicLibraries(coreWasmURI: string): string[];
protected getWasmCoreExpectedHash(simdSupport: boolean, threadsSupport: boolean): string;
protected getWasmCoreFileName(simdSupport: boolean, threadsSupport: boolean): string;
protected getWasmMetadata(): Record;
protected getWasmSideModuleFileName(): string;
private _loadProgressCallback;
/**
* Redraw requests are scheduled at [now + redrawInMs], so when pushed they must be sorted
* in chronological order so that we can later easily check if we need to redraw by checking
* the first element.
* @param redrawInMs
*/
private addRedrawRequest;
private contextDidChangeStatus;
private didStartObservingContext;
private mapMirrorAxisOnModule;
protected setView(view: DataCaptureView | undefined): void;
/**
* Add a native overlay to the view without passing from the deserializer.
* must be implemented in the specific module.
* @param event - The message event containing the overlay handle.
*/
addNativeOverlay(event: MessageEvent): void;
/**
* Remove a native overlay from the view.
* must be implemented in the specific module.
* @param event - The message event containing the overlay handle.
*/
removeNativeOverlay(event: MessageEvent): void;
private setViewRefreshHandler;
private setupDataDecoding;
private getBatteryData;
private isTablet;
private setupDeviceInterface;
updateBatteryInfo(batteryInfo: BatteryInfo): void;
private start;
private getWritableDataPath;
private numOfMBToPages;
private setup;
}
//#endregion
//#region src/main/private/CameraManager.d.ts
declare enum MeteringMode {
CONTINUOUS = "continuous",
MANUAL = "manual",
NONE = "none",
SINGLE_SHOT = "single-shot"
}
declare enum CameraResolutionConstraint {
ULTRA_HD = 0,
FULL_HD = 1,
HD = 2,
SD = 3,
NONE = 4
}
interface ExtendedMediaTrackCapabilities extends MediaTrackCapabilities {
exposureCompensation?: DoubleRange;
exposureMode?: MeteringMode[];
exposureTime?: DoubleRange;
focusDistance?: DoubleRange;
focusMode?: MeteringMode[];
torch?: boolean;
zoom?: DoubleRange;
}
interface ExtendedMediaTrackConstraintSet extends MediaTrackConstraintSet {
exposureCompensation?: ConstrainDouble | number;
exposureMode?: MeteringMode;
exposureTime?: ConstrainDouble | number;
focusDistance?: ConstrainDouble | number;
focusMode?: MeteringMode;
torch?: boolean;
zoom?: ConstrainDouble | number;
}
interface GUI {
isCameraRecoveryVisible: () => boolean;
setCameraRecoveryVisible: (visible: boolean) => void;
}
/**
* Branded type for frame IDs to improve type safety.
*
* Frame IDs are high-resolution timestamps generated via performance.now() using getTimestamp().
* Using a branded type prevents accidental mixing with other numeric IDs and
* makes the intent of numeric values explicit in type signatures.
*
* Example:
* ```typescript
* // ✓ Correct: explicitly marked as a frame ID
* const frameId: FrameId = getTimestamp() as FrameId;
*
* // ✗ TypeScript error: number is not assignable to FrameId
* const wrongId: FrameId = 12345;
* ```
*
* Benefits:
* - Prevents confusion between frame IDs and other numeric identifiers
* - Makes it immediately clear in function signatures that a value is a frame ID
* - Compiler catches accidental type mismatches at compile time
*/
declare const FrameIdBrand: unique symbol;
type FrameId = number & {
readonly [FrameIdBrand]: "FrameId";
};
/**
* Creates a branded FrameId using the current high-resolution timestamp.
* @returns A branded FrameId value
*/
declare function createFrameId(): FrameId;
interface FrameCapture {
colorType?: ColorType;
data: Uint8ClampedArray;
frameId: FrameId;
height: number;
width: number;
/**
* Set when `data` was written directly into a shared-heap memAddressSlot (the zero-copy SharedArrayBuffer
* fast path) rather than popped from a reader's own buffer pool. Callers must not recycle `data`
* into a `WatermarkStack`-based pool when this is set — the memAddressSlot has its own lifecycle, released by
* the worker once it's done with it.
*/
memAddressSlotIndex?: number;
/**
* The pool `memAddressSlotIndex` was claimed from. A capture that claims a memAddressSlot but never
* reaches `sendFrameToSDC`/`markReady` (discarded, skipped by a frame handler, an exception) must call
* `memAddressSlotPool.abandon(memAddressSlotIndex)` to release it - otherwise it's stranded forever.
* Also lets `sendFrameToSDC` detect a stale claim (a renegotiation replaced the pool while this
* capture was in flight) via referential comparison against the current pool.
*/
memAddressSlotPool?: SharedFrameMemAddressSlotPool;
}
declare enum CameraManagerEvent {
CAMERA_PROPERTIES = "cameraProperties",
CAMERA_ACCESS_ERROR = "cameraAccessError"
}
type CameraManagerEventParameters = C extends CameraManagerEvent.CAMERA_PROPERTIES ? ReportCameraPropertiesParameters : C extends CameraManagerEvent.CAMERA_ACCESS_ERROR ? any : never;
/**
* A barcode picker utility class used to handle camera interaction.
*/
declare class CameraManager {
private static readonly autofocusIntervalMs;
private static readonly cameraAccessTimeoutMs;
private static readonly getCapabilitiesTimeoutMs;
private static readonly manualFocusWaitTimeoutMs;
private static readonly manualToAutofocusResumeTimeoutMs;
private static readonly noCameraErrorParameters;
private static readonly notReadableErrorParameters;
private static readonly videoMetadataCheckIntervalMs;
private static readonly videoMetadataCheckTimeoutMs;
private static MIRRORED_CLASS_NAME;
private static _instance;
activeCamera?: DeviceCamera;
activeCameraSettings?: CameraSettings;
canvas: HTMLCanvasElement;
gui: GUI;
selectedCamera?: DeviceCamera;
videoElement: HTMLVideoElement;
private constraint;
private clipArea?;
private readonly checkCameraVideoStreamAccessIfVisibleListener;
private readonly handleWebGLContextLostListener;
private readonly listeners;
private readonly mirrorImageOverrides;
private readonly postStreamInitializationListener;
private readonly triggerFatalError;
private readonly triggerManualFocusListener;
private readonly videoResizeListener;
private readonly videoTrackEndedListener;
private readonly videoTrackMuteListener;
private _canvas2dContext;
private _canvasWebGLContext;
private _synchronousFrameHandling;
private _frameReaderOptions;
private _glFrameReaders;
private _frameReaderType;
private _sharedFrameMemAddressSlotAcquirer;
private _mediaStream?;
private abortedCameraInitializationResolveCallback?;
private autofocusInterval;
private cameraAccessRejectCallback?;
private cameraAccessTimeout;
private cameraInitializationPromise?;
private cameraPosition;
private cameraSetupPromise?;
private getCapabilitiesTimeout;
private manualFocusWaitTimeout;
private manualToAutofocusResumeTimeout;
private mediaTrackCapabilities?;
private mediaTrackCapabilitiesPromise?;
private mediaTrackCapabilitiesPromiseResolver?;
private selectedCameraSettings?;
private tapToFocusEnabled;
private torchEnabled;
private torchToggleEnabled;
private videoMetadataCheckInterval;
private isWebGLSupported;
private clippedFrameRequestID?;
private isVideoStreamPaused;
private handleVideoPauseHandler;
constructor();
get mediaStream(): MediaStream | undefined;
set mediaStream(stream: MediaStream | undefined);
get synchronousFrameHandling(): boolean;
private get canvas2dContext();
private get canvasWebGLContext();
static instance(): CameraManager;
dispose(): void;
recycle(pixelsData: Uint8ClampedArray): void;
/** Wires (or clears, passing undefined) the zero-copy fast path onto every frame reader, present and future. */
setSharedFrameMemAddressSlotAcquirer(acquirer: SharedFrameMemAddressSlotAcquirer | undefined): void;
getCurrentFrame(): FrameCapture | undefined;
requestVideoFrame(scheduledFunction: FrameRequestCallback | VideoFrameRequestCallback, videoElement?: HTMLVideoElement): number;
cancelVideoFrame(id: number, videoElement?: HTMLVideoElement): void;
addListener(event: CameraManagerEvent, listener: (details: CameraManagerEventParameters) => void): void;
applyCameraSettings(cameraSettings?: CameraSettings): Promise;
captureImage(): FrameCapture | null;
initializeCameraWithSettings(camera?: DeviceCamera, cameraSettings?: CameraSettings, desiredTorchState?: TorchState): Promise;
isMirrorImageEnabled(): boolean;
isTapToFocusEnabled(): boolean;
isTorchAvailable(): Promise;
playVideo(): Promise;
reinitializeCamera(): Promise;
removeListener(event: CameraManagerEvent, listenerToRemove?: (details: CameraManagerEventParameters) => void): void;
setCameraPosition(cameraPosition: CameraPosition): Promise;
setExposure(exposure: {
compensation?: number;
time?: number;
}): Promise;
setFocus(manualLensPosition: number): Promise;
setFrameRate(frameRate: {
min?: number;
max?: number;
}): Promise;
setInitialCameraPosition(cameraPosition: CameraPosition): void;
setInteractionOptions(torchToggleEnabled: boolean, tapToFocusEnabled: boolean): void;
setMirrorImageEnabled(enabled: boolean, override: boolean): void;
setSelectedCamera(camera?: DeviceCamera): void;
setSelectedCameraSettings(cameraSettings?: CameraSettings): void;
setTapToFocusEnabled(enabled: boolean): void;
setTorchEnabled(enabled: boolean): Promise;
setZoom(zoomFactor: number): Promise;
setupCameras(): Promise;
pauseStream(): void;
resumeStream(): void;
stopStream(cameraInitializationFailure?: boolean): Promise;
stopVideoTracks(): void;
toggleTorch(): Promise;
updateCanvasVideoImage(): void;
waitForCapabilities(): Promise;
setFrameReaderType(type: ColorType): void;
allowPictureInPicture(allow: boolean): Promise;
setFrameHandling(synchronous: boolean): void;
setClipArea(clipArea?: Rect): Promise;
/**
* Converts a rectangle in DataCaptureView coordinates to camera frame coordinates.
*/
private frameRectFromViewRect;
private accessAutoselectedCamera;
private getFrameReaderOptions;
private getFrameReader;
private accessInitialCamera;
/**
* When a context has been created for a canvas, it is not possible to get another one from another type.
* This function re-creates a new canvas based on the existing one.
*/
private recreateCanvas;
private captureImageFor2dContext;
private areVideoAndWebGLSizeMismatching;
private captureImageForWebGLContext;
private checkCameraAccess;
private checkCameraVideoStreamAccessIfVisible;
private checkVideoMetadata;
private disableTapToFocusListeners;
private emit;
private enableTapToFocusListeners;
private getActiveCamera;
private getInitialCameraResolutionConstraint;
private handleCameraInitializationError;
private handleVideoResize;
private handleWebGLContextLost;
private initializeCameraAndCheckUpdatedSettings;
private initializeCameraForResolution;
private initializeStreamForResolution;
/**
* Whether the given camera access error reports the explicit `CameraSettings` `maxFrameRate` hard cap as the
* overconstraining constraint. Only possible when an explicit cap was requested: the default frame rate is sent
* as `ideal` only, which can never overconstrain.
*/
private isFrameRateCapOverconstrained;
private isVideoAndContextStateValid;
private postStreamInitialization;
private recoverStreamIfNeeded;
private reportCameraProperties;
private setCameraAccessTimeout;
private setupAutofocus;
private setupCameraStreamVideo;
private setupCamerasAndStream;
private storeStreamCapabilities;
private triggerAutoFocus;
private triggerFocusMode;
private triggerManualFocus;
private triggerManualFocusForContinuous;
private triggerManualFocusForSingleShot;
private updateActiveCameraCurrentResolution;
private updateStreamForResolution;
private videoTrackEndedRecovery;
private videoTrackMuteRecovery;
private clipMediaStreamIfNeeded;
private drawClippedFrame;
private cleanupClippedStream;
connectedCallback(mountLocation: HTMLElement): void;
disconnectedCallback(): void;
getVideoElement(): HTMLVideoElement;
private handleVideoPause;
}
//#endregion
//#region src/main/FrameData.d.ts
interface FrameData {
readonly width: number;
readonly height: number;
readonly isFrameSourceMirrored: boolean;
toBlob(type?: string, quality?: number): Promise;
getData(): Promise;
}
type PrivateLoadableFrameData = Omit & {
frameId: FrameId;
};
/**
* Adds some function to the passed frame data object to let the user load the frame data.
*/
declare function convertToPublicFrameData(loadableFrameData: PrivateLoadableFrameData, context: DataCaptureContext): FrameData;
//#endregion
//#region src/main/moduleLoader.d.ts
interface ModuleLoader {
moduleName: string;
load(options: ModuleLoaderOptions): Promise;
}
//#endregion
//#region src/main/worker/WorkerMain.d.ts
declare class WorkerMain, M extends CoreModule> {
dataCaptureInstance: E;
onMessageListener: (event: MessageEvent) => boolean;
private readonly workerSelf;
constructor(workerSelf: AugmentedWorker, module: ModuleHandler);
listenToMessages(): void;
postMessage(message: DataCaptureCallbackMessage, transfer?: Transferable[]): void;
getOffscreenCanvas(): OffscreenCanvas | undefined;
isOffscreenCanvasSupported(): boolean;
hasPayload(result: unknown): result is {
payload: unknown;
};
hasTransferables(result: unknown): result is {
transferables: Transferable[];
};
respondWith(command: C, requestId: number, executor: () => EngineWorkerResponse): Promise;
/**
* Messages received from the main thread (actions to undertake)
*/
onMessage(event: MessageEvent): boolean;
}
//#endregion
//#region src/main/worker/dataCaptureLoader.d.ts
type CommandAndPayload = A extends {
command: C;
} ? A : never;
type WorkerCommandPayload = Omit, "command" | "id">;
type WorkerListener = (event: DataCaptureCallbackMessage) => any;
interface DataCaptureLoaderOptions {
libraryLocation: string;
verifyResponseHash: boolean;
loadProgressNotifier?: (info: ProgressInfo) => void;
logLevel?: Logger.Level;
highEndBlurryRecognition?: boolean;
simdSupport: boolean;
threadsSupport: boolean;
}
/**
* The DataCaptureLoader class is used by the main thread, it instantiates the worker
* and sends commands to it. It represents thus the main communication channel
* between the main thread and the engine running in the worker.
*/
declare class DataCaptureLoader {
highEndBlurryRecognition?: boolean;
protected verifyResponseHash: boolean;
protected simdSupport: boolean;
protected threadsSupport: boolean;
protected _dataCaptureWorker?: DataCaptureWorker;
protected readonly libraryLocation: string;
protected readonly logLevel: Logger.Level;
protected workerCommandId: number;
protected readonly workerTasks: Map any;
reject: (...arguments_: any[]) => any;
command: string;
}>;
protected readonly workerListeners: WorkerListener[];
protected workerMessageListener: (event_: MessageEvent) => void;
protected constructor(options: DataCaptureLoaderOptions);
protected addWorkerMessageListener(): void;
get dataCaptureWorker(): DataCaptureWorker;
protected get name(): string;
protected get fixedWasmMemory(): number | null;
static create(options: DataCaptureLoaderOptions): Promise;
/**
* Instantiate the worker for this loader. Each subclass overrides this so its own
* `?worker` bundle is used; the base can't do it because the core package doesn't
* invoke ExternalWorkerPlugin (each capture mode owns its own worker file). This is
* the single point where the worker is created, so the BlockedIndexedDB retry path
* in `load()` re-creates the worker of the correct subtype after terminating.
*/
protected createDataCaptureWorker(): Promise;
private getIndexedDBTimeoutMs;
load(): Promise>;
/**
* Send a task (i.e. a command) to the worker. Every task sent has a corresponding Promise object which
* gets resolved when the worker has processed the request. The tasks are identified by an id which is
* sent along with the data by both sides.
*/
workerCommand(command: C, payload: WorkerCommandPayload, transferables?: Transferable[]): Promise>;
terminateDataCaptureWorker(disposeContext?: boolean): Promise;
addWorkerListener(listener: WorkerListener): void;
removeWorkerListener(listener: WorkerListener): void;
getOptions(): Pick;
protected onWorkerMessage(event_: MessageEvent): void;
}
//#endregion
//#region src/main/private/ui/molecules/HintPresenter.d.ts
declare enum HintPresenterEvents {
Update = "hintpresenterupdate",
ViewFinderUpdateRequested = "hintpresenterviewfinderupdaterequested"
}
declare class HintPresenter extends ScanditHTMLElement {
static readonly tag: "scandit-hints";
private intervalId;
private root;
private _viewFinderRect;
private onDidToastHideHandler;
constructor();
private static createStyleElement;
static register(): void;
static create(): HintPresenter;
connectedCallback(): void;
disconnectedCallback(): void;
setViewFinderRect(rect: Rect | null): void;
handleMessage(message: DataCaptureCallbackMessage): Promise;
private setHintStyleToToast;
private onDidToastHide;
private getToastElementFromIdOrTag;
showToast(toast: GenericHint): Promise;
showToastWithCustomIcon(hintStyle: GenericHint, icon: ScanditIcon): Promise;
hideToast(hintStyle: GenericHint): Promise;
private showGuidance;
private hideGuidance;
private startUpdateTimer;
private stopUpdateTimer;
/**
* Whenever a toast is shown, we need to ensure that the view finder rect is set. If not, we dispatch an event to
* let the view know about it.
*/
private ensureViewFinderRectIsSet;
private idFromHint;
}
declare global {
interface HTMLElementTagNameMap {
[HintPresenter.tag]: HintPresenter;
}
interface HTMLElementEventMap {
[HintPresenterEvents.Update]: CustomEvent;
}
}
//#endregion
//#region src/main/NotificationPresenter/private/ConcreteNotificationPresenter.d.ts
declare class ConcreteNotificationPresenter implements NotificationPresenter {
private _hintPresenter;
constructor(hintPresenter: HintPresenter);
showNotification(notificationConfiguration: NotificationConfiguration): Promise;
hideNotification(notificationConfiguration: NotificationConfiguration): Promise;
}
//#endregion
//#region src/main/index.d.ts
type PrivateCaptureModuleName = "BarcodeCapture" | "IdCapture" | "Parser" | "LabelCapture";
//#endregion
//#region src/main/DataCaptureContextRelated.d.ts
interface DataCaptureContextListener {
didChangeStatus?: (context: DataCaptureContext, contextStatus: ContextStatus) => void;
didStartObservingContext?: (context: DataCaptureContext) => void;
didChangeFrameSource?: (context: DataCaptureContext, frameSource: FrameSource | null) => void;
}
interface ContextStatusJSON {
code: number;
isValid: boolean;
message: string;
}
declare class ContextStatus {
private _message;
private _code;
private _isValid;
private static fromJSON;
get message(): string;
get code(): number;
get isValid(): boolean;
}
declare enum PrivateMirrorAxis {
None = "None",
X = "X",
Y = "Y"
}
//#endregion
//#region src/main/DataCaptureContext.d.ts
type DataCaptureContextState = "unconfigured" | "configuring" | "configured" | "creating-context" | "ready";
type Change = {
type: "modeEnabled";
newValue: boolean;
} | {
type: "addControl";
newValue: any;
} | {
type: "addOverlay";
newValue: DataCaptureOverlay;
view: DataCaptureView$1;
} | {
type: "cameraSettings";
newValue: any;
} | {
type: "frameSourceState";
newValue: any;
} | {
type: "removeControl";
newValue: any;
} | {
type: "removeOverlay";
newValue: DataCaptureOverlay;
view: DataCaptureView$1;
} | {
type: "singleImageModeUploaderSettings";
newValue: any;
} | {
type: "torchState";
newValue: any;
} | {
type: "viewChange";
newValue: {
orientation: Orientation;
} & Partial;
} | {
type: "viewSet";
newValue: DataCaptureView$1 | null;
};
type PrivateChangeSet = Change[];
interface DataCaptureMode extends Serializable {
isEnabled(): boolean;
setEnabled(enabled: boolean): Promise;
context: Optional;
}
interface PrivateDataCaptureMode extends DataCaptureMode {
type: "barcodeCapture" | "idCapture";
skipSerialization?: boolean;
[nativeHandle]?: symbol;
_context: Optional;
attachedToContext: (context: DataCaptureContext) => Promise;
detachedFromContext: () => Promise;
_synchronousFrameFlow?: boolean;
}
interface DataCaptureModeJSON {
type: "barcodeCapture" | "barcodeTracking" | "idCapture" | "parser" | "sparkScan" | "barcodeFind" | "barcodeAr" | "labelCapture";
enabled: boolean;
settings: S;
}
interface PrivateDataCaptureComponent {
_context: DataCaptureContext;
}
type DataCaptureComponentJSON = JSONType;
interface DataCaptureComponent extends Serializable {
readonly id: string;
}
interface PrivateDataCaptureContextOptions {
deviceName?: string | null;
dataCaptureInstance?: DataCaptureLoader;
licenseKey?: string;
settings?: DataCaptureContextSettings;
}
interface PrivateDataCaptureContext unknown = DataCaptureLoader["workerCommand"]> {
_frameSource?: FrameSource | null;
_useSynchronousFrameFlow: boolean;
capabilityInfo: PrivateCapabilityInfo;
modes: Set;
components: DataCaptureComponent[];
createContext: () => Promise;
update: (changeSet?: PrivateChangeSet, { updateContext }?: {
updateContext?: boolean;
}) => Promise;
addNativeOverlay: (overlay: DataCaptureOverlay) => Promise;
removeNativeOverlay: (overlay: DataCaptureOverlay) => Promise;
addComponent: (component: DataCaptureComponent) => Promise;
dataCaptureInstance: DataCaptureLoader;
sendFrameToProcessor: (capture: FrameCapture) => Promise>;
subscribeToWorkerMessages: (listener: (message: DataCaptureCallbackMessage) => void) => void;
unsubscribeToWorkerMessages: (listener: (message: DataCaptureCallbackMessage) => void) => void;
hasEnabledMode: () => boolean;
workerCommand: MethodSignature;
performanceMark: MethodSignature;
isFeatureSupported: (feature: LicensedFeature) => Promise;
new (): DataCaptureContext;
updateListeners: Set<(change: Change) => void>;
updateCameraFrameFlow: (synchronous: boolean) => void;
getView: () => DataCaptureView$1 | null;
}
interface DataCaptureContextCreationOptions {
libraryLocation: string;
moduleLoaders: ModuleLoader[];
deviceName?: string;
settings?: DataCaptureContextSettings;
logLevel?: Logger.Level;
}
/**
* Configuration options for initializing the DataCapture SDK.
*
* @public
*/
interface ModuleLoaderOptions {
licenseKey: string;
libraryLocation: string;
moduleLoaders: ModuleLoader[];
logLevel: Logger.Level;
}
interface RuntimeEnvironment {
deviceOS: string;
browser: string;
browserVersion: string;
deviceModelName: string;
}
interface PrivateCapabilityInfo {
simdSupport: boolean;
threadsSupport: boolean;
}
interface DataCaptureContextJSON extends RuntimeEnvironment {
framework: string;
settings: DataCaptureContextSettingsJSON;
licenseKey: string;
deviceName: string;
frameSource: FrameSourceJSON | null;
modes: DataCaptureModeJSON[];
components: DataCaptureComponentJSON[];
view: DataCaptureViewJSON | null;
}
type PrivateFrameHandlerResponse = {
action: "continue" | "skip";
frame: FrameCapture;
};
/**
* A handler can replace `frame.data` (e.g. to redirect processing to different pixel data). This is
* incompatible with the zero-copy SharedArrayBuffer fast path (see `claimSharedFrameMemAddressSlot`):
* by the time a handler runs, the pixels are already written into a claimed memAddressSlot, and there
* is no way to redirect a replacement buffer into that slot, nor to safely abandon the slot (it can
* only be released by the worker's `processFrameFromMemAddressSlot` -> `release()` path). For this
* reason, registering any `PrivateFrameHandler` disables the fast path entirely for as long as it's
* registered — this is why features built on frame handlers (e.g. IdCapture) always use the classic
* transfer-based frame path.
*/
type PrivateFrameHandler = (frame: FrameCapture) => Promise;
declare class DataCaptureContext implements Serializable {
static deviceID: string;
protected static stateMachine: AsyncStateMachine;
protected static mainDataCaptureLoader: DataCaptureLoader | undefined;
protected static dataCaptureLoaders: Map;
protected static libraryLocation: string | undefined;
private static userLicenseKey;
/**
* Threads and SIMD support detected during initialization
*/
protected static capabilityInfo: PrivateCapabilityInfo | undefined;
private _asyncImageConverterInstance;
private static get moduleLicenseTextProviders();
private readonly framework;
private readonly runtimeEnvironment;
private settings;
private licenseKey;
private deviceName;
private _frameSource;
private _view;
private readonly modes;
private readonly components;
private listeners;
private readonly updateListeners;
private readonly cameraPropertiesReportListener;
private readonly cameraAccessErrorListener;
private readonly onWorkerMessageListener;
private readonly onVisibilityChangeListener;
private readonly batteryChangeListener;
private dataCaptureInstance;
private readonly pendingWorkerMessageListeners;
private highEndBlurryRecognition;
private webBatteryInterface;
private readonly _frameHandlers;
/** Set once the worker confirms its loaded Module isn't a shared-memory (threads) build — sticky, never retried. */
private _sharedFramePathUnavailable;
private _sharedFrameMemAddressSlotPool;
/** The memAddressSlotByteLength currently being negotiated, so concurrent same-size calls don't double-negotiate. */
private _pendingSharedFramePathNegotiationSize;
/** Last logged shared-frame-path state, so `logSharedFramePathState` only logs on an actual transition. */
private _lastLoggedSharedFramePathState;
private static readonly SHARED_FRAME_MEM_ADDRESS_SLOT_COUNT;
/**
* When synchronous, only one frame is processed at a time by the capture mode, the frame source will wait until the
* frame data is back to send the next frame.
*
* IdCapture uses the synchronous flow because BlinkID only processes one frame at a time.
* MatrixScan and other barcode modes usually use the asynchronous flow because they can use multi-threading.
*/
private _useSynchronousFrameFlow;
[INTERNAL_ACCESS]: {
hasModes: () => boolean;
};
private static _sharedInstance;
static get sharedInstance(): DataCaptureContext;
/**
* Get the current state of the DataCaptureContext initialization
*/
protected static get currentState(): DataCaptureContextState;
/**
* Check if the context is ready for use
*/
protected static get isReady(): boolean;
/**
* Check if initialization is in progress
*/
protected static get isInitializing(): boolean;
/**
* Add a listener to state changes
*/
protected static addStateListener(listener: (currentState: DataCaptureContextState, previousState: DataCaptureContextState, context?: any) => void): void;
/**
* Remove a state change listener
*/
protected static removeStateListener(listener: (currentState: DataCaptureContextState, previousState: DataCaptureContextState, context?: any) => void): void;
private initializeWithOptions;
get frameSource(): FrameSource | null;
private get workerCommand();
static forLicenseKey(licenseKey: string, options: DataCaptureContextCreationOptions): Promise;
private static internalConfigure;
/**
* Initialize the DataCapture SDK for Electron applications using a license data path.
* This method handles the Electron-specific license key retrieval logic.
*
* @param licenseDataPath - Path to the license data file in the Electron app
* @param options - Configuration options for the DataCapture SDK
* @returns Promise resolving to the DataCaptureContext instance
*/
static forLicenseKeyInElectronPath(licenseDataPath: string, options: DataCaptureContextCreationOptions): Promise;
private static updateViewsWithProgress;
private static getOverridesFromQueryString;
private static validateOptions;
private static loadModules;
static getOpenSourceSoftwareLicenseInfo(): Promise;
/**
* Disconnect the current frame source from the context and connect the new one. This process can happen multiple
* times for the same frame source because of its initialisation (The mirroring info of a camera is only available
* when it has started for example).
* Trigger the "didChangeFrameSource" listeners only if the new frame source is different than the old one.
*/
setFrameSource(frameSource: FrameSource | null): Promise;
addListener(listener: DataCaptureContextListener): void;
flushAnalytics(): Promise;
removeListener(listener: DataCaptureContextListener): void;
addMode(mode: DataCaptureMode): Promise;
removeMode(mode: DataCaptureMode): Promise;
setMode(mode: DataCaptureMode): Promise;
removeCurrentMode(): Promise;
removeAllModes(): Promise;
private hasModes;
dispose(): Promise;
applySettings(settings: DataCaptureContextSettings): Promise;
toJSONObject(): DataCaptureContextJSON;
private getView;
private setView;
private getAppName;
private urlToHostname;
private getParentDomain;
private createContext;
private subscribeToVisibilityChange;
private unsubscribeToVisibilityChange;
private requestFrameData;
private performanceMark;
private sendFrameToProcessor;
private sendFrameToHandlers;
private sendFrameToSDC;
/**
* The acquirer passed to `Camera`/`CameraManager`/frame readers for the zero-copy SharedArrayBuffer
* fast path. Gated off entirely whenever a frame handler is registered (e.g. IdCapture): a handler
* can replace `capture.data` after pixels are already written into a claimed memAddressSlot, and the fast path
* has no way to redirect that replacement into the (already-written) memAddressSlot, nor to safely abandon a
* claimed memAddressSlot (it can only be released by the worker's processFrameFromMemAddressSlot -> release() path).
*/
private claimSharedFrameMemAddressSlot;
/** Logs the active frame-capture path, but only when it actually changes - this is on the per-frame hot path. */
private logSharedFramePathState;
private negotiateSharedFramePath;
private registerFrameHandler;
private unregisterFrameHandler;
private onBatteryChange;
private onVisibilityChange;
private getImageConverterInstance;
private onWorkerMessage;
/**
* This method is only called from the worker thread when OffscreenCanvas is not available there.
*/
private convertImageToJPEG;
private subscribeToCameraManagerEvents;
private reportCameraProperties;
private onCameraAccessError;
private update;
private updateContext;
private getViewInfo;
private getMirrorAxisForFrameSource;
private addComponent;
private addNativeOverlay;
private removeNativeOverlay;
private subscribeToWorkerMessages;
private unsubscribeToWorkerMessages;
private hasEnabledMode;
/**
* Some capture modes process frames synchronously, like IdCapture. Other can process multiple frames
* in parallel, like MatrixScan. We inform the CameraManager how to process frames.
*/
private updateCameraFrameFlow;
protected isFeatureSupported(feature: LicensedFeature): Promise;
}
//#endregion
export { TrackingModeName as $, Control as $n, UpdateBatteryInfoDataCaptureAction as $t, ModuleLoader as A, DeviceInterfaceInstance as An, ModuleHandler as At, FrameCapture as B, WasmFeedback as Bn, ProcessFrameFromMemAddressSlotDataCaptureAction as Bt, PrivateCaptureModuleName as C, BatteryData as Cn, HideHintWorkerMessage as Ct, DataCaptureLoader as D, DataCaptureContextDeserializerResult as Dn, IsFeatureSupportedMessage as Dt, HintPresenterEvents as E, DataCaptureContextDeserializer as En, IsFeatureSupportedAction as Et, CameraManagerEvent as F, HintPresenterV2 as Fn, OnTapAction as Ft, CreateContextParameters as G, PoolCapacityOptions as Gn, SetFrameSourceDataCaptureAction as Gt, GUI as H, GrayScaleFrameReader as Hn, ReportCameraPropertiesDataCaptureAction as Ht, CameraManagerEventParameters as I, JSONParseable as In, PayloadForCommand as It, NegotiateSharedFramePathParameters as J, ZoomSwitchControl as Jn, ShowHintWorkerMessage as Jt, DataCaptureEngine as K, SharedFrameMemAddressSlot as Kn, SetLogLevelDataCaptureAction as Kt, CameraResolutionConstraint as L, LicensedFeature as Ln, PerformanceMetrics as Lt, PrivateLoadableFrameData as M, EmscriptenDataCaptureOverlay as Mn, OnFrameProcessingFinishedMessage as Mt, convertToPublicFrameData as N, GestureListener as Nn, OnFrameProcessingStartedMessage as Nt, DataCaptureLoaderOptions as O, DataCaptureImageBufferFrameSource as On, IsFeatureSupportedResponse as Ot, CameraManager as P, GestureRecognizer as Pn, OnFrameSkippedMessage as Pt, SetFrameSourceParameters as Q, CameraFOVSwitchControl as Qn, SuccessFeedbackWorkerMessage as Qt, ExtendedMediaTrackCapabilities as R, OrientationBridgeValue as Rn, PerformanceMetricsReportMessage as Rt, PrivateMirrorAxis as S, ToastHintStyle as Sn, HideGuidanceMessage as St, HintPresenter as T, DataCaptureContext$1 as Tn, HintPresenterV2updateAction as Tt, MeteringMode as U, FrameReader as Un, RequestFrameDataDataCaptureAction as Ut, FrameId as V, WasmFrameData as Vn, RemoveNativeOverlayAction as Vt, createFrameId as W, FrameReaderAbstract as Wn, RequestFrameDataResponse as Wt, ProcessFrameParameters as X, CameraSwitchBehavior as Xn, StartUpdateTimerMessage as Xt, ProcessFrameFromMemAddressSlotParameters as Y, TorchSwitchControl as Yn, ShowToastMessage as Yt, ReportCameraPropertiesParameters as Z, CameraSwitchControl as Zn, StopUpdateTimerMessage as Zt, PrivateFrameHandler as _, HintIcon as _n, FlushAnalyticsDataCaptureAction as _t, DataCaptureContextCreationOptions as a, WorkerResponse as an, DataCaptureViewConnectOptions as ar, ConvertToJPEGResultDataCaptureAction as at, ContextStatusJSON as b, HintWidth as bn, GetViewfinderInfoAction as bt, DataCaptureMode as c, Vector as cn, PrivateDataCaptureOverlay as cr, DataCaptureCallbackMessage as ct, PrivateCapabilityInfo as d, GuidanceHintAnchor as dn, DeleteFrameDataDataCaptureAction as dt, UpdateContextDataCaptureAction as en, ControlType as er, UpdateContextParameters as et, PrivateChangeSet as f, GuidanceHintStyle as fn, DidTapTrackedBarcode as ft, PrivateDataCaptureMode as g, HintHeight as gn, ExtractCentaurusLicenseResponse as gt, PrivateDataCaptureContextOptions as h, HintFont as hn, ExtractCentaurusLicenseDataCaptureAction as ht, DataCaptureContext as i, VisibilityChangeAction as in, DataCaptureView$1 as ir, AugmentedWorker as it, FrameData as j, EmscriptenClassHandle as jn, NegotiateSharedFramePathDataCaptureAction as jt, WorkerMain as k, DataCaptureView as kn, LoadLibraryDataCaptureAction as kt, DataCaptureModeJSON as l, GenericHint as ln, DataCaptureCallbackMessageKeys as lt, PrivateDataCaptureContext as m, HintCornerStyle as mn, EngineWorkerResponse as mt, DataCaptureComponent as n, ViewInfo as nn, PrivateControl as nr, AddNativeOverlayAction as nt, DataCaptureContextJSON as o, CoreModule as on, DataCaptureViewJSON as or, CreateContextDataCaptureAction as ot, PrivateDataCaptureComponent as p, HintAnchor as pn, DisposeDataCaptureAction as pt, LoadLibraryParameters as q, SharedFrameMemAddressSlotAcquirer as qn, ShowGuidanceMessage as qt, DataCaptureComponentJSON as r, ViewSizeChangedMessage as rn, DataCaptureOverlay as rr, AnyDataCaptureActionMessage as rt, DataCaptureContextState as s, ModuleMirrorAxis as sn, DataCaptureViewListener as sr, DataCaptureActionMessageKey as st, Change as t, UpdateHintWorkerMessage as tn, PrivateBaseControl as tr, WorkerFunctions as tt, ModuleLoaderOptions as u, GuidanceHint as un, DataCaptureWorker as ut, PrivateFrameHandlerResponse as v, HintStyle as vn, GetOpenSourceSoftwareLicenseInfoAction as vt, ConcreteNotificationPresenter as w, CaptureModeDeserializerInstance as wn, HideToastMessage as wt, DataCaptureContextListener as x, ToastHint as xn, GetViewfinderInfoResponse as xt, ContextStatus as y, HintTextAlignment as yn, GetOpenSourceSoftwareLicenseInfoResponse as yt, ExtendedMediaTrackConstraintSet as z, PlatformHintPresenter as zn, ProcessFrameDataCaptureAction as zt };