{let e=S.getOutgoingMessages();for(let t of e)W.postMessage(t.msg,t.transferables)}));let H=e=>{e&&e.data&&"wasm"===e.data.t&&(C(location.href.startsWith("blob")?e.data.url:new URL(r(751),r.b).toString()),W.removeEventListener("message",H))};W.addEventListener("message",H),W.addEventListener("message",(e=>{S.postIncomingMessage(e.data)}))})()})();',
+ "Worker",
+ void 0,
+ r.p + "zappar-cv.worker.js"
+ );
+ }
+ },
+ 477: (e) => {
+ "use strict";
+ e.exports = function (e, t, r, i) {
+ var a = self || window;
+ try {
+ try {
+ var n;
+ try {
+ n = new a.Blob([e]);
+ } catch (t) {
+ (n = new (a.BlobBuilder ||
+ a.WebKitBlobBuilder ||
+ a.MozBlobBuilder ||
+ a.MSBlobBuilder)()).append(e),
+ (n = n.getBlob());
+ }
+ var s = a.URL || a.webkitURL,
+ o = s.createObjectURL(n),
+ _ = new a[t](o, r);
+ return s.revokeObjectURL(o), _;
+ } catch (i) {
+ return new a[t](
+ "data:application/javascript,".concat(encodeURIComponent(e)),
+ r
+ );
+ }
+ } catch (e) {
+ if (!i) throw Error("Inline worker is not supported");
+ return new a[t](i, r);
+ }
+ };
+ },
+ 698: (e, t, r) => {
+ "use strict";
+ e.exports = r.p + "b4f46e148a3b3b5aef90.zbin";
+ },
+ 825: (e, t, r) => {
+ "use strict";
+ e.exports = r.p + "f7b62a3a53b5c9b3222b.zbin";
+ },
+ 367: (e, t, r) => {
+ "use strict";
+ e.exports = r.p + "482727c0e7dd40d73f5a.zbin";
+ },
+ 751: (e, t, r) => {
+ "use strict";
+ e.exports = r.p + "c85c7df8e3132b359723.wasm";
+ },
+ },
+ t = {};
+ function r(i) {
+ var a = t[i];
+ if (void 0 !== a) return a.exports;
+ var n = (t[i] = { exports: {} });
+ return e[i].call(n.exports, n, n.exports, r), n.exports;
+ }
+ (r.m = e),
+ (r.amdO = {}),
+ (r.n = (e) => {
+ var t = e && e.__esModule ? () => e.default : () => e;
+ return r.d(t, { a: t }), t;
+ }),
+ (r.d = (e, t) => {
+ for (var i in t)
+ r.o(t, i) &&
+ !r.o(e, i) &&
+ Object.defineProperty(e, i, { enumerable: !0, get: t[i] });
+ }),
+ (r.u = (e) => e + ".zappar-cv.js"),
+ (r.g = (function () {
+ if ("object" == typeof globalThis) return globalThis;
+ try {
+ return this || new Function("return this")();
+ } catch (e) {
+ if ("object" == typeof window) return window;
+ }
+ })()),
+ (r.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)),
+ (r.r = (e) => {
+ "undefined" != typeof Symbol &&
+ Symbol.toStringTag &&
+ Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }),
+ Object.defineProperty(e, "__esModule", { value: !0 });
+ }),
+ (() => {
+ var e;
+ r.g.importScripts && (e = r.g.location + "");
+ var t = r.g.document;
+ if (!e && t && (t.currentScript && (e = t.currentScript.src), !e)) {
+ var i = t.getElementsByTagName("script");
+ i.length && (e = i[i.length - 1].src);
+ }
+ if (!e)
+ throw new Error(
+ "Automatic publicPath is not supported in this browser"
+ );
+ (e = e
+ .replace(/#.*$/, "")
+ .replace(/\?.*$/, "")
+ .replace(/\/[^\/]+$/, "/")),
+ (r.p = e);
+ })(),
+ (r.b = document.baseURI || self.location.href);
+ var i = {};
+ return (
+ (() => {
+ "use strict";
+ var e, t, a, n, s, o;
+ r.r(i),
+ r.d(i, {
+ barcode_format_t: () => e,
+ face_landmark_name_t: () => t,
+ image_target_type_t: () => o,
+ initialize: () => Vt,
+ instant_world_tracker_transform_orientation_t: () => a,
+ log_level_t: () => n,
+ }),
+ (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");
+ })(e || (e = {})),
+ (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");
+ })(t || (t = {})),
+ (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");
+ })(a || (a = {})),
+ (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");
+ })(n || (n = {})),
+ (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");
+ })(s || (s = {})),
+ (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");
+ })(o || (o = {}));
+ class _ {
+ 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),
+ 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 i = 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)),
+ i && this._i32View.set(i.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 c {
+ 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
+ );
+ },
+ 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 l {
+ constructor(e) {
+ (this._messageSender = e),
+ (this._globalState = { log_level: 1 }),
+ (this.serializer = new _((e) => {
+ this._messageSender(e);
+ })),
+ (this.deserializer = new c()),
+ (this._latestId = 1),
+ (this._pipeline_state_by_instance = new Map()),
+ (this._camera_source_state_by_instance = new Map()),
+ (this._sequence_source_state_by_instance = new Map()),
+ (this._image_tracker_state_by_instance = new Map()),
+ (this._face_tracker_state_by_instance = new Map()),
+ (this._face_mesh_state_by_instance = new Map()),
+ (this._face_landmark_state_by_instance = new Map()),
+ (this._barcode_finder_state_by_instance = new Map()),
+ (this._instant_world_tracker_state_by_instance = new Map()),
+ (this.impl = {
+ log_level: () => this._globalState.log_level,
+ log_level_set: (e) => {
+ this.serializer.sendMessage(34, (t) => {
+ t.logLevel(e);
+ });
+ },
+ analytics_project_id_set: (e, t) => {
+ this.serializer.sendMessage(31, (r) => {
+ r.string(e), r.string(t);
+ });
+ },
+ pipeline_create: () => {
+ let e = this._latestId++,
+ t = {
+ current_frame_user_data: 0,
+ camera_model: new Float32Array([
+ 300, 300, 160, 120, 0, 0,
+ ]),
+ camera_pose: new Float32Array([
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
+ ]),
+ camera_frame_camera_attitude: new Float32Array([
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
+ ]),
+ camera_frame_device_attitude: new Float32Array([
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
+ ]),
+ frame_number: 0,
+ };
+ return (
+ this._pipeline_state_by_instance.set(e, t),
+ this.serializer.sendMessage(27, (t) => {
+ t.type(e);
+ }),
+ e
+ );
+ },
+ pipeline_destroy: (e) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._pipeline_state_by_instance.delete(e),
+ this.serializer.sendMessage(28, (t) => {
+ t.type(e);
+ });
+ },
+ pipeline_frame_update: (e) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(9, (t) => {
+ t.type(e);
+ });
+ },
+ pipeline_frame_number: (e) => {
+ let t = this._pipeline_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.frame_number;
+ },
+ pipeline_camera_model: (e) => {
+ let t = this._pipeline_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.camera_model;
+ },
+ pipeline_camera_frame_user_data: (e) => {
+ let t = this._pipeline_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.current_frame_user_data;
+ },
+ pipeline_camera_frame_submit: (e, t, r, i, a, n, s, o) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(8, (_) => {
+ _.type(e),
+ _.dataWithLength(t),
+ _.int(r),
+ _.int(i),
+ _.int(a),
+ _.matrix4x4(n),
+ _.cameraModel(s),
+ _.bool(o);
+ });
+ },
+ pipeline_camera_frame_submit_raw_pointer: (
+ e,
+ t,
+ r,
+ i,
+ a,
+ n,
+ s,
+ o,
+ _,
+ c,
+ l
+ ) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ },
+ pipeline_camera_frame_camera_attitude: (e) => {
+ let t = this._pipeline_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.camera_frame_camera_attitude;
+ },
+ pipeline_camera_frame_device_attitude: (e) => {
+ let t = this._pipeline_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.camera_frame_device_attitude;
+ },
+ pipeline_motion_accelerometer_submit: (e, t, r, i, a) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(10, (n) => {
+ n.type(e),
+ n.timestamp(t),
+ n.float(r),
+ n.float(i),
+ n.float(a);
+ });
+ },
+ pipeline_motion_rotation_rate_submit: (e, t, r, i, a) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(11, (n) => {
+ n.type(e),
+ n.timestamp(t),
+ n.float(r),
+ n.float(i),
+ n.float(a);
+ });
+ },
+ pipeline_motion_attitude_submit: (e, t, r, i, a) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(12, (n) => {
+ n.type(e),
+ n.timestamp(t),
+ n.float(r),
+ n.float(i),
+ n.float(a);
+ });
+ },
+ pipeline_motion_attitude_matrix_submit: (e, t) => {
+ if (!this._pipeline_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(13, (r) => {
+ r.type(e), r.matrix4x4(t);
+ });
+ },
+ camera_source_create: (e, t) => {
+ let r = this._latestId++;
+ return (
+ this._camera_source_state_by_instance.set(r, {}),
+ this.serializer.sendMessage(29, (i) => {
+ i.type(r), i.type(e), i.string(t);
+ }),
+ r
+ );
+ },
+ camera_source_destroy: (e) => {
+ if (!this._camera_source_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._camera_source_state_by_instance.delete(e),
+ this.serializer.sendMessage(30, (t) => {
+ t.type(e);
+ });
+ },
+ sequence_source_create: (e) => {
+ let t = this._latestId++;
+ return (
+ this._sequence_source_state_by_instance.set(t, {}),
+ this.serializer.sendMessage(35, (r) => {
+ r.type(t), r.type(e);
+ }),
+ t
+ );
+ },
+ sequence_source_destroy: (e) => {
+ if (!this._sequence_source_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._sequence_source_state_by_instance.delete(e),
+ this.serializer.sendMessage(36, (t) => {
+ t.type(e);
+ });
+ },
+ image_tracker_create: (e) => {
+ let t = this._latestId++;
+ return (
+ this._image_tracker_state_by_instance.set(t, {
+ enabled: !0,
+ target_loaded_version: -1,
+ anchor_count: 0,
+ anchor_id: [],
+ anchor_pose: [],
+ }),
+ this.serializer.sendMessage(2, (r) => {
+ r.type(t), r.type(e);
+ }),
+ t
+ );
+ },
+ image_tracker_destroy: (e) => {
+ if (!this._image_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._image_tracker_state_by_instance.delete(e),
+ this.serializer.sendMessage(14, (t) => {
+ t.type(e);
+ });
+ },
+ image_tracker_target_load_from_memory: (e, t) => {
+ if (!this._image_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(4, (r) => {
+ r.type(e), r.dataWithLength(t);
+ });
+ },
+ image_tracker_target_loaded_version: (e) => {
+ let t = this._image_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.target_loaded_version;
+ },
+ image_tracker_enabled: (e) => {
+ let t = this._image_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.enabled;
+ },
+ image_tracker_enabled_set: (e, t) => {
+ if (!this._image_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(3, (r) => {
+ r.type(e), r.bool(t);
+ });
+ },
+ image_tracker_anchor_count: (e) => {
+ let t = this._image_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.anchor_count;
+ },
+ image_tracker_anchor_id: (e, t) => {
+ let r = this._image_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_id[t];
+ },
+ image_tracker_anchor_pose_raw: (e, t) => {
+ let r = this._image_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_pose[t];
+ },
+ face_tracker_create: (e) => {
+ let t = this._latestId++;
+ return (
+ this._face_tracker_state_by_instance.set(t, {
+ enabled: !0,
+ model_loaded: -1,
+ max_faces: 1,
+ anchor_count: 0,
+ anchor_id: [],
+ anchor_pose: [],
+ anchor_identity_coefficients: [],
+ anchor_expression_coefficients: [],
+ }),
+ this.serializer.sendMessage(20, (r) => {
+ r.type(t), r.type(e);
+ }),
+ t
+ );
+ },
+ face_tracker_destroy: (e) => {
+ if (!this._face_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._face_tracker_state_by_instance.delete(e),
+ this.serializer.sendMessage(21, (t) => {
+ t.type(e);
+ });
+ },
+ face_tracker_model_load_from_memory: (e, t) => {
+ if (!this._face_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(22, (r) => {
+ r.type(e), r.dataWithLength(t);
+ });
+ },
+ face_tracker_model_loaded_version: (e) => {
+ let t = this._face_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.model_loaded;
+ },
+ face_tracker_enabled_set: (e, t) => {
+ if (!this._face_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(23, (r) => {
+ r.type(e), r.bool(t);
+ });
+ },
+ face_tracker_enabled: (e) => {
+ let t = this._face_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.enabled;
+ },
+ face_tracker_max_faces_set: (e, t) => {
+ if (!this._face_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(24, (r) => {
+ r.type(e), r.int(t);
+ });
+ },
+ face_tracker_max_faces: (e) => {
+ let t = this._face_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.max_faces;
+ },
+ face_tracker_anchor_count: (e) => {
+ let t = this._face_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.anchor_count;
+ },
+ face_tracker_anchor_id: (e, t) => {
+ let r = this._face_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_id[t];
+ },
+ face_tracker_anchor_pose_raw: (e, t) => {
+ let r = this._face_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_pose[t];
+ },
+ face_tracker_anchor_identity_coefficients: (e, t) => {
+ let r = this._face_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_identity_coefficients[t];
+ },
+ face_tracker_anchor_expression_coefficients: (e, t) => {
+ let r = this._face_tracker_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.anchor_expression_coefficients[t];
+ },
+ face_mesh_create: () => {
+ let e = this._latestId++;
+ return (
+ this._face_mesh_state_by_instance.set(e, {}),
+ this.serializer.sendMessage(25, (t) => {
+ t.type(e);
+ }),
+ e
+ );
+ },
+ face_mesh_destroy: (e) => {
+ if (!this._face_mesh_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._face_mesh_state_by_instance.delete(e),
+ this.serializer.sendMessage(26, (t) => {
+ t.type(e);
+ });
+ },
+ face_landmark_create: (e) => {
+ let t = this._latestId++;
+ return (
+ this._face_landmark_state_by_instance.set(t, {}),
+ this.serializer.sendMessage(32, (r) => {
+ r.type(t), r.faceLandmarkName(e);
+ }),
+ t
+ );
+ },
+ face_landmark_destroy: (e) => {
+ if (!this._face_landmark_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._face_landmark_state_by_instance.delete(e),
+ this.serializer.sendMessage(33, (t) => {
+ t.type(e);
+ });
+ },
+ barcode_finder_create: (e) => {
+ let t = this._latestId++;
+ return (
+ this._barcode_finder_state_by_instance.set(t, {
+ enabled: !0,
+ number_found: 0,
+ found_text: [],
+ found_format: [],
+ formats: 131071,
+ }),
+ this.serializer.sendMessage(16, (r) => {
+ r.type(t), r.type(e);
+ }),
+ t
+ );
+ },
+ barcode_finder_destroy: (e) => {
+ if (!this._barcode_finder_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._barcode_finder_state_by_instance.delete(e),
+ this.serializer.sendMessage(17, (t) => {
+ t.type(e);
+ });
+ },
+ barcode_finder_enabled_set: (e, t) => {
+ if (!this._barcode_finder_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(18, (r) => {
+ r.type(e), r.bool(t);
+ });
+ },
+ barcode_finder_enabled: (e) => {
+ let t = this._barcode_finder_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.enabled;
+ },
+ barcode_finder_found_number: (e) => {
+ let t = this._barcode_finder_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.number_found;
+ },
+ barcode_finder_found_text: (e, t) => {
+ let r = this._barcode_finder_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.found_text[t];
+ },
+ barcode_finder_found_format: (e, t) => {
+ let r = this._barcode_finder_state_by_instance.get(e);
+ if (!r) throw new Error("This object has been destroyed");
+ return r.found_format[t];
+ },
+ barcode_finder_formats: (e) => {
+ let t = this._barcode_finder_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.formats;
+ },
+ barcode_finder_formats_set: (e, t) => {
+ if (!this._barcode_finder_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(19, (r) => {
+ r.type(e), r.barcodeFormat(t);
+ });
+ },
+ instant_world_tracker_create: (e) => {
+ let t = this._latestId++,
+ r = {
+ enabled: !0,
+ pose: new Float32Array([
+ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1,
+ ]),
+ };
+ return (
+ this._instant_world_tracker_state_by_instance.set(t, r),
+ this.serializer.sendMessage(5, (r) => {
+ r.type(t), r.type(e);
+ }),
+ t
+ );
+ },
+ instant_world_tracker_destroy: (e) => {
+ if (!this._instant_world_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this._instant_world_tracker_state_by_instance.delete(e),
+ this.serializer.sendMessage(15, (t) => {
+ t.type(e);
+ });
+ },
+ instant_world_tracker_enabled_set: (e, t) => {
+ if (!this._instant_world_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(6, (r) => {
+ r.type(e), r.bool(t);
+ });
+ },
+ instant_world_tracker_enabled: (e) => {
+ let t = this._instant_world_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.enabled;
+ },
+ instant_world_tracker_anchor_pose_raw: (e) => {
+ let t = this._instant_world_tracker_state_by_instance.get(e);
+ if (!t) throw new Error("This object has been destroyed");
+ return t.pose;
+ },
+ instant_world_tracker_anchor_pose_set_from_camera_offset_raw: (
+ e,
+ t,
+ r,
+ i,
+ a
+ ) => {
+ if (!this._instant_world_tracker_state_by_instance.get(e))
+ throw new Error("This object has been destroyed");
+ this.serializer.sendMessage(7, (n) => {
+ n.type(e),
+ n.float(t),
+ n.float(r),
+ n.float(i),
+ n.instantTrackerTransformOrientation(a);
+ });
+ },
+ });
+ }
+ processMessages(e) {
+ this.deserializer.setData(e),
+ this.deserializer.forMessages((e, t) => {
+ switch (e) {
+ case 7: {
+ let e = t.type(),
+ r = this._pipeline_state_by_instance.get(e);
+ if (!r) return;
+ r.frame_number = t.int();
+ break;
+ }
+ case 6: {
+ let e = t.type(),
+ r = this._pipeline_state_by_instance.get(e);
+ if (!r) return;
+ r.camera_model = t.cameraModel();
+ break;
+ }
+ case 5: {
+ let e = t.type(),
+ r = this._pipeline_state_by_instance.get(e);
+ if (!r) return;
+ r.current_frame_user_data = t.int();
+ break;
+ }
+ case 11: {
+ let e = t.type(),
+ r = this._pipeline_state_by_instance.get(e);
+ if (!r) return;
+ r.camera_frame_camera_attitude = t.matrix4x4();
+ break;
+ }
+ case 12: {
+ let e = t.type(),
+ r = this._pipeline_state_by_instance.get(e);
+ if (!r) return;
+ r.camera_frame_device_attitude = t.matrix4x4();
+ break;
+ }
+ case 19: {
+ let e = t.type(),
+ r = this._image_tracker_state_by_instance.get(e);
+ if (!r) return;
+ r.target_loaded_version = t.int();
+ break;
+ }
+ case 1: {
+ let e = t.type(),
+ r = this._image_tracker_state_by_instance.get(e);
+ if (!r) return;
+ r.anchor_count = t.int();
+ break;
+ }
+ case 2: {
+ let e = t.type(),
+ r = this._image_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_id[i] = t.string();
+ break;
+ }
+ case 3: {
+ let e = t.type(),
+ r = this._image_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_pose[i] = t.matrix4x4();
+ break;
+ }
+ case 18: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ r.model_loaded = t.int();
+ break;
+ }
+ case 13: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ r.anchor_count = t.int();
+ break;
+ }
+ case 14: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_id[i] = t.string();
+ break;
+ }
+ case 15: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_pose[i] = t.matrix4x4();
+ break;
+ }
+ case 16: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_identity_coefficients[i] =
+ t.identityCoefficients();
+ break;
+ }
+ case 17: {
+ let e = t.type(),
+ r = this._face_tracker_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.anchor_expression_coefficients[i] =
+ t.expressionCoefficients();
+ break;
+ }
+ case 8: {
+ let e = t.type(),
+ r = this._barcode_finder_state_by_instance.get(e);
+ if (!r) return;
+ r.number_found = t.int();
+ break;
+ }
+ case 9: {
+ let e = t.type(),
+ r = this._barcode_finder_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.found_text[i] = t.string();
+ break;
+ }
+ case 10: {
+ let e = t.type(),
+ r = this._barcode_finder_state_by_instance.get(e);
+ if (!r) return;
+ let i = t.int();
+ r.found_format[i] = t.barcodeFormat();
+ break;
+ }
+ case 4: {
+ let e = t.type(),
+ r = this._instant_world_tracker_state_by_instance.get(e);
+ if (!r) return;
+ r.pose = t.matrix4x4();
+ break;
+ }
+ }
+ });
+ }
+ }
+ function u(e, t, r) {
+ let i = e.createShader(t);
+ if (!i) throw new Error("Unable to create shader");
+ e.shaderSource(i, r), e.compileShader(i);
+ let a = e.getShaderInfoLog(i);
+ if (a && a.trim().length > 0)
+ throw new Error("Shader compile error: " + a);
+ return i;
+ }
+ function d(e, t) {
+ e.linkProgram(t);
+ let r = e.getProgramInfoLog(t);
+ if (r && r.trim().length > 0) throw new Error("Unable to link: " + r);
+ }
+ let f,
+ h,
+ p,
+ m = {};
+ function g(e) {
+ if (p) return p;
+ if (((p = e.createBuffer()), !p))
+ throw new Error("Unable to create buffer object");
+ return (
+ e.bindBuffer(e.ARRAY_BUFFER, p),
+ e.bufferData(
+ e.ARRAY_BUFFER,
+ new Float32Array([0, 1, 0, 0, 1, 1, 1, 0]),
+ e.STATIC_DRAW
+ ),
+ e.bindBuffer(e.ARRAY_BUFFER, null),
+ p
+ );
+ }
+ let b =
+ "\n#ifndef GL_ES\n#define highp\n#define mediump\n#define lowp\n#endif\n\nuniform mat4 projMatrix;\nuniform mat4 cameraMatrix;\nuniform mat4 modelViewMatrix;\nattribute vec4 position;\nattribute vec2 textureCoord;\n\nvarying highp vec2 vTextureCoord;\n\nvoid main()\n{\n gl_Position = projMatrix * cameraMatrix * modelViewMatrix * position;\n vTextureCoord = textureCoord;\n}",
+ w =
+ "\n#define highp mediump\n#ifdef GL_ES\n // define default precision for float, vec, mat.\n precision highp float;\n#else\n#define highp\n#define mediump\n#define lowp\n#endif\n\nvarying highp vec2 vTextureCoord;\nuniform sampler2D skinSampler;\n\nvoid main()\n{\n gl_FragColor = texture2D(skinSampler, vTextureCoord);\n}";
+ function v(e) {
+ if (f) return f;
+ let t = e.createProgram();
+ if (!t) throw new Error("Unable to create program");
+ let r = u(e, e.VERTEX_SHADER, b),
+ i = u(e, e.FRAGMENT_SHADER, w);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "projMatrix");
+ if (!a) throw new Error("Unable to get uniform location projMatrix");
+ let n = e.getUniformLocation(t, "modelViewMatrix");
+ if (!n)
+ throw new Error("Unable to get uniform location modelViewMatrix");
+ let s = e.getUniformLocation(t, "cameraMatrix");
+ if (!s)
+ throw new Error("Unable to get uniform location cameraMatrix");
+ let o = e.getUniformLocation(t, "skinSampler");
+ if (!o) throw new Error("Unable to get uniform location skinSampler");
+ return (
+ (f = {
+ prog: t,
+ unif_matrix: n,
+ unif_proj: a,
+ unif_camera: s,
+ unif_skinSampler: o,
+ attr_position: e.getAttribLocation(t, "position"),
+ attr_textureCoord: e.getAttribLocation(t, "textureCoord"),
+ }),
+ f
+ );
+ }
+ var y = 1e-6,
+ E = "undefined" != typeof Float32Array ? Float32Array : Array;
+ function A() {
+ var e = new E(16);
+ return (
+ E != Float32Array &&
+ ((e[1] = 0),
+ (e[2] = 0),
+ (e[3] = 0),
+ (e[4] = 0),
+ (e[6] = 0),
+ (e[7] = 0),
+ (e[8] = 0),
+ (e[9] = 0),
+ (e[11] = 0),
+ (e[12] = 0),
+ (e[13] = 0),
+ (e[14] = 0)),
+ (e[0] = 1),
+ (e[5] = 1),
+ (e[10] = 1),
+ (e[15] = 1),
+ e
+ );
+ }
+ function T(e, t) {
+ var r = t[0],
+ i = t[1],
+ a = t[2],
+ n = t[3],
+ s = t[4],
+ o = t[5],
+ _ = t[6],
+ c = t[7],
+ l = t[8],
+ u = t[9],
+ d = t[10],
+ f = t[11],
+ h = t[12],
+ p = t[13],
+ m = t[14],
+ g = t[15],
+ b = r * o - i * s,
+ w = r * _ - a * s,
+ v = r * c - n * s,
+ y = i * _ - a * o,
+ E = i * c - n * o,
+ A = a * c - n * _,
+ T = l * p - u * h,
+ x = l * m - d * h,
+ R = l * g - f * h,
+ k = u * m - d * p,
+ F = u * g - f * p,
+ L = d * g - f * m,
+ M = b * L - w * F + v * k + y * R - E * x + A * T;
+ return M
+ ? ((M = 1 / M),
+ (e[0] = (o * L - _ * F + c * k) * M),
+ (e[1] = (a * F - i * L - n * k) * M),
+ (e[2] = (p * A - m * E + g * y) * M),
+ (e[3] = (d * E - u * A - f * y) * M),
+ (e[4] = (_ * R - s * L - c * x) * M),
+ (e[5] = (r * L - a * R + n * x) * M),
+ (e[6] = (m * v - h * A - g * w) * M),
+ (e[7] = (l * A - d * v + f * w) * M),
+ (e[8] = (s * F - o * R + c * T) * M),
+ (e[9] = (i * R - r * F - n * T) * M),
+ (e[10] = (h * E - p * v + g * b) * M),
+ (e[11] = (u * v - l * E - f * b) * M),
+ (e[12] = (o * x - s * k - _ * T) * M),
+ (e[13] = (r * k - i * x + a * T) * M),
+ (e[14] = (p * w - h * y - m * b) * M),
+ (e[15] = (l * y - u * w + d * b) * M),
+ e)
+ : null;
+ }
+ function x(e, t, r) {
+ var i = t[0],
+ a = t[1],
+ n = t[2],
+ s = t[3],
+ o = t[4],
+ _ = t[5],
+ c = t[6],
+ l = t[7],
+ u = t[8],
+ d = t[9],
+ f = t[10],
+ h = t[11],
+ p = t[12],
+ m = t[13],
+ g = t[14],
+ b = t[15],
+ w = r[0],
+ v = r[1],
+ y = r[2],
+ E = r[3];
+ return (
+ (e[0] = w * i + v * o + y * u + E * p),
+ (e[1] = w * a + v * _ + y * d + E * m),
+ (e[2] = w * n + v * c + y * f + E * g),
+ (e[3] = w * s + v * l + y * h + E * b),
+ (w = r[4]),
+ (v = r[5]),
+ (y = r[6]),
+ (E = r[7]),
+ (e[4] = w * i + v * o + y * u + E * p),
+ (e[5] = w * a + v * _ + y * d + E * m),
+ (e[6] = w * n + v * c + y * f + E * g),
+ (e[7] = w * s + v * l + y * h + E * b),
+ (w = r[8]),
+ (v = r[9]),
+ (y = r[10]),
+ (E = r[11]),
+ (e[8] = w * i + v * o + y * u + E * p),
+ (e[9] = w * a + v * _ + y * d + E * m),
+ (e[10] = w * n + v * c + y * f + E * g),
+ (e[11] = w * s + v * l + y * h + E * b),
+ (w = r[12]),
+ (v = r[13]),
+ (y = r[14]),
+ (E = r[15]),
+ (e[12] = w * i + v * o + y * u + E * p),
+ (e[13] = w * a + v * _ + y * d + E * m),
+ (e[14] = w * n + v * c + y * f + E * g),
+ (e[15] = w * s + v * l + y * h + E * b),
+ e
+ );
+ }
+ function R(e, t) {
+ return (
+ (e[0] = 1),
+ (e[1] = 0),
+ (e[2] = 0),
+ (e[3] = 0),
+ (e[4] = 0),
+ (e[5] = 1),
+ (e[6] = 0),
+ (e[7] = 0),
+ (e[8] = 0),
+ (e[9] = 0),
+ (e[10] = 1),
+ (e[11] = 0),
+ (e[12] = t[0]),
+ (e[13] = t[1]),
+ (e[14] = t[2]),
+ (e[15] = 1),
+ e
+ );
+ }
+ function k(e, t) {
+ return (
+ (e[0] = t[0]),
+ (e[1] = 0),
+ (e[2] = 0),
+ (e[3] = 0),
+ (e[4] = 0),
+ (e[5] = t[1]),
+ (e[6] = 0),
+ (e[7] = 0),
+ (e[8] = 0),
+ (e[9] = 0),
+ (e[10] = t[2]),
+ (e[11] = 0),
+ (e[12] = 0),
+ (e[13] = 0),
+ (e[14] = 0),
+ (e[15] = 1),
+ e
+ );
+ }
+ function F(e, t, r) {
+ var i,
+ a,
+ n,
+ s = r[0],
+ o = r[1],
+ _ = r[2],
+ c = Math.hypot(s, o, _);
+ return c < y
+ ? null
+ : ((s *= c = 1 / c),
+ (o *= c),
+ (_ *= c),
+ (i = Math.sin(t)),
+ (n = 1 - (a = Math.cos(t))),
+ (e[0] = s * s * n + a),
+ (e[1] = o * s * n + _ * i),
+ (e[2] = _ * s * n - o * i),
+ (e[3] = 0),
+ (e[4] = s * o * n - _ * i),
+ (e[5] = o * o * n + a),
+ (e[6] = _ * o * n + s * i),
+ (e[7] = 0),
+ (e[8] = s * _ * n + o * i),
+ (e[9] = o * _ * n - s * i),
+ (e[10] = _ * _ * n + a),
+ (e[11] = 0),
+ (e[12] = 0),
+ (e[13] = 0),
+ (e[14] = 0),
+ (e[15] = 1),
+ e);
+ }
+ function L() {
+ var e = new E(3);
+ return E != Float32Array && ((e[0] = 0), (e[1] = 0), (e[2] = 0)), e;
+ }
+ function M(e, t) {
+ var r = t[0],
+ i = t[1],
+ a = t[2],
+ n = r * r + i * i + a * a;
+ return (
+ n > 0 && (n = 1 / Math.sqrt(n)),
+ (e[0] = t[0] * n),
+ (e[1] = t[1] * n),
+ (e[2] = t[2] * n),
+ e
+ );
+ }
+ function I(e, t, r) {
+ var i = t[0],
+ a = t[1],
+ n = t[2],
+ s = r[0],
+ o = r[1],
+ _ = r[2];
+ return (
+ (e[0] = a * _ - n * o),
+ (e[1] = n * s - i * _),
+ (e[2] = i * o - a * s),
+ e
+ );
+ }
+ function S(e, t, r) {
+ var i = t[0],
+ a = t[1],
+ n = t[2],
+ s = r[3] * i + r[7] * a + r[11] * n + r[15];
+ return (
+ (s = s || 1),
+ (e[0] = (r[0] * i + r[4] * a + r[8] * n + r[12]) / s),
+ (e[1] = (r[1] * i + r[5] * a + r[9] * n + r[13]) / s),
+ (e[2] = (r[2] * i + r[6] * a + r[10] * n + r[14]) / s),
+ e
+ );
+ }
+ Math.random,
+ Math.PI,
+ Math.hypot ||
+ (Math.hypot = function () {
+ for (var e = 0, t = arguments.length; t--; )
+ e += arguments[t] * arguments[t];
+ return Math.sqrt(e);
+ }),
+ L();
+ var C,
+ U = r(238);
+ !(function (e) {
+ (e[(e.OBJECT_URL = 0)] = "OBJECT_URL"),
+ (e[(e.SRC_OBJECT = 1)] = "SRC_OBJECT");
+ })(C || (C = {}));
+ let D = {
+ deviceMotionMutliplier: -1,
+ blacklisted: !1,
+ showGyroPermissionsWarningIfNecessary: !1,
+ showSafariPermissionsResetIfNecessary: !1,
+ requestHighFrameRate: !1,
+ videoWidth: 640,
+ videoHeight: 480,
+ dataWidth: 320,
+ dataHeight: 240,
+ videoElementInDOM: !1,
+ preferMediaStreamTrackProcessorCamera: !1,
+ preferImageBitmapCamera: !1,
+ ios164CameraSelection: !1,
+ relyOnConstraintsForCameraSelection: !1,
+ forceWindowOrientation: !1,
+ };
+ "undefined" != typeof window &&
+ ((window.zeeProfile = D),
+ window.location.href.indexOf("_mstppipeline") >= 0 &&
+ (console.log("Configuring for MSTP camera pipeline (if supported)"),
+ (D.preferMediaStreamTrackProcessorCamera = !0)),
+ window.location.href.indexOf("_imagebitmappipeline") >= 0 &&
+ (console.log(
+ "Configuring for ImageBitmap camera pipeline (if supported)"
+ ),
+ (D.preferImageBitmapCamera = !0)));
+ let P = new U.UAParser(),
+ B = (P.getOS().name || "unknown").toLowerCase(),
+ O = (P.getEngine().name || "unknown").toLowerCase();
+ function z(e) {
+ D.forceWindowOrientation = !0;
+ let t = e.split(".");
+ if (t.length >= 2) {
+ const e = parseInt(t[0]),
+ r = parseInt(t[1]);
+ (e < 11 || (11 === e && r < 3)) && (D.blacklisted = !0),
+ (e < 12 || (12 === e && r < 2)) && (D.videoElementInDOM = !0),
+ ((12 === e && r >= 2) || e >= 13) &&
+ (D.showGyroPermissionsWarningIfNecessary = !0),
+ e >= 13 && (D.showSafariPermissionsResetIfNecessary = !0),
+ ((e >= 12 && r > 1) || e >= 13) &&
+ navigator.mediaDevices &&
+ navigator.mediaDevices.getSupportedConstraints &&
+ navigator.mediaDevices.getSupportedConstraints().frameRate &&
+ ((D.requestHighFrameRate = !0),
+ e < 14 && ((D.videoHeight = 360), (D.dataHeight = 180))),
+ 16 === e && r >= 4 && (D.ios164CameraSelection = !0),
+ e >= 17 && (D.relyOnConstraintsForCameraSelection = !0);
+ }
+ }
+ function V(e, t, r, i = 0.01, a = 100) {
+ let n = 2 * e[2],
+ s = 2 * e[3],
+ o = A();
+ !(function (e, t, r, i, a, n, s) {
+ var o = 1 / (r - t),
+ _ = 1 / (a - i),
+ c = 1 / (n - s);
+ (e[0] = 2 * n * o),
+ (e[1] = 0),
+ (e[2] = 0),
+ (e[3] = 0),
+ (e[4] = 0),
+ (e[5] = 2 * n * _),
+ (e[6] = 0),
+ (e[7] = 0),
+ (e[8] = (r + t) * o),
+ (e[9] = (a + i) * _),
+ (e[10] = (s + n) * c),
+ (e[11] = -1),
+ (e[12] = 0),
+ (e[13] = 0),
+ (e[14] = s * n * 2 * c),
+ (e[15] = 0);
+ })(
+ o,
+ (i * (-0.5 - e[2])) / e[0],
+ (i * (n - 0.5 - e[2])) / e[0],
+ (i * (s - 0.5 - e[3])) / e[1],
+ (i * (-0.5 - e[3])) / e[1],
+ i,
+ a
+ ),
+ (o[4] *= -1),
+ (o[5] *= -1),
+ (o[6] *= -1),
+ (o[7] *= -1);
+ let _ = A();
+ k(_, [0.5 * n, 0.5 * s, 1]),
+ x(o, _, o),
+ F(_, (N(!1) * Math.PI) / 180, [0, 0, 1]),
+ x(o, _, o);
+ let c = L();
+ (c[0] = n), (c[1] = s), (c[2] = 0), S(c, c, _);
+ let l = Math.abs(c[0]),
+ u = Math.abs(c[1]),
+ d = 1;
+ return (
+ (d = l / t > u / r ? r / u : t / l),
+ k(_, [d, d, 1]),
+ x(o, _, o),
+ k(_, [2 / t, 2 / r, 1]),
+ x(o, _, o),
+ F(_, (N(!1) * Math.PI) / -180, [0, 0, 1]),
+ x(o, o, _),
+ o
+ );
+ }
+ function N(e) {
+ if (window.screen.orientation && !D.forceWindowOrientation)
+ switch (window.screen.orientation.type) {
+ case "portrait-primary":
+ return e ? 90 : 270;
+ case "landscape-secondary":
+ return 180;
+ case "portrait-secondary":
+ return e ? 270 : 90;
+ default:
+ return 0;
+ }
+ else if (void 0 !== window.orientation)
+ switch (window.orientation) {
+ case 0:
+ return e ? 90 : 270;
+ case 90:
+ return 0;
+ case 180:
+ return e ? 270 : 90;
+ case -90:
+ return 180;
+ }
+ return 0;
+ }
+ "webkit" === O &&
+ "ios" !== B &&
+ ((D.deviceMotionMutliplier = 1),
+ "undefined" != typeof window &&
+ void 0 !== window.orientation &&
+ z("15.0")),
+ "webkit" === O &&
+ "ios" === B &&
+ ((D.deviceMotionMutliplier = 1), z(P.getOS().version || "15.0"));
+ class G {
+ 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 W {
+ 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 H = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ let q = new (class {
+ constructor() {
+ (this.onOutgoingMessage = new G()),
+ (this.onIncomingMessage = new W()),
+ (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;
+ }
+ })();
+ var Y;
+ !(function (e) {
+ (e[(e.PermissionTitle = 0)] = "PermissionTitle"),
+ (e[(e.PermissionDescription = 1)] = "PermissionDescription"),
+ (e[(e.PermissionButton = 2)] = "PermissionButton");
+ })(Y || (Y = {}));
+ const [X, j] = (function (e) {
+ const [t, r] = e.toLowerCase().split("-");
+ return [t, r || ""];
+ })(navigator.language);
+ function Z(e) {
+ switch (X) {
+ case "es":
+ switch (e) {
+ case Y.PermissionTitle:
+ return "Ya casi...";
+ case Y.PermissionDescription:
+ return "Para brindar esta experiencia de realidad aumentada, necesitamos acceso a la cámara y los sensores de movimiento de su dispositivo.";
+ case Y.PermissionButton:
+ return "Permitir acceso";
+ }
+ break;
+ case "de":
+ switch (e) {
+ case Y.PermissionTitle:
+ return "Fast am Ziel..";
+ case Y.PermissionDescription:
+ return "Um dir dieses Augmented Reality Erlebnis zu liefern, brauchen wir Zugriff auf die Kamera und Bewegungssensoren deines Gerätes.";
+ case Y.PermissionButton:
+ return "Gewähre Zugriff";
+ }
+ break;
+ case "pt":
+ switch (e) {
+ case Y.PermissionTitle:
+ return "Está quase!";
+ case Y.PermissionDescription:
+ return "Esta experiência de realidade aumentada precisa de acesso à câmera e aos sensores de movimento deste dispositivo.";
+ case Y.PermissionButton:
+ return "Permitir acesso";
+ }
+ }
+ switch (e) {
+ case Y.PermissionTitle:
+ return "Almost there...";
+ case Y.PermissionDescription:
+ return "In order to provide this augmented reality experience, we need access to your device's camera and motion sensors.";
+ case Y.PermissionButton:
+ return "Grant Access";
+ }
+ return "";
+ }
+ var K = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ let $ = new U.UAParser(),
+ Q = !1,
+ J = !1,
+ ee = !1,
+ te = !1;
+ function re() {
+ return K(this, void 0, void 0, function* () {
+ if (navigator.permissions && navigator.permissions.query)
+ try {
+ let e = yield navigator.permissions.query({ name: "camera" });
+ (ee = "denied" === e.state), (Q = "granted" === e.state);
+ } catch (e) {}
+ });
+ }
+ function ie() {
+ return Q;
+ }
+ function ae() {
+ return J;
+ }
+ function ne() {
+ return ee;
+ }
+ function se() {
+ return te;
+ }
+ function oe() {
+ return ee || te;
+ }
+ function _e() {
+ return Q && J;
+ }
+ function ce() {
+ return K(this, void 0, void 0, function* () {
+ yield ue(), yield le();
+ });
+ }
+ function le() {
+ return K(this, void 0, void 0, function* () {
+ try {
+ (yield navigator.mediaDevices.getUserMedia({ video: !0 }))
+ .getTracks()
+ .forEach((e) => e.stop()),
+ (Q = !0),
+ (ee = !1);
+ } catch (e) {
+ (Q = !1), (ee = !0);
+ }
+ });
+ }
+ function ue() {
+ return K(this, void 0, void 0, function* () {
+ if (
+ window.DeviceOrientationEvent &&
+ window.DeviceOrientationEvent.requestPermission &&
+ "granted" !==
+ (yield window.DeviceOrientationEvent.requestPermission())
+ )
+ return (J = !1), (te = !0), !1;
+ (J = !0), (te = !1);
+ });
+ }
+ function de() {
+ return K(this, void 0, void 0, function* () {
+ if ((yield re(), _e())) return !0;
+ let e = document.createElement("div");
+ e.classList.add("zappar-permission-request"),
+ (e.innerHTML = `\n \n \n
${Z(
+ Y.PermissionTitle
+ )}
\n
${Z(
+ Y.PermissionDescription
+ )}
\n
\n
\n`),
+ document.body.append(e);
+ let t = e.querySelector("#zappar-permission-request-button");
+ return yield new Promise((r) => {
+ null == t ||
+ t.addEventListener("click", () =>
+ K(this, void 0, void 0, function* () {
+ for (yield ce(), e.remove(); ; ) {
+ if (
+ (yield new Promise((e) =>
+ requestAnimationFrame(() => e())
+ ),
+ oe())
+ )
+ return void r(!1);
+ if (_e()) return void r(!0);
+ }
+ })
+ );
+ });
+ });
+ }
+ function fe() {
+ "Chrome" === $.getBrowser().name
+ ? (function () {
+ let e = document.createElement("div");
+ e.classList.add("zappar-permission-request"),
+ (e.innerHTML =
+ '\n \n \n
Permission is Needed
\n
Permission to access your device\'s camera and motion sensors is necessary for this experience.
To grant access, please tap the ! button in the address bar of your browser, then "Site settings", and finally "Clear and reset". You can then reload the page to try again.
\n
\n
\n'),
+ document.body.append(e);
+ let t = e.querySelector("#zappar-permission-reload-button");
+ null == t ||
+ t.addEventListener("click", () => window.location.reload());
+ })()
+ : (function () {
+ let e = document.createElement("div");
+ e.classList.add("zappar-permission-request"),
+ (e.innerHTML =
+ '\n \n \n
Permission is Needed
\n
Permission to access your device\'s camera and motion sensors is necessary for this experience. Please reload the page to try again.
\n
\n
\n'),
+ document.body.append(e);
+ let t = e.querySelector("#zappar-permission-reload-button");
+ null == t ||
+ t.addEventListener("click", () => window.location.reload());
+ })();
+ }
+ (window.DeviceOrientationEvent &&
+ window.DeviceOrientationEvent.requestPermission) ||
+ (J = !0),
+ re();
+ let he = n.LOG_LEVEL_ERROR;
+ function pe(...e) {
+ he >= n.LOG_LEVEL_VERBOSE && console.log("[Zappar] INFO", ...e);
+ }
+ function me(...e) {
+ he >= n.LOG_LEVEL_ERROR && console.error("[Zappar] ERROR", ...e);
+ }
+ function ge(...e) {
+ he >= n.LOG_LEVEL_VERBOSE && console.log("[Zappar] WARN", ...e);
+ }
+ let be = 1,
+ we = new Map();
+ function ve(e) {
+ return we.get(e);
+ }
+ class ye {
+ constructor() {
+ (this.render_mean_ = new Float32Array()),
+ (this.render_identity_ = new Float32Array(50)),
+ (this.render_expression_ = new Float32Array(29)),
+ (this.render_uvs_ = new Float32Array()),
+ (this.render_indices_ = new Uint16Array()),
+ (this.vertices_ = new Float32Array()),
+ (this.normals_ = new Float32Array()),
+ (this.normalsCalculated_ = !1),
+ (this.modelVersion_ = -1),
+ (this.mirrored_ = !1);
+ }
+ loadFromMemory(e, t, r, i, a) {
+ let n = 0,
+ s = new Uint16Array(e),
+ o = new Int32Array(e),
+ _ = new Float32Array(e),
+ c = () => {
+ let e = o[n++] * o[n++],
+ t = _.subarray(n, n + e);
+ return (n += e), t;
+ },
+ l = () => {
+ let e = o[n++],
+ t = s.subarray(2 * n, 2 * n + e);
+ return (n += e / 2), t;
+ };
+ (this.render_mean_ = c()),
+ (this.render_identity_ = c()),
+ (this.render_expression_ = c()),
+ (this.render_uvs_ = c());
+ let u = l(),
+ d = n < o.length ? l() : new Uint16Array(),
+ f = n < o.length ? l() : new Uint16Array(),
+ h = n < o.length ? l() : new Uint16Array(),
+ p = n < o.length ? l() : new Uint16Array();
+ if (t || r || i || a) {
+ let e = u.length;
+ t && (e += d.length),
+ r && (e += f.length),
+ i && (e += h.length),
+ a && (e += p.length),
+ (this.render_indices_ = new Uint16Array(e)),
+ this.render_indices_.set(u, 0);
+ let n = u.length;
+ t && (this.render_indices_.set(d, n), (n += d.length)),
+ r && (this.render_indices_.set(f, n), (n += f.length)),
+ i && (this.render_indices_.set(h, n), (n += h.length)),
+ a && (this.render_indices_.set(p, n), (n += p.length));
+ } else this.render_indices_ = u;
+ (this.vertices_ = new Float32Array(this.render_mean_)),
+ (this.normals_ = new Float32Array(this.vertices_.length)),
+ this.modelVersion_++;
+ }
+ getVertices() {
+ return this.vertices_;
+ }
+ getUVs() {
+ return this.render_uvs_;
+ }
+ getIndices() {
+ if (this.mirrored_) {
+ if (!this.render_indices_reversed) {
+ this.render_indices_reversed = new Uint16Array(
+ this.render_indices_.length
+ );
+ for (let e = 0; e < this.render_indices_.length; e += 3)
+ (this.render_indices_reversed[e] =
+ this.render_indices_[e + 2]),
+ (this.render_indices_reversed[e + 1] =
+ this.render_indices_[e + 1]),
+ (this.render_indices_reversed[e + 2] =
+ this.render_indices_[e]);
+ }
+ return this.render_indices_reversed;
+ }
+ return this.render_indices_;
+ }
+ getNormals() {
+ return (
+ this.normalsCalculated_ || this.calculateNormals(), this.normals_
+ );
+ }
+ getModelVersion() {
+ return this.modelVersion_;
+ }
+ getLandmarkDataForVertex(e) {
+ let t = [
+ this.render_mean_[3 * e],
+ this.render_mean_[3 * e + 1],
+ this.render_mean_[3 * e + 2],
+ ],
+ r = [];
+ for (let t = 0; t < 50; t++)
+ r.push(this.render_identity_[3 * e * 50 + t]),
+ r.push(this.render_identity_[50 * (3 * e + 1) + t]),
+ r.push(this.render_identity_[50 * (3 * e + 2) + t]);
+ let i = [];
+ for (let t = 0; t < 29; t++)
+ i.push(this.render_expression_[3 * e * 29 + t]),
+ i.push(this.render_expression_[29 * (3 * e + 1) + t]),
+ i.push(this.render_expression_[29 * (3 * e + 2) + t]);
+ return { mean: t, identity: r, expression: i };
+ }
+ update(e, t, r) {
+ if (
+ 0 !== this.render_mean_.length &&
+ 0 !== this.render_identity_.length &&
+ 0 !== this.render_expression_.length
+ ) {
+ (this.mirrored_ = r), this.vertices_.set(this.render_mean_);
+ for (let t = 0; t < e.length; t++)
+ for (let r = 0; r < this.vertices_.length; r++)
+ this.vertices_[r] +=
+ e[t] * this.render_identity_[r * e.length + t];
+ for (let e = 0; e < t.length; e++)
+ for (let r = 0; r < this.vertices_.length; r++)
+ this.vertices_[r] +=
+ t[e] * this.render_expression_[r * t.length + e];
+ if (r)
+ for (let e = 0; e < this.vertices_.length; e += 3)
+ this.vertices_[e] *= -1;
+ this.normalsCalculated_ = !1;
+ }
+ }
+ calculateNormals() {
+ let e = this.getIndices(),
+ t = this.vertices_,
+ r = new Float32Array(e.length);
+ if (!t) return;
+ let i = e.length,
+ a = this.normals_,
+ n = new Float32Array([0, 0, 0]),
+ s = new Float32Array([0, 0, 0]),
+ o = new Float32Array([0, 0, 0]);
+ for (let a = 0; a < i; a += 3) {
+ let i = 3 * e[a],
+ d = 3 * e[a + 1],
+ f = 3 * e[a + 2];
+ (n[0] = t[d] - t[i]),
+ (n[1] = t[d + 1] - t[i + 1]),
+ (n[2] = t[d + 2] - t[i + 2]),
+ (s[0] = t[f] - t[i]),
+ (s[1] = t[f + 1] - t[i + 1]),
+ (s[2] = t[f + 2] - t[i + 2]),
+ I(o, n, s);
+ let h =
+ ((c = void 0),
+ (l = void 0),
+ (u = void 0),
+ (c = (_ = o)[0]),
+ (l = _[1]),
+ (u = _[2]),
+ Math.hypot(c, l, u));
+ (r[a] = o[0] / h), (r[a + 1] = o[1] / h), (r[a + 2] = o[2] / h);
+ }
+ var _, c, l, u;
+ a.fill(0);
+ for (let t = 0; t < i; t += 3) {
+ let i = 3 * e[t],
+ n = 3 * e[t + 1],
+ s = 3 * e[t + 2];
+ (a[i] += r[t]),
+ (a[i + 1] += r[t + 1]),
+ (a[i + 2] += r[t + 2]),
+ (a[n] += r[t]),
+ (a[n + 1] += r[t + 1]),
+ (a[n + 2] += r[t + 2]),
+ (a[s] += r[t]),
+ (a[s + 1] += r[t + 1]),
+ (a[s + 2] += r[t + 2]);
+ }
+ let d = a.length / 3;
+ for (let e = 0; e < d; e++) {
+ let t = 3 * e;
+ (n[0] = a[t]),
+ (n[1] = a[t + 1]),
+ (n[2] = a[t + 2]),
+ M(s, n),
+ (a[t] = s[0]),
+ (a[t + 1] = s[1]),
+ (a[t + 2] = s[2]);
+ }
+ this.normalsCalculated_ = !0;
+ }
+ }
+ let Ee = A();
+ class Ae {
+ constructor(e) {
+ this._gl = e;
+ }
+ dispose() {
+ this._vbo && this._gl.deleteBuffer(this._vbo),
+ (this._vbo = void 0),
+ this._shader && this._gl.deleteProgram(this._shader.prog),
+ (this._shader = void 0);
+ }
+ _generate(e, t) {
+ if (this._vbo) return this._vbo;
+ if ((this._vbo || (this._vbo = e.createBuffer()), !this._vbo))
+ throw new Error("Unable to create buffer object");
+ let r = new Float32Array([
+ -1, -1, 0, 0, 0, -1, 1, 0, 0, 1, 1, -1, 0, 1, 0, 1, -1, 0, 1, 0,
+ -1, 1, 0, 0, 1, 1, 1, 0, 1, 1,
+ ]);
+ return (
+ e.bindBuffer(e.ARRAY_BUFFER, this._vbo),
+ e.bufferData(e.ARRAY_BUFFER, new Float32Array(r), e.STATIC_DRAW),
+ e.bindBuffer(e.ARRAY_BUFFER, null),
+ this._vbo
+ );
+ }
+ drawCameraFrame(e, t, r, i) {
+ if (!r.texture) return;
+ let a = this._gl;
+ a.disable(a.DEPTH_TEST),
+ a.disable(a.SCISSOR_TEST),
+ a.disable(a.CULL_FACE),
+ a.disable(a.BLEND);
+ let n = this._getCameraShader(a),
+ s = this._generate(a, r);
+ a.activeTexture(a.TEXTURE0),
+ a.useProgram(n.prog),
+ a.uniformMatrix4fv(
+ n.unif_skinTexTransform,
+ !1,
+ Re(r.dataWidth, r.dataHeight, e, t, r.uvTransform || Ee, i)
+ ),
+ a.uniform1i(n.unif_skinSampler, 0),
+ a.bindTexture(a.TEXTURE_2D, r.texture),
+ a.bindBuffer(a.ARRAY_BUFFER, s),
+ a.vertexAttribPointer(n.attr_position, 3, a.FLOAT, !1, 20, 0),
+ a.enableVertexAttribArray(n.attr_position),
+ a.vertexAttribPointer(n.attr_texCoord, 2, a.FLOAT, !1, 20, 12),
+ a.enableVertexAttribArray(n.attr_texCoord),
+ a.drawArrays(a.TRIANGLES, 0, 6),
+ a.disableVertexAttribArray(n.attr_position),
+ a.disableVertexAttribArray(n.attr_texCoord),
+ a.bindTexture(a.TEXTURE_2D, null),
+ a.bindBuffer(a.ARRAY_BUFFER, null),
+ a.useProgram(null);
+ }
+ _getCameraShader(e) {
+ if (this._shader) return this._shader;
+ let t = e.createProgram();
+ if (!t) throw new Error("Unable to create program");
+ let r = u(e, e.VERTEX_SHADER, Te),
+ i = u(e, e.FRAGMENT_SHADER, xe);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "skinTexTransform");
+ if (!a)
+ throw new Error(
+ "Unable to get uniform location skinTexTransform"
+ );
+ let n = e.getUniformLocation(t, "skinSampler");
+ if (!n)
+ throw new Error("Unable to get uniform location skinSampler");
+ return (
+ (this._shader = {
+ prog: t,
+ unif_skinTexTransform: a,
+ unif_skinSampler: n,
+ attr_position: e.getAttribLocation(t, "position"),
+ attr_texCoord: e.getAttribLocation(t, "texCoord"),
+ }),
+ this._shader
+ );
+ }
+ }
+ let Te =
+ "\n#ifndef GL_ES\n#define highp\n#define mediump\n#define lowp\n#endif\n\nattribute vec4 position;\nattribute vec4 texCoord;\nvarying vec4 skinTexVarying;\nuniform mat4 skinTexTransform;\n\nvoid main()\n{\n gl_Position = position;\n skinTexVarying = skinTexTransform * texCoord;\n}",
+ xe =
+ "\n#define highp mediump\n#ifdef GL_ES\n // define default precision for float, vec, mat.\n precision highp float;\n#else\n#define highp\n#define mediump\n#define lowp\n#endif\n\nvarying vec4 skinTexVarying;\nuniform lowp sampler2D skinSampler;\n\nvoid main()\n{\n gl_FragColor = texture2DProj(skinSampler, skinTexVarying);\n}";
+ function Re(e, t, r, i, a, n) {
+ let s = A(),
+ o = A();
+ R(o, [-0.5, -0.5, 0]),
+ x(s, o, s),
+ n && (k(o, [-1, 1, 1]), x(s, o, s)),
+ F(
+ o,
+ (-1 *
+ (function () {
+ if (window.screen.orientation && !D.forceWindowOrientation)
+ switch (window.screen.orientation.type) {
+ case "portrait-primary":
+ return 270;
+ case "landscape-secondary":
+ return 180;
+ case "portrait-secondary":
+ return 90;
+ default:
+ return 0;
+ }
+ else if (void 0 !== window.orientation)
+ switch (window.orientation) {
+ case 0:
+ return 270;
+ case 90:
+ return 0;
+ case 180:
+ return 90;
+ case -90:
+ return 180;
+ }
+ return 0;
+ })() *
+ Math.PI) /
+ 180,
+ [0, 0, 1]
+ ),
+ x(s, o, s);
+ let _ = L();
+ (_[0] = r), (_[1] = i), (_[2] = 0), S(_, _, o);
+ let c = Math.abs(_[0]),
+ l = Math.abs(_[1]);
+ k(o, [1, -1, 1]), x(s, o, s);
+ let u = c / l,
+ d = e / t;
+ return (
+ k(o, u > d ? [1, d / u, 1] : [u / d, 1, 1]),
+ x(s, o, s),
+ R(o, [0.5, 0.5, 0]),
+ x(s, o, s),
+ x(s, a, s),
+ s
+ );
+ }
+ class ke {
+ constructor(e) {
+ this._gl = e;
+ }
+ dispose() {
+ this._vbo && this._gl.deleteBuffer(this._vbo),
+ this._normalbo && this._gl.deleteBuffer(this._normalbo),
+ this._ibo && this._gl.deleteBuffer(this._ibo),
+ this._shader && this._gl.deleteProgram(this._shader.prog),
+ (this._vbo = void 0),
+ (this._normalbo = void 0),
+ (this._ibo = void 0),
+ (this._shader = void 0);
+ }
+ _generateIBO(e, t) {
+ if (this._ibo && this._lastIndices === e) return this._ibo;
+ if (
+ ((this._lastIndices = e),
+ this._ibo || (this._ibo = t.createBuffer()),
+ !this._ibo)
+ )
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this._ibo),
+ t.bufferData(t.ELEMENT_ARRAY_BUFFER, e, t.STATIC_DRAW),
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null),
+ this._ibo
+ );
+ }
+ _generateVBO(e, t) {
+ if ((this._vbo || (this._vbo = t.createBuffer()), !this._vbo))
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._vbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STREAM_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._vbo
+ );
+ }
+ _generateNormalBO(e, t) {
+ if (
+ (this._normalbo || (this._normalbo = t.createBuffer()),
+ !this._normalbo)
+ )
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._normalbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STREAM_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._normalbo
+ );
+ }
+ drawFace(e, t) {
+ let r = this._gl,
+ i = this._getShader(r),
+ a = this._generateVBO(t.getVertices(), r),
+ n = this._generateNormalBO(t.getNormals(), r),
+ s = this._generateIBO(t.getIndices(), r);
+ r.enable(r.DEPTH_TEST),
+ r.enable(r.CULL_FACE),
+ r.useProgram(i.prog),
+ r.uniformMatrix4fv(i.unif_matrix, !1, e),
+ r.bindBuffer(r.ARRAY_BUFFER, a),
+ r.vertexAttribPointer(i.attr_position, 3, r.FLOAT, !1, 12, 0),
+ r.enableVertexAttribArray(i.attr_position),
+ r.bindBuffer(r.ARRAY_BUFFER, n),
+ r.vertexAttribPointer(i.attr_normal, 3, r.FLOAT, !1, 12, 0),
+ r.enableVertexAttribArray(i.attr_normal),
+ r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, s),
+ r.drawElements(
+ r.TRIANGLES,
+ t.getIndices().length,
+ r.UNSIGNED_SHORT,
+ 0
+ ),
+ r.disableVertexAttribArray(i.attr_position),
+ r.disableVertexAttribArray(i.attr_normal),
+ r.bindBuffer(r.ARRAY_BUFFER, null),
+ r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, null);
+ }
+ _getShader(e) {
+ if (this._shader) return this._shader;
+ let t = e.createProgram();
+ if (!t) throw new Error("Unable to create program");
+ let r = u(e, e.VERTEX_SHADER, Fe),
+ i = u(e, e.FRAGMENT_SHADER, Le);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "matrix");
+ if (!a) throw new Error("Unable to get uniform location mattrix");
+ return (
+ (this._shader = {
+ prog: t,
+ unif_matrix: a,
+ attr_position: e.getAttribLocation(t, "position"),
+ attr_normal: e.getAttribLocation(t, "normal"),
+ }),
+ this._shader
+ );
+ }
+ }
+ let Fe =
+ "\n#ifndef GL_ES\n#define highp\n#define mediump\n#define lowp\n#endif\n\nuniform mat4 matrix;\nattribute vec4 position;\nattribute vec3 normal;\nvarying highp vec3 vnormal;\n\nvoid main()\n{\n gl_Position = matrix * position;\n vnormal = normal;\n}",
+ Le =
+ "\n#define highp mediump\n#ifdef GL_ES\n // define default precision for float, vec, mat.\n precision highp float;\n#else\n#define highp\n#define mediump\n#define lowp\n#endif\n\nvarying vec4 skinTexVarying;\nvarying highp vec3 vnormal;\nuniform lowp sampler2D skinSampler;\n\nvoid main()\n{\n vec3 normal2 = 0.5 * vnormal + 0.5;\n gl_FragColor = vec4(normal2.x , normal2.y, normal2.z, 1.0);\n}";
+ class Me {
+ constructor(e) {
+ this._gl = e;
+ }
+ dispose() {
+ this._vbo && this._gl.deleteBuffer(this._vbo),
+ this._uvbo && this._gl.deleteBuffer(this._uvbo),
+ this._ibo && this._gl.deleteBuffer(this._ibo),
+ this._shader && this._gl.deleteProgram(this._shader.prog),
+ (this._vbo = void 0),
+ (this._uvbo = void 0),
+ (this._ibo = void 0),
+ (this._shader = void 0);
+ }
+ _generateIBO(e, t) {
+ if (this._ibo && this._lastIndices === e) return this._ibo;
+ if (
+ ((this._lastIndices = e),
+ this._ibo || (this._ibo = t.createBuffer()),
+ !this._ibo)
+ )
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this._ibo),
+ t.bufferData(t.ELEMENT_ARRAY_BUFFER, e, t.STATIC_DRAW),
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null),
+ this._ibo
+ );
+ }
+ _generateVBO(e, t) {
+ if ((this._vbo || (this._vbo = t.createBuffer()), !this._vbo))
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._vbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STREAM_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._vbo
+ );
+ }
+ _generateUVBO(e, t) {
+ if ((this._uvbo || (this._uvbo = t.createBuffer()), !this._uvbo))
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._uvbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STREAM_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._uvbo
+ );
+ }
+ drawFace(e, t, r, i, a, n) {
+ let s = this._gl,
+ o = this._getShader(s),
+ _ = this._generateVBO(t, s),
+ c = this._generateUVBO(i, s),
+ l = this._generateIBO(a, s);
+ s.enable(s.DEPTH_TEST),
+ s.enable(s.CULL_FACE),
+ s.useProgram(o.prog),
+ s.uniformMatrix4fv(o.unif_matrix, !1, e),
+ s.uniformMatrix4fv(o.unif_uvmatrix, !1, r),
+ s.activeTexture(s.TEXTURE0),
+ s.bindTexture(s.TEXTURE_2D, n),
+ s.uniform1i(o.unif_sampler, 0),
+ s.bindBuffer(s.ARRAY_BUFFER, _),
+ s.vertexAttribPointer(o.attr_position, 3, s.FLOAT, !1, 12, 0),
+ s.enableVertexAttribArray(o.attr_position),
+ s.bindBuffer(s.ARRAY_BUFFER, c),
+ s.vertexAttribPointer(o.attr_uv, 3, s.FLOAT, !1, 12, 0),
+ s.enableVertexAttribArray(o.attr_uv),
+ s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, l),
+ s.drawElements(s.TRIANGLES, 6912, s.UNSIGNED_SHORT, 0),
+ s.disableVertexAttribArray(o.attr_position),
+ s.disableVertexAttribArray(o.attr_uv),
+ s.bindBuffer(s.ARRAY_BUFFER, null),
+ s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, null);
+ }
+ _getShader(e) {
+ if (this._shader) return this._shader;
+ let t = e.createProgram();
+ if (!t) throw new Error("Unable to create program");
+ let r = u(e, e.VERTEX_SHADER, Ie),
+ i = u(e, e.FRAGMENT_SHADER, Se);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "matrix");
+ if (!a) throw new Error("Unable to get uniform location matrix");
+ let n = e.getUniformLocation(t, "uvmatrix");
+ if (!n) throw new Error("Unable to get uniform location matrix");
+ let s = e.getUniformLocation(t, "uSampler");
+ if (!s) throw new Error("Unable to get uniform location sampler");
+ return (
+ (this._shader = {
+ prog: t,
+ unif_matrix: a,
+ unif_sampler: s,
+ unif_uvmatrix: n,
+ attr_position: e.getAttribLocation(t, "position"),
+ attr_uv: e.getAttribLocation(t, "uv"),
+ attr_texturecoord: e.getAttribLocation(t, "aTextureCoord"),
+ }),
+ this._shader
+ );
+ }
+ }
+ let Ie =
+ "\n#ifndef GL_ES\n#define highp\n#define mediump\n#define lowp\n#endif\n\nuniform mat4 matrix;\nuniform mat4 uvmatrix;\nattribute vec4 position;\nattribute vec3 normal;\nattribute vec3 uv;\n\n// varying highp vec3 vnormal;\n\nvarying highp vec2 vTextureCoord;\nvarying highp float vAlpha;\n\nvoid main()\n{\n gl_Position = matrix * position;\n vec4 ret = uvmatrix * vec4(uv.x, uv.y, uv.z, 1.0);\n ret.x /= ret.w * 2.0;\n ret.y /= ret.w * 2.0;\n ret.x += 0.5;\n ret.y += 0.0;\n vAlpha = 1.0;\n vTextureCoord = ret.xy;\n}",
+ Se =
+ "\n#define highp mediump\n#ifdef GL_ES\n // define default precision for float, vec, mat.\n precision highp float;\n#else\n#define highp\n#define mediump\n#define lowp\n#endif\n\nvarying highp vec2 vTextureCoord;\nvarying highp vec3 vnormal;\nvarying highp float vAlpha;\nuniform lowp sampler2D uSampler;\n\nvoid main()\n{\n // vec3 normal2 = 0.5 * vnormal + 0.5;\n vec4 p = texture2D(uSampler, vTextureCoord);\n p.a = vAlpha;\n gl_FragColor = p; // vec4(normal2.x , normal2.y, normal2.z, 1.0);\n}";
+ var Ce;
+ !(function (e) {
+ (e[(e.CAMERA_FRAME = 0)] = "CAMERA_FRAME"),
+ (e[(e.ACCELEROMETER = 1)] = "ACCELEROMETER"),
+ (e[(e.ROTATION_RATE = 2)] = "ROTATION_RATE"),
+ (e[(e.ATTITUDE = 3)] = "ATTITUDE"),
+ (e[(e.ATTITUDE_MATRIX = 4)] = "ATTITUDE_MATRIX");
+ })(Ce || (Ce = {}));
+ class Ue {
+ constructor(e) {
+ (this._insertionByte = 0),
+ (this._numberPackets = 0),
+ (this._started = !1),
+ (this._hasLoggedUnsuppored = !1),
+ (this._data = new ArrayBuffer(this._estimatedSize(e, 320, 240))),
+ (this._dataView = new DataView(this._data)),
+ (this._dataUint8 = new Uint8Array(this._data)),
+ (this._dataFloat32 = new Float32Array(this._data));
+ }
+ _estimatedSize(e, t, r) {
+ return (
+ Ue.headerSizeBytes +
+ (Ue.psbPacketType + Ue.cameraPacketSizeBytes + t * r) * e
+ );
+ }
+ start() {
+ (this._started = !0),
+ (this._insertionByte = 0),
+ (this._numberPackets = 0),
+ this._growArrayBuffer(Ue.headerSizeBytes);
+ let e = new TextEncoder().encode("UAR1");
+ this._dataUint8.set(e),
+ this._dataView.setUint32(4, 0, !0),
+ (this._insertionByte += 8);
+ }
+ stop() {
+ this._started = !1;
+ let e = this._data.slice(0, this._insertionByte);
+ (this._data = e),
+ (this._dataUint8 = new Uint8Array(this._data)),
+ (this._dataFloat32 = new Float32Array(this._data)),
+ (this._dataView = new DataView(this._data));
+ }
+ data() {
+ return this._dataUint8;
+ }
+ appendCameraFrame(e) {
+ if (!this._started) return;
+ if (!e.data) {
+ if (this._hasLoggedUnsuppored) return;
+ return (
+ (this._hasLoggedUnsuppored = !0),
+ void me("Unable to record frames from this camera source")
+ );
+ }
+ if (e.data.byteLength !== e.dataWidth * e.dataHeight)
+ return void me(
+ "Unable to record frame to sequence: greyscale array doesn't match dimensions"
+ );
+ let t =
+ Ue.psbPacketType +
+ Ue.cameraPacketSizeBytes +
+ e.dataWidth * e.dataHeight;
+ this._growArrayBuffer(t),
+ this._dataView.setUint32(
+ this._insertionByte,
+ Ce.CAMERA_FRAME,
+ !0
+ ),
+ (this._insertionByte += Ue.psbPacketType),
+ this._dataView.setUint32(this._insertionByte, e.dataWidth, !0),
+ (this._insertionByte += Ue.psbCameraFrameWidth),
+ this._dataView.setUint32(this._insertionByte, e.dataHeight, !0),
+ (this._insertionByte += Ue.psbCameraFrameHeight),
+ this._dataFloat32.set(e.cameraToDevice, this._insertionByte / 4),
+ (this._insertionByte += Ue.psbCameraToDeviceTransform),
+ this._dataFloat32.set(e.cameraModel, this._insertionByte / 4),
+ (this._insertionByte += Ue.psbCameraModel),
+ this._dataView.setUint32(
+ this._insertionByte,
+ e.userFacing ? 1 : 0,
+ !0
+ ),
+ (this._insertionByte += Ue.psbFlags),
+ this._dataUint8.set(new Uint8Array(e.data), this._insertionByte),
+ (this._insertionByte += e.data.byteLength),
+ this._numberPackets++,
+ this._dataView.setUint32(4, this._numberPackets, !0);
+ }
+ appendAccelerometer(e, t, r, i) {
+ this._appendTimestampedVec3(Ce.ACCELEROMETER, e, t, r, i);
+ }
+ appendRotationRate(e, t, r, i) {
+ this._appendTimestampedVec3(Ce.ROTATION_RATE, e, t, r, i);
+ }
+ appendAttitude(e, t, r, i) {
+ this._appendTimestampedVec3(Ce.ATTITUDE, e, t, r, i);
+ }
+ _appendTimestampedVec3(e, t, r, i, a) {
+ if (!this._started) return;
+ let n = Ue.psbPacketType + Ue.accelerometerPacketSizeBytes;
+ this._growArrayBuffer(n),
+ this._dataView.setUint32(this._insertionByte, e, !0),
+ (this._insertionByte += Ue.psbPacketType),
+ this._dataView.setUint32(this._insertionByte, t, !0),
+ (this._insertionByte += 4),
+ this._dataView.setFloat32(this._insertionByte, r, !0),
+ (this._insertionByte += 4),
+ this._dataView.setFloat32(this._insertionByte, i, !0),
+ (this._insertionByte += 4),
+ this._dataView.setFloat32(this._insertionByte, a, !0),
+ (this._insertionByte += 4),
+ this._numberPackets++,
+ this._dataView.setUint32(4, this._numberPackets, !0);
+ }
+ appendAttitudeMatrix(e) {
+ if (!this._started) return;
+ let t = Ue.psbPacketType + Ue.attitudeMatrixPacketSizeBytes;
+ this._growArrayBuffer(t),
+ this._dataView.setUint32(
+ this._insertionByte,
+ Ce.ATTITUDE_MATRIX,
+ !0
+ ),
+ (this._insertionByte += Ue.psbPacketType),
+ this._dataFloat32.set(e, this._insertionByte / 4),
+ (this._insertionByte += Ue.attitudeMatrixPacketSizeBytes),
+ this._numberPackets++,
+ this._dataView.setUint32(4, this._numberPackets, !0);
+ }
+ _growArrayBuffer(e) {
+ for (; this._insertionByte + e > this._data.byteLength; ) {
+ let e = Math.max(
+ 2 * this._data.byteLength,
+ this._estimatedSize(50, 320, 240)
+ ),
+ t = new ArrayBuffer(e),
+ r = new Uint8Array(t);
+ r.set(this._dataUint8),
+ (this._data = t),
+ (this._dataUint8 = r),
+ (this._dataFloat32 = new Float32Array(this._data)),
+ (this._dataView = new DataView(this._data));
+ }
+ }
+ }
+ (Ue.headerSizeBytes = 8),
+ (Ue.psbPacketType = 4),
+ (Ue.psbCameraFrameWidth = 4),
+ (Ue.psbCameraFrameHeight = 4),
+ (Ue.psbFlags = 4),
+ (Ue.psbCameraToDeviceTransform = 64),
+ (Ue.psbCameraModel = 24),
+ (Ue.cameraPacketSizeBytes =
+ Ue.psbCameraFrameWidth +
+ Ue.psbCameraFrameHeight +
+ Ue.psbCameraToDeviceTransform +
+ Ue.psbCameraModel +
+ Ue.psbFlags),
+ (Ue.accelerometerPacketSizeBytes = 16),
+ (Ue.rotationRatePacketSizeBytes = 16),
+ (Ue.attitudePacketSizeBytes = 16),
+ (Ue.attitudeMatrixPacketSizeBytes = 64);
+ class De {
+ constructor(e) {
+ (this._data = e),
+ (this.dataByPacket = new Map()),
+ (this.dataByCameraFrame = new Map()),
+ (this.numberPackets = 0),
+ (this.numberCameraFrames = 0),
+ (this.numberAccelerometerPackets = 0),
+ (this.numberRotationRatePackets = 0),
+ (this.numberAttitudePackets = 0),
+ (this.numberAttitudeMatrixPackets = 0);
+ let t = new TextDecoder(),
+ r = "";
+ try {
+ r = t.decode(this._data.slice(0, 4));
+ } catch (e) {
+ throw new Error(
+ "Unable to decode header - perhaps this isn't a sequence file?"
+ );
+ }
+ if ("UAR1" !== r)
+ throw new Error(
+ `Invalid - perhaps this isn't a sequence file: ${r}`
+ );
+ let i = 0,
+ a = new DataView(this._data);
+ (this.numberPackets = a.getUint32(4, !0)),
+ (i += Ue.headerSizeBytes);
+ for (let e = 0; e < this.numberPackets; e++) {
+ let t = a.getUint32(i, !0);
+ switch (((i += Ue.psbPacketType), t)) {
+ case Ce.CAMERA_FRAME: {
+ let t = a.getUint32(i, !0);
+ i += Ue.psbCameraFrameWidth;
+ let r = a.getUint32(i, !0);
+ i += Ue.psbCameraFrameHeight;
+ let n = new Float32Array(
+ this._data,
+ i,
+ Ue.psbCameraToDeviceTransform / 4
+ );
+ i += Ue.psbCameraToDeviceTransform;
+ let s = new Float32Array(
+ this._data,
+ i,
+ Ue.psbCameraModel / 4
+ );
+ i += Ue.psbCameraModel;
+ let o = a.getUint32(i, !0);
+ i += Ue.psbFlags;
+ let _ = 1 === o,
+ c = new Uint8Array(this._data, i, t * r);
+ i += t * r;
+ let l = {
+ type: Ce.CAMERA_FRAME,
+ width: t,
+ height: r,
+ cameraToDevice: n,
+ cameraModel: s,
+ userFacing: _,
+ greyscale: c,
+ };
+ this.dataByPacket.set(e, l),
+ this.dataByCameraFrame.set(this.numberCameraFrames, l),
+ this.numberCameraFrames++;
+ break;
+ }
+ case Ce.ACCELEROMETER: {
+ let t = a.getUint32(i, !0);
+ i += 4;
+ let r = a.getFloat32(i, !0);
+ i += 4;
+ let n = a.getFloat32(i, !0);
+ i += 4;
+ let s = a.getFloat32(i, !0);
+ (i += 4),
+ this.dataByPacket.set(e, {
+ type: Ce.ACCELEROMETER,
+ t,
+ x: r,
+ y: n,
+ z: s,
+ }),
+ this.numberAccelerometerPackets++;
+ break;
+ }
+ case Ce.ROTATION_RATE: {
+ let t = a.getUint32(i, !0);
+ i += 4;
+ let r = a.getFloat32(i, !0);
+ i += 4;
+ let n = a.getFloat32(i, !0);
+ i += 4;
+ let s = a.getFloat32(i, !0);
+ (i += 4),
+ this.dataByPacket.set(e, {
+ type: Ce.ROTATION_RATE,
+ t,
+ x: r,
+ y: n,
+ z: s,
+ }),
+ this.numberRotationRatePackets++;
+ break;
+ }
+ case Ce.ATTITUDE: {
+ let t = a.getUint32(i, !0);
+ i += 4;
+ let r = a.getFloat32(i, !0);
+ i += 4;
+ let n = a.getFloat32(i, !0);
+ i += 4;
+ let s = a.getFloat32(i, !0);
+ (i += 4),
+ this.dataByPacket.set(e, {
+ type: Ce.ATTITUDE,
+ t,
+ x: r,
+ y: n,
+ z: s,
+ }),
+ this.numberAttitudePackets++;
+ break;
+ }
+ case Ce.ATTITUDE_MATRIX: {
+ let t = new Float32Array(
+ this._data,
+ i,
+ Ue.attitudeMatrixPacketSizeBytes / 4
+ );
+ (i += Ue.attitudeMatrixPacketSizeBytes),
+ this.dataByPacket.set(e, {
+ type: Ce.ATTITUDE_MATRIX,
+ attitude: t,
+ }),
+ this.numberAttitudeMatrixPackets++;
+ break;
+ }
+ }
+ }
+ }
+ }
+ class Pe {}
+ const Be = new Map();
+ class Oe {
+ 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, i) => {
+ (this._viewports[this._viewports.length - 1] = [e, t, r, i]),
+ this._underlyingViewport.call(this._gl, e, t, r, i);
+ });
+ }
+ static get(e) {
+ let t = Be.get(e);
+ return t || ((t = new Oe(e)), Be.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]);
+ }
+ }
+ class ze {
+ 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 = A()),
+ (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, i) {
+ let a = this._gl;
+ const n = Oe.get(a);
+ n.push();
+ const s = a.isEnabled(a.SCISSOR_TEST),
+ o = a.isEnabled(a.DEPTH_TEST),
+ _ = a.isEnabled(a.BLEND),
+ c = a.isEnabled(a.CULL_FACE),
+ l = a.isEnabled(a.STENCIL_TEST),
+ u = a.getParameter(a.ACTIVE_TEXTURE),
+ d = a.getParameter(a.UNPACK_FLIP_Y_WEBGL),
+ f = a.getParameter(a.CURRENT_PROGRAM);
+ a.activeTexture(a.TEXTURE0);
+ const h = a.getParameter(a.TEXTURE_BINDING_2D),
+ p = a.getParameter(a.FRAMEBUFFER_BINDING),
+ m = a.getParameter(a.ARRAY_BUFFER_BINDING),
+ g = a.getParameter(a.ELEMENT_ARRAY_BUFFER_BINDING);
+ a.disable(a.SCISSOR_TEST),
+ a.disable(a.DEPTH_TEST),
+ a.disable(a.BLEND),
+ a.disable(a.CULL_FACE),
+ a.disable(a.STENCIL_TEST),
+ a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, !1),
+ a.bindTexture(a.TEXTURE_2D, e);
+ const b = a.RGBA,
+ w = a.RGBA,
+ v = a.UNSIGNED_BYTE;
+ a.texImage2D(a.TEXTURE_2D, 0, b, w, v, t);
+ let y = 0,
+ E = 0;
+ "undefined" != typeof HTMLVideoElement &&
+ t instanceof HTMLVideoElement
+ ? ((y = t.videoWidth), (E = t.videoHeight))
+ : ((y = t.width), (E = t.height)),
+ E > y && (E = [y, (y = E)][0]),
+ this._updateTransforms(r, i);
+ let A = this._getFramebuffer(a, D.dataWidth / 4, D.dataHeight),
+ T = this._getVertexBuffer(a),
+ x = this._getIndexBuffer(a),
+ R = this._getGreyscaleShader(a);
+ const k = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_SIZE
+ ),
+ F = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_TYPE
+ ),
+ L = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_NORMALIZED
+ ),
+ M = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_STRIDE
+ ),
+ I = a.getVertexAttribOffset(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_POINTER
+ ),
+ S = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_ENABLED
+ ),
+ C = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
+ ),
+ U = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_SIZE
+ ),
+ P = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_TYPE
+ ),
+ B = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_NORMALIZED
+ ),
+ O = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_STRIDE
+ ),
+ z = a.getVertexAttribOffset(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_POINTER
+ ),
+ V = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
+ ),
+ N = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_ENABLED
+ );
+ let G = 0,
+ W = 0;
+ this._isWebGL2
+ ? ((G = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ a.VERTEX_ATTRIB_ARRAY_DIVISOR
+ )),
+ (W = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ a.VERTEX_ATTRIB_ARRAY_DIVISOR
+ )),
+ a.vertexAttribDivisor(R.aVertexPositionLoc, 0),
+ a.vertexAttribDivisor(R.aTextureCoordLoc, 0))
+ : this._instancedArraysExtension &&
+ ((G = a.getVertexAttrib(
+ R.aVertexPositionLoc,
+ this._instancedArraysExtension
+ .VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
+ )),
+ (W = a.getVertexAttrib(
+ R.aTextureCoordLoc,
+ this._instancedArraysExtension
+ .VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE
+ )),
+ this._instancedArraysExtension.vertexAttribDivisorANGLE(
+ R.aVertexPositionLoc,
+ 0
+ ),
+ this._instancedArraysExtension.vertexAttribDivisorANGLE(
+ R.aTextureCoordLoc,
+ 0
+ )),
+ a.bindFramebuffer(a.FRAMEBUFFER, A),
+ a.viewport(0, 0, this._framebufferWidth, this._framebufferHeight),
+ a.clear(a.COLOR_BUFFER_BIT),
+ a.bindBuffer(a.ARRAY_BUFFER, T),
+ a.vertexAttribPointer(
+ R.aVertexPositionLoc,
+ 2,
+ a.FLOAT,
+ !1,
+ 16,
+ 0
+ ),
+ a.enableVertexAttribArray(R.aVertexPositionLoc),
+ a.vertexAttribPointer(R.aTextureCoordLoc, 2, a.FLOAT, !1, 16, 8),
+ a.enableVertexAttribArray(R.aTextureCoordLoc),
+ a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, x),
+ a.useProgram(R.program),
+ a.uniform1f(R.uTexWidthLoc, D.dataWidth),
+ a.uniformMatrix4fv(
+ R.uUvTransformLoc,
+ !1,
+ this._cameraUvTransform
+ ),
+ a.activeTexture(a.TEXTURE0),
+ a.bindTexture(a.TEXTURE_2D, e),
+ a.uniform1i(R.uSamplerLoc, 0),
+ a.drawElements(a.TRIANGLES, 6, a.UNSIGNED_SHORT, 0),
+ a.bindBuffer(a.ARRAY_BUFFER, C),
+ a.vertexAttribPointer(R.aVertexPositionLoc, k, F, L, M, I),
+ a.bindBuffer(a.ARRAY_BUFFER, V),
+ a.vertexAttribPointer(R.aTextureCoordLoc, U, P, B, O, z),
+ a.bindBuffer(a.ARRAY_BUFFER, m),
+ a.bindBuffer(a.ELEMENT_ARRAY_BUFFER, g),
+ S || a.disableVertexAttribArray(R.aVertexPositionLoc),
+ N || a.disableVertexAttribArray(R.aTextureCoordLoc),
+ this._isWebGL2
+ ? (a.vertexAttribDivisor(R.aVertexPositionLoc, G),
+ a.vertexAttribDivisor(R.aTextureCoordLoc, W))
+ : this._instancedArraysExtension &&
+ (this._instancedArraysExtension.vertexAttribDivisorANGLE(
+ R.aVertexPositionLoc,
+ G
+ ),
+ this._instancedArraysExtension.vertexAttribDivisorANGLE(
+ R.aTextureCoordLoc,
+ W
+ )),
+ a.bindFramebuffer(a.FRAMEBUFFER, p),
+ a.useProgram(f),
+ a.bindTexture(a.TEXTURE_2D, h),
+ a.activeTexture(u),
+ a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL, d),
+ n.pop(),
+ _ && a.enable(a.BLEND),
+ c && a.enable(a.CULL_FACE),
+ o && a.enable(a.DEPTH_TEST),
+ s && a.enable(a.SCISSOR_TEST),
+ l && a.enable(a.STENCIL_TEST);
+ }
+ readFrame(e, t) {
+ let r = this._gl,
+ i = new Uint8Array(t);
+ const a = r.getParameter(r.FRAMEBUFFER_BINDING);
+ let n = this._getFramebuffer(r, D.dataWidth / 4, D.dataHeight);
+ return (
+ r.bindFramebuffer(r.FRAMEBUFFER, n),
+ r.readPixels(
+ 0,
+ 0,
+ this._framebufferWidth,
+ this._framebufferHeight,
+ r.RGBA,
+ r.UNSIGNED_BYTE,
+ i
+ ),
+ r.bindFramebuffer(r.FRAMEBUFFER, a),
+ {
+ uvTransform: this._cameraUvTransform,
+ data: t,
+ texture: e,
+ dataWidth: D.dataWidth,
+ dataHeight: D.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 i = 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 a = e.checkFramebufferStatus(e.FRAMEBUFFER);
+ if (a !== e.FRAMEBUFFER_COMPLETE)
+ throw new Error("Framebuffer not complete: " + a.toString());
+ return (
+ (this._framebufferWidth = t),
+ (this._framebufferHeight = r),
+ e.bindTexture(e.TEXTURE_2D, i),
+ 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 = u(e, e.VERTEX_SHADER, Ve),
+ i = u(e, e.FRAGMENT_SHADER, Ne);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "uTexWidth");
+ if (!a) throw new Error("Unable to get uniform location uTexWidth");
+ let n = e.getUniformLocation(t, "uUvTransform");
+ if (!n)
+ throw new Error("Unable to get uniform location uUvTransform");
+ let s = e.getUniformLocation(t, "uSampler");
+ if (!s) 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: a,
+ uUvTransformLoc: n,
+ uSamplerLoc: s,
+ }),
+ this._greyscaleShader
+ );
+ }
+ }
+ let Ve =
+ "\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",
+ Ne =
+ "\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",
+ Ge = 1,
+ We = new Map();
+ class He extends Pe {
+ constructor(e, t) {
+ super(),
+ (this._video = e),
+ (this._pipeline = t),
+ (this._isPaused = !0),
+ (this._hadFrames = !1),
+ (this._isUserFacing = !1),
+ (this._cameraToScreenRotation = 0),
+ (this._isUploadFrame = !0),
+ (this._cameraToDeviceTransform = A()),
+ (this._cameraToDeviceTransformUserFacing = A()),
+ (this._cameraModel = new Float32Array([
+ 300, 300, 160, 120, 0, 0,
+ ])),
+ k(this._cameraToDeviceTransformUserFacing, [-1, 1, -1]);
+ let r = this._video;
+ this._video instanceof HTMLVideoElement
+ ? r.addEventListener("loadedmetadata", () => {
+ this._hadFrames = !0;
+ })
+ : (this._hadFrames = !0),
+ (this._resetGLContext = this._resetGLContext.bind(this));
+ let i = ct.get(this._pipeline);
+ i && i.onGLContextReset.bind(this._resetGLContext);
+ }
+ static createVideoElementSource(e, t) {
+ let r = Ge++;
+ return (
+ We.set(r, new He(t, e)),
+ pe("html_element_source_t initialized"),
+ r
+ );
+ }
+ static getVideoElementSource(e) {
+ return We.get(e);
+ }
+ _resetGLContext() {
+ var e, t;
+ (this._currentVideoTexture = void 0),
+ null ===
+ (t =
+ null === (e = this._imageProcessor) || void 0 === e
+ ? void 0
+ : e.resetGLContext) ||
+ void 0 === t ||
+ t.call(e);
+ }
+ destroy() {
+ let e = ct.get(this._pipeline);
+ e && e.onGLContextReset.unbind(this._resetGLContext),
+ this.pause(),
+ this._resetGLContext();
+ }
+ pause() {
+ this._isPaused = !0;
+ let e = ct.get(this._pipeline);
+ e &&
+ e.currentCameraSource === this &&
+ (e.currentCameraSource = void 0);
+ }
+ start() {
+ var e;
+ this._isPaused &&
+ ((this._isUploadFrame = !0),
+ this._video instanceof HTMLVideoElement &&
+ (this._hadFrames = !1)),
+ (this._isPaused = !1);
+ let t = ct.get(this._pipeline);
+ t &&
+ t.currentCameraSource !== this &&
+ (null === (e = t.currentCameraSource) ||
+ void 0 === e ||
+ e.pause(),
+ (t.currentCameraSource = this));
+ }
+ getFrame(e) {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r = t.glContext;
+ if (r && !this._isPaused && this._hadFrames)
+ try {
+ let i = this._processFrame(r, this._cameraToScreenRotation, e);
+ if (i) {
+ let e = t.registerToken(i);
+ t.sendDataToWorker(
+ i.data || new ArrayBuffer(0),
+ e,
+ i.dataWidth,
+ i.dataHeight,
+ i.userFacing,
+ i.cameraToDevice,
+ i.cameraModel
+ );
+ }
+ } catch (e) {
+ console.log("Unable to process frame");
+ }
+ }
+ _processFrame(e, t, r) {
+ let i = ct.get(this._pipeline);
+ if (!i) return;
+ if (
+ (this._imageProcessor || (this._imageProcessor = new ze(e)),
+ this._isUploadFrame)
+ ) {
+ if (
+ (this._currentVideoTexture ||
+ (this._currentVideoTexture = i.getVideoTexture()),
+ !this._currentVideoTexture)
+ )
+ return;
+ return (
+ this._imageProcessor.uploadFrame(
+ this._currentVideoTexture,
+ this._video,
+ t,
+ this._isUserFacing
+ ),
+ void (this._isUploadFrame = !this._isUploadFrame)
+ );
+ }
+ if (r || !this._currentVideoTexture) return;
+ this._isUploadFrame = !this._isUploadFrame;
+ let a = D.dataWidth * D.dataHeight,
+ n = i.cameraPixelArrays.pop();
+ for (; n && n.byteLength !== a; ) n = i.cameraPixelArrays.pop();
+ n || (n = new ArrayBuffer(a));
+ let s = this._currentVideoTexture;
+ this._currentVideoTexture = void 0;
+ let o = (300 * D.dataWidth) / 320;
+ return (
+ (this._cameraModel[0] = o),
+ (this._cameraModel[1] = o),
+ (this._cameraModel[2] = 0.5 * D.dataWidth),
+ (this._cameraModel[3] = 0.5 * D.dataHeight),
+ Object.assign(
+ Object.assign({}, this._imageProcessor.readFrame(s, n)),
+ {
+ cameraModel: this._cameraModel,
+ cameraSource: this,
+ cameraToDevice: this._isUserFacing
+ ? this._cameraToDeviceTransformUserFacing
+ : this._cameraToDeviceTransform,
+ }
+ )
+ );
+ }
+ uploadGL() {}
+ }
+ var qe = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ let Ye = document.createElement("video");
+ Ye.setAttribute("playsinline", ""),
+ Ye.setAttribute("webkit-playsinline", ""),
+ D.videoElementInDOM &&
+ ((Ye.style.width = "0px"),
+ (Ye.style.height = "0px"),
+ document.body.appendChild(Ye));
+ class Xe extends He {
+ constructor(e, t, r) {
+ super(Ye, t),
+ (this._impl = e),
+ (this._deviceId = r),
+ (this._currentStream = null),
+ (this._activeDeviceId = null),
+ (this._hasStartedOrientation = !1),
+ (this._deviceMotionListener = (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.accelerationIncludingGravity &&
+ null !== e.accelerationIncludingGravity.x &&
+ null !== e.accelerationIncludingGravity.y &&
+ null !== e.accelerationIncludingGravity.z &&
+ t.motionAccelerometerSubmit(
+ r,
+ e.accelerationIncludingGravity.x * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.y * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.z * D.deviceMotionMutliplier
+ ),
+ null === e.rotationRate ||
+ null === e.rotationRate.alpha ||
+ null === e.rotationRate.beta ||
+ null === e.rotationRate.gamma ||
+ this._hasStartedOrientation
+ ? this._hasStartedOrientation ||
+ this._startDeviceOrientation()
+ : (e.timeStamp,
+ t.motionRotationRateSubmit(
+ r,
+ (e.rotationRate.alpha * Math.PI) / -180,
+ (e.rotationRate.beta * Math.PI) / -180,
+ (e.rotationRate.gamma * Math.PI) / -180
+ ));
+ });
+ }
+ destroy() {
+ rt(this._impl), super.destroy();
+ }
+ _stop() {
+ this._currentStream &&
+ (this._currentStream.getTracks().forEach((e) => e.stop()),
+ (this._currentStream = null));
+ }
+ pause() {
+ super.pause(), this._stopDeviceMotion(), this._syncCamera();
+ }
+ start() {
+ super.start(), this._startDeviceMotion(), this._syncCamera();
+ }
+ _getConstraints() {
+ return qe(this, void 0, void 0, function* () {
+ let e, t;
+ if (
+ this._deviceId !== Xe.DEFAULT_DEVICE_ID &&
+ this._deviceId !== Xe.USER_DEFAULT_DEVICE_ID
+ )
+ e = this._deviceId;
+ else if (
+ ((t =
+ this._deviceId === Xe.DEFAULT_DEVICE_ID
+ ? "environment"
+ : "user"),
+ D.ios164CameraSelection)
+ ) {
+ if (
+ !this._explicitEnvironmentCameraId ||
+ !this._explicitUserCameraId
+ ) {
+ (yield navigator.mediaDevices.getUserMedia({
+ audio: !1,
+ video: { facingMode: t },
+ }))
+ .getTracks()
+ .forEach((e) => e.stop());
+ let e = yield navigator.mediaDevices.enumerateDevices();
+ (e = e.filter((e) => "videoinput" === e.kind)),
+ e.length >= 2 &&
+ ((this._explicitUserCameraId = e[0].deviceId),
+ (this._explicitEnvironmentCameraId = e[1].deviceId));
+ }
+ e =
+ "environment" === t
+ ? this._explicitEnvironmentCameraId
+ : this._explicitUserCameraId;
+ }
+ let r = {
+ audio: !1,
+ video: {
+ facingMode: t,
+ width: D.videoWidth,
+ height: D.videoHeight,
+ frameRate: D.requestHighFrameRate ? 60 : void 0,
+ deviceId: e,
+ },
+ };
+ if (e || D.relyOnConstraintsForCameraSelection) return r;
+ if (
+ !navigator.mediaDevices ||
+ !navigator.mediaDevices.enumerateDevices
+ )
+ return r;
+ let i = yield navigator.mediaDevices.enumerateDevices(),
+ a = !1;
+ return (
+ (i = i.filter((e) => {
+ if ("videoinput" !== e.kind) return !1;
+ if (e.getCapabilities) {
+ a = !0;
+ let r = e.getCapabilities();
+ if (
+ r &&
+ r.facingMode &&
+ r.facingMode.indexOf(
+ "user" === t ? "user" : "environment"
+ ) < 0
+ )
+ return !1;
+ }
+ return !0;
+ })),
+ a && 0 !== i.length
+ ? ("object" == typeof r.video &&
+ (pe("choosing device ID", i[i.length - 1].deviceId),
+ (r.video.deviceId = i[i.length - 1].deviceId)),
+ r)
+ : r
+ );
+ });
+ }
+ getFrame(e) {
+ (this._cameraToScreenRotation = N(!1)), super.getFrame(e);
+ }
+ _getUserMedia() {
+ return qe(this, void 0, void 0, function* () {
+ let e = yield this._getConstraints();
+ return navigator.mediaDevices &&
+ navigator.mediaDevices.getUserMedia
+ ? yield navigator.mediaDevices.getUserMedia(e)
+ : yield new Promise((t, r) => {
+ navigator.getUserMedia(e, t, r);
+ });
+ });
+ }
+ _syncCamera() {
+ return qe(this, void 0, void 0, function* () {
+ if (this._currentStream && this._isPaused) this._stop();
+ else if (
+ (this._currentStream &&
+ this._activeDeviceId !== this._deviceId &&
+ this._stop(),
+ !this._isPaused)
+ ) {
+ if (
+ ((this._activeDeviceId = this._deviceId),
+ (this._currentStream = yield this._getUserMedia()),
+ this._isPaused)
+ )
+ return void (yield this._syncCamera());
+ if (((this._isUserFacing = !1), this._currentStream)) {
+ let e = this._currentStream.getVideoTracks();
+ e.length > 0 &&
+ (this._isUserFacing =
+ "user" === e[0].getSettings().facingMode);
+ }
+ if (!(this._video instanceof HTMLVideoElement)) return;
+ (this._video.src = ""),
+ (this._video.loop = !1),
+ (this._video.muted = !0),
+ (this._video.srcObject = this._currentStream),
+ this._video.play();
+ }
+ });
+ }
+ _startDeviceOrientation() {
+ this._hasStartedOrientation ||
+ ((this._hasStartedOrientation = !0),
+ (this._deviceOrientationListener = (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.alpha &&
+ null !== e.beta &&
+ null !== e.gamma &&
+ t.motionAttitudeSubmit(r, e.alpha, e.beta, e.gamma);
+ }),
+ window.addEventListener(
+ "deviceorientation",
+ this._deviceOrientationListener
+ ));
+ }
+ _startDeviceMotion() {
+ window.addEventListener(
+ "devicemotion",
+ this._deviceMotionListener,
+ !1
+ );
+ }
+ _stopDeviceMotion() {
+ window.removeEventListener(
+ "devicemotion",
+ this._deviceMotionListener
+ ),
+ this._deviceOrientationListener &&
+ window.removeEventListener(
+ "deviceorientation",
+ this._deviceOrientationListener
+ );
+ }
+ }
+ (Xe.USER_DEFAULT_DEVICE_ID =
+ "Simulated User Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b"),
+ (Xe.DEFAULT_DEVICE_ID =
+ "Simulated Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b");
+ var je = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ class Ze extends Pe {
+ constructor(e, t, r) {
+ super(),
+ (this._impl = e),
+ (this._pipeline = t),
+ (this._deviceId = r),
+ (this._currentStream = null),
+ (this._activeDeviceId = null),
+ (this._isPaused = !0),
+ (this._isUserFacing = !1),
+ (this._hadFrames = !1),
+ (this._canvas = new OffscreenCanvas(640, 480)),
+ (this._context = this._canvas.getContext("2d")),
+ (this._lastFrameTime = -1),
+ (this._video = document.createElement("video")),
+ (this._cameraToDeviceTransform = A()),
+ (this._cameraToDeviceTransformUserFacing = A()),
+ (this._cameraModel = new Float32Array([
+ 300, 300, 160, 120, 0, 0,
+ ])),
+ (this._hasStartedOrientation = !1),
+ (this._deviceMotionListener = (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.accelerationIncludingGravity &&
+ null !== e.accelerationIncludingGravity.x &&
+ null !== e.accelerationIncludingGravity.y &&
+ null !== e.accelerationIncludingGravity.z &&
+ t.motionAccelerometerSubmit(
+ r,
+ e.accelerationIncludingGravity.x * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.y * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.z * D.deviceMotionMutliplier
+ ),
+ null === e.rotationRate ||
+ null === e.rotationRate.alpha ||
+ null === e.rotationRate.beta ||
+ null === e.rotationRate.gamma ||
+ this._hasStartedOrientation
+ ? this._hasStartedOrientation ||
+ this._startDeviceOrientation()
+ : (e.timeStamp,
+ t.motionRotationRateSubmit(
+ r,
+ (e.rotationRate.alpha * Math.PI) / -180,
+ (e.rotationRate.beta * Math.PI) / -180,
+ (e.rotationRate.gamma * Math.PI) / -180
+ ));
+ }),
+ pe("Using ImageBitmap camera source"),
+ k(this._cameraToDeviceTransformUserFacing, [-1, 1, -1]),
+ (this._video.muted = !0),
+ this._video.setAttribute("playsinline", ""),
+ this._video.setAttribute("webkit-playsinline", ""),
+ D.videoElementInDOM &&
+ ((this._video.style.width = "0px"),
+ (this._video.style.height = "0px"),
+ document.body.appendChild(this._video)),
+ this._video.addEventListener("loadedmetadata", () => {
+ this._hadFrames = !0;
+ });
+ }
+ destroy() {
+ this.pause(), rt(this._impl);
+ }
+ _stop() {
+ this._currentStream &&
+ (this._currentStream.getTracks().forEach((e) => e.stop()),
+ (this._currentStream = null));
+ }
+ pause() {
+ this._isPaused = !0;
+ let e = ct.get(this._pipeline);
+ e &&
+ e.currentCameraSource === this &&
+ (e.currentCameraSource = void 0),
+ this._stopDeviceMotion(),
+ this._syncCamera();
+ }
+ start() {
+ var e;
+ let t = ct.get(this._pipeline);
+ t &&
+ t.currentCameraSource !== this &&
+ (null === (e = t.currentCameraSource) ||
+ void 0 === e ||
+ e.pause(),
+ (t.currentCameraSource = this)),
+ (this._isPaused = !1),
+ this._startDeviceMotion(),
+ this._syncCamera();
+ }
+ _getConstraints() {
+ return je(this, void 0, void 0, function* () {
+ let e, t;
+ this._deviceId !== Ze.DEFAULT_DEVICE_ID &&
+ this._deviceId !== Ze.USER_DEFAULT_DEVICE_ID
+ ? (e = this._deviceId)
+ : (t =
+ this._deviceId === Ze.DEFAULT_DEVICE_ID
+ ? "environment"
+ : "user");
+ let r = {
+ audio: !1,
+ video: {
+ facingMode: t,
+ width: D.videoWidth,
+ height: D.videoHeight,
+ frameRate: D.requestHighFrameRate ? 60 : void 0,
+ deviceId: e,
+ },
+ };
+ if (e) return r;
+ if (
+ !navigator.mediaDevices ||
+ !navigator.mediaDevices.enumerateDevices
+ )
+ return r;
+ let i = yield navigator.mediaDevices.enumerateDevices(),
+ a = !1;
+ return (
+ (i = i.filter((e) => {
+ if ("videoinput" !== e.kind) return !1;
+ if (e.getCapabilities) {
+ a = !0;
+ let r = e.getCapabilities();
+ if (
+ r &&
+ r.facingMode &&
+ r.facingMode.indexOf(
+ "user" === t ? "user" : "environment"
+ ) < 0
+ )
+ return !1;
+ }
+ return !0;
+ })),
+ a && 0 !== i.length
+ ? ("object" == typeof r.video &&
+ (pe("choosing device ID", i[i.length - 1].deviceId),
+ (r.video.deviceId = i[i.length - 1].deviceId)),
+ r)
+ : r
+ );
+ });
+ }
+ getFrame(e) {
+ var t, r;
+ if (!this._context) return;
+ if (!this._hadFrames) return;
+ if (e) return;
+ let i = performance.now();
+ if (i < this._lastFrameTime + 25) return;
+ (this._lastFrameTime = i),
+ this._canvas.width !== this._video.videoWidth &&
+ (this._canvas.width = this._video.videoWidth),
+ this._canvas.height !== this._video.videoHeight &&
+ (this._canvas.height = this._video.videoHeight),
+ this._context.drawImage(this._video, 0, 0);
+ const a = this._canvas.transferToImageBitmap();
+ let n = N(!1),
+ s = ct.get(this._pipeline);
+ if (!s) return;
+ let o = (300 * D.dataWidth) / 320;
+ (this._cameraModel[0] = o),
+ (this._cameraModel[1] = o),
+ (this._cameraModel[2] = 0.5 * D.dataWidth),
+ (this._cameraModel[3] = 0.5 * D.dataHeight);
+ let _ = s.registerToken({
+ dataWidth: this._canvas.width,
+ dataHeight: this._canvas.height,
+ texture: void 0,
+ userFacing: this._isUserFacing,
+ cameraSource: this,
+ cameraModel: this._cameraModel.slice(),
+ cameraToDevice: this._isUserFacing
+ ? this._cameraToDeviceTransformUserFacing
+ : this._cameraToDeviceTransform,
+ });
+ null ===
+ (r =
+ null === (t = ct.get(this._pipeline)) || void 0 === t
+ ? void 0
+ : t.sendImageBitmapToWorker) ||
+ void 0 === r ||
+ r.call(
+ t,
+ a,
+ n,
+ this._isUserFacing,
+ _,
+ this._cameraModel,
+ this._isUserFacing
+ ? this._cameraToDeviceTransformUserFacing
+ : this._cameraToDeviceTransform
+ );
+ }
+ _getUserMedia() {
+ return je(this, void 0, void 0, function* () {
+ let e = yield this._getConstraints();
+ return navigator.mediaDevices &&
+ navigator.mediaDevices.getUserMedia
+ ? yield navigator.mediaDevices.getUserMedia(e)
+ : yield new Promise((t, r) => {
+ navigator.getUserMedia(e, t, r);
+ });
+ });
+ }
+ _syncCamera() {
+ return je(this, void 0, void 0, function* () {
+ if (this._currentStream && this._isPaused) this._stop();
+ else if (
+ (this._currentStream &&
+ this._activeDeviceId !== this._deviceId &&
+ this._stop(),
+ !this._isPaused)
+ ) {
+ if (
+ ((this._activeDeviceId = this._deviceId),
+ (this._currentStream = yield this._getUserMedia()),
+ this._isPaused)
+ )
+ return void (yield this._syncCamera());
+ if (((this._isUserFacing = !1), this._currentStream)) {
+ let e = this._currentStream.getVideoTracks();
+ e.length > 0 &&
+ (this._isUserFacing =
+ "user" === e[0].getSettings().facingMode);
+ }
+ (this._video.src = ""),
+ (this._video.loop = !1),
+ (this._video.muted = !0),
+ (this._video.srcObject = this._currentStream),
+ this._video.play();
+ }
+ });
+ }
+ _startDeviceOrientation() {
+ this._hasStartedOrientation ||
+ ((this._hasStartedOrientation = !0),
+ window.addEventListener("deviceorientation", (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.alpha &&
+ null !== e.beta &&
+ null !== e.gamma &&
+ t.motionAttitudeSubmit(r, e.alpha, e.beta, e.gamma);
+ }));
+ }
+ _startDeviceMotion() {
+ window.addEventListener(
+ "devicemotion",
+ this._deviceMotionListener,
+ !1
+ );
+ }
+ _stopDeviceMotion() {
+ window.removeEventListener(
+ "devicemotion",
+ this._deviceMotionListener
+ );
+ }
+ uploadGL(e) {
+ const t = ct.get(this._pipeline),
+ r = null == t ? void 0 : t.glContext;
+ if (!e || e.texture || !e.frame || !t || !r) return;
+ let i = t.getVideoTexture();
+ i &&
+ (r.bindTexture(r.TEXTURE_2D, i),
+ r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, !1),
+ r.texImage2D(
+ r.TEXTURE_2D,
+ 0,
+ r.RGBA,
+ r.RGBA,
+ r.UNSIGNED_BYTE,
+ e.frame
+ ),
+ r.bindTexture(r.TEXTURE_2D, null),
+ (e.texture = i),
+ e.frame.close(),
+ delete e.frame);
+ }
+ }
+ (Ze.USER_DEFAULT_DEVICE_ID =
+ "Simulated User Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b"),
+ (Ze.DEFAULT_DEVICE_ID =
+ "Simulated Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b");
+ var Ke = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ class $e extends Pe {
+ constructor(e, t, r) {
+ super(),
+ (this._impl = e),
+ (this._pipeline = t),
+ (this._deviceId = r),
+ (this._currentStream = null),
+ (this._activeDeviceId = null),
+ (this._isPaused = !0),
+ (this._isUserFacing = !1),
+ (this._cameraToScreenRotation = 0),
+ (this._hasStartedOrientation = !1),
+ (this._deviceMotionListener = (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.accelerationIncludingGravity &&
+ null !== e.accelerationIncludingGravity.x &&
+ null !== e.accelerationIncludingGravity.y &&
+ null !== e.accelerationIncludingGravity.z &&
+ t.motionAccelerometerSubmit(
+ r,
+ e.accelerationIncludingGravity.x * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.y * D.deviceMotionMutliplier,
+ e.accelerationIncludingGravity.z * D.deviceMotionMutliplier
+ ),
+ null === e.rotationRate ||
+ null === e.rotationRate.alpha ||
+ null === e.rotationRate.beta ||
+ null === e.rotationRate.gamma ||
+ this._hasStartedOrientation
+ ? this._hasStartedOrientation ||
+ this._startDeviceOrientation()
+ : (e.timeStamp,
+ t.motionRotationRateSubmit(
+ r,
+ (e.rotationRate.alpha * Math.PI) / -180,
+ (e.rotationRate.beta * Math.PI) / -180,
+ (e.rotationRate.gamma * Math.PI) / -180
+ ));
+ }),
+ pe("Using MSTP camera source");
+ }
+ destroy() {
+ this.pause(), rt(this._impl);
+ }
+ _stop() {
+ this._currentStream &&
+ (this._currentStream.getTracks().forEach((e) => e.stop()),
+ (this._currentStream = null));
+ }
+ pause() {
+ this._isPaused = !0;
+ let e = ct.get(this._pipeline);
+ e &&
+ e.currentCameraSource === this &&
+ (e.currentCameraSource = void 0),
+ this._stopDeviceMotion(),
+ this._syncCamera();
+ }
+ start() {
+ var e;
+ let t = ct.get(this._pipeline);
+ t &&
+ t.currentCameraSource !== this &&
+ (null === (e = t.currentCameraSource) ||
+ void 0 === e ||
+ e.pause(),
+ (t.currentCameraSource = this)),
+ (this._isPaused = !1),
+ this._startDeviceMotion(),
+ this._syncCamera();
+ }
+ _getConstraints() {
+ return Ke(this, void 0, void 0, function* () {
+ let e, t;
+ this._deviceId !== $e.DEFAULT_DEVICE_ID &&
+ this._deviceId !== $e.USER_DEFAULT_DEVICE_ID
+ ? (e = this._deviceId)
+ : (t =
+ this._deviceId === $e.DEFAULT_DEVICE_ID
+ ? "environment"
+ : "user");
+ let r = {
+ audio: !1,
+ video: {
+ facingMode: t,
+ width: D.videoWidth,
+ height: D.videoHeight,
+ frameRate: D.requestHighFrameRate ? 60 : 30,
+ deviceId: e,
+ },
+ };
+ if (e) return r;
+ if (
+ !navigator.mediaDevices ||
+ !navigator.mediaDevices.enumerateDevices
+ )
+ return r;
+ let i = yield navigator.mediaDevices.enumerateDevices(),
+ a = !1;
+ return (
+ (i = i.filter((e) => {
+ if ("videoinput" !== e.kind) return !1;
+ if (e.getCapabilities) {
+ a = !0;
+ let r = e.getCapabilities();
+ if (
+ r &&
+ r.facingMode &&
+ r.facingMode.indexOf(
+ "user" === t ? "user" : "environment"
+ ) < 0
+ )
+ return !1;
+ }
+ return !0;
+ })),
+ a && 0 !== i.length
+ ? ("object" == typeof r.video &&
+ (pe("choosing device ID", i[i.length - 1].deviceId),
+ (r.video.deviceId = i[i.length - 1].deviceId)),
+ r)
+ : r
+ );
+ });
+ }
+ getFrame(e) {
+ var t, r;
+ let i = N(!1);
+ i != this._cameraToScreenRotation &&
+ (null ===
+ (r =
+ null === (t = ct.get(this._pipeline)) || void 0 === t
+ ? void 0
+ : t.sendCameraToScreenRotationToWorker) ||
+ void 0 === r ||
+ r.call(t, i),
+ (this._cameraToScreenRotation = i));
+ }
+ _getUserMedia() {
+ return Ke(this, void 0, void 0, function* () {
+ let e = yield this._getConstraints();
+ return navigator.mediaDevices &&
+ navigator.mediaDevices.getUserMedia
+ ? yield navigator.mediaDevices.getUserMedia(e)
+ : yield new Promise((t, r) => {
+ navigator.getUserMedia(e, t, r);
+ });
+ });
+ }
+ _syncCamera() {
+ return Ke(this, void 0, void 0, function* () {
+ if (this._currentStream && this._isPaused) this._stop();
+ else if (
+ (this._currentStream &&
+ this._activeDeviceId !== this._deviceId &&
+ this._stop(),
+ !this._isPaused)
+ ) {
+ if (
+ ((this._activeDeviceId = this._deviceId),
+ (this._currentStream = yield this._getUserMedia()),
+ this._isPaused)
+ )
+ return void (yield this._syncCamera());
+ if (((this._isUserFacing = !1), this._currentStream)) {
+ let e = this._currentStream.getVideoTracks();
+ if (e.length > 0) {
+ this._isUserFacing =
+ "user" === e[0].getSettings().facingMode;
+ let t = new MediaStreamTrackProcessor({ track: e[0] }),
+ r = ct.get(this._pipeline);
+ r &&
+ r.sendCameraStreamToWorker(
+ this._impl,
+ t.readable,
+ this._isUserFacing
+ );
+ }
+ }
+ }
+ });
+ }
+ _startDeviceOrientation() {
+ this._hasStartedOrientation ||
+ ((this._hasStartedOrientation = !0),
+ window.addEventListener("deviceorientation", (e) => {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r =
+ void 0 !== e.timeStamp && null !== e.timeStamp
+ ? e.timeStamp
+ : performance.now();
+ null !== e.alpha &&
+ null !== e.beta &&
+ null !== e.gamma &&
+ t.motionAttitudeSubmit(r, e.alpha, e.beta, e.gamma);
+ }));
+ }
+ _startDeviceMotion() {
+ window.addEventListener(
+ "devicemotion",
+ this._deviceMotionListener,
+ !1
+ );
+ }
+ _stopDeviceMotion() {
+ window.removeEventListener(
+ "devicemotion",
+ this._deviceMotionListener
+ );
+ }
+ uploadGL(e) {
+ const t = ct.get(this._pipeline),
+ r = null == t ? void 0 : t.glContext;
+ if (!e || e.texture || !e.frame || !t || !r) return;
+ let i = t.getVideoTexture();
+ i &&
+ (r.bindTexture(r.TEXTURE_2D, i),
+ r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, !1),
+ r.texImage2D(
+ r.TEXTURE_2D,
+ 0,
+ r.RGBA,
+ r.RGBA,
+ r.UNSIGNED_BYTE,
+ e.frame
+ ),
+ r.bindTexture(r.TEXTURE_2D, null),
+ (e.texture = i),
+ e.frame.close(),
+ delete e.frame);
+ }
+ }
+ ($e.USER_DEFAULT_DEVICE_ID =
+ "Simulated User Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b"),
+ ($e.DEFAULT_DEVICE_ID =
+ "Simulated Default Device ID: a908df7f-5661-4d20-b227-a1c15d2fdb4b");
+ let Qe = 1,
+ Je = new Map();
+ function et(e, t) {
+ Je.set(e, t);
+ }
+ function tt(e) {
+ return Je.get(e);
+ }
+ function rt(e) {
+ Je.delete(e);
+ }
+ class it {
+ constructor(e) {
+ this._gl = e;
+ }
+ dispose() {
+ this._vbo && this._gl.deleteBuffer(this._vbo),
+ this._uvbo && this._gl.deleteBuffer(this._uvbo),
+ this._ibo && this._gl.deleteBuffer(this._ibo),
+ this._shader && this._gl.deleteProgram(this._shader.prog),
+ (this._vbo = void 0),
+ (this._uvbo = void 0),
+ (this._ibo = void 0),
+ (this._shader = void 0);
+ }
+ _generateIBO(e, t) {
+ if (this._ibo && this._lastIndices === e) return this._ibo;
+ if (
+ ((this._lastIndices = e),
+ this._ibo || (this._ibo = t.createBuffer()),
+ !this._ibo)
+ )
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this._ibo),
+ t.bufferData(t.ELEMENT_ARRAY_BUFFER, e, t.STATIC_DRAW),
+ t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, null),
+ this._ibo
+ );
+ }
+ _generateVBO(e, t) {
+ if ((this._vbo || (this._vbo = t.createBuffer()), !this._vbo))
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._vbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STATIC_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._vbo
+ );
+ }
+ _generateUVBO(e, t) {
+ if ((this._uvbo || (this._uvbo = t.createBuffer()), !this._uvbo))
+ throw new Error("Unable to create buffer object");
+ return (
+ t.bindBuffer(t.ARRAY_BUFFER, this._uvbo),
+ t.bufferData(t.ARRAY_BUFFER, e, t.STATIC_DRAW),
+ t.bindBuffer(t.ARRAY_BUFFER, null),
+ this._uvbo
+ );
+ }
+ draw(e, t, r) {
+ var i;
+ const a = t.getPreviewMesh(r),
+ n =
+ null === (i = t.getTargetInfo(r).preview) || void 0 === i
+ ? void 0
+ : i.image;
+ if (!a || !n) return;
+ if (!n.complete) return;
+ let s = this._gl,
+ o = this._getShader(s),
+ _ = this._generateVBO(a.vertices, s),
+ c = this._generateUVBO(a.uvs, s),
+ l = this._generateIBO(a.indices, s);
+ s.enable(s.DEPTH_TEST),
+ s.enable(s.CULL_FACE),
+ s.useProgram(o.prog),
+ s.uniformMatrix4fv(o.unif_matrix, !1, e),
+ s.activeTexture(s.TEXTURE0),
+ s.bindTexture(
+ s.TEXTURE_2D,
+ (function (e, t) {
+ let r = at.get(t);
+ if (r) return r;
+ if (((r = e.createTexture() || void 0), !r))
+ throw new Error("Unable to create texture");
+ at.set(t, r),
+ e.bindTexture(e.TEXTURE_2D, r),
+ e.texParameteri(
+ e.TEXTURE_2D,
+ e.TEXTURE_MAG_FILTER,
+ e.LINEAR
+ ),
+ e.texParameteri(
+ e.TEXTURE_2D,
+ e.TEXTURE_MIN_FILTER,
+ e.LINEAR
+ ),
+ 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
+ );
+ const i = e.RGBA,
+ a = e.RGBA,
+ n = e.UNSIGNED_BYTE;
+ return (
+ e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !0),
+ e.texImage2D(e.TEXTURE_2D, 0, i, a, n, t),
+ t.addEventListener("load", () => {
+ if (!r) return;
+ e.bindTexture(e.TEXTURE_2D, r);
+ const i = e.RGBA,
+ a = e.RGBA,
+ n = e.UNSIGNED_BYTE;
+ e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !0),
+ e.texImage2D(e.TEXTURE_2D, 0, i, a, n, t);
+ }),
+ r
+ );
+ })(s, n)
+ ),
+ s.uniform1i(o.unif_skinSampler, 0),
+ s.bindBuffer(s.ARRAY_BUFFER, _),
+ s.vertexAttribPointer(o.attr_position, 3, s.FLOAT, !1, 0, 0),
+ s.enableVertexAttribArray(o.attr_position),
+ s.bindBuffer(s.ARRAY_BUFFER, c),
+ s.vertexAttribPointer(o.attr_textureCoord, 2, s.FLOAT, !1, 0, 0),
+ s.enableVertexAttribArray(o.attr_textureCoord),
+ s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, l),
+ s.drawElements(
+ s.TRIANGLES,
+ a.indices.length,
+ s.UNSIGNED_SHORT,
+ 0
+ ),
+ s.disableVertexAttribArray(o.attr_position),
+ s.disableVertexAttribArray(o.attr_textureCoord),
+ s.bindBuffer(s.ARRAY_BUFFER, null),
+ s.bindBuffer(s.ELEMENT_ARRAY_BUFFER, null);
+ }
+ _getShader(e) {
+ if (this._shader) return this._shader;
+ let t = e.createProgram();
+ if (!t) throw new Error("Unable to create program");
+ let r = u(e, e.VERTEX_SHADER, nt),
+ i = u(e, e.FRAGMENT_SHADER, st);
+ e.attachShader(t, r), e.attachShader(t, i), d(e, t);
+ let a = e.getUniformLocation(t, "matrix");
+ if (!a) throw new Error("Unable to get uniform location mattrix");
+ let n = e.getUniformLocation(t, "skinSampler");
+ if (!n)
+ throw new Error("Unable to get uniform location skinSampler");
+ return (
+ (this._shader = {
+ prog: t,
+ unif_matrix: a,
+ unif_skinSampler: n,
+ attr_position: e.getAttribLocation(t, "position"),
+ attr_textureCoord: e.getAttribLocation(t, "textureCoord"),
+ }),
+ this._shader
+ );
+ }
+ }
+ const at = new Map();
+ let nt =
+ "\n#ifndef GL_ES\n#define highp\n#define mediump\n#define lowp\n#endif\n\nuniform mat4 matrix;\nattribute vec4 position;\nattribute vec2 textureCoord;\n\nvarying highp vec2 vTextureCoord;\n\nvoid main()\n{\n gl_Position = matrix * position;\n vTextureCoord = textureCoord;\n}",
+ st =
+ "\n#define highp mediump\n#ifdef GL_ES\n // define default precision for float, vec, mat.\n precision highp float;\n#else\n#define highp\n#define mediump\n#define lowp\n#endif\n\nvarying highp vec2 vTextureCoord;\nuniform sampler2D skinSampler;\n\nvoid main()\n{\n gl_FragColor = texture2D(skinSampler, vTextureCoord);\n}",
+ ot = new Map(),
+ _t = A();
+ class ct {
+ constructor(e, t, r) {
+ (this._client = e),
+ (this._impl = t),
+ (this._mgr = r),
+ (this.pendingMessages = []),
+ (this.cameraTokens = new Map()),
+ (this.nextCameraToken = 1),
+ (this.tokensInFlight = 0),
+ (this.videoTextures = []),
+ (this.cameraPixelArrays = []),
+ (this._sequenceRecordDeviceAttitudeMatrices = !0),
+ (this._sequenceRecorderFirstCameraToken = 0),
+ (this.onGLContextReset = new G());
+ }
+ static create(e, t) {
+ let r = e.pipeline_create();
+ return ot.set(r, new ct(e, r, t)), r;
+ }
+ static get(e) {
+ return ot.get(e);
+ }
+ frameUpdate(e) {
+ for (let t of this.pendingMessages)
+ e.processMessages(t),
+ this._mgr.postOutgoingMessage(
+ { t: "buf", p: this._impl, d: t },
+ [t]
+ );
+ (this.pendingMessages = []), this.cleanOldFrames();
+ }
+ cleanOldFrames() {
+ var e, t;
+ let r = this._client.pipeline_camera_frame_user_data(this._impl);
+ if (r)
+ for (let i of this.cameraTokens)
+ i[0] < r &&
+ (i[1].texture && this.videoTextures.push(i[1].texture),
+ null ===
+ (t =
+ null === (e = i[1].frame) || void 0 === e
+ ? void 0
+ : e.close) ||
+ void 0 === t ||
+ t.call(e),
+ this.cameraTokens.delete(i[0]));
+ }
+ cameraTokenReturn(e) {
+ if (
+ this._sequenceRecorder &&
+ this._sequenceRecordDeviceAttitudeMatrices &&
+ e.token >= this._sequenceRecorderFirstCameraToken
+ ) {
+ let t = this.cameraTokens.get(e.token);
+ t &&
+ (e.att && this._sequenceRecorder.appendAttitudeMatrix(e.att),
+ (t.data = e.d),
+ this._sequenceRecorder.appendCameraFrame(t));
+ }
+ this.cameraPixelArrays.push(e.d), this.tokensInFlight--;
+ }
+ sequenceRecordStart(e) {
+ this._sequenceRecorder || (this._sequenceRecorder = new Ue(e)),
+ this._sequenceRecorder.start(),
+ (this._sequenceRecorderFirstCameraToken = this.nextCameraToken);
+ }
+ sequenceRecordStop() {
+ var e;
+ null === (e = this._sequenceRecorder) || void 0 === e || e.stop();
+ }
+ sequenceRecordData() {
+ var e;
+ return (
+ (null === (e = this._sequenceRecorder) || void 0 === e
+ ? void 0
+ : e.data()) || new Uint8Array(0)
+ );
+ }
+ sequenceRecordClear() {
+ delete this._sequenceRecorder;
+ }
+ sequenceRecordDeviceAttitudeMatrices(e) {
+ this._sequenceRecordDeviceAttitudeMatrices = e;
+ }
+ getVideoTexture() {
+ return this.videoTextures.pop();
+ }
+ destroy() {
+ this._client.pipeline_destroy(this._impl), ot.delete(this._impl);
+ }
+ getCurrentCameraInfo() {
+ let e = this._client.pipeline_camera_frame_user_data(this._impl);
+ if (e) return this.cameraTokens.get(e);
+ }
+ cameraFrameDrawGL(e, t, r) {
+ if (!this.glContext) return;
+ let i = this.getCurrentCameraInfo();
+ i &&
+ (this._cameraDraw || (this._cameraDraw = new Ae(this.glContext)),
+ this._cameraDraw.drawCameraFrame(e, t, i, !0 === r));
+ }
+ glContextLost() {
+ this._cameraDraw && this._cameraDraw.dispose(),
+ this._faceDraw && this._faceDraw.dispose(),
+ this._imageTargetPreviewDraw &&
+ this._imageTargetPreviewDraw.dispose(),
+ this._faceProjectDraw && this._faceProjectDraw.dispose(),
+ delete this._cameraDraw,
+ delete this._faceDraw,
+ delete this._imageTargetPreviewDraw,
+ delete this._faceProjectDraw,
+ (f = void 0),
+ (h = void 0),
+ (p = void 0),
+ (m = {}),
+ this.onGLContextReset.emit();
+ for (let e of this.videoTextures)
+ this.glContext && this.glContext.deleteTexture(e);
+ this.videoTextures = [];
+ for (let e of this.cameraTokens)
+ this.glContext &&
+ e[1].texture &&
+ this.glContext.deleteTexture(e[1].texture),
+ (e[1].texture = void 0);
+ this.glContext = void 0;
+ }
+ glContextSet(e, t) {
+ this.glContextLost(), (this.glContext = e), (t = t || []);
+ for (let r = 0; r < 4; r++) {
+ let i = t[r] || e.createTexture();
+ i &&
+ (e.bindTexture(e.TEXTURE_2D, i),
+ 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.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.LINEAR),
+ this.videoTextures.push(i));
+ }
+ e.bindTexture(e.TEXTURE_2D, null);
+ }
+ drawFace(e, t, r, i) {
+ if (!this.glContext) return;
+ this._faceDraw || (this._faceDraw = new ke(this.glContext));
+ let a = A();
+ x(a, e, t), x(a, a, r), this._faceDraw.drawFace(a, i);
+ }
+ drawImageTargetPreview(e, t, r, i, a) {
+ if (!this.glContext) return;
+ this._imageTargetPreviewDraw ||
+ (this._imageTargetPreviewDraw = new it(this.glContext));
+ let n = A();
+ x(n, e, t), x(n, n, r), this._imageTargetPreviewDraw.draw(n, a, i);
+ }
+ drawFaceProject(e, t, r, i, a, n) {
+ this.glContext &&
+ (this._faceProjectDraw ||
+ (this._faceProjectDraw = new Me(this.glContext)),
+ this._faceProjectDraw.drawFace(e, t, r, i, a, n));
+ }
+ cameraFrameTexture() {
+ var e;
+ return null === (e = this.getCurrentCameraInfo()) || void 0 === e
+ ? void 0
+ : e.texture;
+ }
+ cameraFrameTextureMatrix(e, t, r) {
+ let i = this.getCurrentCameraInfo();
+ return i
+ ? Re(i.dataWidth, i.dataHeight, e, t, i.uvTransform || _t, r)
+ : A();
+ }
+ cameraFrameUserFacing() {
+ var e;
+ return (
+ (null === (e = this.getCurrentCameraInfo()) || void 0 === e
+ ? void 0
+ : e.userFacing) || !1
+ );
+ }
+ cameraPoseWithAttitude(e) {
+ let t = lt(
+ this.getCurrentCameraInfo(),
+ this._client.pipeline_camera_frame_camera_attitude(this._impl)
+ );
+ if (e) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(t, e, t), x(t, t, e);
+ }
+ return T(t, t), t;
+ }
+ videoFrameFromWorker(e) {
+ let t = this.nextCameraToken++;
+ const r = tt(e.source);
+ r &&
+ (this.cameraTokens.set(t, {
+ dataWidth: e.w,
+ dataHeight: e.h,
+ texture: void 0,
+ frame: e.d,
+ userFacing: e.userFacing,
+ uvTransform: e.uvTransform,
+ cameraModel: e.cameraModel,
+ cameraToDevice: e.cameraToDevice,
+ cameraSource: r,
+ }),
+ this.cleanOldFrames());
+ }
+ imageBitmapFromWorker(e) {
+ let t = this.cameraTokens.get(e.tokenId);
+ t &&
+ ((t.dataWidth = e.dataWidth),
+ (t.dataHeight = e.dataHeight),
+ (t.frame = e.frame),
+ (t.userFacing = e.userFacing),
+ (t.uvTransform = e.uvTransform),
+ this.tokensInFlight--,
+ this.cleanOldFrames());
+ }
+ uploadGL() {
+ var e, t;
+ let r = this.getCurrentCameraInfo();
+ null ===
+ (t =
+ null === (e = null == r ? void 0 : r.cameraSource) ||
+ void 0 === e
+ ? void 0
+ : e.uploadGL) ||
+ void 0 === t ||
+ t.call(e, r);
+ }
+ registerToken(e) {
+ let t = this.nextCameraToken++;
+ return this.cameraTokens.set(t, e), this.tokensInFlight++, t;
+ }
+ processGL() {
+ this.glContext
+ ? this.currentCameraSource &&
+ (this.tokensInFlight > 0
+ ? this.currentCameraSource.getFrame(!0)
+ : this.currentCameraSource.getFrame(!1))
+ : me(
+ "no GL context for camera frames - please call pipeline_gl_context_set"
+ );
+ }
+ motionAccelerometerSubmit(e, t, r, i) {
+ var a;
+ this._sequenceRecordDeviceAttitudeMatrices ||
+ null === (a = this._sequenceRecorder) ||
+ void 0 === a ||
+ a.appendAccelerometer(e, t, r, i),
+ this._client.pipeline_motion_accelerometer_submit(
+ this._impl,
+ e,
+ t,
+ r,
+ i
+ );
+ }
+ motionRotationRateSubmit(e, t, r, i) {
+ var a;
+ this._sequenceRecordDeviceAttitudeMatrices ||
+ null === (a = this._sequenceRecorder) ||
+ void 0 === a ||
+ a.appendRotationRate(e, t, r, i),
+ this._client.pipeline_motion_rotation_rate_submit(
+ this._impl,
+ e,
+ t,
+ r,
+ i
+ );
+ }
+ motionAttitudeSubmit(e, t, r, i) {
+ var a;
+ this._sequenceRecordDeviceAttitudeMatrices ||
+ null === (a = this._sequenceRecorder) ||
+ void 0 === a ||
+ a.appendAttitude(e, t, r, i),
+ this._client.pipeline_motion_attitude_submit(
+ this._impl,
+ e,
+ t,
+ r,
+ i
+ );
+ }
+ motionAttitudeMatrix(e) {
+ this._client.pipeline_motion_attitude_matrix_submit(this._impl, e);
+ }
+ sendCameraStreamToWorker(e, t, r) {
+ let i = {
+ t: "streamC2S",
+ p: this._impl,
+ s: t,
+ userFacing: r,
+ source: e,
+ };
+ this._mgr.postOutgoingMessage(i, [i.s]);
+ }
+ sendCameraToScreenRotationToWorker(e) {
+ let t = { p: this._impl, t: "cameraToScreenC2S", r: e };
+ this._mgr.postOutgoingMessage(t, []);
+ }
+ sendImageBitmapToWorker(e, t, r, i, a, n) {
+ let s = {
+ p: this._impl,
+ t: "imageBitmapC2S",
+ i: e,
+ r: t,
+ tokenId: i,
+ userFacing: r,
+ cameraModel: a,
+ cameraToDevice: n,
+ };
+ this._mgr.postOutgoingMessage(s, [e]);
+ }
+ sendDataToWorker(e, t, r, i, a, n, s) {
+ let o = {
+ d: e,
+ p: this._impl,
+ width: r,
+ height: i,
+ token: t,
+ userFacing: a,
+ c2d: n,
+ cm: s,
+ t: "cameraFrameC2S",
+ };
+ this._mgr.postOutgoingMessage(o, [e]);
+ }
+ }
+ function lt(e, t) {
+ let r = !1;
+ r = !!e && e.userFacing;
+ let i = A();
+ return F(i, (N(r) * Math.PI) / 180, [0, 0, 1]), x(i, i, t), i;
+ }
+ const ut = {
+ 0: [
+ {
+ mean: [0.235, 0.2344, 0.7305],
+ identity: [
+ 0.008, 0.0087, 0.0024, -0.0026, 6e-4, -0.0022, 5e-4, 0.0033,
+ 0.0026, 0.0017, -0.0055, -8e-4, 0.0011, 0.0059, 0, 2e-4, 0.001,
+ -0.001, -0.0044, -0.0011, -1e-4, 0.0024, 0.0019, -9e-4, 4e-4,
+ -0.0015, 0, 0.0038, 0.0013, 3e-4, 0.002, -0.0021, 0.0018,
+ 0.0023, 0.0011, 0.0012, -0.0011, -0.0017, 9e-4, -0.0012, -8e-4,
+ 7e-4, -0.0017, 0.0029, -0.0029, 8e-4, -0.0027, 8e-4, -0.0017,
+ 4e-4, 9e-4, -0.001, -3e-4, 8e-4, -0.0016, -3e-4, -7e-4, 0.0016,
+ -9e-4, 0.0021, -5e-4, 0.0011, -0.0024, -1e-4, 6e-4, 1e-4,
+ -0.0026, -4e-4, -3e-4, -9e-4, 5e-4, 3e-4, -8e-4, -0.001, -4e-4,
+ -8e-4, 0.0022, -0.0014, -1e-4, -0.0023, 0, -0.0018, 7e-4,
+ -0.0036, 0.0017, 0.0017, -0.0018, -2e-4, -4e-4, -9e-4, -8e-4,
+ 3e-4, 0.0012, 9e-4, -4e-4, -0.0016, 5e-4, -0.0013, 0.0011,
+ 0.0023, 0.0029, 0.0024, 0.0017, -0.0027, -4e-4, -0.001, -0.0018,
+ -0.0015, -0.001, 0.001, -0.0013, -1e-4, -2e-4, 7e-4, 3e-4, 3e-4,
+ -0.0016, 9e-4, -0.0021, 4e-4, 0.0014, 0.002, -7e-4, -4e-4, 2e-4,
+ -4e-4, -6e-4, -9e-4, 0.0015, 4e-4, -4e-4, 5e-4, -0.0015, 9e-4,
+ 3e-4, 3e-4, -2e-4, -8e-4, -9e-4, 0.0023, 4e-4, 1e-4, -4e-4,
+ -1e-4, 7e-4, 2e-4, 0.001, 1e-4, -0.0029, -5e-4,
+ ],
+ expression: [
+ 0, 3e-4, 0.0052, -7e-4, -0.0051, -0.0103, 0, 0.0019, 0.0027,
+ -0.0054, 0.0135, 0.035, -5e-4, -6e-4, 0.0025, -0.0045, -0.0557,
+ -0.003, -0.0191, -0.1199, 0.0548, -0.0036, -0.0682, -0.0167,
+ 2e-4, -0.0085, -0.0085, 0.0044, 0.0041, -0.0568, 0.0044, 0.179,
+ 0.0065, -0.0017, -0.1006, 0.0036, -0.0267, -0.3279, 0.0301,
+ -0.0011, -0.0173, -0.001, 0.0046, 0.2808, 0.0207, 0.0162, 0.238,
+ -0.0225, 0.0017, 0.1041, 0.0203, 5e-4, 0.0161, 0.0031, -0.0436,
+ 0.6504, 0.0873, -0.0099, 0.1039, 0.0048, -0.0254, 0.2534,
+ -0.0042, 0.003, -0.0106, -0.0153, -0.0118, 0.0252, 9e-4,
+ -0.0071, 0.0099, 0.007, -0.0724, 0.0461, -0.0235, 0.0833, 0.004,
+ 0.0141, -0.0219, 0.0132, -0.0042, -0.0179, 0.0045, -0.0215,
+ 0.3638, 0.0054, -0.0445,
+ ],
+ },
+ {
+ mean: [0.2358, 0.1466, 0.7183],
+ identity: [
+ 0.0077, 0.0093, 1e-4, -0.0022, 0, -0.0041, 5e-4, 0.0022, 0.0028,
+ 0.0018, -0.0038, -0.0013, 0.001, 0.0044, -2e-4, 0, 0.0017,
+ -0.0016, -0.0043, -2e-4, -1e-4, 0.0023, 9e-4, 5e-4, -7e-4,
+ -4e-4, -0.0017, 0.003, 7e-4, 6e-4, 0.0011, -0.0018, 5e-4,
+ 0.0018, -8e-4, 4e-4, -0.0023, -6e-4, -3e-4, -0.0015, -0.0014,
+ -1e-4, -0.0018, 0.0027, -0.0026, 3e-4, -0.0031, 0.0011, -0.0026,
+ -0.0011, 0.0012, -0.0013, -2e-4, 7e-4, -0.0021, 0.0021, 4e-4,
+ 0.0012, -0.001, 0.002, -3e-4, 2e-4, -0.0026, -3e-4, 0.001, 1e-4,
+ -0.0018, -0.001, 9e-4, -0.0011, 0.001, 4e-4, -8e-4, -7e-4,
+ -0.001, -3e-4, 7e-4, -5e-4, -6e-4, -0.0019, -5e-4, -0.002, 7e-4,
+ -0.0027, 0.0014, 0.0013, 6e-4, -5e-4, -3e-4, -3e-4, -0.001, 0,
+ 0.0019, 1e-4, 6e-4, -0.0012, 4e-4, -9e-4, 4e-4, 0.0025, 3e-4,
+ 0.0024, 0.0017, -9e-4, -0.0015, -0.0015, -0.001, -0.0023,
+ -0.001, -5e-4, -4e-4, 8e-4, 9e-4, 7e-4, 2e-4, 7e-4, -9e-4, 9e-4,
+ -0.0013, 1e-4, 9e-4, 2e-4, 6e-4, -6e-4, -8e-4, -4e-4, -7e-4,
+ 8e-4, 0.0019, 3e-4, 0.0015, 2e-4, -0.0015, -3e-4, 0, 6e-4, 3e-4,
+ 6e-4, -6e-4, 2e-4, 5e-4, -4e-4, 0.0012, -4e-4, 2e-4, -8e-4,
+ 6e-4, -4e-4, 2e-4, -0.0021,
+ ],
+ expression: [
+ -0.0034, 0.0054, 0.0069, 0.004, 6e-4, -0.0104, -3e-4, 0.0036,
+ 0.0025, 0.0065, 0.0296, 0.0208, -9e-4, 0.0154, 0.0029, -0.0167,
+ 0.0124, 0.004, -0.0102, 0.0351, 0.028, -0.019, 0.0146, -0.0035,
+ -0.0023, -0.0069, -0.0051, -0.01, 0.0262, -0.028, 0.0112, 0.082,
+ 0.023, -0.0019, -0.066, -0.0104, -0.0408, 0.0164, 0.0075,
+ -0.0074, 0.0367, 0.0041, 0.0517, -0.0207, 0.0045, 0.0291,
+ -0.0672, -0.0129, 0.0345, -0.1558, -0.0106, 0.0037, -0.0437,
+ -0.0021, 0.0854, -0.1121, 0.0187, 0.0041, 0.0072, 0.0011,
+ 0.0193, -0.0143, -0.0119, 0.005, -0.02, -0.0122, -0.008, 0.0527,
+ 0.0036, -0.006, 0.0222, 0.007, -0.0429, 0.046, -0.0046, 0.0226,
+ -0.0059, 0.0202, -0.0173, 0.0087, 0, -0.0067, -0.0095, -0.0153,
+ 0.1506, -0.0017, 0.0021,
+ ],
+ },
+ ],
+ 1: [
+ {
+ mean: [-0.2271, 0.2323, 0.7319],
+ identity: [
+ -0.0084, 0.0097, 0.0018, 0.0041, 2e-4, -0.002, -0.0012, 0.0036,
+ 0.0019, -9e-4, -0.0063, -0.001, -3e-4, 0.0053, 6e-4, 1e-4, 5e-4,
+ -0.0015, 0.0044, -0.0025, -0.0015, -0.002, 0.0016, -6e-4, 2e-4,
+ -0.0013, 0, -0.0022, 2e-4, 2e-4, -0.0025, -0.0014, 0.0015, 8e-4,
+ 2e-4, 0.0012, 6e-4, -6e-4, 0.0017, 0, 3e-4, -1e-4, 0.0024,
+ 0.0025, -0.0029, -0.0015, -0.0015, 1e-4, 0.0031, -0.0016, 7e-4,
+ 0.0019, 6e-4, 0.002, 9e-4, 0.001, -0.0014, -0.002, -0.0015,
+ 0.0029, 1e-4, 5e-4, -0.0023, 8e-4, -0.0011, 0.0019, 0.0017,
+ -3e-4, -0.0011, -3e-4, 0.0011, -8e-4, 0.0019, -0.0022, 1e-4,
+ 0.0015, 0.0017, -8e-4, -0.0011, -0.0022, 3e-4, 0.0022, 6e-4,
+ -0.003, -2e-4, 0, -0.0017, -2e-4, 0, 1e-4, 4e-4, 0.0012, 0.0019,
+ -0.0014, 4e-4, -0.0017, -0.0012, -0.0011, 0.0021, -0.0029,
+ 0.0026, 0.0018, -0.0023, -0.0029, 1e-4, 0.0014, -0.0019, -4e-4,
+ -4e-4, 0.0023, -0.0016, 0, -9e-4, 0.0014, -0.0015, 0.0015,
+ -0.0016, -0.0011, -0.0022, 1e-4, -0.0018, 0.0027, -0.0013, 4e-4,
+ -1e-4, -5e-4, 0.0011, -2e-4, 0.0015, 5e-4, -9e-4, -1e-4, 0.0029,
+ 6e-4, 0, -3e-4, 7e-4, -8e-4, -5e-4, 0.0025, 3e-4, 2e-4, -8e-4,
+ -1e-4, 3e-4, 0, 0.0014, 2e-4, -0.0024, 1e-4,
+ ],
+ expression: [
+ -0.0025, -9e-4, 0.006, 0.004, -0.0027, -0.0113, -8e-4, 0.001,
+ 0.0031, -0.0016, 0.0144, 0.0382, -3e-4, -5e-4, 0.0035, -0.0044,
+ -0.0511, -0.0014, -7e-4, -0.1007, 0.0582, -6e-4, -0.0606,
+ -0.0165, 5e-4, -0.0087, -0.0093, 0.0036, 0.0057, -0.0576,
+ -0.0039, 0.1488, 0.0127, 0.0016, -0.0666, -9e-4, -0.0153,
+ 0.3162, -0.0445, -0.0021, 0.0023, 0.0043, -0.0033, 0.2382,
+ 0.0063, -0.0217, 0.167, -0.039, 0.0097, -0.1144, -0.0189,
+ -0.0145, 0.6831, 0.0632, -0.0012, -0.1959, -0.0133, 4e-4,
+ 0.1108, -3e-4, 0.0062, 0.2593, -0.0161, -0.0018, -0.0051,
+ -0.012, 0.0162, 0.016, -0.0022, -0.0052, -0.0201, 0.0101,
+ 0.0115, 0.0365, -0.024, -0.0059, 0.0188, -0.0336, 0.0352,
+ 0.0224, -0.0229, 0.0146, 0.0086, -0.0273, -0.0032, 0.0103,
+ -0.0112,
+ ],
+ },
+ {
+ mean: [-0.2288, 0.1541, 0.7202],
+ identity: [
+ -0.0082, 0.0101, 2e-4, 0.0036, -7e-4, -0.0037, -8e-4, 0.0024,
+ 0.0022, -0.0013, -0.0045, -0.0013, -6e-4, 0.0045, -4e-4, 4e-4,
+ 0.0012, -0.0014, 0.0042, -0.001, -7e-4, -0.0019, 3e-4, -2e-4,
+ 0.0012, -4e-4, -0.0012, -0.0018, -4e-4, -1e-4, -0.0014, -0.0012,
+ 1e-4, 1e-4, -0.0017, 0.001, 0.0015, -1e-4, 6e-4, 1e-4, 0, -6e-4,
+ 0.0028, 0.0021, -0.0025, -0.002, -0.0015, 7e-4, 0.0028, -0.0023,
+ 9e-4, 0.0013, 1e-4, 0.0016, 0.0012, 0.0032, -6e-4, -0.0013,
+ -0.0011, 0.0021, 3e-4, -5e-4, -0.0024, 4e-4, -4e-4, 0.0014,
+ 0.0015, -8e-4, -3e-4, 3e-4, 0.0017, -6e-4, 0.002, -0.0018,
+ -3e-4, 9e-4, 1e-4, 2e-4, -6e-4, -0.0015, -4e-4, 0.0022, 7e-4,
+ -0.0023, 0, -2e-4, -2e-4, -3e-4, -1e-4, 6e-4, -2e-4, 6e-4,
+ 0.0022, -3e-4, 0.0013, -0.0014, -5e-4, -3e-4, 0.0013, -0.0027,
+ 6e-4, 0.0025, -0.0023, -8e-4, -0.0013, 0.0017, -9e-4, -0.0019,
+ 1e-4, 8e-4, -7e-4, -4e-4, 0, 0.001, -0.001, 0.0019, -8e-4,
+ -0.0015, -6e-4, -2e-4, -0.0011, 8e-4, 1e-4, 9e-4, -8e-4, -4e-4,
+ 6e-4, 7e-4, 0.0021, -4e-4, 7e-4, -5e-4, 0.0021, -7e-4, -4e-4,
+ -9e-4, 8e-4, 3e-4, 1e-4, 3e-4, 1e-4, 9e-4, 0.001, -5e-4, 5e-4,
+ -0.001, 0.001, 4e-4, -5e-4, -0.0012,
+ ],
+ expression: [
+ 8e-4, 0.0037, 0.0078, -4e-4, 5e-4, -0.012, -2e-4, -0.0046,
+ 0.0033, -0.0089, 0.0295, 0.0221, -0.0024, -0.0084, 0.0013,
+ 0.0057, 0.0125, 0.0049, -0.0036, 0.0373, 0.0285, 0.0115, 0.0135,
+ -0.0035, 0.0048, 0.0108, -0.0033, 0.0106, 0.0281, -0.0301,
+ -0.0082, 0.0803, 0.0244, -7e-4, -0.0725, -0.0105, -0.0247,
+ -0.0036, -0.0143, -0.0045, -0.029, 2e-4, -0.0303, 0.0093,
+ -0.0021, -0.0196, -0.0754, -0.0211, 0.0326, 0.1246, 0.006,
+ -0.0804, -0.1499, 0.0109, 0.0182, -0.0029, -0.0014, -0.0035,
+ 0.0072, -8e-4, -0.0152, -0.0108, -0.0166, -0.0073, -0.0144,
+ -0.0095, 0.0101, 0.047, -0.0018, -0.004, -0.0189, 0.0027,
+ 0.0104, 0.0298, -0.0042, -0.0096, 0.0191, -0.0217, 0.0228,
+ 0.0226, -0.0105, 0.0047, -0.0048, -0.0172, 0.0061, -0.0043,
+ -0.0016,
+ ],
+ },
+ ],
+ 2: {
+ mean: [0.5396, 0.2028, 0.2496],
+ identity: [
+ 0.0204, 0.0146, -0.0182, -0.0052, 0.0158, -0.0038, -0.0025,
+ -0.0108, -0.006, 0.0085, -0.0044, 0.0029, 0.0042, 0.001, 0.0095,
+ 0.0015, -0.0034, -0.0064, -0.0057, 7e-4, 0.0026, 7e-4, 0.0037,
+ -6e-4, 0.0037, 0.0026, 0.0024, 5e-4, -0.0019, -0.0013, 0.003,
+ -0.0028, 0.0018, -9e-4, 0.002, -0.0047, 0.004, -0.003, 0.0031,
+ -0.0027, -0.0026, -0.0017, 0.0016, 0.0014, -4e-4, 0.0021, -0.002,
+ 0, 0.0017, 7e-4, -4e-4, -7e-4, -0.0018, -9e-4, 2e-4, -0.0012,
+ 1e-4, -5e-4, -0.0011, 4e-4, 2e-4, 0.0011, 1e-4, 8e-4, 0.0017,
+ -0.0013, 0.0025, 0.0017, 0.001, 2e-4, 3e-4, 5e-4, -4e-4, -1e-4,
+ -5e-4, 7e-4, -0.0022, -0.0029, 6e-4, -8e-4, -6e-4, 6e-4, -5e-4,
+ 5e-4, 0.0013, 3e-4, -5e-4, -0.003, 7e-4, 2e-4, 0.0016, -4e-4, 0,
+ 0, 4e-4, 1e-4, 0.0014, 0.0012, 1e-4, 4e-4, -1e-4, 8e-4, 9e-4,
+ 4e-4, -4e-4, 9e-4, -2e-4, 0.001, 9e-4, 4e-4, 1e-4, 7e-4, 7e-4,
+ 0.001, -0.0017, -8e-4, 2e-4, 0.0017, -3e-4, -1e-4, 4e-4, 5e-4,
+ 7e-4, 5e-4, -1e-4, -6e-4, -1e-4, 1e-4, -3e-4, -7e-4, -2e-4, -5e-4,
+ 0, -3e-4, 3e-4, 8e-4, -2e-4, -3e-4, 5e-4, 1e-4, -7e-4, -0.001,
+ -2e-4, 3e-4, 4e-4, -1e-4, 7e-4, 0, 4e-4, 4e-4,
+ ],
+ expression: [
+ 1e-4, -4e-4, 1e-4, 0, 5e-4, 2e-4, 0, 0, 3e-4, -2e-4, 3e-4, 5e-4,
+ -1e-4, 2e-4, 8e-4, 1e-4, -2e-4, -5e-4, -3e-4, 6e-4, 5e-4, 0, 1e-4,
+ 2e-4, 1e-4, -1e-4, -6e-4, -2e-4, 5e-4, 0, -4e-4, 4e-4, 0.0016,
+ 4e-4, -4e-4, -0.0015, 0, 1e-4, 1e-4, -3e-4, 3e-4, 0.0019, -2e-4,
+ 7e-4, 4e-4, 4e-4, -8e-4, -0.0015, 0.0013, -0.0016, -0.0069, 4e-4,
+ -6e-4, -0.0019, 0, -1e-4, 5e-4, -3e-4, 2e-4, 0.0014, -3e-4, 6e-4,
+ 0.0011, 4e-4, -3e-4, -0.0032, -6e-4, 8e-4, 0.0025, -3e-4, 3e-4,
+ 0.0015, -1e-4, 1e-4, 3e-4, -1e-4, 0, 0, -3e-4, 4e-4, 0.0019, 1e-4,
+ 0, -8e-4, -1e-4, 1e-4, 5e-4,
+ ],
+ },
+ 3: {
+ mean: [-0.5464, 0.2141, 0.26],
+ identity: [
+ -0.0207, 0.0172, -0.0176, 0.0068, 0.0148, -0.0051, 0.0042,
+ -0.0101, -0.0058, -0.0087, -0.0059, 0.0045, -0.0056, 0.0017,
+ 0.0097, -0.0048, -0.004, -0.0044, 0.0019, 2e-4, 0.0041, -0.0052,
+ 0.0041, 2e-4, -0.0027, 6e-4, 0.002, -0.0027, -0.0033, -6e-4,
+ -0.004, 9e-4, -0.0012, -1e-4, -0.0026, 0.0021, -0.003, -0.0025,
+ 0.0052, 0.0025, 0.0022, -1e-4, -8e-4, 0.0013, 0.001, 4e-4, 0.0018,
+ 0.0014, 6e-4, -5e-4, -0.0015, -0.0039, 0.0014, -1e-4, 8e-4, -2e-4,
+ 6e-4, -5e-4, -0.0038, -0.0012, -0.0018, -3e-4, 0.001, 9e-4,
+ 0.0012, 0.0024, -0.0024, -7e-4, -0.0016, -0.0016, 3e-4, -0.001,
+ -0.0014, -0.0014, 0.001, -3e-4, -7e-4, -0.0012, 3e-4, 6e-4, 3e-4,
+ -5e-4, 3e-4, 0.0012, 6e-4, -8e-4, 4e-4, 4e-4, 8e-4, -2e-4,
+ -0.0014, 3e-4, 0, 0.0023, -3e-4, -0.0012, -0.0013, 0.0011, -2e-4,
+ -0.0014, -1e-4, 0.0014, 0, 3e-4, 3e-4, -8e-4, -5e-4, -7e-4, -7e-4,
+ -2e-4, 3e-4, 5e-4, 2e-4, -1e-4, 0.0011, -0.0014, 1e-4, -0.0015,
+ -1e-4, -3e-4, 0, -0.001, -1e-4, -8e-4, 8e-4, -8e-4, -2e-4,
+ -0.0011, -3e-4, -4e-4, 1e-4, -2e-4, 3e-4, -7e-4, 0, 3e-4, 1e-4,
+ -8e-4, 5e-4, 1e-4, 4e-4, 0.0014, -6e-4, -0.001, -3e-4, -2e-4,
+ 1e-4, -1e-4, -1e-4, 7e-4,
+ ],
+ expression: [
+ -3e-4, -1e-4, 6e-4, 4e-4, 0, -7e-4, 0, -3e-4, -2e-4, -4e-4,
+ 0.0012, 8e-4, 1e-4, -5e-4, -7e-4, -4e-4, 0, 1e-4, -4e-4, 0.0017,
+ 7e-4, 0, 1e-4, 3e-4, 0, 4e-4, 4e-4, 5e-4, 1e-4, -0.001, -7e-4,
+ 0.0022, 0.0026, 5e-4, -0.0024, -0.0023, 0, 1e-4, 3e-4, 0, -0.0013,
+ -0.0015, 6e-4, 0.0014, 8e-4, -2e-4, -0.0025, -0.0023, -3e-4,
+ 0.0049, 0.006, -2e-4, -7e-4, -2e-4, 0, -0.0019, -0.0018, -2e-4,
+ 0.0017, 0.0017, 3e-4, 0.0015, 7e-4, 1e-4, -0.0023, -0.0036, 2e-4,
+ 0.0023, 0.0017, 0, -5e-4, -3e-4, -3e-4, 4e-4, 2e-4, -1e-4, -3e-4,
+ -5e-4, 1e-4, 0.0018, 0.0025, 1e-4, -6e-4, -0.0011, 0, 1e-4, 1e-4,
+ ],
+ },
+ 4: {
+ mean: [0.0018, 0.1864, 0.853],
+ identity: [
+ -0.0011, 0.0134, 0.0085, 9e-4, -0.0025, -7e-4, -3e-4, 0.0033,
+ 4e-4, -5e-4, -0.0047, -0.002, 7e-4, 0.0026, -0.0069, -1e-4,
+ 0.0036, 0.0072, 5e-4, -8e-4, -0.0047, 4e-4, -8e-4, -0.001, 0,
+ 2e-4, -0.0036, -2e-4, -0.001, -0.0048, -1e-4, 0.0018, 0.0044,
+ -7e-4, -2e-4, 0.0043, 3e-4, 0.002, -0.0031, 0, -7e-4, 0.0013, 0,
+ 0.0037, 0.0033, -0.0016, -0.0012, 0.002, -1e-4, -0.0027, 0.0051,
+ 5e-4, 8e-4, 7e-4, -0.0017, 0.0054, 0.0023, -3e-4, 0.0032, 1e-4, 0,
+ 7e-4, -5e-4, -0.0011, 2e-4, 8e-4, 0, -0.0033, -8e-4, -7e-4, 7e-4,
+ 0.0033, 5e-4, -3e-4, 0.0029, -1e-4, -0.0024, -0.0011, -0.002,
+ -0.0015, -0.0019, 2e-4, 7e-4, 0.0031, 6e-4, 0.0012, 0, 0, -0.0021,
+ 0, -9e-4, -0.0011, -0.0011, -2e-4, 0.0015, 0.001, 0.0013, 8e-4,
+ 0.001, -3e-4, 9e-4, 0.0027, -2e-4, -0.0011, -0.0011, 6e-4, 7e-4,
+ 2e-4, 1e-4, -5e-4, -0.0022, 0.0011, -0.0014, 9e-4, 3e-4, 2e-4, 0,
+ -6e-4, -4e-4, -0.0011, -7e-4, 0.001, -0.0012, 6e-4, -0.0012,
+ -0.0015, 3e-4, -9e-4, -0.0013, -0.0013, 7e-4, 0.001, -0.0011,
+ -0.0013, 0.0015, 4e-4, 1e-4, 4e-4, -1e-4, -0.0016, -0.0016, 9e-4,
+ -7e-4, -0.0024, 5e-4, -1e-4, -0.0017, -2e-4, 3e-4, -9e-4,
+ ],
+ expression: [
+ -0.0017, 0.0019, 0.0097, 0.003, -0.0103, -0.0093, 9e-4, 6e-4,
+ 0.0023, -0.0017, -0.0204, 0.0376, 0.0033, -0.0034, 0.0033,
+ -0.0026, -0.0322, 0.0396, -0.0032, -0.0947, 0.0942, -7e-4,
+ -0.0175, 0.0266, -0.001, -6e-4, 0.0016, 0.0025, 0.0157, -0.0142,
+ -0.0022, 0.037, 0.015, 0.0021, -0.0102, -0.0107, 0.0036, 0.0055,
+ -0.0051, 0.0021, 3e-4, -3e-4, 4e-4, -0.0177, 0.0074, -6e-4,
+ -0.0357, 0.0149, -0.0066, 9e-4, 0.0013, -0.0031, 0.0016, 0.0095,
+ 0.002, 0.0052, 0.0035, -3e-4, 0.0053, -0.0082, 0.002, 0.0022,
+ -0.0071, -0.0011, 5e-4, 0.0055, 0.0011, 3e-4, -0.0126, -4e-4,
+ 3e-4, -0.0023, -0.0015, 0.0059, 0.0063, -0.0042, -0.0023, 0.0055,
+ 0.0019, 0.0017, -0.0075, 6e-4, -8e-4, 0.0018, 0.0012, 0.0012,
+ -5e-4,
+ ],
+ },
+ 5: {
+ mean: [-0.002, -0.0469, 1.0039],
+ identity: [
+ -0.0017, 0.0018, 0.0156, 6e-4, -0.0038, 5e-4, 4e-4, 0.0013, 0.002,
+ -4e-4, -0.0015, -0.0051, 5e-4, -7e-4, -0.0055, -1e-4, -9e-4,
+ 0.008, -2e-4, 0.0036, -0.0053, 4e-4, -0.0026, -0.0016, 7e-4, 9e-4,
+ -0.009, -3e-4, 7e-4, -0.0084, 0.0015, 0.0021, 0.0032, -0.0015,
+ 0.0018, 0.0046, -3e-4, -4e-4, -1e-4, 8e-4, -0.0044, -7e-4, -8e-4,
+ 7e-4, 0.0048, -0.0024, -3e-4, 0.0024, 2e-4, -0.0051, 0.0058,
+ -6e-4, 0.0028, 0.0018, -0.0021, 0.0035, 0.0057, 0.0011, 0.0065, 0,
+ -2e-4, 0.0011, 0.003, -0.0027, 8e-4, 7e-4, 3e-4, -0.0039, -0.002,
+ -2e-4, -0.0015, 0.0034, 0.0012, -0.0025, 0.0024, -2e-4, 4e-4,
+ -0.0042, -0.0024, -0.001, -0.0023, 0.0016, -7e-4, 0.0039, 1e-4,
+ -5e-4, 0.0018, 3e-4, -2e-4, -9e-4, -0.0015, 3e-4, -7e-4, -1e-4,
+ -2e-4, 0.0023, 0.0032, 0.002, -0.0013, 0.0013, -0.0038, 0.0045,
+ 1e-4, -0.0031, 1e-4, 0.0019, -1e-4, 0.0016, 0.0013, 0, -0.002,
+ 0.0023, 2e-4, 0.0011, 0.0018, -0.0024, 6e-4, -0.0017, 0.002,
+ -8e-4, -0.0021, 7e-4, 0.0011, 8e-4, 4e-4, -0.001, 0.0012, 2e-4,
+ -6e-4, -0.0027, -5e-4, 0.001, -9e-4, 1e-4, -1e-4, 8e-4, -0.0011,
+ 0.0022, -0.001, -5e-4, -0.0011, 0.0016, -0.0015, 8e-4, -3e-4,
+ 9e-4, 0.0013, -7e-4, -7e-4, -2e-4,
+ ],
+ expression: [
+ -0.0018, -0.0168, 0.0088, 0.0389, 0.1026, 0.0414, 0.2201, -0.0262,
+ -0.0016, -0.0017, 0.0612, -0.0298, -0.0323, 0.0093, 0.0013,
+ -0.005, 0.2207, 0.1315, -4e-4, 0.0858, -0.0303, -0.0133, 0.015,
+ -0.008, 0.1454, 0.0114, 0.0177, -0.0077, 0.1022, 0.0356, -0.0023,
+ 0.1088, 0.0232, 0.003, -0.0706, 0.0347, -1e-4, 0.004, -0.0011,
+ 0.0397, -0.0096, -0.0033, 0.0029, -0.01, -0.0083, -6e-4, -0.0135,
+ 0.0016, -0.0087, -0.0019, 0.0022, -0.004, -0.0087, 0.0105, 8e-4,
+ -0.005, 0.0069, 0.0028, 0.0409, -0.0391, 0.003, 0.0103, 0.0051,
+ 0.0026, 0.0776, -0.0083, -0.0062, -0.0567, 0.0268, 0.0175, 0.0017,
+ 0.0156, -0.0043, 0.0299, -0.0395, -0.0015, 0.0051, -0.0148,
+ 0.0125, 0.0035, 0.0603, 0.0109, -0.0645, -0.0257, 0.002, 6e-4,
+ -8e-4,
+ ],
+ },
+ 6: {
+ mean: [-6e-4, -0.1542, 0.8789],
+ identity: [
+ -7e-4, -0.0032, 0.01, 0, -0.0027, 0.0031, 6e-4, 5e-4, -6e-4,
+ -3e-4, 0.0013, -0.0049, -2e-4, -0.002, -0.0046, 8e-4, -0.0011,
+ 0.0054, 2e-4, 0.0043, -0.0027, 3e-4, -0.0022, -0.0019, 8e-4,
+ 0.0032, -0.0069, 0, 4e-4, -0.0071, 0.0016, 0.0027, 0.0039,
+ -0.0017, 9e-4, 0.0031, -1e-4, -5e-4, -4e-4, 7e-4, -0.0026,
+ -0.0012, -5e-4, 6e-4, 2e-4, -0.0014, -0.0013, 0.0019, -2e-4,
+ -0.0053, 0.0031, -6e-4, 0.0016, 0.0023, -0.0013, 0.0021, 0.0029,
+ 8e-4, 0.0052, 0, 4e-4, 0, 0.0037, -0.0026, 3e-4, 0.002, -2e-4,
+ -0.0024, 4e-4, -4e-4, -0.0012, 8e-4, 7e-4, -0.0023, 5e-4, 0,
+ 0.0014, -0.0022, -0.0016, 0, -0.0012, 8e-4, -7e-4, 0.0014, -6e-4,
+ -0.0012, -3e-4, 2e-4, 0.0012, -3e-4, -0.002, -1e-4, 1e-4, -2e-4,
+ -0.0016, 9e-4, 0.002, 0.0019, 0, 6e-4, -0.0022, 0.0016, 1e-4,
+ -0.0017, -0.0013, 0.001, 9e-4, -1e-4, 0.0011, 3e-4, -7e-4, 0.0014,
+ 8e-4, 0.0013, 0.0011, -0.002, 0, -0.0015, 0.0014, 0.001, -0.0015,
+ 7e-4, 3e-4, 0.001, -1e-4, 0.0012, 7e-4, 6e-4, -4e-4, -0.0013,
+ -0.0012, -9e-4, -0.0011, 2e-4, -5e-4, 5e-4, 4e-4, 2e-4, 1e-4, 0,
+ 5e-4, 5e-4, -0.0014, 0.0015, -9e-4, 5e-4, 0.0014, -8e-4, -8e-4,
+ 0.0012,
+ ],
+ expression: [
+ 8e-4, 0.0481, 0.1653, 0.0784, 0.1008, -0.3992, 0.5088, -0.02,
+ 0.0542, 0.001, 0.3723, -0.0151, -0.0986, 0.0283, -0.0033, -0.0121,
+ 0.2634, 0.1202, 0.0036, -0.0529, -0.0245, -0.0297, -0.1085,
+ 0.0495, 0.3264, 0.0083, 4e-4, -0.0314, 0.1459, -0.1142, -0.003,
+ 1e-4, 0.1154, -0.0035, -0.0285, -0.0184, -1e-4, 0.0012, 0.0035,
+ 0.079, -0.0103, 0.0043, 0.011, -0.004, -0.0774, -0.0047, -0.023,
+ 0.0284, -0.0048, -0.001, 0.0149, -0.0039, 0.0046, 0.0528, -6e-4,
+ 0.0063, 0.0376, 0.0096, 0.0558, -0.0295, 0, -0.0311, -0.0634,
+ 0.0062, 0.0176, -0.0154, -0.0109, -0.1149, 0.0192, 0.0326, 0.0121,
+ 0.0237, 0.0034, 0.0262, -0.0778, 0.0014, -0.0045, -0.0203, 0.0077,
+ 0.0588, 0.0575, 0.008, -0.0557, -0.0095, 0.0032, 0.0054, -0.0042,
+ ],
+ },
+ 7: {
+ mean: [0.0038, -0.2927, 0.833],
+ identity: [
+ 6e-4, -0.0109, 0.0073, -6e-4, -0.0044, 0.0017, -1e-4, -0.0022,
+ -6e-4, -3e-4, 0.0065, -0.0014, -6e-4, -0.0051, -0.0046, 3e-4,
+ -0.0029, 0.003, 2e-4, 0.0038, -6e-4, 0, -0.0012, 6e-4, -4e-4,
+ 0.0053, -0.0075, -2e-4, -7e-4, -0.0063, 0.0014, 0.0026, 0.0019,
+ -0.0022, 0.0018, 0.0028, -1e-4, -0.0012, 0.0011, 9e-4, 0.0019,
+ -0.0019, -1e-4, 0.0012, -0.0022, -3e-4, -0.0012, 4e-4, -8e-4,
+ 3e-4, -3e-4, 0, 0.0017, 0.0021, -4e-4, 0.0012, 0.0022, -3e-4,
+ 0.0026, -3e-4, 4e-4, -0.0026, 0.0032, -0.0019, 3e-4, 0.0015, 1e-4,
+ -0.0015, 0.0013, -1e-4, 1e-4, -0.0029, 0, -2e-4, -0.0028, -7e-4,
+ 0.0019, -3e-4, -2e-4, 0.0012, 9e-4, 4e-4, -0.001, -0.002, -0.0016,
+ 0.0011, -1e-4, 3e-4, 0.0021, 2e-4, -0.0014, -9e-4, -1e-4, 0,
+ -2e-4, -0.001, 0.0015, 0.0018, 1e-4, 7e-4, 8e-4, 0.0017, 0.001,
+ -9e-4, 1e-4, 4e-4, 0.0023, -1e-4, 0.0012, 1e-4, -8e-4, 2e-4,
+ 0.0018, 6e-4, 3e-4, 1e-4, 0.0012, -3e-4, 0.002, -6e-4, 0, -1e-4,
+ -0.0022, 4e-4, 5e-4, 0.0011, 2e-4, -0.0013, -0.0023, 6e-4, 6e-4,
+ -5e-4, -5e-4, 9e-4, 2e-4, 2e-4, 0.0011, -3e-4, 0.0011, 0.0015,
+ 0.0011, 3e-4, 2e-4, 8e-4, -4e-4, -8e-4, 3e-4, 0, 0.0012, -1e-4,
+ ],
+ expression: [
+ 0.026, 0.1107, 0.3257, 0.1917, 0.3206, -1.1348, 1.0791, -0.035,
+ 0.1549, -0.0103, 0.6953, 1e-4, -0.3262, 0.068, 0.0219, -0.0044,
+ 0.3643, 0.2178, 0.0168, -0.2478, -0.1321, -0.0414, -0.3782,
+ -0.0617, 0.5088, -0.0031, -0.0311, -0.0497, 0.0948, -0.385,
+ 0.0148, -0.2224, -0.1415, -0.0074, 0.0863, -0.203, 3e-4, -0.0081,
+ 0.0057, 0.1164, -0.0039, 0.0015, -0.0024, 0.0505, 0.1532, 0.0039,
+ -0.0148, -0.0753, 0.0163, 0.0058, -0.0339, 0.0036, 0.0252,
+ -0.0569, -0.0041, 0.0163, -0.0361, 0.0035, -0.018, 0.1266, 0,
+ -0.0163, -0.0046, 0.0133, -0.1656, 0.2134, 0.0191, 0.0057, 0.0734,
+ 0.0681, 0.0039, -0.0144, 0.029, -0.074, -0.046, 0.0122, 0.0072,
+ -0.0162, -0.0349, -0.1234, 0.0212, -0.0355, 0.0535, 0.1218,
+ 0.0043, -0.024, 0.0016,
+ ],
+ },
+ 8: {
+ mean: [-0.0018, -0.3037, 0.8491],
+ identity: [
+ 2e-4, -0.0112, 0.0077, -4e-4, -0.0044, 0.0024, 1e-4, -0.0021,
+ -4e-4, -4e-4, 0.0066, -0.002, -4e-4, -0.0052, -0.0044, 3e-4,
+ -0.0032, 0.0039, 4e-4, 0.0042, -3e-4, 2e-4, -0.0012, -2e-4, -2e-4,
+ 0.0052, -0.0083, -1e-4, -8e-4, -0.0056, 0.0017, 0.0024, 0.0019,
+ -0.0023, 0.002, 0.0027, -2e-4, -0.0013, 0.002, 9e-4, 0.0017,
+ -0.0028, -2e-4, 0.0012, -0.0026, 0, -0.0016, 2e-4, -5e-4, 3e-4,
+ -0.001, -1e-4, 0.0016, 0.0016, -3e-4, 0.0012, 0.0012, -3e-4,
+ 0.0027, -3e-4, 3e-4, -0.0026, 0.0037, -0.0017, 1e-4, 0.0016, 1e-4,
+ -0.0015, 0.0024, 1e-4, 2e-4, -0.0039, 0, -3e-4, -0.0033, -6e-4,
+ 0.0017, -4e-4, -4e-4, 0.0012, 0.0018, 2e-4, -0.0012, -0.002,
+ -0.0017, 0.0013, -0.001, 3e-4, 0.0021, 4e-4, -0.0012, -6e-4,
+ -2e-4, 0, -4e-4, -9e-4, 0.0016, 0.0017, 4e-4, 7e-4, 7e-4, 0.001,
+ 9e-4, -8e-4, 5e-4, 5e-4, 0.0023, 0.001, 0.0013, 2e-4, -4e-4, 2e-4,
+ 0.0017, 8e-4, 3e-4, -1e-4, 9e-4, -4e-4, 0.0019, -5e-4, 3e-4, 0,
+ -0.0025, 3e-4, 3e-4, 0.0011, 1e-4, -0.0015, -0.001, 7e-4, 7e-4,
+ -7e-4, -7e-4, 8e-4, 0, 1e-4, 0.0013, -4e-4, 0.0012, 0.0014,
+ 0.0017, 4e-4, 2e-4, 3e-4, -3e-4, -9e-4, 1e-4, 0, 0.001, -4e-4,
+ ],
+ expression: [
+ -0.0092, 2.8809, 1.416, 0.2018, 1.1982, -0.9351, 1.4492, -0.1902,
+ 0.1749, 0.0305, -0.167, -0.1572, -0.7354, -0.0492, 0.0115, 0.0608,
+ 0.2971, 0.1179, 0.0046, -0.0997, -0.0041, -0.0104, 0.3379,
+ -0.1854, 0.009, 0.0366, -0.0583, 0.0269, -0.0029, -0.4175, -8e-4,
+ 0.1794, 0.0752, -0.0135, 0.1158, 0.1234, 5e-4, 0.003, -0.0032,
+ 0.1034, -0.0504, -0.0055, -0.0076, -0.0772, 0.224, 0.0047, 0.0229,
+ -0.1044, 0.0162, -0.0161, -0.0241, -0.0083, -0.1388, -0.0434,
+ -0.0125, -0.0997, -0.0327, -0.0111, 0.1576, -0.3911, 0.0199,
+ 0.2522, 0.142, 0.0059, -0.0721, -0.0045, 0.031, -0.1136, -0.1685,
+ 0.0641, 0.0142, 0.0312, 0.0426, -0.1366, 0.1011, 0.0101, -0.0157,
+ 0.0018, -0.0103, -0.0344, 0.0907, 0.0016, 0.1168, -0.0806, 0.0104,
+ -0.0057, 0.0111,
+ ],
+ },
+ 9: [
+ {
+ mean: [0.0038, -0.2927, 0.833],
+ identity: [
+ 6e-4, -0.0109, 0.0073, -6e-4, -0.0044, 0.0017, -1e-4, -0.0022,
+ -6e-4, -3e-4, 0.0065, -0.0014, -6e-4, -0.0051, -0.0046, 3e-4,
+ -0.0029, 0.003, 2e-4, 0.0038, -6e-4, 0, -0.0012, 6e-4, -4e-4,
+ 0.0053, -0.0075, -2e-4, -7e-4, -0.0063, 0.0014, 0.0026, 0.0019,
+ -0.0022, 0.0018, 0.0028, -1e-4, -0.0012, 0.0011, 9e-4, 0.0019,
+ -0.0019, -1e-4, 0.0012, -0.0022, -3e-4, -0.0012, 4e-4, -8e-4,
+ 3e-4, -3e-4, 0, 0.0017, 0.0021, -4e-4, 0.0012, 0.0022, -3e-4,
+ 0.0026, -3e-4, 4e-4, -0.0026, 0.0032, -0.0019, 3e-4, 0.0015,
+ 1e-4, -0.0015, 0.0013, -1e-4, 1e-4, -0.0029, 0, -2e-4, -0.0028,
+ -7e-4, 0.0019, -3e-4, -2e-4, 0.0012, 9e-4, 4e-4, -0.001, -0.002,
+ -0.0016, 0.0011, -1e-4, 3e-4, 0.0021, 2e-4, -0.0014, -9e-4,
+ -1e-4, 0, -2e-4, -0.001, 0.0015, 0.0018, 1e-4, 7e-4, 8e-4,
+ 0.0017, 0.001, -9e-4, 1e-4, 4e-4, 0.0023, -1e-4, 0.0012, 1e-4,
+ -8e-4, 2e-4, 0.0018, 6e-4, 3e-4, 1e-4, 0.0012, -3e-4, 0.002,
+ -6e-4, 0, -1e-4, -0.0022, 4e-4, 5e-4, 0.0011, 2e-4, -0.0013,
+ -0.0023, 6e-4, 6e-4, -5e-4, -5e-4, 9e-4, 2e-4, 2e-4, 0.0011,
+ -3e-4, 0.0011, 0.0015, 0.0011, 3e-4, 2e-4, 8e-4, -4e-4, -8e-4,
+ 3e-4, 0, 0.0012, -1e-4,
+ ],
+ expression: [
+ 0.026, 0.1107, 0.3257, 0.1917, 0.3206, -1.1348, 1.0791, -0.035,
+ 0.1549, -0.0103, 0.6953, 1e-4, -0.3262, 0.068, 0.0219, -0.0044,
+ 0.3643, 0.2178, 0.0168, -0.2478, -0.1321, -0.0414, -0.3782,
+ -0.0617, 0.5088, -0.0031, -0.0311, -0.0497, 0.0948, -0.385,
+ 0.0148, -0.2224, -0.1415, -0.0074, 0.0863, -0.203, 3e-4,
+ -0.0081, 0.0057, 0.1164, -0.0039, 0.0015, -0.0024, 0.0505,
+ 0.1532, 0.0039, -0.0148, -0.0753, 0.0163, 0.0058, -0.0339,
+ 0.0036, 0.0252, -0.0569, -0.0041, 0.0163, -0.0361, 0.0035,
+ -0.018, 0.1266, 0, -0.0163, -0.0046, 0.0133, -0.1656, 0.2134,
+ 0.0191, 0.0057, 0.0734, 0.0681, 0.0039, -0.0144, 0.029, -0.074,
+ -0.046, 0.0122, 0.0072, -0.0162, -0.0349, -0.1234, 0.0212,
+ -0.0355, 0.0535, 0.1218, 0.0043, -0.024, 0.0016,
+ ],
+ },
+ {
+ mean: [-0.0018, -0.3037, 0.8491],
+ identity: [
+ 2e-4, -0.0112, 0.0077, -4e-4, -0.0044, 0.0024, 1e-4, -0.0021,
+ -4e-4, -4e-4, 0.0066, -0.002, -4e-4, -0.0052, -0.0044, 3e-4,
+ -0.0032, 0.0039, 4e-4, 0.0042, -3e-4, 2e-4, -0.0012, -2e-4,
+ -2e-4, 0.0052, -0.0083, -1e-4, -8e-4, -0.0056, 0.0017, 0.0024,
+ 0.0019, -0.0023, 0.002, 0.0027, -2e-4, -0.0013, 0.002, 9e-4,
+ 0.0017, -0.0028, -2e-4, 0.0012, -0.0026, 0, -0.0016, 2e-4,
+ -5e-4, 3e-4, -0.001, -1e-4, 0.0016, 0.0016, -3e-4, 0.0012,
+ 0.0012, -3e-4, 0.0027, -3e-4, 3e-4, -0.0026, 0.0037, -0.0017,
+ 1e-4, 0.0016, 1e-4, -0.0015, 0.0024, 1e-4, 2e-4, -0.0039, 0,
+ -3e-4, -0.0033, -6e-4, 0.0017, -4e-4, -4e-4, 0.0012, 0.0018,
+ 2e-4, -0.0012, -0.002, -0.0017, 0.0013, -0.001, 3e-4, 0.0021,
+ 4e-4, -0.0012, -6e-4, -2e-4, 0, -4e-4, -9e-4, 0.0016, 0.0017,
+ 4e-4, 7e-4, 7e-4, 0.001, 9e-4, -8e-4, 5e-4, 5e-4, 0.0023, 0.001,
+ 0.0013, 2e-4, -4e-4, 2e-4, 0.0017, 8e-4, 3e-4, -1e-4, 9e-4,
+ -4e-4, 0.0019, -5e-4, 3e-4, 0, -0.0025, 3e-4, 3e-4, 0.0011,
+ 1e-4, -0.0015, -0.001, 7e-4, 7e-4, -7e-4, -7e-4, 8e-4, 0, 1e-4,
+ 0.0013, -4e-4, 0.0012, 0.0014, 0.0017, 4e-4, 2e-4, 3e-4, -3e-4,
+ -9e-4, 1e-4, 0, 0.001, -4e-4,
+ ],
+ expression: [
+ -0.0092, 2.8809, 1.416, 0.2018, 1.1982, -0.9351, 1.4492,
+ -0.1902, 0.1749, 0.0305, -0.167, -0.1572, -0.7354, -0.0492,
+ 0.0115, 0.0608, 0.2971, 0.1179, 0.0046, -0.0997, -0.0041,
+ -0.0104, 0.3379, -0.1854, 0.009, 0.0366, -0.0583, 0.0269,
+ -0.0029, -0.4175, -8e-4, 0.1794, 0.0752, -0.0135, 0.1158,
+ 0.1234, 5e-4, 0.003, -0.0032, 0.1034, -0.0504, -0.0055, -0.0076,
+ -0.0772, 0.224, 0.0047, 0.0229, -0.1044, 0.0162, -0.0161,
+ -0.0241, -0.0083, -0.1388, -0.0434, -0.0125, -0.0997, -0.0327,
+ -0.0111, 0.1576, -0.3911, 0.0199, 0.2522, 0.142, 0.0059,
+ -0.0721, -0.0045, 0.031, -0.1136, -0.1685, 0.0641, 0.0142,
+ 0.0312, 0.0426, -0.1366, 0.1011, 0.0101, -0.0157, 0.0018,
+ -0.0103, -0.0344, 0.0907, 0.0016, 0.1168, -0.0806, 0.0104,
+ -0.0057, 0.0111,
+ ],
+ },
+ ],
+ 10: {
+ mean: [-0.007, -0.6338, 0.7695],
+ identity: [
+ 1e-4, -0.0296, 0.0089, -6e-4, -0.0073, -0.0065, -1e-4, -0.0029,
+ -0.0031, -2e-4, 0.0128, 0.0065, 0, -0.0116, -0.014, -1e-4,
+ -0.0037, -0.0052, -5e-4, 0.0028, 0.003, -4e-4, 0.0041, 0.0015,
+ 6e-4, 0.0088, -0.0076, -0.0011, -0.0015, -0.0073, 7e-4, -0.0011,
+ 0.0019, -0.0011, -5e-4, 0.0031, -1e-4, -0.0018, 9e-4, 0.0018,
+ 0.0038, 0.0068, -4e-4, -1e-4, 0.0061, 0.0024, 0.0024, -0.0066,
+ -6e-4, 0.0051, 0.0014, 0.002, 0.005, -0.0035, 1e-4, -0.0034,
+ -0.004, -7e-4, 0.001, -8e-4, 1e-4, -5e-4, -0.0021, 2e-4, 0.0045,
+ -0.0043, -0.0012, -0.0024, -0.0014, 6e-4, 0.0034, 0.0027, -8e-4,
+ -0.0053, 0.0014, 1e-4, 0.0013, -0.0018, 6e-4, -0.0015, 0.0029,
+ -2e-4, -0.0035, 1e-4, -0.002, 0.0012, 0.0048, 0.0011, 1e-4, -2e-4,
+ -3e-4, -0.0012, 0.0033, 6e-4, 0.002, -0.0033, 4e-4, 0.0028, 2e-4,
+ 8e-4, -1e-4, -0.0018, 8e-4, 0.0017, 1e-4, 9e-4, 8e-4, 3e-4,
+ 0.0019, -0.001, 0.001, -7e-4, -0.0013, 0, 1e-4, 0.0032, -1e-4,
+ 1e-4, 0.0011, -4e-4, 5e-4, -7e-4, 0.0018, -3e-4, 2e-4, 7e-4, 8e-4,
+ -0.0014, 7e-4, 0.0015, -6e-4, -1e-4, -4e-4, 0.0019, -9e-4, -6e-4,
+ -6e-4, -0.0012, 2e-4, -0.0012, -8e-4, 4e-4, 6e-4, -0.0011, 3e-4,
+ 9e-4, -4e-4, 6e-4, -7e-4, -4e-4,
+ ],
+ expression: [
+ -0.0603, 2.0527, 1.9014, 0.1025, 0.6143, 0.3804, 0.7881, -0.1023,
+ -0.0764, 0.0454, -0.2487, -0.5073, -0.6704, -0.031, -0.0181,
+ 0.0466, 0.0651, -0.0726, -0.0033, -0.0022, 0.2944, 0.0101, 0.1669,
+ -0.5225, -0.4685, 0.0236, 0.0079, 0.011, 0.2173, 0.4529, 0.0121,
+ -0.2104, -0.0673, 0.0225, -0.4023, 0.0317, -9e-4, 0.0076, -0.0032,
+ 0.0333, 0.0523, 0.0129, -0.001, -0.0319, -0.0139, 0.0015, -0.0044,
+ 0.0247, -5e-4, 0.0161, 0.0061, 0.0074, 0.0776, -0.0176, 0.007,
+ 0.055, -0.017, 0.0052, -0.1819, 0.0294, -0.0161, -0.0337, 0.0226,
+ -0.008, -0.0297, 0.1967, -0.0095, 0.0383, 0.2039, 0.0434, 0.0271,
+ -0.0064, -0.0037, -0.0294, -0.024, 0.0024, -0.0137, -0.0209,
+ -0.0031, 0.0628, 0.1003, -0.0126, -0.056, -0.0097, -0.0012,
+ -0.0041, 0.0162,
+ ],
+ },
+ 11: {
+ mean: [0.2505, 0.3833, 0.7793],
+ identity: [
+ 0.0098, 0.012, 0.0077, -6e-4, -3e-4, 0, 1e-4, 0.0082, -7e-4,
+ 0.0019, -0.0036, -0.0012, 2e-4, 0.0119, -0.0039, 0.001, 1e-4,
+ 0.0031, -0.0036, -0.0059, -7e-4, 0.0026, 0.0028, -0.0011, 9e-4,
+ -0.0032, 8e-4, 0.0029, 0.0043, 3e-4, 0.0025, -9e-4, 0.0047,
+ 0.0016, 0.0022, 0.0018, -0.001, 0.0025, -0.003, -0.001, 0.0033,
+ 0.0034, 4e-4, -0.0052, 0.0024, -2e-4, 0.001, -0.0014, -6e-4,
+ 0.0038, -0.0015, -6e-4, -0.001, -0.0011, -4e-4, -0.001, 4e-4,
+ -7e-4, 0.0036, -8e-4, -2e-4, -0.0019, 5e-4, 3e-4, -6e-4, -0.0024,
+ -0.0017, -0.0014, 6e-4, -4e-4, -0.0031, -0.0013, -6e-4, 0.0042,
+ 2e-4, -2e-4, -0.002, -3e-4, 8e-4, 0.0018, -5e-4, -6e-4, -2e-4,
+ -6e-4, 0.0025, 0.0019, 0.001, 8e-4, -0.0015, -0.0012, -1e-4,
+ -6e-4, -4e-4, 0.0023, -0.001, 6e-4, -2e-4, -0.001, 0, -9e-4,
+ -0.002, -0.0011, 1e-4, 0, -1e-4, 5e-4, 6e-4, 9e-4, -6e-4, 5e-4,
+ 8e-4, -1e-4, -2e-4, -0.0017, -6e-4, -4e-4, 4e-4, -6e-4, 0.0012,
+ 4e-4, 3e-4, -7e-4, 3e-4, -2e-4, 6e-4, 1e-4, 5e-4, -0.0019, -6e-4,
+ 4e-4, 7e-4, -1e-4, 1e-4, 5e-4, 0.001, -6e-4, -0.002, -7e-4, -5e-4,
+ 5e-4, 3e-4, 7e-4, 0.0014, 0, 5e-4, -5e-4, -2e-4, 3e-4, -6e-4,
+ -1e-4,
+ ],
+ expression: [
+ -9e-4, -3e-4, 0.0032, -0.003, -0.0034, -0.0031, 0.0014, 0, 4e-4,
+ -0.0139, -0.0764, 0.0275, -0.002, -0.0089, 0.0031, -0.0503,
+ -0.0771, 0.038, -0.1323, -0.3523, 0.1368, -0.0474, -0.0564,
+ 0.0296, -0.0045, 0.007, -0.0013, 0.0153, 0.1259, -0.0464, 0.0866,
+ 0.2175, -0.0786, -0.0413, -0.1248, 0.0448, -0.1777, -0.4607,
+ 0.1782, -5e-4, -0.005, 0.0016, 0.0629, 0.1506, -0.0624, 0.0545,
+ 0.2576, -0.0864, -0.0231, -0.0552, 0.0244, -0.0136, -0.0359,
+ 0.0169, -0.1158, -0.2996, 0.1214, -0.0235, -0.0354, 0.0165,
+ -0.0745, -0.1079, 0.0475, -0.0116, -0.0039, 0.0012, 0.0013,
+ -0.0108, -8e-4, 0.0044, -0.0027, -1e-4, -0.0694, 0.0363, 0.0071,
+ 0.1462, -0.136, 0.0047, 0.009, -0.0177, 0.0038, -0.0271, 0.0118,
+ 0.0011, -0.0399, -0.0111, 0.0123,
+ ],
+ },
+ 12: {
+ mean: [-0.2981, 0.3828, 0.7563],
+ identity: [
+ -0.0116, 0.014, 0.0054, 0.0018, 5e-4, 0, -4e-4, 0.0068, -0.0013,
+ -0.0019, -0.0048, -5e-4, 5e-4, 0.0108, -0.0036, -0.0029, -0.0018,
+ 0.0029, 0.0043, -0.0077, 6e-4, -0.0017, 0.002, -0.0011, -0.0014,
+ -0.0035, 0.0015, -0.0024, 0.0011, 4e-4, -0.0048, 2e-4, 0.0029,
+ -1e-4, -1e-4, 0.003, 0.0019, 0.0035, -0.0016, -4e-4, 0.0039,
+ 0.0019, 1e-4, -0.0064, 0.004, 3e-4, 0.002, -0.0021, 0.0017,
+ 0.0011, -0.001, 0.0026, 0.0025, -5e-4, 2e-4, -3e-4, -5e-4, -7e-4,
+ 9e-4, -4e-4, -0.001, -0.0022, 0.001, 9e-4, -0.0014, 7e-4, 0.0011,
+ -0.001, -5e-4, -8e-4, -0.0017, -0.0021, 9e-4, 0.0036, 5e-4, 4e-4,
+ -0.0031, 6e-4, -0.0015, 0.0027, 2e-4, 1e-4, -0.0011, 2e-4,
+ -0.0011, -0.0018, 4e-4, -0.0013, -2e-4, 7e-4, 9e-4, -3e-4, 0.001,
+ -0.0021, 8e-4, 6e-4, -9e-4, 4e-4, -7e-4, 8e-4, -0.002, -0.0013, 0,
+ 7e-4, -0.0012, -1e-4, 0.0014, 0.0014, -1e-4, 0.0013, 6e-4, 6e-4,
+ -0.0014, -0.0015, -9e-4, 1e-4, 1e-4, 9e-4, 7e-4, 0, 1e-4, -0.001,
+ -4e-4, 0, -5e-4, 1e-4, -3e-4, 4e-4, -5e-4, -1e-4, -0.0011, 2e-4,
+ 0, 1e-4, 8e-4, 8e-4, 0, -7e-4, -8e-4, 0, 2e-4, -1e-4, 0.001, 3e-4,
+ 4e-4, -2e-4, 0, 5e-4, 0.0018, -1e-4,
+ ],
+ expression: [
+ 0, -4e-4, 0.0028, 0.0036, -8e-4, -0.0026, -0.0015, -8e-4, 3e-4,
+ 0.0075, -0.0608, 0.025, 0.0019, -0.0076, 0.0033, 0.0379, -0.0437,
+ 0.0335, 0.0964, -0.2452, 0.1233, 0.0368, -0.0251, 0.0253, 0.0033,
+ 0.0097, -0.0021, -0.0095, 0.1171, -0.0475, -0.064, 0.1548,
+ -0.0718, 0.0228, -0.0831, 0.0343, -0.1924, 0.6206, -0.2771,
+ 0.0021, -0.0143, 0.0056, -0.0705, 0.2522, -0.1116, -0.0692,
+ 0.4229, -0.1592, -0.0093, 0.05, -0.0185, 0.0948, -0.3196, 0.1437,
+ -0.0184, 0.0194, -0.0131, 0.0205, -0.0353, 0.0201, 0.0676, -0.135,
+ 0.0672, 0.0137, -0.0311, 0.0118, 3e-4, -0.0077, -2e-4, -0.0151,
+ 4e-4, -0.0058, 0.029, -0.0139, 0.0163, 0.1324, 0.1819, -0.0039,
+ 0.0406, 0.0501, 0.0017, 0.0331, 0.0161, 0.0062, -0.0235, -0.0446,
+ 0.0047,
+ ],
+ },
+ };
+ let dt = 1,
+ ft = new Map();
+ function ht(e) {
+ return ft.get(e);
+ }
+ class pt {
+ constructor(e) {
+ (this._name = e), (this.anchor_pose = A());
+ }
+ _getVertex(e, t, r) {
+ let i = r.mean.slice();
+ for (let t = 0; t < 50; t++)
+ (i[0] += e[t] * r.identity[3 * t + 0]),
+ (i[1] += e[t] * r.identity[3 * t + 1]),
+ (i[2] += e[t] * r.identity[3 * t + 2]);
+ for (let e = 0; e < 29; e++)
+ (i[0] += t[e] * r.expression[3 * e + 0]),
+ (i[1] += t[e] * r.expression[3 * e + 1]),
+ (i[2] += t[e] * r.expression[3 * e + 2]);
+ return i;
+ }
+ update(e, t, r) {
+ let i,
+ a = ut[this._name.toString()];
+ if (a) {
+ if (Array.isArray(a)) {
+ i = this._getVertex(e, t, a[0]);
+ let r = this._getVertex(e, t, a[1]);
+ (i[0] = 0.5 * (i[0] + r[0])),
+ (i[1] = 0.5 * (i[1] + r[1])),
+ (i[2] = 0.5 * (i[2] + r[2]));
+ } else i = this._getVertex(e, t, a);
+ r && (i[0] *= -1), R(this.anchor_pose, i);
+ }
+ }
+ }
+ const mt = {
+ incompatible: () =>
+ !(
+ "function" == typeof Promise &&
+ "object" == typeof WebAssembly &&
+ navigator.mediaDevices &&
+ navigator.mediaDevices.enumerateDevices &&
+ navigator.mediaDevices.getUserMedia
+ ),
+ incompatible_ui: () => {
+ const e = document.createElement("div");
+ e.append(
+ (function () {
+ let e = document.createElement("div"),
+ t = "a recent web browser";
+ navigator.userAgent.match(/Android/i)
+ ? ((t = "Chrome for Android"),
+ (window.location.href =
+ "googlechrome://navigate?url=" +
+ encodeURI(window.location.href)),
+ setTimeout(() => {
+ window.location.href =
+ "samsunginternet://open?url=" +
+ encodeURI(window.location.href);
+ }, 2e3))
+ : navigator.userAgent.match(/iPhone|iPod|iPad/i) &&
+ ((t = "Safari"),
+ e.classList.add("zee-launcher-browser-safari")),
+ e.classList.add("zee-launcher-unsupported"),
+ (e.innerHTML = `\n \n \n Open with ${t} to access this content.
\n \n
Tap below to copy the address for easy pasting into ${t}.
\n
\n
\n COPIED! Now paste into ${t}'s address bar to experience the content.
\n `);
+ let r =
+ e.querySelector("#zee-launcher-unsupported-message-input") ||
+ document.createElement("input");
+ r.value = window.location.href;
+ let i = () => {
+ if (navigator.userAgent.match(/iPhone|iPod|iPad/i)) {
+ let e = document.createRange();
+ e.selectNodeContents(r);
+ let t = window.getSelection();
+ if (!t) return;
+ t.removeAllRanges(),
+ t.addRange(e),
+ r.setSelectionRange(0, 999999999);
+ } else r.select();
+ document.execCommand("copy"),
+ r.blur(),
+ e.classList.toggle(
+ "zee-launcher-unsupported-message-copied",
+ !0
+ );
+ };
+ return (
+ (
+ e.querySelector(
+ "#zee-launcher-unsupported-message-button"
+ ) || document.createElement("button")
+ ).addEventListener("click", i),
+ r.addEventListener("click", i),
+ e
+ );
+ })()
+ ),
+ Object.assign(e.style, {
+ position: "fixed",
+ width: "100%",
+ height: "100%",
+ top: "0px",
+ left: "0px",
+ zIndex: 1001,
+ backgroundColor: "rgba(0, 0, 0, 0.9)",
+ fontFamily: "sans-serif",
+ color: "white",
+ display: "flex",
+ flexDirection: "column",
+ alignItems: "center",
+ justifyContent: "center",
+ }),
+ e.classList.add("zee_launcher_compatibility"),
+ document.body.append(e);
+ },
+ };
+ let gt = 1,
+ bt = new Map();
+ class wt extends Pe {
+ constructor(e, t) {
+ super(),
+ (this._impl = e),
+ (this._pipeline = t),
+ (this._packetNumber = 0),
+ (this._motionUpdatesQueued = 0),
+ (this._motionUpdatesSent = 0),
+ (this._minFrameGapMs = 0),
+ (this._lastUpdateTime = 0);
+ }
+ static create(e) {
+ let t = gt++;
+ return (
+ bt.set(t, new wt(t, e)),
+ pe("sequence_source_source_t initialized"),
+ t
+ );
+ }
+ static get(e) {
+ return bt.get(e);
+ }
+ loadFromMemory(e) {
+ try {
+ (this._decoder = new De(e)),
+ (this._packetNumber = 0),
+ (this._lastUpdateTime = 0);
+ } catch (e) {
+ me("Unable to decode sequence:", e);
+ }
+ }
+ maxPlaybackFpsSet(e) {
+ this._minFrameGapMs = e <= 0 ? 0 : 1e3 / e;
+ }
+ setTime(e) {
+ e < 0 ? delete this._time : (this._time = e);
+ }
+ getFrame(e) {
+ var t;
+ let r = ct.get(this._pipeline);
+ if (!r) return;
+ if (!this._decoder) return;
+ if (
+ (this._submitMotionUpdates(r),
+ this._motionUpdatesQueued > this._motionUpdatesSent)
+ )
+ return;
+ if (e) return;
+ let i =
+ null !== (t = this._time) && void 0 !== t ? t : performance.now();
+ if (i < this._lastUpdateTime + this._minFrameGapMs) return;
+ if (this._packetNumber >= this._decoder.numberPackets) return;
+ let a = this._decoder.dataByPacket.get(this._packetNumber);
+ if (a.type != Ce.CAMERA_FRAME) return;
+ this._packetNumber++;
+ let n = r.cameraPixelArrays.pop();
+ for (; n && n.byteLength !== a.greyscale.byteLength; )
+ n = r.cameraPixelArrays.pop();
+ n || (n = new ArrayBuffer(a.greyscale.byteLength)),
+ new Uint8Array(n).set(a.greyscale),
+ (this._lastUpdateTime = i);
+ let s = {
+ data: n,
+ cameraSourceData: a.greyscale,
+ cameraModel: a.cameraModel,
+ cameraToDevice: a.cameraToDevice,
+ dataWidth: a.width,
+ dataHeight: a.height,
+ texture: void 0,
+ userFacing: a.userFacing,
+ uvTransform: A(),
+ cameraSource: this,
+ };
+ this._submitMotionUpdates(r);
+ const o = r.registerToken(s);
+ r.sendDataToWorker(
+ s.data || new ArrayBuffer(0),
+ o,
+ s.dataWidth,
+ s.dataHeight,
+ s.userFacing,
+ s.cameraToDevice,
+ s.cameraModel
+ );
+ }
+ destroy() {
+ bt.delete(this._impl), this.pause();
+ }
+ start() {
+ var e;
+ let t = ct.get(this._pipeline);
+ t &&
+ t.currentCameraSource !== this &&
+ (null === (e = t.currentCameraSource) ||
+ void 0 === e ||
+ e.pause(),
+ (t.currentCameraSource = this));
+ }
+ pause() {
+ let e = ct.get(this._pipeline);
+ e &&
+ e.currentCameraSource === this &&
+ (e.currentCameraSource = void 0);
+ }
+ uploadGL(e) {
+ let t = ct.get(this._pipeline);
+ if (!t) return;
+ let r = null == t ? void 0 : t.glContext;
+ r &&
+ (e.texture || (e.texture = t.getVideoTexture()),
+ e.texture &&
+ e.cameraSourceData &&
+ (r.bindTexture(r.TEXTURE_2D, e.texture),
+ r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, !1),
+ r.texImage2D(
+ r.TEXTURE_2D,
+ 0,
+ r.LUMINANCE,
+ e.dataWidth,
+ e.dataHeight,
+ 0,
+ r.LUMINANCE,
+ r.UNSIGNED_BYTE,
+ new Uint8Array(e.cameraSourceData)
+ ),
+ r.bindTexture(r.TEXTURE_2D, null)));
+ }
+ _submitMotionUpdates(e) {
+ let t = !1;
+ for (; this._packetNumber < this._decoder.numberPackets; ) {
+ let r = this._decoder.dataByPacket.get(this._packetNumber);
+ if (r.type == Ce.CAMERA_FRAME) break;
+ switch (r.type) {
+ case Ce.ACCELEROMETER:
+ e.motionAccelerometerSubmit(r.t, r.x, r.y, r.z), (t = !0);
+ break;
+ case Ce.ROTATION_RATE:
+ e.motionRotationRateSubmit(r.t, r.x, r.y, r.z), (t = !0);
+ break;
+ case Ce.ATTITUDE:
+ e.motionAttitudeSubmit(r.t, r.x, r.y, r.z), (t = !0);
+ break;
+ case Ce.ATTITUDE_MATRIX:
+ e.motionAttitudeMatrix(r.attitude), (t = !0);
+ }
+ this._packetNumber++;
+ }
+ t &&
+ (this._motionUpdatesQueued++,
+ setTimeout(() => {
+ this._motionUpdatesSent++;
+ }, 0));
+ }
+ }
+ const vt =
+ '';
+ function yt() {
+ var e = new E(2);
+ return E != Float32Array && ((e[0] = 0), (e[1] = 0)), e;
+ }
+ function Et(e, t) {
+ return (e[0] = t[0]), (e[1] = t[1]), e;
+ }
+ function At(e, t, r) {
+ return (e[0] = t[0] + r[0]), (e[1] = t[1] + r[1]), e;
+ }
+ function Tt(e, t, r) {
+ return (e[0] = t[0] - r[0]), (e[1] = t[1] - r[1]), e;
+ }
+ function xt(e, t, r) {
+ return (e[0] = t[0] * r), (e[1] = t[1] * r), e;
+ }
+ function Rt(e) {
+ var t = e[0],
+ r = e[1];
+ return Math.hypot(t, r);
+ }
+ function kt() {
+ return {
+ indices: new Uint16Array(0),
+ vertices: new Float32Array(0),
+ normals: new Float32Array(0),
+ uvs: new Float32Array(0),
+ };
+ }
+ function Ft(e) {
+ const t = (2 * e.trainedWidth) / (e.trainedHeight * e.topRadius);
+ return Lt(
+ e,
+ 2,
+ !1,
+ 0,
+ 0,
+ 0,
+ yt(),
+ e.trainedWidth / e.trainedHeight,
+ t,
+ e.physicalScaleFactor
+ );
+ }
+ function Lt(e, t, r, i, a, n, s, _, c, l) {
+ isNaN(_) && (_ = 1);
+ const u = [],
+ d = [],
+ f = l > 0 ? l : 1,
+ h = (2 * f) / t,
+ p = 64;
+ for (let t = 0; t <= p; ++t) {
+ const i = (t * c) / p + (2 * Math.PI - c) / 2,
+ a = e.bottomRadius * Math.sin(i) * h,
+ n = e.bottomRadius * Math.cos(i) * h,
+ s = e.topRadius * Math.sin(i) * h,
+ o = e.topRadius * Math.cos(i) * h,
+ _ = -1 * f,
+ l = f;
+ r
+ ? (u.push(a, _, n), u.push(s, l, o))
+ : (u.push(s, l, -o), u.push(a, _, -n));
+ }
+ for (let t = 0; t <= p; ++t)
+ if (e.type == o.IMAGE_TRACKER_TYPE_CYLINDRICAL) {
+ const e = 1 - t / p;
+ d.push(e, 1), d.push(e, 0);
+ } else {
+ let e = 2 * -(t / p - 0.5) * i;
+ r && ((e = -e + i), e > i && (e = e - i - i));
+ const o = yt();
+ (o[0] = Math.sin(e)), (o[1] = Math.cos(e)), r && (o[1] *= -1);
+ const c = yt();
+ Et(c, o), xt(c, c, a), At(c, s, c);
+ const l = yt();
+ Et(l, o),
+ xt(l, l, n),
+ At(l, s, l),
+ d.push((l[0] + _) / (2 * _), 1 - (1 - l[1]) / 2),
+ d.push((c[0] + _) / (2 * _), 1 - (1 - c[1]) / 2);
+ }
+ const m = [];
+ for (let e = 0; e < p; ++e) {
+ const t = 2 * e;
+ m.push(t + 1, t + 2, t + 3), m.push(t + 0, t + 2, t + 1);
+ }
+ return {
+ vertices: new Float32Array(u),
+ indices: new Uint16Array(m),
+ normals: new Float32Array(0),
+ uvs: new Float32Array(d),
+ };
+ }
+ yt();
+ const Mt = new TextDecoder();
+ class It {
+ constructor(e, t = !1) {
+ (this._data = e),
+ (this._paddingBytes = t),
+ (this.truncatedChunks = !1),
+ (this._view = new DataView(this._data)),
+ (this.root = this._parse());
+ }
+ _parse() {
+ if ("RIFF" !== Mt.decode(this._data.slice(0, 4)))
+ throw new Error("Not a valid ZPT file");
+ return this._parseChunk(0);
+ }
+ _parseChunk(e) {
+ const t = Mt.decode(this._data.slice(e, e + 4)),
+ r = this._view.getUint32(e + 4, !0),
+ i = new Uint8Array(this._data, e + 8, r);
+ let a, n;
+ if (
+ (i.byteLength !== r && (this.truncatedChunks = !0),
+ "RIFF" === t || "LIST" === t)
+ ) {
+ (n = Mt.decode(this._data.slice(e + 8, e + 12))), (a = []);
+ let t = 4;
+ for (; t < i.byteLength - 1; ) {
+ const r = this._parseChunk(e + 8 + t);
+ a.push(r),
+ (t += r.data.byteLength + 8),
+ this._paddingBytes && 1 & r.data.byteLength && t++;
+ }
+ }
+ return { ident: t, data: i, subident: n, subchunks: a };
+ }
+ find(e, t = this.root) {
+ if (t.ident === e) return t;
+ if (t.subchunks)
+ for (let r of t.subchunks) {
+ const t = this.find(e, r);
+ if (t) return t;
+ }
+ }
+ has(e) {
+ return void 0 !== this.find(e);
+ }
+ }
+ let St = new Map();
+ const Ct = new TextDecoder();
+ class Ut {
+ constructor(e, t) {
+ (this._client = e), (this._impl = t), (this._targets = []);
+ }
+ static create(e, t) {
+ let r = t.image_tracker_create(e);
+ return St.set(r, new Ut(t, r)), r;
+ }
+ static get(e) {
+ return St.get(e);
+ }
+ destroy() {
+ this._client.image_tracker_destroy(this._impl),
+ St.delete(this._impl);
+ }
+ loadFromMemory(e) {
+ this._targets.push({ data: e }),
+ this._client.image_tracker_target_load_from_memory(this._impl, e);
+ }
+ targetCount() {
+ return this._targets.length;
+ }
+ getTargetInfo(e) {
+ let t = this._targets[e];
+ if (t && t.info) return t.info;
+ t.info = {
+ topRadius: -1,
+ bottomRadius: -1,
+ sideLength: -1,
+ physicalScaleFactor: -1,
+ trainedWidth: 0,
+ trainedHeight: 0,
+ type: o.IMAGE_TRACKER_TYPE_PLANAR,
+ };
+ try {
+ const e = new It(t.data, !1),
+ r = e.find("IMG ");
+ if (r) {
+ let i = "image/png";
+ const a = e.find("IMGM");
+ a && (i = Ct.decode(a.data)),
+ (t.info.preview = { mimeType: i, compressed: r.data });
+ }
+ const i = e.find("ODLE");
+ if (i) {
+ const e = Ct.decode(i.data);
+ this._parseOdle(e, t.info);
+ }
+ } catch (e) {}
+ return t.info;
+ }
+ _parseOdle(e, t) {
+ let r = 0,
+ i = "0";
+ return (
+ ([i, r] = Dt(r, e)),
+ "1" === i
+ ? this._parseOdleV1(e, r, t)
+ : "3" === i
+ ? this._parseOdleV3(e, r, t)
+ : void 0
+ );
+ }
+ _parseOdleV1(e, t, r) {
+ let i = "0";
+ if ((([i, t] = Dt(t, e)), "0" !== i && "1" !== i)) return;
+ let a = "";
+ if ((([a, t] = Dt(t, e)), 0 !== a.length)) return;
+ let n = "";
+ [n, t] = Dt(t, e);
+ const s = n.split(" ");
+ s.length < 5 ||
+ ((r.trainedWidth = parseInt(s[3].replace("[", ""))),
+ (r.trainedHeight = parseInt(s[4].replace("]", ""))));
+ }
+ _parseOdleV3(e, t, r) {
+ let i = "0";
+ if ((([i, t] = Dt(t, e)), "0" !== i && "1" !== i)) return;
+ let a = "0";
+ [a, t] = Dt(t, e);
+ const n = parseInt(a);
+ if (isNaN(n) || n < 1) return;
+ let s = "";
+ if ((([s, t] = Dt(t, e)), 0 !== s.length)) return;
+ let o = "";
+ [o, t] = Dt(t, e);
+ const _ = o.split(" ");
+ if (_.length < 6) return;
+ const c = parseInt(_[0]);
+ (0 !== c && 1 !== c && 2 !== c) || (r.type = c),
+ (r.trainedWidth = parseInt(_[4].replace("[", ""))),
+ (r.trainedHeight = parseInt(_[5].replace("]", ""))),
+ _.length >= 7 &&
+ ((r.physicalScaleFactor = parseFloat(_[6])),
+ isNaN(r.physicalScaleFactor) && (r.physicalScaleFactor = -1)),
+ _.length >= 8 &&
+ ((r.topRadius = parseFloat(_[7])),
+ isNaN(r.topRadius) && (r.topRadius = -1),
+ (r.bottomRadius = r.topRadius)),
+ _.length >= 9 &&
+ ((r.bottomRadius = parseFloat(_[8])),
+ isNaN(r.bottomRadius) && (r.bottomRadius = -1)),
+ _.length >= 10 &&
+ ((r.sideLength = parseFloat(_[9])),
+ isNaN(r.sideLength) && (r.sideLength = -1));
+ }
+ getDecodedPreview(e) {
+ const t = this.getTargetInfo(e);
+ if (t.preview) {
+ if (!t.preview.image) {
+ const e = new Blob([t.preview.compressed], {
+ type: t.preview.mimeType,
+ });
+ (t.preview.image = new Image()),
+ (t.preview.image.src = URL.createObjectURL(e));
+ }
+ return t.preview.image;
+ }
+ }
+ getPreviewMesh(e) {
+ const t = this.getTargetInfo(e);
+ return (
+ t.previewMesh ||
+ (t.previewMesh = (function (e) {
+ switch (e.type) {
+ case o.IMAGE_TRACKER_TYPE_PLANAR:
+ return (function (e) {
+ const t = e.trainedWidth / e.trainedHeight;
+ if (isNaN(t)) return kt();
+ const r =
+ e.physicalScaleFactor > 0 ? e.physicalScaleFactor : 1;
+ return {
+ vertices: new Float32Array([
+ -1 * t * r,
+ -1 * r,
+ 0,
+ -1 * t * r,
+ r,
+ 0,
+ t * r,
+ r,
+ 0,
+ t * r,
+ -1 * r,
+ 0,
+ ]),
+ indices: new Uint16Array([0, 2, 1, 0, 3, 2]),
+ uvs: new Float32Array([0, 0, 0, 1, 1, 1, 1, 0]),
+ normals: new Float32Array([
+ 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1,
+ ]),
+ };
+ })(e);
+ case o.IMAGE_TRACKER_TYPE_CYLINDRICAL:
+ return Ft(e);
+ case o.IMAGE_TRACKER_TYPE_CONICAL:
+ return (function (e) {
+ const t = e.topRadius - e.bottomRadius;
+ if (0 === t)
+ return (
+ console.warn(
+ "Conical target has matching radii, using cylindrical preview mesh with a defined image size instead."
+ ),
+ Ft(e)
+ );
+ const r = Math.sqrt(
+ e.sideLength * e.sideLength - t * t
+ ),
+ i = e.bottomRadius > e.topRadius;
+ let a = e.trainedWidth / e.trainedHeight;
+ isNaN(a) && (a = 1);
+ const n = !(e.bottomRadius > 0 && e.topRadius > 0),
+ s =
+ e.sideLength <
+ 2 * Math.abs(e.topRadius - e.bottomRadius),
+ o = yt(),
+ _ = yt(),
+ c = yt();
+ if (n)
+ if (s)
+ if (i) {
+ c[1] = a - 1;
+ const e = Math.acos((2 - a) / a);
+ (o[0] = a * Math.sin(e)),
+ (o[1] = a - 1 + a * Math.cos(e)),
+ Et(_, c);
+ } else {
+ c[1] = 1 - a;
+ const e = Math.PI + Math.acos((2 - a) / a);
+ (o[0] = a * Math.sin(e)),
+ (o[1] = 1 - a + a * Math.cos(e)),
+ Et(_, c);
+ }
+ else
+ i
+ ? ((c[1] = 1),
+ Et(_, c),
+ (o[0] = a),
+ (o[1] = 1 - Math.sqrt(4 - Math.pow(a, 2))))
+ : ((c[1] = -1),
+ Et(_, c),
+ (o[0] = -a),
+ (o[1] = Math.sqrt(4 - Math.pow(a, 2)) - 1));
+ else if (s)
+ if (i) {
+ c[1] = a - 1;
+ const t = Math.acos((2 - a) / a);
+ (o[0] = a * Math.sin(t)),
+ (o[1] = a - 1 + a * Math.cos(t)),
+ (_[0] = (a - e.sideLength) * Math.sin(t)),
+ (_[1] = a - 1 + (a - e.sideLength) * Math.cos(t));
+ } else {
+ c[1] = 1 - a;
+ const t = Math.PI + Math.acos((2 - a) / a);
+ (o[0] = a * Math.sin(t)),
+ (o[1] = 1 - a + a * Math.cos(t)),
+ (_[0] = (a - e.sideLength) * Math.sin(t)),
+ (_[1] = 1 - a + (a - e.sideLength) * Math.cos(t));
+ }
+ else {
+ const t = i
+ ? e.topRadius / e.bottomRadius
+ : e.bottomRadius / e.topRadius;
+ i
+ ? ((_[0] = t * a),
+ (_[1] = 1),
+ (o[0] = a),
+ (o[1] =
+ 1 -
+ Math.sqrt(
+ e.sideLength * e.sideLength -
+ (_[0] - o[0]) * (_[0] - o[0])
+ )),
+ (c[1] =
+ o[1] + (o[0] / (o[0] - _[0])) * (_[1] - o[1])))
+ : ((_[0] = -t * a),
+ (_[1] = -1),
+ (o[0] = -a),
+ (o[1] =
+ Math.sqrt(
+ e.sideLength * e.sideLength -
+ (_[0] - o[0]) * (_[0] - o[0])
+ ) - 1),
+ (c[1] =
+ o[1] -
+ (-o[0] / (_[0] - o[0])) * (o[1] - _[1])));
+ }
+ const l = yt();
+ Tt(l, o, c);
+ const u = yt();
+ Tt(u, _, c);
+ const d = Rt(l),
+ f = Rt(u);
+ let h = 2 * Math.abs(Math.atan(l[0] / l[1]));
+ s && (h = 2 * Math.PI - h);
+ let p = (d * h) / e.topRadius,
+ m = Math.abs(Math.atan(l[0] / l[1]));
+ return (
+ s && (m = Math.PI - m),
+ Lt(e, r, i, m, f, d, c, a, p, e.physicalScaleFactor)
+ );
+ })(e);
+ }
+ return kt();
+ })(t)),
+ t.previewMesh
+ );
+ }
+ }
+ function Dt(e, t) {
+ let r = t.indexOf("\n", e);
+ return [t.substring(e, r >= 0 ? r : void 0).replace("\r", ""), r + 1];
+ }
+ var Pt = function (e, t, r, i) {
+ return new (r || (r = Promise))(function (a, n) {
+ function s(e) {
+ try {
+ _(i.next(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function o(e) {
+ try {
+ _(i.throw(e));
+ } catch (e) {
+ n(e);
+ }
+ }
+ function _(e) {
+ var t;
+ e.done
+ ? a(e.value)
+ : ((t = e.value),
+ t instanceof r
+ ? t
+ : new r(function (e) {
+ e(t);
+ })).then(s, o);
+ }
+ _((i = i.apply(e, t || [])).next());
+ });
+ };
+ let Bt;
+ function Ot(e) {
+ if (Bt) return Bt;
+ let t = !1;
+ (function (e) {
+ return H(this, void 0, void 0, function* () {
+ var t;
+ function i() {
+ let t = q.getOutgoingMessages();
+ for (let r of t) e.postMessage(r.msg, r.transferables);
+ }
+ e ||
+ (e = new Worker(new URL(r.p + r.u(56), r.b), { type: void 0 })),
+ e.postMessage({
+ t: "wasm",
+ url: new URL(r(751), r.b).toString(),
+ }),
+ yield ((t = e),
+ new Promise((e) => {
+ let r = (i) => {
+ "loaded" === i.data &&
+ (t.removeEventListener("message", r), e());
+ };
+ t.addEventListener("message", r);
+ })),
+ q.onOutgoingMessage.bind(i),
+ i(),
+ e.addEventListener("message", (e) => {
+ q.postIncomingMessage(e.data);
+ });
+ });
+ })(null == e ? void 0 : e.worker).then(() => {
+ pe("Fully loaded"), (t = !0);
+ });
+ let i = new l((e) => {
+ q.postOutgoingMessage({ t: "zappar", d: e }, [e]);
+ });
+ const a = (function () {
+ let e = window.localStorage.getItem("z_uar_lid");
+ if (null === e) {
+ const t = new Uint8Array(8);
+ window.crypto.getRandomValues(t), (e = "");
+ for (let r = 0; r < t.byteLength; r++) {
+ const i = t[r].toString(16);
+ 1 === i.length ? (e += "0" + i) : 2 === i.length && (e += i);
+ }
+ }
+ return e;
+ })();
+ let n = !1,
+ s = !1;
+ try {
+ const e = Object.fromEntries(
+ document.cookie
+ .split("; ")
+ .map((e) => e.split(/=(.*)/s).map(decodeURIComponent))
+ );
+ if (e["zw-uar-project"]) {
+ const t = JSON.parse(e["zw-uar-project"]);
+ "object" == typeof t &&
+ "string" == typeof t.id &&
+ (i.impl.analytics_project_id_set(".wiz" + t.id, a), (s = !0));
+ }
+ } catch (e) {}
+ if (
+ !s &&
+ (window.location.hostname.toLowerCase().indexOf(".zappar.io") > 0 ||
+ window.location.hostname.toLowerCase().indexOf(".webar.run") >
+ 0 ||
+ window.location.hostname.toLowerCase().indexOf(".arweb.app") >
+ 0 ||
+ window.location.hostname.toLowerCase().indexOf(".zappar-us.io") >
+ 0 ||
+ window.location.hostname.toLowerCase().indexOf(".zappar-eu.io") >
+ 0)
+ ) {
+ let e = window.location.pathname.split("/");
+ e.length > 1 &&
+ e[1].length > 0 &&
+ (i.impl.analytics_project_id_set(".wiz" + e[1], a), (s = !0));
+ }
+ return (
+ q.onIncomingMessage.bind((e) => {
+ var t, r, a, n, s, o, _;
+ switch (e.t) {
+ case "zappar":
+ null === (t = ct.get(e.p)) ||
+ void 0 === t ||
+ t.pendingMessages.push(e.d);
+ break;
+ case "buf":
+ i.serializer.bufferReturn(e.d);
+ break;
+ case "cameraFrameRecycleS2C": {
+ let t = e;
+ null ===
+ (a =
+ null === (r = ct.get(t.p)) || void 0 === r
+ ? void 0
+ : r.cameraTokenReturn) ||
+ void 0 === a ||
+ a.call(r, e);
+ break;
+ }
+ case "videoFrameS2C": {
+ let t = e;
+ null ===
+ (s =
+ null === (n = ct.get(t.p)) || void 0 === n
+ ? void 0
+ : n.videoFrameFromWorker) ||
+ void 0 === s ||
+ s.call(n, t);
+ break;
+ }
+ case "imageBitmapS2C": {
+ let t = e;
+ null ===
+ (_ =
+ null === (o = ct.get(t.p)) || void 0 === o
+ ? void 0
+ : o.imageBitmapFromWorker) ||
+ void 0 === _ ||
+ _.call(o, t);
+ break;
+ }
+ case "licerr": {
+ let e = document.createElement("div");
+ (e.innerHTML =
+ "Visit our licensing page to find out about hosting on your own domain."),
+ (e.style.position = "absolute"),
+ (e.style.bottom = "20px"),
+ (e.style.width = "80%"),
+ (e.style.backgroundColor = "black"),
+ (e.style.color = "white"),
+ (e.style.borderRadius = "10px"),
+ (e.style.padding = "10px"),
+ (e.style.fontFamily = "sans-serif"),
+ (e.style.textAlign = "center"),
+ (e.style.left = "10%"),
+ (e.style.zIndex = Number.MAX_SAFE_INTEGER.toString());
+ let t = document.createElement("span");
+ (t.innerText = " (30)"), e.append(t);
+ let r = 30;
+ setInterval(function () {
+ r--, r >= 0 && (t.innerText = " (" + r.toString() + ")");
+ }, 1e3),
+ document.body.append(e);
+ }
+ case "gfx": {
+ let e = document.createElement("div");
+ (e.innerHTML = vt),
+ (e.style.position = "absolute"),
+ (e.style.bottom = "20px"),
+ (e.style.width = "250px"),
+ (e.style.left = "50%"),
+ (e.style.marginLeft = "-125px"),
+ (e.style.zIndex = Number.MAX_SAFE_INTEGER.toString()),
+ (e.style.opacity = "0"),
+ (e.style.transition = "opacity 0.5s"),
+ document.body.append(e),
+ setTimeout(function () {
+ e.style.opacity = "1";
+ }, 500),
+ setTimeout(function () {
+ e.style.opacity = "0";
+ }, 3e3),
+ setTimeout(function () {
+ e.remove();
+ }, 4e3);
+ }
+ }
+ }),
+ (Bt = Object.assign(Object.assign({}, i.impl), {
+ loaded: () => t,
+ camera_default_device_id: (e) =>
+ e ? Xe.USER_DEFAULT_DEVICE_ID : Xe.DEFAULT_DEVICE_ID,
+ camera_source_create: (e, t) =>
+ (function (e, t) {
+ let r = Qe++;
+ return (
+ D.preferMediaStreamTrackProcessorCamera &&
+ "MediaStreamTrackProcessor" in window &&
+ "MediaStreamTrackGenerator" in window
+ ? et(r, new $e(r, e, t))
+ : D.preferImageBitmapCamera &&
+ "undefined" != typeof OffscreenCanvas
+ ? et(r, new Ze(r, e, t))
+ : et(r, new Xe(r, e, t)),
+ pe("camera_source_t initialized"),
+ r
+ );
+ })(e, t),
+ camera_source_destroy: (e) => {
+ var t;
+ return null === (t = tt(e)) || void 0 === t
+ ? void 0
+ : t.destroy();
+ },
+ camera_source_pause: (e) => {
+ var t;
+ return null === (t = tt(e)) || void 0 === t
+ ? void 0
+ : t.pause();
+ },
+ camera_source_start: (e) => {
+ var t;
+ return null === (t = tt(e)) || void 0 === t
+ ? void 0
+ : t.start();
+ },
+ camera_count: () => 2,
+ camera_id: (e) =>
+ 0 === e ? Xe.DEFAULT_DEVICE_ID : Xe.USER_DEFAULT_DEVICE_ID,
+ camera_name: (e) =>
+ 0 === e ? "Rear-facing Camera" : "User-facing Camera",
+ camera_user_facing: (e) => 0 !== e,
+ pipeline_create: () => ct.create(i.impl, q),
+ pipeline_frame_update: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.frameUpdate(i);
+ },
+ pipeline_camera_frame_draw_gl: (e, t, r, i) => {
+ var a;
+ null === (a = ct.get(e)) ||
+ void 0 === a ||
+ a.cameraFrameDrawGL(t, r, i);
+ },
+ draw_plane: (e, t, r, i, a) => {
+ !(function (e, t, r, i, a) {
+ let n = v(e),
+ s = (function (e) {
+ if (h) return h;
+ if (((h = e.createBuffer()), !h))
+ throw new Error("Unable to create buffer object");
+ return (
+ e.bindBuffer(e.ARRAY_BUFFER, h),
+ e.bufferData(
+ e.ARRAY_BUFFER,
+ new Float32Array([
+ -0.5, 0.125, 0, -0.5, -0.125, 0, 0.5, 0.125, 0, 0.5,
+ -0.125, 0,
+ ]),
+ e.STATIC_DRAW
+ ),
+ e.bindBuffer(e.ARRAY_BUFFER, null),
+ h
+ );
+ })(e),
+ o = g(e);
+ e.disable(e.DEPTH_TEST),
+ e.useProgram(n.prog),
+ e.uniformMatrix4fv(n.unif_proj, !1, t),
+ e.uniformMatrix4fv(n.unif_camera, !1, r),
+ e.uniformMatrix4fv(n.unif_matrix, !1, i),
+ e.bindBuffer(e.ARRAY_BUFFER, s),
+ e.activeTexture(e.TEXTURE0),
+ e.bindTexture(
+ e.TEXTURE_2D,
+ (function (e, t) {
+ if (m[t]) return m[t];
+ let r = e.createTexture();
+ if (!r) throw new Error("Unable to create texture");
+ (m[t] = r), e.bindTexture(e.TEXTURE_2D, r);
+ const i = e.RGBA,
+ a = e.RGBA,
+ n = e.UNSIGNED_BYTE,
+ s = new Uint8Array([0, 0, 255, 255]);
+ e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !0),
+ e.texImage2D(e.TEXTURE_2D, 0, i, 1, 1, 0, a, n, s);
+ const o = new Image();
+ return (
+ (o.onload = function () {
+ e.bindTexture(e.TEXTURE_2D, r),
+ e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL, !0),
+ e.texImage2D(e.TEXTURE_2D, 0, i, a, n, o),
+ 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.texParameteri(
+ e.TEXTURE_2D,
+ e.TEXTURE_MIN_FILTER,
+ e.LINEAR
+ );
+ }),
+ (o.src = t),
+ r
+ );
+ })(e, a)
+ ),
+ e.uniform1i(n.unif_skinSampler, 0),
+ e.vertexAttribPointer(
+ n.attr_position,
+ 3,
+ e.FLOAT,
+ !1,
+ 12,
+ 0
+ ),
+ e.enableVertexAttribArray(n.attr_position),
+ e.bindBuffer(e.ARRAY_BUFFER, o),
+ e.vertexAttribPointer(
+ n.attr_textureCoord,
+ 2,
+ e.FLOAT,
+ !1,
+ 8,
+ 0
+ ),
+ e.enableVertexAttribArray(n.attr_textureCoord),
+ e.drawArrays(e.TRIANGLE_STRIP, 0, 4),
+ e.disableVertexAttribArray(n.attr_position),
+ e.disableVertexAttribArray(n.attr_textureCoord),
+ e.bindBuffer(e.ARRAY_BUFFER, null);
+ })(e, t, r, i, a);
+ },
+ pipeline_draw_face: (e, t, r, i, a) => {
+ var n;
+ let s = ve(a);
+ if (!s)
+ return (
+ ge(
+ "attempting to call draw_face on a destroyed zappar_face_mesh_t"
+ ),
+ new Uint16Array()
+ );
+ null === (n = ct.get(e)) ||
+ void 0 === n ||
+ n.drawFace(t, r, i, s);
+ },
+ pipeline_draw_face_project: (e, t, r, i, a, n, s) => {
+ var o;
+ null === (o = ct.get(e)) ||
+ void 0 === o ||
+ o.drawFaceProject(t, r, i, a, n, s);
+ },
+ pipeline_draw_image_target_preview: (e, t, r, i, a, n) => {
+ var s;
+ let o = Ut.get(a);
+ o
+ ? null === (s = ct.get(e)) ||
+ void 0 === s ||
+ s.drawImageTargetPreview(t, r, i, n, o)
+ : ge("image tracker not found");
+ },
+ projection_matrix_from_camera_model: V,
+ projection_matrix_from_camera_model_ext: V,
+ pipeline_process_gl: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.processGL();
+ },
+ pipeline_gl_context_set: (e, t, r) => {
+ var i;
+ return null === (i = ct.get(e)) || void 0 === i
+ ? void 0
+ : i.glContextSet(t, r);
+ },
+ pipeline_gl_context_lost: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.glContextLost();
+ },
+ pipeline_camera_frame_upload_gl: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.uploadGL();
+ },
+ pipeline_camera_frame_texture_gl: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.cameraFrameTexture();
+ },
+ pipeline_camera_frame_texture_matrix: (e, t, r, i) => {
+ var a;
+ return (
+ (null === (a = ct.get(e)) || void 0 === a
+ ? void 0
+ : a.cameraFrameTextureMatrix(t, r, i)) || A()
+ );
+ },
+ pipeline_camera_frame_user_facing: (e) => {
+ var t;
+ return (
+ (null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.cameraFrameUserFacing()) || !1
+ );
+ },
+ pipeline_camera_pose_default: () => A(),
+ pipeline_camera_pose_with_attitude: (e, t) => {
+ var r;
+ return (
+ (null === (r = ct.get(e)) || void 0 === r
+ ? void 0
+ : r.cameraPoseWithAttitude(t)) || A()
+ );
+ },
+ pipeline_camera_pose_with_origin: (e, t) => {
+ let r = A();
+ return T(r, t), r;
+ },
+ pipeline_sequence_record_clear: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.sequenceRecordClear();
+ },
+ pipeline_sequence_record_start: (e, t) => {
+ var r;
+ return null === (r = ct.get(e)) || void 0 === r
+ ? void 0
+ : r.sequenceRecordStart(t);
+ },
+ pipeline_sequence_record_stop: (e) => {
+ var t;
+ return null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.sequenceRecordStop();
+ },
+ pipeline_sequence_record_device_attitude_matrices_set: (e, t) => {
+ var r;
+ return null === (r = ct.get(e)) || void 0 === r
+ ? void 0
+ : r.sequenceRecordDeviceAttitudeMatrices(t);
+ },
+ pipeline_sequence_record_data: (e) => {
+ var t;
+ return (
+ (null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.sequenceRecordData()) || new Uint8Array(0)
+ );
+ },
+ pipeline_sequence_record_data_size: (e) => {
+ var t;
+ return (
+ (null === (t = ct.get(e)) || void 0 === t
+ ? void 0
+ : t.sequenceRecordData().byteLength) || 0
+ );
+ },
+ instant_world_tracker_anchor_pose_camera_relative: (e, t) => {
+ let r = lt(
+ void 0,
+ i.impl.instant_world_tracker_anchor_pose_raw(e)
+ );
+ if (t) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(r, e, r), x(r, r, e);
+ }
+ return r;
+ },
+ instant_world_tracker_anchor_pose: (e, t, r) => {
+ let a = lt(
+ void 0,
+ i.impl.instant_world_tracker_anchor_pose_raw(e)
+ );
+ if (r) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(a, e, a), x(a, a, e);
+ }
+ return x(a, t, a), a;
+ },
+ instant_world_tracker_anchor_pose_set_from_camera_offset: (
+ e,
+ t,
+ r,
+ a,
+ n
+ ) => {
+ let s = (N(!1) * Math.PI) / 180,
+ o = A();
+ F(o, -s, [0, 0, 1]);
+ let _ = L();
+ S(_, [t, r, a], o),
+ i.impl.instant_world_tracker_anchor_pose_set_from_camera_offset_raw(
+ e,
+ _[0],
+ _[1],
+ _[2],
+ n
+ );
+ },
+ image_tracker_create: (e) => Ut.create(e, i.impl),
+ image_tracker_destroy: (e) => {
+ var t;
+ return null === (t = Ut.get(e)) || void 0 === t
+ ? void 0
+ : t.destroy();
+ },
+ image_tracker_target_type: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getTargetInfo(t).type
+ : (ge(
+ "attempting to call image_tracker_target_type on a destroyed zappar_image_tracker_t"
+ ),
+ o.IMAGE_TRACKER_TYPE_PLANAR);
+ },
+ image_tracker_target_count: (e) => {
+ let t = Ut.get(e);
+ return t
+ ? t.targetCount()
+ : (ge(
+ "attempting to call image_tracker_target_count on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_load_from_memory: (e, t) => {
+ let r = Ut.get(e);
+ if (!r)
+ return (
+ ge(
+ "attempting to call image_tracker_target_load_from_memory on a destroyed zappar_image_tracker_t"
+ ),
+ 0
+ );
+ r.loadFromMemory(t);
+ },
+ image_tracker_target_preview_compressed: (e, t) => {
+ var r;
+ let i = Ut.get(e);
+ return i
+ ? (null === (r = i.getTargetInfo(t).preview) || void 0 === r
+ ? void 0
+ : r.compressed) || new Uint8Array(0)
+ : (ge(
+ "attempting to call image_tracker_target_preview_compressed on a destroyed zappar_image_tracker_t"
+ ),
+ new Uint8Array(0));
+ },
+ image_tracker_target_preview_compressed_mimetype: (e, t) => {
+ var r;
+ let i = Ut.get(e);
+ return i
+ ? (null === (r = i.getTargetInfo(t).preview) || void 0 === r
+ ? void 0
+ : r.mimeType) || ""
+ : (ge(
+ "attempting to call image_tracker_target_preview_compressed_mimetype on a destroyed zappar_image_tracker_t"
+ ),
+ "");
+ },
+ image_tracker_target_preview_compressed_size: (e, t) => {
+ var r, i;
+ let a = Ut.get(e);
+ return a
+ ? (null ===
+ (i =
+ null === (r = a.getTargetInfo(t).preview) ||
+ void 0 === r
+ ? void 0
+ : r.compressed) || void 0 === i
+ ? void 0
+ : i.byteLength) || 0
+ : (ge(
+ "attempting to call image_tracker_target_preview_compressed_size on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_physical_scale_factor: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getTargetInfo(t).physicalScaleFactor
+ : (ge(
+ "attempting to call image_tracker_target_physical_scale_factor on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_radius_top: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getTargetInfo(t).topRadius
+ : (ge(
+ "attempting to call image_tracker_target_radius_top on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_radius_bottom: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getTargetInfo(t).bottomRadius
+ : (ge(
+ "attempting to call image_tracker_target_radius_bottom on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_side_length: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getTargetInfo(t).sideLength
+ : (ge(
+ "attempting to call image_tracker_target_side_length on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_image: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getDecodedPreview(t)
+ : (ge(
+ "attempting to call image_tracker_target_image on a destroyed zappar_image_tracker_t"
+ ),
+ new Image());
+ },
+ image_tracker_anchor_pose_camera_relative: (e, t, r) => {
+ let a = lt(void 0, i.impl.image_tracker_anchor_pose_raw(e, t));
+ if (r) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(a, e, a), x(a, a, e);
+ }
+ return a;
+ },
+ image_tracker_anchor_pose: (e, t, r, a) => {
+ let n = lt(void 0, i.impl.image_tracker_anchor_pose_raw(e, t));
+ if (a) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(n, e, n), x(n, n, e);
+ }
+ return x(n, r, n), n;
+ },
+ image_tracker_target_preview_mesh_indices: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).indices
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_indices on a destroyed zappar_image_tracker_t"
+ ),
+ new Uint16Array());
+ },
+ image_tracker_target_preview_mesh_vertices: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).vertices
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_vertices on a destroyed zappar_image_tracker_t"
+ ),
+ new Float32Array());
+ },
+ image_tracker_target_preview_mesh_uvs: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).uvs
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_uvs on a destroyed zappar_image_tracker_t"
+ ),
+ new Float32Array());
+ },
+ image_tracker_target_preview_mesh_normals: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).normals
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_normals on a destroyed zappar_image_tracker_t"
+ ),
+ new Float32Array());
+ },
+ image_tracker_target_preview_mesh_indices_size: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).indices.length
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_indices_size on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_preview_mesh_vertices_size: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).vertices.length
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_vertices_size on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_preview_mesh_uvs_size: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).uvs.length
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_uvs_size on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ image_tracker_target_preview_mesh_normals_size: (e, t) => {
+ let r = Ut.get(e);
+ return r
+ ? r.getPreviewMesh(t).normals.length
+ : (ge(
+ "attempting to call image_tracker_target_preview_mesh_normals_size on a destroyed zappar_image_tracker_t"
+ ),
+ 0);
+ },
+ face_tracker_anchor_pose_camera_relative: (e, t, r) => {
+ let a = lt(void 0, i.impl.face_tracker_anchor_pose_raw(e, t));
+ if (r) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(a, e, a), x(a, a, e);
+ }
+ return a;
+ },
+ face_tracker_anchor_pose: (e, t, r, a) => {
+ let n = lt(void 0, i.impl.face_tracker_anchor_pose_raw(e, t));
+ if (a) {
+ let e = A();
+ k(e, [-1, 1, 1]), x(n, e, n), x(n, n, e);
+ }
+ return x(n, r, n), n;
+ },
+ face_tracker_model_load_default: (e) =>
+ Pt(this, void 0, void 0, function* () {
+ yield (function (e) {
+ return Pt(this, void 0, void 0, function* () {
+ let t = new URL(r(367), r.b),
+ i = yield fetch(t.toString()),
+ a = yield i.arrayBuffer();
+ null == Bt ||
+ Bt.face_tracker_model_load_from_memory(e, a);
+ });
+ })(e);
+ }),
+ face_mesh_create: () =>
+ (function () {
+ let e = be++;
+ return we.set(e, new ye()), pe("face_mesh_t initialized"), e;
+ })(),
+ face_mesh_destroy: (e) => {
+ !(function (e) {
+ we.delete(e);
+ })(e);
+ },
+ face_mesh_indices: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getIndices()
+ : (ge(
+ "attempting to call face_mesh_indices on a destroyed zappar_face_mesh_t"
+ ),
+ new Uint16Array());
+ },
+ face_mesh_indices_size: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getIndices().length
+ : (ge(
+ "attempting to call face_mesh_indices_size on a destroyed zappar_face_mesh_t"
+ ),
+ 0);
+ },
+ face_mesh_uvs: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getUVs()
+ : (ge(
+ "attempting to call face_mesh_uvs on a destroyed zappar_face_mesh_t"
+ ),
+ new Float32Array());
+ },
+ face_mesh_uvs_size: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getUVs().length
+ : (ge(
+ "attempting to call face_mesh_uvs_size on a destroyed zappar_face_mesh_t"
+ ),
+ 0);
+ },
+ face_mesh_vertices: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getVertices()
+ : (ge(
+ "attempting to call face_mesh_vertices on a destroyed zappar_face_mesh_t"
+ ),
+ new Float32Array());
+ },
+ face_mesh_vertices_size: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getVertices().length
+ : (ge(
+ "attempting to call face_mesh_vertices_size on a destroyed zappar_face_mesh_t"
+ ),
+ 0);
+ },
+ face_mesh_normals: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getNormals()
+ : (ge(
+ "attempting to call face_mesh_normals on a destroyed zappar_face_mesh_t"
+ ),
+ new Float32Array());
+ },
+ face_mesh_normals_size: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getNormals().length
+ : (ge(
+ "attempting to call face_mesh_normals_size on a destroyed zappar_face_mesh_t"
+ ),
+ 0);
+ },
+ face_mesh_load_from_memory: (e, t, r, i, a, n) => {
+ let s = ve(e);
+ s
+ ? s.loadFromMemory(t, r, i, a, n)
+ : ge(
+ "attempting to call face_mesh_load_from_memory on a destroyed zappar_face_mesh_t"
+ );
+ },
+ face_mesh_update: (e, t, r, i) => {
+ let a = ve(e);
+ a
+ ? a.update(t, r, i)
+ : ge(
+ "attempting to call face_mesh_update on a destroyed zappar_face_mesh_t"
+ );
+ },
+ face_mesh_load_default: (e) =>
+ Pt(this, void 0, void 0, function* () {
+ let t = ve(e);
+ if (!t)
+ return void ge(
+ "attempting to call face_mesh_load_default on a destroyed zappar_face_mesh_t"
+ );
+ let i = new URL(r(698), r.b),
+ a = yield fetch(i.toString());
+ t.loadFromMemory(yield a.arrayBuffer(), !1, !1, !1, !1);
+ }),
+ face_mesh_load_default_face: (e, t, i, a) =>
+ Pt(this, void 0, void 0, function* () {
+ let n = ve(e);
+ if (!n)
+ return void ge(
+ "attempting to call face_mesh_load_default_face on a destroyed zappar_face_mesh_t"
+ );
+ let s = new URL(r(698), r.b),
+ o = yield fetch(s.toString());
+ n.loadFromMemory(yield o.arrayBuffer(), t, i, a, !1);
+ }),
+ face_mesh_load_default_full_head_simplified: (e, t, i, a, n) =>
+ Pt(this, void 0, void 0, function* () {
+ let s = ve(e);
+ if (!s)
+ return void ge(
+ "attempting to call face_mesh_load_default_full_head_simplified on a destroyed zappar_face_mesh_t"
+ );
+ let o = new URL(r(825), r.b),
+ _ = yield fetch(o.toString());
+ s.loadFromMemory(yield _.arrayBuffer(), t, i, a, n);
+ }),
+ face_mesh_loaded_version: (e) => {
+ let t = ve(e);
+ return t
+ ? t.getModelVersion()
+ : (ge(
+ "attempting to call face_mesh_load_default on a destroyed zappar_face_mesh_t"
+ ),
+ -1);
+ },
+ face_landmark_create: (e) =>
+ (function (e) {
+ let t = dt++;
+ return (
+ ft.set(t, new pt(e)), pe("face_landmark_t initialized"), t
+ );
+ })(e),
+ face_landmark_destroy: (e) => {
+ !(function (e) {
+ ft.delete(e);
+ })(e);
+ },
+ face_landmark_update: (e, t, r, i) => {
+ let a = ht(e);
+ a
+ ? a.update(t, r, i)
+ : ge(
+ "attempting to call face_landmark_update on a destroyed zappar_face_landmark_t"
+ );
+ },
+ face_landmark_anchor_pose: (e) => {
+ let t = ht(e);
+ return t
+ ? t.anchor_pose
+ : (ge(
+ "attempting to call face_landmark_anchor_pose on a destroyed zappar_face_landmark_t"
+ ),
+ A());
+ },
+ html_element_source_create: (e, t) =>
+ He.createVideoElementSource(e, t),
+ html_element_source_start: (e) => {
+ var t;
+ return null === (t = He.getVideoElementSource(e)) ||
+ void 0 === t
+ ? void 0
+ : t.start();
+ },
+ html_element_source_pause: (e) => {
+ var t;
+ return null === (t = He.getVideoElementSource(e)) ||
+ void 0 === t
+ ? void 0
+ : t.pause();
+ },
+ html_element_source_destroy: (e) => {
+ var t;
+ return null === (t = He.getVideoElementSource(e)) ||
+ void 0 === t
+ ? void 0
+ : t.destroy();
+ },
+ sequence_source_create: (e) => wt.create(e),
+ sequence_source_load_from_memory: (e, t) => {
+ var r;
+ return null === (r = wt.get(e)) || void 0 === r
+ ? void 0
+ : r.loadFromMemory(t);
+ },
+ sequence_source_pause: (e) => {
+ var t;
+ return null === (t = wt.get(e)) || void 0 === t
+ ? void 0
+ : t.pause();
+ },
+ sequence_source_start: (e) => {
+ var t;
+ return null === (t = wt.get(e)) || void 0 === t
+ ? void 0
+ : t.start();
+ },
+ sequence_source_max_playback_fps_set: (e, t) => {
+ var r;
+ return null === (r = wt.get(e)) || void 0 === r
+ ? void 0
+ : r.maxPlaybackFpsSet(t);
+ },
+ sequence_source_time_set: (e, t) => {
+ var r;
+ return null === (r = wt.get(e)) || void 0 === r
+ ? void 0
+ : r.setTime(t);
+ },
+ sequence_source_destroy: (e) => {
+ var t;
+ return null === (t = wt.get(e)) || void 0 === t
+ ? void 0
+ : t.destroy();
+ },
+ permission_granted_all: _e,
+ permission_granted_camera: ie,
+ permission_granted_motion: ae,
+ permission_denied_any: oe,
+ permission_denied_camera: ne,
+ permission_denied_motion: se,
+ permission_request_motion: ue,
+ permission_request_camera: le,
+ permission_request_all: ce,
+ permission_request_ui: de,
+ permission_request_ui_promise: de,
+ permission_denied_ui: fe,
+ browser_incompatible: mt.incompatible,
+ browser_incompatible_ui: mt.incompatible_ui,
+ log_level_set: (e) => {
+ !(function (e) {
+ he = e;
+ })(e),
+ i.impl.log_level_set(e);
+ },
+ cookies_permitted: (e) => {
+ var t;
+ e
+ ? n ||
+ ((t = a),
+ window.localStorage.setItem("z_uar_lid", t),
+ (n = !0))
+ : window.localStorage.removeItem("z_uar_lid");
+ },
+ })),
+ Bt
+ );
+ }
+ const zt = "2.1.9";
+ function Vt(e) {
+ return (function (e) {
+ return console.log(`Zappar CV v${zt}`), Ot(e);
+ })(
+ Object.assign(Object.assign({}, e), {
+ worker: (null == e ? void 0 : e.worker) || new (r(276).Z)(),
+ })
+ );
+ }
+ })(),
+ i
+ );
+ })();
+});