easyproctor 2.1.1 → 2.2.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.
@@ -1,18 +1,18 @@
1
- "use strict";(()=>{var Lm=Object.create;var fl=Object.defineProperty;var Nm=Object.getOwnPropertyDescriptor;var jm=Object.getOwnPropertyNames;var Vm=Object.getPrototypeOf,zm=Object.prototype.hasOwnProperty;var Gm=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hm=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of jm(t))!zm.call(e,o)&&o!==r&&fl(e,o,{get:()=>t[o],enumerable:!(i=Nm(t,o))||i.enumerable});return e};var Wm=(e,t,r)=>(r=e!=null?Lm(Vm(e)):{},Hm(t||!e||!e.__esModule?fl(r,"default",{value:e,enumerable:!0}):r,e));var gp=Gm((sc,ac)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof sc<"u"?t():(t(),e.FileSaver={})})(sc,function(){"use strict";function e(a,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function t(a,c,l){var u=new XMLHttpRequest;u.open("GET",a),u.responseType="blob",u.onload=function(){s(u.response,c,l)},u.onerror=function(){console.error("could not download file")},u.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function i(a){try{a.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,n=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!n?function(a,c,l){var u=o.URL||o.webkitURL,d=document.createElement("a");c=c||a.name||"download",d.download=c,d.rel="noopener",typeof a=="string"?(d.href=a,d.origin===location.origin?i(d):r(d.href)?t(a,c,l):i(d,d.target="_blank")):(d.href=u.createObjectURL(a),setTimeout(function(){u.revokeObjectURL(d.href)},4e4),setTimeout(function(){i(d)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,l){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(e(a,l),c);else if(r(a))t(a,c,l);else{var u=document.createElement("a");u.href=a,u.target="_blank",setTimeout(function(){i(u)})}}:function(a,c,l,u){if(u=u||open("","_blank"),u&&(u.document.title=u.document.body.innerText="downloading..."),typeof a=="string")return t(a,c,l);var d=a.type==="application/octet-stream",f=/constructor/i.test(o.HTMLElement)||o.safari,m=/CriOS\/[\d]+/.test(navigator.userAgent);if((m||d&&f||n)&&typeof FileReader<"u"){var h=new FileReader;h.onloadend=function(){var _=h.result;_=m?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),u?u.location.href=_:location=_,u=null},h.readAsDataURL(a)}else{var g=o.URL||o.webkitURL,y=g.createObjectURL(a);u?u.location=y:location.href=y,u=null,setTimeout(function(){g.revokeObjectURL(y)},4e4)}});o.saveAs=s.saveAs=s,typeof ac<"u"&&(ac.exports=s)})});async function ko(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function Eo(){return new Promise((e,t)=>{let r=window.screen.isExtended;if(r)e(r);else if(navigator.userAgent.indexOf("Firefox")>-1)e(!1);else{let o=[];window.getScreenDetails().then(function(n){o=n,e(o.screens.length>=2)})}})}async function tt(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>!e.some(n=>o.deviceId.includes(n)||o.label.includes(n)));return{cameras:r.filter(o=>o.kind=="videoinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId})),microphones:r.filter(o=>o.kind=="audioinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId}))}}var ea=typeof self<"u"?self:{};function mu(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=ea,o=0;o<r.length;o++)if((i=i[r[o]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function cr(){throw Error("Invalid UTF8")}function ml(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var _o,ks,$m=typeof TextDecoder<"u",qm,Xm=typeof TextEncoder<"u";function gu(e){if(Xm)e=(qm||=new TextEncoder).encode(e);else{let r=0,i=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)i[r++]=t;else{if(2048>t)i[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let n=e.charCodeAt(++o);if(56320<=n&&57343>=n){t=1024*(t-55296)+n-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}o--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var wi,yu=mu(610401301,!1),ta=mu(572417392,!0),gl=ea.navigator;function Is(e){return!!yu&&!!wi&&wi.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function ze(e){var t;return(t=ea.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function jt(){return!!yu&&!!wi&&0<wi.brands.length}function Es(){return jt()?Is("Chromium"):(ze("Chrome")||ze("CriOS"))&&!(!jt()&&ze("Edge"))||ze("Silk")}wi=gl&&gl.userAgentData||null;var Km=!jt()&&(ze("Trident")||ze("MSIE"));!ze("Android")||Es(),Es(),ze("Safari")&&(Es()||!jt()&&ze("Coast")||!jt()&&ze("Opera")||!jt()&&ze("Edge")||(jt()?Is("Microsoft Edge"):ze("Edg/"))||jt()&&Is("Opera"));var vu={},pi=null;function Jm(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 i=new Uint8Array(r),o=0;return function(n,s){function a(m){for(;c<n.length;){var h=n.charAt(c++),g=pi[h];if(g!=null)return g;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return m}bu();for(var c=0;;){var l=a(-1),u=a(0),d=a(64),f=a(64);if(f===64&&l===-1)break;s(l<<2|u>>4),d!=64&&(s(u<<4&240|d>>2),f!=64&&s(d<<6&192|f))}}(e,function(n){i[o++]=n}),o!==r?i.subarray(0,o):i}function bu(){if(!pi){pi={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var i=e.concat(t[r].split(""));vu[r]=i;for(var o=0;o<i.length;o++){var n=i[o];pi[n]===void 0&&(pi[n]=o)}}}}var wu=typeof Uint8Array<"u",Su=!Km&&typeof btoa=="function";function yl(e){if(!Su){var t;t===void 0&&(t=0),bu(),t=vu[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],n=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|n>>4],n=t[(15&n)<<2|s>>6],s=t[63&s],r[l++]=a+o+n+s}switch(a=0,s=i,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||i;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var vl=/[-_.]/g,Ym={"-":"+",_:"/",".":"="};function Zm(e){return Ym[e]||""}function ku(e){if(!Su)return Jm(e);vl.test(e)&&(e=e.replace(vl,Zm)),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 qo(e){return wu&&e!=null&&e instanceof Uint8Array}var Qm;function Xo(){return Qm||=new Uint8Array(0)}var xr={},e1;function Eu(e){if(e!==xr)throw Error("illegal external caller")}function Cr(){return e1||=new Vt(null,xr)}function ra(e){Eu(xr);var t=e.Z;return(t=t==null||qo(t)?t:typeof t=="string"?ku(t):null)==null?t:e.Z=t}var Vt=class{constructor(e,t){if(Eu(t),this.Z=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}wa(){let e=ra(this);return e?new Uint8Array(e):Xo()}};function _u(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function ia(){return Error("Failed to read varint, encoding is invalid.")}function Au(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Tu(e){return e.length==0?Cr():new Vt(e,xr)}function oa(e){if(typeof e=="string")return{buffer:ku(e),L:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),L:!1};if(e.constructor===Uint8Array)return{buffer:e,L:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),L:!1};if(e.constructor===Vt)return{buffer:ra(e)||Xo(),L:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),L:!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 na(){return typeof BigInt=="function"}var Os=!ta,bl=!ta,t1=typeof Uint8Array.prototype.slice=="function",xu,F=0,Q=0;function dr(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[i,o]=ca(r,e);e=o,r=i}F=r>>>0,Q=e>>>0}function sa(e){let t=xu||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Q=0,F=t.getUint32(0,!0)}function Ds(e,t){return 4294967296*t+(e>>>0)}function aa(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=Ds(e,t),r?-e:e}function Lo(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else na()?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+wl(r)+wl(e));return r}function wl(e){return e=String(e),"0000000".slice(e.length)+e}function Cu(){var e=F,t=Q;if(2147483648&t)if(na())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,i]=ca(e,t);e="-"+Lo(r,i)}else e=Lo(e,t);return e}function Ko(e){if(16>e.length)dr(Number(e));else if(na())e=BigInt(e),F=Number(e&BigInt(4294967295))>>>0,Q=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");Q=F=0;let r=e.length;for(let i=t,o=(r-t)%6+t;o<=r;i=o,o+=6){let n=Number(e.slice(i,o));Q*=1e6,F=1e6*F+n,4294967296<=F&&(Q+=Math.trunc(F/4294967296),Q>>>=0,F>>>=0)}if(t){let[i,o]=ca(F,Q);F=i,Q=o}}}function ca(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function la(e,t){let r,i=0,o=0,n=0,s=e.h,a=e.g;do r=s[a++],i|=(127&r)<<n,n+=7;while(32>n&&128&r);for(32<n&&(o|=(127&r)>>4),n=3;32>n&&128&r;n+=7)r=s[a++],o|=(127&r)<<n;if(hr(e,a),128>r)return t(i>>>0,o>>>0);throw ia()}function ua(e){let t=0,r=e.g,i=r+10,o=e.h;for(;r<i;){let n=o[r++];if(t|=n,(128&n)==0)return hr(e,r),!!(127&t)}throw ia()}function Gt(e){let t=e.h,r=e.g,i=t[r++],o=127&i;if(128&i&&(i=t[r++],o|=(127&i)<<7,128&i&&(i=t[r++],o|=(127&i)<<14,128&i&&(i=t[r++],o|=(127&i)<<21,128&i&&(i=t[r++],o|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw ia();return hr(e,r),o}function Ht(e){return Gt(e)>>>0}function Fs(e){var t=e.h;let r=e.g,i=t[r],o=t[r+1],n=t[r+2];return t=t[r+3],hr(e,e.g+4),(i<<0|o<<8|n<<16|t<<24)>>>0}function Bs(e){var t=Fs(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 r1(e){return Gt(e)}function _s(e,t,{aa:r=!1}={}){e.aa=r,t&&(t=oa(t),e.h=t.buffer,e.m=t.L,e.j=0,e.l=e.h.length,e.g=e.j)}function hr(e,t){if(e.g=t,t>e.l)throw Au(e.l,t)}function Pu(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,i=r+t;if(i>e.l)throw Au(t,e.l-r);return e.g=i,r}function Ru(e,t){if(t==0)return Cr();var r=Pu(e,t);return e.aa&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?Xo():t1?e.slice(r,t):new Uint8Array(e.subarray(r,t))),Tu(r)}var Sl=[];function Iu(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 _u(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 Po(e){switch(e.h){case 0:e.h!=0?Po(e):ua(e.g);break;case 1:hr(e=e.g,e.g+8);break;case 2:if(e.h!=2)Po(e);else{var t=Ht(e.g);hr(e=e.g,e.g+t)}break;case 5:hr(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!Iu(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Po(e)}break;default:throw _u(e.h,e.l)}}function Ci(e,t,r){let i=e.g.l,o=Ht(e.g),n=e.g.g+o,s=n-i;if(0>=s&&(e.g.l=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=n,e.g.l=i,t}function da(e){var t=Ht(e.g),r=Pu(e=e.g,t);if(e=e.h,$m){var i,o=e;(i=ks)||(i=ks=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var n=i.decode(o)}catch(a){if(_o===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),_o=!0}catch{_o=!1}}throw!_o&&(ks=void 0),a}}else{t=(n=r)+t,r=[];let a,c=null;for(;n<t;){var s=e[n++];128>s?r.push(s):224>s?n>=t?cr():(a=e[n++],194>s||(192&a)!=128?(n--,cr()):r.push((31&s)<<6|63&a)):240>s?n>=t-1?cr():(a=e[n++],(192&a)!=128||s===224&&160>a||s===237&&160<=a||(192&(i=e[n++]))!=128?(n--,cr()):r.push((15&s)<<12|(63&a)<<6|63&i)):244>=s?n>=t-2?cr():(a=e[n++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(i=e[n++]))!=128||(192&(o=e[n++]))!=128?(n--,cr()):(s=(7&s)<<18|(63&a)<<12|(63&i)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):cr(),8192<=r.length&&(c=ml(c,r),r.length=0)}n=ml(c,r)}return n}function Ou(e){let t=Ht(e.g);return Ru(e.g,t)}function Jo(e,t,r){var i=Ht(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Ao=[];function kl(e){return e?/^\d+$/.test(e)?(Ko(e),new El(F,Q)):null:i1||=new El(0,0)}var El=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},i1;function _l(e){return e?/^-?\d+$/.test(e)?(Ko(e),new Al(F,Q)):null:o1||=new Al(0,0)}var Al=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},o1;function No(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 Pi(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function Yo(e,t){if(0<=t)Pi(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Si(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 Pr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function qe(e,t,r){Pi(e.g,8*t+r)}function ha(e,t){return qe(e,t,2),t=e.g.end(),Pr(e,t),t.push(e.h),t}function pa(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 Zo(e,t,r){qe(e,t,2),Pi(e.g,r.length),Pr(e,e.g.end()),Pr(e,r)}function Ms(e,t,r,i){r!=null&&(t=ha(e,t),i(r,e),pa(e,t))}var Wt=class{constructor(t,r,i,o){this.g=t,this.h=r,this.l=i,this.qa=o}};function ve(e){return Array.prototype.slice.call(e)}function Du(e){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():e}var ft=Du(),Tl=Du("0di"),Qo=ft?(e,t)=>{e[ft]|=t}:(e,t)=>{e.D!==void 0?e.D|=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function xl(e){let t=G(e);(1&t)!=1&&(Object.isFrozen(e)&&(e=ve(e)),$(e,1|t))}var jo=ft?(e,t)=>{e[ft]&=~t}:(e,t)=>{e.D!==void 0&&(e.D&=~t)};function le(e,t,r){return r?e|t:e&~t}var G=ft?e=>0|e[ft]:e=>0|e.D,I=ft?e=>e[ft]:e=>e.D,$=ft?(e,t)=>{e[ft]=t}:(e,t)=>{e.D!==void 0?e.D=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Cl(){var e=[];return Qo(e,1),e}function Mr(e){return Qo(e,34),e}function n1(e,t){$(t,-14591&(0|e))}function Us(e,t){$(t,-14557&(34|e))}function Vo(e){return(e=e>>14&1023)===0?536870912:e}var Ri={},Fu={};function Pl(e){return!(!e||typeof e!="object"||e.Na!==Fu)}function mi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}var Bu=!ta;function Mu(e,t,r){if(e!=null){if(typeof e=="string")e=e?new Vt(e,xr):Cr();else if(e.constructor!==Vt)if(qo(e))e=r?Tu(e):e.length?new Vt(new Uint8Array(e),xr):Cr();else{if(!t)throw Error();e=void 0}}return e}function Ls(e,t,r){if(!Array.isArray(e)||e.length)return!1;let i=G(e);return!!(1&i)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&($(e,1|i),!0)}var ur,Rl=[];function vt(e){if(2&e)throw Error()}$(Rl,55),ur=Object.freeze(Rl);var Rr=class{constructor(t,r,i){this.l=0,this.g=t,this.h=r,this.m=i}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 Rr(this.g,this.h,this.m)}},s1={},zt,ki;function Uu(e,t){(t=zt?t[zt]:void 0)&&(e[zt]=ve(t))}function Ns(e){return(e=Error(e)).__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity="warning",e}function Kt(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Lu(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}Object.freeze(new class{}),Object.freeze(new class{});var a1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function en(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&a1.test(e)}function Ur(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 c1(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 Il(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Nu(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 fa(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(dr(e),e=aa(F,Q)),e}function ma(e){var t=Math.trunc(Number(e));return Number.isSafeInteger(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Nu(e)||(Ko(e),e=Cu()),e)}function zo(e){return e==null?e:en(e)?typeof e=="number"?fa(e):ma(e):void 0}function Ii(e){if(typeof e!="string")throw Error();return e}function Oi(e){if(e!=null&&typeof e!="string")throw Error();return e}function Ei(e){return e==null||typeof e=="string"?e:void 0}function ga(e,t,r,i){if(e!=null&&typeof e=="object"&&e.W===Ri)return e;if(!Array.isArray(e))return r?2&i?(e=t[Tl])?t=e:(Mr((e=new t).s),t=t[Tl]=e):t=new t:t=void 0,t;let o=r=G(e);return o===0&&(o|=32&i),o|=2&i,o!==r&&$(e,o),new t(e)}function l1(e,t,r){if(t){var i=!!i;if(!en(t=e))throw Ns("int64");typeof t=="string"?i=ma(t):i?(i=Math.trunc(t),Number.isSafeInteger(i)?i=String(i):Nu(t=String(i))?i=t:(dr(i),i=Cu())):i=fa(t)}else i=zo(e);return typeof(r=(e=i)==null?r?0:void 0:e)=="string"&&(i=+r,Number.isSafeInteger(i))?i:r}var Go,ya,u1;function Ho(e){switch(typeof e){case"boolean":return ya||=[0,void 0,!0];case"number":return 0<e?void 0:e===0?u1||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function pr(e,t){return ju(e,t[0],t[1])}function ju(e,t,r){if(e==null&&(e=Go),Go=void 0,e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error();if(64&(i=G(e)))return ki&&delete e[ki],e;if(i|=64,r&&(i|=512,r!==e[0]))throw Error();e:{let o=(r=e).length;if(o){let n=o-1;if(mi(r[n])){if(1024<=(t=n-(+!!(512&(i|=256))-1)))throw Error();i=-16760833&i|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&i)-1))))throw Error();i=-16760833&i|(1023&t)<<14}}}return $(e,i),e}var d1=function(){try{return new class extends Map{constructor(){super()}},!1}catch{return!0}}(),gi=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()}},h1=d1?(Object.setPrototypeOf(gi.prototype,Map.prototype),Object.defineProperties(gi.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),gi):class extends Map{constructor(){super()}};function To(e){return e}function As(e){if(2&e.O)throw Error("Cannot mutate an immutable Map")}var He=class extends h1{constructor(e,t,r=To,i=To){super();let o=G(e);o|=64,$(e,o),this.O=o,this.V=t,this.R=r||To,this.Y=this.V?p1:i||To;for(let n=0;n<e.length;n++){let s=e[n],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=i(s[1],!1,!0,void 0,void 0,o),super.set(a,c)}}pa(e=Ol){return this.X(e)}X(e=Ol){let t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){As(this),super.clear()}delete(e){return As(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new Rr(e,f1,this)}keys(){return this.Ma()}values(){var e=this.ma();return new Rr(e,He.prototype.get,this)}forEach(e,t){super.forEach((r,i)=>{e.call(t,this.get(i),i,this)})}set(e,t){return As(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.V,!1,this.O))}Ta(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.V?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.O),super.set(t,e)}has(e){return super.has(this.R(e,!1,!1))}get(e){e=this.R(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.V;return r?((r=this.Y(t,!1,!0,r,this.xa,this.O))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ma(){return super.keys()}[Symbol.iterator](){return this.entries()}};function p1(e,t,r,i,o,n){return e=ga(e,i,r,n),o&&(e=tn(e)),e}function Ol(e){return e}function f1(e){return[e,this.get(e)]}function va(e,t,r,i,o,n){if(e!=null){if(Array.isArray(e))e=o&&e.length==0&&1&G(e)?void 0:n&&2&G(e)?e:ba(e,t,r,i!==void 0,o,n);else if(mi(e)){let s={};for(let a in e)s[a]=va(e[a],t,r,i,o,n);e=s}else e=t(e,i);return e}}function ba(e,t,r,i,o,n){let s=i||r?G(e):0;i=i?!!(32&s):void 0;let a=ve(e);for(let c=0;c<a.length;c++)a[c]=va(a[c],t,r,i,o,n);return r&&(Uu(a,e),r(s,a)),a}function m1(e){return va(e,Vu,void 0,void 0,!1,!1)}function Vu(e){return e.W===Ri?e.toJSON():e instanceof He?e.pa(m1):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))return Bu||!Ls(t,void 0,9999)?t:void 0;if(qo(t))return yl(t);if(t instanceof Vt){let r=t.Z;return r==null?"":typeof r=="string"?r:t.Z=yl(r)}if(t instanceof He)return t=t.pa(),Os||t.length!==0?t:void 0}}return t}(e)}function js(e,t,r=Us){if(e!=null){if(wu&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=G(e);return 2&i?e:(t&&=i===0||!!(32&i)&&!(64&i||!(16&i)),t?($(e,-12293&(34|i)),e):ba(e,js,4&i?Us:r,!0,!1,!0))}return e.W===Ri?(r=e.s,e=2&(i=I(r))?e:wa(e,r,i,!0)):e instanceof He&&(r=Mr(e.X(js)),e=new He(r,e.V,e.R,e.Y)),e}}function wa(e,t,r,i){return e=e.constructor,Go=t=zu(t,r,i),t=new e(t),Go=void 0,t}function zu(e,t,r){let i=r||2&t?Us:n1,o=!!(32&t);return e=function(n,s,a){let c=ve(n);var l=c.length;let u=256&s?c[l-1]:void 0;for(l+=u?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(u){s=c[s]={};for(let d in u)s[d]=a(u[d])}return Uu(c,n),c}(e,t,n=>js(n,o,i)),Qo(e,32|(r?2:0)),e}function tn(e){let t=e.s,r=I(t);return 2&r?wa(e,t,r,!1):e}function Ir(e,t){return bt(e=e.s,I(e),t)}function bt(e,t,r,i){if(r===-1)return null;if(r>=Vo(t)){if(256&t)return e[e.length-1][r]}else{var o=e.length;if(i&&256&t&&(i=e[o-1][r])!=null)return i;if((t=r+(+!!(512&t)-1))<o)return e[t]}}function B(e,t,r,i){let o=e.s,n=I(o);return vt(n),M(o,n,t,r,i),e}function M(e,t,r,i,o){var n=Vo(t);if(r>=n||o){if(o=t,256&t)n=e[e.length-1];else{if(i==null)return o;n=e[n+(+!!(512&t)-1)]={},o|=256}return n[r]=i,o!==t&&$(e,o),o}return e[r+(+!!(512&t)-1)]=i,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function Lr(e,t,r,i,o){var n=2&t;let s=bt(e,t,r,o);Array.isArray(s)||(s=ur);let a=!(2&i);i=!(1&i);let c=!!(32&t),l=G(s);return l!==0||!c||n||a?1&l||(l|=1,$(s,l)):(l|=33,$(s,l)),n?(e=!1,2&l||(Mr(s),e=!!(4&l)),(i||e)&&Object.freeze(s)):(n=!!(2&l)||!!(2048&l),i&&n?(s=ve(s),i=1,c&&!a&&(i|=32),$(s,i),M(e,t,r,s,o)):a&&32&l&&!n&&jo(s,32)),s}function Ro(e,t){e=e.s;let r=I(e),i=bt(e,r,t),o=Kt(i);return o!=null&&o!==i&&M(e,r,t,o),o}function Gu(e){e=e.s;let t=I(e),r=bt(e,t,1),i=Mu(r,!0,!!(34&t));return i!=null&&i!==r&&M(e,t,1,i),i}function Ar(e,t,r){e=e.s;let i=I(e),o=2&i?1:2,n=Hu(e,i,t);var s=G(n);if(!(4&s)){(4&s||Object.isFrozen(n))&&(n=ve(n),s=fr(s,i,!1),i=M(e,i,t,n));var a=0;let c=0;for(;a<n.length;a++){let l=r(n[a]);l!=null&&(n[c++]=l)}c<a&&(n.length=c),s=le(s=Wu(s,i,!1),20,!0),s=le(s,4096,!1),s=le(s,8192,!1),$(n,s),2&s&&Object.freeze(n)}return yi(s)||(r=s,(s=(a=o===1)?le(s,2,!0):le(s,32,!1))!==r&&$(n,s),a&&Object.freeze(n)),o===2&&yi(s)&&(n=ve(n),s=fr(s,i,!1),$(n,s),M(e,i,t,n)),n}function Hu(e,t,r){return e=bt(e,t,r),Array.isArray(e)?e:ur}function Wu(e,t,r){return e===0&&(e=fr(e,t,r)),le(e,1,!0)}function yi(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}var g1;function Dl(){return g1??=new He(Mr([]),void 0,void 0,void 0,s1)}function $u(e){e=ve(e);for(let t=0;t<e.length;t++){let r=e[t]=ve(e[t]);Array.isArray(r[1])&&(r[1]=Mr(r[1]))}return e}function Wo(e,t,r){{let s=e.s,a=I(s);if(vt(a),r==null)M(s,a,t);else{var i,o=e=G(r),n=!!(2&e)||Object.isFrozen(r);if((i=!n)&&(i=!1),!(4&e))for(e=21,n&&(r=ve(r),o=0,e=fr(e,a,!0)),n=0;n<r.length;n++)r[n]=Ii(r[n]);i&&(r=ve(r),o=0,e=fr(e,a,!0)),e!==o&&$(r,e),M(s,a,t,r)}}}function Di(e,t,r,i){let o=I(e);vt(o),e=Lr(e,o,t,2),i=r(i,!!(4&(t=G(e)))&&!!(4096&t)),e.push(i)}function y1(e){return e}function Ts(e,t){return Sa(e=e.s,I(e),Rd)===t?t:-1}function Sa(e,t,r){let i=0;for(let o=0;o<r.length;o++){let n=r[o];bt(e,t,n)!=null&&(i!==0&&(t=M(e,t,i)),i=n)}return i}function ka(e,t,r,i){let o=I(e);vt(o);let n=bt(e,o,r,i),s;if(n!=null&&n.W===Ri)return(t=tn(n))!==n&&M(e,o,r,t,i),t.s;if(Array.isArray(n)){let a=G(n);s=2&a?zu(n,a,!1):n,s=pr(s,t)}else s=pr(void 0,t);return s!==n&&M(e,o,r,s,i),s}function qu(e,t,r,i){e=e.s;let o=I(e),n=bt(e,o,r,i);return(t=ga(n,t,!1,o))!==n&&t!=null&&M(e,o,r,t,i),t}function P(e,t,r,i=!1){if((t=qu(e,t,r,i))==null)return t;e=e.s;let o=I(e);if(!(2&o)){let n=tn(t);n!==t&&M(e,o,r,t=n,i)}return t}function Xu(e,t,r,i,o,n){var s=!!(2&t),a=s?1:2;let c=a===1;a=a===2,o=!!o,n&&=!s,s=Hu(e,t,i);var l=G(s);let u=!!(4&l);if(!u){var d=s,f=t;let m=!!(2&(l=Wu(l,t,o)));m&&(f=le(f,2,!0));let h=!m,g=!0,y=0,_=0;for(;y<d.length;y++){let v=ga(d[y],r,!1,f);if(v instanceof r){if(!m){let T=!!(2&G(v.s));h&&=!T,g&&=T}d[_++]=v}}_<y&&(d.length=_),l=le(l,4,!0),l=le(l,16,g),l=le(l,8,h),$(d,l),m&&Object.freeze(d)}if(r=!!(8&l)||c&&!s.length,n&&!r){for(yi(l)&&(s=ve(s),l=fr(l,t,o),t=M(e,t,i,s)),n=s,r=l,d=0;d<n.length;d++)(l=n[d])!==(f=tn(l))&&(n[d]=f);r=le(r,8,!0),r=le(r,16,!n.length),$(n,r),l=r}return yi(l)||(n=l,c?l=le(l,!s.length||16&l&&(!u||32&l)?2:2048,!0):o||(l=le(l,32,!1)),l!==n&&$(s,l),c&&Object.freeze(s)),a&&yi(l)&&(s=ve(s),l=fr(l,t,o),$(s,l),M(e,t,i,s)),s}function Ot(e,t,r){e=e.s;let i=I(e);return Xu(e,i,t,r,!1,!(2&i))}function E(e,t,r,i,o){return i==null&&(i=void 0),B(e,r,i,o)}function vi(e,t,r,i){i==null&&(i=void 0),e=e.s;let o=I(e);vt(o),(r=Sa(e,o,r))&&r!==t&&i!=null&&(o=M(e,o,r)),M(e,o,t,i)}function fr(e,t,r){return e=le(e,2,!!(2&t)),e=le(e,32,!!(32&t)&&r),le(e,2048,!1)}function Vs(e,t,r){e=e.s;let i=I(e);vt(i),e=Xu(e,i,t,1,!0),t=r??new t,e.push(t),2&G(t.s)?jo(e,8):jo(e,16)}function Ge(e,t){return Ur(Ir(e,t))}function We(e,t){return Ei(Ir(e,t))}function mt(e){return e??0}function ue(e,t){return mt(Ro(e,t))}function _i(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}`);B(e,t,r)}function gt(e,t,r){if(r!=null){if(typeof r!="number"||!Number.isFinite(r))throw Ns("int32");r|=0}B(e,t,r)}function A(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);B(e,t,r)}function rt(e,t,r){t.g?t.m(e,t.g,t.h,r,!0):t.m(e,t.h,r,!0)}He.prototype.toJSON=void 0,He.prototype.Na=Fu;var b=class{constructor(e,t){this.s=ju(e,t)}toJSON(){return Ku(this,ba(this.s,Vu,void 0,void 0,!1,!1),!0)}l(){var e=S2;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 wa(this,e,I(e),!1)}L(){return!!(2&G(this.s))}};function Ku(e,t,r){let i=e.constructor.A;var o=I(r?e.s:t),n=Vo(o),s=!1;if(i&&Bu){if(!r){var a;if((t=ve(t)).length&&mi(a=t[t.length-1])){for(s=0;s<i.length;s++)if(i[s]>=n){Object.assign(t[t.length-1]={},a);break}}s=!0}var c;n=t,r=!r,e=Vo(a=I(e.s)),a=+!!(512&a)-1;for(let y=0;y<i.length;y++){var l=i[y];if(l<e){var u=n[l+=a];u==null?n[l]=r?ur:Cl():r&&u!==ur&&xl(u)}else{if(!c){var d=void 0;n.length&&mi(d=n[n.length-1])?c=d:n.push(c={})}u=c[l],c[l]==null?c[l]=r?ur:Cl():r&&u!==ur&&xl(u)}}}if(!(c=t.length))return t;let f,m;if(mi(d=t[c-1])){e:{var h=d;for(var g in n={},r=!1,h)e=h[g],Array.isArray(e)&&(a=e,(!bl&&Ls(e,i,+g)||!Os&&Pl(e)&&e.size===0)&&(e=null),e!=a&&(r=!0)),e!=null?n[g]=e:r=!0;if(r){for(let y in n){h=n;break e}h=null}}h!=d&&(f=!0),c--}for(o=+!!(512&o)-1;0<c&&((d=t[g=c-1])==null||!bl&&Ls(d,i,g-o)||!Os&&Pl(d)&&d.size===0);c--)m=!0;return(f||m)&&(t=s?t:Array.prototype.slice.call(t,0,c),s&&(t.length=c),h&&t.push(h)),t}function Ju(e){return Array.isArray(e)?e[0]instanceof Wt?e:[C1,e]:[e,void 0]}function Nr(e,t){if(Array.isArray(t)){var r=G(t);if(4&r)return t;for(var i=0,o=0;i<t.length;i++){let n=e(t[i]);n!=null&&(t[o++]=n)}return o<i&&(t.length=o),$(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}b.prototype.W=Ri,b.prototype.toString=function(){return Ku(this,this.s,!1).toString()};var Fl=Symbol();function Ea(e){let t=e[Fl];if(!t){let r=Qu(e),i=Aa(e),o=i.g;t=o?(n,s)=>o(n,s,i):(n,s)=>{for(;Iu(s)&&s.h!=4;){var a=s.m,c=i[a];if(!c){var l=i.ha;l&&(l=l[a])&&(c=i[a]=v1(l))}c&&c(s,n,a)||(a=(c=s).l,Po(c),c.ga?c=void 0:(l=c.g.g-a,c.g.g=a,c=Ru(c.g,l)),a=n,c&&(zt||=Symbol(),(l=a[zt])?l.push(c):a[zt]=[c]))}r===Yu||r===Zu||r.Oa||(n[ki||=Symbol()]=r)},e[Fl]=t}return t}function v1(e){let t=(e=Ju(e))[0].g;if(e=e[1]){let r=Ea(e),i=Aa(e).S;return(o,n,s)=>t(o,n,s,i,r)}return t}var Yu,Zu,Io=Symbol();function b1(e,t,r){let i=r[1],o;if(i){let n=i[Io];o=n?n.S:Ho(i[0]),e[t]=n??i}o&&o===ya?(e.na||(e.na=[])).push(t):r[0]&&(e.oa||(e.oa=[])).push(t)}function Bl(e,t){return[e.l,!t||0<t[0]?void 0:t]}function Qu(e){var t=e[Io];if(t)return t;if(!(t=_a(e,e[Io]={},Bl,Bl,b1)).oa&&!t.na){let r=!0;for(let i in t){isNaN(i)||(r=!1);break}r?(t=Ho(e[0])===ya,t=e[Io]=t?Zu||={S:Ho(!0)}:Yu||={}):t.Oa=!0}return t}function w1(e,t,r){e[t]=r}function _a(e,t,r,i,o=w1){t.S=Ho(e[0]);let n=0;var s=e[++n];s&&s.constructor===Object&&(t.ha=s,typeof(s=e[++n])=="function"&&(t.g=s,t.h=e[++n],s=e[++n]));let a={};for(;Array.isArray(s)&&typeof s[0]=="number"&&0<s[0];){for(var c=0;c<s.length;c++)a[s[c]]=s;s=e[++n]}for(c=1;s!==void 0;){let d;typeof s=="number"&&(c+=s,s=e[++n]);var l=void 0;if(s instanceof Wt?d=s:(d=P1,n--),d.qa){s=e[++n],l=e;var u=n;typeof s=="function"&&(s=s(),l[u]=s),l=s}for(u=c+1,typeof(s=e[++n])=="number"&&0>s&&(u-=s,s=e[++n]);c<u;c++){let f=a[c];o(t,c,l?i(d,l,f):r(d,f))}}return t}var Ml=Symbol();function ed(e){let t=e[Ml];if(!t){let r=rn(e);t=(i,o)=>td(i,o,r),e[Ml]=t}return t}var Oo=Symbol();function S1(e){return e.h}function k1(e,t){let r,i,o=e.h;return(n,s,a)=>o(n,s,a,i||=rn(t).S,r||=ed(t))}function rn(e){let t=e[Oo];return t||(t=_a(e,e[Oo]={},S1,k1),Do in e&&Oo in e&&(e.length=0),t)}var Do=Symbol();function E1(e,t){let r=e.g;return t?(i,o,n)=>r(i,o,n,t):r}function _1(e,t,r){let i=e.g,o,n;return(s,a,c)=>i(s,a,c,n||=Aa(t).S,o||=Ea(t),r)}function Aa(e){let t=e[Do];return t||(Qu(e),t=_a(e,e[Do]={},E1,_1),Do in e&&Oo in e&&(e.length=0),t)}function Ul(e,t){var r=e[t];if(r)return r;if((r=e.ha)&&(r=r[t])){var i=(r=Ju(r))[0].h;if(r=r[1]){let o=ed(r),n=rn(r).S;r=(r=e.h)?r(n,o):(s,a,c)=>i(s,a,c,n,o)}else r=i;return e[t]=r}}function td(e,t,r){for(var i=I(e),o=+!!(512&i)-1,n=e.length,s=512&i?1:0,a=n+(256&i?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,u=Ul(r,l);u&&u(t,c,l)}if(256&i){i=e[n-1];for(let c in i)o=+c,Number.isNaN(o)||(n=i[c])!=null&&(a=Ul(r,o))&&a(t,n,o)}if(e=zt?e[zt]:void 0)for(Pr(t,t.g.end()),r=0;r<e.length;r++)Pr(t,ra(e[r])||Xo())}function Ae(e,t){return new Wt(e,t,!1,!1)}function jr(e,t){return new Wt(e,t,!0,!1)}function on(e,t){return new Wt(e,t,!1,!0)}function Te(e,t,r){M(e,I(e),t,r)}var A1=on(function(e,t,r,i,o){return e.h===2&&(e=Ci(e,pr([void 0,void 0],i),o),vt(i=I(t)),(o=bt(t,i,r))instanceof He?(2&o.O)!=0?((o=o.X()).push(e),M(t,i,r,o)):o.Ta(e):Array.isArray(o)?(2&G(o)&&M(t,i,r,o=$u(o)),o.push(e)):M(t,i,r,[e]),!0)},function(e,t,r,i,o){if(t instanceof He)t.forEach((n,s)=>{Ms(e,r,pr([s,n],i),o)});else if(Array.isArray(t))for(let n=0;n<t.length;n++){let s=t[n];Array.isArray(s)&&Ms(e,r,pr(s,i),o)}});function rd(e,t,r){e:if(t!=null){if(en(t)){if(typeof t=="string"){t=ma(t);break e}if(typeof t=="number"){t=fa(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&_l(t),t!=null&&(qe(e,r,0),typeof t=="number"?(e=e.g,dr(t),No(e,F,Q)):(r=_l(t),No(e.g,r.h,r.g))))}function id(e,t,r){(t=Ur(t))!=null&&t!=null&&(qe(e,r,0),Yo(e.g,t))}function od(e,t,r){(t=Lu(t))!=null&&(qe(e,r,0),e.g.g.push(t?1:0))}function nd(e,t,r){(t=Ei(t))!=null&&Zo(e,r,gu(t))}function nn(e,t,r,i,o){Ms(e,r,t instanceof b?t.s:Array.isArray(t)?pr(t,i):void 0,o)}function sd(e,t,r){(t=t==null||typeof t=="string"||qo(t)||t instanceof Vt?t:void 0)!=null&&Zo(e,r,oa(t).buffer)}function ad(e,t,r){return(e.h===5||e.h===2)&&(t=Lr(t,I(t),r,2,!1),e.h==2?Jo(e,Bs,t):t.push(Bs(e.g)),!0)}var ne,It=Ae(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=Fs(i);let o=Fs(i);i=2*(o>>31)+1;let n=o>>>20&2047;return e=4294967296*(1048575&o)+e,Te(t,r,n==2047?e?NaN:1/0*i:n==0?i*Math.pow(2,-1074)*e:i*Math.pow(2,n-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=Kt(t))!=null&&(qe(e,r,1),e=e.g,(r=xu||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),F=r.getUint32(0,!0),Q=r.getUint32(4,!0),Si(e,F),Si(e,Q))}),se=Ae(function(e,t,r){return e.h===5&&(Te(t,r,Bs(e.g)),!0)},function(e,t,r){(t=Kt(t))!=null&&(qe(e,r,5),e=e.g,sa(t),Si(e,F))}),T1=jr(ad,function(e,t,r){if((t=Nr(Kt,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&(qe(i,o,5),i=i.g,sa(n),Si(i,F))}}),Ta=jr(ad,function(e,t,r){if((t=Nr(Kt,t))!=null&&t.length){qe(e,r,2),Pi(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,sa(t[i]),Si(r,F)}}),$t=Ae(function(e,t,r){return e.h===0&&(Te(t,r,la(e.g,aa)),!0)},rd),xs=Ae(function(e,t,r){return e.h===0&&(Te(t,r,(e=la(e.g,aa))===0?void 0:e),!0)},rd),x1=Ae(function(e,t,r){return e.h===0&&(Te(t,r,la(e.g,Ds)),!0)},function(e,t,r){e:if(t!=null){if(en(t)){if(typeof t=="string"){var i=Math.trunc(Number(t));Number.isSafeInteger(i)&&0<=i?t=String(i):((i=t.indexOf("."))!==-1&&(t=t.substring(0,i)),Il(t)||(Ko(t),t=Lo(F,Q)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){dr(o);let n=Lo(F,Q);return o=Number(n),Number.isSafeInteger(o)?o:n}return Il(String(o))?o:(dr(o),Ds(F,Q))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&kl(t),t!=null&&(qe(e,r,0),typeof t=="number"?(e=e.g,dr(t),No(e,F,Q)):(r=kl(t),No(e.g,r.h,r.g))))}),J=Ae(function(e,t,r){return e.h===0&&(Te(t,r,Gt(e.g)),!0)},id),xa=jr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Lr(t,I(t),r,2,!1),e.h==2?Jo(e,Gt,t):t.push(Gt(e.g)),!0)},function(e,t,r){if((t=Nr(Ur,t))!=null&&t.length){r=ha(e,r);for(let i=0;i<t.length;i++)Yo(e.g,t[i]);pa(e,r)}}),Or=Ae(function(e,t,r){return e.h===0&&(Te(t,r,(e=Gt(e.g))===0?void 0:e),!0)},id),ee=Ae(function(e,t,r){return e.h===0&&(Te(t,r,ua(e.g)),!0)},od),bi=Ae(function(e,t,r){return e.h===0&&(Te(t,r,(e=ua(e.g))===!1?void 0:e),!0)},od),ge=jr(function(e,t,r){return e.h===2&&(Di(t,r,y1,e=da(e)),!0)},function(e,t,r){if((t=Nr(Ei,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&Zo(i,o,gu(n))}}),qt=Ae(function(e,t,r){return e.h===2&&(Te(t,r,(e=da(e))===""?void 0:e),!0)},nd),L=Ae(function(e,t,r){return e.h===2&&(Te(t,r,da(e)),!0)},nd),C1=on(function(e,t,r,i,o){return e.h===2&&(Ci(e,ka(t,i,r,!0),o),!0)},nn),P1=on(function(e,t,r,i,o){return e.h===2&&(Ci(e,ka(t,i,r),o),!0)},nn);ne=new Wt(function(e,t,r,i,o){if(e.h!==2)return!1;i=pr(void 0,i);let n=I(t);vt(n);let s=Lr(t,n,r,3);return n=I(t),4&G(s)&&(s=ve(s),$(s,-2079&(1|G(s))),M(t,n,r,s)),s.push(i),Ci(e,i,o),!0},function(e,t,r,i,o){if(Array.isArray(t))for(let n=0;n<t.length;n++)nn(e,t[n],r,i,o)},!0,!0);var N=on(function(e,t,r,i,o,n){if(e.h!==2)return!1;let s=I(t);return vt(s),(n=Sa(t,s,n))&&r!==n&&M(t,s,n),Ci(e,t=ka(t,i,r),o),!0},nn),cd=Ae(function(e,t,r){return e.h===2&&(Te(t,r,Ou(e)),!0)},sd),R1=jr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Lr(t,I(t),r,2,!1),e.h==2?Jo(e,Ht,t):t.push(Ht(e.g)),!0)},function(e,t,r){if((t=Nr(c1,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&(qe(i,o,0),Pi(i.g,n))}}),yt=Ae(function(e,t,r){return e.h===0&&(Te(t,r,Gt(e.g)),!0)},function(e,t,r){(t=Ur(t))!=null&&(t=parseInt(t,10),qe(e,r,0),Yo(e.g,t))}),I1=jr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Lr(t,I(t),r,2,!1),e.h==2?Jo(e,r1,t):t.push(Gt(e.g)),!0)},function(e,t,r){if((t=Nr(Ur,t))!=null&&t.length){r=ha(e,r);for(let i=0;i<t.length;i++)Yo(e.g,t[i]);pa(e,r)}}),zs=class{constructor(t,r){this.h=t,this.g=r,this.l=P,this.m=E,this.defaultValue=void 0}};function it(e,t){return new zs(e,t)}function Jt(e,t){return(r,i)=>{e:{if(Ao.length){let n=Ao.pop();n.o(i),_s(n.g,r,i),r=n}else r=new class{constructor(n,s){if(Sl.length){let a=Sl.pop();_s(a,n,s),n=a}else n=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,_s(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(n,s);this.g=n,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({ga:n=!1}={}){this.ga=n}}(r,i);try{let n=new e,s=n.s;Ea(t)(s,r),ki&&delete s[ki];var o=n;break e}finally{r.g.clear(),r.m=-1,r.h=-1,100>Ao.length&&Ao.push(r)}o=void 0}return o}}function Ca(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 s=this.g;return this.g=[],s}}}};td(this.s,t,rn(e)),Pr(t,t.g.end());let r=new Uint8Array(t.h),i=t.l,o=i.length,n=0;for(let s=0;s<o;s++){let a=i[s];r.set(a,n),n+=a.length}return t.l=[r],r}}var ld=[0,qt,Ae(function(e,t,r){return e.h===2&&(Te(t,r,(e=Ou(e))===Cr()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof b){let i=t.Va;return void(i&&(t=i(t),t!=null&&Zo(e,r,oa(t).buffer)))}if(Array.isArray(t))return}sd(e,t,r)})],O1=[0,L],ud=[0,J,yt,ee,-1,xa,yt,-1],D1=[0,ee,-1],dd=class extends b{constructor(){super()}};dd.A=[6];var hd=[0,ee,L,ee,yt,-1,I1,L,-1,D1,yt],pd=[0,L,-2],Ll=class extends b{constructor(){super()}},fd=[0],md=[0,J,ee,-2],$e=class extends b{constructor(e){super(e,2)}},V={},F1=[-2,V,ee];V[336783863]=[0,L,ee,-1,J,[0,[1,2,3,4,5],N,fd,N,hd,N,pd,N,md,N,ud],O1];var B1=[0,qt,bi],gd=[0,xs,-1,bi,-3,xs,xa,qt,Or,xs,-1,bi,Or,bi,-2,qt],Fi=[-1,{}],yd=[0,L,1,Fi],vd=[0,L,ge,Fi];function Xe(e,t){t=Oi(t),e=e.s;let r=I(e);vt(r),M(e,r,2,t===""?void 0:t)}function U(e,t){Di(e.s,3,Ii,t)}function D(e,t){Di(e.s,4,Ii,t)}var be=class extends b{constructor(e){super(e,500)}o(e){return E(this,0,7,e)}};be.A=[3,4,5,6,8,13,17,1005];var M1=[-500,qt,-1,ge,-3,F1,ne,ld,Or,-1,yd,vd,ne,B1,qt,gd,Or,ge,987,ge],U1=[0,qt,-1,Fi],L1=[-500,L,-1,[-1,{}],998,L],N1=[-500,L,ge,-1,[-2,{},ee],997,ge,-1],j1=[-500,L,ge,Fi,998,ge];function Ke(e,t){Vs(e,be,t)}function z(e,t){Di(e.s,10,Ii,t)}function j(e,t){Di(e.s,15,Ii,t)}var xe=class extends b{constructor(e){super(e,500)}o(e){return E(this,0,1001,e)}};xe.A=[1,6,7,9,10,15,16,17,14,1002];var bd=[-500,ne,M1,4,ne,L1,ne,N1,Or,ne,j1,ge,Or,yd,vd,ne,U1,ge,-2,gd,qt,-1,bi,979,Fi,ne,ld],V1=Jt(xe,bd);xe.prototype.g=Ca(bd);var z1=[0,ne,[0,J,-2]],G1=class extends b{constructor(e){super(e)}},H1=[0,J,se,L,-1],Pa=class extends b{constructor(e){super(e)}g(){return Ot(this,G1,1)}};Pa.A=[1];var wd=[0,ne,H1],Ra=Jt(Pa,wd),W1=[0,J,se],$1=[0,J,-1,z1],q1=class extends b{constructor(e){super(e)}},X1=[0,J,-3],K1=[0,se,-3],J1=class extends b{constructor(e){super(e)}},Y1=[0,se,-1,L,se],Fo=class extends b{constructor(e){super(e)}h(){return P(this,q1,2)}g(){return Ot(this,J1,5)}};Fo.A=[5];var Z1=[0,yt,X1,K1,$1,ne,Y1],Sd=class extends b{constructor(e){super(e)}};Sd.A=[1,2,3,8,9];var kd=Jt(Sd,[0,ge,xa,Ta,Z1,L,-1,$t,ne,W1,ge,$t]),Ed=class extends b{constructor(e){super(e)}},Q1=[0,se,-4],_d=class extends b{constructor(e){super(e)}};_d.A=[1];var Ia=Jt(_d,[0,ne,Q1]),Ad=class extends b{constructor(e){super(e)}},e2=[0,se,-4],Td=class extends b{constructor(e){super(e)}};Td.A=[1];var sn=Jt(Td,[0,ne,e2]),xd=class extends b{constructor(e){super(e)}};xd.A=[3];var t2=[0,J,-1,Ta,yt],Cd=class extends b{constructor(){super()}};Cd.prototype.g=Ca([0,se,-4,$t]);var r2=class extends b{constructor(e){super(e)}},i2=[0,1,J,L,wd],Pd=class extends b{constructor(e){super(e)}};Pd.A=[1];var o2=Jt(Pd,[0,ne,i2,$t]),Gs=class extends b{constructor(e){super(e)}};Gs.A=[1];var n2=class extends b{constructor(e){super(e)}ua(){let e=Gu(this);return e??Cr()}},s2=class extends b{constructor(e){super(e)}},Rd=[1,2],a2=[0,Rd,N,[0,Ta],N,[0,cd],J,L],Id=class extends b{constructor(e){super(e)}};Id.A=[1];var c2=Jt(Id,[0,ne,a2,$t]),an=class extends b{constructor(e){super(e)}};an.A=[4,5];var Od=[0,L,J,se,ge,-1],Nl=class extends b{constructor(e){super(e)}},l2=[0,ee,-1],jl=class extends b{constructor(e){super(e)}},Bo=[1,2,3,4,5],$o=class extends b{constructor(e){super(e)}g(){return Gu(this)!=null}h(){return We(this,2)!=null}},Dd=[0,cd,L,[0,J,$t,-1],[0,x1,$t]],K=class extends b{constructor(e){super(e)}g(){return Lu(Ir(this,2))??!1}},ae=[0,Dd,ee,[0,Bo,N,md,N,hd,N,ud,N,fd,N,pd],yt],Oa=class extends b{constructor(e){super(e)}},Fd=[0,ae,se,-1,J],u2=it(502141897,Oa);V[502141897]=Fd;var Bd=[0,Dd];V[512499200]=Bd;var Md=[0,Bd];V[515723506]=Md;var d2=Jt(class extends b{constructor(e){super(e)}},[0,[0,yt,-1,T1,R1],t2]),Ud=[0,ae];V[508981768]=Ud;var h2=class extends b{constructor(e){super(e)}},Ld=[0,ae,se,Ud,ee],Nd=class extends b{constructor(e){super(e)}},jd=[0,ae,Fd,Ld,se,Md];V[508968149]=Ld;var p2=it(508968150,Nd);V[508968150]=jd;var Vd=class extends b{constructor(e){super(e)}},f2=it(513916220,Vd);V[513916220]=[0,ae,jd,J];var _r=class extends b{constructor(e){super(e)}h(){return P(this,an,2)}g(){B(this,2)}},zd=[0,ae,Od];V[478825465]=zd;var Gd=[0,ae];V[478825422]=Gd;var m2=class extends b{constructor(e){super(e)}},Hd=[0,ae,Gd,zd,-1],Wd=class extends b{constructor(e){super(e)}},$d=[0,ae,se,J],qd=class extends b{constructor(e){super(e)}},Xd=[0,ae,se],Da=class extends b{constructor(e){super(e)}},Kd=[0,ae,$d,Xd,se],Jd=class extends b{constructor(e){super(e)}},g2=[0,ae,Kd,Hd];V[463370452]=Hd,V[464864288]=$d,V[474472470]=Xd;var y2=it(462713202,Da);V[462713202]=Kd;var v2=it(479097054,Jd);V[479097054]=g2;var Yd=class extends b{constructor(e){super(e)}},b2=it(456383383,Yd);V[456383383]=[0,ae,Od];var Zd=class extends b{constructor(e){super(e)}},w2=it(476348187,Zd);V[476348187]=[0,ae,l2];var Qd=class extends b{constructor(e){super(e)}},eh=[0,yt,-1],Hs=class extends b{constructor(e){super(e)}};Hs.A=[3];var S2=it(458105876,class extends b{constructor(e){super(e)}g(){var e=this.s;let t=I(e);var r=2&t;return e=function(i,o,n){var s=Hs;let a=2&o,c=!1;if(n==null){if(a)return Dl();n=[]}else if(n.constructor===He){if((2&n.O)==0||a)return n;n=n.X()}else Array.isArray(n)?c=!!(2&G(n)):n=[];if(a){if(!n.length)return Dl();c||(c=!0,Mr(n))}else c&&(c=!1,n=$u(n));return c||(64&G(n)?jo(n,32):32&o&&Qo(n,32)),M(i,o,2,s=new He(n,s,l1,void 0),!1),s}(e,t,bt(e,t,2)),e==null||!r&&Hs&&(e.xa=!0),r=e}});V[458105876]=[0,eh,A1,[!0,$t,[0,L,-1,ge]]];var Fa=class extends b{constructor(e){super(e)}},th=it(458105758,Fa);V[458105758]=[0,ae,L,eh];var Ba=class extends b{constructor(e){super(e)}};Ba.A=[5,6];var k2=it(443442058,Ba);V[443442058]=[0,ae,L,J,se,ge,-1];var E2=class extends b{constructor(e){super(e)}},rh=[0,ae,se,-1,J];V[514774813]=rh;var _2=class extends b{constructor(e){super(e)}},ih=[0,ae,se,ee],oh=class extends b{constructor(e){super(e)}},A2=[0,ae,rh,ih,se];V[518928384]=ih;var T2=it(516587230,oh);function Ws(e,t){return t=t?t.clone():new an,e.displayNamesLocale!==void 0?B(t,1,Oi(e.displayNamesLocale)):e.displayNamesLocale===void 0&&B(t,1),e.maxResults!==void 0?gt(t,2,e.maxResults):"maxResults"in e&&B(t,2),e.scoreThreshold!==void 0?A(t,3,e.scoreThreshold):"scoreThreshold"in e&&B(t,3),e.categoryAllowlist!==void 0?Wo(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&B(t,4),e.categoryDenylist!==void 0?Wo(t,5,e.categoryDenylist):"categoryDenylist"in e&&B(t,5),t}function nh(e,t=-1,r=""){return{categories:e.map(i=>({index:mt(Ge(i,1))??-1,score:ue(i,2)??0,categoryName:We(i,3)??""??"",displayName:We(i,4)??""??""})),headIndex:t,headName:r}}function sh(e){var t=Ar(e,3,Kt),r=Ar(e,2,Ur),i=Ar(e,1,Ei),o=Ar(e,9,Ei);let n={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)n.categories.push({score:t[s],index:r[s]??-1,categoryName:i[s]??"",displayName:o[s]??""});if((t=P(e,Fo,4)?.h())&&(n.boundingBox={originX:Ge(t,1)??0,originY:Ge(t,2)??0,width:Ge(t,3)??0,height:Ge(t,4)??0,angle:0}),P(e,Fo,4)?.g().length)for(let s of P(e,Fo,4).g())n.keypoints.push({x:Ro(s,1)??0,y:Ro(s,2)??0,score:Ro(s,4)??0,label:We(s,3)??""});return n}function Ma(e){let t=[];for(let r of Ot(e,Ad,1))t.push({x:ue(r,1)??0,y:ue(r,2)??0,z:ue(r,3)??0});return t}function ah(e){let t=[];for(let r of Ot(e,Ed,1))t.push({x:ue(r,1)??0,y:ue(r,2)??0,z:ue(r,3)??0});return t}function Vl(e){return Array.from(e,t=>127<t?t-256:t)}function zl(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,i=0,o=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n],i+=e[n]*e[n],o+=t[n]*t[n];if(0>=i||0>=o)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*o)}var xo;V[516587230]=A2;var x2=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 ch(){if(xo===void 0)try{await WebAssembly.instantiate(x2),xo=!0}catch{xo=!1}return xo}async function Cs(e,t=""){let r=await ch()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Tr=class{};function lh(){let e=navigator.userAgent;return e.includes("Safari")&&!e.includes("Chrome")}async function Gl(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{i(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function w(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 Hl(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`.");return 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),t.videoWidth?(r=t.videoWidth,t=t.videoHeight):t.naturalWidth?(r=t.naturalWidth,t=t.naturalHeight):(r=t.width,t=t.height),!e.l||r===e.i.canvas.width&&t===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=t),[r,t]}function Wl(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let i=new Uint32Array(t.length);for(let o=0;o<t.length;o++)i[o]=e.i.stringToNewUTF8(t[o]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(let o of i)e.i._free(o);e.i._free(t)}function Ct(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function lr(e,t,r){let i=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(o,n,s)=>{n?(r(i,s),i=[]):i.push(o)}}Tr.forVisionTasks=function(e){return Cs("vision",e)},Tr.forTextTasks=function(e){return Cs("text",e)},Tr.forAudioTasks=function(e){return Cs("audio",e)},Tr.isSimdSupported=function(){return ch()};async function C2(e,t,r,i){return e=await(async(o,n,s,a,c)=>{if(n&&await Gl(n),!self.ModuleFactory||s&&(await Gl(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((n=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(n.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(i),e}function $l(e,t){let r=P(e.baseOptions,$o,1)||new $o;typeof t=="string"?(B(r,2,Oi(t)),B(r,1)):t instanceof Uint8Array&&(B(r,1,Mu(t,!1,!1)),B(r,2)),E(e.baseOptions,0,1,r)}function ql(e){try{let t=e.F.length;if(t===1)throw Error(e.F[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.F.map(r=>r.message).join(", "))}finally{e.F=[]}}function S(e,t){e.I=Math.max(e.I,t)}function Ua(e,t){e.C=new be,Xe(e.C,"PassThroughCalculator"),U(e.C,"free_memory"),D(e.C,"free_memory_unused_out"),z(t,"free_memory"),Ke(t,e.C)}function Ai(e,t){U(e.C,t),D(e.C,t+"_unused_out")}function La(e){e.g.addBoolToStream(!0,"free_memory",e.I)}var $s=class{constructor(e){this.g=e,this.F=[],this.I=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(!(P(this.baseOptions,$o,1)?.g()||P(this.baseOptions,$o,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(i,o){let n=P(i.baseOptions,jl,3);if(!n){var s=n=new jl,a=new Ll;vi(s,4,Bo,a)}"delegate"in o&&(o.delegate==="GPU"?(o=n,s=new dd,vi(o,2,Bo,s)):(o=n,s=new Ll,vi(o,4,Bo,s))),E(i.baseOptions,0,3,n)}(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(i=>{if(i.ok)return i.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${i.status})`)}).then(i=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(i),!0,!1,!1),$l(this,"/model.dat"),this.m(),this.N()});$l(this,r.modelAssetBuffer)}return this.m(),this.N(),Promise.resolve()}N(){}da(){let e;if(this.g.da(t=>{e=V1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.F.push(Error(i))}),this.g.Ra(),this.g.setGraph(e,t),this.C=void 0,ql(this)}finishProcessing(){this.g.finishProcessing(),ql(this)}close(){this.C=void 0,this.g.closeGraph()}};function ye(e,t){if(e===null)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}$s.prototype.close=$s.prototype.close;var qs=class{constructor(t,r,i,o){this.g=t,this.h=r,this.m=i,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 Xl(e,t,r){let i=e.g;if(r=ye(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function Kl(e,t){let r=e.g,i=ye(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);let o=ye(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.N),r.vertexAttribPointer(e.N,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 n=ye(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.M),r.vertexAttribPointer(e.M,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 qs(r,i,o,n)}function Na(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Bi(e,t,r,i){return Na(e,t),e.h||(e.m(),e.F()),r?(e.u||(e.u=Kl(e,!0)),r=e.u):(e.v||(e.v=Kl(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Xt(e,t,r){return Na(e,t),e=ye(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 cn(e,t,r){Na(e,t),e.C||(e.C=ye(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.C),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function ja(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Vr=class{I(){return`
1
+ "use strict";(()=>{var Jf=Object.create;var _l=Object.defineProperty;var Yf=Object.getOwnPropertyDescriptor;var Zf=Object.getOwnPropertyNames;var Qf=Object.getPrototypeOf,e1=Object.prototype.hasOwnProperty;var t1=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var r1=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zf(t))!e1.call(e,o)&&o!==r&&_l(e,o,{get:()=>t[o],enumerable:!(i=Yf(t,o))||i.enumerable});return e};var i1=(e,t,r)=>(r=e!=null?Jf(Qf(e)):{},r1(t||!e||!e.__esModule?_l(r,"default",{value:e,enumerable:!0}):r,e));var Tp=t1((gc,yc)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof gc<"u"?t():(t(),e.FileSaver={})})(gc,function(){"use strict";function e(a,c){return typeof c>"u"?c={autoBom:!1}:typeof c!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),c={autoBom:!c}),c.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function t(a,c,l){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){s(d.response,c,l)},d.onerror=function(){console.error("could not download file")},d.send()}function r(a){var c=new XMLHttpRequest;c.open("HEAD",a,!1);try{c.send()}catch{}return 200<=c.status&&299>=c.status}function i(a){try{a.dispatchEvent(new MouseEvent("click"))}catch{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(c)}}var o=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,n=o.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=o.saveAs||(typeof window!="object"||window!==o?function(){}:"download"in HTMLAnchorElement.prototype&&!n?function(a,c,l){var d=o.URL||o.webkitURL,u=document.createElement("a");c=c||a.name||"download",u.download=c,u.rel="noopener",typeof a=="string"?(u.href=a,u.origin===location.origin?i(u):r(u.href)?t(a,c,l):i(u,u.target="_blank")):(u.href=d.createObjectURL(a),setTimeout(function(){d.revokeObjectURL(u.href)},4e4),setTimeout(function(){i(u)},0))}:"msSaveOrOpenBlob"in navigator?function(a,c,l){if(c=c||a.name||"download",typeof a!="string")navigator.msSaveOrOpenBlob(e(a,l),c);else if(r(a))t(a,c,l);else{var d=document.createElement("a");d.href=a,d.target="_blank",setTimeout(function(){i(d)})}}:function(a,c,l,d){if(d=d||open("","_blank"),d&&(d.document.title=d.document.body.innerText="downloading..."),typeof a=="string")return t(a,c,l);var u=a.type==="application/octet-stream",m=/constructor/i.test(o.HTMLElement)||o.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent);if((f||u&&m||n)&&typeof FileReader<"u"){var h=new FileReader;h.onloadend=function(){var v=h.result;v=f?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=v:location=v,d=null},h.readAsDataURL(a)}else{var g=o.URL||o.webkitURL,y=g.createObjectURL(a);d?d.location=y:location.href=y,d=null,setTimeout(function(){g.revokeObjectURL(y)},4e4)}});o.saveAs=s.saveAs=s,typeof yc<"u"&&(yc.exports=s)})});async function Ro(){try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function Do(){return new Promise((e,t)=>{let r=window.screen.isExtended;if(r)e(r);else if(navigator.userAgent.indexOf("Firefox")>-1)e(!1);else{let o=[];window.getScreenDetails().then(function(n){o=n,e(o.screens.length>=2)})}})}async function it(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(o=>!e.some(n=>o.deviceId.includes(n)||o.label.includes(n)));return{cameras:r.filter(o=>o.kind=="videoinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId})),microphones:r.filter(o=>o.kind=="audioinput"&&o.deviceId).map(o=>({label:o.label||"Generic Device",id:o.deviceId}))}}var da=typeof self<"u"?self:{};function xd(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=da,o=0;o<r.length;o++)if((i=i[r[o]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function dr(){throw Error("Invalid UTF8")}function xl(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Oo,Ds,o1=typeof TextDecoder<"u",n1,s1=typeof TextEncoder<"u";function Cd(e){if(s1)e=(n1||=new TextEncoder).encode(e);else{let r=0,i=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)i[r++]=t;else{if(2048>t)i[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let n=e.charCodeAt(++o);if(56320<=n&&57343>=n){t=1024*(t-55296)+n-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}o--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var Ai,Td=xd(610401301,!1),ua=xd(572417392,!0),Cl=da.navigator;function Vs(e){return!!Td&&!!Ai&&Ai.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function ze(e){var t;return(t=da.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function Gt(){return!!Td&&!!Ai&&0<Ai.brands.length}function Os(){return Gt()?Vs("Chromium"):(ze("Chrome")||ze("CriOS"))&&!(!Gt()&&ze("Edge"))||ze("Silk")}Ai=Cl&&Cl.userAgentData||null;var a1=!Gt()&&(ze("Trident")||ze("MSIE"));!ze("Android")||Os(),Os(),ze("Safari")&&(Os()||!Gt()&&ze("Coast")||!Gt()&&ze("Opera")||!Gt()&&ze("Edge")||(Gt()?Vs("Microsoft Edge"):ze("Edg/"))||Gt()&&Vs("Opera"));var Pd={},yi=null;function c1(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 i=new Uint8Array(r),o=0;return function(n,s){function a(f){for(;c<n.length;){var h=n.charAt(c++),g=yi[h];if(g!=null)return g;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return f}Id();for(var c=0;;){var l=a(-1),d=a(0),u=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|d>>4),u!=64&&(s(d<<4&240|u>>2),m!=64&&s(u<<6&192|m))}}(e,function(n){i[o++]=n}),o!==r?i.subarray(0,o):i}function Id(){if(!yi){yi={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var i=e.concat(t[r].split(""));Pd[r]=i;for(var o=0;o<i.length;o++){var n=i[o];yi[n]===void 0&&(yi[n]=o)}}}}var Rd=typeof Uint8Array<"u",Dd=!a1&&typeof btoa=="function";function Tl(e){if(!Dd){var t;t===void 0&&(t=0),Id(),t=Pd[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],n=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|n>>4],n=t[(15&n)<<2|s>>6],s=t[63&s],r[l++]=a+o+n+s}switch(a=0,s=i,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||i;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var Pl=/[-_.]/g,l1={"-":"+",_:"/",".":"="};function d1(e){return l1[e]||""}function Od(e){if(!Dd)return c1(e);Pl.test(e)&&(e=e.replace(Pl,d1)),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 rn(e){return Rd&&e!=null&&e instanceof Uint8Array}var u1;function on(){return u1||=new Uint8Array(0)}var Dr={},h1;function Fd(e){if(e!==Dr)throw Error("illegal external caller")}function Or(){return h1||=new Ht(null,Dr)}function ha(e){Fd(Dr);var t=e.Z;return(t=t==null||rn(t)?t:typeof t=="string"?Od(t):null)==null?t:e.Z=t}var Ht=class{constructor(e,t){if(Fd(t),this.Z=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}wa(){let e=ha(this);return e?new Uint8Array(e):on()}};function Bd(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function pa(){return Error("Failed to read varint, encoding is invalid.")}function Md(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Ud(e){return e.length==0?Or():new Ht(e,Dr)}function ma(e){if(typeof e=="string")return{buffer:Od(e),L:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),L:!1};if(e.constructor===Uint8Array)return{buffer:e,L:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),L:!1};if(e.constructor===Ht)return{buffer:ha(e)||on(),L:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),L:!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 fa(){return typeof BigInt=="function"}var zs=!ua,Il=!ua,p1=typeof Uint8Array.prototype.slice=="function",Ld,M=0,ee=0;function pr(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[i,o]=va(r,e);e=o,r=i}M=r>>>0,ee=e>>>0}function ga(e){let t=Ld||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),ee=0,M=t.getUint32(0,!0)}function Gs(e,t){return 4294967296*t+(e>>>0)}function ya(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=Gs(e,t),r?-e:e}function $o(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else fa()?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+Rl(r)+Rl(e));return r}function Rl(e){return e=String(e),"0000000".slice(e.length)+e}function Nd(){var e=M,t=ee;if(2147483648&t)if(fa())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,i]=va(e,t);e="-"+$o(r,i)}else e=$o(e,t);return e}function nn(e){if(16>e.length)pr(Number(e));else if(fa())e=BigInt(e),M=Number(e&BigInt(4294967295))>>>0,ee=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");ee=M=0;let r=e.length;for(let i=t,o=(r-t)%6+t;o<=r;i=o,o+=6){let n=Number(e.slice(i,o));ee*=1e6,M=1e6*M+n,4294967296<=M&&(ee+=Math.trunc(M/4294967296),ee>>>=0,M>>>=0)}if(t){let[i,o]=va(M,ee);M=i,ee=o}}}function va(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function ba(e,t){let r,i=0,o=0,n=0,s=e.h,a=e.g;do r=s[a++],i|=(127&r)<<n,n+=7;while(32>n&&128&r);for(32<n&&(o|=(127&r)>>4),n=3;32>n&&128&r;n+=7)r=s[a++],o|=(127&r)<<n;if(mr(e,a),128>r)return t(i>>>0,o>>>0);throw pa()}function wa(e){let t=0,r=e.g,i=r+10,o=e.h;for(;r<i;){let n=o[r++];if(t|=n,(128&n)==0)return mr(e,r),!!(127&t)}throw pa()}function qt(e){let t=e.h,r=e.g,i=t[r++],o=127&i;if(128&i&&(i=t[r++],o|=(127&i)<<7,128&i&&(i=t[r++],o|=(127&i)<<14,128&i&&(i=t[r++],o|=(127&i)<<21,128&i&&(i=t[r++],o|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw pa();return mr(e,r),o}function $t(e){return qt(e)>>>0}function Hs(e){var t=e.h;let r=e.g,i=t[r],o=t[r+1],n=t[r+2];return t=t[r+3],mr(e,e.g+4),(i<<0|o<<8|n<<16|t<<24)>>>0}function Ws(e){var t=Hs(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 m1(e){return qt(e)}function Fs(e,t,{aa:r=!1}={}){e.aa=r,t&&(t=ma(t),e.h=t.buffer,e.m=t.L,e.j=0,e.l=e.h.length,e.g=e.j)}function mr(e,t){if(e.g=t,t>e.l)throw Md(e.l,t)}function jd(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,i=r+t;if(i>e.l)throw Md(t,e.l-r);return e.g=i,r}function Vd(e,t){if(t==0)return Or();var r=jd(e,t);return e.aa&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?on():p1?e.slice(r,t):new Uint8Array(e.subarray(r,t))),Ud(r)}var Dl=[];function zd(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=$t(e.g);if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw Bd(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 Lo(e){switch(e.h){case 0:e.h!=0?Lo(e):wa(e.g);break;case 1:mr(e=e.g,e.g+8);break;case 2:if(e.h!=2)Lo(e);else{var t=$t(e.g);mr(e=e.g,e.g+t)}break;case 5:mr(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!zd(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Lo(e)}break;default:throw Bd(e.h,e.l)}}function Di(e,t,r){let i=e.g.l,o=$t(e.g),n=e.g.g+o,s=n-i;if(0>=s&&(e.g.l=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=n,e.g.l=i,t}function Sa(e){var t=$t(e.g),r=jd(e=e.g,t);if(e=e.h,o1){var i,o=e;(i=Ds)||(i=Ds=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var n=i.decode(o)}catch(a){if(Oo===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),Oo=!0}catch{Oo=!1}}throw!Oo&&(Ds=void 0),a}}else{t=(n=r)+t,r=[];let a,c=null;for(;n<t;){var s=e[n++];128>s?r.push(s):224>s?n>=t?dr():(a=e[n++],194>s||(192&a)!=128?(n--,dr()):r.push((31&s)<<6|63&a)):240>s?n>=t-1?dr():(a=e[n++],(192&a)!=128||s===224&&160>a||s===237&&160<=a||(192&(i=e[n++]))!=128?(n--,dr()):r.push((15&s)<<12|(63&a)<<6|63&i)):244>=s?n>=t-2?dr():(a=e[n++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(i=e[n++]))!=128||(192&(o=e[n++]))!=128?(n--,dr()):(s=(7&s)<<18|(63&a)<<12|(63&i)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):dr(),8192<=r.length&&(c=xl(c,r),r.length=0)}n=xl(c,r)}return n}function Gd(e){let t=$t(e.g);return Vd(e.g,t)}function sn(e,t,r){var i=$t(e.g);for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Fo=[];function Ol(e){return e?/^\d+$/.test(e)?(nn(e),new Fl(M,ee)):null:f1||=new Fl(0,0)}var Fl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},f1;function Bl(e){return e?/^-?\d+$/.test(e)?(nn(e),new Ml(M,ee)):null:g1||=new Ml(0,0)}var Ml=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},g1;function Xo(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 Oi(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function an(e,t){if(0<=t)Oi(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function _i(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 Fr(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function $e(e,t,r){Oi(e.g,8*t+r)}function ka(e,t){return $e(e,t,2),t=e.g.end(),Fr(e,t),t.push(e.h),t}function Ea(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 cn(e,t,r){$e(e,t,2),Oi(e.g,r.length),Fr(e,e.g.end()),Fr(e,r)}function qs(e,t,r,i){r!=null&&(t=ka(e,t),i(r,e),Ea(e,t))}var Xt=class{constructor(t,r,i,o){this.g=t,this.h=r,this.l=i,this.qa=o}};function be(e){return Array.prototype.slice.call(e)}function Hd(e){return typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():e}var ft=Hd(),Ul=Hd("0di"),ln=ft?(e,t)=>{e[ft]|=t}:(e,t)=>{e.D!==void 0?e.D|=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Ll(e){let t=W(e);(1&t)!=1&&(Object.isFrozen(e)&&(e=be(e)),X(e,1|t))}var Ko=ft?(e,t)=>{e[ft]&=~t}:(e,t)=>{e.D!==void 0&&(e.D&=~t)};function ue(e,t,r){return r?e|t:e&~t}var W=ft?e=>0|e[ft]:e=>0|e.D,R=ft?e=>e[ft]:e=>e.D,X=ft?(e,t)=>{e[ft]=t}:(e,t)=>{e.D!==void 0?e.D=t:Object.defineProperties(e,{D:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Nl(){var e=[];return ln(e,1),e}function Vr(e){return ln(e,34),e}function y1(e,t){X(t,-14591&(0|e))}function $s(e,t){X(t,-14557&(34|e))}function Jo(e){return(e=e>>14&1023)===0?536870912:e}var Fi={},Wd={};function jl(e){return!(!e||typeof e!="object"||e.Na!==Wd)}function bi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}var qd=!ua;function $d(e,t,r){if(e!=null){if(typeof e=="string")e=e?new Ht(e,Dr):Or();else if(e.constructor!==Ht)if(rn(e))e=r?Ud(e):e.length?new Ht(new Uint8Array(e),Dr):Or();else{if(!t)throw Error();e=void 0}}return e}function Xs(e,t,r){if(!Array.isArray(e)||e.length)return!1;let i=W(e);return!!(1&i)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&(X(e,1|i),!0)}var hr,Vl=[];function bt(e){if(2&e)throw Error()}X(Vl,55),hr=Object.freeze(Vl);var Br=class{constructor(t,r,i){this.l=0,this.g=t,this.h=r,this.m=i}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 Br(this.g,this.h,this.m)}},v1={},Wt,xi;function Xd(e,t){(t=Wt?t[Wt]:void 0)&&(e[Wt]=be(t))}function Ks(e){return(e=Error(e)).__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity="warning",e}function Zt(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Kd(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}Object.freeze(new class{}),Object.freeze(new class{});var b1=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function dn(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&b1.test(e)}function zr(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 zl(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Jd(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 Aa(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(pr(e),e=ya(M,ee)),e}function _a(e){var t=Math.trunc(Number(e));return Number.isSafeInteger(t)?String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Jd(e)||(nn(e),e=Nd()),e)}function Yo(e){return e==null?e:dn(e)?typeof e=="number"?Aa(e):_a(e):void 0}function Bi(e){if(typeof e!="string")throw Error();return e}function Mi(e){if(e!=null&&typeof e!="string")throw Error();return e}function Ci(e){return e==null||typeof e=="string"?e:void 0}function xa(e,t,r,i){if(e!=null&&typeof e=="object"&&e.W===Fi)return e;if(!Array.isArray(e))return r?2&i?(e=t[Ul])?t=e:(Vr((e=new t).s),t=t[Ul]=e):t=new t:t=void 0,t;let o=r=W(e);return o===0&&(o|=32&i),o|=2&i,o!==r&&X(e,o),new t(e)}function S1(e,t,r){if(t){var i=!!i;if(!dn(t=e))throw Ks("int64");typeof t=="string"?i=_a(t):i?(i=Math.trunc(t),Number.isSafeInteger(i)?i=String(i):Jd(t=String(i))?i=t:(pr(i),i=Nd())):i=Aa(t)}else i=Yo(e);return typeof(r=(e=i)==null?r?0:void 0:e)=="string"&&(i=+r,Number.isSafeInteger(i))?i:r}var Zo,Ca,k1;function Qo(e){switch(typeof e){case"boolean":return Ca||=[0,void 0,!0];case"number":return 0<e?void 0:e===0?k1||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function fr(e,t){return Yd(e,t[0],t[1])}function Yd(e,t,r){if(e==null&&(e=Zo),Zo=void 0,e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error();if(64&(i=W(e)))return xi&&delete e[xi],e;if(i|=64,r&&(i|=512,r!==e[0]))throw Error();e:{let o=(r=e).length;if(o){let n=o-1;if(bi(r[n])){if(1024<=(t=n-(+!!(512&(i|=256))-1)))throw Error();i=-16760833&i|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&i)-1))))throw Error();i=-16760833&i|(1023&t)<<14}}}return X(e,i),e}var E1=function(){try{return new class extends Map{constructor(){super()}},!1}catch{return!0}}(),wi=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()}},A1=E1?(Object.setPrototypeOf(wi.prototype,Map.prototype),Object.defineProperties(wi.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),wi):class extends Map{constructor(){super()}};function Bo(e){return e}function Bs(e){if(2&e.O)throw Error("Cannot mutate an immutable Map")}var He=class extends A1{constructor(e,t,r=Bo,i=Bo){super();let o=W(e);o|=64,X(e,o),this.O=o,this.V=t,this.R=r||Bo,this.Y=this.V?_1:i||Bo;for(let n=0;n<e.length;n++){let s=e[n],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=i(s[1],!1,!0,void 0,void 0,o),super.set(a,c)}}pa(e=Gl){return this.X(e)}X(e=Gl){let t=[],r=super.entries();for(var i;!(i=r.next()).done;)(i=i.value)[0]=e(i[0]),i[1]=e(i[1]),t.push(i);return t}clear(){Bs(this),super.clear()}delete(e){return Bs(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new Br(e,x1,this)}keys(){return this.Ma()}values(){var e=this.ma();return new Br(e,He.prototype.get,this)}forEach(e,t){super.forEach((r,i)=>{e.call(t,this.get(i),i,this)})}set(e,t){return Bs(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.V,!1,this.O))}Ta(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.V?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.O),super.set(t,e)}has(e){return super.has(this.R(e,!1,!1))}get(e){e=this.R(e,!1,!1);let t=super.get(e);if(t!==void 0){var r=this.V;return r?((r=this.Y(t,!1,!0,r,this.xa,this.O))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ma(){return super.keys()}[Symbol.iterator](){return this.entries()}};function _1(e,t,r,i,o,n){return e=xa(e,i,r,n),o&&(e=un(e)),e}function Gl(e){return e}function x1(e){return[e,this.get(e)]}function Ta(e,t,r,i,o,n){if(e!=null){if(Array.isArray(e))e=o&&e.length==0&&1&W(e)?void 0:n&&2&W(e)?e:Pa(e,t,r,i!==void 0,o,n);else if(bi(e)){let s={};for(let a in e)s[a]=Ta(e[a],t,r,i,o,n);e=s}else e=t(e,i);return e}}function Pa(e,t,r,i,o,n){let s=i||r?W(e):0;i=i?!!(32&s):void 0;let a=be(e);for(let c=0;c<a.length;c++)a[c]=Ta(a[c],t,r,i,o,n);return r&&(Xd(a,e),r(s,a)),a}function C1(e){return Ta(e,Zd,void 0,void 0,!1,!1)}function Zd(e){return e.W===Fi?e.toJSON():e instanceof He?e.pa(C1):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))return qd||!Xs(t,void 0,9999)?t:void 0;if(rn(t))return Tl(t);if(t instanceof Ht){let r=t.Z;return r==null?"":typeof r=="string"?r:t.Z=Tl(r)}if(t instanceof He)return t=t.pa(),zs||t.length!==0?t:void 0}}return t}(e)}function Js(e,t,r=$s){if(e!=null){if(Rd&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=W(e);return 2&i?e:(t&&=i===0||!!(32&i)&&!(64&i||!(16&i)),t?(X(e,-12293&(34|i)),e):Pa(e,Js,4&i?$s:r,!0,!1,!0))}return e.W===Fi?(r=e.s,e=2&(i=R(r))?e:Ia(e,r,i,!0)):e instanceof He&&(r=Vr(e.X(Js)),e=new He(r,e.V,e.R,e.Y)),e}}function Ia(e,t,r,i){return e=e.constructor,Zo=t=Qd(t,r,i),t=new e(t),Zo=void 0,t}function Qd(e,t,r){let i=r||2&t?$s:y1,o=!!(32&t);return e=function(n,s,a){let c=be(n);var l=c.length;let d=256&s?c[l-1]:void 0;for(l+=d?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(d){s=c[s]={};for(let u in d)s[u]=a(d[u])}return Xd(c,n),c}(e,t,n=>Js(n,o,i)),ln(e,32|(r?2:0)),e}function un(e){let t=e.s,r=R(t);return 2&r?Ia(e,t,r,!1):e}function Mr(e,t){return wt(e=e.s,R(e),t)}function wt(e,t,r,i){if(r===-1)return null;if(r>=Jo(t)){if(256&t)return e[e.length-1][r]}else{var o=e.length;if(i&&256&t&&(i=e[o-1][r])!=null)return i;if((t=r+(+!!(512&t)-1))<o)return e[t]}}function U(e,t,r,i){let o=e.s,n=R(o);return bt(n),L(o,n,t,r,i),e}function L(e,t,r,i,o){var n=Jo(t);if(r>=n||o){if(o=t,256&t)n=e[e.length-1];else{if(i==null)return o;n=e[n+(+!!(512&t)-1)]={},o|=256}return n[r]=i,o!==t&&X(e,o),o}return e[r+(+!!(512&t)-1)]=i,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function Gr(e,t,r,i,o){var n=2&t;let s=wt(e,t,r,o);Array.isArray(s)||(s=hr);let a=!(2&i);i=!(1&i);let c=!!(32&t),l=W(s);return l!==0||!c||n||a?1&l||(l|=1,X(s,l)):(l|=33,X(s,l)),n?(e=!1,2&l||(Vr(s),e=!!(4&l)),(i||e)&&Object.freeze(s)):(n=!!(2&l)||!!(2048&l),i&&n?(s=be(s),i=1,c&&!a&&(i|=32),X(s,i),L(e,t,r,s,o)):a&&32&l&&!n&&Ko(s,32)),s}function No(e,t){e=e.s;let r=R(e),i=wt(e,r,t),o=Zt(i);return o!=null&&o!==i&&L(e,r,t,o),o}function eu(e){e=e.s;let t=R(e),r=wt(e,t,1),i=$d(r,!0,!!(34&t));return i!=null&&i!==r&&L(e,t,1,i),i}function Ir(e,t,r){e=e.s;let i=R(e),o=2&i?1:2,n=tu(e,i,t);var s=W(n);if(!(4&s)){(4&s||Object.isFrozen(n))&&(n=be(n),s=gr(s,i,!1),i=L(e,i,t,n));var a=0;let c=0;for(;a<n.length;a++){let l=r(n[a]);l!=null&&(n[c++]=l)}c<a&&(n.length=c),s=ue(s=ru(s,i,!1),20,!0),s=ue(s,4096,!1),s=ue(s,8192,!1),X(n,s),2&s&&Object.freeze(n)}return Si(s)||(r=s,(s=(a=o===1)?ue(s,2,!0):ue(s,32,!1))!==r&&X(n,s),a&&Object.freeze(n)),o===2&&Si(s)&&(n=be(n),s=gr(s,i,!1),X(n,s),L(e,i,t,n)),n}function tu(e,t,r){return e=wt(e,t,r),Array.isArray(e)?e:hr}function ru(e,t,r){return e===0&&(e=gr(e,t,r)),ue(e,1,!0)}function Si(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}var T1;function Hl(){return T1??=new He(Vr([]),void 0,void 0,void 0,v1)}function iu(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]=Vr(r[1]))}return e}function en(e,t,r){{let s=e.s,a=R(s);if(bt(a),r==null)L(s,a,t);else{var i,o=e=W(r),n=!!(2&e)||Object.isFrozen(r);if((i=!n)&&(i=!1),!(4&e))for(e=21,n&&(r=be(r),o=0,e=gr(e,a,!0)),n=0;n<r.length;n++)r[n]=Bi(r[n]);i&&(r=be(r),o=0,e=gr(e,a,!0)),e!==o&&X(r,e),L(s,a,t,r)}}}function Ui(e,t,r,i){let o=R(e);bt(o),e=Gr(e,o,t,2),i=r(i,!!(4&(t=W(e)))&&!!(4096&t)),e.push(i)}function P1(e){return e}function Ms(e,t){return Ra(e=e.s,R(e),Vu)===t?t:-1}function Ra(e,t,r){let i=0;for(let o=0;o<r.length;o++){let n=r[o];wt(e,t,n)!=null&&(i!==0&&(t=L(e,t,i)),i=n)}return i}function Da(e,t,r,i){let o=R(e);bt(o);let n=wt(e,o,r,i),s;if(n!=null&&n.W===Fi)return(t=un(n))!==n&&L(e,o,r,t,i),t.s;if(Array.isArray(n)){let a=W(n);s=2&a?Qd(n,a,!1):n,s=fr(s,t)}else s=fr(void 0,t);return s!==n&&L(e,o,r,s,i),s}function ou(e,t,r,i){e=e.s;let o=R(e),n=wt(e,o,r,i);return(t=xa(n,t,!1,o))!==n&&t!=null&&L(e,o,r,t,i),t}function P(e,t,r,i=!1){if((t=ou(e,t,r,i))==null)return t;e=e.s;let o=R(e);if(!(2&o)){let n=un(t);n!==t&&L(e,o,r,t=n,i)}return t}function nu(e,t,r,i,o,n){var s=!!(2&t),a=s?1:2;let c=a===1;a=a===2,o=!!o,n&&=!s,s=tu(e,t,i);var l=W(s);let d=!!(4&l);if(!d){var u=s,m=t;let f=!!(2&(l=ru(l,t,o)));f&&(m=ue(m,2,!0));let h=!f,g=!0,y=0,v=0;for(;y<u.length;y++){let S=xa(u[y],r,!1,m);if(S instanceof r){if(!f){let x=!!(2&W(S.s));h&&=!x,g&&=x}u[v++]=S}}v<y&&(u.length=v),l=ue(l,4,!0),l=ue(l,16,g),l=ue(l,8,h),X(u,l),f&&Object.freeze(u)}if(r=!!(8&l)||c&&!s.length,n&&!r){for(Si(l)&&(s=be(s),l=gr(l,t,o),t=L(e,t,i,s)),n=s,r=l,u=0;u<n.length;u++)(l=n[u])!==(m=un(l))&&(n[u]=m);r=ue(r,8,!0),r=ue(r,16,!n.length),X(n,r),l=r}return Si(l)||(n=l,c?l=ue(l,!s.length||16&l&&(!d||32&l)?2:2048,!0):o||(l=ue(l,32,!1)),l!==n&&X(s,l),c&&Object.freeze(s)),a&&Si(l)&&(s=be(s),l=gr(l,t,o),X(s,l),L(e,t,i,s)),s}function Bt(e,t,r){e=e.s;let i=R(e);return nu(e,i,t,r,!1,!(2&i))}function A(e,t,r,i,o){return i==null&&(i=void 0),U(e,r,i,o)}function ki(e,t,r,i){i==null&&(i=void 0),e=e.s;let o=R(e);bt(o),(r=Ra(e,o,r))&&r!==t&&i!=null&&(o=L(e,o,r)),L(e,o,t,i)}function gr(e,t,r){return e=ue(e,2,!!(2&t)),e=ue(e,32,!!(32&t)&&r),ue(e,2048,!1)}function Ys(e,t,r){e=e.s;let i=R(e);bt(i),e=nu(e,i,t,1,!0),t=r??new t,e.push(t),2&W(t.s)?Ko(e,8):Ko(e,16)}function Ge(e,t){return zr(Mr(e,t))}function We(e,t){return Ci(Mr(e,t))}function gt(e){return e??0}function he(e,t){return gt(No(e,t))}function Ti(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}`);U(e,t,r)}function yt(e,t,r){if(r!=null){if(typeof r!="number"||!Number.isFinite(r))throw Ks("int32");r|=0}U(e,t,r)}function _(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);U(e,t,r)}function ot(e,t,r){t.g?t.m(e,t.g,t.h,r,!0):t.m(e,t.h,r,!0)}He.prototype.toJSON=void 0,He.prototype.Na=Wd;var b=class{constructor(e,t){this.s=Yd(e,t)}toJSON(){return su(this,Pa(this.s,Zd,void 0,void 0,!1,!1),!0)}l(){var e=O2;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 Ia(this,e,R(e),!1)}L(){return!!(2&W(this.s))}};function su(e,t,r){let i=e.constructor.A;var o=R(r?e.s:t),n=Jo(o),s=!1;if(i&&qd){if(!r){var a;if((t=be(t)).length&&bi(a=t[t.length-1])){for(s=0;s<i.length;s++)if(i[s]>=n){Object.assign(t[t.length-1]={},a);break}}s=!0}var c;n=t,r=!r,e=Jo(a=R(e.s)),a=+!!(512&a)-1;for(let y=0;y<i.length;y++){var l=i[y];if(l<e){var d=n[l+=a];d==null?n[l]=r?hr:Nl():r&&d!==hr&&Ll(d)}else{if(!c){var u=void 0;n.length&&bi(u=n[n.length-1])?c=u:n.push(c={})}d=c[l],c[l]==null?c[l]=r?hr:Nl():r&&d!==hr&&Ll(d)}}}if(!(c=t.length))return t;let m,f;if(bi(u=t[c-1])){e:{var h=u;for(var g in n={},r=!1,h)e=h[g],Array.isArray(e)&&(a=e,(!Il&&Xs(e,i,+g)||!zs&&jl(e)&&e.size===0)&&(e=null),e!=a&&(r=!0)),e!=null?n[g]=e:r=!0;if(r){for(let y in n){h=n;break e}h=null}}h!=u&&(m=!0),c--}for(o=+!!(512&o)-1;0<c&&((u=t[g=c-1])==null||!Il&&Xs(u,i,g-o)||!zs&&jl(u)&&u.size===0);c--)f=!0;return(m||f)&&(t=s?t:Array.prototype.slice.call(t,0,c),s&&(t.length=c),h&&t.push(h)),t}function au(e){return Array.isArray(e)?e[0]instanceof Xt?e:[j1,e]:[e,void 0]}function Hr(e,t){if(Array.isArray(t)){var r=W(t);if(4&r)return t;for(var i=0,o=0;i<t.length;i++){let n=e(t[i]);n!=null&&(t[o++]=n)}return o<i&&(t.length=o),X(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}b.prototype.W=Fi,b.prototype.toString=function(){return su(this,this.s,!1).toString()};var Wl=Symbol();function Oa(e){let t=e[Wl];if(!t){let r=du(e),i=Ba(e),o=i.g;t=o?(n,s)=>o(n,s,i):(n,s)=>{for(;zd(s)&&s.h!=4;){var a=s.m,c=i[a];if(!c){var l=i.ha;l&&(l=l[a])&&(c=i[a]=I1(l))}c&&c(s,n,a)||(a=(c=s).l,Lo(c),c.ga?c=void 0:(l=c.g.g-a,c.g.g=a,c=Vd(c.g,l)),a=n,c&&(Wt||=Symbol(),(l=a[Wt])?l.push(c):a[Wt]=[c]))}r===cu||r===lu||r.Oa||(n[xi||=Symbol()]=r)},e[Wl]=t}return t}function I1(e){let t=(e=au(e))[0].g;if(e=e[1]){let r=Oa(e),i=Ba(e).S;return(o,n,s)=>t(o,n,s,i,r)}return t}var cu,lu,jo=Symbol();function R1(e,t,r){let i=r[1],o;if(i){let n=i[jo];o=n?n.S:Qo(i[0]),e[t]=n??i}o&&o===Ca?(e.na||(e.na=[])).push(t):r[0]&&(e.oa||(e.oa=[])).push(t)}function ql(e,t){return[e.l,!t||0<t[0]?void 0:t]}function du(e){var t=e[jo];if(t)return t;if(!(t=Fa(e,e[jo]={},ql,ql,R1)).oa&&!t.na){let r=!0;for(let i in t){isNaN(i)||(r=!1);break}r?(t=Qo(e[0])===Ca,t=e[jo]=t?lu||={S:Qo(!0)}:cu||={}):t.Oa=!0}return t}function D1(e,t,r){e[t]=r}function Fa(e,t,r,i,o=D1){t.S=Qo(e[0]);let n=0;var s=e[++n];s&&s.constructor===Object&&(t.ha=s,typeof(s=e[++n])=="function"&&(t.g=s,t.h=e[++n],s=e[++n]));let a={};for(;Array.isArray(s)&&typeof s[0]=="number"&&0<s[0];){for(var c=0;c<s.length;c++)a[s[c]]=s;s=e[++n]}for(c=1;s!==void 0;){let u;typeof s=="number"&&(c+=s,s=e[++n]);var l=void 0;if(s instanceof Xt?u=s:(u=V1,n--),u.qa){s=e[++n],l=e;var d=n;typeof s=="function"&&(s=s(),l[d]=s),l=s}for(d=c+1,typeof(s=e[++n])=="number"&&0>s&&(d-=s,s=e[++n]);c<d;c++){let m=a[c];o(t,c,l?i(u,l,m):r(u,m))}}return t}var $l=Symbol();function uu(e){let t=e[$l];if(!t){let r=hn(e);t=(i,o)=>hu(i,o,r),e[$l]=t}return t}var Vo=Symbol();function O1(e){return e.h}function F1(e,t){let r,i,o=e.h;return(n,s,a)=>o(n,s,a,i||=hn(t).S,r||=uu(t))}function hn(e){let t=e[Vo];return t||(t=Fa(e,e[Vo]={},O1,F1),zo in e&&Vo in e&&(e.length=0),t)}var zo=Symbol();function B1(e,t){let r=e.g;return t?(i,o,n)=>r(i,o,n,t):r}function M1(e,t,r){let i=e.g,o,n;return(s,a,c)=>i(s,a,c,n||=Ba(t).S,o||=Oa(t),r)}function Ba(e){let t=e[zo];return t||(du(e),t=Fa(e,e[zo]={},B1,M1),zo in e&&Vo in e&&(e.length=0),t)}function Xl(e,t){var r=e[t];if(r)return r;if((r=e.ha)&&(r=r[t])){var i=(r=au(r))[0].h;if(r=r[1]){let o=uu(r),n=hn(r).S;r=(r=e.h)?r(n,o):(s,a,c)=>i(s,a,c,n,o)}else r=i;return e[t]=r}}function hu(e,t,r){for(var i=R(e),o=+!!(512&i)-1,n=e.length,s=512&i?1:0,a=n+(256&i?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,d=Xl(r,l);d&&d(t,c,l)}if(256&i){i=e[n-1];for(let c in i)o=+c,Number.isNaN(o)||(n=i[c])!=null&&(a=Xl(r,o))&&a(t,n,o)}if(e=Wt?e[Wt]:void 0)for(Fr(t,t.g.end()),r=0;r<e.length;r++)Fr(t,ha(e[r])||on())}function xe(e,t){return new Xt(e,t,!1,!1)}function Wr(e,t){return new Xt(e,t,!0,!1)}function pn(e,t){return new Xt(e,t,!1,!0)}function Ce(e,t,r){L(e,R(e),t,r)}var U1=pn(function(e,t,r,i,o){return e.h===2&&(e=Di(e,fr([void 0,void 0],i),o),bt(i=R(t)),(o=wt(t,i,r))instanceof He?(2&o.O)!=0?((o=o.X()).push(e),L(t,i,r,o)):o.Ta(e):Array.isArray(o)?(2&W(o)&&L(t,i,r,o=iu(o)),o.push(e)):L(t,i,r,[e]),!0)},function(e,t,r,i,o){if(t instanceof He)t.forEach((n,s)=>{qs(e,r,fr([s,n],i),o)});else if(Array.isArray(t))for(let n=0;n<t.length;n++){let s=t[n];Array.isArray(s)&&qs(e,r,fr(s,i),o)}});function pu(e,t,r){e:if(t!=null){if(dn(t)){if(typeof t=="string"){t=_a(t);break e}if(typeof t=="number"){t=Aa(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&Bl(t),t!=null&&($e(e,r,0),typeof t=="number"?(e=e.g,pr(t),Xo(e,M,ee)):(r=Bl(t),Xo(e.g,r.h,r.g))))}function mu(e,t,r){(t=zr(t))!=null&&t!=null&&($e(e,r,0),an(e.g,t))}function fu(e,t,r){(t=Kd(t))!=null&&($e(e,r,0),e.g.g.push(t?1:0))}function gu(e,t,r){(t=Ci(t))!=null&&cn(e,r,Cd(t))}function mn(e,t,r,i,o){qs(e,r,t instanceof b?t.s:Array.isArray(t)?fr(t,i):void 0,o)}function yu(e,t,r){(t=t==null||typeof t=="string"||rn(t)||t instanceof Ht?t:void 0)!=null&&cn(e,r,ma(t).buffer)}function vu(e,t,r){return(e.h===5||e.h===2)&&(t=Gr(t,R(t),r,2,!1),e.h==2?sn(e,Ws,t):t.push(Ws(e.g)),!0)}var ae,Ft=xe(function(e,t,r){if(e.h!==1)return!1;var i=e.g;e=Hs(i);let o=Hs(i);i=2*(o>>31)+1;let n=o>>>20&2047;return e=4294967296*(1048575&o)+e,Ce(t,r,n==2047?e?NaN:1/0*i:n==0?i*Math.pow(2,-1074)*e:i*Math.pow(2,n-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=Zt(t))!=null&&($e(e,r,1),e=e.g,(r=Ld||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),M=r.getUint32(0,!0),ee=r.getUint32(4,!0),_i(e,M),_i(e,ee))}),ce=xe(function(e,t,r){return e.h===5&&(Ce(t,r,Ws(e.g)),!0)},function(e,t,r){(t=Zt(t))!=null&&($e(e,r,5),e=e.g,ga(t),_i(e,M))}),L1=Wr(vu,function(e,t,r){if((t=Hr(Zt,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&($e(i,o,5),i=i.g,ga(n),_i(i,M))}}),Ma=Wr(vu,function(e,t,r){if((t=Hr(Zt,t))!=null&&t.length){$e(e,r,2),Oi(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,ga(t[i]),_i(r,M)}}),Kt=xe(function(e,t,r){return e.h===0&&(Ce(t,r,ba(e.g,ya)),!0)},pu),Us=xe(function(e,t,r){return e.h===0&&(Ce(t,r,(e=ba(e.g,ya))===0?void 0:e),!0)},pu),N1=xe(function(e,t,r){return e.h===0&&(Ce(t,r,ba(e.g,Gs)),!0)},function(e,t,r){e:if(t!=null){if(dn(t)){if(typeof t=="string"){var i=Math.trunc(Number(t));Number.isSafeInteger(i)&&0<=i?t=String(i):((i=t.indexOf("."))!==-1&&(t=t.substring(0,i)),zl(t)||(nn(t),t=$o(M,ee)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){pr(o);let n=$o(M,ee);return o=Number(n),Number.isSafeInteger(o)?o:n}return zl(String(o))?o:(pr(o),Gs(M,ee))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&Ol(t),t!=null&&($e(e,r,0),typeof t=="number"?(e=e.g,pr(t),Xo(e,M,ee)):(r=Ol(t),Xo(e.g,r.h,r.g))))}),Y=xe(function(e,t,r){return e.h===0&&(Ce(t,r,qt(e.g)),!0)},mu),Ua=Wr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Gr(t,R(t),r,2,!1),e.h==2?sn(e,qt,t):t.push(qt(e.g)),!0)},function(e,t,r){if((t=Hr(zr,t))!=null&&t.length){r=ka(e,r);for(let i=0;i<t.length;i++)an(e.g,t[i]);Ea(e,r)}}),Ur=xe(function(e,t,r){return e.h===0&&(Ce(t,r,(e=qt(e.g))===0?void 0:e),!0)},mu),te=xe(function(e,t,r){return e.h===0&&(Ce(t,r,wa(e.g)),!0)},fu),Ei=xe(function(e,t,r){return e.h===0&&(Ce(t,r,(e=wa(e.g))===!1?void 0:e),!0)},fu),ye=Wr(function(e,t,r){return e.h===2&&(Ui(t,r,P1,e=Sa(e)),!0)},function(e,t,r){if((t=Hr(Ci,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&cn(i,o,Cd(n))}}),Jt=xe(function(e,t,r){return e.h===2&&(Ce(t,r,(e=Sa(e))===""?void 0:e),!0)},gu),j=xe(function(e,t,r){return e.h===2&&(Ce(t,r,Sa(e)),!0)},gu),j1=pn(function(e,t,r,i,o){return e.h===2&&(Di(e,Da(t,i,r,!0),o),!0)},mn),V1=pn(function(e,t,r,i,o){return e.h===2&&(Di(e,Da(t,i,r),o),!0)},mn);ae=new Xt(function(e,t,r,i,o){if(e.h!==2)return!1;i=fr(void 0,i);let n=R(t);bt(n);let s=Gr(t,n,r,3);return n=R(t),4&W(s)&&(s=be(s),X(s,-2079&(1|W(s))),L(t,n,r,s)),s.push(i),Di(e,i,o),!0},function(e,t,r,i,o){if(Array.isArray(t))for(let n=0;n<t.length;n++)mn(e,t[n],r,i,o)},!0,!0);var V=pn(function(e,t,r,i,o,n){if(e.h!==2)return!1;let s=R(t);return bt(s),(n=Ra(t,s,n))&&r!==n&&L(t,s,n),Di(e,t=Da(t,i,r),o),!0},mn),bu=xe(function(e,t,r){return e.h===2&&(Ce(t,r,Gd(e)),!0)},yu),z1=Wr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Gr(t,R(t),r,2,!1),e.h==2?sn(e,$t,t):t.push($t(e.g)),!0)},function(e,t,r){if((t=Hr(w1,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&($e(i,o,0),Oi(i.g,n))}}),vt=xe(function(e,t,r){return e.h===0&&(Ce(t,r,qt(e.g)),!0)},function(e,t,r){(t=zr(t))!=null&&(t=parseInt(t,10),$e(e,r,0),an(e.g,t))}),G1=Wr(function(e,t,r){return(e.h===0||e.h===2)&&(t=Gr(t,R(t),r,2,!1),e.h==2?sn(e,m1,t):t.push(qt(e.g)),!0)},function(e,t,r){if((t=Hr(zr,t))!=null&&t.length){r=ka(e,r);for(let i=0;i<t.length;i++)an(e.g,t[i]);Ea(e,r)}}),Zs=class{constructor(t,r){this.h=t,this.g=r,this.l=P,this.m=A,this.defaultValue=void 0}};function nt(e,t){return new Zs(e,t)}function Qt(e,t){return(r,i)=>{e:{if(Fo.length){let n=Fo.pop();n.o(i),Fs(n.g,r,i),r=n}else r=new class{constructor(n,s){if(Dl.length){let a=Dl.pop();Fs(a,n,s),n=a}else n=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,Fs(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.aa=!1}}(n,s);this.g=n,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({ga:n=!1}={}){this.ga=n}}(r,i);try{let n=new e,s=n.s;Oa(t)(s,r),xi&&delete s[xi];var o=n;break e}finally{r.g.clear(),r.m=-1,r.h=-1,100>Fo.length&&Fo.push(r)}o=void 0}return o}}function La(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 s=this.g;return this.g=[],s}}}};hu(this.s,t,hn(e)),Fr(t,t.g.end());let r=new Uint8Array(t.h),i=t.l,o=i.length,n=0;for(let s=0;s<o;s++){let a=i[s];r.set(a,n),n+=a.length}return t.l=[r],r}}var wu=[0,Jt,xe(function(e,t,r){return e.h===2&&(Ce(t,r,(e=Gd(e))===Or()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof b){let i=t.Va;return void(i&&(t=i(t),t!=null&&cn(e,r,ma(t).buffer)))}if(Array.isArray(t))return}yu(e,t,r)})],H1=[0,j],Su=[0,Y,vt,te,-1,Ua,vt,-1],W1=[0,te,-1],ku=class extends b{constructor(){super()}};ku.A=[6];var Eu=[0,te,j,te,vt,-1,G1,j,-1,W1,vt],Au=[0,j,-2],Kl=class extends b{constructor(){super()}},_u=[0],xu=[0,Y,te,-2],qe=class extends b{constructor(e){super(e,2)}},G={},q1=[-2,G,te];G[336783863]=[0,j,te,-1,Y,[0,[1,2,3,4,5],V,_u,V,Eu,V,Au,V,xu,V,Su],H1];var $1=[0,Jt,Ei],Cu=[0,Us,-1,Ei,-3,Us,Ua,Jt,Ur,Us,-1,Ei,Ur,Ei,-2,Jt],Li=[-1,{}],Tu=[0,j,1,Li],Pu=[0,j,ye,Li];function Xe(e,t){t=Mi(t),e=e.s;let r=R(e);bt(r),L(e,r,2,t===""?void 0:t)}function N(e,t){Ui(e.s,3,Bi,t)}function B(e,t){Ui(e.s,4,Bi,t)}var we=class extends b{constructor(e){super(e,500)}o(e){return A(this,0,7,e)}};we.A=[3,4,5,6,8,13,17,1005];var X1=[-500,Jt,-1,ye,-3,q1,ae,wu,Ur,-1,Tu,Pu,ae,$1,Jt,Cu,Ur,ye,987,ye],K1=[0,Jt,-1,Li],J1=[-500,j,-1,[-1,{}],998,j],Y1=[-500,j,ye,-1,[-2,{},te],997,ye,-1],Z1=[-500,j,ye,Li,998,ye];function Ke(e,t){Ys(e,we,t)}function H(e,t){Ui(e.s,10,Bi,t)}function z(e,t){Ui(e.s,15,Bi,t)}var Te=class extends b{constructor(e){super(e,500)}o(e){return A(this,0,1001,e)}};Te.A=[1,6,7,9,10,15,16,17,14,1002];var Iu=[-500,ae,X1,4,ae,J1,ae,Y1,Ur,ae,Z1,ye,Ur,Tu,Pu,ae,K1,ye,-2,Cu,Jt,-1,Ei,979,Li,ae,wu],Q1=Qt(Te,Iu);Te.prototype.g=La(Iu);var e2=[0,ae,[0,Y,-2]],t2=class extends b{constructor(e){super(e)}},r2=[0,Y,ce,j,-1],Na=class extends b{constructor(e){super(e)}g(){return Bt(this,t2,1)}};Na.A=[1];var Ru=[0,ae,r2],ja=Qt(Na,Ru),i2=[0,Y,ce],o2=[0,Y,-1,e2],n2=class extends b{constructor(e){super(e)}},s2=[0,Y,-3],a2=[0,ce,-3],c2=class extends b{constructor(e){super(e)}},l2=[0,ce,-1,j,ce],Go=class extends b{constructor(e){super(e)}h(){return P(this,n2,2)}g(){return Bt(this,c2,5)}};Go.A=[5];var d2=[0,vt,s2,a2,o2,ae,l2],Du=class extends b{constructor(e){super(e)}};Du.A=[1,2,3,8,9];var Ou=Qt(Du,[0,ye,Ua,Ma,d2,j,-1,Kt,ae,i2,ye,Kt]),Fu=class extends b{constructor(e){super(e)}},u2=[0,ce,-4],Bu=class extends b{constructor(e){super(e)}};Bu.A=[1];var Va=Qt(Bu,[0,ae,u2]),Mu=class extends b{constructor(e){super(e)}},h2=[0,ce,-4],Uu=class extends b{constructor(e){super(e)}};Uu.A=[1];var fn=Qt(Uu,[0,ae,h2]),Lu=class extends b{constructor(e){super(e)}};Lu.A=[3];var p2=[0,Y,-1,Ma,vt],Nu=class extends b{constructor(){super()}};Nu.prototype.g=La([0,ce,-4,Kt]);var m2=class extends b{constructor(e){super(e)}},f2=[0,1,Y,j,Ru],ju=class extends b{constructor(e){super(e)}};ju.A=[1];var g2=Qt(ju,[0,ae,f2,Kt]),Qs=class extends b{constructor(e){super(e)}};Qs.A=[1];var y2=class extends b{constructor(e){super(e)}ua(){let e=eu(this);return e??Or()}},v2=class extends b{constructor(e){super(e)}},Vu=[1,2],b2=[0,Vu,V,[0,Ma],V,[0,bu],Y,j],zu=class extends b{constructor(e){super(e)}};zu.A=[1];var w2=Qt(zu,[0,ae,b2,Kt]),gn=class extends b{constructor(e){super(e)}};gn.A=[4,5];var Gu=[0,j,Y,ce,ye,-1],Jl=class extends b{constructor(e){super(e)}},S2=[0,te,-1],Yl=class extends b{constructor(e){super(e)}},Ho=[1,2,3,4,5],tn=class extends b{constructor(e){super(e)}g(){return eu(this)!=null}h(){return We(this,2)!=null}},Hu=[0,bu,j,[0,Y,Kt,-1],[0,N1,Kt]],J=class extends b{constructor(e){super(e)}g(){return Kd(Mr(this,2))??!1}},le=[0,Hu,te,[0,Ho,V,xu,V,Eu,V,Su,V,_u,V,Au],vt],za=class extends b{constructor(e){super(e)}},Wu=[0,le,ce,-1,Y],k2=nt(502141897,za);G[502141897]=Wu;var qu=[0,Hu];G[512499200]=qu;var $u=[0,qu];G[515723506]=$u;var E2=Qt(class extends b{constructor(e){super(e)}},[0,[0,vt,-1,L1,z1],p2]),Xu=[0,le];G[508981768]=Xu;var A2=class extends b{constructor(e){super(e)}},Ku=[0,le,ce,Xu,te],Ju=class extends b{constructor(e){super(e)}},Yu=[0,le,Wu,Ku,ce,$u];G[508968149]=Ku;var _2=nt(508968150,Ju);G[508968150]=Yu;var Zu=class extends b{constructor(e){super(e)}},x2=nt(513916220,Zu);G[513916220]=[0,le,Yu,Y];var Pr=class extends b{constructor(e){super(e)}h(){return P(this,gn,2)}g(){U(this,2)}},Qu=[0,le,Gu];G[478825465]=Qu;var eh=[0,le];G[478825422]=eh;var C2=class extends b{constructor(e){super(e)}},th=[0,le,eh,Qu,-1],rh=class extends b{constructor(e){super(e)}},ih=[0,le,ce,Y],oh=class extends b{constructor(e){super(e)}},nh=[0,le,ce],Ga=class extends b{constructor(e){super(e)}},sh=[0,le,ih,nh,ce],ah=class extends b{constructor(e){super(e)}},T2=[0,le,sh,th];G[463370452]=th,G[464864288]=ih,G[474472470]=nh;var P2=nt(462713202,Ga);G[462713202]=sh;var I2=nt(479097054,ah);G[479097054]=T2;var ch=class extends b{constructor(e){super(e)}},R2=nt(456383383,ch);G[456383383]=[0,le,Gu];var lh=class extends b{constructor(e){super(e)}},D2=nt(476348187,lh);G[476348187]=[0,le,S2];var dh=class extends b{constructor(e){super(e)}},uh=[0,vt,-1],ea=class extends b{constructor(e){super(e)}};ea.A=[3];var O2=nt(458105876,class extends b{constructor(e){super(e)}g(){var e=this.s;let t=R(e);var r=2&t;return e=function(i,o,n){var s=ea;let a=2&o,c=!1;if(n==null){if(a)return Hl();n=[]}else if(n.constructor===He){if((2&n.O)==0||a)return n;n=n.X()}else Array.isArray(n)?c=!!(2&W(n)):n=[];if(a){if(!n.length)return Hl();c||(c=!0,Vr(n))}else c&&(c=!1,n=iu(n));return c||(64&W(n)?Ko(n,32):32&o&&ln(n,32)),L(i,o,2,s=new He(n,s,S1,void 0),!1),s}(e,t,wt(e,t,2)),e==null||!r&&ea&&(e.xa=!0),r=e}});G[458105876]=[0,uh,U1,[!0,Kt,[0,j,-1,ye]]];var Ha=class extends b{constructor(e){super(e)}},hh=nt(458105758,Ha);G[458105758]=[0,le,j,uh];var Wa=class extends b{constructor(e){super(e)}};Wa.A=[5,6];var F2=nt(443442058,Wa);G[443442058]=[0,le,j,Y,ce,ye,-1];var B2=class extends b{constructor(e){super(e)}},ph=[0,le,ce,-1,Y];G[514774813]=ph;var M2=class extends b{constructor(e){super(e)}},mh=[0,le,ce,te],fh=class extends b{constructor(e){super(e)}},U2=[0,le,ph,mh,ce];G[518928384]=mh;var L2=nt(516587230,fh);function ta(e,t){return t=t?t.clone():new gn,e.displayNamesLocale!==void 0?U(t,1,Mi(e.displayNamesLocale)):e.displayNamesLocale===void 0&&U(t,1),e.maxResults!==void 0?yt(t,2,e.maxResults):"maxResults"in e&&U(t,2),e.scoreThreshold!==void 0?_(t,3,e.scoreThreshold):"scoreThreshold"in e&&U(t,3),e.categoryAllowlist!==void 0?en(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&U(t,4),e.categoryDenylist!==void 0?en(t,5,e.categoryDenylist):"categoryDenylist"in e&&U(t,5),t}function gh(e,t=-1,r=""){return{categories:e.map(i=>({index:gt(Ge(i,1))??-1,score:he(i,2)??0,categoryName:We(i,3)??""??"",displayName:We(i,4)??""??""})),headIndex:t,headName:r}}function yh(e){var t=Ir(e,3,Zt),r=Ir(e,2,zr),i=Ir(e,1,Ci),o=Ir(e,9,Ci);let n={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)n.categories.push({score:t[s],index:r[s]??-1,categoryName:i[s]??"",displayName:o[s]??""});if((t=P(e,Go,4)?.h())&&(n.boundingBox={originX:Ge(t,1)??0,originY:Ge(t,2)??0,width:Ge(t,3)??0,height:Ge(t,4)??0,angle:0}),P(e,Go,4)?.g().length)for(let s of P(e,Go,4).g())n.keypoints.push({x:No(s,1)??0,y:No(s,2)??0,score:No(s,4)??0,label:We(s,3)??""});return n}function qa(e){let t=[];for(let r of Bt(e,Mu,1))t.push({x:he(r,1)??0,y:he(r,2)??0,z:he(r,3)??0});return t}function vh(e){let t=[];for(let r of Bt(e,Fu,1))t.push({x:he(r,1)??0,y:he(r,2)??0,z:he(r,3)??0});return t}function Zl(e){return Array.from(e,t=>127<t?t-256:t)}function Ql(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,i=0,o=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n],i+=e[n]*e[n],o+=t[n]*t[n];if(0>=i||0>=o)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(i*o)}var Mo;G[516587230]=U2;var N2=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 bh(){if(Mo===void 0)try{await WebAssembly.instantiate(N2),Mo=!0}catch{Mo=!1}return Mo}async function Ls(e,t=""){let r=await bh()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Rr=class{};function wh(){let e=navigator.userAgent;return e.includes("Safari")&&!e.includes("Chrome")}async function ed(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{i(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function w(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 td(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`.");return 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),t.videoWidth?(r=t.videoWidth,t=t.videoHeight):t.naturalWidth?(r=t.naturalWidth,t=t.naturalHeight):(r=t.width,t=t.height),!e.l||r===e.i.canvas.width&&t===e.i.canvas.height||(e.i.canvas.width=r,e.i.canvas.height=t),[r,t]}function rd(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let i=new Uint32Array(t.length);for(let o=0;o<t.length;o++)i[o]=e.i.stringToNewUTF8(t[o]);t=e.i._malloc(4*i.length),e.i.HEAPU32.set(i,t>>2),r(t);for(let o of i)e.i._free(o);e.i._free(t)}function Rt(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function ur(e,t,r){let i=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(o,n,s)=>{n?(r(i,s),i=[]):i.push(o)}}Rr.forVisionTasks=function(e){return Ls("vision",e)},Rr.forTextTasks=function(e){return Ls("text",e)},Rr.forAudioTasks=function(e){return Ls("audio",e)},Rr.isSimdSupported=function(){return bh()};async function j2(e,t,r,i){return e=await(async(o,n,s,a,c)=>{if(n&&await ed(n),!self.ModuleFactory||s&&(await ed(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((n=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(n.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(i),e}function id(e,t){let r=P(e.baseOptions,tn,1)||new tn;typeof t=="string"?(U(r,2,Mi(t)),U(r,1)):t instanceof Uint8Array&&(U(r,1,$d(t,!1,!1)),U(r,2)),A(e.baseOptions,0,1,r)}function od(e){try{let t=e.F.length;if(t===1)throw Error(e.F[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.F.map(r=>r.message).join(", "))}finally{e.F=[]}}function k(e,t){e.I=Math.max(e.I,t)}function $a(e,t){e.C=new we,Xe(e.C,"PassThroughCalculator"),N(e.C,"free_memory"),B(e.C,"free_memory_unused_out"),H(t,"free_memory"),Ke(t,e.C)}function Pi(e,t){N(e.C,t),B(e.C,t+"_unused_out")}function Xa(e){e.g.addBoolToStream(!0,"free_memory",e.I)}var ra=class{constructor(e){this.g=e,this.F=[],this.I=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(!(P(this.baseOptions,tn,1)?.g()||P(this.baseOptions,tn,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(i,o){let n=P(i.baseOptions,Yl,3);if(!n){var s=n=new Yl,a=new Kl;ki(s,4,Ho,a)}"delegate"in o&&(o.delegate==="GPU"?(o=n,s=new ku,ki(o,2,Ho,s)):(o=n,s=new Kl,ki(o,4,Ho,s))),A(i.baseOptions,0,3,n)}(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(i=>{if(i.ok)return i.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${i.status})`)}).then(i=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(i),!0,!1,!1),id(this,"/model.dat"),this.m(),this.N()});id(this,r.modelAssetBuffer)}return this.m(),this.N(),Promise.resolve()}N(){}da(){let e;if(this.g.da(t=>{e=Q1(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.F.push(Error(i))}),this.g.Ra(),this.g.setGraph(e,t),this.C=void 0,od(this)}finishProcessing(){this.g.finishProcessing(),od(this)}close(){this.C=void 0,this.g.closeGraph()}};function ve(e,t){if(e===null)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}ra.prototype.close=ra.prototype.close;var ia=class{constructor(t,r,i,o){this.g=t,this.h=r,this.m=i,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 nd(e,t,r){let i=e.g;if(r=ve(i.createShader(r),"Failed to create WebGL shader"),i.shaderSource(r,t),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${i.getShaderInfoLog(r)}`);return i.attachShader(e.h,r),r}function sd(e,t){let r=e.g,i=ve(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(i);let o=ve(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.N),r.vertexAttribPointer(e.N,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 n=ve(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,n),r.enableVertexAttribArray(e.M),r.vertexAttribPointer(e.M,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 ia(r,i,o,n)}function Ka(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Ni(e,t,r,i){return Ka(e,t),e.h||(e.m(),e.F()),r?(e.u||(e.u=sd(e,!0)),r=e.u):(e.v||(e.v=sd(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=i(),r.g.bindVertexArray(null),e}function Yt(e,t,r){return Ka(e,t),e=ve(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 yn(e,t,r){Ka(e,t),e.C||(e.C=ve(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.C),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Ja(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var qr=class{I(){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=ye(e.createProgram(),"Failed to create WebGL program"),this.ta=Xl(this,`
8
+ `}m(){let e=this.g;if(this.h=ve(e.createProgram(),"Failed to create WebGL program"),this.ta=nd(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.sa=Xl(this,this.I(),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.N=e.getAttribLocation(this.h,"aVertex"),this.M=e.getAttribLocation(this.h,"aTex")}F(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.ta),e.deleteShader(this.sa)}this.C&&this.g.deleteFramebuffer(this.C),this.v&&this.v.close(),this.u&&this.u.close()}},P2=class extends Vr{I(){return`
15
+ }`,e.VERTEX_SHADER),this.sa=nd(this,this.I(),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.N=e.getAttribLocation(this.h,"aVertex"),this.M=e.getAttribLocation(this.h,"aTex")}F(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.ta),e.deleteShader(this.sa)}this.C&&this.g.deleteFramebuffer(this.C),this.v&&this.v.close(),this.u&&this.u.close()}},V2=class extends qr{I(){return`
16
16
  precision mediump float;
17
17
  uniform sampler2D backgroundTexture;
18
18
  uniform sampler2D maskTexture;
@@ -24,7 +24,7 @@
24
24
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
25
25
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
26
26
  }
27
- `}F(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=Xt(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Xt(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.U=ye(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.ra=ye(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.T=ye(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.T,0),e.uniform1i(this.U,1),e.uniform1i(this.ra,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},R2=class extends Vr{I(){return`
27
+ `}F(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=Yt(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=Yt(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.U=ve(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.ra=ve(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.T=ve(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.T,0),e.uniform1i(this.U,1),e.uniform1i(this.ra,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},z2=class extends qr{I(){return`
28
28
  precision mediump float;
29
29
  uniform sampler2D maskTexture;
30
30
  uniform sampler2D defaultTexture;
@@ -38,7 +38,7 @@
38
38
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
39
39
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
40
40
  }
41
- `}F(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=Xt(this,e),e.activeTexture(e.TEXTURE2),this.B=Xt(this,e)}m(){super.m();let e=this.g;this.T=ye(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.U=ye(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.J=ye(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.T,1),e.uniform1i(this.U,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Rt(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 Xs(e){var t=Rt(e,1);if(!t){if(t=Rt(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);let i=Dr(e);var r=Va(e);if(cn(r,i,uh(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),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,r);for(let o=0,n=0;o<t.length;++o,n+=4)t[o]=r[n]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function uh(e){let t=Rt(e,2);if(!t){let r=Dr(e);t=hh(e);let i=Xs(e),o=dh(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,i),Ks(e)}return t}function Dr(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=ye(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function dh(e){if(e=Dr(e),!Co)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Co=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Co=e.R16F}return Co}function Va(e){return e.l||(e.l=new Vr),e.l}function hh(e){let t=Dr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Rt(e,2);return r||(r=Xt(Va(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Ks(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Co,oe=class{constructor(e,t,r,i,o,n,s){this.g=e,this.m=t,this.j=r,this.canvas=i,this.l=o,this.width=n,this.height=s,this.j&&--Jl===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}La(){return!!Rt(this,0)}ka(){return!!Rt(this,1)}P(){return!!Rt(this,2)}ja(){return(t=Rt(e=this,0))||(t=Xs(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ia(){return Xs(this)}K(){return uh(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 i=Dr(this),o=Va(this);i.activeTexture(i.TEXTURE1),r=Xt(o,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);let n=dh(this);i.texImage2D(i.TEXTURE_2D,0,n,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),cn(o,i,r),Bi(o,i,!1,()=>{hh(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),Ks(this)}),ja(o),Ks(this)}}e.push(r)}return new oe(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Dr(this).deleteTexture(Rt(this,2)),Jl=-1}};oe.prototype.close=oe.prototype.close,oe.prototype.clone=oe.prototype.clone,oe.prototype.getAsWebGLTexture=oe.prototype.K,oe.prototype.getAsFloat32Array=oe.prototype.ia,oe.prototype.getAsUint8Array=oe.prototype.ja,oe.prototype.hasWebGLTexture=oe.prototype.P,oe.prototype.hasFloat32Array=oe.prototype.ka,oe.prototype.hasUint8Array=oe.prototype.La;var Jl=250,I2={color:"white",lineWidth:4,radius:6};function Ps(e){return{...I2,fillColor:(e=e||{}).color,...e}}function Pt(e,t){return e instanceof Function?e(t):e}function Yl(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function hi(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Ti(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Zl(e,t,r){if(t.P())r(t.K());else{let i=t.ka()?t.ia():t.ja();e.m=e.m??new Vr;let o=Ti(e);r((e=new oe([i],t.m,!1,o.canvas,e.m,t.width,t.height)).K()),e.close()}}function Ql(e,t,r,i){let o=function(a){return a.g||(a.g=new P2),a.g}(e),n=Ti(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Bi(o,n,!0,()=>{(function(c,l,u,d){let f=c.g;if(f.activeTexture(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,l),f.activeTexture(f.TEXTURE1),f.bindTexture(f.TEXTURE_2D,c.B),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,u),c.J&&function(m,h){if(m!==h)return!1;m=m.entries(),h=h.entries();for(let[y,_]of m){m=y;let v=_;var g=h.next();if(g.done)return!1;let[T,q]=g.value;if(g=q,m!==T||v[0]!==g[0]||v[1]!==g[1]||v[2]!==g[2]||v[3]!==g[3])return!1}return!!h.next().done}(c.J,d))f.activeTexture(f.TEXTURE2),f.bindTexture(f.TEXTURE_2D,c.j);else{c.J=d;let m=Array(1024).fill(0);d.forEach((h,g)=>{if(h.length!==4)throw Error(`Color at index ${g} is not a four-channel value.`);m[4*g]=h[0],m[4*g+1]=h[1],m[4*g+2]=h[2],m[4*g+3]=h[3]}),f.activeTexture(f.TEXTURE2),f.bindTexture(f.TEXTURE_2D,c.j),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,256,1,0,f.RGBA,f.UNSIGNED_BYTE,new Uint8Array(m))}})(o,t,s,i),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.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 eu(e,t,r,i){let o=Ti(e),n=function(c){return c.h||(c.h=new R2),c.h}(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i;Bi(n,o,!0,()=>{var c=n.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,n.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,n.B),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=n.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 Se=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}Ea(e,t){if(e){var r=hi(this);t=Ps(t),r.save();var i=r.canvas,o=0;for(let n of e)r.fillStyle=Pt(t.fillColor,{index:o,from:n}),r.strokeStyle=Pt(t.color,{index:o,from:n}),r.lineWidth=Pt(t.lineWidth,{index:o,from:n}),(e=new Path2D).arc(n.x*i.width,n.y*i.height,Pt(t.radius,{index:o,from:n}),0,2*Math.PI),r.fill(e),r.stroke(e),++o;r.restore()}}Da(e,t,r){if(e&&t){var i=hi(this);r=Ps(r),i.save();var o=i.canvas,n=0;for(let s of t){i.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(i.strokeStyle=Pt(r.color,{index:n,from:t,to:a}),i.lineWidth=Pt(r.lineWidth,{index:n,from:t,to:a}),i.moveTo(t.x*o.width,t.y*o.height),i.lineTo(a.x*o.width,a.y*o.height)),++n,i.stroke()}i.restore()}}Aa(e,t){let r=hi(this);t=Ps(t),r.save(),r.beginPath(),r.lineWidth=Pt(t.lineWidth,{}),r.strokeStyle=Pt(t.color,{}),r.fillStyle=Pt(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()}Ba(e,t,r=[0,0,0,255]){this.l?function(i,o,n,s){let a=Ti(i);Zl(i,o,c=>{Ql(i,c,n,s),(c=hi(i)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,r,t):Ql(this,e.K(),r,t)}Ca(e,t,r){this.l?function(i,o,n,s){let a=Ti(i);Zl(i,o,c=>{eu(i,c,n,s),(c=hi(i)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,r):eu(this,e.K(),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 pt(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 ph(e){var t=pt(e,0);if(!t){t=Fr(e);let r=ln(e),i=new Uint8Array(e.width*e.height*4);cn(r,t,Mo(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),ja(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function Mo(e){let t=pt(e,2);if(!t){let r=Fr(e);t=Uo(e);let i=pt(e,1)||ph(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),fi(e)}return t}function Fr(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=ye(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 Vr),e.l}function Uo(e){let t=Fr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=pt(e,2);return r||(r=Xt(ln(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function fi(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function tu(e){let t=Fr(e);return Bi(ln(e),t,!0,()=>function(r,i){let o=r.canvas;if(o.width===r.width&&o.height===r.height)return i();let n=o.width,s=o.height;return o.width=r.width,o.height=r.height,r=i(),o.width=n,o.height=s,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}Se.prototype.close=Se.prototype.close,Se.prototype.drawConfidenceMask=Se.prototype.Ca,Se.prototype.drawCategoryMask=Se.prototype.Ba,Se.prototype.drawBoundingBox=Se.prototype.Aa,Se.prototype.drawConnectors=Se.prototype.Da,Se.prototype.drawLandmarks=Se.prototype.Ea,Se.lerp=function(e,t,r,i,o){return Yl(i*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),i,o)},Se.clamp=Yl;var ce=class{constructor(e,t,r,i,o,n,s){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=o,this.width=n,this.height=s,(this.j||this.m)&&--ru===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ka(){return!!pt(this,0)}la(){return!!pt(this,1)}P(){return!!pt(this,2)}Ia(){return ph(this)}Ha(){var e=pt(this,1);return e||(Mo(this),Uo(this),e=tu(this),fi(this),this.g.push(e),this.j=!0),e}K(){return Mo(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 i=Fr(this),o=ln(this);i.activeTexture(i.TEXTURE1),r=Xt(o,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),cn(o,i,r),Bi(o,i,!1,()=>{Uo(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),fi(this)}),ja(o),fi(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Mo(this),Uo(this),r=tu(this),fi(this)}e.push(r)}return new ce(e,this.la(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&pt(this,1).close(),this.m&&Fr(this).deleteTexture(pt(this,2)),ru=-1}};ce.prototype.close=ce.prototype.close,ce.prototype.clone=ce.prototype.clone,ce.prototype.getAsWebGLTexture=ce.prototype.K,ce.prototype.getAsImageBitmap=ce.prototype.Ha,ce.prototype.getAsImageData=ce.prototype.Ia,ce.prototype.hasWebGLTexture=ce.prototype.P,ce.prototype.hasImageBitmap=ce.prototype.la,ce.prototype.hasImageData=ce.prototype.Ka;var ru=250;function ot(...e){return e.map(([t,r])=>({start:t,end:r}))}var O2=function(e){return class extends e{Ra(){this.i._registerModelResourcesGraphService()}}}((iu=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:typeof OffscreenCanvas>"u"||lh()?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1)}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,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,o){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),w(this,i||"input_audio",n=>{w(this,o=o||"audio_header",s=>{this.i._configureAudio(n,s,e,t,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Ct(this,"__graph_config__",t=>{e(t)}),w(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,i,o){let n=4*e.length;this.h!==n&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(n),this.h=n),this.i.HEAPF32.set(e,this.g/4),w(this,i,s=>{this.i._addAudioToInputStream(this.g,t,r,s,o)})}addGpuBufferToStream(e,t,r){w(this,t,i=>{let[o,n]=Hl(this,e,i);this.i._addBoundTextureToStream(i,o,n,r)})}addBoolToStream(e,t,r){w(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){w(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){w(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){w(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addStringToStream(e,t,r){w(this,t,i=>{w(this,e,o=>{this.i._addStringToInputStream(o,i,r)})})}addStringRecordToStream(e,t,r){w(this,t,i=>{Wl(this,Object.keys(e),o=>{Wl(this,Object.values(e),n=>{this.i._addFlatHashMapToInputStream(o,n,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){w(this,r,o=>{w(this,t,n=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,n,o,i),this.i._free(s)})})}addEmptyPacketToStream(e,t){w(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let n of e)this.i._addBoolVectorEntry(o,n);this.i._addBoolVectorToInputStream(o,i,r)})}addDoubleVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let n of e)this.i._addDoubleVectorEntry(o,n);this.i._addDoubleVectorToInputStream(o,i,r)})}addFloatVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let n of e)this.i._addFloatVectorEntry(o,n);this.i._addFloatVectorToInputStream(o,i,r)})}addIntVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let n of e)this.i._addIntVectorEntry(o,n);this.i._addIntVectorToInputStream(o,i,r)})}addStringVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let n of e)w(this,n,s=>{this.i._addStringVectorEntry(o,s)});this.i._addStringVectorToInputStream(o,i,r)})}addBoolToInputSidePacket(e,t){w(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){w(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){w(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){w(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){w(this,t,r=>{w(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){w(this,r,i=>{w(this,t,o=>{let n=this.i._malloc(e.length);this.i.HEAPU8.set(e,n),this.i._addProtoToInputSidePacket(n,e.length,o,i),this.i._free(n)})})}addBoolVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)w(this,o,n=>{this.i._addStringVectorEntry(i,n)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){Ct(this,e,t),w(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){lr(this,e,t),w(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Ct(this,e,t),w(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){lr(this,e,t),w(this,e,r=>{this.i._attachIntVectorListener(r)})}attachDoubleListener(e,t){Ct(this,e,t),w(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){lr(this,e,t),w(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Ct(this,e,t),w(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){lr(this,e,t),w(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Ct(this,e,t),w(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){lr(this,e,t),w(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Ct(this,e,t),w(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){lr(this,e,t),w(this,e,i=>{this.i._attachProtoVectorListener(i,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?'),Ct(this,e,(i,o)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,o)}),w(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends iu{get fa(){return this.i}va(e,t,r){w(this,t,i=>{let[o,n]=Hl(this,e,i);this.fa._addBoundTextureAsImageToStream(i,o,n,r)})}ba(e,t){Ct(this,e,t),w(this,e,r=>{this.fa._attachImageListener(r)})}ca(e,t){lr(this,e,t),w(this,e,r=>{this.fa._attachImageVectorListener(r)})}})),iu,nt=class extends O2{};async function C(e,t,r){return async function(i,o,n,s){return C2(i,o,n,s)}(e,r.canvas??(typeof OffscreenCanvas>"u"||lh()?document.createElement("canvas"):void 0),t,r)}function fh(e,t,r,i){if(e.J){let n=new Cd;if(r?.regionOfInterest){if(!e.U)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].");A(n,1,(o.left+o.right)/2),A(n,2,(o.top+o.bottom)/2),A(n,4,o.right-o.left),A(n,3,o.bottom-o.top)}else A(n,1,.5),A(n,2,.5),A(n,4,1),A(n,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(A(n,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=t.videoWidth!==void 0?[t.videoWidth,t.videoHeight]:t.naturalWidth!==void 0?[t.naturalWidth,t.naturalHeight]:[t.width,t.height];r=ue(n,3)*a/s,o=ue(n,4)*s/a,A(n,4,r),A(n,3,o)}}e.g.addProtoToStream(n.g(),"mediapipe.NormalizedRect",e.J,i)}e.g.va(t,e.T,i??performance.now()),e.finishProcessing()}function st(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");fh(e,t,r,e.I+1)}function Dt(e,t,r,i){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");fh(e,t,r,i)}function xi(e,t,r,i){var o=t.data;let n=t.width,s=n*(t=t.height);if((o instanceof Uint8Array||o instanceof Float32Array)&&o.length!==s)throw Error("Unsupported channel count: "+o.length/s);return e=new oe([o],r,!1,e.g.i.canvas,e.M,n,t),i?e.clone():e}var Me=class extends $s{constructor(e,t,r,i){super(e),this.g=e,this.T=t,this.J=r,this.U=i,this.M=new Vr}l(e,t=!0){if("runningMode"in e&&_i(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()}};Me.prototype.close=Me.prototype.close;var Ee=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},E(e=this.h=new Oa,0,1,t=new K),A(this.h,2,.5),A(this.h,3,.3)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&A(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&A(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}G(e,t){return this.j={detections:[]},st(this,e,t),this.j}H(e,t,r){return this.j={detections:[]},Dt(this,e,r,t),this.j}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect_in"),j(e,"detections");let t=new $e;rt(t,u2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect_in"),D(r,"DETECTIONS:detections"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("detections",(i,o)=>{for(let n of i)i=kd(n),this.j.detections.push(sh(i));S(this,o)}),this.g.attachEmptyPacketListener("detections",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ee.prototype.detectForVideo=Ee.prototype.H,Ee.prototype.detect=Ee.prototype.G,Ee.prototype.setOptions=Ee.prototype.o,Ee.createFromModelPath=async function(e,t){return C(Ee,e,{baseOptions:{modelAssetPath:t}})},Ee.createFromModelBuffer=function(e,t){return C(Ee,e,{baseOptions:{modelAssetBuffer:t}})},Ee.createFromOptions=function(e,t){return C(Ee,e,t)};var mh=ot([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]),gh=ot([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]),yh=ot([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),D2=ot([474,475],[475,476],[476,477],[477,474]),vh=ot([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]),bh=ot([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),F2=ot([469,470],[470,471],[471,472],[472,469]),wh=ot([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]),B2=[...mh,...gh,...yh,...vh,...bh,...wh],M2=ot([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 ou(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var X=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,E(e=this.h=new Nd,0,1,t=new K),this.v=new h2,E(this.h,0,3,this.v),this.u=new Oa,E(this.h,0,2,this.u),gt(this.u,4,1),A(this.u,2,.5),A(this.v,2,.5),A(this.h,4,.5)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return"numFaces"in e&&gt(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&A(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&A(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}G(e,t){return ou(this),st(this,e,t),this.j}H(e,t,r){return ou(this),Dt(this,e,r,t),this.j}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"face_landmarks");let t=new $e;rt(t,p2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,o)=>{for(let n of i)i=sn(n),this.j.faceLandmarks.push(Ma(i));S(this,o)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{S(this,i)}),this.outputFaceBlendshapes&&(j(e,"blendshapes"),D(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,o)=>{if(this.outputFaceBlendshapes)for(let n of i)i=Ra(n),this.j.faceBlendshapes.push(nh(i.g()??[]));S(this,o)}),this.g.attachEmptyPacketListener("blendshapes",i=>{S(this,i)})),this.outputFacialTransformationMatrixes&&(j(e,"face_geometry"),D(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,o)=>{if(this.outputFacialTransformationMatrixes)for(let n of i)(i=P(d2(n),xd,2))&&this.j.facialTransformationMatrixes.push({rows:mt(Ge(i,1))??0,columns:mt(Ge(i,2))??0,data:Ar(i,3,Kt)??[]});S(this,o)}),this.g.attachEmptyPacketListener("face_geometry",i=>{S(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};X.prototype.detectForVideo=X.prototype.H,X.prototype.detect=X.prototype.G,X.prototype.setOptions=X.prototype.o,X.createFromModelPath=function(e,t){return C(X,e,{baseOptions:{modelAssetPath:t}})},X.createFromModelBuffer=function(e,t){return C(X,e,{baseOptions:{modelAssetBuffer:t}})},X.createFromOptions=function(e,t){return C(X,e,t)},X.FACE_LANDMARKS_LIPS=mh,X.FACE_LANDMARKS_LEFT_EYE=gh,X.FACE_LANDMARKS_LEFT_EYEBROW=yh,X.FACE_LANDMARKS_LEFT_IRIS=D2,X.FACE_LANDMARKS_RIGHT_EYE=vh,X.FACE_LANDMARKS_RIGHT_EYEBROW=bh,X.FACE_LANDMARKS_RIGHT_IRIS=F2,X.FACE_LANDMARKS_FACE_OVAL=wh,X.FACE_LANDMARKS_CONTOURS=B2,X.FACE_LANDMARKS_TESSELATION=M2;var dt=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!0),E(e=this.j=new Vd,0,1,t=new K)}get baseOptions(){return P(this.j,K,1)}set baseOptions(e){E(this.j,0,1,e)}o(e){return super.l(e)}Ua(e,t,r){let i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,st(this,e,i??{}),!this.h)return this.u}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"stylized_image");let t=new $e;rt(t,f2,this.j);let r=new be;Xe(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Ke(e,r),this.g.ba("stylized_image",(i,o)=>{var n=!this.h,s=i.data,a=i.width;let c=a*(i=i.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let u=0;u<c;++u)l[4*u]=s[3*u],l[4*u+1]=s[3*u+1],l[4*u+2]=s[3*u+2],l[4*u+3]=255;s=new ImageData(l,a,i)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,i)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new ce([s],!1,!1,this.g.i.canvas,this.M,a,i),this.u=n=n?a.clone():a,this.h&&this.h(n),S(this,o)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.u=null,this.h&&this.h(null),S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};dt.prototype.stylize=dt.prototype.Ua,dt.prototype.setOptions=dt.prototype.o,dt.createFromModelPath=function(e,t){return C(dt,e,{baseOptions:{modelAssetPath:t}})},dt.createFromModelBuffer=function(e,t){return C(dt,e,{baseOptions:{modelAssetBuffer:t}})},dt.createFromOptions=function(e,t){return C(dt,e,t)};var Sh=ot([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 nu(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function su(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 au(e,t=!0){let r=[];for(let o of e){var i=Ra(o);e=[];for(let n of i.g())i=t&&Ge(n,1)!=null?mt(Ge(n,1)):-1,e.push({score:ue(n,2)??0,index:i,categoryName:We(n,3)??""??"",displayName:We(n,4)??""??""});r.push(e)}return r}var Oe=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],E(e=this.v=new Jd,0,1,t=new K),this.B=new Da,E(this.v,0,2,this.B),this.u=new qd,E(this.B,0,3,this.u),this.h=new Wd,E(this.B,0,2,this.h),this.j=new m2,E(this.v,0,3,this.j),A(this.h,2,.5),A(this.B,4,.5),A(this.u,2,.5)}get baseOptions(){return P(this.v,K,1)}set baseOptions(e){E(this.v,0,1,e)}o(e){if(gt(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&A(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.B,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&A(this.u,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new _r,r=t,i=Ws(e.cannedGesturesClassifierOptions,P(this.j,_r,3)?.h());E(r,0,2,i),E(this.j,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&P(this.j,_r,3)?.g();return e.customGesturesClassifierOptions?(E(r=t=new _r,0,2,i=Ws(e.customGesturesClassifierOptions,P(this.j,_r,4)?.h())),E(this.j,0,4,t)):e.customGesturesClassifierOptions===void 0&&P(this.j,_r,4)?.g(),this.l(e)}Pa(e,t){return nu(this),st(this,e,t),su(this)}Qa(e,t,r){return nu(this),Dt(this,e,r,t),su(this)}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"hand_gestures"),j(e,"hand_landmarks"),j(e,"world_hand_landmarks"),j(e,"handedness");let t=new $e;rt(t,v2,this.v);let r=new be;Xe(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"HAND_GESTURES:hand_gestures"),D(r,"LANDMARKS:hand_landmarks"),D(r,"WORLD_LANDMARKS:world_hand_landmarks"),D(r,"HANDEDNESS:handedness"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,o)=>{for(let n of i){i=sn(n);let s=[];for(let a of Ot(i,Ad,1))s.push({x:ue(a,1)??0,y:ue(a,2)??0,z:ue(a,3)??0});this.landmarks.push(s)}S(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{S(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,o)=>{for(let n of i){i=Ia(n);let s=[];for(let a of Ot(i,Ed,1))s.push({x:ue(a,1)??0,y:ue(a,2)??0,z:ue(a,3)??0});this.worldLandmarks.push(s)}S(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{S(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,o)=>{this.gestures.push(...au(i,!1)),S(this,o)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{S(this,i)}),this.g.attachProtoVectorListener("handedness",(i,o)=>{this.handedness.push(...au(i)),S(this,o)}),this.g.attachEmptyPacketListener("handedness",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function cu(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Oe.prototype.recognizeForVideo=Oe.prototype.Qa,Oe.prototype.recognize=Oe.prototype.Pa,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return C(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return C(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return C(Oe,e,t)},Oe.HAND_CONNECTIONS=Sh;var De=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],E(e=this.j=new Da,0,1,t=new K),this.u=new qd,E(this.j,0,3,this.u),this.h=new Wd,E(this.j,0,2,this.h),gt(this.h,3,1),A(this.h,2,.5),A(this.u,2,.5),A(this.j,4,.5)}get baseOptions(){return P(this.j,K,1)}set baseOptions(e){E(this.j,0,1,e)}o(e){return"numHands"in e&&gt(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&A(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&A(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}G(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],st(this,e,t),cu(this)}H(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Dt(this,e,r,t),cu(this)}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"hand_landmarks"),j(e,"world_hand_landmarks"),j(e,"handedness");let t=new $e;rt(t,y2,this.j);let r=new be;Xe(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"LANDMARKS:hand_landmarks"),D(r,"WORLD_LANDMARKS:world_hand_landmarks"),D(r,"HANDEDNESS:handedness"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,o)=>{for(let n of i)i=sn(n),this.landmarks.push(Ma(i));S(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{S(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,o)=>{for(let n of i)i=Ia(n),this.worldLandmarks.push(ah(i));S(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{S(this,i)}),this.g.attachProtoVectorListener("handedness",(i,o)=>{var n=this.handedness,s=n.push;let a=[];for(let c of i){i=Ra(c);let l=[];for(let u of i.g())l.push({score:ue(u,2)??0,index:mt(Ge(u,1))??-1,categoryName:We(u,3)??""??"",displayName:We(u,4)??""??""});a.push(l)}s.call(n,...a),S(this,o)}),this.g.attachEmptyPacketListener("handedness",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};De.prototype.detectForVideo=De.prototype.H,De.prototype.detect=De.prototype.G,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=function(e,t){return C(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return C(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return C(De,e,t)},De.HAND_CONNECTIONS=Sh;var Ve=class extends Me{constructor(e,t){super(new nt(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},E(e=this.h=new Yd,0,1,t=new K)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return E(this.h,0,2,Ws(e,P(this.h,an,2))),this.l(e)}ya(e,t){return this.j={classifications:[]},st(this,e,t),this.j}za(e,t,r){return this.j={classifications:[]},Dt(this,e,r,t),this.j}m(){var e=new xe;z(e,"input_image"),z(e,"norm_rect"),j(e,"classifications");let t=new $e;rt(t,b2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),U(r,"IMAGE:input_image"),U(r,"NORM_RECT:norm_rect"),D(r,"CLASSIFICATIONS:classifications"),r.o(t),Ke(e,r),this.g.attachProtoListener("classifications",(i,o)=>{this.j=function(n){let s={classifications:Ot(n,r2,1).map(a=>nh(P(a,Pa,4)?.g()??[],mt(Ge(a,2)),We(a,3)??""))};return zo(Ir(n,2))!=null&&(s.timestampMs=mt(zo(Ir(n,2)))),s}(o2(i)),S(this,o)}),this.g.attachEmptyPacketListener("classifications",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.classifyForVideo=Ve.prototype.za,Ve.prototype.classify=Ve.prototype.ya,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return C(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return C(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return C(Ve,e,t)};var Fe=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!0),this.h=new Zd,this.embeddings={embeddings:[]},E(e=this.h,0,1,t=new K)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){var t=this.h,r=P(this.h,Nl,2);return r=r?r.clone():new Nl,e.l2Normalize!==void 0?_i(r,1,e.l2Normalize):"l2Normalize"in e&&B(r,1),e.quantize!==void 0?_i(r,2,e.quantize):"quantize"in e&&B(r,2),E(t,0,2,r),this.l(e)}Fa(e,t){return st(this,e,t),this.embeddings}Ga(e,t,r){return Dt(this,e,r,t),this.embeddings}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"embeddings_out");let t=new $e;rt(t,w2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ke(e,r),this.g.attachProtoListener("embeddings_out",(i,o)=>{i=c2(i),this.embeddings=function(n){return{embeddings:Ot(n,s2,1).map(s=>{let a={headIndex:mt(Ge(s,3))??-1,headName:We(s,4)??""??""};if(qu(s,Gs,Ts(s,1))!==void 0)s=Ar(s=P(s,Gs,Ts(s,1)),1,Kt),a.floatEmbedding=s;else{let c=new Uint8Array(0);a.quantizedEmbedding=P(s,n2,Ts(s,2))?.ua()?.wa()??c}return a}),timestampMs:mt(zo(Ir(n,2)))}}(i),S(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=zl(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=zl(Vl(e.quantizedEmbedding),Vl(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.Ga,Fe.prototype.embed=Fe.prototype.Fa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return C(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return C(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return C(Fe,e,t)};var Js=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 lu(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function uu(e){try{let t=new Js(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{La(e)}}Js.prototype.close=Js.prototype.close;var ke=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fa,this.v=new Qd,E(this.h,0,3,this.v),E(e=this.h,0,1,t=new K)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?B(this.h,2,Oi(e.displayNamesLocale)):"displayNamesLocale"in e&&B(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}N(){(function(e){let t=Ot(e.da(),be,1).filter(r=>(We(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&&(P(t[0],$e,7)?.l()?.g()??new Map).forEach((r,i)=>{e.u[Number(i)]=We(r,1)??""})})(this)}ea(e,t,r){let i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,lu(this),st(this,e,i),uu(this)}Sa(e,t,r,i){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,lu(this),Dt(this,e,o,t),uu(this)}Ja(){return this.u}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect");let t=new $e;rt(t,th,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),r.o(t),Ke(e,r),Ua(this,e),this.outputConfidenceMasks&&(j(e,"confidence_masks"),D(r,"CONFIDENCE_MASKS:confidence_masks"),Ai(this,"confidence_masks"),this.g.ca("confidence_masks",(i,o)=>{this.confidenceMasks=i.map(n=>xi(this,n,!0,!this.j)),S(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],S(this,i)})),this.outputCategoryMask&&(j(e,"category_mask"),D(r,"CATEGORY_MASK:category_mask"),Ai(this,"category_mask"),this.g.ba("category_mask",(i,o)=>{this.categoryMask=xi(this,i,!1,!this.j),S(this,o)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,S(this,i)})),j(e,"quality_scores"),D(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,o)=>{this.qualityScores=i,S(this,o)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ke.prototype.getLabels=ke.prototype.Ja,ke.prototype.segmentForVideo=ke.prototype.Sa,ke.prototype.segment=ke.prototype.ea,ke.prototype.setOptions=ke.prototype.o,ke.createFromModelPath=function(e,t){return C(ke,e,{baseOptions:{modelAssetPath:t}})},ke.createFromModelBuffer=function(e,t){return C(ke,e,{baseOptions:{modelAssetBuffer:t}})},ke.createFromOptions=function(e,t){return C(ke,e,t)};var Ys=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};Ys.prototype.close=Ys.prototype.close;var U2=class extends b{constructor(e){super(e)}},Br=[0,J,-2],L2=[0,It,-3,ee],un=[0,It,-3,ee,It,-1],kh=[0,un],N2=[0,kh,Br],j2=[0,un,Br],Eh=[0,un,J,-1],V2=[0,Eh,Br],z2=[0,It,-3,ee,Br,-1],G2=[0,It,-3,ee,yt],Rs=class extends b{constructor(e){super(e)}},du=[0,It,-1,ee],_h=class extends b{constructor(){super()}};_h.A=[1];var hu=class extends b{constructor(e){super(e)}},Zs=[1,2,3,4,5,6,7,8,9,10,14,15],H2=[0,Zs,N,un,N,j2,N,kh,N,N2,N,du,N,G2,N,L2,N,[0,L,It,-2,ee,J,ee,-1,2,It,Br],N,Eh,N,V2,It,Br,L,N,z2,N,[0,ne,du]],W2=[0,L,J,-1,ee],Qs=class extends b{constructor(){super()}};Qs.A=[1],Qs.prototype.g=Ca([0,ne,H2,L,W2]);var ht=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Fa,this.v=new Qd,E(this.h,0,3,this.v),E(e=this.h,0,1,t=new K)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(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)}ea(e,t,r,i){let o=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.I+1,i=new Qs;let n=new hu;var s=new U2;if(gt(s,1,255),E(n,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Rs;_i(a,3,!0),A(a,1,t.keypoint.x),A(a,2,t.keypoint.y),vi(n,5,Zs,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new _h,t.scribble))_i(t=new Rs,3,!0),A(t,1,a.x),A(t,2,a.y),Vs(s,Rs,t);vi(n,15,Zs,s)}Vs(i,hu,n),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),st(this,e,o);e:{try{let l=new Ys(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{La(this)}c=void 0}return c}m(){var e=new xe;z(e,"image_in"),z(e,"roi_in"),z(e,"norm_rect_in");let t=new $e;rt(t,th,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),U(r,"IMAGE:image_in"),U(r,"ROI:roi_in"),U(r,"NORM_RECT:norm_rect_in"),r.o(t),Ke(e,r),Ua(this,e),this.outputConfidenceMasks&&(j(e,"confidence_masks"),D(r,"CONFIDENCE_MASKS:confidence_masks"),Ai(this,"confidence_masks"),this.g.ca("confidence_masks",(i,o)=>{this.confidenceMasks=i.map(n=>xi(this,n,!0,!this.j)),S(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],S(this,i)})),this.outputCategoryMask&&(j(e,"category_mask"),D(r,"CATEGORY_MASK:category_mask"),Ai(this,"category_mask"),this.g.ba("category_mask",(i,o)=>{this.categoryMask=xi(this,i,!1,!this.j),S(this,o)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,S(this,i)})),j(e,"quality_scores"),D(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,o)=>{this.qualityScores=i,S(this,o)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ht.prototype.segment=ht.prototype.ea,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(e,t){return C(ht,e,{baseOptions:{modelAssetPath:t}})},ht.createFromModelBuffer=function(e,t){return C(ht,e,{baseOptions:{modelAssetBuffer:t}})},ht.createFromOptions=function(e,t){return C(ht,e,t)};var _e=class extends Me{constructor(e,t){super(new nt(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},E(e=this.h=new Ba,0,1,t=new K)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?B(this.h,2,Oi(e.displayNamesLocale)):"displayNamesLocale"in e&&B(this.h,2),e.maxResults!==void 0?gt(this.h,3,e.maxResults):"maxResults"in e&&B(this.h,3),e.scoreThreshold!==void 0?A(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&B(this.h,4),e.categoryAllowlist!==void 0?Wo(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&B(this.h,5),e.categoryDenylist!==void 0?Wo(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&B(this.h,6),this.l(e)}G(e,t){return this.j={detections:[]},st(this,e,t),this.j}H(e,t,r){return this.j={detections:[]},Dt(this,e,r,t),this.j}m(){var e=new xe;z(e,"input_frame_gpu"),z(e,"norm_rect"),j(e,"detections");let t=new $e;rt(t,k2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),U(r,"IMAGE:input_frame_gpu"),U(r,"NORM_RECT:norm_rect"),D(r,"DETECTIONS:detections"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("detections",(i,o)=>{for(let n of i)i=kd(n),this.j.detections.push(sh(i));S(this,o)}),this.g.attachEmptyPacketListener("detections",i=>{S(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.H,_e.prototype.detect=_e.prototype.G,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=async function(e,t){return C(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return C(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return C(_e,e,t)};function pu(e){e.landmarks=[],e.worldLandmarks=[],e.v=void 0}function fu(e){try{let t=new class{constructor(r,i,o){this.landmarks=r,this.worldLandmarks=i,this.g=o}close(){this.g?.forEach(r=>{r.close()})}}(e.landmarks,e.worldLandmarks,e.v);if(!e.u)return t;e.u(t)}finally{La(e)}}var Be=class extends Me{constructor(e,t){super(new nt(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,E(e=this.h=new oh,0,1,t=new K),this.B=new _2,E(this.h,0,3,this.B),this.j=new E2,E(this.h,0,2,this.j),gt(this.j,4,1),A(this.j,2,.5),A(this.B,2,.5),A(this.h,4,.5)}get baseOptions(){return P(this.h,K,1)}set baseOptions(e){E(this.h,0,1,e)}o(e){return"numPoses"in e&&gt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&A(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&A(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&A(this.B,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}G(e,t,r){let i=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,pu(this),st(this,e,i),fu(this)}H(e,t,r,i){let o=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,pu(this),Dt(this,e,o,t),fu(this)}m(){var e=new xe;z(e,"image_in"),z(e,"norm_rect"),j(e,"normalized_landmarks"),j(e,"world_landmarks"),j(e,"segmentation_masks");let t=new $e;rt(t,T2,this.h);let r=new be;Xe(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),U(r,"IMAGE:image_in"),U(r,"NORM_RECT:norm_rect"),D(r,"NORM_LANDMARKS:normalized_landmarks"),D(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ke(e,r),Ua(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,o)=>{this.landmarks=[];for(let n of i)i=sn(n),this.landmarks.push(Ma(i));S(this,o)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],S(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,o)=>{this.worldLandmarks=[];for(let n of i)i=Ia(n),this.worldLandmarks.push(ah(i));S(this,o)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],S(this,i)}),this.outputSegmentationMasks&&(D(r,"SEGMENTATION_MASK:segmentation_masks"),Ai(this,"segmentation_masks"),this.g.ca("segmentation_masks",(i,o)=>{this.v=i.map(n=>xi(this,n,!0,!this.u)),S(this,o)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.v=[],S(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Be.prototype.detectForVideo=Be.prototype.H,Be.prototype.detect=Be.prototype.G,Be.prototype.setOptions=Be.prototype.o,Be.createFromModelPath=function(e,t){return C(Be,e,{baseOptions:{modelAssetPath:t}})},Be.createFromModelBuffer=function(e,t){return C(Be,e,{baseOptions:{modelAssetBuffer:t}})},Be.createFromOptions=function(e,t){return C(Be,e,t)},Be.POSE_CONNECTIONS=ot([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]);var zr=class{constructor(t,r,i,o,n="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=n,this.classDiv=s,o&&(this.paramsConfig=o),i&&(this.options=i)}async initializeDetector(){let t=await Tr.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Ee:_e).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
41
+ `}F(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=Yt(this,e),e.activeTexture(e.TEXTURE2),this.B=Yt(this,e)}m(){super.m();let e=this.g;this.T=ve(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.U=ve(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.J=ve(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.T,1),e.uniform1i(this.U,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Ot(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 oa(e){var t=Ot(e,1);if(!t){if(t=Ot(e,0))t=new Float32Array(t).map(i=>i/255);else{t=new Float32Array(e.width*e.height);let i=Lr(e);var r=Ya(e);if(yn(r,i,Sh(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),i.readPixels(0,0,e.width,e.height,i.RGBA,i.FLOAT,r);for(let o=0,n=0;o<t.length;++o,n+=4)t[o]=r[n]}else i.readPixels(0,0,e.width,e.height,i.RED,i.FLOAT,t)}e.g.push(t)}return t}function Sh(e){let t=Ot(e,2);if(!t){let r=Lr(e);t=Eh(e);let i=oa(e),o=kh(e);r.texImage2D(r.TEXTURE_2D,0,o,e.width,e.height,0,r.RED,r.FLOAT,i),na(e)}return t}function Lr(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=ve(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function kh(e){if(e=Lr(e),!Uo)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))Uo=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");Uo=e.R16F}return Uo}function Ya(e){return e.l||(e.l=new qr),e.l}function Eh(e){let t=Lr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Ot(e,2);return r||(r=Yt(Ya(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function na(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var Uo,se=class{constructor(e,t,r,i,o,n,s){this.g=e,this.m=t,this.j=r,this.canvas=i,this.l=o,this.width=n,this.height=s,this.j&&--ad===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}La(){return!!Ot(this,0)}ka(){return!!Ot(this,1)}P(){return!!Ot(this,2)}ja(){return(t=Ot(e=this,0))||(t=oa(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ia(){return oa(this)}K(){return Sh(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 i=Lr(this),o=Ya(this);i.activeTexture(i.TEXTURE1),r=Yt(o,i,this.m?i.LINEAR:i.NEAREST),i.bindTexture(i.TEXTURE_2D,r);let n=kh(this);i.texImage2D(i.TEXTURE_2D,0,n,this.width,this.height,0,i.RED,i.FLOAT,null),i.bindTexture(i.TEXTURE_2D,null),yn(o,i,r),Ni(o,i,!1,()=>{Eh(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),na(this)}),Ja(o),na(this)}}e.push(r)}return new se(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Lr(this).deleteTexture(Ot(this,2)),ad=-1}};se.prototype.close=se.prototype.close,se.prototype.clone=se.prototype.clone,se.prototype.getAsWebGLTexture=se.prototype.K,se.prototype.getAsFloat32Array=se.prototype.ia,se.prototype.getAsUint8Array=se.prototype.ja,se.prototype.hasWebGLTexture=se.prototype.P,se.prototype.hasFloat32Array=se.prototype.ka,se.prototype.hasUint8Array=se.prototype.La;var ad=250,G2={color:"white",lineWidth:4,radius:6};function Ns(e){return{...G2,fillColor:(e=e||{}).color,...e}}function Dt(e,t){return e instanceof Function?e(t):e}function cd(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function gi(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Ii(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function ld(e,t,r){if(t.P())r(t.K());else{let i=t.ka()?t.ia():t.ja();e.m=e.m??new qr;let o=Ii(e);r((e=new se([i],t.m,!1,o.canvas,e.m,t.width,t.height)).K()),e.close()}}function dd(e,t,r,i){let o=function(a){return a.g||(a.g=new V2),a.g}(e),n=Ii(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Ni(o,n,!0,()=>{(function(c,l,d,u){let m=c.g;if(m.activeTexture(m.TEXTURE0),m.bindTexture(m.TEXTURE_2D,l),m.activeTexture(m.TEXTURE1),m.bindTexture(m.TEXTURE_2D,c.B),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,d),c.J&&function(f,h){if(f!==h)return!1;f=f.entries(),h=h.entries();for(let[y,v]of f){f=y;let S=v;var g=h.next();if(g.done)return!1;let[x,O]=g.value;if(g=O,f!==x||S[0]!==g[0]||S[1]!==g[1]||S[2]!==g[2]||S[3]!==g[3])return!1}return!!h.next().done}(c.J,u))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.J=u;let f=Array(1024).fill(0);u.forEach((h,g)=>{if(h.length!==4)throw Error(`Color at index ${g} is not a four-channel value.`);f[4*g]=h[0],f[4*g+1]=h[1],f[4*g+2]=h[2],f[4*g+3]=h[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(f))}})(o,t,s,i),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.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 ud(e,t,r,i){let o=Ii(e),n=function(c){return c.h||(c.h=new z2),c.h}(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(i)?new ImageData(new Uint8ClampedArray(i),1,1):i;Ni(n,o,!0,()=>{var c=n.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,n.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,n.B),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=n.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 ke=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}Ea(e,t){if(e){var r=gi(this);t=Ns(t),r.save();var i=r.canvas,o=0;for(let n of e)r.fillStyle=Dt(t.fillColor,{index:o,from:n}),r.strokeStyle=Dt(t.color,{index:o,from:n}),r.lineWidth=Dt(t.lineWidth,{index:o,from:n}),(e=new Path2D).arc(n.x*i.width,n.y*i.height,Dt(t.radius,{index:o,from:n}),0,2*Math.PI),r.fill(e),r.stroke(e),++o;r.restore()}}Da(e,t,r){if(e&&t){var i=gi(this);r=Ns(r),i.save();var o=i.canvas,n=0;for(let s of t){i.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(i.strokeStyle=Dt(r.color,{index:n,from:t,to:a}),i.lineWidth=Dt(r.lineWidth,{index:n,from:t,to:a}),i.moveTo(t.x*o.width,t.y*o.height),i.lineTo(a.x*o.width,a.y*o.height)),++n,i.stroke()}i.restore()}}Aa(e,t){let r=gi(this);t=Ns(t),r.save(),r.beginPath(),r.lineWidth=Dt(t.lineWidth,{}),r.strokeStyle=Dt(t.color,{}),r.fillStyle=Dt(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()}Ba(e,t,r=[0,0,0,255]){this.l?function(i,o,n,s){let a=Ii(i);ld(i,o,c=>{dd(i,c,n,s),(c=gi(i)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,r,t):dd(this,e.K(),r,t)}Ca(e,t,r){this.l?function(i,o,n,s){let a=Ii(i);ld(i,o,c=>{ud(i,c,n,s),(c=gi(i)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,r):ud(this,e.K(),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 mt(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 Ah(e){var t=mt(e,0);if(!t){t=Nr(e);let r=vn(e),i=new Uint8Array(e.width*e.height*4);yn(r,t,Wo(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,i),Ja(r),t=new ImageData(new Uint8ClampedArray(i.buffer),e.width,e.height),e.g.push(t)}return t}function Wo(e){let t=mt(e,2);if(!t){let r=Nr(e);t=qo(e);let i=mt(e,1)||Ah(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,i),vi(e)}return t}function Nr(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=ve(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function vn(e){return e.l||(e.l=new qr),e.l}function qo(e){let t=Nr(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=mt(e,2);return r||(r=Yt(vn(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function vi(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function hd(e){let t=Nr(e);return Ni(vn(e),t,!0,()=>function(r,i){let o=r.canvas;if(o.width===r.width&&o.height===r.height)return i();let n=o.width,s=o.height;return o.width=r.width,o.height=r.height,r=i(),o.width=n,o.height=s,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}ke.prototype.close=ke.prototype.close,ke.prototype.drawConfidenceMask=ke.prototype.Ca,ke.prototype.drawCategoryMask=ke.prototype.Ba,ke.prototype.drawBoundingBox=ke.prototype.Aa,ke.prototype.drawConnectors=ke.prototype.Da,ke.prototype.drawLandmarks=ke.prototype.Ea,ke.lerp=function(e,t,r,i,o){return cd(i*(1-(e-t)/(r-t))+o*(1-(r-e)/(r-t)),i,o)},ke.clamp=cd;var de=class{constructor(e,t,r,i,o,n,s){this.g=e,this.j=t,this.m=r,this.canvas=i,this.l=o,this.width=n,this.height=s,(this.j||this.m)&&--pd===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ka(){return!!mt(this,0)}la(){return!!mt(this,1)}P(){return!!mt(this,2)}Ia(){return Ah(this)}Ha(){var e=mt(this,1);return e||(Wo(this),qo(this),e=hd(this),vi(this),this.g.push(e),this.j=!0),e}K(){return Wo(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 i=Nr(this),o=vn(this);i.activeTexture(i.TEXTURE1),r=Yt(o,i),i.bindTexture(i.TEXTURE_2D,r),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,this.width,this.height,0,i.RGBA,i.UNSIGNED_BYTE,null),i.bindTexture(i.TEXTURE_2D,null),yn(o,i,r),Ni(o,i,!1,()=>{qo(this),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),vi(this)}),Ja(o),vi(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Wo(this),qo(this),r=hd(this),vi(this)}e.push(r)}return new de(e,this.la(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&mt(this,1).close(),this.m&&Nr(this).deleteTexture(mt(this,2)),pd=-1}};de.prototype.close=de.prototype.close,de.prototype.clone=de.prototype.clone,de.prototype.getAsWebGLTexture=de.prototype.K,de.prototype.getAsImageBitmap=de.prototype.Ha,de.prototype.getAsImageData=de.prototype.Ia,de.prototype.hasWebGLTexture=de.prototype.P,de.prototype.hasImageBitmap=de.prototype.la,de.prototype.hasImageData=de.prototype.Ka;var pd=250;function st(...e){return e.map(([t,r])=>({start:t,end:r}))}var H2=function(e){return class extends e{Ra(){this.i._registerModelResourcesGraphService()}}}((md=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:typeof OffscreenCanvas>"u"||wh()?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1)}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,i=this.i._malloc(r);this.i.HEAPU8.set(e,i),t?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(e,t,r,i,o){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),w(this,i||"input_audio",n=>{w(this,o=o||"audio_header",s=>{this.i._configureAudio(n,s,e,t,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Rt(this,"__graph_config__",t=>{e(t)}),w(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,i,o){let n=4*e.length;this.h!==n&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(n),this.h=n),this.i.HEAPF32.set(e,this.g/4),w(this,i,s=>{this.i._addAudioToInputStream(this.g,t,r,s,o)})}addGpuBufferToStream(e,t,r){w(this,t,i=>{let[o,n]=td(this,e,i);this.i._addBoundTextureToStream(i,o,n,r)})}addBoolToStream(e,t,r){w(this,t,i=>{this.i._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){w(this,t,i=>{this.i._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){w(this,t,i=>{this.i._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){w(this,t,i=>{this.i._addIntToInputStream(e,i,r)})}addStringToStream(e,t,r){w(this,t,i=>{w(this,e,o=>{this.i._addStringToInputStream(o,i,r)})})}addStringRecordToStream(e,t,r){w(this,t,i=>{rd(this,Object.keys(e),o=>{rd(this,Object.values(e),n=>{this.i._addFlatHashMapToInputStream(o,n,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){w(this,r,o=>{w(this,t,n=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,n,o,i),this.i._free(s)})})}addEmptyPacketToStream(e,t){w(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let n of e)this.i._addBoolVectorEntry(o,n);this.i._addBoolVectorToInputStream(o,i,r)})}addDoubleVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let n of e)this.i._addDoubleVectorEntry(o,n);this.i._addDoubleVectorToInputStream(o,i,r)})}addFloatVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let n of e)this.i._addFloatVectorEntry(o,n);this.i._addFloatVectorToInputStream(o,i,r)})}addIntVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let n of e)this.i._addIntVectorEntry(o,n);this.i._addIntVectorToInputStream(o,i,r)})}addStringVectorToStream(e,t,r){w(this,t,i=>{let o=this.i._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let n of e)w(this,n,s=>{this.i._addStringVectorEntry(o,s)});this.i._addStringVectorToInputStream(o,i,r)})}addBoolToInputSidePacket(e,t){w(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){w(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){w(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){w(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){w(this,t,r=>{w(this,e,i=>{this.i._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){w(this,r,i=>{w(this,t,o=>{let n=this.i._malloc(e.length);this.i.HEAPU8.set(e,n),this.i._addProtoToInputSidePacket(n,e.length,o,i),this.i._free(n)})})}addBoolVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){w(this,t,r=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)w(this,o,n=>{this.i._addStringVectorEntry(i,n)});this.i._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){Rt(this,e,t),w(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){ur(this,e,t),w(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Rt(this,e,t),w(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){ur(this,e,t),w(this,e,r=>{this.i._attachIntVectorListener(r)})}attachDoubleListener(e,t){Rt(this,e,t),w(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){ur(this,e,t),w(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Rt(this,e,t),w(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){ur(this,e,t),w(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Rt(this,e,t),w(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){ur(this,e,t),w(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Rt(this,e,t),w(this,e,i=>{this.i._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){ur(this,e,t),w(this,e,i=>{this.i._attachProtoVectorListener(i,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?'),Rt(this,e,(i,o)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,o)}),w(this,e,i=>{this.i._attachAudioListener(i,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends md{get fa(){return this.i}va(e,t,r){w(this,t,i=>{let[o,n]=td(this,e,i);this.fa._addBoundTextureAsImageToStream(i,o,n,r)})}ba(e,t){Rt(this,e,t),w(this,e,r=>{this.fa._attachImageListener(r)})}ca(e,t){ur(this,e,t),w(this,e,r=>{this.fa._attachImageVectorListener(r)})}})),md,at=class extends H2{};async function T(e,t,r){return async function(i,o,n,s){return j2(i,o,n,s)}(e,r.canvas??(typeof OffscreenCanvas>"u"||wh()?document.createElement("canvas"):void 0),t,r)}function _h(e,t,r,i){if(e.J){let n=new Nu;if(r?.regionOfInterest){if(!e.U)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].");_(n,1,(o.left+o.right)/2),_(n,2,(o.top+o.bottom)/2),_(n,4,o.right-o.left),_(n,3,o.bottom-o.top)}else _(n,1,.5),_(n,2,.5),_(n,4,1),_(n,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(_(n,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=t.videoWidth!==void 0?[t.videoWidth,t.videoHeight]:t.naturalWidth!==void 0?[t.naturalWidth,t.naturalHeight]:[t.width,t.height];r=he(n,3)*a/s,o=he(n,4)*s/a,_(n,4,r),_(n,3,o)}}e.g.addProtoToStream(n.g(),"mediapipe.NormalizedRect",e.J,i)}e.g.va(t,e.T,i??performance.now()),e.finishProcessing()}function ct(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");_h(e,t,r,e.I+1)}function Mt(e,t,r,i){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");_h(e,t,r,i)}function Ri(e,t,r,i){var o=t.data;let n=t.width,s=n*(t=t.height);if((o instanceof Uint8Array||o instanceof Float32Array)&&o.length!==s)throw Error("Unsupported channel count: "+o.length/s);return e=new se([o],r,!1,e.g.i.canvas,e.M,n,t),i?e.clone():e}var Me=class extends ra{constructor(e,t,r,i){super(e),this.g=e,this.T=t,this.J=r,this.U=i,this.M=new qr}l(e,t=!0){if("runningMode"in e&&Ti(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()}};Me.prototype.close=Me.prototype.close;var Ae=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},A(e=this.h=new za,0,1,t=new J),_(this.h,2,.5),_(this.h,3,.3)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&_(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&_(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}G(e,t){return this.j={detections:[]},ct(this,e,t),this.j}H(e,t,r){return this.j={detections:[]},Mt(this,e,r,t),this.j}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect_in"),z(e,"detections");let t=new qe;ot(t,k2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect_in"),B(r,"DETECTIONS:detections"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("detections",(i,o)=>{for(let n of i)i=Ou(n),this.j.detections.push(yh(i));k(this,o)}),this.g.attachEmptyPacketListener("detections",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ae.prototype.detectForVideo=Ae.prototype.H,Ae.prototype.detect=Ae.prototype.G,Ae.prototype.setOptions=Ae.prototype.o,Ae.createFromModelPath=async function(e,t){return T(Ae,e,{baseOptions:{modelAssetPath:t}})},Ae.createFromModelBuffer=function(e,t){return T(Ae,e,{baseOptions:{modelAssetBuffer:t}})},Ae.createFromOptions=function(e,t){return T(Ae,e,t)};var xh=st([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]),Ch=st([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]),Th=st([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),W2=st([474,475],[475,476],[476,477],[477,474]),Ph=st([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]),Ih=st([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),q2=st([469,470],[470,471],[471,472],[472,469]),Rh=st([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]),$2=[...xh,...Ch,...Th,...Ph,...Ih,...Rh],X2=st([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 fd(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var K=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,A(e=this.h=new Ju,0,1,t=new J),this.v=new A2,A(this.h,0,3,this.v),this.u=new za,A(this.h,0,2,this.u),yt(this.u,4,1),_(this.u,2,.5),_(this.v,2,.5),_(this.h,4,.5)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"numFaces"in e&&yt(this.u,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&_(this.u,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&_(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}G(e,t){return fd(this),ct(this,e,t),this.j}H(e,t,r){return fd(this),Mt(this,e,r,t),this.j}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"face_landmarks");let t=new qe;ot(t,_2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("face_landmarks",(i,o)=>{for(let n of i)i=fn(n),this.j.faceLandmarks.push(qa(i));k(this,o)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{k(this,i)}),this.outputFaceBlendshapes&&(z(e,"blendshapes"),B(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(i,o)=>{if(this.outputFaceBlendshapes)for(let n of i)i=ja(n),this.j.faceBlendshapes.push(gh(i.g()??[]));k(this,o)}),this.g.attachEmptyPacketListener("blendshapes",i=>{k(this,i)})),this.outputFacialTransformationMatrixes&&(z(e,"face_geometry"),B(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(i,o)=>{if(this.outputFacialTransformationMatrixes)for(let n of i)(i=P(E2(n),Lu,2))&&this.j.facialTransformationMatrixes.push({rows:gt(Ge(i,1))??0,columns:gt(Ge(i,2))??0,data:Ir(i,3,Zt)??[]});k(this,o)}),this.g.attachEmptyPacketListener("face_geometry",i=>{k(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};K.prototype.detectForVideo=K.prototype.H,K.prototype.detect=K.prototype.G,K.prototype.setOptions=K.prototype.o,K.createFromModelPath=function(e,t){return T(K,e,{baseOptions:{modelAssetPath:t}})},K.createFromModelBuffer=function(e,t){return T(K,e,{baseOptions:{modelAssetBuffer:t}})},K.createFromOptions=function(e,t){return T(K,e,t)},K.FACE_LANDMARKS_LIPS=xh,K.FACE_LANDMARKS_LEFT_EYE=Ch,K.FACE_LANDMARKS_LEFT_EYEBROW=Th,K.FACE_LANDMARKS_LEFT_IRIS=W2,K.FACE_LANDMARKS_RIGHT_EYE=Ph,K.FACE_LANDMARKS_RIGHT_EYEBROW=Ih,K.FACE_LANDMARKS_RIGHT_IRIS=q2,K.FACE_LANDMARKS_FACE_OVAL=Rh,K.FACE_LANDMARKS_CONTOURS=$2,K.FACE_LANDMARKS_TESSELATION=X2;var ht=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!0),A(e=this.j=new Zu,0,1,t=new J)}get baseOptions(){return P(this.j,J,1)}set baseOptions(e){A(this.j,0,1,e)}o(e){return super.l(e)}Ua(e,t,r){let i=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,ct(this,e,i??{}),!this.h)return this.u}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"stylized_image");let t=new qe;ot(t,x2,this.j);let r=new we;Xe(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Ke(e,r),this.g.ba("stylized_image",(i,o)=>{var n=!this.h,s=i.data,a=i.width;let c=a*(i=i.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let d=0;d<c;++d)l[4*d]=s[3*d],l[4*d+1]=s[3*d+1],l[4*d+2]=s[3*d+2],l[4*d+3]=255;s=new ImageData(l,a,i)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,i)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new de([s],!1,!1,this.g.i.canvas,this.M,a,i),this.u=n=n?a.clone():a,this.h&&this.h(n),k(this,o)}),this.g.attachEmptyPacketListener("stylized_image",i=>{this.u=null,this.h&&this.h(null),k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};ht.prototype.stylize=ht.prototype.Ua,ht.prototype.setOptions=ht.prototype.o,ht.createFromModelPath=function(e,t){return T(ht,e,{baseOptions:{modelAssetPath:t}})},ht.createFromModelBuffer=function(e,t){return T(ht,e,{baseOptions:{modelAssetBuffer:t}})},ht.createFromOptions=function(e,t){return T(ht,e,t)};var Dh=st([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 gd(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function yd(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 vd(e,t=!0){let r=[];for(let o of e){var i=ja(o);e=[];for(let n of i.g())i=t&&Ge(n,1)!=null?gt(Ge(n,1)):-1,e.push({score:he(n,2)??0,index:i,categoryName:We(n,3)??""??"",displayName:We(n,4)??""??""});r.push(e)}return r}var De=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],A(e=this.v=new ah,0,1,t=new J),this.B=new Ga,A(this.v,0,2,this.B),this.u=new oh,A(this.B,0,3,this.u),this.h=new rh,A(this.B,0,2,this.h),this.j=new C2,A(this.v,0,3,this.j),_(this.h,2,.5),_(this.B,4,.5),_(this.u,2,.5)}get baseOptions(){return P(this.v,J,1)}set baseOptions(e){A(this.v,0,1,e)}o(e){if(yt(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.B,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.u,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Pr,r=t,i=ta(e.cannedGesturesClassifierOptions,P(this.j,Pr,3)?.h());A(r,0,2,i),A(this.j,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&P(this.j,Pr,3)?.g();return e.customGesturesClassifierOptions?(A(r=t=new Pr,0,2,i=ta(e.customGesturesClassifierOptions,P(this.j,Pr,4)?.h())),A(this.j,0,4,t)):e.customGesturesClassifierOptions===void 0&&P(this.j,Pr,4)?.g(),this.l(e)}Pa(e,t){return gd(this),ct(this,e,t),yd(this)}Qa(e,t,r){return gd(this),Mt(this,e,r,t),yd(this)}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"hand_gestures"),z(e,"hand_landmarks"),z(e,"world_hand_landmarks"),z(e,"handedness");let t=new qe;ot(t,I2,this.v);let r=new we;Xe(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"HAND_GESTURES:hand_gestures"),B(r,"LANDMARKS:hand_landmarks"),B(r,"WORLD_LANDMARKS:world_hand_landmarks"),B(r,"HANDEDNESS:handedness"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,o)=>{for(let n of i){i=fn(n);let s=[];for(let a of Bt(i,Mu,1))s.push({x:he(a,1)??0,y:he(a,2)??0,z:he(a,3)??0});this.landmarks.push(s)}k(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{k(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,o)=>{for(let n of i){i=Va(n);let s=[];for(let a of Bt(i,Fu,1))s.push({x:he(a,1)??0,y:he(a,2)??0,z:he(a,3)??0});this.worldLandmarks.push(s)}k(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{k(this,i)}),this.g.attachProtoVectorListener("hand_gestures",(i,o)=>{this.gestures.push(...vd(i,!1)),k(this,o)}),this.g.attachEmptyPacketListener("hand_gestures",i=>{k(this,i)}),this.g.attachProtoVectorListener("handedness",(i,o)=>{this.handedness.push(...vd(i)),k(this,o)}),this.g.attachEmptyPacketListener("handedness",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function bd(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}De.prototype.recognizeForVideo=De.prototype.Qa,De.prototype.recognize=De.prototype.Pa,De.prototype.setOptions=De.prototype.o,De.createFromModelPath=function(e,t){return T(De,e,{baseOptions:{modelAssetPath:t}})},De.createFromModelBuffer=function(e,t){return T(De,e,{baseOptions:{modelAssetBuffer:t}})},De.createFromOptions=function(e,t){return T(De,e,t)},De.HAND_CONNECTIONS=Dh;var Oe=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],A(e=this.j=new Ga,0,1,t=new J),this.u=new oh,A(this.j,0,3,this.u),this.h=new rh,A(this.j,0,2,this.h),yt(this.h,3,1),_(this.h,2,.5),_(this.u,2,.5),_(this.j,4,.5)}get baseOptions(){return P(this.j,J,1)}set baseOptions(e){A(this.j,0,1,e)}o(e){return"numHands"in e&&yt(this.h,3,e.numHands??1),"minHandDetectionConfidence"in e&&_(this.h,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.j,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&_(this.u,2,e.minHandPresenceConfidence??.5),this.l(e)}G(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ct(this,e,t),bd(this)}H(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Mt(this,e,r,t),bd(this)}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"hand_landmarks"),z(e,"world_hand_landmarks"),z(e,"handedness");let t=new qe;ot(t,P2,this.j);let r=new we;Xe(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"LANDMARKS:hand_landmarks"),B(r,"WORLD_LANDMARKS:world_hand_landmarks"),B(r,"HANDEDNESS:handedness"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("hand_landmarks",(i,o)=>{for(let n of i)i=fn(n),this.landmarks.push(qa(i));k(this,o)}),this.g.attachEmptyPacketListener("hand_landmarks",i=>{k(this,i)}),this.g.attachProtoVectorListener("world_hand_landmarks",(i,o)=>{for(let n of i)i=Va(n),this.worldLandmarks.push(vh(i));k(this,o)}),this.g.attachEmptyPacketListener("world_hand_landmarks",i=>{k(this,i)}),this.g.attachProtoVectorListener("handedness",(i,o)=>{var n=this.handedness,s=n.push;let a=[];for(let c of i){i=ja(c);let l=[];for(let d of i.g())l.push({score:he(d,2)??0,index:gt(Ge(d,1))??-1,categoryName:We(d,3)??""??"",displayName:We(d,4)??""??""});a.push(l)}s.call(n,...a),k(this,o)}),this.g.attachEmptyPacketListener("handedness",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Oe.prototype.detectForVideo=Oe.prototype.H,Oe.prototype.detect=Oe.prototype.G,Oe.prototype.setOptions=Oe.prototype.o,Oe.createFromModelPath=function(e,t){return T(Oe,e,{baseOptions:{modelAssetPath:t}})},Oe.createFromModelBuffer=function(e,t){return T(Oe,e,{baseOptions:{modelAssetBuffer:t}})},Oe.createFromOptions=function(e,t){return T(Oe,e,t)},Oe.HAND_CONNECTIONS=Dh;var Ve=class extends Me{constructor(e,t){super(new at(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},A(e=this.h=new ch,0,1,t=new J)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return A(this.h,0,2,ta(e,P(this.h,gn,2))),this.l(e)}ya(e,t){return this.j={classifications:[]},ct(this,e,t),this.j}za(e,t,r){return this.j={classifications:[]},Mt(this,e,r,t),this.j}m(){var e=new Te;H(e,"input_image"),H(e,"norm_rect"),z(e,"classifications");let t=new qe;ot(t,R2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),N(r,"IMAGE:input_image"),N(r,"NORM_RECT:norm_rect"),B(r,"CLASSIFICATIONS:classifications"),r.o(t),Ke(e,r),this.g.attachProtoListener("classifications",(i,o)=>{this.j=function(n){let s={classifications:Bt(n,m2,1).map(a=>gh(P(a,Na,4)?.g()??[],gt(Ge(a,2)),We(a,3)??""))};return Yo(Mr(n,2))!=null&&(s.timestampMs=gt(Yo(Mr(n,2)))),s}(g2(i)),k(this,o)}),this.g.attachEmptyPacketListener("classifications",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ve.prototype.classifyForVideo=Ve.prototype.za,Ve.prototype.classify=Ve.prototype.ya,Ve.prototype.setOptions=Ve.prototype.o,Ve.createFromModelPath=function(e,t){return T(Ve,e,{baseOptions:{modelAssetPath:t}})},Ve.createFromModelBuffer=function(e,t){return T(Ve,e,{baseOptions:{modelAssetBuffer:t}})},Ve.createFromOptions=function(e,t){return T(Ve,e,t)};var Fe=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!0),this.h=new lh,this.embeddings={embeddings:[]},A(e=this.h,0,1,t=new J)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){var t=this.h,r=P(this.h,Jl,2);return r=r?r.clone():new Jl,e.l2Normalize!==void 0?Ti(r,1,e.l2Normalize):"l2Normalize"in e&&U(r,1),e.quantize!==void 0?Ti(r,2,e.quantize):"quantize"in e&&U(r,2),A(t,0,2,r),this.l(e)}Fa(e,t){return ct(this,e,t),this.embeddings}Ga(e,t,r){return Mt(this,e,r,t),this.embeddings}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"embeddings_out");let t=new qe;ot(t,D2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"EMBEDDINGS:embeddings_out"),r.o(t),Ke(e,r),this.g.attachProtoListener("embeddings_out",(i,o)=>{i=w2(i),this.embeddings=function(n){return{embeddings:Bt(n,v2,1).map(s=>{let a={headIndex:gt(Ge(s,3))??-1,headName:We(s,4)??""??""};if(ou(s,Qs,Ms(s,1))!==void 0)s=Ir(s=P(s,Qs,Ms(s,1)),1,Zt),a.floatEmbedding=s;else{let c=new Uint8Array(0);a.quantizedEmbedding=P(s,y2,Ms(s,2))?.ua()?.wa()??c}return a}),timestampMs:gt(Yo(Mr(n,2)))}}(i),k(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fe.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Ql(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Ql(Zl(e.quantizedEmbedding),Zl(t.quantizedEmbedding))}return e},Fe.prototype.embedForVideo=Fe.prototype.Ga,Fe.prototype.embed=Fe.prototype.Fa,Fe.prototype.setOptions=Fe.prototype.o,Fe.createFromModelPath=function(e,t){return T(Fe,e,{baseOptions:{modelAssetPath:t}})},Fe.createFromModelBuffer=function(e,t){return T(Fe,e,{baseOptions:{modelAssetBuffer:t}})},Fe.createFromOptions=function(e,t){return T(Fe,e,t)};var sa=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 wd(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function Sd(e){try{let t=new sa(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{Xa(e)}}sa.prototype.close=sa.prototype.close;var Ee=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!1),this.u=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Ha,this.v=new dh,A(this.h,0,3,this.v),A(e=this.h,0,1,t=new J)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?U(this.h,2,Mi(e.displayNamesLocale)):"displayNamesLocale"in e&&U(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}N(){(function(e){let t=Bt(e.da(),we,1).filter(r=>(We(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&&(P(t[0],qe,7)?.l()?.g()??new Map).forEach((r,i)=>{e.u[Number(i)]=We(r,1)??""})})(this)}ea(e,t,r){let i=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,wd(this),ct(this,e,i),Sd(this)}Sa(e,t,r,i){let o=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:i,wd(this),Mt(this,e,o,t),Sd(this)}Ja(){return this.u}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect");let t=new qe;ot(t,hh,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),r.o(t),Ke(e,r),$a(this,e),this.outputConfidenceMasks&&(z(e,"confidence_masks"),B(r,"CONFIDENCE_MASKS:confidence_masks"),Pi(this,"confidence_masks"),this.g.ca("confidence_masks",(i,o)=>{this.confidenceMasks=i.map(n=>Ri(this,n,!0,!this.j)),k(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],k(this,i)})),this.outputCategoryMask&&(z(e,"category_mask"),B(r,"CATEGORY_MASK:category_mask"),Pi(this,"category_mask"),this.g.ba("category_mask",(i,o)=>{this.categoryMask=Ri(this,i,!1,!this.j),k(this,o)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,k(this,i)})),z(e,"quality_scores"),B(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,o)=>{this.qualityScores=i,k(this,o)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ee.prototype.getLabels=Ee.prototype.Ja,Ee.prototype.segmentForVideo=Ee.prototype.Sa,Ee.prototype.segment=Ee.prototype.ea,Ee.prototype.setOptions=Ee.prototype.o,Ee.createFromModelPath=function(e,t){return T(Ee,e,{baseOptions:{modelAssetPath:t}})},Ee.createFromModelBuffer=function(e,t){return T(Ee,e,{baseOptions:{modelAssetBuffer:t}})},Ee.createFromOptions=function(e,t){return T(Ee,e,t)};var aa=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};aa.prototype.close=aa.prototype.close;var K2=class extends b{constructor(e){super(e)}},jr=[0,Y,-2],J2=[0,Ft,-3,te],bn=[0,Ft,-3,te,Ft,-1],Oh=[0,bn],Y2=[0,Oh,jr],Z2=[0,bn,jr],Fh=[0,bn,Y,-1],Q2=[0,Fh,jr],eg=[0,Ft,-3,te,jr,-1],tg=[0,Ft,-3,te,vt],js=class extends b{constructor(e){super(e)}},kd=[0,Ft,-1,te],Bh=class extends b{constructor(){super()}};Bh.A=[1];var Ed=class extends b{constructor(e){super(e)}},ca=[1,2,3,4,5,6,7,8,9,10,14,15],rg=[0,ca,V,bn,V,Z2,V,Oh,V,Y2,V,kd,V,tg,V,J2,V,[0,j,Ft,-2,te,Y,te,-1,2,Ft,jr],V,Fh,V,Q2,Ft,jr,j,V,eg,V,[0,ae,kd]],ig=[0,j,Y,-1,te],la=class extends b{constructor(){super()}};la.A=[1],la.prototype.g=La([0,ae,rg,j,ig]);var pt=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new Ha,this.v=new dh,A(this.h,0,3,this.v),A(e=this.h,0,1,t=new J)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(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)}ea(e,t,r,i){let o=typeof r!="function"?r:{};this.j=typeof r=="function"?r:i,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.I+1,i=new la;let n=new Ed;var s=new K2;if(yt(s,1,255),A(n,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new js;Ti(a,3,!0),_(a,1,t.keypoint.x),_(a,2,t.keypoint.y),ki(n,5,ca,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new Bh,t.scribble))Ti(t=new js,3,!0),_(t,1,a.x),_(t,2,a.y),Ys(s,js,t);ki(n,15,ca,s)}Ys(i,Ed,n),this.g.addProtoToStream(i.g(),"drishti.RenderData","roi_in",r),ct(this,e,o);e:{try{let l=new aa(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{Xa(this)}c=void 0}return c}m(){var e=new Te;H(e,"image_in"),H(e,"roi_in"),H(e,"norm_rect_in");let t=new qe;ot(t,hh,this.h);let r=new we;Xe(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),Ke(e,r),$a(this,e),this.outputConfidenceMasks&&(z(e,"confidence_masks"),B(r,"CONFIDENCE_MASKS:confidence_masks"),Pi(this,"confidence_masks"),this.g.ca("confidence_masks",(i,o)=>{this.confidenceMasks=i.map(n=>Ri(this,n,!0,!this.j)),k(this,o)}),this.g.attachEmptyPacketListener("confidence_masks",i=>{this.confidenceMasks=[],k(this,i)})),this.outputCategoryMask&&(z(e,"category_mask"),B(r,"CATEGORY_MASK:category_mask"),Pi(this,"category_mask"),this.g.ba("category_mask",(i,o)=>{this.categoryMask=Ri(this,i,!1,!this.j),k(this,o)}),this.g.attachEmptyPacketListener("category_mask",i=>{this.categoryMask=void 0,k(this,i)})),z(e,"quality_scores"),B(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(i,o)=>{this.qualityScores=i,k(this,o)}),this.g.attachEmptyPacketListener("quality_scores",i=>{this.categoryMask=void 0,k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};pt.prototype.segment=pt.prototype.ea,pt.prototype.setOptions=pt.prototype.o,pt.createFromModelPath=function(e,t){return T(pt,e,{baseOptions:{modelAssetPath:t}})},pt.createFromModelBuffer=function(e,t){return T(pt,e,{baseOptions:{modelAssetBuffer:t}})},pt.createFromOptions=function(e,t){return T(pt,e,t)};var _e=class extends Me{constructor(e,t){super(new at(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},A(e=this.h=new Wa,0,1,t=new J)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?U(this.h,2,Mi(e.displayNamesLocale)):"displayNamesLocale"in e&&U(this.h,2),e.maxResults!==void 0?yt(this.h,3,e.maxResults):"maxResults"in e&&U(this.h,3),e.scoreThreshold!==void 0?_(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&U(this.h,4),e.categoryAllowlist!==void 0?en(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&U(this.h,5),e.categoryDenylist!==void 0?en(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&U(this.h,6),this.l(e)}G(e,t){return this.j={detections:[]},ct(this,e,t),this.j}H(e,t,r){return this.j={detections:[]},Mt(this,e,r,t),this.j}m(){var e=new Te;H(e,"input_frame_gpu"),H(e,"norm_rect"),z(e,"detections");let t=new qe;ot(t,F2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),N(r,"IMAGE:input_frame_gpu"),N(r,"NORM_RECT:norm_rect"),B(r,"DETECTIONS:detections"),r.o(t),Ke(e,r),this.g.attachProtoVectorListener("detections",(i,o)=>{for(let n of i)i=Ou(n),this.j.detections.push(yh(i));k(this,o)}),this.g.attachEmptyPacketListener("detections",i=>{k(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};_e.prototype.detectForVideo=_e.prototype.H,_e.prototype.detect=_e.prototype.G,_e.prototype.setOptions=_e.prototype.o,_e.createFromModelPath=async function(e,t){return T(_e,e,{baseOptions:{modelAssetPath:t}})},_e.createFromModelBuffer=function(e,t){return T(_e,e,{baseOptions:{modelAssetBuffer:t}})},_e.createFromOptions=function(e,t){return T(_e,e,t)};function Ad(e){e.landmarks=[],e.worldLandmarks=[],e.v=void 0}function _d(e){try{let t=new class{constructor(r,i,o){this.landmarks=r,this.worldLandmarks=i,this.g=o}close(){this.g?.forEach(r=>{r.close()})}}(e.landmarks,e.worldLandmarks,e.v);if(!e.u)return t;e.u(t)}finally{Xa(e)}}var Be=class extends Me{constructor(e,t){super(new at(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,A(e=this.h=new fh,0,1,t=new J),this.B=new M2,A(this.h,0,3,this.B),this.j=new B2,A(this.h,0,2,this.j),yt(this.j,4,1),_(this.j,2,.5),_(this.B,2,.5),_(this.h,4,.5)}get baseOptions(){return P(this.h,J,1)}set baseOptions(e){A(this.h,0,1,e)}o(e){return"numPoses"in e&&yt(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&_(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&_(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&_(this.B,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}G(e,t,r){let i=typeof t!="function"?t:{};return this.u=typeof t=="function"?t:r,Ad(this),ct(this,e,i),_d(this)}H(e,t,r,i){let o=typeof r!="function"?r:{};return this.u=typeof r=="function"?r:i,Ad(this),Mt(this,e,o,t),_d(this)}m(){var e=new Te;H(e,"image_in"),H(e,"norm_rect"),z(e,"normalized_landmarks"),z(e,"world_landmarks"),z(e,"segmentation_masks");let t=new qe;ot(t,L2,this.h);let r=new we;Xe(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),N(r,"IMAGE:image_in"),N(r,"NORM_RECT:norm_rect"),B(r,"NORM_LANDMARKS:normalized_landmarks"),B(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Ke(e,r),$a(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(i,o)=>{this.landmarks=[];for(let n of i)i=fn(n),this.landmarks.push(qa(i));k(this,o)}),this.g.attachEmptyPacketListener("normalized_landmarks",i=>{this.landmarks=[],k(this,i)}),this.g.attachProtoVectorListener("world_landmarks",(i,o)=>{this.worldLandmarks=[];for(let n of i)i=Va(n),this.worldLandmarks.push(vh(i));k(this,o)}),this.g.attachEmptyPacketListener("world_landmarks",i=>{this.worldLandmarks=[],k(this,i)}),this.outputSegmentationMasks&&(B(r,"SEGMENTATION_MASK:segmentation_masks"),Pi(this,"segmentation_masks"),this.g.ca("segmentation_masks",(i,o)=>{this.v=i.map(n=>Ri(this,n,!0,!this.u)),k(this,o)}),this.g.attachEmptyPacketListener("segmentation_masks",i=>{this.v=[],k(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Be.prototype.detectForVideo=Be.prototype.H,Be.prototype.detect=Be.prototype.G,Be.prototype.setOptions=Be.prototype.o,Be.createFromModelPath=function(e,t){return T(Be,e,{baseOptions:{modelAssetPath:t}})},Be.createFromModelBuffer=function(e,t){return T(Be,e,{baseOptions:{modelAssetBuffer:t}})},Be.createFromOptions=function(e,t){return T(Be,e,t)},Be.POSE_CONNECTIONS=st([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]);var $r=class{constructor(t,r,i,o,n="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=n,this.classDiv=s,o&&(this.paramsConfig=o),i&&(this.options=i)}async initializeDetector(){let t=await Rr.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Ae:_e).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
42
42
  width: 20rem;
43
43
  border-radius: 10px;
44
44
  position: absolute;
@@ -55,22 +55,22 @@
55
55
  border-radius: 50%;
56
56
  display: block;
57
57
  }
58
- `,document.getElementsByTagName("head")[0].appendChild(i)}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let i=this.detector.detectForVideo(this.video,r);this.verify(i)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r}),this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";default:return t}}};function Ah(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Gr=class extends zr{constructor(r,i,o="videoPreviewFrameDetection",n="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,i,o,n);this.emmitedPositionAlert=!1}displayVideoDetections(r){for(let i of this.children)this.liveView.removeChild(i);this.children.splice(0);for(let i of r.detections){let o=window.innerWidth,n=window.innerHeight,s=this.video.offsetWidth,a=this.video.offsetHeight,c=s/o,l=a/n,u=s-i.boundingBox.width*c-i.boundingBox.originX*c,d=i.boundingBox.originY*l,f=(i.boundingBox.width-10)*c,m=i.boundingBox.height*l,h=document.createElement("p");h.innerText="Confidence: "+Math.round(parseFloat(i.categories[0].score)*100)+"% .",h.style.right=u+"px",h.style.top=d-50+"px",h.style.width=f+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(h.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let y=document.createElement("div");y.setAttribute("class","highlighter"),y.style.right=u+"px",y.style.top=d+"px",y.style.width=f+"px",y.style.height=m-10+"px",Object.assign(y.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(h),this.children.push(y),this.children.push(h);for(let _ of i.keypoints){let v=document.createElement("spam");v.className="key-point",v.style.top=`${_.y*this.video.offsetHeight-3}px`,v.style.right=`${this.video.offsetWidth-_.x*this.video.offsetWidth-3}px`,this.liveView.appendChild(v),this.children.push(v)}}}verify(r){this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent&&(this.numFacesSent=r.detections.length,r.detections.length===0?this.handleAlert("no_face_detected","face_detection_on_stream"):r.detections.length>1?this.handleAlert("multiple_faces_detected","face_detection_on_stream"):this.handleOk("face_ok","face_detection_on_stream")),r.detections[0]?.keypoints[4].x<.2||r.detections[0]?.keypoints[5].x>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};var at={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1};function dn(e){return!!e.width&&!!e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var Th={width:1280,height:720,minWidth:640,minHeight:480};function Mi(e,t){return function(){return e.apply(t,arguments)}}var{toString:$2}=Object.prototype,{getPrototypeOf:Ha}=Object,pn=(e=>t=>{let r=$2.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),wt=e=>(e=e.toLowerCase(),t=>pn(t)===e),fn=e=>t=>typeof t===e,{isArray:Hr}=Array,Ui=fn("undefined");function q2(e){return e!==null&&!Ui(e)&&e.constructor!==null&&!Ui(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Ph=wt("ArrayBuffer");function X2(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ph(e.buffer),t}var K2=fn("string"),Je=fn("function"),Rh=fn("number"),mn=e=>e!==null&&typeof e=="object",J2=e=>e===!0||e===!1,hn=e=>{if(pn(e)!=="object")return!1;let t=Ha(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Y2=wt("Date"),Z2=wt("File"),Q2=wt("Blob"),e0=wt("FileList"),t0=e=>mn(e)&&Je(e.pipe),r0=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Je(e.append)&&((t=pn(e))==="formdata"||t==="object"&&Je(e.toString)&&e.toString()==="[object FormData]"))},i0=wt("URLSearchParams"),o0=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Li(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),Hr(e))for(i=0,o=e.length;i<o;i++)t.call(null,e[i],i,e);else{let n=r?Object.getOwnPropertyNames(e):Object.keys(e),s=n.length,a;for(i=0;i<s;i++)a=n[i],t.call(null,e[a],a,e)}}function Ih(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,o;for(;i-- >0;)if(o=r[i],t===o.toLowerCase())return o;return null}var Oh=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Dh=e=>!Ui(e)&&e!==Oh;function Ga(){let{caseless:e}=Dh(this)&&this||{},t={},r=(i,o)=>{let n=e&&Ih(t,o)||o;hn(t[n])&&hn(i)?t[n]=Ga(t[n],i):hn(i)?t[n]=Ga({},i):Hr(i)?t[n]=i.slice():t[n]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&Li(arguments[i],r);return t}var n0=(e,t,r,{allOwnKeys:i}={})=>(Li(t,(o,n)=>{r&&Je(o)?e[n]=Mi(o,r):e[n]=o},{allOwnKeys:i}),e),s0=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),a0=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},c0=(e,t,r,i)=>{let o,n,s,a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),n=o.length;n-- >0;)s=o[n],(!i||i(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Ha(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},l0=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},u0=e=>{if(!e)return null;if(Hr(e))return e;let t=e.length;if(!Rh(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},d0=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ha(Uint8Array)),h0=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),o;for(;(o=i.next())&&!o.done;){let n=o.value;t.call(e,n[0],n[1])}},p0=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},f0=wt("HTMLFormElement"),m0=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,o){return i.toUpperCase()+o}),xh=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),g0=wt("RegExp"),Fh=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};Li(r,(o,n)=>{let s;(s=t(o,n,e))!==!1&&(i[n]=s||o)}),Object.defineProperties(e,i)},y0=e=>{Fh(e,(t,r)=>{if(Je(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(!!Je(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},v0=(e,t)=>{let r={},i=o=>{o.forEach(n=>{r[n]=!0})};return Hr(e)?i(e):i(String(e).split(t)),r},b0=()=>{},w0=(e,t)=>(e=+e,Number.isFinite(e)?e:t),za="abcdefghijklmnopqrstuvwxyz",Ch="0123456789",Bh={DIGIT:Ch,ALPHA:za,ALPHA_DIGIT:za+za.toUpperCase()+Ch},S0=(e=16,t=Bh.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function k0(e){return!!(e&&Je(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var E0=e=>{let t=new Array(10),r=(i,o)=>{if(mn(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let n=Hr(i)?[]:{};return Li(i,(s,a)=>{let c=r(s,o+1);!Ui(c)&&(n[a]=c)}),t[o]=void 0,n}}return i};return r(e,0)},_0=wt("AsyncFunction"),A0=e=>e&&(mn(e)||Je(e))&&Je(e.then)&&Je(e.catch),p={isArray:Hr,isArrayBuffer:Ph,isBuffer:q2,isFormData:r0,isArrayBufferView:X2,isString:K2,isNumber:Rh,isBoolean:J2,isObject:mn,isPlainObject:hn,isUndefined:Ui,isDate:Y2,isFile:Z2,isBlob:Q2,isRegExp:g0,isFunction:Je,isStream:t0,isURLSearchParams:i0,isTypedArray:d0,isFileList:e0,forEach:Li,merge:Ga,extend:n0,trim:o0,stripBOM:s0,inherits:a0,toFlatObject:c0,kindOf:pn,kindOfTest:wt,endsWith:l0,toArray:u0,forEachEntry:h0,matchAll:p0,isHTMLForm:f0,hasOwnProperty:xh,hasOwnProp:xh,reduceDescriptors:Fh,freezeMethods:y0,toObjectSet:v0,toCamelCase:m0,noop:b0,toFiniteNumber:w0,findKey:Ih,global:Oh,isContextDefined:Dh,ALPHABET:Bh,generateString:S0,isSpecCompliantForm:k0,toJSONObject:E0,isAsyncFn:_0,isThenable:A0};function Wr(e,t,r,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),o&&(this.response=o)}p.inherits(Wr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Mh=Wr.prototype,Uh={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Uh[e]={value:e}});Object.defineProperties(Wr,Uh);Object.defineProperty(Mh,"isAxiosError",{value:!0});Wr.from=(e,t,r,i,o,n)=>{let s=Object.create(Mh);return p.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Wr.call(s,e.message,t,r,i,o),s.cause=e,s.name=e.name,n&&Object.assign(s,n),s};var x=Wr;var gn=null;function Wa(e){return p.isPlainObject(e)||p.isArray(e)}function Nh(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function Lh(e,t,r){return e?e.concat(t).map(function(o,n){return o=Nh(o),!r&&n?"["+o+"]":o}).join(r?".":""):t}function T0(e){return p.isArray(e)&&!e.some(Wa)}var x0=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function C0(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new(gn||FormData),r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!p.isUndefined(y[g])});let i=r.metaTokens,o=r.visitor||u,n=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(p.isDate(h))return h.toISOString();if(!c&&p.isBlob(h))throw new x("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(h)||p.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function u(h,g,y){let _=h;if(h&&!y&&typeof h=="object"){if(p.endsWith(g,"{}"))g=i?g:g.slice(0,-2),h=JSON.stringify(h);else if(p.isArray(h)&&T0(h)||(p.isFileList(h)||p.endsWith(g,"[]"))&&(_=p.toArray(h)))return g=Nh(g),_.forEach(function(T,q){!(p.isUndefined(T)||T===null)&&t.append(s===!0?Lh([g],q,n):s===null?g:g+"[]",l(T))}),!1}return Wa(h)?!0:(t.append(Lh(y,g,n),l(h)),!1)}let d=[],f=Object.assign(x0,{defaultVisitor:u,convertValue:l,isVisitable:Wa});function m(h,g){if(!p.isUndefined(h)){if(d.indexOf(h)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(h),p.forEach(h,function(_,v){(!(p.isUndefined(_)||_===null)&&o.call(t,_,p.isString(v)?v.trim():v,g,f))===!0&&m(_,g?g.concat(v):[v])}),d.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return m(e),t}var Yt=C0;function jh(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Vh(e,t){this._pairs=[],e&&Yt(e,this,t)}var zh=Vh.prototype;zh.append=function(t,r){this._pairs.push([t,r])};zh.toString=function(t){let r=t?function(i){return t.call(this,i,jh)}:jh;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var yn=Vh;function P0(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ni(e,t,r){if(!t)return e;let i=r&&r.encode||P0,o=r&&r.serialize,n;if(o?n=o(t,r):n=p.isURLSearchParams(t)?t.toString():new yn(t,r).toString(i),n){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}var $a=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(i){i!==null&&t(i)})}},qa=$a;var vn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Gh=typeof URLSearchParams<"u"?URLSearchParams:yn;var Hh=typeof FormData<"u"?FormData:null;var Wh=typeof Blob<"u"?Blob:null;var R0=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),I0=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),de={isBrowser:!0,classes:{URLSearchParams:Gh,FormData:Hh,Blob:Wh},isStandardBrowserEnv:R0,isStandardBrowserWebWorkerEnv:I0,protocols:["http","https","file","blob","url","data"]};function Xa(e,t){return Yt(e,new de.classes.URLSearchParams,Object.assign({visitor:function(r,i,o,n){return de.isNode&&p.isBuffer(r)?(this.append(i,r.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}function O0(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function D0(e){let t={},r=Object.keys(e),i,o=r.length,n;for(i=0;i<o;i++)n=r[i],t[n]=e[n];return t}function F0(e){function t(r,i,o,n){let s=r[n++],a=Number.isFinite(+s),c=n>=r.length;return s=!s&&p.isArray(o)?o.length:s,c?(p.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!a):((!o[s]||!p.isObject(o[s]))&&(o[s]=[]),t(r,i,o[s],n)&&p.isArray(o[s])&&(o[s]=D0(o[s])),!a)}if(p.isFormData(e)&&p.isFunction(e.entries)){let r={};return p.forEachEntry(e,(i,o)=>{t(O0(i),o,r,0)}),r}return null}var bn=F0;function B0(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Ka={transitional:vn,adapter:de.isNode?"http":"xhr",transformRequest:[function(t,r){let i=r.getContentType()||"",o=i.indexOf("application/json")>-1,n=p.isObject(t);if(n&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o&&o?JSON.stringify(bn(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Xa(t,this.formSerializer).toString();if((a=p.isFileList(t))||i.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Yt(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return n||o?(r.setContentType("application/json",!1),B0(t)):t}],transformResponse:[function(t){let r=this.transitional||Ka.transitional,i=r&&r.forcedJSONParsing,o=this.responseType==="json";if(t&&p.isString(t)&&(i&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?x.from(a,x.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:de.classes.FormData,Blob:de.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{Ka.headers[e]={}});var $r=Ka;var M0=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$h=e=>{let t={},r,i,o;return e&&e.split(`
59
- `).forEach(function(s){o=s.indexOf(":"),r=s.substring(0,o).trim().toLowerCase(),i=s.substring(o+1).trim(),!(!r||t[r]&&M0[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var qh=Symbol("internals");function ji(e){return e&&String(e).trim().toLowerCase()}function wn(e){return e===!1||e==null?e:p.isArray(e)?e.map(wn):String(e)}function U0(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var L0=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ja(e,t,r,i,o){if(p.isFunction(i))return i.call(this,t,r);if(o&&(t=r),!!p.isString(t)){if(p.isString(i))return t.indexOf(i)!==-1;if(p.isRegExp(i))return i.test(t)}}function N0(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function j0(e,t){let r=p.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(o,n,s){return this[i].call(this,t,o,n,s)},configurable:!0})})}var qr=class{constructor(t){t&&this.set(t)}set(t,r,i){let o=this;function n(a,c,l){let u=ji(c);if(!u)throw new Error("header name must be a non-empty string");let d=p.findKey(o,u);(!d||o[d]===void 0||l===!0||l===void 0&&o[d]!==!1)&&(o[d||c]=wn(a))}let s=(a,c)=>p.forEach(a,(l,u)=>n(l,u,c));return p.isPlainObject(t)||t instanceof this.constructor?s(t,r):p.isString(t)&&(t=t.trim())&&!L0(t)?s($h(t),r):t!=null&&n(r,t,i),this}get(t,r){if(t=ji(t),t){let i=p.findKey(this,t);if(i){let o=this[i];if(!r)return o;if(r===!0)return U0(o);if(p.isFunction(r))return r.call(this,o,i);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=ji(t),t){let i=p.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||Ja(this,this[i],i,r)))}return!1}delete(t,r){let i=this,o=!1;function n(s){if(s=ji(s),s){let a=p.findKey(i,s);a&&(!r||Ja(i,i[a],a,r))&&(delete i[a],o=!0)}}return p.isArray(t)?t.forEach(n):n(t),o}clear(t){let r=Object.keys(this),i=r.length,o=!1;for(;i--;){let n=r[i];(!t||Ja(this,this[n],n,t,!0))&&(delete this[n],o=!0)}return o}normalize(t){let r=this,i={};return p.forEach(this,(o,n)=>{let s=p.findKey(i,n);if(s){r[s]=wn(o),delete r[n];return}let a=t?N0(n):String(n).trim();a!==n&&delete r[n],r[a]=wn(o),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return p.forEach(this,(i,o)=>{i!=null&&i!==!1&&(r[o]=t&&p.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
60
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(o=>i.set(o)),i}static accessor(t){let i=(this[qh]=this[qh]={accessors:{}}).accessors,o=this.prototype;function n(s){let a=ji(s);i[a]||(j0(o,s),i[a]=!0)}return p.isArray(t)?t.forEach(n):n(t),this}};qr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(qr.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});p.freezeMethods(qr);var we=qr;function Vi(e,t){let r=this||$r,i=t||r,o=we.from(i.headers),n=i.data;return p.forEach(e,function(a){n=a.call(r,n,o.normalize(),t?t.status:void 0)}),o.normalize(),n}function zi(e){return!!(e&&e.__CANCEL__)}function Xh(e,t,r){x.call(this,e??"canceled",x.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(Xh,x,{__CANCEL__:!0});var Zt=Xh;function Ya(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new x("Request failed with status code "+r.status,[x.ERR_BAD_REQUEST,x.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var Kh=de.isStandardBrowserEnv?function(){return{write:function(r,i,o,n,s,a){let c=[];c.push(r+"="+encodeURIComponent(i)),p.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),p.isString(n)&&c.push("path="+n),p.isString(s)&&c.push("domain="+s),a===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){let i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Za(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qa(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Gi(e,t){return e&&!Za(t)?Qa(e,t):t}var Jh=de.isStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),i;function o(n){let s=n;return t&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=o(window.location.href),function(s){let a=p.isString(s)?o(s):s;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function ec(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function V0(e,t){e=e||10;let r=new Array(e),i=new Array(e),o=0,n=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),u=i[n];s||(s=l),r[o]=c,i[o]=l;let d=n,f=0;for(;d!==o;)f+=r[d++],d=d%e;if(o=(o+1)%e,o===n&&(n=(n+1)%e),l-s<t)return;let m=u&&l-u;return m?Math.round(f*1e3/m):void 0}}var Yh=V0;function Zh(e,t){let r=0,i=Yh(50,250);return o=>{let n=o.loaded,s=o.lengthComputable?o.total:void 0,a=n-r,c=i(a),l=n<=s;r=n;let u={loaded:n,total:s,progress:s?n/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&l?(s-n)/c:void 0,event:o};u[t?"download":"upload"]=!0,e(u)}}var z0=typeof XMLHttpRequest<"u",Qh=z0&&function(e){return new Promise(function(r,i){let o=e.data,n=we.from(e.headers).normalize(),s=e.responseType,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}p.isFormData(o)&&(de.isStandardBrowserEnv||de.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(e.auth){let m=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(m+":"+h))}let u=Gi(e.baseURL,e.url);l.open(e.method.toUpperCase(),Ni(u,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function d(){if(!l)return;let m=we.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),g={data:!s||s==="text"||s==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:m,config:e,request:l};Ya(function(_){r(_),c()},function(_){i(_),c()},g),l=null}if("onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(d)},l.onabort=function(){!l||(i(new x("Request aborted",x.ECONNABORTED,e,l)),l=null)},l.onerror=function(){i(new x("Network Error",x.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let h=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||vn;e.timeoutErrorMessage&&(h=e.timeoutErrorMessage),i(new x(h,g.clarifyTimeoutError?x.ETIMEDOUT:x.ECONNABORTED,e,l)),l=null},de.isStandardBrowserEnv){let m=(e.withCredentials||Jh(u))&&e.xsrfCookieName&&Kh.read(e.xsrfCookieName);m&&n.set(e.xsrfHeaderName,m)}o===void 0&&n.setContentType(null),"setRequestHeader"in l&&p.forEach(n.toJSON(),function(h,g){l.setRequestHeader(g,h)}),p.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),s&&s!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",Zh(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",Zh(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=m=>{!l||(i(!m||m.type?new Zt(null,e,l):m),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));let f=ec(u);if(f&&de.protocols.indexOf(f)===-1){i(new x("Unsupported protocol "+f+":",x.ERR_BAD_REQUEST,e));return}l.send(o||null)})};var Sn={http:gn,xhr:Qh};p.forEach(Sn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var kn={getAdapter:e=>{e=p.isArray(e)?e:[e];let{length:t}=e,r,i;for(let o=0;o<t&&(r=e[o],!(i=p.isString(r)?Sn[r.toLowerCase()]:r));o++);if(!i)throw i===!1?new x(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(p.hasOwnProp(Sn,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`);if(!p.isFunction(i))throw new TypeError("adapter is not a function");return i},adapters:Sn};function tc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Zt(null,e)}function En(e){return tc(e),e.headers=we.from(e.headers),e.data=Vi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),kn.getAdapter(e.adapter||$r.adapter)(e).then(function(i){return tc(e),i.data=Vi.call(e,e.transformResponse,i),i.headers=we.from(i.headers),i},function(i){return zi(i)||(tc(e),i&&i.response&&(i.response.data=Vi.call(e,e.transformResponse,i.response),i.response.headers=we.from(i.response.headers))),Promise.reject(i)})}var ep=e=>e instanceof we?e.toJSON():e;function Ft(e,t){t=t||{};let r={};function i(l,u,d){return p.isPlainObject(l)&&p.isPlainObject(u)?p.merge.call({caseless:d},l,u):p.isPlainObject(u)?p.merge({},u):p.isArray(u)?u.slice():u}function o(l,u,d){if(p.isUndefined(u)){if(!p.isUndefined(l))return i(void 0,l,d)}else return i(l,u,d)}function n(l,u){if(!p.isUndefined(u))return i(void 0,u)}function s(l,u){if(p.isUndefined(u)){if(!p.isUndefined(l))return i(void 0,l)}else return i(void 0,u)}function a(l,u,d){if(d in t)return i(l,u);if(d in e)return i(void 0,l)}let c={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,u)=>o(ep(l),ep(u),!0)};return p.forEach(Object.keys(Object.assign({},e,t)),function(u){let d=c[u]||o,f=d(e[u],t[u],u);p.isUndefined(f)&&d!==a||(r[u]=f)}),r}var _n="1.5.0";var rc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{rc[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});var tp={};rc.transitional=function(t,r,i){function o(n,s){return"[Axios v"+_n+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,a)=>{if(t===!1)throw new x(o(s," has been removed"+(r?" in "+r:"")),x.ERR_DEPRECATED);return r&&!tp[s]&&(tp[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(n,s,a):!0}};function G0(e,t,r){if(typeof e!="object")throw new x("options must be an object",x.ERR_BAD_OPTION_VALUE);let i=Object.keys(e),o=i.length;for(;o-- >0;){let n=i[o],s=t[n];if(s){let a=e[n],c=a===void 0||s(a,n,e);if(c!==!0)throw new x("option "+n+" must be "+c,x.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new x("Unknown option "+n,x.ERR_BAD_OPTION)}}var An={assertOptions:G0,validators:rc};var Qt=An.validators,Xr=class{constructor(t){this.defaults=t,this.interceptors={request:new qa,response:new qa}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ft(this.defaults,r);let{transitional:i,paramsSerializer:o,headers:n}=r;i!==void 0&&An.assertOptions(i,{silentJSONParsing:Qt.transitional(Qt.boolean),forcedJSONParsing:Qt.transitional(Qt.boolean),clarifyTimeoutError:Qt.transitional(Qt.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:An.assertOptions(o,{encode:Qt.function,serialize:Qt.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=n&&p.merge(n.common,n[r.method]);n&&p.forEach(["delete","get","head","post","put","patch","common"],h=>{delete n[h]}),r.headers=we.concat(s,n);let a=[],c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});let l=[];this.interceptors.response.forEach(function(g){l.push(g.fulfilled,g.rejected)});let u,d=0,f;if(!c){let h=[En.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),f=h.length,u=Promise.resolve(r);d<f;)u=u.then(h[d++],h[d++]);return u}f=a.length;let m=r;for(d=0;d<f;){let h=a[d++],g=a[d++];try{m=h(m)}catch(y){g.call(this,y);break}}try{u=En.call(this,m)}catch(h){return Promise.reject(h)}for(d=0,f=l.length;d<f;)u=u.then(l[d++],l[d++]);return u}getUri(t){t=Ft(this.defaults,t);let r=Gi(t.baseURL,t.url);return Ni(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){Xr.prototype[t]=function(r,i){return this.request(Ft(i||{},{method:t,url:r,data:(i||{}).data}))}});p.forEach(["post","put","patch"],function(t){function r(i){return function(n,s,a){return this.request(Ft(a||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Xr.prototype[t]=r(),Xr.prototype[t+"Form"]=r(!0)});var Hi=Xr;var Wi=class{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});let i=this;this.promise.then(o=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](o);i._listeners=null}),this.promise.then=o=>{let n,s=new Promise(a=>{i.subscribe(a),n=a}).then(o);return s.cancel=function(){i.unsubscribe(n)},s},t(function(n,s,a){i.reason||(i.reason=new Zt(n,s,a),r(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new Wi(function(o){t=o}),cancel:t}}},rp=Wi;function ic(e){return function(r){return e.apply(null,r)}}function oc(e){return p.isObject(e)&&e.isAxiosError===!0}var nc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(nc).forEach(([e,t])=>{nc[t]=e});var ip=nc;function op(e){let t=new Hi(e),r=Mi(Hi.prototype.request,t);return p.extend(r,Hi.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return op(Ft(e,o))},r}var te=op($r);te.Axios=Hi;te.CanceledError=Zt;te.CancelToken=rp;te.isCancel=zi;te.VERSION=_n;te.toFormData=Yt;te.AxiosError=x;te.Cancel=te.CanceledError;te.all=function(t){return Promise.all(t)};te.spread=ic;te.isAxiosError=oc;te.mergeConfig=Ft;te.AxiosHeaders=we;te.formToJSON=e=>bn(p.isHTMLForm(e)?new FormData(e):e);te.getAdapter=kn.getAdapter;te.HttpStatusCode=ip;te.default=te;var er=te;var{Axios:Sb,AxiosError:kb,CanceledError:Eb,isCancel:_b,CancelToken:Ab,VERSION:Tb,all:xb,Cancel:Cb,isAxiosError:Pb,spread:Rb,toFormData:Ib,AxiosHeaders:Ob,HttpStatusCode:Db,formToJSON:Fb,getAdapter:Bb,mergeConfig:Mb}=er;var H0="https://proctoring-api-dev.easyproctor.tech/api",W0="https://proctoring-api-hml.easyproctor.tech/api",np="https://proctoring-api.easyproctor.tech/api",Kr=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type),this.token=t.token}selectBaseUrl(t){return t==="dev"?H0:t==="homol"?W0:np}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async confirmStart(t,r,i,o){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r,latitude:i,longitude:o},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(i=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async getSignedUrlImage(t,r){return(await this.makeRequestAxios({path:"/upload/signed-url-batch",method:"POST",jwt:t,body:r})).data}async getSignedUrl(t,r,i){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${i}/${r.name}`,contentType:r.type}})).data}async saveScreenAlerts(t,r){await this.makeRequest({path:"/proctoring/save-screen",method:"POST",jwt:t.token,body:{proctoringId:r.id,alerts:r.alerts}})}async finishAndSendUrls(t,r){await this.makeRequest({path:`/proctoring/finish/${t.examId}`,method:"POST",body:{endDate:new Date().toISOString(),videoCameraUrl:"",audioCameraUrl:"",videoScreenUrl:""},jwt:t.token})}async log(t,r){let i;return r?.success!==null&&r?.success!==void 0?i=r.success?"4":"1":i="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:i,eventName:t,message:r},jwt:this.token})}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:i,body:o,jwt:n}=t,s=await fetch(this.baseUrl+r,{method:i,body:o!=null?JSON.stringify(o):void 0,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}async makeRequestAxios(t){let{path:r,method:i,body:o,jwt:n}=t,s=await er.request({url:this.baseUrl+r,method:i,headers:{Authorization:`Bearer ${n}`,"Access-Control-Allow-Origin":"*"},data:o});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}async makeRequestPUT(t){let{url:r,method:i,body:o,jwt:n}=t,s=await fetch(r,{method:i,body:o!=null?JSON.stringify(o):void 0,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive","aeg-event-type":"Notification","Content-Type":"application/json","Cache-Control":"no-cache","x-ms-blob-type":"BlockBlob"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}};var Tn=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var xn,sp=e=>(xn=e,xn),Ue={START:"start",FINISH:"finish",ERROR:"error",UPLOAD_VIDEO:"upload_video",DOWNLOAD_VIDEO:"download_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",BROWSER_NOT_SUPPORTED:"browser_not_supported",SAVE_ON_SESSION:"save_on_session"},Le=(e,t)=>xn&&xn.log(e,t),R={registerStart:(e,t,r)=>Le(Ue.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>Le(Ue.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>Le(Ue.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>Le(Ue.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,i,o)=>Le(Ue.UPLOAD_VIDEO,{proctoringId:e,success:t,description:r,serviceType:i,uploadTime:o}),registerUploadFile:(e,t,r)=>Le(Ue.UPLOAD_VIDEO,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>Le(Ue.UPLOAD_VIDEO,{proctoringId:e,inOrOut:t,devicesChanged:r}),registerStopSharingScreen:(e,t)=>Le(Ue.UPLOAD_VIDEO,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>Le(Ue.UPLOAD_VIDEO,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>Le(Ue.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>Le(Ue.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>Le(Ue.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>Le(Ue.SAVE_ON_SESSION,{proctoringId:e,description:t})};function mr(e,t,r,i=!1,o,n=!1){let s,a=!1,c,l,u;u=0;let d={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?d.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),n&&(d={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let f=new MediaRecorder(e,d);f.ondataavailable=v=>{u=u+v.data.size,v.data.size>0&&t.push(v.data),a?(n&&f.state=="inactive"&&(t=[new Blob(t,{type:"audio/webm"})]),s&&s()):((l&&v.data.size===l.data.size||v.data.size===0)&&(o&&o(),r&&l&&v.data.size===l.data.size&&R.registerOnBufferSizeError(r,`onBufferSizeError: Recorder size freezed: ${v.data.size} Mb`),r&&v.data.size===0&&R.registerOnBufferSizeError(r,"onBufferSizeError: Recorder size equal 0 Mb")),l=v)};function m(){return new Promise(v=>{s=v,f.start(),u=0,a=!1,i&&(c=setInterval(async()=>{await f.requestData()},3e4))})}function h(){return new Promise(v=>{f.state=="recording"?(s=v,f.stop(),a=!0,clearInterval(c),e.getTracks().forEach(T=>{T.stop()})):v()})}function g(){return new Promise(v=>{f.state=="recording"&&f.pause(),v()})}function y(){return new Promise(v=>{f.state=="paused"&&f.resume(),v()})}function _(){return u}return{startRecording:m,stopRecording:h,pauseRecording:g,resumeRecording:y,options:d,getBufferSize:_}}var Bt=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadImages(t,r,i){let{file:o,onProgress:n}=t;try{let s=l=>{let u=l.loadedBytes/o.size*100;n&&n(Math.round(u))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+60;d++){let f=`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`;(d+1)%i==0&&(f=`${this.proctoringId}/${this.proctoringId}_${d+1}_realtime.jpg`),l.push({objectName:f,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=60}let c=!1;return c=await er.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(l=>l.status==200||l.status==201?(this.contImages++,!0):!1).catch(()=>!1).finally(()=>{}),{storage:"upload",url:a,uploaded:c}}catch{throw R.registerError(this.proctoringId,`Failed to upload to AWS
58
+ `,document.getElementsByTagName("head")[0].appendChild(i)}async predictWebcam(){if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let i=this.detector.detectForVideo(this.video,r);this.verify(i)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r}),this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectadoa";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";default:return t}}};function Mh(){let e=document.createElement("div");e.setAttribute("id","liveViewFrameDetection");let t=document.createElement("erro");t.setAttribute("id","errorFrameDetection");let r=document.createElement("video");r.setAttribute("id","videoPreviewFrameDetection"),r.muted=!0,e.style.width="320px",e.style.height="180px",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="none",r.style.width="100%",r.style.height="100%",r.style.background="#000",e.appendChild(t),e.appendChild(r),document.body.appendChild(e)}var Xr=class extends $r{constructor(r,i,o="videoPreviewFrameDetection",n="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,i,o,n);this.emmitedPositionAlert=!1}displayVideoDetections(r){for(let i of this.children)this.liveView.removeChild(i);this.children.splice(0);for(let i of r.detections){let o=window.innerWidth,n=window.innerHeight,s=this.video.offsetWidth,a=this.video.offsetHeight,c=s/o,l=a/n,d=s-i.boundingBox.width*c-i.boundingBox.originX*c,u=i.boundingBox.originY*l,m=(i.boundingBox.width-10)*c,f=i.boundingBox.height*l,h=document.createElement("p");h.innerText="Confidence: "+Math.round(parseFloat(i.categories[0].score)*100)+"% .",h.style.right=d+"px",h.style.top=u-50+"px",h.style.width=m+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(h.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let y=document.createElement("div");y.setAttribute("class","highlighter"),y.style.right=d+"px",y.style.top=u+"px",y.style.width=m+"px",y.style.height=f-10+"px",Object.assign(y.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(h),this.children.push(y),this.children.push(h);for(let v of i.keypoints){let S=document.createElement("spam");S.className="key-point",S.style.top=`${v.y*this.video.offsetHeight-3}px`,S.style.right=`${this.video.offsetWidth-v.x*this.video.offsetWidth-3}px`,this.liveView.appendChild(S),this.children.push(S)}}}verify(r){this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent&&(this.numFacesSent=r.detections.length,r.detections.length===0?this.handleAlert("no_face_detected","face_detection_on_stream"):r.detections.length>1?this.handleAlert("multiple_faces_detected","face_detection_on_stream"):this.handleOk("face_ok","face_detection_on_stream")),r.detections[0]?.keypoints[4].x<.2||r.detections[0]?.keypoints[5].x>.8?(!this.emmitedPositionAlert&&this.handleAlert("wrong_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0):(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function ji(e,t){return function(){return e.apply(t,arguments)}}var{toString:og}=Object.prototype,{getPrototypeOf:ec}=Object,Sn=(e=>t=>{let r=og.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),St=e=>(e=e.toLowerCase(),t=>Sn(t)===e),kn=e=>t=>typeof t===e,{isArray:Kr}=Array,Vi=kn("undefined");function ng(e){return e!==null&&!Vi(e)&&e.constructor!==null&&!Vi(e.constructor)&&Je(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Nh=St("ArrayBuffer");function sg(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Nh(e.buffer),t}var ag=kn("string"),Je=kn("function"),jh=kn("number"),En=e=>e!==null&&typeof e=="object",cg=e=>e===!0||e===!1,wn=e=>{if(Sn(e)!=="object")return!1;let t=ec(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},lg=St("Date"),dg=St("File"),ug=St("Blob"),hg=St("FileList"),pg=e=>En(e)&&Je(e.pipe),mg=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Je(e.append)&&((t=Sn(e))==="formdata"||t==="object"&&Je(e.toString)&&e.toString()==="[object FormData]"))},fg=St("URLSearchParams"),gg=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function zi(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),Kr(e))for(i=0,o=e.length;i<o;i++)t.call(null,e[i],i,e);else{let n=r?Object.getOwnPropertyNames(e):Object.keys(e),s=n.length,a;for(i=0;i<s;i++)a=n[i],t.call(null,e[a],a,e)}}function Vh(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,o;for(;i-- >0;)if(o=r[i],t===o.toLowerCase())return o;return null}var zh=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Gh=e=>!Vi(e)&&e!==zh;function Qa(){let{caseless:e}=Gh(this)&&this||{},t={},r=(i,o)=>{let n=e&&Vh(t,o)||o;wn(t[n])&&wn(i)?t[n]=Qa(t[n],i):wn(i)?t[n]=Qa({},i):Kr(i)?t[n]=i.slice():t[n]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&zi(arguments[i],r);return t}var yg=(e,t,r,{allOwnKeys:i}={})=>(zi(t,(o,n)=>{r&&Je(o)?e[n]=ji(o,r):e[n]=o},{allOwnKeys:i}),e),vg=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),bg=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},wg=(e,t,r,i)=>{let o,n,s,a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),n=o.length;n-- >0;)s=o[n],(!i||i(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&ec(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Sg=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},kg=e=>{if(!e)return null;if(Kr(e))return e;let t=e.length;if(!jh(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Eg=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&ec(Uint8Array)),Ag=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),o;for(;(o=i.next())&&!o.done;){let n=o.value;t.call(e,n[0],n[1])}},_g=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},xg=St("HTMLFormElement"),Cg=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,o){return i.toUpperCase()+o}),Uh=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Tg=St("RegExp"),Hh=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};zi(r,(o,n)=>{let s;(s=t(o,n,e))!==!1&&(i[n]=s||o)}),Object.defineProperties(e,i)},Pg=e=>{Hh(e,(t,r)=>{if(Je(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(!!Je(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Ig=(e,t)=>{let r={},i=o=>{o.forEach(n=>{r[n]=!0})};return Kr(e)?i(e):i(String(e).split(t)),r},Rg=()=>{},Dg=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Za="abcdefghijklmnopqrstuvwxyz",Lh="0123456789",Wh={DIGIT:Lh,ALPHA:Za,ALPHA_DIGIT:Za+Za.toUpperCase()+Lh},Og=(e=16,t=Wh.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function Fg(e){return!!(e&&Je(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Bg=e=>{let t=new Array(10),r=(i,o)=>{if(En(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let n=Kr(i)?[]:{};return zi(i,(s,a)=>{let c=r(s,o+1);!Vi(c)&&(n[a]=c)}),t[o]=void 0,n}}return i};return r(e,0)},Mg=St("AsyncFunction"),Ug=e=>e&&(En(e)||Je(e))&&Je(e.then)&&Je(e.catch),p={isArray:Kr,isArrayBuffer:Nh,isBuffer:ng,isFormData:mg,isArrayBufferView:sg,isString:ag,isNumber:jh,isBoolean:cg,isObject:En,isPlainObject:wn,isUndefined:Vi,isDate:lg,isFile:dg,isBlob:ug,isRegExp:Tg,isFunction:Je,isStream:pg,isURLSearchParams:fg,isTypedArray:Eg,isFileList:hg,forEach:zi,merge:Qa,extend:yg,trim:gg,stripBOM:vg,inherits:bg,toFlatObject:wg,kindOf:Sn,kindOfTest:St,endsWith:Sg,toArray:kg,forEachEntry:Ag,matchAll:_g,isHTMLForm:xg,hasOwnProperty:Uh,hasOwnProp:Uh,reduceDescriptors:Hh,freezeMethods:Pg,toObjectSet:Ig,toCamelCase:Cg,noop:Rg,toFiniteNumber:Dg,findKey:Vh,global:zh,isContextDefined:Gh,ALPHABET:Wh,generateString:Og,isSpecCompliantForm:Fg,toJSONObject:Bg,isAsyncFn:Mg,isThenable:Ug};function Jr(e,t,r,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),o&&(this.response=o)}p.inherits(Jr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:p.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var qh=Jr.prototype,$h={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{$h[e]={value:e}});Object.defineProperties(Jr,$h);Object.defineProperty(qh,"isAxiosError",{value:!0});Jr.from=(e,t,r,i,o,n)=>{let s=Object.create(qh);return p.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Jr.call(s,e.message,t,r,i,o),s.cause=e,s.name=e.name,n&&Object.assign(s,n),s};var C=Jr;var An=null;function tc(e){return p.isPlainObject(e)||p.isArray(e)}function Kh(e){return p.endsWith(e,"[]")?e.slice(0,-2):e}function Xh(e,t,r){return e?e.concat(t).map(function(o,n){return o=Kh(o),!r&&n?"["+o+"]":o}).join(r?".":""):t}function Lg(e){return p.isArray(e)&&!e.some(tc)}var Ng=p.toFlatObject(p,{},null,function(t){return/^is[A-Z]/.test(t)});function jg(e,t,r){if(!p.isObject(e))throw new TypeError("target must be an object");t=t||new(An||FormData),r=p.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!p.isUndefined(y[g])});let i=r.metaTokens,o=r.visitor||d,n=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&p.isSpecCompliantForm(t);if(!p.isFunction(o))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(p.isDate(h))return h.toISOString();if(!c&&p.isBlob(h))throw new C("Blob is not supported. Use a Buffer instead.");return p.isArrayBuffer(h)||p.isTypedArray(h)?c&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,g,y){let v=h;if(h&&!y&&typeof h=="object"){if(p.endsWith(g,"{}"))g=i?g:g.slice(0,-2),h=JSON.stringify(h);else if(p.isArray(h)&&Lg(h)||(p.isFileList(h)||p.endsWith(g,"[]"))&&(v=p.toArray(h)))return g=Kh(g),v.forEach(function(x,O){!(p.isUndefined(x)||x===null)&&t.append(s===!0?Xh([g],O,n):s===null?g:g+"[]",l(x))}),!1}return tc(h)?!0:(t.append(Xh(y,g,n),l(h)),!1)}let u=[],m=Object.assign(Ng,{defaultVisitor:d,convertValue:l,isVisitable:tc});function f(h,g){if(!p.isUndefined(h)){if(u.indexOf(h)!==-1)throw Error("Circular reference detected in "+g.join("."));u.push(h),p.forEach(h,function(v,S){(!(p.isUndefined(v)||v===null)&&o.call(t,v,p.isString(S)?S.trim():S,g,m))===!0&&f(v,g?g.concat(S):[S])}),u.pop()}}if(!p.isObject(e))throw new TypeError("data must be an object");return f(e),t}var er=jg;function Jh(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Yh(e,t){this._pairs=[],e&&er(e,this,t)}var Zh=Yh.prototype;Zh.append=function(t,r){this._pairs.push([t,r])};Zh.toString=function(t){let r=t?function(i){return t.call(this,i,Jh)}:Jh;return this._pairs.map(function(o){return r(o[0])+"="+r(o[1])},"").join("&")};var _n=Yh;function Vg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Gi(e,t,r){if(!t)return e;let i=r&&r.encode||Vg,o=r&&r.serialize,n;if(o?n=o(t,r):n=p.isURLSearchParams(t)?t.toString():new _n(t,r).toString(i),n){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+n}return e}var rc=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){p.forEach(this.handlers,function(i){i!==null&&t(i)})}},ic=rc;var xn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Qh=typeof URLSearchParams<"u"?URLSearchParams:_n;var ep=typeof FormData<"u"?FormData:null;var tp=typeof Blob<"u"?Blob:null;var zg=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Gg=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),pe={isBrowser:!0,classes:{URLSearchParams:Qh,FormData:ep,Blob:tp},isStandardBrowserEnv:zg,isStandardBrowserWebWorkerEnv:Gg,protocols:["http","https","file","blob","url","data"]};function oc(e,t){return er(e,new pe.classes.URLSearchParams,Object.assign({visitor:function(r,i,o,n){return pe.isNode&&p.isBuffer(r)?(this.append(i,r.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}function Hg(e){return p.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Wg(e){let t={},r=Object.keys(e),i,o=r.length,n;for(i=0;i<o;i++)n=r[i],t[n]=e[n];return t}function qg(e){function t(r,i,o,n){let s=r[n++],a=Number.isFinite(+s),c=n>=r.length;return s=!s&&p.isArray(o)?o.length:s,c?(p.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!a):((!o[s]||!p.isObject(o[s]))&&(o[s]=[]),t(r,i,o[s],n)&&p.isArray(o[s])&&(o[s]=Wg(o[s])),!a)}if(p.isFormData(e)&&p.isFunction(e.entries)){let r={};return p.forEachEntry(e,(i,o)=>{t(Hg(i),o,r,0)}),r}return null}var Cn=qg;function $g(e,t,r){if(p.isString(e))try{return(t||JSON.parse)(e),p.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var nc={transitional:xn,adapter:pe.isNode?"http":"xhr",transformRequest:[function(t,r){let i=r.getContentType()||"",o=i.indexOf("application/json")>-1,n=p.isObject(t);if(n&&p.isHTMLForm(t)&&(t=new FormData(t)),p.isFormData(t))return o&&o?JSON.stringify(Cn(t)):t;if(p.isArrayBuffer(t)||p.isBuffer(t)||p.isStream(t)||p.isFile(t)||p.isBlob(t))return t;if(p.isArrayBufferView(t))return t.buffer;if(p.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return oc(t,this.formSerializer).toString();if((a=p.isFileList(t))||i.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return er(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return n||o?(r.setContentType("application/json",!1),$g(t)):t}],transformResponse:[function(t){let r=this.transitional||nc.transitional,i=r&&r.forcedJSONParsing,o=this.responseType==="json";if(t&&p.isString(t)&&(i&&!this.responseType||o)){let s=!(r&&r.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?C.from(a,C.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pe.classes.FormData,Blob:pe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};p.forEach(["delete","get","head","post","put","patch"],e=>{nc.headers[e]={}});var Yr=nc;var Xg=p.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),rp=e=>{let t={},r,i,o;return e&&e.split(`
59
+ `).forEach(function(s){o=s.indexOf(":"),r=s.substring(0,o).trim().toLowerCase(),i=s.substring(o+1).trim(),!(!r||t[r]&&Xg[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var ip=Symbol("internals");function Hi(e){return e&&String(e).trim().toLowerCase()}function Tn(e){return e===!1||e==null?e:p.isArray(e)?e.map(Tn):String(e)}function Kg(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var Jg=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function sc(e,t,r,i,o){if(p.isFunction(i))return i.call(this,t,r);if(o&&(t=r),!!p.isString(t)){if(p.isString(i))return t.indexOf(i)!==-1;if(p.isRegExp(i))return i.test(t)}}function Yg(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function Zg(e,t){let r=p.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(o,n,s){return this[i].call(this,t,o,n,s)},configurable:!0})})}var Zr=class{constructor(t){t&&this.set(t)}set(t,r,i){let o=this;function n(a,c,l){let d=Hi(c);if(!d)throw new Error("header name must be a non-empty string");let u=p.findKey(o,d);(!u||o[u]===void 0||l===!0||l===void 0&&o[u]!==!1)&&(o[u||c]=Tn(a))}let s=(a,c)=>p.forEach(a,(l,d)=>n(l,d,c));return p.isPlainObject(t)||t instanceof this.constructor?s(t,r):p.isString(t)&&(t=t.trim())&&!Jg(t)?s(rp(t),r):t!=null&&n(r,t,i),this}get(t,r){if(t=Hi(t),t){let i=p.findKey(this,t);if(i){let o=this[i];if(!r)return o;if(r===!0)return Kg(o);if(p.isFunction(r))return r.call(this,o,i);if(p.isRegExp(r))return r.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Hi(t),t){let i=p.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||sc(this,this[i],i,r)))}return!1}delete(t,r){let i=this,o=!1;function n(s){if(s=Hi(s),s){let a=p.findKey(i,s);a&&(!r||sc(i,i[a],a,r))&&(delete i[a],o=!0)}}return p.isArray(t)?t.forEach(n):n(t),o}clear(t){let r=Object.keys(this),i=r.length,o=!1;for(;i--;){let n=r[i];(!t||sc(this,this[n],n,t,!0))&&(delete this[n],o=!0)}return o}normalize(t){let r=this,i={};return p.forEach(this,(o,n)=>{let s=p.findKey(i,n);if(s){r[s]=Tn(o),delete r[n];return}let a=t?Yg(n):String(n).trim();a!==n&&delete r[n],r[a]=Tn(o),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return p.forEach(this,(i,o)=>{i!=null&&i!==!1&&(r[o]=t&&p.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
60
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(o=>i.set(o)),i}static accessor(t){let i=(this[ip]=this[ip]={accessors:{}}).accessors,o=this.prototype;function n(s){let a=Hi(s);i[a]||(Zg(o,s),i[a]=!0)}return p.isArray(t)?t.forEach(n):n(t),this}};Zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);p.reduceDescriptors(Zr.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});p.freezeMethods(Zr);var Se=Zr;function Wi(e,t){let r=this||Yr,i=t||r,o=Se.from(i.headers),n=i.data;return p.forEach(e,function(a){n=a.call(r,n,o.normalize(),t?t.status:void 0)}),o.normalize(),n}function qi(e){return!!(e&&e.__CANCEL__)}function op(e,t,r){C.call(this,e??"canceled",C.ERR_CANCELED,t,r),this.name="CanceledError"}p.inherits(op,C,{__CANCEL__:!0});var tr=op;function ac(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new C("Request failed with status code "+r.status,[C.ERR_BAD_REQUEST,C.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}var np=pe.isStandardBrowserEnv?function(){return{write:function(r,i,o,n,s,a){let c=[];c.push(r+"="+encodeURIComponent(i)),p.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),p.isString(n)&&c.push("path="+n),p.isString(s)&&c.push("domain="+s),a===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(r){let i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function cc(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function lc(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function $i(e,t){return e&&!cc(t)?lc(e,t):t}var sp=pe.isStandardBrowserEnv?function(){let t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),i;function o(n){let s=n;return t&&(r.setAttribute("href",s),s=r.href),r.setAttribute("href",s),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=o(window.location.href),function(s){let a=p.isString(s)?o(s):s;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function dc(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Qg(e,t){e=e||10;let r=new Array(e),i=new Array(e),o=0,n=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),d=i[n];s||(s=l),r[o]=c,i[o]=l;let u=n,m=0;for(;u!==o;)m+=r[u++],u=u%e;if(o=(o+1)%e,o===n&&(n=(n+1)%e),l-s<t)return;let f=d&&l-d;return f?Math.round(m*1e3/f):void 0}}var ap=Qg;function cp(e,t){let r=0,i=ap(50,250);return o=>{let n=o.loaded,s=o.lengthComputable?o.total:void 0,a=n-r,c=i(a),l=n<=s;r=n;let d={loaded:n,total:s,progress:s?n/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&l?(s-n)/c:void 0,event:o};d[t?"download":"upload"]=!0,e(d)}}var e0=typeof XMLHttpRequest<"u",lp=e0&&function(e){return new Promise(function(r,i){let o=e.data,n=Se.from(e.headers).normalize(),s=e.responseType,a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}p.isFormData(o)&&(pe.isStandardBrowserEnv||pe.isStandardBrowserWebWorkerEnv?n.setContentType(!1):n.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(e.auth){let f=e.auth.username||"",h=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";n.set("Authorization","Basic "+btoa(f+":"+h))}let d=$i(e.baseURL,e.url);l.open(e.method.toUpperCase(),Gi(d,e.params,e.paramsSerializer),!0),l.timeout=e.timeout;function u(){if(!l)return;let f=Se.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders()),g={data:!s||s==="text"||s==="json"?l.responseText:l.response,status:l.status,statusText:l.statusText,headers:f,config:e,request:l};ac(function(v){r(v),c()},function(v){i(v),c()},g),l=null}if("onloadend"in l?l.onloadend=u:l.onreadystatechange=function(){!l||l.readyState!==4||l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)||setTimeout(u)},l.onabort=function(){!l||(i(new C("Request aborted",C.ECONNABORTED,e,l)),l=null)},l.onerror=function(){i(new C("Network Error",C.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let h=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",g=e.transitional||xn;e.timeoutErrorMessage&&(h=e.timeoutErrorMessage),i(new C(h,g.clarifyTimeoutError?C.ETIMEDOUT:C.ECONNABORTED,e,l)),l=null},pe.isStandardBrowserEnv){let f=(e.withCredentials||sp(d))&&e.xsrfCookieName&&np.read(e.xsrfCookieName);f&&n.set(e.xsrfHeaderName,f)}o===void 0&&n.setContentType(null),"setRequestHeader"in l&&p.forEach(n.toJSON(),function(h,g){l.setRequestHeader(g,h)}),p.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),s&&s!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",cp(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",cp(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=f=>{!l||(i(!f||f.type?new tr(null,e,l):f),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));let m=dc(d);if(m&&pe.protocols.indexOf(m)===-1){i(new C("Unsupported protocol "+m+":",C.ERR_BAD_REQUEST,e));return}l.send(o||null)})};var Pn={http:An,xhr:lp};p.forEach(Pn,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var In={getAdapter:e=>{e=p.isArray(e)?e:[e];let{length:t}=e,r,i;for(let o=0;o<t&&(r=e[o],!(i=p.isString(r)?Pn[r.toLowerCase()]:r));o++);if(!i)throw i===!1?new C(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(p.hasOwnProp(Pn,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`);if(!p.isFunction(i))throw new TypeError("adapter is not a function");return i},adapters:Pn};function uc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new tr(null,e)}function Rn(e){return uc(e),e.headers=Se.from(e.headers),e.data=Wi.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),In.getAdapter(e.adapter||Yr.adapter)(e).then(function(i){return uc(e),i.data=Wi.call(e,e.transformResponse,i),i.headers=Se.from(i.headers),i},function(i){return qi(i)||(uc(e),i&&i.response&&(i.response.data=Wi.call(e,e.transformResponse,i.response),i.response.headers=Se.from(i.response.headers))),Promise.reject(i)})}var dp=e=>e instanceof Se?e.toJSON():e;function Ut(e,t){t=t||{};let r={};function i(l,d,u){return p.isPlainObject(l)&&p.isPlainObject(d)?p.merge.call({caseless:u},l,d):p.isPlainObject(d)?p.merge({},d):p.isArray(d)?d.slice():d}function o(l,d,u){if(p.isUndefined(d)){if(!p.isUndefined(l))return i(void 0,l,u)}else return i(l,d,u)}function n(l,d){if(!p.isUndefined(d))return i(void 0,d)}function s(l,d){if(p.isUndefined(d)){if(!p.isUndefined(l))return i(void 0,l)}else return i(void 0,d)}function a(l,d,u){if(u in t)return i(l,d);if(u in e)return i(void 0,l)}let c={url:n,method:n,data:n,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,d)=>o(dp(l),dp(d),!0)};return p.forEach(Object.keys(Object.assign({},e,t)),function(d){let u=c[d]||o,m=u(e[d],t[d],d);p.isUndefined(m)&&u!==a||(r[d]=m)}),r}var Dn="1.5.0";var hc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{hc[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});var up={};hc.transitional=function(t,r,i){function o(n,s){return"[Axios v"+Dn+"] Transitional option '"+n+"'"+s+(i?". "+i:"")}return(n,s,a)=>{if(t===!1)throw new C(o(s," has been removed"+(r?" in "+r:"")),C.ERR_DEPRECATED);return r&&!up[s]&&(up[s]=!0,console.warn(o(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(n,s,a):!0}};function t0(e,t,r){if(typeof e!="object")throw new C("options must be an object",C.ERR_BAD_OPTION_VALUE);let i=Object.keys(e),o=i.length;for(;o-- >0;){let n=i[o],s=t[n];if(s){let a=e[n],c=a===void 0||s(a,n,e);if(c!==!0)throw new C("option "+n+" must be "+c,C.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new C("Unknown option "+n,C.ERR_BAD_OPTION)}}var On={assertOptions:t0,validators:hc};var rr=On.validators,Qr=class{constructor(t){this.defaults=t,this.interceptors={request:new ic,response:new ic}}request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=Ut(this.defaults,r);let{transitional:i,paramsSerializer:o,headers:n}=r;i!==void 0&&On.assertOptions(i,{silentJSONParsing:rr.transitional(rr.boolean),forcedJSONParsing:rr.transitional(rr.boolean),clarifyTimeoutError:rr.transitional(rr.boolean)},!1),o!=null&&(p.isFunction(o)?r.paramsSerializer={serialize:o}:On.assertOptions(o,{encode:rr.function,serialize:rr.function},!0)),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=n&&p.merge(n.common,n[r.method]);n&&p.forEach(["delete","get","head","post","put","patch","common"],h=>{delete n[h]}),r.headers=Se.concat(s,n);let a=[],c=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(r)===!1||(c=c&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});let l=[];this.interceptors.response.forEach(function(g){l.push(g.fulfilled,g.rejected)});let d,u=0,m;if(!c){let h=[Rn.bind(this),void 0];for(h.unshift.apply(h,a),h.push.apply(h,l),m=h.length,d=Promise.resolve(r);u<m;)d=d.then(h[u++],h[u++]);return d}m=a.length;let f=r;for(u=0;u<m;){let h=a[u++],g=a[u++];try{f=h(f)}catch(y){g.call(this,y);break}}try{d=Rn.call(this,f)}catch(h){return Promise.reject(h)}for(u=0,m=l.length;u<m;)d=d.then(l[u++],l[u++]);return d}getUri(t){t=Ut(this.defaults,t);let r=$i(t.baseURL,t.url);return Gi(r,t.params,t.paramsSerializer)}};p.forEach(["delete","get","head","options"],function(t){Qr.prototype[t]=function(r,i){return this.request(Ut(i||{},{method:t,url:r,data:(i||{}).data}))}});p.forEach(["post","put","patch"],function(t){function r(i){return function(n,s,a){return this.request(Ut(a||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:n,data:s}))}}Qr.prototype[t]=r(),Qr.prototype[t+"Form"]=r(!0)});var Xi=Qr;var Ki=class{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(n){r=n});let i=this;this.promise.then(o=>{if(!i._listeners)return;let n=i._listeners.length;for(;n-- >0;)i._listeners[n](o);i._listeners=null}),this.promise.then=o=>{let n,s=new Promise(a=>{i.subscribe(a),n=a}).then(o);return s.cancel=function(){i.unsubscribe(n)},s},t(function(n,s,a){i.reason||(i.reason=new tr(n,s,a),r(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;let r=this._listeners.indexOf(t);r!==-1&&this._listeners.splice(r,1)}static source(){let t;return{token:new Ki(function(o){t=o}),cancel:t}}},hp=Ki;function pc(e){return function(r){return e.apply(null,r)}}function mc(e){return p.isObject(e)&&e.isAxiosError===!0}var fc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(fc).forEach(([e,t])=>{fc[t]=e});var pp=fc;function mp(e){let t=new Xi(e),r=ji(Xi.prototype.request,t);return p.extend(r,Xi.prototype,t,{allOwnKeys:!0}),p.extend(r,t,null,{allOwnKeys:!0}),r.create=function(o){return mp(Ut(e,o))},r}var re=mp(Yr);re.Axios=Xi;re.CanceledError=tr;re.CancelToken=hp;re.isCancel=qi;re.VERSION=Dn;re.toFormData=er;re.AxiosError=C;re.Cancel=re.CanceledError;re.all=function(t){return Promise.all(t)};re.spread=pc;re.isAxiosError=mc;re.mergeConfig=Ut;re.AxiosHeaders=Se;re.formToJSON=e=>Cn(p.isHTMLForm(e)?new FormData(e):e);re.getAdapter=In.getAdapter;re.HttpStatusCode=pp;re.default=re;var kt=re;var{Axios:Fb,AxiosError:Bb,CanceledError:Mb,isCancel:Ub,CancelToken:Lb,VERSION:Nb,all:jb,Cancel:Vb,isAxiosError:zb,spread:Gb,toFormData:Hb,AxiosHeaders:Wb,HttpStatusCode:qb,formToJSON:$b,getAdapter:Xb,mergeConfig:Kb}=kt;var r0="https://proctoring-api-dev.easyproctor.tech/api",i0="https://proctoring-api-hml.easyproctor.tech/api",fp="https://proctoring-api.easyproctor.tech/api",Et=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type),this.token=t.token}selectBaseUrl(t){return t==="dev"?r0:t==="homol"?i0:fp}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async confirmStart(t,r,i,o){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r,latitude:i,longitude:o},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(i=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async getSignedUrlImage(t,r){return(await this.makeRequestAxios({path:"/upload/signed-url-batch",method:"POST",jwt:t,body:r})).data}async getSignedUrl(t,r,i){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${i}/${r.name}`,contentType:r.type}})).data}async saveAlerts(t,r){await this.makeRequest({path:"/proctoring/save-alerts",method:"POST",jwt:t.token,body:{proctoringId:r.id,alerts:r.alerts}})}async finishAndSendUrls(t,r){await this.makeRequest({path:`/proctoring/finish/${t.examId}`,method:"POST",body:{endDate:new Date().toISOString(),videoCameraUrl:"",audioCameraUrl:"",videoScreenUrl:""},jwt:t.token})}async log(t,r){let i;return r?.success!==null&&r?.success!==void 0?i=r.success?"4":"1":i="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:i,eventName:t,message:r},jwt:this.token})}async signTerm(){return await this.makeRequest({path:"/User/sign-terms",method:"PATCH",body:{},jwt:this.token})}async signTermUrl(){return(await this.makeRequestAxios({path:"/User/sign-terms-url",method:"GET",jwt:this.token})).data}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:i,body:o,jwt:n}=t,s=await fetch(this.baseUrl+r,{method:i,body:o!=null?JSON.stringify(o):void 0,headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}async makeRequestAxios(t){let{path:r,method:i,body:o,jwt:n}=t,s=await kt.request({url:this.baseUrl+r,method:i,headers:{Authorization:`Bearer ${n}`,"Access-Control-Allow-Origin":"*"},data:o});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}async makeRequestPUT(t){let{url:r,method:i,body:o,jwt:n}=t,s=await fetch(r,{method:i,body:o!=null?JSON.stringify(o):void 0,headers:{Accept:"*/*","Accept-Encoding":"gzip, deflate, br",Connection:"keep-alive","aeg-event-type":"Notification","Content-Type":"application/json","Cache-Control":"no-cache","x-ms-blob-type":"BlockBlob"}});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";let a=s.headers.get("content-type");return(a?a.includes("application/json"):!1)?await s.json():null}};var Fn=class{constructor(){this.baseUrl="https://localhost:5080"}async isAlive(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-alive",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async isPluggedIn(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/is-plugged-in",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async ConnectAndScan(){return(await this.makeRequestAxios({path:"/api/usb-device-manager/connect-and-scan",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:i}){let o=[];return t&&o.push(`deviceType=${t}`),r&&o.push(`rssiThreshold=${r}`),i&&o.push(`packageRateThreshold=${i}`),(await this.makeRequestAxios({path:`/api/usb-device-manager/devices?${o.join("&")}`,method:"GET",jwt:this.token}).catch(s=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async makeRequestAxios(t){let{path:r,method:i,body:o,jwt:n}=t,s=await kt.request({url:this.baseUrl+r,method:i,headers:{Authorization:`Bearer ${n}`,"Access-Control-Allow-Origin":"*"},data:o});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var yr=class{constructor(){this.sessionDuration=0;this.state="Created",this.startedAt=new Date,this.alerts=[],this.recordings=[]}get hasSomethingToUpload(){for(let t of this.recordings)if(!t.upload)return!0;return!1}start(){this.state="Recording",this.startedAt=new Date(Date.now())}pause(){this.state="Paused"}resume(){this.state="Recording"}stop(){this.state="Ended",this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state="EndConfirmed"}setUploaded(){this.state="Uploaded"}setUploadConfirmed(){this.state="UploadConfirmed"}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var ei=class{constructor(t,r){this.backendService=new Fn;this.scanInterval=5;this.options={};this.options=r,this.context=t,this.backend=new Et({type:t?.type||"prod",token:t.token}),this.currentIsPlugged=!0}setProctoringId(t){this.proctoringId=t}async isPluggedIn(t=!1){try{let r=await this.backendService.isPluggedIn();if(this.proctoringId&&t)if(r)this.currentIsPlugged||this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Dispositivo de varredura conectado.",status:"OK"});else{let i=new yr;i.setProctoringId(this.proctoringId),i.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:33,type:5}),await this.backend.saveAlerts(this.context,i),this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam disconnected",description:"Nenhum dispositivo de varredura conectado.",status:"ALERT"})}return this.currentIsPlugged=r,this.currentIsPlugged}catch(r){throw r}}async isAlive(){try{return await this.backendService.isAlive()}catch(t){throw t}}connectAndScan(){return this.backendService.ConnectAndScan()}async devices({deviceType:t,rssiThreshold:r,packageRateThreshold:i}){let o=await this.backendService.Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:i});if(o.length>0&&(this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam detected",description:"Dispositivo espi\xE3o detectado.",data:o}),this.proctoringId)){let n=new yr;n.setProctoringId(this.proctoringId),n.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:32,type:5}),await this.backend.saveAlerts(this.context,n)}return o}async startCheckSpyCam(t,{deviceType:r,rssiThreshold:i,packageRateThreshold:o}){this.scanInterval=t,this.startTime=new Date(Date.now()),await this.isPluggedIn(!0),this.checkSpyCam=setInterval(async()=>{await this.isPluggedIn(!0)&&await this.devices({deviceType:r,rssiThreshold:i,packageRateThreshold:o})},this.scanInterval*6e4)}stopCheckSpyCam(){clearInterval(this.checkSpyCam)}};var Ye={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1,useSpyScan:!1};function Bn(e){return!!e.width&&!!e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var gp={width:1280,height:720,minWidth:640,minHeight:480};var Mn,yp=e=>(Mn=e,Mn),Ue={START:"start",FINISH:"finish",ERROR:"error",UPLOAD:"upload",UPLOAD_FILE:"upload_file",DOWNLOAD_VIDEO:"download_video",BUFFER_SIZE:"buffer_size",ANOTHER_STREAM:"another_stream",CHANGE_DEVICE:"change_device",STOP_SHARING_SCREEN:"stop_sharing_screen",ERROR_RECORDER_RTC:"error_recorder_rtc",BROWSER_NOT_SUPPORTED:"browser_not_supported",SAVE_ON_SESSION:"save_on_session"},Le=(e,t)=>Mn&&Mn.log(e,t),I={registerStart:(e,t,r)=>Le(Ue.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>Le(Ue.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>Le(Ue.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>Le(Ue.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,i,o)=>Le(Ue.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:i,uploadTime:o}),registerUploadFile:(e,t,r)=>Le(Ue.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>Le(Ue.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>Le(Ue.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>Le(Ue.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>Le(Ue.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>Le(Ue.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>Le(Ue.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>Le(Ue.SAVE_ON_SESSION,{proctoringId:e,description:t})};var Ji;function Un(e){Ji=e}function vr(e,t,r=!1,i,o=!1){let n,s=!1,a,c,l;l=0;let d={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?d.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),o&&(d={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});let u=new MediaRecorder(e,d);u.ondataavailable=v=>{l=l+v.data.size,v.data.size>0&&t.push(v.data),s?(o&&u.state=="inactive"&&(t=[new Blob(t,{type:"audio/webm"})]),n&&n()):((c&&v.data.size===c.data.size||v.data.size===0)&&(Ji&&c&&v.data.size===c.data.size&&I.registerOnBufferSizeError(Ji,`onBufferSizeError: Recorder size freezed: ${v.data.size} Mb`),Ji&&v.data.size===0&&I.registerOnBufferSizeError(Ji,"onBufferSizeError: Recorder size equal 0 Mb"),i&&i()),c=v)};function m(){return new Promise(v=>{n=v,u.start(),l=0,s=!1,r&&(a=setInterval(async()=>{await u.requestData()},3e4))})}function f(){return new Promise(v=>{u.state=="recording"?(n=v,u.stop(),s=!0,clearInterval(a),e.getTracks().forEach(S=>{S.stop()})):v()})}function h(){return new Promise(v=>{u.state=="recording"&&u.pause(),v()})}function g(){return new Promise(v=>{u.state=="paused"&&u.resume(),v()})}function y(){return l}return{startRecording:m,stopRecording:f,pauseRecording:h,resumeRecording:g,recorderOptions:d,getBufferSize:y}}var Lt=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadImages(t,r,i){let{file:o,onProgress:n}=t;try{let s=l=>{let d=l.loadedBytes/o.size*100;n&&n(Math.round(d))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let u=this.imageBatchNum;u<this.imageBatchNum+60;u++){let m=`${this.proctoringId}/${this.proctoringId}_${u+1}.jpg`;(u+1)%i==0&&(m=`${this.proctoringId}/${this.proctoringId}_${u+1}_realtime.jpg`),l.push({objectName:m,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(u=>{this.imageUrlPackage.push(u)}),this.imageBatchNum+=60}let c=!1;return c=await kt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(l=>l.status==200||l.status==201?(this.contImages++,!0):!1).catch(()=>!1).finally(()=>{}),{storage:"upload",url:a,uploaded:c}}catch{throw I.registerError(this.proctoringId,`Failed to upload to AWS
61
61
  File name: ${o.name}
62
62
  File type: ${o.type}
63
- File size: ${o.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,i){let{file:o,onProgress:n}=t;try{let s=l=>{let u=l.loadedBytes/o.size*100;n&&n(Math.round(u))},a;if(i){if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+20;d++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,o,this.proctoringId);let c=!1;return i?c=await er.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await er.request({url:a,method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw R.registerError(this.proctoringId,`Failed to upload to AWS
63
+ File size: ${o.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,i){let{file:o,onProgress:n}=t;try{let s=l=>{let d=l.loadedBytes/o.size*100;n&&n(Math.round(d))},a;if(i){if(this.imageBatchNum===this.contImages){let l=[];for(let u=this.imageBatchNum;u<this.imageBatchNum+20;u++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${u+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(u=>{this.imageUrlPackage.push(u)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,o,this.proctoringId);let c=!1;return i?c=await kt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await kt.request({url:a,method:"PUT",headers:{"Content-Type":o.type,"x-ms-blob-type":"BlockBlob"},data:o,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw I.registerError(this.proctoringId,`Failed to upload to AWS
64
64
  File name: ${o.name}
65
65
  File type: ${o.type}
66
- File size: ${o.size}`),new Error("Failed to upload to AWS")}}};var ap="not_shared_first_screen",cp="not_shared_screen",Cn="multiple_monitors_detected",lp="proctoring_already_started",Pn="proctoring_not_started";var up="another_stream_active",dp="stream_under_minimum_permitted",hp="browser_not_supported",pp="token_missing",fp="credentials_missing";var Rn=class extends zr{constructor(r,i,o="videoPreviewFrameDetection",n="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",r,i,o,n)}displayVideoDetections(r){for(let i of this.children)this.liveView.removeChild(i);this.children.splice(0);for(let i of r.detections){let o=window.innerWidth,n=window.innerHeight,s=this.video.offsetWidth,a=this.video.offsetHeight,c=s/o,l=a/n,u=s-i.boundingBox.width*c-i.boundingBox.originX*c,d=i.boundingBox.originY*l,f=(i.boundingBox.width-10)*c,m=i.boundingBox.height*l,h=document.createElement("p");h.innerText=i.categories[0].categoryName+" - with "+Math.round(parseFloat(i.categories[0].score)*100)+"% confidence.",h.style.right=u-20+"px",h.style.top=d+"px",h.style.width=f+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(h.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let y=document.createElement("div");y.setAttribute("class","highlighter"),y.style.right=u-20+"px",y.style.top=d+"px",y.style.width=f+"px",y.style.height=m-20+"px",Object.assign(y.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(h),this.children.push(y),this.children.push(h)}}verify(r){let i=r.detections.filter(n=>n.categories.some(s=>s.categoryName==="person")).length,o=r.detections.filter(n=>n.categories.some(s=>s.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&i!==this.numPersonsSent&&(i===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=i):i>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=i):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=i)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&o!==this.numCellphoneSent&&(o>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=o):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=o))}};var tr=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,i)=>{try{let o=new AudioContext;this.analyser=o.createAnalyser();let n=o.createMediaStreamSource(this.stream);this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,n.connect(this.analyser);let s=()=>{let a=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(a);let l=a.reduce((u,d)=>u+d,0)/a.length;this.setVolume(l),t.setVolume&&t.setVolume(l),this.animationFrameId=requestAnimationFrame(s)};this.animationFrameId=requestAnimationFrame(s),r(!0)}catch(o){this.stop(),i(`Error: ${o}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId)}getVolume(){return this.volume}setVolume(t){this.volume=t}};var Mt=class{constructor(t,r,i,o,n){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=o,this.backendToken=n,i&&(this.paramsConfig=i)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Bt(this.proctoringId,this.backend))}async initializeDetectors(){Ah(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new Rn({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Gr({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,this.canvas.width=this.videoOptions.width,this.canvas.height=this.videoOptions.height}async startRecording(){(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&await this.initializeDetectors();let{cameraId:t,microphoneId:r,onBufferSizeErrorCallback:i}=this.options,o={audio:{deviceId:r},video:{deviceId:t,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.cameraStream=await navigator.mediaDevices.getUserMedia(o)}catch(m){throw m.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":m}let{startRecording:n,stopRecording:s,pauseRecording:a,resumeRecording:c,options:l,getBufferSize:u}=mr(this.cameraStream,this.blobs,this.proctoringId,this.options.onBufferSizeError,i);this.recordingStart=n,this.recordingStop=s,this.recordingPause=a,this.recordingResume=c,this.recorderOptions=l,this.getBufferSize=u,this.recordingStart();let f=this.cameraStream.getVideoTracks()[0].getSettings();if(this.videoOptions.minWidth>f.width||this.videoOptions.minHeight>f.height)throw dp;if(this.videoOptions.width!==f.width||this.videoOptions.height!==f.height)throw R.registerAnotherStream(this.proctoringId,`Maybe have another stream active
66
+ File size: ${o.size}`),new Error("Failed to upload to AWS")}}};var vp="not_shared_first_screen",bp="not_shared_screen",Ln="multiple_monitors_detected",wp="proctoring_already_started",Nn="proctoring_not_started";var Sp="another_stream_active",kp="stream_under_minimum_permitted",Ep="browser_not_supported",Ap="token_missing",_p="credentials_missing";var xp="spy_scan_api_not_found";var jn=class extends $r{constructor(r,i,o="videoPreviewFrameDetection",n="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",r,i,o,n)}displayVideoDetections(r){for(let i of this.children)this.liveView.removeChild(i);this.children.splice(0);for(let i of r.detections){let o=window.innerWidth,n=window.innerHeight,s=this.video.offsetWidth,a=this.video.offsetHeight,c=s/o,l=a/n,d=s-i.boundingBox.width*c-i.boundingBox.originX*c,u=i.boundingBox.originY*l,m=(i.boundingBox.width-10)*c,f=i.boundingBox.height*l,h=document.createElement("p");h.innerText=i.categories[0].categoryName+" - with "+Math.round(parseFloat(i.categories[0].score)*100)+"% confidence.",h.style.right=d-20+"px",h.style.top=u+"px",h.style.width=m+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(h.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let y=document.createElement("div");y.setAttribute("class","highlighter"),y.style.right=d-20+"px",y.style.top=u+"px",y.style.width=m+"px",y.style.height=f-20+"px",Object.assign(y.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(y),this.liveView.appendChild(h),this.children.push(y),this.children.push(h)}}verify(r){let i=r.detections.filter(n=>n.categories.some(s=>s.categoryName==="person")).length,o=r.detections.filter(n=>n.categories.some(s=>s.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&i!==this.numPersonsSent&&(i===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=i):i>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=i):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=i)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&o!==this.numCellphoneSent&&(o>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=o):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=o))}};var ir=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,i)=>{try{let o=new AudioContext;this.analyser=o.createAnalyser();let n=o.createMediaStreamSource(this.stream);this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,n.connect(this.analyser);let s=()=>{let a=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(a);let l=a.reduce((d,u)=>d+u,0)/a.length;this.setVolume(l),t.setVolume&&t.setVolume(l),this.animationFrameId=requestAnimationFrame(s)};this.animationFrameId=requestAnimationFrame(s),r(!0)}catch(o){this.stop(),i(`Error: ${o}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId)}getVolume(){return this.volume}setVolume(t){this.volume=t}};var Nt=class{constructor(t,r,i,o,n){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectPerson:!1,detectFace:!1,detectCellPhone:!1}};this.options={cameraId:void 0,microphoneId:void 0,onBufferSizeError:!1,onBufferSizeErrorCallback:t=>{},proctoringType:"IMAGE",onChangeDevicesCallback:t=>{},onRealtimeAlertsCallback:t=>{}};this.videoOptions={width:640,height:480,minWidth:0,minHeight:0};this.blobsRTC=[];this.imageCount=0;this.filesToUpload=[];this.currentRetries=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=o,this.backendToken=n,i&&(this.paramsConfig=i)}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Lt(this.proctoringId,this.backend)),Un(t)}async initializeDetectors(){Mh(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new jn({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Xr({onRealtimeAlertsCallback:t=>this.options.onRealtimeAlertsCallback(t)},this.paramsConfig),await this.faceDetection.initializeDetector())}configImageCapture(){this.video=document.createElement("video"),this.canvas=document.createElement("canvas"),this.video.srcObject=this.cameraStream,this.video.play(),this.video.muted=!0,this.canvas.width=this.videoOptions.width,this.canvas.height=this.videoOptions.height}async bufferError(t){console.log("buffer error Camera Recorder params "+this.paramsConfig.videoBehaviourParameters);let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,i=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<i?(await this.recordingStop(),await this.startRecording({retry:!0}),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startRecording(t){(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&!t?.retry&&await this.initializeDetectors();let{cameraId:r,microphoneId:i,onBufferSizeErrorCallback:o}=this.options,n={audio:{deviceId:i},video:{deviceId:r,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.cameraStream=await navigator.mediaDevices.getUserMedia(n)}catch(h){throw h.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":h}let{startRecording:s,stopRecording:a,pauseRecording:c,resumeRecording:l,recorderOptions:d,getBufferSize:u}=vr(this.cameraStream,this.blobs,this.options.onBufferSizeError,h=>this.bufferError(h),!1);this.recordingStart=s,this.recordingStop=a,this.recordingPause=c,this.recordingResume=l,this.recorderOptions=d,this.getBufferSize=u,this.recordingStart();let f=this.cameraStream.getVideoTracks()[0].getSettings();if(this.videoOptions.minWidth>f.width||this.videoOptions.minHeight>f.height)throw kp;if(this.videoOptions.width!==f.width||this.videoOptions.height!==f.height)throw I.registerAnotherStream(this.proctoringId,`Maybe have another stream active
67
67
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
68
- Setting: ${JSON.stringify(f,null,2)}`),up;this.paramsConfig.imageBehaviourParameters?.useUploadImage&&this.options.proctoringType=="IMAGE"&&this.photoShotsCycle(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[],this.options.proctoringType=="REALTIME"&&this.captureFrame()}async stopRecording(){if(this.recordingStop&&await this.recordingStop(),this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken){let t=this.filesToUpload.length,r=this.paramsConfig.imageBehaviourParameters.uploadInterval;for(let i=0;i<t;i++){if(i==t-1&&this.filesToUpload[0]){let o=this.filesToUpload[0].name.replace(".jpg","_realtime.jpg"),n=new File([this.filesToUpload[0]],o,{type:"image/jpeg"});this.filesToUpload[0]=n}this.filesToUpload[0]&&await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,r),this.filesToUpload.shift()}}this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}photoShotsCycle(){let t;this.configImageCapture(),this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.videoOptions.width,this.videoOptions.height);let r=this.canvas.toDataURL("image/jpeg");t=await this.getFile(r,`${this.proctoringId}_${this.imageCount+1}.jpg`,"image/jpeg"),t&&this.upload&&this.backendToken&&(this.upload.upload({file:t},this.backendToken,!0),this.imageCount++)},this.paramsConfig.imageBehaviourParameters.uploadInterval*1e3)}captureFrame(){let t;this.configImageCapture();let r=this.paramsConfig.imageBehaviourParameters.uploadInterval,i=!1;this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let o=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;i==!1&&r>0&&(i=!0,this.sendFrame());let n=`${this.proctoringId}_${this.imageCount+1}.jpg`;(this.imageCount+1)%r==0&&(n=`${this.proctoringId}_${this.imageCount+1}_realtime.jpg`),t=await this.getFile(o,n,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)},1e3)}sendFrame(){let t=this.paramsConfig.imageBehaviourParameters.uploadInterval,r=!1,i=0;this.sendFrameInterval=setInterval(async()=>{if(this.upload&&this.backendToken&&!r){i=0;let o=0,n=this.filesToUpload.length;for(;o<n&&(r=!0,this.filesToUpload.length!=0);)(await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,t)).uploaded==!0?(await this.filesToUpload.shift(),o++):console.log("erro no upload: "+this.filesToUpload[0].name);r=!1}else if(r&&(i++,i==3)){i=0;let o=this.videoOptions.width/2,n=this.videoOptions.height/2;o<320&&(o=320),n<180&&(n=180),this.canvas.width=o,this.canvas.height=n}},t*1e3)}download(t){let r=URL.createObjectURL(t),i=document.createElement("a");document.body.appendChild(i),i.style.display="none",i.href=r,i.download=t.name,i.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&R.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),i=this.cameraStream.getAudioTracks()[0].getSettings();(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo)&&t.addRecording({device:`Audio
68
+ Setting: ${JSON.stringify(f,null,2)}`),Sp;this.paramsConfig.imageBehaviourParameters?.useUploadImage&&this.options.proctoringType=="IMAGE"&&this.photoShotsCycle(),this.paramsConfig.videoBehaviourParameters?.detectFace&&await this.faceDetection.enableCam(this.cameraStream),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&await this.objectDetection.enableCam(this.cameraStream),this.filesToUpload=[],this.options.proctoringType=="REALTIME"&&this.captureFrame()}async stopRecording(){if(this.recordingStop&&await this.recordingStop(),this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken){let t=this.filesToUpload.length,r=this.paramsConfig.imageBehaviourParameters.uploadInterval;for(let i=0;i<t;i++){if(i==t-1&&this.filesToUpload[0]){let o=this.filesToUpload[0].name.replace(".jpg","_realtime.jpg"),n=new File([this.filesToUpload[0]],o,{type:"image/jpeg"});this.filesToUpload[0]=n}this.filesToUpload[0]&&await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,r),this.filesToUpload.shift()}}this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection)}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}photoShotsCycle(){let t;this.configImageCapture(),this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.videoOptions.width,this.videoOptions.height);let r=this.canvas.toDataURL("image/jpeg");t=await this.getFile(r,`${this.proctoringId}_${this.imageCount+1}.jpg`,"image/jpeg"),t&&this.upload&&this.backendToken&&(this.upload.upload({file:t},this.backendToken,!0),this.imageCount++)},this.paramsConfig.imageBehaviourParameters.uploadInterval*1e3)}captureFrame(){let t;this.configImageCapture();let r=this.paramsConfig.imageBehaviourParameters.uploadInterval,i=!1;this.imageInterval=setInterval(async()=>{this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let o=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;i==!1&&r>0&&(i=!0,this.sendFrame());let n=`${this.proctoringId}_${this.imageCount+1}.jpg`;(this.imageCount+1)%r==0&&(n=`${this.proctoringId}_${this.imageCount+1}_realtime.jpg`),t=await this.getFile(o,n,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)},1e3)}sendFrame(){let t=this.paramsConfig.imageBehaviourParameters.uploadInterval,r=!1,i=0;this.sendFrameInterval=setInterval(async()=>{if(this.upload&&this.backendToken&&!r){i=0;let o=0,n=this.filesToUpload.length;for(;o<n&&(r=!0,this.filesToUpload.length!=0);)(await this.upload.uploadImages({file:this.filesToUpload[0]},this.backendToken,t)).uploaded==!0?(await this.filesToUpload.shift(),o++):console.log("erro no upload: "+this.filesToUpload[0].name);r=!1}else if(r&&(i++,i==3)){i=0;let o=this.videoOptions.width/2,n=this.videoOptions.height/2;o<320&&(o=320),n<180&&(n=180),this.canvas.width=o,this.canvas.height=n}},t*1e3)}download(t){let r=URL.createObjectURL(t),i=document.createElement("a");document.body.appendChild(i),i.style.display="none",i.href=r,i.download=t.name,i.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&I.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} `);let r=this.cameraStream.getVideoTracks()[0].getSettings(),i=this.cameraStream.getAudioTracks()[0].getSettings();(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo)&&t.addRecording({device:`Audio
69
69
  Sample Rate: ${i.sampleRate}
70
70
  Sample Size: ${i.sampleSize}
71
71
 
72
72
  Video:
73
- ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,i){return new Promise((o,n)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:i});o(a)}).catch(s=>{n(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new tr(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}};var In=class{constructor(t=at,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...at,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
73
+ ${JSON.stringify(this.recorderOptions)}`,file:new File(this.blobs,`EP_${t.id}_camera_0.webm`,{type:this.recorderOptions?.mimeType||"video/webm"}),origin:"Camera"})}async getFile(t,r,i){return new Promise((o,n)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:i});o(a)}).catch(s=>{n(s)})})}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new ir(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&(console.log("entrou"+this.noiseWait),this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0)),this.noiseWait++}};var Vn=class{constructor(t=Ye,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...Ye,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r}}checkDevicesInterface(){this.addStyleMask();let t=document.createElement("style");t.type="text/css",t.innerHTML=`
74
74
  .alert-div {
75
75
  display: flex;
76
76
  align-items: center;
@@ -165,7 +165,7 @@ Setting: ${JSON.stringify(f,null,2)}`),up;this.paramsConfig.imageBehaviourParame
165
165
  left: 5px;
166
166
  top: 2px;
167
167
  }
168
- `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let i={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(r,i);let o=document.createElement("div"),n={backgroundColor:"#fff",zIndex:"1001",width:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,n);let s=document.createElement("h3");s.innerText="Para iniciar configure a c\xE2mera e o microfone";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),o.appendChild(s);let c=document.createElement("div"),l=document.createElement("h3"),u=document.createElement("select");u.setAttribute("id","cameraSelect");let d={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,d),l.innerText="C\xE2mera";let f={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,f),u.style.maxWidth="400px",c.appendChild(l),c.appendChild(u),o.appendChild(c);let m=document.createElement("div");m.setAttribute("id","liveCheckDevices");let h=document.createElement("div"),g=document.createElement("video"),y=document.createElement("div");g.setAttribute("id","cameraStream"),g.muted=!0;let _={width:"calc(100% - 40px)",display:"flex",justifyContent:"space-between",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",transform:"rotateY(180deg)"};this.applyStyles(m,_);let v={width:"20rem",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(g,v),this.applyStyles(h,{position:"relative"});let T=document.createElement("div");T.setAttribute("class","alert-div"),T.setAttribute("id","alertDivResolution");let q=document.createElement("error");q.setAttribute("id","resolutionAlert"),q.innerText="Resolu\xE7\xE3o m\xEDnima",q.style.marginLeft="10px",q.style.marginRight="5px";let me=document.createElement("span"),Ie=document.createElement("div"),Qc=document.createElement("div");me.setAttribute("id","checkmark_resolution"),Ie.setAttribute("id","checkmark_stem_resolution"),Qc.setAttribute("id","checkmark_kick_resolution"),me.appendChild(Ie),me.appendChild(Qc);let ai=document.createElement("span"),el=document.createElement("div"),tl=document.createElement("div");ai.setAttribute("class","info"),ai.setAttribute("id","info_resolution"),el.setAttribute("class","info_stem"),tl.setAttribute("class","info_kick"),ai.appendChild(el),ai.appendChild(tl),T.appendChild(me),T.appendChild(q),T.appendChild(ai);let ci=document.createElement("div");ci.setAttribute("class","alert-div"),ci.setAttribute("id","alertDivFacePosition");let co=document.createElement("error");co.setAttribute("id","facePositionAlert"),co.innerText="Posicionamento da face",co.style.marginLeft="10px";let lo=document.createElement("span"),rl=document.createElement("div"),il=document.createElement("div");lo.setAttribute("id","checkmark_FacePosition"),rl.setAttribute("id","checkmark_stem_FacePosition"),il.setAttribute("id","checkmark_kick_FacePosition"),lo.appendChild(rl),lo.appendChild(il),ci.appendChild(lo),ci.appendChild(co);let li=document.createElement("div");li.setAttribute("class","alert-div"),li.setAttribute("id","alertDivAmbientVerify");let uo=document.createElement("error");uo.setAttribute("id","ambientVerifyAlert"),uo.innerText="Verifica\xE7\xE3o do ambiente",uo.style.marginLeft="10px";let ho=document.createElement("span"),ol=document.createElement("div"),nl=document.createElement("div");ho.setAttribute("id","checkmark_AmbientVerify"),ol.setAttribute("id","checkmark_stem_AmbientVerify"),nl.setAttribute("id","checkmark_kick_AmbientVerify"),ho.appendChild(ol),ho.appendChild(nl),li.appendChild(ho),li.appendChild(uo),y.style.transform="rotateY(180deg)",y.appendChild(T),y.appendChild(ci),y.appendChild(li),m.appendChild(y),h.appendChild(g),m.appendChild(h);let xt=document.createElement("div");xt.setAttribute("class","facial-biometry__mask"),xt.style.width="100%",xt.style.height="100%",xt.style.position="absolute",xt.style.top="0px",xt.style.left="0px",xt.style.backgroundColor="#fff",xt.style.opacity="0.6";let Nt=document.createElement("div");Nt.setAttribute("class","biometry__frame"),Nt.style.width="100%",Nt.style.height="100%",Nt.style.position="absolute",Nt.style.top="0px",Nt.style.left="0px",Nt.style.zIndex="10",h.appendChild(xt),h.appendChild(Nt),o.appendChild(m);let po=document.createElement("div"),ws=document.createElement("h3"),Ss=document.createElement("select");Ss.setAttribute("id","micSelect");let Am={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(po,Am),ws.innerText="Microfone";let Tm={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(ws,Tm),Ss.style.maxWidth="400px",po.appendChild(ws),po.appendChild(Ss),o.appendChild(po);let fo=document.createElement("div"),xm={width:"100%",padding:"0px 40px",display:"flex"};this.applyStyles(fo,xm);let mo=document.createElement("div"),Cm={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(mo,Cm);let go=document.createElement("div");go.setAttribute("id","audioStream");let Pm={display:"flex",marginBottom:"15px"};this.applyStyles(go,Pm);let Rm={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let hl=0;hl<25;hl++){let pl=document.createElement("div");this.applyStyles(pl,Rm),go.appendChild(pl)}let ui=document.createElement("div"),sl=document.createElement("p"),al=document.createElement("p"),cl=document.createElement("p"),Im={width:"250px",display:"flex",justifyContent:"space-between"};this.applyStyles(ui,Im),sl.innerText="0",al.innerText="50",cl.innerText="100",ui.appendChild(sl),ui.appendChild(al),ui.appendChild(cl);let Er=document.createElement("div");Er.setAttribute("class","alert-div"),Er.setAttribute("id","alertDivMicrophone");let Om={alignItems:"start",justifyContent:"end",width:"inherit"};this.applyStyles(Er,Om);let yo=document.createElement("error");yo.setAttribute("id","microphoneAlert"),yo.innerText="Teste de funcionamento",yo.style.marginLeft="10px";let vo=document.createElement("span"),ll=document.createElement("div"),ul=document.createElement("div");vo.setAttribute("id","checkmark_microphone"),ll.setAttribute("id","checkmark_stem_microphone"),ul.setAttribute("id","checkmark_kick_microphone"),vo.appendChild(ll),vo.appendChild(ul),Er.appendChild(vo),Er.appendChild(yo),mo.appendChild(go),mo.appendChild(ui);let bo=document.createElement("p");bo.innerText='Pronuncie em voz alta: "um, dois, tr\xEAs, quatro".',bo.style.textAlign="start";let Dm={width:"100%",marginLeft:"40px",marginBottom:"15px"};this.applyStyles(bo,Dm),fo.appendChild(mo),fo.appendChild(Er),o.appendChild(bo),o.appendChild(fo);let di=document.createElement("div"),Fm={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(di,Fm);let wo=document.createElement("button");wo.setAttribute("id","cancelBtn"),wo.innerText="Cancelar";let Bm={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(wo,Bm);let dl=document.createElement("span"),Mm={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(dl,Mm);let So=document.createElement("button");So.innerText="Continuar",So.setAttribute("id","confirmBtn");let Um={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px",disabled:!0};this.applyStyles(So,Um),di.appendChild(wo),di.appendChild(dl),di.appendChild(So),o.appendChild(di),r.appendChild(o),document.body.appendChild(r)}async setSelectOption(t,r){let i=document.querySelector("#cameraSelect"),o=document.querySelector("#micSelect"),n=await tt();i&&(i.value=t.cameraId||"default"),o&&(o.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};n.cameras.forEach(a=>{let c=s(a.label,a.id);i?.appendChild(c)}),n.microphones.forEach(a=>{let c=s(a.label,a.id);o?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),i=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:i?.value})),i?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:i?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),i=document.getElementById("confirmBtn"),o=document.getElementById("cameraSelect"),n=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),i?.addEventListener("click",()=>{t(),this.closeModal(),s({cameraId:o?.value,microphoneId:n?.value,result:!0})})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),i=document.getElementById("ambientVerifyAlert"),o=document.getElementById("checkmark_FacePosition"),n=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),u=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),i&&(i.style.color="#16A34A"),a&&a.setAttribute("title",""),o&&(o.setAttribute("class","checkmark"),n.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),u.setAttribute("class","checkmark_kick"))):(o&&(t.description==="Nenhuma face encontrada"||t.description==="Face na posi\xE7\xE3o errada")&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),n.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(i&&(i.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),u.setAttribute("class","checkmark_kick_error")))}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),i=document.getElementById("alertDivResolution"),o=document.getElementById("info_resolution"),n=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",o&&(o.style.display="none"),r.setAttribute("title",""),n.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",o&&(o.style.display="block"),i.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
168
+ `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let i={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(r,i);let o=document.createElement("div"),n={backgroundColor:"#fff",zIndex:"1001",width:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,n);let s=document.createElement("h3");s.innerText="Para iniciar configure a c\xE2mera e o microfone";let a={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(s,a),o.appendChild(s);let c=document.createElement("div"),l=document.createElement("h3"),d=document.createElement("select");d.setAttribute("id","cameraSelect");let u={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,u),l.innerText="C\xE2mera";let m={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,m),d.style.maxWidth="400px",c.appendChild(l),c.appendChild(d),o.appendChild(c);let f=document.createElement("div");f.setAttribute("id","liveCheckDevices");let h=document.createElement("div"),g=document.createElement("video"),y=document.createElement("div");g.setAttribute("id","cameraStream"),g.muted=!0;let v={width:"calc(100% - 40px)",display:"flex",justifyContent:"space-between",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",transform:"rotateY(180deg)"};this.applyStyles(f,v);let S={width:"20rem",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(g,S),this.applyStyles(h,{position:"relative"});let x=document.createElement("div");x.setAttribute("class","alert-div"),x.setAttribute("id","alertDivResolution");let O=document.createElement("error");O.setAttribute("id","resolutionAlert"),O.innerText="Resolu\xE7\xE3o m\xEDnima",O.style.marginLeft="10px",O.style.marginRight="5px";let ne=document.createElement("span"),F=document.createElement("div"),go=document.createElement("div");ne.setAttribute("id","checkmark_resolution"),F.setAttribute("id","checkmark_stem_resolution"),go.setAttribute("id","checkmark_kick_resolution"),ne.appendChild(F),ne.appendChild(go);let rt=document.createElement("span"),ll=document.createElement("div"),dl=document.createElement("div");rt.setAttribute("class","info"),rt.setAttribute("id","info_resolution"),ll.setAttribute("class","info_stem"),dl.setAttribute("class","info_kick"),rt.appendChild(ll),rt.appendChild(dl),x.appendChild(ne),x.appendChild(O),x.appendChild(rt);let hi=document.createElement("div");hi.setAttribute("class","alert-div"),hi.setAttribute("id","alertDivFacePosition");let yo=document.createElement("error");yo.setAttribute("id","facePositionAlert"),yo.innerText="Posicionamento da face",yo.style.marginLeft="10px";let vo=document.createElement("span"),ul=document.createElement("div"),hl=document.createElement("div");vo.setAttribute("id","checkmark_FacePosition"),ul.setAttribute("id","checkmark_stem_FacePosition"),hl.setAttribute("id","checkmark_kick_FacePosition"),vo.appendChild(ul),vo.appendChild(hl),hi.appendChild(vo),hi.appendChild(yo);let pi=document.createElement("div");pi.setAttribute("class","alert-div"),pi.setAttribute("id","alertDivAmbientVerify");let bo=document.createElement("error");bo.setAttribute("id","ambientVerifyAlert"),bo.innerText="Verifica\xE7\xE3o do ambiente",bo.style.marginLeft="10px";let wo=document.createElement("span"),pl=document.createElement("div"),ml=document.createElement("div");wo.setAttribute("id","checkmark_AmbientVerify"),pl.setAttribute("id","checkmark_stem_AmbientVerify"),ml.setAttribute("id","checkmark_kick_AmbientVerify"),wo.appendChild(pl),wo.appendChild(ml),pi.appendChild(wo),pi.appendChild(bo);let xr=document.createElement("div");xr.setAttribute("class","alert-div"),xr.setAttribute("id","alertDivSpyCam"),xr.style.display="none";let So=document.createElement("error");So.setAttribute("id","SpyCamAlert"),So.innerText="Verifica\xE7\xE3o de Spy Cam",So.style.marginLeft="10px";let ko=document.createElement("span"),fl=document.createElement("div"),gl=document.createElement("div");ko.setAttribute("id","checkmark_SpyCam"),fl.setAttribute("id","checkmark_stem_SpyCam"),gl.setAttribute("id","checkmark_kick_SpyCam"),ko.appendChild(fl),ko.appendChild(gl),xr.appendChild(ko),xr.appendChild(So),y.style.transform="rotateY(180deg)",y.appendChild(x),y.appendChild(hi),y.appendChild(pi),y.appendChild(xr),f.appendChild(y),h.appendChild(g),f.appendChild(h);let It=document.createElement("div");It.setAttribute("class","facial-biometry__mask"),It.style.width="100%",It.style.height="100%",It.style.position="absolute",It.style.top="0px",It.style.left="0px",It.style.backgroundColor="#fff",It.style.opacity="0.6";let zt=document.createElement("div");zt.setAttribute("class","biometry__frame"),zt.style.width="100%",zt.style.height="100%",zt.style.position="absolute",zt.style.top="0px",zt.style.left="0px",zt.style.zIndex="10",h.appendChild(It),h.appendChild(zt),o.appendChild(f);let Eo=document.createElement("div"),Is=document.createElement("h3"),Rs=document.createElement("select");Rs.setAttribute("id","micSelect");let Uf={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(Eo,Uf),Is.innerText="Microfone";let Lf={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(Is,Lf),Rs.style.maxWidth="400px",Eo.appendChild(Is),Eo.appendChild(Rs),o.appendChild(Eo);let Ao=document.createElement("div"),Nf={width:"100%",padding:"0px 40px",display:"flex"};this.applyStyles(Ao,Nf);let _o=document.createElement("div"),jf={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(_o,jf);let xo=document.createElement("div");xo.setAttribute("id","audioStream");let Vf={display:"flex",marginBottom:"15px"};this.applyStyles(xo,Vf);let zf={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let El=0;El<25;El++){let Al=document.createElement("div");this.applyStyles(Al,zf),xo.appendChild(Al)}let mi=document.createElement("div"),yl=document.createElement("p"),vl=document.createElement("p"),bl=document.createElement("p"),Gf={width:"250px",display:"flex",justifyContent:"space-between"};this.applyStyles(mi,Gf),yl.innerText="0",vl.innerText="50",bl.innerText="100",mi.appendChild(yl),mi.appendChild(vl),mi.appendChild(bl);let Cr=document.createElement("div");Cr.setAttribute("class","alert-div"),Cr.setAttribute("id","alertDivMicrophone");let Hf={alignItems:"start",justifyContent:"end",width:"inherit"};this.applyStyles(Cr,Hf);let Co=document.createElement("error");Co.setAttribute("id","microphoneAlert"),Co.innerText="Teste de funcionamento",Co.style.marginLeft="10px";let To=document.createElement("span"),wl=document.createElement("div"),Sl=document.createElement("div");To.setAttribute("id","checkmark_microphone"),wl.setAttribute("id","checkmark_stem_microphone"),Sl.setAttribute("id","checkmark_kick_microphone"),To.appendChild(wl),To.appendChild(Sl),Cr.appendChild(To),Cr.appendChild(Co),_o.appendChild(xo),_o.appendChild(mi);let Po=document.createElement("p");Po.innerText='Pronuncie em voz alta: "um, dois, tr\xEAs, quatro".',Po.style.textAlign="start";let Wf={width:"100%",marginLeft:"40px",marginBottom:"15px"};this.applyStyles(Po,Wf),Ao.appendChild(_o),Ao.appendChild(Cr),o.appendChild(Po),o.appendChild(Ao);let fi=document.createElement("div"),qf={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(fi,qf);let Io=document.createElement("button");Io.setAttribute("id","cancelBtn"),Io.innerText="Cancelar";let $f={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Io,$f);let kl=document.createElement("span"),Xf={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(kl,Xf);let Tr=document.createElement("button");Tr.innerText="Continuar",Tr.setAttribute("id","confirmBtn");let Kf={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Tr,Kf),this.options.useSpyScan&&(Tr.style.cursor="not-allowed",Tr.setAttribute("disabled","true")),fi.appendChild(Io),fi.appendChild(kl),fi.appendChild(Tr),o.appendChild(fi),r.appendChild(o),document.body.appendChild(r)}async setSelectOption(t,r){let i=document.querySelector("#cameraSelect"),o=document.querySelector("#micSelect"),n=await it();i&&(i.value=t.cameraId||"default"),o&&(o.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};n.cameras.forEach(a=>{let c=s(a.label,a.id);i?.appendChild(c)}),n.microphones.forEach(a=>{let c=s(a.label,a.id);o?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),i=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:i?.value})),i?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:i?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),i=document.getElementById("confirmBtn"),o=document.getElementById("cameraSelect"),n=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),i?.addEventListener("click",()=>{i.disabled||(t(),this.closeModal(),s({cameraId:o?.value,microphoneId:n?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),i=document.getElementById("ambientVerifyAlert"),o=document.getElementById("checkmark_FacePosition"),n=document.getElementById("checkmark_stem_FacePosition"),s=document.getElementById("checkmark_kick_FacePosition"),a=document.getElementById("alertDivAmbientVerify"),c=document.getElementById("checkmark_AmbientVerify"),l=document.getElementById("checkmark_stem_AmbientVerify"),d=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),i&&(i.style.color="#16A34A"),a&&a.setAttribute("title",""),o&&(o.setAttribute("class","checkmark"),n.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")),c&&(c.setAttribute("class","checkmark"),l.setAttribute("class","checkmark_stem"),d.setAttribute("class","checkmark_kick"))):(o&&(t.description==="Nenhuma face encontrada"||t.description==="Face na posi\xE7\xE3o errada")&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),n.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error")),c&&t.description==="M\xFAltiplas faces detectadas"&&(i&&(i.style.color="#FF0000"),a&&a.setAttribute("title",`${t.description}`),c.setAttribute("class","checkmark_error"),l.setAttribute("class","checkmark_stem_error"),d.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),i=document.getElementById("alertDivSpyCam");if(i&&(i.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","true"),o&&(o.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let o=document.getElementById("confirmBtn");o&&o.setAttribute("disabled","false"),o&&(o.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),i=document.getElementById("confirmBtn"),o=document.getElementById("alertDivSpyCam");o&&(o.style.display="flex");let n=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),n&&(n.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):n&&(r&&(r.style.color="#FF0000"),n.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&i?.removeAttribute("disabled"),i&&(i.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),i=document.getElementById("alertDivResolution"),o=document.getElementById("info_resolution"),n=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",o&&(o.style.display="none"),r.setAttribute("title",""),n.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",o&&(o.style.display="block"),i.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
169
169
  Para iniciar um exame utilize uma outra c\xE2mera.`),n.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error"))}videoDeviceInterfaceUI(t){let r=document.querySelector("#cameraStream");r&&(r.srcObject=t,r.play())}audioDeviceInterfaceUIAllowedAmbient(t){let r=document.getElementById("ambientVerifyAlert"),i=document.getElementById("alertDivAmbientVerify"),o=document.getElementById("checkmark_AmbientVerify"),n=document.getElementById("checkmark_stem_AmbientVerify"),s=document.getElementById("checkmark_kick_AmbientVerify");t?(r&&(r.style.color="#16A34A"),i&&i.setAttribute("title",""),o.setAttribute("class","checkmark"),n.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),i&&i.setAttribute("title","Ambiente apresentando muito ru\xEDdo!"),o.setAttribute("class","checkmark_error"),n.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIMicrophoneWorks(t){let r=document.getElementById("microphoneAlert"),i=document.getElementById("alertDivMicrophone"),o=document.getElementById("checkmark_microphone"),n=document.getElementById("checkmark_stem_microphone"),s=document.getElementById("checkmark_kick_microphone");t?(r&&(r.style.color="#16A34A"),i&&i.setAttribute("title",""),o&&o.setAttribute("class","checkmark"),n&&n.setAttribute("class","checkmark_stem"),s&&s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),i&&i.setAttribute("title","Microfone n\xE3o est\xE1 funcionando corretamente!"),o&&o.setAttribute("class","checkmark_error"),n&&n.setAttribute("class","checkmark_stem_error"),s&&s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIErrorExec(){let t=document.getElementById("microphoneAlert"),r=document.getElementById("checkmark_microphone"),i=document.getElementById("checkmark_stem_microphone"),o=document.getElementById("checkmark_kick_microphone");t&&(t.style.color="#FF0000"),r&&r.setAttribute("class","checkmark_error"),i&&i.setAttribute("class","checkmark_stem_error"),o&&o.setAttribute("class","checkmark_kick_error")}audioDeviceInterfaceUIPills(t){let i=document.querySelector("#audioStream")?.querySelectorAll("div"),o=document.querySelector("#audioText"),n=t/4;i?.forEach((s,a)=>{a<Math.ceil(n)?s.style.backgroundColor="rgb(22, 163, 74)":s.style.backgroundColor="rgba(0, 0, 0, .3)"}),o&&(o.innerText=t.toFixed(0).toString())}async addStyleMask(){let t=`
170
170
  .facial-biometry__mask {
171
171
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
@@ -195,7 +195,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),n.setAttribute("class","che
195
195
  // -webkit-mask-position: center;
196
196
  // -webkit-mask-repeat: no-repeat;
197
197
  }
198
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[i,o]of Object.entries(r))t.style[i]=o}};var St=class{constructor(t){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.volumeMedia=0;this.volumeSum=0;this.volumeCounter=0;this.microphoneMinThreshold=5;this.allowedResolution=!0;this.allowedAmbient=!0;this.allowedPositionFace=!0;this.allowedMicrophone=!1;this.noiseLimit=0;this.faceDetection=new Gr({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new Kr({type:t?.type||"prod",token:t.token})}async runCheckDevicesFlow(t,r,i,o,n){if(St.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");St.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r),a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>n(l);let c=new Promise((l,u)=>{i(()=>{this.closeCheckDevices(),l({result:!0,cameraId:t.cameraId||"default",microphoneId:t.microphoneId||"default",volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,faceDetectionAlerts:this.faceDetectionAlerts}),St.isModalOpen=!1}),o(()=>{this.closeCheckDevices(),l({result:!1}),St.isModalOpen=!1})});return{...a,result:c}}catch(s){return this.closeCheckDevices(),St.isModalOpen=!1,Promise.reject(s)}}onUpdateCallback(){typeof this.onUpdateCb=="function"&&this.onUpdateCb({allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,faceDetectionAlerts:this.faceDetectionAlerts})}async checkDevices(t=at,r=Th){if(St.isModalOpen)return Promise.reject();St.isModalOpen=!0,this.DeviceCheckerUI=new In(t,r);try{this.options={...at,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let i=await this.backend.getParamsConfig(this.context);this.noiseLimit=i.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r);let{cameraId:o,microphoneId:n,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{a({result:s,cameraId:o,microphoneId:n,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,faceDetectionAlerts:this.faceDetectionAlerts})})}catch(i){return this.closeCheckDevices(),this.DeviceCheckerUI.closeModal(),Promise.reject(i)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings();this.videoOptions.minWidth>t.width||this.videoOptions.minHeight>t.height?this.allowedResolution=!1:this.allowedResolution=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.isUnderResolutionUI(this.allowedResolution)}realtimeAlerts(t){this.faceDetectionAlerts=t,t.status==="OK"?(this.allowedPositionFace=!0,this.allowedAmbient=!0):(this.allowedPositionFace=!1,this.allowedAmbient=!1),this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.realtimeAlertsUI(t)}videoDeviceInterface(t){this.DeviceCheckerUI&&this.DeviceCheckerUI.videoDeviceInterfaceUI(t),this.isUnderResolution(),this.faceDetection.enableCam(t)}audioDeviceInterface(t){this.volumeMeter=new tr(this.cameraRecorder.cameraStream),this.volumeMeter.start({setVolume:r=>{this.volumeCounter++,this.volumeSum+=r,!this.allowedMicrophone&&r>this.microphoneMinThreshold?(this.allowedMicrophone=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!0)):this.allowedMicrophone||this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIPills(r),r>this.noiseLimit?(this.allowedAmbient=!1,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!1)):(this.allowedAmbient=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!0))}}).catch(r=>{console.log(r),this.volumeMeter=void 0,this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec()})}async changeSelectedDevice({cameraId:t,microphoneId:r}){return this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new Mt({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=at,r){if(this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,i=>this.changeSelectedDevice(i)),this.videoOptions=dn(r),await ko(),this.cameraRecorder=new Mt({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let i=document.querySelector("#confirmBtn");i.disabled=!1}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){St.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}},$i=St;$i.isModalOpen=!1;var Jr=class{constructor(){}async takePicture(t,r,i={width:1080,height:720}){return this.resolution=i,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),i={audio:!1,video:{facingMode:"user",aspectRatio:1.777777778,width:{min:640,ideal:640,max:1920},height:{min:400,ideal:480},deviceId:t}};this.cameraRecorder=new Mt({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startRecording(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),i=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),i.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((i,o)=>{let n=document.createElement("div");n.setAttribute("id","authPhoto"),n.style.backgroundColor="rgba(0,0,0,0.4)",n.style.zIndex="1000",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.height="100vh",n.style.width="100%",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center";let s=document.createElement("div");s.style.backgroundColor="#fff",s.style.zIndex="1001",s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.height="100vh",s.style.width="100%",s.style.borderRadius="10px",s.style.display="flex",s.style.flexDirection="column",s.style.alignItems="center",s.style.boxSizing="border-box";let a=document.createElement("h3");a.innerText=t||"Biometria Facial",a.style.color="rgba(0, 0, 0, .7)",a.style.fontWeight="bold",a.style.fontSize="20px",a.style.marginTop="0px",a.style.marginBottom="15px",a.style.padding="20px 0px 0px",a.style.width="100%",a.style.textAlign="center",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.zIndex="1010",s.appendChild(a);let c=document.createElement("p");c.innerText=r||"Encaixe seu rosto no formato e clique no bot\xE3o abaixo",c.style.color="rgba(0, 0, 0, .7)",c.style.fontWeight="normal",c.style.fontSize="16px",c.style.marginBottom="15px",c.style.padding="0px 0px 20px",c.style.width="100%",c.style.textAlign="center",c.style.position="fixed",c.style.top="55px",c.style.left="0",c.style.zIndex="1011",s.appendChild(c);let l=document.createElement("div"),u=document.createElement("h3"),d=document.createElement("select");d.setAttribute("id","cameraSelect"),l.style.padding="0 20px",l.style.width="100%",l.style.display="flex",l.style.justifyContent="space-between",l.style.marginBottom="15px",u.innerText="C\xE2mera",u.style.color="rgba(0, 0, 0, .75)",u.style.fontWeight="bold",u.style.fontSize="16px",l.appendChild(u),l.appendChild(d);let f=document.createElement("div"),m=document.createElement("video");m.setAttribute("id","cameraStream"),m.muted=!0,f.style.position="fixed",f.style.top="0",f.style.left="0",f.style.height="100vh",f.style.width="100%",f.style.display="flex",f.style.justifyContent="center",m.style.backgroundColor="#000",m.style.borderRadius="10px",m.style.width="auto",m.style.height="auto",m.style.minHeight="100%",f.appendChild(m);let h=document.createElement("canvas");h.setAttribute("id","canvas"),h.style.display="none",h.style.width="100%",h.style.height="100%";let g=document.createElement("img");g.setAttribute("id","image"),g.style.objectFit="contain",g.style.display="none",g.style.borderRadius="8px",f.appendChild(h),f.appendChild(g);let y=document.createElement("div");y.setAttribute("class","facial-biometry__mask"),y.style.width="100%",y.style.height="100%",y.style.position="absolute",y.style.top="0px",y.style.left="0px",y.style.backgroundColor="#fff",y.style.opacity="0.8";let _=document.createElement("div");_.setAttribute("class","biometry__frame"),_.style.width="100%",_.style.height="100%",_.style.position="absolute",_.style.top="0px",_.style.left="0px",_.style.zIndex="10",f.appendChild(y),f.appendChild(_),s.appendChild(f),this.addStyleMask();let v=document.createElement("button"),T=document.createElement("div");v.setAttribute("id","confirmBtn"),T.style.position="fixed",T.style.bottom="0",T.style.left="0",T.style.width="100%",T.style.display="flex",T.style.alignItems="center",T.style.justifyContent="center",v.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",v.style.width="70px",v.style.height="70px",v.style.borderRadius="70px",v.style.border="none",v.style.backgroundColor="#16a34a",v.style.margin="20px";let q=document.createElement("button");q.setAttribute("id","closeModal"),q.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",q.style.width="70px",q.style.height="70px",q.style.borderRadius="70px",q.style.border="none",q.style.backgroundColor="#e74141",q.style.margin="20px",T.appendChild(q),T.appendChild(v),s.appendChild(T);let me=document.createElement("button");me.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",me.style.width="70px",me.style.height="70px",me.style.borderRadius="70px",me.style.border="none",me.style.backgroundColor="#e74141",me.style.margin="20px 20px";let Ie=document.createElement("button");Ie.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",Ie.style.width="70px",Ie.style.height="70px",Ie.style.borderRadius="70px",Ie.style.border="none",Ie.style.backgroundColor="#16a34a",Ie.style.margin="20px 20px",n.appendChild(s),document.body.appendChild(n),this.setSelectOption(),this.startCapture(),v.addEventListener("click",()=>{T.removeChild(v),T.removeChild(q),T.appendChild(me),T.appendChild(Ie),this.shot(),m.style.display="none",g.style.display="block"}),me.addEventListener("click",()=>{T.appendChild(q),T.appendChild(v),T.removeChild(me),T.removeChild(Ie),m.style.display="block",g.style.display="none"}),Ie.addEventListener("click",()=>{this.closeInterface(),i({base64:this.base64})}),q.addEventListener("click",()=>{this.closeInterface(),o(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await tt();t&&(t.value="default");let i=(o,n)=>{let s=document.createElement("option");return s.setAttribute("value",n),s.innerHTML=o,s};r.cameras.forEach(o=>{let n=i(o.label,o.id);t?.appendChild(n)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopRecording(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
198
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[i,o]of Object.entries(r))t.style[i]=o}};var At=class{constructor(t){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.volumeMedia=0;this.volumeSum=0;this.volumeCounter=0;this.microphoneMinThreshold=5;this.allowedResolution=!0;this.allowedAmbient=!0;this.allowedPositionFace=!0;this.allowedMicrophone=!1;this.allowedSpyScan=null;this.noiseLimit=0;this.faceDetection=new Xr({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new Et({type:t?.type||"prod",token:t.token})}async runCheckDevicesFlow(t,r,i,o,n){if(At.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");this.options={...Ye,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},At.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r);this.checkSpyScan();let a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>n(l);let c=new Promise((l,d)=>{i(()=>{this.closeCheckDevices(),l({result:!0,cameraId:t.cameraId||"default",microphoneId:t.microphoneId||"default",volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts}),At.isModalOpen=!1}),o(()=>{this.closeCheckDevices(),l({result:!1}),At.isModalOpen=!1})});return{...a,result:c}}catch(s){throw this.closeCheckDevices(),At.isModalOpen=!1,s}}onUpdateCallback(){typeof this.onUpdateCb=="function"&&this.onUpdateCb({allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts})}async checkDevices(t=Ye,r=gp){if(At.isModalOpen)return Promise.reject();At.isModalOpen=!0,this.DeviceCheckerUI=new Vn(t,r);try{this.options={...Ye,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let i=await this.backend.getParamsConfig(this.context);this.noiseLimit=i.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r),await this.checkSpyScan();let{cameraId:o,microphoneId:n,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{a({result:s,cameraId:o,microphoneId:n,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts})})}catch(i){return this.closeCheckDevices(),this.DeviceCheckerUI.closeModal(),Promise.reject(i)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings();this.videoOptions.minWidth>t.width||this.videoOptions.minHeight>t.height?this.allowedResolution=!1:this.allowedResolution=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.isUnderResolutionUI(this.allowedResolution)}realtimeAlerts(t){this.faceDetectionAlerts=t,t.status==="OK"?(this.allowedPositionFace=!0,this.allowedAmbient=!0):(this.allowedPositionFace=!1,this.allowedAmbient=!1),this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.realtimeAlertsUI(t)}videoDeviceInterface(t){this.DeviceCheckerUI&&this.DeviceCheckerUI.videoDeviceInterfaceUI(t),this.isUnderResolution(),this.faceDetection.enableCam(t)}audioDeviceInterface(t){this.volumeMeter=new ir(this.cameraRecorder.cameraStream),this.volumeMeter.start({setVolume:r=>{this.volumeCounter++,this.volumeSum+=r,!this.allowedMicrophone&&r>this.microphoneMinThreshold?(this.allowedMicrophone=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!0)):this.allowedMicrophone||this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIMicrophoneWorks(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIPills(r),r>this.noiseLimit?(this.allowedAmbient=!1,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!1)):(this.allowedAmbient=!0,this.onUpdateCallback(),this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIAllowedAmbient(!0))}}).catch(r=>{console.log(r),this.volumeMeter=void 0,this.DeviceCheckerUI&&this.DeviceCheckerUI.audioDeviceInterfaceUIErrorExec()})}async changeSelectedDevice({cameraId:t,microphoneId:r}){return this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new Nt({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=Ye,r){if(this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,i=>this.changeSelectedDevice(i)),this.videoOptions=Bn(r),await Ro(),this.cameraRecorder=new Nt({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startRecording(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let i=document.querySelector("#confirmBtn");!this.options.useSpyScan&&(i.disabled=!1)}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){At.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopRecording&&await this.cameraRecorder.stopRecording(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}async checkSpyScan(){if(this.spycam=new ei(this.context,{}),this.allowedSpyScan=null,this.options.useSpyScan){this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!0);try{await this.spycam.isPluggedIn()?await this.spycam.devices({deviceType:3}).then(r=>{r?.length>0?this.allowedSpyScan=!1:this.allowedSpyScan=!0}).finally(()=>{this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.allowedSpyScan!=null&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan)}):(this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan))}catch(t){this.allowedSpyScan=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!1),this.DeviceCheckerUI&&this.DeviceCheckerUI.isSpyDevicesUI(this.allowedSpyScan),console.log(t)}}}},Yi=At;Yi.isModalOpen=!1;var ti=class{constructor(){}async takePicture(t,r,i={width:1080,height:720}){return this.resolution=i,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),i={audio:!1,video:{facingMode:"user",aspectRatio:1.777777778,width:{min:640,ideal:640,max:1920},height:{min:400,ideal:480},deviceId:t}};this.cameraRecorder=new Nt({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startRecording(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),i=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),i.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((i,o)=>{let n=document.createElement("div");n.setAttribute("id","authPhoto"),n.style.backgroundColor="rgba(0,0,0,0.4)",n.style.zIndex="1000",n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.height="100vh",n.style.width="100%",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center";let s=document.createElement("div");s.style.backgroundColor="#fff",s.style.zIndex="1001",s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.height="100vh",s.style.width="100%",s.style.borderRadius="10px",s.style.display="flex",s.style.flexDirection="column",s.style.alignItems="center",s.style.boxSizing="border-box";let a=document.createElement("h3");a.innerText=t||"Biometria Facial",a.style.color="rgba(0, 0, 0, .7)",a.style.fontWeight="bold",a.style.fontSize="20px",a.style.marginTop="0px",a.style.marginBottom="15px",a.style.padding="20px 0px 0px",a.style.width="100%",a.style.textAlign="center",a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.zIndex="1010",s.appendChild(a);let c=document.createElement("p");c.innerText=r||"Encaixe seu rosto no formato e clique no bot\xE3o abaixo",c.style.color="rgba(0, 0, 0, .7)",c.style.fontWeight="normal",c.style.fontSize="16px",c.style.marginBottom="15px",c.style.padding="0px 0px 20px",c.style.width="100%",c.style.textAlign="center",c.style.position="fixed",c.style.top="55px",c.style.left="0",c.style.zIndex="1011",s.appendChild(c);let l=document.createElement("div"),d=document.createElement("h3"),u=document.createElement("select");u.setAttribute("id","cameraSelect"),l.style.padding="0 20px",l.style.width="100%",l.style.display="flex",l.style.justifyContent="space-between",l.style.marginBottom="15px",d.innerText="C\xE2mera",d.style.color="rgba(0, 0, 0, .75)",d.style.fontWeight="bold",d.style.fontSize="16px",l.appendChild(d),l.appendChild(u);let m=document.createElement("div"),f=document.createElement("video");f.setAttribute("id","cameraStream"),f.muted=!0,m.style.position="fixed",m.style.top="0",m.style.left="0",m.style.height="100vh",m.style.width="100%",m.style.display="flex",m.style.justifyContent="center",f.style.backgroundColor="#000",f.style.borderRadius="10px",f.style.width="auto",f.style.height="auto",f.style.minHeight="100%",m.appendChild(f);let h=document.createElement("canvas");h.setAttribute("id","canvas"),h.style.display="none",h.style.width="100%",h.style.height="100%";let g=document.createElement("img");g.setAttribute("id","image"),g.style.objectFit="contain",g.style.display="none",g.style.borderRadius="8px",m.appendChild(h),m.appendChild(g);let y=document.createElement("div");y.setAttribute("class","facial-biometry__mask"),y.style.width="100%",y.style.height="100%",y.style.position="absolute",y.style.top="0px",y.style.left="0px",y.style.backgroundColor="#fff",y.style.opacity="0.8";let v=document.createElement("div");v.setAttribute("class","biometry__frame"),v.style.width="100%",v.style.height="100%",v.style.position="absolute",v.style.top="0px",v.style.left="0px",v.style.zIndex="10",m.appendChild(y),m.appendChild(v),s.appendChild(m),this.addStyleMask();let S=document.createElement("button"),x=document.createElement("div");S.setAttribute("id","confirmBtn"),x.style.position="fixed",x.style.bottom="0",x.style.left="0",x.style.width="100%",x.style.display="flex",x.style.alignItems="center",x.style.justifyContent="center",S.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",S.style.width="70px",S.style.height="70px",S.style.borderRadius="70px",S.style.border="none",S.style.backgroundColor="#16a34a",S.style.margin="20px";let O=document.createElement("button");O.setAttribute("id","closeModal"),O.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",O.style.width="70px",O.style.height="70px",O.style.borderRadius="70px",O.style.border="none",O.style.backgroundColor="#e74141",O.style.margin="20px",x.appendChild(O),x.appendChild(S),s.appendChild(x);let ne=document.createElement("button");ne.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",ne.style.width="70px",ne.style.height="70px",ne.style.borderRadius="70px",ne.style.border="none",ne.style.backgroundColor="#e74141",ne.style.margin="20px 20px";let F=document.createElement("button");F.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",F.style.width="70px",F.style.height="70px",F.style.borderRadius="70px",F.style.border="none",F.style.backgroundColor="#16a34a",F.style.margin="20px 20px",n.appendChild(s),document.body.appendChild(n),this.setSelectOption(),this.startCapture(),S.addEventListener("click",()=>{x.removeChild(S),x.removeChild(O),x.appendChild(ne),x.appendChild(F),this.shot(),f.style.display="none",g.style.display="block"}),ne.addEventListener("click",()=>{x.appendChild(O),x.appendChild(S),x.removeChild(ne),x.removeChild(F),f.style.display="block",g.style.display="none"}),F.addEventListener("click",()=>{this.closeInterface(),i({base64:this.base64})}),O.addEventListener("click",()=>{this.closeInterface(),o(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await it();t&&(t.value="default");let i=(o,n)=>{let s=document.createElement("option");return s.setAttribute("value",n),s.innerHTML=o,s};r.cameras.forEach(o=>{let n=i(o.label,o.id);t?.appendChild(n)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopRecording(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
199
199
  .facial-biometry__mask {
200
200
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
201
201
  mask-size: cover, auto 65%;
@@ -224,16 +224,16 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),n.setAttribute("class","che
224
224
  // -webkit-mask-position: center;
225
225
  // -webkit-mask-repeat: no-repeat;
226
226
  }
227
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var On=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,i)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),i(new Error("N\xE3o foi poss\xEDvel se conectar com a extens\xE3o"))),this.responseStart&&(clearInterval(t),r(this.responseStart)),this.tryes++},1e3)})}sendVerifyMsg(t,r){window.postMessage({type:"easyproctor",func:"verifyExtensionEasyproctor",url:t,token:r},"*")}verify(t){return t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="progress"&&this.options.onProgress&&this.options.onProgress(100),t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="start"&&(this.responseStart=!0),new Promise((r,i)=>{t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="version"&&(this.hasExtension=!0,r(this.hasExtension))})}addEventListener(){window.addEventListener("message",t=>this.verify(t))}};var Dn=class{constructor(t,r){this.repositoryDevices=t,this.proctoringId=r}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await tt(),i=(d,f)=>d.label===f.label&&d.id===f.id,o=(d,f,m)=>d.filter(h=>!f.some(g=>m(h,g))),n=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:n?.cameras||[s],microphones:n?.microphones||[s]},c,l;r.cameras.length!=a?.cameras.length&&(c=r.cameras.length>a?.cameras.length?o(r.cameras,a?.cameras,i):o(a?.cameras,r.cameras,i),c=c.filter(d=>d.id!="default")),r.microphones.length!=a?.microphones.length&&(l=r.microphones.length>a?.microphones.length?o(r.microphones,a?.microphones,i):o(a?.microphones,r.microphones,i),l=l.filter(d=>d.id!="default"&&d.id!="communications"));let u={cameras:c||[],microphones:l||[],status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"};await this.repositoryDevices.save({...r,id:"devices",status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"}),t.status&&(u.cameras.length!=0||u.microphones.length!=0)&&(R.registerChangeDevice(this.proctoringId,u.status,u),t.status(u))}};var yp=Wm(gp()),Yr=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:i,onProgress:o}=t;try{R.registerDownloadFile(this.proctoringId,`File to download
227
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var zn=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,i)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),i(new Error("N\xE3o foi poss\xEDvel se conectar com a extens\xE3o"))),this.responseStart&&(clearInterval(t),r(this.responseStart)),this.tryes++},1e3)})}sendVerifyMsg(t,r){window.postMessage({type:"easyproctor",func:"verifyExtensionEasyproctor",url:t,token:r},"*")}verify(t){return t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="progress"&&this.options.onProgress&&this.options.onProgress(100),t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="start"&&(this.responseStart=!0),new Promise((r,i)=>{t.source==window&&t.data.sender&&t.data.sender==="easyproctor-extension"&&t.data.message_name&&t.data.message_name==="version"&&(this.hasExtension=!0,r(this.hasExtension))})}addEventListener(){window.addEventListener("message",t=>this.verify(t))}};var Gn=class{constructor(t,r){this.repositoryDevices=t,this.proctoringId=r}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await it(),i=(u,m)=>u.label===m.label&&u.id===m.id,o=(u,m,f)=>u.filter(h=>!m.some(g=>f(h,g))),n=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:n?.cameras||[s],microphones:n?.microphones||[s]},c,l;r.cameras.length!=a?.cameras.length&&(c=r.cameras.length>a?.cameras.length?o(r.cameras,a?.cameras,i):o(a?.cameras,r.cameras,i),c=c.filter(u=>u.id!="default")),r.microphones.length!=a?.microphones.length&&(l=r.microphones.length>a?.microphones.length?o(r.microphones,a?.microphones,i):o(a?.microphones,r.microphones,i),l=l.filter(u=>u.id!="default"&&u.id!="communications"));let d={cameras:c||[],microphones:l||[],status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"};await this.repositoryDevices.save({...r,id:"devices",status:r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out"}),t.status&&(d.cameras.length!=0||d.microphones.length!=0)&&(I.registerChangeDevice(this.proctoringId,d.status,JSON.stringify(d,null,2)),t.status(d))}};var Pp=i1(Tp()),ri=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:i,onProgress:o}=t;try{I.registerDownloadFile(this.proctoringId,`File to download
228
228
  File name: ${i.name}
229
229
  File type: ${i.type}
230
- File size: ${i.size}}`),(0,yp.saveAs)(i),this.loadingBoolean=!1,clearInterval(this.loadingInterval),o&&o(Math.round(100))}catch{throw i&&this.proctoringId&&R.registerError(this.proctoringId,`Failed on machine download
230
+ File size: ${i.size}}`),(0,Pp.saveAs)(i),this.loadingBoolean=!1,clearInterval(this.loadingInterval),o&&o(Math.round(100))}catch{throw i&&this.proctoringId&&I.registerError(this.proctoringId,`Failed on machine download
231
231
  File name: ${i.name}
232
232
  File type: ${i.type}
233
- File size: ${i.size}`),new Error("Error on machine download")}}};var Fn=class{constructor(t,r){this.session=t;this.recorders=r}async startAll(){this.session.start();for(let t of this.recorders)await t.startRecording()}async pauseAll(){this.session.pause();for(let t of this.recorders)await t.pauseRecording()}async resumeAll(){this.session.resume();for(let t of this.recorders)await t.resumeRecording()}async stopAll(){for(let t of this.recorders)await t.stopRecording();this.session.stop()}async saveAllOnSession(){for(let t of this.recorders)await t.saveOnSession(this.session)}};var Zr=class{constructor(t,r,i){this.session=t;this.proctoringId=r;this.uploadServices=i}async upload(t,r){await this.uploadRecordings(t,r)}async uploadRecordings(t,r){await this.uploadAllFiles(t,r),this.session.hasSomethingToUpload||this.session.setUploaded()}async uploadAllFiles(t,r){for(let i=0;i<this.session.recordings.length;i++){let o=this.session.recordings[i];if(o.upload)continue;let n=a=>{let c=(i*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(o,t,n).catch(()=>{});s&&(o.upload||(o.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(o.upload.storage=s.storage),s.storage==="upload"?s.url&&(o.upload.azureUrl=s.url):s.url&&(o.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,i){for await(let o of this.uploadServices){let n=await o.upload({file:t.file,onProgress:s=>{i&&i(s)}},r);if(n){let s="";return t.file.name.search("camera")!==-1?s="Camera":t.file.name.search("screen")!==-1?s="Screen":t.file.name.search("audio")!==-1&&(s="Audio"),R.registerUploadFile(this.proctoringId,`Upload File
233
+ File size: ${i.size}`),new Error("Error on machine download")}}};var Hn=class{constructor(t,r){this.session=t;this.recorders=r}async startAll(){this.session.start();for(let t of this.recorders)await t.startRecording({retry:!1})}async pauseAll(){this.session.pause();for(let t of this.recorders)await t.pauseRecording()}async resumeAll(){this.session.resume();for(let t of this.recorders)await t.resumeRecording()}async stopAll(){for(let t of this.recorders)await t.stopRecording();this.session.stop()}async saveAllOnSession(){for(let t of this.recorders)await t.saveOnSession(this.session)}};var ii=class{constructor(t,r,i){this.session=t;this.proctoringId=r;this.uploadServices=i}async upload(t,r){await this.uploadRecordings(t,r)}async uploadRecordings(t,r){await this.uploadAllFiles(t,r),this.session.hasSomethingToUpload||this.session.setUploaded()}async uploadAllFiles(t,r){for(let i=0;i<this.session.recordings.length;i++){let o=this.session.recordings[i];if(o.upload)continue;let n=a=>{let c=(i*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(o,t,n).catch(()=>{});s&&(o.upload||(o.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(o.upload.storage=s.storage),s.storage==="upload"?s.url&&(o.upload.azureUrl=s.url):s.url&&(o.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,i){for await(let o of this.uploadServices){let n=await o.upload({file:t.file,onProgress:s=>{i&&i(s)}},r);if(n){let s="";return t.file.name.search("camera")!==-1?s="Camera":t.file.name.search("screen")!==-1?s="Screen":t.file.name.search("audio")!==-1&&(s="Audio"),I.registerUploadFile(this.proctoringId,`Upload File
234
234
  Name: ${t.file.name}
235
235
  Type: ${t.file.type}
236
- Size: ${t.file.size}`,s),n}}throw new Error("Could not upload")}};var Bn=class{constructor(t,r){this.alerts=[];this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async pauseRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async resumeRecording(){this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async stopRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}onLostFocus(){Date.now()-this.startTime?.getTime()>1e4&&(this.onLostFocusCallback(),this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:0,alert:25}))}onReturnFocus(){let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback(),t.end=Date.now()-this.startTime.getTime())}};var Mn=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:i,pauseRecording:o,resumeRecording:n}=mr(this.audioStream,this.blobs,void 0,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=i,this.recordingPause=o,this.recordingResume=n,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,i){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&i&&`${r}_${i}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var Tc=typeof self<"u"?self:{};function Zp(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=Tc,o=0;o<r.length;o++)if((i=i[r[o]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function gr(){throw Error("Invalid UTF8")}function vp(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Un,cc,q0=typeof TextDecoder<"u",X0,K0=typeof TextEncoder<"u";function Qp(e){if(K0)e=(X0||=new TextEncoder).encode(e);else{let r=0,i=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)i[r++]=t;else{if(2048>t)i[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let n=e.charCodeAt(++o);if(56320<=n&&57343>=n){t=1024*(t-55296)+n-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}o--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var Zi,ef=Zp(610401301,!1),xc=Zp(572417392,!0),bp=Tc.navigator;function mc(e){return!!ef&&!!Zi&&Zi.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Ze(e){var t;return(t=Tc.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function rr(){return!!ef&&!!Zi&&0<Zi.brands.length}function lc(){return rr()?mc("Chromium"):(Ze("Chrome")||Ze("CriOS"))&&!(!rr()&&Ze("Edge"))||Ze("Silk")}Zi=bp&&bp.userAgentData||null;var J0=!rr()&&(Ze("Trident")||Ze("MSIE"));!Ze("Android")||lc(),lc(),Ze("Safari")&&(lc()||!rr()&&Ze("Coast")||!rr()&&Ze("Opera")||!rr()&&Ze("Edge")||(rr()?mc("Microsoft Edge"):Ze("Edg/"))||rr()&&mc("Opera"));var tf={},qi=null;function Y0(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 i=new Uint8Array(r),o=0;return function(n,s){function a(m){for(;c<n.length;){var h=n.charAt(c++),g=qi[h];if(g!=null)return g;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return m}rf();for(var c=0;;){var l=a(-1),u=a(0),d=a(64),f=a(64);if(f===64&&l===-1)break;s(l<<2|u>>4),d!=64&&(s(u<<4&240|d>>2),f!=64&&s(d<<6&192|f))}}(e,function(n){i[o++]=n}),o!==r?i.subarray(0,o):i}function rf(){if(!qi){qi={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var i=e.concat(t[r].split(""));tf[r]=i;for(var o=0;o<i.length;o++){var n=i[o];qi[n]===void 0&&(qi[n]=o)}}}}var of=typeof Uint8Array<"u",nf=!J0&&typeof btoa=="function";function wp(e){if(!nf){var t;t===void 0&&(t=0),rf(),t=tf[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],n=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|n>>4],n=t[(15&n)<<2|s>>6],s=t[63&s],r[l++]=a+o+n+s}switch(a=0,s=i,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||i;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var Sp=/[-_.]/g,Z0={"-":"+",_:"/",".":"="};function Q0(e){return Z0[e]||""}function sf(e){if(!nf)return Y0(e);Sp.test(e)&&(e=e.replace(Sp,Q0)),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 is(e){return of&&e!=null&&e instanceof Uint8Array}var eg;function os(){return eg||=new Uint8Array(0)}var ii={},tg;function af(e){if(e!==ii)throw Error("illegal external caller")}function oi(){return tg||=new ir(null,ii)}function Cc(e){af(ii);var t=e.D;return(t=t==null||is(t)?t:typeof t=="string"?sf(t):null)==null?t:e.D=t}var ir=class{constructor(e,t){if(af(t),this.D=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}P(){let e=Cc(this);return e?new Uint8Array(e):os()}};function cf(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Pc(){return Error("Failed to read varint, encoding is invalid.")}function lf(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function uf(e){return e.length==0?oi():new ir(e,ii)}function Rc(e){if(typeof e=="string")return{buffer:sf(e),A:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),A:!1};if(e.constructor===Uint8Array)return{buffer:e,A:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),A:!1};if(e.constructor===ir)return{buffer:Cc(e)||os(),A:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),A:!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 Ic(){return typeof BigInt=="function"}var kp=!xc,Ep=!xc,rg=typeof Uint8Array.prototype.slice=="function",df,H=0,re=0;function ri(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[i,o]=Dc(r,e);e=o,r=i}H=r>>>0,re=e>>>0}function hf(e){let t=df||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),re=0,H=t.getUint32(0,!0)}function gc(e,t){return 4294967296*t+(e>>>0)}function Oc(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=gc(e,t),r?-e:e}function Hn(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else Ic()?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+_p(r)+_p(e));return r}function _p(e){return e=String(e),"0000000".slice(e.length)+e}function ns(e){if(16>e.length)ri(Number(e));else if(Ic())e=BigInt(e),H=Number(e&BigInt(4294967295))>>>0,re=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");re=H=0;let r=e.length;for(let i=t,o=(r-t)%6+t;o<=r;i=o,o+=6){let n=Number(e.slice(i,o));re*=1e6,H=1e6*H+n,4294967296<=H&&(re+=Math.trunc(H/4294967296),re>>>=0,H>>>=0)}if(t){let[i,o]=Dc(H,re);H=i,re=o}}}function Dc(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Fc(e,t){let r,i=0,o=0,n=0,s=e.i,a=e.g;do r=s[a++],i|=(127&r)<<n,n+=7;while(32>n&&128&r);for(32<n&&(o|=(127&r)>>4),n=3;32>n&&128&r;n+=7)r=s[a++],o|=(127&r)<<n;if(br(e,a),128>r)return t(i>>>0,o>>>0);throw Pc()}function Bc(e){let t=0,r=e.g,i=r+10,o=e.i;for(;r<i;){let n=o[r++];if(t|=n,(128&n)==0)return br(e,r),!!(127&t)}throw Pc()}function Ne(e){let t=e.i,r=e.g,i=t[r++],o=127&i;if(128&i&&(i=t[r++],o|=(127&i)<<7,128&i&&(i=t[r++],o|=(127&i)<<14,128&i&&(i=t[r++],o|=(127&i)<<21,128&i&&(i=t[r++],o|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Pc();return br(e,r),o}function yc(e){var t=e.i;let r=e.g,i=t[r],o=t[r+1],n=t[r+2];return t=t[r+3],br(e,e.g+4),(i<<0|o<<8|n<<16|t<<24)>>>0}function vc(e){var t=yc(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 ig(e){return Ne(e)}function uc(e,t,{F:r=!1}={}){e.F=r,t&&(t=Rc(t),e.i=t.buffer,e.m=t.A,e.u=0,e.j=e.i.length,e.g=e.u)}function br(e,t){if(e.g=t,t>e.j)throw lf(e.j,t)}function pf(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,i=r+t;if(i>e.j)throw lf(t,e.j-r);return e.g=i,r}function ff(e,t){if(t==0)return oi();var r=pf(e,t);return e.F&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?os():rg?e.slice(r,t):new Uint8Array(e.subarray(r,t))),uf(r)}var Ap=[];function mf(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Ne(e.g)>>>0;if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw cf(r,e.j);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function jn(e){switch(e.i){case 0:e.i!=0?jn(e):Bc(e.g);break;case 1:br(e=e.g,e.g+8);break;case 2:if(e.i!=2)jn(e);else{var t=Ne(e.g)>>>0;br(e=e.g,e.g+t)}break;case 5:br(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!mf(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}jn(e)}break;default:throw cf(e.i,e.j)}}function ss(e,t,r){let i=e.g.j,o=Ne(e.g)>>>0,n=e.g.g+o,s=n-i;if(0>=s&&(e.g.j=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=n,e.g.j=i}function Mc(e){var t=Ne(e.g)>>>0,r=pf(e=e.g,t);if(e=e.i,q0){var i,o=e;(i=cc)||(i=cc=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var n=i.decode(o)}catch(a){if(Un===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),Un=!0}catch{Un=!1}}throw!Un&&(cc=void 0),a}}else{t=(n=r)+t,r=[];let a,c=null;for(;n<t;){var s=e[n++];128>s?r.push(s):224>s?n>=t?gr():(a=e[n++],194>s||(192&a)!=128?(n--,gr()):r.push((31&s)<<6|63&a)):240>s?n>=t-1?gr():(a=e[n++],(192&a)!=128||s===224&&160>a||s===237&&160<=a||(192&(i=e[n++]))!=128?(n--,gr()):r.push((15&s)<<12|(63&a)<<6|63&i)):244>=s?n>=t-2?gr():(a=e[n++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(i=e[n++]))!=128||(192&(o=e[n++]))!=128?(n--,gr()):(s=(7&s)<<18|(63&a)<<12|(63&i)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):gr(),8192<=r.length&&(c=vp(c,r),r.length=0)}n=vp(c,r)}return n}function gf(e){let t=Ne(e.g)>>>0;return ff(e.g,t)}function Uc(e,t,r){var i=Ne(e.g)>>>0;for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Ln=[];function Tp(e){return e?/^\d+$/.test(e)?(ns(e),new xp(H,re)):null:og||=new xp(0,0)}var xp=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},og;function Cp(e){return e?/^-?\d+$/.test(e)?(ns(e),new Pp(H,re)):null:ng||=new Pp(0,0)}var Pp=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},ng;function Wn(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 as(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function cs(e,t){if(0<=t)as(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function $n(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 ni(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Tt(e,t,r){as(e.g,8*t+r)}function Lc(e,t){return Tt(e,t,2),t=e.g.end(),ni(e,t),t.push(e.i),t}function Nc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;127<r;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function ls(e,t,r){Tt(e,t,2),as(e.g,r.length),ni(e,e.g.end()),ni(e,r)}var Et,_t=class{constructor(t,r,i,o){this.g=t,this.i=r,this.j=i,this.N=o}};function je(e){return Array.prototype.slice.call(e)}var jc=(Et=typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():void 0)?(e,t)=>{e[Et]|=t}:(e,t)=>{e.o!==void 0?e.o|=t:Object.defineProperties(e,{o:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Rp(e){let t=ie(e);(1&t)!=1&&(Object.isFrozen(e)&&(e=je(e)),Y(e,1|t))}var bc=Et?(e,t)=>{e[Et]&=~t}:(e,t)=>{e.o!==void 0&&(e.o&=~t)};function he(e,t,r){return r?e|t:e&~t}var ie=Et?e=>0|e[Et]:e=>0|e.o,O=Et?e=>e[Et]:e=>e.o,Y=Et?(e,t)=>{e[Et]=t}:(e,t)=>{e.o!==void 0?e.o=t:Object.defineProperties(e,{o:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Ip(){var e=[];return jc(e,1),e}function sg(e,t){Y(t,-14591&(0|e))}function wc(e,t){Y(t,-14557&(34|e))}function qn(e){return(e=e>>14&1023)===0?536870912:e}var ro={},ag={};function Op(e){return!(!e||typeof e!="object"||e.W!==ag)}function Xi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}var yf=!xc;function vf(e,t,r){if(e!=null){if(typeof e=="string")e=e?new ir(e,ii):oi();else if(e.constructor!==ir)if(is(e))e=r?uf(e):e.length?new ir(new Uint8Array(e),ii):oi();else{if(!t)throw Error();e=void 0}}return e}function Sc(e,t,r){if(!Array.isArray(e)||e.length)return!1;let i=ie(e);return!!(1&i)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&(Y(e,1|i),!0)}var vr,Dp=[];function Lt(e){if(2&e)throw Error()}var or,Qi;function bf(e,t){(t=or?t[or]:void 0)&&(e[or]=je(t))}Y(Dp,55),vr=Object.freeze(Dp);function Fp(){let e=Error("int32");return e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity="warning",e}function io(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Bp(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}Object.freeze(new class{}),Object.freeze(new class{});var cg=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Vc(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&cg.test(e)}function Sr(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 Mp(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function wf(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(ri(e),e=Oc(H,re)),e}function Sf(e){var t=Math.trunc(Number(e));if(Number.isSafeInteger(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),!(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))))if(ns(e),e=H,2147483648&(t=re))if(Ic())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,i]=Dc(e,t);e="-"+Hn(r,i)}else e=Hn(e,t);return e}function kf(e){if(typeof e!="string")throw Error();return e}function Xn(e){if(e!=null&&typeof e!="string")throw Error();return e}function wr(e){return e==null||typeof e=="string"?e:void 0}function Ef(e,t,r){if(e!=null&&typeof e=="object"&&e.C===ro)return e;if(Array.isArray(e)){var i=ie(e),o=i;return o===0&&(o|=32&r),(o|=2&r)!==i&&Y(e,o),new t(e)}}var Kn,zc,lg;function Jn(e){switch(typeof e){case"boolean":return zc||=[0,void 0,!0];case"number":return 0<e?void 0:e===0?lg||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function eo(e,t,r){if(e==null&&(e=Kn),Kn=void 0,e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error();if(64&(i=ie(e)))return Qi&&delete e[Qi],e;if(i|=64,r&&(i|=512,r!==e[0]))throw Error();e:{let o=(r=e).length;if(o){let n=o-1;if(Xi(r[n])){if(1024<=(t=n-(+!!(512&(i|=256))-1)))throw Error();i=-16760833&i|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&i)-1))))throw Error();i=-16760833&i|(1023&t)<<14}}}return Y(e,i),e}function _f(e,t,r,i,o,n){if(e!=null){if(Array.isArray(e))e=o&&e.length==0&&1&ie(e)?void 0:n&&2&ie(e)?e:Gc(e,t,r,i!==void 0,o,n);else if(Xi(e)){let s={};for(let a in e)s[a]=_f(e[a],t,r,i,o,n);e=s}else e=t(e,i);return e}}function Gc(e,t,r,i,o,n){let s=i||r?ie(e):0;i=i?!!(32&s):void 0;let a=je(e);for(let c=0;c<a.length;c++)a[c]=_f(a[c],t,r,i,o,n);return r&&(bf(a,e),r(s,a)),a}function ug(e){return e.C===ro?e.toJSON():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))return yf||!Sc(t,void 0,9999)?t:void 0;if(is(t))return wp(t);if(t instanceof ir){let r=t.D;return r==null?"":typeof r=="string"?r:t.D=wp(r)}}}return t}(e)}function Af(e,t,r=wc){if(e!=null){if(of&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=ie(e);return 2&i?e:(t&&=i===0||!!(32&i)&&!(64&i||!(16&i)),t?(Y(e,-12293&(34|i)),e):Gc(e,Af,4&i?wc:r,!0,!1,!0))}return e.C===ro&&(r=e.l,e=2&(i=O(r))?e:Hc(e,r,i,!0)),e}}function Tf(e){let t=e.l;return Hc(e,t,O(t),!1)}function Hc(e,t,r,i){return e=e.constructor,Kn=t=xf(t,r,i),t=new e(t),Kn=void 0,t}function xf(e,t,r){let i=r||2&t?wc:sg,o=!!(32&t);return e=function(n,s,a){let c=je(n);var l=c.length;let u=256&s?c[l-1]:void 0;for(l+=u?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(u){s=c[s]={};for(let d in u)s[d]=a(u[d])}return bf(c,n),c}(e,t,n=>Af(n,o,i)),jc(e,32|(r?2:0)),e}function Wc(e){let t=e.l,r=O(t);return 2&r?Hc(e,t,r,!1):e}function Ut(e,t){return sr(e=e.l,O(e),t)}function sr(e,t,r,i){if(r===-1)return null;if(r>=qn(t)){if(256&t)return e[e.length-1][r]}else{var o=e.length;if(i&&256&t&&(i=e[o-1][r])!=null)return i;if((t=r+(+!!(512&t)-1))<o)return e[t]}}function pe(e,t,r,i){let o=e.l,n=O(o);return Lt(n),Z(o,n,t,r,i),e}function Z(e,t,r,i,o){var n=qn(t);if(r>=n||o){if(o=t,256&t)n=e[e.length-1];else{if(i==null)return o;n=e[n+(+!!(512&t)-1)]={},o|=256}return n[r]=i,o!==t&&Y(e,o),o}return e[r+(+!!(512&t)-1)]=i,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function oo(e,t,r,i,o){var n=2&t;let s=sr(e,t,r,o);Array.isArray(s)||(s=vr);let a=!(2&i);i=!(1&i);let c=!!(32&t),l=ie(s);return l!==0||!c||n||a?1&l||(l|=1,Y(s,l)):(l|=33,Y(s,l)),n?(e=!1,2&l||(jc(s,34),e=!!(4&l)),(i||e)&&Object.freeze(s)):(n=!!(2&l)||!!(2048&l),i&&n?(s=je(s),i=1,c&&!a&&(i|=32),Y(s,i),Z(e,t,r,s,o)):a&&32&l&&!n&&bc(s,32)),s}function Cf(e){e=e.l;let t=O(e),r=sr(e,t,1),i=vf(r,!0,!!(34&t));return i!=null&&i!==r&&Z(e,t,1,i),i}function Pf(e,t){return e=sr(e,t,1),Array.isArray(e)?e:vr}function Rf(e,t,r){return e===0&&(e=kr(e,t,r)),he(e,1,!0)}function Ki(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Up(e,t,r){{let s=e.l,a=O(s);if(Lt(a),r==null)Z(s,a,t);else{var i,o=e=ie(r),n=!!(2&e)||Object.isFrozen(r);if((i=!n)&&(i=!1),!(4&e))for(e=21,n&&(r=je(r),o=0,e=kr(e,a,!0)),n=0;n<r.length;n++)r[n]=kf(r[n]);i&&(r=je(r),o=0,e=kr(e,a,!0)),e!==o&&Y(r,e),Z(s,a,t,r)}}}function If(e,t){e=e.l;let r=O(e);Lt(r),Z(e,r,2,t===""?void 0:t)}function Of(e,t,r,i){let o=O(e);Lt(o),e=oo(e,o,t,2),i=r(i,!!(4&(t=ie(e)))&&!!(4096&t)),e.push(i)}function dg(e){return e}function dc(e,t){return $c(e=e.l,O(e),ym)===t?t:-1}function $c(e,t,r){let i=0;for(let o=0;o<r.length;o++){let n=r[o];sr(e,t,n)!=null&&(i!==0&&(t=Z(e,t,i)),i=n)}return i}function qc(e,t,r,i){let o=O(e);Lt(o);let n=sr(e,o,r,i),s;if(n!=null&&n.C===ro)return(t=Wc(n))!==n&&Z(e,o,r,t,i),t.l;if(Array.isArray(n)){let a=ie(n);s=2&a?xf(n,a,!1):n,s=eo(s,t[0],t[1])}else s=eo(void 0,t[0],t[1]);return s!==n&&Z(e,o,r,s,i),s}function Df(e,t,r,i){e=e.l;let o=O(e),n=sr(e,o,r,i);return(t=Ef(n,t,o))!==n&&t!=null&&Z(e,o,r,t,i),t}function ct(e,t,r){if((t=Df(e,t,r,!1))==null)return t;e=e.l;let i=O(e);if(!(2&i)){let o=Wc(t);o!==t&&Z(e,i,r,t=o,!1)}return t}function Ff(e,t,r,i,o){var n=!!(2&t),s=n?1:2;let a=s===1;s=s===2,i=!!i,o&&=!n,n=Pf(e,t);var c=ie(n);let l=!!(4&c);if(!l){var u,d=n,f=t;(u=!!(2&(c=Rf(c,t,i))))&&(f=he(f,2,!0));let m=!u,h=!0,g=0,y=0;for(;g<d.length;g++){let _=Ef(d[g],r,f);if(_ instanceof r){if(!u){let v=!!(2&ie(_.l));m&&=!v,h&&=v}d[y++]=_}}y<g&&(d.length=y),c=he(c,4,!0),c=he(c,16,h),c=he(c,8,m),Y(d,c),u&&Object.freeze(d)}if(r=!!(8&c)||a&&!n.length,o&&!r){for(Ki(c)&&(n=je(n),c=kr(c,t,i),t=Z(e,t,1,n)),o=n,r=c,d=0;d<o.length;d++)(c=o[d])!==(f=Wc(c))&&(o[d]=f);r=he(r,8,!0),r=he(r,16,!o.length),Y(o,r),c=r}return Ki(c)||(o=c,a?c=he(c,!n.length||16&c&&(!l||32&c)?2:2048,!0):i||(c=he(c,32,!1)),c!==o&&Y(n,c),a&&Object.freeze(n)),s&&Ki(c)&&(n=je(n),c=kr(c,t,i),Y(n,c),Z(e,t,1,n)),n}function Xc(e,t){e=e.l;let r=O(e);return Ff(e,r,t,!1,!(2&r))}function lt(e,t,r,i,o){return i==null&&(i=void 0),pe(e,r,i,o)}function hc(e,t,r){var i=hm;r==null&&(r=void 0),e=e.l;let o=O(e);Lt(o),(i=$c(e,o,i))&&i!==t&&r!=null&&(o=Z(e,o,i)),Z(e,o,t,r)}function kr(e,t,r){return e=he(e,2,!!(2&t)),e=he(e,32,!!(32&t)&&r),he(e,2048,!1)}function Bf(e,t){var r=ms;e=e.l;let i=O(e);Lt(i),e=Ff(e,i,r,!0),t=t??new r,e.push(t),2&ie(t.l)?bc(e,8):bc(e,16)}function kc(e){return(e=Ut(e,2))==null?e:Vc(e)?typeof e=="number"?wf(e):Sf(e):void 0}function Mf(e){return e??0}function Ce(e,t,r){Of(e.l,t,kf,r)}function Uf(e,t,r){t.g?t.j(e,t.g,t.i,r,!0):t.j(e,t.i,r,!0)}var W=class{constructor(e,t){this.l=eo(e,t)}toJSON(){return Lf(this,Gc(this.l,ug,void 0,void 0,!1,!1),!0)}A(){return!!(2&ie(this.l))}};function Lf(e,t,r){let i=e.constructor.v;var o=O(r?e.l:t),n=qn(o),s=!1;if(i&&yf){if(!r){var a;if((t=je(t)).length&&Xi(a=t[t.length-1])){for(s=0;s<i.length;s++)if(i[s]>=n){Object.assign(t[t.length-1]={},a);break}}s=!0}var c;n=t,r=!r,e=qn(a=O(e.l)),a=+!!(512&a)-1;for(let y=0;y<i.length;y++){var l=i[y];if(l<e){var u=n[l+=a];u==null?n[l]=r?vr:Ip():r&&u!==vr&&Rp(u)}else{if(!c){var d=void 0;n.length&&Xi(d=n[n.length-1])?c=d:n.push(c={})}u=c[l],c[l]==null?c[l]=r?vr:Ip():r&&u!==vr&&Rp(u)}}}if(!(c=t.length))return t;let f,m;if(Xi(d=t[c-1])){e:{var h=d;for(var g in n={},r=!1,h)e=h[g],Array.isArray(e)&&(a=e,(!Ep&&Sc(e,i,+g)||!kp&&Op(e)&&e.size===0)&&(e=null),e!=a&&(r=!0)),e!=null?n[g]=e:r=!0;if(r){for(let y in n){h=n;break e}h=null}}h!=d&&(f=!0),c--}for(o=+!!(512&o)-1;0<c&&((d=t[g=c-1])==null||!Ep&&Sc(d,i,g-o)||!kp&&Op(d)&&d.size===0);c--)m=!0;return(f||m)&&(t=s?t:Array.prototype.slice.call(t,0,c),s&&(t.length=c),h&&t.push(h)),t}function Nf(e){return Array.isArray(e)?e[0]instanceof _t?e:[kg,e]:[e,void 0]}function us(e,t){if(Array.isArray(t)){var r=ie(t);if(4&r)return t;for(var i=0,o=0;i<t.length;i++){let n=e(t[i]);n!=null&&(t[o++]=n)}return o<i&&(t.length=o),Y(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}W.prototype.C=ro,W.prototype.toString=function(){return Lf(this,this.l,!1).toString()};var Lp=Symbol();function Kc(e){let t=e[Lp];if(!t){let r=zf(e),i=Yc(e),o=i.g;t=o?(n,s)=>o(n,s,i):(n,s)=>{for(;mf(s)&&s.i!=4;){var a=s.m,c=i[a];if(!c){var l=i.K;l&&(l=l[a])&&(c=i[a]=hg(l))}c&&c(s,n,a)||(a=(c=s).j,jn(c),c.J?c=void 0:(l=c.g.g-a,c.g.g=a,c=ff(c.g,l)),a=n,c&&(or||=Symbol(),(l=a[or])?l.push(c):a[or]=[c]))}r===jf||r===Vf||r.T||(n[Qi||=Symbol()]=r)},e[Lp]=t}return t}function hg(e){let t=(e=Nf(e))[0].g;if(e=e[1]){let r=Kc(e),i=Yc(e).B;return(o,n,s)=>t(o,n,s,i,r)}return t}var jf,Vf,Vn=Symbol();function pg(e,t,r){let i=r[1],o;if(i){let n=i[Vn];o=n?n.B:Jn(i[0]),e[t]=n??i}o&&o===zc?(e.L||(e.L=[])).push(t):r[0]&&(e.M||(e.M=[])).push(t)}function Np(e,t){return[e.j,!t||0<t[0]?void 0:t]}function zf(e){var t=e[Vn];if(t)return t;if(!(t=Jc(e,e[Vn]={},Np,Np,pg)).M&&!t.L){let r=!0;for(let i in t){isNaN(i)||(r=!1);break}r?(t=Jn(e[0])===zc,t=e[Vn]=t?Vf||={B:Jn(!0)}:jf||={}):t.T=!0}return t}function fg(e,t,r){e[t]=r}function Jc(e,t,r,i,o=fg){t.B=Jn(e[0]);let n=0;var s=e[++n];s&&s.constructor===Object&&(t.K=s,typeof(s=e[++n])=="function"&&(t.g=s,t.i=e[++n],s=e[++n]));let a={};for(;Array.isArray(s)&&typeof s[0]=="number"&&0<s[0];){for(var c=0;c<s.length;c++)a[s[c]]=s;s=e[++n]}for(c=1;s!==void 0;){let d;typeof s=="number"&&(c+=s,s=e[++n]);var l=void 0;if(s instanceof _t?d=s:(d=Eg,n--),d.N){s=e[++n],l=e;var u=n;typeof s=="function"&&(s=s(),l[u]=s),l=s}for(u=c+1,typeof(s=e[++n])=="number"&&0>s&&(u-=s,s=e[++n]);c<u;c++){let f=a[c];o(t,c,l?i(d,l,f):r(d,f))}}return t}var jp=Symbol();function Gf(e){let t=e[jp];if(!t){let r=ds(e);t=(i,o)=>Hf(i,o,r),e[jp]=t}return t}var zn=Symbol();function mg(e){return e.i}function gg(e,t){let r,i,o=e.i;return(n,s,a)=>o(n,s,a,i||=ds(t).B,r||=Gf(t))}function ds(e){let t=e[zn];return t||(t=Jc(e,e[zn]={},mg,gg),Gn in e&&zn in e&&(e.length=0),t)}var Gn=Symbol();function yg(e,t){let r=e.g;return t?(i,o,n)=>r(i,o,n,t):r}function vg(e,t,r){let i=e.g,o,n;return(s,a,c)=>i(s,a,c,n||=Yc(t).B,o||=Kc(t),r)}function Yc(e){let t=e[Gn];return t||(zf(e),t=Jc(e,e[Gn]={},yg,vg),Gn in e&&zn in e&&(e.length=0),t)}function Vp(e,t){var r=e[t];if(r)return r;if((r=e.K)&&(r=r[t])){var i=(r=Nf(r))[0].i;if(r=r[1]){let o=Gf(r),n=ds(r).B;r=(r=e.i)?r(n,o):(s,a,c)=>i(s,a,c,n,o)}else r=i;return e[t]=r}}function Hf(e,t,r){for(var i=O(e),o=+!!(512&i)-1,n=e.length,s=512&i?1:0,a=n+(256&i?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,u=Vp(r,l);u&&u(t,c,l)}if(256&i){i=e[n-1];for(let c in i)o=+c,Number.isNaN(o)||(n=i[c])!=null&&(a=Vp(r,o))&&a(t,n,o)}if(e=or?e[or]:void 0)for(ni(t,t.g.end()),r=0;r<e.length;r++)ni(t,Cc(e[r])||os())}function Pe(e,t){return new _t(e,t,!1,!1)}function hs(e,t){return new _t(e,t,!0,!1)}function Re(e,t,r){Z(e,O(e),t,r)}function Wf(e,t,r){e:if(t!=null){if(Vc(t)){if(typeof t=="string"){t=Sf(t);break e}if(typeof t=="number"){t=wf(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&Cp(t),t!=null&&(Tt(e,r,0),typeof t=="number"?(e=e.g,ri(t),Wn(e,H,re)):(r=Cp(t),Wn(e.g,r.i,r.g))))}function $f(e,t,r){(t=Sr(t))!=null&&t!=null&&(Tt(e,r,0),cs(e.g,t))}function qf(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Tt(e,r,0),e.g.g.push(t?1:0))}function Xf(e,t,r){(t=wr(t))!=null&&ls(e,r,Qp(t))}function ps(e,t,r,i,o){(t=t instanceof W?t.l:Array.isArray(t)?eo(t,i[0],i[1]):void 0)!=null&&(r=Lc(e,r),o(t,e),Nc(e,r))}function Kf(e,t,r){(t=t==null||typeof t=="string"||is(t)||t instanceof ir?t:void 0)!=null&&ls(e,r,Rc(t).buffer)}var Qe,bg=Pe(function(e,t,r){if(e.i!==1)return!1;var i=e.g;e=yc(i);let o=yc(i);i=2*(o>>31)+1;let n=o>>>20&2047;return e=4294967296*(1048575&o)+e,Re(t,r,n==2047?e?NaN:1/0*i:n==0?i*Math.pow(2,-1074)*e:i*Math.pow(2,n-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=io(t))!=null&&(Tt(e,r,1),e=e.g,(r=df||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),H=r.getUint32(0,!0),re=r.getUint32(4,!0),$n(e,H),$n(e,re))}),Jf=Pe(function(e,t,r){return e.i===5&&(Re(t,r,vc(e.g)),!0)},function(e,t,r){(t=io(t))!=null&&(Tt(e,r,5),e=e.g,hf(t),$n(e,H))}),wg=hs(function(e,t,r){return(e.i===5||e.i===2)&&(t=oo(t,O(t),r,2,!1),e.i==2?Uc(e,vc,t):t.push(vc(e.g)),!0)},function(e,t,r){if((t=us(io,t))!=null&&t.length){Tt(e,r,2),as(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,hf(t[i]),$n(r,H)}}),Yn=Pe(function(e,t,r){return e.i===0&&(Re(t,r,Fc(e.g,Oc)),!0)},Wf),pc=Pe(function(e,t,r){return e.i===0&&(Re(t,r,(e=Fc(e.g,Oc))===0?void 0:e),!0)},Wf),Sg=Pe(function(e,t,r){return e.i===0&&(Re(t,r,Fc(e.g,gc)),!0)},function(e,t,r){e:if(t!=null){if(Vc(t)){if(typeof t=="string"){var i=Math.trunc(Number(t));Number.isSafeInteger(i)&&0<=i?t=String(i):((i=t.indexOf("."))!==-1&&(t=t.substring(0,i)),Mp(t)||(ns(t),t=Hn(H,re)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){ri(o);let n=Hn(H,re);return o=Number(n),Number.isSafeInteger(o)?o:n}return Mp(String(o))?o:(ri(o),gc(H,re))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&Tp(t),t!=null&&(Tt(e,r,0),typeof t=="number"?(e=e.g,ri(t),Wn(e,H,re)):(r=Tp(t),Wn(e.g,r.i,r.g))))}),ar=Pe(function(e,t,r){return e.i===0&&(Re(t,r,Ne(e.g)),!0)},$f),Yf=hs(function(e,t,r){return(e.i===0||e.i===2)&&(t=oo(t,O(t),r,2,!1),e.i==2?Uc(e,Ne,t):t.push(Ne(e.g)),!0)},function(e,t,r){if((t=us(Sr,t))!=null&&t.length){r=Lc(e,r);for(let i=0;i<t.length;i++)cs(e.g,t[i]);Nc(e,r)}}),si=Pe(function(e,t,r){return e.i===0&&(Re(t,r,(e=Ne(e.g))===0?void 0:e),!0)},$f),At=Pe(function(e,t,r){return e.i===0&&(Re(t,r,Bc(e.g)),!0)},qf),Ji=Pe(function(e,t,r){return e.i===0&&(Re(t,r,(e=Bc(e.g))===!1?void 0:e),!0)},qf),ut=hs(function(e,t,r){return e.i===2&&(Of(t,r,dg,e=Mc(e)),!0)},function(e,t,r){if((t=us(wr,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&ls(i,o,Qp(n))}}),nr=Pe(function(e,t,r){return e.i===2&&(Re(t,r,(e=Mc(e))===""?void 0:e),!0)},Xf),fe=Pe(function(e,t,r){return e.i===2&&(Re(t,r,Mc(e)),!0)},Xf),kg=new _t(function(e,t,r,i,o){return e.i===2&&(ss(e,qc(t,i,r,!0),o),!0)},ps,!1,!0),Eg=new _t(function(e,t,r,i,o){return e.i===2&&(ss(e,qc(t,i,r),o),!0)},ps,!1,!0);Qe=new _t(function(e,t,r,i,o){if(e.i!==2)return!1;i=eo(void 0,i[0],i[1]);let n=O(t);Lt(n);let s=oo(t,n,r,3);return n=O(t),4&ie(s)&&(s=je(s),Y(s,-2079&(1|ie(s))),Z(t,n,r,s)),s.push(i),ss(e,i,o),!0},function(e,t,r,i,o){if(Array.isArray(t))for(let n=0;n<t.length;n++)ps(e,t[n],r,i,o)},!0,!0);var et=new _t(function(e,t,r,i,o,n){if(e.i!==2)return!1;let s=O(t);return Lt(s),(n=$c(t,s,n))&&r!==n&&Z(t,s,n),ss(e,t=qc(t,i,r),o),!0},ps,!1,!0),Zf=Pe(function(e,t,r){return e.i===2&&(Re(t,r,gf(e)),!0)},Kf),to=Pe(function(e,t,r){return e.i===0&&(Re(t,r,Ne(e.g)),!0)},function(e,t,r){(t=Sr(t))!=null&&(t=parseInt(t,10),Tt(e,r,0),cs(e.g,t))}),_g=hs(function(e,t,r){return(e.i===0||e.i===2)&&(t=oo(t,O(t),r,2,!1),e.i==2?Uc(e,ig,t):t.push(Ne(e.g)),!0)},function(e,t,r){if((t=us(Sr,t))!=null&&t.length){r=Lc(e,r);for(let i=0;i<t.length;i++)cs(e.g,t[i]);Nc(e,r)}}),Zn=class{constructor(t,r){this.i=t,this.g=r,this.j=lt,this.defaultValue=void 0}};function Qf(e,t){return(r,i)=>{e:{if(Ln.length){let n=Ln.pop();n.s(i),uc(n.g,r,i),r=n}else r=new class{constructor(n,s){if(Ap.length){let a=Ap.pop();uc(a,n,s),n=a}else n=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.u=0,uc(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.u=0,this.F=!1}}(n,s);this.g=n,this.j=this.g.g,this.i=this.m=-1,this.s(s)}s({J:n=!1}={}){this.J=n}}(r,i);try{let n=new e,s=n.l;Kc(t)(s,r),Qi&&delete s[Qi];var o=n;break e}finally{r.g.clear(),r.m=-1,r.i=-1,100>Ln.length&&Ln.push(r)}o=void 0}return o}}var em=[0,nr,Pe(function(e,t,r){return e.i===2&&(Re(t,r,(e=gf(e))===oi()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof W){let i=t.X;return void(i&&(t=i(t),t!=null&&ls(e,r,Rc(t).buffer)))}if(Array.isArray(t))return}Kf(e,t,r)})],Ag=[0,fe],tm=[0,ar,to,At,-1,Yf,to,-1],Tg=[0,At,-1],rm=class extends W{constructor(){super()}};rm.v=[6];var im=[0,At,fe,At,to,-1,_g,fe,-1,Tg,to],om=[0,fe,-2],zp=class extends W{constructor(){super()}},nm=[0],sm=[0,ar,At,-2],am=class extends W{constructor(e){super(e,2)}},fs={},xg=[-2,fs,At];fs[336783863]=[0,fe,At,-1,ar,[0,[1,2,3,4,5],et,nm,et,im,et,om,et,sm,et,tm],Ag];var Cg=[0,nr,Ji],cm=[0,pc,-1,Ji,-3,pc,Yf,nr,si,pc,-1,Ji,si,Ji,-2,nr],no=[-1,{}],lm=[0,fe,1,no],um=[0,fe,ut,no],ms=class extends W{constructor(e){super(e,500)}s(e){return lt(this,0,7,e)}};ms.v=[3,4,5,6,8,13,17,1005];var Gp,Pg=[-500,nr,-1,ut,-3,xg,Qe,em,si,-1,lm,um,Qe,Cg,nr,cm,si,ut,987,ut],Rg=[0,nr,-1,no],Ig=[-500,fe,-1,[-1,{}],998,fe],Og=[-500,fe,ut,-1,[-2,{},At],997,ut,-1],Dg=[-500,fe,ut,no,998,ut],Qn=class extends W{constructor(){super(void 0,500)}s(e){return lt(this,0,1001,e)}};Qn.v=[1,6,7,9,10,15,16,17,14,1002],Qn.prototype.g=(Gp=[-500,Qe,Pg,4,Qe,Ig,Qe,Og,si,Qe,Dg,ut,si,lm,um,Qe,Rg,ut,-2,cm,nr,-1,Ji,979,no,Qe,em],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let n=this.g;return this.g=[],n}}}};Hf(this.l,e,ds(Gp)),ni(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,i=r.length,o=0;for(let n=0;n<i;n++){let s=r[n];t.set(s,o),o+=s.length}return e.j=[t],t});var Fg=class extends W{constructor(e){super(e)}},Bg=[0,ar,Jf,fe,-1],dm=class extends W{constructor(e){super(e)}g(){return Xc(this,Fg)}};dm.v=[1];var Mg=[0,Qe,Bg],Ec=class extends W{constructor(e){super(e)}};Ec.v=[4,5];var Hp=class extends W{constructor(e){super(e)}},hm=[1,2,3,4,5],es=class extends W{constructor(e){super(e)}g(){return Cf(this)!=null}i(){return wr(Ut(this,2))!=null}},ts=class extends W{constructor(e){super(e)}},pm=[0,[0,Zf,fe,[0,ar,Yn,-1],[0,Sg,Yn]],At,[0,hm,et,sm,et,im,et,tm,et,nm,et,om],to],fm=class extends W{constructor(e){super(e)}},Ug=new Zn(451755788,fm);fs[451755788]=[0,pm,[0,fe,ar,Jf,ut,-1],bg];var Wp=class extends W{constructor(e){super(e)}},mm=class extends W{constructor(e){super(e)}},Lg=new Zn(487277289,mm);fs[487277289]=[0,pm,[0,At,-1]];var Ng=class extends W{constructor(e){super(e)}},jg=[0,1,ar,fe,Mg],gm=class extends W{constructor(e){super(e)}};gm.v=[1];var Vg=Qf(gm,[0,Qe,jg,Yn]),_c=class extends W{constructor(e){super(e)}};_c.v=[1];var zg=class extends W{constructor(e){super(e)}O(){let e=Cf(this);return e??oi()}},Gg=class extends W{constructor(e){super(e)}},ym=[1,2],Hg=[0,ym,et,[0,wg],et,[0,Zf],ar,fe],vm=class extends W{constructor(e){super(e)}};vm.v=[1];var $p=Qf(vm,[0,Qe,Hg,Yn]);async function qp(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{i(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function k(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.h.stringToNewUTF8(t)),e.h._free(t)}function Xp(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let i=new Uint32Array(t.length);for(let o=0;o<t.length;o++)i[o]=e.h.stringToNewUTF8(t[o]);t=e.h._malloc(4*i.length),e.h.HEAPU32.set(i,t>>2),r(t);for(let o of i)e.h._free(o);e.h._free(t)}function yr(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Qr(e,t,r){let i=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(o,n,s)=>{n?(r(i,s),i=[]):i.push(o)}}var Wg=function(e){return class extends e{U(){this.h._registerModelResourcesGraphService()}}}(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:((e=typeof OffscreenCanvas>"u")||(e=(e=navigator.userAgent).includes("Safari")&&!e.includes("Chrome")),e?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas")):this.h.canvas=new OffscreenCanvas(1,1))}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,i=this.h._malloc(r);this.h.HEAPU8.set(e,i),t?this.h._changeBinaryGraph(r,i):this.h._changeTextGraph(r,i),this.h._free(i)}configureAudio(e,t,r,i,o){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),k(this,i||"input_audio",n=>{k(this,o=o||"audio_header",s=>{this.h._configureAudio(n,s,e,t,r)})})}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,i,o){let n=4*e.length;this.i!==n&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(n),this.i=n),this.h.HEAPF32.set(e,this.g/4),k(this,i,s=>{this.h._addAudioToInputStream(this.g,t,r,s,o)})}addGpuBufferToStream(e,t,r){k(this,t,i=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");i?this.h._bindTextureToStream(i):this.h._bindTextureToCanvas();var o=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!o)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let n;this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),e.videoWidth?(o=e.videoWidth,n=e.videoHeight):e.naturalWidth?(o=e.naturalWidth,n=e.naturalHeight):(o=e.width,n=e.height),!this.j||o===this.h.canvas.width&&n===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=n);let[s,a]=[o,n];this.h._addBoundTextureToStream(i,s,a,r)})}addBoolToStream(e,t,r){k(this,t,i=>{this.h._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){k(this,t,i=>{this.h._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){k(this,t,i=>{this.h._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){k(this,t,i=>{this.h._addIntToInputStream(e,i,r)})}addStringToStream(e,t,r){k(this,t,i=>{k(this,e,o=>{this.h._addStringToInputStream(o,i,r)})})}addStringRecordToStream(e,t,r){k(this,t,i=>{Xp(this,Object.keys(e),o=>{Xp(this,Object.values(e),n=>{this.h._addFlatHashMapToInputStream(o,n,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){k(this,r,o=>{k(this,t,n=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,n,o,i),this.h._free(s)})})}addEmptyPacketToStream(e,t){k(this,e,r=>{this.h._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){k(this,t,i=>{let o=this.h._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let n of e)this.h._addBoolVectorEntry(o,n);this.h._addBoolVectorToInputStream(o,i,r)})}addDoubleVectorToStream(e,t,r){k(this,t,i=>{let o=this.h._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let n of e)this.h._addDoubleVectorEntry(o,n);this.h._addDoubleVectorToInputStream(o,i,r)})}addFloatVectorToStream(e,t,r){k(this,t,i=>{let o=this.h._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let n of e)this.h._addFloatVectorEntry(o,n);this.h._addFloatVectorToInputStream(o,i,r)})}addIntVectorToStream(e,t,r){k(this,t,i=>{let o=this.h._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let n of e)this.h._addIntVectorEntry(o,n);this.h._addIntVectorToInputStream(o,i,r)})}addStringVectorToStream(e,t,r){k(this,t,i=>{let o=this.h._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let n of e)k(this,n,s=>{this.h._addStringVectorEntry(o,s)});this.h._addStringVectorToInputStream(o,i,r)})}addBoolToInputSidePacket(e,t){k(this,t,r=>{this.h._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){k(this,t,r=>{this.h._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){k(this,t,r=>{this.h._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){k(this,t,r=>{this.h._addIntToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){k(this,t,r=>{k(this,e,i=>{this.h._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){k(this,r,i=>{k(this,t,o=>{let n=this.h._malloc(e.length);this.h.HEAPU8.set(e,n),this.h._addProtoToInputSidePacket(n,e.length,o,i),this.h._free(n)})})}addBoolVectorToInputSidePacket(e,t){k(this,t,r=>{let i=this.h._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(i,o);this.h._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){k(this,t,r=>{let i=this.h._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(i,o);this.h._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){k(this,t,r=>{let i=this.h._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(i,o);this.h._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){k(this,t,r=>{let i=this.h._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(i,o);this.h._addIntVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){k(this,t,r=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)k(this,o,n=>{this.h._addStringVectorEntry(i,n)});this.h._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){yr(this,e,t),k(this,e,r=>{this.h._attachBoolListener(r)})}attachBoolVectorListener(e,t){Qr(this,e,t),k(this,e,r=>{this.h._attachBoolVectorListener(r)})}attachIntListener(e,t){yr(this,e,t),k(this,e,r=>{this.h._attachIntListener(r)})}attachIntVectorListener(e,t){Qr(this,e,t),k(this,e,r=>{this.h._attachIntVectorListener(r)})}attachDoubleListener(e,t){yr(this,e,t),k(this,e,r=>{this.h._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){Qr(this,e,t),k(this,e,r=>{this.h._attachDoubleVectorListener(r)})}attachFloatListener(e,t){yr(this,e,t),k(this,e,r=>{this.h._attachFloatListener(r)})}attachFloatVectorListener(e,t){Qr(this,e,t),k(this,e,r=>{this.h._attachFloatVectorListener(r)})}attachStringListener(e,t){yr(this,e,t),k(this,e,r=>{this.h._attachStringListener(r)})}attachStringVectorListener(e,t){Qr(this,e,t),k(this,e,r=>{this.h._attachStringVectorListener(r)})}attachProtoListener(e,t,r){yr(this,e,t),k(this,e,i=>{this.h._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){Qr(this,e,t),k(this,e,i=>{this.h._attachProtoVectorListener(i,r||!1)})}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),yr(this,e,(i,o)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,o)}),k(this,e,i=>{this.h._attachAudioListener(i,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),bm=class extends Wg{};async function $g(e,t,r){return e=await(async(i,o,n,s)=>{if(o&&await qp(o),!self.ModuleFactory||n&&(await qp(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((o=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new i(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:i=>i.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&i.endsWith(".data")?t.assetBinaryPath.toString():i}),await e.s(r),e}async function wm(e,t,r){return $g(e,t,r)}function Kp(e,t){let r=ct(e.baseOptions,es,1)||new es;typeof t=="string"?(pe(r,2,Xn(t)),pe(r,1)):t instanceof Uint8Array&&(pe(r,1,vf(t,!1,!1)),pe(r,2)),lt(e.baseOptions,0,1,r)}function Sm(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(ct(e.baseOptions,es,1)?.g()||ct(e.baseOptions,es,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return function(i,o){let n=ct(i.baseOptions,Hp,3);if(!n){var s=n=new Hp;hc(s,4,new zp)}"delegate"in o&&(o.delegate==="GPU"?hc(o=n,2,s=new rm):hc(o=n,4,s=new zp)),lt(i.baseOptions,0,3,n)}(e,r),r.modelAssetPath?fetch(r.modelAssetPath.toString()).then(i=>{if(i.ok)return i.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${i.status})`)}).then(i=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(i),!0,!1,!1),Kp(e,"/model.dat"),e.I()}):(Kp(e,r.modelAssetBuffer),e.I(),Promise.resolve())}function Jp(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.j.map(r=>r.message).join(", "))}finally{e.j=[]}}function ei(e,t){e.u=Math.max(e.u,t)}var Ac=class{constructor(e){this.g=e,this.j=[],this.u=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.j.push(Error(i))}),this.g.U(),this.g.setGraph(e,t),Jp(this)}finishProcessing(){this.g.finishProcessing(),Jp(this)}close(){this.g.closeGraph()}};async function Yi(e,t,r){return wm(e,t,r)}Ac.prototype.close=Ac.prototype.close;var rs=class extends Ac{constructor(){super(...arguments),this.H=48e3}V(e){this.H=e}};function qg(e){let t={classifications:Xc(e,Ng).map(r=>function(i,o=-1,n=""){return{categories:i.map(s=>{var a=Sr(Ut(s,1))??0??-1;let c=s.l,l=O(c),u=sr(c,l,2),d=io(u);return d!=null&&d!==u&&Z(c,l,2,d),{index:a,score:d??0??0,categoryName:wr(Ut(s,3))??""??"",displayName:wr(Ut(s,4))??""??""}}),headIndex:o,headName:n}}(ct(r,dm,4)?.g()??[],Sr(Ut(r,2))??0,wr(Ut(r,3))??""))};return kc(e)!=null&&(t.timestampMs=Mf(kc(e))),t}rs.prototype.setDefaultSampleRate=rs.prototype.V;var Ye=class extends rs{constructor(e,t){super(new bm(e,t)),this.m=[],lt(e=this.i=new fm,0,1,t=new ts)}get baseOptions(){return ct(this.i,ts,1)}set baseOptions(e){lt(this.i,0,1,e)}s(e){var t=this.i,r=ct(this.i,Ec,2);if(r=r?Tf(r):new Ec,e.displayNamesLocale!==void 0?pe(r,1,Xn(e.displayNamesLocale)):e.displayNamesLocale===void 0&&pe(r,1),e.maxResults!==void 0){var i=e.maxResults;if(i!=null){if(typeof i!="number"||!Number.isFinite(i))throw Fp();i|=0}pe(r,2,i)}else"maxResults"in e&&pe(r,2);if(e.scoreThreshold!==void 0){if((i=e.scoreThreshold)!=null&&typeof i!="number")throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);pe(r,3,i)}else"scoreThreshold"in e&&pe(r,3);return e.categoryAllowlist!==void 0?Up(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&pe(r,4),e.categoryDenylist!==void 0?Up(r,5,e.categoryDenylist):"categoryDenylist"in e&&pe(r,5),lt(t,0,2,r),Sm(this,e)}R(e,t){return this.G(e,t??this.H,this.u+1)}G(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}I(){var e=new Qn;Ce(e,10,"audio_in"),Ce(e,10,"sample_rate"),Ce(e,15,"timestamped_classifications");let t=new am;Uf(t,Ug,this.i);let r=new ms;If(r,Xn("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Ce(r,3,"AUDIO:audio_in"),Ce(r,3,"SAMPLE_RATE:sample_rate"),Ce(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.s(t),Bf(e,r),this.g.attachProtoVectorListener("timestamped_classifications",(i,o)=>{(function(n,s){s.forEach(a=>{a=Vg(a),n.m.push(qg(a))})})(this,i),ei(this,o)}),this.g.attachEmptyPacketListener("timestamped_classifications",i=>{ei(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function Yp(e){return{embeddings:Xc(e,Gg).map(t=>{let r={headIndex:Sr(Ut(t,3))??0??-1,headName:wr(Ut(t,4))??""??""};if(Df(t,_c,dc(t,1))!==void 0){var i=void 0;t=ct(t,_c,dc(t,1)).l;let a=O(t),c=2&a?1:2;i=!!i;let l=Pf(t,a);var o=ie(l);if(!(4&o)){(4&o||Object.isFrozen(l))&&(l=je(l),o=kr(o,a,i),a=Z(t,a,1,l));for(var n=0,s=0;n<l.length;n++){let u=io(l[n]);u!=null&&(l[s++]=u)}s<n&&(l.length=s),o=he(o=Rf(o,a,i),20,!0),o=he(o,4096,!1),o=he(o,8192,!1),Y(l,o),2&o&&Object.freeze(l)}Ki(o)||(n=o,(s=c===1)?o=he(o,2,!0):i||(o=he(o,32,!1)),o!==n&&Y(l,o),s&&Object.freeze(l)),c===2&&Ki(o)&&(l=je(l),o=kr(o,a,i),Y(l,o),Z(t,a,1,l)),r.floatEmbedding=l}else i=new Uint8Array(0),r.quantizedEmbedding=ct(t,zg,dc(t,2))?.O()?.P()??i;return r}),timestampMs:Mf(kc(e))}}Ye.prototype.classify=Ye.prototype.R,Ye.prototype.setOptions=Ye.prototype.s,Ye.createFromModelPath=function(e,t){return wm(Ye,e,{baseOptions:{modelAssetPath:t}})},Ye.createFromModelBuffer=function(e,t){return Yi(Ye,e,{baseOptions:{modelAssetBuffer:t}})},Ye.createFromOptions=function(e,t){return Yi(Ye,e,t)};var kt=class extends rs{constructor(e,t){super(new bm(e,t)),this.m=[],lt(e=this.i=new mm,0,1,t=new ts)}get baseOptions(){return ct(this.i,ts,1)}set baseOptions(e){lt(this.i,0,1,e)}s(e){var t=this.i,r=ct(this.i,Wp,2);return r=r?Tf(r):new Wp,e.l2Normalize!==void 0?pe(r,1,Bp(e.l2Normalize)):"l2Normalize"in e&&pe(r,1),e.quantize!==void 0?pe(r,2,Bp(e.quantize)):"quantize"in e&&pe(r,2),lt(t,0,2,r),Sm(this,e)}S(e,t){return this.G(e,t??this.H,this.u+1)}G(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}I(){var e=new Qn;Ce(e,10,"audio_in"),Ce(e,10,"sample_rate"),Ce(e,15,"embeddings_out"),Ce(e,15,"timestamped_embeddings_out");let t=new am;Uf(t,Lg,this.i);let r=new ms;If(r,Xn("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Ce(r,3,"AUDIO:audio_in"),Ce(r,3,"SAMPLE_RATE:sample_rate"),Ce(r,4,"EMBEDDINGS:embeddings_out"),Ce(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.s(t),Bf(e,r),this.g.attachProtoListener("embeddings_out",(i,o)=>{i=$p(i),this.m.push(Yp(i)),ei(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{ei(this,i)}),this.g.attachProtoVectorListener("timestamped_embeddings_out",(i,o)=>{for(let n of i)i=$p(n),this.m.push(Yp(i));ei(this,o)}),this.g.attachEmptyPacketListener("timestamped_embeddings_out",i=>{ei(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Nn;kt.prototype.embed=kt.prototype.S,kt.prototype.setOptions=kt.prototype.s,kt.createFromModelPath=function(e,t){return Yi(kt,e,{baseOptions:{modelAssetPath:t}})},kt.createFromModelBuffer=function(e,t){return Yi(kt,e,{baseOptions:{modelAssetBuffer:t}})},kt.createFromOptions=function(e,t){return Yi(kt,e,t)};var Xg=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 km(){if(Nn===void 0)try{await WebAssembly.instantiate(Xg),Nn=!0}catch{Nn=!1}return Nn}async function fc(e,t=""){let r=await km()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var ti=class{};ti.forVisionTasks=function(e){return fc("vision",e)},ti.forTextTasks=function(e){return fc("text",e)},ti.forAudioTasks=function(e){return fc("audio",e)},ti.isSimdSupported=function(){return km()};var gs=class{constructor(t,r,i,o,n,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=i,this.cameraRecorder=o,this.onRealtimeAlertsCallback=n,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Bt(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new Mn(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new tr(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(i=>{console.log(i),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t+t*.25),r>=t&&!this.recordingInProgress?(this.recordingInProgress=!0,this.audioRecorder.startRecording(),this.recordingStartTime=Date.now()-this.examStartTime):r<t&&this.recordingInProgress&&(Date.now()-this.recordingStartTime>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++)}async stopSoundRecord(){if(this.audioRecorder.stopRecording&&await this.audioRecorder.stopRecording(),this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME")return;let t=new File(this.audioRecorder.blobs,`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.webm`,{type:"audio/webm"});this.uploadRecord(t),this.audioRecorder.blobs=[]}download(t){let r=URL.createObjectURL(t),i=document.createElement("a");document.body.appendChild(i),i.style.display="none",i.href=r,i.download=t.name,i.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let i=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return i;let o=parseFloat(r.score)>.22;if(i&&o)return!0}return!1}async createAudioClassifier(){let t=await ti.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await Ye.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:16e3});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([Kg],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let i=r.data,n=this.audioClassifier.classify(i)[0].classifications[0].categories;n.length>0&&(this.audioClassificationResult=[{name:n[0].categoryName,score:n[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},Kg=`
236
+ Size: ${t.file.size}`,s),n}}throw new Error("Could not upload")}};var Wn=class{constructor(t,r){this.alerts=[];this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async pauseRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async resumeRecording(){this.optionsProctoring.captureScreen&&(window.addEventListener("blur",()=>this.onLostFocus()),window.addEventListener("focus",()=>this.onReturnFocus()))}async stopRecording(){window.removeEventListener("blur",()=>this.onLostFocus()),window.removeEventListener("focus",()=>this.onReturnFocus())}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}onLostFocus(){Date.now()-this.startTime?.getTime()>1e4&&(this.onLostFocusCallback(),this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:0,alert:25,type:3}))}onReturnFocus(){let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback(),t.end=Date.now()-this.startTime.getTime())}};var qn=class{constructor(t,r){this.blobs=[];this.options={cameraId:void 0,microphoneId:void 0};this.audioParams={recordingBitrate:128};r&&(this.audioParams=r),t&&(this.options=t)}async startRecording(){let t={audio:{deviceId:this.options.microphoneId||"default"}};this.audioStream=await navigator.mediaDevices.getUserMedia(t);let{startRecording:r,stopRecording:i,pauseRecording:o,resumeRecording:n}=vr(this.audioStream,this.blobs,void 0,void 0,!0);this.recordingStart=r,this.recordingStop=i,this.recordingPause=o,this.recordingResume=n,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t,r,i){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_audio_${r&&i&&`${r}_${i}`||"0"}.webm`,{type:"audio/webm"}),origin:"Mic"})}};var Mc=typeof self<"u"?self:{};function dm(e,t){e:{for(var r=["CLOSURE_FLAGS"],i=Mc,o=0;o<r.length;o++)if((i=i[r[o]])==null){r=null;break e}r=i}return(e=r&&r[e])!=null?e:t}function br(){throw Error("Invalid UTF8")}function Ip(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var $n,vc,c0=typeof TextDecoder<"u",l0,d0=typeof TextEncoder<"u";function um(e){if(d0)e=(l0||=new TextEncoder).encode(e);else{let r=0,i=new Uint8Array(3*e.length);for(let o=0;o<e.length;o++){var t=e.charCodeAt(o);if(128>t)i[r++]=t;else{if(2048>t)i[r++]=t>>6|192;else{if(55296<=t&&57343>=t){if(56319>=t&&o<e.length){let n=e.charCodeAt(++o);if(56320<=n&&57343>=n){t=1024*(t-55296)+n-56320+65536,i[r++]=t>>18|240,i[r++]=t>>12&63|128,i[r++]=t>>6&63|128,i[r++]=63&t|128;continue}o--}t=65533}i[r++]=t>>12|224,i[r++]=t>>6&63|128}i[r++]=63&t|128}}e=r===i.length?i:i.subarray(0,r)}return e}var io,hm=dm(610401301,!1),Uc=dm(572417392,!0),Rp=Mc.navigator;function _c(e){return!!hm&&!!io&&io.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Qe(e){var t;return(t=Mc.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function or(){return!!hm&&!!io&&0<io.brands.length}function bc(){return or()?_c("Chromium"):(Qe("Chrome")||Qe("CriOS"))&&!(!or()&&Qe("Edge"))||Qe("Silk")}io=Rp&&Rp.userAgentData||null;var u0=!or()&&(Qe("Trident")||Qe("MSIE"));!Qe("Android")||bc(),bc(),Qe("Safari")&&(bc()||!or()&&Qe("Coast")||!or()&&Qe("Opera")||!or()&&Qe("Edge")||(or()?_c("Microsoft Edge"):Qe("Edg/"))||or()&&_c("Opera"));var pm={},Zi=null;function h0(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 i=new Uint8Array(r),o=0;return function(n,s){function a(f){for(;c<n.length;){var h=n.charAt(c++),g=Zi[h];if(g!=null)return g;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return f}mm();for(var c=0;;){var l=a(-1),d=a(0),u=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|d>>4),u!=64&&(s(d<<4&240|u>>2),m!=64&&s(u<<6&192|m))}}(e,function(n){i[o++]=n}),o!==r?i.subarray(0,o):i}function mm(){if(!Zi){Zi={};for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"],r=0;5>r;r++){var i=e.concat(t[r].split(""));pm[r]=i;for(var o=0;o<i.length;o++){var n=i[o];Zi[n]===void 0&&(Zi[n]=o)}}}}var fm=typeof Uint8Array<"u",gm=!u0&&typeof btoa=="function";function Dp(e){if(!gm){var t;t===void 0&&(t=0),mm(),t=pm[t];var r=Array(Math.floor(e.length/3)),i=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var o=e[c],n=e[c+1],s=e[c+2],a=t[o>>2];o=t[(3&o)<<4|n>>4],n=t[(15&n)<<2|s>>6],s=t[63&s],r[l++]=a+o+n+s}switch(a=0,s=i,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||i;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+i}return r.join("")}for(t="",r=0,i=e.length-10240;r<i;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var Op=/[-_.]/g,p0={"-":"+",_:"/",".":"="};function m0(e){return p0[e]||""}function ym(e){if(!gm)return h0(e);Op.test(e)&&(e=e.replace(Op,m0)),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 ps(e){return fm&&e!=null&&e instanceof Uint8Array}var f0;function ms(){return f0||=new Uint8Array(0)}var ci={},g0;function vm(e){if(e!==ci)throw Error("illegal external caller")}function li(){return g0||=new nr(null,ci)}function Lc(e){vm(ci);var t=e.D;return(t=t==null||ps(t)?t:typeof t=="string"?ym(t):null)==null?t:e.D=t}var nr=class{constructor(e,t){if(vm(t),this.D=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}P(){let e=Lc(this);return e?new Uint8Array(e):ms()}};function bm(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Nc(){return Error("Failed to read varint, encoding is invalid.")}function wm(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Sm(e){return e.length==0?li():new nr(e,ci)}function jc(e){if(typeof e=="string")return{buffer:ym(e),A:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),A:!1};if(e.constructor===Uint8Array)return{buffer:e,A:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),A:!1};if(e.constructor===nr)return{buffer:Lc(e)||ms(),A:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),A:!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 Vc(){return typeof BigInt=="function"}var Fp=!Uc,Bp=!Uc,y0=typeof Uint8Array.prototype.slice=="function",km,q=0,ie=0;function ai(e){let t=0>e,r=(e=Math.abs(e))>>>0;if(e=Math.floor((e-r)/4294967296),t){let[i,o]=Gc(r,e);e=o,r=i}q=r>>>0,ie=e>>>0}function Em(e){let t=km||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),ie=0,q=t.getUint32(0,!0)}function xc(e,t){return 4294967296*t+(e>>>0)}function zc(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),e=xc(e,t),r?-e:e}function es(e,t){if(e>>>=0,2097151>=(t>>>=0))var r=""+(4294967296*t+e);else Vc()?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+Mp(r)+Mp(e));return r}function Mp(e){return e=String(e),"0000000".slice(e.length)+e}function fs(e){if(16>e.length)ai(Number(e));else if(Vc())e=BigInt(e),q=Number(e&BigInt(4294967295))>>>0,ie=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");ie=q=0;let r=e.length;for(let i=t,o=(r-t)%6+t;o<=r;i=o,o+=6){let n=Number(e.slice(i,o));ie*=1e6,q=1e6*q+n,4294967296<=q&&(ie+=Math.trunc(q/4294967296),ie>>>=0,q>>>=0)}if(t){let[i,o]=Gc(q,ie);q=i,ie=o}}}function Gc(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}function Hc(e,t){let r,i=0,o=0,n=0,s=e.i,a=e.g;do r=s[a++],i|=(127&r)<<n,n+=7;while(32>n&&128&r);for(32<n&&(o|=(127&r)>>4),n=3;32>n&&128&r;n+=7)r=s[a++],o|=(127&r)<<n;if(kr(e,a),128>r)return t(i>>>0,o>>>0);throw Nc()}function Wc(e){let t=0,r=e.g,i=r+10,o=e.i;for(;r<i;){let n=o[r++];if(t|=n,(128&n)==0)return kr(e,r),!!(127&t)}throw Nc()}function Ne(e){let t=e.i,r=e.g,i=t[r++],o=127&i;if(128&i&&(i=t[r++],o|=(127&i)<<7,128&i&&(i=t[r++],o|=(127&i)<<14,128&i&&(i=t[r++],o|=(127&i)<<21,128&i&&(i=t[r++],o|=i<<28,128&i&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Nc();return kr(e,r),o}function Cc(e){var t=e.i;let r=e.g,i=t[r],o=t[r+1],n=t[r+2];return t=t[r+3],kr(e,e.g+4),(i<<0|o<<8|n<<16|t<<24)>>>0}function Tc(e){var t=Cc(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 v0(e){return Ne(e)}function wc(e,t,{F:r=!1}={}){e.F=r,t&&(t=jc(t),e.i=t.buffer,e.m=t.A,e.u=0,e.j=e.i.length,e.g=e.u)}function kr(e,t){if(e.g=t,t>e.j)throw wm(e.j,t)}function Am(e,t){if(0>t)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,i=r+t;if(i>e.j)throw wm(t,e.j-r);return e.g=i,r}function _m(e,t){if(t==0)return li();var r=Am(e,t);return e.F&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?ms():y0?e.slice(r,t):new Uint8Array(e.subarray(r,t))),Sm(r)}var Up=[];function xm(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Ne(e.g)>>>0;if(t=r>>>3,!(0<=(r&=7)&&5>=r))throw bm(r,e.j);if(1>t)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Jn(e){switch(e.i){case 0:e.i!=0?Jn(e):Wc(e.g);break;case 1:kr(e=e.g,e.g+8);break;case 2:if(e.i!=2)Jn(e);else{var t=Ne(e.g)>>>0;kr(e=e.g,e.g+t)}break;case 5:kr(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!xm(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Jn(e)}break;default:throw bm(e.i,e.j)}}function gs(e,t,r){let i=e.g.j,o=Ne(e.g)>>>0,n=e.g.g+o,s=n-i;if(0>=s&&(e.g.j=n,r(t,e,void 0,void 0,void 0),s=n-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${o} bytes, instead read ${o-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=n,e.g.j=i}function qc(e){var t=Ne(e.g)>>>0,r=Am(e=e.g,t);if(e=e.i,c0){var i,o=e;(i=vc)||(i=vc=new TextDecoder("utf-8",{fatal:!0})),t=r+t,o=r===0&&t===o.length?o:o.subarray(r,t);try{var n=i.decode(o)}catch(a){if($n===void 0){try{i.decode(new Uint8Array([128]))}catch{}try{i.decode(new Uint8Array([97])),$n=!0}catch{$n=!1}}throw!$n&&(vc=void 0),a}}else{t=(n=r)+t,r=[];let a,c=null;for(;n<t;){var s=e[n++];128>s?r.push(s):224>s?n>=t?br():(a=e[n++],194>s||(192&a)!=128?(n--,br()):r.push((31&s)<<6|63&a)):240>s?n>=t-1?br():(a=e[n++],(192&a)!=128||s===224&&160>a||s===237&&160<=a||(192&(i=e[n++]))!=128?(n--,br()):r.push((15&s)<<12|(63&a)<<6|63&i)):244>=s?n>=t-2?br():(a=e[n++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(i=e[n++]))!=128||(192&(o=e[n++]))!=128?(n--,br()):(s=(7&s)<<18|(63&a)<<12|(63&i)<<6|63&o,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):br(),8192<=r.length&&(c=Ip(c,r),r.length=0)}n=Ip(c,r)}return n}function Cm(e){let t=Ne(e.g)>>>0;return _m(e.g,t)}function $c(e,t,r){var i=Ne(e.g)>>>0;for(i=e.g.g+i;e.g.g<i;)r.push(t(e.g))}var Xn=[];function Lp(e){return e?/^\d+$/.test(e)?(fs(e),new Np(q,ie)):null:b0||=new Np(0,0)}var Np=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},b0;function jp(e){return e?/^-?\d+$/.test(e)?(fs(e),new Vp(q,ie)):null:w0||=new Vp(0,0)}var Vp=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},w0;function ts(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 ys(e,t){for(;127<t;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function vs(e,t){if(0<=t)ys(e,t);else{for(let r=0;9>r;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function rs(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 di(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Pt(e,t,r){ys(e.g,8*t+r)}function Xc(e,t){return Pt(e,t,2),t=e.g.end(),di(e,t),t.push(e.i),t}function Kc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;127<r;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function bs(e,t,r){Pt(e,t,2),ys(e.g,r.length),di(e,e.g.end()),di(e,r)}var xt,Ct=class{constructor(t,r,i,o){this.g=t,this.i=r,this.j=i,this.N=o}};function je(e){return Array.prototype.slice.call(e)}var Jc=(xt=typeof Symbol=="function"&&typeof Symbol()=="symbol"?Symbol():void 0)?(e,t)=>{e[xt]|=t}:(e,t)=>{e.o!==void 0?e.o|=t:Object.defineProperties(e,{o:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function zp(e){let t=oe(e);(1&t)!=1&&(Object.isFrozen(e)&&(e=je(e)),Z(e,1|t))}var Pc=xt?(e,t)=>{e[xt]&=~t}:(e,t)=>{e.o!==void 0&&(e.o&=~t)};function me(e,t,r){return r?e|t:e&~t}var oe=xt?e=>0|e[xt]:e=>0|e.o,D=xt?e=>e[xt]:e=>e.o,Z=xt?(e,t)=>{e[xt]=t}:(e,t)=>{e.o!==void 0?e.o=t:Object.defineProperties(e,{o:{value:t,configurable:!0,writable:!0,enumerable:!1}})};function Gp(){var e=[];return Jc(e,1),e}function S0(e,t){Z(t,-14591&(0|e))}function Ic(e,t){Z(t,-14557&(34|e))}function is(e){return(e=e>>14&1023)===0?536870912:e}var ao={},k0={};function Hp(e){return!(!e||typeof e!="object"||e.W!==k0)}function Qi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}var Tm=!Uc;function Pm(e,t,r){if(e!=null){if(typeof e=="string")e=e?new nr(e,ci):li();else if(e.constructor!==nr)if(ps(e))e=r?Sm(e):e.length?new nr(new Uint8Array(e),ci):li();else{if(!t)throw Error();e=void 0}}return e}function Rc(e,t,r){if(!Array.isArray(e)||e.length)return!1;let i=oe(e);return!!(1&i)||!(!t||!(Array.isArray(t)?t.includes(r):t.has(r)))&&(Z(e,1|i),!0)}var Sr,Wp=[];function Vt(e){if(2&e)throw Error()}var sr,oo;function Im(e,t){(t=sr?t[sr]:void 0)&&(e[sr]=je(t))}Z(Wp,55),Sr=Object.freeze(Wp);function qp(){let e=Error("int32");return e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity="warning",e}function co(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function $p(e){if(e!=null&&typeof e!="boolean"){var t=typeof e;throw Error(`Expected boolean but got ${t!="object"?t:e?Array.isArray(e)?"array":t:"null"}: ${e}`)}return e}Object.freeze(new class{}),Object.freeze(new class{});var E0=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Yc(e){let t=typeof e;return t==="number"?Number.isFinite(e):t==="string"&&E0.test(e)}function Ar(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 Xp(e){return e[0]!=="-"&&(20>e.length||e.length===20&&184467>Number(e.substring(0,6)))}function Rm(e){return e=Math.trunc(e),Number.isSafeInteger(e)||(ai(e),e=zc(q,ie)),e}function Dm(e){var t=Math.trunc(Number(e));if(Number.isSafeInteger(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),!(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))))if(fs(e),e=q,2147483648&(t=ie))if(Vc())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,i]=Gc(e,t);e="-"+es(r,i)}else e=es(e,t);return e}function Om(e){if(typeof e!="string")throw Error();return e}function os(e){if(e!=null&&typeof e!="string")throw Error();return e}function Er(e){return e==null||typeof e=="string"?e:void 0}function Fm(e,t,r){if(e!=null&&typeof e=="object"&&e.C===ao)return e;if(Array.isArray(e)){var i=oe(e),o=i;return o===0&&(o|=32&r),(o|=2&r)!==i&&Z(e,o),new t(e)}}var ns,Zc,A0;function ss(e){switch(typeof e){case"boolean":return Zc||=[0,void 0,!0];case"number":return 0<e?void 0:e===0?A0||=[0,void 0]:[-e,void 0];case"string":return[0,e];case"object":return e}}function no(e,t,r){if(e==null&&(e=ns),ns=void 0,e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-16760833&i|(1023&t)<<14)}else{if(!Array.isArray(e))throw Error();if(64&(i=oe(e)))return oo&&delete e[oo],e;if(i|=64,r&&(i|=512,r!==e[0]))throw Error();e:{let o=(r=e).length;if(o){let n=o-1;if(Qi(r[n])){if(1024<=(t=n-(+!!(512&(i|=256))-1)))throw Error();i=-16760833&i|(1023&t)<<14;break e}}if(t){if(1024<(t=Math.max(t,o-(+!!(512&i)-1))))throw Error();i=-16760833&i|(1023&t)<<14}}}return Z(e,i),e}function Bm(e,t,r,i,o,n){if(e!=null){if(Array.isArray(e))e=o&&e.length==0&&1&oe(e)?void 0:n&&2&oe(e)?e:Qc(e,t,r,i!==void 0,o,n);else if(Qi(e)){let s={};for(let a in e)s[a]=Bm(e[a],t,r,i,o,n);e=s}else e=t(e,i);return e}}function Qc(e,t,r,i,o,n){let s=i||r?oe(e):0;i=i?!!(32&s):void 0;let a=je(e);for(let c=0;c<a.length;c++)a[c]=Bm(a[c],t,r,i,o,n);return r&&(Im(a,e),r(s,a)),a}function _0(e){return e.C===ao?e.toJSON():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))return Tm||!Rc(t,void 0,9999)?t:void 0;if(ps(t))return Dp(t);if(t instanceof nr){let r=t.D;return r==null?"":typeof r=="string"?r:t.D=Dp(r)}}}return t}(e)}function Mm(e,t,r=Ic){if(e!=null){if(fm&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var i=oe(e);return 2&i?e:(t&&=i===0||!!(32&i)&&!(64&i||!(16&i)),t?(Z(e,-12293&(34|i)),e):Qc(e,Mm,4&i?Ic:r,!0,!1,!0))}return e.C===ao&&(r=e.l,e=2&(i=D(r))?e:el(e,r,i,!0)),e}}function Um(e){let t=e.l;return el(e,t,D(t),!1)}function el(e,t,r,i){return e=e.constructor,ns=t=Lm(t,r,i),t=new e(t),ns=void 0,t}function Lm(e,t,r){let i=r||2&t?Ic:S0,o=!!(32&t);return e=function(n,s,a){let c=je(n);var l=c.length;let d=256&s?c[l-1]:void 0;for(l+=d?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(d){s=c[s]={};for(let u in d)s[u]=a(d[u])}return Im(c,n),c}(e,t,n=>Mm(n,o,i)),Jc(e,32|(r?2:0)),e}function tl(e){let t=e.l,r=D(t);return 2&r?el(e,t,r,!1):e}function jt(e,t){return cr(e=e.l,D(e),t)}function cr(e,t,r,i){if(r===-1)return null;if(r>=is(t)){if(256&t)return e[e.length-1][r]}else{var o=e.length;if(i&&256&t&&(i=e[o-1][r])!=null)return i;if((t=r+(+!!(512&t)-1))<o)return e[t]}}function fe(e,t,r,i){let o=e.l,n=D(o);return Vt(n),Q(o,n,t,r,i),e}function Q(e,t,r,i,o){var n=is(t);if(r>=n||o){if(o=t,256&t)n=e[e.length-1];else{if(i==null)return o;n=e[n+(+!!(512&t)-1)]={},o|=256}return n[r]=i,o!==t&&Z(e,o),o}return e[r+(+!!(512&t)-1)]=i,256&t&&r in(e=e[e.length-1])&&delete e[r],t}function lo(e,t,r,i,o){var n=2&t;let s=cr(e,t,r,o);Array.isArray(s)||(s=Sr);let a=!(2&i);i=!(1&i);let c=!!(32&t),l=oe(s);return l!==0||!c||n||a?1&l||(l|=1,Z(s,l)):(l|=33,Z(s,l)),n?(e=!1,2&l||(Jc(s,34),e=!!(4&l)),(i||e)&&Object.freeze(s)):(n=!!(2&l)||!!(2048&l),i&&n?(s=je(s),i=1,c&&!a&&(i|=32),Z(s,i),Q(e,t,r,s,o)):a&&32&l&&!n&&Pc(s,32)),s}function Nm(e){e=e.l;let t=D(e),r=cr(e,t,1),i=Pm(r,!0,!!(34&t));return i!=null&&i!==r&&Q(e,t,1,i),i}function jm(e,t){return e=cr(e,t,1),Array.isArray(e)?e:Sr}function Vm(e,t,r){return e===0&&(e=_r(e,t,r)),me(e,1,!0)}function eo(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Kp(e,t,r){{let s=e.l,a=D(s);if(Vt(a),r==null)Q(s,a,t);else{var i,o=e=oe(r),n=!!(2&e)||Object.isFrozen(r);if((i=!n)&&(i=!1),!(4&e))for(e=21,n&&(r=je(r),o=0,e=_r(e,a,!0)),n=0;n<r.length;n++)r[n]=Om(r[n]);i&&(r=je(r),o=0,e=_r(e,a,!0)),e!==o&&Z(r,e),Q(s,a,t,r)}}}function zm(e,t){e=e.l;let r=D(e);Vt(r),Q(e,r,2,t===""?void 0:t)}function Gm(e,t,r,i){let o=D(e);Vt(o),e=lo(e,o,t,2),i=r(i,!!(4&(t=oe(e)))&&!!(4096&t)),e.push(i)}function x0(e){return e}function Sc(e,t){return rl(e=e.l,D(e),Pf)===t?t:-1}function rl(e,t,r){let i=0;for(let o=0;o<r.length;o++){let n=r[o];cr(e,t,n)!=null&&(i!==0&&(t=Q(e,t,i)),i=n)}return i}function il(e,t,r,i){let o=D(e);Vt(o);let n=cr(e,o,r,i),s;if(n!=null&&n.C===ao)return(t=tl(n))!==n&&Q(e,o,r,t,i),t.l;if(Array.isArray(n)){let a=oe(n);s=2&a?Lm(n,a,!1):n,s=no(s,t[0],t[1])}else s=no(void 0,t[0],t[1]);return s!==n&&Q(e,o,r,s,i),s}function Hm(e,t,r,i){e=e.l;let o=D(e),n=cr(e,o,r,i);return(t=Fm(n,t,o))!==n&&t!=null&&Q(e,o,r,t,i),t}function lt(e,t,r){if((t=Hm(e,t,r,!1))==null)return t;e=e.l;let i=D(e);if(!(2&i)){let o=tl(t);o!==t&&Q(e,i,r,t=o,!1)}return t}function Wm(e,t,r,i,o){var n=!!(2&t),s=n?1:2;let a=s===1;s=s===2,i=!!i,o&&=!n,n=jm(e,t);var c=oe(n);let l=!!(4&c);if(!l){var d,u=n,m=t;(d=!!(2&(c=Vm(c,t,i))))&&(m=me(m,2,!0));let f=!d,h=!0,g=0,y=0;for(;g<u.length;g++){let v=Fm(u[g],r,m);if(v instanceof r){if(!d){let S=!!(2&oe(v.l));f&&=!S,h&&=S}u[y++]=v}}y<g&&(u.length=y),c=me(c,4,!0),c=me(c,16,h),c=me(c,8,f),Z(u,c),d&&Object.freeze(u)}if(r=!!(8&c)||a&&!n.length,o&&!r){for(eo(c)&&(n=je(n),c=_r(c,t,i),t=Q(e,t,1,n)),o=n,r=c,u=0;u<o.length;u++)(c=o[u])!==(m=tl(c))&&(o[u]=m);r=me(r,8,!0),r=me(r,16,!o.length),Z(o,r),c=r}return eo(c)||(o=c,a?c=me(c,!n.length||16&c&&(!l||32&c)?2:2048,!0):i||(c=me(c,32,!1)),c!==o&&Z(n,c),a&&Object.freeze(n)),s&&eo(c)&&(n=je(n),c=_r(c,t,i),Z(n,c),Q(e,t,1,n)),n}function ol(e,t){e=e.l;let r=D(e);return Wm(e,r,t,!1,!(2&r))}function dt(e,t,r,i,o){return i==null&&(i=void 0),fe(e,r,i,o)}function kc(e,t,r){var i=Af;r==null&&(r=void 0),e=e.l;let o=D(e);Vt(o),(i=rl(e,o,i))&&i!==t&&r!=null&&(o=Q(e,o,i)),Q(e,o,t,r)}function _r(e,t,r){return e=me(e,2,!!(2&t)),e=me(e,32,!!(32&t)&&r),me(e,2048,!1)}function qm(e,t){var r=_s;e=e.l;let i=D(e);Vt(i),e=Wm(e,i,r,!0),t=t??new r,e.push(t),2&oe(t.l)?Pc(e,8):Pc(e,16)}function Dc(e){return(e=jt(e,2))==null?e:Yc(e)?typeof e=="number"?Rm(e):Dm(e):void 0}function $m(e){return e??0}function Pe(e,t,r){Gm(e.l,t,Om,r)}function Xm(e,t,r){t.g?t.j(e,t.g,t.i,r,!0):t.j(e,t.i,r,!0)}var $=class{constructor(e,t){this.l=no(e,t)}toJSON(){return Km(this,Qc(this.l,_0,void 0,void 0,!1,!1),!0)}A(){return!!(2&oe(this.l))}};function Km(e,t,r){let i=e.constructor.v;var o=D(r?e.l:t),n=is(o),s=!1;if(i&&Tm){if(!r){var a;if((t=je(t)).length&&Qi(a=t[t.length-1])){for(s=0;s<i.length;s++)if(i[s]>=n){Object.assign(t[t.length-1]={},a);break}}s=!0}var c;n=t,r=!r,e=is(a=D(e.l)),a=+!!(512&a)-1;for(let y=0;y<i.length;y++){var l=i[y];if(l<e){var d=n[l+=a];d==null?n[l]=r?Sr:Gp():r&&d!==Sr&&zp(d)}else{if(!c){var u=void 0;n.length&&Qi(u=n[n.length-1])?c=u:n.push(c={})}d=c[l],c[l]==null?c[l]=r?Sr:Gp():r&&d!==Sr&&zp(d)}}}if(!(c=t.length))return t;let m,f;if(Qi(u=t[c-1])){e:{var h=u;for(var g in n={},r=!1,h)e=h[g],Array.isArray(e)&&(a=e,(!Bp&&Rc(e,i,+g)||!Fp&&Hp(e)&&e.size===0)&&(e=null),e!=a&&(r=!0)),e!=null?n[g]=e:r=!0;if(r){for(let y in n){h=n;break e}h=null}}h!=u&&(m=!0),c--}for(o=+!!(512&o)-1;0<c&&((u=t[g=c-1])==null||!Bp&&Rc(u,i,g-o)||!Fp&&Hp(u)&&u.size===0);c--)f=!0;return(m||f)&&(t=s?t:Array.prototype.slice.call(t,0,c),s&&(t.length=c),h&&t.push(h)),t}function Jm(e){return Array.isArray(e)?e[0]instanceof Ct?e:[U0,e]:[e,void 0]}function ws(e,t){if(Array.isArray(t)){var r=oe(t);if(4&r)return t;for(var i=0,o=0;i<t.length;i++){let n=e(t[i]);n!=null&&(t[o++]=n)}return o<i&&(t.length=o),Z(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}$.prototype.C=ao,$.prototype.toString=function(){return Km(this,this.l,!1).toString()};var Jp=Symbol();function nl(e){let t=e[Jp];if(!t){let r=Qm(e),i=al(e),o=i.g;t=o?(n,s)=>o(n,s,i):(n,s)=>{for(;xm(s)&&s.i!=4;){var a=s.m,c=i[a];if(!c){var l=i.K;l&&(l=l[a])&&(c=i[a]=C0(l))}c&&c(s,n,a)||(a=(c=s).j,Jn(c),c.J?c=void 0:(l=c.g.g-a,c.g.g=a,c=_m(c.g,l)),a=n,c&&(sr||=Symbol(),(l=a[sr])?l.push(c):a[sr]=[c]))}r===Ym||r===Zm||r.T||(n[oo||=Symbol()]=r)},e[Jp]=t}return t}function C0(e){let t=(e=Jm(e))[0].g;if(e=e[1]){let r=nl(e),i=al(e).B;return(o,n,s)=>t(o,n,s,i,r)}return t}var Ym,Zm,Yn=Symbol();function T0(e,t,r){let i=r[1],o;if(i){let n=i[Yn];o=n?n.B:ss(i[0]),e[t]=n??i}o&&o===Zc?(e.L||(e.L=[])).push(t):r[0]&&(e.M||(e.M=[])).push(t)}function Yp(e,t){return[e.j,!t||0<t[0]?void 0:t]}function Qm(e){var t=e[Yn];if(t)return t;if(!(t=sl(e,e[Yn]={},Yp,Yp,T0)).M&&!t.L){let r=!0;for(let i in t){isNaN(i)||(r=!1);break}r?(t=ss(e[0])===Zc,t=e[Yn]=t?Zm||={B:ss(!0)}:Ym||={}):t.T=!0}return t}function P0(e,t,r){e[t]=r}function sl(e,t,r,i,o=P0){t.B=ss(e[0]);let n=0;var s=e[++n];s&&s.constructor===Object&&(t.K=s,typeof(s=e[++n])=="function"&&(t.g=s,t.i=e[++n],s=e[++n]));let a={};for(;Array.isArray(s)&&typeof s[0]=="number"&&0<s[0];){for(var c=0;c<s.length;c++)a[s[c]]=s;s=e[++n]}for(c=1;s!==void 0;){let u;typeof s=="number"&&(c+=s,s=e[++n]);var l=void 0;if(s instanceof Ct?u=s:(u=L0,n--),u.N){s=e[++n],l=e;var d=n;typeof s=="function"&&(s=s(),l[d]=s),l=s}for(d=c+1,typeof(s=e[++n])=="number"&&0>s&&(d-=s,s=e[++n]);c<d;c++){let m=a[c];o(t,c,l?i(u,l,m):r(u,m))}}return t}var Zp=Symbol();function ef(e){let t=e[Zp];if(!t){let r=Ss(e);t=(i,o)=>tf(i,o,r),e[Zp]=t}return t}var Zn=Symbol();function I0(e){return e.i}function R0(e,t){let r,i,o=e.i;return(n,s,a)=>o(n,s,a,i||=Ss(t).B,r||=ef(t))}function Ss(e){let t=e[Zn];return t||(t=sl(e,e[Zn]={},I0,R0),Qn in e&&Zn in e&&(e.length=0),t)}var Qn=Symbol();function D0(e,t){let r=e.g;return t?(i,o,n)=>r(i,o,n,t):r}function O0(e,t,r){let i=e.g,o,n;return(s,a,c)=>i(s,a,c,n||=al(t).B,o||=nl(t),r)}function al(e){let t=e[Qn];return t||(Qm(e),t=sl(e,e[Qn]={},D0,O0),Qn in e&&Zn in e&&(e.length=0),t)}function Qp(e,t){var r=e[t];if(r)return r;if((r=e.K)&&(r=r[t])){var i=(r=Jm(r))[0].i;if(r=r[1]){let o=ef(r),n=Ss(r).B;r=(r=e.i)?r(n,o):(s,a,c)=>i(s,a,c,n,o)}else r=i;return e[t]=r}}function tf(e,t,r){for(var i=D(e),o=+!!(512&i)-1,n=e.length,s=512&i?1:0,a=n+(256&i?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-o,d=Qp(r,l);d&&d(t,c,l)}if(256&i){i=e[n-1];for(let c in i)o=+c,Number.isNaN(o)||(n=i[c])!=null&&(a=Qp(r,o))&&a(t,n,o)}if(e=sr?e[sr]:void 0)for(di(t,t.g.end()),r=0;r<e.length;r++)di(t,Lc(e[r])||ms())}function Ie(e,t){return new Ct(e,t,!1,!1)}function ks(e,t){return new Ct(e,t,!0,!1)}function Re(e,t,r){Q(e,D(e),t,r)}function rf(e,t,r){e:if(t!=null){if(Yc(t)){if(typeof t=="string"){t=Dm(t);break e}if(typeof t=="number"){t=Rm(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&jp(t),t!=null&&(Pt(e,r,0),typeof t=="number"?(e=e.g,ai(t),ts(e,q,ie)):(r=jp(t),ts(e.g,r.i,r.g))))}function of(e,t,r){(t=Ar(t))!=null&&t!=null&&(Pt(e,r,0),vs(e.g,t))}function nf(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Pt(e,r,0),e.g.g.push(t?1:0))}function sf(e,t,r){(t=Er(t))!=null&&bs(e,r,um(t))}function Es(e,t,r,i,o){(t=t instanceof $?t.l:Array.isArray(t)?no(t,i[0],i[1]):void 0)!=null&&(r=Xc(e,r),o(t,e),Kc(e,r))}function af(e,t,r){(t=t==null||typeof t=="string"||ps(t)||t instanceof nr?t:void 0)!=null&&bs(e,r,jc(t).buffer)}var et,F0=Ie(function(e,t,r){if(e.i!==1)return!1;var i=e.g;e=Cc(i);let o=Cc(i);i=2*(o>>31)+1;let n=o>>>20&2047;return e=4294967296*(1048575&o)+e,Re(t,r,n==2047?e?NaN:1/0*i:n==0?i*Math.pow(2,-1074)*e:i*Math.pow(2,n-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=co(t))!=null&&(Pt(e,r,1),e=e.g,(r=km||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),q=r.getUint32(0,!0),ie=r.getUint32(4,!0),rs(e,q),rs(e,ie))}),cf=Ie(function(e,t,r){return e.i===5&&(Re(t,r,Tc(e.g)),!0)},function(e,t,r){(t=co(t))!=null&&(Pt(e,r,5),e=e.g,Em(t),rs(e,q))}),B0=ks(function(e,t,r){return(e.i===5||e.i===2)&&(t=lo(t,D(t),r,2,!1),e.i==2?$c(e,Tc,t):t.push(Tc(e.g)),!0)},function(e,t,r){if((t=ws(co,t))!=null&&t.length){Pt(e,r,2),ys(e.g,4*t.length);for(let i=0;i<t.length;i++)r=e.g,Em(t[i]),rs(r,q)}}),as=Ie(function(e,t,r){return e.i===0&&(Re(t,r,Hc(e.g,zc)),!0)},rf),Ec=Ie(function(e,t,r){return e.i===0&&(Re(t,r,(e=Hc(e.g,zc))===0?void 0:e),!0)},rf),M0=Ie(function(e,t,r){return e.i===0&&(Re(t,r,Hc(e.g,xc)),!0)},function(e,t,r){e:if(t!=null){if(Yc(t)){if(typeof t=="string"){var i=Math.trunc(Number(t));Number.isSafeInteger(i)&&0<=i?t=String(i):((i=t.indexOf("."))!==-1&&(t=t.substring(0,i)),Xp(t)||(fs(t),t=es(q,ie)));break e}if(typeof t=="number"){t=0<=(t=Math.trunc(t))&&Number.isSafeInteger(t)?t:function(o){if(0>o){ai(o);let n=es(q,ie);return o=Number(n),Number.isSafeInteger(o)?o:n}return Xp(String(o))?o:(ai(o),xc(q,ie))}(t);break e}}t=void 0}t!=null&&(typeof t=="string"&&Lp(t),t!=null&&(Pt(e,r,0),typeof t=="number"?(e=e.g,ai(t),ts(e,q,ie)):(r=Lp(t),ts(e.g,r.i,r.g))))}),lr=Ie(function(e,t,r){return e.i===0&&(Re(t,r,Ne(e.g)),!0)},of),lf=ks(function(e,t,r){return(e.i===0||e.i===2)&&(t=lo(t,D(t),r,2,!1),e.i==2?$c(e,Ne,t):t.push(Ne(e.g)),!0)},function(e,t,r){if((t=ws(Ar,t))!=null&&t.length){r=Xc(e,r);for(let i=0;i<t.length;i++)vs(e.g,t[i]);Kc(e,r)}}),ui=Ie(function(e,t,r){return e.i===0&&(Re(t,r,(e=Ne(e.g))===0?void 0:e),!0)},of),Tt=Ie(function(e,t,r){return e.i===0&&(Re(t,r,Wc(e.g)),!0)},nf),to=Ie(function(e,t,r){return e.i===0&&(Re(t,r,(e=Wc(e.g))===!1?void 0:e),!0)},nf),ut=ks(function(e,t,r){return e.i===2&&(Gm(t,r,x0,e=qc(e)),!0)},function(e,t,r){if((t=ws(Er,t))!=null)for(let s=0;s<t.length;s++){var i=e,o=r,n=t[s];n!=null&&bs(i,o,um(n))}}),ar=Ie(function(e,t,r){return e.i===2&&(Re(t,r,(e=qc(e))===""?void 0:e),!0)},sf),ge=Ie(function(e,t,r){return e.i===2&&(Re(t,r,qc(e)),!0)},sf),U0=new Ct(function(e,t,r,i,o){return e.i===2&&(gs(e,il(t,i,r,!0),o),!0)},Es,!1,!0),L0=new Ct(function(e,t,r,i,o){return e.i===2&&(gs(e,il(t,i,r),o),!0)},Es,!1,!0);et=new Ct(function(e,t,r,i,o){if(e.i!==2)return!1;i=no(void 0,i[0],i[1]);let n=D(t);Vt(n);let s=lo(t,n,r,3);return n=D(t),4&oe(s)&&(s=je(s),Z(s,-2079&(1|oe(s))),Q(t,n,r,s)),s.push(i),gs(e,i,o),!0},function(e,t,r,i,o){if(Array.isArray(t))for(let n=0;n<t.length;n++)Es(e,t[n],r,i,o)},!0,!0);var tt=new Ct(function(e,t,r,i,o,n){if(e.i!==2)return!1;let s=D(t);return Vt(s),(n=rl(t,s,n))&&r!==n&&Q(t,s,n),gs(e,t=il(t,i,r),o),!0},Es,!1,!0),df=Ie(function(e,t,r){return e.i===2&&(Re(t,r,Cm(e)),!0)},af),so=Ie(function(e,t,r){return e.i===0&&(Re(t,r,Ne(e.g)),!0)},function(e,t,r){(t=Ar(t))!=null&&(t=parseInt(t,10),Pt(e,r,0),vs(e.g,t))}),N0=ks(function(e,t,r){return(e.i===0||e.i===2)&&(t=lo(t,D(t),r,2,!1),e.i==2?$c(e,v0,t):t.push(Ne(e.g)),!0)},function(e,t,r){if((t=ws(Ar,t))!=null&&t.length){r=Xc(e,r);for(let i=0;i<t.length;i++)vs(e.g,t[i]);Kc(e,r)}}),cs=class{constructor(t,r){this.i=t,this.g=r,this.j=dt,this.defaultValue=void 0}};function uf(e,t){return(r,i)=>{e:{if(Xn.length){let n=Xn.pop();n.s(i),wc(n.g,r,i),r=n}else r=new class{constructor(n,s){if(Up.length){let a=Up.pop();wc(a,n,s),n=a}else n=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.u=0,wc(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.u=0,this.F=!1}}(n,s);this.g=n,this.j=this.g.g,this.i=this.m=-1,this.s(s)}s({J:n=!1}={}){this.J=n}}(r,i);try{let n=new e,s=n.l;nl(t)(s,r),oo&&delete s[oo];var o=n;break e}finally{r.g.clear(),r.m=-1,r.i=-1,100>Xn.length&&Xn.push(r)}o=void 0}return o}}var hf=[0,ar,Ie(function(e,t,r){return e.i===2&&(Re(t,r,(e=Cm(e))===li()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof $){let i=t.X;return void(i&&(t=i(t),t!=null&&bs(e,r,jc(t).buffer)))}if(Array.isArray(t))return}af(e,t,r)})],j0=[0,ge],pf=[0,lr,so,Tt,-1,lf,so,-1],V0=[0,Tt,-1],mf=class extends ${constructor(){super()}};mf.v=[6];var ff=[0,Tt,ge,Tt,so,-1,N0,ge,-1,V0,so],gf=[0,ge,-2],em=class extends ${constructor(){super()}},yf=[0],vf=[0,lr,Tt,-2],bf=class extends ${constructor(e){super(e,2)}},As={},z0=[-2,As,Tt];As[336783863]=[0,ge,Tt,-1,lr,[0,[1,2,3,4,5],tt,yf,tt,ff,tt,gf,tt,vf,tt,pf],j0];var G0=[0,ar,to],wf=[0,Ec,-1,to,-3,Ec,lf,ar,ui,Ec,-1,to,ui,to,-2,ar],uo=[-1,{}],Sf=[0,ge,1,uo],kf=[0,ge,ut,uo],_s=class extends ${constructor(e){super(e,500)}s(e){return dt(this,0,7,e)}};_s.v=[3,4,5,6,8,13,17,1005];var tm,H0=[-500,ar,-1,ut,-3,z0,et,hf,ui,-1,Sf,kf,et,G0,ar,wf,ui,ut,987,ut],W0=[0,ar,-1,uo],q0=[-500,ge,-1,[-1,{}],998,ge],$0=[-500,ge,ut,-1,[-2,{},Tt],997,ut,-1],X0=[-500,ge,ut,uo,998,ut],ls=class extends ${constructor(){super(void 0,500)}s(e){return dt(this,0,1001,e)}};ls.v=[1,6,7,9,10,15,16,17,14,1002],ls.prototype.g=(tm=[-500,et,H0,4,et,q0,et,$0,ui,et,X0,ut,ui,Sf,kf,et,W0,ut,-2,wf,ar,-1,to,979,uo,et,hf],function(){let e=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){let n=this.g;return this.g=[],n}}}};tf(this.l,e,Ss(tm)),di(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,i=r.length,o=0;for(let n=0;n<i;n++){let s=r[n];t.set(s,o),o+=s.length}return e.j=[t],t});var K0=class extends ${constructor(e){super(e)}},J0=[0,lr,cf,ge,-1],Ef=class extends ${constructor(e){super(e)}g(){return ol(this,K0)}};Ef.v=[1];var Y0=[0,et,J0],Oc=class extends ${constructor(e){super(e)}};Oc.v=[4,5];var rm=class extends ${constructor(e){super(e)}},Af=[1,2,3,4,5],ds=class extends ${constructor(e){super(e)}g(){return Nm(this)!=null}i(){return Er(jt(this,2))!=null}},us=class extends ${constructor(e){super(e)}},_f=[0,[0,df,ge,[0,lr,as,-1],[0,M0,as]],Tt,[0,Af,tt,vf,tt,ff,tt,pf,tt,yf,tt,gf],so],xf=class extends ${constructor(e){super(e)}},Z0=new cs(451755788,xf);As[451755788]=[0,_f,[0,ge,lr,cf,ut,-1],F0];var im=class extends ${constructor(e){super(e)}},Cf=class extends ${constructor(e){super(e)}},Q0=new cs(487277289,Cf);As[487277289]=[0,_f,[0,Tt,-1]];var e3=class extends ${constructor(e){super(e)}},t3=[0,1,lr,ge,Y0],Tf=class extends ${constructor(e){super(e)}};Tf.v=[1];var r3=uf(Tf,[0,et,t3,as]),Fc=class extends ${constructor(e){super(e)}};Fc.v=[1];var i3=class extends ${constructor(e){super(e)}O(){let e=Nm(this);return e??li()}},o3=class extends ${constructor(e){super(e)}},Pf=[1,2],n3=[0,Pf,tt,[0,B0],tt,[0,df],lr,ge],If=class extends ${constructor(e){super(e)}};If.v=[1];var om=uf(If,[0,et,n3,as]);async function nm(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,i)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",o=>{i(o)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function E(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.h.stringToNewUTF8(t)),e.h._free(t)}function sm(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let i=new Uint32Array(t.length);for(let o=0;o<t.length;o++)i[o]=e.h.stringToNewUTF8(t[o]);t=e.h._malloc(4*i.length),e.h.HEAPU32.set(i,t>>2),r(t);for(let o of i)e.h._free(o);e.h._free(t)}function wr(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function oi(e,t,r){let i=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(o,n,s)=>{n?(r(i,s),i=[]):i.push(o)}}var s3=function(e){return class extends e{U(){this.h._registerModelResourcesGraphService()}}}(class{constructor(e,t){this.j=!0,this.h=e,this.g=null,this.i=0,this.m=typeof this.h._addIntToInputStream=="function",t!==void 0?this.h.canvas=t:((e=typeof OffscreenCanvas>"u")||(e=(e=navigator.userAgent).includes("Safari")&&!e.includes("Chrome")),e?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas")):this.h.canvas=new OffscreenCanvas(1,1))}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,i=this.h._malloc(r);this.h.HEAPU8.set(e,i),t?this.h._changeBinaryGraph(r,i):this.h._changeTextGraph(r,i),this.h._free(i)}configureAudio(e,t,r,i,o){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),E(this,i||"input_audio",n=>{E(this,o=o||"audio_header",s=>{this.h._configureAudio(n,s,e,t,r)})})}setAutoResizeCanvas(e){this.j=e}setAutoRenderToScreen(e){this.h._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.h.gpuOriginForWebTexturesIsBottomLeft=e}attachErrorListener(e){this.h.errorListener=e}attachEmptyPacketListener(e,t){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,i,o){let n=4*e.length;this.i!==n&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(n),this.i=n),this.h.HEAPF32.set(e,this.g/4),E(this,i,s=>{this.h._addAudioToInputStream(this.g,t,r,s,o)})}addGpuBufferToStream(e,t,r){E(this,t,i=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");i?this.h._bindTextureToStream(i):this.h._bindTextureToCanvas();var o=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!o)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let n;this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!0),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),e.videoWidth?(o=e.videoWidth,n=e.videoHeight):e.naturalWidth?(o=e.naturalWidth,n=e.naturalHeight):(o=e.width,n=e.height),!this.j||o===this.h.canvas.width&&n===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=n);let[s,a]=[o,n];this.h._addBoundTextureToStream(i,s,a,r)})}addBoolToStream(e,t,r){E(this,t,i=>{this.h._addBoolToInputStream(e,i,r)})}addDoubleToStream(e,t,r){E(this,t,i=>{this.h._addDoubleToInputStream(e,i,r)})}addFloatToStream(e,t,r){E(this,t,i=>{this.h._addFloatToInputStream(e,i,r)})}addIntToStream(e,t,r){E(this,t,i=>{this.h._addIntToInputStream(e,i,r)})}addStringToStream(e,t,r){E(this,t,i=>{E(this,e,o=>{this.h._addStringToInputStream(o,i,r)})})}addStringRecordToStream(e,t,r){E(this,t,i=>{sm(this,Object.keys(e),o=>{sm(this,Object.values(e),n=>{this.h._addFlatHashMapToInputStream(o,n,Object.keys(e).length,i,r)})})})}addProtoToStream(e,t,r,i){E(this,r,o=>{E(this,t,n=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,n,o,i),this.h._free(s)})})}addEmptyPacketToStream(e,t){E(this,e,r=>{this.h._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){E(this,t,i=>{let o=this.h._allocateBoolVector(e.length);if(!o)throw Error("Unable to allocate new bool vector on heap.");for(let n of e)this.h._addBoolVectorEntry(o,n);this.h._addBoolVectorToInputStream(o,i,r)})}addDoubleVectorToStream(e,t,r){E(this,t,i=>{let o=this.h._allocateDoubleVector(e.length);if(!o)throw Error("Unable to allocate new double vector on heap.");for(let n of e)this.h._addDoubleVectorEntry(o,n);this.h._addDoubleVectorToInputStream(o,i,r)})}addFloatVectorToStream(e,t,r){E(this,t,i=>{let o=this.h._allocateFloatVector(e.length);if(!o)throw Error("Unable to allocate new float vector on heap.");for(let n of e)this.h._addFloatVectorEntry(o,n);this.h._addFloatVectorToInputStream(o,i,r)})}addIntVectorToStream(e,t,r){E(this,t,i=>{let o=this.h._allocateIntVector(e.length);if(!o)throw Error("Unable to allocate new int vector on heap.");for(let n of e)this.h._addIntVectorEntry(o,n);this.h._addIntVectorToInputStream(o,i,r)})}addStringVectorToStream(e,t,r){E(this,t,i=>{let o=this.h._allocateStringVector(e.length);if(!o)throw Error("Unable to allocate new string vector on heap.");for(let n of e)E(this,n,s=>{this.h._addStringVectorEntry(o,s)});this.h._addStringVectorToInputStream(o,i,r)})}addBoolToInputSidePacket(e,t){E(this,t,r=>{this.h._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){E(this,t,r=>{this.h._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){E(this,t,r=>{this.h._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){E(this,t,r=>{this.h._addIntToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){E(this,t,r=>{E(this,e,i=>{this.h._addStringToInputSidePacket(i,r)})})}addProtoToInputSidePacket(e,t,r){E(this,r,i=>{E(this,t,o=>{let n=this.h._malloc(e.length);this.h.HEAPU8.set(e,n),this.h._addProtoToInputSidePacket(n,e.length,o,i),this.h._free(n)})})}addBoolVectorToInputSidePacket(e,t){E(this,t,r=>{let i=this.h._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.h._addBoolVectorEntry(i,o);this.h._addBoolVectorToInputSidePacket(i,r)})}addDoubleVectorToInputSidePacket(e,t){E(this,t,r=>{let i=this.h._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.h._addDoubleVectorEntry(i,o);this.h._addDoubleVectorToInputSidePacket(i,r)})}addFloatVectorToInputSidePacket(e,t){E(this,t,r=>{let i=this.h._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.h._addFloatVectorEntry(i,o);this.h._addFloatVectorToInputSidePacket(i,r)})}addIntVectorToInputSidePacket(e,t){E(this,t,r=>{let i=this.h._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.h._addIntVectorEntry(i,o);this.h._addIntVectorToInputSidePacket(i,r)})}addStringVectorToInputSidePacket(e,t){E(this,t,r=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)E(this,o,n=>{this.h._addStringVectorEntry(i,n)});this.h._addStringVectorToInputSidePacket(i,r)})}attachBoolListener(e,t){wr(this,e,t),E(this,e,r=>{this.h._attachBoolListener(r)})}attachBoolVectorListener(e,t){oi(this,e,t),E(this,e,r=>{this.h._attachBoolVectorListener(r)})}attachIntListener(e,t){wr(this,e,t),E(this,e,r=>{this.h._attachIntListener(r)})}attachIntVectorListener(e,t){oi(this,e,t),E(this,e,r=>{this.h._attachIntVectorListener(r)})}attachDoubleListener(e,t){wr(this,e,t),E(this,e,r=>{this.h._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){oi(this,e,t),E(this,e,r=>{this.h._attachDoubleVectorListener(r)})}attachFloatListener(e,t){wr(this,e,t),E(this,e,r=>{this.h._attachFloatListener(r)})}attachFloatVectorListener(e,t){oi(this,e,t),E(this,e,r=>{this.h._attachFloatVectorListener(r)})}attachStringListener(e,t){wr(this,e,t),E(this,e,r=>{this.h._attachStringListener(r)})}attachStringVectorListener(e,t){oi(this,e,t),E(this,e,r=>{this.h._attachStringVectorListener(r)})}attachProtoListener(e,t,r){wr(this,e,t),E(this,e,i=>{this.h._attachProtoListener(i,r||!1)})}attachProtoVectorListener(e,t,r){oi(this,e,t),E(this,e,i=>{this.h._attachProtoVectorListener(i,r||!1)})}attachAudioListener(e,t,r){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),wr(this,e,(i,o)=>{i=new Float32Array(i.buffer,i.byteOffset,i.length/4),t(i,o)}),E(this,e,i=>{this.h._attachAudioListener(i,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),Rf=class extends s3{};async function a3(e,t,r){return e=await(async(i,o,n,s)=>{if(o&&await nm(o),!self.ModuleFactory||n&&(await nm(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((o=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new i(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:i=>i.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&i.endsWith(".data")?t.assetBinaryPath.toString():i}),await e.s(r),e}async function Df(e,t,r){return a3(e,t,r)}function am(e,t){let r=lt(e.baseOptions,ds,1)||new ds;typeof t=="string"?(fe(r,2,os(t)),fe(r,1)):t instanceof Uint8Array&&(fe(r,1,Pm(t,!1,!1)),fe(r,2)),dt(e.baseOptions,0,1,r)}function Of(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(lt(e.baseOptions,ds,1)?.g()||lt(e.baseOptions,ds,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return function(i,o){let n=lt(i.baseOptions,rm,3);if(!n){var s=n=new rm;kc(s,4,new em)}"delegate"in o&&(o.delegate==="GPU"?kc(o=n,2,s=new mf):kc(o=n,4,s=new em)),dt(i.baseOptions,0,3,n)}(e,r),r.modelAssetPath?fetch(r.modelAssetPath.toString()).then(i=>{if(i.ok)return i.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${i.status})`)}).then(i=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(i),!0,!1,!1),am(e,"/model.dat"),e.I()}):(am(e,r.modelAssetBuffer),e.I(),Promise.resolve())}function cm(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(1<t)throw Error("Encountered multiple errors: "+e.j.map(r=>r.message).join(", "))}finally{e.j=[]}}function ni(e,t){e.u=Math.max(e.u,t)}var Bc=class{constructor(e){this.g=e,this.j=[],this.u=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener((r,i)=>{this.j.push(Error(i))}),this.g.U(),this.g.setGraph(e,t),cm(this)}finishProcessing(){this.g.finishProcessing(),cm(this)}close(){this.g.closeGraph()}};async function ro(e,t,r){return Df(e,t,r)}Bc.prototype.close=Bc.prototype.close;var hs=class extends Bc{constructor(){super(...arguments),this.H=48e3}V(e){this.H=e}};function c3(e){let t={classifications:ol(e,e3).map(r=>function(i,o=-1,n=""){return{categories:i.map(s=>{var a=Ar(jt(s,1))??0??-1;let c=s.l,l=D(c),d=cr(c,l,2),u=co(d);return u!=null&&u!==d&&Q(c,l,2,u),{index:a,score:u??0??0,categoryName:Er(jt(s,3))??""??"",displayName:Er(jt(s,4))??""??""}}),headIndex:o,headName:n}}(lt(r,Ef,4)?.g()??[],Ar(jt(r,2))??0,Er(jt(r,3))??""))};return Dc(e)!=null&&(t.timestampMs=$m(Dc(e))),t}hs.prototype.setDefaultSampleRate=hs.prototype.V;var Ze=class extends hs{constructor(e,t){super(new Rf(e,t)),this.m=[],dt(e=this.i=new xf,0,1,t=new us)}get baseOptions(){return lt(this.i,us,1)}set baseOptions(e){dt(this.i,0,1,e)}s(e){var t=this.i,r=lt(this.i,Oc,2);if(r=r?Um(r):new Oc,e.displayNamesLocale!==void 0?fe(r,1,os(e.displayNamesLocale)):e.displayNamesLocale===void 0&&fe(r,1),e.maxResults!==void 0){var i=e.maxResults;if(i!=null){if(typeof i!="number"||!Number.isFinite(i))throw qp();i|=0}fe(r,2,i)}else"maxResults"in e&&fe(r,2);if(e.scoreThreshold!==void 0){if((i=e.scoreThreshold)!=null&&typeof i!="number")throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);fe(r,3,i)}else"scoreThreshold"in e&&fe(r,3);return e.categoryAllowlist!==void 0?Kp(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&fe(r,4),e.categoryDenylist!==void 0?Kp(r,5,e.categoryDenylist):"categoryDenylist"in e&&fe(r,5),dt(t,0,2,r),Of(this,e)}R(e,t){return this.G(e,t??this.H,this.u+1)}G(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),[...this.m]}I(){var e=new ls;Pe(e,10,"audio_in"),Pe(e,10,"sample_rate"),Pe(e,15,"timestamped_classifications");let t=new bf;Xm(t,Z0,this.i);let r=new _s;zm(r,os("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Pe(r,3,"AUDIO:audio_in"),Pe(r,3,"SAMPLE_RATE:sample_rate"),Pe(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.s(t),qm(e,r),this.g.attachProtoVectorListener("timestamped_classifications",(i,o)=>{(function(n,s){s.forEach(a=>{a=r3(a),n.m.push(c3(a))})})(this,i),ni(this,o)}),this.g.attachEmptyPacketListener("timestamped_classifications",i=>{ni(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function lm(e){return{embeddings:ol(e,o3).map(t=>{let r={headIndex:Ar(jt(t,3))??0??-1,headName:Er(jt(t,4))??""??""};if(Hm(t,Fc,Sc(t,1))!==void 0){var i=void 0;t=lt(t,Fc,Sc(t,1)).l;let a=D(t),c=2&a?1:2;i=!!i;let l=jm(t,a);var o=oe(l);if(!(4&o)){(4&o||Object.isFrozen(l))&&(l=je(l),o=_r(o,a,i),a=Q(t,a,1,l));for(var n=0,s=0;n<l.length;n++){let d=co(l[n]);d!=null&&(l[s++]=d)}s<n&&(l.length=s),o=me(o=Vm(o,a,i),20,!0),o=me(o,4096,!1),o=me(o,8192,!1),Z(l,o),2&o&&Object.freeze(l)}eo(o)||(n=o,(s=c===1)?o=me(o,2,!0):i||(o=me(o,32,!1)),o!==n&&Z(l,o),s&&Object.freeze(l)),c===2&&eo(o)&&(l=je(l),o=_r(o,a,i),Z(l,o),Q(t,a,1,l)),r.floatEmbedding=l}else i=new Uint8Array(0),r.quantizedEmbedding=lt(t,i3,Sc(t,2))?.O()?.P()??i;return r}),timestampMs:$m(Dc(e))}}Ze.prototype.classify=Ze.prototype.R,Ze.prototype.setOptions=Ze.prototype.s,Ze.createFromModelPath=function(e,t){return Df(Ze,e,{baseOptions:{modelAssetPath:t}})},Ze.createFromModelBuffer=function(e,t){return ro(Ze,e,{baseOptions:{modelAssetBuffer:t}})},Ze.createFromOptions=function(e,t){return ro(Ze,e,t)};var _t=class extends hs{constructor(e,t){super(new Rf(e,t)),this.m=[],dt(e=this.i=new Cf,0,1,t=new us)}get baseOptions(){return lt(this.i,us,1)}set baseOptions(e){dt(this.i,0,1,e)}s(e){var t=this.i,r=lt(this.i,im,2);return r=r?Um(r):new im,e.l2Normalize!==void 0?fe(r,1,$p(e.l2Normalize)):"l2Normalize"in e&&fe(r,1),e.quantize!==void 0?fe(r,2,$p(e.quantize)):"quantize"in e&&fe(r,2),dt(t,0,2,r),Of(this,e)}S(e,t){return this.G(e,t??this.H,this.u+1)}G(e,t,r){return this.g.addDoubleToStream(t,"sample_rate",r),this.g.addAudioToStreamWithShape(e,1,e.length,"audio_in",r),this.m=[],this.finishProcessing(),this.m}I(){var e=new ls;Pe(e,10,"audio_in"),Pe(e,10,"sample_rate"),Pe(e,15,"embeddings_out"),Pe(e,15,"timestamped_embeddings_out");let t=new bf;Xm(t,Q0,this.i);let r=new _s;zm(r,os("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Pe(r,3,"AUDIO:audio_in"),Pe(r,3,"SAMPLE_RATE:sample_rate"),Pe(r,4,"EMBEDDINGS:embeddings_out"),Pe(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.s(t),qm(e,r),this.g.attachProtoListener("embeddings_out",(i,o)=>{i=om(i),this.m.push(lm(i)),ni(this,o)}),this.g.attachEmptyPacketListener("embeddings_out",i=>{ni(this,i)}),this.g.attachProtoVectorListener("timestamped_embeddings_out",(i,o)=>{for(let n of i)i=om(n),this.m.push(lm(i));ni(this,o)}),this.g.attachEmptyPacketListener("timestamped_embeddings_out",i=>{ni(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Kn;_t.prototype.embed=_t.prototype.S,_t.prototype.setOptions=_t.prototype.s,_t.createFromModelPath=function(e,t){return ro(_t,e,{baseOptions:{modelAssetPath:t}})},_t.createFromModelBuffer=function(e,t){return ro(_t,e,{baseOptions:{modelAssetBuffer:t}})},_t.createFromOptions=function(e,t){return ro(_t,e,t)};var l3=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 Ff(){if(Kn===void 0)try{await WebAssembly.instantiate(l3),Kn=!0}catch{Kn=!1}return Kn}async function Ac(e,t=""){let r=await Ff()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var si=class{};si.forVisionTasks=function(e){return Ac("vision",e)},si.forTextTasks=function(e){return Ac("text",e)},si.forAudioTasks=function(e){return Ac("audio",e)},si.isSimdSupported=function(){return Ff()};var xs=class{constructor(t,r,i,o,n,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.examStartTime=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=i,this.cameraRecorder=o,this.onRealtimeAlertsCallback=n,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Lt(this.proctoringId,this.backend))}async startRecording(){this.examStartTime=Date.now(),await this.createAudioClassifier(),this.audioRecorder=new qn(void 0,this.paramsConfig.audioBehaviourParameters),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new ir(this.cameraRecorder.cameraStream),this.volumeMeter.start().catch(i=>{console.log(i),this.volumeMeter=void 0}));let t=this.paramsConfig.audioBehaviourParameters?.noiseLimit||40,r=this.volumeMeter?.getVolume()||0;this.isSpeech=this.isSpeech||this.hasDesiredResult(this.audioClassificationResult),!this.isSpeech&&!this.recordingInProgress&&(t=t+t*.25),r>=t&&!this.recordingInProgress?(this.recordingInProgress=!0,this.audioRecorder.startRecording(),this.recordingStartTime=Date.now()-this.examStartTime):r<t&&this.recordingInProgress&&(Date.now()-this.recordingStartTime>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({status:"ALERT",description:"Fala detectada",type:"audio_detection_on_stream"}),this.recordingInProgress=!1,this.recordIndex++,this.countLoopTimes=0,this.isSpeech=!1),this.countLoopTimes++)}async stopSoundRecord(){if(this.audioRecorder.stopRecording&&await this.audioRecorder.stopRecording(),this.recordingEndTime=Date.now()-this.examStartTime,this.optionsProctoring.proctoringType!=="REALTIME")return;let t=new File(this.audioRecorder.blobs,`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.webm`,{type:"audio/webm"});this.uploadRecord(t),this.audioRecorder.blobs=[]}download(t){let r=URL.createObjectURL(t),i=document.createElement("a");document.body.appendChild(i),i.style.display="none",i.href=r,i.download=t.name,i.click(),window.URL.revokeObjectURL(r)}uploadRecord(t){t&&this.upload&&this.backendToken&&this.upload.upload({file:t},this.backendToken)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let i=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return i;let o=parseFloat(r.score)>.22;if(i&&o)return!0}return!1}async createAudioClassifier(){let t=await si.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await Ze.createFromOptions(t,{scoreThreshold:.15,maxResults:1,baseOptions:{modelAssetPath:"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"}})}async streamingAudioClassification(){this.context=new AudioContext({sampleRate:16e3});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([d3],{type:"text/javascript"})))}catch{throw new Error("\u274C Error loading audio worklet module")}let t=this.context.createMediaStreamSource(this.cameraRecorder.cameraStream);this.audioWorkletNode=new AudioWorkletNode(this.context,"audio-processor"),this.audioWorkletNode.port.onmessage=r=>{let i=r.data,n=this.audioClassifier.classify(i)[0].classifications[0].categories;n.length>0&&(this.audioClassificationResult=[{name:n[0].categoryName,score:n[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},d3=`
237
237
  class AudioProcessor extends AudioWorkletProcessor {
238
238
  bufferSize;
239
239
  inputBuffer;
@@ -270,7 +270,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),n.setAttribute("class","che
270
270
  }
271
271
 
272
272
  registerProcessor("audio-processor", AudioProcessor);
273
- `;var ys=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t}async startRecording(){this.startTime=new Date(Date.now());let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:i,onBufferSizeErrorCallback:o}=this.options,n={video:{cursor:"always",width:854,height:480,displaySurface:"monitor"},audio:!1};this.screenStream=await navigator.mediaDevices.getDisplayMedia(n);let s=this.screenStream.getVideoTracks();if(s[0].onended=i,navigator.userAgent.indexOf("Firefox")>-1){let m=s.find(h=>h.label=="");if(m&&t||m&&!r)throw Cn}let c=s.find(m=>["screen:0:0","Primary Monitor"].includes(m.label))!=null,l=s.find(m=>["screen:0:0","Primary Monitor",""].includes(m.label)||["screen:"].some(h=>m.label.includes(h)))!=null,u=s.find(m=>["web-contents-media-stream","window"].some(h=>m.label.includes(h)))!=null;if(!c&&t)throw s.forEach(m=>{m.stop()}),ap;if(!l||u)throw s.forEach(m=>{m.stop()}),cp;let{startRecording:d,stopRecording:f}=mr(this.screenStream,this.blobs,this.proctoringId,this.options.onBufferSizeError,o);this.recordingStart=d,this.recordingStop=f,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_screen_0.webm`,{type:"video/webm"}),origin:"Screen"})}};var so=class{constructor(t,r){this.dbName="EasyProctorDb";this.dbVersion=2;this.storeName="exams2";this.dbName=t,this.storeName=r}async save(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.delete(t),r)}async get(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.get(t),r).catch(()=>{})}async list(){let{transaction:t,store:r}=await this.connectToStore("readonly");return this.processRequest(r.getAll(),t)}async clear(){let{transaction:t,store:r}=await this.connectToStore("readwrite");return this.processRequest(r.clear(),t)}async processRequest(t,r){return new Promise((i,o)=>{t.onerror=n=>{o(t.error?.message)},t.onsuccess=n=>{r.commit(),i(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let o=(await this.connect()).result.transaction(this.storeName,t),n=o.objectStore(this.storeName);return{transaction:o,store:n}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let i=window.indexedDB.open(this.dbName,this.dbVersion);i.onerror=o=>{r("Can't connect to IndexedDB")},i.onupgradeneeded=o=>{let n=i.result;n.onerror=s=>{},n.createObjectStore(this.storeName,{keyPath:"id"})},i.onsuccess=o=>{this.connection=i,t(i)}})}};function Em(){let e=navigator.userAgent,t;return e.match(/chrome|chromium|crios/i)?t="chrome":e.match(/firefox|fxios/i)?t="firefox":e.match(/safari/i)?t="safari":e.match(/opr\//i)?t="opera":e.match(/edg/i)?t="edge":t="No browser detection",t}function _m(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function ao(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var vs=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new Jr}async login(){let t=await this.capturePhoto.takePicture("Login com biometria facial","Encaixe seu rosto no formato e clique no bot\xE3o abaixo",{width:1280,height:720});return this.loading(),new Promise((r,i)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(o=>{this.token=o.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(o=>{console.log(o),document.querySelector("#authLoader")?.remove(),i(o)})})}loading(){let t=document.createElement("div");t.setAttribute("id","authLoader"),t.style.backgroundColor="rgba(0,0,0,0.4)",t.style.zIndex="1000",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.height="100vh",t.style.width="100%",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center";let r=document.createElement("div");r.setAttribute("class","loader"),t.appendChild(r),document.body.appendChild(t);let i=`
273
+ `;var Cs=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.options=t}setProctoringId(t){this.proctoringId=t,Un(t)}async startRecording(){this.startTime=new Date(Date.now());let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:i,onBufferSizeErrorCallback:o}=this.options,n={video:{cursor:"always",width:854,height:480,displaySurface:"monitor"},audio:!1};this.screenStream=await navigator.mediaDevices.getDisplayMedia(n);let s=this.screenStream.getVideoTracks();if(s[0].onended=i,navigator.userAgent.indexOf("Firefox")>-1){let f=s.find(h=>h.label=="");if(f&&t||f&&!r)throw Ln}let c=s.find(f=>["screen:0:0","Primary Monitor"].includes(f.label))!=null,l=s.find(f=>["screen:0:0","Primary Monitor",""].includes(f.label)||["screen:"].some(h=>f.label.includes(h)))!=null,d=s.find(f=>["web-contents-media-stream","window"].some(h=>f.label.includes(h)))!=null;if(!c&&t)throw s.forEach(f=>{f.stop()}),vp;if(!l||d)throw s.forEach(f=>{f.stop()}),bp;let{startRecording:u,stopRecording:m}=vr(this.screenStream,this.blobs,this.options.onBufferSizeError,o);this.recordingStart=u,this.recordingStop=m,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop()}async saveOnSession(t){t.addRecording({device:"",file:new File(this.blobs,`EP_${t.id}_screen_0.webm`,{type:"video/webm"}),origin:"Screen"})}};var ho=class{constructor(t,r){this.dbName="EasyProctorDb";this.dbVersion=2;this.storeName="exams2";this.dbName=t,this.storeName=r}async save(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.delete(t),r)}async get(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:i}=await this.connectToStore("readwrite");return this.processRequest(i.get(t),r).catch(()=>{})}async list(){let{transaction:t,store:r}=await this.connectToStore("readonly");return this.processRequest(r.getAll(),t)}async clear(){let{transaction:t,store:r}=await this.connectToStore("readwrite");return this.processRequest(r.clear(),t)}async processRequest(t,r){return new Promise((i,o)=>{t.onerror=n=>{o(t.error?.message)},t.onsuccess=n=>{r.commit(),i(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let o=(await this.connect()).result.transaction(this.storeName,t),n=o.objectStore(this.storeName);return{transaction:o,store:n}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let i=window.indexedDB.open(this.dbName,this.dbVersion);i.onerror=o=>{r("Can't connect to IndexedDB")},i.onupgradeneeded=o=>{let n=i.result;n.onerror=s=>{},n.createObjectStore(this.storeName,{keyPath:"id"})},i.onsuccess=o=>{this.connection=i,t(i)}})}};function Bf(){let e=navigator.userAgent,t;return e.match(/chrome|chromium|crios/i)?t="chrome":e.match(/firefox|fxios/i)?t="firefox":e.match(/safari/i)?t="safari":e.match(/opr\//i)?t="opera":e.match(/edg/i)?t="edge":t="No browser detection",t}function Mf(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}function po(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}var Ts=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new ti}async login(){let t=await this.capturePhoto.takePicture("Login com biometria facial","Encaixe seu rosto no formato e clique no bot\xE3o abaixo",{width:1280,height:720});return this.loading(),new Promise((r,i)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(o=>{this.token=o.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(o=>{console.log(o),document.querySelector("#authLoader")?.remove(),i(o)})})}loading(){let t=document.createElement("div");t.setAttribute("id","authLoader"),t.style.backgroundColor="rgba(0,0,0,0.4)",t.style.zIndex="1000",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.height="100vh",t.style.width="100%",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center";let r=document.createElement("div");r.setAttribute("class","loader"),t.appendChild(r),document.body.appendChild(t);let i=`
274
274
  .loader {
275
275
  border: 6px solid #f3f3f3;
276
276
  border-radius: 50%;
@@ -291,17 +291,17 @@ registerProcessor("audio-processor", AudioProcessor);
291
291
  0% { transform: rotate(0deg); }
292
292
  100% { transform: rotate(360deg); }
293
293
  }
294
- `,o=document.createElement("style");o.innerHTML=i,document.head.appendChild(o)}};var bs=class{constructor(t){this.context=t;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onFocusCallback=()=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=t=>{};this.onBufferSizeErrorCallback=()=>{};this.backend=new Kr({type:t.type||"prod",token:t.token}),this.repository=new so("EasyProctorDb","exams2"),this.repositoryDevices=new so("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new vs(this.context.credentials.cpf,this.backend))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=()=>{R.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),t()}}setOnLostFocusCallback(t){this.onLostFocusCallback=()=>t()}setOnFocusCallback(t){this.onFocusCallback=()=>t()}async onChangeDevices(t={}){new Dn(this.repositoryDevices,this.proctoringId).startRecording(t),this.onChangeDevicesCallback=i=>t.status&&t.status(i)}async onRealtimeAlerts(t={}){this.onRealtimeAlertsCallback=r=>t.data&&t.data(r)}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=()=>t()}createRecorders(t=at){this.onChangeDevices();let r=new Mt({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback(),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),i=this.sessionOptions.captureScreen?new ys({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,o=new Bn({onFocusCallback:()=>this.onFocusCallback(),onLostFocusCallback:()=>this.onLostFocusCallback()},t),n=new gs(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,i,o].filter(Boolean);return s.push(n),this.recorder=new Fn(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:i,alertRecorder:o,noiseRecorder:n}}async login(){if(!this.context.credentials?.cpf)throw fp;this.context.token=await this.auth.login()}async start(t=at,r={}){try{if(this.context.token===void 0)throw pp;this.extension=new On,this.extension.addEventListener();let i=this.backend.selectBaseUrl(this.context.type),o=await tt();if(await this.repositoryDevices.save({...o,id:"devices"}),this.sessionOptions={...at,...t},this.videoOptions=dn(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions),this.state!="Stop")throw lp;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Tn,this.allRecorders=this.createRecorders(this.sessionOptions),await this.recorder.startAll();let n=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions.proctoringType,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=n.id,this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId),await this.repository.save(this.proctoringSession);let s={};for(let a in navigator)s[a]=navigator[a];return R.registerStart(this.proctoringId,!0,`Version: ${ao()}
295
- Navigator: ${JSON.stringify(s)}`),n.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(n.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording",n}catch(i){throw await this.cancel(),this.proctoringId&&R.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
296
- Version: ${ao()}
294
+ `,o=document.createElement("style");o.innerHTML=i,document.head.appendChild(o)}};var Ps=class{constructor(t){this.context=t;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{frames:40,useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onLostFocusCallback=()=>{};this.onFocusCallback=()=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=t=>{};this.onBufferSizeErrorCallback=t=>{};this.backend=new Et({type:t.type||"prod",token:t.token}),this.repository=new ho("EasyProctorDb","exams2"),this.repositoryDevices=new ho("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new Ts(this.context.credentials.cpf,this.backend))}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=()=>{I.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),t()}}setOnLostFocusCallback(t){this.onLostFocusCallback=()=>t()}setOnFocusCallback(t){this.onFocusCallback=()=>t()}async onChangeDevices(t={}){new Gn(this.repositoryDevices,this.proctoringId).startRecording(t),this.onChangeDevicesCallback=i=>t.status&&t.status(i)}async onRealtimeAlerts(t={}){this.onRealtimeAlertsCallback=r=>t.data&&t.data(r)}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}createRecorders(t=Ye){this.onChangeDevices();let r=new Nt({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),i=this.sessionOptions.captureScreen?new Cs({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,o=new Wn({onFocusCallback:()=>this.onFocusCallback(),onLostFocusCallback:()=>this.onLostFocusCallback()},t),n=new xs(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,i,o].filter(Boolean);return s.push(n),this.recorder=new Hn(this.proctoringSession,s),{cameraRecorder:r,screenRecorder:i,alertRecorder:o,noiseRecorder:n}}async login(){if(!this.context.credentials?.cpf)throw _p;this.context.token=await this.auth.login()}async start(t=Ye,r={}){try{if(this.context.token===void 0)throw Ap;this.extension=new zn,this.extension.addEventListener();let i=this.backend.selectBaseUrl(this.context.type),o=await it();await this.repositoryDevices.save({...o,id:"devices"}),this.sessionOptions={...Ye,...t},this.videoOptions=Bn(r),await this.initConfig(t.useGeolocation),await this.verifyBrowser(),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw xp}if(this.state!="Stop")throw wp;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new yr,this.allRecorders=this.createRecorders(this.sessionOptions),await this.recorder.startAll();let n=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions.proctoringType,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=n.id,this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId),t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let a in navigator)s[a]=navigator[a];return I.registerStart(this.proctoringId,!0,`Version: ${po()}
295
+ Navigator: ${JSON.stringify(s)}`),n.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(n.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording",n}catch(i){throw await this.cancel(),this.proctoringId&&I.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
296
+ Version: ${po()}
297
297
  Navigator: ${navigator}
298
- Error: ${i}`),this.state="Stop",i}}async cancel(){(this.state==="Recording"||this.state==="Starting")&&await this.recorder.stopAll(),this.state="Stop"}async finish(t={}){try{if(this.extension.options=t,this.state!=="Recording")throw Pn;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession);let r,i;ao()!=="1.0.0.0"?(r=new Zr(this.proctoringSession,this.proctoringId,[new Yr(this.proctoringId)]),i="Download",this.serviceType="Download"):(r=new Zr(this.proctoringSession,this.proctoringId,[new Bt(this.proctoringId,this.backend),new Yr(this.proctoringId)]),i="Upload",this.serviceType="Upload");let o=!1;this.extension.hasExtension&&await this.extension.start().then(n=>{o=n}).catch(n=>{o=!1}),(!o||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async n=>{R.registerUpload(this.proctoringSession.id,!1,`upload error: ${n}
298
+ Error: ${i}`),this.state="Stop",i}}async cancel(){(this.state==="Recording"||this.state==="Starting")&&(await this.recorder.stopAll(),this.spyCam&&await this.spyCam.stopCheckSpyCam()),this.state="Stop"}async finish(t={}){try{if(this.extension.options=t,this.state!=="Recording")throw Nn;await this.recorder.stopAll(),this.spyCam&&this.spyCam.stopCheckSpyCam(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession);let r,i;po()!=="1.0.0.0"?(r=new ii(this.proctoringSession,this.proctoringId,[new ri(this.proctoringId)]),i="Download",this.serviceType="Download"):(r=new ii(this.proctoringSession,this.proctoringId,[new Lt(this.proctoringId,this.backend),new ri(this.proctoringId)]),i="Upload",this.serviceType="Upload");let o=!1;this.extension.hasExtension&&await this.extension.start().then(n=>{o=n}).catch(n=>{o=!1}),(!o||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async n=>{I.registerUpload(this.proctoringSession.id,!1,`upload error: ${n}
299
299
 
300
- Upload Services: ${i}`,this.serviceType),ao()!=="1.0.0.0"&&(r=new Zr(this.proctoringSession,this.proctoringId,[new Bt(this.proctoringId,this.backend),new Yr(this.proctoringId)]),i="Upload",this.serviceType="Upload",i="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{R.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
300
+ Upload Services: ${i}`,this.serviceType),po()!=="1.0.0.0"&&(r=new ii(this.proctoringSession,this.proctoringId,[new Lt(this.proctoringId,this.backend),new ri(this.proctoringId)]),i="Upload",this.serviceType="Upload",i="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{I.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
301
301
 
302
302
  Upload Services: ${i}
303
- Upload backup for Safe Browser`,this.serviceType)}))}),R.registerUpload(this.proctoringSession.id,!0,`upload success
303
+ Upload backup for Safe Browser`,this.serviceType)}))}),I.registerUpload(this.proctoringSession.id,!0,`upload success
304
304
 
305
- Upload Services: ${i}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveScreenAlerts(this.context,this.proctoringSession).catch(n=>{R.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+n)}),await this.backend.finishAndSendUrls(this.context,this.proctoringSession).then(()=>{R.registerFinish(this.proctoringSession.id,!0,"")}).catch(n=>{R.registerFinish(this.proctoringSession.id,!1,"finish error: "+n)}),this.state="Stop"}catch(r){throw await this.cancel(),R.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
306
- Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Eo())throw R.registerError(this.proctoringId,"Multiplas telas detectadas!"),Cn}async verifyBrowser(){let t=await Em();if(t!=="chrome"&&t!=="firefox")throw R.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
307
- Tentativa utilizando o browser ${t}`),hp}async initConfig(t){try{let r=await this.backend.getParamsConfig(this.context);this.paramsConfig={...this.paramsConfig,...r,audioBehaviourParameters:{...this.paramsConfig.audioBehaviourParameters,...r.audioBehaviourParameters},imageBehaviourParameters:{...this.paramsConfig.imageBehaviourParameters,...r.imageBehaviourParameters},videoBehaviourParameters:{...this.paramsConfig.videoBehaviourParameters,...r.videoBehaviourParameters}},t&&(this.geolocation=await _m().then(i=>i).catch(i=>{throw i.message})),sp(this.backend)}catch(r){throw this.proctoringId&&R.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(i=>{R.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel requisitar a data do servidor!")});return t?new Date(t.toString()):new Date}async pause(){if(this.state!=="Recording")throw R.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),Pn;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw Pn;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state="Recording",{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}};function Zc(e,t="prod"){e.showConsole||(console.log=()=>{},console.warn=()=>{},console.error=()=>{});let r=new bs({type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole}),i=new $i({type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole}),o=new Jr,n=r.login.bind(r),s=r.start.bind(r),a=r.finish.bind(r),c=r.pause.bind(r),l=r.resume.bind(r),u=r.setOnFocusCallback.bind(r),d=r.setOnLostFocusCallback.bind(r),f=r.onChangeDevices.bind(r),m=r.setOnBufferSizeErrorCallback.bind(r),h=r.setOnStopSharingScreenCallback.bind(r),g=r.onRealtimeAlerts.bind(r),y=i.checkDevices.bind(i),_=i.runCheckDevicesFlow.bind(i),v=i.changeSelectedDevice.bind(i),T=o.takePicture.bind(o);return{login:n,start:s,finish:a,onFocus:u,onLostFocus:d,onChangeDevices:f,onBufferSizeError:m,onRealtimeAlerts:g,checkDevices:y,runCheckDevicesFlow:_,changeSelectedDevice:v,capturePhoto:T,enumarateDevices:tt,checkPermissions:ko,checkIfhasMultipleMonitors:Eo,onStopSharingScreen:h}}typeof window<"u"&&(window.useProctoring=Zc);})();
305
+ Upload Services: ${i}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(n=>{I.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+n)}),await this.backend.finishAndSendUrls(this.context,this.proctoringSession).then(()=>{I.registerFinish(this.proctoringSession.id,!0,"")}).catch(n=>{I.registerFinish(this.proctoringSession.id,!1,"finish error: "+n)}),this.state="Stop"}catch(r){throw await this.cancel(),I.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
306
+ Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Do())throw I.registerError(this.proctoringId,"Multiplas telas detectadas!"),Ln}async verifyBrowser(){let t=await Bf();if(t!=="chrome"&&t!=="firefox")throw I.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
307
+ Tentativa utilizando o browser ${t}`),Ep}async initConfig(t){try{let r=await this.backend.getParamsConfig(this.context);this.paramsConfig={...this.paramsConfig,...r,audioBehaviourParameters:{...this.paramsConfig.audioBehaviourParameters,...r.audioBehaviourParameters},imageBehaviourParameters:{...this.paramsConfig.imageBehaviourParameters,...r.imageBehaviourParameters},videoBehaviourParameters:{...this.paramsConfig.videoBehaviourParameters,...r.videoBehaviourParameters}},t&&(this.geolocation=await Mf().then(i=>i).catch(i=>{throw i.message})),yp(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new ei(this.context,{onRealtimeAlertsCallback:i=>this.onRealtimeAlertsCallback(i)}))}catch(r){throw this.proctoringId&&I.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(i=>{I.registerError(this.proctoringId,"N\xE3o foi poss\xEDvel requisitar a data do servidor!")});return t?new Date(t.toString()):new Date}async pause(){if(this.state!=="Recording")throw I.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),Nn;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw Nn;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state="Recording",{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}};var fo=class{constructor(t){this.backend=new Et({type:t?.type||"prod",token:t.token})}async signInTerms(){if(fo.isModalOpen)return Promise.reject();fo.isModalOpen=!0;try{let t=await this.openModal();return new Promise(r=>{r(t)})}catch(t){return this.closeModal(),Promise.reject(t)}}openModal(){return new Promise((t,r)=>{let i=document.createElement("div");i.setAttribute("id","signTermModal");let o={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"};this.applyStyles(i,o);let n=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(n,s);let a=document.createElement("h3");a.innerText="Termo de consentimento para coleta e uso de dados";let c={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"20px",marginBottom:"15px",padding:"20px 0px",borderBottom:"2px solid rgba(0, 0, 0, .1)",width:"100%",textAlign:"center"};this.applyStyles(a,c),n.appendChild(a);let l=document.createElement("iframe"),d="https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";this.backend.signTermUrl().then(rt=>{if(!rt)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",rt)}).catch(()=>{l.setAttribute("src",d)});let u={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,u),n.appendChild(l);let m=document.createElement("div"),f=document.createElement("input");f.setAttribute("type","checkbox"),f.setAttribute("id","termsCheckbox");let h=document.createElement("label");h.setAttribute("for","termsCheckbox"),h.innerText="Li e aceito os termos e condi\xE7\xF5es";let g={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(m,g),m.appendChild(f),m.appendChild(h),n.appendChild(m);let y=document.createElement("div"),v={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(y,v);let S=document.createElement("button");S.innerText="Cancelar";let x={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(S,x),S.addEventListener("click",()=>{this.closeModal(),t(!1)});let O=document.createElement("span"),ne={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(O,ne);let F=document.createElement("button");F.innerText="Continuar",F.setAttribute("id","confirmBtn");let go={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px",disabled:!0,cursor:"not-allowed"};this.applyStyles(F,go),F.disabled=!0,F.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),f.addEventListener("change",rt=>{F.disabled=!rt.target.checked,rt.target.checked?(F.style.color="#007bff",F.style.cursor="pointer"):(F.style.color="rgba(0, 0, 0, .7)",F.style.cursor="not-allowed")}),y.appendChild(S),y.appendChild(O),y.appendChild(F),n.appendChild(y),i.appendChild(n),document.body.appendChild(i)})}async closeModal(){fo.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[i,o]of Object.entries(r))t.style[i]=o}},mo=fo;mo.isModalOpen=!1;function cl(e,t="prod"){e.showConsole||(console.log=()=>{},console.warn=()=>{},console.error=()=>{});let r={type:t,clientId:e.clientId,examId:e.examId,token:e.token,credentials:e.credentials,showConsole:e.showConsole},i=new Ps(r),o=new Yi(r),n=new mo(r),s=new ti,a=i.login.bind(i),c=i.start.bind(i),l=i.finish.bind(i),d=i.pause.bind(i),u=i.resume.bind(i),m=i.setOnFocusCallback.bind(i),f=i.setOnLostFocusCallback.bind(i),h=i.onChangeDevices.bind(i),g=i.setOnBufferSizeErrorCallback.bind(i),y=i.setOnStopSharingScreenCallback.bind(i),v=i.onRealtimeAlerts.bind(i),S=n.signInTerms.bind(n),x=o.checkDevices.bind(o),O=o.runCheckDevicesFlow.bind(o),ne=o.changeSelectedDevice.bind(o),F=s.takePicture.bind(s);return{login:a,start:c,finish:l,onFocus:m,onLostFocus:f,onChangeDevices:h,onBufferSizeError:g,onRealtimeAlerts:v,checkDevices:x,runCheckDevicesFlow:O,changeSelectedDevice:ne,capturePhoto:F,enumarateDevices:it,checkPermissions:Ro,checkIfhasMultipleMonitors:Do,onStopSharingScreen:y,signInTerms:S}}typeof window<"u"&&(window.useProctoring=cl);})();