@richard.fadiora/liveness-detection 3.1.0 → 4.0.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/README.md +56 -10
- package/dist/index.es.js +2720 -3327
- package/dist/index.umd.js +3 -32
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,44 +1,15 @@
|
|
|
1
|
-
(function(ze,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react"),require("react-webcam")):typeof define=="function"&&define.amd?define(["exports","react","react-webcam"],N):(ze=typeof globalThis<"u"?globalThis:ze||self,N(ze.LivenessSDK={},ze.React,ze.Webcam))})(this,function(ze,N,D2){"use strict";var Wt=typeof self<"u"?self:{};function Ar(e,t){e:{for(var r=["CLOSURE_FLAGS"],n=Wt,s=0;s<r.length;s++)if((n=n[r[s]])==null){r=null;break e}r=n}return(e=r&&r[e])!=null?e:t}function St(){throw Error("Invalid UTF8")}function gi(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}let Jr,Bn;const j2=typeof TextDecoder<"u";let B2;const U2=typeof TextEncoder<"u";function mi(e){if(U2)e=(B2||(B2=new TextEncoder)).encode(e);else{let r=0;const n=new Uint8Array(3*e.length);for(let s=0;s<e.length;s++){var t=e.charCodeAt(s);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&s<e.length){const i=e.charCodeAt(++s);if(i>=56320&&i<=57343){t=1024*(t-55296)+i-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}s--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}function vi(e){Wt.setTimeout(()=>{throw e},0)}var Un,V2=Ar(610401301,!1),yi=Ar(748402147,!0),Vn=Ar(824648567,!0),Gn=Ar(824656860,Ar(1,!0));function _i(){var e=Wt.navigator;return e&&(e=e.userAgent)?e:""}const bi=Wt.navigator;function $r(e){return $r[" "](e),e}Un=bi&&bi.userAgentData||null,$r[" "]=function(){};const wi={};let kr=null;function G2(e){const t=e.length;let r=3*t/4;r%3?r=Math.floor(r):"=.".indexOf(e[t-1])!=-1&&(r="=.".indexOf(e[t-2])!=-1?r-2:r-1);const n=new Uint8Array(r);let s=0;return function(i,o){function c(f){for(;u<i.length;){const h=i.charAt(u++),d=kr[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return f}Ei();let u=0;for(;;){const f=c(-1),h=c(0),d=c(64),b=c(64);if(b===64&&f===-1)break;o(f<<2|h>>4),d!=64&&(o(h<<4&240|d>>2),b!=64&&o(d<<6&192|b))}}(e,function(i){n[s++]=i}),s!==r?n.subarray(0,s):n}function Ei(){if(!kr){kr={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){const n=e.concat(t[r].split(""));wi[r]=n;for(let s=0;s<n.length;s++){const i=n[s];kr[i]===void 0&&(kr[i]=s)}}}}var W2=typeof Uint8Array<"u",Ai=!(!(V2&&Un&&Un.brands.length>0)&&(_i().indexOf("Trident")!=-1||_i().indexOf("MSIE")!=-1))&&typeof btoa=="function";const ki=/[-_.]/g,H2={"-":"+",_:"/",".":"="};function K2(e){return H2[e]||""}function Si(e){if(!Ai)return G2(e);e=ki.test(e)?e.replace(ki,K2):e,e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function Wn(e){return W2&&e!=null&&e instanceof Uint8Array}var Ht={};function Tt(){return z2||(z2=new Ye(null,Ht))}function Hn(e){Ti(Ht);var t=e.g;return(t=t==null||Wn(t)?t:typeof t=="string"?Si(t):null)==null?t:e.g=t}var Ye=class{h(){return new Uint8Array(Hn(this)||0)}constructor(e,t){if(Ti(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}};let z2,Y2;function Ti(e){if(e!==Ht)throw Error("illegal external caller")}function Li(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Kn(e){return Li(e=Error(e),"warning"),e}function Kt(e,t){if(e!=null){var r=Y2??(Y2={}),n=r[e]||0;n>=t||(r[e]=n+1,Li(e=Error(),"incident"),vi(e))}}function zt(){return typeof BigInt=="function"}var Yt=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Xe(e,t,r=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?r&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t}var X2=Xe("jas",void 0,!0),Oi=Xe(void 0,"0di"),Sr=Xe(void 0,"1oa"),Ee=Xe(void 0,Symbol()),q2=Xe(void 0,"0ub"),J2=Xe(void 0,"0ubs"),zn=Xe(void 0,"0ubsb"),$2=Xe(void 0,"0actk"),Xt=Xe("m_m","Pa",!0),Pi=Xe();const Ri={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Fi=Object.defineProperties,m=Yt?X2:"Ga";var Lt;const xi=[];function Tr(e,t){Yt||m in e||Fi(e,Ri),e[m]|=t}function ee(e,t){Yt||m in e||Fi(e,Ri),e[m]=t}function Lr(e){return Tr(e,34),e}function Or(e){return Tr(e,8192),e}ee(xi,7),Lt=Object.freeze(xi);var qt={};function Ae(e,t){return t===void 0?e.h!==Ot&&!!(2&(0|e.v[m])):!!(2&t)&&e.h!==Ot}const Ot={};function Yn(e,t){if(e!=null){if(typeof e=="string")e=e?new Ye(e,Ht):Tt();else if(e.constructor!==Ye)if(Wn(e))e=e.length?new Ye(new Uint8Array(e),Ht):Tt();else{if(!t)throw Error();e=void 0}}return e}class Mi{constructor(t,r,n){this.g=t,this.h=r,this.l=n}next(){const t=this.g.next();return t.done||(t.value=this.h.call(this.l,t.value)),t}[Symbol.iterator](){return this}}var Z2=Object.freeze({});function Ii(e,t,r){const n=128&t?0:-1,s=e.length;var i;(i=!!s)&&(i=(i=e[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(t=128&t?1:0;t<o;t++)r(t-n,e[t]);if(i){e=e[s-1];for(const c in e)!isNaN(c)&&r(+c,e[c])}}var Ci={};function Jt(e){return 128&e?Ci:void 0}function Zr(e){return e.Na=!0,e}var Q2=Zr(e=>typeof e=="number"),Ni=Zr(e=>typeof e=="string"),e1=Zr(e=>typeof e=="boolean"),Qr=typeof Wt.BigInt=="function"&&typeof Wt.BigInt(0)=="bigint";function ke(e){var t=e;if(Ni(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(Q2(t)&&!Number.isSafeInteger(t))throw Error(String(t));return Qr?BigInt(e):e=e1(e)?e?"1":"0":Ni(e)?e.trim()||"0":String(e)}var Xn=Zr(e=>Qr?e>=r1&&e<=s1:e[0]==="-"?Di(e,t1):Di(e,n1));const t1=Number.MIN_SAFE_INTEGER.toString(),r1=Qr?BigInt(Number.MIN_SAFE_INTEGER):void 0,n1=Number.MAX_SAFE_INTEGER.toString(),s1=Qr?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Di(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){const n=e[r],s=t[r];if(n>s)return!1;if(n<s)return!0}}const i1=typeof Uint8Array.prototype.slice=="function";let o1,U=0,q=0;function ji(e){const t=e>>>0;U=t,q=(e-t)/4294967296>>>0}function $t(e){if(e<0){ji(-e);const[t,r]=Qn(U,q);U=t>>>0,q=r>>>0}else ji(e)}function qn(e){const t=o1||(o1=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),q=0,U=t.getUint32(0,!0)}function Jn(e,t){const r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Pr(e,t)}function a1(e,t){return ke(zt()?BigInt.asUintN(64,(BigInt(t>>>0)<<BigInt(32))+BigInt(e>>>0)):Pr(e,t))}function $n(e,t){const r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Jn(e,t))=="number"?r?-e:e:r?"-"+e:e}function Bi(e,t){return zt()?ke(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(t))<<BigInt(32))+BigInt.asUintN(32,BigInt(e)))):ke(Zn(e,t))}function Pr(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else zt()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Ui(r)+Ui(e));return r}function Ui(e){return e=String(e),"0000000".slice(e.length)+e}function Zn(e,t){if(2147483648&t)if(zt())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{const[r,n]=Qn(e,t);e="-"+Pr(r,n)}else e=Pr(e,t);return e}function en(e){if(e.length<16)$t(Number(e));else if(zt())e=BigInt(e),U=Number(e&BigInt(4294967295))>>>0,q=Number(e>>BigInt(32)&BigInt(4294967295));else{const t=+(e[0]==="-");q=U=0;const r=e.length;for(let n=t,s=(r-t)%6+t;s<=r;n=s,s+=6){const i=Number(e.slice(n,s));q*=1e6,U=1e6*U+i,U>=4294967296&&(q+=Math.trunc(U/4294967296),q>>>=0,U>>>=0)}if(t){const[n,s]=Qn(U,q);U=n,q=s}}}function Qn(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Ge(e){return Array.prototype.slice.call(e)}const Rr=typeof BigInt=="function"?BigInt.asIntN:void 0,c1=typeof BigInt=="function"?BigInt.asUintN:void 0,Pt=Number.isSafeInteger,tn=Number.isFinite,Zt=Math.trunc,u1=ke(0);function Fr(e){if(e!=null&&typeof e!="number")throw Error(`Value of float/double field must be a number, found ${typeof e}: ${e}`);return e}function qe(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function xr(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}function Vi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}const h1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Mr(e){switch(typeof e){case"bigint":return!0;case"number":return tn(e);case"string":return h1.test(e);default:return!1}}function Qt(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return tn(e)?0|e:void 0}function Gi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return tn(e)?e>>>0:void 0}function Wi(e){const t=e.length;return(e[0]==="-"?t<20||t===20&&e<="-9223372036854775808":t<19||t===19&&e<="9223372036854775807")?e:(en(e),Zn(U,q))}function es(e){return e=Zt(e),Pt(e)||($t(e),e=$n(U,q)),e}function Hi(e){var t=Zt(Number(e));return Pt(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Wi(e))}function Ki(e){var t=Zt(Number(e));return Pt(t)?ke(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),zt()?ke(Rr(64,BigInt(e))):ke(Wi(e)))}function zi(e){return Pt(e)?e=ke(es(e)):(e=Zt(e),Pt(e)?e=String(e):($t(e),e=Zn(U,q)),e=ke(e)),e}function l1(e){return e==null?e:typeof e=="bigint"?(Xn(e)?e=Number(e):(e=Rr(64,e),e=Xn(e)?Number(e):String(e)),e):Mr(e)?typeof e=="number"?es(e):Hi(e):void 0}function rn(e){const t=typeof e;return e==null?e:t==="bigint"?ke(Rr(64,e)):Mr(e)?t==="string"?Ki(e):zi(e):void 0}function Yi(e){if(typeof e!="string")throw Error();return e}function Ir(e){if(e!=null&&typeof e!="string")throw Error();return e}function ce(e){return e==null||typeof e=="string"?e:void 0}function ts(e,t,r,n){return e!=null&&e[Xt]===qt?e:Array.isArray(e)?((n=(r=0|e[m])|32&n|2&n)!==r&&ee(e,n),new t(e)):(r?2&n?((e=t[Oi])||(Lr((e=new t).v),e=t[Oi]=e),t=e):t=new t:t=void 0,t)}function f1(e,t,r){if(t)e:{if(!Mr(t=e))throw Kn("int64");switch(typeof t){case"string":t=Ki(t);break e;case"bigint":t=ke(Rr(64,t));break e;default:t=zi(t)}}else t=rn(e);return(e=t)==null?r?u1:void 0:e}const d1={};let p1=function(){try{return $r(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class rs{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,r){return this.g.set(t,r),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,r){return this.g.forEach(t,r)}[Symbol.iterator](){return this.entries()}}const g1=p1?(Object.setPrototypeOf(rs.prototype,Map.prototype),Object.defineProperties(rs.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),rs):class extends Map{constructor(){super()}};function Xi(e){return e}function ns(e){if(2&e.J)throw Error("Cannot mutate an immutable Map")}var it=class extends g1{constructor(e,t,r=Xi,n=Xi){super(),this.J=0|e[m],this.K=t,this.S=r,this.fa=this.K?m1:n;for(let s=0;s<e.length;s++){const i=e[s],o=r(i[0],!1,!0);let c=i[1];t?c===void 0&&(c=null):c=n(i[1],!1,!0,void 0,void 0,this.J),super.set(o,c)}}V(e){return Or(Array.from(super.entries(),e))}clear(){ns(this),super.clear()}delete(e){return ns(this),super.delete(this.S(e,!0,!1))}entries(){if(this.K){var e=super.keys();e=new Mi(e,v1,this)}else e=super.entries();return e}values(){if(this.K){var e=super.keys();e=new Mi(e,it.prototype.get,this)}else e=super.values();return e}forEach(e,t){this.K?super.forEach((r,n,s)=>{e.call(t,s.get(n),n,s)}):super.forEach(e,t)}set(e,t){return ns(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.fa(t,!0,!0,this.K,!1,this.J))}Ma(e){const t=this.S(e[0],!1,!0);e=e[1],e=this.K?e===void 0?null:e:this.fa(e,!1,!0,void 0,!1,this.J),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);const t=super.get(e);if(t!==void 0){var r=this.K;return r?((r=this.fa(t,!1,!0,r,this.ra,this.J))!==t&&super.set(e,r),r):t}}[Symbol.iterator](){return this.entries()}};function m1(e,t,r,n,s,i){return e=ts(e,n,r,i),s&&(e=os(e)),e}function v1(e){return[e,this.get(e)]}let y1;function qi(){return y1||(y1=new it(Lr([]),void 0,void 0,void 0,d1))}function nn(e){return Ee?e[Ee]:void 0}function sn(e,t){for(const r in e)!isNaN(r)&&t(e,+r,e[r])}it.prototype.toJSON=void 0;var ss=class{};const _1={Ka:!0};function b1(e,t){t<100||Kt(J2,1)}function on(e,t,r,n){const s=n!==void 0;n=!!n;var i,o=Ee;!s&&Yt&&o&&(i=e[o])&&sn(i,b1),o=[];var c=e.length;let u;i=4294967295;let f=!1;const h=!!(64&t),d=h?128&t?0:-1:void 0;1&t||(u=c&&e[c-1],u!=null&&typeof u=="object"&&u.constructor===Object?i=--c:u=void 0,!h||128&t||s||(f=!0,i=i-d+d)),t=void 0;for(var b=0;b<c;b++){let A=e[b];if(A!=null&&(A=r(A,n))!=null)if(h&&b>=i){const R=b-d;(t??(t={}))[R]=A}else o[b]=A}if(u)for(let A in u){if((c=u[A])==null||(c=r(c,n))==null)continue;let R;b=+A,h&&!Number.isNaN(b)&&(R=b+d)<i?o[R]=c:(t??(t={}))[A]=c}return t&&(f?o.push(t):o[i]=t),s&&Ee&&(e=nn(e))&&e instanceof ss&&(o[Ee]=function(A){const R=new ss;return sn(A,(Ut,Me,ue)=>{R[Me]=Ge(ue)}),R.da=A.da,R}(e)),o}function w1(e){return e[0]=Cr(e[0]),e[1]=Cr(e[1]),e}function Cr(e){switch(typeof e){case"number":return Number.isFinite(e)?e:""+e;case"bigint":return Xn(e)?Number(e):""+e;case"boolean":return e?1:0;case"object":if(Array.isArray(e)){var t=0|e[m];return e.length===0&&1&t?void 0:on(e,t,Cr)}if(e!=null&&e[Xt]===qt)return Ji(e);if(e instanceof Ye){if((t=e.g)==null)e="";else if(typeof t=="string")e=t;else{if(Ai){for(var r="",n=0,s=t.length-10240;n<s;)r+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));r+=String.fromCharCode.apply(null,n?t.subarray(n):t),t=btoa(r)}else{r===void 0&&(r=0),Ei(),r=wi[r],n=Array(Math.floor(t.length/3)),s=r[64]||"";let f=0,h=0;for(;f<t.length-2;f+=3){var i=t[f],o=t[f+1],c=t[f+2],u=r[i>>2];i=r[(3&i)<<4|o>>4],o=r[(15&o)<<2|c>>6],c=r[63&c],n[h++]=u+i+o+c}switch(u=0,c=s,t.length-f){case 2:c=r[(15&(u=t[f+1]))<<2]||s;case 1:t=t[f],n[h]=r[t>>2]+r[(3&t)<<4|u>>4]+c+s}t=n.join("")}e=e.g=t}return e}return e instanceof it?e=e.size!==0?e.V(w1):void 0:void 0}return e}function Ji(e){return on(e=e.v,0|e[m],Cr)}let E1,A1;function Rt(e,t){return $i(e,t[0],t[1])}function $i(e,t,r,n=0){if(e==null){var s=32;r?(e=[r],s|=128):e=[],t&&(s=-16760833&s|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(s=0|e[m],yi&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(yi)throw Error("carr");Kt($2,5)}(),256&s)throw Error("farr");if(64&s)return(s|n)!==s&&ee(e,s|n),e;if(r&&(s|=128,r!==e[0]))throw Error("mid");e:{s|=64;var i=(r=e).length;if(i){var o=i-1;const u=r[o];if(u!=null&&typeof u=="object"&&u.constructor===Object){if((o-=t=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var c in u)(i=+c)<o&&(r[i+t]=u[c],delete u[c]);s=-16760833&s|(1023&o)<<14;break e}}if(t){if((c=Math.max(t,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&c)<<14}}}return ee(e,64|s|n),e}function k1(e,t){if(typeof e!="object")return e;if(Array.isArray(e)){var r=0|e[m];return e.length===0&&1&r?void 0:Zi(e,r,t)}if(e!=null&&e[Xt]===qt)return Qi(e);if(e instanceof it){if(2&(t=e.J))return e;if(!e.size)return;if(r=Lr(e.V()),e.K)for(e=0;e<r.length;e++){const n=r[e];let s=n[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[Xt]===qt?Qi(s):Array.isArray(s)?Zi(s,0|s[m],!!(32&t)):void 0,n[1]=s}return r}return e instanceof Ye?e:void 0}function Zi(e,t,r){return 2&t||(!r||4096&t||16&t?e=er(e,t,!1,r&&!(16&t)):(Tr(e,34),4&t&&Object.freeze(e))),e}function is(e,t,r){return e=new e.constructor(t),r&&(e.h=Ot),e.m=Ot,e}function Qi(e){const t=e.v,r=0|t[m];return Ae(e,r)?e:as(e,t,r)?is(e,t):er(t,r)}function er(e,t,r,n){return n??(n=!!(34&t)),e=on(e,t,k1,n),n=32,r&&(n|=2),ee(e,t=16769217&t|n),e}function os(e){const t=e.v,r=0|t[m];return Ae(e,r)?as(e,t,r)?is(e,t,!0):new e.constructor(er(t,r,!1)):e}function tr(e){if(e.h!==Ot)return!1;var t=e.v;return Tr(t=er(t,0|t[m]),2048),e.v=t,e.h=void 0,e.m=void 0,!0}function rr(e){if(!tr(e)&&Ae(e,0|e.v[m]))throw Error()}function Ft(e,t){t===void 0&&(t=0|e[m]),32&t&&!(4096&t)&&ee(e,4096|t)}function as(e,t,r){return!!(2&r)||!(!(32&r)||4096&r)&&(ee(t,2|r),e.h=Ot,!0)}const S1=ke(0),gt={};function D(e,t,r,n,s){if((t=ot(e.v,t,r,s))!==null||n&&e.m!==Ot)return t}function ot(e,t,r,n){if(t===-1)return null;const s=t+(r?0:-1),i=e.length-1;let o,c;if(!(i<1+(r?0:-1))){if(s>=i)if(o=e[i],o!=null&&typeof o=="object"&&o.constructor===Object)r=o[t],c=!0;else{if(s!==i)return;r=o}else r=e[s];if(n&&r!=null){if((n=n(r))==null)return n;if(!Object.is(n,r))return c?o[t]=n:e[s]=n,n}return r}}function x(e,t,r,n){rr(e),te(e=e.v,0|e[m],t,r,n)}function te(e,t,r,n,s){const i=r+(s?0:-1);var o=e.length-1;if(o>=1+(s?0:-1)&&i>=o){const c=e[o];if(c!=null&&typeof c=="object"&&c.constructor===Object)return c[r]=n,t}return i<=o?(e[i]=n,t):(n!==void 0&&(r>=(o=(t??(t=0|e[m]))>>14&1023||536870912)?n!=null&&(e[o+(s?0:-1)]={[r]:n}):e[i]=n),t)}function xt(){return Z2===void 0?2:4}function Mt(e,t,r,n,s){let i=e.v,o=0|i[m];n=Ae(e,o)?1:n,s=!!s||n===3,n===2&&tr(e)&&(i=e.v,o=0|i[m]);let c=(e=cs(i,t))===Lt?7:0|e[m],u=us(c,o);var f=!(4&u);if(f){4&u&&(e=Ge(e),c=0,u=Ct(u,o),o=te(i,o,t,e));let h=0,d=0;for(;h<e.length;h++){const b=r(e[h]);b!=null&&(e[d++]=b)}d<h&&(e.length=d),r=-513&(4|u),u=r&=-1025,u&=-4097}return u!==c&&(ee(e,u),2&u&&Object.freeze(e)),eo(e,u,i,o,t,n,f,s)}function eo(e,t,r,n,s,i,o,c){let u=t;return i===1||i===4&&(2&t||!(16&t)&&32&n)?It(t)||((t|=!e.length||o&&!(4096&t)||32&n&&!(4096&t||16&t)?2:256)!==u&&ee(e,t),Object.freeze(e)):(i===2&&It(t)&&(e=Ge(e),u=0,t=Ct(t,n),n=te(r,n,s,e)),It(t)||(c||(t|=16),t!==u&&ee(e,t))),2&t||!(4096&t||16&t)||Ft(r,n),e}function cs(e,t,r){return e=ot(e,t,r),Array.isArray(e)?e:Lt}function us(e,t){return 2&t&&(e|=2),1|e}function It(e){return!!(2&e)&&!!(4&e)||!!(256&e)}function to(e){return Yn(e,!0)}function ro(e){e=Ge(e);for(let t=0;t<e.length;t++){const r=e[t]=Ge(e[t]);Array.isArray(r[1])&&(r[1]=Lr(r[1]))}return Or(e)}function mt(e,t,r,n){rr(e),te(e=e.v,0|e[m],t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function nr(e,t,r){if(2&t)throw Error();const n=Jt(t);let s=cs(e,r,n),i=s===Lt?7:0|s[m],o=us(i,t);return(2&o||It(o)||16&o)&&(o===i||It(o)||ee(s,o),s=Ge(s),i=0,o=Ct(o,t),te(e,t,r,s,n)),o&=-13,o!==i&&ee(s,o),s}function hs(e,t){var r=ua;return fs(ls(e=e.v),e,void 0,r)===t?t:-1}function ls(e){if(Yt)return e[Sr]??(e[Sr]=new Map);if(Sr in e)return e[Sr];const t=new Map;return Object.defineProperty(e,Sr,{value:t}),t}function no(e,t,r,n,s){const i=ls(e),o=fs(i,e,t,r,s);return o!==n&&(o&&(t=te(e,t,o,void 0,s)),i.set(r,n)),t}function fs(e,t,r,n,s){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){const c=n[o];ot(t,c,s)!=null&&(i!==0&&(r=te(t,r,i,void 0,s)),i=c)}return e.set(n,i),i}function ds(e,t,r){let n=0|e[m];const s=Jt(n),i=ot(e,r,s);let o;if(i!=null&&i[Xt]===qt){if(!Ae(i))return tr(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const c=0|o[m];2&c&&(o=er(o,c))}return o=Rt(o,t),o!==i&&te(e,n,r,o,s),o}function so(e,t,r,n,s){let i=!1;if((n=ot(e,n,s,o=>{const c=ts(o,r,!1,t);return i=c!==o&&c!=null,c}))!=null)return i&&!Ae(n)&&Ft(e,t),n}function O(e,t,r,n){let s=e.v,i=0|s[m];if((t=so(s,i,t,r,n))==null)return t;if(i=0|s[m],!Ae(e,i)){const o=os(t);o!==t&&(tr(e)&&(s=e.v,i=0|s[m]),i=te(s,i,r,t=o,n),Ft(s,i))}return t}function io(e,t,r,n,s,i,o,c){var u=Ae(e,r);i=u?1:i,o=!!o||i===3,u=c&&!u,(i===2||u)&&tr(e)&&(r=0|(t=e.v)[m]);var f=(e=cs(t,s))===Lt?7:0|e[m],h=us(f,r);if(c=!(4&h)){var d=e,b=r;const A=!!(2&h);A&&(b|=2);let R=!A,Ut=!0,Me=0,ue=0;for(;Me<d.length;Me++){const Y=ts(d[Me],n,!1,b);if(Y instanceof n){if(!A){const lt=Ae(Y);R&&(R=!lt),Ut&&(Ut=lt)}d[ue++]=Y}}ue<Me&&(d.length=ue),h|=4,h=Ut?-4097&h:4096|h,h=R?8|h:-9&h}if(h!==f&&(ee(e,h),2&h&&Object.freeze(e)),u&&!(8&h||!e.length&&(i===1||i===4&&(2&h||!(16&h)&&32&r)))){for(It(h)&&(e=Ge(e),h=Ct(h,r),r=te(t,r,s,e)),n=e,u=h,f=0;f<n.length;f++)(d=n[f])!==(h=os(d))&&(n[f]=h);u|=8,ee(e,h=u=n.length?4096|u:-4097&u)}return eo(e,h,t,r,s,i,c,o)}function at(e,t,r){const n=e.v;return io(e,n,0|n[m],t,r,xt(),!1,!0)}function oo(e){return e==null&&(e=void 0),e}function w(e,t,r,n,s){return x(e,r,n=oo(n),s),n&&!Ae(n)&&Ft(e.v),e}function Nr(e,t,r,n){e:{var s=n=oo(n);rr(e);const i=e.v;let o=0|i[m];if(s==null){const c=ls(i);if(fs(c,i,o,r)!==t)break e;c.set(r,0)}else o=no(i,o,r,t);te(i,o,t,s)}n&&!Ae(n)&&Ft(e.v)}function Ct(e,t){return-273&(2&t?2|e:-3&e)}function ps(e,t,r,n){var s=n;rr(e),e=io(e,n=e.v,0|n[m],r,t,2,!0),s=s??new r,e.push(s),t=r=e===Lt?7:0|e[m],(s=Ae(s))?(r&=-9,e.length===1&&(r&=-4097)):r|=4096,r!==t&&ee(e,r),s||Ft(n)}function Ie(e,t,r){return Qt(D(e,t,void 0,r))}function ao(e){return(Gn?D(e,2,void 0,void 0,rn):rn(D(e,2)))??S1}function H(e,t){return D(e,t,void 0,void 0,qe)??0}function ct(e,t,r){if(r!=null){if(typeof r!="number"||!tn(r))throw Kn("int32");r|=0}x(e,t,r)}function _(e,t,r){x(e,t,Fr(r))}function Se(e,t,r){mt(e,t,Ir(r),"")}function an(e,t,r){{rr(e);const o=e.v;let c=0|o[m];if(r==null)te(o,c,t);else{var n=e=r===Lt?7:0|r[m],s=It(e),i=s||Object.isFrozen(r);for(s||(e=0),i||(r=Ge(r),n=0,e=Ct(e,c),i=!1),e|=5,e|=(4&e?512&e?512:1024&e?1024:0:void 0)??(Gn?1024:0),s=0;s<r.length;s++){const u=r[s],f=Yi(u);Object.is(u,f)||(i&&(r=Ge(r),n=0,e=Ct(e,c),i=!1),r[s]=f)}e!==n&&(i&&(r=Ge(r),e=Ct(e,c)),ee(r,e)),te(o,c,t,r)}}}function cn(e,t,r){rr(e),Mt(e,t,ce,2,!0).push(Yi(r))}var sr=class{constructor(e,t,r){if(this.buffer=e,r&&!t)throw Error();this.g=t}};function gs(e,t){if(typeof e=="string")return new sr(Si(e),t);if(Array.isArray(e))return new sr(new Uint8Array(e),t);if(e.constructor===Uint8Array)return new sr(e,!1);if(e.constructor===ArrayBuffer)return e=new Uint8Array(e),new sr(e,!1);if(e.constructor===Ye)return t=Hn(e)||new Uint8Array(0),new sr(t,!0,e);if(e instanceof Uint8Array)return e=e.constructor===Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new sr(e,!1);throw Error()}function ir(e,t){let r,n=0,s=0,i=0;const o=e.h;let c=e.g;do r=o[c++],n|=(127&r)<<i,i+=7;while(i<32&&128&r);if(i>32)for(s|=(127&r)>>4,i=3;i<32&&128&r;i+=7)r=o[c++],s|=(127&r)<<i;if(Nt(e,c),!(128&r))return t(n>>>0,s>>>0);throw Error()}function ms(e){let t=0,r=e.g;const n=r+10,s=e.h;for(;r<n;){const i=s[r++];if(t|=i,(128&i)==0)return Nt(e,r),!!(127&t)}throw Error()}function vt(e){const t=e.h;let r=e.g,n=t[r++],s=127&n;if(128&n&&(n=t[r++],s|=(127&n)<<7,128&n&&(n=t[r++],s|=(127&n)<<14,128&n&&(n=t[r++],s|=(127&n)<<21,128&n&&(n=t[r++],s|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Error();return Nt(e,r),s}function ut(e){return vt(e)>>>0}function un(e){var t=e.h;const r=e.g;var n=t[r],s=t[r+1];const i=t[r+2];return t=t[r+3],Nt(e,e.g+4),e=2*((s=(n<<0|s<<8|i<<16|t<<24)>>>0)>>31)+1,n=s>>>23&255,s&=8388607,n==255?s?NaN:e*(1/0):n==0?1401298464324817e-60*e*s:e*Math.pow(2,n-150)*(s+8388608)}function T1(e){return vt(e)}function Nt(e,t){if(e.g=t,t>e.l)throw Error()}function co(e,t){if(t<0)throw Error();const r=e.g;if((t=r+t)>e.l)throw Error();return e.g=t,r}function uo(e,t){if(t==0)return Tt();var r=co(e,t);return e.Y&&e.j?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):i1?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Tt():new Ye(r,Ht)}var ho=[];function lo(e,t,r,n){if(fn.length){const s=fn.pop();return s.o(n),s.g.init(e,t,r,n),s}return new L1(e,t,r,n)}function fo(e){e.g.clear(),e.l=-1,e.h=-1,fn.length<100&&fn.push(e)}function po(e){var t=e.g;if(t.g==t.l)return!1;e.m=e.g.g;var r=ut(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5)||t<1)throw Error();return e.l=t,e.h=r,!0}function hn(e){switch(e.h){case 0:e.h!=0?hn(e):ms(e.g);break;case 1:Nt(e=e.g,e.g+8);break;case 2:if(e.h!=2)hn(e);else{var t=ut(e.g);Nt(e=e.g,e.g+t)}break;case 5:Nt(e=e.g,e.g+4);break;case 3:for(t=e.l;;){if(!po(e))throw Error();if(e.h==4){if(e.l!=t)throw Error();break}hn(e)}break;default:throw Error()}}function Dr(e,t,r){const n=e.g.l;var s=ut(e.g);let i=(s=e.g.g+s)-n;if(i<=0&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error();return e.g.g=s,e.g.l=n,t}function vs(e){var t=ut(e.g),r=co(e=e.g,t);if(e=e.h,j2){var n,s=e;(n=Bn)||(n=Bn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,s=r===0&&t===s.length?s:s.subarray(r,t);try{var i=n.decode(s)}catch(c){if(Jr===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Jr=!0}catch{Jr=!1}}throw!Jr&&(Bn=void 0),c}}else{t=(i=r)+t,r=[];let c,u=null;for(;i<t;){var o=e[i++];o<128?r.push(o):o<224?i>=t?St():(c=e[i++],o<194||(192&c)!=128?(i--,St()):r.push((31&o)<<6|63&c)):o<240?i>=t-1?St():(c=e[i++],(192&c)!=128||o===224&&c<160||o===237&&c>=160||(192&(n=e[i++]))!=128?(i--,St()):r.push((15&o)<<12|(63&c)<<6|63&n)):o<=244?i>=t-2?St():(c=e[i++],(192&c)!=128||c-144+(o<<28)>>30||(192&(n=e[i++]))!=128||(192&(s=e[i++]))!=128?(i--,St()):(o=(7&o)<<18|(63&c)<<12|(63&n)<<6|63&s,o-=65536,r.push(55296+(o>>10&1023),56320+(1023&o)))):St(),r.length>=8192&&(u=gi(u,r),r.length=0)}i=gi(u,r)}return i}function go(e){const t=ut(e.g);return uo(e.g,t)}function ln(e,t,r){var n=ut(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var L1=class{constructor(e,t,r,n){if(ho.length){const s=ho.pop();s.init(e,t,r,n),e=s}else e=new class{constructor(s,i,o,c){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,c)}init(s,i,o,{Y:c=!1,ea:u=!1}={}){this.Y=c,this.ea=u,s&&(s=gs(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(e,t,r,n);this.g=e,this.m=this.g.g,this.h=this.l=-1,this.o(n)}o({ha:e=!1}={}){this.ha=e}},fn=[];function mo(e){return e?/^\d+$/.test(e)?(en(e),new ys(U,q)):null:O1||(O1=new ys(0,0))}var ys=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let O1;function vo(e){return e?/^-?\d+$/.test(e)?(en(e),new _s(U,q)):null:P1||(P1=new _s(0,0))}var _s=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}};let P1;function or(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ar(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function dn(e,t){if(t>=0)ar(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function bs(e){var t=U;e.g.push(t>>>0&255),e.g.push(t>>>8&255),e.g.push(t>>>16&255),e.g.push(t>>>24&255)}function cr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ce(e,t,r){ar(e.g,8*t+r)}function ws(e,t){return Ce(e,t,2),t=e.g.end(),cr(e,t),t.push(e.h),t}function Es(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function pn(e,t,r){Ce(e,t,2),ar(e.g,r.length),cr(e,e.g.end()),cr(e,r)}function gn(e,t,r,n){r!=null&&(t=ws(e,t),n(r,e),Es(e,t))}function Je(){const e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var As=Je(),yo=Je(),ks=Je(),Ss=Je(),_o=Je(),bo=Je(),R1=Je(),mn=Je(),wo=Je(),Eo=Je();function $e(e,t,r){var n=e.v;Ee&&Ee in n&&(n=n[Ee])&&delete n[t.g],t.h?t.j(e,t.h,t.g,r,t.l):t.j(e,t.g,r,t.l)}var v=class{constructor(e,t){this.v=$i(e,t,void 0,2048)}toJSON(){return Ji(this)}j(){var s;var e=fc,t=this.v,r=e.g,n=Ee;if(Yt&&n&&((s=t[n])==null?void 0:s[r])!=null&&Kt(q2,3),t=e.g,Pi&&Ee&&Pi===void 0&&(n=(r=this.v)[Ee])&&(n=n.da))try{n(r,t,_1)}catch(i){vi(i)}return e.h?e.m(this,e.h,e.g,e.l):e.m(this,e.g,e.defaultValue,e.l)}clone(){const e=this.v,t=0|e[m];return as(this,e,t)?is(this,e,!0):new this.constructor(er(e,t,!1))}};v.prototype[Xt]=qt,v.prototype.toString=function(){return this.v.toString()};var ur=class{constructor(e,t,r){this.g=e,this.h=t,e=As,this.l=!!e&&r===e||!1}};function vn(e,t){return new ur(e,t,As)}function Ao(e,t,r,n,s){gn(e,r,Po(t,n),s)}const F1=vn(function(e,t,r,n,s){return e.h===2&&(Dr(e,ds(t,n,r),s),!0)},Ao),x1=vn(function(e,t,r,n,s){return e.h===2&&(Dr(e,ds(t,n,r),s),!0)},Ao);var yn=Symbol(),_n=Symbol(),Ts=Symbol(),ko=Symbol(),So=Symbol();let To,Lo;function Dt(e,t,r,n){var s=n[e];if(s)return s;(s={}).qa=n,s.T=function(d){switch(typeof d){case"boolean":return E1||(E1=[0,void 0,!0]);case"number":return d>0?void 0:d===0?A1||(A1=[0,void 0]):[-d,void 0];case"string":return[0,d];case"object":return d}}(n[0]);var i=n[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=n[++o])=="function"&&(s.ma=!0,To??(To=i),Lo??(Lo=n[o+1]),i=n[o+=2]));const c={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var u=0;u<i.length;u++)c[i[u]]=i;i=n[++o]}for(u=1;i!==void 0;){let d;typeof i=="number"&&(u+=i,i=n[++o]);var f=void 0;if(i instanceof ur?d=i:(d=F1,o--),d==null?void 0:d.l){i=n[++o],f=n;var h=o;typeof i=="function"&&(i=i(),f[h]=i),f=i}for(h=u+1,typeof(i=n[++o])=="number"&&i<0&&(h-=i,i=n[++o]);u<h;u++){const b=c[u];f?r(s,u,d,f,b):t(s,u,d,b)}}return n[e]=s}function Oo(e){return Array.isArray(e)?e[0]instanceof ur?e:[x1,e]:[e,void 0]}function Po(e,t){return e instanceof v?e.v:Array.isArray(e)?Rt(e,t):void 0}function Ls(e,t,r,n){const s=r.g;e[t]=n?(i,o,c)=>s(i,o,c,n):s}function Os(e,t,r,n,s){const i=r.g;let o,c;e[t]=(u,f,h)=>i(u,f,h,c||(c=Dt(_n,Ls,Os,n).T),o||(o=Ps(n)),s)}function Ps(e){let t=e[Ts];if(t!=null)return t;const r=Dt(_n,Ls,Os,e);return t=r.ma?(n,s)=>To(n,s,r):(n,s)=>{for(;po(s)&&s.h!=4;){var i=s.l,o=r[i];if(o==null){var c=r.ba;c&&(c=c[i])&&(c=I1(c))!=null&&(o=r[i]=c)}if(o==null||!o(s,n,i)){if(o=(c=s).m,hn(c),c.ha)var u=void 0;else u=c.g.g-o,c.g.g=o,u=uo(c.g,u);o=void 0,c=n,u&&((o=c[Ee]??(c[Ee]=new ss))[i]??(o[i]=[])).push(u)}}return(n=nn(n))&&(n.da=r.qa[So]),!0},e[Ts]=t,e[So]=M1.bind(e),t}function M1(e,t,r,n){var s=this[_n];const i=this[Ts],o=Rt(void 0,s.T),c=nn(e);if(c){var u=!1,f=s.ba;if(f){if(s=(h,d,b)=>{if(b.length!==0)if(f[d])for(const A of b){h=lo(A);try{u=!0,i(o,h)}finally{fo(h)}}else n==null||n(e,d,b)},t==null)sn(c,s);else if(c!=null){const h=c[t];h&&s(c,t,h)}if(u){let h=0|e[m];if(2&h&&2048&h&&!(r!=null&&r.Ka))throw Error();const d=Jt(h),b=(A,R)=>{if(ot(e,A,d)!=null){if((r==null?void 0:r.Qa)===1)return;throw Error()}R!=null&&(h=te(e,h,A,R,d)),delete c[A]};t==null?Ii(o,0|o[m],(A,R)=>{b(A,R)}):b(t,ot(o,t,d))}}}}function I1(e){const t=(e=Oo(e))[0].g;if(e=e[1]){const r=Ps(e),n=Dt(_n,Ls,Os,e).T;return(s,i,o)=>t(s,i,o,n,r)}return t}function bn(e,t,r){e[t]=r.h}function wn(e,t,r,n){let s,i;const o=r.h;e[t]=(c,u,f)=>o(c,u,f,i||(i=Dt(yn,bn,wn,n).T),s||(s=Ro(n)))}function Ro(e){let t=e[ko];if(!t){const r=Dt(yn,bn,wn,e);t=(n,s)=>Fo(n,s,r),e[ko]=t}return t}function Fo(e,t,r){Ii(e,0|e[m],(n,s)=>{if(s!=null){var i=function(o,c){var u=o[c];if(u)return u;if((u=o.ba)&&(u=u[c])){var f=(u=Oo(u))[0].h;if(u=u[1]){const h=Ro(u),d=Dt(yn,bn,wn,u).T;u=o.ma?Lo(d,h):(b,A,R)=>f(b,A,R,d,h)}else u=f;return o[c]=u}}(r,n);i?i(t,s,n):n<500||Kt(zn,3)}}),(e=nn(e))&&sn(e,(n,s,i)=>{for(cr(t,t.g.end()),n=0;n<i.length;n++)cr(t,Hn(i[n])||new Uint8Array(0))})}const C1=ke(0);function hr(e,t){if(Array.isArray(t)){var r=0|t[m];if(4&r)return t;for(var n=0,s=0;n<t.length;n++){const i=e(t[n]);i!=null&&(t[s++]=i)}return s<n&&(t.length=s),(e=-1537&(5|r))!==r&&ee(t,e),2&e&&Object.freeze(t),t}}function ge(e,t,r){return new ur(e,t,r)}function lr(e,t,r){return new ur(e,t,r)}function se(e,t,r){te(e,0|e[m],t,r,Jt(0|e[m]))}var N1=vn(function(e,t,r,n,s){if(e.h!==2)return!1;if(e=Ge(e=Dr(e,Rt([void 0,void 0],n),s)),s=Jt(n=0|t[m]),2&n)throw Error();let i=ot(t,r,s);if(i instanceof it)2&i.J?(i=i.V(),i.push(e),te(t,n,r,i,s)):i.Ma(e);else if(Array.isArray(i)){var o=0|i[m];8192&o||ee(i,o|=8192),2&o&&(i=ro(i),te(t,n,r,i,s)),i.push(e)}else te(t,n,r,Or([e]),s);return!0},function(e,t,r,n,s){if(t instanceof it)t.forEach((i,o)=>{gn(e,r,Rt([o,i],n),s)});else if(Array.isArray(t)){for(let i=0;i<t.length;i++){const o=t[i];Array.isArray(o)&&gn(e,r,Rt(o,n),s)}Or(t)}});function xo(e,t,r){(t=qe(t))!=null&&(Ce(e,r,5),e=e.g,qn(t),bs(e))}function Mo(e,t,r){if(t=function(n){if(n==null)return n;const s=typeof n;if(s==="bigint")return String(Rr(64,n));if(Mr(n)){if(s==="string")return Hi(n);if(s==="number")return es(n)}}(t),t!=null&&(typeof t=="string"&&vo(t),t!=null))switch(Ce(e,r,0),typeof t){case"number":e=e.g,$t(t),or(e,U,q);break;case"bigint":r=BigInt.asUintN(64,t),r=new _s(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),or(e.g,r.h,r.g);break;default:r=vo(t),or(e.g,r.h,r.g)}}function Io(e,t,r){(t=Qt(t))!=null&&t!=null&&(Ce(e,r,0),dn(e.g,t))}function Co(e,t,r){(t=Vi(t))!=null&&(Ce(e,r,0),e.g.g.push(t?1:0))}function No(e,t,r){(t=ce(t))!=null&&pn(e,r,mi(t))}function Do(e,t,r,n,s){gn(e,r,Po(t,n),s)}function jo(e,t,r){(t=t==null||typeof t=="string"||t instanceof Ye?t:void 0)!=null&&pn(e,r,gs(t,!0).buffer)}function Bo(e,t,r){return(e.h===5||e.h===2)&&(t=nr(t,0|t[m],r),e.h==2?ln(e,un,t):t.push(un(e.g)),!0)}var J=ge(function(e,t,r){return e.h===5&&(se(t,r,un(e.g)),!0)},xo,mn),D1=lr(Bo,function(e,t,r){if((t=hr(qe,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ce(n,s,5),n=n.g,qn(i),bs(n))}},mn),Rs=lr(Bo,function(e,t,r){if((t=hr(qe,t))!=null&&t.length){Ce(e,r,2),ar(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,qn(t[n]),bs(r)}},mn),j1=ge(function(e,t,r){return e.h===5&&(se(t,r,(e=un(e.g))===0?void 0:e),!0)},xo,mn),yt=ge(function(e,t,r){return Vn?(e.h!==0?e=!1:(se(t,r,ir(e.g,Bi)),e=!0),e):e.h===0&&(se(t,r,ir(e.g,$n)),!0)},Mo,bo),Fs=ge(function(e,t,r){return Vn?(e.h!==0?t=!1:(se(t,r,(e=ir(e.g,Bi))===C1?void 0:e),t=!0),t):e.h===0&&(se(t,r,(e=ir(e.g,$n))===0?void 0:e),!0)},Mo,bo),B1=ge(function(e,t,r){return Vn?(e.h!==0?e=!1:(se(t,r,ir(e.g,a1)),e=!0),e):e.h===0&&(se(t,r,ir(e.g,Jn)),!0)},function(e,t,r){if(t=function(n){if(n==null)return n;var s=typeof n;if(s==="bigint")return String(c1(64,n));if(Mr(n)){if(s==="string")return s=Zt(Number(n)),Pt(s)&&s>=0?n=String(s):((s=n.indexOf("."))!==-1&&(n=n.substring(0,s)),(s=n[0]!=="-"&&((s=n.length)<20||s===20&&n<="18446744073709551615"))||(en(n),n=Pr(U,q))),n;if(s==="number")return(n=Zt(n))>=0&&Pt(n)||($t(n),n=Jn(U,q)),n}}(t),t!=null&&(typeof t=="string"&&mo(t),t!=null))switch(Ce(e,r,0),typeof t){case"number":e=e.g,$t(t),or(e,U,q);break;case"bigint":r=BigInt.asUintN(64,t),r=new ys(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),or(e.g,r.h,r.g);break;default:r=mo(t),or(e.g,r.h,r.g)}},R1),ie=ge(function(e,t,r){return e.h===0&&(se(t,r,vt(e.g)),!0)},Io,Ss),jr=lr(function(e,t,r){return(e.h===0||e.h===2)&&(t=nr(t,0|t[m],r),e.h==2?ln(e,vt,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=hr(Qt,t))!=null&&t.length){r=ws(e,r);for(let n=0;n<t.length;n++)dn(e.g,t[n]);Es(e,r)}},Ss),fr=ge(function(e,t,r){return e.h===0&&(se(t,r,(e=vt(e.g))===0?void 0:e),!0)},Io,Ss),K=ge(function(e,t,r){return e.h===0&&(se(t,r,ms(e.g)),!0)},Co,yo),jt=ge(function(e,t,r){return e.h===0&&(se(t,r,(e=ms(e.g))===!1?void 0:e),!0)},Co,yo),de=lr(function(e,t,r){return e.h===2&&(e=vs(e),nr(t,0|t[m],r).push(e),!0)},function(e,t,r){if((t=hr(ce,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&pn(n,s,mi(i))}},ks),_t=ge(function(e,t,r){return e.h===2&&(se(t,r,(e=vs(e))===""?void 0:e),!0)},No,ks),I=ge(function(e,t,r){return e.h===2&&(se(t,r,vs(e)),!0)},No,ks),oe=function(e,t,r=As){return new ur(e,t,r)}(function(e,t,r,n,s){return e.h===2&&(n=Rt(void 0,n),nr(t,0|t[m],r).push(n),Dr(e,n,s),!0)},function(e,t,r,n,s){if(Array.isArray(t)){for(let i=0;i<t.length;i++)Do(e,t[i],r,n,s);1&(e=0|t[m])||ee(t,1|e)}}),z=vn(function(e,t,r,n,s,i){if(e.h!==2)return!1;let o=0|t[m];return no(t,o,i,r,Jt(o)),Dr(e,t=ds(t,n,r),s),!0},Do),Uo=ge(function(e,t,r){return e.h===2&&(se(t,r,go(e)),!0)},jo,wo),U1=lr(function(e,t,r){return(e.h===0||e.h===2)&&(t=nr(t,0|t[m],r),e.h==2?ln(e,ut,t):t.push(ut(e.g)),!0)},function(e,t,r){if((t=hr(Gi,t))!=null)for(let o=0;o<t.length;o++){var n=e,s=r,i=t[o];i!=null&&(Ce(n,s,0),ar(n.g,i))}},_o),V1=ge(function(e,t,r){return e.h===0&&(se(t,r,(e=ut(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Gi(t))!=null&&t!=null&&(Ce(e,r,0),ar(e.g,t))},_o),Te=ge(function(e,t,r){return e.h===0&&(se(t,r,vt(e.g)),!0)},function(e,t,r){(t=Qt(t))!=null&&(t=parseInt(t,10),Ce(e,r,0),dn(e.g,t))},Eo);class G1{constructor(t,r){var n=Le;this.g=t,this.h=r,this.m=O,this.j=w,this.defaultValue=void 0,this.l=n.Oa!=null?Ci:void 0}register(){$r(this)}}function Ze(e,t){return new G1(e,t)}function bt(e,t){return(r,n)=>{{const i={ea:!0};n&&Object.assign(i,n),r=lo(r,void 0,void 0,i);try{const o=new e,c=o.v;Ps(t)(c,r);var s=o}finally{fo(r)}}return s}}function En(e){return function(){const t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};Fo(this.v,t,Dt(yn,bn,wn,e)),cr(t,t.g.end());const r=new Uint8Array(t.h),n=t.l,s=n.length;let i=0;for(let o=0;o<s;o++){const c=n[o];r.set(c,i),i+=c.length}return t.l=[r],r}}var Vo=class extends v{constructor(e){super(e)}},Go=[0,_t,ge(function(e,t,r){return e.h===2&&(se(t,r,(e=go(e))===Tt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof v){const n=t.Ra;return void(n?(t=n(t),t!=null&&pn(e,r,gs(t,!0).buffer)):Kt(zn,3))}if(Array.isArray(t))return void Kt(zn,3)}jo(e,t,r)},wo)];let xs,Wo=globalThis.trustedTypes;function Ho(e){var t;return xs===void 0&&(xs=function(){let r=null;if(!Wo)return r;try{const n=s=>s;r=Wo.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r}()),e=(t=xs)?t.createScriptURL(e):e,new class{constructor(r){this.g=r}toString(){return this.g+""}}(e)}function W1(e,...t){if(t.length===0)return Ho(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return Ho(r)}var Ko=[0,ie,Te,K,-1,jr,Te,-1,K],H1=class extends v{constructor(e){super(e)}},zo=[0,K,I,K,Te,-1,lr(function(e,t,r){return(e.h===0||e.h===2)&&(t=nr(t,0|t[m],r),e.h==2?ln(e,T1,t):t.push(vt(e.g)),!0)},function(e,t,r){if((t=hr(Qt,t))!=null&&t.length){r=ws(e,r);for(let n=0;n<t.length;n++)dn(e.g,t[n]);Es(e,r)}},Eo),I,-1,[0,K,-1],Te,K,-1],Yo=[0,3,K,-1,2,[0,ie],[0,Te,K],[0,I,-1],[0]],Xo=[0,I,-2],qo=class extends v{constructor(e){super(e)}},Jo=[0],$o=[0,ie,K,1,K,-4],Le=class extends v{constructor(e){super(e,2)}},re={};re[336783863]=[0,I,K,-1,ie,[0,[1,2,3,4,5,6,7,8,9],z,Jo,z,zo,z,Xo,z,$o,z,Ko,z,[0,I,-2],z,[0,I,Te],z,Yo,z,[0,Te,-1,K]],[0,I],K,[0,[1,3],[2,4],z,[0,jr],-1,z,[0,de],-1,oe,[0,I,-1]],I];var Zo=[0,Fs,-1,jt,-3,Fs,jr,_t,fr,Fs,-1,jt,fr,jt,-2,_t];function j(e,t){cn(e,3,t)}function S(e,t){cn(e,4,t)}var ve=class extends v{constructor(e){super(e,500)}o(e){return w(this,0,7,e)}},Br=[-1,{}],Qo=[0,I,1,Br],ea=[0,I,de,Br];function Ne(e,t){ps(e,1,ve,t)}function V(e,t){cn(e,10,t)}function P(e,t){cn(e,15,t)}var Oe=class extends v{constructor(e){super(e,500)}o(e){return w(this,0,1001,e)}},ta=[-500,oe,[-500,_t,-1,de,-3,[-2,re,K],oe,Go,fr,-1,Qo,ea,oe,[0,_t,jt],_t,Zo,fr,de,987,de],4,oe,[-500,I,-1,[-1,{}],998,I],oe,[-500,I,de,-1,[-2,{},K],997,de,-1],fr,oe,[-500,I,de,Br,998,de],de,fr,Qo,ea,oe,[0,_t,-1,Br],de,-2,Zo,_t,-1,jt,[0,jt,V1],978,Br,oe,Go];Oe.prototype.g=En(ta);var K1=bt(Oe,ta),z1=class extends v{constructor(e){super(e)}},ra=class extends v{constructor(e){super(e)}g(){return at(this,z1,1)}},na=[0,oe,[0,ie,J,I,-1]],An=bt(ra,na),Y1=class extends v{constructor(e){super(e)}},X1=class extends v{constructor(e){super(e)}},Ms=class extends v{constructor(e){super(e)}l(){return O(this,Y1,2)}g(){return at(this,X1,5)}},sa=bt(class extends v{constructor(e){super(e)}},[0,de,jr,Rs,[0,Te,[0,ie,-3],[0,J,-3],[0,ie,-1,[0,oe,[0,ie,-2]]],oe,[0,J,-1,I,J]],I,-1,yt,oe,[0,ie,J],de,yt]),ia=class extends v{constructor(e){super(e)}},dr=bt(class extends v{constructor(e){super(e)}},[0,oe,[0,J,-4]]),oa=class extends v{constructor(e){super(e)}},Ur=bt(class extends v{constructor(e){super(e)}},[0,oe,[0,J,-4]]),q1=class extends v{constructor(e){super(e)}},J1=[0,ie,-1,Rs,Te],aa=class extends v{constructor(e){super(e)}};aa.prototype.g=En([0,J,-4,yt]);var $1=class extends v{constructor(e){super(e)}},Z1=bt(class extends v{constructor(e){super(e)}},[0,oe,[0,1,ie,I,na],yt]),ca=class extends v{constructor(e){super(e)}},Q1=class extends v{constructor(e){super(e)}na(){const e=D(this,1,void 0,void 0,to);return e??Tt()}},ec=class extends v{constructor(e){super(e)}},ua=[1,2],tc=bt(class extends v{constructor(e){super(e)}},[0,oe,[0,ua,z,[0,Rs],z,[0,Uo],ie,I],yt]),Is=class extends v{constructor(e){super(e)}},ha=[0,I,ie,J,de,-1],la=class extends v{constructor(e){super(e)}},rc=[0,K,-1],fa=class extends v{constructor(e){super(e)}},kn=[1,2,3,4,5,6],Sn=class extends v{constructor(e){super(e)}g(){return D(this,1,void 0,void 0,to)!=null}l(){return ce(D(this,2))!=null}},W=class extends v{constructor(e){super(e)}g(){return Vi(D(this,2))??!1}},da=[0,Uo,I,[0,ie,yt,-1],[0,B1,yt]],$=[0,da,K,[0,kn,z,$o,z,zo,z,Ko,z,Jo,z,Xo,z,Yo],Te],Tn=class extends v{constructor(e){super(e)}},Cs=[0,$,J,-1,ie],nc=Ze(502141897,Tn);re[502141897]=Cs;var sc=bt(class extends v{constructor(e){super(e)}},[0,[0,Te,-1,D1,U1],J1]),pa=class extends v{constructor(e){super(e)}},ga=class extends v{constructor(e){super(e)}},Ns=[0,$,J,[0,$],K],ic=Ze(508968150,ga);re[508968150]=[0,$,Cs,Ns,J,[0,[0,da]]],re[508968149]=Ns;var pr=class extends v{constructor(e){super(e)}l(){return O(this,Is,2)}g(){x(this,2)}},ma=[0,$,ha];re[478825465]=ma;var oc=class extends v{constructor(e){super(e)}},va=class extends v{constructor(e){super(e)}},Ds=class extends v{constructor(e){super(e)}},js=class extends v{constructor(e){super(e)}},ya=class extends v{constructor(e){super(e)}},_a=[0,$,[0,$],ma,-1],ba=[0,$,J,ie],Bs=[0,$,J],wa=[0,$,ba,Bs,J],ac=Ze(479097054,ya);re[479097054]=[0,$,wa,_a],re[463370452]=_a,re[464864288]=ba;var cc=Ze(462713202,js);re[462713202]=wa,re[474472470]=Bs;var uc=class extends v{constructor(e){super(e)}},Ea=class extends v{constructor(e){super(e)}},Aa=class extends v{constructor(e){super(e)}},ka=class extends v{constructor(e){super(e)}},Us=[0,$,J,-1,ie],Vs=[0,$,J,K];ka.prototype.g=En([0,$,Bs,[0,$],Cs,Ns,Us,Vs]);var Sa=class extends v{constructor(e){super(e)}},hc=Ze(456383383,Sa);re[456383383]=[0,$,ha];var Ta=class extends v{constructor(e){super(e)}},lc=Ze(476348187,Ta);re[476348187]=[0,$,rc];var La=class extends v{constructor(e){super(e)}},Oa=class extends v{constructor(e){super(e)}},Pa=[0,Te,-1],fc=Ze(458105876,class extends v{constructor(e){super(e)}g(){let e;var t=this.v;const r=0|t[m];return e=Ae(this,r),t=function(n,s,i,o){var c=Oa;!o&&tr(n)&&(i=0|(s=n.v)[m]);var u=ot(s,2);if(n=!1,u==null){if(o)return qi();u=[]}else if(u.constructor===it){if(!(2&u.J)||o)return u;u=u.V()}else Array.isArray(u)?n=!!(2&(0|u[m])):u=[];if(o){if(!u.length)return qi();n||(n=!0,Lr(u))}else n&&(n=!1,Or(u),u=ro(u));return!n&&32&i&&Tr(u,32),i=te(s,i,2,o=new it(u,c,f1,void 0)),n||Ft(s,i),o}(this,t,r,e),!e&&Oa&&(t.ra=!0),t}});re[458105876]=[0,Pa,N1,[!0,yt,[0,I,-1,de]],[0,jr,K,Te]];var Gs=class extends v{constructor(e){super(e)}},Ra=Ze(458105758,Gs);re[458105758]=[0,$,I,Pa];var Ws=class extends v{constructor(e){super(e)}},Fa=[0,j1,-1,jt],dc=class extends v{constructor(e){super(e)}},xa=class extends v{constructor(e){super(e)}},Hs=[1,2];xa.prototype.g=En([0,Hs,z,Fa,z,[0,oe,Fa]]);var Ma=class extends v{constructor(e){super(e)}},pc=Ze(443442058,Ma);re[443442058]=[0,$,I,ie,J,de,-1,K,J],re[514774813]=Us;var Ia=class extends v{constructor(e){super(e)}},gc=Ze(516587230,Ia);function Ks(e,t){return t=t?t.clone():new Is,e.displayNamesLocale!==void 0?x(t,1,Ir(e.displayNamesLocale)):e.displayNamesLocale===void 0&&x(t,1),e.maxResults!==void 0?ct(t,2,e.maxResults):"maxResults"in e&&x(t,2),e.scoreThreshold!==void 0?_(t,3,e.scoreThreshold):"scoreThreshold"in e&&x(t,3),e.categoryAllowlist!==void 0?an(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&x(t,4),e.categoryDenylist!==void 0?an(t,5,e.categoryDenylist):"categoryDenylist"in e&&x(t,5),t}function Ca(e){const t=Number(e);return Number.isSafeInteger(t)?t:String(e)}function zs(e,t=-1,r=""){return{categories:e.map(n=>({index:Ie(n,1)??0??-1,score:H(n,2)??0,categoryName:ce(D(n,3))??""??"",displayName:ce(D(n,4))??""??""})),headIndex:t,headName:r}}function mc(e){const t={classifications:at(e,$1,1).map(r=>{var n;return zs(((n=O(r,ra,4))==null?void 0:n.g())??[],Ie(r,2)??0,ce(D(r,3))??"")})};return function(r){return l1(Gn?D(r,2,void 0,void 0,rn):D(r,2))}(e)!=null&&(t.timestampMs=Ca(ao(e))),t}function Na(e){var o,c;var t=Mt(e,3,qe,xt()),r=Mt(e,2,Qt,xt()),n=Mt(e,1,ce,xt()),s=Mt(e,9,ce,xt());const i={categories:[],keypoints:[]};for(let u=0;u<t.length;u++)i.categories.push({score:t[u],index:r[u]??-1,categoryName:n[u]??"",displayName:s[u]??""});if((t=(o=O(e,Ms,4))==null?void 0:o.l())&&(i.boundingBox={originX:Ie(t,1,gt)??0,originY:Ie(t,2,gt)??0,width:Ie(t,3,gt)??0,height:Ie(t,4,gt)??0,angle:0}),(c=O(e,Ms,4))==null?void 0:c.g().length)for(const u of O(e,Ms,4).g())i.keypoints.push({x:D(u,1,void 0,gt,qe)??0,y:D(u,2,void 0,gt,qe)??0,score:D(u,4,void 0,gt,qe)??0,label:ce(D(u,3,void 0,gt))??""});return i}function Ln(e){const t=[];for(const r of at(e,oa,1))t.push({x:H(r,1)??0,y:H(r,2)??0,z:H(r,3)??0,visibility:H(r,4)??0});return t}function Vr(e){const t=[];for(const r of at(e,ia,1))t.push({x:H(r,1)??0,y:H(r,2)??0,z:H(r,3)??0,visibility:H(r,4)??0});return t}function Da(e){return Array.from(e,t=>t>127?t-256:t)}function ja(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,s=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i],n+=e[i]*e[i],s+=t[i]*t[i];if(n<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*s)}let On;re[516587230]=[0,$,Us,Vs,J],re[518928384]=Vs;const vc=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Ba(){if(On===void 0)try{await WebAssembly.instantiate(vc),On=!0}catch{On=!1}return On}async function Gr(e,t=W1``){const r=await Ba()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Bt=class{};function Ua(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Va(e){if(typeof importScripts!="function"){const t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",s=>{n(s)},!1),document.body.appendChild(t)})}try{importScripts(e.toString())}catch(t){if(!(t instanceof TypeError))throw t;await self.import(e.toString())}}function Ga(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function y(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(t=e.i.stringToNewUTF8(t)),e.i._free(t)}function Wa(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[n,s]=Ga(t);return!e.l||n===e.i.canvas.width&&s===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=s),[n,s]}function Ha(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const n=new Uint32Array(t.length);for(let s=0;s<t.length;s++)n[s]=e.i.stringToNewUTF8(t[s]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(const s of n)e.i._free(s);e.i._free(t)}function Qe(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function wt(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(s,i,o)=>{i?(r(n,o),n=[]):n.push(s)}}Bt.forVisionTasks=function(e){return Gr("vision",e)},Bt.forTextTasks=function(e){return Gr("text",e)},Bt.forGenAiExperimentalTasks=function(e){return Gr("genai_experimental",e)},Bt.forGenAiTasks=function(e){return Gr("genai",e)},Bt.forAudioTasks=function(e){return Gr("audio",e)},Bt.isSimdSupported=function(){return Ba()};async function yc(e,t,r,n){return e=await(async(s,i,o,c,u)=>{if(i&&await Va(i),!self.ModuleFactory||o&&(await Va(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&u&&((i=self.Module).locateFile=u.locateFile,u.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=u.mainScriptUrlOrBlob)),u=await self.ModuleFactory(self.Module||u),self.ModuleFactory=self.Module=void 0,new s(u,c)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:s=>s.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&s.endsWith(".data")?r.assetBinaryPath.toString():s}),await e.o(n),e}function Ys(e,t){const r=O(e.baseOptions,Sn,1)||new Sn;typeof t=="string"?(x(r,2,Ir(t)),x(r,1)):t instanceof Uint8Array&&(x(r,1,Yn(t,!1)),x(r,2)),w(e.baseOptions,0,1,r)}function Ka(e){try{const t=e.H.length;if(t===1)throw Error(e.H[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.H.map(r=>r.message).join(", "))}finally{e.H=[]}}function g(e,t){e.C=Math.max(e.C,t)}function Pn(e,t){e.B=new ve,Se(e.B,2,"PassThroughCalculator"),j(e.B,"free_memory"),S(e.B,"free_memory_unused_out"),V(t,"free_memory"),Ne(t,e.B)}function gr(e,t){j(e.B,t),S(e.B,t+"_unused_out")}function Rn(e){e.g.addBoolToStream(!0,"free_memory",e.C)}var Xs=class{constructor(e){this.g=e,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){var r,n,s,i,o,c;if(t){const u=e.baseOptions||{};if((r=e.baseOptions)!=null&&r.modelAssetBuffer&&((n=e.baseOptions)!=null&&n.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=O(this.baseOptions,Sn,1))!=null&&s.g()||(i=O(this.baseOptions,Sn,1))!=null&&i.l()||(o=e.baseOptions)!=null&&o.modelAssetBuffer||(c=e.baseOptions)!=null&&c.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(f,h){let d=O(f.baseOptions,fa,3);if(!d){var b=d=new fa,A=new qo;Nr(b,4,kn,A)}"delegate"in h&&(h.delegate==="GPU"?(h=d,b=new H1,Nr(h,2,kn,b)):(h=d,b=new qo,Nr(h,4,kn,b))),w(f.baseOptions,0,3,d)}(this,u),u.modelAssetPath)return fetch(u.modelAssetPath.toString()).then(f=>{if(f.ok)return f.arrayBuffer();throw Error(`Failed to fetch model: ${u.modelAssetPath} (${f.status})`)}).then(f=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(f),!0,!1,!1),Ys(this,"/model.dat"),this.m(),this.L()});if(u.modelAssetBuffer instanceof Uint8Array)Ys(this,u.modelAssetBuffer);else if(u.modelAssetBuffer)return async function(f){const h=[];for(var d=0;;){const{done:b,value:A}=await f.read();if(b)break;h.push(A),d+=A.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];f=new Uint8Array(d),d=0;for(const b of h)f.set(b,d),d+=b.length;return f}(u.modelAssetBuffer).then(f=>{Ys(this,f),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let e;if(this.g.ca(t=>{e=K1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.H.push(Error(n))}),this.g.Ja(),this.g.setGraph(e,t),this.B=void 0,Ka(this)}finishProcessing(){this.g.finishProcessing(),Ka(this)}close(){this.B=void 0,this.g.closeGraph()}};function Et(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Xs.prototype.close=Xs.prototype.close;class _c{constructor(t,r,n,s){this.g=t,this.h=r,this.m=n,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function za(e,t,r){const n=e.g;if(r=Et(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Ya(e,t){const r=e.g,n=Et(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);const s=Et(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);const i=Et(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.L),r.vertexAttribPointer(e.L,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array(t?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,null),r.bindVertexArray(null),new _c(r,n,s,i)}function qs(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function bc(e,t,r,n){return qs(e,t),e.h||(e.m(),e.D()),r?(e.u||(e.u=Ya(e,!0)),r=e.u):(e.A||(e.A=Ya(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function Xa(e,t,r){return qs(e,t),e=Et(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,r??t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r??t.LINEAR),t.bindTexture(t.TEXTURE_2D,null),e}function qa(e,t,r){qs(e,t),e.B||(e.B=Et(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.B),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function wc(e){var t;(t=e.g)==null||t.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ja=class{H(){return`
|
|
1
|
+
(function($,j){typeof exports=="object"&&typeof module<"u"?j(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],j):($=typeof globalThis<"u"?globalThis:$||self,j($.LivenessSDK={},$.React))})(this,function($,j){"use strict";var c1=Object.defineProperty;var h1=($,j,oe)=>j in $?c1($,j,{enumerable:!0,configurable:!0,writable:!0,value:oe}):$[j]=oe;var va=($,j,oe)=>h1($,typeof j!="symbol"?j+"":j,oe);const oe=async(t,e,n)=>{const r=new FormData;e.forEach((i,o)=>{r.append("files",i,`frame_${o}.jpg`)}),r.append("challenge",n);const s=await fetch(`${t}/v1/verify`,{method:"POST",body:r});if(!s.ok)throw new Error("Network response was not ok");return await s.json()};var ae=typeof self<"u"?self:{};function Be(t,e){t:{for(var n=["CLOSURE_FLAGS"],r=ae,s=0;s<n.length;s++)if((r=r[n[s]])==null){n=null;break t}n=r}return(t=n&&n[t])!=null?t:e}function Kt(){throw Error("Invalid UTF8")}function ds(t,e){return e=String.fromCharCode.apply(null,e),t==null?e:t+e}let sn,Gn;const wa=typeof TextDecoder<"u";let ba;const Aa=typeof TextEncoder<"u";function ps(t){if(Aa)t=(ba||(ba=new TextEncoder)).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let s=0;s<t.length;s++){var e=t.charCodeAt(s);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&s<t.length){const i=t.charCodeAt(++s);if(i>=56320&&i<=57343){e=1024*(e-55296)+i-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}s--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}function gs(t){ae.setTimeout(()=>{throw t},0)}var Vn,Ea=Be(610401301,!1),ms=Be(748402147,!0),Hn=Be(824648567,!0),Wn=Be(824656860,Be(1,!0));function _s(){var t=ae.navigator;return t&&(t=t.userAgent)?t:""}const ys=ae.navigator;function on(t){return on[" "](t),t}Vn=ys&&ys.userAgentData||null,on[" "]=function(){};const vs={};let De=null;function ka(t){const e=t.length;let n=3*e/4;n%3?n=Math.floor(n):"=.".indexOf(t[e-1])!=-1&&(n="=.".indexOf(t[e-2])!=-1?n-2:n-1);const r=new Uint8Array(n);let s=0;return function(i,o){function a(u){for(;c<i.length;){const h=i.charAt(c++),f=De[h];if(f!=null)return f;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return u}ws();let c=0;for(;;){const u=a(-1),h=a(0),f=a(64),y=a(64);if(y===64&&u===-1)break;o(u<<2|h>>4),f!=64&&(o(h<<4&240|f>>2),y!=64&&o(f<<6&192|y))}}(t,function(i){r[s++]=i}),s!==n?r.subarray(0,s):r}function ws(){if(!De){De={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));vs[n]=r;for(let s=0;s<r.length;s++){const i=r[s];De[i]===void 0&&(De[i]=s)}}}}var Sa=typeof Uint8Array<"u",bs=!(!(Ea&&Vn&&Vn.brands.length>0)&&(_s().indexOf("Trident")!=-1||_s().indexOf("MSIE")!=-1))&&typeof btoa=="function";const As=/[-_.]/g,Ta={"-":"+",_:"/",".":"="};function La(t){return Ta[t]||""}function Es(t){if(!bs)return ka(t);t=As.test(t)?t.replace(As,La):t,t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function Kn(t){return Sa&&t!=null&&t instanceof Uint8Array}var ce={};function zt(){return Fa||(Fa=new At(null,ce))}function zn(t){ks(ce);var e=t.g;return(e=e==null||Kn(e)?e:typeof e=="string"?Es(e):null)==null?e:t.g=e}var At=class{h(){return new Uint8Array(zn(this)||0)}constructor(t,e){if(ks(e),this.g=t,t!=null&&t.length===0)throw Error("ByteString should be constructed with non-empty values")}};let Fa,Ma;function ks(t){if(t!==ce)throw Error("illegal external caller")}function Ss(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function qn(t){return Ss(t=Error(t),"warning"),t}function he(t,e){if(t!=null){var n=Ma??(Ma={}),r=n[t]||0;r>=e||(n[t]=r+1,Ss(t=Error(),"incident"),gs(t))}}function ue(){return typeof BigInt=="function"}var le=typeof Symbol=="function"&&typeof Symbol()=="symbol";function Et(t,e,n=!1){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&t?Symbol.for(t):t!=null?Symbol(t):Symbol():e}var Pa=Et("jas",void 0,!0),Ts=Et(void 0,"0di"),Ue=Et(void 0,"1oa"),et=Et(void 0,Symbol()),Oa=Et(void 0,"0ub"),xa=Et(void 0,"0ubs"),Xn=Et(void 0,"0ubsb"),Ia=Et(void 0,"0actk"),fe=Et("m_m","Pa",!0),Ls=Et();const Fs={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ms=Object.defineProperties,d=le?Pa:"Ga";var qt;const Ps=[];function je(t,e){le||d in t||Ms(t,Fs),t[d]|=e}function G(t,e){le||d in t||Ms(t,Fs),t[d]=e}function Ge(t){return je(t,34),t}function Ve(t){return je(t,8192),t}G(Ps,7),qt=Object.freeze(Ps);var de={};function nt(t,e){return e===void 0?t.h!==Xt&&!!(2&(0|t.v[d])):!!(2&e)&&t.h!==Xt}const Xt={};function Yn(t,e){if(t!=null){if(typeof t=="string")t=t?new At(t,ce):zt();else if(t.constructor!==At)if(Kn(t))t=t.length?new At(new Uint8Array(t),ce):zt();else{if(!e)throw Error();t=void 0}}return t}class Os{constructor(e,n,r){this.g=e,this.h=n,this.l=r}next(){const e=this.g.next();return e.done||(e.value=this.h.call(this.l,e.value)),e}[Symbol.iterator](){return this}}var Na=Object.freeze({});function xs(t,e,n){const r=128&e?0:-1,s=t.length;var i;(i=!!s)&&(i=(i=t[s-1])!=null&&typeof i=="object"&&i.constructor===Object);const o=s+(i?-1:0);for(e=128&e?1:0;e<o;e++)n(e-r,t[e]);if(i){t=t[s-1];for(const a in t)!isNaN(a)&&n(+a,t[a])}}var Is={};function pe(t){return 128&t?Is:void 0}function an(t){return t.Na=!0,t}var Ca=an(t=>typeof t=="number"),Ns=an(t=>typeof t=="string"),Ra=an(t=>typeof t=="boolean"),cn=typeof ae.BigInt=="function"&&typeof ae.BigInt(0)=="bigint";function rt(t){var e=t;if(Ns(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(Ca(e)&&!Number.isSafeInteger(e))throw Error(String(e));return cn?BigInt(t):t=Ra(t)?t?"1":"0":Ns(t)?t.trim()||"0":String(t)}var $n=an(t=>cn?t>=Da&&t<=ja:t[0]==="-"?Cs(t,Ba):Cs(t,Ua));const Ba=Number.MIN_SAFE_INTEGER.toString(),Da=cn?BigInt(Number.MIN_SAFE_INTEGER):void 0,Ua=Number.MAX_SAFE_INTEGER.toString(),ja=cn?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Cs(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],s=e[n];if(r>s)return!1;if(r<s)return!0}}const Ga=typeof Uint8Array.prototype.slice=="function";let Va,M=0,B=0;function Rs(t){const e=t>>>0;M=e,B=(t-e)/4294967296>>>0}function ge(t){if(t<0){Rs(-t);const[e,n]=er(M,B);M=e>>>0,B=n>>>0}else Rs(t)}function Jn(t){const e=Va||(Va=new DataView(new ArrayBuffer(8)));e.setFloat32(0,+t,!0),B=0,M=e.getUint32(0,!0)}function Zn(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:He(t,e)}function Ha(t,e){return rt(ue()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):He(t,e))}function Qn(t,e){const n=2147483648&e;return n&&(e=~e>>>0,(t=1+~t>>>0)==0&&(e=e+1>>>0)),typeof(t=Zn(t,e))=="number"?n?-t:t:n?"-"+t:t}function Bs(t,e){return ue()?rt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):rt(tr(t,e))}function He(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else ue()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+Ds(n)+Ds(t));return n}function Ds(t){return t=String(t),"0000000".slice(t.length)+t}function tr(t,e){if(2147483648&e)if(ue())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=er(t,e);t="-"+He(n,r)}else t=He(t,e);return t}function hn(t){if(t.length<16)ge(Number(t));else if(ue())t=BigInt(t),M=Number(t&BigInt(4294967295))>>>0,B=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+(t[0]==="-");B=M=0;const n=t.length;for(let r=e,s=(n-e)%6+e;s<=n;r=s,s+=6){const i=Number(t.slice(r,s));B*=1e6,M=1e6*M+i,M>=4294967296&&(B+=Math.trunc(M/4294967296),B>>>=0,M>>>=0)}if(e){const[r,s]=er(M,B);M=r,B=s}}}function er(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function yt(t){return Array.prototype.slice.call(t)}const We=typeof BigInt=="function"?BigInt.asIntN:void 0,Wa=typeof BigInt=="function"?BigInt.asUintN:void 0,Yt=Number.isSafeInteger,un=Number.isFinite,me=Math.trunc,Ka=rt(0);function Ke(t){if(t!=null&&typeof t!="number")throw Error(`Value of float/double field must be a number, found ${typeof t}: ${t}`);return t}function kt(t){return t==null||typeof t=="number"?t:t==="NaN"||t==="Infinity"||t==="-Infinity"?Number(t):void 0}function ze(t){if(t!=null&&typeof t!="boolean"){var e=typeof t;throw Error(`Expected boolean but got ${e!="object"?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}function Us(t){return t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0}const za=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function qe(t){switch(typeof t){case"bigint":return!0;case"number":return un(t);case"string":return za.test(t);default:return!1}}function _e(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return un(t)?0|t:void 0}function js(t){if(t==null)return t;if(typeof t=="string"&&t)t=+t;else if(typeof t!="number")return;return un(t)?t>>>0:void 0}function Gs(t){const e=t.length;return(t[0]==="-"?e<20||e===20&&t<="-9223372036854775808":e<19||e===19&&t<="9223372036854775807")?t:(hn(t),tr(M,B))}function nr(t){return t=me(t),Yt(t)||(ge(t),t=Qn(M,B)),t}function Vs(t){var e=me(Number(t));return Yt(e)?String(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),Gs(t))}function Hs(t){var e=me(Number(t));return Yt(e)?rt(e):((e=t.indexOf("."))!==-1&&(t=t.substring(0,e)),ue()?rt(We(64,BigInt(t))):rt(Gs(t)))}function Ws(t){return Yt(t)?t=rt(nr(t)):(t=me(t),Yt(t)?t=String(t):(ge(t),t=tr(M,B)),t=rt(t)),t}function qa(t){return t==null?t:typeof t=="bigint"?($n(t)?t=Number(t):(t=We(64,t),t=$n(t)?Number(t):String(t)),t):qe(t)?typeof t=="number"?nr(t):Vs(t):void 0}function ln(t){const e=typeof t;return t==null?t:e==="bigint"?rt(We(64,t)):qe(t)?e==="string"?Hs(t):Ws(t):void 0}function Ks(t){if(typeof t!="string")throw Error();return t}function Xe(t){if(t!=null&&typeof t!="string")throw Error();return t}function X(t){return t==null||typeof t=="string"?t:void 0}function rr(t,e,n,r){return t!=null&&t[fe]===de?t:Array.isArray(t)?((r=(n=0|t[d])|32&r|2&r)!==n&&G(t,r),new e(t)):(n?2&r?((t=e[Ts])||(Ge((t=new e).v),t=e[Ts]=t),e=t):e=new e:e=void 0,e)}function Xa(t,e,n){if(e)t:{if(!qe(e=t))throw qn("int64");switch(typeof e){case"string":e=Hs(e);break t;case"bigint":e=rt(We(64,e));break t;default:e=Ws(e)}}else e=ln(t);return(t=e)==null?n?Ka:void 0:t}const Ya={};let $a=function(){try{return on(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class sr{constructor(){this.g=new Map}get(e){return this.g.get(e)}set(e,n){return this.g.set(e,n),this.size=this.g.size,this}delete(e){return e=this.g.delete(e),this.size=this.g.size,e}clear(){this.g.clear(),this.size=this.g.size}has(e){return this.g.has(e)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(e,n){return this.g.forEach(e,n)}[Symbol.iterator](){return this.entries()}}const Ja=$a?(Object.setPrototypeOf(sr.prototype,Map.prototype),Object.defineProperties(sr.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),sr):class extends Map{constructor(){super()}};function zs(t){return t}function ir(t){if(2&t.J)throw Error("Cannot mutate an immutable Map")}var Ot=class extends Ja{constructor(t,e,n=zs,r=zs){super(),this.J=0|t[d],this.K=e,this.S=n,this.fa=this.K?Za:r;for(let s=0;s<t.length;s++){const i=t[s],o=n(i[0],!1,!0);let a=i[1];e?a===void 0&&(a=null):a=r(i[1],!1,!0,void 0,void 0,this.J),super.set(o,a)}}V(t){return Ve(Array.from(super.entries(),t))}clear(){ir(this),super.clear()}delete(t){return ir(this),super.delete(this.S(t,!0,!1))}entries(){if(this.K){var t=super.keys();t=new Os(t,Qa,this)}else t=super.entries();return t}values(){if(this.K){var t=super.keys();t=new Os(t,Ot.prototype.get,this)}else t=super.values();return t}forEach(t,e){this.K?super.forEach((n,r,s)=>{t.call(e,s.get(r),r,s)}):super.forEach(t,e)}set(t,e){return ir(this),(t=this.S(t,!0,!1))==null?this:e==null?(super.delete(t),this):super.set(t,this.fa(e,!0,!0,this.K,!1,this.J))}Ma(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.K?t===void 0?null:t:this.fa(t,!1,!0,void 0,!1,this.J),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(e!==void 0){var n=this.K;return n?((n=this.fa(e,!1,!0,n,this.ra,this.J))!==e&&super.set(t,n),n):e}}[Symbol.iterator](){return this.entries()}};function Za(t,e,n,r,s,i){return t=rr(t,r,n,i),s&&(t=cr(t)),t}function Qa(t){return[t,this.get(t)]}let t2;function qs(){return t2||(t2=new Ot(Ge([]),void 0,void 0,void 0,Ya))}function fn(t){return et?t[et]:void 0}function dn(t,e){for(const n in t)!isNaN(n)&&e(t,+n,t[n])}Ot.prototype.toJSON=void 0;var or=class{};const e2={Ka:!0};function n2(t,e){e<100||he(xa,1)}function pn(t,e,n,r){const s=r!==void 0;r=!!r;var i,o=et;!s&&le&&o&&(i=t[o])&&dn(i,n2),o=[];var a=t.length;let c;i=4294967295;let u=!1;const h=!!(64&e),f=h?128&e?0:-1:void 0;1&e||(c=a&&t[a-1],c!=null&&typeof c=="object"&&c.constructor===Object?i=--a:c=void 0,!h||128&e||s||(u=!0,i=i-f+f)),e=void 0;for(var y=0;y<a;y++){let v=t[y];if(v!=null&&(v=n(v,r))!=null)if(h&&y>=i){const I=y-f;(e??(e={}))[I]=v}else o[y]=v}if(c)for(let v in c){if((a=c[v])==null||(a=n(a,r))==null)continue;let I;y=+v,h&&!Number.isNaN(y)&&(I=y+f)<i?o[I]=a:(e??(e={}))[v]=a}return e&&(u?o.push(e):o[i]=e),s&&et&&(t=fn(t))&&t instanceof or&&(o[et]=function(v){const I=new or;return dn(v,(ls,Re,rn)=>{I[Re]=yt(rn)}),I.da=v.da,I}(t)),o}function r2(t){return t[0]=Ye(t[0]),t[1]=Ye(t[1]),t}function Ye(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return $n(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[d];return t.length===0&&1&e?void 0:pn(t,e,Ye)}if(t!=null&&t[fe]===de)return Xs(t);if(t instanceof At){if((e=t.g)==null)t="";else if(typeof e=="string")t=e;else{if(bs){for(var n="",r=0,s=e.length-10240;r<s;)n+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));n+=String.fromCharCode.apply(null,r?e.subarray(r):e),e=btoa(n)}else{n===void 0&&(n=0),ws(),n=vs[n],r=Array(Math.floor(e.length/3)),s=n[64]||"";let u=0,h=0;for(;u<e.length-2;u+=3){var i=e[u],o=e[u+1],a=e[u+2],c=n[i>>2];i=n[(3&i)<<4|o>>4],o=n[(15&o)<<2|a>>6],a=n[63&a],r[h++]=c+i+o+a}switch(c=0,a=s,e.length-u){case 2:a=n[(15&(c=e[u+1]))<<2]||s;case 1:e=e[u],r[h]=n[e>>2]+n[(3&e)<<4|c>>4]+a+s}e=r.join("")}t=t.g=e}return t}return t instanceof Ot?t=t.size!==0?t.V(r2):void 0:void 0}return t}function Xs(t){return pn(t=t.v,0|t[d],Ye)}let s2,i2;function $t(t,e){return Ys(t,e[0],e[1])}function Ys(t,e,n,r=0){if(t==null){var s=32;n?(t=[n],s|=128):t=[],e&&(s=-16760833&s|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(s=0|t[d],ms&&1&s)throw Error("rfarr");if(2048&s&&!(2&s)&&function(){if(ms)throw Error("carr");he(Ia,5)}(),256&s)throw Error("farr");if(64&s)return(s|r)!==s&&G(t,s|r),t;if(n&&(s|=128,n!==t[0]))throw Error("mid");t:{s|=64;var i=(n=t).length;if(i){var o=i-1;const c=n[o];if(c!=null&&typeof c=="object"&&c.constructor===Object){if((o-=e=128&s?0:-1)>=1024)throw Error("pvtlmt");for(var a in c)(i=+a)<o&&(n[i+e]=c[a],delete c[a]);s=-16760833&s|(1023&o)<<14;break t}}if(e){if((a=Math.max(e,i-(128&s?0:-1)))>1024)throw Error("spvt");s=-16760833&s|(1023&a)<<14}}}return G(t,64|s|r),t}function o2(t,e){if(typeof t!="object")return t;if(Array.isArray(t)){var n=0|t[d];return t.length===0&&1&n?void 0:$s(t,n,e)}if(t!=null&&t[fe]===de)return Js(t);if(t instanceof Ot){if(2&(e=t.J))return t;if(!t.size)return;if(n=Ge(t.V()),t.K)for(t=0;t<n.length;t++){const r=n[t];let s=r[1];s=s==null||typeof s!="object"?void 0:s!=null&&s[fe]===de?Js(s):Array.isArray(s)?$s(s,0|s[d],!!(32&e)):void 0,r[1]=s}return n}return t instanceof At?t:void 0}function $s(t,e,n){return 2&e||(!n||4096&e||16&e?t=ye(t,e,!1,n&&!(16&e)):(je(t,34),4&e&&Object.freeze(t))),t}function ar(t,e,n){return t=new t.constructor(e),n&&(t.h=Xt),t.m=Xt,t}function Js(t){const e=t.v,n=0|e[d];return nt(t,n)?t:hr(t,e,n)?ar(t,e):ye(e,n)}function ye(t,e,n,r){return r??(r=!!(34&e)),t=pn(t,e,o2,r),r=32,n&&(r|=2),G(t,e=16769217&e|r),t}function cr(t){const e=t.v,n=0|e[d];return nt(t,n)?hr(t,e,n)?ar(t,e,!0):new t.constructor(ye(e,n,!1)):t}function ve(t){if(t.h!==Xt)return!1;var e=t.v;return je(e=ye(e,0|e[d]),2048),t.v=e,t.h=void 0,t.m=void 0,!0}function we(t){if(!ve(t)&&nt(t,0|t.v[d]))throw Error()}function Jt(t,e){e===void 0&&(e=0|t[d]),32&e&&!(4096&e)&&G(t,4096|e)}function hr(t,e,n){return!!(2&n)||!(!(32&n)||4096&n)&&(G(e,2|n),t.h=Xt,!0)}const a2=rt(0),Bt={};function T(t,e,n,r,s){if((e=xt(t.v,e,n,s))!==null||r&&t.m!==Xt)return e}function xt(t,e,n,r){if(e===-1)return null;const s=e+(n?0:-1),i=t.length-1;let o,a;if(!(i<1+(n?0:-1))){if(s>=i)if(o=t[i],o!=null&&typeof o=="object"&&o.constructor===Object)n=o[e],a=!0;else{if(s!==i)return;n=o}else n=t[s];if(r&&n!=null){if((r=r(n))==null)return r;if(!Object.is(r,n))return a?o[e]=r:t[s]=r,r}return n}}function k(t,e,n,r){we(t),V(t=t.v,0|t[d],e,n,r)}function V(t,e,n,r,s){const i=n+(s?0:-1);var o=t.length-1;if(o>=1+(s?0:-1)&&i>=o){const a=t[o];if(a!=null&&typeof a=="object"&&a.constructor===Object)return a[n]=r,e}return i<=o?(t[i]=r,e):(r!==void 0&&(n>=(o=(e??(e=0|t[d]))>>14&1023||536870912)?r!=null&&(t[o+(s?0:-1)]={[n]:r}):t[i]=r),e)}function Zt(){return Na===void 0?2:4}function Qt(t,e,n,r,s){let i=t.v,o=0|i[d];r=nt(t,o)?1:r,s=!!s||r===3,r===2&&ve(t)&&(i=t.v,o=0|i[d]);let a=(t=ur(i,e))===qt?7:0|t[d],c=lr(a,o);var u=!(4&c);if(u){4&c&&(t=yt(t),a=0,c=ee(c,o),o=V(i,o,e,t));let h=0,f=0;for(;h<t.length;h++){const y=n(t[h]);y!=null&&(t[f++]=y)}f<h&&(t.length=f),n=-513&(4|c),c=n&=-1025,c&=-4097}return c!==a&&(G(t,c),2&c&&Object.freeze(t)),Zs(t,c,i,o,e,r,u,s)}function Zs(t,e,n,r,s,i,o,a){let c=e;return i===1||i===4&&(2&e||!(16&e)&&32&r)?te(e)||((e|=!t.length||o&&!(4096&e)||32&r&&!(4096&e||16&e)?2:256)!==c&&G(t,e),Object.freeze(t)):(i===2&&te(e)&&(t=yt(t),c=0,e=ee(e,r),r=V(n,r,s,t)),te(e)||(a||(e|=16),e!==c&&G(t,e))),2&e||!(4096&e||16&e)||Jt(n,r),t}function ur(t,e,n){return t=xt(t,e,n),Array.isArray(t)?t:qt}function lr(t,e){return 2&e&&(t|=2),1|t}function te(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Qs(t){return Yn(t,!0)}function ti(t){t=yt(t);for(let e=0;e<t.length;e++){const n=t[e]=yt(t[e]);Array.isArray(n[1])&&(n[1]=Ge(n[1]))}return Ve(t)}function Dt(t,e,n,r){we(t),V(t=t.v,0|t[d],e,(r==="0"?Number(n)===0:n===r)?void 0:n)}function be(t,e,n){if(2&e)throw Error();const r=pe(e);let s=ur(t,n,r),i=s===qt?7:0|s[d],o=lr(i,e);return(2&o||te(o)||16&o)&&(o===i||te(o)||G(s,o),s=yt(s),i=0,o=ee(o,e),V(t,e,n,s,r)),o&=-13,o!==i&&G(s,o),s}function fr(t,e){var n=oo;return pr(dr(t=t.v),t,void 0,n)===e?e:-1}function dr(t){if(le)return t[Ue]??(t[Ue]=new Map);if(Ue in t)return t[Ue];const e=new Map;return Object.defineProperty(t,Ue,{value:e}),e}function ei(t,e,n,r,s){const i=dr(t),o=pr(i,t,e,n,s);return o!==r&&(o&&(e=V(t,e,o,void 0,s)),i.set(n,r)),e}function pr(t,e,n,r,s){let i=t.get(r);if(i!=null)return i;i=0;for(let o=0;o<r.length;o++){const a=r[o];xt(e,a,s)!=null&&(i!==0&&(n=V(e,n,i,void 0,s)),i=a)}return t.set(r,i),i}function gr(t,e,n){let r=0|t[d];const s=pe(r),i=xt(t,n,s);let o;if(i!=null&&i[fe]===de){if(!nt(i))return ve(i),i.v;o=i.v}else Array.isArray(i)&&(o=i);if(o){const a=0|o[d];2&a&&(o=ye(o,a))}return o=$t(o,e),o!==i&&V(t,r,n,o,s),o}function ni(t,e,n,r,s){let i=!1;if((r=xt(t,r,s,o=>{const a=rr(o,n,!1,e);return i=a!==o&&a!=null,a}))!=null)return i&&!nt(r)&&Jt(t,e),r}function A(t,e,n,r){let s=t.v,i=0|s[d];if((e=ni(s,i,e,n,r))==null)return e;if(i=0|s[d],!nt(t,i)){const o=cr(e);o!==e&&(ve(t)&&(s=t.v,i=0|s[d]),i=V(s,i,n,e=o,r),Jt(s,i))}return e}function ri(t,e,n,r,s,i,o,a){var c=nt(t,n);i=c?1:i,o=!!o||i===3,c=a&&!c,(i===2||c)&&ve(t)&&(n=0|(e=t.v)[d]);var u=(t=ur(e,s))===qt?7:0|t[d],h=lr(u,n);if(a=!(4&h)){var f=t,y=n;const v=!!(2&h);v&&(y|=2);let I=!v,ls=!0,Re=0,rn=0;for(;Re<f.length;Re++){const fs=rr(f[Re],r,!1,y);if(fs instanceof r){if(!v){const ya=nt(fs);I&&(I=!ya),ls&&(ls=ya)}f[rn++]=fs}}rn<Re&&(f.length=rn),h|=4,h=ls?-4097&h:4096|h,h=I?8|h:-9&h}if(h!==u&&(G(t,h),2&h&&Object.freeze(t)),c&&!(8&h||!t.length&&(i===1||i===4&&(2&h||!(16&h)&&32&n)))){for(te(h)&&(t=yt(t),h=ee(h,n),n=V(e,n,s,t)),r=t,c=h,u=0;u<r.length;u++)(f=r[u])!==(h=cr(f))&&(r[u]=h);c|=8,G(t,h=c=r.length?4096|c:-4097&c)}return Zs(t,h,e,n,s,i,a,o)}function It(t,e,n){const r=t.v;return ri(t,r,0|r[d],e,n,Zt(),!1,!0)}function si(t){return t==null&&(t=void 0),t}function _(t,e,n,r,s){return k(t,n,r=si(r),s),r&&!nt(r)&&Jt(t.v),t}function $e(t,e,n,r){t:{var s=r=si(r);we(t);const i=t.v;let o=0|i[d];if(s==null){const a=dr(i);if(pr(a,i,o,n)!==e)break t;a.set(n,0)}else o=ei(i,o,n,e);V(i,o,e,s)}r&&!nt(r)&&Jt(t.v)}function ee(t,e){return-273&(2&e?2|t:-3&t)}function mr(t,e,n,r){var s=r;we(t),t=ri(t,r=t.v,0|r[d],n,e,2,!0),s=s??new n,t.push(s),e=n=t===qt?7:0|t[d],(s=nt(s))?(n&=-9,t.length===1&&(n&=-4097)):n|=4096,n!==e&&G(t,n),s||Jt(r)}function ft(t,e,n){return _e(T(t,e,void 0,n))}function ii(t){return(Wn?T(t,2,void 0,void 0,ln):ln(T(t,2)))??a2}function N(t,e){return T(t,e,void 0,void 0,kt)??0}function Nt(t,e,n){if(n!=null){if(typeof n!="number"||!un(n))throw qn("int32");n|=0}k(t,e,n)}function m(t,e,n){k(t,e,Ke(n))}function st(t,e,n){Dt(t,e,Xe(n),"")}function gn(t,e,n){{we(t);const o=t.v;let a=0|o[d];if(n==null)V(o,a,e);else{var r=t=n===qt?7:0|n[d],s=te(t),i=s||Object.isFrozen(n);for(s||(t=0),i||(n=yt(n),r=0,t=ee(t,a),i=!1),t|=5,t|=(4&t?512&t?512:1024&t?1024:0:void 0)??(Wn?1024:0),s=0;s<n.length;s++){const c=n[s],u=Ks(c);Object.is(c,u)||(i&&(n=yt(n),r=0,t=ee(t,a),i=!1),n[s]=u)}t!==r&&(i&&(n=yt(n),t=ee(t,a)),G(n,t)),V(o,a,e,n)}}}function mn(t,e,n){we(t),Qt(t,e,X,2,!0).push(Ks(n))}var Ae=class{constructor(t,e,n){if(this.buffer=t,n&&!e)throw Error();this.g=e}};function _r(t,e){if(typeof t=="string")return new Ae(Es(t),e);if(Array.isArray(t))return new Ae(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new Ae(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Ae(t,!1);if(t.constructor===At)return e=zn(t)||new Uint8Array(0),new Ae(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Ae(t,!1);throw Error()}function Ee(t,e){let n,r=0,s=0,i=0;const o=t.h;let a=t.g;do n=o[a++],r|=(127&n)<<i,i+=7;while(i<32&&128&n);if(i>32)for(s|=(127&n)>>4,i=3;i<32&&128&n;i+=7)n=o[a++],s|=(127&n)<<i;if(ne(t,a),!(128&n))return e(r>>>0,s>>>0);throw Error()}function yr(t){let e=0,n=t.g;const r=n+10,s=t.h;for(;n<r;){const i=s[n++];if(e|=i,(128&i)==0)return ne(t,n),!!(127&e)}throw Error()}function Ut(t){const e=t.h;let n=t.g,r=e[n++],s=127&r;if(128&r&&(r=e[n++],s|=(127&r)<<7,128&r&&(r=e[n++],s|=(127&r)<<14,128&r&&(r=e[n++],s|=(127&r)<<21,128&r&&(r=e[n++],s|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw Error();return ne(t,n),s}function Ct(t){return Ut(t)>>>0}function _n(t){var e=t.h;const n=t.g;var r=e[n],s=e[n+1];const i=e[n+2];return e=e[n+3],ne(t,t.g+4),t=2*((s=(r<<0|s<<8|i<<16|e<<24)>>>0)>>31)+1,r=s>>>23&255,s&=8388607,r==255?s?NaN:t*(1/0):r==0?1401298464324817e-60*t*s:t*Math.pow(2,r-150)*(s+8388608)}function c2(t){return Ut(t)}function ne(t,e){if(t.g=e,e>t.l)throw Error()}function oi(t,e){if(e<0)throw Error();const n=t.g;if((e=n+e)>t.l)throw Error();return t.g=e,n}function ai(t,e){if(e==0)return zt();var n=oi(t,e);return t.Y&&t.j?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Ga?t.slice(n,e):new Uint8Array(t.subarray(n,e))),n.length==0?zt():new At(n,ce)}var ci=[];function hi(t,e,n,r){if(wn.length){const s=wn.pop();return s.o(r),s.g.init(t,e,n,r),s}return new h2(t,e,n,r)}function ui(t){t.g.clear(),t.l=-1,t.h=-1,wn.length<100&&wn.push(t)}function li(t){var e=t.g;if(e.g==e.l)return!1;t.m=t.g.g;var n=Ct(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5)||e<1)throw Error();return t.l=e,t.h=n,!0}function yn(t){switch(t.h){case 0:t.h!=0?yn(t):yr(t.g);break;case 1:ne(t=t.g,t.g+8);break;case 2:if(t.h!=2)yn(t);else{var e=Ct(t.g);ne(t=t.g,t.g+e)}break;case 5:ne(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!li(t))throw Error();if(t.h==4){if(t.l!=e)throw Error();break}yn(t)}break;default:throw Error()}}function Je(t,e,n){const r=t.g.l;var s=Ct(t.g);let i=(s=t.g.g+s)-r;if(i<=0&&(t.g.l=s,n(e,t,void 0,void 0,void 0),i=s-t.g.g),i)throw Error();return t.g.g=s,t.g.l=r,e}function vr(t){var e=Ct(t.g),n=oi(t=t.g,e);if(t=t.h,wa){var r,s=t;(r=Gn)||(r=Gn=new TextDecoder("utf-8",{fatal:!0})),e=n+e,s=n===0&&e===s.length?s:s.subarray(n,e);try{var i=r.decode(s)}catch(a){if(sn===void 0){try{r.decode(new Uint8Array([128]))}catch{}try{r.decode(new Uint8Array([97])),sn=!0}catch{sn=!1}}throw!sn&&(Gn=void 0),a}}else{e=(i=n)+e,n=[];let a,c=null;for(;i<e;){var o=t[i++];o<128?n.push(o):o<224?i>=e?Kt():(a=t[i++],o<194||(192&a)!=128?(i--,Kt()):n.push((31&o)<<6|63&a)):o<240?i>=e-1?Kt():(a=t[i++],(192&a)!=128||o===224&&a<160||o===237&&a>=160||(192&(r=t[i++]))!=128?(i--,Kt()):n.push((15&o)<<12|(63&a)<<6|63&r)):o<=244?i>=e-2?Kt():(a=t[i++],(192&a)!=128||a-144+(o<<28)>>30||(192&(r=t[i++]))!=128||(192&(s=t[i++]))!=128?(i--,Kt()):(o=(7&o)<<18|(63&a)<<12|(63&r)<<6|63&s,o-=65536,n.push(55296+(o>>10&1023),56320+(1023&o)))):Kt(),n.length>=8192&&(c=ds(c,n),n.length=0)}i=ds(c,n)}return i}function fi(t){const e=Ct(t.g);return ai(t.g,e)}function vn(t,e,n){var r=Ct(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var h2=class{constructor(t,e,n,r){if(ci.length){const s=ci.pop();s.init(t,e,n,r),t=s}else t=new class{constructor(s,i,o,a){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.init(s,i,o,a)}init(s,i,o,{Y:a=!1,ea:c=!1}={}){this.Y=a,this.ea=c,s&&(s=_r(s,this.ea),this.h=s.buffer,this.j=s.g,this.m=i||0,this.l=o!==void 0?this.m+o:this.h.length,this.g=this.m)}clear(){this.h=null,this.j=!1,this.g=this.l=this.m=0,this.Y=!1}}(t,e,n,r);this.g=t,this.m=this.g.g,this.h=this.l=-1,this.o(r)}o({ha:t=!1}={}){this.ha=t}},wn=[];function di(t){return t?/^\d+$/.test(t)?(hn(t),new wr(M,B)):null:u2||(u2=new wr(0,0))}var wr=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let u2;function pi(t){return t?/^-?\d+$/.test(t)?(hn(t),new br(M,B)):null:l2||(l2=new br(0,0))}var br=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let l2;function ke(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function Se(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function bn(t,e){if(e>=0)Se(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Ar(t){var e=M;t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function Te(t,e){e.length!==0&&(t.l.push(e),t.h+=e.length)}function dt(t,e,n){Se(t.g,8*e+n)}function Er(t,e){return dt(t,e,2),e=t.g.end(),Te(t,e),e.push(t.h),e}function kr(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function An(t,e,n){dt(t,e,2),Se(t.g,n.length),Te(t,t.g.end()),Te(t,n)}function En(t,e,n,r){n!=null&&(e=Er(t,e),r(n,t),kr(t,e))}function St(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Sr=St(),gi=St(),Tr=St(),Lr=St(),mi=St(),_i=St(),f2=St(),kn=St(),yi=St(),vi=St();function Tt(t,e,n){var r=t.v;et&&et in r&&(r=r[et])&&delete r[e.g],e.h?e.j(t,e.h,e.g,n,e.l):e.j(t,e.g,n,e.l)}var p=class{constructor(t,e){this.v=Ys(t,e,void 0,2048)}toJSON(){return Xs(this)}j(){var s;var t=X2,e=this.v,n=t.g,r=et;if(le&&r&&((s=e[r])==null?void 0:s[n])!=null&&he(Oa,3),e=t.g,Ls&&et&&Ls===void 0&&(r=(n=this.v)[et])&&(r=r.da))try{r(n,e,e2)}catch(i){gs(i)}return t.h?t.m(this,t.h,t.g,t.l):t.m(this,t.g,t.defaultValue,t.l)}clone(){const t=this.v,e=0|t[d];return hr(this,t,e)?ar(this,t,!0):new this.constructor(ye(t,e,!1))}};p.prototype[fe]=de,p.prototype.toString=function(){return this.v.toString()};var Le=class{constructor(t,e,n){this.g=t,this.h=e,t=Sr,this.l=!!t&&n===t||!1}};function Sn(t,e){return new Le(t,e,Sr)}function wi(t,e,n,r,s){En(t,n,Ti(e,r),s)}const d2=Sn(function(t,e,n,r,s){return t.h===2&&(Je(t,gr(e,r,n),s),!0)},wi),p2=Sn(function(t,e,n,r,s){return t.h===2&&(Je(t,gr(e,r,n),s),!0)},wi);var Tn=Symbol(),Ln=Symbol(),Fr=Symbol(),bi=Symbol(),Ai=Symbol();let Ei,ki;function re(t,e,n,r){var s=r[t];if(s)return s;(s={}).qa=r,s.T=function(f){switch(typeof f){case"boolean":return s2||(s2=[0,void 0,!0]);case"number":return f>0?void 0:f===0?i2||(i2=[0,void 0]):[-f,void 0];case"string":return[0,f];case"object":return f}}(r[0]);var i=r[1];let o=1;i&&i.constructor===Object&&(s.ba=i,typeof(i=r[++o])=="function"&&(s.ma=!0,Ei??(Ei=i),ki??(ki=r[o+1]),i=r[o+=2]));const a={};for(;i&&Array.isArray(i)&&i.length&&typeof i[0]=="number"&&i[0]>0;){for(var c=0;c<i.length;c++)a[i[c]]=i;i=r[++o]}for(c=1;i!==void 0;){let f;typeof i=="number"&&(c+=i,i=r[++o]);var u=void 0;if(i instanceof Le?f=i:(f=d2,o--),f==null?void 0:f.l){i=r[++o],u=r;var h=o;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=r[++o])=="number"&&i<0&&(h-=i,i=r[++o]);c<h;c++){const y=a[c];u?n(s,c,f,u,y):e(s,c,f,y)}}return r[t]=s}function Si(t){return Array.isArray(t)?t[0]instanceof Le?t:[p2,t]:[t,void 0]}function Ti(t,e){return t instanceof p?t.v:Array.isArray(t)?$t(t,e):void 0}function Mr(t,e,n,r){const s=n.g;t[e]=r?(i,o,a)=>s(i,o,a,r):s}function Pr(t,e,n,r,s){const i=n.g;let o,a;t[e]=(c,u,h)=>i(c,u,h,a||(a=re(Ln,Mr,Pr,r).T),o||(o=Or(r)),s)}function Or(t){let e=t[Fr];if(e!=null)return e;const n=re(Ln,Mr,Pr,t);return e=n.ma?(r,s)=>Ei(r,s,n):(r,s)=>{for(;li(s)&&s.h!=4;){var i=s.l,o=n[i];if(o==null){var a=n.ba;a&&(a=a[i])&&(a=m2(a))!=null&&(o=n[i]=a)}if(o==null||!o(s,r,i)){if(o=(a=s).m,yn(a),a.ha)var c=void 0;else c=a.g.g-o,a.g.g=o,c=ai(a.g,c);o=void 0,a=r,c&&((o=a[et]??(a[et]=new or))[i]??(o[i]=[])).push(c)}}return(r=fn(r))&&(r.da=n.qa[Ai]),!0},t[Fr]=e,t[Ai]=g2.bind(t),e}function g2(t,e,n,r){var s=this[Ln];const i=this[Fr],o=$t(void 0,s.T),a=fn(t);if(a){var c=!1,u=s.ba;if(u){if(s=(h,f,y)=>{if(y.length!==0)if(u[f])for(const v of y){h=hi(v);try{c=!0,i(o,h)}finally{ui(h)}}else r==null||r(t,f,y)},e==null)dn(a,s);else if(a!=null){const h=a[e];h&&s(a,e,h)}if(c){let h=0|t[d];if(2&h&&2048&h&&!(n!=null&&n.Ka))throw Error();const f=pe(h),y=(v,I)=>{if(xt(t,v,f)!=null){if((n==null?void 0:n.Qa)===1)return;throw Error()}I!=null&&(h=V(t,h,v,I,f)),delete a[v]};e==null?xs(o,0|o[d],(v,I)=>{y(v,I)}):y(e,xt(o,e,f))}}}}function m2(t){const e=(t=Si(t))[0].g;if(t=t[1]){const n=Or(t),r=re(Ln,Mr,Pr,t).T;return(s,i,o)=>e(s,i,o,r,n)}return e}function Fn(t,e,n){t[e]=n.h}function Mn(t,e,n,r){let s,i;const o=n.h;t[e]=(a,c,u)=>o(a,c,u,i||(i=re(Tn,Fn,Mn,r).T),s||(s=Li(r)))}function Li(t){let e=t[bi];if(!e){const n=re(Tn,Fn,Mn,t);e=(r,s)=>Fi(r,s,n),t[bi]=e}return e}function Fi(t,e,n){xs(t,0|t[d],(r,s)=>{if(s!=null){var i=function(o,a){var c=o[a];if(c)return c;if((c=o.ba)&&(c=c[a])){var u=(c=Si(c))[0].h;if(c=c[1]){const h=Li(c),f=re(Tn,Fn,Mn,c).T;c=o.ma?ki(f,h):(y,v,I)=>u(y,v,I,f,h)}else c=u;return o[a]=c}}(n,r);i?i(e,s,r):r<500||he(Xn,3)}}),(t=fn(t))&&dn(t,(r,s,i)=>{for(Te(e,e.g.end()),r=0;r<i.length;r++)Te(e,zn(i[r])||new Uint8Array(0))})}const _2=rt(0);function Fe(t,e){if(Array.isArray(e)){var n=0|e[d];if(4&n)return e;for(var r=0,s=0;r<e.length;r++){const i=t(e[r]);i!=null&&(e[s++]=i)}return s<r&&(e.length=s),(t=-1537&(5|n))!==n&&G(e,t),2&t&&Object.freeze(e),e}}function J(t,e,n){return new Le(t,e,n)}function Me(t,e,n){return new Le(t,e,n)}function W(t,e,n){V(t,0|t[d],e,n,pe(0|t[d]))}var y2=Sn(function(t,e,n,r,s){if(t.h!==2)return!1;if(t=yt(t=Je(t,$t([void 0,void 0],r),s)),s=pe(r=0|e[d]),2&r)throw Error();let i=xt(e,n,s);if(i instanceof Ot)2&i.J?(i=i.V(),i.push(t),V(e,r,n,i,s)):i.Ma(t);else if(Array.isArray(i)){var o=0|i[d];8192&o||G(i,o|=8192),2&o&&(i=ti(i),V(e,r,n,i,s)),i.push(t)}else V(e,r,n,Ve([t]),s);return!0},function(t,e,n,r,s){if(e instanceof Ot)e.forEach((i,o)=>{En(t,n,$t([o,i],r),s)});else if(Array.isArray(e)){for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&En(t,n,$t(o,r),s)}Ve(e)}});function Mi(t,e,n){(e=kt(e))!=null&&(dt(t,n,5),t=t.g,Jn(e),Ar(t))}function Pi(t,e,n){if(e=function(r){if(r==null)return r;const s=typeof r;if(s==="bigint")return String(We(64,r));if(qe(r)){if(s==="string")return Vs(r);if(s==="number")return nr(r)}}(e),e!=null&&(typeof e=="string"&&pi(e),e!=null))switch(dt(t,n,0),typeof e){case"number":t=t.g,ge(e),ke(t,M,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new br(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),ke(t.g,n.h,n.g);break;default:n=pi(e),ke(t.g,n.h,n.g)}}function Oi(t,e,n){(e=_e(e))!=null&&e!=null&&(dt(t,n,0),bn(t.g,e))}function xi(t,e,n){(e=Us(e))!=null&&(dt(t,n,0),t.g.g.push(e?1:0))}function Ii(t,e,n){(e=X(e))!=null&&An(t,n,ps(e))}function Ni(t,e,n,r,s){En(t,n,Ti(e,r),s)}function Ci(t,e,n){(e=e==null||typeof e=="string"||e instanceof At?e:void 0)!=null&&An(t,n,_r(e,!0).buffer)}function Ri(t,e,n){return(t.h===5||t.h===2)&&(e=be(e,0|e[d],n),t.h==2?vn(t,_n,e):e.push(_n(t.g)),!0)}var D=J(function(t,e,n){return t.h===5&&(W(e,n,_n(t.g)),!0)},Mi,kn),v2=Me(Ri,function(t,e,n){if((e=Fe(kt,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(dt(r,s,5),r=r.g,Jn(i),Ar(r))}},kn),xr=Me(Ri,function(t,e,n){if((e=Fe(kt,e))!=null&&e.length){dt(t,n,2),Se(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Jn(e[r]),Ar(n)}},kn),w2=J(function(t,e,n){return t.h===5&&(W(e,n,(t=_n(t.g))===0?void 0:t),!0)},Mi,kn),jt=J(function(t,e,n){return Hn?(t.h!==0?t=!1:(W(e,n,Ee(t.g,Bs)),t=!0),t):t.h===0&&(W(e,n,Ee(t.g,Qn)),!0)},Pi,_i),Ir=J(function(t,e,n){return Hn?(t.h!==0?e=!1:(W(e,n,(t=Ee(t.g,Bs))===_2?void 0:t),e=!0),e):t.h===0&&(W(e,n,(t=Ee(t.g,Qn))===0?void 0:t),!0)},Pi,_i),b2=J(function(t,e,n){return Hn?(t.h!==0?t=!1:(W(e,n,Ee(t.g,Ha)),t=!0),t):t.h===0&&(W(e,n,Ee(t.g,Zn)),!0)},function(t,e,n){if(e=function(r){if(r==null)return r;var s=typeof r;if(s==="bigint")return String(Wa(64,r));if(qe(r)){if(s==="string")return s=me(Number(r)),Yt(s)&&s>=0?r=String(s):((s=r.indexOf("."))!==-1&&(r=r.substring(0,s)),(s=r[0]!=="-"&&((s=r.length)<20||s===20&&r<="18446744073709551615"))||(hn(r),r=He(M,B))),r;if(s==="number")return(r=me(r))>=0&&Yt(r)||(ge(r),r=Zn(M,B)),r}}(e),e!=null&&(typeof e=="string"&&di(e),e!=null))switch(dt(t,n,0),typeof e){case"number":t=t.g,ge(e),ke(t,M,B);break;case"bigint":n=BigInt.asUintN(64,e),n=new wr(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),ke(t.g,n.h,n.g);break;default:n=di(e),ke(t.g,n.h,n.g)}},f2),K=J(function(t,e,n){return t.h===0&&(W(e,n,Ut(t.g)),!0)},Oi,Lr),Ze=Me(function(t,e,n){return(t.h===0||t.h===2)&&(e=be(e,0|e[d],n),t.h==2?vn(t,Ut,e):e.push(Ut(t.g)),!0)},function(t,e,n){if((e=Fe(_e,e))!=null&&e.length){n=Er(t,n);for(let r=0;r<e.length;r++)bn(t.g,e[r]);kr(t,n)}},Lr),Pe=J(function(t,e,n){return t.h===0&&(W(e,n,(t=Ut(t.g))===0?void 0:t),!0)},Oi,Lr),C=J(function(t,e,n){return t.h===0&&(W(e,n,yr(t.g)),!0)},xi,gi),se=J(function(t,e,n){return t.h===0&&(W(e,n,(t=yr(t.g))===!1?void 0:t),!0)},xi,gi),Y=Me(function(t,e,n){return t.h===2&&(t=vr(t),be(e,0|e[d],n).push(t),!0)},function(t,e,n){if((e=Fe(X,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&An(r,s,ps(i))}},Tr),Gt=J(function(t,e,n){return t.h===2&&(W(e,n,(t=vr(t))===""?void 0:t),!0)},Ii,Tr),S=J(function(t,e,n){return t.h===2&&(W(e,n,vr(t)),!0)},Ii,Tr),z=function(t,e,n=Sr){return new Le(t,e,n)}(function(t,e,n,r,s){return t.h===2&&(r=$t(void 0,r),be(e,0|e[d],n).push(r),Je(t,r,s),!0)},function(t,e,n,r,s){if(Array.isArray(e)){for(let i=0;i<e.length;i++)Ni(t,e[i],n,r,s);1&(t=0|e[d])||G(e,1|t)}}),R=Sn(function(t,e,n,r,s,i){if(t.h!==2)return!1;let o=0|e[d];return ei(e,o,i,n,pe(o)),Je(t,e=gr(e,r,n),s),!0},Ni),Bi=J(function(t,e,n){return t.h===2&&(W(e,n,fi(t)),!0)},Ci,yi),A2=Me(function(t,e,n){return(t.h===0||t.h===2)&&(e=be(e,0|e[d],n),t.h==2?vn(t,Ct,e):e.push(Ct(t.g)),!0)},function(t,e,n){if((e=Fe(js,e))!=null)for(let o=0;o<e.length;o++){var r=t,s=n,i=e[o];i!=null&&(dt(r,s,0),Se(r.g,i))}},mi),E2=J(function(t,e,n){return t.h===0&&(W(e,n,(t=Ct(t.g))===0?void 0:t),!0)},function(t,e,n){(e=js(e))!=null&&e!=null&&(dt(t,n,0),Se(t.g,e))},mi),it=J(function(t,e,n){return t.h===0&&(W(e,n,Ut(t.g)),!0)},function(t,e,n){(e=_e(e))!=null&&(e=parseInt(e,10),dt(t,n,0),bn(t.g,e))},vi);class k2{constructor(e,n){var r=ot;this.g=e,this.h=n,this.m=A,this.j=_,this.defaultValue=void 0,this.l=r.Oa!=null?Is:void 0}register(){on(this)}}function Lt(t,e){return new k2(t,e)}function Vt(t,e){return(n,r)=>{{const i={ea:!0};r&&Object.assign(i,r),n=hi(n,void 0,void 0,i);try{const o=new t,a=o.v;Or(e)(a,n);var s=o}finally{ui(n)}}return s}}function Pn(t){return function(){const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const o=this.g;return this.g=[],o}}}};Fi(this.v,e,re(Tn,Fn,Mn,t)),Te(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,s=r.length;let i=0;for(let o=0;o<s;o++){const a=r[o];n.set(a,i),i+=a.length}return e.l=[n],n}}var Di=class extends p{constructor(t){super(t)}},Ui=[0,Gt,J(function(t,e,n){return t.h===2&&(W(e,n,(t=fi(t))===zt()?void 0:t),!0)},function(t,e,n){if(e!=null){if(e instanceof p){const r=e.Ra;return void(r?(e=r(e),e!=null&&An(t,n,_r(e,!0).buffer)):he(Xn,3))}if(Array.isArray(e))return void he(Xn,3)}Ci(t,e,n)},yi)];let Nr,ji=globalThis.trustedTypes;function Gi(t){var e;return Nr===void 0&&(Nr=function(){let n=null;if(!ji)return n;try{const r=s=>s;n=ji.createPolicy("goog#html",{createHTML:r,createScript:r,createScriptURL:r})}catch{}return n}()),t=(e=Nr)?e.createScriptURL(t):t,new class{constructor(n){this.g=n}toString(){return this.g+""}}(t)}function S2(t,...e){if(e.length===0)return Gi(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Gi(n)}var Vi=[0,K,it,C,-1,Ze,it,-1,C],T2=class extends p{constructor(t){super(t)}},Hi=[0,C,S,C,it,-1,Me(function(t,e,n){return(t.h===0||t.h===2)&&(e=be(e,0|e[d],n),t.h==2?vn(t,c2,e):e.push(Ut(t.g)),!0)},function(t,e,n){if((e=Fe(_e,e))!=null&&e.length){n=Er(t,n);for(let r=0;r<e.length;r++)bn(t.g,e[r]);kr(t,n)}},vi),S,-1,[0,C,-1],it,C,-1],Wi=[0,3,C,-1,2,[0,K],[0,it,C],[0,S,-1],[0]],Ki=[0,S,-2],zi=class extends p{constructor(t){super(t)}},qi=[0],Xi=[0,K,C,1,C,-4],ot=class extends p{constructor(t){super(t,2)}},H={};H[336783863]=[0,S,C,-1,K,[0,[1,2,3,4,5,6,7,8,9],R,qi,R,Hi,R,Ki,R,Xi,R,Vi,R,[0,S,-2],R,[0,S,it],R,Wi,R,[0,it,-1,C]],[0,S],C,[0,[1,3],[2,4],R,[0,Ze],-1,R,[0,Y],-1,z,[0,S,-1]],S];var Yi=[0,Ir,-1,se,-3,Ir,Ze,Gt,Pe,Ir,-1,se,Pe,se,-2,Gt];function L(t,e){mn(t,3,e)}function w(t,e){mn(t,4,e)}var Z=class extends p{constructor(t){super(t,500)}o(t){return _(this,0,7,t)}},Qe=[-1,{}],$i=[0,S,1,Qe],Ji=[0,S,Y,Qe];function pt(t,e){mr(t,1,Z,e)}function P(t,e){mn(t,10,e)}function E(t,e){mn(t,15,e)}var at=class extends p{constructor(t){super(t,500)}o(t){return _(this,0,1001,t)}},Zi=[-500,z,[-500,Gt,-1,Y,-3,[-2,H,C],z,Ui,Pe,-1,$i,Ji,z,[0,Gt,se],Gt,Yi,Pe,Y,987,Y],4,z,[-500,S,-1,[-1,{}],998,S],z,[-500,S,Y,-1,[-2,{},C],997,Y,-1],Pe,z,[-500,S,Y,Qe,998,Y],Y,Pe,$i,Ji,z,[0,Gt,-1,Qe],Y,-2,Yi,Gt,-1,se,[0,se,E2],978,Qe,z,Ui];at.prototype.g=Pn(Zi);var L2=Vt(at,Zi),F2=class extends p{constructor(t){super(t)}},Qi=class extends p{constructor(t){super(t)}g(){return It(this,F2,1)}},to=[0,z,[0,K,D,S,-1]],On=Vt(Qi,to),M2=class extends p{constructor(t){super(t)}},P2=class extends p{constructor(t){super(t)}},Cr=class extends p{constructor(t){super(t)}l(){return A(this,M2,2)}g(){return It(this,P2,5)}},eo=Vt(class extends p{constructor(t){super(t)}},[0,Y,Ze,xr,[0,it,[0,K,-3],[0,D,-3],[0,K,-1,[0,z,[0,K,-2]]],z,[0,D,-1,S,D]],S,-1,jt,z,[0,K,D],Y,jt]),no=class extends p{constructor(t){super(t)}},Oe=Vt(class extends p{constructor(t){super(t)}},[0,z,[0,D,-4]]),ro=class extends p{constructor(t){super(t)}},tn=Vt(class extends p{constructor(t){super(t)}},[0,z,[0,D,-4]]),O2=class extends p{constructor(t){super(t)}},x2=[0,K,-1,xr,it],so=class extends p{constructor(t){super(t)}};so.prototype.g=Pn([0,D,-4,jt]);var I2=class extends p{constructor(t){super(t)}},N2=Vt(class extends p{constructor(t){super(t)}},[0,z,[0,1,K,S,to],jt]),io=class extends p{constructor(t){super(t)}},C2=class extends p{constructor(t){super(t)}na(){const t=T(this,1,void 0,void 0,Qs);return t??zt()}},R2=class extends p{constructor(t){super(t)}},oo=[1,2],B2=Vt(class extends p{constructor(t){super(t)}},[0,z,[0,oo,R,[0,xr],R,[0,Bi],K,S],jt]),Rr=class extends p{constructor(t){super(t)}},ao=[0,S,K,D,Y,-1],co=class extends p{constructor(t){super(t)}},D2=[0,C,-1],ho=class extends p{constructor(t){super(t)}},xn=[1,2,3,4,5,6],In=class extends p{constructor(t){super(t)}g(){return T(this,1,void 0,void 0,Qs)!=null}l(){return X(T(this,2))!=null}},x=class extends p{constructor(t){super(t)}g(){return Us(T(this,2))??!1}},uo=[0,Bi,S,[0,K,jt,-1],[0,b2,jt]],U=[0,uo,C,[0,xn,R,Xi,R,Hi,R,Vi,R,qi,R,Ki,R,Wi],it],Nn=class extends p{constructor(t){super(t)}},Br=[0,U,D,-1,K],U2=Lt(502141897,Nn);H[502141897]=Br;var j2=Vt(class extends p{constructor(t){super(t)}},[0,[0,it,-1,v2,A2],x2]),lo=class extends p{constructor(t){super(t)}},fo=class extends p{constructor(t){super(t)}},Dr=[0,U,D,[0,U],C],G2=Lt(508968150,fo);H[508968150]=[0,U,Br,Dr,D,[0,[0,uo]]],H[508968149]=Dr;var xe=class extends p{constructor(t){super(t)}l(){return A(this,Rr,2)}g(){k(this,2)}},po=[0,U,ao];H[478825465]=po;var V2=class extends p{constructor(t){super(t)}},go=class extends p{constructor(t){super(t)}},Ur=class extends p{constructor(t){super(t)}},jr=class extends p{constructor(t){super(t)}},mo=class extends p{constructor(t){super(t)}},_o=[0,U,[0,U],po,-1],yo=[0,U,D,K],Gr=[0,U,D],vo=[0,U,yo,Gr,D],H2=Lt(479097054,mo);H[479097054]=[0,U,vo,_o],H[463370452]=_o,H[464864288]=yo;var W2=Lt(462713202,jr);H[462713202]=vo,H[474472470]=Gr;var K2=class extends p{constructor(t){super(t)}},wo=class extends p{constructor(t){super(t)}},bo=class extends p{constructor(t){super(t)}},Ao=class extends p{constructor(t){super(t)}},Vr=[0,U,D,-1,K],Hr=[0,U,D,C];Ao.prototype.g=Pn([0,U,Gr,[0,U],Br,Dr,Vr,Hr]);var Eo=class extends p{constructor(t){super(t)}},z2=Lt(456383383,Eo);H[456383383]=[0,U,ao];var ko=class extends p{constructor(t){super(t)}},q2=Lt(476348187,ko);H[476348187]=[0,U,D2];var So=class extends p{constructor(t){super(t)}},To=class extends p{constructor(t){super(t)}},Lo=[0,it,-1],X2=Lt(458105876,class extends p{constructor(t){super(t)}g(){let t;var e=this.v;const n=0|e[d];return t=nt(this,n),e=function(r,s,i,o){var a=To;!o&&ve(r)&&(i=0|(s=r.v)[d]);var c=xt(s,2);if(r=!1,c==null){if(o)return qs();c=[]}else if(c.constructor===Ot){if(!(2&c.J)||o)return c;c=c.V()}else Array.isArray(c)?r=!!(2&(0|c[d])):c=[];if(o){if(!c.length)return qs();r||(r=!0,Ge(c))}else r&&(r=!1,Ve(c),c=ti(c));return!r&&32&i&&je(c,32),i=V(s,i,2,o=new Ot(c,a,Xa,void 0)),r||Jt(s,i),o}(this,e,n,t),!t&&To&&(e.ra=!0),e}});H[458105876]=[0,Lo,y2,[!0,jt,[0,S,-1,Y]],[0,Ze,C,it]];var Wr=class extends p{constructor(t){super(t)}},Fo=Lt(458105758,Wr);H[458105758]=[0,U,S,Lo];var Kr=class extends p{constructor(t){super(t)}},Mo=[0,w2,-1,se],Y2=class extends p{constructor(t){super(t)}},Po=class extends p{constructor(t){super(t)}},zr=[1,2];Po.prototype.g=Pn([0,zr,R,Mo,R,[0,z,Mo]]);var Oo=class extends p{constructor(t){super(t)}},$2=Lt(443442058,Oo);H[443442058]=[0,U,S,K,D,Y,-1,C,D],H[514774813]=Vr;var xo=class extends p{constructor(t){super(t)}},J2=Lt(516587230,xo);function qr(t,e){return e=e?e.clone():new Rr,t.displayNamesLocale!==void 0?k(e,1,Xe(t.displayNamesLocale)):t.displayNamesLocale===void 0&&k(e,1),t.maxResults!==void 0?Nt(e,2,t.maxResults):"maxResults"in t&&k(e,2),t.scoreThreshold!==void 0?m(e,3,t.scoreThreshold):"scoreThreshold"in t&&k(e,3),t.categoryAllowlist!==void 0?gn(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&k(e,4),t.categoryDenylist!==void 0?gn(e,5,t.categoryDenylist):"categoryDenylist"in t&&k(e,5),e}function Io(t){const e=Number(t);return Number.isSafeInteger(e)?e:String(t)}function Xr(t,e=-1,n=""){return{categories:t.map(r=>({index:ft(r,1)??0??-1,score:N(r,2)??0,categoryName:X(T(r,3))??""??"",displayName:X(T(r,4))??""??""})),headIndex:e,headName:n}}function Z2(t){const e={classifications:It(t,I2,1).map(n=>{var r;return Xr(((r=A(n,Qi,4))==null?void 0:r.g())??[],ft(n,2)??0,X(T(n,3))??"")})};return function(n){return qa(Wn?T(n,2,void 0,void 0,ln):T(n,2))}(t)!=null&&(e.timestampMs=Io(ii(t))),e}function No(t){var o,a;var e=Qt(t,3,kt,Zt()),n=Qt(t,2,_e,Zt()),r=Qt(t,1,X,Zt()),s=Qt(t,9,X,Zt());const i={categories:[],keypoints:[]};for(let c=0;c<e.length;c++)i.categories.push({score:e[c],index:n[c]??-1,categoryName:r[c]??"",displayName:s[c]??""});if((e=(o=A(t,Cr,4))==null?void 0:o.l())&&(i.boundingBox={originX:ft(e,1,Bt)??0,originY:ft(e,2,Bt)??0,width:ft(e,3,Bt)??0,height:ft(e,4,Bt)??0,angle:0}),(a=A(t,Cr,4))==null?void 0:a.g().length)for(const c of A(t,Cr,4).g())i.keypoints.push({x:T(c,1,void 0,Bt,kt)??0,y:T(c,2,void 0,Bt,kt)??0,score:T(c,4,void 0,Bt,kt)??0,label:X(T(c,3,void 0,Bt))??""});return i}function Cn(t){const e=[];for(const n of It(t,ro,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function en(t){const e=[];for(const n of It(t,no,1))e.push({x:N(n,1)??0,y:N(n,2)??0,z:N(n,3)??0,visibility:N(n,4)??0});return e}function Co(t){return Array.from(t,e=>e>127?e-256:e)}function Ro(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,s=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i],r+=t[i]*t[i],s+=e[i]*e[i];if(r<=0||s<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*s)}let Rn;H[516587230]=[0,U,Vr,Hr,D],H[518928384]=Hr;const Q2=new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]);async function Bo(){if(Rn===void 0)try{await WebAssembly.instantiate(Q2),Rn=!0}catch{Rn=!1}return Rn}async function nn(t,e=S2``){const n=await Bo()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ie=class{};function Do(){var t=navigator;return typeof OffscreenCanvas<"u"&&(!function(e=navigator){return(e=e.userAgent).includes("Safari")&&!e.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Uo(t){if(typeof importScripts!="function"){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((n,r)=>{e.addEventListener("load",()=>{n()},!1),e.addEventListener("error",s=>{r(s)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;await self.import(t.toString())}}function jo(t){return t.videoWidth!==void 0?[t.videoWidth,t.videoHeight]:t.naturalWidth!==void 0?[t.naturalWidth,t.naturalHeight]:t.displayWidth!==void 0?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function g(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function Go(t,e,n){if(!t.i.canvas)throw Error("No OpenGL canvas configured.");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext("webgl2")||t.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1);const[r,s]=jo(e);return!t.l||r===t.i.canvas.width&&s===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=s),[r,s]}function Vo(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let s=0;s<e.length;s++)r[s]=t.i.stringToNewUTF8(e[s]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const s of r)t.i._free(s);t.i._free(e)}function Ft(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function Ht(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(s,i,o)=>{i?(n(r,o),r=[]):r.push(s)}}ie.forVisionTasks=function(t){return nn("vision",t)},ie.forTextTasks=function(t){return nn("text",t)},ie.forGenAiExperimentalTasks=function(t){return nn("genai_experimental",t)},ie.forGenAiTasks=function(t){return nn("genai",t)},ie.forAudioTasks=function(t){return nn("audio",t)},ie.isSimdSupported=function(){return Bo()};async function t1(t,e,n,r){return t=await(async(s,i,o,a,c)=>{if(i&&await Uo(i),!self.ModuleFactory||o&&(await Uo(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((i=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new s(c,a)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:s=>s.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&s.endsWith(".data")?n.assetBinaryPath.toString():s}),await t.o(r),t}function Yr(t,e){const n=A(t.baseOptions,In,1)||new In;typeof e=="string"?(k(n,2,Xe(e)),k(n,1)):e instanceof Uint8Array&&(k(n,1,Yn(e,!1)),k(n,2)),_(t.baseOptions,0,1,n)}function Ho(t){try{const e=t.H.length;if(e===1)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map(n=>n.message).join(", "))}finally{t.H=[]}}function l(t,e){t.C=Math.max(t.C,e)}function Bn(t,e){t.B=new Z,st(t.B,2,"PassThroughCalculator"),L(t.B,"free_memory"),w(t.B,"free_memory_unused_out"),P(e,"free_memory"),pt(e,t.B)}function Ie(t,e){L(t.B,e),w(t.B,e+"_unused_out")}function Dn(t){t.g.addBoolToStream(!0,"free_memory",t.C)}var $r=class{constructor(t){this.g=t,this.H=[],this.C=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){var n,r,s,i,o,a;if(e){const c=t.baseOptions||{};if((n=t.baseOptions)!=null&&n.modelAssetBuffer&&((r=t.baseOptions)!=null&&r.modelAssetPath))throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!((s=A(this.baseOptions,In,1))!=null&&s.g()||(i=A(this.baseOptions,In,1))!=null&&i.l()||(o=t.baseOptions)!=null&&o.modelAssetBuffer||(a=t.baseOptions)!=null&&a.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(u,h){let f=A(u.baseOptions,ho,3);if(!f){var y=f=new ho,v=new zi;$e(y,4,xn,v)}"delegate"in h&&(h.delegate==="GPU"?(h=f,y=new T2,$e(h,2,xn,y)):(h=f,y=new zi,$e(h,4,xn,y))),_(u.baseOptions,0,3,f)}(this,c),c.modelAssetPath)return fetch(c.modelAssetPath.toString()).then(u=>{if(u.ok)return u.arrayBuffer();throw Error(`Failed to fetch model: ${c.modelAssetPath} (${u.status})`)}).then(u=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(u),!0,!1,!1),Yr(this,"/model.dat"),this.m(),this.L()});if(c.modelAssetBuffer instanceof Uint8Array)Yr(this,c.modelAssetBuffer);else if(c.modelAssetBuffer)return async function(u){const h=[];for(var f=0;;){const{done:y,value:v}=await u.read();if(y)break;h.push(v),f+=v.length}if(h.length===0)return new Uint8Array(0);if(h.length===1)return h[0];u=new Uint8Array(f),f=0;for(const y of h)u.set(y,f),f+=y.length;return u}(c.modelAssetBuffer).then(u=>{Yr(this,u),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}ca(){let t;if(this.g.ca(e=>{t=L2(e)}),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener((n,r)=>{this.H.push(Error(r))}),this.g.Ja(),this.g.setGraph(t,e),this.B=void 0,Ho(this)}finishProcessing(){this.g.finishProcessing(),Ho(this)}close(){this.B=void 0,this.g.closeGraph()}};function Wt(t,e){if(!t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}$r.prototype.close=$r.prototype.close;class e1{constructor(e,n,r,s){this.g=e,this.h=n,this.m=r,this.l=s}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function Wo(t,e,n){const r=t.g;if(n=Wt(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.h,n),n}function Ko(t,e){const n=t.g,r=Wt(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=Wt(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.O),n.vertexAttribPointer(t.O,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=Wt(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.L),n.vertexAttribPointer(t.L,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new e1(n,r,s,i)}function Jr(t,e){if(t.g){if(e!==t.g)throw Error("Cannot change GL context once initialized")}else t.g=e}function n1(t,e,n,r){return Jr(t,e),t.h||(t.m(),t.D()),n?(t.u||(t.u=Ko(t,!0)),n=t.u):(t.A||(t.A=Ko(t,!1)),n=t.A),e.useProgram(t.h),n.bind(),t.l(),t=r(),n.g.bindVertexArray(null),t}function zo(t,e,n){return Jr(t,e),t=Wt(e.createTexture(),"Failed to create texture"),e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,n??e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,n??e.LINEAR),e.bindTexture(e.TEXTURE_2D,null),t}function qo(t,e,n){Jr(t,e),t.B||(t.B=Wt(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,t.B),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function r1(t){var e;(e=t.g)==null||e.bindFramebuffer(t.g.FRAMEBUFFER,null)}var Xo=class{H(){return`
|
|
2
2
|
precision mediump float;
|
|
3
3
|
varying vec2 vTex;
|
|
4
4
|
uniform sampler2D inputTexture;
|
|
5
5
|
void main() {
|
|
6
6
|
gl_FragColor = texture2D(inputTexture, vTex);
|
|
7
7
|
}
|
|
8
|
-
`}m(){const
|
|
8
|
+
`}m(){const t=this.g;if(this.h=Wt(t.createProgram(),"Failed to create WebGL program"),this.X=Wo(this,`
|
|
9
9
|
attribute vec2 aVertex;
|
|
10
10
|
attribute vec2 aTex;
|
|
11
11
|
varying vec2 vTex;
|
|
12
12
|
void main(void) {
|
|
13
13
|
gl_Position = vec4(aVertex, 0.0, 1.0);
|
|
14
14
|
vTex = aTex;
|
|
15
|
-
}`,e.VERTEX_SHADER),this.W=za(this,this.H(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.L=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const e=this.g;e.deleteProgram(this.h),e.deleteShader(this.X),e.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function ht(e,t){switch(t){case 0:return e.g.find(r=>r instanceof Uint8Array);case 1:return e.g.find(r=>r instanceof Float32Array);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Js(e){var t=ht(e,1);if(!t){if(t=ht(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);const n=mr(e);var r=$s(e);if(qa(r,n,$a(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let s=0,i=0;s<t.length;++s,i+=4)t[s]=r[i]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function $a(e){let t=ht(e,2);if(!t){const r=mr(e);t=Qa(e);const n=Js(e),s=Za(e);r.texImage2D(r.TEXTURE_2D,0,s,e.width,e.height,0,r.RED,r.FLOAT,n),Zs(e)}return t}function mr(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=Et(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Za(e){if(e=mr(e),!Fn)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Fn=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Fn=e.R16F}return Fn}function $s(e){return e.l||(e.l=new Ja),e.l}function Qa(e){const t=mr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=ht(e,2);return r||(r=Xa($s(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Zs(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Fn,ae=class{constructor(e,t,r,n,s,i,o){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=s,this.width=i,this.height=o,this.j&&--e2===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!ht(this,0)}ka(){return!!ht(this,1)}R(){return!!ht(this,2)}ja(){return(t=ht(e=this,0))||(t=Js(e),t=new Uint8Array(t.map(r=>Math.round(255*r))),e.g.push(t)),t;var e,t}ia(){return Js(this)}N(){return $a(this)}clone(){const e=[];for(const t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{const n=mr(this),s=$s(this);n.activeTexture(n.TEXTURE1),r=Xa(s,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);const i=Za(this);n.texImage2D(n.TEXTURE_2D,0,i,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),qa(s,n,r),bc(s,n,!1,()=>{Qa(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Zs(this)}),wc(s),Zs(this)}}e.push(r)}return new ae(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mr(this).deleteTexture(ht(this,2)),e2=-1}};ae.prototype.close=ae.prototype.close,ae.prototype.clone=ae.prototype.clone,ae.prototype.getAsWebGLTexture=ae.prototype.N,ae.prototype.getAsFloat32Array=ae.prototype.ia,ae.prototype.getAsUint8Array=ae.prototype.ja,ae.prototype.hasWebGLTexture=ae.prototype.R,ae.prototype.hasFloat32Array=ae.prototype.ka,ae.prototype.hasUint8Array=ae.prototype.Fa;var e2=250;function We(...e){return e.map(([t,r])=>({start:t,end:r}))}const Ec=function(e){return class extends e{Ja(){this.i._registerModelResourcesGraphService()}}}((t2=class{constructor(e,t){this.l=!0,this.i=e,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",t!==void 0?this.i.canvas=t:Ua()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){const t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){const r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),y(this,n||"input_audio",i=>{y(this,s=s||"audio_header",o=>{this.i._configureAudio(i,o,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}ca(e){Qe(this,"__graph_config__",t=>{e(t)}),y(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,s){const i=4*e.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(e,this.g/4),y(this,n,o=>{this.i._addAudioToInputStream(this.g,t,r,o,s)})}addGpuBufferToStream(e,t,r){y(this,t,n=>{const[s,i]=Wa(this,e,n);this.i._addBoundTextureToStream(n,s,i,r)})}addBoolToStream(e,t,r){y(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){y(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){y(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){y(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){y(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){y(this,t,n=>{y(this,e,s=>{this.i._addStringToInputStream(s,n,r)})})}addStringRecordToStream(e,t,r){y(this,t,n=>{Ha(this,Object.keys(e),s=>{Ha(this,Object.values(e),i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){y(this,r,s=>{y(this,t,i=>{const o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputStream(o,e.length,i,s,n),this.i._free(o)})})}addEmptyPacketToStream(e,t){y(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateBoolVector(e.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of e)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,n,r)})}addDoubleVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateDoubleVector(e.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of e)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,n,r)})}addFloatVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateFloatVector(e.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of e)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,n,r)})}addIntVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateIntVector(e.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of e)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,n,r)})}addUintVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateUintVector(e.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of e)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,n,r)})}addStringVectorToStream(e,t,r){y(this,t,n=>{const s=this.i._allocateStringVector(e.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of e)y(this,i,o=>{this.i._addStringVectorEntry(s,o)});this.i._addStringVectorToInputStream(s,n,r)})}addBoolToInputSidePacket(e,t){y(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){y(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){y(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){y(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){y(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){y(this,t,r=>{y(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){y(this,r,n=>{y(this,t,s=>{const i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputSidePacket(i,e.length,s,n),this.i._free(i)})})}addBoolVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const s of e)this.i._addBoolVectorEntry(n,s);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const s of e)this.i._addDoubleVectorEntry(n,s);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const s of e)this.i._addFloatVectorEntry(n,s);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const s of e)this.i._addIntVectorEntry(n,s);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of e)this.i._addUintVectorEntry(n,s);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){y(this,t,r=>{const n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const s of e)y(this,s,i=>{this.i._addStringVectorEntry(n,i)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Qe(this,e,t),y(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){wt(this,e,t),y(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Qe(this,e,t),y(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){wt(this,e,t),y(this,e,n=>{this.i._attachProtoVectorListener(n,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Qe(this,e,(n,s)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,s)}),y(this,e,n=>{this.i._attachAudioListener(n,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends t2{get ga(){return this.i}pa(e,t,r){y(this,t,n=>{const[s,i]=Wa(this,e,n);this.ga._addBoundTextureAsImageToStream(n,s,i,r)})}Z(e,t){Qe(this,e,t),y(this,e,r=>{this.ga._attachImageListener(r)})}aa(e,t){wt(this,e,t),y(this,e,r=>{this.ga._attachImageVectorListener(r)})}}));var t2,He=class extends Ec{};async function L(e,t,r){return async function(n,s,i,o){return yc(n,s,i,o)}(e,r.canvas??(Ua()?void 0:document.createElement("canvas")),t,r)}function r2(e,t,r,n){if(e.U){const i=new aa;if(r!=null&&r.regionOfInterest){if(!e.oa)throw Error("This task doesn't support region-of-interest.");var s=r.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");_(i,1,(s.left+s.right)/2),_(i,2,(s.top+s.bottom)/2),_(i,4,s.right-s.left),_(i,3,s.bottom-s.top)}else _(i,1,.5),_(i,2,.5),_(i,4,1),_(i,3,1);if(r!=null&&r.rotationDegrees){if((r==null?void 0:r.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(_(i,5,-Math.PI*r.rotationDegrees/180),(r==null?void 0:r.rotationDegrees)%180!=0){const[o,c]=Ga(t);r=H(i,3)*c/o,s=H(i,4)*o/c,_(i,4,r),_(i,3,s)}}e.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",e.U,n)}e.g.pa(t,e.X,n??performance.now()),e.finishProcessing()}function Ke(e,t,r){var n;if((n=e.baseOptions)!=null&&n.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");r2(e,t,r,e.C+1)}function et(e,t,r,n){var s;if(!((s=e.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");r2(e,t,r,n)}function vr(e,t,r,n){var s=t.data;const i=t.width,o=i*(t=t.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return e=new ae([s],r,!1,e.g.i.canvas,e.P,i,t),n?e.clone():e}var Pe=class extends Xs{constructor(e,t,r,n){super(e),this.g=e,this.X=t,this.U=r,this.oa=n,this.P=new Ja}l(e,t=!0){if("runningMode"in e&&x(this.baseOptions,2,xr(!!e.runningMode&&e.runningMode!=="IMAGE")),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.P.close(),super.close()}};Pe.prototype.close=Pe.prototype.close;var De=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},w(e=this.h=new Tn,0,1,t=new W),_(this.h,2,.5),_(this.h,3,.3)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&_(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&_(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Ke(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},et(this,e,r,t),this.j}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect_in"),P(e,"detections");const t=new Le;$e(t,nc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect_in"),S(r,"DETECTIONS:detections"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=sa(i),this.j.detections.push(Na(n));g(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};De.prototype.detectForVideo=De.prototype.G,De.prototype.detect=De.prototype.F,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=async function(e,t){return L(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return L(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return L(De,e,t)};var Qs=We([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]),ei=We([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]),ti=We([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),n2=We([474,475],[475,476],[476,477],[477,474]),ri=We([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]),ni=We([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),s2=We([469,470],[470,471],[471,472],[472,469]),si=We([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]),i2=[...Qs,...ei,...ti,...ri,...ni,...si],o2=We([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 a2(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var G=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,w(e=this.h=new ga,0,1,t=new W),this.A=new pa,w(this.h,0,3,this.A),this.u=new Tn,w(this.h,0,2,this.u),ct(this.u,4,1),_(this.u,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numFaces"in e&&ct(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&_(this.A,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}F(e,t){return a2(this),Ke(this,e,t),this.j}G(e,t,r){return a2(this),et(this,e,r,t),this.j}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect"),P(e,"face_landmarks");const t=new Le;$e(t,ic,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,s)=>{for(const i of n)n=Ur(i),this.j.faceLandmarks.push(Ln(n));g(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{g(this,n)}),this.outputFaceBlendshapes&&(P(e,"blendshapes"),S(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,s)=>{if(this.outputFaceBlendshapes)for(const i of n)n=An(i),this.j.faceBlendshapes.push(zs(n.g()??[]));g(this,s)}),this.g.attachEmptyPacketListener("blendshapes",n=>{g(this,n)})),this.outputFacialTransformationMatrixes&&(P(e,"face_geometry"),S(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of n)(n=O(n=sc(i),q1,2))&&this.j.facialTransformationMatrixes.push({rows:Ie(n,1)??0??0,columns:Ie(n,2)??0??0,data:Mt(n,3,qe,xt()).slice()??[]});g(this,s)}),this.g.attachEmptyPacketListener("face_geometry",n=>{g(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};G.prototype.detectForVideo=G.prototype.G,G.prototype.detect=G.prototype.F,G.prototype.setOptions=G.prototype.o,G.createFromModelPath=function(e,t){return L(G,e,{baseOptions:{modelAssetPath:t}})},G.createFromModelBuffer=function(e,t){return L(G,e,{baseOptions:{modelAssetBuffer:t}})},G.createFromOptions=function(e,t){return L(G,e,t)},G.FACE_LANDMARKS_LIPS=Qs,G.FACE_LANDMARKS_LEFT_EYE=ei,G.FACE_LANDMARKS_LEFT_EYEBROW=ti,G.FACE_LANDMARKS_LEFT_IRIS=n2,G.FACE_LANDMARKS_RIGHT_EYE=ri,G.FACE_LANDMARKS_RIGHT_EYEBROW=ni,G.FACE_LANDMARKS_RIGHT_IRIS=s2,G.FACE_LANDMARKS_FACE_OVAL=si,G.FACE_LANDMARKS_CONTOURS=i2,G.FACE_LANDMARKS_TESSELATION=o2;var ii=We([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 c2(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function u2(e){return e.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:e.gestures,landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handedness:e.handedness,handednesses:e.handedness}}function h2(e,t=!0){const r=[];for(const s of e){var n=An(s);e=[];for(const i of n.g())n=t&&Ie(i,1)!=null?Ie(i,1)??0:-1,e.push({score:H(i,2)??0,index:n,categoryName:ce(D(i,3))??""??"",displayName:ce(D(i,4))??""??""});r.push(e)}return r}var Re=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.j=new ya,0,1,t=new W),this.u=new js,w(this.j,0,2,this.u),this.D=new Ds,w(this.u,0,3,this.D),this.A=new va,w(this.u,0,2,this.A),this.h=new oc,w(this.j,0,3,this.h),_(this.A,2,.5),_(this.u,4,.5),_(this.D,2,.5)}get baseOptions(){return O(this.j,W,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){var s,i,o,c;if(ct(this.A,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.A,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.u,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.D,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new pr,r=t,n=Ks(e.cannedGesturesClassifierOptions,(s=O(this.h,pr,3))==null?void 0:s.l());w(r,0,2,n),w(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&((i=O(this.h,pr,3))==null||i.g());return e.customGesturesClassifierOptions?(w(r=t=new pr,0,2,n=Ks(e.customGesturesClassifierOptions,(o=O(this.h,pr,4))==null?void 0:o.l())),w(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&((c=O(this.h,pr,4))==null||c.g()),this.l(e)}Ha(e,t){return c2(this),Ke(this,e,t),u2(this)}Ia(e,t,r){return c2(this),et(this,e,r,t),u2(this)}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect"),P(e,"hand_gestures"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new Le;$e(t,ac,this.j);const r=new ve;Se(r,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),S(r,"HAND_GESTURES:hand_gestures"),S(r,"LANDMARKS:hand_landmarks"),S(r,"WORLD_LANDMARKS:world_hand_landmarks"),S(r,"HANDEDNESS:handedness"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n){n=Ur(i);const o=[];for(const c of at(n,oa,1))o.push({x:H(c,1)??0,y:H(c,2)??0,z:H(c,3)??0,visibility:H(c,4)??0});this.landmarks.push(o)}g(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n){n=dr(i);const o=[];for(const c of at(n,ia,1))o.push({x:H(c,1)??0,y:H(c,2)??0,z:H(c,3)??0,visibility:H(c,4)??0});this.worldLandmarks.push(o)}g(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,s)=>{this.gestures.push(...h2(n,!1)),g(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{g(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{this.handedness.push(...h2(n)),g(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function l2(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Re.prototype.recognizeForVideo=Re.prototype.Ia,Re.prototype.recognize=Re.prototype.Ha,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=function(e,t){return L(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return L(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return L(Re,e,t)},Re.HAND_CONNECTIONS=ii;var ye=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],w(e=this.h=new js,0,1,t=new W),this.u=new Ds,w(this.h,0,3,this.u),this.j=new va,w(this.h,0,2,this.j),ct(this.j,3,1),_(this.j,2,.5),_(this.u,2,.5),_(this.h,4,.5)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numHands"in e&&ct(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ke(this,e,t),l2(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],et(this,e,r,t),l2(this)}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect"),P(e,"hand_landmarks"),P(e,"world_hand_landmarks"),P(e,"handedness");const t=new Le;$e(t,cc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),S(r,"LANDMARKS:hand_landmarks"),S(r,"WORLD_LANDMARKS:world_hand_landmarks"),S(r,"HANDEDNESS:handedness"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,s)=>{for(const i of n)n=Ur(i),this.landmarks.push(Ln(n));g(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,s)=>{for(const i of n)n=dr(i),this.worldLandmarks.push(Vr(n));g(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{g(this,n)}),this.g.attachProtoVectorListener("handedness",(n,s)=>{var i=this.handedness,o=i.push;const c=[];for(const u of n){n=An(u);const f=[];for(const h of n.g())f.push({score:H(h,2)??0,index:Ie(h,1)??0??-1,categoryName:ce(D(h,3))??""??"",displayName:ce(D(h,4))??""??""});c.push(f)}o.call(i,...c),g(this,s)}),this.g.attachEmptyPacketListener("handedness",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ye.prototype.detectForVideo=ye.prototype.G,ye.prototype.detect=ye.prototype.F,ye.prototype.setOptions=ye.prototype.o,ye.createFromModelPath=function(e,t){return L(ye,e,{baseOptions:{modelAssetPath:t}})},ye.createFromModelBuffer=function(e,t){return L(ye,e,{baseOptions:{modelAssetBuffer:t}})},ye.createFromOptions=function(e,t){return L(ye,e,t)},ye.HAND_CONNECTIONS=ii;var f2=We([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 d2(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function p2(e){try{if(!e.D)return e.h;e.D(e.h)}finally{Rn(e)}}function xn(e,t){e=Ur(e),t.push(Ln(e))}var B=class extends Pe{constructor(e,t){super(new He(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,w(e=this.j=new ka,0,1,t=new W),this.I=new Ds,w(this.j,0,2,this.I),this.W=new uc,w(this.j,0,3,this.W),this.u=new Tn,w(this.j,0,4,this.u),this.O=new pa,w(this.j,0,5,this.O),this.A=new Ea,w(this.j,0,6,this.A),this.M=new Aa,w(this.j,0,7,this.M),_(this.u,2,.5),_(this.u,3,.3),_(this.O,2,.5),_(this.A,2,.5),_(this.A,3,.3),_(this.M,2,.5),_(this.I,2,.5)}get baseOptions(){return O(this.j,W,1)}set baseOptions(e){w(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&_(this.u,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&_(this.O,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&_(this.A,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&_(this.A,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&_(this.M,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&_(this.I,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.D=typeof t=="function"?t:r,d2(this),Ke(this,e,n),p2(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.D=typeof r=="function"?r:n,d2(this),et(this,e,s,t),p2(this)}m(){var e=new Oe;V(e,"input_frames_image"),P(e,"pose_landmarks"),P(e,"pose_world_landmarks"),P(e,"face_landmarks"),P(e,"left_hand_landmarks"),P(e,"left_hand_world_landmarks"),P(e,"right_hand_landmarks"),P(e,"right_hand_world_landmarks");const t=new Le,r=new Vo;Se(r,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(s,i){if(i!=null)if(Array.isArray(i))x(s,2,on(i,0,Cr));else{if(!(typeof i=="string"||i instanceof Ye||Wn(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");mt(s,2,Yn(i,!1),Tt())}}(r,this.j.g());const n=new ve;Se(n,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),ps(n,8,Vo,r),j(n,"IMAGE:input_frames_image"),S(n,"POSE_LANDMARKS:pose_landmarks"),S(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),S(n,"FACE_LANDMARKS:face_landmarks"),S(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),S(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),S(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),S(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Ne(e,n),Pn(this,e),this.g.attachProtoListener("pose_landmarks",(s,i)=>{xn(s,this.h.poseLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("pose_world_landmarks",(s,i)=>{var o=this.h.poseWorldLandmarks;s=dr(s),o.push(Vr(s)),g(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{g(this,s)}),this.outputPoseSegmentationMasks&&(S(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),gr(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[vr(this,s,!0,!this.D)],g(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",s=>{this.h.poseSegmentationMasks=[],g(this,s)})),this.g.attachProtoListener("face_landmarks",(s,i)=>{xn(s,this.h.faceLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{g(this,s)}),this.outputFaceBlendshapes&&(P(e,"extra_blendshapes"),S(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=An(s),o.push(zs(s.g()??[]))),g(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{g(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{xn(s,this.h.leftHandLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("left_hand_world_landmarks",(s,i)=>{var o=this.h.leftHandWorldLandmarks;s=dr(s),o.push(Vr(s)),g(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{xn(s,this.h.rightHandLandmarks),g(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",s=>{g(this,s)}),this.g.attachProtoListener("right_hand_world_landmarks",(s,i)=>{var o=this.h.rightHandWorldLandmarks;s=dr(s),o.push(Vr(s)),g(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{g(this,s)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};B.prototype.detectForVideo=B.prototype.G,B.prototype.detect=B.prototype.F,B.prototype.setOptions=B.prototype.o,B.createFromModelPath=function(e,t){return L(B,e,{baseOptions:{modelAssetPath:t}})},B.createFromModelBuffer=function(e,t){return L(B,e,{baseOptions:{modelAssetBuffer:t}})},B.createFromOptions=function(e,t){return L(B,e,t)},B.HAND_CONNECTIONS=ii,B.POSE_CONNECTIONS=f2,B.FACE_LANDMARKS_LIPS=Qs,B.FACE_LANDMARKS_LEFT_EYE=ei,B.FACE_LANDMARKS_LEFT_EYEBROW=ti,B.FACE_LANDMARKS_LEFT_IRIS=n2,B.FACE_LANDMARKS_RIGHT_EYE=ri,B.FACE_LANDMARKS_RIGHT_EYEBROW=ni,B.FACE_LANDMARKS_RIGHT_IRIS=s2,B.FACE_LANDMARKS_FACE_OVAL=si,B.FACE_LANDMARKS_CONTOURS=i2,B.FACE_LANDMARKS_TESSELATION=o2;var je=class extends Pe{constructor(e,t){super(new He(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},w(e=this.h=new Sa,0,1,t=new W)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return w(this.h,0,2,Ks(e,O(this.h,Is,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},Ke(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},et(this,e,r,t),this.j}m(){var e=new Oe;V(e,"input_image"),V(e,"norm_rect"),P(e,"classifications");const t=new Le;$e(t,hc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),j(r,"IMAGE:input_image"),j(r,"NORM_RECT:norm_rect"),S(r,"CLASSIFICATIONS:classifications"),r.o(t),Ne(e,r),this.g.attachProtoListener("classifications",(n,s)=>{this.j=mc(Z1(n)),g(this,s)}),this.g.attachEmptyPacketListener("classifications",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};je.prototype.classifyForVideo=je.prototype.ta,je.prototype.classify=je.prototype.sa,je.prototype.setOptions=je.prototype.o,je.createFromModelPath=function(e,t){return L(je,e,{baseOptions:{modelAssetPath:t}})},je.createFromModelBuffer=function(e,t){return L(je,e,{baseOptions:{modelAssetBuffer:t}})},je.createFromOptions=function(e,t){return L(je,e,t)};var Fe=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!0),this.h=new Ta,this.embeddings={embeddings:[]},w(e=this.h,0,1,t=new W)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){var t=this.h,r=O(this.h,la,2);return r=r?r.clone():new la,e.l2Normalize!==void 0?x(r,1,xr(e.l2Normalize)):"l2Normalize"in e&&x(r,1),e.quantize!==void 0?x(r,2,xr(e.quantize)):"quantize"in e&&x(r,2),w(t,0,2,r),this.l(e)}za(e,t){return Ke(this,e,t),this.embeddings}Aa(e,t,r){return et(this,e,r,t),this.embeddings}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect"),P(e,"embeddings_out");const t=new Le;$e(t,lc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),S(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ne(e,r),this.g.attachProtoListener("embeddings_out",(n,s)=>{n=tc(n),this.embeddings=function(i){return{embeddings:at(i,ec,1).map(o=>{var f,h;const c={headIndex:Ie(o,3)??0??-1,headName:ce(D(o,4))??""??""};var u=o.v;return so(u,0|u[m],ca,hs(o,1))!==void 0?(o=Mt(o=O(o,ca,hs(o,1),void 0),1,qe,xt()),c.floatEmbedding=o.slice()):(u=new Uint8Array(0),c.quantizedEmbedding=((h=(f=O(o,Q1,hs(o,2),void 0))==null?void 0:f.na())==null?void 0:h.h())??u),c}),timestampMs:Ca(ao(i))}}(n),g(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=ja(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=ja(Da(e.quantizedEmbedding),Da(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.Aa,Fe.prototype.embed=Fe.prototype.za,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return L(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return L(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return L(Fe,e,t)};var oi=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};function Ac(e){var r,n;const t=function(s){return at(s,ve,1)}(e.ca()).filter(s=>(ce(D(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(((n=(r=O(t[0],Le,7))==null?void 0:r.j())==null?void 0:n.g())??new Map).forEach((s,i)=>{e.u[Number(i)]=ce(D(s,1))??""})}function g2(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function m2(e){try{const t=new oi(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Rn(e)}}oi.prototype.close=oi.prototype.close;var _e=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Gs,this.A=new La,w(this.h,0,3,this.A),w(e=this.h,0,1,t=new W)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?x(this.h,2,Ir(e.displayNamesLocale)):"displayNamesLocale"in e&&x(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){Ac(this)}segment(e,t,r){const n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,g2(this),Ke(this,e,n),m2(this)}La(e,t,r,n){const s=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,g2(this),et(this,e,s,t),m2(this)}Da(){return this.u}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect");const t=new Le;$e(t,Ra,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),r.o(t),Ne(e,r),Pn(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),gr(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>vr(this,i,!0,!this.j)),g(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],g(this,n)})),this.outputCategoryMask&&(P(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),gr(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=vr(this,n,!1,!this.j),g(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,g(this,n)})),P(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,g(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.getLabels=_e.prototype.Da,_e.prototype.segmentForVideo=_e.prototype.La,_e.prototype.segment=_e.prototype.segment,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return L(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return L(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return L(_e,e,t)};var ai=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){var e,t;(e=this.confidenceMasks)==null||e.forEach(r=>{r.close()}),(t=this.categoryMask)==null||t.close()}};ai.prototype.close=ai.prototype.close;var tt=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Gs,this.u=new La,w(this.h,0,3,this.u),w(e=this.h,0,1,t=new W)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){const s=typeof r!="function"?r:{};if(this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.C+1,n=new xa,t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var i=new Ws;mt(i,3,xr(!0),!1),mt(i,1,Fr(t.keypoint.x),0),mt(i,2,Fr(t.keypoint.y),0),Nr(n,1,Hs,i)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");{const c=new dc;for(i of t.scribble)mt(t=new Ws,3,xr(!0),!1),mt(t,1,Fr(i.x),0),mt(t,2,Fr(i.y),0),ps(c,1,Ws,t);Nr(n,2,Hs,c)}}this.g.addProtoToStream(n.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",r),Ke(this,e,s);e:{try{const c=new ai(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=c;break e}this.j(c)}finally{Rn(this)}o=void 0}return o}m(){var e=new Oe;V(e,"image_in"),V(e,"roi_in"),V(e,"norm_rect_in");const t=new Le;$e(t,Ra,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),j(r,"IMAGE:image_in"),j(r,"ROI:roi_in"),j(r,"NORM_RECT:norm_rect_in"),r.o(t),Ne(e,r),Pn(this,e),this.outputConfidenceMasks&&(P(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),gr(this,"confidence_masks"),this.g.aa("confidence_masks",(n,s)=>{this.confidenceMasks=n.map(i=>vr(this,i,!0,!this.j)),g(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],g(this,n)})),this.outputCategoryMask&&(P(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),gr(this,"category_mask"),this.g.Z("category_mask",(n,s)=>{this.categoryMask=vr(this,n,!1,!this.j),g(this,s)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,g(this,n)})),P(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,s)=>{this.qualityScores=n,g(this,s)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};tt.prototype.segment=tt.prototype.segment,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(e,t){return L(tt,e,{baseOptions:{modelAssetPath:t}})},tt.createFromModelBuffer=function(e,t){return L(tt,e,{baseOptions:{modelAssetBuffer:t}})},tt.createFromOptions=function(e,t){return L(tt,e,t)};var Be=class extends Pe{constructor(e,t){super(new He(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},w(e=this.h=new Ma,0,1,t=new W)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?x(this.h,2,Ir(e.displayNamesLocale)):"displayNamesLocale"in e&&x(this.h,2),e.maxResults!==void 0?ct(this.h,3,e.maxResults):"maxResults"in e&&x(this.h,3),e.scoreThreshold!==void 0?_(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&x(this.h,4),e.categoryAllowlist!==void 0?an(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&x(this.h,5),e.categoryDenylist!==void 0?an(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&x(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Ke(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},et(this,e,r,t),this.j}m(){var e=new Oe;V(e,"input_frame_gpu"),V(e,"norm_rect"),P(e,"detections");const t=new Le;$e(t,pc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),j(r,"IMAGE:input_frame_gpu"),j(r,"NORM_RECT:norm_rect"),S(r,"DETECTIONS:detections"),r.o(t),Ne(e,r),this.g.attachProtoVectorListener("detections",(n,s)=>{for(const i of n)n=sa(i),this.j.detections.push(Na(n));g(this,s)}),this.g.attachEmptyPacketListener("detections",n=>{g(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Be.prototype.detectForVideo=Be.prototype.G,Be.prototype.detect=Be.prototype.F,Be.prototype.setOptions=Be.prototype.o,Be.createFromModelPath=async function(e,t){return L(Be,e,{baseOptions:{modelAssetPath:t}})},Be.createFromModelBuffer=function(e,t){return L(Be,e,{baseOptions:{modelAssetBuffer:t}})},Be.createFromOptions=function(e,t){return L(Be,e,t)};var ci=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){var e;(e=this.segmentationMasks)==null||e.forEach(t=>{t.close()})}};function v2(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function y2(e){try{const t=new ci(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.u)return t;e.u(t)}finally{Rn(e)}}ci.prototype.close=ci.prototype.close;var xe=class extends Pe{constructor(e,t){super(new He(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,w(e=this.h=new Ia,0,1,t=new W),this.A=new Aa,w(this.h,0,3,this.A),this.j=new Ea,w(this.h,0,2,this.j),ct(this.j,4,1),_(this.j,2,.5),_(this.A,2,.5),_(this.h,4,.5)}get baseOptions(){return O(this.h,W,1)}set baseOptions(e){w(this.h,0,1,e)}o(e){return"numPoses"in e&&ct(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&_(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&_(this.A,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){const n=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,v2(this),Ke(this,e,n),y2(this)}G(e,t,r,n){const s=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:n,v2(this),et(this,e,s,t),y2(this)}m(){var e=new Oe;V(e,"image_in"),V(e,"norm_rect"),P(e,"normalized_landmarks"),P(e,"world_landmarks"),P(e,"segmentation_masks");const t=new Le;$e(t,gc,this.h);const r=new ve;Se(r,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),j(r,"IMAGE:image_in"),j(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:normalized_landmarks"),S(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ne(e,r),Pn(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,s)=>{this.landmarks=[];for(const i of n)n=Ur(i),this.landmarks.push(Ln(n));g(this,s)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],g(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,s)=>{this.worldLandmarks=[];for(const i of n)n=dr(i),this.worldLandmarks.push(Vr(n));g(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],g(this,n)}),this.outputSegmentationMasks&&(S(r,"SEGMENTATION_MASK:segmentation_masks"),gr(this,"segmentation_masks"),this.g.aa("segmentation_masks",(n,s)=>{this.segmentationMasks=n.map(i=>vr(this,i,!0,!this.u)),g(this,s)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],g(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xe.prototype.detectForVideo=xe.prototype.G,xe.prototype.detect=xe.prototype.F,xe.prototype.setOptions=xe.prototype.o,xe.createFromModelPath=function(e,t){return L(xe,e,{baseOptions:{modelAssetPath:t}})},xe.createFromModelBuffer=function(e,t){return L(xe,e,{baseOptions:{modelAssetBuffer:t}})},xe.createFromOptions=function(e,t){return L(xe,e,t)},xe.POSE_CONNECTIONS=f2;const kc=["Smile","Blink","Turn_Head","Thumbs_Up"],_2=({apiUrl:e,duration:t=60,smileThreshold:r=.2,blinkThreshold:n=.01,minturnHeadThreshold:s=.15,maxturnHeadThreshold:i=.85,onComplete:o,onError:c})=>{const u=N.useRef(null),f=N.useRef(),h=N.useRef(null),[d,b]=N.useState({face:null,hand:null}),[A,R]=N.useState("loading"),[Ut,Me]=N.useState(""),[ue,Y]=N.useState([]),[lt,Mn]=N.useState(0),[yr,In]=N.useState(t),[_r,Kr]=N.useState(!1),At=N.useRef(lt),kt=N.useRef(_r);N.useEffect(()=>{At.current=lt},[lt]),N.useEffect(()=>{kt.current=_r},[_r]);const Cn=()=>{Y([...kc].sort(()=>.5-Math.random()).slice(0,3))};N.useEffect(()=>{(async()=>{try{const ne=await Bt.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm"),he=await G.createFromOptions(ne,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO"}),le=await ye.createFromOptions(ne,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",numHands:1});b({face:he,hand:le}),Cn(),R("ready")}catch{Me("Failed to load security assets."),R("error")}})()},[]),N.useEffect(()=>(A==="capturing"&&yr>0?h.current=setInterval(()=>In(Z=>Z-1),1e3):yr===0&&A==="capturing"&&R("expired"),()=>clearInterval(h.current)),[A,yr]);const Nn=()=>R("capturing"),rt=()=>{Mn(0),At.current=0,In(t),Kr(!1),kt.current=!1,Me(""),Cn(),R("ready")},ft=(Z,ne)=>{const he=document.createElement("canvas"),le=he.getContext("2d"),be=ne.map(Xr=>Xr.x*Z.videoWidth),C=ne.map(Xr=>Xr.y*Z.videoHeight),pe=Math.min(...be),fe=Math.max(...be),nt=Math.min(...C),st=Math.max(...C),dt=fe-pe,Yr=st-nt,pt=dt*.25;return he.width=224,he.height=224,le.drawImage(Z,pe-pt,nt-pt,dt+pt*2,Yr+pt*2,0,0,224,224),he},Vt=(Z,ne,he)=>{var le,be;if(kt.current)return!1;if(he==="Thumbs_Up"&&((le=ne==null?void 0:ne.landmarks)==null?void 0:le.length)>0){const C=ne.landmarks[0];return C[4].y<C[2].y&&[8,12,16,20].every(pe=>C[pe].y>C[pe-2].y)}if(((be=Z==null?void 0:Z.faceLandmarks)==null?void 0:be.length)>0){const C=Z.faceLandmarks[0];switch(he){case"Smile":return C[291].x-C[61].x>r;case"Blink":return(Math.abs(C[159].y-C[145].y)+Math.abs(C[386].y-C[374].y))/2<n;case"Turn_Head":const fe=(C[1].x-C[33].x)/(C[263].x-C[33].x);return fe<s||fe>i;default:return!1}}return!1},br=N.useCallback(()=>{var be,C,pe;if(A!=="capturing"||!((be=u.current)!=null&&be.video))return;const Z=u.current.video,ne=performance.now(),he=(C=d.face)==null?void 0:C.detectForVideo(Z,ne),le=(pe=d.hand)==null?void 0:pe.detectForVideo(Z,ne);Vt(he,le,ue[At.current])&&(kt.current||(Kr(!0),kt.current=!0,setTimeout(()=>{At.current<ue.length-1?(Mn(fe=>(At.current=fe+1,fe+1)),Kr(!1),kt.current=!1):zr()},1500))),f.current=requestAnimationFrame(br)},[A,d,ue]);N.useEffect(()=>(A==="capturing"&&(f.current=requestAnimationFrame(br)),()=>cancelAnimationFrame(f.current)),[A,br]);const zr=async()=>{var Z,ne;R("verifying");try{const he=u.current.video,le=[];for(let fe=0;fe<5;fe++){const nt=performance.now(),st=(Z=d.face)==null?void 0:Z.detectForVideo(he,nt);(ne=st==null?void 0:st.faceLandmarks)!=null&&ne[0]&&le.push(ft(he,st.faceLandmarks[0]).toDataURL("image/jpeg",.95)),await new Promise(dt=>setTimeout(dt,60))}const be=new FormData;for(let fe=0;fe<le.length;fe++){const nt=await(await fetch(le[fe])).blob();be.append("files",nt,`frame_${fe}.jpg`)}const pe=await(await fetch(`${e}/v1/verify`,{method:"POST",body:be})).json();pe.is_live?(R("success"),o==null||o({success:!0,image:le[le.length-1],skinConfidence:pe.skin_confidence})):(Me(pe.reason||"Spoof detected."),R("error"),c==null||c({success:!1,reason:pe.reason||"Spoof detected."}))}catch{Me("Server unreachable."),R("error"),c==null||c({success:!1,reason:"Server error"})}};return{webcamRef:u,status:A,errorMsg:Ut,sequence:ue,currentStep:lt,timeLeft:yr,isStepTransitioning:_r,start:Nn,reset:rt,sendFinalProof:zr}};var ui={exports:{}},Wr={};/**
|
|
16
|
-
* @license React
|
|
17
|
-
* react-jsx-runtime.production.min.js
|
|
18
|
-
*
|
|
19
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the MIT license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/var b2;function Sc(){if(b2)return Wr;b2=1;var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(c,u,f){var h,d={},b=null,A=null;f!==void 0&&(b=""+f),u.key!==void 0&&(b=""+u.key),u.ref!==void 0&&(A=u.ref);for(h in u)n.call(u,h)&&!i.hasOwnProperty(h)&&(d[h]=u[h]);if(c&&c.defaultProps)for(h in u=c.defaultProps,u)d[h]===void 0&&(d[h]=u[h]);return{$$typeof:t,type:c,key:b,ref:A,props:d,_owner:s.current}}return Wr.Fragment=r,Wr.jsx=o,Wr.jsxs=o,Wr}var Hr={};/**
|
|
24
|
-
* @license React
|
|
25
|
-
* react-jsx-runtime.development.js
|
|
26
|
-
*
|
|
27
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the MIT license found in the
|
|
30
|
-
* LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/var w2;function Tc(){return w2||(w2=1,process.env.NODE_ENV!=="production"&&function(){var e=N,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),R=Symbol.iterator,Ut="@@iterator";function Me(a){if(a===null||typeof a!="object")return null;var l=R&&a[R]||a[Ut];return typeof l=="function"?l:null}var ue=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Y(a){{for(var l=arguments.length,p=new Array(l>1?l-1:0),E=1;E<l;E++)p[E-1]=arguments[E];lt("error",a,p)}}function lt(a,l,p){{var E=ue.ReactDebugCurrentFrame,F=E.getStackAddendum();F!==""&&(l+="%s",p=p.concat([F]));var M=p.map(function(T){return String(T)});M.unshift("Warning: "+l),Function.prototype.apply.call(console[a],console,M)}}var Mn=!1,yr=!1,In=!1,_r=!1,Kr=!1,At;At=Symbol.for("react.module.reference");function kt(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===i||Kr||a===s||a===f||a===h||_r||a===A||Mn||yr||In||typeof a=="object"&&a!==null&&(a.$$typeof===b||a.$$typeof===d||a.$$typeof===o||a.$$typeof===c||a.$$typeof===u||a.$$typeof===At||a.getModuleId!==void 0))}function Cn(a,l,p){var E=a.displayName;if(E)return E;var F=l.displayName||l.name||"";return F!==""?p+"("+F+")":p}function Nn(a){return a.displayName||"Context"}function rt(a){if(a==null)return null;if(typeof a.tag=="number"&&Y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case s:return"StrictMode";case f:return"Suspense";case h:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case c:var l=a;return Nn(l)+".Consumer";case o:var p=a;return Nn(p._context)+".Provider";case u:return Cn(a,a.render,"ForwardRef");case d:var E=a.displayName||null;return E!==null?E:rt(a.type)||"Memo";case b:{var F=a,M=F._payload,T=F._init;try{return rt(T(M))}catch{return null}}}return null}var ft=Object.assign,Vt=0,br,zr,Z,ne,he,le,be;function C(){}C.__reactDisabledLog=!0;function pe(){{if(Vt===0){br=console.log,zr=console.info,Z=console.warn,ne=console.error,he=console.group,le=console.groupCollapsed,be=console.groupEnd;var a={configurable:!0,enumerable:!0,value:C,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}Vt++}}function fe(){{if(Vt--,Vt===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ft({},a,{value:br}),info:ft({},a,{value:zr}),warn:ft({},a,{value:Z}),error:ft({},a,{value:ne}),group:ft({},a,{value:he}),groupCollapsed:ft({},a,{value:le}),groupEnd:ft({},a,{value:be})})}Vt<0&&Y("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var nt=ue.ReactCurrentDispatcher,st;function dt(a,l,p){{if(st===void 0)try{throw Error()}catch(F){var E=F.stack.trim().match(/\n( *(at )?)/);st=E&&E[1]||""}return`
|
|
32
|
-
`+st+a}}var Yr=!1,pt;{var Xr=typeof WeakMap=="function"?WeakMap:Map;pt=new Xr}function E2(a,l){if(!a||Yr)return"";{var p=pt.get(a);if(p!==void 0)return p}var E;Yr=!0;var F=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var M;M=nt.current,nt.current=null,pe();try{if(l){var T=function(){throw Error()};if(Object.defineProperty(T.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(T,[])}catch(we){E=we}Reflect.construct(a,[],T)}else{try{T.call()}catch(we){E=we}a.call(T.prototype)}}else{try{throw Error()}catch(we){E=we}a()}}catch(we){if(we&&E&&typeof we.stack=="string"){for(var k=we.stack.split(`
|
|
33
|
-
`),me=E.stack.split(`
|
|
34
|
-
`),X=k.length-1,Q=me.length-1;X>=1&&Q>=0&&k[X]!==me[Q];)Q--;for(;X>=1&&Q>=0;X--,Q--)if(k[X]!==me[Q]){if(X!==1||Q!==1)do if(X--,Q--,Q<0||k[X]!==me[Q]){var Ve=`
|
|
35
|
-
`+k[X].replace(" at new "," at ");return a.displayName&&Ve.includes("<anonymous>")&&(Ve=Ve.replace("<anonymous>",a.displayName)),typeof a=="function"&&pt.set(a,Ve),Ve}while(X>=1&&Q>=0);break}}}finally{Yr=!1,nt.current=M,fe(),Error.prepareStackTrace=F}var Er=a?a.displayName||a.name:"",Gt=Er?dt(Er):"";return typeof a=="function"&&pt.set(a,Gt),Gt}function Pc(a,l,p){return E2(a,!1)}function Rc(a){var l=a.prototype;return!!(l&&l.isReactComponent)}function Dn(a,l,p){if(a==null)return"";if(typeof a=="function")return E2(a,Rc(a));if(typeof a=="string")return dt(a);switch(a){case f:return dt("Suspense");case h:return dt("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case u:return Pc(a.render);case d:return Dn(a.type,l,p);case b:{var E=a,F=E._payload,M=E._init;try{return Dn(M(F),l,p)}catch{}}}return""}var qr=Object.prototype.hasOwnProperty,A2={},k2=ue.ReactDebugCurrentFrame;function jn(a){if(a){var l=a._owner,p=Dn(a.type,a._source,l?l.type:null);k2.setExtraStackFrame(p)}else k2.setExtraStackFrame(null)}function Fc(a,l,p,E,F){{var M=Function.call.bind(qr);for(var T in a)if(M(a,T)){var k=void 0;try{if(typeof a[T]!="function"){var me=Error((E||"React class")+": "+p+" type `"+T+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[T]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw me.name="Invariant Violation",me}k=a[T](l,T,E,p,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(X){k=X}k&&!(k instanceof Error)&&(jn(F),Y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",E||"React class",p,T,typeof k),jn(null)),k instanceof Error&&!(k.message in A2)&&(A2[k.message]=!0,jn(F),Y("Failed %s type: %s",p,k.message),jn(null))}}}var xc=Array.isArray;function hi(a){return xc(a)}function Mc(a){{var l=typeof Symbol=="function"&&Symbol.toStringTag,p=l&&a[Symbol.toStringTag]||a.constructor.name||"Object";return p}}function Ic(a){try{return S2(a),!1}catch{return!0}}function S2(a){return""+a}function T2(a){if(Ic(a))return Y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Mc(a)),S2(a)}var L2=ue.ReactCurrentOwner,Cc={key:!0,ref:!0,__self:!0,__source:!0},O2,P2;function Nc(a){if(qr.call(a,"ref")){var l=Object.getOwnPropertyDescriptor(a,"ref").get;if(l&&l.isReactWarning)return!1}return a.ref!==void 0}function Dc(a){if(qr.call(a,"key")){var l=Object.getOwnPropertyDescriptor(a,"key").get;if(l&&l.isReactWarning)return!1}return a.key!==void 0}function jc(a,l){typeof a.ref=="string"&&L2.current}function Bc(a,l){{var p=function(){O2||(O2=!0,Y("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(a,"key",{get:p,configurable:!0})}}function Uc(a,l){{var p=function(){P2||(P2=!0,Y("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};p.isReactWarning=!0,Object.defineProperty(a,"ref",{get:p,configurable:!0})}}var Vc=function(a,l,p,E,F,M,T){var k={$$typeof:t,type:a,key:l,ref:p,props:T,_owner:M};return k._store={},Object.defineProperty(k._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(k,"_self",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.defineProperty(k,"_source",{configurable:!1,enumerable:!1,writable:!1,value:F}),Object.freeze&&(Object.freeze(k.props),Object.freeze(k)),k};function Gc(a,l,p,E,F){{var M,T={},k=null,me=null;p!==void 0&&(T2(p),k=""+p),Dc(l)&&(T2(l.key),k=""+l.key),Nc(l)&&(me=l.ref,jc(l,F));for(M in l)qr.call(l,M)&&!Cc.hasOwnProperty(M)&&(T[M]=l[M]);if(a&&a.defaultProps){var X=a.defaultProps;for(M in X)T[M]===void 0&&(T[M]=X[M])}if(k||me){var Q=typeof a=="function"?a.displayName||a.name||"Unknown":a;k&&Bc(T,Q),me&&Uc(T,Q)}return Vc(a,k,me,F,E,L2.current,T)}}var li=ue.ReactCurrentOwner,R2=ue.ReactDebugCurrentFrame;function wr(a){if(a){var l=a._owner,p=Dn(a.type,a._source,l?l.type:null);R2.setExtraStackFrame(p)}else R2.setExtraStackFrame(null)}var fi;fi=!1;function di(a){return typeof a=="object"&&a!==null&&a.$$typeof===t}function F2(){{if(li.current){var a=rt(li.current.type);if(a)return`
|
|
36
|
-
|
|
37
|
-
Check the render method of \``+a+"`."}return""}}function Wc(a){return""}var x2={};function Hc(a){{var l=F2();if(!l){var p=typeof a=="string"?a:a.displayName||a.name;p&&(l=`
|
|
38
|
-
|
|
39
|
-
Check the top-level render call using <`+p+">.")}return l}}function M2(a,l){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var p=Hc(l);if(x2[p])return;x2[p]=!0;var E="";a&&a._owner&&a._owner!==li.current&&(E=" It was passed a child from "+rt(a._owner.type)+"."),wr(a),Y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',p,E),wr(null)}}function I2(a,l){{if(typeof a!="object")return;if(hi(a))for(var p=0;p<a.length;p++){var E=a[p];di(E)&&M2(E,l)}else if(di(a))a._store&&(a._store.validated=!0);else if(a){var F=Me(a);if(typeof F=="function"&&F!==a.entries)for(var M=F.call(a),T;!(T=M.next()).done;)di(T.value)&&M2(T.value,l)}}}function Kc(a){{var l=a.type;if(l==null||typeof l=="string")return;var p;if(typeof l=="function")p=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===u||l.$$typeof===d))p=l.propTypes;else return;if(p){var E=rt(l);Fc(p,a.props,"prop",E,a)}else if(l.PropTypes!==void 0&&!fi){fi=!0;var F=rt(l);Y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",F||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&Y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function zc(a){{for(var l=Object.keys(a.props),p=0;p<l.length;p++){var E=l[p];if(E!=="children"&&E!=="key"){wr(a),Y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",E),wr(null);break}}a.ref!==null&&(wr(a),Y("Invalid attribute `ref` supplied to `React.Fragment`."),wr(null))}}var C2={};function N2(a,l,p,E,F,M){{var T=kt(a);if(!T){var k="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(k+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var me=Wc();me?k+=me:k+=F2();var X;a===null?X="null":hi(a)?X="array":a!==void 0&&a.$$typeof===t?(X="<"+(rt(a.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):X=typeof a,Y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",X,k)}var Q=Gc(a,l,p,F,M);if(Q==null)return Q;if(T){var Ve=l.children;if(Ve!==void 0)if(E)if(hi(Ve)){for(var Er=0;Er<Ve.length;Er++)I2(Ve[Er],a);Object.freeze&&Object.freeze(Ve)}else Y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else I2(Ve,a)}if(qr.call(l,"key")){var Gt=rt(a),we=Object.keys(l).filter(function(Zc){return Zc!=="key"}),pi=we.length>0?"{key: someKey, "+we.join(": ..., ")+": ...}":"{key: someKey}";if(!C2[Gt+pi]){var $c=we.length>0?"{"+we.join(": ..., ")+": ...}":"{}";Y(`A props object containing a "key" prop is being spread into JSX:
|
|
40
|
-
let props = %s;
|
|
41
|
-
<%s {...props} />
|
|
42
|
-
React keys must be passed directly to JSX without using spread:
|
|
43
|
-
let props = %s;
|
|
44
|
-
<%s key={someKey} {...props} />`,pi,Gt,$c,Gt),C2[Gt+pi]=!0}}return a===n?zc(Q):Kc(Q),Q}}function Yc(a,l,p){return N2(a,l,p,!0)}function Xc(a,l,p){return N2(a,l,p,!1)}var qc=Xc,Jc=Yc;Hr.Fragment=n,Hr.jsx=qc,Hr.jsxs=Jc}()),Hr}process.env.NODE_ENV==="production"?ui.exports=Sc():ui.exports=Tc();var Ue=ui.exports;const Lc=({apiUrl:e,duration:t,onComplete:r,onError:n,classNames:s={},render:i,smileThreshold:o,blinkThreshold:c,minturnHeadThreshold:u,maxturnHeadThreshold:f})=>{var d;const h=_2({apiUrl:e,duration:t,smileThreshold:o,blinkThreshold:c,minturnHeadThreshold:u,maxturnHeadThreshold:f,onComplete:r,onError:n});return i?i(h):Ue.jsxs("div",{className:s.container,children:[h.status==="loading"&&Ue.jsx("div",{children:"Initializing..."}),["ready","capturing","verifying"].includes(h.status)&&Ue.jsxs(Ue.Fragment,{children:[Ue.jsx(D2,{ref:h.webcamRef,mirrored:!0,screenshotFormat:"image/jpeg",className:s.webcam}),h.status==="capturing"&&Ue.jsx("div",{className:"liveness-challenge",children:h.isStepTransitioning?"Step verified! Get ready for the next...":`Do this: ${(d=h.sequence[h.currentStep])==null?void 0:d.replace("_"," ")}`}),["capturing","ready"].includes(h.status)&&Ue.jsxs("div",{className:s.timer,children:[h.timeLeft,"s"]}),h.status==="ready"&&Ue.jsx("button",{onClick:h.start,className:s.button,children:"Start Challenge"}),h.status==="verifying"&&Ue.jsx("div",{children:"Analyzing..."})]}),h.status==="error"&&Ue.jsxs("div",{className:s.error,children:[h.errorMsg,Ue.jsx("button",{onClick:h.reset,className:s.button,children:"Retry"})]}),h.status==="success"&&Ue.jsx("div",{className:s.success,children:"Verification Complete"})]})},Oc=async(e,t,r)=>{const n=new FormData;t.forEach((i,o)=>{n.append("files",i,`frame_${o}.jpg`)}),n.append("challenge",r);const s=await fetch(`${e}/v1/verify`,{method:"POST",body:n});if(!s.ok)throw new Error("Network response was not ok");return await s.json()};ze.LivenessSDK=Lc,ze.useLiveness=_2,ze.verifyLiveness=Oc,Object.defineProperty(ze,Symbol.toStringTag,{value:"Module"})});
|
|
15
|
+
}`,t.VERTEX_SHADER),this.W=Wo(this,this.H(),t.FRAGMENT_SHADER),t.linkProgram(this.h),!t.getProgramParameter(this.h,t.LINK_STATUS))throw Error(`Error during program linking: ${t.getProgramInfoLog(this.h)}`);this.O=t.getAttribLocation(this.h,"aVertex"),this.L=t.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){const t=this.g;t.deleteProgram(this.h),t.deleteShader(this.X),t.deleteShader(this.W)}this.B&&this.g.deleteFramebuffer(this.B),this.A&&this.A.close(),this.u&&this.u.close()}};function Rt(t,e){switch(e){case 0:return t.g.find(n=>n instanceof Uint8Array);case 1:return t.g.find(n=>n instanceof Float32Array);case 2:return t.g.find(n=>typeof WebGLTexture<"u"&&n instanceof WebGLTexture);default:throw Error(`Type is not supported: ${e}`)}}function Zr(t){var e=Rt(t,1);if(!e){if(e=Rt(t,0))e=new Float32Array(e).map(r=>r/255);else{e=new Float32Array(t.width*t.height);const r=Ne(t);var n=Qr(t);if(qo(n,r,Yo(t)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){n=new Float32Array(t.width*t.height*4),r.readPixels(0,0,t.width,t.height,r.RGBA,r.FLOAT,n);for(let s=0,i=0;s<e.length;++s,i+=4)e[s]=n[i]}else r.readPixels(0,0,t.width,t.height,r.RED,r.FLOAT,e)}t.g.push(e)}return e}function Yo(t){let e=Rt(t,2);if(!e){const n=Ne(t);e=Jo(t);const r=Zr(t),s=$o(t);n.texImage2D(n.TEXTURE_2D,0,s,t.width,t.height,0,n.RED,n.FLOAT,r),ts(t)}return e}function Ne(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return t.h||(t.h=Wt(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function $o(t){if(t=Ne(t),!Un)if(t.getExtension("EXT_color_buffer_float")&&t.getExtension("OES_texture_float_linear")&&t.getExtension("EXT_float_blend"))Un=t.R32F;else{if(!t.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Un=t.R16F}return Un}function Qr(t){return t.l||(t.l=new Xo),t.l}function Jo(t){const e=Ne(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Rt(t,2);return n||(n=zo(Qr(t),e,t.m?e.LINEAR:e.NEAREST),t.g.push(n),t.j=!0),e.bindTexture(e.TEXTURE_2D,n),n}function ts(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}var Un,q=class{constructor(t,e,n,r,s,i,o){this.g=t,this.m=e,this.j=n,this.canvas=r,this.l=s,this.width=i,this.height=o,this.j&&--Zo===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Rt(this,0)}ka(){return!!Rt(this,1)}R(){return!!Rt(this,2)}ja(){return(e=Rt(t=this,0))||(e=Zr(t),e=new Uint8Array(e.map(n=>Math.round(255*n))),t.g.push(e)),e;var t,e}ia(){return Zr(this)}N(){return Yo(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof Uint8Array)n=new Uint8Array(e);else if(e instanceof Float32Array)n=new Float32Array(e);else{if(!(e instanceof WebGLTexture))throw Error(`Type is not supported: ${e}`);{const r=Ne(this),s=Qr(this);r.activeTexture(r.TEXTURE1),n=zo(s,r,this.m?r.LINEAR:r.NEAREST),r.bindTexture(r.TEXTURE_2D,n);const i=$o(this);r.texImage2D(r.TEXTURE_2D,0,i,this.width,this.height,0,r.RED,r.FLOAT,null),r.bindTexture(r.TEXTURE_2D,null),qo(s,r,n),n1(s,r,!1,()=>{Jo(this),r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT),r.drawArrays(r.TRIANGLE_FAN,0,4),ts(this)}),r1(s),ts(this)}}t.push(n)}return new q(t,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ne(this).deleteTexture(Rt(this,2)),Zo=-1}};q.prototype.close=q.prototype.close,q.prototype.clone=q.prototype.clone,q.prototype.getAsWebGLTexture=q.prototype.N,q.prototype.getAsFloat32Array=q.prototype.ia,q.prototype.getAsUint8Array=q.prototype.ja,q.prototype.hasWebGLTexture=q.prototype.R,q.prototype.hasFloat32Array=q.prototype.ka,q.prototype.hasUint8Array=q.prototype.Fa;var Zo=250;function vt(...t){return t.map(([e,n])=>({start:e,end:n}))}const s1=function(t){return class extends t{Ja(){this.i._registerModelResourcesGraphService()}}}((Qo=class{constructor(t,e){this.l=!0,this.i=t,this.g=null,this.h=0,this.m=typeof this.i._addIntToInputStream=="function",e!==void 0?this.i.canvas=e:Do()?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(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph(new TextEncoder().encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,s){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),g(this,r||"input_audio",i=>{g(this,s=s||"audio_header",o=>{this.i._configureAudio(i,o,t,e??0,n)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}ca(t){Ft(this,"__graph_config__",e=>{t(e)}),g(this,"__graph_config__",e=>{this.i._getGraphConfig(e,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,s){const i=4*t.length;this.h!==i&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(i),this.h=i),this.i.HEAPF32.set(t,this.g/4),g(this,r,o=>{this.i._addAudioToInputStream(this.g,e,n,o,s)})}addGpuBufferToStream(t,e,n){g(this,e,r=>{const[s,i]=Go(this,t,r);this.i._addBoundTextureToStream(r,s,i,n)})}addBoolToStream(t,e,n){g(this,e,r=>{this.i._addBoolToInputStream(t,r,n)})}addDoubleToStream(t,e,n){g(this,e,r=>{this.i._addDoubleToInputStream(t,r,n)})}addFloatToStream(t,e,n){g(this,e,r=>{this.i._addFloatToInputStream(t,r,n)})}addIntToStream(t,e,n){g(this,e,r=>{this.i._addIntToInputStream(t,r,n)})}addUintToStream(t,e,n){g(this,e,r=>{this.i._addUintToInputStream(t,r,n)})}addStringToStream(t,e,n){g(this,e,r=>{g(this,t,s=>{this.i._addStringToInputStream(s,r,n)})})}addStringRecordToStream(t,e,n){g(this,e,r=>{Vo(this,Object.keys(t),s=>{Vo(this,Object.values(t),i=>{this.i._addFlatHashMapToInputStream(s,i,Object.keys(t).length,r,n)})})})}addProtoToStream(t,e,n,r){g(this,n,s=>{g(this,e,i=>{const o=this.i._malloc(t.length);this.i.HEAPU8.set(t,o),this.i._addProtoToInputStream(o,t.length,i,s,r),this.i._free(o)})})}addEmptyPacketToStream(t,e){g(this,t,n=>{this.i._addEmptyPacketToInputStream(n,e)})}addBoolVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateBoolVector(t.length);if(!s)throw Error("Unable to allocate new bool vector on heap.");for(const i of t)this.i._addBoolVectorEntry(s,i);this.i._addBoolVectorToInputStream(s,r,n)})}addDoubleVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateDoubleVector(t.length);if(!s)throw Error("Unable to allocate new double vector on heap.");for(const i of t)this.i._addDoubleVectorEntry(s,i);this.i._addDoubleVectorToInputStream(s,r,n)})}addFloatVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateFloatVector(t.length);if(!s)throw Error("Unable to allocate new float vector on heap.");for(const i of t)this.i._addFloatVectorEntry(s,i);this.i._addFloatVectorToInputStream(s,r,n)})}addIntVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateIntVector(t.length);if(!s)throw Error("Unable to allocate new int vector on heap.");for(const i of t)this.i._addIntVectorEntry(s,i);this.i._addIntVectorToInputStream(s,r,n)})}addUintVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateUintVector(t.length);if(!s)throw Error("Unable to allocate new unsigned int vector on heap.");for(const i of t)this.i._addUintVectorEntry(s,i);this.i._addUintVectorToInputStream(s,r,n)})}addStringVectorToStream(t,e,n){g(this,e,r=>{const s=this.i._allocateStringVector(t.length);if(!s)throw Error("Unable to allocate new string vector on heap.");for(const i of t)g(this,i,o=>{this.i._addStringVectorEntry(s,o)});this.i._addStringVectorToInputStream(s,r,n)})}addBoolToInputSidePacket(t,e){g(this,e,n=>{this.i._addBoolToInputSidePacket(t,n)})}addDoubleToInputSidePacket(t,e){g(this,e,n=>{this.i._addDoubleToInputSidePacket(t,n)})}addFloatToInputSidePacket(t,e){g(this,e,n=>{this.i._addFloatToInputSidePacket(t,n)})}addIntToInputSidePacket(t,e){g(this,e,n=>{this.i._addIntToInputSidePacket(t,n)})}addUintToInputSidePacket(t,e){g(this,e,n=>{this.i._addUintToInputSidePacket(t,n)})}addStringToInputSidePacket(t,e){g(this,e,n=>{g(this,t,r=>{this.i._addStringToInputSidePacket(r,n)})})}addProtoToInputSidePacket(t,e,n){g(this,n,r=>{g(this,e,s=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,s,r),this.i._free(i)})})}addBoolVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const s of t)this.i._addBoolVectorEntry(r,s);this.i._addBoolVectorToInputSidePacket(r,n)})}addDoubleVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const s of t)this.i._addDoubleVectorEntry(r,s);this.i._addDoubleVectorToInputSidePacket(r,n)})}addFloatVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const s of t)this.i._addFloatVectorEntry(r,s);this.i._addFloatVectorToInputSidePacket(r,n)})}addIntVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const s of t)this.i._addIntVectorEntry(r,s);this.i._addIntVectorToInputSidePacket(r,n)})}addUintVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const s of t)this.i._addUintVectorEntry(r,s);this.i._addUintVectorToInputSidePacket(r,n)})}addStringVectorToInputSidePacket(t,e){g(this,e,n=>{const r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const s of t)g(this,s,i=>{this.i._addStringVectorEntry(r,i)});this.i._addStringVectorToInputSidePacket(r,n)})}attachBoolListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachBoolListener(n)})}attachBoolVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachBoolVectorListener(n)})}attachIntListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachIntListener(n)})}attachIntVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachIntVectorListener(n)})}attachUintListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachUintListener(n)})}attachUintVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachUintVectorListener(n)})}attachDoubleListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachDoubleListener(n)})}attachDoubleVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachDoubleVectorListener(n)})}attachFloatListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachFloatListener(n)})}attachFloatVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachFloatVectorListener(n)})}attachStringListener(t,e){Ft(this,t,e),g(this,t,n=>{this.i._attachStringListener(n)})}attachStringVectorListener(t,e){Ht(this,t,e),g(this,t,n=>{this.i._attachStringVectorListener(n)})}attachProtoListener(t,e,n){Ft(this,t,e),g(this,t,r=>{this.i._attachProtoListener(r,n||!1)})}attachProtoVectorListener(t,e,n){Ht(this,t,e),g(this,t,r=>{this.i._attachProtoVectorListener(r,n||!1)})}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Ft(this,t,(r,s)=>{r=new Float32Array(r.buffer,r.byteOffset,r.length/4),e(r,s)}),g(this,t,r=>{this.i._attachAudioListener(r,n||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Qo{get ga(){return this.i}pa(t,e,n){g(this,e,r=>{const[s,i]=Go(this,t,r);this.ga._addBoundTextureAsImageToStream(r,s,i,n)})}Z(t,e){Ft(this,t,e),g(this,t,n=>{this.ga._attachImageListener(n)})}aa(t,e){Ht(this,t,e),g(this,t,n=>{this.ga._attachImageVectorListener(n)})}}));var Qo,wt=class extends s1{};async function b(t,e,n){return async function(r,s,i,o){return t1(r,s,i,o)}(t,n.canvas??(Do()?void 0:document.createElement("canvas")),e,n)}function ta(t,e,n,r){if(t.U){const i=new so;if(n!=null&&n.regionOfInterest){if(!t.oa)throw Error("This task doesn't support region-of-interest.");var s=n.regionOfInterest;if(s.left>=s.right||s.top>=s.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(s.left<0||s.top<0||s.right>1||s.bottom>1)throw Error("Expected RectF values to be in [0,1].");m(i,1,(s.left+s.right)/2),m(i,2,(s.top+s.bottom)/2),m(i,4,s.right-s.left),m(i,3,s.bottom-s.top)}else m(i,1,.5),m(i,2,.5),m(i,4,1),m(i,3,1);if(n!=null&&n.rotationDegrees){if((n==null?void 0:n.rotationDegrees)%90!=0)throw Error("Expected rotation to be a multiple of 90°.");if(m(i,5,-Math.PI*n.rotationDegrees/180),(n==null?void 0:n.rotationDegrees)%180!=0){const[o,a]=jo(e);n=N(i,3)*a/o,s=N(i,4)*o/a,m(i,4,n),m(i,3,s)}}t.g.addProtoToStream(i.g(),"mediapipe.NormalizedRect",t.U,r)}t.g.pa(e,t.X,r??performance.now()),t.finishProcessing()}function bt(t,e,n){var r;if((r=t.baseOptions)!=null&&r.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");ta(t,e,n,t.C+1)}function Mt(t,e,n,r){var s;if(!((s=t.baseOptions)!=null&&s.g()))throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");ta(t,e,n,r)}function Ce(t,e,n,r){var s=e.data;const i=e.width,o=i*(e=e.height);if((s instanceof Uint8Array||s instanceof Float32Array)&&s.length!==o)throw Error("Unsupported channel count: "+s.length/o);return t=new q([s],n,!1,t.g.i.canvas,t.P,i,e),r?t.clone():t}var ct=class extends $r{constructor(t,e,n,r){super(t),this.g=t,this.X=e,this.U=n,this.oa=r,this.P=new Xo}l(t,e=!0){if("runningMode"in t&&k(this.baseOptions,2,ze(!!t.runningMode&&t.runningMode!=="IMAGE")),t.canvas!==void 0&&this.g.i.canvas!==t.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(t,e)}close(){this.P.close(),super.close()}};ct.prototype.close=ct.prototype.close;var gt=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect_in",!1),this.j={detections:[]},_(t=this.h=new Nn,0,1,e=new x),m(this.h,2,.5),m(this.h,3,.3)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return"minDetectionConfidence"in t&&m(this.h,2,t.minDetectionConfidence??.5),"minSuppressionThreshold"in t&&m(this.h,3,t.minSuppressionThreshold??.3),this.l(t)}F(t,e){return this.j={detections:[]},bt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Mt(this,t,n,e),this.j}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect_in"),E(t,"detections");const e=new ot;Tt(e,U2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect_in"),w(n,"DETECTIONS:detections"),n.o(e),pt(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=eo(i),this.j.detections.push(No(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};gt.prototype.detectForVideo=gt.prototype.G,gt.prototype.detect=gt.prototype.F,gt.prototype.setOptions=gt.prototype.o,gt.createFromModelPath=async function(t,e){return b(gt,t,{baseOptions:{modelAssetPath:e}})},gt.createFromModelBuffer=function(t,e){return b(gt,t,{baseOptions:{modelAssetBuffer:e}})},gt.createFromOptions=function(t,e){return b(gt,t,e)};var es=vt([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]),ns=vt([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]),rs=vt([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ea=vt([474,475],[475,476],[476,477],[477,474]),ss=vt([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]),is=vt([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),na=vt([469,470],[470,471],[471,472],[472,469]),os=vt([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]),ra=[...es,...ns,...rs,...ss,...is,...os],sa=vt([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 ia(t){t.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var O=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,_(t=this.h=new fo,0,1,e=new x),this.A=new lo,_(this.h,0,3,this.A),this.u=new Nn,_(this.h,0,2,this.u),Nt(this.u,4,1),m(this.u,2,.5),m(this.A,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return"numFaces"in t&&Nt(this.u,4,t.numFaces??1),"minFaceDetectionConfidence"in t&&m(this.u,2,t.minFaceDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minFacePresenceConfidence"in t&&m(this.A,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in t&&(this.outputFacialTransformationMatrixes=!!t.outputFacialTransformationMatrixes),this.l(t)}F(t,e){return ia(this),bt(this,t,e),this.j}G(t,e,n){return ia(this),Mt(this,t,n,e),this.j}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect"),E(t,"face_landmarks");const e=new ot;Tt(e,G2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:face_landmarks"),n.o(e),pt(t,n),this.g.attachProtoVectorListener("face_landmarks",(r,s)=>{for(const i of r)r=tn(i),this.j.faceLandmarks.push(Cn(r));l(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",r=>{l(this,r)}),this.outputFaceBlendshapes&&(E(t,"blendshapes"),w(n,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(r,s)=>{if(this.outputFaceBlendshapes)for(const i of r)r=On(i),this.j.faceBlendshapes.push(Xr(r.g()??[]));l(this,s)}),this.g.attachEmptyPacketListener("blendshapes",r=>{l(this,r)})),this.outputFacialTransformationMatrixes&&(E(t,"face_geometry"),w(n,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(r,s)=>{if(this.outputFacialTransformationMatrixes)for(const i of r)(r=A(r=j2(i),O2,2))&&this.j.facialTransformationMatrixes.push({rows:ft(r,1)??0??0,columns:ft(r,2)??0??0,data:Qt(r,3,kt,Zt()).slice()??[]});l(this,s)}),this.g.attachEmptyPacketListener("face_geometry",r=>{l(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};O.prototype.detectForVideo=O.prototype.G,O.prototype.detect=O.prototype.F,O.prototype.setOptions=O.prototype.o,O.createFromModelPath=function(t,e){return b(O,t,{baseOptions:{modelAssetPath:e}})},O.createFromModelBuffer=function(t,e){return b(O,t,{baseOptions:{modelAssetBuffer:e}})},O.createFromOptions=function(t,e){return b(O,t,e)},O.FACE_LANDMARKS_LIPS=es,O.FACE_LANDMARKS_LEFT_EYE=ns,O.FACE_LANDMARKS_LEFT_EYEBROW=rs,O.FACE_LANDMARKS_LEFT_IRIS=ea,O.FACE_LANDMARKS_RIGHT_EYE=ss,O.FACE_LANDMARKS_RIGHT_EYEBROW=is,O.FACE_LANDMARKS_RIGHT_IRIS=na,O.FACE_LANDMARKS_FACE_OVAL=os,O.FACE_LANDMARKS_CONTOURS=ra,O.FACE_LANDMARKS_TESSELATION=sa;var as=vt([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 oa(t){t.gestures=[],t.landmarks=[],t.worldLandmarks=[],t.handedness=[]}function aa(t){return t.gestures.length===0?{gestures:[],landmarks:[],worldLandmarks:[],handedness:[],handednesses:[]}:{gestures:t.gestures,landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handedness:t.handedness,handednesses:t.handedness}}function ca(t,e=!0){const n=[];for(const s of t){var r=On(s);t=[];for(const i of r.g())r=e&&ft(i,1)!=null?ft(i,1)??0:-1,t.push({score:N(i,2)??0,index:r,categoryName:X(T(i,3))??""??"",displayName:X(T(i,4))??""??""});n.push(t)}return n}var ht=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(t=this.j=new mo,0,1,e=new x),this.u=new jr,_(this.j,0,2,this.u),this.D=new Ur,_(this.u,0,3,this.D),this.A=new go,_(this.u,0,2,this.A),this.h=new V2,_(this.j,0,3,this.h),m(this.A,2,.5),m(this.u,4,.5),m(this.D,2,.5)}get baseOptions(){return A(this.j,x,1)}set baseOptions(t){_(this.j,0,1,t)}o(t){var s,i,o,a;if(Nt(this.A,3,t.numHands??1),"minHandDetectionConfidence"in t&&m(this.A,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.u,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&m(this.D,2,t.minHandPresenceConfidence??.5),t.cannedGesturesClassifierOptions){var e=new xe,n=e,r=qr(t.cannedGesturesClassifierOptions,(s=A(this.h,xe,3))==null?void 0:s.l());_(n,0,2,r),_(this.h,0,3,e)}else t.cannedGesturesClassifierOptions===void 0&&((i=A(this.h,xe,3))==null||i.g());return t.customGesturesClassifierOptions?(_(n=e=new xe,0,2,r=qr(t.customGesturesClassifierOptions,(o=A(this.h,xe,4))==null?void 0:o.l())),_(this.h,0,4,e)):t.customGesturesClassifierOptions===void 0&&((a=A(this.h,xe,4))==null||a.g()),this.l(t)}Ha(t,e){return oa(this),bt(this,t,e),aa(this)}Ia(t,e,n){return oa(this),Mt(this,t,n,e),aa(this)}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_gestures"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ot;Tt(e,H2,this.j);const n=new Z;st(n,2,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"HAND_GESTURES:hand_gestures"),w(n,"LANDMARKS:hand_landmarks"),w(n,"WORLD_LANDMARKS:world_hand_landmarks"),w(n,"HANDEDNESS:handedness"),n.o(e),pt(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r){r=tn(i);const o=[];for(const a of It(r,ro,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.landmarks.push(o)}l(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("world_hand_landmarks",(r,s)=>{for(const i of r){r=Oe(i);const o=[];for(const a of It(r,no,1))o.push({x:N(a,1)??0,y:N(a,2)??0,z:N(a,3)??0,visibility:N(a,4)??0});this.worldLandmarks.push(o)}l(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("hand_gestures",(r,s)=>{this.gestures.push(...ca(r,!1)),l(this,s)}),this.g.attachEmptyPacketListener("hand_gestures",r=>{l(this,r)}),this.g.attachProtoVectorListener("handedness",(r,s)=>{this.handedness.push(...ca(r)),l(this,s)}),this.g.attachEmptyPacketListener("handedness",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function ha(t){return{landmarks:t.landmarks,worldLandmarks:t.worldLandmarks,handednesses:t.handedness,handedness:t.handedness}}ht.prototype.recognizeForVideo=ht.prototype.Ia,ht.prototype.recognize=ht.prototype.Ha,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(t,e){return b(ht,t,{baseOptions:{modelAssetPath:e}})},ht.createFromModelBuffer=function(t,e){return b(ht,t,{baseOptions:{modelAssetBuffer:e}})},ht.createFromOptions=function(t,e){return b(ht,t,e)},ht.HAND_CONNECTIONS=as;var Q=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],_(t=this.h=new jr,0,1,e=new x),this.u=new Ur,_(this.h,0,3,this.u),this.j=new go,_(this.h,0,2,this.j),Nt(this.j,3,1),m(this.j,2,.5),m(this.u,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return"numHands"in t&&Nt(this.j,3,t.numHands??1),"minHandDetectionConfidence"in t&&m(this.j,2,t.minHandDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minHandPresenceConfidence"in t&&m(this.u,2,t.minHandPresenceConfidence??.5),this.l(t)}F(t,e){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],bt(this,t,e),ha(this)}G(t,e,n){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Mt(this,t,n,e),ha(this)}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect"),E(t,"hand_landmarks"),E(t,"world_hand_landmarks"),E(t,"handedness");const e=new ot;Tt(e,W2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"LANDMARKS:hand_landmarks"),w(n,"WORLD_LANDMARKS:world_hand_landmarks"),w(n,"HANDEDNESS:handedness"),n.o(e),pt(t,n),this.g.attachProtoVectorListener("hand_landmarks",(r,s)=>{for(const i of r)r=tn(i),this.landmarks.push(Cn(r));l(this,s)}),this.g.attachEmptyPacketListener("hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("world_hand_landmarks",(r,s)=>{for(const i of r)r=Oe(i),this.worldLandmarks.push(en(r));l(this,s)}),this.g.attachEmptyPacketListener("world_hand_landmarks",r=>{l(this,r)}),this.g.attachProtoVectorListener("handedness",(r,s)=>{var i=this.handedness,o=i.push;const a=[];for(const c of r){r=On(c);const u=[];for(const h of r.g())u.push({score:N(h,2)??0,index:ft(h,1)??0??-1,categoryName:X(T(h,3))??""??"",displayName:X(T(h,4))??""??""});a.push(u)}o.call(i,...a),l(this,s)}),this.g.attachEmptyPacketListener("handedness",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Q.prototype.detectForVideo=Q.prototype.G,Q.prototype.detect=Q.prototype.F,Q.prototype.setOptions=Q.prototype.o,Q.createFromModelPath=function(t,e){return b(Q,t,{baseOptions:{modelAssetPath:e}})},Q.createFromModelBuffer=function(t,e){return b(Q,t,{baseOptions:{modelAssetBuffer:e}})},Q.createFromOptions=function(t,e){return b(Q,t,e)},Q.HAND_CONNECTIONS=as;var ua=vt([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 la(t){t.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function fa(t){try{if(!t.D)return t.h;t.D(t.h)}finally{Dn(t)}}function jn(t,e){t=tn(t),e.push(Cn(t))}var F=class extends ct{constructor(t,e){super(new wt(t,e),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,_(t=this.j=new Ao,0,1,e=new x),this.I=new Ur,_(this.j,0,2,this.I),this.W=new K2,_(this.j,0,3,this.W),this.u=new Nn,_(this.j,0,4,this.u),this.O=new lo,_(this.j,0,5,this.O),this.A=new wo,_(this.j,0,6,this.A),this.M=new bo,_(this.j,0,7,this.M),m(this.u,2,.5),m(this.u,3,.3),m(this.O,2,.5),m(this.A,2,.5),m(this.A,3,.3),m(this.M,2,.5),m(this.I,2,.5)}get baseOptions(){return A(this.j,x,1)}set baseOptions(t){_(this.j,0,1,t)}o(t){return"minFaceDetectionConfidence"in t&&m(this.u,2,t.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in t&&m(this.u,3,t.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in t&&m(this.O,2,t.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in t&&(this.outputFaceBlendshapes=!!t.outputFaceBlendshapes),"minPoseDetectionConfidence"in t&&m(this.A,2,t.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in t&&m(this.A,3,t.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in t&&m(this.M,2,t.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in t&&(this.outputPoseSegmentationMasks=!!t.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in t&&m(this.I,2,t.minHandLandmarksConfidence??.5),this.l(t)}F(t,e,n){const r=typeof e!="function"?e:{};return this.D=typeof e=="function"?e:n,la(this),bt(this,t,r),fa(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.D=typeof n=="function"?n:r,la(this),Mt(this,t,s,e),fa(this)}m(){var t=new at;P(t,"input_frames_image"),E(t,"pose_landmarks"),E(t,"pose_world_landmarks"),E(t,"face_landmarks"),E(t,"left_hand_landmarks"),E(t,"left_hand_world_landmarks"),E(t,"right_hand_landmarks"),E(t,"right_hand_world_landmarks");const e=new ot,n=new Di;st(n,1,"type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),function(s,i){if(i!=null)if(Array.isArray(i))k(s,2,pn(i,0,Ye));else{if(!(typeof i=="string"||i instanceof At||Kn(i)))throw Error("invalid value in Any.value field: "+i+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Dt(s,2,Yn(i,!1),zt())}}(n,this.j.g());const r=new Z;st(r,2,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),mr(r,8,Di,n),L(r,"IMAGE:input_frames_image"),w(r,"POSE_LANDMARKS:pose_landmarks"),w(r,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),w(r,"FACE_LANDMARKS:face_landmarks"),w(r,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),w(r,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),w(r,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),w(r,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),r.o(e),pt(t,r),Bn(this,t),this.g.attachProtoListener("pose_landmarks",(s,i)=>{jn(s,this.h.poseLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("pose_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("pose_world_landmarks",(s,i)=>{var o=this.h.poseWorldLandmarks;s=Oe(s),o.push(en(s)),l(this,i)}),this.g.attachEmptyPacketListener("pose_world_landmarks",s=>{l(this,s)}),this.outputPoseSegmentationMasks&&(w(r,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ie(this,"pose_segmentation_mask"),this.g.Z("pose_segmentation_mask",(s,i)=>{this.h.poseSegmentationMasks=[Ce(this,s,!0,!this.D)],l(this,i)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",s=>{this.h.poseSegmentationMasks=[],l(this,s)})),this.g.attachProtoListener("face_landmarks",(s,i)=>{jn(s,this.h.faceLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",s=>{l(this,s)}),this.outputFaceBlendshapes&&(E(t,"extra_blendshapes"),w(r,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(s,i)=>{var o=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(s=On(s),o.push(Xr(s.g()??[]))),l(this,i)}),this.g.attachEmptyPacketListener("extra_blendshapes",s=>{l(this,s)})),this.g.attachProtoListener("left_hand_landmarks",(s,i)=>{jn(s,this.h.leftHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("left_hand_world_landmarks",(s,i)=>{var o=this.h.leftHandWorldLandmarks;s=Oe(s),o.push(en(s)),l(this,i)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("right_hand_landmarks",(s,i)=>{jn(s,this.h.rightHandLandmarks),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_landmarks",s=>{l(this,s)}),this.g.attachProtoListener("right_hand_world_landmarks",(s,i)=>{var o=this.h.rightHandWorldLandmarks;s=Oe(s),o.push(en(s)),l(this,i)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",s=>{l(this,s)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};F.prototype.detectForVideo=F.prototype.G,F.prototype.detect=F.prototype.F,F.prototype.setOptions=F.prototype.o,F.createFromModelPath=function(t,e){return b(F,t,{baseOptions:{modelAssetPath:e}})},F.createFromModelBuffer=function(t,e){return b(F,t,{baseOptions:{modelAssetBuffer:e}})},F.createFromOptions=function(t,e){return b(F,t,e)},F.HAND_CONNECTIONS=as,F.POSE_CONNECTIONS=ua,F.FACE_LANDMARKS_LIPS=es,F.FACE_LANDMARKS_LEFT_EYE=ns,F.FACE_LANDMARKS_LEFT_EYEBROW=rs,F.FACE_LANDMARKS_LEFT_IRIS=ea,F.FACE_LANDMARKS_RIGHT_EYE=ss,F.FACE_LANDMARKS_RIGHT_EYEBROW=is,F.FACE_LANDMARKS_RIGHT_IRIS=na,F.FACE_LANDMARKS_FACE_OVAL=os,F.FACE_LANDMARKS_CONTOURS=ra,F.FACE_LANDMARKS_TESSELATION=sa;var mt=class extends ct{constructor(t,e){super(new wt(t,e),"input_image","norm_rect",!0),this.j={classifications:[]},_(t=this.h=new Eo,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return _(this.h,0,2,qr(t,A(this.h,Rr,2))),this.l(t)}sa(t,e){return this.j={classifications:[]},bt(this,t,e),this.j}ta(t,e,n){return this.j={classifications:[]},Mt(this,t,n,e),this.j}m(){var t=new at;P(t,"input_image"),P(t,"norm_rect"),E(t,"classifications");const e=new ot;Tt(e,z2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),L(n,"IMAGE:input_image"),L(n,"NORM_RECT:norm_rect"),w(n,"CLASSIFICATIONS:classifications"),n.o(e),pt(t,n),this.g.attachProtoListener("classifications",(r,s)=>{this.j=Z2(N2(r)),l(this,s)}),this.g.attachEmptyPacketListener("classifications",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};mt.prototype.classifyForVideo=mt.prototype.ta,mt.prototype.classify=mt.prototype.sa,mt.prototype.setOptions=mt.prototype.o,mt.createFromModelPath=function(t,e){return b(mt,t,{baseOptions:{modelAssetPath:e}})},mt.createFromModelBuffer=function(t,e){return b(mt,t,{baseOptions:{modelAssetBuffer:e}})},mt.createFromOptions=function(t,e){return b(mt,t,e)};var ut=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!0),this.h=new ko,this.embeddings={embeddings:[]},_(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){var e=this.h,n=A(this.h,co,2);return n=n?n.clone():new co,t.l2Normalize!==void 0?k(n,1,ze(t.l2Normalize)):"l2Normalize"in t&&k(n,1),t.quantize!==void 0?k(n,2,ze(t.quantize)):"quantize"in t&&k(n,2),_(e,0,2,n),this.l(t)}za(t,e){return bt(this,t,e),this.embeddings}Aa(t,e,n){return Mt(this,t,n,e),this.embeddings}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect"),E(t,"embeddings_out");const e=new ot;Tt(e,q2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"EMBEDDINGS:embeddings_out"),n.o(e),pt(t,n),this.g.attachProtoListener("embeddings_out",(r,s)=>{r=B2(r),this.embeddings=function(i){return{embeddings:It(i,R2,1).map(o=>{var u,h;const a={headIndex:ft(o,3)??0??-1,headName:X(T(o,4))??""??""};var c=o.v;return ni(c,0|c[d],io,fr(o,1))!==void 0?(o=Qt(o=A(o,io,fr(o,1),void 0),1,kt,Zt()),a.floatEmbedding=o.slice()):(c=new Uint8Array(0),a.quantizedEmbedding=((h=(u=A(o,C2,fr(o,2),void 0))==null?void 0:u.na())==null?void 0:h.h())??c),a}),timestampMs:Io(ii(i))}}(r),l(this,s)}),this.g.attachEmptyPacketListener("embeddings_out",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ut.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Ro(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Ro(Co(t.quantizedEmbedding),Co(e.quantizedEmbedding))}return t},ut.prototype.embedForVideo=ut.prototype.Aa,ut.prototype.embed=ut.prototype.za,ut.prototype.setOptions=ut.prototype.o,ut.createFromModelPath=function(t,e){return b(ut,t,{baseOptions:{modelAssetPath:e}})},ut.createFromModelBuffer=function(t,e){return b(ut,t,{baseOptions:{modelAssetBuffer:e}})},ut.createFromOptions=function(t,e){return b(ut,t,e)};var cs=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){var t,e;(t=this.confidenceMasks)==null||t.forEach(n=>{n.close()}),(e=this.categoryMask)==null||e.close()}};function i1(t){var n,r;const e=function(s){return It(s,Z,1)}(t.ca()).filter(s=>(X(T(s,1))??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(t.u=[],e.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");e.length===1&&(((r=(n=A(e[0],ot,7))==null?void 0:n.j())==null?void 0:r.g())??new Map).forEach((s,i)=>{t.u[Number(i)]=X(T(s,1))??""})}function da(t){t.categoryMask=void 0,t.confidenceMasks=void 0,t.qualityScores=void 0}function pa(t){try{const e=new cs(t.confidenceMasks,t.categoryMask,t.qualityScores);if(!t.j)return e;t.j(e)}finally{Dn(t)}}cs.prototype.close=cs.prototype.close;var tt=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Wr,this.A=new So,_(this.h,0,3,this.A),_(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Xe(t.displayNamesLocale)):"displayNamesLocale"in t&&k(this.h,2),"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}L(){i1(this)}segment(t,e,n){const r=typeof e!="function"?e:{};return this.j=typeof e=="function"?e:n,da(this),bt(this,t,r),pa(this)}La(t,e,n,r){const s=typeof n!="function"?n:{};return this.j=typeof n=="function"?n:r,da(this),Mt(this,t,s,e),pa(this)}Da(){return this.u}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect");const e=new ot;Tt(e,Fo,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),n.o(e),pt(t,n),Bn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),Ie(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ce(this,i,!0,!this.j)),l(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",r=>{this.confidenceMasks=[],l(this,r)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),Ie(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ce(this,r,!1,!this.j),l(this,s)}),this.g.attachEmptyPacketListener("category_mask",r=>{this.categoryMask=void 0,l(this,r)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(r,s)=>{this.qualityScores=r,l(this,s)}),this.g.attachEmptyPacketListener("quality_scores",r=>{this.categoryMask=void 0,l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};tt.prototype.getLabels=tt.prototype.Da,tt.prototype.segmentForVideo=tt.prototype.La,tt.prototype.segment=tt.prototype.segment,tt.prototype.setOptions=tt.prototype.o,tt.createFromModelPath=function(t,e){return b(tt,t,{baseOptions:{modelAssetPath:e}})},tt.createFromModelBuffer=function(t,e){return b(tt,t,{baseOptions:{modelAssetBuffer:e}})},tt.createFromOptions=function(t,e){return b(tt,t,e)};var hs=class{constructor(t,e,n){this.confidenceMasks=t,this.categoryMask=e,this.qualityScores=n}close(){var t,e;(t=this.confidenceMasks)==null||t.forEach(n=>{n.close()}),(e=this.categoryMask)==null||e.close()}};hs.prototype.close=hs.prototype.close;var Pt=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Wr,this.u=new So,_(this.h,0,3,this.u),_(t=this.h,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return"outputCategoryMask"in t&&(this.outputCategoryMask=t.outputCategoryMask??!1),"outputConfidenceMasks"in t&&(this.outputConfidenceMasks=t.outputConfidenceMasks??!0),super.l(t)}segment(t,e,n,r){const s=typeof n!="function"?n:{};if(this.j=typeof n=="function"?n:r,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,n=this.C+1,r=new Po,e.keypoint&&e.scribble)throw Error("Cannot provide both keypoint and scribble.");if(e.keypoint){var i=new Kr;Dt(i,3,ze(!0),!1),Dt(i,1,Ke(e.keypoint.x),0),Dt(i,2,Ke(e.keypoint.y),0),$e(r,1,zr,i)}else{if(!e.scribble)throw Error("Must provide either a keypoint or a scribble.");{const a=new Y2;for(i of e.scribble)Dt(e=new Kr,3,ze(!0),!1),Dt(e,1,Ke(i.x),0),Dt(e,2,Ke(i.y),0),mr(a,1,Kr,e);$e(r,2,zr,a)}}this.g.addProtoToStream(r.g(),"mediapipe.tasks.vision.interactive_segmenter.proto.RegionOfInterest","roi_in",n),bt(this,t,s);t:{try{const a=new hs(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var o=a;break t}this.j(a)}finally{Dn(this)}o=void 0}return o}m(){var t=new at;P(t,"image_in"),P(t,"roi_in"),P(t,"norm_rect_in");const e=new ot;Tt(e,Fo,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraphV2"),L(n,"IMAGE:image_in"),L(n,"ROI:roi_in"),L(n,"NORM_RECT:norm_rect_in"),n.o(e),pt(t,n),Bn(this,t),this.outputConfidenceMasks&&(E(t,"confidence_masks"),w(n,"CONFIDENCE_MASKS:confidence_masks"),Ie(this,"confidence_masks"),this.g.aa("confidence_masks",(r,s)=>{this.confidenceMasks=r.map(i=>Ce(this,i,!0,!this.j)),l(this,s)}),this.g.attachEmptyPacketListener("confidence_masks",r=>{this.confidenceMasks=[],l(this,r)})),this.outputCategoryMask&&(E(t,"category_mask"),w(n,"CATEGORY_MASK:category_mask"),Ie(this,"category_mask"),this.g.Z("category_mask",(r,s)=>{this.categoryMask=Ce(this,r,!1,!this.j),l(this,s)}),this.g.attachEmptyPacketListener("category_mask",r=>{this.categoryMask=void 0,l(this,r)})),E(t,"quality_scores"),w(n,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(r,s)=>{this.qualityScores=r,l(this,s)}),this.g.attachEmptyPacketListener("quality_scores",r=>{this.categoryMask=void 0,l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Pt.prototype.segment=Pt.prototype.segment,Pt.prototype.setOptions=Pt.prototype.o,Pt.createFromModelPath=function(t,e){return b(Pt,t,{baseOptions:{modelAssetPath:e}})},Pt.createFromModelBuffer=function(t,e){return b(Pt,t,{baseOptions:{modelAssetBuffer:e}})},Pt.createFromOptions=function(t,e){return b(Pt,t,e)};var _t=class extends ct{constructor(t,e){super(new wt(t,e),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},_(t=this.h=new Oo,0,1,e=new x)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return t.displayNamesLocale!==void 0?k(this.h,2,Xe(t.displayNamesLocale)):"displayNamesLocale"in t&&k(this.h,2),t.maxResults!==void 0?Nt(this.h,3,t.maxResults):"maxResults"in t&&k(this.h,3),t.scoreThreshold!==void 0?m(this.h,4,t.scoreThreshold):"scoreThreshold"in t&&k(this.h,4),t.categoryAllowlist!==void 0?gn(this.h,5,t.categoryAllowlist):"categoryAllowlist"in t&&k(this.h,5),t.categoryDenylist!==void 0?gn(this.h,6,t.categoryDenylist):"categoryDenylist"in t&&k(this.h,6),this.l(t)}F(t,e){return this.j={detections:[]},bt(this,t,e),this.j}G(t,e,n){return this.j={detections:[]},Mt(this,t,n,e),this.j}m(){var t=new at;P(t,"input_frame_gpu"),P(t,"norm_rect"),E(t,"detections");const e=new ot;Tt(e,$2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.ObjectDetectorGraph"),L(n,"IMAGE:input_frame_gpu"),L(n,"NORM_RECT:norm_rect"),w(n,"DETECTIONS:detections"),n.o(e),pt(t,n),this.g.attachProtoVectorListener("detections",(r,s)=>{for(const i of r)r=eo(i),this.j.detections.push(No(r));l(this,s)}),this.g.attachEmptyPacketListener("detections",r=>{l(this,r)}),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};_t.prototype.detectForVideo=_t.prototype.G,_t.prototype.detect=_t.prototype.F,_t.prototype.setOptions=_t.prototype.o,_t.createFromModelPath=async function(t,e){return b(_t,t,{baseOptions:{modelAssetPath:e}})},_t.createFromModelBuffer=function(t,e){return b(_t,t,{baseOptions:{modelAssetBuffer:e}})},_t.createFromOptions=function(t,e){return b(_t,t,e)};var us=class{constructor(t,e,n){this.landmarks=t,this.worldLandmarks=e,this.segmentationMasks=n}close(){var t;(t=this.segmentationMasks)==null||t.forEach(e=>{e.close()})}};function ga(t){t.landmarks=[],t.worldLandmarks=[],t.segmentationMasks=void 0}function ma(t){try{const e=new us(t.landmarks,t.worldLandmarks,t.segmentationMasks);if(!t.u)return e;t.u(e)}finally{Dn(t)}}us.prototype.close=us.prototype.close;var lt=class extends ct{constructor(t,e){super(new wt(t,e),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,_(t=this.h=new xo,0,1,e=new x),this.A=new bo,_(this.h,0,3,this.A),this.j=new wo,_(this.h,0,2,this.j),Nt(this.j,4,1),m(this.j,2,.5),m(this.A,2,.5),m(this.h,4,.5)}get baseOptions(){return A(this.h,x,1)}set baseOptions(t){_(this.h,0,1,t)}o(t){return"numPoses"in t&&Nt(this.j,4,t.numPoses??1),"minPoseDetectionConfidence"in t&&m(this.j,2,t.minPoseDetectionConfidence??.5),"minTrackingConfidence"in t&&m(this.h,4,t.minTrackingConfidence??.5),"minPosePresenceConfidence"in t&&m(this.A,2,t.minPosePresenceConfidence??.5),"outputSegmentationMasks"in t&&(this.outputSegmentationMasks=t.outputSegmentationMasks??!1),this.l(t)}F(t,e,n){const r=typeof e!="function"?e:{};return this.u=typeof e=="function"?e:n,ga(this),bt(this,t,r),ma(this)}G(t,e,n,r){const s=typeof n!="function"?n:{};return this.u=typeof n=="function"?n:r,ga(this),Mt(this,t,s,e),ma(this)}m(){var t=new at;P(t,"image_in"),P(t,"norm_rect"),E(t,"normalized_landmarks"),E(t,"world_landmarks"),E(t,"segmentation_masks");const e=new ot;Tt(e,J2,this.h);const n=new Z;st(n,2,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),L(n,"IMAGE:image_in"),L(n,"NORM_RECT:norm_rect"),w(n,"NORM_LANDMARKS:normalized_landmarks"),w(n,"WORLD_LANDMARKS:world_landmarks"),n.o(e),pt(t,n),Bn(this,t),this.g.attachProtoVectorListener("normalized_landmarks",(r,s)=>{this.landmarks=[];for(const i of r)r=tn(i),this.landmarks.push(Cn(r));l(this,s)}),this.g.attachEmptyPacketListener("normalized_landmarks",r=>{this.landmarks=[],l(this,r)}),this.g.attachProtoVectorListener("world_landmarks",(r,s)=>{this.worldLandmarks=[];for(const i of r)r=Oe(i),this.worldLandmarks.push(en(r));l(this,s)}),this.g.attachEmptyPacketListener("world_landmarks",r=>{this.worldLandmarks=[],l(this,r)}),this.outputSegmentationMasks&&(w(n,"SEGMENTATION_MASK:segmentation_masks"),Ie(this,"segmentation_masks"),this.g.aa("segmentation_masks",(r,s)=>{this.segmentationMasks=r.map(i=>Ce(this,i,!0,!this.u)),l(this,s)}),this.g.attachEmptyPacketListener("segmentation_masks",r=>{this.segmentationMasks=[],l(this,r)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};lt.prototype.detectForVideo=lt.prototype.G,lt.prototype.detect=lt.prototype.F,lt.prototype.setOptions=lt.prototype.o,lt.createFromModelPath=function(t,e){return b(lt,t,{baseOptions:{modelAssetPath:e}})},lt.createFromModelBuffer=function(t,e){return b(lt,t,{baseOptions:{modelAssetBuffer:e}})},lt.createFromOptions=function(t,e){return b(lt,t,e)},lt.POSE_CONNECTIONS=ua;const o1=["Smile","Blink","Turn_Head","Thumbs_Up"];class _a{constructor(e){va(this,"_detectLoop",()=>{var i,o;if(this.state.status!=="capturing"||!this.videoElement)return;const e=performance.now(),n=(i=this.models.face)==null?void 0:i.detectForVideo(this.videoElement,e),r=(o=this.models.hand)==null?void 0:o.detectForVideo(this.videoElement,e),s=this.state.sequence[this.state.currentStep];this._checkAction(n,r,s)?this._handleStepCompletion():this.requestRef=requestAnimationFrame(this._detectLoop)});this.options={apiUrl:e.apiUrl,duration:e.duration||60,smileThreshold:e.smileThreshold||.2,blinkThreshold:e.blinkThreshold||.01,minTurnHead:e.minTurnHead||.15,maxTurnHead:e.maxTurnHead||.85,onStateChange:e.onStateChange||(()=>{})},this.models={face:null,hand:null},this.state={status:"loading",sequence:[],currentStep:0,timeLeft:this.options.duration,isStepTransitioning:!1,errorMsg:""},this.videoElement=null,this.requestRef=null,this.timerInterval=null}async init(e){this.videoElement=e;try{const n=await ie.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.3/wasm");this.models.face=await O.createFromOptions(n,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task",delegate:"GPU"},outputFaceBlendshapes:!0,runningMode:"VIDEO"}),this.models.hand=await Q.createFromOptions(n,{baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task",delegate:"GPU"},runningMode:"VIDEO",numHands:1}),this._generateSequence(),this._updateState({status:"ready"})}catch{this._updateState({status:"error",errorMsg:"Failed to load security assets."})}}start(){this.state.status==="ready"&&(this._updateState({status:"capturing"}),this._startTimer(),this._detectLoop())}reset(){this.stop(),this._generateSequence(),this._updateState({status:"ready",currentStep:0,timeLeft:this.options.duration,isStepTransitioning:!1,errorMsg:""})}stop(){cancelAnimationFrame(this.requestRef),clearInterval(this.timerInterval)}_updateState(e){this.state={...this.state,...e},this.options.onStateChange(this.state)}_generateSequence(){const e=[...o1].sort(()=>.5-Math.random()).slice(0,3);this._updateState({sequence:e})}_startTimer(){this.timerInterval=setInterval(()=>{const e=this.state.timeLeft-1;e<=0?(this.stop(),this._updateState({timeLeft:0,status:"expired"})):this._updateState({timeLeft:e})},1e3)}_handleStepCompletion(){this.state.isStepTransitioning||(this._updateState({isStepTransitioning:!0}),setTimeout(()=>{this.state.currentStep<this.state.sequence.length-1?(this._updateState({currentStep:this.state.currentStep+1,isStepTransitioning:!1}),this._detectLoop()):this._sendFinalProof()},1500))}_checkAction(e,n,r){var s,i;if(this.state.isStepTransitioning)return!1;if(r==="Thumbs_Up"&&((s=n==null?void 0:n.landmarks)==null?void 0:s.length)>0){const o=n.landmarks[0];return o[4].y<o[2].y&&[8,12,16,20].every(a=>o[a].y>o[a-2].y)}if(((i=e==null?void 0:e.faceLandmarks)==null?void 0:i.length)>0){const o=e.faceLandmarks[0];switch(r){case"Smile":return o[291].x-o[61].x>this.options.smileThreshold;case"Blink":return(Math.abs(o[159].y-o[145].y)+Math.abs(o[386].y-o[374].y))/2<this.options.blinkThreshold;case"Turn_Head":const c=(o[1].x-o[33].x)/(o[263].x-o[33].x);return c<this.options.minTurnHead||c>this.options.maxTurnHead}}return!1}async _sendFinalProof(){this.stop(),this._updateState({status:"verifying"});try{const e=await this._captureFrames(),n=new FormData;for(let i=0;i<e.length;i++){const o=await(await fetch(e[i])).blob();n.append("files",o,`frame_${i}.jpg`)}const s=await(await fetch(`${this.options.apiUrl}/v1/verify`,{method:"POST",body:n})).json();s.is_live?this._updateState({status:"success"}):this._updateState({status:"error",errorMsg:s.reason||"Spoof detected."})}catch{this._updateState({status:"error",errorMsg:"Server unreachable."})}}async _captureFrames(){var n,r;const e=[];for(let s=0;s<5;s++){const i=(n=this.models.face)==null?void 0:n.detectForVideo(this.videoElement,performance.now());(r=i==null?void 0:i.faceLandmarks)!=null&&r[0]&&e.push(this._getFaceCrop(this.videoElement,i.faceLandmarks[0])),await new Promise(o=>setTimeout(o,60))}return e}_getFaceCrop(e,n){const r=document.createElement("canvas"),s=r.getContext("2d"),i=n.map(I=>I.x*e.videoWidth),o=n.map(I=>I.y*e.videoHeight),a=Math.min(...i),c=Math.max(...i),u=Math.min(...o),h=Math.max(...o),f=c-a,y=h-u,v=f*.25;return r.width=224,r.height=224,s.drawImage(e,a-v,u-v,f+v*2,y+v*2,0,0,224,224),r.toDataURL("image/jpeg",.95)}}const a1=t=>{var i;const[e,n]=j.useState({status:"loading",sequence:[],currentStep:0,timeLeft:t.duration||60,isStepTransitioning:!1,errorMsg:""}),r=j.useRef(null),s=j.useRef(null);return j.useEffect(()=>(r.current=new _a({...t,onStateChange:o=>n(o)}),()=>{var o;return(o=r.current)==null?void 0:o.stop()}),[]),j.useEffect(()=>{var o;(o=s.current)!=null&&o.video&&e.status==="loading"&&r.current.init(s.current.video)},[(i=s.current)==null?void 0:i.video]),{...e,webcamRef:s,start:j.useCallback(()=>{var o;return(o=r.current)==null?void 0:o.start()},[]),reset:j.useCallback(()=>{var o;return(o=r.current)==null?void 0:o.reset()},[])}};$.LivenessEngine=_a,$.useLiveness=a1,$.verifyLiveness=oe,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|