@pexip/media-processor 18.3.0 → 18.5.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +26 -28
  3. package/dist/common/backends/webgl/blender.d.ts +5 -4
  4. package/dist/common/backends/webgl/blender.js +4 -9
  5. package/dist/common/backends/webgl/blur.d.ts +3 -0
  6. package/dist/common/backends/webgl/blur.js +3 -0
  7. package/dist/common/backends/webgl/canvas.d.ts +3 -0
  8. package/dist/common/backends/webgl/canvas.js +3 -0
  9. package/dist/common/backends/webgl/renderer.js +18 -6
  10. package/dist/common/backends/webgl/shaders/blendFragmentShader.d.ts +1 -1
  11. package/dist/common/backends/webgl/shaders/blendFragmentShader.js +1 -43
  12. package/dist/common/backends/webgl/shaders/smoothingMaskFragmentShader.d.ts +1 -0
  13. package/dist/common/backends/webgl/shaders/smoothingMaskFragmentShader.js +57 -0
  14. package/dist/common/backends/webgl/smoothingMask.d.ts +12 -0
  15. package/dist/common/backends/webgl/smoothingMask.js +100 -0
  16. package/dist/common/backends/webgl/texture.d.ts +3 -0
  17. package/dist/common/backends/webgl/texture.js +3 -0
  18. package/dist/common/backends/webgl/textureToTexture.d.ts +8 -0
  19. package/dist/common/backends/webgl/textureToTexture.js +92 -0
  20. package/dist/common/tsconfig.tsbuildinfo +1 -1
  21. package/dist/common/types/segmentation.d.ts +6 -3
  22. package/dist/main/tsconfig.tsbuildinfo +1 -1
  23. package/dist/main/video/segmenters/mediapipe.d.ts +23 -3
  24. package/dist/main/video/segmenters/mediapipe.js +12 -3
  25. package/dist/main/video/videoStreamTrackProcessor.d.ts +6 -0
  26. package/dist/main/video/videoStreamTrackProcessor.js +6 -0
  27. package/dist/workers/mediaWorker.js +36 -22
  28. package/dist/workers/tsconfig.tsbuildinfo +1 -1
  29. package/dist/worklets/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +9 -6
@@ -1,18 +1,18 @@
1
- var cr=typeof self<"u"?self:{};function ti(e){e:{for(var t=["CLOSURE_FLAGS"],r=cr,n=0;n<t.length;n++)if((r=r[t[n]])==null){t=null;break e}t=r}return(e=t&&t[e])!=null&&e}function _t(){throw Error("Invalid UTF8")}function Qo(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var _r,mn,x2=typeof TextDecoder<"u",A2,w2=typeof TextEncoder<"u";function ri(e){if(w2)e=(A2||(A2=new TextEncoder)).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)n[r++]=t;else{if(2048>t)n[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let s=e.charCodeAt(++o);if(56320<=s&&57343>=s){t=1024*(t-55296)+s-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}o--}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}var or,ni=ti(610401301),R2=ti(188588736),es=cr.navigator;function wn(e){return!!ni&&!!or&&or.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Ce(e){var t;return(t=cr.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function ot(){return!!ni&&!!or&&0<or.brands.length}function gn(){return ot()?wn("Chromium"):(Ce("Chrome")||Ce("CriOS"))&&!(!ot()&&Ce("Edge"))||Ce("Silk")}function Kn(e){return Kn[" "](e),e}or=es&&es.userAgentData||null,Kn[" "]=function(){};var S2=!ot()&&(Ce("Trident")||Ce("MSIE"));!Ce("Android")||gn(),gn(),Ce("Safari")&&(gn()||!ot()&&Ce("Coast")||!ot()&&Ce("Opera")||!ot()&&Ce("Edge")||(ot()?wn("Microsoft Edge"):Ce("Edg/"))||ot()&&wn("Opera"));var oi={},$t=null;function k2(e){var t=e.length,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);var n=new Uint8Array(r),o=0;return function(s,i){function a(b){for(;c<s.length;){var A=s.charAt(c++),x=$t[A];if(x!=null)return x;if(!/^[\s\xa0]*$/.test(A))throw Error("Unknown base64 encoding at char: "+A)}return b}si();for(var c=0;;){var u=a(-1),h=a(0),f=a(64),m=a(64);if(m===64&&u===-1)break;i(u<<2|h>>4),f!=64&&(i(h<<4&240|f>>2),m!=64&&i(f<<6&192|m))}}(e,function(s){n[o++]=s}),o!==r?n.subarray(0,o):n}function si(){if(!$t){$t={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=e.concat(t[r].split(""));oi[r]=n;for(var o=0;o<n.length;o++){var s=n[o];$t[s]===void 0&&($t[s]=o)}}}}var ii=typeof Uint8Array<"u",ai=!S2&&typeof btoa=="function";function ts(e){if(!ai){var t;t===void 0&&(t=0),si(),t=oi[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,u=0;for(;c<e.length-2;c+=3){var o=e[c],s=e[c+1],i=e[c+2],a=t[o>>2];o=t[(3&o)<<4|s>>4],s=t[(15&s)<<2|i>>6],i=t[63&i],r[u++]=a+o+s+i}switch(a=0,i=n,e.length-c){case 2:i=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[u]=t[e>>2]+t[(3&e)<<4|a>>4]+i+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var rs=/[-_.]/g,C2={"-":"+",_:"/",".":"="};function F2(e){return C2[e]||""}function ci(e){if(!ai)return k2(e);rs.test(e)&&(e=e.replace(rs,F2)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function ur(e){return ii&&e!=null&&e instanceof Uint8Array}var L2;function Wr(){return L2||(L2=new Uint8Array(0))}var Ft={},I2;function ui(e){if(e!==Ft)throw Error("illegal external caller")}function At(){return I2||(I2=new Qe(null,Ft))}function $n(e){ui(Ft);var t=e.g;return(t=t==null||ur(t)?t:typeof t=="string"?ci(t):null)==null?t:e.g=t}var Qe=class{constructor(e,t){if(ui(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}h(){let e=$n(this);return e?new Uint8Array(e):Wr()}};function hi(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function qn(){return Error("Failed to read varint, encoding is invalid.")}function li(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Jn(e){if(typeof e=="string")return{buffer:ci(e),P:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),P:!1};if(e.constructor===Uint8Array)return{buffer:e,P:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),P:!1};if(e.constructor===Qe)return{buffer:$n(e)||Wr(),P:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),P:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Zn(){return typeof BigInt=="function"}var M2=typeof Uint8Array.prototype.slice=="function",fi,G=0,te=0;function Tt(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[n,o]=to(r,e);e=o,r=n}G=r>>>0,te=e>>>0}function Qn(e){let t=fi||(fi=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),te=0,G=t.getUint32(0,!0)}function Rn(e,t){return 4294967296*t+(e>>>0)}function eo(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=Rn(e,t),r?-e:e}function Ir(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else Zn()?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,1e7<=e&&(r+=Math.floor(e/1e7),e%=1e7),1e7<=r&&(t+=Math.floor(r/1e7),r%=1e7),r=t+ns(r)+ns(e));return r}function ns(e){return e=String(e),"0000000".slice(e.length)+e}function di(){var e=G,t=te;if(2147483648&t)if(Zn())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=to(e,t);e="-"+Ir(r,n)}else e=Ir(e,t);return e}function Xr(e){if(16>e.length)Tt(Number(e));else if(Zn())e=BigInt(e),G=Number(e&BigInt(4294967295))>>>0,te=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");te=G=0;let r=e.length;for(let n=t,o=(r-t)%6+t;o<=r;n=o,o+=6){let s=Number(e.slice(n,o));te*=1e6,G=1e6*G+s,4294967296<=G&&(te+=Math.trunc(G/4294967296),te>>>=0,G>>>=0)}if(t){let[n,o]=to(G,te);G=n,te=o}}}function to(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ro(e,t){let r,n=0,o=0,s=0,i=e.h,a=e.g;do r=i[a++],n|=(127&r)<<s,s+=7;while(32>s&&128&r);for(32<s&&(o|=(127&r)>>4),s=3;32>s&&128&r;s+=7)r=i[a++],o|=(127&r)<<s;if(Et(e,a),128>r)return t(n>>>0,o>>>0);throw qn()}function no(e){let t=0,r=e.g,n=r+10,o=e.h;for(;r<n;){let s=o[r++];if(t|=s,(128&s)==0)return Et(e,r),!!(127&t)}throw qn()}function it(e){let t=e.h,r=e.g,n=t[r++],o=127&n;if(128&n&&(n=t[r++],o|=(127&n)<<7,128&n&&(n=t[r++],o|=(127&n)<<14,128&n&&(n=t[r++],o|=(127&n)<<21,128&n&&(n=t[r++],o|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw qn();return Et(e,r),o}function at(e){return it(e)>>>0}function Sn(e){var t=e.h;let r=e.g,n=t[r],o=t[r+1],s=t[r+2];return t=t[r+3],Et(e,e.g+4),(n<<0|o<<8|s<<16|t<<24)>>>0}function kn(e){var t=Sn(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:1/0*e:r==0?e*Math.pow(2,-149)*t:e*Math.pow(2,r-150)*(t+Math.pow(2,23))}function O2(e){return it(e)}function yn(e,t,{ca:r=!1}={}){e.ca=r,t&&(t=Jn(t),e.h=t.buffer,e.m=t.P,e.j=0,e.l=e.h.length,e.g=e.j)}function Et(e,t){if(e.g=t,t>e.l)throw li(e.l,t)}function pi(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw li(t,e.l-r);return e.g=n,r}function mi(e,t){if(t==0)return At();var r=pi(e,t);return e.ca&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?Wr():M2?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?At():new Qe(r,Ft)}var os=[];function gi(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=at(e.g);if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw hi(r,e.l);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function Ar(e){switch(e.h){case 0:e.h!=0?Ar(e):no(e.g);break;case 1:Et(e=e.g,e.g+8);break;case 2:if(e.h!=2)Ar(e);else{var t=at(e.g);Et(e=e.g,e.g+t)}break;case 5:Et(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!gi(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Ar(e)}break;default:throw hi(e.h,e.l)}}function hr(e,t,r){let n=e.g.l,o=at(e.g),s=e.g.g+o,i=s-n;if(0>=i&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-i} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=n,t}function oo(e){var t=at(e.g),r=pi(e=e.g,t);if(e=e.h,x2){var n,o=e;(n=mn)||(n=mn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var s=n.decode(o)}catch(a){if(_r===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),_r=!0}catch{_r=!1}}throw!_r&&(mn=void 0),a}}else{t=(s=r)+t,r=[];let a,c=null;for(;s<t;){var i=e[s++];128>i?r.push(i):224>i?s>=t?_t():(a=e[s++],194>i||(192&a)!=128?(s--,_t()):r.push((31&i)<<6|63&a)):240>i?s>=t-1?_t():(a=e[s++],(192&a)!=128||i===224&&160>a||i===237&&160<=a||(192&(n=e[s++]))!=128?(s--,_t()):r.push((15&i)<<12|(63&a)<<6|63&n)):244>=i?s>=t-2?_t():(a=e[s++],(192&a)!=128||a-144+(i<<28)>>30||(192&(n=e[s++]))!=128||(192&(o=e[s++]))!=128?(s--,_t()):(i=(7&i)<<18|(63&a)<<12|(63&n)<<6|63&o,i-=65536,r.push(55296+(i>>10&1023),56320+(1023&i)))):_t(),8192<=r.length&&(c=Qo(c,r),r.length=0)}s=Qo(c,r)}return s}function yi(e){let t=at(e.g);return mi(e.g,t)}function Hr(e,t,r){var n=at(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Tr=[];function ss(e){return e?/^\d+$/.test(e)?(Xr(e),new is(G,te)):null:P2||(P2=new is(0,0))}var is=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},P2;function as(e){return e?/^-?\d+$/.test(e)?(Xr(e),new cs(G,te)):null:U2||(U2=new cs(0,0))}var cs=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},U2;function Mr(e,t,r){for(;0<r||127<t;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function lr(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function zr(e,t){if(0<=t)lr(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function sr(e,t){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 Lt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ie(e,t,r){lr(e.g,8*t+r)}function so(e,t){return Ie(e,t,2),t=e.g.end(),Lt(e,t),t.push(e.h),t}function io(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;127<r;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function Yr(e,t,r){Ie(e,t,2),lr(e.g,r.length),Lt(e,e.g.end()),Lt(e,r)}function Cn(e,t,r,n){r!=null&&(t=so(e,t),n(r,e),io(e,t))}var ct=class{constructor(t,r,n,o){this.g=t,this.h=r,this.l=n,this.pa=o}};function be(e){return Array.prototype.slice.call(e)}function Kr(e){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():e}var We=Kr(),us=Kr("0di"),vn=Kr("2ex"),hs=Kr("0dg"),ao=We?(e,t)=>{e[We]|=t}:(e,t)=>{e.g!==void 0?e.g|=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}})},Or=We?(e,t)=>{e[We]&=~t}:(e,t)=>{e.g!==void 0&&(e.g&=~t)};function ae(e,t,r){return r?e|t:e&~t}var $=We?e=>0|e[We]:e=>0|e.g,M=We?e=>e[We]:e=>e.g,K=We?(e,t)=>(e[We]=t,e):(e,t)=>(e.g!==void 0?e.g=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}}),e);function Nt(e){return ao(e,34),e}function D2(e,t){K(t,-14591&(0|e))}function Fn(e,t){K(t,-14557&(34|e))}function vi(e){return(e=e>>14&1023)===0?536870912:e}var co,fr={},_i={};function ls(e){return!(!e||typeof e!="object"||e.Ja!==_i)}function uo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function ho(e,t,r){if(e!=null){if(typeof e=="string")e=e?new Qe(e,Ft):At();else if(e.constructor!==Qe)if(ur(e))e=e.length?new Qe(r?e:new Uint8Array(e),Ft):At();else{if(!t)throw Error();e=void 0}}return e}function Pr(e,t,r){if(!Array.isArray(e)||e.length)return!1;let n=$(e);return!!(1&n)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&(K(e,1|n),!0)}var fs=[];function Ye(e){if(2&e)throw Error()}K(fs,55),co=Object.freeze(fs);var Ur=class e{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new e(this.g,this.h,this.m)}},st,B2,N2;function Ti(e,t){(t=st?t[st]:void 0)&&(e[st]=be(t))}function Ei(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function bi(){let e=Error();Ei(e,"incident"),function(t){cr.setTimeout(()=>{throw t},0)}(e)}function Ln(e){return Ei(e=Error(e),"warning"),e}function dt(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function xi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}Object.freeze(new class{}),Object.freeze(new class{});var G2=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function $r(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&G2.test(e)}function Gt(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?0|e:void 0}function V2(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?e>>>0:void 0}function ds(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Ai(e){return e[0]==="-"?20>e.length||e.length===20&&-922337<Number(e.substring(0,7)):19>e.length||e.length===19&&922337>Number(e.substring(0,6))}function lo(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(Tt(e),e=eo(G,te)),e}function fo(e){var t=Math.trunc(Number(e));return Number.isSafeInteger(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ai(e)||(Xr(e),e=di()),e)}function Dr(e){return e==null?e:$r(e)?typeof e=="number"?lo(e):fo(e):void 0}function dr(e){if(typeof e!="string")throw Error();return e}function Vt(e){if(e!=null&&typeof e!="string")throw Error();return e}function bt(e){return e==null||typeof e=="string"?e:void 0}function po(e,t,r,n){if(e!=null&&typeof e=="object"&&e.X===fr)return e;if(!Array.isArray(e))return r?2&n?(e=t[us])?t=e:(Nt((e=new t).s),t=t[us]=e):t=new t:t=void 0,t;let o=r=$(e);return o===0&&(o|=32&n),o|=2&n,o!==r&&K(e,o),new t(e)}function j2(e,t,r){if(t){var n=!!n;if(!$r(t=e))throw Ln("int64");typeof t=="string"?n=fo(t):n?(n=Math.trunc(t),Number.isSafeInteger(n)?n=String(n):Ai(t=String(n))?n=t:(Tt(n),n=di())):n=lo(t)}else n=Dr(e);return typeof(r=(e=n)==null?r?0:void 0:e)=="string"&&(n=+r,Number.isSafeInteger(n))?n:r}var Br,mo,W2;function Nr(e){switch(typeof e){case"boolean":return mo||(mo=[0,void 0,!0]);case"number":return 0<e?void 0:e===0?W2||(W2=[0,void 0]):[-e,void 0];case"string":return[0,e];case"object":return e}}function xt(e,t){return wi(e,t[0],t[1])}function wi(e,t,r){if(e==null&&(e=Br),Br=void 0,e==null){var n=96;r?(e=[r],n|=512):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(n=$(e)))throw Error("farr");if(64&n)return e;if(n|=64,r&&(n|=512,r!==e[0]))throw Error("mid");e:{let o=(r=e).length;if(o){let s=o-1;if(uo(r[s])){if(1024<=(t=s-(+!!(512&(n|=256))-1)))throw Error("pvtlmt");n=-16760833&n|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&n)-1))))throw Error("spvt");n=-16760833&n|(1023&t)<<14}}}return K(e,n),e}var X2={},H2=function(){try{return Kn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),Jt=class{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()}},z2=H2?(Object.setPrototypeOf(Jt.prototype,Map.prototype),Object.defineProperties(Jt.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Jt):class extends Map{constructor(){super()}};function ps(e){return e}function _n(e){if(2&e.N)throw Error("Cannot mutate an immutable Map")}var Le=class extends z2{constructor(e,t,r=ps,n=ps){super();let o=$(e);o|=64,K(e,o),this.N=o,this.U=t,this.S=r,this.Z=this.U?Y2:n;for(let s=0;s<e.length;s++){let i=e[s],a=r(i[0],!1,!0),c=i[1];t?c===void 0&&(c=null):c=n(i[1],!1,!0,void 0,void 0,o),super.set(a,c)}}oa(e=ms){if(this.size!==0)return this.Y(e)}Y(e=ms){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){_n(this),super.clear()}delete(e){return _n(this),super.delete(this.S(e,!0,!1))}entries(){var e=this.na();return new Ur(e,K2,this)}keys(){return this.Ia()}values(){var e=this.na();return new Ur(e,Le.prototype.get,this)}forEach(e,t){super.forEach((r,n)=>{e.call(t,this.get(n),n,this)})}set(e,t){return _n(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Z(t,!0,!0,this.U,!1,this.N))}Oa(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.U?e===void 0?null:e:this.Z(e,!1,!0,void 0,!1,this.N),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.U;return r?((r=this.Z(t,!1,!0,r,this.ta,this.N))!==t&&super.set(e,r),r):t}}na(){return Array.from(super.keys())}Ia(){return super.keys()}[Symbol.iterator](){return this.entries()}};function Y2(e,t,r,n,o,s){return e=po(e,n,r,s),o&&(e=Jr(e)),e}function ms(e){return e}function K2(e){return[e,this.get(e)]}var $2;function gs(){return $2||($2=new Le(Nt([]),void 0,void 0,void 0,X2))}function go(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=Pr(e,void 0,0)?void 0:o&&2&$(e)?e:qr(e,t,r,n!==void 0,o);else if(uo(e)){let s={};for(let i in e)s[i]=go(e[i],t,r,n,o);e=s}else e=t(e,n);return e}}function qr(e,t,r,n,o){let s=n||r?$(e):0;n=n?!!(32&s):void 0;let i=be(e);for(let a=0;a<i.length;a++)i[a]=go(i[a],t,r,n,o);return r&&(Ti(i,e),r(s,i)),i}function q2(e){return go(e,yo,void 0,void 0,!1)}function yo(e){return e.X===fr?e.toJSON():e instanceof Le?e.oa(q2):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Pr(t,void 0,0))return}else{if(ur(t))return ts(t);if(t instanceof Qe){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=ts(r)}if(t instanceof Le)return t.oa()}}return t}(e)}function In(e,t,r=Fn){if(e!=null){if(ii&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=$(e);return 2&n||(t&&(t=n===0||!!(32&n)&&!(64&n||!(16&n))),e=t?K(e,-12293&(34|n)):qr(e,In,4&n?Fn:r,!0,!0)),e}return e.X===fr?(r=e.s,e=2&(n=M(r))?e:vo(e,r,n,!0)):e instanceof Le&&!(2&e.N)&&(r=Nt(e.Y(In)),e=new Le(r,e.U,e.S,e.Z)),e}}function vo(e,t,r,n){return e=e.constructor,Br=t=Ri(t,r,n),t=new e(t),Br=void 0,t}function Ri(e,t,r){let n=r||2&t?Fn:D2,o=!!(32&t);return e=function(s,i,a){let c=be(s);var u=c.length;let h=256&i?c[u-1]:void 0;for(u+=h?-1:0,i=512&i?1:0;i<u;i++)c[i]=a(c[i]);if(h){i=c[i]={};for(let f in h)i[f]=a(h[f])}return Ti(c,s),c}(e,t,s=>In(s,o,n)),ao(e,32|(r?2:0)),e}function Jr(e){let t=e.s,r=M(t);return 2&r?vo(e,t,r,!1):e}function Si(e,t,r,n){return!(4&t)||r!=null&&(!n&&r===0&&(4096&t||8192&t)&&5>(e.constructor[hs]=1+(0|e.constructor[hs]))&&bi(),r!==0&&!(r&t))}function ut(e,t){return Ke(e=e.s,M(e),t)}function ys(e,t,r,n){if(!(0>(t=n+(+!!(512&t)-1))||t>=e.length||t>=r))return e[t]}function Ke(e,t,r,n){if(r===-1)return null;let o=vi(t);if(!(r>=o)){var s=e.length;return n&&256&t&&(n=e[s-1][r])!=null?(ys(e,t,o,r)&&vn!=null&&(4<=(t=(e=N2??(N2={}))[vn]||0)||(e[vn]=t+1,bi())),n):ys(e,t,o,r)}return 256&t?e[e.length-1][r]:void 0}function D(e,t,r,n){let o=e.s,s=M(o);return Ye(s),V(o,s,t,r,n),e}function V(e,t,r,n,o){let s=vi(t);if(r>=s||o){let i=t;if(256&t)o=e[e.length-1];else{if(n==null)return i;o=e[s+(+!!(512&t)-1)]={},i|=256}return o[r]=n,r<s&&(e[r+(+!!(512&t)-1)]=void 0),i!==t&&K(e,i),i}return e[r+(+!!(512&t)-1)]=n,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function jt(e,t,r,n,o){var s=2&t;let i=Ke(e,t,r,o);Array.isArray(i)||(i=co);let a=!(2&n);n=!(1&n);let c=!!(32&t),u=$(i);return u!==0||!c||s||a?1&u||(u|=1,K(i,u)):(u|=33,K(i,u)),s?(e=!1,2&u||(Nt(i),e=!!(4&u)),(n||e)&&Object.freeze(i)):(s=!!(2&u)||!!(2048&u),n&&s?(i=be(i),n=1,c&&!a&&(n|=32),K(i,n),V(e,t,r,i,o)):a&&32&u&&!s&&Or(i,32)),i}function wr(e,t){e=e.s;let r=M(e),n=Ke(e,r,t),o=dt(n);return o!=null&&o!==n&&V(e,r,t,o),o}function ki(e){e=e.s;let t=M(e),r=Ke(e,t,1),n=ho(r,!0,!!(34&t));return n!=null&&n!==r&&V(e,t,1,n),n}function kt(e,t,r){let n=e.s,o=M(n),s=2&o?1:2,i=Ci(n,o,t);var a=$(i);if(Si(e,a,void 0,!1)){(4&a||Object.isFrozen(i))&&(i=be(i),a=wt(a,o),o=V(n,o,t,i));let c=e=0;for(;e<i.length;e++){let u=r(i[e]);u!=null&&(i[c++]=u)}c<e&&(i.length=c),a=ae(a=Fi(a,o),20,!0),a=ae(a,4096,!1),a=ae(a,8192,!1),K(i,a),2&a&&Object.freeze(i)}return Zt(a)||(r=a,(a=(e=s===1||s===4&&!!(32&a))?ae(a,2,!0):It(a,o,!1))!==r&&K(i,a),e&&Object.freeze(i)),s===2&&Zt(a)&&(i=be(i),a=It(a=wt(a,o),o,!1),K(i,a),V(n,o,t,i)),i}function Ci(e,t,r){return e=Ke(e,t,r),Array.isArray(e)?e:co}function Fi(e,t){return e===0&&(e=wt(e,t)),ae(e,1,!0)}function Zt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Li(e){e=be(e);for(let t=0;t<e.length;t++){let r=e[t]=be(e[t]);Array.isArray(r[1])&&(r[1]=Nt(r[1]))}return e}function Gr(e,t,r){{let a=e.s,c=M(a);if(Ye(c),r==null)V(a,c,t);else{var n,o=$(r),s=o,i=!!(2&o)||Object.isFrozen(r);if((n=!i)&&(n=!1),Si(e,o))for(o=21,i&&(r=be(r),s=0,o=It(o=wt(o,c),c,!0)),e=0;e<r.length;e++)r[e]=dr(r[e]);n&&(r=be(r),s=0,o=It(o=wt(o,c),c,!0)),o!==s&&K(r,o),V(a,c,t,r)}}}function Mn(e,t,r,n){e=e.s;let o=M(e);Ye(o),V(e,o,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function pr(e,t,r,n){let o=M(e);Ye(o),e=jt(e,o,t,2),n=r(n,!!(4&(t=$(e)))&&!!(4096&t)),e.push(n)}function J2(e){return e}function Tn(e,t){return _o(e=e.s,M(e),ma)===t?t:-1}function _o(e,t,r){let n=0;for(let o=0;o<r.length;o++){let s=r[o];Ke(e,t,s)!=null&&(n!==0&&(t=V(e,t,n)),n=s)}return n}function To(e,t,r,n){let o=M(e);Ye(o);let s=Ke(e,o,r,n),i;if(s!=null&&s.X===fr)return(t=Jr(s))!==s&&V(e,o,r,t,n),t.s;if(Array.isArray(s)){let a=$(s);i=2&a?Ri(s,a,!1):s,i=xt(i,t)}else i=xt(void 0,t);return i!==s&&V(e,o,r,i,n),i}function Ii(e,t,r,n){e=e.s;let o=M(e),s=Ke(e,o,r,n);return(t=po(s,t,!1,o))!==s&&t!=null&&V(e,o,r,t,n),t}function C(e,t,r,n=!1){if((t=Ii(e,t,r,n))==null)return t;e=e.s;let o=M(e);if(!(2&o)){let s=Jr(t);s!==t&&V(e,o,r,t=s,n)}return t}function Mi(e,t,r,n,o,s){var i=2,a=!!(2&t);i=a?1:i,o=!!o,s&&(s=!a),a=Ci(e,t,n);var c=$(a);let u=!!(4&c);if(!u){var h=a,f=t;let m=!!(2&(c=Fi(c,t)));m&&(f=ae(f,2,!0));let b=!m,A=!0,x=0,N=0;for(;x<h.length;x++){let d=po(h[x],r,!1,f);if(d instanceof r){if(!m){let l=!!(2&$(d.s));b&&(b=!l),A&&(A=l)}h[N++]=d}}N<x&&(h.length=N),c=ae(c,4,!0),c=ae(c,16,A),c=ae(c,8,b),K(h,c),m&&Object.freeze(h)}if(s&&!(8&c||!a.length&&(i===1||i===4&&32&c))){for(Zt(c)&&(a=be(a),c=wt(c,t),t=V(e,t,n,a)),r=a,s=c,h=0;h<r.length;h++)(c=r[h])!==(f=Jr(c))&&(r[h]=f);s=ae(s,8,!0),s=ae(s,16,!r.length),K(r,s),c=s}return Zt(c)||(r=c,(c=(s=i===1||i===4&&!!(32&c))?ae(c,!a.length||16&c&&(!u||32&c)?2:2048,!0):It(c,t,o))!==r&&K(a,c),s&&Object.freeze(a)),i===2&&Zt(c)&&(a=be(a),c=It(c=wt(c,t),t,o),K(a,c),V(e,t,n,a)),a}function tt(e,t,r){e=e.s;let n=M(e);return Mi(e,n,t,r,!1,!(2&n))}function T(e,t,r,n,o){return n==null&&(n=void 0),D(e,r,n,o)}function Qt(e,t,r,n){n==null&&(n=void 0),e=e.s;let o=M(e);Ye(o),(r=_o(e,o,r))&&r!==t&&n!=null&&(o=V(e,o,r)),V(e,o,t,n)}function wt(e,t){return e=ae(e,2,!!(2&t)),e=ae(e,32,!0),ae(e,2048,!1)}function It(e,t,r){return 32&t&&r||(e=ae(e,32,!1)),e}function Vr(e,t,r,n){e=e.s;let o=M(e);Ye(o),t=Mi(e,o,r,t,!0),r=n??new r,t.push(r),2&$(r.s)?Or(t,8):Or(t,16)}function Fe(e,t){return Gt(ut(e,t))}function Pe(e,t){return e??t}function J(e,t){return Pe(wr(e,t),0)}function Xe(e,t){return Pe(bt(ut(e,t)),"")}function ir(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);D(e,t,r)}function He(e,t,r){if(r!=null){if(typeof r!="number"||!Number.isFinite(r))throw Ln("int32");r|=0}D(e,t,r)}function y(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);D(e,t,r)}function Ue(e,t,r){t.g?t.m(e,t.g,t.h,r,!0):t.m(e,t.h,r,!0)}Le.prototype.toJSON=void 0,Le.prototype.Ja=_i;var g=class{constructor(e,t){this.s=wi(e,t)}toJSON(){return Oi(this,qr(this.s,yo,void 0,void 0,!1),!0)}l(){var e=rc;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.s;return vo(this,e,M(e),!1)}P(){return!!(2&$(this.s))}};function Oi(e,t,r){var n=R2?void 0:e.constructor.B;let o=M(r?e.s:t);if(!(e=t.length))return t;let s,i;if(uo(r=t[e-1])){e:{var a=r;let h={},f=!1;for(var c in a){let m=a[c];if(Array.isArray(m)){let b=m;(Pr(m,n,+c)||ls(m)&&m.size===0)&&(m=null),m!=b&&(f=!0)}m!=null?h[c]=m:f=!0}if(f){for(var u in h){a=h;break e}a=null}}a!=r&&(s=!0),e--}for(c=+!!(512&o)-1;0<e&&(r=t[u=e-1],u-=c,r==null||Pr(r,n,u)||ls(r)&&r.size===0);e--)i=!0;return(s||i)&&(t=Array.prototype.slice.call(t,0,e),a&&t.push(a)),t}function Pi(e){return Array.isArray(e)?e[0]instanceof ct?e:[c1,e]:[e,void 0]}function Wt(e,t){if(Array.isArray(t)){var r=$(t);if(4&r)return t;for(var n=0,o=0;n<t.length;n++){let s=e(t[n]);s!=null&&(t[o++]=s)}return o<n&&(t.length=o),K(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}g.prototype.X=fr,g.prototype.toString=function(){return Oi(this,this.s,!1).toString()};var vs=Symbol();function Eo(e){let t=e[vs];if(!t){let r=Di(e),n=xo(e),o=n.l;t=o?(s,i)=>o(s,i,n):(s,i)=>{for(;gi(i)&&i.h!=4;){var a=i.m,c=n[a];if(!c){var u=n.ea;u&&(u=u[a])&&(c=n[a]=Z2(u))}c&&c(i,s,a)||(a=(c=i).l,Ar(c),c.ia?c=void 0:(u=c.g.g-a,c.g.g=a,c=mi(c.g,u)),a=s,c&&(st||(st=Symbol()),(u=a[st])?u.push(c):a[st]=[c]))}r===Ui||r===Rr||r.j||(s[B2||(B2=Symbol())]=r)},e[vs]=t}return t}function Z2(e){let t=(e=Pi(e))[0].g;if(e=e[1]){let r=Eo(e),n=xo(e).T;return(o,s,i)=>t(o,s,i,n,r)}return t}var er=class{},Ui,Rr,tr=Symbol();function Q2(e,t,r){let n=r[1],o;if(n){let s=n[tr];o=s?s.T:Nr(n[0]),e[t]=s??n}o&&o===mo?(e.g||(e.g=new Set)).add(t):r[0]&&(e.h||(e.h=new Set)).add(t)}function _s(e,t){return[e.l,!t||0<t[0]?void 0:t]}function Di(e){var t=e[tr];if(t)return t;if(!(t=bo(e,e[tr]=new er,_s,_s,Q2)).ea&&!t.h&&!t.g){let r=!0;for(let n in t)isNaN(n)||(r=!1);r?(Nr(e[0])===mo?Rr?t=Rr:((t=new er).T=Nr(!0),t=Rr=t):t=Ui||(Ui=new er),t=e[tr]=t):t.j=!0}return t}function e1(e,t,r){e[t]=r}function bo(e,t,r,n,o=e1){t.T=Nr(e[0]);let s=0;var i=e[++s];i&&i.constructor===Object&&(t.ea=i,typeof(i=e[++s])=="function"&&(t.l=i,t.m=e[++s],i=e[++s]));let a={};for(;Array.isArray(i)&&typeof i[0]=="number"&&0<i[0];){for(var c=0;c<i.length;c++)a[i[c]]=i;i=e[++s]}for(c=1;i!==void 0;){let f;typeof i=="number"&&(c+=i,i=e[++s]);var u=void 0;if(i instanceof ct?f=i:(f=u1,s--),f.pa){i=e[++s],u=e;var h=s;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=e[++s])=="number"&&0>i&&(h-=i,i=e[++s]);c<h;c++){let m=a[c];o(t,c,u?n(f,u,m):r(f,m))}}return t}var Ts=Symbol();function Bi(e){let t=e[Ts];if(!t){let r=Zr(e);t=(n,o)=>Gi(n,o,r),e[Ts]=t}return t}var On=Symbol();function t1(e){return e.h}function r1(e,t){let r,n,o=e.h;return(s,i,a)=>o(s,i,a,n||(n=Zr(t).T),r||(r=Bi(t)))}function Zr(e){let t=e[On];return t||(t=bo(e,e[On]={},t1,r1),Ni(e),t)}var Pn=Symbol();function n1(e,t){let r=e.g;return t?(n,o,s)=>r(n,o,s,t):r}function o1(e,t,r){let n=e.g,o,s;return(i,a,c)=>n(i,a,c,s||(s=xo(t).T),o||(o=Eo(t)),r)}function xo(e){let t=e[Pn];return t||(Di(e),t=bo(e,e[Pn]={},n1,o1),Ni(e),t)}function Ni(e){Pn in e&&tr in e&&On in e&&(e.length=0)}function Es(e,t){var r=e[t];if(r)return r;if((r=e.ea)&&(r=r[t])){var n=(r=Pi(r))[0].h;if(r=r[1]){let o=Bi(r),s=Zr(r).T;r=(r=e.m)?r(s,o):(i,a,c)=>n(i,a,c,s,o)}else r=n;return e[t]=r}}function Gi(e,t,r){for(var n=M(e),o=+!!(512&n)-1,s=e.length,i=512&n?1:0,a=s+(256&n?-1:0);i<a;i++){let c=e[i];if(c==null)continue;let u=i-o,h=Es(r,u);h&&h(t,c,u)}if(256&n){n=e[s-1];for(let c in n)o=+c,Number.isNaN(o)||(s=n[c])!=null&&(a=Es(r,o))&&a(t,s,o)}if(e=st?e[st]:void 0)for(Lt(t,t.g.end()),r=0;r<e.length;r++)Lt(t,$n(e[r])||Wr())}function me(e,t){return new ct(e,t,!1,!1)}function Xt(e,t){return new ct(e,t,!0,!1)}function Qr(e,t){return new ct(e,t,!1,!0)}function ge(e,t,r){V(e,M(e),t,r)}var s1=Qr(function(e,t,r,n,o){return e.h===2&&(e=hr(e,xt([void 0,void 0],n),o),Ye(n=M(t)),(o=Ke(t,n,r))instanceof Le?2&o.N?((o=o.Y()).push(e),V(t,n,r,o)):o.Oa(e):Array.isArray(o)?(2&$(o)&&V(t,n,r,o=Li(o)),o.push(e)):V(t,n,r,[e]),!0)},function(e,t,r,n,o){if(t instanceof Le)t.forEach((s,i)=>{Cn(e,r,xt([i,s],n),o)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){let i=t[s];Array.isArray(i)&&Cn(e,r,xt(i,n),o)}});function Vi(e,t,r){e:if(t!=null){if($r(t)){if(typeof t=="string"){t=fo(t);break e}if(typeof t=="number"){t=lo(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&as(t),t!=null&&(Ie(e,r,0),typeof t=="number"?(e=e.g,Tt(t),Mr(e,G,te)):(r=as(t),Mr(e.g,r.h,r.g))))}function ji(e,t,r){(t=Gt(t))!=null&&t!=null&&(Ie(e,r,0),zr(e.g,t))}function Wi(e,t,r){(t=xi(t))!=null&&(Ie(e,r,0),e.g.g.push(t?1:0))}function Xi(e,t,r){(t=bt(t))!=null&&Yr(e,r,ri(t))}function en(e,t,r,n,o){Cn(e,r,t instanceof g?t.s:Array.isArray(t)?xt(t,n):void 0,o)}function Hi(e,t,r){(t=t==null||typeof t=="string"||ur(t)||t instanceof Qe?t:void 0)!=null&&Yr(e,r,Jn(t).buffer)}function zi(e,t,r){return(e.h===5||e.h===2)&&(t=jt(t,M(t),r,2,!1),e.h==2?Hr(e,kn,t):t.push(kn(e.g)),!0)}var re,et=me(function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=Sn(n);let o=Sn(n);n=2*(o>>31)+1;let s=o>>>20&2047;return e=4294967296*(1048575&o)+e,ge(t,r,s==2047?e?NaN:1/0*n:s==0?n*Math.pow(2,-1074)*e:n*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=dt(t))!=null&&(Ie(e,r,1),e=e.g,(r=fi||(fi=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),G=r.getUint32(0,!0),te=r.getUint32(4,!0),sr(e,G),sr(e,te))}),oe=me(function(e,t,r){return e.h===5&&(ge(t,r,kn(e.g)),!0)},function(e,t,r){(t=dt(t))!=null&&(Ie(e,r,5),e=e.g,Qn(t),sr(e,G))}),i1=Xt(zi,function(e,t,r){if((t=Wt(dt,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&(Ie(n,o,5),n=n.g,Qn(s),sr(n,G))}}),Ao=Xt(zi,function(e,t,r){if((t=Wt(dt,t))!=null&&t.length){Ie(e,r,2),lr(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Qn(t[n]),sr(r,G)}}),ht=me(function(e,t,r){return e.h===0&&(ge(t,r,ro(e.g,eo)),!0)},Vi),En=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=ro(e.g,eo))===0?void 0:e),!0)},Vi),a1=me(function(e,t,r){return e.h===0&&(ge(t,r,ro(e.g,Rn)),!0)},function(e,t,r){e:if(t!=null){if($r(t)){if(typeof t=="string"){var n=Math.trunc(Number(t));Number.isSafeInteger(n)&&0<=n?t=String(n):((n=t.indexOf("."))!==-1&&(t=t.substring(0,n)),ds(t)||(Xr(t),t=Ir(G,te)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){Tt(o);let s=Ir(G,te);return o=Number(s),Number.isSafeInteger(o)?o:s}return ds(String(o))?o:(Tt(o),Rn(G,te))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&ss(t),t!=null&&(Ie(e,r,0),typeof t=="number"?(e=e.g,Tt(t),Mr(e,G,te)):(r=ss(t),Mr(e.g,r.h,r.g))))}),q=me(function(e,t,r){return e.h===0&&(ge(t,r,it(e.g)),!0)},ji),tn=Xt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,M(t),r,2,!1),e.h==2?Hr(e,it,t):t.push(it(e.g)),!0)},function(e,t,r){if((t=Wt(Gt,t))!=null&&t.length){r=so(e,r);for(let n=0;n<t.length;n++)zr(e.g,t[n]);io(e,r)}}),Mt=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=it(e.g))===0?void 0:e),!0)},ji),Z=me(function(e,t,r){return e.h===0&&(ge(t,r,no(e.g)),!0)},Wi),rr=me(function(e,t,r){return e.h===0&&(ge(t,r,(e=no(e.g))===!1?void 0:e),!0)},Wi),ce=Xt(function(e,t,r){return e.h===2&&(pr(t,r,J2,e=oo(e)),!0)},function(e,t,r){if((t=Wt(bt,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&Yr(n,o,ri(s))}}),lt=me(function(e,t,r){return e.h===2&&(ge(t,r,(e=oo(e))===""?void 0:e),!0)},Xi),O=me(function(e,t,r){return e.h===2&&(ge(t,r,oo(e)),!0)},Xi),c1=Qr(function(e,t,r,n,o){return e.h===2&&(hr(e,To(t,n,r,!0),o),!0)},en),u1=Qr(function(e,t,r,n,o){return e.h===2&&(hr(e,To(t,n,r),o),!0)},en);re=new ct(function(e,t,r,n,o){if(e.h!==2)return!1;n=xt(void 0,n);let s=M(t);Ye(s);let i=jt(t,s,r,3);return s=M(t),4&$(i)&&(i=be(i),K(i,-2079&(1|$(i))),V(t,s,r,i)),i.push(n),hr(e,n,o),!0},function(e,t,r,n,o){if(Array.isArray(t))for(let s=0;s<t.length;s++)en(e,t[s],r,n,o)},!0,!0);var P=Qr(function(e,t,r,n,o,s){if(e.h!==2)return!1;let i=M(t);return Ye(i),(s=_o(t,i,s))&&r!==s&&V(t,i,s),hr(e,t=To(t,n,r),o),!0},en),Yi=me(function(e,t,r){return e.h===2&&(ge(t,r,yi(e)),!0)},Hi),h1=Xt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,M(t),r,2,!1),e.h==2?Hr(e,at,t):t.push(at(e.g)),!0)},function(e,t,r){if((t=Wt(V2,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&(Ie(n,o,0),lr(n.g,s))}}),ze=me(function(e,t,r){return e.h===0&&(ge(t,r,it(e.g)),!0)},function(e,t,r){(t=Gt(t))!=null&&(t=parseInt(t,10),Ie(e,r,0),zr(e.g,t))}),l1=Xt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,M(t),r,2,!1),e.h==2?Hr(e,O2,t):t.push(it(e.g)),!0)},function(e,t,r){if((t=Wt(Gt,t))!=null&&t.length){r=so(e,r);for(let n=0;n<t.length;n++)zr(e.g,t[n]);io(e,r)}}),Un=class{constructor(t,r){this.h=t,this.g=r,this.l=C,this.m=T,this.defaultValue=void 0}};function De(e,t){return new Un(e,t)}function pt(e,t){return(r,n)=>{if(Tr.length){let s=Tr.pop();s.o(n),yn(s.g,r,n),r=s}else r=new class{constructor(s,i){if(os.length){let a=os.pop();yn(a,s,i),s=a}else s=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,yn(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ca=!1}}(s,i);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(i)}o({ia:s=!1}={}){this.ia=s}}(r,n);try{let s=new e,i=s.s;Eo(t)(i,r);var o=s}finally{r.g.clear(),r.m=-1,r.h=-1,100>Tr.length&&Tr.push(r)}return o}}function rn(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let i=this.g;return this.g=[],i}}}};Gi(this.s,t,Zr(e)),Lt(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,o=n.length,s=0;for(let i=0;i<o;i++){let a=n[i];r.set(a,s),s+=a.length}return t.l=[r],r}}var bs=class extends g{constructor(e){super(e)}},Ki=[0,lt,me(function(e,t,r){return e.h===2&&(ge(t,r,(e=yi(e))===At()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof g){let n=t.Qa;return void(n&&(t=n(t),t!=null&&Yr(e,r,Jn(t).buffer)))}if(Array.isArray(t))return}Hi(e,t,r)})],f1=[0,O],$i=[0,q,ze,Z,-1,tn,ze,-1],d1=[0,Z,-1],qi=class extends g{constructor(){super()}};qi.B=[6];var Ji=[0,Z,O,Z,ze,-1,l1,O,-1,d1,ze],Zi=[0,O,-2],xs=class extends g{constructor(){super()}},Qi=[0],ea=[0,q,Z,-4],xe=class extends g{constructor(e){super(e,2)}},H={},p1=[-2,H,Z];H[336783863]=[0,O,Z,-1,q,[0,[1,2,3,4,5,6],P,Qi,P,Ji,P,Zi,P,ea,P,$i,P,[0,O]],f1,Z,[0,[1,3],[2,4],P,[0,tn],-1,P,[0,ce],-1,re,[0,O,-1]],O];var m1=[0,lt,rr],ta=[0,En,-1,rr,-3,En,tn,lt,Mt,En,-1,rr,Mt,rr,-2,lt],mr=[-1,{}],ra=[0,O,1,mr],na=[0,O,ce,mr];function Ae(e,t){Mn(e,2,Vt(t),"")}function B(e,t){pr(e.s,3,dr,t)}function S(e,t){pr(e.s,4,dr,t)}var ue=class extends g{constructor(e){super(e,500)}o(e){return T(this,0,7,e)}};ue.B=[3,4,5,6,8,13,17,1005];var g1=[-500,lt,-1,ce,-3,p1,re,Ki,Mt,-1,ra,na,re,m1,lt,ta,Mt,ce,987,ce],y1=[0,lt,-1,mr],v1=[-500,O,-1,[-1,{}],998,O],_1=[-500,O,ce,-1,[-2,{},Z],997,ce,-1],T1=[-500,O,ce,mr,998,ce];function we(e,t){Vr(e,1,ue,t)}function j(e,t){pr(e.s,10,dr,t)}function L(e,t){pr(e.s,15,dr,t)}var le=class extends g{constructor(e){super(e,500)}o(e){return T(this,0,1001,e)}};le.B=[1,6,7,9,10,15,16,17,14,1002];var oa=[-500,re,g1,4,re,v1,re,_1,Mt,re,T1,ce,Mt,ra,na,re,y1,ce,-2,ta,lt,-1,rr,979,mr,re,Ki],E1=pt(le,oa);le.prototype.g=rn(oa);var b1=[0,re,[0,q,-2]],x1=class extends g{constructor(e){super(e)}},A1=[0,q,oe,O,-1],wo=class extends g{constructor(e){super(e)}g(){return tt(this,x1,1)}};wo.B=[1];var sa=[0,re,A1],nn=pt(wo,sa),w1=[0,q,oe],R1=[0,q,-1,b1],S1=class extends g{constructor(e){super(e)}},k1=[0,q,-3],C1=[0,oe,-3],F1=class extends g{constructor(e){super(e)}},L1=[0,oe,-1,O,oe],Sr=class extends g{constructor(e){super(e)}h(){return C(this,S1,2)}g(){return tt(this,F1,5)}};Sr.B=[5];var I1=[0,ze,k1,C1,R1,re,L1],ia=class extends g{constructor(e){super(e)}};ia.B=[1,2,3,8,9];var aa=pt(ia,[0,ce,tn,Ao,I1,O,-1,ht,re,w1,ce,ht]),ca=class extends g{constructor(e){super(e)}},M1=[0,oe,-4],ua=class extends g{constructor(e){super(e)}};ua.B=[1];var Ct=pt(ua,[0,re,M1]),ha=class extends g{constructor(e){super(e)}},O1=[0,oe,-4],la=class extends g{constructor(e){super(e)}};la.B=[1];var gr=pt(la,[0,re,O1]),fa=class extends g{constructor(e){super(e)}};fa.B=[3];var P1=[0,q,-1,Ao,ze],da=class extends g{constructor(){super()}};da.prototype.g=rn([0,oe,-4,ht]);var U1=class extends g{constructor(e){super(e)}},D1=[0,1,q,O,sa],pa=class extends g{constructor(e){super(e)}};pa.B=[1];var B1=pt(pa,[0,re,D1,ht]),Dn=class extends g{constructor(e){super(e)}};Dn.B=[1];var N1=class extends g{constructor(e){super(e)}qa(){let e=ki(this);return e??At()}},G1=class extends g{constructor(e){super(e)}},ma=[1,2],V1=[0,ma,P,[0,Ao],P,[0,Yi],q,O],ga=class extends g{constructor(e){super(e)}};ga.B=[1];var j1=pt(ga,[0,re,V1,ht]),on=class extends g{constructor(e){super(e)}};on.B=[4,5];var ya=[0,O,q,oe,ce,-1],As=class extends g{constructor(e){super(e)}},W1=[0,Z,-1],ws=class extends g{constructor(e){super(e)}},kr=[1,2,3,4,5],jr=class extends g{constructor(e){super(e)}g(){return ki(this)!=null}h(){return bt(ut(this,2))!=null}},va=[0,Yi,O,[0,q,ht,-1],[0,a1,ht]],z=class extends g{constructor(e){super(e)}g(){return xi(ut(this,2))??!1}},Q=[0,va,Z,[0,kr,P,ea,P,Ji,P,$i,P,Qi,P,Zi],ze],sn=class extends g{constructor(e){super(e)}},Ro=[0,Q,oe,-1,q],X1=De(502141897,sn);H[502141897]=Ro;var _a=[0,va];H[512499200]=_a;var Ta=[0,_a];H[515723506]=Ta;var H1=pt(class extends g{constructor(e){super(e)}},[0,[0,ze,-1,i1,h1],P1]),Ea=[0,Q];H[508981768]=Ea;var ba=class extends g{constructor(e){super(e)}},So=[0,Q,oe,Ea,Z],xa=class extends g{constructor(e){super(e)}},Aa=[0,Q,Ro,So,oe,Ta];H[508968149]=So;var z1=De(508968150,xa);H[508968150]=Aa;var wa=class extends g{constructor(e){super(e)}},Y1=De(513916220,wa);H[513916220]=[0,Q,Aa,q];var St=class extends g{constructor(e){super(e)}h(){return C(this,on,2)}g(){D(this,2)}},Ra=[0,Q,ya];H[478825465]=Ra;var Sa=[0,Q];H[478825422]=Sa;var K1=class extends g{constructor(e){super(e)}},ka=[0,Q,Sa,Ra,-1],Ca=class extends g{constructor(e){super(e)}},Fa=[0,Q,oe,q],ko=class extends g{constructor(e){super(e)}},Co=[0,Q,oe],Fo=class extends g{constructor(e){super(e)}},La=[0,Q,Fa,Co,oe],Ia=class extends g{constructor(e){super(e)}},$1=[0,Q,La,ka];H[463370452]=ka,H[464864288]=Fa,H[474472470]=Co;var q1=De(462713202,Fo);H[462713202]=La;var J1=De(479097054,Ia);H[479097054]=$1;var Z1=class extends g{constructor(e){super(e)}},Q1=[0,Q],Ma=class extends g{constructor(e){super(e)}},Lo=[0,Q,oe,-1,q];H[514774813]=Lo;var Oa=class extends g{constructor(e){super(e)}},Io=[0,Q,oe,Z];H[518928384]=Io;var Pa=class extends g{constructor(){super()}};Pa.prototype.g=rn([0,Q,Co,Q1,Ro,So,Lo,Io]);var Ua=class extends g{constructor(e){super(e)}},ec=De(456383383,Ua);H[456383383]=[0,Q,ya];var Da=class extends g{constructor(e){super(e)}},tc=De(476348187,Da);H[476348187]=[0,Q,W1];var Ba=class extends g{constructor(e){super(e)}},Na=[0,ze,-1],Bn=class extends g{constructor(e){super(e)}};Bn.B=[3];var rc=De(458105876,class extends g{constructor(e){super(e)}g(){var e=this.s;let t=M(e);var r=2&t;return e=function(n,o,s){var i=Bn;let a=2&o,c=!1;if(s==null){if(a)return gs();s=[]}else if(s.constructor===Le){if(!(2&s.N)||a)return s;s=s.Y()}else Array.isArray(s)?c=!!(2&$(s)):s=[];if(a){if(!s.length)return gs();c||(c=!0,Nt(s))}else c&&(c=!1,s=Li(s));return c||(64&$(s)?Or(s,32):32&o&&ao(s,32)),V(n,o,2,i=new Le(s,i,j2,void 0),!1),i}(e,t,Ke(e,t,2)),e==null||!r&&Bn&&(e.ta=!0),r=e}});H[458105876]=[0,Na,s1,[!0,ht,[0,O,-1,ce]]];var Mo=class extends g{constructor(e){super(e)}},Ga=De(458105758,Mo);H[458105758]=[0,Q,O,Na];var Oo=class extends g{constructor(e){super(e)}};Oo.B=[5,6];var nc=De(443442058,Oo);H[443442058]=[0,Q,O,q,oe,ce,-1];var Va=class extends g{constructor(e){super(e)}},oc=De(516587230,Va);function Nn(e,t){return t=t?t.clone():new on,e.displayNamesLocale!==void 0?D(t,1,Vt(e.displayNamesLocale)):e.displayNamesLocale===void 0&&D(t,1),e.maxResults!==void 0?He(t,2,e.maxResults):"maxResults"in e&&D(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&D(t,3),e.categoryAllowlist!==void 0?Gr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&D(t,4),e.categoryDenylist!==void 0?Gr(t,5,e.categoryDenylist):"categoryDenylist"in e&&D(t,5),t}function Po(e,t=-1,r=""){return{categories:e.map(n=>({index:Pe(Fe(n,1),0)??-1,score:J(n,2)??0,categoryName:Xe(n,3)??"",displayName:Xe(n,4)??""})),headIndex:t,headName:r}}function ja(e){var t=kt(e,3,dt),r=kt(e,2,Gt),n=kt(e,1,bt),o=kt(e,9,bt);let s={categories:[],keypoints:[]};for(let i=0;i<t.length;i++)s.categories.push({score:t[i],index:r[i]??-1,categoryName:n[i]??"",displayName:o[i]??""});if((t=C(e,Sr,4)?.h())&&(s.boundingBox={originX:Fe(t,1)??0,originY:Fe(t,2)??0,width:Fe(t,3)??0,height:Fe(t,4)??0,angle:0}),C(e,Sr,4)?.g().length)for(let i of C(e,Sr,4).g())s.keypoints.push({x:wr(i,1)??0,y:wr(i,2)??0,score:wr(i,4)??0,label:bt(ut(i,3))??""});return s}function an(e){let t=[];for(let r of tt(e,ha,1))t.push({x:J(r,1)??0,y:J(r,2)??0,z:J(r,3)??0,visibility:J(r,4)??0});return t}function nr(e){let t=[];for(let r of tt(e,ca,1))t.push({x:J(r,1)??0,y:J(r,2)??0,z:J(r,3)??0,visibility:J(r,4)??0});return t}function Rs(e){return Array.from(e,t=>127<t?t-256:t)}function Ss(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,o=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s],n+=e[s]*e[s],o+=t[s]*t[s];if(0>=n||0>=o)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*o)}var Er;H[516587230]=[0,Q,Lo,Io,oe];var sc=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 Wa(){if(Er===void 0)try{await WebAssembly.instantiate(sc),Er=!0}catch{Er=!1}return Er}async function Yt(e,t=""){let r=await Wa()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var nt=class{};function Xa(){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/))&&1<=e.length&&17<=Number(e[1])))}async function ks(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{n(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Ha(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 _(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 Cs(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);let[n,o]=Ha(t);return!e.l||n===e.i.canvas.width&&o===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=o),[n,o]}function Fs(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let o=0;o<t.length;o++)n[o]=e.i.stringToNewUTF8(t[o]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let o of n)e.i._free(o);e.i._free(t)}function Ne(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function rt(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(o,s,i)=>{s?(r(n,i),n=[]):n.push(o)}}nt.forVisionTasks=function(e){return Yt("vision",e)},nt.forTextTasks=function(e){return Yt("text",e)},nt.forGenAiExperimentalTasks=function(e){return Yt("genai_experimental",e)},nt.forGenAiTasks=function(e){return Yt("genai",e)},nt.forAudioTasks=function(e){return Yt("audio",e)},nt.isSimdSupported=function(){return Wa()};async function ic(e,t,r,n){return e=await(async(o,s,i,a,c)=>{if(s&&await ks(s),!self.ModuleFactory||i&&(await ks(i),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((s=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(s.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new o(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:o=>o.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&o.endsWith(".data")?r.assetBinaryPath.toString():o}),await e.o(n),e}function bn(e,t){let r=C(e.baseOptions,jr,1)||new jr;typeof t=="string"?(D(r,2,Vt(t)),D(r,1)):t instanceof Uint8Array&&(D(r,1,ho(t,!1,!1)),D(r,2)),T(e.baseOptions,0,1,r)}function Ls(e){try{let t=e.K.length;if(t===1)throw Error(e.K[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.K.map(r=>r.message).join(", "))}finally{e.K=[]}}function p(e,t){e.J=Math.max(e.J,t)}function cn(e,t){e.C=new ue,Ae(e.C,"PassThroughCalculator"),B(e.C,"free_memory"),S(e.C,"free_memory_unused_out"),j(t,"free_memory"),we(t,e.C)}function Ot(e,t){B(e.C,t),S(e.C,t+"_unused_out")}function un(e){e.g.addBoolToStream(!0,"free_memory",e.J)}var Cr=class{constructor(e){this.g=e,this.K=[],this.J=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(C(this.baseOptions,jr,1)?.g()||C(this.baseOptions,jr,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(n,o){let s=C(n.baseOptions,ws,3);if(!s){var i=s=new ws,a=new xs;Qt(i,4,kr,a)}"delegate"in o&&(o.delegate==="GPU"?(o=s,i=new qi,Qt(o,2,kr,i)):(o=s,i=new xs,Qt(o,4,kr,i))),T(n.baseOptions,0,3,s)}(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)}).then(n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),bn(this,"/model.dat"),this.m(),this.L()});if(r.modelAssetBuffer instanceof Uint8Array)bn(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(n){let o=[];for(var s=0;;){let{done:i,value:a}=await n.read();if(i)break;o.push(a),s+=a.length}if(o.length===0)return new Uint8Array(0);if(o.length===1)return o[0];n=new Uint8Array(s),s=0;for(let i of o)n.set(i,s),s+=i.length;return n}(r.modelAssetBuffer).then(n=>{bn(this,n),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}fa(){let e;if(this.g.fa(t=>{e=E1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.K.push(Error(n))}),this.g.Ma(),this.g.setGraph(e,t),this.C=void 0,Ls(this)}finishProcessing(){this.g.finishProcessing(),Ls(this)}close(){this.C=void 0,this.g.closeGraph()}};function he(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Cr.prototype.close=Cr.prototype.close,function(e,t){e=e.split(".");var r,n=cr;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t}("TaskRunner",Cr);var Gn=class{constructor(t,r,n,o){this.g=t,this.h=r,this.m=n,this.l=o}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Is(e,t,r){let n=e.g;if(r=he(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 Ms(e,t){let r=e.g,n=he(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let o=he(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.K),r.vertexAttribPointer(e.K,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let s=he(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,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 Gn(r,n,o,s)}function Uo(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function yr(e,t,r,n){return Uo(e,t),e.h||(e.m(),e.D()),r?(e.v||(e.v=Ms(e,!0)),r=e.v):(e.A||(e.A=Ms(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function ft(e,t,r){return Uo(e,t),e=he(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 hn(e,t,r){Uo(e,t),e.u||(e.u=he(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.u),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Do(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ht=class{H(){return`
1
+ var ur=typeof self<"u"?self:{};function ei(e){e:{for(var t=["CLOSURE_FLAGS"],r=ur,n=0;n<t.length;n++)if((r=r[t[n]])==null){t=null;break e}t=r}return(e=t&&t[e])!=null&&e}function Tt(){throw Error("Invalid UTF8")}function Zo(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Tr,pn,R1=typeof TextDecoder<"u",S1,k1=typeof TextEncoder<"u";function ti(e){if(k1)e=(S1||(S1=new TextEncoder)).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)n[r++]=t;else{if(2048>t)n[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let s=e.charCodeAt(++o);if(56320<=s&&57343>=s){t=1024*(t-55296)+s-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}o--}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}var sr,ri=ei(610401301),C1=ei(188588736),Qo=ur.navigator;function wn(e){return!!ri&&!!sr&&sr.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Ce(e){var t;return(t=ur.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function at(){return!!ri&&!!sr&&0<sr.brands.length}function gn(){return at()?wn("Chromium"):(Ce("Chrome")||Ce("CriOS"))&&!(!at()&&Ce("Edge"))||Ce("Silk")}function Kn(e){return Kn[" "](e),e}sr=Qo&&Qo.userAgentData||null,Kn[" "]=function(){};var F1=!at()&&(Ce("Trident")||Ce("MSIE"));!Ce("Android")||gn(),gn(),Ce("Safari")&&(gn()||!at()&&Ce("Coast")||!at()&&Ce("Opera")||!at()&&Ce("Edge")||(at()?wn("Microsoft Edge"):Ce("Edg/"))||at()&&wn("Opera"));var ni={},qt=null;function L1(e){var t=e.length,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);var n=new Uint8Array(r),o=0;return function(s,i){function a(b){for(;c<s.length;){var E=s.charAt(c++),A=qt[E];if(A!=null)return A;if(!/^[\s\xa0]*$/.test(E))throw Error("Unknown base64 encoding at char: "+E)}return b}oi();for(var c=0;;){var u=a(-1),h=a(0),l=a(64),m=a(64);if(m===64&&u===-1)break;i(u<<2|h>>4),l!=64&&(i(h<<4&240|l>>2),m!=64&&i(l<<6&192|m))}}(e,function(s){n[o++]=s}),o!==r?n.subarray(0,o):n}function oi(){if(!qt){qt={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var n=e.concat(t[r].split(""));ni[r]=n;for(var o=0;o<n.length;o++){var s=n[o];qt[s]===void 0&&(qt[s]=o)}}}}var si=typeof Uint8Array<"u",ii=!F1&&typeof btoa=="function";function es(e){if(!ii){var t;t===void 0&&(t=0),oi(),t=ni[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,u=0;for(;c<e.length-2;c+=3){var o=e[c],s=e[c+1],i=e[c+2],a=t[o>>2];o=t[(3&o)<<4|s>>4],s=t[(15&s)<<2|i>>6],i=t[63&i],r[u++]=a+o+s+i}switch(a=0,i=n,e.length-c){case 2:i=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[u]=t[e>>2]+t[(3&e)<<4|a>>4]+i+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var ts=/[-_.]/g,I1={"-":"+",_:"/",".":"="};function M1(e){return I1[e]||""}function ai(e){if(!ii)return L1(e);ts.test(e)&&(e=e.replace(ts,M1)),e=atob(e);let t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function hr(e){return si&&e!=null&&e instanceof Uint8Array}var O1;function Wr(){return O1||(O1=new Uint8Array(0))}var Ft={},U1;function ci(e){if(e!==Ft)throw Error("illegal external caller")}function wt(){return U1||(U1=new rt(null,Ft))}function $n(e){ci(Ft);var t=e.g;return(t=t==null||hr(t)?t:typeof t=="string"?ai(t):null)==null?t:e.g=t}var rt=class{constructor(e,t){if(ci(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}h(){let e=$n(this);return e?new Uint8Array(e):Wr()}};function ui(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function qn(){return Error("Failed to read varint, encoding is invalid.")}function hi(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Jn(e){if(typeof e=="string")return{buffer:ai(e),P:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),P:!1};if(e.constructor===Uint8Array)return{buffer:e,P:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),P:!1};if(e.constructor===rt)return{buffer:$n(e)||Wr(),P:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),P:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Zn(){return typeof BigInt=="function"}var B1=typeof Uint8Array.prototype.slice=="function",li,G=0,te=0;function xt(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[n,o]=to(r,e);e=o,r=n}G=r>>>0,te=e>>>0}function Qn(e){let t=li||(li=new DataView(new ArrayBuffer(8)));t.setFloat32(0,+e,!0),te=0,G=t.getUint32(0,!0)}function Rn(e,t){return 4294967296*t+(e>>>0)}function eo(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=Rn(e,t),r?-e:e}function Mr(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else Zn()?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,1e7<=e&&(r+=Math.floor(e/1e7),e%=1e7),1e7<=r&&(t+=Math.floor(r/1e7),r%=1e7),r=t+rs(r)+rs(e));return r}function rs(e){return e=String(e),"0000000".slice(e.length)+e}function fi(){var e=G,t=te;if(2147483648&t)if(Zn())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=to(e,t);e="-"+Mr(r,n)}else e=Mr(e,t);return e}function Hr(e){if(16>e.length)xt(Number(e));else if(Zn())e=BigInt(e),G=Number(e&BigInt(4294967295))>>>0,te=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");te=G=0;let r=e.length;for(let n=t,o=(r-t)%6+t;o<=r;n=o,o+=6){let s=Number(e.slice(n,o));te*=1e6,G=1e6*G+s,4294967296<=G&&(te+=Math.trunc(G/4294967296),te>>>=0,G>>>=0)}if(t){let[n,o]=to(G,te);G=n,te=o}}}function to(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ro(e,t){let r,n=0,o=0,s=0,i=e.h,a=e.g;do r=i[a++],n|=(127&r)<<s,s+=7;while(32>s&&128&r);for(32<s&&(o|=(127&r)>>4),s=3;32>s&&128&r;s+=7)r=i[a++],o|=(127&r)<<s;if(bt(e,a),128>r)return t(n>>>0,o>>>0);throw qn()}function no(e){let t=0,r=e.g,n=r+10,o=e.h;for(;r<n;){let s=o[r++];if(t|=s,(128&s)==0)return bt(e,r),!!(127&t)}throw qn()}function ut(e){let t=e.h,r=e.g,n=t[r++],o=127&n;if(128&n&&(n=t[r++],o|=(127&n)<<7,128&n&&(n=t[r++],o|=(127&n)<<14,128&n&&(n=t[r++],o|=(127&n)<<21,128&n&&(n=t[r++],o|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw qn();return bt(e,r),o}function ht(e){return ut(e)>>>0}function Sn(e){var t=e.h;let r=e.g,n=t[r],o=t[r+1],s=t[r+2];return t=t[r+3],bt(e,e.g+4),(n<<0|o<<8|s<<16|t<<24)>>>0}function kn(e){var t=Sn(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:1/0*e:r==0?e*Math.pow(2,-149)*t:e*Math.pow(2,r-150)*(t+Math.pow(2,23))}function P1(e){return ut(e)}function yn(e,t,{ca:r=!1}={}){e.ca=r,t&&(t=Jn(t),e.h=t.buffer,e.m=t.P,e.j=0,e.l=e.h.length,e.g=e.j)}function bt(e,t){if(e.g=t,t>e.l)throw hi(e.l,t)}function di(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw hi(t,e.l-r);return e.g=n,r}function mi(e,t){if(t==0)return wt();var r=di(e,t);return e.ca&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?Wr():B1?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?wt():new rt(r,Ft)}var ns=[];function pi(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=ht(e.g);if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw ui(r,e.l);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function wr(e){switch(e.h){case 0:e.h!=0?wr(e):no(e.g);break;case 1:bt(e=e.g,e.g+8);break;case 2:if(e.h!=2)wr(e);else{var t=ht(e.g);bt(e=e.g,e.g+t)}break;case 5:bt(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!pi(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}wr(e)}break;default:throw ui(e.h,e.l)}}function lr(e,t,r){let n=e.g.l,o=ht(e.g),s=e.g.g+o,i=s-n;if(0>=i&&(e.g.l=s,r(t,e,void 0,void 0,void 0),i=s-e.g.g),i)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-i} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=s,e.g.l=n,t}function oo(e){var t=ht(e.g),r=di(e=e.g,t);if(e=e.h,R1){var n,o=e;(n=pn)||(n=pn=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var s=n.decode(o)}catch(a){if(Tr===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Tr=!0}catch{Tr=!1}}throw!Tr&&(pn=void 0),a}}else{t=(s=r)+t,r=[];let a,c=null;for(;s<t;){var i=e[s++];128>i?r.push(i):224>i?s>=t?Tt():(a=e[s++],194>i||(192&a)!=128?(s--,Tt()):r.push((31&i)<<6|63&a)):240>i?s>=t-1?Tt():(a=e[s++],(192&a)!=128||i===224&&160>a||i===237&&160<=a||(192&(n=e[s++]))!=128?(s--,Tt()):r.push((15&i)<<12|(63&a)<<6|63&n)):244>=i?s>=t-2?Tt():(a=e[s++],(192&a)!=128||a-144+(i<<28)>>30||(192&(n=e[s++]))!=128||(192&(o=e[s++]))!=128?(s--,Tt()):(i=(7&i)<<18|(63&a)<<12|(63&n)<<6|63&o,i-=65536,r.push(55296+(i>>10&1023),56320+(1023&i)))):Tt(),8192<=r.length&&(c=Zo(c,r),r.length=0)}s=Zo(c,r)}return s}function gi(e){let t=ht(e.g);return mi(e.g,t)}function Yr(e,t,r){var n=ht(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var xr=[];function os(e){return e?/^\d+$/.test(e)?(Hr(e),new ss(G,te)):null:D1||(D1=new ss(0,0))}var ss=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},D1;function is(e){return e?/^-?\d+$/.test(e)?(Hr(e),new as(G,te)):null:N1||(N1=new as(0,0))}var as=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},N1;function Or(e,t,r){for(;0<r||127<t;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function fr(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function zr(e,t){if(0<=t)fr(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function ir(e,t){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 Lt(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function Ie(e,t,r){fr(e.g,8*t+r)}function so(e,t){return Ie(e,t,2),t=e.g.end(),Lt(e,t),t.push(e.h),t}function io(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;127<r;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function Kr(e,t,r){Ie(e,t,2),fr(e.g,r.length),Lt(e,e.g.end()),Lt(e,r)}function Cn(e,t,r,n){r!=null&&(t=so(e,t),n(r,e),io(e,t))}var lt=class{constructor(t,r,n,o){this.g=t,this.h=r,this.l=n,this.pa=o}};function be(e){return Array.prototype.slice.call(e)}function $r(e){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():e}var Ye=$r(),cs=$r("0di"),vn=$r("2ex"),us=$r("0dg"),ao=Ye?(e,t)=>{e[Ye]|=t}:(e,t)=>{e.g!==void 0?e.g|=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}})},Ur=Ye?(e,t)=>{e[Ye]&=~t}:(e,t)=>{e.g!==void 0&&(e.g&=~t)};function ue(e,t,r){return r?e|t:e&~t}var q=Ye?e=>0|e[Ye]:e=>0|e.g,I=Ye?e=>e[Ye]:e=>e.g,$=Ye?(e,t)=>(e[Ye]=t,e):(e,t)=>(e.g!==void 0?e.g=t:Object.defineProperties(e,{g:{value:t,configurable:!0,writable:!0,enumerable:!1}}),e);function Nt(e){return ao(e,34),e}function G1(e,t){$(t,-14591&(0|e))}function Fn(e,t){$(t,-14557&(34|e))}function yi(e){return(e=e>>14&1023)===0?536870912:e}var co,dr={},vi={};function hs(e){return!(!e||typeof e!="object"||e.Ja!==vi)}function uo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function ho(e,t,r){if(e!=null){if(typeof e=="string")e=e?new rt(e,Ft):wt();else if(e.constructor!==rt)if(hr(e))e=e.length?new rt(r?e:new Uint8Array(e),Ft):wt();else{if(!t)throw Error();e=void 0}}return e}function Br(e,t,r){if(!Array.isArray(e)||e.length)return!1;let n=q(e);return!!(1&n)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&($(e,1|n),!0)}var ls=[];function qe(e){if(2&e)throw Error()}$(ls,55),co=Object.freeze(ls);var Pr=class e{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new e(this.g,this.h,this.m)}},ct,V1,j1;function _i(e,t){(t=ct?t[ct]:void 0)&&(e[ct]=be(t))}function Ti(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function xi(){let e=Error();Ti(e,"incident"),function(t){ur.setTimeout(()=>{throw t},0)}(e)}function Ln(e){return Ti(e=Error(e),"warning"),e}function gt(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function bi(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}Object.freeze(new class{}),Object.freeze(new class{});var X1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function qr(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&X1.test(e)}function Gt(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?0|e:void 0}function W1(e){if(e==null)return e;if(typeof e=="string"){if(!e)return;e=+e}return typeof e=="number"&&Number.isFinite(e)?e>>>0:void 0}function fs(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Ei(e){return e[0]==="-"?20>e.length||e.length===20&&-922337<Number(e.substring(0,7)):19>e.length||e.length===19&&922337>Number(e.substring(0,6))}function lo(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(xt(e),e=eo(G,te)),e}function fo(e){var t=Math.trunc(Number(e));return Number.isSafeInteger(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Ei(e)||(Hr(e),e=fi()),e)}function Dr(e){return e==null?e:qr(e)?typeof e=="number"?lo(e):fo(e):void 0}function mr(e){if(typeof e!="string")throw Error();return e}function Vt(e){if(e!=null&&typeof e!="string")throw Error();return e}function Et(e){return e==null||typeof e=="string"?e:void 0}function mo(e,t,r,n){if(e!=null&&typeof e=="object"&&e.X===dr)return e;if(!Array.isArray(e))return r?2&n?(e=t[cs])?t=e:(Nt((e=new t).s),t=t[cs]=e):t=new t:t=void 0,t;let o=r=q(e);return o===0&&(o|=32&n),o|=2&n,o!==r&&$(e,o),new t(e)}function H1(e,t,r){if(t){var n=!!n;if(!qr(t=e))throw Ln("int64");typeof t=="string"?n=fo(t):n?(n=Math.trunc(t),Number.isSafeInteger(n)?n=String(n):Ei(t=String(n))?n=t:(xt(n),n=fi())):n=lo(t)}else n=Dr(e);return typeof(r=(e=n)==null?r?0:void 0:e)=="string"&&(n=+r,Number.isSafeInteger(n))?n:r}var Nr,po,Y1;function Gr(e){switch(typeof e){case"boolean":return po||(po=[0,void 0,!0]);case"number":return 0<e?void 0:e===0?Y1||(Y1=[0,void 0]):[-e,void 0];case"string":return[0,e];case"object":return e}}function At(e,t){return Ai(e,t[0],t[1])}function Ai(e,t,r){if(e==null&&(e=Nr),Nr=void 0,e==null){var n=96;r?(e=[r],n|=512):e=[],t&&(n=-16760833&n|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(n=q(e)))throw Error("farr");if(64&n)return e;if(n|=64,r&&(n|=512,r!==e[0]))throw Error("mid");e:{let o=(r=e).length;if(o){let s=o-1;if(uo(r[s])){if(1024<=(t=s-(+!!(512&(n|=256))-1)))throw Error("pvtlmt");n=-16760833&n|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&n)-1))))throw Error("spvt");n=-16760833&n|(1023&t)<<14}}}return $(e,n),e}var z1={},K1=function(){try{return Kn(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),Zt=class{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()}},$1=K1?(Object.setPrototypeOf(Zt.prototype,Map.prototype),Object.defineProperties(Zt.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Zt):class extends Map{constructor(){super()}};function ds(e){return e}function _n(e){if(2&e.N)throw Error("Cannot mutate an immutable Map")}var Le=class extends $1{constructor(e,t,r=ds,n=ds){super();let o=q(e);o|=64,$(e,o),this.N=o,this.U=t,this.S=r,this.Z=this.U?q1:n;for(let s=0;s<e.length;s++){let i=e[s],a=r(i[0],!1,!0),c=i[1];t?c===void 0&&(c=null):c=n(i[1],!1,!0,void 0,void 0,o),super.set(a,c)}}oa(e=ms){if(this.size!==0)return this.Y(e)}Y(e=ms){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){_n(this),super.clear()}delete(e){return _n(this),super.delete(this.S(e,!0,!1))}entries(){var e=this.na();return new Pr(e,J1,this)}keys(){return this.Ia()}values(){var e=this.na();return new Pr(e,Le.prototype.get,this)}forEach(e,t){super.forEach((r,n)=>{e.call(t,this.get(n),n,this)})}set(e,t){return _n(this),(e=this.S(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Z(t,!0,!0,this.U,!1,this.N))}Oa(e){let t=this.S(e[0],!1,!0);e=e[1],e=this.U?e===void 0?null:e:this.Z(e,!1,!0,void 0,!1,this.N),super.set(t,e)}has(e){return super.has(this.S(e,!1,!1))}get(e){e=this.S(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.U;return r?((r=this.Z(t,!1,!0,r,this.ta,this.N))!==t&&super.set(e,r),r):t}}na(){return Array.from(super.keys())}Ia(){return super.keys()}[Symbol.iterator](){return this.entries()}};function q1(e,t,r,n,o,s){return e=mo(e,n,r,s),o&&(e=Zr(e)),e}function ms(e){return e}function J1(e){return[e,this.get(e)]}var Z1;function ps(){return Z1||(Z1=new Le(Nt([]),void 0,void 0,void 0,z1))}function go(e,t,r,n,o){if(e!=null){if(Array.isArray(e))e=Br(e,void 0,0)?void 0:o&&2&q(e)?e:Jr(e,t,r,n!==void 0,o);else if(uo(e)){let s={};for(let i in e)s[i]=go(e[i],t,r,n,o);e=s}else e=t(e,n);return e}}function Jr(e,t,r,n,o){let s=n||r?q(e):0;n=n?!!(32&s):void 0;let i=be(e);for(let a=0;a<i.length;a++)i[a]=go(i[a],t,r,n,o);return r&&(_i(i,e),r(s,i)),i}function Q1(e){return go(e,yo,void 0,void 0,!1)}function yo(e){return e.X===dr?e.toJSON():e instanceof Le?e.oa(Q1):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Br(t,void 0,0))return}else{if(hr(t))return es(t);if(t instanceof rt){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=es(r)}if(t instanceof Le)return t.oa()}}return t}(e)}function In(e,t,r=Fn){if(e!=null){if(si&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=q(e);return 2&n||(t&&(t=n===0||!!(32&n)&&!(64&n||!(16&n))),e=t?$(e,-12293&(34|n)):Jr(e,In,4&n?Fn:r,!0,!0)),e}return e.X===dr?(r=e.s,e=2&(n=I(r))?e:vo(e,r,n,!0)):e instanceof Le&&!(2&e.N)&&(r=Nt(e.Y(In)),e=new Le(r,e.U,e.S,e.Z)),e}}function vo(e,t,r,n){return e=e.constructor,Nr=t=wi(t,r,n),t=new e(t),Nr=void 0,t}function wi(e,t,r){let n=r||2&t?Fn:G1,o=!!(32&t);return e=function(s,i,a){let c=be(s);var u=c.length;let h=256&i?c[u-1]:void 0;for(u+=h?-1:0,i=512&i?1:0;i<u;i++)c[i]=a(c[i]);if(h){i=c[i]={};for(let l in h)i[l]=a(h[l])}return _i(c,s),c}(e,t,s=>In(s,o,n)),ao(e,32|(r?2:0)),e}function Zr(e){let t=e.s,r=I(t);return 2&r?vo(e,t,r,!1):e}function Ri(e,t,r,n){return!(4&t)||r!=null&&(!n&&r===0&&(4096&t||8192&t)&&5>(e.constructor[us]=1+(0|e.constructor[us]))&&xi(),r!==0&&!(r&t))}function ft(e,t){return Je(e=e.s,I(e),t)}function gs(e,t,r,n){if(!(0>(t=n+(+!!(512&t)-1))||t>=e.length||t>=r))return e[t]}function Je(e,t,r,n){if(r===-1)return null;let o=yi(t);if(!(r>=o)){var s=e.length;return n&&256&t&&(n=e[s-1][r])!=null?(gs(e,t,o,r)&&vn!=null&&(4<=(t=(e=j1??(j1={}))[vn]||0)||(e[vn]=t+1,xi())),n):gs(e,t,o,r)}return 256&t?e[e.length-1][r]:void 0}function D(e,t,r,n){let o=e.s,s=I(o);return qe(s),V(o,s,t,r,n),e}function V(e,t,r,n,o){let s=yi(t);if(r>=s||o){let i=t;if(256&t)o=e[e.length-1];else{if(n==null)return i;o=e[s+(+!!(512&t)-1)]={},i|=256}return o[r]=n,r<s&&(e[r+(+!!(512&t)-1)]=void 0),i!==t&&$(e,i),i}return e[r+(+!!(512&t)-1)]=n,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function jt(e,t,r,n,o){var s=2&t;let i=Je(e,t,r,o);Array.isArray(i)||(i=co);let a=!(2&n);n=!(1&n);let c=!!(32&t),u=q(i);return u!==0||!c||s||a?1&u||(u|=1,$(i,u)):(u|=33,$(i,u)),s?(e=!1,2&u||(Nt(i),e=!!(4&u)),(n||e)&&Object.freeze(i)):(s=!!(2&u)||!!(2048&u),n&&s?(i=be(i),n=1,c&&!a&&(n|=32),$(i,n),V(e,t,r,i,o)):a&&32&u&&!s&&Ur(i,32)),i}function Rr(e,t){e=e.s;let r=I(e),n=Je(e,r,t),o=gt(n);return o!=null&&o!==n&&V(e,r,t,o),o}function Si(e){e=e.s;let t=I(e),r=Je(e,t,1),n=ho(r,!0,!!(34&t));return n!=null&&n!==r&&V(e,t,1,n),n}function kt(e,t,r){let n=e.s,o=I(n),s=2&o?1:2,i=ki(n,o,t);var a=q(i);if(Ri(e,a,void 0,!1)){(4&a||Object.isFrozen(i))&&(i=be(i),a=Rt(a,o),o=V(n,o,t,i));let c=e=0;for(;e<i.length;e++){let u=r(i[e]);u!=null&&(i[c++]=u)}c<e&&(i.length=c),a=ue(a=Ci(a,o),20,!0),a=ue(a,4096,!1),a=ue(a,8192,!1),$(i,a),2&a&&Object.freeze(i)}return Qt(a)||(r=a,(a=(e=s===1||s===4&&!!(32&a))?ue(a,2,!0):It(a,o,!1))!==r&&$(i,a),e&&Object.freeze(i)),s===2&&Qt(a)&&(i=be(i),a=It(a=Rt(a,o),o,!1),$(i,a),V(n,o,t,i)),i}function ki(e,t,r){return e=Je(e,t,r),Array.isArray(e)?e:co}function Ci(e,t){return e===0&&(e=Rt(e,t)),ue(e,1,!0)}function Qt(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Fi(e){e=be(e);for(let t=0;t<e.length;t++){let r=e[t]=be(e[t]);Array.isArray(r[1])&&(r[1]=Nt(r[1]))}return e}function Vr(e,t,r){{let a=e.s,c=I(a);if(qe(c),r==null)V(a,c,t);else{var n,o=q(r),s=o,i=!!(2&o)||Object.isFrozen(r);if((n=!i)&&(n=!1),Ri(e,o))for(o=21,i&&(r=be(r),s=0,o=It(o=Rt(o,c),c,!0)),e=0;e<r.length;e++)r[e]=mr(r[e]);n&&(r=be(r),s=0,o=It(o=Rt(o,c),c,!0)),o!==s&&$(r,o),V(a,c,t,r)}}}function Mn(e,t,r,n){e=e.s;let o=I(e);qe(o),V(e,o,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function pr(e,t,r,n){let o=I(e);qe(o),e=jt(e,o,t,2),n=r(n,!!(4&(t=q(e)))&&!!(4096&t)),e.push(n)}function e2(e){return e}function Tn(e,t){return _o(e=e.s,I(e),ma)===t?t:-1}function _o(e,t,r){let n=0;for(let o=0;o<r.length;o++){let s=r[o];Je(e,t,s)!=null&&(n!==0&&(t=V(e,t,n)),n=s)}return n}function To(e,t,r,n){let o=I(e);qe(o);let s=Je(e,o,r,n),i;if(s!=null&&s.X===dr)return(t=Zr(s))!==s&&V(e,o,r,t,n),t.s;if(Array.isArray(s)){let a=q(s);i=2&a?wi(s,a,!1):s,i=At(i,t)}else i=At(void 0,t);return i!==s&&V(e,o,r,i,n),i}function Li(e,t,r,n){e=e.s;let o=I(e),s=Je(e,o,r,n);return(t=mo(s,t,!1,o))!==s&&t!=null&&V(e,o,r,t,n),t}function C(e,t,r,n=!1){if((t=Li(e,t,r,n))==null)return t;e=e.s;let o=I(e);if(!(2&o)){let s=Zr(t);s!==t&&V(e,o,r,t=s,n)}return t}function Ii(e,t,r,n,o,s){var i=2,a=!!(2&t);i=a?1:i,o=!!o,s&&(s=!a),a=ki(e,t,n);var c=q(a);let u=!!(4&c);if(!u){var h=a,l=t;let m=!!(2&(c=Ci(c,t)));m&&(l=ue(l,2,!0));let b=!m,E=!0,A=0,Y=0;for(;A<h.length;A++){let d=mo(h[A],r,!1,l);if(d instanceof r){if(!m){let f=!!(2&q(d.s));b&&(b=!f),E&&(E=f)}h[Y++]=d}}Y<A&&(h.length=Y),c=ue(c,4,!0),c=ue(c,16,E),c=ue(c,8,b),$(h,c),m&&Object.freeze(h)}if(s&&!(8&c||!a.length&&(i===1||i===4&&32&c))){for(Qt(c)&&(a=be(a),c=Rt(c,t),t=V(e,t,n,a)),r=a,s=c,h=0;h<r.length;h++)(c=r[h])!==(l=Zr(c))&&(r[h]=l);s=ue(s,8,!0),s=ue(s,16,!r.length),$(r,s),c=s}return Qt(c)||(r=c,(c=(s=i===1||i===4&&!!(32&c))?ue(c,!a.length||16&c&&(!u||32&c)?2:2048,!0):It(c,t,o))!==r&&$(a,c),s&&Object.freeze(a)),i===2&&Qt(c)&&(a=be(a),c=It(c=Rt(c,t),t,o),$(a,c),V(e,t,n,a)),a}function ot(e,t,r){e=e.s;let n=I(e);return Ii(e,n,t,r,!1,!(2&n))}function T(e,t,r,n,o){return n==null&&(n=void 0),D(e,r,n,o)}function er(e,t,r,n){n==null&&(n=void 0),e=e.s;let o=I(e);qe(o),(r=_o(e,o,r))&&r!==t&&n!=null&&(o=V(e,o,r)),V(e,o,t,n)}function Rt(e,t){return e=ue(e,2,!!(2&t)),e=ue(e,32,!0),ue(e,2048,!1)}function It(e,t,r){return 32&t&&r||(e=ue(e,32,!1)),e}function jr(e,t,r,n){e=e.s;let o=I(e);qe(o),t=Ii(e,o,r,t,!0),r=n??new r,t.push(r),2&q(r.s)?Ur(t,8):Ur(t,16)}function Fe(e,t){return Gt(ft(e,t))}function Pe(e,t){return e??t}function Z(e,t){return Pe(Rr(e,t),0)}function ze(e,t){return Pe(Et(ft(e,t)),"")}function ar(e,t,r){if(r!=null&&typeof r!="boolean")throw e=typeof r,Error(`Expected boolean but got ${e!="object"?e:r?Array.isArray(r)?"array":e:"null"}: ${r}`);D(e,t,r)}function Ke(e,t,r){if(r!=null){if(typeof r!="number"||!Number.isFinite(r))throw Ln("int32");r|=0}D(e,t,r)}function y(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);D(e,t,r)}function De(e,t,r){t.g?t.m(e,t.g,t.h,r,!0):t.m(e,t.h,r,!0)}Le.prototype.toJSON=void 0,Le.prototype.Ja=vi;var g=class{constructor(e,t){this.s=Ai(e,t)}toJSON(){return Mi(this,Jr(this.s,yo,void 0,void 0,!1),!0)}l(){var e=sc;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.s;return vo(this,e,I(e),!1)}P(){return!!(2&q(this.s))}};function Mi(e,t,r){var n=C1?void 0:e.constructor.B;let o=I(r?e.s:t);if(!(e=t.length))return t;let s,i;if(uo(r=t[e-1])){e:{var a=r;let h={},l=!1;for(var c in a){let m=a[c];if(Array.isArray(m)){let b=m;(Br(m,n,+c)||hs(m)&&m.size===0)&&(m=null),m!=b&&(l=!0)}m!=null?h[c]=m:l=!0}if(l){for(var u in h){a=h;break e}a=null}}a!=r&&(s=!0),e--}for(c=+!!(512&o)-1;0<e&&(r=t[u=e-1],u-=c,r==null||Br(r,n,u)||hs(r)&&r.size===0);e--)i=!0;return(s||i)&&(t=Array.prototype.slice.call(t,0,e),a&&t.push(a)),t}function Oi(e){return Array.isArray(e)?e[0]instanceof lt?e:[l2,e]:[e,void 0]}function Xt(e,t){if(Array.isArray(t)){var r=q(t);if(4&r)return t;for(var n=0,o=0;n<t.length;n++){let s=e(t[n]);s!=null&&(t[o++]=s)}return o<n&&(t.length=o),$(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}g.prototype.X=dr,g.prototype.toString=function(){return Mi(this,this.s,!1).toString()};var ys=Symbol();function xo(e){let t=e[ys];if(!t){let r=Bi(e),n=Eo(e),o=n.l;t=o?(s,i)=>o(s,i,n):(s,i)=>{for(;pi(i)&&i.h!=4;){var a=i.m,c=n[a];if(!c){var u=n.ea;u&&(u=u[a])&&(c=n[a]=t2(u))}c&&c(i,s,a)||(a=(c=i).l,wr(c),c.ia?c=void 0:(u=c.g.g-a,c.g.g=a,c=mi(c.g,u)),a=s,c&&(ct||(ct=Symbol()),(u=a[ct])?u.push(c):a[ct]=[c]))}r===Ui||r===Sr||r.j||(s[V1||(V1=Symbol())]=r)},e[ys]=t}return t}function t2(e){let t=(e=Oi(e))[0].g;if(e=e[1]){let r=xo(e),n=Eo(e).T;return(o,s,i)=>t(o,s,i,n,r)}return t}var tr=class{},Ui,Sr,rr=Symbol();function r2(e,t,r){let n=r[1],o;if(n){let s=n[rr];o=s?s.T:Gr(n[0]),e[t]=s??n}o&&o===po?(e.g||(e.g=new Set)).add(t):r[0]&&(e.h||(e.h=new Set)).add(t)}function vs(e,t){return[e.l,!t||0<t[0]?void 0:t]}function Bi(e){var t=e[rr];if(t)return t;if(!(t=bo(e,e[rr]=new tr,vs,vs,r2)).ea&&!t.h&&!t.g){let r=!0;for(let n in t)isNaN(n)||(r=!1);r?(Gr(e[0])===po?Sr?t=Sr:((t=new tr).T=Gr(!0),t=Sr=t):t=Ui||(Ui=new tr),t=e[rr]=t):t.j=!0}return t}function n2(e,t,r){e[t]=r}function bo(e,t,r,n,o=n2){t.T=Gr(e[0]);let s=0;var i=e[++s];i&&i.constructor===Object&&(t.ea=i,typeof(i=e[++s])=="function"&&(t.l=i,t.m=e[++s],i=e[++s]));let a={};for(;Array.isArray(i)&&typeof i[0]=="number"&&0<i[0];){for(var c=0;c<i.length;c++)a[i[c]]=i;i=e[++s]}for(c=1;i!==void 0;){let l;typeof i=="number"&&(c+=i,i=e[++s]);var u=void 0;if(i instanceof lt?l=i:(l=f2,s--),l.pa){i=e[++s],u=e;var h=s;typeof i=="function"&&(i=i(),u[h]=i),u=i}for(h=c+1,typeof(i=e[++s])=="number"&&0>i&&(h-=i,i=e[++s]);c<h;c++){let m=a[c];o(t,c,u?n(l,u,m):r(l,m))}}return t}var _s=Symbol();function Pi(e){let t=e[_s];if(!t){let r=Qr(e);t=(n,o)=>Ni(n,o,r),e[_s]=t}return t}var On=Symbol();function o2(e){return e.h}function s2(e,t){let r,n,o=e.h;return(s,i,a)=>o(s,i,a,n||(n=Qr(t).T),r||(r=Pi(t)))}function Qr(e){let t=e[On];return t||(t=bo(e,e[On]={},o2,s2),Di(e),t)}var Un=Symbol();function i2(e,t){let r=e.g;return t?(n,o,s)=>r(n,o,s,t):r}function a2(e,t,r){let n=e.g,o,s;return(i,a,c)=>n(i,a,c,s||(s=Eo(t).T),o||(o=xo(t)),r)}function Eo(e){let t=e[Un];return t||(Bi(e),t=bo(e,e[Un]={},i2,a2),Di(e),t)}function Di(e){Un in e&&rr in e&&On in e&&(e.length=0)}function Ts(e,t){var r=e[t];if(r)return r;if((r=e.ea)&&(r=r[t])){var n=(r=Oi(r))[0].h;if(r=r[1]){let o=Pi(r),s=Qr(r).T;r=(r=e.m)?r(s,o):(i,a,c)=>n(i,a,c,s,o)}else r=n;return e[t]=r}}function Ni(e,t,r){for(var n=I(e),o=+!!(512&n)-1,s=e.length,i=512&n?1:0,a=s+(256&n?-1:0);i<a;i++){let c=e[i];if(c==null)continue;let u=i-o,h=Ts(r,u);h&&h(t,c,u)}if(256&n){n=e[s-1];for(let c in n)o=+c,Number.isNaN(o)||(s=n[c])!=null&&(a=Ts(r,o))&&a(t,s,o)}if(e=ct?e[ct]:void 0)for(Lt(t,t.g.end()),r=0;r<e.length;r++)Lt(t,$n(e[r])||Wr())}function ge(e,t){return new lt(e,t,!1,!1)}function Wt(e,t){return new lt(e,t,!0,!1)}function en(e,t){return new lt(e,t,!1,!0)}function ye(e,t,r){V(e,I(e),t,r)}var c2=en(function(e,t,r,n,o){return e.h===2&&(e=lr(e,At([void 0,void 0],n),o),qe(n=I(t)),(o=Je(t,n,r))instanceof Le?2&o.N?((o=o.Y()).push(e),V(t,n,r,o)):o.Oa(e):Array.isArray(o)?(2&q(o)&&V(t,n,r,o=Fi(o)),o.push(e)):V(t,n,r,[e]),!0)},function(e,t,r,n,o){if(t instanceof Le)t.forEach((s,i)=>{Cn(e,r,At([i,s],n),o)});else if(Array.isArray(t))for(let s=0;s<t.length;s++){let i=t[s];Array.isArray(i)&&Cn(e,r,At(i,n),o)}});function Gi(e,t,r){e:if(t!=null){if(qr(t)){if(typeof t=="string"){t=fo(t);break e}if(typeof t=="number"){t=lo(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&is(t),t!=null&&(Ie(e,r,0),typeof t=="number"?(e=e.g,xt(t),Or(e,G,te)):(r=is(t),Or(e.g,r.h,r.g))))}function Vi(e,t,r){(t=Gt(t))!=null&&t!=null&&(Ie(e,r,0),zr(e.g,t))}function ji(e,t,r){(t=bi(t))!=null&&(Ie(e,r,0),e.g.g.push(t?1:0))}function Xi(e,t,r){(t=Et(t))!=null&&Kr(e,r,ti(t))}function tn(e,t,r,n,o){Cn(e,r,t instanceof g?t.s:Array.isArray(t)?At(t,n):void 0,o)}function Wi(e,t,r){(t=t==null||typeof t=="string"||hr(t)||t instanceof rt?t:void 0)!=null&&Kr(e,r,Jn(t).buffer)}function Hi(e,t,r){return(e.h===5||e.h===2)&&(t=jt(t,I(t),r,2,!1),e.h==2?Yr(e,kn,t):t.push(kn(e.g)),!0)}var re,nt=ge(function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=Sn(n);let o=Sn(n);n=2*(o>>31)+1;let s=o>>>20&2047;return e=4294967296*(1048575&o)+e,ye(t,r,s==2047?e?NaN:1/0*n:s==0?n*Math.pow(2,-1074)*e:n*Math.pow(2,s-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=gt(t))!=null&&(Ie(e,r,1),e=e.g,(r=li||(li=new DataView(new ArrayBuffer(8)))).setFloat64(0,+t,!0),G=r.getUint32(0,!0),te=r.getUint32(4,!0),ir(e,G),ir(e,te))}),oe=ge(function(e,t,r){return e.h===5&&(ye(t,r,kn(e.g)),!0)},function(e,t,r){(t=gt(t))!=null&&(Ie(e,r,5),e=e.g,Qn(t),ir(e,G))}),u2=Wt(Hi,function(e,t,r){if((t=Xt(gt,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&(Ie(n,o,5),n=n.g,Qn(s),ir(n,G))}}),Ao=Wt(Hi,function(e,t,r){if((t=Xt(gt,t))!=null&&t.length){Ie(e,r,2),fr(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,Qn(t[n]),ir(r,G)}}),dt=ge(function(e,t,r){return e.h===0&&(ye(t,r,ro(e.g,eo)),!0)},Gi),xn=ge(function(e,t,r){return e.h===0&&(ye(t,r,(e=ro(e.g,eo))===0?void 0:e),!0)},Gi),h2=ge(function(e,t,r){return e.h===0&&(ye(t,r,ro(e.g,Rn)),!0)},function(e,t,r){e:if(t!=null){if(qr(t)){if(typeof t=="string"){var n=Math.trunc(Number(t));Number.isSafeInteger(n)&&0<=n?t=String(n):((n=t.indexOf("."))!==-1&&(t=t.substring(0,n)),fs(t)||(Hr(t),t=Mr(G,te)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){xt(o);let s=Mr(G,te);return o=Number(s),Number.isSafeInteger(o)?o:s}return fs(String(o))?o:(xt(o),Rn(G,te))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&os(t),t!=null&&(Ie(e,r,0),typeof t=="number"?(e=e.g,xt(t),Or(e,G,te)):(r=os(t),Or(e.g,r.h,r.g))))}),J=ge(function(e,t,r){return e.h===0&&(ye(t,r,ut(e.g)),!0)},Vi),rn=Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,I(t),r,2,!1),e.h==2?Yr(e,ut,t):t.push(ut(e.g)),!0)},function(e,t,r){if((t=Xt(Gt,t))!=null&&t.length){r=so(e,r);for(let n=0;n<t.length;n++)zr(e.g,t[n]);io(e,r)}}),Mt=ge(function(e,t,r){return e.h===0&&(ye(t,r,(e=ut(e.g))===0?void 0:e),!0)},Vi),Q=ge(function(e,t,r){return e.h===0&&(ye(t,r,no(e.g)),!0)},ji),nr=ge(function(e,t,r){return e.h===0&&(ye(t,r,(e=no(e.g))===!1?void 0:e),!0)},ji),he=Wt(function(e,t,r){return e.h===2&&(pr(t,r,e2,e=oo(e)),!0)},function(e,t,r){if((t=Xt(Et,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&Kr(n,o,ti(s))}}),mt=ge(function(e,t,r){return e.h===2&&(ye(t,r,(e=oo(e))===""?void 0:e),!0)},Xi),U=ge(function(e,t,r){return e.h===2&&(ye(t,r,oo(e)),!0)},Xi),l2=en(function(e,t,r,n,o){return e.h===2&&(lr(e,To(t,n,r,!0),o),!0)},tn),f2=en(function(e,t,r,n,o){return e.h===2&&(lr(e,To(t,n,r),o),!0)},tn);re=new lt(function(e,t,r,n,o){if(e.h!==2)return!1;n=At(void 0,n);let s=I(t);qe(s);let i=jt(t,s,r,3);return s=I(t),4&q(i)&&(i=be(i),$(i,-2079&(1|q(i))),V(t,s,r,i)),i.push(n),lr(e,n,o),!0},function(e,t,r,n,o){if(Array.isArray(t))for(let s=0;s<t.length;s++)tn(e,t[s],r,n,o)},!0,!0);var P=en(function(e,t,r,n,o,s){if(e.h!==2)return!1;let i=I(t);return qe(i),(s=_o(t,i,s))&&r!==s&&V(t,i,s),lr(e,t=To(t,n,r),o),!0},tn),Yi=ge(function(e,t,r){return e.h===2&&(ye(t,r,gi(e)),!0)},Wi),d2=Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,I(t),r,2,!1),e.h==2?Yr(e,ht,t):t.push(ht(e.g)),!0)},function(e,t,r){if((t=Xt(W1,t))!=null)for(let i=0;i<t.length;i++){var n=e,o=r,s=t[i];s!=null&&(Ie(n,o,0),fr(n.g,s))}}),$e=ge(function(e,t,r){return e.h===0&&(ye(t,r,ut(e.g)),!0)},function(e,t,r){(t=Gt(t))!=null&&(t=parseInt(t,10),Ie(e,r,0),zr(e.g,t))}),m2=Wt(function(e,t,r){return(e.h===0||e.h===2)&&(t=jt(t,I(t),r,2,!1),e.h==2?Yr(e,P1,t):t.push(ut(e.g)),!0)},function(e,t,r){if((t=Xt(Gt,t))!=null&&t.length){r=so(e,r);for(let n=0;n<t.length;n++)zr(e.g,t[n]);io(e,r)}}),Bn=class{constructor(t,r){this.h=t,this.g=r,this.l=C,this.m=T,this.defaultValue=void 0}};function Ne(e,t){return new Bn(e,t)}function yt(e,t){return(r,n)=>{if(xr.length){let s=xr.pop();s.o(n),yn(s.g,r,n),r=s}else r=new class{constructor(s,i){if(ns.length){let a=ns.pop();yn(a,s,i),s=a}else s=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,yn(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ca=!1}}(s,i);this.g=s,this.l=this.g.g,this.h=this.m=-1,this.o(i)}o({ia:s=!1}={}){this.ia=s}}(r,n);try{let s=new e,i=s.s;xo(t)(i,r);var o=s}finally{r.g.clear(),r.m=-1,r.h=-1,100>xr.length&&xr.push(r)}return o}}function nn(e){return function(){let t=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let i=this.g;return this.g=[],i}}}};Ni(this.s,t,Qr(e)),Lt(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,o=n.length,s=0;for(let i=0;i<o;i++){let a=n[i];r.set(a,s),s+=a.length}return t.l=[r],r}}var xs=class extends g{constructor(e){super(e)}},zi=[0,mt,ge(function(e,t,r){return e.h===2&&(ye(t,r,(e=gi(e))===wt()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof g){let n=t.Qa;return void(n&&(t=n(t),t!=null&&Kr(e,r,Jn(t).buffer)))}if(Array.isArray(t))return}Wi(e,t,r)})],p2=[0,U],Ki=[0,J,$e,Q,-1,rn,$e,-1],g2=[0,Q,-1],$i=class extends g{constructor(){super()}};$i.B=[6];var qi=[0,Q,U,Q,$e,-1,m2,U,-1,g2,$e],Ji=[0,U,-2],bs=class extends g{constructor(){super()}},Zi=[0],Qi=[0,J,Q,-4],Ee=class extends g{constructor(e){super(e,2)}},W={},y2=[-2,W,Q];W[336783863]=[0,U,Q,-1,J,[0,[1,2,3,4,5,6],P,Zi,P,qi,P,Ji,P,Qi,P,Ki,P,[0,U]],p2,Q,[0,[1,3],[2,4],P,[0,rn],-1,P,[0,he],-1,re,[0,U,-1]],U];var v2=[0,mt,nr],ea=[0,xn,-1,nr,-3,xn,rn,mt,Mt,xn,-1,nr,Mt,nr,-2,mt],gr=[-1,{}],ta=[0,U,1,gr],ra=[0,U,he,gr];function Ae(e,t){Mn(e,2,Vt(t),"")}function N(e,t){pr(e.s,3,mr,t)}function R(e,t){pr(e.s,4,mr,t)}var le=class extends g{constructor(e){super(e,500)}o(e){return T(this,0,7,e)}};le.B=[3,4,5,6,8,13,17,1005];var _2=[-500,mt,-1,he,-3,y2,re,zi,Mt,-1,ta,ra,re,v2,mt,ea,Mt,he,987,he],T2=[0,mt,-1,gr],x2=[-500,U,-1,[-1,{}],998,U],b2=[-500,U,he,-1,[-2,{},Q],997,he,-1],E2=[-500,U,he,gr,998,he];function we(e,t){jr(e,1,le,t)}function j(e,t){pr(e.s,10,mr,t)}function F(e,t){pr(e.s,15,mr,t)}var de=class extends g{constructor(e){super(e,500)}o(e){return T(this,0,1001,e)}};de.B=[1,6,7,9,10,15,16,17,14,1002];var na=[-500,re,_2,4,re,x2,re,b2,Mt,re,E2,he,Mt,ta,ra,re,T2,he,-2,ea,mt,-1,nr,979,gr,re,zi],A2=yt(de,na);de.prototype.g=nn(na);var w2=[0,re,[0,J,-2]],R2=class extends g{constructor(e){super(e)}},S2=[0,J,oe,U,-1],wo=class extends g{constructor(e){super(e)}g(){return ot(this,R2,1)}};wo.B=[1];var oa=[0,re,S2],on=yt(wo,oa),k2=[0,J,oe],C2=[0,J,-1,w2],F2=class extends g{constructor(e){super(e)}},L2=[0,J,-3],I2=[0,oe,-3],M2=class extends g{constructor(e){super(e)}},O2=[0,oe,-1,U,oe],kr=class extends g{constructor(e){super(e)}h(){return C(this,F2,2)}g(){return ot(this,M2,5)}};kr.B=[5];var U2=[0,$e,L2,I2,C2,re,O2],sa=class extends g{constructor(e){super(e)}};sa.B=[1,2,3,8,9];var ia=yt(sa,[0,he,rn,Ao,U2,U,-1,dt,re,k2,he,dt]),aa=class extends g{constructor(e){super(e)}},B2=[0,oe,-4],ca=class extends g{constructor(e){super(e)}};ca.B=[1];var Ct=yt(ca,[0,re,B2]),ua=class extends g{constructor(e){super(e)}},P2=[0,oe,-4],ha=class extends g{constructor(e){super(e)}};ha.B=[1];var yr=yt(ha,[0,re,P2]),la=class extends g{constructor(e){super(e)}};la.B=[3];var D2=[0,J,-1,Ao,$e],fa=class extends g{constructor(){super()}};fa.prototype.g=nn([0,oe,-4,dt]);var N2=class extends g{constructor(e){super(e)}},G2=[0,1,J,U,oa],da=class extends g{constructor(e){super(e)}};da.B=[1];var V2=yt(da,[0,re,G2,dt]),Pn=class extends g{constructor(e){super(e)}};Pn.B=[1];var j2=class extends g{constructor(e){super(e)}qa(){let e=Si(this);return e??wt()}},X2=class extends g{constructor(e){super(e)}},ma=[1,2],W2=[0,ma,P,[0,Ao],P,[0,Yi],J,U],pa=class extends g{constructor(e){super(e)}};pa.B=[1];var H2=yt(pa,[0,re,W2,dt]),sn=class extends g{constructor(e){super(e)}};sn.B=[4,5];var ga=[0,U,J,oe,he,-1],Es=class extends g{constructor(e){super(e)}},Y2=[0,Q,-1],As=class extends g{constructor(e){super(e)}},Cr=[1,2,3,4,5],Xr=class extends g{constructor(e){super(e)}g(){return Si(this)!=null}h(){return Et(ft(this,2))!=null}},ya=[0,Yi,U,[0,J,dt,-1],[0,h2,dt]],H=class extends g{constructor(e){super(e)}g(){return bi(ft(this,2))??!1}},ee=[0,ya,Q,[0,Cr,P,Qi,P,qi,P,Ki,P,Zi,P,Ji],$e],an=class extends g{constructor(e){super(e)}},Ro=[0,ee,oe,-1,J],z2=Ne(502141897,an);W[502141897]=Ro;var va=[0,ya];W[512499200]=va;var _a=[0,va];W[515723506]=_a;var K2=yt(class extends g{constructor(e){super(e)}},[0,[0,$e,-1,u2,d2],D2]),Ta=[0,ee];W[508981768]=Ta;var xa=class extends g{constructor(e){super(e)}},So=[0,ee,oe,Ta,Q],ba=class extends g{constructor(e){super(e)}},Ea=[0,ee,Ro,So,oe,_a];W[508968149]=So;var $2=Ne(508968150,ba);W[508968150]=Ea;var Aa=class extends g{constructor(e){super(e)}},q2=Ne(513916220,Aa);W[513916220]=[0,ee,Ea,J];var St=class extends g{constructor(e){super(e)}h(){return C(this,sn,2)}g(){D(this,2)}},wa=[0,ee,ga];W[478825465]=wa;var Ra=[0,ee];W[478825422]=Ra;var J2=class extends g{constructor(e){super(e)}},Sa=[0,ee,Ra,wa,-1],ka=class extends g{constructor(e){super(e)}},Ca=[0,ee,oe,J],ko=class extends g{constructor(e){super(e)}},Co=[0,ee,oe],Fo=class extends g{constructor(e){super(e)}},Fa=[0,ee,Ca,Co,oe],La=class extends g{constructor(e){super(e)}},Z2=[0,ee,Fa,Sa];W[463370452]=Sa,W[464864288]=Ca,W[474472470]=Co;var Q2=Ne(462713202,Fo);W[462713202]=Fa;var ec=Ne(479097054,La);W[479097054]=Z2;var tc=class extends g{constructor(e){super(e)}},rc=[0,ee],Ia=class extends g{constructor(e){super(e)}},Lo=[0,ee,oe,-1,J];W[514774813]=Lo;var Ma=class extends g{constructor(e){super(e)}},Io=[0,ee,oe,Q];W[518928384]=Io;var Oa=class extends g{constructor(){super()}};Oa.prototype.g=nn([0,ee,Co,rc,Ro,So,Lo,Io]);var Ua=class extends g{constructor(e){super(e)}},nc=Ne(456383383,Ua);W[456383383]=[0,ee,ga];var Ba=class extends g{constructor(e){super(e)}},oc=Ne(476348187,Ba);W[476348187]=[0,ee,Y2];var Pa=class extends g{constructor(e){super(e)}},Da=[0,$e,-1],Dn=class extends g{constructor(e){super(e)}};Dn.B=[3];var sc=Ne(458105876,class extends g{constructor(e){super(e)}g(){var e=this.s;let t=I(e);var r=2&t;return e=function(n,o,s){var i=Dn;let a=2&o,c=!1;if(s==null){if(a)return ps();s=[]}else if(s.constructor===Le){if(!(2&s.N)||a)return s;s=s.Y()}else Array.isArray(s)?c=!!(2&q(s)):s=[];if(a){if(!s.length)return ps();c||(c=!0,Nt(s))}else c&&(c=!1,s=Fi(s));return c||(64&q(s)?Ur(s,32):32&o&&ao(s,32)),V(n,o,2,i=new Le(s,i,H1,void 0),!1),i}(e,t,Je(e,t,2)),e==null||!r&&Dn&&(e.ta=!0),r=e}});W[458105876]=[0,Da,c2,[!0,dt,[0,U,-1,he]]];var Mo=class extends g{constructor(e){super(e)}},Na=Ne(458105758,Mo);W[458105758]=[0,ee,U,Da];var Oo=class extends g{constructor(e){super(e)}};Oo.B=[5,6];var ic=Ne(443442058,Oo);W[443442058]=[0,ee,U,J,oe,he,-1];var Ga=class extends g{constructor(e){super(e)}},ac=Ne(516587230,Ga);function Nn(e,t){return t=t?t.clone():new sn,e.displayNamesLocale!==void 0?D(t,1,Vt(e.displayNamesLocale)):e.displayNamesLocale===void 0&&D(t,1),e.maxResults!==void 0?Ke(t,2,e.maxResults):"maxResults"in e&&D(t,2),e.scoreThreshold!==void 0?y(t,3,e.scoreThreshold):"scoreThreshold"in e&&D(t,3),e.categoryAllowlist!==void 0?Vr(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&D(t,4),e.categoryDenylist!==void 0?Vr(t,5,e.categoryDenylist):"categoryDenylist"in e&&D(t,5),t}function Uo(e,t=-1,r=""){return{categories:e.map(n=>({index:Pe(Fe(n,1),0)??-1,score:Z(n,2)??0,categoryName:ze(n,3)??"",displayName:ze(n,4)??""})),headIndex:t,headName:r}}function Va(e){var t=kt(e,3,gt),r=kt(e,2,Gt),n=kt(e,1,Et),o=kt(e,9,Et);let s={categories:[],keypoints:[]};for(let i=0;i<t.length;i++)s.categories.push({score:t[i],index:r[i]??-1,categoryName:n[i]??"",displayName:o[i]??""});if((t=C(e,kr,4)?.h())&&(s.boundingBox={originX:Fe(t,1)??0,originY:Fe(t,2)??0,width:Fe(t,3)??0,height:Fe(t,4)??0,angle:0}),C(e,kr,4)?.g().length)for(let i of C(e,kr,4).g())s.keypoints.push({x:Rr(i,1)??0,y:Rr(i,2)??0,score:Rr(i,4)??0,label:Et(ft(i,3))??""});return s}function cn(e){let t=[];for(let r of ot(e,ua,1))t.push({x:Z(r,1)??0,y:Z(r,2)??0,z:Z(r,3)??0,visibility:Z(r,4)??0});return t}function or(e){let t=[];for(let r of ot(e,aa,1))t.push({x:Z(r,1)??0,y:Z(r,2)??0,z:Z(r,3)??0,visibility:Z(r,4)??0});return t}function ws(e){return Array.from(e,t=>127<t?t-256:t)}function Rs(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,o=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s],n+=e[s]*e[s],o+=t[s]*t[s];if(0>=n||0>=o)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*o)}var br;W[516587230]=[0,ee,Lo,Io,oe];var cc=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 ja(){if(br===void 0)try{await WebAssembly.instantiate(cc),br=!0}catch{br=!1}return br}async function Kt(e,t=""){let r=await ja()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var it=class{};function Xa(){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/))&&1<=e.length&&17<=Number(e[1])))}async function Ss(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{n(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Wa(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 _(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 ks(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);let[n,o]=Wa(t);return!e.l||n===e.i.canvas.width&&o===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=o),[n,o]}function Cs(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let o=0;o<t.length;o++)n[o]=e.i.stringToNewUTF8(t[o]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let o of n)e.i._free(o);e.i._free(t)}function je(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function st(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(o,s,i)=>{s?(r(n,i),n=[]):n.push(o)}}it.forVisionTasks=function(e){return Kt("vision",e)},it.forTextTasks=function(e){return Kt("text",e)},it.forGenAiExperimentalTasks=function(e){return Kt("genai_experimental",e)},it.forGenAiTasks=function(e){return Kt("genai",e)},it.forAudioTasks=function(e){return Kt("audio",e)},it.isSimdSupported=function(){return ja()};async function uc(e,t,r,n){return e=await(async(o,s,i,a,c)=>{if(s&&await Ss(s),!self.ModuleFactory||i&&(await Ss(i),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((s=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(s.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new o(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:o=>o.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&o.endsWith(".data")?r.assetBinaryPath.toString():o}),await e.o(n),e}function bn(e,t){let r=C(e.baseOptions,Xr,1)||new Xr;typeof t=="string"?(D(r,2,Vt(t)),D(r,1)):t instanceof Uint8Array&&(D(r,1,ho(t,!1,!1)),D(r,2)),T(e.baseOptions,0,1,r)}function Fs(e){try{let t=e.K.length;if(t===1)throw Error(e.K[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.K.map(r=>r.message).join(", "))}finally{e.K=[]}}function p(e,t){e.J=Math.max(e.J,t)}function un(e,t){e.C=new le,Ae(e.C,"PassThroughCalculator"),N(e.C,"free_memory"),R(e.C,"free_memory_unused_out"),j(t,"free_memory"),we(t,e.C)}function Ot(e,t){N(e.C,t),R(e.C,t+"_unused_out")}function hn(e){e.g.addBoolToStream(!0,"free_memory",e.J)}var Fr=class{constructor(e){this.g=e,this.K=[],this.J=0,this.g.setAutoRenderToScreen(!1)}l(e,t=!0){if(t){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(C(this.baseOptions,Xr,1)?.g()||C(this.baseOptions,Xr,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(n,o){let s=C(n.baseOptions,As,3);if(!s){var i=s=new As,a=new bs;er(i,4,Cr,a)}"delegate"in o&&(o.delegate==="GPU"?(o=s,i=new $i,er(o,2,Cr,i)):(o=s,i=new bs,er(o,4,Cr,i))),T(n.baseOptions,0,3,s)}(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)}).then(n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),bn(this,"/model.dat"),this.m(),this.L()});if(r.modelAssetBuffer instanceof Uint8Array)bn(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(n){let o=[];for(var s=0;;){let{done:i,value:a}=await n.read();if(i)break;o.push(a),s+=a.length}if(o.length===0)return new Uint8Array(0);if(o.length===1)return o[0];n=new Uint8Array(s),s=0;for(let i of o)n.set(i,s),s+=i.length;return n}(r.modelAssetBuffer).then(n=>{bn(this,n),this.m(),this.L()})}return this.m(),this.L(),Promise.resolve()}L(){}fa(){let e;if(this.g.fa(t=>{e=A2(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.K.push(Error(n))}),this.g.Ma(),this.g.setGraph(e,t),this.C=void 0,Fs(this)}finishProcessing(){this.g.finishProcessing(),Fs(this)}close(){this.C=void 0,this.g.closeGraph()}};function fe(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Fr.prototype.close=Fr.prototype.close,function(e,t){e=e.split(".");var r,n=ur;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t}("TaskRunner",Fr);var Gn=class{constructor(t,r,n,o){this.g=t,this.h=r,this.m=n,this.l=o}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Ls(e,t,r){let n=e.g;if(r=fe(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 Is(e,t){let r=e.g,n=fe(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let o=fe(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.K),r.vertexAttribPointer(e.K,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let s=fe(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,s),r.enableVertexAttribArray(e.J),r.vertexAttribPointer(e.J,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 Gn(r,n,o,s)}function Bo(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function vr(e,t,r,n){return Bo(e,t),e.h||(e.m(),e.D()),r?(e.v||(e.v=Is(e,!0)),r=e.v):(e.A||(e.A=Is(e,!1)),r=e.A),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function pt(e,t,r){return Bo(e,t),e=fe(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 ln(e,t,r){Bo(e,t),e.u||(e.u=fe(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.u),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Po(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Ht=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(){let e=this.g;if(this.h=he(e.createProgram(),"Failed to create WebGL program"),this.ba=Is(this,`
8
+ `}m(){let e=this.g;if(this.h=fe(e.createProgram(),"Failed to create WebGL program"),this.ba=Ls(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.aa=Is(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.K=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.ba),e.deleteShader(this.aa)}this.u&&this.g.deleteFramebuffer(this.u),this.A&&this.A.close(),this.v&&this.v.close()}},ac=class extends Ht{H(){return`
15
+ }`,e.VERTEX_SHADER),this.aa=Ls(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.K=e.getAttribLocation(this.h,"aVertex"),this.J=e.getAttribLocation(this.h,"aTex")}D(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.ba),e.deleteShader(this.aa)}this.u&&this.g.deleteFramebuffer(this.u),this.A&&this.A.close(),this.v&&this.v.close()}},hc=class extends Ht{H(){return`
16
16
  precision mediump float;
17
17
  uniform sampler2D backgroundTexture;
18
18
  uniform sampler2D maskTexture;
@@ -24,7 +24,7 @@ var cr=typeof self<"u"?self:{};function ti(e){e:{for(var t=["CLOSURE_FLAGS"],r=c
24
24
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
25
25
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
26
26
  }
27
- `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.C=ft(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=ft(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.M=he(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.V=he(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.L=he(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.L,0),e.uniform1i(this.M,1),e.uniform1i(this.V,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},cc=class extends Ht{H(){return`
27
+ `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.C=pt(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=pt(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.M=fe(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.V=fe(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.L=fe(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.L,0),e.uniform1i(this.M,1),e.uniform1i(this.V,2)}close(){this.C&&this.g.deleteTexture(this.C),this.j&&this.g.deleteTexture(this.j),super.close()}},lc=class extends Ht{H(){return`
28
28
  precision mediump float;
29
29
  uniform sampler2D maskTexture;
30
30
  uniform sampler2D defaultTexture;
@@ -38,15 +38,15 @@ var cr=typeof self<"u"?self:{};function ti(e){e:{for(var t=["CLOSURE_FLAGS"],r=c
38
38
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
39
39
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
40
40
  }
41
- `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=ft(this,e),e.activeTexture(e.TEXTURE2),this.C=ft(this,e)}m(){super.m();let e=this.g;this.L=he(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.M=he(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.I=he(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.L,1),e.uniform1i(this.M,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function Ze(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 Vn(e){var t=Ze(e,1);if(!t){if(t=Ze(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);let n=Pt(e);var r=Bo(e);if(hn(r,n,za(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"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 o=0,s=0;o<t.length;++o,s+=4)t[o]=r[s]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function za(e){let t=Ze(e,2);if(!t){let r=Pt(e);t=Ka(e);let n=Vn(e),o=Ya(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,n),jn(e)}return t}function Pt(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=he(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ya(e){if(e=Pt(e),!br)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))br=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");br=e.R16F}return br}function Bo(e){return e.l||(e.l=new Ht),e.l}function Ka(e){let t=Pt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Ze(e,2);return r||(r=ft(Bo(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function jn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var br,ne=class{constructor(e,t,r,n,o,s,i){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=o,this.width=s,this.height=i,this.j&&--Os===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Ha(){return!!Ze(this,0)}la(){return!!Ze(this,1)}R(){return!!Ze(this,2)}ka(){return(t=Ze(e=this,0))||(t=Vn(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ja(){return Vn(this)}O(){return za(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=Pt(this),o=Bo(this);n.activeTexture(n.TEXTURE1),r=ft(o,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let s=Ya(this);n.texImage2D(n.TEXTURE_2D,0,s,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),hn(o,n,r),yr(o,n,!1,()=>{Ka(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),jn(this)}),Do(o),jn(this)}}e.push(r)}return new ne(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Pt(this).deleteTexture(Ze(this,2)),Os=-1}};ne.prototype.close=ne.prototype.close,ne.prototype.clone=ne.prototype.clone,ne.prototype.getAsWebGLTexture=ne.prototype.O,ne.prototype.getAsFloat32Array=ne.prototype.ja,ne.prototype.getAsUint8Array=ne.prototype.ka,ne.prototype.hasWebGLTexture=ne.prototype.R,ne.prototype.hasFloat32Array=ne.prototype.la,ne.prototype.hasUint8Array=ne.prototype.Ha;var Os=250,uc={color:"white",lineWidth:4,radius:6};function xn(e){return{...uc,fillColor:(e=e||{}).color,...e}}function Je(e,t){return e instanceof Function?e(t):e}function Ps(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function Kt(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function ar(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Us(e,t,r){if(t.R())r(t.O());else{let n=t.la()?t.ja():t.ka();e.m=e.m??new Ht;let o=ar(e);r((e=new ne([n],t.m,!1,o.canvas,e.m,t.width,t.height)).O()),e.close()}}function Ds(e,t,r,n){let o=function(a){return a.g||(a.g=new ac),a.g}(e),s=ar(e),i=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;yr(o,s,!0,()=>{(function(c,u,h,f){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,u),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.C),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,h),c.I&&function(b,A){if(b!==A)return!1;b=b.entries(),A=A.entries();for(let[N,d]of b){b=N;let l=d;var x=A.next();if(x.done)return!1;let[v,k]=x.value;if(x=k,b!==v||l[0]!==x[0]||l[1]!==x[1]||l[2]!==x[2]||l[3]!==x[3])return!1}return!!A.next().done}(c.I,f))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.I=f;let b=Array(1024).fill(0);f.forEach((A,x)=>{if(A.length!==4)throw Error(`Color at index ${x} is not a four-channel value.`);b[4*x]=A[0],b[4*x+1]=A[1],b[4*x+2]=A[2],b[4*x+3]=A[3]}),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(b))}})(o,t,i,n),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);let a=o.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)})}function Bs(e,t,r,n){let o=ar(e),s=function(c){return c.h||(c.h=new cc),c.h}(e),i=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;yr(s,o,!0,()=>{var c=s.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,s.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,s.C),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4),o.bindTexture(o.TEXTURE_2D,null),(c=s.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)})}var de=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}Aa(e,t){if(e){var r=Kt(this);t=xn(t),r.save();var n=r.canvas,o=0;for(let s of e)r.fillStyle=Je(t.fillColor,{index:o,from:s}),r.strokeStyle=Je(t.color,{index:o,from:s}),r.lineWidth=Je(t.lineWidth,{index:o,from:s}),(e=new Path2D).arc(s.x*n.width,s.y*n.height,Je(t.radius,{index:o,from:s}),0,2*Math.PI),r.fill(e),r.stroke(e),++o;r.restore()}}za(e,t,r){if(e&&t){var n=Kt(this);r=xn(r),n.save();var o=n.canvas,s=0;for(let i of t){n.beginPath(),t=e[i.start];let a=e[i.end];t&&a&&(n.strokeStyle=Je(r.color,{index:s,from:t,to:a}),n.lineWidth=Je(r.lineWidth,{index:s,from:t,to:a}),n.moveTo(t.x*o.width,t.y*o.height),n.lineTo(a.x*o.width,a.y*o.height)),++s,n.stroke()}n.restore()}}wa(e,t){let r=Kt(this);t=xn(t),r.save(),r.beginPath(),r.lineWidth=Je(t.lineWidth,{}),r.strokeStyle=Je(t.color,{}),r.fillStyle=Je(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}xa(e,t,r=[0,0,0,255]){this.l?function(n,o,s,i){let a=ar(n);Us(n,o,c=>{Ds(n,c,s,i),(c=Kt(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,r,t):Ds(this,e.O(),r,t)}ya(e,t,r){this.l?function(n,o,s,i){let a=ar(n);Us(n,o,c=>{Bs(n,c,s,i),(c=Kt(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,r):Bs(this,e.O(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function je(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function $a(e){var t=je(e,0);if(!t){t=Ut(e);let r=ln(e),n=new Uint8Array(e.width*e.height*4);hn(r,t,Fr(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),Do(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Fr(e){let t=je(e,2);if(!t){let r=Ut(e);t=Lr(e);let n=je(e,1)||$a(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),qt(e)}return t}function Ut(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return e.h||(e.h=he(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function ln(e){return e.l||(e.l=new Ht),e.l}function Lr(e){let t=Ut(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=je(e,2);return r||(r=ft(ln(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function qt(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Ns(e){let t=Ut(e);return yr(ln(e),t,!0,()=>function(r,n){let o=r.canvas;if(o.width===r.width&&o.height===r.height)return n();let s=o.width,i=o.height;return o.width=r.width,o.height=r.height,r=n(),o.width=s,o.height=i,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}de.prototype.close=de.prototype.close,de.prototype.drawConfidenceMask=de.prototype.ya,de.prototype.drawCategoryMask=de.prototype.xa,de.prototype.drawBoundingBox=de.prototype.wa,de.prototype.drawConnectors=de.prototype.za,de.prototype.drawLandmarks=de.prototype.Aa,de.lerp=function(e,t,r,n,o){return Ps(n*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),n,o)},de.clamp=Ps;var se=class{constructor(e,t,r,n,o,s,i){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=o,this.width=s,this.height=i,(this.j||this.m)&&--Gs===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ga(){return!!je(this,0)}ma(){return!!je(this,1)}R(){return!!je(this,2)}Ea(){return $a(this)}Da(){var e=je(this,1);return e||(Fr(this),Lr(this),e=Ns(this),qt(this),this.g.push(e),this.j=!0),e}O(){return Fr(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Ut(this),o=ln(this);n.activeTexture(n.TEXTURE1),r=ft(o,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),hn(o,n,r),yr(o,n,!1,()=>{Lr(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),qt(this)}),Do(o),qt(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Fr(this),Lr(this),r=Ns(this),qt(this)}e.push(r)}return new se(e,this.ma(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&je(this,1).close(),this.m&&Ut(this).deleteTexture(je(this,2)),Gs=-1}};se.prototype.close=se.prototype.close,se.prototype.clone=se.prototype.clone,se.prototype.getAsWebGLTexture=se.prototype.O,se.prototype.getAsImageBitmap=se.prototype.Da,se.prototype.getAsImageData=se.prototype.Ea,se.prototype.hasWebGLTexture=se.prototype.R,se.prototype.hasImageBitmap=se.prototype.ma,se.prototype.hasImageData=se.prototype.Ga;var Gs=250;function Be(...e){return e.map(([t,r])=>({start:t,end:r}))}var hc=function(e){return class extends e{Ma(){this.i._registerModelResourcesGraphService()}}}((Vs=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:Xa()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,o){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),_(this,n||"input_audio",s=>{_(this,o=o||"audio_header",i=>{this.i._configureAudio(s,i,e,t,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}fa(e){Ne(this,"__graph_config__",t=>{e(t)}),_(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,o){let s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),_(this,n,i=>{this.i._addAudioToInputStream(this.g,t,r,i,o)})}addGpuBufferToStream(e,t,r){_(this,t,n=>{let[o,s]=Cs(this,e,n);this.i._addBoundTextureToStream(n,o,s,r)})}addBoolToStream(e,t,r){_(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){_(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){_(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){_(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){_(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){_(this,t,n=>{_(this,e,o=>{this.i._addStringToInputStream(o,n,r)})})}addStringRecordToStream(e,t,r){_(this,t,n=>{Fs(this,Object.keys(e),o=>{Fs(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(o,s,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){_(this,r,o=>{_(this,t,s=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,s,o,n),this.i._free(i)})})}addEmptyPacketToStream(e,t){_(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let s of e)this.i._addBoolVectorEntry(o,s);this.i._addBoolVectorToInputStream(o,n,r)})}addDoubleVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let s of e)this.i._addDoubleVectorEntry(o,s);this.i._addDoubleVectorToInputStream(o,n,r)})}addFloatVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let s of e)this.i._addFloatVectorEntry(o,s);this.i._addFloatVectorToInputStream(o,n,r)})}addIntVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let s of e)this.i._addIntVectorEntry(o,s);this.i._addIntVectorToInputStream(o,n,r)})}addUintVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateUintVector(e.length);if(!o)throw Error("Unable to allocate new unsigned int vector on heap.");for(let s of e)this.i._addUintVectorEntry(o,s);this.i._addUintVectorToInputStream(o,n,r)})}addStringVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let s of e)_(this,s,i=>{this.i._addStringVectorEntry(o,i)});this.i._addStringVectorToInputStream(o,n,r)})}addBoolToInputSidePacket(e,t){_(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){_(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){_(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){_(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){_(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){_(this,t,r=>{_(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){_(this,r,n=>{_(this,t,o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,o,n),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(n,o);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(n,o);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(n,o);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(n,o);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(n,o);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let o of e)_(this,o,s=>{this.i._addStringVectorEntry(n,s)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Ne(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){rt(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Ne(this,e,t),_(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){rt(this,e,t),_(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?'),Ne(this,e,(n,o)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,o)}),_(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 Vs{get ha(){return this.i}sa(e,t,r){_(this,t,n=>{let[o,s]=Cs(this,e,n);this.ha._addBoundTextureAsImageToStream(n,o,s,r)})}W(e,t){Ne(this,e,t),_(this,e,r=>{this.ha._attachImageListener(r)})}da(e,t){rt(this,e,t),_(this,e,r=>{this.ha._attachImageVectorListener(r)})}})),Vs,Me=class extends hc{};async function w(e,t,r){return async function(n,o,s,i){return ic(n,o,s,i)}(e,r.canvas??(Xa()?void 0:document.createElement("canvas")),t,r)}function qa(e,t,r,n){if(e.V){let s=new da;if(r?.regionOfInterest){if(!e.ra)throw Error("This task doesn't support region-of-interest.");var o=r.regionOfInterest;if(o.left>=o.right||o.top>=o.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(0>o.left||0>o.top||1<o.right||1<o.bottom)throw Error("Expected RectF values to be in [0,1].");y(s,1,(o.left+o.right)/2),y(s,2,(o.top+o.bottom)/2),y(s,4,o.right-o.left),y(s,3,o.bottom-o.top)}else y(s,1,.5),y(s,2,.5),y(s,4,1),y(s,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(y(s,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[i,a]=Ha(t);r=J(s,3)*a/i,o=J(s,4)*i/a,y(s,4,r),y(s,3,o)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.V,n)}e.g.sa(t,e.ba,n??performance.now()),e.finishProcessing()}function Oe(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");qa(e,t,r,e.J+1)}function $e(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");qa(e,t,r,n)}function Dt(e,t,r,n){var o=t.data;let s=t.width,i=s*(t=t.height);if((o instanceof Uint8Array||o instanceof Float32Array)&&o.length!==i)throw Error("Unsupported channel count: "+o.length/i);return e=new ne([o],r,!1,e.g.i.canvas,e.M,s,t),n?e.clone():e}var pe=class extends Cr{constructor(e,t,r,n){super(e),this.g=e,this.ba=t,this.V=r,this.ra=n,this.M=new Ht}l(e,t=!0){if("runningMode"in e&&ir(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.M.close(),super.close()}};pe.prototype.close=pe.prototype.close;var Re=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},T(e=this.h=new sn,0,1,t=new z),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Oe(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},$e(this,e,r,t),this.j}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect_in"),L(e,"detections");let t=new xe;Ue(t,X1,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect_in"),S(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",(n,o)=>{for(let s of n)n=aa(s),this.j.detections.push(ja(n));p(this,o)}),this.g.attachEmptyPacketListener("detections",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.detectForVideo=Re.prototype.G,Re.prototype.detect=Re.prototype.F,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=async function(e,t){return w(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return w(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return w(Re,e,t)};var No=Be([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]),Go=Be([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]),Vo=Be([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Ja=Be([474,475],[475,476],[476,477],[477,474]),jo=Be([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]),Wo=Be([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Za=Be([469,470],[470,471],[471,472],[472,469]),Xo=Be([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]),Qa=[...No,...Go,...Vo,...jo,...Wo,...Xo],e2=Be([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 js(e){e.u={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var Y=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.u={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,T(e=this.h=new xa,0,1,t=new z),this.H=new ba,T(this.h,0,3,this.H),this.j=new sn,T(this.h,0,2,this.j),He(this.j,4,1),y(this.j,2,.5),y(this.H,2,.5),y(this.h,4,.5)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numFaces"in e&&He(this.j,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.j,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(this.H,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 js(this),Oe(this,e,t),this.u}G(e,t,r){return js(this),$e(this,e,r,t),this.u}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"face_landmarks");let t=new xe;Ue(t,z1,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),we(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,o)=>{for(let s of n)n=gr(s),this.u.faceLandmarks.push(an(n));p(this,o)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{p(this,n)}),this.outputFaceBlendshapes&&(L(e,"blendshapes"),S(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,o)=>{if(this.outputFaceBlendshapes)for(let s of n)n=nn(s),this.u.faceBlendshapes.push(Po(n.g()??[]));p(this,o)}),this.g.attachEmptyPacketListener("blendshapes",n=>{p(this,n)})),this.outputFacialTransformationMatrixes&&(L(e,"face_geometry"),S(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,o)=>{if(this.outputFacialTransformationMatrixes)for(let s of n)(n=C(H1(s),fa,2))&&this.u.facialTransformationMatrixes.push({rows:Pe(Fe(n,1),0)??0,columns:Pe(Fe(n,2),0)??0,data:kt(n,3,dt).slice()??[]});p(this,o)}),this.g.attachEmptyPacketListener("face_geometry",n=>{p(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Y.prototype.detectForVideo=Y.prototype.G,Y.prototype.detect=Y.prototype.F,Y.prototype.setOptions=Y.prototype.o,Y.createFromModelPath=function(e,t){return w(Y,e,{baseOptions:{modelAssetPath:t}})},Y.createFromModelBuffer=function(e,t){return w(Y,e,{baseOptions:{modelAssetBuffer:t}})},Y.createFromOptions=function(e,t){return w(Y,e,t)},Y.FACE_LANDMARKS_LIPS=No,Y.FACE_LANDMARKS_LEFT_EYE=Go,Y.FACE_LANDMARKS_LEFT_EYEBROW=Vo,Y.FACE_LANDMARKS_LEFT_IRIS=Ja,Y.FACE_LANDMARKS_RIGHT_EYE=jo,Y.FACE_LANDMARKS_RIGHT_EYEBROW=Wo,Y.FACE_LANDMARKS_RIGHT_IRIS=Za,Y.FACE_LANDMARKS_FACE_OVAL=Xo,Y.FACE_LANDMARKS_CONTOURS=Qa,Y.FACE_LANDMARKS_TESSELATION=e2;var Ge=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!0),T(e=this.j=new wa,0,1,t=new z)}get baseOptions(){return C(this.j,z,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){return super.l(e)}Pa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,Oe(this,e,n??{}),!this.h)return this.u}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"stylized_image");let t=new xe;Ue(t,Y1,this.j);let r=new ue;Ae(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),S(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),we(e,r),this.g.W("stylized_image",(n,o)=>{var s=!this.h,i=n.data,a=n.width;let c=a*(n=n.height);if(i instanceof Uint8Array)if(i.length===3*c){let u=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)u[4*h]=i[3*h],u[4*h+1]=i[3*h+1],u[4*h+2]=i[3*h+2],u[4*h+3]=255;i=new ImageData(u,a,n)}else{if(i.length!==4*c)throw Error("Unsupported channel count: "+i.length/c);i=new ImageData(new Uint8ClampedArray(i.buffer,i.byteOffset,i.length),a,n)}else if(!(i instanceof WebGLTexture))throw Error(`Unsupported format: ${i.constructor.name}`);a=new se([i],!1,!1,this.g.i.canvas,this.M,a,n),this.u=s=s?a.clone():a,this.h&&this.h(s),p(this,o)}),this.g.attachEmptyPacketListener("stylized_image",n=>{this.u=null,this.h&&this.h(null),p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.stylize=Ge.prototype.Pa,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return w(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return w(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return w(Ge,e,t)};var Ho=Be([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 Ws(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Xs(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 Hs(e,t=!0){let r=[];for(let o of e){var n=nn(o);e=[];for(let s of n.g())n=t&&Fe(s,1)!=null?Pe(Fe(s,1),0):-1,e.push({score:J(s,2)??0,index:n,categoryName:Xe(s,3)??"",displayName:Xe(s,4)??""});r.push(e)}return r}var ve=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.v=new Ia,0,1,t=new z),this.A=new Fo,T(this.v,0,2,this.A),this.u=new ko,T(this.A,0,3,this.u),this.h=new Ca,T(this.A,0,2,this.h),this.j=new K1,T(this.v,0,3,this.j),y(this.h,2,.5),y(this.A,4,.5),y(this.u,2,.5)}get baseOptions(){return C(this.v,z,1)}set baseOptions(e){T(this.v,0,1,e)}o(e){if(He(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.A,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new St,r=t,n=Nn(e.cannedGesturesClassifierOptions,C(this.j,St,3)?.h());T(r,0,2,n),T(this.j,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&C(this.j,St,3)?.g();return e.customGesturesClassifierOptions?(T(r=t=new St,0,2,n=Nn(e.customGesturesClassifierOptions,C(this.j,St,4)?.h())),T(this.j,0,4,t)):e.customGesturesClassifierOptions===void 0&&C(this.j,St,4)?.g(),this.l(e)}Ka(e,t){return Ws(this),Oe(this,e,t),Xs(this)}La(e,t,r){return Ws(this),$e(this,e,r,t),Xs(this)}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"hand_gestures"),L(e,"hand_landmarks"),L(e,"world_hand_landmarks"),L(e,"handedness");let t=new xe;Ue(t,J1,this.v);let r=new ue;Ae(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),B(r,"IMAGE:image_in"),B(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),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,o)=>{for(let s of n){n=gr(s);let i=[];for(let a of tt(n,ha,1))i.push({x:J(a,1)??0,y:J(a,2)??0,z:J(a,3)??0,visibility:J(a,4)??0});this.landmarks.push(i)}p(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,o)=>{for(let s of n){n=Ct(s);let i=[];for(let a of tt(n,ca,1))i.push({x:J(a,1)??0,y:J(a,2)??0,z:J(a,3)??0,visibility:J(a,4)??0});this.worldLandmarks.push(i)}p(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,o)=>{this.gestures.push(...Hs(n,!1)),p(this,o)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{p(this,n)}),this.g.attachProtoVectorListener("handedness",(n,o)=>{this.handedness.push(...Hs(n)),p(this,o)}),this.g.attachEmptyPacketListener("handedness",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function zs(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ve.prototype.recognizeForVideo=ve.prototype.La,ve.prototype.recognize=ve.prototype.Ka,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return w(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return w(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return w(ve,e,t)},ve.HAND_CONNECTIONS=Ho;var _e=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.j=new Fo,0,1,t=new z),this.u=new ko,T(this.j,0,3,this.u),this.h=new Ca,T(this.j,0,2,this.h),He(this.h,3,1),y(this.h,2,.5),y(this.u,2,.5),y(this.j,4,.5)}get baseOptions(){return C(this.j,z,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){return"numHands"in e&&He(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Oe(this,e,t),zs(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],$e(this,e,r,t),zs(this)}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"hand_landmarks"),L(e,"world_hand_landmarks"),L(e,"handedness");let t=new xe;Ue(t,q1,this.j);let r=new ue;Ae(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),S(r,"LANDMARKS:hand_landmarks"),S(r,"WORLD_LANDMARKS:world_hand_landmarks"),S(r,"HANDEDNESS:handedness"),r.o(t),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,o)=>{for(let s of n)n=gr(s),this.landmarks.push(an(n));p(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,o)=>{for(let s of n)n=Ct(s),this.worldLandmarks.push(nr(n));p(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("handedness",(n,o)=>{var s=this.handedness,i=s.push;let a=[];for(let c of n){n=nn(c);let u=[];for(let h of n.g())u.push({score:J(h,2)??0,index:Pe(Fe(h,1),0)??-1,categoryName:Xe(h,3)??"",displayName:Xe(h,4)??""});a.push(u)}i.call(s,...a),p(this,o)}),this.g.attachEmptyPacketListener("handedness",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.G,_e.prototype.detect=_e.prototype.F,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return w(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return w(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return w(_e,e,t)},_e.HAND_CONNECTIONS=Ho;var t2=Be([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 Ys(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function Ks(e){try{if(!e.I)return e.h;e.I(e.h)}finally{un(e)}}function xr(e,t){e=gr(e),t.push(an(e))}var X=class extends pe{constructor(e,t){super(new Me(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,T(e=this.A=new Pa,0,1,t=new z),this.u=new ko,T(this.A,0,2,this.u),this.aa=new Z1,T(this.A,0,3,this.aa),this.j=new sn,T(this.A,0,4,this.j),this.H=new ba,T(this.A,0,5,this.H),this.v=new Ma,T(this.A,0,6,this.v),this.D=new Oa,T(this.A,0,7,this.D),y(this.j,2,.5),y(this.j,3,.3),y(this.H,2,.5),y(this.v,2,.5),y(this.v,3,.3),y(this.D,2,.5),y(this.u,2,.5)}get baseOptions(){return C(this.A,z,1)}set baseOptions(e){T(this.A,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.j,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.j,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.D,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.u,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){let n=typeof t!="function"?t:{};return this.I=typeof t=="function"?t:r,Ys(this),Oe(this,e,n),Ks(this)}G(e,t,r,n){let o=typeof r!="function"?r:{};return this.I=typeof r=="function"?r:n,Ys(this),$e(this,e,o,t),Ks(this)}m(){var e=new le;j(e,"input_frames_image"),L(e,"pose_landmarks"),L(e,"pose_world_landmarks"),L(e,"face_landmarks"),L(e,"left_hand_landmarks"),L(e,"left_hand_world_landmarks"),L(e,"right_hand_landmarks"),L(e,"right_hand_world_landmarks");let t=new xe,r=new bs;Mn(r,1,Vt("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(o,s){if(s!=null)if(Array.isArray(s))D(o,2,qr(s,yo,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof Qe||ur(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Mn(o,2,ho(s,!1,!1),At())}}(r,this.A.g());let n=new ue;Ae(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Vr(n,8,bs,r),B(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),we(e,n),cn(this,e),this.g.attachProtoListener("pose_landmarks",(o,s)=>{xr(o,this.h.poseLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("pose_world_landmarks",(o,s)=>{var i=this.h.poseWorldLandmarks;o=Ct(o),i.push(nr(o)),p(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",o=>{p(this,o)}),this.outputPoseSegmentationMasks&&(S(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ot(this,"pose_segmentation_mask"),this.g.W("pose_segmentation_mask",(o,s)=>{this.h.poseSegmentationMasks=[Dt(this,o,!0,!this.I)],p(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",o=>{this.h.poseSegmentationMasks=[],p(this,o)})),this.g.attachProtoListener("face_landmarks",(o,s)=>{xr(o,this.h.faceLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",o=>{p(this,o)}),this.outputFaceBlendshapes&&(L(e,"extra_blendshapes"),S(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(o,s)=>{var i=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(o=nn(o),i.push(Po(o.g()??[]))),p(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",o=>{p(this,o)})),this.g.attachProtoListener("left_hand_landmarks",(o,s)=>{xr(o,this.h.leftHandLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("left_hand_world_landmarks",(o,s)=>{var i=this.h.leftHandWorldLandmarks;o=Ct(o),i.push(nr(o)),p(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("right_hand_landmarks",(o,s)=>{xr(o,this.h.rightHandLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("right_hand_world_landmarks",(o,s)=>{var i=this.h.rightHandWorldLandmarks;o=Ct(o),i.push(nr(o)),p(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",o=>{p(this,o)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.G,X.prototype.detect=X.prototype.F,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return w(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return w(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return w(X,e,t)},X.HAND_CONNECTIONS=Ho,X.POSE_CONNECTIONS=t2,X.FACE_LANDMARKS_LIPS=No,X.FACE_LANDMARKS_LEFT_EYE=Go,X.FACE_LANDMARKS_LEFT_EYEBROW=Vo,X.FACE_LANDMARKS_LEFT_IRIS=Ja,X.FACE_LANDMARKS_RIGHT_EYE=jo,X.FACE_LANDMARKS_RIGHT_EYEBROW=Wo,X.FACE_LANDMARKS_RIGHT_IRIS=Za,X.FACE_LANDMARKS_FACE_OVAL=Xo,X.FACE_LANDMARKS_CONTOURS=Qa,X.FACE_LANDMARKS_TESSELATION=e2;var Se=class extends pe{constructor(e,t){super(new Me(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},T(e=this.h=new Ua,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return T(this.h,0,2,Nn(e,C(this.h,on,2))),this.l(e)}ua(e,t){return this.j={classifications:[]},Oe(this,e,t),this.j}va(e,t,r){return this.j={classifications:[]},$e(this,e,r,t),this.j}m(){var e=new le;j(e,"input_image"),j(e,"norm_rect"),L(e,"classifications");let t=new xe;Ue(t,ec,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),B(r,"IMAGE:input_image"),B(r,"NORM_RECT:norm_rect"),S(r,"CLASSIFICATIONS:classifications"),r.o(t),we(e,r),this.g.attachProtoListener("classifications",(n,o)=>{this.j=function(s){let i={classifications:tt(s,U1,1).map(a=>Po(C(a,wo,4)?.g()??[],Pe(Fe(a,2),0),Xe(a,3)))};return Dr(ut(s,2))!=null&&(i.timestampMs=Pe(Dr(ut(s,2)),0)),i}(B1(n)),p(this,o)}),this.g.attachEmptyPacketListener("classifications",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Se.prototype.classifyForVideo=Se.prototype.va,Se.prototype.classify=Se.prototype.ua,Se.prototype.setOptions=Se.prototype.o,Se.createFromModelPath=function(e,t){return w(Se,e,{baseOptions:{modelAssetPath:t}})},Se.createFromModelBuffer=function(e,t){return w(Se,e,{baseOptions:{modelAssetBuffer:t}})},Se.createFromOptions=function(e,t){return w(Se,e,t)};var Te=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!0),this.h=new Da,this.embeddings={embeddings:[]},T(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){var t=this.h,r=C(this.h,As,2);return r=r?r.clone():new As,e.l2Normalize!==void 0?ir(r,1,e.l2Normalize):"l2Normalize"in e&&D(r,1),e.quantize!==void 0?ir(r,2,e.quantize):"quantize"in e&&D(r,2),T(t,0,2,r),this.l(e)}Ba(e,t){return Oe(this,e,t),this.embeddings}Ca(e,t,r){return $e(this,e,r,t),this.embeddings}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"embeddings_out");let t=new xe;Ue(t,tc,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),S(r,"EMBEDDINGS:embeddings_out"),r.o(t),we(e,r),this.g.attachProtoListener("embeddings_out",(n,o)=>{n=j1(n),this.embeddings=function(s){return{embeddings:tt(s,G1,1).map(i=>{let a={headIndex:Pe(Fe(i,3),0)??-1,headName:Xe(i,4)??""};if(Ii(i,Dn,Tn(i,1))!==void 0)i=kt(i=C(i,Dn,Tn(i,1)),1,dt),a.floatEmbedding=i.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=C(i,N1,Tn(i,2))?.qa()?.h()??c}return a}),timestampMs:Pe(Dr(ut(s,2)),0)}}(n),p(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Te.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ss(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ss(Rs(e.quantizedEmbedding),Rs(t.quantizedEmbedding))}return e},Te.prototype.embedForVideo=Te.prototype.Ca,Te.prototype.embed=Te.prototype.Ba,Te.prototype.setOptions=Te.prototype.o,Te.createFromModelPath=function(e,t){return w(Te,e,{baseOptions:{modelAssetPath:t}})},Te.createFromModelBuffer=function(e,t){return w(Te,e,{baseOptions:{modelAssetBuffer:t}})},Te.createFromOptions=function(e,t){return w(Te,e,t)};var Wn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};function $s(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function qs(e){try{let t=new Wn(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{un(e)}}Wn.prototype.close=Wn.prototype.close;var ie=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.v=new Ba,T(this.h,0,3,this.v),T(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?D(this.h,2,Vt(e.displayNamesLocale)):"displayNamesLocale"in e&&D(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){(function(e){let t=tt(e.fa(),ue,1).filter(r=>Xe(r,1).includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],1<t.length)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(C(t[0],xe,7)?.l()?.g()??new Map).forEach((r,n)=>{e.u[Number(n)]=Xe(r,1)})})(this)}ga(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,$s(this),Oe(this,e,n),qs(this)}Na(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,$s(this),$e(this,e,o,t),qs(this)}Fa(){return this.u}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect");let t=new xe;Ue(t,Ga,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),r.o(t),we(e,r),cn(this,e),this.outputConfidenceMasks&&(L(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),Ot(this,"confidence_masks"),this.g.da("confidence_masks",(n,o)=>{this.confidenceMasks=n.map(s=>Dt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],p(this,n)})),this.outputCategoryMask&&(L(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),Ot(this,"category_mask"),this.g.W("category_mask",(n,o)=>{this.categoryMask=Dt(this,n,!1,!this.j),p(this,o)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,p(this,n)})),L(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,o)=>{this.qualityScores=n,p(this,o)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ie.prototype.getLabels=ie.prototype.Fa,ie.prototype.segmentForVideo=ie.prototype.Na,ie.prototype.segment=ie.prototype.ga,ie.prototype.setOptions=ie.prototype.o,ie.createFromModelPath=function(e,t){return w(ie,e,{baseOptions:{modelAssetPath:t}})},ie.createFromModelBuffer=function(e,t){return w(ie,e,{baseOptions:{modelAssetBuffer:t}})},ie.createFromOptions=function(e,t){return w(ie,e,t)};var Xn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};Xn.prototype.close=Xn.prototype.close;var lc=class extends g{constructor(e){super(e)}},Bt=[0,q,-2],fc=[0,et,-3,Z],fn=[0,et,-3,Z,et,-1],r2=[0,fn],dc=[0,r2,Bt],pc=[0,fn,Bt],n2=[0,fn,q,-1],mc=[0,n2,Bt],gc=[0,et,-3,Z,Bt,-1],yc=[0,et,-3,Z,ze],An=class extends g{constructor(e){super(e)}},Js=[0,et,-1,Z],o2=class extends g{constructor(){super()}};o2.B=[1];var Zs=class extends g{constructor(e){super(e)}},Hn=[1,2,3,4,5,6,7,8,9,10,14,15],vc=[0,Hn,P,fn,P,pc,P,r2,P,dc,P,Js,P,yc,P,fc,P,[0,O,et,-2,Z,q,Z,-1,2,et,Bt],P,n2,P,mc,et,Bt,O,P,gc,P,[0,re,Js]],_c=[0,O,q,-1,Z],zn=class extends g{constructor(){super()}};zn.B=[1],zn.prototype.g=rn([0,re,vc,O,_c]);var Ve=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.v=new Ba,T(this.h,0,3,this.v),T(e=this.h,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(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)}ga(e,t,r,n){let o=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.J+1,n=new zn;let s=new Zs;var i=new lc;if(He(i,1,255),T(s,0,12,i),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new An;ir(a,3,!0),y(a,1,t.keypoint.x),y(a,2,t.keypoint.y),Qt(s,5,Hn,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(i=new o2,t.scribble))ir(t=new An,3,!0),y(t,1,a.x),y(t,2,a.y),Vr(i,1,An,t);Qt(s,15,Hn,i)}Vr(n,1,Zs,s),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),Oe(this,e,o);e:{try{let u=new Xn(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=u;break e}this.j(u)}finally{un(this)}c=void 0}return c}m(){var e=new le;j(e,"image_in"),j(e,"roi_in"),j(e,"norm_rect_in");let t=new xe;Ue(t,Ga,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),B(r,"IMAGE:image_in"),B(r,"ROI:roi_in"),B(r,"NORM_RECT:norm_rect_in"),r.o(t),we(e,r),cn(this,e),this.outputConfidenceMasks&&(L(e,"confidence_masks"),S(r,"CONFIDENCE_MASKS:confidence_masks"),Ot(this,"confidence_masks"),this.g.da("confidence_masks",(n,o)=>{this.confidenceMasks=n.map(s=>Dt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],p(this,n)})),this.outputCategoryMask&&(L(e,"category_mask"),S(r,"CATEGORY_MASK:category_mask"),Ot(this,"category_mask"),this.g.W("category_mask",(n,o)=>{this.categoryMask=Dt(this,n,!1,!this.j),p(this,o)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,p(this,n)})),L(e,"quality_scores"),S(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,o)=>{this.qualityScores=n,p(this,o)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.segment=Ve.prototype.ga,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return w(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return w(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return w(Ve,e,t)};var ke=class extends pe{constructor(e,t){super(new Me(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},T(e=this.h=new Oo,0,1,t=new z)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?D(this.h,2,Vt(e.displayNamesLocale)):"displayNamesLocale"in e&&D(this.h,2),e.maxResults!==void 0?He(this.h,3,e.maxResults):"maxResults"in e&&D(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&D(this.h,4),e.categoryAllowlist!==void 0?Gr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&D(this.h,5),e.categoryDenylist!==void 0?Gr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&D(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Oe(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},$e(this,e,r,t),this.j}m(){var e=new le;j(e,"input_frame_gpu"),j(e,"norm_rect"),L(e,"detections");let t=new xe;Ue(t,nc,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),B(r,"IMAGE:input_frame_gpu"),B(r,"NORM_RECT:norm_rect"),S(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",(n,o)=>{for(let s of n)n=aa(s),this.j.detections.push(ja(n));p(this,o)}),this.g.attachEmptyPacketListener("detections",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ke.prototype.detectForVideo=ke.prototype.G,ke.prototype.detect=ke.prototype.F,ke.prototype.setOptions=ke.prototype.o,ke.createFromModelPath=async function(e,t){return w(ke,e,{baseOptions:{modelAssetPath:t}})},ke.createFromModelBuffer=function(e,t){return w(ke,e,{baseOptions:{modelAssetBuffer:t}})},ke.createFromOptions=function(e,t){return w(ke,e,t)};var Yn=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach(e=>{e.close()})}};function Qs(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function ei(e){try{let t=new Yn(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.j)return t;e.j(t)}finally{un(e)}}Yn.prototype.close=Yn.prototype.close;var Ee=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,T(e=this.h=new Va,0,1,t=new z),this.D=new Oa,T(this.h,0,3,this.D),this.v=new Ma,T(this.h,0,2,this.v),He(this.v,4,1),y(this.v,2,.5),y(this.D,2,.5),y(this.h,4,.5)}get baseOptions(){return C(this.h,z,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numPoses"in e&&He(this.v,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.v,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.D,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Qs(this),Oe(this,e,n),ei(this)}G(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Qs(this),$e(this,e,o,t),ei(this)}m(){var e=new le;j(e,"image_in"),j(e,"norm_rect"),L(e,"normalized_landmarks"),L(e,"world_landmarks"),L(e,"segmentation_masks");let t=new xe;Ue(t,oc,this.h);let r=new ue;Ae(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),B(r,"IMAGE:image_in"),B(r,"NORM_RECT:norm_rect"),S(r,"NORM_LANDMARKS:normalized_landmarks"),S(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),we(e,r),cn(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,o)=>{this.landmarks=[];for(let s of n)n=gr(s),this.landmarks.push(an(n));p(this,o)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],p(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,o)=>{this.worldLandmarks=[];for(let s of n)n=Ct(s),this.worldLandmarks.push(nr(n));p(this,o)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],p(this,n)}),this.outputSegmentationMasks&&(S(r,"SEGMENTATION_MASK:segmentation_masks"),Ot(this,"segmentation_masks"),this.g.da("segmentation_masks",(n,o)=>{this.segmentationMasks=n.map(s=>Dt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],p(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ee.prototype.detectForVideo=Ee.prototype.G,Ee.prototype.detect=Ee.prototype.F,Ee.prototype.setOptions=Ee.prototype.o,Ee.createFromModelPath=function(e,t){return w(Ee,e,{baseOptions:{modelAssetPath:t}})},Ee.createFromModelBuffer=function(e,t){return w(Ee,e,{baseOptions:{modelAssetBuffer:t}})},Ee.createFromOptions=function(e,t){return w(Ee,e,t)},Ee.POSE_CONNECTIONS=t2;var qe={New:"new",Error:"Error",Opened:"opened",Opening:"opening",Processing:"processing",Idle:"idle",Closing:"closing",Closed:"closed",Destroying:"destroying",Destroyed:"destroyed"},s2={None:"none",Blur:"blur",Overlay:"overlay"};var ye=(e,t="AssertError")=>{if(e==null)throw new Error(t,{cause:e});return e};var i2=e=>{let t=new Set(Object.keys(e));return r=>{for(let n in r)t.has(n)&&typeof e[n]==typeof r[n]&&(e[n]=r[n])}},a2=e=>{let t=new Map(e),r=new Set,n=async i=>{let c=await(await fetch(i)).blob();return await createImageBitmap(c)},o=async i=>{let a=t.get(i);if(!a){if(r.has(i))return null;r.add(i);let c=await n(i);return t.set(i,c),r.delete(i),c}return a},s=i=>(t.get(i)?.close(),t.delete(i));return{tryFetchingImage:o,setImage:(i,a)=>{t.has(i)&&s(i),t.set(i,a)},getImage:i=>t.get(i)??null,removeImage:s,clear:()=>{t.forEach(i=>i.close()),t.clear()}}},c2=(e,t)=>r=>Math.min(Math.max(r,e),t);var u2=(e,t,r,n)=>{if(!e||!t||!r||!n||e*n===r*t)return{sx:0,sy:0,sw:e,sh:t,dx:0,dy:0,dw:r,dh:n};let o=e/t,s=r/n;if(o>s){let u=Math.ceil(e*s)/o,h=Math.abs(e-u);return{sx:Math.ceil(h/2),sy:0,sw:u,sh:t,dx:0,dy:0,dw:r,dh:n}}let i=Math.ceil(t*o)/s,a=Math.abs(t-i);return{sx:0,sy:Math.ceil(a/2),sw:e,sh:i,dx:0,dy:0,dw:r,dh:n}};var mt=(e,t)=>{let r=e.getContext("2d",t);if(!r)throw new Error("Cannot get CanvasRenderingContext2D");return r},Tc=e=>{let t=mt(e);t.scale(-1,1),t.translate(-e.width,0)},zo=e=>"VideoFrame"in globalThis&&e instanceof VideoFrame?{height:e.displayHeight,width:e.displayWidth}:"offsetHeight"in e&&typeof e.offsetHeight=="number"&&e.offsetHeight!==0&&"offsetWidth"in e&&typeof e.offsetWidth=="number"&&e.offsetWidth!==0?{height:e.offsetHeight,width:e.offsetWidth}:"videoHeight"in e&&typeof e.videoHeight=="number"&&e.videoHeight!==0&&"videoWidth"in e&&typeof e.videoWidth=="number"&&e.videoWidth!==0?{height:e.videoHeight,width:e.videoWidth}:"height"in e&&e.height!==0&&"width"in e&&e.width!==0?{height:e.height,width:e.width}:{height:0,width:0},vr=(e,t)=>new OffscreenCanvas(e,t);var Ec=e=>{mt(e).clearRect(0,0,e.width,e.height)},h2=(e,t)=>{let r={downScaleFactor:3},n=d=>{let l=r[d];if(!l){let v=vr(d==="downScaledCanvas"?Math.trunc(e/r.downScaleFactor):e,d==="downScaledCanvas"?Math.trunc(t/r.downScaleFactor):t);return r[d]=v,v}return l},o=(d,l)=>{let v=n(l);return mt(v).putImageData(d,0,0),v},s=(d,l,v,k,R,I,U,F,W,ee)=>{let vt=l instanceof ImageData?o(l,"drawImageDataCanvas"):l;R===void 0||I===void 0?d.drawImage(vt,v,k):U===void 0||F===void 0||W===void 0||ee===void 0?d.drawImage(vt,v,k,R,I):d.drawImage(vt,v,k,R,I,U,F,W,ee)},i=(d,l,v=e,k=t,R={})=>{let{height:I,width:U}=zo(d),F=u2(U,I,v,k),W=mt(l,R);s(W,d,F.sx,F.sy,F.sw,F.sh,F.dx,F.dy,F.dw,F.dh)},a=(d,l)=>{let v=n(l);return i(d,v),v},c=(d,l,v)=>{d.globalCompositeOperation=v,s(d,l,0,0)},u=(d,l,v)=>{let k=mt(d),R=0,I=5,U=1/(2*Math.PI*I*I),F=v<3?1:2;for(let W=-v;W<=v;W+=F)for(let ee=-v;ee<=v;ee+=F){let vt=U*Math.exp(-(ee*ee+W*W)/(2*I*I));R+=vt}for(let W=-v;W<=v;W+=F)for(let ee=-v;ee<=v;ee+=F)k.globalAlpha=U*Math.exp(-(ee*ee+W*W)/(2*I*I))/R*v,s(k,l,ee,W);k.globalAlpha=1},h=({image:d,blurAmount:l,canvas:v,preserveOldDrawing:k=!0})=>{let{height:R,width:I}=zo(d),U=mt(v);if(l<=0)return s(U,d,0,0,I,R);let F=n("downScaledCanvas"),W=mt(F);k||(W.clearRect(0,0,F.width,F.height),U.clearRect(0,0,I,R)),"filter"in U?(W.filter=`blur(${l}px)`,s(W,d,0,0,I,R,0,0,F.width,F.height),s(U,F,0,0,I,R)):u(v,d,l)},f=({image:d,blurAmount:l,offscreenCanvasName:v,preserveOldDrawing:k})=>{let R=n(v);return Ec(R),l===0?i(d,R):h({image:d,blurAmount:l,canvas:R,preserveOldDrawing:k}),R},m=(d,l,v)=>{let k=Array.isArray(d)?d[0]?.canvas:d.canvas;if(!k)return n("maskCanvas");let R=f({image:k,offscreenCanvasName:"maskCanvas",blurAmount:0});return v===0?R:f({image:R,blurAmount:v,offscreenCanvasName:"blurredMaskCanvas",preserveOldDrawing:!1})},b=(d,l,v,k,R=.5,I=3,U=3,F=!1)=>{let W=f({image:v,blurAmount:I,offscreenCanvasName:"blurredCanvas"}),ee=mt(d);if(Array.isArray(k)&&k.length===0)return s(ee,W,0,0);let vt=m(k,R,U);ee.save(),F&&Tc(d);let{height:E2,width:b2}=zo(l);s(ee,l,0,0,b2,E2),c(ee,vt,"destination-in"),c(ee,W,"destination-over"),ee.restore()};return{evaluateInput:d=>a(d,"inputCanvas"),renderImageToCanvas:i,drawBlurEffect:(d,l,v,k=.5,R=3,I=3,U=!1)=>b(d,l,l,v,k,R,I,U),drawOverlayEffect:(d,l,v,k,R=.5,I=0,U=3,F=!1)=>b(d,l,v,k,R,I,U,F),renderImageToOffScreenCanvas:a,renderImageDataToOffScreenCanvas:o,drawAndBlurImageOnOffScreenCanvas:f}};var dn={VertexShader:WebGLRenderingContext.VERTEX_SHADER,FragmentShader:WebGLRenderingContext.FRAGMENT_SHADER},Yo={[dn.VertexShader]:"VertexShader",[dn.FragmentShader]:"FragmentShader"},bc=e=>typeof e=="string"?e.startsWith("#version 300 es"):!1,l2=e=>{if(!bc(e))throw new Error("Expecting GLSL ES 3.00 shader source")},xc=/ERROR:\s*\d+:(\d+)/gi;function p2(e,t="",r=0){let n=[...t.matchAll(xc)],o=new Map(n.map((s,i)=>{if(!s[1]||s.index===void 0)return[0,t];let a=parseInt(s[1],10),c=n[i+1],u=c?c.index:t.length,h=t.substring(s.index,u);return[a-1,h]}));return e.split(`
41
+ `}D(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=pt(this,e),e.activeTexture(e.TEXTURE2),this.C=pt(this,e)}m(){super.m();let e=this.g;this.L=fe(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.M=fe(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.I=fe(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.I,0),e.uniform1i(this.L,1),e.uniform1i(this.M,2)}close(){this.j&&this.g.deleteTexture(this.j),this.C&&this.g.deleteTexture(this.C),super.close()}};function tt(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 Vn(e){var t=tt(e,1);if(!t){if(t=tt(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);let n=Ut(e);var r=Do(e);if(ln(r,n,Ha(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"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 o=0,s=0;o<t.length;++o,s+=4)t[o]=r[s]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Ha(e){let t=tt(e,2);if(!t){let r=Ut(e);t=za(e);let n=Vn(e),o=Ya(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,n),jn(e)}return t}function Ut(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=fe(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Ya(e){if(e=Ut(e),!Er)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Er=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Er=e.R16F}return Er}function Do(e){return e.l||(e.l=new Ht),e.l}function za(e){let t=Ut(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=tt(e,2);return r||(r=pt(Do(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function jn(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Er,ne=class{constructor(e,t,r,n,o,s,i){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=o,this.width=s,this.height=i,this.j&&--Ms===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Ha(){return!!tt(this,0)}la(){return!!tt(this,1)}R(){return!!tt(this,2)}ka(){return(t=tt(e=this,0))||(t=Vn(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ja(){return Vn(this)}O(){return Ha(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=Ut(this),o=Do(this);n.activeTexture(n.TEXTURE1),r=pt(o,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let s=Ya(this);n.texImage2D(n.TEXTURE_2D,0,s,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),ln(o,n,r),vr(o,n,!1,()=>{za(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),jn(this)}),Po(o),jn(this)}}e.push(r)}return new ne(e,this.m,this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ut(this).deleteTexture(tt(this,2)),Ms=-1}};ne.prototype.close=ne.prototype.close,ne.prototype.clone=ne.prototype.clone,ne.prototype.getAsWebGLTexture=ne.prototype.O,ne.prototype.getAsFloat32Array=ne.prototype.ja,ne.prototype.getAsUint8Array=ne.prototype.ka,ne.prototype.hasWebGLTexture=ne.prototype.R,ne.prototype.hasFloat32Array=ne.prototype.la,ne.prototype.hasUint8Array=ne.prototype.Ha;var Ms=250,fc={color:"white",lineWidth:4,radius:6};function En(e){return{...fc,fillColor:(e=e||{}).color,...e}}function et(e,t){return e instanceof Function?e(t):e}function Os(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function $t(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function cr(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Us(e,t,r){if(t.R())r(t.O());else{let n=t.la()?t.ja():t.ka();e.m=e.m??new Ht;let o=cr(e);r((e=new ne([n],t.m,!1,o.canvas,e.m,t.width,t.height)).O()),e.close()}}function Bs(e,t,r,n){let o=function(a){return a.g||(a.g=new hc),a.g}(e),s=cr(e),i=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;vr(o,s,!0,()=>{(function(c,u,h,l){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,u),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.C),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,h),c.I&&function(b,E){if(b!==E)return!1;b=b.entries(),E=E.entries();for(let[Y,d]of b){b=Y;let f=d;var A=E.next();if(A.done)return!1;let[v,S]=A.value;if(A=S,b!==v||f[0]!==A[0]||f[1]!==A[1]||f[2]!==A[2]||f[3]!==A[3])return!1}return!!E.next().done}(c.I,l))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.I=l;let b=Array(1024).fill(0);l.forEach((E,A)=>{if(E.length!==4)throw Error(`Color at index ${A} is not a four-channel value.`);b[4*A]=E[0],b[4*A+1]=E[1],b[4*A+2]=E[2],b[4*A+3]=E[3]}),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(b))}})(o,t,i,n),s.clearColor(0,0,0,0),s.clear(s.COLOR_BUFFER_BIT),s.drawArrays(s.TRIANGLE_FAN,0,4);let a=o.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)})}function Ps(e,t,r,n){let o=cr(e),s=function(c){return c.h||(c.h=new lc),c.h}(e),i=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;vr(s,o,!0,()=>{var c=s.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,s.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,s.C),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4),o.bindTexture(o.TEXTURE_2D,null),(c=s.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)})}var me=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}Aa(e,t){if(e){var r=$t(this);t=En(t),r.save();var n=r.canvas,o=0;for(let s of e)r.fillStyle=et(t.fillColor,{index:o,from:s}),r.strokeStyle=et(t.color,{index:o,from:s}),r.lineWidth=et(t.lineWidth,{index:o,from:s}),(e=new Path2D).arc(s.x*n.width,s.y*n.height,et(t.radius,{index:o,from:s}),0,2*Math.PI),r.fill(e),r.stroke(e),++o;r.restore()}}za(e,t,r){if(e&&t){var n=$t(this);r=En(r),n.save();var o=n.canvas,s=0;for(let i of t){n.beginPath(),t=e[i.start];let a=e[i.end];t&&a&&(n.strokeStyle=et(r.color,{index:s,from:t,to:a}),n.lineWidth=et(r.lineWidth,{index:s,from:t,to:a}),n.moveTo(t.x*o.width,t.y*o.height),n.lineTo(a.x*o.width,a.y*o.height)),++s,n.stroke()}n.restore()}}wa(e,t){let r=$t(this);t=En(t),r.save(),r.beginPath(),r.lineWidth=et(t.lineWidth,{}),r.strokeStyle=et(t.color,{}),r.fillStyle=et(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}xa(e,t,r=[0,0,0,255]){this.l?function(n,o,s,i){let a=cr(n);Us(n,o,c=>{Bs(n,c,s,i),(c=$t(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,r,t):Bs(this,e.O(),r,t)}ya(e,t,r){this.l?function(n,o,s,i){let a=cr(n);Us(n,o,c=>{Ps(n,c,s,i),(c=$t(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,r):Ps(this,e.O(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function He(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap<"u"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function Ka(e){var t=He(e,0);if(!t){t=Bt(e);let r=fn(e),n=new Uint8Array(e.width*e.height*4);ln(r,t,Lr(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),Po(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Lr(e){let t=He(e,2);if(!t){let r=Bt(e);t=Ir(e);let n=He(e,1)||Ka(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),Jt(e)}return t}function Bt(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return e.h||(e.h=fe(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function fn(e){return e.l||(e.l=new Ht),e.l}function Ir(e){let t=Bt(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=He(e,2);return r||(r=pt(fn(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Jt(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Ds(e){let t=Bt(e);return vr(fn(e),t,!0,()=>function(r,n){let o=r.canvas;if(o.width===r.width&&o.height===r.height)return n();let s=o.width,i=o.height;return o.width=r.width,o.height=r.height,r=n(),o.width=s,o.height=i,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}me.prototype.close=me.prototype.close,me.prototype.drawConfidenceMask=me.prototype.ya,me.prototype.drawCategoryMask=me.prototype.xa,me.prototype.drawBoundingBox=me.prototype.wa,me.prototype.drawConnectors=me.prototype.za,me.prototype.drawLandmarks=me.prototype.Aa,me.lerp=function(e,t,r,n,o){return Os(n*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),n,o)},me.clamp=Os;var ie=class{constructor(e,t,r,n,o,s,i){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=o,this.width=s,this.height=i,(this.j||this.m)&&--Ns===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ga(){return!!He(this,0)}ma(){return!!He(this,1)}R(){return!!He(this,2)}Ea(){return Ka(this)}Da(){var e=He(this,1);return e||(Lr(this),Ir(this),e=Ds(this),Jt(this),this.g.push(e),this.j=!0),e}O(){return Lr(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=Bt(this),o=fn(this);n.activeTexture(n.TEXTURE1),r=pt(o,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),ln(o,n,r),vr(o,n,!1,()=>{Ir(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Jt(this)}),Po(o),Jt(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Lr(this),Ir(this),r=Ds(this),Jt(this)}e.push(r)}return new ie(e,this.ma(),this.R(),this.canvas,this.l,this.width,this.height)}close(){this.j&&He(this,1).close(),this.m&&Bt(this).deleteTexture(He(this,2)),Ns=-1}};ie.prototype.close=ie.prototype.close,ie.prototype.clone=ie.prototype.clone,ie.prototype.getAsWebGLTexture=ie.prototype.O,ie.prototype.getAsImageBitmap=ie.prototype.Da,ie.prototype.getAsImageData=ie.prototype.Ea,ie.prototype.hasWebGLTexture=ie.prototype.R,ie.prototype.hasImageBitmap=ie.prototype.ma,ie.prototype.hasImageData=ie.prototype.Ga;var Ns=250;function Ge(...e){return e.map(([t,r])=>({start:t,end:r}))}var dc=function(e){return class extends e{Ma(){this.i._registerModelResourcesGraphService()}}}((Gs=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:Xa()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,o){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),_(this,n||"input_audio",s=>{_(this,o=o||"audio_header",i=>{this.i._configureAudio(s,i,e,t,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}fa(e){je(this,"__graph_config__",t=>{e(t)}),_(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,o){let s=4*e.length;this.h!==s&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(s),this.h=s),this.i.HEAPF32.set(e,this.g/4),_(this,n,i=>{this.i._addAudioToInputStream(this.g,t,r,i,o)})}addGpuBufferToStream(e,t,r){_(this,t,n=>{let[o,s]=ks(this,e,n);this.i._addBoundTextureToStream(n,o,s,r)})}addBoolToStream(e,t,r){_(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){_(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){_(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){_(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){_(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){_(this,t,n=>{_(this,e,o=>{this.i._addStringToInputStream(o,n,r)})})}addStringRecordToStream(e,t,r){_(this,t,n=>{Cs(this,Object.keys(e),o=>{Cs(this,Object.values(e),s=>{this.i._addFlatHashMapToInputStream(o,s,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){_(this,r,o=>{_(this,t,s=>{let i=this.i._malloc(e.length);this.i.HEAPU8.set(e,i),this.i._addProtoToInputStream(i,e.length,s,o,n),this.i._free(i)})})}addEmptyPacketToStream(e,t){_(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let s of e)this.i._addBoolVectorEntry(o,s);this.i._addBoolVectorToInputStream(o,n,r)})}addDoubleVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let s of e)this.i._addDoubleVectorEntry(o,s);this.i._addDoubleVectorToInputStream(o,n,r)})}addFloatVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let s of e)this.i._addFloatVectorEntry(o,s);this.i._addFloatVectorToInputStream(o,n,r)})}addIntVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let s of e)this.i._addIntVectorEntry(o,s);this.i._addIntVectorToInputStream(o,n,r)})}addUintVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateUintVector(e.length);if(!o)throw Error("Unable to allocate new unsigned int vector on heap.");for(let s of e)this.i._addUintVectorEntry(o,s);this.i._addUintVectorToInputStream(o,n,r)})}addStringVectorToStream(e,t,r){_(this,t,n=>{let o=this.i._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let s of e)_(this,s,i=>{this.i._addStringVectorEntry(o,i)});this.i._addStringVectorToInputStream(o,n,r)})}addBoolToInputSidePacket(e,t){_(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){_(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){_(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){_(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){_(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){_(this,t,r=>{_(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){_(this,r,n=>{_(this,t,o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputSidePacket(s,e.length,o,n),this.i._free(s)})})}addBoolVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(n,o);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(n,o);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(n,o);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(n,o);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(n,o);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){_(this,t,r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let o of e)_(this,o,s=>{this.i._addStringVectorEntry(n,s)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){je(this,e,t),_(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){st(this,e,t),_(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){je(this,e,t),_(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){st(this,e,t),_(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?'),je(this,e,(n,o)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,o)}),_(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 Gs{get ha(){return this.i}sa(e,t,r){_(this,t,n=>{let[o,s]=ks(this,e,n);this.ha._addBoundTextureAsImageToStream(n,o,s,r)})}W(e,t){je(this,e,t),_(this,e,r=>{this.ha._attachImageListener(r)})}da(e,t){st(this,e,t),_(this,e,r=>{this.ha._attachImageVectorListener(r)})}})),Gs,Me=class extends dc{};async function w(e,t,r){return async function(n,o,s,i){return uc(n,o,s,i)}(e,r.canvas??(Xa()?void 0:document.createElement("canvas")),t,r)}function $a(e,t,r,n){if(e.V){let s=new fa;if(r?.regionOfInterest){if(!e.ra)throw Error("This task doesn't support region-of-interest.");var o=r.regionOfInterest;if(o.left>=o.right||o.top>=o.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(0>o.left||0>o.top||1<o.right||1<o.bottom)throw Error("Expected RectF values to be in [0,1].");y(s,1,(o.left+o.right)/2),y(s,2,(o.top+o.bottom)/2),y(s,4,o.right-o.left),y(s,3,o.bottom-o.top)}else y(s,1,.5),y(s,2,.5),y(s,4,1),y(s,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(y(s,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[i,a]=Wa(t);r=Z(s,3)*a/i,o=Z(s,4)*i/a,y(s,4,r),y(s,3,o)}}e.g.addProtoToStream(s.g(),"mediapipe.NormalizedRect",e.V,n)}e.g.sa(t,e.ba,n??performance.now()),e.finishProcessing()}function Oe(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");$a(e,t,r,e.J+1)}function Ze(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");$a(e,t,r,n)}function Pt(e,t,r,n){var o=t.data;let s=t.width,i=s*(t=t.height);if((o instanceof Uint8Array||o instanceof Float32Array)&&o.length!==i)throw Error("Unsupported channel count: "+o.length/i);return e=new ne([o],r,!1,e.g.i.canvas,e.M,s,t),n?e.clone():e}var pe=class extends Fr{constructor(e,t,r,n){super(e),this.g=e,this.ba=t,this.V=r,this.ra=n,this.M=new Ht}l(e,t=!0){if("runningMode"in e&&ar(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.M.close(),super.close()}};pe.prototype.close=pe.prototype.close;var Re=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},T(e=this.h=new an,0,1,t=new H),y(this.h,2,.5),y(this.h,3,.3)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&y(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&y(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}F(e,t){return this.j={detections:[]},Oe(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ze(this,e,r,t),this.j}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect_in"),F(e,"detections");let t=new Ee;De(t,z2,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect_in"),R(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",(n,o)=>{for(let s of n)n=ia(s),this.j.detections.push(Va(n));p(this,o)}),this.g.attachEmptyPacketListener("detections",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Re.prototype.detectForVideo=Re.prototype.G,Re.prototype.detect=Re.prototype.F,Re.prototype.setOptions=Re.prototype.o,Re.createFromModelPath=async function(e,t){return w(Re,e,{baseOptions:{modelAssetPath:t}})},Re.createFromModelBuffer=function(e,t){return w(Re,e,{baseOptions:{modelAssetBuffer:t}})},Re.createFromOptions=function(e,t){return w(Re,e,t)};var No=Ge([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]),Go=Ge([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]),Vo=Ge([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),qa=Ge([474,475],[475,476],[476,477],[477,474]),jo=Ge([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]),Xo=Ge([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Ja=Ge([469,470],[470,471],[471,472],[472,469]),Wo=Ge([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]),Za=[...No,...Go,...Vo,...jo,...Xo,...Wo],Qa=Ge([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 Vs(e){e.u={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.u={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,T(e=this.h=new ba,0,1,t=new H),this.H=new xa,T(this.h,0,3,this.H),this.j=new an,T(this.h,0,2,this.j),Ke(this.j,4,1),y(this.j,2,.5),y(this.H,2,.5),y(this.h,4,.5)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numFaces"in e&&Ke(this.j,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&y(this.j,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&y(this.H,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 Vs(this),Oe(this,e,t),this.u}G(e,t,r){return Vs(this),Ze(this,e,r,t),this.u}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"face_landmarks");let t=new Ee;De(t,$2,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),we(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,o)=>{for(let s of n)n=yr(s),this.u.faceLandmarks.push(cn(n));p(this,o)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{p(this,n)}),this.outputFaceBlendshapes&&(F(e,"blendshapes"),R(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,o)=>{if(this.outputFaceBlendshapes)for(let s of n)n=on(s),this.u.faceBlendshapes.push(Uo(n.g()??[]));p(this,o)}),this.g.attachEmptyPacketListener("blendshapes",n=>{p(this,n)})),this.outputFacialTransformationMatrixes&&(F(e,"face_geometry"),R(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,o)=>{if(this.outputFacialTransformationMatrixes)for(let s of n)(n=C(K2(s),la,2))&&this.u.facialTransformationMatrixes.push({rows:Pe(Fe(n,1),0)??0,columns:Pe(Fe(n,2),0)??0,data:kt(n,3,gt).slice()??[]});p(this,o)}),this.g.attachEmptyPacketListener("face_geometry",n=>{p(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.G,K.prototype.detect=K.prototype.F,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return w(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return w(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return w(K,e,t)},K.FACE_LANDMARKS_LIPS=No,K.FACE_LANDMARKS_LEFT_EYE=Go,K.FACE_LANDMARKS_LEFT_EYEBROW=Vo,K.FACE_LANDMARKS_LEFT_IRIS=qa,K.FACE_LANDMARKS_RIGHT_EYE=jo,K.FACE_LANDMARKS_RIGHT_EYEBROW=Xo,K.FACE_LANDMARKS_RIGHT_IRIS=Ja,K.FACE_LANDMARKS_FACE_OVAL=Wo,K.FACE_LANDMARKS_CONTOURS=Za,K.FACE_LANDMARKS_TESSELATION=Qa;var Xe=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!0),T(e=this.j=new Aa,0,1,t=new H)}get baseOptions(){return C(this.j,H,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){return super.l(e)}Pa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,Oe(this,e,n??{}),!this.h)return this.u}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"stylized_image");let t=new Ee;De(t,q2,this.j);let r=new le;Ae(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),we(e,r),this.g.W("stylized_image",(n,o)=>{var s=!this.h,i=n.data,a=n.width;let c=a*(n=n.height);if(i instanceof Uint8Array)if(i.length===3*c){let u=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)u[4*h]=i[3*h],u[4*h+1]=i[3*h+1],u[4*h+2]=i[3*h+2],u[4*h+3]=255;i=new ImageData(u,a,n)}else{if(i.length!==4*c)throw Error("Unsupported channel count: "+i.length/c);i=new ImageData(new Uint8ClampedArray(i.buffer,i.byteOffset,i.length),a,n)}else if(!(i instanceof WebGLTexture))throw Error(`Unsupported format: ${i.constructor.name}`);a=new ie([i],!1,!1,this.g.i.canvas,this.M,a,n),this.u=s=s?a.clone():a,this.h&&this.h(s),p(this,o)}),this.g.attachEmptyPacketListener("stylized_image",n=>{this.u=null,this.h&&this.h(null),p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Xe.prototype.stylize=Xe.prototype.Pa,Xe.prototype.setOptions=Xe.prototype.o,Xe.createFromModelPath=function(e,t){return w(Xe,e,{baseOptions:{modelAssetPath:t}})},Xe.createFromModelBuffer=function(e,t){return w(Xe,e,{baseOptions:{modelAssetBuffer:t}})},Xe.createFromOptions=function(e,t){return w(Xe,e,t)};var Ho=Ge([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 js(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function Xs(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 Ws(e,t=!0){let r=[];for(let o of e){var n=on(o);e=[];for(let s of n.g())n=t&&Fe(s,1)!=null?Pe(Fe(s,1),0):-1,e.push({score:Z(s,2)??0,index:n,categoryName:ze(s,3)??"",displayName:ze(s,4)??""});r.push(e)}return r}var ve=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.v=new La,0,1,t=new H),this.A=new Fo,T(this.v,0,2,this.A),this.u=new ko,T(this.A,0,3,this.u),this.h=new ka,T(this.A,0,2,this.h),this.j=new J2,T(this.v,0,3,this.j),y(this.h,2,.5),y(this.A,4,.5),y(this.u,2,.5)}get baseOptions(){return C(this.v,H,1)}set baseOptions(e){T(this.v,0,1,e)}o(e){if(Ke(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.A,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new St,r=t,n=Nn(e.cannedGesturesClassifierOptions,C(this.j,St,3)?.h());T(r,0,2,n),T(this.j,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&C(this.j,St,3)?.g();return e.customGesturesClassifierOptions?(T(r=t=new St,0,2,n=Nn(e.customGesturesClassifierOptions,C(this.j,St,4)?.h())),T(this.j,0,4,t)):e.customGesturesClassifierOptions===void 0&&C(this.j,St,4)?.g(),this.l(e)}Ka(e,t){return js(this),Oe(this,e,t),Xs(this)}La(e,t,r){return js(this),Ze(this,e,r,t),Xs(this)}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"hand_gestures"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Ee;De(t,ec,this.v);let r=new le;Ae(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"HAND_GESTURES:hand_gestures"),R(r,"LANDMARKS:hand_landmarks"),R(r,"WORLD_LANDMARKS:world_hand_landmarks"),R(r,"HANDEDNESS:handedness"),r.o(t),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,o)=>{for(let s of n){n=yr(s);let i=[];for(let a of ot(n,ua,1))i.push({x:Z(a,1)??0,y:Z(a,2)??0,z:Z(a,3)??0,visibility:Z(a,4)??0});this.landmarks.push(i)}p(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,o)=>{for(let s of n){n=Ct(s);let i=[];for(let a of ot(n,aa,1))i.push({x:Z(a,1)??0,y:Z(a,2)??0,z:Z(a,3)??0,visibility:Z(a,4)??0});this.worldLandmarks.push(i)}p(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,o)=>{this.gestures.push(...Ws(n,!1)),p(this,o)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{p(this,n)}),this.g.attachProtoVectorListener("handedness",(n,o)=>{this.handedness.push(...Ws(n)),p(this,o)}),this.g.attachEmptyPacketListener("handedness",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Hs(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}ve.prototype.recognizeForVideo=ve.prototype.La,ve.prototype.recognize=ve.prototype.Ka,ve.prototype.setOptions=ve.prototype.o,ve.createFromModelPath=function(e,t){return w(ve,e,{baseOptions:{modelAssetPath:t}})},ve.createFromModelBuffer=function(e,t){return w(ve,e,{baseOptions:{modelAssetBuffer:t}})},ve.createFromOptions=function(e,t){return w(ve,e,t)},ve.HAND_CONNECTIONS=Ho;var _e=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],T(e=this.j=new Fo,0,1,t=new H),this.u=new ko,T(this.j,0,3,this.u),this.h=new ka,T(this.j,0,2,this.h),Ke(this.h,3,1),y(this.h,2,.5),y(this.u,2,.5),y(this.j,4,.5)}get baseOptions(){return C(this.j,H,1)}set baseOptions(e){T(this.j,0,1,e)}o(e){return"numHands"in e&&Ke(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&y(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&y(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}F(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Oe(this,e,t),Hs(this)}G(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ze(this,e,r,t),Hs(this)}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"hand_landmarks"),F(e,"world_hand_landmarks"),F(e,"handedness");let t=new Ee;De(t,Q2,this.j);let r=new le;Ae(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"LANDMARKS:hand_landmarks"),R(r,"WORLD_LANDMARKS:world_hand_landmarks"),R(r,"HANDEDNESS:handedness"),r.o(t),we(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,o)=>{for(let s of n)n=yr(s),this.landmarks.push(cn(n));p(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,o)=>{for(let s of n)n=Ct(s),this.worldLandmarks.push(or(n));p(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{p(this,n)}),this.g.attachProtoVectorListener("handedness",(n,o)=>{var s=this.handedness,i=s.push;let a=[];for(let c of n){n=on(c);let u=[];for(let h of n.g())u.push({score:Z(h,2)??0,index:Pe(Fe(h,1),0)??-1,categoryName:ze(h,3)??"",displayName:ze(h,4)??""});a.push(u)}i.call(s,...a),p(this,o)}),this.g.attachEmptyPacketListener("handedness",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.G,_e.prototype.detect=_e.prototype.F,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=function(e,t){return w(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return w(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return w(_e,e,t)},_e.HAND_CONNECTIONS=Ho;var e1=Ge([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 Ys(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function zs(e){try{if(!e.I)return e.h;e.I(e.h)}finally{hn(e)}}function Ar(e,t){e=yr(e),t.push(cn(e))}var X=class extends pe{constructor(e,t){super(new Me(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,T(e=this.A=new Oa,0,1,t=new H),this.u=new ko,T(this.A,0,2,this.u),this.aa=new tc,T(this.A,0,3,this.aa),this.j=new an,T(this.A,0,4,this.j),this.H=new xa,T(this.A,0,5,this.H),this.v=new Ia,T(this.A,0,6,this.v),this.D=new Ma,T(this.A,0,7,this.D),y(this.j,2,.5),y(this.j,3,.3),y(this.H,2,.5),y(this.v,2,.5),y(this.v,3,.3),y(this.D,2,.5),y(this.u,2,.5)}get baseOptions(){return C(this.A,H,1)}set baseOptions(e){T(this.A,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&y(this.j,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&y(this.j,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&y(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&y(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&y(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&y(this.D,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&y(this.u,2,e.minHandLandmarksConfidence??.5),this.l(e)}F(e,t,r){let n=typeof t!="function"?t:{};return this.I=typeof t=="function"?t:r,Ys(this),Oe(this,e,n),zs(this)}G(e,t,r,n){let o=typeof r!="function"?r:{};return this.I=typeof r=="function"?r:n,Ys(this),Ze(this,e,o,t),zs(this)}m(){var e=new de;j(e,"input_frames_image"),F(e,"pose_landmarks"),F(e,"pose_world_landmarks"),F(e,"face_landmarks"),F(e,"left_hand_landmarks"),F(e,"left_hand_world_landmarks"),F(e,"right_hand_landmarks"),F(e,"right_hand_world_landmarks");let t=new Ee,r=new xs;Mn(r,1,Vt("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(o,s){if(s!=null)if(Array.isArray(s))D(o,2,Jr(s,yo,void 0,void 0,!1));else{if(!(typeof s=="string"||s instanceof rt||hr(s)))throw Error("invalid value in Any.value field: "+s+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Mn(o,2,ho(s,!1,!1),wt())}}(r,this.A.g());let n=new le;Ae(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),jr(n,8,xs,r),N(n,"IMAGE:input_frames_image"),R(n,"POSE_LANDMARKS:pose_landmarks"),R(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),R(n,"FACE_LANDMARKS:face_landmarks"),R(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),R(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),R(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),R(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),we(e,n),un(this,e),this.g.attachProtoListener("pose_landmarks",(o,s)=>{Ar(o,this.h.poseLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("pose_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("pose_world_landmarks",(o,s)=>{var i=this.h.poseWorldLandmarks;o=Ct(o),i.push(or(o)),p(this,s)}),this.g.attachEmptyPacketListener("pose_world_landmarks",o=>{p(this,o)}),this.outputPoseSegmentationMasks&&(R(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Ot(this,"pose_segmentation_mask"),this.g.W("pose_segmentation_mask",(o,s)=>{this.h.poseSegmentationMasks=[Pt(this,o,!0,!this.I)],p(this,s)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",o=>{this.h.poseSegmentationMasks=[],p(this,o)})),this.g.attachProtoListener("face_landmarks",(o,s)=>{Ar(o,this.h.faceLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("face_landmarks",o=>{p(this,o)}),this.outputFaceBlendshapes&&(F(e,"extra_blendshapes"),R(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(o,s)=>{var i=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(o=on(o),i.push(Uo(o.g()??[]))),p(this,s)}),this.g.attachEmptyPacketListener("extra_blendshapes",o=>{p(this,o)})),this.g.attachProtoListener("left_hand_landmarks",(o,s)=>{Ar(o,this.h.leftHandLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("left_hand_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("left_hand_world_landmarks",(o,s)=>{var i=this.h.leftHandWorldLandmarks;o=Ct(o),i.push(or(o)),p(this,s)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("right_hand_landmarks",(o,s)=>{Ar(o,this.h.rightHandLandmarks),p(this,s)}),this.g.attachEmptyPacketListener("right_hand_landmarks",o=>{p(this,o)}),this.g.attachProtoListener("right_hand_world_landmarks",(o,s)=>{var i=this.h.rightHandWorldLandmarks;o=Ct(o),i.push(or(o)),p(this,s)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",o=>{p(this,o)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.G,X.prototype.detect=X.prototype.F,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return w(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return w(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return w(X,e,t)},X.HAND_CONNECTIONS=Ho,X.POSE_CONNECTIONS=e1,X.FACE_LANDMARKS_LIPS=No,X.FACE_LANDMARKS_LEFT_EYE=Go,X.FACE_LANDMARKS_LEFT_EYEBROW=Vo,X.FACE_LANDMARKS_LEFT_IRIS=qa,X.FACE_LANDMARKS_RIGHT_EYE=jo,X.FACE_LANDMARKS_RIGHT_EYEBROW=Xo,X.FACE_LANDMARKS_RIGHT_IRIS=Ja,X.FACE_LANDMARKS_FACE_OVAL=Wo,X.FACE_LANDMARKS_CONTOURS=Za,X.FACE_LANDMARKS_TESSELATION=Qa;var Se=class extends pe{constructor(e,t){super(new Me(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},T(e=this.h=new Ua,0,1,t=new H)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return T(this.h,0,2,Nn(e,C(this.h,sn,2))),this.l(e)}ua(e,t){return this.j={classifications:[]},Oe(this,e,t),this.j}va(e,t,r){return this.j={classifications:[]},Ze(this,e,r,t),this.j}m(){var e=new de;j(e,"input_image"),j(e,"norm_rect"),F(e,"classifications");let t=new Ee;De(t,nc,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),N(r,"IMAGE:input_image"),N(r,"NORM_RECT:norm_rect"),R(r,"CLASSIFICATIONS:classifications"),r.o(t),we(e,r),this.g.attachProtoListener("classifications",(n,o)=>{this.j=function(s){let i={classifications:ot(s,N2,1).map(a=>Uo(C(a,wo,4)?.g()??[],Pe(Fe(a,2),0),ze(a,3)))};return Dr(ft(s,2))!=null&&(i.timestampMs=Pe(Dr(ft(s,2)),0)),i}(V2(n)),p(this,o)}),this.g.attachEmptyPacketListener("classifications",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Se.prototype.classifyForVideo=Se.prototype.va,Se.prototype.classify=Se.prototype.ua,Se.prototype.setOptions=Se.prototype.o,Se.createFromModelPath=function(e,t){return w(Se,e,{baseOptions:{modelAssetPath:t}})},Se.createFromModelBuffer=function(e,t){return w(Se,e,{baseOptions:{modelAssetBuffer:t}})},Se.createFromOptions=function(e,t){return w(Se,e,t)};var Te=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!0),this.h=new Ba,this.embeddings={embeddings:[]},T(e=this.h,0,1,t=new H)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){var t=this.h,r=C(this.h,Es,2);return r=r?r.clone():new Es,e.l2Normalize!==void 0?ar(r,1,e.l2Normalize):"l2Normalize"in e&&D(r,1),e.quantize!==void 0?ar(r,2,e.quantize):"quantize"in e&&D(r,2),T(t,0,2,r),this.l(e)}Ba(e,t){return Oe(this,e,t),this.embeddings}Ca(e,t,r){return Ze(this,e,r,t),this.embeddings}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"embeddings_out");let t=new Ee;De(t,oc,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"EMBEDDINGS:embeddings_out"),r.o(t),we(e,r),this.g.attachProtoListener("embeddings_out",(n,o)=>{n=H2(n),this.embeddings=function(s){return{embeddings:ot(s,X2,1).map(i=>{let a={headIndex:Pe(Fe(i,3),0)??-1,headName:ze(i,4)??""};if(Li(i,Pn,Tn(i,1))!==void 0)i=kt(i=C(i,Pn,Tn(i,1)),1,gt),a.floatEmbedding=i.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=C(i,j2,Tn(i,2))?.qa()?.h()??c}return a}),timestampMs:Pe(Dr(ft(s,2)),0)}}(n),p(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Te.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Rs(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Rs(ws(e.quantizedEmbedding),ws(t.quantizedEmbedding))}return e},Te.prototype.embedForVideo=Te.prototype.Ca,Te.prototype.embed=Te.prototype.Ba,Te.prototype.setOptions=Te.prototype.o,Te.createFromModelPath=function(e,t){return w(Te,e,{baseOptions:{modelAssetPath:t}})},Te.createFromModelBuffer=function(e,t){return w(Te,e,{baseOptions:{modelAssetBuffer:t}})},Te.createFromOptions=function(e,t){return w(Te,e,t)};var Xn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};function Ks(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function $s(e){try{let t=new Xn(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{hn(e)}}Xn.prototype.close=Xn.prototype.close;var ce=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.v=new Pa,T(this.h,0,3,this.v),T(e=this.h,0,1,t=new H)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?D(this.h,2,Vt(e.displayNamesLocale)):"displayNamesLocale"in e&&D(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}L(){(function(e){let t=ot(e.fa(),le,1).filter(r=>ze(r,1).includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.u=[],1<t.length)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(C(t[0],Ee,7)?.l()?.g()??new Map).forEach((r,n)=>{e.u[Number(n)]=ze(r,1)})})(this)}ga(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Ks(this),Oe(this,e,n),$s(this)}Na(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Ks(this),Ze(this,e,o,t),$s(this)}Fa(){return this.u}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect");let t=new Ee;De(t,Na,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),r.o(t),we(e,r),un(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),R(r,"CONFIDENCE_MASKS:confidence_masks"),Ot(this,"confidence_masks"),this.g.da("confidence_masks",(n,o)=>{this.confidenceMasks=n.map(s=>Pt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],p(this,n)})),this.outputCategoryMask&&(F(e,"category_mask"),R(r,"CATEGORY_MASK:category_mask"),Ot(this,"category_mask"),this.g.W("category_mask",(n,o)=>{this.categoryMask=Pt(this,n,!1,!this.j),p(this,o)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,p(this,n)})),F(e,"quality_scores"),R(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,o)=>{this.qualityScores=n,p(this,o)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ce.prototype.getLabels=ce.prototype.Fa,ce.prototype.segmentForVideo=ce.prototype.Na,ce.prototype.segment=ce.prototype.ga,ce.prototype.setOptions=ce.prototype.o,ce.createFromModelPath=function(e,t){return w(ce,e,{baseOptions:{modelAssetPath:t}})},ce.createFromModelBuffer=function(e,t){return w(ce,e,{baseOptions:{modelAssetBuffer:t}})},ce.createFromOptions=function(e,t){return w(ce,e,t)};var Wn=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};Wn.prototype.close=Wn.prototype.close;var mc=class extends g{constructor(e){super(e)}},Dt=[0,J,-2],pc=[0,nt,-3,Q],dn=[0,nt,-3,Q,nt,-1],t1=[0,dn],gc=[0,t1,Dt],yc=[0,dn,Dt],r1=[0,dn,J,-1],vc=[0,r1,Dt],_c=[0,nt,-3,Q,Dt,-1],Tc=[0,nt,-3,Q,$e],An=class extends g{constructor(e){super(e)}},qs=[0,nt,-1,Q],n1=class extends g{constructor(){super()}};n1.B=[1];var Js=class extends g{constructor(e){super(e)}},Hn=[1,2,3,4,5,6,7,8,9,10,14,15],xc=[0,Hn,P,dn,P,yc,P,t1,P,gc,P,qs,P,Tc,P,pc,P,[0,U,nt,-2,Q,J,Q,-1,2,nt,Dt],P,r1,P,vc,nt,Dt,U,P,_c,P,[0,re,qs]],bc=[0,U,J,-1,Q],Yn=class extends g{constructor(){super()}};Yn.B=[1],Yn.prototype.g=nn([0,re,xc,U,bc]);var We=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Mo,this.v=new Pa,T(this.h,0,3,this.v),T(e=this.h,0,1,t=new H)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(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)}ga(e,t,r,n){let o=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.J+1,n=new Yn;let s=new Js;var i=new mc;if(Ke(i,1,255),T(s,0,12,i),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new An;ar(a,3,!0),y(a,1,t.keypoint.x),y(a,2,t.keypoint.y),er(s,5,Hn,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(i=new n1,t.scribble))ar(t=new An,3,!0),y(t,1,a.x),y(t,2,a.y),jr(i,1,An,t);er(s,15,Hn,i)}jr(n,1,Js,s),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),Oe(this,e,o);e:{try{let u=new Wn(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=u;break e}this.j(u)}finally{hn(this)}c=void 0}return c}m(){var e=new de;j(e,"image_in"),j(e,"roi_in"),j(e,"norm_rect_in");let t=new Ee;De(t,Na,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),N(r,"IMAGE:image_in"),N(r,"ROI:roi_in"),N(r,"NORM_RECT:norm_rect_in"),r.o(t),we(e,r),un(this,e),this.outputConfidenceMasks&&(F(e,"confidence_masks"),R(r,"CONFIDENCE_MASKS:confidence_masks"),Ot(this,"confidence_masks"),this.g.da("confidence_masks",(n,o)=>{this.confidenceMasks=n.map(s=>Pt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],p(this,n)})),this.outputCategoryMask&&(F(e,"category_mask"),R(r,"CATEGORY_MASK:category_mask"),Ot(this,"category_mask"),this.g.W("category_mask",(n,o)=>{this.categoryMask=Pt(this,n,!1,!this.j),p(this,o)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,p(this,n)})),F(e,"quality_scores"),R(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,o)=>{this.qualityScores=n,p(this,o)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};We.prototype.segment=We.prototype.ga,We.prototype.setOptions=We.prototype.o,We.createFromModelPath=function(e,t){return w(We,e,{baseOptions:{modelAssetPath:t}})},We.createFromModelBuffer=function(e,t){return w(We,e,{baseOptions:{modelAssetBuffer:t}})},We.createFromOptions=function(e,t){return w(We,e,t)};var ke=class extends pe{constructor(e,t){super(new Me(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},T(e=this.h=new Oo,0,1,t=new H)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?D(this.h,2,Vt(e.displayNamesLocale)):"displayNamesLocale"in e&&D(this.h,2),e.maxResults!==void 0?Ke(this.h,3,e.maxResults):"maxResults"in e&&D(this.h,3),e.scoreThreshold!==void 0?y(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&D(this.h,4),e.categoryAllowlist!==void 0?Vr(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&D(this.h,5),e.categoryDenylist!==void 0?Vr(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&D(this.h,6),this.l(e)}F(e,t){return this.j={detections:[]},Oe(this,e,t),this.j}G(e,t,r){return this.j={detections:[]},Ze(this,e,r,t),this.j}m(){var e=new de;j(e,"input_frame_gpu"),j(e,"norm_rect"),F(e,"detections");let t=new Ee;De(t,ic,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),N(r,"IMAGE:input_frame_gpu"),N(r,"NORM_RECT:norm_rect"),R(r,"DETECTIONS:detections"),r.o(t),we(e,r),this.g.attachProtoVectorListener("detections",(n,o)=>{for(let s of n)n=ia(s),this.j.detections.push(Va(n));p(this,o)}),this.g.attachEmptyPacketListener("detections",n=>{p(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ke.prototype.detectForVideo=ke.prototype.G,ke.prototype.detect=ke.prototype.F,ke.prototype.setOptions=ke.prototype.o,ke.createFromModelPath=async function(e,t){return w(ke,e,{baseOptions:{modelAssetPath:t}})},ke.createFromModelBuffer=function(e,t){return w(ke,e,{baseOptions:{modelAssetBuffer:t}})},ke.createFromOptions=function(e,t){return w(ke,e,t)};var zn=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach(e=>{e.close()})}};function Zs(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function Qs(e){try{let t=new zn(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.j)return t;e.j(t)}finally{hn(e)}}zn.prototype.close=zn.prototype.close;var xe=class extends pe{constructor(e,t){super(new Me(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,T(e=this.h=new Ga,0,1,t=new H),this.D=new Ma,T(this.h,0,3,this.D),this.v=new Ia,T(this.h,0,2,this.v),Ke(this.v,4,1),y(this.v,2,.5),y(this.D,2,.5),y(this.h,4,.5)}get baseOptions(){return C(this.h,H,1)}set baseOptions(e){T(this.h,0,1,e)}o(e){return"numPoses"in e&&Ke(this.v,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&y(this.v,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&y(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&y(this.D,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}F(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,Zs(this),Oe(this,e,n),Qs(this)}G(e,t,r,n){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,Zs(this),Ze(this,e,o,t),Qs(this)}m(){var e=new de;j(e,"image_in"),j(e,"norm_rect"),F(e,"normalized_landmarks"),F(e,"world_landmarks"),F(e,"segmentation_masks");let t=new Ee;De(t,ac,this.h);let r=new le;Ae(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),R(r,"NORM_LANDMARKS:normalized_landmarks"),R(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),we(e,r),un(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,o)=>{this.landmarks=[];for(let s of n)n=yr(s),this.landmarks.push(cn(n));p(this,o)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],p(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,o)=>{this.worldLandmarks=[];for(let s of n)n=Ct(s),this.worldLandmarks.push(or(n));p(this,o)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],p(this,n)}),this.outputSegmentationMasks&&(R(r,"SEGMENTATION_MASK:segmentation_masks"),Ot(this,"segmentation_masks"),this.g.da("segmentation_masks",(n,o)=>{this.segmentationMasks=n.map(s=>Pt(this,s,!0,!this.j)),p(this,o)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],p(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 w(xe,e,{baseOptions:{modelAssetPath:t}})},xe.createFromModelBuffer=function(e,t){return w(xe,e,{baseOptions:{modelAssetBuffer:t}})},xe.createFromOptions=function(e,t){return w(xe,e,t)},xe.POSE_CONNECTIONS=e1;var Qe={New:"new",Error:"Error",Opened:"opened",Opening:"opening",Processing:"processing",Idle:"idle",Closing:"closing",Closed:"closed",Destroying:"destroying",Destroyed:"destroyed"},o1={None:"none",Blur:"blur",Overlay:"overlay"};var ae=(e,t="AssertError")=>{if(e==null)throw new Error(t,{cause:e});return e};var s1=e=>{let t=new Set(Object.keys(e));return r=>{for(let n in r)t.has(n)&&typeof e[n]==typeof r[n]&&(e[n]=r[n])}},i1=e=>{let t=new Map(e),r=new Set,n=async i=>{let c=await(await fetch(i)).blob();return await createImageBitmap(c)},o=async i=>{let a=t.get(i);if(!a){if(r.has(i))return null;r.add(i);let c=await n(i);return t.set(i,c),r.delete(i),c}return a},s=i=>(t.get(i)?.close(),t.delete(i));return{tryFetchingImage:o,setImage:(i,a)=>{t.has(i)&&s(i),t.set(i,a)},getImage:i=>t.get(i)??null,removeImage:s,clear:()=>{t.forEach(i=>i.close()),t.clear()}}},a1=(e,t)=>r=>Math.min(Math.max(r,e),t);var c1=(e,t,r,n)=>{if(!e||!t||!r||!n||e*n===r*t)return{sx:0,sy:0,sw:e,sh:t,dx:0,dy:0,dw:r,dh:n};let o=e/t,s=r/n;if(o>s){let u=Math.ceil(e*s)/o,h=Math.abs(e-u);return{sx:Math.ceil(h/2),sy:0,sw:u,sh:t,dx:0,dy:0,dw:r,dh:n}}let i=Math.ceil(t*o)/s,a=Math.abs(t-i);return{sx:0,sy:Math.ceil(a/2),sw:e,sh:i,dx:0,dy:0,dw:r,dh:n}};var vt=(e,t)=>{let r=e.getContext("2d",t);if(!r)throw new Error("Cannot get CanvasRenderingContext2D");return r},Ec=e=>{let t=vt(e);t.scale(-1,1),t.translate(-e.width,0)},Yo=e=>"VideoFrame"in globalThis&&e instanceof VideoFrame?{height:e.displayHeight,width:e.displayWidth}:"offsetHeight"in e&&typeof e.offsetHeight=="number"&&e.offsetHeight!==0&&"offsetWidth"in e&&typeof e.offsetWidth=="number"&&e.offsetWidth!==0?{height:e.offsetHeight,width:e.offsetWidth}:"videoHeight"in e&&typeof e.videoHeight=="number"&&e.videoHeight!==0&&"videoWidth"in e&&typeof e.videoWidth=="number"&&e.videoWidth!==0?{height:e.videoHeight,width:e.videoWidth}:"height"in e&&e.height!==0&&"width"in e&&e.width!==0?{height:e.height,width:e.width}:{height:0,width:0},_r=(e,t)=>new OffscreenCanvas(e,t);var Ac=e=>{vt(e).clearRect(0,0,e.width,e.height)},u1=(e,t)=>{let r={downScaleFactor:3},n=d=>{let f=r[d];if(!f){let v=_r(d==="downScaledCanvas"?Math.trunc(e/r.downScaleFactor):e,d==="downScaledCanvas"?Math.trunc(t/r.downScaleFactor):t);return r[d]=v,v}return f},o=(d,f)=>{let v=n(f);return vt(v).putImageData(d,0,0),v},s=(d,f,v,S,k,L,O,M,B,z)=>{let _t=f instanceof ImageData?o(f,"drawImageDataCanvas"):f;k===void 0||L===void 0?d.drawImage(_t,v,S):O===void 0||M===void 0||B===void 0||z===void 0?d.drawImage(_t,v,S,k,L):d.drawImage(_t,v,S,k,L,O,M,B,z)},i=(d,f,v=e,S=t,k={})=>{let{height:L,width:O}=Yo(d),M=c1(O,L,v,S),B=vt(f,k);s(B,d,M.sx,M.sy,M.sw,M.sh,M.dx,M.dy,M.dw,M.dh)},a=(d,f)=>{let v=n(f);return i(d,v),v},c=(d,f,v)=>{d.globalCompositeOperation=v,s(d,f,0,0)},u=(d,f,v)=>{let S=vt(d),k=0,L=5,O=1/(2*Math.PI*L*L),M=v<3?1:2;for(let B=-v;B<=v;B+=M)for(let z=-v;z<=v;z+=M){let _t=O*Math.exp(-(z*z+B*B)/(2*L*L));k+=_t}for(let B=-v;B<=v;B+=M)for(let z=-v;z<=v;z+=M)S.globalAlpha=O*Math.exp(-(z*z+B*B)/(2*L*L))/k*v,s(S,f,z,B);S.globalAlpha=1},h=({image:d,blurAmount:f,canvas:v,preserveOldDrawing:S=!0})=>{let{height:k,width:L}=Yo(d),O=vt(v);if(f<=0)return s(O,d,0,0,L,k);let M=n("downScaledCanvas"),B=vt(M);S||(B.clearRect(0,0,M.width,M.height),O.clearRect(0,0,L,k)),"filter"in O?(B.filter=`blur(${f}px)`,s(B,d,0,0,L,k,0,0,M.width,M.height),s(O,M,0,0,L,k)):u(v,d,f)},l=({image:d,blurAmount:f,offscreenCanvasName:v,preserveOldDrawing:S})=>{let k=n(v);return Ac(k),f===0?i(d,k):h({image:d,blurAmount:f,canvas:k,preserveOldDrawing:S}),k},m=(d,f,v)=>{let S=Array.isArray(d)?d[0]?.canvas:d.canvas;if(!S)return n("maskCanvas");let k=l({image:S,offscreenCanvasName:"maskCanvas",blurAmount:0});return v===0?k:l({image:k,blurAmount:v,offscreenCanvasName:"blurredMaskCanvas",preserveOldDrawing:!1})},b=(d,f,v,S,k=.5,L=3,O=3,M=!1)=>{let B=l({image:v,blurAmount:L,offscreenCanvasName:"blurredCanvas"}),z=vt(d);if(Array.isArray(S)&&S.length===0)return s(z,B,0,0);let _t=m(S,k,O);z.save(),M&&Ec(d);let{height:A1,width:w1}=Yo(f);s(z,f,0,0,w1,A1),c(z,_t,"destination-in"),c(z,B,"destination-over"),z.restore()};return{evaluateInput:d=>a(d,"inputCanvas"),renderImageToCanvas:i,drawBlurEffect:(d,f,v,S=.5,k=3,L=3,O=!1)=>b(d,f,f,v,S,k,L,O),drawOverlayEffect:(d,f,v,S,k=.5,L=0,O=3,M=!1)=>b(d,f,v,S,k,L,O,M),renderImageToOffScreenCanvas:a,renderImageDataToOffScreenCanvas:o,drawAndBlurImageOnOffScreenCanvas:l}};var mn={VertexShader:WebGLRenderingContext.VERTEX_SHADER,FragmentShader:WebGLRenderingContext.FRAGMENT_SHADER},zo={[mn.VertexShader]:"VertexShader",[mn.FragmentShader]:"FragmentShader"},wc=e=>typeof e=="string"?e.startsWith("#version 300 es"):!1,h1=e=>{if(!wc(e))throw new Error("Expecting GLSL ES 3.00 shader source")},Rc=/ERROR:\s*\d+:(\d+)/gi;function d1(e,t="",r=0){let n=[...t.matchAll(Rc)],o=new Map(n.map((s,i)=>{if(!s[1]||s.index===void 0)return[0,t];let a=parseInt(s[1],10),c=n[i+1],u=c?c.index:t.length,h=t.substring(s.index,u);return[a-1,h]}));return e.split(`
42
42
  `).map((s,i)=>{let a=o.get(i);return`${i+1+r}: ${s}${a?`
43
43
 
44
44
  ^^^ ${a}`:""}`}).join(`
45
- `)}var f2=(e,t,r)=>{let n=e.createShader(t);if(!n)throw new Error(`Unable to create ${Yo[t]}`);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let s=e.getShaderInfoLog(n);e.deleteShader(n);let i=`Error compiling ${Yo[t]}: ${s??""}
46
- ${s?p2(r,s):"no error message available"}`;throw new Error(i)}return n},Ac=(e,t,r,n)=>{let o=e.createProgram();if(!o)throw new Error("Unable to create WebGL program");if(t.forEach(function(i){e.attachShader(o,i)}),r?.forEach(function(i,a){let c=n?.[a]??a;e.bindAttribLocation(o,c,i)}),e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS)){let i=e.getProgramInfoLog(o);throw e.deleteProgram(o),new Error(`Error in program linking: ${i??""}
47
- ${t.map(a=>{let c=p2(e.getShaderSource(a)??""),u=e.getShaderParameter(a,e.SHADER_TYPE);return`${Yo[u]}:
45
+ `)}var l1=(e,t,r)=>{let n=e.createShader(t);if(!n)throw new Error(`Unable to create ${zo[t]}`);if(e.shaderSource(n,r),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){let s=e.getShaderInfoLog(n);e.deleteShader(n);let i=`Error compiling ${zo[t]}: ${s??""}
46
+ ${s?d1(r,s):"no error message available"}`;throw new Error(i)}return n},Sc=(e,t,r,n)=>{let o=e.createProgram();if(!o)throw new Error("Unable to create WebGL program");if(t.forEach(function(i){e.attachShader(o,i)}),r?.forEach(function(i,a){let c=n?.[a]??a;e.bindAttribLocation(o,c,i)}),e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS)){let i=e.getProgramInfoLog(o);throw e.deleteProgram(o),new Error(`Error in program linking: ${i??""}
47
+ ${t.map(a=>{let c=d1(e.getShaderSource(a)??""),u=e.getShaderParameter(a,e.SHADER_TYPE);return`${zo[u]}:
48
48
  ${c}`}).join(`
49
- `)}`)}return[o,()=>{t.forEach(i=>{e.detachShader(o,i),e.deleteShader(i)}),e.deleteProgram(o)}]},wc=(e,[t,r],n,o)=>Ac(e,[f2(e,dn.VertexShader,t),f2(e,dn.FragmentShader,r)],n,o),Rt=e=>{let t=e.createTexture();return 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,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),t},d2=(e,t,r)=>Object.keys(r).reduce((n,o)=>{let i=r[o];return i?{...n,[o]:i.startsWith("u_")?e.getUniformLocation(t,i):e.getAttribLocation(t,i)}:n},{}),gt=(e,{attribs:t,uniforms:r,vertexSrc:n,fragmentSrc:o})=>{let s=e.getContext("webgl2",{premultipliedAlpha:!1});if(!s)throw new Error("WebGL2 is not supported");s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),l2(n),l2(o);let[i,a]=wc(s,[n,o]);return{gl:s,program:i,attribLocations:d2(s,i,t),uniformLocations:d2(s,i,r),release:a}},Ko=e=>({texture:e.getAsWebGLTexture(),width:e.width,height:e.height});var fe={projection:(e,t,r=-1)=>[2/e,0,0,0,2/t*r,0,-1,1*-r,1],translation:(e,t)=>[1,0,0,0,1,0,e,t,1],rotation:e=>{let t=Math.cos(e),r=Math.sin(e);return[t,-r,0,r,t,0,0,0,1]},scaling:(e,t)=>[e,0,0,0,t,0,0,0,1],multiply:(e,t)=>{let r=e[0],n=e[0*3+1],o=e[0*3+2],s=e[1*3+0],i=e[1*3+1],a=e[1*3+2],c=e[2*3+0],u=e[2*3+1],h=e[2*3+2],f=t[0*3+0],m=t[0*3+1],b=t[0*3+2],A=t[1*3+0],x=t[1*3+1],N=t[1*3+2],d=t[2*3+0],l=t[2*3+1],v=t[2*3+2];return[f*r+m*s+b*c,f*n+m*i+b*u,f*o+m*a+b*h,A*r+x*s+N*c,A*n+x*i+N*u,A*o+x*a+N*h,d*r+l*s+v*c,d*n+l*i+v*u,d*o+l*a+v*h]},translate:(e,t,r)=>fe.multiply(e,fe.translation(t,r)),rotate:(e,t)=>fe.multiply(e,fe.rotation(t)),scale:(e,t,r)=>fe.multiply(e,fe.scaling(t,r))};var yt=`#version 300 es
49
+ `)}`)}return[o,()=>{t.forEach(i=>{e.detachShader(o,i),e.deleteShader(i)}),e.deleteProgram(o)}]},kc=(e,[t,r],n,o)=>Sc(e,[l1(e,mn.VertexShader,t),l1(e,mn.FragmentShader,r)],n,o),Ve=e=>{let t=e.createTexture();return 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,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),t},f1=(e,t,r)=>Object.keys(r).reduce((n,o)=>{let i=r[o];return i?{...n,[o]:i.startsWith("u_")?e.getUniformLocation(t,i):e.getAttribLocation(t,i)}:n},{}),Ue=(e,{attribs:t,uniforms:r,vertexSrc:n,fragmentSrc:o})=>{let s=e.getContext("webgl2",{premultipliedAlpha:!1});if(!s)throw new Error("WebGL2 is not supported");s.enable(s.BLEND),s.blendFunc(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA),h1(n),h1(o);let[i,a]=kc(s,[n,o]);return{gl:s,program:i,attribLocations:f1(s,i,t),uniformLocations:f1(s,i,r),release:a}},m1=e=>({texture:e.getAsWebGLTexture(),width:e.width,height:e.height});var se={projection:(e,t,r=-1)=>[2/e,0,0,0,2/t*r,0,-1,1*-r,1],translation:(e,t)=>[1,0,0,0,1,0,e,t,1],rotation:e=>{let t=Math.cos(e),r=Math.sin(e);return[t,-r,0,r,t,0,0,0,1]},scaling:(e,t)=>[e,0,0,0,t,0,0,0,1],multiply:(e,t)=>{let r=e[0],n=e[0*3+1],o=e[0*3+2],s=e[1*3+0],i=e[1*3+1],a=e[1*3+2],c=e[2*3+0],u=e[2*3+1],h=e[2*3+2],l=t[0*3+0],m=t[0*3+1],b=t[0*3+2],E=t[1*3+0],A=t[1*3+1],Y=t[1*3+2],d=t[2*3+0],f=t[2*3+1],v=t[2*3+2];return[l*r+m*s+b*c,l*n+m*i+b*u,l*o+m*a+b*h,E*r+A*s+Y*c,E*n+A*i+Y*u,E*o+A*a+Y*h,d*r+f*s+v*c,d*n+f*i+v*u,d*o+f*a+v*h]},translate:(e,t,r)=>se.multiply(e,se.translation(t,r)),rotate:(e,t)=>se.multiply(e,se.rotation(t)),scale:(e,t,r)=>se.multiply(e,se.scaling(t,r))};var Be=`#version 300 es
50
50
  // an attribute is an input (in) to a vertex shader.
51
51
  // It will receive data from a buffer
52
52
  in vec2 a_position;
@@ -64,7 +64,7 @@ void main() {
64
64
  // pass the texCoord to the fragment shader
65
65
  v_texCoord = a_texCoord;
66
66
  }
67
- `;var pn=`#version 300 es
67
+ `;var Yt=`#version 300 es
68
68
  precision mediump float;
69
69
 
70
70
  // Passed in from the vertex shader.
@@ -79,7 +79,7 @@ out vec4 outColor;
79
79
  void main() {
80
80
  outColor = texture(u_texture, v_texCoord);
81
81
  }
82
- `;var $o=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=gt(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",texture:"u_texture"},vertexSrc:yt,fragmentSrc:pn}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Rt(t),h=Rt(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let f=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,f),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,h,0),{render:m=>{t.bindFramebuffer(t.FRAMEBUFFER,f),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.uniform1i(o.texture,0);let b=fe.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,b),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,m.frame),t.generateMipmap(t.TEXTURE_2D),t.drawArrays(t.TRIANGLES,0,6),ye(h),{texture:h,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteTexture(h),t.deleteVertexArray(i),s()}}};var m2=`#version 300 es
82
+ `;var Ko=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",texture:"u_texture"},vertexSrc:Be,fragmentSrc:Yt}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Ve(t),h=Ve(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let l=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,h,0),{render:m=>{t.bindFramebuffer(t.FRAMEBUFFER,l),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.uniform1i(o.texture,0);let b=se.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,b),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,m.frame),t.generateMipmap(t.TEXTURE_2D),t.drawArrays(t.TRIANGLES,0,6),ae(h),{texture:h,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteTexture(h),t.deleteVertexArray(i),s()}}};var p1=`#version 300 es
83
83
  precision mediump float;
84
84
 
85
85
  // our textures
@@ -123,15 +123,33 @@ void main() {
123
123
  }
124
124
  outColor = Upsample(u_frame, v_texCoord, halfpixel);
125
125
  }
126
- `;var Rc=c2(1,9),qo=(e,t)=>{let{gl:r,program:n,attribLocations:o,uniformLocations:s,release:i}=gt(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",downsampling:"u_downsampling",frame:"u_frame"},vertexSrc:yt,fragmentSrc:m2}),a=r.createVertexArray();r.bindVertexArray(a);let c=r.createBuffer();r.enableVertexAttribArray(o.position),r.bindBuffer(r.ARRAY_BUFFER,c),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),r.STATIC_DRAW);let u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),r.STATIC_DRAW),r.enableVertexAttribArray(o.texCoord),r.vertexAttribPointer(o.texCoord,2,r.FLOAT,!1,0,0);let h=(A,x,N)=>{r.bindFramebuffer(r.FRAMEBUFFER,A),r.viewport(0,0,x,N)},f=A=>{let x=Rt(r);ye(x);let N=Math.trunc(e.width/Math.pow(2,A)),d=Math.trunc(e.height/Math.pow(2,A));r.texImage2D(r.TEXTURE_2D,0,r.RGBA,N,d,0,r.RGBA,r.UNSIGNED_BYTE,null);let l=r.createFramebuffer();ye(l),r.bindFramebuffer(r.FRAMEBUFFER,l);let v=r.COLOR_ATTACHMENT0;return r.framebufferTexture2D(r.FRAMEBUFFER,v,r.TEXTURE_2D,x,0),{texture:x,frameBuffer:l,width:N,height:d}},m=(A,x=0)=>{let N=Math.max(Rc(x+A)-x,0);return Array.from({length:N}).map((d,l)=>f(x+l))},b=m(t+1);return{render:(A,x)=>{r.useProgram(n),r.bindVertexArray(a),r.activeTexture(r.TEXTURE0),r.uniform1i(s.frame,0),r.bindTexture(r.TEXTURE_2D,A.texture),r.uniform1i(s.downsampling,1);let N=x+1;for(N>b.length&&m(N-b.length,b.length).forEach(d=>b.push(d));N<b.length;){let d=b.pop();r.deleteTexture(d?.texture??null),r.deleteFramebuffer(d?.frameBuffer??null)}for(let d=1;d<N;d++){let{frameBuffer:l=null,texture:v=null,width:k=e.width,height:R=e.height}=b[d]??{};h(l,k,R);let I=fe.projection(1,1,1);r.uniformMatrix3fv(s.matrix,!1,I),r.drawArrays(r.TRIANGLES,0,6);let U=r.checkFramebufferStatus(r.FRAMEBUFFER);if(U!==r.FRAMEBUFFER_COMPLETE)throw new Error(`downsampling FrameBuffer Status: ${U}`);r.bindTexture(r.TEXTURE_2D,v)}r.uniform1i(s.downsampling,0);for(let d=x-1;d>=0;d--){let{frameBuffer:l=null,texture:v=null,width:k=e.width,height:R=e.height}=b[d]??{};h(l,k,R);let I=fe.projection(1,1,1);r.uniformMatrix3fv(s.matrix,!1,I),r.drawArrays(r.TRIANGLES,0,6);let U=r.checkFramebufferStatus(r.FRAMEBUFFER);if(U!==r.FRAMEBUFFER_COMPLETE)throw new Error(`Upsampling FrameBuffer Status: ${U}`);r.bindTexture(r.TEXTURE_2D,v)}return{texture:b[0]?.texture??A.texture,width:b[0]?.width??A.width,height:b[0]?.height??A.height}},release:()=>{b.forEach(({frameBuffer:A,texture:x})=>{r.deleteTexture(x),r.deleteFramebuffer(A)}),r.deleteBuffer(c),r.deleteBuffer(u),r.deleteVertexArray(a),i()}}};var g2=`#version 300 es
126
+ `;var Cc=a1(1,9),$o=(e,t)=>{let{gl:r,program:n,attribLocations:o,uniformLocations:s,release:i}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",downsampling:"u_downsampling",frame:"u_frame"},vertexSrc:Be,fragmentSrc:p1}),a=r.createVertexArray();r.bindVertexArray(a);let c=r.createBuffer();r.enableVertexAttribArray(o.position),r.bindBuffer(r.ARRAY_BUFFER,c),r.vertexAttribPointer(o.position,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),r.STATIC_DRAW);let u=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),r.STATIC_DRAW),r.enableVertexAttribArray(o.texCoord),r.vertexAttribPointer(o.texCoord,2,r.FLOAT,!1,0,0);let h=(E,A,Y)=>{r.bindFramebuffer(r.FRAMEBUFFER,E),r.viewport(0,0,A,Y)},l=E=>{let A=Ve(r);ae(A);let Y=Math.trunc(e.width/Math.pow(2,E)),d=Math.trunc(e.height/Math.pow(2,E));r.texImage2D(r.TEXTURE_2D,0,r.RGBA,Y,d,0,r.RGBA,r.UNSIGNED_BYTE,null);let f=r.createFramebuffer();ae(f),r.bindFramebuffer(r.FRAMEBUFFER,f);let v=r.COLOR_ATTACHMENT0;return r.framebufferTexture2D(r.FRAMEBUFFER,v,r.TEXTURE_2D,A,0),{texture:A,frameBuffer:f,width:Y,height:d}},m=(E,A=0)=>{let Y=Math.max(Cc(A+E)-A,0);return Array.from({length:Y}).map((d,f)=>l(A+f))},b=m(t+1);return{render:(E,A)=>{r.useProgram(n),r.bindVertexArray(a),r.activeTexture(r.TEXTURE0),r.uniform1i(s.frame,0),r.bindTexture(r.TEXTURE_2D,E.texture),r.uniform1i(s.downsampling,1);let Y=A+1;for(Y>b.length&&m(Y-b.length,b.length).forEach(d=>b.push(d));Y<b.length;){let d=b.pop();r.deleteTexture(d?.texture??null),r.deleteFramebuffer(d?.frameBuffer??null)}for(let d=1;d<Y;d++){let{frameBuffer:f=null,texture:v=null,width:S=e.width,height:k=e.height}=b[d]??{};h(f,S,k);let L=se.projection(1,1,1);r.uniformMatrix3fv(s.matrix,!1,L),r.drawArrays(r.TRIANGLES,0,6);let O=r.checkFramebufferStatus(r.FRAMEBUFFER);if(O!==r.FRAMEBUFFER_COMPLETE)throw new Error(`downsampling FrameBuffer Status: ${O}`);r.bindTexture(r.TEXTURE_2D,v)}r.uniform1i(s.downsampling,0);for(let d=A-1;d>=0;d--){let{frameBuffer:f=null,texture:v=null,width:S=e.width,height:k=e.height}=b[d]??{};h(f,S,k);let L=se.projection(1,1,1);r.uniformMatrix3fv(s.matrix,!1,L),r.drawArrays(r.TRIANGLES,0,6);let O=r.checkFramebufferStatus(r.FRAMEBUFFER);if(O!==r.FRAMEBUFFER_COMPLETE)throw new Error(`Upsampling FrameBuffer Status: ${O}`);r.bindTexture(r.TEXTURE_2D,v)}return{texture:b[0]?.texture??E.texture,width:b[0]?.width??E.width,height:b[0]?.height??E.height}},release:()=>{b.forEach(({frameBuffer:E,texture:A})=>{r.deleteTexture(A),r.deleteFramebuffer(E)}),r.deleteBuffer(c),r.deleteBuffer(u),r.deleteVertexArray(a),i()}}};var g1=`#version 300 es
127
127
  precision mediump float;
128
128
 
129
129
  // our textures
130
130
  uniform sampler2D u_mask;
131
- uniform sampler2D u_mask_prev;
132
131
  uniform sampler2D u_frame_foreground;
133
132
  uniform sampler2D u_frame_background;
134
133
 
134
+ in vec2 v_texCoord;
135
+
136
+ // we need to declare an output for the fragment shader
137
+ out vec4 outColor;
138
+
139
+ void main() {
140
+ vec4 background = texture(u_frame_background, v_texCoord);
141
+ vec4 foreground = texture(u_frame_foreground, v_texCoord);
142
+ float filteredMask = texture(u_mask, v_texCoord).r;
143
+
144
+ outColor = mix(background, foreground, filteredMask);
145
+ }
146
+ `;var y1=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",frameBackground:"u_frame_background",frameForeground:"u_frame_foreground",mask:"u_mask"},vertexSrc:Be,fragmentSrc:g1});t.enable(t.BLEND);let i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Ve(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let h=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,h),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{render:({mask:l,foreground:m,background:b})=>{t.bindFramebuffer(t.FRAMEBUFFER,h),t.viewport(0,0,e.width,e.height),t.useProgram(r),t.bindVertexArray(i),t.activeTexture(t.TEXTURE0),t.uniform1i(o.frameForeground,0),t.bindTexture(t.TEXTURE_2D,m.texture),t.activeTexture(t.TEXTURE1),t.uniform1i(o.frameBackground,1),t.bindTexture(t.TEXTURE_2D,b.texture),t.activeTexture(t.TEXTURE2),t.uniform1i(o.mask,2),t.bindTexture(t.TEXTURE_2D,l.texture);let E=se.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,E),t.drawArrays(t.TRIANGLES,0,6),ae(u),{texture:u,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteFramebuffer(h),t.deleteVertexArray(i),s()}}};var v1=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",texture:"u_texture"},vertexSrc:Be,fragmentSrc:Yt}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0),{render:u=>{t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.uniform1i(o.texture,0);let h=se.projection(1,1);t.uniformMatrix3fv(o.matrix,!1,h),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,u.texture),t.drawArrays(t.TRIANGLES,0,6)},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteVertexArray(i),s()}}};var _1=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",texture:"u_texture"},vertexSrc:Be,fragmentSrc:Yt}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Ve(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let h=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,h),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{render:l=>{t.bindFramebuffer(t.FRAMEBUFFER,h),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.activeTexture(t.TEXTURE0),t.uniform1i(o.texture,0),t.bindTexture(t.TEXTURE_2D,l.texture);let m=se.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,m),t.drawArrays(t.TRIANGLES,0,6),ae(u),{texture:u,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteVertexArray(i),s()}}};var T1=`#version 300 es
147
+ precision mediump float;
148
+
149
+ // our textures
150
+ uniform sampler2D u_mask;
151
+ uniform sampler2D u_mask_prev;
152
+
135
153
  // control flags
136
154
  uniform float u_mask_combine_ratio;
137
155
  uniform float u_foreground_threshold;
@@ -173,16 +191,12 @@ float SmoothingMask(sampler2D prevMask, sampler2D currMask, vec2 uv, float ratio
173
191
  }
174
192
 
175
193
  void main() {
176
- vec2 halfpixel = 0.5 / vec2(textureSize(u_frame_background, 0));
177
-
178
- vec4 background = texture(u_frame_background, v_texCoord);
179
- vec4 foreground = texture(u_frame_foreground, v_texCoord);
180
194
  float maskAlpha = SmoothingMask(u_mask_prev, u_mask, v_texCoord, u_mask_combine_ratio);
181
- float filteredMask = maskAlpha;
182
- if (maskAlpha < u_foreground_threshold) {
183
- filteredMask = 0.0;
195
+ float backgroundMask = maskAlpha;
196
+ if (backgroundMask < u_foreground_threshold) {
197
+ backgroundMask = 0.0;
184
198
  }
185
199
 
186
- outColor = mix(background, foreground, filteredMask);
200
+ outColor = vec4(backgroundMask, backgroundMask, backgroundMask, backgroundMask);
187
201
  }
188
- `;var y2=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=gt(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",frameBackground:"u_frame_background",frameForeground:"u_frame_foreground",mask:"u_mask",maskCombineRatio:"u_mask_combine_ratio",foregroundThreshold:"u_foreground_threshold",prevMask:"u_mask_prev"},vertexSrc:yt,fragmentSrc:g2});t.enable(t.BLEND);let i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Rt(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let h=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,h),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{render:({mask:f,prevMask:m,foreground:b,background:A},x)=>{t.bindFramebuffer(t.FRAMEBUFFER,h),t.viewport(0,0,e.width,e.height),t.useProgram(r),t.bindVertexArray(i),t.activeTexture(t.TEXTURE0),t.uniform1i(o.frameForeground,0),t.bindTexture(t.TEXTURE_2D,b.texture),t.activeTexture(t.TEXTURE1),t.uniform1i(o.frameBackground,1),t.bindTexture(t.TEXTURE_2D,A.texture),t.activeTexture(t.TEXTURE2),t.uniform1i(o.mask,2),t.bindTexture(t.TEXTURE_2D,f.texture),t.activeTexture(t.TEXTURE3),t.uniform1i(o.prevMask,3),t.bindTexture(t.TEXTURE_2D,m?.texture??f.texture);let N=fe.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,N),t.uniform1f(o.maskCombineRatio,x.maskCombineRatio),t.uniform1f(o.foregroundThreshold,x.foregroundThreshold),t.drawArrays(t.TRIANGLES,0,6),ye(u),{texture:u,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteFramebuffer(h),t.deleteVertexArray(i),s()}}};var v2=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=gt(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",texture:"u_texture"},vertexSrc:yt,fragmentSrc:pn}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0),{render:u=>{t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.uniform1i(o.texture,0);let h=fe.projection(1,1);t.uniformMatrix3fv(o.matrix,!1,h),t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,u.texture),t.drawArrays(t.TRIANGLES,0,6)},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteVertexArray(i),s()}}};var _2=e=>{let t={};return new Proxy(t,{get(r,n,o){return r[n]||(r[n]=e[n]?.(t)),Reflect.get(r,n,o)}})},T2=(e=new OffscreenCanvas(768,432),{backgroundBlurAmount:t=3,backgroundImageUrl:r="",edgeBlurAmount:n=3,effects:o=s2.None,foregroundThreshold:s=.5,maskCombineRatio:i=.5,onError:a,backgroundImageInits:c}={})=>{let u={videoFrameRenderer:()=>$o(e),canvasRenderer:()=>v2(e),backgroundImageRenderer:()=>$o(e),blendRenderer:()=>y2(e),blurRenderer:()=>qo(e,f.backgroundBlurAmount),maskBlurRenderer:()=>qo(e,f.edgeBlurAmount),release:l=>()=>Object.keys(l).forEach(v=>v!=="release"&&l[v]?.release())},h=_2(u),f={backgroundBlurAmount:t,backgroundImageUrl:r,edgeBlurAmount:n,effects:o,foregroundThreshold:s,maskCombineRatio:i,canvas:e,backgroundImages:a2(c),get videoFrameRenderer(){return h.videoFrameRenderer},get canvasRenderer(){return h.canvasRenderer},get backgroundImageRenderer(){return h.backgroundImageRenderer},get blendRenderer(){return h.blendRenderer},get blurRenderer(){return h.blurRenderer},get maskBlurRenderer(){return h.maskBlurRenderer}},m=i2(f),b=l=>{l.backgroundImage&&f.backgroundImages.setImage(l.backgroundImage.key,l.backgroundImage.image),m(l)},A=l=>{if(l instanceof Error)return a?.(l);throw l};return{init:l=>{l&&b(l)},render:(l,v,k)=>{k&&m(k);let R=f.videoFrameRenderer.render(v),I=R;if(f.effects==="blur"&&f.backgroundBlurAmount)I=f.blurRenderer.render(R,f.backgroundBlurAmount);else if(f?.effects==="overlay"&&f.backgroundImageUrl){let F=f.backgroundImages.getImage(f.backgroundImageUrl);F?I=f.backgroundImageRenderer.render({frame:F,timestamp:performance.now(),width:F.width,height:F.height}):f.backgroundImages.tryFetchingImage(f.backgroundImageUrl).catch(W=>{A(new Error(`FailedToLoadBackgroundImage: ${f.backgroundImageUrl}`,{cause:W}))})}let U=f.blendRenderer.render({prevMask:f.prevMask&&Ko(f.prevMask),mask:Ko(l),foreground:R,background:I},f);f.canvasRenderer.render(U),f.prevMask?.close(),f.prevMask=l.clone()},release:()=>{h.release(),h=_2(u),f.backgroundImages.clear(),f.prevMask?.close(),f.prevMask=void 0},update:b}};var E={width:768,height:432,status:qe.New,directOutput:!1},zt=(e,t)=>postMessage(e,t??[]),Lc=async(e={})=>{try{E.status=qe.Opening,e.processingWidth&&(E.width=e.processingWidth),e.processingHeight&&(E.height=e.processingHeight),E.directOutput=!!e.output,E.output=e.output??vr(E.width,E.height);let{basePath:t,imageSegmenterOptions:r={}}=e;E.processCanvas=r.canvas??vr(E.width,E.height),E.renderer=T2(E.processCanvas,{...e.renderOptions,backgroundImageInits:e.backgroundImage&&[[e.backgroundImage.key,e.backgroundImage.image]],onError:s=>{zt({type:"error",error:s})}}),E.renderer.init();let n=await nt.forVisionTasks(t),o=await ie.createFromOptions(n,{outputCategoryMask:!1,outputConfidenceMasks:!0,runningMode:"VIDEO",canvas:E.processCanvas,baseOptions:{modelAssetPath:r.modelAsset?.path,delegate:r.delegate}});E.renderUtils=h2(E.width,E.height),E.segmenter=o,E.status=qe.Opened,zt({type:"opened"})}catch(t){if(E.status=qe.Error,t instanceof Error)return zt({type:"error",error:t});throw t}};self.addEventListener("message",e=>{switch(e.data.type){case"open":{Lc(e.data.data);break}case"update":{let{renderOptions:t,backgroundImage:r,output:n}=e.data.data;(t||r)&&E.renderer?.update({...t,backgroundImage:r}),n!==void 0&&(E.output=n??vr(E.width,E.height),E.directOutput=!!n);break}case"process":{E.status=qe.Processing;let{videoFrame:t,imageSegmenterOptions:r,renderOptions:n}=e.data.data;E.videoFrame=t,ye(E.segmenter),(r?.delegate||r?.canvas)&&E.segmenter.setOptions({canvas:r.canvas,baseOptions:{delegate:r.delegate}}).catch(o=>{E.status=qe.Error,o instanceof Error&&zt({type:"error",error:o})}),ye(E.renderUtils),E.segmenter.segmentForVideo(E.renderUtils.renderImageToOffScreenCanvas(t.frame,"inputCanvas"),t.timestamp,o=>{let{confidenceMasks:s}=o,i=s?.[0];if(!i)zt({type:"processed"});else{ye(E.output),ye(E.renderer),ye(E.renderUtils),ye(E.processCanvas),E.renderer.render(i,t,n),E.renderUtils.renderImageToCanvas(E.processCanvas,E.output,E.width,E.height),t.frame.close();let a=E.directOutput?void 0:E.output.transferToImageBitmap();zt({type:"processed",data:a&&{frame:a,width:E.output.width,height:E.output.height,timestamp:performance.now()}},a?[a]:void 0)}E.status=qe.Idle});break}case"close":{E.status=qe.Closing,E.renderer?.release(),E.videoFrame?.frame.close(),E.segmenter?.close(),E.status=qe.Closed;break}case"destroy":break}});
202
+ `;var x1=e=>{let{gl:t,program:r,attribLocations:n,uniformLocations:o,release:s}=Ue(e,{attribs:{position:"a_position",texCoord:"a_texCoord"},uniforms:{matrix:"u_matrix",mask:"u_mask",maskCombineRatio:"u_mask_combine_ratio",foregroundThreshold:"u_foreground_threshold",prevMask:"u_mask_prev"},vertexSrc:Be,fragmentSrc:T1}),i=t.createVertexArray();t.bindVertexArray(i);let a=t.createBuffer();t.enableVertexAttribArray(n.position),t.bindBuffer(t.ARRAY_BUFFER,a),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW);let c=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,c),t.bufferData(t.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,0,1,0,0,1,1,1]),t.STATIC_DRAW),t.enableVertexAttribArray(n.texCoord),t.vertexAttribPointer(n.texCoord,2,t.FLOAT,!1,0,0);let u=Ve(t);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,e.width,e.height,0,t.RGBA,t.UNSIGNED_BYTE,null);let h=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,h),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{render:({mask:l,prevMask:m},b)=>{t.bindFramebuffer(t.FRAMEBUFFER,h),t.viewport(0,0,e.width,e.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(r),t.bindVertexArray(i),t.activeTexture(t.TEXTURE0),t.uniform1i(o.mask,0),t.bindTexture(t.TEXTURE_2D,l.texture),t.activeTexture(t.TEXTURE1),t.uniform1i(o.prevMask,1),t.bindTexture(t.TEXTURE_2D,m?.texture??l.texture);let E=se.projection(1,1,1);return t.uniformMatrix3fv(o.matrix,!1,E),t.uniform1f(o.maskCombineRatio,b.maskCombineRatio),t.uniform1f(o.foregroundThreshold,b.foregroundThreshold),t.drawArrays(t.TRIANGLES,0,6),ae(u),{texture:u,width:e.width,height:e.height}},release:()=>{t.deleteBuffer(a),t.deleteBuffer(c),t.deleteTexture(u),t.deleteFramebuffer(h),t.deleteVertexArray(i),s()}}};var b1=e=>{let t={};return new Proxy(t,{get(r,n,o){return r[n]||(r[n]=e[n]?.(t)),Reflect.get(r,n,o)}})},E1=(e=new OffscreenCanvas(768,432),{backgroundBlurAmount:t=3,backgroundImageUrl:r="",edgeBlurAmount:n=3,effects:o=o1.None,foregroundThreshold:s=.5,maskCombineRatio:i=.5,onError:a,backgroundImageInits:c}={})=>{let u={videoFrameRenderer:()=>Ko(e),canvasRenderer:()=>v1(e),backgroundImageRenderer:()=>Ko(e),blendRenderer:()=>y1(e),blurRenderer:()=>$o(e,l.backgroundBlurAmount),maskBlurRenderer:()=>$o(e,l.edgeBlurAmount),textureRenderer:()=>_1(e),smoothingMaskRenderer:()=>x1(e),release:f=>()=>Object.keys(f).forEach(v=>v!=="release"&&f[v]?.release())},h=b1(u),l={backgroundBlurAmount:t,backgroundImageUrl:r,edgeBlurAmount:n,effects:o,foregroundThreshold:s,maskCombineRatio:i,canvas:e,backgroundImages:i1(c),get videoFrameRenderer(){return h.videoFrameRenderer},get canvasRenderer(){return h.canvasRenderer},get backgroundImageRenderer(){return h.backgroundImageRenderer},get blendRenderer(){return h.blendRenderer},get blurRenderer(){return h.blurRenderer},get maskBlurRenderer(){return h.maskBlurRenderer},get textureRenderer(){return h.textureRenderer},get smoothingMaskRenderer(){return h.smoothingMaskRenderer}},m=s1(l),b=f=>{f.backgroundImage&&l.backgroundImages.setImage(f.backgroundImage.key,f.backgroundImage.image),m(f)},E=f=>{if(f instanceof Error)return a?.(f);throw f};return{init:f=>{f&&b(f)},render:(f,v,S)=>{S&&m(S);let k=l.smoothingMaskRenderer.render({mask:m1(f),prevMask:l.prevMask},l),L=l.videoFrameRenderer.render(v),O=L;if(l.effects==="blur"&&l.backgroundBlurAmount)O=l.blurRenderer.render(L,l.backgroundBlurAmount);else if(l?.effects==="overlay"&&l.backgroundImageUrl){let B=l.backgroundImages.getImage(l.backgroundImageUrl);B?O=l.backgroundImageRenderer.render({frame:B,timestamp:performance.now(),width:B.width,height:B.height}):l.backgroundImages.tryFetchingImage(l.backgroundImageUrl).catch(z=>{E(new Error(`FailedToLoadBackgroundImage: ${l.backgroundImageUrl}`,{cause:z}))})}let M=l.blendRenderer.render({mask:k,foreground:L,background:O});l.canvasRenderer.render(M),l.prevMask=l.textureRenderer.render(k)},release:()=>{h.release(),h=b1(u),l.backgroundImages.clear(),l.prevMask=void 0},update:b}};var x={width:768,height:432,status:Qe.New,directOutput:!1},zt=(e,t)=>postMessage(e,t??[]),Oc=async(e={})=>{try{x.status=Qe.Opening,e.processingWidth&&(x.width=e.processingWidth),e.processingHeight&&(x.height=e.processingHeight),x.directOutput=!!e.output,x.output=e.output??_r(x.width,x.height);let{basePath:t,imageSegmenterOptions:r={}}=e;x.processCanvas=r.canvas??_r(x.width,x.height),x.renderer=E1(x.processCanvas,{...e.renderOptions,backgroundImageInits:e.backgroundImage&&[[e.backgroundImage.key,e.backgroundImage.image]],onError:s=>{zt({type:"error",error:s})}}),x.renderer.init();let n=await it.forVisionTasks(t),o=await ce.createFromOptions(n,{outputCategoryMask:!1,outputConfidenceMasks:!0,runningMode:"VIDEO",canvas:x.processCanvas,baseOptions:{modelAssetPath:r.modelAsset?.path,delegate:r.delegate}});x.renderUtils=u1(x.width,x.height),x.segmenter=o,x.status=Qe.Opened,zt({type:"opened"})}catch(t){if(x.status=Qe.Error,t instanceof Error)return zt({type:"error",error:t});throw t}};self.addEventListener("message",e=>{switch(e.data.type){case"open":{Oc(e.data.data);break}case"update":{let{renderOptions:t,backgroundImage:r,output:n}=e.data.data;(t||r)&&x.renderer?.update({...t,backgroundImage:r}),n!==void 0&&(x.output=n??_r(x.width,x.height),x.directOutput=!!n);break}case"process":{x.status=Qe.Processing;let{videoFrame:t,imageSegmenterOptions:r,renderOptions:n}=e.data.data;x.videoFrame=t,ae(x.segmenter),(r?.delegate||r?.canvas)&&x.segmenter.setOptions({canvas:r.canvas,baseOptions:{delegate:r.delegate}}).catch(o=>{x.status=Qe.Error,o instanceof Error&&zt({type:"error",error:o})}),ae(x.renderUtils),x.segmenter.segmentForVideo(x.renderUtils.renderImageToOffScreenCanvas(t.frame,"inputCanvas"),t.timestamp,o=>{let{confidenceMasks:s}=o,i=s?.[0];if(!i)zt({type:"processed"});else{ae(x.output),ae(x.renderer),ae(x.renderUtils),ae(x.processCanvas),x.renderer.render(i,t,n),x.renderUtils.renderImageToCanvas(x.processCanvas,x.output,x.width,x.height),t.frame.close();let a=x.directOutput?void 0:x.output.transferToImageBitmap();zt({type:"processed",data:a&&{frame:a,width:x.output.width,height:x.output.height,timestamp:performance.now()}},a?[a]:void 0)}x.status=Qe.Idle});break}case"close":{x.status=Qe.Closing,x.renderer?.release(),x.videoFrame?.frame.close(),x.segmenter?.close(),x.status=Qe.Closed;break}case"destroy":break}});