Socket
Socket
Sign inDemoInstall

@zappar/zappar-cv

Package Overview
Dependencies
4
Maintainers
11
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1-alpha.5 to 3.0.1-alpha.7

umd/7e63bec626d6ccda2134.wasm

13

lib/gen/zappar-bridge.d.ts

@@ -12,2 +12,3 @@ import { barcode_format_t } from "./zappar-native";

export { world_tracker_quality_t } from "./zappar-native";
export { camera_profile_t } from "./zappar-native";
export declare type zappar_pipeline_t = number & {

@@ -40,2 +41,5 @@ _: 'zappar_pipeline_t';

};
export declare type zappar_zapcode_tracker_t = number & {
_: 'zappar_zapcode_tracker_t';
};
export declare type zappar_world_tracker_t = number & {

@@ -110,2 +114,11 @@ _: 'zappar_world_tracker_t';

instant_world_tracker_anchor_pose_set_from_camera_offset_raw(o: zappar_instant_world_tracker_t, x: number, y: number, z: number, orientation: instant_world_tracker_transform_orientation_t): void;
zapcode_tracker_create(pipeline: zappar_pipeline_t): zappar_zapcode_tracker_t;
zapcode_tracker_destroy(o: zappar_zapcode_tracker_t): void;
zapcode_tracker_target_load_from_memory(o: zappar_zapcode_tracker_t, data: ArrayBuffer): void;
zapcode_tracker_target_loaded_version(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_enabled(o: zappar_zapcode_tracker_t): boolean;
zapcode_tracker_enabled_set(o: zappar_zapcode_tracker_t, enabled: boolean): void;
zapcode_tracker_anchor_count(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_anchor_id(o: zappar_zapcode_tracker_t, indx: number): string;
zapcode_tracker_anchor_pose_raw(o: zappar_zapcode_tracker_t, indx: number): Float32Array;
world_tracker_create(pipeline: zappar_pipeline_t): zappar_world_tracker_t;

@@ -112,0 +125,0 @@ world_tracker_destroy(o: zappar_world_tracker_t): void;

1

lib/gen/zappar-bridge.js

@@ -8,1 +8,2 @@ export { barcode_format_t } from "./zappar-native";

export { world_tracker_quality_t } from "./zappar-native";
export { camera_profile_t } from "./zappar-native";

@@ -20,2 +20,3 @@ import { MessageSerializer } from "../serializer";

private _instant_world_tracker_state_by_instance;
private _zapcode_tracker_state_by_instance;
private _world_tracker_state_by_instance;

@@ -22,0 +23,0 @@ impl: zappar;

@@ -23,2 +23,3 @@ import { MessageSerializer } from "../serializer";

this._instant_world_tracker_state_by_instance = new Map();
this._zapcode_tracker_state_by_instance = new Map();
this._world_tracker_state_by_instance = new Map();

@@ -604,2 +605,76 @@ this.impl = {

},
// #### zapcode_tracker ####
zapcode_tracker_create: (pipeline) => {
let newId = (this._latestId++);
let s = {
enabled: true,
target_loaded_version: -1,
anchor_count: 0,
anchor_id: [],
anchor_pose: [],
};
this._zapcode_tracker_state_by_instance.set(newId, s);
this.serializer.sendMessage(41, m => {
m.type(newId);
m.type(pipeline);
});
return newId;
},
zapcode_tracker_destroy: (o) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
this._zapcode_tracker_state_by_instance.delete(o);
this.serializer.sendMessage(44, m => {
m.type(o);
});
},
zapcode_tracker_target_load_from_memory: (o, data) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
this.serializer.sendMessage(43, m => {
m.type(o);
m.dataWithLength(data);
});
},
zapcode_tracker_target_loaded_version: (o) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
return s.target_loaded_version;
},
zapcode_tracker_enabled: (o) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
return s.enabled;
},
zapcode_tracker_enabled_set: (o, enabled) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
this.serializer.sendMessage(42, m => {
m.type(o);
m.bool(enabled);
});
},
zapcode_tracker_anchor_count: (o) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
return s.anchor_count;
},
zapcode_tracker_anchor_id: (o, indx) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
return s.anchor_id[indx];
},
zapcode_tracker_anchor_pose_raw: (o, indx) => {
let s = this._zapcode_tracker_state_by_instance.get(o);
if (!s)
throw new Error("This object has been destroyed");
return s.anchor_pose[indx];
},
// #### world_tracker ####

@@ -624,3 +699,3 @@ world_tracker_create: (pipeline) => {

this._world_tracker_state_by_instance.set(newId, s);
this.serializer.sendMessage(41, m => {
this.serializer.sendMessage(45, m => {
m.type(newId);

@@ -636,3 +711,3 @@ m.type(pipeline);

this._world_tracker_state_by_instance.delete(o);
this.serializer.sendMessage(42, m => {
this.serializer.sendMessage(46, m => {
m.type(o);

@@ -651,3 +726,3 @@ });

throw new Error("This object has been destroyed");
this.serializer.sendMessage(43, m => {
this.serializer.sendMessage(47, m => {
m.type(o);

@@ -703,3 +778,3 @@ m.bool(enabled);

throw new Error("This object has been destroyed");
this.serializer.sendMessage(44, m => {
this.serializer.sendMessage(48, m => {
m.type(o);

@@ -718,3 +793,3 @@ });

throw new Error("This object has been destroyed");
this.serializer.sendMessage(45, m => {
this.serializer.sendMessage(49, m => {
m.type(o);

@@ -914,4 +989,38 @@ m.bool(debug_enabled);

}
case 27: {
case 24: {
let handle = msg.type();
let inst = this._zapcode_tracker_state_by_instance.get(handle);
if (!inst)
return;
inst.target_loaded_version = msg.int();
break;
}
case 21: {
let handle = msg.type();
let inst = this._zapcode_tracker_state_by_instance.get(handle);
if (!inst)
return;
inst.anchor_count = msg.int();
break;
}
case 22: {
let handle = msg.type();
let inst = this._zapcode_tracker_state_by_instance.get(handle);
if (!inst)
return;
let indx = msg.int();
inst.anchor_id[indx] = msg.string();
break;
}
case 23: {
let handle = msg.type();
let inst = this._zapcode_tracker_state_by_instance.get(handle);
if (!inst)
return;
let indx = msg.int();
inst.anchor_pose[indx] = msg.matrix4x4();
break;
}
case 31: {
let handle = msg.type();
let inst = this._world_tracker_state_by_instance.get(handle);

@@ -923,3 +1032,3 @@ if (!inst)

}
case 21: {
case 25: {
let handle = msg.type();

@@ -932,3 +1041,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 22: {
case 26: {
let handle = msg.type();

@@ -942,3 +1051,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 23: {
case 27: {
let handle = msg.type();

@@ -951,3 +1060,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 24: {
case 28: {
let handle = msg.type();

@@ -960,3 +1069,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 23: {
case 27: {
let handle = msg.type();

@@ -969,3 +1078,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 26: {
case 30: {
let handle = msg.type();

@@ -978,3 +1087,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 29: {
case 33: {
let handle = msg.type();

@@ -987,3 +1096,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 28: {
case 32: {
let handle = msg.type();

@@ -996,3 +1105,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 31: {
case 35: {
let handle = msg.type();

@@ -1005,3 +1114,3 @@ let inst = this._world_tracker_state_by_instance.get(handle);

}
case 30: {
case 34: {
let handle = msg.type();

@@ -1008,0 +1117,0 @@ let inst = this._world_tracker_state_by_instance.get(handle);

@@ -41,3 +41,3 @@ export function getRuntimeObject(mod) {

"number",
"number", "number", "number", "number", "number", "number", "number", "number", "number", "number", "number"
"number", "number", "number", "number", "number", "number", "number", "number", "number", "number", "number", "number"
]);

@@ -202,2 +202,29 @@ let pipeline_camera_frame_camera_attitude_wrapped = mod.cwrap("zappar_pipeline_camera_frame_camera_attitude", "number", [

]);
let zapcode_tracker_create_wrapped = mod.cwrap("zappar_zapcode_tracker_create", "number", ["number"]);
let zapcode_tracker_destroy_wrapped = mod.cwrap("zappar_zapcode_tracker_destroy", null, ["number"]);
let zapcode_tracker_target_load_from_memory_wrapped = mod.cwrap("zappar_zapcode_tracker_target_load_from_memory", null, [
"number",
"number", "number"
]);
let zapcode_tracker_target_loaded_version_wrapped = mod.cwrap("zappar_zapcode_tracker_target_loaded_version", "number", [
"number"
]);
let zapcode_tracker_enabled_wrapped = mod.cwrap("zappar_zapcode_tracker_enabled", "number", [
"number"
]);
let zapcode_tracker_enabled_set_wrapped = mod.cwrap("zappar_zapcode_tracker_enabled_set", null, [
"number",
"number"
]);
let zapcode_tracker_anchor_count_wrapped = mod.cwrap("zappar_zapcode_tracker_anchor_count", "number", [
"number"
]);
let zapcode_tracker_anchor_id_wrapped = mod.cwrap("zappar_zapcode_tracker_anchor_id", "string", [
"number",
"number"
]);
let zapcode_tracker_anchor_pose_raw_wrapped = mod.cwrap("zappar_zapcode_tracker_anchor_pose_raw", "number", [
"number",
"number"
]);
let world_tracker_create_wrapped = mod.cwrap("zappar_world_tracker_create", "number", ["number"]);

@@ -348,3 +375,3 @@ let world_tracker_destroy_wrapped = mod.cwrap("zappar_world_tracker_destroy", null, ["number"]);

},
pipeline_camera_frame_submit_raw_pointer: (o, data, dataLength, format, width, height, user_data, camera_to_device_transform, rotation, camera_model, user_facing, timestamp) => {
pipeline_camera_frame_submit_raw_pointer: (o, data, dataLength, format, width, height, user_data, camera_to_device_transform, rotation, camera_model, user_facing, timestamp, halfSample) => {
let arg_data = data;

@@ -363,3 +390,4 @@ let arg_dataLength = dataLength;

let arg_timestamp = timestamp;
let ret = pipeline_camera_frame_submit_raw_pointer_wrapped(o, arg_data, arg_dataLength, arg_format, arg_width, arg_height, arg_user_data, arg_camera_to_device_transform, arg_rotation, arg_camera_model, arg_user_facing, arg_timestamp);
let arg_halfSample = halfSample ? 1 : 0;
let ret = pipeline_camera_frame_submit_raw_pointer_wrapped(o, arg_data, arg_dataLength, arg_format, arg_width, arg_height, arg_user_data, arg_camera_to_device_transform, arg_rotation, arg_camera_model, arg_user_facing, arg_timestamp, arg_halfSample);
return ret;

@@ -672,2 +700,52 @@ },

},
zapcode_tracker_create: (pipeline) => {
let arg_pipeline = pipeline;
return zapcode_tracker_create_wrapped(arg_pipeline);
},
zapcode_tracker_destroy: () => {
zapcode_tracker_destroy_wrapped();
},
zapcode_tracker_target_load_from_memory: (o, data) => {
if (dataArrayArgLength < data.byteLength) {
mod._free(dataArrayArg);
dataArrayArgLength = data.byteLength;
dataArrayArg = mod._malloc(dataArrayArgLength);
}
let arg_data = dataArrayArg;
let arg_len_data = data.byteLength;
mod.HEAPU8.set(new Uint8Array(data), dataArrayArg);
let ret = zapcode_tracker_target_load_from_memory_wrapped(o, arg_data, arg_len_data);
return ret;
},
zapcode_tracker_target_loaded_version: (o) => {
let ret = zapcode_tracker_target_loaded_version_wrapped(o);
return ret;
},
zapcode_tracker_enabled: (o) => {
let ret = zapcode_tracker_enabled_wrapped(o);
ret = ret === 1;
return ret;
},
zapcode_tracker_enabled_set: (o, enabled) => {
let arg_enabled = enabled ? 1 : 0;
let ret = zapcode_tracker_enabled_set_wrapped(o, arg_enabled);
return ret;
},
zapcode_tracker_anchor_count: (o) => {
let ret = zapcode_tracker_anchor_count_wrapped(o);
return ret;
},
zapcode_tracker_anchor_id: (o, indx) => {
let arg_indx = indx;
let ret = zapcode_tracker_anchor_id_wrapped(o, arg_indx);
return ret;
},
zapcode_tracker_anchor_pose_raw: (o, indx) => {
let arg_indx = indx;
let ret = zapcode_tracker_anchor_pose_raw_wrapped(o, arg_indx);
let ab = new Float32Array(16);
ab.set(mod.HEAPF32.subarray(ret / 4, 16 + ret / 4));
ret = ab;
return ret;
},
world_tracker_create: (pipeline) => {

@@ -674,0 +752,0 @@ let arg_pipeline = pipeline;

@@ -69,2 +69,6 @@ export declare enum barcode_format_t {

}
export declare enum camera_profile_t {
DEFAULT = 0,
HIGH = 1
}
export declare type zappar_pipeline_t = number & {

@@ -97,2 +101,5 @@ _: 'zappar_pipeline_t';

};
export declare type zappar_zapcode_tracker_t = number & {
_: 'zappar_zapcode_tracker_t';
};
export declare type zappar_world_tracker_t = number & {

@@ -116,3 +123,3 @@ _: 'zappar_world_tracker_t';

pipeline_camera_frame_submit(o: zappar_pipeline_t, data: ArrayBuffer, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, camera_model: Float32Array, user_facing: boolean): void;
pipeline_camera_frame_submit_raw_pointer(o: zappar_pipeline_t, data: number, dataLength: number, format: frame_pixel_format_t, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, rotation: number, camera_model: Float32Array, user_facing: boolean, timestamp: number): void;
pipeline_camera_frame_submit_raw_pointer(o: zappar_pipeline_t, data: number, dataLength: number, format: frame_pixel_format_t, width: number, height: number, user_data: number, camera_to_device_transform: Float32Array, rotation: number, camera_model: Float32Array, user_facing: boolean, timestamp: number, halfSample: boolean): void;
pipeline_camera_frame_camera_attitude(o: zappar_pipeline_t): Float32Array;

@@ -173,2 +180,11 @@ pipeline_camera_frame_device_attitude(o: zappar_pipeline_t): Float32Array;

instant_world_tracker_anchor_pose_set_from_camera_offset_raw(o: zappar_instant_world_tracker_t, x: number, y: number, z: number, orientation: instant_world_tracker_transform_orientation_t): void;
zapcode_tracker_create(pipeline: zappar_pipeline_t): zappar_zapcode_tracker_t;
zapcode_tracker_destroy(o: zappar_zapcode_tracker_t): void;
zapcode_tracker_target_load_from_memory(o: zappar_zapcode_tracker_t, data: ArrayBuffer): void;
zapcode_tracker_target_loaded_version(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_enabled(o: zappar_zapcode_tracker_t): boolean;
zapcode_tracker_enabled_set(o: zappar_zapcode_tracker_t, enabled: boolean): void;
zapcode_tracker_anchor_count(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_anchor_id(o: zappar_zapcode_tracker_t, indx: number): string;
zapcode_tracker_anchor_pose_raw(o: zappar_zapcode_tracker_t, indx: number): Float32Array;
world_tracker_create(pipeline: zappar_pipeline_t): zappar_world_tracker_t;

@@ -175,0 +191,0 @@ world_tracker_destroy(o: zappar_world_tracker_t): void;

@@ -83,1 +83,7 @@ export var barcode_format_t;

;
export var camera_profile_t;
(function (camera_profile_t) {
camera_profile_t[camera_profile_t["DEFAULT"] = 0] = "DEFAULT";
camera_profile_t[camera_profile_t["HIGH"] = 1] = "HIGH";
})(camera_profile_t || (camera_profile_t = {}));
;

@@ -12,2 +12,3 @@ import { MessageSerializer } from "../serializer";

import { zappar_instant_world_tracker_t } from "./zappar-native";
import { zappar_zapcode_tracker_t } from "./zappar-native";
import { zappar_world_tracker_t } from "./zappar-native";

@@ -38,2 +39,4 @@ export declare class zappar_server {

_instant_world_tracker_by_instance: Map<number, zappar_instant_world_tracker_t>;
_pipeline_id_by_zapcode_tracker_id: Map<number, number>;
_zapcode_tracker_by_instance: Map<number, zappar_zapcode_tracker_t>;
_pipeline_id_by_world_tracker_id: Map<number, number>;

@@ -40,0 +43,0 @@ _world_tracker_by_instance: Map<number, zappar_world_tracker_t>;

@@ -27,2 +27,4 @@ import { MessageSerializer } from "../serializer";

this._instant_world_tracker_by_instance = new Map();
this._pipeline_id_by_zapcode_tracker_id = new Map();
this._zapcode_tracker_by_instance = new Map();
this._pipeline_id_by_world_tracker_id = new Map();

@@ -358,2 +360,36 @@ this._world_tracker_by_instance = new Map();

let arg_pipeline = this._pipeline_by_instance.get(arg_pipeline_id);
let handle = this._impl.zapcode_tracker_create(arg_pipeline);
this._zapcode_tracker_by_instance.set(clientId, handle);
this._pipeline_id_by_zapcode_tracker_id.set(clientId, arg_pipeline_id);
break;
}
case 44: {
let clientId = msg.type();
let obj = this._zapcode_tracker_by_instance.get(clientId);
if (obj === undefined)
return;
this._impl.zapcode_tracker_destroy(obj);
this._zapcode_tracker_by_instance.delete(clientId);
break;
}
case 43: {
let clientId = msg.type();
let obj = this._zapcode_tracker_by_instance.get(clientId);
if (obj === undefined)
return;
this._impl.zapcode_tracker_target_load_from_memory(obj, msg.dataWithLength());
break;
}
case 42: {
let clientId = msg.type();
let obj = this._zapcode_tracker_by_instance.get(clientId);
if (obj === undefined)
return;
this._impl.zapcode_tracker_enabled_set(obj, msg.bool());
break;
}
case 45: {
let clientId = msg.type();
let arg_pipeline_id = msg.type();
let arg_pipeline = this._pipeline_by_instance.get(arg_pipeline_id);
let handle = this._impl.world_tracker_create(arg_pipeline);

@@ -364,3 +400,3 @@ this._world_tracker_by_instance.set(clientId, handle);

}
case 42: {
case 46: {
let clientId = msg.type();

@@ -374,3 +410,3 @@ let obj = this._world_tracker_by_instance.get(clientId);

}
case 43: {
case 47: {
let clientId = msg.type();

@@ -383,3 +419,3 @@ let obj = this._world_tracker_by_instance.get(clientId);

}
case 44: {
case 48: {
let clientId = msg.type();

@@ -392,3 +428,3 @@ let obj = this._world_tracker_by_instance.get(clientId);

}
case 45: {
case 49: {
let clientId = msg.type();

@@ -577,2 +613,32 @@ let obj = this._world_tracker_by_instance.get(clientId);

}
for (let [k, v] of this._zapcode_tracker_by_instance) {
let pipeline = this._pipeline_id_by_zapcode_tracker_id.get(k);
if (!pipeline)
continue;
let serializer = this.serializersByPipelineId.get(pipeline);
if (!serializer)
continue;
serializer.sendMessage(24, msg => {
msg.type(k);
msg.int(this._impl.zapcode_tracker_target_loaded_version(v));
});
serializer.sendMessage(21, msg => {
msg.type(k);
msg.int(this._impl.zapcode_tracker_anchor_count(v));
});
for (let i = 0; i < this._impl.zapcode_tracker_anchor_count(v); i++) {
serializer.sendMessage(22, msg => {
msg.type(k);
msg.int(i);
msg.string(this._impl.zapcode_tracker_anchor_id(v, i));
});
}
for (let i = 0; i < this._impl.zapcode_tracker_anchor_count(v); i++) {
serializer.sendMessage(23, msg => {
msg.type(k);
msg.int(i);
msg.matrix4x4(this._impl.zapcode_tracker_anchor_pose_raw(v, i));
});
}
}
for (let [k, v] of this._world_tracker_by_instance) {

@@ -585,7 +651,7 @@ let pipeline = this._pipeline_id_by_world_tracker_id.get(k);

continue;
serializer.sendMessage(27, msg => {
serializer.sendMessage(31, msg => {
msg.type(k);
msg.int(this._impl.world_tracker_quality(v));
});
serializer.sendMessage(21, msg => {
serializer.sendMessage(25, msg => {
msg.type(k);

@@ -595,3 +661,3 @@ msg.int(this._impl.world_tracker_plane_count(v));

for (let i = 0; i < this._impl.world_tracker_plane_count(v); i++) {
serializer.sendMessage(22, msg => {
serializer.sendMessage(26, msg => {
msg.type(k);

@@ -602,31 +668,31 @@ msg.int(i);

}
serializer.sendMessage(23, msg => {
serializer.sendMessage(27, msg => {
msg.type(k);
msg.bool(this._impl.world_tracker_world_anchor_valid(v));
});
serializer.sendMessage(24, msg => {
serializer.sendMessage(28, msg => {
msg.type(k);
msg.matrix4x4(this._impl.world_tracker_world_anchor_pose_raw(v));
});
serializer.sendMessage(23, msg => {
serializer.sendMessage(27, msg => {
msg.type(k);
msg.bool(this._impl.world_tracker_ground_anchor_valid(v));
});
serializer.sendMessage(26, msg => {
serializer.sendMessage(30, msg => {
msg.type(k);
msg.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(v));
});
serializer.sendMessage(29, msg => {
serializer.sendMessage(33, msg => {
msg.type(k);
msg.int(this._impl.world_tracker_debug_tracks_data_size(v));
});
serializer.sendMessage(28, msg => {
serializer.sendMessage(32, msg => {
msg.type(k);
msg.floatArray(this._impl.world_tracker_debug_tracks_data(v));
});
serializer.sendMessage(31, msg => {
serializer.sendMessage(35, msg => {
msg.type(k);
msg.int(this._impl.world_tracker_debug_projections_data_size(v));
});
serializer.sendMessage(30, msg => {
serializer.sendMessage(34, msg => {
msg.type(k);

@@ -633,0 +699,0 @@ msg.floatArray(this._impl.world_tracker_debug_projections_data(v));

@@ -13,2 +13,4 @@ import { barcode_format_t } from "./zappar-native";

export { world_tracker_quality_t } from "./zappar-native";
import { camera_profile_t } from "./zappar-native";
export { camera_profile_t } from "./zappar-native";
export declare type zappar_pipeline_t = number & {

@@ -41,2 +43,5 @@ _: 'zappar_pipeline_t';

};
export declare type zappar_zapcode_tracker_t = number & {
_: 'zappar_zapcode_tracker_t';
};
export declare type zappar_world_tracker_t = number & {

@@ -104,2 +109,3 @@ _: 'zappar_world_tracker_t';

camera_source_pause(o: zappar_camera_source_t): void;
camera_source_profile_set(o: zappar_camera_source_t, profile: camera_profile_t): void;
sequence_source_create(pipeline: zappar_pipeline_t): zappar_sequence_source_t;

@@ -189,2 +195,13 @@ sequence_source_destroy(o: zappar_sequence_source_t): void;

instant_world_tracker_anchor_pose_set_from_camera_offset(o: zappar_instant_world_tracker_t, x: number, y: number, z: number, orientation: instant_world_tracker_transform_orientation_t): void;
zapcode_tracker_create(pipeline: zappar_pipeline_t): zappar_zapcode_tracker_t;
zapcode_tracker_destroy(o: zappar_zapcode_tracker_t): void;
zapcode_tracker_target_load_from_memory(o: zappar_zapcode_tracker_t, data: ArrayBuffer): void;
zapcode_tracker_target_loaded_version(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_enabled(o: zappar_zapcode_tracker_t): boolean;
zapcode_tracker_enabled_set(o: zappar_zapcode_tracker_t, enabled: boolean): void;
zapcode_tracker_anchor_count(o: zappar_zapcode_tracker_t): number;
zapcode_tracker_anchor_id(o: zappar_zapcode_tracker_t, indx: number): string;
zapcode_tracker_anchor_pose_raw(o: zappar_zapcode_tracker_t, indx: number): Float32Array;
zapcode_tracker_anchor_pose_camera_relative(o: zappar_zapcode_tracker_t, indx: number, mirror: boolean): Float32Array;
zapcode_tracker_anchor_pose(o: zappar_zapcode_tracker_t, indx: number, camera_pose: Float32Array, mirror: boolean): Float32Array;
world_tracker_create(pipeline: zappar_pipeline_t): zappar_world_tracker_t;

@@ -191,0 +208,0 @@ world_tracker_destroy(o: zappar_world_tracker_t): void;

@@ -8,1 +8,2 @@ export { barcode_format_t } from "./zappar-native";

export { world_tracker_quality_t } from "./zappar-native";
export { camera_profile_t } from "./zappar-native";

4

lib/html-element-source.d.ts

@@ -1,2 +0,2 @@

import { zappar_pipeline_t } from "./gen/zappar";
import { camera_profile_t, zappar_pipeline_t } from "./gen/zappar";
import { Source } from "./source";

@@ -17,2 +17,3 @@ import { zappar_html_element_source_t } from "./additional";

private _cameraModel;
private _profile;
static createVideoElementSource(p: zappar_pipeline_t, element: HTMLVideoElement | HTMLImageElement): zappar_html_element_source_t;

@@ -28,2 +29,3 @@ static getVideoElementSource(m: zappar_html_element_source_t): HTMLElementSource | undefined;

uploadGL(): void;
setProfile(p: camera_profile_t): void;
}

@@ -0,1 +1,2 @@

import { camera_profile_t } from "./gen/zappar";
import { Pipeline } from "./pipeline";

@@ -22,2 +23,3 @@ import { Source } from "./source";

this._cameraModel = new Float32Array([300, 300, 160, 120, 0, 0]);
this._profile = camera_profile_t.DEFAULT;
mat4.fromScaling(this._cameraToDeviceTransformUserFacing, [-1, 1, -1]);

@@ -113,3 +115,3 @@ let video = this._video;

return undefined;
this._imageProcessor.uploadFrame(this._currentVideoTexture, this._video, rotation, this._isUserFacing);
this._imageProcessor.uploadFrame(this._currentVideoTexture, this._video, rotation, this._isUserFacing, this._profile);
this._isUploadFrame = !this._isUploadFrame;

@@ -121,3 +123,4 @@ return undefined;

this._isUploadFrame = !this._isUploadFrame;
let greySize = profile.dataWidth * profile.dataHeight;
const [dataWidth, dataHeight] = profile.getDataSize(this._profile);
let greySize = dataWidth * dataHeight;
let pixels = pipeline.cameraPixelArrays.pop();

@@ -134,8 +137,8 @@ while (pixels) {

this._currentVideoTexture = undefined;
let focalLength = 300.0 * profile.dataWidth / 320.0;
let focalLength = 300.0 * dataWidth / 320.0;
this._cameraModel[0] = focalLength;
this._cameraModel[1] = focalLength;
this._cameraModel[2] = profile.dataWidth * 0.5;
this._cameraModel[3] = profile.dataHeight * 0.5;
return Object.assign(Object.assign({}, this._imageProcessor.readFrame(tex, pixels)), { cameraModel: this._cameraModel, cameraSource: this, cameraToDevice: (this._isUserFacing ? this._cameraToDeviceTransformUserFacing : this._cameraToDeviceTransform) });
this._cameraModel[2] = dataWidth * 0.5;
this._cameraModel[3] = dataHeight * 0.5;
return Object.assign(Object.assign({}, this._imageProcessor.readFrame(tex, pixels, this._profile)), { cameraModel: this._cameraModel, cameraSource: this, cameraToDevice: (this._isUserFacing ? this._cameraToDeviceTransformUserFacing : this._cameraToDeviceTransform) });
}

@@ -145,2 +148,5 @@ uploadGL() {

}
setProfile(p) {
this._profile = p;
}
}

@@ -0,1 +1,2 @@

import { camera_profile_t } from "./gen/zappar-native";
export interface ProcessedFrame {

@@ -31,4 +32,4 @@ data?: ArrayBuffer;

destroy(): void;
uploadFrame(texture: WebGLTexture, img: HTMLVideoElement | HTMLImageElement | ImageBitmap, rotation: number, fc: boolean): void;
readFrame(texture: WebGLTexture, pixels: ArrayBuffer): ProcessedFrame;
uploadFrame(texture: WebGLTexture, img: HTMLVideoElement | HTMLImageElement | ImageBitmap, rotation: number, fc: boolean, cp: camera_profile_t): void;
readFrame(texture: WebGLTexture, pixels: ArrayBuffer, cp: camera_profile_t): ProcessedFrame;
private _updateTransforms;

@@ -35,0 +36,0 @@ private _getCameraUvTransform;

@@ -36,3 +36,3 @@ import { mat4 } from "gl-matrix";

}
uploadFrame(texture, img, rotation, fc) {
uploadFrame(texture, img, rotation, fc, cp) {
let gl = this._gl;

@@ -79,3 +79,4 @@ const glStateManager = GLStateManager.get(gl);

this._updateTransforms(rotation, fc);
let framebuffer = this._getFramebuffer(gl, profile.dataWidth / 4, profile.dataHeight);
const [dataWidth, dataHeight] = profile.getDataSize(cp);
let framebuffer = this._getFramebuffer(gl, dataWidth / 4, dataHeight);
let vbo = this._getVertexBuffer(gl);

@@ -128,3 +129,3 @@ let ibo = this._getIndexBuffer(gl);

// Specify greyscale width for the correct offsets, and the uv transform
gl.uniform1f(shader.uTexWidthLoc, profile.dataWidth);
gl.uniform1f(shader.uTexWidthLoc, dataWidth);
gl.uniformMatrix4fv(shader.uUvTransformLoc, false, this._cameraUvTransform);

@@ -173,7 +174,8 @@ gl.activeTexture(gl.TEXTURE0);

}
readFrame(texture, pixels) {
readFrame(texture, pixels, cp) {
let gl = this._gl;
let pixelsView = new Uint8Array(pixels);
const previousBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);
let framebuffer = this._getFramebuffer(gl, profile.dataWidth / 4, profile.dataHeight);
const [dataWidth, dataHeight] = profile.getDataSize(cp);
let framebuffer = this._getFramebuffer(gl, dataWidth / 4, dataHeight);
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);

@@ -186,4 +188,4 @@ gl.readPixels(0, 0, this._framebufferWidth, this._framebufferHeight, gl.RGBA, gl.UNSIGNED_BYTE, pixelsView);

texture,
dataWidth: profile.dataWidth,
dataHeight: profile.dataHeight,
dataWidth,
dataHeight,
userFacing: this._computedFrontCameraRotation

@@ -190,0 +192,0 @@ };

@@ -1,2 +0,2 @@

import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
import { camera_profile_t, zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
import { CameraFrameInfo, Source } from "./source";

@@ -21,4 +21,6 @@ export declare class ImageBitmapCameraSource extends Source {

private _cameraModel;
private _profile;
constructor(_impl: zappar_camera_source_t, _pipeline: zappar_pipeline_t, _deviceId: string);
destroy(): void;
setProfile(p: camera_profile_t): void;
private _stop;

@@ -25,0 +27,0 @@ pause(): void;

@@ -10,2 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { camera_profile_t } from "./gen/zappar";
import { profile } from "./profile";

@@ -36,2 +37,3 @@ import { Pipeline } from "./pipeline";

this._cameraModel = new Float32Array([300, 300, 160, 120, 0, 0]);
this._profile = camera_profile_t.DEFAULT;
this._hasStartedOrientation = false;

@@ -90,2 +92,5 @@ this._lastTimestamp = -1;

}
setProfile(p) {
this._profile = p;
}
_stop() {

@@ -191,7 +196,8 @@ if (!this._currentStream)

return;
let focalLength = 300.0 * profile.dataWidth / 320.0;
const [dataWidth, dataHeight] = profile.getDataSize(this._profile);
let focalLength = 300.0 * dataWidth / 320.0;
this._cameraModel[0] = focalLength;
this._cameraModel[1] = focalLength;
this._cameraModel[2] = profile.dataWidth * 0.5;
this._cameraModel[3] = profile.dataHeight * 0.5;
this._cameraModel[2] = dataWidth * 0.5;
this._cameraModel[3] = dataHeight * 0.5;
let token = pipeline.registerToken({

@@ -206,3 +212,3 @@ dataWidth: this._canvas.width,

});
(_b = (_a = Pipeline.get(this._pipeline)) === null || _a === void 0 ? void 0 : _a.sendImageBitmapToWorker) === null || _b === void 0 ? void 0 : _b.call(_a, imageBitmap, rotation, this._isUserFacing, token, this._cameraModel, this._isUserFacing ? this._cameraToDeviceTransformUserFacing : this._cameraToDeviceTransform);
(_b = (_a = Pipeline.get(this._pipeline)) === null || _a === void 0 ? void 0 : _a.sendImageBitmapToWorker) === null || _b === void 0 ? void 0 : _b.call(_a, imageBitmap, rotation, this._isUserFacing, token, this._cameraModel, this._isUserFacing ? this._cameraToDeviceTransformUserFacing : this._cameraToDeviceTransform, this._profile);
return;

@@ -209,0 +215,0 @@ }

@@ -7,2 +7,2 @@ import { zappar } from "./gen/zappar";

export { CameraFrameData } from './camera-frame-data';
export { zappar_image_tracker_t, zappar_instant_world_tracker_t, zappar_world_tracker_t, zappar_barcode_finder_t, zappar_face_tracker_t, zappar_face_landmark_t, barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, zappar_face_mesh_t, zappar_pipeline_t, zappar_camera_source_t, zappar_sequence_source_t, image_target_type_t, world_tracker_quality_t } from "./gen/zappar";
export { zappar_image_tracker_t, zappar_instant_world_tracker_t, zappar_world_tracker_t, zappar_barcode_finder_t, zappar_face_tracker_t, zappar_face_landmark_t, zappar_zapcode_tracker_t, barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, zappar_face_mesh_t, zappar_pipeline_t, zappar_camera_source_t, zappar_sequence_source_t, image_target_type_t, world_tracker_quality_t, camera_profile_t } from "./gen/zappar";

@@ -7,2 +7,2 @@ import { initialize as nativeInitialize } from "./native";

}
export { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, image_target_type_t, world_tracker_quality_t } from "./gen/zappar";
export { barcode_format_t, face_landmark_name_t, instant_world_tracker_transform_orientation_t, log_level_t, image_target_type_t, world_tracker_quality_t, camera_profile_t } from "./gen/zappar";

@@ -1,2 +0,2 @@

import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
import { camera_profile_t, zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar";
import { CameraFrameInfo, Source } from "./source";

@@ -27,2 +27,3 @@ export declare class MSTPCameraSource extends Source {

private _syncCamera;
setProfile(profile: camera_profile_t): void;
private _hasStartedOrientation;

@@ -29,0 +30,0 @@ private _lastTimestamp;

@@ -252,2 +252,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
setProfile(profile) {
let p = Pipeline.get(this._pipeline);
if (p)
p.sendCameraProfileToWorker(this._impl, profile);
}
_startDeviceOrientation() {

@@ -254,0 +259,0 @@ if (this._hasStartedOrientation)

@@ -150,3 +150,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

});
client = Object.assign(Object.assign({}, c.impl), { loaded: () => loaded, camera_default_device_id: userFacing => userFacing ? CameraSource.USER_DEFAULT_DEVICE_ID : CameraSource.DEFAULT_DEVICE_ID, camera_source_create: (p, deviceId) => createCameraSource(p, deviceId), camera_source_destroy: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.destroy(); }, camera_source_pause: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.pause(); }, camera_source_start: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.start(); }, camera_count: () => 2, camera_id: indx => indx === 0 ? CameraSource.DEFAULT_DEVICE_ID : CameraSource.USER_DEFAULT_DEVICE_ID, camera_name: indx => indx === 0 ? "Rear-facing Camera" : "User-facing Camera", camera_user_facing: indx => indx !== 0, pose_from_raw: (raw_pose, mirror) => {
client = Object.assign(Object.assign({}, c.impl), { loaded: () => loaded, camera_default_device_id: userFacing => userFacing ? CameraSource.USER_DEFAULT_DEVICE_ID : CameraSource.DEFAULT_DEVICE_ID, camera_source_create: (p, deviceId) => createCameraSource(p, deviceId), camera_source_destroy: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.destroy(); }, camera_source_pause: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.pause(); }, camera_source_start: cam => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.start(); }, camera_source_profile_set: (cam, p) => { var _a; return (_a = getCameraSource(cam)) === null || _a === void 0 ? void 0 : _a.setProfile(p); }, camera_count: () => 2, camera_id: indx => indx === 0 ? CameraSource.DEFAULT_DEVICE_ID : CameraSource.USER_DEFAULT_DEVICE_ID, camera_name: indx => indx === 0 ? "Rear-facing Camera" : "User-facing Camera", camera_user_facing: indx => indx !== 0, pose_from_raw: (raw_pose, mirror) => {
let res = applyScreenCounterRotation(undefined, raw_pose);

@@ -381,2 +381,21 @@ if (mirror) {

return obj.getPreviewMesh(indx).normals.length;
}, zapcode_tracker_anchor_pose_camera_relative: (o, indx, mirror) => {
let res = applyScreenCounterRotation(undefined, c.impl.zapcode_tracker_anchor_pose_raw(o, indx));
if (mirror) {
let scale = mat4.create();
mat4.fromScaling(scale, [-1, 1, 1]);
mat4.multiply(res, scale, res);
mat4.multiply(res, res, scale);
}
return res;
}, zapcode_tracker_anchor_pose: (o, indx, cameraPose, mirror) => {
let res = applyScreenCounterRotation(undefined, c.impl.zapcode_tracker_anchor_pose_raw(o, indx));
if (mirror) {
let scale = mat4.create();
mat4.fromScaling(scale, [-1, 1, 1]);
mat4.multiply(res, scale, res);
mat4.multiply(res, res, scale);
}
mat4.multiply(res, cameraPose, res);
return res;
}, face_tracker_anchor_pose_camera_relative: (o, indx, mirror) => {

@@ -383,0 +402,0 @@ let res = applyScreenCounterRotation(undefined, c.impl.face_tracker_anchor_pose_raw(o, indx));

/// <reference types="dom-webcodecs" />
import { zappar_pipeline_t, zappar_camera_source_t } from "./gen/zappar";
import { camera_profile_t } from "./gen/zappar-native";
import { zappar_client } from "./gen/zappar-client";

@@ -77,6 +78,7 @@ import { MsgManager } from "./messages";

sendCameraStreamToWorker(source: zappar_camera_source_t, stream: ReadableStream<VideoFrame>, userFacing: boolean): void;
sendCameraProfileToWorker(source: zappar_camera_source_t, profile: camera_profile_t): void;
sendCameraToScreenRotationToWorker(rot: number): void;
sendImageBitmapToWorker(img: ImageBitmap, rot: number, userFacing: boolean, tokenId: number, cameraModel: Float32Array, cameraToDevice: Float32Array): void;
sendImageBitmapToWorker(img: ImageBitmap, rot: number, userFacing: boolean, tokenId: number, cameraModel: Float32Array, cameraToDevice: Float32Array, cp: camera_profile_t): void;
sendDataToWorker(data: ArrayBuffer, token: number, width: number, height: number, userFacing: boolean, cameraToDevice: Float32Array, cameraModel: Float32Array): void;
}
export declare function applyScreenCounterRotation(info: CameraFrameInfo | undefined, inp: Float32Array): Float32Array;

@@ -451,2 +451,11 @@ import { cameraFrameTextureMatrix, CameraDraw } from "./drawcamera";

}
sendCameraProfileToWorker(source, profile) {
let msg = {
t: "cameraProfileC2S",
p: this._impl,
source,
profile
};
this._mgr.postOutgoingMessage(msg, []);
}
sendCameraToScreenRotationToWorker(rot) {

@@ -460,3 +469,3 @@ let msg = {

}
sendImageBitmapToWorker(img, rot, userFacing, tokenId, cameraModel, cameraToDevice) {
sendImageBitmapToWorker(img, rot, userFacing, tokenId, cameraModel, cameraToDevice, cp) {
let msg = {

@@ -470,3 +479,4 @@ p: this._impl,

cameraModel,
cameraToDevice
cameraToDevice,
cp
};

@@ -473,0 +483,0 @@ this._mgr.postOutgoingMessage(msg, [img]);

@@ -0,1 +1,2 @@

import { camera_profile_t } from "./gen/zappar-native";
export declare enum EmbeddedVideoImplementation {

@@ -13,4 +14,3 @@ OBJECT_URL = 0,

videoHeight: number;
dataWidth: number;
dataHeight: number;
getDataSize: (p: camera_profile_t) => number[];
videoElementInDOM: boolean;

@@ -17,0 +17,0 @@ preferMediaStreamTrackProcessorCamera: boolean;

import * as UAParser from "ua-parser-js";
import { camera_profile_t } from "./gen/zappar-native";
export var EmbeddedVideoImplementation;

@@ -15,4 +16,3 @@ (function (EmbeddedVideoImplementation) {

videoHeight: 480,
dataWidth: 320,
dataHeight: 240,
getDataSize: (p) => p === camera_profile_t.HIGH ? [640, 480] : [320, 240],
videoElementInDOM: false,

@@ -84,3 +84,3 @@ preferMediaStreamTrackProcessorCamera: true,

profile.videoHeight = 360;
profile.dataHeight = 180;
profile.getDataSize = (p) => p === camera_profile_t.HIGH ? [640, 360] : [320, 180];
}

@@ -87,0 +87,0 @@ }

@@ -1,1 +0,1 @@

export declare const VERSION = "3.0.1-alpha.5";
export declare const VERSION = "3.0.1-alpha.7";

@@ -1,1 +0,1 @@

export const VERSION = "3.0.1-alpha.5";
export const VERSION = "3.0.1-alpha.7";

@@ -37,8 +37,9 @@ import { ImageProcessGL } from "./image-process-gl";

return;
if (!pixels || pixels.byteLength < profile.dataWidth * profile.dataHeight) {
const [dataWidth, dataHeight] = profile.getDataSize(m.cp);
if (!pixels || pixels.byteLength < dataWidth * dataHeight) {
// console.log("Generating pixel buffer", profile.dataWidth * profile.dataHeight);
pixels = new ArrayBuffer(profile.dataWidth * profile.dataHeight);
pixels = new ArrayBuffer(dataWidth * dataHeight);
}
imageProcessor.uploadFrame(texture, m.i, m.r, m.userFacing);
let info = imageProcessor.readFrame(texture, pixels);
imageProcessor.uploadFrame(texture, m.i, m.r, m.userFacing, m.cp);
let info = imageProcessor.readFrame(texture, pixels, m.cp);
let msg = {

@@ -45,0 +46,0 @@ t: "imageBitmapS2C",

@@ -15,5 +15,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import { mat4 } from "gl-matrix";
import { frame_pixel_format_t } from "./gen/zappar-native";
import { camera_profile_t, frame_pixel_format_t } from "./gen/zappar-native";
import { handleImageBitmap } from "./worker-imagebitmap";
import { profile } from "./profile";
import { getWorkerMessageAPI } from "./worker-messages";

@@ -26,2 +25,3 @@ import { getDataDownloadAPI } from "./data-download";

const rawCameraFrameBuffersByPipeline = new Map();
const cameraProfileBySource = new Map();
export function launchWorkerServer(wasmUrl, module, shouldRecordData) {

@@ -104,2 +104,7 @@ return __awaiter(this, void 0, void 0, function* () {

}
case "cameraProfileC2S": {
let msgt = msg;
cameraProfileBySource.set(msgt.source, msgt.p);
break;
}
case "streamC2S": {

@@ -256,2 +261,8 @@ let msgt = msg;

}
let downSample = false;
if (cameraProfileBySource.get(source) !== camera_profile_t.HIGH) {
dataWidth /= 2;
dataHeight /= 2;
downSample = true;
}
let clone = frame.clone();

@@ -262,7 +273,7 @@ if (userFacing)

mat4.identity(cameraToDeviceTransform);
let focalLength = 300.0 * profile.dataWidth / 320.0;
let focalLength = 300.0 * dataWidth / 320.0;
cameraModel[0] = focalLength;
cameraModel[1] = focalLength;
cameraModel[2] = profile.dataWidth * 0.5;
cameraModel[3] = profile.dataHeight * 0.5;
cameraModel[2] = dataWidth * 0.5;
cameraModel[3] = dataHeight * 0.5;
const ret = {

@@ -275,4 +286,4 @@ token: token,

uvTransform,
w: profile.dataWidth,
h: profile.dataHeight,
w: dataWidth,
h: dataHeight,
cameraToDevice: cameraToDeviceTransform,

@@ -286,3 +297,3 @@ cameraModel,

try {
r.pipeline_camera_frame_submit_raw_pointer(pipeline, streamDataBufferPointer, size, framePixelFormatFromFormat(frame.format), width, height, token, cameraToDeviceTransform, latestCameraToScreenRotation, cameraModel, userFacing, (_b = frame.timestamp) !== null && _b !== void 0 ? _b : -1);
r.pipeline_camera_frame_submit_raw_pointer(pipeline, streamDataBufferPointer, size, framePixelFormatFromFormat(frame.format), width, height, token, cameraToDeviceTransform, latestCameraToScreenRotation, cameraModel, userFacing, (_b = frame.timestamp) !== null && _b !== void 0 ? _b : -1, downSample);
handleMessages(mod, workerMessageAPI);

@@ -289,0 +300,0 @@ if (dataDownloadAPI)

/// <reference types="dom-webcodecs" />
import { CameraFrameData } from "./camera-frame-data";
import { zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar-native";
import { camera_profile_t, zappar_camera_source_t, zappar_pipeline_t } from "./gen/zappar-native";
export interface CameraFrameC2S {

@@ -42,2 +42,8 @@ t: "cameraFrameC2S";

}
export interface CameraProfileC2S {
t: "cameraProfileC2S";
p: zappar_pipeline_t;
source: zappar_camera_source_t;
profile: camera_profile_t;
}
export interface CameraToScreenRotationC2S {

@@ -57,2 +63,3 @@ t: "cameraToScreenC2S";

cameraToDevice: Float32Array;
cp: camera_profile_t;
}

@@ -59,0 +66,0 @@ export interface ImageBitmapS2C {

{
"name": "@zappar/zappar-cv",
"version": "3.0.1-alpha.5",
"version": "3.0.1-alpha.7",
"description": "Zappar's core computer vision library, supporting image, face and world tracking.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -21,6 +21,6 @@ # Zappar CV

```
<script src="https://libs.zappar.com/zappar-cv/3.0.1-alpha.5/zappar-cv.js"></script>
<script src="https://libs.zappar.com/zappar-cv/3.0.1-alpha.7/zappar-cv.js"></script>
```
Or you can download and host our standalone JavaScript bundle:
[https://libs.zappar.com/zappar-cv/3.0.1-alpha.5/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.1-alpha.5/zappar-cv.zip)
[https://libs.zappar.com/zappar-cv/3.0.1-alpha.7/zappar-cv.zip](https://libs.zappar.com/zappar-cv/3.0.1-alpha.7/zappar-cv.zip)

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ZCV=t():e.ZCV=t()}(self,(()=>(()=>{"use strict";var e,t,r={152:(e,t,r)=>{var a=r(581);class i{constructor(e){this._messageSender=e,this._freeBufferPool=[],this._buffer=new ArrayBuffer(16),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1,this._timeoutSet=!1,this._appender={int:e=>this.int(e),bool:e=>this.int(e?1:0),float:e=>this.float(e),string:e=>this.string(e),dataWithLength:e=>this.arrayBuffer(e),type:e=>this.int(e),matrix4x4:e=>this.float32ArrayBuffer(e),matrix3x3:e=>this.float32ArrayBuffer(e),floatArray:e=>this.float32ArrayBuffer(e),identityCoefficients:e=>this.float32ArrayBuffer(e),expressionCoefficients:e=>this.float32ArrayBuffer(e),cameraModel:e=>this.float32ArrayBuffer(e),timestamp:e=>this.double(e),barcodeFormat:e=>this.int(e),faceLandmarkName:e=>this.int(e),instantTrackerTransformOrientation:e=>this.int(e),logLevel:e=>this.int(e)},this._freeBufferPool.push(new ArrayBuffer(16)),this._freeBufferPool.push(new ArrayBuffer(16))}bufferReturn(e){this._freeBufferPool.push(e)}_ensureArrayBuffer(e){let t,r=4*(this._offset+e+8);if(this._buffer&&this._buffer.byteLength>=r)return;if(!t){let e=r;e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,t=new ArrayBuffer(e)}let a=this._buffer?this._i32View:void 0;this._buffer=t,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),a&&this._i32View.set(a.subarray(0,this._offset))}sendMessage(e,t){this._ensureArrayBuffer(4),this._startOffset=this._offset,this._i32View[this._offset+1]=e,this._offset+=2,t(this._appender),this._i32View[this._startOffset]=this._offset-this._startOffset,this._startOffset=-1,this._sendOneTime()}_sendOneTime(){!1===this._timeoutSet&&(this._timeoutSet=!0,setTimeout((()=>{this._timeoutSet=!1,this._send()}),0))}_send(){0!==this._freeBufferPool.length?(this._i32View[0]=this._offset,this._messageSender(this._buffer),this._buffer=void 0,this._buffer=this._freeBufferPool.pop(),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1):this._sendOneTime()}int(e){this._ensureArrayBuffer(1),this._i32View[this._offset]=e,this._offset++}double(e){this._ensureArrayBuffer(2),this._offset%2==1&&this._offset++,this._f64View[this._offset/2]=e,this._offset+=2}float(e){this._ensureArrayBuffer(1),this._f32View[this._offset]=e,this._offset++}int32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t];this._offset+=e.length}float32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._f32View[this._offset+t]=e[t];this._offset+=e.length}booleanArray(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t]?1:0;this._offset+=e.length}uint8ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8View.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}arrayBuffer(e){let t=new Uint8Array(e);this.uint8ArrayBuffer(t)}uint8ClampedArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8cView.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}float32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._f32View.set(e,this._offset),this._offset+=e.length}uint16ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++;let t=2*this._offset;this._u16View.set(e,t),this._offset+=e.length>>1,0!=(1&e.length)&&this._offset++}int32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._i32View.set(e,this._offset),this._offset+=e.length}uint32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._u32View.set(e,this._offset),this._offset+=e.length}string(e){let t=(new TextEncoder).encode(e);this._ensureArrayBuffer(t.byteLength/4),this._i32View[this._offset]=t.byteLength,this._offset++,this._u8View.set(t,4*this._offset),this._offset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._offset++}}class _{constructor(){this._buffer=new ArrayBuffer(0),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,this._startOffset=-1,this._processor={int:()=>this._i32View[this._startOffset++],bool:()=>1===this._i32View[this._startOffset++],type:()=>this._i32View[this._startOffset++],float:()=>this._f32View[this._startOffset++],timestamp:()=>{this._startOffset%2==1&&this._startOffset++;let e=this._f64View[this._startOffset/2];return this._startOffset+=2,e},string:()=>{let e=this._i32View[this._startOffset++],t=(new TextDecoder).decode(new Uint8Array(this._buffer,4*this._startOffset,e));return this._startOffset+=e>>2,0!=(3&e)&&this._startOffset++,t},dataWithLength:()=>{let e=this._i32View[this._startOffset++],t=new Uint8Array(e);return t.set(this._u8View.subarray(4*this._startOffset,4*this._startOffset+e)),this._startOffset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._startOffset++,t.buffer},floatArray:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+e)),this._startOffset+=e,t},matrix4x4:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+16)),this._startOffset+=e,t},matrix3x3:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+9)),this._startOffset+=e,t},identityCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+50)),this._startOffset+=e,t},expressionCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+29)),this._startOffset+=e,t},cameraModel:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+6)),this._startOffset+=e,t},barcodeFormat:()=>this._i32View[this._startOffset++],faceLandmarkName:()=>this._i32View[this._startOffset++],instantTrackerTransformOrientation:()=>this._i32View[this._startOffset++],logLevel:()=>this._i32View[this._startOffset++]}}setData(e){this._buffer=e,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,e.byteLength>=4&&(this._offset=1,this._length=this._i32View[0]),this._startOffset=-1}hasMessage(){return this._offset+1<this._length}forMessages(e){for(;this.hasMessage();){let t=this._i32View[this._offset],r=this._i32View[this._offset+1];this._startOffset=this._offset+2,this._offset+=t,e(r,this._processor)}}}class n{constructor(e,t){this._impl=e,this._sender=t,this._deserializer=new _,this.serializersByPipelineId=new Map,this._pipeline_id_by_pipeline_id=new Map,this._pipeline_by_instance=new Map,this._pipeline_id_by_camera_source_id=new Map,this._camera_source_by_instance=new Map,this._pipeline_id_by_sequence_source_id=new Map,this._sequence_source_by_instance=new Map,this._pipeline_id_by_image_tracker_id=new Map,this._image_tracker_by_instance=new Map,this._pipeline_id_by_face_tracker_id=new Map,this._face_tracker_by_instance=new Map,this._pipeline_id_by_face_mesh_id=new Map,this._face_mesh_by_instance=new Map,this._pipeline_id_by_face_landmark_id=new Map,this._face_landmark_by_instance=new Map,this._pipeline_id_by_barcode_finder_id=new Map,this._barcode_finder_by_instance=new Map,this._pipeline_id_by_instant_world_tracker_id=new Map,this._instant_world_tracker_by_instance=new Map,this._pipeline_id_by_world_tracker_id=new Map,this._world_tracker_by_instance=new Map}processBuffer(e){this._deserializer.setData(e),this._deserializer.forMessages(((e,t)=>{switch(e){case 38:this._impl.log_level_set(t.logLevel());break;case 35:this._impl.analytics_project_id_set(t.string(),t.string());break;case 31:{let e=t.type(),r=this._impl.pipeline_create();this._pipeline_by_instance.set(e,r),this._pipeline_id_by_pipeline_id.set(e,e),this.serializersByPipelineId.set(e,new i((t=>{this._sender(e,t)})));break}case 32:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_destroy(r),this._pipeline_by_instance.delete(e);break}case 9:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_frame_update(r);break}case 8:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_camera_frame_submit(r,t.dataWithLength(),t.int(),t.int(),t.int(),t.matrix4x4(),t.cameraModel(),t.bool());break}case 10:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 12:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_with_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 11:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_without_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 15:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 13:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 16:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 14:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 17:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_matrix_submit(r,t.matrix4x4());break}case 33:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=t.string(),_=this._impl.camera_source_create(a,i);this._camera_source_by_instance.set(e,_),this._pipeline_id_by_camera_source_id.set(e,r);break}case 34:{let e=t.type(),r=this._camera_source_by_instance.get(e);if(void 0===r)return;this._impl.camera_source_destroy(r),this._camera_source_by_instance.delete(e);break}case 39:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.sequence_source_create(a);this._sequence_source_by_instance.set(e,i),this._pipeline_id_by_sequence_source_id.set(e,r);break}case 40:{let e=t.type(),r=this._sequence_source_by_instance.get(e);if(void 0===r)return;this._impl.sequence_source_destroy(r),this._sequence_source_by_instance.delete(e);break}case 2:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.image_tracker_create(a);this._image_tracker_by_instance.set(e,i),this._pipeline_id_by_image_tracker_id.set(e,r);break}case 18:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_destroy(r),this._image_tracker_by_instance.delete(e);break}case 4:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_target_load_from_memory(r,t.dataWithLength());break}case 3:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_enabled_set(r,t.bool());break}case 24:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.face_tracker_create(a);this._face_tracker_by_instance.set(e,i),this._pipeline_id_by_face_tracker_id.set(e,r);break}case 25:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_destroy(r),this._face_tracker_by_instance.delete(e);break}case 26:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_model_load_from_memory(r,t.dataWithLength());break}case 27:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_enabled_set(r,t.bool());break}case 28:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_max_faces_set(r,t.int());break}case 29:{let e=t.type(),r=this._impl.face_mesh_create();this._face_mesh_by_instance.set(e,r);break}case 30:{let e=t.type(),r=this._face_mesh_by_instance.get(e);if(void 0===r)return;this._impl.face_mesh_destroy(r),this._face_mesh_by_instance.delete(e);break}case 36:{let e=t.type(),r=t.faceLandmarkName(),a=this._impl.face_landmark_create(r);this._face_landmark_by_instance.set(e,a);break}case 37:{let e=t.type(),r=this._face_landmark_by_instance.get(e);if(void 0===r)return;this._impl.face_landmark_destroy(r),this._face_landmark_by_instance.delete(e);break}case 20:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.barcode_finder_create(a);this._barcode_finder_by_instance.set(e,i),this._pipeline_id_by_barcode_finder_id.set(e,r);break}case 21:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_destroy(r),this._barcode_finder_by_instance.delete(e);break}case 22:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_enabled_set(r,t.bool());break}case 23:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_formats_set(r,t.barcodeFormat());break}case 5:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.instant_world_tracker_create(a);this._instant_world_tracker_by_instance.set(e,i),this._pipeline_id_by_instant_world_tracker_id.set(e,r);break}case 19:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_destroy(r),this._instant_world_tracker_by_instance.delete(e);break}case 6:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_enabled_set(r,t.bool());break}case 7:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(r,t.float(),t.float(),t.float(),t.instantTrackerTransformOrientation());break}case 41:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.world_tracker_create(a);this._world_tracker_by_instance.set(e,i),this._pipeline_id_by_world_tracker_id.set(e,r);break}case 42:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_destroy(r),this._world_tracker_by_instance.delete(e);break}case 43:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_enabled_set(r,t.bool());break}case 44:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_reset(r);break}case 45:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_debug_enabled_set(r,t.bool());break}}}))}exploreState(){for(let[e,t]of this._pipeline_by_instance){let r=this._pipeline_id_by_pipeline_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&(a.sendMessage(7,(r=>{r.type(e),r.int(this._impl.pipeline_frame_number(t))})),a.sendMessage(6,(r=>{r.type(e),r.cameraModel(this._impl.pipeline_camera_model(t))})),a.sendMessage(5,(r=>{r.type(e),r.int(this._impl.pipeline_camera_frame_user_data(t))})),a.sendMessage(11,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_camera_attitude(t))})),a.sendMessage(12,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_device_attitude(t))})))}for(let[e,t]of this._camera_source_by_instance){let t=this._pipeline_id_by_camera_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._sequence_source_by_instance){let t=this._pipeline_id_by_sequence_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._image_tracker_by_instance){let r=this._pipeline_id_by_image_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(19,(r=>{r.type(e),r.int(this._impl.image_tracker_target_loaded_version(t))})),a.sendMessage(1,(r=>{r.type(e),r.int(this._impl.image_tracker_anchor_count(t))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(2,(a=>{a.type(e),a.int(r),a.string(this._impl.image_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(3,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.image_tracker_anchor_pose_raw(t,r))}))}}for(let[e,t]of this._face_tracker_by_instance){let r=this._pipeline_id_by_face_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(18,(r=>{r.type(e),r.int(this._impl.face_tracker_model_loaded_version(t))})),a.sendMessage(13,(r=>{r.type(e),r.int(this._impl.face_tracker_anchor_count(t))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(14,(a=>{a.type(e),a.int(r),a.string(this._impl.face_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(15,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.face_tracker_anchor_pose_raw(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(16,(a=>{a.type(e),a.int(r),a.identityCoefficients(this._impl.face_tracker_anchor_identity_coefficients(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(17,(a=>{a.type(e),a.int(r),a.expressionCoefficients(this._impl.face_tracker_anchor_expression_coefficients(t,r))}))}}for(let[e,t]of this._face_mesh_by_instance){let t=this._pipeline_id_by_face_mesh_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._face_landmark_by_instance){let t=this._pipeline_id_by_face_landmark_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._barcode_finder_by_instance){let r=this._pipeline_id_by_barcode_finder_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(8,(r=>{r.type(e),r.int(this._impl.barcode_finder_found_number(t))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(9,(a=>{a.type(e),a.int(r),a.string(this._impl.barcode_finder_found_text(t,r))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(10,(a=>{a.type(e),a.int(r),a.barcodeFormat(this._impl.barcode_finder_found_format(t,r))}))}}for(let[e,t]of this._instant_world_tracker_by_instance){let r=this._pipeline_id_by_instant_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&a.sendMessage(4,(r=>{r.type(e),r.matrix4x4(this._impl.instant_world_tracker_anchor_pose_raw(t))}))}for(let[e,t]of this._world_tracker_by_instance){let r=this._pipeline_id_by_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(27,(r=>{r.type(e),r.int(this._impl.world_tracker_quality(t))})),a.sendMessage(21,(r=>{r.type(e),r.int(this._impl.world_tracker_plane_count(t))}));for(let r=0;r<this._impl.world_tracker_plane_count(t);r++)a.sendMessage(22,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.world_tracker_plane_pose_raw(t,r))}));a.sendMessage(23,(r=>{r.type(e),r.bool(this._impl.world_tracker_world_anchor_valid(t))})),a.sendMessage(24,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_world_anchor_pose_raw(t))})),a.sendMessage(23,(r=>{r.type(e),r.bool(this._impl.world_tracker_ground_anchor_valid(t))})),a.sendMessage(26,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(t))})),a.sendMessage(29,(r=>{r.type(e),r.int(this._impl.world_tracker_debug_tracks_data_size(t))})),a.sendMessage(28,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_debug_tracks_data(t))})),a.sendMessage(31,(r=>{r.type(e),r.int(this._impl.world_tracker_debug_projections_data_size(t))})),a.sendMessage(30,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_debug_projections_data(t))}))}}}}class s{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(){for(var e=0,t=this._funcs.length;e<t;e++)this._funcs[e]()}}class o{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(e){for(var t=0,r=this._funcs.length;t<r;t++)this._funcs[t](e)}}var c,f,l,u,p,d,h,m=r(975);!function(e){e[e.UNKNOWN=131072]="UNKNOWN",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=4]="CODE_39",e[e.CODE_93=8]="CODE_93",e[e.CODE_128=16]="CODE_128",e[e.DATA_MATRIX=32]="DATA_MATRIX",e[e.EAN_8=64]="EAN_8",e[e.EAN_13=128]="EAN_13",e[e.ITF=256]="ITF",e[e.MAXICODE=512]="MAXICODE",e[e.PDF_417=1024]="PDF_417",e[e.QR_CODE=2048]="QR_CODE",e[e.RSS_14=4096]="RSS_14",e[e.RSS_EXPANDED=8192]="RSS_EXPANDED",e[e.UPC_A=16384]="UPC_A",e[e.UPC_E=32768]="UPC_E",e[e.UPC_EAN_EXTENSION=65536]="UPC_EAN_EXTENSION",e[e.ALL=131071]="ALL"}(c||(c={})),function(e){e[e.EYE_LEFT=0]="EYE_LEFT",e[e.EYE_RIGHT=1]="EYE_RIGHT",e[e.EAR_LEFT=2]="EAR_LEFT",e[e.EAR_RIGHT=3]="EAR_RIGHT",e[e.NOSE_BRIDGE=4]="NOSE_BRIDGE",e[e.NOSE_TIP=5]="NOSE_TIP",e[e.NOSE_BASE=6]="NOSE_BASE",e[e.LIP_TOP=7]="LIP_TOP",e[e.LIP_BOTTOM=8]="LIP_BOTTOM",e[e.MOUTH_CENTER=9]="MOUTH_CENTER",e[e.CHIN=10]="CHIN",e[e.EYEBROW_LEFT=11]="EYEBROW_LEFT",e[e.EYEBROW_RIGHT=12]="EYEBROW_RIGHT"}(f||(f={})),function(e){e[e.WORLD=3]="WORLD",e[e.MINUS_Z_AWAY_FROM_USER=4]="MINUS_Z_AWAY_FROM_USER",e[e.MINUS_Z_HEADING=5]="MINUS_Z_HEADING",e[e.UNCHANGED=6]="UNCHANGED"}(l||(l={})),function(e){e[e.LOG_LEVEL_NONE=0]="LOG_LEVEL_NONE",e[e.LOG_LEVEL_ERROR=1]="LOG_LEVEL_ERROR",e[e.LOG_LEVEL_WARNING=2]="LOG_LEVEL_WARNING",e[e.LOG_LEVEL_VERBOSE=3]="LOG_LEVEL_VERBOSE"}(u||(u={})),function(e){e[e.FRAME_PIXEL_FORMAT_I420=0]="FRAME_PIXEL_FORMAT_I420",e[e.FRAME_PIXEL_FORMAT_I420A=1]="FRAME_PIXEL_FORMAT_I420A",e[e.FRAME_PIXEL_FORMAT_I422=2]="FRAME_PIXEL_FORMAT_I422",e[e.FRAME_PIXEL_FORMAT_I444=3]="FRAME_PIXEL_FORMAT_I444",e[e.FRAME_PIXEL_FORMAT_NV12=4]="FRAME_PIXEL_FORMAT_NV12",e[e.FRAME_PIXEL_FORMAT_RGBA=5]="FRAME_PIXEL_FORMAT_RGBA",e[e.FRAME_PIXEL_FORMAT_BGRA=6]="FRAME_PIXEL_FORMAT_BGRA",e[e.FRAME_PIXEL_FORMAT_Y=7]="FRAME_PIXEL_FORMAT_Y"}(p||(p={})),function(e){e[e.IMAGE_TRACKER_TYPE_PLANAR=0]="IMAGE_TRACKER_TYPE_PLANAR",e[e.IMAGE_TRACKER_TYPE_CYLINDRICAL=1]="IMAGE_TRACKER_TYPE_CYLINDRICAL",e[e.IMAGE_TRACKER_TYPE_CONICAL=2]="IMAGE_TRACKER_TYPE_CONICAL"}(d||(d={})),function(e){e[e.WORLD_TRACKER_QUALITY_INITIALIZING=0]="WORLD_TRACKER_QUALITY_INITIALIZING",e[e.WORLD_TRACKER_QUALITY_GOOD=1]="WORLD_TRACKER_QUALITY_GOOD",e[e.WORLD_TRACKER_QUALITY_ORIENTATION_ONLY=2]="WORLD_TRACKER_QUALITY_ORIENTATION_ONLY"}(h||(h={}));const b=new Map;class g{constructor(e){this._gl=e,this._viewports=[],this._underlyingViewport=this._gl.viewport,this._viewports.push(this._gl.getParameter(this._gl.VIEWPORT)),this._gl.viewport=(e,t,r,a)=>{this._viewports[this._viewports.length-1]=[e,t,r,a],this._underlyingViewport.call(this._gl,e,t,r,a)}}static get(e){let t=b.get(e);return t||(t=new g(e),b.set(e,t)),t}push(){this._viewports.push(this._viewports[this._viewports.length-1])}pop(){const e=this._viewports.pop(),t=this._viewports[this._viewports.length-1];e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]||this._underlyingViewport.call(this._gl,t[0],t[1],t[2],t[3])}}var w,y=r(238);!function(e){e[e.OBJECT_URL=0]="OBJECT_URL",e[e.SRC_OBJECT=1]="SRC_OBJECT"}(w||(w={}));let A={deviceMotionMutliplier:-1,blacklisted:!1,showGyroPermissionsWarningIfNecessary:!1,showSafariPermissionsResetIfNecessary:!1,requestHighFrameRate:!1,videoWidth:640,videoHeight:480,dataWidth:320,dataHeight:240,videoElementInDOM:!1,preferMediaStreamTrackProcessorCamera:!0,preferImageBitmapCamera:!1,ios164CameraSelection:!1,relyOnConstraintsForCameraSelection:!1,forceWindowOrientation:!1,intervalMultiplier:1,trustSensorIntervals:!1};"undefined"!=typeof window&&(window.zeeProfile=A,window.location.href.indexOf("_mstppipeline")>=0&&(console.log("Configuring for MSTP camera pipeline (if supported)"),A.preferMediaStreamTrackProcessorCamera=!0),window.location.href.indexOf("_imagebitmappipeline")>=0&&(console.log("Configuring for ImageBitmap camera pipeline (if supported)"),A.preferImageBitmapCamera=!0));let E=new y.UAParser,T=(E.getOS().name||"unknown").toLowerCase(),R=(E.getEngine().name||"unknown").toLowerCase();function k(e){A.forceWindowOrientation=!0,A.preferMediaStreamTrackProcessorCamera=!1,A.intervalMultiplier=1e3,A.trustSensorIntervals=!0;let t=e.split(".");if(t.length>=2){const e=parseInt(t[0]),r=parseInt(t[1]);(e<11||11===e&&r<3)&&(A.blacklisted=!0),(e<12||12===e&&r<2)&&(A.videoElementInDOM=!0),(12===e&&r>=2||e>=13)&&(A.showGyroPermissionsWarningIfNecessary=!0),e>=13&&(A.showSafariPermissionsResetIfNecessary=!0),(e>=12&&r>1||e>=13)&&navigator.mediaDevices&&navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints().frameRate&&(A.requestHighFrameRate=!0,e<14&&(A.videoHeight=360,A.dataHeight=180)),16===e&&r>=4&&(A.ios164CameraSelection=!0),e>=17&&(A.relyOnConstraintsForCameraSelection=!0)}}function v(e,t,r){let a=e.createShader(t);if(!a)throw new Error("Unable to create shader");e.shaderSource(a,r),e.compileShader(a);let i=e.getShaderInfoLog(a);if(i&&i.trim().length>0)throw new Error("Shader compile error: "+i);return a}"webkit"===R&&"ios"!==T&&(A.deviceMotionMutliplier=1,"undefined"!=typeof window&&void 0!==window.orientation&&k("15.0")),"webkit"===R&&"ios"===T&&(A.deviceMotionMutliplier=1,k(E.getOS().version||"15.0"));class x{constructor(e){this._gl=e,this._isPaused=!0,this._hadFrames=!1,this._isUserFacing=!1,this._cameraToScreenRotation=0,this._isUploadFrame=!0,this._computedTransformRotation=-1,this._computedFrontCameraRotation=!1,this._cameraUvTransform=m.Ue(),this._framebufferWidth=0,this._framebufferHeight=0,this._framebufferId=null,this._renderTexture=null,this._isWebGL2=!1,this._isWebGL2=e.getParameter(e.VERSION).indexOf("WebGL 2")>=0,this._isWebGL2||(this._instancedArraysExtension=this._gl.getExtension("ANGLE_instanced_arrays"))}resetGLContext(){this._framebufferId=null,this._renderTexture=null,this._vertexBuffer=void 0,this._indexBuffer=void 0,this._greyscaleShader=void 0}destroy(){this.resetGLContext()}uploadFrame(e,t,r,a){let i=this._gl;const _=g.get(i);_.push();const n=i.isEnabled(i.SCISSOR_TEST),s=i.isEnabled(i.DEPTH_TEST),o=i.isEnabled(i.BLEND),c=i.isEnabled(i.CULL_FACE),f=i.isEnabled(i.STENCIL_TEST),l=i.getParameter(i.ACTIVE_TEXTURE),u=i.getParameter(i.UNPACK_FLIP_Y_WEBGL),p=i.getParameter(i.CURRENT_PROGRAM);i.activeTexture(i.TEXTURE0);const d=i.getParameter(i.TEXTURE_BINDING_2D),h=i.getParameter(i.FRAMEBUFFER_BINDING),m=i.getParameter(i.ARRAY_BUFFER_BINDING),b=i.getParameter(i.ELEMENT_ARRAY_BUFFER_BINDING);i.disable(i.SCISSOR_TEST),i.disable(i.DEPTH_TEST),i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.STENCIL_TEST),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.bindTexture(i.TEXTURE_2D,e);const w=i.RGBA,y=i.RGBA,E=i.UNSIGNED_BYTE;i.texImage2D(i.TEXTURE_2D,0,w,y,E,t);let T=0,R=0;"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?(T=t.videoWidth,R=t.videoHeight):(T=t.width,R=t.height),R>T&&(R=[T,T=R][0]),this._updateTransforms(r,a);let k=this._getFramebuffer(i,A.dataWidth/4,A.dataHeight),v=this._getVertexBuffer(i),x=this._getIndexBuffer(i),L=this._getGreyscaleShader(i);const F=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_SIZE),I=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_TYPE),O=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_NORMALIZED),M=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_STRIDE),B=i.getVertexAttribOffset(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_POINTER),P=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_ENABLED),V=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),C=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_SIZE),U=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_TYPE),S=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_NORMALIZED),z=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_STRIDE),N=i.getVertexAttribOffset(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_POINTER),D=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),G=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_ENABLED);let W=0,X=0;this._isWebGL2?(W=i.getVertexAttrib(L.aVertexPositionLoc,i.VERTEX_ATTRIB_ARRAY_DIVISOR),X=i.getVertexAttrib(L.aTextureCoordLoc,i.VERTEX_ATTRIB_ARRAY_DIVISOR),i.vertexAttribDivisor(L.aVertexPositionLoc,0),i.vertexAttribDivisor(L.aTextureCoordLoc,0)):this._instancedArraysExtension&&(W=i.getVertexAttrib(L.aVertexPositionLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),X=i.getVertexAttrib(L.aTextureCoordLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),this._instancedArraysExtension.vertexAttribDivisorANGLE(L.aVertexPositionLoc,0),this._instancedArraysExtension.vertexAttribDivisorANGLE(L.aTextureCoordLoc,0)),i.bindFramebuffer(i.FRAMEBUFFER,k),i.viewport(0,0,this._framebufferWidth,this._framebufferHeight),i.clear(i.COLOR_BUFFER_BIT),i.bindBuffer(i.ARRAY_BUFFER,v),i.vertexAttribPointer(L.aVertexPositionLoc,2,i.FLOAT,!1,16,0),i.enableVertexAttribArray(L.aVertexPositionLoc),i.vertexAttribPointer(L.aTextureCoordLoc,2,i.FLOAT,!1,16,8),i.enableVertexAttribArray(L.aTextureCoordLoc),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,x),i.useProgram(L.program),i.uniform1f(L.uTexWidthLoc,A.dataWidth),i.uniformMatrix4fv(L.uUvTransformLoc,!1,this._cameraUvTransform),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,e),i.uniform1i(L.uSamplerLoc,0),i.drawElements(i.TRIANGLES,6,i.UNSIGNED_SHORT,0),i.bindBuffer(i.ARRAY_BUFFER,V),i.vertexAttribPointer(L.aVertexPositionLoc,F,I,O,M,B),i.bindBuffer(i.ARRAY_BUFFER,D),i.vertexAttribPointer(L.aTextureCoordLoc,C,U,S,z,N),i.bindBuffer(i.ARRAY_BUFFER,m),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,b),P||i.disableVertexAttribArray(L.aVertexPositionLoc),G||i.disableVertexAttribArray(L.aTextureCoordLoc),this._isWebGL2?(i.vertexAttribDivisor(L.aVertexPositionLoc,W),i.vertexAttribDivisor(L.aTextureCoordLoc,X)):this._instancedArraysExtension&&(this._instancedArraysExtension.vertexAttribDivisorANGLE(L.aVertexPositionLoc,W),this._instancedArraysExtension.vertexAttribDivisorANGLE(L.aTextureCoordLoc,X)),i.bindFramebuffer(i.FRAMEBUFFER,h),i.useProgram(p),i.bindTexture(i.TEXTURE_2D,d),i.activeTexture(l),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,u),_.pop(),o&&i.enable(i.BLEND),c&&i.enable(i.CULL_FACE),s&&i.enable(i.DEPTH_TEST),n&&i.enable(i.SCISSOR_TEST),f&&i.enable(i.STENCIL_TEST)}readFrame(e,t){let r=this._gl,a=new Uint8Array(t);const i=r.getParameter(r.FRAMEBUFFER_BINDING);let _=this._getFramebuffer(r,A.dataWidth/4,A.dataHeight);return r.bindFramebuffer(r.FRAMEBUFFER,_),r.readPixels(0,0,this._framebufferWidth,this._framebufferHeight,r.RGBA,r.UNSIGNED_BYTE,a),r.bindFramebuffer(r.FRAMEBUFFER,i),{uvTransform:this._cameraUvTransform,data:t,texture:e,dataWidth:A.dataWidth,dataHeight:A.dataHeight,userFacing:this._computedFrontCameraRotation}}_updateTransforms(e,t){e==this._computedTransformRotation&&t==this._computedFrontCameraRotation||(this._computedTransformRotation=e,this._computedFrontCameraRotation=t,this._cameraUvTransform=this._getCameraUvTransform())}_getCameraUvTransform(){switch(this._computedTransformRotation){case 270:return new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]);case 180:return new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);case 90:return new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1])}return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}_getFramebuffer(e,t,r){if(this._framebufferWidth===t&&this._framebufferHeight===r&&this._framebufferId)return this._framebufferId;if(this._framebufferId&&(e.deleteFramebuffer(this._framebufferId),this._framebufferId=null),this._renderTexture&&(e.deleteTexture(this._renderTexture),this._renderTexture=null),this._framebufferId=e.createFramebuffer(),!this._framebufferId)throw new Error("Unable to create framebuffer");if(e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferId),this._renderTexture=e.createTexture(),!this._renderTexture)throw new Error("Unable to create render texture");e.activeTexture(e.TEXTURE0);const a=e.getParameter(e.TEXTURE_BINDING_2D);e.bindTexture(e.TEXTURE_2D,this._renderTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameterf(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._renderTexture,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER);if(i!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete: "+i.toString());return this._framebufferWidth=t,this._framebufferHeight=r,e.bindTexture(e.TEXTURE_2D,a),e.bindFramebuffer(e.FRAMEBUFFER,null),this._framebufferId}_getVertexBuffer(e){if(this._vertexBuffer)return this._vertexBuffer;if(this._vertexBuffer=e.createBuffer(),!this._vertexBuffer)throw new Error("Unable to create vertex buffer");e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer);let t=new Float32Array([-1,-1,0,0,-1,1,0,1,1,1,1,1,1,-1,1,0]);return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),this._vertexBuffer}_getIndexBuffer(e){if(this._indexBuffer)return this._indexBuffer;if(this._indexBuffer=e.createBuffer(),!this._indexBuffer)throw new Error("Unable to create index buffer");e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer);let t=new Uint16Array([0,1,2,0,2,3]);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW),this._indexBuffer}_getGreyscaleShader(e){if(this._greyscaleShader)return this._greyscaleShader;let t=e.createProgram();if(!t)throw new Error("Unable to create program");let r=v(e,e.VERTEX_SHADER,M),a=v(e,e.FRAGMENT_SHADER,B);e.attachShader(t,r),e.attachShader(t,a),function(e,t){e.linkProgram(t);let r=e.getProgramInfoLog(t);if(r&&r.trim().length>0)throw new Error("Unable to link: "+r)}(e,t);let i=e.getUniformLocation(t,"uTexWidth");if(!i)throw new Error("Unable to get uniform location uTexWidth");let _=e.getUniformLocation(t,"uUvTransform");if(!_)throw new Error("Unable to get uniform location uUvTransform");let n=e.getUniformLocation(t,"uSampler");if(!n)throw new Error("Unable to get uniform location uSampler");return this._greyscaleShader={program:t,aVertexPositionLoc:e.getAttribLocation(t,"aVertexPosition"),aTextureCoordLoc:e.getAttribLocation(t,"aTextureCoord"),uTexWidthLoc:i,uUvTransformLoc:_,uSamplerLoc:n},this._greyscaleShader}}let L,F,I,O,M="\n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform float uTexWidth;\n\tuniform mat4 uUvTransform;\n\n void main(void) {\n highp vec2 offset1 = vec2(1.5 / uTexWidth, 0);\n highp vec2 offset2 = vec2(0.5 / uTexWidth, 0);\n\n gl_Position = aVertexPosition;\n vTextureCoord1 = (uUvTransform * vec4(aTextureCoord - offset1, 0, 1)).xy;\n vTextureCoord2 = (uUvTransform * vec4(aTextureCoord - offset2, 0, 1)).xy;\n vTextureCoord3 = (uUvTransform * vec4(aTextureCoord + offset2, 0, 1)).xy;\n vTextureCoord4 = (uUvTransform * vec4(aTextureCoord + offset1, 0, 1)).xy;\n }\n",B="\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform sampler2D uSampler;\n\n const lowp vec3 colorWeights = vec3(77.0 / 256.0, 150.0 / 256.0, 29.0 / 256.0);\n\n void main(void) {\n lowp vec4 outpx;\n\n outpx.r = dot(colorWeights, texture2D(uSampler, vTextureCoord1).xyz);\n outpx.g = dot(colorWeights, texture2D(uSampler, vTextureCoord2).xyz);\n outpx.b = dot(colorWeights, texture2D(uSampler, vTextureCoord3).xyz);\n outpx.a = dot(colorWeights, texture2D(uSampler, vTextureCoord4).xyz);\n\n gl_FragColor = outpx;\n }\n";var P=r(604),V=function(e,t,r,a){return new(r||(r=Promise))((function(i,_){function n(e){try{o(a.next(e))}catch(e){_(e)}}function s(e){try{o(a.throw(e))}catch(e){_(e)}}function o(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,s)}o((a=a.apply(e,t||[])).next())}))};let C,U=new class{constructor(){this.onOutgoingMessage=new s,this.onIncomingMessage=new o,this._outgoingMessages=[]}postIncomingMessage(e){this.onIncomingMessage.emit(e)}postOutgoingMessage(e,t){this._outgoingMessages.push({msg:e,transferables:t}),this.onOutgoingMessage.emit()}getOutgoingMessages(){let e=this._outgoingMessages;return this._outgoingMessages=[],e}},S=0,z=!1;const N=new Map;function D(e,t,r){return V(this,void 0,void 0,(function*(){let i=a.Z({locateFile:(t,r)=>t.endsWith("zappar-cv.wasm")?e:r+t,instantiateWasm:(e,r)=>{const a=new WebAssembly.Instance(t,e);return r(a),a.exports},onRuntimeInitialized:()=>{let e=function(e){let t=e.cwrap("zappar_log_level","number",[]),r=e.cwrap("zappar_log_level_set",null,["number"]),a=e.cwrap("zappar_analytics_project_id_set",null,["string","string"]),i=e.cwrap("zappar_pipeline_create","number",[]),_=e.cwrap("zappar_pipeline_destroy",null,["number"]),n=e.cwrap("zappar_pipeline_camera_frame_data_raw","number",["number"]),s=e.cwrap("zappar_pipeline_camera_frame_data_raw_size","number",["number"]),o=e.cwrap("zappar_pipeline_camera_frame_data_raw_width","number",["number"]),c=e.cwrap("zappar_pipeline_camera_frame_data_raw_height","number",["number"]),f=e.cwrap("zappar_pipeline_frame_update",null,["number"]),l=e.cwrap("zappar_pipeline_frame_number","number",["number"]),u=e.cwrap("zappar_pipeline_camera_model","number",["number"]),p=e.cwrap("zappar_pipeline_camera_frame_user_data","number",["number"]),d=e.cwrap("zappar_pipeline_camera_frame_submit",null,["number","number","number","number","number","number","number","number","number"]),h=e.cwrap("zappar_pipeline_camera_frame_submit_raw_pointer",null,["number","number","number","number","number","number","number","number","number","number","number","number"]),m=e.cwrap("zappar_pipeline_camera_frame_camera_attitude","number",["number"]),b=e.cwrap("zappar_pipeline_camera_frame_device_attitude","number",["number"]),g=e.cwrap("zappar_pipeline_motion_accelerometer_submit",null,["number","number","number","number","number"]),w=e.cwrap("zappar_pipeline_motion_accelerometer_with_gravity_submit_int",null,["number","number","number","number","number","number"]),y=e.cwrap("zappar_pipeline_motion_accelerometer_without_gravity_submit_int",null,["number","number","number","number","number","number"]),A=e.cwrap("zappar_pipeline_motion_rotation_rate_submit",null,["number","number","number","number","number"]),E=e.cwrap("zappar_pipeline_motion_rotation_rate_submit_int",null,["number","number","number","number","number","number"]),T=e.cwrap("zappar_pipeline_motion_attitude_submit",null,["number","number","number","number","number"]),R=e.cwrap("zappar_pipeline_motion_attitude_submit_int",null,["number","number","number","number","number","number"]),k=e.cwrap("zappar_pipeline_motion_attitude_matrix_submit",null,["number","number"]),v=e.cwrap("zappar_camera_source_create","number",["number","string"]),x=e.cwrap("zappar_camera_source_destroy",null,["number"]),L=e.cwrap("zappar_sequence_source_create","number",["number"]),F=e.cwrap("zappar_sequence_source_destroy",null,["number"]),I=e.cwrap("zappar_image_tracker_create","number",["number"]),O=e.cwrap("zappar_image_tracker_destroy",null,["number"]),M=e.cwrap("zappar_image_tracker_target_load_from_memory",null,["number","number","number"]),B=e.cwrap("zappar_image_tracker_target_loaded_version","number",["number"]),P=e.cwrap("zappar_image_tracker_enabled","number",["number"]),V=e.cwrap("zappar_image_tracker_enabled_set",null,["number","number"]),C=e.cwrap("zappar_image_tracker_anchor_count","number",["number"]),U=e.cwrap("zappar_image_tracker_anchor_id","string",["number","number"]),S=e.cwrap("zappar_image_tracker_anchor_pose_raw","number",["number","number"]),z=e.cwrap("zappar_face_tracker_create","number",["number"]),N=e.cwrap("zappar_face_tracker_destroy",null,["number"]),D=e.cwrap("zappar_face_tracker_model_load_from_memory",null,["number","number","number"]),G=e.cwrap("zappar_face_tracker_model_loaded_version","number",["number"]),W=e.cwrap("zappar_face_tracker_enabled_set",null,["number","number"]),X=e.cwrap("zappar_face_tracker_enabled","number",["number"]),H=e.cwrap("zappar_face_tracker_max_faces_set",null,["number","number"]),Y=e.cwrap("zappar_face_tracker_max_faces","number",["number"]),q=e.cwrap("zappar_face_tracker_anchor_count","number",["number"]),j=e.cwrap("zappar_face_tracker_anchor_id","string",["number","number"]),K=e.cwrap("zappar_face_tracker_anchor_pose_raw","number",["number","number"]),Z=e.cwrap("zappar_face_tracker_anchor_identity_coefficients","number",["number","number"]),Q=e.cwrap("zappar_face_tracker_anchor_expression_coefficients","number",["number","number"]),J=e.cwrap("zappar_face_mesh_create","number",[]),$=e.cwrap("zappar_face_mesh_destroy",null,["number"]),ee=e.cwrap("zappar_face_landmark_create","number",["number"]),te=e.cwrap("zappar_face_landmark_destroy",null,["number"]),re=e.cwrap("zappar_barcode_finder_create","number",["number"]),ae=e.cwrap("zappar_barcode_finder_destroy",null,["number"]),ie=e.cwrap("zappar_barcode_finder_enabled_set",null,["number","number"]),_e=e.cwrap("zappar_barcode_finder_enabled","number",["number"]),ne=e.cwrap("zappar_barcode_finder_found_number","number",["number"]),se=e.cwrap("zappar_barcode_finder_found_text","string",["number","number"]),oe=e.cwrap("zappar_barcode_finder_found_format","number",["number","number"]),ce=e.cwrap("zappar_barcode_finder_formats","number",["number"]),fe=e.cwrap("zappar_barcode_finder_formats_set",null,["number","number"]),le=e.cwrap("zappar_instant_world_tracker_create","number",["number"]),ue=e.cwrap("zappar_instant_world_tracker_destroy",null,["number"]),pe=e.cwrap("zappar_instant_world_tracker_enabled_set",null,["number","number"]),de=e.cwrap("zappar_instant_world_tracker_enabled","number",["number"]),he=e.cwrap("zappar_instant_world_tracker_anchor_pose_raw","number",["number"]),me=e.cwrap("zappar_instant_world_tracker_anchor_pose_set_from_camera_offset_raw",null,["number","number","number","number","number"]),be=e.cwrap("zappar_world_tracker_create","number",["number"]),ge=e.cwrap("zappar_world_tracker_destroy",null,["number"]),we=e.cwrap("zappar_world_tracker_enabled","number",["number"]),ye=e.cwrap("zappar_world_tracker_enabled_set",null,["number","number"]),Ae=e.cwrap("zappar_world_tracker_quality","number",["number"]),Ee=e.cwrap("zappar_world_tracker_plane_count","number",["number"]),Te=e.cwrap("zappar_world_tracker_plane_pose_raw","number",["number","number"]),Re=e.cwrap("zappar_world_tracker_world_anchor_valid","number",["number"]),ke=e.cwrap("zappar_world_tracker_world_anchor_pose_raw","number",["number"]),ve=e.cwrap("zappar_world_tracker_ground_anchor_valid","number",["number"]),xe=e.cwrap("zappar_world_tracker_ground_anchor_pose_raw","number",["number"]),Le=e.cwrap("zappar_world_tracker_reset",null,["number"]),Fe=e.cwrap("zappar_world_tracker_debug_enabled","number",["number"]),Ie=e.cwrap("zappar_world_tracker_debug_enabled_set",null,["number","number"]),Oe=e.cwrap("zappar_world_tracker_debug_tracks_data_size","number",["number"]),Me=e.cwrap("zappar_world_tracker_debug_tracks_data","number",["number"]),Be=e.cwrap("zappar_world_tracker_debug_projections_data_size","number",["number"]),Pe=e.cwrap("zappar_world_tracker_debug_projections_data","number",["number"]),Ve=32,Ce=e._malloc(Ve),Ue=(e._malloc(64),new Map),Se=(t,r)=>{let a=Ue.get(t);return(!a||a[0]<r)&&(a&&e._free(a[1]),a=[r,e._malloc(r)],Ue.set(t,a)),a[1]};return{log_level:()=>t(),log_level_set:e=>r(e),analytics_project_id_set:(e,t)=>a(e,t),pipeline_create:()=>i(),pipeline_destroy:()=>{_()},pipeline_camera_frame_data_raw:e=>n(e),pipeline_camera_frame_data_raw_size:e=>s(e),pipeline_camera_frame_data_raw_width:e=>o(e),pipeline_camera_frame_data_raw_height:e=>c(e),pipeline_frame_update:e=>f(e),pipeline_frame_number:e=>l(e),pipeline_camera_model:t=>{let r=u(t),a=new Float32Array(6);return a.set(e.HEAPF32.subarray(r/4,6+r/4)),r=a,r},pipeline_camera_frame_user_data:e=>p(e),pipeline_camera_frame_submit:(t,r,a,i,_,n,s,o)=>{Ve<r.byteLength&&(e._free(Ce),Ve=r.byteLength,Ce=e._malloc(Ve));let c=Ce,f=r.byteLength;e.HEAPU8.set(new Uint8Array(r),Ce);let l=a,u=i,p=_,h=Se(4,n.byteLength);e.HEAPF32.set(n,h/4);let m=Se(5,s.byteLength);return e.HEAPF32.set(s,m/4),d(t,c,f,l,u,p,h,m,o?1:0)},pipeline_camera_frame_submit_raw_pointer:(t,r,a,i,_,n,s,o,c,f,l,u)=>{let p=r,d=a,m=i,b=_,g=n,w=s,y=Se(6,o.byteLength);e.HEAPF32.set(o,y/4);let A=c,E=Se(8,f.byteLength);return e.HEAPF32.set(f,E/4),h(t,p,d,m,b,g,w,y,A,E,l?1:0,u)},pipeline_camera_frame_camera_attitude:t=>{let r=m(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_camera_frame_device_attitude:t=>{let r=b(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_motion_accelerometer_submit:(e,t,r,a,i)=>g(e,t,r,a,i),pipeline_motion_accelerometer_with_gravity_submit_int:(e,t,r,a,i,_)=>w(e,t,r,a,i,_),pipeline_motion_accelerometer_without_gravity_submit_int:(e,t,r,a,i,_)=>y(e,t,r,a,i,_),pipeline_motion_rotation_rate_submit:(e,t,r,a,i)=>A(e,t,r,a,i),pipeline_motion_rotation_rate_submit_int:(e,t,r,a,i,_)=>E(e,t,r,a,i,_),pipeline_motion_attitude_submit:(e,t,r,a,i)=>T(e,t,r,a,i),pipeline_motion_attitude_submit_int:(e,t,r,a,i,_)=>R(e,t,r,a,i,_),pipeline_motion_attitude_matrix_submit:(t,r)=>{let a=Se(0,r.byteLength);return e.HEAPF32.set(r,a/4),k(t,a)},camera_source_create:(e,t)=>v(e,t),camera_source_destroy:()=>{x()},sequence_source_create:e=>L(e),sequence_source_destroy:()=>{F()},image_tracker_create:e=>I(e),image_tracker_destroy:()=>{O()},image_tracker_target_load_from_memory:(t,r)=>{Ve<r.byteLength&&(e._free(Ce),Ve=r.byteLength,Ce=e._malloc(Ve));let a=Ce,i=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),Ce),M(t,a,i)},image_tracker_target_loaded_version:e=>B(e),image_tracker_enabled:e=>{let t=P(e);return t=1===t,t},image_tracker_enabled_set:(e,t)=>V(e,t?1:0),image_tracker_anchor_count:e=>C(e),image_tracker_anchor_id:(e,t)=>U(e,t),image_tracker_anchor_pose_raw:(t,r)=>{let a=S(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},face_tracker_create:e=>z(e),face_tracker_destroy:()=>{N()},face_tracker_model_load_from_memory:(t,r)=>{Ve<r.byteLength&&(e._free(Ce),Ve=r.byteLength,Ce=e._malloc(Ve));let a=Ce,i=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),Ce),D(t,a,i)},face_tracker_model_loaded_version:e=>G(e),face_tracker_enabled_set:(e,t)=>W(e,t?1:0),face_tracker_enabled:e=>{let t=X(e);return t=1===t,t},face_tracker_max_faces_set:(e,t)=>H(e,t),face_tracker_max_faces:e=>Y(e),face_tracker_anchor_count:e=>q(e),face_tracker_anchor_id:(e,t)=>j(e,t),face_tracker_anchor_pose_raw:(t,r)=>{let a=K(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},face_tracker_anchor_identity_coefficients:(t,r)=>{let a=Z(t,r),i=new Float32Array(50);return i.set(e.HEAPF32.subarray(a/4,50+a/4)),a=i,a},face_tracker_anchor_expression_coefficients:(t,r)=>{let a=Q(t,r),i=new Float32Array(29);return i.set(e.HEAPF32.subarray(a/4,29+a/4)),a=i,a},face_mesh_create:()=>J(),face_mesh_destroy:()=>{$()},face_landmark_create:e=>ee(e),face_landmark_destroy:()=>{te()},barcode_finder_create:e=>re(e),barcode_finder_destroy:()=>{ae()},barcode_finder_enabled_set:(e,t)=>ie(e,t?1:0),barcode_finder_enabled:e=>{let t=_e(e);return t=1===t,t},barcode_finder_found_number:e=>ne(e),barcode_finder_found_text:(e,t)=>se(e,t),barcode_finder_found_format:(e,t)=>oe(e,t),barcode_finder_formats:e=>ce(e),barcode_finder_formats_set:(e,t)=>fe(e,t),instant_world_tracker_create:e=>le(e),instant_world_tracker_destroy:()=>{ue()},instant_world_tracker_enabled_set:(e,t)=>pe(e,t?1:0),instant_world_tracker_enabled:e=>{let t=de(e);return t=1===t,t},instant_world_tracker_anchor_pose_raw:t=>{let r=he(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},instant_world_tracker_anchor_pose_set_from_camera_offset_raw:(e,t,r,a,i)=>me(e,t,r,a,i),world_tracker_create:e=>be(e),world_tracker_destroy:()=>{ge()},world_tracker_enabled:e=>{let t=we(e);return t=1===t,t},world_tracker_enabled_set:(e,t)=>ye(e,t?1:0),world_tracker_quality:e=>Ae(e),world_tracker_plane_count:e=>Ee(e),world_tracker_plane_pose_raw:(t,r)=>{let a=Te(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},world_tracker_world_anchor_valid:e=>{let t=Re(e);return t=1===t,t},world_tracker_world_anchor_pose_raw:t=>{let r=ke(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_ground_anchor_valid:e=>{let t=ve(e);return t=1===t,t},world_tracker_ground_anchor_pose_raw:t=>{let r=xe(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_reset:e=>Le(e),world_tracker_debug_enabled:e=>{let t=Fe(e);return t=1===t,t},world_tracker_debug_enabled_set:(e,t)=>Ie(e,t?1:0),world_tracker_debug_tracks_data_size:e=>Oe(e),world_tracker_debug_tracks_data:t=>{let r=Me(t),a=Oe(t),i=new Float32Array(a);return i.set(e.HEAPF32.subarray(r/4,a+r/4)),r=i,r},world_tracker_debug_projections_data_size:e=>Be(e),world_tracker_debug_projections_data:t=>{let r=Pe(t),a=Be(t),i=new Float32Array(a);return i.set(e.HEAPF32.subarray(r/4,a+r/4)),r=i,r}}}(i);const t=(0,P.g)(i),a=r?function(e){return{data_download_clear:e.cwrap("data_download_clear",null,[]),data_download_size:e.cwrap("data_download_size","number",[]),data_download:e.cwrap("data_download","number",[]),data_should_record_set:e.cwrap("data_should_record_set",null,["number"])}}(i):void 0;null==a||a.data_should_record_set(1);let _=new n(e,((e,t)=>{U.postOutgoingMessage({p:e,t:"zappar",d:t},[t])}));U.postOutgoingMessage("loaded",[]),U.onIncomingMessage.bind((r=>{var n,s,o;switch(r.t){case"zappar":_.processBuffer(r.d),U.postOutgoingMessage({t:"buf",d:r.d},[r.d]);break;case"buf":null===(n=_.serializersByPipelineId.get(r.p))||void 0===n||n.bufferReturn(r.d);break;case"cameraFrameC2S":{let n,s=r,o=_._pipeline_by_instance.get(s.p);o&&(e.pipeline_camera_frame_submit(o,s.d,s.width,s.height,s.token,s.c2d,s.cm,s.userFacing),e.pipeline_frame_update(o),n=e.pipeline_camera_frame_device_attitude(o),_.exploreState(),Q(i,t),a&&J(i,a));let c={token:s.token,d:s.d,p:s.p,t:"cameraFrameRecycleS2C",att:n};U.postOutgoingMessage(c,[s.d]);break}case"rawenabled":z=r.v;break;case"rawrequest":{const e=r,t=N.get(e.p),a={t:"raw",token:e.token,p:e.p,data:t&&null!==(o=null===(s=t.ready.find((t=>t.token===e.token)))||void 0===s?void 0:s.data)&&void 0!==o?o:null};U.postOutgoingMessage(a,[]);break}case"streamC2S":{let n=r;(function(e,t,r,a,i,_,n,s,o){return V(this,void 0,void 0,(function*(){for(;;){let c;try{c=yield r.getReader()}catch(e){yield K(1e3);continue}try{return void(yield j(e,t,c,a,i,_,n,s,o))}catch(e){}return void(yield K(1e3))}}))})(i,e,n.s,n.p,n.userFacing,_,n.source,t,a).then((()=>{let e={t:"streamEndedS2C",p:n.p,source:n.source};U.postOutgoingMessage(e,[])})).catch((e=>{}));break}case"cameraToScreenC2S":S=r.r;break;case"imageBitmapC2S":!function(e,t,r,a){const[i,_]=function(){if(!I||!O){const e=new OffscreenCanvas(1,1);if(O=e.getContext("webgl"),!O)throw new Error("Unable to get offscreen GL context");I=new x(O)}return[I,O]}();if(F||(F=_.createTexture(),_.bindTexture(_.TEXTURE_2D,F),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR)),!F)return;(!L||L.byteLength<A.dataWidth*A.dataHeight)&&(L=new ArrayBuffer(A.dataWidth*A.dataHeight)),i.uploadFrame(F,e.i,e.r,e.userFacing);let n=i.readFrame(F,L),s={t:"imageBitmapS2C",dataWidth:n.dataWidth,dataHeight:n.dataHeight,frame:e.i,userFacing:n.userFacing,uvTransform:n.uvTransform||m.Ue(),tokenId:e.tokenId,p:e.p};a.postOutgoingMessage(s,[e.i]);let o=r._pipeline_by_instance.get(e.p);o&&(t.pipeline_camera_frame_submit(o,L,n.dataWidth,n.dataHeight,e.tokenId,e.cameraToDevice,e.cameraModel,n.userFacing),t.pipeline_frame_update(o),r.exploreState())}(r,e,_,U);break;case"sensorDataC2S":{const t=r,a=_._pipeline_by_instance.get(t.p);if(!a)break;switch(t.sensor){case"accel":e.pipeline_motion_accelerometer_submit(a,t.timestamp,t.x,t.y,t.z);break;case"accel_w_gravity_int":e.pipeline_motion_accelerometer_with_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"accel_wo_gravity_int":e.pipeline_motion_accelerometer_without_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude_int":e.pipeline_motion_attitude_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude":e.pipeline_motion_attitude_submit(a,t.timestamp,t.x,t.y,t.z);break;case"rotation_rate_int":e.pipeline_motion_rotation_rate_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"rotation_rate":e.pipeline_motion_rotation_rate_submit(a,t.timestamp,t.x,t.y,t.z)}break}case"attitudeMatrixC2S":{const t=r,a=_._pipeline_by_instance.get(t.p);if(!a)break;e.pipeline_motion_attitude_matrix_submit(a,t.m);break}}}))}})}))}let G=0,W=0,X=1;function H(e){return new Promise(((t,r)=>{const a=setTimeout((()=>{r("Frame timeout")}),2e3);e.read().then((e=>{clearTimeout(a),t(e)}))}))}const Y=m.Ue(),q=new Float32Array([300,300,160,120,0,0]);function j(e,t,r,a,i,_,n,s,o){var c,f;return V(this,void 0,void 0,(function*(){for(;;){let l=yield H(r);if(l.done)return void(null===(c=l.value)||void 0===c||c.close());let u=l.value,p=u.allocationSize();p>W&&(G>0&&e._free(G),G=e._malloc(p),W=p),yield u.copyTo(e.HEAPU8.subarray(G,G+W));let d=X;X++;const h=u.visibleRect.width,b=u.visibleRect.height;let g,w=h,y=b;switch(S){case 270:g=new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]),w=b,y=h;break;case 180:g=new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);break;case 90:g=new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1]),w=b,y=h;break;default:g=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}let E=u.clone();i?m.xJ(Y,[-1,1,-1]):m.yR(Y);let T=300*A.dataWidth/320;q[0]=T,q[1]=T,q[2]=.5*A.dataWidth,q[3]=.5*A.dataHeight;const R={token:d,d:E,p:a,t:"videoFrameS2C",userFacing:i,uvTransform:g,w:A.dataWidth,h:A.dataHeight,cameraToDevice:Y,cameraModel:q,source:n};U.postOutgoingMessage(R,[R.d,R.uvTransform.buffer]);const k=_._pipeline_by_instance.get(a);if(k){try{t.pipeline_camera_frame_submit_raw_pointer(k,G,p,Z(u.format),h,b,d,Y,S,q,i,null!==(f=u.timestamp)&&void 0!==f?f:-1),Q(e,s),o&&J(e,o)}catch(e){console.log("Exception during camera processing",e)}if(t.pipeline_frame_update(k),z){let r=N.get(a);if(r||(r={available:[],ready:[]},N.set(a,r)),r.ready.length>4){const e=r.ready.splice(0,1);for(const t of e)r.available.push(new Uint8Array(t.data.data))}const i=t.pipeline_camera_frame_data_raw_size(k);let _;for(;!_||_.byteLength<i;)r.available.length<1&&r.available.push(new Uint8Array(i)),_=r.available.pop();const n=t.pipeline_camera_frame_data_raw(k);_.set(e.HEAPU8.subarray(n,n+i)),r.ready.push({token:d,data:{data:_,width:t.pipeline_camera_frame_data_raw_width(a),height:t.pipeline_camera_frame_data_raw_height(a)}})}_.exploreState()}u.close()}}))}function K(e){return new Promise((t=>{setTimeout(t,e)}))}function Z(e){switch(e){case"I420":return p.FRAME_PIXEL_FORMAT_I420;case"I420A":return p.FRAME_PIXEL_FORMAT_I420A;case"I422":return p.FRAME_PIXEL_FORMAT_I422;case"I444":return p.FRAME_PIXEL_FORMAT_I444;case"NV12":return p.FRAME_PIXEL_FORMAT_NV12;case"RGBA":case"RGBX":return p.FRAME_PIXEL_FORMAT_RGBA;case"BGRA":case"BGRX":return p.FRAME_PIXEL_FORMAT_BGRA}return p.FRAME_PIXEL_FORMAT_Y}function Q(e,t){const r=t.worker_message_send_count();if(0!==r){C||(C=new MessageChannel,C.port1.start(),C.port1.addEventListener("message",(r=>{if("msgrec"!==r.data.t)return;const a=r.data.data,i=e._malloc(a.byteLength);e.HEAPU8.set(a,i),t.worker_message_receive(r.data.reference,a.byteLength,i),e._free(i)})),U.postOutgoingMessage({t:"setupCeresWorker",port:C.port2},[C.port2]));for(let a=0;a<r;a++){const r=t.worker_message_send_reference(a),i=t.worker_message_send_data_size(a),_=t.worker_message_send_data(a),n=e.HEAPU8.slice(_,_+i);C.port1.postMessage({t:"msgsend",data:n,reference:r},[n.buffer])}t.worker_message_send_clear()}}function J(e,t){const r=t.data_download_size();if(0===r)return;const a=t.data_download(),i=e.HEAPU8.slice(a,a+r);U.postOutgoingMessage({t:"_z_datadownload",data:i},[i.buffer]),t.data_download_clear()}const $=self;U.onOutgoingMessage.bind((()=>{let e=U.getOutgoingMessages();for(let t of e)$.postMessage(t.msg,t.transferables)}));let ee=e=>{var t;e&&e.data&&"wasm"===e.data.t&&(D(location.href.startsWith("blob")?e.data.url:new URL(r(751),r.b).toString(),e.data.module,null!==(t=e.data.shouldRecordData)&&void 0!==t&&t),$.removeEventListener("message",ee))};$.addEventListener("message",ee),$.addEventListener("message",(e=>{U.postIncomingMessage(e.data)}))}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var _=a[e]={exports:{}};return r[e].call(_.exports,_,_.exports,i),_.exports}return i.m=r,i.x=()=>{var e=i.O(void 0,[169,867],(()=>i(152)));return i.O(e)},i.amdO={},e=[],i.O=(t,r,a,_)=>{if(!r){var n=1/0;for(f=0;f<e.length;f++){for(var[r,a,_]=e[f],s=!0,o=0;o<r.length;o++)(!1&_||n>=_)&&Object.keys(i.O).every((e=>i.O[e](r[o])))?r.splice(o--,1):(s=!1,_<n&&(n=_));if(s){e.splice(f--,1);var c=a();void 0!==c&&(t=c)}}return t}_=_||0;for(var f=e.length;f>0&&e[f-1][2]>_;f--)e[f]=e[f-1];e[f]=[r,a,_]},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".zappar-cv.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var a=r.length-1;a>-1&&!e;)e=r[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{i.b=self.location+"";var e={751:1};i.f.i=(t,r)=>{e[t]||importScripts(i.p+i.u(t))};var t=self.webpackChunkZCV=self.webpackChunkZCV||[],r=t.push.bind(t);t.push=t=>{var[a,_,n]=t;for(var s in _)i.o(_,s)&&(i.m[s]=_[s]);for(n&&n(i);a.length;)e[a.pop()]=1;r(t)}})(),t=i.x,i.x=()=>Promise.all([i.e(169),i.e(867)]).then(t),i.x()})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ZCV=t():e.ZCV=t()}(self,(()=>(()=>{"use strict";var e,t,r={152:(e,t,r)=>{var a=r(581);class i{constructor(e){this._messageSender=e,this._freeBufferPool=[],this._buffer=new ArrayBuffer(16),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1,this._timeoutSet=!1,this._appender={int:e=>this.int(e),bool:e=>this.int(e?1:0),float:e=>this.float(e),string:e=>this.string(e),dataWithLength:e=>this.arrayBuffer(e),type:e=>this.int(e),matrix4x4:e=>this.float32ArrayBuffer(e),matrix3x3:e=>this.float32ArrayBuffer(e),floatArray:e=>this.float32ArrayBuffer(e),identityCoefficients:e=>this.float32ArrayBuffer(e),expressionCoefficients:e=>this.float32ArrayBuffer(e),cameraModel:e=>this.float32ArrayBuffer(e),timestamp:e=>this.double(e),barcodeFormat:e=>this.int(e),faceLandmarkName:e=>this.int(e),instantTrackerTransformOrientation:e=>this.int(e),logLevel:e=>this.int(e)},this._freeBufferPool.push(new ArrayBuffer(16)),this._freeBufferPool.push(new ArrayBuffer(16))}bufferReturn(e){this._freeBufferPool.push(e)}_ensureArrayBuffer(e){let t,r=4*(this._offset+e+8);if(this._buffer&&this._buffer.byteLength>=r)return;if(!t){let e=r;e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,t=new ArrayBuffer(e)}let a=this._buffer?this._i32View:void 0;this._buffer=t,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),a&&this._i32View.set(a.subarray(0,this._offset))}sendMessage(e,t){this._ensureArrayBuffer(4),this._startOffset=this._offset,this._i32View[this._offset+1]=e,this._offset+=2,t(this._appender),this._i32View[this._startOffset]=this._offset-this._startOffset,this._startOffset=-1,this._sendOneTime()}_sendOneTime(){!1===this._timeoutSet&&(this._timeoutSet=!0,setTimeout((()=>{this._timeoutSet=!1,this._send()}),0))}_send(){0!==this._freeBufferPool.length?(this._i32View[0]=this._offset,this._messageSender(this._buffer),this._buffer=void 0,this._buffer=this._freeBufferPool.pop(),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u8cView=new Uint8ClampedArray(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=1,this._startOffset=-1):this._sendOneTime()}int(e){this._ensureArrayBuffer(1),this._i32View[this._offset]=e,this._offset++}double(e){this._ensureArrayBuffer(2),this._offset%2==1&&this._offset++,this._f64View[this._offset/2]=e,this._offset+=2}float(e){this._ensureArrayBuffer(1),this._f32View[this._offset]=e,this._offset++}int32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t];this._offset+=e.length}float32Array(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._f32View[this._offset+t]=e[t];this._offset+=e.length}booleanArray(e){this._ensureArrayBuffer(e.length);for(let t=0;t<e.length;++t)this._i32View[this._offset+t]=e[t]?1:0;this._offset+=e.length}uint8ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8View.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}arrayBuffer(e){let t=new Uint8Array(e);this.uint8ArrayBuffer(t)}uint8ClampedArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.byteLength,this._offset++,this._u8cView.set(e,4*this._offset),this._offset+=e.byteLength>>2,0!=(3&e.byteLength)&&this._offset++}float32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._f32View.set(e,this._offset),this._offset+=e.length}uint16ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++;let t=2*this._offset;this._u16View.set(e,t),this._offset+=e.length>>1,0!=(1&e.length)&&this._offset++}int32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._i32View.set(e,this._offset),this._offset+=e.length}uint32ArrayBuffer(e){this._ensureArrayBuffer(e.byteLength/4),this._i32View[this._offset]=e.length,this._offset++,this._u32View.set(e,this._offset),this._offset+=e.length}string(e){let t=(new TextEncoder).encode(e);this._ensureArrayBuffer(t.byteLength/4),this._i32View[this._offset]=t.byteLength,this._offset++,this._u8View.set(t,4*this._offset),this._offset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._offset++}}class _{constructor(){this._buffer=new ArrayBuffer(0),this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,this._startOffset=-1,this._processor={int:()=>this._i32View[this._startOffset++],bool:()=>1===this._i32View[this._startOffset++],type:()=>this._i32View[this._startOffset++],float:()=>this._f32View[this._startOffset++],timestamp:()=>{this._startOffset%2==1&&this._startOffset++;let e=this._f64View[this._startOffset/2];return this._startOffset+=2,e},string:()=>{let e=this._i32View[this._startOffset++],t=(new TextDecoder).decode(new Uint8Array(this._buffer,4*this._startOffset,e));return this._startOffset+=e>>2,0!=(3&e)&&this._startOffset++,t},dataWithLength:()=>{let e=this._i32View[this._startOffset++],t=new Uint8Array(e);return t.set(this._u8View.subarray(4*this._startOffset,4*this._startOffset+e)),this._startOffset+=t.byteLength>>2,0!=(3&t.byteLength)&&this._startOffset++,t.buffer},floatArray:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+e)),this._startOffset+=e,t},matrix4x4:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+16)),this._startOffset+=e,t},matrix3x3:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+9)),this._startOffset+=e,t},identityCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+50)),this._startOffset+=e,t},expressionCoefficients:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+29)),this._startOffset+=e,t},cameraModel:()=>{let e=this._i32View[this._startOffset++],t=new Float32Array(e);return t.set(this._f32View.subarray(this._startOffset,this._startOffset+6)),this._startOffset+=e,t},barcodeFormat:()=>this._i32View[this._startOffset++],faceLandmarkName:()=>this._i32View[this._startOffset++],instantTrackerTransformOrientation:()=>this._i32View[this._startOffset++],logLevel:()=>this._i32View[this._startOffset++]}}setData(e){this._buffer=e,this._i32View=new Int32Array(this._buffer),this._f32View=new Float32Array(this._buffer),this._f64View=new Float64Array(this._buffer),this._u8View=new Uint8Array(this._buffer),this._u16View=new Uint16Array(this._buffer),this._u32View=new Uint32Array(this._buffer),this._offset=0,this._length=0,e.byteLength>=4&&(this._offset=1,this._length=this._i32View[0]),this._startOffset=-1}hasMessage(){return this._offset+1<this._length}forMessages(e){for(;this.hasMessage();){let t=this._i32View[this._offset],r=this._i32View[this._offset+1];this._startOffset=this._offset+2,this._offset+=t,e(r,this._processor)}}}class n{constructor(e,t){this._impl=e,this._sender=t,this._deserializer=new _,this.serializersByPipelineId=new Map,this._pipeline_id_by_pipeline_id=new Map,this._pipeline_by_instance=new Map,this._pipeline_id_by_camera_source_id=new Map,this._camera_source_by_instance=new Map,this._pipeline_id_by_sequence_source_id=new Map,this._sequence_source_by_instance=new Map,this._pipeline_id_by_image_tracker_id=new Map,this._image_tracker_by_instance=new Map,this._pipeline_id_by_face_tracker_id=new Map,this._face_tracker_by_instance=new Map,this._pipeline_id_by_face_mesh_id=new Map,this._face_mesh_by_instance=new Map,this._pipeline_id_by_face_landmark_id=new Map,this._face_landmark_by_instance=new Map,this._pipeline_id_by_barcode_finder_id=new Map,this._barcode_finder_by_instance=new Map,this._pipeline_id_by_instant_world_tracker_id=new Map,this._instant_world_tracker_by_instance=new Map,this._pipeline_id_by_zapcode_tracker_id=new Map,this._zapcode_tracker_by_instance=new Map,this._pipeline_id_by_world_tracker_id=new Map,this._world_tracker_by_instance=new Map}processBuffer(e){this._deserializer.setData(e),this._deserializer.forMessages(((e,t)=>{switch(e){case 38:this._impl.log_level_set(t.logLevel());break;case 35:this._impl.analytics_project_id_set(t.string(),t.string());break;case 31:{let e=t.type(),r=this._impl.pipeline_create();this._pipeline_by_instance.set(e,r),this._pipeline_id_by_pipeline_id.set(e,e),this.serializersByPipelineId.set(e,new i((t=>{this._sender(e,t)})));break}case 32:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_destroy(r),this._pipeline_by_instance.delete(e);break}case 9:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_frame_update(r);break}case 8:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_camera_frame_submit(r,t.dataWithLength(),t.int(),t.int(),t.int(),t.matrix4x4(),t.cameraModel(),t.bool());break}case 10:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 12:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_with_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 11:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_accelerometer_without_gravity_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 15:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 13:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_rotation_rate_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 16:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit(r,t.timestamp(),t.float(),t.float(),t.float());break}case 14:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_submit_int(r,t.timestamp(),t.timestamp(),t.float(),t.float(),t.float());break}case 17:{let e=t.type(),r=this._pipeline_by_instance.get(e);if(void 0===r)return;this._impl.pipeline_motion_attitude_matrix_submit(r,t.matrix4x4());break}case 33:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=t.string(),_=this._impl.camera_source_create(a,i);this._camera_source_by_instance.set(e,_),this._pipeline_id_by_camera_source_id.set(e,r);break}case 34:{let e=t.type(),r=this._camera_source_by_instance.get(e);if(void 0===r)return;this._impl.camera_source_destroy(r),this._camera_source_by_instance.delete(e);break}case 39:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.sequence_source_create(a);this._sequence_source_by_instance.set(e,i),this._pipeline_id_by_sequence_source_id.set(e,r);break}case 40:{let e=t.type(),r=this._sequence_source_by_instance.get(e);if(void 0===r)return;this._impl.sequence_source_destroy(r),this._sequence_source_by_instance.delete(e);break}case 2:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.image_tracker_create(a);this._image_tracker_by_instance.set(e,i),this._pipeline_id_by_image_tracker_id.set(e,r);break}case 18:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_destroy(r),this._image_tracker_by_instance.delete(e);break}case 4:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_target_load_from_memory(r,t.dataWithLength());break}case 3:{let e=t.type(),r=this._image_tracker_by_instance.get(e);if(void 0===r)return;this._impl.image_tracker_enabled_set(r,t.bool());break}case 24:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.face_tracker_create(a);this._face_tracker_by_instance.set(e,i),this._pipeline_id_by_face_tracker_id.set(e,r);break}case 25:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_destroy(r),this._face_tracker_by_instance.delete(e);break}case 26:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_model_load_from_memory(r,t.dataWithLength());break}case 27:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_enabled_set(r,t.bool());break}case 28:{let e=t.type(),r=this._face_tracker_by_instance.get(e);if(void 0===r)return;this._impl.face_tracker_max_faces_set(r,t.int());break}case 29:{let e=t.type(),r=this._impl.face_mesh_create();this._face_mesh_by_instance.set(e,r);break}case 30:{let e=t.type(),r=this._face_mesh_by_instance.get(e);if(void 0===r)return;this._impl.face_mesh_destroy(r),this._face_mesh_by_instance.delete(e);break}case 36:{let e=t.type(),r=t.faceLandmarkName(),a=this._impl.face_landmark_create(r);this._face_landmark_by_instance.set(e,a);break}case 37:{let e=t.type(),r=this._face_landmark_by_instance.get(e);if(void 0===r)return;this._impl.face_landmark_destroy(r),this._face_landmark_by_instance.delete(e);break}case 20:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.barcode_finder_create(a);this._barcode_finder_by_instance.set(e,i),this._pipeline_id_by_barcode_finder_id.set(e,r);break}case 21:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_destroy(r),this._barcode_finder_by_instance.delete(e);break}case 22:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_enabled_set(r,t.bool());break}case 23:{let e=t.type(),r=this._barcode_finder_by_instance.get(e);if(void 0===r)return;this._impl.barcode_finder_formats_set(r,t.barcodeFormat());break}case 5:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.instant_world_tracker_create(a);this._instant_world_tracker_by_instance.set(e,i),this._pipeline_id_by_instant_world_tracker_id.set(e,r);break}case 19:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_destroy(r),this._instant_world_tracker_by_instance.delete(e);break}case 6:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_enabled_set(r,t.bool());break}case 7:{let e=t.type(),r=this._instant_world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(r,t.float(),t.float(),t.float(),t.instantTrackerTransformOrientation());break}case 41:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.zapcode_tracker_create(a);this._zapcode_tracker_by_instance.set(e,i),this._pipeline_id_by_zapcode_tracker_id.set(e,r);break}case 44:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_destroy(r),this._zapcode_tracker_by_instance.delete(e);break}case 43:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_target_load_from_memory(r,t.dataWithLength());break}case 42:{let e=t.type(),r=this._zapcode_tracker_by_instance.get(e);if(void 0===r)return;this._impl.zapcode_tracker_enabled_set(r,t.bool());break}case 45:{let e=t.type(),r=t.type(),a=this._pipeline_by_instance.get(r),i=this._impl.world_tracker_create(a);this._world_tracker_by_instance.set(e,i),this._pipeline_id_by_world_tracker_id.set(e,r);break}case 46:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_destroy(r),this._world_tracker_by_instance.delete(e);break}case 47:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_enabled_set(r,t.bool());break}case 48:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_reset(r);break}case 49:{let e=t.type(),r=this._world_tracker_by_instance.get(e);if(void 0===r)return;this._impl.world_tracker_debug_enabled_set(r,t.bool());break}}}))}exploreState(){for(let[e,t]of this._pipeline_by_instance){let r=this._pipeline_id_by_pipeline_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&(a.sendMessage(7,(r=>{r.type(e),r.int(this._impl.pipeline_frame_number(t))})),a.sendMessage(6,(r=>{r.type(e),r.cameraModel(this._impl.pipeline_camera_model(t))})),a.sendMessage(5,(r=>{r.type(e),r.int(this._impl.pipeline_camera_frame_user_data(t))})),a.sendMessage(11,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_camera_attitude(t))})),a.sendMessage(12,(r=>{r.type(e),r.matrix4x4(this._impl.pipeline_camera_frame_device_attitude(t))})))}for(let[e,t]of this._camera_source_by_instance){let t=this._pipeline_id_by_camera_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._sequence_source_by_instance){let t=this._pipeline_id_by_sequence_source_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._image_tracker_by_instance){let r=this._pipeline_id_by_image_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(19,(r=>{r.type(e),r.int(this._impl.image_tracker_target_loaded_version(t))})),a.sendMessage(1,(r=>{r.type(e),r.int(this._impl.image_tracker_anchor_count(t))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(2,(a=>{a.type(e),a.int(r),a.string(this._impl.image_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.image_tracker_anchor_count(t);r++)a.sendMessage(3,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.image_tracker_anchor_pose_raw(t,r))}))}}for(let[e,t]of this._face_tracker_by_instance){let r=this._pipeline_id_by_face_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(18,(r=>{r.type(e),r.int(this._impl.face_tracker_model_loaded_version(t))})),a.sendMessage(13,(r=>{r.type(e),r.int(this._impl.face_tracker_anchor_count(t))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(14,(a=>{a.type(e),a.int(r),a.string(this._impl.face_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(15,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.face_tracker_anchor_pose_raw(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(16,(a=>{a.type(e),a.int(r),a.identityCoefficients(this._impl.face_tracker_anchor_identity_coefficients(t,r))}));for(let r=0;r<this._impl.face_tracker_anchor_count(t);r++)a.sendMessage(17,(a=>{a.type(e),a.int(r),a.expressionCoefficients(this._impl.face_tracker_anchor_expression_coefficients(t,r))}))}}for(let[e,t]of this._face_mesh_by_instance){let t=this._pipeline_id_by_face_mesh_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._face_landmark_by_instance){let t=this._pipeline_id_by_face_landmark_id.get(e);t&&this.serializersByPipelineId.get(t)}for(let[e,t]of this._barcode_finder_by_instance){let r=this._pipeline_id_by_barcode_finder_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(8,(r=>{r.type(e),r.int(this._impl.barcode_finder_found_number(t))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(9,(a=>{a.type(e),a.int(r),a.string(this._impl.barcode_finder_found_text(t,r))}));for(let r=0;r<this._impl.barcode_finder_found_number(t);r++)a.sendMessage(10,(a=>{a.type(e),a.int(r),a.barcodeFormat(this._impl.barcode_finder_found_format(t,r))}))}}for(let[e,t]of this._instant_world_tracker_by_instance){let r=this._pipeline_id_by_instant_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);a&&a.sendMessage(4,(r=>{r.type(e),r.matrix4x4(this._impl.instant_world_tracker_anchor_pose_raw(t))}))}for(let[e,t]of this._zapcode_tracker_by_instance){let r=this._pipeline_id_by_zapcode_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(24,(r=>{r.type(e),r.int(this._impl.zapcode_tracker_target_loaded_version(t))})),a.sendMessage(21,(r=>{r.type(e),r.int(this._impl.zapcode_tracker_anchor_count(t))}));for(let r=0;r<this._impl.zapcode_tracker_anchor_count(t);r++)a.sendMessage(22,(a=>{a.type(e),a.int(r),a.string(this._impl.zapcode_tracker_anchor_id(t,r))}));for(let r=0;r<this._impl.zapcode_tracker_anchor_count(t);r++)a.sendMessage(23,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.zapcode_tracker_anchor_pose_raw(t,r))}))}}for(let[e,t]of this._world_tracker_by_instance){let r=this._pipeline_id_by_world_tracker_id.get(e);if(!r)continue;let a=this.serializersByPipelineId.get(r);if(a){a.sendMessage(31,(r=>{r.type(e),r.int(this._impl.world_tracker_quality(t))})),a.sendMessage(25,(r=>{r.type(e),r.int(this._impl.world_tracker_plane_count(t))}));for(let r=0;r<this._impl.world_tracker_plane_count(t);r++)a.sendMessage(26,(a=>{a.type(e),a.int(r),a.matrix4x4(this._impl.world_tracker_plane_pose_raw(t,r))}));a.sendMessage(27,(r=>{r.type(e),r.bool(this._impl.world_tracker_world_anchor_valid(t))})),a.sendMessage(28,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_world_anchor_pose_raw(t))})),a.sendMessage(27,(r=>{r.type(e),r.bool(this._impl.world_tracker_ground_anchor_valid(t))})),a.sendMessage(30,(r=>{r.type(e),r.matrix4x4(this._impl.world_tracker_ground_anchor_pose_raw(t))})),a.sendMessage(33,(r=>{r.type(e),r.int(this._impl.world_tracker_debug_tracks_data_size(t))})),a.sendMessage(32,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_debug_tracks_data(t))})),a.sendMessage(35,(r=>{r.type(e),r.int(this._impl.world_tracker_debug_projections_data_size(t))})),a.sendMessage(34,(r=>{r.type(e),r.floatArray(this._impl.world_tracker_debug_projections_data(t))}))}}}}class s{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(){for(var e=0,t=this._funcs.length;e<t;e++)this._funcs[e]()}}class o{constructor(){this._funcs=[]}bind(e){this._funcs.push(e)}unbind(e){let t=this._funcs.indexOf(e);t>-1&&this._funcs.splice(t,1)}emit(e){for(var t=0,r=this._funcs.length;t<r;t++)this._funcs[t](e)}}var c,l,f,p,u,d,h,m,b=r(975);!function(e){e[e.UNKNOWN=131072]="UNKNOWN",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=4]="CODE_39",e[e.CODE_93=8]="CODE_93",e[e.CODE_128=16]="CODE_128",e[e.DATA_MATRIX=32]="DATA_MATRIX",e[e.EAN_8=64]="EAN_8",e[e.EAN_13=128]="EAN_13",e[e.ITF=256]="ITF",e[e.MAXICODE=512]="MAXICODE",e[e.PDF_417=1024]="PDF_417",e[e.QR_CODE=2048]="QR_CODE",e[e.RSS_14=4096]="RSS_14",e[e.RSS_EXPANDED=8192]="RSS_EXPANDED",e[e.UPC_A=16384]="UPC_A",e[e.UPC_E=32768]="UPC_E",e[e.UPC_EAN_EXTENSION=65536]="UPC_EAN_EXTENSION",e[e.ALL=131071]="ALL"}(c||(c={})),function(e){e[e.EYE_LEFT=0]="EYE_LEFT",e[e.EYE_RIGHT=1]="EYE_RIGHT",e[e.EAR_LEFT=2]="EAR_LEFT",e[e.EAR_RIGHT=3]="EAR_RIGHT",e[e.NOSE_BRIDGE=4]="NOSE_BRIDGE",e[e.NOSE_TIP=5]="NOSE_TIP",e[e.NOSE_BASE=6]="NOSE_BASE",e[e.LIP_TOP=7]="LIP_TOP",e[e.LIP_BOTTOM=8]="LIP_BOTTOM",e[e.MOUTH_CENTER=9]="MOUTH_CENTER",e[e.CHIN=10]="CHIN",e[e.EYEBROW_LEFT=11]="EYEBROW_LEFT",e[e.EYEBROW_RIGHT=12]="EYEBROW_RIGHT"}(l||(l={})),function(e){e[e.WORLD=3]="WORLD",e[e.MINUS_Z_AWAY_FROM_USER=4]="MINUS_Z_AWAY_FROM_USER",e[e.MINUS_Z_HEADING=5]="MINUS_Z_HEADING",e[e.UNCHANGED=6]="UNCHANGED"}(f||(f={})),function(e){e[e.LOG_LEVEL_NONE=0]="LOG_LEVEL_NONE",e[e.LOG_LEVEL_ERROR=1]="LOG_LEVEL_ERROR",e[e.LOG_LEVEL_WARNING=2]="LOG_LEVEL_WARNING",e[e.LOG_LEVEL_VERBOSE=3]="LOG_LEVEL_VERBOSE"}(p||(p={})),function(e){e[e.FRAME_PIXEL_FORMAT_I420=0]="FRAME_PIXEL_FORMAT_I420",e[e.FRAME_PIXEL_FORMAT_I420A=1]="FRAME_PIXEL_FORMAT_I420A",e[e.FRAME_PIXEL_FORMAT_I422=2]="FRAME_PIXEL_FORMAT_I422",e[e.FRAME_PIXEL_FORMAT_I444=3]="FRAME_PIXEL_FORMAT_I444",e[e.FRAME_PIXEL_FORMAT_NV12=4]="FRAME_PIXEL_FORMAT_NV12",e[e.FRAME_PIXEL_FORMAT_RGBA=5]="FRAME_PIXEL_FORMAT_RGBA",e[e.FRAME_PIXEL_FORMAT_BGRA=6]="FRAME_PIXEL_FORMAT_BGRA",e[e.FRAME_PIXEL_FORMAT_Y=7]="FRAME_PIXEL_FORMAT_Y"}(u||(u={})),function(e){e[e.IMAGE_TRACKER_TYPE_PLANAR=0]="IMAGE_TRACKER_TYPE_PLANAR",e[e.IMAGE_TRACKER_TYPE_CYLINDRICAL=1]="IMAGE_TRACKER_TYPE_CYLINDRICAL",e[e.IMAGE_TRACKER_TYPE_CONICAL=2]="IMAGE_TRACKER_TYPE_CONICAL"}(d||(d={})),function(e){e[e.WORLD_TRACKER_QUALITY_INITIALIZING=0]="WORLD_TRACKER_QUALITY_INITIALIZING",e[e.WORLD_TRACKER_QUALITY_GOOD=1]="WORLD_TRACKER_QUALITY_GOOD",e[e.WORLD_TRACKER_QUALITY_ORIENTATION_ONLY=2]="WORLD_TRACKER_QUALITY_ORIENTATION_ONLY"}(h||(h={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.HIGH=1]="HIGH"}(m||(m={}));const g=new Map;class w{constructor(e){this._gl=e,this._viewports=[],this._underlyingViewport=this._gl.viewport,this._viewports.push(this._gl.getParameter(this._gl.VIEWPORT)),this._gl.viewport=(e,t,r,a)=>{this._viewports[this._viewports.length-1]=[e,t,r,a],this._underlyingViewport.call(this._gl,e,t,r,a)}}static get(e){let t=g.get(e);return t||(t=new w(e),g.set(e,t)),t}push(){this._viewports.push(this._viewports[this._viewports.length-1])}pop(){const e=this._viewports.pop(),t=this._viewports[this._viewports.length-1];e&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]||this._underlyingViewport.call(this._gl,t[0],t[1],t[2],t[3])}}var y,A=r(238);!function(e){e[e.OBJECT_URL=0]="OBJECT_URL",e[e.SRC_OBJECT=1]="SRC_OBJECT"}(y||(y={}));let E={deviceMotionMutliplier:-1,blacklisted:!1,showGyroPermissionsWarningIfNecessary:!1,showSafariPermissionsResetIfNecessary:!1,requestHighFrameRate:!1,videoWidth:640,videoHeight:480,getDataSize:e=>e===m.HIGH?[640,480]:[320,240],videoElementInDOM:!1,preferMediaStreamTrackProcessorCamera:!0,preferImageBitmapCamera:!1,ios164CameraSelection:!1,relyOnConstraintsForCameraSelection:!1,forceWindowOrientation:!1,intervalMultiplier:1,trustSensorIntervals:!1};"undefined"!=typeof window&&(window.zeeProfile=E,window.location.href.indexOf("_mstppipeline")>=0&&(console.log("Configuring for MSTP camera pipeline (if supported)"),E.preferMediaStreamTrackProcessorCamera=!0),window.location.href.indexOf("_imagebitmappipeline")>=0&&(console.log("Configuring for ImageBitmap camera pipeline (if supported)"),E.preferImageBitmapCamera=!0));let T=new A.UAParser,R=(T.getOS().name||"unknown").toLowerCase(),k=(T.getEngine().name||"unknown").toLowerCase();function v(e){E.forceWindowOrientation=!0,E.preferMediaStreamTrackProcessorCamera=!1,E.intervalMultiplier=1e3,E.trustSensorIntervals=!0;let t=e.split(".");if(t.length>=2){const e=parseInt(t[0]),r=parseInt(t[1]);(e<11||11===e&&r<3)&&(E.blacklisted=!0),(e<12||12===e&&r<2)&&(E.videoElementInDOM=!0),(12===e&&r>=2||e>=13)&&(E.showGyroPermissionsWarningIfNecessary=!0),e>=13&&(E.showSafariPermissionsResetIfNecessary=!0),(e>=12&&r>1||e>=13)&&navigator.mediaDevices&&navigator.mediaDevices.getSupportedConstraints&&navigator.mediaDevices.getSupportedConstraints().frameRate&&(E.requestHighFrameRate=!0,e<14&&(E.videoHeight=360,E.getDataSize=e=>e===m.HIGH?[640,360]:[320,180])),16===e&&r>=4&&(E.ios164CameraSelection=!0),e>=17&&(E.relyOnConstraintsForCameraSelection=!0)}}function x(e,t,r){let a=e.createShader(t);if(!a)throw new Error("Unable to create shader");e.shaderSource(a,r),e.compileShader(a);let i=e.getShaderInfoLog(a);if(i&&i.trim().length>0)throw new Error("Shader compile error: "+i);return a}"webkit"===k&&"ios"!==R&&(E.deviceMotionMutliplier=1,"undefined"!=typeof window&&void 0!==window.orientation&&v("15.0")),"webkit"===k&&"ios"===R&&(E.deviceMotionMutliplier=1,v(T.getOS().version||"15.0"));class L{constructor(e){this._gl=e,this._isPaused=!0,this._hadFrames=!1,this._isUserFacing=!1,this._cameraToScreenRotation=0,this._isUploadFrame=!0,this._computedTransformRotation=-1,this._computedFrontCameraRotation=!1,this._cameraUvTransform=b.Ue(),this._framebufferWidth=0,this._framebufferHeight=0,this._framebufferId=null,this._renderTexture=null,this._isWebGL2=!1,this._isWebGL2=e.getParameter(e.VERSION).indexOf("WebGL 2")>=0,this._isWebGL2||(this._instancedArraysExtension=this._gl.getExtension("ANGLE_instanced_arrays"))}resetGLContext(){this._framebufferId=null,this._renderTexture=null,this._vertexBuffer=void 0,this._indexBuffer=void 0,this._greyscaleShader=void 0}destroy(){this.resetGLContext()}uploadFrame(e,t,r,a,i){let _=this._gl;const n=w.get(_);n.push();const s=_.isEnabled(_.SCISSOR_TEST),o=_.isEnabled(_.DEPTH_TEST),c=_.isEnabled(_.BLEND),l=_.isEnabled(_.CULL_FACE),f=_.isEnabled(_.STENCIL_TEST),p=_.getParameter(_.ACTIVE_TEXTURE),u=_.getParameter(_.UNPACK_FLIP_Y_WEBGL),d=_.getParameter(_.CURRENT_PROGRAM);_.activeTexture(_.TEXTURE0);const h=_.getParameter(_.TEXTURE_BINDING_2D),m=_.getParameter(_.FRAMEBUFFER_BINDING),b=_.getParameter(_.ARRAY_BUFFER_BINDING),g=_.getParameter(_.ELEMENT_ARRAY_BUFFER_BINDING);_.disable(_.SCISSOR_TEST),_.disable(_.DEPTH_TEST),_.disable(_.BLEND),_.disable(_.CULL_FACE),_.disable(_.STENCIL_TEST),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,!1),_.bindTexture(_.TEXTURE_2D,e);const y=_.RGBA,A=_.RGBA,T=_.UNSIGNED_BYTE;_.texImage2D(_.TEXTURE_2D,0,y,A,T,t);let R=0,k=0;"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement?(R=t.videoWidth,k=t.videoHeight):(R=t.width,k=t.height),k>R&&(k=[R,R=k][0]),this._updateTransforms(r,a);const[v,x]=E.getDataSize(i);let L=this._getFramebuffer(_,v/4,x),I=this._getVertexBuffer(_),F=this._getIndexBuffer(_),O=this._getGreyscaleShader(_);const M=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_SIZE),P=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_TYPE),z=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_NORMALIZED),B=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_STRIDE),V=_.getVertexAttribOffset(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_POINTER),C=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_ENABLED),U=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),S=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_SIZE),N=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_TYPE),D=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_NORMALIZED),G=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_STRIDE),X=_.getVertexAttribOffset(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_POINTER),H=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),W=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_ENABLED);let Y=0,q=0;this._isWebGL2?(Y=_.getVertexAttrib(O.aVertexPositionLoc,_.VERTEX_ATTRIB_ARRAY_DIVISOR),q=_.getVertexAttrib(O.aTextureCoordLoc,_.VERTEX_ATTRIB_ARRAY_DIVISOR),_.vertexAttribDivisor(O.aVertexPositionLoc,0),_.vertexAttribDivisor(O.aTextureCoordLoc,0)):this._instancedArraysExtension&&(Y=_.getVertexAttrib(O.aVertexPositionLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),q=_.getVertexAttrib(O.aTextureCoordLoc,this._instancedArraysExtension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aVertexPositionLoc,0),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aTextureCoordLoc,0)),_.bindFramebuffer(_.FRAMEBUFFER,L),_.viewport(0,0,this._framebufferWidth,this._framebufferHeight),_.clear(_.COLOR_BUFFER_BIT),_.bindBuffer(_.ARRAY_BUFFER,I),_.vertexAttribPointer(O.aVertexPositionLoc,2,_.FLOAT,!1,16,0),_.enableVertexAttribArray(O.aVertexPositionLoc),_.vertexAttribPointer(O.aTextureCoordLoc,2,_.FLOAT,!1,16,8),_.enableVertexAttribArray(O.aTextureCoordLoc),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,F),_.useProgram(O.program),_.uniform1f(O.uTexWidthLoc,v),_.uniformMatrix4fv(O.uUvTransformLoc,!1,this._cameraUvTransform),_.activeTexture(_.TEXTURE0),_.bindTexture(_.TEXTURE_2D,e),_.uniform1i(O.uSamplerLoc,0),_.drawElements(_.TRIANGLES,6,_.UNSIGNED_SHORT,0),_.bindBuffer(_.ARRAY_BUFFER,U),_.vertexAttribPointer(O.aVertexPositionLoc,M,P,z,B,V),_.bindBuffer(_.ARRAY_BUFFER,H),_.vertexAttribPointer(O.aTextureCoordLoc,S,N,D,G,X),_.bindBuffer(_.ARRAY_BUFFER,b),_.bindBuffer(_.ELEMENT_ARRAY_BUFFER,g),C||_.disableVertexAttribArray(O.aVertexPositionLoc),W||_.disableVertexAttribArray(O.aTextureCoordLoc),this._isWebGL2?(_.vertexAttribDivisor(O.aVertexPositionLoc,Y),_.vertexAttribDivisor(O.aTextureCoordLoc,q)):this._instancedArraysExtension&&(this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aVertexPositionLoc,Y),this._instancedArraysExtension.vertexAttribDivisorANGLE(O.aTextureCoordLoc,q)),_.bindFramebuffer(_.FRAMEBUFFER,m),_.useProgram(d),_.bindTexture(_.TEXTURE_2D,h),_.activeTexture(p),_.pixelStorei(_.UNPACK_FLIP_Y_WEBGL,u),n.pop(),c&&_.enable(_.BLEND),l&&_.enable(_.CULL_FACE),o&&_.enable(_.DEPTH_TEST),s&&_.enable(_.SCISSOR_TEST),f&&_.enable(_.STENCIL_TEST)}readFrame(e,t,r){let a=this._gl,i=new Uint8Array(t);const _=a.getParameter(a.FRAMEBUFFER_BINDING),[n,s]=E.getDataSize(r);let o=this._getFramebuffer(a,n/4,s);return a.bindFramebuffer(a.FRAMEBUFFER,o),a.readPixels(0,0,this._framebufferWidth,this._framebufferHeight,a.RGBA,a.UNSIGNED_BYTE,i),a.bindFramebuffer(a.FRAMEBUFFER,_),{uvTransform:this._cameraUvTransform,data:t,texture:e,dataWidth:n,dataHeight:s,userFacing:this._computedFrontCameraRotation}}_updateTransforms(e,t){e==this._computedTransformRotation&&t==this._computedFrontCameraRotation||(this._computedTransformRotation=e,this._computedFrontCameraRotation=t,this._cameraUvTransform=this._getCameraUvTransform())}_getCameraUvTransform(){switch(this._computedTransformRotation){case 270:return new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]);case 180:return new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);case 90:return new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1])}return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}_getFramebuffer(e,t,r){if(this._framebufferWidth===t&&this._framebufferHeight===r&&this._framebufferId)return this._framebufferId;if(this._framebufferId&&(e.deleteFramebuffer(this._framebufferId),this._framebufferId=null),this._renderTexture&&(e.deleteTexture(this._renderTexture),this._renderTexture=null),this._framebufferId=e.createFramebuffer(),!this._framebufferId)throw new Error("Unable to create framebuffer");if(e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferId),this._renderTexture=e.createTexture(),!this._renderTexture)throw new Error("Unable to create render texture");e.activeTexture(e.TEXTURE0);const a=e.getParameter(e.TEXTURE_BINDING_2D);e.bindTexture(e.TEXTURE_2D,this._renderTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameterf(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this._renderTexture,0);let i=e.checkFramebufferStatus(e.FRAMEBUFFER);if(i!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer not complete: "+i.toString());return this._framebufferWidth=t,this._framebufferHeight=r,e.bindTexture(e.TEXTURE_2D,a),e.bindFramebuffer(e.FRAMEBUFFER,null),this._framebufferId}_getVertexBuffer(e){if(this._vertexBuffer)return this._vertexBuffer;if(this._vertexBuffer=e.createBuffer(),!this._vertexBuffer)throw new Error("Unable to create vertex buffer");e.bindBuffer(e.ARRAY_BUFFER,this._vertexBuffer);let t=new Float32Array([-1,-1,0,0,-1,1,0,1,1,1,1,1,1,-1,1,0]);return e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),this._vertexBuffer}_getIndexBuffer(e){if(this._indexBuffer)return this._indexBuffer;if(this._indexBuffer=e.createBuffer(),!this._indexBuffer)throw new Error("Unable to create index buffer");e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this._indexBuffer);let t=new Uint16Array([0,1,2,0,2,3]);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,t,e.STATIC_DRAW),this._indexBuffer}_getGreyscaleShader(e){if(this._greyscaleShader)return this._greyscaleShader;let t=e.createProgram();if(!t)throw new Error("Unable to create program");let r=x(e,e.VERTEX_SHADER,P),a=x(e,e.FRAGMENT_SHADER,z);e.attachShader(t,r),e.attachShader(t,a),function(e,t){e.linkProgram(t);let r=e.getProgramInfoLog(t);if(r&&r.trim().length>0)throw new Error("Unable to link: "+r)}(e,t);let i=e.getUniformLocation(t,"uTexWidth");if(!i)throw new Error("Unable to get uniform location uTexWidth");let _=e.getUniformLocation(t,"uUvTransform");if(!_)throw new Error("Unable to get uniform location uUvTransform");let n=e.getUniformLocation(t,"uSampler");if(!n)throw new Error("Unable to get uniform location uSampler");return this._greyscaleShader={program:t,aVertexPositionLoc:e.getAttribLocation(t,"aVertexPosition"),aTextureCoordLoc:e.getAttribLocation(t,"aTextureCoord"),uTexWidthLoc:i,uUvTransformLoc:_,uSamplerLoc:n},this._greyscaleShader}}let I,F,O,M,P="\n attribute vec4 aVertexPosition;\n attribute vec2 aTextureCoord;\n\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform float uTexWidth;\n\tuniform mat4 uUvTransform;\n\n void main(void) {\n highp vec2 offset1 = vec2(1.5 / uTexWidth, 0);\n highp vec2 offset2 = vec2(0.5 / uTexWidth, 0);\n\n gl_Position = aVertexPosition;\n vTextureCoord1 = (uUvTransform * vec4(aTextureCoord - offset1, 0, 1)).xy;\n vTextureCoord2 = (uUvTransform * vec4(aTextureCoord - offset2, 0, 1)).xy;\n vTextureCoord3 = (uUvTransform * vec4(aTextureCoord + offset2, 0, 1)).xy;\n vTextureCoord4 = (uUvTransform * vec4(aTextureCoord + offset1, 0, 1)).xy;\n }\n",z="\n varying highp vec2 vTextureCoord1;\n varying highp vec2 vTextureCoord2;\n varying highp vec2 vTextureCoord3;\n varying highp vec2 vTextureCoord4;\n\n uniform sampler2D uSampler;\n\n const lowp vec3 colorWeights = vec3(77.0 / 256.0, 150.0 / 256.0, 29.0 / 256.0);\n\n void main(void) {\n lowp vec4 outpx;\n\n outpx.r = dot(colorWeights, texture2D(uSampler, vTextureCoord1).xyz);\n outpx.g = dot(colorWeights, texture2D(uSampler, vTextureCoord2).xyz);\n outpx.b = dot(colorWeights, texture2D(uSampler, vTextureCoord3).xyz);\n outpx.a = dot(colorWeights, texture2D(uSampler, vTextureCoord4).xyz);\n\n gl_FragColor = outpx;\n }\n";var B=r(604),V=function(e,t,r,a){return new(r||(r=Promise))((function(i,_){function n(e){try{o(a.next(e))}catch(e){_(e)}}function s(e){try{o(a.throw(e))}catch(e){_(e)}}function o(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(n,s)}o((a=a.apply(e,t||[])).next())}))};let C,U=new class{constructor(){this.onOutgoingMessage=new s,this.onIncomingMessage=new o,this._outgoingMessages=[]}postIncomingMessage(e){this.onIncomingMessage.emit(e)}postOutgoingMessage(e,t){this._outgoingMessages.push({msg:e,transferables:t}),this.onOutgoingMessage.emit()}getOutgoingMessages(){let e=this._outgoingMessages;return this._outgoingMessages=[],e}},S=0,N=!1;const D=new Map,G=new Map;function X(e,t,r){return V(this,void 0,void 0,(function*(){let i=a.Z({locateFile:(t,r)=>t.endsWith("zappar-cv.wasm")?e:r+t,instantiateWasm:(e,r)=>{const a=new WebAssembly.Instance(t,e);return r(a),a.exports},onRuntimeInitialized:()=>{let e=function(e){let t=e.cwrap("zappar_log_level","number",[]),r=e.cwrap("zappar_log_level_set",null,["number"]),a=e.cwrap("zappar_analytics_project_id_set",null,["string","string"]),i=e.cwrap("zappar_pipeline_create","number",[]),_=e.cwrap("zappar_pipeline_destroy",null,["number"]),n=e.cwrap("zappar_pipeline_camera_frame_data_raw","number",["number"]),s=e.cwrap("zappar_pipeline_camera_frame_data_raw_size","number",["number"]),o=e.cwrap("zappar_pipeline_camera_frame_data_raw_width","number",["number"]),c=e.cwrap("zappar_pipeline_camera_frame_data_raw_height","number",["number"]),l=e.cwrap("zappar_pipeline_frame_update",null,["number"]),f=e.cwrap("zappar_pipeline_frame_number","number",["number"]),p=e.cwrap("zappar_pipeline_camera_model","number",["number"]),u=e.cwrap("zappar_pipeline_camera_frame_user_data","number",["number"]),d=e.cwrap("zappar_pipeline_camera_frame_submit",null,["number","number","number","number","number","number","number","number","number"]),h=e.cwrap("zappar_pipeline_camera_frame_submit_raw_pointer",null,["number","number","number","number","number","number","number","number","number","number","number","number","number"]),m=e.cwrap("zappar_pipeline_camera_frame_camera_attitude","number",["number"]),b=e.cwrap("zappar_pipeline_camera_frame_device_attitude","number",["number"]),g=e.cwrap("zappar_pipeline_motion_accelerometer_submit",null,["number","number","number","number","number"]),w=e.cwrap("zappar_pipeline_motion_accelerometer_with_gravity_submit_int",null,["number","number","number","number","number","number"]),y=e.cwrap("zappar_pipeline_motion_accelerometer_without_gravity_submit_int",null,["number","number","number","number","number","number"]),A=e.cwrap("zappar_pipeline_motion_rotation_rate_submit",null,["number","number","number","number","number"]),E=e.cwrap("zappar_pipeline_motion_rotation_rate_submit_int",null,["number","number","number","number","number","number"]),T=e.cwrap("zappar_pipeline_motion_attitude_submit",null,["number","number","number","number","number"]),R=e.cwrap("zappar_pipeline_motion_attitude_submit_int",null,["number","number","number","number","number","number"]),k=e.cwrap("zappar_pipeline_motion_attitude_matrix_submit",null,["number","number"]),v=e.cwrap("zappar_camera_source_create","number",["number","string"]),x=e.cwrap("zappar_camera_source_destroy",null,["number"]),L=e.cwrap("zappar_sequence_source_create","number",["number"]),I=e.cwrap("zappar_sequence_source_destroy",null,["number"]),F=e.cwrap("zappar_image_tracker_create","number",["number"]),O=e.cwrap("zappar_image_tracker_destroy",null,["number"]),M=e.cwrap("zappar_image_tracker_target_load_from_memory",null,["number","number","number"]),P=e.cwrap("zappar_image_tracker_target_loaded_version","number",["number"]),z=e.cwrap("zappar_image_tracker_enabled","number",["number"]),B=e.cwrap("zappar_image_tracker_enabled_set",null,["number","number"]),V=e.cwrap("zappar_image_tracker_anchor_count","number",["number"]),C=e.cwrap("zappar_image_tracker_anchor_id","string",["number","number"]),U=e.cwrap("zappar_image_tracker_anchor_pose_raw","number",["number","number"]),S=e.cwrap("zappar_face_tracker_create","number",["number"]),N=e.cwrap("zappar_face_tracker_destroy",null,["number"]),D=e.cwrap("zappar_face_tracker_model_load_from_memory",null,["number","number","number"]),G=e.cwrap("zappar_face_tracker_model_loaded_version","number",["number"]),X=e.cwrap("zappar_face_tracker_enabled_set",null,["number","number"]),H=e.cwrap("zappar_face_tracker_enabled","number",["number"]),W=e.cwrap("zappar_face_tracker_max_faces_set",null,["number","number"]),Y=e.cwrap("zappar_face_tracker_max_faces","number",["number"]),q=e.cwrap("zappar_face_tracker_anchor_count","number",["number"]),j=e.cwrap("zappar_face_tracker_anchor_id","string",["number","number"]),K=e.cwrap("zappar_face_tracker_anchor_pose_raw","number",["number","number"]),Z=e.cwrap("zappar_face_tracker_anchor_identity_coefficients","number",["number","number"]),Q=e.cwrap("zappar_face_tracker_anchor_expression_coefficients","number",["number","number"]),J=e.cwrap("zappar_face_mesh_create","number",[]),$=e.cwrap("zappar_face_mesh_destroy",null,["number"]),ee=e.cwrap("zappar_face_landmark_create","number",["number"]),te=e.cwrap("zappar_face_landmark_destroy",null,["number"]),re=e.cwrap("zappar_barcode_finder_create","number",["number"]),ae=e.cwrap("zappar_barcode_finder_destroy",null,["number"]),ie=e.cwrap("zappar_barcode_finder_enabled_set",null,["number","number"]),_e=e.cwrap("zappar_barcode_finder_enabled","number",["number"]),ne=e.cwrap("zappar_barcode_finder_found_number","number",["number"]),se=e.cwrap("zappar_barcode_finder_found_text","string",["number","number"]),oe=e.cwrap("zappar_barcode_finder_found_format","number",["number","number"]),ce=e.cwrap("zappar_barcode_finder_formats","number",["number"]),le=e.cwrap("zappar_barcode_finder_formats_set",null,["number","number"]),fe=e.cwrap("zappar_instant_world_tracker_create","number",["number"]),pe=e.cwrap("zappar_instant_world_tracker_destroy",null,["number"]),ue=e.cwrap("zappar_instant_world_tracker_enabled_set",null,["number","number"]),de=e.cwrap("zappar_instant_world_tracker_enabled","number",["number"]),he=e.cwrap("zappar_instant_world_tracker_anchor_pose_raw","number",["number"]),me=e.cwrap("zappar_instant_world_tracker_anchor_pose_set_from_camera_offset_raw",null,["number","number","number","number","number"]),be=e.cwrap("zappar_zapcode_tracker_create","number",["number"]),ge=e.cwrap("zappar_zapcode_tracker_destroy",null,["number"]),we=e.cwrap("zappar_zapcode_tracker_target_load_from_memory",null,["number","number","number"]),ye=e.cwrap("zappar_zapcode_tracker_target_loaded_version","number",["number"]),Ae=e.cwrap("zappar_zapcode_tracker_enabled","number",["number"]),Ee=e.cwrap("zappar_zapcode_tracker_enabled_set",null,["number","number"]),Te=e.cwrap("zappar_zapcode_tracker_anchor_count","number",["number"]),Re=e.cwrap("zappar_zapcode_tracker_anchor_id","string",["number","number"]),ke=e.cwrap("zappar_zapcode_tracker_anchor_pose_raw","number",["number","number"]),ve=e.cwrap("zappar_world_tracker_create","number",["number"]),xe=e.cwrap("zappar_world_tracker_destroy",null,["number"]),Le=e.cwrap("zappar_world_tracker_enabled","number",["number"]),Ie=e.cwrap("zappar_world_tracker_enabled_set",null,["number","number"]),Fe=e.cwrap("zappar_world_tracker_quality","number",["number"]),Oe=e.cwrap("zappar_world_tracker_plane_count","number",["number"]),Me=e.cwrap("zappar_world_tracker_plane_pose_raw","number",["number","number"]),Pe=e.cwrap("zappar_world_tracker_world_anchor_valid","number",["number"]),ze=e.cwrap("zappar_world_tracker_world_anchor_pose_raw","number",["number"]),Be=e.cwrap("zappar_world_tracker_ground_anchor_valid","number",["number"]),Ve=e.cwrap("zappar_world_tracker_ground_anchor_pose_raw","number",["number"]),Ce=e.cwrap("zappar_world_tracker_reset",null,["number"]),Ue=e.cwrap("zappar_world_tracker_debug_enabled","number",["number"]),Se=e.cwrap("zappar_world_tracker_debug_enabled_set",null,["number","number"]),Ne=e.cwrap("zappar_world_tracker_debug_tracks_data_size","number",["number"]),De=e.cwrap("zappar_world_tracker_debug_tracks_data","number",["number"]),Ge=e.cwrap("zappar_world_tracker_debug_projections_data_size","number",["number"]),Xe=e.cwrap("zappar_world_tracker_debug_projections_data","number",["number"]),He=32,We=e._malloc(He),Ye=(e._malloc(64),new Map),qe=(t,r)=>{let a=Ye.get(t);return(!a||a[0]<r)&&(a&&e._free(a[1]),a=[r,e._malloc(r)],Ye.set(t,a)),a[1]};return{log_level:()=>t(),log_level_set:e=>r(e),analytics_project_id_set:(e,t)=>a(e,t),pipeline_create:()=>i(),pipeline_destroy:()=>{_()},pipeline_camera_frame_data_raw:e=>n(e),pipeline_camera_frame_data_raw_size:e=>s(e),pipeline_camera_frame_data_raw_width:e=>o(e),pipeline_camera_frame_data_raw_height:e=>c(e),pipeline_frame_update:e=>l(e),pipeline_frame_number:e=>f(e),pipeline_camera_model:t=>{let r=p(t),a=new Float32Array(6);return a.set(e.HEAPF32.subarray(r/4,6+r/4)),r=a,r},pipeline_camera_frame_user_data:e=>u(e),pipeline_camera_frame_submit:(t,r,a,i,_,n,s,o)=>{He<r.byteLength&&(e._free(We),He=r.byteLength,We=e._malloc(He));let c=We,l=r.byteLength;e.HEAPU8.set(new Uint8Array(r),We);let f=a,p=i,u=_,h=qe(4,n.byteLength);e.HEAPF32.set(n,h/4);let m=qe(5,s.byteLength);return e.HEAPF32.set(s,m/4),d(t,c,l,f,p,u,h,m,o?1:0)},pipeline_camera_frame_submit_raw_pointer:(t,r,a,i,_,n,s,o,c,l,f,p,u)=>{let d=r,m=a,b=i,g=_,w=n,y=s,A=qe(6,o.byteLength);e.HEAPF32.set(o,A/4);let E=c,T=qe(8,l.byteLength);return e.HEAPF32.set(l,T/4),h(t,d,m,b,g,w,y,A,E,T,f?1:0,p,u?1:0)},pipeline_camera_frame_camera_attitude:t=>{let r=m(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_camera_frame_device_attitude:t=>{let r=b(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},pipeline_motion_accelerometer_submit:(e,t,r,a,i)=>g(e,t,r,a,i),pipeline_motion_accelerometer_with_gravity_submit_int:(e,t,r,a,i,_)=>w(e,t,r,a,i,_),pipeline_motion_accelerometer_without_gravity_submit_int:(e,t,r,a,i,_)=>y(e,t,r,a,i,_),pipeline_motion_rotation_rate_submit:(e,t,r,a,i)=>A(e,t,r,a,i),pipeline_motion_rotation_rate_submit_int:(e,t,r,a,i,_)=>E(e,t,r,a,i,_),pipeline_motion_attitude_submit:(e,t,r,a,i)=>T(e,t,r,a,i),pipeline_motion_attitude_submit_int:(e,t,r,a,i,_)=>R(e,t,r,a,i,_),pipeline_motion_attitude_matrix_submit:(t,r)=>{let a=qe(0,r.byteLength);return e.HEAPF32.set(r,a/4),k(t,a)},camera_source_create:(e,t)=>v(e,t),camera_source_destroy:()=>{x()},sequence_source_create:e=>L(e),sequence_source_destroy:()=>{I()},image_tracker_create:e=>F(e),image_tracker_destroy:()=>{O()},image_tracker_target_load_from_memory:(t,r)=>{He<r.byteLength&&(e._free(We),He=r.byteLength,We=e._malloc(He));let a=We,i=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),We),M(t,a,i)},image_tracker_target_loaded_version:e=>P(e),image_tracker_enabled:e=>{let t=z(e);return t=1===t,t},image_tracker_enabled_set:(e,t)=>B(e,t?1:0),image_tracker_anchor_count:e=>V(e),image_tracker_anchor_id:(e,t)=>C(e,t),image_tracker_anchor_pose_raw:(t,r)=>{let a=U(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},face_tracker_create:e=>S(e),face_tracker_destroy:()=>{N()},face_tracker_model_load_from_memory:(t,r)=>{He<r.byteLength&&(e._free(We),He=r.byteLength,We=e._malloc(He));let a=We,i=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),We),D(t,a,i)},face_tracker_model_loaded_version:e=>G(e),face_tracker_enabled_set:(e,t)=>X(e,t?1:0),face_tracker_enabled:e=>{let t=H(e);return t=1===t,t},face_tracker_max_faces_set:(e,t)=>W(e,t),face_tracker_max_faces:e=>Y(e),face_tracker_anchor_count:e=>q(e),face_tracker_anchor_id:(e,t)=>j(e,t),face_tracker_anchor_pose_raw:(t,r)=>{let a=K(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},face_tracker_anchor_identity_coefficients:(t,r)=>{let a=Z(t,r),i=new Float32Array(50);return i.set(e.HEAPF32.subarray(a/4,50+a/4)),a=i,a},face_tracker_anchor_expression_coefficients:(t,r)=>{let a=Q(t,r),i=new Float32Array(29);return i.set(e.HEAPF32.subarray(a/4,29+a/4)),a=i,a},face_mesh_create:()=>J(),face_mesh_destroy:()=>{$()},face_landmark_create:e=>ee(e),face_landmark_destroy:()=>{te()},barcode_finder_create:e=>re(e),barcode_finder_destroy:()=>{ae()},barcode_finder_enabled_set:(e,t)=>ie(e,t?1:0),barcode_finder_enabled:e=>{let t=_e(e);return t=1===t,t},barcode_finder_found_number:e=>ne(e),barcode_finder_found_text:(e,t)=>se(e,t),barcode_finder_found_format:(e,t)=>oe(e,t),barcode_finder_formats:e=>ce(e),barcode_finder_formats_set:(e,t)=>le(e,t),instant_world_tracker_create:e=>fe(e),instant_world_tracker_destroy:()=>{pe()},instant_world_tracker_enabled_set:(e,t)=>ue(e,t?1:0),instant_world_tracker_enabled:e=>{let t=de(e);return t=1===t,t},instant_world_tracker_anchor_pose_raw:t=>{let r=he(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},instant_world_tracker_anchor_pose_set_from_camera_offset_raw:(e,t,r,a,i)=>me(e,t,r,a,i),zapcode_tracker_create:e=>be(e),zapcode_tracker_destroy:()=>{ge()},zapcode_tracker_target_load_from_memory:(t,r)=>{He<r.byteLength&&(e._free(We),He=r.byteLength,We=e._malloc(He));let a=We,i=r.byteLength;return e.HEAPU8.set(new Uint8Array(r),We),we(t,a,i)},zapcode_tracker_target_loaded_version:e=>ye(e),zapcode_tracker_enabled:e=>{let t=Ae(e);return t=1===t,t},zapcode_tracker_enabled_set:(e,t)=>Ee(e,t?1:0),zapcode_tracker_anchor_count:e=>Te(e),zapcode_tracker_anchor_id:(e,t)=>Re(e,t),zapcode_tracker_anchor_pose_raw:(t,r)=>{let a=ke(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},world_tracker_create:e=>ve(e),world_tracker_destroy:()=>{xe()},world_tracker_enabled:e=>{let t=Le(e);return t=1===t,t},world_tracker_enabled_set:(e,t)=>Ie(e,t?1:0),world_tracker_quality:e=>Fe(e),world_tracker_plane_count:e=>Oe(e),world_tracker_plane_pose_raw:(t,r)=>{let a=Me(t,r),i=new Float32Array(16);return i.set(e.HEAPF32.subarray(a/4,16+a/4)),a=i,a},world_tracker_world_anchor_valid:e=>{let t=Pe(e);return t=1===t,t},world_tracker_world_anchor_pose_raw:t=>{let r=ze(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_ground_anchor_valid:e=>{let t=Be(e);return t=1===t,t},world_tracker_ground_anchor_pose_raw:t=>{let r=Ve(t),a=new Float32Array(16);return a.set(e.HEAPF32.subarray(r/4,16+r/4)),r=a,r},world_tracker_reset:e=>Ce(e),world_tracker_debug_enabled:e=>{let t=Ue(e);return t=1===t,t},world_tracker_debug_enabled_set:(e,t)=>Se(e,t?1:0),world_tracker_debug_tracks_data_size:e=>Ne(e),world_tracker_debug_tracks_data:t=>{let r=De(t),a=Ne(t),i=new Float32Array(a);return i.set(e.HEAPF32.subarray(r/4,a+r/4)),r=i,r},world_tracker_debug_projections_data_size:e=>Ge(e),world_tracker_debug_projections_data:t=>{let r=Xe(t),a=Ge(t),i=new Float32Array(a);return i.set(e.HEAPF32.subarray(r/4,a+r/4)),r=i,r}}}(i);const t=(0,B.g)(i),a=r?function(e){return{data_download_clear:e.cwrap("data_download_clear",null,[]),data_download_size:e.cwrap("data_download_size","number",[]),data_download:e.cwrap("data_download","number",[]),data_should_record_set:e.cwrap("data_should_record_set",null,["number"])}}(i):void 0;null==a||a.data_should_record_set(1);let _=new n(e,((e,t)=>{U.postOutgoingMessage({p:e,t:"zappar",d:t},[t])}));U.postOutgoingMessage("loaded",[]),U.onIncomingMessage.bind((r=>{var n,s,o;switch(r.t){case"zappar":_.processBuffer(r.d),U.postOutgoingMessage({t:"buf",d:r.d},[r.d]);break;case"buf":null===(n=_.serializersByPipelineId.get(r.p))||void 0===n||n.bufferReturn(r.d);break;case"cameraFrameC2S":{let n,s=r,o=_._pipeline_by_instance.get(s.p);o&&(e.pipeline_camera_frame_submit(o,s.d,s.width,s.height,s.token,s.c2d,s.cm,s.userFacing),e.pipeline_frame_update(o),n=e.pipeline_camera_frame_device_attitude(o),_.exploreState(),$(i,t),a&&ee(i,a));let c={token:s.token,d:s.d,p:s.p,t:"cameraFrameRecycleS2C",att:n};U.postOutgoingMessage(c,[s.d]);break}case"rawenabled":N=r.v;break;case"rawrequest":{const e=r,t=D.get(e.p),a={t:"raw",token:e.token,p:e.p,data:t&&null!==(o=null===(s=t.ready.find((t=>t.token===e.token)))||void 0===s?void 0:s.data)&&void 0!==o?o:null};U.postOutgoingMessage(a,[]);break}case"cameraProfileC2S":{let e=r;G.set(e.source,e.p);break}case"streamC2S":{let n=r;(function(e,t,r,a,i,_,n,s,o){return V(this,void 0,void 0,(function*(){for(;;){let c;try{c=yield r.getReader()}catch(e){yield Q(1e3);continue}try{return void(yield Z(e,t,c,a,i,_,n,s,o))}catch(e){}return void(yield Q(1e3))}}))})(i,e,n.s,n.p,n.userFacing,_,n.source,t,a).then((()=>{let e={t:"streamEndedS2C",p:n.p,source:n.source};U.postOutgoingMessage(e,[])})).catch((e=>{}));break}case"cameraToScreenC2S":S=r.r;break;case"imageBitmapC2S":!function(e,t,r,a){const[i,_]=function(){if(!O||!M){const e=new OffscreenCanvas(1,1);if(M=e.getContext("webgl"),!M)throw new Error("Unable to get offscreen GL context");O=new L(M)}return[O,M]}();if(F||(F=_.createTexture(),_.bindTexture(_.TEXTURE_2D,F),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE),_.texParameteri(_.TEXTURE_2D,_.TEXTURE_MIN_FILTER,_.LINEAR)),!F)return;const[n,s]=E.getDataSize(e.cp);(!I||I.byteLength<n*s)&&(I=new ArrayBuffer(n*s)),i.uploadFrame(F,e.i,e.r,e.userFacing,e.cp);let o=i.readFrame(F,I,e.cp),c={t:"imageBitmapS2C",dataWidth:o.dataWidth,dataHeight:o.dataHeight,frame:e.i,userFacing:o.userFacing,uvTransform:o.uvTransform||b.Ue(),tokenId:e.tokenId,p:e.p};a.postOutgoingMessage(c,[e.i]);let l=r._pipeline_by_instance.get(e.p);l&&(t.pipeline_camera_frame_submit(l,I,o.dataWidth,o.dataHeight,e.tokenId,e.cameraToDevice,e.cameraModel,o.userFacing),t.pipeline_frame_update(l),r.exploreState())}(r,e,_,U);break;case"sensorDataC2S":{const t=r,a=_._pipeline_by_instance.get(t.p);if(!a)break;switch(t.sensor){case"accel":e.pipeline_motion_accelerometer_submit(a,t.timestamp,t.x,t.y,t.z);break;case"accel_w_gravity_int":e.pipeline_motion_accelerometer_with_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"accel_wo_gravity_int":e.pipeline_motion_accelerometer_without_gravity_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude_int":e.pipeline_motion_attitude_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"attitude":e.pipeline_motion_attitude_submit(a,t.timestamp,t.x,t.y,t.z);break;case"rotation_rate_int":e.pipeline_motion_rotation_rate_submit_int(a,t.timestamp,t.interval,t.x,t.y,t.z);break;case"rotation_rate":e.pipeline_motion_rotation_rate_submit(a,t.timestamp,t.x,t.y,t.z)}break}case"attitudeMatrixC2S":{const t=r,a=_._pipeline_by_instance.get(t.p);if(!a)break;e.pipeline_motion_attitude_matrix_submit(a,t.m);break}}}))}})}))}let H=0,W=0,Y=1;function q(e){return new Promise(((t,r)=>{const a=setTimeout((()=>{r("Frame timeout")}),2e3);e.read().then((e=>{clearTimeout(a),t(e)}))}))}const j=b.Ue(),K=new Float32Array([300,300,160,120,0,0]);function Z(e,t,r,a,i,_,n,s,o){var c,l;return V(this,void 0,void 0,(function*(){for(;;){let f=yield q(r);if(f.done)return void(null===(c=f.value)||void 0===c||c.close());let p=f.value,u=p.allocationSize();u>W&&(H>0&&e._free(H),H=e._malloc(u),W=u),yield p.copyTo(e.HEAPU8.subarray(H,H+W));let d=Y;Y++;const h=p.visibleRect.width,g=p.visibleRect.height;let w,y=h,A=g;switch(S){case 270:w=new Float32Array([0,1,0,0,-1,0,0,0,0,0,1,0,1,0,0,1]),y=g,A=h;break;case 180:w=new Float32Array([-1,0,0,0,0,-1,0,0,0,0,1,0,1,1,0,1]);break;case 90:w=new Float32Array([0,-1,0,0,1,0,0,0,0,0,1,0,0,1,0,1]),y=g,A=h;break;default:w=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}let E=!1;G.get(n)!==m.HIGH&&(y/=2,A/=2,E=!0);let T=p.clone();i?b.xJ(j,[-1,1,-1]):b.yR(j);let R=300*y/320;K[0]=R,K[1]=R,K[2]=.5*y,K[3]=.5*A;const k={token:d,d:T,p:a,t:"videoFrameS2C",userFacing:i,uvTransform:w,w:y,h:A,cameraToDevice:j,cameraModel:K,source:n};U.postOutgoingMessage(k,[k.d,k.uvTransform.buffer]);const v=_._pipeline_by_instance.get(a);if(v){try{t.pipeline_camera_frame_submit_raw_pointer(v,H,u,J(p.format),h,g,d,j,S,K,i,null!==(l=p.timestamp)&&void 0!==l?l:-1,E),$(e,s),o&&ee(e,o)}catch(e){console.log("Exception during camera processing",e)}if(t.pipeline_frame_update(v),N){let r=D.get(a);if(r||(r={available:[],ready:[]},D.set(a,r)),r.ready.length>4){const e=r.ready.splice(0,1);for(const t of e)r.available.push(new Uint8Array(t.data.data))}const i=t.pipeline_camera_frame_data_raw_size(v);let _;for(;!_||_.byteLength<i;)r.available.length<1&&r.available.push(new Uint8Array(i)),_=r.available.pop();const n=t.pipeline_camera_frame_data_raw(v);_.set(e.HEAPU8.subarray(n,n+i)),r.ready.push({token:d,data:{data:_,width:t.pipeline_camera_frame_data_raw_width(a),height:t.pipeline_camera_frame_data_raw_height(a)}})}_.exploreState()}p.close()}}))}function Q(e){return new Promise((t=>{setTimeout(t,e)}))}function J(e){switch(e){case"I420":return u.FRAME_PIXEL_FORMAT_I420;case"I420A":return u.FRAME_PIXEL_FORMAT_I420A;case"I422":return u.FRAME_PIXEL_FORMAT_I422;case"I444":return u.FRAME_PIXEL_FORMAT_I444;case"NV12":return u.FRAME_PIXEL_FORMAT_NV12;case"RGBA":case"RGBX":return u.FRAME_PIXEL_FORMAT_RGBA;case"BGRA":case"BGRX":return u.FRAME_PIXEL_FORMAT_BGRA}return u.FRAME_PIXEL_FORMAT_Y}function $(e,t){const r=t.worker_message_send_count();if(0!==r){C||(C=new MessageChannel,C.port1.start(),C.port1.addEventListener("message",(r=>{if("msgrec"!==r.data.t)return;const a=r.data.data,i=e._malloc(a.byteLength);e.HEAPU8.set(a,i),t.worker_message_receive(r.data.reference,a.byteLength,i),e._free(i)})),U.postOutgoingMessage({t:"setupCeresWorker",port:C.port2},[C.port2]));for(let a=0;a<r;a++){const r=t.worker_message_send_reference(a),i=t.worker_message_send_data_size(a),_=t.worker_message_send_data(a),n=e.HEAPU8.slice(_,_+i);C.port1.postMessage({t:"msgsend",data:n,reference:r},[n.buffer])}t.worker_message_send_clear()}}function ee(e,t){const r=t.data_download_size();if(0===r)return;const a=t.data_download(),i=e.HEAPU8.slice(a,a+r);U.postOutgoingMessage({t:"_z_datadownload",data:i},[i.buffer]),t.data_download_clear()}const te=self;U.onOutgoingMessage.bind((()=>{let e=U.getOutgoingMessages();for(let t of e)te.postMessage(t.msg,t.transferables)}));let re=e=>{var t;e&&e.data&&"wasm"===e.data.t&&(X(location.href.startsWith("blob")?e.data.url:new URL(r(751),r.b).toString(),e.data.module,null!==(t=e.data.shouldRecordData)&&void 0!==t&&t),te.removeEventListener("message",re))};te.addEventListener("message",re),te.addEventListener("message",(e=>{U.postIncomingMessage(e.data)}))}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var _=a[e]={exports:{}};return r[e].call(_.exports,_,_.exports,i),_.exports}return i.m=r,i.x=()=>{var e=i.O(void 0,[169,867],(()=>i(152)));return i.O(e)},i.amdO={},e=[],i.O=(t,r,a,_)=>{if(!r){var n=1/0;for(l=0;l<e.length;l++){for(var[r,a,_]=e[l],s=!0,o=0;o<r.length;o++)(!1&_||n>=_)&&Object.keys(i.O).every((e=>i.O[e](r[o])))?r.splice(o--,1):(s=!1,_<n&&(n=_));if(s){e.splice(l--,1);var c=a();void 0!==c&&(t=c)}}return t}_=_||0;for(var l=e.length;l>0&&e[l-1][2]>_;l--)e[l]=e[l-1];e[l]=[r,a,_]},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,r)=>(i.f[r](e,t),t)),[])),i.u=e=>e+".zappar-cv.js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var a=r.length-1;a>-1&&!e;)e=r[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{i.b=self.location+"";var e={751:1};i.f.i=(t,r)=>{e[t]||importScripts(i.p+i.u(t))};var t=self.webpackChunkZCV=self.webpackChunkZCV||[],r=t.push.bind(t);t.push=t=>{var[a,_,n]=t;for(var s in _)i.o(_,s)&&(i.m[s]=_[s]);for(n&&n(i);a.length;)e[a.pop()]=1;r(t)}})(),t=i.x,i.x=()=>Promise.all([i.e(169),i.e(867)]).then(t),i.x()})()));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc