@techlabi/kycrazy-ui-kit 0.51.0-beta.2 → 0.51.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.51.0
4
+
5
+ ### Improvements
6
+
7
+ - Optimized ID and Selfie validation for faster verification results
8
+ - Enhanced image capture quality for ID and Selfie uploads
9
+
3
10
  ## 0.50.0
4
11
 
5
12
  ### Features
package/dist/index.es.js CHANGED
@@ -24547,16 +24547,19 @@ class IS {
24547
24547
  }
24548
24548
  }
24549
24549
  async validateIdCard(e, a) {
24550
- if (typeof window > "u") return { type: a, passed: !1 };
24551
- const t = await this.getOCRWorker(), {
24552
- data: { text: n }
24553
- } = await t.recognize(e), i = 3, o = 4, A = 4, s = n.match(new RegExp(`\\b[a-zA-Z]{${o},}\\b`, "g")) ?? [], f = n.match(new RegExp(`\\b\\d{${A},}\\b`, "g")) ?? [];
24554
- return {
24555
- type: a,
24556
- passed: s.length >= i || f.length >= 1,
24557
- textSnippet: n.replace(/[^a-zA-Z0-9]/g, "").slice(0, 200),
24558
- fullText: n
24559
- };
24550
+ try {
24551
+ const t = await this.getOCRWorker(), {
24552
+ data: { text: n }
24553
+ } = await t.recognize(e), i = 3, o = 4, A = 4, s = n.match(new RegExp(`\\b[a-zA-Z]{${o},}\\b`, "g")) ?? [], f = n.match(new RegExp(`\\b\\d{${A},}\\b`, "g")) ?? [];
24554
+ return {
24555
+ type: a,
24556
+ passed: s.length >= i || f.length >= 1,
24557
+ textSnippet: n.replace(/[^a-zA-Z0-9]/g, "").slice(0, 200),
24558
+ fullText: n
24559
+ };
24560
+ } catch (t) {
24561
+ return console.error("[ImageValidator] OCR validation error:", t), { type: a, passed: !1 };
24562
+ }
24560
24563
  }
24561
24564
  }
24562
24565
  const Vt = new IS(), BS = (r, e, a, t, n, i, o, A) => {
package/dist/index.umd.js CHANGED
@@ -168,7 +168,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
168
168
  void main(void) {
169
169
  gl_Position = vec4(aVertex, 0.0, 1.0);
170
170
  vTex = aTex;
171
- }`,r.VERTEX_SHADER),this.Y=jm(this,this.G(),r.FRAGMENT_SHADER),r.linkProgram(this.h),!r.getProgramParameter(this.h,r.LINK_STATUS))throw Error(`Error during program linking: ${r.getProgramInfoLog(this.h)}`);this.P=r.getAttribLocation(this.h,"aVertex"),this.J=r.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const r=this.g;r.deleteProgram(this.h),r.deleteShader(this.Z),r.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function Et(r,e){switch(e){case 0:return r.g.find(a=>a instanceof Uint8Array);case 1:return r.g.find(a=>a instanceof Float32Array);case 2:return r.g.find(a=>typeof WebGLTexture<"u"&&a instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Kl(r){var e=Et(r,1);if(!e){if(e=Et(r,0))e=new Float32Array(e).map(t=>t/255);else{e=new Float32Array(r.width*r.height);const t=ai(r);var a=ql(r);if(Us(a,t,Um(r)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){a=new Float32Array(r.width*r.height*4),t.readPixels(0,0,r.width,r.height,t.RGBA,t.FLOAT,a);for(let n=0,i=0;n<e.length;++n,i+=4)e[n]=a[i]}else t.readPixels(0,0,r.width,r.height,t.RED,t.FLOAT,e)}r.g.push(e)}return e}function Um(r){let e=Et(r,2);if(!e){const a=ai(r);e=Hm(r);const t=Kl(r),n=Ym(r);a.texImage2D(a.TEXTURE_2D,0,n,r.width,r.height,0,a.RED,a.FLOAT,t),rc(r)}return e}function ai(r){if(!r.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return r.h||(r.h=kt(r.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),r.h}function Ym(r){if(r=ai(r),!Ys)if(r.getExtension("EXT_color_buffer_float")&&r.getExtension("OES_texture_float_linear")&&r.getExtension("EXT_float_blend"))Ys=r.R32F;else{if(!r.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Ys=r.R16F}return Ys}function ql(r){return r.l||(r.l=new zl),r.l}function Hm(r){const e=ai(r);e.viewport(0,0,r.width,r.height),e.activeTexture(e.TEXTURE0);let a=Et(r,2);return a||(a=Ls(ql(r),e,r.m?e.LINEAR:e.NEAREST),r.g.push(a),r.j=!0),e.bindTexture(e.TEXTURE_2D,a),a}function rc(r){r.h.bindTexture(r.h.TEXTURE_2D,null)}var Ys,re=class{constructor(r,e,a,t,n,i,o){this.g=r,this.m=e,this.j=a,this.canvas=t,this.l=n,this.width=i,this.height=o,this.j&&--Qm===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!Et(this,0)}ja(){return!!Et(this,1)}R(){return!!Et(this,2)}ia(){return(e=Et(r=this,0))||(e=Kl(r),e=new Uint8Array(e.map(a=>255*a)),r.g.push(e)),e;var r,e}ha(){return Kl(this)}N(){return Um(this)}clone(){const r=[];for(const e of this.g){let a;if(e instanceof Uint8Array)a=new Uint8Array(e);else if(e instanceof Float32Array)a=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const t=ai(this),n=ql(this);t.activeTexture(t.TEXTURE1),a=Ls(n,t,this.m?t.LINEAR:t.NEAREST),t.bindTexture(t.TEXTURE_2D,a);const i=Ym(this);t.texImage2D(t.TEXTURE_2D,0,i,this.width,this.height,0,t.RED,t.FLOAT,null),t.bindTexture(t.TEXTURE_2D,null),Us(n,t,a),Ql(n,t,!1,()=>{Hm(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),rc(this)}),Jl(n),rc(this)}}r.push(a)}return new re(r,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&ai(this).deleteTexture(Et(this,2)),Qm=-1}};re.prototype.close=re.prototype.close,re.prototype.clone=re.prototype.clone,re.prototype.getAsWebGLTexture=re.prototype.N,re.prototype.getAsFloat32Array=re.prototype.ha,re.prototype.getAsUint8Array=re.prototype.ia,re.prototype.hasWebGLTexture=re.prototype.R,re.prototype.hasFloat32Array=re.prototype.ja,re.prototype.hasUint8Array=re.prototype.Da;var Qm=250;function Ra(r,e){switch(e){case 0:return r.g.find(a=>a instanceof ImageData);case 1:return r.g.find(a=>typeof ImageBitmap<"u"&&a instanceof ImageBitmap);case 2:return r.g.find(a=>typeof WebGLTexture<"u"&&a instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Jm(r){var e=Ra(r,0);if(!e){e=ti(r);const a=Qs(r),t=new Uint8Array(r.width*r.height*4);Us(a,e,Hs(r)),e.readPixels(0,0,r.width,r.height,e.RGBA,e.UNSIGNED_BYTE,t),Jl(a),e=new ImageData(new Uint8ClampedArray(t.buffer),r.width,r.height),r.g.push(e)}return e}function Hs(r){let e=Ra(r,2);if(!e){const a=ti(r);e=Js(r);const t=Ra(r,1)||Jm(r);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,t),Zo(r)}return e}function ti(r){if(!r.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return r.h||(r.h=kt(r.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),r.h}function Qs(r){return r.l||(r.l=new zl),r.l}function Js(r){const e=ti(r);e.viewport(0,0,r.width,r.height),e.activeTexture(e.TEXTURE0);let a=Ra(r,2);return a||(a=Ls(Qs(r),e),r.g.push(a),r.m=!0),e.bindTexture(e.TEXTURE_2D,a),a}function Zo(r){r.h.bindTexture(r.h.TEXTURE_2D,null)}function zm(r){const e=ti(r);return Ql(Qs(r),e,!0,()=>function(a,t){const n=a.canvas;if(n.width===a.width&&n.height===a.height)return t();const i=n.width,o=n.height;return n.width=a.width,n.height=a.height,a=t(),n.width=i,n.height=o,a}(r,()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(r.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return r.canvas.transferToImageBitmap()}))}var ee=class{constructor(r,e,a,t,n,i,o){this.g=r,this.j=e,this.m=a,this.canvas=t,this.l=n,this.width=i,this.height=o,(this.j||this.m)&&--Km===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!Ra(this,0)}ka(){return!!Ra(this,1)}R(){return!!Ra(this,2)}Aa(){return Jm(this)}za(){var r=Ra(this,1);return r||(Hs(this),Js(this),r=zm(this),Zo(this),this.g.push(r),this.j=!0),r}N(){return Hs(this)}clone(){const r=[];for(const e of this.g){let a;if(e instanceof ImageData)a=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=ti(this),n=Qs(this);t.activeTexture(t.TEXTURE1),a=Ls(n,t),t.bindTexture(t.TEXTURE_2D,a),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),Us(n,t,a),Ql(n,t,!1,()=>{Js(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Zo(this)}),Jl(n),Zo(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);Hs(this),Js(this),a=zm(this),Zo(this)}r.push(a)}return new ee(r,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ra(this,1).close(),this.m&&ti(this).deleteTexture(Ra(this,2)),Km=-1}};ee.prototype.close=ee.prototype.close,ee.prototype.clone=ee.prototype.clone,ee.prototype.getAsWebGLTexture=ee.prototype.N,ee.prototype.getAsImageBitmap=ee.prototype.za,ee.prototype.getAsImageData=ee.prototype.Aa,ee.prototype.hasWebGLTexture=ee.prototype.R,ee.prototype.hasImageBitmap=ee.prototype.ka,ee.prototype.hasImageData=ee.prototype.Ca;var Km=250;function ka(...r){return r.map(([e,a])=>({start:e,end:a}))}const LS=function(r){return class extends r{Ha(){this.i._registerModelResourcesGraphService()}}}((qm=class{constructor(r,e){this.l=!0,this.i=r,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",e!==void 0?this.i.canvas=e:Vm()?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(r){const e=await(await fetch(r)).arrayBuffer();r=!(r.endsWith(".pbtxt")||r.endsWith(".textproto")),this.setGraph(new Uint8Array(e),r)}setGraphFromString(r){this.setGraph(new TextEncoder().encode(r),!1)}setGraph(r,e){const a=r.length,t=this.i._malloc(a);this.i.HEAPU8.set(r,t),e?this.i._changeBinaryGraph(a,t):this.i._changeTextGraph(a,t),this.i._free(t)}configureAudio(r,e,a,t,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),xr(this,t||"input_audio",i=>{xr(this,n=n||"audio_header",o=>{this.i._configureAudio(i,o,r,e??0,a)})})}setAutoResizeCanvas(r){this.l=r}setAutoRenderToScreen(r){this.i._setAutoRenderToScreen(r)}setGpuBufferVerticalFlip(r){this.i.gpuOriginForWebTexturesIsBottomLeft=r}ca(r){Xa(this,"__graph_config__",e=>{r(e)}),xr(this,"__graph_config__",e=>{this.i._getGraphConfig(e,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(r){this.i.errorListener=r}attachEmptyPacketListener(r,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[r]=e}addAudioToStream(r,e,a){this.addAudioToStreamWithShape(r,0,0,e,a)}addAudioToStreamWithShape(r,e,a,t,n){const i=4*r.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(r,this.g/4),xr(this,t,o=>{this.i._addAudioToInputStream(this.g,e,a,o,n)})}addGpuBufferToStream(r,e,a){xr(this,e,t=>{const[n,i]=Gm(this,r,t);this.i._addBoundTextureToStream(t,n,i,a)})}addBoolToStream(r,e,a){xr(this,e,t=>{this.i._addBoolToInputStream(r,t,a)})}addDoubleToStream(r,e,a){xr(this,e,t=>{this.i._addDoubleToInputStream(r,t,a)})}addFloatToStream(r,e,a){xr(this,e,t=>{this.i._addFloatToInputStream(r,t,a)})}addIntToStream(r,e,a){xr(this,e,t=>{this.i._addIntToInputStream(r,t,a)})}addUintToStream(r,e,a){xr(this,e,t=>{this.i._addUintToInputStream(r,t,a)})}addStringToStream(r,e,a){xr(this,e,t=>{xr(this,r,n=>{this.i._addStringToInputStream(n,t,a)})})}addStringRecordToStream(r,e,a){xr(this,e,t=>{Xm(this,Object.keys(r),n=>{Xm(this,Object.values(r),i=>{this.i._addFlatHashMapToInputStream(n,i,Object.keys(r).length,t,a)})})})}addProtoToStream(r,e,a,t){xr(this,a,n=>{xr(this,e,i=>{const o=this.i._malloc(r.length);this.i.HEAPU8.set(r,o),this.i._addProtoToInputStream(o,r.length,i,n,t),this.i._free(o)})})}addEmptyPacketToStream(r,e){xr(this,r,a=>{this.i._addEmptyPacketToInputStream(a,e)})}addBoolVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateBoolVector(r.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const i of r)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputStream(n,t,a)})}addDoubleVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateDoubleVector(r.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const i of r)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputStream(n,t,a)})}addFloatVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateFloatVector(r.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const i of r)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputStream(n,t,a)})}addIntVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateIntVector(r.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const i of r)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputStream(n,t,a)})}addUintVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateUintVector(r.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of r)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputStream(n,t,a)})}addStringVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateStringVector(r.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const i of r)xr(this,i,o=>{this.i._addStringVectorEntry(n,o)});this.i._addStringVectorToInputStream(n,t,a)})}addBoolToInputSidePacket(r,e){xr(this,e,a=>{this.i._addBoolToInputSidePacket(r,a)})}addDoubleToInputSidePacket(r,e){xr(this,e,a=>{this.i._addDoubleToInputSidePacket(r,a)})}addFloatToInputSidePacket(r,e){xr(this,e,a=>{this.i._addFloatToInputSidePacket(r,a)})}addIntToInputSidePacket(r,e){xr(this,e,a=>{this.i._addIntToInputSidePacket(r,a)})}addUintToInputSidePacket(r,e){xr(this,e,a=>{this.i._addUintToInputSidePacket(r,a)})}addStringToInputSidePacket(r,e){xr(this,e,a=>{xr(this,r,t=>{this.i._addStringToInputSidePacket(t,a)})})}addProtoToInputSidePacket(r,e,a){xr(this,a,t=>{xr(this,e,n=>{const i=this.i._malloc(r.length);this.i.HEAPU8.set(r,i),this.i._addProtoToInputSidePacket(i,r.length,n,t),this.i._free(i)})})}addBoolVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateBoolVector(r.length);if(!t)throw Error("Unable to allocate new bool vector on heap.");for(const n of r)this.i._addBoolVectorEntry(t,n);this.i._addBoolVectorToInputSidePacket(t,a)})}addDoubleVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateDoubleVector(r.length);if(!t)throw Error("Unable to allocate new double vector on heap.");for(const n of r)this.i._addDoubleVectorEntry(t,n);this.i._addDoubleVectorToInputSidePacket(t,a)})}addFloatVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateFloatVector(r.length);if(!t)throw Error("Unable to allocate new float vector on heap.");for(const n of r)this.i._addFloatVectorEntry(t,n);this.i._addFloatVectorToInputSidePacket(t,a)})}addIntVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateIntVector(r.length);if(!t)throw Error("Unable to allocate new int vector on heap.");for(const n of r)this.i._addIntVectorEntry(t,n);this.i._addIntVectorToInputSidePacket(t,a)})}addUintVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateUintVector(r.length);if(!t)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of r)this.i._addUintVectorEntry(t,n);this.i._addUintVectorToInputSidePacket(t,a)})}addStringVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateStringVector(r.length);if(!t)throw Error("Unable to allocate new string vector on heap.");for(const n of r)xr(this,n,i=>{this.i._addStringVectorEntry(t,i)});this.i._addStringVectorToInputSidePacket(t,a)})}attachBoolListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachBoolListener(a)})}attachBoolVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachBoolVectorListener(a)})}attachIntListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachIntListener(a)})}attachIntVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachIntVectorListener(a)})}attachUintListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachUintListener(a)})}attachUintVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachUintVectorListener(a)})}attachDoubleListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachDoubleListener(a)})}attachDoubleVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachDoubleVectorListener(a)})}attachFloatListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachFloatListener(a)})}attachFloatVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachFloatVectorListener(a)})}attachStringListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachStringListener(a)})}attachStringVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachStringVectorListener(a)})}attachProtoListener(r,e,a){Xa(this,r,e),xr(this,r,t=>{this.i._attachProtoListener(t,a||!1)})}attachProtoVectorListener(r,e,a){qt(this,r,e),xr(this,r,t=>{this.i._attachProtoVectorListener(t,a||!1)})}attachAudioListener(r,e,a){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Xa(this,r,(t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)}),xr(this,r,t=>{this.i._attachAudioListener(t,a||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends qm{get ea(){return this.i}oa(r,e,a){xr(this,e,t=>{const[n,i]=Gm(this,r,t);this.ea._addBoundTextureAsImageToStream(t,n,i,a)})}V(r,e){Xa(this,r,e),xr(this,r,a=>{this.ea._attachImageListener(a)})}ba(r,e){qt(this,r,e),xr(this,r,a=>{this.ea._attachImageVectorListener(a)})}}));var qm,aa=class extends LS{};async function Kr(r,e,a){return async function(t,n,i,o){return RS(t,n,i,o)}(r,a.canvas??(Vm()?void 0:document.createElement("canvas")),e,a)}function rv(r,e,a,t){if(r.U){const i=new om;if(a!=null&&a.regionOfInterest){if(!r.na)throw Error("This task doesn't support region-of-interest.");var n=a.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");Cr(i,1,(n.left+n.right)/2),Cr(i,2,(n.top+n.bottom)/2),Cr(i,4,n.right-n.left),Cr(i,3,n.bottom-n.top)}else Cr(i,1,.5),Cr(i,2,.5),Cr(i,4,1),Cr(i,3,1);if(a!=null&&a.rotationDegrees){if((a==null?void 0:a.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(Cr(i,5,-Math.PI*a.rotationDegrees/180),(a==null?void 0:a.rotationDegrees)%180!=0){const[o,A]=Mm(e);a=D0(i,3)*A/o,n=D0(i,4)*o/A,Cr(i,4,a),Cr(i,3,n)}}r.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",r.U,t)}r.g.oa(e,r.Z,t??performance.now()),r.finishProcessing()}function ta(r,e,a){var t;if((t=r.baseOptions)!=null&&t.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");rv(r,e,a,r.B+1)}function ja(r,e,a,t){var n;if(!((n=r.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");rv(r,e,a,t)}function ni(r,e,a,t){var n=e.data;const i=e.width,o=i*(e=e.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==o)throw Error("Unsupported channel count: "+n.length/o);return r=new re([n],a,!1,r.g.i.canvas,r.P,i,e),t?r.clone():r}var Be=class extends Yl{constructor(r,e,a,t){super(r),this.g=r,this.Z=e,this.U=a,this.na=t,this.P=new zl}l(r,e=!0){if("runningMode"in r&&Eo(this.baseOptions,2,!!r.runningMode&&r.runningMode!=="IMAGE"),r.canvas!==void 0&&this.g.i.canvas!==r.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(r,e)}close(){this.P.close(),super.close()}};Be.prototype.close=Be.prototype.close;var je=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect_in",!1),this.j={detections:[]},Zr(r=this.h=new Ms,0,1,e=new B0),Cr(this.h,2,.5),Cr(this.h,3,.3)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"minDetectionConfidence"in r&&Cr(this.h,2,r.minDetectionConfidence??.5),"minSuppressionThreshold"in r&&Cr(this.h,3,r.minSuppressionThreshold??.3),this.l(r)}D(r,e){return this.j={detections:[]},ta(this,r,e),this.j}F(r,e,a){return this.j={detections:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect_in"),s0(r,"detections");const e=new Ge;pa(e,xS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect_in"),qr(a,"DETECTIONS:detections"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("detections",(t,n)=>{for(const i of t)t=tm(i),this.j.detections.push(Tm(t));vr(this,n)}),this.g.attachEmptyPacketListener("detections",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};je.prototype.detectForVideo=je.prototype.F,je.prototype.detect=je.prototype.D,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=async function(r,e){return Kr(je,r,{baseOptions:{modelAssetPath:e}})},je.createFromModelBuffer=function(r,e){return Kr(je,r,{baseOptions:{modelAssetBuffer:e}})},je.createFromOptions=function(r,e){return Kr(je,r,e)};var ec=ka([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]),ac=ka([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]),tc=ka([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ev=ka([474,475],[475,476],[476,477],[477,474]),nc=ka([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]),ic=ka([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),av=ka([469,470],[470,471],[471,472],[472,469]),oc=ka([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]),tv=[...ec,...ac,...tc,...nc,...ic,...oc],nv=ka([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 iv(r){r.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var P0=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,Zr(r=this.h=new hm,0,1,e=new B0),this.v=new dm,Zr(this.h,0,3,this.v),this.s=new Ms,Zr(this.h,0,2,this.s),Ga(this.s,4,1),Cr(this.s,2,.5),Cr(this.v,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numFaces"in r&&Ga(this.s,4,r.numFaces??1),"minFaceDetectionConfidence"in r&&Cr(this.s,2,r.minFaceDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minFacePresenceConfidence"in r&&Cr(this.v,2,r.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in r&&(this.outputFaceBlendshapes=!!r.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in r&&(this.outputFacialTransformationMatrixes=!!r.outputFacialTransformationMatrixes),this.l(r)}D(r,e){return iv(this),ta(this,r,e),this.j}F(r,e,a){return iv(this),ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"face_landmarks");const e=new Ge;pa(e,FS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"NORM_LANDMARKS:face_landmarks"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("face_landmarks",(t,n)=>{for(const i of t)t=Bo(i),this.j.faceLandmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",t=>{vr(this,t)}),this.outputFaceBlendshapes&&(s0(r,"blendshapes"),qr(a,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(t,n)=>{if(this.outputFaceBlendshapes)for(const i of t)t=Os(i),this.j.faceBlendshapes.push(Ll(t.g()??[]));vr(this,n)}),this.g.attachEmptyPacketListener("blendshapes",t=>{vr(this,t)})),this.outputFacialTransformationMatrixes&&(s0(r,"face_geometry"),qr(a,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(t,n)=>{if(this.outputFacialTransformationMatrixes)for(const i of t)(t=i0(ZS(i),wS,2))&&this.j.facialTransformationMatrixes.push({rows:ra(t,1)??0??0,columns:ra(t,2)??0??0,data:Dn(t,3,Ut,Vn()).slice()??[]});vr(this,n)}),this.g.attachEmptyPacketListener("face_geometry",t=>{vr(this,t)})),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};P0.prototype.detectForVideo=P0.prototype.F,P0.prototype.detect=P0.prototype.D,P0.prototype.setOptions=P0.prototype.o,P0.createFromModelPath=function(r,e){return Kr(P0,r,{baseOptions:{modelAssetPath:e}})},P0.createFromModelBuffer=function(r,e){return Kr(P0,r,{baseOptions:{modelAssetBuffer:e}})},P0.createFromOptions=function(r,e){return Kr(P0,r,e)},P0.FACE_LANDMARKS_LIPS=ec,P0.FACE_LANDMARKS_LEFT_EYE=ac,P0.FACE_LANDMARKS_LEFT_EYEBROW=tc,P0.FACE_LANDMARKS_LEFT_IRIS=ev,P0.FACE_LANDMARKS_RIGHT_EYE=nc,P0.FACE_LANDMARKS_RIGHT_EYEBROW=ic,P0.FACE_LANDMARKS_RIGHT_IRIS=av,P0.FACE_LANDMARKS_FACE_OVAL=oc,P0.FACE_LANDMARKS_CONTOURS=tv,P0.FACE_LANDMARKS_TESSELATION=nv;var La=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!0),Zr(r=this.j=new mm,0,1,e=new B0)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){return super.l(r)}Ka(r,e,a){const t=typeof e!="function"?e:{};if(this.h=typeof e=="function"?e:a,ta(this,r,t??{}),!this.h)return this.s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"stylized_image");const e=new Ge;pa(e,SS,this.j);const a=new he;Xe(a,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"STYLIZED_IMAGE:stylized_image"),a.o(e),Re(r,a),this.g.V("stylized_image",(t,n)=>{var i=!this.h,o=t.data,A=t.width;const s=A*(t=t.height);if(o instanceof Uint8Array)if(o.length===3*s){const u=new Uint8ClampedArray(4*s);for(let l=0;l<s;++l)u[4*l]=o[3*l],u[4*l+1]=o[3*l+1],u[4*l+2]=o[3*l+2],u[4*l+3]=255;o=new ImageData(u,A,t)}else{if(o.length!==4*s)throw Error("Unsupported channel count: "+o.length/s);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),A,t)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);A=new ee([o],!1,!1,this.g.i.canvas,this.P,A,t),this.s=i=i?A.clone():A,this.h&&this.h(i),vr(this,n)}),this.g.attachEmptyPacketListener("stylized_image",t=>{this.s=null,this.h&&this.h(null),vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};La.prototype.stylize=La.prototype.Ka,La.prototype.setOptions=La.prototype.o,La.createFromModelPath=function(r,e){return Kr(La,r,{baseOptions:{modelAssetPath:e}})},La.createFromModelBuffer=function(r,e){return Kr(La,r,{baseOptions:{modelAssetBuffer:e}})},La.createFromOptions=function(r,e){return Kr(La,r,e)};var Ac=ka([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 ov(r){r.gestures=[],r.landmarks=[],r.worldLandmarks=[],r.handedness=[]}function Av(r){return r.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:r.gestures,landmarks:r.landmarks,worldLandmarks:r.worldLandmarks,handedness:r.handedness,handednesses:r.handedness}}function sv(r,e=!0){const a=[];for(const n of r){var t=Os(n);r=[];for(const i of t.g())t=e&&ra(i,1)!=null?ra(i,1)??0:-1,r.push({score:D0(i,2)??0,index:t,categoryName:ea(i,3)??""??"",displayName:ea(i,4)??""??""});a.push(r)}return a}var Le=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Zr(r=this.j=new pm,0,1,e=new B0),this.s=new Dl,Zr(this.j,0,2,this.s),this.C=new Vl,Zr(this.s,0,3,this.C),this.v=new gm,Zr(this.s,0,2,this.v),this.h=new WS,Zr(this.j,0,3,this.h),Cr(this.v,2,.5),Cr(this.s,4,.5),Cr(this.C,2,.5)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){var n,i,o,A;if(Ga(this.v,3,r.numHands??1),"minHandDetectionConfidence"in r&&Cr(this.v,2,r.minHandDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.s,4,r.minTrackingConfidence??.5),"minHandPresenceConfidence"in r&&Cr(this.C,2,r.minHandPresenceConfidence??.5),r.cannedGesturesClassifierOptions){var e=new ri,a=e,t=jl(r.cannedGesturesClassifierOptions,(n=i0(this.h,ri,3))==null?void 0:n.h());Zr(a,0,2,t),Zr(this.h,0,3,e)}else r.cannedGesturesClassifierOptions===void 0&&((i=i0(this.h,ri,3))==null||i.g());return r.customGesturesClassifierOptions?(Zr(a=e=new ri,0,2,t=jl(r.customGesturesClassifierOptions,(o=i0(this.h,ri,4))==null?void 0:o.h())),Zr(this.h,0,4,e)):r.customGesturesClassifierOptions===void 0&&((A=i0(this.h,ri,4))==null||A.g()),this.l(r)}Fa(r,e){return ov(this),ta(this,r,e),Av(this)}Ga(r,e,a){return ov(this),ja(this,r,a,e),Av(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"hand_gestures"),s0(r,"hand_landmarks"),s0(r,"world_hand_landmarks"),s0(r,"handedness");const e=new Ge;pa(e,TS,this.j);const a=new he;Xe(a,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"HAND_GESTURES:hand_gestures"),qr(a,"LANDMARKS:hand_landmarks"),qr(a,"WORLD_LANDMARKS:world_hand_landmarks"),qr(a,"HANDEDNESS:handedness"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("hand_landmarks",(t,n)=>{for(const i of t){t=Bo(i);const o=[];for(const A of gt(t,im,1))o.push({x:D0(A,1)??0,y:D0(A,2)??0,z:D0(A,3)??0,visibility:D0(A,4)??0});this.landmarks.push(o)}vr(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("world_hand_landmarks",(t,n)=>{for(const i of t){t=q2(i);const o=[];for(const A of gt(t,nm,1))o.push({x:D0(A,1)??0,y:D0(A,2)??0,z:D0(A,3)??0,visibility:D0(A,4)??0});this.worldLandmarks.push(o)}vr(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("hand_gestures",(t,n)=>{this.gestures.push(...sv(t,!1)),vr(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",t=>{vr(this,t)}),this.g.attachProtoVectorListener("handedness",(t,n)=>{this.handedness.push(...sv(t)),vr(this,n)}),this.g.attachEmptyPacketListener("handedness",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};function fv(r){return{landmarks:r.landmarks,worldLandmarks:r.worldLandmarks,handednesses:r.handedness,handedness:r.handedness}}Le.prototype.recognizeForVideo=Le.prototype.Ga,Le.prototype.recognize=Le.prototype.Fa,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(r,e){return Kr(Le,r,{baseOptions:{modelAssetPath:e}})},Le.createFromModelBuffer=function(r,e){return Kr(Le,r,{baseOptions:{modelAssetBuffer:e}})},Le.createFromOptions=function(r,e){return Kr(Le,r,e)},Le.HAND_CONNECTIONS=Ac;var Ue=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Zr(r=this.h=new Dl,0,1,e=new B0),this.s=new Vl,Zr(this.h,0,3,this.s),this.j=new gm,Zr(this.h,0,2,this.j),Ga(this.j,3,1),Cr(this.j,2,.5),Cr(this.s,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numHands"in r&&Ga(this.j,3,r.numHands??1),"minHandDetectionConfidence"in r&&Cr(this.j,2,r.minHandDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minHandPresenceConfidence"in r&&Cr(this.s,2,r.minHandPresenceConfidence??.5),this.l(r)}D(r,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ta(this,r,e),fv(this)}F(r,e,a){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ja(this,r,a,e),fv(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"hand_landmarks"),s0(r,"world_hand_landmarks"),s0(r,"handedness");const e=new Ge;pa(e,$S,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"LANDMARKS:hand_landmarks"),qr(a,"WORLD_LANDMARKS:world_hand_landmarks"),qr(a,"HANDEDNESS:handedness"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("hand_landmarks",(t,n)=>{for(const i of t)t=Bo(i),this.landmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("world_hand_landmarks",(t,n)=>{for(const i of t)t=q2(i),this.worldLandmarks.push(No(t));vr(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("handedness",(t,n)=>{var i=this.handedness,o=i.push;const A=[];for(const s of t){t=Os(s);const u=[];for(const l of t.g())u.push({score:D0(l,2)??0,index:ra(l,1)??0??-1,categoryName:ea(l,3)??""??"",displayName:ea(l,4)??""??""});A.push(u)}o.call(i,...A),vr(this,n)}),this.g.attachEmptyPacketListener("handedness",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ue.prototype.detectForVideo=Ue.prototype.F,Ue.prototype.detect=Ue.prototype.D,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(r,e){return Kr(Ue,r,{baseOptions:{modelAssetPath:e}})},Ue.createFromModelBuffer=function(r,e){return Kr(Ue,r,{baseOptions:{modelAssetBuffer:e}})},Ue.createFromOptions=function(r,e){return Kr(Ue,r,e)},Ue.HAND_CONNECTIONS=Ac;var uv=ka([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 lv(r){r.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function cv(r){try{if(!r.C)return r.h;r.C(r.h)}finally{js(r)}}function zs(r,e){r=Bo(r),e.push(Gs(r))}var N0=class extends Be{constructor(r,e){super(new aa(r,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,Zr(r=this.j=new _m,0,1,e=new B0),this.K=new Vl,Zr(this.j,0,2,this.K),this.Y=new PS,Zr(this.j,0,3,this.Y),this.s=new Ms,Zr(this.j,0,4,this.s),this.H=new dm,Zr(this.j,0,5,this.H),this.v=new Em,Zr(this.j,0,6,this.v),this.L=new Cm,Zr(this.j,0,7,this.L),Cr(this.s,2,.5),Cr(this.s,3,.3),Cr(this.H,2,.5),Cr(this.v,2,.5),Cr(this.v,3,.3),Cr(this.L,2,.5),Cr(this.K,2,.5)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){return"minFaceDetectionConfidence"in r&&Cr(this.s,2,r.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in r&&Cr(this.s,3,r.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in r&&Cr(this.H,2,r.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in r&&(this.outputFaceBlendshapes=!!r.outputFaceBlendshapes),"minPoseDetectionConfidence"in r&&Cr(this.v,2,r.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in r&&Cr(this.v,3,r.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in r&&Cr(this.L,2,r.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in r&&(this.outputPoseSegmentationMasks=!!r.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in r&&Cr(this.K,2,r.minHandLandmarksConfidence??.5),this.l(r)}D(r,e,a){const t=typeof e!="function"?e:{};return this.C=typeof e=="function"?e:a,lv(this),ta(this,r,t),cv(this)}F(r,e,a,t){const n=typeof a!="function"?a:{};return this.C=typeof a=="function"?a:t,lv(this),ja(this,r,n,e),cv(this)}m(){var r=new Ie;C0(r,"input_frames_image"),s0(r,"pose_landmarks"),s0(r,"pose_world_landmarks"),s0(r,"face_landmarks"),s0(r,"left_hand_landmarks"),s0(r,"left_hand_world_landmarks"),s0(r,"right_hand_landmarks"),s0(r,"right_hand_world_landmarks");const e=new Ge,a=new G5;ol(a,1,G2("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,i){if(i!=null)if(Array.isArray(i))y0(n,2,gs(i,al,void 0,void 0,!1));else{if(!(typeof i=="string"||i instanceof bt||$n(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");ol(n,2,Ru(i,!1),Pn())}}(a,this.j.g());const t=new he;Xe(t,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Es(t,8,G5,a),w0(t,"IMAGE:input_frames_image"),qr(t,"POSE_LANDMARKS:pose_landmarks"),qr(t,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),qr(t,"FACE_LANDMARKS:face_landmarks"),qr(t,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),qr(t,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),qr(t,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),qr(t,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),t.o(e),Re(r,t),Rs(this,r),this.g.attachProtoListener("pose_landmarks",(n,i)=>{zs(n,this.h.poseLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,i)=>{var o=this.h.poseWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{vr(this,n)}),this.outputPoseSegmentationMasks&&(qr(t,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),ei(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,i)=>{this.h.poseSegmentationMasks=[ni(this,n,!0,!this.C)],vr(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],vr(this,n)})),this.g.attachProtoListener("face_landmarks",(n,i)=>{zs(n,this.h.faceLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{vr(this,n)}),this.outputFaceBlendshapes&&(s0(r,"extra_blendshapes"),qr(t,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Os(n),o.push(Ll(n.g()??[]))),vr(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{vr(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,i)=>{zs(n,this.h.leftHandLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,i)=>{var o=this.h.leftHandWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,i)=>{zs(n,this.h.rightHandLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,i)=>{var o=this.h.rightHandWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{vr(this,n)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};N0.prototype.detectForVideo=N0.prototype.F,N0.prototype.detect=N0.prototype.D,N0.prototype.setOptions=N0.prototype.o,N0.createFromModelPath=function(r,e){return Kr(N0,r,{baseOptions:{modelAssetPath:e}})},N0.createFromModelBuffer=function(r,e){return Kr(N0,r,{baseOptions:{modelAssetBuffer:e}})},N0.createFromOptions=function(r,e){return Kr(N0,r,e)},N0.HAND_CONNECTIONS=Ac,N0.POSE_CONNECTIONS=uv,N0.FACE_LANDMARKS_LIPS=ec,N0.FACE_LANDMARKS_LEFT_EYE=ac,N0.FACE_LANDMARKS_LEFT_EYEBROW=tc,N0.FACE_LANDMARKS_LEFT_IRIS=ev,N0.FACE_LANDMARKS_RIGHT_EYE=nc,N0.FACE_LANDMARKS_RIGHT_EYEBROW=ic,N0.FACE_LANDMARKS_RIGHT_IRIS=av,N0.FACE_LANDMARKS_FACE_OVAL=oc,N0.FACE_LANDMARKS_CONTOURS=tv,N0.FACE_LANDMARKS_TESSELATION=nv;var na=class extends Be{constructor(r,e){super(new aa(r,e),"input_image","norm_rect",!0),this.j={classifications:[]},Zr(r=this.h=new Im,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return Zr(this.h,0,2,jl(r,i0(this.h,$l,2))),this.l(r)}qa(r,e){return this.j={classifications:[]},ta(this,r,e),this.j}ra(r,e,a){return this.j={classifications:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"input_image"),C0(r,"norm_rect"),s0(r,"classifications");const e=new Ge;pa(e,OS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),w0(a,"IMAGE:input_image"),w0(a,"NORM_RECT:norm_rect"),qr(a,"CLASSIFICATIONS:classifications"),a.o(e),Re(r,a),this.g.attachProtoListener("classifications",(t,n)=>{this.j=function(i){const o={classifications:gt(i,ES,1).map(A=>{var s;return Ll(((s=i0(A,em,4))==null?void 0:s.g())??[],ra(A,2)??0,ea(A,3)??"")})};return zu(R2(i,2))!=null&&(o.timestampMs=zu(R2(i,2))??0),o}(CS(t)),vr(this,n)}),this.g.attachEmptyPacketListener("classifications",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};na.prototype.classifyForVideo=na.prototype.ra,na.prototype.classify=na.prototype.qa,na.prototype.setOptions=na.prototype.o,na.createFromModelPath=function(r,e){return Kr(na,r,{baseOptions:{modelAssetPath:e}})},na.createFromModelBuffer=function(r,e){return Kr(na,r,{baseOptions:{modelAssetBuffer:e}})},na.createFromOptions=function(r,e){return Kr(na,r,e)};var Ye=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!0),this.h=new Bm,this.embeddings={embeddings:[]},Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){var e=this.h,a=i0(this.h,um,2);return a=a?a.clone():new um,r.l2Normalize!==void 0?Eo(a,1,r.l2Normalize):"l2Normalize"in r&&y0(a,1),r.quantize!==void 0?Eo(a,2,r.quantize):"quantize"in r&&y0(a,2),Zr(e,0,2,a),this.l(r)}xa(r,e){return ta(this,r,e),this.embeddings}ya(r,e,a){return ja(this,r,a,e),this.embeddings}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"embeddings_out");const e=new Ge;pa(e,VS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"EMBEDDINGS:embeddings_out"),a.o(e),Re(r,a),this.g.attachProtoListener("embeddings_out",(t,n)=>{t=BS(t),this.embeddings=function(i){return{embeddings:gt(i,IS,1).map(o=>{var s,u;const A={headIndex:ra(o,3)??0??-1,headName:ea(o,4)??""??""};if(s5(o,Am,Al(o,1))!==void 0)o=Dn(o=i0(o,Am,Al(o,1)),1,Ut,Vn()),A.floatEmbedding=o.slice();else{const l=new Uint8Array(0);A.quantizedEmbedding=((u=(s=i0(o,_S,Al(o,2)))==null?void 0:s.ma())==null?void 0:u.h())??l}return A}),timestampMs:zu(R2(i,2))??0}}(t),vr(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ye.cosineSimilarity=function(r,e){if(r.floatEmbedding&&e.floatEmbedding)r=Pm(r.floatEmbedding,e.floatEmbedding);else{if(!r.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");r=Pm($m(r.quantizedEmbedding),$m(e.quantizedEmbedding))}return r},Ye.prototype.embedForVideo=Ye.prototype.ya,Ye.prototype.embed=Ye.prototype.xa,Ye.prototype.setOptions=Ye.prototype.o,Ye.createFromModelPath=function(r,e){return Kr(Ye,r,{baseOptions:{modelAssetPath:e}})},Ye.createFromModelBuffer=function(r,e){return Kr(Ye,r,{baseOptions:{modelAssetBuffer:e}})},Ye.createFromOptions=function(r,e){return Kr(Ye,r,e)};var sc=class{constructor(r,e,a){this.confidenceMasks=r,this.categoryMask=e,this.qualityScores=a}close(){var r,e;(r=this.confidenceMasks)==null||r.forEach(a=>{a.close()}),(e=this.categoryMask)==null||e.close()}};function dv(r){r.categoryMask=void 0,r.confidenceMasks=void 0,r.qualityScores=void 0}function hv(r){try{const e=new sc(r.confidenceMasks,r.categoryMask,r.qualityScores);if(!r.j)return e;r.j(e)}finally{js(r)}}sc.prototype.close=sc.prototype.close;var Ne=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Rl,this.v=new Nm,Zr(this.h,0,3,this.v),Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return r.displayNamesLocale!==void 0?y0(this.h,2,G2(r.displayNamesLocale)):"displayNamesLocale"in r&&y0(this.h,2),"outputCategoryMask"in r&&(this.outputCategoryMask=r.outputCategoryMask??!1),"outputConfidenceMasks"in r&&(this.outputConfidenceMasks=r.outputConfidenceMasks??!0),super.l(r)}J(){(function(r){var a,t;const e=gt(r.ca(),he,1).filter(n=>(ea(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(r.s=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");e.length===1&&(((t=(a=i0(e[0],Ge,7))==null?void 0:a.l())==null?void 0:t.g())??new Map).forEach((n,i)=>{r.s[Number(i)]=ea(n,1)??""})})(this)}segment(r,e,a){const t=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:a,dv(this),ta(this,r,t),hv(this)}Ia(r,e,a,t){const n=typeof a!="function"?a:{};return this.j=typeof a=="function"?a:t,dv(this),ja(this,r,n,e),hv(this)}Ba(){return this.s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect");const e=new Ge;pa(e,Fm,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),a.o(e),Re(r,a),Rs(this,r),this.outputConfidenceMasks&&(s0(r,"confidence_masks"),qr(a,"CONFIDENCE_MASKS:confidence_masks"),ei(this,"confidence_masks"),this.g.ba("confidence_masks",(t,n)=>{this.confidenceMasks=t.map(i=>ni(this,i,!0,!this.j)),vr(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",t=>{this.confidenceMasks=[],vr(this,t)})),this.outputCategoryMask&&(s0(r,"category_mask"),qr(a,"CATEGORY_MASK:category_mask"),ei(this,"category_mask"),this.g.V("category_mask",(t,n)=>{this.categoryMask=ni(this,t,!1,!this.j),vr(this,n)}),this.g.attachEmptyPacketListener("category_mask",t=>{this.categoryMask=void 0,vr(this,t)})),s0(r,"quality_scores"),qr(a,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(t,n)=>{this.qualityScores=t,vr(this,n)}),this.g.attachEmptyPacketListener("quality_scores",t=>{this.categoryMask=void 0,vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ne.prototype.getLabels=Ne.prototype.Ba,Ne.prototype.segmentForVideo=Ne.prototype.Ia,Ne.prototype.segment=Ne.prototype.segment,Ne.prototype.setOptions=Ne.prototype.o,Ne.createFromModelPath=function(r,e){return Kr(Ne,r,{baseOptions:{modelAssetPath:e}})},Ne.createFromModelBuffer=function(r,e){return Kr(Ne,r,{baseOptions:{modelAssetBuffer:e}})},Ne.createFromOptions=function(r,e){return Kr(Ne,r,e)};var fc=class{constructor(r,e,a){this.confidenceMasks=r,this.categoryMask=e,this.qualityScores=a}close(){var r,e;(r=this.confidenceMasks)==null||r.forEach(a=>{a.close()}),(e=this.categoryMask)==null||e.close()}};fc.prototype.close=fc.prototype.close;var US=class extends yr{constructor(r){super(r)}},ii=[0,$0,-2],Ks=[0,wt,-3,I0,wt,-1],bv=[0,Ks],mv=[0,Ks,$0,-1],uc=class extends yr{constructor(r){super(r)}},vv=[0,wt,-1,I0],YS=class extends yr{constructor(r){super(r)}},gv=class extends yr{constructor(r){super(r)}},lc=[1,2,3,4,5,6,7,8,9,10,14,15],pv=class extends yr{constructor(r){super(r)}};pv.prototype.g=Ps([0,J0,[0,lc,c0,Ks,c0,[0,Ks,ii],c0,bv,c0,[0,bv,ii],c0,vv,c0,[0,wt,-3,I0,Me],c0,[0,wt,-3,I0],c0,[0,l0,wt,-2,I0,$0,I0,-1,2,wt,ii],c0,mv,c0,[0,mv,ii],wt,ii,l0,c0,[0,wt,-3,I0,ii,-1],c0,[0,J0,vv]],l0,[0,l0,$0,-1,I0]]);var Ua=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Rl,this.s=new Nm,Zr(this.h,0,3,this.s),Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"outputCategoryMask"in r&&(this.outputCategoryMask=r.outputCategoryMask??!1),"outputConfidenceMasks"in r&&(this.outputConfidenceMasks=r.outputConfidenceMasks??!0),super.l(r)}segment(r,e,a,t){const n=typeof a!="function"?a:{};this.j=typeof a=="function"?a:t,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,a=this.B+1,t=new pv;const i=new gv;var o=new US;if(Ga(o,1,255),Zr(i,0,12,o),e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var A=new uc;Eo(A,3,!0),Cr(A,1,e.keypoint.x),Cr(A,2,e.keypoint.y),ko(i,5,lc,A)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");for(A of(o=new YS,e.scribble))Eo(e=new uc,3,!0),Cr(e,1,A.x),Cr(e,2,A.y),Es(o,1,uc,e);ko(i,15,lc,o)}Es(t,1,gv,i),this.g.addProtoToStream(t.g(),"drishti.RenderData","roi_in",a),ta(this,r,n);r:{try{const u=new fc(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var s=u;break r}this.j(u)}finally{js(this)}s=void 0}return s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"roi_in"),C0(r,"norm_rect_in");const e=new Ge;pa(e,Fm,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),w0(a,"IMAGE:image_in"),w0(a,"ROI:roi_in"),w0(a,"NORM_RECT:norm_rect_in"),a.o(e),Re(r,a),Rs(this,r),this.outputConfidenceMasks&&(s0(r,"confidence_masks"),qr(a,"CONFIDENCE_MASKS:confidence_masks"),ei(this,"confidence_masks"),this.g.ba("confidence_masks",(t,n)=>{this.confidenceMasks=t.map(i=>ni(this,i,!0,!this.j)),vr(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",t=>{this.confidenceMasks=[],vr(this,t)})),this.outputCategoryMask&&(s0(r,"category_mask"),qr(a,"CATEGORY_MASK:category_mask"),ei(this,"category_mask"),this.g.V("category_mask",(t,n)=>{this.categoryMask=ni(this,t,!1,!this.j),vr(this,n)}),this.g.attachEmptyPacketListener("category_mask",t=>{this.categoryMask=void 0,vr(this,t)})),s0(r,"quality_scores"),qr(a,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(t,n)=>{this.qualityScores=t,vr(this,n)}),this.g.attachEmptyPacketListener("quality_scores",t=>{this.categoryMask=void 0,vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ua.prototype.segment=Ua.prototype.segment,Ua.prototype.setOptions=Ua.prototype.o,Ua.createFromModelPath=function(r,e){return Kr(Ua,r,{baseOptions:{modelAssetPath:e}})},Ua.createFromModelBuffer=function(r,e){return Kr(Ua,r,{baseOptions:{modelAssetBuffer:e}})},Ua.createFromOptions=function(r,e){return Kr(Ua,r,e)};var ia=class extends Be{constructor(r,e){super(new aa(r,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},Zr(r=this.h=new Sm,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return r.displayNamesLocale!==void 0?y0(this.h,2,G2(r.displayNamesLocale)):"displayNamesLocale"in r&&y0(this.h,2),r.maxResults!==void 0?Ga(this.h,3,r.maxResults):"maxResults"in r&&y0(this.h,3),r.scoreThreshold!==void 0?Cr(this.h,4,r.scoreThreshold):"scoreThreshold"in r&&y0(this.h,4),r.categoryAllowlist!==void 0?Cs(this.h,5,r.categoryAllowlist):"categoryAllowlist"in r&&y0(this.h,5),r.categoryDenylist!==void 0?Cs(this.h,6,r.categoryDenylist):"categoryDenylist"in r&&y0(this.h,6),this.l(r)}D(r,e){return this.j={detections:[]},ta(this,r,e),this.j}F(r,e,a){return this.j={detections:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"input_frame_gpu"),C0(r,"norm_rect"),s0(r,"detections");const e=new Ge;pa(e,MS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.ObjectDetectorGraph"),w0(a,"IMAGE:input_frame_gpu"),w0(a,"NORM_RECT:norm_rect"),qr(a,"DETECTIONS:detections"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("detections",(t,n)=>{for(const i of t)t=tm(i),this.j.detections.push(Tm(t));vr(this,n)}),this.g.attachEmptyPacketListener("detections",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};ia.prototype.detectForVideo=ia.prototype.F,ia.prototype.detect=ia.prototype.D,ia.prototype.setOptions=ia.prototype.o,ia.createFromModelPath=async function(r,e){return Kr(ia,r,{baseOptions:{modelAssetPath:e}})},ia.createFromModelBuffer=function(r,e){return Kr(ia,r,{baseOptions:{modelAssetBuffer:e}})},ia.createFromOptions=function(r,e){return Kr(ia,r,e)};var cc=class{constructor(r,e,a){this.landmarks=r,this.worldLandmarks=e,this.segmentationMasks=a}close(){var r;(r=this.segmentationMasks)==null||r.forEach(e=>{e.close()})}};function yv(r){r.landmarks=[],r.worldLandmarks=[],r.segmentationMasks=void 0}function wv(r){try{const e=new cc(r.landmarks,r.worldLandmarks,r.segmentationMasks);if(!r.s)return e;r.s(e)}finally{js(r)}}cc.prototype.close=cc.prototype.close;var He=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,Zr(r=this.h=new Wm,0,1,e=new B0),this.v=new Cm,Zr(this.h,0,3,this.v),this.j=new Em,Zr(this.h,0,2,this.j),Ga(this.j,4,1),Cr(this.j,2,.5),Cr(this.v,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numPoses"in r&&Ga(this.j,4,r.numPoses??1),"minPoseDetectionConfidence"in r&&Cr(this.j,2,r.minPoseDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minPosePresenceConfidence"in r&&Cr(this.v,2,r.minPosePresenceConfidence??.5),"outputSegmentationMasks"in r&&(this.outputSegmentationMasks=r.outputSegmentationMasks??!1),this.l(r)}D(r,e,a){const t=typeof e!="function"?e:{};return this.s=typeof e=="function"?e:a,yv(this),ta(this,r,t),wv(this)}F(r,e,a,t){const n=typeof a!="function"?a:{};return this.s=typeof a=="function"?a:t,yv(this),ja(this,r,n,e),wv(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"normalized_landmarks"),s0(r,"world_landmarks"),s0(r,"segmentation_masks");const e=new Ge;pa(e,GS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"NORM_LANDMARKS:normalized_landmarks"),qr(a,"WORLD_LANDMARKS:world_landmarks"),a.o(e),Re(r,a),Rs(this,r),this.g.attachProtoVectorListener("normalized_landmarks",(t,n)=>{this.landmarks=[];for(const i of t)t=Bo(i),this.landmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",t=>{this.landmarks=[],vr(this,t)}),this.g.attachProtoVectorListener("world_landmarks",(t,n)=>{this.worldLandmarks=[];for(const i of t)t=q2(i),this.worldLandmarks.push(No(t));vr(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",t=>{this.worldLandmarks=[],vr(this,t)}),this.outputSegmentationMasks&&(qr(a,"SEGMENTATION_MASK:segmentation_masks"),ei(this,"segmentation_masks"),this.g.ba("segmentation_masks",(t,n)=>{this.segmentationMasks=t.map(i=>ni(this,i,!0,!this.s)),vr(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",t=>{this.segmentationMasks=[],vr(this,t)})),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(r,e){return Kr(He,r,{baseOptions:{modelAssetPath:e}})},He.createFromModelBuffer=function(r,e){return Kr(He,r,{baseOptions:{modelAssetBuffer:e}})},He.createFromOptions=function(r,e){return Kr(He,r,e)},He.POSE_CONNECTIONS=uv;class HS{constructor(){n2(this,"faceDetector",null);n2(this,"ocrWorker",null);n2(this,"isLoadingFaceDetector",!1);n2(this,"loadingPromise",null);n2(this,"isLoadingOCR",!1);n2(this,"ocrLoadingPromise",null)}get isFaceDetectorLoading(){return this.isLoadingFaceDetector}get isOCRLoading(){return this.isLoadingOCR}async getOCRWorker(){return this.ocrWorker?this.ocrWorker:this.ocrLoadingPromise?await this.ocrLoadingPromise:(this.isLoadingOCR=!0,this.ocrLoadingPromise=(async()=>{try{const e=await wF.createWorker("eng");return this.ocrWorker=e,e}finally{this.isLoadingOCR=!1,this.ocrLoadingPromise=null}})(),await this.ocrLoadingPromise)}async loadFaceDetector(){if(!(this.faceDetector||typeof window>"u")){if(this.loadingPromise){await this.loadingPromise;return}this.isLoadingFaceDetector=!0,this.loadingPromise=(async()=>{const e=["0.10.10","0.10.11","0.10.22-rc.20250304"];let a=null;for(const t of e)try{const n=await Xn.forVisionTasks(`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${t}/wasm`);this.faceDetector=await je.createFromOptions(n,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite"},runningMode:"IMAGE"});return}catch(n){a=n,console.warn(`[ImageValidator] Failed to load face detector with version ${t}:`,n)}console.error("[ImageValidator] Failed to load face detector with all versions:",a)})();try{await this.loadingPromise}finally{this.isLoadingFaceDetector=!1,this.loadingPromise=null}}}async validateFace(e){if(typeof window>"u")return{type:"face",passed:!1,facesDetected:0};try{if(await this.loadFaceDetector(),!this.faceDetector)return console.warn("[ImageValidator] Face detector not available"),{type:"face",passed:!1,facesDetected:0};const t=this.faceDetector.detect(e).detections.length;return{type:"face",passed:t>=1,facesDetected:t}}catch(a){return console.error("[ImageValidator] Face validation error:",a),{type:"face",passed:!1,facesDetected:0}}}async validateIdCard(e,a){if(typeof window>"u")return{type:a,passed:!1};const t=await this.getOCRWorker(),{data:{text:n}}=await t.recognize(e),i=3,o=4,A=4,s=n.match(new RegExp(`\\b[a-zA-Z]{${o},}\\b`,"g"))??[],u=n.match(new RegExp(`\\b\\d{${A},}\\b`,"g"))??[];return{type:a,passed:s.length>=i||u.length>=1,textSnippet:n.replace(/[^a-zA-Z0-9]/g,"").slice(0,200),fullText:n}}}const rn=new HS,QS=(r,e,a,t,n,i,o,A)=>{const[s,u]=B.useState(null),[l,c]=B.useState(null),[h,d]=B.useState({x:0,y:0,w:320,h:192}),[g,b]=B.useState(!1),[v,_]=B.useState(!1),[E,I]=B.useState(!1),Z=B.useRef(!1),k=B.useRef(`frameMask-${Math.random().toString(36).slice(2)}`),{toast:M}=Zi(),G=B.useRef(0),K=B.useMemo(()=>l?URL.createObjectURL(l):null,[l]),er=B.useCallback(()=>{const P=a.current;if(!P||!P.videoWidth)return null;const Q=P.getBoundingClientRect(),j=P.videoWidth/P.videoHeight,O=Q.width/Q.height;if(A){let m,y,p=0,w=0;j>O?(y=Q.height,m=Q.height*j,p=(m-Q.width)/2):(m=Q.width,y=Q.width/j,w=(y-Q.height)/2);const x=P.videoWidth/m;let F=(h.x+p)*x,N=(h.y+w)*x,W=h.w*x,D=h.h*x;if(r==="selfie"){const _r=W*.2,Ir=D*.2;F=Math.max(0,F-_r/2),N=Math.max(0,N-Ir/2),W=Math.min(P.videoWidth-F,W+_r),D=Math.min(P.videoHeight-N,D+Ir)}const T=Math.max(0,Math.round(F)),Y=Math.max(0,Math.round(N)),rr=Math.min(P.videoWidth-T,Math.round(W)),H=Math.min(P.videoHeight-Y,Math.round(D)),z=rr,$=H;if(z<=0||$<=0)return null;const tr=document.createElement("canvas");tr.width=z,tr.height=$;const gr=tr.getContext("2d",{willReadFrequently:!1,colorSpace:"srgb"});return gr&&(gr.imageSmoothingEnabled=!0,gr.imageSmoothingQuality="high",r==="selfie"?gr.filter="contrast(1.1) brightness(1.02)":gr.filter="contrast(1.15) brightness(1.05) saturate(1.05)",gr.drawImage(P,T,Y,rr,H,0,0,z,$)),tr}else{let m,y,p=0,w=0;j>O?(m=Q.width,y=Q.width/j,w=(Q.height-y)/2):(y=Q.height,m=Q.height*j,p=(Q.width-m)/2);const x=P.videoWidth/m,F=h.x-p,N=h.y-w,W=Math.max(0,F),D=Math.max(0,N),T=Math.min(m,F+h.w)-W,Y=Math.min(y,N+h.h)-D;if(T<=0||Y<=0)return null;let rr=W*x,H=D*x,z=T*x,$=Y*x;if(r==="selfie"){const X=z*.2,U=$*.2;rr=Math.max(0,rr-X/2),H=Math.max(0,H-U/2),z=Math.min(P.videoWidth-rr,z+X),$=Math.min(P.videoHeight-H,$+U)}const tr=Math.max(0,Math.round(rr)),gr=Math.max(0,Math.round(H)),_r=Math.min(P.videoWidth-tr,Math.round(z)),Ir=Math.min(P.videoHeight-gr,Math.round($)),wr=_r,jr=Ir;if(wr<=0||jr<=0)return null;const Lr=document.createElement("canvas");Lr.width=wr,Lr.height=jr;const S=Lr.getContext("2d",{willReadFrequently:!1,colorSpace:"srgb"});return S&&(S.imageSmoothingEnabled=!0,S.imageSmoothingQuality="high",r==="selfie"?S.filter="contrast(1.1) brightness(1.02)":S.filter="contrast(1.15) brightness(1.05) saturate(1.05)",S.drawImage(P,tr,gr,_r,Ir,0,0,wr,jr)),Lr}},[h,a,r,A]),R=B.useCallback(()=>{const P=a.current;if(!P||!P.videoWidth)return null;const Q=P.getBoundingClientRect(),j=P.videoWidth/P.videoHeight,O=Q.width/Q.height,m=50;if(A){let y,p,w=0,x=0;j>O?(p=Q.height,y=Q.height*j,w=(y-Q.width)/2):(y=Q.width,p=Q.width/j,x=(p-Q.height)/2);const F=P.videoWidth/y;let N=(h.x+w)*F,W=(h.y+x)*F,D=h.w*F,T=h.h*F;if(r==="selfie"){const gr=D*.2,_r=T*.2;N=Math.max(0,N-gr/2),W=Math.max(0,W-_r/2),D=Math.min(P.videoWidth-N,D+gr),T=Math.min(P.videoHeight-W,T+_r)}const rr=Math.min(1,640/Math.max(D,T)),H=Math.max(m,Math.round(D*rr)),z=Math.max(m,Math.round(T*rr)),$=document.createElement("canvas");$.width=H,$.height=z;const tr=$.getContext("2d");return tr&&(tr.imageSmoothingEnabled=!0,tr.imageSmoothingQuality="high",tr.drawImage(P,N,W,D,T,0,0,H,z)),$}else{let y,p,w=0,x=0;j>O?(y=Q.width,p=Q.width/j,x=(Q.height-p)/2):(p=Q.height,y=Q.height*j,w=(Q.width-y)/2);const F=P.videoWidth/y,N=h.x-w,W=h.y-x,D=Math.max(0,N),T=Math.max(0,W),Y=Math.min(y,N+h.w)-D,rr=Math.min(p,W+h.h)-T;if(Y<=0||rr<=0)return null;let H=D*F,z=T*F,$=Y*F,tr=rr*F;if(r==="selfie"){const S=$*.2,X=tr*.2;H=Math.max(0,H-S/2),z=Math.max(0,z-X/2),$=Math.min(P.videoWidth-H,$+S),tr=Math.min(P.videoHeight-z,tr+X)}if($<m||tr<m)return null;const _r=Math.min(1,640/Math.max($,tr)),Ir=Math.max(m,Math.round($*_r)),wr=Math.max(m,Math.round(tr*_r)),jr=document.createElement("canvas");jr.width=Ir,jr.height=wr;const Lr=jr.getContext("2d");return Lr&&(Lr.imageSmoothingEnabled=!0,Lr.imageSmoothingQuality="high",Lr.drawImage(P,H,z,$,tr,0,0,Ir,wr)),jr}},[h,a,r,A]),ar=B.useCallback(async()=>{if(Z.current||G.current>0)return;const P=R();if(P){if(P.width<50||P.height<50){console.warn("[Validation] Canvas too small, skipping validation",{width:P.width,height:P.height,minSize:50});return}Z.current=!0;try{(r==="selfie"?await rn.validateFace(P):await rn.validateIdCard(P,o)).passed?(b(!0),G.current=500):b(!1)}catch{b(!1)}finally{Z.current=!1}}},[r,o,R]),L=B.useCallback(async()=>{const P=er();if(!P)return;const Q=await new Promise(O=>P.toBlob(m=>O(m),"image/jpeg",1)),j=new File([Q],`${r}.jpg`,{type:"image/jpeg"});c(j),s&&(s.getTracks().forEach(O=>O.stop()),u(null))},[r,er,s]);B.useEffect(()=>{if(!s)return;let P,Q=0;const j=O=>{O-Q>=300&&(G.current>0?G.current-=O-Q:ar(),Q=O),P=requestAnimationFrame(j)};return P=requestAnimationFrame(j),()=>cancelAnimationFrame(P)},[s,ar]);const q=B.useCallback(async()=>{b(!1);try{const P=r==="selfie",Q=await navigator.mediaDevices.getUserMedia({video:{facingMode:P?"user":"environment",width:{ideal:P?1920:3840},height:{ideal:P?1080:2160},aspectRatio:16/9,...P?{whiteBalanceMode:"continuous",exposureMode:"continuous"}:{focusMode:"continuous",whiteBalanceMode:"continuous",exposureMode:"continuous",exposureCompensation:{min:-2,max:2,step:.1}}}});u(Q)}catch{M({title:"Camera Error",variant:"destructive"})}},[r,M]);return B.useEffect(()=>{a.current&&s&&a.current.srcObject!==s&&(a.current.srcObject=s)},[s,a.current]),B.useEffect(()=>(!l&&!s&&q(),()=>{s&&s.getTracks().forEach(P=>P.stop())}),[r,l,s,q]),B.useEffect(()=>{if(!n.current||!i.current)return;const P=()=>{requestAnimationFrame(()=>{if(!n.current||!i.current)return;const j=n.current.getBoundingClientRect(),O=i.current.getBoundingClientRect();d({x:Math.round(O.left-j.left),y:Math.round(O.top-j.top),w:Math.round(O.width),h:Math.round(O.height)})})};P();const Q=new ResizeObserver(P);return Q.observe(i.current),Q.observe(n.current),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),()=>{Q.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}},[s,e,r]),B.useEffect(()=>{if(r!=="selfie"||typeof window>"u"){_(!1);return}const P=async()=>{_(!0);try{const O=document.createElement("canvas");O.width=100,O.height=100,await rn.validateFace(O)}catch{}finally{_(!1)}},Q=()=>{_(rn.isFaceDetectorLoading)};Q(),P();const j=setInterval(()=>{Q(),rn.isFaceDetectorLoading||clearInterval(j)},100);return()=>{clearInterval(j)}},[r]),B.useEffect(()=>{if(!(r==="id-front"||r==="id-back")||typeof window>"u"){I(!1);return}const Q=async()=>{I(!0);try{const m=document.createElement("canvas");m.width=100,m.height=100,await rn.validateIdCard(m,o||"id")}catch{}finally{I(!1)}},j=()=>{I(rn.isOCRLoading)};j(),Q();const O=setInterval(()=>{j(),rn.isOCRLoading||clearInterval(O)},100);return()=>{clearInterval(O)}},[r,o]),{stream:s,photo:l,setPhoto:c,hole:h,maskId:k.current,photoUrl:K,capturePhoto:L,isFrameValid:g,isFaceDetectorLoading:v,isOCRLoading:E}},dc=768;function JS(){const[r,e]=C.useState(void 0);return C.useEffect(()=>{const a=window.matchMedia(`(max-width: ${dc-1}px)`),t=()=>{e(window.innerWidth<dc)};return a.addEventListener("change",t),e(window.innerWidth<dc),()=>a.removeEventListener("change",t)},[]),!!r}const zS={"id-front":"ID Front","id-back":"ID Back",selfie:"Selfie"},oi=({currentStep:r,onRetake:e,onConfirm:a,onBack:t,title:n,description:i,frameType:o,documentTypeId:A})=>{const s=B.useRef(null),u=B.useRef(null),l=B.useRef(null),c=B.useRef(null),h=B.useRef(null),d=JS(),{stream:g,photo:b,setPhoto:v,hole:_,maskId:E,photoUrl:I,capturePhoto:Z,isFrameValid:k,isFaceDetectorLoading:M,isOCRLoading:G}=QS(r,o,s,l,c,h,A,d),[K,er]=B.useState(!1),[R,ar]=B.useState(!1),L=!!g,P=!L||r==="selfie"&&M||(r==="id-front"||r==="id-back")&&G;B.useEffect(()=>{u.current&&g&&u.current.srcObject!==g&&(u.current.srcObject=g)},[g]);const Q=()=>{v(null),t()},j=()=>{v(null),e()},O=async()=>{if(b){ar(!0);try{await a(b)}finally{ar(!1),v(null)}}},m=async()=>{er(!0),await Z(),er(!1)},y=_.x+_.w/2,p=_.y+_.h/2,w=Math.max(_.w,_.h)/2,x=()=>{const F=zS[r]||"Photo";return f.jsx(K0,{className:"w-full max-w-md mx-auto",children:f.jsxs(q0,{className:"p-6",children:[f.jsx(ht,{title:`Review ${F}`,subTitle:"Make sure the information is seen clearly, with no blur or glare.",onBack:Q}),f.jsx("div",{className:"mb-8",children:f.jsx("div",{className:"relative",children:I&&f.jsx("img",{src:I,alt:"Captured photo",className:`w-full h-full object-contain ${r==="selfie"?"":o==="circular"?"rounded-full":"rounded-2xl"} bg-muted`})})}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx(p0,{variant:"outline",onClick:j,className:"flex-1 text-md",disabled:R,children:"Take again"}),f.jsx(p0,{onClick:O,className:"flex-1 text-md",disabled:R,children:R?f.jsxs(f.Fragment,{children:[f.jsx(vn,{className:"mr-2 h-4 w-4 animate-spin"}),"Uploading..."]}):"Looks good"})]})]})})};return b?x():d?f.jsxs(K0,{className:"relative w-full max-w-md mx-auto bg-gray-900 overflow-hidden",children:[L&&f.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:`absolute inset-0 w-full h-full object-cover z-0 ${!d&&"scale-x-[-1]"}`}),f.jsx("div",{ref:c,className:"absolute inset-0 z-5 pointer-events-none","aria-hidden":!0,children:f.jsxs("svg",{className:"w-full h-full",children:[f.jsx("defs",{children:f.jsxs("mask",{id:E,children:[f.jsx("rect",{width:"100%",height:"100%",fill:"white"}),o==="circular"?f.jsx("circle",{cx:y,cy:p,r:w,fill:"black"}):f.jsx("rect",{x:_.x,y:_.y,width:_.w,height:_.h,fill:"black"})]})}),f.jsx("rect",{width:"100%",height:"100%",fill:"rgba(17,24,39,0.7)",mask:`url(#${E})`})]})}),f.jsx("canvas",{ref:l,className:"hidden"}),f.jsxs(q0,{className:"relative z-10 text-white flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center p-6",children:[f.jsx(p0,{variant:"ghost",size:"sm",onClick:Q,className:"hover:bg-gray-600",children:f.jsx(Wf,{className:"h-6 w-6 text-white"})}),f.jsx("h1",{className:"text-xl font-semibold ml-4",children:n})]}),f.jsx("div",{className:"px-6 mb-8",children:f.jsx("p",{className:"text-gray-300 text-center",children:i})}),f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[f.jsxs("div",{className:"relative mb-16",children:[f.jsxs("div",{ref:h,className:`relative flex items-center justify-center z-20 transition-all duration-300 ${o==="circular"?"w-80 h-80 rounded-full":A==="passport"?"w-80 h-[225px]":"w-80 h-[202px]"} ${k?"ring-4 ring-green-400":""}`,children:[o!=="circular"&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-l-4 border-white z-30 -top-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-r-4 border-white z-30 -top-1 -right-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-l-4 border-white z-30 -bottom-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-r-4 border-white z-30 -bottom-1 -right-1"})]}),P&&f.jsx(vn,{size:36,className:"animate-spin"})]}),K&&f.jsx("div",{className:`absolute inset-0 flex items-center justify-center bg-black/50 ${o==="circular"?"rounded-full":"rounded-none"}`,children:f.jsx(vn,{className:"animate-spin h-10 w-10 text-white"})})]}),f.jsx(p0,{onClick:m,size:"lg",className:"w-16 h-16 rounded-full bg-white hover:bg-gray-100 border-4 border-gray-600 p-0",disabled:P||K||!k,children:f.jsx("div",{className:"w-8 h-8 rounded-full bg-white"})})]})]})]}):f.jsxs(K0,{className:" relative w-full max-w-md mx-auto bg-gray-900 overflow-hidden",children:[f.jsx("canvas",{ref:l,className:"hidden"}),L&&f.jsx("video",{ref:u,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:"absolute inset-0 w-full h-full object-cover scale-x-[-1]",style:{filter:"blur(5px)",zIndex:0}}),f.jsxs(q0,{className:"relative z-10 text-white flex flex-col h-full p-0",children:[f.jsxs("div",{className:"relative flex items-center p-6",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsxs("div",{className:"relative z-10 flex items-center",children:[f.jsx(p0,{variant:"ghost",size:"sm",onClick:Q,className:" hover:bg-gray-600",children:f.jsx(Wf,{className:"h-6 w-6 text-white"})}),f.jsx("h1",{className:"text-xl font-semibold ml-4",children:n})]})]}),f.jsxs("div",{className:"relative px-6 pb-4",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsx("p",{className:"relative z-10 text-gray-300 text-center",children:i})]}),f.jsx("div",{className:"flex-1 flex flex-col gap-8",children:f.jsx("div",{className:"relative flex-1 w-full flex items-center justify-center",children:f.jsxs("div",{className:"relative w-full h-[240px] overflow-hidden flex items-center justify-center",children:[L?f.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:`w-full h-auto object-contain ${!d&&"scale-x-[-1]"}`}):f.jsx("div",{className:"w-full h-[240px] flex items-center justify-center text-gray-400",children:f.jsx(vn,{size:36,className:"animate-spin"})}),L&&P&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:f.jsx(vn,{size:36,className:"animate-spin text-white"})}),f.jsx("div",{ref:c,className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:f.jsxs("svg",{className:"w-full h-full",children:[f.jsx("defs",{children:f.jsxs("mask",{id:E,children:[f.jsx("rect",{width:"100%",height:"100%",fill:"white"}),o==="circular"?f.jsx("circle",{cx:y,cy:p,r:w,fill:"black"}):f.jsx("rect",{x:_.x,y:_.y,width:_.w,height:_.h,fill:"black"})]})}),f.jsx("rect",{width:"100%",height:"100%",fill:"rgba(17,24,39,0.7)",mask:`url(#${E})`})]})}),f.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:f.jsx("div",{ref:h,className:`relative z-20 transition-all duration-300 ${o==="circular"?"w-56 h-56 rounded-full":A==="passport"?"w-72 h-[190px]":"w-72 h-[180px]"} ${k?"ring-4 ring-green-400":""}`,children:o!=="circular"&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-l-4 border-white z-30 -top-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-r-4 border-white z-30 -top-1 -right-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-l-4 border-white z-30 -bottom-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-r-4 border-white z-30 -bottom-1 -right-1"})]})})}),K&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:f.jsx(vn,{className:"animate-spin h-10 w-10 text-white"})})]})})}),f.jsxs("div",{className:"relative flex justify-center pb-6 pt-3",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsx("div",{className:"relative z-10 flex justify-center",children:f.jsx(p0,{onClick:m,size:"lg",className:"w-16 h-16 rounded-full bg-white hover:bg-gray-100 border-4 border-gray-600 p-0",disabled:P||K||!k,children:f.jsx("div",{className:"w-8 h-8 rounded-full bg-white"})})})]})]})]})},kv=({onContinue:r,onBack:e})=>f.jsx(K0,{className:"w-full max-w-md mx-auto",children:f.jsxs(q0,{className:"p-6",children:[f.jsx(ht,{title:"Selfie",subTitle:"Make sure your face is clear and is fully inside the frame.",onBack:e}),f.jsx("div",{className:"m-auto w-44 h-80 bg-gradient-to-br from-primary/20 to-primary/40 rounded-3xl p-4 shadow-2xl",children:f.jsx("div",{className:"w-full h-full bg-background rounded-2xl overflow-hidden relative",children:f.jsx("div",{className:"flex items-center justify-center h-full bg-muted/30",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"w-16 h-16 bg-primary rounded-full flex items-center justify-center mx-auto mb-2"}),f.jsx("div",{className:"w-28 h-32 bg-primary/30 rounded-2xl mx-auto"})]})})})}),f.jsx("div",{className:"mt-8",children:f.jsx(p0,{onClick:r,className:"w-full h-12 text-lg font-semibold",children:"Take a selfie"})})]})});function Ev(r,[e,a]){return Math.min(a,Math.max(e,r))}var KS=C.createContext(void 0);function qS(r){const e=C.useContext(KS);return r||e||"ltr"}var hc=0;function Cv(){C.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??_v()),document.body.insertAdjacentElement("beforeend",r[1]??_v()),hc++,()=>{hc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hc--}},[])}function _v(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var bc="focusScope.autoFocusOnMount",mc="focusScope.autoFocusOnUnmount",Iv={bubbles:!1,cancelable:!0},rW="FocusScope",vc=C.forwardRef((r,e)=>{const{loop:a=!1,trapped:t=!1,onMountAutoFocus:n,onUnmountAutoFocus:i,...o}=r,[A,s]=C.useState(null),u=fa(n),l=fa(i),c=C.useRef(null),h=_0(e,b=>s(b)),d=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(t){let b=function(I){if(d.paused||!A)return;const Z=I.target;A.contains(Z)?c.current=Z:en(c.current,{select:!0})},v=function(I){if(d.paused||!A)return;const Z=I.relatedTarget;Z!==null&&(A.contains(Z)||en(c.current,{select:!0}))},_=function(I){if(document.activeElement===document.body)for(const k of I)k.removedNodes.length>0&&en(A)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const E=new MutationObserver(_);return A&&E.observe(A,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),E.disconnect()}}},[t,A,d.paused]),C.useEffect(()=>{if(A){xv.add(d);const b=document.activeElement;if(!A.contains(b)){const _=new CustomEvent(bc,Iv);A.addEventListener(bc,u),A.dispatchEvent(_),_.defaultPrevented||(eW(oW(Bv(A)),{select:!0}),document.activeElement===b&&en(A))}return()=>{A.removeEventListener(bc,u),setTimeout(()=>{const _=new CustomEvent(mc,Iv);A.addEventListener(mc,l),A.dispatchEvent(_),_.defaultPrevented||en(b??document.body,{select:!0}),A.removeEventListener(mc,l),xv.remove(d)},0)}}},[A,u,l,d]);const g=C.useCallback(b=>{if(!a&&!t||d.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,_=document.activeElement;if(v&&_){const E=b.currentTarget,[I,Z]=aW(E);I&&Z?!b.shiftKey&&_===Z?(b.preventDefault(),a&&en(I,{select:!0})):b.shiftKey&&_===I&&(b.preventDefault(),a&&en(Z,{select:!0})):_===E&&b.preventDefault()}},[a,t,d.paused]);return f.jsx(t0.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});vc.displayName=rW;function eW(r,{select:e=!1}={}){const a=document.activeElement;for(const t of r)if(en(t,{select:e}),document.activeElement!==a)return}function aW(r){const e=Bv(r),a=Nv(e,r),t=Nv(e.reverse(),r);return[a,t]}function Bv(r){const e=[],a=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{const n=t.tagName==="INPUT"&&t.type==="hidden";return t.disabled||t.hidden||n?NodeFilter.FILTER_SKIP:t.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)e.push(a.currentNode);return e}function Nv(r,e){for(const a of r)if(!tW(a,{upTo:e}))return a}function tW(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function nW(r){return r instanceof HTMLInputElement&&"select"in r}function en(r,{select:e=!1}={}){if(r&&r.focus){const a=document.activeElement;r.focus({preventScroll:!0}),r!==a&&nW(r)&&e&&r.select()}}var xv=iW();function iW(){let r=[];return{add(e){const a=r[0];e!==a&&(a==null||a.pause()),r=Zv(r,e),r.unshift(e)},remove(e){var a;r=Zv(r,e),(a=r[0])==null||a.resume()}}}function Zv(r,e){const a=[...r],t=a.indexOf(e);return t!==-1&&a.splice(t,1),a}function oW(r){return r.filter(e=>e.tagName!=="A")}function AW(r){const e=C.useRef({value:r,previous:r});return C.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}var sW=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Ai=new WeakMap,qs=new WeakMap,rf={},gc=0,Fv=function(r){return r&&(r.host||Fv(r.parentNode))},fW=function(r,e){return e.map(function(a){if(r.contains(a))return a;var t=Fv(a);return t&&r.contains(t)?t:(console.error("aria-hidden",a,"in not contained inside",r,". Doing nothing"),null)}).filter(function(a){return!!a})},uW=function(r,e,a,t){var n=fW(e,Array.isArray(r)?r:[r]);rf[a]||(rf[a]=new WeakMap);var i=rf[a],o=[],A=new Set,s=new Set(n),u=function(c){!c||A.has(c)||(A.add(c),u(c.parentNode))};n.forEach(u);var l=function(c){!c||s.has(c)||Array.prototype.forEach.call(c.children,function(h){if(A.has(h))l(h);else try{var d=h.getAttribute(t),g=d!==null&&d!=="false",b=(Ai.get(h)||0)+1,v=(i.get(h)||0)+1;Ai.set(h,b),i.set(h,v),o.push(h),b===1&&g&&qs.set(h,!0),v===1&&h.setAttribute(a,"true"),g||h.setAttribute(t,"true")}catch(_){console.error("aria-hidden: cannot operate on ",h,_)}})};return l(e),A.clear(),gc++,function(){o.forEach(function(c){var h=Ai.get(c)-1,d=i.get(c)-1;Ai.set(c,h),i.set(c,d),h||(qs.has(c)||c.removeAttribute(t),qs.delete(c)),d||c.removeAttribute(a)}),gc--,gc||(Ai=new WeakMap,Ai=new WeakMap,qs=new WeakMap,rf={})}},Sv=function(r,e,a){a===void 0&&(a="data-aria-hidden");var t=Array.from(Array.isArray(r)?r:[r]),n=sW(r);return n?(t.push.apply(t,Array.from(n.querySelectorAll("[aria-live], script"))),uW(t,n,a,"aria-hidden")):function(){return null}},Ya=function(){return Ya=Object.assign||function(e){for(var a,t=1,n=arguments.length;t<n;t++){a=arguments[t];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])}return e},Ya.apply(this,arguments)};function Wv(r,e){var a={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(r);n<t.length;n++)e.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(r,t[n])&&(a[t[n]]=r[t[n]]);return a}function lW(r,e,a){if(a||arguments.length===2)for(var t=0,n=e.length,i;t<n;t++)(i||!(t in e))&&(i||(i=Array.prototype.slice.call(e,0,t)),i[t]=e[t]);return r.concat(i||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var ef="right-scroll-bar-position",af="width-before-scroll-bar",cW="with-scroll-bars-hidden",dW="--removed-body-scroll-bar-size";function pc(r,e){return typeof r=="function"?r(e):r&&(r.current=e),r}function hW(r,e){var a=B.useState(function(){return{value:r,callback:e,facade:{get current(){return a.value},set current(t){var n=a.value;n!==t&&(a.value=t,a.callback(t,n))}}}})[0];return a.callback=e,a.facade}var bW=typeof window<"u"?C.useLayoutEffect:C.useEffect,Tv=new WeakMap;function mW(r,e){var a=hW(null,function(t){return r.forEach(function(n){return pc(n,t)})});return bW(function(){var t=Tv.get(a);if(t){var n=new Set(t),i=new Set(r),o=a.current;n.forEach(function(A){i.has(A)||pc(A,null)}),i.forEach(function(A){n.has(A)||pc(A,o)})}Tv.set(a,r)},[r]),a}function vW(r){return r}function gW(r,e){e===void 0&&(e=vW);var a=[],t=!1,n={read:function(){if(t)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:r},useMedium:function(i){var o=e(i,t);return a.push(o),function(){a=a.filter(function(A){return A!==o})}},assignSyncMedium:function(i){for(t=!0;a.length;){var o=a;a=[],o.forEach(i)}a={push:function(A){return i(A)},filter:function(){return a}}},assignMedium:function(i){t=!0;var o=[];if(a.length){var A=a;a=[],A.forEach(i),o=a}var s=function(){var l=o;o=[],l.forEach(i)},u=function(){return Promise.resolve().then(s)};u(),a={push:function(l){o.push(l),u()},filter:function(l){return o=o.filter(l),a}}}};return n}function pW(r){r===void 0&&(r={});var e=gW(null);return e.options=Ya({async:!0,ssr:!1},r),e}var $v=function(r){var e=r.sideCar,a=Wv(r,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var t=e.read();if(!t)throw new Error("Sidecar medium not found");return C.createElement(t,Ya({},a))};$v.isSideCarExport=!0;function yW(r,e){return r.useMedium(e),$v}var Pv=pW(),yc=function(){},tf=C.forwardRef(function(r,e){var a=C.useRef(null),t=C.useState({onScrollCapture:yc,onWheelCapture:yc,onTouchMoveCapture:yc}),n=t[0],i=t[1],o=r.forwardProps,A=r.children,s=r.className,u=r.removeScrollBar,l=r.enabled,c=r.shards,h=r.sideCar,d=r.noRelative,g=r.noIsolation,b=r.inert,v=r.allowPinchZoom,_=r.as,E=_===void 0?"div":_,I=r.gapMode,Z=Wv(r,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,M=mW([a,e]),G=Ya(Ya({},Z),n);return C.createElement(C.Fragment,null,l&&C.createElement(k,{sideCar:Pv,removeScrollBar:u,shards:c,noRelative:d,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!v,lockRef:a,gapMode:I}),o?C.cloneElement(C.Children.only(A),Ya(Ya({},G),{ref:M})):C.createElement(E,Ya({},G,{className:s,ref:M}),A))});tf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},tf.classNames={fullWidth:af,zeroRight:ef};var wW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kW(){if(!document)return null;var r=document.createElement("style");r.type="text/css";var e=wW();return e&&r.setAttribute("nonce",e),r}function EW(r,e){r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}function CW(r){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(r)}var _W=function(){var r=0,e=null;return{add:function(a){r==0&&(e=kW())&&(EW(e,a),CW(e)),r++},remove:function(){r--,!r&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},IW=function(){var r=_W();return function(e,a){C.useEffect(function(){return r.add(e),function(){r.remove()}},[e&&a])}},Ov=function(){var r=IW(),e=function(a){var t=a.styles,n=a.dynamic;return r(t,n),null};return e},BW={left:0,top:0,right:0,gap:0},wc=function(r){return parseInt(r||"",10)||0},NW=function(r){var e=window.getComputedStyle(document.body),a=e[r==="padding"?"paddingLeft":"marginLeft"],t=e[r==="padding"?"paddingTop":"marginTop"],n=e[r==="padding"?"paddingRight":"marginRight"];return[wc(a),wc(t),wc(n)]},xW=function(r){if(r===void 0&&(r="margin"),typeof window>"u")return BW;var e=NW(r),a=document.documentElement.clientWidth,t=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,t-a+e[2]-e[0])}},ZW=Ov(),si="data-scroll-locked",FW=function(r,e,a,t){var n=r.left,i=r.top,o=r.right,A=r.gap;return a===void 0&&(a="margin"),`
171
+ }`,r.VERTEX_SHADER),this.Y=jm(this,this.G(),r.FRAGMENT_SHADER),r.linkProgram(this.h),!r.getProgramParameter(this.h,r.LINK_STATUS))throw Error(`Error during program linking: ${r.getProgramInfoLog(this.h)}`);this.P=r.getAttribLocation(this.h,"aVertex"),this.J=r.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){const r=this.g;r.deleteProgram(this.h),r.deleteShader(this.Z),r.deleteShader(this.Y)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}};function Et(r,e){switch(e){case 0:return r.g.find(a=>a instanceof Uint8Array);case 1:return r.g.find(a=>a instanceof Float32Array);case 2:return r.g.find(a=>typeof WebGLTexture<"u"&&a instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Kl(r){var e=Et(r,1);if(!e){if(e=Et(r,0))e=new Float32Array(e).map(t=>t/255);else{e=new Float32Array(r.width*r.height);const t=ai(r);var a=ql(r);if(Us(a,t,Um(r)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){a=new Float32Array(r.width*r.height*4),t.readPixels(0,0,r.width,r.height,t.RGBA,t.FLOAT,a);for(let n=0,i=0;n<e.length;++n,i+=4)e[n]=a[i]}else t.readPixels(0,0,r.width,r.height,t.RED,t.FLOAT,e)}r.g.push(e)}return e}function Um(r){let e=Et(r,2);if(!e){const a=ai(r);e=Hm(r);const t=Kl(r),n=Ym(r);a.texImage2D(a.TEXTURE_2D,0,n,r.width,r.height,0,a.RED,a.FLOAT,t),rc(r)}return e}function ai(r){if(!r.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return r.h||(r.h=kt(r.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),r.h}function Ym(r){if(r=ai(r),!Ys)if(r.getExtension("EXT_color_buffer_float")&&r.getExtension("OES_texture_float_linear")&&r.getExtension("EXT_float_blend"))Ys=r.R32F;else{if(!r.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Ys=r.R16F}return Ys}function ql(r){return r.l||(r.l=new zl),r.l}function Hm(r){const e=ai(r);e.viewport(0,0,r.width,r.height),e.activeTexture(e.TEXTURE0);let a=Et(r,2);return a||(a=Ls(ql(r),e,r.m?e.LINEAR:e.NEAREST),r.g.push(a),r.j=!0),e.bindTexture(e.TEXTURE_2D,a),a}function rc(r){r.h.bindTexture(r.h.TEXTURE_2D,null)}var Ys,re=class{constructor(r,e,a,t,n,i,o){this.g=r,this.m=e,this.j=a,this.canvas=t,this.l=n,this.width=i,this.height=o,this.j&&--Qm===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Da(){return!!Et(this,0)}ja(){return!!Et(this,1)}R(){return!!Et(this,2)}ia(){return(e=Et(r=this,0))||(e=Kl(r),e=new Uint8Array(e.map(a=>255*a)),r.g.push(e)),e;var r,e}ha(){return Kl(this)}N(){return Um(this)}clone(){const r=[];for(const e of this.g){let a;if(e instanceof Uint8Array)a=new Uint8Array(e);else if(e instanceof Float32Array)a=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const t=ai(this),n=ql(this);t.activeTexture(t.TEXTURE1),a=Ls(n,t,this.m?t.LINEAR:t.NEAREST),t.bindTexture(t.TEXTURE_2D,a);const i=Ym(this);t.texImage2D(t.TEXTURE_2D,0,i,this.width,this.height,0,t.RED,t.FLOAT,null),t.bindTexture(t.TEXTURE_2D,null),Us(n,t,a),Ql(n,t,!1,()=>{Hm(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),rc(this)}),Jl(n),rc(this)}}r.push(a)}return new re(r,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&ai(this).deleteTexture(Et(this,2)),Qm=-1}};re.prototype.close=re.prototype.close,re.prototype.clone=re.prototype.clone,re.prototype.getAsWebGLTexture=re.prototype.N,re.prototype.getAsFloat32Array=re.prototype.ha,re.prototype.getAsUint8Array=re.prototype.ia,re.prototype.hasWebGLTexture=re.prototype.R,re.prototype.hasFloat32Array=re.prototype.ja,re.prototype.hasUint8Array=re.prototype.Da;var Qm=250;function Ra(r,e){switch(e){case 0:return r.g.find(a=>a instanceof ImageData);case 1:return r.g.find(a=>typeof ImageBitmap<"u"&&a instanceof ImageBitmap);case 2:return r.g.find(a=>typeof WebGLTexture<"u"&&a instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Jm(r){var e=Ra(r,0);if(!e){e=ti(r);const a=Qs(r),t=new Uint8Array(r.width*r.height*4);Us(a,e,Hs(r)),e.readPixels(0,0,r.width,r.height,e.RGBA,e.UNSIGNED_BYTE,t),Jl(a),e=new ImageData(new Uint8ClampedArray(t.buffer),r.width,r.height),r.g.push(e)}return e}function Hs(r){let e=Ra(r,2);if(!e){const a=ti(r);e=Js(r);const t=Ra(r,1)||Jm(r);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,t),Zo(r)}return e}function ti(r){if(!r.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return r.h||(r.h=kt(r.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),r.h}function Qs(r){return r.l||(r.l=new zl),r.l}function Js(r){const e=ti(r);e.viewport(0,0,r.width,r.height),e.activeTexture(e.TEXTURE0);let a=Ra(r,2);return a||(a=Ls(Qs(r),e),r.g.push(a),r.m=!0),e.bindTexture(e.TEXTURE_2D,a),a}function Zo(r){r.h.bindTexture(r.h.TEXTURE_2D,null)}function zm(r){const e=ti(r);return Ql(Qs(r),e,!0,()=>function(a,t){const n=a.canvas;if(n.width===a.width&&n.height===a.height)return t();const i=n.width,o=n.height;return n.width=a.width,n.height=a.height,a=t(),n.width=i,n.height=o,a}(r,()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(r.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return r.canvas.transferToImageBitmap()}))}var ee=class{constructor(r,e,a,t,n,i,o){this.g=r,this.j=e,this.m=a,this.canvas=t,this.l=n,this.width=i,this.height=o,(this.j||this.m)&&--Km===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ca(){return!!Ra(this,0)}ka(){return!!Ra(this,1)}R(){return!!Ra(this,2)}Aa(){return Jm(this)}za(){var r=Ra(this,1);return r||(Hs(this),Js(this),r=zm(this),Zo(this),this.g.push(r),this.j=!0),r}N(){return Hs(this)}clone(){const r=[];for(const e of this.g){let a;if(e instanceof ImageData)a=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=ti(this),n=Qs(this);t.activeTexture(t.TEXTURE1),a=Ls(n,t),t.bindTexture(t.TEXTURE_2D,a),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),Us(n,t,a),Ql(n,t,!1,()=>{Js(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Zo(this)}),Jl(n),Zo(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);Hs(this),Js(this),a=zm(this),Zo(this)}r.push(a)}return new ee(r,this.ka(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ra(this,1).close(),this.m&&ti(this).deleteTexture(Ra(this,2)),Km=-1}};ee.prototype.close=ee.prototype.close,ee.prototype.clone=ee.prototype.clone,ee.prototype.getAsWebGLTexture=ee.prototype.N,ee.prototype.getAsImageBitmap=ee.prototype.za,ee.prototype.getAsImageData=ee.prototype.Aa,ee.prototype.hasWebGLTexture=ee.prototype.R,ee.prototype.hasImageBitmap=ee.prototype.ka,ee.prototype.hasImageData=ee.prototype.Ca;var Km=250;function ka(...r){return r.map(([e,a])=>({start:e,end:a}))}const LS=function(r){return class extends r{Ha(){this.i._registerModelResourcesGraphService()}}}((qm=class{constructor(r,e){this.l=!0,this.i=r,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",e!==void 0?this.i.canvas=e:Vm()?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(r){const e=await(await fetch(r)).arrayBuffer();r=!(r.endsWith(".pbtxt")||r.endsWith(".textproto")),this.setGraph(new Uint8Array(e),r)}setGraphFromString(r){this.setGraph(new TextEncoder().encode(r),!1)}setGraph(r,e){const a=r.length,t=this.i._malloc(a);this.i.HEAPU8.set(r,t),e?this.i._changeBinaryGraph(a,t):this.i._changeTextGraph(a,t),this.i._free(t)}configureAudio(r,e,a,t,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),xr(this,t||"input_audio",i=>{xr(this,n=n||"audio_header",o=>{this.i._configureAudio(i,o,r,e??0,a)})})}setAutoResizeCanvas(r){this.l=r}setAutoRenderToScreen(r){this.i._setAutoRenderToScreen(r)}setGpuBufferVerticalFlip(r){this.i.gpuOriginForWebTexturesIsBottomLeft=r}ca(r){Xa(this,"__graph_config__",e=>{r(e)}),xr(this,"__graph_config__",e=>{this.i._getGraphConfig(e,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(r){this.i.errorListener=r}attachEmptyPacketListener(r,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[r]=e}addAudioToStream(r,e,a){this.addAudioToStreamWithShape(r,0,0,e,a)}addAudioToStreamWithShape(r,e,a,t,n){const i=4*r.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(r,this.g/4),xr(this,t,o=>{this.i._addAudioToInputStream(this.g,e,a,o,n)})}addGpuBufferToStream(r,e,a){xr(this,e,t=>{const[n,i]=Gm(this,r,t);this.i._addBoundTextureToStream(t,n,i,a)})}addBoolToStream(r,e,a){xr(this,e,t=>{this.i._addBoolToInputStream(r,t,a)})}addDoubleToStream(r,e,a){xr(this,e,t=>{this.i._addDoubleToInputStream(r,t,a)})}addFloatToStream(r,e,a){xr(this,e,t=>{this.i._addFloatToInputStream(r,t,a)})}addIntToStream(r,e,a){xr(this,e,t=>{this.i._addIntToInputStream(r,t,a)})}addUintToStream(r,e,a){xr(this,e,t=>{this.i._addUintToInputStream(r,t,a)})}addStringToStream(r,e,a){xr(this,e,t=>{xr(this,r,n=>{this.i._addStringToInputStream(n,t,a)})})}addStringRecordToStream(r,e,a){xr(this,e,t=>{Xm(this,Object.keys(r),n=>{Xm(this,Object.values(r),i=>{this.i._addFlatHashMapToInputStream(n,i,Object.keys(r).length,t,a)})})})}addProtoToStream(r,e,a,t){xr(this,a,n=>{xr(this,e,i=>{const o=this.i._malloc(r.length);this.i.HEAPU8.set(r,o),this.i._addProtoToInputStream(o,r.length,i,n,t),this.i._free(o)})})}addEmptyPacketToStream(r,e){xr(this,r,a=>{this.i._addEmptyPacketToInputStream(a,e)})}addBoolVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateBoolVector(r.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const i of r)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputStream(n,t,a)})}addDoubleVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateDoubleVector(r.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const i of r)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputStream(n,t,a)})}addFloatVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateFloatVector(r.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const i of r)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputStream(n,t,a)})}addIntVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateIntVector(r.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const i of r)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputStream(n,t,a)})}addUintVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateUintVector(r.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of r)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputStream(n,t,a)})}addStringVectorToStream(r,e,a){xr(this,e,t=>{const n=this.i._allocateStringVector(r.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const i of r)xr(this,i,o=>{this.i._addStringVectorEntry(n,o)});this.i._addStringVectorToInputStream(n,t,a)})}addBoolToInputSidePacket(r,e){xr(this,e,a=>{this.i._addBoolToInputSidePacket(r,a)})}addDoubleToInputSidePacket(r,e){xr(this,e,a=>{this.i._addDoubleToInputSidePacket(r,a)})}addFloatToInputSidePacket(r,e){xr(this,e,a=>{this.i._addFloatToInputSidePacket(r,a)})}addIntToInputSidePacket(r,e){xr(this,e,a=>{this.i._addIntToInputSidePacket(r,a)})}addUintToInputSidePacket(r,e){xr(this,e,a=>{this.i._addUintToInputSidePacket(r,a)})}addStringToInputSidePacket(r,e){xr(this,e,a=>{xr(this,r,t=>{this.i._addStringToInputSidePacket(t,a)})})}addProtoToInputSidePacket(r,e,a){xr(this,a,t=>{xr(this,e,n=>{const i=this.i._malloc(r.length);this.i.HEAPU8.set(r,i),this.i._addProtoToInputSidePacket(i,r.length,n,t),this.i._free(i)})})}addBoolVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateBoolVector(r.length);if(!t)throw Error("Unable to allocate new bool vector on heap.");for(const n of r)this.i._addBoolVectorEntry(t,n);this.i._addBoolVectorToInputSidePacket(t,a)})}addDoubleVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateDoubleVector(r.length);if(!t)throw Error("Unable to allocate new double vector on heap.");for(const n of r)this.i._addDoubleVectorEntry(t,n);this.i._addDoubleVectorToInputSidePacket(t,a)})}addFloatVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateFloatVector(r.length);if(!t)throw Error("Unable to allocate new float vector on heap.");for(const n of r)this.i._addFloatVectorEntry(t,n);this.i._addFloatVectorToInputSidePacket(t,a)})}addIntVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateIntVector(r.length);if(!t)throw Error("Unable to allocate new int vector on heap.");for(const n of r)this.i._addIntVectorEntry(t,n);this.i._addIntVectorToInputSidePacket(t,a)})}addUintVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateUintVector(r.length);if(!t)throw Error("Unable to allocate new unsigned int vector on heap.");for(const n of r)this.i._addUintVectorEntry(t,n);this.i._addUintVectorToInputSidePacket(t,a)})}addStringVectorToInputSidePacket(r,e){xr(this,e,a=>{const t=this.i._allocateStringVector(r.length);if(!t)throw Error("Unable to allocate new string vector on heap.");for(const n of r)xr(this,n,i=>{this.i._addStringVectorEntry(t,i)});this.i._addStringVectorToInputSidePacket(t,a)})}attachBoolListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachBoolListener(a)})}attachBoolVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachBoolVectorListener(a)})}attachIntListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachIntListener(a)})}attachIntVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachIntVectorListener(a)})}attachUintListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachUintListener(a)})}attachUintVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachUintVectorListener(a)})}attachDoubleListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachDoubleListener(a)})}attachDoubleVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachDoubleVectorListener(a)})}attachFloatListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachFloatListener(a)})}attachFloatVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachFloatVectorListener(a)})}attachStringListener(r,e){Xa(this,r,e),xr(this,r,a=>{this.i._attachStringListener(a)})}attachStringVectorListener(r,e){qt(this,r,e),xr(this,r,a=>{this.i._attachStringVectorListener(a)})}attachProtoListener(r,e,a){Xa(this,r,e),xr(this,r,t=>{this.i._attachProtoListener(t,a||!1)})}attachProtoVectorListener(r,e,a){qt(this,r,e),xr(this,r,t=>{this.i._attachProtoVectorListener(t,a||!1)})}attachAudioListener(r,e,a){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Xa(this,r,(t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)}),xr(this,r,t=>{this.i._attachAudioListener(t,a||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends qm{get ea(){return this.i}oa(r,e,a){xr(this,e,t=>{const[n,i]=Gm(this,r,t);this.ea._addBoundTextureAsImageToStream(t,n,i,a)})}V(r,e){Xa(this,r,e),xr(this,r,a=>{this.ea._attachImageListener(a)})}ba(r,e){qt(this,r,e),xr(this,r,a=>{this.ea._attachImageVectorListener(a)})}}));var qm,aa=class extends LS{};async function Kr(r,e,a){return async function(t,n,i,o){return RS(t,n,i,o)}(r,a.canvas??(Vm()?void 0:document.createElement("canvas")),e,a)}function rv(r,e,a,t){if(r.U){const i=new om;if(a!=null&&a.regionOfInterest){if(!r.na)throw Error("This task doesn't support region-of-interest.");var n=a.regionOfInterest;if(n.left>=n.right||n.top>=n.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(n.left<0||n.top<0||n.right>1||n.bottom>1)throw Error("Expected RectF values to be in [0,1].");Cr(i,1,(n.left+n.right)/2),Cr(i,2,(n.top+n.bottom)/2),Cr(i,4,n.right-n.left),Cr(i,3,n.bottom-n.top)}else Cr(i,1,.5),Cr(i,2,.5),Cr(i,4,1),Cr(i,3,1);if(a!=null&&a.rotationDegrees){if((a==null?void 0:a.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(Cr(i,5,-Math.PI*a.rotationDegrees/180),(a==null?void 0:a.rotationDegrees)%180!=0){const[o,A]=Mm(e);a=D0(i,3)*A/o,n=D0(i,4)*o/A,Cr(i,4,a),Cr(i,3,n)}}r.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",r.U,t)}r.g.oa(e,r.Z,t??performance.now()),r.finishProcessing()}function ta(r,e,a){var t;if((t=r.baseOptions)!=null&&t.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");rv(r,e,a,r.B+1)}function ja(r,e,a,t){var n;if(!((n=r.baseOptions)!=null&&n.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");rv(r,e,a,t)}function ni(r,e,a,t){var n=e.data;const i=e.width,o=i*(e=e.height);if((n instanceof Uint8Array||n instanceof Float32Array)&&n.length!==o)throw Error("Unsupported channel count: "+n.length/o);return r=new re([n],a,!1,r.g.i.canvas,r.P,i,e),t?r.clone():r}var Be=class extends Yl{constructor(r,e,a,t){super(r),this.g=r,this.Z=e,this.U=a,this.na=t,this.P=new zl}l(r,e=!0){if("runningMode"in r&&Eo(this.baseOptions,2,!!r.runningMode&&r.runningMode!=="IMAGE"),r.canvas!==void 0&&this.g.i.canvas!==r.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(r,e)}close(){this.P.close(),super.close()}};Be.prototype.close=Be.prototype.close;var je=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect_in",!1),this.j={detections:[]},Zr(r=this.h=new Ms,0,1,e=new B0),Cr(this.h,2,.5),Cr(this.h,3,.3)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"minDetectionConfidence"in r&&Cr(this.h,2,r.minDetectionConfidence??.5),"minSuppressionThreshold"in r&&Cr(this.h,3,r.minSuppressionThreshold??.3),this.l(r)}D(r,e){return this.j={detections:[]},ta(this,r,e),this.j}F(r,e,a){return this.j={detections:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect_in"),s0(r,"detections");const e=new Ge;pa(e,xS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect_in"),qr(a,"DETECTIONS:detections"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("detections",(t,n)=>{for(const i of t)t=tm(i),this.j.detections.push(Tm(t));vr(this,n)}),this.g.attachEmptyPacketListener("detections",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};je.prototype.detectForVideo=je.prototype.F,je.prototype.detect=je.prototype.D,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=async function(r,e){return Kr(je,r,{baseOptions:{modelAssetPath:e}})},je.createFromModelBuffer=function(r,e){return Kr(je,r,{baseOptions:{modelAssetBuffer:e}})},je.createFromOptions=function(r,e){return Kr(je,r,e)};var ec=ka([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]),ac=ka([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]),tc=ka([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ev=ka([474,475],[475,476],[476,477],[477,474]),nc=ka([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]),ic=ka([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),av=ka([469,470],[470,471],[471,472],[472,469]),oc=ka([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]),tv=[...ec,...ac,...tc,...nc,...ic,...oc],nv=ka([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 iv(r){r.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var P0=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,Zr(r=this.h=new hm,0,1,e=new B0),this.v=new dm,Zr(this.h,0,3,this.v),this.s=new Ms,Zr(this.h,0,2,this.s),Ga(this.s,4,1),Cr(this.s,2,.5),Cr(this.v,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numFaces"in r&&Ga(this.s,4,r.numFaces??1),"minFaceDetectionConfidence"in r&&Cr(this.s,2,r.minFaceDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minFacePresenceConfidence"in r&&Cr(this.v,2,r.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in r&&(this.outputFaceBlendshapes=!!r.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in r&&(this.outputFacialTransformationMatrixes=!!r.outputFacialTransformationMatrixes),this.l(r)}D(r,e){return iv(this),ta(this,r,e),this.j}F(r,e,a){return iv(this),ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"face_landmarks");const e=new Ge;pa(e,FS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"NORM_LANDMARKS:face_landmarks"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("face_landmarks",(t,n)=>{for(const i of t)t=Bo(i),this.j.faceLandmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("face_landmarks",t=>{vr(this,t)}),this.outputFaceBlendshapes&&(s0(r,"blendshapes"),qr(a,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(t,n)=>{if(this.outputFaceBlendshapes)for(const i of t)t=Os(i),this.j.faceBlendshapes.push(Ll(t.g()??[]));vr(this,n)}),this.g.attachEmptyPacketListener("blendshapes",t=>{vr(this,t)})),this.outputFacialTransformationMatrixes&&(s0(r,"face_geometry"),qr(a,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(t,n)=>{if(this.outputFacialTransformationMatrixes)for(const i of t)(t=i0(ZS(i),wS,2))&&this.j.facialTransformationMatrixes.push({rows:ra(t,1)??0??0,columns:ra(t,2)??0??0,data:Dn(t,3,Ut,Vn()).slice()??[]});vr(this,n)}),this.g.attachEmptyPacketListener("face_geometry",t=>{vr(this,t)})),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};P0.prototype.detectForVideo=P0.prototype.F,P0.prototype.detect=P0.prototype.D,P0.prototype.setOptions=P0.prototype.o,P0.createFromModelPath=function(r,e){return Kr(P0,r,{baseOptions:{modelAssetPath:e}})},P0.createFromModelBuffer=function(r,e){return Kr(P0,r,{baseOptions:{modelAssetBuffer:e}})},P0.createFromOptions=function(r,e){return Kr(P0,r,e)},P0.FACE_LANDMARKS_LIPS=ec,P0.FACE_LANDMARKS_LEFT_EYE=ac,P0.FACE_LANDMARKS_LEFT_EYEBROW=tc,P0.FACE_LANDMARKS_LEFT_IRIS=ev,P0.FACE_LANDMARKS_RIGHT_EYE=nc,P0.FACE_LANDMARKS_RIGHT_EYEBROW=ic,P0.FACE_LANDMARKS_RIGHT_IRIS=av,P0.FACE_LANDMARKS_FACE_OVAL=oc,P0.FACE_LANDMARKS_CONTOURS=tv,P0.FACE_LANDMARKS_TESSELATION=nv;var La=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!0),Zr(r=this.j=new mm,0,1,e=new B0)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){return super.l(r)}Ka(r,e,a){const t=typeof e!="function"?e:{};if(this.h=typeof e=="function"?e:a,ta(this,r,t??{}),!this.h)return this.s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"stylized_image");const e=new Ge;pa(e,SS,this.j);const a=new he;Xe(a,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"STYLIZED_IMAGE:stylized_image"),a.o(e),Re(r,a),this.g.V("stylized_image",(t,n)=>{var i=!this.h,o=t.data,A=t.width;const s=A*(t=t.height);if(o instanceof Uint8Array)if(o.length===3*s){const u=new Uint8ClampedArray(4*s);for(let l=0;l<s;++l)u[4*l]=o[3*l],u[4*l+1]=o[3*l+1],u[4*l+2]=o[3*l+2],u[4*l+3]=255;o=new ImageData(u,A,t)}else{if(o.length!==4*s)throw Error("Unsupported channel count: "+o.length/s);o=new ImageData(new Uint8ClampedArray(o.buffer,o.byteOffset,o.length),A,t)}else if(!(o instanceof WebGLTexture))throw Error(`Unsupported format: ${o.constructor.name}`);A=new ee([o],!1,!1,this.g.i.canvas,this.P,A,t),this.s=i=i?A.clone():A,this.h&&this.h(i),vr(this,n)}),this.g.attachEmptyPacketListener("stylized_image",t=>{this.s=null,this.h&&this.h(null),vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};La.prototype.stylize=La.prototype.Ka,La.prototype.setOptions=La.prototype.o,La.createFromModelPath=function(r,e){return Kr(La,r,{baseOptions:{modelAssetPath:e}})},La.createFromModelBuffer=function(r,e){return Kr(La,r,{baseOptions:{modelAssetBuffer:e}})},La.createFromOptions=function(r,e){return Kr(La,r,e)};var Ac=ka([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 ov(r){r.gestures=[],r.landmarks=[],r.worldLandmarks=[],r.handedness=[]}function Av(r){return r.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:r.gestures,landmarks:r.landmarks,worldLandmarks:r.worldLandmarks,handedness:r.handedness,handednesses:r.handedness}}function sv(r,e=!0){const a=[];for(const n of r){var t=Os(n);r=[];for(const i of t.g())t=e&&ra(i,1)!=null?ra(i,1)??0:-1,r.push({score:D0(i,2)??0,index:t,categoryName:ea(i,3)??""??"",displayName:ea(i,4)??""??""});a.push(r)}return a}var Le=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Zr(r=this.j=new pm,0,1,e=new B0),this.s=new Dl,Zr(this.j,0,2,this.s),this.C=new Vl,Zr(this.s,0,3,this.C),this.v=new gm,Zr(this.s,0,2,this.v),this.h=new WS,Zr(this.j,0,3,this.h),Cr(this.v,2,.5),Cr(this.s,4,.5),Cr(this.C,2,.5)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){var n,i,o,A;if(Ga(this.v,3,r.numHands??1),"minHandDetectionConfidence"in r&&Cr(this.v,2,r.minHandDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.s,4,r.minTrackingConfidence??.5),"minHandPresenceConfidence"in r&&Cr(this.C,2,r.minHandPresenceConfidence??.5),r.cannedGesturesClassifierOptions){var e=new ri,a=e,t=jl(r.cannedGesturesClassifierOptions,(n=i0(this.h,ri,3))==null?void 0:n.h());Zr(a,0,2,t),Zr(this.h,0,3,e)}else r.cannedGesturesClassifierOptions===void 0&&((i=i0(this.h,ri,3))==null||i.g());return r.customGesturesClassifierOptions?(Zr(a=e=new ri,0,2,t=jl(r.customGesturesClassifierOptions,(o=i0(this.h,ri,4))==null?void 0:o.h())),Zr(this.h,0,4,e)):r.customGesturesClassifierOptions===void 0&&((A=i0(this.h,ri,4))==null||A.g()),this.l(r)}Fa(r,e){return ov(this),ta(this,r,e),Av(this)}Ga(r,e,a){return ov(this),ja(this,r,a,e),Av(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"hand_gestures"),s0(r,"hand_landmarks"),s0(r,"world_hand_landmarks"),s0(r,"handedness");const e=new Ge;pa(e,TS,this.j);const a=new he;Xe(a,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"HAND_GESTURES:hand_gestures"),qr(a,"LANDMARKS:hand_landmarks"),qr(a,"WORLD_LANDMARKS:world_hand_landmarks"),qr(a,"HANDEDNESS:handedness"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("hand_landmarks",(t,n)=>{for(const i of t){t=Bo(i);const o=[];for(const A of gt(t,im,1))o.push({x:D0(A,1)??0,y:D0(A,2)??0,z:D0(A,3)??0,visibility:D0(A,4)??0});this.landmarks.push(o)}vr(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("world_hand_landmarks",(t,n)=>{for(const i of t){t=q2(i);const o=[];for(const A of gt(t,nm,1))o.push({x:D0(A,1)??0,y:D0(A,2)??0,z:D0(A,3)??0,visibility:D0(A,4)??0});this.worldLandmarks.push(o)}vr(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("hand_gestures",(t,n)=>{this.gestures.push(...sv(t,!1)),vr(this,n)}),this.g.attachEmptyPacketListener("hand_gestures",t=>{vr(this,t)}),this.g.attachProtoVectorListener("handedness",(t,n)=>{this.handedness.push(...sv(t)),vr(this,n)}),this.g.attachEmptyPacketListener("handedness",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};function fv(r){return{landmarks:r.landmarks,worldLandmarks:r.worldLandmarks,handednesses:r.handedness,handedness:r.handedness}}Le.prototype.recognizeForVideo=Le.prototype.Ga,Le.prototype.recognize=Le.prototype.Fa,Le.prototype.setOptions=Le.prototype.o,Le.createFromModelPath=function(r,e){return Kr(Le,r,{baseOptions:{modelAssetPath:e}})},Le.createFromModelBuffer=function(r,e){return Kr(Le,r,{baseOptions:{modelAssetBuffer:e}})},Le.createFromOptions=function(r,e){return Kr(Le,r,e)},Le.HAND_CONNECTIONS=Ac;var Ue=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Zr(r=this.h=new Dl,0,1,e=new B0),this.s=new Vl,Zr(this.h,0,3,this.s),this.j=new gm,Zr(this.h,0,2,this.j),Ga(this.j,3,1),Cr(this.j,2,.5),Cr(this.s,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numHands"in r&&Ga(this.j,3,r.numHands??1),"minHandDetectionConfidence"in r&&Cr(this.j,2,r.minHandDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minHandPresenceConfidence"in r&&Cr(this.s,2,r.minHandPresenceConfidence??.5),this.l(r)}D(r,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ta(this,r,e),fv(this)}F(r,e,a){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ja(this,r,a,e),fv(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"hand_landmarks"),s0(r,"world_hand_landmarks"),s0(r,"handedness");const e=new Ge;pa(e,$S,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"LANDMARKS:hand_landmarks"),qr(a,"WORLD_LANDMARKS:world_hand_landmarks"),qr(a,"HANDEDNESS:handedness"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("hand_landmarks",(t,n)=>{for(const i of t)t=Bo(i),this.landmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("world_hand_landmarks",(t,n)=>{for(const i of t)t=q2(i),this.worldLandmarks.push(No(t));vr(this,n)}),this.g.attachEmptyPacketListener("world_hand_landmarks",t=>{vr(this,t)}),this.g.attachProtoVectorListener("handedness",(t,n)=>{var i=this.handedness,o=i.push;const A=[];for(const s of t){t=Os(s);const u=[];for(const l of t.g())u.push({score:D0(l,2)??0,index:ra(l,1)??0??-1,categoryName:ea(l,3)??""??"",displayName:ea(l,4)??""??""});A.push(u)}o.call(i,...A),vr(this,n)}),this.g.attachEmptyPacketListener("handedness",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ue.prototype.detectForVideo=Ue.prototype.F,Ue.prototype.detect=Ue.prototype.D,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(r,e){return Kr(Ue,r,{baseOptions:{modelAssetPath:e}})},Ue.createFromModelBuffer=function(r,e){return Kr(Ue,r,{baseOptions:{modelAssetBuffer:e}})},Ue.createFromOptions=function(r,e){return Kr(Ue,r,e)},Ue.HAND_CONNECTIONS=Ac;var uv=ka([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 lv(r){r.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function cv(r){try{if(!r.C)return r.h;r.C(r.h)}finally{js(r)}}function zs(r,e){r=Bo(r),e.push(Gs(r))}var N0=class extends Be{constructor(r,e){super(new aa(r,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,Zr(r=this.j=new _m,0,1,e=new B0),this.K=new Vl,Zr(this.j,0,2,this.K),this.Y=new PS,Zr(this.j,0,3,this.Y),this.s=new Ms,Zr(this.j,0,4,this.s),this.H=new dm,Zr(this.j,0,5,this.H),this.v=new Em,Zr(this.j,0,6,this.v),this.L=new Cm,Zr(this.j,0,7,this.L),Cr(this.s,2,.5),Cr(this.s,3,.3),Cr(this.H,2,.5),Cr(this.v,2,.5),Cr(this.v,3,.3),Cr(this.L,2,.5),Cr(this.K,2,.5)}get baseOptions(){return i0(this.j,B0,1)}set baseOptions(r){Zr(this.j,0,1,r)}o(r){return"minFaceDetectionConfidence"in r&&Cr(this.s,2,r.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in r&&Cr(this.s,3,r.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in r&&Cr(this.H,2,r.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in r&&(this.outputFaceBlendshapes=!!r.outputFaceBlendshapes),"minPoseDetectionConfidence"in r&&Cr(this.v,2,r.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in r&&Cr(this.v,3,r.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in r&&Cr(this.L,2,r.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in r&&(this.outputPoseSegmentationMasks=!!r.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in r&&Cr(this.K,2,r.minHandLandmarksConfidence??.5),this.l(r)}D(r,e,a){const t=typeof e!="function"?e:{};return this.C=typeof e=="function"?e:a,lv(this),ta(this,r,t),cv(this)}F(r,e,a,t){const n=typeof a!="function"?a:{};return this.C=typeof a=="function"?a:t,lv(this),ja(this,r,n,e),cv(this)}m(){var r=new Ie;C0(r,"input_frames_image"),s0(r,"pose_landmarks"),s0(r,"pose_world_landmarks"),s0(r,"face_landmarks"),s0(r,"left_hand_landmarks"),s0(r,"left_hand_world_landmarks"),s0(r,"right_hand_landmarks"),s0(r,"right_hand_world_landmarks");const e=new Ge,a=new G5;ol(a,1,G2("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(n,i){if(i!=null)if(Array.isArray(i))y0(n,2,gs(i,al,void 0,void 0,!1));else{if(!(typeof i=="string"||i instanceof bt||$n(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");ol(n,2,Ru(i,!1),Pn())}}(a,this.j.g());const t=new he;Xe(t,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Es(t,8,G5,a),w0(t,"IMAGE:input_frames_image"),qr(t,"POSE_LANDMARKS:pose_landmarks"),qr(t,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),qr(t,"FACE_LANDMARKS:face_landmarks"),qr(t,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),qr(t,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),qr(t,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),qr(t,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),t.o(e),Re(r,t),Rs(this,r),this.g.attachProtoListener("pose_landmarks",(n,i)=>{zs(n,this.h.poseLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("pose_world_landmarks",(n,i)=>{var o=this.h.poseWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",n=>{vr(this,n)}),this.outputPoseSegmentationMasks&&(qr(t,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),ei(this,"pose_segmentation_mask"),this.g.V("pose_segmentation_mask",(n,i)=>{this.h.poseSegmentationMasks=[ni(this,n,!0,!this.C)],vr(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",n=>{this.h.poseSegmentationMasks=[],vr(this,n)})),this.g.attachProtoListener("face_landmarks",(n,i)=>{zs(n,this.h.faceLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{vr(this,n)}),this.outputFaceBlendshapes&&(s0(r,"extra_blendshapes"),qr(t,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(n,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(n=Os(n),o.push(Ll(n.g()??[]))),vr(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",n=>{vr(this,n)})),this.g.attachProtoListener("left_hand_landmarks",(n,i)=>{zs(n,this.h.leftHandLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("left_hand_world_landmarks",(n,i)=>{var o=this.h.leftHandWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("right_hand_landmarks",(n,i)=>{zs(n,this.h.rightHandLandmarks),vr(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",n=>{vr(this,n)}),this.g.attachProtoListener("right_hand_world_landmarks",(n,i)=>{var o=this.h.rightHandWorldLandmarks;n=q2(n),o.push(No(n)),vr(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",n=>{vr(this,n)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};N0.prototype.detectForVideo=N0.prototype.F,N0.prototype.detect=N0.prototype.D,N0.prototype.setOptions=N0.prototype.o,N0.createFromModelPath=function(r,e){return Kr(N0,r,{baseOptions:{modelAssetPath:e}})},N0.createFromModelBuffer=function(r,e){return Kr(N0,r,{baseOptions:{modelAssetBuffer:e}})},N0.createFromOptions=function(r,e){return Kr(N0,r,e)},N0.HAND_CONNECTIONS=Ac,N0.POSE_CONNECTIONS=uv,N0.FACE_LANDMARKS_LIPS=ec,N0.FACE_LANDMARKS_LEFT_EYE=ac,N0.FACE_LANDMARKS_LEFT_EYEBROW=tc,N0.FACE_LANDMARKS_LEFT_IRIS=ev,N0.FACE_LANDMARKS_RIGHT_EYE=nc,N0.FACE_LANDMARKS_RIGHT_EYEBROW=ic,N0.FACE_LANDMARKS_RIGHT_IRIS=av,N0.FACE_LANDMARKS_FACE_OVAL=oc,N0.FACE_LANDMARKS_CONTOURS=tv,N0.FACE_LANDMARKS_TESSELATION=nv;var na=class extends Be{constructor(r,e){super(new aa(r,e),"input_image","norm_rect",!0),this.j={classifications:[]},Zr(r=this.h=new Im,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return Zr(this.h,0,2,jl(r,i0(this.h,$l,2))),this.l(r)}qa(r,e){return this.j={classifications:[]},ta(this,r,e),this.j}ra(r,e,a){return this.j={classifications:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"input_image"),C0(r,"norm_rect"),s0(r,"classifications");const e=new Ge;pa(e,OS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),w0(a,"IMAGE:input_image"),w0(a,"NORM_RECT:norm_rect"),qr(a,"CLASSIFICATIONS:classifications"),a.o(e),Re(r,a),this.g.attachProtoListener("classifications",(t,n)=>{this.j=function(i){const o={classifications:gt(i,ES,1).map(A=>{var s;return Ll(((s=i0(A,em,4))==null?void 0:s.g())??[],ra(A,2)??0,ea(A,3)??"")})};return zu(R2(i,2))!=null&&(o.timestampMs=zu(R2(i,2))??0),o}(CS(t)),vr(this,n)}),this.g.attachEmptyPacketListener("classifications",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};na.prototype.classifyForVideo=na.prototype.ra,na.prototype.classify=na.prototype.qa,na.prototype.setOptions=na.prototype.o,na.createFromModelPath=function(r,e){return Kr(na,r,{baseOptions:{modelAssetPath:e}})},na.createFromModelBuffer=function(r,e){return Kr(na,r,{baseOptions:{modelAssetBuffer:e}})},na.createFromOptions=function(r,e){return Kr(na,r,e)};var Ye=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!0),this.h=new Bm,this.embeddings={embeddings:[]},Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){var e=this.h,a=i0(this.h,um,2);return a=a?a.clone():new um,r.l2Normalize!==void 0?Eo(a,1,r.l2Normalize):"l2Normalize"in r&&y0(a,1),r.quantize!==void 0?Eo(a,2,r.quantize):"quantize"in r&&y0(a,2),Zr(e,0,2,a),this.l(r)}xa(r,e){return ta(this,r,e),this.embeddings}ya(r,e,a){return ja(this,r,a,e),this.embeddings}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"embeddings_out");const e=new Ge;pa(e,VS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"EMBEDDINGS:embeddings_out"),a.o(e),Re(r,a),this.g.attachProtoListener("embeddings_out",(t,n)=>{t=BS(t),this.embeddings=function(i){return{embeddings:gt(i,IS,1).map(o=>{var s,u;const A={headIndex:ra(o,3)??0??-1,headName:ea(o,4)??""??""};if(s5(o,Am,Al(o,1))!==void 0)o=Dn(o=i0(o,Am,Al(o,1)),1,Ut,Vn()),A.floatEmbedding=o.slice();else{const l=new Uint8Array(0);A.quantizedEmbedding=((u=(s=i0(o,_S,Al(o,2)))==null?void 0:s.ma())==null?void 0:u.h())??l}return A}),timestampMs:zu(R2(i,2))??0}}(t),vr(this,n)}),this.g.attachEmptyPacketListener("embeddings_out",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ye.cosineSimilarity=function(r,e){if(r.floatEmbedding&&e.floatEmbedding)r=Pm(r.floatEmbedding,e.floatEmbedding);else{if(!r.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");r=Pm($m(r.quantizedEmbedding),$m(e.quantizedEmbedding))}return r},Ye.prototype.embedForVideo=Ye.prototype.ya,Ye.prototype.embed=Ye.prototype.xa,Ye.prototype.setOptions=Ye.prototype.o,Ye.createFromModelPath=function(r,e){return Kr(Ye,r,{baseOptions:{modelAssetPath:e}})},Ye.createFromModelBuffer=function(r,e){return Kr(Ye,r,{baseOptions:{modelAssetBuffer:e}})},Ye.createFromOptions=function(r,e){return Kr(Ye,r,e)};var sc=class{constructor(r,e,a){this.confidenceMasks=r,this.categoryMask=e,this.qualityScores=a}close(){var r,e;(r=this.confidenceMasks)==null||r.forEach(a=>{a.close()}),(e=this.categoryMask)==null||e.close()}};function dv(r){r.categoryMask=void 0,r.confidenceMasks=void 0,r.qualityScores=void 0}function hv(r){try{const e=new sc(r.confidenceMasks,r.categoryMask,r.qualityScores);if(!r.j)return e;r.j(e)}finally{js(r)}}sc.prototype.close=sc.prototype.close;var Ne=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Rl,this.v=new Nm,Zr(this.h,0,3,this.v),Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return r.displayNamesLocale!==void 0?y0(this.h,2,G2(r.displayNamesLocale)):"displayNamesLocale"in r&&y0(this.h,2),"outputCategoryMask"in r&&(this.outputCategoryMask=r.outputCategoryMask??!1),"outputConfidenceMasks"in r&&(this.outputConfidenceMasks=r.outputConfidenceMasks??!0),super.l(r)}J(){(function(r){var a,t;const e=gt(r.ca(),he,1).filter(n=>(ea(n,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(r.s=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");e.length===1&&(((t=(a=i0(e[0],Ge,7))==null?void 0:a.l())==null?void 0:t.g())??new Map).forEach((n,i)=>{r.s[Number(i)]=ea(n,1)??""})})(this)}segment(r,e,a){const t=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:a,dv(this),ta(this,r,t),hv(this)}Ia(r,e,a,t){const n=typeof a!="function"?a:{};return this.j=typeof a=="function"?a:t,dv(this),ja(this,r,n,e),hv(this)}Ba(){return this.s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect");const e=new Ge;pa(e,Fm,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),a.o(e),Re(r,a),Rs(this,r),this.outputConfidenceMasks&&(s0(r,"confidence_masks"),qr(a,"CONFIDENCE_MASKS:confidence_masks"),ei(this,"confidence_masks"),this.g.ba("confidence_masks",(t,n)=>{this.confidenceMasks=t.map(i=>ni(this,i,!0,!this.j)),vr(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",t=>{this.confidenceMasks=[],vr(this,t)})),this.outputCategoryMask&&(s0(r,"category_mask"),qr(a,"CATEGORY_MASK:category_mask"),ei(this,"category_mask"),this.g.V("category_mask",(t,n)=>{this.categoryMask=ni(this,t,!1,!this.j),vr(this,n)}),this.g.attachEmptyPacketListener("category_mask",t=>{this.categoryMask=void 0,vr(this,t)})),s0(r,"quality_scores"),qr(a,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(t,n)=>{this.qualityScores=t,vr(this,n)}),this.g.attachEmptyPacketListener("quality_scores",t=>{this.categoryMask=void 0,vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ne.prototype.getLabels=Ne.prototype.Ba,Ne.prototype.segmentForVideo=Ne.prototype.Ia,Ne.prototype.segment=Ne.prototype.segment,Ne.prototype.setOptions=Ne.prototype.o,Ne.createFromModelPath=function(r,e){return Kr(Ne,r,{baseOptions:{modelAssetPath:e}})},Ne.createFromModelBuffer=function(r,e){return Kr(Ne,r,{baseOptions:{modelAssetBuffer:e}})},Ne.createFromOptions=function(r,e){return Kr(Ne,r,e)};var fc=class{constructor(r,e,a){this.confidenceMasks=r,this.categoryMask=e,this.qualityScores=a}close(){var r,e;(r=this.confidenceMasks)==null||r.forEach(a=>{a.close()}),(e=this.categoryMask)==null||e.close()}};fc.prototype.close=fc.prototype.close;var US=class extends yr{constructor(r){super(r)}},ii=[0,$0,-2],Ks=[0,wt,-3,I0,wt,-1],bv=[0,Ks],mv=[0,Ks,$0,-1],uc=class extends yr{constructor(r){super(r)}},vv=[0,wt,-1,I0],YS=class extends yr{constructor(r){super(r)}},gv=class extends yr{constructor(r){super(r)}},lc=[1,2,3,4,5,6,7,8,9,10,14,15],pv=class extends yr{constructor(r){super(r)}};pv.prototype.g=Ps([0,J0,[0,lc,c0,Ks,c0,[0,Ks,ii],c0,bv,c0,[0,bv,ii],c0,vv,c0,[0,wt,-3,I0,Me],c0,[0,wt,-3,I0],c0,[0,l0,wt,-2,I0,$0,I0,-1,2,wt,ii],c0,mv,c0,[0,mv,ii],wt,ii,l0,c0,[0,wt,-3,I0,ii,-1],c0,[0,J0,vv]],l0,[0,l0,$0,-1,I0]]);var Ua=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Rl,this.s=new Nm,Zr(this.h,0,3,this.s),Zr(r=this.h,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"outputCategoryMask"in r&&(this.outputCategoryMask=r.outputCategoryMask??!1),"outputConfidenceMasks"in r&&(this.outputConfidenceMasks=r.outputConfidenceMasks??!0),super.l(r)}segment(r,e,a,t){const n=typeof a!="function"?a:{};this.j=typeof a=="function"?a:t,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,a=this.B+1,t=new pv;const i=new gv;var o=new US;if(Ga(o,1,255),Zr(i,0,12,o),e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var A=new uc;Eo(A,3,!0),Cr(A,1,e.keypoint.x),Cr(A,2,e.keypoint.y),ko(i,5,lc,A)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");for(A of(o=new YS,e.scribble))Eo(e=new uc,3,!0),Cr(e,1,A.x),Cr(e,2,A.y),Es(o,1,uc,e);ko(i,15,lc,o)}Es(t,1,gv,i),this.g.addProtoToStream(t.g(),"drishti.RenderData","roi_in",a),ta(this,r,n);r:{try{const u=new fc(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var s=u;break r}this.j(u)}finally{js(this)}s=void 0}return s}m(){var r=new Ie;C0(r,"image_in"),C0(r,"roi_in"),C0(r,"norm_rect_in");const e=new Ge;pa(e,Fm,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),w0(a,"IMAGE:image_in"),w0(a,"ROI:roi_in"),w0(a,"NORM_RECT:norm_rect_in"),a.o(e),Re(r,a),Rs(this,r),this.outputConfidenceMasks&&(s0(r,"confidence_masks"),qr(a,"CONFIDENCE_MASKS:confidence_masks"),ei(this,"confidence_masks"),this.g.ba("confidence_masks",(t,n)=>{this.confidenceMasks=t.map(i=>ni(this,i,!0,!this.j)),vr(this,n)}),this.g.attachEmptyPacketListener("confidence_masks",t=>{this.confidenceMasks=[],vr(this,t)})),this.outputCategoryMask&&(s0(r,"category_mask"),qr(a,"CATEGORY_MASK:category_mask"),ei(this,"category_mask"),this.g.V("category_mask",(t,n)=>{this.categoryMask=ni(this,t,!1,!this.j),vr(this,n)}),this.g.attachEmptyPacketListener("category_mask",t=>{this.categoryMask=void 0,vr(this,t)})),s0(r,"quality_scores"),qr(a,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(t,n)=>{this.qualityScores=t,vr(this,n)}),this.g.attachEmptyPacketListener("quality_scores",t=>{this.categoryMask=void 0,vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};Ua.prototype.segment=Ua.prototype.segment,Ua.prototype.setOptions=Ua.prototype.o,Ua.createFromModelPath=function(r,e){return Kr(Ua,r,{baseOptions:{modelAssetPath:e}})},Ua.createFromModelBuffer=function(r,e){return Kr(Ua,r,{baseOptions:{modelAssetBuffer:e}})},Ua.createFromOptions=function(r,e){return Kr(Ua,r,e)};var ia=class extends Be{constructor(r,e){super(new aa(r,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},Zr(r=this.h=new Sm,0,1,e=new B0)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return r.displayNamesLocale!==void 0?y0(this.h,2,G2(r.displayNamesLocale)):"displayNamesLocale"in r&&y0(this.h,2),r.maxResults!==void 0?Ga(this.h,3,r.maxResults):"maxResults"in r&&y0(this.h,3),r.scoreThreshold!==void 0?Cr(this.h,4,r.scoreThreshold):"scoreThreshold"in r&&y0(this.h,4),r.categoryAllowlist!==void 0?Cs(this.h,5,r.categoryAllowlist):"categoryAllowlist"in r&&y0(this.h,5),r.categoryDenylist!==void 0?Cs(this.h,6,r.categoryDenylist):"categoryDenylist"in r&&y0(this.h,6),this.l(r)}D(r,e){return this.j={detections:[]},ta(this,r,e),this.j}F(r,e,a){return this.j={detections:[]},ja(this,r,a,e),this.j}m(){var r=new Ie;C0(r,"input_frame_gpu"),C0(r,"norm_rect"),s0(r,"detections");const e=new Ge;pa(e,MS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.ObjectDetectorGraph"),w0(a,"IMAGE:input_frame_gpu"),w0(a,"NORM_RECT:norm_rect"),qr(a,"DETECTIONS:detections"),a.o(e),Re(r,a),this.g.attachProtoVectorListener("detections",(t,n)=>{for(const i of t)t=tm(i),this.j.detections.push(Tm(t));vr(this,n)}),this.g.attachEmptyPacketListener("detections",t=>{vr(this,t)}),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};ia.prototype.detectForVideo=ia.prototype.F,ia.prototype.detect=ia.prototype.D,ia.prototype.setOptions=ia.prototype.o,ia.createFromModelPath=async function(r,e){return Kr(ia,r,{baseOptions:{modelAssetPath:e}})},ia.createFromModelBuffer=function(r,e){return Kr(ia,r,{baseOptions:{modelAssetBuffer:e}})},ia.createFromOptions=function(r,e){return Kr(ia,r,e)};var cc=class{constructor(r,e,a){this.landmarks=r,this.worldLandmarks=e,this.segmentationMasks=a}close(){var r;(r=this.segmentationMasks)==null||r.forEach(e=>{e.close()})}};function yv(r){r.landmarks=[],r.worldLandmarks=[],r.segmentationMasks=void 0}function wv(r){try{const e=new cc(r.landmarks,r.worldLandmarks,r.segmentationMasks);if(!r.s)return e;r.s(e)}finally{js(r)}}cc.prototype.close=cc.prototype.close;var He=class extends Be{constructor(r,e){super(new aa(r,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,Zr(r=this.h=new Wm,0,1,e=new B0),this.v=new Cm,Zr(this.h,0,3,this.v),this.j=new Em,Zr(this.h,0,2,this.j),Ga(this.j,4,1),Cr(this.j,2,.5),Cr(this.v,2,.5),Cr(this.h,4,.5)}get baseOptions(){return i0(this.h,B0,1)}set baseOptions(r){Zr(this.h,0,1,r)}o(r){return"numPoses"in r&&Ga(this.j,4,r.numPoses??1),"minPoseDetectionConfidence"in r&&Cr(this.j,2,r.minPoseDetectionConfidence??.5),"minTrackingConfidence"in r&&Cr(this.h,4,r.minTrackingConfidence??.5),"minPosePresenceConfidence"in r&&Cr(this.v,2,r.minPosePresenceConfidence??.5),"outputSegmentationMasks"in r&&(this.outputSegmentationMasks=r.outputSegmentationMasks??!1),this.l(r)}D(r,e,a){const t=typeof e!="function"?e:{};return this.s=typeof e=="function"?e:a,yv(this),ta(this,r,t),wv(this)}F(r,e,a,t){const n=typeof a!="function"?a:{};return this.s=typeof a=="function"?a:t,yv(this),ja(this,r,n,e),wv(this)}m(){var r=new Ie;C0(r,"image_in"),C0(r,"norm_rect"),s0(r,"normalized_landmarks"),s0(r,"world_landmarks"),s0(r,"segmentation_masks");const e=new Ge;pa(e,GS,this.h);const a=new he;Xe(a,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),w0(a,"IMAGE:image_in"),w0(a,"NORM_RECT:norm_rect"),qr(a,"NORM_LANDMARKS:normalized_landmarks"),qr(a,"WORLD_LANDMARKS:world_landmarks"),a.o(e),Re(r,a),Rs(this,r),this.g.attachProtoVectorListener("normalized_landmarks",(t,n)=>{this.landmarks=[];for(const i of t)t=Bo(i),this.landmarks.push(Gs(t));vr(this,n)}),this.g.attachEmptyPacketListener("normalized_landmarks",t=>{this.landmarks=[],vr(this,t)}),this.g.attachProtoVectorListener("world_landmarks",(t,n)=>{this.worldLandmarks=[];for(const i of t)t=q2(i),this.worldLandmarks.push(No(t));vr(this,n)}),this.g.attachEmptyPacketListener("world_landmarks",t=>{this.worldLandmarks=[],vr(this,t)}),this.outputSegmentationMasks&&(qr(a,"SEGMENTATION_MASK:segmentation_masks"),ei(this,"segmentation_masks"),this.g.ba("segmentation_masks",(t,n)=>{this.segmentationMasks=t.map(i=>ni(this,i,!0,!this.s)),vr(this,n)}),this.g.attachEmptyPacketListener("segmentation_masks",t=>{this.segmentationMasks=[],vr(this,t)})),r=r.g(),this.setGraph(new Uint8Array(r),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(r,e){return Kr(He,r,{baseOptions:{modelAssetPath:e}})},He.createFromModelBuffer=function(r,e){return Kr(He,r,{baseOptions:{modelAssetBuffer:e}})},He.createFromOptions=function(r,e){return Kr(He,r,e)},He.POSE_CONNECTIONS=uv;class HS{constructor(){n2(this,"faceDetector",null);n2(this,"ocrWorker",null);n2(this,"isLoadingFaceDetector",!1);n2(this,"loadingPromise",null);n2(this,"isLoadingOCR",!1);n2(this,"ocrLoadingPromise",null)}get isFaceDetectorLoading(){return this.isLoadingFaceDetector}get isOCRLoading(){return this.isLoadingOCR}async getOCRWorker(){return this.ocrWorker?this.ocrWorker:this.ocrLoadingPromise?await this.ocrLoadingPromise:(this.isLoadingOCR=!0,this.ocrLoadingPromise=(async()=>{try{const e=await wF.createWorker("eng");return this.ocrWorker=e,e}finally{this.isLoadingOCR=!1,this.ocrLoadingPromise=null}})(),await this.ocrLoadingPromise)}async loadFaceDetector(){if(!(this.faceDetector||typeof window>"u")){if(this.loadingPromise){await this.loadingPromise;return}this.isLoadingFaceDetector=!0,this.loadingPromise=(async()=>{const e=["0.10.10","0.10.11","0.10.22-rc.20250304"];let a=null;for(const t of e)try{const n=await Xn.forVisionTasks(`https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@${t}/wasm`);this.faceDetector=await je.createFromOptions(n,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite"},runningMode:"IMAGE"});return}catch(n){a=n,console.warn(`[ImageValidator] Failed to load face detector with version ${t}:`,n)}console.error("[ImageValidator] Failed to load face detector with all versions:",a)})();try{await this.loadingPromise}finally{this.isLoadingFaceDetector=!1,this.loadingPromise=null}}}async validateFace(e){if(typeof window>"u")return{type:"face",passed:!1,facesDetected:0};try{if(await this.loadFaceDetector(),!this.faceDetector)return console.warn("[ImageValidator] Face detector not available"),{type:"face",passed:!1,facesDetected:0};const t=this.faceDetector.detect(e).detections.length;return{type:"face",passed:t>=1,facesDetected:t}}catch(a){return console.error("[ImageValidator] Face validation error:",a),{type:"face",passed:!1,facesDetected:0}}}async validateIdCard(e,a){try{const t=await this.getOCRWorker(),{data:{text:n}}=await t.recognize(e),i=3,o=4,A=4,s=n.match(new RegExp(`\\b[a-zA-Z]{${o},}\\b`,"g"))??[],u=n.match(new RegExp(`\\b\\d{${A},}\\b`,"g"))??[];return{type:a,passed:s.length>=i||u.length>=1,textSnippet:n.replace(/[^a-zA-Z0-9]/g,"").slice(0,200),fullText:n}}catch(t){return console.error("[ImageValidator] OCR validation error:",t),{type:a,passed:!1}}}}const rn=new HS,QS=(r,e,a,t,n,i,o,A)=>{const[s,u]=B.useState(null),[l,c]=B.useState(null),[h,d]=B.useState({x:0,y:0,w:320,h:192}),[g,b]=B.useState(!1),[v,_]=B.useState(!1),[E,I]=B.useState(!1),Z=B.useRef(!1),k=B.useRef(`frameMask-${Math.random().toString(36).slice(2)}`),{toast:M}=Zi(),G=B.useRef(0),K=B.useMemo(()=>l?URL.createObjectURL(l):null,[l]),er=B.useCallback(()=>{const P=a.current;if(!P||!P.videoWidth)return null;const Q=P.getBoundingClientRect(),j=P.videoWidth/P.videoHeight,O=Q.width/Q.height;if(A){let m,y,p=0,w=0;j>O?(y=Q.height,m=Q.height*j,p=(m-Q.width)/2):(m=Q.width,y=Q.width/j,w=(y-Q.height)/2);const x=P.videoWidth/m;let F=(h.x+p)*x,N=(h.y+w)*x,W=h.w*x,D=h.h*x;if(r==="selfie"){const _r=W*.2,Ir=D*.2;F=Math.max(0,F-_r/2),N=Math.max(0,N-Ir/2),W=Math.min(P.videoWidth-F,W+_r),D=Math.min(P.videoHeight-N,D+Ir)}const T=Math.max(0,Math.round(F)),Y=Math.max(0,Math.round(N)),rr=Math.min(P.videoWidth-T,Math.round(W)),H=Math.min(P.videoHeight-Y,Math.round(D)),z=rr,$=H;if(z<=0||$<=0)return null;const tr=document.createElement("canvas");tr.width=z,tr.height=$;const gr=tr.getContext("2d",{willReadFrequently:!1,colorSpace:"srgb"});return gr&&(gr.imageSmoothingEnabled=!0,gr.imageSmoothingQuality="high",r==="selfie"?gr.filter="contrast(1.1) brightness(1.02)":gr.filter="contrast(1.15) brightness(1.05) saturate(1.05)",gr.drawImage(P,T,Y,rr,H,0,0,z,$)),tr}else{let m,y,p=0,w=0;j>O?(m=Q.width,y=Q.width/j,w=(Q.height-y)/2):(y=Q.height,m=Q.height*j,p=(Q.width-m)/2);const x=P.videoWidth/m,F=h.x-p,N=h.y-w,W=Math.max(0,F),D=Math.max(0,N),T=Math.min(m,F+h.w)-W,Y=Math.min(y,N+h.h)-D;if(T<=0||Y<=0)return null;let rr=W*x,H=D*x,z=T*x,$=Y*x;if(r==="selfie"){const X=z*.2,U=$*.2;rr=Math.max(0,rr-X/2),H=Math.max(0,H-U/2),z=Math.min(P.videoWidth-rr,z+X),$=Math.min(P.videoHeight-H,$+U)}const tr=Math.max(0,Math.round(rr)),gr=Math.max(0,Math.round(H)),_r=Math.min(P.videoWidth-tr,Math.round(z)),Ir=Math.min(P.videoHeight-gr,Math.round($)),wr=_r,jr=Ir;if(wr<=0||jr<=0)return null;const Lr=document.createElement("canvas");Lr.width=wr,Lr.height=jr;const S=Lr.getContext("2d",{willReadFrequently:!1,colorSpace:"srgb"});return S&&(S.imageSmoothingEnabled=!0,S.imageSmoothingQuality="high",r==="selfie"?S.filter="contrast(1.1) brightness(1.02)":S.filter="contrast(1.15) brightness(1.05) saturate(1.05)",S.drawImage(P,tr,gr,_r,Ir,0,0,wr,jr)),Lr}},[h,a,r,A]),R=B.useCallback(()=>{const P=a.current;if(!P||!P.videoWidth)return null;const Q=P.getBoundingClientRect(),j=P.videoWidth/P.videoHeight,O=Q.width/Q.height,m=50;if(A){let y,p,w=0,x=0;j>O?(p=Q.height,y=Q.height*j,w=(y-Q.width)/2):(y=Q.width,p=Q.width/j,x=(p-Q.height)/2);const F=P.videoWidth/y;let N=(h.x+w)*F,W=(h.y+x)*F,D=h.w*F,T=h.h*F;if(r==="selfie"){const gr=D*.2,_r=T*.2;N=Math.max(0,N-gr/2),W=Math.max(0,W-_r/2),D=Math.min(P.videoWidth-N,D+gr),T=Math.min(P.videoHeight-W,T+_r)}const rr=Math.min(1,640/Math.max(D,T)),H=Math.max(m,Math.round(D*rr)),z=Math.max(m,Math.round(T*rr)),$=document.createElement("canvas");$.width=H,$.height=z;const tr=$.getContext("2d");return tr&&(tr.imageSmoothingEnabled=!0,tr.imageSmoothingQuality="high",tr.drawImage(P,N,W,D,T,0,0,H,z)),$}else{let y,p,w=0,x=0;j>O?(y=Q.width,p=Q.width/j,x=(Q.height-p)/2):(p=Q.height,y=Q.height*j,w=(Q.width-y)/2);const F=P.videoWidth/y,N=h.x-w,W=h.y-x,D=Math.max(0,N),T=Math.max(0,W),Y=Math.min(y,N+h.w)-D,rr=Math.min(p,W+h.h)-T;if(Y<=0||rr<=0)return null;let H=D*F,z=T*F,$=Y*F,tr=rr*F;if(r==="selfie"){const S=$*.2,X=tr*.2;H=Math.max(0,H-S/2),z=Math.max(0,z-X/2),$=Math.min(P.videoWidth-H,$+S),tr=Math.min(P.videoHeight-z,tr+X)}if($<m||tr<m)return null;const _r=Math.min(1,640/Math.max($,tr)),Ir=Math.max(m,Math.round($*_r)),wr=Math.max(m,Math.round(tr*_r)),jr=document.createElement("canvas");jr.width=Ir,jr.height=wr;const Lr=jr.getContext("2d");return Lr&&(Lr.imageSmoothingEnabled=!0,Lr.imageSmoothingQuality="high",Lr.drawImage(P,H,z,$,tr,0,0,Ir,wr)),jr}},[h,a,r,A]),ar=B.useCallback(async()=>{if(Z.current||G.current>0)return;const P=R();if(P){if(P.width<50||P.height<50){console.warn("[Validation] Canvas too small, skipping validation",{width:P.width,height:P.height,minSize:50});return}Z.current=!0;try{(r==="selfie"?await rn.validateFace(P):await rn.validateIdCard(P,o)).passed?(b(!0),G.current=500):b(!1)}catch{b(!1)}finally{Z.current=!1}}},[r,o,R]),L=B.useCallback(async()=>{const P=er();if(!P)return;const Q=await new Promise(O=>P.toBlob(m=>O(m),"image/jpeg",1)),j=new File([Q],`${r}.jpg`,{type:"image/jpeg"});c(j),s&&(s.getTracks().forEach(O=>O.stop()),u(null))},[r,er,s]);B.useEffect(()=>{if(!s)return;let P,Q=0;const j=O=>{O-Q>=300&&(G.current>0?G.current-=O-Q:ar(),Q=O),P=requestAnimationFrame(j)};return P=requestAnimationFrame(j),()=>cancelAnimationFrame(P)},[s,ar]);const q=B.useCallback(async()=>{b(!1);try{const P=r==="selfie",Q=await navigator.mediaDevices.getUserMedia({video:{facingMode:P?"user":"environment",width:{ideal:P?1920:3840},height:{ideal:P?1080:2160},aspectRatio:16/9,...P?{whiteBalanceMode:"continuous",exposureMode:"continuous"}:{focusMode:"continuous",whiteBalanceMode:"continuous",exposureMode:"continuous",exposureCompensation:{min:-2,max:2,step:.1}}}});u(Q)}catch{M({title:"Camera Error",variant:"destructive"})}},[r,M]);return B.useEffect(()=>{a.current&&s&&a.current.srcObject!==s&&(a.current.srcObject=s)},[s,a.current]),B.useEffect(()=>(!l&&!s&&q(),()=>{s&&s.getTracks().forEach(P=>P.stop())}),[r,l,s,q]),B.useEffect(()=>{if(!n.current||!i.current)return;const P=()=>{requestAnimationFrame(()=>{if(!n.current||!i.current)return;const j=n.current.getBoundingClientRect(),O=i.current.getBoundingClientRect();d({x:Math.round(O.left-j.left),y:Math.round(O.top-j.top),w:Math.round(O.width),h:Math.round(O.height)})})};P();const Q=new ResizeObserver(P);return Q.observe(i.current),Q.observe(n.current),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),()=>{Q.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}},[s,e,r]),B.useEffect(()=>{if(r!=="selfie"||typeof window>"u"){_(!1);return}const P=async()=>{_(!0);try{const O=document.createElement("canvas");O.width=100,O.height=100,await rn.validateFace(O)}catch{}finally{_(!1)}},Q=()=>{_(rn.isFaceDetectorLoading)};Q(),P();const j=setInterval(()=>{Q(),rn.isFaceDetectorLoading||clearInterval(j)},100);return()=>{clearInterval(j)}},[r]),B.useEffect(()=>{if(!(r==="id-front"||r==="id-back")||typeof window>"u"){I(!1);return}const Q=async()=>{I(!0);try{const m=document.createElement("canvas");m.width=100,m.height=100,await rn.validateIdCard(m,o||"id")}catch{}finally{I(!1)}},j=()=>{I(rn.isOCRLoading)};j(),Q();const O=setInterval(()=>{j(),rn.isOCRLoading||clearInterval(O)},100);return()=>{clearInterval(O)}},[r,o]),{stream:s,photo:l,setPhoto:c,hole:h,maskId:k.current,photoUrl:K,capturePhoto:L,isFrameValid:g,isFaceDetectorLoading:v,isOCRLoading:E}},dc=768;function JS(){const[r,e]=C.useState(void 0);return C.useEffect(()=>{const a=window.matchMedia(`(max-width: ${dc-1}px)`),t=()=>{e(window.innerWidth<dc)};return a.addEventListener("change",t),e(window.innerWidth<dc),()=>a.removeEventListener("change",t)},[]),!!r}const zS={"id-front":"ID Front","id-back":"ID Back",selfie:"Selfie"},oi=({currentStep:r,onRetake:e,onConfirm:a,onBack:t,title:n,description:i,frameType:o,documentTypeId:A})=>{const s=B.useRef(null),u=B.useRef(null),l=B.useRef(null),c=B.useRef(null),h=B.useRef(null),d=JS(),{stream:g,photo:b,setPhoto:v,hole:_,maskId:E,photoUrl:I,capturePhoto:Z,isFrameValid:k,isFaceDetectorLoading:M,isOCRLoading:G}=QS(r,o,s,l,c,h,A,d),[K,er]=B.useState(!1),[R,ar]=B.useState(!1),L=!!g,P=!L||r==="selfie"&&M||(r==="id-front"||r==="id-back")&&G;B.useEffect(()=>{u.current&&g&&u.current.srcObject!==g&&(u.current.srcObject=g)},[g]);const Q=()=>{v(null),t()},j=()=>{v(null),e()},O=async()=>{if(b){ar(!0);try{await a(b)}finally{ar(!1),v(null)}}},m=async()=>{er(!0),await Z(),er(!1)},y=_.x+_.w/2,p=_.y+_.h/2,w=Math.max(_.w,_.h)/2,x=()=>{const F=zS[r]||"Photo";return f.jsx(K0,{className:"w-full max-w-md mx-auto",children:f.jsxs(q0,{className:"p-6",children:[f.jsx(ht,{title:`Review ${F}`,subTitle:"Make sure the information is seen clearly, with no blur or glare.",onBack:Q}),f.jsx("div",{className:"mb-8",children:f.jsx("div",{className:"relative",children:I&&f.jsx("img",{src:I,alt:"Captured photo",className:`w-full h-full object-contain ${r==="selfie"?"":o==="circular"?"rounded-full":"rounded-2xl"} bg-muted`})})}),f.jsxs("div",{className:"flex gap-4",children:[f.jsx(p0,{variant:"outline",onClick:j,className:"flex-1 text-md",disabled:R,children:"Take again"}),f.jsx(p0,{onClick:O,className:"flex-1 text-md",disabled:R,children:R?f.jsxs(f.Fragment,{children:[f.jsx(vn,{className:"mr-2 h-4 w-4 animate-spin"}),"Uploading..."]}):"Looks good"})]})]})})};return b?x():d?f.jsxs(K0,{className:"relative w-full max-w-md mx-auto bg-gray-900 overflow-hidden",children:[L&&f.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:`absolute inset-0 w-full h-full object-cover z-0 ${!d&&"scale-x-[-1]"}`}),f.jsx("div",{ref:c,className:"absolute inset-0 z-5 pointer-events-none","aria-hidden":!0,children:f.jsxs("svg",{className:"w-full h-full",children:[f.jsx("defs",{children:f.jsxs("mask",{id:E,children:[f.jsx("rect",{width:"100%",height:"100%",fill:"white"}),o==="circular"?f.jsx("circle",{cx:y,cy:p,r:w,fill:"black"}):f.jsx("rect",{x:_.x,y:_.y,width:_.w,height:_.h,fill:"black"})]})}),f.jsx("rect",{width:"100%",height:"100%",fill:"rgba(17,24,39,0.7)",mask:`url(#${E})`})]})}),f.jsx("canvas",{ref:l,className:"hidden"}),f.jsxs(q0,{className:"relative z-10 text-white flex flex-col h-full",children:[f.jsxs("div",{className:"flex items-center p-6",children:[f.jsx(p0,{variant:"ghost",size:"sm",onClick:Q,className:"hover:bg-gray-600",children:f.jsx(Wf,{className:"h-6 w-6 text-white"})}),f.jsx("h1",{className:"text-xl font-semibold ml-4",children:n})]}),f.jsx("div",{className:"px-6 mb-8",children:f.jsx("p",{className:"text-gray-300 text-center",children:i})}),f.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6",children:[f.jsxs("div",{className:"relative mb-16",children:[f.jsxs("div",{ref:h,className:`relative flex items-center justify-center z-20 transition-all duration-300 ${o==="circular"?"w-80 h-80 rounded-full":A==="passport"?"w-80 h-[225px]":"w-80 h-[202px]"} ${k?"ring-4 ring-green-400":""}`,children:[o!=="circular"&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-l-4 border-white z-30 -top-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-r-4 border-white z-30 -top-1 -right-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-l-4 border-white z-30 -bottom-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-r-4 border-white z-30 -bottom-1 -right-1"})]}),P&&f.jsx(vn,{size:36,className:"animate-spin"})]}),K&&f.jsx("div",{className:`absolute inset-0 flex items-center justify-center bg-black/50 ${o==="circular"?"rounded-full":"rounded-none"}`,children:f.jsx(vn,{className:"animate-spin h-10 w-10 text-white"})})]}),f.jsx(p0,{onClick:m,size:"lg",className:"w-16 h-16 rounded-full bg-white hover:bg-gray-100 border-4 border-gray-600 p-0",disabled:P||K||!k,children:f.jsx("div",{className:"w-8 h-8 rounded-full bg-white"})})]})]})]}):f.jsxs(K0,{className:" relative w-full max-w-md mx-auto bg-gray-900 overflow-hidden",children:[f.jsx("canvas",{ref:l,className:"hidden"}),L&&f.jsx("video",{ref:u,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:"absolute inset-0 w-full h-full object-cover scale-x-[-1]",style:{filter:"blur(5px)",zIndex:0}}),f.jsxs(q0,{className:"relative z-10 text-white flex flex-col h-full p-0",children:[f.jsxs("div",{className:"relative flex items-center p-6",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsxs("div",{className:"relative z-10 flex items-center",children:[f.jsx(p0,{variant:"ghost",size:"sm",onClick:Q,className:" hover:bg-gray-600",children:f.jsx(Wf,{className:"h-6 w-6 text-white"})}),f.jsx("h1",{className:"text-xl font-semibold ml-4",children:n})]})]}),f.jsxs("div",{className:"relative px-6 pb-4",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsx("p",{className:"relative z-10 text-gray-300 text-center",children:i})]}),f.jsx("div",{className:"flex-1 flex flex-col gap-8",children:f.jsx("div",{className:"relative flex-1 w-full flex items-center justify-center",children:f.jsxs("div",{className:"relative w-full h-[240px] overflow-hidden flex items-center justify-center",children:[L?f.jsx("video",{ref:s,autoPlay:!0,playsInline:!0,muted:!0,loop:!0,className:`w-full h-auto object-contain ${!d&&"scale-x-[-1]"}`}):f.jsx("div",{className:"w-full h-[240px] flex items-center justify-center text-gray-400",children:f.jsx(vn,{size:36,className:"animate-spin"})}),L&&P&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:f.jsx(vn,{size:36,className:"animate-spin text-white"})}),f.jsx("div",{ref:c,className:"pointer-events-none absolute inset-0","aria-hidden":!0,children:f.jsxs("svg",{className:"w-full h-full",children:[f.jsx("defs",{children:f.jsxs("mask",{id:E,children:[f.jsx("rect",{width:"100%",height:"100%",fill:"white"}),o==="circular"?f.jsx("circle",{cx:y,cy:p,r:w,fill:"black"}):f.jsx("rect",{x:_.x,y:_.y,width:_.w,height:_.h,fill:"black"})]})}),f.jsx("rect",{width:"100%",height:"100%",fill:"rgba(17,24,39,0.7)",mask:`url(#${E})`})]})}),f.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:f.jsx("div",{ref:h,className:`relative z-20 transition-all duration-300 ${o==="circular"?"w-56 h-56 rounded-full":A==="passport"?"w-72 h-[190px]":"w-72 h-[180px]"} ${k?"ring-4 ring-green-400":""}`,children:o!=="circular"&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-l-4 border-white z-30 -top-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-t-4 border-r-4 border-white z-30 -top-1 -right-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-l-4 border-white z-30 -bottom-1 -left-1"}),f.jsx("div",{className:"absolute w-6 h-6 border-b-4 border-r-4 border-white z-30 -bottom-1 -right-1"})]})})}),K&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:f.jsx(vn,{className:"animate-spin h-10 w-10 text-white"})})]})})}),f.jsxs("div",{className:"relative flex justify-center pb-6 pt-3",children:[f.jsx("div",{className:"absolute inset-0 bg-[rgba(17,24,39,0.7)]"}),f.jsx("div",{className:"relative z-10 flex justify-center",children:f.jsx(p0,{onClick:m,size:"lg",className:"w-16 h-16 rounded-full bg-white hover:bg-gray-100 border-4 border-gray-600 p-0",disabled:P||K||!k,children:f.jsx("div",{className:"w-8 h-8 rounded-full bg-white"})})})]})]})]})},kv=({onContinue:r,onBack:e})=>f.jsx(K0,{className:"w-full max-w-md mx-auto",children:f.jsxs(q0,{className:"p-6",children:[f.jsx(ht,{title:"Selfie",subTitle:"Make sure your face is clear and is fully inside the frame.",onBack:e}),f.jsx("div",{className:"m-auto w-44 h-80 bg-gradient-to-br from-primary/20 to-primary/40 rounded-3xl p-4 shadow-2xl",children:f.jsx("div",{className:"w-full h-full bg-background rounded-2xl overflow-hidden relative",children:f.jsx("div",{className:"flex items-center justify-center h-full bg-muted/30",children:f.jsxs("div",{className:"text-center",children:[f.jsx("div",{className:"w-16 h-16 bg-primary rounded-full flex items-center justify-center mx-auto mb-2"}),f.jsx("div",{className:"w-28 h-32 bg-primary/30 rounded-2xl mx-auto"})]})})})}),f.jsx("div",{className:"mt-8",children:f.jsx(p0,{onClick:r,className:"w-full h-12 text-lg font-semibold",children:"Take a selfie"})})]})});function Ev(r,[e,a]){return Math.min(a,Math.max(e,r))}var KS=C.createContext(void 0);function qS(r){const e=C.useContext(KS);return r||e||"ltr"}var hc=0;function Cv(){C.useEffect(()=>{const r=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",r[0]??_v()),document.body.insertAdjacentElement("beforeend",r[1]??_v()),hc++,()=>{hc===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),hc--}},[])}function _v(){const r=document.createElement("span");return r.setAttribute("data-radix-focus-guard",""),r.tabIndex=0,r.style.outline="none",r.style.opacity="0",r.style.position="fixed",r.style.pointerEvents="none",r}var bc="focusScope.autoFocusOnMount",mc="focusScope.autoFocusOnUnmount",Iv={bubbles:!1,cancelable:!0},rW="FocusScope",vc=C.forwardRef((r,e)=>{const{loop:a=!1,trapped:t=!1,onMountAutoFocus:n,onUnmountAutoFocus:i,...o}=r,[A,s]=C.useState(null),u=fa(n),l=fa(i),c=C.useRef(null),h=_0(e,b=>s(b)),d=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(t){let b=function(I){if(d.paused||!A)return;const Z=I.target;A.contains(Z)?c.current=Z:en(c.current,{select:!0})},v=function(I){if(d.paused||!A)return;const Z=I.relatedTarget;Z!==null&&(A.contains(Z)||en(c.current,{select:!0}))},_=function(I){if(document.activeElement===document.body)for(const k of I)k.removedNodes.length>0&&en(A)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const E=new MutationObserver(_);return A&&E.observe(A,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),E.disconnect()}}},[t,A,d.paused]),C.useEffect(()=>{if(A){xv.add(d);const b=document.activeElement;if(!A.contains(b)){const _=new CustomEvent(bc,Iv);A.addEventListener(bc,u),A.dispatchEvent(_),_.defaultPrevented||(eW(oW(Bv(A)),{select:!0}),document.activeElement===b&&en(A))}return()=>{A.removeEventListener(bc,u),setTimeout(()=>{const _=new CustomEvent(mc,Iv);A.addEventListener(mc,l),A.dispatchEvent(_),_.defaultPrevented||en(b??document.body,{select:!0}),A.removeEventListener(mc,l),xv.remove(d)},0)}}},[A,u,l,d]);const g=C.useCallback(b=>{if(!a&&!t||d.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,_=document.activeElement;if(v&&_){const E=b.currentTarget,[I,Z]=aW(E);I&&Z?!b.shiftKey&&_===Z?(b.preventDefault(),a&&en(I,{select:!0})):b.shiftKey&&_===I&&(b.preventDefault(),a&&en(Z,{select:!0})):_===E&&b.preventDefault()}},[a,t,d.paused]);return f.jsx(t0.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});vc.displayName=rW;function eW(r,{select:e=!1}={}){const a=document.activeElement;for(const t of r)if(en(t,{select:e}),document.activeElement!==a)return}function aW(r){const e=Bv(r),a=Nv(e,r),t=Nv(e.reverse(),r);return[a,t]}function Bv(r){const e=[],a=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:t=>{const n=t.tagName==="INPUT"&&t.type==="hidden";return t.disabled||t.hidden||n?NodeFilter.FILTER_SKIP:t.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)e.push(a.currentNode);return e}function Nv(r,e){for(const a of r)if(!tW(a,{upTo:e}))return a}function tW(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function nW(r){return r instanceof HTMLInputElement&&"select"in r}function en(r,{select:e=!1}={}){if(r&&r.focus){const a=document.activeElement;r.focus({preventScroll:!0}),r!==a&&nW(r)&&e&&r.select()}}var xv=iW();function iW(){let r=[];return{add(e){const a=r[0];e!==a&&(a==null||a.pause()),r=Zv(r,e),r.unshift(e)},remove(e){var a;r=Zv(r,e),(a=r[0])==null||a.resume()}}}function Zv(r,e){const a=[...r],t=a.indexOf(e);return t!==-1&&a.splice(t,1),a}function oW(r){return r.filter(e=>e.tagName!=="A")}function AW(r){const e=C.useRef({value:r,previous:r});return C.useMemo(()=>(e.current.value!==r&&(e.current.previous=e.current.value,e.current.value=r),e.current.previous),[r])}var sW=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Ai=new WeakMap,qs=new WeakMap,rf={},gc=0,Fv=function(r){return r&&(r.host||Fv(r.parentNode))},fW=function(r,e){return e.map(function(a){if(r.contains(a))return a;var t=Fv(a);return t&&r.contains(t)?t:(console.error("aria-hidden",a,"in not contained inside",r,". Doing nothing"),null)}).filter(function(a){return!!a})},uW=function(r,e,a,t){var n=fW(e,Array.isArray(r)?r:[r]);rf[a]||(rf[a]=new WeakMap);var i=rf[a],o=[],A=new Set,s=new Set(n),u=function(c){!c||A.has(c)||(A.add(c),u(c.parentNode))};n.forEach(u);var l=function(c){!c||s.has(c)||Array.prototype.forEach.call(c.children,function(h){if(A.has(h))l(h);else try{var d=h.getAttribute(t),g=d!==null&&d!=="false",b=(Ai.get(h)||0)+1,v=(i.get(h)||0)+1;Ai.set(h,b),i.set(h,v),o.push(h),b===1&&g&&qs.set(h,!0),v===1&&h.setAttribute(a,"true"),g||h.setAttribute(t,"true")}catch(_){console.error("aria-hidden: cannot operate on ",h,_)}})};return l(e),A.clear(),gc++,function(){o.forEach(function(c){var h=Ai.get(c)-1,d=i.get(c)-1;Ai.set(c,h),i.set(c,d),h||(qs.has(c)||c.removeAttribute(t),qs.delete(c)),d||c.removeAttribute(a)}),gc--,gc||(Ai=new WeakMap,Ai=new WeakMap,qs=new WeakMap,rf={})}},Sv=function(r,e,a){a===void 0&&(a="data-aria-hidden");var t=Array.from(Array.isArray(r)?r:[r]),n=sW(r);return n?(t.push.apply(t,Array.from(n.querySelectorAll("[aria-live], script"))),uW(t,n,a,"aria-hidden")):function(){return null}},Ya=function(){return Ya=Object.assign||function(e){for(var a,t=1,n=arguments.length;t<n;t++){a=arguments[t];for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(e[i]=a[i])}return e},Ya.apply(this,arguments)};function Wv(r,e){var a={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(a[t]=r[t]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,t=Object.getOwnPropertySymbols(r);n<t.length;n++)e.indexOf(t[n])<0&&Object.prototype.propertyIsEnumerable.call(r,t[n])&&(a[t[n]]=r[t[n]]);return a}function lW(r,e,a){if(a||arguments.length===2)for(var t=0,n=e.length,i;t<n;t++)(i||!(t in e))&&(i||(i=Array.prototype.slice.call(e,0,t)),i[t]=e[t]);return r.concat(i||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var ef="right-scroll-bar-position",af="width-before-scroll-bar",cW="with-scroll-bars-hidden",dW="--removed-body-scroll-bar-size";function pc(r,e){return typeof r=="function"?r(e):r&&(r.current=e),r}function hW(r,e){var a=B.useState(function(){return{value:r,callback:e,facade:{get current(){return a.value},set current(t){var n=a.value;n!==t&&(a.value=t,a.callback(t,n))}}}})[0];return a.callback=e,a.facade}var bW=typeof window<"u"?C.useLayoutEffect:C.useEffect,Tv=new WeakMap;function mW(r,e){var a=hW(null,function(t){return r.forEach(function(n){return pc(n,t)})});return bW(function(){var t=Tv.get(a);if(t){var n=new Set(t),i=new Set(r),o=a.current;n.forEach(function(A){i.has(A)||pc(A,null)}),i.forEach(function(A){n.has(A)||pc(A,o)})}Tv.set(a,r)},[r]),a}function vW(r){return r}function gW(r,e){e===void 0&&(e=vW);var a=[],t=!1,n={read:function(){if(t)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return a.length?a[a.length-1]:r},useMedium:function(i){var o=e(i,t);return a.push(o),function(){a=a.filter(function(A){return A!==o})}},assignSyncMedium:function(i){for(t=!0;a.length;){var o=a;a=[],o.forEach(i)}a={push:function(A){return i(A)},filter:function(){return a}}},assignMedium:function(i){t=!0;var o=[];if(a.length){var A=a;a=[],A.forEach(i),o=a}var s=function(){var l=o;o=[],l.forEach(i)},u=function(){return Promise.resolve().then(s)};u(),a={push:function(l){o.push(l),u()},filter:function(l){return o=o.filter(l),a}}}};return n}function pW(r){r===void 0&&(r={});var e=gW(null);return e.options=Ya({async:!0,ssr:!1},r),e}var $v=function(r){var e=r.sideCar,a=Wv(r,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var t=e.read();if(!t)throw new Error("Sidecar medium not found");return C.createElement(t,Ya({},a))};$v.isSideCarExport=!0;function yW(r,e){return r.useMedium(e),$v}var Pv=pW(),yc=function(){},tf=C.forwardRef(function(r,e){var a=C.useRef(null),t=C.useState({onScrollCapture:yc,onWheelCapture:yc,onTouchMoveCapture:yc}),n=t[0],i=t[1],o=r.forwardProps,A=r.children,s=r.className,u=r.removeScrollBar,l=r.enabled,c=r.shards,h=r.sideCar,d=r.noRelative,g=r.noIsolation,b=r.inert,v=r.allowPinchZoom,_=r.as,E=_===void 0?"div":_,I=r.gapMode,Z=Wv(r,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,M=mW([a,e]),G=Ya(Ya({},Z),n);return C.createElement(C.Fragment,null,l&&C.createElement(k,{sideCar:Pv,removeScrollBar:u,shards:c,noRelative:d,noIsolation:g,inert:b,setCallbacks:i,allowPinchZoom:!!v,lockRef:a,gapMode:I}),o?C.cloneElement(C.Children.only(A),Ya(Ya({},G),{ref:M})):C.createElement(E,Ya({},G,{className:s,ref:M}),A))});tf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},tf.classNames={fullWidth:af,zeroRight:ef};var wW=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function kW(){if(!document)return null;var r=document.createElement("style");r.type="text/css";var e=wW();return e&&r.setAttribute("nonce",e),r}function EW(r,e){r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}function CW(r){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(r)}var _W=function(){var r=0,e=null;return{add:function(a){r==0&&(e=kW())&&(EW(e,a),CW(e)),r++},remove:function(){r--,!r&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},IW=function(){var r=_W();return function(e,a){C.useEffect(function(){return r.add(e),function(){r.remove()}},[e&&a])}},Ov=function(){var r=IW(),e=function(a){var t=a.styles,n=a.dynamic;return r(t,n),null};return e},BW={left:0,top:0,right:0,gap:0},wc=function(r){return parseInt(r||"",10)||0},NW=function(r){var e=window.getComputedStyle(document.body),a=e[r==="padding"?"paddingLeft":"marginLeft"],t=e[r==="padding"?"paddingTop":"marginTop"],n=e[r==="padding"?"paddingRight":"marginRight"];return[wc(a),wc(t),wc(n)]},xW=function(r){if(r===void 0&&(r="margin"),typeof window>"u")return BW;var e=NW(r),a=document.documentElement.clientWidth,t=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,t-a+e[2]-e[0])}},ZW=Ov(),si="data-scroll-locked",FW=function(r,e,a,t){var n=r.left,i=r.top,o=r.right,A=r.gap;return a===void 0&&(a="margin"),`
172
172
  .`.concat(cW,` {
173
173
  overflow: hidden `).concat(t,`;
174
174
  padding-right: `).concat(A,"px ").concat(t,`;
@@ -18,6 +18,6 @@ export declare class ImageValidator {
18
18
  private getOCRWorker;
19
19
  private loadFaceDetector;
20
20
  validateFace(source: HTMLCanvasElement | File): Promise<ValidationResult>;
21
- validateIdCard(source: HTMLCanvasElement | File, documentType: documentIds): Promise<ValidationResult>;
21
+ validateIdCard(source: HTMLCanvasElement | File | string, documentType: documentIds): Promise<ValidationResult>;
22
22
  }
23
23
  export declare const validator: ImageValidator;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A modern React component library for KYC",
5
5
  "author": "TechLabi",
6
- "version": "0.51.0-beta.2",
6
+ "version": "0.51.0",
7
7
  "type": "module",
8
8
  "types": "dist/types/index.d.ts",
9
9
  "style": "dist/style.css",