shopar-plugin
Version:
Plugin for the Web that seamlessly integrates into your webpage to create embedded virtual try-on and 3D preview capabilities.
1 lines • 120 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ShopAR__TrueScale={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(s,i){function o(t){try{h(r.next(t))}catch(t){i(t)}}function a(t){try{h(r.throw(t))}catch(t){i(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}h((r=r.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var n=self;function r(){throw Error("Invalid UTF8")}function s(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,o;const a="undefined"!=typeof TextDecoder;let h;const c="undefined"!=typeof TextEncoder;function u(t){if(c)t=(h||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let s=0;s<t.length;s++){var e=t.charCodeAt(s);if(128>e)r[n++]=e;else{if(2048>e)r[n++]=e>>6|192;else{if(55296<=e&&57343>=e){if(56319>=e&&s<t.length){const i=t.charCodeAt(++s);if(56320<=i&&57343>=i){e=1024*(e-55296)+i-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}s--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}var l,f;t:{for(var d=["CLOSURE_FLAGS"],p=n,g=0;g<d.length;g++)if(null==(p=p[d[g]])){f=null;break t}f=p}var m,y=f&&f[610401301];l=null!=y&&y;const v=n.navigator;function _(t){return!!l&&!!m&&m.brands.some((({brand:e})=>e&&-1!=e.indexOf(t)))}function w(t){var e;return(e=n.navigator)&&(e=e.userAgent)||(e=""),-1!=e.indexOf(t)}function A(){return!!l&&!!m&&0<m.brands.length}function b(){return A()?_("Chromium"):(w("Chrome")||w("CriOS"))&&!(!A()&&w("Edge"))||w("Silk")}m=v&&v.userAgentData||null;var E=!A()&&(w("Trident")||w("MSIE"));!w("Android")||b(),b(),w("Safari")&&(b()||!A()&&w("Coast")||!A()&&w("Opera")||!A()&&w("Edge")||(A()?_("Microsoft Edge"):w("Edg/"))||A()&&_("Opera"));var T={},k=null;function x(){if(!k){k={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=t.concat(e[n].split(""));T[n]=r;for(var s=0;s<r.length;s++){var i=r[s];void 0===k[i]&&(k[i]=s)}}}}var M="undefined"!=typeof Uint8Array,F=!E&&"function"==typeof btoa;function L(t){if(!F){var e;void 0===e&&(e=0),x(),e=T[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let h=0,c=0;for(;h<t.length-2;h+=3){var s=t[h],i=t[h+1],o=t[h+2],a=e[s>>2];s=e[(3&s)<<4|i>>4],i=e[(15&i)<<2|o>>6],o=e[63&o],n[c++]=a+s+i+o}switch(a=0,o=r,t.length-h){case 2:o=e[(15&(a=t[h+1]))<<2]||r;case 1:t=t[h],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+o+r}return n.join("")}for(e="",n=0,r=t.length-10240;n<r;)e+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));return e+=String.fromCharCode.apply(null,n?t.subarray(n):t),btoa(e)}const S=/[-_.]/g,O={"-":"+",_:"/",".":"="};function P(t){return O[t]||""}function R(t){if(!F)return function(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),s=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),s=k[n];if(null!=s)return s;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}x();for(var r=0;;){var s=n(-1),i=n(0),o=n(64),a=n(64);if(64===a&&-1===s)break;e(s<<2|i>>4),64!=o&&(e(i<<4&240|o>>2),64!=a&&e(o<<6&192|a))}}(t,(function(t){r[s++]=t})),s!==n?r.subarray(0,s):r}(t);S.test(t)&&(t=t.replace(S,P)),t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function C(t){return M&&null!=t&&t instanceof Uint8Array}let I;function D(){return I||=new Uint8Array(0)}var B={};let U;function N(t){if(t!==B)throw Error("illegal external caller")}function G(){return U||=new V(null,B)}function j(t){N(B);var e=t.N;return null==(e=null==e||C(e)?e:"string"==typeof e?R(e):null)?e:t.N=e}var V=class{constructor(t,e){if(N(e),this.N=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}ha(){const t=j(this);return t?new Uint8Array(t):D()}};function z(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function W(){return Error("Failed to read varint, encoding is invalid.")}function X(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function H(t){return 0==t.length?G():new V(t,B)}function q(t){if("string"==typeof t)return{buffer:R(t),H:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),H:!1};if(t.constructor===Uint8Array)return{buffer:t,H:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),H:!1};if(t.constructor===V)return{buffer:j(t)||D(),H:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),H:!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")}const $="function"==typeof Uint8Array.prototype.slice;let K,Y=0,J=0;function Z(t){const e=0>t;let n=(t=Math.abs(t))>>>0;if(t=Math.floor((t-n)/4294967296),e){const[e,r]=rt(n,t);t=r,n=e}Y=n>>>0,J=t>>>0}function Q(t){const e=K||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),J=0,Y=e.getUint32(0,!0)}function tt(t,e){return 4294967296*e+(t>>>0)}function et(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=tt(t,e),n?-t:t}function nt(t){if(16>t.length)Z(Number(t));else if("function"==typeof BigInt)t=BigInt(t),Y=Number(t&BigInt(4294967295))>>>0,J=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);J=Y=0;const n=t.length;for(let r=e,s=(n-e)%6+e;s<=n;r=s,s+=6){const e=Number(t.slice(r,s));J*=1e6,Y=1e6*Y+e,4294967296<=Y&&(J+=Math.trunc(Y/4294967296),J>>>=0,Y>>>=0)}if(e){const[t,e]=rt(Y,J);Y=t,J=e}}}function rt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function st(t,e,{R:n=!1}={}){t.R=n,e&&(e=q(e),t.h=e.buffer,t.s=e.H,t.v=0,t.l=t.h.length,t.g=t.v)}function it(t,e){if(t.g=e,e>t.l)throw X(t.l,e)}function ot(t,e){let n,r=0,s=0,i=0;const o=t.h;let a=t.g;do{n=o[a++],r|=(127&n)<<i,i+=7}while(32>i&&128&n);for(32<i&&(s|=(127&n)>>4),i=3;32>i&&128&n;i+=7)n=o[a++],s|=(127&n)<<i;if(it(t,a),128>n)return e(r>>>0,s>>>0);throw W()}function at(t){let e=0,n=t.g;const r=n+10,s=t.h;for(;n<r;){const r=s[n++];if(e|=r,0==(128&r))return it(t,n),!!(127&e)}throw W()}function ht(t){var e=t.h;const n=t.g,r=e[n],s=e[n+1],i=e[n+2];return e=e[n+3],it(t,t.g+4),(r<<0|s<<8|i<<16|e<<24)>>>0}function ct(t,e){if(0>e)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.l)throw X(e,t.l-n);return t.g=r,n}function ut(t,e){if(0==e)return G();var n=ct(t,e);return t.R&&t.s?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?D():$?t.slice(n,e):new Uint8Array(t.subarray(n,e))),H(n)}var lt=class{constructor(t,e){this.h=null,this.s=!1,this.g=this.l=this.v=0,st(this,t,e)}m(){const t=this.h;let e=this.g,n=t[e++],r=127&n;if(128&n&&(n=t[e++],r|=(127&n)<<7,128&n&&(n=t[e++],r|=(127&n)<<14,128&n&&(n=t[e++],r|=(127&n)<<21,128&n&&(n=t[e++],r|=n<<28,128&n&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++])))))throw W();return it(this,e),r}j(){return this.m()>>>0}A(){var t=ht(this);const e=2*(t>>31)+1,n=t>>>23&255;return t&=8388607,255==n?t?NaN:1/0*e:0==n?e*Math.pow(2,-149)*t:e*Math.pow(2,n-150)*(t+Math.pow(2,23))}C(){return this.m()}},ft=[];function dt(t){var e=t.g;if(e.g==e.l)return!1;t.l=t.g.g;var n=t.g.j();if(e=n>>>3,!(0<=(n&=7)&&5>=n))throw z(n,t.l);if(1>e)throw Error(`Invalid field number: ${e} (at position ${t.l})`);return t.m=e,t.h=n,!0}function pt(t){switch(t.h){case 0:0!=t.h?pt(t):at(t.g);break;case 1:it(t=t.g,t.g+8);break;case 2:if(2!=t.h)pt(t);else{var e=t.g.j();it(t=t.g,t.g+e)}break;case 5:it(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!dt(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.m!=e)throw Error("Unmatched end-group tag");break}pt(t)}break;default:throw z(t.h,t.l)}}function gt(t,e,n){const r=t.g.l,s=t.g.j(),i=t.g.g+s;let o=i-r;if(0>=o&&(t.g.l=i,n(e,t,void 0,void 0,void 0),o=i-t.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${s} bytes, instead read ${s-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return t.g.g=i,t.g.l=r,e}function mt(t){var e=t.g.j(),n=ct(t=t.g,e);if(t=t.h,a){var h,c=t;(h=o)||(h=o=new TextDecoder("utf-8",{fatal:!0})),t=n+e,c=0===n&&t===c.length?c:c.subarray(n,t);try{var u=h.decode(c)}catch(t){if(void 0===i){try{h.decode(new Uint8Array([128]))}catch(t){}try{h.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(u=n)+e,n=[];let i,o=null;for(;u<e;){var l=t[u++];128>l?n.push(l):224>l?u>=e?r():(i=t[u++],194>l||128!=(192&i)?(u--,r()):n.push((31&l)<<6|63&i)):240>l?u>=e-1?r():(i=t[u++],128!=(192&i)||224===l&&160>i||237===l&&160<=i||128!=(192&(c=t[u++]))?(u--,r()):n.push((15&l)<<12|(63&i)<<6|63&c)):244>=l?u>=e-2?r():(i=t[u++],128!=(192&i)||0!=i-144+(l<<28)>>30||128!=(192&(c=t[u++]))||128!=(192&(h=t[u++]))?(u--,r()):(l=(7&l)<<18|(63&i)<<12|(63&c)<<6|63&h,l-=65536,n.push(55296+(l>>10&1023),56320+(1023&l)))):r(),8192<=n.length&&(o=s(o,n),n.length=0)}u=s(o,n)}return u}function yt(t){const e=t.g.j();return ut(t.g,e)}function vt(t,e,n){var r=t.g.j();for(r=t.g.g+r;t.g.g<r;)n.push(e.call(t.g))}var _t=[];function wt(t){return t?/^\d+$/.test(t)?(nt(t),new At(Y,J)):null:bt||=new At(0,0)}var At=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let bt;function Et(t){return t?/^-?\d+$/.test(t)?(nt(t),new Tt(Y,J)):null:kt||=new Tt(0,0)}var Tt=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let kt;function xt(t,e,n){for(;0<n||127<e;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function Mt(t,e){for(;127<e;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Ft(t,e){if(0<=e)Mt(t,e);else{for(let n=0;9>n;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Lt(t,e){t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function St(t,e){0!==e.length&&(t.l.push(e),t.h+=e.length)}function Ot(t,e,n){Mt(t.g,8*e+n)}function Pt(t,e){return Ot(t,e,2),e=t.g.end(),St(t,e),e.push(t.h),e}function Rt(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;127<n;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function Ct(t,e,n){Ot(t,e,2),Mt(t.g,n.length),St(t,t.g.end()),St(t,n)}function It(t,e,n,r){null!=n&&(e=Pt(t,e),r(n,t),Rt(t,e))}class Dt{constructor(t,e,n){this.g=t,this.h=e,this.l=n}}function Bt(t){return Array.prototype.slice.call(t)}const Ut="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var Nt=Ut?(t,e)=>{t[Ut]|=e}:(t,e)=>{void 0!==t.D?t.D|=e:Object.defineProperties(t,{D:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Gt(t){const e=Vt(t);1!=(1&e)&&(Object.isFrozen(t)&&(t=Bt(t)),Wt(t,1|e))}var jt=Ut?(t,e)=>{t[Ut]&=~e}:(t,e)=>{void 0!==t.D&&(t.D&=~e)},Vt=Ut?t=>0|t[Ut]:t=>0|t.D,zt=Ut?t=>t[Ut]:t=>t.D,Wt=Ut?(t,e)=>{t[Ut]=e}:(t,e)=>{void 0!==t.D?t.D=e:Object.defineProperties(t,{D:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Xt(){var t=[];return Nt(t,1),t}function Ht(t){return Nt(t,34),t}function qt(t,e){Wt(e,-255&(0|t))}function $t(t,e){Wt(e,-221&(34|t))}function Kt(t){return 0==(t=t>>11&1023)?536870912:t}var Yt,Jt={};function Zt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function Qt(t,e,n){if(null!=t)if("string"==typeof t)t=t?new V(t,B):G();else if(t.constructor!==V)if(C(t))t=n?H(t):t.length?new V(new Uint8Array(t),B):G();else{if(!e)throw Error();t=void 0}return t}const te=[];function ee(t){if(2&t)throw Error()}Wt(te,55),Yt=Object.freeze(te);class ne{constructor(t,e,n){this.l=0,this.g=t,this.h=e,this.m=n}next(){if(this.l<this.g.length){const 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 ne(this.g,this.h,this.m)}}var re={};let se,ie;function oe(t,e){(e=se?e[se]:void 0)&&(t[se]=Bt(e))}function ae(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function he(t){return null==t?t:"number"==typeof t||"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function ce(t){return null==t?t:"boolean"==typeof t||"number"==typeof t?!!t:void 0}function ue(t){return"number"==typeof t&&Number.isFinite(t)||!!t&&"string"==typeof t&&isFinite(t)}function le(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t?t:void 0}function fe(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t?t:void 0}function de(t){if("string"!=typeof t)throw Error();return t}function pe(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function ge(t){return null==t||"string"==typeof t?t:void 0}function me(t,e,n,r){var s=!1;return null==t||"object"!=typeof t||(s=Array.isArray(t))||t.M!==Jt?s?(0===(s=n=Vt(t))&&(s|=32&r),(s|=2&r)!==n&&Wt(t,s),new e(t)):(n?2&r?(t=e[ye])?e=t:(Ht((t=new e).u),e=e[ye]=t):e=new e:e=void 0,e):t}const ye="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():"di";function ve(t){return t}function _e(t,e,n){return"string"==typeof(t="number"==(e=typeof t)||"string"===e?t:n?0:void 0)&&(n=+t,Number.isSafeInteger(n))?n:t}let we,Ae,be;function Ee(t){switch(typeof t){case"boolean":return Ae||=[0,void 0,!0];case"number":return 0<t?void 0:0===t?be||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function Te(t,e){return ke(t,e[0],e[1])}function ke(t,e,n){if(null==t&&(t=we),we=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-2095105&r|(1023&e)<<11)}else{if(!Array.isArray(t))throw Error();if(64&(r=Vt(t)))return ie&&delete t[ie],t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error();t:{var s=(n=t).length;if(s){const t=s-1;var i=n[t];if(Zt(i)){1024<=(s=t-(e=+!!(512&(r|=256))-1))&&(xe(n,e,i),s=1023),r=-2095105&r|(1023&s)<<11;break t}}e&&(i=+!!(512&r)-1,1024<(e=Math.max(e,s-i))&&(xe(n,i,{}),r|=256,e=1023),r=-2095105&r|(1023&e)<<11)}}return Wt(t,r),t}function xe(t,e,n){const r=1023+e,s=t.length;for(let i=r;i<s;i++){const r=t[i];null!=r&&r!==n&&(n[i-e]=r)}t.length=r+1,t[r]=n}function Me(t){if(2&t.g)throw Error("Cannot mutate an immutable Map")}var Fe=class extends Map{constructor(t,e,n=ve,r=ve){super();let s=Vt(t);s|=64,Wt(t,s),this.g=s,this.l=e,this.h=n||ve,this.j=this.l?Le:r||ve;for(let i=0;i<t.length;i++){const o=t[i],a=n(o[0],!1,!0);let h=o[1];e?void 0===h&&(h=null):h=r(o[1],!1,!0,void 0,void 0,s),super.set(a,h)}}s(t=Se){return this.m(t)}m(t=Se){const e=[],n=super.entries();for(var r;!(r=n.next()).done;)(r=r.value)[0]=t(r[0]),r[1]=t(r[1]),e.push(r);return e}clear(){Me(this),super.clear()}delete(t){return Me(this),super.delete(this.h(t,!0,!1))}entries(){var t=this.A();return new ne(t,Oe,this)}keys(){return this.C()}values(){var t=this.A();return new ne(t,Fe.prototype.get,this)}forEach(t,e){super.forEach(((n,r)=>{t.call(e,this.get(r),r,this)}))}set(t,e){return Me(this),null==(t=this.h(t,!0,!1))?this:null==e?(super.delete(t),this):super.set(t,this.j(e,!0,!0,this.l,!1,this.g))}I(t){const e=this.h(t[0],!1,!0);t=t[1],t=this.l?void 0===t?null:t:this.j(t,!1,!0,void 0,!1,this.g),super.set(e,t)}has(t){return super.has(this.h(t,!1,!1))}get(t){t=this.h(t,!1,!1);const e=super.get(t);if(void 0!==e){var n=this.l;return n?((n=this.j(e,!1,!0,n,this.v,this.g))!==e&&super.set(t,n),n):e}}A(){return Array.from(super.keys())}C(){return super.keys()}[Symbol.iterator](){return this.entries()}};function Le(t,e,n,r,s,i){return t=me(t,r,n,i),s&&(t=Ne(t)),t}function Se(t){return t}function Oe(t){return[t,this.get(t)]}function Pe(t,e,n,r,s,i){if(null!=t){if(Array.isArray(t))t=s&&0==t.length&&1&Vt(t)?void 0:i&&2&Vt(t)?t:Re(t,e,n,void 0!==r,s,i);else if(Zt(t)){const o={};for(let a in t)o[a]=Pe(t[a],e,n,r,s,i);t=o}else t=e(t,r);return t}}function Re(t,e,n,r,s,i){const o=r||n?Vt(t):0;r=r?!!(32&o):void 0;const a=Bt(t);for(let t=0;t<a.length;t++)a[t]=Pe(a[t],e,n,r,s,i);return n&&(oe(a,t),n(o,a)),a}function Ce(t){return Pe(t,Ie,void 0,void 0,!1,!1)}function Ie(t){return t.M===Jt?t.toJSON():t instanceof Fe?t.s(Ce):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t&&!Array.isArray(t)){if(C(t))return L(t);if(t instanceof V){const e=t.N;return null==e?"":"string"==typeof e?e:t.N=L(e)}if(t instanceof Fe)return t.s()}}return t}(t)}function De(t,e,n=$t){if(null!=t){if(M&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Vt(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Wt(t,34|r),4&r&&Object.freeze(t),t):Re(t,De,4&r?$t:n,!0,!1,!0))}return t.M===Jt?(n=t.u,t=2&(r=zt(n))?t:Be(t,n,r,!0)):t instanceof Fe&&(n=Ht(t.m(De)),t=new Fe(n,t.l,t.h,t.j)),t}}function Be(t,e,n,r){return t=t.constructor,we=e=Ue(e,n,r),e=new t(e),we=void 0,e}function Ue(t,e,n){const r=n||2&e?$t:qt,s=!!(32&e);return t=function(t,e,n){const r=Bt(t);var s=r.length;const i=256&e?r[s-1]:void 0;for(s+=i?-1:0,e=512&e?1:0;e<s;e++)r[e]=n(r[e]);if(i){e=r[e]={};for(const t in i)e[t]=n(i[t])}return oe(r,t),r}(t,e,(t=>De(t,s,r))),Nt(t,32|(n?2:0)),t}function Ne(t){const e=t.u,n=zt(e);return 2&n?Be(t,e,n,!1):t}function Ge(t,e){return je(t=t.u,zt(t),e)}function je(t,e,n,r){if(-1===n)return null;if(n>=Kt(e)){if(256&e)return t[t.length-1][n]}else{var s=t.length;if(r&&256&e&&null!=(r=t[s-1][n]))return r;if((e=n+(+!!(512&e)-1))<s)return t[e]}}function Ve(t,e,n,r){const s=t.u,i=zt(s);return ee(i),ze(s,i,e,n,r),t}function ze(t,e,n,r,s){var i=Kt(e);if(n>=i||s){if(s=e,256&e)i=t[t.length-1];else{if(null==r)return;i=t[i+(+!!(512&e)-1)]={},s|=256}i[n]=r,s!==e&&Wt(t,s)}else t[n+(+!!(512&e)-1)]=r,256&e&&n in(t=t[t.length-1])&&delete t[n]}function We(t,e,n,r,s){var i=2&e;let o=je(t,e,n,s);Array.isArray(o)||(o=Yt);const a=!(2&r),h=!(1&r);r=!!(32&e);let c=Vt(o);return 0!==c||!r||i||a?1&c||(c|=1,Wt(o,c)):(c|=33,Wt(o,c)),i?(2&c||Ht(o),h&&Object.freeze(o)):(i=2&c,h&&i?(o=Bt(o),i=1,r&&!a&&(i|=32),Wt(o,i),ze(t,e,n,o,s)):a&&32&c&&!i&&jt(o,32)),o}function Xe(t,e){t=t.u;const n=zt(t),r=je(t,n,e),s=he(r);return null!=s&&s!==r&&ze(t,n,e,s),s}function He(t){t=t.u;const e=zt(t),n=je(t,e,1),r=Qt(n,!0,!!(34&e));return null!=r&&r!==n&&ze(t,e,1,r),r}function qe(t,e,n){t=t.u;const r=zt(t),s=2&r;let i=We(t,r,e,1),o=Vt(i);if(!(4&o)){Object.isFrozen(i)&&(i=Bt(i),Wt(i,o=-3&o|32),ze(t,r,e,i));let a=0,h=0;for(;a<i.length;a++){const t=n(i[a]);null!=t&&(i[h++]=t)}h<a&&(i.length=h),o|=21,s?o|=34:o&=-33,Wt(i,o),2&o&&Object.freeze(i)}return!s&&(2&o||Object.isFrozen(i))&&(i=Bt(i),Wt(i,-35&o),ze(t,r,e,i)),i}let $e;function Ke(){return $e??=new Fe(Ht([]),void 0,void 0,void 0,re)}function Ye(t){t=Bt(t);for(let e=0;e<t.length;e++){const n=t[e]=Bt(t[e]);Array.isArray(n[1])&&(n[1]=Ht(n[1]))}return t}function Je(t,e,n){{t=t.u;const r=zt(t);if(ee(r),null==n)ze(t,r,e);else{if(!(4&Vt(n))){Object.isFrozen(n)&&(n=Bt(n));for(let t=0;t<n.length;t++)n[t]=de(n[t]);Wt(n,5)}ze(t,r,e,n)}}}function Ze(t,e){return Qe(t=t.u,zt(t),zs)===e?e:-1}function Qe(t,e,n){let r=0;for(let s=0;s<n.length;s++){const i=n[s];null!=je(t,e,i)&&(0!==r&&ze(t,e,r),r=i)}return r}function tn(t,e,n,r){const s=zt(t);ee(s);const i=je(t,s,n,r);let o;if(null!=i&&i.M===Jt)return(e=Ne(i))!==i&&ze(t,s,n,e,r),e.u;if(Array.isArray(i)){const t=Vt(i);o=2&t?Ue(i,t,!1):i,o=Te(o,e)}else o=Te(void 0,e);return o!==i&&ze(t,s,n,o,r),o}function en(t,e,n,r){t=t.u;const s=zt(t),i=je(t,s,n,r);return(e=me(i,e,!1,s))!==i&&null!=e&&ze(t,s,n,e,r),e}function nn(t,e,n,r=!1){if(null==(e=en(t,e,n,r)))return e;t=t.u;const s=zt(t);if(!(2&s)){const i=Ne(e);i!==e&&ze(t,s,n,e=i,r)}return e}function rn(t,e,n,r,s){var i=!!(2&e),o=We(t,e,r,1),a=o===Yt;if(a&&2!==s)return o;if(a||!(4&Vt(o))){var h=o;o=!!(2&e),a=!!(2&Vt(h)),i=h,!o&&a&&(h=Bt(h));var c=e|((a=a||void 0)?2:0),u=a;a=!1;let l=0,f=0;for(;l<h.length;l++){const t=me(h[l],n,!1,c);if(null==t)continue;const e=!!(2&Vt(t.u));u=u||e,a=a||!e,h[f++]=t}return f<l&&(h.length=f),c=5|(h=Vt(n=h)),u=u?-9&c:8|c,h!=(u=a?-17&u:16|u)&&(Object.isFrozen(n)&&(n=Bt(n)),Wt(n,u)),i!==(h=n)&&ze(t,e,r,h),(o&&2!==s||1===s)&&Object.freeze(h),h}return 3===s||(i?2===s&&(s=Vt(o),o=Bt(o),Wt(o,s),ze(t,e,r,o)):(i=Object.isFrozen(o),1===s?i||Object.freeze(o):(n=-33&(s=Vt(o)),i||2&s?(o=Bt(o),Wt(o,-3&n),ze(t,e,r,o)):s!==n&&Wt(o,n)))),o}function sn(t,e,n){var r=t.u;const s=zt(r);if(e=rn(r,s,e,n,(t=!!(2&s))?1:2),!(t||8&Vt(e))){for(n=0;n<e.length;n++)(t=e[n])!==(r=Ne(t))&&(e[n]=r);Nt(e,8)}return e}function on(t,e,n,r,s){return null==r&&(r=void 0),Ve(t,n,r,s)}function an(t,e,n,r){null==r&&(r=void 0),t=t.u;const s=zt(t);ee(s),(n=Qe(t,s,n))&&n!==e&&null!=r&&ze(t,s,n),ze(t,s,e,r)}function hn(t,e,n){t=t.u;const r=zt(t);ee(r),t=rn(t,r,e,1,2),e=null!=n?n:new e,t.push(e),2&Vt(e.u)?jt(t,8):jt(t,16)}function cn(t,e){return le(Ge(t,e))}function un(t){return null==(t=Ge(t,2))||ue(t)?t:void 0}function ln(t,e){return ge(Ge(t,e))}function fn(t){return t??0}function dn(t,e){return fn(Xe(t,e))}function pn(t,e,n){if(null!=n){if("boolean"!=typeof n)throw t=typeof n,Error(`Expected boolean but got ${"object"!=t?t:n?Array.isArray(n)?"array":t:"null"}: ${n}`);n=!!n}Ve(t,e,n)}function gn(t,e,r){if(null!=r){if("number"!=typeof r)throw ae(t=Error(),"warning"),t;if(!Number.isFinite(r)){const t=Error();ae(t,"incident"),function(t){n.setTimeout((()=>{throw t}),0)}(t)}}Ve(t,e,r)}function mn(t,e,n){if(null!=n&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);Ve(t,e,n)}function yn(t,e,n){n=de(n),t=t.u;const r=zt(t);ee(r),We(t,r,e,2).push(n)}function vn(t,e,n){e.g?e.m(t,e.g,e.h,n,!0):e.m(t,e.h,n,!0)}Fe.prototype.toJSON=void 0;var _n=class{constructor(t,e){this.u=ke(t,e)}toJSON(){return wn(this,Re(this.u,Ie,void 0,void 0,!1,!1),!0)}l(){var t=Ni;return t.g?t.l(this,t.g,t.h,!0):t.l(this,t.h,t.defaultValue,!0)}clone(){const t=this.u;return Be(this,t,zt(t),!1)}H(){return!!(2&Vt(this.u))}};function wn(t,e,n){var r=t.constructor.B,s=Kt(zt(n?t.u:e)),i=!1;if(r){if(!n){var o;if((e=Bt(e)).length&&Zt(o=e[e.length-1]))for(i=0;i<r.length;i++)if(r[i]>=s){Object.assign(e[e.length-1]={},o);break}i=!0}var a;s=e,n=!n,t=Kt(o=zt(t.u)),o=+!!(512&o)-1;for(let e=0;e<r.length;e++){var h=r[e];if(h<t){var c=s[h+=o];null==c?s[h]=n?Yt:Xt():n&&c!==Yt&&Gt(c)}else{if(!a){var u=void 0;s.length&&Zt(u=s[s.length-1])?a=u:s.push(a={})}c=a[h],null==a[h]?a[h]=n?Yt:Xt():n&&c!==Yt&&Gt(c)}}}if(!(r=e.length))return e;let l,f;if(Zt(a=e[r-1])){t:{var d=a;u={},s=!1;for(let t in d)n=d[t],Array.isArray(n)&&n!=n&&(s=!0),null!=n?u[t]=n:s=!0;if(s){for(let t in u){d=u;break t}d=null}}d!=a&&(l=!0),r--}for(;0<r&&null==(a=e[r-1]);r--)f=!0;return l||f?(e=i?e:Array.prototype.slice.call(e,0,r),i&&(e.length=r),d&&e.push(d),e):e}function An(t){return{ca:mr,U:t}}function bn(t,e){if(Array.isArray(e)){var n=Vt(e);if(4&n)return e;for(var r=0,s=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[s++]=n)}return s<r&&(e.length=s),Wt(e,5|n),2&n&&Object.freeze(e),e}}_n.prototype.M=Jt,_n.prototype.toString=function(){return wn(this,this.u,!1).toString()};const En=Symbol();function Tn(t){let e=t[En];if(!e){const n=Sn(t),r=jn(t),s=r.h;e=s?(t,e)=>s(t,e,r):(t,e)=>{for(;dt(e)&&4!=e.h;){var s=e.m,i=r[s];if(!i){var o=r.g;o&&(o=o[s])&&(i=r[s]=kn(o))}i&&i(e,t,s)||(s=(i=e).l,pt(i),i.aa?i=void 0:(o=i.g.g-s,i.g.g=s,i=ut(i.g,o)),s=t,i&&(se||=Symbol(),(o=s[se])?o.push(i):s[se]=[i]))}for(const e in n){t[ie||=Symbol()]=n;break}},t[En]=e}return e}function kn(t){const e=function(t){if(t=t.U)return Tn(t)}(t),n=t.ca.g;if(e){const r=jn(t.U).L;return(t,s,i)=>n(t,s,i,r,e)}return(t,e,r)=>n(t,e,r)}const xn=Symbol();function Mn(t,e,n,r){let s;if(r){const e=r[xn];s=e?e.L:Ee(r[0]),n[t]=e??r}s&&s===Ae?((e=n.xa)||(n.xa=e=[]),e.push(t)):e.l&&((e=n.Ba)||(n.Ba=e=[]),e.push(t))}function Fn(t,e,n,r){Mn(t,e,r)}function Ln(t,e,n,r,s){Mn(t,e,s,n)}function Sn(t){let e=t[xn];return e||(e=t[xn]={},On(t,e,Fn,Ln,e))}function On(t,e,n,r,s){e.L=Ee(t[0]);let i=1;if(t.length>i&&!(t[i]instanceof Dt)){var o=t[i++];if(Array.isArray(o))return e.h=o[0],e.g=o[1],e;e.g=o}for(o=0;i<t.length;){var a=t[i++],h=t[i];for("number"==typeof h?(i++,o+=h):o++,h=i;h<t.length&&!(t[h]instanceof Dt);)h++;if(h-=i){var c=t,u=i,l=c[u];if("function"==typeof l&&(l=l(),c[u]=l),(c=Array.isArray(l))&&!(c=Un in l||Cn in l)&&(c=0<l.length)){const t=Ee(u=(c=l)[0]);null!=t&&t!==u&&(c[0]=t),c=null!=t}(l=c?l:void 0)?(i++,1===h?void 0!==(a=r(o,a,l,void 0,s))&&(e[o]=a):void 0!==(a=r(o,a,l,t[i++],s))&&(e[o]=a)):void 0!==(a=n(o,a,t[i++],s))&&(e[o]=a)}else void 0!==(a=n(o,a,void 0,s))&&(e[o]=a)}return e}const Pn=Symbol();function Rn(t){let e=t[Pn];if(!e){const n=Bn(t);e=(t,e)=>zn(t,e,n),t[Pn]=e}return e}const Cn=Symbol();function In(t,e){return e.h}function Dn(t,e,n){let r,s;const i=e.h;return(t,e,o)=>i(t,e,o,s||=Bn(n).L,r||=Rn(n))}function Bn(t){let e=t[Cn];return e||(e=On(t,t[Cn]={},In,Dn),Un in t&&Cn in t&&(t.length=0),e)}const Un=Symbol();function Nn(t,e,n){const r=e.g;return n?(t,e,s)=>r(t,e,s,n):r}function Gn(t,e,n,r){const s=e.g;let i,o;return(t,e,a)=>s(t,e,a,o||=jn(n).L,i||=Tn(n),r)}function jn(t){let e=t[Un];return e||(Sn(t),e=On(t,t[Un]={},Nn,Gn),Un in t&&Cn in t&&(t.length=0),e)}function Vn(t,e){var n=t[e];if(n)return n;if((n=t.g)&&(n=n[e])){var r=n.U,s=n.ca.h;if(r){const t=Rn(r),e=Bn(r).L;n=(n,r,i)=>s(n,r,i,e,t)}else n=s;return t[e]=n}}function zn(t,e,n){for(var r=zt(t),s=+!!(512&r)-1,i=t.length,o=512&r?1:0,a=i+(256&r?-1:0);o<a;o++){const r=t[o];if(null==r)continue;const i=o-s,a=Vn(n,i);a&&a(e,r,i)}if(256&r){r=t[i-1];for(let t in r)s=+t,Number.isNaN(s)||null!=(i=r[t])&&(a=Vn(n,s))&&a(e,i,s)}if(t=se?t[se]:void 0)for(St(e,e.g.end()),n=0;n<t.length;n++)St(e,j(t[n])||D())}function Wn(t,e){return new Dt(t,e,!1)}function Xn(t,e){return new Dt(t,e,!0)}function Hn(t,e,n){ze(t,zt(t),e,n)}var qn=Wn((function(t,e,n,r,s){return 2===t.h&&(t=gt(t,Te([void 0,void 0],r),s),ee(r=zt(e)),(s=je(e,r,n))instanceof Fe?0!=(2&s.g)?((s=s.m()).push(t),ze(e,r,n,s)):s.I(t):Array.isArray(s)?(2&Vt(s)&&ze(e,r,n,s=Ye(s)),s.push(t)):ze(e,r,n,[t]),!0)}),(function(t,e,n,r,s){if(e instanceof Fe)e.forEach(((e,i)=>{It(t,n,Te([i,e],r),s)}));else if(Array.isArray(e))for(let i=0;i<e.length;i++){const o=e[i];Array.isArray(o)&&It(t,n,Te(o,r),s)}}));function $n(t,e,n){t:if(null!=e){if(ue(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&Et(e),null!=e&&(Ot(t,n,0),"number"==typeof e?(t=t.g,Z(e),xt(t,Y,J)):(n=Et(e),xt(t.g,n.h,n.g))))}function Kn(t,e,n){null!=(e=le(e))&&null!=e&&(Ot(t,n,0),Ft(t.g,e))}function Yn(t,e,n){null!=(e=ce(e))&&(Ot(t,n,0),t.g.g.push(e?1:0))}function Jn(t,e,n){null!=(e=ge(e))&&Ct(t,n,u(e))}function Zn(t,e,n,r,s){It(t,n,e instanceof _n?e.u:Array.isArray(e)?Te(e,r):void 0,s)}function Qn(t,e,n){null!=(e=null==e||"string"==typeof e||C(e)||e instanceof V?e:void 0)&&Ct(t,n,q(e).buffer)}function tr(t,e,n){return(5===t.h||2===t.h)&&(e=We(e,zt(e),n,2,!1),2==t.h?vt(t,lt.prototype.A,e):e.push(t.g.A()),!0)}var er=Wn((function(t,e,n){if(1!==t.h)return!1;var r=t.g;t=ht(r);const s=ht(r);r=2*(s>>31)+1;const i=s>>>20&2047;return t=4294967296*(1048575&s)+t,Hn(e,n,2047==i?t?NaN:1/0*r:0==i?r*Math.pow(2,-1074)*t:r*Math.pow(2,i-1075)*(t+4503599627370496)),!0}),(function(t,e,n){null!=(e=he(e))&&(Ot(t,n,1),t=t.g,(n=K||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),Y=n.getUint32(0,!0),J=n.getUint32(4,!0),Lt(t,Y),Lt(t,J))})),nr=Wn((function(t,e,n){return 5===t.h&&(Hn(e,n,t.g.A()),!0)}),(function(t,e,n){null!=(e=he(e))&&(Ot(t,n,5),t=t.g,Q(e),Lt(t,Y))})),rr=Xn(tr,(function(t,e,n){if(null!=(e=bn(he,e)))for(let i=0;i<e.length;i++){var r=t,s=e[i];null!=s&&(Ot(r,n,5),r=r.g,Q(s),Lt(r,Y))}})),sr=Xn(tr,(function(t,e,n){if(null!=(e=bn(he,e))&&e.length){Ot(t,n,2),Mt(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Q(e[r]),Lt(n,Y)}})),ir=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,ot(t.g,et)),!0)}),$n),or=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,0===(t=ot(t.g,et))?void 0:t),!0)}),$n),ar=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,ot(t.g,tt)),!0)}),(function(t,e,n){t:if(null!=e){if(ue(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&wt(e),null!=e&&(Ot(t,n,0),"number"==typeof e?(t=t.g,Z(e),xt(t,Y,J)):(n=wt(e),xt(t.g,n.h,n.g))))})),hr=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,t.g.m()),!0)}),Kn),cr=Xn((function(t,e,n){return(0===t.h||2===t.h)&&(e=We(e,zt(e),n,2,!1),2==t.h?vt(t,lt.prototype.m,e):e.push(t.g.m()),!0)}),(function(t,e,n){if(null!=(e=bn(le,e))&&e.length){n=Pt(t,n);for(let n=0;n<e.length;n++)Ft(t.g,e[n]);Rt(t,n)}})),ur=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,0===(t=t.g.m())?void 0:t),!0)}),Kn),lr=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,at(t.g)),!0)}),Yn),fr=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,!1===(t=at(t.g))?void 0:t),!0)}),Yn),dr=Xn((function(t,e,n){if(2!==t.h)return!1;t=mt(t);const r=zt(e);return ee(r),We(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=bn(ge,e)))for(let s=0;s<e.length;s++){var r=e[s];null!=r&&Ct(t,n,u(r))}})),pr=Wn((function(t,e,n){return 2===t.h&&(Hn(e,n,""===(t=mt(t))?void 0:t),!0)}),Jn),gr=Wn((function(t,e,n){return 2===t.h&&(Hn(e,n,mt(t)),!0)}),Jn),mr=Wn((function(t,e,n,r,s){return 2===t.h&&(gt(t,tn(e,r,n,!0),s),!0)}),Zn),yr=Wn((function(t,e,n,r,s){return 2===t.h&&(gt(t,tn(e,r,n),s),!0)}),Zn),vr=Xn((function(t,e,n,r,s){if(2!==t.h)return!1;r=Te(void 0,r);const i=zt(e);ee(i);let o=We(e,i,n,3);return(Object.isFrozen(o)||4&Vt(o))&&(o=Bt(o),ze(e,i,n,o)),o.push(r),gt(t,r,s),!0}),(function(t,e,n,r,s){if(Array.isArray(e))for(let i=0;i<e.length;i++)Zn(t,e[i],n,r,s)})),_r=Wn((function(t,e,n,r,s,i){if(2!==t.h)return!1;const o=zt(e);return ee(o),(i=Qe(e,o,i))&&n!==i&&ze(e,o,i),gt(t,e=tn(e,r,n),s),!0}),Zn),wr=Wn((function(t,e,n){return 2===t.h&&(Hn(e,n,yt(t)),!0)}),Qn),Ar=Xn((function(t,e,n){return(0===t.h||2===t.h)&&(e=We(e,zt(e),n,2,!1),2==t.h?vt(t,lt.prototype.j,e):e.push(t.g.j()),!0)}),(function(t,e,n){if(null!=(e=bn(fe,e)))for(let i=0;i<e.length;i++){var r=t,s=e[i];null!=s&&(Ot(r,n,0),Mt(r.g,s))}})),br=Wn((function(t,e,n){return 0===t.h&&(Hn(e,n,t.g.m()),!0)}),(function(t,e,n){null!=(e=le(e))&&(e=parseInt(e,10),Ot(t,n,0),Ft(t.g,e))})),Er=Xn((function(t,e,n){return(0===t.h||2===t.h)&&(e=We(e,zt(e),n,2,!1),2==t.h?vt(t,lt.prototype.C,e):e.push(t.g.m()),!0)}),(function(t,e,n){if(null!=(e=bn(le,e))&&e.length){n=Pt(t,n);for(let n=0;n<e.length;n++)Ft(t.g,e[n]);Rt(t,n)}}));class Tr{constructor(t,e){this.h=t,this.g=e,this.l=nn,this.m=on,this.defaultValue=void 0}}function kr(t,e){return new Tr(t,e)}function xr(t,e){return(n,r)=>{t:{if(_t.length){const t=_t.pop();t.o(r),st(t.g,n,r),n=t}else n=new class{constructor(t,e){if(ft.length){const n=ft.pop();st(n,t,e),t=n}else t=new lt(t,e);this.g=t,this.l=this.g.g,this.h=this.m=-1,this.o(e)}o({aa:t=!1}={}){this.aa=t}}(n,r);try{var s=new t;const r=s.u;Tn(e)(r,n),ie&&delete r[ie];var i=s;break t}finally{(s=n.g).h=null,s.s=!1,s.v=0,s.l=0,s.g=0,s.R=!1,n.m=-1,n.h=-1,100>_t.length&&_t.push(n)}i=void 0}return i}}function Mr(t){return function(){const e=new class{constructor(){this.l=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};zn(this.u,e,Bn(t)),St(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,s=r.length;let i=0;for(let t=0;t<s;t++){const e=r[t];n.set(e,i),i+=e.length}return e.l=[n],n}}var Fr=[0,pr,Wn((function(t,e,n){return 2===t.h&&(Hn(e,n,(t=yt(t))===G()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof _n){const r=e.Ea;return void(r&&(e=r(e),null!=e&&Ct(t,n,q(e).buffer)))}if(Array.isArray(e))return}Qn(t,e,n)}))],Lr=[0,gr],Sr=[0,hr,br,lr,lr,cr,br,br],Or=[0,lr,lr],Pr=class extends _n{constructor(){super()}};Pr.B=[6];var Rr=[0,lr,gr,lr,br,br,Er,gr,gr,yr,Or,br],Cr=[0,gr,gr,gr],Ir=class extends _n{constructor(){super()}},Dr=[0],Br=[0,hr],Ur=[1,2,3,4,5],Nr=class extends _n{constructor(t){super(t,2)}},Gr={},jr=[-2,Gr,lr];Gr[336783863]=An([0,gr,lr,lr,hr,yr,[0,_r,Dr,Ur,_r,Rr,Ur,_r,Cr,Ur,_r,Br,Ur,_r,Sr,Ur],yr,Lr]);var Vr=[0,pr,fr],zr=[0,or,or,fr,fr,fr,fr,or,cr,pr,ur,or,or,fr,ur,fr,fr,fr,pr],Wr=[-1,{}],Xr=[0,gr,yr,2,Wr],Hr=[0,gr,dr,yr,Wr];function qr(t,e){e=pe(e),t=t.u;const n=zt(t);ee(n),ze(t,n,2,""===e?void 0:e)}function $r(t,e){yn(t,3,e)}function Kr(t,e){yn(t,4,e)}var Yr=class extends _n{constructor(t){super(t,500)}o(t){return on(this,0,7,t)}};Yr.B=[3,4,5,6,8,13,17,1005];var Jr=[-500,pr,pr,dr,dr,dr,dr,yr,jr,vr,Fr,ur,ur,yr,Xr,yr,Hr,vr,Vr,pr,yr,zr,ur,dr,dr,988],Zr=[0,pr,pr,yr,Wr],Qr=[-500,gr,gr,yr,[-1,{}],gr,999],ts=[-500,gr,dr,dr,yr,[-2,{},lr],dr,998,dr],es=[-500,gr,dr,yr,Wr,dr,999];function ns(t,e){hn(t,Yr,e)}function rs(t,e){yn(t,10,e)}function ss(t,e){yn(t,15,e)}var is=class extends _n{constructor(t){super(t,500)}o(t){return on(this,0,1001,t)}};is.B=[1,6,7,9,10,15,16,17,14,1002];var os=[-500,vr,Jr,vr,5,Qr,vr,ts,ur,vr,es,dr,ur,yr,Xr,yr,Hr,vr,Zr,dr,dr,dr,yr,zr,pr,pr,fr,yr,980,Wr,vr,Fr],as=xr(is,os);is.prototype.g=Mr(os);var hs=[0,vr,[0,hr,hr,hr]],cs=class extends _n{constructor(t){super(t)}},us=[0,hr,nr,gr,gr],ls=class extends _n{constructor(t){super(t)}g(){return sn(this,cs,1)}};ls.B=[1];var fs=[0,vr,us],ds=xr(ls,fs),ps=[0,hr,nr],gs=[0,hr,hr,yr,hs],ms=class extends _n{constructor(t){super(t)}},ys=[0,hr,hr,hr,hr],vs=[0,nr,nr,nr,nr],_s=class extends _n{constructor(t){super(t)}},ws=[0,nr,nr,gr,nr],As=class extends _n{constructor(t){super(t)}h(){return nn(this,ms,2)}g(){return sn(this,_s,5)}};As.B=[5];var bs=[0,br,yr,ys,yr,vs,yr,gs,vr,ws],Es=class extends _n{constructor(t){super(t)}};Es.B=[1,2,3,8,9];var Ts=xr(Es,[0,dr,cr,sr,yr,bs,gr,gr,ir,vr,ps,dr,ir]),ks=class extends _n{constructor(t){super(t)}},xs=[0,nr,nr,nr,nr,nr],Ms=class extends _n{constructor(t){super(t)}};Ms.B=[1];var Fs=xr(Ms,[0,vr,xs]),Ls=class extends _n{constructor(t){super(t)}},Ss=[0,nr,nr,nr,nr,nr],Os=class extends _n{constructor(t){super(t)}};Os.B=[1];var Ps=xr(Os,[0,vr,Ss]),Rs=class extends _n{constructor(t){super(t)}};Rs.B=[3];var Cs=[0,hr,hr,sr,br],Is=class extends _n{constructor(){super()}};Is.prototype.g=Mr([0,nr,nr,nr,nr,nr,ir]);var Ds=class extends _n{constructor(t){super(t)}},Bs=[0,hr,2,gr,yr,fs],Us=class extends _n{constructor(t){super(t)}};Us.B=[1];var Ns=xr(Us,[0,vr,Bs,ir]),Gs=class extends _n{constructor(t){super(t)}};Gs.B=[1];var js=class extends _n{constructor(t){super(t)}fa(){const t=He(this);return null==t?G():t}},Vs=class extends _n{constructor(t){super(t)}},zs=[1,2],Ws=[0,_r,[0,sr],zs,_r,[0,wr],zs,hr,gr],Xs=class extends _n{constructor(t){super(t)}};Xs.B=[1];var Hs=xr(Xs,[0,vr,Ws,ir]),qs=class extends _n{constructor(t){super(t)}};qs.B=[4,5];var $s=[0,gr,hr,nr,dr,dr],Ks=class extends _n{constructor(t){super(t)}},Ys=[0,lr,lr],Js=class extends _n{constructor(t){super(t)}},Zs=[1,2,3,4,5],Qs=class extends _n{constructor(t){super(t)}g(){return null!=He(this)}h(){return null!=ln(this,2)}},ti=[0,wr,gr,yr,[0,hr,ir,ir],yr,[0,ar,ir]],ei=class extends _n{constructor(t){super(t)}g(){return ce(Ge(this,2))??!1}},ni=[0,yr,ti,lr,yr,[0,_r,Br,Zs,_r,Rr,Zs,_r,Sr,Zs,_r,Dr,Zs,_r,Cr,Zs]],ri=class extends _n{constructor(t){super(t)}},si=[0,yr,ni,nr,nr,hr],ii=kr(502141897,ri);Gr[502141897]=An(si);var oi=[0,yr,ti];Gr[512499200]=An(oi);var ai=[0,yr,oi];Gr[515723506]=An(ai);var hi=xr(class extends _n{constructor(t){super(t)}},[0,yr,[0,br,br,rr,Ar],yr,Cs]),ci=[0,yr,ni];Gr[508981768]=An(ci);var ui=class extends _n{constructor(t){super(t)}},li=[0,yr,ni,nr,yr,ci,lr],fi=class extends _n{constructor(t){super(t)}},di=[0,yr,ni,yr,si,yr,li,nr,yr,ai];Gr[508968149]=An(li);var pi=kr(508968150,fi);Gr[508968150]=An(di);var gi=class extends _n{constructor(t){super(t)}},mi=kr(513916220,gi);Gr[513916220]=An([0,yr,ni,yr,di,hr]);var yi=class extends _n{constructor(t){super(t)}h(){return nn(this,qs,2)}g(){Ve(this,2)}},vi=[0,yr,ni,yr,$s];Gr[478825465]=An(vi);var _i=[0,yr,ni];Gr[478825422]=An(_i);var wi=class extends _n{constructor(t){super(t)}},Ai=[0,yr,ni,yr,_i,yr,vi,yr,vi],bi=class extends _n{constructor(t){super(t)}},Ei=[0,yr,ni,nr,hr],Ti=class extends _n{constructor(t){super(t)}},ki=[0,yr,ni,nr],xi=class extends _n{constructor(t){super(t)}},Mi=[0,yr,ni,yr,Ei,yr,ki,nr],Fi=class extends _n{constructor(t){super(t)}},Li=[0,yr,ni,yr,Mi,yr,Ai];Gr[463370452]=An(Ai),Gr[464864288]=An(Ei),Gr[474472470]=An(ki);var Si=kr(462713202,xi);Gr[462713202]=An(Mi);var Oi=kr(479097054,Fi);Gr[479097054]=An(Li);var Pi=class extends _n{constructor(t){super(t)}},Ri=kr(456383383,Pi);Gr[456383383]=An([0,yr,ni,yr,$s]);var Ci=class extends _n{constructor(t){super(t)}},Ii=kr(476348187,Ci);Gr[476348187]=An([0,yr,ni,yr,Ys]);var Di=class extends _n{constructor(t){super(t)}},Bi=[0,br,br],Ui=class extends _n{constructor(t){super(t)}};Ui.B=[3];var Ni=kr(458105876,class extends _n{constructor(t){super(t)}g(){var t=this.u;const e=zt(t);var n=2&e;return t=function(t,e,n){var r=Ui;const s=2&e;let i=!1;if(null==n){if(s)return Ke();n=[]}else if(n.constructor===Fe){if(0==(2&n.g)||s)return n;n=n.m()}else Array.isArray(n)?i=!!(2&Vt(n)):n=[];if(s){if(!n.length)return Ke();i||(i=!0,Ht(n))}else i&&(i=!1,n=Ye(n));return i||(64&Vt(n)?jt(n,32):32&e&&Nt(n,32)),ze(t,e,2,r=new Fe(n,r,_e,void 0),!1),r}(t,e,je(t,e,2)),null==t||!n&&Ui&&(t.v=!0),t}});Gr[458105876]=An([0,yr,Bi,qn,[!0,ir,yr,[0,gr,gr,dr]]]);var Gi=class extends _n{constructor(t){super(t)}},ji=kr(458105758,Gi);Gr[458105758]=An([0,yr,ni,gr,yr,Bi]);var Vi=class extends _n{constructor(t){super(t)}};Vi.B=[5,6];var zi=kr(443442058,Vi);Gr[443442058]=An([0,yr,ni,gr,hr,nr,dr,dr]);var Wi=class extends _n{constructor(t){super(t)}},Xi=[0,yr,ni,nr,nr,hr];Gr[514774813]=An(Xi);var Hi=class extends _n{constructor(t){super(t)}},qi=[0,yr,ni,nr,lr],$i=class extends _n{constructor(t){super(t)}},Ki=[0,yr,ni,yr,Xi,yr,qi,nr];Gr[518928384]=An(qi);var Yi=kr(516587230,$i);function Ji(t,e){return e=e?e.clone():new qs,void 0!==t.displayNamesLocale?Ve(e,1,pe(t.displayNamesLocale)):void 0===t.displayNamesLocale&&Ve(e,1),void 0!==t.maxResults?gn(e,2,t.maxResults):"maxResults"in t&&Ve(e,2),void 0!==t.scoreThreshold?mn(e,3,t.scoreThreshold):"scoreThreshold"in t&&Ve(e,3),void 0!==t.categoryAllowlist?Je(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&Ve(e,4),void 0!==t.categoryDenylist?Je(e,5,t.categoryDenylist):"categoryDenylist"in t&&Ve(e,5),e}function Zi(t,e=-1,n=""){return{categories:t.map((t=>({index:fn(cn(t,1))??-1,score:dn(t,2)??0,categoryName:ln(t,3)??""??"",displayName:ln(t,4)??""??""}))),headIndex:e,headName:n}}function Qi(t){var e=qe(t,3,he),n=qe(t,2,le);const r=qe(t,1,ge),s=qe(t,9,ge),i={categories:[],keypoints:[]};for(let t=0;t<e.length;t++)i.categories.push({score:e[t],index:n[t]??-1,categoryName:r[t]??"",displayName:s[t]??""});if((e=nn(t,As,4)?.h())&&(i.boundingBox={originX:cn(e,1)??0,originY:cn(e,2)??0,width:cn(e,3)??0,height:cn(e,4)??0,angle:0}),nn(t,As,4)?.g().length)for(const e of nn(t,As,4).g())i.keypoints.push({x:Xe(e,1)??0,y:Xe(e,2)??0,score:Xe(e,4)??0,label:ln(e,3)??""});return i}function to(t){const e=[];for(const n of sn(t,Ls,1))e.push({x:dn(n,1)??0,y:dn(n,2)??0,z:dn(n,3)??0});return e}function eo(t){const e=[];for(const n of sn(t,ks,1))e.push({x:dn(n,1)??0,y:dn(n,2)??0,z:dn(n,3)??0});return e}function no(t){return Array.from(t,(t=>127<t?t-256:t))}function ro(t,e){if(t.length!==e.length)throw Error(`Cannot compute cosine similarity between embeddings of different sizes (${t.length} vs. ${e.length}).`);let n=0,r=0,s=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i],r+=t[i]*t[i],s+=e[i]*e[i];if(0>=r||0>=s)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*s)}let so;Gr[516587230]=An(Ki);const io=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 oo(){if(void 0===so)try{await WebAssembly.instantiate(io),so=!0}catch{so=!1}return so}async function ao(t,e=""){const n=await oo()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var ho=class{};function co(){const t=navigator.userAgent;return t.includes("Safari")&&!t.includes("Chrome")}async function uo(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}function lo(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function fo(t,e,n){if(!t.i.canvas)throw Error("No OpenGL canvas configured.");if(n?t.i._bindTextureToStream(n):t.i._bindTextureToCanvas(),!(n=t.i.canvas.getContext("webgl2")||t.i.canvas.getContext("webgl")))throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");return t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e),t.i.gpuOriginForWebTexturesIsBottomLeft&&n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!1),e.videoWidth?(n=e.videoWidth,e=e.videoHeight):e.naturalWidth?(n=e.naturalWidth,e=e.naturalHeight):(n=e.width,e=e.height),!t.l||n===t.i.canvas.width&&e===t.i.canvas.height||(t.i.canvas.width=n,t.i.canvas.height=e),[n,e]}function po(t,e,n){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function go(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function mo(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,s)=>{e?(n(r,s),r=[]):r.push(t)}}function yo(t,e){const n=nn(t.baseOptions,Qs,1)||new Qs;"string"==typeof e?(Ve(n,2,pe(e)),Ve(n,1)):e instanceof Uint8Array&&(Ve(n,1,Qt(e,!1,!1)),Ve(n,2)),on(t.baseOptions,0,1,n)}function vo(t){try{const e=t.J.length;if(1===e)throw Error(t.J[0].message);if(1<e)throw Error("Encountered multiple errors: "+t.J.map((t=>t.message)).join(", "))}finally{t.J=[]}}function _o(t,e){t.I=Math.max(t.I,e)}function wo(t,e){t.A=new Yr,qr(t.A,"PassThroughCalculator"),$r(t.A,"free_memory"),Kr(t.A,"free_memory_unused_out"),rs(e,"free_memory"),ns(e,t.A)}function Ao(t,e){$r(t.A,e),Kr(t.A,e+"_unused_out")}function bo(t){t.g.addBoolToStream(!0,"free_memory",t.I)}ho.forVisionTasks=function(t){return ao("vision",t)},ho.forTextTasks=function(t){return ao("text",t)},ho.forAudioTasks=function(t){return ao("audio",t)},ho.isSimdSupported=function(){return oo()};var Eo=class{constructor(t){this.g=t,this.J=[],this.I=0,this.g.setAutoRenderToScreen(!1)}l(t,e=!0){if(e){const e=t.baseOptions||{};if(t.baseOptions?.modelAssetBuffer&&t.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(nn(this.baseOptions,Qs,1)?.g()||nn(this.baseOptions,Qs,1)?.h()||t.baseOptions?.modelAssetBuffer||t.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=nn(t.baseOptions,Js,3);if(!n){var r=n=new Js,s=new Ir;an(r,4,Zs,s)}"delegate"in e&&("GPU"===e.delegate?(e=n,r=new Pr,an(e,2,Zs,r)):(e=n,r=new Ir,an(e,4,Zs,r))),on(t.baseOptions,0,3,n)}(this,e),e.modelAssetPath)return fetch(e.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${e.modelAssetPath} (${t.status})`)})).then((t=>{try{this.g.i.FS_unlink("/model.dat")}catch{}this.g.i.FS_createDataFile("/","model.dat",new Uint8Array(t),!0,!1,!1),yo(this,"/model.dat"),this.m(),this.P()}));yo(this,e.modelAssetBuffer)}return this.m(),this.P(),Promise.resolve()}P(){}W(){let t;if(this.g.W((e=>{t=as(e)})),!t)throw Error("Failed to retrieve CalculatorGraphConfig");return t}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.J.push(Error(e))})),this.g.Aa(),this.g.setGraph(t,e),this.A=void 0,vo(this)}finishProcessing(){this.g.finishProcessing(),vo(this)}close(){this.A=void 0,this.g.closeGraph()}};function To(t,e){if(null===t)throw Error(`Unable to obtain required WebGL resource: ${e}`);return t}Eo.prototype.close=Eo.prototype.close;class ko{constructor(t,e,n,r){this.g=t,this.h=e,this.m=n,this.l=r}bind(){this.g.bindVertexArray(this.h)}close(){this.g.deleteVertexArray(this.h),this.g.deleteBuffer(this.m),this.g.deleteBuffer(this.l)}}function xo(t,e,n){const r=t.h;if(n=To(r.createShader(n),"Failed to create WebGL shader"),r.shaderSource(n,e),r.compileShader(n),!r.getShaderParameter(n,r.COMPILE_STATUS))throw Error(`Could not compile WebGL shader: ${r.getShaderInfoLog(n)}`);return r.attachShader(t.g,n),n}function Mo(t,e){const n=t.h,r=To(n.createVertexArray(),"Failed to create vertex array");n.bindVertexArray(r);const s=To(n.createBuffer(),"Failed to create buffer");n.bindBuffer(n.ARRAY_BUFFER,s),n.enableVertexAttribArray(t.s),n.vertexAttribPointer(t.s,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW);const i=To(n.createBuffer(),"Failed to create buffer");return n.bindBuffer(n.ARRAY_BUFFER,i),n.enableVertexAttribArray(t.A),n.vertexAttribPointer(t.A,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array(e?[0,1,0,0,1,0,1,1]:[0,0,0,1,1,1,1,0]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.bindVertexArray(null),new ko(n,r,s,i)}function Fo(t,e){if(t.h){if(e!==t.h)throw Error("Cannot change GL context once initialized")}else t.h=e}function Lo(t,e,n,r){if(Fo(t,e),!t.g){const e=t.h;if(t.g=To(e.createProgram(),"Failed to create WebGL program"),t.C=xo(t,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",e.VERTEX_SHADER),t.v=xo(t,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D inputTexture;\n void main() {\n gl_FragColor = texture2D(inputTexture, vTex);\n }\n ",e.FRAGMENT_SHADER),e.linkProgram(t.g),!e.getProgramParameter(t.g,e.LINK_STATUS))throw Error(`Error during program linking: ${e.getProgramInfoLog(t.g)}`);t.s=e.getAttribLocation(t.g,"aVertex"),t.A=e.getAttribLocation(t.g,"aTex")}return n?(t.m||(t.m=Mo(t,!0)),n=t.m):(t.j||(t.j=Mo(t,!1)),n=t.j),e.useProgram(t.g),n.bind(),t=r(),n.g.bindVertexArray(null),t}function So(t,e,n){Fo(t,e),t.l||(t.l=To(e.createFramebuffer(),"Failed to create framebuffe.")),e.bindFramebuffer(e.FRAMEBUFFER,t.l),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0)}function Oo(t){t.h?.bindFramebuffer(t.h.FRAMEBUFFER,null)}var Po=class{close(){if(this.g){const t=this.h;t.deleteProgram(this.g),t.deleteShader(this.C),t.deleteShader(this.v)}this.l&&this.h.deleteFramebuffer(this.l),this.j&&this.j.close(),this.m&&this.m.close()}};function Ro(t,e){switch(e){case 0:return t.g.find((t=>t instanceof ImageData));case 1:return t.g.find((t=>"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap));case 2:return t.g.find((t=>"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture));default:throw Error(`Type is not supported: ${e}`)}}function Co(t){var e=Ro(t,0);if(!e){e=Do(t);const n=Bo(t),r=new Uint8Array(t.width*t.height*4);So(n,e,Io(t)),e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,r),Oo(n),e=new ImageData(new Uint8ClampedArray(r.buffer),t.width,t.height),t.g.push(e)}return e}function Io(t){let e=Ro(t,2);if(!e){const n=Do(t);e=No(t);const r=Ro(t,1)||Co(t);n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,r),Go(t)}return e}function Do(t){if(!t.canvas)throw Error("Conversion to different image formats require that a canvas is passed when iniitializing the image.");return t.h||(t.h=To(t.canvas.getContext("webgl2"),"You cannot use a canvas that is already bound to a different type of rendering context.")),t.h}function Bo(t){return t.l||(t.l=new Po),t.l}function Uo(t){(t=Do(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,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR)}function No(t){const e=Do(t);e.viewport(0,0,t.width,t.height),e.activeTexture(e.TEXTURE0);let n=Ro(t,2);return n?e.bindTexture(e.TEXTURE_2D,n):(n=To(e.createTexture(),"Failed to create texture"),t.g.push(n),t.m=!0,e.bindTexture(e.TEXTURE_2D,n),Uo(t)),n}function Go(t){t.h.bindTexture(t.h.TEXTURE_2D,null)}function jo(t){const e=Do(t);return Lo(Bo(t),e,!0,(()=>function(t,e){const n=t.canvas;if(n.width===t.width&&n.height===t.height)return e();const r=n.width,s=n.height;return n.width=t.width,n.height=t.height,t=e(),n.width=r,n.height=s,t}(t,(()=>{if(e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),e.drawArrays(e.TRIANGLE_FAN,0,4),!(t.canvas instanceof OffscreenCanvas))throw Error("Conversion to ImageBitmap requires that the MediaPipe Tasks is initialized with an OffscreenCanvas");return t.canvas.transferToImageBitmap()}))))}var Vo=class{constructor(t,e,n,r,s,i,o){this.g=t,this.j=e,this.m=n,this.canvas=r,this.l=s,this.width=i,this.height=o,(this.j||this.m)&&0==--zo&&console.error("You seem to be creating MPImage instances without invoking .close(). This leaks resources.")}va(){return!!Ro(this,0)}ba(){return!!Ro(this,1)}K(){return!!Ro(this,2)}ra(){return Co(this)}qa(){var t=Ro(this,1);return t||(Io(this),No(this),t=jo(this),Go(this),this.g.push(t),this.j=!0),t}V(){return Io(this)}clone(){const t=[];for(const e of this.g){let n;if(e instanceof ImageData)n=new ImageData(e.data,this.width,this.height);else if(e instanceof WebGLTexture){const t=Do(this),e=Bo(this);t.activeTexture(t.TEXTURE1),n=To(t.createTexture(),"Failed to create texture"),t.bindTexture(t.TEXTURE_2D,n),Uo(this),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.bindTexture(t.TEXTURE_2D,null),So(e,t,n),Lo(e,t,!1,(()=>{No(this),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4),Go(this)})),Oo(e),Go(this)}else{if(!(e instanceof ImageBitmap))throw Error(`Type is not supported: ${e}`);Io(this),No(this),n=jo(this),Go(this)}t.p