easyproctor-hml 2.7.5 → 2.7.7

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,26 +1,26 @@
1
- (()=>{var My=Object.create,Is=Object.defineProperty,Ny=Object.getPrototypeOf,jy=Object.prototype.hasOwnProperty,zy=Object.getOwnPropertyNames,Vy=Object.getOwnPropertyDescriptor;var Hy=e=>Is(e,"__esModule",{value:!0});var we=(e,t)=>()=>(t||(t={exports:{}},e(t.exports,t)),t.exports),Wy=(e,t)=>{for(var r in t)Is(e,r,{get:t[r],enumerable:!0})},$y=(e,t,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of zy(t))!jy.call(e,n)&&n!=="default"&&Is(e,n,{get:()=>t[n],enumerable:!(r=Vy(t,n))||r.enumerable});return e},Qc=e=>$y(Hy(Is(e!=null?My(Ny(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var v0=we((b0,sh)=>{(function(e){typeof b0=="object"&&typeof sh!="undefined"?sh.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:this).JSZip=e()})(function(){return function e(t,r,n){function i(a,c){if(!r[a]){if(!t[a]){var l=!1;if(!c&&l)return l(a,!0);if(o)return o(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var h=r[a]={exports:{}};t[a][0].call(h.exports,function(m){var f=t[a][1][m];return i(f||m)},h,h.exports,e,t,r,n)}return r[a].exports}for(var o=!1,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(s){for(var a,c,l,d,h,m,f,g=[],u=0,b=s.length,v=b,k=n.getTypeOf(s)!=="string";u<s.length;)v=b-u,l=k?(a=s[u++],c=u<b?s[u++]:0,u<b?s[u++]:0):(a=s.charCodeAt(u++),c=u<b?s.charCodeAt(u++):0,u<b?s.charCodeAt(u++):0),d=a>>2,h=(3&a)<<4|c>>4,m=1<v?(15&c)<<2|l>>6:64,f=2<v?63&l:64,g.push(o.charAt(d)+o.charAt(h)+o.charAt(m)+o.charAt(f));return g.join("")},r.decode=function(s){var a,c,l,d,h,m,f=0,g=0,u="data:";if(s.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var b,v=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===o.charAt(64)&&v--,s.charAt(s.length-2)===o.charAt(64)&&v--,v%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|v):new Array(0|v);f<s.length;)a=o.indexOf(s.charAt(f++))<<2|(d=o.indexOf(s.charAt(f++)))>>4,c=(15&d)<<4|(h=o.indexOf(s.charAt(f++)))>>2,l=(3&h)<<6|(m=o.indexOf(s.charAt(f++))),b[g++]=a,h!==64&&(b[g++]=c),m!==64&&(b[g++]=l);return b}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(c,l,d,h,m){this.compressedSize=c,this.uncompressedSize=l,this.crc32=d,this.compression=h,this.compressedContent=m}a.prototype={getContentWorker:function(){var c=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),l=this;return c.on("end",function(){if(this.streamInfo.data_length!==l.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(c,l,d){return c.pipe(new o).pipe(new s("uncompressedSize")).pipe(l.compressWorker(d)).pipe(new s("compressedSize")).withStreamInfo("compression",l)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=function(){for(var o,s=[],a=0;a<256;a++){o=a;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;s[a]=o}return s}();t.exports=function(o,s){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(a,c,l,d){var h=i,m=d+l;a^=-1;for(var f=d;f<m;f++)a=a>>>8^h[255&(a^c[f])];return-1^a}(0|s,o,o.length,0):function(a,c,l,d){var h=i,m=d+l;a^=-1;for(var f=d;f<m;f++)a=a>>>8^h[255&(a^c.charCodeAt(f))];return-1^a}(0|s,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise!="undefined"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=n?"uint8array":"array";function c(l,d){s.call(this,"FlateWorker/"+l),this._pako=null,this._pakoAction=l,this._pakoOptions=d,this.meta={}}r.magic="\b\0",o.inherits(c,s),c.prototype.processChunk=function(l){this.meta=l.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(a,l.data),!1)},c.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var l=this;this._pako.onData=function(d){l.push({data:d,meta:l.meta})}},r.compressWorker=function(l){return new c("Deflate",l)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(h,m){var f,g="";for(f=0;f<m;f++)g+=String.fromCharCode(255&h),h>>>=8;return g}function i(h,m,f,g,u,b){var v,k,S=h.file,I=h.compression,x=b!==a.utf8encode,B=o.transformTo("string",b(S.name)),P=o.transformTo("string",a.utf8encode(S.name)),M=S.comment,J=o.transformTo("string",b(M)),E=o.transformTo("string",a.utf8encode(M)),U=P.length!==S.name.length,y=E.length!==M.length,L="",ce="",V="",le=S.dir,H=S.date,se={crc32:0,compressedSize:0,uncompressedSize:0};m&&!f||(se.crc32=h.crc32,se.compressedSize=h.compressedSize,se.uncompressedSize=h.uncompressedSize);var D=0;m&&(D|=8),x||!U&&!y||(D|=2048);var R=0,te=0;le&&(R|=16),u==="UNIX"?(te=798,R|=function(G,xe){var Xe=G;return G||(Xe=xe?16893:33204),(65535&Xe)<<16}(S.unixPermissions,le)):(te=20,R|=function(G){return 63&(G||0)}(S.dosPermissions)),v=H.getUTCHours(),v<<=6,v|=H.getUTCMinutes(),v<<=5,v|=H.getUTCSeconds()/2,k=H.getUTCFullYear()-1980,k<<=4,k|=H.getUTCMonth()+1,k<<=5,k|=H.getUTCDate(),U&&(ce=n(1,1)+n(c(B),4)+P,L+="up"+n(ce.length,2)+ce),y&&(V=n(1,1)+n(c(J),4)+E,L+="uc"+n(V.length,2)+V);var q="";return q+=`
2
- \0`,q+=n(D,2),q+=I.magic,q+=n(v,2),q+=n(k,2),q+=n(se.crc32,4),q+=n(se.compressedSize,4),q+=n(se.uncompressedSize,4),q+=n(B.length,2),q+=n(L.length,2),{fileRecord:l.LOCAL_FILE_HEADER+q+B+L,dirRecord:l.CENTRAL_FILE_HEADER+n(te,2)+q+n(J.length,2)+"\0\0\0\0"+n(R,4)+n(g,4)+B+L+J}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function d(h,m,f,g){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=f,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,s),d.prototype.push=function(h){var m=h.meta.percent||0,f=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,s.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:f?(m+100*(f-g-1))/f:100}}))},d.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var m=this.streamFiles&&!h.file.dir;if(m){var f=i(h,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(h){this.accumulate=!1;var m=this.streamFiles&&!h.file.dir,f=i(h,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),m)this.push({data:function(g){return l.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var h=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var f=this.bytesWritten-h,g=function(u,b,v,k,S){var I=o.transformTo("string",S(k));return l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(u,2)+n(u,2)+n(b,4)+n(v,4)+n(I.length,2)+I}(this.dirRecords.length,f,h,this.zipComment,this.encodeFileName);this.push({data:g,meta:{percent:100}})},d.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},d.prototype.registerPrevious=function(h){this._sources.push(h);var m=this;return h.on("data",function(f){m.processChunk(f)}),h.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),h.on("error",function(f){m.error(f)}),this},d.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},d.prototype.error=function(h){var m=this._sources;if(!s.prototype.error.call(this,h))return!1;for(var f=0;f<m.length;f++)try{m[f].error(h)}catch(g){}return!0},d.prototype.lock=function(){s.prototype.lock.call(this);for(var h=this._sources,m=0;m<h.length;m++)h[m].lock()},t.exports=d},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(o,s,a){var c=new i(s.streamFiles,a,s.platform,s.encodeFileName),l=0;try{o.forEach(function(d,h){l++;var m=function(b,v){var k=b||v,S=n[k];if(!S)throw new Error(k+" is not a valid compression method !");return S}(h.options.compression,s.compression),f=h.options.compressionOptions||s.compressionOptions||{},g=h.dir,u=h.date;h._compressWorker(m,f).withStreamInfo("file",{name:d,dir:g,date:u,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.dosPermissions}).pipe(c)}),c.entriesCount=l}catch(d){c.error(d)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new n;for(var o in this)typeof this[o]!="function"&&(i[o]=this[o]);return i}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(i,o){return new n().loadAsync(i,o)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./external"),o=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(d){return new i.Promise(function(h,m){var f=d.decompressed.getContentWorker().pipe(new a);f.on("error",function(g){m(g)}).on("end",function(){f.streamInfo.crc32!==d.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}t.exports=function(d,h){var m=this;return h=n.extend(h||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),c.isNode&&c.isStream(d)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",d,!0,h.optimizedBinaryString,h.base64).then(function(f){var g=new s(h);return g.load(f),g}).then(function(f){var g=[i.Promise.resolve(f)],u=f.files;if(h.checkCRC32)for(var b=0;b<u.length;b++)g.push(l(u[b]));return i.Promise.all(g)}).then(function(f){for(var g=f.shift(),u=g.files,b=0;b<u.length;b++){var v=u[b],k=v.fileNameStr,S=n.resolve(v.fileNameStr);m.file(S,v.decompressed,{binary:!0,optimizedBinaryString:!0,date:v.date,dir:v.dir,comment:v.fileCommentStr.length?v.fileCommentStr:null,unixPermissions:v.unixPermissions,dosPermissions:v.dosPermissions,createFolders:h.createFolders}),v.dir||(m.file(S).unsafeOriginalName=k)}return g.zipComment.length&&(m.comment=g.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function o(s,a){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(a)}n.inherits(o,i),o.prototype._bindStream=function(s){var a=this;(this._stream=s).pause(),s.on("data",function(c){a.push({data:c,meta:{percent:0}})}).on("error",function(c){a.isPaused?this.generatedError=c:a.error(c)}).on("end",function(){a.isPaused?a._upstreamEnded=!0:a.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var n=e("readable-stream").Readable;function i(o,s,a){n.call(this,s),this._helper=o;var c=this;o.on("data",function(l,d){c.push(l)||c._helper.pause(),a&&a(d)}).on("error",function(l){c.emit("error",l)}).on("end",function(){c.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(n,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,i);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,i)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var i=new Buffer(n);return i.fill(0),i},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(e,t,r){"use strict";function n(S,I,x){var B,P=o.getTypeOf(I),M=o.extend(x||{},c);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(S=u(S)),M.createFolders&&(B=g(S))&&b.call(this,B,!0);var J=P==="string"&&M.binary===!1&&M.base64===!1;x&&x.binary!==void 0||(M.binary=!J),(I instanceof l&&I.uncompressedSize===0||M.dir||!I||I.length===0)&&(M.base64=!1,M.binary=!0,I="",M.compression="STORE",P="string");var E=null;E=I instanceof l||I instanceof s?I:m.isNode&&m.isStream(I)?new f(S,I):o.prepareContent(S,I,M.binary,M.optimizedBinaryString,M.base64);var U=new d(S,E,M);this.files[S]=U}var i=e("./utf8"),o=e("./utils"),s=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),d=e("./zipObject"),h=e("./generate"),m=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),g=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var I=S.lastIndexOf("/");return 0<I?S.substring(0,I):""},u=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},b=function(S,I){return I=I!==void 0?I:c.createFolders,S=u(S),this.files[S]||n.call(this,S,null,{dir:!0,createFolders:I}),this.files[S]};function v(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var I,x,B;for(I in this.files)B=this.files[I],(x=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&S(x,B)},filter:function(S){var I=[];return this.forEach(function(x,B){S(x,B)&&I.push(B)}),I},file:function(S,I,x){if(arguments.length!==1)return S=this.root+S,n.call(this,S,I,x),this;if(v(S)){var B=S;return this.filter(function(M,J){return!J.dir&&B.test(M)})}var P=this.files[this.root+S];return P&&!P.dir?P:null},folder:function(S){if(!S)return this;if(v(S))return this.filter(function(P,M){return M.dir&&S.test(P)});var I=this.root+S,x=b.call(this,I),B=this.clone();return B.root=x.name,B},remove:function(S){S=this.root+S;var I=this.files[S];if(I||(S.slice(-1)!=="/"&&(S+="/"),I=this.files[S]),I&&!I.dir)delete this.files[S];else for(var x=this.filter(function(P,M){return M.name.slice(0,S.length)===S}),B=0;B<x.length;B++)delete this.files[x[B].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var I,x={};try{if((x=o.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=x.type.toLowerCase(),x.compression=x.compression.toUpperCase(),x.type==="binarystring"&&(x.type="string"),!x.type)throw new Error("No output type specified.");o.checkSupport(x.type),x.platform!=="darwin"&&x.platform!=="freebsd"&&x.platform!=="linux"&&x.platform!=="sunos"||(x.platform="UNIX"),x.platform==="win32"&&(x.platform="DOS");var B=x.comment||this.comment||"";I=h.generateWorker(this,x,B)}catch(P){(I=new s("error")).error(P)}return new a(I,x.type||"string",x.mimeType)},generateAsync:function(S,I){return this.generateInternalStream(S).accumulate(I)},generateNodeStream:function(S,I){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(I)}};t.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o);for(var s=0;s<this.data.length;s++)o[s]=255&o[s]}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data[this.zero+o]},i.prototype.lastIndexOfSignature=function(o){for(var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),d=this.length-4;0<=d;--d)if(this.data[d]===s&&this.data[d+1]===a&&this.data[d+2]===c&&this.data[d+3]===l)return d-this.zero;return-1},i.prototype.readAndCheckSignature=function(o){var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),d=this.readData(4);return s===d[0]&&a===d[1]&&c===d[2]&&l===d[3]},i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var s,a=0;for(this.checkOffset(o),s=this.index+o-1;s>=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=o,a},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},i.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},i.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(l){var d=n.getTypeOf(l);return n.checkSupport(d),d!=="string"||i.uint8array?d==="nodebuffer"?new a(l):i.uint8array?new c(n.transformTo("uint8array",l)):new o(n.transformTo("array",l)):new s(l)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(s){n.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(o,n),o.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}n.inherits(o,i),o.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(c){a.dataIsReady=!0,a.data=c,a.max=c&&c.length||0,a.type=n.getTypeOf(c),a.isPaused||a._tickAndRepeat()},function(c){a.error(c)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,o){return this._listeners[i].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,o){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,o)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var o=this;return i.on("data",function(s){o.processChunk(s)}),i.on("end",function(){o.end()}),i.on("error",function(s){o.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,o){return this.extraStreamInfo[i]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(m){}function d(m,f){return new c.Promise(function(g,u){var b=[],v=m._internalType,k=m._outputType,S=m._mimeType;m.on("data",function(I,x){b.push(I),f&&f(x)}).on("error",function(I){b=[],u(I)}).on("end",function(){try{var I=function(x,B,P){switch(x){case"blob":return n.newBlob(n.transformTo("arraybuffer",B),P);case"base64":return s.encode(B);default:return n.transformTo(x,B)}}(k,function(x,B){var P,M=0,J=null,E=0;for(P=0;P<B.length;P++)E+=B[P].length;switch(x){case"string":return B.join("");case"array":return Array.prototype.concat.apply([],B);case"uint8array":for(J=new Uint8Array(E),P=0;P<B.length;P++)J.set(B[P],M),M+=B[P].length;return J;case"nodebuffer":return Buffer.concat(B);default:throw new Error("concat : unsupported type '"+x+"'")}}(v,b),S);g(I)}catch(x){u(x)}b=[]}).resume()})}function h(m,f,g){var u=f;switch(f){case"blob":case"arraybuffer":u="uint8array";break;case"base64":u="string"}try{this._internalType=u,this._outputType=f,this._mimeType=g,n.checkSupport(u),this._worker=m.pipe(new i(u)),m.lock()}catch(b){this._worker=new o("error"),this._worker.error(b)}}h.prototype={accumulate:function(m){return d(this,m)},on:function(m,f){var g=this;return m==="data"?this._worker.on(m,function(u){f.call(g,u.data,u.meta)}):this._worker.on(m,function(){n.delay(f,arguments,g)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:this._outputType!=="nodebuffer"},m)}},t.exports=h},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",r.nodebuffer=typeof Buffer!="undefined",r.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch(o){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch(s){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(o){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;a[254]=a[254]=1;function l(){s.call(this,"utf-8 decode"),this.leftOver=null}function d(){s.call(this,"utf-8 encode")}r.utf8encode=function(h){return i.nodebuffer?o.newBufferFrom(h,"utf-8"):function(m){var f,g,u,b,v,k=m.length,S=0;for(b=0;b<k;b++)(64512&(g=m.charCodeAt(b)))==55296&&b+1<k&&(64512&(u=m.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(u-56320),b++),S+=g<128?1:g<2048?2:g<65536?3:4;for(f=i.uint8array?new Uint8Array(S):new Array(S),b=v=0;v<S;b++)(64512&(g=m.charCodeAt(b)))==55296&&b+1<k&&(64512&(u=m.charCodeAt(b+1)))==56320&&(g=65536+(g-55296<<10)+(u-56320),b++),g<128?f[v++]=g:(g<2048?f[v++]=192|g>>>6:(g<65536?f[v++]=224|g>>>12:(f[v++]=240|g>>>18,f[v++]=128|g>>>12&63),f[v++]=128|g>>>6&63),f[v++]=128|63&g);return f}(h)},r.utf8decode=function(h){return i.nodebuffer?n.transformTo("nodebuffer",h).toString("utf-8"):function(m){var f,g,u,b,v=m.length,k=new Array(2*v);for(f=g=0;f<v;)if((u=m[f++])<128)k[g++]=u;else if(4<(b=a[u]))k[g++]=65533,f+=b-1;else{for(u&=b===2?31:b===3?15:7;1<b&&f<v;)u=u<<6|63&m[f++],b--;1<b?k[g++]=65533:u<65536?k[g++]=u:(u-=65536,k[g++]=55296|u>>10&1023,k[g++]=56320|1023&u)}return k.length!==g&&(k.subarray?k=k.subarray(0,g):k.length=g),n.applyFromCharCode(k)}(h=n.transformTo(i.uint8array?"uint8array":"array",h))},n.inherits(l,s),l.prototype.processChunk=function(h){var m=n.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=m;(m=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),m.set(f,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var g=function(b,v){var k;for((v=v||b.length)>b.length&&(v=b.length),k=v-1;0<=k&&(192&b[k])==128;)k--;return k<0||k===0?v:k+a[b[k]]>v?k:v}(m),u=m;g!==m.length&&(i.uint8array?(u=m.subarray(0,g),this.leftOver=m.subarray(g,m.length)):(u=m.slice(0,g),this.leftOver=m.slice(g,m.length))),this.push({data:r.utf8decode(u),meta:h.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=l,n.inherits(d,s),d.prototype.processChunk=function(h){this.push({data:r.utf8encode(h.data),meta:h.meta})},r.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(f){return f}function c(f,g){for(var u=0;u<f.length;++u)g[u]=255&f.charCodeAt(u);return g}e("setimmediate"),r.newBlob=function(f,g){r.checkSupport("blob");try{return new Blob([f],{type:g})}catch(b){try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return u.append(f),u.getBlob(g)}catch(v){throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(f,g,u){var b=[],v=0,k=f.length;if(k<=u)return String.fromCharCode.apply(null,f);for(;v<k;)g==="array"||g==="nodebuffer"?b.push(String.fromCharCode.apply(null,f.slice(v,Math.min(v+u,k)))):b.push(String.fromCharCode.apply(null,f.subarray(v,Math.min(v+u,k)))),v+=u;return b.join("")},stringifyByChar:function(f){for(var g="",u=0;u<f.length;u++)g+=String.fromCharCode(f[u]);return g},applyCanBeUsed:{uint8array:function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(f){return!1}}(),nodebuffer:function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch(f){return!1}}()}};function d(f){var g=65536,u=r.getTypeOf(f),b=!0;if(u==="uint8array"?b=l.applyCanBeUsed.uint8array:u==="nodebuffer"&&(b=l.applyCanBeUsed.nodebuffer),b)for(;1<g;)try{return l.stringifyByChunk(f,u,g)}catch(v){g=Math.floor(g/2)}return l.stringifyByChar(f)}function h(f,g){for(var u=0;u<f.length;u++)g[u]=f[u];return g}r.applyFromCharCode=d;var m={};m.string={string:a,array:function(f){return c(f,new Array(f.length))},arraybuffer:function(f){return m.string.uint8array(f).buffer},uint8array:function(f){return c(f,new Uint8Array(f.length))},nodebuffer:function(f){return c(f,o.allocBuffer(f.length))}},m.array={string:d,array:a,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(f)}},m.arraybuffer={string:function(f){return d(new Uint8Array(f))},array:function(f){return h(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:a,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(new Uint8Array(f))}},m.uint8array={string:d,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:a,nodebuffer:function(f){return o.newBufferFrom(f)}},m.nodebuffer={string:d,array:function(f){return h(f,new Array(f.length))},arraybuffer:function(f){return m.nodebuffer.uint8array(f).buffer},uint8array:function(f){return h(f,new Uint8Array(f.length))},nodebuffer:a},r.transformTo=function(f,g){if(g=g||"",!f)return g;r.checkSupport(f);var u=r.getTypeOf(g);return m[u][f](g)},r.resolve=function(f){for(var g=f.split("/"),u=[],b=0;b<g.length;b++){var v=g[b];v==="."||v===""&&b!==0&&b!==g.length-1||(v===".."?u.pop():u.push(v))}return u.join("/")},r.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(f)?"nodebuffer":n.uint8array&&f instanceof Uint8Array?"uint8array":n.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(f){if(!n[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(f){var g,u,b="";for(u=0;u<(f||"").length;u++)b+="\\x"+((g=f.charCodeAt(u))<16?"0":"")+g.toString(16).toUpperCase();return b},r.delay=function(f,g,u){setImmediate(function(){f.apply(u||null,g||[])})},r.inherits=function(f,g){function u(){}u.prototype=g.prototype,f.prototype=new u},r.extend=function(){var f,g,u={};for(f=0;f<arguments.length;f++)for(g in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],g)&&u[g]===void 0&&(u[g]=arguments[f][g]);return u},r.prepareContent=function(f,g,u,b,v){return s.Promise.resolve(g).then(function(k){return n.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader!="undefined"?new s.Promise(function(S,I){var x=new FileReader;x.onload=function(B){S(B.target.result)},x.onerror=function(B){I(B.target.error)},x.readAsArrayBuffer(k)}):k}).then(function(k){var S=r.getTypeOf(k);return S?(S==="arraybuffer"?k=r.transformTo("uint8array",k):S==="string"&&(v?k=i.decode(k):u&&b!==!0&&(k=function(I){return c(I,n.uint8array?new Uint8Array(I.length):new Array(I.length))}(k))),k):s.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./signature"),s=e("./zipEntry"),a=e("./support");function c(l){this.files=[],this.loadOptions=l}c.prototype={checkSignature:function(l){if(!this.reader.readAndCheckSignature(l)){this.reader.index-=4;var d=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(d)+", expected "+i.pretty(l)+")")}},isSignature:function(l,d){var h=this.reader.index;this.reader.setIndex(l);var m=this.reader.readString(4)===d;return this.reader.setIndex(h),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var l=this.reader.readData(this.zipCommentLength),d=a.uint8array?"uint8array":"array",h=i.transformTo(d,l);this.zipComment=this.loadOptions.decodeFileName(h)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var l,d,h,m=this.zip64EndOfCentralSize-44;0<m;)l=this.reader.readInt(2),d=this.reader.readInt(4),h=this.reader.readData(d),this.zip64ExtensibleData[l]={id:l,length:d,value:h}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var l,d;for(l=0;l<this.files.length;l++)d=this.files[l],this.reader.setIndex(d.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),d.readLocalPart(this.reader),d.handleUTF8(),d.processAttributes()},readCentralDir:function(){var l;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(l=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(l);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var l=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(l<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(l);var d=l;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(l=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(l),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var m=d-h;if(0<m)this.isSignature(d,o.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(l){this.reader=n(l)},load:function(l){this.prepareReader(l),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./compressedObject"),s=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function d(h,m){this.options=h,this.loadOptions=m}d.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var m,f;if(h.skip(22),this.fileNameLength=h.readInt(2),f=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=function(g){for(var u in c)if(Object.prototype.hasOwnProperty.call(c,u)&&c[u].magic===g)return c[u];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,m,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var m=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(m),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var m,f,g,u=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<u;)m=h.readInt(2),f=h.readInt(2),g=h.readData(f),this.extraFields[m]={id:m,length:f,value:g};h.setIndex(u)},handleUTF8:function(){var h=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var f=i.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var g=this.findExtraFieldUnicodeComment();if(g!==null)this.fileCommentStr=g;else{var u=i.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(u)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var m=n(h.value);return m.readInt(1)!==1||s(this.fileName)!==m.readInt(4)?null:a.utf8decode(m.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var m=n(h.value);return m.readInt(1)!==1||s(this.fileComment)!==m.readInt(4)?null:a.utf8decode(m.readData(h.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function n(m,f,g){this.name=m,this.dir=g.dir,this.date=g.date,this.comment=g.comment,this.unixPermissions=g.unixPermissions,this.dosPermissions=g.dosPermissions,this._data=f,this._dataBinary=g.binary,this.options={compression:g.compression,compressionOptions:g.compressionOptions}}var i=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),s=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");n.prototype={internalStream:function(m){var f=null,g="string";try{if(!m)throw new Error("No output type specified.");var u=(g=m.toLowerCase())==="string"||g==="text";g!=="binarystring"&&g!=="text"||(g="string"),f=this._decompressWorker();var b=!this._dataBinary;b&&!u&&(f=f.pipe(new s.Utf8EncodeWorker)),!b&&u&&(f=f.pipe(new s.Utf8DecodeWorker))}catch(v){(f=new c("error")).error(v)}return new i(f,g,"")},async:function(m,f){return this.internalStream(m).accumulate(f)},nodeStream:function(m,f){return this.internalStream(m||"nodebuffer").toNodejsStream(f)},_compressWorker:function(m,f){if(this._data instanceof a&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var g=this._decompressWorker();return this._dataBinary||(g=g.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(g,m,f)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new o(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],d=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<l.length;h++)n.prototype[l[h]]=d;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(n){"use strict";var i,o,s=n.MutationObserver||n.WebKitMutationObserver;if(s){var a=0,c=new s(m),l=n.document.createTextNode("");c.observe(l,{characterData:!0}),i=function(){l.data=a=++a%2}}else if(n.setImmediate||n.MessageChannel===void 0)i="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var f=n.document.createElement("script");f.onreadystatechange=function(){m(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},n.document.documentElement.appendChild(f)}:function(){setTimeout(m,0)};else{var d=new n.MessageChannel;d.port1.onmessage=m,i=function(){d.port2.postMessage(0)}}var h=[];function m(){var f,g;o=!0;for(var u=h.length;u;){for(g=h,h=[],f=-1;++f<u;)g[f]();u=h.length}o=!1}t.exports=function(f){h.push(f)!==1||o||i()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,t,r){"use strict";var n=e("immediate");function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(u){if(typeof u!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,u!==i&&f(this,u)}function d(u,b,v){this.promise=u,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof v=="function"&&(this.onRejected=v,this.callRejected=this.otherCallRejected)}function h(u,b,v){n(function(){var k;try{k=b(v)}catch(S){return o.reject(u,S)}k===u?o.reject(u,new TypeError("Cannot resolve promise with itself")):o.resolve(u,k)})}function m(u){var b=u&&u.then;if(u&&(typeof u=="object"||typeof u=="function")&&typeof b=="function")return function(){b.apply(u,arguments)}}function f(u,b){var v=!1;function k(x){v||(v=!0,o.reject(u,x))}function S(x){v||(v=!0,o.resolve(u,x))}var I=g(function(){b(S,k)});I.status==="error"&&k(I.value)}function g(u,b){var v={};try{v.value=u(b),v.status="success"}catch(k){v.status="error",v.value=k}return v}(t.exports=l).prototype.finally=function(u){if(typeof u!="function")return this;var b=this.constructor;return this.then(function(v){return b.resolve(u()).then(function(){return v})},function(v){return b.resolve(u()).then(function(){throw v})})},l.prototype.catch=function(u){return this.then(null,u)},l.prototype.then=function(u,b){if(typeof u!="function"&&this.state===a||typeof b!="function"&&this.state===s)return this;var v=new this.constructor(i);return this.state!==c?h(v,this.state===a?u:b,this.outcome):this.queue.push(new d(v,u,b)),v},d.prototype.callFulfilled=function(u){o.resolve(this.promise,u)},d.prototype.otherCallFulfilled=function(u){h(this.promise,this.onFulfilled,u)},d.prototype.callRejected=function(u){o.reject(this.promise,u)},d.prototype.otherCallRejected=function(u){h(this.promise,this.onRejected,u)},o.resolve=function(u,b){var v=g(m,b);if(v.status==="error")return o.reject(u,v.value);var k=v.value;if(k)f(u,k);else{u.state=a,u.outcome=b;for(var S=-1,I=u.queue.length;++S<I;)u.queue[S].callFulfilled(b)}return u},o.reject=function(u,b){u.state=s,u.outcome=b;for(var v=-1,k=u.queue.length;++v<k;)u.queue[v].callRejected(b);return u},l.resolve=function(u){return u instanceof this?u:o.resolve(new this(i),u)},l.reject=function(u){var b=new this(i);return o.reject(b,u)},l.all=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=u.length,k=!1;if(!v)return this.resolve([]);for(var S=new Array(v),I=0,x=-1,B=new this(i);++x<v;)P(u[x],x);return B;function P(M,J){b.resolve(M).then(function(E){S[J]=E,++I!==v||k||(k=!0,o.resolve(B,S))},function(E){k||(k=!0,o.reject(B,E))})}},l.race=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var v=u.length,k=!1;if(!v)return this.resolve([]);for(var S=-1,I=new this(i);++S<v;)x=u[S],b.resolve(x).then(function(B){k||(k=!0,o.resolve(I,B))},function(B){k||(k=!0,o.reject(I,B))});var x;return I}},{immediate:36}],38:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var n=e("./zlib/deflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,d=-1,h=0,m=8;function f(u){if(!(this instanceof f))return new f(u);this.options=i.assign({level:d,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},u||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var v=n.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(v!==l)throw new Error(s[v]);if(b.header&&n.deflateSetHeader(this.strm,b.header),b.dictionary){var k;if(k=typeof b.dictionary=="string"?o.string2buf(b.dictionary):c.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(v=n.deflateSetDictionary(this.strm,k))!==l)throw new Error(s[v]);this._dict_set=!0}}function g(u,b){var v=new f(b);if(v.push(u,!0),v.err)throw v.msg||s[v.err];return v.result}f.prototype.push=function(u,b){var v,k,S=this.strm,I=this.options.chunkSize;if(this.ended)return!1;k=b===~~b?b:b===!0?4:0,typeof u=="string"?S.input=o.string2buf(u):c.call(u)==="[object ArrayBuffer]"?S.input=new Uint8Array(u):S.input=u,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(I),S.next_out=0,S.avail_out=I),(v=n.deflate(S,k))!==1&&v!==l)return this.onEnd(v),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&v!==1);return k===4?(v=n.deflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===l):k!==2||(this.onEnd(l),!(S.avail_out=0))},f.prototype.onData=function(u){this.chunks.push(u)},f.prototype.onEnd=function(u){u===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},r.Deflate=f,r.deflate=g,r.deflateRaw=function(u,b){return(b=b||{}).raw=!0,g(u,b)},r.gzip=function(u,b){return(b=b||{}).gzip=!0,g(u,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),d=Object.prototype.toString;function h(f){if(!(this instanceof h))return new h(f);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},f||{});var g=this.options;g.raw&&0<=g.windowBits&&g.windowBits<16&&(g.windowBits=-g.windowBits,g.windowBits===0&&(g.windowBits=-15)),!(0<=g.windowBits&&g.windowBits<16)||f&&f.windowBits||(g.windowBits+=32),15<g.windowBits&&g.windowBits<48&&(15&g.windowBits)==0&&(g.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var u=n.inflateInit2(this.strm,g.windowBits);if(u!==s.Z_OK)throw new Error(a[u]);this.header=new l,n.inflateGetHeader(this.strm,this.header)}function m(f,g){var u=new h(g);if(u.push(f,!0),u.err)throw u.msg||a[u.err];return u.result}h.prototype.push=function(f,g){var u,b,v,k,S,I,x=this.strm,B=this.options.chunkSize,P=this.options.dictionary,M=!1;if(this.ended)return!1;b=g===~~g?g:g===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof f=="string"?x.input=o.binstring2buf(f):d.call(f)==="[object ArrayBuffer]"?x.input=new Uint8Array(f):x.input=f,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new i.Buf8(B),x.next_out=0,x.avail_out=B),(u=n.inflate(x,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&P&&(I=typeof P=="string"?o.string2buf(P):d.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,u=n.inflateSetDictionary(this.strm,I)),u===s.Z_BUF_ERROR&&M===!0&&(u=s.Z_OK,M=!1),u!==s.Z_STREAM_END&&u!==s.Z_OK)return this.onEnd(u),!(this.ended=!0);x.next_out&&(x.avail_out!==0&&u!==s.Z_STREAM_END&&(x.avail_in!==0||b!==s.Z_FINISH&&b!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(v=o.utf8border(x.output,x.next_out),k=x.next_out-v,S=o.buf2string(x.output,v),x.next_out=k,x.avail_out=B-k,k&&i.arraySet(x.output,x.output,v,k,0),this.onData(S)):this.onData(i.shrinkBuf(x.output,x.next_out)))),x.avail_in===0&&x.avail_out===0&&(M=!0)}while((0<x.avail_in||x.avail_out===0)&&u!==s.Z_STREAM_END);return u===s.Z_STREAM_END&&(b=s.Z_FINISH),b===s.Z_FINISH?(u=n.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===s.Z_OK):b!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(x.avail_out=0))},h.prototype.onData=function(f){this.chunks.push(f)},h.prototype.onEnd=function(f){f===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},r.Inflate=h,r.inflate=m,r.inflateRaw=function(f,g){return(g=g||{}).raw=!0,m(f,g)},r.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var n=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";r.assign=function(s){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var c=a.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}}return s},r.shrinkBuf=function(s,a){return s.length===a?s:s.subarray?s.subarray(0,a):(s.length=a,s)};var i={arraySet:function(s,a,c,l,d){if(a.subarray&&s.subarray)s.set(a.subarray(c,c+l),d);else for(var h=0;h<l;h++)s[d+h]=a[c+h]},flattenChunks:function(s){var a,c,l,d,h,m;for(a=l=0,c=s.length;a<c;a++)l+=s[a].length;for(m=new Uint8Array(l),a=d=0,c=s.length;a<c;a++)h=s[a],m.set(h,d),d+=h.length;return m}},o={arraySet:function(s,a,c,l,d){for(var h=0;h<l;h++)s[d+h]=a[c+h]},flattenChunks:function(s){return[].concat.apply([],s)}};r.setTyped=function(s){s?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(n)},{}],42:[function(e,t,r){"use strict";var n=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(l){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(l){o=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(l,d){if(d<65537&&(l.subarray&&o||!l.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(l,d));for(var h="",m=0;m<d;m++)h+=String.fromCharCode(l[m]);return h}s[254]=s[254]=1,r.string2buf=function(l){var d,h,m,f,g,u=l.length,b=0;for(f=0;f<u;f++)(64512&(h=l.charCodeAt(f)))==55296&&f+1<u&&(64512&(m=l.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(m-56320),f++),b+=h<128?1:h<2048?2:h<65536?3:4;for(d=new n.Buf8(b),f=g=0;g<b;f++)(64512&(h=l.charCodeAt(f)))==55296&&f+1<u&&(64512&(m=l.charCodeAt(f+1)))==56320&&(h=65536+(h-55296<<10)+(m-56320),f++),h<128?d[g++]=h:(h<2048?d[g++]=192|h>>>6:(h<65536?d[g++]=224|h>>>12:(d[g++]=240|h>>>18,d[g++]=128|h>>>12&63),d[g++]=128|h>>>6&63),d[g++]=128|63&h);return d},r.buf2binstring=function(l){return c(l,l.length)},r.binstring2buf=function(l){for(var d=new n.Buf8(l.length),h=0,m=d.length;h<m;h++)d[h]=l.charCodeAt(h);return d},r.buf2string=function(l,d){var h,m,f,g,u=d||l.length,b=new Array(2*u);for(h=m=0;h<u;)if((f=l[h++])<128)b[m++]=f;else if(4<(g=s[f]))b[m++]=65533,h+=g-1;else{for(f&=g===2?31:g===3?15:7;1<g&&h<u;)f=f<<6|63&l[h++],g--;1<g?b[m++]=65533:f<65536?b[m++]=f:(f-=65536,b[m++]=55296|f>>10&1023,b[m++]=56320|1023&f)}return c(b,m)},r.utf8border=function(l,d){var h;for((d=d||l.length)>l.length&&(d=l.length),h=d-1;0<=h&&(192&l[h])==128;)h--;return h<0||h===0?d:h+s[l[h]]>d?h:d}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,o,s){for(var a=65535&n|0,c=n>>>16&65535|0,l=0;o!==0;){for(o-=l=2e3<o?2e3:o;c=c+(a=a+i[s++]|0)|0,--l;);a%=65521,c%=65521}return a|c<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var n=function(){for(var i,o=[],s=0;s<256;s++){i=s;for(var a=0;a<8;a++)i=1&i?3988292384^i>>>1:i>>>1;o[s]=i}return o}();t.exports=function(i,o,s,a){var c=n,l=a+s;i^=-1;for(var d=a;d<l;d++)i=i>>>8^c[255&(i^o[d])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,d=4,h=0,m=-2,f=-1,g=4,u=2,b=8,v=9,k=286,S=30,I=19,x=2*k+1,B=15,P=3,M=258,J=M+P+1,E=42,U=113,y=1,L=2,ce=3,V=4;function le(p,N){return p.msg=c[N],N}function H(p){return(p<<1)-(4<p?9:0)}function se(p){for(var N=p.length;0<=--N;)p[N]=0}function D(p){var N=p.state,O=N.pending;O>p.avail_out&&(O=p.avail_out),O!==0&&(i.arraySet(p.output,N.pending_buf,N.pending_out,O,p.next_out),p.next_out+=O,N.pending_out+=O,p.total_out+=O,p.avail_out-=O,N.pending-=O,N.pending===0&&(N.pending_out=0))}function R(p,N){o._tr_flush_block(p,0<=p.block_start?p.block_start:-1,p.strstart-p.block_start,N),p.block_start=p.strstart,D(p.strm)}function te(p,N){p.pending_buf[p.pending++]=N}function q(p,N){p.pending_buf[p.pending++]=N>>>8&255,p.pending_buf[p.pending++]=255&N}function G(p,N){var O,_,w=p.max_chain_length,C=p.strstart,j=p.prev_length,z=p.nice_match,A=p.strstart>p.w_size-J?p.strstart-(p.w_size-J):0,$=p.window,K=p.w_mask,W=p.prev,re=p.strstart+M,Ee=$[C+j-1],pe=$[C+j];p.prev_length>=p.good_match&&(w>>=2),z>p.lookahead&&(z=p.lookahead);do if($[(O=N)+j]===pe&&$[O+j-1]===Ee&&$[O]===$[C]&&$[++O]===$[C+1]){C+=2,O++;do;while($[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&C<re);if(_=M-(re-C),C=re-M,j<_){if(p.match_start=N,z<=(j=_))break;Ee=$[C+j-1],pe=$[C+j]}}while((N=W[N&K])>A&&--w!=0);return j<=p.lookahead?j:p.lookahead}function xe(p){var N,O,_,w,C,j,z,A,$,K,W=p.w_size;do{if(w=p.window_size-p.lookahead-p.strstart,p.strstart>=W+(W-J)){for(i.arraySet(p.window,p.window,W,W,0),p.match_start-=W,p.strstart-=W,p.block_start-=W,N=O=p.hash_size;_=p.head[--N],p.head[N]=W<=_?_-W:0,--O;);for(N=O=W;_=p.prev[--N],p.prev[N]=W<=_?_-W:0,--O;);w+=W}if(p.strm.avail_in===0)break;if(j=p.strm,z=p.window,A=p.strstart+p.lookahead,$=w,K=void 0,K=j.avail_in,$<K&&(K=$),O=K===0?0:(j.avail_in-=K,i.arraySet(z,j.input,j.next_in,K,A),j.state.wrap===1?j.adler=s(j.adler,z,K,A):j.state.wrap===2&&(j.adler=a(j.adler,z,K,A)),j.next_in+=K,j.total_in+=K,K),p.lookahead+=O,p.lookahead+p.insert>=P)for(C=p.strstart-p.insert,p.ins_h=p.window[C],p.ins_h=(p.ins_h<<p.hash_shift^p.window[C+1])&p.hash_mask;p.insert&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[C+P-1])&p.hash_mask,p.prev[C&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=C,C++,p.insert--,!(p.lookahead+p.insert<P)););}while(p.lookahead<J&&p.strm.avail_in!==0)}function Xe(p,N){for(var O,_;;){if(p.lookahead<J){if(xe(p),p.lookahead<J&&N===l)return y;if(p.lookahead===0)break}if(O=0,p.lookahead>=P&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),O!==0&&p.strstart-O<=p.w_size-J&&(p.match_length=G(p,O)),p.match_length>=P)if(_=o._tr_tally(p,p.strstart-p.match_start,p.match_length-P),p.lookahead-=p.match_length,p.match_length<=p.max_lazy_match&&p.lookahead>=P){for(p.match_length--;p.strstart++,p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart,--p.match_length!=0;);p.strstart++}else p.strstart+=p.match_length,p.match_length=0,p.ins_h=p.window[p.strstart],p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+1])&p.hash_mask;else _=o._tr_tally(p,0,p.window[p.strstart]),p.lookahead--,p.strstart++;if(_&&(R(p,!1),p.strm.avail_out===0))return y}return p.insert=p.strstart<P-1?p.strstart:P-1,N===d?(R(p,!0),p.strm.avail_out===0?ce:V):p.last_lit&&(R(p,!1),p.strm.avail_out===0)?y:L}function ue(p,N){for(var O,_,w;;){if(p.lookahead<J){if(xe(p),p.lookahead<J&&N===l)return y;if(p.lookahead===0)break}if(O=0,p.lookahead>=P&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),p.prev_length=p.match_length,p.prev_match=p.match_start,p.match_length=P-1,O!==0&&p.prev_length<p.max_lazy_match&&p.strstart-O<=p.w_size-J&&(p.match_length=G(p,O),p.match_length<=5&&(p.strategy===1||p.match_length===P&&4096<p.strstart-p.match_start)&&(p.match_length=P-1)),p.prev_length>=P&&p.match_length<=p.prev_length){for(w=p.strstart+p.lookahead-P,_=o._tr_tally(p,p.strstart-1-p.prev_match,p.prev_length-P),p.lookahead-=p.prev_length-1,p.prev_length-=2;++p.strstart<=w&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),--p.prev_length!=0;);if(p.match_available=0,p.match_length=P-1,p.strstart++,_&&(R(p,!1),p.strm.avail_out===0))return y}else if(p.match_available){if((_=o._tr_tally(p,0,p.window[p.strstart-1]))&&R(p,!1),p.strstart++,p.lookahead--,p.strm.avail_out===0)return y}else p.match_available=1,p.strstart++,p.lookahead--}return p.match_available&&(_=o._tr_tally(p,0,p.window[p.strstart-1]),p.match_available=0),p.insert=p.strstart<P-1?p.strstart:P-1,N===d?(R(p,!0),p.strm.avail_out===0?ce:V):p.last_lit&&(R(p,!1),p.strm.avail_out===0)?y:L}function ge(p,N,O,_,w){this.good_length=p,this.max_lazy=N,this.nice_length=O,this.max_chain=_,this.func=w}function Je(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*x),this.dyn_dtree=new i.Buf16(2*(2*S+1)),this.bl_tree=new i.Buf16(2*(2*I+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(B+1),this.heap=new i.Buf16(2*k+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*k+1),se(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ve(p){var N;return p&&p.state?(p.total_in=p.total_out=0,p.data_type=u,(N=p.state).pending=0,N.pending_out=0,N.wrap<0&&(N.wrap=-N.wrap),N.status=N.wrap?E:U,p.adler=N.wrap===2?0:1,N.last_flush=l,o._tr_init(N),h):le(p,m)}function st(p){var N=ve(p);return N===h&&function(O){O.window_size=2*O.w_size,se(O.head),O.max_lazy_match=n[O.level].max_lazy,O.good_match=n[O.level].good_length,O.nice_match=n[O.level].nice_length,O.max_chain_length=n[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=P-1,O.match_available=0,O.ins_h=0}(p.state),N}function pt(p,N,O,_,w,C){if(!p)return m;var j=1;if(N===f&&(N=6),_<0?(j=0,_=-_):15<_&&(j=2,_-=16),w<1||v<w||O!==b||_<8||15<_||N<0||9<N||C<0||g<C)return le(p,m);_===8&&(_=9);var z=new Je;return(p.state=z).strm=p,z.wrap=j,z.gzhead=null,z.w_bits=_,z.w_size=1<<z.w_bits,z.w_mask=z.w_size-1,z.hash_bits=w+7,z.hash_size=1<<z.hash_bits,z.hash_mask=z.hash_size-1,z.hash_shift=~~((z.hash_bits+P-1)/P),z.window=new i.Buf8(2*z.w_size),z.head=new i.Buf16(z.hash_size),z.prev=new i.Buf16(z.w_size),z.lit_bufsize=1<<w+6,z.pending_buf_size=4*z.lit_bufsize,z.pending_buf=new i.Buf8(z.pending_buf_size),z.d_buf=1*z.lit_bufsize,z.l_buf=3*z.lit_bufsize,z.level=N,z.strategy=C,z.method=O,st(p)}n=[new ge(0,0,0,0,function(p,N){var O=65535;for(O>p.pending_buf_size-5&&(O=p.pending_buf_size-5);;){if(p.lookahead<=1){if(xe(p),p.lookahead===0&&N===l)return y;if(p.lookahead===0)break}p.strstart+=p.lookahead,p.lookahead=0;var _=p.block_start+O;if((p.strstart===0||p.strstart>=_)&&(p.lookahead=p.strstart-_,p.strstart=_,R(p,!1),p.strm.avail_out===0)||p.strstart-p.block_start>=p.w_size-J&&(R(p,!1),p.strm.avail_out===0))return y}return p.insert=0,N===d?(R(p,!0),p.strm.avail_out===0?ce:V):(p.strstart>p.block_start&&(R(p,!1),p.strm.avail_out),y)}),new ge(4,4,8,4,Xe),new ge(4,5,16,8,Xe),new ge(4,6,32,32,Xe),new ge(4,4,16,16,ue),new ge(8,16,32,32,ue),new ge(8,16,128,128,ue),new ge(8,32,128,256,ue),new ge(32,128,258,1024,ue),new ge(32,258,258,4096,ue)],r.deflateInit=function(p,N){return pt(p,N,b,15,8,0)},r.deflateInit2=pt,r.deflateReset=st,r.deflateResetKeep=ve,r.deflateSetHeader=function(p,N){return p&&p.state?p.state.wrap!==2?m:(p.state.gzhead=N,h):m},r.deflate=function(p,N){var O,_,w,C;if(!p||!p.state||5<N||N<0)return p?le(p,m):m;if(_=p.state,!p.output||!p.input&&p.avail_in!==0||_.status===666&&N!==d)return le(p,p.avail_out===0?-5:m);if(_.strm=p,O=_.last_flush,_.last_flush=N,_.status===E)if(_.wrap===2)p.adler=0,te(_,31),te(_,139),te(_,8),_.gzhead?(te(_,(_.gzhead.text?1:0)+(_.gzhead.hcrc?2:0)+(_.gzhead.extra?4:0)+(_.gzhead.name?8:0)+(_.gzhead.comment?16:0)),te(_,255&_.gzhead.time),te(_,_.gzhead.time>>8&255),te(_,_.gzhead.time>>16&255),te(_,_.gzhead.time>>24&255),te(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),te(_,255&_.gzhead.os),_.gzhead.extra&&_.gzhead.extra.length&&(te(_,255&_.gzhead.extra.length),te(_,_.gzhead.extra.length>>8&255)),_.gzhead.hcrc&&(p.adler=a(p.adler,_.pending_buf,_.pending,0)),_.gzindex=0,_.status=69):(te(_,0),te(_,0),te(_,0),te(_,0),te(_,0),te(_,_.level===9?2:2<=_.strategy||_.level<2?4:0),te(_,3),_.status=U);else{var j=b+(_.w_bits-8<<4)<<8;j|=(2<=_.strategy||_.level<2?0:_.level<6?1:_.level===6?2:3)<<6,_.strstart!==0&&(j|=32),j+=31-j%31,_.status=U,q(_,j),_.strstart!==0&&(q(_,p.adler>>>16),q(_,65535&p.adler)),p.adler=1}if(_.status===69)if(_.gzhead.extra){for(w=_.pending;_.gzindex<(65535&_.gzhead.extra.length)&&(_.pending!==_.pending_buf_size||(_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),D(p),w=_.pending,_.pending!==_.pending_buf_size));)te(_,255&_.gzhead.extra[_.gzindex]),_.gzindex++;_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),_.gzindex===_.gzhead.extra.length&&(_.gzindex=0,_.status=73)}else _.status=73;if(_.status===73)if(_.gzhead.name){w=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),D(p),w=_.pending,_.pending===_.pending_buf_size)){C=1;break}C=_.gzindex<_.gzhead.name.length?255&_.gzhead.name.charCodeAt(_.gzindex++):0,te(_,C)}while(C!==0);_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),C===0&&(_.gzindex=0,_.status=91)}else _.status=91;if(_.status===91)if(_.gzhead.comment){w=_.pending;do{if(_.pending===_.pending_buf_size&&(_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),D(p),w=_.pending,_.pending===_.pending_buf_size)){C=1;break}C=_.gzindex<_.gzhead.comment.length?255&_.gzhead.comment.charCodeAt(_.gzindex++):0,te(_,C)}while(C!==0);_.gzhead.hcrc&&_.pending>w&&(p.adler=a(p.adler,_.pending_buf,_.pending-w,w)),C===0&&(_.status=103)}else _.status=103;if(_.status===103&&(_.gzhead.hcrc?(_.pending+2>_.pending_buf_size&&D(p),_.pending+2<=_.pending_buf_size&&(te(_,255&p.adler),te(_,p.adler>>8&255),p.adler=0,_.status=U)):_.status=U),_.pending!==0){if(D(p),p.avail_out===0)return _.last_flush=-1,h}else if(p.avail_in===0&&H(N)<=H(O)&&N!==d)return le(p,-5);if(_.status===666&&p.avail_in!==0)return le(p,-5);if(p.avail_in!==0||_.lookahead!==0||N!==l&&_.status!==666){var z=_.strategy===2?function(A,$){for(var K;;){if(A.lookahead===0&&(xe(A),A.lookahead===0)){if($===l)return y;break}if(A.match_length=0,K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,K&&(R(A,!1),A.strm.avail_out===0))return y}return A.insert=0,$===d?(R(A,!0),A.strm.avail_out===0?ce:V):A.last_lit&&(R(A,!1),A.strm.avail_out===0)?y:L}(_,N):_.strategy===3?function(A,$){for(var K,W,re,Ee,pe=A.window;;){if(A.lookahead<=M){if(xe(A),A.lookahead<=M&&$===l)return y;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=P&&0<A.strstart&&(W=pe[re=A.strstart-1])===pe[++re]&&W===pe[++re]&&W===pe[++re]){Ee=A.strstart+M;do;while(W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&W===pe[++re]&&re<Ee);A.match_length=M-(Ee-re),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=P?(K=o._tr_tally(A,1,A.match_length-P),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),K&&(R(A,!1),A.strm.avail_out===0))return y}return A.insert=0,$===d?(R(A,!0),A.strm.avail_out===0?ce:V):A.last_lit&&(R(A,!1),A.strm.avail_out===0)?y:L}(_,N):n[_.level].func(_,N);if(z!==ce&&z!==V||(_.status=666),z===y||z===ce)return p.avail_out===0&&(_.last_flush=-1),h;if(z===L&&(N===1?o._tr_align(_):N!==5&&(o._tr_stored_block(_,0,0,!1),N===3&&(se(_.head),_.lookahead===0&&(_.strstart=0,_.block_start=0,_.insert=0))),D(p),p.avail_out===0))return _.last_flush=-1,h}return N!==d?h:_.wrap<=0?1:(_.wrap===2?(te(_,255&p.adler),te(_,p.adler>>8&255),te(_,p.adler>>16&255),te(_,p.adler>>24&255),te(_,255&p.total_in),te(_,p.total_in>>8&255),te(_,p.total_in>>16&255),te(_,p.total_in>>24&255)):(q(_,p.adler>>>16),q(_,65535&p.adler)),D(p),0<_.wrap&&(_.wrap=-_.wrap),_.pending!==0?h:1)},r.deflateEnd=function(p){var N;return p&&p.state?(N=p.state.status)!==E&&N!==69&&N!==73&&N!==91&&N!==103&&N!==U&&N!==666?le(p,m):(p.state=null,N===U?le(p,-3):h):m},r.deflateSetDictionary=function(p,N){var O,_,w,C,j,z,A,$,K=N.length;if(!p||!p.state||(C=(O=p.state).wrap)===2||C===1&&O.status!==E||O.lookahead)return m;for(C===1&&(p.adler=s(p.adler,N,K,0)),O.wrap=0,K>=O.w_size&&(C===0&&(se(O.head),O.strstart=0,O.block_start=0,O.insert=0),$=new i.Buf8(O.w_size),i.arraySet($,N,K-O.w_size,O.w_size,0),N=$,K=O.w_size),j=p.avail_in,z=p.next_in,A=p.input,p.avail_in=K,p.next_in=0,p.input=N,xe(O);O.lookahead>=P;){for(_=O.strstart,w=O.lookahead-(P-1);O.ins_h=(O.ins_h<<O.hash_shift^O.window[_+P-1])&O.hash_mask,O.prev[_&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=_,_++,--w;);O.strstart=_,O.lookahead=P-1,xe(O)}return O.strstart+=O.lookahead,O.block_start=O.strstart,O.insert=O.lookahead,O.lookahead=0,O.match_length=O.prev_length=P-1,O.match_available=0,p.next_in=z,p.input=A,p.avail_in=j,O.wrap=C,h},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(n,i){var o,s,a,c,l,d,h,m,f,g,u,b,v,k,S,I,x,B,P,M,J,E,U,y,L;o=n.state,s=n.next_in,y=n.input,a=s+(n.avail_in-5),c=n.next_out,L=n.output,l=c-(i-n.avail_out),d=c+(n.avail_out-257),h=o.dmax,m=o.wsize,f=o.whave,g=o.wnext,u=o.window,b=o.hold,v=o.bits,k=o.lencode,S=o.distcode,I=(1<<o.lenbits)-1,x=(1<<o.distbits)-1;e:do{v<15&&(b+=y[s++]<<v,v+=8,b+=y[s++]<<v,v+=8),B=k[b&I];t:for(;;){if(b>>>=P=B>>>24,v-=P,(P=B>>>16&255)==0)L[c++]=65535&B;else{if(!(16&P)){if((64&P)==0){B=k[(65535&B)+(b&(1<<P)-1)];continue t}if(32&P){o.mode=12;break e}n.msg="invalid literal/length code",o.mode=30;break e}M=65535&B,(P&=15)&&(v<P&&(b+=y[s++]<<v,v+=8),M+=b&(1<<P)-1,b>>>=P,v-=P),v<15&&(b+=y[s++]<<v,v+=8,b+=y[s++]<<v,v+=8),B=S[b&x];r:for(;;){if(b>>>=P=B>>>24,v-=P,!(16&(P=B>>>16&255))){if((64&P)==0){B=S[(65535&B)+(b&(1<<P)-1)];continue r}n.msg="invalid distance code",o.mode=30;break e}if(J=65535&B,v<(P&=15)&&(b+=y[s++]<<v,(v+=8)<P&&(b+=y[s++]<<v,v+=8)),h<(J+=b&(1<<P)-1)){n.msg="invalid distance too far back",o.mode=30;break e}if(b>>>=P,v-=P,(P=c-l)<J){if(f<(P=J-P)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break e}if(U=u,(E=0)===g){if(E+=m-P,P<M){for(M-=P;L[c++]=u[E++],--P;);E=c-J,U=L}}else if(g<P){if(E+=m+g-P,(P-=g)<M){for(M-=P;L[c++]=u[E++],--P;);if(E=0,g<M){for(M-=P=g;L[c++]=u[E++],--P;);E=c-J,U=L}}}else if(E+=g-P,P<M){for(M-=P;L[c++]=u[E++],--P;);E=c-J,U=L}for(;2<M;)L[c++]=U[E++],L[c++]=U[E++],L[c++]=U[E++],M-=3;M&&(L[c++]=U[E++],1<M&&(L[c++]=U[E++]))}else{for(E=c-J;L[c++]=L[E++],L[c++]=L[E++],L[c++]=L[E++],2<(M-=3););M&&(L[c++]=L[E++],1<M&&(L[c++]=L[E++]))}break}}break}}while(s<a&&c<d);s-=M=v>>3,b&=(1<<(v-=M<<3))-1,n.next_in=s,n.next_out=c,n.avail_in=s<a?a-s+5:5-(s-a),n.avail_out=c<d?d-c+257:257-(c-d),o.hold=b,o.bits=v}},{}],49:[function(e,t,r){"use strict";var n=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),s=e("./inffast"),a=e("./inftrees"),c=1,l=2,d=0,h=-2,m=1,f=852,g=592;function u(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function v(E){var U;return E&&E.state?(U=E.state,E.total_in=E.total_out=U.total=0,E.msg="",U.wrap&&(E.adler=1&U.wrap),U.mode=m,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new n.Buf32(f),U.distcode=U.distdyn=new n.Buf32(g),U.sane=1,U.back=-1,d):h}function k(E){var U;return E&&E.state?((U=E.state).wsize=0,U.whave=0,U.wnext=0,v(E)):h}function S(E,U){var y,L;return E&&E.state?(L=E.state,U<0?(y=0,U=-U):(y=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15<U)?h:(L.window!==null&&L.wbits!==U&&(L.window=null),L.wrap=y,L.wbits=U,k(E))):h}function I(E,U){var y,L;return E?(L=new b,(E.state=L).window=null,(y=S(E,U))!==d&&(E.state=null),y):h}var x,B,P=!0;function M(E){if(P){var U;for(x=new n.Buf32(512),B=new n.Buf32(32),U=0;U<144;)E.lens[U++]=8;for(;U<256;)E.lens[U++]=9;for(;U<280;)E.lens[U++]=7;for(;U<288;)E.lens[U++]=8;for(a(c,E.lens,0,288,x,0,E.work,{bits:9}),U=0;U<32;)E.lens[U++]=5;a(l,E.lens,0,32,B,0,E.work,{bits:5}),P=!1}E.lencode=x,E.lenbits=9,E.distcode=B,E.distbits=5}function J(E,U,y,L){var ce,V=E.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new n.Buf8(V.wsize)),L>=V.wsize?(n.arraySet(V.window,U,y-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(L<(ce=V.wsize-V.wnext)&&(ce=L),n.arraySet(V.window,U,y-L,ce,V.wnext),(L-=ce)?(n.arraySet(V.window,U,y-L,L,0),V.wnext=L,V.whave=V.wsize):(V.wnext+=ce,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=ce))),0}r.inflateReset=k,r.inflateReset2=S,r.inflateResetKeep=v,r.inflateInit=function(E){return I(E,15)},r.inflateInit2=I,r.inflate=function(E,U){var y,L,ce,V,le,H,se,D,R,te,q,G,xe,Xe,ue,ge,Je,ve,st,pt,p,N,O,_,w=0,C=new n.Buf8(4),j=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return h;(y=E.state).mode===12&&(y.mode=13),le=E.next_out,ce=E.output,se=E.avail_out,V=E.next_in,L=E.input,H=E.avail_in,D=y.hold,R=y.bits,te=H,q=se,N=d;e:for(;;)switch(y.mode){case m:if(y.wrap===0){y.mode=13;break}for(;R<16;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(2&y.wrap&&D===35615){C[y.check=0]=255&D,C[1]=D>>>8&255,y.check=o(y.check,C,2,0),R=D=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&D)<<8)+(D>>8))%31){E.msg="incorrect header check",y.mode=30;break}if((15&D)!=8){E.msg="unknown compression method",y.mode=30;break}if(R-=4,p=8+(15&(D>>>=4)),y.wbits===0)y.wbits=p;else if(p>y.wbits){E.msg="invalid window size",y.mode=30;break}y.dmax=1<<p,E.adler=y.check=1,y.mode=512&D?10:12,R=D=0;break;case 2:for(;R<16;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(y.flags=D,(255&y.flags)!=8){E.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){E.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=D>>8&1),512&y.flags&&(C[0]=255&D,C[1]=D>>>8&255,y.check=o(y.check,C,2,0)),R=D=0,y.mode=3;case 3:for(;R<32;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.head&&(y.head.time=D),512&y.flags&&(C[0]=255&D,C[1]=D>>>8&255,C[2]=D>>>16&255,C[3]=D>>>24&255,y.check=o(y.check,C,4,0)),R=D=0,y.mode=4;case 4:for(;R<16;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.head&&(y.head.xflags=255&D,y.head.os=D>>8),512&y.flags&&(C[0]=255&D,C[1]=D>>>8&255,y.check=o(y.check,C,2,0)),R=D=0,y.mode=5;case 5:if(1024&y.flags){for(;R<16;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.length=D,y.head&&(y.head.extra_len=D),512&y.flags&&(C[0]=255&D,C[1]=D>>>8&255,y.check=o(y.check,C,2,0)),R=D=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(H<(G=y.length)&&(G=H),G&&(y.head&&(p=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),n.arraySet(y.head.extra,L,V,G,p)),512&y.flags&&(y.check=o(y.check,L,G,V)),H-=G,V+=G,y.length-=G),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(H===0)break e;for(G=0;p=L[V+G++],y.head&&p&&y.length<65536&&(y.head.name+=String.fromCharCode(p)),p&&G<H;);if(512&y.flags&&(y.check=o(y.check,L,G,V)),H-=G,V+=G,p)break e}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if(H===0)break e;for(G=0;p=L[V+G++],y.head&&p&&y.length<65536&&(y.head.comment+=String.fromCharCode(p)),p&&G<H;);if(512&y.flags&&(y.check=o(y.check,L,G,V)),H-=G,V+=G,p)break e}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;R<16;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(D!==(65535&y.check)){E.msg="header crc mismatch",y.mode=30;break}R=D=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),E.adler=y.check=0,y.mode=12;break;case 10:for(;R<32;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}E.adler=y.check=u(D),R=D=0,y.mode=11;case 11:if(y.havedict===0)return E.next_out=le,E.avail_out=se,E.next_in=V,E.avail_in=H,y.hold=D,y.bits=R,2;E.adler=y.check=1,y.mode=12;case 12:if(U===5||U===6)break e;case 13:if(y.last){D>>>=7&R,R-=7&R,y.mode=27;break}for(;R<3;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}switch(y.last=1&D,R-=1,3&(D>>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,U!==6)break;D>>>=2,R-=2;break e;case 2:y.mode=17;break;case 3:E.msg="invalid block type",y.mode=30}D>>>=2,R-=2;break;case 14:for(D>>>=7&R,R-=7&R;R<32;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if((65535&D)!=(D>>>16^65535)){E.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&D,R=D=0,y.mode=15,U===6)break e;case 15:y.mode=16;case 16:if(G=y.length){if(H<G&&(G=H),se<G&&(G=se),G===0)break e;n.arraySet(ce,L,V,G,le),H-=G,V+=G,se-=G,le+=G,y.length-=G;break}y.mode=12;break;case 17:for(;R<14;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(y.nlen=257+(31&D),D>>>=5,R-=5,y.ndist=1+(31&D),D>>>=5,R-=5,y.ncode=4+(15&D),D>>>=4,R-=4,286<y.nlen||30<y.ndist){E.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;R<3;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.lens[j[y.have++]]=7&D,D>>>=3,R-=3}for(;y.have<19;)y.lens[j[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,O={bits:y.lenbits},N=a(0,y.lens,0,19,y.lencode,0,y.work,O),y.lenbits=O.bits,N){E.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;ge=(w=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Je=65535&w,!((ue=w>>>24)<=R);){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(Je<16)D>>>=ue,R-=ue,y.lens[y.have++]=Je;else{if(Je===16){for(_=ue+2;R<_;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(D>>>=ue,R-=ue,y.have===0){E.msg="invalid bit length repeat",y.mode=30;break}p=y.lens[y.have-1],G=3+(3&D),D>>>=2,R-=2}else if(Je===17){for(_=ue+3;R<_;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}R-=ue,p=0,G=3+(7&(D>>>=ue)),D>>>=3,R-=3}else{for(_=ue+7;R<_;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}R-=ue,p=0,G=11+(127&(D>>>=ue)),D>>>=7,R-=7}if(y.have+G>y.nlen+y.ndist){E.msg="invalid bit length repeat",y.mode=30;break}for(;G--;)y.lens[y.have++]=p}}if(y.mode===30)break;if(y.lens[256]===0){E.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,O={bits:y.lenbits},N=a(c,y.lens,0,y.nlen,y.lencode,0,y.work,O),y.lenbits=O.bits,N){E.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,O={bits:y.distbits},N=a(l,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,O),y.distbits=O.bits,N){E.msg="invalid distances set",y.mode=30;break}if(y.mode=20,U===6)break e;case 20:y.mode=21;case 21:if(6<=H&&258<=se){E.next_out=le,E.avail_out=se,E.next_in=V,E.avail_in=H,y.hold=D,y.bits=R,s(E,q),le=E.next_out,ce=E.output,se=E.avail_out,V=E.next_in,L=E.input,H=E.avail_in,D=y.hold,R=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;ge=(w=y.lencode[D&(1<<y.lenbits)-1])>>>16&255,Je=65535&w,!((ue=w>>>24)<=R);){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(ge&&(240&ge)==0){for(ve=ue,st=ge,pt=Je;ge=(w=y.lencode[pt+((D&(1<<ve+st)-1)>>ve)])>>>16&255,Je=65535&w,!(ve+(ue=w>>>24)<=R);){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}D>>>=ve,R-=ve,y.back+=ve}if(D>>>=ue,R-=ue,y.back+=ue,y.length=Je,ge===0){y.mode=26;break}if(32&ge){y.back=-1,y.mode=12;break}if(64&ge){E.msg="invalid literal/length code",y.mode=30;break}y.extra=15&ge,y.mode=22;case 22:if(y.extra){for(_=y.extra;R<_;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.length+=D&(1<<y.extra)-1,D>>>=y.extra,R-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;ge=(w=y.distcode[D&(1<<y.distbits)-1])>>>16&255,Je=65535&w,!((ue=w>>>24)<=R);){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if((240&ge)==0){for(ve=ue,st=ge,pt=Je;ge=(w=y.distcode[pt+((D&(1<<ve+st)-1)>>ve)])>>>16&255,Je=65535&w,!(ve+(ue=w>>>24)<=R);){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}D>>>=ve,R-=ve,y.back+=ve}if(D>>>=ue,R-=ue,y.back+=ue,64&ge){E.msg="invalid distance code",y.mode=30;break}y.offset=Je,y.extra=15&ge,y.mode=24;case 24:if(y.extra){for(_=y.extra;R<_;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}y.offset+=D&(1<<y.extra)-1,D>>>=y.extra,R-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){E.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(se===0)break e;if(G=q-se,y.offset>G){if((G=y.offset-G)>y.whave&&y.sane){E.msg="invalid distance too far back",y.mode=30;break}xe=G>y.wnext?(G-=y.wnext,y.wsize-G):y.wnext-G,G>y.length&&(G=y.length),Xe=y.window}else Xe=ce,xe=le-y.offset,G=y.length;for(se<G&&(G=se),se-=G,y.length-=G;ce[le++]=Xe[xe++],--G;);y.length===0&&(y.mode=21);break;case 26:if(se===0)break e;ce[le++]=y.length,se--,y.mode=21;break;case 27:if(y.wrap){for(;R<32;){if(H===0)break e;H--,D|=L[V++]<<R,R+=8}if(q-=se,E.total_out+=q,y.total+=q,q&&(E.adler=y.check=y.flags?o(y.check,ce,q,le-q):i(y.check,ce,q,le-q)),q=se,(y.flags?D:u(D))!==y.check){E.msg="incorrect data check",y.mode=30;break}R=D=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;R<32;){if(H===0)break e;H--,D+=L[V++]<<R,R+=8}if(D!==(4294967295&y.total)){E.msg="incorrect length check",y.mode=30;break}R=D=0}y.mode=29;case 29:N=1;break e;case 30:N=-3;break e;case 31:return-4;case 32:default:return h}return E.next_out=le,E.avail_out=se,E.next_in=V,E.avail_in=H,y.hold=D,y.bits=R,(y.wsize||q!==E.avail_out&&y.mode<30&&(y.mode<27||U!==4))&&J(E,E.output,E.next_out,q-E.avail_out)?(y.mode=31,-4):(te-=E.avail_in,q-=E.avail_out,E.total_in+=te,E.total_out+=q,y.total+=q,y.wrap&&q&&(E.adler=y.check=y.flags?o(y.check,ce,q,E.next_out-q):i(y.check,ce,q,E.next_out-q)),E.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(te==0&&q===0||U===4)&&N===d&&(N=-5),N)},r.inflateEnd=function(E){if(!E||!E.state)return h;var U=E.state;return U.window&&(U.window=null),E.state=null,d},r.inflateGetHeader=function(E,U){var y;return E&&E.state?(2&(y=E.state).wrap)==0?h:((y.head=U).done=!1,d):h},r.inflateSetDictionary=function(E,U){var y,L=U.length;return E&&E.state?(y=E.state).wrap!==0&&y.mode!==11?h:y.mode===11&&i(1,U,L,0)!==y.check?-3:J(E,U,L,L)?(y.mode=31,-4):(y.havedict=1,d):h},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(c,l,d,h,m,f,g,u){var b,v,k,S,I,x,B,P,M,J=u.bits,E=0,U=0,y=0,L=0,ce=0,V=0,le=0,H=0,se=0,D=0,R=null,te=0,q=new n.Buf16(16),G=new n.Buf16(16),xe=null,Xe=0;for(E=0;E<=15;E++)q[E]=0;for(U=0;U<h;U++)q[l[d+U]]++;for(ce=J,L=15;1<=L&&q[L]===0;L--);if(L<ce&&(ce=L),L===0)return m[f++]=20971520,m[f++]=20971520,u.bits=1,0;for(y=1;y<L&&q[y]===0;y++);for(ce<y&&(ce=y),E=H=1;E<=15;E++)if(H<<=1,(H-=q[E])<0)return-1;if(0<H&&(c===0||L!==1))return-1;for(G[1]=0,E=1;E<15;E++)G[E+1]=G[E]+q[E];for(U=0;U<h;U++)l[d+U]!==0&&(g[G[l[d+U]]++]=U);if(x=c===0?(R=xe=g,19):c===1?(R=i,te-=257,xe=o,Xe-=257,256):(R=s,xe=a,-1),E=y,I=f,le=U=D=0,k=-1,S=(se=1<<(V=ce))-1,c===1&&852<se||c===2&&592<se)return 1;for(;;){for(B=E-le,M=g[U]<x?(P=0,g[U]):g[U]>x?(P=xe[Xe+g[U]],R[te+g[U]]):(P=96,0),b=1<<E-le,y=v=1<<V;m[I+(D>>le)+(v-=b)]=B<<24|P<<16|M|0,v!==0;);for(b=1<<E-1;D&b;)b>>=1;if(b!==0?(D&=b-1,D+=b):D=0,U++,--q[E]==0){if(E===L)break;E=l[d+g[U]]}if(ce<E&&(D&S)!==k){for(le===0&&(le=ce),I+=y,H=1<<(V=E-le);V+le<L&&!((H-=q[V+le])<=0);)V++,H<<=1;if(se+=1<<V,c===1&&852<se||c===2&&592<se)return 1;m[k=D&S]=ce<<24|V<<16|I-f|0}}return D!==0&&(m[I+D]=E-le<<24|64<<16|0),u.bits=ce,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var n=e("../utils/common"),i=0,o=1;function s(w){for(var C=w.length;0<=--C;)w[C]=0}var a=0,c=29,l=256,d=l+1+c,h=30,m=19,f=2*d+1,g=15,u=16,b=7,v=256,k=16,S=17,I=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],B=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],J=new Array(2*(d+2));s(J);var E=new Array(2*h);s(E);var U=new Array(512);s(U);var y=new Array(256);s(y);var L=new Array(c);s(L);var ce,V,le,H=new Array(h);function se(w,C,j,z,A){this.static_tree=w,this.extra_bits=C,this.extra_base=j,this.elems=z,this.max_length=A,this.has_stree=w&&w.length}function D(w,C){this.dyn_tree=w,this.max_code=0,this.stat_desc=C}function R(w){return w<256?U[w]:U[256+(w>>>7)]}function te(w,C){w.pending_buf[w.pending++]=255&C,w.pending_buf[w.pending++]=C>>>8&255}function q(w,C,j){w.bi_valid>u-j?(w.bi_buf|=C<<w.bi_valid&65535,te(w,w.bi_buf),w.bi_buf=C>>u-w.bi_valid,w.bi_valid+=j-u):(w.bi_buf|=C<<w.bi_valid&65535,w.bi_valid+=j)}function G(w,C,j){q(w,j[2*C],j[2*C+1])}function xe(w,C){for(var j=0;j|=1&w,w>>>=1,j<<=1,0<--C;);return j>>>1}function Xe(w,C,j){var z,A,$=new Array(g+1),K=0;for(z=1;z<=g;z++)$[z]=K=K+j[z-1]<<1;for(A=0;A<=C;A++){var W=w[2*A+1];W!==0&&(w[2*A]=xe($[W]++,W))}}function ue(w){var C;for(C=0;C<d;C++)w.dyn_ltree[2*C]=0;for(C=0;C<h;C++)w.dyn_dtree[2*C]=0;for(C=0;C<m;C++)w.bl_tree[2*C]=0;w.dyn_ltree[2*v]=1,w.opt_len=w.static_len=0,w.last_lit=w.matches=0}function ge(w){8<w.bi_valid?te(w,w.bi_buf):0<w.bi_valid&&(w.pending_buf[w.pending++]=w.bi_buf),w.bi_buf=0,w.bi_valid=0}function Je(w,C,j,z){var A=2*C,$=2*j;return w[A]<w[$]||w[A]===w[$]&&z[C]<=z[j]}function ve(w,C,j){for(var z=w.heap[j],A=j<<1;A<=w.heap_len&&(A<w.heap_len&&Je(C,w.heap[A+1],w.heap[A],w.depth)&&A++,!Je(C,z,w.heap[A],w.depth));)w.heap[j]=w.heap[A],j=A,A<<=1;w.heap[j]=z}function st(w,C,j){var z,A,$,K,W=0;if(w.last_lit!==0)for(;z=w.pending_buf[w.d_buf+2*W]<<8|w.pending_buf[w.d_buf+2*W+1],A=w.pending_buf[w.l_buf+W],W++,z===0?G(w,A,C):(G(w,($=y[A])+l+1,C),(K=x[$])!==0&&q(w,A-=L[$],K),G(w,$=R(--z),j),(K=B[$])!==0&&q(w,z-=H[$],K)),W<w.last_lit;);G(w,v,C)}function pt(w,C){var j,z,A,$=C.dyn_tree,K=C.stat_desc.static_tree,W=C.stat_desc.has_stree,re=C.stat_desc.elems,Ee=-1;for(w.heap_len=0,w.heap_max=f,j=0;j<re;j++)$[2*j]!==0?(w.heap[++w.heap_len]=Ee=j,w.depth[j]=0):$[2*j+1]=0;for(;w.heap_len<2;)$[2*(A=w.heap[++w.heap_len]=Ee<2?++Ee:0)]=1,w.depth[A]=0,w.opt_len--,W&&(w.static_len-=K[2*A+1]);for(C.max_code=Ee,j=w.heap_len>>1;1<=j;j--)ve(w,$,j);for(A=re;j=w.heap[1],w.heap[1]=w.heap[w.heap_len--],ve(w,$,1),z=w.heap[1],w.heap[--w.heap_max]=j,w.heap[--w.heap_max]=z,$[2*A]=$[2*j]+$[2*z],w.depth[A]=(w.depth[j]>=w.depth[z]?w.depth[j]:w.depth[z])+1,$[2*j+1]=$[2*z+1]=A,w.heap[1]=A++,ve(w,$,1),2<=w.heap_len;);w.heap[--w.heap_max]=w.heap[1],function(pe,Tt){var Yt,Zt,Pr,Ie,Fn,fi,_t=Tt.dyn_tree,As=Tt.max_code,Mn=Tt.stat_desc.static_tree,Zc=Tt.stat_desc.has_stree,Nn=Tt.stat_desc.extra_bits,Ts=Tt.stat_desc.extra_base,Gr=Tt.stat_desc.max_length,mi=0;for(Ie=0;Ie<=g;Ie++)pe.bl_count[Ie]=0;for(_t[2*pe.heap[pe.heap_max]+1]=0,Yt=pe.heap_max+1;Yt<f;Yt++)Gr<(Ie=_t[2*_t[2*(Zt=pe.heap[Yt])+1]+1]+1)&&(Ie=Gr,mi++),_t[2*Zt+1]=Ie,As<Zt||(pe.bl_count[Ie]++,Fn=0,Ts<=Zt&&(Fn=Nn[Zt-Ts]),fi=_t[2*Zt],pe.opt_len+=fi*(Ie+Fn),Zc&&(pe.static_len+=fi*(Mn[2*Zt+1]+Fn)));if(mi!==0){do{for(Ie=Gr-1;pe.bl_count[Ie]===0;)Ie--;pe.bl_count[Ie]--,pe.bl_count[Ie+1]+=2,pe.bl_count[Gr]--,mi-=2}while(0<mi);for(Ie=Gr;Ie!==0;Ie--)for(Zt=pe.bl_count[Ie];Zt!==0;)As<(Pr=pe.heap[--Yt])||(_t[2*Pr+1]!==Ie&&(pe.opt_len+=(Ie-_t[2*Pr+1])*_t[2*Pr],_t[2*Pr+1]=Ie),Zt--)}}(w,C),Xe($,Ee,w.bl_count)}function p(w,C,j){var z,A,$=-1,K=C[1],W=0,re=7,Ee=4;for(K===0&&(re=138,Ee=3),C[2*(j+1)+1]=65535,z=0;z<=j;z++)A=K,K=C[2*(z+1)+1],++W<re&&A===K||(W<Ee?w.bl_tree[2*A]+=W:A!==0?(A!==$&&w.bl_tree[2*A]++,w.bl_tree[2*k]++):W<=10?w.bl_tree[2*S]++:w.bl_tree[2*I]++,$=A,Ee=(W=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4))}function N(w,C,j){var z,A,$=-1,K=C[1],W=0,re=7,Ee=4;for(K===0&&(re=138,Ee=3),z=0;z<=j;z++)if(A=K,K=C[2*(z+1)+1],!(++W<re&&A===K)){if(W<Ee)for(;G(w,A,w.bl_tree),--W!=0;);else A!==0?(A!==$&&(G(w,A,w.bl_tree),W--),G(w,k,w.bl_tree),q(w,W-3,2)):W<=10?(G(w,S,w.bl_tree),q(w,W-3,3)):(G(w,I,w.bl_tree),q(w,W-11,7));$=A,Ee=(W=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4)}}s(H);var O=!1;function _(w,C,j,z){q(w,(a<<1)+(z?1:0),3),function(A,$,K,W){ge(A),W&&(te(A,K),te(A,~K)),n.arraySet(A.pending_buf,A.window,$,K,A.pending),A.pending+=K}(w,C,j,!0)}r._tr_init=function(w){O||(function(){var C,j,z,A,$,K=new Array(g+1);for(A=z=0;A<c-1;A++)for(L[A]=z,C=0;C<1<<x[A];C++)y[z++]=A;for(y[z-1]=A,A=$=0;A<16;A++)for(H[A]=$,C=0;C<1<<B[A];C++)U[$++]=A;for($>>=7;A<h;A++)for(H[A]=$<<7,C=0;C<1<<B[A]-7;C++)U[256+$++]=A;for(j=0;j<=g;j++)K[j]=0;for(C=0;C<=143;)J[2*C+1]=8,C++,K[8]++;for(;C<=255;)J[2*C+1]=9,C++,K[9]++;for(;C<=279;)J[2*C+1]=7,C++,K[7]++;for(;C<=287;)J[2*C+1]=8,C++,K[8]++;for(Xe(J,d+1,K),C=0;C<h;C++)E[2*C+1]=5,E[2*C]=xe(C,5);ce=new se(J,x,l+1,d,g),V=new se(E,B,0,h,g),le=new se(new Array(0),P,0,m,b)}(),O=!0),w.l_desc=new D(w.dyn_ltree,ce),w.d_desc=new D(w.dyn_dtree,V),w.bl_desc=new D(w.bl_tree,le),w.bi_buf=0,w.bi_valid=0,ue(w)},r._tr_stored_block=_,r._tr_flush_block=function(w,C,j,z){var A,$,K=0;0<w.level?(w.strm.data_type===2&&(w.strm.data_type=function(W){var re,Ee=4093624447;for(re=0;re<=31;re++,Ee>>>=1)if(1&Ee&&W.dyn_ltree[2*re]!==0)return i;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return o;for(re=32;re<l;re++)if(W.dyn_ltree[2*re]!==0)return o;return i}(w)),pt(w,w.l_desc),pt(w,w.d_desc),K=function(W){var re;for(p(W,W.dyn_ltree,W.l_desc.max_code),p(W,W.dyn_dtree,W.d_desc.max_code),pt(W,W.bl_desc),re=m-1;3<=re&&W.bl_tree[2*M[re]+1]===0;re--);return W.opt_len+=3*(re+1)+5+5+4,re}(w),A=w.opt_len+3+7>>>3,($=w.static_len+3+7>>>3)<=A&&(A=$)):A=$=j+5,j+4<=A&&C!==-1?_(w,C,j,z):w.strategy===4||$===A?(q(w,2+(z?1:0),3),st(w,J,E)):(q(w,4+(z?1:0),3),function(W,re,Ee,pe){var Tt;for(q(W,re-257,5),q(W,Ee-1,5),q(W,pe-4,4),Tt=0;Tt<pe;Tt++)q(W,W.bl_tree[2*M[Tt]+1],3);N(W,W.dyn_ltree,re-1),N(W,W.dyn_dtree,Ee-1)}(w,w.l_desc.max_code+1,w.d_desc.max_code+1,K+1),st(w,w.dyn_ltree,w.dyn_dtree)),ue(w),z&&ge(w)},r._tr_tally=function(w,C,j){return w.pending_buf[w.d_buf+2*w.last_lit]=C>>>8&255,w.pending_buf[w.d_buf+2*w.last_lit+1]=255&C,w.pending_buf[w.l_buf+w.last_lit]=255&j,w.last_lit++,C===0?w.dyn_ltree[2*j]++:(w.matches++,C--,w.dyn_ltree[2*(y[j]+l+1)]++,w.dyn_dtree[2*R(C)]++),w.last_lit===w.lit_bufsize-1},r._tr_align=function(w){q(w,2,3),G(w,v,J),function(C){C.bi_valid===16?(te(C,C.bi_buf),C.bi_buf=0,C.bi_valid=0):8<=C.bi_valid&&(C.pending_buf[C.pending++]=255&C.bi_buf,C.bi_buf>>=8,C.bi_valid-=8)}(w)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,o){"use strict";if(!i.setImmediate){var s,a,c,l,d=1,h={},m=!1,f=i.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(i);g=g&&g.setTimeout?g:i,s={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){b(k)})}:function(){if(i.postMessage&&!i.importScripts){var k=!0,S=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=S,k}}()?(l="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",v,!1):i.attachEvent("onmessage",v),function(k){i.postMessage(l+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){b(k.data)},function(k){c.port2.postMessage(k)}):f&&"onreadystatechange"in f.createElement("script")?(a=f.documentElement,function(k){var S=f.createElement("script");S.onreadystatechange=function(){b(k),S.onreadystatechange=null,a.removeChild(S),S=null},a.appendChild(S)}):function(k){setTimeout(b,0,k)},g.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var S=new Array(arguments.length-1),I=0;I<S.length;I++)S[I]=arguments[I+1];var x={callback:k,args:S};return h[d]=x,s(d),d++},g.clearImmediate=u}function u(k){delete h[k]}function b(k){if(m)setTimeout(b,0,k);else{var S=h[k];if(S){m=!0;try{(function(I){var x=I.callback,B=I.args;switch(B.length){case 0:x();break;case 1:x(B[0]);break;case 2:x(B[0],B[1]);break;case 3:x(B[0],B[1],B[2]);break;default:x.apply(o,B)}})(S)}finally{u(k),m=!1}}}}function v(k){k.source===i&&typeof k.data=="string"&&k.data.indexOf(l)===0&&b(+k.data.slice(l.length))}})(typeof self=="undefined"?n===void 0?this:n:self)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}]},{},[10])(10)})});var ah=we((ux,Ja)=>{(function(e,t){typeof define=="function"&&define.amd?define(t):typeof Ja!="undefined"&&Ja.exports?Ja.exports=t():window.ysFixWebmDuration=t()})("fix-webm-duration",function(){var e={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};function t(l,d){l.prototype=Object.create(d.prototype),l.prototype.constructor=l}function r(l,d){this.name=l||"Unknown",this.type=d||"Unknown"}r.prototype.updateBySource=function(){},r.prototype.setSource=function(l){this.source=l,this.updateBySource()},r.prototype.updateByData=function(){},r.prototype.setData=function(l){this.data=l,this.updateByData()};function n(l,d){r.call(this,l,d||"Uint")}t(n,r);function i(l){return l.length%2==1?"0"+l:l}n.prototype.updateBySource=function(){this.data="";for(var l=0;l<this.source.length;l++){var d=this.source[l].toString(16);this.data+=i(d)}},n.prototype.updateByData=function(){var l=this.data.length/2;this.source=new Uint8Array(l);for(var d=0;d<l;d++){var h=this.data.substr(d*2,2);this.source[d]=parseInt(h,16)}},n.prototype.getValue=function(){return parseInt(this.data,16)},n.prototype.setValue=function(l){this.setData(i(l.toString(16)))};function o(l,d){r.call(this,l,d||"Float")}t(o,r),o.prototype.getFloatArrayType=function(){return this.source&&this.source.length===4?Float32Array:Float64Array},o.prototype.updateBySource=function(){var l=this.source.reverse(),d=this.getFloatArrayType(),h=new d(l.buffer);this.data=h[0]},o.prototype.updateByData=function(){var l=this.getFloatArrayType(),d=new l([this.data]),h=new Uint8Array(d.buffer);this.source=h.reverse()},o.prototype.getValue=function(){return this.data},o.prototype.setValue=function(l){this.setData(l)};function s(l,d){r.call(this,l,d||"Container")}t(s,r),s.prototype.readByte=function(){return this.source[this.offset++]},s.prototype.readUint=function(){for(var l=this.readByte(),d=8-l.toString(2).length,h=l-(1<<7-d),m=0;m<d;m++)h*=256,h+=this.readByte();return h},s.prototype.updateBySource=function(){for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=h){var l=this.readUint(),d=this.readUint(),h=Math.min(this.offset+d,this.source.length),m=this.source.slice(this.offset,h),f=e[l]||{name:"Unknown",type:"Unknown"},g=r;switch(f.type){case"Container":g=s;break;case"Uint":g=n;break;case"Float":g=o;break}var u=new g(f.name,f.type);u.setSource(m),this.data.push({id:l,idHex:l.toString(16),data:u})}},s.prototype.writeUint=function(l,d){for(var h=1,m=128;l>=m&&h<8;h++,m*=128);if(!d)for(var f=m+l,g=h-1;g>=0;g--){var u=f%256;this.source[this.offset+g]=u,f=(f-u)/256}this.offset+=h},s.prototype.writeSections=function(l){this.offset=0;for(var d=0;d<this.data.length;d++){var h=this.data[d],m=h.data.source,f=m.length;this.writeUint(h.id,l),this.writeUint(f,l),l||this.source.set(m,this.offset),this.offset+=f}return this.offset},s.prototype.updateByData=function(){var l=this.writeSections("draft");this.source=new Uint8Array(l),this.writeSections()},s.prototype.getSectionById=function(l){for(var d=0;d<this.data.length;d++){var h=this.data[d];if(h.id===l)return h.data}return null};function a(l){s.call(this,"File","File"),this.setSource(l)}t(a,s),a.prototype.fixDuration=function(l,d){var h=d&&d.logger;h===void 0?h=function(b){console.log(b)}:h||(h=function(){});var m=this.getSectionById(139690087);if(!m)return h("[fix-webm-duration] Segment section is missing"),!1;var f=m.getSectionById(88713574);if(!f)return h("[fix-webm-duration] Info section is missing"),!1;var g=f.getSectionById(710577);if(!g)return h("[fix-webm-duration] TimecodeScale section is missing"),!1;var u=f.getSectionById(1161);if(u)if(u.getValue()<=0)h(`[fix-webm-duration] Duration section is present, but the value is ${u.getValue()}`),u.setValue(l);else return h(`[fix-webm-duration] Duration section is present, and the value is ${u.getValue()}`),!1;else h("[fix-webm-duration] Duration section is missing"),u=new o("Duration","Float"),u.setValue(l),f.data.push({id:1161,data:u});return g.setValue(1e6),f.updateByData(),m.updateByData(),this.updateByData(),!0},a.prototype.toBlob=function(l){return new Blob([this.source.buffer],{type:l||"video/webm"})};function c(l,d,h,m){if(typeof h=="object"&&(m=h,h=void 0),!h)return new Promise(function(g){c(l,d,g,m)});try{var f=new FileReader;f.onloadend=function(){try{var g=new a(new Uint8Array(f.result));g.fixDuration(d,m)&&(l=g.toBlob(l.type))}catch(u){}h(l)},f.readAsArrayBuffer(l)}catch(g){h(l)}}return c.default=c,c})});var k0=we((hh,uh)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof hh!="undefined"?t():(t(),e.FileSaver={exports:{}}.exports)})(hh,function(){"use strict";function e(a,c){return typeof c=="undefined"?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(l){}return 200<=c.status&&299>=c.status}function n(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(l){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 i=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,o=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||(typeof window!="object"||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(a,c,l){var d=i.URL||i.webkitURL,h=document.createElement("a");c=c||a.name||"download",h.download=c,h.rel="noopener",typeof a=="string"?(h.href=a,h.origin===location.origin?n(h):r(h.href)?t(a,c,l):n(h,h.target="_blank")):(h.href=d.createObjectURL(a),setTimeout(function(){d.revokeObjectURL(h.href)},4e4),setTimeout(function(){n(h)},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(){n(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 h=a.type==="application/octet-stream",m=/constructor/i.test(i.HTMLElement)||i.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent);if((f||h&&m||o)&&typeof FileReader!="undefined"){var g=new FileReader;g.onloadend=function(){var v=g.result;v=f?v:v.replace(/^data:[^;]*;/,"data:attachment/file;"),d?d.location.href=v:location=v,d=null},g.readAsDataURL(a)}else{var u=i.URL||i.webkitURL,b=u.createObjectURL(a);d?d.location=b:location.href=b,d=null,setTimeout(function(){u.revokeObjectURL(b)},4e4)}});i.saveAs=s.saveAs=s,typeof uh!="undefined"&&(uh.exports=s)})});var F2=we((W6,L2)=>{L2.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Bn=we(li=>{var Nu,Z_=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];li.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};li.getSymbolTotalCodewords=function(t){return Z_[t]};li.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};li.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Nu=t};li.isKanjiModeEnabled=function(){return typeof Nu!="undefined"};li.toSJIS=function(t){return Nu(t)}});var Mc=we(fr=>{fr.L={bit:1};fr.M={bit:0};fr.Q={bit:3};fr.H={bit:2};function Q_(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return fr.L;case"m":case"medium":return fr.M;case"q":case"quartile":return fr.Q;case"h":case"high":return fr.H;default:throw new Error("Unknown EC Level: "+e)}}fr.isValid=function(t){return t&&typeof t.bit!="undefined"&&t.bit>=0&&t.bit<4};fr.from=function(t,r){if(fr.isValid(t))return t;try{return Q_(t)}catch(n){return r}}});var j2=we((q6,M2)=>{function N2(){this.buffer=[],this.length=0}N2.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};M2.exports=N2});var V2=we((K6,z2)=>{function ys(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}ys.prototype.set=function(e,t,r,n){let i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)};ys.prototype.get=function(e,t){return this.data[e*this.size+t]};ys.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};ys.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};z2.exports=ys});var H2=we(Nc=>{var e3=Bn().getSymbolSize;Nc.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=e3(t),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,o=[n-7];for(let s=1;s<r-1;s++)o[s]=o[s-1]-i;return o.push(6),o.reverse()};Nc.getPositions=function(t){let r=[],n=Nc.getRowColCoords(t),i=n.length;for(let o=0;o<i;o++)for(let s=0;s<i;s++)o===0&&s===0||o===0&&s===i-1||o===i-1&&s===0||r.push([n[o],n[s]]);return r}});var G2=we(W2=>{var t3=Bn().getSymbolSize,$2=7;W2.getPositions=function(t){let r=t3(t);return[[0,0],[r-$2,0],[0,r-$2]]}});var q2=we(Oe=>{Oe.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var di={N1:3,N2:3,N3:40,N4:10};Oe.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};Oe.from=function(t){return Oe.isValid(t)?parseInt(t,10):void 0};Oe.getPenaltyN1=function(t){let r=t.size,n=0,i=0,o=0,s=null,a=null;for(let c=0;c<r;c++){i=o=0,s=a=null;for(let l=0;l<r;l++){let d=t.get(c,l);d===s?i++:(i>=5&&(n+=di.N1+(i-5)),s=d,i=1),d=t.get(l,c),d===a?o++:(o>=5&&(n+=di.N1+(o-5)),a=d,o=1)}i>=5&&(n+=di.N1+(i-5)),o>=5&&(n+=di.N1+(o-5))}return n};Oe.getPenaltyN2=function(t){let r=t.size,n=0;for(let i=0;i<r-1;i++)for(let o=0;o<r-1;o++){let s=t.get(i,o)+t.get(i,o+1)+t.get(i+1,o)+t.get(i+1,o+1);(s===4||s===0)&&n++}return n*di.N2};Oe.getPenaltyN3=function(t){let r=t.size,n=0,i=0,o=0;for(let s=0;s<r;s++){i=o=0;for(let a=0;a<r;a++)i=i<<1&2047|t.get(s,a),a>=10&&(i===1488||i===93)&&n++,o=o<<1&2047|t.get(a,s),a>=10&&(o===1488||o===93)&&n++}return n*di.N3};Oe.getPenaltyN4=function(t){let r=0,n=t.data.length;for(let o=0;o<n;o++)r+=t.data[o];return Math.abs(Math.ceil(r*100/n/5)-10)*di.N4};function r3(e,t,r){switch(e){case Oe.Patterns.PATTERN000:return(t+r)%2==0;case Oe.Patterns.PATTERN001:return t%2==0;case Oe.Patterns.PATTERN010:return r%3==0;case Oe.Patterns.PATTERN011:return(t+r)%3==0;case Oe.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Oe.Patterns.PATTERN101:return t*r%2+t*r%3==0;case Oe.Patterns.PATTERN110:return(t*r%2+t*r%3)%2==0;case Oe.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}Oe.applyMask=function(t,r){let n=r.size;for(let i=0;i<n;i++)for(let o=0;o<n;o++)r.isReserved(o,i)||r.xor(o,i,r3(t,o,i))};Oe.getBestMask=function(t,r){let n=Object.keys(Oe.Patterns).length,i=0,o=Infinity;for(let s=0;s<n;s++){r(s),Oe.applyMask(s,t);let a=Oe.getPenaltyN1(t)+Oe.getPenaltyN2(t)+Oe.getPenaltyN3(t)+Oe.getPenaltyN4(t);Oe.applyMask(s,t),a<o&&(o=a,i=s)}return i}});var zu=we(ju=>{var On=Mc(),jc=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],zc=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];ju.getBlocksCount=function(t,r){switch(r){case On.L:return jc[(t-1)*4+0];case On.M:return jc[(t-1)*4+1];case On.Q:return jc[(t-1)*4+2];case On.H:return jc[(t-1)*4+3];default:return}};ju.getTotalCodewordsCount=function(t,r){switch(r){case On.L:return zc[(t-1)*4+0];case On.M:return zc[(t-1)*4+1];case On.Q:return zc[(t-1)*4+2];case On.H:return zc[(t-1)*4+3];default:return}}});var K2=we(Vc=>{var bs=new Uint8Array(512),Hc=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)bs[r]=t,Hc[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)bs[r]=bs[r-255]})();Vc.log=function(t){if(t<1)throw new Error("log("+t+")");return Hc[t]};Vc.exp=function(t){return bs[t]};Vc.mul=function(t,r){return t===0||r===0?0:bs[Hc[t]+Hc[r]]}});var X2=we(vs=>{var Vu=K2();vs.mul=function(t,r){let n=new Uint8Array(t.length+r.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<r.length;o++)n[i+o]^=Vu.mul(t[i],r[o]);return n};vs.mod=function(t,r){let n=new Uint8Array(t);for(;n.length-r.length>=0;){let i=n[0];for(let s=0;s<r.length;s++)n[s]^=Vu.mul(r[s],i);let o=0;for(;o<n.length&&n[o]===0;)o++;n=n.slice(o)}return n};vs.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=vs.mul(r,new Uint8Array([1,Vu.exp(n)]));return r}});var Z2=we((tT,J2)=>{var Y2=X2();function Hu(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}Hu.prototype.initialize=function(t){this.degree=t,this.genPoly=Y2.generateECPolynomial(this.degree)};Hu.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(t.length+this.degree);r.set(t);let n=Y2.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let o=new Uint8Array(this.degree);return o.set(n,i),o}return n};J2.exports=Hu});var Wu=we(Q2=>{Q2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var $u=we(an=>{var ey="[0-9]+",n3="[A-Z $%*+\\-./:]+",ws="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";ws=ws.replace(/u/g,"\\u");var i3="(?:(?![A-Z0-9 $%*+\\-./:]|"+ws+`)(?:.|[\r
3
- ]))+`;an.KANJI=new RegExp(ws,"g");an.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");an.BYTE=new RegExp(i3,"g");an.NUMERIC=new RegExp(ey,"g");an.ALPHANUMERIC=new RegExp(n3,"g");var o3=new RegExp("^"+ws+"$"),s3=new RegExp("^"+ey+"$"),a3=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");an.testKanji=function(t){return o3.test(t)};an.testNumeric=function(t){return s3.test(t)};an.testAlphanumeric=function(t){return a3.test(t)}});var Un=we(ot=>{var c3=Wu(),Gu=$u();ot.NUMERIC={id:"Numeric",bit:1<<0,ccBits:[10,12,14]};ot.ALPHANUMERIC={id:"Alphanumeric",bit:1<<1,ccBits:[9,11,13]};ot.BYTE={id:"Byte",bit:1<<2,ccBits:[8,16,16]};ot.KANJI={id:"Kanji",bit:1<<3,ccBits:[8,10,12]};ot.MIXED={bit:-1};ot.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!c3.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};ot.getBestModeForData=function(t){return Gu.testNumeric(t)?ot.NUMERIC:Gu.testAlphanumeric(t)?ot.ALPHANUMERIC:Gu.testKanji(t)?ot.KANJI:ot.BYTE};ot.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};ot.isValid=function(t){return t&&t.bit&&t.ccBits};function l3(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return ot.NUMERIC;case"alphanumeric":return ot.ALPHANUMERIC;case"kanji":return ot.KANJI;case"byte":return ot.BYTE;default:throw new Error("Unknown mode: "+e)}}ot.from=function(t,r){if(ot.isValid(t))return t;try{return l3(t)}catch(n){return r}}});var oy=we(hi=>{var Wc=Bn(),d3=zu(),ty=Mc(),Ln=Un(),qu=Wu(),ry=1<<12|1<<11|1<<10|1<<9|1<<8|1<<5|1<<2|1<<0,ny=Wc.getBCHDigit(ry);function h3(e,t,r){for(let n=1;n<=40;n++)if(t<=hi.getCapacity(n,r,e))return n}function iy(e,t){return Ln.getCharCountIndicator(e,t)+4}function u3(e,t){let r=0;return e.forEach(function(n){r+=iy(n.mode,t)+n.getBitsLength()}),r}function p3(e,t){for(let r=1;r<=40;r++)if(u3(e,r)<=hi.getCapacity(r,t,Ln.MIXED))return r}hi.from=function(t,r){return qu.isValid(t)?parseInt(t,10):r};hi.getCapacity=function(t,r,n){if(!qu.isValid(t))throw new Error("Invalid QR Code version");typeof n=="undefined"&&(n=Ln.BYTE);let i=Wc.getSymbolTotalCodewords(t),o=d3.getTotalCodewordsCount(t,r),s=(i-o)*8;if(n===Ln.MIXED)return s;let a=s-iy(n,t);switch(n){case Ln.NUMERIC:return Math.floor(a/10*3);case Ln.ALPHANUMERIC:return Math.floor(a/11*2);case Ln.KANJI:return Math.floor(a/13);case Ln.BYTE:default:return Math.floor(a/8)}};hi.getBestVersionForData=function(t,r){let n,i=ty.from(r,ty.M);if(Array.isArray(t)){if(t.length>1)return p3(t,i);if(t.length===0)return 1;n=t[0]}else n=t;return h3(n.mode,n.getLength(),i)};hi.getEncodedBits=function(t){if(!qu.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;Wc.getBCHDigit(r)-ny>=0;)r^=ry<<Wc.getBCHDigit(r)-ny;return t<<12|r}});var ly=we(sy=>{var Ku=Bn(),ay=1<<10|1<<8|1<<5|1<<4|1<<2|1<<1|1<<0,f3=1<<14|1<<12|1<<10|1<<4|1<<1,cy=Ku.getBCHDigit(ay);sy.getEncodedBits=function(t,r){let n=t.bit<<3|r,i=n<<10;for(;Ku.getBCHDigit(i)-cy>=0;)i^=ay<<Ku.getBCHDigit(i)-cy;return(n<<10|i)^f3}});var hy=we((aT,dy)=>{var m3=Un();function lo(e){this.mode=m3.NUMERIC,this.data=e.toString()}lo.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};lo.prototype.getLength=function(){return this.data.length};lo.prototype.getBitsLength=function(){return lo.getBitsLength(this.data.length)};lo.prototype.write=function(t){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),t.put(i,10);let o=this.data.length-r;o>0&&(n=this.data.substr(r),i=parseInt(n,10),t.put(i,o*3+1))};dy.exports=lo});var py=we((cT,uy)=>{var g3=Un(),Xu=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ho(e){this.mode=g3.ALPHANUMERIC,this.data=e}ho.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};ho.prototype.getLength=function(){return this.data.length};ho.prototype.getBitsLength=function(){return ho.getBitsLength(this.data.length)};ho.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Xu.indexOf(this.data[r])*45;n+=Xu.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(Xu.indexOf(this.data[r]),6)};uy.exports=ho});var my=we((lT,fy)=>{var y3=Un();function uo(e){this.mode=y3.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}uo.getBitsLength=function(t){return t*8};uo.prototype.getLength=function(){return this.data.length};uo.prototype.getBitsLength=function(){return uo.getBitsLength(this.data.length)};uo.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};fy.exports=uo});var yy=we((dT,gy)=>{var b3=Un(),v3=Bn();function po(e){this.mode=b3.KANJI,this.data=e}po.getBitsLength=function(t){return t*13};po.prototype.getLength=function(){return this.data.length};po.prototype.getBitsLength=function(){return po.getBitsLength(this.data.length)};po.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=v3.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
4
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};gy.exports=po});var by=we((hT,Ju)=>{"use strict";var _s={single_source_shortest_paths:function(e,t,r){var n={},i={};i[t]=0;var o=_s.PriorityQueue.make();o.push(t,0);for(var s,a,c,l,d,h,m,f,g;!o.empty();){s=o.pop(),a=s.value,l=s.cost,d=e[a]||{};for(c in d)d.hasOwnProperty(c)&&(h=d[c],m=l+h,f=i[c],g=typeof i[c]=="undefined",(g||f>m)&&(i[c]=m,o.push(c,m),n[c]=a))}if(typeof r!="undefined"&&typeof i[r]=="undefined"){var u=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(u)}return n},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t,i;n;)r.push(n),i=e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var n=_s.single_source_shortest_paths(e,t,r);return _s.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=_s.PriorityQueue,r={},n;e=e||{};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Ju!="undefined"&&(Ju.exports=_s)});var xy=we(fo=>{var Se=Un(),vy=hy(),wy=py(),_y=my(),ky=yy(),ks=$u(),$c=Bn(),w3=by();function Sy(e){return unescape(encodeURIComponent(e)).length}function Ss(e,t,r){let n=[],i;for(;(i=e.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function Ey(e){let t=Ss(ks.NUMERIC,Se.NUMERIC,e),r=Ss(ks.ALPHANUMERIC,Se.ALPHANUMERIC,e),n,i;return $c.isKanjiModeEnabled()?(n=Ss(ks.BYTE,Se.BYTE,e),i=Ss(ks.KANJI,Se.KANJI,e)):(n=Ss(ks.BYTE_KANJI,Se.BYTE,e),i=[]),t.concat(r,n,i).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function Yu(e,t){switch(t){case Se.NUMERIC:return vy.getBitsLength(e);case Se.ALPHANUMERIC:return wy.getBitsLength(e);case Se.KANJI:return ky.getBitsLength(e);case Se.BYTE:return _y.getBitsLength(e)}}function _3(e){return e.reduce(function(t,r){let n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)},[])}function k3(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case Se.NUMERIC:t.push([n,{data:n.data,mode:Se.ALPHANUMERIC,length:n.length},{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.ALPHANUMERIC:t.push([n,{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.KANJI:t.push([n,{data:n.data,mode:Se.BYTE,length:Sy(n.data)}]);break;case Se.BYTE:t.push([{data:n.data,mode:Se.BYTE,length:Sy(n.data)}])}}return t}function S3(e,t){let r={},n={start:{}},i=["start"];for(let o=0;o<e.length;o++){let s=e[o],a=[];for(let c=0;c<s.length;c++){let l=s[c],d=""+o+c;a.push(d),r[d]={node:l,lastCount:0},n[d]={};for(let h=0;h<i.length;h++){let m=i[h];r[m]&&r[m].node.mode===l.mode?(n[m][d]=Yu(r[m].lastCount+l.length,l.mode)-Yu(r[m].lastCount,l.mode),r[m].lastCount+=l.length):(r[m]&&(r[m].lastCount=l.length),n[m][d]=Yu(l.length,l.mode)+4+Se.getCharCountIndicator(l.mode,t))}}i=a}for(let o=0;o<i.length;o++)n[i[o]].end=0;return{map:n,table:r}}function Cy(e,t){let r,n=Se.getBestModeForData(e);if(r=Se.from(t,n),r!==Se.BYTE&&r.bit<n.bit)throw new Error('"'+e+'" cannot be encoded with mode '+Se.toString(r)+`.
5
- Suggested mode is: `+Se.toString(n));switch(r===Se.KANJI&&!$c.isKanjiModeEnabled()&&(r=Se.BYTE),r){case Se.NUMERIC:return new vy(e);case Se.ALPHANUMERIC:return new wy(e);case Se.KANJI:return new ky(e);case Se.BYTE:return new _y(e)}}fo.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(Cy(n,null)):n.data&&r.push(Cy(n.data,n.mode)),r},[])};fo.fromString=function(t,r){let n=Ey(t,$c.isKanjiModeEnabled()),i=k3(n),o=S3(i,r),s=w3.find_path(o.map,"start","end"),a=[];for(let c=1;c<s.length-1;c++)a.push(o.table[s[c]].node);return fo.fromArray(_3(a))};fo.rawSplit=function(t){return fo.fromArray(Ey(t,$c.isKanjiModeEnabled()))}});var Ty=we(Ay=>{var Gc=Bn(),Zu=Mc(),E3=j2(),C3=V2(),x3=H2(),A3=G2(),Qu=q2(),ep=zu(),T3=Z2(),qc=oy(),I3=ly(),R3=Un(),tp=xy();function P3(e,t){let r=e.size,n=A3.getPositions(t);for(let i=0;i<n.length;i++){let o=n[i][0],s=n[i][1];for(let a=-1;a<=7;a++)if(!(o+a<=-1||r<=o+a))for(let c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?e.set(o+a,s+c,!0,!0):e.set(o+a,s+c,!1,!0))}}function D3(e){let t=e.size;for(let r=8;r<t-8;r++){let n=r%2==0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function B3(e,t){let r=x3.getPositions(t);for(let n=0;n<r.length;n++){let i=r[n][0],o=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(i+s,o+a,!0,!0):e.set(i+s,o+a,!1,!0)}}function O3(e,t){let r=e.size,n=qc.getEncodedBits(t),i,o,s;for(let a=0;a<18;a++)i=Math.floor(a/3),o=a%3+r-8-3,s=(n>>a&1)==1,e.set(i,o,s,!0),e.set(o,i,s,!0)}function rp(e,t,r){let n=e.size,i=I3.getEncodedBits(t,r),o,s;for(o=0;o<15;o++)s=(i>>o&1)==1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}function U3(e,t){let r=e.size,n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!e.isReserved(i,a-c)){let l=!1;s<t.length&&(l=(t[s]>>>o&1)==1),e.set(i,a-c,l),o--,o===-1&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function F3(e,t,r){let n=new E3;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),R3.getCharCountIndicator(c.mode,e)),c.write(n)});let i=Gc.getSymbolTotalCodewords(e),o=ep.getTotalCodewordsCount(e,t),s=(i-o)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!=0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let c=0;c<a;c++)n.put(c%2?17:236,8);return L3(n,e,t)}function L3(e,t,r){let n=Gc.getSymbolTotalCodewords(t),i=ep.getTotalCodewordsCount(t,r),o=n-i,s=ep.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),d=Math.floor(o/s),h=d+1,m=l-d,f=new T3(m),g=0,u=new Array(s),b=new Array(s),v=0,k=new Uint8Array(e.buffer);for(let P=0;P<s;P++){let M=P<c?d:h;u[P]=k.slice(g,g+M),b[P]=f.encode(u[P]),g+=M,v=Math.max(v,M)}let S=new Uint8Array(n),I=0,x,B;for(x=0;x<v;x++)for(B=0;B<s;B++)x<u[B].length&&(S[I++]=u[B][x]);for(x=0;x<m;x++)for(B=0;B<s;B++)S[I++]=b[B][x];return S}function M3(e,t,r,n){let i;if(Array.isArray(e))i=tp.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let d=tp.rawSplit(e);l=qc.getBestVersionForData(d,r)}i=tp.fromString(e,l||40)}else throw new Error("Invalid data");let o=qc.getBestVersionForData(i,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=o;else if(t<o)throw new Error(`
1
+ "use strict";(()=>{var Ay=Object.create;var pl=Object.defineProperty;var Ty=Object.getOwnPropertyDescriptor;var Iy=Object.getOwnPropertyNames;var Ry=Object.getPrototypeOf,Py=Object.prototype.hasOwnProperty;var ur=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dy=(e,t)=>{for(var r in t)pl(e,r,{get:t[r],enumerable:!0})},By=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Iy(t))!Py.call(e,i)&&i!==r&&pl(e,i,{get:()=>t[i],enumerable:!(n=Ty(t,i))||n.enumerable});return e};var fl=(e,t,r)=>(r=e!=null?Ay(Ry(e)):{},By(t||!e||!e.__esModule?pl(r,"default",{value:e,enumerable:!0}):r,e));var c0=_e((a0,Cd)=>{(function(e){typeof a0=="object"&&typeof Cd<"u"?Cd.exports=e():typeof define=="function"&&define.amd?define([],e):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=e()})(function(){return(function e(t,r,n){function i(a,c){if(!r[a]){if(!t[a]){var l=typeof ur=="function"&&ur;if(!c&&l)return l(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var d=r[a]={exports:{}};t[a][0].call(d.exports,function(g){var f=t[a][1][g];return i(f||g)},d,d.exports,e,t,r,n)}return r[a].exports}for(var o=typeof ur=="function"&&ur,s=0;s<n.length;s++)i(n[s]);return i})({1:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./support"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(s){for(var a,c,l,h,d,g,f,m=[],u=0,b=s.length,_=b,k=n.getTypeOf(s)!=="string";u<s.length;)_=b-u,l=k?(a=s[u++],c=u<b?s[u++]:0,u<b?s[u++]:0):(a=s.charCodeAt(u++),c=u<b?s.charCodeAt(u++):0,u<b?s.charCodeAt(u++):0),h=a>>2,d=(3&a)<<4|c>>4,g=1<_?(15&c)<<2|l>>6:64,f=2<_?63&l:64,m.push(o.charAt(h)+o.charAt(d)+o.charAt(g)+o.charAt(f));return m.join("")},r.decode=function(s){var a,c,l,h,d,g,f=0,m=0,u="data:";if(s.substr(0,u.length)===u)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(s=s.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(s.charAt(s.length-1)===o.charAt(64)&&_--,s.charAt(s.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|_):new Array(0|_);f<s.length;)a=o.indexOf(s.charAt(f++))<<2|(h=o.indexOf(s.charAt(f++)))>>4,c=(15&h)<<4|(d=o.indexOf(s.charAt(f++)))>>2,l=(3&d)<<6|(g=o.indexOf(s.charAt(f++))),b[m++]=a,d!==64&&(b[m++]=c),g!==64&&(b[m++]=l);return b}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var n=e("./external"),i=e("./stream/DataWorker"),o=e("./stream/Crc32Probe"),s=e("./stream/DataLengthProbe");function a(c,l,h,d,g){this.compressedSize=c,this.uncompressedSize=l,this.crc32=h,this.compression=d,this.compressedContent=g}a.prototype={getContentWorker:function(){var c=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new s("data_length")),l=this;return c.on("end",function(){if(this.streamInfo.data_length!==l.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(c,l,h){return c.pipe(new o).pipe(new s("uncompressedSize")).pipe(l.compressWorker(h)).pipe(new s("compressedSize")).withStreamInfo("compression",l)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var n=e("./utils"),i=(function(){for(var o,s=[],a=0;a<256;a++){o=a;for(var c=0;c<8;c++)o=1&o?3988292384^o>>>1:o>>>1;s[a]=o}return s})();t.exports=function(o,s){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?(function(a,c,l,h){var d=i,g=h+l;a^=-1;for(var f=h;f<g;f++)a=a>>>8^d[255&(a^c[f])];return-1^a})(0|s,o,o.length,0):(function(a,c,l,h){var d=i,g=h+l;a^=-1;for(var f=h;f<g;f++)a=a>>>8^d[255&(a^c.charCodeAt(f))];return-1^a})(0|s,o,o.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var n=null;n=typeof Promise<"u"?Promise:e("lie"),t.exports={Promise:n}},{lie:37}],7:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),a=n?"uint8array":"array";function c(l,h){s.call(this,"FlateWorker/"+l),this._pako=null,this._pakoAction=l,this._pakoOptions=h,this.meta={}}r.magic="\b\0",o.inherits(c,s),c.prototype.processChunk=function(l){this.meta=l.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(a,l.data),!1)},c.prototype.flush=function(){s.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var l=this;this._pako.onData=function(h){l.push({data:h,meta:l.meta})}},r.compressWorker=function(l){return new c("Deflate",l)},r.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function n(d,g){var f,m="";for(f=0;f<g;f++)m+=String.fromCharCode(255&d),d>>>=8;return m}function i(d,g,f,m,u,b){var _,k,S=d.file,I=d.compression,x=b!==a.utf8encode,D=o.transformTo("string",b(S.name)),P=o.transformTo("string",a.utf8encode(S.name)),M=S.comment,J=o.transformTo("string",b(M)),E=o.transformTo("string",a.utf8encode(M)),U=P.length!==S.name.length,y=E.length!==M.length,F="",ae="",V="",ce=S.dir,H=S.date,oe={crc32:0,compressedSize:0,uncompressedSize:0};g&&!f||(oe.crc32=d.crc32,oe.compressedSize=d.compressedSize,oe.uncompressedSize=d.uncompressedSize);var B=0;g&&(B|=8),x||!U&&!y||(B|=2048);var R=0,te=0;ce&&(R|=16),u==="UNIX"?(te=798,R|=(function(G,Ce){var Ke=G;return G||(Ke=Ce?16893:33204),(65535&Ke)<<16})(S.unixPermissions,ce)):(te=20,R|=(function(G){return 63&(G||0)})(S.dosPermissions)),_=H.getUTCHours(),_<<=6,_|=H.getUTCMinutes(),_<<=5,_|=H.getUTCSeconds()/2,k=H.getUTCFullYear()-1980,k<<=4,k|=H.getUTCMonth()+1,k<<=5,k|=H.getUTCDate(),U&&(ae=n(1,1)+n(c(D),4)+P,F+="up"+n(ae.length,2)+ae),y&&(V=n(1,1)+n(c(J),4)+E,F+="uc"+n(V.length,2)+V);var q="";return q+=`
2
+ \0`,q+=n(B,2),q+=I.magic,q+=n(_,2),q+=n(k,2),q+=n(oe.crc32,4),q+=n(oe.compressedSize,4),q+=n(oe.uncompressedSize,4),q+=n(D.length,2),q+=n(F.length,2),{fileRecord:l.LOCAL_FILE_HEADER+q+D+F,dirRecord:l.CENTRAL_FILE_HEADER+n(te,2)+q+n(J.length,2)+"\0\0\0\0"+n(R,4)+n(m,4)+D+F+J}}var o=e("../utils"),s=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function h(d,g,f,m){s.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=f,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(h,s),h.prototype.push=function(d){var g=d.meta.percent||0,f=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,s.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:f?(g+100*(f-m-1))/f:100}}))},h.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var g=this.streamFiles&&!d.file.dir;if(g){var f=i(d,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:f.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(d){this.accumulate=!1;var g=this.streamFiles&&!d.file.dir,f=i(d,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(f.dirRecord),g)this.push({data:(function(m){return l.DATA_DESCRIPTOR+n(m.crc32,4)+n(m.compressedSize,4)+n(m.uncompressedSize,4)})(d),meta:{percent:100}});else for(this.push({data:f.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var d=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var f=this.bytesWritten-d,m=(function(u,b,_,k,S){var I=o.transformTo("string",S(k));return l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+n(u,2)+n(u,2)+n(b,4)+n(_,4)+n(I.length,2)+I})(this.dirRecords.length,f,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(d){this._sources.push(d);var g=this;return d.on("data",function(f){g.processChunk(f)}),d.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),d.on("error",function(f){g.error(f)}),this},h.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(d){var g=this._sources;if(!s.prototype.error.call(this,d))return!1;for(var f=0;f<g.length;f++)try{g[f].error(d)}catch{}return!0},h.prototype.lock=function(){s.prototype.lock.call(this);for(var d=this._sources,g=0;g<d.length;g++)d[g].lock()},t.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var n=e("../compressions"),i=e("./ZipFileWorker");r.generateWorker=function(o,s,a){var c=new i(s.streamFiles,a,s.platform,s.encodeFileName),l=0;try{o.forEach(function(h,d){l++;var g=(function(b,_){var k=b||_,S=n[k];if(!S)throw new Error(k+" is not a valid compression method !");return S})(d.options.compression,s.compression),f=d.options.compressionOptions||s.compressionOptions||{},m=d.dir,u=d.date;d._compressWorker(g,f).withStreamInfo("file",{name:h,dir:m,date:u,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(c)}),c.entriesCount=l}catch(h){c.error(h)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function n(){if(!(this instanceof n))return new n;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new n;for(var o in this)typeof this[o]!="function"&&(i[o]=this[o]);return i}}(n.prototype=e("./object")).loadAsync=e("./load"),n.support=e("./support"),n.defaults=e("./defaults"),n.version="3.10.1",n.loadAsync=function(i,o){return new n().loadAsync(i,o)},n.external=e("./external"),t.exports=n},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var n=e("./utils"),i=e("./external"),o=e("./utf8"),s=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(h){return new i.Promise(function(d,g){var f=h.decompressed.getContentWorker().pipe(new a);f.on("error",function(m){g(m)}).on("end",function(){f.streamInfo.crc32!==h.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}t.exports=function(h,d){var g=this;return d=n.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:o.utf8decode}),c.isNode&&c.isStream(h)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",h,!0,d.optimizedBinaryString,d.base64).then(function(f){var m=new s(d);return m.load(f),m}).then(function(f){var m=[i.Promise.resolve(f)],u=f.files;if(d.checkCRC32)for(var b=0;b<u.length;b++)m.push(l(u[b]));return i.Promise.all(m)}).then(function(f){for(var m=f.shift(),u=m.files,b=0;b<u.length;b++){var _=u[b],k=_.fileNameStr,S=n.resolve(_.fileNameStr);g.file(S,_.decompressed,{binary:!0,optimizedBinaryString:!0,date:_.date,dir:_.dir,comment:_.fileCommentStr.length?_.fileCommentStr:null,unixPermissions:_.unixPermissions,dosPermissions:_.dosPermissions,createFolders:d.createFolders}),_.dir||(g.file(S).unsafeOriginalName=k)}return m.zipComment.length&&(g.comment=m.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../stream/GenericWorker");function o(s,a){i.call(this,"Nodejs stream input adapter for "+s),this._upstreamEnded=!1,this._bindStream(a)}n.inherits(o,i),o.prototype._bindStream=function(s){var a=this;(this._stream=s).pause(),s.on("data",function(c){a.push({data:c,meta:{percent:0}})}).on("error",function(c){a.isPaused?this.generatedError=c:a.error(c)}).on("end",function(){a.isPaused?a._upstreamEnded=!0:a.end()})},o.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=o},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var n=e("readable-stream").Readable;function i(o,s,a){n.call(this,s),this._helper=o;var c=this;o.on("data",function(l,h){c.push(l)||c._helper.pause(),a&&a(h)}).on("error",function(l){c.emit("error",l)}).on("end",function(){c.push(null)})}e("../utils").inherits(i,n),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:typeof Buffer<"u",newBufferFrom:function(n,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(n,i);if(typeof n=="number")throw new Error('The "data" argument must not be a number');return new Buffer(n,i)},allocBuffer:function(n){if(Buffer.alloc)return Buffer.alloc(n);var i=new Buffer(n);return i.fill(0),i},isBuffer:function(n){return Buffer.isBuffer(n)},isStream:function(n){return n&&typeof n.on=="function"&&typeof n.pause=="function"&&typeof n.resume=="function"}}},{}],15:[function(e,t,r){"use strict";function n(S,I,x){var D,P=o.getTypeOf(I),M=o.extend(x||{},c);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(S=u(S)),M.createFolders&&(D=m(S))&&b.call(this,D,!0);var J=P==="string"&&M.binary===!1&&M.base64===!1;x&&x.binary!==void 0||(M.binary=!J),(I instanceof l&&I.uncompressedSize===0||M.dir||!I||I.length===0)&&(M.base64=!1,M.binary=!0,I="",M.compression="STORE",P="string");var E=null;E=I instanceof l||I instanceof s?I:g.isNode&&g.isStream(I)?new f(S,I):o.prepareContent(S,I,M.binary,M.optimizedBinaryString,M.base64);var U=new h(S,E,M);this.files[S]=U}var i=e("./utf8"),o=e("./utils"),s=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),h=e("./zipObject"),d=e("./generate"),g=e("./nodejsUtils"),f=e("./nodejs/NodejsStreamInputAdapter"),m=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var I=S.lastIndexOf("/");return 0<I?S.substring(0,I):""},u=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},b=function(S,I){return I=I!==void 0?I:c.createFolders,S=u(S),this.files[S]||n.call(this,S,null,{dir:!0,createFolders:I}),this.files[S]};function _(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var k={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var I,x,D;for(I in this.files)D=this.files[I],(x=I.slice(this.root.length,I.length))&&I.slice(0,this.root.length)===this.root&&S(x,D)},filter:function(S){var I=[];return this.forEach(function(x,D){S(x,D)&&I.push(D)}),I},file:function(S,I,x){if(arguments.length!==1)return S=this.root+S,n.call(this,S,I,x),this;if(_(S)){var D=S;return this.filter(function(M,J){return!J.dir&&D.test(M)})}var P=this.files[this.root+S];return P&&!P.dir?P:null},folder:function(S){if(!S)return this;if(_(S))return this.filter(function(P,M){return M.dir&&S.test(P)});var I=this.root+S,x=b.call(this,I),D=this.clone();return D.root=x.name,D},remove:function(S){S=this.root+S;var I=this.files[S];if(I||(S.slice(-1)!=="/"&&(S+="/"),I=this.files[S]),I&&!I.dir)delete this.files[S];else for(var x=this.filter(function(P,M){return M.name.slice(0,S.length)===S}),D=0;D<x.length;D++)delete this.files[x[D].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var I,x={};try{if((x=o.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=x.type.toLowerCase(),x.compression=x.compression.toUpperCase(),x.type==="binarystring"&&(x.type="string"),!x.type)throw new Error("No output type specified.");o.checkSupport(x.type),x.platform!=="darwin"&&x.platform!=="freebsd"&&x.platform!=="linux"&&x.platform!=="sunos"||(x.platform="UNIX"),x.platform==="win32"&&(x.platform="DOS");var D=x.comment||this.comment||"";I=d.generateWorker(this,x,D)}catch(P){(I=new s("error")).error(P)}return new a(I,x.type||"string",x.mimeType)},generateAsync:function(S,I){return this.generateInternalStream(S).accumulate(I)},generateNodeStream:function(S,I){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(I)}};t.exports=k},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o);for(var s=0;s<this.data.length;s++)o[s]=255&o[s]}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data[this.zero+o]},i.prototype.lastIndexOfSignature=function(o){for(var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===s&&this.data[h+1]===a&&this.data[h+2]===c&&this.data[h+3]===l)return h-this.zero;return-1},i.prototype.readAndCheckSignature=function(o){var s=o.charCodeAt(0),a=o.charCodeAt(1),c=o.charCodeAt(2),l=o.charCodeAt(3),h=this.readData(4);return s===h[0]&&a===h[1]&&c===h[2]&&l===h[3]},i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return[];var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var n=e("../utils");function i(o){this.data=o,this.length=o.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(o){this.checkIndex(this.index+o)},checkIndex:function(o){if(this.length<this.zero+o||o<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+o+"). Corrupted zip ?")},setIndex:function(o){this.checkIndex(o),this.index=o},skip:function(o){this.setIndex(this.index+o)},byteAt:function(){},readInt:function(o){var s,a=0;for(this.checkOffset(o),s=this.index+o-1;s>=this.index;s--)a=(a<<8)+this.byteAt(s);return this.index+=o,a},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,r){"use strict";var n=e("./Uint8ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var n=e("./DataReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},i.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},i.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},i.prototype.readData=function(o){this.checkOffset(o);var s=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var n=e("./ArrayReader");function i(o){n.call(this,o)}e("../utils").inherits(i,n),i.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var s=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,s},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var n=e("../utils"),i=e("../support"),o=e("./ArrayReader"),s=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(l){var h=n.getTypeOf(l);return n.checkSupport(h),h!=="string"||i.uint8array?h==="nodebuffer"?new a(l):i.uint8array?new c(n.transformTo("uint8array",l)):new o(n.transformTo("array",l)):new s(l)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../utils");function o(s){n.call(this,"ConvertWorker to "+s),this.destType=s}i.inherits(o,n),o.prototype.processChunk=function(s){this.push({data:i.transformTo(this.destType,s.data),meta:s.meta})},t.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var n=e("./GenericWorker"),i=e("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(o,n),o.prototype.processChunk=function(s){this.streamInfo.crc32=i(s.data,this.streamInfo.crc32||0),this.push(s)},t.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataLengthProbe for "+s),this.propName=s,this.withStreamInfo(s,0)}n.inherits(o,i),o.prototype.processChunk=function(s){if(s){var a=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=a+s.data.length}i.prototype.processChunk.call(this,s)},t.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./GenericWorker");function o(s){i.call(this,"DataWorker");var a=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,s.then(function(c){a.dataIsReady=!0,a.data=c,a.max=c&&c.length||0,a.type=n.getTypeOf(c),a.isPaused||a._tickAndRepeat()},function(c){a.error(c)})}n.inherits(o,i),o.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var s=null,a=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":s=this.data.substring(this.index,a);break;case"uint8array":s=this.data.subarray(this.index,a);break;case"array":case"nodebuffer":s=this.data.slice(this.index,a)}return this.index=a,this.push({data:s,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function n(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,o){return this._listeners[i].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,o){if(this._listeners[i])for(var s=0;s<this._listeners[i].length;s++)this._listeners[i][s].call(this,o)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var o=this;return i.on("data",function(s){o.processChunk(s)}),i.on("end",function(){o.end()}),i.on("error",function(s){o.error(s)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,o){return this.extraStreamInfo[i]=o,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},t.exports=n},{}],29:[function(e,t,r){"use strict";var n=e("../utils"),i=e("./ConvertWorker"),o=e("./GenericWorker"),s=e("../base64"),a=e("../support"),c=e("../external"),l=null;if(a.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(g,f){return new c.Promise(function(m,u){var b=[],_=g._internalType,k=g._outputType,S=g._mimeType;g.on("data",function(I,x){b.push(I),f&&f(x)}).on("error",function(I){b=[],u(I)}).on("end",function(){try{var I=(function(x,D,P){switch(x){case"blob":return n.newBlob(n.transformTo("arraybuffer",D),P);case"base64":return s.encode(D);default:return n.transformTo(x,D)}})(k,(function(x,D){var P,M=0,J=null,E=0;for(P=0;P<D.length;P++)E+=D[P].length;switch(x){case"string":return D.join("");case"array":return Array.prototype.concat.apply([],D);case"uint8array":for(J=new Uint8Array(E),P=0;P<D.length;P++)J.set(D[P],M),M+=D[P].length;return J;case"nodebuffer":return Buffer.concat(D);default:throw new Error("concat : unsupported type '"+x+"'")}})(_,b),S);m(I)}catch(x){u(x)}b=[]}).resume()})}function d(g,f,m){var u=f;switch(f){case"blob":case"arraybuffer":u="uint8array";break;case"base64":u="string"}try{this._internalType=u,this._outputType=f,this._mimeType=m,n.checkSupport(u),this._worker=g.pipe(new i(u)),g.lock()}catch(b){this._worker=new o("error"),this._worker.error(b)}}d.prototype={accumulate:function(g){return h(this,g)},on:function(g,f){var m=this;return g==="data"?this._worker.on(g,function(u){f.call(m,u.data,u.meta)}):this._worker.on(g,function(){n.delay(f,arguments,m)}),this},resume:function(){return n.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(n.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new l(this,{objectMode:this._outputType!=="nodebuffer"},g)}},t.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",r.nodebuffer=typeof Buffer<"u",r.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(n),r.blob=i.getBlob("application/zip").size===0}catch{r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch{r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var n=e("./utils"),i=e("./support"),o=e("./nodejsUtils"),s=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;a[254]=a[254]=1;function l(){s.call(this,"utf-8 decode"),this.leftOver=null}function h(){s.call(this,"utf-8 encode")}r.utf8encode=function(d){return i.nodebuffer?o.newBufferFrom(d,"utf-8"):(function(g){var f,m,u,b,_,k=g.length,S=0;for(b=0;b<k;b++)(64512&(m=g.charCodeAt(b)))==55296&&b+1<k&&(64512&(u=g.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(u-56320),b++),S+=m<128?1:m<2048?2:m<65536?3:4;for(f=i.uint8array?new Uint8Array(S):new Array(S),b=_=0;_<S;b++)(64512&(m=g.charCodeAt(b)))==55296&&b+1<k&&(64512&(u=g.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(u-56320),b++),m<128?f[_++]=m:(m<2048?f[_++]=192|m>>>6:(m<65536?f[_++]=224|m>>>12:(f[_++]=240|m>>>18,f[_++]=128|m>>>12&63),f[_++]=128|m>>>6&63),f[_++]=128|63&m);return f})(d)},r.utf8decode=function(d){return i.nodebuffer?n.transformTo("nodebuffer",d).toString("utf-8"):(function(g){var f,m,u,b,_=g.length,k=new Array(2*_);for(f=m=0;f<_;)if((u=g[f++])<128)k[m++]=u;else if(4<(b=a[u]))k[m++]=65533,f+=b-1;else{for(u&=b===2?31:b===3?15:7;1<b&&f<_;)u=u<<6|63&g[f++],b--;1<b?k[m++]=65533:u<65536?k[m++]=u:(u-=65536,k[m++]=55296|u>>10&1023,k[m++]=56320|1023&u)}return k.length!==m&&(k.subarray?k=k.subarray(0,m):k.length=m),n.applyFromCharCode(k)})(d=n.transformTo(i.uint8array?"uint8array":"array",d))},n.inherits(l,s),l.prototype.processChunk=function(d){var g=n.transformTo(i.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var f=g;(g=new Uint8Array(f.length+this.leftOver.length)).set(this.leftOver,0),g.set(f,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var m=(function(b,_){var k;for((_=_||b.length)>b.length&&(_=b.length),k=_-1;0<=k&&(192&b[k])==128;)k--;return k<0||k===0?_:k+a[b[k]]>_?k:_})(g),u=g;m!==g.length&&(i.uint8array?(u=g.subarray(0,m),this.leftOver=g.subarray(m,g.length)):(u=g.slice(0,m),this.leftOver=g.slice(m,g.length))),this.push({data:r.utf8decode(u),meta:d.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=l,n.inherits(h,s),h.prototype.processChunk=function(d){this.push({data:r.utf8encode(d.data),meta:d.meta})},r.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var n=e("./support"),i=e("./base64"),o=e("./nodejsUtils"),s=e("./external");function a(f){return f}function c(f,m){for(var u=0;u<f.length;++u)m[u]=255&f.charCodeAt(u);return m}e("setimmediate"),r.newBlob=function(f,m){r.checkSupport("blob");try{return new Blob([f],{type:m})}catch{try{var u=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return u.append(f),u.getBlob(m)}catch{throw new Error("Bug : can't construct the Blob.")}}};var l={stringifyByChunk:function(f,m,u){var b=[],_=0,k=f.length;if(k<=u)return String.fromCharCode.apply(null,f);for(;_<k;)m==="array"||m==="nodebuffer"?b.push(String.fromCharCode.apply(null,f.slice(_,Math.min(_+u,k)))):b.push(String.fromCharCode.apply(null,f.subarray(_,Math.min(_+u,k)))),_+=u;return b.join("")},stringifyByChar:function(f){for(var m="",u=0;u<f.length;u++)m+=String.fromCharCode(f[u]);return m},applyCanBeUsed:{uint8array:(function(){try{return n.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return n.nodebuffer&&String.fromCharCode.apply(null,o.allocBuffer(1)).length===1}catch{return!1}})()}};function h(f){var m=65536,u=r.getTypeOf(f),b=!0;if(u==="uint8array"?b=l.applyCanBeUsed.uint8array:u==="nodebuffer"&&(b=l.applyCanBeUsed.nodebuffer),b)for(;1<m;)try{return l.stringifyByChunk(f,u,m)}catch{m=Math.floor(m/2)}return l.stringifyByChar(f)}function d(f,m){for(var u=0;u<f.length;u++)m[u]=f[u];return m}r.applyFromCharCode=h;var g={};g.string={string:a,array:function(f){return c(f,new Array(f.length))},arraybuffer:function(f){return g.string.uint8array(f).buffer},uint8array:function(f){return c(f,new Uint8Array(f.length))},nodebuffer:function(f){return c(f,o.allocBuffer(f.length))}},g.array={string:h,array:a,arraybuffer:function(f){return new Uint8Array(f).buffer},uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(f)}},g.arraybuffer={string:function(f){return h(new Uint8Array(f))},array:function(f){return d(new Uint8Array(f),new Array(f.byteLength))},arraybuffer:a,uint8array:function(f){return new Uint8Array(f)},nodebuffer:function(f){return o.newBufferFrom(new Uint8Array(f))}},g.uint8array={string:h,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return f.buffer},uint8array:a,nodebuffer:function(f){return o.newBufferFrom(f)}},g.nodebuffer={string:h,array:function(f){return d(f,new Array(f.length))},arraybuffer:function(f){return g.nodebuffer.uint8array(f).buffer},uint8array:function(f){return d(f,new Uint8Array(f.length))},nodebuffer:a},r.transformTo=function(f,m){if(m=m||"",!f)return m;r.checkSupport(f);var u=r.getTypeOf(m);return g[u][f](m)},r.resolve=function(f){for(var m=f.split("/"),u=[],b=0;b<m.length;b++){var _=m[b];_==="."||_===""&&b!==0&&b!==m.length-1||(_===".."?u.pop():u.push(_))}return u.join("/")},r.getTypeOf=function(f){return typeof f=="string"?"string":Object.prototype.toString.call(f)==="[object Array]"?"array":n.nodebuffer&&o.isBuffer(f)?"nodebuffer":n.uint8array&&f instanceof Uint8Array?"uint8array":n.arraybuffer&&f instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(f){if(!n[f.toLowerCase()])throw new Error(f+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(f){var m,u,b="";for(u=0;u<(f||"").length;u++)b+="\\x"+((m=f.charCodeAt(u))<16?"0":"")+m.toString(16).toUpperCase();return b},r.delay=function(f,m,u){setImmediate(function(){f.apply(u||null,m||[])})},r.inherits=function(f,m){function u(){}u.prototype=m.prototype,f.prototype=new u},r.extend=function(){var f,m,u={};for(f=0;f<arguments.length;f++)for(m in arguments[f])Object.prototype.hasOwnProperty.call(arguments[f],m)&&u[m]===void 0&&(u[m]=arguments[f][m]);return u},r.prepareContent=function(f,m,u,b,_){return s.Promise.resolve(m).then(function(k){return n.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new s.Promise(function(S,I){var x=new FileReader;x.onload=function(D){S(D.target.result)},x.onerror=function(D){I(D.target.error)},x.readAsArrayBuffer(k)}):k}).then(function(k){var S=r.getTypeOf(k);return S?(S==="arraybuffer"?k=r.transformTo("uint8array",k):S==="string"&&(_?k=i.decode(k):u&&b!==!0&&(k=(function(I){return c(I,n.uint8array?new Uint8Array(I.length):new Array(I.length))})(k))),k):s.Promise.reject(new Error("Can't read the data of '"+f+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./signature"),s=e("./zipEntry"),a=e("./support");function c(l){this.files=[],this.loadOptions=l}c.prototype={checkSignature:function(l){if(!this.reader.readAndCheckSignature(l)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(h)+", expected "+i.pretty(l)+")")}},isSignature:function(l,h){var d=this.reader.index;this.reader.setIndex(l);var g=this.reader.readString(4)===h;return this.reader.setIndex(d),g},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var l=this.reader.readData(this.zipCommentLength),h=a.uint8array?"uint8array":"array",d=i.transformTo(h,l);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var l,h,d,g=this.zip64EndOfCentralSize-44;0<g;)l=this.reader.readInt(2),h=this.reader.readInt(4),d=this.reader.readData(h),this.zip64ExtensibleData[l]={id:l,length:h,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var l,h;for(l=0;l<this.files.length;l++)h=this.files[l],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(o.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var l;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER);)(l=new s({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(l);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var l=this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);if(l<0)throw this.isSignature(0,o.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(l);var h=l;if(this.checkSignature(o.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(l=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(l),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,o.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var g=h-d;if(0<g)this.isSignature(h,o.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(l){this.reader=n(l)},load:function(l){this.prepareReader(l),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var n=e("./reader/readerFor"),i=e("./utils"),o=e("./compressedObject"),s=e("./crc32"),a=e("./utf8"),c=e("./compressions"),l=e("./support");function h(d,g){this.options=d,this.loadOptions=g}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var g,f;if(d.skip(22),this.fileNameLength=d.readInt(2),f=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(f),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((g=(function(m){for(var u in c)if(Object.prototype.hasOwnProperty.call(c,u)&&c[u].magic===m)return c[u];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,g,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var g=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(g),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var d=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=d.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=d.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=d.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=d.readInt(4))}},readExtraFields:function(d){var g,f,m,u=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<u;)g=d.readInt(2),f=d.readInt(2),m=d.readData(f),this.extraFields[g]={id:g,length:f,value:m};d.setIndex(u)},handleUTF8:function(){var d=l.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var f=i.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(f)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var u=i.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(u)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var g=n(d.value);return g.readInt(1)!==1||s(this.fileName)!==g.readInt(4)?null:a.utf8decode(g.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var g=n(d.value);return g.readInt(1)!==1||s(this.fileComment)!==g.readInt(4)?null:a.utf8decode(g.readData(d.length-5))}return null}},t.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function n(g,f,m){this.name=g,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=f,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var i=e("./stream/StreamHelper"),o=e("./stream/DataWorker"),s=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");n.prototype={internalStream:function(g){var f=null,m="string";try{if(!g)throw new Error("No output type specified.");var u=(m=g.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),f=this._decompressWorker();var b=!this._dataBinary;b&&!u&&(f=f.pipe(new s.Utf8EncodeWorker)),!b&&u&&(f=f.pipe(new s.Utf8DecodeWorker))}catch(_){(f=new c("error")).error(_)}return new i(f,m,"")},async:function(g,f){return this.internalStream(g).accumulate(f)},nodeStream:function(g,f){return this.internalStream(g||"nodebuffer").toNodejsStream(f)},_compressWorker:function(g,f){if(this._data instanceof a&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new s.Utf8EncodeWorker)),a.createWorkerFrom(m,g,f)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new o(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<l.length;d++)n.prototype[l[d]]=h;t.exports=n},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,r){(function(n){"use strict";var i,o,s=n.MutationObserver||n.WebKitMutationObserver;if(s){var a=0,c=new s(g),l=n.document.createTextNode("");c.observe(l,{characterData:!0}),i=function(){l.data=a=++a%2}}else if(n.setImmediate||n.MessageChannel===void 0)i="document"in n&&"onreadystatechange"in n.document.createElement("script")?function(){var f=n.document.createElement("script");f.onreadystatechange=function(){g(),f.onreadystatechange=null,f.parentNode.removeChild(f),f=null},n.document.documentElement.appendChild(f)}:function(){setTimeout(g,0)};else{var h=new n.MessageChannel;h.port1.onmessage=g,i=function(){h.port2.postMessage(0)}}var d=[];function g(){var f,m;o=!0;for(var u=d.length;u;){for(m=d,d=[],f=-1;++f<u;)m[f]();u=d.length}o=!1}t.exports=function(f){d.push(f)!==1||o||i()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(e,t,r){"use strict";var n=e("immediate");function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(u){if(typeof u!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,u!==i&&f(this,u)}function h(u,b,_){this.promise=u,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof _=="function"&&(this.onRejected=_,this.callRejected=this.otherCallRejected)}function d(u,b,_){n(function(){var k;try{k=b(_)}catch(S){return o.reject(u,S)}k===u?o.reject(u,new TypeError("Cannot resolve promise with itself")):o.resolve(u,k)})}function g(u){var b=u&&u.then;if(u&&(typeof u=="object"||typeof u=="function")&&typeof b=="function")return function(){b.apply(u,arguments)}}function f(u,b){var _=!1;function k(x){_||(_=!0,o.reject(u,x))}function S(x){_||(_=!0,o.resolve(u,x))}var I=m(function(){b(S,k)});I.status==="error"&&k(I.value)}function m(u,b){var _={};try{_.value=u(b),_.status="success"}catch(k){_.status="error",_.value=k}return _}(t.exports=l).prototype.finally=function(u){if(typeof u!="function")return this;var b=this.constructor;return this.then(function(_){return b.resolve(u()).then(function(){return _})},function(_){return b.resolve(u()).then(function(){throw _})})},l.prototype.catch=function(u){return this.then(null,u)},l.prototype.then=function(u,b){if(typeof u!="function"&&this.state===a||typeof b!="function"&&this.state===s)return this;var _=new this.constructor(i);return this.state!==c?d(_,this.state===a?u:b,this.outcome):this.queue.push(new h(_,u,b)),_},h.prototype.callFulfilled=function(u){o.resolve(this.promise,u)},h.prototype.otherCallFulfilled=function(u){d(this.promise,this.onFulfilled,u)},h.prototype.callRejected=function(u){o.reject(this.promise,u)},h.prototype.otherCallRejected=function(u){d(this.promise,this.onRejected,u)},o.resolve=function(u,b){var _=m(g,b);if(_.status==="error")return o.reject(u,_.value);var k=_.value;if(k)f(u,k);else{u.state=a,u.outcome=b;for(var S=-1,I=u.queue.length;++S<I;)u.queue[S].callFulfilled(b)}return u},o.reject=function(u,b){u.state=s,u.outcome=b;for(var _=-1,k=u.queue.length;++_<k;)u.queue[_].callRejected(b);return u},l.resolve=function(u){return u instanceof this?u:o.resolve(new this(i),u)},l.reject=function(u){var b=new this(i);return o.reject(b,u)},l.all=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=u.length,k=!1;if(!_)return this.resolve([]);for(var S=new Array(_),I=0,x=-1,D=new this(i);++x<_;)P(u[x],x);return D;function P(M,J){b.resolve(M).then(function(E){S[J]=E,++I!==_||k||(k=!0,o.resolve(D,S))},function(E){k||(k=!0,o.reject(D,E))})}},l.race=function(u){var b=this;if(Object.prototype.toString.call(u)!=="[object Array]")return this.reject(new TypeError("must be an array"));var _=u.length,k=!1;if(!_)return this.resolve([]);for(var S=-1,I=new this(i);++S<_;)x=u[S],b.resolve(x).then(function(D){k||(k=!0,o.resolve(I,D))},function(D){k||(k=!0,o.reject(I,D))});var x;return I}},{immediate:36}],38:[function(e,t,r){"use strict";var n={};(0,e("./lib/utils/common").assign)(n,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=n},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var n=e("./zlib/deflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,h=-1,d=0,g=8;function f(u){if(!(this instanceof f))return new f(u);this.options=i.assign({level:h,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},u||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var _=n.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(_!==l)throw new Error(s[_]);if(b.header&&n.deflateSetHeader(this.strm,b.header),b.dictionary){var k;if(k=typeof b.dictionary=="string"?o.string2buf(b.dictionary):c.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(_=n.deflateSetDictionary(this.strm,k))!==l)throw new Error(s[_]);this._dict_set=!0}}function m(u,b){var _=new f(b);if(_.push(u,!0),_.err)throw _.msg||s[_.err];return _.result}f.prototype.push=function(u,b){var _,k,S=this.strm,I=this.options.chunkSize;if(this.ended)return!1;k=b===~~b?b:b===!0?4:0,typeof u=="string"?S.input=o.string2buf(u):c.call(u)==="[object ArrayBuffer]"?S.input=new Uint8Array(u):S.input=u,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new i.Buf8(I),S.next_out=0,S.avail_out=I),(_=n.deflate(S,k))!==1&&_!==l)return this.onEnd(_),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(o.buf2binstring(i.shrinkBuf(S.output,S.next_out))):this.onData(i.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&_!==1);return k===4?(_=n.deflateEnd(this.strm),this.onEnd(_),this.ended=!0,_===l):k!==2||(this.onEnd(l),!(S.avail_out=0))},f.prototype.onData=function(u){this.chunks.push(u)},f.prototype.onEnd=function(u){u===l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=u,this.msg=this.strm.msg},r.Deflate=f,r.deflate=m,r.deflateRaw=function(u,b){return(b=b||{}).raw=!0,m(u,b)},r.gzip=function(u,b){return(b=b||{}).gzip=!0,m(u,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var n=e("./zlib/inflate"),i=e("./utils/common"),o=e("./utils/strings"),s=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),h=Object.prototype.toString;function d(f){if(!(this instanceof d))return new d(f);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},f||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||f&&f.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var u=n.inflateInit2(this.strm,m.windowBits);if(u!==s.Z_OK)throw new Error(a[u]);this.header=new l,n.inflateGetHeader(this.strm,this.header)}function g(f,m){var u=new d(m);if(u.push(f,!0),u.err)throw u.msg||a[u.err];return u.result}d.prototype.push=function(f,m){var u,b,_,k,S,I,x=this.strm,D=this.options.chunkSize,P=this.options.dictionary,M=!1;if(this.ended)return!1;b=m===~~m?m:m===!0?s.Z_FINISH:s.Z_NO_FLUSH,typeof f=="string"?x.input=o.binstring2buf(f):h.call(f)==="[object ArrayBuffer]"?x.input=new Uint8Array(f):x.input=f,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new i.Buf8(D),x.next_out=0,x.avail_out=D),(u=n.inflate(x,s.Z_NO_FLUSH))===s.Z_NEED_DICT&&P&&(I=typeof P=="string"?o.string2buf(P):h.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,u=n.inflateSetDictionary(this.strm,I)),u===s.Z_BUF_ERROR&&M===!0&&(u=s.Z_OK,M=!1),u!==s.Z_STREAM_END&&u!==s.Z_OK)return this.onEnd(u),!(this.ended=!0);x.next_out&&(x.avail_out!==0&&u!==s.Z_STREAM_END&&(x.avail_in!==0||b!==s.Z_FINISH&&b!==s.Z_SYNC_FLUSH)||(this.options.to==="string"?(_=o.utf8border(x.output,x.next_out),k=x.next_out-_,S=o.buf2string(x.output,_),x.next_out=k,x.avail_out=D-k,k&&i.arraySet(x.output,x.output,_,k,0),this.onData(S)):this.onData(i.shrinkBuf(x.output,x.next_out)))),x.avail_in===0&&x.avail_out===0&&(M=!0)}while((0<x.avail_in||x.avail_out===0)&&u!==s.Z_STREAM_END);return u===s.Z_STREAM_END&&(b=s.Z_FINISH),b===s.Z_FINISH?(u=n.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===s.Z_OK):b!==s.Z_SYNC_FLUSH||(this.onEnd(s.Z_OK),!(x.avail_out=0))},d.prototype.onData=function(f){this.chunks.push(f)},d.prototype.onEnd=function(f){f===s.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=f,this.msg=this.strm.msg},r.Inflate=d,r.inflate=g,r.inflateRaw=function(f,m){return(m=m||{}).raw=!0,g(f,m)},r.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";r.assign=function(s){for(var a=Array.prototype.slice.call(arguments,1);a.length;){var c=a.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var l in c)c.hasOwnProperty(l)&&(s[l]=c[l])}}return s},r.shrinkBuf=function(s,a){return s.length===a?s:s.subarray?s.subarray(0,a):(s.length=a,s)};var i={arraySet:function(s,a,c,l,h){if(a.subarray&&s.subarray)s.set(a.subarray(c,c+l),h);else for(var d=0;d<l;d++)s[h+d]=a[c+d]},flattenChunks:function(s){var a,c,l,h,d,g;for(a=l=0,c=s.length;a<c;a++)l+=s[a].length;for(g=new Uint8Array(l),a=h=0,c=s.length;a<c;a++)d=s[a],g.set(d,h),h+=d.length;return g}},o={arraySet:function(s,a,c,l,h){for(var d=0;d<l;d++)s[h+d]=a[c+d]},flattenChunks:function(s){return[].concat.apply([],s)}};r.setTyped=function(s){s?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,o))},r.setTyped(n)},{}],42:[function(e,t,r){"use strict";var n=e("./common"),i=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{o=!1}for(var s=new n.Buf8(256),a=0;a<256;a++)s[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(l,h){if(h<65537&&(l.subarray&&o||!l.subarray&&i))return String.fromCharCode.apply(null,n.shrinkBuf(l,h));for(var d="",g=0;g<h;g++)d+=String.fromCharCode(l[g]);return d}s[254]=s[254]=1,r.string2buf=function(l){var h,d,g,f,m,u=l.length,b=0;for(f=0;f<u;f++)(64512&(d=l.charCodeAt(f)))==55296&&f+1<u&&(64512&(g=l.charCodeAt(f+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),f++),b+=d<128?1:d<2048?2:d<65536?3:4;for(h=new n.Buf8(b),f=m=0;m<b;f++)(64512&(d=l.charCodeAt(f)))==55296&&f+1<u&&(64512&(g=l.charCodeAt(f+1)))==56320&&(d=65536+(d-55296<<10)+(g-56320),f++),d<128?h[m++]=d:(d<2048?h[m++]=192|d>>>6:(d<65536?h[m++]=224|d>>>12:(h[m++]=240|d>>>18,h[m++]=128|d>>>12&63),h[m++]=128|d>>>6&63),h[m++]=128|63&d);return h},r.buf2binstring=function(l){return c(l,l.length)},r.binstring2buf=function(l){for(var h=new n.Buf8(l.length),d=0,g=h.length;d<g;d++)h[d]=l.charCodeAt(d);return h},r.buf2string=function(l,h){var d,g,f,m,u=h||l.length,b=new Array(2*u);for(d=g=0;d<u;)if((f=l[d++])<128)b[g++]=f;else if(4<(m=s[f]))b[g++]=65533,d+=m-1;else{for(f&=m===2?31:m===3?15:7;1<m&&d<u;)f=f<<6|63&l[d++],m--;1<m?b[g++]=65533:f<65536?b[g++]=f:(f-=65536,b[g++]=55296|f>>10&1023,b[g++]=56320|1023&f)}return c(b,g)},r.utf8border=function(l,h){var d;for((h=h||l.length)>l.length&&(h=l.length),d=h-1;0<=d&&(192&l[d])==128;)d--;return d<0||d===0?h:d+s[l[d]]>h?d:h}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(n,i,o,s){for(var a=65535&n|0,c=n>>>16&65535|0,l=0;o!==0;){for(o-=l=2e3<o?2e3:o;c=c+(a=a+i[s++]|0)|0,--l;);a%=65521,c%=65521}return a|c<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var n=(function(){for(var i,o=[],s=0;s<256;s++){i=s;for(var a=0;a<8;a++)i=1&i?3988292384^i>>>1:i>>>1;o[s]=i}return o})();t.exports=function(i,o,s,a){var c=n,l=a+s;i^=-1;for(var h=a;h<l;h++)i=i>>>8^c[255&(i^o[h])];return-1^i}},{}],46:[function(e,t,r){"use strict";var n,i=e("../utils/common"),o=e("./trees"),s=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,h=4,d=0,g=-2,f=-1,m=4,u=2,b=8,_=9,k=286,S=30,I=19,x=2*k+1,D=15,P=3,M=258,J=M+P+1,E=42,U=113,y=1,F=2,ae=3,V=4;function ce(p,N){return p.msg=c[N],N}function H(p){return(p<<1)-(4<p?9:0)}function oe(p){for(var N=p.length;0<=--N;)p[N]=0}function B(p){var N=p.state,O=N.pending;O>p.avail_out&&(O=p.avail_out),O!==0&&(i.arraySet(p.output,N.pending_buf,N.pending_out,O,p.next_out),p.next_out+=O,N.pending_out+=O,p.total_out+=O,p.avail_out-=O,N.pending-=O,N.pending===0&&(N.pending_out=0))}function R(p,N){o._tr_flush_block(p,0<=p.block_start?p.block_start:-1,p.strstart-p.block_start,N),p.block_start=p.strstart,B(p.strm)}function te(p,N){p.pending_buf[p.pending++]=N}function q(p,N){p.pending_buf[p.pending++]=N>>>8&255,p.pending_buf[p.pending++]=255&N}function G(p,N){var O,w,v=p.max_chain_length,C=p.strstart,z=p.prev_length,j=p.nice_match,A=p.strstart>p.w_size-J?p.strstart-(p.w_size-J):0,$=p.window,K=p.w_mask,W=p.prev,re=p.strstart+M,ke=$[C+z-1],ue=$[C+z];p.prev_length>=p.good_match&&(v>>=2),j>p.lookahead&&(j=p.lookahead);do if($[(O=N)+z]===ue&&$[O+z-1]===ke&&$[O]===$[C]&&$[++O]===$[C+1]){C+=2,O++;do;while($[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&$[++C]===$[++O]&&C<re);if(w=M-(re-C),C=re-M,z<w){if(p.match_start=N,j<=(z=w))break;ke=$[C+z-1],ue=$[C+z]}}while((N=W[N&K])>A&&--v!=0);return z<=p.lookahead?z:p.lookahead}function Ce(p){var N,O,w,v,C,z,j,A,$,K,W=p.w_size;do{if(v=p.window_size-p.lookahead-p.strstart,p.strstart>=W+(W-J)){for(i.arraySet(p.window,p.window,W,W,0),p.match_start-=W,p.strstart-=W,p.block_start-=W,N=O=p.hash_size;w=p.head[--N],p.head[N]=W<=w?w-W:0,--O;);for(N=O=W;w=p.prev[--N],p.prev[N]=W<=w?w-W:0,--O;);v+=W}if(p.strm.avail_in===0)break;if(z=p.strm,j=p.window,A=p.strstart+p.lookahead,$=v,K=void 0,K=z.avail_in,$<K&&(K=$),O=K===0?0:(z.avail_in-=K,i.arraySet(j,z.input,z.next_in,K,A),z.state.wrap===1?z.adler=s(z.adler,j,K,A):z.state.wrap===2&&(z.adler=a(z.adler,j,K,A)),z.next_in+=K,z.total_in+=K,K),p.lookahead+=O,p.lookahead+p.insert>=P)for(C=p.strstart-p.insert,p.ins_h=p.window[C],p.ins_h=(p.ins_h<<p.hash_shift^p.window[C+1])&p.hash_mask;p.insert&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[C+P-1])&p.hash_mask,p.prev[C&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=C,C++,p.insert--,!(p.lookahead+p.insert<P)););}while(p.lookahead<J&&p.strm.avail_in!==0)}function Ke(p,N){for(var O,w;;){if(p.lookahead<J){if(Ce(p),p.lookahead<J&&N===l)return y;if(p.lookahead===0)break}if(O=0,p.lookahead>=P&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),O!==0&&p.strstart-O<=p.w_size-J&&(p.match_length=G(p,O)),p.match_length>=P)if(w=o._tr_tally(p,p.strstart-p.match_start,p.match_length-P),p.lookahead-=p.match_length,p.match_length<=p.max_lazy_match&&p.lookahead>=P){for(p.match_length--;p.strstart++,p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart,--p.match_length!=0;);p.strstart++}else p.strstart+=p.match_length,p.match_length=0,p.ins_h=p.window[p.strstart],p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+1])&p.hash_mask;else w=o._tr_tally(p,0,p.window[p.strstart]),p.lookahead--,p.strstart++;if(w&&(R(p,!1),p.strm.avail_out===0))return y}return p.insert=p.strstart<P-1?p.strstart:P-1,N===h?(R(p,!0),p.strm.avail_out===0?ae:V):p.last_lit&&(R(p,!1),p.strm.avail_out===0)?y:F}function de(p,N){for(var O,w,v;;){if(p.lookahead<J){if(Ce(p),p.lookahead<J&&N===l)return y;if(p.lookahead===0)break}if(O=0,p.lookahead>=P&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),p.prev_length=p.match_length,p.prev_match=p.match_start,p.match_length=P-1,O!==0&&p.prev_length<p.max_lazy_match&&p.strstart-O<=p.w_size-J&&(p.match_length=G(p,O),p.match_length<=5&&(p.strategy===1||p.match_length===P&&4096<p.strstart-p.match_start)&&(p.match_length=P-1)),p.prev_length>=P&&p.match_length<=p.prev_length){for(v=p.strstart+p.lookahead-P,w=o._tr_tally(p,p.strstart-1-p.prev_match,p.prev_length-P),p.lookahead-=p.prev_length-1,p.prev_length-=2;++p.strstart<=v&&(p.ins_h=(p.ins_h<<p.hash_shift^p.window[p.strstart+P-1])&p.hash_mask,O=p.prev[p.strstart&p.w_mask]=p.head[p.ins_h],p.head[p.ins_h]=p.strstart),--p.prev_length!=0;);if(p.match_available=0,p.match_length=P-1,p.strstart++,w&&(R(p,!1),p.strm.avail_out===0))return y}else if(p.match_available){if((w=o._tr_tally(p,0,p.window[p.strstart-1]))&&R(p,!1),p.strstart++,p.lookahead--,p.strm.avail_out===0)return y}else p.match_available=1,p.strstart++,p.lookahead--}return p.match_available&&(w=o._tr_tally(p,0,p.window[p.strstart-1]),p.match_available=0),p.insert=p.strstart<P-1?p.strstart:P-1,N===h?(R(p,!0),p.strm.avail_out===0?ae:V):p.last_lit&&(R(p,!1),p.strm.avail_out===0)?y:F}function ge(p,N,O,w,v){this.good_length=p,this.max_lazy=N,this.nice_length=O,this.max_chain=w,this.func=v}function Xe(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*x),this.dyn_dtree=new i.Buf16(2*(2*S+1)),this.bl_tree=new i.Buf16(2*(2*I+1)),oe(this.dyn_ltree),oe(this.dyn_dtree),oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(D+1),this.heap=new i.Buf16(2*k+1),oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*k+1),oe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function ve(p){var N;return p&&p.state?(p.total_in=p.total_out=0,p.data_type=u,(N=p.state).pending=0,N.pending_out=0,N.wrap<0&&(N.wrap=-N.wrap),N.status=N.wrap?E:U,p.adler=N.wrap===2?0:1,N.last_flush=l,o._tr_init(N),d):ce(p,g)}function it(p){var N=ve(p);return N===d&&(function(O){O.window_size=2*O.w_size,oe(O.head),O.max_lazy_match=n[O.level].max_lazy,O.good_match=n[O.level].good_length,O.nice_match=n[O.level].nice_length,O.max_chain_length=n[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=P-1,O.match_available=0,O.ins_h=0})(p.state),N}function ut(p,N,O,w,v,C){if(!p)return g;var z=1;if(N===f&&(N=6),w<0?(z=0,w=-w):15<w&&(z=2,w-=16),v<1||_<v||O!==b||w<8||15<w||N<0||9<N||C<0||m<C)return ce(p,g);w===8&&(w=9);var j=new Xe;return(p.state=j).strm=p,j.wrap=z,j.gzhead=null,j.w_bits=w,j.w_size=1<<j.w_bits,j.w_mask=j.w_size-1,j.hash_bits=v+7,j.hash_size=1<<j.hash_bits,j.hash_mask=j.hash_size-1,j.hash_shift=~~((j.hash_bits+P-1)/P),j.window=new i.Buf8(2*j.w_size),j.head=new i.Buf16(j.hash_size),j.prev=new i.Buf16(j.w_size),j.lit_bufsize=1<<v+6,j.pending_buf_size=4*j.lit_bufsize,j.pending_buf=new i.Buf8(j.pending_buf_size),j.d_buf=1*j.lit_bufsize,j.l_buf=3*j.lit_bufsize,j.level=N,j.strategy=C,j.method=O,it(p)}n=[new ge(0,0,0,0,function(p,N){var O=65535;for(O>p.pending_buf_size-5&&(O=p.pending_buf_size-5);;){if(p.lookahead<=1){if(Ce(p),p.lookahead===0&&N===l)return y;if(p.lookahead===0)break}p.strstart+=p.lookahead,p.lookahead=0;var w=p.block_start+O;if((p.strstart===0||p.strstart>=w)&&(p.lookahead=p.strstart-w,p.strstart=w,R(p,!1),p.strm.avail_out===0)||p.strstart-p.block_start>=p.w_size-J&&(R(p,!1),p.strm.avail_out===0))return y}return p.insert=0,N===h?(R(p,!0),p.strm.avail_out===0?ae:V):(p.strstart>p.block_start&&(R(p,!1),p.strm.avail_out),y)}),new ge(4,4,8,4,Ke),new ge(4,5,16,8,Ke),new ge(4,6,32,32,Ke),new ge(4,4,16,16,de),new ge(8,16,32,32,de),new ge(8,16,128,128,de),new ge(8,32,128,256,de),new ge(32,128,258,1024,de),new ge(32,258,258,4096,de)],r.deflateInit=function(p,N){return ut(p,N,b,15,8,0)},r.deflateInit2=ut,r.deflateReset=it,r.deflateResetKeep=ve,r.deflateSetHeader=function(p,N){return p&&p.state?p.state.wrap!==2?g:(p.state.gzhead=N,d):g},r.deflate=function(p,N){var O,w,v,C;if(!p||!p.state||5<N||N<0)return p?ce(p,g):g;if(w=p.state,!p.output||!p.input&&p.avail_in!==0||w.status===666&&N!==h)return ce(p,p.avail_out===0?-5:g);if(w.strm=p,O=w.last_flush,w.last_flush=N,w.status===E)if(w.wrap===2)p.adler=0,te(w,31),te(w,139),te(w,8),w.gzhead?(te(w,(w.gzhead.text?1:0)+(w.gzhead.hcrc?2:0)+(w.gzhead.extra?4:0)+(w.gzhead.name?8:0)+(w.gzhead.comment?16:0)),te(w,255&w.gzhead.time),te(w,w.gzhead.time>>8&255),te(w,w.gzhead.time>>16&255),te(w,w.gzhead.time>>24&255),te(w,w.level===9?2:2<=w.strategy||w.level<2?4:0),te(w,255&w.gzhead.os),w.gzhead.extra&&w.gzhead.extra.length&&(te(w,255&w.gzhead.extra.length),te(w,w.gzhead.extra.length>>8&255)),w.gzhead.hcrc&&(p.adler=a(p.adler,w.pending_buf,w.pending,0)),w.gzindex=0,w.status=69):(te(w,0),te(w,0),te(w,0),te(w,0),te(w,0),te(w,w.level===9?2:2<=w.strategy||w.level<2?4:0),te(w,3),w.status=U);else{var z=b+(w.w_bits-8<<4)<<8;z|=(2<=w.strategy||w.level<2?0:w.level<6?1:w.level===6?2:3)<<6,w.strstart!==0&&(z|=32),z+=31-z%31,w.status=U,q(w,z),w.strstart!==0&&(q(w,p.adler>>>16),q(w,65535&p.adler)),p.adler=1}if(w.status===69)if(w.gzhead.extra){for(v=w.pending;w.gzindex<(65535&w.gzhead.extra.length)&&(w.pending!==w.pending_buf_size||(w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),B(p),v=w.pending,w.pending!==w.pending_buf_size));)te(w,255&w.gzhead.extra[w.gzindex]),w.gzindex++;w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),w.gzindex===w.gzhead.extra.length&&(w.gzindex=0,w.status=73)}else w.status=73;if(w.status===73)if(w.gzhead.name){v=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),B(p),v=w.pending,w.pending===w.pending_buf_size)){C=1;break}C=w.gzindex<w.gzhead.name.length?255&w.gzhead.name.charCodeAt(w.gzindex++):0,te(w,C)}while(C!==0);w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),C===0&&(w.gzindex=0,w.status=91)}else w.status=91;if(w.status===91)if(w.gzhead.comment){v=w.pending;do{if(w.pending===w.pending_buf_size&&(w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),B(p),v=w.pending,w.pending===w.pending_buf_size)){C=1;break}C=w.gzindex<w.gzhead.comment.length?255&w.gzhead.comment.charCodeAt(w.gzindex++):0,te(w,C)}while(C!==0);w.gzhead.hcrc&&w.pending>v&&(p.adler=a(p.adler,w.pending_buf,w.pending-v,v)),C===0&&(w.status=103)}else w.status=103;if(w.status===103&&(w.gzhead.hcrc?(w.pending+2>w.pending_buf_size&&B(p),w.pending+2<=w.pending_buf_size&&(te(w,255&p.adler),te(w,p.adler>>8&255),p.adler=0,w.status=U)):w.status=U),w.pending!==0){if(B(p),p.avail_out===0)return w.last_flush=-1,d}else if(p.avail_in===0&&H(N)<=H(O)&&N!==h)return ce(p,-5);if(w.status===666&&p.avail_in!==0)return ce(p,-5);if(p.avail_in!==0||w.lookahead!==0||N!==l&&w.status!==666){var j=w.strategy===2?(function(A,$){for(var K;;){if(A.lookahead===0&&(Ce(A),A.lookahead===0)){if($===l)return y;break}if(A.match_length=0,K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,K&&(R(A,!1),A.strm.avail_out===0))return y}return A.insert=0,$===h?(R(A,!0),A.strm.avail_out===0?ae:V):A.last_lit&&(R(A,!1),A.strm.avail_out===0)?y:F})(w,N):w.strategy===3?(function(A,$){for(var K,W,re,ke,ue=A.window;;){if(A.lookahead<=M){if(Ce(A),A.lookahead<=M&&$===l)return y;if(A.lookahead===0)break}if(A.match_length=0,A.lookahead>=P&&0<A.strstart&&(W=ue[re=A.strstart-1])===ue[++re]&&W===ue[++re]&&W===ue[++re]){ke=A.strstart+M;do;while(W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&W===ue[++re]&&re<ke);A.match_length=M-(ke-re),A.match_length>A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=P?(K=o._tr_tally(A,1,A.match_length-P),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(K=o._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),K&&(R(A,!1),A.strm.avail_out===0))return y}return A.insert=0,$===h?(R(A,!0),A.strm.avail_out===0?ae:V):A.last_lit&&(R(A,!1),A.strm.avail_out===0)?y:F})(w,N):n[w.level].func(w,N);if(j!==ae&&j!==V||(w.status=666),j===y||j===ae)return p.avail_out===0&&(w.last_flush=-1),d;if(j===F&&(N===1?o._tr_align(w):N!==5&&(o._tr_stored_block(w,0,0,!1),N===3&&(oe(w.head),w.lookahead===0&&(w.strstart=0,w.block_start=0,w.insert=0))),B(p),p.avail_out===0))return w.last_flush=-1,d}return N!==h?d:w.wrap<=0?1:(w.wrap===2?(te(w,255&p.adler),te(w,p.adler>>8&255),te(w,p.adler>>16&255),te(w,p.adler>>24&255),te(w,255&p.total_in),te(w,p.total_in>>8&255),te(w,p.total_in>>16&255),te(w,p.total_in>>24&255)):(q(w,p.adler>>>16),q(w,65535&p.adler)),B(p),0<w.wrap&&(w.wrap=-w.wrap),w.pending!==0?d:1)},r.deflateEnd=function(p){var N;return p&&p.state?(N=p.state.status)!==E&&N!==69&&N!==73&&N!==91&&N!==103&&N!==U&&N!==666?ce(p,g):(p.state=null,N===U?ce(p,-3):d):g},r.deflateSetDictionary=function(p,N){var O,w,v,C,z,j,A,$,K=N.length;if(!p||!p.state||(C=(O=p.state).wrap)===2||C===1&&O.status!==E||O.lookahead)return g;for(C===1&&(p.adler=s(p.adler,N,K,0)),O.wrap=0,K>=O.w_size&&(C===0&&(oe(O.head),O.strstart=0,O.block_start=0,O.insert=0),$=new i.Buf8(O.w_size),i.arraySet($,N,K-O.w_size,O.w_size,0),N=$,K=O.w_size),z=p.avail_in,j=p.next_in,A=p.input,p.avail_in=K,p.next_in=0,p.input=N,Ce(O);O.lookahead>=P;){for(w=O.strstart,v=O.lookahead-(P-1);O.ins_h=(O.ins_h<<O.hash_shift^O.window[w+P-1])&O.hash_mask,O.prev[w&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=w,w++,--v;);O.strstart=w,O.lookahead=P-1,Ce(O)}return O.strstart+=O.lookahead,O.block_start=O.strstart,O.insert=O.lookahead,O.lookahead=0,O.match_length=O.prev_length=P-1,O.match_available=0,p.next_in=j,p.input=A,p.avail_in=z,O.wrap=C,d},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(n,i){var o,s,a,c,l,h,d,g,f,m,u,b,_,k,S,I,x,D,P,M,J,E,U,y,F;o=n.state,s=n.next_in,y=n.input,a=s+(n.avail_in-5),c=n.next_out,F=n.output,l=c-(i-n.avail_out),h=c+(n.avail_out-257),d=o.dmax,g=o.wsize,f=o.whave,m=o.wnext,u=o.window,b=o.hold,_=o.bits,k=o.lencode,S=o.distcode,I=(1<<o.lenbits)-1,x=(1<<o.distbits)-1;e:do{_<15&&(b+=y[s++]<<_,_+=8,b+=y[s++]<<_,_+=8),D=k[b&I];t:for(;;){if(b>>>=P=D>>>24,_-=P,(P=D>>>16&255)===0)F[c++]=65535&D;else{if(!(16&P)){if((64&P)==0){D=k[(65535&D)+(b&(1<<P)-1)];continue t}if(32&P){o.mode=12;break e}n.msg="invalid literal/length code",o.mode=30;break e}M=65535&D,(P&=15)&&(_<P&&(b+=y[s++]<<_,_+=8),M+=b&(1<<P)-1,b>>>=P,_-=P),_<15&&(b+=y[s++]<<_,_+=8,b+=y[s++]<<_,_+=8),D=S[b&x];r:for(;;){if(b>>>=P=D>>>24,_-=P,!(16&(P=D>>>16&255))){if((64&P)==0){D=S[(65535&D)+(b&(1<<P)-1)];continue r}n.msg="invalid distance code",o.mode=30;break e}if(J=65535&D,_<(P&=15)&&(b+=y[s++]<<_,(_+=8)<P&&(b+=y[s++]<<_,_+=8)),d<(J+=b&(1<<P)-1)){n.msg="invalid distance too far back",o.mode=30;break e}if(b>>>=P,_-=P,(P=c-l)<J){if(f<(P=J-P)&&o.sane){n.msg="invalid distance too far back",o.mode=30;break e}if(U=u,(E=0)===m){if(E+=g-P,P<M){for(M-=P;F[c++]=u[E++],--P;);E=c-J,U=F}}else if(m<P){if(E+=g+m-P,(P-=m)<M){for(M-=P;F[c++]=u[E++],--P;);if(E=0,m<M){for(M-=P=m;F[c++]=u[E++],--P;);E=c-J,U=F}}}else if(E+=m-P,P<M){for(M-=P;F[c++]=u[E++],--P;);E=c-J,U=F}for(;2<M;)F[c++]=U[E++],F[c++]=U[E++],F[c++]=U[E++],M-=3;M&&(F[c++]=U[E++],1<M&&(F[c++]=U[E++]))}else{for(E=c-J;F[c++]=F[E++],F[c++]=F[E++],F[c++]=F[E++],2<(M-=3););M&&(F[c++]=F[E++],1<M&&(F[c++]=F[E++]))}break}}break}}while(s<a&&c<h);s-=M=_>>3,b&=(1<<(_-=M<<3))-1,n.next_in=s,n.next_out=c,n.avail_in=s<a?a-s+5:5-(s-a),n.avail_out=c<h?h-c+257:257-(c-h),o.hold=b,o.bits=_}},{}],49:[function(e,t,r){"use strict";var n=e("../utils/common"),i=e("./adler32"),o=e("./crc32"),s=e("./inffast"),a=e("./inftrees"),c=1,l=2,h=0,d=-2,g=1,f=852,m=592;function u(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(E){var U;return E&&E.state?(U=E.state,E.total_in=E.total_out=U.total=0,E.msg="",U.wrap&&(E.adler=1&U.wrap),U.mode=g,U.last=0,U.havedict=0,U.dmax=32768,U.head=null,U.hold=0,U.bits=0,U.lencode=U.lendyn=new n.Buf32(f),U.distcode=U.distdyn=new n.Buf32(m),U.sane=1,U.back=-1,h):d}function k(E){var U;return E&&E.state?((U=E.state).wsize=0,U.whave=0,U.wnext=0,_(E)):d}function S(E,U){var y,F;return E&&E.state?(F=E.state,U<0?(y=0,U=-U):(y=1+(U>>4),U<48&&(U&=15)),U&&(U<8||15<U)?d:(F.window!==null&&F.wbits!==U&&(F.window=null),F.wrap=y,F.wbits=U,k(E))):d}function I(E,U){var y,F;return E?(F=new b,(E.state=F).window=null,(y=S(E,U))!==h&&(E.state=null),y):d}var x,D,P=!0;function M(E){if(P){var U;for(x=new n.Buf32(512),D=new n.Buf32(32),U=0;U<144;)E.lens[U++]=8;for(;U<256;)E.lens[U++]=9;for(;U<280;)E.lens[U++]=7;for(;U<288;)E.lens[U++]=8;for(a(c,E.lens,0,288,x,0,E.work,{bits:9}),U=0;U<32;)E.lens[U++]=5;a(l,E.lens,0,32,D,0,E.work,{bits:5}),P=!1}E.lencode=x,E.lenbits=9,E.distcode=D,E.distbits=5}function J(E,U,y,F){var ae,V=E.state;return V.window===null&&(V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new n.Buf8(V.wsize)),F>=V.wsize?(n.arraySet(V.window,U,y-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize):(F<(ae=V.wsize-V.wnext)&&(ae=F),n.arraySet(V.window,U,y-F,ae,V.wnext),(F-=ae)?(n.arraySet(V.window,U,y-F,F,0),V.wnext=F,V.whave=V.wsize):(V.wnext+=ae,V.wnext===V.wsize&&(V.wnext=0),V.whave<V.wsize&&(V.whave+=ae))),0}r.inflateReset=k,r.inflateReset2=S,r.inflateResetKeep=_,r.inflateInit=function(E){return I(E,15)},r.inflateInit2=I,r.inflate=function(E,U){var y,F,ae,V,ce,H,oe,B,R,te,q,G,Ce,Ke,de,ge,Xe,ve,it,ut,p,N,O,w,v=0,C=new n.Buf8(4),z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return d;(y=E.state).mode===12&&(y.mode=13),ce=E.next_out,ae=E.output,oe=E.avail_out,V=E.next_in,F=E.input,H=E.avail_in,B=y.hold,R=y.bits,te=H,q=oe,N=h;e:for(;;)switch(y.mode){case g:if(y.wrap===0){y.mode=13;break}for(;R<16;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(2&y.wrap&&B===35615){C[y.check=0]=255&B,C[1]=B>>>8&255,y.check=o(y.check,C,2,0),R=B=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&B)<<8)+(B>>8))%31){E.msg="incorrect header check",y.mode=30;break}if((15&B)!=8){E.msg="unknown compression method",y.mode=30;break}if(R-=4,p=8+(15&(B>>>=4)),y.wbits===0)y.wbits=p;else if(p>y.wbits){E.msg="invalid window size",y.mode=30;break}y.dmax=1<<p,E.adler=y.check=1,y.mode=512&B?10:12,R=B=0;break;case 2:for(;R<16;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(y.flags=B,(255&y.flags)!=8){E.msg="unknown compression method",y.mode=30;break}if(57344&y.flags){E.msg="unknown header flags set",y.mode=30;break}y.head&&(y.head.text=B>>8&1),512&y.flags&&(C[0]=255&B,C[1]=B>>>8&255,y.check=o(y.check,C,2,0)),R=B=0,y.mode=3;case 3:for(;R<32;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.head&&(y.head.time=B),512&y.flags&&(C[0]=255&B,C[1]=B>>>8&255,C[2]=B>>>16&255,C[3]=B>>>24&255,y.check=o(y.check,C,4,0)),R=B=0,y.mode=4;case 4:for(;R<16;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.head&&(y.head.xflags=255&B,y.head.os=B>>8),512&y.flags&&(C[0]=255&B,C[1]=B>>>8&255,y.check=o(y.check,C,2,0)),R=B=0,y.mode=5;case 5:if(1024&y.flags){for(;R<16;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.length=B,y.head&&(y.head.extra_len=B),512&y.flags&&(C[0]=255&B,C[1]=B>>>8&255,y.check=o(y.check,C,2,0)),R=B=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(H<(G=y.length)&&(G=H),G&&(y.head&&(p=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),n.arraySet(y.head.extra,F,V,G,p)),512&y.flags&&(y.check=o(y.check,F,G,V)),H-=G,V+=G,y.length-=G),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(H===0)break e;for(G=0;p=F[V+G++],y.head&&p&&y.length<65536&&(y.head.name+=String.fromCharCode(p)),p&&G<H;);if(512&y.flags&&(y.check=o(y.check,F,G,V)),H-=G,V+=G,p)break e}else y.head&&(y.head.name=null);y.length=0,y.mode=8;case 8:if(4096&y.flags){if(H===0)break e;for(G=0;p=F[V+G++],y.head&&p&&y.length<65536&&(y.head.comment+=String.fromCharCode(p)),p&&G<H;);if(512&y.flags&&(y.check=o(y.check,F,G,V)),H-=G,V+=G,p)break e}else y.head&&(y.head.comment=null);y.mode=9;case 9:if(512&y.flags){for(;R<16;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(B!==(65535&y.check)){E.msg="header crc mismatch",y.mode=30;break}R=B=0}y.head&&(y.head.hcrc=y.flags>>9&1,y.head.done=!0),E.adler=y.check=0,y.mode=12;break;case 10:for(;R<32;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}E.adler=y.check=u(B),R=B=0,y.mode=11;case 11:if(y.havedict===0)return E.next_out=ce,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=B,y.bits=R,2;E.adler=y.check=1,y.mode=12;case 12:if(U===5||U===6)break e;case 13:if(y.last){B>>>=7&R,R-=7&R,y.mode=27;break}for(;R<3;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}switch(y.last=1&B,R-=1,3&(B>>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,U!==6)break;B>>>=2,R-=2;break e;case 2:y.mode=17;break;case 3:E.msg="invalid block type",y.mode=30}B>>>=2,R-=2;break;case 14:for(B>>>=7&R,R-=7&R;R<32;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if((65535&B)!=(B>>>16^65535)){E.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&B,R=B=0,y.mode=15,U===6)break e;case 15:y.mode=16;case 16:if(G=y.length){if(H<G&&(G=H),oe<G&&(G=oe),G===0)break e;n.arraySet(ae,F,V,G,ce),H-=G,V+=G,oe-=G,ce+=G,y.length-=G;break}y.mode=12;break;case 17:for(;R<14;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(y.nlen=257+(31&B),B>>>=5,R-=5,y.ndist=1+(31&B),B>>>=5,R-=5,y.ncode=4+(15&B),B>>>=4,R-=4,286<y.nlen||30<y.ndist){E.msg="too many length or distance symbols",y.mode=30;break}y.have=0,y.mode=18;case 18:for(;y.have<y.ncode;){for(;R<3;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.lens[z[y.have++]]=7&B,B>>>=3,R-=3}for(;y.have<19;)y.lens[z[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,O={bits:y.lenbits},N=a(0,y.lens,0,19,y.lencode,0,y.work,O),y.lenbits=O.bits,N){E.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have<y.nlen+y.ndist;){for(;ge=(v=y.lencode[B&(1<<y.lenbits)-1])>>>16&255,Xe=65535&v,!((de=v>>>24)<=R);){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(Xe<16)B>>>=de,R-=de,y.lens[y.have++]=Xe;else{if(Xe===16){for(w=de+2;R<w;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(B>>>=de,R-=de,y.have===0){E.msg="invalid bit length repeat",y.mode=30;break}p=y.lens[y.have-1],G=3+(3&B),B>>>=2,R-=2}else if(Xe===17){for(w=de+3;R<w;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}R-=de,p=0,G=3+(7&(B>>>=de)),B>>>=3,R-=3}else{for(w=de+7;R<w;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}R-=de,p=0,G=11+(127&(B>>>=de)),B>>>=7,R-=7}if(y.have+G>y.nlen+y.ndist){E.msg="invalid bit length repeat",y.mode=30;break}for(;G--;)y.lens[y.have++]=p}}if(y.mode===30)break;if(y.lens[256]===0){E.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,O={bits:y.lenbits},N=a(c,y.lens,0,y.nlen,y.lencode,0,y.work,O),y.lenbits=O.bits,N){E.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,O={bits:y.distbits},N=a(l,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,O),y.distbits=O.bits,N){E.msg="invalid distances set",y.mode=30;break}if(y.mode=20,U===6)break e;case 20:y.mode=21;case 21:if(6<=H&&258<=oe){E.next_out=ce,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=B,y.bits=R,s(E,q),ce=E.next_out,ae=E.output,oe=E.avail_out,V=E.next_in,F=E.input,H=E.avail_in,B=y.hold,R=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;ge=(v=y.lencode[B&(1<<y.lenbits)-1])>>>16&255,Xe=65535&v,!((de=v>>>24)<=R);){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(ge&&(240&ge)==0){for(ve=de,it=ge,ut=Xe;ge=(v=y.lencode[ut+((B&(1<<ve+it)-1)>>ve)])>>>16&255,Xe=65535&v,!(ve+(de=v>>>24)<=R);){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}B>>>=ve,R-=ve,y.back+=ve}if(B>>>=de,R-=de,y.back+=de,y.length=Xe,ge===0){y.mode=26;break}if(32&ge){y.back=-1,y.mode=12;break}if(64&ge){E.msg="invalid literal/length code",y.mode=30;break}y.extra=15&ge,y.mode=22;case 22:if(y.extra){for(w=y.extra;R<w;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.length+=B&(1<<y.extra)-1,B>>>=y.extra,R-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;ge=(v=y.distcode[B&(1<<y.distbits)-1])>>>16&255,Xe=65535&v,!((de=v>>>24)<=R);){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if((240&ge)==0){for(ve=de,it=ge,ut=Xe;ge=(v=y.distcode[ut+((B&(1<<ve+it)-1)>>ve)])>>>16&255,Xe=65535&v,!(ve+(de=v>>>24)<=R);){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}B>>>=ve,R-=ve,y.back+=ve}if(B>>>=de,R-=de,y.back+=de,64&ge){E.msg="invalid distance code",y.mode=30;break}y.offset=Xe,y.extra=15&ge,y.mode=24;case 24:if(y.extra){for(w=y.extra;R<w;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}y.offset+=B&(1<<y.extra)-1,B>>>=y.extra,R-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){E.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(oe===0)break e;if(G=q-oe,y.offset>G){if((G=y.offset-G)>y.whave&&y.sane){E.msg="invalid distance too far back",y.mode=30;break}Ce=G>y.wnext?(G-=y.wnext,y.wsize-G):y.wnext-G,G>y.length&&(G=y.length),Ke=y.window}else Ke=ae,Ce=ce-y.offset,G=y.length;for(oe<G&&(G=oe),oe-=G,y.length-=G;ae[ce++]=Ke[Ce++],--G;);y.length===0&&(y.mode=21);break;case 26:if(oe===0)break e;ae[ce++]=y.length,oe--,y.mode=21;break;case 27:if(y.wrap){for(;R<32;){if(H===0)break e;H--,B|=F[V++]<<R,R+=8}if(q-=oe,E.total_out+=q,y.total+=q,q&&(E.adler=y.check=y.flags?o(y.check,ae,q,ce-q):i(y.check,ae,q,ce-q)),q=oe,(y.flags?B:u(B))!==y.check){E.msg="incorrect data check",y.mode=30;break}R=B=0}y.mode=28;case 28:if(y.wrap&&y.flags){for(;R<32;){if(H===0)break e;H--,B+=F[V++]<<R,R+=8}if(B!==(4294967295&y.total)){E.msg="incorrect length check",y.mode=30;break}R=B=0}y.mode=29;case 29:N=1;break e;case 30:N=-3;break e;case 31:return-4;case 32:default:return d}return E.next_out=ce,E.avail_out=oe,E.next_in=V,E.avail_in=H,y.hold=B,y.bits=R,(y.wsize||q!==E.avail_out&&y.mode<30&&(y.mode<27||U!==4))&&J(E,E.output,E.next_out,q-E.avail_out)?(y.mode=31,-4):(te-=E.avail_in,q-=E.avail_out,E.total_in+=te,E.total_out+=q,y.total+=q,y.wrap&&q&&(E.adler=y.check=y.flags?o(y.check,ae,q,E.next_out-q):i(y.check,ae,q,E.next_out-q)),E.data_type=y.bits+(y.last?64:0)+(y.mode===12?128:0)+(y.mode===20||y.mode===15?256:0),(te==0&&q===0||U===4)&&N===h&&(N=-5),N)},r.inflateEnd=function(E){if(!E||!E.state)return d;var U=E.state;return U.window&&(U.window=null),E.state=null,h},r.inflateGetHeader=function(E,U){var y;return E&&E.state?(2&(y=E.state).wrap)==0?d:((y.head=U).done=!1,h):d},r.inflateSetDictionary=function(E,U){var y,F=U.length;return E&&E.state?(y=E.state).wrap!==0&&y.mode!==11?d:y.mode===11&&i(1,U,F,0)!==y.check?-3:J(E,U,F,F)?(y.mode=31,-4):(y.havedict=1,h):d},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var n=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],s=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(c,l,h,d,g,f,m,u){var b,_,k,S,I,x,D,P,M,J=u.bits,E=0,U=0,y=0,F=0,ae=0,V=0,ce=0,H=0,oe=0,B=0,R=null,te=0,q=new n.Buf16(16),G=new n.Buf16(16),Ce=null,Ke=0;for(E=0;E<=15;E++)q[E]=0;for(U=0;U<d;U++)q[l[h+U]]++;for(ae=J,F=15;1<=F&&q[F]===0;F--);if(F<ae&&(ae=F),F===0)return g[f++]=20971520,g[f++]=20971520,u.bits=1,0;for(y=1;y<F&&q[y]===0;y++);for(ae<y&&(ae=y),E=H=1;E<=15;E++)if(H<<=1,(H-=q[E])<0)return-1;if(0<H&&(c===0||F!==1))return-1;for(G[1]=0,E=1;E<15;E++)G[E+1]=G[E]+q[E];for(U=0;U<d;U++)l[h+U]!==0&&(m[G[l[h+U]]++]=U);if(x=c===0?(R=Ce=m,19):c===1?(R=i,te-=257,Ce=o,Ke-=257,256):(R=s,Ce=a,-1),E=y,I=f,ce=U=B=0,k=-1,S=(oe=1<<(V=ae))-1,c===1&&852<oe||c===2&&592<oe)return 1;for(;;){for(D=E-ce,M=m[U]<x?(P=0,m[U]):m[U]>x?(P=Ce[Ke+m[U]],R[te+m[U]]):(P=96,0),b=1<<E-ce,y=_=1<<V;g[I+(B>>ce)+(_-=b)]=D<<24|P<<16|M|0,_!==0;);for(b=1<<E-1;B&b;)b>>=1;if(b!==0?(B&=b-1,B+=b):B=0,U++,--q[E]==0){if(E===F)break;E=l[h+m[U]]}if(ae<E&&(B&S)!==k){for(ce===0&&(ce=ae),I+=y,H=1<<(V=E-ce);V+ce<F&&!((H-=q[V+ce])<=0);)V++,H<<=1;if(oe+=1<<V,c===1&&852<oe||c===2&&592<oe)return 1;g[k=B&S]=ae<<24|V<<16|I-f|0}}return B!==0&&(g[I+B]=E-ce<<24|64<<16|0),u.bits=ae,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var n=e("../utils/common"),i=0,o=1;function s(v){for(var C=v.length;0<=--C;)v[C]=0}var a=0,c=29,l=256,h=l+1+c,d=30,g=19,f=2*h+1,m=15,u=16,b=7,_=256,k=16,S=17,I=18,x=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],D=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],J=new Array(2*(h+2));s(J);var E=new Array(2*d);s(E);var U=new Array(512);s(U);var y=new Array(256);s(y);var F=new Array(c);s(F);var ae,V,ce,H=new Array(d);function oe(v,C,z,j,A){this.static_tree=v,this.extra_bits=C,this.extra_base=z,this.elems=j,this.max_length=A,this.has_stree=v&&v.length}function B(v,C){this.dyn_tree=v,this.max_code=0,this.stat_desc=C}function R(v){return v<256?U[v]:U[256+(v>>>7)]}function te(v,C){v.pending_buf[v.pending++]=255&C,v.pending_buf[v.pending++]=C>>>8&255}function q(v,C,z){v.bi_valid>u-z?(v.bi_buf|=C<<v.bi_valid&65535,te(v,v.bi_buf),v.bi_buf=C>>u-v.bi_valid,v.bi_valid+=z-u):(v.bi_buf|=C<<v.bi_valid&65535,v.bi_valid+=z)}function G(v,C,z){q(v,z[2*C],z[2*C+1])}function Ce(v,C){for(var z=0;z|=1&v,v>>>=1,z<<=1,0<--C;);return z>>>1}function Ke(v,C,z){var j,A,$=new Array(m+1),K=0;for(j=1;j<=m;j++)$[j]=K=K+z[j-1]<<1;for(A=0;A<=C;A++){var W=v[2*A+1];W!==0&&(v[2*A]=Ce($[W]++,W))}}function de(v){var C;for(C=0;C<h;C++)v.dyn_ltree[2*C]=0;for(C=0;C<d;C++)v.dyn_dtree[2*C]=0;for(C=0;C<g;C++)v.bl_tree[2*C]=0;v.dyn_ltree[2*_]=1,v.opt_len=v.static_len=0,v.last_lit=v.matches=0}function ge(v){8<v.bi_valid?te(v,v.bi_buf):0<v.bi_valid&&(v.pending_buf[v.pending++]=v.bi_buf),v.bi_buf=0,v.bi_valid=0}function Xe(v,C,z,j){var A=2*C,$=2*z;return v[A]<v[$]||v[A]===v[$]&&j[C]<=j[z]}function ve(v,C,z){for(var j=v.heap[z],A=z<<1;A<=v.heap_len&&(A<v.heap_len&&Xe(C,v.heap[A+1],v.heap[A],v.depth)&&A++,!Xe(C,j,v.heap[A],v.depth));)v.heap[z]=v.heap[A],z=A,A<<=1;v.heap[z]=j}function it(v,C,z){var j,A,$,K,W=0;if(v.last_lit!==0)for(;j=v.pending_buf[v.d_buf+2*W]<<8|v.pending_buf[v.d_buf+2*W+1],A=v.pending_buf[v.l_buf+W],W++,j===0?G(v,A,C):(G(v,($=y[A])+l+1,C),(K=x[$])!==0&&q(v,A-=F[$],K),G(v,$=R(--j),z),(K=D[$])!==0&&q(v,j-=H[$],K)),W<v.last_lit;);G(v,_,C)}function ut(v,C){var z,j,A,$=C.dyn_tree,K=C.stat_desc.static_tree,W=C.stat_desc.has_stree,re=C.stat_desc.elems,ke=-1;for(v.heap_len=0,v.heap_max=f,z=0;z<re;z++)$[2*z]!==0?(v.heap[++v.heap_len]=ke=z,v.depth[z]=0):$[2*z+1]=0;for(;v.heap_len<2;)$[2*(A=v.heap[++v.heap_len]=ke<2?++ke:0)]=1,v.depth[A]=0,v.opt_len--,W&&(v.static_len-=K[2*A+1]);for(C.max_code=ke,z=v.heap_len>>1;1<=z;z--)ve(v,$,z);for(A=re;z=v.heap[1],v.heap[1]=v.heap[v.heap_len--],ve(v,$,1),j=v.heap[1],v.heap[--v.heap_max]=z,v.heap[--v.heap_max]=j,$[2*A]=$[2*z]+$[2*j],v.depth[A]=(v.depth[z]>=v.depth[j]?v.depth[z]:v.depth[j])+1,$[2*z+1]=$[2*j+1]=A,v.heap[1]=A++,ve(v,$,1),2<=v.heap_len;);v.heap[--v.heap_max]=v.heap[1],(function(ue,kt){var Kt,Xt,Tr,Ie,Pn,oi,gt=kt.dyn_tree,bs=kt.max_code,Dn=kt.stat_desc.static_tree,ul=kt.stat_desc.has_stree,Bn=kt.stat_desc.extra_bits,vs=kt.stat_desc.extra_base,jr=kt.stat_desc.max_length,si=0;for(Ie=0;Ie<=m;Ie++)ue.bl_count[Ie]=0;for(gt[2*ue.heap[ue.heap_max]+1]=0,Kt=ue.heap_max+1;Kt<f;Kt++)jr<(Ie=gt[2*gt[2*(Xt=ue.heap[Kt])+1]+1]+1)&&(Ie=jr,si++),gt[2*Xt+1]=Ie,bs<Xt||(ue.bl_count[Ie]++,Pn=0,vs<=Xt&&(Pn=Bn[Xt-vs]),oi=gt[2*Xt],ue.opt_len+=oi*(Ie+Pn),ul&&(ue.static_len+=oi*(Dn[2*Xt+1]+Pn)));if(si!==0){do{for(Ie=jr-1;ue.bl_count[Ie]===0;)Ie--;ue.bl_count[Ie]--,ue.bl_count[Ie+1]+=2,ue.bl_count[jr]--,si-=2}while(0<si);for(Ie=jr;Ie!==0;Ie--)for(Xt=ue.bl_count[Ie];Xt!==0;)bs<(Tr=ue.heap[--Kt])||(gt[2*Tr+1]!==Ie&&(ue.opt_len+=(Ie-gt[2*Tr+1])*gt[2*Tr],gt[2*Tr+1]=Ie),Xt--)}})(v,C),Ke($,ke,v.bl_count)}function p(v,C,z){var j,A,$=-1,K=C[1],W=0,re=7,ke=4;for(K===0&&(re=138,ke=3),C[2*(z+1)+1]=65535,j=0;j<=z;j++)A=K,K=C[2*(j+1)+1],++W<re&&A===K||(W<ke?v.bl_tree[2*A]+=W:A!==0?(A!==$&&v.bl_tree[2*A]++,v.bl_tree[2*k]++):W<=10?v.bl_tree[2*S]++:v.bl_tree[2*I]++,$=A,ke=(W=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4))}function N(v,C,z){var j,A,$=-1,K=C[1],W=0,re=7,ke=4;for(K===0&&(re=138,ke=3),j=0;j<=z;j++)if(A=K,K=C[2*(j+1)+1],!(++W<re&&A===K)){if(W<ke)for(;G(v,A,v.bl_tree),--W!=0;);else A!==0?(A!==$&&(G(v,A,v.bl_tree),W--),G(v,k,v.bl_tree),q(v,W-3,2)):W<=10?(G(v,S,v.bl_tree),q(v,W-3,3)):(G(v,I,v.bl_tree),q(v,W-11,7));$=A,ke=(W=0)===K?(re=138,3):A===K?(re=6,3):(re=7,4)}}s(H);var O=!1;function w(v,C,z,j){q(v,(a<<1)+(j?1:0),3),(function(A,$,K,W){ge(A),W&&(te(A,K),te(A,~K)),n.arraySet(A.pending_buf,A.window,$,K,A.pending),A.pending+=K})(v,C,z,!0)}r._tr_init=function(v){O||((function(){var C,z,j,A,$,K=new Array(m+1);for(A=j=0;A<c-1;A++)for(F[A]=j,C=0;C<1<<x[A];C++)y[j++]=A;for(y[j-1]=A,A=$=0;A<16;A++)for(H[A]=$,C=0;C<1<<D[A];C++)U[$++]=A;for($>>=7;A<d;A++)for(H[A]=$<<7,C=0;C<1<<D[A]-7;C++)U[256+$++]=A;for(z=0;z<=m;z++)K[z]=0;for(C=0;C<=143;)J[2*C+1]=8,C++,K[8]++;for(;C<=255;)J[2*C+1]=9,C++,K[9]++;for(;C<=279;)J[2*C+1]=7,C++,K[7]++;for(;C<=287;)J[2*C+1]=8,C++,K[8]++;for(Ke(J,h+1,K),C=0;C<d;C++)E[2*C+1]=5,E[2*C]=Ce(C,5);ae=new oe(J,x,l+1,h,m),V=new oe(E,D,0,d,m),ce=new oe(new Array(0),P,0,g,b)})(),O=!0),v.l_desc=new B(v.dyn_ltree,ae),v.d_desc=new B(v.dyn_dtree,V),v.bl_desc=new B(v.bl_tree,ce),v.bi_buf=0,v.bi_valid=0,de(v)},r._tr_stored_block=w,r._tr_flush_block=function(v,C,z,j){var A,$,K=0;0<v.level?(v.strm.data_type===2&&(v.strm.data_type=(function(W){var re,ke=4093624447;for(re=0;re<=31;re++,ke>>>=1)if(1&ke&&W.dyn_ltree[2*re]!==0)return i;if(W.dyn_ltree[18]!==0||W.dyn_ltree[20]!==0||W.dyn_ltree[26]!==0)return o;for(re=32;re<l;re++)if(W.dyn_ltree[2*re]!==0)return o;return i})(v)),ut(v,v.l_desc),ut(v,v.d_desc),K=(function(W){var re;for(p(W,W.dyn_ltree,W.l_desc.max_code),p(W,W.dyn_dtree,W.d_desc.max_code),ut(W,W.bl_desc),re=g-1;3<=re&&W.bl_tree[2*M[re]+1]===0;re--);return W.opt_len+=3*(re+1)+5+5+4,re})(v),A=v.opt_len+3+7>>>3,($=v.static_len+3+7>>>3)<=A&&(A=$)):A=$=z+5,z+4<=A&&C!==-1?w(v,C,z,j):v.strategy===4||$===A?(q(v,2+(j?1:0),3),it(v,J,E)):(q(v,4+(j?1:0),3),(function(W,re,ke,ue){var kt;for(q(W,re-257,5),q(W,ke-1,5),q(W,ue-4,4),kt=0;kt<ue;kt++)q(W,W.bl_tree[2*M[kt]+1],3);N(W,W.dyn_ltree,re-1),N(W,W.dyn_dtree,ke-1)})(v,v.l_desc.max_code+1,v.d_desc.max_code+1,K+1),it(v,v.dyn_ltree,v.dyn_dtree)),de(v),j&&ge(v)},r._tr_tally=function(v,C,z){return v.pending_buf[v.d_buf+2*v.last_lit]=C>>>8&255,v.pending_buf[v.d_buf+2*v.last_lit+1]=255&C,v.pending_buf[v.l_buf+v.last_lit]=255&z,v.last_lit++,C===0?v.dyn_ltree[2*z]++:(v.matches++,C--,v.dyn_ltree[2*(y[z]+l+1)]++,v.dyn_dtree[2*R(C)]++),v.last_lit===v.lit_bufsize-1},r._tr_align=function(v){q(v,2,3),G(v,_,J),(function(C){C.bi_valid===16?(te(C,C.bi_buf),C.bi_buf=0,C.bi_valid=0):8<=C.bi_valid&&(C.pending_buf[C.pending++]=255&C.bi_buf,C.bi_buf>>=8,C.bi_valid-=8)})(v)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,r){(function(n){(function(i,o){"use strict";if(!i.setImmediate){var s,a,c,l,h=1,d={},g=!1,f=i.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(i);m=m&&m.setTimeout?m:i,s={}.toString.call(i.process)==="[object process]"?function(k){process.nextTick(function(){b(k)})}:(function(){if(i.postMessage&&!i.importScripts){var k=!0,S=i.onmessage;return i.onmessage=function(){k=!1},i.postMessage("","*"),i.onmessage=S,k}})()?(l="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",_,!1):i.attachEvent("onmessage",_),function(k){i.postMessage(l+k,"*")}):i.MessageChannel?((c=new MessageChannel).port1.onmessage=function(k){b(k.data)},function(k){c.port2.postMessage(k)}):f&&"onreadystatechange"in f.createElement("script")?(a=f.documentElement,function(k){var S=f.createElement("script");S.onreadystatechange=function(){b(k),S.onreadystatechange=null,a.removeChild(S),S=null},a.appendChild(S)}):function(k){setTimeout(b,0,k)},m.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var S=new Array(arguments.length-1),I=0;I<S.length;I++)S[I]=arguments[I+1];var x={callback:k,args:S};return d[h]=x,s(h),h++},m.clearImmediate=u}function u(k){delete d[k]}function b(k){if(g)setTimeout(b,0,k);else{var S=d[k];if(S){g=!0;try{(function(I){var x=I.callback,D=I.args;switch(D.length){case 0:x();break;case 1:x(D[0]);break;case 2:x(D[0],D[1]);break;case 3:x(D[0],D[1],D[2]);break;default:x.apply(o,D)}})(S)}finally{u(k),g=!1}}}}function _(k){k.source===i&&typeof k.data=="string"&&k.data.indexOf(l)===0&&b(+k.data.slice(l.length))}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})});var xd=_e((Px,ja)=>{(function(e,t){typeof define=="function"&&define.amd?define(t):typeof ja<"u"&&ja.exports?ja.exports=t():window.ysFixWebmDuration=t()})("fix-webm-duration",function(){var e={172351395:{name:"EBML",type:"Container"},646:{name:"EBMLVersion",type:"Uint"},759:{name:"EBMLReadVersion",type:"Uint"},754:{name:"EBMLMaxIDLength",type:"Uint"},755:{name:"EBMLMaxSizeLength",type:"Uint"},642:{name:"DocType",type:"String"},647:{name:"DocTypeVersion",type:"Uint"},645:{name:"DocTypeReadVersion",type:"Uint"},108:{name:"Void",type:"Binary"},63:{name:"CRC-32",type:"Binary"},190023271:{name:"SignatureSlot",type:"Container"},16010:{name:"SignatureAlgo",type:"Uint"},16026:{name:"SignatureHash",type:"Uint"},16037:{name:"SignaturePublicKey",type:"Binary"},16053:{name:"Signature",type:"Binary"},15963:{name:"SignatureElements",type:"Container"},15995:{name:"SignatureElementList",type:"Container"},9522:{name:"SignedElement",type:"Binary"},139690087:{name:"Segment",type:"Container"},21863284:{name:"SeekHead",type:"Container"},3515:{name:"Seek",type:"Container"},5035:{name:"SeekID",type:"Binary"},5036:{name:"SeekPosition",type:"Uint"},88713574:{name:"Info",type:"Container"},13220:{name:"SegmentUID",type:"Binary"},13188:{name:"SegmentFilename",type:"String"},1882403:{name:"PrevUID",type:"Binary"},1868715:{name:"PrevFilename",type:"String"},2013475:{name:"NextUID",type:"Binary"},1999803:{name:"NextFilename",type:"String"},1092:{name:"SegmentFamily",type:"Binary"},10532:{name:"ChapterTranslate",type:"Container"},10748:{name:"ChapterTranslateEditionUID",type:"Uint"},10687:{name:"ChapterTranslateCodec",type:"Uint"},10661:{name:"ChapterTranslateID",type:"Binary"},710577:{name:"TimecodeScale",type:"Uint"},1161:{name:"Duration",type:"Float"},1121:{name:"DateUTC",type:"Date"},15273:{name:"Title",type:"String"},3456:{name:"MuxingApp",type:"String"},5953:{name:"WritingApp",type:"String"},103:{name:"Timecode",type:"Uint"},6228:{name:"SilentTracks",type:"Container"},6359:{name:"SilentTrackNumber",type:"Uint"},39:{name:"Position",type:"Uint"},43:{name:"PrevSize",type:"Uint"},35:{name:"SimpleBlock",type:"Binary"},32:{name:"BlockGroup",type:"Container"},33:{name:"Block",type:"Binary"},34:{name:"BlockVirtual",type:"Binary"},13729:{name:"BlockAdditions",type:"Container"},38:{name:"BlockMore",type:"Container"},110:{name:"BlockAddID",type:"Uint"},37:{name:"BlockAdditional",type:"Binary"},27:{name:"BlockDuration",type:"Uint"},122:{name:"ReferencePriority",type:"Uint"},123:{name:"ReferenceBlock",type:"Int"},125:{name:"ReferenceVirtual",type:"Int"},36:{name:"CodecState",type:"Binary"},13730:{name:"DiscardPadding",type:"Int"},14:{name:"Slices",type:"Container"},104:{name:"TimeSlice",type:"Container"},76:{name:"LaceNumber",type:"Uint"},77:{name:"FrameNumber",type:"Uint"},75:{name:"BlockAdditionID",type:"Uint"},78:{name:"Delay",type:"Uint"},79:{name:"SliceDuration",type:"Uint"},72:{name:"ReferenceFrame",type:"Container"},73:{name:"ReferenceOffset",type:"Uint"},74:{name:"ReferenceTimeCode",type:"Uint"},47:{name:"EncryptedBlock",type:"Binary"},106212971:{name:"Tracks",type:"Container"},46:{name:"TrackEntry",type:"Container"},87:{name:"TrackNumber",type:"Uint"},13253:{name:"TrackUID",type:"Uint"},3:{name:"TrackType",type:"Uint"},57:{name:"FlagEnabled",type:"Uint"},8:{name:"FlagDefault",type:"Uint"},5546:{name:"FlagForced",type:"Uint"},28:{name:"FlagLacing",type:"Uint"},11751:{name:"MinCache",type:"Uint"},11768:{name:"MaxCache",type:"Uint"},254851:{name:"DefaultDuration",type:"Uint"},216698:{name:"DefaultDecodedFieldDuration",type:"Uint"},209231:{name:"TrackTimecodeScale",type:"Float"},4991:{name:"TrackOffset",type:"Int"},5614:{name:"MaxBlockAdditionID",type:"Uint"},4974:{name:"Name",type:"String"},177564:{name:"Language",type:"String"},6:{name:"CodecID",type:"String"},9122:{name:"CodecPrivate",type:"Binary"},362120:{name:"CodecName",type:"String"},13382:{name:"AttachmentLink",type:"Uint"},1742487:{name:"CodecSettings",type:"String"},1785920:{name:"CodecInfoURL",type:"String"},438848:{name:"CodecDownloadURL",type:"String"},42:{name:"CodecDecodeAll",type:"Uint"},12203:{name:"TrackOverlay",type:"Uint"},5802:{name:"CodecDelay",type:"Uint"},5819:{name:"SeekPreRoll",type:"Uint"},9764:{name:"TrackTranslate",type:"Container"},9980:{name:"TrackTranslateEditionUID",type:"Uint"},9919:{name:"TrackTranslateCodec",type:"Uint"},9893:{name:"TrackTranslateTrackID",type:"Binary"},96:{name:"Video",type:"Container"},26:{name:"FlagInterlaced",type:"Uint"},5048:{name:"StereoMode",type:"Uint"},5056:{name:"AlphaMode",type:"Uint"},5049:{name:"OldStereoMode",type:"Uint"},48:{name:"PixelWidth",type:"Uint"},58:{name:"PixelHeight",type:"Uint"},5290:{name:"PixelCropBottom",type:"Uint"},5307:{name:"PixelCropTop",type:"Uint"},5324:{name:"PixelCropLeft",type:"Uint"},5341:{name:"PixelCropRight",type:"Uint"},5296:{name:"DisplayWidth",type:"Uint"},5306:{name:"DisplayHeight",type:"Uint"},5298:{name:"DisplayUnit",type:"Uint"},5299:{name:"AspectRatioType",type:"Uint"},963876:{name:"ColourSpace",type:"Binary"},1029411:{name:"GammaValue",type:"Float"},230371:{name:"FrameRate",type:"Float"},97:{name:"Audio",type:"Container"},53:{name:"SamplingFrequency",type:"Float"},14517:{name:"OutputSamplingFrequency",type:"Float"},31:{name:"Channels",type:"Uint"},15739:{name:"ChannelPositions",type:"Binary"},8804:{name:"BitDepth",type:"Uint"},98:{name:"TrackOperation",type:"Container"},99:{name:"TrackCombinePlanes",type:"Container"},100:{name:"TrackPlane",type:"Container"},101:{name:"TrackPlaneUID",type:"Uint"},102:{name:"TrackPlaneType",type:"Uint"},105:{name:"TrackJoinBlocks",type:"Container"},109:{name:"TrackJoinUID",type:"Uint"},64:{name:"TrickTrackUID",type:"Uint"},65:{name:"TrickTrackSegmentUID",type:"Binary"},70:{name:"TrickTrackFlag",type:"Uint"},71:{name:"TrickMasterTrackUID",type:"Uint"},68:{name:"TrickMasterTrackSegmentUID",type:"Binary"},11648:{name:"ContentEncodings",type:"Container"},8768:{name:"ContentEncoding",type:"Container"},4145:{name:"ContentEncodingOrder",type:"Uint"},4146:{name:"ContentEncodingScope",type:"Uint"},4147:{name:"ContentEncodingType",type:"Uint"},4148:{name:"ContentCompression",type:"Container"},596:{name:"ContentCompAlgo",type:"Uint"},597:{name:"ContentCompSettings",type:"Binary"},4149:{name:"ContentEncryption",type:"Container"},2017:{name:"ContentEncAlgo",type:"Uint"},2018:{name:"ContentEncKeyID",type:"Binary"},2019:{name:"ContentSignature",type:"Binary"},2020:{name:"ContentSigKeyID",type:"Binary"},2021:{name:"ContentSigAlgo",type:"Uint"},2022:{name:"ContentSigHashAlgo",type:"Uint"},206814059:{name:"Cues",type:"Container"},59:{name:"CuePoint",type:"Container"},51:{name:"CueTime",type:"Uint"},55:{name:"CueTrackPositions",type:"Container"},119:{name:"CueTrack",type:"Uint"},113:{name:"CueClusterPosition",type:"Uint"},112:{name:"CueRelativePosition",type:"Uint"},50:{name:"CueDuration",type:"Uint"},4984:{name:"CueBlockNumber",type:"Uint"},106:{name:"CueCodecState",type:"Uint"},91:{name:"CueReference",type:"Container"},22:{name:"CueRefTime",type:"Uint"},23:{name:"CueRefCluster",type:"Uint"},4959:{name:"CueRefNumber",type:"Uint"},107:{name:"CueRefCodecState",type:"Uint"},155296873:{name:"Attachments",type:"Container"},8615:{name:"AttachedFile",type:"Container"},1662:{name:"FileDescription",type:"String"},1646:{name:"FileName",type:"String"},1632:{name:"FileMimeType",type:"String"},1628:{name:"FileData",type:"Binary"},1710:{name:"FileUID",type:"Uint"},1653:{name:"FileReferral",type:"Binary"},1633:{name:"FileUsedStartTime",type:"Uint"},1634:{name:"FileUsedEndTime",type:"Uint"},4433776:{name:"Chapters",type:"Container"},1465:{name:"EditionEntry",type:"Container"},1468:{name:"EditionUID",type:"Uint"},1469:{name:"EditionFlagHidden",type:"Uint"},1499:{name:"EditionFlagDefault",type:"Uint"},1501:{name:"EditionFlagOrdered",type:"Uint"},54:{name:"ChapterAtom",type:"Container"},13252:{name:"ChapterUID",type:"Uint"},5716:{name:"ChapterStringUID",type:"String"},17:{name:"ChapterTimeStart",type:"Uint"},18:{name:"ChapterTimeEnd",type:"Uint"},24:{name:"ChapterFlagHidden",type:"Uint"},1432:{name:"ChapterFlagEnabled",type:"Uint"},11879:{name:"ChapterSegmentUID",type:"Binary"},11964:{name:"ChapterSegmentEditionUID",type:"Uint"},9155:{name:"ChapterPhysicalEquiv",type:"Uint"},15:{name:"ChapterTrack",type:"Container"},9:{name:"ChapterTrackNumber",type:"Uint"},0:{name:"ChapterDisplay",type:"Container"},5:{name:"ChapString",type:"String"},892:{name:"ChapLanguage",type:"String"},894:{name:"ChapCountry",type:"String"},10564:{name:"ChapProcess",type:"Container"},10581:{name:"ChapProcessCodecID",type:"Uint"},1293:{name:"ChapProcessPrivate",type:"Binary"},10513:{name:"ChapProcessCommand",type:"Container"},10530:{name:"ChapProcessTime",type:"Uint"},10547:{name:"ChapProcessData",type:"Binary"},39109479:{name:"Tags",type:"Container"},13171:{name:"Tag",type:"Container"},9152:{name:"Targets",type:"Container"},10442:{name:"TargetTypeValue",type:"Uint"},9162:{name:"TargetType",type:"String"},9157:{name:"TagTrackUID",type:"Uint"},9161:{name:"TagEditionUID",type:"Uint"},9156:{name:"TagChapterUID",type:"Uint"},9158:{name:"TagAttachmentUID",type:"Uint"},10184:{name:"SimpleTag",type:"Container"},1443:{name:"TagName",type:"String"},1146:{name:"TagLanguage",type:"String"},1156:{name:"TagDefault",type:"Uint"},1159:{name:"TagString",type:"String"},1157:{name:"TagBinary",type:"Binary"}};function t(l,h){l.prototype=Object.create(h.prototype),l.prototype.constructor=l}function r(l,h){this.name=l||"Unknown",this.type=h||"Unknown"}r.prototype.updateBySource=function(){},r.prototype.setSource=function(l){this.source=l,this.updateBySource()},r.prototype.updateByData=function(){},r.prototype.setData=function(l){this.data=l,this.updateByData()};function n(l,h){r.call(this,l,h||"Uint")}t(n,r);function i(l){return l.length%2===1?"0"+l:l}n.prototype.updateBySource=function(){this.data="";for(var l=0;l<this.source.length;l++){var h=this.source[l].toString(16);this.data+=i(h)}},n.prototype.updateByData=function(){var l=this.data.length/2;this.source=new Uint8Array(l);for(var h=0;h<l;h++){var d=this.data.substr(h*2,2);this.source[h]=parseInt(d,16)}},n.prototype.getValue=function(){return parseInt(this.data,16)},n.prototype.setValue=function(l){this.setData(i(l.toString(16)))};function o(l,h){r.call(this,l,h||"Float")}t(o,r),o.prototype.getFloatArrayType=function(){return this.source&&this.source.length===4?Float32Array:Float64Array},o.prototype.updateBySource=function(){var l=this.source.reverse(),h=this.getFloatArrayType(),d=new h(l.buffer);this.data=d[0]},o.prototype.updateByData=function(){var l=this.getFloatArrayType(),h=new l([this.data]),d=new Uint8Array(h.buffer);this.source=d.reverse()},o.prototype.getValue=function(){return this.data},o.prototype.setValue=function(l){this.setData(l)};function s(l,h){r.call(this,l,h||"Container")}t(s,r),s.prototype.readByte=function(){return this.source[this.offset++]},s.prototype.readUint=function(){for(var l=this.readByte(),h=8-l.toString(2).length,d=l-(1<<7-h),g=0;g<h;g++)d*=256,d+=this.readByte();return d},s.prototype.updateBySource=function(){for(this.data=[],this.offset=0;this.offset<this.source.length;this.offset=d){var l=this.readUint(),h=this.readUint(),d=Math.min(this.offset+h,this.source.length),g=this.source.slice(this.offset,d),f=e[l]||{name:"Unknown",type:"Unknown"},m=r;switch(f.type){case"Container":m=s;break;case"Uint":m=n;break;case"Float":m=o;break}var u=new m(f.name,f.type);u.setSource(g),this.data.push({id:l,idHex:l.toString(16),data:u})}},s.prototype.writeUint=function(l,h){for(var d=1,g=128;l>=g&&d<8;d++,g*=128);if(!h)for(var f=g+l,m=d-1;m>=0;m--){var u=f%256;this.source[this.offset+m]=u,f=(f-u)/256}this.offset+=d},s.prototype.writeSections=function(l){this.offset=0;for(var h=0;h<this.data.length;h++){var d=this.data[h],g=d.data.source,f=g.length;this.writeUint(d.id,l),this.writeUint(f,l),l||this.source.set(g,this.offset),this.offset+=f}return this.offset},s.prototype.updateByData=function(){var l=this.writeSections("draft");this.source=new Uint8Array(l),this.writeSections()},s.prototype.getSectionById=function(l){for(var h=0;h<this.data.length;h++){var d=this.data[h];if(d.id===l)return d.data}return null};function a(l){s.call(this,"File","File"),this.setSource(l)}t(a,s),a.prototype.fixDuration=function(l,h){var d=h&&h.logger;d===void 0?d=function(b){console.log(b)}:d||(d=function(){});var g=this.getSectionById(139690087);if(!g)return d("[fix-webm-duration] Segment section is missing"),!1;var f=g.getSectionById(88713574);if(!f)return d("[fix-webm-duration] Info section is missing"),!1;var m=f.getSectionById(710577);if(!m)return d("[fix-webm-duration] TimecodeScale section is missing"),!1;var u=f.getSectionById(1161);if(u)if(u.getValue()<=0)d(`[fix-webm-duration] Duration section is present, but the value is ${u.getValue()}`),u.setValue(l);else return d(`[fix-webm-duration] Duration section is present, and the value is ${u.getValue()}`),!1;else d("[fix-webm-duration] Duration section is missing"),u=new o("Duration","Float"),u.setValue(l),f.data.push({id:1161,data:u});return m.setValue(1e6),f.updateByData(),g.updateByData(),this.updateByData(),!0},a.prototype.toBlob=function(l){return new Blob([this.source.buffer],{type:l||"video/webm"})};function c(l,h,d,g){if(typeof d=="object"&&(g=d,d=void 0),!d)return new Promise(function(m){c(l,h,m,g)});try{var f=new FileReader;f.onloadend=function(){try{var m=new a(new Uint8Array(f.result));m.fixDuration(h,g)&&(l=m.toBlob(l.type))}catch{}d(l)},f.readAsArrayBuffer(l)}catch{d(l)}}return c.default=c,c})});var d0=_e((Ad,Td)=>{(function(e,t){typeof define=="function"&&define.amd?define([],t):typeof Ad<"u"?t():(t(),e.FileSaver={})})(Ad,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 h=new XMLHttpRequest;h.open("GET",a),h.responseType="blob",h.onload=function(){s(h.response,c,l)},h.onerror=function(){console.error("could not download file")},h.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 n(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 i=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:void 0,o=i.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=i.saveAs||(typeof window!="object"||window!==i?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(a,c,l){var h=i.URL||i.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?n(d):r(d.href)?t(a,c,l):n(d,d.target="_blank")):(d.href=h.createObjectURL(a),setTimeout(function(){h.revokeObjectURL(d.href)},4e4),setTimeout(function(){n(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 h=document.createElement("a");h.href=a,h.target="_blank",setTimeout(function(){n(h)})}}:function(a,c,l,h){if(h=h||open("","_blank"),h&&(h.document.title=h.document.body.innerText="downloading..."),typeof a=="string")return t(a,c,l);var d=a.type==="application/octet-stream",g=/constructor/i.test(i.HTMLElement)||i.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent);if((f||d&&g||o)&&typeof FileReader<"u"){var m=new FileReader;m.onloadend=function(){var _=m.result;_=f?_:_.replace(/^data:[^;]*;/,"data:attachment/file;"),h?h.location.href=_:location=_,h=null},m.readAsDataURL(a)}else{var u=i.URL||i.webkitURL,b=u.createObjectURL(a);h?h.location=b:location.href=b,h=null,setTimeout(function(){u.revokeObjectURL(b)},4e4)}});i.saveAs=s.saveAs=s,typeof Td<"u"&&(Td.exports=s)})});var C2=_e((ST,E2)=>{E2.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var An=_e(ti=>{var Du,Hw=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];ti.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};ti.getSymbolTotalCodewords=function(t){return Hw[t]};ti.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};ti.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');Du=t};ti.isKanjiModeEnabled=function(){return typeof Du<"u"};ti.toSJIS=function(t){return Du(t)}});var Zc=_e(dr=>{dr.L={bit:1};dr.M={bit:0};dr.Q={bit:3};dr.H={bit:2};function Ww(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return dr.L;case"m":case"medium":return dr.M;case"q":case"quartile":return dr.Q;case"h":case"high":return dr.H;default:throw new Error("Unknown EC Level: "+e)}}dr.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4};dr.from=function(t,r){if(dr.isValid(t))return t;try{return Ww(t)}catch{return r}}});var T2=_e((CT,A2)=>{function x2(){this.buffer=[],this.length=0}x2.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r<t;r++)this.putBit((e>>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};A2.exports=x2});var R2=_e((xT,I2)=>{function ls(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}ls.prototype.set=function(e,t,r,n){let i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)};ls.prototype.get=function(e,t){return this.data[e*this.size+t]};ls.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};ls.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};I2.exports=ls});var P2=_e(Qc=>{var $w=An().getSymbolSize;Qc.getRowColCoords=function(t){if(t===1)return[];let r=Math.floor(t/7)+2,n=$w(t),i=n===145?26:Math.ceil((n-13)/(2*r-2))*2,o=[n-7];for(let s=1;s<r-1;s++)o[s]=o[s-1]-i;return o.push(6),o.reverse()};Qc.getPositions=function(t){let r=[],n=Qc.getRowColCoords(t),i=n.length;for(let o=0;o<i;o++)for(let s=0;s<i;s++)o===0&&s===0||o===0&&s===i-1||o===i-1&&s===0||r.push([n[o],n[s]]);return r}});var O2=_e(B2=>{var Gw=An().getSymbolSize,D2=7;B2.getPositions=function(t){let r=Gw(t);return[[0,0],[r-D2,0],[0,r-D2]]}});var U2=_e(Be=>{Be.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var ri={N1:3,N2:3,N3:40,N4:10};Be.isValid=function(t){return t!=null&&t!==""&&!isNaN(t)&&t>=0&&t<=7};Be.from=function(t){return Be.isValid(t)?parseInt(t,10):void 0};Be.getPenaltyN1=function(t){let r=t.size,n=0,i=0,o=0,s=null,a=null;for(let c=0;c<r;c++){i=o=0,s=a=null;for(let l=0;l<r;l++){let h=t.get(c,l);h===s?i++:(i>=5&&(n+=ri.N1+(i-5)),s=h,i=1),h=t.get(l,c),h===a?o++:(o>=5&&(n+=ri.N1+(o-5)),a=h,o=1)}i>=5&&(n+=ri.N1+(i-5)),o>=5&&(n+=ri.N1+(o-5))}return n};Be.getPenaltyN2=function(t){let r=t.size,n=0;for(let i=0;i<r-1;i++)for(let o=0;o<r-1;o++){let s=t.get(i,o)+t.get(i,o+1)+t.get(i+1,o)+t.get(i+1,o+1);(s===4||s===0)&&n++}return n*ri.N2};Be.getPenaltyN3=function(t){let r=t.size,n=0,i=0,o=0;for(let s=0;s<r;s++){i=o=0;for(let a=0;a<r;a++)i=i<<1&2047|t.get(s,a),a>=10&&(i===1488||i===93)&&n++,o=o<<1&2047|t.get(a,s),a>=10&&(o===1488||o===93)&&n++}return n*ri.N3};Be.getPenaltyN4=function(t){let r=0,n=t.data.length;for(let o=0;o<n;o++)r+=t.data[o];return Math.abs(Math.ceil(r*100/n/5)-10)*ri.N4};function qw(e,t,r){switch(e){case Be.Patterns.PATTERN000:return(t+r)%2===0;case Be.Patterns.PATTERN001:return t%2===0;case Be.Patterns.PATTERN010:return r%3===0;case Be.Patterns.PATTERN011:return(t+r)%3===0;case Be.Patterns.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2===0;case Be.Patterns.PATTERN101:return t*r%2+t*r%3===0;case Be.Patterns.PATTERN110:return(t*r%2+t*r%3)%2===0;case Be.Patterns.PATTERN111:return(t*r%3+(t+r)%2)%2===0;default:throw new Error("bad maskPattern:"+e)}}Be.applyMask=function(t,r){let n=r.size;for(let i=0;i<n;i++)for(let o=0;o<n;o++)r.isReserved(o,i)||r.xor(o,i,qw(t,o,i))};Be.getBestMask=function(t,r){let n=Object.keys(Be.Patterns).length,i=0,o=1/0;for(let s=0;s<n;s++){r(s),Be.applyMask(s,t);let a=Be.getPenaltyN1(t)+Be.getPenaltyN2(t)+Be.getPenaltyN3(t)+Be.getPenaltyN4(t);Be.applyMask(s,t),a<o&&(o=a,i=s)}return i}});var Ou=_e(Bu=>{var Tn=Zc(),el=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],tl=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Bu.getBlocksCount=function(t,r){switch(r){case Tn.L:return el[(t-1)*4+0];case Tn.M:return el[(t-1)*4+1];case Tn.Q:return el[(t-1)*4+2];case Tn.H:return el[(t-1)*4+3];default:return}};Bu.getTotalCodewordsCount=function(t,r){switch(r){case Tn.L:return tl[(t-1)*4+0];case Tn.M:return tl[(t-1)*4+1];case Tn.Q:return tl[(t-1)*4+2];case Tn.H:return tl[(t-1)*4+3];default:return}}});var L2=_e(nl=>{var hs=new Uint8Array(512),rl=new Uint8Array(256);(function(){let t=1;for(let r=0;r<255;r++)hs[r]=t,rl[t]=r,t<<=1,t&256&&(t^=285);for(let r=255;r<512;r++)hs[r]=hs[r-255]})();nl.log=function(t){if(t<1)throw new Error("log("+t+")");return rl[t]};nl.exp=function(t){return hs[t]};nl.mul=function(t,r){return t===0||r===0?0:hs[rl[t]+rl[r]]}});var F2=_e(ds=>{var Uu=L2();ds.mul=function(t,r){let n=new Uint8Array(t.length+r.length-1);for(let i=0;i<t.length;i++)for(let o=0;o<r.length;o++)n[i+o]^=Uu.mul(t[i],r[o]);return n};ds.mod=function(t,r){let n=new Uint8Array(t);for(;n.length-r.length>=0;){let i=n[0];for(let s=0;s<r.length;s++)n[s]^=Uu.mul(r[s],i);let o=0;for(;o<n.length&&n[o]===0;)o++;n=n.slice(o)}return n};ds.generateECPolynomial=function(t){let r=new Uint8Array([1]);for(let n=0;n<t;n++)r=ds.mul(r,new Uint8Array([1,Uu.exp(n)]));return r}});var z2=_e((BT,N2)=>{var M2=F2();function Lu(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}Lu.prototype.initialize=function(t){this.degree=t,this.genPoly=M2.generateECPolynomial(this.degree)};Lu.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");let r=new Uint8Array(t.length+this.degree);r.set(t);let n=M2.mod(r,this.genPoly),i=this.degree-n.length;if(i>0){let o=new Uint8Array(this.degree);return o.set(n,i),o}return n};N2.exports=Lu});var Fu=_e(j2=>{j2.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}});var Mu=_e(tn=>{var V2="[0-9]+",Kw="[A-Z $%*+\\-./:]+",us="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";us=us.replace(/u/g,"\\u");var Xw="(?:(?![A-Z0-9 $%*+\\-./:]|"+us+`)(?:.|[\r
3
+ ]))+`;tn.KANJI=new RegExp(us,"g");tn.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");tn.BYTE=new RegExp(Xw,"g");tn.NUMERIC=new RegExp(V2,"g");tn.ALPHANUMERIC=new RegExp(Kw,"g");var Jw=new RegExp("^"+us+"$"),Yw=new RegExp("^"+V2+"$"),Zw=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");tn.testKanji=function(t){return Jw.test(t)};tn.testNumeric=function(t){return Yw.test(t)};tn.testAlphanumeric=function(t){return Zw.test(t)}});var In=_e(nt=>{var Qw=Fu(),Nu=Mu();nt.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};nt.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};nt.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};nt.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};nt.MIXED={bit:-1};nt.getCharCountIndicator=function(t,r){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Qw.isValid(r))throw new Error("Invalid version: "+r);return r>=1&&r<10?t.ccBits[0]:r<27?t.ccBits[1]:t.ccBits[2]};nt.getBestModeForData=function(t){return Nu.testNumeric(t)?nt.NUMERIC:Nu.testAlphanumeric(t)?nt.ALPHANUMERIC:Nu.testKanji(t)?nt.KANJI:nt.BYTE};nt.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")};nt.isValid=function(t){return t&&t.bit&&t.ccBits};function e3(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return nt.NUMERIC;case"alphanumeric":return nt.ALPHANUMERIC;case"kanji":return nt.KANJI;case"byte":return nt.BYTE;default:throw new Error("Unknown mode: "+e)}}nt.from=function(t,r){if(nt.isValid(t))return t;try{return e3(t)}catch{return r}}});var q2=_e(ni=>{var il=An(),t3=Ou(),H2=Zc(),Rn=In(),zu=Fu(),$2=7973,W2=il.getBCHDigit($2);function r3(e,t,r){for(let n=1;n<=40;n++)if(t<=ni.getCapacity(n,r,e))return n}function G2(e,t){return Rn.getCharCountIndicator(e,t)+4}function n3(e,t){let r=0;return e.forEach(function(n){let i=G2(n.mode,t);r+=i+n.getBitsLength()}),r}function i3(e,t){for(let r=1;r<=40;r++)if(n3(e,r)<=ni.getCapacity(r,t,Rn.MIXED))return r}ni.from=function(t,r){return zu.isValid(t)?parseInt(t,10):r};ni.getCapacity=function(t,r,n){if(!zu.isValid(t))throw new Error("Invalid QR Code version");typeof n>"u"&&(n=Rn.BYTE);let i=il.getSymbolTotalCodewords(t),o=t3.getTotalCodewordsCount(t,r),s=(i-o)*8;if(n===Rn.MIXED)return s;let a=s-G2(n,t);switch(n){case Rn.NUMERIC:return Math.floor(a/10*3);case Rn.ALPHANUMERIC:return Math.floor(a/11*2);case Rn.KANJI:return Math.floor(a/13);case Rn.BYTE:default:return Math.floor(a/8)}};ni.getBestVersionForData=function(t,r){let n,i=H2.from(r,H2.M);if(Array.isArray(t)){if(t.length>1)return i3(t,i);if(t.length===0)return 1;n=t[0]}else n=t;return r3(n.mode,n.getLength(),i)};ni.getEncodedBits=function(t){if(!zu.isValid(t)||t<7)throw new Error("Invalid QR Code version");let r=t<<12;for(;il.getBCHDigit(r)-W2>=0;)r^=$2<<il.getBCHDigit(r)-W2;return t<<12|r}});var Y2=_e(J2=>{var ju=An(),X2=1335,o3=21522,K2=ju.getBCHDigit(X2);J2.getEncodedBits=function(t,r){let n=t.bit<<3|r,i=n<<10;for(;ju.getBCHDigit(i)-K2>=0;)i^=X2<<ju.getBCHDigit(i)-K2;return(n<<10|i)^o3}});var Q2=_e((NT,Z2)=>{var s3=In();function ao(e){this.mode=s3.NUMERIC,this.data=e.toString()}ao.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)};ao.prototype.getLength=function(){return this.data.length};ao.prototype.getBitsLength=function(){return ao.getBitsLength(this.data.length)};ao.prototype.write=function(t){let r,n,i;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),i=parseInt(n,10),t.put(i,10);let o=this.data.length-r;o>0&&(n=this.data.substr(r),i=parseInt(n,10),t.put(i,o*3+1))};Z2.exports=ao});var ty=_e((zT,ey)=>{var a3=In(),Vu=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function co(e){this.mode=a3.ALPHANUMERIC,this.data=e}co.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};co.prototype.getLength=function(){return this.data.length};co.prototype.getBitsLength=function(){return co.getBitsLength(this.data.length)};co.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Vu.indexOf(this.data[r])*45;n+=Vu.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(Vu.indexOf(this.data[r]),6)};ey.exports=co});var ny=_e((jT,ry)=>{var c3=In();function lo(e){this.mode=c3.BYTE,typeof e=="string"?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}lo.getBitsLength=function(t){return t*8};lo.prototype.getLength=function(){return this.data.length};lo.prototype.getBitsLength=function(){return lo.getBitsLength(this.data.length)};lo.prototype.write=function(e){for(let t=0,r=this.data.length;t<r;t++)e.put(this.data[t],8)};ry.exports=lo});var oy=_e((VT,iy)=>{var l3=In(),h3=An();function ho(e){this.mode=l3.KANJI,this.data=e}ho.getBitsLength=function(t){return t*13};ho.prototype.getLength=function(){return this.data.length};ho.prototype.getBitsLength=function(){return ho.getBitsLength(this.data.length)};ho.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let r=h3.toSJIS(this.data[t]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+`
4
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};iy.exports=ho});var sy=_e((HT,Hu)=>{"use strict";var ps={single_source_shortest_paths:function(e,t,r){var n={},i={};i[t]=0;var o=ps.PriorityQueue.make();o.push(t,0);for(var s,a,c,l,h,d,g,f,m;!o.empty();){s=o.pop(),a=s.value,l=s.cost,h=e[a]||{};for(c in h)h.hasOwnProperty(c)&&(d=h[c],g=l+d,f=i[c],m=typeof i[c]>"u",(m||f>g)&&(i[c]=g,o.push(c,g),n[c]=a))}if(typeof r<"u"&&typeof i[r]>"u"){var u=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(u)}return n},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t,i;n;)r.push(n),i=e[n],n=e[n];return r.reverse(),r},find_path:function(e,t,r){var n=ps.single_source_shortest_paths(e,t,r);return ps.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(e){var t=ps.PriorityQueue,r={},n;e=e||{};for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof Hu<"u"&&(Hu.exports=ps)});var fy=_e(uo=>{var Se=In(),ly=Q2(),hy=ty(),dy=ny(),uy=oy(),fs=Mu(),ol=An(),d3=sy();function ay(e){return unescape(encodeURIComponent(e)).length}function ms(e,t,r){let n=[],i;for(;(i=e.exec(r))!==null;)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function py(e){let t=ms(fs.NUMERIC,Se.NUMERIC,e),r=ms(fs.ALPHANUMERIC,Se.ALPHANUMERIC,e),n,i;return ol.isKanjiModeEnabled()?(n=ms(fs.BYTE,Se.BYTE,e),i=ms(fs.KANJI,Se.KANJI,e)):(n=ms(fs.BYTE_KANJI,Se.BYTE,e),i=[]),t.concat(r,n,i).sort(function(s,a){return s.index-a.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function Wu(e,t){switch(t){case Se.NUMERIC:return ly.getBitsLength(e);case Se.ALPHANUMERIC:return hy.getBitsLength(e);case Se.KANJI:return uy.getBitsLength(e);case Se.BYTE:return dy.getBitsLength(e)}}function u3(e){return e.reduce(function(t,r){let n=t.length-1>=0?t[t.length-1]:null;return n&&n.mode===r.mode?(t[t.length-1].data+=r.data,t):(t.push(r),t)},[])}function p3(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];switch(n.mode){case Se.NUMERIC:t.push([n,{data:n.data,mode:Se.ALPHANUMERIC,length:n.length},{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.ALPHANUMERIC:t.push([n,{data:n.data,mode:Se.BYTE,length:n.length}]);break;case Se.KANJI:t.push([n,{data:n.data,mode:Se.BYTE,length:ay(n.data)}]);break;case Se.BYTE:t.push([{data:n.data,mode:Se.BYTE,length:ay(n.data)}])}}return t}function f3(e,t){let r={},n={start:{}},i=["start"];for(let o=0;o<e.length;o++){let s=e[o],a=[];for(let c=0;c<s.length;c++){let l=s[c],h=""+o+c;a.push(h),r[h]={node:l,lastCount:0},n[h]={};for(let d=0;d<i.length;d++){let g=i[d];r[g]&&r[g].node.mode===l.mode?(n[g][h]=Wu(r[g].lastCount+l.length,l.mode)-Wu(r[g].lastCount,l.mode),r[g].lastCount+=l.length):(r[g]&&(r[g].lastCount=l.length),n[g][h]=Wu(l.length,l.mode)+4+Se.getCharCountIndicator(l.mode,t))}}i=a}for(let o=0;o<i.length;o++)n[i[o]].end=0;return{map:n,table:r}}function cy(e,t){let r,n=Se.getBestModeForData(e);if(r=Se.from(t,n),r!==Se.BYTE&&r.bit<n.bit)throw new Error('"'+e+'" cannot be encoded with mode '+Se.toString(r)+`.
5
+ Suggested mode is: `+Se.toString(n));switch(r===Se.KANJI&&!ol.isKanjiModeEnabled()&&(r=Se.BYTE),r){case Se.NUMERIC:return new ly(e);case Se.ALPHANUMERIC:return new hy(e);case Se.KANJI:return new uy(e);case Se.BYTE:return new dy(e)}}uo.fromArray=function(t){return t.reduce(function(r,n){return typeof n=="string"?r.push(cy(n,null)):n.data&&r.push(cy(n.data,n.mode)),r},[])};uo.fromString=function(t,r){let n=py(t,ol.isKanjiModeEnabled()),i=p3(n),o=f3(i,r),s=d3.find_path(o.map,"start","end"),a=[];for(let c=1;c<s.length-1;c++)a.push(o.table[s[c]].node);return uo.fromArray(u3(a))};uo.rawSplit=function(t){return uo.fromArray(py(t,ol.isKanjiModeEnabled()))}});var gy=_e(my=>{var al=An(),$u=Zc(),m3=T2(),g3=R2(),y3=P2(),b3=O2(),Ku=U2(),Xu=Ou(),v3=z2(),sl=q2(),_3=Y2(),w3=In(),Gu=fy();function S3(e,t){let r=e.size,n=b3.getPositions(t);for(let i=0;i<n.length;i++){let o=n[i][0],s=n[i][1];for(let a=-1;a<=7;a++)if(!(o+a<=-1||r<=o+a))for(let c=-1;c<=7;c++)s+c<=-1||r<=s+c||(a>=0&&a<=6&&(c===0||c===6)||c>=0&&c<=6&&(a===0||a===6)||a>=2&&a<=4&&c>=2&&c<=4?e.set(o+a,s+c,!0,!0):e.set(o+a,s+c,!1,!0))}}function k3(e){let t=e.size;for(let r=8;r<t-8;r++){let n=r%2===0;e.set(r,6,n,!0),e.set(6,r,n,!0)}}function E3(e,t){let r=y3.getPositions(t);for(let n=0;n<r.length;n++){let i=r[n][0],o=r[n][1];for(let s=-2;s<=2;s++)for(let a=-2;a<=2;a++)s===-2||s===2||a===-2||a===2||s===0&&a===0?e.set(i+s,o+a,!0,!0):e.set(i+s,o+a,!1,!0)}}function C3(e,t){let r=e.size,n=sl.getEncodedBits(t),i,o,s;for(let a=0;a<18;a++)i=Math.floor(a/3),o=a%3+r-8-3,s=(n>>a&1)===1,e.set(i,o,s,!0),e.set(o,i,s,!0)}function qu(e,t,r){let n=e.size,i=_3.getEncodedBits(t,r),o,s;for(o=0;o<15;o++)s=(i>>o&1)===1,o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}function x3(e,t){let r=e.size,n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let c=0;c<2;c++)if(!e.isReserved(i,a-c)){let l=!1;s<t.length&&(l=(t[s]>>>o&1)===1),e.set(i,a-c,l),o--,o===-1&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}function A3(e,t,r){let n=new m3;r.forEach(function(c){n.put(c.mode.bit,4),n.put(c.getLength(),w3.getCharCountIndicator(c.mode,e)),c.write(n)});let i=al.getSymbolTotalCodewords(e),o=Xu.getTotalCodewordsCount(e,t),s=(i-o)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);let a=(s-n.getLengthInBits())/8;for(let c=0;c<a;c++)n.put(c%2?17:236,8);return T3(n,e,t)}function T3(e,t,r){let n=al.getSymbolTotalCodewords(t),i=Xu.getTotalCodewordsCount(t,r),o=n-i,s=Xu.getBlocksCount(t,r),a=n%s,c=s-a,l=Math.floor(n/s),h=Math.floor(o/s),d=h+1,g=l-h,f=new v3(g),m=0,u=new Array(s),b=new Array(s),_=0,k=new Uint8Array(e.buffer);for(let P=0;P<s;P++){let M=P<c?h:d;u[P]=k.slice(m,m+M),b[P]=f.encode(u[P]),m+=M,_=Math.max(_,M)}let S=new Uint8Array(n),I=0,x,D;for(x=0;x<_;x++)for(D=0;D<s;D++)x<u[D].length&&(S[I++]=u[D][x]);for(x=0;x<g;x++)for(D=0;D<s;D++)S[I++]=b[D][x];return S}function I3(e,t,r,n){let i;if(Array.isArray(e))i=Gu.fromArray(e);else if(typeof e=="string"){let l=t;if(!l){let h=Gu.rawSplit(e);l=sl.getBestVersionForData(h,r)}i=Gu.fromString(e,l||40)}else throw new Error("Invalid data");let o=sl.getBestVersionForData(i,r);if(!o)throw new Error("The amount of data is too big to be stored in a QR Code");if(!t)t=o;else if(t<o)throw new Error(`
6
6
  The chosen QR Code version cannot contain this amount of data.
7
7
  Minimum version required to store current data is: `+o+`.
8
- `);let s=F3(t,r,i),a=Gc.getSymbolSize(t),c=new C3(a);return P3(c,t),D3(c),B3(c,t),rp(c,r,0),t>=7&&O3(c,t),U3(c,s),isNaN(n)&&(n=Qu.getBestMask(c,rp.bind(null,c,r))),Qu.applyMask(n,c),rp(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:i}}Ay.create=function(t,r){if(typeof t=="undefined"||t==="")throw new Error("No input text");let n=Zu.M,i,o;return typeof r!="undefined"&&(n=Zu.from(r.errorCorrectionLevel,Zu.M),i=qc.from(r.version),o=Qu.from(r.maskPattern),r.toSJISFunc&&Gc.setToSJISFunction(r.toSJISFunc)),M3(t,i,n,o)}});var np=we(ui=>{function Iy(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(n){return[n,n]}))),t.length===6&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+t.slice(0,6).join("")}}ui.getOptions=function(t){t||(t={}),t.color||(t.color={});let r=typeof t.margin=="undefined"||t.margin===null||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:Iy(t.color.dark||"#000000ff"),light:Iy(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};ui.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};ui.getImageWidth=function(t,r){let n=ui.getScale(t,r);return Math.floor((t+r.margin*2)*n)};ui.qrToImageData=function(t,r,n){let i=r.modules.size,o=r.modules.data,s=ui.getScale(i,n),a=Math.floor((i+n.margin*2)*s),c=n.margin*s,l=[n.color.light,n.color.dark];for(let d=0;d<a;d++)for(let h=0;h<a;h++){let m=(d*a+h)*4,f=n.color.light;if(d>=c&&h>=c&&d<a-c&&h<a-c){let g=Math.floor((d-c)/s),u=Math.floor((h-c)/s);f=l[o[g*i+u]?1:0]}t[m++]=f.r,t[m++]=f.g,t[m++]=f.b,t[m]=f.a}}});var Ry=we(Kc=>{var ip=np();function N3(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}function j3(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}Kc.render=function(t,r,n){let i=n,o=r;typeof i=="undefined"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(o=j3()),i=ip.getOptions(i);let s=ip.getImageWidth(t.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return ip.qrToImageData(c.data,t,i),N3(a,o,s),a.putImageData(c,0,0),o};Kc.renderToDataURL=function(t,r,n){let i=n;typeof i=="undefined"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let o=Kc.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}});var By=we(Py=>{var z3=np();function Dy(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function op(e,t,r){let n=e+t;return typeof r!="undefined"&&(n+=" "+r),n}function V3(e,t,r){let n="",i=0,o=!1,s=0;for(let a=0;a<e.length;a++){let c=Math.floor(a%t),l=Math.floor(a/t);!c&&!o&&(o=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=o?op("M",c+r,.5+l+r):op("m",i,0),i=0,o=!1),c+1<t&&e[a+1]||(n+=op("h",s),s=0)):i++}return n}Py.render=function(t,r,n){let i=z3.getOptions(r),o=t.modules.size,s=t.modules.data,a=o+i.margin*2,c=i.color.light.a?"<path "+Dy(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+Dy(i.color.dark,"stroke")+' d="'+V3(s,o,i.margin)+'"/>',d='viewBox="0 0 '+a+" "+a+'"',h=i.width?'width="'+i.width+'" height="'+i.width+'" ':"",m='<svg xmlns="http://www.w3.org/2000/svg" '+h+d+' shape-rendering="crispEdges">'+c+l+`</svg>
9
- `;return typeof n=="function"&&n(null,m),m}});var Uy=we(Es=>{var H3=F2(),sp=Ty(),Oy=Ry(),W3=By();function ap(e,t,r,n,i){let o=[].slice.call(arguments,1),s=o.length,a=typeof o[s-1]=="function";if(!a&&!H3())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(i=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof i=="undefined"?(i=n,n=void 0):(i=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,l){try{let d=sp.create(r,n);c(e(d,t,n))}catch(d){l(d)}})}try{let c=sp.create(r,n);i(null,e(c,t,n))}catch(c){i(c)}}Es.create=sp.create;Es.toCanvas=ap.bind(null,Oy.render);Es.toDataURL=ap.bind(null,Oy.renderToDataURL);Es.toString=ap.bind(null,function(e,t,r){return W3.render(e,r)})});async function Rs(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return!1;try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch(e){return!1}}async function Ps(){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 i=[];window.getScreenDetails().then(function(o){i=o,e(i.screens.length>=2)})}})}async function mr(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(i=>!e.some(o=>i.deviceId.includes(o)||i.label.includes(o)));return{cameras:r.filter(i=>i.kind=="videoinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId})),microphones:r.filter(i=>i.kind=="audioinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId}))}}var zn=typeof self!="undefined"?self:{};function Vn(){throw Error("Invalid UTF8")}function up(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Ds,el,Gy=typeof TextDecoder!="undefined",qy,Ky=typeof TextEncoder!="undefined";function pp(e){if(Ky)e=(qy||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var tl,Bs;e:{for(rl=["CLOSURE_FLAGS"],Os=zn,Us=0;Us<rl.length;Us++)if((Os=Os[rl[Us]])==null){Bs=null;break e}Bs=Os}var rl,Os,Us,mo,fp=Bs&&Bs[610401301];tl=fp!=null&&fp;var mp=zn.navigator;function nl(e){return!!tl&&!!mo&&mo.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function Qt(e){var t;return(t=zn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function cn(){return!!tl&&!!mo&&mo.brands.length>0}function il(){return cn()?nl("Chromium"):(Qt("Chrome")||Qt("CriOS"))&&!(!cn()&&Qt("Edge"))||Qt("Silk")}function ol(e){return ol[" "](e),e}mo=mp&&mp.userAgentData||null,ol[" "]=function(){};var Xy=!cn()&&(Qt("Trident")||Qt("MSIE"));!Qt("Android")||il(),il(),Qt("Safari")&&(il()||!cn()&&Qt("Coast")||!cn()&&Qt("Opera")||!cn()&&Qt("Edge")||(cn()?nl("Microsoft Edge"):Qt("Edg/"))||cn()&&nl("Opera"));var gp={},go=null;function Jy(e){let 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);let n=new Uint8Array(r),i=0;return function(o,s){function a(l){for(;c<o.length;){let d=o.charAt(c++),h=go[d];if(h!=null)return h;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return l}yp();let c=0;for(;;){let l=a(-1),d=a(0),h=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|d>>4),h!=64&&(s(d<<4&240|h>>2),m!=64&&s(h<<6&192|m))}}(e,function(o){n[i++]=o}),i!==r?n.subarray(0,i):n}function yp(){if(!go){go={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));gp[r]=n;for(let i=0;i<n.length;i++){let o=n[i];go[o]===void 0&&(go[o]=i)}}}}var bp=typeof Uint8Array!="undefined",vp=!Xy&&typeof btoa=="function";function wp(e){if(!vp){var t;t===void 0&&(t=0),yp(),t=gp[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var _p=/[-_.]/g,Yy={"-":"+",_:"/",".":"="};function Zy(e){return Yy[e]||""}function kp(e){if(!vp)return Jy(e);_p.test(e)&&(e=e.replace(_p,Zy)),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 yo(e){return bp&&e!=null&&e instanceof Uint8Array}var gi={};function Hn(){return Qy||=new qr(null,gi)}function sl(e){Sp(gi);var t=e.g;return(t=t==null||yo(t)?t:typeof t=="string"?kp(t):null)==null?t:e.g=t}var qr=class{h(){return new Uint8Array(sl(this)||0)}constructor(e,t){if(Sp(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},Qy,eb;function Sp(e){if(e!==gi)throw Error("illegal external caller")}function Ep(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function al(e){return Ep(e=Error(e),"warning"),e}var Ls=typeof Symbol=="function"&&typeof Symbol()=="symbol",tb=new Set;function bo(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&tb.add(e),e}var rb=bo("jas",void 0,!0,!0),Cp=bo(void 0,"0di"),cl=bo(void 0,"2ex"),vo=bo(void 0,"1oa",!0),yi=bo(void 0,Symbol(),!0),Q=Ls?rb:"Ga",xp={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},Ap=Object.defineProperties;function Fs(e,t){Ls||Q in e||Ap(e,xp),e[Q]|=t}function tt(e,t){Ls||Q in e||Ap(e,xp),e[Q]=t}function bi(e){return Fs(e,34),e}function nb(e,t){tt(t,-30975&(0|e))}function ll(e,t){tt(t,-30941&(34|e))}function dl(){return typeof BigInt=="function"}function It(e){return Array.prototype.slice.call(e)}var hl,wo={},Tp={};function Ip(e){return!(!e||typeof e!="object"||e.Ia!==Tp)}function ul(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function pl(e,t){if(e!=null){if(typeof e=="string")e=e?new qr(e,gi):Hn();else if(e.constructor!==qr)if(yo(e))e=e.length?new qr(new Uint8Array(e),gi):Hn();else{if(!t)throw Error();e=void 0}}return e}function Ms(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[Q]))}var Rp=[];function ln(e){if(2&e)throw Error()}tt(Rp,55),hl=Object.freeze(Rp);var _o=class{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new _o(this.g,this.h,this.m)}};function fl(e){return yi?e[yi]:void 0}var ib=Object.freeze({});function Ns(e){return e.Qa=!0,e}var ob=Ns(e=>typeof e=="number"),Pp=Ns(e=>typeof e=="string"),sb=Ns(e=>typeof e=="boolean"),js=typeof zn.BigInt=="function"&&typeof zn.BigInt(0)=="bigint",ml=Ns(e=>js?e>=cb&&e<=db:e[0]==="-"?Dp(e,ab):Dp(e,lb)),ab=Number.MIN_SAFE_INTEGER.toString(),cb=js?BigInt(Number.MIN_SAFE_INTEGER):void 0,lb=Number.MAX_SAFE_INTEGER.toString(),db=js?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Dp(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var hb=typeof Uint8Array.prototype.slice=="function",Bp,Ae=0,We=0;function Op(e){let t=e>>>0;Ae=t,We=(e-t)/4294967296>>>0}function vi(e){if(e<0){Op(-e);let[t,r]=gl(Ae,We);Ae=t>>>0,We=r>>>0}else Op(e)}function yl(e){let t=Bp||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),We=0,Ae=t.getUint32(0,!0)}function bl(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:ko(e,t)}function vl(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=bl(e,t))=="number"?r?-e:e:r?"-"+e:e}function ko(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else dl()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+Up(r)+Up(e));return r}function Up(e){return e=String(e),"0000000".slice(e.length)+e}function zs(e){if(e.length<16)vi(Number(e));else if(dl())e=BigInt(e),Ae=Number(e&BigInt(4294967295))>>>0,We=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");We=Ae=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));We*=1e6,Ae=1e6*Ae+o,Ae>=4294967296&&(We+=Math.trunc(Ae/4294967296),We>>>=0,Ae>>>=0)}if(t){let[n,i]=gl(Ae,We);Ae=n,We=i}}}function gl(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var wl=typeof BigInt=="function"?BigInt.asIntN:void 0,ub=typeof BigInt=="function"?BigInt.asUintN:void 0,wi=Number.isSafeInteger,Vs=Number.isFinite,Hs=Math.trunc;function dn(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function Lp(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var pb=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ws(e){switch(typeof e){case"bigint":return!0;case"number":return Vs(e);case"string":return pb.test(e);default:return!1}}function _i(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Vs(e)?0|e:void 0}function Fp(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Vs(e)?e>>>0:void 0}function Mp(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function _l(e){return e=Hs(e),wi(e)||(vi(e),e=vl(Ae,We)),e}function kl(e){var t=Hs(Number(e));if(wi(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(zs(e),e=Ae,2147483648&(t=We))if(dl())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=gl(e,t);e="-"+ko(r,n)}else e=ko(e,t);return e}function $s(e){return e==null?e:typeof e=="bigint"?(ml(e)?e=Number(e):(e=wl(64,e),e=ml(e)?Number(e):String(e)),e):Ws(e)?typeof e=="number"?_l(e):kl(e):void 0}function fb(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(ub(64,e));if(Ws(e)){if(t==="string")return t=Hs(Number(e)),wi(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Mp(e)||(zs(e),e=ko(Ae,We))),e;if(t==="number")return(e=Hs(e))>=0&&wi(e)?e:function(r){if(r<0){vi(r);var n=ko(Ae,We);return r=Number(n),wi(r)?r:n}return Mp(n=String(r))?n:(vi(r),bl(Ae,We))}(e)}}function Np(e){if(typeof e!="string")throw Error();return e}function ki(e){if(e!=null&&typeof e!="string")throw Error();return e}function Si(e){return e==null||typeof e=="string"?e:void 0}function Sl(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===wo)return e;if(!Array.isArray(e))return r?2&n?((e=t[Cp])||(bi((e=new t).u),e=t[Cp]=e),t=e):t=new t:t=void 0,t;let i=r=0|e[Q];return i===0&&(i|=32&n),i|=2&n,i!==r&&tt(e,i),new t(e)}function mb(e,t,r){if(t)e:{if(!Ws(t=e))throw al("int64");switch(typeof t){case"string":t=kl(t);break e;case"bigint":if(e=t=wl(64,t),Pp(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(ob(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=js?BigInt(t):sb(t)?t?"1":"0":Pp(t)?t.trim()||"0":String(t);break e;default:t=_l(t)}}else t=$s(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&wi(t=+r)?t:r}var gb={},yb=function(){try{return ol(new class extends Map{constructor(){super()}}),!1}catch{return!0}}(),Gs=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()}},bb=yb?(Object.setPrototypeOf(Gs.prototype,Map.prototype),Object.defineProperties(Gs.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),Gs):class extends Map{constructor(){super()}};function jp(e){return e}function El(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var er=class extends bb{constructor(e,t,r=jp,n=jp){super();let i=0|e[Q];i|=64,tt(e,i),this.L=i,this.S=t,this.R=r,this.Y=this.S?vb:n;for(let o=0;o<e.length;o++){let s=e[o],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=n(s[1],!1,!0,void 0,void 0,i),super.set(a,c)}}na(e=zp){if(this.size!==0)return this.X(e)}X(e=zp){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){El(this),super.clear()}delete(e){return El(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new _o(e,wb,this)}keys(){return this.Ha()}values(){var e=this.ma();return new _o(e,er.prototype.get,this)}forEach(e,t){super.forEach((r,n)=>{e.call(t,this.get(n),n,this)})}set(e,t){return El(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.S,!1,this.L))}Na(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.S?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.L),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.S;return r?((r=this.Y(t,!1,!0,r,this.ra,this.L))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function vb(e,t,r,n,i,o){return e=Sl(e,n,r,o),i&&(e=qs(e)),e}function zp(e){return e}function wb(e){return[e,this.get(e)]}var _b,Vp,kb;function Hp(){return _b||=new er(bi([]),void 0,void 0,void 0,gb)}function Cl(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=Ms(e)?void 0:i&&2&(0|e[Q])?e:xl(e,t,r,n!==void 0,i);else if(ul(e)){let o={};for(let s in e)o[s]=Cl(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function xl(e,t,r,n,i){let o=n||r?0|e[Q]:0,s=n?!!(32&o):void 0;n=It(e);for(let a=0;a<n.length;a++)n[a]=Cl(n[a],t,r,s,i);return r&&((e=fl(e))&&(n[yi]=It(e)),r(o,n)),n}function Sb(e){return Cl(e,Wp,void 0,void 0,!1)}function Wp(e){return e.W===wo?e.toJSON():e instanceof er?e.na(Sb):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return ml(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Ms(t))return}else{if(yo(t))return wp(t);if(t instanceof qr){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=wp(r)}if(t instanceof er)return t.na()}}return t}(e)}function $p(e){return xl(e,Wp,void 0,void 0,!1)}function hn(e,t,r){return e=Gp(e,t[0],t[1],r?1:2),t!==Vp&&r&&Fs(e,16384),e}function Gp(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[Q]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(ul(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return tt(e,i),e}function Al(e,t,r=ll){if(e!=null){if(bp&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[Q];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(tt(e,-12293&(34|n)),e):xl(e,Al,4&n?ll:r,!0,!0))}return e.W===wo?e=2&(n=0|(r=e.u)[Q])?e:new e.constructor(Ks(r,n,!0)):e instanceof er&&!(2&e.L)&&(r=bi(e.X(Al)),e=new er(r,e.S,e.R,e.Y)),e}}function Ks(e,t,r){let n=r||2&t?ll:nb,i=!!(32&t);return e=function(o,s,a){let c=It(o);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 h in d)s[h]=a(d[h])}return(o=fl(o))&&(c[yi]=It(o)),c}(e,t,o=>Al(o,i,n)),Fs(e,32|(r?2:0)),e}function qs(e){let t=e.u,r=0|t[Q];return 2&r?new e.constructor(Ks(t,r,!1)):e}function Ei(e,t){return Kr(e=e.u,0|e[Q],t)}function Kr(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&cl!=null&&((i=(e=eb??={})[cl]||0)>=4||(e[cl]=i+1,Ep(e=Error(),"incident"),function(s){zn.setTimeout(()=>{throw s},0)}(e))),t):i<=o?e[i]:void 0}function Re(e,t,r){let n=e.u,i=0|n[Q];return ln(i),ze(n,i,t,r),e}function ze(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},tt(e,t|=256)):e[o]=n),t)}function Xs(e,t){let r=0|(e=e.u)[Q],n=Kr(e,r,t),i=dn(n);return i!=null&&i!==n&&ze(e,r,t,i),i}function qp(e){let t=0|(e=e.u)[Q],r=Kr(e,t,1),n=pl(r,!0);return n!=null&&n!==r&&ze(e,t,1,n),n}function Wn(){return ib===void 0?2:4}function $n(e,t,r,n,i){let o=e.u,s=2&(e=0|o[Q])?1:n;i=!!i;let a=0|(n=Tl(o,e,t))[Q];if(!(4&a)){4&a&&(n=It(n),a=Jr(a,e),e=ze(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let d=r(n[c]);d!=null&&(n[l++]=d)}l<c&&(n.length=l),a=Il(a,e),r=-4097&(20|a),a=r&=-8193,tt(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Xr(a)||(i=a,a|=2,a!==i&&tt(n,a),Object.freeze(n)):(s===2&&Xr(a)&&(n=It(n),a=Jr(a,e),a=un(a,e,i),tt(n,a),e=ze(o,e,t,n)),Xr(a)||(t=a,a=un(a,e,i),a!==t&&tt(n,a))),n}function Tl(e,t,r,n){return e=Kr(e,t,r,n),Array.isArray(e)?e:hl}function Il(e,t){return e===0&&(e=Jr(e,t)),1|e}function Xr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Kp(e){e=It(e);for(let t=0;t<e.length;t++){let r=e[t]=It(e[t]);Array.isArray(r[1])&&(r[1]=bi(r[1]))}return e}function Rl(e,t,r,n){let i=0|(e=e.u)[Q];ln(i),ze(e,i,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Ci(e,t,r,n,i){ln(t);var o=!(!(64&t)&&16384&t);let s=(i=Tl(e,t,r,i))!==hl;if(o||!s){let a=o=s?0|i[Q]:0;(!s||2&a||Xr(a)||4&a&&!(32&a))&&(i=It(i),a=Jr(a,t),t=ze(e,t,r,i)),a=-13&Il(a,t),a=un(n?-17&a:16|a,t,!0),a!==o&&tt(i,a)}return i}function Bl(e,t){var r=Xp;return Dl(Pl(e=e.u),e,0|e[Q],r)===t?t:-1}function Pl(e){if(Ls)return e[vo]??(e[vo]=new Map);if(vo in e)return e[vo];let t=new Map;return Object.defineProperty(e,vo,{value:t}),t}function Jp(e,t,r,n){let i=Pl(e),o=Dl(i,e,t,r);return o!==n&&(o&&(t=ze(e,t,o)),i.set(r,n)),t}function Dl(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Kr(t,r,s)!=null&&(i!==0&&(r=ze(t,r,i)),i=s)}return e.set(n,i),i}function Ol(e,t,r,n){let i,o=0|e[Q];if((n=Kr(e,o,r,n))!=null&&n.W===wo)return(t=qs(n))!==n&&ze(e,o,r,t),t.u;if(Array.isArray(n)){let s=0|n[Q];i=2&s?hn(Ks(n,s,!1),t,!0):64&s?n:hn(i,t,!0)}else i=hn(void 0,t,!0);return i!==n&&ze(e,o,r,i),i}function Yp(e,t,r,n){let i=0|(e=e.u)[Q];return(t=Sl(n=Kr(e,i,r,n),t,!1,i))!==n&&t!=null&&ze(e,i,r,t),t}function ye(e,t,r,n=!1){if((t=Yp(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[Q]))){let i=qs(t);i!==t&&ze(e,n,r,t=i)}return t}function Zp(e,t,r,n,i,o,s){e=e.u;var a=!!(2&t);let c=a?1:i;o=!!o,s&&=!a;var l=0|(i=Tl(e,t,n))[Q];if(!(a=!!(4&l))){var d=i,h=t;let m=!!(2&(l=Il(l,t)));m&&(h|=2);let f=!m,g=!0,u=0,b=0;for(;u<d.length;u++){let v=Sl(d[u],r,!1,h);if(v instanceof r){if(!m){let k=!!(2&(0|v.u[Q]));f&&=!k,g&&=k}d[b++]=v}}b<u&&(d.length=b),l|=4,l=g?16|l:-17&l,tt(d,l=f?8|l:-9&l),m&&Object.freeze(d)}if(s&&!(8&l||!i.length&&(c===1||c===4&&32&l))){for(Xr(l)&&(i=It(i),l=Jr(l,t),t=ze(e,t,n,i)),r=i,s=l,d=0;d<r.length;d++)(l=r[d])!==(h=qs(l))&&(r[d]=h);s|=8,tt(r,s=r.length?-17&s:16|s),l=s}return c===1||c===4&&32&l?Xr(l)||(t=l,(l|=!i.length||16&l&&(!a||32&l)?2:2048)!==t&&tt(i,l),Object.freeze(i)):(c===2&&Xr(l)&&(tt(i=It(i),l=un(l=Jr(l,t),t,o)),t=ze(e,t,n,i)),Xr(l)||(n=l,(l=un(l,t,o))!==n&&tt(i,l))),i}function Yr(e,t,r){let n=0|e.u[Q];return Zp(e,n,t,r,Wn(),!1,!(2&n))}function ne(e,t,r,n){return n==null&&(n=void 0),Re(e,r,n)}function So(e,t,r,n){n==null&&(n=void 0);e:{let i=0|(e=e.u)[Q];if(ln(i),n==null){let o=Pl(e);if(Dl(o,e,i,r)!==t)break e;o.set(r,0)}else i=Jp(e,i,r,t);ze(e,i,t,n)}}function Jr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function un(e,t,r){return 32&t&&r||(e&=-33),e}function Js(e,t,r,n){let i=0|e.u[Q];ln(i),e=Zp(e,i,r,t,2,!0),n=n??new r,e.push(n),e[Q]=2&(0|n.u[Q])?-9&e[Q]:-17&e[Q]}function tr(e,t){return _i(Ei(e,t))}function rr(e,t){return Si(Ei(e,t))}function Ye(e,t){return Xs(e,t)??0}function Eo(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}`);Re(e,t,r)}function Dr(e,t,r){if(r!=null){if(typeof r!="number"||!Vs(r))throw al("int32");r|=0}Re(e,t,r)}function Z(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Re(e,t,r)}function Ys(e,t,r){{let s=e.u,a=0|s[Q];if(ln(a),r==null)ze(s,a,t);else{var n=e=0|r[Q],i=Xr(e),o=i||Object.isFrozen(r);for(i||(e=0),o||(r=It(r),n=0,e=un(e=Jr(e,a),a,!0),o=!1),e|=21,i=0;i<r.length;i++){let c=r[i],l=Np(c);Object.is(c,l)||(o&&(r=It(r),n=0,e=un(e=Jr(e,a),a,!0),o=!1),r[i]=l)}e!==n&&(o&&(r=It(r),e=un(e=Jr(e,a),a,!0)),tt(r,e)),ze(s,a,t,r)}}}function Zs(e,t,r){ln(0|e.u[Q]),$n(e,t,Si,2,!0).push(Np(r))}function Qp(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Ul(){return Error("Failed to read varint, encoding is invalid.")}function ef(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function Ll(e){if(typeof e=="string")return{buffer:kp(e),N:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Uint8Array)return{buffer:e,N:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),N:!1};if(e.constructor===qr)return{buffer:sl(e)||new Uint8Array(0),N:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),N:!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 Fl(e,t){let r,n=0,i=0,o=0,s=e.h,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(Gn(e,a),r<128)return t(n>>>0,i>>>0);throw Ul()}function Ml(e){let t=0,r=e.g,n=r+10,i=e.h;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return Gn(e,r),!!(127&t)}throw Ul()}function pn(e){let t=e.h,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Ul();return Gn(e,r),i}function Zr(e){return pn(e)>>>0}function Nl(e){var t=e.h;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],Gn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function jl(e){var t=Nl(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Eb(e){return pn(e)}function zl(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=Ll(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function Gn(e,t){if(e.g=t,t>e.l)throw ef(e.l,t)}function tf(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw ef(t,e.l-r);return e.g=n,r}function rf(e,t){if(t==0)return Hn();var r=tf(e,t);return e.ba&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):hb?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Hn():new qr(r,gi)}er.prototype.toJSON=void 0,er.prototype.Ia=Tp;var nf=[];function of(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=Zr(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw Qp(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function Qs(e){switch(e.h){case 0:e.h!=0?Qs(e):Ml(e.g);break;case 1:Gn(e=e.g,e.g+8);break;case 2:if(e.h!=2)Qs(e);else{var t=Zr(e.g);Gn(e=e.g,e.g+t)}break;case 5:Gn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!of(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Qs(e)}break;default:throw Qp(e.h,e.l)}}function Co(e,t,r){let n=e.g.l,i=Zr(e.g),o=e.g.g+i,s=o-n;if(s<=0&&(e.g.l=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=o,e.g.l=n,t}function Vl(e){var t=Zr(e.g),r=tf(e=e.g,t);if(e=e.h,Gy){var n,i=e;(n=el)||(n=el=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(Ds===void 0){try{n.decode(new Uint8Array([128]))}catch(c){}try{n.decode(new Uint8Array([97])),Ds=!0}catch(c){Ds=!1}}throw!Ds&&(el=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?Vn():(a=e[o++],s<194||(192&a)!=128?(o--,Vn()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?Vn():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,Vn()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?Vn():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,Vn()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Vn(),r.length>=8192&&(c=up(c,r),r.length=0)}o=up(c,r)}return o}function sf(e){let t=Zr(e.g);return rf(e.g,t)}function ea(e,t,r){var n=Zr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var ta=[];function Cb(e){return e}var xi;function gr(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var Y=class{constructor(e,t){this.u=Gp(e,t)}toJSON(){let e=!xi;try{return e&&(xi=$p),af(this)}finally{e&&(xi=void 0)}}l(){var e=xb;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.u;return new this.constructor(Ks(e,0|e[Q],!1))}N(){return!!(2&(0|this.u[Q]))}};function af(e){var t=e.u;{t=(e=xi(t))!==t;let l=e.length;if(l){var r=e[l-1],n=ul(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let d in s)isNaN(+d)?(o??={})[d]=s[d]:(n=s[d],Array.isArray(n)&&(Ms(n)||Ip(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[d]=n));if(a||(o=s),o)for(let d in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||Ms(o)||Ip(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function cf(e){return e?/^\d+$/.test(e)?(zs(e),new Hl(Ae,We)):null:Ab||=new Hl(0,0)}Y.prototype.W=wo,Y.prototype.toString=function(){try{return xi=Cb,af(this).toString()}finally{xi=void 0}};var Hl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Ab;function lf(e){return e?/^-?\d+$/.test(e)?(zs(e),new Wl(Ae,We)):null:Tb||=new Wl(0,0)}var Wl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},Tb;function Ai(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function Ti(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ra(e,t){if(t>=0)Ti(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function xo(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 Ii(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function zt(e,t,r){Ti(e.g,8*t+r)}function $l(e,t){return zt(e,t,2),t=e.g.end(),Ii(e,t),t.push(e.h),t}function Gl(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function na(e,t,r){zt(e,t,2),Ti(e.g,r.length),Ii(e,e.g.end()),Ii(e,r)}function ia(e,t,r,n){r!=null&&(t=$l(e,t),n(r,e),Gl(e,t))}function yr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var ql=yr(),df=yr(),Kl=yr(),Xl=yr(),hf=yr(),uf=yr(),Jl=yr(),pf=yr(),ff=yr(),Ri=class{constructor(e,t,r){this.g=e,this.h=t,e=ql,this.l=!!e&&r===e||!1}};function oa(e,t){return new Ri(e,t,ql)}function gf(e,t,r,n,i){ia(e,r,mf(t,n),i)}var Ib=oa(function(e,t,r,n,i){return e.h===2&&(Co(e,Ol(t,n,r),i),!0)},gf),Rb=oa(function(e,t,r,n,i){return e.h===2&&(Co(e,Ol(t,n,r,!0),i),!0)},gf),sa=Symbol(),Yl=Symbol(),yf=Symbol(),bf=Symbol(),vf,wf;function qn(e,t,r,n){var i=n[e];if(i)return i;(i={}).Pa=n,i.V=function(h){switch(typeof h){case"boolean":return Vp||=[0,void 0,!0];case"number":return h>0?void 0:h===0?kb||=[0,void 0]:[-h,void 0];case"string":return[0,h];case"object":return h}}(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.ga=o,typeof(o=n[++s])=="function"&&(i.la=!0,vf??=o,wf??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let h;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof Ri?h=o:(h=Ib,s--),h?.l){o=n[++s],l=n;var d=s;typeof o=="function"&&(o=o(),l[d]=o),l=o}for(d=c+1,typeof(o=n[++s])=="number"&&o<0&&(d-=o,o=n[++s]);c<d;c++){let m=a[c];l?r(i,c,h,l,m):t(i,c,h,m)}}return n[e]=i}function _f(e){return Array.isArray(e)?e[0]instanceof Ri?e:[Rb,e]:[e,void 0]}function mf(e,t){return e instanceof Y?e.u:Array.isArray(e)?hn(e,t,!1):void 0}function Zl(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function Ql(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,d)=>o(c,l,d,a||=qn(Yl,Zl,Ql,n).V,s||=ed(n),i)}function ed(e){let t=e[yf];if(t!=null)return t;let r=qn(Yl,Zl,Ql,e);return t=r.la?(n,i)=>vf(n,i,r):(n,i)=>{let o=0|n[Q];for(;of(i)&&i.h!=4;){var s=i.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=Pb(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).l,Qs(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=rf(a.g,c)),s=n,a&&((c=s[yi])?c.push(a):s[yi]=[a]))}return 16384&o&&bi(n),!0},e[yf]=t}function Pb(e){let t=(e=_f(e))[0].g;if(e=e[1]){let r=ed(e),n=qn(Yl,Zl,Ql,e).V;return(i,o,s)=>t(i,o,s,n,r)}return t}function aa(e,t,r){e[t]=r.h}function ca(e,t,r,n){let i,o,s=r.h;e[t]=(a,c,l)=>s(a,c,l,o||=qn(sa,aa,ca,n).V,i||=kf(n))}function kf(e){let t=e[bf];if(!t){let r=qn(sa,aa,ca,e);t=(n,i)=>Sf(n,i,r),e[bf]=t}return t}function Sf(e,t,r){for(var n=0|e[Q],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,d=Ef(r,l);d&&d(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=Ef(r,i))&&a(t,o,i)}if(e=fl(e))for(Ii(t,t.g.end()),r=0;r<e.length;r++)Ii(t,sl(e[r])||new Uint8Array(0))}function Ef(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=_f(r))[0].h;if(r=r[1]){let i=kf(r),o=qn(sa,aa,ca,r).V;r=e.la?wf(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Pi(e,t){if(Array.isArray(t)){var r=0|t[Q];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),tt(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function kt(e,t,r){return new Ri(e,t,r)}function Di(e,t,r){return new Ri(e,t,r)}function St(e,t,r){ze(e,0|e[Q],t,r)}var Db=oa(function(e,t,r,n,i){return e.h===2&&(e=Co(e,hn([void 0,void 0],n,!0),i),ln(n=0|t[Q]),(i=Kr(t,n,r))instanceof er?(2&i.L)!=0?((i=i.X()).push(e),ze(t,n,r,i)):i.Na(e):Array.isArray(i)?(2&(0|i[Q])&&ze(t,n,r,i=Kp(i)),i.push(e)):ze(t,n,r,[e]),!0)},function(e,t,r,n,i){if(t instanceof er)t.forEach((o,s)=>{ia(e,r,hn([s,o],n,!1),i)});else if(Array.isArray(t))for(let o=0;o<t.length;o++){let s=t[o];Array.isArray(s)&&ia(e,r,hn(s,n,!1),i)}});function Cf(e,t,r){if(t=function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(wl(64,n));if(Ws(n)){if(i==="string")return kl(n);if(i==="number")return _l(n)}}(t),t!=null&&(typeof t=="string"&&lf(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,vi(t),Ai(e,Ae,We);break;case"bigint":r=BigInt.asUintN(64,t),r=new Wl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Ai(e.g,r.h,r.g);break;default:r=lf(t),Ai(e.g,r.h,r.g)}}function xf(e,t,r){(t=_i(t))!=null&&t!=null&&(zt(e,r,0),ra(e.g,t))}function Af(e,t,r){(t=Lp(t))!=null&&(zt(e,r,0),e.g.g.push(t?1:0))}function Tf(e,t,r){(t=Si(t))!=null&&na(e,r,pp(t))}function If(e,t,r,n,i){ia(e,r,mf(t,n),i)}function Rf(e,t,r){(t=t==null||typeof t=="string"||yo(t)||t instanceof qr?t:void 0)!=null&&na(e,r,Ll(t).buffer)}function Pf(e,t,r){return(e.h===5||e.h===2)&&(t=Ci(t,0|t[Q],r,!1,!1),e.h==2?ea(e,jl,t):t.push(jl(e.g)),!0)}var Qr=kt(function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=Nl(n);let i=Nl(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,St(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=dn(t))!=null&&(zt(e,r,1),e=e.g,(r=Bp||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Ae=r.getUint32(0,!0),We=r.getUint32(4,!0),xo(e,Ae),xo(e,We))},yr()),rt=kt(function(e,t,r){return e.h===5&&(St(t,r,jl(e.g)),!0)},function(e,t,r){(t=dn(t))!=null&&(zt(e,r,5),e=e.g,yl(t),xo(e,Ae))},Jl),Bb=Di(Pf,function(e,t,r){if((t=Pi(dn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,5),n=n.g,yl(o),xo(n,Ae))}},Jl),td=Di(Pf,function(e,t,r){if((t=Pi(dn,t))!=null&&t.length){zt(e,r,2),Ti(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,yl(t[n]),xo(r,Ae)}},Jl),fn=kt(function(e,t,r){return e.h===0&&(St(t,r,Fl(e.g,vl)),!0)},Cf,uf),rd=kt(function(e,t,r){return e.h===0&&(St(t,r,(e=Fl(e.g,vl))===0?void 0:e),!0)},Cf,uf),Ob=kt(function(e,t,r){return e.h===0&&(St(t,r,Fl(e.g,bl)),!0)},function(e,t,r){if((t=fb(t))!=null&&(typeof t=="string"&&cf(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,vi(t),Ai(e,Ae,We);break;case"bigint":r=BigInt.asUintN(64,t),r=new Hl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Ai(e.g,r.h,r.g);break;default:r=cf(t),Ai(e.g,r.h,r.g)}},yr()),$e=kt(function(e,t,r){return e.h===0&&(St(t,r,pn(e.g)),!0)},xf,Xl),la=Di(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ci(t,0|t[Q],r,!1,!1),e.h==2?ea(e,pn,t):t.push(pn(e.g)),!0)},function(e,t,r){if((t=Pi(_i,t))!=null&&t.length){r=$l(e,r);for(let n=0;n<t.length;n++)ra(e.g,t[n]);Gl(e,r)}},Xl),Bi=kt(function(e,t,r){return e.h===0&&(St(t,r,(e=pn(e.g))===0?void 0:e),!0)},xf,Xl),Le=kt(function(e,t,r){return e.h===0&&(St(t,r,Ml(e.g)),!0)},Af,df),Oi=kt(function(e,t,r){return e.h===0&&(St(t,r,(e=Ml(e.g))===!1?void 0:e),!0)},Af,df),vt=Di(function(e,t,r){return e.h===2&&(e=Vl(e),Ci(t,0|t[Q],r,!1).push(e),!0)},function(e,t,r){if((t=Pi(Si,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&na(n,i,pp(o))}},Kl),mn=kt(function(e,t,r){return e.h===2&&(St(t,r,(e=Vl(e))===""?void 0:e),!0)},Tf,Kl),_e=kt(function(e,t,r){return e.h===2&&(St(t,r,Vl(e)),!0)},Tf,Kl),at=function(e,t,r=ql){return new Ri(e,t,r)}(function(e,t,r,n,i){return e.h===2&&(n=hn(void 0,n,!0),Ci(t,0|t[Q],r,!0).push(n),Co(e,n,i),!0)},function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)If(e,t[o],r,n,i)}),Ce=oa(function(e,t,r,n,i,o){return e.h===2&&(Jp(t,0|t[Q],o,r),Co(e,t=Ol(t,n,r),i),!0)},If),Df=kt(function(e,t,r){return e.h===2&&(St(t,r,sf(e)),!0)},Rf,pf),Ub=Di(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ci(t,0|t[Q],r,!1,!1),e.h==2?ea(e,Zr,t):t.push(Zr(e.g)),!0)},function(e,t,r){if((t=Pi(Fp,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,0),Ti(n.g,o))}},hf),Lb=kt(function(e,t,r){return e.h===0&&(St(t,r,(e=Zr(e.g))===0?void 0:e),!0)},function(e,t,r){(t=Fp(t))!=null&&t!=null&&(zt(e,r,0),Ti(e.g,t))},hf),nr=kt(function(e,t,r){return e.h===0&&(St(t,r,pn(e.g)),!0)},function(e,t,r){(t=_i(t))!=null&&(t=parseInt(t,10),zt(e,r,0),ra(e.g,t))},ff),Bf=class{constructor(t,r){this.h=t,this.g=r,this.l=ye,this.m=ne,this.defaultValue=void 0}};function br(e,t){return new Bf(e,t)}function gn(e,t){return(r,n)=>{if(ta.length){let o=ta.pop();o.o(n),zl(o.g,r,n),r=o}else r=new class{constructor(o,s){if(nf.length){let a=nf.pop();zl(a,o,s),o=a}else o=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,zl(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ba=!1}}(o,s);this.g=o,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({fa:o=!1}={}){this.fa=o}}(r,n);try{let o=new e,s=o.u;ed(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.h=-1,ta.length<100&&ta.push(r)}return i}}function da(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}}}};Sf(this.u,t,qn(sa,aa,ca,e)),Ii(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,i=n.length,o=0;for(let s=0;s<i;s++){let a=n[s];r.set(a,o),o+=a.length}return t.l=[r],r}}var Of=class extends Y{constructor(e){super(e)}},Uf=[0,mn,kt(function(e,t,r){return e.h===2&&(St(t,r,(e=sf(e))===Hn()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof Y){let n=t.Ra;return void(n&&(t=n(t),t!=null&&na(e,r,Ll(t).buffer)))}if(Array.isArray(t))return}Rf(e,t,r)},pf)],nd,Lf=globalThis.trustedTypes;function Ff(e){nd===void 0&&(nd=function(){let r=null;if(!Lf)return r;try{let n=i=>i;r=Lf.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch(n){}return r}());var t=nd;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Fb(e,...t){if(t.length===0)return Ff(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return Ff(r)}var Mf=[0,$e,nr,Le,-1,la,nr,-1],Mb=class extends Y{constructor(e){super(e)}},Nf=[0,Le,_e,Le,nr,-1,Di(function(e,t,r){return(e.h===0||e.h===2)&&(t=Ci(t,0|t[Q],r,!1,!1),e.h==2?ea(e,Eb,t):t.push(pn(e.g)),!0)},function(e,t,r){if((t=Pi(_i,t))!=null&&t.length){r=$l(e,r);for(let n=0;n<t.length;n++)ra(e.g,t[n]);Gl(e,r)}},ff),_e,-1,[0,Le,-1],nr,Le,-1],jf=[0,_e,-2],zf=class extends Y{constructor(e){super(e)}},Vf=[0],Hf=[0,$e,Le,1,Le,-3],Vt=class extends Y{constructor(e){super(e,2)}},nt={};nt[336783863]=[0,_e,Le,-1,$e,[0,[1,2,3,4,5,6,7,8],Ce,Vf,Ce,Nf,Ce,jf,Ce,Hf,Ce,Mf,Ce,[0,_e,-2],Ce,[0,_e,nr],Ce,[0,nr,_e]],[0,_e],Le,[0,[1,3],[2,4],Ce,[0,la],-1,Ce,[0,vt],-1,at,[0,_e,-1]],_e];var Wf=[0,rd,-1,Oi,-3,rd,la,mn,Bi,rd,-1,Oi,Bi,Oi,-2,mn];function Ht(e,t){Rl(e,2,ki(t),"")}function Pe(e,t){Zs(e,3,t)}function me(e,t){Zs(e,4,t)}var Et=class extends Y{constructor(e){super(e,500)}o(e){return ne(this,0,7,e)}},Ao=[-1,{}],$f=[0,_e,1,Ao],Gf=[0,_e,vt,Ao];function Wt(e,t){Js(e,1,Et,t)}function Ue(e,t){Zs(e,10,t)}function be(e,t){Zs(e,15,t)}var Rt=class extends Y{constructor(e){super(e,500)}o(e){return ne(this,0,1001,e)}},qf=[-500,at,[-500,mn,-1,vt,-3,[-2,nt,Le],at,Uf,Bi,-1,$f,Gf,at,[0,mn,Oi],mn,Wf,Bi,vt,987,vt],4,at,[-500,_e,-1,[-1,{}],998,_e],at,[-500,_e,vt,-1,[-2,{},Le],997,vt,-1],Bi,at,[-500,_e,vt,Ao,998,vt],vt,Bi,$f,Gf,at,[0,mn,-1,Ao],vt,-2,Wf,mn,-1,Oi,[0,Oi,Lb],978,Ao,at,Uf];Rt.prototype.g=da(qf);var Nb=gn(Rt,qf),jb=class extends Y{constructor(e){super(e)}},Kf=class extends Y{constructor(e){super(e)}g(){return Yr(this,jb,1)}},Xf=[0,at,[0,$e,rt,_e,-1]],ha=gn(Kf,Xf),zb=class extends Y{constructor(e){super(e)}},Vb=class extends Y{constructor(e){super(e)}},id=class extends Y{constructor(e){super(e)}h(){return ye(this,zb,2)}g(){return Yr(this,Vb,5)}},Jf=gn(class extends Y{constructor(e){super(e)}},[0,vt,la,td,[0,nr,[0,$e,-3],[0,rt,-3],[0,$e,-1,[0,at,[0,$e,-2]]],at,[0,rt,-1,_e,rt]],_e,-1,fn,at,[0,$e,rt],vt,fn]),Yf=class extends Y{constructor(e){super(e)}},Ui=gn(class extends Y{constructor(e){super(e)}},[0,at,[0,rt,-4]]),Zf=class extends Y{constructor(e){super(e)}},To=gn(class extends Y{constructor(e){super(e)}},[0,at,[0,rt,-4]]),Hb=class extends Y{constructor(e){super(e)}},Wb=[0,$e,-1,td,nr],Qf=class extends Y{constructor(e){super(e)}};Qf.prototype.g=da([0,rt,-4,fn]);var $b=class extends Y{constructor(e){super(e)}},Gb=gn(class extends Y{constructor(e){super(e)}},[0,at,[0,1,$e,_e,Xf],fn]),em=class extends Y{constructor(e){super(e)}},qb=class extends Y{constructor(e){super(e)}oa(){let e=qp(this);return e??Hn()}},Kb=class extends Y{constructor(e){super(e)}},Xp=[1,2],Xb=gn(class extends Y{constructor(e){super(e)}},[0,at,[0,Xp,Ce,[0,td],Ce,[0,Df],$e,_e],fn]),od=class extends Y{constructor(e){super(e)}},tm=[0,_e,$e,rt,vt,-1],rm=class extends Y{constructor(e){super(e)}},Jb=[0,Le,-1],nm=class extends Y{constructor(e){super(e)}},ua=[1,2,3,4,5],pa=class extends Y{constructor(e){super(e)}g(){return qp(this)!=null}h(){return rr(this,2)!=null}},Fe=class extends Y{constructor(e){super(e)}g(){return Lp(Ei(this,2))??!1}},im=[0,Df,_e,[0,$e,fn,-1],[0,Ob,fn]],Ze=[0,im,Le,[0,ua,Ce,Hf,Ce,Nf,Ce,Mf,Ce,Vf,Ce,jf],nr],fa=class extends Y{constructor(e){super(e)}},sd=[0,Ze,rt,-1,$e],Yb=br(502141897,fa);nt[502141897]=sd;var Zb=gn(class extends Y{constructor(e){super(e)}},[0,[0,nr,-1,Bb,Ub],Wb]),om=class extends Y{constructor(e){super(e)}},sm=class extends Y{constructor(e){super(e)}},ad=[0,Ze,rt,[0,Ze],Le],am=[0,Ze,sd,ad,rt,[0,[0,im]]],Qb=br(508968150,sm);nt[508968150]=am,nt[508968149]=ad;var cm=class extends Y{constructor(e){super(e)}},ev=br(513916220,cm);nt[513916220]=[0,Ze,am,$e];var Li=class extends Y{constructor(e){super(e)}h(){return ye(this,od,2)}g(){Re(this,2)}},lm=[0,Ze,tm];nt[478825465]=lm;var tv=class extends Y{constructor(e){super(e)}},dm=class extends Y{constructor(e){super(e)}},cd=class extends Y{constructor(e){super(e)}},ld=class extends Y{constructor(e){super(e)}},hm=class extends Y{constructor(e){super(e)}},um=[0,Ze,[0,Ze],lm,-1],pm=[0,Ze,rt,$e],dd=[0,Ze,rt],fm=[0,Ze,pm,dd,rt],rv=br(479097054,hm);nt[479097054]=[0,Ze,fm,um],nt[463370452]=um,nt[464864288]=pm;var nv=br(462713202,ld);nt[462713202]=fm,nt[474472470]=dd;var iv=class extends Y{constructor(e){super(e)}},mm=class extends Y{constructor(e){super(e)}},gm=class extends Y{constructor(e){super(e)}},ym=class extends Y{constructor(e){super(e)}},hd=[0,Ze,rt,-1,$e],ud=[0,Ze,rt,Le];ym.prototype.g=da([0,Ze,dd,[0,Ze],sd,ad,hd,ud]);var bm=class extends Y{constructor(e){super(e)}},ov=br(456383383,bm);nt[456383383]=[0,Ze,tm];var vm=class extends Y{constructor(e){super(e)}},sv=br(476348187,vm);nt[476348187]=[0,Ze,Jb];var wm=class extends Y{constructor(e){super(e)}},_m=class extends Y{constructor(e){super(e)}},km=[0,nr,-1],xb=br(458105876,class extends Y{constructor(e){super(e)}g(){var e=this.u;let t=0|e[Q],r=2&t;return e=function(n,i,o){var s=_m;let a=2&i,c=!1;if(o==null){if(a)return Hp();o=[]}else if(o.constructor===er){if((2&o.L)==0||a)return o;o=o.X()}else Array.isArray(o)?c=!!(2&(0|o[Q])):o=[];if(a){if(!o.length)return Hp();c||(c=!0,bi(o))}else c&&(c=!1,o=Kp(o));return c||(64&(0|o[Q])?o[Q]&=-33:32&i&&Fs(o,32)),ze(n,i,2,s=new er(o,s,mb,void 0)),s}(e,t,Kr(e,t,2)),!r&&_m&&(e.ra=!0),e}});nt[458105876]=[0,km,Db,[!0,fn,[0,_e,-1,vt]]];var pd=class extends Y{constructor(e){super(e)}},Sm=br(458105758,pd);nt[458105758]=[0,Ze,_e,km];var Em=class extends Y{constructor(e){super(e)}},av=br(443442058,Em);nt[443442058]=[0,Ze,_e,$e,rt,vt,-1,Le,rt],nt[514774813]=hd;var Cm=class extends Y{constructor(e){super(e)}},cv=br(516587230,Cm);function fd(e,t){return t=t?t.clone():new od,e.displayNamesLocale!==void 0?Re(t,1,ki(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Re(t,1),e.maxResults!==void 0?Dr(t,2,e.maxResults):"maxResults"in e&&Re(t,2),e.scoreThreshold!==void 0?Z(t,3,e.scoreThreshold):"scoreThreshold"in e&&Re(t,3),e.categoryAllowlist!==void 0?Ys(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&Re(t,4),e.categoryDenylist!==void 0?Ys(t,5,e.categoryDenylist):"categoryDenylist"in e&&Re(t,5),t}function md(e,t=-1,r=""){return{categories:e.map(n=>({index:tr(n,1)??0??-1,score:Ye(n,2)??0,categoryName:rr(n,3)??""??"",displayName:rr(n,4)??""??""})),headIndex:t,headName:r}}function xm(e){var t=$n(e,3,dn,Wn()),r=$n(e,2,_i,Wn()),n=$n(e,1,Si,Wn()),i=$n(e,9,Si,Wn());let o={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)o.categories.push({score:t[s],index:r[s]??-1,categoryName:n[s]??"",displayName:i[s]??""});if((t=ye(e,id,4)?.h())&&(o.boundingBox={originX:tr(t,1)??0,originY:tr(t,2)??0,width:tr(t,3)??0,height:tr(t,4)??0,angle:0}),ye(e,id,4)?.g().length)for(let s of ye(e,id,4).g())o.keypoints.push({x:Xs(s,1)??0,y:Xs(s,2)??0,score:Xs(s,4)??0,label:rr(s,3)??""});return o}function ma(e){let t=[];for(let r of Yr(e,Zf,1))t.push({x:Ye(r,1)??0,y:Ye(r,2)??0,z:Ye(r,3)??0,visibility:Ye(r,4)??0});return t}function Io(e){let t=[];for(let r of Yr(e,Yf,1))t.push({x:Ye(r,1)??0,y:Ye(r,2)??0,z:Ye(r,3)??0,visibility:Ye(r,4)??0});return t}function Am(e){return Array.from(e,t=>t>127?t-256:t)}function Tm(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,i=0;for(let o=0;o<e.length;o++)r+=e[o]*t[o],n+=e[o]*e[o],i+=t[o]*t[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}var ga;nt[516587230]=[0,Ze,hd,ud,rt],nt[518928384]=ud;var lv=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 Im(){if(ga===void 0)try{await WebAssembly.instantiate(lv),ga=!0}catch{ga=!1}return ga}async function Ro(e,t=Fb``){let r=await Im()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var yn=class{};function Rm(){var e=navigator;return typeof OffscreenCanvas!="undefined"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function Pm(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",i=>{n(i)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function Dm(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function ee(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 Bm(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);let[n,i]=Dm(t);return!e.l||n===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=i),[n,i]}function Om(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.i.stringToNewUTF8(t[i]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.i._free(i);e.i._free(t)}function Br(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function bn(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}yn.forVisionTasks=function(e){return Ro("vision",e)},yn.forTextTasks=function(e){return Ro("text",e)},yn.forGenAiExperimentalTasks=function(e){return Ro("genai_experimental",e)},yn.forGenAiTasks=function(e){return Ro("genai",e)},yn.forAudioTasks=function(e){return Ro("audio",e)},yn.isSimdSupported=function(){return Im()};async function dv(e,t,r,n){return e=await(async(i,o,s,a,c)=>{if(o&&await Pm(o),!self.ModuleFactory||s&&(await Pm(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((o=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new i(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:i=>i.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&i.endsWith(".data")?r.assetBinaryPath.toString():i}),await e.o(n),e}function gd(e,t){let r=ye(e.baseOptions,pa,1)||new pa;typeof t=="string"?(Re(r,2,ki(t)),Re(r,1)):t instanceof Uint8Array&&(Re(r,1,pl(t,!1)),Re(r,2)),ne(e.baseOptions,0,1,r)}function Um(e){try{let t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map(r=>r.message).join(", "))}finally{e.G=[]}}function X(e,t){e.B=Math.max(e.B,t)}function ya(e,t){e.A=new Et,Ht(e.A,"PassThroughCalculator"),Pe(e.A,"free_memory"),me(e.A,"free_memory_unused_out"),Ue(t,"free_memory"),Wt(t,e.A)}function Fi(e,t){Pe(e.A,t),me(e.A,t+"_unused_out")}function ba(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var va=class{constructor(e){this.g=e,this.G=[],this.B=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(!(ye(this.baseOptions,pa,1)?.g()||ye(this.baseOptions,pa,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(n,i){let o=ye(n.baseOptions,nm,3);if(!o){var s=o=new nm,a=new zf;So(s,4,ua,a)}"delegate"in i&&(i.delegate==="GPU"?(i=o,s=new Mb,So(i,2,ua,s)):(i=o,s=new zf,So(i,4,ua,s))),ne(n.baseOptions,0,3,o)}(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)}).then(n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),gd(this,"/model.dat"),this.m(),this.I()});if(r.modelAssetBuffer instanceof Uint8Array)gd(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n}(r.modelAssetBuffer).then(n=>{gd(this,n),this.m(),this.I()})}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da(t=>{e=Nb(t)}),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.G.push(Error(n))}),this.g.La(),this.g.setGraph(e,t),this.A=void 0,Um(this)}finishProcessing(){this.g.finishProcessing(),Um(this)}close(){this.A=void 0,this.g.closeGraph()}};function Ct(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}va.prototype.close=va.prototype.close,function(e,t){e=e.split(".");var r,n=zn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t}("TaskRunner",va);var Lm=class{constructor(t,r,n,i){this.g=t,this.h=r,this.m=n,this.l=i}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function Fm(e,t,r){let n=e.g;if(r=Ct(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Mm(e,t){let r=e.g,n=Ct(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let i=Ct(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let o=Ct(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.I),r.vertexAttribPointer(e.I,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 Lm(r,n,i,o)}function yd(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Po(e,t,r,n){return yd(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Mm(e,!0)),r=e.s):(e.v||(e.v=Mm(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function vn(e,t,r){return yd(e,t),e=Ct(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 wa(e,t,r){yd(e,t),e.A||(e.A=Ct(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function bd(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Mi=class{G(){return`
8
+ `);let s=A3(t,r,i),a=al.getSymbolSize(t),c=new g3(a);return S3(c,t),k3(c),E3(c,t),qu(c,r,0),t>=7&&C3(c,t),x3(c,s),isNaN(n)&&(n=Ku.getBestMask(c,qu.bind(null,c,r))),Ku.applyMask(n,c),qu(c,r,n),{modules:c,version:t,errorCorrectionLevel:r,maskPattern:n,segments:i}}my.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=$u.M,i,o;return typeof r<"u"&&(n=$u.from(r.errorCorrectionLevel,$u.M),i=sl.from(r.version),o=Ku.from(r.maskPattern),r.toSJISFunc&&al.setToSJISFunction(r.toSJISFunc)),I3(t,i,n,o)}});var Ju=_e(ii=>{function yy(e){if(typeof e=="number"&&(e=e.toString()),typeof e!="string")throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(n){return[n,n]}))),t.length===6&&t.push("F","F");let r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+t.slice(0,6).join("")}}ii.getOptions=function(t){t||(t={}),t.color||(t.color={});let r=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:n,scale:n?4:i,margin:r,color:{dark:yy(t.color.dark||"#000000ff"),light:yy(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}};ii.getScale=function(t,r){return r.width&&r.width>=t+r.margin*2?r.width/(t+r.margin*2):r.scale};ii.getImageWidth=function(t,r){let n=ii.getScale(t,r);return Math.floor((t+r.margin*2)*n)};ii.qrToImageData=function(t,r,n){let i=r.modules.size,o=r.modules.data,s=ii.getScale(i,n),a=Math.floor((i+n.margin*2)*s),c=n.margin*s,l=[n.color.light,n.color.dark];for(let h=0;h<a;h++)for(let d=0;d<a;d++){let g=(h*a+d)*4,f=n.color.light;if(h>=c&&d>=c&&h<a-c&&d<a-c){let m=Math.floor((h-c)/s),u=Math.floor((d-c)/s);f=l[o[m*i+u]?1:0]}t[g++]=f.r,t[g++]=f.g,t[g++]=f.b,t[g]=f.a}}});var by=_e(cl=>{var Yu=Ju();function R3(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}function P3(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}cl.render=function(t,r,n){let i=n,o=r;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),r||(o=P3()),i=Yu.getOptions(i);let s=Yu.getImageWidth(t.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return Yu.qrToImageData(c.data,t,i),R3(a,o,s),a.putImageData(c,0,0),o};cl.renderToDataURL=function(t,r,n){let i=n;typeof i>"u"&&(!r||!r.getContext)&&(i=r,r=void 0),i||(i={});let o=cl.render(t,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}});var wy=_e(_y=>{var D3=Ju();function vy(e,t){let r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Zu(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function B3(e,t,r){let n="",i=0,o=!1,s=0;for(let a=0;a<e.length;a++){let c=Math.floor(a%t),l=Math.floor(a/t);!c&&!o&&(o=!0),e[a]?(s++,a>0&&c>0&&e[a-1]||(n+=o?Zu("M",c+r,.5+l+r):Zu("m",i,0),i=0,o=!1),c+1<t&&e[a+1]||(n+=Zu("h",s),s=0)):i++}return n}_y.render=function(t,r,n){let i=D3.getOptions(r),o=t.modules.size,s=t.modules.data,a=o+i.margin*2,c=i.color.light.a?"<path "+vy(i.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",l="<path "+vy(i.color.dark,"stroke")+' d="'+B3(s,o,i.margin)+'"/>',h='viewBox="0 0 '+a+" "+a+'"',g='<svg xmlns="http://www.w3.org/2000/svg" '+(i.width?'width="'+i.width+'" height="'+i.width+'" ':"")+h+' shape-rendering="crispEdges">'+c+l+`</svg>
9
+ `;return typeof n=="function"&&n(null,g),g}});var ky=_e(gs=>{var O3=C2(),Qu=gy(),Sy=by(),U3=wy();function ep(e,t,r,n,i){let o=[].slice.call(arguments,1),s=o.length,a=typeof o[s-1]=="function";if(!a&&!O3())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(i=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof i>"u"?(i=n,n=void 0):(i=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(c,l){try{let h=Qu.create(r,n);c(e(h,t,n))}catch(h){l(h)}})}try{let c=Qu.create(r,n);i(null,e(c,t,n))}catch(c){i(c)}}gs.create=Qu.create;gs.toCanvas=ep.bind(null,Sy.render);gs.toDataURL=ep.bind(null,Sy.renderToDataURL);gs.toString=ep.bind(null,function(e,t,r){return U3.render(e,r)})});async function _s(){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return!1;try{let e={audio:!0,video:!0};return(await navigator.mediaDevices.getUserMedia(e)).getTracks().forEach(r=>{r.stop()}),!0}catch{return!1}}async function ws(){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 i=[];window.getScreenDetails().then(function(o){i=o,e(i.screens.length>=2)})}})}async function pr(){let e=["OBS","ManyCam","Snap Camera","Virtual"],r=(await navigator.mediaDevices.enumerateDevices()).filter(i=>!e.some(o=>i.deviceId.includes(o)||i.label.includes(o)));return{cameras:r.filter(i=>i.kind=="videoinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId})),microphones:r.filter(i=>i.kind=="audioinput"&&i.deviceId).map(i=>({label:i.label||"Generic Device",id:i.deviceId}))}}var Nn=typeof self<"u"?self:{};function Un(){throw Error("Invalid UTF8")}function ip(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Ss,ml,Oy=typeof TextDecoder<"u",Uy,Ly=typeof TextEncoder<"u";function yf(e){if(Ly)e=(Uy||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var Kl,Us;e:{for(gl=["CLOSURE_FLAGS"],ks=Nn,Es=0;Es<gl.length;Es++)if((ks=ks[gl[Es]])==null){Us=null;break e}Us=ks}var gl,ks,Es,So,op=Us&&Us[610401301];Kl=op!=null&&op;var sp=Nn.navigator;function Tl(e){return!!Kl&&!!So&&So.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function Yt(e){var t;return(t=Nn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function on(){return!!Kl&&!!So&&So.brands.length>0}function yl(){return on()?Tl("Chromium"):(Yt("Chrome")||Yt("CriOS"))&&!(!on()&&Yt("Edge"))||Yt("Silk")}function Xl(e){return Xl[" "](e),e}So=sp&&sp.userAgentData||null,Xl[" "]=function(){};var Fy=!on()&&(Yt("Trident")||Yt("MSIE"));!Yt("Android")||yl(),yl(),Yt("Safari")&&(yl()||!on()&&Yt("Coast")||!on()&&Yt("Opera")||!on()&&Yt("Edge")||(on()?Tl("Microsoft Edge"):Yt("Edg/"))||on()&&Tl("Opera"));var bf={},go=null;function My(e){let 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);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),d=go[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}vf();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),g=a(64);if(g===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),g!=64&&s(d<<6&192|g))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function vf(){if(!go){go={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));bf[r]=n;for(let i=0;i<n.length;i++){let o=n[i];go[o]===void 0&&(go[o]=i)}}}}var _f=typeof Uint8Array<"u",wf=!Fy&&typeof btoa=="function";function ap(e){if(!wf){var t;t===void 0&&(t=0),vf(),t=bf[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var cp=/[-_.]/g,Ny={"-":"+",_:"/",".":"="};function zy(e){return Ny[e]||""}function Sf(e){if(!wf)return My(e);cp.test(e)&&(e=e.replace(cp,zy)),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 Ao(e){return _f&&e!=null&&e instanceof Uint8Array}var mi={};function zn(){return jy||=new Gr(null,mi)}function Jl(e){kf(mi);var t=e.g;return(t=t==null||Ao(t)?t:typeof t=="string"?Sf(t):null)==null?t:e.g=t}var Gr=class{h(){return new Uint8Array(Jl(this)||0)}constructor(e,t){if(kf(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},jy,Vy;function kf(e){if(e!==mi)throw Error("illegal external caller")}function Ef(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function Il(e){return Ef(e=Error(e),"warning"),e}var $s=typeof Symbol=="function"&&typeof Symbol()=="symbol",Hy=new Set;function To(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&Hy.add(e),e}var Wy=To("jas",void 0,!0,!0),lp=To(void 0,"0di"),bl=To(void 0,"2ex"),po=To(void 0,"1oa",!0),gi=To(void 0,Symbol(),!0),ee=$s?Wy:"Ga",Cf={Ga:{value:0,configurable:!0,writable:!0,enumerable:!1}},xf=Object.defineProperties;function Gs(e,t){$s||ee in e||xf(e,Cf),e[ee]|=t}function Qe(e,t){$s||ee in e||xf(e,Cf),e[ee]=t}function Ci(e){return Gs(e,34),e}function $y(e,t){Qe(t,-30975&(0|e))}function Rl(e,t){Qe(t,-30941&(34|e))}function Yl(){return typeof BigInt=="function"}function Tt(e){return Array.prototype.slice.call(e)}var Zl,Io={},Af={};function hp(e){return!(!e||typeof e!="object"||e.Ia!==Af)}function Ql(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function eh(e,t){if(e!=null){if(typeof e=="string")e=e?new Gr(e,mi):zn();else if(e.constructor!==Gr)if(Ao(e))e=e.length?new Gr(new Uint8Array(e),mi):zn();else{if(!t)throw Error();e=void 0}}return e}function Ls(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[ee]))}var dp=[];function un(e){if(2&e)throw Error()}Qe(dp,55),Zl=Object.freeze(dp);var Fs=class e{constructor(t,r,n){this.l=0,this.g=t,this.h=r,this.m=n}next(){if(this.l<this.g.length){let t=this.g[this.l++];return{done:!1,value:this.h?this.h.call(this.m,t):t}}return{done:!0,value:void 0}}[Symbol.iterator](){return new e(this.g,this.h,this.m)}};function th(e){return gi?e[gi]:void 0}var Gy=Object.freeze({});function qs(e){return e.Qa=!0,e}var qy=qs((e=>typeof e=="number")),up=qs((e=>typeof e=="string")),Ky=qs((e=>typeof e=="boolean")),Ks=typeof Nn.BigInt=="function"&&typeof Nn.BigInt(0)=="bigint",Pl=qs((e=>Ks?e>=Jy&&e<=Zy:e[0]==="-"?pp(e,Xy):pp(e,Yy))),Xy=Number.MIN_SAFE_INTEGER.toString(),Jy=Ks?BigInt(Number.MIN_SAFE_INTEGER):void 0,Yy=Number.MAX_SAFE_INTEGER.toString(),Zy=Ks?BigInt(Number.MAX_SAFE_INTEGER):void 0;function pp(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var Qy=typeof Uint8Array.prototype.slice=="function",Tf,Ae=0,We=0;function fp(e){let t=e>>>0;Ae=t,We=(e-t)/4294967296>>>0}function yi(e){if(e<0){fp(-e);let[t,r]=oh(Ae,We);Ae=t>>>0,We=r>>>0}else fp(e)}function rh(e){let t=Tf||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),We=0,Ae=t.getUint32(0,!0)}function nh(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:ko(e,t)}function ih(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=nh(e,t))=="number"?r?-e:e:r?"-"+e:e}function ko(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Yl()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+mp(r)+mp(e));return r}function mp(e){return e=String(e),"0000000".slice(e.length)+e}function Xs(e){if(e.length<16)yi(Number(e));else if(Yl())e=BigInt(e),Ae=Number(e&BigInt(4294967295))>>>0,We=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");We=Ae=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));We*=1e6,Ae=1e6*Ae+o,Ae>=4294967296&&(We+=Math.trunc(Ae/4294967296),We>>>=0,Ae>>>=0)}if(t){let[n,i]=oh(Ae,We);Ae=n,We=i}}}function oh(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var sh=typeof BigInt=="function"?BigInt.asIntN:void 0,eb=typeof BigInt=="function"?BigInt.asUintN:void 0,hi=Number.isSafeInteger,Js=Number.isFinite,Ms=Math.trunc;function pn(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function If(e){return e==null||typeof e=="boolean"?e:typeof e=="number"?!!e:void 0}var tb=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ys(e){switch(typeof e){case"bigint":return!0;case"number":return Js(e);case"string":return tb.test(e);default:return!1}}function xi(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Js(e)?0|e:void 0}function Rf(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return Js(e)?e>>>0:void 0}function gp(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function ah(e){return e=Ms(e),hi(e)||(yi(e),e=ih(Ae,We)),e}function ch(e){var t=Ms(Number(e));if(hi(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(Xs(e),e=Ae,2147483648&(t=We))if(Yl())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=oh(e,t);e="-"+ko(r,n)}else e=ko(e,t);return e}function Ns(e){return e==null?e:typeof e=="bigint"?(Pl(e)?e=Number(e):(e=sh(64,e),e=Pl(e)?Number(e):String(e)),e):Ys(e)?typeof e=="number"?ah(e):ch(e):void 0}function rb(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(eb(64,e));if(Ys(e)){if(t==="string")return t=Ms(Number(e)),hi(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),gp(e)||(Xs(e),e=ko(Ae,We))),e;if(t==="number")return(e=Ms(e))>=0&&hi(e)?e:(function(r){if(r<0){yi(r);var n=ko(Ae,We);return r=Number(n),hi(r)?r:n}return gp(n=String(r))?n:(yi(r),nh(Ae,We))})(e)}}function Pf(e){if(typeof e!="string")throw Error();return e}function Ai(e){if(e!=null&&typeof e!="string")throw Error();return e}function bi(e){return e==null||typeof e=="string"?e:void 0}function lh(e,t,r,n){if(e!=null&&typeof e=="object"&&e.W===Io)return e;if(!Array.isArray(e))return r?2&n?((e=t[lp])||(Ci((e=new t).u),e=t[lp]=e),t=e):t=new t:t=void 0,t;let i=r=0|e[ee];return i===0&&(i|=32&n),i|=2&n,i!==r&&Qe(e,i),new t(e)}function nb(e,t,r){if(t)e:{if(!Ys(t=e))throw Il("int64");switch(typeof t){case"string":t=ch(t);break e;case"bigint":if(e=t=sh(64,t),up(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(qy(e)&&!Number.isSafeInteger(e))throw Error(String(e));t=Ks?BigInt(t):Ky(t)?t?"1":"0":up(t)?t.trim()||"0":String(t);break e;default:t=ah(t)}}else t=Ns(e);return typeof(r=(e=t)==null?r?0:void 0:e)=="string"&&hi(t=+r)?t:r}var ib={},ob=(function(){try{return Xl(new class extends Map{constructor(){super()}}),!1}catch{return!0}})(),bo=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()}},sb=ob?(Object.setPrototypeOf(bo.prototype,Map.prototype),Object.defineProperties(bo.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),bo):class extends Map{constructor(){super()}};function yp(e){return e}function vl(e){if(2&e.L)throw Error("Cannot mutate an immutable Map")}var Qt=class extends sb{constructor(e,t,r=yp,n=yp){super();let i=0|e[ee];i|=64,Qe(e,i),this.L=i,this.S=t,this.R=r,this.Y=this.S?ab:n;for(let o=0;o<e.length;o++){let s=e[o],a=r(s[0],!1,!0),c=s[1];t?c===void 0&&(c=null):c=n(s[1],!1,!0,void 0,void 0,i),super.set(a,c)}}na(e=bp){if(this.size!==0)return this.X(e)}X(e=bp){let t=[],r=super.entries();for(var n;!(n=r.next()).done;)(n=n.value)[0]=e(n[0]),n[1]=e(n[1]),t.push(n);return t}clear(){vl(this),super.clear()}delete(e){return vl(this),super.delete(this.R(e,!0,!1))}entries(){var e=this.ma();return new Fs(e,cb,this)}keys(){return this.Ha()}values(){var e=this.ma();return new Fs(e,Qt.prototype.get,this)}forEach(e,t){super.forEach(((r,n)=>{e.call(t,this.get(n),n,this)}))}set(e,t){return vl(this),(e=this.R(e,!0,!1))==null?this:t==null?(super.delete(e),this):super.set(e,this.Y(t,!0,!0,this.S,!1,this.L))}Na(e){let t=this.R(e[0],!1,!0);e=e[1],e=this.S?e===void 0?null:e:this.Y(e,!1,!0,void 0,!1,this.L),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.S;return r?((r=this.Y(t,!1,!0,r,this.ra,this.L))!==t&&super.set(e,r),r):t}}ma(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function ab(e,t,r,n,i,o){return e=lh(e,n,r,o),i&&(e=Qs(e)),e}function bp(e){return e}function cb(e){return[e,this.get(e)]}var lb,Df,hb;function vp(){return lb||=new Qt(Ci([]),void 0,void 0,void 0,ib)}function hh(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=Ls(e)?void 0:i&&2&(0|e[ee])?e:dh(e,t,r,n!==void 0,i);else if(Ql(e)){let o={};for(let s in e)o[s]=hh(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function dh(e,t,r,n,i){let o=n||r?0|e[ee]:0,s=n?!!(32&o):void 0;n=Tt(e);for(let a=0;a<n.length;a++)n[a]=hh(n[a],t,r,s,i);return r&&((e=th(e))&&(n[gi]=Tt(e)),r(o,n)),n}function db(e){return hh(e,Bf,void 0,void 0,!1)}function Bf(e){return e.W===Io?e.toJSON():e instanceof Qt?e.na(db):(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Pl(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(Ls(t))return}else{if(Ao(t))return ap(t);if(t instanceof Gr){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=ap(r)}if(t instanceof Qt)return t.na()}}return t})(e)}function Of(e){return dh(e,Bf,void 0,void 0,!1)}function an(e,t,r){return e=Uf(e,t[0],t[1],r?1:2),t!==Df&&r&&Gs(e,16384),e}function Uf(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[ee]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Ql(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return Qe(e,i),e}function Dl(e,t,r=Rl){if(e!=null){if(_f&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[ee];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(Qe(e,-12293&(34|n)),e):dh(e,Dl,4&n?Rl:r,!0,!0))}return e.W===Io?e=2&(n=0|(r=e.u)[ee])?e:new e.constructor(Zs(r,n,!0)):e instanceof Qt&&!(2&e.L)&&(r=Ci(e.X(Dl)),e=new Qt(r,e.S,e.R,e.Y)),e}}function Zs(e,t,r){let n=r||2&t?Rl:$y,i=!!(32&t);return e=(function(o,s,a){let c=Tt(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(o=th(o))&&(c[gi]=Tt(o)),c})(e,t,(o=>Dl(o,i,n))),Gs(e,32|(r?2:0)),e}function Qs(e){let t=e.u,r=0|t[ee];return 2&r?new e.constructor(Zs(t,r,!1)):e}function vi(e,t){return Jr(e=e.u,0|e[ee],t)}function Jr(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&bl!=null&&((i=(e=Vy??={})[bl]||0)>=4||(e[bl]=i+1,Ef(e=Error(),"incident"),(function(s){Nn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function Re(e,t,r){let n=e.u,i=0|n[ee];return un(i),ze(n,i,t,r),e}function ze(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},Qe(e,t|=256)):e[o]=n),t)}function Is(e,t){let r=0|(e=e.u)[ee],n=Jr(e,r,t),i=pn(n);return i!=null&&i!==n&&ze(e,r,t,i),i}function Lf(e){let t=0|(e=e.u)[ee],r=Jr(e,t,1),n=eh(r,!0);return n!=null&&n!==r&&ze(e,t,1,n),n}function Ln(){return Gy===void 0?2:4}function Fn(e,t,r,n,i){let o=e.u,s=2&(e=0|o[ee])?1:n;i=!!i;let a=0|(n=uh(o,e,t))[ee];if(!(4&a)){4&a&&(n=Tt(n),a=qr(a,e),e=ze(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=ph(a,e),r=-4097&(20|a),a=r&=-8193,Qe(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?$r(a)||(i=a,a|=2,a!==i&&Qe(n,a),Object.freeze(n)):(s===2&&$r(a)&&(n=Tt(n),a=qr(a,e),a=cn(a,e,i),Qe(n,a),e=ze(o,e,t,n)),$r(a)||(t=a,a=cn(a,e,i),a!==t&&Qe(n,a))),n}function uh(e,t,r,n){return e=Jr(e,t,r,n),Array.isArray(e)?e:Zl}function ph(e,t){return e===0&&(e=qr(e,t)),1|e}function $r(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function Ff(e){e=Tt(e);for(let t=0;t<e.length;t++){let r=e[t]=Tt(e[t]);Array.isArray(r[1])&&(r[1]=Ci(r[1]))}return e}function Bl(e,t,r,n){let i=0|(e=e.u)[ee];un(i),ze(e,i,t,(n==="0"?Number(r)===0:r===n)?void 0:r)}function Ti(e,t,r,n,i){un(t);var o=!(!(64&t)&&16384&t);let s=(i=uh(e,t,r,i))!==Zl;if(o||!s){let a=o=s?0|i[ee]:0;(!s||2&a||$r(a)||4&a&&!(32&a))&&(i=Tt(i),a=qr(a,t),t=ze(e,t,r,i)),a=-13&ph(a,t),a=cn(n?-17&a:16|a,t,!0),a!==o&&Qe(i,a)}return i}function _l(e,t){var r=xm;return mh(fh(e=e.u),e,0|e[ee],r)===t?t:-1}function fh(e){if($s)return e[po]??(e[po]=new Map);if(po in e)return e[po];let t=new Map;return Object.defineProperty(e,po,{value:t}),t}function Mf(e,t,r,n){let i=fh(e),o=mh(i,e,t,r);return o!==n&&(o&&(t=ze(e,t,o)),i.set(r,n)),t}function mh(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Jr(t,r,s)!=null&&(i!==0&&(r=ze(t,r,i)),i=s)}return e.set(n,i),i}function gh(e,t,r,n){let i,o=0|e[ee];if((n=Jr(e,o,r,n))!=null&&n.W===Io)return(t=Qs(n))!==n&&ze(e,o,r,t),t.u;if(Array.isArray(n)){let s=0|n[ee];i=2&s?an(Zs(n,s,!1),t,!0):64&s?n:an(i,t,!0)}else i=an(void 0,t,!0);return i!==n&&ze(e,o,r,i),i}function Nf(e,t,r,n){let i=0|(e=e.u)[ee];return(t=lh(n=Jr(e,i,r,n),t,!1,i))!==n&&t!=null&&ze(e,i,r,t),t}function ye(e,t,r,n=!1){if((t=Nf(e,t,r,n))==null)return t;if(!(2&(n=0|(e=e.u)[ee]))){let i=Qs(t);i!==t&&ze(e,n,r,t=i)}return t}function zf(e,t,r,n,i,o,s){e=e.u;var a=!!(2&t);let c=a?1:i;o=!!o,s&&=!a;var l=0|(i=uh(e,t,n))[ee];if(!(a=!!(4&l))){var h=i,d=t;let g=!!(2&(l=ph(l,t)));g&&(d|=2);let f=!g,m=!0,u=0,b=0;for(;u<h.length;u++){let _=lh(h[u],r,!1,d);if(_ instanceof r){if(!g){let k=!!(2&(0|_.u[ee]));f&&=!k,m&&=k}h[b++]=_}}b<u&&(h.length=b),l|=4,l=m?16|l:-17&l,Qe(h,l=f?8|l:-9&l),g&&Object.freeze(h)}if(s&&!(8&l||!i.length&&(c===1||c===4&&32&l))){for($r(l)&&(i=Tt(i),l=qr(l,t),t=ze(e,t,n,i)),r=i,s=l,h=0;h<r.length;h++)(l=r[h])!==(d=Qs(l))&&(r[h]=d);s|=8,Qe(r,s=r.length?-17&s:16|s),l=s}return c===1||c===4&&32&l?$r(l)||(t=l,(l|=!i.length||16&l&&(!a||32&l)?2:2048)!==t&&Qe(i,l),Object.freeze(i)):(c===2&&$r(l)&&(Qe(i=Tt(i),l=cn(l=qr(l,t),t,o)),t=ze(e,t,n,i)),$r(l)||(n=l,(l=cn(l,t,o))!==n&&Qe(i,l))),i}function Kr(e,t,r){let n=0|e.u[ee];return zf(e,n,t,r,Ln(),!1,!(2&n))}function ne(e,t,r,n){return n==null&&(n=void 0),Re(e,r,n)}function vo(e,t,r,n){n==null&&(n=void 0);e:{let i=0|(e=e.u)[ee];if(un(i),n==null){let o=fh(e);if(mh(o,e,i,r)!==t)break e;o.set(r,0)}else i=Mf(e,i,r,t);ze(e,i,t,n)}}function qr(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function cn(e,t,r){return 32&t&&r||(e&=-33),e}function zs(e,t,r,n){let i=0|e.u[ee];un(i),e=zf(e,i,r,t,2,!0),n=n??new r,e.push(n),e[ee]=2&(0|n.u[ee])?-9&e[ee]:-17&e[ee]}function Zt(e,t){return xi(vi(e,t))}function er(e,t){return bi(vi(e,t))}function Je(e,t){return Is(e,t)??0}function Eo(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}`);Re(e,t,r)}function Br(e,t,r){if(r!=null){if(typeof r!="number"||!Js(r))throw Il("int32");r|=0}Re(e,t,r)}function Z(e,t,r){if(r!=null&&typeof r!="number")throw Error(`Value of float/double field must be a number, found ${typeof r}: ${r}`);Re(e,t,r)}function js(e,t,r){{let s=e.u,a=0|s[ee];if(un(a),r==null)ze(s,a,t);else{var n=e=0|r[ee],i=$r(e),o=i||Object.isFrozen(r);for(i||(e=0),o||(r=Tt(r),n=0,e=cn(e=qr(e,a),a,!0),o=!1),e|=21,i=0;i<r.length;i++){let c=r[i],l=Pf(c);Object.is(c,l)||(o&&(r=Tt(r),n=0,e=cn(e=qr(e,a),a,!0),o=!1),r[i]=l)}e!==n&&(o&&(r=Tt(r),e=cn(e=qr(e,a),a,!0)),Qe(r,e)),ze(s,a,t,r)}}}function ea(e,t,r){un(0|e.u[ee]),Fn(e,t,bi,2,!0).push(Pf(r))}function jf(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function yh(){return Error("Failed to read varint, encoding is invalid.")}function Vf(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function bh(e){if(typeof e=="string")return{buffer:Sf(e),N:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Uint8Array)return{buffer:e,N:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),N:!1};if(e.constructor===Gr)return{buffer:Jl(e)||new Uint8Array(0),N:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),N:!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 vh(e,t){let r,n=0,i=0,o=0,s=e.h,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(Mn(e,a),r<128)return t(n>>>0,i>>>0);throw yh()}function _h(e){let t=0,r=e.g,n=r+10,i=e.h;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return Mn(e,r),!!(127&t)}throw yh()}function ln(e){let t=e.h,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw yh();return Mn(e,r),i}function Xr(e){return ln(e)>>>0}function Ol(e){var t=e.h;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],Mn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Ul(e){var t=Ol(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function ub(e){return ln(e)}function wl(e,t,{ba:r=!1}={}){e.ba=r,t&&(t=bh(t),e.h=t.buffer,e.m=t.N,e.j=0,e.l=e.h.length,e.g=e.j)}function Mn(e,t){if(e.g=t,t>e.l)throw Vf(e.l,t)}function Hf(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.l)throw Vf(t,e.l-r);return e.g=n,r}function Wf(e,t){if(t==0)return zn();var r=Hf(e,t);return e.ba&&e.m?r=e.h.subarray(r,r+t):(e=e.h,r=r===(t=r+t)?new Uint8Array(0):Qy?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?zn():new Gr(r,mi)}Qt.prototype.toJSON=void 0,Qt.prototype.Ia=Af;var _p=[];function $f(e){var t=e.g;if(t.g==t.l)return!1;e.l=e.g.g;var r=Xr(e.g);if(t=r>>>3,!((r&=7)>=0&&r<=5))throw jf(r,e.l);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.l})`);return e.m=t,e.h=r,!0}function Rs(e){switch(e.h){case 0:e.h!=0?Rs(e):_h(e.g);break;case 1:Mn(e=e.g,e.g+8);break;case 2:if(e.h!=2)Rs(e);else{var t=Xr(e.g);Mn(e=e.g,e.g+t)}break;case 5:Mn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!$f(e))throw Error("Unmatched start-group tag: stream EOF");if(e.h==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Rs(e)}break;default:throw jf(e.h,e.l)}}function Ro(e,t,r){let n=e.g.l,i=Xr(e.g),o=e.g.g+i,s=o-n;if(s<=0&&(e.g.l=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);return e.g.g=o,e.g.l=n,t}function wh(e){var t=Xr(e.g),r=Hf(e=e.g,t);if(e=e.h,Oy){var n,i=e;(n=ml)||(n=ml=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(Ss===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Ss=!0}catch{Ss=!1}}throw!Ss&&(ml=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?Un():(a=e[o++],s<194||(192&a)!=128?(o--,Un()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?Un():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,Un()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?Un():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,Un()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):Un(),r.length>=8192&&(c=ip(c,r),r.length=0)}o=ip(c,r)}return o}function Gf(e){let t=Xr(e.g);return Wf(e.g,t)}function ta(e,t,r){var n=Xr(e.g);for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Cs=[];function pb(e){return e}var di;function fr(e,t,r){t.g?t.m(e,t.g,t.h,r):t.m(e,t.h,r)}var Y=class{constructor(e,t){this.u=Uf(e,t)}toJSON(){let e=!di;try{return e&&(di=Of),qf(this)}finally{e&&(di=void 0)}}l(){var e=Kb;return e.g?e.l(this,e.g,e.h,!0):e.l(this,e.h,e.defaultValue,!0)}clone(){let e=this.u;return new this.constructor(Zs(e,0|e[ee],!1))}N(){return!!(2&(0|this.u[ee]))}};function qf(e){var t=e.u;{t=(e=di(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Ql(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(Ls(n)||hp(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||Ls(o)||hp(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function wp(e){return e?/^\d+$/.test(e)?(Xs(e),new Ll(Ae,We)):null:fb||=new Ll(0,0)}Y.prototype.W=Io,Y.prototype.toString=function(){try{return di=pb,qf(this).toString()}finally{di=void 0}};var Ll=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},fb;function Sp(e){return e?/^-?\d+$/.test(e)?(Xs(e),new Fl(Ae,We)):null:mb||=new Fl(0,0)}var Fl=class{constructor(e,t){this.h=e>>>0,this.g=t>>>0}},mb;function ui(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function Ii(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function ra(e,t){if(t>=0)Ii(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function Co(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 _i(e,t){t.length!==0&&(e.l.push(t),e.h+=t.length)}function zt(e,t,r){Ii(e.g,8*t+r)}function Sh(e,t){return zt(e,t,2),t=e.g.end(),_i(e,t),t.push(e.h),t}function kh(e,t){var r=t.pop();for(r=e.h+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.h++;t.push(r),e.h++}function na(e,t,r){zt(e,t,2),Ii(e.g,r.length),_i(e,e.g.end()),_i(e,r)}function Vs(e,t,r,n){r!=null&&(t=Sh(e,t),n(r,e),kh(e,t))}function mr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var Eh=mr(),Kf=mr(),Ch=mr(),xh=mr(),Xf=mr(),Jf=mr(),Ah=mr(),Yf=mr(),Zf=mr(),Ri=class{constructor(e,t,r){this.g=e,this.h=t,e=Eh,this.l=!!e&&r===e||!1}};function ia(e,t){return new Ri(e,t,Eh)}function Qf(e,t,r,n,i){Vs(e,r,nm(t,n),i)}var gb=ia((function(e,t,r,n,i){return e.h===2&&(Ro(e,gh(t,n,r),i),!0)}),Qf),yb=ia((function(e,t,r,n,i){return e.h===2&&(Ro(e,gh(t,n,r,!0),i),!0)}),Qf),oa=Symbol(),Th=Symbol(),kp=Symbol(),Ep=Symbol(),em,tm;function jn(e,t,r,n){var i=n[e];if(i)return i;(i={}).Pa=n,i.V=(function(d){switch(typeof d){case"boolean":return Df||=[0,void 0,!0];case"number":return d>0?void 0:d===0?hb||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.ga=o,typeof(o=n[++s])=="function"&&(i.la=!0,em??=o,tm??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let d;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof Ri?d=o:(d=gb,s--),d?.l){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let g=a[c];l?r(i,c,d,l,g):t(i,c,d,g)}}return n[e]=i}function rm(e){return Array.isArray(e)?e[0]instanceof Ri?e:[yb,e]:[e,void 0]}function nm(e,t){return e instanceof Y?e.u:Array.isArray(e)?an(e,t,!1):void 0}function Ih(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function Rh(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=jn(Th,Ih,Rh,n).V,s||=Ph(n),i)}function Ph(e){let t=e[kp];if(t!=null)return t;let r=jn(Th,Ih,Rh,e);return t=r.la?(n,i)=>em(n,i,r):(n,i)=>{let o=0|n[ee];for(;$f(i)&&i.h!=4;){var s=i.m,a=r[s];if(a==null){var c=r.ga;c&&(c=c[s])&&(c=bb(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).l,Rs(a),a.fa?a=void 0:(c=a.g.g-s,a.g.g=s,a=Wf(a.g,c)),s=n,a&&((c=s[gi])?c.push(a):s[gi]=[a]))}return 16384&o&&Ci(n),!0},e[kp]=t}function bb(e){let t=(e=rm(e))[0].g;if(e=e[1]){let r=Ph(e),n=jn(Th,Ih,Rh,e).V;return(i,o,s)=>t(i,o,s,n,r)}return t}function sa(e,t,r){e[t]=r.h}function aa(e,t,r,n){let i,o,s=r.h;e[t]=(a,c,l)=>s(a,c,l,o||=jn(oa,sa,aa,n).V,i||=im(n))}function im(e){let t=e[Ep];if(!t){let r=jn(oa,sa,aa,e);t=(n,i)=>om(n,i,r),e[Ep]=t}return t}function om(e,t,r){for(var n=0|e[ee],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=Cp(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=Cp(r,i))&&a(t,o,i)}if(e=th(e))for(_i(t,t.g.end()),r=0;r<e.length;r++)_i(t,Jl(e[r])||new Uint8Array(0))}function Cp(e,t){var r=e[t];if(r)return r;if((r=e.ga)&&(r=r[t])){var n=(r=rm(r))[0].h;if(r=r[1]){let i=im(r),o=jn(oa,sa,aa,r).V;r=e.la?tm(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Pi(e,t){if(Array.isArray(t)){var r=0|t[ee];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),Qe(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function vt(e,t,r){return new Ri(e,t,r)}function Di(e,t,r){return new Ri(e,t,r)}function _t(e,t,r){ze(e,0|e[ee],t,r)}var vb=ia((function(e,t,r,n,i){return e.h===2&&(e=Ro(e,an([void 0,void 0],n,!0),i),un(n=0|t[ee]),(i=Jr(t,n,r))instanceof Qt?(2&i.L)!=0?((i=i.X()).push(e),ze(t,n,r,i)):i.Na(e):Array.isArray(i)?(2&(0|i[ee])&&ze(t,n,r,i=Ff(i)),i.push(e)):ze(t,n,r,[e]),!0)}),(function(e,t,r,n,i){if(t instanceof Qt)t.forEach(((o,s)=>{Vs(e,r,an([s,o],n,!1),i)}));else if(Array.isArray(t))for(let o=0;o<t.length;o++){let s=t[o];Array.isArray(s)&&Vs(e,r,an(s,n,!1),i)}}));function sm(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(sh(64,n));if(Ys(n)){if(i==="string")return ch(n);if(i==="number")return ah(n)}})(t),t!=null&&(typeof t=="string"&&Sp(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,yi(t),ui(e,Ae,We);break;case"bigint":r=BigInt.asUintN(64,t),r=new Fl(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ui(e.g,r.h,r.g);break;default:r=Sp(t),ui(e.g,r.h,r.g)}}function am(e,t,r){(t=xi(t))!=null&&t!=null&&(zt(e,r,0),ra(e.g,t))}function cm(e,t,r){(t=If(t))!=null&&(zt(e,r,0),e.g.g.push(t?1:0))}function lm(e,t,r){(t=bi(t))!=null&&na(e,r,yf(t))}function hm(e,t,r,n,i){Vs(e,r,nm(t,n),i)}function dm(e,t,r){(t=t==null||typeof t=="string"||Ao(t)||t instanceof Gr?t:void 0)!=null&&na(e,r,bh(t).buffer)}function um(e,t,r){return(e.h===5||e.h===2)&&(t=Ti(t,0|t[ee],r,!1,!1),e.h==2?ta(e,Ul,t):t.push(Ul(e.g)),!0)}var Hr=vt((function(e,t,r){if(e.h!==1)return!1;var n=e.g;e=Ol(n);let i=Ol(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,_t(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=pn(t))!=null&&(zt(e,r,1),e=e.g,(r=Tf||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Ae=r.getUint32(0,!0),We=r.getUint32(4,!0),Co(e,Ae),Co(e,We))}),mr()),et=vt((function(e,t,r){return e.h===5&&(_t(t,r,Ul(e.g)),!0)}),(function(e,t,r){(t=pn(t))!=null&&(zt(e,r,5),e=e.g,rh(t),Co(e,Ae))}),Ah),_b=Di(um,(function(e,t,r){if((t=Pi(pn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,5),n=n.g,rh(o),Co(n,Ae))}}),Ah),Dh=Di(um,(function(e,t,r){if((t=Pi(pn,t))!=null&&t.length){zt(e,r,2),Ii(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,rh(t[n]),Co(r,Ae)}}),Ah),hn=vt((function(e,t,r){return e.h===0&&(_t(t,r,vh(e.g,ih)),!0)}),sm,Jf),Sl=vt((function(e,t,r){return e.h===0&&(_t(t,r,(e=vh(e.g,ih))===0?void 0:e),!0)}),sm,Jf),wb=vt((function(e,t,r){return e.h===0&&(_t(t,r,vh(e.g,nh)),!0)}),(function(e,t,r){if((t=rb(t))!=null&&(typeof t=="string"&&wp(t),t!=null))switch(zt(e,r,0),typeof t){case"number":e=e.g,yi(t),ui(e,Ae,We);break;case"bigint":r=BigInt.asUintN(64,t),r=new Ll(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ui(e.g,r.h,r.g);break;default:r=wp(t),ui(e.g,r.h,r.g)}}),mr()),$e=vt((function(e,t,r){return e.h===0&&(_t(t,r,ln(e.g)),!0)}),am,xh),ca=Di((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ti(t,0|t[ee],r,!1,!1),e.h==2?ta(e,ln,t):t.push(ln(e.g)),!0)}),(function(e,t,r){if((t=Pi(xi,t))!=null&&t.length){r=Sh(e,r);for(let n=0;n<t.length;n++)ra(e.g,t[n]);kh(e,r)}}),xh),li=vt((function(e,t,r){return e.h===0&&(_t(t,r,(e=ln(e.g))===0?void 0:e),!0)}),am,xh),Le=vt((function(e,t,r){return e.h===0&&(_t(t,r,_h(e.g)),!0)}),cm,Kf),pi=vt((function(e,t,r){return e.h===0&&(_t(t,r,(e=_h(e.g))===!1?void 0:e),!0)}),cm,Kf),mt=Di((function(e,t,r){return e.h===2&&(e=wh(e),Ti(t,0|t[ee],r,!1).push(e),!0)}),(function(e,t,r){if((t=Pi(bi,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&na(n,i,yf(o))}}),Ch),sn=vt((function(e,t,r){return e.h===2&&(_t(t,r,(e=wh(e))===""?void 0:e),!0)}),lm,Ch),we=vt((function(e,t,r){return e.h===2&&(_t(t,r,wh(e)),!0)}),lm,Ch),st=(function(e,t,r=Eh){return new Ri(e,t,r)})((function(e,t,r,n,i){return e.h===2&&(n=an(void 0,n,!0),Ti(t,0|t[ee],r,!0).push(n),Ro(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)hm(e,t[o],r,n,i)})),Ee=ia((function(e,t,r,n,i,o){return e.h===2&&(Mf(t,0|t[ee],o,r),Ro(e,t=gh(t,n,r),i),!0)}),hm),pm=vt((function(e,t,r){return e.h===2&&(_t(t,r,Gf(e)),!0)}),dm,Yf),Sb=Di((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ti(t,0|t[ee],r,!1,!1),e.h==2?ta(e,Xr,t):t.push(Xr(e.g)),!0)}),(function(e,t,r){if((t=Pi(Rf,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&(zt(n,i,0),Ii(n.g,o))}}),Xf),kb=vt((function(e,t,r){return e.h===0&&(_t(t,r,(e=Xr(e.g))===0?void 0:e),!0)}),(function(e,t,r){(t=Rf(t))!=null&&t!=null&&(zt(e,r,0),Ii(e.g,t))}),Xf),tr=vt((function(e,t,r){return e.h===0&&(_t(t,r,ln(e.g)),!0)}),(function(e,t,r){(t=xi(t))!=null&&(t=parseInt(t,10),zt(e,r,0),ra(e.g,t))}),Zf),Ml=class{constructor(t,r){this.h=t,this.g=r,this.l=ye,this.m=ne,this.defaultValue=void 0}};function gr(e,t){return new Ml(e,t)}function fn(e,t){return(r,n)=>{if(Cs.length){let o=Cs.pop();o.o(n),wl(o.g,r,n),r=o}else r=new class{constructor(o,s){if(_p.length){let a=_p.pop();wl(a,o,s),o=a}else o=new class{constructor(a,c){this.h=null,this.m=!1,this.g=this.l=this.j=0,wl(this,a,c)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ba=!1}}(o,s);this.g=o,this.l=this.g.g,this.h=this.m=-1,this.o(s)}o({fa:o=!1}={}){this.fa=o}}(r,n);try{let o=new e,s=o.u;Ph(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.h=-1,Cs.length<100&&Cs.push(r)}return i}}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}}}};om(this.u,t,jn(oa,sa,aa,e)),_i(t,t.g.end());let r=new Uint8Array(t.h),n=t.l,i=n.length,o=0;for(let s=0;s<i;s++){let a=n[s];r.set(a,o),o+=a.length}return t.l=[r],r}}var xp=class extends Y{constructor(e){super(e)}},Ap=[0,sn,vt((function(e,t,r){return e.h===2&&(_t(t,r,(e=Gf(e))===zn()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof Y){let n=t.Ra;return void(n&&(t=n(t),t!=null&&na(e,r,bh(t).buffer)))}if(Array.isArray(t))return}dm(e,t,r)}),Yf)],kl,Tp=globalThis.trustedTypes;function Ip(e){kl===void 0&&(kl=(function(){let r=null;if(!Tp)return r;try{let n=i=>i;r=Tp.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=kl;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function Eb(e,...t){if(t.length===0)return Ip(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return Ip(r)}var fm=[0,$e,tr,Le,-1,ca,tr,-1],Cb=class extends Y{constructor(e){super(e)}},mm=[0,Le,we,Le,tr,-1,Di((function(e,t,r){return(e.h===0||e.h===2)&&(t=Ti(t,0|t[ee],r,!1,!1),e.h==2?ta(e,ub,t):t.push(ln(e.g)),!0)}),(function(e,t,r){if((t=Pi(xi,t))!=null&&t.length){r=Sh(e,r);for(let n=0;n<t.length;n++)ra(e.g,t[n]);kh(e,r)}}),Zf),we,-1,[0,Le,-1],tr,Le,-1],gm=[0,we,-2],Rp=class extends Y{constructor(e){super(e)}},ym=[0],bm=[0,$e,Le,1,Le,-3],Nt=class extends Y{constructor(e){super(e,2)}},tt={};tt[336783863]=[0,we,Le,-1,$e,[0,[1,2,3,4,5,6,7,8],Ee,ym,Ee,mm,Ee,gm,Ee,bm,Ee,fm,Ee,[0,we,-2],Ee,[0,we,tr],Ee,[0,tr,we]],[0,we],Le,[0,[1,3],[2,4],Ee,[0,ca],-1,Ee,[0,mt],-1,st,[0,we,-1]],we];var Pp=[0,Sl,-1,pi,-3,Sl,ca,sn,li,Sl,-1,pi,li,pi,-2,sn];function jt(e,t){Bl(e,2,Ai(t),"")}function Pe(e,t){ea(e,3,t)}function me(e,t){ea(e,4,t)}var bt=class extends Y{constructor(e){super(e,500)}o(e){return ne(this,0,7,e)}},_o=[-1,{}],Dp=[0,we,1,_o],Bp=[0,we,mt,_o];function Vt(e,t){zs(e,1,bt,t)}function Oe(e,t){ea(e,10,t)}function be(e,t){ea(e,15,t)}var Rt=class extends Y{constructor(e){super(e,500)}o(e){return ne(this,0,1001,e)}},vm=[-500,st,[-500,sn,-1,mt,-3,[-2,tt,Le],st,Ap,li,-1,Dp,Bp,st,[0,sn,pi],sn,Pp,li,mt,987,mt],4,st,[-500,we,-1,[-1,{}],998,we],st,[-500,we,mt,-1,[-2,{},Le],997,mt,-1],li,st,[-500,we,mt,_o,998,mt],mt,li,Dp,Bp,st,[0,sn,-1,_o],mt,-2,Pp,sn,-1,pi,[0,pi,kb],978,_o,st,Ap];Rt.prototype.g=la(vm);var xb=fn(Rt,vm),Ab=class extends Y{constructor(e){super(e)}},_m=class extends Y{constructor(e){super(e)}g(){return Kr(this,Ab,1)}},wm=[0,st,[0,$e,et,we,-1]],ha=fn(_m,wm),Tb=class extends Y{constructor(e){super(e)}},Ib=class extends Y{constructor(e){super(e)}},El=class extends Y{constructor(e){super(e)}h(){return ye(this,Tb,2)}g(){return Kr(this,Ib,5)}},Sm=fn(class extends Y{constructor(e){super(e)}},[0,mt,ca,Dh,[0,tr,[0,$e,-3],[0,et,-3],[0,$e,-1,[0,st,[0,$e,-2]]],st,[0,et,-1,we,et]],we,-1,hn,st,[0,$e,et],mt,hn]),km=class extends Y{constructor(e){super(e)}},fi=fn(class extends Y{constructor(e){super(e)}},[0,st,[0,et,-4]]),Em=class extends Y{constructor(e){super(e)}},Po=fn(class extends Y{constructor(e){super(e)}},[0,st,[0,et,-4]]),Rb=class extends Y{constructor(e){super(e)}},Pb=[0,$e,-1,Dh,tr],Cm=class extends Y{constructor(e){super(e)}};Cm.prototype.g=la([0,et,-4,hn]);var Db=class extends Y{constructor(e){super(e)}},Bb=fn(class extends Y{constructor(e){super(e)}},[0,st,[0,1,$e,we,wm],hn]),Op=class extends Y{constructor(e){super(e)}},Ob=class extends Y{constructor(e){super(e)}oa(){let e=Lf(this);return e??zn()}},Ub=class extends Y{constructor(e){super(e)}},xm=[1,2],Lb=fn(class extends Y{constructor(e){super(e)}},[0,st,[0,xm,Ee,[0,Dh],Ee,[0,pm],$e,we],hn]),Bh=class extends Y{constructor(e){super(e)}},Am=[0,we,$e,et,mt,-1],Up=class extends Y{constructor(e){super(e)}},Fb=[0,Le,-1],Lp=class extends Y{constructor(e){super(e)}},Ps=[1,2,3,4,5],Hs=class extends Y{constructor(e){super(e)}g(){return Lf(this)!=null}h(){return er(this,2)!=null}},Fe=class extends Y{constructor(e){super(e)}g(){return If(vi(this,2))??!1}},Tm=[0,pm,we,[0,$e,hn,-1],[0,wb,hn]],Ye=[0,Tm,Le,[0,Ps,Ee,bm,Ee,mm,Ee,fm,Ee,ym,Ee,gm],tr],da=class extends Y{constructor(e){super(e)}},Oh=[0,Ye,et,-1,$e],Mb=gr(502141897,da);tt[502141897]=Oh;var Nb=fn(class extends Y{constructor(e){super(e)}},[0,[0,tr,-1,_b,Sb],Pb]),Im=class extends Y{constructor(e){super(e)}},Rm=class extends Y{constructor(e){super(e)}},Uh=[0,Ye,et,[0,Ye],Le],Pm=[0,Ye,Oh,Uh,et,[0,[0,Tm]]],zb=gr(508968150,Rm);tt[508968150]=Pm,tt[508968149]=Uh;var Dm=class extends Y{constructor(e){super(e)}},jb=gr(513916220,Dm);tt[513916220]=[0,Ye,Pm,$e];var ai=class extends Y{constructor(e){super(e)}h(){return ye(this,Bh,2)}g(){Re(this,2)}},Bm=[0,Ye,Am];tt[478825465]=Bm;var Vb=class extends Y{constructor(e){super(e)}},Om=class extends Y{constructor(e){super(e)}},Lh=class extends Y{constructor(e){super(e)}},Fh=class extends Y{constructor(e){super(e)}},Um=class extends Y{constructor(e){super(e)}},Fp=[0,Ye,[0,Ye],Bm,-1],Lm=[0,Ye,et,$e],Mh=[0,Ye,et],Fm=[0,Ye,Lm,Mh,et],Hb=gr(479097054,Um);tt[479097054]=[0,Ye,Fm,Fp],tt[463370452]=Fp,tt[464864288]=Lm;var Wb=gr(462713202,Fh);tt[462713202]=Fm,tt[474472470]=Mh;var $b=class extends Y{constructor(e){super(e)}},Mm=class extends Y{constructor(e){super(e)}},Nm=class extends Y{constructor(e){super(e)}},zm=class extends Y{constructor(e){super(e)}},Nh=[0,Ye,et,-1,$e],Nl=[0,Ye,et,Le];zm.prototype.g=la([0,Ye,Mh,[0,Ye],Oh,Uh,Nh,Nl]);var jm=class extends Y{constructor(e){super(e)}},Gb=gr(456383383,jm);tt[456383383]=[0,Ye,Am];var Vm=class extends Y{constructor(e){super(e)}},qb=gr(476348187,Vm);tt[476348187]=[0,Ye,Fb];var Hm=class extends Y{constructor(e){super(e)}},Mp=class extends Y{constructor(e){super(e)}},Wm=[0,tr,-1],Kb=gr(458105876,class extends Y{constructor(e){super(e)}g(){var e=this.u;let t=0|e[ee],r=2&t;return e=(function(n,i,o){var s=Mp;let a=2&i,c=!1;if(o==null){if(a)return vp();o=[]}else if(o.constructor===Qt){if((2&o.L)==0||a)return o;o=o.X()}else Array.isArray(o)?c=!!(2&(0|o[ee])):o=[];if(a){if(!o.length)return vp();c||(c=!0,Ci(o))}else c&&(c=!1,o=Ff(o));return c||(64&(0|o[ee])?o[ee]&=-33:32&i&&Gs(o,32)),ze(n,i,2,s=new Qt(o,s,nb,void 0)),s})(e,t,Jr(e,t,2)),!r&&Mp&&(e.ra=!0),e}});tt[458105876]=[0,Wm,vb,[!0,hn,[0,we,-1,mt]]];var zh=class extends Y{constructor(e){super(e)}},$m=gr(458105758,zh);tt[458105758]=[0,Ye,we,Wm];var Gm=class extends Y{constructor(e){super(e)}},Xb=gr(443442058,Gm);tt[443442058]=[0,Ye,we,$e,et,mt,-1,Le,et],tt[514774813]=Nh;var qm=class extends Y{constructor(e){super(e)}},Jb=gr(516587230,qm);function zl(e,t){return t=t?t.clone():new Bh,e.displayNamesLocale!==void 0?Re(t,1,Ai(e.displayNamesLocale)):e.displayNamesLocale===void 0&&Re(t,1),e.maxResults!==void 0?Br(t,2,e.maxResults):"maxResults"in e&&Re(t,2),e.scoreThreshold!==void 0?Z(t,3,e.scoreThreshold):"scoreThreshold"in e&&Re(t,3),e.categoryAllowlist!==void 0?js(t,4,e.categoryAllowlist):"categoryAllowlist"in e&&Re(t,4),e.categoryDenylist!==void 0?js(t,5,e.categoryDenylist):"categoryDenylist"in e&&Re(t,5),t}function jh(e,t=-1,r=""){return{categories:e.map((n=>({index:Zt(n,1)??0??-1,score:Je(n,2)??0,categoryName:er(n,3)??""??"",displayName:er(n,4)??""??""}))),headIndex:t,headName:r}}function Km(e){var t=Fn(e,3,pn,Ln()),r=Fn(e,2,xi,Ln()),n=Fn(e,1,bi,Ln()),i=Fn(e,9,bi,Ln());let o={categories:[],keypoints:[]};for(let s=0;s<t.length;s++)o.categories.push({score:t[s],index:r[s]??-1,categoryName:n[s]??"",displayName:i[s]??""});if((t=ye(e,El,4)?.h())&&(o.boundingBox={originX:Zt(t,1)??0,originY:Zt(t,2)??0,width:Zt(t,3)??0,height:Zt(t,4)??0,angle:0}),ye(e,El,4)?.g().length)for(let s of ye(e,El,4).g())o.keypoints.push({x:Is(s,1)??0,y:Is(s,2)??0,score:Is(s,4)??0,label:er(s,3)??""});return o}function ua(e){let t=[];for(let r of Kr(e,Em,1))t.push({x:Je(r,1)??0,y:Je(r,2)??0,z:Je(r,3)??0,visibility:Je(r,4)??0});return t}function wo(e){let t=[];for(let r of Kr(e,km,1))t.push({x:Je(r,1)??0,y:Je(r,2)??0,z:Je(r,3)??0,visibility:Je(r,4)??0});return t}function Np(e){return Array.from(e,(t=>t>127?t-256:t))}function zp(e,t){if(e.length!==t.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${e.length} vs. ${t.length}).`);let r=0,n=0,i=0;for(let o=0;o<e.length;o++)r+=e[o]*t[o],n+=e[o]*e[o],i+=t[o]*t[o];if(n<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return r/Math.sqrt(n*i)}var xs;tt[516587230]=[0,Ye,Nh,Nl,et],tt[518928384]=Nl;var Yb=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 Xm(){if(xs===void 0)try{await WebAssembly.instantiate(Yb),xs=!0}catch{xs=!1}return xs}async function fo(e,t=Eb``){let r=await Xm()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var nn=class{};function Jm(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function jp(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function Ym(e){return e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height]}function Q(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 Vp(e,t,r){if(!e.i.canvas)throw Error("No OpenGL canvas configured.");if(r?e.i._bindTextureToStream(r):e.i._bindTextureToCanvas(),!(r=e.i.canvas.getContext("webgl2")||e.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),e.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);let[n,i]=Ym(t);return!e.l||n===e.i.canvas.width&&i===e.i.canvas.height||(e.i.canvas.width=n,e.i.canvas.height=i),[n,i]}function Hp(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.i.stringToNewUTF8(t[i]);t=e.i._malloc(4*n.length),e.i.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.i._free(i);e.i._free(t)}function Ir(e,t,r){e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=r}function rn(e,t,r){let n=[];e.i.simpleListeners=e.i.simpleListeners||{},e.i.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}nn.forVisionTasks=function(e){return fo("vision",e)},nn.forTextTasks=function(e){return fo("text",e)},nn.forGenAiExperimentalTasks=function(e){return fo("genai_experimental",e)},nn.forGenAiTasks=function(e){return fo("genai",e)},nn.forAudioTasks=function(e){return fo("audio",e)},nn.isSimdSupported=function(){return Xm()};async function Zb(e,t,r,n){return e=await(async(i,o,s,a,c)=>{if(o&&await jp(o),!self.ModuleFactory||s&&(await jp(s),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&c&&((o=self.Module).locateFile=c.locateFile,c.mainScriptUrlOrBlob&&(o.mainScriptUrlOrBlob=c.mainScriptUrlOrBlob)),c=await self.ModuleFactory(self.Module||c),self.ModuleFactory=self.Module=void 0,new i(c,a)})(e,r.wasmLoaderPath,r.assetLoaderPath,t,{locateFile:i=>i.endsWith(".wasm")?r.wasmBinaryPath.toString():r.assetBinaryPath&&i.endsWith(".data")?r.assetBinaryPath.toString():i}),await e.o(n),e}function Cl(e,t){let r=ye(e.baseOptions,Hs,1)||new Hs;typeof t=="string"?(Re(r,2,Ai(t)),Re(r,1)):t instanceof Uint8Array&&(Re(r,1,eh(t,!1)),Re(r,2)),ne(e.baseOptions,0,1,r)}function Wp(e){try{let t=e.G.length;if(t===1)throw Error(e.G[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.G.map((r=>r.message)).join(", "))}finally{e.G=[]}}function X(e,t){e.B=Math.max(e.B,t)}function pa(e,t){e.A=new bt,jt(e.A,"PassThroughCalculator"),Pe(e.A,"free_memory"),me(e.A,"free_memory_unused_out"),Oe(t,"free_memory"),Vt(t,e.A)}function wi(e,t){Pe(e.A,t),me(e.A,t+"_unused_out")}function fa(e){e.g.addBoolToStream(!0,"free_memory",e.B)}var Ds=class{constructor(e){this.g=e,this.G=[],this.B=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(!(ye(this.baseOptions,Hs,1)?.g()||ye(this.baseOptions,Hs,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=ye(n.baseOptions,Lp,3);if(!o){var s=o=new Lp,a=new Rp;vo(s,4,Ps,a)}"delegate"in i&&(i.delegate==="GPU"?(i=o,s=new Cb,vo(i,2,Ps,s)):(i=o,s=new Rp,vo(i,4,Ps,s))),ne(n.baseOptions,0,3,o)})(this,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Cl(this,"/model.dat"),this.m(),this.I()}));if(r.modelAssetBuffer instanceof Uint8Array)Cl(this,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{Cl(this,n),this.m(),this.I()}))}return this.m(),this.I(),Promise.resolve()}I(){}da(){let e;if(this.g.da((t=>{e=xb(t)})),!e)throw Error("Failed to retrieve CalculatorGraphConfig");return e}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.G.push(Error(n))})),this.g.La(),this.g.setGraph(e,t),this.A=void 0,Wp(this)}finishProcessing(){this.g.finishProcessing(),Wp(this)}close(){this.A=void 0,this.g.closeGraph()}};function yt(e,t){if(!e)throw Error(`Unable to obtain required WebGL resource: ${t}`);return e}Ds.prototype.close=Ds.prototype.close,(function(e,t){e=e.split(".");var r,n=Nn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",Ds);var jl=class{constructor(t,r,n,i){this.g=t,this.h=r,this.m=n,this.l=i}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}};function $p(e,t,r){let n=e.g;if(r=yt(n.createShader(r),"Failed to create WebGL shader"),n.shaderSource(r,t),n.compileShader(r),!n.getShaderParameter(r,n.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${n.getShaderInfoLog(r)}`);return n.attachShader(e.h,r),r}function Gp(e,t){let r=e.g,n=yt(r.createVertexArray(),"Failed to create vertex array");r.bindVertexArray(n);let i=yt(r.createBuffer(),"Failed to create buffer");r.bindBuffer(r.ARRAY_BUFFER,i),r.enableVertexAttribArray(e.O),r.vertexAttribPointer(e.O,2,r.FLOAT,!1,0,0),r.bufferData(r.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),r.STATIC_DRAW);let o=yt(r.createBuffer(),"Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,o),r.enableVertexAttribArray(e.I),r.vertexAttribPointer(e.I,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 jl(r,n,i,o)}function Vh(e,t){if(e.g){if(t!==e.g)throw Error("Cannot change GL context once initialized")}else e.g=t}function Do(e,t,r,n){return Vh(e,t),e.h||(e.m(),e.C()),r?(e.s||(e.s=Gp(e,!0)),r=e.s):(e.v||(e.v=Gp(e,!1)),r=e.v),t.useProgram(e.h),r.bind(),e.l(),e=n(),r.g.bindVertexArray(null),e}function dn(e,t,r){return Vh(e,t),e=yt(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 ma(e,t,r){Vh(e,t),e.A||(e.A=yt(t.createFramebuffer(),"Failed to create framebuffe.")),t.bindFramebuffer(t.FRAMEBUFFER,e.A),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0)}function Hh(e){e.g?.bindFramebuffer(e.g.FRAMEBUFFER,null)}var Bi=class{G(){return`
10
10
  precision mediump float;
11
11
  varying vec2 vTex;
12
12
  uniform sampler2D inputTexture;
13
13
  void main() {
14
14
  gl_FragColor = texture2D(inputTexture, vTex);
15
15
  }
16
- `}m(){let e=this.g;if(this.h=Ct(e.createProgram(),"Failed to create WebGL program"),this.aa=Fm(this,`
16
+ `}m(){let e=this.g;if(this.h=yt(e.createProgram(),"Failed to create WebGL program"),this.aa=$p(this,`
17
17
  attribute vec2 aVertex;
18
18
  attribute vec2 aTex;
19
19
  varying vec2 vTex;
20
20
  void main(void) {
21
21
  gl_Position = vec4(aVertex, 0.0, 1.0);
22
22
  vTex = aTex;
23
- }`,e.VERTEX_SHADER),this.Z=Fm(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.I=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.aa),e.deleteShader(this.Z)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}},hv=class extends Mi{G(){return`
23
+ }`,e.VERTEX_SHADER),this.Z=$p(this,this.G(),e.FRAGMENT_SHADER),e.linkProgram(this.h),!e.getProgramParameter(this.h,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(this.h)}`);this.O=e.getAttribLocation(this.h,"aVertex"),this.I=e.getAttribLocation(this.h,"aTex")}C(){}l(){}close(){if(this.h){let e=this.g;e.deleteProgram(this.h),e.deleteShader(this.aa),e.deleteShader(this.Z)}this.A&&this.g.deleteFramebuffer(this.A),this.v&&this.v.close(),this.s&&this.s.close()}},Qb=class extends Bi{G(){return`
24
24
  precision mediump float;
25
25
  uniform sampler2D backgroundTexture;
26
26
  uniform sampler2D maskTexture;
@@ -32,7 +32,7 @@ Minimum version required to store current data is: `+o+`.
32
32
  vec4 categoryColor = texture2D(colorMappingTexture, vec2(category, 0.0));
33
33
  gl_FragColor = mix(backgroundColor, categoryColor, categoryColor.a);
34
34
  }
35
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=vn(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=vn(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.K=Ct(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.T=Ct(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.J=Ct(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.K,1),e.uniform1i(this.T,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},uv=class extends Mi{G(){return`
35
+ `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.B=dn(this,e,e.LINEAR),e.activeTexture(e.TEXTURE2),this.j=dn(this,e,e.NEAREST)}m(){super.m();let e=this.g;this.K=yt(e.getUniformLocation(this.h,"backgroundTexture"),"Uniform location"),this.T=yt(e.getUniformLocation(this.h,"colorMappingTexture"),"Uniform location"),this.J=yt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.J,0),e.uniform1i(this.K,1),e.uniform1i(this.T,2)}close(){this.B&&this.g.deleteTexture(this.B),this.j&&this.g.deleteTexture(this.j),super.close()}},ev=class extends Bi{G(){return`
36
36
  precision mediump float;
37
37
  uniform sampler2D maskTexture;
38
38
  uniform sampler2D defaultTexture;
@@ -46,7 +46,7 @@ Minimum version required to store current data is: `+o+`.
46
46
  overlayColor = mix(defaultColor, overlayColor, overlayColor.a);
47
47
  gl_FragColor = mix(defaultColor, overlayColor, confidence);
48
48
  }
49
- `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=vn(this,e),e.activeTexture(e.TEXTURE2),this.B=vn(this,e)}m(){super.m();let e=this.g;this.J=Ct(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=Ct(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=Ct(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function en(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!="undefined"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function wd(e){var t=en(e,1);if(!t){if(t=en(e,0))t=new Float32Array(t).map(n=>n/255);else{t=new Float32Array(e.width*e.height);let n=Ni(e);var r=vd(e);if(wa(r,n,Nm(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let i=0,o=0;i<t.length;++i,o+=4)t[i]=r[o]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Nm(e){let t=en(e,2);if(!t){let r=Ni(e);t=zm(e);let n=wd(e),i=jm(e);r.texImage2D(r.TEXTURE_2D,0,i,e.width,e.height,0,r.RED,r.FLOAT,n),_d(e)}return t}function Ni(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=Ct(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function jm(e){if(e=Ni(e),!_a)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))_a=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");_a=e.R16F}return _a}function vd(e){return e.l||(e.l=new Mi),e.l}function zm(e){let t=Ni(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=en(e,2);return r||(r=vn(vd(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function _d(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var _a,ct=class{constructor(e,t,r,n,i,o,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=i,this.width=o,this.height=s,this.j&&--Vm==0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!en(this,0)}ja(){return!!en(this,1)}P(){return!!en(this,2)}ia(){return(t=en(e=this,0))||(t=wd(e),t=new Uint8Array(t.map(r=>255*r)),e.g.push(t)),t;var e,t}ha(){return wd(this)}M(){return Nm(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=Ni(this),i=vd(this);n.activeTexture(n.TEXTURE1),r=vn(i,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let o=jm(this);n.texImage2D(n.TEXTURE_2D,0,o,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),wa(i,n,r),Po(i,n,!1,()=>{zm(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),_d(this)}),bd(i),_d(this)}}e.push(r)}return new ct(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Ni(this).deleteTexture(en(this,2)),Vm=-1}};ct.prototype.close=ct.prototype.close,ct.prototype.clone=ct.prototype.clone,ct.prototype.getAsWebGLTexture=ct.prototype.M,ct.prototype.getAsFloat32Array=ct.prototype.ha,ct.prototype.getAsUint8Array=ct.prototype.ia,ct.prototype.hasWebGLTexture=ct.prototype.P,ct.prototype.hasFloat32Array=ct.prototype.ja,ct.prototype.hasUint8Array=ct.prototype.Fa;var Vm=250,pv={color:"white",lineWidth:4,radius:6};function kd(e){return{...pv,fillColor:(e=e||{}).color,...e}}function tn(e,t){return e instanceof Function?e(t):e}function Hm(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function Do(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function Bo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Wm(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Mi;let i=Bo(e);r((e=new ct([n],t.m,!1,i.canvas,e.m,t.width,t.height)).M()),e.close()}}function $m(e,t,r,n){let i=function(a){return a.g||(a.g=new hv),a.g}(e),o=Bo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Po(i,o,!0,()=>{(function(c,l,d,h){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.H&&function(f,g){if(f!==g)return!1;f=f.entries(),g=g.entries();for(let[b,v]of f){f=b;let k=v;var u=g.next();if(u.done)return!1;let[S,I]=u.value;if(u=I,f!==S||k[0]!==u[0]||k[1]!==u[1]||k[2]!==u[2]||k[3]!==u[3])return!1}return!!g.next().done}(c.H,h))m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j);else{c.H=h;let f=Array(1024).fill(0);h.forEach((g,u)=>{if(g.length!==4)throw Error(`Color at index ${u} is not a four-channel value.`);f[4*u]=g[0],f[4*u+1]=g[1],f[4*u+2]=g[2],f[4*u+3]=g[3]}),m.activeTexture(m.TEXTURE2),m.bindTexture(m.TEXTURE_2D,c.j),m.texImage2D(m.TEXTURE_2D,0,m.RGBA,256,1,0,m.RGBA,m.UNSIGNED_BYTE,new Uint8Array(f))}})(i,t,s,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4);let a=i.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)})}function Gm(e,t,r,n){let i=Bo(e),o=function(c){return c.h||(c.h=new uv),c.h}(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Po(o,i,!0,()=>{var c=o.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,o.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,o.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(c=o.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)})}var Pt=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=Do(this);t=kd(t),r.save();var n=r.canvas,i=0;for(let o of e)r.fillStyle=tn(t.fillColor,{index:i,from:o}),r.strokeStyle=tn(t.color,{index:i,from:o}),r.lineWidth=tn(t.lineWidth,{index:i,from:o}),(e=new Path2D).arc(o.x*n.width,o.y*n.height,tn(t.radius,{index:i,from:o}),0,2*Math.PI),r.fill(e),r.stroke(e),++i;r.restore()}}xa(e,t,r){if(e&&t){var n=Do(this);r=kd(r),n.save();var i=n.canvas,o=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=tn(r.color,{index:o,from:t,to:a}),n.lineWidth=tn(r.lineWidth,{index:o,from:t,to:a}),n.moveTo(t.x*i.width,t.y*i.height),n.lineTo(a.x*i.width,a.y*i.height)),++o,n.stroke()}n.restore()}}ua(e,t){let r=Do(this);t=kd(t),r.save(),r.beginPath(),r.lineWidth=tn(t.lineWidth,{}),r.strokeStyle=tn(t.color,{}),r.fillStyle=tn(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?function(n,i,o,s){let a=Bo(n);Wm(n,i,c=>{$m(n,c,o,s),(c=Do(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,r,t):$m(this,e.M(),r,t)}wa(e,t,r){this.l?function(n,i,o,s){let a=Bo(n);Wm(n,i,c=>{Gm(n,c,o,s),(c=Do(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)})}(this,e,t,r):Gm(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Or(e,t){switch(t){case 0:return e.g.find(r=>r instanceof ImageData);case 1:return e.g.find(r=>typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap);case 2:return e.g.find(r=>typeof WebGLTexture!="undefined"&&r instanceof WebGLTexture);default:throw Error(`Type is not supported: ${t}`)}}function qm(e){var t=Or(e,0);if(!t){t=ji(e);let r=Sa(e),n=new Uint8Array(e.width*e.height*4);wa(r,t,ka(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),bd(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function ka(e){let t=Or(e,2);if(!t){let r=ji(e);t=Ea(e);let n=Or(e,1)||qm(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),Oo(e)}return t}function ji(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=Ct(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Sa(e){return e.l||(e.l=new Mi),e.l}function Ea(e){let t=ji(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Or(e,2);return r||(r=vn(Sa(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Oo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Km(e){let t=ji(e);return Po(Sa(e),t,!0,()=>function(r,n){let i=r.canvas;if(i.width===r.width&&i.height===r.height)return n();let o=i.width,s=i.height;return i.width=r.width,i.height=r.height,r=n(),i.width=o,i.height=s,r}(e,()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))}Pt.prototype.close=Pt.prototype.close,Pt.prototype.drawConfidenceMask=Pt.prototype.wa,Pt.prototype.drawCategoryMask=Pt.prototype.va,Pt.prototype.drawBoundingBox=Pt.prototype.ua,Pt.prototype.drawConnectors=Pt.prototype.xa,Pt.prototype.drawLandmarks=Pt.prototype.ya,Pt.lerp=function(e,t,r,n,i){return Hm(n*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t)),n,i)},Pt.clamp=Hm;var ut=class{constructor(e,t,r,n,i,o,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=i,this.width=o,this.height=s,(this.j||this.m)&&--Xm==0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Or(this,0)}ka(){return!!Or(this,1)}P(){return!!Or(this,2)}Ca(){return qm(this)}Ba(){var e=Or(this,1);return e||(ka(this),Ea(this),e=Km(this),Oo(this),this.g.push(e),this.j=!0),e}M(){return ka(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=ji(this),i=Sa(this);n.activeTexture(n.TEXTURE1),r=vn(i,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),wa(i,n,r),Po(i,n,!1,()=>{Ea(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Oo(this)}),bd(i),Oo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);ka(this),Ea(this),r=Km(this),Oo(this)}e.push(r)}return new ut(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Or(this,1).close(),this.m&&ji(this).deleteTexture(Or(this,2)),Xm=-1}};ut.prototype.close=ut.prototype.close,ut.prototype.clone=ut.prototype.clone,ut.prototype.getAsWebGLTexture=ut.prototype.M,ut.prototype.getAsImageBitmap=ut.prototype.Ba,ut.prototype.getAsImageData=ut.prototype.Ca,ut.prototype.hasWebGLTexture=ut.prototype.P,ut.prototype.hasImageBitmap=ut.prototype.ka,ut.prototype.hasImageData=ut.prototype.Ea;var Xm=250;function vr(...e){return e.map(([t,r])=>({start:t,end:r}))}var fv=function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}}((Jm=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:Rm()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ee(this,n||"input_audio",o=>{ee(this,i=i||"audio_header",s=>{this.i._configureAudio(o,s,e,t??0,r)})})}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Br(this,"__graph_config__",t=>{e(t)}),ee(this,"__graph_config__",t=>{this.i._getGraphConfig(t,void 0)}),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(e,this.g/4),ee(this,n,s=>{this.i._addAudioToInputStream(this.g,t,r,s,i)})}addGpuBufferToStream(e,t,r){ee(this,t,n=>{let[i,o]=Bm(this,e,n);this.i._addBoundTextureToStream(n,i,o,r)})}addBoolToStream(e,t,r){ee(this,t,n=>{this.i._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){ee(this,t,n=>{this.i._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){ee(this,t,n=>{this.i._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){ee(this,t,n=>{this.i._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){ee(this,t,n=>{this.i._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){ee(this,t,n=>{ee(this,e,i=>{this.i._addStringToInputStream(i,n,r)})})}addStringRecordToStream(e,t,r){ee(this,t,n=>{Om(this,Object.keys(e),i=>{Om(this,Object.values(e),o=>{this.i._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){ee(this,r,i=>{ee(this,t,o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,o,i,n),this.i._free(s)})})}addEmptyPacketToStream(e,t){ee(this,e,r=>{this.i._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputStream(i,n,r)})}addDoubleVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputStream(i,n,r)})}addFloatVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputStream(i,n,r)})}addIntVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputStream(i,n,r)})}addUintVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(i,o);this.i._addUintVectorToInputStream(i,n,r)})}addStringVectorToStream(e,t,r){ee(this,t,n=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ee(this,o,s=>{this.i._addStringVectorEntry(i,s)});this.i._addStringVectorToInputStream(i,n,r)})}addBoolToInputSidePacket(e,t){ee(this,t,r=>{this.i._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){ee(this,t,r=>{this.i._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){ee(this,t,r=>{this.i._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){ee(this,t,r=>{this.i._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){ee(this,t,r=>{this.i._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){ee(this,t,r=>{ee(this,e,n=>{this.i._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){ee(this,r,n=>{ee(this,t,i=>{let o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputSidePacket(o,e.length,i,n),this.i._free(o)})})}addBoolVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){ee(this,t,r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ee(this,i,o=>{this.i._addStringVectorEntry(n,o)});this.i._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachBoolListener(r)})}attachBoolVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachBoolVectorListener(r)})}attachIntListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachIntListener(r)})}attachIntVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachIntVectorListener(r)})}attachUintListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachUintListener(r)})}attachUintVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachUintVectorListener(r)})}attachDoubleListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachFloatListener(r)})}attachFloatVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachFloatVectorListener(r)})}attachStringListener(e,t){Br(this,e,t),ee(this,e,r=>{this.i._attachStringListener(r)})}attachStringVectorListener(e,t){bn(this,e,t),ee(this,e,r=>{this.i._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Br(this,e,t),ee(this,e,n=>{this.i._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){bn(this,e,t),ee(this,e,n=>{this.i._attachProtoVectorListener(n,r||!1)})}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Br(this,e,(n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)}),ee(this,e,n=>{this.i._attachAudioListener(n,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends Jm{get ea(){return this.i}qa(e,t,r){ee(this,t,n=>{let[i,o]=Bm(this,e,n);this.ea._addBoundTextureAsImageToStream(n,i,o,r)})}U(e,t){Br(this,e,t),ee(this,e,r=>{this.ea._attachImageListener(r)})}ca(e,t){bn(this,e,t),ee(this,e,r=>{this.ea._attachImageVectorListener(r)})}})),Jm,ir=class extends fv{};async function fe(e,t,r){return async function(n,i,o,s){return dv(n,i,o,s)}(e,r.canvas??(Rm()?void 0:document.createElement("canvas")),t,r)}function Ym(e,t,r,n){if(e.T){let o=new Qf;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var i=r.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Z(o,1,(i.left+i.right)/2),Z(o,2,(i.top+i.bottom)/2),Z(o,4,i.right-i.left),Z(o,3,i.bottom-i.top)}else Z(o,1,.5),Z(o,2,.5),Z(o,4,1),Z(o,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(Z(o,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=Dm(t);r=Ye(o,3)*a/s,i=Ye(o,4)*s/a,Z(o,4,r),Z(o,3,i)}}e.g.addProtoToStream(o.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function or(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");Ym(e,t,r,e.B+1)}function Ur(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");Ym(e,t,r,n)}function zi(e,t,r,n){var i=t.data;let o=t.width,s=o*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==s)throw Error("Unsupported channel count: "+i.length/s);return e=new ct([i],r,!1,e.g.i.canvas,e.O,o,t),n?e.clone():e}var Dt=class extends va{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Mi}l(e,t=!0){if("runningMode"in e&&Eo(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};Dt.prototype.close=Dt.prototype.close;var Bt=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},ne(e=this.h=new fa,0,1,t=new Fe),Z(this.h,2,.5),Z(this.h,3,.3)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Z(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Z(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},or(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Ur(this,e,r,t),this.j}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect_in"),be(e,"detections");let t=new Vt;gr(t,Yb,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect_in"),me(r,"DETECTIONS:detections"),r.o(t),Wt(e,r),this.g.attachProtoVectorListener("detections",(n,i)=>{for(let o of n)n=Jf(o),this.j.detections.push(xm(n));X(this,i)}),this.g.attachEmptyPacketListener("detections",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Bt.prototype.detectForVideo=Bt.prototype.F,Bt.prototype.detect=Bt.prototype.D,Bt.prototype.setOptions=Bt.prototype.o,Bt.createFromModelPath=async function(e,t){return fe(Bt,e,{baseOptions:{modelAssetPath:t}})},Bt.createFromModelBuffer=function(e,t){return fe(Bt,e,{baseOptions:{modelAssetBuffer:t}})},Bt.createFromOptions=function(e,t){return fe(Bt,e,t)};var Sd=vr([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]),Ed=vr([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]),Cd=vr([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),Zm=vr([474,475],[475,476],[476,477],[477,474]),xd=vr([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]),Ad=vr([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),Qm=vr([469,470],[470,471],[471,472],[472,469]),Td=vr([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]),eg=[...Sd,...Ed,...Cd,...xd,...Ad,...Td],tg=vr([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 rg(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var Ge=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,ne(e=this.h=new sm,0,1,t=new Fe),this.v=new om,ne(this.h,0,3,this.v),this.s=new fa,ne(this.h,0,2,this.s),Dr(this.s,4,1),Z(this.s,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numFaces"in e&&Dr(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Z(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return rg(this),or(this,e,t),this.j}F(e,t,r){return rg(this),Ur(this,e,r,t),this.j}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"face_landmarks");let t=new Vt;gr(t,Qb,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Wt(e,r),this.g.attachProtoVectorListener("face_landmarks",(n,i)=>{for(let o of n)n=To(o),this.j.faceLandmarks.push(ma(n));X(this,i)}),this.g.attachEmptyPacketListener("face_landmarks",n=>{X(this,n)}),this.outputFaceBlendshapes&&(be(e,"blendshapes"),me(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",(n,i)=>{if(this.outputFaceBlendshapes)for(let o of n)n=ha(o),this.j.faceBlendshapes.push(md(n.g()??[]));X(this,i)}),this.g.attachEmptyPacketListener("blendshapes",n=>{X(this,n)})),this.outputFacialTransformationMatrixes&&(be(e,"face_geometry"),me(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",(n,i)=>{if(this.outputFacialTransformationMatrixes)for(let o of n)(n=ye(Zb(o),Hb,2))&&this.j.facialTransformationMatrixes.push({rows:tr(n,1)??0??0,columns:tr(n,2)??0??0,data:$n(n,3,dn,Wn()).slice()??[]});X(this,i)}),this.g.attachEmptyPacketListener("face_geometry",n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ge.prototype.detectForVideo=Ge.prototype.F,Ge.prototype.detect=Ge.prototype.D,Ge.prototype.setOptions=Ge.prototype.o,Ge.createFromModelPath=function(e,t){return fe(Ge,e,{baseOptions:{modelAssetPath:t}})},Ge.createFromModelBuffer=function(e,t){return fe(Ge,e,{baseOptions:{modelAssetBuffer:t}})},Ge.createFromOptions=function(e,t){return fe(Ge,e,t)},Ge.FACE_LANDMARKS_LIPS=Sd,Ge.FACE_LANDMARKS_LEFT_EYE=Ed,Ge.FACE_LANDMARKS_LEFT_EYEBROW=Cd,Ge.FACE_LANDMARKS_LEFT_IRIS=Zm,Ge.FACE_LANDMARKS_RIGHT_EYE=xd,Ge.FACE_LANDMARKS_RIGHT_EYEBROW=Ad,Ge.FACE_LANDMARKS_RIGHT_IRIS=Qm,Ge.FACE_LANDMARKS_FACE_OVAL=Td,Ge.FACE_LANDMARKS_CONTOURS=eg,Ge.FACE_LANDMARKS_TESSELATION=tg;var Lr=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!0),ne(e=this.j=new cm,0,1,t=new Fe)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,or(this,e,n??{}),!this.h)return this.s}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"stylized_image");let t=new Vt;gr(t,ev,this.j);let r=new Et;Ht(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Wt(e,r),this.g.U("stylized_image",(n,i)=>{var o=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let 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,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new ut([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=o=o?a.clone():a,this.h&&this.h(o),X(this,i)}),this.g.attachEmptyPacketListener("stylized_image",n=>{this.s=null,this.h&&this.h(null),X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Lr.prototype.stylize=Lr.prototype.Oa,Lr.prototype.setOptions=Lr.prototype.o,Lr.createFromModelPath=function(e,t){return fe(Lr,e,{baseOptions:{modelAssetPath:t}})},Lr.createFromModelBuffer=function(e,t){return fe(Lr,e,{baseOptions:{modelAssetBuffer:t}})},Lr.createFromOptions=function(e,t){return fe(Lr,e,t)};var Id=vr([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 ng(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function ig(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 og(e,t=!0){let r=[];for(let i of e){var n=ha(i);e=[];for(let o of n.g())n=t&&tr(o,1)!=null?tr(o,1)??0:-1,e.push({score:Ye(o,2)??0,index:n,categoryName:rr(o,3)??""??"",displayName:rr(o,4)??""??""});r.push(e)}return r}var $t=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.j=new hm,0,1,t=new Fe),this.s=new ld,ne(this.j,0,2,this.s),this.C=new cd,ne(this.s,0,3,this.C),this.v=new dm,ne(this.s,0,2,this.v),this.h=new tv,ne(this.j,0,3,this.h),Z(this.v,2,.5),Z(this.s,4,.5),Z(this.C,2,.5)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){if(Dr(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new Li,r=t,n=fd(e.cannedGesturesClassifierOptions,ye(this.h,Li,3)?.h());ne(r,0,2,n),ne(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&ye(this.h,Li,3)?.g();return e.customGesturesClassifierOptions?(ne(r=t=new Li,0,2,n=fd(e.customGesturesClassifierOptions,ye(this.h,Li,4)?.h())),ne(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&ye(this.h,Li,4)?.g(),this.l(e)}Ja(e,t){return ng(this),or(this,e,t),ig(this)}Ka(e,t,r){return ng(this),Ur(this,e,r,t),ig(this)}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"hand_gestures"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Vt;gr(t,rv,this.j);let r=new Et;Ht(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"HAND_GESTURES:hand_gestures"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Wt(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,i)=>{for(let o of n){n=To(o);let s=[];for(let a of Yr(n,Zf,1))s.push({x:Ye(a,1)??0,y:Ye(a,2)??0,z:Ye(a,3)??0,visibility:Ye(a,4)??0});this.landmarks.push(s)}X(this,i)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{X(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,i)=>{for(let o of n){n=Ui(o);let s=[];for(let a of Yr(n,Yf,1))s.push({x:Ye(a,1)??0,y:Ye(a,2)??0,z:Ye(a,3)??0,visibility:Ye(a,4)??0});this.worldLandmarks.push(s)}X(this,i)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{X(this,n)}),this.g.attachProtoVectorListener("hand_gestures",(n,i)=>{this.gestures.push(...og(n,!1)),X(this,i)}),this.g.attachEmptyPacketListener("hand_gestures",n=>{X(this,n)}),this.g.attachProtoVectorListener("handedness",(n,i)=>{this.handedness.push(...og(n)),X(this,i)}),this.g.attachEmptyPacketListener("handedness",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function sg(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}$t.prototype.recognizeForVideo=$t.prototype.Ka,$t.prototype.recognize=$t.prototype.Ja,$t.prototype.setOptions=$t.prototype.o,$t.createFromModelPath=function(e,t){return fe($t,e,{baseOptions:{modelAssetPath:t}})},$t.createFromModelBuffer=function(e,t){return fe($t,e,{baseOptions:{modelAssetBuffer:t}})},$t.createFromOptions=function(e,t){return fe($t,e,t)},$t.HAND_CONNECTIONS=Id;var Gt=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.h=new ld,0,1,t=new Fe),this.s=new cd,ne(this.h,0,3,this.s),this.j=new dm,ne(this.h,0,2,this.j),Dr(this.j,3,1),Z(this.j,2,.5),Z(this.s,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numHands"in e&&Dr(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],or(this,e,t),sg(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Ur(this,e,r,t),sg(this)}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Vt;gr(t,nv,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Wt(e,r),this.g.attachProtoVectorListener("hand_landmarks",(n,i)=>{for(let o of n)n=To(o),this.landmarks.push(ma(n));X(this,i)}),this.g.attachEmptyPacketListener("hand_landmarks",n=>{X(this,n)}),this.g.attachProtoVectorListener("world_hand_landmarks",(n,i)=>{for(let o of n)n=Ui(o),this.worldLandmarks.push(Io(n));X(this,i)}),this.g.attachEmptyPacketListener("world_hand_landmarks",n=>{X(this,n)}),this.g.attachProtoVectorListener("handedness",(n,i)=>{var o=this.handedness,s=o.push;let a=[];for(let c of n){n=ha(c);let l=[];for(let d of n.g())l.push({score:Ye(d,2)??0,index:tr(d,1)??0??-1,categoryName:rr(d,3)??""??"",displayName:rr(d,4)??""??""});a.push(l)}s.call(o,...a),X(this,i)}),this.g.attachEmptyPacketListener("handedness",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Gt.prototype.detectForVideo=Gt.prototype.F,Gt.prototype.detect=Gt.prototype.D,Gt.prototype.setOptions=Gt.prototype.o,Gt.createFromModelPath=function(e,t){return fe(Gt,e,{baseOptions:{modelAssetPath:t}})},Gt.createFromModelBuffer=function(e,t){return fe(Gt,e,{baseOptions:{modelAssetBuffer:t}})},Gt.createFromOptions=function(e,t){return fe(Gt,e,t)},Gt.HAND_CONNECTIONS=Id;var ag=vr([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function cg(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function lg(e){try{if(!e.C)return e.h;e.C(e.h)}finally{ba(e)}}function Ca(e,t){e=To(e),t.push(ma(e))}var Me=class extends Dt{constructor(e,t){super(new ir(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,ne(e=this.j=new ym,0,1,t=new Fe),this.J=new cd,ne(this.j,0,2,this.J),this.Z=new iv,ne(this.j,0,3,this.Z),this.s=new fa,ne(this.j,0,4,this.s),this.H=new om,ne(this.j,0,5,this.H),this.v=new mm,ne(this.j,0,6,this.v),this.K=new gm,ne(this.j,0,7,this.K),Z(this.s,2,.5),Z(this.s,3,.3),Z(this.H,2,.5),Z(this.v,2,.5),Z(this.v,3,.3),Z(this.K,2,.5),Z(this.J,2,.5)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&Z(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&Z(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&Z(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&Z(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&Z(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&Z(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,cg(this),or(this,e,n),lg(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,cg(this),Ur(this,e,i,t),lg(this)}m(){var e=new Rt;Ue(e,"input_frames_image"),be(e,"pose_landmarks"),be(e,"pose_world_landmarks"),be(e,"face_landmarks"),be(e,"left_hand_landmarks"),be(e,"left_hand_world_landmarks"),be(e,"right_hand_landmarks"),be(e,"right_hand_world_landmarks");let t=new Vt,r=new Of;Rl(r,1,ki("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),function(i,o){if(o!=null)if(Array.isArray(o))Re(i,2,$p(o));else{if(!(typeof o=="string"||o instanceof qr||yo(o)))throw Error("invalid value in Any.value field: "+o+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Rl(i,2,pl(o,!1),Hn())}}(r,this.j.g());let n=new Et;Ht(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),Js(n,8,Of,r),Pe(n,"IMAGE:input_frames_image"),me(n,"POSE_LANDMARKS:pose_landmarks"),me(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),me(n,"FACE_LANDMARKS:face_landmarks"),me(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),me(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),me(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),me(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Wt(e,n),ya(this,e),this.g.attachProtoListener("pose_landmarks",(i,o)=>{Ca(i,this.h.poseLandmarks),X(this,o)}),this.g.attachEmptyPacketListener("pose_landmarks",i=>{X(this,i)}),this.g.attachProtoListener("pose_world_landmarks",(i,o)=>{var s=this.h.poseWorldLandmarks;i=Ui(i),s.push(Io(i)),X(this,o)}),this.g.attachEmptyPacketListener("pose_world_landmarks",i=>{X(this,i)}),this.outputPoseSegmentationMasks&&(me(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),Fi(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",(i,o)=>{this.h.poseSegmentationMasks=[zi(this,i,!0,!this.C)],X(this,o)}),this.g.attachEmptyPacketListener("pose_segmentation_mask",i=>{this.h.poseSegmentationMasks=[],X(this,i)})),this.g.attachProtoListener("face_landmarks",(i,o)=>{Ca(i,this.h.faceLandmarks),X(this,o)}),this.g.attachEmptyPacketListener("face_landmarks",i=>{X(this,i)}),this.outputFaceBlendshapes&&(be(e,"extra_blendshapes"),me(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",(i,o)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(i=ha(i),s.push(md(i.g()??[]))),X(this,o)}),this.g.attachEmptyPacketListener("extra_blendshapes",i=>{X(this,i)})),this.g.attachProtoListener("left_hand_landmarks",(i,o)=>{Ca(i,this.h.leftHandLandmarks),X(this,o)}),this.g.attachEmptyPacketListener("left_hand_landmarks",i=>{X(this,i)}),this.g.attachProtoListener("left_hand_world_landmarks",(i,o)=>{var s=this.h.leftHandWorldLandmarks;i=Ui(i),s.push(Io(i)),X(this,o)}),this.g.attachEmptyPacketListener("left_hand_world_landmarks",i=>{X(this,i)}),this.g.attachProtoListener("right_hand_landmarks",(i,o)=>{Ca(i,this.h.rightHandLandmarks),X(this,o)}),this.g.attachEmptyPacketListener("right_hand_landmarks",i=>{X(this,i)}),this.g.attachProtoListener("right_hand_world_landmarks",(i,o)=>{var s=this.h.rightHandWorldLandmarks;i=Ui(i),s.push(Io(i)),X(this,o)}),this.g.attachEmptyPacketListener("right_hand_world_landmarks",i=>{X(this,i)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Me.prototype.detectForVideo=Me.prototype.F,Me.prototype.detect=Me.prototype.D,Me.prototype.setOptions=Me.prototype.o,Me.createFromModelPath=function(e,t){return fe(Me,e,{baseOptions:{modelAssetPath:t}})},Me.createFromModelBuffer=function(e,t){return fe(Me,e,{baseOptions:{modelAssetBuffer:t}})},Me.createFromOptions=function(e,t){return fe(Me,e,t)},Me.HAND_CONNECTIONS=Id,Me.POSE_CONNECTIONS=ag,Me.FACE_LANDMARKS_LIPS=Sd,Me.FACE_LANDMARKS_LEFT_EYE=Ed,Me.FACE_LANDMARKS_LEFT_EYEBROW=Cd,Me.FACE_LANDMARKS_LEFT_IRIS=Zm,Me.FACE_LANDMARKS_RIGHT_EYE=xd,Me.FACE_LANDMARKS_RIGHT_EYEBROW=Ad,Me.FACE_LANDMARKS_RIGHT_IRIS=Qm,Me.FACE_LANDMARKS_FACE_OVAL=Td,Me.FACE_LANDMARKS_CONTOURS=eg,Me.FACE_LANDMARKS_TESSELATION=tg;var sr=class extends Dt{constructor(e,t){super(new ir(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},ne(e=this.h=new bm,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return ne(this.h,0,2,fd(e,ye(this.h,od,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},or(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Ur(this,e,r,t),this.j}m(){var e=new Rt;Ue(e,"input_image"),Ue(e,"norm_rect"),be(e,"classifications");let t=new Vt;gr(t,ov,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Pe(r,"IMAGE:input_image"),Pe(r,"NORM_RECT:norm_rect"),me(r,"CLASSIFICATIONS:classifications"),r.o(t),Wt(e,r),this.g.attachProtoListener("classifications",(n,i)=>{this.j=function(o){let s={classifications:Yr(o,$b,1).map(a=>md(ye(a,Kf,4)?.g()??[],tr(a,2)??0,rr(a,3)??""))};return $s(Ei(o,2))!=null&&(s.timestampMs=$s(Ei(o,2))??0),s}(Gb(n)),X(this,i)}),this.g.attachEmptyPacketListener("classifications",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};sr.prototype.classifyForVideo=sr.prototype.ta,sr.prototype.classify=sr.prototype.sa,sr.prototype.setOptions=sr.prototype.o,sr.createFromModelPath=function(e,t){return fe(sr,e,{baseOptions:{modelAssetPath:t}})},sr.createFromModelBuffer=function(e,t){return fe(sr,e,{baseOptions:{modelAssetBuffer:t}})},sr.createFromOptions=function(e,t){return fe(sr,e,t)};var qt=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!0),this.h=new vm,this.embeddings={embeddings:[]},ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){var t=this.h,r=ye(this.h,rm,2);return r=r?r.clone():new rm,e.l2Normalize!==void 0?Eo(r,1,e.l2Normalize):"l2Normalize"in e&&Re(r,1),e.quantize!==void 0?Eo(r,2,e.quantize):"quantize"in e&&Re(r,2),ne(t,0,2,r),this.l(e)}za(e,t){return or(this,e,t),this.embeddings}Aa(e,t,r){return Ur(this,e,r,t),this.embeddings}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"embeddings_out");let t=new Vt;gr(t,sv,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"EMBEDDINGS:embeddings_out"),r.o(t),Wt(e,r),this.g.attachProtoListener("embeddings_out",(n,i)=>{n=Xb(n),this.embeddings=function(o){return{embeddings:Yr(o,Kb,1).map(s=>{let a={headIndex:tr(s,3)??0??-1,headName:rr(s,4)??""??""};if(Yp(s,em,Bl(s,1))!==void 0)s=$n(s=ye(s,em,Bl(s,1)),1,dn,Wn()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=ye(s,qb,Bl(s,2))?.oa()?.h()??c}return a}),timestampMs:$s(Ei(o,2))??0}}(n),X(this,i)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};qt.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=Tm(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=Tm(Am(e.quantizedEmbedding),Am(t.quantizedEmbedding))}return e},qt.prototype.embedForVideo=qt.prototype.Aa,qt.prototype.embed=qt.prototype.za,qt.prototype.setOptions=qt.prototype.o,qt.createFromModelPath=function(e,t){return fe(qt,e,{baseOptions:{modelAssetPath:t}})},qt.createFromModelBuffer=function(e,t){return fe(qt,e,{baseOptions:{modelAssetBuffer:t}})},qt.createFromOptions=function(e,t){return fe(qt,e,t)};var Rd=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 dg(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function hg(e){try{let t=new Rd(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{ba(e)}}Rd.prototype.close=Rd.prototype.close;var Ot=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new pd,this.v=new wm,ne(this.h,0,3,this.v),ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,ki(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=Yr(e.da(),Et,1).filter(r=>(rr(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator"));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(ye(t[0],Vt,7)?.l()?.g()??new Map).forEach((r,n)=>{e.s[Number(n)]=rr(r,1)??""})})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,dg(this),or(this,e,n),hg(this)}Ma(e,t,r,n){let i=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,dg(this),Ur(this,e,i,t),hg(this)}Da(){return this.s}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect");let t=new Vt;gr(t,Sm,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),r.o(t),Wt(e,r),ya(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),Fi(this,"confidence_masks"),this.g.ca("confidence_masks",(n,i)=>{this.confidenceMasks=n.map(o=>zi(this,o,!0,!this.j)),X(this,i)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],X(this,n)})),this.outputCategoryMask&&(be(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),Fi(this,"category_mask"),this.g.U("category_mask",(n,i)=>{this.categoryMask=zi(this,n,!1,!this.j),X(this,i)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,X(this,n)})),be(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,i)=>{this.qualityScores=n,X(this,i)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ot.prototype.getLabels=Ot.prototype.Da,Ot.prototype.segmentForVideo=Ot.prototype.Ma,Ot.prototype.segment=Ot.prototype.segment,Ot.prototype.setOptions=Ot.prototype.o,Ot.createFromModelPath=function(e,t){return fe(Ot,e,{baseOptions:{modelAssetPath:t}})},Ot.createFromModelBuffer=function(e,t){return fe(Ot,e,{baseOptions:{modelAssetBuffer:t}})},Ot.createFromOptions=function(e,t){return fe(Ot,e,t)};var Pd=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach(e=>{e.close()}),this.categoryMask?.close()}};Pd.prototype.close=Pd.prototype.close;var mv=class extends Y{constructor(e){super(e)}},Vi=[0,$e,-2],xa=[0,Qr,-3,Le,Qr,-1],ug=[0,xa],pg=[0,xa,$e,-1],Dd=class extends Y{constructor(e){super(e)}},fg=[0,Qr,-1,Le],gv=class extends Y{constructor(e){super(e)}},mg=class extends Y{constructor(e){super(e)}},Bd=[1,2,3,4,5,6,7,8,9,10,14,15],gg=class extends Y{constructor(e){super(e)}};gg.prototype.g=da([0,at,[0,Bd,Ce,xa,Ce,[0,xa,Vi],Ce,ug,Ce,[0,ug,Vi],Ce,fg,Ce,[0,Qr,-3,Le,nr],Ce,[0,Qr,-3,Le],Ce,[0,_e,Qr,-2,Le,$e,Le,-1,2,Qr,Vi],Ce,pg,Ce,[0,pg,Vi],Qr,Vi,_e,Ce,[0,Qr,-3,Le,Vi,-1],Ce,[0,at,fg]],_e,[0,_e,$e,-1,Le]]);var Fr=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new pd,this.s=new wm,ne(this.h,0,3,this.s),ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let i=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new gg;let o=new mg;var s=new mv;if(Dr(s,1,255),ne(o,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Dd;Eo(a,3,!0),Z(a,1,t.keypoint.x),Z(a,2,t.keypoint.y),So(o,5,Bd,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new gv,t.scribble))Eo(t=new Dd,3,!0),Z(t,1,a.x),Z(t,2,a.y),Js(s,1,Dd,t);So(o,15,Bd,s)}Js(n,1,mg,o),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),or(this,e,i);e:{try{let l=new Pd(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{ba(this)}c=void 0}return c}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"roi_in"),Ue(e,"norm_rect_in");let t=new Vt;gr(t,Sm,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"ROI:roi_in"),Pe(r,"NORM_RECT:norm_rect_in"),r.o(t),Wt(e,r),ya(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),Fi(this,"confidence_masks"),this.g.ca("confidence_masks",(n,i)=>{this.confidenceMasks=n.map(o=>zi(this,o,!0,!this.j)),X(this,i)}),this.g.attachEmptyPacketListener("confidence_masks",n=>{this.confidenceMasks=[],X(this,n)})),this.outputCategoryMask&&(be(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),Fi(this,"category_mask"),this.g.U("category_mask",(n,i)=>{this.categoryMask=zi(this,n,!1,!this.j),X(this,i)}),this.g.attachEmptyPacketListener("category_mask",n=>{this.categoryMask=void 0,X(this,n)})),be(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",(n,i)=>{this.qualityScores=n,X(this,i)}),this.g.attachEmptyPacketListener("quality_scores",n=>{this.categoryMask=void 0,X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Fr.prototype.segment=Fr.prototype.segment,Fr.prototype.setOptions=Fr.prototype.o,Fr.createFromModelPath=function(e,t){return fe(Fr,e,{baseOptions:{modelAssetPath:t}})},Fr.createFromModelBuffer=function(e,t){return fe(Fr,e,{baseOptions:{modelAssetBuffer:t}})},Fr.createFromOptions=function(e,t){return fe(Fr,e,t)};var Ut=class extends Dt{constructor(e,t){super(new ir(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},ne(e=this.h=new Em,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,ki(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),e.maxResults!==void 0?Dr(this.h,3,e.maxResults):"maxResults"in e&&Re(this.h,3),e.scoreThreshold!==void 0?Z(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Re(this.h,4),e.categoryAllowlist!==void 0?Ys(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Re(this.h,5),e.categoryDenylist!==void 0?Ys(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Re(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},or(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Ur(this,e,r,t),this.j}m(){var e=new Rt;Ue(e,"input_frame_gpu"),Ue(e,"norm_rect"),be(e,"detections");let t=new Vt;gr(t,av,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),Pe(r,"IMAGE:input_frame_gpu"),Pe(r,"NORM_RECT:norm_rect"),me(r,"DETECTIONS:detections"),r.o(t),Wt(e,r),this.g.attachProtoVectorListener("detections",(n,i)=>{for(let o of n)n=Jf(o),this.j.detections.push(xm(n));X(this,i)}),this.g.attachEmptyPacketListener("detections",n=>{X(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ut.prototype.detectForVideo=Ut.prototype.F,Ut.prototype.detect=Ut.prototype.D,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=async function(e,t){return fe(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return fe(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return fe(Ut,e,t)};var Od=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach(e=>{e.close()})}};function yg(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function bg(e){try{let t=new Od(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{ba(e)}}Od.prototype.close=Od.prototype.close;var Kt=class extends Dt{constructor(e,t){super(new ir(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,ne(e=this.h=new Cm,0,1,t=new Fe),this.v=new gm,ne(this.h,0,3,this.v),this.j=new mm,ne(this.h,0,2,this.j),Dr(this.j,4,1),Z(this.j,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numPoses"in e&&Dr(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Z(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Z(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,yg(this),or(this,e,n),bg(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,yg(this),Ur(this,e,i,t),bg(this)}m(){var e=new Rt;Ue(e,"image_in"),Ue(e,"norm_rect"),be(e,"normalized_landmarks"),be(e,"world_landmarks"),be(e,"segmentation_masks");let t=new Vt;gr(t,cv,this.h);let r=new Et;Ht(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:normalized_landmarks"),me(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Wt(e,r),ya(this,e),this.g.attachProtoVectorListener("normalized_landmarks",(n,i)=>{this.landmarks=[];for(let o of n)n=To(o),this.landmarks.push(ma(n));X(this,i)}),this.g.attachEmptyPacketListener("normalized_landmarks",n=>{this.landmarks=[],X(this,n)}),this.g.attachProtoVectorListener("world_landmarks",(n,i)=>{this.worldLandmarks=[];for(let o of n)n=Ui(o),this.worldLandmarks.push(Io(n));X(this,i)}),this.g.attachEmptyPacketListener("world_landmarks",n=>{this.worldLandmarks=[],X(this,n)}),this.outputSegmentationMasks&&(me(r,"SEGMENTATION_MASK:segmentation_masks"),Fi(this,"segmentation_masks"),this.g.ca("segmentation_masks",(n,i)=>{this.segmentationMasks=n.map(o=>zi(this,o,!0,!this.s)),X(this,i)}),this.g.attachEmptyPacketListener("segmentation_masks",n=>{this.segmentationMasks=[],X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Kt.prototype.detectForVideo=Kt.prototype.F,Kt.prototype.detect=Kt.prototype.D,Kt.prototype.setOptions=Kt.prototype.o,Kt.createFromModelPath=function(e,t){return fe(Kt,e,{baseOptions:{modelAssetPath:t}})},Kt.createFromModelBuffer=function(e,t){return fe(Kt,e,{baseOptions:{modelAssetBuffer:t}})},Kt.createFromOptions=function(e,t){return fe(Kt,e,t)},Kt.POSE_CONNECTIONS=ag;var Uo=class{constructor(t,r,n,i,o="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=o,this.classDiv=s,i&&(this.paramsConfig=i),n&&(this.options=n)}async initializeDetector(){let t=await yn.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?Bt:Ut).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,r=1e4){if(!this.detector){console.log("Wait! Detector not loaded yet.");return}this.detecting=!0,this.error=document.getElementById("errorFrameDetection"),this.video=document.getElementById(this.classVideo),this.liveView=document.getElementById(this.classDiv),this.video||(this.video=document.createElement("video"),this.video.setAttribute("id",this.classVideo),this.video.setAttribute("style",`
49
+ `}C(){let e=this.g;e.activeTexture(e.TEXTURE1),this.j=dn(this,e),e.activeTexture(e.TEXTURE2),this.B=dn(this,e)}m(){super.m();let e=this.g;this.J=yt(e.getUniformLocation(this.h,"defaultTexture"),"Uniform location"),this.K=yt(e.getUniformLocation(this.h,"overlayTexture"),"Uniform location"),this.H=yt(e.getUniformLocation(this.h,"maskTexture"),"Uniform location")}l(){super.l();let e=this.g;e.uniform1i(this.H,0),e.uniform1i(this.J,1),e.uniform1i(this.K,2)}close(){this.j&&this.g.deleteTexture(this.j),this.B&&this.g.deleteTexture(this.B),super.close()}};function Wr(e,t){switch(t){case 0:return e.g.find((r=>r instanceof Uint8Array));case 1:return e.g.find((r=>r instanceof Float32Array));case 2:return e.g.find((r=>typeof WebGLTexture<"u"&&r instanceof WebGLTexture));default:throw Error(`Type is not supported: ${t}`)}}function Vl(e){var t=Wr(e,1);if(!t){if(t=Wr(e,0))t=new Float32Array(t).map((n=>n/255));else{t=new Float32Array(e.width*e.height);let n=Si(e);var r=Wh(e);if(ma(r,n,Zm(e)),"iPad Simulator;iPhone Simulator;iPod Simulator;iPad;iPhone;iPod".split(";").includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"document"in self&&"ontouchend"in self.document){r=new Float32Array(e.width*e.height*4),n.readPixels(0,0,e.width,e.height,n.RGBA,n.FLOAT,r);for(let i=0,o=0;i<t.length;++i,o+=4)t[i]=r[o]}else n.readPixels(0,0,e.width,e.height,n.RED,n.FLOAT,t)}e.g.push(t)}return t}function Zm(e){let t=Wr(e,2);if(!t){let r=Si(e);t=eg(e);let n=Vl(e),i=Qm(e);r.texImage2D(r.TEXTURE_2D,0,i,e.width,e.height,0,r.RED,r.FLOAT,n),Hl(e)}return t}function Si(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function Qm(e){if(e=Si(e),!As)if(e.getExtension("EXT_color_buffer_float")&&e.getExtension("OES_texture_float_linear")&&e.getExtension("EXT_float_blend"))As=e.R32F;else{if(!e.getExtension("EXT_color_buffer_half_float"))throw Error("GPU does not fully support 4-channel float32 or float16 formats");As=e.R16F}return As}function Wh(e){return e.l||(e.l=new Bi),e.l}function eg(e){let t=Si(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Wr(e,2);return r||(r=dn(Wh(e),t,e.m?t.LINEAR:t.NEAREST),e.g.push(r),e.j=!0),t.bindTexture(t.TEXTURE_2D,r),r}function Hl(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}var As,ot=class{constructor(e,t,r,n,i,o,s){this.g=e,this.m=t,this.j=r,this.canvas=n,this.l=i,this.width=o,this.height=s,this.j&&--qp===0&&console.error("You seem to be creating MPMask instances without invoking .close(). This leaks resources.")}Fa(){return!!Wr(this,0)}ja(){return!!Wr(this,1)}P(){return!!Wr(this,2)}ia(){return(t=Wr(e=this,0))||(t=Vl(e),t=new Uint8Array(t.map((r=>255*r))),e.g.push(t)),t;var e,t}ha(){return Vl(this)}M(){return Zm(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof Uint8Array)r=new Uint8Array(t);else if(t instanceof Float32Array)r=new Float32Array(t);else{if(!(t instanceof WebGLTexture))throw Error(`Type is not supported: ${t}`);{let n=Si(this),i=Wh(this);n.activeTexture(n.TEXTURE1),r=dn(i,n,this.m?n.LINEAR:n.NEAREST),n.bindTexture(n.TEXTURE_2D,r);let o=Qm(this);n.texImage2D(n.TEXTURE_2D,0,o,this.width,this.height,0,n.RED,n.FLOAT,null),n.bindTexture(n.TEXTURE_2D,null),ma(i,n,r),Do(i,n,!1,(()=>{eg(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),Hl(this)})),Hh(i),Hl(this)}}e.push(r)}return new ot(e,this.m,this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Si(this).deleteTexture(Wr(this,2)),qp=-1}};ot.prototype.close=ot.prototype.close,ot.prototype.clone=ot.prototype.clone,ot.prototype.getAsWebGLTexture=ot.prototype.M,ot.prototype.getAsFloat32Array=ot.prototype.ha,ot.prototype.getAsUint8Array=ot.prototype.ia,ot.prototype.hasWebGLTexture=ot.prototype.P,ot.prototype.hasFloat32Array=ot.prototype.ja,ot.prototype.hasUint8Array=ot.prototype.Fa;var qp=250,tv={color:"white",lineWidth:4,radius:6};function xl(e){return{...tv,fillColor:(e=e||{}).color,...e}}function Vr(e,t){return e instanceof Function?e(t):e}function Kp(e,t,r){return Math.max(Math.min(t,r),Math.min(Math.max(t,r),e))}function mo(e){if(!e.l)throw Error("CPU rendering requested but CanvasRenderingContext2D not provided.");return e.l}function xo(e){if(!e.j)throw Error("GPU rendering requested but WebGL2RenderingContext not provided.");return e.j}function Xp(e,t,r){if(t.P())r(t.M());else{let n=t.ja()?t.ha():t.ia();e.m=e.m??new Bi;let i=xo(e);r((e=new ot([n],t.m,!1,i.canvas,e.m,t.width,t.height)).M()),e.close()}}function Jp(e,t,r,n){let i=(function(a){return a.g||(a.g=new Qb),a.g})(e),o=xo(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r;Do(i,o,!0,(()=>{(function(c,l,h,d){let g=c.g;if(g.activeTexture(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,l),g.activeTexture(g.TEXTURE1),g.bindTexture(g.TEXTURE_2D,c.B),g.texImage2D(g.TEXTURE_2D,0,g.RGBA,g.RGBA,g.UNSIGNED_BYTE,h),c.H&&(function(f,m){if(f!==m)return!1;f=f.entries(),m=m.entries();for(let[b,_]of f){f=b;let k=_;var u=m.next();if(u.done)return!1;let[S,I]=u.value;if(u=I,f!==S||k[0]!==u[0]||k[1]!==u[1]||k[2]!==u[2]||k[3]!==u[3])return!1}return!!m.next().done})(c.H,d))g.activeTexture(g.TEXTURE2),g.bindTexture(g.TEXTURE_2D,c.j);else{c.H=d;let f=Array(1024).fill(0);d.forEach(((m,u)=>{if(m.length!==4)throw Error(`Color at index ${u} is not a four-channel value.`);f[4*u]=m[0],f[4*u+1]=m[1],f[4*u+2]=m[2],f[4*u+3]=m[3]})),g.activeTexture(g.TEXTURE2),g.bindTexture(g.TEXTURE_2D,c.j),g.texImage2D(g.TEXTURE_2D,0,g.RGBA,256,1,0,g.RGBA,g.UNSIGNED_BYTE,new Uint8Array(f))}})(i,t,s,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),o.drawArrays(o.TRIANGLE_FAN,0,4);let a=i.g;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,null),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,null)}))}function Yp(e,t,r,n){let i=xo(e),o=(function(c){return c.h||(c.h=new ev),c.h})(e),s=Array.isArray(r)?new ImageData(new Uint8ClampedArray(r),1,1):r,a=Array.isArray(n)?new ImageData(new Uint8ClampedArray(n),1,1):n;Do(o,i,!0,(()=>{var c=o.g;c.activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,t),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,o.j),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,s),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,o.B),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.drawArrays(i.TRIANGLE_FAN,0,4),i.bindTexture(i.TEXTURE_2D,null),(c=o.g).activeTexture(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE1),c.bindTexture(c.TEXTURE_2D,null),c.activeTexture(c.TEXTURE2),c.bindTexture(c.TEXTURE_2D,null)}))}var Et=class{constructor(e,t){e instanceof CanvasRenderingContext2D||e instanceof OffscreenCanvasRenderingContext2D?(this.l=e,this.j=t):this.j=e}ya(e,t){if(e){var r=mo(this);t=xl(t),r.save();var n=r.canvas,i=0;for(let o of e)r.fillStyle=Vr(t.fillColor,{index:i,from:o}),r.strokeStyle=Vr(t.color,{index:i,from:o}),r.lineWidth=Vr(t.lineWidth,{index:i,from:o}),(e=new Path2D).arc(o.x*n.width,o.y*n.height,Vr(t.radius,{index:i,from:o}),0,2*Math.PI),r.fill(e),r.stroke(e),++i;r.restore()}}xa(e,t,r){if(e&&t){var n=mo(this);r=xl(r),n.save();var i=n.canvas,o=0;for(let s of t){n.beginPath(),t=e[s.start];let a=e[s.end];t&&a&&(n.strokeStyle=Vr(r.color,{index:o,from:t,to:a}),n.lineWidth=Vr(r.lineWidth,{index:o,from:t,to:a}),n.moveTo(t.x*i.width,t.y*i.height),n.lineTo(a.x*i.width,a.y*i.height)),++o,n.stroke()}n.restore()}}ua(e,t){let r=mo(this);t=xl(t),r.save(),r.beginPath(),r.lineWidth=Vr(t.lineWidth,{}),r.strokeStyle=Vr(t.color,{}),r.fillStyle=Vr(t.fillColor,{}),r.moveTo(e.originX,e.originY),r.lineTo(e.originX+e.width,e.originY),r.lineTo(e.originX+e.width,e.originY+e.height),r.lineTo(e.originX,e.originY+e.height),r.lineTo(e.originX,e.originY),r.stroke(),r.fill(),r.restore()}va(e,t,r=[0,0,0,255]){this.l?(function(n,i,o,s){let a=xo(n);Xp(n,i,(c=>{Jp(n,c,o,s),(c=mo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,r,t):Jp(this,e.M(),r,t)}wa(e,t,r){this.l?(function(n,i,o,s){let a=xo(n);Xp(n,i,(c=>{Yp(n,c,o,s),(c=mo(n)).drawImage(a.canvas,0,0,c.canvas.width,c.canvas.height)}))})(this,e,t,r):Yp(this,e.M(),t,r)}close(){this.g?.close(),this.g=void 0,this.h?.close(),this.h=void 0,this.m?.close(),this.m=void 0}};function Dr(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 tg(e){var t=Dr(e,0);if(!t){t=ki(e);let r=ga(e),n=new Uint8Array(e.width*e.height*4);ma(r,t,Bs(e)),t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,n),Hh(r),t=new ImageData(new Uint8ClampedArray(n.buffer),e.width,e.height),e.g.push(t)}return t}function Bs(e){let t=Dr(e,2);if(!t){let r=ki(e);t=Os(e);let n=Dr(e,1)||tg(e);r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,n),yo(e)}return t}function ki(e){if(!e.canvas)throw Error("Conversion to different image formats require that a canvas is passed when initializing the image.");return e.h||(e.h=yt(e.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),e.h}function ga(e){return e.l||(e.l=new Bi),e.l}function Os(e){let t=ki(e);t.viewport(0,0,e.width,e.height),t.activeTexture(t.TEXTURE0);let r=Dr(e,2);return r||(r=dn(ga(e),t),e.g.push(r),e.m=!0),t.bindTexture(t.TEXTURE_2D,r),r}function yo(e){e.h.bindTexture(e.h.TEXTURE_2D,null)}function Zp(e){let t=ki(e);return Do(ga(e),t,!0,(()=>(function(r,n){let i=r.canvas;if(i.width===r.width&&i.height===r.height)return n();let o=i.width,s=i.height;return i.width=r.width,i.height=r.height,r=n(),i.width=o,i.height=s,r})(e,(()=>{if(t.bindFramebuffer(t.FRAMEBUFFER,null),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),!(e.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return e.canvas.transferToImageBitmap()}))))}Et.prototype.close=Et.prototype.close,Et.prototype.drawConfidenceMask=Et.prototype.wa,Et.prototype.drawCategoryMask=Et.prototype.va,Et.prototype.drawBoundingBox=Et.prototype.ua,Et.prototype.drawConnectors=Et.prototype.xa,Et.prototype.drawLandmarks=Et.prototype.ya,Et.lerp=function(e,t,r,n,i){return Kp(n*(1-(e-t)/(r-t))+i*(1-(r-e)/(r-t)),n,i)},Et.clamp=Kp;var ht=class{constructor(e,t,r,n,i,o,s){this.g=e,this.j=t,this.m=r,this.canvas=n,this.l=i,this.width=o,this.height=s,(this.j||this.m)&&--Qp===0&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}Ea(){return!!Dr(this,0)}ka(){return!!Dr(this,1)}P(){return!!Dr(this,2)}Ca(){return tg(this)}Ba(){var e=Dr(this,1);return e||(Bs(this),Os(this),e=Zp(this),yo(this),this.g.push(e),this.j=!0),e}M(){return Bs(this)}clone(){let e=[];for(let t of this.g){let r;if(t instanceof ImageData)r=new ImageData(t.data,this.width,this.height);else if(t instanceof WebGLTexture){let n=ki(this),i=ga(this);n.activeTexture(n.TEXTURE1),r=dn(i,n),n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,this.width,this.height,0,n.RGBA,n.UNSIGNED_BYTE,null),n.bindTexture(n.TEXTURE_2D,null),ma(i,n,r),Do(i,n,!1,(()=>{Os(this),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.drawArrays(n.TRIANGLE_FAN,0,4),yo(this)})),Hh(i),yo(this)}else{if(!(t instanceof ImageBitmap))throw Error(`Type is not supported: ${t}`);Bs(this),Os(this),r=Zp(this),yo(this)}e.push(r)}return new ht(e,this.ka(),this.P(),this.canvas,this.l,this.width,this.height)}close(){this.j&&Dr(this,1).close(),this.m&&ki(this).deleteTexture(Dr(this,2)),Qp=-1}};ht.prototype.close=ht.prototype.close,ht.prototype.clone=ht.prototype.clone,ht.prototype.getAsWebGLTexture=ht.prototype.M,ht.prototype.getAsImageBitmap=ht.prototype.Ba,ht.prototype.getAsImageData=ht.prototype.Ca,ht.prototype.hasWebGLTexture=ht.prototype.P,ht.prototype.hasImageBitmap=ht.prototype.ka,ht.prototype.hasImageData=ht.prototype.Ea;var Qp=250;function yr(...e){return e.map((([t,r])=>({start:t,end:r})))}var rv=(function(e){return class extends e{La(){this.i._registerModelResourcesGraphService()}}})((ef=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:Jm()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.i._malloc(r);this.i.HEAPU8.set(e,n),t?this.i._changeBinaryGraph(r,n):this.i._changeTextGraph(r,n),this.i._free(n)}configureAudio(e,t,r,n,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Q(this,n||"input_audio",(o=>{Q(this,i=i||"audio_header",(s=>{this.i._configureAudio(o,s,e,t??0,r)}))}))}setAutoResizeCanvas(e){this.l=e}setAutoRenderToScreen(e){this.i._setAutoRenderToScreen(e)}setGpuBufferVerticalFlip(e){this.i.gpuOriginForWebTexturesIsBottomLeft=e}da(e){Ir(this,"__graph_config__",(t=>{e(t)})),Q(this,"__graph_config__",(t=>{this.i._getGraphConfig(t,void 0)})),delete this.i.simpleListeners.__graph_config__}attachErrorListener(e){this.i.errorListener=e}attachEmptyPacketListener(e,t){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[e]=t}addAudioToStream(e,t,r){this.addAudioToStreamWithShape(e,0,0,t,r)}addAudioToStreamWithShape(e,t,r,n,i){let o=4*e.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(e,this.g/4),Q(this,n,(s=>{this.i._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){Q(this,t,(n=>{let[i,o]=Vp(this,e,n);this.i._addBoundTextureToStream(n,i,o,r)}))}addBoolToStream(e,t,r){Q(this,t,(n=>{this.i._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){Q(this,t,(n=>{this.i._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){Q(this,t,(n=>{this.i._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){Q(this,t,(n=>{this.i._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){Q(this,t,(n=>{this.i._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){Q(this,t,(n=>{Q(this,e,(i=>{this.i._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){Q(this,t,(n=>{Hp(this,Object.keys(e),(i=>{Hp(this,Object.values(e),(o=>{this.i._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){Q(this,r,(i=>{Q(this,t,(o=>{let s=this.i._malloc(e.length);this.i.HEAPU8.set(e,s),this.i._addProtoToInputStream(s,e.length,o,i,n),this.i._free(s)}))}))}addEmptyPacketToStream(e,t){Q(this,e,(r=>{this.i._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateBoolVector(e.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let o of e)this.i._addBoolVectorEntry(i,o);this.i._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateDoubleVector(e.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let o of e)this.i._addDoubleVectorEntry(i,o);this.i._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateFloatVector(e.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let o of e)this.i._addFloatVectorEntry(i,o);this.i._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateIntVector(e.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let o of e)this.i._addIntVectorEntry(i,o);this.i._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.i._addUintVectorEntry(i,o);this.i._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){Q(this,t,(n=>{let i=this.i._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)Q(this,o,(s=>{this.i._addStringVectorEntry(i,s)}));this.i._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){Q(this,t,(r=>{this.i._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){Q(this,t,(r=>{Q(this,e,(n=>{this.i._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){Q(this,r,(n=>{Q(this,t,(i=>{let o=this.i._malloc(e.length);this.i.HEAPU8.set(e,o),this.i._addProtoToInputSidePacket(o,e.length,i,n),this.i._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.i._addBoolVectorEntry(n,i);this.i._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.i._addDoubleVectorEntry(n,i);this.i._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.i._addFloatVectorEntry(n,i);this.i._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.i._addIntVectorEntry(n,i);this.i._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.i._addUintVectorEntry(n,i);this.i._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){Q(this,t,(r=>{let n=this.i._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)Q(this,i,(o=>{this.i._addStringVectorEntry(n,o)}));this.i._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachBoolListener(r)}))}attachBoolVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachBoolVectorListener(r)}))}attachIntListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachIntListener(r)}))}attachIntVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachIntVectorListener(r)}))}attachUintListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachUintListener(r)}))}attachUintVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachUintVectorListener(r)}))}attachDoubleListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachFloatListener(r)}))}attachFloatVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachFloatVectorListener(r)}))}attachStringListener(e,t){Ir(this,e,t),Q(this,e,(r=>{this.i._attachStringListener(r)}))}attachStringVectorListener(e,t){rn(this,e,t),Q(this,e,(r=>{this.i._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){Ir(this,e,t),Q(this,e,(n=>{this.i._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){rn(this,e,t),Q(this,e,(n=>{this.i._attachProtoVectorListener(n,r||!1)}))}attachAudioListener(e,t,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Ir(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),Q(this,e,(n=>{this.i._attachAudioListener(n,r||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}},class extends ef{get ea(){return this.i}qa(e,t,r){Q(this,t,(n=>{let[i,o]=Vp(this,e,n);this.ea._addBoundTextureAsImageToStream(n,i,o,r)}))}U(e,t){Ir(this,e,t),Q(this,e,(r=>{this.ea._attachImageListener(r)}))}ca(e,t){rn(this,e,t),Q(this,e,(r=>{this.ea._attachImageVectorListener(r)}))}})),ef,rr=class extends rv{};async function fe(e,t,r){return(async function(n,i,o,s){return Zb(n,i,o,s)})(e,r.canvas??(Jm()?void 0:document.createElement("canvas")),t,r)}function rg(e,t,r,n){if(e.T){let o=new Cm;if(r?.regionOfInterest){if(!e.pa)throw Error("This task doesn't support region-of-interest.");var i=r.regionOfInterest;if(i.left>=i.right||i.top>=i.bottom)throw Error("Expected RectF with left < right and top < bottom.");if(i.left<0||i.top<0||i.right>1||i.bottom>1)throw Error("Expected RectF values to be in [0,1].");Z(o,1,(i.left+i.right)/2),Z(o,2,(i.top+i.bottom)/2),Z(o,4,i.right-i.left),Z(o,3,i.bottom-i.top)}else Z(o,1,.5),Z(o,2,.5),Z(o,4,1),Z(o,3,1);if(r?.rotationDegrees){if(r?.rotationDegrees%90!=0)throw Error("Expected rotation to be a multiple of 90\xB0.");if(Z(o,5,-Math.PI*r.rotationDegrees/180),r?.rotationDegrees%180!=0){let[s,a]=Ym(t);r=Je(o,3)*a/s,i=Je(o,4)*s/a,Z(o,4,r),Z(o,3,i)}}e.g.addProtoToStream(o.g(),"mediapipe.NormalizedRect",e.T,n)}e.g.qa(t,e.aa,n??performance.now()),e.finishProcessing()}function nr(e,t,r){if(e.baseOptions?.g())throw Error("Task is not initialized with image mode. 'runningMode' must be set to 'IMAGE'.");rg(e,t,r,e.B+1)}function Or(e,t,r,n){if(!e.baseOptions?.g())throw Error("Task is not initialized with video mode. 'runningMode' must be set to 'VIDEO'.");rg(e,t,r,n)}function Ei(e,t,r,n){var i=t.data;let o=t.width,s=o*(t=t.height);if((i instanceof Uint8Array||i instanceof Float32Array)&&i.length!==s)throw Error("Unsupported channel count: "+i.length/s);return e=new ot([i],r,!1,e.g.i.canvas,e.O,o,t),n?e.clone():e}var It=class extends Ds{constructor(e,t,r,n){super(e),this.g=e,this.aa=t,this.T=r,this.pa=n,this.O=new Bi}l(e,t=!0){if("runningMode"in e&&Eo(this.baseOptions,2,!!e.runningMode&&e.runningMode!=="IMAGE"),e.canvas!==void 0&&this.g.i.canvas!==e.canvas)throw Error("You must create a new task to reset the canvas.");return super.l(e,t)}close(){this.O.close(),super.close()}};It.prototype.close=It.prototype.close;var xt=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect_in",!1),this.j={detections:[]},ne(e=this.h=new da,0,1,t=new Fe),Z(this.h,2,.5),Z(this.h,3,.3)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"minDetectionConfidence"in e&&Z(this.h,2,e.minDetectionConfidence??.5),"minSuppressionThreshold"in e&&Z(this.h,3,e.minSuppressionThreshold??.3),this.l(e)}D(e,t){return this.j={detections:[]},nr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Or(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect_in"),be(e,"detections");let t=new Nt;fr(t,Mb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_detector.FaceDetectorGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect_in"),me(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=Sm(o),this.j.detections.push(Km(n));X(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};xt.prototype.detectForVideo=xt.prototype.F,xt.prototype.detect=xt.prototype.D,xt.prototype.setOptions=xt.prototype.o,xt.createFromModelPath=async function(e,t){return fe(xt,e,{baseOptions:{modelAssetPath:t}})},xt.createFromModelBuffer=function(e,t){return fe(xt,e,{baseOptions:{modelAssetBuffer:t}})},xt.createFromOptions=function(e,t){return fe(xt,e,t)};var $h=yr([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=yr([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]),qh=yr([276,283],[283,282],[282,295],[295,285],[300,293],[293,334],[334,296],[296,336]),ng=yr([474,475],[475,476],[476,477],[477,474]),Kh=yr([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]),Xh=yr([46,53],[53,52],[52,65],[65,55],[70,63],[63,105],[105,66],[66,107]),ig=yr([469,470],[470,471],[471,472],[472,469]),Jh=yr([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]),og=[...$h,...Gh,...qh,...Kh,...Xh,...Jh],sg=yr([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 tf(e){e.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]}}var He=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!1),this.j={faceLandmarks:[],faceBlendshapes:[],facialTransformationMatrixes:[]},this.outputFacialTransformationMatrixes=this.outputFaceBlendshapes=!1,ne(e=this.h=new Rm,0,1,t=new Fe),this.v=new Im,ne(this.h,0,3,this.v),this.s=new da,ne(this.h,0,2,this.s),Br(this.s,4,1),Z(this.s,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numFaces"in e&&Br(this.s,4,e.numFaces??1),"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minFacePresenceConfidence"in e&&Z(this.v,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"outputFacialTransformationMatrixes"in e&&(this.outputFacialTransformationMatrixes=!!e.outputFacialTransformationMatrixes),this.l(e)}D(e,t){return tf(this),nr(this,e,t),this.j}F(e,t,r){return tf(this),Or(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"face_landmarks");let t=new Nt;fr(t,zb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.face_landmarker.FaceLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:face_landmarks"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("face_landmarks",((n,i)=>{for(let o of n)n=Po(o),this.j.faceLandmarks.push(ua(n));X(this,i)})),this.g.attachEmptyPacketListener("face_landmarks",(n=>{X(this,n)})),this.outputFaceBlendshapes&&(be(e,"blendshapes"),me(r,"BLENDSHAPES:blendshapes"),this.g.attachProtoVectorListener("blendshapes",((n,i)=>{if(this.outputFaceBlendshapes)for(let o of n)n=ha(o),this.j.faceBlendshapes.push(jh(n.g()??[]));X(this,i)})),this.g.attachEmptyPacketListener("blendshapes",(n=>{X(this,n)}))),this.outputFacialTransformationMatrixes&&(be(e,"face_geometry"),me(r,"FACE_GEOMETRY:face_geometry"),this.g.attachProtoVectorListener("face_geometry",((n,i)=>{if(this.outputFacialTransformationMatrixes)for(let o of n)(n=ye(Nb(o),Rb,2))&&this.j.facialTransformationMatrixes.push({rows:Zt(n,1)??0??0,columns:Zt(n,2)??0??0,data:Fn(n,3,pn,Ln()).slice()??[]});X(this,i)})),this.g.attachEmptyPacketListener("face_geometry",(n=>{X(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};He.prototype.detectForVideo=He.prototype.F,He.prototype.detect=He.prototype.D,He.prototype.setOptions=He.prototype.o,He.createFromModelPath=function(e,t){return fe(He,e,{baseOptions:{modelAssetPath:t}})},He.createFromModelBuffer=function(e,t){return fe(He,e,{baseOptions:{modelAssetBuffer:t}})},He.createFromOptions=function(e,t){return fe(He,e,t)},He.FACE_LANDMARKS_LIPS=$h,He.FACE_LANDMARKS_LEFT_EYE=Gh,He.FACE_LANDMARKS_LEFT_EYEBROW=qh,He.FACE_LANDMARKS_LEFT_IRIS=ng,He.FACE_LANDMARKS_RIGHT_EYE=Kh,He.FACE_LANDMARKS_RIGHT_EYEBROW=Xh,He.FACE_LANDMARKS_RIGHT_IRIS=ig,He.FACE_LANDMARKS_FACE_OVAL=Jh,He.FACE_LANDMARKS_CONTOURS=og,He.FACE_LANDMARKS_TESSELATION=sg;var Rr=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!0),ne(e=this.j=new Dm,0,1,t=new Fe)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return super.l(e)}Oa(e,t,r){let n=typeof t!="function"?t:{};if(this.h=typeof t=="function"?t:r,nr(this,e,n??{}),!this.h)return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"stylized_image");let t=new Nt;fr(t,jb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.face_stylizer.FaceStylizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"STYLIZED_IMAGE:stylized_image"),r.o(t),Vt(e,r),this.g.U("stylized_image",((n,i)=>{var o=!this.h,s=n.data,a=n.width;let c=a*(n=n.height);if(s instanceof Uint8Array)if(s.length===3*c){let l=new Uint8ClampedArray(4*c);for(let h=0;h<c;++h)l[4*h]=s[3*h],l[4*h+1]=s[3*h+1],l[4*h+2]=s[3*h+2],l[4*h+3]=255;s=new ImageData(l,a,n)}else{if(s.length!==4*c)throw Error("Unsupported channel count: "+s.length/c);s=new ImageData(new Uint8ClampedArray(s.buffer,s.byteOffset,s.length),a,n)}else if(!(s instanceof WebGLTexture))throw Error(`Unsupported format: ${s.constructor.name}`);a=new ht([s],!1,!1,this.g.i.canvas,this.O,a,n),this.s=o=o?a.clone():a,this.h&&this.h(o),X(this,i)})),this.g.attachEmptyPacketListener("stylized_image",(n=>{this.s=null,this.h&&this.h(null),X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Rr.prototype.stylize=Rr.prototype.Oa,Rr.prototype.setOptions=Rr.prototype.o,Rr.createFromModelPath=function(e,t){return fe(Rr,e,{baseOptions:{modelAssetPath:t}})},Rr.createFromModelBuffer=function(e,t){return fe(Rr,e,{baseOptions:{modelAssetBuffer:t}})},Rr.createFromOptions=function(e,t){return fe(Rr,e,t)};var Yh=yr([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 rf(e){e.gestures=[],e.landmarks=[],e.worldLandmarks=[],e.handedness=[]}function nf(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 of(e,t=!0){let r=[];for(let i of e){var n=ha(i);e=[];for(let o of n.g())n=t&&Zt(o,1)!=null?Zt(o,1)??0:-1,e.push({score:Je(o,2)??0,index:n,categoryName:er(o,3)??""??"",displayName:er(o,4)??""??""});r.push(e)}return r}var Ut=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!1),this.gestures=[],this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.j=new Um,0,1,t=new Fe),this.s=new Fh,ne(this.j,0,2,this.s),this.C=new Lh,ne(this.s,0,3,this.C),this.v=new Om,ne(this.s,0,2,this.v),this.h=new Vb,ne(this.j,0,3,this.h),Z(this.v,2,.5),Z(this.s,4,.5),Z(this.C,2,.5)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){if(Br(this.v,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.v,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.s,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.C,2,e.minHandPresenceConfidence??.5),e.cannedGesturesClassifierOptions){var t=new ai,r=t,n=zl(e.cannedGesturesClassifierOptions,ye(this.h,ai,3)?.h());ne(r,0,2,n),ne(this.h,0,3,t)}else e.cannedGesturesClassifierOptions===void 0&&ye(this.h,ai,3)?.g();return e.customGesturesClassifierOptions?(ne(r=t=new ai,0,2,n=zl(e.customGesturesClassifierOptions,ye(this.h,ai,4)?.h())),ne(this.h,0,4,t)):e.customGesturesClassifierOptions===void 0&&ye(this.h,ai,4)?.g(),this.l(e)}Ja(e,t){return rf(this),nr(this,e,t),nf(this)}Ka(e,t,r){return rf(this),Or(this,e,r,t),nf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_gestures"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;fr(t,Hb,this.j);let r=new bt;jt(r,"mediapipe.tasks.vision.gesture_recognizer.GestureRecognizerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"HAND_GESTURES:hand_gestures"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n){n=Po(o);let s=[];for(let a of Kr(n,Em,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.landmarks.push(s)}X(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n){n=fi(o);let s=[];for(let a of Kr(n,km,1))s.push({x:Je(a,1)??0,y:Je(a,2)??0,z:Je(a,3)??0,visibility:Je(a,4)??0});this.worldLandmarks.push(s)}X(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("hand_gestures",((n,i)=>{this.gestures.push(...of(n,!1)),X(this,i)})),this.g.attachEmptyPacketListener("hand_gestures",(n=>{X(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{this.handedness.push(...of(n)),X(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function sf(e){return{landmarks:e.landmarks,worldLandmarks:e.worldLandmarks,handednesses:e.handedness,handedness:e.handedness}}Ut.prototype.recognizeForVideo=Ut.prototype.Ka,Ut.prototype.recognize=Ut.prototype.Ja,Ut.prototype.setOptions=Ut.prototype.o,Ut.createFromModelPath=function(e,t){return fe(Ut,e,{baseOptions:{modelAssetPath:t}})},Ut.createFromModelBuffer=function(e,t){return fe(Ut,e,{baseOptions:{modelAssetBuffer:t}})},Ut.createFromOptions=function(e,t){return fe(Ut,e,t)},Ut.HAND_CONNECTIONS=Yh;var Lt=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.handedness=[],ne(e=this.h=new Fh,0,1,t=new Fe),this.s=new Lh,ne(this.h,0,3,this.s),this.j=new Om,ne(this.h,0,2,this.j),Br(this.j,3,1),Z(this.j,2,.5),Z(this.s,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numHands"in e&&Br(this.j,3,e.numHands??1),"minHandDetectionConfidence"in e&&Z(this.j,2,e.minHandDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minHandPresenceConfidence"in e&&Z(this.s,2,e.minHandPresenceConfidence??.5),this.l(e)}D(e,t){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],nr(this,e,t),sf(this)}F(e,t,r){return this.landmarks=[],this.worldLandmarks=[],this.handedness=[],Or(this,e,r,t),sf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"hand_landmarks"),be(e,"world_hand_landmarks"),be(e,"handedness");let t=new Nt;fr(t,Wb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.hand_landmarker.HandLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"LANDMARKS:hand_landmarks"),me(r,"WORLD_LANDMARKS:world_hand_landmarks"),me(r,"HANDEDNESS:handedness"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("hand_landmarks",((n,i)=>{for(let o of n)n=Po(o),this.landmarks.push(ua(n));X(this,i)})),this.g.attachEmptyPacketListener("hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("world_hand_landmarks",((n,i)=>{for(let o of n)n=fi(o),this.worldLandmarks.push(wo(n));X(this,i)})),this.g.attachEmptyPacketListener("world_hand_landmarks",(n=>{X(this,n)})),this.g.attachProtoVectorListener("handedness",((n,i)=>{var o=this.handedness,s=o.push;let a=[];for(let c of n){n=ha(c);let l=[];for(let h of n.g())l.push({score:Je(h,2)??0,index:Zt(h,1)??0??-1,categoryName:er(h,3)??""??"",displayName:er(h,4)??""??""});a.push(l)}s.call(o,...a),X(this,i)})),this.g.attachEmptyPacketListener("handedness",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Lt.prototype.detectForVideo=Lt.prototype.F,Lt.prototype.detect=Lt.prototype.D,Lt.prototype.setOptions=Lt.prototype.o,Lt.createFromModelPath=function(e,t){return fe(Lt,e,{baseOptions:{modelAssetPath:t}})},Lt.createFromModelBuffer=function(e,t){return fe(Lt,e,{baseOptions:{modelAssetBuffer:t}})},Lt.createFromOptions=function(e,t){return fe(Lt,e,t)},Lt.HAND_CONNECTIONS=Yh;var ag=yr([0,1],[1,2],[2,3],[3,7],[0,4],[4,5],[5,6],[6,8],[9,10],[11,12],[11,13],[13,15],[15,17],[15,19],[15,21],[17,19],[12,14],[14,16],[16,18],[16,20],[16,22],[18,20],[11,23],[12,24],[23,24],[23,25],[24,26],[25,27],[26,28],[27,29],[28,30],[29,31],[30,32],[27,31],[28,32]);function af(e){e.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]}}function cf(e){try{if(!e.C)return e.h;e.C(e.h)}finally{fa(e)}}function Ts(e,t){e=Po(e),t.push(ua(e))}var Ue=class extends It{constructor(e,t){super(new rr(e,t),"input_frames_image",null,!1),this.h={faceLandmarks:[],faceBlendshapes:[],poseLandmarks:[],poseWorldLandmarks:[],poseSegmentationMasks:[],leftHandLandmarks:[],leftHandWorldLandmarks:[],rightHandLandmarks:[],rightHandWorldLandmarks:[]},this.outputPoseSegmentationMasks=this.outputFaceBlendshapes=!1,ne(e=this.j=new zm,0,1,t=new Fe),this.J=new Lh,ne(this.j,0,2,this.J),this.Z=new $b,ne(this.j,0,3,this.Z),this.s=new da,ne(this.j,0,4,this.s),this.H=new Im,ne(this.j,0,5,this.H),this.v=new Mm,ne(this.j,0,6,this.v),this.K=new Nm,ne(this.j,0,7,this.K),Z(this.s,2,.5),Z(this.s,3,.3),Z(this.H,2,.5),Z(this.v,2,.5),Z(this.v,3,.3),Z(this.K,2,.5),Z(this.J,2,.5)}get baseOptions(){return ye(this.j,Fe,1)}set baseOptions(e){ne(this.j,0,1,e)}o(e){return"minFaceDetectionConfidence"in e&&Z(this.s,2,e.minFaceDetectionConfidence??.5),"minFaceSuppressionThreshold"in e&&Z(this.s,3,e.minFaceSuppressionThreshold??.3),"minFacePresenceConfidence"in e&&Z(this.H,2,e.minFacePresenceConfidence??.5),"outputFaceBlendshapes"in e&&(this.outputFaceBlendshapes=!!e.outputFaceBlendshapes),"minPoseDetectionConfidence"in e&&Z(this.v,2,e.minPoseDetectionConfidence??.5),"minPoseSuppressionThreshold"in e&&Z(this.v,3,e.minPoseSuppressionThreshold??.3),"minPosePresenceConfidence"in e&&Z(this.K,2,e.minPosePresenceConfidence??.5),"outputPoseSegmentationMasks"in e&&(this.outputPoseSegmentationMasks=!!e.outputPoseSegmentationMasks),"minHandLandmarksConfidence"in e&&Z(this.J,2,e.minHandLandmarksConfidence??.5),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.C=typeof t=="function"?t:r,af(this),nr(this,e,n),cf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.C=typeof r=="function"?r:n,af(this),Or(this,e,i,t),cf(this)}m(){var e=new Rt;Oe(e,"input_frames_image"),be(e,"pose_landmarks"),be(e,"pose_world_landmarks"),be(e,"face_landmarks"),be(e,"left_hand_landmarks"),be(e,"left_hand_world_landmarks"),be(e,"right_hand_landmarks"),be(e,"right_hand_world_landmarks");let t=new Nt,r=new xp;Bl(r,1,Ai("type.googleapis.com/mediapipe.tasks.vision.holistic_landmarker.proto.HolisticLandmarkerGraphOptions"),""),(function(i,o){if(o!=null)if(Array.isArray(o))Re(i,2,Of(o));else{if(!(typeof o=="string"||o instanceof Gr||Ao(o)))throw Error("invalid value in Any.value field: "+o+" expected a ByteString, a base64 encoded string, a Uint8Array or a jspb array");Bl(i,2,eh(o,!1),zn())}})(r,this.j.g());let n=new bt;jt(n,"mediapipe.tasks.vision.holistic_landmarker.HolisticLandmarkerGraph"),zs(n,8,xp,r),Pe(n,"IMAGE:input_frames_image"),me(n,"POSE_LANDMARKS:pose_landmarks"),me(n,"POSE_WORLD_LANDMARKS:pose_world_landmarks"),me(n,"FACE_LANDMARKS:face_landmarks"),me(n,"LEFT_HAND_LANDMARKS:left_hand_landmarks"),me(n,"LEFT_HAND_WORLD_LANDMARKS:left_hand_world_landmarks"),me(n,"RIGHT_HAND_LANDMARKS:right_hand_landmarks"),me(n,"RIGHT_HAND_WORLD_LANDMARKS:right_hand_world_landmarks"),n.o(t),Vt(e,n),pa(this,e),this.g.attachProtoListener("pose_landmarks",((i,o)=>{Ts(i,this.h.poseLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("pose_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("pose_world_landmarks",((i,o)=>{var s=this.h.poseWorldLandmarks;i=fi(i),s.push(wo(i)),X(this,o)})),this.g.attachEmptyPacketListener("pose_world_landmarks",(i=>{X(this,i)})),this.outputPoseSegmentationMasks&&(me(n,"POSE_SEGMENTATION_MASK:pose_segmentation_mask"),wi(this,"pose_segmentation_mask"),this.g.U("pose_segmentation_mask",((i,o)=>{this.h.poseSegmentationMasks=[Ei(this,i,!0,!this.C)],X(this,o)})),this.g.attachEmptyPacketListener("pose_segmentation_mask",(i=>{this.h.poseSegmentationMasks=[],X(this,i)}))),this.g.attachProtoListener("face_landmarks",((i,o)=>{Ts(i,this.h.faceLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("face_landmarks",(i=>{X(this,i)})),this.outputFaceBlendshapes&&(be(e,"extra_blendshapes"),me(n,"FACE_BLENDSHAPES:extra_blendshapes"),this.g.attachProtoListener("extra_blendshapes",((i,o)=>{var s=this.h.faceBlendshapes;this.outputFaceBlendshapes&&(i=ha(i),s.push(jh(i.g()??[]))),X(this,o)})),this.g.attachEmptyPacketListener("extra_blendshapes",(i=>{X(this,i)}))),this.g.attachProtoListener("left_hand_landmarks",((i,o)=>{Ts(i,this.h.leftHandLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("left_hand_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("left_hand_world_landmarks",((i,o)=>{var s=this.h.leftHandWorldLandmarks;i=fi(i),s.push(wo(i)),X(this,o)})),this.g.attachEmptyPacketListener("left_hand_world_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("right_hand_landmarks",((i,o)=>{Ts(i,this.h.rightHandLandmarks),X(this,o)})),this.g.attachEmptyPacketListener("right_hand_landmarks",(i=>{X(this,i)})),this.g.attachProtoListener("right_hand_world_landmarks",((i,o)=>{var s=this.h.rightHandWorldLandmarks;i=fi(i),s.push(wo(i)),X(this,o)})),this.g.attachEmptyPacketListener("right_hand_world_landmarks",(i=>{X(this,i)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ue.prototype.detectForVideo=Ue.prototype.F,Ue.prototype.detect=Ue.prototype.D,Ue.prototype.setOptions=Ue.prototype.o,Ue.createFromModelPath=function(e,t){return fe(Ue,e,{baseOptions:{modelAssetPath:t}})},Ue.createFromModelBuffer=function(e,t){return fe(Ue,e,{baseOptions:{modelAssetBuffer:t}})},Ue.createFromOptions=function(e,t){return fe(Ue,e,t)},Ue.HAND_CONNECTIONS=Yh,Ue.POSE_CONNECTIONS=ag,Ue.FACE_LANDMARKS_LIPS=$h,Ue.FACE_LANDMARKS_LEFT_EYE=Gh,Ue.FACE_LANDMARKS_LEFT_EYEBROW=qh,Ue.FACE_LANDMARKS_LEFT_IRIS=ng,Ue.FACE_LANDMARKS_RIGHT_EYE=Kh,Ue.FACE_LANDMARKS_RIGHT_EYEBROW=Xh,Ue.FACE_LANDMARKS_RIGHT_IRIS=ig,Ue.FACE_LANDMARKS_FACE_OVAL=Jh,Ue.FACE_LANDMARKS_CONTOURS=og,Ue.FACE_LANDMARKS_TESSELATION=sg;var Jt=class extends It{constructor(e,t){super(new rr(e,t),"input_image","norm_rect",!0),this.j={classifications:[]},ne(e=this.h=new jm,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return ne(this.h,0,2,zl(e,ye(this.h,Bh,2))),this.l(e)}sa(e,t){return this.j={classifications:[]},nr(this,e,t),this.j}ta(e,t,r){return this.j={classifications:[]},Or(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_image"),Oe(e,"norm_rect"),be(e,"classifications");let t=new Nt;fr(t,Gb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_classifier.ImageClassifierGraph"),Pe(r,"IMAGE:input_image"),Pe(r,"NORM_RECT:norm_rect"),me(r,"CLASSIFICATIONS:classifications"),r.o(t),Vt(e,r),this.g.attachProtoListener("classifications",((n,i)=>{this.j=(function(o){let s={classifications:Kr(o,Db,1).map((a=>jh(ye(a,_m,4)?.g()??[],Zt(a,2)??0,er(a,3)??"")))};return Ns(vi(o,2))!=null&&(s.timestampMs=Ns(vi(o,2))??0),s})(Bb(n)),X(this,i)})),this.g.attachEmptyPacketListener("classifications",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Jt.prototype.classifyForVideo=Jt.prototype.ta,Jt.prototype.classify=Jt.prototype.sa,Jt.prototype.setOptions=Jt.prototype.o,Jt.createFromModelPath=function(e,t){return fe(Jt,e,{baseOptions:{modelAssetPath:t}})},Jt.createFromModelBuffer=function(e,t){return fe(Jt,e,{baseOptions:{modelAssetBuffer:t}})},Jt.createFromOptions=function(e,t){return fe(Jt,e,t)};var Ft=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!0),this.h=new Vm,this.embeddings={embeddings:[]},ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){var t=this.h,r=ye(this.h,Up,2);return r=r?r.clone():new Up,e.l2Normalize!==void 0?Eo(r,1,e.l2Normalize):"l2Normalize"in e&&Re(r,1),e.quantize!==void 0?Eo(r,2,e.quantize):"quantize"in e&&Re(r,2),ne(t,0,2,r),this.l(e)}za(e,t){return nr(this,e,t),this.embeddings}Aa(e,t,r){return Or(this,e,r,t),this.embeddings}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"embeddings_out");let t=new Nt;fr(t,qb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_embedder.ImageEmbedderGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"EMBEDDINGS:embeddings_out"),r.o(t),Vt(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=Lb(n),this.embeddings=(function(o){return{embeddings:Kr(o,Ub,1).map((s=>{let a={headIndex:Zt(s,3)??0??-1,headName:er(s,4)??""??""};if(Nf(s,Op,_l(s,1))!==void 0)s=Fn(s=ye(s,Op,_l(s,1)),1,pn,Ln()),a.floatEmbedding=s.slice();else{let c=new Uint8Array(0);a.quantizedEmbedding=ye(s,Ob,_l(s,2))?.oa()?.h()??c}return a})),timestampMs:Ns(vi(o,2))??0}})(n),X(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ft.cosineSimilarity=function(e,t){if(e.floatEmbedding&&t.floatEmbedding)e=zp(e.floatEmbedding,t.floatEmbedding);else{if(!e.quantizedEmbedding||!t.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");e=zp(Np(e.quantizedEmbedding),Np(t.quantizedEmbedding))}return e},Ft.prototype.embedForVideo=Ft.prototype.Aa,Ft.prototype.embed=Ft.prototype.za,Ft.prototype.setOptions=Ft.prototype.o,Ft.createFromModelPath=function(e,t){return fe(Ft,e,{baseOptions:{modelAssetPath:t}})},Ft.createFromModelBuffer=function(e,t){return fe(Ft,e,{baseOptions:{modelAssetBuffer:t}})},Ft.createFromOptions=function(e,t){return fe(Ft,e,t)};var Wl=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 lf(e){e.categoryMask=void 0,e.confidenceMasks=void 0,e.qualityScores=void 0}function hf(e){try{let t=new Wl(e.confidenceMasks,e.categoryMask,e.qualityScores);if(!e.j)return t;e.j(t)}finally{fa(e)}}Wl.prototype.close=Wl.prototype.close;var Ct=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!1),this.s=[],this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new zh,this.v=new Hm,ne(this.h,0,3,this.v),ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ai(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}I(){(function(e){let t=Kr(e.da(),bt,1).filter((r=>(er(r,1)??"").includes("mediapipe.tasks.TensorsToSegmentationCalculator")));if(e.s=[],t.length>1)throw Error("The graph has more than one mediapipe.tasks.TensorsToSegmentationCalculator.");t.length===1&&(ye(t[0],Nt,7)?.l()?.g()??new Map).forEach(((r,n)=>{e.s[Number(n)]=er(r,1)??""}))})(this)}segment(e,t,r){let n=typeof t!="function"?t:{};return this.j=typeof t=="function"?t:r,lf(this),nr(this,e,n),hf(this)}Ma(e,t,r,n){let i=typeof r!="function"?r:{};return this.j=typeof r=="function"?r:n,lf(this),Or(this,e,i,t),hf(this)}Da(){return this.s}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect");let t=new Nt;fr(t,$m,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.image_segmenter.ImageSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),r.o(t),Vt(e,r),pa(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),wi(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>Ei(this,o,!0,!this.j))),X(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],X(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),wi(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=Ei(this,n,!1,!this.j),X(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,X(this,n)}))),be(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,X(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Ct.prototype.getLabels=Ct.prototype.Da,Ct.prototype.segmentForVideo=Ct.prototype.Ma,Ct.prototype.segment=Ct.prototype.segment,Ct.prototype.setOptions=Ct.prototype.o,Ct.createFromModelPath=function(e,t){return fe(Ct,e,{baseOptions:{modelAssetPath:t}})},Ct.createFromModelBuffer=function(e,t){return fe(Ct,e,{baseOptions:{modelAssetBuffer:t}})},Ct.createFromOptions=function(e,t){return fe(Ct,e,t)};var $l=class{constructor(e,t,r){this.confidenceMasks=e,this.categoryMask=t,this.qualityScores=r}close(){this.confidenceMasks?.forEach((e=>{e.close()})),this.categoryMask?.close()}};$l.prototype.close=$l.prototype.close;var nv=class extends Y{constructor(e){super(e)}},ci=[0,$e,-2],Ws=[0,Hr,-3,Le,Hr,-1],df=[0,Ws],uf=[0,Ws,$e,-1],Al=class extends Y{constructor(e){super(e)}},pf=[0,Hr,-1,Le],iv=class extends Y{constructor(e){super(e)}},ff=class extends Y{constructor(e){super(e)}},Gl=[1,2,3,4,5,6,7,8,9,10,14,15],cg=class extends Y{constructor(e){super(e)}};cg.prototype.g=la([0,st,[0,Gl,Ee,Ws,Ee,[0,Ws,ci],Ee,df,Ee,[0,df,ci],Ee,pf,Ee,[0,Hr,-3,Le,tr],Ee,[0,Hr,-3,Le],Ee,[0,we,Hr,-2,Le,$e,Le,-1,2,Hr,ci],Ee,uf,Ee,[0,uf,ci],Hr,ci,we,Ee,[0,Hr,-3,Le,ci,-1],Ee,[0,st,pf]],we,[0,we,$e,-1,Le]]);var Pr=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect_in",!1),this.outputCategoryMask=!1,this.outputConfidenceMasks=!0,this.h=new zh,this.s=new Hm,ne(this.h,0,3,this.s),ne(e=this.h,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"outputCategoryMask"in e&&(this.outputCategoryMask=e.outputCategoryMask??!1),"outputConfidenceMasks"in e&&(this.outputConfidenceMasks=e.outputConfidenceMasks??!0),super.l(e)}segment(e,t,r,n){let i=typeof r!="function"?r:{};this.j=typeof r=="function"?r:n,this.qualityScores=this.categoryMask=this.confidenceMasks=void 0,r=this.B+1,n=new cg;let o=new ff;var s=new nv;if(Br(s,1,255),ne(o,0,12,s),t.keypoint&&t.scribble)throw Error("Cannot provide both keypoint and scribble.");if(t.keypoint){var a=new Al;Eo(a,3,!0),Z(a,1,t.keypoint.x),Z(a,2,t.keypoint.y),vo(o,5,Gl,a)}else{if(!t.scribble)throw Error("Must provide either a keypoint or a scribble.");for(a of(s=new iv,t.scribble))Eo(t=new Al,3,!0),Z(t,1,a.x),Z(t,2,a.y),zs(s,1,Al,t);vo(o,15,Gl,s)}zs(n,1,ff,o),this.g.addProtoToStream(n.g(),"drishti.RenderData","roi_in",r),nr(this,e,i);e:{try{let l=new $l(this.confidenceMasks,this.categoryMask,this.qualityScores);if(!this.j){var c=l;break e}this.j(l)}finally{fa(this)}c=void 0}return c}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"roi_in"),Oe(e,"norm_rect_in");let t=new Nt;fr(t,$m,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.interactive_segmenter.InteractiveSegmenterGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"ROI:roi_in"),Pe(r,"NORM_RECT:norm_rect_in"),r.o(t),Vt(e,r),pa(this,e),this.outputConfidenceMasks&&(be(e,"confidence_masks"),me(r,"CONFIDENCE_MASKS:confidence_masks"),wi(this,"confidence_masks"),this.g.ca("confidence_masks",((n,i)=>{this.confidenceMasks=n.map((o=>Ei(this,o,!0,!this.j))),X(this,i)})),this.g.attachEmptyPacketListener("confidence_masks",(n=>{this.confidenceMasks=[],X(this,n)}))),this.outputCategoryMask&&(be(e,"category_mask"),me(r,"CATEGORY_MASK:category_mask"),wi(this,"category_mask"),this.g.U("category_mask",((n,i)=>{this.categoryMask=Ei(this,n,!1,!this.j),X(this,i)})),this.g.attachEmptyPacketListener("category_mask",(n=>{this.categoryMask=void 0,X(this,n)}))),be(e,"quality_scores"),me(r,"QUALITY_SCORES:quality_scores"),this.g.attachFloatVectorListener("quality_scores",((n,i)=>{this.qualityScores=n,X(this,i)})),this.g.attachEmptyPacketListener("quality_scores",(n=>{this.categoryMask=void 0,X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Pr.prototype.segment=Pr.prototype.segment,Pr.prototype.setOptions=Pr.prototype.o,Pr.createFromModelPath=function(e,t){return fe(Pr,e,{baseOptions:{modelAssetPath:t}})},Pr.createFromModelBuffer=function(e,t){return fe(Pr,e,{baseOptions:{modelAssetBuffer:t}})},Pr.createFromOptions=function(e,t){return fe(Pr,e,t)};var At=class extends It{constructor(e,t){super(new rr(e,t),"input_frame_gpu","norm_rect",!1),this.j={detections:[]},ne(e=this.h=new Gm,0,1,t=new Fe)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return e.displayNamesLocale!==void 0?Re(this.h,2,Ai(e.displayNamesLocale)):"displayNamesLocale"in e&&Re(this.h,2),e.maxResults!==void 0?Br(this.h,3,e.maxResults):"maxResults"in e&&Re(this.h,3),e.scoreThreshold!==void 0?Z(this.h,4,e.scoreThreshold):"scoreThreshold"in e&&Re(this.h,4),e.categoryAllowlist!==void 0?js(this.h,5,e.categoryAllowlist):"categoryAllowlist"in e&&Re(this.h,5),e.categoryDenylist!==void 0?js(this.h,6,e.categoryDenylist):"categoryDenylist"in e&&Re(this.h,6),this.l(e)}D(e,t){return this.j={detections:[]},nr(this,e,t),this.j}F(e,t,r){return this.j={detections:[]},Or(this,e,r,t),this.j}m(){var e=new Rt;Oe(e,"input_frame_gpu"),Oe(e,"norm_rect"),be(e,"detections");let t=new Nt;fr(t,Xb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.ObjectDetectorGraph"),Pe(r,"IMAGE:input_frame_gpu"),Pe(r,"NORM_RECT:norm_rect"),me(r,"DETECTIONS:detections"),r.o(t),Vt(e,r),this.g.attachProtoVectorListener("detections",((n,i)=>{for(let o of n)n=Sm(o),this.j.detections.push(Km(n));X(this,i)})),this.g.attachEmptyPacketListener("detections",(n=>{X(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};At.prototype.detectForVideo=At.prototype.F,At.prototype.detect=At.prototype.D,At.prototype.setOptions=At.prototype.o,At.createFromModelPath=async function(e,t){return fe(At,e,{baseOptions:{modelAssetPath:t}})},At.createFromModelBuffer=function(e,t){return fe(At,e,{baseOptions:{modelAssetBuffer:t}})},At.createFromOptions=function(e,t){return fe(At,e,t)};var ql=class{constructor(e,t,r){this.landmarks=e,this.worldLandmarks=t,this.segmentationMasks=r}close(){this.segmentationMasks?.forEach((e=>{e.close()}))}};function mf(e){e.landmarks=[],e.worldLandmarks=[],e.segmentationMasks=void 0}function gf(e){try{let t=new ql(e.landmarks,e.worldLandmarks,e.segmentationMasks);if(!e.s)return t;e.s(t)}finally{fa(e)}}ql.prototype.close=ql.prototype.close;var Mt=class extends It{constructor(e,t){super(new rr(e,t),"image_in","norm_rect",!1),this.landmarks=[],this.worldLandmarks=[],this.outputSegmentationMasks=!1,ne(e=this.h=new qm,0,1,t=new Fe),this.v=new Nm,ne(this.h,0,3,this.v),this.j=new Mm,ne(this.h,0,2,this.j),Br(this.j,4,1),Z(this.j,2,.5),Z(this.v,2,.5),Z(this.h,4,.5)}get baseOptions(){return ye(this.h,Fe,1)}set baseOptions(e){ne(this.h,0,1,e)}o(e){return"numPoses"in e&&Br(this.j,4,e.numPoses??1),"minPoseDetectionConfidence"in e&&Z(this.j,2,e.minPoseDetectionConfidence??.5),"minTrackingConfidence"in e&&Z(this.h,4,e.minTrackingConfidence??.5),"minPosePresenceConfidence"in e&&Z(this.v,2,e.minPosePresenceConfidence??.5),"outputSegmentationMasks"in e&&(this.outputSegmentationMasks=e.outputSegmentationMasks??!1),this.l(e)}D(e,t,r){let n=typeof t!="function"?t:{};return this.s=typeof t=="function"?t:r,mf(this),nr(this,e,n),gf(this)}F(e,t,r,n){let i=typeof r!="function"?r:{};return this.s=typeof r=="function"?r:n,mf(this),Or(this,e,i,t),gf(this)}m(){var e=new Rt;Oe(e,"image_in"),Oe(e,"norm_rect"),be(e,"normalized_landmarks"),be(e,"world_landmarks"),be(e,"segmentation_masks");let t=new Nt;fr(t,Jb,this.h);let r=new bt;jt(r,"mediapipe.tasks.vision.pose_landmarker.PoseLandmarkerGraph"),Pe(r,"IMAGE:image_in"),Pe(r,"NORM_RECT:norm_rect"),me(r,"NORM_LANDMARKS:normalized_landmarks"),me(r,"WORLD_LANDMARKS:world_landmarks"),r.o(t),Vt(e,r),pa(this,e),this.g.attachProtoVectorListener("normalized_landmarks",((n,i)=>{this.landmarks=[];for(let o of n)n=Po(o),this.landmarks.push(ua(n));X(this,i)})),this.g.attachEmptyPacketListener("normalized_landmarks",(n=>{this.landmarks=[],X(this,n)})),this.g.attachProtoVectorListener("world_landmarks",((n,i)=>{this.worldLandmarks=[];for(let o of n)n=fi(o),this.worldLandmarks.push(wo(n));X(this,i)})),this.g.attachEmptyPacketListener("world_landmarks",(n=>{this.worldLandmarks=[],X(this,n)})),this.outputSegmentationMasks&&(me(r,"SEGMENTATION_MASK:segmentation_masks"),wi(this,"segmentation_masks"),this.g.ca("segmentation_masks",((n,i)=>{this.segmentationMasks=n.map((o=>Ei(this,o,!0,!this.s))),X(this,i)})),this.g.attachEmptyPacketListener("segmentation_masks",(n=>{this.segmentationMasks=[],X(this,n)}))),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};Mt.prototype.detectForVideo=Mt.prototype.F,Mt.prototype.detect=Mt.prototype.D,Mt.prototype.setOptions=Mt.prototype.o,Mt.createFromModelPath=function(e,t){return fe(Mt,e,{baseOptions:{modelAssetPath:t}})},Mt.createFromModelBuffer=function(e,t){return fe(Mt,e,{baseOptions:{modelAssetBuffer:t}})},Mt.createFromOptions=function(e,t){return fe(Mt,e,t)},Mt.POSE_CONNECTIONS=ag;var Oi=class{constructor(t,r,n,i,o="videoPreviewFrameDetection",s="liveViewFrameDetection"){this.options={onRealtimeAlertsCallback:t=>{}};this.children=[];this.runningMode="VIDEO";this.detecting=!1;this.createdVideo=!1;this.lastVideoTime=-1;this.lastExecutionDate=Date.now();this.detectorType=t,this.modelAssetPath=r,this.classVideo=o,this.classDiv=s,i&&(this.paramsConfig=i),n&&(this.options=n)}async initializeDetector(){let t=await nn.forVisionTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.2/wasm");this.detector=await(this.detectorType==="FaceDetector"?xt:At).createFromOptions(t,{baseOptions:{modelAssetPath:this.modelAssetPath,delegate:"CPU"},scoreThreshold:this.detectorType==="ObjectDetector"?.5:0,runningMode:this.runningMode})}stopDetection(){this.animationFrameId&&clearTimeout(this.animationFrameId),this.detecting=!1,this.liveView=document.getElementById(this.classDiv),this.liveView&&this.classDiv==="liveViewFrameDetection"&&document.body.removeChild(this.liveView),this.createdVideo&&this.video&&document.body.removeChild(this.video),this.createdVideo=!1}enableCam(t,r=1e4){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",`
50
50
  width: 20rem;
51
51
  border-radius: 10px;
52
52
  position: absolute;
@@ -63,33 +63,31 @@ Minimum version required to store current data is: `+o+`.
63
63
  border-radius: 50%;
64
64
  display: block;
65
65
  }
66
- `,document.getElementsByTagName("head")[0].appendChild(i)}async predictWebcam(){if(this.detecting==!1)return;if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectado";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function vg(){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 Lo=class extends Uo{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",t,r,n,i);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1;this.numFacesSent=-1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(t){for(let o of this.children)this.liveView.removeChild(o);this.children.splice(0);let r=this.video;if(r.videoWidth===0||r.videoHeight===0)return;let n=r.offsetWidth/r.videoWidth,i=r.offsetHeight/r.videoHeight;for(let o of t.detections){let s=o.boundingBox,c=(r.videoWidth-s.originX-s.width)*n,l=s.originY*i,d=(s.width-10)*n,h=s.height*i,m=document.createElement("div");m.setAttribute("class","highlighter"),Object.assign(m.style,{right:`${c+20}px`,top:`${l}px`,width:`${d}px`,height:`${h-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let f=document.createElement("p"),g=o.categories[0].score?Math.round(parseFloat(o.categories[0].score)*100):0;if(f.innerText=`Confidence: ${g}%`,Object.assign(f.style,{right:`${c+20}px`,top:`${l-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(m),this.liveView.appendChild(f),this.children.push(m),this.children.push(f),o.keypoints)for(let u of o.keypoints){let b=document.createElement("span");b.className="key-point";let v=u.x<2?u.x*r.videoWidth:u.x,k=u.y<2?u.y*r.videoHeight:u.y,I=(r.videoWidth-v)*n,x=k*i;Object.assign(b.style,{right:`${I+20}px`,top:`${x-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(b),this.children.push(b)}}}verify(t){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&t.detections.length!==this.numFacesSent)if(this.numFacesSent=t.detections.length,t.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(t.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(t.detections.length===0)return;let r=!1,n=document.getElementById(this.classVideo),i=n.videoWidth,o=n.videoHeight,s=t.detections[0],a=s.boundingBox,c=s.keypoints,l=c[0],d=c[1],h=c[3],m=c[4],f=c[5],g=c[2];i>o&&(a.height/o>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),r=!0,this.emmitedPositionAlert=!0):a.width/i>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0));let u=[a.originX,a.originY],b=[a.originX+a.width,a.originY+a.height];(u[0]<.1*a.width||u[1]<.2*a.height||b[0]>i-.1*a.width||b[1]>o-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0);let v=u[0],k=i-b[0],S=u[1],I=o-b[1];v>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0),S>4*I&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0),k>2*v&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0),I>3*S&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,r=!0),r==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};"use strict";function Fo(e,t){return function(){return e.apply(t,arguments)}}"use strict";var{toString:yv}=Object.prototype,{getPrototypeOf:Ud}=Object,Aa=(e=>t=>{let r=yv.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),wr=e=>(e=e.toLowerCase(),t=>Aa(t)===e),Ta=e=>t=>typeof t===e,{isArray:Hi}=Array,Mo=Ta("undefined");function bv(e){return e!==null&&!Mo(e)&&e.constructor!==null&&!Mo(e.constructor)&&Xt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var wg=wr("ArrayBuffer");function vv(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&wg(e.buffer),t}var wv=Ta("string"),Xt=Ta("function"),_g=Ta("number"),Ia=e=>e!==null&&typeof e=="object",_v=e=>e===!0||e===!1,Ra=e=>{if(Aa(e)!=="object")return!1;let t=Ud(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},kv=wr("Date"),Sv=wr("File"),Ev=wr("Blob"),Cv=wr("FileList"),xv=e=>Ia(e)&&Xt(e.pipe),Av=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Xt(e.append)&&((t=Aa(e))==="formdata"||t==="object"&&Xt(e.toString)&&e.toString()==="[object FormData]"))},Tv=wr("URLSearchParams"),[Iv,Rv,Pv,Dv]=["ReadableStream","Request","Response","Headers"].map(wr),Bv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function No(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e=="undefined")return;let n,i;if(typeof e!="object"&&(e=[e]),Hi(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function kg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Kn=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Sg=e=>!Mo(e)&&e!==Kn;function Ld(){let{caseless:e}=Sg(this)&&this||{},t={},r=(n,i)=>{let o=e&&kg(t,i)||i;Ra(t[o])&&Ra(n)?t[o]=Ld(t[o],n):Ra(n)?t[o]=Ld({},n):Hi(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&No(arguments[n],r);return t}var Ov=(e,t,r,{allOwnKeys:n}={})=>(No(t,(i,o)=>{r&&Xt(i)?e[o]=Fo(i,r):e[o]=i},{allOwnKeys:n}),e),Uv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Lv=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Fv=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Ud(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},Mv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Nv=e=>{if(!e)return null;if(Hi(e))return e;let t=e.length;if(!_g(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},jv=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&Ud(Uint8Array)),zv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Vv=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Hv=wr("HTMLFormElement"),Wv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),Eg=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),$v=wr("RegExp"),Cg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};No(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Gv=e=>{Cg(e,(t,r)=>{if(Xt(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(!!Xt(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},qv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Hi(e)?n(e):n(String(e).split(t)),r},Kv=()=>{},Xv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Jv(e){return!!(e&&Xt(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Yv=e=>{let t=new Array(10),r=(n,i)=>{if(Ia(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Hi(n)?[]:{};return No(n,(s,a)=>{let c=r(s,i+1);!Mo(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},Zv=wr("AsyncFunction"),Qv=e=>e&&(Ia(e)||Xt(e))&&Xt(e.then)&&Xt(e.catch),xg=((e,t)=>e?setImmediate:t?((r,n)=>(Kn.addEventListener("message",({source:i,data:o})=>{i===Kn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Kn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Xt(Kn.postMessage)),ew=typeof queueMicrotask!="undefined"?queueMicrotask.bind(Kn):typeof process!="undefined"&&process.nextTick||xg,T={isArray:Hi,isArrayBuffer:wg,isBuffer:bv,isFormData:Av,isArrayBufferView:vv,isString:wv,isNumber:_g,isBoolean:_v,isObject:Ia,isPlainObject:Ra,isReadableStream:Iv,isRequest:Rv,isResponse:Pv,isHeaders:Dv,isUndefined:Mo,isDate:kv,isFile:Sv,isBlob:Ev,isRegExp:$v,isFunction:Xt,isStream:xv,isURLSearchParams:Tv,isTypedArray:jv,isFileList:Cv,forEach:No,merge:Ld,extend:Ov,trim:Bv,stripBOM:Uv,inherits:Lv,toFlatObject:Fv,kindOf:Aa,kindOfTest:wr,endsWith:Mv,toArray:Nv,forEachEntry:zv,matchAll:Vv,isHTMLForm:Hv,hasOwnProperty:Eg,hasOwnProp:Eg,reduceDescriptors:Cg,freezeMethods:Gv,toObjectSet:qv,toCamelCase:Wv,noop:Kv,toFiniteNumber:Xv,findKey:kg,global:Kn,isContextDefined:Sg,isSpecCompliantForm:Jv,toJSONObject:Yv,isAsyncFn:Zv,isThenable:Qv,setImmediate:xg,asap:ew};"use strict";function Wi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Wi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var Ag=Wi.prototype,Tg={};["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=>{Tg[e]={value:e}});Object.defineProperties(Wi,Tg);Object.defineProperty(Ag,"isAxiosError",{value:!0});Wi.from=(e,t,r,n,i,o)=>{let s=Object.create(Ag);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Wi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var de=Wi;var Pa=null;"use strict";function Fd(e){return T.isPlainObject(e)||T.isArray(e)}function Ig(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function Rg(e,t,r){return e?e.concat(t).map(function(i,o){return i=Ig(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function tw(e){return T.isArray(e)&&!e.some(Fd)}var rw=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function nw(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(Pa||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,b){return!T.isUndefined(b[u])});let n=r.metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob!="undefined"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(g){if(g===null)return"";if(T.isDate(g))return g.toISOString();if(!c&&T.isBlob(g))throw new de("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(g)||T.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,u,b){let v=g;if(g&&!b&&typeof g=="object"){if(T.endsWith(u,"{}"))u=n?u:u.slice(0,-2),g=JSON.stringify(g);else if(T.isArray(g)&&tw(g)||(T.isFileList(g)||T.endsWith(u,"[]"))&&(v=T.toArray(g)))return u=Ig(u),v.forEach(function(S,I){!(T.isUndefined(S)||S===null)&&t.append(s===!0?Rg([u],I,o):s===null?u:u+"[]",l(S))}),!1}return Fd(g)?!0:(t.append(Rg(b,u,o),l(g)),!1)}let h=[],m=Object.assign(rw,{defaultVisitor:d,convertValue:l,isVisitable:Fd});function f(g,u){if(!T.isUndefined(g)){if(h.indexOf(g)!==-1)throw Error("Circular reference detected in "+u.join("."));h.push(g),T.forEach(g,function(v,k){(!(T.isUndefined(v)||v===null)&&i.call(t,v,T.isString(k)?k.trim():k,u,m))===!0&&f(v,u?u.concat(k):[k])}),h.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return f(e),t}var wn=nw;"use strict";function Pg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Dg(e,t){this._pairs=[],e&&wn(e,this,t)}var Bg=Dg.prototype;Bg.append=function(t,r){this._pairs.push([t,r])};Bg.toString=function(t){let r=t?function(n){return t.call(this,n,Pg)}:Pg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var Da=Dg;"use strict";function iw(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function jo(e,t,r){if(!t)return e;let n=r&&r.encode||iw;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new Da(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}"use strict";var Og=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},Md=Og;"use strict";var Ba={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};"use strict";var Ug=typeof URLSearchParams!="undefined"?URLSearchParams:Da;"use strict";var Lg=typeof FormData!="undefined"?FormData:null;"use strict";var Fg=typeof Blob!="undefined"?Blob:null;var Mg={isBrowser:!0,classes:{URLSearchParams:Ug,FormData:Lg,Blob:Fg},protocols:["http","https","file","blob","url","data"]};var Nd={};Wy(Nd,{hasBrowserEnv:()=>jd,hasStandardBrowserEnv:()=>ow,hasStandardBrowserWebWorkerEnv:()=>sw,navigator:()=>zd,origin:()=>aw});var jd=typeof window!="undefined"&&typeof document!="undefined",zd=typeof navigator=="object"&&navigator||void 0,ow=jd&&(!zd||["ReactNative","NativeScript","NS"].indexOf(zd.product)<0),sw=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),aw=jd&&window.location.href||"http://localhost";var Ve={...Nd,...Mg};"use strict";function Vd(e,t){return wn(e,new Ve.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return Ve.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}"use strict";function cw(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function lw(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function dw(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=lw(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t(cw(n),i,r,0)}),r}return null}var Oa=dw;"use strict";function hw(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Hd={transitional:Ba,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(Oa(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Vd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return wn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),hw(t)):t}],transformResponse:[function(t){let r=this.transitional||Hd.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?de.from(a,de.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:Ve.classes.FormData,Blob:Ve.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{Hd.headers[e]={}});var $i=Hd;"use strict";var uw=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ng=e=>{let t={},r,n,i;return e&&e.split(`
67
- `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&uw[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};"use strict";var jg=Symbol("internals");function zo(e){return e&&String(e).trim().toLowerCase()}function Ua(e){return e===!1||e==null?e:T.isArray(e)?e.map(Ua):String(e)}function pw(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var fw=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Wd(e,t,r,n,i){if(T.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!T.isString(t)){if(T.isString(n))return t.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(t)}}function mw(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function gw(e,t){let r=T.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}var Vo=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(a,c,l){let d=zo(c);if(!d)throw new Error("header name must be a non-empty string");let h=T.findKey(i,d);(!h||i[h]===void 0||l===!0||l===void 0&&i[h]!==!1)&&(i[h||c]=Ua(a))}let s=(a,c)=>T.forEach(a,(l,d)=>o(l,d,c));if(T.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(T.isString(t)&&(t=t.trim())&&!fw(t))s(Ng(t),r);else if(T.isHeaders(t))for(let[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=zo(t),t){let n=T.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return pw(i);if(T.isFunction(r))return r.call(this,i,n);if(T.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=zo(t),t){let n=T.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Wd(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(s){if(s=zo(s),s){let a=T.findKey(n,s);a&&(!r||Wd(n,n[a],a,r))&&(delete n[a],i=!0)}}return T.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||Wd(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return T.forEach(this,(i,o)=>{let s=T.findKey(n,o);if(s){r[s]=Ua(i),delete r[o];return}let a=t?mw(o):String(o).trim();a!==o&&delete r[o],r[a]=Ua(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&T.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
68
- `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[jg]=this[jg]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=zo(s);n[a]||(gw(i,s),n[a]=!0)}return T.isArray(t)?t.forEach(o):o(t),this}};Vo.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Vo.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});T.freezeMethods(Vo);var lt=Vo;"use strict";function Ho(e,t){let r=this||$i,n=t||r,i=lt.from(n.headers),o=n.data;return T.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}"use strict";function Wo(e){return!!(e&&e.__CANCEL__)}"use strict";function zg(e,t,r){de.call(this,e??"canceled",de.ERR_CANCELED,t,r),this.name="CanceledError"}T.inherits(zg,de,{__CANCEL__:!0});var Mr=zg;"use strict";function $o(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new de("Request failed with status code "+r.status,[de.ERR_BAD_REQUEST,de.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}"use strict";function $d(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}"use strict";function yw(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),d=n[o];s||(s=l),r[i]=c,n[i]=l;let h=o,m=0;for(;h!==i;)m+=r[h++],h=h%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;let f=d&&l-d;return f?Math.round(m*1e3/f):void 0}}var Vg=yw;function bw(e,t){let r=0,n=1e3/t,i,o,s=(l,d=Date.now())=>{r=d,i=null,o&&(clearTimeout(o),o=null),e.apply(null,l)};return[(...l)=>{let d=Date.now(),h=d-r;h>=n?s(l,d):(i=l,o||(o=setTimeout(()=>{o=null,s(i)},n-h)))},()=>i&&s(i)]}var Hg=bw;var Gi=(e,t,r=3)=>{let n=0,i=Vg(50,250);return Hg(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,l=i(c),d=s<=a;n=s;let h={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&d?(a-s)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(h)},r)},Gd=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},qd=e=>(...t)=>T.asap(()=>e(...t));var Wg=Ve.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Ve.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Ve.origin),Ve.navigator&&/(msie|trident)/i.test(Ve.navigator.userAgent)):()=>!0;var $g=Ve.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];T.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),T.isString(n)&&s.push("path="+n),T.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};"use strict";function Kd(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}"use strict";function Xd(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}"use strict";function Go(e,t,r){let n=!Kd(t);return e&&(n||r==!1)?Xd(e,t):t}"use strict";var Gg=e=>e instanceof lt?{...e}:e;function _r(e,t){t=t||{};let r={};function n(l,d,h,m){return T.isPlainObject(l)&&T.isPlainObject(d)?T.merge.call({caseless:m},l,d):T.isPlainObject(d)?T.merge({},d):T.isArray(d)?d.slice():d}function i(l,d,h,m){if(T.isUndefined(d)){if(!T.isUndefined(l))return n(void 0,l,h,m)}else return n(l,d,h,m)}function o(l,d){if(!T.isUndefined(d))return n(void 0,d)}function s(l,d){if(T.isUndefined(d)){if(!T.isUndefined(l))return n(void 0,l)}else return n(void 0,d)}function a(l,d,h){if(h in t)return n(l,d);if(h in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,d,h)=>i(Gg(l),Gg(d),h,!0)};return T.forEach(Object.keys(Object.assign({},e,t)),function(d){let h=c[d]||i,m=h(e[d],t[d],d);T.isUndefined(m)&&h!==a||(r[d]=m)}),r}var La=e=>{let t=_r({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=lt.from(s),t.url=jo(Go(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(r)){if(Ve.hasStandardBrowserEnv||Ve.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...d]=c?c.split(";").map(h=>h.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...d].join("; "))}}if(Ve.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(t)),n||n!==!1&&Wg(t.url))){let l=i&&o&&$g.read(o);l&&s.set(i,l)}return t};var vw=typeof XMLHttpRequest!="undefined",qg=vw&&function(e){return new Promise(function(r,n){let i=La(e),o=i.data,s=lt.from(i.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,d,h,m,f,g;function u(){f&&f(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function v(){if(!b)return;let S=lt.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:S,config:e,request:b};$o(function(P){r(P),u()},function(P){n(P),u()},x),b=null}"onloadend"in b?b.onloadend=v:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(v)},b.onabort=function(){!b||(n(new de("Request aborted",de.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new de("Network Error",de.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let I=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",x=i.transitional||Ba;i.timeoutErrorMessage&&(I=i.timeoutErrorMessage),n(new de(I,x.clarifyTimeoutError?de.ETIMEDOUT:de.ECONNABORTED,e,b)),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&T.forEach(s.toJSON(),function(I,x){b.setRequestHeader(x,I)}),T.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),l&&([m,g]=Gi(l,!0),b.addEventListener("progress",m)),c&&b.upload&&([h,f]=Gi(c),b.upload.addEventListener("progress",h),b.upload.addEventListener("loadend",f)),(i.cancelToken||i.signal)&&(d=S=>{!b||(n(!S||S.type?new Mr(null,e,b):S),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));let k=$d(i.url);if(k&&Ve.protocols.indexOf(k)===-1){n(new de("Unsupported protocol "+k+":",de.ERR_BAD_REQUEST,e));return}b.send(o||null)})};var ww=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,a();let d=l instanceof Error?l:this.reason;n.abort(d instanceof de?d:new Mr(d instanceof Error?d.message:d))}},s=t&&setTimeout(()=>{s=null,o(new de(`timeout ${t} of ms exceeded`,de.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>T.asap(a),c}},Kg=ww;var _w=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},Sw=async function*(e,t){for await(let r of kw(e))yield*_w(r,t)},kw=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},Jd=(e,t,r,n)=>{let i=Sw(e,t),o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:d}=await i.next();if(l){a(),c.close();return}let h=d.byteLength;if(r){let m=o+=h;r(m)}c.enqueue(new Uint8Array(d))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};var Fa=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Xg=Fa&&typeof ReadableStream=="function",Ew=Fa&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Jg=(e,...t)=>{try{return!!e(...t)}catch(r){return!1}},Cw=Xg&&Jg(()=>{let e=!1,t=new Request(Ve.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Yg=64*1024,Yd=Xg&&Jg(()=>T.isReadableStream(new Response("").body)),Ma={stream:Yd&&(e=>e.body)};Fa&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ma[t]&&(Ma[t]=T.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new de(`Response type '${t}' is not supported`,de.ERR_NOT_SUPPORT,n)})})})(new Response);var xw=async e=>{if(e==null)return 0;if(T.isBlob(e))return e.size;if(T.isSpecCompliantForm(e))return(await new Request(Ve.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(T.isArrayBufferView(e)||T.isArrayBuffer(e))return e.byteLength;if(T.isURLSearchParams(e)&&(e=e+""),T.isString(e))return(await Ew(e)).byteLength},Aw=async(e,t)=>{let r=T.toFiniteNumber(e.getContentLength());return r??xw(t)},Zg=Fa&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:d,withCredentials:h="same-origin",fetchOptions:m}=La(e);l=l?(l+"").toLowerCase():"text";let f=Kg([i,o&&o.toAbortSignal()],s),g,u=f&&f.unsubscribe&&(()=>{f.unsubscribe()}),b;try{if(c&&Cw&&r!=="get"&&r!=="head"&&(b=await Aw(d,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),B;if(T.isFormData(n)&&(B=x.headers.get("content-type"))&&d.setContentType(B),x.body){let[P,M]=Gd(b,Gi(qd(c)));n=Jd(x.body,Yg,P,M)}}T.isString(h)||(h=h?"include":"omit");let v="credentials"in Request.prototype;g=new Request(t,{...m,signal:f,method:r.toUpperCase(),headers:d.normalize().toJSON(),body:n,duplex:"half",credentials:v?h:void 0});let k=await fetch(g),S=Yd&&(l==="stream"||l==="response");if(Yd&&(a||S&&u)){let x={};["status","statusText","headers"].forEach(J=>{x[J]=k[J]});let B=T.toFiniteNumber(k.headers.get("content-length")),[P,M]=a&&Gd(B,Gi(qd(a),!0))||[];k=new Response(Jd(k.body,Yg,P,()=>{M&&M(),u&&u()}),x)}l=l||"text";let I=await Ma[T.findKey(Ma,l)||"text"](k,e);return!S&&u&&u(),await new Promise((x,B)=>{$o(x,B,{data:I,headers:lt.from(k.headers),status:k.status,statusText:k.statusText,config:e,request:g})})}catch(v){throw u&&u(),v&&v.name==="TypeError"&&/fetch/i.test(v.message)?Object.assign(new de("Network Error",de.ERR_NETWORK,e,g),{cause:v.cause||v}):de.from(v,v&&v.code,e,g)}});var Zd={http:Pa,xhr:qg,fetch:Zg};T.forEach(Zd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(r){}Object.defineProperty(e,"adapterName",{value:t})}});var Qg=e=>`- ${e}`,Tw=e=>T.isFunction(e)||e===null||e===!1,Na={getAdapter:e=>{e=T.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!Tw(r)&&(n=Zd[(s=String(r)).toLowerCase()],n===void 0))throw new de(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?o.length>1?`since :
69
- `+o.map(Qg).join(`
70
- `):" "+Qg(o[0]):"as no adapter specified";throw new de("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:Zd};"use strict";function Qd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mr(null,e)}function ja(e){return Qd(e),e.headers=lt.from(e.headers),e.data=Ho.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Na.getAdapter(e.adapter||$i.adapter)(e).then(function(n){return Qd(e),n.data=Ho.call(e,e.transformResponse,n),n.headers=lt.from(n.headers),n},function(n){return Wo(n)||(Qd(e),n&&n.response&&(n.response.data=Ho.call(e,e.transformResponse,n.response),n.response.headers=lt.from(n.response.headers))),Promise.reject(n)})}var za="1.8.4";"use strict";var Va={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Va[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var e0={};Va.transitional=function(t,r,n){function i(o,s){return"[Axios v"+za+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(t===!1)throw new de(i(s," has been removed"+(r?" in "+r:"")),de.ERR_DEPRECATED);return r&&!e0[s]&&(e0[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,a):!0}};Va.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function Iw(e,t,r){if(typeof e!="object")throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let o=n[i],s=t[o];if(s){let a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new de("option "+o+" must be "+c,de.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new de("Unknown option "+o,de.ERR_BAD_OPTION)}}var qo={assertOptions:Iw,validators:Va};"use strict";var Nr=qo.validators,Ko=class{constructor(t){this.defaults=t,this.interceptors={request:new Md,response:new Md}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
71
- `+o):n.stack=o}catch(s){}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=_r(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&qo.assertOptions(n,{silentJSONParsing:Nr.transitional(Nr.boolean),forcedJSONParsing:Nr.transitional(Nr.boolean),clarifyTimeoutError:Nr.transitional(Nr.boolean)},!1),i!=null&&(T.isFunction(i)?r.paramsSerializer={serialize:i}:qo.assertOptions(i,{encode:Nr.function,serialize:Nr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),qo.assertOptions(r,{baseUrl:Nr.spelling("baseURL"),withXsrfToken:Nr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&T.merge(o.common,o[r.method]);o&&T.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),r.headers=lt.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(r)===!1||(c=c&&u.synchronous,a.unshift(u.fulfilled,u.rejected))});let l=[];this.interceptors.response.forEach(function(u){l.push(u.fulfilled,u.rejected)});let d,h=0,m;if(!c){let g=[ja.bind(this),void 0];for(g.unshift.apply(g,a),g.push.apply(g,l),m=g.length,d=Promise.resolve(r);h<m;)d=d.then(g[h++],g[h++]);return d}m=a.length;let f=r;for(h=0;h<m;){let g=a[h++],u=a[h++];try{f=g(f)}catch(b){u.call(this,b);break}}try{d=ja.call(this,f)}catch(g){return Promise.reject(g)}for(h=0,m=l.length;h<m;)d=d.then(l[h++],l[h++]);return d}getUri(t){t=_r(this.defaults,t);let r=Go(t.baseURL,t.url,t.allowAbsoluteUrls);return jo(r,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){Ko.prototype[t]=function(r,n){return this.request(_r(n||{},{method:t,url:r,data:(n||{}).data}))}});T.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(_r(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}Ko.prototype[t]=r(),Ko.prototype[t+"Form"]=r(!0)});var Xo=Ko;"use strict";var Ha=class{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new Mr(o,s,a),r(n.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)}toAbortSignal(){let t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new Ha(function(i){t=i}),cancel:t}}},t0=Ha;"use strict";function eh(e){return function(r){return e.apply(null,r)}}"use strict";function th(e){return T.isObject(e)&&e.isAxiosError===!0}var rh={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(rh).forEach(([e,t])=>{rh[t]=e});var r0=rh;"use strict";function n0(e){let t=new Xo(e),r=Fo(Xo.prototype.request,t);return T.extend(r,Xo.prototype,t,{allOwnKeys:!0}),T.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return n0(_r(e,i))},r}var it=n0($i);it.Axios=Xo;it.CanceledError=Mr;it.CancelToken=t0;it.isCancel=Wo;it.VERSION=za;it.toFormData=wn;it.AxiosError=de;it.Cancel=it.CanceledError;it.all=function(t){return Promise.all(t)};it.spread=eh;it.isAxiosError=th;it.mergeConfig=_r;it.AxiosHeaders=lt;it.formToJSON=e=>Oa(T.isHTMLForm(e)?new FormData(e):e);it.getAdapter=Na.getAdapter;it.HttpStatusCode=r0;it.default=it;var kr=it;var Rw="https://proctoring-api-dev.easyproctor.tech/api",Pw="https://proctoring-api-hml.easyproctor.tech/api",i0="https://proctoring-api.easyproctor.tech/api",Dw="https://easyproctor-realtime-api-dev.easyproctor.tech/api",Bw="https://easyproctor-realtime-api-hml.easyproctor.tech/api",Ow="https://easyproctor-realtime-api.easyproctor.tech/api",Sr=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type,t.isRealtime),this.token=t.token}getBaseUrl(){return this.baseUrl}selectBaseUrl(t,r){return r?t==="dev"?Dw:t==="homol"?Bw:Ow:t==="dev"?Rw:t==="homol"?Pw:i0}setRealtime(t){this.baseUrl=this.selectBaseUrl(this.options.type,t)}getSocketUrl(){return this.baseUrl.replace("/api","/hub/sockethub")}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async externalCameraRegister(t){return await this.makeRequest({path:"/ExternalCamera/register",method:"POST",body:t,jwt:this.token})}async externalCameraCheckTransmission(t){return await this.makeRequest({path:`/ExternalCamera/send-action/${t}`,method:"POST",body:{command:"Check_Transmission"},jwt:this.token})}async externalCameraStartTransmission(t,r){return await this.makeRequest({path:`/ExternalCamera/start-transmission/${t}`,method:"POST",body:{proctoringId:r},jwt:this.token})}async externalCameraStartSession(){return await this.makeRequest({path:"/ExternalCamera/start-session",method:"POST",body:{},jwt:this.token})}async goToExternalCameraPositionStep(t){return await this.makeRequest({path:`/ExternalCamera/go-to-position-step/${t}`,method:"POST",body:{},jwt:this.token})}async externalCameraFinish(t){return await this.makeRequest({path:`/ExternalCamera/finish/${t}`,method:"POST",body:{},jwt:this.token})}async confirmStart(t,r,n,i){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r.proctoringType,latitude:n,longitude:i,captureScreen:r.captureScreen},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(n=>{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,n){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${n}/${r.name}`,contentType:r.type}})).data}async initiateUpload(t,r,n){return(await this.makeRequestAxios({path:"/upload/initiate-upload",method:"POST",jwt:t,body:{objectName:r,contentType:n}})).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){return 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 n;return r?.success!==null&&r?.success!==void 0?n=r.success?"4":"1":n="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:n,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 startChallenge(t){return(await this.makeRequestAxios({path:"/Challenge/start",method:"POST",jwt:this.token,body:t})).data}async stopChallenge(t,r){return(await this.makeRequestAxios({path:`/Challenge/stop/${t}`,method:"POST",jwt:this.token,body:r})).data}async startRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/start-warning",method:"POST",jwt:this.token,body:t})).data}async stopRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/stop-warning",method:"POST",jwt:this.token,body:t})).data}async verifyFace(t,r,n){return(await this.makeRequestAxios({path:"/Realtime/verify-face",method:"POST",jwt:this.token,body:{proctoringId:t,base64:r,retry:n}})).data}async checkUpload(t,r,n){try{return(await this.makeRequestAxios({path:"/Upload/check",method:"POST",jwt:t,body:{objectName:r,contentType:n}})).data===!0}catch(i){return!1}}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:n,body:i,jwt:o}=t,s=await fetch(this.baseUrl+r,{method:n,body:i!=null?JSON.stringify(i):void 0,headers:{Authorization:`Bearer ${o}`,"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:n,body:i,jwt:o}=t,s=await kr.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});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:n,body:i,jwt:o}=t,s=await fetch(r,{method:n,body:i!=null?JSON.stringify(i):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 qi;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ROUTER=1]="ROUTER",e[e.CLIENT_DEVICE=2]="CLIENT_DEVICE",e[e.POTENCIAL_CAMERA=3]="POTENCIAL_CAMERA"})(qi||(qi={}));var nh=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:n}){let i=[];return t&&i.push(`deviceType=${t}`),r&&i.push(`rssiThreshold=${r}`),n&&i.push(`packageRateThreshold=${n}`),(await this.makeRequestAxios({path:`/api/usb-device-manager/devices?${i.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:n,body:i,jwt:o}=t,s=await kr.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var jr;(function(e){e.Created="Created",e.Recording="Recording",e.Paused="Paused",e.Ended="Ended",e.EndConfirmed="EndConfirmed",e.Uploaded="Uploaded",e.UploadConfirmed="UploadConfirmed"})(jr||(jr={}));var _n;(function(e){e.none="upload"})(_n||(_n={}));var Ki;(function(e){e.Screen="Screen",e.Mic="Mic",e.Camera="Camera"})(Ki||(Ki={}));var De;(function(e){e[e.NoFace=1]="NoFace",e[e.MultipleFaces=2]="MultipleFaces",e[e.FocusOff=25]="FocusOff",e[e.EnvironmentMultiplePeople=28]="EnvironmentMultiplePeople",e[e.EnvironmentNoPeople=29]="EnvironmentNoPeople",e[e.PotentialCamera=32]="PotentialCamera",e[e.SpyDeviceDisconnected=33]="SpyDeviceDisconnected",e[e.StopSharingScreen=34]="StopSharingScreen",e[e.ChangeDevices=39]="ChangeDevices",e[e.ClipBoardUse=42]="ClipBoardUse",e[e.SplitScreen=43]="SplitScreen",e[e.RealtimeOffline=44]="RealtimeOffline",e[e.System=200]="System"})(De||(De={}));var Xn;(function(e){e[e.Face=0]="Face",e[e.People=1]="People",e[e.LostFocus=2]="LostFocus"})(Xn||(Xn={}));var ft;(function(e){e[e.Audio=1]="Audio",e[e.Video=2]="Video",e[e.Screen=3]="Screen",e[e.Image=4]="Image",e[e.Environment=5]="Environment"})(ft||(ft={}));var Xi=class{constructor(){this.sessionDuration=0;this.state=jr.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=jr.Recording,this.startedAt=new Date(Date.now())}pause(){this.state=jr.Paused}resume(){this.state=jr.Recording}stop(){this.state=jr.Ended,this.sessionDuration=Date.now()-this.startedAt.getTime()}setProctoringId(t){this.id=t}setEndConfirmed(){this.state=jr.EndConfirmed}setUploaded(){this.state=jr.Uploaded}setUploadConfirmed(){this.state=jr.UploadConfirmed}addAlert(t){this.alerts.push(t)}addRecording(t){this.recordings.push(t)}};var Jo=class{constructor(t,r){this.backendService=new nh;this.scanInterval=5;this.options={};this.options=r,this.context=t,this.backend=new Sr({type:t?.type||"prod",token:t.token,isRealtime:!1}),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 n=new Xi;n.setProctoringId(this.proctoringId),n.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:De.SpyDeviceDisconnected,type:ft.Environment}),await this.backend.saveAlerts(this.context,n),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:n}){let i=await this.backendService.Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n});if(i.length>0&&(this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam detected",description:"Dispositivo espi\xE3o detectado.",data:i}),this.proctoringId)){let o=new Xi;o.setProctoringId(this.proctoringId),o.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:De.PotentialCamera,type:ft.Environment}),await this.backend.saveAlerts(this.context,o)}return i}async startCheckSpyCam(t,{deviceType:r,rssiThreshold:n,packageRateThreshold:i}){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:n,packageRateThreshold:i})},this.scanInterval*6e4)}stopCheckSpyCam(){clearInterval(this.checkSpyCam)}};var ar={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1,useSpyScan:!1,useExternalCamera:!1,useChallenge:!1,screenRecorderOptions:{width:1280,height:720}};function Wa(e){return!!e.width&&!!e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var o0={width:1280,height:720,minWidth:640,minHeight:480};function Jn(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}function s0(){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 Er(){if("userAgentData"in navigator){let e=navigator.userAgentData,t=e.mobile||!1,r=e.platform||"";return t||/Android|iOS/i.test(r)}return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)}function $a(){return Jn()!=="1.0.0.0"}var Uw;function Ga(e){Uw=e}function Yo(e,t,r=!1,n,i=!1,o){let s,a,c,l;l=0;let d,h=0,m=0,f={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?f.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),i&&(f={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});function g(M,J){let E=M.getTracks();if(E.length==0)throw new Error("No tracks found");let U=E.find(L=>L.readyState!="live");if(U)throw new Error("Track not live: "+U.label);console.log("buildMediaRecorder tracks OK");let y=new MediaRecorder(M,J);return console.log("buildMediaRecorder mediaRecorder OK"),y.ondataavailable=L=>{l=l+L.data.size,L.data.size>0&&(o?.onChunkAvailable&&(o.onChunkAvailable(L.data,m),m++),t.push(L.data))},y}let u=g(e,f);async function b(M){return new Promise((J,E)=>{let U=!1;M.onstart=()=>{U=!0,console.log("recorder onstart"),d=new Date(Date.now()),J()},M.onerror=y=>{if(console.error("Recorder error event:",y),e.getTracks().forEach(L=>console.log(L.readyState)),"error"in y){let L=y.error;console.error("Error name:",L?.name),console.error("Error message:",L?.message),E(L||y)}else console.warn("Evento sem propriedade error"),E(y)};try{console.log("State antes do start:",M.state),m=0,o?.timeslice&&o?.timeslice>0?M.start(o.timeslice):M.start(1e4),l=0,d=new Date(Date.now())}catch(y){return console.error("Recorder erro ao chamar start event:",y),console.error("Erro real:",y,y?.error,y?.error?.name,y?.error?.message),console.error("Erro real 2:",y,y?.message,y?.name),e.getTracks().forEach(L=>console.log(L.readyState)),E(y)}setTimeout(()=>{U||(console.error("Timeout ao iniciar o recorder"),E(new Error("Timeout ao iniciar o recorder")))},2e3)})}async function v(){try{if(await b(u),u.state==="recording"){l=0;return}else console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start")}catch(M){throw console.error("Erro ao iniciar o recorder:",M),await new Promise(J=>setTimeout(J,300)),M}}function k(){return new Promise(M=>{u.state=="recording"?(console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop"),s=M,u.onstop=()=>{console.log("recorder onstop"),h=Date.now()-d.getTime()||0,console.log("duration no onstop",h),e.getTracks().forEach(J=>{J.stop()}),s&&s()},u.stop(),h=Date.now()-d.getTime()||0,console.log("duration imediatamente ap\xF3s mediaRecorder.stop()",h)):(console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording"),M())})}function S(){return new Promise(M=>{u.state=="recording"&&u.pause(),M()})}function I(){return new Promise(M=>{u.state=="paused"&&u.resume(),M()})}function x(){return l}function B(){return d}function P(){return h}return{startRecording:v,stopRecording:k,pauseRecording:S,resumeRecording:I,recorderOptions:f,getBufferSize:x,getStartTime:B,getDuration:P}}var qa,a0=e=>(qa=e,qa),Lt={DEVICES_CHECKED:"devices_checked",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"},Ft=(e,t)=>qa&&qa.log(e,t),ie={registerDevicesChecked:(e,t,r)=>Ft(Lt.DEVICES_CHECKED,{proctoringId:e,success:t,description:r}),registerStart:(e,t,r)=>Ft(Lt.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>Ft(Lt.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>Ft(Lt.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>Ft(Lt.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,i)=>Ft(Lt.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:i}),registerUploadFile:(e,t,r)=>Ft(Lt.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>Ft(Lt.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>Ft(Lt.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>Ft(Lt.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>Ft(Lt.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>Ft(Lt.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>Ft(Lt.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>Ft(Lt.SAVE_ON_SESSION,{proctoringId:e,description:t})};var kn=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadPackage(t,r){let{file:n}=t;try{console.log("Upload service: uploadPackage");var i="";return await this.backend.getSignedUrl(r,n,this.proctoringId).then(o=>i=o).catch(o=>{throw o}),console.log("Upload service: uploadUrl",i),await kr.request({url:i,method:"PUT",headers:{"Content-Type":n.type,"x-ms-blob-type":"BlockBlob"},data:n}).then(()=>!0).catch(o=>{throw o}),!0}catch(o){throw ie.registerError(this.proctoringId,`Failed to upload package ${o}
66
+ `,document.getElementsByTagName("head")[0].appendChild(i)}async predictWebcam(){if(this.detecting==!1)return;if(this.lastVideoTime===-1&&await this.detector.setOptions({runningMode:"VIDEO"}),Date.now()-this.lastExecutionDate>=1e3){let r=Date.now();if(this.lastExecutionDate=r,this.video.currentTime!==this.lastVideoTime){this.lastVideoTime=this.video.currentTime;let n=this.detector.detectForVideo(this.video,r);this.verify(n)}}this.animationFrameId=setTimeout(()=>{this.predictWebcam()},0)}handleAlert(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.options.onRealtimeAlertsCallback==null&&this.error&&(this.error.innerText=t)}handleOk(t,r){this.options.onRealtimeAlertsCallback&&this.options.onRealtimeAlertsCallback({status:"OK",description:this.alertTranslate(t),type:r,category:t,begin:0,end:0}),this.error&&(this.error.innerText="")}displayVideoDetections(t){}verify(t){}alertTranslate(t){switch(t){case"multiple_faces_detected":return"M\xFAltiplas faces detectadas";case"no_face_detected":return"Nenhuma face encontrada";case"multiple_persons_detected":return"M\xFAltiplas pessoas detectadas";case"no_person_detected":return"Nenhuma pessoa encontrada";case"cellphone_detected":return"Celular detectado";case"wrong_position_face_detected":return"Face na posi\xE7\xE3o errada";case"person_ok":return"Pessoa detectada";case"cellphone_ok":return"Nenhum celular detectado";case"face_ok":return"Face detectada";case"ok_position_face_detected":return"Face na posi\xE7\xE3o correta";case"wrong_face_size_detected":return"Face muito perto da c\xE2mera, afaste-se um pouco mais";case"wrong_face_position_edge_detected":return"Face muito pr\xF3xima da borda, mova-se para o centro da tela";case"wrong_face_position_move_right_detected":return"Face n\xE3o centralizada, mova-se para a direita";case"wrong_face_position_move_left_detected":return"Face n\xE3o centralizada, mova-se para a esquerda";case"wrong_face_position_move_top_detected":return"Face n\xE3o centralizada, mova-se para cima";case"wrong_face_position_move_bottom_detected":return"Face n\xE3o centralizada, mova-se para baixo";case"face_turned_left_detected":return"Face virada para a esquerda, centralize-a";case"face_turned_right_detected":return"Face virada para a direita, centralize-a";case"face_turned_up_detected":return"Face virada para cima, centralize-a";case"face_turned_down_detected":return"Face virada para baixo, centralize-a";default:return t}}};function lg(){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 Ui=class extends Oi{constructor(r,n,i="videoPreviewFrameDetection",o="liveViewFrameDetection"){super("FaceDetector","https://storage.googleapis.com/mediapipe-models/face_detector/blaze_face_short_range/float16/1/blaze_face_short_range.tflite",r,n,i,o);this.emmitedPositionAlert=!1;this.emmitedFaceAlert=!1;this.numFacesSent=-1}stopDetection(){super.stopDetection(),this.emmitedFaceAlert&&this.handleOk("face_stop","face_detection_on_stream")}displayVideoDetections(r){for(let s of this.children)this.liveView.removeChild(s);this.children.splice(0);let n=this.video;if(n.videoWidth===0||n.videoHeight===0)return;let i=n.offsetWidth/n.videoWidth,o=n.offsetHeight/n.videoHeight;for(let s of r.detections){let a=s.boundingBox,l=(n.videoWidth-a.originX-a.width)*i,h=a.originY*o,d=(a.width-10)*i,g=a.height*o,f=document.createElement("div");f.setAttribute("class","highlighter"),Object.assign(f.style,{right:`${l+20}px`,top:`${h}px`,width:`${d}px`,height:`${g-10}px`,zIndex:"1",position:"absolute",border:"1px dashed #fff",background:"rgba(0, 255, 0, 0.25)",transform:"scaleX(-1)"});let m=document.createElement("p"),u=s.categories[0].score?Math.round(parseFloat(s.categories[0].score)*100):0;if(m.innerText=`Confidence: ${u}%`,Object.assign(m.style,{right:`${l+20}px`,top:`${h-50}px`,width:`${d}px`,zIndex:"2",position:"absolute",margin:"0",fontSize:"12px",padding:"5px",color:"#fff",backgroundColor:"#007f8b",textAlign:"center",transform:"scaleX(-1)"}),this.liveView.appendChild(f),this.liveView.appendChild(m),this.children.push(f),this.children.push(m),s.keypoints)for(let b of s.keypoints){let _=document.createElement("span");_.className="key-point";let k=b.x<2?b.x*n.videoWidth:b.x,S=b.y<2?b.y*n.videoHeight:b.y,x=(n.videoWidth-k)*i,D=S*o;Object.assign(_.style,{right:`${x+20}px`,top:`${D-3}px`,position:"absolute",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"red",zIndex:"3"}),this.liveView.appendChild(_),this.children.push(_)}}}verify(r){if(this.paramsConfig.videoBehaviourParameters?.detectFace&&r.detections.length!==this.numFacesSent)if(this.numFacesSent=r.detections.length,r.detections.length===0){this.handleAlert("no_face_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else if(r.detections.length>1){this.handleAlert("multiple_faces_detected","face_detection_on_stream"),this.emmitedFaceAlert=!0;return}else this.handleOk("face_ok","face_detection_on_stream"),this.emmitedFaceAlert=!1;if(r.detections.length===0)return;let n=!1,i=document.getElementById(this.classVideo),o=i.videoWidth,s=i.videoHeight,a=r.detections[0],c=a.boundingBox,l=a.keypoints,h=l[0],d=l[1],g=l[3],f=l[4],m=l[5],u=l[2];o>s&&(c.height/s>.7?(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),n=!0,this.emmitedPositionAlert=!0):c.width/o>.7&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_size_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0));let b=[c.originX,c.originY],_=[c.originX+c.width,c.originY+c.height];(b[0]<.1*c.width||b[1]<.2*c.height||_[0]>o-.1*c.width||_[1]>s-5)&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_edge_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0);let k=b[0],S=o-_[0],I=b[1],x=s-_[1];k>2*S&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_right_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),I>4*x&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_top_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),S>2*k&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_left_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),x>3*I&&(!this.emmitedPositionAlert&&this.handleAlert("wrong_face_position_move_bottom_detected","position_detection_on_stream"),this.emmitedPositionAlert=!0,n=!0),n==!1&&(this.emmitedPositionAlert&&this.handleOk("ok_position_face_detected","position_detection_on_stream"),this.emmitedPositionAlert=!1)}};function Bo(e,t){return function(){return e.apply(t,arguments)}}var{toString:ov}=Object.prototype,{getPrototypeOf:Qh}=Object,ba=(e=>t=>{let r=ov.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),br=e=>(e=e.toLowerCase(),t=>ba(t)===e),va=e=>t=>typeof t===e,{isArray:Li}=Array,Oo=va("undefined");function sv(e){return e!==null&&!Oo(e)&&e.constructor!==null&&!Oo(e.constructor)&&Ht(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var dg=br("ArrayBuffer");function av(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dg(e.buffer),t}var cv=va("string"),Ht=va("function"),ug=va("number"),_a=e=>e!==null&&typeof e=="object",lv=e=>e===!0||e===!1,ya=e=>{if(ba(e)!=="object")return!1;let t=Qh(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},hv=br("Date"),dv=br("File"),uv=br("Blob"),pv=br("FileList"),fv=e=>_a(e)&&Ht(e.pipe),mv=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ht(e.append)&&((t=ba(e))==="formdata"||t==="object"&&Ht(e.toString)&&e.toString()==="[object FormData]"))},gv=br("URLSearchParams"),[yv,bv,vv,_v]=["ReadableStream","Request","Response","Headers"].map(br),wv=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Uo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Li(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{let o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length,a;for(n=0;n<s;n++)a=o[n],t.call(null,e[a],a,e)}}function pg(e,t){t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var Vn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,fg=e=>!Oo(e)&&e!==Vn;function Zh(){let{caseless:e}=fg(this)&&this||{},t={},r=(n,i)=>{let o=e&&pg(t,i)||i;ya(t[o])&&ya(n)?t[o]=Zh(t[o],n):ya(n)?t[o]=Zh({},n):Li(n)?t[o]=n.slice():t[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Uo(arguments[n],r);return t}var Sv=(e,t,r,{allOwnKeys:n}={})=>(Uo(t,(i,o)=>{r&&Ht(i)?e[o]=Bo(i,r):e[o]=i},{allOwnKeys:n}),e),kv=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ev=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},Cv=(e,t,r,n)=>{let i,o,s,a={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=r!==!1&&Qh(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},xv=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},Av=e=>{if(!e)return null;if(Li(e))return e;let t=e.length;if(!ug(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},Tv=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qh(Uint8Array)),Iv=(e,t)=>{let n=(e&&e[Symbol.iterator]).call(e),i;for(;(i=n.next())&&!i.done;){let o=i.value;t.call(e,o[0],o[1])}},Rv=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},Pv=br("HTMLFormElement"),Dv=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),hg=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Bv=br("RegExp"),mg=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};Uo(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},Ov=e=>{mg(e,(t,r)=>{if(Ht(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Ht(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Uv=(e,t)=>{let r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Li(e)?n(e):n(String(e).split(t)),r},Lv=()=>{},Fv=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Mv(e){return!!(e&&Ht(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var Nv=e=>{let t=new Array(10),r=(n,i)=>{if(_a(n)){if(t.indexOf(n)>=0)return;if(!("toJSON"in n)){t[i]=n;let o=Li(n)?[]:{};return Uo(n,(s,a)=>{let c=r(s,i+1);!Oo(c)&&(o[a]=c)}),t[i]=void 0,o}}return n};return r(e,0)},zv=br("AsyncFunction"),jv=e=>e&&(_a(e)||Ht(e))&&Ht(e.then)&&Ht(e.catch),gg=((e,t)=>e?setImmediate:t?((r,n)=>(Vn.addEventListener("message",({source:i,data:o})=>{i===Vn&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),Vn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Ht(Vn.postMessage)),Vv=typeof queueMicrotask<"u"?queueMicrotask.bind(Vn):typeof process<"u"&&process.nextTick||gg,T={isArray:Li,isArrayBuffer:dg,isBuffer:sv,isFormData:mv,isArrayBufferView:av,isString:cv,isNumber:ug,isBoolean:lv,isObject:_a,isPlainObject:ya,isReadableStream:yv,isRequest:bv,isResponse:vv,isHeaders:_v,isUndefined:Oo,isDate:hv,isFile:dv,isBlob:uv,isRegExp:Bv,isFunction:Ht,isStream:fv,isURLSearchParams:gv,isTypedArray:Tv,isFileList:pv,forEach:Uo,merge:Zh,extend:Sv,trim:wv,stripBOM:kv,inherits:Ev,toFlatObject:Cv,kindOf:ba,kindOfTest:br,endsWith:xv,toArray:Av,forEachEntry:Iv,matchAll:Rv,isHTMLForm:Pv,hasOwnProperty:hg,hasOwnProp:hg,reduceDescriptors:mg,freezeMethods:Ov,toObjectSet:Uv,toCamelCase:Dv,noop:Lv,toFiniteNumber:Fv,findKey:pg,global:Vn,isContextDefined:fg,isSpecCompliantForm:Mv,toJSONObject:Nv,isAsyncFn:zv,isThenable:jv,setImmediate:gg,asap:Vv};function Fi(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}T.inherits(Fi,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var yg=Fi.prototype,bg={};["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=>{bg[e]={value:e}});Object.defineProperties(Fi,bg);Object.defineProperty(yg,"isAxiosError",{value:!0});Fi.from=(e,t,r,n,i,o)=>{let s=Object.create(yg);return T.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Fi.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};var le=Fi;var wa=null;function ed(e){return T.isPlainObject(e)||T.isArray(e)}function _g(e){return T.endsWith(e,"[]")?e.slice(0,-2):e}function vg(e,t,r){return e?e.concat(t).map(function(i,o){return i=_g(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function Hv(e){return T.isArray(e)&&!e.some(ed)}var Wv=T.toFlatObject(T,{},null,function(t){return/^is[A-Z]/.test(t)});function $v(e,t,r){if(!T.isObject(e))throw new TypeError("target must be an object");t=t||new(wa||FormData),r=T.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(u,b){return!T.isUndefined(b[u])});let n=r.metaTokens,i=r.visitor||h,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(t);if(!T.isFunction(i))throw new TypeError("visitor must be a function");function l(m){if(m===null)return"";if(T.isDate(m))return m.toISOString();if(!c&&T.isBlob(m))throw new le("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(m)||T.isTypedArray(m)?c&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function h(m,u,b){let _=m;if(m&&!b&&typeof m=="object"){if(T.endsWith(u,"{}"))u=n?u:u.slice(0,-2),m=JSON.stringify(m);else if(T.isArray(m)&&Hv(m)||(T.isFileList(m)||T.endsWith(u,"[]"))&&(_=T.toArray(m)))return u=_g(u),_.forEach(function(S,I){!(T.isUndefined(S)||S===null)&&t.append(s===!0?vg([u],I,o):s===null?u:u+"[]",l(S))}),!1}return ed(m)?!0:(t.append(vg(b,u,o),l(m)),!1)}let d=[],g=Object.assign(Wv,{defaultVisitor:h,convertValue:l,isVisitable:ed});function f(m,u){if(!T.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+u.join("."));d.push(m),T.forEach(m,function(_,k){(!(T.isUndefined(_)||_===null)&&i.call(t,_,T.isString(k)?k.trim():k,u,g))===!0&&f(_,u?u.concat(k):[k])}),d.pop()}}if(!T.isObject(e))throw new TypeError("data must be an object");return f(e),t}var mn=$v;function wg(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function Sg(e,t){this._pairs=[],e&&mn(e,this,t)}var kg=Sg.prototype;kg.append=function(t,r){this._pairs.push([t,r])};kg.toString=function(t){let r=t?function(n){return t.call(this,n,wg)}:wg;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var Sa=Sg;function Gv(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lo(e,t,r){if(!t)return e;let n=r&&r.encode||Gv;T.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,o;if(i?o=i(t,r):o=T.isURLSearchParams(t)?t.toString():new Sa(t,r).toString(n),o){let s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}var td=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){T.forEach(this.handlers,function(n){n!==null&&t(n)})}},rd=td;var ka={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Eg=typeof URLSearchParams<"u"?URLSearchParams:Sa;var Cg=typeof FormData<"u"?FormData:null;var xg=typeof Blob<"u"?Blob:null;var Ag={isBrowser:!0,classes:{URLSearchParams:Eg,FormData:Cg,Blob:xg},protocols:["http","https","file","blob","url","data"]};var od={};Dy(od,{hasBrowserEnv:()=>id,hasStandardBrowserEnv:()=>qv,hasStandardBrowserWebWorkerEnv:()=>Kv,navigator:()=>nd,origin:()=>Xv});var id=typeof window<"u"&&typeof document<"u",nd=typeof navigator=="object"&&navigator||void 0,qv=id&&(!nd||["ReactNative","NativeScript","NS"].indexOf(nd.product)<0),Kv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Xv=id&&window.location.href||"http://localhost";var je={...od,...Ag};function sd(e,t){return mn(e,new je.classes.URLSearchParams,Object.assign({visitor:function(r,n,i,o){return je.isNode&&T.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function Jv(e){return T.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Yv(e){let t={},r=Object.keys(e),n,i=r.length,o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function Zv(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;let a=Number.isFinite(+s),c=o>=r.length;return s=!s&&T.isArray(i)?i.length:s,c?(T.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!T.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&T.isArray(i[s])&&(i[s]=Yv(i[s])),!a)}if(T.isFormData(e)&&T.isFunction(e.entries)){let r={};return T.forEachEntry(e,(n,i)=>{t(Jv(n),i,r,0)}),r}return null}var Ea=Zv;function Qv(e,t,r){if(T.isString(e))try{return(t||JSON.parse)(e),T.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var ad={transitional:ka,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=T.isObject(t);if(o&&T.isHTMLForm(t)&&(t=new FormData(t)),T.isFormData(t))return i?JSON.stringify(Ea(t)):t;if(T.isArrayBuffer(t)||T.isBuffer(t)||T.isStream(t)||T.isFile(t)||T.isBlob(t)||T.isReadableStream(t))return t;if(T.isArrayBufferView(t))return t.buffer;if(T.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return sd(t,this.formSerializer).toString();if((a=T.isFileList(t))||n.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return mn(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),Qv(t)):t}],transformResponse:[function(t){let r=this.transitional||ad.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(T.isResponse(t)||T.isReadableStream(t))return t;if(t&&T.isString(t)&&(n&&!this.responseType||i)){let s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?le.from(a,le.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:je.classes.FormData,Blob:je.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],e=>{ad.headers[e]={}});var Mi=ad;var e_=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Tg=e=>{let t={},r,n,i;return e&&e.split(`
67
+ `).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&e_[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var Ig=Symbol("internals");function Fo(e){return e&&String(e).trim().toLowerCase()}function Ca(e){return e===!1||e==null?e:T.isArray(e)?e.map(Ca):String(e)}function t_(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var r_=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function cd(e,t,r,n,i){if(T.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!T.isString(t)){if(T.isString(n))return t.indexOf(n)!==-1;if(T.isRegExp(n))return n.test(t)}}function n_(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function i_(e,t){let r=T.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}var Ni=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function o(a,c,l){let h=Fo(c);if(!h)throw new Error("header name must be a non-empty string");let d=T.findKey(i,h);(!d||i[d]===void 0||l===!0||l===void 0&&i[d]!==!1)&&(i[d||c]=Ca(a))}let s=(a,c)=>T.forEach(a,(l,h)=>o(l,h,c));if(T.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(T.isString(t)&&(t=t.trim())&&!r_(t))s(Tg(t),r);else if(T.isHeaders(t))for(let[a,c]of t.entries())o(c,a,n);else t!=null&&o(r,t,n);return this}get(t,r){if(t=Fo(t),t){let n=T.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return t_(i);if(T.isFunction(r))return r.call(this,i,n);if(T.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Fo(t),t){let n=T.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||cd(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function o(s){if(s=Fo(s),s){let a=T.findKey(n,s);a&&(!r||cd(n,n[a],a,r))&&(delete n[a],i=!0)}}return T.isArray(t)?t.forEach(o):o(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let o=r[n];(!t||cd(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){let r=this,n={};return T.forEach(this,(i,o)=>{let s=T.findKey(n,o);if(s){r[s]=Ca(i),delete r[o];return}let a=t?n_(o):String(o).trim();a!==o&&delete r[o],r[a]=Ca(i),n[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return T.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&T.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
68
+ `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[Ig]=this[Ig]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Fo(s);n[a]||(i_(i,s),n[a]=!0)}return T.isArray(t)?t.forEach(o):o(t),this}};Ni.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Ni.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});T.freezeMethods(Ni);var at=Ni;function Mo(e,t){let r=this||Mi,n=t||r,i=at.from(n.headers),o=n.data;return T.forEach(e,function(a){o=a.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function No(e){return!!(e&&e.__CANCEL__)}function Rg(e,t,r){le.call(this,e??"canceled",le.ERR_CANCELED,t,r),this.name="CanceledError"}T.inherits(Rg,le,{__CANCEL__:!0});var Ur=Rg;function zo(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new le("Request failed with status code "+r.status,[le.ERR_BAD_REQUEST,le.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function ld(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function o_(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){let l=Date.now(),h=n[o];s||(s=l),r[i]=c,n[i]=l;let d=o,g=0;for(;d!==i;)g+=r[d++],d=d%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;let f=h&&l-h;return f?Math.round(g*1e3/f):void 0}}var Pg=o_;function s_(e,t){let r=0,n=1e3/t,i,o,s=(l,h=Date.now())=>{r=h,i=null,o&&(clearTimeout(o),o=null),e.apply(null,l)};return[(...l)=>{let h=Date.now(),d=h-r;d>=n?s(l,h):(i=l,o||(o=setTimeout(()=>{o=null,s(i)},n-d)))},()=>i&&s(i)]}var Dg=s_;var zi=(e,t,r=3)=>{let n=0,i=Pg(50,250);return Dg(o=>{let s=o.loaded,a=o.lengthComputable?o.total:void 0,c=s-n,l=i(c),h=s<=a;n=s;let d={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&h?(a-s)/l:void 0,event:o,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},r)},hd=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},dd=e=>(...t)=>T.asap(()=>e(...t));var Bg=je.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,je.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(je.origin),je.navigator&&/(msie|trident)/i.test(je.navigator.userAgent)):()=>!0;var Og=je.hasStandardBrowserEnv?{write(e,t,r,n,i,o){let s=[e+"="+encodeURIComponent(t)];T.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),T.isString(n)&&s.push("path="+n),T.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ud(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function pd(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function jo(e,t,r){let n=!ud(t);return e&&(n||r==!1)?pd(e,t):t}var Ug=e=>e instanceof at?{...e}:e;function vr(e,t){t=t||{};let r={};function n(l,h,d,g){return T.isPlainObject(l)&&T.isPlainObject(h)?T.merge.call({caseless:g},l,h):T.isPlainObject(h)?T.merge({},h):T.isArray(h)?h.slice():h}function i(l,h,d,g){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l,d,g)}else return n(l,h,d,g)}function o(l,h){if(!T.isUndefined(h))return n(void 0,h)}function s(l,h){if(T.isUndefined(h)){if(!T.isUndefined(l))return n(void 0,l)}else return n(void 0,h)}function a(l,h,d){if(d in t)return n(l,h);if(d in e)return n(void 0,l)}let c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(l,h,d)=>i(Ug(l),Ug(h),d,!0)};return T.forEach(Object.keys(Object.assign({},e,t)),function(h){let d=c[h]||i,g=d(e[h],t[h],h);T.isUndefined(g)&&d!==a||(r[h]=g)}),r}var xa=e=>{let t=vr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:a}=t;t.headers=s=at.from(s),t.url=Lo(jo(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(r)){if(je.hasStandardBrowserEnv||je.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((c=s.getContentType())!==!1){let[l,...h]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];s.setContentType([l||"multipart/form-data",...h].join("; "))}}if(je.hasStandardBrowserEnv&&(n&&T.isFunction(n)&&(n=n(t)),n||n!==!1&&Bg(t.url))){let l=i&&o&&Og.read(o);l&&s.set(i,l)}return t};var a_=typeof XMLHttpRequest<"u",Lg=a_&&function(e){return new Promise(function(r,n){let i=xa(e),o=i.data,s=at.from(i.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=i,h,d,g,f,m;function u(){f&&f(),m&&m(),i.cancelToken&&i.cancelToken.unsubscribe(h),i.signal&&i.signal.removeEventListener("abort",h)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function _(){if(!b)return;let S=at.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:S,config:e,request:b};zo(function(P){r(P),u()},function(P){n(P),u()},x),b=null}"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(_)},b.onabort=function(){b&&(n(new le("Request aborted",le.ECONNABORTED,e,b)),b=null)},b.onerror=function(){n(new le("Network Error",le.ERR_NETWORK,e,b)),b=null},b.ontimeout=function(){let I=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",x=i.transitional||ka;i.timeoutErrorMessage&&(I=i.timeoutErrorMessage),n(new le(I,x.clarifyTimeoutError?le.ETIMEDOUT:le.ECONNABORTED,e,b)),b=null},o===void 0&&s.setContentType(null),"setRequestHeader"in b&&T.forEach(s.toJSON(),function(I,x){b.setRequestHeader(x,I)}),T.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),l&&([g,m]=zi(l,!0),b.addEventListener("progress",g)),c&&b.upload&&([d,f]=zi(c),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",f)),(i.cancelToken||i.signal)&&(h=S=>{b&&(n(!S||S.type?new Ur(null,e,b):S),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(h),i.signal&&(i.signal.aborted?h():i.signal.addEventListener("abort",h)));let k=ld(i.url);if(k&&je.protocols.indexOf(k)===-1){n(new le("Unsupported protocol "+k+":",le.ERR_BAD_REQUEST,e));return}b.send(o||null)})};var c_=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,o=function(l){if(!i){i=!0,a();let h=l instanceof Error?l:this.reason;n.abort(h instanceof le?h:new Ur(h instanceof Error?h.message:h))}},s=t&&setTimeout(()=>{s=null,o(new le(`timeout ${t} of ms exceeded`,le.ETIMEDOUT))},t),a=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(o):l.removeEventListener("abort",o)}),e=null)};e.forEach(l=>l.addEventListener("abort",o));let{signal:c}=n;return c.unsubscribe=()=>T.asap(a),c}},Fg=c_;var l_=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},h_=async function*(e,t){for await(let r of d_(e))yield*l_(r,t)},d_=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},fd=(e,t,r,n)=>{let i=h_(e,t),o=0,s,a=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{let{done:l,value:h}=await i.next();if(l){a(),c.close();return}let d=h.byteLength;if(r){let g=o+=d;r(g)}c.enqueue(new Uint8Array(h))}catch(l){throw a(l),l}},cancel(c){return a(c),i.return()}},{highWaterMark:2})};var Ta=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Ng=Ta&&typeof ReadableStream=="function",u_=Ta&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),zg=(e,...t)=>{try{return!!e(...t)}catch{return!1}},p_=Ng&&zg(()=>{let e=!1,t=new Request(je.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Mg=64*1024,md=Ng&&zg(()=>T.isReadableStream(new Response("").body)),Aa={stream:md&&(e=>e.body)};Ta&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Aa[t]&&(Aa[t]=T.isFunction(e[t])?r=>r[t]():(r,n)=>{throw new le(`Response type '${t}' is not supported`,le.ERR_NOT_SUPPORT,n)})})})(new Response);var f_=async e=>{if(e==null)return 0;if(T.isBlob(e))return e.size;if(T.isSpecCompliantForm(e))return(await new Request(je.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(T.isArrayBufferView(e)||T.isArrayBuffer(e))return e.byteLength;if(T.isURLSearchParams(e)&&(e=e+""),T.isString(e))return(await u_(e)).byteLength},m_=async(e,t)=>{let r=T.toFiniteNumber(e.getContentLength());return r??f_(t)},jg=Ta&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:h,withCredentials:d="same-origin",fetchOptions:g}=xa(e);l=l?(l+"").toLowerCase():"text";let f=Fg([i,o&&o.toAbortSignal()],s),m,u=f&&f.unsubscribe&&(()=>{f.unsubscribe()}),b;try{if(c&&p_&&r!=="get"&&r!=="head"&&(b=await m_(h,n))!==0){let x=new Request(t,{method:"POST",body:n,duplex:"half"}),D;if(T.isFormData(n)&&(D=x.headers.get("content-type"))&&h.setContentType(D),x.body){let[P,M]=hd(b,zi(dd(c)));n=fd(x.body,Mg,P,M)}}T.isString(d)||(d=d?"include":"omit");let _="credentials"in Request.prototype;m=new Request(t,{...g,signal:f,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:_?d:void 0});let k=await fetch(m),S=md&&(l==="stream"||l==="response");if(md&&(a||S&&u)){let x={};["status","statusText","headers"].forEach(J=>{x[J]=k[J]});let D=T.toFiniteNumber(k.headers.get("content-length")),[P,M]=a&&hd(D,zi(dd(a),!0))||[];k=new Response(fd(k.body,Mg,P,()=>{M&&M(),u&&u()}),x)}l=l||"text";let I=await Aa[T.findKey(Aa,l)||"text"](k,e);return!S&&u&&u(),await new Promise((x,D)=>{zo(x,D,{data:I,headers:at.from(k.headers),status:k.status,statusText:k.statusText,config:e,request:m})})}catch(_){throw u&&u(),_&&_.name==="TypeError"&&/fetch/i.test(_.message)?Object.assign(new le("Network Error",le.ERR_NETWORK,e,m),{cause:_.cause||_}):le.from(_,_&&_.code,e,m)}});var gd={http:wa,xhr:Lg,fetch:jg};T.forEach(gd,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Vg=e=>`- ${e}`,g_=e=>T.isFunction(e)||e===null||e===!1,Ia={getAdapter:e=>{e=T.isArray(e)?e:[e];let{length:t}=e,r,n,i={};for(let o=0;o<t;o++){r=e[o];let s;if(n=r,!g_(r)&&(n=gd[(s=String(r)).toLowerCase()],n===void 0))throw new le(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),s=t?o.length>1?`since :
69
+ `+o.map(Vg).join(`
70
+ `):" "+Vg(o[0]):"as no adapter specified";throw new le("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:gd};function yd(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ur(null,e)}function Ra(e){return yd(e),e.headers=at.from(e.headers),e.data=Mo.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ia.getAdapter(e.adapter||Mi.adapter)(e).then(function(n){return yd(e),n.data=Mo.call(e,e.transformResponse,n),n.headers=at.from(n.headers),n},function(n){return No(n)||(yd(e),n&&n.response&&(n.response.data=Mo.call(e,e.transformResponse,n.response),n.response.headers=at.from(n.response.headers))),Promise.reject(n)})}var Pa="1.8.4";var Da={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Da[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});var Hg={};Da.transitional=function(t,r,n){function i(o,s){return"[Axios v"+Pa+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(t===!1)throw new le(i(s," has been removed"+(r?" in "+r:"")),le.ERR_DEPRECATED);return r&&!Hg[s]&&(Hg[s]=!0,console.warn(i(s," has been deprecated since v"+r+" and will be removed in the near future"))),t?t(o,s,a):!0}};Da.spelling=function(t){return(r,n)=>(console.warn(`${n} is likely a misspelling of ${t}`),!0)};function y_(e,t,r){if(typeof e!="object")throw new le("options must be an object",le.ERR_BAD_OPTION_VALUE);let n=Object.keys(e),i=n.length;for(;i-- >0;){let o=n[i],s=t[o];if(s){let a=e[o],c=a===void 0||s(a,o,e);if(c!==!0)throw new le("option "+o+" must be "+c,le.ERR_BAD_OPTION_VALUE);continue}if(r!==!0)throw new le("Unknown option "+o,le.ERR_BAD_OPTION)}}var Vo={assertOptions:y_,validators:Da};var Lr=Vo.validators,ji=class{constructor(t){this.defaults=t,this.interceptors={request:new rd,response:new rd}}async request(t,r){try{return await this._request(t,r)}catch(n){if(n instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;let o=i.stack?i.stack.replace(/^.+\n/,""):"";try{n.stack?o&&!String(n.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(n.stack+=`
71
+ `+o):n.stack=o}catch{}}throw n}}_request(t,r){typeof t=="string"?(r=r||{},r.url=t):r=t||{},r=vr(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:o}=r;n!==void 0&&Vo.assertOptions(n,{silentJSONParsing:Lr.transitional(Lr.boolean),forcedJSONParsing:Lr.transitional(Lr.boolean),clarifyTimeoutError:Lr.transitional(Lr.boolean)},!1),i!=null&&(T.isFunction(i)?r.paramsSerializer={serialize:i}:Vo.assertOptions(i,{encode:Lr.function,serialize:Lr.function},!0)),r.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?r.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:r.allowAbsoluteUrls=!0),Vo.assertOptions(r,{baseUrl:Lr.spelling("baseURL"),withXsrfToken:Lr.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let s=o&&T.merge(o.common,o[r.method]);o&&T.forEach(["delete","get","head","post","put","patch","common"],m=>{delete o[m]}),r.headers=at.concat(s,o);let a=[],c=!0;this.interceptors.request.forEach(function(u){typeof u.runWhen=="function"&&u.runWhen(r)===!1||(c=c&&u.synchronous,a.unshift(u.fulfilled,u.rejected))});let l=[];this.interceptors.response.forEach(function(u){l.push(u.fulfilled,u.rejected)});let h,d=0,g;if(!c){let m=[Ra.bind(this),void 0];for(m.unshift.apply(m,a),m.push.apply(m,l),g=m.length,h=Promise.resolve(r);d<g;)h=h.then(m[d++],m[d++]);return h}g=a.length;let f=r;for(d=0;d<g;){let m=a[d++],u=a[d++];try{f=m(f)}catch(b){u.call(this,b);break}}try{h=Ra.call(this,f)}catch(m){return Promise.reject(m)}for(d=0,g=l.length;d<g;)h=h.then(l[d++],l[d++]);return h}getUri(t){t=vr(this.defaults,t);let r=jo(t.baseURL,t.url,t.allowAbsoluteUrls);return Lo(r,t.params,t.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(t){ji.prototype[t]=function(r,n){return this.request(vr(n||{},{method:t,url:r,data:(n||{}).data}))}});T.forEach(["post","put","patch"],function(t){function r(n){return function(o,s,a){return this.request(vr(a||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}ji.prototype[t]=r(),ji.prototype[t+"Form"]=r(!0)});var Ho=ji;var bd=class e{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(o){r=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},t(function(o,s,a){n.reason||(n.reason=new Ur(o,s,a),r(n.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)}toAbortSignal(){let t=new AbortController,r=n=>{t.abort(n)};return this.subscribe(r),t.signal.unsubscribe=()=>this.unsubscribe(r),t.signal}static source(){let t;return{token:new e(function(i){t=i}),cancel:t}}},Wg=bd;function vd(e){return function(r){return e.apply(null,r)}}function _d(e){return T.isObject(e)&&e.isAxiosError===!0}var wd={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(wd).forEach(([e,t])=>{wd[t]=e});var $g=wd;function Gg(e){let t=new Ho(e),r=Bo(Ho.prototype.request,t);return T.extend(r,Ho.prototype,t,{allOwnKeys:!0}),T.extend(r,t,null,{allOwnKeys:!0}),r.create=function(i){return Gg(vr(e,i))},r}var rt=Gg(Mi);rt.Axios=Ho;rt.CanceledError=Ur;rt.CancelToken=Wg;rt.isCancel=No;rt.VERSION=Pa;rt.toFormData=mn;rt.AxiosError=le;rt.Cancel=rt.CanceledError;rt.all=function(t){return Promise.all(t)};rt.spread=vd;rt.isAxiosError=_d;rt.mergeConfig=vr;rt.AxiosHeaders=at;rt.formToJSON=e=>Ea(T.isHTMLForm(e)?new FormData(e):e);rt.getAdapter=Ia.getAdapter;rt.HttpStatusCode=$g;rt.default=rt;var Wt=rt;var{Axios:LC,AxiosError:FC,CanceledError:MC,isCancel:NC,CancelToken:zC,VERSION:jC,all:VC,Cancel:HC,isAxiosError:WC,spread:$C,toFormData:GC,AxiosHeaders:qC,HttpStatusCode:KC,formToJSON:XC,getAdapter:JC,mergeConfig:YC}=Wt;var b_="https://proctoring-api-dev.easyproctor.tech/api",v_="https://proctoring-api-hml.easyproctor.tech/api",qg="https://proctoring-api.easyproctor.tech/api",__="https://easyproctor-realtime-api-dev.easyproctor.tech/api",w_="https://easyproctor-realtime-api-hml.easyproctor.tech/api",S_="https://easyproctor-realtime-api.easyproctor.tech/api",ir=class{constructor(t){this.options=t;this.baseUrl=this.selectBaseUrl(t.type,t.isRealtime),this.token=t.token}getBaseUrl(){return this.baseUrl}selectBaseUrl(t,r){return r?t==="dev"?__:t==="homol"?w_:S_:t==="dev"?b_:t==="homol"?v_:qg}setRealtime(t){this.baseUrl=this.selectBaseUrl(this.options.type,t)}getSocketUrl(){return this.baseUrl.replace("/api","/hub/sockethub")}async loginAuth(t,r){return await this.makeRequest({path:"/Auth",method:"POST",body:{emailOrCpf:t,key:r}})}async externalCameraRegister(t){return await this.makeRequest({path:"/ExternalCamera/register",method:"POST",body:t,jwt:this.token})}async externalCameraCheckTransmission(t){return await this.makeRequest({path:`/ExternalCamera/send-action/${t}`,method:"POST",body:{command:"Check_Transmission"},jwt:this.token})}async externalCameraStartTransmission(t,r){return await this.makeRequest({path:`/ExternalCamera/start-transmission/${t}`,method:"POST",body:{proctoringId:r},jwt:this.token})}async externalCameraStartSession(){return await this.makeRequest({path:"/ExternalCamera/start-session",method:"POST",body:{},jwt:this.token})}async goToExternalCameraPositionStep(t){return await this.makeRequest({path:`/ExternalCamera/go-to-position-step/${t}`,method:"POST",body:{},jwt:this.token})}async externalCameraFinish(t){return await this.makeRequest({path:`/ExternalCamera/finish/${t}`,method:"POST",body:{},jwt:this.token})}async confirmStart(t,r,n,i){return await this.makeRequest({path:`/proctoring/start/${t.examId}`,method:"POST",body:{clientId:t.clientId,proctoringType:r.proctoringType,latitude:n,longitude:i,captureScreen:r.captureScreen},jwt:t.token})}async getParamsConfig(t){return(await this.makeRequestAxios({path:"/Client/params",method:"GET",jwt:t.token}).catch(n=>{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,n){return(await this.makeRequestAxios({path:"/upload/signed-url",method:"POST",jwt:t,body:{objectName:`${n}/${r.name}`,contentType:r.type}})).data}async initiateUpload(t,r,n){return(await this.makeRequestAxios({path:"/upload/initiate-upload",method:"POST",jwt:t,body:{objectName:r,contentType:n}})).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){return 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 n;return r?.success!==null&&r?.success!==void 0?n=r.success?"4":"1":n="4",await this.makeRequest({path:"/Log",method:"POST",body:{entryType:n,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 startChallenge(t){return(await this.makeRequestAxios({path:"/Challenge/start",method:"POST",jwt:this.token,body:t})).data}async stopChallenge(t,r){return(await this.makeRequestAxios({path:`/Challenge/stop/${t}`,method:"POST",jwt:this.token,body:r})).data}async startRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/start-warning",method:"POST",jwt:this.token,body:t})).data}async stopRealtimeAlert(t){return(await this.makeRequestAxios({path:"/Realtime/stop-warning",method:"POST",jwt:this.token,body:t})).data}async verifyFace(t,r,n){return(await this.makeRequestAxios({path:"/Realtime/verify-face",method:"POST",jwt:this.token,body:{proctoringId:t,base64:r,retry:n}})).data}async checkUpload(t,r,n){try{return(await this.makeRequestAxios({path:"/Upload/check",method:"POST",jwt:t,body:{objectName:r,contentType:n}})).data===!0}catch{return!1}}async getServerHour(t){return await this.makeRequest({path:"/Proctoring/server-hour",method:"GET",jwt:t})}async makeRequest(t){let{path:r,method:n,body:i,jwt:o}=t,s=await fetch(this.baseUrl+r,{method:n,body:i!=null?JSON.stringify(i):void 0,headers:{Authorization:`Bearer ${o}`,"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:n,body:i,jwt:o}=t,s=await Wt.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});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:n,body:i,jwt:o}=t,s=await fetch(r,{method:n,body:i!=null?JSON.stringify(i):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 Ba=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:n}){let i=[];return t&&i.push(`deviceType=${t}`),r&&i.push(`rssiThreshold=${r}`),n&&i.push(`packageRateThreshold=${n}`),(await this.makeRequestAxios({path:`/api/usb-device-manager/devices?${i.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:n,body:i,jwt:o}=t,s=await Wt.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var Hn=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 Vi=class{constructor(t,r){this.backendService=new Ba;this.scanInterval=5;this.options={};this.options=r,this.context=t,this.backend=new ir({type:t?.type||"prod",token:t.token,isRealtime:!1}),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 n=new Hn;n.setProctoringId(this.proctoringId),n.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:33,type:5}),await this.backend.saveAlerts(this.context,n),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:n}){let i=await this.backendService.Devices({deviceType:t,rssiThreshold:r,packageRateThreshold:n});if(i.length>0&&(this.options.onRealtimeAlertsCallback?.({type:"spycam",message:"Spycam detected",description:"Dispositivo espi\xE3o detectado.",data:i}),this.proctoringId)){let o=new Hn;o.setProctoringId(this.proctoringId),o.addAlert({begin:Date.now()-this.startTime.getTime(),end:0,alert:32,type:5}),await this.backend.saveAlerts(this.context,o)}return i}async startCheckSpyCam(t,{deviceType:r,rssiThreshold:n,packageRateThreshold:i}){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:n,packageRateThreshold:i})},this.scanInterval*6e4)}stopCheckSpyCam(){clearInterval(this.checkSpyCam)}};var or={cameraId:void 0,microphoneId:void 0,allowMultipleMonitors:!1,allowOnlyFirstMonitor:!0,captureScreen:!0,noiseLimit:40,proctoringType:"IMAGE",insights:"",onBufferSizeError:!1,useGeolocation:!1,useSpyScan:!1,useExternalCamera:!1,useChallenge:!1,screenRecorderOptions:{width:1280,height:720}};function Oa(e){return e.width&&e.height?{width:e.width,height:e.height,minWidth:e.minWidth,minHeight:e.minHeight}:{width:640,height:480}}var Kg={width:1280,height:720,minWidth:640,minHeight:480};function Wn(){let e=window.navigator.userAgent.split("SEB/");return e.length>1?e[1]:"1.0.0.0"}function Xg(){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 _r(){if("userAgentData"in navigator){let e=navigator.userAgentData,t=e.mobile||!1,r=e.platform||"";return t||/Android|iOS/i.test(r)}return/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)}function Ua(){return Wn()!=="1.0.0.0"}var k_;function La(e){k_=e}function Wo(e,t,r=!1,n,i=!1,o){let s,a,c,l;l=0;let h,d=0,g=0,f={mimeType:"video/webm",videoBitsPerSecond:128e3,audioBitsPerSecond:64*1e3};MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?f.mimeType="video/webm;codecs=vp9":console.warn("vp9 codec not supported. Using default mimeType without vp9."),i&&(f={mimeType:"audio/webm",audioBitsPerSecond:64*1e3});function m(M,J){let E=M.getTracks();if(E.length==0)throw new Error("No tracks found");let U=E.find(F=>F.readyState!="live");if(U)throw new Error("Track not live: "+U.label);console.log("buildMediaRecorder tracks OK");let y=new MediaRecorder(M,J);return console.log("buildMediaRecorder mediaRecorder OK"),y.ondataavailable=F=>{l=l+F.data.size,F.data.size>0&&(o?.onChunkAvailable&&(o.onChunkAvailable(F.data,g),g++),t.push(F.data))},y}let u=m(e,f);async function b(M){return new Promise((J,E)=>{let U=!1;M.onstart=()=>{U=!0,console.log("recorder onstart"),h=new Date(Date.now()),J()},M.onerror=y=>{if(console.error("Recorder error event:",y),e.getTracks().forEach(F=>console.log(F.readyState)),"error"in y){let F=y.error;console.error("Error name:",F?.name),console.error("Error message:",F?.message),E(F||y)}else console.warn("Evento sem propriedade error"),E(y)};try{console.log("State antes do start:",M.state),g=0,o?.timeslice&&o?.timeslice>0?M.start(o.timeslice):M.start(1e4),l=0,h=new Date(Date.now())}catch(y){return console.error("Recorder erro ao chamar start event:",y),console.error("Erro real:",y,y?.error,y?.error?.name,y?.error?.message),console.error("Erro real 2:",y,y?.message,y?.name),e.getTracks().forEach(F=>console.log(F.readyState)),E(y)}setTimeout(()=>{U||(console.error("Timeout ao iniciar o recorder"),E(new Error("Timeout ao iniciar o recorder")))},2e3)})}async function _(){try{if(await b(u),u.state==="recording"){l=0;return}else console.log("Recorder n\xE3o est\xE1 em estado recording ap\xF3s start")}catch(M){throw console.error("Erro ao iniciar o recorder:",M),await new Promise(J=>setTimeout(J,300)),M}}function k(){return new Promise(M=>{u.state=="recording"?(console.log("stopRecording Recorder est\xE1 em estado recording, iniciando stop"),s=M,u.onstop=()=>{console.log("recorder onstop"),d=Date.now()-h.getTime()||0,console.log("duration no onstop",d),e.getTracks().forEach(J=>{J.stop()}),s&&s()},u.stop(),d=Date.now()-h.getTime()||0,console.log("duration imediatamente ap\xF3s mediaRecorder.stop()",d)):(console.log("stopRecording Recorder n\xE3o est\xE1 em estado recording"),M())})}function S(){return new Promise(M=>{u.state=="recording"&&u.pause(),M()})}function I(){return new Promise(M=>{u.state=="paused"&&u.resume(),M()})}function x(){return l}function D(){return h}function P(){return d}return{startRecording:_,stopRecording:k,pauseRecording:S,resumeRecording:I,recorderOptions:f,getBufferSize:x,getStartTime:D,getDuration:P}}var Fa,Jg=e=>(Fa=e,Fa),Pt={DEVICES_CHECKED:"devices_checked",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"},Dt=(e,t)=>Fa&&Fa.log(e,t),pe={registerDevicesChecked:(e,t,r)=>Dt(Pt.DEVICES_CHECKED,{proctoringId:e,success:t,description:r}),registerStart:(e,t,r)=>Dt(Pt.START,{proctoringId:e,success:t,description:r}),registerFinish:(e,t,r)=>Dt(Pt.FINISH,{proctoringId:e,success:t,description:r}),registerError:(e,t)=>Dt(Pt.ERROR,{proctoringId:e,description:t}),registerBrowserNotSupported:(e,t)=>Dt(Pt.BROWSER_NOT_SUPPORTED,{proctoringId:e,description:t}),registerUpload:(e,t,r,n,i)=>Dt(Pt.UPLOAD,{proctoringId:e,success:t,description:r,serviceType:n,uploadTime:i}),registerUploadFile:(e,t,r)=>Dt(Pt.UPLOAD_FILE,{proctoringId:e,description:t,fileType:r}),registerChangeDevice:(e,t,r)=>Dt(Pt.CHANGE_DEVICE,{proctoringId:e,inOrOut:t,description:r}),registerStopSharingScreen:(e,t)=>Dt(Pt.STOP_SHARING_SCREEN,{proctoringId:e,description:t}),registerErrorRecorderRTC:(e,t)=>Dt(Pt.ERROR_RECORDER_RTC,{proctoringId:e,description:t}),registerDownloadFile:(e,t)=>Dt(Pt.DOWNLOAD_VIDEO,{proctoringId:e,description:t}),registerOnBufferSizeError:(e,t)=>Dt(Pt.BUFFER_SIZE,{proctoringId:e,description:t}),registerAnotherStream:(e,t)=>Dt(Pt.ANOTHER_STREAM,{proctoringId:e,description:t}),registerSaveOnSession:(e,t)=>Dt(Pt.SAVE_ON_SESSION,{proctoringId:e,description:t})};var Yr=class{constructor(t,r){this.backend=r;this.imageUrlPackage=[];this.imageBatchNum=0;this.contImages=0;this.proctoringId=t}async uploadPackage(t,r){let{file:n}=t;try{console.log("Upload service: uploadPackage");var i="";return await this.backend.getSignedUrl(r,n,this.proctoringId).then(o=>i=o).catch(o=>{throw o}),console.log("Upload service: uploadUrl",i),await Wt.request({url:i,method:"PUT",headers:{"Content-Type":n.type,"x-ms-blob-type":"BlockBlob"},data:n}).then(()=>!0).catch(o=>{throw o}),!0}catch(o){throw pe.registerError(this.proctoringId,`Failed to upload package ${o}
72
72
  File name: ${n.name}
73
73
  File type: ${n.type}
74
- File size: ${n.size}`),o}}async uploadImages(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let d=l.loadedBytes/i.size*100;o&&o(Math.round(d))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let h=this.imageBatchNum;h<this.imageBatchNum+60;h++){let m=`${this.proctoringId}/${this.proctoringId}_${h+1}.jpg`;(h+1)%n==0&&(m=`${this.proctoringId}/${this.proctoringId}_${h+1}_realtime.jpg`),l.push({objectName:m,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(h=>{this.imageUrlPackage.push(h)}),this.imageBatchNum+=60}let c=!1;return c=await kr.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(l=>l.status==200||l.status==201?(this.contImages++,!0):!1).catch(()=>!1).finally(()=>{}),{storage:_n.none,url:a,uploaded:c}}catch(s){throw ie.registerError(this.proctoringId,`Failed to upload to AWS
74
+ File size: ${n.size}`),o}}async uploadImages(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let h=l.loadedBytes/i.size*100;o&&o(Math.round(h))},a;if(this.imageBatchNum===this.contImages){let l=[];for(let d=this.imageBatchNum;d<this.imageBatchNum+60;d++){let g=`${this.proctoringId}/${this.proctoringId}_${d+1}.jpg`;(d+1)%n==0&&(g=`${this.proctoringId}/${this.proctoringId}_${d+1}_realtime.jpg`),l.push({objectName:g,contentType:"image/jpeg"})}(await this.backend.getSignedUrlImage(r,l)).map(d=>{this.imageUrlPackage.push(d)}),this.imageBatchNum+=60}let c=!1;return c=await Wt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,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 pe.registerError(this.proctoringId,`Failed to upload to AWS
75
75
  File name: ${i.name}
76
76
  File type: ${i.type}
77
- File size: ${i.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let d=l.loadedBytes/i.size*100;o&&o(Math.round(d))},a;if(n){if(this.imageBatchNum===this.contImages){let l=[];for(let h=this.imageBatchNum;h<this.imageBatchNum+20;h++)l.push({objectName:`${this.proctoringId}/${this.proctoringId}_${h+1}.jpg`,contentType:"image/jpeg"});(await this.backend.getSignedUrlImage(r,l)).map(h=>{this.imageUrlPackage.push(h)}),this.imageBatchNum+=20}}else a=await this.backend.getSignedUrl(r,i,this.proctoringId);let c=!1;return n?c=await kr.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await kr.request({url:a,method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:_n.none,url:a,uploaded:c}}catch(s){throw ie.registerError(this.proctoringId,`Failed to upload to AWS
77
+ File size: ${i.size}`),new Error("Failed to upload to AWS")}}async upload(t,r,n){let{file:i,onProgress:o}=t;try{let s=l=>{let h=l.loadedBytes/i.size*100;o&&o(Math.round(h))},a;if(n){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,i,this.proctoringId);let c=!1;return n?c=await Wt.request({url:this.imageUrlPackage[this.contImages],method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1).finally(()=>{this.contImages++}):c=await Wt.request({url:a,method:"PUT",headers:{"Content-Type":i.type,"x-ms-blob-type":"BlockBlob"},data:i,onUploadProgress:l=>{s({loadedBytes:l.loaded})}}).then(()=>!0).catch(()=>!1),{storage:"upload",url:a,uploaded:c}}catch{throw pe.registerError(this.proctoringId,`Failed to upload to AWS
78
78
  File name: ${i.name}
79
79
  File type: ${i.type}
80
- File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var c0="not_shared_first_screen",l0="not_shared_screen",Ka="multiple_monitors_detected",d0="proctoring_already_started",Xa="proctoring_not_started";var h0="another_stream_active",u0="stream_under_minimum_permitted",p0="browser_not_supported",f0="token_missing",m0="credentials_missing";var g0="spy_scan_api_not_found",ih="safe_browser_api_not_found";var y0="external_camera_not_started";var oh=class extends Uo{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,d=r.boundingBox.originY*c,h=(r.boundingBox.width-10)*a,m=r.boundingBox.height*c,f=document.createElement("p");f.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",f.style.right=l-20+"px",f.style.top=d+"px",f.style.width=h+"px";let g={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(f.style,{...g,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let u=document.createElement("div");u.setAttribute("class","highlighter"),u.style.right=l-20+"px",u.style.top=d+"px",u.style.width=h+"px",u.style.height=m-20+"px",Object.assign(u.style,{...g,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(u),this.liveView.appendChild(f),this.children.push(u),this.children.push(f)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var Yn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,this.microphone.connect(this.analyser);let i=()=>{let o=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(o);let a=o.reduce((c,l)=>c+l,0)/o.length;this.setVolume(a),t.setVolume&&t.setVolume(a),this.animationFrameId=requestAnimationFrame(i)};this.animationFrameId=requestAnimationFrame(i),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId),this.audioContext?.close(),this.microphone?.disconnect(),this.analyser?.disconnect()}getVolume(){return this.volume}setVolume(t){this.volume=t}};var He=class{constructor(){this.db=null}async connect(){return this.db?this.db:new Promise((t,r)=>{let n=window.indexedDB.open(He.DB_NAME,He.DB_VERSION);n.onerror=()=>{r(new Error("N\xE3o foi poss\xEDvel conectar ao IndexedDB para chunks."))},n.onupgradeneeded=()=>{let i=n.result;i.objectStoreNames.contains(He.STORE_NAME)&&i.deleteObjectStore(He.STORE_NAME);let o=i.createObjectStore(He.STORE_NAME,{keyPath:"id",autoIncrement:!0});o.createIndex("proctoringId","proctoringId",{unique:!1}),o.createIndex("uploaded","uploaded",{unique:!1}),o.createIndex("proctoringId_uploaded",["proctoringId","uploaded"],{unique:!1})},n.onsuccess=()=>{this.db=n.result,t(this.db)}})}async saveChunk(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(He.STORE_NAME,"readwrite").objectStore(He.STORE_NAME).add(t);a.onsuccess=()=>{n(a.result)},a.onerror=()=>{i(new Error(`Erro ao salvar chunk no IndexedDB: ${a.error?.message}`))}})}async getPendingChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(He.STORE_NAME,"readonly").objectStore(He.STORE_NAME).index("proctoringId_uploaded"),c=IDBKeyRange.only([t,0]),l=a.getAll(c);l.onsuccess=()=>{let d=l.result.sort((h,m)=>h.chunkIndex-m.chunkIndex);n(d)},l.onerror=()=>{i(new Error(`Erro ao buscar chunks pendentes: ${l.error?.message}`))}})}async getAllChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(He.STORE_NAME,"readonly").objectStore(He.STORE_NAME).index("proctoringId"),c=IDBKeyRange.only(t),l=a.getAll(c);l.onsuccess=()=>{let d=l.result.sort((h,m)=>h.chunkIndex-m.chunkIndex);n(d)},l.onerror=()=>{i(new Error(`Erro ao buscar todos os chunks: ${l.error?.message}`))}})}async markAsUploaded(t){let r=await this.connect();return new Promise((n,i)=>{let s=r.transaction(He.STORE_NAME,"readwrite").objectStore(He.STORE_NAME),a=s.get(t);a.onsuccess=()=>{let c=a.result;if(!c){n();return}c.uploaded=1;let l=s.put(c);l.onsuccess=()=>n(),l.onerror=()=>i(new Error(`Erro ao marcar chunk como enviado: ${l.error?.message}`))},a.onerror=()=>i(new Error(`Erro ao buscar chunk para marcar: ${a.error?.message}`))})}async clearUploadedChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(He.STORE_NAME,"readwrite").objectStore(He.STORE_NAME).index("proctoringId_uploaded"),c=IDBKeyRange.only([t,1]),l=a.openCursor(c);l.onsuccess=()=>{let d=l.result;d?(d.delete(),d.continue()):n()},l.onerror=()=>i(new Error(`Erro ao limpar chunks enviados: ${l.error?.message}`))})}async clearAllChunks(t){let r=await this.connect();return new Promise((n,i)=>{let o=r.transaction(He.STORE_NAME,"readwrite"),a=o.objectStore(He.STORE_NAME).index("proctoringId"),c=IDBKeyRange.only(t),l=a.openCursor(c);l.onsuccess=()=>{let d=l.result;d&&(d.delete(),d.continue())},l.onerror=()=>{i(new Error(`Erro ao limpar chunks: ${l.error?.message}`))},o.oncomplete=()=>{n()},o.onerror=()=>{i(new Error(`Transaction error: ${o.error?.message}`))},o.onabort=()=>{i(new Error(`Transaction aborted: ${o.error?.message}`))}})}async hasAnyPendingChunks(){let t=await this.connect();return new Promise((r,n)=>{let s=t.transaction(He.STORE_NAME,"readonly").objectStore(He.STORE_NAME).index("uploaded"),a=IDBKeyRange.only(0),c=s.count(a);c.onsuccess=()=>{r(c.result>0)},c.onerror=()=>n(new Error(`Erro ao verificar chunks pendentes: ${c.error?.message}`))})}async getPendingProctoringIds(){let t=await this.connect();return new Promise((r,n)=>{let s=t.transaction(He.STORE_NAME,"readonly").objectStore(He.STORE_NAME).index("uploaded"),a=IDBKeyRange.only(0),c=s.getAll(a);c.onsuccess=()=>{let l=c.result,d=[...new Set(l.map(h=>h.proctoringId))];r(d)},c.onerror=()=>n(new Error(`Erro ao buscar proctoringIds pendentes: ${c.error?.message}`))})}close(){this.db&&(this.db.close(),this.db=null)}},Sn=He;Sn.DB_NAME="EasyProctorChunksDb",Sn.DB_VERSION=3,Sn.STORE_NAME="chunks";var Lw={pollInterval:5e3,maxRetries:5,baseRetryDelay:2e3,cleanAfterUpload:!0},Zn=class{constructor(t,r,n,i,o){this.pollTimer=null;this.isProcessing=!1;this.isRunning=!1;this.retryCount=new Map;this.sessionUrl=null;this.currentOffset=0;this.totalBytesPurged=0;this.STORAGE_KEY_PREFIX="ep_upload_session_";this.GCS_CHUNK_SIZE=256*1024;this.proctoringId=t.trim(),this.token=r,this.backend=n,this.chunkStorage=i,this.config={...Lw,...o},this.loadSessionState()}loadSessionState(){try{let t=localStorage.getItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`);if(t){let{sessionUrl:r,currentOffset:n,totalBytesPurged:i}=JSON.parse(t);this.sessionUrl=r,this.currentOffset=n,this.totalBytesPurged=i||0}}catch(t){console.warn("[BackgroundUpload] Erro ao carregar estado da sess\xE3o:",t)}}saveSessionState(){try{localStorage.setItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`,JSON.stringify({sessionUrl:this.sessionUrl,currentOffset:this.currentOffset,totalBytesPurged:this.totalBytesPurged}))}catch(t){console.warn("[BackgroundUpload] Erro ao salvar estado da sess\xE3o:",t)}}clearSessionState(){try{localStorage.removeItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`),this.sessionUrl=null,this.currentOffset=0,this.totalBytesPurged=0}catch(t){console.warn("[BackgroundUpload] Erro ao limpar estado da sess\xE3o:",t)}}start(){this.isRunning||(this.isRunning=!0,console.log(`[BackgroundUpload] Iniciando servi\xE7o para proctoringId: ${this.proctoringId}`),this.processQueue(),this.pollTimer=setInterval(()=>{this.processQueue(!1)},this.config.pollInterval))}stop(){this.isRunning=!1,this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),console.log(`[BackgroundUpload] Servi\xE7o parado para proctoringId: ${this.proctoringId}`)}async flush(){console.log("[BackgroundUpload] Flush: enviando todos os chunks pendentes e finalizando...");let t=0;for(;this.isProcessing&&t<10;)await this.sleep(1e3),t++;let r=0,n=3;for(;r<n;)try{await this.processQueue(!0),console.log("[BackgroundUpload] Flush completado com sucesso.");return}catch(i){r++,console.error(`[BackgroundUpload] Erro no flush (tentativa ${r}/${n}):`,i),r<n&&await this.sleep(2e3)}throw new Error(`[BackgroundUpload] Falha ao finalizar upload ap\xF3s ${n} tentativas.`)}async syncOffset(){if(!this.sessionUrl)return 0;try{console.log("[BackgroundUpload] Sincronizando offset com GCS...");let t=await fetch(this.sessionUrl,{method:"PUT",headers:{"Content-Range":"bytes */*"}});if(console.log(`[BackgroundUpload] Status da sincroniza\xE7\xE3o (syncOffset): ${t.status}`),t.status===308){let r=t.headers.get("Range");if(r){let n=parseInt(r.split("-")[1],10);this.currentOffset=n+1,this.saveSessionState(),console.log(`[BackgroundUpload] Offset sincronizado: ${this.currentOffset}`)}else this.currentOffset=0}else t.ok||t.status===201?(console.log("[BackgroundUpload] Sincroniza\xE7\xE3o indicou upload JA FINALIZADO."),this.currentOffset=-1):console.warn(`[BackgroundUpload] Status inesperado na sincroniza\xE7\xE3o: ${t.status}`)}catch(t){console.warn("[BackgroundUpload] Erro ao sincronizar offset:",t)}return this.currentOffset}async processQueue(t=!1){if(!this.isProcessing){this.isProcessing=!0;try{if(this.sessionUrl&&(await this.syncOffset(),this.currentOffset===-1)){console.log("[BackgroundUpload] Sess\xE3o j\xE1 finalizada no servidor."),this.clearSessionState(),this.isProcessing=!1;return}let r=await this.chunkStorage.getAllChunks(this.proctoringId),n=r.filter(u=>u.uploaded===0);if(n.length===0&&!t){this.isProcessing=!1;return}console.log(`[BackgroundUpload] ${n.length} chunks pendentes encontrados. Modo final: ${t}`);let i=this.totalBytesPurged,o=r.map(u=>{let b=u.arrayBuffer.byteLength,v=i,k=v+b-1;return i+=b,{chunk:u,start:v,end:k}}),s=[],a=null,c=0,l=n[0].mimeType;for(let u of o){if(this.currentOffset>u.end)continue;let b=Math.max(0,this.currentOffset-u.start),v=new Uint8Array(u.chunk.arrayBuffer);s.push(v.subarray(b)),a=u.chunk.id,c=u.chunk.chunkIndex}if(s.length===0&&!t){this.isProcessing=!1;return}let d=s.reduce((u,b)=>u+b.length,0),h=new Uint8Array(d);{let u=0;for(let b of s)h.set(b,u),u+=b.length}let m=h.byteLength,f;if(t)f=i;else if(m=Math.floor(h.byteLength/this.GCS_CHUNK_SIZE)*this.GCS_CHUNK_SIZE,m===0){console.log("[BackgroundUpload] Dados insuficientes para atingir 256KB. Aguardando novo chunk..."),this.isProcessing=!1;return}let g=m===h.byteLength?h:h.subarray(0,m);try{await this.uploadData(g.byteLength>0?g:null,l,c,f);for(let u of o)u.chunk.uploaded===0&&u.end<this.currentOffset&&(await this.chunkStorage.markAsUploaded(u.chunk.id),this.retryCount.delete(u.chunk.id),this.onChunkUploaded?.(u.chunk.id,u.chunk.chunkIndex),console.log(`[BackgroundUpload] Chunk ${u.chunk.chunkIndex} marcado como enviado.`));if(this.config.cleanAfterUpload){let b=o.filter(v=>v.chunk.uploaded===1||v.chunk.uploaded===0&&v.end<this.currentOffset).reduce((v,k)=>v+k.chunk.arrayBuffer.byteLength,0);await this.chunkStorage.clearUploadedChunks(this.proctoringId),b>0&&(this.totalBytesPurged+=b,this.saveSessionState(),console.log(`[BackgroundUpload] ${b} bytes limpos do armazenamento local. Total purgado: ${this.totalBytesPurged}`))}t&&this.clearSessionState()}catch(u){console.error("[BackgroundUpload] Falha no upload:",u),this.onUploadError?.(a||0,u)}}catch(r){console.error("[BackgroundUpload] Erro ao processar fila:",r)}finally{this.isProcessing=!1}}}async uploadData(t,r,n,i){let o=`EP_${this.proctoringId}_camera_0.webm`;if(this.sessionUrl)console.log(`[BackgroundUpload] Usando sess\xE3o GCS existente: ${this.sessionUrl}`);else{let g=await this.backend.initiateUpload(this.token,`${this.proctoringId}/${o}`,r),u=await fetch(g,{method:"POST",headers:{"x-goog-resumable":"start","Content-Type":r}});if(!u.ok)throw new Error(`Falha ao iniciar: ${u.status}`);if(this.sessionUrl=u.headers.get("Location"),!this.sessionUrl)throw new Error("Location header ausente");try{let v=new URL(this.sessionUrl).pathname.split("/"),k=v[1],S=decodeURIComponent(v.slice(2).join("/"));if(v.includes("b")&&v.includes("o")){let I=v.indexOf("b")+1,x=v.indexOf("o")+1;k=v[I],S=decodeURIComponent(v.slice(x).join("/"))}console.log(`[BackgroundUpload] Sess\xE3o Iniciada -> Bucket: ${k}, Objeto: ${S}`)}catch(b){console.log(`[BackgroundUpload] Sess\xE3o Iniciada. URL: ${this.sessionUrl}`)}this.currentOffset=0,this.saveSessionState()}let s=t?.byteLength??0,a=this.currentOffset,c=a+s-1,l=i!==void 0?i.toString():"*",d=s===0&&i!==void 0?`bytes */${l}`:`bytes ${a}-${c}/${l}`;console.log(`[BackgroundUpload] Enviando ${s>0?"dados":"finaliza\xE7\xE3o"}: ${d} (Size: ${s})`);let h=null;if(s>0&&t){let g=t.buffer;g instanceof ArrayBuffer?h=t.byteOffset===0&&t.byteLength===g.byteLength?g:g.slice(t.byteOffset,t.byteOffset+t.byteLength):(h=new ArrayBuffer(t.byteLength),new Uint8Array(h).set(t))}let m=await fetch(this.sessionUrl,{method:"PUT",headers:{"Content-Range":d},body:h});if(console.log(`[BackgroundUpload] Resposta GCS (uploadData): ${m.status}`),m.status!==200&&m.status!==201&&m.status!==308){let g=await m.text();throw console.error(`[BackgroundUpload] Erro GCS: ${g}`),new Error(`Status HTTP inesperado: ${m.status}`)}let f=m.headers.get("Range");if(f){let g=parseInt(f.split("-")[1],10);this.currentOffset=g+1}else this.currentOffset+=s;this.saveSessionState(),ie.registerUploadFile(this.proctoringId,`GCS Stream Upload
81
- Size: ${s}
82
- Range: ${a}-${c}
83
- Last Index: ${n}`,"CameraChunk")}static async recoverPendingUploads(t,r){let n=new Sn,i=[];try{let o=await n.getPendingProctoringIds();if(o.length===0)return console.log("[BackgroundUpload] Nenhum chunk pendente encontrado para recupera\xE7\xE3o."),i;console.log(`[BackgroundUpload] Recupera\xE7\xE3o p\xF3s-crash: ${o.length} sess\xE3o(\xF5es) com chunks pendentes.`);for(let s of o)try{await new Zn(s,r,t,n,{cleanAfterUpload:!0}).flush(),i.push(s),console.log(`[BackgroundUpload] Chunks da sess\xE3o ${s} recuperados com sucesso.`)}catch(a){console.error(`[BackgroundUpload] Erro ao recuperar chunks da sess\xE3o ${s}:`,a)}}catch(o){console.error("[BackgroundUpload] Erro geral na recupera\xE7\xE3o:",o)}return i}sleep(t){return new Promise(r=>setTimeout(r,t))}};var w0=Qc(v0()),_0=ah(),Fw=_0.default||_0,Ji=class{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{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.pendingPackages=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.videoElement=null;this.duration=0;this.stopped=!1;this.backgroundUpload=null;this.chunkIndex=0;this.pendingChunkSaves=[];this.boundVisibilityHandler=null;this.boundPageHideHandler=null;this.currentRetries=0;this.packageCount=0;this.failedUploads=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}get isChunkEnabled(){return!!this.proctoringId&&this.options.proctoringType==="REALTIME"&&!$a()}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new kn(this.proctoringId,this.backend)),Ga(t),this.isChunkEnabled?(this.chunkStorage=new Sn,this.backend&&this.backendToken&&(this.backgroundUpload=new Zn(this.proctoringId,this.backendToken,this.backend,this.chunkStorage,{pollInterval:5e3,maxRetries:5,cleanAfterUpload:!0})),this.persistSessionState("IN_PROGRESS"),console.log(`[CameraRecorder] Chunk recording ATIVO (type: ${this.options.proctoringType}, mobile: ${Er()})`)):console.log(`[CameraRecorder] Chunk recording INATIVO (type: ${this.options.proctoringType}) \u2014 modo cl\xE1ssico.`)}persistSessionState(t){try{let r={proctoringId:this.proctoringId,status:t,timestamp:Date.now()};localStorage.setItem(Ji.LS_SESSION_KEY,JSON.stringify(r))}catch(r){console.warn("[CameraRecorder] N\xE3o foi poss\xEDvel salvar estado no localStorage:",r)}}clearSessionState(){try{localStorage.removeItem(Ji.LS_SESSION_KEY)}catch(t){console.warn("[CameraRecorder] N\xE3o foi poss\xEDvel limpar estado do localStorage:",t)}}static checkForActiveSession(){try{let t=localStorage.getItem(Ji.LS_SESSION_KEY);if(!t)return null;let r=JSON.parse(t);return r.status==="IN_PROGRESS"?r:null}catch{return null}}setupLifecycleListeners(){this.boundVisibilityHandler=()=>this.handleVisibilityChange(),this.boundPageHideHandler=()=>this.handlePageHide(),document.addEventListener("visibilitychange",this.boundVisibilityHandler),window.addEventListener("pagehide",this.boundPageHideHandler)}removeLifecycleListeners(){this.boundVisibilityHandler&&(document.removeEventListener("visibilitychange",this.boundVisibilityHandler),this.boundVisibilityHandler=null),this.boundPageHideHandler&&(window.removeEventListener("pagehide",this.boundPageHideHandler),this.boundPageHideHandler=null)}handleVisibilityChange(){document.visibilityState==="hidden"?(console.log("[CameraRecorder] P\xE1gina ficou invis\xEDvel \u2014 sess\xE3o potencialmente interrompida."),this.persistSessionState("INTERRUPTED"),this.proctoringId&&ie.registerError(this.proctoringId,"Visibility API: P\xE1gina ficou oculta (hidden). Poss\xEDvel troca de app ou minimiza\xE7\xE3o.")):document.visibilityState==="visible"&&(console.log("[CameraRecorder] P\xE1gina vis\xEDvel novamente \u2014 verificando estado da grava\xE7\xE3o."),this.persistSessionState("IN_PROGRESS"),this.proctoringId&&ie.registerError(this.proctoringId,"Visibility API: P\xE1gina voltou a ficar vis\xEDvel. Usu\xE1rio retornou."),this.onVisibilityRestored?.())}handlePageHide(){console.log("[CameraRecorder] pagehide detectado \u2014 persistindo estado."),this.persistSessionState("INTERRUPTED"),this.proctoringId&&ie.registerError(this.proctoringId,"Page Lifecycle: pagehide event detectado. P\xE1gina est\xE1 sendo descarregada.")}async initializeDetectors(){vg(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new oh({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),this.options.onRealtimeAlertsCallback(t)}},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Lo({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),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,screen.orientation?.type.includes("portrait")&&Er()?(console.log("configurando canvas em portrait"),this.canvas.width=this.videoOptions.height/2,this.canvas.height=this.videoOptions.width/2):(this.canvas.width=this.videoOptions.width/2,this.canvas.height=this.videoOptions.height/2)}async bufferError(t){console.log("buffer error Camera Recorder params ");let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(await this.recordingStop(),await this.startRecording(),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startStream(){let{cameraId:t,microphoneId:r,onBufferSizeErrorCallback:n}=this.options,i={audio:{deviceId:r},video:{deviceId:t,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(i)}catch(d){throw d.toString()=="NotReadableError: Could not start video source"?"N\xE3o foi poss\xEDvel conectar a camera, ela pode estar sendo utilizada por outro programa":d}this.cameraStream=this.hardwareStream;let s=this.cameraStream.getVideoTracks()[0].getSettings(),{width:a=0,height:c=0}=s;if(screen.orientation?.type.includes("portrait")&&Er()&&this.videoOptions.width==c&&this.videoOptions.height==a&&([a,c]=[c,a]),this.videoOptions.minWidth>a||this.videoOptions.minHeight>c)throw u0;if(this.videoOptions.width!==a||this.videoOptions.height!==c)throw ie.registerAnotherStream(this.proctoringId,`Maybe have another stream active
80
+ File size: ${i.size}`),new Error("Failed to upload to AWS")}}};var Yg="not_shared_first_screen",Zg="not_shared_screen",Ma="multiple_monitors_detected",Qg="proctoring_already_started",Na="proctoring_not_started";var e0="another_stream_active",t0="stream_under_minimum_permitted",r0="browser_not_supported",n0="token_missing",i0="credentials_missing";var o0="spy_scan_api_not_found",Ed="safe_browser_api_not_found";var s0="external_camera_not_started";var za=class extends Oi{constructor(t,r,n="videoPreviewFrameDetection",i="liveViewFrameDetection"){super("ObjectDetector","https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite0/float16/1/efficientdet_lite0.tflite",t,r,n,i)}stopDetection(){super.stopDetection(),this.numPersonsSent>0&&this.handleOk("person_ok","person_detection_on_stream")}displayVideoDetections(t){for(let r of this.children)this.liveView.removeChild(r);this.children.splice(0);for(let r of t.detections){let n=window.innerWidth,i=window.innerHeight,o=this.video.offsetWidth,s=this.video.offsetHeight,a=o/n,c=s/i,l=o-r.boundingBox.width*a-r.boundingBox.originX*a,h=r.boundingBox.originY*c,d=(r.boundingBox.width-10)*a,g=r.boundingBox.height*c,f=document.createElement("p");f.innerText=r.categories[0].categoryName+" - with "+Math.round(parseFloat(r.categories[0].score)*100)+"% confidence.",f.style.right=l-20+"px",f.style.top=h+"px",f.style.width=d+"px";let m={zIndex:"2",position:"absolute",border:"1px dashed #fff"};Object.assign(f.style,{...m,margin:"0",fontSize:"9px",paddingBottom:"5px",paddingTop:"5px",color:"#fff",backgroundColor:"#007f8b"});let u=document.createElement("div");u.setAttribute("class","highlighter"),u.style.right=l-20+"px",u.style.top=h+"px",u.style.width=d+"px",u.style.height=g-20+"px",Object.assign(u.style,{...m,zIndex:"1",background:"rgba(0, 255, 0, 0.25)"}),this.liveView.appendChild(u),this.liveView.appendChild(f),this.children.push(u),this.children.push(f)}}verify(t){let r=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="person")).length,n=t.detections.filter(i=>i.categories.some(o=>o.categoryName==="cell phone")).length;this.paramsConfig.videoBehaviourParameters?.detectPerson&&r!==this.numPersonsSent&&(r===0?(this.handleAlert("no_person_detected","person_detection_on_stream"),this.numPersonsSent=r):r>1?(this.handleAlert("multiple_persons_detected","person_detection_on_stream"),this.numPersonsSent=r):(this.handleOk("person_ok","person_detection_on_stream"),this.numPersonsSent=r)),this.paramsConfig.videoBehaviourParameters?.detectCellPhone&&n!==this.numCellphoneSent&&(n>0?(this.handleAlert("cellphone_detected","mobile_detection_on_stream"),this.numCellphoneSent=n):(this.handleOk("cellphone_ok","mobile_detection_on_stream"),this.numCellphoneSent=n))}};var gn=class{constructor(t){this.volume=null;this.animationFrameId=null;this.stream=t}async start(t={}){return new Promise((r,n)=>{try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.smoothingTimeConstant=.8,this.analyser.fftSize=1024,this.microphone.connect(this.analyser);let i=()=>{let o=new Uint8Array(this.analyser.frequencyBinCount);this.analyser.getByteFrequencyData(o);let a=o.reduce((c,l)=>c+l,0)/o.length;this.setVolume(a),t.setVolume&&t.setVolume(a),this.animationFrameId=requestAnimationFrame(i)};this.animationFrameId=requestAnimationFrame(i),r(!0)}catch(i){this.stop(),n(`Error: ${i}`)}})}stop(){this.animationFrameId!==null&&cancelAnimationFrame(this.animationFrameId),this.audioContext?.close(),this.microphone?.disconnect(),this.analyser?.disconnect()}getVolume(){return this.volume}setVolume(t){this.volume=t}};var Hi=class e{constructor(){this.db=null}static{this.DB_NAME="EasyProctorChunksDb"}static{this.DB_VERSION=3}static{this.STORE_NAME="chunks"}async connect(){return this.db?this.db:new Promise((t,r)=>{let n=window.indexedDB.open(e.DB_NAME,e.DB_VERSION);n.onerror=()=>{r(new Error("N\xE3o foi poss\xEDvel conectar ao IndexedDB para chunks."))},n.onupgradeneeded=()=>{let i=n.result;i.objectStoreNames.contains(e.STORE_NAME)&&i.deleteObjectStore(e.STORE_NAME);let o=i.createObjectStore(e.STORE_NAME,{keyPath:"id",autoIncrement:!0});o.createIndex("proctoringId","proctoringId",{unique:!1}),o.createIndex("uploaded","uploaded",{unique:!1}),o.createIndex("proctoringId_uploaded",["proctoringId","uploaded"],{unique:!1})},n.onsuccess=()=>{this.db=n.result,t(this.db)}})}async saveChunk(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(e.STORE_NAME,"readwrite").objectStore(e.STORE_NAME).add(t);a.onsuccess=()=>{n(a.result)},a.onerror=()=>{i(new Error(`Erro ao salvar chunk no IndexedDB: ${a.error?.message}`))}})}async getPendingChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(e.STORE_NAME,"readonly").objectStore(e.STORE_NAME).index("proctoringId_uploaded"),c=IDBKeyRange.only([t,0]),l=a.getAll(c);l.onsuccess=()=>{let h=l.result.sort((d,g)=>d.chunkIndex-g.chunkIndex);n(h)},l.onerror=()=>{i(new Error(`Erro ao buscar chunks pendentes: ${l.error?.message}`))}})}async getAllChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(e.STORE_NAME,"readonly").objectStore(e.STORE_NAME).index("proctoringId"),c=IDBKeyRange.only(t),l=a.getAll(c);l.onsuccess=()=>{let h=l.result.sort((d,g)=>d.chunkIndex-g.chunkIndex);n(h)},l.onerror=()=>{i(new Error(`Erro ao buscar todos os chunks: ${l.error?.message}`))}})}async markAsUploaded(t){let r=await this.connect();return new Promise((n,i)=>{let s=r.transaction(e.STORE_NAME,"readwrite").objectStore(e.STORE_NAME),a=s.get(t);a.onsuccess=()=>{let c=a.result;if(!c){n();return}c.uploaded=1;let l=s.put(c);l.onsuccess=()=>n(),l.onerror=()=>i(new Error(`Erro ao marcar chunk como enviado: ${l.error?.message}`))},a.onerror=()=>i(new Error(`Erro ao buscar chunk para marcar: ${a.error?.message}`))})}async clearUploadedChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(e.STORE_NAME,"readwrite").objectStore(e.STORE_NAME).index("proctoringId_uploaded"),c=IDBKeyRange.only([t,1]),l=a.openCursor(c);l.onsuccess=()=>{let h=l.result;h?(h.delete(),h.continue()):n()},l.onerror=()=>i(new Error(`Erro ao limpar chunks enviados: ${l.error?.message}`))})}async clearAllChunks(t){let r=await this.connect();return new Promise((n,i)=>{let a=r.transaction(e.STORE_NAME,"readwrite").objectStore(e.STORE_NAME).index("proctoringId"),c=IDBKeyRange.only(t),l=a.openCursor(c);l.onsuccess=()=>{let h=l.result;h?(h.delete(),h.continue()):n()},l.onerror=()=>i(new Error(`Erro ao limpar todos os chunks: ${l.error?.message}`))})}async hasAnyPendingChunks(){let t=await this.connect();return new Promise((r,n)=>{let s=t.transaction(e.STORE_NAME,"readonly").objectStore(e.STORE_NAME).index("uploaded"),a=IDBKeyRange.only(0),c=s.count(a);c.onsuccess=()=>{r(c.result>0)},c.onerror=()=>n(new Error(`Erro ao verificar chunks pendentes: ${c.error?.message}`))})}async getPendingProctoringIds(){let t=await this.connect();return new Promise((r,n)=>{let s=t.transaction(e.STORE_NAME,"readonly").objectStore(e.STORE_NAME).index("uploaded"),a=IDBKeyRange.only(0),c=s.getAll(a);c.onsuccess=()=>{let l=c.result,h=[...new Set(l.map(d=>d.proctoringId))];r(h)},c.onerror=()=>n(new Error(`Erro ao buscar proctoringIds pendentes: ${c.error?.message}`))})}close(){this.db&&(this.db.close(),this.db=null)}};var C_={pollInterval:5e3,maxRetries:5,baseRetryDelay:2e3,cleanAfterUpload:!0},Wi=class e{constructor(t,r,n,i,o){this.pollTimer=null;this.isProcessing=!1;this.isRunning=!1;this.retryCount=new Map;this.sessionUrl=null;this.currentOffset=0;this.totalBytesPurged=0;this.STORAGE_KEY_PREFIX="ep_upload_session_";this.GCS_CHUNK_SIZE=256*1024;this.proctoringId=t.trim(),this.token=r,this.backend=n,this.chunkStorage=i,this.config={...C_,...o},this.loadSessionState()}loadSessionState(){try{let t=localStorage.getItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`);if(t){let{sessionUrl:r,currentOffset:n,totalBytesPurged:i}=JSON.parse(t);this.sessionUrl=r,this.currentOffset=n,this.totalBytesPurged=i||0}}catch(t){console.warn("[BackgroundUpload] Erro ao carregar estado da sess\xE3o:",t)}}saveSessionState(){try{localStorage.setItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`,JSON.stringify({sessionUrl:this.sessionUrl,currentOffset:this.currentOffset,totalBytesPurged:this.totalBytesPurged}))}catch(t){console.warn("[BackgroundUpload] Erro ao salvar estado da sess\xE3o:",t)}}clearSessionState(){try{localStorage.removeItem(`${this.STORAGE_KEY_PREFIX}${this.proctoringId}`),this.sessionUrl=null,this.currentOffset=0,this.totalBytesPurged=0}catch(t){console.warn("[BackgroundUpload] Erro ao limpar estado da sess\xE3o:",t)}}start(){this.isRunning||(this.isRunning=!0,console.log(`[BackgroundUpload] Iniciando servi\xE7o para proctoringId: ${this.proctoringId}`),this.processQueue(),this.pollTimer=setInterval(()=>{this.processQueue(!1)},this.config.pollInterval))}stop(){this.isRunning=!1,this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null),console.log(`[BackgroundUpload] Servi\xE7o parado para proctoringId: ${this.proctoringId}`)}async flush(){console.log("[BackgroundUpload] Flush: enviando todos os chunks pendentes e finalizando...");let t=0;for(;this.isProcessing&&t<10;)await this.sleep(1e3),t++;let r=0,n=3;for(;r<n;)try{await this.processQueue(!0),console.log("[BackgroundUpload] Flush completado com sucesso.");return}catch(i){r++,console.error(`[BackgroundUpload] Erro no flush (tentativa ${r}/${n}):`,i),r<n&&await this.sleep(2e3)}throw new Error(`[BackgroundUpload] Falha ao finalizar upload ap\xF3s ${n} tentativas.`)}async syncOffset(){if(!this.sessionUrl)return 0;try{console.log("[BackgroundUpload] Sincronizando offset com GCS...");let t=await fetch(this.sessionUrl,{method:"PUT",headers:{"Content-Range":"bytes */*"}});if(console.log(`[BackgroundUpload] Status da sincroniza\xE7\xE3o (syncOffset): ${t.status}`),t.status===308){let r=t.headers.get("Range");if(r){let n=parseInt(r.split("-")[1],10);this.currentOffset=n+1,this.saveSessionState(),console.log(`[BackgroundUpload] Offset sincronizado: ${this.currentOffset}`)}else this.currentOffset=0}else t.ok||t.status===201?(console.log("[BackgroundUpload] Sincroniza\xE7\xE3o indicou upload JA FINALIZADO."),this.currentOffset=-1):console.warn(`[BackgroundUpload] Status inesperado na sincroniza\xE7\xE3o: ${t.status}`)}catch(t){console.warn("[BackgroundUpload] Erro ao sincronizar offset:",t)}return this.currentOffset}async processQueue(t=!1){if(!this.isProcessing){this.isProcessing=!0;try{if(this.sessionUrl&&(await this.syncOffset(),this.currentOffset===-1)){console.log("[BackgroundUpload] Sess\xE3o j\xE1 finalizada no servidor."),this.clearSessionState(),this.isProcessing=!1;return}let r=await this.chunkStorage.getAllChunks(this.proctoringId),n=r.filter(m=>m.uploaded===0);if(n.length===0&&!t){this.isProcessing=!1;return}console.log(`[BackgroundUpload] ${n.length} chunks pendentes encontrados. Modo final: ${t}`);let i=this.totalBytesPurged,o=r.map(m=>{let u=i,b=u+m.arrayBuffer.byteLength-1;return i+=m.arrayBuffer.byteLength,{chunk:m,start:u,end:b}}),s=[],a=null,c=0,l=n[0]?.mimeType??r[r.length-1]?.mimeType??"video/webm";for(let m of o){if(this.currentOffset>m.end)continue;let u=Math.max(0,this.currentOffset-m.start),b=m.chunk.arrayBuffer.slice(u);s.push(b),a=m.chunk.id,c=m.chunk.chunkIndex}if(s.length===0&&!t){this.isProcessing=!1;return}let h=e.concatArrayBuffers(s),d=h.byteLength,g;if(t)g=i;else if(d=Math.floor(h.byteLength/this.GCS_CHUNK_SIZE)*this.GCS_CHUNK_SIZE,d===0){console.log("[BackgroundUpload] Dados insuficientes para atingir 256KB. Aguardando novo chunk..."),this.isProcessing=!1;return}let f=d<h.byteLength?h.slice(0,d):h;try{await this.uploadData(f,l,c,g);for(let m of o)m.chunk.uploaded===0&&m.end<this.currentOffset&&(await this.chunkStorage.markAsUploaded(m.chunk.id),this.retryCount.delete(m.chunk.id),this.onChunkUploaded?.(m.chunk.id,m.chunk.chunkIndex),console.log(`[BackgroundUpload] Chunk ${m.chunk.chunkIndex} marcado como enviado.`));if(this.config.cleanAfterUpload){let u=o.filter(b=>b.chunk.uploaded===1||b.chunk.uploaded===0&&b.end<this.currentOffset).reduce((b,_)=>b+_.chunk.arrayBuffer.byteLength,0);await this.chunkStorage.clearUploadedChunks(this.proctoringId),u>0&&(this.totalBytesPurged+=u,this.saveSessionState(),console.log(`[BackgroundUpload] ${u} bytes limpos do armazenamento local. Total purgado: ${this.totalBytesPurged}`))}t&&this.clearSessionState()}catch(m){console.error("[BackgroundUpload] Falha no upload:",m),this.onUploadError?.(a||0,m)}}catch(r){console.error("[BackgroundUpload] Erro ao processar fila:",r)}finally{this.isProcessing=!1}}}static concatArrayBuffers(t){if(t.length===0)return new ArrayBuffer(0);let r=t.reduce((o,s)=>o+s.byteLength,0),n=new Uint8Array(r),i=0;for(let o of t)n.set(new Uint8Array(o),i),i+=o.byteLength;return n.buffer.byteLength===r?n.buffer:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}async uploadData(t,r,n,i){let o=`EP_${this.proctoringId}_camera_0.webm`;if(this.sessionUrl)console.log(`[BackgroundUpload] Usando sess\xE3o GCS existente: ${this.sessionUrl}`);else{let g=await this.backend.initiateUpload(this.token,`${this.proctoringId}/${o}`,r),f=await fetch(g,{method:"POST",headers:{"x-goog-resumable":"start","Content-Type":r}});if(!f.ok)throw new Error(`Falha ao iniciar: ${f.status}`);if(this.sessionUrl=f.headers.get("Location"),!this.sessionUrl)throw new Error("Location header ausente");try{let u=new URL(this.sessionUrl).pathname.split("/"),b=u[1],_=decodeURIComponent(u.slice(2).join("/"));if(u.includes("b")&&u.includes("o")){let k=u.indexOf("b")+1,S=u.indexOf("o")+1;b=u[k],_=decodeURIComponent(u.slice(S).join("/"))}console.log(`[BackgroundUpload] Sess\xE3o Iniciada -> Bucket: ${b}, Objeto: ${_}`)}catch{console.log(`[BackgroundUpload] Sess\xE3o Iniciada. URL: ${this.sessionUrl}`)}this.currentOffset=0,this.saveSessionState()}let s=this.currentOffset,a=s+t.byteLength-1,c=i!==void 0?i.toString():"*",l=t.byteLength===0&&i!==void 0?`bytes */${c}`:`bytes ${s}-${a}/${c}`;console.log(`[BackgroundUpload] Enviando ${t.byteLength>0?"dados":"finaliza\xE7\xE3o"}: ${l} (Size: ${t.byteLength})`);let h=await fetch(this.sessionUrl,{method:"PUT",headers:{"Content-Range":l},body:t.byteLength>0?t:null});if(console.log(`[BackgroundUpload] Resposta GCS (uploadData): ${h.status}`),h.status!==200&&h.status!==201&&h.status!==308){let g=await h.text();throw console.error(`[BackgroundUpload] Erro GCS: ${g}`),new Error(`Status HTTP inesperado: ${h.status}`)}let d=h.headers.get("Range");if(d){let g=parseInt(d.split("-")[1],10);this.currentOffset=g+1}else this.currentOffset+=t.byteLength;this.saveSessionState(),pe.registerUploadFile(this.proctoringId,`GCS Stream Upload
81
+ Size: ${t.byteLength}
82
+ Range: ${s}-${a}
83
+ Last Index: ${n}`,"CameraChunk")}static async recoverPendingUploads(t,r){let n=new Hi,i=[];try{let o=await n.getPendingProctoringIds();if(o.length===0)return console.log("[BackgroundUpload] Nenhum chunk pendente encontrado para recupera\xE7\xE3o."),i;console.log(`[BackgroundUpload] Recupera\xE7\xE3o p\xF3s-crash: ${o.length} sess\xE3o(\xF5es) com chunks pendentes.`);for(let s of o)try{await new e(s,r,t,n,{cleanAfterUpload:!0}).flush(),i.push(s),console.log(`[BackgroundUpload] Chunks da sess\xE3o ${s} recuperados com sucesso.`)}catch(a){console.error(`[BackgroundUpload] Erro ao recuperar chunks da sess\xE3o ${s}:`,a)}}catch(o){console.error("[BackgroundUpload] Erro geral na recupera\xE7\xE3o:",o)}return i}sleep(t){return new Promise(r=>setTimeout(r,t))}};var h0=fl(c0()),l0=xd(),A_=l0.default||l0,Zr=class e{constructor(t,r,n,i,o){this.blobs=[];this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{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.pendingPackages=[];this.animationFrameId=null;this.isCanvasLoopActive=!1;this.hardwareStream=null;this.internalClonedStream=null;this.videoElement=null;this.duration=0;this.stopped=!1;this.backgroundUpload=null;this.chunkIndex=0;this.pendingChunkSaves=[];this.boundVisibilityHandler=null;this.boundPageHideHandler=null;this.currentRetries=0;this.packageCount=0;this.failedUploads=0;this.noiseWait=20;this.options=t,this.videoOptions=r,this.backend=i,this.backendToken=o,n&&(this.paramsConfig=n)}static{this.CHUNK_TIMESLICE_MS=6e4}static{this.LS_SESSION_KEY="ep_proctoring_session"}get isChunkEnabled(){return!!this.proctoringId&&this.options.proctoringType==="REALTIME"&&!Ua()}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend)),La(t),this.isChunkEnabled?(this.chunkStorage=new Hi,this.backend&&this.backendToken&&(this.backgroundUpload=new Wi(this.proctoringId,this.backendToken,this.backend,this.chunkStorage,{pollInterval:5e3,maxRetries:5,cleanAfterUpload:!0})),this.persistSessionState("IN_PROGRESS"),console.log(`[CameraRecorder] Chunk recording ATIVO (type: ${this.options.proctoringType}, mobile: ${_r()})`)):console.log(`[CameraRecorder] Chunk recording INATIVO (type: ${this.options.proctoringType}) \u2014 modo cl\xE1ssico.`)}persistSessionState(t){try{let r={proctoringId:this.proctoringId,status:t,timestamp:Date.now()};localStorage.setItem(e.LS_SESSION_KEY,JSON.stringify(r))}catch(r){console.warn("[CameraRecorder] N\xE3o foi poss\xEDvel salvar estado no localStorage:",r)}}clearSessionState(){try{localStorage.removeItem(e.LS_SESSION_KEY)}catch(t){console.warn("[CameraRecorder] N\xE3o foi poss\xEDvel limpar estado do localStorage:",t)}}static checkForActiveSession(){try{let t=localStorage.getItem(e.LS_SESSION_KEY);if(!t)return null;let r=JSON.parse(t);return r.status==="IN_PROGRESS"?r:null}catch{return null}}setupLifecycleListeners(){this.boundVisibilityHandler=()=>this.handleVisibilityChange(),this.boundPageHideHandler=()=>this.handlePageHide(),document.addEventListener("visibilitychange",this.boundVisibilityHandler),window.addEventListener("pagehide",this.boundPageHideHandler)}removeLifecycleListeners(){this.boundVisibilityHandler&&(document.removeEventListener("visibilitychange",this.boundVisibilityHandler),this.boundVisibilityHandler=null),this.boundPageHideHandler&&(window.removeEventListener("pagehide",this.boundPageHideHandler),this.boundPageHideHandler=null)}handleVisibilityChange(){document.visibilityState==="hidden"?(console.log("[CameraRecorder] P\xE1gina ficou invis\xEDvel \u2014 sess\xE3o potencialmente interrompida."),this.persistSessionState("INTERRUPTED"),this.proctoringId&&pe.registerError(this.proctoringId,"Visibility API: P\xE1gina ficou oculta (hidden). Poss\xEDvel troca de app ou minimiza\xE7\xE3o.")):document.visibilityState==="visible"&&(console.log("[CameraRecorder] P\xE1gina vis\xEDvel novamente \u2014 verificando estado da grava\xE7\xE3o."),this.persistSessionState("IN_PROGRESS"),this.proctoringId&&pe.registerError(this.proctoringId,"Visibility API: P\xE1gina voltou a ficar vis\xEDvel. Usu\xE1rio retornou."),this.onVisibilityRestored?.())}handlePageHide(){console.log("[CameraRecorder] pagehide detectado \u2014 persistindo estado."),this.persistSessionState("INTERRUPTED"),this.proctoringId&&pe.registerError(this.proctoringId,"Page Lifecycle: pagehide event detectado. P\xE1gina est\xE1 sendo descarregada.")}async initializeDetectors(){lg(),(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone)&&(this.objectDetection=new za({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),this.options.onRealtimeAlertsCallback(t)}},this.paramsConfig),await this.objectDetection.initializeDetector()),this.paramsConfig.videoBehaviourParameters?.detectFace&&(this.faceDetection=new Ui({onRealtimeAlertsCallback:t=>{t.begin=Date.now()-(this.getStartTime()?.getTime()||0),t.end=Date.now()-(this.getStartTime()?.getTime()||0),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,screen.orientation?.type.includes("portrait")&&_r()?(console.log("configurando canvas em portrait"),this.canvas.width=this.videoOptions.height/2,this.canvas.height=this.videoOptions.width/2):(this.canvas.width=this.videoOptions.width/2,this.canvas.height=this.videoOptions.height/2)}async bufferError(t){console.log("buffer error Camera Recorder params ");let r=this.paramsConfig.videoBehaviourParameters?.retryEnabled||!1,n=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;r&&this.currentRetries<n?(await this.recordingStop(),await this.startRecording(),this.currentRetries++,this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback(this.cameraStream)):this.options.onBufferSizeErrorCallback&&this.options.onBufferSizeErrorCallback()}async startStream(){let{cameraId:t,microphoneId:r,onBufferSizeErrorCallback:n}=this.options,i={audio:{deviceId:r},video:{deviceId:t,width:this.videoOptions.width,height:this.videoOptions.height,frameRate:15}};try{this.hardwareStream=await navigator.mediaDevices.getUserMedia(i)}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}this.cameraStream=this.hardwareStream;let s=this.cameraStream.getVideoTracks()[0].getSettings(),{width:a=0,height:c=0}=s;if(screen.orientation?.type.includes("portrait")&&_r()&&this.videoOptions.width==c&&this.videoOptions.height==a&&([a,c]=[c,a]),this.videoOptions.minWidth>a||this.videoOptions.minHeight>c)throw t0;if(this.videoOptions.width!==a||this.videoOptions.height!==c)throw pe.registerAnotherStream(this.proctoringId,`Maybe have another stream active
84
84
  Video Options: ${JSON.stringify(this.videoOptions,null,2)}
85
- Setting: ${JSON.stringify(s,null,2)}`),h0}async stopStream(){this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}async waitForVideoFlow(){return new Promise(t=>{let r=()=>{if(this.videoElement&&this.videoElement?.readyState>=3)return t();requestAnimationFrame(r)};r()})}async attachAndWarmup(t){this.videoElement=document.createElement("video"),this.videoElement.srcObject=t,this.videoElement.muted=!0,await this.videoElement.play().catch(r=>{}),await new Promise(r=>{if(this.videoElement&&this.videoElement?.readyState>=1)return r();this.videoElement&&(this.videoElement.onloadedmetadata=()=>r())}),console.log("CameraRecorder checking metadata ok"),await this.waitForVideoFlow(),console.log("CameraRecorder waiting for video flow ok"),await new Promise(r=>setTimeout(r,300))}async startRecording(){await this.startStream(),await this.attachAndWarmup(this.cameraStream);let t=this.isChunkEnabled?{timeslice:Ji.CHUNK_TIMESLICE_MS,onChunkAvailable:(d,h)=>{this.handleNewChunk(d,h)}}:{},{startRecording:r,stopRecording:n,pauseRecording:i,resumeRecording:o,recorderOptions:s,getBufferSize:a,getStartTime:c,getDuration:l}=Yo(this.cameraStream,this.blobs,this.options.onBufferSizeError,d=>this.bufferError(d),!1,t);this.recordingStart=r,this.recordingStop=n,this.recordingPause=i,this.recordingResume=o,this.recorderOptions=s,this.getBufferSize=a,this.getStartTime=c,this.getDuration=l,this.chunkIndex=0,this.isChunkEnabled&&(this.backgroundUpload?.start(),this.setupLifecycleListeners());try{await new Promise(d=>setTimeout(d,500)),await this.recordingStart()}catch(d){console.log("Camera Recorder error",d),this.stopRecording();let h=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;if(this.currentRetries<h)console.log("Camera Recorder retry",this.currentRetries),this.currentRetries++,await this.startRecording();else throw d}this.stopped=!1,(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&await this.initializeDetectors(),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.pendingPackages=[],this.options.proctoringType=="REALTIME"&&await this.startRealtimeCapture(),this.packageCount=0,console.log("Camera Recorder started OK")}async stopRecording(){console.log("Camera Recorder stopRecording"),this.stopped=!0,this.isCanvasLoopActive=!1,this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection),this.recordingStop&&await this.recordingStop(),this.duration=this.getDuration?this.getDuration():0,await new Promise(t=>setTimeout(t,200));try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null),this.videoElement&&(this.videoElement?.remove(),this.videoElement=null),this.video&&this.video?.remove(),this.canvas&&this.canvas?.remove()}catch{console.error("Erro ao parar os streams de m\xEDdia.")}if(this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken&&(this.pendingPackages.push(this.filesToUpload.slice(0,this.filesToUpload.length)),await this.sendPackage(),await this.filesToUpload.splice(0,this.filesToUpload.length)),this.isChunkEnabled){if(this.backgroundUpload){ie.registerError(this.proctoringId,"Flush e parada do background upload");try{this.pendingChunkSaves.length>0&&(console.log(`[CameraRecorder] Aguardando ${this.pendingChunkSaves.length} salvamentos de chunks pendentes...`),await Promise.all(this.pendingChunkSaves)),await this.backgroundUpload.flush(),this.backgroundUpload.stop()}catch(t){console.warn("[CameraRecorder] Erro ao fazer flush dos chunks:",t),ie.registerError(this.proctoringId,`Flush Chunks
86
- Error: ${t}`)}}this.removeLifecycleListeners(),this.persistSessionState("FINISHED"),ie.registerError(this.proctoringId,"Finalizando flush e parada do background upload")}}async handleNewChunk(t,r){if(!this.proctoringId||!this.chunkStorage)return;let n=(async()=>{try{let i=await t.arrayBuffer();await this.chunkStorage.saveChunk({proctoringId:this.proctoringId,chunkIndex:this.chunkIndex,arrayBuffer:i,timestamp:Date.now(),uploaded:0,mimeType:this.recorderOptions?.mimeType||"video/webm"}),this.chunkIndex++,console.log(`[CameraRecorder] Chunk ${this.chunkIndex-1} salvo no IndexedDB.`)}catch(i){ie.registerError(this.proctoringId,`Save Chunk
87
- Error: ${i}`),console.error("[CameraRecorder] Erro ao salvar chunk no IndexedDB:",i)}})();this.pendingChunkSaves.push(n),n.finally(()=>{this.pendingChunkSaves=this.pendingChunkSaves.filter(i=>i!==n)})}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}async captureFrame(){let t,r=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize;this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let n=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;r==this.imageCount&&(this.imageCount=0,this.pendingPackages.push(this.filesToUpload.slice(0,r)),this.sendPackage(),await this.filesToUpload.splice(0,r));let i=`${this.proctoringId}_${this.imageCount+1}.jpg`;t=await this.getFile(n,i,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)}async startRealtimeCapture(){this.configImageCapture(),this.imageCount=0,this.pendingPackages=[],await this.captureFrame(),this.imageInterval=setInterval(async()=>{await this.captureFrame()},this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval*1e3)}async sendPackage(){let t=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize,r=this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval;if(this.upload&&this.backendToken&&this.pendingPackages.length>0){let n=[],i=0;for(let o of this.pendingPackages){let s=new w0.default;for(let d of o)s.file(d.name,d);let a=await s.generateAsync({type:"blob"}),c="realtime_package_"+t*r*this.packageCount+".zip",l=new File([a],c,{type:"application/zip"});try{await this.upload.uploadPackage({file:l},this.backendToken)==!0&&(this.packageCount++,this.failedUploads=0,n.push(i++))}catch(d){this.failedUploads++,this.failedUploads>=2&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Realtime n\xE3o est\xE1 enviando pacotes",type:"error_upload_package",category:"error_upload_package",begin:0,end:0});break}}for(let o of n)await this.pendingPackages.splice(o,1)}}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&ie.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} ChunkEnabled: ${this.isChunkEnabled}`);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();if(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo){let i;if(ie.registerError(this.proctoringId,"saveOnSession iniciando"),this.isChunkEnabled&&!await this.checkInternetStability()){if(this.backend&&this.backendToken&&this.proctoringId){let c=`EP_${this.proctoringId}_camera_0.webm`,l=`${this.proctoringId}/${c}`,d=await this.backend.checkUpload(this.backendToken,l,"video/webm");if(ie.registerError(this.proctoringId,"Limpa o armazenamento local pois o v\xEDdeo j\xE1 est\xE1 no servidor"),d){try{this.chunkStorage&&await this.chunkStorage.clearAllChunks(t.id)}catch(h){ie.registerError(this.proctoringId,`Erro ao limpar o armazenamento local: ${h}`)}return}}}ie.registerError(this.proctoringId,"saveOnSession gerando v\xEDdeo a partir do buffer em mem\xF3ria (\xEDntegra)");let o=new Blob(this.blobs,{type:this.recorderOptions?.mimeType||"video/webm"}),s=await Fw(o,this.duration);i=new File([s],`EP_${t.id}_camera_0.webm`,{type:o.type}),t.addRecording({device:`Audio
85
+ Setting: ${JSON.stringify(s,null,2)}`),e0}async stopStream(){this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null)}async waitForVideoFlow(){return new Promise(t=>{let r=()=>{if(this.videoElement&&this.videoElement?.readyState>=3)return t();requestAnimationFrame(r)};r()})}async attachAndWarmup(t){this.videoElement=document.createElement("video"),this.videoElement.srcObject=t,this.videoElement.muted=!0,await this.videoElement.play().catch(r=>{}),await new Promise(r=>{if(this.videoElement&&this.videoElement?.readyState>=1)return r();this.videoElement&&(this.videoElement.onloadedmetadata=()=>r())}),console.log("CameraRecorder checking metadata ok"),await this.waitForVideoFlow(),console.log("CameraRecorder waiting for video flow ok"),await new Promise(r=>setTimeout(r,300))}async startRecording(){await this.startStream(),await this.attachAndWarmup(this.cameraStream);let t=this.isChunkEnabled?{timeslice:e.CHUNK_TIMESLICE_MS,onChunkAvailable:(h,d)=>{this.handleNewChunk(h,d)}}:{},{startRecording:r,stopRecording:n,pauseRecording:i,resumeRecording:o,recorderOptions:s,getBufferSize:a,getStartTime:c,getDuration:l}=Wo(this.cameraStream,this.blobs,this.options.onBufferSizeError,h=>this.bufferError(h),!1,t);this.recordingStart=r,this.recordingStop=n,this.recordingPause=i,this.recordingResume=o,this.recorderOptions=s,this.getBufferSize=a,this.getStartTime=c,this.getDuration=l,this.chunkIndex=0,this.isChunkEnabled&&(this.backgroundUpload?.start(),this.setupLifecycleListeners());try{await new Promise(h=>setTimeout(h,500)),await this.recordingStart()}catch(h){console.log("Camera Recorder error",h),this.stopRecording();let d=this.paramsConfig.videoBehaviourParameters?.maxRetries||3;if(this.currentRetries<d)console.log("Camera Recorder retry",this.currentRetries),this.currentRetries++,await this.startRecording();else throw h}this.stopped=!1,(this.paramsConfig.videoBehaviourParameters?.detectPerson||this.paramsConfig.videoBehaviourParameters?.detectCellPhone||this.paramsConfig.videoBehaviourParameters?.detectFace)&&await this.initializeDetectors(),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.pendingPackages=[],this.options.proctoringType=="REALTIME"&&await this.startRealtimeCapture(),this.packageCount=0,console.log("Camera Recorder started OK")}async stopRecording(){console.log("Camera Recorder stopRecording"),this.stopped=!0,this.isCanvasLoopActive=!1,this.faceDetection&&this.faceDetection.detecting&&this.faceDetection.stopDetection(),this.objectDetection&&this.objectDetection.detecting&&this.objectDetection.stopDetection(),clearInterval(this.imageInterval),clearInterval(this.sendFrameInterval),this.volumeMeter&&this.volumeMeter.stop(),this.intervalNoiseDetection&&clearInterval(this.intervalNoiseDetection),this.recordingStop&&await this.recordingStop(),this.duration=this.getDuration?this.getDuration():0,await new Promise(t=>setTimeout(t,200));try{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.cameraStream&&this.cameraStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream&&(this.internalClonedStream.getTracks().forEach(t=>t.stop()),this.internalClonedStream=null),this.hardwareStream&&(this.hardwareStream.getTracks().forEach(t=>t.stop()),this.hardwareStream=null),this.videoElement&&(this.videoElement?.remove(),this.videoElement=null),this.video&&this.video?.remove(),this.canvas&&this.canvas?.remove()}catch{console.error("Erro ao parar os streams de m\xEDdia.")}if(this.options.proctoringType=="REALTIME"&&this.upload&&this.backendToken&&(this.pendingPackages.push(this.filesToUpload.slice(0,this.filesToUpload.length)),await this.sendPackage(),await this.filesToUpload.splice(0,this.filesToUpload.length)),this.isChunkEnabled){if(this.backgroundUpload){try{this.pendingChunkSaves.length>0&&(console.log(`[CameraRecorder] Aguardando ${this.pendingChunkSaves.length} salvamentos de chunks pendentes...`),await Promise.all(this.pendingChunkSaves)),await this.backgroundUpload.flush()}catch(t){console.warn("[CameraRecorder] Erro ao fazer flush dos chunks:",t)}this.backgroundUpload.stop()}this.removeLifecycleListeners(),this.persistSessionState("FINISHED")}}async handleNewChunk(t,r){if(!this.proctoringId||!this.chunkStorage)return;let n=(async()=>{try{let i=await t.arrayBuffer();await this.chunkStorage.saveChunk({proctoringId:this.proctoringId,chunkIndex:this.chunkIndex,arrayBuffer:i,timestamp:Date.now(),uploaded:0,mimeType:this.recorderOptions?.mimeType||"video/webm"}),this.chunkIndex++,console.log(`[CameraRecorder] Chunk ${this.chunkIndex-1} salvo no IndexedDB.`)}catch(i){console.error("[CameraRecorder] Erro ao salvar chunk no IndexedDB:",i)}})();this.pendingChunkSaves.push(n),n.finally(()=>{this.pendingChunkSaves=this.pendingChunkSaves.filter(i=>i!==n)})}async pauseRecording(){await this.recordingPause()}async resumeRecording(){await this.recordingResume()}async getCurrentImageBase64(){return!this.video||!this.canvas?this.configImageCapture():this.video.srcObject!==this.cameraStream&&(this.video.srcObject=this.cameraStream,await this.video.play()),this.video.paused&&await this.video.play(),await new Promise(t=>{if(this.video.readyState>=2){t();return}let r=()=>{this.video.removeEventListener("loadedmetadata",r),setTimeout(()=>t(),50)};this.video.addEventListener("loadedmetadata",r),setTimeout(()=>{this.video.removeEventListener("loadedmetadata",r),t()},500)}),this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height),this.canvas.toDataURL("image/jpeg")}async captureFrame(){let t,r=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize;this.canvas.getContext("2d").drawImage(this.video,0,0,this.canvas.width,this.canvas.height);let n=this.canvas.toDataURL("image/jpeg");if(this.proctoringId==null)return;r==this.imageCount&&(this.imageCount=0,this.pendingPackages.push(this.filesToUpload.slice(0,r)),this.sendPackage(),await this.filesToUpload.splice(0,r));let i=`${this.proctoringId}_${this.imageCount+1}.jpg`;t=await this.getFile(n,i,"image/jpeg"),t&&t.size>10&&r>0&&(this.filesToUpload.push(t),this.imageCount++)}async startRealtimeCapture(){this.configImageCapture(),this.imageCount=0,this.pendingPackages=[],await this.captureFrame(),this.imageInterval=setInterval(async()=>{await this.captureFrame()},this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval*1e3)}async sendPackage(){let t=this.paramsConfig.videoBehaviourParameters?.realtimePackageSize,r=this.paramsConfig.videoBehaviourParameters?.realtimeCaptureInterval;if(this.upload&&this.backendToken&&this.pendingPackages.length>0){let n=[],i=0;for(let o of this.pendingPackages){let s=new h0.default;for(let h of o)s.file(h.name,h);let a=await s.generateAsync({type:"blob"}),c="realtime_package_"+t*r*this.packageCount+".zip",l=new File([a],c,{type:"application/zip"});try{await this.upload.uploadPackage({file:l},this.backendToken)==!0&&(this.packageCount++,this.failedUploads=0,n.push(i++))}catch{this.failedUploads++,this.failedUploads>=2&&this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Realtime n\xE3o est\xE1 enviando pacotes",type:"error_upload_package",category:"error_upload_package",begin:0,end:0});break}}for(let o of n)await this.pendingPackages.splice(o,1)}}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}async saveOnSession(t){this.blobs!=null&&pe.registerSaveOnSession(this.proctoringId,`Blobs Length: ${this.blobs.length} Buffer Size: ${this.getBufferSize()} ChunkEnabled: ${this.isChunkEnabled}`);let r=this.cameraStream.getVideoTracks()[0].getSettings(),n=this.cameraStream.getAudioTracks()[0].getSettings();if(this.options.proctoringType=="VIDEO"||this.options.proctoringType=="REALTIME"||this.options.proctoringType=="IMAGE"&&this.paramsConfig.imageBehaviourParameters?.saveVideo){let i;if(this.isChunkEnabled&&!await this.checkInternetStability()){if(this.backend&&this.backendToken&&this.proctoringId){let c=`EP_${this.proctoringId}_camera_0.webm`,l=`${this.proctoringId}/${c}`;if(await this.backend.checkUpload(this.backendToken,l,"video/webm")){this.chunkStorage&&await this.chunkStorage.clearAllChunks(t.id);return}}}let o=new Blob(this.blobs,{type:this.recorderOptions?.mimeType||"video/webm"}),s=await A_(o,this.duration);i=new File([s],`EP_${t.id}_camera_0.webm`,{type:o.type}),t.addRecording({device:`Audio
88
86
  Sample Rate: ${n.sampleRate}
89
87
  Sample Size: ${n.sampleSize}
90
88
 
91
89
  Video:
92
- ${JSON.stringify(this.recorderOptions)}`,file:i,origin:Ki.Camera})}ie.registerError(this.proctoringId,"saveOnSession finalizado")}async getFile(t,r,n){return new Promise((i,o)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});i(a)}).catch(s=>{o(s)})})}async checkInternetStability(){if(!navigator.onLine)return!1;try{let t=new AbortController,r=setTimeout(()=>t.abort(),5e3),n=this.backend?.getBaseUrl();if(!n)return!0;let i=await fetch(`${n}/Client/health`,{method:"GET",signal:t.signal});return clearTimeout(r),i.status<500}catch(t){return console.warn("[CameraRecorder] Internet inst\xE1vel ou lenta detectada para upload integral."),!1}}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new Yn(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0),this.noiseWait++}},zr=Ji;zr.CHUNK_TIMESLICE_MS=6e4,zr.LS_SESSION_KEY="ep_proctoring_session";var ch=class{constructor(t=ar,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...ar,...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=`
90
+ ${JSON.stringify(this.recorderOptions)}`,file:i,origin:"Camera"})}}async getFile(t,r,n){return new Promise((i,o)=>{t.length>5&&fetch(t).then(s=>s.blob()).then(s=>{let a=new File([s],r,{type:n});i(a)}).catch(s=>{o(s)})})}async checkInternetStability(){if(!navigator.onLine)return!1;try{let t=new AbortController,r=setTimeout(()=>t.abort(),5e3),n=this.backend?.getBaseUrl();if(!n)return!0;let i=await fetch(`${n}/Client/health`,{method:"GET",signal:t.signal});return clearTimeout(r),i.status<500}catch{return console.warn("[CameraRecorder] Internet inst\xE1vel ou lenta detectada para upload integral."),!1}}onNoiseDetected(){if(this.options.proctoringType==="REALTIME")return;!this.volumeMeter&&this.cameraStream&&(this.volumeMeter=new gn(this.cameraStream),this.volumeMeter.start().catch(r=>{console.log(r),this.volumeMeter=void 0})),(this.volumeMeter?.getVolume()??0)>=(this.paramsConfig.audioBehaviourParameters?.noiseLimit||40)&&this.noiseWait>=20&&(this.options.onRealtimeAlertsCallback({status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.noiseWait=0),this.noiseWait++}};var Va=class{constructor(t=or,r){this.videoOptions={width:1080,height:720,minWidth:0,minHeight:0};this.options={...or,...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=`
93
91
  .alert-div {
94
92
  display: flex;
95
93
  align-items: center;
@@ -369,7 +367,7 @@ Setting: ${JSON.stringify(s,null,2)}`),h0}async stopStream(){this.cameraStream&&
369
367
  height: 50px !important;
370
368
  }
371
369
  }
372
- `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let i=document.createElement("div");i.setAttribute("class","modal-responsive");let o={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(i,o);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";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),i.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),d=document.createElement("select");d.setAttribute("id","cameraSelect");let h={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",marginBottom:"15px"};this.applyStyles(c,h),l.innerText="C\xE2mera";let m={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,m),d.style.maxWidth="400px",d.style.minWidth="150px",d.style.width="100%",d.style.boxSizing="border-box",c.appendChild(l),c.appendChild(d),i.appendChild(c);let f=document.createElement("div");f.setAttribute("id","liveCheckDevices"),f.setAttribute("class","camera-container-responsive");let g=document.createElement("div");g.setAttribute("class","video-responsive");let u=document.createElement("video"),b=document.createElement("div");u.setAttribute("id","cameraStream"),u.muted=!0;let v={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(f,v);let k={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(u,k),this.applyStyles(g,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let S=document.createElement("div");S.setAttribute("class","alert-div"),S.setAttribute("id","alertDivResolution");let I=document.createElement("error");I.setAttribute("id","resolutionAlert"),I.innerText="Resolu\xE7\xE3o m\xEDnima",I.style.marginLeft="10px",I.style.marginRight="5px";let x=document.createElement("span"),B=document.createElement("div"),P=document.createElement("div");x.setAttribute("id","checkmark_resolution"),B.setAttribute("id","checkmark_stem_resolution"),P.setAttribute("id","checkmark_kick_resolution"),x.appendChild(B),x.appendChild(P);let M=document.createElement("span"),J=document.createElement("div"),E=document.createElement("div");M.setAttribute("class","info"),M.setAttribute("id","info_resolution"),J.setAttribute("class","info_stem"),E.setAttribute("class","info_kick"),M.appendChild(J),M.appendChild(E),S.appendChild(x),S.appendChild(I),S.appendChild(M);let U=document.createElement("div");U.setAttribute("class","alert-div"),U.setAttribute("id","alertDivFacePosition");let y=document.createElement("error");y.setAttribute("id","facePositionAlert"),y.innerText="Posicionamento da face",y.style.marginLeft="10px";let L=document.createElement("span"),ce=document.createElement("div"),V=document.createElement("div");L.setAttribute("id","checkmark_FacePosition"),ce.setAttribute("id","checkmark_stem_FacePosition"),V.setAttribute("id","checkmark_kick_FacePosition"),L.appendChild(ce),L.appendChild(V);let le=document.createElement("span"),H=document.createElement("div"),se=document.createElement("div");le.style.marginLeft="10px",le.setAttribute("class","info"),le.setAttribute("id","info_FacePosition"),le.style.display="none",H.setAttribute("class","info_stem"),se.setAttribute("class","info_kick"),le.appendChild(H),le.appendChild(se),U.appendChild(L),U.appendChild(y),U.appendChild(le);let D=document.createElement("div");D.setAttribute("class","alert-div"),D.setAttribute("id","alertDivAmbientVerify");let R=document.createElement("error");R.setAttribute("id","ambientVerifyAlert"),R.innerText="Verifica\xE7\xE3o do ambiente",R.style.marginLeft="10px";let te=document.createElement("span"),q=document.createElement("div"),G=document.createElement("div");te.setAttribute("id","checkmark_AmbientVerify"),q.setAttribute("id","checkmark_stem_AmbientVerify"),G.setAttribute("id","checkmark_kick_AmbientVerify"),te.appendChild(q),te.appendChild(G),D.appendChild(te),D.appendChild(R);let xe=document.createElement("div");xe.setAttribute("class","alert-div"),xe.setAttribute("id","alertDivSpyCam"),xe.style.display="none";let Xe=document.createElement("error");Xe.setAttribute("id","SpyCamAlert"),Xe.innerText="Verifica\xE7\xE3o de Spy Cam",Xe.style.marginLeft="10px";let ue=document.createElement("span"),ge=document.createElement("div"),Je=document.createElement("div");ue.setAttribute("id","checkmark_SpyCam"),ge.setAttribute("id","checkmark_stem_SpyCam"),Je.setAttribute("id","checkmark_kick_SpyCam"),ue.appendChild(ge),ue.appendChild(Je),xe.appendChild(ue),xe.appendChild(Xe),b.style.transform="rotateY(180deg)",b.style.display="flex",b.style.flexDirection="column",b.style.flex="1",b.style.minWidth="0",b.appendChild(S),b.appendChild(U),b.appendChild(D),b.appendChild(xe),f.appendChild(b),g.appendChild(u),g.style.flexShrink="0",f.appendChild(g);let ve=document.createElement("div");ve.setAttribute("class","facial-biometry__mask"),ve.style.width="100%",ve.style.height="100%",ve.style.position="absolute",ve.style.top="0px",ve.style.left="0px",ve.style.backgroundColor="#fff",ve.style.opacity="0.6";let st=document.createElement("div");st.setAttribute("class","biometry__frame"),st.style.width="100%",st.style.height="100%",st.style.position="absolute",st.style.top="0px",st.style.left="0px",st.style.zIndex="10",g.appendChild(ve),g.appendChild(st),i.appendChild(f);let pt=document.createElement("div");pt.setAttribute("class","mic-header-responsive");let p=document.createElement("h3"),N=document.createElement("select");N.setAttribute("id","micSelect");let O={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(pt,O),p.innerText="Microfone";let _={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(p,_),N.style.maxWidth="400px",N.style.minWidth="150px",N.style.width="100%",N.style.boxSizing="border-box",pt.appendChild(p),pt.appendChild(N),i.appendChild(pt);let w=document.createElement("div");w.setAttribute("class","mic-container-responsive");let C={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(w,C);let j=document.createElement("div");j.setAttribute("class","mic-meter-responsive");let z={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(j,z);let A=document.createElement("div");A.setAttribute("id","audioStream");let $={display:"flex",marginBottom:"15px"};this.applyStyles(A,$);let K={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let dp=0;dp<25;dp++){let hp=document.createElement("div");this.applyStyles(hp,K),A.appendChild(hp)}let W=document.createElement("div");W.setAttribute("class","range-responsive");let re=document.createElement("p"),Ee=document.createElement("p"),pe=document.createElement("p"),Tt={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(W,Tt),re.innerText="0",Ee.innerText="50",pe.innerText="100",W.appendChild(re),W.appendChild(Ee),W.appendChild(pe);let Yt=document.createElement("div");Yt.setAttribute("class","alert-div"),Yt.setAttribute("id","alertDivMicrophone");let Zt={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(Yt,Zt);let Pr=document.createElement("error");Pr.setAttribute("id","microphoneAlert"),Pr.innerText="Teste de funcionamento",Pr.style.marginLeft="10px";let Ie=document.createElement("span"),Fn=document.createElement("div"),fi=document.createElement("div");Ie.setAttribute("id","checkmark_microphone"),Fn.setAttribute("id","checkmark_stem_microphone"),fi.setAttribute("id","checkmark_kick_microphone"),Ie.appendChild(Fn),Ie.appendChild(fi),Yt.appendChild(Ie),Yt.appendChild(Pr),j.appendChild(A),j.appendChild(W);let _t=document.createElement("p");_t.setAttribute("class","pronounce-responsive"),_t.innerText='Pronuncie em voz alta: "Testando..."',_t.style.textAlign="start";let As={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(_t,As),w.appendChild(j),w.appendChild(Yt),i.appendChild(_t),i.appendChild(w);let Mn=document.createElement("div"),Zc={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Mn,Zc);let Nn=document.createElement("button");Nn.setAttribute("id","cancelBtn"),Nn.setAttribute("class","button-responsive"),Nn.innerText="Cancelar";let Ts={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Nn,Ts);let Gr=document.createElement("span");Gr.setAttribute("class","divider-responsive");let mi={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(Gr,mi);let jn=document.createElement("button");jn.innerText="Continuar",jn.setAttribute("id","confirmBtn"),jn.setAttribute("class","button-responsive");let Fy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(jn,Fy),this.options.useSpyScan&&(jn.style.cursor="not-allowed",jn.setAttribute("disabled","true")),Mn.appendChild(Nn),Mn.appendChild(Gr),Mn.appendChild(jn),i.appendChild(Mn),r.appendChild(i),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),i=document.querySelector("#micSelect"),o=await mr();n&&(n.value=t.cameraId||"default"),i&&(i.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};o.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),o.microphones.forEach(a=>{let c=s(a.label,a.id);i?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),i=document.getElementById("cameraSelect"),o=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:i?.value,microphoneId:o?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),i=document.getElementById("alertDivFacePosition"),o=document.getElementById("info_FacePosition"),s=document.getElementById("checkmark_FacePosition"),a=document.getElementById("checkmark_stem_FacePosition"),c=document.getElementById("checkmark_kick_FacePosition"),l=document.getElementById("alertDivAmbientVerify"),d=document.getElementById("checkmark_AmbientVerify"),h=document.getElementById("checkmark_stem_AmbientVerify"),m=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),i&&i.setAttribute("title",""),o&&(o.style.display="none"),l&&l.setAttribute("title",""),s&&(s.setAttribute("class","checkmark"),a.setAttribute("class","checkmark_stem"),c.setAttribute("class","checkmark_kick")),d&&(d.setAttribute("class","checkmark"),h.setAttribute("class","checkmark_stem"),m.setAttribute("class","checkmark_kick"))):(s&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),o&&(o.style.display="block"),i&&i.setAttribute("title",t.description),s.setAttribute("class","checkmark_error"),a.setAttribute("class","checkmark_stem_error"),c.setAttribute("class","checkmark_kick_error")),d&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),l&&l.setAttribute("title",`${t.description}`),d.setAttribute("class","checkmark_error"),h.setAttribute("class","checkmark_stem_error"),m.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","true"),i&&(i.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","false"),i&&(i.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),i=document.getElementById("alertDivSpyCam");i&&(i.style.display="flex");let o=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),o&&(o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):o&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),i=document.getElementById("info_resolution"),o=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",i&&(i.style.display="none"),r.setAttribute("title",""),o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",i&&(i.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
370
+ `,document.getElementsByTagName("head")[0].appendChild(t);let r=document.createElement("div");r.setAttribute("id","checkDevices");let n={backgroundColor:"rgba(0,0,0,0.4)",zIndex:"1000",position:"fixed",top:"0",left:"0",height:"100vh",width:"100%",maxWidth:"100vw",display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto",boxSizing:"border-box"};this.applyStyles(r,n);let i=document.createElement("div");i.setAttribute("class","modal-responsive");let o={backgroundColor:"#fff",zIndex:"1001",width:"90%",maxWidth:"600px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center",boxSizing:"border-box",overflow:"hidden"};this.applyStyles(i,o);let s=document.createElement("h3");s.innerText="Checagem de dispositivos";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),i.appendChild(s);let c=document.createElement("div");c.setAttribute("class","camera-header-responsive");let l=document.createElement("h3"),h=document.createElement("select");h.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 g={color:"rgba(0, 0, 0, .75)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(l,g),h.style.maxWidth="400px",h.style.minWidth="150px",h.style.width="100%",h.style.boxSizing="border-box",c.appendChild(l),c.appendChild(h),i.appendChild(c);let f=document.createElement("div");f.setAttribute("id","liveCheckDevices"),f.setAttribute("class","camera-container-responsive");let m=document.createElement("div");m.setAttribute("class","video-responsive");let u=document.createElement("video"),b=document.createElement("div");u.setAttribute("id","cameraStream"),u.muted=!0;let _={width:"100%",display:"flex",justifyContent:"space-between",gap:"20px",borderBottom:"2px solid rgba(0, 0, 0, .1)",paddingBottom:"15px",paddingLeft:"20px",paddingRight:"20px",boxSizing:"border-box",transform:"rotateY(180deg)"};this.applyStyles(f,_);let k={width:"100%",maxWidth:"320px",height:"auto",maxHeight:"240px",objectFit:"contain",backgroundColor:"#000",borderRadius:"10px",marginBottom:"15px"};this.applyStyles(u,k),this.applyStyles(m,{position:"relative",width:"100%",maxWidth:"320px",maxHeight:"240px",boxSizing:"border-box"});let S=document.createElement("div");S.setAttribute("class","alert-div"),S.setAttribute("id","alertDivResolution");let I=document.createElement("error");I.setAttribute("id","resolutionAlert"),I.innerText="Resolu\xE7\xE3o m\xEDnima",I.style.marginLeft="10px",I.style.marginRight="5px";let x=document.createElement("span"),D=document.createElement("div"),P=document.createElement("div");x.setAttribute("id","checkmark_resolution"),D.setAttribute("id","checkmark_stem_resolution"),P.setAttribute("id","checkmark_kick_resolution"),x.appendChild(D),x.appendChild(P);let M=document.createElement("span"),J=document.createElement("div"),E=document.createElement("div");M.setAttribute("class","info"),M.setAttribute("id","info_resolution"),J.setAttribute("class","info_stem"),E.setAttribute("class","info_kick"),M.appendChild(J),M.appendChild(E),S.appendChild(x),S.appendChild(I),S.appendChild(M);let U=document.createElement("div");U.setAttribute("class","alert-div"),U.setAttribute("id","alertDivFacePosition");let y=document.createElement("error");y.setAttribute("id","facePositionAlert"),y.innerText="Posicionamento da face",y.style.marginLeft="10px";let F=document.createElement("span"),ae=document.createElement("div"),V=document.createElement("div");F.setAttribute("id","checkmark_FacePosition"),ae.setAttribute("id","checkmark_stem_FacePosition"),V.setAttribute("id","checkmark_kick_FacePosition"),F.appendChild(ae),F.appendChild(V);let ce=document.createElement("span"),H=document.createElement("div"),oe=document.createElement("div");ce.style.marginLeft="10px",ce.setAttribute("class","info"),ce.setAttribute("id","info_FacePosition"),ce.style.display="none",H.setAttribute("class","info_stem"),oe.setAttribute("class","info_kick"),ce.appendChild(H),ce.appendChild(oe),U.appendChild(F),U.appendChild(y),U.appendChild(ce);let B=document.createElement("div");B.setAttribute("class","alert-div"),B.setAttribute("id","alertDivAmbientVerify");let R=document.createElement("error");R.setAttribute("id","ambientVerifyAlert"),R.innerText="Verifica\xE7\xE3o do ambiente",R.style.marginLeft="10px";let te=document.createElement("span"),q=document.createElement("div"),G=document.createElement("div");te.setAttribute("id","checkmark_AmbientVerify"),q.setAttribute("id","checkmark_stem_AmbientVerify"),G.setAttribute("id","checkmark_kick_AmbientVerify"),te.appendChild(q),te.appendChild(G),B.appendChild(te),B.appendChild(R);let Ce=document.createElement("div");Ce.setAttribute("class","alert-div"),Ce.setAttribute("id","alertDivSpyCam"),Ce.style.display="none";let Ke=document.createElement("error");Ke.setAttribute("id","SpyCamAlert"),Ke.innerText="Verifica\xE7\xE3o de Spy Cam",Ke.style.marginLeft="10px";let de=document.createElement("span"),ge=document.createElement("div"),Xe=document.createElement("div");de.setAttribute("id","checkmark_SpyCam"),ge.setAttribute("id","checkmark_stem_SpyCam"),Xe.setAttribute("id","checkmark_kick_SpyCam"),de.appendChild(ge),de.appendChild(Xe),Ce.appendChild(de),Ce.appendChild(Ke),b.style.transform="rotateY(180deg)",b.style.display="flex",b.style.flexDirection="column",b.style.flex="1",b.style.minWidth="0",b.appendChild(S),b.appendChild(U),b.appendChild(B),b.appendChild(Ce),f.appendChild(b),m.appendChild(u),m.style.flexShrink="0",f.appendChild(m);let ve=document.createElement("div");ve.setAttribute("class","facial-biometry__mask"),ve.style.width="100%",ve.style.height="100%",ve.style.position="absolute",ve.style.top="0px",ve.style.left="0px",ve.style.backgroundColor="#fff",ve.style.opacity="0.6";let it=document.createElement("div");it.setAttribute("class","biometry__frame"),it.style.width="100%",it.style.height="100%",it.style.position="absolute",it.style.top="0px",it.style.left="0px",it.style.zIndex="10",m.appendChild(ve),m.appendChild(it),i.appendChild(f);let ut=document.createElement("div");ut.setAttribute("class","mic-header-responsive");let p=document.createElement("h3"),N=document.createElement("select");N.setAttribute("id","micSelect");let O={padding:"0 20px",width:"100%",display:"flex",justifyContent:"space-between",margin:"15px 0"};this.applyStyles(ut,O),p.innerText="Microfone";let w={color:"rgba(0, 0, 0, .7)",fontWeight:"bold",fontSize:"16px"};this.applyStyles(p,w),N.style.maxWidth="400px",N.style.minWidth="150px",N.style.width="100%",N.style.boxSizing="border-box",ut.appendChild(p),ut.appendChild(N),i.appendChild(ut);let v=document.createElement("div");v.setAttribute("class","mic-container-responsive");let C={width:"100%",padding:"0px 20px",display:"flex",boxSizing:"border-box"};this.applyStyles(v,C);let z=document.createElement("div");z.setAttribute("class","mic-meter-responsive");let j={display:"flex",flexDirection:"column",justifyContent:"space-between",paddingBottom:"15px"};this.applyStyles(z,j);let A=document.createElement("div");A.setAttribute("id","audioStream");let $={display:"flex",marginBottom:"15px"};this.applyStyles(A,$);let K={height:"16px",width:"5px",marginRight:"5px",borderRadius:"10px",backgroundColor:"rgba(0, 0, 0, .3)"};for(let rp=0;rp<25;rp++){let np=document.createElement("div");this.applyStyles(np,K),A.appendChild(np)}let W=document.createElement("div");W.setAttribute("class","range-responsive");let re=document.createElement("p"),ke=document.createElement("p"),ue=document.createElement("p"),kt={width:"100%",maxWidth:"250px",display:"flex",justifyContent:"space-between",boxSizing:"border-box"};this.applyStyles(W,kt),re.innerText="0",ke.innerText="50",ue.innerText="100",W.appendChild(re),W.appendChild(ke),W.appendChild(ue);let Kt=document.createElement("div");Kt.setAttribute("class","alert-div"),Kt.setAttribute("id","alertDivMicrophone");let Xt={display:"flex",alignItems:"center",justifyContent:"center",width:"100%"};this.applyStyles(Kt,Xt);let Tr=document.createElement("error");Tr.setAttribute("id","microphoneAlert"),Tr.innerText="Teste de funcionamento",Tr.style.marginLeft="10px";let Ie=document.createElement("span"),Pn=document.createElement("div"),oi=document.createElement("div");Ie.setAttribute("id","checkmark_microphone"),Pn.setAttribute("id","checkmark_stem_microphone"),oi.setAttribute("id","checkmark_kick_microphone"),Ie.appendChild(Pn),Ie.appendChild(oi),Kt.appendChild(Ie),Kt.appendChild(Tr),z.appendChild(A),z.appendChild(W);let gt=document.createElement("p");gt.setAttribute("class","pronounce-responsive"),gt.innerText='Pronuncie em voz alta: "Testando..."',gt.style.textAlign="start";let bs={width:"calc(100% - 40px)",marginLeft:"20px",marginRight:"20px",marginBottom:"15px",boxSizing:"border-box",padding:"0 10px"};this.applyStyles(gt,bs),v.appendChild(z),v.appendChild(Kt),i.appendChild(gt),i.appendChild(v);let Dn=document.createElement("div"),ul={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)",boxSizing:"border-box"};this.applyStyles(Dn,ul);let Bn=document.createElement("button");Bn.setAttribute("id","cancelBtn"),Bn.setAttribute("class","button-responsive"),Bn.innerText="Cancelar";let vs={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(Bn,vs);let jr=document.createElement("span");jr.setAttribute("class","divider-responsive");let si={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(jr,si);let On=document.createElement("button");On.innerText="Continuar",On.setAttribute("id","confirmBtn"),On.setAttribute("class","button-responsive");let xy={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(On,xy),this.options.useSpyScan&&(On.style.cursor="not-allowed",On.setAttribute("disabled","true")),Dn.appendChild(Bn),Dn.appendChild(jr),Dn.appendChild(On),i.appendChild(Dn),r.appendChild(i),document.body.appendChild(r)}async setSelectOption(t,r){let n=document.querySelector("#cameraSelect"),i=document.querySelector("#micSelect"),o=await pr();n&&(n.value=t.cameraId||"default"),i&&(i.value=t.microphoneId||"default");let s=(a,c)=>{let l=document.createElement("option");return l.setAttribute("value",c),l.innerHTML=a,l};o.cameras.forEach(a=>{let c=s(a.label,a.id);n?.appendChild(c)}),o.microphones.forEach(a=>{let c=s(a.label,a.id);i?.appendChild(c)}),this.onSelectOptionChange(a=>r(a))}async onSelectOptionChange(t){let r=document.querySelector("#cameraSelect"),n=document.querySelector("#micSelect");r?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value})),n?.addEventListener("change",()=>t({cameraId:r?.value,microphoneId:n?.value}))}closeModal(){document.querySelector("#checkDevices")?.remove()}modalActions(t){let r=document.getElementById("cancelBtn"),n=document.getElementById("confirmBtn"),i=document.getElementById("cameraSelect"),o=document.getElementById("micSelect");return new Promise((s,a)=>{r?.addEventListener("click",()=>{t(),this.closeModal(),a({result:!1})}),n?.addEventListener("click",()=>{n.disabled||(t(),this.closeModal(),s({cameraId:i?.value,microphoneId:o?.value,result:!0}))})})}realtimeAlertsUI(t){let r=document.getElementById("facePositionAlert"),n=document.getElementById("ambientVerifyAlert"),i=document.getElementById("alertDivFacePosition"),o=document.getElementById("info_FacePosition"),s=document.getElementById("checkmark_FacePosition"),a=document.getElementById("checkmark_stem_FacePosition"),c=document.getElementById("checkmark_kick_FacePosition"),l=document.getElementById("alertDivAmbientVerify"),h=document.getElementById("checkmark_AmbientVerify"),d=document.getElementById("checkmark_stem_AmbientVerify"),g=document.getElementById("checkmark_kick_AmbientVerify");t.status==="OK"?(r&&(r.style.color="#16A34A"),n&&(n.style.color="#16A34A"),i&&i.setAttribute("title",""),o&&(o.style.display="none"),l&&l.setAttribute("title",""),s&&(s.setAttribute("class","checkmark"),a.setAttribute("class","checkmark_stem"),c.setAttribute("class","checkmark_kick")),h&&(h.setAttribute("class","checkmark"),d.setAttribute("class","checkmark_stem"),g.setAttribute("class","checkmark_kick"))):(s&&(t.type==="position_detection_on_stream"||t.type==="face_detection_on_stream")&&(r&&(r.style.color="#FF0000"),o&&(o.style.display="block"),i&&i.setAttribute("title",t.description),s.setAttribute("class","checkmark_error"),a.setAttribute("class","checkmark_stem_error"),c.setAttribute("class","checkmark_kick_error")),h&&t.description==="M\xFAltiplas faces detectadas"&&(n&&(n.style.color="#FF0000"),l&&l.setAttribute("title",`${t.description}`),h.setAttribute("class","checkmark_error"),d.setAttribute("class","checkmark_stem_error"),g.setAttribute("class","checkmark_kick_error")))}waitingSpyDevices(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("alertDivSpyCam");if(n&&(n.style.display="flex"),t){r&&(r.style.color="#c7c7c7"),r&&(r.innerText="Verificando Spy Cam...");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","true"),i&&(i.style.cursor="not-allowed")}else{r&&(r.style.color="#16A34A"),r&&(r.innerText="Verifica\xE7\xE3o de Spy Cam");let i=document.getElementById("confirmBtn");i&&i.setAttribute("disabled","false"),i&&(i.style.cursor="pointer")}}isSpyDevicesUI(t){let r=document.getElementById("SpyCamAlert"),n=document.getElementById("confirmBtn"),i=document.getElementById("alertDivSpyCam");i&&(i.style.display="flex");let o=document.getElementById("checkmark_SpyCam"),s=document.getElementById("checkmark_stem_SpyCam"),a=document.getElementById("checkmark_kick_SpyCam");t?(r&&(r.style.color="#16A34A"),o&&(o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick"))):o&&(r&&(r.style.color="#FF0000"),o.setAttribute("class","checkmark_error"),s.setAttribute("class","checkmark_stem_error"),a.setAttribute("class","checkmark_kick_error")),this.options.useSpyScan&&n?.removeAttribute("disabled"),n&&(n.style.cursor="pointer")}isUnderResolutionUI(t){let r=document.getElementById("resolutionAlert"),n=document.getElementById("alertDivResolution"),i=document.getElementById("info_resolution"),o=document.getElementById("checkmark_resolution"),s=document.getElementById("checkmark_stem_resolution"),a=document.getElementById("checkmark_kick_resolution");t?(r.style.color="#16A34A",i&&(i.style.display="none"),r.setAttribute("title",""),o.setAttribute("class","checkmark"),s.setAttribute("class","checkmark_stem"),a.setAttribute("class","checkmark_kick")):(r.style.color="#FF0000",i&&(i.style.display="block"),n.setAttribute("title",`A c\xE2mera n\xE3o satisfaz a resolu\xE7\xE3o m\xEDnima exigida (${this.videoOptions.minWidth}x${this.videoOptions.minHeight}).
373
371
  Para iniciar um exame utilize uma outra c\xE2mera.`),o.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().catch(n=>{console.warn("Erro ao iniciar preview de v\xEDdeo:",n)}))}audioDeviceInterfaceUIAllowedAmbient(t){let r=document.getElementById("ambientVerifyAlert"),n=document.getElementById("alertDivAmbientVerify"),i=document.getElementById("checkmark_AmbientVerify"),o=document.getElementById("checkmark_stem_AmbientVerify"),s=document.getElementById("checkmark_kick_AmbientVerify");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),i.setAttribute("class","checkmark"),o.setAttribute("class","checkmark_stem"),s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Ambiente apresentando muito ru\xEDdo!"),i.setAttribute("class","checkmark_error"),o.setAttribute("class","checkmark_stem_error"),s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIMicrophoneWorks(t){let r=document.getElementById("microphoneAlert"),n=document.getElementById("alertDivMicrophone"),i=document.getElementById("checkmark_microphone"),o=document.getElementById("checkmark_stem_microphone"),s=document.getElementById("checkmark_kick_microphone");t?(r&&(r.style.color="#16A34A"),n&&n.setAttribute("title",""),i&&i.setAttribute("class","checkmark"),o&&o.setAttribute("class","checkmark_stem"),s&&s.setAttribute("class","checkmark_kick")):(r&&(r.style.color="#FF0000"),n&&n.setAttribute("title","Microfone n\xE3o est\xE1 funcionando corretamente!"),i&&i.setAttribute("class","checkmark_error"),o&&o.setAttribute("class","checkmark_stem_error"),s&&s.setAttribute("class","checkmark_kick_error"))}audioDeviceInterfaceUIErrorExec(){let t=document.getElementById("microphoneAlert"),r=document.getElementById("checkmark_microphone"),n=document.getElementById("checkmark_stem_microphone"),i=document.getElementById("checkmark_kick_microphone");t&&(t.style.color="#FF0000"),r&&r.setAttribute("class","checkmark_error"),n&&n.setAttribute("class","checkmark_stem_error"),i&&i.setAttribute("class","checkmark_kick_error")}audioDeviceInterfaceUIPills(t){let n=document.querySelector("#audioStream")?.querySelectorAll("div"),i=document.querySelector("#audioText"),o=t/4;n?.forEach((s,a)=>{a<Math.ceil(o)?s.style.backgroundColor="rgb(22, 163, 74)":s.style.backgroundColor="rgba(0, 0, 0, .3)"}),i&&(i.innerText=t.toFixed(0).toString())}async addStyleMask(){let t=`
374
372
  .facial-biometry__mask {
375
373
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
@@ -399,7 +397,7 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),o.setAttribute("class","che
399
397
  // -webkit-mask-position: center;
400
398
  // -webkit-mask-repeat: no-repeat;
401
399
  }
402
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}};var Vr=class{constructor(t){this.deviceCheckResult=null;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 Lo({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new Sr({type:t?.type||"prod",token:t.token,isRealtime:!1})}getDeviceCheckResult(){return this.deviceCheckResult}async runCheckDevicesFlow(t,r,n,i,o){if(Vr.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");this.options={...ar,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},Vr.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r);this.options?.useSpyScan&&await this.checkSpyScan();let a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>o(l);let c=new Promise((l,d)=>{n(()=>{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}),Vr.isModalOpen=!1}),i(()=>{this.closeCheckDevices(),l({result:!1}),Vr.isModalOpen=!1})});return this.deviceCheckResult={...a,result:c},{...a,result:c}}catch(s){throw this.closeCheckDevices(),Vr.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=ar,r=o0){if(Vr.isModalOpen)return Promise.reject();this.allowedAmbient=!1,this.allowedMicrophone=!1,this.allowedAmbient=!1,this.allowedPositionFace=!1,Vr.isModalOpen=!0,this.DeviceCheckerUI=new ch(t,r);try{this.options={...ar,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let n=await this.backend.getParamsConfig(this.context);this.noiseLimit=n.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r),await this.checkSpyScan();let{cameraId:i,microphoneId:o,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{let c={result:s,cameraId:i,microphoneId:o,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts};this.deviceCheckResult=c,a(c)})}catch(n){return this.DeviceCheckerUI&&this.DeviceCheckerUI.closeModal(),this.closeCheckDevices(),Promise.reject(n)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings(),{width:r=0,height:n=0}=t;screen.orientation?.type.includes("portrait")&&Er()&&this.videoOptions.width==n&&this.videoOptions.height==r&&([r,n]=[n,r]),this.videoOptions.minWidth>r||this.videoOptions.minHeight>n?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,1e3)}audioDeviceInterface(t){this.volumeMeter=new Yn(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.stopStream&&await this.cameraRecorder.stopStream(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new zr({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startStream(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=ar,r){if(this.allowedAmbient=!1,this.allowedMicrophone=!1,this.allowedAmbient=!1,this.allowedPositionFace=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,n=>this.changeSelectedDevice(n)),this.videoOptions=Wa(r),await Rs(),this.cameraRecorder=new zr({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startStream(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let n=document.querySelector("#confirmBtn");!this.options.useSpyScan&&(n.disabled=!1)}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){Vr.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopStream&&await this.cameraRecorder.stopStream(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}async checkSpyScan(){if(this.spycam=new Jo(this.context,{}),this.allowedSpyScan=null,this.options.useSpyScan){this.DeviceCheckerUI&&this.DeviceCheckerUI.waitingSpyDevices(!0);try{await this.spycam.isPluggedIn()?await this.spycam.devices({deviceType:qi.POTENCIAL_CAMERA}).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)}}}},Ya=Vr;Ya.isModalOpen=!1;var Zo=class{constructor(){}async takePicture(t,r,n={width:1080,height:720}){return this.resolution=n,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),n={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 zr({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startStream(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),n=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),n.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((n,i)=>{let o=document.createElement("div");o.setAttribute("id","authPhoto"),o.style.backgroundColor="rgba(0,0,0,0.4)",o.style.zIndex="1000",o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.height="100vh",o.style.width="100%",o.style.display="flex",o.style.alignItems="center",o.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"),h=document.createElement("select");h.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(h);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 g=document.createElement("canvas");g.setAttribute("id","canvas"),g.style.display="none",g.style.width="100%",g.style.height="100%";let u=document.createElement("img");u.setAttribute("id","image"),u.style.objectFit="contain",u.style.display="none",u.style.borderRadius="8px",m.appendChild(g),m.appendChild(u);let b=document.createElement("div");b.setAttribute("class","facial-biometry__mask"),b.style.width="100%",b.style.height="100%",b.style.position="absolute",b.style.top="0px",b.style.left="0px",b.style.backgroundColor="#fff",b.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(b),m.appendChild(v),s.appendChild(m),this.addStyleMask();let k=document.createElement("button"),S=document.createElement("div");k.setAttribute("id","confirmBtn"),S.style.position="fixed",S.style.bottom="0",S.style.left="0",S.style.width="100%",S.style.display="flex",S.style.alignItems="center",S.style.justifyContent="center",k.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",k.style.width="70px",k.style.height="70px",k.style.borderRadius="70px",k.style.border="none",k.style.backgroundColor="#16a34a",k.style.margin="20px";let I=document.createElement("button");I.setAttribute("id","closeModal"),I.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",I.style.width="70px",I.style.height="70px",I.style.borderRadius="70px",I.style.border="none",I.style.backgroundColor="#e74141",I.style.margin="20px",S.appendChild(I),S.appendChild(k),s.appendChild(S);let x=document.createElement("button");x.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",x.style.width="70px",x.style.height="70px",x.style.borderRadius="70px",x.style.border="none",x.style.backgroundColor="#e74141",x.style.margin="20px 20px";let B=document.createElement("button");B.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",B.style.width="70px",B.style.height="70px",B.style.borderRadius="70px",B.style.border="none",B.style.backgroundColor="#16a34a",B.style.margin="20px 20px",o.appendChild(s),document.body.appendChild(o),this.setSelectOption(),this.startCapture(),k.addEventListener("click",()=>{S.removeChild(k),S.removeChild(I),S.appendChild(x),S.appendChild(B),this.shot(),this.closeInterface(),n({base64:this.base64})}),x.addEventListener("click",()=>{S.appendChild(I),S.appendChild(k),S.removeChild(x),S.removeChild(B)}),B.addEventListener("click",()=>{this.closeInterface(),n({base64:this.base64})}),I.addEventListener("click",()=>{this.closeInterface(),i(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await mr();t&&(t.value="default");let n=(i,o)=>{let s=document.createElement("option");return s.setAttribute("value",o),s.innerHTML=i,s};r.cameras.forEach(i=>{let o=n(i.label,i.id);t?.appendChild(o)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopStream(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
400
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}};var Ha=class e{constructor(t){this.deviceCheckResult=null;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 Ui({onRealtimeAlertsCallback:r=>this.realtimeAlerts(r)},{videoBehaviourParameters:{detectFace:!0}},"cameraStream","liveCheckDevices"),this.context=t,this.backend=new ir({type:t?.type||"prod",token:t.token,isRealtime:!1})}static{this.isModalOpen=!1}getDeviceCheckResult(){return this.deviceCheckResult}async runCheckDevicesFlow(t,r,n,i,o){if(e.isModalOpen)return Promise.reject("Modal j\xE1 est\xE1 aberto");this.options={...or,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},e.isModalOpen=!0;try{await this.faceDetection.initializeDetector();let{cameraStream:s}=await this.startCheckDevices(t,r);this.options?.useSpyScan&&await this.checkSpyScan();let a={cameraStream:this.cameraRecorder.cameraStream};this.onUpdateCb=l=>o(l);let c=new Promise((l,h)=>{n(()=>{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}),e.isModalOpen=!1}),i(()=>{this.closeCheckDevices(),l({result:!1}),e.isModalOpen=!1})});return this.deviceCheckResult={...a,result:c},{...a,result:c}}catch(s){throw this.closeCheckDevices(),e.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=or,r=Kg){if(e.isModalOpen)return Promise.reject();this.allowedAmbient=!1,this.allowedMicrophone=!1,this.allowedAmbient=!1,this.allowedPositionFace=!1,e.isModalOpen=!0,this.DeviceCheckerUI=new Va(t,r);try{this.options={...or,...t,captureScreen:!1,allowMultipleMonitors:!0,allowOnlyFirstMonitor:!1},this.videoOptions={...this.videoOptions,...r};let n=await this.backend.getParamsConfig(this.context);this.noiseLimit=n.audioBehaviourParameters?.noiseLimit||40,await this.faceDetection.initializeDetector(),this.DeviceCheckerUI.checkDevicesInterface(),this.startCheckDevices(t,r),await this.checkSpyScan();let{cameraId:i,microphoneId:o,result:s}=await this.DeviceCheckerUI.modalActions(()=>this.closeCheckDevices());return new Promise(a=>{let c={result:s,cameraId:i,microphoneId:o,volumeRange:this.volumeMedia,allowedResolution:this.allowedResolution,allowedPositionFace:this.allowedPositionFace,allowedAmbient:this.allowedAmbient,allowedMicrophone:this.allowedMicrophone,allowedSpyScan:this.allowedSpyScan,faceDetectionAlerts:this.faceDetectionAlerts};this.deviceCheckResult=c,a(c)})}catch(n){return this.DeviceCheckerUI&&this.DeviceCheckerUI.closeModal(),this.closeCheckDevices(),Promise.reject(n)}}isUnderResolution(){let t=this.cameraRecorder.cameraStream.getVideoTracks()[0].getSettings(),{width:r=0,height:n=0}=t;screen.orientation?.type.includes("portrait")&&_r()&&this.videoOptions.width==n&&this.videoOptions.height==r&&([r,n]=[n,r]),this.videoOptions.minWidth>r||this.videoOptions.minHeight>n?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,1e3)}audioDeviceInterface(t){this.volumeMeter=new gn(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.stopStream&&await this.cameraRecorder.stopStream(),this.volumeMeter?.stop(),this.faceDetection.stopDetection(),this.cameraRecorder=new Zr({cameraId:t,microphoneId:r,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startStream(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),{cameraStream:this.cameraRecorder.cameraStream}}async startCheckDevices(t=or,r){if(this.allowedAmbient=!1,this.allowedMicrophone=!1,this.allowedAmbient=!1,this.allowedPositionFace=!1,this.DeviceCheckerUI&&this.DeviceCheckerUI.setSelectOption(t,n=>this.changeSelectedDevice(n)),this.videoOptions=Oa(r),await _s(),this.cameraRecorder=new Zr({cameraId:t.cameraId,microphoneId:t.microphoneId,onBufferSizeError:!1,onBufferSizeErrorCallback:()=>{}},{width:this.videoOptions.width,height:this.videoOptions.height}),await this.cameraRecorder.startStream(),this.videoDeviceInterface(this.cameraRecorder.cameraStream),this.audioDeviceInterface(this.cameraRecorder.cameraStream),this.DeviceCheckerUI){let n=document.querySelector("#confirmBtn");!this.options.useSpyScan&&(n.disabled=!1)}return{cameraStream:this.cameraRecorder.cameraStream}}async closeCheckDevices(){e.isModalOpen=!1,this.faceDetection.stopDetection(),this.volumeMeter?.stop(),this.volumeMedia=Math.ceil(this.volumeSum/this.volumeCounter),this.cameraRecorder.stopStream&&await this.cameraRecorder.stopStream(),this.DeviceCheckerUI=void 0,this.onUpdateCb=void 0}async checkSpyScan(){if(this.spycam=new Vi(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)}}}};var $i=class{constructor(){}async takePicture(t,r,n={width:1080,height:720}){return this.resolution=n,await this.takePictureInterface(t,r)}async startCapture(t="default"){let r=document.querySelector("#cameraStream"),n={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 Zr({cameraId:t,onBufferSizeErrorCallback:()=>{}},{...this.resolution}),await this.cameraRecorder.startStream(),r.srcObject=this.cameraRecorder.cameraStream,r.play()}shot(){let t=document.querySelector("#cameraStream"),r=document.querySelector("#canvas"),n=document.querySelector("#image");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d").drawImage(t,0,0,t.videoWidth,t.videoHeight),n.src=r.toDataURL("image/jpg"),this.base64=r.toDataURL("image/jpg")}takePictureInterface(t,r){return new Promise((n,i)=>{let o=document.createElement("div");o.setAttribute("id","authPhoto"),o.style.backgroundColor="rgba(0,0,0,0.4)",o.style.zIndex="1000",o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.height="100vh",o.style.width="100%",o.style.display="flex",o.style.alignItems="center",o.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"),h=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",h.innerText="C\xE2mera",h.style.color="rgba(0, 0, 0, .75)",h.style.fontWeight="bold",h.style.fontSize="16px",l.appendChild(h),l.appendChild(d);let g=document.createElement("div"),f=document.createElement("video");f.setAttribute("id","cameraStream"),f.muted=!0,g.style.position="fixed",g.style.top="0",g.style.left="0",g.style.height="100vh",g.style.width="100%",g.style.display="flex",g.style.justifyContent="center",f.style.backgroundColor="#000",f.style.borderRadius="10px",f.style.width="auto",f.style.height="auto",f.style.minHeight="100%",g.appendChild(f);let m=document.createElement("canvas");m.setAttribute("id","canvas"),m.style.display="none",m.style.width="100%",m.style.height="100%";let u=document.createElement("img");u.setAttribute("id","image"),u.style.objectFit="contain",u.style.display="none",u.style.borderRadius="8px",g.appendChild(m),g.appendChild(u);let b=document.createElement("div");b.setAttribute("class","facial-biometry__mask"),b.style.width="100%",b.style.height="100%",b.style.position="absolute",b.style.top="0px",b.style.left="0px",b.style.backgroundColor="#fff",b.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",g.appendChild(b),g.appendChild(_),s.appendChild(g),this.addStyleMask();let k=document.createElement("button"),S=document.createElement("div");k.setAttribute("id","confirmBtn"),S.style.position="fixed",S.style.bottom="0",S.style.left="0",S.style.width="100%",S.style.display="flex",S.style.alignItems="center",S.style.justifyContent="center",k.style.background="url('https://iarisprod.blob.core.windows.net/imagens/camera.svg') no-repeat center",k.style.width="70px",k.style.height="70px",k.style.borderRadius="70px",k.style.border="none",k.style.backgroundColor="#16a34a",k.style.margin="20px";let I=document.createElement("button");I.setAttribute("id","closeModal"),I.style.background="url('https://iarisprod.blob.core.windows.net/imagens/close.svg') no-repeat center",I.style.width="70px",I.style.height="70px",I.style.borderRadius="70px",I.style.border="none",I.style.backgroundColor="#e74141",I.style.margin="20px",S.appendChild(I),S.appendChild(k),s.appendChild(S);let x=document.createElement("button");x.style.background="url('https://easyproctor-public.s3.us-east-2.amazonaws.com/images/retry.svg') no-repeat center",x.style.width="70px",x.style.height="70px",x.style.borderRadius="70px",x.style.border="none",x.style.backgroundColor="#e74141",x.style.margin="20px 20px";let D=document.createElement("button");D.style.background="url('https://iarisprod.blob.core.windows.net/imagens/check.svg') no-repeat center",D.style.width="70px",D.style.height="70px",D.style.borderRadius="70px",D.style.border="none",D.style.backgroundColor="#16a34a",D.style.margin="20px 20px",o.appendChild(s),document.body.appendChild(o),this.setSelectOption(),this.startCapture(),k.addEventListener("click",()=>{S.removeChild(k),S.removeChild(I),S.appendChild(x),S.appendChild(D),this.shot(),this.closeInterface(),n({base64:this.base64})}),x.addEventListener("click",()=>{S.appendChild(I),S.appendChild(k),S.removeChild(x),S.removeChild(D)}),D.addEventListener("click",()=>{this.closeInterface(),n({base64:this.base64})}),I.addEventListener("click",()=>{this.closeInterface(),i(new Error("User does not captured photo"))})})}async setSelectOption(){let t=document.querySelector("#cameraSelect"),r=await pr();t&&(t.value="default");let n=(i,o)=>{let s=document.createElement("option");return s.setAttribute("value",o),s.innerHTML=i,s};r.cameras.forEach(i=>{let o=n(i.label,i.id);t?.appendChild(o)}),this.onSelectOptionChange()}async onSelectOptionChange(){let t=document.querySelector("#cameraSelect");t?.addEventListener("change",async()=>{this.startCapture(t?.value)})}async closeInterface(){await this.cameraRecorder.stopStream(),document.querySelector("#authPhoto")?.remove()}async addStyleMask(){let t=`
403
401
  .facial-biometry__mask {
404
402
  mask-image: url('https://iarisprod.blob.core.windows.net/imagens/square.svg'), url('https://iarisprod.blob.core.windows.net/imagens/face-mask.svg');
405
403
  mask-size: cover, auto 65%;
@@ -428,19 +426,19 @@ Para iniciar um exame utilize uma outra c\xE2mera.`),o.setAttribute("class","che
428
426
  // -webkit-mask-position: center;
429
427
  // -webkit-mask-repeat: no-repeat;
430
428
  }
431
- `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var lh=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,n)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),n(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,n)=>{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 dh=class{constructor(t,r,n,i){this.repositoryDevices=t,this.proctoringId=r,this.sessionOptions=n,this.allRecorders=i}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await mr(),n=(f,g)=>f.label===g.label&&f.id===g.id,i=(f,g,u)=>f.filter(b=>!g.some(v=>u(b,v))),o=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:o?.cameras||[s],microphones:o?.microphones||[s]},c=r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out",l=[],d=[],h=!1;if(r.cameras.length!=a?.cameras.length){let f=c==="out"?i(a?.cameras,r.cameras,n):[],g=c==="in"?i(r.cameras,a?.cameras,n):[];l=c==="out"?f:g,l=l.filter(u=>u.id!="default"),console.log(f),console.log(this.sessionOptions.cameraId),c==="out"&&(h=f.some(u=>u.id===this.sessionOptions.cameraId))}if(r.microphones.length!=a?.microphones.length){let f=c==="out"?i(a?.microphones,r.microphones,n):[],g=c==="in"?i(r.microphones,a?.microphones,n):[];d=c==="out"?f:g,d=d.filter(u=>u.id!="default"&&u.id!="communications"),c==="out"&&!h&&(h=f.some(u=>u.id===this.sessionOptions.microphoneId))}let m={cameras:l||[],microphones:d||[],status:c,isActiveDevice:h};await this.repositoryDevices.save({...r,id:"devices",status:c}),t.status&&(m.cameras.length!=0||m.microphones.length!=0)&&(ie.registerChangeDevice(this.proctoringId,m.status,JSON.stringify(m,null,2)),m.isActiveDevice&&this.allRecorders.alertRecorder.addAlert({alert:De.ChangeDevices,type:ft.Video}),t.status(m))}};var S0=Qc(k0()),Qo=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:i}=t;try{ie.registerDownloadFile(this.proctoringId,`File to download
429
+ `,r=document.createElement("style");r.innerHTML=t,document.head.appendChild(r)}};var Wa=class{constructor(){this.hasExtension=!1;this.tryes=0;this.responseStart=!1}start(){let t;return new Promise((r,n)=>{window.postMessage({type:"easyproctor",func:"startExtensionEasyproctor"},"*"),t=setInterval(()=>{this.tryes>10&&(clearInterval(t),n(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,n)=>{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 $a=class{constructor(t,r,n,i){this.repositoryDevices=t,this.proctoringId=r,this.sessionOptions=n,this.allRecorders=i}startRecording(t){navigator.mediaDevices.ondevicechange=()=>{this.onChangeDevices(t)}}async onChangeDevices(t){let r=await pr(),n=(f,m)=>f.label===m.label&&f.id===m.id,i=(f,m,u)=>f.filter(b=>!m.some(_=>u(b,_))),o=await this.repositoryDevices.getDevices("devices"),s={label:"",id:""},a={cameras:o?.cameras||[s],microphones:o?.microphones||[s]},c=r.cameras.length>a?.cameras.length||r.microphones.length>a?.microphones.length?"in":"out",l=[],h=[],d=!1;if(r.cameras.length!=a?.cameras.length){let f=c==="out"?i(a?.cameras,r.cameras,n):[],m=c==="in"?i(r.cameras,a?.cameras,n):[];l=c==="out"?f:m,l=l.filter(u=>u.id!="default"),console.log(f),console.log(this.sessionOptions.cameraId),c==="out"&&(d=f.some(u=>u.id===this.sessionOptions.cameraId))}if(r.microphones.length!=a?.microphones.length){let f=c==="out"?i(a?.microphones,r.microphones,n):[],m=c==="in"?i(r.microphones,a?.microphones,n):[];h=c==="out"?f:m,h=h.filter(u=>u.id!="default"&&u.id!="communications"),c==="out"&&!d&&(d=f.some(u=>u.id===this.sessionOptions.microphoneId))}let g={cameras:l||[],microphones:h||[],status:c,isActiveDevice:d};await this.repositoryDevices.save({...r,id:"devices",status:c}),t.status&&(g.cameras.length!=0||g.microphones.length!=0)&&(pe.registerChangeDevice(this.proctoringId,g.status,JSON.stringify(g,null,2)),g.isActiveDevice&&this.allRecorders.alertRecorder.addAlert({alert:39,type:2}),t.status(g))}};var u0=fl(d0()),Gi=class{constructor(t){this.loadingBoolean=!0;this.proctoringId=t}async upload(t,r){let{file:n,onProgress:i}=t;try{pe.registerDownloadFile(this.proctoringId,`File to download
432
430
  File name: ${n.name}
433
431
  File type: ${n.type}
434
- File size: ${n.size}}`),(0,S0.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),i&&i(Math.round(100))}catch(o){throw n&&this.proctoringId&&ie.registerError(this.proctoringId,`Failed on machine download
432
+ File size: ${n.size}}`),(0,u0.saveAs)(n),this.loadingBoolean=!1,clearInterval(this.loadingInterval),i&&i(Math.round(100))}catch{throw n&&this.proctoringId&&pe.registerError(this.proctoringId,`Failed on machine download
435
433
  File name: ${n.name}
436
434
  File type: ${n.type}
437
- File size: ${n.size}`),new Error("Error on machine download")}}};var ph=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 es=class{constructor(t,r,n){this.session=t;this.proctoringId=r;this.uploadServices=n}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 n=0;n<this.session.recordings.length;n++){let i=this.session.recordings[n];if(i.upload)continue;let o=a=>{let c=(n*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(i,t,o).catch(()=>{});s&&(i.upload||(i.upload={storage:_n.none,awsUrl:"",azureUrl:""}),s.uploaded&&(i.upload.storage=s.storage),s.storage===_n.none?s.url&&(i.upload.azureUrl=s.url):s.url&&(i.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,n){for await(let i of this.uploadServices){let o=await i.upload({file:t.file,onProgress:s=>{n&&n(s)}},r).catch(async s=>{console.log("Upload File Error",s),ie.registerError(this.proctoringId,`Upload File
435
+ File size: ${n.size}`),new Error("Error on machine download")}}};var Ga=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 qi=class{constructor(t,r,n){this.session=t;this.proctoringId=r;this.uploadServices=n}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 n=0;n<this.session.recordings.length;n++){let i=this.session.recordings[n];if(i.upload)continue;let o=a=>{let c=(n*100+a)/this.session.recordings.length;r&&r(c)},s=await this.uploadFile(i,t,o).catch(()=>{});s&&(i.upload||(i.upload={storage:"upload",awsUrl:"",azureUrl:""}),s.uploaded&&(i.upload.storage=s.storage),s.storage==="upload"?s.url&&(i.upload.azureUrl=s.url):s.url&&(i.upload.awsUrl=s.url))}r&&r(100)}async uploadFile(t,r,n){for await(let i of this.uploadServices){let o=await i.upload({file:t.file,onProgress:s=>{n&&n(s)}},r).catch(async s=>{console.log("Upload File Error",s),pe.registerError(this.proctoringId,`Upload File
438
436
  Name: ${t.file.name}
439
437
  Error: ${s.message}
440
- Size: ${s.error}`),await i.upload({file:t.file,onProgress:a=>{n&&n(a)}},r)});if(o){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"),ie.registerUploadFile(this.proctoringId,`Upload File
438
+ Size: ${s.error}`),await i.upload({file:t.file,onProgress:a=>{n&&n(a)}},r)});if(o){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"),pe.registerUploadFile(this.proctoringId,`Upload File
441
439
  Name: ${t.file.name}
442
440
  Type: ${t.file.type}
443
- Size: ${t.file.size}`,s),o}}throw new Error("Could not upload")}};var fh=class{constructor(t,r){this.alerts=[];this.lastActivityTime=Date.now();this.IDLE_THRESHOLD_MS=3e4;this.handleVisibilityChange=()=>{document.visibilityState==="visible"?this.handleReturnFocus():this.handleLostFocus()};this.handleLostFocus=()=>{if(this.getRelativeTime()>1e4){let t={begin:this.getRelativeTime(),end:0,alert:De.FocusOff,type:ft.Screen};this.onLostFocusCallback(t),this.alerts.push(t)}};this.handleReturnFocus=()=>{let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback({begin:t.begin,end:this.getRelativeTime(),alert:De.FocusOff,type:ft.Screen}),t.end=this.getRelativeTime())};this.handleResize=()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{let t=window.screen.availWidth,r=window.outerWidth;if(r<t*.85){let n=`Split Screen Detectado: Janela ocupa ${(r/t*100).toFixed(0)}% da tela`;this.createAlert(De.SplitScreen,ft.Screen,n),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:n,type:"split_screen"})}},1e3)};this.handleUserActivity=t=>{this.lastActivityTime=Date.now(),console.log("\u{1F449} handleUserActivity",t)};this.handleCopy=t=>{t.preventDefault();let r="Tentativa de Copiar (Clipboard)";this.createAlert(De.ClipBoardUse,ft.Screen,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_copy"})};this.handleCut=t=>{t.preventDefault();let r="Tentativa de Recortar (Clipboard)";this.createAlert(De.ClipBoardUse,ft.Screen,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_cut"})};this.handlePaste=t=>{t.preventDefault();let r="Tentativa de Colar (Clipboard)";this.createAlert(De.ClipBoardUse,ft.Screen,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_paste"})};this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.onRealtimeAlertCallback=t.onRealtimeAlertCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.alerts=[],this.attachListeners()}async pauseRecording(){this.detachListeners()}async resumeRecording(){this.attachListeners()}async stopRecording(){this.detachListeners()}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}attachListeners(){this.optionsProctoring.captureScreen&&(window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("resize",this.handleResize),window.document.addEventListener("copy",this.handleCopy),window.document.addEventListener("cut",this.handleCut),window.document.addEventListener("paste",this.handlePaste))}detachListeners(){window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("resize",this.handleResize),window.document.removeEventListener("copy",this.handleCopy),window.document.removeEventListener("cut",this.handleCut),window.document.removeEventListener("paste",this.handlePaste)}addBackgroundEvent(t,r=De.System){this.createAlert(r,ft.Screen,t),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:t,type:"background_event"})}getRelativeTime(){return Date.now()-this.startTime.getTime()}createAlert(t,r,n){this.alerts.push({begin:this.getRelativeTime(),end:this.getRelativeTime(),alert:t,type:r})}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var Qn=typeof self!="undefined"?self:{};function ei(){throw Error("Invalid UTF8")}function E0(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Za,mh,Mw=typeof TextDecoder!="undefined",Nw,jw=typeof TextEncoder!="undefined";function C0(e){if(jw)e=(Nw||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var gh,Qa;e:{for(yh=["CLOSURE_FLAGS"],ec=Qn,tc=0;tc<yh.length;tc++)if((ec=ec[yh[tc]])==null){Qa=null;break e}Qa=ec}var yh,ec,tc,ts,x0=Qa&&Qa[610401301];gh=x0!=null&&x0;var A0=Qn.navigator;function bh(e){return!!gh&&!!ts&&ts.brands.some(({brand:t})=>t&&t.indexOf(e)!=-1)}function cr(e){var t;return(t=Qn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function En(){return!!gh&&!!ts&&ts.brands.length>0}function vh(){return En()?bh("Chromium"):(cr("Chrome")||cr("CriOS"))&&!(!En()&&cr("Edge"))||cr("Silk")}ts=A0&&A0.userAgentData||null;var zw=!En()&&(cr("Trident")||cr("MSIE"));!cr("Android")||vh(),vh(),cr("Safari")&&(vh()||!En()&&cr("Coast")||!En()&&cr("Opera")||!En()&&cr("Edge")||(En()?bh("Microsoft Edge"):cr("Edg/"))||En()&&bh("Opera"));var T0={},rs=null;function Vw(e){let 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);let n=new Uint8Array(r),i=0;return function(o,s){function a(l){for(;c<o.length;){let d=o.charAt(c++),h=rs[d];if(h!=null)return h;if(!/^[\s\xa0]*$/.test(d))throw Error("Unknown base64 encoding at char: "+d)}return l}I0();let c=0;for(;;){let l=a(-1),d=a(0),h=a(64),m=a(64);if(m===64&&l===-1)break;s(l<<2|d>>4),h!=64&&(s(d<<4&240|h>>2),m!=64&&s(h<<6&192|m))}}(e,function(o){n[i++]=o}),i!==r?n.subarray(0,i):n}function I0(){if(!rs){rs={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));T0[r]=n;for(let i=0;i<n.length;i++){let o=n[i];rs[o]===void 0&&(rs[o]=i)}}}}var R0=typeof Uint8Array!="undefined",P0=!zw&&typeof btoa=="function";function D0(e){if(!P0){var t;t===void 0&&(t=0),I0(),t=T0[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var B0=/[-_.]/g,Hw={"-":"+",_:"/",".":"="};function Ww(e){return Hw[e]||""}function O0(e){if(!P0)return Vw(e);B0.test(e)&&(e=e.replace(B0,Ww)),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 rc(e){return R0&&e!=null&&e instanceof Uint8Array}var Yi={};function Zi(){return $w||=new Cn(null,Yi)}function wh(e){U0(Yi);var t=e.g;return(t=t==null||rc(t)?t:typeof t=="string"?O0(t):null)==null?t:e.g=t}var Cn=class{i(){return new Uint8Array(wh(this)||0)}constructor(e,t){if(U0(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},$w,Gw;function U0(e){if(e!==Yi)throw Error("illegal external caller")}function L0(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function F0(){let e=Error("int32");return L0(e,"warning"),e}var nc=typeof Symbol=="function"&&typeof Symbol()=="symbol",qw=new Set;function ic(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&qw.add(e),e}var Kw=ic("jas",void 0,!0,!0),_h=ic(void 0,"2ex"),ns=ic(void 0,"1oa",!0),Qi=ic(void 0,Symbol(),!0),ae=nc?Kw:"M",M0={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},N0=Object.defineProperties;function kh(e,t){nc||ae in e||N0(e,M0),e[ae]|=t}function dt(e,t){nc||ae in e||N0(e,M0),e[ae]=t}function Xw(e,t){dt(t,-30975&(0|e))}function Sh(e,t){dt(t,-30941&(34|e))}function Eh(){return typeof BigInt=="function"}function lr(e){return Array.prototype.slice.call(e)}var Ch,is={},Jw={};function j0(e){return!(!e||typeof e!="object"||e.g!==Jw)}function xh(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function z0(e,t){if(e!=null){if(typeof e=="string")e=e?new Cn(e,Yi):Zi();else if(e.constructor!==Cn)if(rc(e))e=e.length?new Cn(new Uint8Array(e),Yi):Zi();else{if(!t)throw Error();e=void 0}}return e}function oc(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[ae]))}var V0=[];function ti(e){if(2&e)throw Error()}function Ah(e){return Qi?e[Qi]:void 0}dt(V0,55),Ch=Object.freeze(V0);var H0=Object.freeze({}),Th=typeof Qn.BigInt=="function"&&typeof Qn.BigInt(0)=="bigint",Ih=e=>Th?e>=Zw&&e<=e_:e[0]==="-"?W0(e,Yw):W0(e,Qw),Yw=Number.MIN_SAFE_INTEGER.toString(),Zw=Th?BigInt(Number.MIN_SAFE_INTEGER):void 0,Qw=Number.MAX_SAFE_INTEGER.toString(),e_=Th?BigInt(Number.MAX_SAFE_INTEGER):void 0;function W0(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var t_=typeof Uint8Array.prototype.slice=="function",$0,Be=0,qe=0;function G0(e){let t=e>>>0;Be=t,qe=(e-t)/4294967296>>>0}function eo(e){if(e<0){G0(-e);let[t,r]=Rh(Be,qe);Be=t>>>0,qe=r>>>0}else G0(e)}function q0(e){let t=$0||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),qe=0,Be=t.getUint32(0,!0)}function Ph(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:os(e,t)}function Dh(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=Ph(e,t))=="number"?r?-e:e:r?"-"+e:e}function os(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Eh()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+K0(r)+K0(e));return r}function K0(e){return e=String(e),"0000000".slice(e.length)+e}function sc(e){if(e.length<16)eo(Number(e));else if(Eh())e=BigInt(e),Be=Number(e&BigInt(4294967295))>>>0,qe=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");qe=Be=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));qe*=1e6,Be=1e6*Be+o,Be>=4294967296&&(qe+=Math.trunc(Be/4294967296),qe>>>=0,Be>>>=0)}if(t){let[n,i]=Rh(Be,qe);Be=n,qe=i}}}function Rh(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var X0=typeof BigInt=="function"?BigInt.asIntN:void 0,r_=typeof BigInt=="function"?BigInt.asUintN:void 0,ss=Number.isSafeInteger,ac=Number.isFinite,cc=Math.trunc;function as(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function J0(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}var n_=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Bh(e){switch(typeof e){case"bigint":return!0;case"number":return ac(e);case"string":return n_.test(e);default:return!1}}function ri(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return ac(e)?0|e:void 0}function Y0(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function Z0(e){return e=cc(e),ss(e)||(eo(e),e=Dh(Be,qe)),e}function Q0(e){var t=cc(Number(e));if(ss(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(sc(e),e=Be,2147483648&(t=qe))if(Eh())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=Rh(e,t);e="-"+os(r,n)}else e=os(e,t);return e}function Oh(e){return e==null?e:typeof e=="bigint"?(Ih(e)?e=Number(e):(e=X0(64,e),e=Ih(e)?Number(e):String(e)),e):Bh(e)?typeof e=="number"?Z0(e):Q0(e):void 0}function i_(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(r_(64,e));if(Bh(e)){if(t==="string")return t=cc(Number(e)),ss(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),Y0(e)||(sc(e),e=os(Be,qe))),e;if(t==="number")return(e=cc(e))>=0&&ss(e)?e:function(r){if(r<0){eo(r);var n=os(Be,qe);return r=Number(n),ss(r)?r:n}return Y0(n=String(r))?n:(eo(r),Ph(Be,qe))}(e)}}function e1(e){if(typeof e!="string")throw Error();return e}function lc(e){if(e!=null&&typeof e!="string")throw Error();return e}function xn(e){return e==null||typeof e=="string"?e:void 0}function t1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===is)return e;if(Array.isArray(e)){var n=0|e[ae],i=n;return i===0&&(i|=32&r),(i|=2&r)!==n&&dt(e,i),new t(e)}}function r1(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=oc(e)?void 0:i&&2&(0|e[ae])?e:Uh(e,t,r,n!==void 0,i);else if(xh(e)){let o={};for(let s in e)o[s]=r1(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function Uh(e,t,r,n,i){let o=n||r?0|e[ae]:0,s=n?!!(32&o):void 0;n=lr(e);for(let a=0;a<n.length;a++)n[a]=r1(n[a],t,r,s,i);return r&&((e=Ah(e))&&(n[Qi]=lr(e)),r(o,n)),n}function o_(e){return e.B===is?e.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return Ih(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(oc(t))return}else{if(rc(t))return D0(t);if(t instanceof Cn){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=D0(r)}}}return t}(e)}function s_(e){return Uh(e,o_,void 0,void 0,!1)}var n1,a_;function cs(e,t,r){return e=i1(e,t[0],t[1],r?1:2),t!==n1&&r&&kh(e,16384),e}function i1(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[ae]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(xh(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return dt(e,i),e}function o1(e,t,r=Sh){if(e!=null){if(R0&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[ae];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(dt(e,-12293&(34|n)),e):Uh(e,o1,4&n?Sh:r,!0,!0))}return e.B===is&&(e=2&(n=0|(r=e.l)[ae])?e:new e.constructor(dc(r,n,!0))),e}}function s1(e){let t=e.l;return new e.constructor(dc(t,0|t[ae],!1))}function dc(e,t,r){let n=r||2&t?Sh:Xw,i=!!(32&t);return e=function(o,s,a){let c=lr(o);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 h in d)s[h]=a(d[h])}return(o=Ah(o))&&(c[Qi]=lr(o)),c}(e,t,o=>o1(o,i,n)),kh(e,32|(r?2:0)),e}function Lh(e){let t=e.l,r=0|t[ae];return 2&r?new e.constructor(dc(t,r,!1)):e}function Cr(e,t){return ni(e=e.l,0|e[ae],t)}function ni(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&_h!=null&&((i=(e=Gw??={})[_h]||0)>=4||(e[_h]=i+1,L0(e=Error(),"incident"),function(s){Qn.setTimeout(()=>{throw s},0)}(e))),t):i<=o?e[i]:void 0}function mt(e,t,r){let n=e.l,i=0|n[ae];return ti(i),ht(n,i,t,r),e}function ht(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},dt(e,t|=256)):e[o]=n),t)}function a1(e){let t=0|(e=e.l)[ae],r=ni(e,t,1),n=z0(r,!0);return n!=null&&n!==r&&ht(e,t,1,n),n}function c1(e,t,r,n,i){let o=e.l,s=2&(e=0|o[ae])?1:n;i=!!i;let a=0|(n=Fh(o,e,t))[ae];if(!(4&a)){4&a&&(n=lr(n),a=nn(a,e),e=ht(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let d=r(n[c]);d!=null&&(n[l++]=d)}l<c&&(n.length=l),a=Mh(a,e),r=-4097&(20|a),a=r&=-8193,dt(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?rn(a)||(i=a,a|=2,a!==i&&dt(n,a),Object.freeze(n)):(s===2&&rn(a)&&(n=lr(n),a=nn(a,e),a=An(a,e,i),dt(n,a),e=ht(o,e,t,n)),rn(a)||(t=a,a=An(a,e,i),a!==t&&dt(n,a))),n}function Fh(e,t,r,n){return e=ni(e,t,r,n),Array.isArray(e)?e:Ch}function Mh(e,t){return e===0&&(e=nn(e,t)),1|e}function rn(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function l1(e,t,r){let n=0|(e=e.l)[ae];if(ti(n),r==null)ht(e,n,t);else{var i=0|r[ae],o=i,s=rn(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=lr(r),o=0,i=An(i=nn(i,n),n,!0),a=!1),i|=21,s=0;s<r.length;s++){let c=r[s],l=e1(c);Object.is(c,l)||(a&&(r=lr(r),o=0,i=An(i=nn(i,n),n,!0),a=!1),r[s]=l)}i!==o&&(a&&(r=lr(r),i=An(i=nn(i,n),n,!0)),dt(r,i)),ht(e,n,t,r)}}function d1(e,t){let r=0|(e=e.l)[ae];ti(r),ht(e,r,2,t===""?void 0:t)}function ls(e,t,r,n,i){ti(t);var o=!(!(64&t)&&16384&t);let s=(i=Fh(e,t,r,i))!==Ch;if(o||!s){let a=o=s?0|i[ae]:0;(!s||2&a||rn(a)||4&a&&!(32&a))&&(i=lr(i),a=nn(a,t),t=ht(e,t,r,i)),a=-13&Mh(a,t),a=An(n?-17&a:16|a,t,!0),a!==o&&dt(i,a)}return i}function zh(e,t){var r=h1;return jh(Nh(e=e.l),e,0|e[ae],r)===t?t:-1}function Nh(e){if(nc)return e[ns]??(e[ns]=new Map);if(ns in e)return e[ns];let t=new Map;return Object.defineProperty(e,ns,{value:t}),t}function u1(e,t,r,n){let i=Nh(e),o=jh(i,e,t,r);return o!==n&&(o&&(t=ht(e,t,o)),i.set(r,n)),t}function jh(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];ni(t,r,s)!=null&&(i!==0&&(r=ht(t,r,i)),i=s)}return e.set(n,i),i}function Vh(e,t,r,n){let i,o=0|e[ae];if((n=ni(e,o,r,n))!=null&&n.B===is)return(t=Lh(n))!==n&&ht(e,o,r,t),t.l;if(Array.isArray(n)){let s=0|n[ae];i=2&s?cs(dc(n,s,!1),t,!0):64&s?n:cs(i,t,!0)}else i=cs(void 0,t,!0);return i!==n&&ht(e,o,r,i),i}function p1(e,t,r,n){let i=0|(e=e.l)[ae];return(t=t1(n=ni(e,i,r,n),t,i))!==n&&t!=null&&ht(e,i,r,t),t}function xr(e,t,r){if((t=p1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[ae];if(!(2&n)){let i=Lh(t);i!==t&&ht(e,n,r,t=i)}return t}function f1(e,t,r,n,i,o){e=e.l;var s=!!(2&t);let a=s?1:n;i=!!i,o&&=!s;var c=0|(n=Fh(e,t,1))[ae];if(!(s=!!(4&c))){var l=n,d=t;let h=!!(2&(c=Mh(c,t)));h&&(d|=2);let m=!h,f=!0,g=0,u=0;for(;g<l.length;g++){let b=t1(l[g],r,d);if(b instanceof r){if(!h){let v=!!(2&(0|b.l[ae]));m&&=!v,f&&=v}l[u++]=b}}u<g&&(l.length=u),c|=4,c=f?16|c:-17&c,dt(l,c=m?8|c:-9&c),h&&Object.freeze(l)}if(o&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(rn(c)&&(n=lr(n),c=nn(c,t),t=ht(e,t,1,n)),r=n,o=c,l=0;l<r.length;l++)(c=r[l])!==(d=Lh(c))&&(r[l]=d);o|=8,dt(r,o=r.length?-17&o:16|o),c=o}return a===1||a===4&&32&c?rn(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&dt(n,c),Object.freeze(n)):(a===2&&rn(c)&&(dt(n=lr(n),c=An(c=nn(c,t),t,i)),t=ht(e,t,1,n)),rn(c)||(e=c,(c=An(c,t,i))!==e&&dt(n,c))),n}function Hh(e,t){let r=0|e.l[ae];return f1(e,r,t,H0===void 0?2:4,!1,!(2&r))}function Ar(e,t,r,n){return n==null&&(n=void 0),mt(e,r,n)}function Wh(e,t,r){var n=m1;r==null&&(r=void 0);e:{let i=0|(e=e.l)[ae];if(ti(i),r==null){let o=Nh(e);if(jh(o,e,i,n)!==t)break e;o.set(n,0)}else i=u1(e,i,n,t);ht(e,i,t,r)}}function nn(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function An(e,t,r){return 32&t&&r||(e&=-33),e}function g1(e,t){var r=$h;let n=0|e.l[ae];ti(n),e=f1(e,n,r,2,!0),t=t??new r,e.push(t),e[ae]=2&(0|t.l[ae])?-9&e[ae]:-17&e[ae]}function Mt(e,t,r){ti(0|e.l[ae]),c1(e,t,xn,2,!0).push(e1(r))}function y1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function Gh(){return Error("Failed to read varint, encoding is invalid.")}function b1(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function qh(e){if(typeof e=="string")return{buffer:O0(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Cn)return{buffer:wh(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!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 Kh(e,t){let r,n=0,i=0,o=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(ii(e,a),r<128)return t(n>>>0,i>>>0);throw Gh()}function Xh(e){let t=0,r=e.g,n=r+10,i=e.i;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return ii(e,r),!!(127&t)}throw Gh()}function Nt(e){let t=e.i,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw Gh();return ii(e,r),i}function Jh(e){var t=e.i;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],ii(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Yh(e){var t=Jh(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function c_(e){return Nt(e)}function Zh(e,t,{C:r=!1}={}){e.C=r,t&&(t=qh(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function ii(e,t){if(e.g=t,t>e.j)throw b1(e.j,t)}function v1(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw b1(t,e.j-r);return e.g=n,r}function w1(e,t){if(t==0)return Zi();var r=v1(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):t_?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?Zi():new Cn(r,Yi)}var _1=[];function k1(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Nt(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw y1(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function hc(e){switch(e.i){case 0:e.i!=0?hc(e):Xh(e.g);break;case 1:ii(e=e.g,e.g+8);break;case 2:if(e.i!=2)hc(e);else{var t=Nt(e.g)>>>0;ii(e=e.g,e.g+t)}break;case 5:ii(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!k1(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}hc(e)}break;default:throw y1(e.i,e.j)}}function uc(e,t,r){let n=e.g.j,i=Nt(e.g)>>>0,o=e.g.g+i,s=o-n;if(s<=0&&(e.g.j=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=o,e.g.j=n}function Qh(e){var t=Nt(e.g)>>>0,r=v1(e=e.g,t);if(e=e.i,Mw){var n,i=e;(n=mh)||(n=mh=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(Za===void 0){try{n.decode(new Uint8Array([128]))}catch(c){}try{n.decode(new Uint8Array([97])),Za=!0}catch(c){Za=!1}}throw!Za&&(mh=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?ei():(a=e[o++],s<194||(192&a)!=128?(o--,ei()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?ei():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,ei()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?ei():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,ei()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):ei(),r.length>=8192&&(c=E0(c,r),r.length=0)}o=E0(c,r)}return o}function S1(e){let t=Nt(e.g)>>>0;return w1(e.g,t)}function eu(e,t,r){var n=Nt(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var pc=[];function l_(e){return e}var to;function E1(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var Ne=class{constructor(e,t){this.l=i1(e,t)}toJSON(){let e=!to;try{return e&&(to=s_),C1(this)}finally{e&&(to=void 0)}}u(){return!!(2&(0|this.l[ae]))}};function C1(e){var t=e.l;{t=(e=to(t))!==t;let l=e.length;if(l){var r=e[l-1],n=xh(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let d in s)isNaN(+d)?(o??={})[d]=s[d]:(n=s[d],Array.isArray(n)&&(oc(n)||j0(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[d]=n));if(a||(o=s),o)for(let d in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||oc(o)||j0(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function x1(e){return e?/^\d+$/.test(e)?(sc(e),new tu(Be,qe)):null:d_||=new tu(0,0)}Ne.prototype.B=is,Ne.prototype.toString=function(){try{return to=l_,C1(this).toString()}finally{to=void 0}};var tu=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},d_;function A1(e){return e?/^-?\d+$/.test(e)?(sc(e),new ru(Be,qe)):null:h_||=new ru(0,0)}var ru=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},h_;function ro(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ds(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function fc(e,t){if(t>=0)ds(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function mc(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 no(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Tr(e,t,r){ds(e.g,8*t+r)}function gc(e,t){return Tr(e,t,2),t=e.g.end(),no(e,t),t.push(e.i),t}function yc(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function bc(e,t,r){Tr(e,t,2),ds(e.g,r.length),no(e,e.g.end()),no(e,r)}function Ir(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var nu=Ir(),T1=Ir(),iu=Ir(),ou=Ir(),I1=Ir(),R1=Ir(),P1=Ir(),D1=Ir(),io=class{constructor(e,t,r){this.g=e,this.i=t,e=nu,this.j=!!e&&r===e||!1}};function su(e,t){return new io(e,t,nu)}function O1(e,t,r,n,i){(t=B1(t,n))!=null&&(r=gc(e,r),i(t,e),yc(e,r))}var u_=su(function(e,t,r,n,i){return e.i===2&&(uc(e,Vh(t,n,r),i),!0)},O1),p_=su(function(e,t,r,n,i){return e.i===2&&(uc(e,Vh(t,n,r,!0),i),!0)},O1),vc=Symbol(),au=Symbol(),U1=Symbol(),L1=Symbol(),F1,M1;function oi(e,t,r,n){var i=n[e];if(i)return i;(i={}).P=n,i.A=function(h){switch(typeof h){case"boolean":return n1||=[0,void 0,!0];case"number":return h>0?void 0:h===0?a_||=[0,void 0]:[-h,void 0];case"string":return[0,h];case"object":return h}}(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.H=o,typeof(o=n[++s])=="function"&&(i.I=!0,F1??=o,M1??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let h;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof io?h=o:(h=u_,s--),h?.j){o=n[++s],l=n;var d=s;typeof o=="function"&&(o=o(),l[d]=o),l=o}for(d=c+1,typeof(o=n[++s])=="number"&&o<0&&(d-=o,o=n[++s]);c<d;c++){let m=a[c];l?r(i,c,h,l,m):t(i,c,h,m)}}return n[e]=i}function N1(e){return Array.isArray(e)?e[0]instanceof io?e:[p_,e]:[e,void 0]}function B1(e,t){return e instanceof Ne?e.l:Array.isArray(e)?cs(e,t,!1):void 0}function cu(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function lu(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,d)=>o(c,l,d,a||=oi(au,cu,lu,n).A,s||=du(n),i)}function du(e){let t=e[U1];if(t!=null)return t;let r=oi(au,cu,lu,e);return t=r.I?(n,i)=>F1(n,i,r):(n,i)=>{let o=0|n[ae];for(;k1(i)&&i.i!=4;){var s=i.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=f_(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).j,hc(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=w1(a.g,c)),s=n,a&&((c=s[Qi])?c.push(a):s[Qi]=[a]))}return 16384&o&&kh(n,34),!0},e[U1]=t}function f_(e){let t=(e=N1(e))[0].g;if(e=e[1]){let r=du(e),n=oi(au,cu,lu,e).A;return(i,o,s)=>t(i,o,s,n,r)}return t}function wc(e,t,r){e[t]=r.i}function _c(e,t,r,n){let i,o,s=r.i;e[t]=(a,c,l)=>s(a,c,l,o||=oi(vc,wc,_c,n).A,i||=j1(n))}function j1(e){let t=e[L1];if(!t){let r=oi(vc,wc,_c,e);t=(n,i)=>z1(n,i,r),e[L1]=t}return t}function z1(e,t,r){for(var n=0|e[ae],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,d=V1(r,l);d&&d(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=V1(r,i))&&a(t,o,i)}if(e=Ah(e))for(no(t,t.g.end()),r=0;r<e.length;r++)no(t,wh(e[r])||new Uint8Array(0))}function V1(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=N1(r))[0].i;if(r=r[1]){let i=j1(r),o=oi(vc,wc,_c,r).A;r=e.I?M1(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function kc(e,t){if(Array.isArray(t)){var r=0|t[ae];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),dt(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function xt(e,t,r){return new io(e,t,r)}function Sc(e,t,r){return new io(e,t,r)}function At(e,t,r){ht(e,0|e[ae],t,r)}function H1(e,t,r){if(t=function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(X0(64,n));if(Bh(n)){if(i==="string")return Q0(n);if(i==="number")return Z0(n)}}(t),t!=null&&(typeof t=="string"&&A1(t),t!=null))switch(Tr(e,r,0),typeof t){case"number":e=e.g,eo(t),ro(e,Be,qe);break;case"bigint":r=BigInt.asUintN(64,t),r=new ru(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ro(e.g,r.i,r.g);break;default:r=A1(t),ro(e.g,r.i,r.g)}}function W1(e,t,r){(t=ri(t))!=null&&t!=null&&(Tr(e,r,0),fc(e.g,t))}function $1(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Tr(e,r,0),e.g.g.push(t?1:0))}function G1(e,t,r){(t=xn(t))!=null&&bc(e,r,C0(t))}function q1(e,t,r,n,i){(t=B1(t,n))!=null&&(r=gc(e,r),i(t,e),yc(e,r))}function K1(e,t,r){(t=t==null||typeof t=="string"||rc(t)||t instanceof Cn?t:void 0)!=null&&bc(e,r,qh(t).buffer)}var m_=xt(function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=Jh(n);let i=Jh(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,At(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0},function(e,t,r){(t=as(t))!=null&&(Tr(e,r,1),e=e.g,(r=$0||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),Be=r.getUint32(0,!0),qe=r.getUint32(4,!0),mc(e,Be),mc(e,qe))},Ir()),X1=xt(function(e,t,r){return e.i===5&&(At(t,r,Yh(e.g)),!0)},function(e,t,r){(t=as(t))!=null&&(Tr(e,r,5),e=e.g,q0(t),mc(e,Be))},R1),g_=Sc(function(e,t,r){return(e.i===5||e.i===2)&&(t=ls(t,0|t[ae],r,!1,!1),e.i==2?eu(e,Yh,t):t.push(Yh(e.g)),!0)},function(e,t,r){if((t=kc(as,t))!=null&&t.length){Tr(e,r,2),ds(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,q0(t[n]),mc(r,Be)}},R1),Ec=xt(function(e,t,r){return e.i===0&&(At(t,r,Kh(e.g,Dh)),!0)},H1,I1),hu=xt(function(e,t,r){return e.i===0&&(At(t,r,(e=Kh(e.g,Dh))===0?void 0:e),!0)},H1,I1),y_=xt(function(e,t,r){return e.i===0&&(At(t,r,Kh(e.g,Ph)),!0)},function(e,t,r){if((t=i_(t))!=null&&(typeof t=="string"&&x1(t),t!=null))switch(Tr(e,r,0),typeof t){case"number":e=e.g,eo(t),ro(e,Be,qe);break;case"bigint":r=BigInt.asUintN(64,t),r=new tu(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),ro(e.g,r.i,r.g);break;default:r=x1(t),ro(e.g,r.i,r.g)}},Ir()),Tn=xt(function(e,t,r){return e.i===0&&(At(t,r,Nt(e.g)),!0)},W1,ou),uu=Sc(function(e,t,r){return(e.i===0||e.i===2)&&(t=ls(t,0|t[ae],r,!1,!1),e.i==2?eu(e,Nt,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=kc(ri,t))!=null&&t.length){r=gc(e,r);for(let n=0;n<t.length;n++)fc(e.g,t[n]);yc(e,r)}},ou),oo=xt(function(e,t,r){return e.i===0&&(At(t,r,(e=Nt(e.g))===0?void 0:e),!0)},W1,ou),Jt=xt(function(e,t,r){return e.i===0&&(At(t,r,Xh(e.g)),!0)},$1,T1),so=xt(function(e,t,r){return e.i===0&&(At(t,r,(e=Xh(e.g))===!1?void 0:e),!0)},$1,T1),dr=Sc(function(e,t,r){return e.i===2&&(e=Qh(e),ls(t,0|t[ae],r,!1).push(e),!0)},function(e,t,r){if((t=kc(xn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&bc(n,i,C0(o))}},iu),In=xt(function(e,t,r){return e.i===2&&(At(t,r,(e=Qh(e))===""?void 0:e),!0)},G1,iu),Qe=xt(function(e,t,r){return e.i===2&&(At(t,r,Qh(e)),!0)},G1,iu),hr=function(e,t,r=nu){return new io(e,t,r)}(function(e,t,r,n,i){return e.i===2&&(n=cs(void 0,n,!0),ls(t,0|t[ae],r,!0).push(n),uc(e,n,i),!0)},function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)q1(e,t[o],r,n,i)}),gt=su(function(e,t,r,n,i,o){return e.i===2&&(u1(t,0|t[ae],o,r),uc(e,t=Vh(t,n,r),i),!0)},q1),J1=xt(function(e,t,r){return e.i===2&&(At(t,r,S1(e)),!0)},K1,P1),b_=xt(function(e,t,r){return e.i===0&&(At(t,r,(e=Nt(e.g)>>>0)==0?void 0:e),!0)},function(e,t,r){t=function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return ac(n)?n>>>0:void 0}(t),t!=null&&t!=null&&(Tr(e,r,0),ds(e.g,t))},Ir()),si=xt(function(e,t,r){return e.i===0&&(At(t,r,Nt(e.g)),!0)},function(e,t,r){(t=ri(t))!=null&&(t=parseInt(t,10),Tr(e,r,0),fc(e.g,t))},D1),pu=class{constructor(t,r){this.i=t,this.g=r,this.j=Ar,this.defaultValue=void 0}};function Y1(e,t){return(r,n)=>{if(pc.length){let o=pc.pop();o.o(n),Zh(o.g,r,n),r=o}else r=new class{constructor(o,s){if(_1.length){let a=_1.pop();Zh(a,o,s),o=a}else o=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,Zh(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(o,s);this.g=o,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:o=!1}={}){this.G=o}}(r,n);try{let o=new e,s=o.l;du(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.i=-1,pc.length<100&&pc.push(r)}return i}}var Z1=[0,In,xt(function(e,t,r){return e.i===2&&(At(t,r,(e=S1(e))===Zi()?void 0:e),!0)},function(e,t,r){if(t!=null){if(t instanceof Ne){let n=t.R;return void(n&&(t=n(t),t!=null&&bc(e,r,qh(t).buffer)))}if(Array.isArray(t))return}K1(e,t,r)},P1)],fu,Q1=globalThis.trustedTypes;function e2(e){fu===void 0&&(fu=function(){let r=null;if(!Q1)return r;try{let n=i=>i;r=Q1.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch(n){}return r}());var t=fu;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function v_(e,...t){if(t.length===0)return e2(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return e2(r)}var t2=[0,Tn,si,Jt,-1,uu,si,-1],w_=class extends Ne{constructor(e){super(e)}},r2=[0,Jt,Qe,Jt,si,-1,Sc(function(e,t,r){return(e.i===0||e.i===2)&&(t=ls(t,0|t[ae],r,!1,!1),e.i==2?eu(e,c_,t):t.push(Nt(e.g)),!0)},function(e,t,r){if((t=kc(ri,t))!=null&&t.length){r=gc(e,r);for(let n=0;n<t.length;n++)fc(e.g,t[n]);yc(e,r)}},D1),Qe,-1,[0,Jt,-1],si,Jt,-1],n2=[0,Qe,-2],i2=class extends Ne{constructor(e){super(e)}},o2=[0],s2=[0,Tn,Jt,1,Jt,-3],a2=class extends Ne{constructor(e){super(e,2)}},Cc={};Cc[336783863]=[0,Qe,Jt,-1,Tn,[0,[1,2,3,4,5,6,7,8],gt,o2,gt,r2,gt,n2,gt,s2,gt,t2,gt,[0,Qe,-2],gt,[0,Qe,si],gt,[0,si,Qe]],[0,Qe],Jt,[0,[1,3],[2,4],gt,[0,uu],-1,gt,[0,dr],-1,hr,[0,Qe,-1]],Qe];var c2,l2=[0,hu,-1,so,-3,hu,uu,In,oo,hu,-1,so,oo,so,-2,In],$h=class extends Ne{constructor(e){super(e,500)}o(e){return Ar(this,0,7,e)}},hs=[-1,{}],d2=[0,Qe,1,hs],h2=[0,Qe,dr,hs],mu=class extends Ne{constructor(e){super(e,500)}o(e){return Ar(this,0,1001,e)}};mu.prototype.g=(c2=[-500,hr,[-500,In,-1,dr,-3,[-2,Cc,Jt],hr,Z1,oo,-1,d2,h2,hr,[0,In,so],In,l2,oo,dr,987,dr],4,hr,[-500,Qe,-1,[-1,{}],998,Qe],hr,[-500,Qe,dr,-1,[-2,{},Jt],997,dr,-1],oo,hr,[-500,Qe,dr,hs,998,dr],dr,oo,d2,h2,hr,[0,In,-1,hs],dr,-2,l2,In,-1,so,[0,so,b_],978,hs,hr,Z1],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 o=this.g;return this.g=[],o}}}};z1(this.l,e,oi(vc,wc,_c,c2)),no(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,i=0;for(let o=0;o<n;o++){let s=r[o];t.set(s,i),i+=s.length}return e.j=[t],t});var __=class extends Ne{constructor(e){super(e)}},k_=class extends Ne{constructor(e){super(e)}g(){return Hh(this,__)}},S_=[0,hr,[0,Tn,X1,Qe,-1]],u2=class extends Ne{constructor(e){super(e)}},p2=class extends Ne{constructor(e){super(e)}},m1=[1,2,3,4,5],xc=class extends Ne{constructor(e){super(e)}g(){return a1(this)!=null}i(){return xn(Cr(this,2))!=null}},Ac=class extends Ne{constructor(e){super(e)}},f2=class extends Ne{constructor(e){super(e)}},m2=[0,[0,J1,Qe,[0,Tn,Ec,-1],[0,y_,Ec]],Jt,[0,m1,gt,s2,gt,r2,gt,t2,gt,o2,gt,n2],si],E_=new pu(451755788,f2);Cc[451755788]=[0,m2,[0,Qe,Tn,X1,dr,-1],m_];var g2=class extends Ne{constructor(e){super(e)}},y2=class extends Ne{constructor(e){super(e)}},C_=new pu(487277289,y2);Cc[487277289]=[0,m2,[0,Jt,-1]];var x_=class extends Ne{constructor(e){super(e)}},A_=Y1(class extends Ne{constructor(e){super(e)}},[0,hr,[0,1,Tn,Qe,S_],Ec]),b2=class extends Ne{constructor(e){super(e)}},T_=class extends Ne{constructor(e){super(e)}J(){let e=a1(this);return e??Zi()}},I_=class extends Ne{constructor(e){super(e)}},h1=[1,2],v2=Y1(class extends Ne{constructor(e){super(e)}},[0,hr,[0,h1,gt,[0,g_],gt,[0,J1],Tn,Qe],Ec]);function R_(){var e=navigator;return typeof OffscreenCanvas!="undefined"&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function w2(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise((r,n)=>{t.addEventListener("load",()=>{r()},!1),t.addEventListener("error",i=>{n(i)},!1),document.body.appendChild(t)})}importScripts(e.toString())}function oe(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 _2(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.h.stringToNewUTF8(t[i]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.h._free(i);e.h._free(t)}function Rn(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function ai(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}var P_=function(e){return class extends e{N(){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:R_()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),oe(this,n||"input_audio",o=>{oe(this,i=i||"audio_header",s=>{this.h._configureAudio(o,s,e,t??0,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,n,i){let o=4*e.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(e,this.g/4),oe(this,n,s=>{this.h._addAudioToInputStream(this.g,t,r,s,i)})}addGpuBufferToStream(e,t,r){oe(this,t,n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let i=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let[o,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||o===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=s);let[a,c]=[o,s];this.h._addBoundTextureToStream(n,a,c,r)})}addBoolToStream(e,t,r){oe(this,t,n=>{this.h._addBoolToInputStream(e,n,r)})}addDoubleToStream(e,t,r){oe(this,t,n=>{this.h._addDoubleToInputStream(e,n,r)})}addFloatToStream(e,t,r){oe(this,t,n=>{this.h._addFloatToInputStream(e,n,r)})}addIntToStream(e,t,r){oe(this,t,n=>{this.h._addIntToInputStream(e,n,r)})}addUintToStream(e,t,r){oe(this,t,n=>{this.h._addUintToInputStream(e,n,r)})}addStringToStream(e,t,r){oe(this,t,n=>{oe(this,e,i=>{this.h._addStringToInputStream(i,n,r)})})}addStringRecordToStream(e,t,r){oe(this,t,n=>{_2(this,Object.keys(e),i=>{_2(this,Object.values(e),o=>{this.h._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)})})})}addProtoToStream(e,t,r,n){oe(this,r,i=>{oe(this,t,o=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,o,i,n),this.h._free(s)})})}addEmptyPacketToStream(e,t){oe(this,e,r=>{this.h._addEmptyPacketToInputStream(r,t)})}addBoolVectorToStream(e,t,r){oe(this,t,n=>{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._addBoolVectorToInputStream(i,n,r)})}addDoubleVectorToStream(e,t,r){oe(this,t,n=>{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._addDoubleVectorToInputStream(i,n,r)})}addFloatVectorToStream(e,t,r){oe(this,t,n=>{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._addFloatVectorToInputStream(i,n,r)})}addIntVectorToStream(e,t,r){oe(this,t,n=>{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._addIntVectorToInputStream(i,n,r)})}addUintVectorToStream(e,t,r){oe(this,t,n=>{let i=this.h._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(i,o);this.h._addUintVectorToInputStream(i,n,r)})}addStringVectorToStream(e,t,r){oe(this,t,n=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)oe(this,o,s=>{this.h._addStringVectorEntry(i,s)});this.h._addStringVectorToInputStream(i,n,r)})}addBoolToInputSidePacket(e,t){oe(this,t,r=>{this.h._addBoolToInputSidePacket(e,r)})}addDoubleToInputSidePacket(e,t){oe(this,t,r=>{this.h._addDoubleToInputSidePacket(e,r)})}addFloatToInputSidePacket(e,t){oe(this,t,r=>{this.h._addFloatToInputSidePacket(e,r)})}addIntToInputSidePacket(e,t){oe(this,t,r=>{this.h._addIntToInputSidePacket(e,r)})}addUintToInputSidePacket(e,t){oe(this,t,r=>{this.h._addUintToInputSidePacket(e,r)})}addStringToInputSidePacket(e,t){oe(this,t,r=>{oe(this,e,n=>{this.h._addStringToInputSidePacket(n,r)})})}addProtoToInputSidePacket(e,t,r){oe(this,r,n=>{oe(this,t,i=>{let o=this.h._malloc(e.length);this.h.HEAPU8.set(e,o),this.h._addProtoToInputSidePacket(o,e.length,i,n),this.h._free(o)})})}addBoolVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(n,i);this.h._addBoolVectorToInputSidePacket(n,r)})}addDoubleVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(n,i);this.h._addDoubleVectorToInputSidePacket(n,r)})}addFloatVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(n,i);this.h._addFloatVectorToInputSidePacket(n,r)})}addIntVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(n,i);this.h._addIntVectorToInputSidePacket(n,r)})}addUintVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(n,i);this.h._addUintVectorToInputSidePacket(n,r)})}addStringVectorToInputSidePacket(e,t){oe(this,t,r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)oe(this,i,o=>{this.h._addStringVectorEntry(n,o)});this.h._addStringVectorToInputSidePacket(n,r)})}attachBoolListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachBoolListener(r)})}attachBoolVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachBoolVectorListener(r)})}attachIntListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachIntListener(r)})}attachIntVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachIntVectorListener(r)})}attachUintListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachUintListener(r)})}attachUintVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachUintVectorListener(r)})}attachDoubleListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachDoubleListener(r)})}attachDoubleVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachDoubleVectorListener(r)})}attachFloatListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachFloatListener(r)})}attachFloatVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachFloatVectorListener(r)})}attachStringListener(e,t){Rn(this,e,t),oe(this,e,r=>{this.h._attachStringListener(r)})}attachStringVectorListener(e,t){ai(this,e,t),oe(this,e,r=>{this.h._attachStringVectorListener(r)})}attachProtoListener(e,t,r){Rn(this,e,t),oe(this,e,n=>{this.h._attachProtoListener(n,r||!1)})}attachProtoVectorListener(e,t,r){ai(this,e,t),oe(this,e,n=>{this.h._attachProtoVectorListener(n,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?'),Rn(this,e,(n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)}),oe(this,e,n=>{this.h._attachAudioListener(n,r||!1)})}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),k2=class extends P_{};async function D_(e,t,r){return e=await(async(n,i,o,s)=>{if(i&&await w2(i),!self.ModuleFactory||o&&(await w2(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((i=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function S2(e,t,r){return D_(e,t,r)}function gu(e,t){let r=xr(e.baseOptions,xc,1)||new xc;typeof t=="string"?(mt(r,2,lc(t)),mt(r,1)):t instanceof Uint8Array&&(mt(r,1,z0(t,!1)),mt(r,2)),Ar(e.baseOptions,0,1,r)}function E2(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(xr(e.baseOptions,xc,1)?.g()||xr(e.baseOptions,xc,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(n,i){let o=xr(n.baseOptions,p2,3);if(!o){var s=o=new p2;Wh(s,4,new i2)}"delegate"in i&&(i.delegate==="GPU"?Wh(i=o,2,s=new w_):Wh(i=o,4,s=new i2)),Ar(n.baseOptions,0,3,o)}(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)}).then(n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),gu(e,"/model.dat"),e.v()});if(r.modelAssetBuffer instanceof Uint8Array)gu(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n}(r.modelAssetBuffer).then(n=>{gu(e,n),e.v()});return e.v(),Promise.resolve()}function C2(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map(r=>r.message).join(", "))}finally{e.j=[]}}function ao(e,t){e.s=Math.max(e.s,t)}var Tc=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener((r,n)=>{this.j.push(Error(n))}),this.g.N(),this.g.setGraph(e,t),C2(this)}finishProcessing(){this.g.finishProcessing(),C2(this)}close(){this.g.closeGraph()}};async function us(e,t,r){return S2(e,t,r)}Tc.prototype.close=Tc.prototype.close,function(e,t){e=e.split(".");var r,n=Qn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t}("TaskRunner",Tc);var Ic=class extends Tc{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function B_(e){let t={classifications:Hh(e,x_).map(r=>function(n,i=-1,o=""){return{categories:n.map(s=>{var a=ri(Cr(s,1))??0??-1;let c=s.l,l=0|c[ae],d=ni(c,l,2),h=as(d);return h!=null&&h!==d&&ht(c,l,2,h),{index:a,score:h??0??0,categoryName:xn(Cr(s,3))??""??"",displayName:xn(Cr(s,4))??""??""}}),headIndex:i,headName:o}}(xr(r,k_,4)?.g()??[],ri(Cr(r,2))??0,xn(Cr(r,3))??""))};return Oh(Cr(e,2))!=null&&(t.timestampMs=Oh(Cr(e,2))??0),t}Ic.prototype.setDefaultSampleRate=Ic.prototype.O;var ur=class extends Ic{constructor(e,t){super(new k2(e,t)),this.m=[],Ar(e=this.i=new f2,0,1,t=new Ac)}get baseOptions(){return xr(this.i,Ac,1)}set baseOptions(e){Ar(this.i,0,1,e)}o(e){var t=this.i,r=xr(this.i,u2,2);if(r=r?s1(r):new u2,e.displayNamesLocale!==void 0?mt(r,1,lc(e.displayNamesLocale)):e.displayNamesLocale===void 0&&mt(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!ac(n))throw F0();n|=0}mt(r,2,n)}else"maxResults"in e&&mt(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);mt(r,3,n)}else"scoreThreshold"in e&&mt(r,3);return e.categoryAllowlist!==void 0?l1(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&mt(r,4),e.categoryDenylist!==void 0?l1(r,5,e.categoryDenylist):"categoryDenylist"in e&&mt(r,5),Ar(t,0,2,r),E2(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(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]}v(){var e=new mu;Mt(e,10,"audio_in"),Mt(e,10,"sample_rate"),Mt(e,15,"timestamped_classifications");let t=new a2;E1(t,E_,this.i);let r=new $h;d1(r,lc("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Mt(r,3,"AUDIO:audio_in"),Mt(r,3,"SAMPLE_RATE:sample_rate"),Mt(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),g1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",(n,i)=>{(function(o,s){s.forEach(a=>{a=A_(a),o.m.push(B_(a))})})(this,n),ao(this,i)}),this.g.attachEmptyPacketListener("timestamped_classifications",n=>{ao(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function x2(e){return{embeddings:Hh(e,I_).map(t=>{let r={headIndex:ri(Cr(t,3))??0??-1,headName:xn(Cr(t,4))??""??""};if(p1(t,b2,zh(t,1))!==void 0)r.floatEmbedding=c1(xr(t,b2,zh(t,1)),1,as,H0===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=xr(t,T_,zh(t,2))?.J()?.i()??n}return r}),timestampMs:Oh(Cr(e,2))??0}}ur.prototype.classify=ur.prototype.K,ur.prototype.setOptions=ur.prototype.o,ur.createFromModelPath=function(e,t){return S2(ur,e,{baseOptions:{modelAssetPath:t}})},ur.createFromModelBuffer=function(e,t){return us(ur,e,{baseOptions:{modelAssetBuffer:t}})},ur.createFromOptions=function(e,t){return us(ur,e,t)};var Hr=class extends Ic{constructor(e,t){super(new k2(e,t)),this.m=[],Ar(e=this.i=new y2,0,1,t=new Ac)}get baseOptions(){return xr(this.i,Ac,1)}set baseOptions(e){Ar(this.i,0,1,e)}o(e){var t=this.i,r=xr(this.i,g2,2);return r=r?s1(r):new g2,e.l2Normalize!==void 0?mt(r,1,J0(e.l2Normalize)):"l2Normalize"in e&&mt(r,1),e.quantize!==void 0?mt(r,2,J0(e.quantize)):"quantize"in e&&mt(r,2),Ar(t,0,2,r),E2(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(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}v(){var e=new mu;Mt(e,10,"audio_in"),Mt(e,10,"sample_rate"),Mt(e,15,"embeddings_out"),Mt(e,15,"timestamped_embeddings_out");let t=new a2;E1(t,C_,this.i);let r=new $h;d1(r,lc("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Mt(r,3,"AUDIO:audio_in"),Mt(r,3,"SAMPLE_RATE:sample_rate"),Mt(r,4,"EMBEDDINGS:embeddings_out"),Mt(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),g1(e,r),this.g.attachProtoListener("embeddings_out",(n,i)=>{n=v2(n),this.m.push(x2(n)),ao(this,i)}),this.g.attachEmptyPacketListener("embeddings_out",n=>{ao(this,n)}),this.g.attachProtoVectorListener("timestamped_embeddings_out",(n,i)=>{for(let o of n)n=v2(o),this.m.push(x2(n));ao(this,i)}),this.g.attachEmptyPacketListener("timestamped_embeddings_out",n=>{ao(this,n)}),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Rc;Hr.prototype.embed=Hr.prototype.L,Hr.prototype.setOptions=Hr.prototype.o,Hr.createFromModelPath=function(e,t){return us(Hr,e,{baseOptions:{modelAssetPath:t}})},Hr.createFromModelBuffer=function(e,t){return us(Hr,e,{baseOptions:{modelAssetBuffer:t}})},Hr.createFromOptions=function(e,t){return us(Hr,e,t)};var O_=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 A2(){if(Rc===void 0)try{await WebAssembly.instantiate(O_),Rc=!0}catch{Rc=!1}return Rc}async function ps(e,t=v_``){let r=await A2()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var Pn=class{};Pn.forVisionTasks=function(e){return ps("vision",e)},Pn.forTextTasks=function(e){return ps("text",e)},Pn.forGenAiExperimentalTasks=function(e){return ps("genai_experimental",e)},Pn.forGenAiTasks=function(e){return ps("genai",e)},Pn.forAudioTasks=function(e){return ps("audio",e)},Pn.isSimdSupported=function(){return A2()};function U_(e,t){let r=e.reduce((a,c)=>a+c.length,0),n=new ArrayBuffer(44+r*2),i=new DataView(n),o=(a,c,l)=>{for(let d=0;d<l.length;d++)a.setUint8(c+d,l.charCodeAt(d))};o(i,0,"RIFF"),i.setUint32(4,36+r*2,!0),o(i,8,"WAVE"),o(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(i,36,"data"),i.setUint32(40,r*2,!0);let s=44;for(let a of e)for(let c=0;c<a.length;c++){let l=Math.max(-1,Math.min(1,a[c]));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([i],{type:"audio/wav"})}var yu=class{constructor(t,r,n,i,o,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.preRollBuffer=[];this.recordingChunks=[];this.PRE_ROLL_SECONDS=2;this.SAMPLE_RATE=16e3;this.MAX_PRE_ROLL_CHUNKS=4;this.lastNoiseTime=0;this.SILENCE_THRESHOLD=3e3;this.filesToUpload=[];this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=i,this.onRealtimeAlertsCallback=o,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new kn(this.proctoringId,this.backend))}async startRecording(){await this.createAudioClassifier(),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect(),this.context&&this.context.close()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new Yn(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*1.25);let n=r>=t;if(n&&(this.lastNoiseTime=Date.now()),n&&!this.recordingInProgress){this.recordingInProgress=!0,this.recordingChunks=[...this.preRollBuffer];let o=this.preRollBuffer.reduce((a,c)=>a+c.length,0)/this.SAMPLE_RATE*1e3,s=Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0);this.recordingStartTime=s-o,this.recordingStartTime<0&&(this.recordingStartTime=0)}else if(this.recordingInProgress){let i=Date.now()-this.lastNoiseTime,o=Date.now()-this.recordingStartTime;i>=this.SILENCE_THRESHOLD&&o>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({begin:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),end:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({begin:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),end:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),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.recordingInProgress&&this.recordingChunks.length===0||(this.recordingEndTime=Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=U_(this.recordingChunks,this.SAMPLE_RATE),r=new File([t],`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.wav`,{type:"audio/wav"}),n=[...this.filesToUpload];for(let i of n)try{await this.upload?.upload({file:i},this.backendToken),this.filesToUpload.splice(this.filesToUpload.indexOf(i),1)}catch(o){break}try{r&&this.upload&&this.backendToken&&this.upload.upload({file:r},this.backendToken)}catch(i){console.log("error Noise recorder adicionando na fila",i),this.filesToUpload.push(r)}this.recordingChunks=[],this.recordingInProgress=!1}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let i=parseFloat(r.score)>.22;if(n&&i)return!0}return!1}async createAudioClassifier(){let t=await Pn.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await ur.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:this.SAMPLE_RATE});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([L_],{type:"text/javascript"})))}catch(r){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 n=r.data;this.preRollBuffer.push(n),this.preRollBuffer.length>this.MAX_PRE_ROLL_CHUNKS&&this.preRollBuffer.shift(),this.recordingInProgress&&this.recordingChunks.push(n);let o=this.audioClassifier.classify(n)[0].classifications[0].categories;o.length>0&&(this.audioClassificationResult=[{name:o[0].categoryName,score:o[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},L_=`
441
+ Size: ${t.file.size}`,s),o}}throw new Error("Could not upload")}};var qa=class{constructor(t,r){this.alerts=[];this.lastActivityTime=Date.now();this.IDLE_THRESHOLD_MS=3e4;this.handleVisibilityChange=()=>{document.visibilityState==="visible"?this.handleReturnFocus():this.handleLostFocus()};this.handleLostFocus=()=>{if(this.getRelativeTime()>1e4){let t={begin:this.getRelativeTime(),end:0,alert:25,type:3};this.onLostFocusCallback(t),this.alerts.push(t)}};this.handleReturnFocus=()=>{let t=this.alerts[this.alerts.length-1];t&&(this.onFocusCallback({begin:t.begin,end:this.getRelativeTime(),alert:25,type:3}),t.end=this.getRelativeTime())};this.handleResize=()=>{clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{let t=window.screen.availWidth,r=window.outerWidth;if(r<t*.85){let n=`Split Screen Detectado: Janela ocupa ${(r/t*100).toFixed(0)}% da tela`;this.createAlert(43,3,n),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:n,type:"split_screen"})}},1e3)};this.handleUserActivity=t=>{this.lastActivityTime=Date.now(),console.log("\u{1F449} handleUserActivity",t)};this.handleCopy=t=>{t.preventDefault();let r="Tentativa de Copiar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_copy"})};this.handleCut=t=>{t.preventDefault();let r="Tentativa de Recortar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_cut"})};this.handlePaste=t=>{t.preventDefault();let r="Tentativa de Colar (Clipboard)";this.createAlert(42,3,r),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:r,type:"clipboard_paste"})};this.onLostFocusCallback=t.onLostFocusCallback,this.onFocusCallback=t.onFocusCallback,this.onRealtimeAlertCallback=t.onRealtimeAlertCallback,this.optionsProctoring=r}async startRecording(){this.startTime=new Date(Date.now()),this.alerts=[],this.attachListeners()}async pauseRecording(){this.detachListeners()}async resumeRecording(){this.attachListeners()}async stopRecording(){this.detachListeners()}async saveOnSession(t){this.alerts.forEach(r=>{t.addAlert(r)})}attachListeners(){this.optionsProctoring.captureScreen&&(window.addEventListener("visibilitychange",this.handleVisibilityChange),window.addEventListener("resize",this.handleResize),window.document.addEventListener("copy",this.handleCopy),window.document.addEventListener("cut",this.handleCut),window.document.addEventListener("paste",this.handlePaste))}detachListeners(){window.removeEventListener("visibilitychange",this.handleVisibilityChange),window.removeEventListener("resize",this.handleResize),window.document.removeEventListener("copy",this.handleCopy),window.document.removeEventListener("cut",this.handleCut),window.document.removeEventListener("paste",this.handlePaste)}addBackgroundEvent(t,r=200){this.createAlert(r,3,t),this.onRealtimeAlertCallback&&this.onRealtimeAlertCallback({status:"ALERT",description:t,type:"background_event"})}getRelativeTime(){return Date.now()-this.startTime.getTime()}createAlert(t,r,n){this.alerts.push({begin:this.getRelativeTime(),end:this.getRelativeTime(),alert:t,type:r})}addAlert({alert:t,type:r}){this.alerts.push({begin:Date.now()-this.startTime.getTime(),end:Date.now()-this.startTime.getTime(),alert:t,type:r})}};var Kn=typeof self<"u"?self:{};function $n(){throw Error("Invalid UTF8")}function p0(e,t){return t=String.fromCharCode.apply(null,t),e==null?t:e+t}var Ka,Id,I_=typeof TextDecoder<"u",R_,P_=typeof TextEncoder<"u";function J0(e){if(P_)e=(R_||=new TextEncoder).encode(e);else{let r=0,n=new Uint8Array(3*e.length);for(let i=0;i<e.length;i++){var t=e.charCodeAt(i);if(t<128)n[r++]=t;else{if(t<2048)n[r++]=t>>6|192;else{if(t>=55296&&t<=57343){if(t<=56319&&i<e.length){let o=e.charCodeAt(++i);if(o>=56320&&o<=57343){t=1024*(t-55296)+o-56320+65536,n[r++]=t>>18|240,n[r++]=t>>12&63|128,n[r++]=t>>6&63|128,n[r++]=63&t|128;continue}i--}t=65533}n[r++]=t>>12|224,n[r++]=t>>6&63|128}n[r++]=63&t|128}}e=r===n.length?n:n.subarray(0,r)}return e}var qd,tc;e:{for(Rd=["CLOSURE_FLAGS"],Xa=Kn,Ja=0;Ja<Rd.length;Ja++)if((Xa=Xa[Rd[Ja]])==null){tc=null;break e}tc=Xa}var Rd,Xa,Ja,Zo,f0=tc&&tc[610401301];qd=f0!=null&&f0;var m0=Kn.navigator;function Nd(e){return!!qd&&!!Zo&&Zo.brands.some((({brand:t})=>t&&t.indexOf(e)!=-1))}function lr(e){var t;return(t=Kn.navigator)&&(t=t.userAgent)||(t=""),t.indexOf(e)!=-1}function vn(){return!!qd&&!!Zo&&Zo.brands.length>0}function Pd(){return vn()?Nd("Chromium"):(lr("Chrome")||lr("CriOS"))&&!(!vn()&&lr("Edge"))||lr("Silk")}Zo=m0&&m0.userAgentData||null;var D_=!vn()&&(lr("Trident")||lr("MSIE"));!lr("Android")||Pd(),Pd(),lr("Safari")&&(Pd()||!vn()&&lr("Coast")||!vn()&&lr("Opera")||!vn()&&lr("Edge")||(vn()?Nd("Microsoft Edge"):lr("Edg/"))||vn()&&Nd("Opera"));var Y0={},qo=null;function B_(e){let 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);let n=new Uint8Array(r),i=0;return(function(o,s){function a(l){for(;c<o.length;){let h=o.charAt(c++),d=qo[h];if(d!=null)return d;if(!/^[\s\xa0]*$/.test(h))throw Error("Unknown base64 encoding at char: "+h)}return l}Z0();let c=0;for(;;){let l=a(-1),h=a(0),d=a(64),g=a(64);if(g===64&&l===-1)break;s(l<<2|h>>4),d!=64&&(s(h<<4&240|d>>2),g!=64&&s(d<<6&192|g))}})(e,(function(o){n[i++]=o})),i!==r?n.subarray(0,i):n}function Z0(){if(!qo){qo={};var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),t=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let n=e.concat(t[r].split(""));Y0[r]=n;for(let i=0;i<n.length;i++){let o=n[i];qo[o]===void 0&&(qo[o]=i)}}}}var Q0=typeof Uint8Array<"u",e1=!D_&&typeof btoa=="function";function g0(e){if(!e1){var t;t===void 0&&(t=0),Z0(),t=Y0[t];var r=Array(Math.floor(e.length/3)),n=t[64]||"";let c=0,l=0;for(;c<e.length-2;c+=3){var i=e[c],o=e[c+1],s=e[c+2],a=t[i>>2];i=t[(3&i)<<4|o>>4],o=t[(15&o)<<2|s>>6],s=t[63&s],r[l++]=a+i+o+s}switch(a=0,s=n,e.length-c){case 2:s=t[(15&(a=e[c+1]))<<2]||n;case 1:e=e[c],r[l]=t[e>>2]+t[(3&e)<<4|a>>4]+s+n}return r.join("")}for(t="",r=0,n=e.length-10240;r<n;)t+=String.fromCharCode.apply(null,e.subarray(r,r+=10240));return t+=String.fromCharCode.apply(null,r?e.subarray(r):e),btoa(t)}var y0=/[-_.]/g,O_={"-":"+",_:"/",".":"="};function U_(e){return O_[e]||""}function t1(e){if(!e1)return B_(e);y0.test(e)&&(e=e.replace(y0,U_)),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 dc(e){return Q0&&e!=null&&e instanceof Uint8Array}var Qi={};function eo(){return L_||=new wn(null,Qi)}function Kd(e){r1(Qi);var t=e.g;return(t=t==null||dc(t)?t:typeof t=="string"?t1(t):null)==null?t:e.g=t}var wn=class{i(){return new Uint8Array(Kd(this)||0)}constructor(e,t){if(r1(t),this.g=e,e!=null&&e.length===0)throw Error("ByteString should be constructed with non-empty values")}},L_,F_;function r1(e){if(e!==Qi)throw Error("illegal external caller")}function n1(e,t){e.__closure__error__context__984382||(e.__closure__error__context__984382={}),e.__closure__error__context__984382.severity=t}function b0(){let e=Error("int32");return n1(e,"warning"),e}var uc=typeof Symbol=="function"&&typeof Symbol()=="symbol",M_=new Set;function pc(e,t,r=!1,n=!1){return e=typeof Symbol=="function"&&typeof Symbol()=="symbol"?n&&Symbol.for&&e?Symbol.for(e):e!=null?Symbol(e):Symbol():t,r&&M_.add(e),e}var N_=pc("jas",void 0,!0,!0),Dd=pc(void 0,"2ex"),$o=pc(void 0,"1oa",!0),to=pc(void 0,Symbol(),!0),se=uc?N_:"M",i1={M:{value:0,configurable:!0,writable:!0,enumerable:!1}},o1=Object.defineProperties;function Xd(e,t){uc||se in e||o1(e,i1),e[se]|=t}function ct(e,t){uc||se in e||o1(e,i1),e[se]=t}function z_(e,t){ct(t,-30975&(0|e))}function zd(e,t){ct(t,-30941&(34|e))}function Jd(){return typeof BigInt=="function"}function hr(e){return Array.prototype.slice.call(e)}var Yd,es={},j_={};function v0(e){return!(!e||typeof e!="object"||e.g!==j_)}function Zd(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&e.constructor===Object}function s1(e,t){if(e!=null){if(typeof e=="string")e=e?new wn(e,Qi):eo();else if(e.constructor!==wn)if(dc(e))e=e.length?new wn(new Uint8Array(e),Qi):eo();else{if(!t)throw Error();e=void 0}}return e}function rc(e){return!(!Array.isArray(e)||e.length)&&!!(1&(0|e[se]))}var _0=[];function Yn(e){if(2&e)throw Error()}function Qd(e){return to?e[to]:void 0}ct(_0,55),Yd=Object.freeze(_0);var a1=Object.freeze({}),eu=typeof Kn.BigInt=="function"&&typeof Kn.BigInt(0)=="bigint",jd=e=>eu?e>=H_&&e<=$_:e[0]==="-"?w0(e,V_):w0(e,W_),V_=Number.MIN_SAFE_INTEGER.toString(),H_=eu?BigInt(Number.MIN_SAFE_INTEGER):void 0,W_=Number.MAX_SAFE_INTEGER.toString(),$_=eu?BigInt(Number.MAX_SAFE_INTEGER):void 0;function w0(e,t){if(e.length>t.length)return!1;if(e.length<t.length||e===t)return!0;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n>i)return!1;if(n<i)return!0}}var G_=typeof Uint8Array.prototype.slice=="function",c1,De=0,Ge=0;function S0(e){let t=e>>>0;De=t,Ge=(e-t)/4294967296>>>0}function ro(e){if(e<0){S0(-e);let[t,r]=nu(De,Ge);De=t>>>0,Ge=r>>>0}else S0(e)}function l1(e){let t=c1||=new DataView(new ArrayBuffer(8));t.setFloat32(0,+e,!0),Ge=0,De=t.getUint32(0,!0)}function tu(e,t){let r=4294967296*t+(e>>>0);return Number.isSafeInteger(r)?r:Qo(e,t)}function ru(e,t){let r=2147483648&t;return r&&(t=~t>>>0,(e=1+~e>>>0)==0&&(t=t+1>>>0)),typeof(e=tu(e,t))=="number"?r?-e:e:r?"-"+e:e}function Qo(e,t){if(e>>>=0,(t>>>=0)<=2097151)var r=""+(4294967296*t+e);else Jd()?r=""+(BigInt(t)<<BigInt(32)|BigInt(e)):(e=(16777215&e)+6777216*(r=16777215&(e>>>24|t<<8))+6710656*(t=t>>16&65535),r+=8147497*t,t*=2,e>=1e7&&(r+=e/1e7>>>0,e%=1e7),r>=1e7&&(t+=r/1e7>>>0,r%=1e7),r=t+k0(r)+k0(e));return r}function k0(e){return e=String(e),"0000000".slice(e.length)+e}function fc(e){if(e.length<16)ro(Number(e));else if(Jd())e=BigInt(e),De=Number(e&BigInt(4294967295))>>>0,Ge=Number(e>>BigInt(32)&BigInt(4294967295));else{let t=+(e[0]==="-");Ge=De=0;let r=e.length;for(let n=t,i=(r-t)%6+t;i<=r;n=i,i+=6){let o=Number(e.slice(n,i));Ge*=1e6,De=1e6*De+o,De>=4294967296&&(Ge+=Math.trunc(De/4294967296),Ge>>>=0,De>>>=0)}if(t){let[n,i]=nu(De,Ge);De=n,Ge=i}}}function nu(e,t){return t=~t,e?e=1+~e:t+=1,[e,t]}var h1=typeof BigInt=="function"?BigInt.asIntN:void 0,q_=typeof BigInt=="function"?BigInt.asUintN:void 0,Ko=Number.isSafeInteger,mc=Number.isFinite,nc=Math.trunc;function ts(e){return e==null||typeof e=="number"?e:e==="NaN"||e==="Infinity"||e==="-Infinity"?Number(e):void 0}function E0(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}var K_=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function iu(e){switch(typeof e){case"bigint":return!0;case"number":return mc(e);case"string":return K_.test(e);default:return!1}}function Xn(e){if(e==null)return e;if(typeof e=="string"&&e)e=+e;else if(typeof e!="number")return;return mc(e)?0|e:void 0}function C0(e){if(e[0]==="-")return!1;let t=e.length;return t<20||t===20&&Number(e.substring(0,6))<184467}function d1(e){return e=nc(e),Ko(e)||(ro(e),e=ru(De,Ge)),e}function u1(e){var t=nc(Number(e));if(Ko(t))return String(t);if((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),t=e.length,!(e[0]==="-"?t<20||t===20&&Number(e.substring(0,7))>-922337:t<19||t===19&&Number(e.substring(0,6))<922337))if(fc(e),e=De,2147483648&(t=Ge))if(Jd())e=""+(BigInt(0|t)<<BigInt(32)|BigInt(e>>>0));else{let[r,n]=nu(e,t);e="-"+Qo(r,n)}else e=Qo(e,t);return e}function Vd(e){return e==null?e:typeof e=="bigint"?(jd(e)?e=Number(e):(e=h1(64,e),e=jd(e)?Number(e):String(e)),e):iu(e)?typeof e=="number"?d1(e):u1(e):void 0}function X_(e){if(e==null)return e;var t=typeof e;if(t==="bigint")return String(q_(64,e));if(iu(e)){if(t==="string")return t=nc(Number(e)),Ko(t)&&t>=0?e=String(t):((t=e.indexOf("."))!==-1&&(e=e.substring(0,t)),C0(e)||(fc(e),e=Qo(De,Ge))),e;if(t==="number")return(e=nc(e))>=0&&Ko(e)?e:(function(r){if(r<0){ro(r);var n=Qo(De,Ge);return r=Number(n),Ko(r)?r:n}return C0(n=String(r))?n:(ro(r),tu(De,Ge))})(e)}}function p1(e){if(typeof e!="string")throw Error();return e}function ic(e){if(e!=null&&typeof e!="string")throw Error();return e}function Sn(e){return e==null||typeof e=="string"?e:void 0}function f1(e,t,r){if(e!=null&&typeof e=="object"&&e.B===es)return e;if(Array.isArray(e)){var n=0|e[se],i=n;return i===0&&(i|=32&r),(i|=2&r)!==n&&ct(e,i),new t(e)}}function m1(e,t,r,n,i){if(e!=null){if(Array.isArray(e))e=rc(e)?void 0:i&&2&(0|e[se])?e:ou(e,t,r,n!==void 0,i);else if(Zd(e)){let o={};for(let s in e)o[s]=m1(e[s],t,r,n,i);e=o}else e=t(e,n);return e}}function ou(e,t,r,n,i){let o=n||r?0|e[se]:0,s=n?!!(32&o):void 0;n=hr(e);for(let a=0;a<n.length;a++)n[a]=m1(n[a],t,r,s,i);return r&&((e=Qd(e))&&(n[to]=hr(e)),r(o,n)),n}function J_(e){return e.B===es?e.toJSON():(function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return jd(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(rc(t))return}else{if(dc(t))return g0(t);if(t instanceof wn){let r=t.g;return r==null?"":typeof r=="string"?r:t.g=g0(r)}}}return t})(e)}function Y_(e){return ou(e,J_,void 0,void 0,!1)}var g1,Z_;function Xo(e,t,r){return e=y1(e,t[0],t[1],r?1:2),t!==g1&&r&&Xd(e,16384),e}function y1(e,t,r,n){if(e==null){var i=96;r?(e=[r],i|=512):e=[],t&&(i=-33521665&i|(1023&t)<<15)}else{if(!Array.isArray(e))throw Error("narr");if(2048&(i=0|e[se]))throw Error("farr");if(64&i)return e;if(n===1||n===2||(i|=64),r&&(i|=512,r!==e[0]))throw Error("mid");e:{if(n=(r=e).length){let o=n-1;if(Zd(r[o])){if((t=o-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&t)<<15;break e}}if(t){if((t=Math.max(t,n-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&t)<<15}}}return ct(e,i),e}function b1(e,t,r=zd){if(e!=null){if(Q0&&e instanceof Uint8Array)return t?e:new Uint8Array(e);if(Array.isArray(e)){var n=0|e[se];return 2&n?e:(t&&=n===0||!!(32&n)&&!(64&n||!(16&n)),t?(ct(e,-12293&(34|n)),e):ou(e,b1,4&n?zd:r,!0,!0))}return e.B===es&&(e=2&(n=0|(r=e.l)[se])?e:new e.constructor(gc(r,n,!0))),e}}function v1(e){let t=e.l;return new e.constructor(gc(t,0|t[se],!1))}function gc(e,t,r){let n=r||2&t?zd:z_,i=!!(32&t);return e=(function(o,s,a){let c=hr(o);var l=c.length;let h=256&s?c[l-1]:void 0;for(l+=h?-1:0,s=512&s?1:0;s<l;s++)c[s]=a(c[s]);if(h){s=c[s]={};for(let d in h)s[d]=a(h[d])}return(o=Qd(o))&&(c[to]=hr(o)),c})(e,t,(o=>b1(o,i,n))),Xd(e,32|(r?2:0)),e}function su(e){let t=e.l,r=0|t[se];return 2&r?new e.constructor(gc(t,r,!1)):e}function wr(e,t){return Zn(e=e.l,0|e[se],t)}function Zn(e,t,r,n){if(r===-1)return null;var i=r+(512&t?0:-1);let o=e.length-1;return i>=o&&256&t?e[o][r]:n&&256&t&&(t=e[o][r])!=null?(e[i]!=null&&Dd!=null&&((i=(e=F_??={})[Dd]||0)>=4||(e[Dd]=i+1,n1(e=Error(),"incident"),(function(s){Kn.setTimeout((()=>{throw s}),0)})(e))),t):i<=o?e[i]:void 0}function ft(e,t,r){let n=e.l,i=0|n[se];return Yn(i),lt(n,i,t,r),e}function lt(e,t,r,n){let i=512&t?0:-1,o=r+i;var s=e.length-1;return o>=s&&256&t?(e[s][r]=n,t):o<=s?(e[o]=n,256&t&&r in(e=e[s])&&delete e[r],t):(n!==void 0&&(r>=(s=t>>15&1023||536870912)?n!=null&&(e[s+i]={[r]:n},ct(e,t|=256)):e[o]=n),t)}function _1(e){let t=0|(e=e.l)[se],r=Zn(e,t,1),n=s1(r,!0);return n!=null&&n!==r&&lt(e,t,1,n),n}function w1(e,t,r,n,i){let o=e.l,s=2&(e=0|o[se])?1:n;i=!!i;let a=0|(n=au(o,e,t))[se];if(!(4&a)){4&a&&(n=hr(n),a=en(a,e),e=lt(o,e,t,n));let c=0,l=0;for(;c<n.length;c++){let h=r(n[c]);h!=null&&(n[l++]=h)}l<c&&(n.length=l),a=cu(a,e),r=-4097&(20|a),a=r&=-8193,ct(n,a),2&a&&Object.freeze(n)}return s===1||s===4&&32&a?Qr(a)||(i=a,a|=2,a!==i&&ct(n,a),Object.freeze(n)):(s===2&&Qr(a)&&(n=hr(n),a=en(a,e),a=kn(a,e,i),ct(n,a),e=lt(o,e,t,n)),Qr(a)||(t=a,a=kn(a,e,i),a!==t&&ct(n,a))),n}function au(e,t,r,n){return e=Zn(e,t,r,n),Array.isArray(e)?e:Yd}function cu(e,t){return e===0&&(e=en(e,t)),1|e}function Qr(e){return!!(2&e)&&!!(4&e)||!!(2048&e)}function x0(e,t,r){let n=0|(e=e.l)[se];if(Yn(n),r==null)lt(e,n,t);else{var i=0|r[se],o=i,s=Qr(i),a=s||Object.isFrozen(r);for(s||(i=0),a||(r=hr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),i|=21,s=0;s<r.length;s++){let c=r[s],l=p1(c);Object.is(c,l)||(a&&(r=hr(r),o=0,i=kn(i=en(i,n),n,!0),a=!1),r[s]=l)}i!==o&&(a&&(r=hr(r),i=kn(i=en(i,n),n,!0)),ct(r,i)),lt(e,n,t,r)}}function S1(e,t){let r=0|(e=e.l)[se];Yn(r),lt(e,r,2,t===""?void 0:t)}function rs(e,t,r,n,i){Yn(t);var o=!(!(64&t)&&16384&t);let s=(i=au(e,t,r,i))!==Yd;if(o||!s){let a=o=s?0|i[se]:0;(!s||2&a||Qr(a)||4&a&&!(32&a))&&(i=hr(i),a=en(a,t),t=lt(e,t,r,i)),a=-13&cu(a,t),a=kn(n?-17&a:16|a,t,!0),a!==o&&ct(i,a)}return i}function Bd(e,t){var r=u2;return hu(lu(e=e.l),e,0|e[se],r)===t?t:-1}function lu(e){if(uc)return e[$o]??(e[$o]=new Map);if($o in e)return e[$o];let t=new Map;return Object.defineProperty(e,$o,{value:t}),t}function k1(e,t,r,n){let i=lu(e),o=hu(i,e,t,r);return o!==n&&(o&&(t=lt(e,t,o)),i.set(r,n)),t}function hu(e,t,r,n){let i=e.get(n);if(i!=null)return i;i=0;for(let o=0;o<n.length;o++){let s=n[o];Zn(t,r,s)!=null&&(i!==0&&(r=lt(t,r,i)),i=s)}return e.set(n,i),i}function du(e,t,r,n){let i,o=0|e[se];if((n=Zn(e,o,r,n))!=null&&n.B===es)return(t=su(n))!==n&&lt(e,o,r,t),t.l;if(Array.isArray(n)){let s=0|n[se];i=2&s?Xo(gc(n,s,!1),t,!0):64&s?n:Xo(i,t,!0)}else i=Xo(void 0,t,!0);return i!==n&&lt(e,o,r,i),i}function E1(e,t,r,n){let i=0|(e=e.l)[se];return(t=f1(n=Zn(e,i,r,n),t,i))!==n&&t!=null&&lt(e,i,r,t),t}function Sr(e,t,r){if((t=E1(e,t,r,!1))==null)return t;let n=0|(e=e.l)[se];if(!(2&n)){let i=su(t);i!==t&&lt(e,n,r,t=i)}return t}function C1(e,t,r,n,i,o){e=e.l;var s=!!(2&t);let a=s?1:n;i=!!i,o&&=!s;var c=0|(n=au(e,t,1))[se];if(!(s=!!(4&c))){var l=n,h=t;let d=!!(2&(c=cu(c,t)));d&&(h|=2);let g=!d,f=!0,m=0,u=0;for(;m<l.length;m++){let b=f1(l[m],r,h);if(b instanceof r){if(!d){let _=!!(2&(0|b.l[se]));g&&=!_,f&&=_}l[u++]=b}}u<m&&(l.length=u),c|=4,c=f?16|c:-17&c,ct(l,c=g?8|c:-9&c),d&&Object.freeze(l)}if(o&&!(8&c||!n.length&&(a===1||a===4&&32&c))){for(Qr(c)&&(n=hr(n),c=en(c,t),t=lt(e,t,1,n)),r=n,o=c,l=0;l<r.length;l++)(c=r[l])!==(h=su(c))&&(r[l]=h);o|=8,ct(r,o=r.length?-17&o:16|o),c=o}return a===1||a===4&&32&c?Qr(c)||(t=c,(c|=!n.length||16&c&&(!s||32&c)?2:2048)!==t&&ct(n,c),Object.freeze(n)):(a===2&&Qr(c)&&(ct(n=hr(n),c=kn(c=en(c,t),t,i)),t=lt(e,t,1,n)),Qr(c)||(e=c,(c=kn(c,t,i))!==e&&ct(n,c))),n}function uu(e,t){let r=0|e.l[se];return C1(e,r,t,a1===void 0?2:4,!1,!(2&r))}function kr(e,t,r,n){return n==null&&(n=void 0),ft(e,r,n)}function Od(e,t,r){var n=c2;r==null&&(r=void 0);e:{let i=0|(e=e.l)[se];if(Yn(i),r==null){let o=lu(e);if(hu(o,e,i,n)!==t)break e;o.set(n,0)}else i=k1(e,i,n,t);lt(e,i,t,r)}}function en(e,t){return-2049&(e=32|(2&t?2|e:-3&e))}function kn(e,t,r){return 32&t&&r||(e&=-33),e}function x1(e,t){var r=Tu;let n=0|e.l[se];Yn(n),e=C1(e,n,r,2,!0),t=t??new r,e.push(t),e[se]=2&(0|t.l[se])?-9&e[se]:-17&e[se]}function Bt(e,t,r){Yn(0|e.l[se]),w1(e,t,Sn,2,!0).push(p1(r))}function A1(e,t){return Error(`Invalid wire type: ${e} (at position ${t})`)}function pu(){return Error("Failed to read varint, encoding is invalid.")}function T1(e,t){return Error(`Tried to read past the end of the data ${t} > ${e}`)}function fu(e){if(typeof e=="string")return{buffer:t1(e),u:!1};if(Array.isArray(e))return{buffer:new Uint8Array(e),u:!1};if(e.constructor===Uint8Array)return{buffer:e,u:!1};if(e.constructor===ArrayBuffer)return{buffer:new Uint8Array(e),u:!1};if(e.constructor===wn)return{buffer:Kd(e)||new Uint8Array(0),u:!0};if(e instanceof Uint8Array)return{buffer:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u:!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 mu(e,t){let r,n=0,i=0,o=0,s=e.i,a=e.g;do r=s[a++],n|=(127&r)<<o,o+=7;while(o<32&&128&r);for(o>32&&(i|=(127&r)>>4),o=3;o<32&&128&r;o+=7)r=s[a++],i|=(127&r)<<o;if(qn(e,a),r<128)return t(n>>>0,i>>>0);throw pu()}function gu(e){let t=0,r=e.g,n=r+10,i=e.i;for(;r<n;){let o=i[r++];if(t|=o,(128&o)==0)return qn(e,r),!!(127&t)}throw pu()}function Ot(e){let t=e.i,r=e.g,n=t[r++],i=127&n;if(128&n&&(n=t[r++],i|=(127&n)<<7,128&n&&(n=t[r++],i|=(127&n)<<14,128&n&&(n=t[r++],i|=(127&n)<<21,128&n&&(n=t[r++],i|=n<<28,128&n&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++]&&128&t[r++])))))throw pu();return qn(e,r),i}function Hd(e){var t=e.i;let r=e.g,n=t[r],i=t[r+1],o=t[r+2];return t=t[r+3],qn(e,e.g+4),(n<<0|i<<8|o<<16|t<<24)>>>0}function Wd(e){var t=Hd(e);e=2*(t>>31)+1;let r=t>>>23&255;return t&=8388607,r==255?t?NaN:e*(1/0):r==0?1401298464324817e-60*e*t:e*Math.pow(2,r-150)*(t+8388608)}function Q_(e){return Ot(e)}function Ud(e,t,{C:r=!1}={}){e.C=r,t&&(t=fu(t),e.i=t.buffer,e.m=t.u,e.s=0,e.j=e.i.length,e.g=e.s)}function qn(e,t){if(e.g=t,t>e.j)throw T1(e.j,t)}function I1(e,t){if(t<0)throw Error(`Tried to read a negative byte length: ${t}`);let r=e.g,n=r+t;if(n>e.j)throw T1(t,e.j-r);return e.g=n,r}function R1(e,t){if(t==0)return eo();var r=I1(e,t);return e.C&&e.m?r=e.i.subarray(r,r+t):(e=e.i,r=r===(t=r+t)?new Uint8Array(0):G_?e.slice(r,t):new Uint8Array(e.subarray(r,t))),r.length==0?eo():new wn(r,Qi)}var A0=[];function P1(e){var t=e.g;if(t.g==t.j)return!1;e.j=e.g.g;var r=Ot(e.g)>>>0;if(t=r>>>3,!((r&=7)>=0&&r<=5))throw A1(r,e.j);if(t<1)throw Error(`Invalid field number: ${t} (at position ${e.j})`);return e.m=t,e.i=r,!0}function Qa(e){switch(e.i){case 0:e.i!=0?Qa(e):gu(e.g);break;case 1:qn(e=e.g,e.g+8);break;case 2:if(e.i!=2)Qa(e);else{var t=Ot(e.g)>>>0;qn(e=e.g,e.g+t)}break;case 5:qn(e=e.g,e.g+4);break;case 3:for(t=e.m;;){if(!P1(e))throw Error("Unmatched start-group tag: stream EOF");if(e.i==4){if(e.m!=t)throw Error("Unmatched end-group tag");break}Qa(e)}break;default:throw A1(e.i,e.j)}}function yc(e,t,r){let n=e.g.j,i=Ot(e.g)>>>0,o=e.g.g+i,s=o-n;if(s<=0&&(e.g.j=o,r(t,e,void 0,void 0,void 0),s=o-e.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);e.g.g=o,e.g.j=n}function yu(e){var t=Ot(e.g)>>>0,r=I1(e=e.g,t);if(e=e.i,I_){var n,i=e;(n=Id)||(n=Id=new TextDecoder("utf-8",{fatal:!0})),t=r+t,i=r===0&&t===i.length?i:i.subarray(r,t);try{var o=n.decode(i)}catch(a){if(Ka===void 0){try{n.decode(new Uint8Array([128]))}catch{}try{n.decode(new Uint8Array([97])),Ka=!0}catch{Ka=!1}}throw!Ka&&(Id=void 0),a}}else{t=(o=r)+t,r=[];let a,c=null;for(;o<t;){var s=e[o++];s<128?r.push(s):s<224?o>=t?$n():(a=e[o++],s<194||(192&a)!=128?(o--,$n()):r.push((31&s)<<6|63&a)):s<240?o>=t-1?$n():(a=e[o++],(192&a)!=128||s===224&&a<160||s===237&&a>=160||(192&(n=e[o++]))!=128?(o--,$n()):r.push((15&s)<<12|(63&a)<<6|63&n)):s<=244?o>=t-2?$n():(a=e[o++],(192&a)!=128||a-144+(s<<28)>>30!=0||(192&(n=e[o++]))!=128||(192&(i=e[o++]))!=128?(o--,$n()):(s=(7&s)<<18|(63&a)<<12|(63&n)<<6|63&i,s-=65536,r.push(55296+(s>>10&1023),56320+(1023&s)))):$n(),r.length>=8192&&(c=p0(c,r),r.length=0)}o=p0(c,r)}return o}function D1(e){let t=Ot(e.g)>>>0;return R1(e.g,t)}function bu(e,t,r){var n=Ot(e.g)>>>0;for(n=e.g.g+n;e.g.g<n;)r.push(t(e.g))}var Ya=[];function ew(e){return e}var Ji;function B1(e,t,r){t.g?t.j(e,t.g,t.i,r):t.j(e,t.i,r)}var Me=class{constructor(e,t){this.l=y1(e,t)}toJSON(){let e=!Ji;try{return e&&(Ji=Y_),O1(this)}finally{e&&(Ji=void 0)}}u(){return!!(2&(0|this.l[se]))}};function O1(e){var t=e.l;{t=(e=Ji(t))!==t;let l=e.length;if(l){var r=e[l-1],n=Zd(r);n?l--:r=void 0;var i=e;if(n){e:{var o,s=r,a=!1;if(s)for(let h in s)isNaN(+h)?(o??={})[h]=s[h]:(n=s[h],Array.isArray(n)&&(rc(n)||v0(n)&&n.size===0)&&(n=null),n==null&&(a=!0),n!=null&&((o??={})[h]=n));if(a||(o=s),o)for(let h in o){a=o;break e}a=null}s=a==null?r!=null:a!==r}for(;l>0&&((o=i[l-1])==null||rc(o)||v0(o)&&o.size===0);l--)var c=!0;(i!==e||s||c)&&(t?(c||s||a)&&(i.length=l):i=Array.prototype.slice.call(i,0,l),a&&i.push(a)),c=i}else c=e}return c}function T0(e){return e?/^\d+$/.test(e)?(fc(e),new $d(De,Ge)):null:tw||=new $d(0,0)}Me.prototype.B=es,Me.prototype.toString=function(){try{return Ji=ew,O1(this).toString()}finally{Ji=void 0}};var $d=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},tw;function I0(e){return e?/^-?\d+$/.test(e)?(fc(e),new Gd(De,Ge)):null:rw||=new Gd(0,0)}var Gd=class{constructor(e,t){this.i=e>>>0,this.g=t>>>0}},rw;function Yi(e,t,r){for(;r>0||t>127;)e.g.push(127&t|128),t=(t>>>7|r<<25)>>>0,r>>>=7;e.g.push(t)}function ns(e,t){for(;t>127;)e.g.push(127&t|128),t>>>=7;e.g.push(t)}function bc(e,t){if(t>=0)ns(e,t);else{for(let r=0;r<9;r++)e.g.push(127&t|128),t>>=7;e.g.push(1)}}function oc(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 no(e,t){t.length!==0&&(e.j.push(t),e.i+=t.length)}function Er(e,t,r){ns(e.g,8*t+r)}function vc(e,t){return Er(e,t,2),t=e.g.end(),no(e,t),t.push(e.i),t}function _c(e,t){var r=t.pop();for(r=e.i+e.g.length()-r;r>127;)t.push(127&r|128),r>>>=7,e.i++;t.push(r),e.i++}function wc(e,t,r){Er(e,t,2),ns(e.g,r.length),no(e,e.g.end()),no(e,r)}function Cr(){let e=class{constructor(){throw Error()}};return Object.setPrototypeOf(e,e.prototype),e}var vu=Cr(),U1=Cr(),_u=Cr(),wu=Cr(),L1=Cr(),F1=Cr(),M1=Cr(),N1=Cr(),io=class{constructor(e,t,r){this.g=e,this.i=t,e=vu,this.j=!!e&&r===e||!1}};function Su(e,t){return new io(e,t,vu)}function z1(e,t,r,n,i){(t=W1(t,n))!=null&&(r=vc(e,r),i(t,e),_c(e,r))}var nw=Su((function(e,t,r,n,i){return e.i===2&&(yc(e,du(t,n,r),i),!0)}),z1),iw=Su((function(e,t,r,n,i){return e.i===2&&(yc(e,du(t,n,r,!0),i),!0)}),z1),Sc=Symbol(),ku=Symbol(),R0=Symbol(),P0=Symbol(),j1,V1;function Qn(e,t,r,n){var i=n[e];if(i)return i;(i={}).P=n,i.A=(function(d){switch(typeof d){case"boolean":return g1||=[0,void 0,!0];case"number":return d>0?void 0:d===0?Z_||=[0,void 0]:[-d,void 0];case"string":return[0,d];case"object":return d}})(n[0]);var o=n[1];let s=1;o&&o.constructor===Object&&(i.H=o,typeof(o=n[++s])=="function"&&(i.I=!0,j1??=o,V1??=n[s+1],o=n[s+=2]));let a={};for(;o&&Array.isArray(o)&&o.length&&typeof o[0]=="number"&&o[0]>0;){for(var c=0;c<o.length;c++)a[o[c]]=o;o=n[++s]}for(c=1;o!==void 0;){let d;typeof o=="number"&&(c+=o,o=n[++s]);var l=void 0;if(o instanceof io?d=o:(d=nw,s--),d?.j){o=n[++s],l=n;var h=s;typeof o=="function"&&(o=o(),l[h]=o),l=o}for(h=c+1,typeof(o=n[++s])=="number"&&o<0&&(h-=o,o=n[++s]);c<h;c++){let g=a[c];l?r(i,c,d,l,g):t(i,c,d,g)}}return n[e]=i}function H1(e){return Array.isArray(e)?e[0]instanceof io?e:[iw,e]:[e,void 0]}function W1(e,t){return e instanceof Me?e.l:Array.isArray(e)?Xo(e,t,!1):void 0}function Eu(e,t,r,n){let i=r.g;e[t]=n?(o,s,a)=>i(o,s,a,n):i}function Cu(e,t,r,n,i){let o=r.g,s,a;e[t]=(c,l,h)=>o(c,l,h,a||=Qn(ku,Eu,Cu,n).A,s||=xu(n),i)}function xu(e){let t=e[R0];if(t!=null)return t;let r=Qn(ku,Eu,Cu,e);return t=r.I?(n,i)=>j1(n,i,r):(n,i)=>{let o=0|n[se];for(;P1(i)&&i.i!=4;){var s=i.m,a=r[s];if(a==null){var c=r.H;c&&(c=c[s])&&(c=ow(c))!=null&&(a=r[s]=c)}a!=null&&a(i,n,s)||(s=(a=i).j,Qa(a),a.G?a=void 0:(c=a.g.g-s,a.g.g=s,a=R1(a.g,c)),s=n,a&&((c=s[to])?c.push(a):s[to]=[a]))}return 16384&o&&Xd(n,34),!0},e[R0]=t}function ow(e){let t=(e=H1(e))[0].g;if(e=e[1]){let r=xu(e),n=Qn(ku,Eu,Cu,e).A;return(i,o,s)=>t(i,o,s,n,r)}return t}function kc(e,t,r){e[t]=r.i}function Ec(e,t,r,n){let i,o,s=r.i;e[t]=(a,c,l)=>s(a,c,l,o||=Qn(Sc,kc,Ec,n).A,i||=$1(n))}function $1(e){let t=e[P0];if(!t){let r=Qn(Sc,kc,Ec,e);t=(n,i)=>G1(n,i,r),e[P0]=t}return t}function G1(e,t,r){for(var n=0|e[se],i=512&n?0:-1,o=e.length,s=512&n?1:0,a=o+(256&n?-1:0);s<a;s++){let c=e[s];if(c==null)continue;let l=s-i,h=D0(r,l);h&&h(t,c,l)}if(256&n){n=e[o-1];for(let c in n)i=+c,Number.isNaN(i)||(o=n[i])!=null&&(a=D0(r,i))&&a(t,o,i)}if(e=Qd(e))for(no(t,t.g.end()),r=0;r<e.length;r++)no(t,Kd(e[r])||new Uint8Array(0))}function D0(e,t){var r=e[t];if(r)return r;if((r=e.H)&&(r=r[t])){var n=(r=H1(r))[0].i;if(r=r[1]){let i=$1(r),o=Qn(Sc,kc,Ec,r).A;r=e.I?V1(o,i):(s,a,c)=>n(s,a,c,o,i)}else r=n;return e[t]=r}}function Cc(e,t){if(Array.isArray(t)){var r=0|t[se];if(4&r)return t;for(var n=0,i=0;n<t.length;n++){let o=e(t[n]);o!=null&&(t[i++]=o)}return i<n&&(t.length=i),ct(t,-12289&(5|r)),2&r&&Object.freeze(t),t}}function wt(e,t,r){return new io(e,t,r)}function xc(e,t,r){return new io(e,t,r)}function St(e,t,r){lt(e,0|e[se],t,r)}function q1(e,t,r){if(t=(function(n){if(n==null)return n;let i=typeof n;if(i==="bigint")return String(h1(64,n));if(iu(n)){if(i==="string")return u1(n);if(i==="number")return d1(n)}})(t),t!=null&&(typeof t=="string"&&I0(t),t!=null))switch(Er(e,r,0),typeof t){case"number":e=e.g,ro(t),Yi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new Gd(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Yi(e.g,r.i,r.g);break;default:r=I0(t),Yi(e.g,r.i,r.g)}}function K1(e,t,r){(t=Xn(t))!=null&&t!=null&&(Er(e,r,0),bc(e.g,t))}function X1(e,t,r){(t=t==null||typeof t=="boolean"?t:typeof t=="number"?!!t:void 0)!=null&&(Er(e,r,0),e.g.g.push(t?1:0))}function J1(e,t,r){(t=Sn(t))!=null&&wc(e,r,J0(t))}function Y1(e,t,r,n,i){(t=W1(t,n))!=null&&(r=vc(e,r),i(t,e),_c(e,r))}function Z1(e,t,r){(t=t==null||typeof t=="string"||dc(t)||t instanceof wn?t:void 0)!=null&&wc(e,r,fu(t).buffer)}var sw=wt((function(e,t,r){if(e.i!==1)return!1;var n=e.g;e=Hd(n);let i=Hd(n);n=2*(i>>31)+1;let o=i>>>20&2047;return e=4294967296*(1048575&i)+e,St(t,r,o==2047?e?NaN:n*(1/0):o==0?5e-324*n*e:n*Math.pow(2,o-1075)*(e+4503599627370496)),!0}),(function(e,t,r){(t=ts(t))!=null&&(Er(e,r,1),e=e.g,(r=c1||=new DataView(new ArrayBuffer(8))).setFloat64(0,+t,!0),De=r.getUint32(0,!0),Ge=r.getUint32(4,!0),oc(e,De),oc(e,Ge))}),Cr()),Q1=wt((function(e,t,r){return e.i===5&&(St(t,r,Wd(e.g)),!0)}),(function(e,t,r){(t=ts(t))!=null&&(Er(e,r,5),e=e.g,l1(t),oc(e,De))}),F1),aw=xc((function(e,t,r){return(e.i===5||e.i===2)&&(t=rs(t,0|t[se],r,!1,!1),e.i==2?bu(e,Wd,t):t.push(Wd(e.g)),!0)}),(function(e,t,r){if((t=Cc(ts,t))!=null&&t.length){Er(e,r,2),ns(e.g,4*t.length);for(let n=0;n<t.length;n++)r=e.g,l1(t[n]),oc(r,De)}}),F1),sc=wt((function(e,t,r){return e.i===0&&(St(t,r,mu(e.g,ru)),!0)}),q1,L1),Ld=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=mu(e.g,ru))===0?void 0:e),!0)}),q1,L1),cw=wt((function(e,t,r){return e.i===0&&(St(t,r,mu(e.g,tu)),!0)}),(function(e,t,r){if((t=X_(t))!=null&&(typeof t=="string"&&T0(t),t!=null))switch(Er(e,r,0),typeof t){case"number":e=e.g,ro(t),Yi(e,De,Ge);break;case"bigint":r=BigInt.asUintN(64,t),r=new $d(Number(r&BigInt(4294967295)),Number(r>>BigInt(32))),Yi(e.g,r.i,r.g);break;default:r=T0(t),Yi(e.g,r.i,r.g)}}),Cr()),En=wt((function(e,t,r){return e.i===0&&(St(t,r,Ot(e.g)),!0)}),K1,wu),Au=xc((function(e,t,r){return(e.i===0||e.i===2)&&(t=rs(t,0|t[se],r,!1,!1),e.i==2?bu(e,Ot,t):t.push(Ot(e.g)),!0)}),(function(e,t,r){if((t=Cc(Xn,t))!=null&&t.length){r=vc(e,r);for(let n=0;n<t.length;n++)bc(e.g,t[n]);_c(e,r)}}),wu),Ki=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Ot(e.g))===0?void 0:e),!0)}),K1,wu),$t=wt((function(e,t,r){return e.i===0&&(St(t,r,gu(e.g)),!0)}),X1,U1),Zi=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=gu(e.g))===!1?void 0:e),!0)}),X1,U1),ar=xc((function(e,t,r){return e.i===2&&(e=yu(e),rs(t,0|t[se],r,!1).push(e),!0)}),(function(e,t,r){if((t=Cc(Sn,t))!=null)for(let s=0;s<t.length;s++){var n=e,i=r,o=t[s];o!=null&&wc(n,i,J0(o))}}),_u),_n=wt((function(e,t,r){return e.i===2&&(St(t,r,(e=yu(e))===""?void 0:e),!0)}),J1,_u),Ze=wt((function(e,t,r){return e.i===2&&(St(t,r,yu(e)),!0)}),J1,_u),cr=(function(e,t,r=vu){return new io(e,t,r)})((function(e,t,r,n,i){return e.i===2&&(n=Xo(void 0,n,!0),rs(t,0|t[se],r,!0).push(n),yc(e,n,i),!0)}),(function(e,t,r,n,i){if(Array.isArray(t))for(let o=0;o<t.length;o++)Y1(e,t[o],r,n,i)})),pt=Su((function(e,t,r,n,i,o){return e.i===2&&(k1(t,0|t[se],o,r),yc(e,t=du(t,n,r),i),!0)}),Y1),e2=wt((function(e,t,r){return e.i===2&&(St(t,r,D1(e)),!0)}),Z1,M1),lw=wt((function(e,t,r){return e.i===0&&(St(t,r,(e=Ot(e.g)>>>0)===0?void 0:e),!0)}),(function(e,t,r){t=(function(n){if(n==null)return n;if(typeof n=="string"&&n)n=+n;else if(typeof n!="number")return;return mc(n)?n>>>0:void 0})(t),t!=null&&t!=null&&(Er(e,r,0),ns(e.g,t))}),Cr()),Jn=wt((function(e,t,r){return e.i===0&&(St(t,r,Ot(e.g)),!0)}),(function(e,t,r){(t=Xn(t))!=null&&(t=parseInt(t,10),Er(e,r,0),bc(e.g,t))}),N1),ac=class{constructor(t,r){this.i=t,this.g=r,this.j=kr,this.defaultValue=void 0}};function t2(e,t){return(r,n)=>{if(Ya.length){let o=Ya.pop();o.o(n),Ud(o.g,r,n),r=o}else r=new class{constructor(o,s){if(A0.length){let a=A0.pop();Ud(a,o,s),o=a}else o=new class{constructor(a,c){this.i=null,this.m=!1,this.g=this.j=this.s=0,Ud(this,a,c)}clear(){this.i=null,this.m=!1,this.g=this.j=this.s=0,this.C=!1}}(o,s);this.g=o,this.j=this.g.g,this.i=this.m=-1,this.o(s)}o({G:o=!1}={}){this.G=o}}(r,n);try{let o=new e,s=o.l;xu(t)(s,r);var i=o}finally{r.g.clear(),r.m=-1,r.i=-1,Ya.length<100&&Ya.push(r)}return i}}var B0=[0,_n,wt((function(e,t,r){return e.i===2&&(St(t,r,(e=D1(e))===eo()?void 0:e),!0)}),(function(e,t,r){if(t!=null){if(t instanceof Me){let n=t.R;return void(n&&(t=n(t),t!=null&&wc(e,r,fu(t).buffer)))}if(Array.isArray(t))return}Z1(e,t,r)}),M1)],Fd,O0=globalThis.trustedTypes;function U0(e){Fd===void 0&&(Fd=(function(){let r=null;if(!O0)return r;try{let n=i=>i;r=O0.createPolicy("goog#html",{createHTML:n,createScript:n,createScriptURL:n})}catch{}return r})());var t=Fd;return new class{constructor(r){this.g=r}toString(){return this.g+""}}(t?t.createScriptURL(e):e)}function hw(e,...t){if(t.length===0)return U0(e[0]);let r=e[0];for(let n=0;n<t.length;n++)r+=encodeURIComponent(t[n])+e[n+1];return U0(r)}var r2=[0,En,Jn,$t,-1,Au,Jn,-1],dw=class extends Me{constructor(e){super(e)}},n2=[0,$t,Ze,$t,Jn,-1,xc((function(e,t,r){return(e.i===0||e.i===2)&&(t=rs(t,0|t[se],r,!1,!1),e.i==2?bu(e,Q_,t):t.push(Ot(e.g)),!0)}),(function(e,t,r){if((t=Cc(Xn,t))!=null&&t.length){r=vc(e,r);for(let n=0;n<t.length;n++)bc(e.g,t[n]);_c(e,r)}}),N1),Ze,-1,[0,$t,-1],Jn,$t,-1],i2=[0,Ze,-2],L0=class extends Me{constructor(e){super(e)}},o2=[0],s2=[0,En,$t,1,$t,-3],a2=class extends Me{constructor(e){super(e,2)}},Ac={};Ac[336783863]=[0,Ze,$t,-1,En,[0,[1,2,3,4,5,6,7,8],pt,o2,pt,n2,pt,i2,pt,s2,pt,r2,pt,[0,Ze,-2],pt,[0,Ze,Jn],pt,[0,Jn,Ze]],[0,Ze],$t,[0,[1,3],[2,4],pt,[0,Au],-1,pt,[0,ar],-1,cr,[0,Ze,-1]],Ze];var F0,M0=[0,Ld,-1,Zi,-3,Ld,Au,_n,Ki,Ld,-1,Zi,Ki,Zi,-2,_n],Tu=class extends Me{constructor(e){super(e,500)}o(e){return kr(this,0,7,e)}},Jo=[-1,{}],N0=[0,Ze,1,Jo],z0=[0,Ze,ar,Jo],Iu=class extends Me{constructor(e){super(e,500)}o(e){return kr(this,0,1001,e)}};Iu.prototype.g=(F0=[-500,cr,[-500,_n,-1,ar,-3,[-2,Ac,$t],cr,B0,Ki,-1,N0,z0,cr,[0,_n,Zi],_n,M0,Ki,ar,987,ar],4,cr,[-500,Ze,-1,[-1,{}],998,Ze],cr,[-500,Ze,ar,-1,[-2,{},$t],997,ar,-1],Ki,cr,[-500,Ze,ar,Jo,998,ar],ar,Ki,N0,z0,cr,[0,_n,-1,Jo],ar,-2,M0,_n,-1,Zi,[0,Zi,lw],978,Jo,cr,B0],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 o=this.g;return this.g=[],o}}}};G1(this.l,e,Qn(Sc,kc,Ec,F0)),no(e,e.g.end());let t=new Uint8Array(e.i),r=e.j,n=r.length,i=0;for(let o=0;o<n;o++){let s=r[o];t.set(s,i),i+=s.length}return e.j=[t],t});var uw=class extends Me{constructor(e){super(e)}},pw=class extends Me{constructor(e){super(e)}g(){return uu(this,uw)}},fw=[0,cr,[0,En,Q1,Ze,-1]],j0=class extends Me{constructor(e){super(e)}},V0=class extends Me{constructor(e){super(e)}},c2=[1,2,3,4,5],cc=class extends Me{constructor(e){super(e)}g(){return _1(this)!=null}i(){return Sn(wr(this,2))!=null}},lc=class extends Me{constructor(e){super(e)}},l2=class extends Me{constructor(e){super(e)}},h2=[0,[0,e2,Ze,[0,En,sc,-1],[0,cw,sc]],$t,[0,c2,pt,s2,pt,n2,pt,r2,pt,o2,pt,i2],Jn],mw=new ac(451755788,l2);Ac[451755788]=[0,h2,[0,Ze,En,Q1,ar,-1],sw];var H0=class extends Me{constructor(e){super(e)}},d2=class extends Me{constructor(e){super(e)}},gw=new ac(487277289,d2);Ac[487277289]=[0,h2,[0,$t,-1]];var yw=class extends Me{constructor(e){super(e)}},bw=t2(class extends Me{constructor(e){super(e)}},[0,cr,[0,1,En,Ze,fw],sc]),W0=class extends Me{constructor(e){super(e)}},vw=class extends Me{constructor(e){super(e)}J(){let e=_1(this);return e??eo()}},_w=class extends Me{constructor(e){super(e)}},u2=[1,2],$0=t2(class extends Me{constructor(e){super(e)}},[0,cr,[0,u2,pt,[0,aw],pt,[0,e2],En,Ze],sc]);function ww(){var e=navigator;return typeof OffscreenCanvas<"u"&&(!(function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")})(e)||!!((e=e.userAgent.match(/Version\/([\d]+).*Safari/))&&e.length>=1&&Number(e[1])>=17))}async function G0(e){if(typeof importScripts!="function"){let t=document.createElement("script");return t.src=e.toString(),t.crossOrigin="anonymous",new Promise(((r,n)=>{t.addEventListener("load",(()=>{r()}),!1),t.addEventListener("error",(i=>{n(i)}),!1),document.body.appendChild(t)}))}importScripts(e.toString())}function ie(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 q0(e,t,r){e.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");let n=new Uint32Array(t.length);for(let i=0;i<t.length;i++)n[i]=e.h.stringToNewUTF8(t[i]);t=e.h._malloc(4*n.length),e.h.HEAPU32.set(n,t>>2),r(t);for(let i of n)e.h._free(i);e.h._free(t)}function yn(e,t,r){e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=r}function Gn(e,t,r){let n=[];e.h.simpleListeners=e.h.simpleListeners||{},e.h.simpleListeners[t]=(i,o,s)=>{o?(r(n,s),n=[]):n.push(i)}}var Sw=(function(e){return class extends e{N(){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:ww()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(e){let t=await(await fetch(e)).arrayBuffer();e=!(e.endsWith(".pbtxt")||e.endsWith(".textproto")),this.setGraph(new Uint8Array(t),e)}setGraphFromString(e){this.setGraph(new TextEncoder().encode(e),!1)}setGraph(e,t){let r=e.length,n=this.h._malloc(r);this.h.HEAPU8.set(e,n),t?this.h._changeBinaryGraph(r,n):this.h._changeTextGraph(r,n),this.h._free(n)}configureAudio(e,t,r,n,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ie(this,n||"input_audio",(o=>{ie(this,i=i||"audio_header",(s=>{this.h._configureAudio(o,s,e,t??0,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,n,i){let o=4*e.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(e,this.g/4),ie(this,n,(s=>{this.h._addAudioToInputStream(this.g,t,r,s,i)}))}addGpuBufferToStream(e,t,r){ie(this,t,(n=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");n?this.h._bindTextureToStream(n):this.h._bindTextureToCanvas();let i=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),this.h.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);let[o,s]=e.videoWidth!==void 0?[e.videoWidth,e.videoHeight]:e.naturalWidth!==void 0?[e.naturalWidth,e.naturalHeight]:e.displayWidth!==void 0?[e.displayWidth,e.displayHeight]:[e.width,e.height];!this.j||o===this.h.canvas.width&&s===this.h.canvas.height||(this.h.canvas.width=o,this.h.canvas.height=s);let[a,c]=[o,s];this.h._addBoundTextureToStream(n,a,c,r)}))}addBoolToStream(e,t,r){ie(this,t,(n=>{this.h._addBoolToInputStream(e,n,r)}))}addDoubleToStream(e,t,r){ie(this,t,(n=>{this.h._addDoubleToInputStream(e,n,r)}))}addFloatToStream(e,t,r){ie(this,t,(n=>{this.h._addFloatToInputStream(e,n,r)}))}addIntToStream(e,t,r){ie(this,t,(n=>{this.h._addIntToInputStream(e,n,r)}))}addUintToStream(e,t,r){ie(this,t,(n=>{this.h._addUintToInputStream(e,n,r)}))}addStringToStream(e,t,r){ie(this,t,(n=>{ie(this,e,(i=>{this.h._addStringToInputStream(i,n,r)}))}))}addStringRecordToStream(e,t,r){ie(this,t,(n=>{q0(this,Object.keys(e),(i=>{q0(this,Object.values(e),(o=>{this.h._addFlatHashMapToInputStream(i,o,Object.keys(e).length,n,r)}))}))}))}addProtoToStream(e,t,r,n){ie(this,r,(i=>{ie(this,t,(o=>{let s=this.h._malloc(e.length);this.h.HEAPU8.set(e,s),this.h._addProtoToInputStream(s,e.length,o,i,n),this.h._free(s)}))}))}addEmptyPacketToStream(e,t){ie(this,e,(r=>{this.h._addEmptyPacketToInputStream(r,t)}))}addBoolVectorToStream(e,t,r){ie(this,t,(n=>{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._addBoolVectorToInputStream(i,n,r)}))}addDoubleVectorToStream(e,t,r){ie(this,t,(n=>{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._addDoubleVectorToInputStream(i,n,r)}))}addFloatVectorToStream(e,t,r){ie(this,t,(n=>{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._addFloatVectorToInputStream(i,n,r)}))}addIntVectorToStream(e,t,r){ie(this,t,(n=>{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._addIntVectorToInputStream(i,n,r)}))}addUintVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateUintVector(e.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let o of e)this.h._addUintVectorEntry(i,o);this.h._addUintVectorToInputStream(i,n,r)}))}addStringVectorToStream(e,t,r){ie(this,t,(n=>{let i=this.h._allocateStringVector(e.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let o of e)ie(this,o,(s=>{this.h._addStringVectorEntry(i,s)}));this.h._addStringVectorToInputStream(i,n,r)}))}addBoolToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addBoolToInputSidePacket(e,r)}))}addDoubleToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addDoubleToInputSidePacket(e,r)}))}addFloatToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addFloatToInputSidePacket(e,r)}))}addIntToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addIntToInputSidePacket(e,r)}))}addUintToInputSidePacket(e,t){ie(this,t,(r=>{this.h._addUintToInputSidePacket(e,r)}))}addStringToInputSidePacket(e,t){ie(this,t,(r=>{ie(this,e,(n=>{this.h._addStringToInputSidePacket(n,r)}))}))}addProtoToInputSidePacket(e,t,r){ie(this,r,(n=>{ie(this,t,(i=>{let o=this.h._malloc(e.length);this.h.HEAPU8.set(e,o),this.h._addProtoToInputSidePacket(o,e.length,i,n),this.h._free(o)}))}))}addBoolVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateBoolVector(e.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(let i of e)this.h._addBoolVectorEntry(n,i);this.h._addBoolVectorToInputSidePacket(n,r)}))}addDoubleVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateDoubleVector(e.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(let i of e)this.h._addDoubleVectorEntry(n,i);this.h._addDoubleVectorToInputSidePacket(n,r)}))}addFloatVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateFloatVector(e.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(let i of e)this.h._addFloatVectorEntry(n,i);this.h._addFloatVectorToInputSidePacket(n,r)}))}addIntVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateIntVector(e.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(let i of e)this.h._addIntVectorEntry(n,i);this.h._addIntVectorToInputSidePacket(n,r)}))}addUintVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateUintVector(e.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(let i of e)this.h._addUintVectorEntry(n,i);this.h._addUintVectorToInputSidePacket(n,r)}))}addStringVectorToInputSidePacket(e,t){ie(this,t,(r=>{let n=this.h._allocateStringVector(e.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(let i of e)ie(this,i,(o=>{this.h._addStringVectorEntry(n,o)}));this.h._addStringVectorToInputSidePacket(n,r)}))}attachBoolListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachBoolListener(r)}))}attachBoolVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachBoolVectorListener(r)}))}attachIntListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachIntListener(r)}))}attachIntVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachIntVectorListener(r)}))}attachUintListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachUintListener(r)}))}attachUintVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachUintVectorListener(r)}))}attachDoubleListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleListener(r)}))}attachDoubleVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachDoubleVectorListener(r)}))}attachFloatListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachFloatListener(r)}))}attachFloatVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachFloatVectorListener(r)}))}attachStringListener(e,t){yn(this,e,t),ie(this,e,(r=>{this.h._attachStringListener(r)}))}attachStringVectorListener(e,t){Gn(this,e,t),ie(this,e,(r=>{this.h._attachStringVectorListener(r)}))}attachProtoListener(e,t,r){yn(this,e,t),ie(this,e,(n=>{this.h._attachProtoListener(n,r||!1)}))}attachProtoVectorListener(e,t,r){Gn(this,e,t),ie(this,e,(n=>{this.h._attachProtoVectorListener(n,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?'),yn(this,e,((n,i)=>{n=new Float32Array(n.buffer,n.byteOffset,n.length/4),t(n,i)})),ie(this,e,(n=>{this.h._attachAudioListener(n,r||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}}),p2=class extends Sw{};async function kw(e,t,r){return e=await(async(n,i,o,s)=>{if(i&&await G0(i),!self.ModuleFactory||o&&(await G0(o),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&s&&((i=self.Module).locateFile=s.locateFile,s.mainScriptUrlOrBlob&&(i.mainScriptUrlOrBlob=s.mainScriptUrlOrBlob)),s=await self.ModuleFactory(self.Module||s),self.ModuleFactory=self.Module=void 0,new n(s,null)})(e,t.wasmLoaderPath,t.assetLoaderPath,{locateFile:n=>n.endsWith(".wasm")?t.wasmBinaryPath.toString():t.assetBinaryPath&&n.endsWith(".data")?t.assetBinaryPath.toString():n}),await e.o(r),e}async function f2(e,t,r){return kw(e,t,r)}function Md(e,t){let r=Sr(e.baseOptions,cc,1)||new cc;typeof t=="string"?(ft(r,2,ic(t)),ft(r,1)):t instanceof Uint8Array&&(ft(r,1,s1(t,!1)),ft(r,2)),kr(e.baseOptions,0,1,r)}function m2(e,t){let r=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Sr(e.baseOptions,cc,1)?.g()||Sr(e.baseOptions,cc,1)?.i()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if((function(n,i){let o=Sr(n.baseOptions,V0,3);if(!o){var s=o=new V0;Od(s,4,new L0)}"delegate"in i&&(i.delegate==="GPU"?Od(i=o,2,s=new dw):Od(i=o,4,s=new L0)),kr(n.baseOptions,0,3,o)})(e,r),r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then((n=>{if(n.ok)return n.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${n.status})`)})).then((n=>{try{e.g.h.FS_unlink("/model.dat")}catch{}e.g.h.FS_createDataFile("/","model.dat",new Uint8Array(n),!0,!1,!1),Md(e,"/model.dat"),e.v()}));if(r.modelAssetBuffer instanceof Uint8Array)Md(e,r.modelAssetBuffer);else if(r.modelAssetBuffer)return(async function(n){let i=[];for(var o=0;;){let{done:s,value:a}=await n.read();if(s)break;i.push(a),o+=a.length}if(i.length===0)return new Uint8Array(0);if(i.length===1)return i[0];n=new Uint8Array(o),o=0;for(let s of i)n.set(s,o),o+=s.length;return n})(r.modelAssetBuffer).then((n=>{Md(e,n),e.v()}));return e.v(),Promise.resolve()}function K0(e){try{let t=e.j.length;if(t===1)throw Error(e.j[0].message);if(t>1)throw Error("Encountered multiple errors: "+e.j.map((r=>r.message)).join(", "))}finally{e.j=[]}}function Xi(e,t){e.s=Math.max(e.s,t)}var ec=class{constructor(e){this.g=e,this.j=[],this.s=0,this.g.setAutoRenderToScreen(!1)}setGraph(e,t){this.g.attachErrorListener(((r,n)=>{this.j.push(Error(n))})),this.g.N(),this.g.setGraph(e,t),K0(this)}finishProcessing(){this.g.finishProcessing(),K0(this)}close(){this.g.closeGraph()}};async function Yo(e,t,r){return f2(e,t,r)}ec.prototype.close=ec.prototype.close,(function(e,t){e=e.split(".");var r,n=Kn;for((e[0]in n)||n.execScript===void 0||n.execScript("var "+e[0]);e.length&&(r=e.shift());)e.length||t===void 0?n=n[r]&&n[r]!==Object.prototype[r]?n[r]:n[r]={}:n[r]=t})("TaskRunner",ec);var hc=class extends ec{constructor(){super(...arguments),this.F=48e3}O(e){this.F=e}};function Ew(e){let t={classifications:uu(e,yw).map((r=>(function(n,i=-1,o=""){return{categories:n.map((s=>{var a=Xn(wr(s,1))??0??-1;let c=s.l,l=0|c[se],h=Zn(c,l,2),d=ts(h);return d!=null&&d!==h&&lt(c,l,2,d),{index:a,score:d??0??0,categoryName:Sn(wr(s,3))??""??"",displayName:Sn(wr(s,4))??""??""}})),headIndex:i,headName:o}})(Sr(r,pw,4)?.g()??[],Xn(wr(r,2))??0,Sn(wr(r,3))??"")))};return Vd(wr(e,2))!=null&&(t.timestampMs=Vd(wr(e,2))??0),t}hc.prototype.setDefaultSampleRate=hc.prototype.O;var sr=class extends hc{constructor(e,t){super(new p2(e,t)),this.m=[],kr(e=this.i=new l2,0,1,t=new lc)}get baseOptions(){return Sr(this.i,lc,1)}set baseOptions(e){kr(this.i,0,1,e)}o(e){var t=this.i,r=Sr(this.i,j0,2);if(r=r?v1(r):new j0,e.displayNamesLocale!==void 0?ft(r,1,ic(e.displayNamesLocale)):e.displayNamesLocale===void 0&&ft(r,1),e.maxResults!==void 0){var n=e.maxResults;if(n!=null){if(typeof n!="number"||!mc(n))throw b0();n|=0}ft(r,2,n)}else"maxResults"in e&&ft(r,2);if(e.scoreThreshold!==void 0){if((n=e.scoreThreshold)!=null&&typeof n!="number")throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);ft(r,3,n)}else"scoreThreshold"in e&&ft(r,3);return e.categoryAllowlist!==void 0?x0(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&ft(r,4),e.categoryDenylist!==void 0?x0(r,5,e.categoryDenylist):"categoryDenylist"in e&&ft(r,5),kr(t,0,2,r),m2(this,e)}K(e,t){return this.D(e,t??this.F,this.s+1)}D(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]}v(){var e=new Iu;Bt(e,10,"audio_in"),Bt(e,10,"sample_rate"),Bt(e,15,"timestamped_classifications");let t=new a2;B1(t,mw,this.i);let r=new Tu;S1(r,ic("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),Bt(r,3,"AUDIO:audio_in"),Bt(r,3,"SAMPLE_RATE:sample_rate"),Bt(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.o(t),x1(e,r),this.g.attachProtoVectorListener("timestamped_classifications",((n,i)=>{(function(o,s){s.forEach((a=>{a=bw(a),o.m.push(Ew(a))}))})(this,n),Xi(this,i)})),this.g.attachEmptyPacketListener("timestamped_classifications",(n=>{Xi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}};function X0(e){return{embeddings:uu(e,_w).map((t=>{let r={headIndex:Xn(wr(t,3))??0??-1,headName:Sn(wr(t,4))??""??""};if(E1(t,W0,Bd(t,1))!==void 0)r.floatEmbedding=w1(Sr(t,W0,Bd(t,1)),1,ts,a1===void 0?2:4).slice();else{let n=new Uint8Array(0);r.quantizedEmbedding=Sr(t,vw,Bd(t,2))?.J()?.i()??n}return r})),timestampMs:Vd(wr(e,2))??0}}sr.prototype.classify=sr.prototype.K,sr.prototype.setOptions=sr.prototype.o,sr.createFromModelPath=function(e,t){return f2(sr,e,{baseOptions:{modelAssetPath:t}})},sr.createFromModelBuffer=function(e,t){return Yo(sr,e,{baseOptions:{modelAssetBuffer:t}})},sr.createFromOptions=function(e,t){return Yo(sr,e,t)};var Fr=class extends hc{constructor(e,t){super(new p2(e,t)),this.m=[],kr(e=this.i=new d2,0,1,t=new lc)}get baseOptions(){return Sr(this.i,lc,1)}set baseOptions(e){kr(this.i,0,1,e)}o(e){var t=this.i,r=Sr(this.i,H0,2);return r=r?v1(r):new H0,e.l2Normalize!==void 0?ft(r,1,E0(e.l2Normalize)):"l2Normalize"in e&&ft(r,1),e.quantize!==void 0?ft(r,2,E0(e.quantize)):"quantize"in e&&ft(r,2),kr(t,0,2,r),m2(this,e)}L(e,t){return this.D(e,t??this.F,this.s+1)}D(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}v(){var e=new Iu;Bt(e,10,"audio_in"),Bt(e,10,"sample_rate"),Bt(e,15,"embeddings_out"),Bt(e,15,"timestamped_embeddings_out");let t=new a2;B1(t,gw,this.i);let r=new Tu;S1(r,ic("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),Bt(r,3,"AUDIO:audio_in"),Bt(r,3,"SAMPLE_RATE:sample_rate"),Bt(r,4,"EMBEDDINGS:embeddings_out"),Bt(r,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),r.o(t),x1(e,r),this.g.attachProtoListener("embeddings_out",((n,i)=>{n=$0(n),this.m.push(X0(n)),Xi(this,i)})),this.g.attachEmptyPacketListener("embeddings_out",(n=>{Xi(this,n)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((n,i)=>{for(let o of n)n=$0(o),this.m.push(X0(n));Xi(this,i)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(n=>{Xi(this,n)})),e=e.g(),this.setGraph(new Uint8Array(e),!0)}},Za;Fr.prototype.embed=Fr.prototype.L,Fr.prototype.setOptions=Fr.prototype.o,Fr.createFromModelPath=function(e,t){return Yo(Fr,e,{baseOptions:{modelAssetPath:t}})},Fr.createFromModelBuffer=function(e,t){return Yo(Fr,e,{baseOptions:{modelAssetBuffer:t}})},Fr.createFromOptions=function(e,t){return Yo(Fr,e,t)};var Cw=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 g2(){if(Za===void 0)try{await WebAssembly.instantiate(Cw),Za=!0}catch{Za=!1}return Za}async function Go(e,t=hw``){let r=await g2()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${t}/${e}_${r}.js`,wasmBinaryPath:`${t}/${e}_${r}.wasm`}}var bn=class{};bn.forVisionTasks=function(e){return Go("vision",e)},bn.forTextTasks=function(e){return Go("text",e)},bn.forGenAiExperimentalTasks=function(e){return Go("genai_experimental",e)},bn.forGenAiTasks=function(e){return Go("genai",e)},bn.forAudioTasks=function(e){return Go("audio",e)},bn.isSimdSupported=function(){return g2()};function xw(e,t){let r=e.reduce((a,c)=>a+c.length,0),n=new ArrayBuffer(44+r*2),i=new DataView(n),o=(a,c,l)=>{for(let h=0;h<l.length;h++)a.setUint8(c+h,l.charCodeAt(h))};o(i,0,"RIFF"),i.setUint32(4,36+r*2,!0),o(i,8,"WAVE"),o(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,t,!0),i.setUint32(28,t*2,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),o(i,36,"data"),i.setUint32(40,r*2,!0);let s=44;for(let a of e)for(let c=0;c<a.length;c++){let l=Math.max(-1,Math.min(1,a[c]));i.setInt16(s,l<0?l*32768:l*32767,!0),s+=2}return new Blob([i],{type:"audio/wav"})}var Tc=class{constructor(t,r,n,i,o,s,a){this.recordingInProgress=!1;this.recordIndex=1;this.countLoopTimes=0;this.recordingStartTime=0;this.recordingEndTime=0;this.isSpeech=!1;this.preRollBuffer=[];this.recordingChunks=[];this.PRE_ROLL_SECONDS=2;this.SAMPLE_RATE=16e3;this.MAX_PRE_ROLL_CHUNKS=4;this.lastNoiseTime=0;this.SILENCE_THRESHOLD=3e3;this.filesToUpload=[];this.optionsProctoring=t,this.proctoringSession=r,this.paramsConfig=n,this.cameraRecorder=i,this.onRealtimeAlertsCallback=o,this.backend=s,this.backendToken=a}setProctoringId(t){this.proctoringId=t,this.proctoringId&&this.backend&&(this.upload=new Yr(this.proctoringId,this.backend))}async startRecording(){await this.createAudioClassifier(),this.intervalNoiseDetection=setInterval(()=>this.onNoiseDetectedRecord(),200),this.streamingAudioClassification()}async stopRecording(){clearInterval(this.intervalNoiseDetection),await this.stopSoundRecord(),await this.volumeMeter&&this.volumeMeter.stop(),this.audioWorkletNode&&this.audioWorkletNode.disconnect(),this.context&&this.context.close()}async pauseRecording(){}async resumeRecording(){}async saveOnSession(t){}async onNoiseDetectedRecord(){!this.volumeMeter&&this.cameraRecorder.cameraStream&&(this.volumeMeter=new gn(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*1.25);let n=r>=t;if(n&&(this.lastNoiseTime=Date.now()),n&&!this.recordingInProgress){this.recordingInProgress=!0,this.recordingChunks=[...this.preRollBuffer];let o=this.preRollBuffer.reduce((a,c)=>a+c.length,0)/this.SAMPLE_RATE*1e3,s=Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0);this.recordingStartTime=s-o,this.recordingStartTime<0&&(this.recordingStartTime=0)}else if(this.recordingInProgress){let i=Date.now()-this.lastNoiseTime,o=Date.now()-this.recordingStartTime;i>=this.SILENCE_THRESHOLD&&o>=3e3&&this.countLoopTimes>4&&(await this.stopSoundRecord(),this.paramsConfig.videoBehaviourParameters?.detectNoise&&!this.isSpeech&&this.onRealtimeAlertsCallback({begin:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),end:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),status:"ALERT",description:"Barulho detectado",type:"audio_detection_on_stream"}),this.paramsConfig.videoBehaviourParameters?.detectSpeech&&this.isSpeech&&this.onRealtimeAlertsCallback({begin:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),end:Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),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.recordingInProgress&&this.recordingChunks.length===0||(this.recordingEndTime=Date.now()-(this.cameraRecorder.getStartTime()?.getTime()||0),this.optionsProctoring.proctoringType!=="REALTIME"))return;let t=xw(this.recordingChunks,this.SAMPLE_RATE),r=new File([t],`EP_${this.proctoringSession.id}_${this.recordingStartTime}_${this.recordingEndTime}_${this.isSpeech?"speech":"noise"}.wav`,{type:"audio/wav"}),n=[...this.filesToUpload];for(let i of n)try{await this.upload?.upload({file:i},this.backendToken),this.filesToUpload.splice(this.filesToUpload.indexOf(i),1)}catch{break}try{r&&this.upload&&this.backendToken&&this.upload.upload({file:r},this.backendToken)}catch(i){console.log("error Noise recorder adicionando na fila",i),this.filesToUpload.push(r)}this.recordingChunks=[],this.recordingInProgress=!1}download(t){let r=URL.createObjectURL(t),n=document.createElement("a");document.body.appendChild(n),n.style.display="none",n.href=r,n.download=t.name,n.click(),window.URL.revokeObjectURL(r)}hasDesiredResult(t){if(t==null)return!1;for(let r of t){let n=r.name.toLowerCase().includes("speech");if(this.optionsProctoring.proctoringType!=="REALTIME")return n;let i=parseFloat(r.score)>.22;if(n&&i)return!0}return!1}async createAudioClassifier(){let t=await bn.forAudioTasks("https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.0/wasm");this.audioClassifier=await sr.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:this.SAMPLE_RATE});try{await this.context.audioWorklet.addModule(URL.createObjectURL(new Blob([Aw],{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 n=r.data;this.preRollBuffer.push(n),this.preRollBuffer.length>this.MAX_PRE_ROLL_CHUNKS&&this.preRollBuffer.shift(),this.recordingInProgress&&this.recordingChunks.push(n);let o=this.audioClassifier.classify(n)[0].classifications[0].categories;o.length>0&&(this.audioClassificationResult=[{name:o[0].categoryName,score:o[0].score.toFixed(3)}])},t.connect(this.audioWorkletNode),this.audioWorkletNode.connect(this.context.destination)}},Aw=`
444
442
  class AudioProcessor extends AudioWorkletProcessor {
445
443
  bufferSize;
446
444
  inputBuffer;
@@ -477,7 +475,7 @@ Error: ${s.message}
477
475
  }
478
476
 
479
477
  registerProcessor("audio-processor", AudioProcessor);
480
- `;var T2=ah(),F_=T2.default||T2,bu=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.duration=0;this.options=t}setProctoringId(t){this.proctoringId=t,Ga(t)}async startRecording(){if(this.startTime=new Date(Date.now()),Er())return;let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:i}=this.options,o={video:{cursor:"always",width:this.options.screenRecorderOptions.width,height:this.options.screenRecorderOptions.height,displaySurface:"monitor"},audio:!1},s={video:{cursor:"always",width:1280,height:720,displaySurface:"monitor"},audio:!1},a;try{a=await navigator.mediaDevices.getDisplayMedia(o)}catch(u){if(u instanceof TypeError&&u.message.includes("min constraints are not supported"))console.warn("Navegador n\xE3o suporta restri\xE7\xF5es 'min/max/ideal'. Tentando com 720p fixo."),a=await navigator.mediaDevices.getDisplayMedia(s);else throw u}this.screenStream=a;let c=this.screenStream.getVideoTracks();if(c[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let u=c.find(b=>b.label=="");if(u&&t||u&&!r)throw Ka}let d=c.find(u=>["screen:0:0","Primary Monitor"].includes(u.label))!=null,h=c.find(u=>["screen:0:0","Primary Monitor",""].includes(u.label)||["screen:"].some(b=>u.label.includes(b)))!=null,m=c.find(u=>["web-contents-media-stream","window"].some(b=>u.label.includes(b)))!=null;if(!d&&t)throw c.forEach(u=>{u.stop()}),c0;if(!h||m)throw c.forEach(u=>{u.stop()}),l0;let{startRecording:f,stopRecording:g}=Yo(this.screenStream,this.blobs,this.options.onBufferSizeError,i);this.recordingStart=f,this.recordingStop=g,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop(),this.duration=Date.now()-this.startTime?.getTime()||0}async saveOnSession(t){if(Er())return;let r=new Blob(this.blobs,{type:"video/webm"}),n=await F_(r,this.duration),i=new File([n],`EP_${t.id}_screen_0.webm`,{type:r.type});t.addRecording({device:"",file:i,origin:Ki.Screen})}};var Pc=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:n}=await this.connectToStore("readwrite");return this.processRequest(n.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.delete(t),r)}async get(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.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((n,i)=>{t.onerror=o=>{i(t.error?.message)},t.onsuccess=o=>{r.commit(),n(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let i=(await this.connect()).result.transaction(this.storeName,t),o=i.objectStore(this.storeName);return{transaction:i,store:o}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let n=window.indexedDB.open(this.dbName,this.dbVersion);n.onerror=i=>{r("Can't connect to IndexedDB")},n.onupgradeneeded=i=>{let o=n.result;o.onerror=s=>{},o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=i=>{this.connection=n,t(n)}})}};function I2(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}var vu=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new Zo}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,n)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(i=>{this.token=i.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(i=>{console.log(i),document.querySelector("#authLoader")?.remove(),n(i)})})}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 n=`
478
+ `;var y2=xd(),Tw=y2.default||y2,Ic=class{constructor(t){this.blobs=[];this.blobsFinal=[];this.duration=0;this.options=t}setProctoringId(t){this.proctoringId=t,La(t)}async startRecording(){if(this.startTime=new Date(Date.now()),_r())return;let{allowOnlyFirstMonitor:t,allowMultipleMonitors:r,onStopSharingScreenCallback:n,onBufferSizeErrorCallback:i}=this.options,o={video:{cursor:"always",width:this.options.screenRecorderOptions.width,height:this.options.screenRecorderOptions.height,displaySurface:"monitor"},audio:!1},s={video:{cursor:"always",width:1280,height:720,displaySurface:"monitor"},audio:!1},a;try{a=await navigator.mediaDevices.getDisplayMedia(o)}catch(u){if(u instanceof TypeError&&u.message.includes("min constraints are not supported"))console.warn("Navegador n\xE3o suporta restri\xE7\xF5es 'min/max/ideal'. Tentando com 720p fixo."),a=await navigator.mediaDevices.getDisplayMedia(s);else throw u}this.screenStream=a;let c=this.screenStream.getVideoTracks();if(c[0].onended=n,navigator.userAgent.indexOf("Firefox")>-1){let u=c.find(b=>b.label=="");if(u&&t||u&&!r)throw Ma}let h=c.find(u=>["screen:0:0","Primary Monitor"].includes(u.label))!=null,d=c.find(u=>["screen:0:0","Primary Monitor",""].includes(u.label)||["screen:"].some(b=>u.label.includes(b)))!=null,g=c.find(u=>["web-contents-media-stream","window"].some(b=>u.label.includes(b)))!=null;if(!h&&t)throw c.forEach(u=>{u.stop()}),Yg;if(!d||g)throw c.forEach(u=>{u.stop()}),Zg;let{startRecording:f,stopRecording:m}=Wo(this.screenStream,this.blobs,this.options.onBufferSizeError,i);this.recordingStart=f,this.recordingStop=m,this.recordingStart()}async pauseRecording(){}async resumeRecording(){}async stopRecording(){this.recordingStop&&await this.recordingStop(),this.duration=Date.now()-this.startTime?.getTime()||0}async saveOnSession(t){if(_r())return;let r=new Blob(this.blobs,{type:"video/webm"}),n=await Tw(r,this.duration),i=new File([n],`EP_${t.id}_screen_0.webm`,{type:r.type});t.addRecording({device:"",file:i,origin:"Screen"})}};var is=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:n}=await this.connectToStore("readwrite");return this.processRequest(n.put(t),r).then(()=>{})}async delete(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.delete(t),r)}async get(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.get(t),r).catch(()=>{})}async getDevices(t){let{transaction:r,store:n}=await this.connectToStore("readwrite");return this.processRequest(n.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((n,i)=>{t.onerror=o=>{i(t.error?.message)},t.onsuccess=o=>{r.commit(),n(t.result)}})}async hasSessions(){return(await this.list()).length>0}async connectToStore(t){let i=(await this.connect()).result.transaction(this.storeName,t),o=i.objectStore(this.storeName);return{transaction:i,store:o}}async connect(){return this.connection?this.connection:new Promise((t,r)=>{let n=window.indexedDB.open(this.dbName,this.dbVersion);n.onerror=i=>{r("Can't connect to IndexedDB")},n.onupgradeneeded=i=>{let o=n.result;o.onerror=s=>{},o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=i=>{this.connection=n,t(n)}})}};function b2(){return new Promise((e,t)=>{window.navigator.geolocation.getCurrentPosition(e,t)})}var Rc=class{constructor(t,r){this.cpf=t,this.backend=r,this.capturePhoto=new $i}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,n)=>{this.backend.loginAuth(this.cpf,t.base64.substr(22,t.base64.length)).then(i=>{this.token=i.token,document.querySelector("#authLoader")?.remove(),this.backend.token=this.token,r(this.token)}).catch(i=>{console.log(i),document.querySelector("#authLoader")?.remove(),n(i)})})}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 n=`
481
479
  .loader {
482
480
  border: 6px solid #f3f3f3;
483
481
  border-radius: 50%;
@@ -498,39 +496,42 @@ registerProcessor("audio-processor", AudioProcessor);
498
496
  0% { transform: rotate(0deg); }
499
497
  100% { transform: rotate(360deg); }
500
498
  }
501
- `,i=document.createElement("style");i.innerHTML=n,document.head.appendChild(i)}};var wu=class{constructor(){this.baseUrl="http://localhost:7485/Station/api"}async isAlive(){return(await this.makeRequestAxios({path:"/health",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async setProctoringId(t){return(await this.makeRequestAxios({path:"/update-station/"+t,method:"POST",jwt:this.token}).catch(n=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async makeRequestAxios(t){let{path:r,method:n,body:i,jwt:o}=t,s=await kr.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var pr=class extends Error{constructor(t,r){let n=new.target.prototype;super(`${t}: Status code '${r}'`);this.statusCode=r,this.__proto__=n}},ci=class extends Error{constructor(t="A timeout occurred."){let r=new.target.prototype;super(t);this.__proto__=r}},yt=class extends Error{constructor(t="An abort occurred."){let r=new.target.prototype;super(t);this.__proto__=r}},_u=class extends Error{constructor(t,r){let n=new.target.prototype;super(t);this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}},ku=class extends Error{constructor(t,r){let n=new.target.prototype;super(t);this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}},Su=class extends Error{constructor(t,r){let n=new.target.prototype;super(t);this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},Dc=class extends Error{constructor(t){let r=new.target.prototype;super(t);this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},Eu=class extends Error{constructor(t,r){let n=new.target.prototype;super(t);this.innerErrors=r,this.__proto__=n}};var fs=class{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}},on=class{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}};var F;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(F||(F={}));var sn=class{constructor(){}log(t,r){}};sn.instance=new sn;var R2="9.0.6";var Te=class{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}},ke=class{static get isBrowser(){return!ke.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!ke.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!ke.isNode&&typeof window=="object"&&typeof window.document=="undefined"}static get isNode(){return typeof process!="undefined"&&process.release&&process.release.name==="node"}};function Dn(e,t){let r="";return Rr(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${M_(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function M_(e){let t=new Uint8Array(e),r="";return t.forEach(n=>{r+=`0x${n<16?"0":""}${n.toString(16)} `}),r.substr(0,r.length-1)}function Rr(e){return e&&typeof ArrayBuffer!="undefined"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Bc(e,t,r,n,i,o){let s={},[a,c]=Wr();s[a]=c,e.log(F.Trace,`(${t} transport) sending data. ${Dn(i,o.logMessageContent)}.`);let l=Rr(i)?"arraybuffer":"text",d=await r.post(n,{content:i,headers:{...s,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});e.log(F.Trace,`(${t} transport) request complete. Response status: ${d.statusCode}.`)}function P2(e){return e===void 0?new co(F.Information):e===null?sn.instance:e.log!==void 0?e:new co(e)}var Cu=class{constructor(t,r){this._subject=t,this._observer=r}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}},co=class{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){let n=`[${new Date().toISOString()}] ${F[t]}: ${r}`;switch(t){case F.Critical:case F.Error:this.out.error(n);break;case F.Warning:this.out.warn(n);break;case F.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function Wr(){let e="X-SignalR-User-Agent";return ke.isNode&&(e="User-Agent"),[e,N_(R2,j_(),V_(),z_())]}function N_(e,t,r,n){let i="Microsoft SignalR/",o=e.split(".");return i+=`${o[0]}.${o[1]}`,i+=` (${e}; `,t&&t!==""?i+=`${t}; `:i+="Unknown OS; ",i+=`${r}`,n?i+=`; ${n}`:i+="; Unknown Runtime Version",i+=")",i}function j_(){if(ke.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function z_(){if(ke.isNode)return process.versions.node}function V_(){return ke.isNode?"NodeJS":"Browser"}function Oc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function D2(){if(typeof globalThis!="undefined")return globalThis;if(typeof self!="undefined")return self;if(typeof window!="undefined")return window;if(typeof global!="undefined")return global;throw new Error("could not find global")}var xu=class extends on{constructor(t){super();if(this._logger=t,typeof fetch=="undefined"||ke.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch=="undefined"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(D2());if(typeof AbortController=="undefined"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new yt;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");let r=new this._abortControllerType,n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new yt});let i=null;if(t.timeout){let c=t.timeout;i=setTimeout(()=>{r.abort(),this._logger.log(F.Warning,"Timeout from HTTP request."),n=new ci},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},Rr(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(F.Warning,`Error from HTTP request. ${c}.`),c)}finally{i&&clearTimeout(i),t.abortSignal&&(t.abortSignal.onabort=null)}if(!o.ok){let c=await B2(o,"text");throw new pr(c||o.statusText,o.status)}let a=await B2(o,t.responseType);return new fs(o.status,o.statusText,a)}getCookieString(t){let r="";return ke.isNode&&this._jar&&this._jar.getCookies(t,(n,i)=>r=i.join("; ")),r}};function B2(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}var Au=class extends on{constructor(t){super();this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new yt):t.method?t.url?new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method,t.url,!0),i.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,i.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(Rr(t.content)?i.setRequestHeader("Content-Type","application/octet-stream"):i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let o=t.headers;o&&Object.keys(o).forEach(s=>{i.setRequestHeader(s,o[s])}),t.responseType&&(i.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{i.abort(),n(new yt)}),t.timeout&&(i.timeout=t.timeout),i.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),i.status>=200&&i.status<300?r(new fs(i.status,i.statusText,i.response||i.responseText)):n(new pr(i.response||i.responseText||i.statusText,i.status))},i.onerror=()=>{this._logger.log(F.Warning,`Error from HTTP request. ${i.status}: ${i.statusText}.`),n(new pr(i.statusText,i.status))},i.ontimeout=()=>{this._logger.log(F.Warning,"Timeout from HTTP request."),n(new ci)},i.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var Tu=class extends on{constructor(t){super();if(typeof fetch!="undefined"||ke.isNode)this._httpClient=new xu(t);else if(typeof XMLHttpRequest!="undefined")this._httpClient=new Au(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new yt):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}};var wt=class{static write(t){return`${t}${wt.RecordSeparator}`}static parse(t){if(t[t.length-1]!==wt.RecordSeparator)throw new Error("Message is incomplete.");let r=t.split(wt.RecordSeparator);return r.pop(),r}};wt.RecordSeparatorCode=30;wt.RecordSeparator=String.fromCharCode(wt.RecordSeparatorCode);var Iu=class{writeHandshakeRequest(t){return wt.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(Rr(t)){let a=new Uint8Array(t),c=a.indexOf(wt.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{let a=t,c=a.indexOf(wt.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}let i=wt.parse(r),o=JSON.parse(i[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}};var he;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})(he||(he={}));var Ru=class{constructor(){this.observers=[]}next(t){for(let r of this.observers)r.next(t)}error(t){for(let r of this.observers)r.error&&r.error(t)}complete(){for(let t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Cu(this,t)}};var Pu=class{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){let r=this._protocol.writeMessage(t),n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let i=()=>{},o=()=>{};Rr(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((s,a)=>{i=s,o=a})),this._messages.push(new O2(r,this._totalMessageCount,i,o))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){let i=this._messages[n];if(i._id<=t.sequenceId)r=n,Rr(i._message)?this._bufferedByteCount-=i._message.byteLength:this._bufferedByteCount-=i._message.length,i._resolver();else if(this._bufferedByteCount<this._bufferSize)i._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==he.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;let r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){let t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:he.Sequence,sequenceId:t}));let r=this._messages;for(let n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(let r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case he.Invocation:case he.StreamItem:case he.Completion:case he.StreamInvocation:case he.CancelInvocation:return!0;case he.Close:case he.Sequence:case he.Ping:case he.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:he.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}},O2=class{constructor(t,r,n,i){this._message=t,this._id=r,this._resolver=n,this._rejector=i}};var H_=30*1e3,W_=15*1e3,$_=1e5,je;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(je||(je={}));var ms=class{static create(t,r,n,i,o,s,a){return new ms(t,r,n,i,o,s,a)}constructor(t,r,n,i,o,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(F.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},Te.isRequired(t,"connection"),Te.isRequired(r,"logger"),Te.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??H_,this.keepAliveIntervalInMilliseconds=s??W_,this._statefulReconnectBufferSize=a??$_,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=i,this._handshakeProtocol=new Iu,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=je.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:he.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==je.Disconnected&&this._connectionState!==je.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==je.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=je.Connecting,this._logger.log(F.Debug,"Starting HubConnection.");try{await this._startInternal(),ke.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=je.Connected,this._connectionStarted=!0,this._logger.log(F.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=je.Disconnected,this._logger.log(F.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);let n={protocol:this._protocol.name,version:r};if(this._logger.log(F.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(F.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Pu(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(F.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){let t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch(r){}}_stopInternal(t){if(this._connectionState===je.Disconnected)return this._logger.log(F.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===je.Disconnecting)return this._logger.log(F.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let r=this._connectionState;return this._connectionState=je.Disconnecting,this._logger.log(F.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(F.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===je.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new yt("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createStreamInvocation(t,r,i),s,a=new Ru;return a.cancelCallback=()=>{let c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===he.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,s),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._sendWithProtocol(this._createInvocation(t,r,!0,i));return this._launchStreams(n,o),o}invoke(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createInvocation(t,r,!1,i);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(d,h)=>{if(h){c(h);return}else d&&(d.type===he.Completion?d.error?c(new Error(d.error)):a(d.result):c(new Error(`Unexpected message type: ${d.type}`)))};let l=this._sendWithProtocol(o).catch(d=>{c(d),delete this._callbacks[o.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();let n=this._methods[t];if(!!n)if(r){let i=n.indexOf(r);i!==-1&&(n.splice(i,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let r=this._protocol.parseMessages(t,this._logger);for(let n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case he.Invocation:this._invokeClientMethod(n).catch(i=>{this._logger.log(F.Error,`Invoke client method threw error: ${Oc(i)}`)});break;case he.StreamItem:case he.Completion:{let i=this._callbacks[n.invocationId];if(i){n.type===he.Completion&&delete this._callbacks[n.invocationId];try{i(n)}catch(o){this._logger.log(F.Error,`Stream callback threw error: ${Oc(o)}`)}}break}case he.Ping:break;case he.Close:{this._logger.log(F.Information,"Close message received from server.");let i=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}case he.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case he.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(F.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(i){let o="Error parsing handshake response: "+i;this._logger.log(F.Error,o);let s=new Error(o);throw this._handshakeRejecter(s),s}if(r.error){let i="Server returned handshake error: "+r.error;this._logger.log(F.Error,i);let o=new Error(i);throw this._handshakeRejecter(o),o}else this._logger.log(F.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===je.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){let r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(F.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(F.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}let i=n.slice(),o=!!t.invocationId,s,a,c;for(let l of i)try{let d=s;s=await l.apply(this,t.arguments),o&&s&&d&&(this._logger.log(F.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(d){a=d,this._logger.log(F.Error,`A callback for the method '${r}' threw error '${d}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(t.invocationId,null,s):(this._logger.log(F.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(F.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(F.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new yt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===je.Disconnecting?this._completeClose(t):this._connectionState===je.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===je.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=je.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),ke.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(F.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){let r=Date.now(),n=0,i=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,i);if(o===null){this._logger.log(F.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=je.Reconnecting,t?this._logger.log(F.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(F.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(F.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==je.Reconnecting){this._logger.log(F.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(F.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==je.Reconnecting){this._logger.log(F.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=je.Connected,this._logger.log(F.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(F.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(F.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==je.Reconnecting){this._logger.log(F.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===je.Disconnecting&&this._completeClose();return}i=s instanceof Error?s:new Error(s.toString()),o=this._getNextRetryDelay(n++,Date.now()-r,i)}}this._logger.log(F.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(i){return this._logger.log(F.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${i}'.`),null}}_cancelCallbacksWithError(t){let r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{let i=r[n];try{i(null,t)}catch(o){this._logger.log(F.Error,`Stream 'error' callback called with '${t}' threw error: ${Oc(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,i){if(n)return i.length!==0?{target:t,arguments:r,streamIds:i,type:he.Invocation}:{target:t,arguments:r,type:he.Invocation};{let o=this._invocationId;return this._invocationId++,i.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:i,type:he.Invocation}:{target:t,arguments:r,invocationId:o.toString(),type:he.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(let n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:i=>{let o;i instanceof Error?o=i.message:i&&i.toString?o=i.toString():o="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:i=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,i)))}})}}_replaceStreamingParams(t){let r=[],n=[];for(let i=0;i<t.length;i++){let o=t[i];if(this._isObservable(o)){let s=this._invocationId;this._invocationId++,r[s]=o,n.push(s.toString()),t.splice(i,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){let i=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:i.toString(),streamIds:n,type:he.StreamInvocation}:{target:t,arguments:r,invocationId:i.toString(),type:he.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:he.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:he.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:he.Completion}:{invocationId:t,result:n,type:he.Completion}}_createCloseMessage(){return{type:he.Close}}};var G_=[0,2e3,1e4,3e4,null],Uc=class{constructor(t){this._retryDelays=t!==void 0?[...t,null]:G_}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}};var $r=class{};$r.Authorization="Authorization";$r.Cookie="Cookie";var Du=class extends on{constructor(t,r){super();this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);let n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[$r.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[$r.Authorization]&&delete t.headers[$r.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}};var Ke;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Ke||(Ke={}));var et;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(et||(et={}));var Bu=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var Lc=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new Bu,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(Te.isRequired(t,"url"),Te.isRequired(r,"transferFormat"),Te.isIn(r,et,"transferFormat"),this._url=t,this._logger.log(F.Trace,"(LongPolling transport) Connecting."),r===et.Binary&&typeof XMLHttpRequest!="undefined"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,i]=Wr(),o={[n]:i,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};r===et.Binary&&(s.responseType="arraybuffer");let a=`${t}&_=${Date.now()}`;this._logger.log(F.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(F.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new pr(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(t,r){try{for(;this._running;)try{let n=`${t}&_=${Date.now()}`;this._logger.log(F.Trace,`(LongPolling transport) polling: ${n}.`);let i=await this._httpClient.get(n,r);i.statusCode===204?(this._logger.log(F.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):i.statusCode!==200?(this._logger.log(F.Error,`(LongPolling transport) Unexpected response code: ${i.statusCode}.`),this._closeError=new pr(i.statusText||"",i.statusCode),this._running=!1):i.content?(this._logger.log(F.Trace,`(LongPolling transport) data received. ${Dn(i.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(i.content)):this._logger.log(F.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof ci?this._logger.log(F.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(F.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(F.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Bc(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(F.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(F.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[r,n]=Wr();t[r]=n;let i={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},o;try{await this._httpClient.delete(this._url,i)}catch(s){o=s}o?o instanceof pr&&(o.statusCode===404?this._logger.log(F.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(F.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(F.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(F.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(F.Trace,t),this.onclose(this._closeError)}}};var Ou=class{constructor(t,r,n,i){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=i,this.onreceive=null,this.onclose=null}async connect(t,r){return Te.isRequired(t,"url"),Te.isRequired(r,"transferFormat"),Te.isIn(r,et,"transferFormat"),this._logger.log(F.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,i)=>{let o=!1;if(r!==et.Text){i(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(ke.isBrowser||ke.isWebWorker)s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(t),c={};c.Cookie=a;let[l,d]=Wr();c[l]=d,s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(F.Trace,`(SSE transport) data received. ${Dn(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{o?this._close():i(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(F.Information,`SSE connected to ${this._url}`),this._eventSource=s,o=!0,n()}}catch(a){i(a);return}})}async send(t){return this._eventSource?Bc(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}};var Uu=class{constructor(t,r,n,i,o,s){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=i,this._webSocketConstructor=o,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=s}async connect(t,r){Te.isRequired(t,"url"),Te.isRequired(r,"transferFormat"),Te.isIn(r,et,"transferFormat"),this._logger.log(F.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((i,o)=>{t=t.replace(/^http/,"ws");let s,a=this._httpClient.getCookieString(t),c=!1;if(ke.isNode||ke.isReactNative){let l={},[d,h]=Wr();l[d]=h,n&&(l[$r.Authorization]=`Bearer ${n}`),a&&(l[$r.Cookie]=a),s=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(t)),r===et.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(F.Information,`WebSocket connected to ${t}.`),this._webSocket=s,c=!0,i()},s.onerror=l=>{let d=null;typeof ErrorEvent!="undefined"&&l instanceof ErrorEvent?d=l.error:d="There was an error with the transport",this._logger.log(F.Information,`(WebSockets transport) ${d}.`)},s.onmessage=l=>{if(this._logger.log(F.Trace,`(WebSockets transport) data received. ${Dn(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(d){this._close(d);return}},s.onclose=l=>{if(c)this._close(l);else{let d=null;typeof ErrorEvent!="undefined"&&l instanceof ErrorEvent?d=l.error:d="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(d))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(F.Trace,`(WebSockets transport) sending data. ${Dn(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(F.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}};var U2=100,Lu=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,Te.isRequired(t,"url"),this._logger=P2(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,i=null;if(ke.isNode){let o=typeof __webpack_require__=="function"?__non_webpack_require__:require;n=o("ws"),i=o("eventsource")}!ke.isNode&&typeof WebSocket!="undefined"&&!r.WebSocket?r.WebSocket=WebSocket:ke.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!ke.isNode&&typeof EventSource!="undefined"&&!r.EventSource?r.EventSource=EventSource:ke.isNode&&!r.EventSource&&typeof i!="undefined"&&(r.EventSource=i),this._httpClient=new Du(r.httpClient||new Tu(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||et.Binary,Te.isIn(t,et,"transferFormat"),this._logger.log(F.Debug,`Starting connection with transfer format '${et[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){let r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(F.Error,r),await this._stopPromise,Promise.reject(new yt(r))}else if(this._connectionState!=="Connected"){let r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(F.Error,r),Promise.reject(new yt(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Fc(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(F.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(F.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch(r){}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(F.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(F.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Ke.WebSockets)this.transport=this._constructTransport(Ke.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,i=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new yt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){let o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}i++}while(n.url&&i<U2);if(i===U2&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof Lc&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(F.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(F.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){let r={},[n,i]=Wr();r[n]=i;let o=this._resolveNegotiateUrl(t);this._logger.log(F.Debug,`Sending negotiation request: ${o}.`);try{let s=await this._httpClient.post(o,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));let a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new Dc("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof pr&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(F.Error,a),Promise.reject(new Dc(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,i){let o=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(F.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(o,i),this.connectionId=n.connectionId;return}let s=[],a=n.availableTransports||[],c=n;for(let l of a){let d=this._resolveTransportOrError(l,r,i,(c==null?void 0:c.useStatefulReconnect)===!0);if(d instanceof Error)s.push(`${l.transport} failed:`),s.push(d);else if(this._isITransport(d)){if(this.transport=d,!c){try{c=await this._getNegotiationResponse(t)}catch(h){return Promise.reject(h)}o=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(o,i),this.connectionId=c.connectionId;return}catch(h){if(this._logger.log(F.Error,`Failed to start the transport '${l.transport}': ${h}`),c=void 0,s.push(new Su(`${l.transport} failed: ${h}`,Ke[l.transport])),this._connectionState!=="Connecting"){let m="Failed to select transport before stop() was called.";return this._logger.log(F.Debug,m),Promise.reject(new yt(m))}}}}return s.length>0?Promise.reject(new Eu(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Ke.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Uu(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Ke.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Ou(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Ke.LongPolling:return new Lc(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let i=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{i=!0}else{this._stopConnection(n);return}i&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,i){let o=Ke[t.transport];if(o==null)return this._logger.log(F.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(q_(r,o))if(t.transferFormats.map(a=>et[a]).indexOf(n)>=0){if(o===Ke.WebSockets&&!this._options.WebSocket||o===Ke.ServerSentEvents&&!this._options.EventSource)return this._logger.log(F.Debug,`Skipping transport '${Ke[o]}' because it is not supported in your environment.'`),new _u(`'${Ke[o]}' is not supported in your environment.`,o);this._logger.log(F.Debug,`Selecting transport '${Ke[o]}'.`);try{return this.features.reconnect=o===Ke.WebSockets?i:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(F.Debug,`Skipping transport '${Ke[o]}' because it does not support the requested transfer format '${et[n]}'.`),new Error(`'${Ke[o]}' does not support ${et[n]}.`);else return this._logger.log(F.Debug,`Skipping transport '${Ke[o]}' because it was disabled by the client.`),new ku(`'${Ke[o]}' is disabled by the client.`,o)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(F.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(F.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(F.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(F.Error,`Connection disconnected with error '${t}'.`):this._logger.log(F.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(F.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(F.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!ke.isBrowser)throw new Error(`Cannot resolve '${t}'.`);let r=window.document.createElement("a");return r.href=t,this._logger.log(F.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){let r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";let n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}};function q_(e,t){return!e||(t&e)!=0}var Fc=class{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new gs,this._transportResult=new gs,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new gs),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new gs;let t=this._transportResult;this._transportResult=void 0;let r=typeof this._buffer[0]=="string"?this._buffer.join(""):Fc._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){let r=t.map(o=>o.byteLength).reduce((o,s)=>o+s),n=new Uint8Array(r),i=0;for(let o of t)n.set(new Uint8Array(o),i),i+=o.byteLength;return n.buffer}},gs=class{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}};var K_="json",Fu=class{constructor(){this.name=K_,this.version=2,this.transferFormat=et.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=sn.instance);let n=wt.parse(t),i=[];for(let o of n){let s=JSON.parse(o);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case he.Invocation:this._isInvocationMessage(s);break;case he.StreamItem:this._isStreamItemMessage(s);break;case he.Completion:this._isCompletionMessage(s);break;case he.Ping:break;case he.Close:break;case he.Ack:this._isAckMessage(s);break;case he.Sequence:this._isSequenceMessage(s);break;default:r.log(F.Information,"Unknown message type '"+s.type+"' ignored.");continue}i.push(s)}return i}writeMessage(t){return wt.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}};var X_={trace:F.Trace,debug:F.Debug,info:F.Information,information:F.Information,warn:F.Warning,warning:F.Warning,error:F.Error,critical:F.Critical,none:F.None};function J_(e){let t=X_[e.toLowerCase()];if(typeof t!="undefined")return t;throw new Error(`Unknown log level: ${e}`)}var Mu=class{configureLogging(t){if(Te.isRequired(t,"logging"),Y_(t))this.logger=t;else if(typeof t=="string"){let r=J_(t);this.logger=new co(r)}else this.logger=new co(t);return this}withUrl(t,r){return Te.isRequired(t,"url"),Te.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return Te.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new Uc(t):this.reconnectPolicy=t:this.reconnectPolicy=new Uc,this}withServerTimeout(t){return Te.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return Te.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t==null?void 0:t.bufferSize,this}build(){let t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let r=new Lu(this.url,t);return ms.create(r,this.logger||sn.instance,this.protocol||new Fu,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function Y_(e){return e.log!==void 0}var Ly=Qc(Uy());var Xc=class{},jt;(function(e){e[e.WAITING=-1]="WAITING",e[e.STARTED=0]="STARTED",e[e.QR_CODE=1]="QR_CODE",e[e.POSITION=2]="POSITION",e[e.FINISHED=3]="FINISHED",e[e.ERROR=9]="ERROR"})(jt||(jt={}));var Cs=class{constructor(t,r){this.proctoringId="";this.capturePhotoUrl="";this.qrCodeBase64Image="";this.transmissionOk=!1;this.waitingPositionValidation=!1;this.externalSessionId=null;this.currentStep=0;this.connection=null;this.context=t,this.onRealtimeAlertsCallback=r,this.backend=new Sr({type:t?.type||"prod",token:t.token,isRealtime:!1}),this.currentStep=-1}getExternalCameraSessionId(){return""+this.externalSessionId}async checkTransmission(){try{this.transmissionOk=!1;let t=await this.backend.externalCameraCheckTransmission(""+this.externalSessionId),r=0;for(;!this.transmissionOk&&r<=5;)await new Promise(n=>setTimeout(n,2e3)),r=r+1;if(!this.transmissionOk)throw new Error("Timed out na checagem da transmiss\xE3o!")}catch(t){throw console.error("Erro ao checar a transmiss\xE3o:",t),new Error("N\xE3o foi poss\xEDvel checar a transmiss\xE3o."+t)}}async startTransmission(t){try{this.proctoringId=t;let r=await this.backend.externalCameraStartTransmission(""+this.externalSessionId,t)}catch(r){throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.")}}async goToPositionGuide(){try{let t=await this.backend.goToExternalCameraPositionStep(""+this.externalSessionId)}catch(t){throw console.error("Erro ao enviar comando de Position:",t),new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.")}}async reset(){if(this.connection){let t=new Xc;t.command="Reset",this.connection.invoke("SendAction",this.externalSessionId,t)}}async takePicture(t,r){if(this.connection){this.waitingPositionValidation=t,this.onTakePictureCallback=r;let n=new Xc;n.command="Capture",this.connection.invoke("SendAction",this.externalSessionId,n)}else throw new Error("N\xE3o existe conex\xE3o de camera externa ativa.")}async startSession(t){try{this.onQrCodeReadedCallback=t,this.connection&&await this.disconnectWebSocket(),await this.initializeWebSocketConnection(),await this.reset();let r=await this.backend.externalCameraStartSession();this.externalSessionId=r.externalSessionId,this.currentStep=0;let n={externalSessionId:this.externalSessionId,token:this.context.token,ambient:this.context.type},i=JSON.stringify(n);return this.qrCodeBase64Image=await Ly.default.toDataURL(i),this.qrCodeBase64Image}catch(r){return this.disconnectWebSocket(),Promise.reject(r)}}async checkExternalCamera(){if(this.currentStep=0,Cs.isModalOpen)return Promise.reject("O modal de verifica\xE7\xE3o j\xE1 est\xE1 aberto.");Cs.isModalOpen=!0;try{return await this.startSession(()=>{}),await this.buildInterface()}catch(t){return console.error("Erro ao iniciar verifica\xE7\xE3o:",t),this.closeCheckExternalCamera(),Promise.reject(t)}}buildInterface(){return new Promise((t,r)=>{this.resolvePromise=t;let n=document.createElement("div");n.setAttribute("id","externalCameraCheck"),this.applyStyles(n,{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"});let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",zIndex:"1001",width:"500px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"});let o=document.createElement("h3");o.innerText="Conectar dispositivo m\xF3vel",this.applyStyles(o,{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"});let s=document.createElement("div");s.id="external-camera-content",this.applyStyles(s,{width:"100%",padding:"20px 40px",boxSizing:"border-box",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"});let a=document.createElement("div");this.applyStyles(a,{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"});let c=document.createElement("button");c.innerText="Cancelar",this.applyStyles(c,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 0 10px",cursor:"pointer"}),c.addEventListener("click",()=>{let d=new Xc;d.command="Cancel",this.connection?.invoke("SendAction",this.externalSessionId,d),this.closeCheckExternalCamera(),t({result:!1})});let l=document.createElement("button");l.innerText="Continuar",l.id="external-camera-continue",this.applyStyles(l,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),a.appendChild(c),a.appendChild(l),i.appendChild(o),i.appendChild(s),i.appendChild(a),n.appendChild(i),document.body.appendChild(n),this.renderCurrentStep()})}renderCurrentStep(){let t=document.getElementById("external-camera-content");if(!!t)switch(t.innerHTML="",this.currentStep){case 0:this.renderQRCodeStep(t);break;case 1:this.renderPhotoStep(t);break;case 2:this.renderImageStep(t);break;default:break}}renderQRCodeStep(t){let r=document.createElement("canvas");r.id="qr-code-canvas";let n=document.createElement("p");n.innerText="Aponte a c\xE2mera do seu celular para o QR Code para iniciar a verifica\xE7\xE3o do ambiente.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"});let i=r.getContext("2d"),o=new Image;o.onload=()=>{let a=250,c=a/o.width,l=o.height*c;r.width=a,r.height=l,i&&i.drawImage(o,0,0,a,l)},o.src=this.qrCodeBase64Image,t.appendChild(r),t.appendChild(n);let s=document.getElementById("external-camera-continue");s.disabled=!0,this.applyStyles(s,{color:"#ccc",cursor:"not-allowed"})}renderPhotoStep(t){let r=document.createElement("p");r.id="photo-message",r.innerText="Clique no bot\xE3o abaixo para realizar a captura da foto do ambiente.",this.applyStyles(r,{textAlign:"center",color:"#555",marginBottom:"20px",fontSize:"14px",display:"-webkit-box",overflow:"hidden",textOverflow:"ellipsis"}),r.style.webkitLineClamp="3",r.style.webkitBoxOrient="vertical",t.appendChild(r);let n=document.createElement("div");n.id="photo-error-banner",n.innerText="Foto fora do padr\xE3o esperado.",this.applyStyles(n,{backgroundColor:"#FEE2E2",color:"#DC2626",padding:"12px 15px",borderRadius:"8px",textAlign:"center",fontSize:"12px",fontWeight:"400",marginBottom:"15px",display:"none"}),t.appendChild(n);let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",borderRadius:"8px",padding:"20px",display:"flex",gap:"20px",alignItems:"flex-start",border:"1px solid #e5e5e5",marginBottom:"20px"});let o=document.createElement("div");if(o.id="photo-icon-container",this.applyStyles(o,{backgroundColor:"#f5f5f5",borderRadius:"8px",width:"120px",height:"160px",minWidth:"120px",minHeight:"160px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",overflow:"hidden"}),this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let u=document.createElement("img");u.id="img-photo";let b=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;u.src=b,this.applyStyles(u,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(u)}else{let u=document.createElement("div");u.innerHTML=`
499
+ `,i=document.createElement("style");i.innerHTML=n,document.head.appendChild(i)}};var Pc=class{constructor(){this.baseUrl="http://localhost:7485/Station/api"}async isAlive(){return(await this.makeRequestAxios({path:"/health",method:"GET",jwt:this.token}).catch(r=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async setProctoringId(t){return(await this.makeRequestAxios({path:"/update-station/"+t,method:"POST",jwt:this.token}).catch(n=>{throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde"})).data}async makeRequestAxios(t){let{path:r,method:n,body:i,jwt:o}=t,s=await Wt.request({url:this.baseUrl+r,method:n,headers:{Authorization:`Bearer ${o}`,"Access-Control-Allow-Origin":"*"},data:i});if(s.status>=400)throw"N\xE3o foi poss\xEDvel realizar a requisi\xE7\xE3o, tente novamente mais tarde";return s}};var Gt=class extends Error{constructor(t,r){let n=new.target.prototype;super(`${t}: Status code '${r}'`),this.statusCode=r,this.__proto__=n}},Cn=class extends Error{constructor(t="A timeout occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},dt=class extends Error{constructor(t="An abort occurred."){let r=new.target.prototype;super(t),this.__proto__=r}},Dc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="UnsupportedTransportError",this.__proto__=n}},Bc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="DisabledTransportError",this.__proto__=n}},Oc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.transport=r,this.errorType="FailedToStartTransportError",this.__proto__=n}},os=class extends Error{constructor(t){let r=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=r}},Uc=class extends Error{constructor(t,r){let n=new.target.prototype;super(t),this.innerErrors=r,this.__proto__=n}};var oo=class{constructor(t,r,n){this.statusCode=t,this.statusText=r,this.content=n}},Mr=class{get(t,r){return this.send({...r,method:"GET",url:t})}post(t,r){return this.send({...r,method:"POST",url:t})}delete(t,r){return this.send({...r,method:"DELETE",url:t})}getCookieString(t){return""}};var L;(function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"})(L||(L={}));var Nr=class{constructor(){}log(t,r){}};Nr.instance=new Nr;var v2="9.0.6";var xe=class{static isRequired(t,r){if(t==null)throw new Error(`The '${r}' argument is required.`)}static isNotEmpty(t,r){if(!t||t.match(/^\s*$/))throw new Error(`The '${r}' argument should not be empty.`)}static isIn(t,r,n){if(!(t in r))throw new Error(`Unknown ${n} value: ${t}.`)}},Te=class e{static get isBrowser(){return!e.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!e.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!e.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}};function xn(e,t){let r="";return xr(e)?(r=`Binary data of length ${e.byteLength}`,t&&(r+=`. Content: '${Iw(e)}'`)):typeof e=="string"&&(r=`String data of length ${e.length}`,t&&(r+=`. Content: '${e}'`)),r}function Iw(e){let t=new Uint8Array(e),r="";return t.forEach(n=>{let i=n<16?"0":"";r+=`0x${i}${n.toString(16)} `}),r.substr(0,r.length-1)}function xr(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}async function Fc(e,t,r,n,i,o){let s={},[a,c]=zr();s[a]=c,e.log(L.Trace,`(${t} transport) sending data. ${xn(i,o.logMessageContent)}.`);let l=xr(i)?"arraybuffer":"text",h=await r.post(n,{content:i,headers:{...s,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});e.log(L.Trace,`(${t} transport) request complete. Response status: ${h.statusCode}.`)}function _2(e){return e===void 0?new ei(L.Information):e===null?Nr.instance:e.log!==void 0?e:new ei(e)}var Lc=class{constructor(t,r){this._subject=t,this._observer=r}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(r=>{})}},ei=class{constructor(t){this._minLevel=t,this.out=console}log(t,r){if(t>=this._minLevel){let n=`[${new Date().toISOString()}] ${L[t]}: ${r}`;switch(t){case L.Critical:case L.Error:this.out.error(n);break;case L.Warning:this.out.warn(n);break;case L.Information:this.out.info(n);break;default:this.out.log(n);break}}}};function zr(){let e="X-SignalR-User-Agent";return Te.isNode&&(e="User-Agent"),[e,Rw(v2,Pw(),Bw(),Dw())]}function Rw(e,t,r,n){let i="Microsoft SignalR/",o=e.split(".");return i+=`${o[0]}.${o[1]}`,i+=` (${e}; `,t&&t!==""?i+=`${t}; `:i+="Unknown OS; ",i+=`${r}`,n?i+=`; ${n}`:i+="; Unknown Runtime Version",i+=")",i}function Pw(){if(Te.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function Dw(){if(Te.isNode)return process.versions.node}function Bw(){return Te.isNode?"NodeJS":"Browser"}function Mc(e){return e.stack?e.stack:e.message?e.message:`${e}`}function w2(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}var Nc=class extends Mr{constructor(t){if(super(),this._logger=t,typeof fetch>"u"||Te.isNode){let r=typeof __webpack_require__=="function"?__non_webpack_require__:ur;this._jar=new(r("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=r("node-fetch"):this._fetchType=fetch,this._fetchType=r("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(w2());if(typeof AbortController>"u"){let r=typeof __webpack_require__=="function"?__non_webpack_require__:ur;this._abortControllerType=r("abort-controller")}else this._abortControllerType=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new dt;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");let r=new this._abortControllerType,n;t.abortSignal&&(t.abortSignal.onabort=()=>{r.abort(),n=new dt});let i=null;if(t.timeout){let c=t.timeout;i=setTimeout(()=>{r.abort(),this._logger.log(L.Warning,"Timeout from HTTP request."),n=new Cn},c)}t.content===""&&(t.content=void 0),t.content&&(t.headers=t.headers||{},xr(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:t.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:r.signal})}catch(c){throw n||(this._logger.log(L.Warning,`Error from HTTP request. ${c}.`),c)}finally{i&&clearTimeout(i),t.abortSignal&&(t.abortSignal.onabort=null)}if(!o.ok){let c=await S2(o,"text");throw new Gt(c||o.statusText,o.status)}let a=await S2(o,t.responseType);return new oo(o.status,o.statusText,a)}getCookieString(t){let r="";return Te.isNode&&this._jar&&this._jar.getCookies(t,(n,i)=>r=i.join("; ")),r}};function S2(e,t){let r;switch(t){case"arraybuffer":r=e.arrayBuffer();break;case"text":r=e.text();break;case"blob":case"document":case"json":throw new Error(`${t} is not supported.`);default:r=e.text();break}return r}var zc=class extends Mr{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new dt):t.method?t.url?new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method,t.url,!0),i.withCredentials=t.withCredentials===void 0?!0:t.withCredentials,i.setRequestHeader("X-Requested-With","XMLHttpRequest"),t.content===""&&(t.content=void 0),t.content&&(xr(t.content)?i.setRequestHeader("Content-Type","application/octet-stream"):i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let o=t.headers;o&&Object.keys(o).forEach(s=>{i.setRequestHeader(s,o[s])}),t.responseType&&(i.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{i.abort(),n(new dt)}),t.timeout&&(i.timeout=t.timeout),i.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),i.status>=200&&i.status<300?r(new oo(i.status,i.statusText,i.response||i.responseText)):n(new Gt(i.response||i.responseText||i.statusText,i.status))},i.onerror=()=>{this._logger.log(L.Warning,`Error from HTTP request. ${i.status}: ${i.statusText}.`),n(new Gt(i.statusText,i.status))},i.ontimeout=()=>{this._logger.log(L.Warning,"Timeout from HTTP request."),n(new Cn)},i.send(t.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}};var jc=class extends Mr{constructor(t){if(super(),typeof fetch<"u"||Te.isNode)this._httpClient=new Nc(t);else if(typeof XMLHttpRequest<"u")this._httpClient=new zc(t);else throw new Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new dt):t.method?t.url?this._httpClient.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}};var qt=class e{static write(t){return`${t}${e.RecordSeparator}`}static parse(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");let r=t.split(e.RecordSeparator);return r.pop(),r}};qt.RecordSeparatorCode=30;qt.RecordSeparator=String.fromCharCode(qt.RecordSeparatorCode);var Vc=class{writeHandshakeRequest(t){return qt.write(JSON.stringify(t))}parseHandshakeResponse(t){let r,n;if(xr(t)){let a=new Uint8Array(t),c=a.indexOf(qt.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,l))),n=a.byteLength>l?a.slice(l).buffer:null}else{let a=t,c=a.indexOf(qt.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");let l=c+1;r=a.substring(0,l),n=a.length>l?a.substring(l):null}let i=qt.parse(r),o=JSON.parse(i[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[n,o]}};var he;(function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close",e[e.Ack=8]="Ack",e[e.Sequence=9]="Sequence"})(he||(he={}));var Hc=class{constructor(){this.observers=[]}next(t){for(let r of this.observers)r.next(t)}error(t){for(let r of this.observers)r.error&&r.error(t)}complete(){for(let t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new Lc(this,t)}};var Wc=class{constructor(t,r,n){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=t,this._connection=r,this._bufferSize=n}async _send(t){let r=this._protocol.writeMessage(t),n=Promise.resolve();if(this._isInvocationMessage(t)){this._totalMessageCount++;let i=()=>{},o=()=>{};xr(r)?this._bufferedByteCount+=r.byteLength:this._bufferedByteCount+=r.length,this._bufferedByteCount>=this._bufferSize&&(n=new Promise((s,a)=>{i=s,o=a})),this._messages.push(new Ru(r,this._totalMessageCount,i,o))}try{this._reconnectInProgress||await this._connection.send(r)}catch{this._disconnected()}await n}_ack(t){let r=-1;for(let n=0;n<this._messages.length;n++){let i=this._messages[n];if(i._id<=t.sequenceId)r=n,xr(i._message)?this._bufferedByteCount-=i._message.byteLength:this._bufferedByteCount-=i._message.length,i._resolver();else if(this._bufferedByteCount<this._bufferSize)i._resolver();else break}r!==-1&&(this._messages=this._messages.slice(r+1))}_shouldProcessMessage(t){if(this._waitForSequenceMessage)return t.type!==he.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(t))return!0;let r=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,r<=this._latestReceivedSequenceId?(r===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=r,this._ackTimer(),!0)}_resetSequence(t){if(t.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=t.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){let t=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:he.Sequence,sequenceId:t}));let r=this._messages;for(let n of r)await this._connection.send(n._message);this._reconnectInProgress=!1}_dispose(t){t??(t=new Error("Unable to reconnect to server."));for(let r of this._messages)r._rejector(t)}_isInvocationMessage(t){switch(t.type){case he.Invocation:case he.StreamItem:case he.Completion:case he.StreamInvocation:case he.CancelInvocation:return!0;case he.Close:case he.Sequence:case he.Ping:case he.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:he.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}},Ru=class{constructor(t,r,n,i){this._message=t,this._id=r,this._resolver=n,this._rejector=i}};var Ow=30*1e3,Uw=15*1e3,Lw=1e5,Ne;(function(e){e.Disconnected="Disconnected",e.Connecting="Connecting",e.Connected="Connected",e.Disconnecting="Disconnecting",e.Reconnecting="Reconnecting"})(Ne||(Ne={}));var $c=class e{static create(t,r,n,i,o,s,a){return new e(t,r,n,i,o,s,a)}constructor(t,r,n,i,o,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(L.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},xe.isRequired(t,"connection"),xe.isRequired(r,"logger"),xe.isRequired(n,"protocol"),this.serverTimeoutInMilliseconds=o??Ow,this.keepAliveIntervalInMilliseconds=s??Uw,this._statefulReconnectBufferSize=a??Lw,this._logger=r,this._protocol=n,this.connection=t,this._reconnectPolicy=i,this._handshakeProtocol=new Vc,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ne.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:he.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==Ne.Disconnected&&this._connectionState!==Ne.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ne.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ne.Connecting,this._logger.log(L.Debug,"Starting HubConnection.");try{await this._startInternal(),Te.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ne.Connected,this._connectionStarted=!0,this._logger.log(L.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=Ne.Disconnected,this._logger.log(L.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((r,n)=>{this._handshakeResolver=r,this._handshakeRejecter=n});await this.connection.start(this._protocol.transferFormat);try{let r=this._protocol.version;this.connection.features.reconnect||(r=1);let n={protocol:this._protocol.name,version:r};if(this._logger.log(L.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(n)),this._logger.log(L.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new Wc(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(r){throw this._logger.log(L.Debug,`Hub handshake failed with error '${r}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(r),r}}async stop(){let t=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch{}}_stopInternal(t){if(this._connectionState===Ne.Disconnected)return this._logger.log(L.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ne.Disconnecting)return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;let r=this._connectionState;return this._connectionState=Ne.Disconnecting,this._logger.log(L.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(L.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(r===Ne.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new dt("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createStreamInvocation(t,r,i),s,a=new Hc;return a.cancelCallback=()=>{let c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,l)=>{if(l){a.error(l);return}else c&&(c.type===he.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(n,s),a}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._messageBuffer?this._messageBuffer._send(t):this._sendMessage(this._protocol.writeMessage(t))}send(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._sendWithProtocol(this._createInvocation(t,r,!0,i));return this._launchStreams(n,o),o}invoke(t,...r){let[n,i]=this._replaceStreamingParams(r),o=this._createInvocation(t,r,!1,i);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(h,d)=>{if(d){c(d);return}else h&&(h.type===he.Completion?h.error?c(new Error(h.error)):a(h.result):c(new Error(`Unexpected message type: ${h.type}`)))};let l=this._sendWithProtocol(o).catch(h=>{c(h),delete this._callbacks[o.invocationId]});this._launchStreams(n,l)})}on(t,r){!t||!r||(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),this._methods[t].indexOf(r)===-1&&this._methods[t].push(r))}off(t,r){if(!t)return;t=t.toLowerCase();let n=this._methods[t];if(n)if(r){let i=n.indexOf(r);i!==-1&&(n.splice(i,1),n.length===0&&delete this._methods[t])}else delete this._methods[t]}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let r=this._protocol.parseMessages(t,this._logger);for(let n of r)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(n)))switch(n.type){case he.Invocation:this._invokeClientMethod(n).catch(i=>{this._logger.log(L.Error,`Invoke client method threw error: ${Mc(i)}`)});break;case he.StreamItem:case he.Completion:{let i=this._callbacks[n.invocationId];if(i){n.type===he.Completion&&delete this._callbacks[n.invocationId];try{i(n)}catch(o){this._logger.log(L.Error,`Stream callback threw error: ${Mc(o)}`)}}break}case he.Ping:break;case he.Close:{this._logger.log(L.Information,"Close message received from server.");let i=n.error?new Error("Server returned an error on close: "+n.error):void 0;n.allowReconnect===!0?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}case he.Ack:this._messageBuffer&&this._messageBuffer._ack(n);break;case he.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(n);break;default:this._logger.log(L.Warning,`Invalid message type: ${n.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let r,n;try{[n,r]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(i){let o="Error parsing handshake response: "+i;this._logger.log(L.Error,o);let s=new Error(o);throw this._handshakeRejecter(s),s}if(r.error){let i="Server returned handshake error: "+r.error;this._logger.log(L.Error,i);let o=new Error(i);throw this._handshakeRejecter(o),o}else this._logger.log(L.Debug,"Server handshake complete.");return this._handshakeResolver(),n}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),this._pingServerHandle===void 0)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===Ne.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){let r=t.target.toLowerCase(),n=this._methods[r];if(!n){this._logger.log(L.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(L.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}let i=n.slice(),o=!!t.invocationId,s,a,c;for(let l of i)try{let h=s;s=await l.apply(this,t.arguments),o&&s&&h&&(this._logger.log(L.Error,`Multiple results provided for '${r}'. Sending error to server.`),c=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),a=void 0}catch(h){a=h,this._logger.log(L.Error,`A callback for the method '${r}' threw error '${h}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(t.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(t.invocationId,null,s):(this._logger.log(L.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),c=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(L.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(L.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new dt("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ne.Disconnecting?this._completeClose(t):this._connectionState===Ne.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===Ne.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=Ne.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(t??new Error("Connection closed.")),this._messageBuffer=void 0),Te.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(r=>r.apply(this,[t]))}catch(r){this._logger.log(L.Error,`An onclose callback called with error '${t}' threw error '${r}'.`)}}}async _reconnect(t){let r=Date.now(),n=0,i=t!==void 0?t:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(n++,0,i);if(o===null){this._logger.log(L.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=Ne.Reconnecting,t?this._logger.log(L.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(L.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[t]))}catch(s){this._logger.log(L.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this._connectionState!==Ne.Reconnecting){this._logger.log(L.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(L.Information,`Reconnect attempt number ${n} will start in ${o} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ne.Reconnecting){this._logger.log(L.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ne.Connected,this._logger.log(L.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(L.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(L.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==Ne.Reconnecting){this._logger.log(L.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ne.Disconnecting&&this._completeClose();return}i=s instanceof Error?s:new Error(s.toString()),o=this._getNextRetryDelay(n++,Date.now()-r,i)}}this._logger.log(L.Information,`Reconnect retries have been exhausted after ${Date.now()-r} ms and ${n} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,r,n){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:r,previousRetryCount:t,retryReason:n})}catch(i){return this._logger.log(L.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${r}) threw error '${i}'.`),null}}_cancelCallbacksWithError(t){let r=this._callbacks;this._callbacks={},Object.keys(r).forEach(n=>{let i=r[n];try{i(null,t)}catch(o){this._logger.log(L.Error,`Stream 'error' callback called with '${t}' threw error: ${Mc(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,r,n,i){if(n)return i.length!==0?{target:t,arguments:r,streamIds:i,type:he.Invocation}:{target:t,arguments:r,type:he.Invocation};{let o=this._invocationId;return this._invocationId++,i.length!==0?{target:t,arguments:r,invocationId:o.toString(),streamIds:i,type:he.Invocation}:{target:t,arguments:r,invocationId:o.toString(),type:he.Invocation}}}_launchStreams(t,r){if(t.length!==0){r||(r=Promise.resolve());for(let n in t)t[n].subscribe({complete:()=>{r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n)))},error:i=>{let o;i instanceof Error?o=i.message:i&&i.toString?o=i.toString():o="Unknown error",r=r.then(()=>this._sendWithProtocol(this._createCompletionMessage(n,o)))},next:i=>{r=r.then(()=>this._sendWithProtocol(this._createStreamItemMessage(n,i)))}})}}_replaceStreamingParams(t){let r=[],n=[];for(let i=0;i<t.length;i++){let o=t[i];if(this._isObservable(o)){let s=this._invocationId;this._invocationId++,r[s]=o,n.push(s.toString()),t.splice(i,1)}}return[r,n]}_isObservable(t){return t&&t.subscribe&&typeof t.subscribe=="function"}_createStreamInvocation(t,r,n){let i=this._invocationId;return this._invocationId++,n.length!==0?{target:t,arguments:r,invocationId:i.toString(),streamIds:n,type:he.StreamInvocation}:{target:t,arguments:r,invocationId:i.toString(),type:he.StreamInvocation}}_createCancelInvocation(t){return{invocationId:t,type:he.CancelInvocation}}_createStreamItemMessage(t,r){return{invocationId:t,item:r,type:he.StreamItem}}_createCompletionMessage(t,r,n){return r?{error:r,invocationId:t,type:he.Completion}:{invocationId:t,result:n,type:he.Completion}}_createCloseMessage(){return{type:he.Close}}};var Fw=[0,2e3,1e4,3e4,null],ss=class{constructor(t){this._retryDelays=t!==void 0?[...t,null]:Fw}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}};var Ar=class{};Ar.Authorization="Authorization";Ar.Cookie="Cookie";var Gc=class extends Mr{constructor(t,r){super(),this._innerClient=t,this._accessTokenFactory=r}async send(t){let r=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(r=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);let n=await this._innerClient.send(t);return r&&n.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):n}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[Ar.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[Ar.Authorization]&&delete t.headers[Ar.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}};var Ve;(function(e){e[e.None=0]="None",e[e.WebSockets=1]="WebSockets",e[e.ServerSentEvents=2]="ServerSentEvents",e[e.LongPolling=4]="LongPolling"})(Ve||(Ve={}));var qe;(function(e){e[e.Text=1]="Text",e[e.Binary=2]="Binary"})(qe||(qe={}));var qc=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};var as=class{get pollAborted(){return this._pollAbort.aborted}constructor(t,r,n){this._httpClient=t,this._logger=r,this._pollAbort=new qc,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}async connect(t,r){if(xe.isRequired(t,"url"),xe.isRequired(r,"transferFormat"),xe.isIn(r,qe,"transferFormat"),this._url=t,this._logger.log(L.Trace,"(LongPolling transport) Connecting."),r===qe.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[n,i]=zr(),o={[n]:i,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};r===qe.Binary&&(s.responseType="arraybuffer");let a=`${t}&_=${Date.now()}`;this._logger.log(L.Trace,`(LongPolling transport) polling: ${a}.`);let c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(L.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Gt(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(t,r){try{for(;this._running;)try{let n=`${t}&_=${Date.now()}`;this._logger.log(L.Trace,`(LongPolling transport) polling: ${n}.`);let i=await this._httpClient.get(n,r);i.statusCode===204?(this._logger.log(L.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):i.statusCode!==200?(this._logger.log(L.Error,`(LongPolling transport) Unexpected response code: ${i.statusCode}.`),this._closeError=new Gt(i.statusText||"",i.statusCode),this._running=!1):i.content?(this._logger.log(L.Trace,`(LongPolling transport) data received. ${xn(i.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(i.content)):this._logger.log(L.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(n){this._running?n instanceof Cn?this._logger.log(L.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=n,this._running=!1):this._logger.log(L.Trace,`(LongPolling transport) Poll errored after shutdown: ${n.message}`)}}finally{this._logger.log(L.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?Fc(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(L.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(L.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[r,n]=zr();t[r]=n;let i={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},o;try{await this._httpClient.delete(this._url,i)}catch(s){o=s}o?o instanceof Gt&&(o.statusCode===404?this._logger.log(L.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(L.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(L.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(L.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(L.Trace,t),this.onclose(this._closeError)}}};var Kc=class{constructor(t,r,n,i){this._httpClient=t,this._accessToken=r,this._logger=n,this._options=i,this.onreceive=null,this.onclose=null}async connect(t,r){return xe.isRequired(t,"url"),xe.isRequired(r,"transferFormat"),xe.isIn(r,qe,"transferFormat"),this._logger.log(L.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((n,i)=>{let o=!1;if(r!==qe.Text){i(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(Te.isBrowser||Te.isWebWorker)s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let a=this._httpClient.getCookieString(t),c={};c.Cookie=a;let[l,h]=zr();c[l]=h,s=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(L.Trace,`(SSE transport) data received. ${xn(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{o?this._close():i(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(L.Information,`SSE connected to ${this._url}`),this._eventSource=s,o=!0,n()}}catch(a){i(a);return}})}async send(t){return this._eventSource?Fc(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}};var Xc=class{constructor(t,r,n,i,o,s){this._logger=n,this._accessTokenFactory=r,this._logMessageContent=i,this._webSocketConstructor=o,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=s}async connect(t,r){xe.isRequired(t,"url"),xe.isRequired(r,"transferFormat"),xe.isIn(r,qe,"transferFormat"),this._logger.log(L.Trace,"(WebSockets transport) Connecting.");let n;return this._accessTokenFactory&&(n=await this._accessTokenFactory()),new Promise((i,o)=>{t=t.replace(/^http/,"ws");let s,a=this._httpClient.getCookieString(t),c=!1;if(Te.isNode||Te.isReactNative){let l={},[h,d]=zr();l[h]=d,n&&(l[Ar.Authorization]=`Bearer ${n}`),a&&(l[Ar.Cookie]=a),s=new this._webSocketConstructor(t,void 0,{headers:{...l,...this._headers}})}else n&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(n)}`);s||(s=new this._webSocketConstructor(t)),r===qe.Binary&&(s.binaryType="arraybuffer"),s.onopen=l=>{this._logger.log(L.Information,`WebSocket connected to ${t}.`),this._webSocket=s,c=!0,i()},s.onerror=l=>{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="There was an error with the transport",this._logger.log(L.Information,`(WebSockets transport) ${h}.`)},s.onmessage=l=>{if(this._logger.log(L.Trace,`(WebSockets transport) data received. ${xn(l.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(l.data)}catch(h){this._close(h);return}},s.onclose=l=>{if(c)this._close(l);else{let h=null;typeof ErrorEvent<"u"&&l instanceof ErrorEvent?h=l.error:h="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(h))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(L.Trace,`(WebSockets transport) sending data. ${xn(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(L.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(t.wasClean===!1||t.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&typeof t.wasClean=="boolean"&&typeof t.code=="number"}};var k2=100,Jc=class{constructor(t,r={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,xe.isRequired(t,"url"),this._logger=_2(r.logger),this.baseUrl=this._resolveUrl(t),r=r||{},r.logMessageContent=r.logMessageContent===void 0?!1:r.logMessageContent,typeof r.withCredentials=="boolean"||r.withCredentials===void 0)r.withCredentials=r.withCredentials===void 0?!0:r.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");r.timeout=r.timeout===void 0?100*1e3:r.timeout;let n=null,i=null;if(Te.isNode&&typeof ur<"u"){let o=typeof __webpack_require__=="function"?__non_webpack_require__:ur;n=o("ws"),i=o("eventsource")}!Te.isNode&&typeof WebSocket<"u"&&!r.WebSocket?r.WebSocket=WebSocket:Te.isNode&&!r.WebSocket&&n&&(r.WebSocket=n),!Te.isNode&&typeof EventSource<"u"&&!r.EventSource?r.EventSource=EventSource:Te.isNode&&!r.EventSource&&typeof i<"u"&&(r.EventSource=i),this._httpClient=new Gc(r.httpClient||new jc(this._logger),r.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=r,this.onreceive=null,this.onclose=null}async start(t){if(t=t||qe.Binary,xe.isIn(t,qe,"transferFormat"),this._logger.log(L.Debug,`Starting connection with transfer format '${qe[t]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,this._connectionState==="Disconnecting"){let r="Failed to start the HttpConnection before stop() was called.";return this._logger.log(L.Error,r),await this._stopPromise,Promise.reject(new dt(r))}else if(this._connectionState!=="Connected"){let r="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(L.Error,r),Promise.reject(new dt(r))}this._connectionStarted=!0}send(t){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new Pu(this.transport)),this._sendQueue.send(t))}async stop(t){if(this._connectionState==="Disconnected")return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(L.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(r=>{this._stopPromiseResolver=r}),await this._stopInternal(t),await this._stopPromise}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(r){this._logger.log(L.Error,`HttpConnection.transport.stop() threw error '${r}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(L.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let r=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===Ve.WebSockets)this.transport=this._constructTransport(Ve.WebSockets),await this._startTransport(r,t);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let n=null,i=0;do{if(n=await this._getNegotiationResponse(r),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new dt("The connection was stopped during negotiation.");if(n.error)throw new Error(n.error);if(n.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(n.url&&(r=n.url),n.accessToken){let o=n.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}i++}while(n.url&&i<k2);if(i===k2&&n.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(r,this._options.transport,n,t)}this.transport instanceof as&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(L.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(n){return this._logger.log(L.Error,"Failed to start the connection: "+n),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(n)}}async _getNegotiationResponse(t){let r={},[n,i]=zr();r[n]=i;let o=this._resolveNegotiateUrl(t);this._logger.log(L.Debug,`Sending negotiation request: ${o}.`);try{let s=await this._httpClient.post(o,{content:"",headers:{...r,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));let a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new os("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof Gt&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(L.Error,a),Promise.reject(new os(a))}}_createConnectUrl(t,r){return r?t+(t.indexOf("?")===-1?"?":"&")+`id=${r}`:t}async _createTransport(t,r,n,i){let o=this._createConnectUrl(t,n.connectionToken);if(this._isITransport(r)){this._logger.log(L.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=r,await this._startTransport(o,i),this.connectionId=n.connectionId;return}let s=[],a=n.availableTransports||[],c=n;for(let l of a){let h=this._resolveTransportOrError(l,r,i,c?.useStatefulReconnect===!0);if(h instanceof Error)s.push(`${l.transport} failed:`),s.push(h);else if(this._isITransport(h)){if(this.transport=h,!c){try{c=await this._getNegotiationResponse(t)}catch(d){return Promise.reject(d)}o=this._createConnectUrl(t,c.connectionToken)}try{await this._startTransport(o,i),this.connectionId=c.connectionId;return}catch(d){if(this._logger.log(L.Error,`Failed to start the transport '${l.transport}': ${d}`),c=void 0,s.push(new Oc(`${l.transport} failed: ${d}`,Ve[l.transport])),this._connectionState!=="Connecting"){let g="Failed to select transport before stop() was called.";return this._logger.log(L.Debug,g),Promise.reject(new dt(g))}}}}return s.length>0?Promise.reject(new Uc(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case Ve.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new Xc(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case Ve.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new Kc(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case Ve.LongPolling:return new as(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${t}.`)}}_startTransport(t,r){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async n=>{let i=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(t,r),await this.features.resend()}catch{i=!0}else{this._stopConnection(n);return}i&&this._stopConnection(n)}:this.transport.onclose=n=>this._stopConnection(n),this.transport.connect(t,r)}_resolveTransportOrError(t,r,n,i){let o=Ve[t.transport];if(o==null)return this._logger.log(L.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(Mw(r,o))if(t.transferFormats.map(a=>qe[a]).indexOf(n)>=0){if(o===Ve.WebSockets&&!this._options.WebSocket||o===Ve.ServerSentEvents&&!this._options.EventSource)return this._logger.log(L.Debug,`Skipping transport '${Ve[o]}' because it is not supported in your environment.'`),new Dc(`'${Ve[o]}' is not supported in your environment.`,o);this._logger.log(L.Debug,`Selecting transport '${Ve[o]}'.`);try{return this.features.reconnect=o===Ve.WebSockets?i:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(L.Debug,`Skipping transport '${Ve[o]}' because it does not support the requested transfer format '${qe[n]}'.`),new Error(`'${Ve[o]}' does not support ${qe[n]}.`);else return this._logger.log(L.Debug,`Skipping transport '${Ve[o]}' because it was disabled by the client.`),new Bc(`'${Ve[o]}' is disabled by the client.`,o)}_isITransport(t){return t&&typeof t=="object"&&"connect"in t}_stopConnection(t){if(this._logger.log(L.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(L.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(L.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),t?this._logger.log(L.Error,`Connection disconnected with error '${t}'.`):this._logger.log(L.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(r=>{this._logger.log(L.Error,`TransportSendQueue.stop() threw error '${r}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(r){this._logger.log(L.Error,`HttpConnection.onclose(${t}) threw error '${r}'.`)}}}_resolveUrl(t){if(t.lastIndexOf("https://",0)===0||t.lastIndexOf("http://",0)===0)return t;if(!Te.isBrowser)throw new Error(`Cannot resolve '${t}'.`);let r=window.document.createElement("a");return r.href=t,this._logger.log(L.Information,`Normalizing '${t}' to '${r.href}'.`),r.href}_resolveNegotiateUrl(t){let r=new URL(t);r.pathname.endsWith("/")?r.pathname+="negotiate":r.pathname+="/negotiate";let n=new URLSearchParams(r.searchParams);return n.has("negotiateVersion")||n.append("negotiateVersion",this._negotiateVersion.toString()),n.has("useStatefulReconnect")?n.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&n.append("useStatefulReconnect","true"),r.search=n.toString(),r.toString()}};function Mw(e,t){return!e||(t&e)!==0}var Pu=class e{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new so,this._transportResult=new so,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new so),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new so;let t=this._transportResult;this._transportResult=void 0;let r=typeof this._buffer[0]=="string"?this._buffer.join(""):e._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(r),t.resolve()}catch(n){t.reject(n)}}}static _concatBuffers(t){let r=t.map(o=>o.byteLength).reduce((o,s)=>o+s),n=new Uint8Array(r),i=0;for(let o of t)n.set(new Uint8Array(o),i),i+=o.byteLength;return n.buffer}},so=class{constructor(){this.promise=new Promise((t,r)=>[this._resolver,this._rejecter]=[t,r])}resolve(){this._resolver()}reject(t){this._rejecter(t)}};var Nw="json",Yc=class{constructor(){this.name=Nw,this.version=2,this.transferFormat=qe.Text}parseMessages(t,r){if(typeof t!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];r===null&&(r=Nr.instance);let n=qt.parse(t),i=[];for(let o of n){let s=JSON.parse(o);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case he.Invocation:this._isInvocationMessage(s);break;case he.StreamItem:this._isStreamItemMessage(s);break;case he.Completion:this._isCompletionMessage(s);break;case he.Ping:break;case he.Close:break;case he.Ack:this._isAckMessage(s);break;case he.Sequence:this._isSequenceMessage(s);break;default:r.log(L.Information,"Unknown message type '"+s.type+"' ignored.");continue}i.push(s)}return i}writeMessage(t){return qt.write(JSON.stringify(t))}_isInvocationMessage(t){this._assertNotEmptyString(t.target,"Invalid payload for Invocation message."),t.invocationId!==void 0&&this._assertNotEmptyString(t.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(t){if(this._assertNotEmptyString(t.invocationId,"Invalid payload for StreamItem message."),t.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this._assertNotEmptyString(t.error,"Invalid payload for Completion message."),this._assertNotEmptyString(t.invocationId,"Invalid payload for Completion message.")}_isAckMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(t){if(typeof t.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(t,r){if(typeof t!="string"||t==="")throw new Error(r)}};var zw={trace:L.Trace,debug:L.Debug,info:L.Information,information:L.Information,warn:L.Warning,warning:L.Warning,error:L.Error,critical:L.Critical,none:L.None};function jw(e){let t=zw[e.toLowerCase()];if(typeof t<"u")return t;throw new Error(`Unknown log level: ${e}`)}var cs=class{configureLogging(t){if(xe.isRequired(t,"logging"),Vw(t))this.logger=t;else if(typeof t=="string"){let r=jw(t);this.logger=new ei(r)}else this.logger=new ei(t);return this}withUrl(t,r){return xe.isRequired(t,"url"),xe.isNotEmpty(t,"url"),this.url=t,typeof r=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...r}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:r},this}withHubProtocol(t){return xe.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new ss(t):this.reconnectPolicy=t:this.reconnectPolicy=new ss,this}withServerTimeout(t){return xe.isRequired(t,"milliseconds"),this._serverTimeoutInMilliseconds=t,this}withKeepAliveInterval(t){return xe.isRequired(t,"milliseconds"),this._keepAliveIntervalInMilliseconds=t,this}withStatefulReconnect(t){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=t?.bufferSize,this}build(){let t=this.httpConnectionOptions||{};if(t.logger===void 0&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");let r=new Jc(this.url,t);return $c.create(r,this.logger||Nr.instance,this.protocol||new Yc,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}};function Vw(e){return e.log!==void 0}var Ey=fl(ky());var ys=class{},Cy=(s=>(s[s.WAITING=-1]="WAITING",s[s.STARTED=0]="STARTED",s[s.QR_CODE=1]="QR_CODE",s[s.POSITION=2]="POSITION",s[s.FINISHED=3]="FINISHED",s[s.ERROR=9]="ERROR",s))(Cy||{}),ll=class e{constructor(t,r){this.proctoringId="";this.capturePhotoUrl="";this.qrCodeBase64Image="";this.transmissionOk=!1;this.waitingPositionValidation=!1;this.externalSessionId=null;this.currentStep=0;this.connection=null;this.context=t,this.onRealtimeAlertsCallback=r,this.backend=new ir({type:t?.type||"prod",token:t.token,isRealtime:!1}),this.currentStep=-1}static{this.isModalOpen=!1}getExternalCameraSessionId(){return""+this.externalSessionId}async checkTransmission(){try{this.transmissionOk=!1;let t=await this.backend.externalCameraCheckTransmission(""+this.externalSessionId),r=0;for(;!this.transmissionOk&&r<=5;)await new Promise(n=>setTimeout(n,2e3)),r=r+1;if(!this.transmissionOk)throw new Error("Timed out na checagem da transmiss\xE3o!")}catch(t){throw console.error("Erro ao checar a transmiss\xE3o:",t),new Error("N\xE3o foi poss\xEDvel checar a transmiss\xE3o."+t)}}async startTransmission(t){try{this.proctoringId=t;let r=await this.backend.externalCameraStartTransmission(""+this.externalSessionId,t)}catch{throw new Error("N\xE3o foi poss\xEDvel iniciar a transmiss\xE3o.")}}async goToPositionGuide(){try{let t=await this.backend.goToExternalCameraPositionStep(""+this.externalSessionId)}catch(t){throw console.error("Erro ao enviar comando de Position:",t),new Error("N\xE3o foi poss\xEDvel enviar comando de Position Guide.")}}async reset(){if(this.connection){let t=new ys;t.command="Reset",this.connection.invoke("SendAction",this.externalSessionId,t)}}async takePicture(t,r){if(this.connection){this.waitingPositionValidation=t,this.onTakePictureCallback=r;let n=new ys;n.command="Capture",this.connection.invoke("SendAction",this.externalSessionId,n)}else throw new Error("N\xE3o existe conex\xE3o de camera externa ativa.")}async startSession(t){try{this.onQrCodeReadedCallback=t,this.connection&&await this.disconnectWebSocket(),await this.initializeWebSocketConnection(),await this.reset();let r=await this.backend.externalCameraStartSession();this.externalSessionId=r.externalSessionId,this.currentStep=0;let n={externalSessionId:this.externalSessionId,token:this.context.token,ambient:this.context.type},i=JSON.stringify(n);return this.qrCodeBase64Image=await Ey.default.toDataURL(i),this.qrCodeBase64Image}catch(r){return this.disconnectWebSocket(),Promise.reject(r)}}async checkExternalCamera(){if(this.currentStep=0,e.isModalOpen)return Promise.reject("O modal de verifica\xE7\xE3o j\xE1 est\xE1 aberto.");e.isModalOpen=!0;try{return await this.startSession(()=>{}),await this.buildInterface()}catch(t){return console.error("Erro ao iniciar verifica\xE7\xE3o:",t),this.closeCheckExternalCamera(),Promise.reject(t)}}buildInterface(){return new Promise((t,r)=>{this.resolvePromise=t;let n=document.createElement("div");n.setAttribute("id","externalCameraCheck"),this.applyStyles(n,{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"});let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",zIndex:"1001",width:"500px",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"});let o=document.createElement("h3");o.innerText="Conectar dispositivo m\xF3vel",this.applyStyles(o,{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"});let s=document.createElement("div");s.id="external-camera-content",this.applyStyles(s,{width:"100%",padding:"20px 40px",boxSizing:"border-box",minHeight:"300px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"});let a=document.createElement("div");this.applyStyles(a,{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"});let c=document.createElement("button");c.innerText="Cancelar",this.applyStyles(c,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 0 10px",cursor:"pointer"}),c.addEventListener("click",()=>{let h=new ys;h.command="Cancel",this.connection?.invoke("SendAction",this.externalSessionId,h),this.closeCheckExternalCamera(),t({result:!1})});let l=document.createElement("button");l.innerText="Continuar",l.id="external-camera-continue",this.applyStyles(l,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),a.appendChild(c),a.appendChild(l),i.appendChild(o),i.appendChild(s),i.appendChild(a),n.appendChild(i),document.body.appendChild(n),this.renderCurrentStep()})}renderCurrentStep(){let t=document.getElementById("external-camera-content");if(t)switch(t.innerHTML="",this.currentStep){case 0:this.renderQRCodeStep(t);break;case 1:this.renderPhotoStep(t);break;case 2:this.renderImageStep(t);break;default:break}}renderQRCodeStep(t){let r=document.createElement("canvas");r.id="qr-code-canvas";let n=document.createElement("p");n.innerText="Aponte a c\xE2mera do seu celular para o QR Code para iniciar a verifica\xE7\xE3o do ambiente.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"});let i=r.getContext("2d"),o=new Image;o.onload=()=>{let c=250/o.width,l=o.height*c;r.width=250,r.height=l,i&&i.drawImage(o,0,0,250,l)},o.src=this.qrCodeBase64Image,t.appendChild(r),t.appendChild(n);let s=document.getElementById("external-camera-continue");s.disabled=!0,this.applyStyles(s,{color:"#ccc",cursor:"not-allowed"})}renderPhotoStep(t){let r=document.createElement("p");r.id="photo-message",r.innerText="Clique no bot\xE3o abaixo para realizar a captura da foto do ambiente.",this.applyStyles(r,{textAlign:"center",color:"#555",marginBottom:"20px",fontSize:"14px",display:"-webkit-box",overflow:"hidden",textOverflow:"ellipsis"}),r.style.webkitLineClamp="3",r.style.webkitBoxOrient="vertical",t.appendChild(r);let n=document.createElement("div");n.id="photo-error-banner",n.innerText="Foto fora do padr\xE3o esperado.",this.applyStyles(n,{backgroundColor:"#FEE2E2",color:"#DC2626",padding:"12px 15px",borderRadius:"8px",textAlign:"center",fontSize:"12px",fontWeight:"400",marginBottom:"15px",display:"none"}),t.appendChild(n);let i=document.createElement("div");this.applyStyles(i,{backgroundColor:"#fff",borderRadius:"8px",padding:"20px",display:"flex",gap:"20px",alignItems:"flex-start",border:"1px solid #e5e5e5",marginBottom:"20px"});let o=document.createElement("div");if(o.id="photo-icon-container",this.applyStyles(o,{backgroundColor:"#f5f5f5",borderRadius:"8px",width:"120px",height:"160px",minWidth:"120px",minHeight:"160px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:"0",overflow:"hidden"}),this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let u=document.createElement("img");u.id="img-photo";let b=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;u.src=b,this.applyStyles(u,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(u)}else{let u=document.createElement("div");u.innerHTML=`
502
500
  <svg width="40" height="40" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
503
501
  <path d="M23 19C23 19.5304 22.7893 20.0391 22.4142 20.4142C22.0391 20.7893 21.5304 21 21 21H3C2.46957 21 1.96086 20.7893 1.58579 20.4142C1.21071 20.0391 1 19.5304 1 19V8C1 7.46957 1.21071 6.96086 1.58579 6.58579C1.96086 6.21071 2.46957 6 3 6H7L9 4H15L17 6H21C21.5304 6 22.0391 6.21071 22.4142 6.58579C22.7893 6.96086 23 7.46957 23 8V19Z" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
504
502
  <path d="M12 17C14.2091 17 16 15.2091 16 13C16 10.7909 14.2091 9 12 9C9.79086 9 8 10.7909 8 13C8 15.2091 9.79086 17 12 17Z" stroke="#666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
505
503
  </svg>
506
- `,o.appendChild(u)}i.appendChild(o);let s=document.createElement("div");this.applyStyles(s,{flex:"1",display:"flex",flexDirection:"column",gap:"15px"});let a=document.createElement("h4");a.innerText="Capture uma foto n\xEDtida",this.applyStyles(a,{margin:"0",fontSize:"16px",fontWeight:"bold",color:"#333"}),s.appendChild(a);let c=document.createElement("div");this.applyStyles(c,{display:"flex",flexDirection:"column",gap:"10px"}),["Boa ilumina\xE7\xE3o e sem reflexos","Mostre a mesa, cadeira e ambiente","Evite pessoas ao fundo"].forEach(u=>{let b=document.createElement("div");this.applyStyles(b,{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#555"});let v=document.createElement("span");v.innerHTML=`
504
+ `,o.appendChild(u)}i.appendChild(o);let s=document.createElement("div");this.applyStyles(s,{flex:"1",display:"flex",flexDirection:"column",gap:"15px"});let a=document.createElement("h4");a.innerText="Capture uma foto n\xEDtida",this.applyStyles(a,{margin:"0",fontSize:"16px",fontWeight:"bold",color:"#333"}),s.appendChild(a);let c=document.createElement("div");this.applyStyles(c,{display:"flex",flexDirection:"column",gap:"10px"}),["Boa ilumina\xE7\xE3o e sem reflexos","Mostre a mesa, cadeira e ambiente","Evite pessoas ao fundo"].forEach(u=>{let b=document.createElement("div");this.applyStyles(b,{display:"flex",alignItems:"center",gap:"8px",fontSize:"14px",color:"#555"});let _=document.createElement("span");_.innerHTML=`
507
505
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
508
506
  <circle cx="10" cy="10" r="9" stroke="#16A34A" stroke-width="2" fill="none"/>
509
507
  <path d="M6 10L9 13L14 7" stroke="#16A34A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
510
508
  </svg>
511
- `,this.applyStyles(v,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let k=document.createElement("span");k.innerText=u,b.appendChild(v),b.appendChild(k),c.appendChild(b)}),s.appendChild(c);let d=document.createElement("button");d.innerText="Capturar foto",d.id="position-capture-button",this.applyStyles(d,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),d.onclick=()=>{if(this.connection){let u=document.getElementById("photo-message");u&&(u.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),d.disabled=!0,this.applyStyles(d,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(d),i.appendChild(s),t.appendChild(i);let h=document.createElement("div");this.applyStyles(h,{marginTop:"10px",fontSize:"13px",color:"#666"});let m=document.createElement("span");m.innerText="Dica: ",m.style.fontWeight="bold";let f=document.createElement("span");f.innerText="mantenha o celular est\xE1vel durante todo o processo.",h.appendChild(m),h.appendChild(f),t.appendChild(h);let g=document.getElementById("external-camera-continue");g.disabled=!0,this.applyStyles(g,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let i=document.getElementById("external-camera-continue");i.disabled=!1,i.innerText="Concluir",this.applyStyles(i,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),i.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new Mu().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:Ke.WebSockets,withCredentials:!1,skipNegotiation:!0}).withAutomaticReconnect().configureLogging(F.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let o=jt[n];this.handleWebSocketMessage(o)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}}),this.connection.on("ReceiveAction",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}});try{await this.connection.start()}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),i=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),i&&(i.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let o=document.getElementById("photo-icon-container");if(o&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(o.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop()}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){Cs.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}},Jc=Cs;Jc.isModalOpen=!1;var bt;(function(e){e.Stop="Stop",e.Starting="Starting",e.Recording="Recording",e.Stopping="Stopping",e.Paused="Paused"})(bt||(bt={}));var pi;(function(e){e.Download="Download",e.Upload="Upload"})(pi||(pi={}));var cp=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1,realtimePackageSize:10,realtimeCaptureInterval:2}};this.proctoringId="";this.insights=void 0;this.state=bt.Stop;this.serviceType=pi.Upload;this.onStopSharingScreenCallback=()=>{};this.onVisibilityLostCallback=()=>{};this.onVisibilityRestoredCallback=()=>{};this.onLostFocusCallback=()=>{};this.onLostFocusAlertRecorderCallback=t=>{};this.onFocusCallback=()=>{};this.onFocusAlertRecorderCallback=t=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=async t=>{await this.internalOnRealtimeAlerts(t)};this.realtimeAlertsToSend=[];this.onBufferSizeErrorCallback=t=>{};this.backend=new Sr({type:t.type||"prod",token:t.token,isRealtime:!1}),this.repository=new Pc("EasyProctorDb","exams2"),this.repositoryDevices=new Pc("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new vu(this.context.credentials.cpf,this.backend)),this.appChecker=new Jc(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnVisibilityLostCallback(t){this.onVisibilityLostCallback=t}setOnVisibilityRestoredCallback(t){this.onVisibilityRestoredCallback=t}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{ie.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:De.StopSharingScreen,type:ft.Screen}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusAlertRecorderCallback(){this.onLostFocusAlertRecorderCallback=async t=>{this.onLostFocusCallback&&this.onLostFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"lost_focus",category:"lost_focus",description:"Perda de foco no exame",begin:t.begin,end:t.end,alert:De.FocusOff,status:"ALERT"})}}setOnFocusAlertRecorderCallback(){this.onFocusAlertRecorderCallback=async t=>{this.onFocusCallback&&this.onFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"focus",category:"focus",description:"Retorno de foco no exame",begin:t.begin,end:t.end,alert:De.FocusOff,status:"OK"})}}async setOnLostFocusCallback(t){this.onLostFocusCallback=async()=>await t(),this.setOnLostFocusAlertRecorderCallback()}async setOnFocusCallback(t){this.onFocusCallback=async()=>await t(),this.setOnFocusAlertRecorderCallback()}async onChangeDevices(t={}){new dh(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return De.NoFace;case"multiple_faces_detected":return De.MultipleFaces;case"multiple_persons_detected":return De.EnvironmentMultiplePeople;case"no_person_detected":return De.EnvironmentNoPeople;case"lost_focus":return De.FocusOff;case"focus":return De.FocusOff;case"error_upload_package":return De.RealtimeOffline;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return Xn.Face;case"person_detection_on_stream":return Xn.People;case"lost_focus":return Xn.LostFocus;case"focus":return Xn.LostFocus;default:return null}}async stopRealtimeAlert(t){let r=3,n=async i=>{if(!(i>r))try{var o=await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(t.type),alertImageBase64:t.description!=="face_stop"?await this.allRecorders.cameraRecorder.getCurrentImageBase64():"",retry:i<r-1});return o}catch(s){return console.log("error stopRealtimeAlert",s),n(i+1)}};await n(1)}async sendPendingRealtimeAlerts(){let t=[...this.realtimeAlertsToSend];for(let r of t)try{r.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,alert:this.convertRealtimeCategoryToAlertCategory(r.category)}):r.status==="OK"&&await this.stopRealtimeAlert(r),this.realtimeAlertsToSend.splice(this.realtimeAlertsToSend.indexOf(r),1)}catch(n){console.log("error sendPendingRealtimeAlerts",n),this.realtimeAlertsToSend.push(r);break}}async internalOnRealtimeAlerts(t){if(this.sessionOptions.proctoringType==="REALTIME"&&(t.type==="face_detection_on_stream"||t.type==="person_detection_on_stream"||t.type==="lost_focus"||t.type==="focus"||t.type==="error_upload_package")){if(await this.sendPendingRealtimeAlerts(),t.status==="ALERT"){if(this.allRecorders.cameraRecorder.stopped)return;try{await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,alert:this.convertRealtimeCategoryToAlertCategory(t.category)})}catch(r){console.log("error startRealtimeAlert "+t.category),console.log("error startRealtimeAlert adicionando na fila",r),this.realtimeAlertsToSend.push(t)}}else if(t.status==="OK"){if(this.allRecorders.cameraRecorder.stopped&&t.description!=="face_stop")return;try{await this.stopRealtimeAlert(t)}catch(r){console.log("error stopRealtimeAlert adicionando na fila",r),this.realtimeAlertsToSend.push(t)}}}}async onRealtimeAlerts(t={}){this.setOnLostFocusAlertRecorderCallback(),this.setOnFocusAlertRecorderCallback(),this.onRealtimeAlertsCallback=async r=>{t.data&&t.data(r),await this.internalOnRealtimeAlerts(r)}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}async createRecorders(t=ar){this.onChangeDevices(),console.log("Creating recorders"),await this.recorder?.stopAll();let r=new zr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new bu({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,i=new fh({onFocusCallback:a=>this.onFocusAlertRecorderCallback(a),onLostFocusCallback:a=>this.onLostFocusAlertRecorderCallback(a),onRealtimeAlertCallback:a=>this.onRealtimeAlertsCallback(a)},t),o=new yu(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,o,i].filter(Boolean);return this.sessionOptions.proctoringType!="REALTIME"&&n&&s.push(n),this.recorder=new ph(this.proctoringSession,s),{screenRecorder:n,alertRecorder:i,noiseRecorder:o,cameraRecorder:r}}async login(){if(!this.context.credentials?.cpf)throw m0;this.context.token=await this.auth.login()}async start(t=ar,r={}){try{if(this.context.token===void 0)throw f0;this.extension=new lh,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),i=await mr();await this.repositoryDevices.save({...i,id:"devices"}),this.sessionOptions={...ar,...t},this.videoOptions=Wa(r),this.sessionOptions.proctoringType==="REALTIME"&&this.backend.setRealtime(!0),await this.initConfig(t.useGeolocation),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch(l){throw g0}try{t?.useSafeBrowserAPI&&await this.safeBrowserBackendService.isAlive()}catch(l){throw ih}if(this.state!=bt.Stop)throw d0;this.state=bt.Starting,await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Xi,this.allRecorders=await this.createRecorders(this.sessionOptions);let o=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=o.id,ie.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(i)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch(l){throw y0}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId);try{t?.useSafeBrowserAPI&&await this.safeBrowserBackendService.setProctoringId(this.proctoringId)}catch(l){throw ih}if(this.allRecorders.cameraRecorder.onVisibilityRestored=()=>{console.log("[Proctoring] Usu\xE1rio retornou ao browser."),this.onVisibilityRestoredCallback()},this.sessionOptions.proctoringType==="REALTIME"&&!$a())try{await Zn.recoverPendingUploads(this.backend,this.context.token)}catch(l){console.warn("[Proctoring] Erro ao recuperar chunks de sess\xE3o anterior:",l)}try{console.log("Starting recorders"),await this.recorder.startAll()}catch(l){throw console.log("Starting recorders error:",l),l}t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:qi.POTENCIAL_CAMERA})),await this.repository.save(this.proctoringSession);let s={};for(let l in navigator)s[l]=navigator[l];ie.registerStart(this.proctoringId,!0,`Version: ${Jn()}
512
- Navigator: ${JSON.stringify(s)}`),o.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(o.screenStream=this.allRecorders.screenRecorder.screenStream),this.state=bt.Recording;let a=0,c=!1;return this.verifyFirstFaceInterval=setInterval(async()=>{if(this.sessionOptions.proctoringType==="REALTIME"){if(c)return;c=!0,a++;try{var l=await this.backend.verifyFace(this.proctoringId,await this.allRecorders.cameraRecorder.getCurrentImageBase64(),!(a>2));c=!1,clearInterval(this.verifyFirstFaceInterval)}catch(d){c=!1;return}}},5e3),o}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&ie.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
513
- Version: ${Jn()}
509
+ `,this.applyStyles(_,{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:"0"});let k=document.createElement("span");k.innerText=u,b.appendChild(_),b.appendChild(k),c.appendChild(b)}),s.appendChild(c);let h=document.createElement("button");h.innerText="Capturar foto",h.id="position-capture-button",this.applyStyles(h,{marginTop:"10px",padding:"12px 24px",fontSize:"14px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"6px",cursor:"pointer",transition:"background-color 0.2s",alignSelf:"flex-start"}),h.onclick=()=>{if(this.connection){let u=document.getElementById("photo-message");u&&(u.innerText="N\xE3o saia da posi\xE7\xE3o atual, estamos validando o ambiente..."),n.style.display="none",this.takePicture(!0,()=>{}),h.disabled=!0,this.applyStyles(h,{backgroundColor:"#9CA3AF",cursor:"not-allowed"})}},s.appendChild(h),i.appendChild(s),t.appendChild(i);let d=document.createElement("div");this.applyStyles(d,{marginTop:"10px",fontSize:"13px",color:"#666"});let g=document.createElement("span");g.innerText="Dica: ",g.style.fontWeight="bold";let f=document.createElement("span");f.innerText="mantenha o celular est\xE1vel durante todo o processo.",d.appendChild(g),d.appendChild(f),t.appendChild(d);let m=document.getElementById("external-camera-continue");m.disabled=!0,this.applyStyles(m,{color:"#ccc",cursor:"not-allowed"})}renderImageStep(t){t.innerHTML="";let r=document.createElement("img");r.src="data:image/jpeg;base64,"+this.capturePhotoUrl,this.applyStyles(r,{maxWidth:"100%",maxHeight:"300px",borderRadius:"8px"}),t.appendChild(r);let n=document.createElement("photo-message");n.id="photo-message",n.innerText="Verifica\xE7\xE3o finalizada com sucesso.",this.applyStyles(n,{textAlign:"center",color:"#555",marginTop:"20px"}),t.appendChild(n);let i=document.getElementById("external-camera-continue");i.disabled=!1,i.innerText="Concluir",this.applyStyles(i,{width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"0 0 10px 0",cursor:"pointer",borderLeft:"2px solid rgba(0, 0, 0, .1)"}),i.onclick=()=>{this.closeCheckExternalCamera(),this.resolvePromise({result:!0})}}nextState(){this.renderCurrentStep()}async initializeWebSocketConnection(){let t=this.backend.getSocketUrl();this.connection=new cs().withUrl(t,{accessTokenFactory:()=>this.context.token,transport:Ve.WebSockets,withCredentials:!1,skipNegotiation:!0}).withAutomaticReconnect().configureLogging(L.Information).build(),this.connection.on("ReceiveMessage",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{let o=Cy[n];this.handleWebSocketMessage(o)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}}),this.connection.on("ReceiveAction",(r,n)=>{if(r!==this.externalSessionId){console.warn("Sess\xE3o diferente!");return}try{this.handleWebSocketAction(n)}catch(i){console.error("Erro ao processar mensagem do WebSocket:",i)}});try{await this.connection.start()}catch(r){throw console.error("Falha ao conectar ou entrar no grupo do SignalR: ",r),new Error("N\xE3o foi poss\xEDvel conectar ao servi\xE7o em tempo real.")}}handleWebSocketAction(t){let r=document.getElementById("position-capture-button"),n=document.getElementById("photo-message"),i=document.getElementById("photo-error-banner");switch(t.command){case"Capture_Error":r&&(this.applyStyles(r,{marginTop:"30px",padding:"12px 20px",fontSize:"16px",fontWeight:"bold",color:"white",backgroundColor:"#16A34A",border:"none",borderRadius:"8px",cursor:"pointer",transition:"background-color 0.2s"}),r.disabled=!1),n&&(n.innerText=""+t.message),i&&(i.style.display="flex"),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,errorMessage:t.message,success:!1});break;case"CapturePhoto":this.capturePhotoUrl=""+t.message;let o=document.getElementById("photo-icon-container");if(o&&this.capturePhotoUrl&&this.capturePhotoUrl.trim()!==""){let s=document.getElementById("img-photo");s||(o.innerHTML="",s=document.createElement("img"),s.id="img-photo",this.applyStyles(s,{width:"100%",height:"100%",objectFit:"contain",objectPosition:"center",borderRadius:"8px",display:"block"}),o.appendChild(s));let a=this.capturePhotoUrl.startsWith("data:")?this.capturePhotoUrl:"data:image/jpeg;base64,"+this.capturePhotoUrl;s.src=a,s.onload=()=>{console.log("Image loaded successfully in icon container")},s.onerror=c=>{console.error("Error loading image:",c)}}this.waitingPositionValidation==!1&&this.onTakePictureCallback({photo:this.capturePhotoUrl});break;case"Check_Transmission":t.message=="Transmission_OK"&&(this.transmissionOk=!0);break;case"Cancel":this.closeCheckExternalCamera();break;case"EnvironmentAlert":this.onRealtimeAlertsCallback({status:"ALERT",description:t.message,type:"environment_alert"});break}}handleWebSocketMessage(t){switch(this.currentStep=t,t){case 1:this.currentStep===1&&(this.nextState(),this.onQrCodeReadedCallback(!0));break;case 2:this.nextState(),this.waitingPositionValidation==!0&&this.onTakePictureCallback({photo:this.capturePhotoUrl,success:!0});break;case 3:this.closeCheckExternalCamera();break;case 9:console.error("Erro recebido do processo de c\xE2mera externa."),this.closeCheckExternalCamera(),this.resolvePromise({result:!1});break}}async disconnectWebSocket(){if(this.connection)try{await this.connection.stop()}catch(t){console.error("Erro ao desconectar do SignalR:",t)}finally{this.connection=null}}closeCheckExternalCamera(){e.isModalOpen=!1,this.disconnectWebSocket(),document.querySelector("#externalCameraCheck")?.remove()}applyStyles(t,r){for(let n in r)t.style[n]=r[n]}};var hl=class{constructor(t){this.context=t;this.deviceData=null;this.paramsConfig={audioBehaviourParameters:{recordingBitrate:128,noiseLimit:40},imageBehaviourParameters:{useUploadImage:!0,uploadInterval:20,saveVideo:!0},videoBehaviourParameters:{detectFace:!1,detectPerson:!1,detectCellPhone:!1,detectNoise:!1,detectSpeech:!1,realtimePackageSize:10,realtimeCaptureInterval:2}};this.proctoringId="";this.insights=void 0;this.state="Stop";this.serviceType="Upload";this.onStopSharingScreenCallback=()=>{};this.onVisibilityLostCallback=()=>{};this.onVisibilityRestoredCallback=()=>{};this.onLostFocusCallback=()=>{};this.onLostFocusAlertRecorderCallback=t=>{};this.onFocusCallback=()=>{};this.onFocusAlertRecorderCallback=t=>{};this.onChangeDevicesCallback=t=>{};this.onRealtimeAlertsCallback=async t=>{await this.internalOnRealtimeAlerts(t)};this.realtimeAlertsToSend=[];this.onBufferSizeErrorCallback=t=>{};this.backend=new ir({type:t.type||"prod",token:t.token,isRealtime:!1}),this.repository=new is("EasyProctorDb","exams2"),this.repositoryDevices=new is("EasyProctorDbDevices","devices"),this.context.credentials?.cpf&&(this.auth=new Rc(this.context.credentials.cpf,this.backend)),this.appChecker=new ll(this.context,r=>this.onRealtimeAlertsCallback(r))}setOnVisibilityLostCallback(t){this.onVisibilityLostCallback=t}setOnVisibilityRestoredCallback(t){this.onVisibilityRestoredCallback=t}setOnStopSharingScreenCallback(t){this.onStopSharingScreenCallback=async()=>{pe.registerStopSharingScreen(this.proctoringId,"Stop sharing screen"),this.allRecorders?.alertRecorder?.addAlert({alert:34,type:3}),this.allRecorders?.screenRecorder?.stopRecording(),t()}}setOnLostFocusAlertRecorderCallback(){this.onLostFocusAlertRecorderCallback=async t=>{this.onLostFocusCallback&&this.onLostFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"lost_focus",category:"lost_focus",description:"Perda de foco no exame",begin:t.begin,end:t.end,alert:25,status:"ALERT"})}}setOnFocusAlertRecorderCallback(){this.onFocusAlertRecorderCallback=async t=>{this.onFocusCallback&&this.onFocusCallback(),this.sessionOptions.proctoringType==="REALTIME"&&await this.onRealtimeAlertsCallback({type:"focus",category:"focus",description:"Retorno de foco no exame",begin:t.begin,end:t.end,alert:25,status:"OK"})}}async setOnLostFocusCallback(t){this.onLostFocusCallback=async()=>await t(),this.setOnLostFocusAlertRecorderCallback()}async setOnFocusCallback(t){this.onFocusCallback=async()=>await t(),this.setOnFocusAlertRecorderCallback()}async onChangeDevices(t={}){new $a(this.repositoryDevices,this.proctoringId,this.sessionOptions,this.allRecorders).startRecording(t),this.onChangeDevicesCallback=n=>t.status&&t.status(n)}convertRealtimeCategoryToAlertCategory(t){switch(t){case"no_face_detected":return 1;case"multiple_faces_detected":return 2;case"multiple_persons_detected":return 28;case"no_person_detected":return 29;case"lost_focus":return 25;case"focus":return 25;case"error_upload_package":return 44;default:return null}}convertRealtimeTypeToWarningType(t){switch(t){case"face_detection_on_stream":return 0;case"person_detection_on_stream":return 1;case"lost_focus":return 2;case"focus":return 2;default:return null}}async stopRealtimeAlert(t){let n=async i=>{if(!(i>3))try{var o=await this.backend.stopRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,warningCategoryEnum:this.convertRealtimeTypeToWarningType(t.type),alertImageBase64:t.description!=="face_stop"?await this.allRecorders.cameraRecorder.getCurrentImageBase64():"",retry:i<2});return o}catch(s){return console.log("error stopRealtimeAlert",s),n(i+1)}};await n(1)}async sendPendingRealtimeAlerts(){let t=[...this.realtimeAlertsToSend];for(let r of t)try{r.status==="ALERT"?await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:r.begin,end:r.end,alert:this.convertRealtimeCategoryToAlertCategory(r.category)}):r.status==="OK"&&await this.stopRealtimeAlert(r),this.realtimeAlertsToSend.splice(this.realtimeAlertsToSend.indexOf(r),1)}catch(n){console.log("error sendPendingRealtimeAlerts",n),this.realtimeAlertsToSend.push(r);break}}async internalOnRealtimeAlerts(t){if(this.sessionOptions.proctoringType==="REALTIME"&&(t.type==="face_detection_on_stream"||t.type==="person_detection_on_stream"||t.type==="lost_focus"||t.type==="focus"||t.type==="error_upload_package")){if(await this.sendPendingRealtimeAlerts(),t.status==="ALERT"){if(this.allRecorders.cameraRecorder.stopped)return;try{await this.backend.startRealtimeAlert({proctoringId:this.proctoringId,begin:t.begin,end:t.end,alert:this.convertRealtimeCategoryToAlertCategory(t.category)})}catch(r){console.log("error startRealtimeAlert "+t.category),console.log("error startRealtimeAlert adicionando na fila",r),this.realtimeAlertsToSend.push(t)}}else if(t.status==="OK"){if(this.allRecorders.cameraRecorder.stopped&&t.description!=="face_stop")return;try{await this.stopRealtimeAlert(t)}catch(r){console.log("error stopRealtimeAlert adicionando na fila",r),this.realtimeAlertsToSend.push(t)}}}}async onRealtimeAlerts(t={}){this.setOnLostFocusAlertRecorderCallback(),this.setOnFocusAlertRecorderCallback(),this.onRealtimeAlertsCallback=async r=>{t.data&&t.data(r),await this.internalOnRealtimeAlerts(r)}}setOnBufferSizeErrorCallback(t){this.onBufferSizeErrorCallback=r=>t(r)}setDeviceCheckData(t){this.deviceData=t}async createRecorders(t=or){this.onChangeDevices(),console.log("Creating recorders"),await this.recorder?.stopAll();let r=new Zr({cameraId:this.sessionOptions.cameraId,microphoneId:this.sessionOptions.microphoneId,onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:a=>this.onBufferSizeErrorCallback(a),proctoringType:this.sessionOptions.proctoringType,onChangeDevicesCallback:a=>this.onChangeDevicesCallback(a),onRealtimeAlertsCallback:a=>this.onRealtimeAlertsCallback(a)},{width:this.videoOptions.width,height:this.videoOptions.height,minWidth:this.videoOptions.minWidth,minHeight:this.videoOptions.minHeight},this.paramsConfig,this.backend,this.context.token),n=this.sessionOptions.captureScreen?new Ic({allowOnlyFirstMonitor:this.sessionOptions.allowOnlyFirstMonitor??!0,allowMultipleMonitors:this.sessionOptions.allowMultipleMonitors??!0,screenRecorderOptions:this.sessionOptions.screenRecorderOptions,onStopSharingScreenCallback:()=>this.onStopSharingScreenCallback(),onBufferSizeError:this.sessionOptions.onBufferSizeError,onBufferSizeErrorCallback:()=>this.onBufferSizeErrorCallback()}):void 0,i=new qa({onFocusCallback:a=>this.onFocusAlertRecorderCallback(a),onLostFocusCallback:a=>this.onLostFocusAlertRecorderCallback(a),onRealtimeAlertCallback:a=>this.onRealtimeAlertsCallback(a)},t),o=new Tc(t,this.proctoringSession,this.paramsConfig,r,a=>this.onRealtimeAlertsCallback(a),this.backend,this.context.token),s=[r,o,i].filter(Boolean);return this.sessionOptions.proctoringType!="REALTIME"&&n&&s.push(n),this.recorder=new Ga(this.proctoringSession,s),{screenRecorder:n,alertRecorder:i,noiseRecorder:o,cameraRecorder:r}}async login(){if(!this.context.credentials?.cpf)throw i0;this.context.token=await this.auth.login()}async start(t=or,r={}){try{if(this.context.token===void 0)throw n0;this.extension=new Wa,this.extension.addEventListener();let n=this.backend.selectBaseUrl(this.context.type),i=await pr();await this.repositoryDevices.save({...i,id:"devices"}),this.sessionOptions={...or,...t},this.videoOptions=Oa(r),this.sessionOptions.proctoringType==="REALTIME"&&this.backend.setRealtime(!0),await this.initConfig(t.useGeolocation),this.sessionOptions.captureScreen&&await this.verifyMultipleMonitors(this.sessionOptions);try{t?.useSpyScan&&await this.spyCam.isAlive()}catch{throw o0}try{t?.useSafeBrowserAPI&&await this.safeBrowserBackendService.isAlive()}catch{throw Ed}if(this.state!="Stop")throw Qg;this.state="Starting",await this.repository.hasSessions()&&await this.repository.clear(),this.proctoringSession=new Hn,this.allRecorders=await this.createRecorders(this.sessionOptions);let o=await this.backend.confirmStart({clientId:this.context.clientId,examId:this.context.examId,token:this.context.token},this.sessionOptions,this.geolocation?this.geolocation.coords.latitude:void 0,this.geolocation?this.geolocation.coords.longitude:void 0);this.proctoringId=o.id,pe.registerDevicesChecked(this.proctoringId,!!this.deviceData,`Devices checked: ${JSON.stringify(this.deviceData)} | Devices List: ${JSON.stringify(i)}`);try{t?.useExternalCamera&&await this.appChecker.startTransmission(this.proctoringId)}catch{throw s0}this.allRecorders.cameraRecorder.setProctoringId(this.proctoringId),this.allRecorders.noiseRecorder.setProctoringId(this.proctoringId),this.proctoringSession.setProctoringId(this.proctoringId);try{t?.useSafeBrowserAPI&&await this.safeBrowserBackendService.setProctoringId(this.proctoringId)}catch{throw Ed}if(this.allRecorders.cameraRecorder.onVisibilityRestored=()=>{console.log("[Proctoring] Usu\xE1rio retornou ao browser."),this.onVisibilityRestoredCallback()},this.sessionOptions.proctoringType==="REALTIME"&&!Ua())try{await Wi.recoverPendingUploads(this.backend,this.context.token)}catch(l){console.warn("[Proctoring] Erro ao recuperar chunks de sess\xE3o anterior:",l)}try{console.log("Starting recorders"),await this.recorder.startAll()}catch(l){throw console.log("Starting recorders error:",l),l}t?.useSpyScan&&(this.spyCam.setProctoringId(this.proctoringId),this.spyCam.startCheckSpyCam(this.paramsConfig.spyScanInterval??5,{deviceType:3})),await this.repository.save(this.proctoringSession);let s={};for(let l in navigator)s[l]=navigator[l];pe.registerStart(this.proctoringId,!0,`Version: ${Wn()}
510
+ Navigator: ${JSON.stringify(s)}`),o.cameraStream=this.allRecorders.cameraRecorder.cameraStream,this.allRecorders.screenRecorder&&(o.screenStream=this.allRecorders.screenRecorder.screenStream),this.state="Recording";let a=0,c=!1;return this.verifyFirstFaceInterval=setInterval(async()=>{if(this.sessionOptions.proctoringType==="REALTIME"){if(c)return;c=!0,a++;try{var l=await this.backend.verifyFace(this.proctoringId,await this.allRecorders.cameraRecorder.getCurrentImageBase64(),!(a>2));c=!1,clearInterval(this.verifyFirstFaceInterval)}catch{c=!1;return}}},5e3),o}catch(n){throw console.log(n),await this.cancel(),this.proctoringId&&pe.registerStart(this.proctoringId,!1,`Token: ${this.context.token}
511
+ Version: ${Wn()}
514
512
  Navigator: ${navigator}
515
- Error: ${n}`),this.state=bt.Stop,n}}async cancel(){(this.state===bt.Recording||this.state===bt.Starting)&&(await this.recorder.stopAll(),this.spyCam&&await this.spyCam.stopCheckSpyCam()),this.state=bt.Stop}async finish(t={}){try{if(this.extension.options=t,this.state!==bt.Recording)throw Xa;await this.recorder.stopAll(),this.spyCam&&this.spyCam.stopCheckSpyCam(),this.appChecker&&await this.appChecker.disconnectWebSocket(),ie.registerError(this.proctoringId,"finish saveAllOnSession"),await this.recorder.saveAllOnSession(),ie.registerError(this.proctoringId,"finish sendPendingRealtimeAlerts"),await this.sendPendingRealtimeAlerts(),ie.registerError(this.proctoringId,"finish this.repository.save");let r,n;ie.registerError(this.proctoringId,"finish uploader"),Jn()!=="1.0.0.0"?(r=new es(this.proctoringSession,this.proctoringId,[new Qo(this.proctoringId)]),n="Download",this.serviceType=pi.Download):(r=new es(this.proctoringSession,this.proctoringId,[new kn(this.proctoringId,this.backend),new Qo(this.proctoringId)]),n="Upload",this.serviceType=pi.Upload);let i=!1;if(this.extension.hasExtension&&await this.extension.start().then(o=>{i=o}).catch(o=>{i=!1}),(!i||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async o=>{ie.registerUpload(this.proctoringSession.id,!1,`upload error: ${o}
513
+ Error: ${n}`),this.state="Stop",n}}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 Na;await this.recorder.stopAll(),this.spyCam&&this.spyCam.stopCheckSpyCam(),this.appChecker&&await this.appChecker.disconnectWebSocket(),await this.recorder.saveAllOnSession(),await this.sendPendingRealtimeAlerts(),await this.repository.save(this.proctoringSession);let r,n;Wn()!=="1.0.0.0"?(r=new qi(this.proctoringSession,this.proctoringId,[new Gi(this.proctoringId)]),n="Download",this.serviceType="Download"):(r=new qi(this.proctoringSession,this.proctoringId,[new Yr(this.proctoringId,this.backend),new Gi(this.proctoringId)]),n="Upload",this.serviceType="Upload");let i=!1;if(this.extension.hasExtension&&await this.extension.start().then(o=>{i=o}).catch(o=>{i=!1}),(!i||!this.extension.hasExtension)&&(await r.upload(this.context.token,t.onProgress).catch(async o=>{pe.registerUpload(this.proctoringSession.id,!1,`upload error: ${o}
516
514
 
517
- Upload Services: ${n}`,this.serviceType),Jn()!=="1.0.0.0"&&(r=new es(this.proctoringSession,this.proctoringId,[new kn(this.proctoringId,this.backend),new Qo(this.proctoringId)]),n="Upload",this.serviceType=pi.Upload,n="Download",this.serviceType=pi.Download,await r.upload(this.context.token,t.onProgress).catch(s=>{ie.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
515
+ Upload Services: ${n}`,this.serviceType),Wn()!=="1.0.0.0"&&(r=new qi(this.proctoringSession,this.proctoringId,[new Yr(this.proctoringId,this.backend),new Gi(this.proctoringId)]),n="Upload",this.serviceType="Upload",n="Download",this.serviceType="Download",await r.upload(this.context.token,t.onProgress).catch(s=>{pe.registerUpload(this.proctoringSession.id,!1,`upload backup error: ${s}
518
516
 
519
517
  Upload Services: ${n}
520
- Upload backup for Safe Browser`,this.serviceType)}))}),ie.registerUpload(this.proctoringSession.id,!0,`upload success
518
+ Upload backup for Safe Browser`,this.serviceType)}))}),pe.registerUpload(this.proctoringSession.id,!0,`upload success
521
519
 
522
- Upload Services: ${n}`,this.serviceType)),ie.registerError(this.proctoringId,"finish uploader success"),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(o=>{ie.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+o)}),ie.registerError(this.proctoringId,"finish saveAlerts ok"),await this.backend.finishAndSendUrls(this.context).then(o=>{ie.registerFinish(this.proctoringSession.id,!0,""),t.onResultAvailable&&t.onResultAvailable(o?.score??100,o?.scoreThreshold??70,o?.approved??!0,o?.justification??"")}).catch(o=>{ie.registerFinish(this.proctoringSession.id,!1,"finish error: "+o)}),ie.registerError(this.proctoringId,"finish call"),this.appChecker){let o=this.appChecker.getExternalCameraSessionId();o!="null"&&await this.backend.externalCameraFinish(o)}this.verifyFirstFaceInterval&&clearInterval(this.verifyFirstFaceInterval),this.state=bt.Stop}catch(r){throw await this.cancel(),ie.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
523
- Error: `+r),this.state=bt.Stop,r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await Ps())throw ie.registerError(this.proctoringId,"Multiplas telas detectadas!"),Ka}async verifyBrowser(){let t=await s0();if(t!=="chrome"&&t!=="firefox"&&!Er())throw ie.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
524
- Tentativa utilizando o browser ${t}`),p0}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 I2().then(n=>n).catch(n=>{throw n.message})),a0(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new Jo(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)})),this.sessionOptions?.useSafeBrowserAPI&&(this.safeBrowserBackendService=new wu)}catch(r){throw this.proctoringId&&ie.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{ie.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!==bt.Recording)throw ie.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),Xa;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state=bt.Paused}async resume(){if(this.state!=bt.Paused)throw Xa;return await this.verifyBrowser(),await this.verifyMultipleMonitors(this.sessionOptions),await this.recorder.startAll(),this.proctoringSession.recordings=[],await this.repository.save(this.proctoringSession),this.state=bt.Recording,{cameraStream:this.allRecorders.cameraRecorder.cameraStream,_screenStream:this.allRecorders.screenRecorder?.screenStream}}};var xs=class{constructor(t){this.backend=new Sr({type:t?.type||"prod",token:t.token,isRealtime:!1})}async signInTerms(){if(xs.isModalOpen)return Promise.reject();xs.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 n=document.createElement("div");n.setAttribute("id","signTermModal");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(n,i);let o=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,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),o.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(M=>{if(!M)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",M)}).catch(()=>{l.setAttribute("src",d)});let h={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,h),o.appendChild(l);let m=document.createElement("div"),f=document.createElement("input");f.setAttribute("type","checkbox"),f.setAttribute("id","termsCheckbox");let g=document.createElement("label");g.setAttribute("for","termsCheckbox"),g.innerText="Li e aceito os termos e condi\xE7\xF5es";let u={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(m,u),m.appendChild(f),m.appendChild(g),o.appendChild(m);let b=document.createElement("div"),v={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(b,v);let k=document.createElement("button");k.innerText="Cancelar";let S={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(k,S),k.addEventListener("click",()=>{this.closeModal(),t(!1)});let I=document.createElement("span"),x={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(I,x);let B=document.createElement("button");B.innerText="Continuar",B.setAttribute("id","confirmBtn");let P={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(B,P),B.disabled=!0,B.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),f.addEventListener("change",M=>{B.disabled=!M.target.checked,M.target.checked?(B.style.color="#007bff",B.style.cursor="pointer"):(B.style.color="rgba(0, 0, 0, .7)",B.style.cursor="not-allowed")}),b.appendChild(k),b.appendChild(I),b.appendChild(B),o.appendChild(b),n.appendChild(o),document.body.appendChild(n)})}async closeModal(){xs.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}},Yc=xs;Yc.isModalOpen=!1;function lp(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},n=new cp(r),i=new Ya(r),o=new Yc(r),s=new Zo,a=n.login.bind(n),c=n.start.bind(n),l=async(V,le)=>{let H=i.getDeviceCheckResult();return H&&n.setDeviceCheckData(H),c(V,le)},d=n.finish.bind(n),h=n.pause.bind(n),m=n.resume.bind(n),f=n.setOnFocusCallback.bind(n),g=n.setOnLostFocusCallback.bind(n),u=n.onChangeDevices.bind(n),b=n.setOnBufferSizeErrorCallback.bind(n),v=n.setOnStopSharingScreenCallback.bind(n),k=n.onRealtimeAlerts.bind(n),S=n.setOnVisibilityLostCallback.bind(n),I=n.setOnVisibilityRestoredCallback.bind(n),x=o.signInTerms.bind(o),B=i.checkDevices.bind(i),P=n.appChecker.checkExternalCamera.bind(n.appChecker),M=n.appChecker.startSession.bind(n.appChecker),J=n.appChecker.takePicture.bind(n.appChecker),E=n.appChecker.goToPositionGuide.bind(n.appChecker),U=n.appChecker.startTransmission.bind(n.appChecker),y=i.runCheckDevicesFlow.bind(i),L=i.changeSelectedDevice.bind(i),ce=s.takePicture.bind(s);return{login:a,start:l,finish:d,onFocus:f,onLostFocus:g,onChangeDevices:u,onBufferSizeError:b,onRealtimeAlerts:k,checkDevices:B,runCheckDevicesFlow:y,changeSelectedDevice:L,capturePhoto:ce,enumarateDevices:mr,checkPermissions:Rs,checkIfhasMultipleMonitors:Ps,onStopSharingScreen:v,signInTerms:x,checkExternalCamera:P,startExternalCameraSession:M,takeExternalCameraPicture:J,goToExternalCameraPositionStep:E,startExternalCameraTransmission:U,onVisibilityLost:S,onVisibilityRestored:I}}typeof window!="undefined"&&(window.useProctoring=lp);})();
525
- /*!
520
+ Upload Services: ${n}`,this.serviceType)),this.proctoringSession.alerts.length>0&&await this.backend.saveAlerts(this.context,this.proctoringSession).catch(o=>{pe.registerFinish(this.proctoringSession.id,!1,"save-screen error: "+o)}),await this.backend.finishAndSendUrls(this.context).then(o=>{pe.registerFinish(this.proctoringSession.id,!0,""),t.onResultAvailable&&t.onResultAvailable(o?.score??100,o?.scoreThreshold??70,o?.approved??!0,o?.justification??"")}).catch(o=>{pe.registerFinish(this.proctoringSession.id,!1,"finish error: "+o)}),this.appChecker){let o=this.appChecker.getExternalCameraSessionId();o!="null"&&await this.backend.externalCameraFinish(o)}this.verifyFirstFaceInterval&&clearInterval(this.verifyFirstFaceInterval),this.state="Stop"}catch(r){throw await this.cancel(),pe.registerFinish(this.proctoringId,!1,`Token: ${this.context.token}
521
+ Error: `+r),this.state="Stop",r}}async verifyMultipleMonitors(t){if(!t.allowMultipleMonitors&&await ws())throw pe.registerError(this.proctoringId,"Multiplas telas detectadas!"),Ma}async verifyBrowser(){let t=await Xg();if(t!=="chrome"&&t!=="firefox"&&!_r())throw pe.registerBrowserNotSupported(this.proctoringId,`Browser n\xE3o suportado:
522
+ Tentativa utilizando o browser ${t}`),r0}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 b2().then(n=>n).catch(n=>{throw n.message})),Jg(this.backend),this.sessionOptions?.useSpyScan&&(this.spyCam=new Vi(this.context,{onRealtimeAlertsCallback:n=>this.onRealtimeAlertsCallback(n)})),this.sessionOptions?.useSafeBrowserAPI&&(this.safeBrowserBackendService=new Pc)}catch(r){throw this.proctoringId&&pe.registerError(this.proctoringId,"Erro no initConfig!"),await this.cancel(),r}}async getServerDate(){let t=await this.backend.getServerHour(this.context.token).catch(n=>{pe.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 pe.registerError(this.proctoringId,"Proctoring n\xE3o iniciado!"),Na;await this.recorder.stopAll(),await this.recorder.saveAllOnSession(),await this.repository.save(this.proctoringSession),this.state="Paused"}async resume(){if(this.state!="Paused")throw Na;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 dl=class e{static{this.isModalOpen=!1}constructor(t){this.backend=new ir({type:t?.type||"prod",token:t.token,isRealtime:!1})}async signInTerms(){if(e.isModalOpen)return Promise.reject();e.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 n=document.createElement("div");n.setAttribute("id","signTermModal");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(n,i);let o=document.createElement("div"),s={backgroundColor:"#fff",zIndex:"1001",width:"850px",maxHeight:"95%",borderRadius:"10px",display:"flex",flexDirection:"column",alignItems:"center"};this.applyStyles(o,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),o.appendChild(a);let l=document.createElement("iframe"),h="https://docs.google.com/document/u/3/d/e/2PACX-1vRMgrLhDLyDP8BHmotfPDpwAFaDHqK-mA4eBJ0Cy1mDdvHcWLsx47H4otII_4qi4rhtSf6B0OO97e9c/pub";this.backend.signTermUrl().then(M=>{if(!M)throw new Error("N\xE3o foi poss\xEDvel obter o termo de consentimento");l.setAttribute("src",M)}).catch(()=>{l.setAttribute("src",h)});let d={width:"100%",height:"500px",border:"1px solid rgba(0, 0, 0, .1)",margin:"20px",borderRadius:"5px"};this.applyStyles(l,d),o.appendChild(l);let g=document.createElement("div"),f=document.createElement("input");f.setAttribute("type","checkbox"),f.setAttribute("id","termsCheckbox");let m=document.createElement("label");m.setAttribute("for","termsCheckbox"),m.innerText="Li e aceito os termos e condi\xE7\xF5es";let u={display:"flex",alignItems:"center",gap:"10px",margin:"20px",width:"100%",paddingLeft:"20px"};this.applyStyles(g,u),g.appendChild(f),g.appendChild(m),o.appendChild(g);let b=document.createElement("div"),_={width:"100%",display:"flex",alignItems:"center",justifyContent:"center",borderTop:"2px solid rgba(0, 0, 0, .1)"};this.applyStyles(b,_);let k=document.createElement("button");k.innerText="Cancelar";let S={width:"100%",height:"70px",backgroundColor:"#FFF",border:"none",color:"rgba(0, 0, 0, .7)",fontWeight:"bold",borderRadius:"10px",paddingTop:"5px",paddingBottom:"5px"};this.applyStyles(k,S),k.addEventListener("click",()=>{this.closeModal(),t(!1)});let I=document.createElement("span"),x={width:"3px",height:"70px",margin:"0px 2px",background:"rgba(0, 0, 0, .1)"};this.applyStyles(I,x);let D=document.createElement("button");D.innerText="Continuar",D.setAttribute("id","confirmBtn");let P={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(D,P),D.disabled=!0,D.addEventListener("click",()=>{this.closeModal(),this.backend.signTerm().then(()=>{t(!0)})}),f.addEventListener("change",M=>{D.disabled=!M.target.checked,M.target.checked?(D.style.color="#007bff",D.style.cursor="pointer"):(D.style.color="rgba(0, 0, 0, .7)",D.style.cursor="not-allowed")}),b.appendChild(k),b.appendChild(I),b.appendChild(D),o.appendChild(b),n.appendChild(o),document.body.appendChild(n)})}async closeModal(){e.isModalOpen=!1,document.querySelector("#signTermModal")?.remove()}applyStyles(t,r){for(let[n,i]of Object.entries(r))t.style[n]=i}};function tp(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},n=new hl(r),i=new Ha(r),o=new dl(r),s=new $i,a=n.login.bind(n),c=n.start.bind(n),l=async(V,ce)=>{let H=i.getDeviceCheckResult();return H&&n.setDeviceCheckData(H),c(V,ce)},h=n.finish.bind(n),d=n.pause.bind(n),g=n.resume.bind(n),f=n.setOnFocusCallback.bind(n),m=n.setOnLostFocusCallback.bind(n),u=n.onChangeDevices.bind(n),b=n.setOnBufferSizeErrorCallback.bind(n),_=n.setOnStopSharingScreenCallback.bind(n),k=n.onRealtimeAlerts.bind(n),S=n.setOnVisibilityLostCallback.bind(n),I=n.setOnVisibilityRestoredCallback.bind(n),x=o.signInTerms.bind(o),D=i.checkDevices.bind(i),P=n.appChecker.checkExternalCamera.bind(n.appChecker),M=n.appChecker.startSession.bind(n.appChecker),J=n.appChecker.takePicture.bind(n.appChecker),E=n.appChecker.goToPositionGuide.bind(n.appChecker),U=n.appChecker.startTransmission.bind(n.appChecker),y=i.runCheckDevicesFlow.bind(i),F=i.changeSelectedDevice.bind(i),ae=s.takePicture.bind(s);return{login:a,start:l,finish:h,onFocus:f,onLostFocus:m,onChangeDevices:u,onBufferSizeError:b,onRealtimeAlerts:k,checkDevices:D,runCheckDevicesFlow:y,changeSelectedDevice:F,capturePhoto:ae,enumarateDevices:pr,checkPermissions:_s,checkIfhasMultipleMonitors:ws,onStopSharingScreen:_,signInTerms:x,checkExternalCamera:P,startExternalCameraSession:M,takeExternalCameraPicture:J,goToExternalCameraPositionStep:E,startExternalCameraTransmission:U,onVisibilityLost:S,onVisibilityRestored:I}}typeof window<"u"&&(window.useProctoring=tp);})();
523
+ /*! Bundled license information:
526
524
 
527
- JSZip v3.10.1 - A JavaScript class for generating and reading zip files
528
- <http://stuartk.com/jszip>
529
-
530
- (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
531
- Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
532
-
533
- JSZip uses the library pako released under the MIT license :
534
- https://github.com/nodeca/pako/blob/main/LICENSE
525
+ jszip/dist/jszip.min.js:
526
+ (*!
527
+
528
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
529
+ <http://stuartk.com/jszip>
530
+
531
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
532
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
533
+
534
+ JSZip uses the library pako released under the MIT license :
535
+ https://github.com/nodeca/pako/blob/main/LICENSE
536
+ *)
535
537
  */
536
- //# sourceMappingURL=easyproctor.min.js.map