UNPKG

@viji-dev/core

Version:

Universal execution engine for Viji Creative scenes

1 lines 139 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof self?self:{};function e(e,n){e=e.split(".");var r,i=t;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(r=e.shift());)e.length||void 0===n?i=i[r]&&i[r]!==Object.prototype[r]?i[r]:i[r]={}:i[r]=n}function n(){throw Error("Invalid UTF8")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,s;const o="undefined"!=typeof TextDecoder;let a;const c="undefined"!=typeof TextEncoder;function h(t){if(c)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(e<128)r[n++]=e;else{if(e<2048)r[n++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&i<t.length){const s=t.charCodeAt(++i);if(s>=56320&&s<=57343){e=1024*(e-55296)+s-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}i--}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 u,l;t:{for(var f=["CLOSURE_FLAGS"],d=t,p=0;p<f.length;p++)if(null==(d=d[f[p]])){l=null;break t}l=d}var g,m=l&&l[610401301];u=null!=m&&m;const y=t.navigator;function _(t){return!!u&&(!!g&&g.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function v(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function E(){return!!u&&(!!g&&g.brands.length>0)}function w(){return E()?_("Chromium"):(v("Chrome")||v("CriOS"))&&!(!E()&&v("Edge"))||v("Silk")}function T(t){return T[" "](t),t}g=y&&y.userAgentData||null,T[" "]=function(){};var b=!E()&&(v("Trident")||v("MSIE"));!v("Android")||w(),w(),v("Safari")&&(w()||!E()&&v("Coast")||!E()&&v("Opera")||!E()&&v("Edge")||(E()?_("Microsoft Edge"):v("Edg/"))||E()&&_("Opera"));var A={},k=null;function x(t){const e=t.length;let 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);const r=new Uint8Array(n);let i=0;return function(t,e){function n(e){for(;r<t.length;){const e=t.charAt(r++),n=k[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}S();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),s=n(64);if(64===s&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=s&&e(i<<6&192|s))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function S(){if(!k){k={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));A[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===k[e]&&(k[e]=t)}}}}var L="undefined"!=typeof Uint8Array,R=!b&&"function"==typeof btoa;function F(t){if(!R){var e;void 0===e&&(e=0),S(),e=A[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let c=0,h=0;for(;c<t.length-2;c+=3){var i=t[c],s=t[c+1],o=t[c+2],a=e[i>>2];i=e[(3&i)<<4|s>>4],s=e[(15&s)<<2|o>>6],o=e[63&o],n[h++]=a+i+s+o}switch(a=0,o=r,t.length-c){case 2:o=e[(15&(a=t[c+1]))<<2]||r;case 1:t=t[c],n[h]=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 I=/[-_.]/g,M={"-":"+",_:"/",".":"="};function P(t){return M[t]||""}function O(t){if(!R)return x(t);I.test(t)&&(t=t.replace(I,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 L&&null!=t&&t instanceof Uint8Array}var U={};function N(){return G||=new B(null,U)}function D(t){V(U);var e=t.g;return null==(e=null==e||C(e)?e:"string"==typeof e?O(e):null)?e:t.g=e}var B=class{h(){return new Uint8Array(D(this)||0)}constructor(t,e){if(V(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let G,j;function V(t){if(t!==U)throw Error("illegal external caller")}function X(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function H(){const e=Error();X(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function W(t){return X(t=Error(t),"warning"),t}function z(){return"function"==typeof BigInt}function K(t){return Array.prototype.slice.call(t)}var Y="function"==typeof Symbol&&"symbol"==typeof Symbol();function $(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var q=$(),J=$("0di"),Z=$("2ex"),Q=$("1oa"),tt=Y?(t,e)=>{t[q]|=e}:(t,e)=>{void 0!==t.G?t.G|=e:Object.defineProperties(t,{G:{value:e,configurable:!0,writable:!0,enumerable:!1}})},et=Y?(t,e)=>{t[q]&=~e}:(t,e)=>{void 0!==t.G&&(t.G&=~e)},nt=Y?t=>0|t[q]:t=>0|t.G,rt=Y?t=>t[q]:t=>t.G,it=Y?(t,e)=>{t[q]=e}:(t,e)=>{void 0!==t.G?t.G=e:Object.defineProperties(t,{G:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function st(t){return tt(t,34),t}function ot(t,e){it(e,-30975&(0|t))}function at(t,e){it(e,-30941&(34|t))}var ct,ht={},ut={};function lt(t){return!(!t||"object"!=typeof t||t.Ia!==ut)}function ft(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function dt(t,e){if(null!=t)if("string"==typeof t)t=t?new B(t,U):N();else if(t.constructor!==B)if(C(t))t=t.length?new B(new Uint8Array(t),U):N();else{if(!e)throw Error();t=void 0}return t}function pt(t){return!(!Array.isArray(t)||t.length)&&!!(1&nt(t))}const gt=[];function mt(t){if(2&t)throw Error()}it(gt,55),ct=Object.freeze(gt);class yt{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 yt(this.g,this.h,this.m)}}let _t;function vt(t,e){(e=_t?e[_t]:void 0)&&(t[_t]=K(e))}var Et=Object.freeze({});function wt(t){return t.Pa=!0,t}var Tt=wt((t=>"number"==typeof t)),bt=wt((t=>"string"==typeof t)),At=wt((t=>"boolean"==typeof t)),kt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),xt=wt((t=>kt?t>=Lt&&t<=Ft:"-"===t[0]?It(t,St):It(t,Rt)));const St=Number.MIN_SAFE_INTEGER.toString(),Lt=kt?BigInt(Number.MIN_SAFE_INTEGER):void 0,Rt=Number.MAX_SAFE_INTEGER.toString(),Ft=kt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function It(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let n=0;n<t.length;n++){const r=t[n],i=e[n];if(r>i)return!1;if(r<i)return!0}}const Mt="function"==typeof Uint8Array.prototype.slice;let Pt,Ot=0,Ct=0;function Ut(t){const e=t>>>0;Ot=e,Ct=(t-e)/4294967296>>>0}function Nt(t){if(t<0){Ut(-t);const[e,n]=Ht(Ot,Ct);Ot=e>>>0,Ct=n>>>0}else Ut(t)}function Dt(t){const e=Pt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Ct=0,Ot=e.getUint32(0,!0)}function Bt(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:jt(t,e)}function Gt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),"number"==typeof(t=Bt(t,e))?n?-t:t:n?"-"+t:t}function jt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else z()?n=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(n=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),n+=8147497*e,e*=2,t>=1e7&&(n+=t/1e7>>>0,t%=1e7),n>=1e7&&(e+=n/1e7>>>0,n%=1e7),n=e+Vt(n)+Vt(t));return n}function Vt(t){return t=String(t),"0000000".slice(t.length)+t}function Xt(t){if(t.length<16)Nt(Number(t));else if(z())t=BigInt(t),Ot=Number(t&BigInt(4294967295))>>>0,Ct=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);Ct=Ot=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));Ct*=1e6,Ot=1e6*Ot+e,Ot>=4294967296&&(Ct+=Math.trunc(Ot/4294967296),Ct>>>=0,Ot>>>=0)}if(e){const[t,e]=Ht(Ot,Ct);Ot=t,Ct=e}}}function Ht(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Wt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function zt(t){return null==t||"boolean"==typeof t?t:"number"==typeof t?!!t:void 0}const Kt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Yt(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&Kt.test(t)}function $t(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t&&Number.isFinite(t)?0|t:void 0}function qt(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t&&Number.isFinite(t)?t>>>0:void 0}function Jt(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function Zt(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(Nt(t),t=Gt(Ot,Ct)),t}function Qt(t){var e=Math.trunc(Number(t));if(Number.isSafeInteger(e))return String(e);if(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),!("-"===t[0]?t.length<20||20===t.length&&Number(t.substring(0,7))>-922337:t.length<19||19===t.length&&Number(t.substring(0,6))<922337))if(Xt(t),t=Ot,2147483648&(e=Ct))if(z())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ht(t,e);t="-"+jt(n,r)}else t=jt(t,e);return t}function te(t){return null==t?t:"bigint"==typeof t?(xt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=xt(t)?Number(t):String(t)),t):Yt(t)?"number"==typeof t?Zt(t):Qt(t):void 0}function ee(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Yt(t)){if("string"===e)return e=Math.trunc(Number(t)),Number.isSafeInteger(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Jt(t)||(Xt(t),t=jt(Ot,Ct))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){Nt(t);var e=jt(Ot,Ct);return t=Number(e),Number.isSafeInteger(t)?t:e}return Jt(e=String(t))?e:(Nt(t),Bt(Ot,Ct))}(t)}}function ne(t){if("string"!=typeof t)throw Error();return t}function re(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function ie(t){return null==t||"string"==typeof t?t:void 0}function se(t,e,n,r){if(null!=t&&"object"==typeof t&&t.X===ht)return t;if(!Array.isArray(t))return n?2&r?(t=e[J])?e=t:(st((t=new e).u),e=e[J]=t):e=new e:e=void 0,e;let i=n=nt(t);return 0===i&&(i|=32&r),i|=2&r,i!==n&&it(t,i),new e(t)}function oe(t,e,n){if(e)t:{if(!Yt(e=t))throw W("int64");switch(typeof e){case"string":e=Qt(e);break t;case"bigint":if(t=e=BigInt.asIntN(64,e),bt(t)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(t))throw Error(String(t))}else if(Tt(t)&&!Number.isSafeInteger(t))throw Error(String(t));e=kt?BigInt(e):At(e)?e?"1":"0":bt(e)?e.trim()||"0":String(e);break t;default:e=Zt(e)}}else e=te(t);return"string"==typeof(n=null==(t=e)?n?0:void 0:t)&&(e=+n,Number.isSafeInteger(e))?e:n}function ae(t){var e;return void 0===ue&&(ue="function"==typeof Proxy?me(Proxy):null),(e=!ue)||(void 0===le&&(le="function"==typeof WeakMap?me(WeakMap):null),e=!le),e?t:(e=ce?.get(t))?e:Math.random()>.01?t:(function(t){if(void 0===fe){const t=new ue([],{});fe=1===Array.prototype.concat.call([],t).length}fe&&"function"==typeof Symbol&&Symbol.isConcatSpreadable&&(t[Symbol.isConcatSpreadable]=!0)}(t),function(t,e){(ce||=new le).set(t,e),(he||=new le).set(e,t)}(t,e=new ue(t,{set:(t,e,n)=>(H(),t[e]=n,!0)})),e)}let ce,he,ue,le,fe,de,pe,ge;function me(t){try{return-1!==t.toString().indexOf("[native code]")?t:null}catch{return null}}function ye(t,e,n){return t=_e(t,e[0],e[1],n?1:2),e!==pe&&n&&tt(t,16384),t}function _e(t,e,n,r){if(r=r??0,null==t&&(t=de),de=void 0,null==t){var i=96;n?(t=[n],i|=512):t=[],e&&(i=-33521665&i|(1023&e)<<15)}else{if(!Array.isArray(t))throw Error("narr");if(2048&(i=nt(t)))throw Error("farr");if(64&i)return t;if(1===r||2===r||(i|=64),n&&(i|=512,n!==t[0]))throw Error("mid");t:{if(r=(n=t).length){const t=r-1;if(ft(n[t])){if((e=t-(+!!(512&(i|=256))-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,r-(+!!(512&i)-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&e)<<15}}}return it(t,i),t}const ve={};let Ee=function(){try{return T(new class extends Map{constructor(){super()}}),!1}catch{return!0}}();class we{constructor(){this.g=new Map}get(t){return this.g.get(t)}set(t,e){return this.g.set(t,e),this.size=this.g.size,this}delete(t){return t=this.g.delete(t),this.size=this.g.size,t}clear(){this.g.clear(),this.size=this.g.size}has(t){return this.g.has(t)}entries(){return this.g.entries()}keys(){return this.g.keys()}values(){return this.g.values()}forEach(t,e){return this.g.forEach(t,e)}[Symbol.iterator](){return this.entries()}}const Te=Ee?(Object.setPrototypeOf(we.prototype,Map.prototype),Object.defineProperties(we.prototype,{size:{value:0,configurable:!0,enumerable:!0,writable:!0}}),we):class extends Map{constructor(){super()}};function be(t){return t}function Ae(t){if(2&t.M)throw Error("Cannot mutate an immutable Map")}var ke=class extends Te{constructor(t,e,n=be,r=be){super();let i=nt(t);i|=64,it(t,i),this.M=i,this.T=e,this.S=n,this.Z=this.T?xe:r;for(let s=0;s<t.length;s++){const o=t[s],a=n(o[0],!1,!0);let c=o[1];e?void 0===c&&(c=null):c=r(o[1],!1,!0,void 0,void 0,i),super.set(a,c)}}oa(t=Se){if(0!==this.size)return this.Y(t)}Y(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(){Ae(this),super.clear()}delete(t){return Ae(this),super.delete(this.S(t,!0,!1))}entries(){var t=this.na();return new yt(t,Le,this)}keys(){return this.Ha()}values(){var t=this.na();return new yt(t,ke.prototype.get,this)}forEach(t,e){super.forEach(((n,r)=>{t.call(e,this.get(r),r,this)}))}set(t,e){return Ae(this),null==(t=this.S(t,!0,!1))?this:null==e?(super.delete(t),this):super.set(t,this.Z(e,!0,!0,this.T,!1,this.M))}Na(t){const e=this.S(t[0],!1,!0);t=t[1],t=this.T?void 0===t?null:t:this.Z(t,!1,!0,void 0,!1,this.M),super.set(e,t)}has(t){return super.has(this.S(t,!1,!1))}get(t){t=this.S(t,!1,!1);const e=super.get(t);if(void 0!==e){var n=this.T;return n?((n=this.Z(e,!1,!0,n,this.sa,this.M))!==e&&super.set(t,n),n):e}}na(){return Array.from(super.keys())}Ha(){return super.keys()}[Symbol.iterator](){return this.entries()}};function xe(t,e,n,r,i,s){return t=se(t,r,n,s),i&&(t=De(t)),t}function Se(t){return t}function Le(t){return[t,this.get(t)]}let Re;function Fe(){return Re||=new ke(st([]),void 0,void 0,void 0,ve)}function Ie(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=pt(t)?void 0:i&&2&nt(t)?t:Me(t,e,n,void 0!==r,i);else if(ft(t)){const s={};for(let o in t)s[o]=Ie(t[o],e,n,r,i);t=s}else t=e(t,r);return t}}function Me(t,e,n,r,i){const s=r||n?nt(t):0;r=r?!!(32&s):void 0;const o=K(t);for(let t=0;t<o.length;t++)o[t]=Ie(o[t],e,n,r,i);return n&&(vt(o,t),n(s,o)),o}function Pe(t){return Ie(t,Oe,void 0,void 0,!1)}function Oe(t){return t.X===ht?t.toJSON():t instanceof ke?t.oa(Pe):function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return xt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(pt(t))return}else{if(C(t))return F(t);if(t instanceof B){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=F(e)}if(t instanceof ke)return t.oa()}}return t}(t)}function Ce(t,e,n=at){if(null!=t){if(L&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=nt(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(it(t,-12293&(34|r)),t):Me(t,Ce,4&r?at:n,!0,!0))}return t.X===ht?(n=t.u,t=2&(r=rt(n))?t:Ue(t,n,r,!0)):t instanceof ke&&!(2&t.M)&&(n=st(t.Y(Ce)),t=new ke(n,t.T,t.S,t.Z)),t}}function Ue(t,e,n,r){return t=t.constructor,de=e=Ne(e,n,r),e=new t(e),de=void 0,e}function Ne(t,e,n){const r=n||2&e?at:ot,i=!!(32&e);return t=function(t,e,n){const r=K(t);var i=r.length;const s=256&e?r[i-1]:void 0;for(i+=s?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(s){e=r[e]={};for(const t in s)e[t]=n(s[t])}return vt(r,t),r}(t,e,(t=>Ce(t,i,r))),tt(t,32|(n?2:0)),t}function De(t){const e=t.u,n=rt(e);return 2&n?Ue(t,e,n,!1):t}function Be(t,e){return je(t=t.u,rt(t),e)}function Ge(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function je(t,e,n,r){if(-1===n)return null;const i=e>>15&1023||536870912;if(!(n>=i)){var s=t.length;return r&&256&e&&null!=(r=t[s-1][n])?(Ge(t,e,i,n)&&null!=Z&&((e=(t=j??={})[Z]||0)>=4||(t[Z]=e+1,H())),r):Ge(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function Ve(t,e,n){const r=t.u;let i=rt(r);return mt(i),Xe(r,i,e,n),t}function Xe(t,e,n,r){const i=e>>15&1023||536870912;if(n>=i){let s,o=e;if(256&e)s=t[t.length-1];else{if(null==r)return o;s=t[i+(+!!(512&e)-1)]={},o|=256}return s[n]=r,n<i&&(t[n+(+!!(512&e)-1)]=void 0),o!==e&&it(t,o),o}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function He(t,e){t=t.u;let n=rt(t);const r=je(t,n,e),i=Wt(r);return null!=i&&i!==r&&Xe(t,n,e,i),i}function We(t){t=t.u;let e=rt(t);const n=je(t,e,1),r=dt(n,!0);return null!=r&&r!==n&&Xe(t,e,1,r),r}function ze(){return void 0===Et?2:4}function Ke(t,e,n,r,i){const s=t.u,o=2&(t=rt(s))?1:r;i=!!i,r=Ye(s,t,e);var a=nt(r);if(!(4&a)){4&a&&(r=K(r),a=fn(a,t),t=Xe(s,t,e,r));let i=0,o=0;for(;i<r.length;i++){const t=n(r[i]);null!=t&&(r[o++]=t)}o<i&&(r.length=o),a=-4097&(20|(a=$e(a,t))),it(r,a&=-8193),2&a&&Object.freeze(r)}let c;return 1===o||4===o&&32&a?qe(a)||(i=a,(a|=2)!==i&&it(r,a),Object.freeze(r)):(n=5===o&&(!!(32&a)||qe(a)||!!ce?.get(r)),(2===o||n)&&qe(a)&&(r=K(r),a=dn(a=fn(a,t),t,i),it(r,a),t=Xe(s,t,e,r)),qe(a)||(e=a,(a=dn(a,t,i))!==e&&it(r,a)),n?c=ae(r):2!==o||i||ce?.delete(r)),c||r}function Ye(t,e,n,r){return t=je(t,e,n,r),Array.isArray(t)?t:ct}function $e(t,e){return 0===t&&(t=fn(t,e)),1|t}function qe(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Je(t){t=K(t);for(let e=0;e<t.length;e++){const n=t[e]=K(t[e]);Array.isArray(n[1])&&(n[1]=st(n[1]))}return t}function Ze(t,e,n,r){t=t.u;let i=rt(t);mt(i),Xe(t,i,e,("0"===r?0===Number(n):n===r)?void 0:n)}function Qe(t,e,n,r,i){mt(e);var s=!(!(64&e)&&16384&e);const o=(i=Ye(t,e,n,i))!==ct;if(s||!o){let a=s=o?nt(i):0;(!o||2&a||qe(a)||4&a&&!(32&a))&&(i=K(i),a=fn(a,e),e=Xe(t,e,n,i)),a=-13&$e(a,e),a=dn(r?-17&a:16|a,e,!0),a!==s&&it(i,a)}return i}function tn(t,e){var n=As;return rn(en(t=t.u),t,rt(t),n)===e?e:-1}function en(t){if(Y)return t[Q]??(t[Q]=new Map);if(Q in t)return t[Q];const e=new Map;return Object.defineProperty(t,Q,{value:e}),e}function nn(t,e,n,r){const i=en(t),s=rn(i,t,e,n);return s!==r&&(s&&(e=Xe(t,e,s)),i.set(n,r)),e}function rn(t,e,n,r){let i=t.get(r);if(null!=i)return i;i=0;for(let t=0;t<r.length;t++){const s=r[t];null!=je(e,n,s)&&(0!==i&&(n=Xe(e,n,i)),i=s)}return t.set(r,i),i}function sn(t,e,n,r){let i,s=rt(t);if(null!=(r=je(t,s,n,r))&&r.X===ht)return(e=De(r))!==r&&Xe(t,s,n,e),e.u;if(Array.isArray(r)){const t=nt(r);i=2&t?ye(Ne(r,t,!1),e,!0):64&t?r:ye(i,e,!0)}else i=ye(void 0,e,!0);return i!==r&&Xe(t,s,n,i),i}function on(t,e,n,r){t=t.u;let i=rt(t);return(e=se(r=je(t,i,n,r),e,!1,i))!==r&&null!=e&&Xe(t,i,n,e),e}function an(t,e,n,r=!1){if(null==(e=on(t,e,n,r)))return e;if(t=t.u,!(2&(r=rt(t)))){const i=De(e);i!==e&&Xe(t,r,n,e=i)}return e}function cn(t,e,n,r,i,s,o){t=t.u;var a=!!(2&e);i=a?1:i,s=!!s,o&&=!a,a=Ye(t,e,r);var c=nt(a),h=!!(4&c);if(!h){var u=a,l=e;const t=!!(2&(c=$e(c,e)));t&&(l|=2);let r=!t,i=!0,s=0,o=0;for(;s<u.length;s++){const e=se(u[s],n,!1,l);if(e instanceof n){if(!t){const t=!!(2&nt(e.u));r&&=!t,i&&=t}u[o++]=e}}o<s&&(u.length=o),c|=4,c=i?16|c:-17&c,it(u,c=r?8|c:-9&c),t&&Object.freeze(u)}if(o&&!(8&c||!a.length&&(1===i||4===i&&32&c))){for(qe(c)&&(a=K(a),c=fn(c,e),e=Xe(t,e,r,a)),n=a,o=c,u=0;u<n.length;u++)(c=n[u])!==(l=De(c))&&(n[u]=l);o|=8,o=n.length?-17&o:16|o,it(n,o),c=o}let f;return 1===i||4===i&&32&c?qe(c)||(e=c,(c|=!a.length||16&c&&(!h||32&c)?2:2048)!==e&&it(a,c),Object.freeze(a)):(h=5===i&&(!!(32&c)||qe(c)||!!ce?.get(a)),(2===i||h)&&qe(c)&&(a=K(a),c=dn(c=fn(c,e),e,s),it(a,c),e=Xe(t,e,r,a)),qe(c)||(r=c,(c=dn(c,e,s))!==r&&it(a,c)),h?f=ae(a):2!==i||s||ce?.delete(a)),f||a}function hn(t,e,n){const r=rt(t.u);return cn(t,r,e,n,ze(),!1,!(2&r))}function un(t,e,n,r){return null==r&&(r=void 0),Ve(t,n,r)}function ln(t,e,n,r){null==r&&(r=void 0);t:{t=t.u;let i=rt(t);if(mt(i),null==r){const r=en(t);if(rn(r,t,i,n)!==e)break t;r.set(n,0)}else i=nn(t,i,n,e);Xe(t,i,e,r)}}function fn(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function dn(t,e,n){return 32&e&&n||(t&=-33),t}function pn(t,e,n,r){const i=rt(t.u);mt(i),t=cn(t,i,n,e,2,!0),r=null!=r?r:new n,t.push(r),2&nt(r.u)?et(t,8):et(t,16)}function gn(t,e){return t??e}function mn(t,e){return $t(Be(t,e))}function yn(t,e){return gn(He(t,e),0)}function _n(t,e){return gn(ie(Be(t,e)),"")}function vn(t,e,n){if(null!=n&&"boolean"!=typeof n)throw t=typeof n,Error(`Expected boolean but got ${"object"!=t?t:n?Array.isArray(n)?"array":t:"null"}: ${n}`);Ve(t,e,n)}function En(t,e,n){if(null!=n){if("number"!=typeof n)throw W("int32");if(!Number.isFinite(n))throw W("int32");n|=0}Ve(t,e,n)}function wn(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 Tn(t,e,n){{const o=t.u;let a=rt(o);if(mt(a),null==n)Xe(o,a,e);else{n=he?.get(n)||n;var r=t=nt(n),i=qe(t),s=i||Object.isFrozen(n);for(i||(t=0),s||(n=K(n),r=0,t=dn(t=fn(t,a),a,!0),s=!1),t|=21,i=0;i<n.length;i++){const e=n[i],o=ne(e);Object.is(e,o)||(s&&(n=K(n),r=0,t=dn(t=fn(t,a),a,!0),s=!1),n[i]=o)}t!==r&&(s&&(n=K(n),t=dn(t=fn(t,a),a,!0)),it(n,t)),Xe(o,a,e,n)}}}function bn(t,e,n){mt(rt(t.u)),Ke(t,e,ie,2,!0).push(ne(n))}function An(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function kn(){return Error("Failed to read varint, encoding is invalid.")}function xn(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function Sn(t){if("string"==typeof t)return{buffer:O(t),O:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),O:!1};if(t.constructor===Uint8Array)return{buffer:t,O:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),O:!1};if(t.constructor===B)return{buffer:D(t)||new Uint8Array(0),O:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),O:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function Ln(t,e){let n,r=0,i=0,s=0;const o=t.h;let a=t.g;do{n=o[a++],r|=(127&n)<<s,s+=7}while(s<32&&128&n);for(s>32&&(i|=(127&n)>>4),s=3;s<32&&128&n;s+=7)n=o[a++],i|=(127&n)<<s;if(Un(t,a),n<128)return e(r>>>0,i>>>0);throw kn()}function Rn(t){let e=0,n=t.g;const r=n+10,i=t.h;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return Un(t,n),!!(127&e)}throw kn()}function Fn(t){const e=t.h;let n=t.g,r=e[n++],i=127&r;if(128&r&&(r=e[n++],i|=(127&r)<<7,128&r&&(r=e[n++],i|=(127&r)<<14,128&r&&(r=e[n++],i|=(127&r)<<21,128&r&&(r=e[n++],i|=r<<28,128&r&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++]&&128&e[n++])))))throw kn();return Un(t,n),i}function In(t){return Fn(t)>>>0}function Mn(t){var e=t.h;const n=t.g,r=e[n],i=e[n+1],s=e[n+2];return e=e[n+3],Un(t,t.g+4),(r<<0|i<<8|s<<16|e<<24)>>>0}function Pn(t){var e=Mn(t);t=2*(e>>31)+1;const n=e>>>23&255;return e&=8388607,255==n?e?NaN:t*(1/0):0==n?1401298464324817e-60*t*e:t*Math.pow(2,n-150)*(e+8388608)}function On(t){return Fn(t)}function Cn(t,e,{ca:n=!1}={}){t.ca=n,e&&(e=Sn(e),t.h=e.buffer,t.m=e.O,t.j=0,t.l=t.h.length,t.g=t.j)}function Un(t,e){if(t.g=e,e>t.l)throw xn(t.l,e)}function Nn(t,e){if(e<0)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.l)throw xn(e,t.l-n);return t.g=r,n}function Dn(t,e){if(0==e)return N();var n=Nn(t,e);return t.ca&&t.m?n=t.h.subarray(n,n+e):(t=t.h,n=n===(e=n+e)?new Uint8Array(0):Mt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?N():new B(n,U)}ke.prototype.toJSON=void 0,ke.prototype.Ia=ut;var Bn=[];function Gn(t){var e=t.g;if(e.g==e.l)return!1;t.l=t.g.g;var n=In(t.g);if(e=n>>>3,!((n&=7)>=0&&n<=5))throw An(n,t.l);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.l})`);return t.m=e,t.h=n,!0}function jn(t){switch(t.h){case 0:0!=t.h?jn(t):Rn(t.g);break;case 1:Un(t=t.g,t.g+8);break;case 2:if(2!=t.h)jn(t);else{var e=In(t.g);Un(t=t.g,t.g+e)}break;case 5:Un(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!Gn(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.m!=e)throw Error("Unmatched end-group tag");break}jn(t)}break;default:throw An(t.h,t.l)}}function Vn(t,e,n){const r=t.g.l,i=In(t.g),s=t.g.g+i;let o=s-r;if(o<=0&&(t.g.l=s,n(e,t,void 0,void 0,void 0),o=s-t.g.g),o)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-o} bytes, either the data ended unexpectedly or the message misreported its own length`);return t.g.g=s,t.g.l=r,e}function Xn(t){var e=In(t.g),a=Nn(t=t.g,e);if(t=t.h,o){var c,h=t;(c=s)||(c=s=new TextDecoder("utf-8",{fatal:!0})),e=a+e,h=0===a&&e===h.length?h:h.subarray(a,e);try{var u=c.decode(h)}catch(t){if(void 0===i){try{c.decode(new Uint8Array([128]))}catch(t){}try{c.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(s=void 0),t}}else{e=(u=a)+e,a=[];let i,s=null;for(;u<e;){var l=t[u++];l<128?a.push(l):l<224?u>=e?n():(i=t[u++],l<194||128!=(192&i)?(u--,n()):a.push((31&l)<<6|63&i)):l<240?u>=e-1?n():(i=t[u++],128!=(192&i)||224===l&&i<160||237===l&&i>=160||128!=(192&(c=t[u++]))?(u--,n()):a.push((15&l)<<12|(63&i)<<6|63&c)):l<=244?u>=e-2?n():(i=t[u++],128!=(192&i)||i-144+(l<<28)>>30!=0||128!=(192&(c=t[u++]))||128!=(192&(h=t[u++]))?(u--,n()):(l=(7&l)<<18|(63&i)<<12|(63&c)<<6|63&h,l-=65536,a.push(55296+(l>>10&1023),56320+(1023&l)))):n(),a.length>=8192&&(s=r(s,a),a.length=0)}u=r(s,a)}return u}function Hn(t){const e=In(t.g);return Dn(t.g,e)}function Wn(t,e,n){var r=In(t.g);for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var zn=[];let Kn;function Yn(t,e,n){e.g?e.m(t,e.g,e.h,n,!0):e.m(t,e.h,n,!0)}var $n=class{constructor(t,e){this.u=_e(t,e)}toJSON(){return qn(this)}l(){var t=Eo;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 Ue(this,t,rt(t),!1)}O(){return!!(2&nt(this.u))}};function qn(t){t=t.u,t=Kn?t:Me(t,Oe,void 0,void 0,!1);{var e=!Kn;let h=t.length;if(h){var n=t[h-1],r=ft(n);r?h--:n=void 0;var i=t;if(r){t:{var s,o=n,a=!1;if(o)for(let t in o)isNaN(+t)?(s??={})[t]=o[t]:(r=o[t],Array.isArray(r)&&(pt(r)||lt(r)&&0===r.size)&&(r=null),null==r&&(a=!0),null!=r&&((s??={})[t]=r));if(a||(s=o),s)for(let t in s){a=s;break t}a=null}o=null==a?null!=n:a!==n}for(;h>0&&(null==(s=i[h-1])||pt(s)||lt(s)&&0===s.size);h--)var c=!0;(i!==t||o||c)&&(e?(c||o||a)&&(i.length=h):i=Array.prototype.slice.call(i,0,h),a&&i.push(a)),c=i}else c=t}return c}function Jn(t){return t?/^\d+$/.test(t)?(Xt(t),new Zn(Ot,Ct)):null:Qn||=new Zn(0,0)}$n.prototype.X=ht,$n.prototype.toString=function(){try{return Kn=!0,qn(this).toString()}finally{Kn=!1}};var Zn=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let Qn;function tr(t){return t?/^-?\d+$/.test(t)?(Xt(t),new er(Ot,Ct)):null:nr||=new er(0,0)}var er=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let nr;function rr(t,e,n){for(;n>0||e>127;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function ir(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function sr(t,e){if(e>=0)ir(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function or(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 ar(t,e){0!==e.length&&(t.l.push(e),t.h+=e.length)}function cr(t,e,n){ir(t.g,8*e+n)}function hr(t,e){return cr(t,e,2),e=t.g.end(),ar(t,e),e.push(t.h),e}function ur(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function lr(t,e,n){cr(t,e,2),ir(t.g,n.length),ar(t,t.g.end()),ar(t,n)}function fr(t,e,n,r){null!=n&&(e=hr(t,e),r(n,t),ur(t,e))}function dr(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var pr=dr(),gr=dr(),mr=dr(),yr=dr(),_r=dr(),vr=dr(),Er=dr(),wr=dr(),Tr=dr(),br=class{constructor(t,e,n){this.g=t,this.h=e,t=pr,this.l=!!t&&n===t||!1}};function Ar(t,e){return new br(t,e,pr)}function kr(t,e,n,r,i){fr(t,n,Ur(e,r),i)}const xr=Ar((function(t,e,n,r,i){return 2===t.h&&(Vn(t,sn(e,r,n),i),!0)}),kr),Sr=Ar((function(t,e,n,r,i){return 2===t.h&&(Vn(t,sn(e,r,n,!0),i),!0)}),kr);var Lr=Symbol(),Rr=Symbol(),Fr=Symbol(),Ir=Symbol();let Mr,Pr;function Or(t,e,n,r){var i=r[t];if(i)return i;(i={}).W=function(t){switch(typeof t){case"boolean":return pe||=[0,void 0,!0];case"number":return t>0?void 0:0===t?ge||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(r[0]);var s=r[1];let o=1;s&&s.constructor===Object&&(i.ha=s,"function"==typeof(s=r[++o])&&(i.ma=!0,Mr??=s,Pr??=r[o+1],s=r[o+=2]));const a={};for(;s&&Array.isArray(s)&&s.length&&"number"==typeof s[0]&&s[0]>0;){for(var c=0;c<s.length;c++)a[s[c]]=s;s=r[++o]}for(c=1;void 0!==s;){let t;"number"==typeof s&&(c+=s,s=r[++o]);var h=void 0;if(s instanceof br?t=s:(t=xr,o--),t?.l){s=r[++o],h=r;var u=o;"function"==typeof s&&(s=s(),h[u]=s),h=s}for(u=c+1,"number"==typeof(s=r[++o])&&s<0&&(u-=s,s=r[++o]);c<u;c++){const r=a[c];h?n(i,c,t,h,r):e(i,c,t,r)}}return r[t]=i}function Cr(t){return Array.isArray(t)?t[0]instanceof br?t:[Sr,t]:[t,void 0]}function Ur(t,e){return t instanceof $n?t.u:Array.isArray(t)?ye(t,e,!1):void 0}function Nr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function Dr(t,e,n,r,i){const s=n.g;let o,a;t[e]=(t,e,n)=>s(t,e,n,a||=Or(Rr,Nr,Dr,r).W,o||=Br(r),i)}function Br(t){let e=t[Fr];if(null!=e)return e;const n=Or(Rr,Nr,Dr,t);return e=n.ma?(t,e)=>Mr(t,e,n):(t,e)=>{const r=rt(t);for(;Gn(e)&&4!=e.h;){var i=e.m,s=n[i];if(null==s){var o=n.ha;o&&(o=o[i])&&(null!=(o=Gr(o))&&(s=n[i]=o))}null!=s&&s(e,t,i)||(i=(s=e).l,jn(s),s.ga?s=void 0:(o=s.g.g-i,s.g.g=i,s=Dn(s.g,o)),i=t,s&&(_t||=Symbol(),(o=i[_t])?o.push(s):i[_t]=[s]))}return 16384&r&&st(t),!0},t[Fr]=e}function Gr(t){const e=(t=Cr(t))[0].g;if(t=t[1]){const n=Br(t),r=Or(Rr,Nr,Dr,t).W;return(t,i,s)=>e(t,i,s,r,n)}return e}function jr(t,e,n){t[e]=n.h}function Vr(t,e,n,r){let i,s;const o=n.h;t[e]=(t,e,n)=>o(t,e,n,s||=Or(Lr,jr,Vr,r).W,i||=Xr(r))}function Xr(t){let e=t[Ir];if(!e){const n=Or(Lr,jr,Vr,t);e=(t,e)=>Hr(t,e,n),t[Ir]=e}return e}function Hr(t,e,n){for(var r=nt(t),i=+!!(512&r)-1,s=t.length,o=512&r?1:0,a=s+(256&r?-1:0);o<a;o++){const r=t[o];if(null==r)continue;const s=o-i,a=Wr(n,s);a&&a(e,r,s)}if(256&r){r=t[s-1];for(const t in r)i=+t,Number.isNaN(i)||null!=(s=r[i])&&(a=Wr(n,i))&&a(e,s,i)}if(t=_t?t[_t]:void 0)for(ar(e,e.g.end()),n=0;n<t.length;n++)ar(e,D(t[n])||new Uint8Array(0))}function Wr(t,e){var n=t[e];if(n)return n;if((n=t.ha)&&(n=n[e])){var r=(n=Cr(n))[0].h;if(n=n[1]){const e=Xr(n),i=Or(Lr,jr,Vr,n).W;n=t.ma?Pr(i,e):(t,n,s)=>r(t,n,s,i,e)}else n=r;return t[e]=n}}function zr(t,e){if(Array.isArray(e)){var n=nt(e);if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),it(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}function Kr(t,e,n){return new br(t,e,n)}function Yr(t,e,n){return new br(t,e,n)}function $r(t,e,n){Xe(t,rt(t),e,n)}var qr=Ar((function(t,e,n,r,i){return 2===t.h&&(t=Vn(t,ye([void 0,void 0],r,!0),i),mt(r=rt(e)),(i=je(e,r,n))instanceof ke?0!=(2&i.M)?((i=i.Y()).push(t),Xe(e,r,n,i)):i.Na(t):Array.isArray(i)?(2&nt(i)&&Xe(e,r,n,i=Je(i)),i.push(t)):Xe(e,r,n,[t]),!0)}),(function(t,e,n,r,i){if(e instanceof ke)e.forEach(((e,s)=>{fr(t,n,ye([s,e],r,!1),i)}));else if(Array.isArray(e))for(let s=0;s<e.length;s++){const o=e[s];Array.isArray(o)&&fr(t,n,ye(o,r,!1),i)}}));function Jr(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(BigInt.asIntN(64,t));if(Yt(t)){if("string"===e)return Qt(t);if("number"===e)return Zt(t)}}(e),null!=e){if("string"==typeof e)tr(e);if(null!=e)switch(cr(t,n,0),typeof e){case"number":t=t.g,Nt(e),rr(t,Ot,Ct);break;case"bigint":n=BigInt.asUintN(64,e),n=new er(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),rr(t.g,n.h,n.g);break;default:n=tr(e),rr(t.g,n.h,n.g)}}}function Zr(t,e,n){null!=(e=$t(e))&&null!=e&&(cr(t,n,0),sr(t.g,e))}function Qr(t,e,n){null!=(e=zt(e))&&(cr(t,n,0),t.g.g.push(e?1:0))}function ti(t,e,n){null!=(e=ie(e))&&lr(t,n,h(e))}function ei(t,e,n,r,i){fr(t,n,Ur(e,r),i)}function ni(t,e,n){null!=(e=null==e||"string"==typeof e||C(e)||e instanceof B?e:void 0)&&lr(t,n,Sn(e).buffer)}function ri(t,e,n){return(5===t.h||2===t.h)&&(e=Qe(e,rt(e),n,!1,!1),2==t.h?Wn(t,Pn,e):e.push(Pn(t.g)),!0)}var ii=Kr((function(t,e,n){if(1!==t.h)return!1;var r=t.g;t=Mn(r);const i=Mn(r);r=2*(i>>31)+1;const s=i>>>20&2047;return t=4294967296*(1048575&i)+t,$r(e,n,2047==s?t?NaN:r*(1/0):0==s?5e-324*r*t:r*Math.pow(2,s-1075)*(t+4503599627370496)),!0}),(function(t,e,n){null!=(e=Wt(e))&&(cr(t,n,1),t=t.g,(n=Pt||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),Ot=n.getUint32(0,!0),Ct=n.getUint32(4,!0),or(t,Ot),or(t,Ct))}),dr()),si=Kr((function(t,e,n){return 5===t.h&&($r(e,n,Pn(t.g)),!0)}),(function(t,e,n){null!=(e=Wt(e))&&(cr(t,n,5),t=t.g,Dt(e),or(t,Ot))}),Er),oi=Yr(ri,(function(t,e,n){if(null!=(e=zr(Wt,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(cr(r,i,5),r=r.g,Dt(s),or(r,Ot))}}),Er),ai=Yr(ri,(function(t,e,n){if(null!=(e=zr(Wt,e))&&e.length){cr(t,n,2),ir(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Dt(e[r]),or(n,Ot)}}),Er),ci=Kr((function(t,e,n){return 0===t.h&&($r(e,n,Ln(t.g,Gt)),!0)}),Jr,vr),hi=Kr((function(t,e,n){return 0===t.h&&($r(e,n,0===(t=Ln(t.g,Gt))?void 0:t),!0)}),Jr,vr),ui=Kr((function(t,e,n){return 0===t.h&&($r(e,n,Ln(t.g,Bt)),!0)}),(function(t,e,n){if(null!=(e=ee(e))){if("string"==typeof e)Jn(e);if(null!=e)switch(cr(t,n,0),typeof e){case"number":t=t.g,Nt(e),rr(t,Ot,Ct);break;case"bigint":n=BigInt.asUintN(64,e),n=new Zn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),rr(t.g,n.h,n.g);break;default:n=Jn(e),rr(t.g,n.h,n.g)}}}),dr()),li=Kr((function(t,e,n){return 0===t.h&&($r(e,n,Fn(t.g)),!0)}),Zr,yr),fi=Yr((function(t,e,n){return(0===t.h||2===t.h)&&(e=Qe(e,rt(e),n,!1,!1),2==t.h?Wn(t,Fn,e):e.push(Fn(t.g)),!0)}),(function(t,e,n){if(null!=(e=zr($t,e))&&e.length){n=hr(t,n);for(let n=0;n<e.length;n++)sr(t.g,e[n]);ur(t,n)}}),yr),di=Kr((function(t,e,n){return 0===t.h&&($r(e,n,0===(t=Fn(t.g))?void 0:t),!0)}),Zr,yr),pi=Kr((function(t,e,n){return 0===t.h&&($r(e,n,Rn(t.g)),!0)}),Qr,gr),gi=Kr((function(t,e,n){return 0===t.h&&($r(e,n,!1===(t=Rn(t.g))?void 0:t),!0)}),Qr,gr),mi=Yr((function(t,e,n){return 2===t.h&&(t=Xn(t),Qe(e,rt(e),n,!1).push(t),!0)}),(function(t,e,n){if(null!=(e=zr(ie,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&lr(r,i,h(s))}}),mr),yi=Kr((function(t,e,n){return 2===t.h&&($r(e,n,""===(t=Xn(t))?void 0:t),!0)}),ti,mr),_i=Kr((function(t,e,n){return 2===t.h&&($r(e,n,Xn(t)),!0)}),ti,mr),vi=function(t,e,n=pr){return new br(t,e,n)}((function(t,e,n,r,i){return 2===t.h&&(r=ye(void 0,r,!0),Qe(e,rt(e),n,!0).push(r),Vn(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e))for(let s=0;s<e.length;s++)ei(t,e[s],n,r,i)})),Ei=Ar((function(t,e,n,r,i,s){return 2===t.h&&(nn(e,nt(e),s,n),Vn(t,e=sn(e,r,n),i),!0)}),ei),wi=Kr((function(t,e,n){return 2===t.h&&($r(e,n,Hn(t)),!0)}),ni,wr),Ti=Yr((function(t,e,n){return(0===t.h||2===t.h)&&(e=Qe(e,rt(e),n,!1,!1),2==t.h?Wn(t,In,e):e.push(In(t.g)),!0)}),(function(t,e,n){if(null!=(e=zr(qt,e)))for(let o=0;o<e.length;o++){var r=t,i=n,s=e[o];null!=s&&(cr(r,i,0),ir(r.g,s))}}),_r),bi=Kr((function(t,e,n){return 0===t.h&&($r(e,n,0===(t=In(t.g))?void 0:t),!0)}),(function(t,e,n){null!=(e=qt(e))&&null!=e&&(cr(t,n,0),ir(t.g,e))}),_r),Ai=Kr((function(t,e,n){return 0===t.h&&($r(e,n,Fn(t.g)),!0)}),(function(t,e,n){null!=(e=$t(e))&&(e=parseInt(e,10),cr(t,n,0),sr(t.g,e))}),Tr);class ki{constructor(t,e){this.h=t,this.g=e,this.l=an,this.m=un,this.defaultValue=void 0}}function xi(t,e){return new ki(t,e)}function Si(t,e){return(n,r)=>{if(zn.length){const t=zn.pop();t.o(r),Cn(t.g,n,r),n=t}else n=new class{constructor(t,e){if(Bn.length){const n=Bn.pop();Cn(n,t,e),t=n}else t=new class{constructor(t,e){this.h=null,this.m=!1,this.g=this.l=this.j=0,Cn(this,t,e)}clear(){this.h=null,this.m=!1,this.g=this.l=this.j=0,this.ca=!1}}(t,e);this.g=t,this.l=this.g.g,this.h=this.m=-1,this.o(e)}o({ga:t=!1}={}){this.ga=t}}(n,r);try{const r=new t,s=r.u;Br(e)(s,n);var i=r}finally{n.g.clear(),n.m=-1,n.h=-1,zn.length<100&&zn.push(n)}return i}}function Li(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}}}};Hr(this.u,e,Or(Lr,jr,Vr,t)),ar(e,e.g.end());const n=new Uint8Array(e.h),r=e.l,i=r.length;let s=0;for(let t=0;t<i;t++){const e=r[t];n.set(e,s),s+=e.length}return e.l=[n],n}}var Ri=class extends $n{constructor(t){super(t)}},Fi=[0,yi,Kr((function(t,e,n){return 2===t.h&&($r(e,n,(t=Hn(t))===N()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof $n){const r=e.Qa;return void(r&&(e=r(e),null!=e&&lr(t,n,Sn(e).buffer)))}if(Array.isArray(e))return}ni(t,e,n)}),wr)];let Ii,Mi=globalThis.trustedTypes;function Pi(t){void 0===Ii&&(Ii=function(){let t=null;if(!Mi)return t;try{const e=t=>t;t=Mi.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Ii;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function Oi(t,...e){if(0===e.length)return Pi(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Pi(n)}var Ci=[0,li,Ai,pi,-1,fi,Ai,-1],Ui=class extends $n{constructor(){super()}},Ni=[0,pi,_i,pi,Ai,-1,Yr((function(t,e,n){return(0===t.h||2===t.h)&&(e=Qe(e,rt(e),n,!1,!1),2==t.h?Wn(t,On,e):e.push(Fn(t.g)),!0)}),(function(t,e,n){if(null!=(e=zr($t,e))&&e.length){n=hr(t,n);for(let n=0;n<e.length;n++)sr(t.g,e[n]);ur(t,n)}}),Tr),_i,-1,[0,pi,-1],Ai,pi,-1],Di=[0,_i,-2],Bi=class extends $n{constructor(){super()}},Gi=[0],ji=[0,li,pi,1,pi,-3],Vi=class extends $n{constructor(t){super(t,2)}},Xi={};Xi[336783863]=[0,_i,pi,-1,li,[0,[1,2,3,4,5,6,7],Ei,Gi,Ei,Ni,Ei,Di,Ei,ji,Ei,Ci,Ei,[0,_i,-2],Ei,[0,_i,Ai]],[0,_i],pi,[0,[1,3],[2,4],Ei,[0,fi],-1,Ei,[0,mi],-1,vi,[0,_i,-1]],_i];var Hi=[0,hi,-1,gi,-3,hi,fi,yi,di,hi,-1,gi,di,gi,-2,yi];function Wi(t,e){Ze(t,2,re(e),"")}function zi(t,e){bn(t,3,e)}function Ki(t,e){bn(t,4,e)}var Yi=class extends $n{constructor(t){super(t,500)}o(t){return un(this,0,7,t)}},$i=[-1,{}],qi=[0,_i,1,$i],Ji=[0,_i,mi,$i];function Zi(t,e){pn(t,1,Yi,e)}function Qi(t,e){bn(t,10,e)}function ts(t,e){bn(t,15,e)}var es=class extends $n{constructor(t){super(t,500)}o(t){return un(this,0,1001,t)}},ns=[-500,vi,[-500,yi,-1,mi,-3,[-2,Xi,pi],vi,Fi,di,-1,qi,Ji,vi,[0,yi,gi],yi,Hi,di,mi,987,mi],4,vi,[-500,_i,-1,[-1,{}],998,_i],vi,[-500,_i,mi,-1,[-2,{},pi],997,mi,-1],di,vi,[-500,_i,mi,$i,998,mi],mi,di,qi,Ji,vi,[0,yi,-1,$i],mi,-2,Hi,yi,-1,gi,[0,gi,bi],978,$i,vi,Fi];es.prototype.g=Li(ns);var rs=Si(es,ns),is=class extends $n{constructor(t){super(t)}},ss=class extends $n{constructor(t){super(t)}g(){return hn(this,is,1)}},os=[0,vi,[0,li,si,_i,-1]],as=Si(ss,os),cs=class extends $n{constructor(t){super(t)}},hs=class extends $n{constructor(t){super(t)}},us=class extends $n{constructor(t){super(t)}h(){return an(this,cs,2)}g(){return hn(this,hs,5)}},ls=Si(class extends $n{constructor(t){super(t)}},[0,mi,fi,ai,[0,Ai,[0,li,-3],[0,si,-3],[0,li,-1,[0,vi,[0,li,-2]]],vi,[0,si,-1,_i,si]],_i,-1,ci,vi,[0,li,si],mi,ci]),fs=class extends $n{constructor(t){super(t)}},ds=Si(class extends $n{constructor(t){super(t)}},[0,vi,[0,si,-4]]),ps=class extends $n{constructor(t){super(t)}},gs=Si(class extends $n{constructor(t){super(t)}},[0,vi,[0,si,-4]]),ms=class extends $n{constructor(t){super(t)}},ys=[0,li,-1,ai,Ai],_s=class extends $n{constructor(){super()}};_s.prototype.g=Li([0,si,-4,ci]);var vs=class extends $n{constructor(t){super(t)}},Es=Si(class extends $n{constructor(t){super(t)}},[0,vi,[0,1,li,_i,os],ci]),ws=class extends $n{constructor(t){super(t)}},Ts=class extends $n{constructor(t){super(t)}pa(){const t=We(this);return null==t?N():t}},bs=class extends $n{constructor(t){super(t)}},As=[1,2],ks=Si(class extends $n{constructor(t){super(t)}},[0,vi,[0,As,Ei,[0,ai],Ei,[0,wi],li,_i],ci]),xs=class extends $n{constructor(t){super(t)}},Ss=[0,_i,li,si,mi,-1],Ls=class extends $n{constructor(t){super(t)}},Rs=[0,pi,-1],Fs=class extends $n{constructor(t){super(t)}},Is=[1,2,3,4,5],Ms=class extends $n{constructor(t){super(t)}g(){return null!=We(this)}h(){return null!=ie(Be(this,2))}},Ps=class extends $n{constructor(t){super(t)}g(){return zt(Be(this,2))??!1}},Os=[0,wi,_i,[0,li,ci,-1],[0,ui,ci]],Cs=[0,Os,pi,[0,Is,Ei,ji,Ei,Ni,Ei,Ci,Ei,Gi,Ei,Di],Ai],Us=class extends $n{constructor(t){super(t)}},Ns=[0,Cs,si,-1,li],Ds=xi(502141897,Us);Xi[502141897]=Ns;var Bs=Si(class extends $n{constructor(t){super(t)}},[0,[0,Ai,-1,oi,Ti],ys]),Gs=class extends $n{constructor(t){super(t)}},js=class extends $n{constructor(t){super(t)}},Vs=[0,Cs,si,[0,Cs],pi],Xs=[0,Cs,Ns,Vs,si,[0,[0,Os]]],Hs=xi(508968150,js);Xi[508968150]=Xs,Xi[508968149]=Vs;var Ws=class extends $n{constructor(t){super(t)}},zs=xi(513916220,Ws);Xi[513916220]=[0,Cs,Xs,li];var Ks=class extends $n{constructor(t){super(t)}h(){return an(this,xs,2)}g(){Ve(this,2)}},Ys=[0,Cs,Ss];Xi[478825465]=Ys;var $s=class extends $n{constructor(t){super(t)}},qs=class extends $n{constructor(t){super(t)}},Js=class extends $n{constructor(t){super(t)}},Zs=class extends $n{constructor(t){super(t)}},Qs=class extends $n{constructor(t){super(t)}},to=[0,Cs,[0,Cs],Ys,-1],eo=[0,Cs,si,li],no=[0,Cs,si],ro=[0,Cs,eo,no,si],io=xi(479097054,Qs);Xi[479097054]=[0,Cs,ro,to],Xi[463370452]=to,Xi[464864288]=eo;var so=xi(462713202,Zs);Xi[462713202]=ro,Xi[474472470]=no;var oo=class extends $n{constructor(t){super(t)}},ao=class extends $n{constructor(t){super(t)}},co=class extends $n{constructor(t){super(t)}},ho=class extends $n{constructor(){super()}},uo=[0,Cs,si,-1,li],lo=[0,Cs,si,pi];ho.prototype.g=Li([0,Cs,no,[0,Cs],Ns,Vs,uo,lo]);var fo=class extends $n{constructor(t){super(t)}},po=xi(456383383,fo);Xi[456383383]=[0,Cs,Ss];var go=class extends $n{constructor(t){super(t)}},mo=xi(476348187,go);Xi[476348187]=[0,Cs,Rs];var yo=class extends $n{constructor(t){super(t)}},_o=class extends $n{constructor(t){super(t)}},vo=[0,Ai,-1],Eo=xi(458105876,class extends $n{constructor(t){super(t)}g(){var t=this.u;const e=rt(t);const n=2&e;return t=function(t,e,n){var r=_o;const i=2&e;let s=!1;if(null==n){if(i)return Fe();n=[]}else if(n.constructor===ke){if(0==(2&n.M)||i)return n;n=n.Y()}else Array.isArray(n)?s=!!(2&nt(n)):n=[];if(i){if(!n.length)return Fe();s||(s=!0,st(n))}else s&&(s=!1,n=Je(n));return s||(64&nt(n)?et(n,32):32&e&&tt(n,32)),Xe(t,e,2,r=new ke(n,r,oe,void 0)),r}(t,e,je(t,e,2)),!n&&_o&&(t.sa=!0),t}});Xi[458105876]=[0,vo,qr,[!0,ci,[0,_i,-1,mi]]];var wo=class extends $n{constructor(t){super(t)}},To=xi(458105758,wo);Xi[458105758]=[0,Cs,_i,vo];var bo=class extends $n{constructor(t){super(t)}},Ao=xi(443442058,bo);Xi[443442058]=[0,Cs,_i,li,si,mi,-1],Xi[514774813]=uo;var ko=class extends $n{constructor(t){super(t)}},xo=xi(516587230,ko);function So(t,e){return e=e?e.clone():new xs,void 0!==t.displayNamesLocale?Ve(e,1,re(t.displayNamesLocale)):void 0===t.displayNamesLocale&&Ve(e,1),void 0!==t.maxResults?En(e,2,t.maxResults):"maxResults"in t&&Ve(e,2),void 0!==t.scoreThreshold?wn(e,3,t.scoreThreshold):"scoreThreshold"in t&&Ve(e,3),void 0!==t.categoryAllowlist?Tn(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&Ve(e,4),void 0!==t.categoryDenylist?Tn(e,5,t.categoryDenylist):"categoryDenylist"in t&&Ve(e,5),e}function Lo(t,e=-1,n=""){return{categories:t.map((t=>({index:gn(mn(t,1),0)??-1,score:yn(t,2)??0,categoryName:_n(t,3)??"",displayName:_n(t,4)??""}))),headIndex:e,headName:n}}function Ro(t){var e=Ke(t,3,Wt,ze()),n=Ke(t,2,$t,ze()),r=Ke(t,1,ie,ze()),i=Ke(t,9,ie,ze());const s={categories:[],keypoints:[]};for(let t=0;t<e.length;t++)s.categories.push({score:e[t],index:n[t]??-1,categoryName:r[t]??"",displayName:i[t]??""});if((e=an(t,us,4)?.h())&&(s.boundingBox={originX:mn(e,1)??0,originY:mn(e,2)??0,width:mn(e,3)??0,height:mn(e,4)??0,angle:0}),an(t,us,4)?.g().length)for(const e of an(t,us,4).g())s.keypoints.push({x:He(e,1)??0,y:He(e,2)??0,score:He(e,4)??0,label:ie(Be(e,3))??""});return s}function Fo(t){const e=[];for(const n of hn(t,ps,1))e.push({x:yn(n,1)??0,y:yn(n,2)??0,z:yn(n,3)??0,visibility:yn(n,4)??0});return e}function Io(t){const e=[];for(const n of hn(t,fs,1))e.push({x:yn(n,1)??0,y:yn(n,2)??0,z:yn(n,3)??0,visibility:yn(n,4)??0});return e}function Mo(t){return Array.from(t,(t=>t>127?t-256:t))}function Po(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,i=0;for(let s=0;s<t.length;s++)n+=t[s]*e[s],r+=t[s]*t[s],i+=e[s]*e[s];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Oo;Xi[516587230]=[0,Cs,uo,lo,si],Xi[518928384]=lo;const Co=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 Uo(){if(void 0===Oo)try{await WebAssembly.instantiate(Co),Oo=!0}catch{Oo=!1}return Oo}async function No(t,e=Oi``){const n=await Uo()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Do=class{};function Bo(){var t=navigator;return"undefined"!=typeof OffscreenCanvas&&(!function(t=navigator){return(t=t.userAgent).includes("Safari")&&!t.includes("Chrome")}(t)||!!((t=t.userAgent.match(/Version\/([\d]+).*Safari/))&&t.length>=1&&Number(t[1])>=17))}async function Go(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 jo(t){return void 0!==t.videoWidth?[t.videoWidth,t.videoHeight]:void 0!==t.naturalWidth?[t.naturalWidth,t.naturalHeight]:void 0!==t.displayWidth?[t.displayWidth,t.displayHeight]:[t.width,t.height]}function Vo(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 Xo(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`.");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);const[r,i]=jo(e);return!t.l||r===t.i.canvas.width&&i===t.i.canvas.height||(t.i.canvas.width=r,t.i.canvas.height=i),[r,i]}function Ho(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 Wo(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function zo(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}Do.forVisionTasks=function(t){return No("vision",t)},Do.forTextTasks=function(t){return No("text",t)},Do.forGenAiExperimentalTasks=function(t){return No("genai_experimental",t)},Do.forGenAiTasks=function(t){return No("genai",t)},Do.forAudioTasks=function(t){return No("audio",t)},Do.isSimdSupported=function(){return Uo()};async function Ko(t,e,n,r){return t=await(async(t,e,n,r,i)=>{if(e&&await Go(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Go(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,r)})(t,n.wasmLoaderPath,n.assetLoaderPath,e,{locateFile:t=>t.endsWith(".wasm")?n.wasmBinaryPath.toString():n.assetBinaryPath&&t.endsWith(".data")?n.assetBinaryPath.toString():t}),await t.o(r),t}function Yo(t,e){const n=an(t.baseOptions,Ms,1)||new Ms;"string"==typeof e?(Ve(n,2,re(e)),Ve(n,1)):e instanceof Uint8Array&&(Ve(n,1,dt(e,!1)),Ve(n,2)),un(t.baseOptions,0,1,n)}function $o(t){try{const e=t.H.length;if(1===e)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map((t=>t.message)).join(", "))}finally{t.H=[]}}function qo(t,e){t.B=Math.max(t.B,e)}function Jo(t,e){t.A=new Yi,Wi(t.A,"PassThroughCalculator"),zi(t.A,"free_memory"),Ki(t.A,"free_memory_unused_out"),Qi(e,"free_memory"),Zi(e,t.A)}function Zo(t,e){zi(t.A,e),Ki(t.A,e+"_unused_out")}function Qo(t){t.g.addBoolToStream(!0,"free_memory",t.B)}var ta=class{constructor(t){this.g=t,this.H=[],this.B=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(!(an(this.baseOptions,Ms,1)?.g()||an(this.baseOptions,Ms,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=an(t.baseOptions,Fs,3);if(!n){var r=n=new Fs,i=new Bi;ln(r,4,Is,i)}"delegate"in e&&("GPU"===e.delegate?(e=n,r=new Ui,ln(e,2,Is,r)):(e=n,r=new Bi,ln(e,4,Is,r))),un(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.J()}));if(e.modelAssetBuffer instanceof Uint8Array)Yo(this,e.modelAssetBuffer);else if(e.modelAssetBuffer)return async function(t){const e=[];for(var n=0;;){const{done:r,value:i}=await t.read();if(r)break;e.push(i),n+=i.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(n),n=0;for(const r of e)t.set(r,n),n+=r.length;ret