UNPKG

v3d-web-realbits

Version:

Single camera motion-tracking in browser

149 lines (135 loc) 14.9 MB
/******/ var __webpack_modules__ = ({ /***/ "./node_modules/@mediapipe/control_utils/control_utils.js": /*!****************************************************************!*\ !*** ./node_modules/@mediapipe/control_utils/control_utils.js ***! \****************************************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (function(){/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ 'use strict';function q(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var t="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a}; function aa(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof __webpack_require__.g&&__webpack_require__.g];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var u=aa(this);function v(a,b){if(b)a:{var c=u;a=a.split(".");for(var d=0;d<a.length-1;d++){var f=a[d];if(!(f in c))break a;c=c[f]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&t(c,a,{configurable:!0,writable:!0,value:b})}} v("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+f++,g)}function c(g,e){this.g=g;t(this,"description",{configurable:!0,writable:!0,value:e})}if(a)return a;c.prototype.toString=function(){return this.g};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",f=0;return b}); v("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=u[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&t(d.prototype,a,{configurable:!0,writable:!0,value:function(){return ba(q(this))}})}return a});function ba(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} function w(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:q(a)}}function x(a){if(!(a instanceof Array)){a=w(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a}var ca="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var f in d)Object.prototype.hasOwnProperty.call(d,f)&&(a[f]=d[f])}return a};v("Object.assign",function(a){return a||ca}); function y(){this.l=!1;this.h=null;this.i=void 0;this.g=1;this.u=this.m=0;this.j=null}function B(a){if(a.l)throw new TypeError("Generator is already running");a.l=!0}y.prototype.o=function(a){this.i=a};function C(a,b){a.j={K:b,L:!0};a.g=a.m||a.u}y.prototype.return=function(a){this.j={return:a};this.g=this.u};function D(a,b,c){a.g=c;return{value:b}}function da(a){a.g=3;a.m=0}function ea(a){a.m=0;a.j=null}function fa(a){this.g=new y;this.h=a} function ha(a,b){B(a.g);var c=a.g.h;if(c)return E(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.g.return);a.g.return(b);return F(a)}function E(a,b,c,d){try{var f=b.call(a.g.h,c);if(!(f instanceof Object))throw new TypeError("Iterator result "+f+" is not an object");if(!f.done)return a.g.l=!1,f;var g=f.value}catch(e){return a.g.h=null,C(a.g,e),F(a)}a.g.h=null;d.call(a.g,g);return F(a)} function F(a){for(;a.g.g;)try{var b=a.h(a.g);if(b)return a.g.l=!1,{value:b.value,done:!1}}catch(c){a.g.i=void 0,C(a.g,c)}a.g.l=!1;if(a.g.j){b=a.g.j;a.g.j=null;if(b.L)throw b.K;return{value:b.return,done:!0}}return{value:void 0,done:!0}} function ia(a){this.next=function(b){B(a.g);a.g.h?b=E(a,a.g.h.next,b,a.g.o):(a.g.o(b),b=F(a));return b};this.throw=function(b){B(a.g);a.g.h?b=E(a,a.g.h["throw"],b,a.g.o):(C(a.g,b),b=F(a));return b};this.return=function(b){return ha(a,b)};this[Symbol.iterator]=function(){return this}}function ja(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,f){function g(e){e.done?d(e.value):Promise.resolve(e.value).then(b,c).then(g,f)}g(a.next())})} function G(a){return ja(new ia(new fa(a)))} v("Promise",function(a){function b(e){this.h=0;this.i=void 0;this.g=[];this.o=!1;var h=this.j();try{e(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.g=null}function d(e){return e instanceof b?e:new b(function(h){h(e)})}if(a)return a;c.prototype.h=function(e){if(null==this.g){this.g=[];var h=this;this.i(function(){h.l()})}this.g.push(e)};var f=u.setTimeout;c.prototype.i=function(e){f(e,0)};c.prototype.l=function(){for(;this.g&&this.g.length;){var e=this.g;this.g=[];for(var h=0;h<e.length;++h){var k= e[h];e[h]=null;try{k()}catch(m){this.j(m)}}}this.g=null};c.prototype.j=function(e){this.i(function(){throw e;})};b.prototype.j=function(){function e(m){return function(l){k||(k=!0,m.call(h,l))}}var h=this,k=!1;return{resolve:e(this.F),reject:e(this.l)}};b.prototype.F=function(e){if(e===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(e instanceof b)this.H(e);else{a:switch(typeof e){case "object":var h=null!=e;break a;case "function":h=!0;break a;default:h=!1}h?this.D(e):this.m(e)}}; b.prototype.D=function(e){var h=void 0;try{h=e.then}catch(k){this.l(k);return}"function"==typeof h?this.I(h,e):this.m(e)};b.prototype.l=function(e){this.u(2,e)};b.prototype.m=function(e){this.u(1,e)};b.prototype.u=function(e,h){if(0!=this.h)throw Error("Cannot settle("+e+", "+h+"): Promise already settled in state"+this.h);this.h=e;this.i=h;2===this.h&&this.G();this.C()};b.prototype.G=function(){var e=this;f(function(){if(e.N()){var h=u.console;"undefined"!==typeof h&&h.error(e.i)}},1)};b.prototype.N= function(){if(this.o)return!1;var e=u.CustomEvent,h=u.Event,k=u.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof e?e=new e("unhandledrejection",{cancelable:!0}):"function"===typeof h?e=new h("unhandledrejection",{cancelable:!0}):(e=u.document.createEvent("CustomEvent"),e.initCustomEvent("unhandledrejection",!1,!0,e));e.promise=this;e.reason=this.i;return k(e)};b.prototype.C=function(){if(null!=this.g){for(var e=0;e<this.g.length;++e)g.h(this.g[e]);this.g=null}};var g=new c;b.prototype.H= function(e){var h=this.j();e.v(h.resolve,h.reject)};b.prototype.I=function(e,h){var k=this.j();try{e.call(h,k.resolve,k.reject)}catch(m){k.reject(m)}};b.prototype.then=function(e,h){function k(n,p){return"function"==typeof n?function(A){try{m(n(A))}catch(z){l(z)}}:p}var m,l,r=new b(function(n,p){m=n;l=p});this.v(k(e,m),k(h,l));return r};b.prototype.catch=function(e){return this.then(void 0,e)};b.prototype.v=function(e,h){function k(){switch(m.h){case 1:e(m.i);break;case 2:h(m.i);break;default:throw Error("Unexpected state: "+ m.h);}}var m=this;null==this.g?g.h(k):this.g.push(k);this.o=!0};b.resolve=d;b.reject=function(e){return new b(function(h,k){k(e)})};b.race=function(e){return new b(function(h,k){for(var m=w(e),l=m.next();!l.done;l=m.next())d(l.value).v(h,k)})};b.all=function(e){var h=w(e),k=h.next();return k.done?d([]):new b(function(m,l){function r(A){return function(z){n[A]=z;p--;0==p&&m(n)}}var n=[],p=0;do n.push(void 0),p++,d(k.value).v(r(n.length-1),l),k=h.next();while(!k.done)})};return b}); v("Array.prototype.find",function(a){return a?a:function(b,c){a:{var d=this;d instanceof String&&(d=String(d));for(var f=d.length,g=0;g<f;g++){var e=d[g];if(b.call(c,e,g,d)){b=e;break a}}b=void 0}return b}});function ka(a,b){a instanceof String&&(a+="");var c=0,d=!1,f={next:function(){if(!d&&c<a.length){var g=c++;return{value:b(g,a[g]),done:!1}}d=!0;return{done:!0,value:void 0}}};f[Symbol.iterator]=function(){return f};return f} v("Array.prototype.keys",function(a){return a?a:function(){return ka(this,function(b){return b})}});v("Array.from",function(a){return a?a:function(b,c,d){c=null!=c?c:function(h){return h};var f=[],g="undefined"!=typeof Symbol&&Symbol.iterator&&b[Symbol.iterator];if("function"==typeof g){b=g.call(b);for(var e=0;!(g=b.next()).done;)f.push(c.call(d,g.value,e++))}else for(g=b.length,e=0;e<g;e++)f.push(c.call(d,b[e],e));return f}}); v("Array.prototype.fill",function(a){return a?a:function(b,c,d){var f=this.length||0;0>c&&(c=Math.max(0,f+c));if(null==d||d>f)d=f;d=Number(d);0>d&&(d=Math.max(0,f+d));for(c=Number(c||0);c<d;c++)this[c]=b;return this}});function H(a){return a?a:Array.prototype.fill}v("Int8Array.prototype.fill",H);v("Uint8Array.prototype.fill",H);v("Uint8ClampedArray.prototype.fill",H);v("Int16Array.prototype.fill",H);v("Uint16Array.prototype.fill",H);v("Int32Array.prototype.fill",H); v("Uint32Array.prototype.fill",H);v("Float32Array.prototype.fill",H);v("Float64Array.prototype.fill",H);v("Object.values",function(a){return a?a:function(b){var c=[],d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&c.push(b[d]);return c}});var la=this||self;function I(a,b){a=a.split(".");var c=la;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};function J(a){this.g=ma===ma?a:""}J.prototype.toString=function(){return this.g.toString()};var ma={};function K(a,b,c){a=document.createElement(a);b&&a.classList.add(b);if(c)for(b=w(c),c=b.next();!c.done;c=b.next())a.appendChild(c.value);return a}function L(a,b){return K("div",a,b)}function M(a,b){return K("span",a,b)}function N(a){var b=K("img","");b.src=a||"";return b};function na(a,b){var c=this;this.config=a;this.h={};var d,f=L("dropdown-wrapper",[d=L("dropdown",[L("dropdown-trigger",[this.g=M(),L("arrow")]),this.options=L("dropdown-options")])]);f.onclick=function(){a.B&&a.B();d.classList.toggle("open");d.g=function(){a.A&&a.A()}};for(var g={},e=w(a.options),h=e.next();!h.done;g={s:g.s},h=e.next())g.s=h.value,h=void 0,this.options.appendChild(h=M("dropdown-option")),this.h[g.s.value]=h,h.textContent=g.s.name,g.s.prefix&&h.prepend(g.s.prefix),h.setAttribute("data-value", g.s.value),h.onclick=function(k){return function(){O(c,k.s.value)}}(g);window.addEventListener("click",function(k){d.contains(k.target)||d.classList.remove("open")});b.appendChild(f)} function O(a,b){for(var c=w(a.config.options),d=c.next();!d.done;d=c.next()){d=d.value;var f=a.h[d.value];if(d.value===b&&!f.classList.contains("selected"))return(b=a.options.querySelector(".selected"))&&b.classList.remove("selected"),f.classList.add("selected"),a.g.textContent=f.textContent,a.config.onclick(d),!0}return!1}function P(a,b){var c=a.options.querySelector(".selected");c&&(c.classList.remove("selected"),a.g.textContent=void 0===b?"":b)};function Q(a){this.config=a} Q.prototype.create=function(a,b,c){var d=this,f=c.appendChild(document.createElement("div"));f.classList.add("control-panel-entry");f.classList.add("control-panel-slider");c=f.appendChild(document.createElement("span"));c.classList.add("label");c.textContent=this.config.title;c=new na({options:this.config.options.map(function(g){return Object.assign({},g,{data:null})}),B:function(){f.style.zIndex="1000"},onclick:function(g){b[d.config.field]=g.value;a();if(d.config.onselectionchanged)d.config.onselectionchanged(g)},A:function(){f.style.zIndex= "100"}},f);0<this.config.options.length&&O(c,b[this.config.field]||this.config.options[0].value)};Q.prototype.update=function(){};function R(){this.i=this.counter=0;this.g=Array.from({length:10}).fill(0)} R.prototype.create=function(a,b,c){b=c.appendChild(document.createElement("div"));b.classList.add("control-panel-entry");b.classList.add("control-panel-fps");a=b.appendChild(document.createElement("canvas"));this.h=b.appendChild(document.createElement("div"));this.h.classList.add("fps-text");c=b.appendChild(document.createElement("div"));c.classList.add("fps-30");c.textContent="30";b=b.appendChild(document.createElement("div"));b.classList.add("fps-60");b.textContent="60";a.width=100;a.height=100; this.j=a.getContext("2d");oa(this,0)};R.prototype.update=function(){};R.prototype.tick=function(){var a=Math.floor(performance.now()/1E3);1<=a-this.i&&(oa(this,this.counter),this.i=a,this.counter=0);++this.counter}; function oa(a,b){a.g.shift();a.g.push(b);var c=a.j;c.fillStyle="#309f93";c.clearRect(0,0,c.canvas.width,c.canvas.height);for(var d=0;10>d;++d){var f=Math.min(100,Math.max(0,a.g[d]));c.fillRect(10*d+1,100-f+1,8,f)}c.setLineDash([2,2]);c.strokeStyle="#a0a0a0a0";c.lineWidth=2;c.beginPath();c.moveTo(0,30);c.lineTo(100,30);c.stroke();c.beginPath();c.moveTo(0,60);c.lineTo(100,60);c.stroke();a.h.textContent=b.toFixed(0)+" fps"};function S(a){this.config=a} S.prototype.create=function(a,b,c){var d=this;this.options=b;b=this.config;c=c.appendChild(document.createElement("div"));c.classList.add("control-panel-entry");c.classList.add("control-panel-slider");var f=c.appendChild(document.createElement("span"));f.classList.add("label");(this.g=c.appendChild(document.createElement("span"))).classList.add("callout");var g=this.h=c.appendChild(document.createElement("input"));g.classList.add("value");g.type="range";b.range?(g.min=""+b.range[0],g.max=""+b.range[1], g.step=void 0===b.step?"any":""+b.step):b.discrete&&(g.min="0",g.max=""+(Object.keys(b.discrete).length-1),g.step="1");g.oninput=function(){pa(d,Number(g.value))};g.onchange=function(){var e=Number(g.value);d.config.discrete&&(e=Object.keys(d.config.discrete)[e],Array.isArray(d.config.discrete)&&(e=Number(e)));d.options[d.config.field]=e;a()};f.textContent=b.title}; S.prototype.update=function(){var a=this.options[this.config.field];a=this.config.discrete&&!Array.isArray(this.config.discrete)?Object.keys(this.config.discrete).indexOf(a):a;this.h.value=""+a;pa(this,a)};function pa(a,b){b=a.config.discrete?Object.values(a.config.discrete)[b]:b;a.g.textContent=""+b};/* SPDX-License-Identifier: Apache-2.0 */ var qa={facingMode:"user",width:640,height:480},ra={allowVideo:!0,allowImage:!0,examples:{videos:[],images:[]}};function T(a){return"https://fonts.gstatic.com/s/i/googlematerialicons/"+a+"/v8/white-24dp/1x/gm_"+a+"_white_24dp.png"} function sa(a,b){var c=a.getVideoTracks()[0],d=c.getSettings().width,f=c.getSettings().height,g=d/f;if(1E-6>Math.abs(g-b))return a;if(g>b){var e=f;var h=2*Math.floor(f*b/2)}else h=d,e=2*Math.floor(d/b/2);a=new MediaStreamTrackProcessor({track:c});b=new MediaStreamTrackGenerator({kind:"video"});c=new TransformStream({transform:function(k,m){var l,r,n,p;return G(function(A){l=2*Math.floor((d-h)/4);r=2*Math.floor((f-e)/4);n={x:l,y:r,width:h,height:e};p=new VideoFrame(k,{visibleRect:n});k.close();m.enqueue(p); A.g=0})}});a.readable.pipeThrough(c).pipeTo(b.writable);return new MediaStream([b])}function U(a){this.j=[];this.u=0;this.l=!1;this.aspectRatio=0;this.config=Object.assign({},ra,a);this.config.cameraOptions=Object.assign({},qa,a.cameraOptions||{})} function ta(){var a,b,c,d,f,g;return G(function(e){switch(e.g){case 1:return D(e,navigator.mediaDevices.enumerateDevices(),2);case 2:a=e.i;b=a.filter(function(h){return"videoinput"===h.kind&&h.label});if(b.length){e.g=3;break}e.m=4;return D(e,navigator.mediaDevices.getUserMedia({video:!0}),6);case 6:c=e.i;d=w(c.getTracks());for(f=d.next();!f.done;f=d.next())g=f.value,g.stop();da(e);break;case 4:return ea(e),e.return(!1);case 3:return e.return(!0)}})} function ua(){var a,b,c,d,f,g;return G(function(e){switch(e.g){case 1:return a=[],D(e,ta(),2);case 2:b=e.i;if(!b){e.g=3;break}return D(e,navigator.mediaDevices.enumerateDevices(),4);case 4:for(c=e.i,d=w(c),f=d.next();!f.done;f=d.next())g=f.value,""!==g.label&&"videoinput"===g.kind&&a.push({label:g.label,deviceId:g.deviceId});case 3:return e.return(a)}})}function V(a){window.requestAnimationFrame(function(){a.tick()})} U.prototype.tick=function(){var a=this,b=null;this.l&&(this.video.paused||this.video.currentTime===this.u||(this.i||(va(this,this.video.currentTime/this.video.duration),this.h.time.textContent=wa(this.video.currentTime)),this.u=this.video.currentTime,b=this.config.onFrame?this.config.onFrame(this.video,{width:this.video.videoWidth,height:this.video.videoHeight}):null),b?b.then(function(){V(a)}):V(this))};U.prototype.setVideoCameraAspectRatio=function(a){this.aspectRatio=a;this.i&&xa(this,this.i)}; function xa(a,b){function c(){a.video.play();a.l=!0;V(a);a.video.removeEventListener("loadedmetadata",c)}b=0!==a.aspectRatio?sa(b,a.aspectRatio):b;a.i=b;a.video.srcObject=b;a.video.addEventListener("loadedmetadata",c)}function ya(a){var b,c,d,f;return G(function(g){a.h.parent.style.display="none";a.l=!1;if(a.i){b=a.i.getTracks();c=w(b);for(d=c.next();!d.done;d=c.next())f=d.value,f.stop();a.i=void 0}g.g=0})} function za(a){var b,c,d,f,g,e,h,k,m;return G(function(l){if(1==l.g)return D(l,ua(),2);b=l.i.map(function(r){return{label:r.label,type:"webcam",O:r,start:function(){return Aa(a,r)}}});f=null==(c=a.config.examples)?void 0:null==(d=c.videos)?void 0:d.map(function(r){return{label:r.name,type:"video",video:a.video,start:function(){Ba(a,r.src)}}});h=null==(g=a.config.examples)?void 0:null==(e=g.images)?void 0:e.map(function(r){return{label:r.name,type:"image",image:a.g,start:function(){Ca(a,r.src)}}}); return l.return([].concat(x(b),x(null!=(k=f)?k:[]),x(null!=(m=h)?m:[])))})}function Da(a,b){var c,d;return G(function(f){return 1==f.g?D(f,null==(d=(c=a.config).M)?void 0:d.call(c),2):3!=f.g?D(f,ya(a),3):D(f,b.start(),0)})}function Ea(a,b){var c,d,f,g,e;return G(function(h){return 1==h.g?D(h,null==(d=(c=a.config).onFrame)?void 0:d.call(c,b,{width:b.naturalWidth,height:b.naturalHeight}),2):h.return(null==(f=a.config)?void 0:null==(e=(g=f).onSourceChanged)?void 0:e.call(g,b.src,"image"))})} function Fa(a){var b,c,d;return G(function(f){if(1==f.g)return a.h.parent.style.display="flex",va(a,0),D(f,a.video.play(),2);a.C();a.l=!0;V(a);return f.return(null==(b=a.config)?void 0:null==(d=(c=b).onSourceChanged)?void 0:d.call(c,a.video.src,"video"))})} function Aa(a,b){var c,d,f,g,e;return G(function(h){return 1==h.g?(d={video:Object.assign({},{deviceId:b.deviceId},null!=(c=a.config.cameraOptions)?c:{})},D(h,null==(f=a.config)?void 0:null==(e=(g=f).M)?void 0:e.call(g),2)):3!=h.g?D(h,ya(a),3):h.return(navigator.mediaDevices.getUserMedia(d).then(function(k){xa(a,k);var m,l;return null==(m=a.config)?void 0:null==(l=m.onSourceChanged)?void 0:l.call(m,b.deviceId,"webcam")}).catch(function(k){console.error("Failed to acquire camera feed: "+k);alert("Failed to acquire camera feed: "+ k);throw k;}))})} function Ga(a,b){a.m=new na({options:a.j.map(function(c){var d=void 0;"image"===c.type?d=N("https://fonts.gstatic.com/s/i/googlematerialicons/image/v12/gm_grey-24dp/1x/gm_image_gm_grey_24dp.png"):"video"===c.type&&(d=N("https://fonts.gstatic.com/s/i/googlematerialicons/videocam/v12/gm_grey-24dp/1x/gm_videocam_gm_grey_24dp.png"));return{name:c.label,value:c.label,data:c,prefix:d}}),onclick:function(c){a.h.parent.style.display="none";c=c.data;c.start();window.localStorage.setItem("SOURCE_PICKER_LAST_SOURCE",c.label)}, B:function(){a.o.style.zIndex="2000"},A:function(){a.o.style.zIndex="100"}},b)} function Ha(a,b){var c=b.appendChild(document.createElement("input"));c.type="file";c.style.display="none";b.appendChild(M("file-selection",[b=L("",[N(T("file_upload"))])]));b.onclick=function(){c.click()};c.onchange=function(){var d,f,g,e,h,k;return G(function(m){d=c.files;if(null==(f=d)?0:f.length){g=d[0];e=g.type.toLowerCase();h=e.substring(0,e.indexOf("/"));var l;(l="undefined"!==typeof MediaSource&&g instanceof MediaSource)||(l=g.type.match(/^([^;]+)(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i),l=2===(null== l?void 0:l.length)&&(/^image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon|heic|heif)$/i.test(l[1])||/^video\/(?:mpeg|mp4|ogg|webm|x-matroska|quicktime|x-ms-wmv)$/i.test(l[1])||/^audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)$/i.test(l[1])));if(!l)throw Error("");l=new J(URL.createObjectURL(g));k=l.toString();"image"===h?(P(a.m,g.name),Ca(a,k)):"video"===h&&(P(a.m,g.name),Ba(a,k))}m.g=0})}} function Ca(a,b){a.g.onload=function(){return G(function(c){a.config.onFrame?c=D(c,Da(a,{label:"file",type:"image",image:a.g,start:function(){return G(function(d){return D(d,Ea(a,a.g),0)})}}),0):(c.g=0,c=void 0);return c})};a.g.src=b} function Ba(a,b){function c(){return G(function(d){if(1==d.g)return a.video.loop=!0,a.config?d=D(d,Da(a,{label:"file",type:"video",video:a.video,start:function(){return Fa(a)}}),2):(d.g=2,d=void 0),d;a.video.removeEventListener("loadedmetadata",c);d.g=0})}a.video.addEventListener("loadedmetadata",c);a.video.srcObject=null;a.video.src=b}function Ia(a,b){O(a.m,b.label)||P(a.m)} function Ja(a){var b=window.localStorage.getItem("SOURCE_PICKER_LAST_SOURCE"),c=a.j.find(function(d){return d.label===b});c?Ia(a,c):0<a.j.length&&Ia(a,a.j[0])} U.prototype.create=function(a,b,c){var d=this,f=this.o=c.appendChild(document.createElement("div"));f.classList.add("control-panel-entry");f.classList.add("control-panel-source-picker");var g=L("source-selection");f.append(g);za(this).then(function(e){d.j=e;Ga(d,g);Ha(d,g);e=g.appendChild(document.createElement("div"));e.classList.add("inputs");d.video=e.appendChild(document.createElement("video"));d.video.setAttribute("crossorigin","anonymous");d.video.setAttribute("playsinline","true");d.g=e.appendChild(document.createElement("img")); d.g.setAttribute("crossorigin","anonymous");var h,k;null==(k=(h=d.config).onVideoElementCreated)||k.call(h,d.video);Ka(d,f);Ja(d)})}; function Ka(a,b){var c=T("pause"),d=T("play_arrow"),f,g,e,h;b.append(e=L("video-controls",[h=N(c),g=L("video-track"),f=L("video-slider-ball"),b=M("video-time")]));a.h={parent:e,J:f,track:g,time:b};b.textContent="00:00";f.style.display="inline-block";f.onmousedown=function(k){function m(){k.preventDefault();document.removeEventListener("mousemove",l);r||a.video.play();document.removeEventListener("mouseup",m)}function l(n){k.preventDefault();var p=e.getBoundingClientRect(),A=f.getBoundingClientRect(), z=g.getBoundingClientRect();n=n.clientX-p.left-A.width/2;p=z.left-p.left;n<p?n=p:n>p+z.width&&(n=p+z.width);f.style.left=n+"px";a.video.currentTime=(n-p)/z.width*a.video.duration}k.preventDefault();var r=a.video.paused;a.video.pause();document.addEventListener("mousemove",l);document.addEventListener("mouseup",m)};h.onclick=function(){a.video.paused?(a.video.play(),h.src=c):(a.video.pause(),h.src=d)};a.C=function(){a.video.paused&&(h.src=d);h.src=c}} function va(a,b){var c=a.h.J,d=a.h.track.getBoundingClientRect();a=a.h.parent.getBoundingClientRect();c.style.left=d.left-a.left+d.width*b+"px"}function wa(a){var b=Math.floor(a%60).toString();b=1===b.length?"0"+b:b;a=Math.floor(a/60).toString();a=1===a.length?"0"+a:a;return a+":"+b}U.prototype.update=function(){if(this.g&&!this.l&&this.config.onFrame)this.config.onFrame(this.g,{width:this.g.naturalWidth,height:this.g.naturalHeight})};function W(a){this.config=a}W.prototype.create=function(a,b,c){a=c.appendChild(document.createElement("div"));a.classList.add("control-panel-entry");a.classList.add("control-panel-text");a.textContent=this.config.title};W.prototype.update=function(){};function X(a){this.config=a} X.prototype.create=function(a,b,c){var d=this;this.h=a;this.options=b;this.g=c.appendChild(document.createElement("div"));this.g.classList.add("control-panel-entry");this.g.classList.add("control-panel-toggle");this.g.onclick=function(){d.options[d.config.field]=!d.options[d.config.field];d.h()};a=this.g.appendChild(document.createElement("span"));a.classList.add("label");this.value=this.g.appendChild(document.createElement("span"));this.value.classList.add("value");a.textContent=this.config.title}; X.prototype.update=function(){this.options[this.config.field]?(this.value.textContent="Yes",this.g.classList.add("yes"),this.g.classList.remove("no")):(this.value.textContent="No",this.g.classList.add("no"),this.g.classList.remove("yes"))};function Y(a,b){var c=this;this.parent=a;this.options=b;this.i=[];this.h=!0;a=[L("hamburger-menu"),L("hamburger-menu"),L("hamburger-menu")];var d=L("control-panel-shell",[this.g=L("control-panel"),this.l=L("control-panel-expander",a)]);this.l.onclick=function(){c.h=!c.h;d.style.left=c.h?"0px":"-"+(d.offsetLeft+c.g.offsetLeft+c.g.offsetWidth-15)+"px";d.classList.toggle("control-panel-expanded")};this.parent.appendChild(d)} Y.prototype.add=function(a){var b=this;a=w(a);for(var c=a.next();!c.done;c=a.next())c=c.value,this.i.push(c),c.create(function(){Z(b)},this.options,this.g);Z(this);return this};Y.prototype.on=function(a){this.j=a;Z(this);return this};function Z(a){for(var b=w(a.i),c=b.next();!c.done;c=b.next())c.value.update();a.j&&a.j(a.options)}I("ControlPanel",Y);I("Slider",S);I("StaticText",W);I("Toggle",X);I("SourcePicker",U);I("FPS",R);I("DropDownControl",Q);}).call(this); /***/ }), /***/ "./node_modules/@mediapipe/drawing_utils/drawing_utils.js": /*!****************************************************************!*\ !*** ./node_modules/@mediapipe/drawing_utils/drawing_utils.js ***! \****************************************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (function(){/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ 'use strict';function h(a){var c=0;return function(){return c<a.length?{done:!1,value:a[c++]}:{done:!0}}}var l="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(a==Array.prototype||a==Object.prototype)return a;a[c]=b.value;return a}; function m(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof __webpack_require__.g&&__webpack_require__.g];for(var c=0;c<a.length;++c){var b=a[c];if(b&&b.Math==Math)return b}throw Error("Cannot find global object");}var n=m(this);function p(a,c){if(c)a:{var b=n;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in b))break a;b=b[e]}a=a[a.length-1];d=b[a];c=c(d);c!=d&&null!=c&&l(b,a,{configurable:!0,writable:!0,value:c})}} function q(a){var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return c?c.call(a):{next:h(a)}}var r="function"==typeof Object.assign?Object.assign:function(a,c){for(var b=1;b<arguments.length;b++){var d=arguments[b];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a};p("Object.assign",function(a){return a||r}); p("Array.prototype.fill",function(a){return a?a:function(c,b,d){var e=this.length||0;0>b&&(b=Math.max(0,e+b));if(null==d||d>e)d=e;d=Number(d);0>d&&(d=Math.max(0,e+d));for(b=Number(b||0);b<d;b++)this[b]=c;return this}});function t(a){return a?a:Array.prototype.fill}p("Int8Array.prototype.fill",t);p("Uint8Array.prototype.fill",t);p("Uint8ClampedArray.prototype.fill",t);p("Int16Array.prototype.fill",t);p("Uint16Array.prototype.fill",t);p("Int32Array.prototype.fill",t); p("Uint32Array.prototype.fill",t);p("Float32Array.prototype.fill",t);p("Float64Array.prototype.fill",t);var u=this||self;function v(a,c){a=a.split(".");var b=u;a[0]in b||"undefined"==typeof b.execScript||b.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===c?b[d]&&b[d]!==Object.prototype[d]?b=b[d]:b=b[d]={}:b[d]=c};var w={color:"white",lineWidth:4,radius:6,visibilityMin:.5};function x(a){a=a||{};return Object.assign({},w,{fillColor:a.color},a)}function y(a,c){return a instanceof Function?a(c):a}function z(a,c,b){return Math.max(Math.min(c,b),Math.min(Math.max(c,b),a))}v("clamp",z); v("drawLandmarks",function(a,c,b){if(c){b=x(b);a.save();var d=a.canvas,e=0;c=q(c);for(var f=c.next();!f.done;f=c.next())if(f=f.value,void 0!==f&&(void 0===f.visibility||f.visibility>b.visibilityMin)){a.fillStyle=y(b.fillColor,{index:e,from:f});a.strokeStyle=y(b.color,{index:e,from:f});a.lineWidth=y(b.lineWidth,{index:e,from:f});var g=new Path2D;g.arc(f.x*d.width,f.y*d.height,y(b.radius,{index:e,from:f}),0,2*Math.PI);a.fill(g);a.stroke(g);++e}a.restore()}}); v("drawConnectors",function(a,c,b,d){if(c&&b){d=x(d);a.save();var e=a.canvas,f=0;b=q(b);for(var g=b.next();!g.done;g=b.next()){var k=g.value;a.beginPath();g=c[k[0]];k=c[k[1]];g&&k&&(void 0===g.visibility||g.visibility>d.visibilityMin)&&(void 0===k.visibility||k.visibility>d.visibilityMin)&&(a.strokeStyle=y(d.color,{index:f,from:g,to:k}),a.lineWidth=y(d.lineWidth,{index:f,from:g,to:k}),a.moveTo(g.x*e.width,g.y*e.height),a.lineTo(k.x*e.width,k.y*e.height));++f;a.stroke()}a.restore()}}); v("drawRectangle",function(a,c,b){b=x(b);a.save();var d=a.canvas;a.beginPath();a.lineWidth=y(b.lineWidth,{});a.strokeStyle=y(b.color,{});a.fillStyle=y(b.fillColor,{});a.translate(c.xCenter*d.width,c.yCenter*d.height);a.rotate(c.rotation*Math.PI/180);a.rect(-c.width/2*d.width,-c.height/2*d.height,c.width*d.width,c.height*d.height);a.translate(-c.xCenter*d.width,-c.yCenter*d.height);a.stroke();a.fill();a.restore()});v("lerp",function(a,c,b,d,e){return z(d*(1-(a-c)/(b-c))+e*(1-(b-a)/(b-c)),d,e)});}).call(this); /***/ }), /***/ "./node_modules/@mediapipe/face_mesh/face_mesh.js": /*!********************************************************!*\ !*** ./node_modules/@mediapipe/face_mesh/face_mesh.js ***! \********************************************************/ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (function(){/* Copyright The Closure Library Authors. SPDX-License-Identifier: Apache-2.0 */ 'use strict';var v;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a}; function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof __webpack_require__.g&&__webpack_require__.g];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var G=ca(this);function J(a,b){if(b)a:{var c=G;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&ba(c,a,{configurable:!0,writable:!0,value:b})}} J("Symbol",function(a){function b(g){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(g||"")+"_"+e++,g)}function c(g,f){this.g=g;ba(this,"description",{configurable:!0,writable:!0,value:f})}if(a)return a;c.prototype.toString=function(){return this.g};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b}); J("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=G[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return da(aa(this))}})}return a});function da(a){a={next:a};a[Symbol.iterator]=function(){return this};return a} function K(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function L(a){if(!(a instanceof Array)){a=K(a);for(var b,c=[];!(b=a.next()).done;)c.push(b.value);a=c}return a}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa; if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var ka=fa; function M(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.ea=b.prototype}function ma(){this.l=!1;this.i=null;this.h=void 0;this.g=1;this.s=this.m=0;this.j=null}function na(a){if(a.l)throw new TypeError("Generator is already running");a.l=!0}ma.prototype.o=function(a){this.h=a}; function oa(a,b){a.j={U:b,V:!0};a.g=a.m||a.s}ma.prototype.return=function(a){this.j={return:a};this.g=this.s};function N(a,b,c){a.g=c;return{value:b}}function pa(a){this.g=new ma;this.h=a}function qa(a,b){na(a.g);var c=a.g.i;if(c)return ra(a,"return"in c?c["return"]:function(d){return{value:d,done:!0}},b,a.g.return);a.g.return(b);return sa(a)} function ra(a,b,c,d){try{var e=b.call(a.g.i,c);if(!(e instanceof Object))throw new TypeError("Iterator result "+e+" is not an object");if(!e.done)return a.g.l=!1,e;var g=e.value}catch(f){return a.g.i=null,oa(a.g,f),sa(a)}a.g.i=null;d.call(a.g,g);return sa(a)}function sa(a){for(;a.g.g;)try{var b=a.h(a.g);if(b)return a.g.l=!1,{value:b.value,done:!1}}catch(c){a.g.h=void 0,oa(a.g,c)}a.g.l=!1;if(a.g.j){b=a.g.j;a.g.j=null;if(b.V)throw b.U;return{value:b.return,done:!0}}return{value:void 0,done:!0}} function ta(a){this.next=function(b){na(a.g);a.g.i?b=ra(a,a.g.i.next,b,a.g.o):(a.g.o(b),b=sa(a));return b};this.throw=function(b){na(a.g);a.g.i?b=ra(a,a.g.i["throw"],b,a.g.o):(oa(a.g,b),b=sa(a));return b};this.return=function(b){return qa(a,b)};this[Symbol.iterator]=function(){return this}}function O(a,b){b=new ta(new pa(b));ka&&a.prototype&&ka(b,a.prototype);return b} function ua(a,b){a instanceof String&&(a+="");var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var g=c++;return{value:b(g,a[g]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}var va="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a};J("Object.assign",function(a){return a||va}); J("Promise",function(a){function b(f){this.h=0;this.i=void 0;this.g=[];this.o=!1;var h=this.j();try{f(h.resolve,h.reject)}catch(k){h.reject(k)}}function c(){this.g=null}function d(f){return f instanceof b?f:new b(function(h){h(f)})}if(a)return a;c.prototype.h=function(f){if(null==this.g){this.g=[];var h=this;this.i(function(){h.l()})}this.g.push(f)};var e=G.setTimeout;c.prototype.i=function(f){e(f,0)};c.prototype.l=function(){for(;this.g&&this.g.length;){var f=this.g;this.g=[];for(var h=0;h<f.length;++h){var k= f[h];f[h]=null;try{k()}catch(l){this.j(l)}}}this.g=null};c.prototype.j=function(f){this.i(function(){throw f;})};b.prototype.j=function(){function f(l){return function(n){k||(k=!0,l.call(h,n))}}var h=this,k=!1;return{resolve:f(this.C),reject:f(this.l)}};b.prototype.C=function(f){if(f===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(f instanceof b)this.F(f);else{a:switch(typeof f){case "object":var h=null!=f;break a;case "function":h=!0;break a;default:h=!1}h?this.u(f):this.m(f)}}; b.prototype.u=function(f){var h=void 0;try{h=f.then}catch(k){this.l(k);return}"function"==typeof h?this.G(h,f):this.m(f)};b.prototype.l=function(f){this.s(2,f)};b.prototype.m=function(f){this.s(1,f)};b.prototype.s=function(f,h){if(0!=this.h)throw Error("Cannot settle("+f+", "+h+"): Promise already settled in state"+this.h);this.h=f;this.i=h;2===this.h&&this.D();this.A()};b.prototype.D=function(){var f=this;e(function(){if(f.B()){var h=G.console;"undefined"!==typeof h&&h.error(f.i)}},1)};b.prototype.B= function(){if(this.o)return!1;var f=G.CustomEvent,h=G.Event,k=G.dispatchEvent;if("undefined"===typeof k)return!0;"function"===typeof f?f=new f("unhandledrejection",{cancelable:!0}):"function"===typeof h?f=new h("unhandledrejection",{cancelable:!0}):(f=G.document.createEvent("CustomEvent"),f.initCustomEvent("unhandledrejection",!1,!0,f));f.promise=this;f.reason=this.i;return k(f)};b.prototype.A=function(){if(null!=this.g){for(var f=0;f<this.g.length;++f)g.h(this.g[f]);this.g=null}};var g=new c;b.prototype.F= function(f){var h=this.j();f.J(h.resolve,h.reject)};b.prototype.G=function(f,h){var k=this.j();try{f.call(h,k.resolve,k.reject)}catch(l){k.reject(l)}};b.prototype.then=function(f,h){function k(w,r){return"function"==typeof w?function(y){try{l(w(y))}catch(m){n(m)}}:r}var l,n,u=new b(function(w,r){l=w;n=r});this.J(k(f,l),k(h,n));return u};b.prototype.catch=function(f){return this.then(void 0,f)};b.prototype.J=function(f,h){function k(){switch(l.h){case 1:f(l.i);break;case 2:h(l.i);break;default:throw Error("Unexpected state: "+ l.h);}}var l=this;null==this.g?g.h(k):this.g.push(k);this.o=!0};b.resolve=d;b.reject=function(f){return new b(function(h,k){k(f)})};b.race=function(f){return new b(function(h,k){for(var l=K(f),n=l.next();!n.done;n=l.next())d(n.value).J(h,k)})};b.all=function(f){var h=K(f),k=h.next();return k.done?d([]):new b(function(l,n){function u(y){return function(m){w[y]=m;r--;0==r&&l(w)}}var w=[],r=0;do w.push(void 0),r++,d(k.value).J(u(w.length-1),n),k=h.next();while(!k.done)})};return b}); J("Object.is",function(a){return a?a:function(b,c){return b===c?0!==b||1/b===1/c:b!==b&&c!==c}});J("Array.prototype.includes",function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var g=d[c];if(g===b||Object.is(g,b))return!0}return!1}}); J("String.prototype.includes",function(a){return a?a:function(b,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.includes must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype.includes must not be a regular expression");return-1!==this.indexOf(b,c||0)}});J("Array.prototype.keys",function(a){return a?a:function(){return ua(this,function(b){return b})}});var wa=this||self; function P(a,b){a=a.split(".");var c=wa;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};function xa(a,b){b=String.fromCharCode.apply(null,b);return null==a?b:a+b}var ya,za="undefined"!==typeof TextDecoder,Aa,Ba="undefined"!==typeof TextEncoder; function Ca(a){if(Ba)a=(Aa||(Aa=new TextEncoder)).encode(a);else{var b=void 0;b=void 0===b?!1:b;for(var c=0,d=new Uint8Array(3*a.length),e=0;e<a.length;e++){var g=a.charCodeAt(e);if(128>g)d[c++]=g;else{if(2048>g)d[c++]=g>>6|192;else{if(55296<=g&&57343>=g){if(56319>=g&&e<a.length){var f=a.charCodeAt(++e);if(56320<=f&&57343>=f){g=1024*(g-55296)+f-56320+65536;d[c++]=g>>18|240;d[c++]=g>>12&63|128;d[c++]=g>>6&63|128;d[c++]=g&63|128;continue}else e--}if(b)throw Error("Found an unpaired surrogate");g=65533}d[c++]= g>>12|224;d[c++]=g>>6&63|128}d[c++]=g&63|128}}a=d.subarray(0,c)}return a};var Da={},Ea=null;function Fa(a,b){void 0===b&&(b=0);Ga();b=Da[b];for(var c=Array(Math.floor(a.length/3)),d=b[64]||"",e=0,g=0;e<a.length-2;e+=3){var f=a[e],h=a[e+1],k=a[e+2],l=b[f>>2];f=b[(f&3)<<4|h>>4];h=b[(h&15)<<2|k>>6];k=b[k&63];c[g++]=l+f+h+k}l=0;k=d;switch(a.length-e){case 2:l=a[e+1],k=b[(l&15)<<2]||d;case 1:a=a[e],c[g]=b[a>>2]+b[(a&3)<<4|l>>4]+k+d}return c.join("")} function Ha(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;Ia(a,function(g){d[e++]=g});return d.subarray(0,e)} function Ia(a,b){function c(k){for(;d<a.length;){var l=a.charAt(d++),n=Ea[l];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(l))throw Error("Unknown base64 encoding at char: "+l);}return k}Ga();for(var d=0;;){var e=c(-1),g=c(0),f=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|g>>4);64!=f&&(b(g<<4&240|f>>2),64!=h&&b(f<<6&192|h))}} function Ga(){if(!Ea){Ea={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Da[c]=d;for(var e=0;e<d.length;e++){var g=d[e];void 0===Ea[g]&&(Ea[g]=e)}}}};var Ja="function"===typeof Uint8Array.prototype.slice,Ka;function La(a,b,c){return b===c?Ka||(Ka=new Uint8Array(0)):Ja?a.slice(b,c):new Uint8Array(a.subarray(b,c))}var Q=0,R=0;function Ma(a,b){b=void 0===b?{}:b;b=void 0===b.v?!1:b.v;this.h=null;this.g=this.j=this.l=0;this.m=!1;this.v=b;a&&Na(this,a)}function Na(a,b){b=b.constructor===Uint8Array?b:b.constructor===ArrayBuffer?new Uint8Array(b):b.constructor===Array?new Uint8Array(b):b.constructor===String?Ha(b):b instanceof Uint8Array?new Uint8Array(b.buffer,b.byteOffset,b.byteLength):new Uint8Array(0);a.h=b;a.l=0;a.j=a.h.length;a.g=a.l}Ma.prototype.reset=function(){this.g=this.l}; function Oa(a){for(var b=128,c=0,d=0,e=0;4>e&&128<=b;e++)b=a.h[a.g++],c|=(b&127)<<7*e;128<=b&&(b=a.h[a.g++],c|=(b&127)<<28,d|=(b&127)>>4);if(128<=b)for(e=0;5>e&&128<=b;e++)b=a.h[a.g++],d|=(b&127)<<7*e+3;if(128>b){a=c>>>0;b=d>>>0;if(d=b&2147483648)a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0);a=4294967296*b+(a>>>0);return d?-a:a}a.m=!0} Ma.prototype.i=function(){var a=this.h,b=a[this.g],c=b&127;if(128>b)return this.g+=1,c;b=a[this.g+1];c|=(b&127)<<7;if(128>b)return this.g+=2,c;b=a[this.g+2];c|=(b&127)<<14;if(128>b)return this.g+=3,c;b=a[this.g+3];c|=(b&127)<<21;if(128>b)return this.g+=4,c;b=a[this.g+4];c|=(b&15)<<28;if(128>b)return this.g+=5,c>>>0;this.g+=5;128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&this.g++;return c}; Ma.prototype.o=function(){var a=this.h[this.g],b=this.h[this.g+1];var c=this.h[this.g+2];var d=this.h[this.g+3];this.g+=4;c=(a<<0|b<<8|c<<16|d<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))};var Pa=[];function Qa(){this.g=new Uint8Array(64);this.h=0}Qa.prototype.push=function(a){if(!(this.h+1<this.g.length)){var b=this.g;this.g=new Uint8Array(Math.ceil(1+2*this.g.length));this.g.set(b)}this.g[this.h++]=a};Qa.prototype.length=function(){return this.h};Qa.prototype.end=function(){var a=this.g,b=this.h;this.h=0;return La(a,0,b)};function Ra(a,b){for(;127<b;)a.push(b&127|128),b>>>=7;a.push(b)};function Sa(a){var b={},c=void 0===b.N?!1:b.N;this.o={v:void 0===b.v?!1:b.v};this.N=c;b=this.o;Pa.length?(c=Pa.pop(),b&&(c.v=b.v),a&&Na(c,a),a=c):a=new Ma(a,b);this.g=a;this.m=this.g.g;this.h=this.i=this.l=-1;this.j=!1}Sa.prototype.reset=function(){this.g.reset();this.h=this.l=-1};function S(a){var b=a.g;(b=b.g==b.j)||(b=a.j)||(b=a.g,b=b.m||0>b.g||b.g>b.j);if(b)return!1;a.m=a.g.g;b=a.g.i();var c=b&7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return a.j=!0,!1;a.i=b;a.l=b>>>3;a.h=c;return!0} function Ta(a){switch(a.h){case 0:if(0!=a.h)Ta(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.h?Ta(a):(a=a.g,a.g+=8);break;case 2:if(2!=a.h)Ta(a);else{var b=a.g.i();a=a.g;a.g+=b}break;case 5:5!=a.h?Ta(a):(a=a.g,a.g+=4);break;case 3:b=a.l;do{if(!S(a)){a.j=!0;break}if(4==a.h){a.l!=b&&(a.j=!0);break}Ta(a)}while(1);break;default:a.j=!0}} function Ua(a,b,c){var d=a.g.j,e=a.g.i(),g=a.g.g+e;a.g.j=g;c(b,a);c=g-a.g.g;if(0!==c)throw Error("Message parsing ended unexpectedly. Expected to read "+e+" bytes, instead read "+(e-c)+" bytes, either the data ended unexpectedly or the message misreported its own length");a.g.g=g;a.g.j=d;return b}function T(a){return a.g.o()} function Va(a){var b=a.g.i();a=a.g;var c=a.g;a.g+=b;a=a.h;var d;if(za)(d=ya)||(d=ya=new TextDecoder("utf-8",{fatal:!1})),d=d.decode(a.subarray(c,c+b));else{b=c+b;for(var e=[],g=null,f,h,k;c<b;)f=a[c++],128>f?e.push(f):224>f?c>=b?e.push(65533):(h=a[c++],194>f||128!==(h&192)?(c--,e.push(65533)):e.push((f&31)<<6|h&63)):240>f?c>=b-1?e.push(65533):(h=a[c++],128!==(h&192)||224===f&&160>h||237===f&&160<=h||128!==((d=a[c++])&192)?(c--,e.push(65533)):e.push((f&15)<<12|(h&63)<<6|d&63)):244>=f?c>=b-2?e.push(65533): (h=a[c++],128!==(h&192)||0!==(f<<28)+(h-144)>>30||128!==((d=a[c++])&192)||128!==((k=a[c++])&192)?(c--,e.push(65533)):(f=(f&7)<<18|(h&63)<<12|(d&63)<<6|k&63,f-=65536,e.push((f>>10&1023)+55296,(f&1023)+56320))):e.push(65533),8192<=e.length&&(g=xa(g,e),e.length=0);d=xa(g,e)}return d}function Wa(a,b,c){var d=a.g.i();for(d=a.g.g+d;a.g.g<d;)c.push(b.call(a.g))}function Xa(a,b){2==a.h?Wa(a,Ma.prototype.o,b):b.push(T(a))};function Ya(){this.h=[];this.i=0;this.g=new Qa}function Za(a,b){0!==b.length&&(a.h.push(b),a.i+=b.length)}function $a(a){var b=a.i+a.g.length();if(0===b)return new Uint8Array(0);b=new Uint8Array(b);for(var c=a.h,d=c.length,e=0,g=0;g<d;g++){var f=c[g];0!==f.length&&(b.set(f,e),e+=f.length)}c=a.g;d=c.h;0!==d&&(b.set(c.g.subarray(0,d),e),c.h=0);a.h=[b];return b} function U(a,b,c){if(null!=c){Ra(a.g,8*b+5);a=a.g;var d=c;d=(c=0>d?1:0)?-d:d;0===d?0<1/d?Q=R=0:(R=0,Q=2147483648):isNaN(d)?(R=0,Q=2147483647):3.4028234663852886E38<d?(R=0,Q=(c<<31|2139095040)>>>0):1.1754943508222875E-38>d?(d=Math.round(d/Math.pow(2,-149)),R=0,Q=(c<<31|d)>>>0):(b=Math.floor(Math.log(d)/Math.LN2),d*=Math.pow(2,-b),d=Math.round(8388608*d),16777216<=d&&++b,R=0,Q=(c<<31|b+127<<23|d&8388607)>>>0);c=Q;a.push(c>>>0&255);a.push(c>>>8&255);a.push(c>>>16&255);a.push(c>>>24&255)}};var ab="function"===typeof Uint8Array;function bb(a,b,c){if(null!=a)return"object"===typeof a?ab&&a instanceof Uint8Array?c(a):cb(a,b,c):b(a)}function cb(a,b,c){if(Array.isArray(a)){for(var d=Array(a.length),e=0;e<a.length;e++)d[e]=bb(a[e],b,c);Array.isArray(a)&&a.W&&db(d);return d}d={};for(e in a)d[e]=bb(a[e],b,c);return d}function eb(a){return"number"===typeof a?isFinite(a)?a:String(a):a}var fb={W:{value:!0,configurable:!0}}; function db(a){Array.isArray(a)&&!Object.isFrozen(a)&&Object.defineProperties(a,fb);return a};var gb;function V(a,b,c){var d=gb;gb=null;a||(a=d);d=this.constructor.ca;a||(a=d?[d]:[]);this.j=d?0:-1;this.m=this.g=null;this.h=a;a:{d=this.h.length;a=d-1;if(d&&(d=this.h[a],!(null===d||"object"!=typeof d||Array.isArray(d)||ab&&d instanceof Uint8Array))){this.l=a-this.j;this.i=d;break a}void 0!==b&&-1<b?(this.l=Math.max(b,a+1-this.j),this.i=null):this.l=Number.MAX_VALUE}if(c)for(b=0;b<c.length;b++)a=c[b],a<this.l?(a+=this.j,(d=this.h[a])?db(d):this.h[a]=hb):(ib(this),(d=this.i[a])?db(d):this.i[a]=hb)} var hb=Object.freeze(db([]));function ib(a){var b=a.l+a.j;a.h[b]||(a.i=a.h[b]={})}function W(a,b,c){return-1===b?null:(void 0===c?0:c)||b>=a.l?a.i?a.i[b]:void 0:a.h[b+a.j]}function jb(a,b){var c=void 0===c?!1:c;var d=W(a,b,c);null==d&&(d=hb);d===hb&&(d=db([]),X(a,b,d,c));return d}function kb(a){var b=jb(a,3);a.m||(a.m={});if(!a.m[3]){for(var c=0;c<b.length;c++)b[c]=+b[c];a.m[3]=!0}return b}function lb(a,b,c){a=W(a,b);return null==a?c:a} function Y(a,b,c){a=W(a,b);a=null==a?a:+a;return null==a?void 0===c?0:c:a}function X(a,b,c,d){(void 0===d?0:d)||b>=a.l?(ib(a),a.i[b]=c):a.h[b+a.j]=c}function mb(a,b,c){if(-1===c)return null;a.g||(a.g={});if(!a.g[c]){var d=W(a,c,!1);d&&(a.g[c]=new b(d))}return a.g[c]}function nb(a,b){a.g||(a.g={});var c=a.g[1];if(!c){var d=jb(a,1);c=[];for(var e=0;e<d.length;e++)c[e]=new b(d[e]);a.g[1]=c}return c}function ob(a,b,c){var d=void 0===d?!1:d;a.g||(a.g={});var e=c?pb(c,!1):c;a.g[b]=c;X(a,b,e,d)} function qb(a,b,c,d){var e=nb(a,c);b=b?b:new c;a=jb(a,1);void 0!=d?(e.splice(d,0,b),a.splice(d,0,pb(b,!1))):(e.push(b),a.push(pb(b,!1)))}V.prototype.toJSON=function(){var a=pb(this,!1);return cb(a,eb,Fa)};function pb(a,b){if(a.g)for(var c in a.g){var d=a.g[c];if(Array.isArray(d))for(var e=0;e<d.length;e++)d[e]&&pb(d[e],b);else d&&pb(d,b)}return a.h}V.prototype.toString=function(){return pb(this,!1).toString()};function rb(a,b){if(a=a.o){Za(b,b.g.end());for(var c=0;c<a.length;c++)Za(b,a[c])}}function sb(a,b){if(4==b.h)return!1;var c=b.m;Ta(b);b.N||(b=La(b.g.h,c,b.g.g),(c=a.o)?c.push(b):a.o=[b]);return!0};function tb(a){V.call(this,a,-1,ub)}M(tb,V);tb.prototype.getRows=function(){return W(this,1)};tb.prototype.getCols=function(){return W(this,2)};tb.prototype.getPackedDataList=function(){return kb(this)};tb.prototype.getLayout=function(){return lb(this,4,0)};function vb(a,b){for(;S(b);)switch(b.i){case 8:var c=b.g.i();X(a,1,c);break;case 16:c=b.g.i();X(a,2,c);break;case 29:case 26:Xa(b,a.getPackedDataList());break;case 32:c=Oa(b.g);X(a,4,c);break;default:if(!sb(a,b))return a}return a}var ub=[3];function Z(a,b){var c=void 0;return new (c||(c=Promise))(function(d,e){function g(k){try{h(b.next(k))}catch(l){e(l)}}function f(k){try{h(b["throw"](k))}catch(l){e(l)}}function h(k){k.done?d(k.value):(new c(function(l){l(k.value)})).then(g,f)}h((b=b.apply(a,void 0)).next())})};function wb(a){V.call(this,a)}M(wb,V);function xb(a,b){for(;S(b);)switch(b.i){case 8:var c=b.g.i();X(a,1,c);break;case 21:c=T(b);X(a,2,c);break;case 26:c=Va(b);X(a,3,c);break;case 34:c=Va(b);X(a,4,c);break;default:if(!sb(a,b))return a}return a};function yb(a){V.call(this,a,-1,zb)}M(yb,V);yb.prototype.addClassification=function(a,b){qb(this,a,wb,b);return this};var zb=[1];function Ab(a){V.call(this,a)}M(Ab,V);function Bb(a,b){for(;S(b);)switch(b.i){case 13:var c=T(b);X(a,1,c);break;case 21:c=T(b);X(a,2,c);break;case 29:c=T(b);X(a,3,c);break;case 37:c=T(b);X(a,4,c);break;case 45:c=T(b);X(a,5,c);break;default:if(!sb(a,b))return a}return a};function Cb(a){V.call(this,a,-1,Db)}M(Cb,V);function Eb(a){a:{var b=new Cb;for(a=new Sa(a);S(a);)switch(a.i){case 10:var c=Ua(a,new Ab,Bb);qb(b,c,Ab,void 0);break;default:if(!sb(b,a))break a}}return b}var Db=[1];function Fb(a){V.call(this,a)}M(Fb,V);function Gb(a){V.call(this,a,-1,Hb)}M(Gb,V);Gb.prototype.getVertexType=function(){return lb(this,1,0)};Gb.prototype.getPrimitiveType=function(){return lb(this,2,0)};Gb.prototype.getVertexBufferList=function(){return kb(this)};Gb.prototype.getIndexBufferList=function(){return jb(this,4)}; function Ib(a,b){for(;S(b);)switch(b.i){case 8:var c=Oa(b.g);X(a,1,c);break;case 16:c=Oa(b.g);X(a,2,c);break;case 29:case 26:Xa(b,a.getVertexBufferList());break;case 32:case 34:c=b;var d=a.getIndexBufferList();2==c.h?Wa(c,Ma.prototype.i,d):d.push(c.g.i());break;default:if(!sb(a,b))return a}return a}var Hb=[3,4];function Jb(a){V.call(this,a)}M(Jb,V);Jb.prototype.getMesh=function(){return mb(this,Gb,1)};Jb.prototype.getPoseTransformMatrix=function(){return mb(this,tb,2)};function Kb(a){a:{var b=new Jb;for(a=new Sa(a);S(a);)switch(a.i){case 10:var c=Ua(a,new Gb,Ib);ob(b,1,c);break;case 18:c=Ua(a,new tb,vb);ob(b,2,c);break;default:if(!sb(b,a))break a}}return b};function Lb(a,b,c){c=a