easyproctor-hml 2.5.35 → 2.5.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -9145,6 +9145,7 @@ var BaseDetection = class {
9145
9145
  // objectDetection
9146
9146
  runningMode: this.runningMode
9147
9147
  });
9148
+ console.log("BaseDetection initializeDetector", this.detectorType);
9148
9149
  }
9149
9150
  stopDetection() {
9150
9151
  this.animationFrameId && clearTimeout(this.animationFrameId);
@@ -9156,6 +9157,7 @@ var BaseDetection = class {
9156
9157
  }
9157
9158
  enableCam(cameraStream) {
9158
9159
  var _a2;
9160
+ console.log("BaseDetection enableCam");
9159
9161
  if (!this.detector) {
9160
9162
  console.log("Wait! Detector not loaded yet.");
9161
9163
  return;
@@ -9197,6 +9199,7 @@ var BaseDetection = class {
9197
9199
  }
9198
9200
  `;
9199
9201
  document.getElementsByTagName("head")[0].appendChild(style);
9202
+ console.log("BaseDetection enableCam OK");
9200
9203
  }
9201
9204
  async predictWebcam() {
9202
9205
  if (this.lastVideoTime === -1) {
@@ -9325,6 +9328,8 @@ var FaceDetection = class extends BaseDetection {
9325
9328
  );
9326
9329
  this.emmitedPositionAlert = false;
9327
9330
  this.emmitedFaceAlert = false;
9331
+ console.log("FaceDetection constructor");
9332
+ this.numFacesSent = -1;
9328
9333
  }
9329
9334
  stopDetection() {
9330
9335
  super.stopDetection();
@@ -9492,6 +9497,8 @@ var FaceDetection = class extends BaseDetection {
9492
9497
  }
9493
9498
  verify(result) {
9494
9499
  var _a2;
9500
+ console.log("this.numFacesSent", this.numFacesSent);
9501
+ console.log("result.detections.length", result.detections.length);
9495
9502
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
9496
9503
  this.numFacesSent = result.detections.length;
9497
9504
  if (result.detections.length === 0) {
@@ -22379,7 +22386,8 @@ var Proctoring = class {
22379
22386
  this.onChangeDevicesCallback = (devices) => {
22380
22387
  return;
22381
22388
  };
22382
- this.onRealtimeAlertsCallback = (response) => {
22389
+ this.onRealtimeAlertsCallback = async (response) => {
22390
+ await this.internalOnRealtimeAlerts(response);
22383
22391
  return;
22384
22392
  };
22385
22393
  this.onBufferSizeErrorCallback = (cameraStream) => {
@@ -22517,23 +22525,26 @@ var Proctoring = class {
22517
22525
  };
22518
22526
  await verifyFace(1);
22519
22527
  }
22528
+ async internalOnRealtimeAlerts(response) {
22529
+ if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
22530
+ if (response.status === "ALERT") {
22531
+ await this.backend.startRealtimeAlert({
22532
+ proctoringId: this.proctoringId,
22533
+ begin: response.begin,
22534
+ end: response.end,
22535
+ alert: this.convertRealtimeCategoryToAlertCategory(response.category)
22536
+ });
22537
+ } else if (response.status === "OK") {
22538
+ await this.stopRealtimeAlert(response);
22539
+ }
22540
+ }
22541
+ }
22520
22542
  async onRealtimeAlerts(options = {}) {
22521
22543
  this.setOnLostFocusAlertRecorderCallback();
22522
22544
  this.setOnFocusAlertRecorderCallback();
22523
22545
  this.onRealtimeAlertsCallback = async (response) => {
22546
+ await this.internalOnRealtimeAlerts(response);
22524
22547
  options.data && options.data(response);
22525
- if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
22526
- if (response.status === "ALERT") {
22527
- await this.backend.startRealtimeAlert({
22528
- proctoringId: this.proctoringId,
22529
- begin: response.begin,
22530
- end: response.end,
22531
- alert: this.convertRealtimeCategoryToAlertCategory(response.category)
22532
- });
22533
- } else if (response.status === "OK") {
22534
- await this.stopRealtimeAlert(response);
22535
- }
22536
- }
22537
22548
  };
22538
22549
  }
22539
22550
  setOnBufferSizeErrorCallback(cb) {
package/index.js CHANGED
@@ -26430,6 +26430,7 @@ var BaseDetection = class {
26430
26430
  // objectDetection
26431
26431
  runningMode: this.runningMode
26432
26432
  });
26433
+ console.log("BaseDetection initializeDetector", this.detectorType);
26433
26434
  }
26434
26435
  stopDetection() {
26435
26436
  this.animationFrameId && clearTimeout(this.animationFrameId);
@@ -26441,6 +26442,7 @@ var BaseDetection = class {
26441
26442
  }
26442
26443
  enableCam(cameraStream) {
26443
26444
  var _a2;
26445
+ console.log("BaseDetection enableCam");
26444
26446
  if (!this.detector) {
26445
26447
  console.log("Wait! Detector not loaded yet.");
26446
26448
  return;
@@ -26482,6 +26484,7 @@ var BaseDetection = class {
26482
26484
  }
26483
26485
  `;
26484
26486
  document.getElementsByTagName("head")[0].appendChild(style);
26487
+ console.log("BaseDetection enableCam OK");
26485
26488
  }
26486
26489
  async predictWebcam() {
26487
26490
  if (this.lastVideoTime === -1) {
@@ -26610,6 +26613,8 @@ var FaceDetection = class extends BaseDetection {
26610
26613
  );
26611
26614
  this.emmitedPositionAlert = false;
26612
26615
  this.emmitedFaceAlert = false;
26616
+ console.log("FaceDetection constructor");
26617
+ this.numFacesSent = -1;
26613
26618
  }
26614
26619
  stopDetection() {
26615
26620
  super.stopDetection();
@@ -26777,6 +26782,8 @@ var FaceDetection = class extends BaseDetection {
26777
26782
  }
26778
26783
  verify(result) {
26779
26784
  var _a2;
26785
+ console.log("this.numFacesSent", this.numFacesSent);
26786
+ console.log("result.detections.length", result.detections.length);
26780
26787
  if (((_a2 = this.paramsConfig.videoBehaviourParameters) == null ? void 0 : _a2.detectFace) && result.detections.length !== this.numFacesSent) {
26781
26788
  this.numFacesSent = result.detections.length;
26782
26789
  if (result.detections.length === 0) {
@@ -37628,7 +37635,8 @@ var Proctoring = class {
37628
37635
  this.onChangeDevicesCallback = (devices) => {
37629
37636
  return;
37630
37637
  };
37631
- this.onRealtimeAlertsCallback = (response) => {
37638
+ this.onRealtimeAlertsCallback = async (response) => {
37639
+ await this.internalOnRealtimeAlerts(response);
37632
37640
  return;
37633
37641
  };
37634
37642
  this.onBufferSizeErrorCallback = (cameraStream) => {
@@ -37766,23 +37774,26 @@ var Proctoring = class {
37766
37774
  };
37767
37775
  await verifyFace(1);
37768
37776
  }
37777
+ async internalOnRealtimeAlerts(response) {
37778
+ if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37779
+ if (response.status === "ALERT") {
37780
+ await this.backend.startRealtimeAlert({
37781
+ proctoringId: this.proctoringId,
37782
+ begin: response.begin,
37783
+ end: response.end,
37784
+ alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37785
+ });
37786
+ } else if (response.status === "OK") {
37787
+ await this.stopRealtimeAlert(response);
37788
+ }
37789
+ }
37790
+ }
37769
37791
  async onRealtimeAlerts(options = {}) {
37770
37792
  this.setOnLostFocusAlertRecorderCallback();
37771
37793
  this.setOnFocusAlertRecorderCallback();
37772
37794
  this.onRealtimeAlertsCallback = async (response) => {
37795
+ await this.internalOnRealtimeAlerts(response);
37773
37796
  options.data && options.data(response);
37774
- if (this.sessionOptions.proctoringType === "REALTIME" && (response.type === "face_detection_on_stream" || response.type === "person_detection_on_stream" || response.type === "lost_focus" || response.type === "focus")) {
37775
- if (response.status === "ALERT") {
37776
- await this.backend.startRealtimeAlert({
37777
- proctoringId: this.proctoringId,
37778
- begin: response.begin,
37779
- end: response.end,
37780
- alert: this.convertRealtimeCategoryToAlertCategory(response.category)
37781
- });
37782
- } else if (response.status === "OK") {
37783
- await this.stopRealtimeAlert(response);
37784
- }
37785
- }
37786
37797
  };
37787
37798
  }
37788
37799
  setOnBufferSizeErrorCallback(cb) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easyproctor-hml",
3
- "version": "2.5.35",
3
+ "version": "2.5.37",
4
4
  "description": "Modulo web de gravação do EasyProctor",
5
5
  "main": "./index.js",
6
6
  "module": "./esm/index.js",
@@ -73,6 +73,7 @@ export declare class Proctoring {
73
73
  private convertRealtimeTypeToWarningType;
74
74
  private stopRealtimeAlert;
75
75
  private onRealtimeAlertsCallback;
76
+ private internalOnRealtimeAlerts;
76
77
  onRealtimeAlerts(options?: ProctoringRealtimeAlertsOptions): Promise<void>;
77
78
  private onBufferSizeErrorCallback;
78
79
  setOnBufferSizeErrorCallback(cb: (cameraStream?: any) => void): void;
@@ -46,7 +46,7 @@ Minimum version required to store current data is: `+o+`.
46
46
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
47
47
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
48
48
  }
49
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=dn(this,e),e.activeTexture(e.TEXTURE2),this.B=dn(this,e)}m(){super.m();let e=this.g;this.J=yt(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=yt(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=yt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Wr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Nl(e){var t=Wr(e,1);if(!t){if(t=Wr(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);let n=wi(e);var r=jh(e);if(fa(r,n,Km(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let i=0,o=0;i<t.length;++i,o+=4)t[i]=r[o]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Km(e){let t=Wr(e,2);if(!t){let r=wi(e);t=Jm(e);let n=Nl(e),i=Xm(e);r.texImage2D(r.TEXTURE_2D,0,i,e.width,e.height,0,r.RED,r.FLOAT,n),zl(e)}return t}function wi(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Xm(e){if(e=wi(e),!Cs)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Cs=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Cs=e.R16F}return Cs}function jh(e){return e.l||(e.l=new Di),e.l}function Jm(e){let t=wi(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Wr(e,2);return r||(r=dn(jh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function zl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Cs,ot=class{constructor(e,t,r,n,i,o,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=i,this.width=o,this.height=s,this.j&&--Hp===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Wr(this,0)}ja(){return!!Wr(this,1)}P(){return!!Wr(this,2)}ia(){return(t=Wr(e=this,0))||(t=Nl(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return Nl(this)}M(){return Km(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=wi(this),i=jh(this);n.activeTexture(n.TEXTURE1),r=dn(i,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let o=Xm(this);n.texImage2D(n.TEXTURE_2D,0,o,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),fa(i,n,r),Ro(i,n,!1,(()=>{Jm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),zl(this)})),zh(i),zl(this)}}e.push(r)}return new ot(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&wi(this).deleteTexture(Wr(this,2)),Hp=-1}};ot.prototype.close=ot.prototype.close,ot.prototype.clone=ot.prototype.clone,ot.prototype.getAsWebGLTexture=ot.prototype.M,ot.prototype.getAsFloat32Array=ot.prototype.ha,ot.prototype.getAsUint8Array=ot.prototype.ia,ot.prototype.hasWebGLTexture=ot.prototype.P,ot.prototype.hasFloat32Array=ot.prototype.ja,ot.prototype.hasUint8Array=ot.prototype.Fa;var Hp=250,Yb={color:"white",lineWidth:4,radius:6};function kl(e){return{...Yb,fillColor:(e=e||{}).color,...e}}function Vr(e,t){return e instanceof Function?e(t):e}function Wp(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function po(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Eo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function $p(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Di;let i=Eo(e);r((e=new ot([n],t.m,!1,i.canvas,e.m,t.width,t.height)).M()),e.close()}}function Gp(e,t,r,n){let i=(function(a){return a.g||(a.g=new Xb),a.g})(e),o=Eo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ro(i,o,!0,(()=>{(function(c,l,h,d){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,l),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.B),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,h),c.H&&(function(p,g){if(p!==g)return!1;p=p.entries(),g=g.entries();for(let[b,_]of p){p=b;let E=_;var f=g.next();if(f.done)return!1;let[k,R]=f.value;if(f=R,p!==k||E[0]!==f[0]||E[1]!==f[1]||E[2]!==f[2]||E[3]!==f[3])return!1}return!!g.next().done})(c.H,d))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.H=d;let p=Array(1024).fill(0);d.forEach(((g,f)=>{if(g.length!==4)throw Error(`Color at index ${f} is not a four-channel value.`);p[4*f]=g[0],p[4*f+1]=g[1],p[4*f+2]=g[2],p[4*f+3]=g[3]})),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(p))}})(i,t,s,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4);let a=i.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)}))}function qp(e,t,r,n){let i=Eo(e),o=(function(c){return c.h||(c.h=new Jb),c.h})(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Ro(o,i,!0,(()=>{var c=o.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,o.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,o.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(c=o.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)}))}var Et=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=po(this);t=kl(t),r.save();var n=r.canvas,i=0;for(let o of e)r.fillStyle=Vr(t.fillColor,{index:i,from:o}),r.strokeStyle=Vr(t.color,{index:i,from:o}),r.lineWidth=Vr(t.lineWidth,{index:i,from:o}),(e=new Path2D).arc(o.x*n.width,o.y*n.height,Vr(t.radius,{index:i,from:o}),0,2*Math.PI),r.fill(e),r.stroke(e),++i;r.restore()}}xa(e,t,r){if(e&&t){var n=po(this);r=kl(r),n.save();var i=n.canvas,o=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=Vr(r.color,{index:o,from:t,to:a}),n.lineWidth=Vr(r.lineWidth,{index:o,from:t,to:a}),n.moveTo(t.x*i.width,t.y*i.height),n.lineTo(a.x*i.width,a.y*i.height)),++o,n.stroke()}n.restore()}}ua(e,t){let r=po(this);t=kl(t),r.save(),r.beginPath(),r.lineWidth=Vr(t.lineWidth,{}),r.strokeStyle=Vr(t.color,{}),r.fillStyle=Vr(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?(function(n,i,o,s){let a=Eo(n);$p(n,i,(c=>{Gp(n,c,o,s),(c=po(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Gp(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,i,o,s){let a=Eo(n);$p(n,i,(c=>{qp(n,c,o,s),(c=po(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):qp(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Pr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof ImageData));case 1:return e.g.find((r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Ym(e){var t=Pr(e,0);if(!t){t=Si(e);let r=ma(e),n=new Uint8Array(e.width*e.height*4);fa(r,t,Ds(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),zh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Ds(e){let t=Pr(e,2);if(!t){let r=Si(e);t=Bs(e);let n=Pr(e,1)||Ym(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),mo(e)}return t}function Si(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function ma(e){return e.l||(e.l=new Di),e.l}function Bs(e){let t=Si(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Pr(e,2);return r||(r=dn(ma(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function mo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Kp(e){let t=Si(e);return Ro(ma(e),t,!0,(()=>(function(r,n){let i=r.canvas;if(i.width===r.width&&i.height===r.height)return n();let o=i.width,s=i.height;return i.width=r.width,i.height=r.height,r=n(),i.width=o,i.height=s,r})(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}Et.prototype.close=Et.prototype.close,Et.prototype.drawConfidenceMask=Et.prototype.wa,Et.prototype.drawCategoryMask=Et.prototype.va,Et.prototype.drawBoundingBox=Et.prototype.ua,Et.prototype.drawConnectors=Et.prototype.xa,Et.prototype.drawLandmarks=Et.prototype.ya,Et.lerp=function(e,t,r,n,i){return Wp(n*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t)),n,i)},Et.clamp=Wp;var ht=class{constructor(e,t,r,n,i,o,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=i,this.width=o,this.height=s,(this.j||this.m)&&--Xp===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Pr(this,0)}ka(){return!!Pr(this,1)}P(){return!!Pr(this,2)}Ca(){return Ym(this)}Ba(){var e=Pr(this,1);return e||(Ds(this),Bs(this),e=Kp(this),mo(this),this.g.push(e),this.j=!0),e}M(){return Ds(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Si(this),i=ma(this);n.activeTexture(n.TEXTURE1),r=dn(i,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),fa(i,n,r),Ro(i,n,!1,(()=>{Bs(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),mo(this)})),zh(i),mo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Ds(this),Bs(this),r=Kp(this),mo(this)}e.push(r)}return new ht(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Pr(this,1).close(),this.m&&Si(this).deleteTexture(Pr(this,2)),Xp=-1}};ht.prototype.close=ht.prototype.close,ht.prototype.clone=ht.prototype.clone,ht.prototype.getAsWebGLTexture=ht.prototype.M,ht.prototype.getAsImageBitmap=ht.prototype.Ba,ht.prototype.getAsImageData=ht.prototype.Ca,ht.prototype.hasWebGLTexture=ht.prototype.P,ht.prototype.hasImageBitmap=ht.prototype.ka,ht.prototype.hasImageData=ht.prototype.Ea;var Xp=250;function gr(...e){return e.map((([t,r])=>({start:t,end:r})))}var Zb=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Jp=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Gm()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Q(this,n||"input_audio",(o=>{Q(this,i=i||"audio_header",(s=>{this.i._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Tr(this,"__graph_config__",(t=>{e(t)})),Q(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(e,this.g/4),Q(this,n,(s=>{this.i._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){Q(this,t,(n=>{let[i,o]=Mp(this,e,n);this.i._addBoundTextureToStream(n,i,o,r)}))}addBoolToStream(e,t,r){Q(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){Q(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){Q(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){Q(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){Q(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){Q(this,t,(n=>{Q(this,e,(i=>{this.i._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){Q(this,t,(n=>{Np(this,Object.keys(e),(i=>{Np(this,Object.values(e),(o=>{this.i._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){Q(this,r,(i=>{Q(this,t,(o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,o,i,n),this.i._free(s)}))}))}addEmptyPacketToStream(e,t){Q(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(i,o);this.i._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)Q(this,o,(s=>{this.i._addStringVectorEntry(i,s)}));this.i._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){Q(this,t,(r=>{Q(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){Q(this,r,(n=>{Q(this,t,(i=>{let o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputSidePacket(o,e.length,i,n),this.i._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)Q(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Tr(this,e,t),Q(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){rn(this,e,t),Q(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Tr(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),Q(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Jp{get ea(){return this.i}qa(e,t,r){Q(this,t,(n=>{let[i,o]=Mp(this,e,n);this.ea._addBoundTextureAsImageToStream(n,i,o,r)}))}U(e,t){Tr(this,e,t),Q(this,e,(r=>{this.ea._attachImageListener(r)}))}ca(e,t){rn(this,e,t),Q(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),Jp,tr=class extends Zb{};async function pe(e,t,r){return(async function(n,i,o,s){return Kb(n,i,o,s)})(e,r.canvas??(Gm()?void 0:document.createElement("canvas")),t,r)}function Zm(e,t,r,n){if(e.T){let o=new wm;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var i=r.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Z(o,1,(i.left+i.right)/2),Z(o,2,(i.top+i.bottom)/2),Z(o,4,i.right-i.left),Z(o,3,i.bottom-i.top)}else Z(o,1,.5),Z(o,2,.5),Z(o,4,1),Z(o,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(Z(o,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=qm(t);r=Je(o,3)*a/s,i=Je(o,4)*s/a,Z(o,4,r),Z(o,3,i)}}e.g.addProtoToStream(o.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function rr(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Zm(e,t,r,e.B+1)}function Br(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Zm(e,t,r,n)}function ki(e,t,r,n){var i=t.data;let o=t.width,s=o*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==s)throw Error("Unsupported channel count: "+i.length/s);return e=new ot([i],r,!1,e.g.i.canvas,e.O,o,t),n?e.clone():e}var It=class extends Ps{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Di}l(e,t=!0){if("runningMode"in e&&So(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};It.prototype.close=It.prototype.close;var Ct=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},ne(e=this.h=new ha,0,1,t=new Le),Z(this.h,2,.5),Z(this.h,3,.3)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Z(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Z(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},rr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect_in"),be(e,"detections");let t=new Nt;pr(t,Ob,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect_in"),fe(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=bm(o),this.j.detections.push(Wm(n));J(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ct.prototype.detectForVideo=Ct.prototype.F,Ct.prototype.detect=Ct.prototype.D,Ct.prototype.setOptions=Ct.prototype.o,Ct.createFromModelPath=async function(e,t){return pe(Ct,e,{baseOptions:{modelAssetPath:t}})},Ct.createFromModelBuffer=function(e,t){return pe(Ct,e,{baseOptions:{modelAssetBuffer:t}})},Ct.createFromOptions=function(e,t){return pe(Ct,e,t)};var Vh=gr([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Hh=gr([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Wh=gr([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Qm=gr([474,475],[475,476],[476,477],[477,474]),$h=gr([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Gh=gr([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),eg=gr([469,470],[470,471],[471,472],[472,469]),qh=gr([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),tg=[...Vh,...Hh,...Wh,...$h,...Gh,...qh],rg=gr([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Yp(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var He=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,ne(e=this.h=new Cm,0,1,t=new Le),this.v=new xm,ne(this.h,0,3,this.v),this.s=new ha,ne(this.h,0,2,this.s),Dr(this.s,4,1),Z(this.s,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numFaces"in e&&Dr(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Z(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Yp(this),rr(this,e,t),this.j}F(e,t,r){return Yp(this),Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"face_landmarks");let t=new Nt;pr(t,Fb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.j.faceLandmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{J(this,n)})),this.outputFaceBlendshapes&&(be(e,"blendshapes"),fe(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,i)=>{if(this.outputFaceBlendshapes)for(let o of n)n=la(o),this.j.faceBlendshapes.push(Mh(n.g()??[]));J(this,i)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{J(this,n)}))),this.outputFacialTransformationMatrixes&&(be(e,"face_geometry"),fe(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,i)=>{if(this.outputFacialTransformationMatrixes)for(let o of n)(n=ye(Ub(o),Cb,2))&&this.j.facialTransformationMatrixes.push({rows:Yt(n,1)??0??0,columns:Yt(n,2)??0??0,data:Ln(n,3,pn,Fn()).slice()??[]});J(this,i)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{J(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(e,t){return pe(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return pe(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return pe(He,e,t)},He.FACE_LANDMARKS_LIPS=Vh,He.FACE_LANDMARKS_LEFT_EYE=Hh,He.FACE_LANDMARKS_LEFT_EYEBROW=Wh,He.FACE_LANDMARKS_LEFT_IRIS=Qm,He.FACE_LANDMARKS_RIGHT_EYE=$h,He.FACE_LANDMARKS_RIGHT_EYEBROW=Gh,He.FACE_LANDMARKS_RIGHT_IRIS=eg,He.FACE_LANDMARKS_FACE_OVAL=qh,He.FACE_LANDMARKS_CONTOURS=tg,He.FACE_LANDMARKS_TESSELATION=rg;var Ir=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!0),ne(e=this.j=new Tm,0,1,t=new Le)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,rr(this,e,n??{}),!this.h)return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"stylized_image");let t=new Nt;pr(t,Lb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Vt(e,r),this.g.U("stylized_image",((n,i)=>{var o=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)l[4*h]=s[3*h],l[4*h+1]=s[3*h+1],l[4*h+2]=s[3*h+2],l[4*h+3]=255;s=new ImageData(l,a,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new ht([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=o=o?a.clone():a,this.h&&this.h(o),J(this,i)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ir.prototype.stylize=Ir.prototype.Oa,Ir.prototype.setOptions=Ir.prototype.o,Ir.createFromModelPath=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetPath:t}})},Ir.createFromModelBuffer=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetBuffer:t}})},Ir.createFromOptions=function(e,t){return pe(Ir,e,t)};var Kh=gr([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Zp(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Qp(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function ef(e,t=!0){let r=[];for(let i of e){var n=la(i);e=[];for(let o of n.g())n=t&&Yt(o,1)!=null?Yt(o,1)??0:-1,e.push({score:Je(o,2)??0,index:n,categoryName:Qt(o,3)??""??"",displayName:Qt(o,4)??""??""});r.push(e)}return r}var Ut=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.j=new Pm,0,1,t=new Le),this.s=new Oh,ne(this.j,0,2,this.s),this.C=new Bh,ne(this.s,0,3,this.C),this.v=new Rm,ne(this.s,0,2,this.v),this.h=new Mb,ne(this.j,0,3,this.h),Z(this.v,2,.5),Z(this.s,4,.5),Z(this.C,2,.5)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){if(Dr(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new si,r=t,n=Ll(e.cannedGesturesClassifierOptions,ye(this.h,si,3)?.h());ne(r,0,2,n),ne(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&ye(this.h,si,3)?.g();return e.customGesturesClassifierOptions?(ne(r=t=new si,0,2,n=Ll(e.customGesturesClassifierOptions,ye(this.h,si,4)?.h())),ne(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&ye(this.h,si,4)?.g(),this.l(e)}Ja(e,t){return Zp(this),rr(this,e,t),Qp(this)}Ka(e,t,r){return Zp(this),Br(this,e,r,t),Qp(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_gestures"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;pr(t,Nb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"HAND_GESTURES:hand_gestures"),fe(r,"LANDMARKS:hand_landmarks"),fe(r,"WORLD_LANDMARKS:world_hand_landmarks"),fe(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n){n=Io(o);let s=[];for(let a of Kr(n,_m,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.landmarks.push(s)}J(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n){n=pi(o);let s=[];for(let a of Kr(n,vm,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.worldLandmarks.push(s)}J(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,i)=>{this.gestures.push(...ef(n,!1)),J(this,i)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{J(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{this.handedness.push(...ef(n)),J(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function tf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ut.prototype.recognizeForVideo=Ut.prototype.Ka,Ut.prototype.recognize=Ut.prototype.Ja,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return pe(Ut,e,t)},Ut.HAND_CONNECTIONS=Kh;var Ft=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.h=new Oh,0,1,t=new Le),this.s=new Bh,ne(this.h,0,3,this.s),this.j=new Rm,ne(this.h,0,2,this.j),Dr(this.j,3,1),Z(this.j,2,.5),Z(this.s,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numHands"in e&&Dr(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],rr(this,e,t),tf(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Br(this,e,r,t),tf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;pr(t,zb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"LANDMARKS:hand_landmarks"),fe(r,"WORLD_LANDMARKS:world_hand_landmarks"),fe(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.landmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n)n=pi(o),this.worldLandmarks.push(vo(n));J(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{var o=this.handedness,s=o.push;let a=[];for(let c of n){n=la(c);let l=[];for(let h of n.g())l.push({score:Je(h,2)??0,index:Yt(h,1)??0??-1,categoryName:Qt(h,3)??""??"",displayName:Qt(h,4)??""??""});a.push(l)}s.call(o,...a),J(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.prototype.detectForVideo=Ft.prototype.F,Ft.prototype.detect=Ft.prototype.D,Ft.prototype.setOptions=Ft.prototype.o,Ft.createFromModelPath=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetPath:t}})},Ft.createFromModelBuffer=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetBuffer:t}})},Ft.createFromOptions=function(e,t){return pe(Ft,e,t)},Ft.HAND_CONNECTIONS=Kh;var ng=gr([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function rf(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function nf(e){try{if(!e.C)return e.h;e.C(e.h)}finally{pa(e)}}function As(e,t){e=Io(e),t.push(da(e))}var Ue=class extends It{constructor(e,t){super(new tr(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,ne(e=this.j=new Fm,0,1,t=new Le),this.J=new Bh,ne(this.j,0,2,this.J),this.Z=new jb,ne(this.j,0,3,this.Z),this.s=new ha,ne(this.j,0,4,this.s),this.H=new xm,ne(this.j,0,5,this.H),this.v=new Om,ne(this.j,0,6,this.v),this.K=new Um,ne(this.j,0,7,this.K),Z(this.s,2,.5),Z(this.s,3,.3),Z(this.H,2,.5),Z(this.v,2,.5),Z(this.v,3,.3),Z(this.K,2,.5),Z(this.J,2,.5)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&Z(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&Z(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&Z(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&Z(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&Z(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&Z(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,rf(this),rr(this,e,n),nf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,rf(this),Br(this,e,i,t),nf(this)}m(){var e=new Rt;Oe(e,"input_frames_image"),be(e,"pose_landmarks"),be(e,"pose_world_landmarks"),be(e,"face_landmarks"),be(e,"left_hand_landmarks"),be(e,"left_hand_world_landmarks"),be(e,"right_hand_landmarks"),be(e,"right_hand_world_landmarks");let t=new Nt,r=new Sp;Rl(r,1,Ci("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(i,o){if(o!=null)if(Array.isArray(o))Re(i,2,Rf(o));else{if(!(typeof o=="string"||o instanceof Gr||xo(o)))throw Error("invalid value in Any.value field: "+o+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Rl(i,2,Yl(o,!1),zn())}})(r,this.j.g());let n=new bt;jt(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Ns(n,8,Sp,r),Pe(n,"IMAGE:input_frames_image"),fe(n,"POSE_LANDMARKS:pose_landmarks"),fe(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),fe(n,"FACE_LANDMARKS:face_landmarks"),fe(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),fe(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),fe(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),fe(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Vt(e,n),ua(this,e),this.g.attachProtoListener("pose_landmarks",((i,o)=>{As(i,this.h.poseLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("pose_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("pose_world_landmarks",((i,o)=>{var s=this.h.poseWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(i=>{J(this,i)})),this.outputPoseSegmentationMasks&&(fe(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),_i(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((i,o)=>{this.h.poseSegmentationMasks=[ki(this,i,!0,!this.C)],J(this,o)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(i=>{this.h.poseSegmentationMasks=[],J(this,i)}))),this.g.attachProtoListener("face_landmarks",((i,o)=>{As(i,this.h.faceLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(i=>{J(this,i)})),this.outputFaceBlendshapes&&(be(e,"extra_blendshapes"),fe(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((i,o)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(i=la(i),s.push(Mh(i.g()??[]))),J(this,o)})),this.g.attachEmptyPacketListener("extra_blendshapes",(i=>{J(this,i)}))),this.g.attachProtoListener("left_hand_landmarks",((i,o)=>{As(i,this.h.leftHandLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("left_hand_world_landmarks",((i,o)=>{var s=this.h.leftHandWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("right_hand_landmarks",((i,o)=>{As(i,this.h.rightHandLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("right_hand_world_landmarks",((i,o)=>{var s=this.h.rightHandWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(i=>{J(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.detectForVideo=Ue.prototype.F,Ue.prototype.detect=Ue.prototype.D,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return pe(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return pe(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return pe(Ue,e,t)},Ue.HAND_CONNECTIONS=Kh,Ue.POSE_CONNECTIONS=ng,Ue.FACE_LANDMARKS_LIPS=Vh,Ue.FACE_LANDMARKS_LEFT_EYE=Hh,Ue.FACE_LANDMARKS_LEFT_EYEBROW=Wh,Ue.FACE_LANDMARKS_LEFT_IRIS=Qm,Ue.FACE_LANDMARKS_RIGHT_EYE=$h,Ue.FACE_LANDMARKS_RIGHT_EYEBROW=Gh,Ue.FACE_LANDMARKS_RIGHT_IRIS=eg,Ue.FACE_LANDMARKS_FACE_OVAL=qh,Ue.FACE_LANDMARKS_CONTOURS=tg,Ue.FACE_LANDMARKS_TESSELATION=rg;var Xt=class extends It{constructor(e,t){super(new tr(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},ne(e=this.h=new Lm,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return ne(this.h,0,2,Ll(e,ye(this.h,Rh,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},rr(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_image"),Oe(e,"norm_rect"),be(e,"classifications");let t=new Nt;pr(t,Vb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Pe(r,"IMAGE:input_image"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"CLASSIFICATIONS:classifications"),r.o(t),Vt(e,r),this.g.attachProtoListener("classifications",((n,i)=>{this.j=(function(o){let s={classifications:Kr(o,Tb,1).map((a=>Mh(ye(a,gm,4)?.g()??[],Yt(a,2)??0,Qt(a,3)??"")))};return Ms(bi(o,2))!=null&&(s.timestampMs=Ms(bi(o,2))??0),s})(Ib(n)),J(this,i)})),this.g.attachEmptyPacketListener("classifications",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Xt.prototype.classifyForVideo=Xt.prototype.ta,Xt.prototype.classify=Xt.prototype.sa,Xt.prototype.setOptions=Xt.prototype.o,Xt.createFromModelPath=function(e,t){return pe(Xt,e,{baseOptions:{modelAssetPath:t}})},Xt.createFromModelBuffer=function(e,t){return pe(Xt,e,{baseOptions:{modelAssetBuffer:t}})},Xt.createFromOptions=function(e,t){return pe(Xt,e,t)};var Lt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!0),this.h=new Mm,this.embeddings={embeddings:[]},ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){var t=this.h,r=ye(this.h,Pp,2);return r=r?r.clone():new Pp,e.l2Normalize!==void 0?So(r,1,e.l2Normalize):"l2Normalize"in e&&Re(r,1),e.quantize!==void 0?So(r,2,e.quantize):"quantize"in e&&Re(r,2),ne(t,0,2,r),this.l(e)}za(e,t){return rr(this,e,t),this.embeddings}Aa(e,t,r){return Br(this,e,r,t),this.embeddings}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"embeddings_out");let t=new Nt;pr(t,Hb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"EMBEDDINGS:embeddings_out"),r.o(t),Vt(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=Db(n),this.embeddings=(function(o){return{embeddings:Kr(o,Pb,1).map((s=>{let a={headIndex:Yt(s,3)??0??-1,headName:Qt(s,4)??""??""};if(Uf(s,Rp,yl(s,1))!==void 0)s=Ln(s=ye(s,Rp,yl(s,1)),1,pn,Fn()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=ye(s,Rb,yl(s,2))?.oa()?.h()??c}return a})),timestampMs:Ms(bi(o,2))??0}})(n),J(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Lt.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Fp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Fp(Up(e.quantizedEmbedding),Up(t.quantizedEmbedding))}return e},Lt.prototype.embedForVideo=Lt.prototype.Aa,Lt.prototype.embed=Lt.prototype.za,Lt.prototype.setOptions=Lt.prototype.o,Lt.createFromModelPath=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetPath:t}})},Lt.createFromModelBuffer=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetBuffer:t}})},Lt.createFromOptions=function(e,t){return pe(Lt,e,t)};var jl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function of(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function sf(e){try{let t=new jl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{pa(e)}}jl.prototype.close=jl.prototype.close;var xt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lh,this.v=new Nm,ne(this.h,0,3,this.v),ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ci(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=Kr(e.da(),bt,1).filter((r=>(Qt(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(ye(t[0],Nt,7)?.l()?.g()??new Map).forEach(((r,n)=>{e.s[Number(n)]=Qt(r,1)??""}))})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,of(this),rr(this,e,n),sf(this)}Ma(e,t,r,n){let i=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,of(this),Br(this,e,i,t),sf(this)}Da(){return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect");let t=new Nt;pr(t,jm,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),r.o(t),Vt(e,r),ua(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),fe(r,"CONFIDENCE_MASKS:confidence_masks"),_i(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),J(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],J(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),fe(r,"CATEGORY_MASK:category_mask"),_i(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),J(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,J(this,n)}))),be(e,"quality_scores"),fe(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,J(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xt.prototype.getLabels=xt.prototype.Da,xt.prototype.segmentForVideo=xt.prototype.Ma,xt.prototype.segment=xt.prototype.segment,xt.prototype.setOptions=xt.prototype.o,xt.createFromModelPath=function(e,t){return pe(xt,e,{baseOptions:{modelAssetPath:t}})},xt.createFromModelBuffer=function(e,t){return pe(xt,e,{baseOptions:{modelAssetBuffer:t}})},xt.createFromOptions=function(e,t){return pe(xt,e,t)};var Vl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};Vl.prototype.close=Vl.prototype.close;var Qb=class extends Y{constructor(e){super(e)}},ai=[0,$e,-2],Hs=[0,Hr,-3,Fe,Hr,-1],af=[0,Hs],cf=[0,Hs,$e,-1],El=class extends Y{constructor(e){super(e)}},lf=[0,Hr,-1,Fe],ev=class extends Y{constructor(e){super(e)}},hf=class extends Y{constructor(e){super(e)}},Hl=[1,2,3,4,5,6,7,8,9,10,14,15],ig=class extends Y{constructor(e){super(e)}};ig.prototype.g=ca([0,st,[0,Hl,Ee,Hs,Ee,[0,Hs,ai],Ee,af,Ee,[0,af,ai],Ee,lf,Ee,[0,Hr,-3,Fe,er],Ee,[0,Hr,-3,Fe],Ee,[0,we,Hr,-2,Fe,$e,Fe,-1,2,Hr,ai],Ee,cf,Ee,[0,cf,ai],Hr,ai,we,Ee,[0,Hr,-3,Fe,ai,-1],Ee,[0,st,lf]],we,[0,we,$e,-1,Fe]]);var Rr=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lh,this.s=new Nm,ne(this.h,0,3,this.s),ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let i=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new ig;let o=new hf;var s=new Qb;if(Dr(s,1,255),ne(o,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new El;So(a,3,!0),Z(a,1,t.keypoint.x),Z(a,2,t.keypoint.y),yo(o,5,Hl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new ev,t.scribble))So(t=new El,3,!0),Z(t,1,a.x),Z(t,2,a.y),Ns(s,1,El,t);yo(o,15,Hl,s)}Ns(n,1,hf,o),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),rr(this,e,i);e:{try{let l=new Vl(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{pa(this)}c=void 0}return c}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"roi_in"),Oe(e,"norm_rect_in");let t=new Nt;pr(t,jm,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"ROI:roi_in"),Pe(r,"NORM_RECT:norm_rect_in"),r.o(t),Vt(e,r),ua(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),fe(r,"CONFIDENCE_MASKS:confidence_masks"),_i(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),J(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],J(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),fe(r,"CATEGORY_MASK:category_mask"),_i(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),J(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,J(this,n)}))),be(e,"quality_scores"),fe(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,J(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Rr.prototype.segment=Rr.prototype.segment,Rr.prototype.setOptions=Rr.prototype.o,Rr.createFromModelPath=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetPath:t}})},Rr.createFromModelBuffer=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetBuffer:t}})},Rr.createFromOptions=function(e,t){return pe(Rr,e,t)};var At=class extends It{constructor(e,t){super(new tr(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},ne(e=this.h=new Vm,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ci(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),e.maxResults!==void 0?Dr(this.h,3,e.maxResults):"maxResults"in e&&Re(this.h,3),e.scoreThreshold!==void 0?Z(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Re(this.h,4),e.categoryAllowlist!==void 0?zs(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Re(this.h,5),e.categoryDenylist!==void 0?zs(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Re(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},rr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_frame_gpu"),Oe(e,"norm_rect"),be(e,"detections");let t=new Nt;pr(t,$b,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),Pe(r,"IMAGE:input_frame_gpu"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=bm(o),this.j.detections.push(Wm(n));J(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};At.prototype.detectForVideo=At.prototype.F,At.prototype.detect=At.prototype.D,At.prototype.setOptions=At.prototype.o,At.createFromModelPath=async function(e,t){return pe(At,e,{baseOptions:{modelAssetPath:t}})},At.createFromModelBuffer=function(e,t){return pe(At,e,{baseOptions:{modelAssetBuffer:t}})},At.createFromOptions=function(e,t){return pe(At,e,t)};var Wl=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function df(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function uf(e){try{let t=new Wl(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{pa(e)}}Wl.prototype.close=Wl.prototype.close;var Mt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,ne(e=this.h=new Hm,0,1,t=new Le),this.v=new Um,ne(this.h,0,3,this.v),this.j=new Om,ne(this.h,0,2,this.j),Dr(this.j,4,1),Z(this.j,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numPoses"in e&&Dr(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Z(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Z(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,df(this),rr(this,e,n),uf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,df(this),Br(this,e,i,t),uf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"normalized_landmarks"),be(e,"world_landmarks"),be(e,"segmentation_masks");let t=new Nt;pr(t,Gb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"NORM_LANDMARKS:normalized_landmarks"),fe(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Vt(e,r),ua(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,i)=>{this.landmarks=[];for(let o of n)n=Io(o),this.landmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],J(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,i)=>{this.worldLandmarks=[];for(let o of n)n=pi(o),this.worldLandmarks.push(vo(n));J(this,i)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],J(this,n)})),this.outputSegmentationMasks&&(fe(r,"SEGMENTATION_MASK:segmentation_masks"),_i(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,i)=>{this.segmentationMasks=n.map((o=>ki(this,o,!0,!this.s))),J(this,i)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],J(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mt.prototype.detectForVideo=Mt.prototype.F,Mt.prototype.detect=Mt.prototype.D,Mt.prototype.setOptions=Mt.prototype.o,Mt.createFromModelPath=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetPath:t}})},Mt.createFromModelBuffer=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetBuffer:t}})},Mt.createFromOptions=function(e,t){return pe(Mt,e,t)},Mt.POSE_CONNECTIONS=ng;var Bi=class{constructor(t,r,n,i,o="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=o,this.classDiv=s,i&&(this.paramsConfig=i),n&&(this.options=n)}async initializeDetector(){let t=await nn.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Ct:At).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
49
+ `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=dn(this,e),e.activeTexture(e.TEXTURE2),this.B=dn(this,e)}m(){super.m();let e=this.g;this.J=yt(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=yt(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=yt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Wr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Nl(e){var t=Wr(e,1);if(!t){if(t=Wr(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);let n=wi(e);var r=jh(e);if(fa(r,n,Km(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let i=0,o=0;i<t.length;++i,o+=4)t[i]=r[o]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Km(e){let t=Wr(e,2);if(!t){let r=wi(e);t=Jm(e);let n=Nl(e),i=Xm(e);r.texImage2D(r.TEXTURE_2D,0,i,e.width,e.height,0,r.RED,r.FLOAT,n),zl(e)}return t}function wi(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Xm(e){if(e=wi(e),!Cs)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Cs=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Cs=e.R16F}return Cs}function jh(e){return e.l||(e.l=new Di),e.l}function Jm(e){let t=wi(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Wr(e,2);return r||(r=dn(jh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function zl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Cs,ot=class{constructor(e,t,r,n,i,o,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=i,this.width=o,this.height=s,this.j&&--Hp===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Wr(this,0)}ja(){return!!Wr(this,1)}P(){return!!Wr(this,2)}ia(){return(t=Wr(e=this,0))||(t=Nl(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return Nl(this)}M(){return Km(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=wi(this),i=jh(this);n.activeTexture(n.TEXTURE1),r=dn(i,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let o=Xm(this);n.texImage2D(n.TEXTURE_2D,0,o,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),fa(i,n,r),Ro(i,n,!1,(()=>{Jm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),zl(this)})),zh(i),zl(this)}}e.push(r)}return new ot(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&wi(this).deleteTexture(Wr(this,2)),Hp=-1}};ot.prototype.close=ot.prototype.close,ot.prototype.clone=ot.prototype.clone,ot.prototype.getAsWebGLTexture=ot.prototype.M,ot.prototype.getAsFloat32Array=ot.prototype.ha,ot.prototype.getAsUint8Array=ot.prototype.ia,ot.prototype.hasWebGLTexture=ot.prototype.P,ot.prototype.hasFloat32Array=ot.prototype.ja,ot.prototype.hasUint8Array=ot.prototype.Fa;var Hp=250,Yb={color:"white",lineWidth:4,radius:6};function kl(e){return{...Yb,fillColor:(e=e||{}).color,...e}}function Vr(e,t){return e instanceof Function?e(t):e}function Wp(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function po(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Eo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function $p(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Di;let i=Eo(e);r((e=new ot([n],t.m,!1,i.canvas,e.m,t.width,t.height)).M()),e.close()}}function Gp(e,t,r,n){let i=(function(a){return a.g||(a.g=new Xb),a.g})(e),o=Eo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ro(i,o,!0,(()=>{(function(c,l,h,d){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,l),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.B),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,h),c.H&&(function(p,g){if(p!==g)return!1;p=p.entries(),g=g.entries();for(let[b,_]of p){p=b;let E=_;var f=g.next();if(f.done)return!1;let[k,R]=f.value;if(f=R,p!==k||E[0]!==f[0]||E[1]!==f[1]||E[2]!==f[2]||E[3]!==f[3])return!1}return!!g.next().done})(c.H,d))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.H=d;let p=Array(1024).fill(0);d.forEach(((g,f)=>{if(g.length!==4)throw Error(`Color at index ${f} is not a four-channel value.`);p[4*f]=g[0],p[4*f+1]=g[1],p[4*f+2]=g[2],p[4*f+3]=g[3]})),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(p))}})(i,t,s,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4);let a=i.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)}))}function qp(e,t,r,n){let i=Eo(e),o=(function(c){return c.h||(c.h=new Jb),c.h})(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Ro(o,i,!0,(()=>{var c=o.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,o.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,o.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(c=o.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)}))}var Et=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=po(this);t=kl(t),r.save();var n=r.canvas,i=0;for(let o of e)r.fillStyle=Vr(t.fillColor,{index:i,from:o}),r.strokeStyle=Vr(t.color,{index:i,from:o}),r.lineWidth=Vr(t.lineWidth,{index:i,from:o}),(e=new Path2D).arc(o.x*n.width,o.y*n.height,Vr(t.radius,{index:i,from:o}),0,2*Math.PI),r.fill(e),r.stroke(e),++i;r.restore()}}xa(e,t,r){if(e&&t){var n=po(this);r=kl(r),n.save();var i=n.canvas,o=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=Vr(r.color,{index:o,from:t,to:a}),n.lineWidth=Vr(r.lineWidth,{index:o,from:t,to:a}),n.moveTo(t.x*i.width,t.y*i.height),n.lineTo(a.x*i.width,a.y*i.height)),++o,n.stroke()}n.restore()}}ua(e,t){let r=po(this);t=kl(t),r.save(),r.beginPath(),r.lineWidth=Vr(t.lineWidth,{}),r.strokeStyle=Vr(t.color,{}),r.fillStyle=Vr(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?(function(n,i,o,s){let a=Eo(n);$p(n,i,(c=>{Gp(n,c,o,s),(c=po(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Gp(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,i,o,s){let a=Eo(n);$p(n,i,(c=>{qp(n,c,o,s),(c=po(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):qp(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Pr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof ImageData));case 1:return e.g.find((r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Ym(e){var t=Pr(e,0);if(!t){t=Si(e);let r=ma(e),n=new Uint8Array(e.width*e.height*4);fa(r,t,Ds(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),zh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Ds(e){let t=Pr(e,2);if(!t){let r=Si(e);t=Bs(e);let n=Pr(e,1)||Ym(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),mo(e)}return t}function Si(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function ma(e){return e.l||(e.l=new Di),e.l}function Bs(e){let t=Si(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Pr(e,2);return r||(r=dn(ma(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function mo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Kp(e){let t=Si(e);return Ro(ma(e),t,!0,(()=>(function(r,n){let i=r.canvas;if(i.width===r.width&&i.height===r.height)return n();let o=i.width,s=i.height;return i.width=r.width,i.height=r.height,r=n(),i.width=o,i.height=s,r})(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}Et.prototype.close=Et.prototype.close,Et.prototype.drawConfidenceMask=Et.prototype.wa,Et.prototype.drawCategoryMask=Et.prototype.va,Et.prototype.drawBoundingBox=Et.prototype.ua,Et.prototype.drawConnectors=Et.prototype.xa,Et.prototype.drawLandmarks=Et.prototype.ya,Et.lerp=function(e,t,r,n,i){return Wp(n*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t)),n,i)},Et.clamp=Wp;var ht=class{constructor(e,t,r,n,i,o,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=i,this.width=o,this.height=s,(this.j||this.m)&&--Xp===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Pr(this,0)}ka(){return!!Pr(this,1)}P(){return!!Pr(this,2)}Ca(){return Ym(this)}Ba(){var e=Pr(this,1);return e||(Ds(this),Bs(this),e=Kp(this),mo(this),this.g.push(e),this.j=!0),e}M(){return Ds(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Si(this),i=ma(this);n.activeTexture(n.TEXTURE1),r=dn(i,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),fa(i,n,r),Ro(i,n,!1,(()=>{Bs(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),mo(this)})),zh(i),mo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Ds(this),Bs(this),r=Kp(this),mo(this)}e.push(r)}return new ht(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Pr(this,1).close(),this.m&&Si(this).deleteTexture(Pr(this,2)),Xp=-1}};ht.prototype.close=ht.prototype.close,ht.prototype.clone=ht.prototype.clone,ht.prototype.getAsWebGLTexture=ht.prototype.M,ht.prototype.getAsImageBitmap=ht.prototype.Ba,ht.prototype.getAsImageData=ht.prototype.Ca,ht.prototype.hasWebGLTexture=ht.prototype.P,ht.prototype.hasImageBitmap=ht.prototype.ka,ht.prototype.hasImageData=ht.prototype.Ea;var Xp=250;function gr(...e){return e.map((([t,r])=>({start:t,end:r})))}var Zb=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((Jp=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Gm()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Q(this,n||"input_audio",(o=>{Q(this,i=i||"audio_header",(s=>{this.i._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Tr(this,"__graph_config__",(t=>{e(t)})),Q(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(e,this.g/4),Q(this,n,(s=>{this.i._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){Q(this,t,(n=>{let[i,o]=Mp(this,e,n);this.i._addBoundTextureToStream(n,i,o,r)}))}addBoolToStream(e,t,r){Q(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){Q(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){Q(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){Q(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){Q(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){Q(this,t,(n=>{Q(this,e,(i=>{this.i._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){Q(this,t,(n=>{Np(this,Object.keys(e),(i=>{Np(this,Object.values(e),(o=>{this.i._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){Q(this,r,(i=>{Q(this,t,(o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,o,i,n),this.i._free(s)}))}))}addEmptyPacketToStream(e,t){Q(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(i,o);this.i._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)Q(this,o,(s=>{this.i._addStringVectorEntry(i,s)}));this.i._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){Q(this,t,(r=>{Q(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){Q(this,r,(n=>{Q(this,t,(i=>{let o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputSidePacket(o,e.length,i,n),this.i._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)Q(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Tr(this,e,t),Q(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Tr(this,e,t),Q(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){rn(this,e,t),Q(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Tr(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),Q(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Jp{get ea(){return this.i}qa(e,t,r){Q(this,t,(n=>{let[i,o]=Mp(this,e,n);this.ea._addBoundTextureAsImageToStream(n,i,o,r)}))}U(e,t){Tr(this,e,t),Q(this,e,(r=>{this.ea._attachImageListener(r)}))}ca(e,t){rn(this,e,t),Q(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),Jp,tr=class extends Zb{};async function pe(e,t,r){return(async function(n,i,o,s){return Kb(n,i,o,s)})(e,r.canvas??(Gm()?void 0:document.createElement("canvas")),t,r)}function Zm(e,t,r,n){if(e.T){let o=new wm;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var i=r.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Z(o,1,(i.left+i.right)/2),Z(o,2,(i.top+i.bottom)/2),Z(o,4,i.right-i.left),Z(o,3,i.bottom-i.top)}else Z(o,1,.5),Z(o,2,.5),Z(o,4,1),Z(o,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(Z(o,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=qm(t);r=Je(o,3)*a/s,i=Je(o,4)*s/a,Z(o,4,r),Z(o,3,i)}}e.g.addProtoToStream(o.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function rr(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Zm(e,t,r,e.B+1)}function Br(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Zm(e,t,r,n)}function ki(e,t,r,n){var i=t.data;let o=t.width,s=o*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==s)throw Error("Unsupported channel count: "+i.length/s);return e=new ot([i],r,!1,e.g.i.canvas,e.O,o,t),n?e.clone():e}var It=class extends Ps{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Di}l(e,t=!0){if("runningMode"in e&&So(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};It.prototype.close=It.prototype.close;var Ct=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},ne(e=this.h=new ha,0,1,t=new Le),Z(this.h,2,.5),Z(this.h,3,.3)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Z(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Z(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},rr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect_in"),be(e,"detections");let t=new Nt;pr(t,Ob,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect_in"),fe(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=bm(o),this.j.detections.push(Wm(n));J(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ct.prototype.detectForVideo=Ct.prototype.F,Ct.prototype.detect=Ct.prototype.D,Ct.prototype.setOptions=Ct.prototype.o,Ct.createFromModelPath=async function(e,t){return pe(Ct,e,{baseOptions:{modelAssetPath:t}})},Ct.createFromModelBuffer=function(e,t){return pe(Ct,e,{baseOptions:{modelAssetBuffer:t}})},Ct.createFromOptions=function(e,t){return pe(Ct,e,t)};var Vh=gr([61,146],[146,91],[91,181],[181,84],[84,17],[17,314],[314,405],[405,321],[321,375],[375,291],[61,185],[185,40],[40,39],[39,37],[37,0],[0,267],[267,269],[269,270],[270,409],[409,291],[78,95],[95,88],[88,178],[178,87],[87,14],[14,317],[317,402],[402,318],[318,324],[324,308],[78,191],[191,80],[80,81],[81,82],[82,13],[13,312],[312,311],[311,310],[310,415],[415,308]),Hh=gr([263,249],[249,390],[390,373],[373,374],[374,380],[380,381],[381,382],[382,362],[263,466],[466,388],[388,387],[387,386],[386,385],[385,384],[384,398],[398,362]),Wh=gr([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Qm=gr([474,475],[475,476],[476,477],[477,474]),$h=gr([33,7],[7,163],[163,144],[144,145],[145,153],[153,154],[154,155],[155,133],[33,246],[246,161],[161,160],[160,159],[159,158],[158,157],[157,173],[173,133]),Gh=gr([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),eg=gr([469,470],[470,471],[471,472],[472,469]),qh=gr([10,338],[338,297],[297,332],[332,284],[284,251],[251,389],[389,356],[356,454],[454,323],[323,361],[361,288],[288,397],[397,365],[365,379],[379,378],[378,400],[400,377],[377,152],[152,148],[148,176],[176,149],[149,150],[150,136],[136,172],[172,58],[58,132],[132,93],[93,234],[234,127],[127,162],[162,21],[21,54],[54,103],[103,67],[67,109],[109,10]),tg=[...Vh,...Hh,...Wh,...$h,...Gh,...qh],rg=gr([127,34],[34,139],[139,127],[11,0],[0,37],[37,11],[232,231],[231,120],[120,232],[72,37],[37,39],[39,72],[128,121],[121,47],[47,128],[232,121],[121,128],[128,232],[104,69],[69,67],[67,104],[175,171],[171,148],[148,175],[118,50],[50,101],[101,118],[73,39],[39,40],[40,73],[9,151],[151,108],[108,9],[48,115],[115,131],[131,48],[194,204],[204,211],[211,194],[74,40],[40,185],[185,74],[80,42],[42,183],[183,80],[40,92],[92,186],[186,40],[230,229],[229,118],[118,230],[202,212],[212,214],[214,202],[83,18],[18,17],[17,83],[76,61],[61,146],[146,76],[160,29],[29,30],[30,160],[56,157],[157,173],[173,56],[106,204],[204,194],[194,106],[135,214],[214,192],[192,135],[203,165],[165,98],[98,203],[21,71],[71,68],[68,21],[51,45],[45,4],[4,51],[144,24],[24,23],[23,144],[77,146],[146,91],[91,77],[205,50],[50,187],[187,205],[201,200],[200,18],[18,201],[91,106],[106,182],[182,91],[90,91],[91,181],[181,90],[85,84],[84,17],[17,85],[206,203],[203,36],[36,206],[148,171],[171,140],[140,148],[92,40],[40,39],[39,92],[193,189],[189,244],[244,193],[159,158],[158,28],[28,159],[247,246],[246,161],[161,247],[236,3],[3,196],[196,236],[54,68],[68,104],[104,54],[193,168],[168,8],[8,193],[117,228],[228,31],[31,117],[189,193],[193,55],[55,189],[98,97],[97,99],[99,98],[126,47],[47,100],[100,126],[166,79],[79,218],[218,166],[155,154],[154,26],[26,155],[209,49],[49,131],[131,209],[135,136],[136,150],[150,135],[47,126],[126,217],[217,47],[223,52],[52,53],[53,223],[45,51],[51,134],[134,45],[211,170],[170,140],[140,211],[67,69],[69,108],[108,67],[43,106],[106,91],[91,43],[230,119],[119,120],[120,230],[226,130],[130,247],[247,226],[63,53],[53,52],[52,63],[238,20],[20,242],[242,238],[46,70],[70,156],[156,46],[78,62],[62,96],[96,78],[46,53],[53,63],[63,46],[143,34],[34,227],[227,143],[123,117],[117,111],[111,123],[44,125],[125,19],[19,44],[236,134],[134,51],[51,236],[216,206],[206,205],[205,216],[154,153],[153,22],[22,154],[39,37],[37,167],[167,39],[200,201],[201,208],[208,200],[36,142],[142,100],[100,36],[57,212],[212,202],[202,57],[20,60],[60,99],[99,20],[28,158],[158,157],[157,28],[35,226],[226,113],[113,35],[160,159],[159,27],[27,160],[204,202],[202,210],[210,204],[113,225],[225,46],[46,113],[43,202],[202,204],[204,43],[62,76],[76,77],[77,62],[137,123],[123,116],[116,137],[41,38],[38,72],[72,41],[203,129],[129,142],[142,203],[64,98],[98,240],[240,64],[49,102],[102,64],[64,49],[41,73],[73,74],[74,41],[212,216],[216,207],[207,212],[42,74],[74,184],[184,42],[169,170],[170,211],[211,169],[170,149],[149,176],[176,170],[105,66],[66,69],[69,105],[122,6],[6,168],[168,122],[123,147],[147,187],[187,123],[96,77],[77,90],[90,96],[65,55],[55,107],[107,65],[89,90],[90,180],[180,89],[101,100],[100,120],[120,101],[63,105],[105,104],[104,63],[93,137],[137,227],[227,93],[15,86],[86,85],[85,15],[129,102],[102,49],[49,129],[14,87],[87,86],[86,14],[55,8],[8,9],[9,55],[100,47],[47,121],[121,100],[145,23],[23,22],[22,145],[88,89],[89,179],[179,88],[6,122],[122,196],[196,6],[88,95],[95,96],[96,88],[138,172],[172,136],[136,138],[215,58],[58,172],[172,215],[115,48],[48,219],[219,115],[42,80],[80,81],[81,42],[195,3],[3,51],[51,195],[43,146],[146,61],[61,43],[171,175],[175,199],[199,171],[81,82],[82,38],[38,81],[53,46],[46,225],[225,53],[144,163],[163,110],[110,144],[52,65],[65,66],[66,52],[229,228],[228,117],[117,229],[34,127],[127,234],[234,34],[107,108],[108,69],[69,107],[109,108],[108,151],[151,109],[48,64],[64,235],[235,48],[62,78],[78,191],[191,62],[129,209],[209,126],[126,129],[111,35],[35,143],[143,111],[117,123],[123,50],[50,117],[222,65],[65,52],[52,222],[19,125],[125,141],[141,19],[221,55],[55,65],[65,221],[3,195],[195,197],[197,3],[25,7],[7,33],[33,25],[220,237],[237,44],[44,220],[70,71],[71,139],[139,70],[122,193],[193,245],[245,122],[247,130],[130,33],[33,247],[71,21],[21,162],[162,71],[170,169],[169,150],[150,170],[188,174],[174,196],[196,188],[216,186],[186,92],[92,216],[2,97],[97,167],[167,2],[141,125],[125,241],[241,141],[164,167],[167,37],[37,164],[72,38],[38,12],[12,72],[38,82],[82,13],[13,38],[63,68],[68,71],[71,63],[226,35],[35,111],[111,226],[101,50],[50,205],[205,101],[206,92],[92,165],[165,206],[209,198],[198,217],[217,209],[165,167],[167,97],[97,165],[220,115],[115,218],[218,220],[133,112],[112,243],[243,133],[239,238],[238,241],[241,239],[214,135],[135,169],[169,214],[190,173],[173,133],[133,190],[171,208],[208,32],[32,171],[125,44],[44,237],[237,125],[86,87],[87,178],[178,86],[85,86],[86,179],[179,85],[84,85],[85,180],[180,84],[83,84],[84,181],[181,83],[201,83],[83,182],[182,201],[137,93],[93,132],[132,137],[76,62],[62,183],[183,76],[61,76],[76,184],[184,61],[57,61],[61,185],[185,57],[212,57],[57,186],[186,212],[214,207],[207,187],[187,214],[34,143],[143,156],[156,34],[79,239],[239,237],[237,79],[123,137],[137,177],[177,123],[44,1],[1,4],[4,44],[201,194],[194,32],[32,201],[64,102],[102,129],[129,64],[213,215],[215,138],[138,213],[59,166],[166,219],[219,59],[242,99],[99,97],[97,242],[2,94],[94,141],[141,2],[75,59],[59,235],[235,75],[24,110],[110,228],[228,24],[25,130],[130,226],[226,25],[23,24],[24,229],[229,23],[22,23],[23,230],[230,22],[26,22],[22,231],[231,26],[112,26],[26,232],[232,112],[189,190],[190,243],[243,189],[221,56],[56,190],[190,221],[28,56],[56,221],[221,28],[27,28],[28,222],[222,27],[29,27],[27,223],[223,29],[30,29],[29,224],[224,30],[247,30],[30,225],[225,247],[238,79],[79,20],[20,238],[166,59],[59,75],[75,166],[60,75],[75,240],[240,60],[147,177],[177,215],[215,147],[20,79],[79,166],[166,20],[187,147],[147,213],[213,187],[112,233],[233,244],[244,112],[233,128],[128,245],[245,233],[128,114],[114,188],[188,128],[114,217],[217,174],[174,114],[131,115],[115,220],[220,131],[217,198],[198,236],[236,217],[198,131],[131,134],[134,198],[177,132],[132,58],[58,177],[143,35],[35,124],[124,143],[110,163],[163,7],[7,110],[228,110],[110,25],[25,228],[356,389],[389,368],[368,356],[11,302],[302,267],[267,11],[452,350],[350,349],[349,452],[302,303],[303,269],[269,302],[357,343],[343,277],[277,357],[452,453],[453,357],[357,452],[333,332],[332,297],[297,333],[175,152],[152,377],[377,175],[347,348],[348,330],[330,347],[303,304],[304,270],[270,303],[9,336],[336,337],[337,9],[278,279],[279,360],[360,278],[418,262],[262,431],[431,418],[304,408],[408,409],[409,304],[310,415],[415,407],[407,310],[270,409],[409,410],[410,270],[450,348],[348,347],[347,450],[422,430],[430,434],[434,422],[313,314],[314,17],[17,313],[306,307],[307,375],[375,306],[387,388],[388,260],[260,387],[286,414],[414,398],[398,286],[335,406],[406,418],[418,335],[364,367],[367,416],[416,364],[423,358],[358,327],[327,423],[251,284],[284,298],[298,251],[281,5],[5,4],[4,281],[373,374],[374,253],[253,373],[307,320],[320,321],[321,307],[425,427],[427,411],[411,425],[421,313],[313,18],[18,421],[321,405],[405,406],[406,321],[320,404],[404,405],[405,320],[315,16],[16,17],[17,315],[426,425],[425,266],[266,426],[377,400],[400,369],[369,377],[322,391],[391,269],[269,322],[417,465],[465,464],[464,417],[386,257],[257,258],[258,386],[466,260],[260,388],[388,466],[456,399],[399,419],[419,456],[284,332],[332,333],[333,284],[417,285],[285,8],[8,417],[346,340],[340,261],[261,346],[413,441],[441,285],[285,413],[327,460],[460,328],[328,327],[355,371],[371,329],[329,355],[392,439],[439,438],[438,392],[382,341],[341,256],[256,382],[429,420],[420,360],[360,429],[364,394],[394,379],[379,364],[277,343],[343,437],[437,277],[443,444],[444,283],[283,443],[275,440],[440,363],[363,275],[431,262],[262,369],[369,431],[297,338],[338,337],[337,297],[273,375],[375,321],[321,273],[450,451],[451,349],[349,450],[446,342],[342,467],[467,446],[293,334],[334,282],[282,293],[458,461],[461,462],[462,458],[276,353],[353,383],[383,276],[308,324],[324,325],[325,308],[276,300],[300,293],[293,276],[372,345],[345,447],[447,372],[352,345],[345,340],[340,352],[274,1],[1,19],[19,274],[456,248],[248,281],[281,456],[436,427],[427,425],[425,436],[381,256],[256,252],[252,381],[269,391],[391,393],[393,269],[200,199],[199,428],[428,200],[266,330],[330,329],[329,266],[287,273],[273,422],[422,287],[250,462],[462,328],[328,250],[258,286],[286,384],[384,258],[265,353],[353,342],[342,265],[387,259],[259,257],[257,387],[424,431],[431,430],[430,424],[342,353],[353,276],[276,342],[273,335],[335,424],[424,273],[292,325],[325,307],[307,292],[366,447],[447,345],[345,366],[271,303],[303,302],[302,271],[423,266],[266,371],[371,423],[294,455],[455,460],[460,294],[279,278],[278,294],[294,279],[271,272],[272,304],[304,271],[432,434],[434,427],[427,432],[272,407],[407,408],[408,272],[394,430],[430,431],[431,394],[395,369],[369,400],[400,395],[334,333],[333,299],[299,334],[351,417],[417,168],[168,351],[352,280],[280,411],[411,352],[325,319],[319,320],[320,325],[295,296],[296,336],[336,295],[319,403],[403,404],[404,319],[330,348],[348,349],[349,330],[293,298],[298,333],[333,293],[323,454],[454,447],[447,323],[15,16],[16,315],[315,15],[358,429],[429,279],[279,358],[14,15],[15,316],[316,14],[285,336],[336,9],[9,285],[329,349],[349,350],[350,329],[374,380],[380,252],[252,374],[318,402],[402,403],[403,318],[6,197],[197,419],[419,6],[318,319],[319,325],[325,318],[367,364],[364,365],[365,367],[435,367],[367,397],[397,435],[344,438],[438,439],[439,344],[272,271],[271,311],[311,272],[195,5],[5,281],[281,195],[273,287],[287,291],[291,273],[396,428],[428,199],[199,396],[311,271],[271,268],[268,311],[283,444],[444,445],[445,283],[373,254],[254,339],[339,373],[282,334],[334,296],[296,282],[449,347],[347,346],[346,449],[264,447],[447,454],[454,264],[336,296],[296,299],[299,336],[338,10],[10,151],[151,338],[278,439],[439,455],[455,278],[292,407],[407,415],[415,292],[358,371],[371,355],[355,358],[340,345],[345,372],[372,340],[346,347],[347,280],[280,346],[442,443],[443,282],[282,442],[19,94],[94,370],[370,19],[441,442],[442,295],[295,441],[248,419],[419,197],[197,248],[263,255],[255,359],[359,263],[440,275],[275,274],[274,440],[300,383],[383,368],[368,300],[351,412],[412,465],[465,351],[263,467],[467,466],[466,263],[301,368],[368,389],[389,301],[395,378],[378,379],[379,395],[412,351],[351,419],[419,412],[436,426],[426,322],[322,436],[2,164],[164,393],[393,2],[370,462],[462,461],[461,370],[164,0],[0,267],[267,164],[302,11],[11,12],[12,302],[268,12],[12,13],[13,268],[293,300],[300,301],[301,293],[446,261],[261,340],[340,446],[330,266],[266,425],[425,330],[426,423],[423,391],[391,426],[429,355],[355,437],[437,429],[391,327],[327,326],[326,391],[440,457],[457,438],[438,440],[341,382],[382,362],[362,341],[459,457],[457,461],[461,459],[434,430],[430,394],[394,434],[414,463],[463,362],[362,414],[396,369],[369,262],[262,396],[354,461],[461,457],[457,354],[316,403],[403,402],[402,316],[315,404],[404,403],[403,315],[314,405],[405,404],[404,314],[313,406],[406,405],[405,313],[421,418],[418,406],[406,421],[366,401],[401,361],[361,366],[306,408],[408,407],[407,306],[291,409],[409,408],[408,291],[287,410],[410,409],[409,287],[432,436],[436,410],[410,432],[434,416],[416,411],[411,434],[264,368],[368,383],[383,264],[309,438],[438,457],[457,309],[352,376],[376,401],[401,352],[274,275],[275,4],[4,274],[421,428],[428,262],[262,421],[294,327],[327,358],[358,294],[433,416],[416,367],[367,433],[289,455],[455,439],[439,289],[462,370],[370,326],[326,462],[2,326],[326,370],[370,2],[305,460],[460,455],[455,305],[254,449],[449,448],[448,254],[255,261],[261,446],[446,255],[253,450],[450,449],[449,253],[252,451],[451,450],[450,252],[256,452],[452,451],[451,256],[341,453],[453,452],[452,341],[413,464],[464,463],[463,413],[441,413],[413,414],[414,441],[258,442],[442,441],[441,258],[257,443],[443,442],[442,257],[259,444],[444,443],[443,259],[260,445],[445,444],[444,260],[467,342],[342,445],[445,467],[459,458],[458,250],[250,459],[289,392],[392,290],[290,289],[290,328],[328,460],[460,290],[376,433],[433,435],[435,376],[250,290],[290,392],[392,250],[411,416],[416,433],[433,411],[341,463],[463,464],[464,341],[453,464],[464,465],[465,453],[357,465],[465,412],[412,357],[343,412],[412,399],[399,343],[360,363],[363,440],[440,360],[437,399],[399,456],[456,437],[420,456],[456,363],[363,420],[401,435],[435,288],[288,401],[372,383],[383,353],[353,372],[339,255],[255,249],[249,339],[448,261],[261,255],[255,448],[133,243],[243,190],[190,133],[133,155],[155,112],[112,133],[33,246],[246,247],[247,33],[33,130],[130,25],[25,33],[398,384],[384,286],[286,398],[362,398],[398,414],[414,362],[362,463],[463,341],[341,362],[263,359],[359,467],[467,263],[263,249],[249,255],[255,263],[466,467],[467,260],[260,466],[75,60],[60,166],[166,75],[238,239],[239,79],[79,238],[162,127],[127,139],[139,162],[72,11],[11,37],[37,72],[121,232],[232,120],[120,121],[73,72],[72,39],[39,73],[114,128],[128,47],[47,114],[233,232],[232,128],[128,233],[103,104],[104,67],[67,103],[152,175],[175,148],[148,152],[119,118],[118,101],[101,119],[74,73],[73,40],[40,74],[107,9],[9,108],[108,107],[49,48],[48,131],[131,49],[32,194],[194,211],[211,32],[184,74],[74,185],[185,184],[191,80],[80,183],[183,191],[185,40],[40,186],[186,185],[119,230],[230,118],[118,119],[210,202],[202,214],[214,210],[84,83],[83,17],[17,84],[77,76],[76,146],[146,77],[161,160],[160,30],[30,161],[190,56],[56,173],[173,190],[182,106],[106,194],[194,182],[138,135],[135,192],[192,138],[129,203],[203,98],[98,129],[54,21],[21,68],[68,54],[5,51],[51,4],[4,5],[145,144],[144,23],[23,145],[90,77],[77,91],[91,90],[207,205],[205,187],[187,207],[83,201],[201,18],[18,83],[181,91],[91,182],[182,181],[180,90],[90,181],[181,180],[16,85],[85,17],[17,16],[205,206],[206,36],[36,205],[176,148],[148,140],[140,176],[165,92],[92,39],[39,165],[245,193],[193,244],[244,245],[27,159],[159,28],[28,27],[30,247],[247,161],[161,30],[174,236],[236,196],[196,174],[103,54],[54,104],[104,103],[55,193],[193,8],[8,55],[111,117],[117,31],[31,111],[221,189],[189,55],[55,221],[240,98],[98,99],[99,240],[142,126],[126,100],[100,142],[219,166],[166,218],[218,219],[112,155],[155,26],[26,112],[198,209],[209,131],[131,198],[169,135],[135,150],[150,169],[114,47],[47,217],[217,114],[224,223],[223,53],[53,224],[220,45],[45,134],[134,220],[32,211],[211,140],[140,32],[109,67],[67,108],[108,109],[146,43],[43,91],[91,146],[231,230],[230,120],[120,231],[113,226],[226,247],[247,113],[105,63],[63,52],[52,105],[241,238],[238,242],[242,241],[124,46],[46,156],[156,124],[95,78],[78,96],[96,95],[70,46],[46,63],[63,70],[116,143],[143,227],[227,116],[116,123],[123,111],[111,116],[1,44],[44,19],[19,1],[3,236],[236,51],[51,3],[207,216],[216,205],[205,207],[26,154],[154,22],[22,26],[165,39],[39,167],[167,165],[199,200],[200,208],[208,199],[101,36],[36,100],[100,101],[43,57],[57,202],[202,43],[242,20],[20,99],[99,242],[56,28],[28,157],[157,56],[124,35],[35,113],[113,124],[29,160],[160,27],[27,29],[211,204],[204,210],[210,211],[124,113],[113,46],[46,124],[106,43],[43,204],[204,106],[96,62],[62,77],[77,96],[227,137],[137,116],[116,227],[73,41],[41,72],[72,73],[36,203],[203,142],[142,36],[235,64],[64,240],[240,235],[48,49],[49,64],[64,48],[42,41],[41,74],[74,42],[214,212],[212,207],[207,214],[183,42],[42,184],[184,183],[210,169],[169,211],[211,210],[140,170],[170,176],[176,140],[104,105],[105,69],[69,104],[193,122],[122,168],[168,193],[50,123],[123,187],[187,50],[89,96],[96,90],[90,89],[66,65],[65,107],[107,66],[179,89],[89,180],[180,179],[119,101],[101,120],[120,119],[68,63],[63,104],[104,68],[234,93],[93,227],[227,234],[16,15],[15,85],[85,16],[209,129],[129,49],[49,209],[15,14],[14,86],[86,15],[107,55],[55,9],[9,107],[120,100],[100,121],[121,120],[153,145],[145,22],[22,153],[178,88],[88,179],[179,178],[197,6],[6,196],[196,197],[89,88],[88,96],[96,89],[135,138],[138,136],[136,135],[138,215],[215,172],[172,138],[218,115],[115,219],[219,218],[41,42],[42,81],[81,41],[5,195],[195,51],[51,5],[57,43],[43,61],[61,57],[208,171],[171,199],[199,208],[41,81],[81,38],[38,41],[224,53],[53,225],[225,224],[24,144],[144,110],[110,24],[105,52],[52,66],[66,105],[118,229],[229,117],[117,118],[227,34],[34,234],[234,227],[66,107],[107,69],[69,66],[10,109],[109,151],[151,10],[219,48],[48,235],[235,219],[183,62],[62,191],[191,183],[142,129],[129,126],[126,142],[116,111],[111,143],[143,116],[118,117],[117,50],[50,118],[223,222],[222,52],[52,223],[94,19],[19,141],[141,94],[222,221],[221,65],[65,222],[196,3],[3,197],[197,196],[45,220],[220,44],[44,45],[156,70],[70,139],[139,156],[188,122],[122,245],[245,188],[139,71],[71,162],[162,139],[149,170],[170,150],[150,149],[122,188],[188,196],[196,122],[206,216],[216,92],[92,206],[164,2],[2,167],[167,164],[242,141],[141,241],[241,242],[0,164],[164,37],[37,0],[11,72],[72,12],[12,11],[12,38],[38,13],[13,12],[70,63],[63,71],[71,70],[31,226],[226,111],[111,31],[36,101],[101,205],[205,36],[203,206],[206,165],[165,203],[126,209],[209,217],[217,126],[98,165],[165,97],[97,98],[237,220],[220,218],[218,237],[237,239],[239,241],[241,237],[210,214],[214,169],[169,210],[140,171],[171,32],[32,140],[241,125],[125,237],[237,241],[179,86],[86,178],[178,179],[180,85],[85,179],[179,180],[181,84],[84,180],[180,181],[182,83],[83,181],[181,182],[194,201],[201,182],[182,194],[177,137],[137,132],[132,177],[184,76],[76,183],[183,184],[185,61],[61,184],[184,185],[186,57],[57,185],[185,186],[216,212],[212,186],[186,216],[192,214],[214,187],[187,192],[139,34],[34,156],[156,139],[218,79],[79,237],[237,218],[147,123],[123,177],[177,147],[45,44],[44,4],[4,45],[208,201],[201,32],[32,208],[98,64],[64,129],[129,98],[192,213],[213,138],[138,192],[235,59],[59,219],[219,235],[141,242],[242,97],[97,141],[97,2],[2,141],[141,97],[240,75],[75,235],[235,240],[229,24],[24,228],[228,229],[31,25],[25,226],[226,31],[230,23],[23,229],[229,230],[231,22],[22,230],[230,231],[232,26],[26,231],[231,232],[233,112],[112,232],[232,233],[244,189],[189,243],[243,244],[189,221],[221,190],[190,189],[222,28],[28,221],[221,222],[223,27],[27,222],[222,223],[224,29],[29,223],[223,224],[225,30],[30,224],[224,225],[113,247],[247,225],[225,113],[99,60],[60,240],[240,99],[213,147],[147,215],[215,213],[60,20],[20,166],[166,60],[192,187],[187,213],[213,192],[243,112],[112,244],[244,243],[244,233],[233,245],[245,244],[245,128],[128,188],[188,245],[188,114],[114,174],[174,188],[134,131],[131,220],[220,134],[174,217],[217,236],[236,174],[236,198],[198,134],[134,236],[215,177],[177,58],[58,215],[156,143],[143,124],[124,156],[25,110],[110,7],[7,25],[31,228],[228,25],[25,31],[264,356],[356,368],[368,264],[0,11],[11,267],[267,0],[451,452],[452,349],[349,451],[267,302],[302,269],[269,267],[350,357],[357,277],[277,350],[350,452],[452,357],[357,350],[299,333],[333,297],[297,299],[396,175],[175,377],[377,396],[280,347],[347,330],[330,280],[269,303],[303,270],[270,269],[151,9],[9,337],[337,151],[344,278],[278,360],[360,344],[424,418],[418,431],[431,424],[270,304],[304,409],[409,270],[272,310],[310,407],[407,272],[322,270],[270,410],[410,322],[449,450],[450,347],[347,449],[432,422],[422,434],[434,432],[18,313],[313,17],[17,18],[291,306],[306,375],[375,291],[259,387],[387,260],[260,259],[424,335],[335,418],[418,424],[434,364],[364,416],[416,434],[391,423],[423,327],[327,391],[301,251],[251,298],[298,301],[275,281],[281,4],[4,275],[254,373],[373,253],[253,254],[375,307],[307,321],[321,375],[280,425],[425,411],[411,280],[200,421],[421,18],[18,200],[335,321],[321,406],[406,335],[321,320],[320,405],[405,321],[314,315],[315,17],[17,314],[423,426],[426,266],[266,423],[396,377],[377,369],[369,396],[270,322],[322,269],[269,270],[413,417],[417,464],[464,413],[385,386],[386,258],[258,385],[248,456],[456,419],[419,248],[298,284],[284,333],[333,298],[168,417],[417,8],[8,168],[448,346],[346,261],[261,448],[417,413],[413,285],[285,417],[326,327],[327,328],[328,326],[277,355],[355,329],[329,277],[309,392],[392,438],[438,309],[381,382],[382,256],[256,381],[279,429],[429,360],[360,279],[365,364],[364,379],[379,365],[355,277],[277,437],[437,355],[282,443],[443,283],[283,282],[281,275],[275,363],[363,281],[395,431],[431,369],[369,395],[299,297],[297,337],[337,299],[335,273],[273,321],[321,335],[348,450],[450,349],[349,348],[359,446],[446,467],[467,359],[283,293],[293,282],[282,283],[250,458],[458,462],[462,250],[300,276],[276,383],[383,300],[292,308],[308,325],[325,292],[283,276],[276,293],[293,283],[264,372],[372,447],[447,264],[346,352],[352,340],[340,346],[354,274],[274,19],[19,354],[363,456],[456,281],[281,363],[426,436],[436,425],[425,426],[380,381],[381,252],[252,380],[267,269],[269,393],[393,267],[421,200],[200,428],[428,421],[371,266],[266,329],[329,371],[432,287],[287,422],[422,432],[290,250],[250,328],[328,290],[385,258],[258,384],[384,385],[446,265],[265,342],[342,446],[386,387],[387,257],[257,386],[422,424],[424,430],[430,422],[445,342],[342,276],[276,445],[422,273],[273,424],[424,422],[306,292],[292,307],[307,306],[352,366],[366,345],[345,352],[268,271],[271,302],[302,268],[358,423],[423,371],[371,358],[327,294],[294,460],[460,327],[331,279],[279,294],[294,331],[303,271],[271,304],[304,303],[436,432],[432,427],[427,436],[304,272],[272,408],[408,304],[395,394],[394,431],[431,395],[378,395],[395,400],[400,378],[296,334],[334,299],[299,296],[6,351],[351,168],[168,6],[376,352],[352,411],[411,376],[307,325],[325,320],[320,307],[285,295],[295,336],[336,285],[320,319],[319,404],[404,320],[329,330],[330,349],[349,329],[334,293],[293,333],[333,334],[366,323],[323,447],[447,366],[316,15],[15,315],[315,316],[331,358],[358,279],[279,331],[317,14],[14,316],[316,317],[8,285],[285,9],[9,8],[277,329],[329,350],[350,277],[253,374],[374,252],[252,253],[319,318],[318,403],[403,319],[351,6],[6,419],[419,351],[324,318],[318,325],[325,324],[397,367],[367,365],[365,397],[288,435],[435,397],[397,288],[278,344],[344,439],[439,278],[310,272],[272,311],[311,310],[248,195],[195,281],[281,248],[375,273],[273,291],[291,375],[175,396],[396,199],[199,175],[312,311],[311,268],[268,312],[276,283],[283,445],[445,276],[390,373],[373,339],[339,390],[295,282],[282,296],[296,295],[448,449],[449,346],[346,448],[356,264],[264,454],[454,356],[337,336],[336,299],[299,337],[337,338],[338,151],[151,337],[294,278],[278,455],[455,294],[308,292],[292,415],[415,308],[429,358],[358,355],[355,429],[265,340],[340,372],[372,265],[352,346],[346,280],[280,352],[295,442],[442,282],[282,295],[354,19],[19,370],[370,354],[285,441],[441,295],[295,285],[195,248],[248,197],[197,195],[457,440],[440,274],[274,457],[301,300],[300,368],[368,301],[417,351],[351,465],[465,417],[251,301],[301,389],[389,251],[394,395],[395,379],[379,394],[399,412],[412,419],[419,399],[410,436],[436,322],[322,410],[326,2],[2,393],[393,326],[354,370],[370,461],[461,354],[393,164],[164,267],[267,393],[268,302],[302,12],[12,268],[312,268],[268,13],[13,312],[298,293],[293,301],[301,298],[265,446],[446,340],[340,265],[280,330],[330,425],[425,280],[322,426],[426,391],[391,322],[420,429],[429,437],[437,420],[393,391],[391,326],[326,393],[344,440],[440,438],[438,344],[458,459],[459,461],[461,458],[364,434],[434,394],[394,364],[428,396],[396,262],[262,428],[274,354],[354,457],[457,274],[317,316],[316,402],[402,317],[316,315],[315,403],[403,316],[315,314],[314,404],[404,315],[314,313],[313,405],[405,314],[313,421],[421,406],[406,313],[323,366],[366,361],[361,323],[292,306],[306,407],[407,292],[306,291],[291,408],[408,306],[291,287],[287,409],[409,291],[287,432],[432,410],[410,287],[427,434],[434,411],[411,427],[372,264],[264,383],[383,372],[459,309],[309,457],[457,459],[366,352],[352,401],[401,366],[1,274],[274,4],[4,1],[418,421],[421,262],[262,418],[331,294],[294,358],[358,331],[435,433],[433,367],[367,435],[392,289],[289,439],[439,392],[328,462],[462,326],[326,328],[94,2],[2,370],[370,94],[289,305],[305,455],[455,289],[339,254],[254,448],[448,339],[359,255],[255,446],[446,359],[254,253],[253,449],[449,254],[253,252],[252,450],[450,253],[252,256],[256,451],[451,252],[256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]);function Yp(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var He=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,ne(e=this.h=new Cm,0,1,t=new Le),this.v=new xm,ne(this.h,0,3,this.v),this.s=new ha,ne(this.h,0,2,this.s),Dr(this.s,4,1),Z(this.s,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numFaces"in e&&Dr(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Z(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return Yp(this),rr(this,e,t),this.j}F(e,t,r){return Yp(this),Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"face_landmarks");let t=new Nt;pr(t,Fb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.j.faceLandmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{J(this,n)})),this.outputFaceBlendshapes&&(be(e,"blendshapes"),fe(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,i)=>{if(this.outputFaceBlendshapes)for(let o of n)n=la(o),this.j.faceBlendshapes.push(Mh(n.g()??[]));J(this,i)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{J(this,n)}))),this.outputFacialTransformationMatrixes&&(be(e,"face_geometry"),fe(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,i)=>{if(this.outputFacialTransformationMatrixes)for(let o of n)(n=ye(Ub(o),Cb,2))&&this.j.facialTransformationMatrixes.push({rows:Yt(n,1)??0??0,columns:Yt(n,2)??0??0,data:Ln(n,3,pn,Fn()).slice()??[]});J(this,i)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{J(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(e,t){return pe(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return pe(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return pe(He,e,t)},He.FACE_LANDMARKS_LIPS=Vh,He.FACE_LANDMARKS_LEFT_EYE=Hh,He.FACE_LANDMARKS_LEFT_EYEBROW=Wh,He.FACE_LANDMARKS_LEFT_IRIS=Qm,He.FACE_LANDMARKS_RIGHT_EYE=$h,He.FACE_LANDMARKS_RIGHT_EYEBROW=Gh,He.FACE_LANDMARKS_RIGHT_IRIS=eg,He.FACE_LANDMARKS_FACE_OVAL=qh,He.FACE_LANDMARKS_CONTOURS=tg,He.FACE_LANDMARKS_TESSELATION=rg;var Ir=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!0),ne(e=this.j=new Tm,0,1,t=new Le)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,rr(this,e,n??{}),!this.h)return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"stylized_image");let t=new Nt;pr(t,Lb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Vt(e,r),this.g.U("stylized_image",((n,i)=>{var o=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)l[4*h]=s[3*h],l[4*h+1]=s[3*h+1],l[4*h+2]=s[3*h+2],l[4*h+3]=255;s=new ImageData(l,a,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new ht([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=o=o?a.clone():a,this.h&&this.h(o),J(this,i)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ir.prototype.stylize=Ir.prototype.Oa,Ir.prototype.setOptions=Ir.prototype.o,Ir.createFromModelPath=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetPath:t}})},Ir.createFromModelBuffer=function(e,t){return pe(Ir,e,{baseOptions:{modelAssetBuffer:t}})},Ir.createFromOptions=function(e,t){return pe(Ir,e,t)};var Kh=gr([0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[5,9],[9,10],[10,11],[11,12],[9,13],[13,14],[14,15],[15,16],[13,17],[0,17],[17,18],[18,19],[19,20]);function Zp(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Qp(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function ef(e,t=!0){let r=[];for(let i of e){var n=la(i);e=[];for(let o of n.g())n=t&&Yt(o,1)!=null?Yt(o,1)??0:-1,e.push({score:Je(o,2)??0,index:n,categoryName:Qt(o,3)??""??"",displayName:Qt(o,4)??""??""});r.push(e)}return r}var Ut=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.j=new Pm,0,1,t=new Le),this.s=new Oh,ne(this.j,0,2,this.s),this.C=new Bh,ne(this.s,0,3,this.C),this.v=new Rm,ne(this.s,0,2,this.v),this.h=new Mb,ne(this.j,0,3,this.h),Z(this.v,2,.5),Z(this.s,4,.5),Z(this.C,2,.5)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){if(Dr(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new si,r=t,n=Ll(e.cannedGesturesClassifierOptions,ye(this.h,si,3)?.h());ne(r,0,2,n),ne(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&ye(this.h,si,3)?.g();return e.customGesturesClassifierOptions?(ne(r=t=new si,0,2,n=Ll(e.customGesturesClassifierOptions,ye(this.h,si,4)?.h())),ne(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&ye(this.h,si,4)?.g(),this.l(e)}Ja(e,t){return Zp(this),rr(this,e,t),Qp(this)}Ka(e,t,r){return Zp(this),Br(this,e,r,t),Qp(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_gestures"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;pr(t,Nb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"HAND_GESTURES:hand_gestures"),fe(r,"LANDMARKS:hand_landmarks"),fe(r,"WORLD_LANDMARKS:world_hand_landmarks"),fe(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n){n=Io(o);let s=[];for(let a of Kr(n,_m,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.landmarks.push(s)}J(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n){n=pi(o);let s=[];for(let a of Kr(n,vm,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.worldLandmarks.push(s)}J(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,i)=>{this.gestures.push(...ef(n,!1)),J(this,i)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{J(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{this.handedness.push(...ef(n)),J(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function tf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ut.prototype.recognizeForVideo=Ut.prototype.Ka,Ut.prototype.recognize=Ut.prototype.Ja,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return pe(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return pe(Ut,e,t)},Ut.HAND_CONNECTIONS=Kh;var Ft=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.h=new Oh,0,1,t=new Le),this.s=new Bh,ne(this.h,0,3,this.s),this.j=new Rm,ne(this.h,0,2,this.j),Dr(this.j,3,1),Z(this.j,2,.5),Z(this.s,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numHands"in e&&Dr(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],rr(this,e,t),tf(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Br(this,e,r,t),tf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;pr(t,zb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"LANDMARKS:hand_landmarks"),fe(r,"WORLD_LANDMARKS:world_hand_landmarks"),fe(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n)n=Io(o),this.landmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n)n=pi(o),this.worldLandmarks.push(vo(n));J(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{J(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{var o=this.handedness,s=o.push;let a=[];for(let c of n){n=la(c);let l=[];for(let h of n.g())l.push({score:Je(h,2)??0,index:Yt(h,1)??0??-1,categoryName:Qt(h,3)??""??"",displayName:Qt(h,4)??""??""});a.push(l)}s.call(o,...a),J(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.prototype.detectForVideo=Ft.prototype.F,Ft.prototype.detect=Ft.prototype.D,Ft.prototype.setOptions=Ft.prototype.o,Ft.createFromModelPath=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetPath:t}})},Ft.createFromModelBuffer=function(e,t){return pe(Ft,e,{baseOptions:{modelAssetBuffer:t}})},Ft.createFromOptions=function(e,t){return pe(Ft,e,t)},Ft.HAND_CONNECTIONS=Kh;var ng=gr([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function rf(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function nf(e){try{if(!e.C)return e.h;e.C(e.h)}finally{pa(e)}}function As(e,t){e=Io(e),t.push(da(e))}var Ue=class extends It{constructor(e,t){super(new tr(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,ne(e=this.j=new Fm,0,1,t=new Le),this.J=new Bh,ne(this.j,0,2,this.J),this.Z=new jb,ne(this.j,0,3,this.Z),this.s=new ha,ne(this.j,0,4,this.s),this.H=new xm,ne(this.j,0,5,this.H),this.v=new Om,ne(this.j,0,6,this.v),this.K=new Um,ne(this.j,0,7,this.K),Z(this.s,2,.5),Z(this.s,3,.3),Z(this.H,2,.5),Z(this.v,2,.5),Z(this.v,3,.3),Z(this.K,2,.5),Z(this.J,2,.5)}get baseOptions(){return ye(this.j,Le,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&Z(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&Z(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&Z(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&Z(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&Z(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&Z(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,rf(this),rr(this,e,n),nf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,rf(this),Br(this,e,i,t),nf(this)}m(){var e=new Rt;Oe(e,"input_frames_image"),be(e,"pose_landmarks"),be(e,"pose_world_landmarks"),be(e,"face_landmarks"),be(e,"left_hand_landmarks"),be(e,"left_hand_world_landmarks"),be(e,"right_hand_landmarks"),be(e,"right_hand_world_landmarks");let t=new Nt,r=new Sp;Rl(r,1,Ci("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(i,o){if(o!=null)if(Array.isArray(o))Re(i,2,Rf(o));else{if(!(typeof o=="string"||o instanceof Gr||xo(o)))throw Error("invalid value in Any.value field: "+o+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Rl(i,2,Yl(o,!1),zn())}})(r,this.j.g());let n=new bt;jt(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Ns(n,8,Sp,r),Pe(n,"IMAGE:input_frames_image"),fe(n,"POSE_LANDMARKS:pose_landmarks"),fe(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),fe(n,"FACE_LANDMARKS:face_landmarks"),fe(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),fe(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),fe(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),fe(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Vt(e,n),ua(this,e),this.g.attachProtoListener("pose_landmarks",((i,o)=>{As(i,this.h.poseLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("pose_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("pose_world_landmarks",((i,o)=>{var s=this.h.poseWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(i=>{J(this,i)})),this.outputPoseSegmentationMasks&&(fe(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),_i(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((i,o)=>{this.h.poseSegmentationMasks=[ki(this,i,!0,!this.C)],J(this,o)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(i=>{this.h.poseSegmentationMasks=[],J(this,i)}))),this.g.attachProtoListener("face_landmarks",((i,o)=>{As(i,this.h.faceLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(i=>{J(this,i)})),this.outputFaceBlendshapes&&(be(e,"extra_blendshapes"),fe(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((i,o)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(i=la(i),s.push(Mh(i.g()??[]))),J(this,o)})),this.g.attachEmptyPacketListener("extra_blendshapes",(i=>{J(this,i)}))),this.g.attachProtoListener("left_hand_landmarks",((i,o)=>{As(i,this.h.leftHandLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("left_hand_world_landmarks",((i,o)=>{var s=this.h.leftHandWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("right_hand_landmarks",((i,o)=>{As(i,this.h.rightHandLandmarks),J(this,o)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(i=>{J(this,i)})),this.g.attachProtoListener("right_hand_world_landmarks",((i,o)=>{var s=this.h.rightHandWorldLandmarks;i=pi(i),s.push(vo(i)),J(this,o)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(i=>{J(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.detectForVideo=Ue.prototype.F,Ue.prototype.detect=Ue.prototype.D,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return pe(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return pe(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return pe(Ue,e,t)},Ue.HAND_CONNECTIONS=Kh,Ue.POSE_CONNECTIONS=ng,Ue.FACE_LANDMARKS_LIPS=Vh,Ue.FACE_LANDMARKS_LEFT_EYE=Hh,Ue.FACE_LANDMARKS_LEFT_EYEBROW=Wh,Ue.FACE_LANDMARKS_LEFT_IRIS=Qm,Ue.FACE_LANDMARKS_RIGHT_EYE=$h,Ue.FACE_LANDMARKS_RIGHT_EYEBROW=Gh,Ue.FACE_LANDMARKS_RIGHT_IRIS=eg,Ue.FACE_LANDMARKS_FACE_OVAL=qh,Ue.FACE_LANDMARKS_CONTOURS=tg,Ue.FACE_LANDMARKS_TESSELATION=rg;var Xt=class extends It{constructor(e,t){super(new tr(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},ne(e=this.h=new Lm,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return ne(this.h,0,2,Ll(e,ye(this.h,Rh,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},rr(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_image"),Oe(e,"norm_rect"),be(e,"classifications");let t=new Nt;pr(t,Vb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Pe(r,"IMAGE:input_image"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"CLASSIFICATIONS:classifications"),r.o(t),Vt(e,r),this.g.attachProtoListener("classifications",((n,i)=>{this.j=(function(o){let s={classifications:Kr(o,Tb,1).map((a=>Mh(ye(a,gm,4)?.g()??[],Yt(a,2)??0,Qt(a,3)??"")))};return Ms(bi(o,2))!=null&&(s.timestampMs=Ms(bi(o,2))??0),s})(Ib(n)),J(this,i)})),this.g.attachEmptyPacketListener("classifications",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Xt.prototype.classifyForVideo=Xt.prototype.ta,Xt.prototype.classify=Xt.prototype.sa,Xt.prototype.setOptions=Xt.prototype.o,Xt.createFromModelPath=function(e,t){return pe(Xt,e,{baseOptions:{modelAssetPath:t}})},Xt.createFromModelBuffer=function(e,t){return pe(Xt,e,{baseOptions:{modelAssetBuffer:t}})},Xt.createFromOptions=function(e,t){return pe(Xt,e,t)};var Lt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!0),this.h=new Mm,this.embeddings={embeddings:[]},ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){var t=this.h,r=ye(this.h,Pp,2);return r=r?r.clone():new Pp,e.l2Normalize!==void 0?So(r,1,e.l2Normalize):"l2Normalize"in e&&Re(r,1),e.quantize!==void 0?So(r,2,e.quantize):"quantize"in e&&Re(r,2),ne(t,0,2,r),this.l(e)}za(e,t){return rr(this,e,t),this.embeddings}Aa(e,t,r){return Br(this,e,r,t),this.embeddings}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"embeddings_out");let t=new Nt;pr(t,Hb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"EMBEDDINGS:embeddings_out"),r.o(t),Vt(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=Db(n),this.embeddings=(function(o){return{embeddings:Kr(o,Pb,1).map((s=>{let a={headIndex:Yt(s,3)??0??-1,headName:Qt(s,4)??""??""};if(Uf(s,Rp,yl(s,1))!==void 0)s=Ln(s=ye(s,Rp,yl(s,1)),1,pn,Fn()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=ye(s,Rb,yl(s,2))?.oa()?.h()??c}return a})),timestampMs:Ms(bi(o,2))??0}})(n),J(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Lt.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Fp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Fp(Up(e.quantizedEmbedding),Up(t.quantizedEmbedding))}return e},Lt.prototype.embedForVideo=Lt.prototype.Aa,Lt.prototype.embed=Lt.prototype.za,Lt.prototype.setOptions=Lt.prototype.o,Lt.createFromModelPath=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetPath:t}})},Lt.createFromModelBuffer=function(e,t){return pe(Lt,e,{baseOptions:{modelAssetBuffer:t}})},Lt.createFromOptions=function(e,t){return pe(Lt,e,t)};var jl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};function of(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function sf(e){try{let t=new jl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{pa(e)}}jl.prototype.close=jl.prototype.close;var xt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lh,this.v=new Nm,ne(this.h,0,3,this.v),ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ci(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=Kr(e.da(),bt,1).filter((r=>(Qt(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(ye(t[0],Nt,7)?.l()?.g()??new Map).forEach(((r,n)=>{e.s[Number(n)]=Qt(r,1)??""}))})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,of(this),rr(this,e,n),sf(this)}Ma(e,t,r,n){let i=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,of(this),Br(this,e,i,t),sf(this)}Da(){return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect");let t=new Nt;pr(t,jm,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),r.o(t),Vt(e,r),ua(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),fe(r,"CONFIDENCE_MASKS:confidence_masks"),_i(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),J(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],J(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),fe(r,"CATEGORY_MASK:category_mask"),_i(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),J(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,J(this,n)}))),be(e,"quality_scores"),fe(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,J(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xt.prototype.getLabels=xt.prototype.Da,xt.prototype.segmentForVideo=xt.prototype.Ma,xt.prototype.segment=xt.prototype.segment,xt.prototype.setOptions=xt.prototype.o,xt.createFromModelPath=function(e,t){return pe(xt,e,{baseOptions:{modelAssetPath:t}})},xt.createFromModelBuffer=function(e,t){return pe(xt,e,{baseOptions:{modelAssetBuffer:t}})},xt.createFromOptions=function(e,t){return pe(xt,e,t)};var Vl=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};Vl.prototype.close=Vl.prototype.close;var Qb=class extends Y{constructor(e){super(e)}},ai=[0,$e,-2],Hs=[0,Hr,-3,Fe,Hr,-1],af=[0,Hs],cf=[0,Hs,$e,-1],El=class extends Y{constructor(e){super(e)}},lf=[0,Hr,-1,Fe],ev=class extends Y{constructor(e){super(e)}},hf=class extends Y{constructor(e){super(e)}},Hl=[1,2,3,4,5,6,7,8,9,10,14,15],ig=class extends Y{constructor(e){super(e)}};ig.prototype.g=ca([0,st,[0,Hl,Ee,Hs,Ee,[0,Hs,ai],Ee,af,Ee,[0,af,ai],Ee,lf,Ee,[0,Hr,-3,Fe,er],Ee,[0,Hr,-3,Fe],Ee,[0,we,Hr,-2,Fe,$e,Fe,-1,2,Hr,ai],Ee,cf,Ee,[0,cf,ai],Hr,ai,we,Ee,[0,Hr,-3,Fe,ai,-1],Ee,[0,st,lf]],we,[0,we,$e,-1,Fe]]);var Rr=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Lh,this.s=new Nm,ne(this.h,0,3,this.s),ne(e=this.h,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let i=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new ig;let o=new hf;var s=new Qb;if(Dr(s,1,255),ne(o,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new El;So(a,3,!0),Z(a,1,t.keypoint.x),Z(a,2,t.keypoint.y),yo(o,5,Hl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new ev,t.scribble))So(t=new El,3,!0),Z(t,1,a.x),Z(t,2,a.y),Ns(s,1,El,t);yo(o,15,Hl,s)}Ns(n,1,hf,o),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),rr(this,e,i);e:{try{let l=new Vl(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{pa(this)}c=void 0}return c}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"roi_in"),Oe(e,"norm_rect_in");let t=new Nt;pr(t,jm,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"ROI:roi_in"),Pe(r,"NORM_RECT:norm_rect_in"),r.o(t),Vt(e,r),ua(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),fe(r,"CONFIDENCE_MASKS:confidence_masks"),_i(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>ki(this,o,!0,!this.j))),J(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],J(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),fe(r,"CATEGORY_MASK:category_mask"),_i(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=ki(this,n,!1,!this.j),J(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,J(this,n)}))),be(e,"quality_scores"),fe(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,J(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Rr.prototype.segment=Rr.prototype.segment,Rr.prototype.setOptions=Rr.prototype.o,Rr.createFromModelPath=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetPath:t}})},Rr.createFromModelBuffer=function(e,t){return pe(Rr,e,{baseOptions:{modelAssetBuffer:t}})},Rr.createFromOptions=function(e,t){return pe(Rr,e,t)};var At=class extends It{constructor(e,t){super(new tr(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},ne(e=this.h=new Vm,0,1,t=new Le)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ci(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),e.maxResults!==void 0?Dr(this.h,3,e.maxResults):"maxResults"in e&&Re(this.h,3),e.scoreThreshold!==void 0?Z(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Re(this.h,4),e.categoryAllowlist!==void 0?zs(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Re(this.h,5),e.categoryDenylist!==void 0?zs(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Re(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},rr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Br(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_frame_gpu"),Oe(e,"norm_rect"),be(e,"detections");let t=new Nt;pr(t,$b,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),Pe(r,"IMAGE:input_frame_gpu"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=bm(o),this.j.detections.push(Wm(n));J(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{J(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};At.prototype.detectForVideo=At.prototype.F,At.prototype.detect=At.prototype.D,At.prototype.setOptions=At.prototype.o,At.createFromModelPath=async function(e,t){return pe(At,e,{baseOptions:{modelAssetPath:t}})},At.createFromModelBuffer=function(e,t){return pe(At,e,{baseOptions:{modelAssetBuffer:t}})},At.createFromOptions=function(e,t){return pe(At,e,t)};var Wl=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function df(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function uf(e){try{let t=new Wl(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{pa(e)}}Wl.prototype.close=Wl.prototype.close;var Mt=class extends It{constructor(e,t){super(new tr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,ne(e=this.h=new Hm,0,1,t=new Le),this.v=new Um,ne(this.h,0,3,this.v),this.j=new Om,ne(this.h,0,2,this.j),Dr(this.j,4,1),Z(this.j,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Le,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numPoses"in e&&Dr(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Z(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Z(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,df(this),rr(this,e,n),uf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,df(this),Br(this,e,i,t),uf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"normalized_landmarks"),be(e,"world_landmarks"),be(e,"segmentation_masks");let t=new Nt;pr(t,Gb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),fe(r,"NORM_LANDMARKS:normalized_landmarks"),fe(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Vt(e,r),ua(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,i)=>{this.landmarks=[];for(let o of n)n=Io(o),this.landmarks.push(da(n));J(this,i)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],J(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,i)=>{this.worldLandmarks=[];for(let o of n)n=pi(o),this.worldLandmarks.push(vo(n));J(this,i)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],J(this,n)})),this.outputSegmentationMasks&&(fe(r,"SEGMENTATION_MASK:segmentation_masks"),_i(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,i)=>{this.segmentationMasks=n.map((o=>ki(this,o,!0,!this.s))),J(this,i)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],J(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mt.prototype.detectForVideo=Mt.prototype.F,Mt.prototype.detect=Mt.prototype.D,Mt.prototype.setOptions=Mt.prototype.o,Mt.createFromModelPath=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetPath:t}})},Mt.createFromModelBuffer=function(e,t){return pe(Mt,e,{baseOptions:{modelAssetBuffer:t}})},Mt.createFromOptions=function(e,t){return pe(Mt,e,t)},Mt.POSE_CONNECTIONS=ng;var Bi=class{constructor(t,r,n,i,o="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=o,this.classDiv=s,i&&(this.paramsConfig=i),n&&(this.options=n)}async initializeDetector(){let t=await nn.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Ct:At).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode}),console.log("BaseDetection initializeDetector",this.detectorType)}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(console.log("BaseDetection enableCam"),!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
50
50
  width: 20rem;
51
51
  border-radius: 10px;
52
52
  position: absolute;
@@ -63,7 +63,7 @@ Minimum version required to store current data is: `+o+`.
63
63
  border-radius: 50%;
64
64
  display: block;
65
65
  }
66
- `,document.getElementsByTagName("head")[0].appendChild(n)}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function og(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Oi=class extends Bi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,d=(a.width-10)*i,m=a.height*o,p=document.createElement("div");p.setAttribute("class","highlighter"),Object.assign(p.style,{right:`${l+20}px`,top:`${h}px`,width:`${d}px`,height:`${m-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let g=document.createElement("p"),f=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(g.innerText=`Confidence: ${f}%`,Object.assign(g.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(p),this.liveView.appendChild(g),this.children.push(p),this.children.push(g),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let E=b.x<2?b.x*n.videoWidth:b.x,k=b.y<2?b.y*n.videoHeight:b.y,x=(n.videoWidth-E)*i,D=k*o;Object.assign(_.style,{right:`${x+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=!1,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=r.detections[0],c=a.boundingBox,l=a.keypoints,h=l[0],d=l[1],m=l[3],p=l[4],g=l[5],f=l[2];o>s&&(c.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),n=!0,this.emmitedPositionAlert=!0):c.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0));let b=[c.originX,c.originY],_=[c.originX+c.width,c.originY+c.height];(b[0]<.1*c.width||b[1]<.2*c.height||_[0]>o-.1*c.width||_[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0);let E=b[0],k=o-_[0],R=b[1],x=s-_[1];E>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),R>4*x&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),k>2*E&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),x>3*R&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),n==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Po(e,t){return function(){return e.apply(t,arguments)}}var{toString:tv}=Object.prototype,{getPrototypeOf:Jh}=Object,ya=(e=>t=>{let r=tv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yr=e=>(e=e.toLowerCase(),t=>ya(t)===e),ba=e=>t=>typeof t===e,{isArray:Ui}=Array,Do=ba("undefined");function rv(e){return e!==null&&!Do(e)&&e.constructor!==null&&!Do(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var ag=yr("ArrayBuffer");function nv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ag(e.buffer),t}var iv=ba("string"),Ht=ba("function"),cg=ba("number"),va=e=>e!==null&&typeof e=="object",ov=e=>e===!0||e===!1,ga=e=>{if(ya(e)!=="object")return!1;let t=Jh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},sv=yr("Date"),av=yr("File"),cv=yr("Blob"),lv=yr("FileList"),hv=e=>va(e)&&Ht(e.pipe),dv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ya(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},uv=yr("URLSearchParams"),[pv,fv,mv,gv]=["ReadableStream","Request","Response","Headers"].map(yr),yv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Bo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ui(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function lg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hg=e=>!Do(e)&&e!==Vn;function Xh(){let{caseless:e}=hg(this)&&this||{},t={},r=(n,i)=>{let o=e&&lg(t,i)||i;ga(t[o])&&ga(n)?t[o]=Xh(t[o],n):ga(n)?t[o]=Xh({},n):Ui(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Bo(arguments[n],r);return t}var bv=(e,t,r,{allOwnKeys:n}={})=>(Bo(t,(i,o)=>{r&&Ht(i)?e[o]=Po(i,r):e[o]=i},{allOwnKeys:n}),e),vv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),_v=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},wv=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Jh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Sv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},kv=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!cg(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ev=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Jh(Uint8Array)),xv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Cv=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Av=yr("HTMLFormElement"),Tv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),sg=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Iv=yr("RegExp"),dg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Bo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Rv=e=>{dg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Pv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ui(e)?n(e):n(String(e).split(t)),r},Dv=()=>{},Bv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Ov(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Uv=e=>{let t=new Array(10),r=(n,i)=>{if(va(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Ui(n)?[]:{};return Bo(n,(s,a)=>{let c=r(s,i+1);!Do(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},Fv=yr("AsyncFunction"),Lv=e=>e&&(va(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),ug=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),Mv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||ug,T={isArray:Ui,isArrayBuffer:ag,isBuffer:rv,isFormData:dv,isArrayBufferView:nv,isString:iv,isNumber:cg,isBoolean:ov,isObject:va,isPlainObject:ga,isReadableStream:pv,isRequest:fv,isResponse:mv,isHeaders:gv,isUndefined:Do,isDate:sv,isFile:av,isBlob:cv,isRegExp:Iv,isFunction:Ht,isStream:hv,isURLSearchParams:uv,isTypedArray:Ev,isFileList:lv,forEach:Bo,merge:Xh,extend:bv,trim:yv,stripBOM:vv,inherits:_v,toFlatObject:wv,kindOf:ya,kindOfTest:yr,endsWith:Sv,toArray:kv,forEachEntry:xv,matchAll:Cv,isHTMLForm:Av,hasOwnProperty:sg,hasOwnProp:sg,reduceDescriptors:dg,freezeMethods:Rv,toObjectSet:Pv,toCamelCase:Tv,noop:Dv,toFiniteNumber:Bv,findKey:lg,global:Vn,isContextDefined:hg,isSpecCompliantForm:Ov,toJSONObject:Uv,isAsyncFn:Fv,isThenable:Lv,setImmediate:ug,asap:Mv};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var pg=Fi.prototype,fg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{fg[e]={value:e}});Object.defineProperties(Fi,fg);Object.defineProperty(pg,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(pg);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var le=Fi;var _a=null;function Yh(e){return T.isPlainObject(e)||T.isArray(e)}function gg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function mg(e,t,r){return e?e.concat(t).map(function(i,o){return i=gg(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Nv(e){return T.isArray(e)&&!e.some(Yh)}var zv=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function jv(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(_a||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!T.isUndefined(b[f])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new le("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,f,b){let _=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(f,"{}"))f=n?f:f.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Nv(g)||(T.isFileList(g)||T.endsWith(f,"[]"))&&(_=T.toArray(g)))return f=gg(f),_.forEach(function(k,R){!(T.isUndefined(k)||k===null)&&t.append(s===!0?mg([f],R,o):s===null?f:f+"[]",l(k))}),!1}return Yh(g)?!0:(t.append(mg(b,f,o),l(g)),!1)}let d=[],m=Object.assign(zv,{defaultVisitor:h,convertValue:l,isVisitable:Yh});function p(g,f){if(!T.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(g),T.forEach(g,function(_,E){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(E)?E.trim():E,f,m))===!0&&p(_,f?f.concat(E):[E])}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return p(e),t}var mn=jv;function yg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function bg(e,t){this._pairs=[],e&&mn(e,this,t)}var vg=bg.prototype;vg.append=function(t,r){this._pairs.push([t,r])};vg.toString=function(t){let r=t?function(n){return t.call(this,n,yg)}:yg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var wa=bg;function Vv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oo(e,t,r){if(!t)return e;let n=r&&r.encode||Vv;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new wa(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var Zh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Qh=Zh;var Sa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var _g=typeof URLSearchParams<"u"?URLSearchParams:wa;var wg=typeof FormData<"u"?FormData:null;var Sg=typeof Blob<"u"?Blob:null;var kg={isBrowser:!0,classes:{URLSearchParams:_g,FormData:wg,Blob:Sg},protocols:["http","https","file","blob","url","data"]};var rd={};Ty(rd,{hasBrowserEnv:()=>td,hasStandardBrowserEnv:()=>Hv,hasStandardBrowserWebWorkerEnv:()=>Wv,navigator:()=>ed,origin:()=>$v});var td=typeof window<"u"&&typeof document<"u",ed=typeof navigator=="object"&&navigator||void 0,Hv=td&&(!ed||["ReactNative","NativeScript","NS"].indexOf(ed.product)<0),Wv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$v=td&&window.location.href||"http://localhost";var je={...rd,...kg};function nd(e,t){return mn(e,new je.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return je.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Gv(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qv(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function Kv(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=qv(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t(Gv(n),i,r,0)}),r}return null}var ka=Kv;function Xv(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var id={transitional:Sa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(ka(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return nd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return mn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Xv(t)):t}],transformResponse:[function(t){let r=this.transitional||id.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?le.from(a,le.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{id.headers[e]={}});var Li=id;var Jv=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Eg=e=>{let t={},r,n,i;return e&&e.split(`
66
+ `,document.getElementsByTagName("head")[0].appendChild(n),console.log("BaseDetection enableCam OK")}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function og(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Oi=class extends Bi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1;console.log("FaceDetection constructor"),this.numFacesSent=-1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,d=(a.width-10)*i,m=a.height*o,p=document.createElement("div");p.setAttribute("class","highlighter"),Object.assign(p.style,{right:`${l+20}px`,top:`${h}px`,width:`${d}px`,height:`${m-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let g=document.createElement("p"),f=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(g.innerText=`Confidence: ${f}%`,Object.assign(g.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(p),this.liveView.appendChild(g),this.children.push(p),this.children.push(g),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let E=b.x<2?b.x*n.videoWidth:b.x,k=b.y<2?b.y*n.videoHeight:b.y,x=(n.videoWidth-E)*i,D=k*o;Object.assign(_.style,{right:`${x+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(console.log("this.numFacesSent",this.numFacesSent),console.log("result.detections.length",r.detections.length),this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=!1,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=r.detections[0],c=a.boundingBox,l=a.keypoints,h=l[0],d=l[1],m=l[3],p=l[4],g=l[5],f=l[2];o>s&&(c.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),n=!0,this.emmitedPositionAlert=!0):c.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0));let b=[c.originX,c.originY],_=[c.originX+c.width,c.originY+c.height];(b[0]<.1*c.width||b[1]<.2*c.height||_[0]>o-.1*c.width||_[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0);let E=b[0],k=o-_[0],R=b[1],x=s-_[1];E>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),R>4*x&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),k>2*E&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),x>3*R&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),n==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Po(e,t){return function(){return e.apply(t,arguments)}}var{toString:tv}=Object.prototype,{getPrototypeOf:Jh}=Object,ya=(e=>t=>{let r=tv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),yr=e=>(e=e.toLowerCase(),t=>ya(t)===e),ba=e=>t=>typeof t===e,{isArray:Ui}=Array,Do=ba("undefined");function rv(e){return e!==null&&!Do(e)&&e.constructor!==null&&!Do(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var ag=yr("ArrayBuffer");function nv(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ag(e.buffer),t}var iv=ba("string"),Ht=ba("function"),cg=ba("number"),va=e=>e!==null&&typeof e=="object",ov=e=>e===!0||e===!1,ga=e=>{if(ya(e)!=="object")return!1;let t=Jh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},sv=yr("Date"),av=yr("File"),cv=yr("Blob"),lv=yr("FileList"),hv=e=>va(e)&&Ht(e.pipe),dv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ya(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},uv=yr("URLSearchParams"),[pv,fv,mv,gv]=["ReadableStream","Request","Response","Headers"].map(yr),yv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Bo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Ui(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function lg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,hg=e=>!Do(e)&&e!==Vn;function Xh(){let{caseless:e}=hg(this)&&this||{},t={},r=(n,i)=>{let o=e&&lg(t,i)||i;ga(t[o])&&ga(n)?t[o]=Xh(t[o],n):ga(n)?t[o]=Xh({},n):Ui(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Bo(arguments[n],r);return t}var bv=(e,t,r,{allOwnKeys:n}={})=>(Bo(t,(i,o)=>{r&&Ht(i)?e[o]=Po(i,r):e[o]=i},{allOwnKeys:n}),e),vv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),_v=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},wv=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Jh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Sv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},kv=e=>{if(!e)return null;if(Ui(e))return e;let t=e.length;if(!cg(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Ev=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Jh(Uint8Array)),xv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Cv=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Av=yr("HTMLFormElement"),Tv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),sg=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Iv=yr("RegExp"),dg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Bo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Rv=e=>{dg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Pv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Ui(e)?n(e):n(String(e).split(t)),r},Dv=()=>{},Bv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Ov(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Uv=e=>{let t=new Array(10),r=(n,i)=>{if(va(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Ui(n)?[]:{};return Bo(n,(s,a)=>{let c=r(s,i+1);!Do(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},Fv=yr("AsyncFunction"),Lv=e=>e&&(va(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),ug=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),Mv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||ug,T={isArray:Ui,isArrayBuffer:ag,isBuffer:rv,isFormData:dv,isArrayBufferView:nv,isString:iv,isNumber:cg,isBoolean:ov,isObject:va,isPlainObject:ga,isReadableStream:pv,isRequest:fv,isResponse:mv,isHeaders:gv,isUndefined:Do,isDate:sv,isFile:av,isBlob:cv,isRegExp:Iv,isFunction:Ht,isStream:hv,isURLSearchParams:uv,isTypedArray:Ev,isFileList:lv,forEach:Bo,merge:Xh,extend:bv,trim:yv,stripBOM:vv,inherits:_v,toFlatObject:wv,kindOf:ya,kindOfTest:yr,endsWith:Sv,toArray:kv,forEachEntry:xv,matchAll:Cv,isHTMLForm:Av,hasOwnProperty:sg,hasOwnProp:sg,reduceDescriptors:dg,freezeMethods:Rv,toObjectSet:Pv,toCamelCase:Tv,noop:Dv,toFiniteNumber:Bv,findKey:lg,global:Vn,isContextDefined:hg,isSpecCompliantForm:Ov,toJSONObject:Uv,isAsyncFn:Fv,isThenable:Lv,setImmediate:ug,asap:Mv};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var pg=Fi.prototype,fg={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{fg[e]={value:e}});Object.defineProperties(Fi,fg);Object.defineProperty(pg,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(pg);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var le=Fi;var _a=null;function Yh(e){return T.isPlainObject(e)||T.isArray(e)}function gg(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function mg(e,t,r){return e?e.concat(t).map(function(i,o){return i=gg(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Nv(e){return T.isArray(e)&&!e.some(Yh)}var zv=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function jv(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(_a||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(f,b){return!T.isUndefined(b[f])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new le("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function h(g,f,b){let _=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(f,"{}"))f=n?f:f.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&Nv(g)||(T.isFileList(g)||T.endsWith(f,"[]"))&&(_=T.toArray(g)))return f=gg(f),_.forEach(function(k,R){!(T.isUndefined(k)||k===null)&&t.append(s===!0?mg([f],R,o):s===null?f:f+"[]",l(k))}),!1}return Yh(g)?!0:(t.append(mg(b,f,o),l(g)),!1)}let d=[],m=Object.assign(zv,{defaultVisitor:h,convertValue:l,isVisitable:Yh});function p(g,f){if(!T.isUndefined(g)){if(d.indexOf(g)!==-1)throw Error("Circular reference detected in "+f.join("."));d.push(g),T.forEach(g,function(_,E){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(E)?E.trim():E,f,m))===!0&&p(_,f?f.concat(E):[E])}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return p(e),t}var mn=jv;function yg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function bg(e,t){this._pairs=[],e&&mn(e,this,t)}var vg=bg.prototype;vg.append=function(t,r){this._pairs.push([t,r])};vg.toString=function(t){let r=t?function(n){return t.call(this,n,yg)}:yg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var wa=bg;function Vv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oo(e,t,r){if(!t)return e;let n=r&&r.encode||Vv;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new wa(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var Zh=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Qh=Zh;var Sa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var _g=typeof URLSearchParams<"u"?URLSearchParams:wa;var wg=typeof FormData<"u"?FormData:null;var Sg=typeof Blob<"u"?Blob:null;var kg={isBrowser:!0,classes:{URLSearchParams:_g,FormData:wg,Blob:Sg},protocols:["http","https","file","blob","url","data"]};var rd={};Ty(rd,{hasBrowserEnv:()=>td,hasStandardBrowserEnv:()=>Hv,hasStandardBrowserWebWorkerEnv:()=>Wv,navigator:()=>ed,origin:()=>$v});var td=typeof window<"u"&&typeof document<"u",ed=typeof navigator=="object"&&navigator||void 0,Hv=td&&(!ed||["ReactNative","NativeScript","NS"].indexOf(ed.product)<0),Wv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$v=td&&window.location.href||"http://localhost";var je={...rd,...kg};function nd(e,t){return mn(e,new je.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return je.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Gv(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function qv(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function Kv(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=qv(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t(Gv(n),i,r,0)}),r}return null}var ka=Kv;function Xv(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var id={transitional:Sa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(ka(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return nd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return mn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Xv(t)):t}],transformResponse:[function(t){let r=this.transitional||id.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?le.from(a,le.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{id.headers[e]={}});var Li=id;var Jv=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Eg=e=>{let t={},r,n,i;return e&&e.split(`
67
67
  `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&Jv[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var xg=Symbol("internals");function Uo(e){return e&&String(e).trim().toLowerCase()}function Ea(e){return e===!1||e==null?e:T.isArray(e)?e.map(Ea):String(e)}function Yv(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var Zv=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function od(e,t,r,n,i){if(T.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!T.isString(t)){if(T.isString(n))return t.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(t)}}function Qv(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function e_(e,t){let r=T.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}var Mi=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(a,c,l){let h=Uo(c);if(!h)throw new Error("header name must be a non-empty string");let d=T.findKey(i,h);(!d||i[d]===void 0||l===!0||l===void 0&&i[d]!==!1)&&(i[d||c]=Ea(a))}let s=(a,c)=>T.forEach(a,(l,h)=>o(l,h,c));if(T.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(T.isString(t)&&(t=t.trim())&&!Zv(t))s(Eg(t),r);else if(T.isHeaders(t))for(let[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=Uo(t),t){let n=T.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return Yv(i);if(T.isFunction(r))return r.call(this,i,n);if(T.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Uo(t),t){let n=T.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||od(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(s){if(s=Uo(s),s){let a=T.findKey(n,s);a&&(!r||od(n,n[a],a,r))&&(delete n[a],i=!0)}}return T.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||od(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return T.forEach(this,(i,o)=>{let s=T.findKey(n,o);if(s){r[s]=Ea(i),delete r[o];return}let a=t?Qv(o):String(o).trim();a!==o&&delete r[o],r[a]=Ea(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&T.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
68
68
  `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[xg]=this[xg]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Uo(s);n[a]||(e_(i,s),n[a]=!0)}return T.isArray(t)?t.forEach(o):o(t),this}};Mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Mi.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});T.freezeMethods(Mi);var at=Mi;function Fo(e,t){let r=this||Li,n=t||r,i=at.from(n.headers),o=n.data;return T.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function Lo(e){return!!(e&&e.__CANCEL__)}function Cg(e,t,r){le.call(this,e??"canceled",le.ERR_CANCELED,t,r),this.name="CanceledError"}T.inherits(Cg,le,{__CANCEL__:!0});var Or=Cg;function Mo(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new le("Request failed with status code "+r.status,[le.ERR_BAD_REQUEST,le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function sd(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function t_(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),h=n[o];s||(s=l),r[i]=c,n[i]=l;let d=o,m=0;for(;d!==i;)m+=r[d++],d=d%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;let p=h&&l-h;return p?Math.round(m*1e3/p):void 0}}var Ag=t_;function r_(e,t){let r=0,n=1e3/t,i,o,s=(l,h=Date.now())=>{r=h,i=null,o&&(clearTimeout(o),o=null),e.apply(null,l)};return[(...l)=>{let h=Date.now(),d=h-r;d>=n?s(l,h):(i=l,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i)]}var Tg=r_;var Ni=(e,t,r=3)=>{let n=0,i=Ag(50,250);return Tg(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,l=i(c),h=s<=a;n=s;let d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},ad=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},cd=e=>(...t)=>T.asap(()=>e(...t));var Ig=je.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,je.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(je.origin),je.navigator&&/(msie|trident)/i.test(je.navigator.userAgent)):()=>!0;var Rg=je.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];T.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),T.isString(n)&&s.push("path="+n),T.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ld(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function hd(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function No(e,t,r){let n=!ld(t);return e&&(n||r==!1)?hd(e,t):t}var Pg=e=>e instanceof at?{...e}:e;function br(e,t){t=t||{};let r={};function n(l,h,d,m){return T.isPlainObject(l)&&T.isPlainObject(h)?T.merge.call({caseless:m},l,h):T.isPlainObject(h)?T.merge({},h):T.isArray(h)?h.slice():h}function i(l,h,d,m){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l,d,m)}else return n(l,h,d,m)}function o(l,h){if(!T.isUndefined(h))return n(void 0,h)}function s(l,h){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function a(l,h,d){if(d in t)return n(l,h);if(d in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,h,d)=>i(Pg(l),Pg(h),d,!0)};return T.forEach(Object.keys(Object.assign({},e,t)),function(h){let d=c[h]||i,m=d(e[h],t[h],h);T.isUndefined(m)&&d!==a||(r[h]=m)}),r}var xa=e=>{let t=br({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=at.from(s),t.url=Oo(No(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(r)){if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...h]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...h].join("; "))}}if(je.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(t)),n||n!==!1&&Ig(t.url))){let l=i&&o&&Rg.read(o);l&&s.set(i,l)}return t};var n_=typeof XMLHttpRequest<"u",Dg=n_&&function(e){return new Promise(function(r,n){let i=xa(e),o=i.data,s=at.from(i.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,h,d,m,p,g;function f(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function _(){if(!b)return;let k=at.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:k,config:e,request:b};Mo(function(I){r(I),f()},function(I){n(I),f()},x),b=null}"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(_)},b.onabort=function(){b&&(n(new le("Request aborted",le.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new le("Network Error",le.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",x=i.transitional||Sa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new le(R,x.clarifyTimeoutError?le.ETIMEDOUT:le.ECONNABORTED,e,b)),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&T.forEach(s.toJSON(),function(R,x){b.setRequestHeader(x,R)}),T.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),l&&([m,g]=Ni(l,!0),b.addEventListener("progress",m)),c&&b.upload&&([d,p]=Ni(c),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(h=k=>{b&&(n(!k||k.type?new Or(null,e,b):k),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));let E=sd(i.url);if(E&&je.protocols.indexOf(E)===-1){n(new le("Unsupported protocol "+E+":",le.ERR_BAD_REQUEST,e));return}b.send(o||null)})};var i_=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,a();let h=l instanceof Error?l:this.reason;n.abort(h instanceof le?h:new Or(h instanceof Error?h.message:h))}},s=t&&setTimeout(()=>{s=null,o(new le(`timeout ${t} of ms exceeded`,le.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>T.asap(a),c}},Bg=i_;var o_=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},s_=async function*(e,t){for await(let r of a_(e))yield*o_(r,t)},a_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},dd=(e,t,r,n)=>{let i=s_(e,t),o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:h}=await i.next();if(l){a(),c.close();return}let d=h.byteLength;if(r){let m=o+=d;r(m)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};var Aa=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ug=Aa&&typeof ReadableStream=="function",c_=Aa&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Fg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},l_=Ug&&Fg(()=>{let e=!1,t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Og=64*1024,ud=Ug&&Fg(()=>T.isReadableStream(new Response("").body)),Ca={stream:ud&&(e=>e.body)};Aa&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ca[t]&&(Ca[t]=T.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new le(`Response type '${t}' is not supported`,le.ERR_NOT_SUPPORT,n)})})})(new Response);var h_=async e=>{if(e==null)return 0;if(T.isBlob(e))return e.size;if(T.isSpecCompliantForm(e))return(await new Request(je.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(T.isArrayBufferView(e)||T.isArrayBuffer(e))return e.byteLength;if(T.isURLSearchParams(e)&&(e=e+""),T.isString(e))return(await c_(e)).byteLength},d_=async(e,t)=>{let r=T.toFiniteNumber(e.getContentLength());return r??h_(t)},Lg=Aa&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:d="same-origin",fetchOptions:m}=xa(e);l=l?(l+"").toLowerCase():"text";let p=Bg([i,o&&o.toAbortSignal()],s),g,f=p&&p.unsubscribe&&(()=>{p.unsubscribe()}),b;try{if(c&&l_&&r!=="get"&&r!=="head"&&(b=await d_(h,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),D;if(T.isFormData(n)&&(D=x.headers.get("content-type"))&&h.setContentType(D),x.body){let[I,N]=ad(b,Ni(cd(c)));n=dd(x.body,Og,I,N)}}T.isString(d)||(d=d?"include":"omit");let _="credentials"in Request.prototype;g=new Request(t,{...m,signal:p,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:_?d:void 0});let E=await fetch(g),k=ud&&(l==="stream"||l==="response");if(ud&&(a||k&&f)){let x={};["status","statusText","headers"].forEach(q=>{x[q]=E[q]});let D=T.toFiniteNumber(E.headers.get("content-length")),[I,N]=a&&ad(D,Ni(cd(a),!0))||[];E=new Response(dd(E.body,Og,I,()=>{N&&N(),f&&f()}),x)}l=l||"text";let R=await Ca[T.findKey(Ca,l)||"text"](E,e);return!k&&f&&f(),await new Promise((x,D)=>{Mo(x,D,{data:R,headers:at.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:g})})}catch(_){throw f&&f(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new le("Network Error",le.ERR_NETWORK,e,g),{cause:_.cause||_}):le.from(_,_&&_.code,e,g)}});var pd={http:_a,xhr:Dg,fetch:Lg};T.forEach(pd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Mg=e=>`- ${e}`,u_=e=>T.isFunction(e)||e===null||e===!1,Ta={getAdapter:e=>{e=T.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!u_(r)&&(n=pd[(s=String(r)).toLowerCase()],n===void 0))throw new le(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?o.length>1?`since :
69
69
  `+o.map(Mg).join(`
@@ -503,7 +503,7 @@ registerProcessor("audio-processor", AudioProcessor);
503
503
  <circle cx="10" cy="10" r="9" stroke="#16A34A" stroke-width="2" fill="none"/>
504
504
  <path d="M6 10L9 13L14 7" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
505
505
  </svg>
506
- `,this.applyStyles(_,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let E=document.createElement("span");E.innerText=f,b.appendChild(_),b.appendChild(E),c.appendChild(b)}),s.appendChild(c);let h=document.createElement("button");h.innerText="Capturar foto",h.id="position-capture-button",this.applyStyles(h,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),h.onclick=()=>{if(this.connection){let f=document.getElementById("photo-message");f&&(f.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),h.disabled=!0,this.applyStyles(h,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(h),i.appendChild(s),t.appendChild(i);let d=document.createElement("div");this.applyStyles(d,{marginTop:"10px",fontSize:"13px",color:"#666"});let m=document.createElement("span");m.innerText="Dica: ",m.style.fontWeight="bold";let p=document.createElement("span");p.innerText="mantenha o celular est\xE1vel durante todo o processo.",d.appendChild(m),d.appendChild(p),t.appendChild(d);let g=document.getElementById("external-camera-continue");g.disabled=!0,this.applyStyles(g,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let i=document.getElementById("external-camera-continue");i.disabled=!1,i.innerText="Concluir",this.applyStyles(i,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),i.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new as().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:Ve.WebSockets,withCredentials:!1,skipNegotiation:!0}).withAutomaticReconnect().configureLogging(U.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let o=wy[n];this.handleWebSocketMessage(o)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}}),this.connection.on("ReceiveAction",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}});try{await this.connection.start()}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),i=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),i&&(i.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let o=document.getElementById("photo-icon-container");if(o&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(o.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop()}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){e.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}};var cl=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1,realtimePackageSize:10,realtimeCaptureInterval:2}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onLostFocusAlertRecorderCallback=t=>{};this.onFocusCallback=()=>{};this.onFocusAlertRecorderCallback=t=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=t=>{};this.onBufferSizeErrorCallback=t=>{};this.backend=new nr({type:t.type||"prod",token:t.token}),this.repository=new rs("EasyProctorDb","exams2"),this.repositoryDevices=new rs("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new Ic(this.context.credentials.cpf,this.backend)),this.appChecker=new al(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{me.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:34,type:3}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusAlertRecorderCallback(){this.onLostFocusAlertRecorderCallback=async t=>{this.onLostFocusCallback&&this.onLostFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"lost_focus",category:"lost_focus",description:"Perda de foco no exame",begin:t.begin,end:t.end,alert:25,status:"ALERT"})}}setOnFocusAlertRecorderCallback(){this.onFocusAlertRecorderCallback=async t=>{this.onFocusCallback&&this.onFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"focus",category:"focus",description:"Retorno de foco no exame",begin:t.begin,end:t.end,alert:25,status:"OK"})}}async setOnLostFocusCallback(t){this.onLostFocusCallback=async()=>await t(),this.setOnLostFocusAlertRecorderCallback()}async setOnFocusCallback(t){this.onFocusCallback=async()=>await t(),this.setOnFocusAlertRecorderCallback()}async onChangeDevices(t={}){new Wa(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return 1;case"multiple_faces_detected":return 2;case"multiple_persons_detected":return 28;case"no_person_detected":return 29;case"lost_focus":return 25;case"focus":return 25;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return 0;case"person_detection_on_stream":return 1;case"lost_focus":return 2;case"focus":return 2;default:return null}}async stopRealtimeAlert(t){let n=async i=>{if(!(i>3))try{var o=await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(t.type),alertImageBase64:t.description!=="face_stop"?await this.allRecorders.cameraRecorder.getCurrentImageBase64():"",retry:i<2});return o}catch(s){return console.log("error stopRealtimeAlert",s),n(i+1)}};await n(1)}async onRealtimeAlerts(t={}){this.setOnLostFocusAlertRecorderCallback(),this.setOnFocusAlertRecorderCallback(),this.onRealtimeAlertsCallback=async r=>{t.data&&t.data(r),this.sessionOptions.proctoringType==="REALTIME"&&(r.type==="face_detection_on_stream"||r.type==="person_detection_on_stream"||r.type==="lost_focus"||r.type==="focus")&&(r.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,alert:this.convertRealtimeCategoryToAlertCategory(r.category)}):r.status==="OK"&&await this.stopRealtimeAlert(r))}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}async createRecorders(t=ir){this.onChangeDevices(),console.log("Creating recorders"),await this.recorder?.stopAll();let r=new Zr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new Tc({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,i=new Ga({onFocusCallback:a=>this.onFocusAlertRecorderCallback(a),onLostFocusCallback:a=>this.onLostFocusAlertRecorderCallback(a),onRealtimeAlertCallback:a=>this.onRealtimeAlertsCallback(a)},t),o=new Ac(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,o,i].filter(Boolean);return this.sessionOptions.proctoringType!="REALTIME"&&n&&s.push(n),this.recorder=new $a(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:i,noiseRecorder:o}}async login(){if(!this.context.credentials?.cpf)throw e0;this.context.token=await this.auth.login()}async start(t=ir,r={}){try{if(this.context.token===void 0)throw Qg;t.useChallenge&&(this.extensionEasycatcher=new Ha),this.extension=new Va,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),i=await ur();await this.repositoryDevices.save({...i,id:"devices"}),this.sessionOptions={...ir,...t},this.videoOptions=Ba(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw t0}if(this.state!="Stop")throw Xg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Hn,this.allRecorders=await this.createRecorders(this.sessionOptions);let o=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=o.id,me.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(i)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw r0}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId);try{console.log("Starting recorders"),await this.recorder.startAll()}catch(l){throw console.log("Starting recorders error:",l),l}t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let l in navigator)s[l]=navigator[l];me.registerStart(this.proctoringId,!0,`Version: ${ns()}
506
+ `,this.applyStyles(_,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let E=document.createElement("span");E.innerText=f,b.appendChild(_),b.appendChild(E),c.appendChild(b)}),s.appendChild(c);let h=document.createElement("button");h.innerText="Capturar foto",h.id="position-capture-button",this.applyStyles(h,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),h.onclick=()=>{if(this.connection){let f=document.getElementById("photo-message");f&&(f.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),h.disabled=!0,this.applyStyles(h,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(h),i.appendChild(s),t.appendChild(i);let d=document.createElement("div");this.applyStyles(d,{marginTop:"10px",fontSize:"13px",color:"#666"});let m=document.createElement("span");m.innerText="Dica: ",m.style.fontWeight="bold";let p=document.createElement("span");p.innerText="mantenha o celular est\xE1vel durante todo o processo.",d.appendChild(m),d.appendChild(p),t.appendChild(d);let g=document.getElementById("external-camera-continue");g.disabled=!0,this.applyStyles(g,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let i=document.getElementById("external-camera-continue");i.disabled=!1,i.innerText="Concluir",this.applyStyles(i,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),i.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new as().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:Ve.WebSockets,withCredentials:!1,skipNegotiation:!0}).withAutomaticReconnect().configureLogging(U.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let o=wy[n];this.handleWebSocketMessage(o)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}}),this.connection.on("ReceiveAction",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}});try{await this.connection.start()}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),i=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),i&&(i.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let o=document.getElementById("photo-icon-container");if(o&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(o.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop()}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){e.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}};var cl=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1,realtimePackageSize:10,realtimeCaptureInterval:2}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onLostFocusAlertRecorderCallback=t=>{};this.onFocusCallback=()=>{};this.onFocusAlertRecorderCallback=t=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=async t=>{await this.internalOnRealtimeAlerts(t)};this.onBufferSizeErrorCallback=t=>{};this.backend=new nr({type:t.type||"prod",token:t.token}),this.repository=new rs("EasyProctorDb","exams2"),this.repositoryDevices=new rs("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new Ic(this.context.credentials.cpf,this.backend)),this.appChecker=new al(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{me.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:34,type:3}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusAlertRecorderCallback(){this.onLostFocusAlertRecorderCallback=async t=>{this.onLostFocusCallback&&this.onLostFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"lost_focus",category:"lost_focus",description:"Perda de foco no exame",begin:t.begin,end:t.end,alert:25,status:"ALERT"})}}setOnFocusAlertRecorderCallback(){this.onFocusAlertRecorderCallback=async t=>{this.onFocusCallback&&this.onFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"focus",category:"focus",description:"Retorno de foco no exame",begin:t.begin,end:t.end,alert:25,status:"OK"})}}async setOnLostFocusCallback(t){this.onLostFocusCallback=async()=>await t(),this.setOnLostFocusAlertRecorderCallback()}async setOnFocusCallback(t){this.onFocusCallback=async()=>await t(),this.setOnFocusAlertRecorderCallback()}async onChangeDevices(t={}){new Wa(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return 1;case"multiple_faces_detected":return 2;case"multiple_persons_detected":return 28;case"no_person_detected":return 29;case"lost_focus":return 25;case"focus":return 25;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return 0;case"person_detection_on_stream":return 1;case"lost_focus":return 2;case"focus":return 2;default:return null}}async stopRealtimeAlert(t){let n=async i=>{if(!(i>3))try{var o=await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(t.type),alertImageBase64:t.description!=="face_stop"?await this.allRecorders.cameraRecorder.getCurrentImageBase64():"",retry:i<2});return o}catch(s){return console.log("error stopRealtimeAlert",s),n(i+1)}};await n(1)}async internalOnRealtimeAlerts(t){this.sessionOptions.proctoringType==="REALTIME"&&(t.type==="face_detection_on_stream"||t.type==="person_detection_on_stream"||t.type==="lost_focus"||t.type==="focus")&&(t.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,alert:this.convertRealtimeCategoryToAlertCategory(t.category)}):t.status==="OK"&&await this.stopRealtimeAlert(t))}async onRealtimeAlerts(t={}){this.setOnLostFocusAlertRecorderCallback(),this.setOnFocusAlertRecorderCallback(),this.onRealtimeAlertsCallback=async r=>{await this.internalOnRealtimeAlerts(r),t.data&&t.data(r)}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}async createRecorders(t=ir){this.onChangeDevices(),console.log("Creating recorders"),await this.recorder?.stopAll();let r=new Zr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new Tc({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,i=new Ga({onFocusCallback:a=>this.onFocusAlertRecorderCallback(a),onLostFocusCallback:a=>this.onLostFocusAlertRecorderCallback(a),onRealtimeAlertCallback:a=>this.onRealtimeAlertsCallback(a)},t),o=new Ac(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,o,i].filter(Boolean);return this.sessionOptions.proctoringType!="REALTIME"&&n&&s.push(n),this.recorder=new $a(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:n,alertRecorder:i,noiseRecorder:o}}async login(){if(!this.context.credentials?.cpf)throw e0;this.context.token=await this.auth.login()}async start(t=ir,r={}){try{if(this.context.token===void 0)throw Qg;t.useChallenge&&(this.extensionEasycatcher=new Ha),this.extension=new Va,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),i=await ur();await this.repositoryDevices.save({...i,id:"devices"}),this.sessionOptions={...ir,...t},this.videoOptions=Ba(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw t0}if(this.state!="Stop")throw Xg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Hn,this.allRecorders=await this.createRecorders(this.sessionOptions);let o=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=o.id,me.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(i)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw r0}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId);try{console.log("Starting recorders"),await this.recorder.startAll()}catch(l){throw console.log("Starting recorders error:",l),l}t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let l in navigator)s[l]=navigator[l];me.registerStart(this.proctoringId,!0,`Version: ${ns()}
507
507
  Navigator: ${JSON.stringify(s)}`),o.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(o.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording";let a=0,c=!1;return this.verifyFirstFaceInterval=setInterval(async()=>{if(this.sessionOptions.proctoringType==="REALTIME"){if(c)return;c=!0,a++;try{var l=await this.backend.verifyFace(this.proctoringId,await this.allRecorders.cameraRecorder.getCurrentImageBase64(),!(a>2));c=!1,clearInterval(this.verifyFirstFaceInterval)}catch{c=!1;return}}},5e3),o}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&me.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
508
508
  Version: ${ns()}
509
509
  Navigator: ${navigator}