@mediapipe/tasks-text 0.10.18-rc.20241103 → 0.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/package.json +1 -1
- package/text_bundle.cjs +1 -1
- package/text_bundle.cjs.map +1 -1
- package/text_bundle.mjs +1 -1
- package/text_bundle.mjs.map +1 -1
- package/wasm/text_wasm_internal.js +0 -0
- package/wasm/text_wasm_internal.wasm +0 -0
- package/wasm/text_wasm_nosimd_internal.js +0 -0
- package/wasm/text_wasm_nosimd_internal.wasm +0 -0
package/README.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/text_bundle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"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,o;const s="undefined"!=typeof TextDecoder;let a;const u="undefined"!=typeof TextEncoder;function c(t){if(u)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 o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-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 l,h;t:{for(var f=["CLOSURE_FLAGS"],d=t,g=0;g<f.length;g++)if(null==(d=d[f[g]])){h=null;break t}h=d}var p,m=h&&h[610401301];l=null!=m&&m;const y=t.navigator;function b(t){return!!l&&(!!p&&p.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 w(){return!!l&&(!!p&&p.brands.length>0)}function _(){return w()?b("Chromium"):(v("Chrome")||v("CriOS"))&&!(!w()&&v("Edge"))||v("Silk")}p=y&&y.userAgentData||null;var S=!w()&&(v("Trident")||v("MSIE"));!v("Android")||_(),_(),v("Safari")&&(_()||!w()&&v("Coast")||!w()&&v("Opera")||!w()&&v("Edge")||(w()?b("Microsoft Edge"):v("Edg/"))||w()&&b("Opera"));var A={},E=null;function I(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=E[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}T();let r=0;for(;;){const t=n(-1),r=n(0),i=n(64),o=n(64);if(64===o&&-1===t)break;e(t<<2|r>>4),64!=i&&(e(r<<4&240|i>>2),64!=o&&e(i<<6&192|o))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function T(){if(!E){E={};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===E[e]&&(E[e]=t)}}}}var x="undefined"!=typeof Uint8Array,P=!S&&"function"==typeof btoa;function U(t){if(!P){var e;void 0===e&&(e=0),T(),e=A[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let u=0,c=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],s=t[u+2],a=e[i>>2];i=e[(3&i)<<4|o>>4],o=e[(15&o)<<2|s>>6],s=e[63&s],n[c++]=a+i+o+s}switch(a=0,s=r,t.length-u){case 2:s=e[(15&(a=t[u+1]))<<2]||r;case 1:t=t[u],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+s+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 B=/[-_.]/g,N={"-":"+",_:"/",".":"="};function O(t){return N[t]||""}function L(t){if(!P)return I(t);B.test(t)&&(t=t.replace(B,O)),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 k(t){return x&&null!=t&&t instanceof Uint8Array}var F={};function V(){return C||=new M(null,F)}function j(t){D(F);var e=t.g;return null==(e=null==e||k(e)?e:"string"==typeof e?L(e):null)?e:t.g=e}var M=class{i(){return new Uint8Array(j(this)||0)}constructor(t,e){if(D(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let C,G;function D(t){if(t!==F)throw Error("illegal external caller")}function z(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function $(){const e=Error();z(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function R(){const t=Error("int32");return z(t,"warning"),t}function W(){return"function"==typeof BigInt}function H(t){return Array.prototype.slice.call(t)}var q="function"==typeof Symbol&&"symbol"==typeof Symbol();function J(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var K=J(),X=J("2ex"),Y=J("1oa"),Q=J("0dg"),Z=q?(t,e)=>{t[K]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},tt=q?(t,e)=>{t[K]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},et=q?t=>0|t[K]:t=>0|t.s,nt=q?t=>t[K]:t=>t.s,rt=q?(t,e)=>{t[K]=e}:(t,e)=>{void 0!==t.s?t.s=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function it(t,e){rt(e,-30975&(0|t))}function ot(t,e){rt(e,-30941&(34|t))}var st,at={},ut={};function ct(t){return!(!t||"object"!=typeof t||t.g!==ut)}function lt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function ht(t,e){if(null!=t)if("string"==typeof t)t=t?new M(t,F):V();else if(t.constructor!==M)if(k(t))t=t.length?new M(new Uint8Array(t),F):V();else{if(!e)throw Error();t=void 0}return t}function ft(t){return!(!Array.isArray(t)||t.length)&&!!(1&et(t))}const dt=[];function gt(t){if(2&t)throw Error()}let pt;function mt(t,e){(e=pt?e[pt]:void 0)&&(t[pt]=H(e))}rt(dt,55),st=Object.freeze(dt);var yt=Object.freeze({}),bt=Object.freeze({}),vt=Object.freeze({}),wt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),_t=t=>wt?t>=At&&t<=It:"-"===t[0]?Tt(t,St):Tt(t,Et);const St=Number.MIN_SAFE_INTEGER.toString(),At=wt?BigInt(Number.MIN_SAFE_INTEGER):void 0,Et=Number.MAX_SAFE_INTEGER.toString(),It=wt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function Tt(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 xt="function"==typeof Uint8Array.prototype.slice;let Pt,Ut=0,Bt=0;function Nt(t){const e=t>>>0;Ut=e,Bt=(t-e)/4294967296>>>0}function Ot(t){if(t<0){Nt(-t);const[e,n]=Ct(Ut,Bt);Ut=e>>>0,Bt=n>>>0}else Nt(t)}function Lt(t){const e=Pt||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Bt=0,Ut=e.getUint32(0,!0)}function kt(t,e){return 4294967296*e+(t>>>0)}function Ft(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=kt(t,e),n?-t:t}function Vt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else W()?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+jt(n)+jt(t));return n}function jt(t){return t=String(t),"0000000".slice(t.length)+t}function Mt(t){if(t.length<16)Ot(Number(t));else if(W())t=BigInt(t),Ut=Number(t&BigInt(4294967295))>>>0,Bt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);Bt=Ut=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));Bt*=1e6,Ut=1e6*Ut+e,Ut>=4294967296&&(Bt+=Math.trunc(Ut/4294967296),Bt>>>=0,Ut>>>=0)}if(e){const[t,e]=Ct(Ut,Bt);Ut=t,Bt=e}}}function Ct(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Gt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function Dt(t){if(null!=t&&"boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}const zt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function $t(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&zt.test(t)}function Rt(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 Wt(t){return"-"!==t[0]&&(t.length<20||20===t.length&&Number(t.substring(0,6))<184467)}function Ht(t){return t=Math.trunc(t),Number.isSafeInteger(t)||(Ot(t),t=Ft(Ut,Bt)),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(Mt(t),t=Ut,2147483648&(e=Bt))if(W())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ct(t,e);t="-"+Vt(n,r)}else t=Vt(t,e);return t}function Jt(t){return null==t?t:"bigint"==typeof t?(_t(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=_t(t)?Number(t):String(t)),t):$t(t)?"number"==typeof t?Ht(t):qt(t):void 0}function Kt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if($t(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)),Wt(t)||(Mt(t),t=Vt(Ut,Bt))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){Ot(t);const e=Vt(Ut,Bt);return t=Number(e),Number.isSafeInteger(t)?t:e}return Wt(String(t))?t:(Ot(t),kt(Ut,Bt))}(t)}}function Xt(t){if("string"!=typeof t)throw Error();return t}function Yt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Qt(t){return null==t||"string"==typeof t?t:void 0}function Zt(t,e,n){if(null!=t&&"object"==typeof t&&t.C===at)return t;if(Array.isArray(t)){var r=et(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&rt(t,i),new e(t)}}function te(t){if(void 0===re&&(re="function"==typeof Proxy?he(Proxy):null),!re||!le())return t;let e=ee?.get(t);return e||(Math.random()>.01?t:(function(t){if(void 0===oe){const t=new re([],{});oe=1===Array.prototype.concat.call([],t).length}oe&&"function"==typeof Symbol&&Symbol.isConcatSpreadable&&(t[Symbol.isConcatSpreadable]=!0)}(t),e=new re(t,{set:(t,e,n)=>($(),t[e]=n,!0)}),function(t,e){(ee||=new ie).set(t,e),(ne||=new ie).set(e,t)}(t,e),e))}let ee,ne,re,ie,oe,se,ae,ue,ce;function le(){return void 0===ie&&(ie="function"==typeof WeakMap?he(WeakMap):null),ie}function he(t){try{return-1!==t.toString().indexOf("[native code]")?t:null}catch{return null}}function fe(t,e,n){if(le()){if(se?.get(e)?.get(t)){if(n)return}else if(Math.random()>.01)return;var r=t.length;n={length:r};for(var i=0;i<Math.min(r,10);i++){if(r<=10)var o=i;else{o=r/10;const t=Math.floor(i*o);o=t+Math.floor(Math.random()*(Math.floor((i+1)*o)-t))}n[o]=t[o]}ge(t,n)?((i=(r=se||=new ie).get(e))||(i=new ie,r.set(e,i)),i.set(t,n)):($(),me(t,e))}}function de(t,e){const n=se?.get(e)?.get(t);n&&!ge(t,n)&&($(),me(t,e))}function ge(t,e){if(t.length!==e.length)return!1;for(const i in e){var n,r=Number(i);if((n=Number.isInteger(r))&&(n=t[r],r=e[r],n=!(Number.isNaN(n)?Number.isNaN(r):n===r)),n)return!1}return!0}function pe(t){if(t&&se?.has(t)){var e=t.l;if(e)for(let n=0;n<e.length;n++){const r=e[n];if(n===e.length-1&<(r))for(const e in r){const n=r[e];Array.isArray(n)&&de(n,t)}else Array.isArray(r)&&de(r,t)}}}function me(t,e){se?.get(e)?.delete(t)}function ye(t,e,n){return t=be(t,e[0],e[1],n?1:2),e!==ue&&n&&Z(t,16384),t}function be(t,e,n,r){if(r=r??0,null==t&&(t=ae),ae=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=et(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(lt(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 rt(t,i),t}function ve(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=ft(t)?void 0:i&&2&et(t)?t:we(t,e,n,void 0!==r,i);else if(lt(t)){const o={};for(let s in t)o[s]=ve(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function we(t,e,n,r,i){const o=r||n?et(t):0;r=r?!!(32&o):void 0;const s=H(t);for(let t=0;t<s.length;t++)s[t]=ve(s[t],e,n,r,i);return n&&(mt(s,t),n(o,s)),s}function _e(t){return t.C===at?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return _t(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ft(t))return}else{if(k(t))return U(t);if(t instanceof M){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=U(e)}}}return t}(t)}function Se(t,e,n=ot){if(null!=t){if(x&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=et(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(rt(t,-12293&(34|r)),t):we(t,Se,4&r?ot:n,!0,!0))}return t.C===at&&(n=t.l,t=2&(r=nt(n))?t:Ee(t,n,r,!0)),t}}function Ae(t){const e=t.l;return Ee(t,e,nt(e),!1)}function Ee(t,e,n,r){return pe(t),t=t.constructor,ae=e=Ie(e,n,r),e=new t(e),ae=void 0,e}function Ie(t,e,n){const r=n||2&e?ot:it,i=!!(32&e);return t=function(t,e,n){const r=H(t);var i=r.length;const o=256&e?r[i-1]:void 0;for(i+=o?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(o){e=r[e]={};for(const t in o)e[t]=n(o[t])}return mt(r,t),r}(t,e,(t=>Se(t,i,r))),Z(t,32|(n?2:0)),t}function Te(t){const e=t.l,n=nt(e);return 2&n?Ee(t,e,n,!1):t}function xe(t,e,n,r){return!(4&e)||null!=n&&(!r&&0===n&&(4096&e||8192&e)&&(t.constructor[Q]=1+(0|t.constructor[Q]))<5&&$(),0!==n&&!(n&e))}function Pe(t,e){return Be(t=t.l,nt(t),e)}function Ue(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function Be(t,e,n,r){if(-1===n)return null;const i=e>>15&1023||536870912;if(!(n>=i)){var o=t.length;return r&&256&e&&null!=(r=t[o-1][n])?(Ue(t,e,i,n)&&null!=X&&((e=(t=G??={})[X]||0)>=4||(t[X]=e+1,$())),r):Ue(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function Ne(t,e,n){const r=t.l;let i=nt(r);return gt(i),Oe(r,i,e,n),t}function Oe(t,e,n,r){const i=e>>15&1023||536870912;if(n>=i){let o,s=e;if(256&e)o=t[t.length-1];else{if(null==r)return s;o=t[i+(+!!(512&e)-1)]={},s|=256}return o[n]=r,n<i&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&rt(t,s),s}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function Le(t,e,n,r,i){var o=2&e;i=Be(t,e,n,i),Array.isArray(i)||(i=st);const s=!(2&r);r=!(1&r);const a=!!(32&e);let u=et(i);return 0!==u||!a||o||s?1&u||(u|=1,rt(i,u)):(u|=33,rt(i,u)),o?(t=!1,2&u||(Z(i,34),t=!!(4&u)),(r||t)&&Object.freeze(i)):(o=!!(2&u)||!!(2048&u),r&&o?(i=H(i),o=1,a&&!s&&(o|=32),rt(i,o),Oe(t,e,n,i)):s&&32&u&&!o&&tt(i,32)),i}function ke(t){t=t.l;let e=nt(t);const n=Be(t,e,1),r=ht(n,!0);return null!=r&&r!==n&&Oe(t,e,1,r),r}function Fe(t,e,n,r,i){const o=t.l;let s=nt(o);const a=2&s?1:r;i=!!i,r=Ve(o,s,e);var u=et(r),c=r;if(de(c,t),2!==a&&1!==a||me(c,t),xe(t,u,void 0,i)){4&u&&(r=H(r),u=Ye(u,s),s=Oe(o,s,e,r));let t=c=0;for(;c<r.length;c++){const e=n(r[c]);null!=e&&(r[t++]=e)}t<c&&(r.length=t),u=-4097&(20|(u=je(u,s))),rt(r,u&=-8193),2&u&&Object.freeze(r)}let l;return 1===a||4===a&&32&u?Me(u)||(t=u,(u|=2)!==t&&rt(r,u),Object.freeze(r)):(n=5===a&&(!!(32&u)||Me(u)||!!ee?.get(r)),(2===a||n)&&Me(u)&&(r=H(r),u=Qe(u=Ye(u,s),s,i),rt(r,u),s=Oe(o,s,e,r)),Me(u)||(e=u,(u=Qe(u,s,i))!==e&&rt(r,u)),n?(l=te(r),fe(r,t,!0)):2!==a||i||ee?.delete(r)),l||r}function Ve(t,e,n){return t=Be(t,e,n),Array.isArray(t)?t:st}function je(t,e){return 0===t&&(t=Ye(t,e)),1|t}function Me(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Ce(t,e){t=t.l;let n=nt(t);gt(n),Oe(t,n,2,""===e?void 0:e)}function Ge(t,e){var n=xi;return $e(De(t=t.l),t,nt(t),n)===e?e:-1}function De(t){if(q)return t[Y]??(t[Y]=new Map);if(Y in t)return t[Y];const e=new Map;return Object.defineProperty(t,Y,{value:e}),e}function ze(t,e,n,r){const i=De(t),o=$e(i,t,e,n);return o!==r&&(o&&(e=Oe(t,e,o)),i.set(n,r)),e}function $e(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 o=r[t];null!=Be(e,n,o)&&(0!==i&&(n=Oe(e,n,i)),i=o)}return t.set(r,i),i}function Re(t,e,n,r){let i,o=nt(t);if(null!=(r=Be(t,o,n,r))&&r.C===at)return(e=Te(r))!==r&&Oe(t,o,n,e),e.l;if(Array.isArray(r)){const t=et(r);i=2&t?ye(Ie(r,t,!1),e,!0):64&t?r:ye(i,e,!0)}else i=ye(void 0,e,!0);return i!==r&&Oe(t,o,n,i),i}function We(t,e,n,r){t=t.l;let i=nt(t);return(e=Zt(r=Be(t,i,n,r),e,i))!==r&&null!=e&&Oe(t,i,n,e),e}function He(t,e,n){if(null==(e=We(t,e,n,!1)))return e;t=t.l;let r=nt(t);if(!(2&r)){const i=Te(e);i!==e&&Oe(t,r,n,e=i)}return e}function qe(t,e,n,r,i,o){var s=t.l,a=!!(2&e);r=a?1:r,i=!!i,o&&=!a,a=Ve(s,e,1);var u=et(a),c=a;if(de(c,t),2!==r&&1!==r||me(c,t),!(c=!!(4&u))){var l=a,h=e;const t=!!(2&(u=je(u,e)));t&&(h|=2);let r=!t,i=!0,o=0,s=0;for(;o<l.length;o++){const e=Zt(l[o],n,h);if(e instanceof n){if(!t){const t=!!(2&et(e.l));r&&=!t,i&&=t}l[s++]=e}}s<o&&(l.length=s),u|=4,u=i?16|u:-17&u,rt(l,u=r?8|u:-9&u),t&&Object.freeze(l)}if(o&&!(8&u||!a.length&&(1===r||4===r&&32&u))){for(Me(u)?(a=H(a),u=Ye(u,e),e=Oe(s,e,1,a)):me(a,t),n=a,o=u,l=0;l<n.length;l++)(u=n[l])!==(h=Te(u))&&(n[l]=h);o|=8,o=n.length?-17&o:16|o,rt(n,o),u=o}let f;return 1===r||4===r&&32&u?Me(u)||(t=u,(u|=!a.length||16&u&&(!c||32&u)?2:2048)!==t&&rt(a,u),Object.freeze(a)):(c=5===r&&(!!(32&u)||Me(u)||!!ee?.get(a)),(2===r||c)&&Me(u)&&(a=H(a),u=Qe(u=Ye(u,e),e,i),rt(a,u),e=Oe(s,e,1,a)),Me(u)||(s=u,(u=Qe(u,e,i))!==s&&rt(a,u)),c?(f=te(a),fe(a,t,!0)):2!==r||i||ee?.delete(a)),f||a}function Je(t,e){const n=nt(t.l);return qe(t,n,e,void 0===yt?2:5,!1,!(2&n))}function Ke(t,e,n,r){return null==r&&(r=void 0),Ne(t,n,r)}function Xe(t,e,n){var r=Li;null==n&&(n=void 0);t:{t=t.l;let i=nt(t);if(gt(i),null==n){const n=De(t);if($e(n,t,i,r)!==e)break t;n.set(r,0)}else i=ze(t,i,r,e);Oe(t,i,e,n)}}function Ye(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Qe(t,e,n){return 32&e&&n||(t&=-33),t}function Ze(t,e){var n=di;const r=nt(t.l);gt(r),t=qe(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&et(e.l)?tt(t,8):tt(t,16)}function tn(t,e){return t??e}function en(t,e,n){{const a=t.l;let u=nt(a);if(gt(u),null==n)Oe(a,u,e);else{n=ne?.get(n)||n;var r,i=et(n),o=i,s=!!(2&i)||Object.isFrozen(n);if((r=!s)&&(r=void 0===vt||void 0!==bt),xe(t,i)){i=21,s&&(n=H(n),o=0,i=Qe(i=Ye(i,u),u,!0));for(let t=0;t<n.length;t++)n[t]=Xt(n[t])}r?(n=H(n),o=0,i=Qe(i=Ye(i,u),u,!0)):s||fe(n,t),i!==o&&rt(n,i),Oe(a,u,e,n)}}}function nn(t,e,n){gt(nt(t.l)),Fe(t,e,Qt,2,!0).push(Xt(n))}function rn(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function on(){return Error("Failed to read varint, encoding is invalid.")}function sn(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function an(t){if("string"==typeof t)return{buffer:L(t),A:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),A:!1};if(t.constructor===Uint8Array)return{buffer:t,A:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),A:!1};if(t.constructor===M)return{buffer:j(t)||new Uint8Array(0),A:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),A:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function un(t,e){let n,r=0,i=0,o=0;const s=t.i;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(o<32&&128&n);for(o>32&&(i|=(127&n)>>4),o=3;o<32&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(gn(t,a),n<128)return e(r>>>0,i>>>0);throw on()}function cn(t){let e=0,n=t.g;const r=n+10,i=t.i;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return gn(t,n),!!(127&e)}throw on()}function ln(t){const e=t.i;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 on();return gn(t,n),i}function hn(t){var e=t.i;const n=t.g;var r=e[n],i=e[n+1];const o=e[n+2];return e=e[n+3],gn(t,t.g+4),t=2*((i=(r<<0|i<<8|o<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function fn(t){return ln(t)}function dn(t,e,{D:n=!1}={}){t.D=n,e&&(e=an(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}function gn(t,e){if(t.g=e,e>t.j)throw sn(t.j,e)}function pn(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.j)throw sn(e,t.j-n);return t.g=r,n}function mn(t,e){if(0==e)return V();var n=pn(t,e);return t.D&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):xt?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?V():new M(n,F)}var yn=[];function bn(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=ln(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw rn(n,t.j);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.i=n,!0}function vn(t){switch(t.i){case 0:0!=t.i?vn(t):cn(t.g);break;case 1:gn(t=t.g,t.g+8);break;case 2:if(2!=t.i)vn(t);else{var e=ln(t.g)>>>0;gn(t=t.g,t.g+e)}break;case 5:gn(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!bn(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}vn(t)}break;default:throw rn(t.i,t.j)}}function wn(t,e,n){const r=t.g.j,i=ln(t.g)>>>0,o=t.g.g+i;let s=o-r;if(s<=0&&(t.g.j=o,n(e,t,void 0,void 0,void 0),s=o-t.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);t.g.g=o,t.g.j=r}function _n(t){var e=ln(t.g)>>>0,a=pn(t=t.g,e);if(t=t.i,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),e=a+e,c=0===a&&e===c.length?c:c.subarray(a,e);try{var l=u.decode(c)}catch(t){if(void 0===i){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(l=a)+e,a=[];let i,o=null;for(;l<e;){var h=t[l++];h<128?a.push(h):h<224?l>=e?n():(i=t[l++],h<194||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):h<240?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&i<160||237===h&&i>=160||128!=(192&(u=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&u)):h<=244?l>=e-2?n():(i=t[l++],128!=(192&i)||i-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),a.length>=8192&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function Sn(t){const e=ln(t.g)>>>0;return mn(t.g,e)}function An(t,e,n){var r=ln(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var En=[];let In;function Tn(t,e,n){e.g?e.j(t,e.g,e.i,n,!0):e.j(t,e.i,n,!0)}var xn=class{constructor(t,e){this.l=be(t,e)}toJSON(){return Pn(this)}A(){return!!(2&et(this.l))}};function Pn(t){pe(t),t=In?t.l:we(t.l,_e,void 0,void 0,!1);{var e=!In;let c=t.length;if(c){var n=t[c-1],r=lt(n);r?c--:n=void 0;var i=t;if(r){t:{var o,s=n,a=!1;if(s)for(let t in s)isNaN(+t)?(o??={})[t]=s[t]:(r=s[t],Array.isArray(r)&&(ft(r)||ct(r)&&0===r.size)&&(r=null),null==r&&(a=!0),null!=r&&((o??={})[t]=r));if(a||(o=s),o)for(let t in o){a=o;break t}a=null}s=null==a?null!=n:a!==n}for(;c>0&&(null==(o=i[c-1])||ft(o)||ct(o)&&0===o.size);c--)var u=!0;(i!==t||s||u)&&(e?(u||s||a)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),a&&i.push(a)),u=i}else u=t}return u}function Un(t){return t?/^\d+$/.test(t)?(Mt(t),new Bn(Ut,Bt)):null:Nn||=new Bn(0,0)}xn.prototype.C=at,xn.prototype.toString=function(){try{return In=!0,Pn(this).toString()}finally{In=!1}};var Bn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let Nn;function On(t){return t?/^-?\d+$/.test(t)?(Mt(t),new Ln(Ut,Bt)):null:kn||=new Ln(0,0)}var Ln=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let kn;function Fn(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 Vn(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function jn(t,e){if(e>=0)Vn(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function Mn(t){var e=Ut;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 Cn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function Gn(t,e,n){Vn(t.g,8*e+n)}function Dn(t,e){return Gn(t,e,2),e=t.g.end(),Cn(t,e),e.push(t.i),e}function zn(t,e){var n=e.pop();for(n=t.i+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.i++;e.push(n),t.i++}function $n(t,e,n){Gn(t,e,2),Vn(t.g,n.length),Cn(t,t.g.end()),Cn(t,n)}function Rn(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Wn=Rn(),Hn=Rn(),qn=Rn(),Jn=Rn(),Kn=Rn(),Xn=Rn(),Yn=Rn(),Qn=Rn(),Zn=class{constructor(t,e,n){this.g=t,this.i=e,t=Wn,this.j=!!t&&n===t||!1}};function tr(t,e){return new Zn(t,e,Wn)}function er(t,e,n,r,i){null!=(e=fr(e,r))&&(n=Dn(t,n),i(e,t),zn(t,n))}const nr=tr((function(t,e,n,r,i){return 2===t.i&&(wn(t,Re(e,r,n),i),!0)}),er),rr=tr((function(t,e,n,r,i){return 2===t.i&&(wn(t,Re(e,r,n,!0),i),!0)}),er);var ir=Symbol(),or=Symbol(),sr=Symbol(),ar=Symbol();let ur,cr;function lr(t,e,n,r){var i=r[t];if(i)return i;(i={}).B=function(t){switch(typeof t){case"boolean":return ue||=[0,void 0,!0];case"number":return t>0?void 0:0===t?ce||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(r[0]);var o=r[1];let s=1;o&&o.constructor===Object&&(i.G=o,"function"==typeof(o=r[++s])&&(i.H=!0,ur??=o,cr??=r[s+1],o=r[s+=2]));const a={};for(;o&&Array.isArray(o)&&o.length&&"number"==typeof o[0]&&o[0]>0;){for(var u=0;u<o.length;u++)a[o[u]]=o;o=r[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=r[++s]);var c=void 0;if(o instanceof Zn?t=o:(t=nr,s--),t?.j){o=r[++s],c=r;var l=s;"function"==typeof o&&(o=o(),c[l]=o),c=o}for(l=u+1,"number"==typeof(o=r[++s])&&o<0&&(l-=o,o=r[++s]);u<l;u++){const r=a[u];c?n(i,u,t,c,r):e(i,u,t,r)}}return r[t]=i}function hr(t){return Array.isArray(t)?t[0]instanceof Zn?t:[rr,t]:[t,void 0]}function fr(t,e){return t instanceof xn?(pe(t),t.l):Array.isArray(t)?ye(t,e,!1):void 0}function dr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function gr(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=lr(or,dr,gr,r).B,s||=pr(r),i)}function pr(t){let e=t[sr];if(null!=e)return e;const n=lr(or,dr,gr,t);return e=n.H?(t,e)=>ur(t,e,n):(t,e)=>{const r=nt(t);for(;bn(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=mr(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,vn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=mn(o.g,s)),i=t,o&&(pt||=Symbol(),(s=i[pt])?s.push(o):i[pt]=[o]))}return 16384&r&&Z(t,34),!0},t[sr]=e}function mr(t){const e=(t=hr(t))[0].g;if(t=t[1]){const n=pr(t),r=lr(or,dr,gr,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function yr(t,e,n){t[e]=n.i}function br(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=lr(ir,yr,br,r).B,i||=vr(r))}function vr(t){let e=t[ar];if(!e){const n=lr(ir,yr,br,t);e=(t,e)=>wr(t,e,n),t[ar]=e}return e}function wr(t,e,n){for(var r=et(t),i=+!!(512&r)-1,o=t.length,s=512&r?1:0,a=o+(256&r?-1:0);s<a;s++){const r=t[s];if(null==r)continue;const o=s-i,a=_r(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(const t in r)i=+t,Number.isNaN(i)||null!=(o=r[i])&&(a=_r(n,i))&&a(e,o,i)}if(t=pt?t[pt]:void 0)for(Cn(e,e.g.end()),n=0;n<t.length;n++)Cn(e,j(t[n])||new Uint8Array(0))}function _r(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=hr(n))[0].i;if(n=n[1]){const e=vr(n),i=lr(ir,yr,br,n).B;n=t.H?cr(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function Sr(t,e){if(Array.isArray(e)){var n=et(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),rt(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}function Ar(t,e,n){return new Zn(t,e,n)}function Er(t,e,n){return new Zn(t,e,n)}function Ir(t,e,n){Oe(t,nt(t),e,n)}function Tr(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($t(t)){if("string"===e)return qt(t);if("number"===e)return Ht(t)}}(e),null!=e){if("string"==typeof e)On(e);if(null!=e)switch(Gn(t,n,0),typeof e){case"number":t=t.g,Ot(e),Fn(t,Ut,Bt);break;case"bigint":n=BigInt.asUintN(64,e),n=new Ln(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Fn(t.g,n.i,n.g);break;default:n=On(e),Fn(t.g,n.i,n.g)}}}function xr(t,e,n){null!=(e=Rt(e))&&null!=e&&(Gn(t,n,0),jn(t.g,e))}function Pr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Gn(t,n,0),t.g.g.push(e?1:0))}function Ur(t,e,n){null!=(e=Qt(e))&&$n(t,n,c(e))}function Br(t,e,n,r,i){null!=(e=fr(e,r))&&(n=Dn(t,n),i(e,t),zn(t,n))}function Nr(t,e,n){null!=(e=null==e||"string"==typeof e||k(e)||e instanceof M?e:void 0)&&$n(t,n,an(e).buffer)}var Or=Ar((function(t,e,n){return 5===t.i&&(Ir(e,n,hn(t.g)),!0)}),(function(t,e,n){null!=(e=Gt(e))&&(Gn(t,n,5),t=t.g,Lt(e),Mn(t))}),Xn),Lr=Er((function(t,e,n){return(5===t.i||2===t.i)&&(e=Le(e,nt(e),n,2,!1),2==t.i?An(t,hn,e):e.push(hn(t.g)),!0)}),(function(t,e,n){if(null!=(e=Sr(Gt,e))&&e.length){Gn(t,n,2),Vn(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Lt(e[r]),Mn(n)}}),Xn),kr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,un(t.g,Ft)),!0)}),Tr,Kn),Fr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,0===(t=un(t.g,Ft))?void 0:t),!0)}),Tr,Kn),Vr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,un(t.g,kt)),!0)}),(function(t,e,n){if(null!=(e=Kt(e))){if("string"==typeof e)Un(e);if(null!=e)switch(Gn(t,n,0),typeof e){case"number":t=t.g,Ot(e),Fn(t,Ut,Bt);break;case"bigint":n=BigInt.asUintN(64,e),n=new Bn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Fn(t.g,n.i,n.g);break;default:n=Un(e),Fn(t.g,n.i,n.g)}}}),Rn()),jr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,ln(t.g)),!0)}),xr,Jn),Mr=Er((function(t,e,n){return(0===t.i||2===t.i)&&(e=Le(e,nt(e),n,2,!1),2==t.i?An(t,ln,e):e.push(ln(t.g)),!0)}),(function(t,e,n){if(null!=(e=Sr(Rt,e))&&e.length){n=Dn(t,n);for(let n=0;n<e.length;n++)jn(t.g,e[n]);zn(t,n)}}),Jn),Cr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,0===(t=ln(t.g))?void 0:t),!0)}),xr,Jn),Gr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,cn(t.g)),!0)}),Pr,Hn),Dr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,!1===(t=cn(t.g))?void 0:t),!0)}),Pr,Hn),zr=Er((function(t,e,n){if(2!==t.i)return!1;t=_n(t);const r=nt(e);return gt(r),Le(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=Sr(Qt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&$n(r,i,c(o))}}),qn),$r=Ar((function(t,e,n){return 2===t.i&&(Ir(e,n,""===(t=_n(t))?void 0:t),!0)}),Ur,qn),Rr=Ar((function(t,e,n){return 2===t.i&&(Ir(e,n,_n(t)),!0)}),Ur,qn),Wr=function(t,e,n=Wn){return new Zn(t,e,n)}((function(t,e,n,r,i){if(2!==t.i)return!1;r=ye(void 0,r,!0);let o=nt(e);gt(o);let s=Le(e,o,n,3);return o=nt(e),4&et(s)&&(s=H(s),rt(s,-2079&(1|et(s))),Oe(e,o,n,s)),s.push(r),wn(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)Br(t,e[o],n,r,i)})),Hr=tr((function(t,e,n,r,i,o){return 2===t.i&&(ze(e,et(e),o,n),wn(t,e=Re(e,r,n),i),!0)}),Br),qr=Ar((function(t,e,n){return 2===t.i&&(Ir(e,n,Sn(t)),!0)}),Nr,Yn),Jr=Ar((function(t,e,n){return 0===t.i&&(Ir(e,n,ln(t.g)),!0)}),(function(t,e,n){null!=(e=Rt(e))&&(e=parseInt(e,10),Gn(t,n,0),jn(t.g,e))}),Qn);class Kr{constructor(t,e){this.i=t,this.g=e,this.j=Ke,this.defaultValue=void 0}}function Xr(t,e){return(n,r)=>{if(En.length){const t=En.pop();t.o(r),dn(t.g,n,r),n=t}else n=new class{constructor(t,e){if(yn.length){const n=yn.pop();dn(n,t,e),t=n}else t=new class{constructor(t,e){this.i=null,this.m=!1,this.g=this.j=this.v=0,dn(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.v=0,this.D=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({F:t=!1}={}){this.F=t}}(n,r);try{const r=new t,o=r.l;pr(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,En.length<100&&En.push(n)}return i}}var Yr=[0,$r,Ar((function(t,e,n){return 2===t.i&&(Ir(e,n,(t=Sn(t))===V()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof xn){const r=e.N;return void(r&&(e=r(e),null!=e&&$n(t,n,an(e).buffer)))}if(Array.isArray(e))return}Nr(t,e,n)}),Yn)];let Qr,Zr=globalThis.trustedTypes;function ti(t){void 0===Qr&&(Qr=function(){let t=null;if(!Zr)return t;try{const e=t=>t;t=Zr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Qr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function ei(t,...e){if(0===e.length)return ti(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return ti(n)}var ni=[0,jr,Jr,Gr,-1,Mr,Jr,-1],ri=class extends xn{constructor(){super()}},ii=[0,Gr,Rr,Gr,Jr,-1,Er((function(t,e,n){return(0===t.i||2===t.i)&&(e=Le(e,nt(e),n,2,!1),2==t.i?An(t,fn,e):e.push(ln(t.g)),!0)}),(function(t,e,n){if(null!=(e=Sr(Rt,e))&&e.length){n=Dn(t,n);for(let n=0;n<e.length;n++)jn(t.g,e[n]);zn(t,n)}}),Qn),Rr,-1,[0,Gr,-1],Jr,Gr,-1],oi=[0,Rr,-2],si=class extends xn{constructor(){super()}},ai=[0],ui=[0,jr,Gr,1,Gr,-3],ci=class extends xn{constructor(t){super(t,2)}},li={};li[336783863]=[0,Rr,Gr,-1,jr,[0,[1,2,3,4,5,6,7],Hr,ai,Hr,ii,Hr,oi,Hr,ui,Hr,ni,Hr,[0,Rr,-2],Hr,[0,Rr,Jr]],[0,Rr],Gr,[0,[1,3],[2,4],Hr,[0,Mr],-1,Hr,[0,zr],-1,Wr,[0,Rr,-1]],Rr];var hi=[0,Fr,-1,Dr,-3,Fr,Mr,$r,Cr,Fr,-1,Dr,Cr,Dr,-2,$r];function fi(t){nn(t,3,"TEXT:text_in")}var di=class extends xn{constructor(t){super(t,500)}o(t){return Ke(this,0,7,t)}},gi=[-1,{}],pi=[0,Rr,1,gi],mi=[0,Rr,zr,gi];function yi(t){nn(t,10,"text_in")}var bi,vi=class extends xn{constructor(){super(void 0,500)}o(t){return Ke(this,0,1001,t)}};vi.prototype.g=(bi=[-500,Wr,[-500,$r,-1,zr,-3,[-2,li,Gr],Wr,Yr,Cr,-1,pi,mi,Wr,[0,$r,Dr],$r,hi,Cr,zr,987,zr],4,Wr,[-500,Rr,-1,[-1,{}],998,Rr],Wr,[-500,Rr,zr,-1,[-2,{},Gr],997,zr,-1],Cr,Wr,[-500,Rr,zr,gi,998,zr],zr,Cr,pi,mi,Wr,[0,$r,-1,gi],zr,-2,hi,$r,-1,Dr,979,gi,Wr,Yr],function(){pe(this);const t=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};wr(this.l,t,lr(ir,yr,br,bi)),Cn(t,t.g.end());const e=new Uint8Array(t.i),n=t.j,r=n.length;let i=0;for(let t=0;t<r;t++){const r=n[t];e.set(r,i),i+=r.length}return t.j=[e],e});var wi=class extends xn{constructor(t){super(t)}},_i=class extends xn{constructor(t){super(t)}g(){return Je(this,wi)}},Si=class extends xn{constructor(t){super(t)}},Ai=Xr(class extends xn{constructor(t){super(t)}},[0,Wr,[0,1,jr,Rr,[0,Wr,[0,jr,Or,Rr,-1]]],kr]),Ei=class extends xn{constructor(t){super(t)}},Ii=class extends xn{constructor(t){super(t)}I(){const t=ke(this);return null==t?V():t}},Ti=class extends xn{constructor(t){super(t)}},xi=[1,2],Pi=Xr(class extends xn{constructor(t){super(t)}},[0,Wr,[0,xi,Hr,[0,Lr],Hr,[0,qr],jr,Rr],kr]),Ui=class extends xn{constructor(t){super(t)}},Bi=class extends xn{constructor(t){super(t)}},Ni=[0,Gr,-1],Oi=class extends xn{constructor(t){super(t)}},Li=[1,2,3,4,5],ki=class extends xn{constructor(t){super(t)}g(){return null!=ke(this)}i(){return null!=Qt(Pe(this,2))}},Fi=class extends xn{constructor(t){super(t)}},Vi=[0,[0,qr,Rr,[0,jr,kr,-1],[0,Vr,kr]],Gr,[0,Li,Hr,ui,Hr,ii,Hr,ni,Hr,ai,Hr,oi],Jr],ji=class extends xn{constructor(t){super(t)}},Mi=new Kr(462704549,ji);li[462704549]=[0,Vi,[0,Rr,jr,Or,zr,-1]];var Ci=class extends xn{constructor(t){super(t)}},Gi=new Kr(477589892,Ci);function Di(t,e){if(e=e?Ae(e):new Ui,void 0!==t.displayNamesLocale?Ne(e,1,Yt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&Ne(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw R();if(!Number.isFinite(n))throw R();n|=0}Ne(e,2,n)}else"maxResults"in t&&Ne(e,2);if(void 0!==t.scoreThreshold){if(null!=(n=t.scoreThreshold)&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);Ne(e,3,n)}else"scoreThreshold"in t&&Ne(e,3);return void 0!==t.categoryAllowlist?en(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&Ne(e,4),void 0!==t.categoryDenylist?en(e,5,t.categoryDenylist):"categoryDenylist"in t&&Ne(e,5),e}function zi(t){const e={classifications:Je(t,Si).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=tn(Rt(Pe(t,1)),0)??-1;const n=t.l;let r=nt(n);const i=Be(n,r,2),o=Gt(i);return null!=o&&o!==i&&Oe(n,r,2,o),{index:e,score:o??0??0,categoryName:tn(Qt(Pe(t,3)),"")??"",displayName:tn(Qt(Pe(t,4)),"")??""}})),headIndex:e,headName:n}}(He(t,_i,4)?.g()??[],tn(Rt(Pe(t,2)),0),tn(Qt(Pe(t,3)),""))))};return null!=Jt(Pe(t,2))&&(e.timestampMs=tn(Jt(Pe(t,2)),0)),e}function $i(t){return Array.from(t,(t=>t>127?t-256:t))}function Ri(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 o=0;o<t.length;o++)n+=t[o]*e[o],r+=t[o]*t[o],i+=e[o]*e[o];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Wi;li[477589892]=[0,Vi,Ni];const Hi=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 qi(){if(void 0===Wi)try{await WebAssembly.instantiate(Hi),Wi=!0}catch{Wi=!1}return Wi}async function Ji(t,e=ei``){const n=await qi()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Ki=class{};function Xi(){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 Yi(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())}Ki.forVisionTasks=function(t){return Ji("vision",t)},Ki.forTextTasks=function(t){return Ji("text",t)},Ki.forGenAiExperimentalTasks=function(t){return Ji("genai_experimental",t)},Ki.forGenAiTasks=function(t){return Ji("genai",t)},Ki.forAudioTasks=function(t){return Ji("audio",t)},Ki.isSimdSupported=function(){return qi()},e("FilesetResolver",Ki);function Qi(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.h.stringToNewUTF8(e)),t.h._free(e)}function Zi(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.h.stringToNewUTF8(e[n]);e=t.h._malloc(4*r.length),t.h.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.h._free(e);t.h._free(e)}function to(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function eo(t,e,n){let r=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const no=function(t){return class extends t{M(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.h=t,this.g=null,this.i=0,this.m="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:Xi()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.h._malloc(n);this.h.HEAPU8.set(t,r),e?this.h._changeBinaryGraph(n,r):this.h._changeTextGraph(n,r),this.h._free(r)}configureAudio(t,e,n,r,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Qi(this,r||"input_audio",(r=>{Qi(this,i=i||"audio_header",(i=>{this.h._configureAudio(r,i,t,e??0,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const o=4*t.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(t,this.g/4),Qi(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Qi(this,e,(e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();const r=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!r)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[i,o]=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];!this.j||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);const[s,a]=[i,o];this.h._addBoundTextureToStream(e,s,a,n)}))}addBoolToStream(t,e,n){Qi(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Qi(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Qi(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Qi(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Qi(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Qi(this,e,(e=>{Qi(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Qi(this,e,(e=>{Zi(this,Object.keys(t),(r=>{Zi(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Qi(this,n,(n=>{Qi(this,e,(e=>{const i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,n,r),this.h._free(i)}))}))}addEmptyPacketToStream(t,e){Qi(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){Qi(this,e,(e=>{const r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Qi(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Qi(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Qi(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Qi(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Qi(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Qi(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Qi(this,e,(e=>{Qi(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Qi(this,n,(n=>{Qi(this,e,(e=>{const r=this.h._malloc(t.length);this.h.HEAPU8.set(t,r),this.h._addProtoToInputSidePacket(r,t.length,e,n),this.h._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){Qi(this,e,(e=>{const n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Qi(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){to(this,t,e),Qi(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){eo(this,t,e),Qi(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){to(this,t,e),Qi(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){eo(this,t,e),Qi(this,t,(t=>{this.h._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),to(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Qi(this,t,(t=>{this.h._attachAudioListener(t,n||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}});var ro=class extends no{};async function io(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Yi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Yi(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),await t.o(n),t}async function oo(t,e,n){return io(t,e,n)}function so(t,e){const n=He(t.baseOptions,ki,1)||new ki;"string"==typeof e?(Ne(n,2,Yt(e)),Ne(n,1)):e instanceof Uint8Array&&(Ne(n,1,ht(e,!1)),Ne(n,2)),Ke(t.baseOptions,0,1,n)}function ao(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(He(t.baseOptions,ki,1)?.g()||He(t.baseOptions,ki,1)?.i()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=He(t.baseOptions,Oi,3);if(!n){var r=n=new Oi;Xe(r,4,new si)}"delegate"in e&&("GPU"===e.delegate?Xe(e=n,2,r=new ri):Xe(e=n,4,r=new si)),Ke(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${t.status})`)})).then((e=>{try{t.g.h.FS_unlink("/model.dat")}catch{}t.g.h.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),so(t,"/model.dat"),t.v()}));if(n.modelAssetBuffer instanceof Uint8Array)so(t,n.modelAssetBuffer);else if(n.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;return t}(n.modelAssetBuffer).then((e=>{so(t,e),t.v()}));return t.v(),Promise.resolve()}function uo(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function co(t,e){t.j=Math.max(t.j,e)}var lo=class{constructor(t){this.g=t,this.m=[],this.j=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.m.push(Error(e))})),this.g.M(),this.g.setGraph(t,e),uo(this)}finishProcessing(){this.g.finishProcessing(),uo(this)}close(){this.g.closeGraph()}};lo.prototype.close=lo.prototype.close,e("TaskRunner",lo);var ho=class extends lo{constructor(t,e){super(new ro(t,e)),this.u={languages:[]},Ke(t=this.i=new ji,0,1,e=new Fi)}o(t){return Ke(this.i,0,2,Di(t,He(this.i,Ui,2))),ao(this,t)}get baseOptions(){return He(this.i,Fi,1)}set baseOptions(t){Ke(this.i,0,1,t)}K(t){return this.u={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new vi;yi(t),nn(t,15,"classifications_out");const e=new ci;Tn(e,Mi,this.i);const n=new di;Ce(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),fi(n),nn(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ze(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=zi(Ai(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.u.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),co(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{co(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ho.prototype.detect=ho.prototype.K,ho.prototype.setOptions=ho.prototype.o,ho.createFromModelPath=function(t,e){return oo(ho,t,{baseOptions:{modelAssetPath:e}})},ho.createFromModelBuffer=function(t,e){return oo(ho,t,{baseOptions:{modelAssetBuffer:e}})},ho.createFromOptions=function(t,e){return oo(ho,t,e)};var fo=class extends lo{constructor(t,e){super(new ro(t,e)),this.u={classifications:[]},Ke(t=this.i=new ji,0,1,e=new Fi)}o(t){return Ke(this.i,0,2,Di(t,He(this.i,Ui,2))),ao(this,t)}get baseOptions(){return He(this.i,Fi,1)}set baseOptions(t){Ke(this.i,0,1,t)}J(t){return this.u={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new vi;yi(t),nn(t,15,"classifications_out");const e=new ci;Tn(e,Mi,this.i);const n=new di;Ce(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),fi(n),nn(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ze(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=zi(Ai(t)),co(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{co(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};fo.prototype.classify=fo.prototype.J,fo.prototype.setOptions=fo.prototype.o,fo.createFromModelPath=function(t,e){return oo(fo,t,{baseOptions:{modelAssetPath:e}})},fo.createFromModelBuffer=function(t,e){return oo(fo,t,{baseOptions:{modelAssetBuffer:e}})},fo.createFromOptions=function(t,e){return oo(fo,t,e)};var go=class extends lo{constructor(t,e){super(new ro(t,e)),this.u={embeddings:[]},Ke(t=this.i=new Ci,0,1,e=new Fi)}o(t){var e=this.i,n=He(this.i,Bi,2);return n=n?Ae(n):new Bi,void 0!==t.l2Normalize?Ne(n,1,Dt(t.l2Normalize)):"l2Normalize"in t&&Ne(n,1),void 0!==t.quantize?Ne(n,2,Dt(t.quantize)):"quantize"in t&&Ne(n,2),Ke(e,0,2,n),ao(this,t)}get baseOptions(){return He(this.i,Fi,1)}set baseOptions(t){Ke(this.i,0,1,t)}L(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new vi;yi(t),nn(t,15,"embeddings_out");const e=new ci;Tn(e,Gi,this.i);const n=new di;Ce(n,Yt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),fi(n),nn(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),Ze(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Pi(t),this.u=function(t){return{embeddings:Je(t,Ti).map((t=>{const e={headIndex:tn(Rt(Pe(t,3)),0)??-1,headName:tn(Qt(Pe(t,4)),"")??""};if(void 0!==We(t,Ei,Ge(t,1)))e.floatEmbedding=Fe(He(t,Ei,Ge(t,1)),1,Gt,void 0===yt?2:5).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=He(t,Ii,Ge(t,2))?.I()?.i()??n}return e})),timestampMs:tn(Jt(Pe(t,2)),0)}}(t),co(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{co(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};go.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Ri(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Ri($i(t.quantizedEmbedding),$i(e.quantizedEmbedding))}return t},go.prototype.embed=go.prototype.L,go.prototype.setOptions=go.prototype.o,go.createFromModelPath=function(t,e){return oo(go,t,{baseOptions:{modelAssetPath:e}})},go.createFromModelBuffer=function(t,e){return oo(go,t,{baseOptions:{modelAssetBuffer:e}})},go.createFromOptions=function(t,e){return oo(go,t,e)},exports.LanguageDetector=ho,exports.TextClassifier=fo,exports.TextEmbedder=go;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof self?self:{};function e(e,n){t:{for(var r=["CLOSURE_FLAGS"],i=t,o=0;o<r.length;o++)if(null==(i=i[r[o]])){r=null;break t}r=i}return null!=(e=r&&r[e])?e: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,o;const s="undefined"!=typeof TextDecoder;let a;const u="undefined"!=typeof TextEncoder;function c(t){if(u)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 o=t.charCodeAt(++i);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-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 l,h=e(610401301,!1),f=e(653718497,e(1,!0));const d=t.navigator;function g(t){return!!h&&(!!l&&l.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function p(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function m(){return!!h&&(!!l&&l.brands.length>0)}function y(){return m()?g("Chromium"):(p("Chrome")||p("CriOS"))&&!(!m()&&p("Edge"))||p("Silk")}l=d&&d.userAgentData||null;var b=!m()&&(p("Trident")||p("MSIE"));!p("Android")||y(),y(),p("Safari")&&(y()||!m()&&p("Coast")||!m()&&p("Opera")||!m()&&p("Edge")||(m()?g("Microsoft Edge"):p("Edg/"))||m()&&g("Opera"));var v={},w=null;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),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=w[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}S();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function S(){if(!w){w={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++){var r=t.concat(e[n].split(""));v[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===w[o]&&(w[o]=i)}}}}var A="undefined"!=typeof Uint8Array,E=!b&&"function"==typeof btoa;function I(t){if(!E){var e;void 0===e&&(e=0),S(),e=v[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let u=0,c=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],s=t[u+2],a=e[i>>2];i=e[(3&i)<<4|o>>4],o=e[(15&o)<<2|s>>6],s=e[63&s],n[c++]=a+i+o+s}switch(a=0,s=r,t.length-u){case 2:s=e[(15&(a=t[u+1]))<<2]||r;case 1:t=t[u],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+s+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 T=/[-_.]/g,x={"-":"+",_:"/",".":"="};function P(t){return x[t]||""}function U(t){if(!E)return _(t);T.test(t)&&(t=t.replace(T,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 B(t){return A&&null!=t&&t instanceof Uint8Array}var N={};let O;function L(t){if(t!==N)throw Error("illegal external caller")}function k(){return O||=new V(null,N)}function F(t){L(N);var e=t.g;return null==(e=null==e||B(e)?e:"string"==typeof e?U(e):null)?e:t.g=e}var V=class{constructor(t,e){if(L(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}i(){return new Uint8Array(F(this)||0)}};function j(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}let M;function C(){const e=Error();j(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}function G(){const t=Error("int32");return j(t,"warning"),t}function D(){return"function"==typeof BigInt}function z(t){return Array.prototype.slice.call(t)}var $="function"==typeof Symbol&&"symbol"==typeof Symbol();function R(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():t}var W=R(),H=R("2ex"),q=R("1oa"),J=R("0dg"),K=$?(t,e)=>{t[W]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},X=$?(t,e)=>{t[W]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},Y=$?t=>0|t[W]:t=>0|t.s,Q=$?t=>t[W]:t=>t.s,Z=$?(t,e)=>{t[W]=e}:(t,e)=>{void 0!==t.s?t.s=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function tt(t,e){Z(e,-30975&(0|t))}function et(t,e){Z(e,-30941&(34|t))}var nt,rt={},it={};function ot(t){return!(!t||"object"!=typeof t||t.g!==it)}function st(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function at(t,e,n){if(null!=t)if("string"==typeof t)t=t?new V(t,N):k();else if(t.constructor!==V)if(B(t))t=t.length?new V(n?t:new Uint8Array(t),N):k();else{if(!e)throw Error();t=void 0}return t}function ut(t){return!(!Array.isArray(t)||t.length)&&!!(1&Y(t))}const ct=[];function lt(t){if(2&t)throw Error()}let ht;function ft(t,e){(e=ht?e[ht]:void 0)&&(t[ht]=z(e))}Z(ct,55),nt=Object.freeze(ct);var dt=Object.freeze({}),gt=Object.freeze({}),pt=Object.freeze({}),mt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),yt=t=>mt?t>=vt&&t<=_t:"-"===t[0]?St(t,bt):St(t,wt);const bt=Number.MIN_SAFE_INTEGER.toString(),vt=mt?BigInt(Number.MIN_SAFE_INTEGER):void 0,wt=Number.MAX_SAFE_INTEGER.toString(),_t=mt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function St(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 At="function"==typeof Uint8Array.prototype.slice;let Et,It=0,Tt=0;function xt(t){const e=t>>>0;It=e,Tt=(t-e)/4294967296>>>0}function Pt(t){if(t<0){xt(-t);const[e,n]=Ft(It,Tt);It=e>>>0,Tt=n>>>0}else xt(t)}function Ut(t){const e=Et||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),Tt=0,It=e.getUint32(0,!0)}function Bt(t,e){return 4294967296*e+(t>>>0)}function Nt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=Bt(t,e),n?-t:t}function Ot(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else D()?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+Lt(n)+Lt(t));return n}function Lt(t){return t=String(t),"0000000".slice(t.length)+t}function kt(t){if(t.length<16)Pt(Number(t));else if(D())t=BigInt(t),It=Number(t&BigInt(4294967295))>>>0,Tt=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);Tt=It=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));Tt*=1e6,It=1e6*It+e,It>=4294967296&&(Tt+=Math.trunc(It/4294967296),Tt>>>=0,It>>>=0)}if(e){const[t,e]=Ft(It,Tt);It=t,Tt=e}}}function Ft(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Vt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function jt(t){if(null!=t&&"boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}return t}const Mt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ct(t){const e=typeof t;switch(e){case"bigint":return!0;case"number":return Number.isFinite(t)}return"string"===e&&Mt.test(t)}function Gt(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 Dt(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)||(Pt(t),t=Nt(It,Tt)),t}function $t(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(kt(t),t=It,2147483648&(e=Tt))if(D())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=Ft(t,e);t="-"+Ot(n,r)}else t=Ot(t,e);return t}function Rt(t){return null==t?t:"bigint"==typeof t?(yt(t)?t=Number(t):(t=BigInt.asIntN(64,t),t=yt(t)?Number(t):String(t)),t):Ct(t)?"number"==typeof t?zt(t):$t(t):void 0}function Wt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(BigInt.asUintN(64,t));if(Ct(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)),Dt(t)||(kt(t),t=Ot(It,Tt))),t;if("number"===e)return(t=Math.trunc(t))>=0&&Number.isSafeInteger(t)?t:function(t){if(t<0){Pt(t);const e=Ot(It,Tt);return t=Number(e),Number.isSafeInteger(t)?t:e}return Dt(String(t))?t:(Pt(t),Bt(It,Tt))}(t)}}function Ht(t){if("string"!=typeof t)throw Error();return t}function qt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function Jt(t){return null==t||"string"==typeof t?t:void 0}function Kt(t,e,n){if(null!=t&&"object"==typeof t&&t.C===rt)return t;if(Array.isArray(t)){var r=Y(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&Z(t,i),new e(t)}}function Xt(t){if(void 0===Zt&&(Zt="function"==typeof Proxy?ae(Proxy):null),!Zt||!se())return t;let e=Yt?.get(t);return e||(Math.random()>.01?t:(function(t){if(void 0===ee){const t=new Zt([],{});ee=1===Array.prototype.concat.call([],t).length}ee&&"function"==typeof Symbol&&Symbol.isConcatSpreadable&&(t[Symbol.isConcatSpreadable]=!0)}(t),e=new Zt(t,{set:(t,e,n)=>(C(),t[e]=n,!0)}),function(t,e){(Yt||=new te).set(t,e),(Qt||=new te).set(e,t)}(t,e),e))}let Yt,Qt,Zt,te,ee,ne,re,ie,oe;function se(){return void 0===te&&(te="function"==typeof WeakMap?ae(WeakMap):null),te}function ae(t){try{return-1!==t.toString().indexOf("[native code]")?t:null}catch{return null}}function ue(t,e,n){if(se()){if(ne?.get(e)?.get(t)){if(n)return}else if(Math.random()>.01)return;var r=t.length;n={length:r};for(var i=0;i<Math.min(r,10);i++){if(r<=10)var o=i;else{o=r/10;const t=Math.floor(i*o);o=t+Math.floor(Math.random()*(Math.floor((i+1)*o)-t))}n[o]=t[o]}le(t,n)?((i=(r=ne||=new te).get(e))||(i=new te,r.set(e,i)),i.set(t,n)):(C(),fe(t,e))}}function ce(t,e){const n=ne?.get(e)?.get(t);n&&!le(t,n)&&(C(),fe(t,e))}function le(t,e){if(t.length!==e.length)return!1;for(const i in e){var n,r=Number(i);if((n=Number.isInteger(r))&&(n=t[r],r=e[r],n=!(Number.isNaN(n)?Number.isNaN(r):n===r)),n)return!1}return!0}function he(t){if(t&&ne?.has(t)){var e=t.l;if(e)for(let n=0;n<e.length;n++){const r=e[n];if(n===e.length-1&&st(r))for(const e in r){const n=r[e];Array.isArray(n)&&ce(n,t)}else Array.isArray(r)&&ce(r,t)}}}function fe(t,e){ne?.get(e)?.delete(t)}function de(t,e,n){return t=ge(t,e[0],e[1],n?1:2),e!==ie&&n&&K(t,16384),t}function ge(t,e,n,r){if(r=r??0,null==t&&(t=re),re=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=Y(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(st(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 Z(t,i),t}function pe(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=ut(t)?void 0:i&&2&Y(t)?t:me(t,e,n,void 0!==r,i);else if(st(t)){const o={};for(let s in t)o[s]=pe(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function me(t,e,n,r,i){const o=r||n?Y(t):0;r=r?!!(32&o):void 0;const s=z(t);for(let t=0;t<s.length;t++)s[t]=pe(s[t],e,n,r,i);return n&&(ft(s,t),n(o,s)),s}function ye(t){return t.C===rt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return yt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(ut(t))return}else{if(B(t))return I(t);if(t instanceof V){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=I(e)}}}return t}(t)}function be(t,e,n=et){if(null!=t){if(A&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Y(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Z(t,-12293&(34|r)),t):me(t,be,4&r?et:n,!0,!0))}return t.C===rt&&(n=t.l,t=2&(r=Q(n))?t:we(t,n,r,!0)),t}}function ve(t){const e=t.l;return we(t,e,Q(e),!1)}function we(t,e,n,r){return he(t),t=t.constructor,re=e=_e(e,n,r),e=new t(e),re=void 0,e}function _e(t,e,n){const r=n||2&e?et:tt,i=!!(32&e);return t=function(t,e,n){const r=z(t);var i=r.length;const o=256&e?r[i-1]:void 0;for(i+=o?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(o){e=r[e]={};for(const t in o)e[t]=n(o[t])}return ft(r,t),r}(t,e,(t=>be(t,i,r))),K(t,32|(n?2:0)),t}function Se(t){const e=t.l,n=Q(e);return 2&n?we(t,e,n,!1):t}function Ae(t,e,n,r){return!(4&e)||null!=n&&(!r&&0===n&&(4096&e||8192&e)&&(t.constructor[J]=1+(0|t.constructor[J]))<5&&C(),0!==n&&!(n&e))}function Ee(t,e){return Te(t=t.l,Q(t),e)}function Ie(t,e,n,r){if(!((e=r+(+!!(512&e)-1))<0||e>=t.length||e>=n))return t[e]}function Te(t,e,n,r){if(-1===n)return null;const i=e>>15&1023||536870912;if(!(n>=i)){var o=t.length;return r&&256&e&&null!=(r=t[o-1][n])?(Ie(t,e,i,n)&&null!=H&&((e=(t=M??={})[H]||0)>=4||(t[H]=e+1,C())),r):Ie(t,e,i,n)}return 256&e?t[t.length-1][n]:void 0}function xe(t,e,n){const r=t.l;let i=Q(r);return lt(i),Pe(r,i,e,n),t}function Pe(t,e,n,r){const i=e>>15&1023||536870912;if(n>=i){let o,s=e;if(256&e)o=t[t.length-1];else{if(null==r)return s;o=t[i+(+!!(512&e)-1)]={},s|=256}return o[n]=r,n<i&&(t[n+(+!!(512&e)-1)]=void 0),s!==e&&Z(t,s),s}return t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n]),e}function Ue(t,e,n,r,i){var o=2&e;i=Te(t,e,n,i),Array.isArray(i)||(i=nt);const s=!(2&r);r=!(1&r);const a=!!(32&e);let u=Y(i);return 0!==u||!a||o||s?1&u||(u|=1,Z(i,u)):(u|=33,Z(i,u)),o?(t=!1,2&u||(K(i,34),t=!!(4&u)),(r||t)&&Object.freeze(i)):(o=!!(2&u)||!!(2048&u),r&&o?(i=z(i),o=1,a&&!s&&(o|=32),Z(i,o),Pe(t,e,n,i)):s&&32&u&&!o&&X(i,32)),i}function Be(t){t=t.l;let e=Q(t);const n=Te(t,e,1),r=at(n,!0,!!(34&e));return null!=r&&r!==n&&Pe(t,e,1,r),r}function Ne(t,e,n,r,i,o){const s=t.l;let a=Q(s);r=2&a?1:r,o=!!o,i=Oe(s,a,e,i);var u=Y(i),c=i;if(ce(c,t),2!==r&&1!==r||fe(c,t),Ae(t,u,void 0,o)){4&u&&(i=z(i),u=qe(u,a),a=Pe(s,a,e,i));let t=c=0;for(;c<i.length;c++){const e=n(i[c]);null!=e&&(i[t++]=e)}t<c&&(i.length=t),u=-4097&(20|(u=Le(u,a))),Z(i,u&=-8193),2&u&&Object.freeze(i)}let l;return 1===r||4===r&&32&u?ke(u)||(t=u,(u|=2)!==t&&Z(i,u),Object.freeze(i)):(n=5===r&&(!!(32&u)||ke(u)||!!Yt?.get(i)),(2===r||n)&&ke(u)&&(i=z(i),u=Je(u=qe(u,a),a,o),Z(i,u),a=Pe(s,a,e,i)),ke(u)||(e=u,(u=Je(u,a,o))!==e&&Z(i,u)),n?(l=Xt(i),ue(i,t,!0)):2!==r||o||Yt?.delete(i)),l||i}function Oe(t,e,n,r){return t=Te(t,e,n,r),Array.isArray(t)?t:nt}function Le(t,e){return 0===t&&(t=qe(t,e)),1|t}function ke(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function Fe(t,e){t=t.l;let n=Q(t);lt(n),Pe(t,n,2,""===e?void 0:e)}function Ve(t,e){var n=Ai;return Ce(je(t=t.l),t,Q(t),n)===e?e:-1}function je(t){if($)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 Me(t,e,n,r){const i=je(t),o=Ce(i,t,e,n);return o!==r&&(o&&(e=Pe(t,e,o)),i.set(n,r)),e}function Ce(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 o=r[t];null!=Te(e,n,o)&&(0!==i&&(n=Pe(e,n,i)),i=o)}return t.set(r,i),i}function Ge(t,e,n,r){let i,o=Q(t);if(null!=(r=Te(t,o,n,r))&&r.C===rt)return(e=Se(r))!==r&&Pe(t,o,n,e),e.l;if(Array.isArray(r)){const t=Y(r);i=2&t?de(_e(r,t,!1),e,!0):64&t?r:de(i,e,!0)}else i=de(void 0,e,!0);return i!==r&&Pe(t,o,n,i),i}function De(t,e,n,r){t=t.l;let i=Q(t);return(e=Kt(r=Te(t,i,n,r),e,i))!==r&&null!=e&&Pe(t,i,n,e),e}function ze(t,e,n){if(null==(e=De(t,e,n,!1)))return e;t=t.l;let r=Q(t);if(!(2&r)){const i=Se(e);i!==e&&Pe(t,r,n,e=i)}return e}function $e(t,e,n,r,i,o){var s=t.l,a=!!(2&e);r=a?1:r,i=!!i,o&&=!a,a=Oe(s,e,1);var u=Y(a),c=a;if(ce(c,t),2!==r&&1!==r||fe(c,t),!(c=!!(4&u))){var l=a,h=e;const t=!!(2&(u=Le(u,e)));t&&(h|=2);let r=!t,i=!0,o=0,s=0;for(;o<l.length;o++){const e=Kt(l[o],n,h);if(e instanceof n){if(!t){const t=!!(2&Y(e.l));r&&=!t,i&&=t}l[s++]=e}}s<o&&(l.length=s),u|=4,u=i?16|u:-17&u,Z(l,u=r?8|u:-9&u),t&&Object.freeze(l)}if(o&&!(8&u||!a.length&&(1===r||4===r&&32&u))){for(ke(u)?(a=z(a),u=qe(u,e),e=Pe(s,e,1,a)):fe(a,t),n=a,o=u,l=0;l<n.length;l++)(u=n[l])!==(h=Se(u))&&(n[l]=h);o|=8,o=n.length?-17&o:16|o,Z(n,o),u=o}let f;return 1===r||4===r&&32&u?ke(u)||(t=u,(u|=!a.length||16&u&&(!c||32&u)?2:2048)!==t&&Z(a,u),Object.freeze(a)):(c=5===r&&(!!(32&u)||ke(u)||!!Yt?.get(a)),(2===r||c)&&ke(u)&&(a=z(a),u=Je(u=qe(u,e),e,i),Z(a,u),e=Pe(s,e,1,a)),ke(u)||(s=u,(u=Je(u,e,i))!==s&&Z(a,u)),c?(f=Xt(a),ue(a,t,!0)):2!==r||i||Yt?.delete(a)),f||a}function Re(t,e){const n=Q(t.l);return $e(t,n,e,void 0===dt?2:5,!1,!(2&n))}function We(t,e,n,r){return null==r&&(r=void 0),xe(t,n,r)}function He(t,e,n){var r=Ui;null==n&&(n=void 0);t:{t=t.l;let i=Q(t);if(lt(i),null==n){const n=je(t);if(Ce(n,t,i,r)!==e)break t;n.set(r,0)}else i=Me(t,i,r,e);Pe(t,i,e,n)}}function qe(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Je(t,e,n){return 32&e&&n||(t&=-33),t}function Ke(t,e){var n=ci;const r=Q(t.l);lt(r),t=$e(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&Y(e.l)?X(t,8):X(t,16)}function Xe(t,e){return t??e}function Ye(t,e,n){{const a=t.l;let u=Q(a);if(lt(u),null==n)Pe(a,u,e);else{n=Qt?.get(n)||n;var r,i=Y(n),o=i,s=!!(2&i)||Object.isFrozen(n);if((r=!s)&&((r=void 0===pt)||(r=!!f&&void 0!==gt)),Ae(t,i)){i=21,s&&(n=z(n),o=0,i=Je(i=qe(i,u),u,!0));for(let t=0;t<n.length;t++)n[t]=Ht(n[t])}r?(n=z(n),o=0,i=Je(i=qe(i,u),u,!0)):s||ue(n,t),i!==o&&Z(n,i),Pe(a,u,e,n)}}}function Qe(t,e,n){lt(Q(t.l)),Ne(t,e,Jt,2,void 0,!0).push(Ht(n))}function Ze(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function tn(){return Error("Failed to read varint, encoding is invalid.")}function en(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function nn(t){if("string"==typeof t)return{buffer:U(t),A:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),A:!1};if(t.constructor===Uint8Array)return{buffer:t,A:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),A:!1};if(t.constructor===V)return{buffer:F(t)||new Uint8Array(0),A:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),A:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}function rn(t,e){let n,r=0,i=0,o=0;const s=t.i;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(o<32&&128&n);for(o>32&&(i|=(127&n)>>4),o=3;o<32&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(ln(t,a),n<128)return e(r>>>0,i>>>0);throw tn()}function on(t){let e=0,n=t.g;const r=n+10,i=t.i;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return ln(t,n),!!(127&e)}throw tn()}function sn(t){const e=t.i;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 tn();return ln(t,n),i}function an(t){var e=t.i;const n=t.g;var r=e[n],i=e[n+1];const o=e[n+2];return e=e[n+3],ln(t,t.g+4),t=2*((i=(r<<0|i<<8|o<<16|e<<24)>>>0)>>31)+1,r=i>>>23&255,i&=8388607,255==r?i?NaN:t*(1/0):0==r?1401298464324817e-60*t*i:t*Math.pow(2,r-150)*(i+8388608)}function un(t){return sn(t)}function cn(t,e,{D:n=!1}={}){t.D=n,e&&(e=nn(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}function ln(t,e){if(t.g=e,e>t.j)throw en(t.j,e)}function hn(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.j)throw en(e,t.j-n);return t.g=r,n}function fn(t,e){if(0==e)return k();var n=hn(t,e);return t.D&&t.m?n=t.i.subarray(n,n+e):(t=t.i,n=n===(e=n+e)?new Uint8Array(0):At?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?k():new V(n,N)}var dn=[];function gn(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=sn(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Ze(n,t.j);if(e<1)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.m=e,t.i=n,!0}function pn(t){switch(t.i){case 0:0!=t.i?pn(t):on(t.g);break;case 1:ln(t=t.g,t.g+8);break;case 2:if(2!=t.i)pn(t);else{var e=sn(t.g)>>>0;ln(t=t.g,t.g+e)}break;case 5:ln(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.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}pn(t)}break;default:throw Ze(t.i,t.j)}}function mn(t,e,n){const r=t.g.j,i=sn(t.g)>>>0,o=t.g.g+i;let s=o-r;if(s<=0&&(t.g.j=o,n(e,t,void 0,void 0,void 0),s=o-t.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);t.g.g=o,t.g.j=r}function yn(t){var e=sn(t.g)>>>0,a=hn(t=t.g,e);if(t=t.i,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),e=a+e,c=0===a&&e===c.length?c:c.subarray(a,e);try{var l=u.decode(c)}catch(t){if(void 0===i){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(l=a)+e,a=[];let i,o=null;for(;l<e;){var h=t[l++];h<128?a.push(h):h<224?l>=e?n():(i=t[l++],h<194||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):h<240?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&i<160||237===h&&i>=160||128!=(192&(u=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&u)):h<=244?l>=e-2?n():(i=t[l++],128!=(192&i)||i-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),a.length>=8192&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function bn(t){const e=sn(t.g)>>>0;return fn(t.g,e)}function vn(t,e,n){var r=sn(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var wn=[];let _n;function Sn(t,e,n){e.g?e.j(t,e.g,e.i,n,!0):e.j(t,e.i,n,!0)}var An=class{constructor(t,e){this.l=ge(t,e)}toJSON(){return En(this)}A(){return!!(2&Y(this.l))}};function En(t){he(t),t=_n?t.l:me(t.l,ye,void 0,void 0,!1);{var e=!_n;let c=t.length;if(c){var n=t[c-1],r=st(n);r?c--:n=void 0;var i=t;if(r){t:{var o,s=n,a=!1;if(s)for(let t in s)isNaN(+t)?(o??={})[t]=s[t]:(r=s[t],Array.isArray(r)&&(ut(r)||ot(r)&&0===r.size)&&(r=null),null==r&&(a=!0),null!=r&&((o??={})[t]=r));if(a||(o=s),o)for(let t in o){a=o;break t}a=null}s=null==a?null!=n:a!==n}for(;c>0&&(null==(o=i[c-1])||ut(o)||ot(o)&&0===o.size);c--)var u=!0;(i!==t||s||u)&&(e?(u||s||a)&&(i.length=c):i=Array.prototype.slice.call(i,0,c),a&&i.push(a)),u=i}else u=t}return u}function In(t){return t?/^\d+$/.test(t)?(kt(t),new Tn(It,Tt)):null:xn||=new Tn(0,0)}An.prototype.C=rt,An.prototype.toString=function(){try{return _n=!0,En(this).toString()}finally{_n=!1}};var Tn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let xn;function Pn(t){return t?/^-?\d+$/.test(t)?(kt(t),new Un(It,Tt)):null:Bn||=new Un(0,0)}var Un=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let Bn;function Nn(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 On(t,e){for(;e>127;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Ln(t,e){if(e>=0)On(t,e);else{for(let n=0;n<9;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function kn(t){var e=It;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 Fn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function Vn(t,e,n){On(t.g,8*e+n)}function jn(t,e){return Vn(t,e,2),e=t.g.end(),Fn(t,e),e.push(t.i),e}function Mn(t,e){var n=e.pop();for(n=t.i+t.g.length()-n;n>127;)e.push(127&n|128),n>>>=7,t.i++;e.push(n),t.i++}function Cn(t,e,n){Vn(t,e,2),On(t.g,n.length),Fn(t,t.g.end()),Fn(t,n)}function Gn(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Dn=Gn(),zn=Gn(),$n=Gn(),Rn=Gn(),Wn=Gn(),Hn=Gn(),qn=Gn(),Jn=Gn(),Kn=class{constructor(t,e,n){this.g=t,this.i=e,t=Dn,this.j=!!t&&n===t||!1}};function Xn(t,e){return new Kn(t,e,Dn)}function Yn(t,e,n,r,i){null!=(e=ur(e,r))&&(n=jn(t,n),i(e,t),Mn(t,n))}const Qn=Xn((function(t,e,n,r,i){return 2===t.i&&(mn(t,Ge(e,r,n),i),!0)}),Yn),Zn=Xn((function(t,e,n,r,i){return 2===t.i&&(mn(t,Ge(e,r,n,!0),i),!0)}),Yn);var tr=Symbol(),er=Symbol(),nr=Symbol(),rr=Symbol();let ir,or;function sr(t,e,n,r){var i=r[t];if(i)return i;(i={}).B=function(t){switch(typeof t){case"boolean":return ie||=[0,void 0,!0];case"number":return t>0?void 0:0===t?oe||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(r[0]);var o=r[1];let s=1;o&&o.constructor===Object&&(i.G=o,"function"==typeof(o=r[++s])&&(i.H=!0,ir??=o,or??=r[s+1],o=r[s+=2]));const a={};for(;o&&Array.isArray(o)&&o.length&&"number"==typeof o[0]&&o[0]>0;){for(var u=0;u<o.length;u++)a[o[u]]=o;o=r[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=r[++s]);var c=void 0;if(o instanceof Kn?t=o:(t=Qn,s--),t?.j){o=r[++s],c=r;var l=s;"function"==typeof o&&(o=o(),c[l]=o),c=o}for(l=u+1,"number"==typeof(o=r[++s])&&o<0&&(l-=o,o=r[++s]);u<l;u++){const r=a[u];c?n(i,u,t,c,r):e(i,u,t,r)}}return r[t]=i}function ar(t){return Array.isArray(t)?t[0]instanceof Kn?t:[Zn,t]:[t,void 0]}function ur(t,e){return t instanceof An?(he(t),t.l):Array.isArray(t)?de(t,e,!1):void 0}function cr(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function lr(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=sr(er,cr,lr,r).B,s||=hr(r),i)}function hr(t){let e=t[nr];if(null!=e)return e;const n=sr(er,cr,lr,t);return e=n.H?(t,e)=>ir(t,e,n):(t,e)=>{const r=Q(t);for(;gn(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=fr(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,pn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=fn(o.g,s)),i=t,o&&(ht||=Symbol(),(s=i[ht])?s.push(o):i[ht]=[o]))}return 16384&r&&K(t,34),!0},t[nr]=e}function fr(t){const e=(t=ar(t))[0].g;if(t=t[1]){const n=hr(t),r=sr(er,cr,lr,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function dr(t,e,n){t[e]=n.i}function gr(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=sr(tr,dr,gr,r).B,i||=pr(r))}function pr(t){let e=t[rr];if(!e){const n=sr(tr,dr,gr,t);e=(t,e)=>mr(t,e,n),t[rr]=e}return e}function mr(t,e,n){for(var r=Y(t),i=+!!(512&r)-1,o=t.length,s=512&r?1:0,a=o+(256&r?-1:0);s<a;s++){const r=t[s];if(null==r)continue;const o=s-i,a=yr(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(const t in r)i=+t,Number.isNaN(i)||null!=(o=r[i])&&(a=yr(n,i))&&a(e,o,i)}if(t=ht?t[ht]:void 0)for(Fn(e,e.g.end()),n=0;n<t.length;n++)Fn(e,F(t[n])||new Uint8Array(0))}function yr(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=ar(n))[0].i;if(n=n[1]){const e=pr(n),i=sr(tr,dr,gr,n).B;n=t.H?or(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function br(t,e){if(Array.isArray(e)){var n=Y(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),Z(e,-12289&(5|n)),2&n&&Object.freeze(e),e}}function vr(t,e,n){return new Kn(t,e,n)}function wr(t,e,n){return new Kn(t,e,n)}function _r(t,e,n){Pe(t,Q(t),e,n)}function Sr(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(Ct(t)){if("string"===e)return $t(t);if("number"===e)return zt(t)}}(e),null!=e){if("string"==typeof e)Pn(e);if(null!=e)switch(Vn(t,n,0),typeof e){case"number":t=t.g,Pt(e),Nn(t,It,Tt);break;case"bigint":n=BigInt.asUintN(64,e),n=new Un(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Nn(t.g,n.i,n.g);break;default:n=Pn(e),Nn(t.g,n.i,n.g)}}}function Ar(t,e,n){null!=(e=Gt(e))&&null!=e&&(Vn(t,n,0),Ln(t.g,e))}function Er(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Vn(t,n,0),t.g.g.push(e?1:0))}function Ir(t,e,n){null!=(e=Jt(e))&&Cn(t,n,c(e))}function Tr(t,e,n,r,i){null!=(e=ur(e,r))&&(n=jn(t,n),i(e,t),Mn(t,n))}function xr(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof V?e:void 0)&&Cn(t,n,nn(e).buffer)}var Pr=vr((function(t,e,n){return 5===t.i&&(_r(e,n,an(t.g)),!0)}),(function(t,e,n){null!=(e=Vt(e))&&(Vn(t,n,5),t=t.g,Ut(e),kn(t))}),Hn),Ur=wr((function(t,e,n){return(5===t.i||2===t.i)&&(e=Ue(e,Q(e),n,2,!1),2==t.i?vn(t,an,e):e.push(an(t.g)),!0)}),(function(t,e,n){if(null!=(e=br(Vt,e))&&e.length){Vn(t,n,2),On(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Ut(e[r]),kn(n)}}),Hn),Br=vr((function(t,e,n){return 0===t.i&&(_r(e,n,rn(t.g,Nt)),!0)}),Sr,Wn),Nr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,0===(t=rn(t.g,Nt))?void 0:t),!0)}),Sr,Wn),Or=vr((function(t,e,n){return 0===t.i&&(_r(e,n,rn(t.g,Bt)),!0)}),(function(t,e,n){if(null!=(e=Wt(e))){if("string"==typeof e)In(e);if(null!=e)switch(Vn(t,n,0),typeof e){case"number":t=t.g,Pt(e),Nn(t,It,Tt);break;case"bigint":n=BigInt.asUintN(64,e),n=new Tn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),Nn(t.g,n.i,n.g);break;default:n=In(e),Nn(t.g,n.i,n.g)}}}),Gn()),Lr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,sn(t.g)),!0)}),Ar,Rn),kr=wr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ue(e,Q(e),n,2,!1),2==t.i?vn(t,sn,e):e.push(sn(t.g)),!0)}),(function(t,e,n){if(null!=(e=br(Gt,e))&&e.length){n=jn(t,n);for(let n=0;n<e.length;n++)Ln(t.g,e[n]);Mn(t,n)}}),Rn),Fr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,0===(t=sn(t.g))?void 0:t),!0)}),Ar,Rn),Vr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,on(t.g)),!0)}),Er,zn),jr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,!1===(t=on(t.g))?void 0:t),!0)}),Er,zn),Mr=wr((function(t,e,n){if(2!==t.i)return!1;t=yn(t);const r=Q(e);return lt(r),Ue(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=br(Jt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Cn(r,i,c(o))}}),$n),Cr=vr((function(t,e,n){return 2===t.i&&(_r(e,n,""===(t=yn(t))?void 0:t),!0)}),Ir,$n),Gr=vr((function(t,e,n){return 2===t.i&&(_r(e,n,yn(t)),!0)}),Ir,$n),Dr=function(t,e,n=Dn){return new Kn(t,e,n)}((function(t,e,n,r,i){if(2!==t.i)return!1;r=de(void 0,r,!0);let o=Q(e);lt(o);let s=Ue(e,o,n,3);return o=Q(e),4&Y(s)&&(s=z(s),Z(s,-2079&(1|Y(s))),Pe(e,o,n,s)),s.push(r),mn(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)Tr(t,e[o],n,r,i)})),zr=Xn((function(t,e,n,r,i,o){return 2===t.i&&(Me(e,Y(e),o,n),mn(t,e=Ge(e,r,n),i),!0)}),Tr),$r=vr((function(t,e,n){return 2===t.i&&(_r(e,n,bn(t)),!0)}),xr,qn),Rr=vr((function(t,e,n){return 0===t.i&&(_r(e,n,sn(t.g)),!0)}),(function(t,e,n){null!=(e=Gt(e))&&(e=parseInt(e,10),Vn(t,n,0),Ln(t.g,e))}),Jn);class Wr{constructor(t,e){this.i=t,this.g=e,this.j=We,this.defaultValue=void 0}}function Hr(t,e){return(n,r)=>{if(wn.length){const t=wn.pop();t.o(r),cn(t.g,n,r),n=t}else n=new class{constructor(t,e){if(dn.length){const n=dn.pop();cn(n,t,e),t=n}else t=new class{constructor(t,e){this.i=null,this.m=!1,this.g=this.j=this.v=0,cn(this,t,e)}clear(){this.i=null,this.m=!1,this.g=this.j=this.v=0,this.D=!1}}(t,e);this.g=t,this.j=this.g.g,this.i=this.m=-1,this.o(e)}o({F:t=!1}={}){this.F=t}}(n,r);try{const r=new t,o=r.l;hr(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,wn.length<100&&wn.push(n)}return i}}var qr=[0,Cr,vr((function(t,e,n){return 2===t.i&&(_r(e,n,(t=bn(t))===k()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof An){const r=e.N;return void(r&&(e=r(e),null!=e&&Cn(t,n,nn(e).buffer)))}if(Array.isArray(e))return}xr(t,e,n)}),qn)];let Jr,Kr=globalThis.trustedTypes;function Xr(t){void 0===Jr&&(Jr=function(){let t=null;if(!Kr)return t;try{const e=t=>t;t=Kr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Jr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function Yr(t,...e){if(0===e.length)return Xr(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Xr(n)}var Qr=[0,Lr,Rr,Vr,-1,kr,Rr,-1],Zr=class extends An{constructor(){super()}},ti=[0,Vr,Gr,Vr,Rr,-1,wr((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ue(e,Q(e),n,2,!1),2==t.i?vn(t,un,e):e.push(sn(t.g)),!0)}),(function(t,e,n){if(null!=(e=br(Gt,e))&&e.length){n=jn(t,n);for(let n=0;n<e.length;n++)Ln(t.g,e[n]);Mn(t,n)}}),Jn),Gr,-1,[0,Vr,-1],Rr,Vr,-1],ei=[0,Gr,-2],ni=class extends An{constructor(){super()}},ri=[0],ii=[0,Lr,Vr,1,Vr,-3],oi=class extends An{constructor(t){super(t,2)}},si={};si[336783863]=[0,Gr,Vr,-1,Lr,[0,[1,2,3,4,5,6,7],zr,ri,zr,ti,zr,ei,zr,ii,zr,Qr,zr,[0,Gr,-2],zr,[0,Gr,Rr]],[0,Gr],Vr,[0,[1,3],[2,4],zr,[0,kr],-1,zr,[0,Mr],-1,Dr,[0,Gr,-1]],Gr];var ai=[0,Nr,-1,jr,-3,Nr,kr,Cr,Fr,Nr,-1,jr,Fr,jr,-2,Cr];function ui(t){Qe(t,3,"TEXT:text_in")}var ci=class extends An{constructor(t){super(t,500)}o(t){return We(this,0,7,t)}},li=[-1,{}],hi=[0,Gr,1,li],fi=[0,Gr,Mr,li];function di(t){Qe(t,10,"text_in")}var gi,pi=class extends An{constructor(){super(void 0,500)}o(t){return We(this,0,1001,t)}};pi.prototype.g=(gi=[-500,Dr,[-500,Cr,-1,Mr,-3,[-2,si,Vr],Dr,qr,Fr,-1,hi,fi,Dr,[0,Cr,jr],Cr,ai,Fr,Mr,987,Mr],4,Dr,[-500,Gr,-1,[-1,{}],998,Gr],Dr,[-500,Gr,Mr,-1,[-2,{},Vr],997,Mr,-1],Fr,Dr,[-500,Gr,Mr,li,998,Mr],Mr,Fr,hi,fi,Dr,[0,Cr,-1,li],Mr,-2,ai,Cr,-1,jr,979,li,Dr,qr],function(){he(this);const t=new class{constructor(){this.j=[],this.i=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};mr(this.l,t,sr(tr,dr,gr,gi)),Fn(t,t.g.end());const e=new Uint8Array(t.i),n=t.j,r=n.length;let i=0;for(let t=0;t<r;t++){const r=n[t];e.set(r,i),i+=r.length}return t.j=[e],e});var mi=class extends An{constructor(t){super(t)}},yi=class extends An{constructor(t){super(t)}g(){return Re(this,mi)}},bi=class extends An{constructor(t){super(t)}},vi=Hr(class extends An{constructor(t){super(t)}},[0,Dr,[0,1,Lr,Gr,[0,Dr,[0,Lr,Pr,Gr,-1]]],Br]),wi=class extends An{constructor(t){super(t)}},_i=class extends An{constructor(t){super(t)}I(){const t=Be(this);return null==t?k():t}},Si=class extends An{constructor(t){super(t)}},Ai=[1,2],Ei=Hr(class extends An{constructor(t){super(t)}},[0,Dr,[0,Ai,zr,[0,Ur],zr,[0,$r],Lr,Gr],Br]),Ii=class extends An{constructor(t){super(t)}},Ti=class extends An{constructor(t){super(t)}},xi=[0,Vr,-1],Pi=class extends An{constructor(t){super(t)}},Ui=[1,2,3,4,5],Bi=class extends An{constructor(t){super(t)}g(){return null!=Be(this)}i(){return null!=Jt(Ee(this,2))}},Ni=class extends An{constructor(t){super(t)}},Oi=[0,[0,$r,Gr,[0,Lr,Br,-1],[0,Or,Br]],Vr,[0,Ui,zr,ii,zr,ti,zr,Qr,zr,ri,zr,ei],Rr],Li=class extends An{constructor(t){super(t)}},ki=new Wr(462704549,Li);si[462704549]=[0,Oi,[0,Gr,Lr,Pr,Mr,-1]];var Fi=class extends An{constructor(t){super(t)}},Vi=new Wr(477589892,Fi);function ji(t,e){if(e=e?ve(e):new Ii,void 0!==t.displayNamesLocale?xe(e,1,qt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&xe(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw G();if(!Number.isFinite(n))throw G();n|=0}xe(e,2,n)}else"maxResults"in t&&xe(e,2);if(void 0!==t.scoreThreshold){if(null!=(n=t.scoreThreshold)&&"number"!=typeof n)throw Error(`Value of float/double field must be a number, found ${typeof n}: ${n}`);xe(e,3,n)}else"scoreThreshold"in t&&xe(e,3);return void 0!==t.categoryAllowlist?Ye(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&xe(e,4),void 0!==t.categoryDenylist?Ye(e,5,t.categoryDenylist):"categoryDenylist"in t&&xe(e,5),e}function Mi(t){const e={classifications:Re(t,bi).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=Xe(Gt(Ee(t,1)),0)??-1;const n=t.l;let r=Q(n);const i=Te(n,r,2),o=Vt(i);return null!=o&&o!==i&&Pe(n,r,2,o),{index:e,score:o??0??0,categoryName:Xe(Jt(Ee(t,3)),"")??"",displayName:Xe(Jt(Ee(t,4)),"")??""}})),headIndex:e,headName:n}}(ze(t,yi,4)?.g()??[],Xe(Gt(Ee(t,2)),0),Xe(Jt(Ee(t,3)),""))))};return null!=Rt(Ee(t,2))&&(e.timestampMs=Xe(Rt(Ee(t,2)),0)),e}function Ci(t){return Array.from(t,(t=>t>127?t-256:t))}function Gi(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 o=0;o<t.length;o++)n+=t[o]*e[o],r+=t[o]*t[o],i+=e[o]*e[o];if(r<=0||i<=0)throw Error("Cannot compute cosine similarity on embedding with 0 norm.");return n/Math.sqrt(r*i)}let Di;si[477589892]=[0,Oi,xi];const zi=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 $i(){if(void 0===Di)try{await WebAssembly.instantiate(zi),Di=!0}catch{Di=!1}return Di}async function Ri(t,e=Yr``){const n=await $i()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Wi=class{};function Hi(){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 qi(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())}Wi.forVisionTasks=function(t){return Ri("vision",t)},Wi.forTextTasks=function(t){return Ri("text",t)},Wi.forGenAiExperimentalTasks=function(t){return Ri("genai_experimental",t)},Wi.forGenAiTasks=function(t){return Ri("genai",t)},Wi.forAudioTasks=function(t){return Ri("audio",t)},Wi.isSimdSupported=function(){return $i()};function Ji(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.h.stringToNewUTF8(e)),t.h._free(e)}function Ki(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.h.stringToNewUTF8(e[n]);e=t.h._malloc(4*r.length),t.h.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.h._free(e);t.h._free(e)}function Xi(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function Yi(t,e,n){let r=[];t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const Qi=function(t){return class extends t{M(){this.h._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.h=t,this.g=null,this.i=0,this.m="function"==typeof this.h._addIntToInputStream,void 0!==e?this.h.canvas=e:Hi()?this.h.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.h.canvas=document.createElement("canvas"))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.h._malloc(n);this.h.HEAPU8.set(t,r),e?this.h._changeBinaryGraph(n,r):this.h._changeTextGraph(n,r),this.h._free(r)}configureAudio(t,e,n,r,i){this.h._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Ji(this,r||"input_audio",(r=>{Ji(this,i=i||"audio_header",(i=>{this.h._configureAudio(r,i,t,e??0,n)}))}))}setAutoResizeCanvas(t){this.j=t}setAutoRenderToScreen(t){this.h._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.h.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.h.errorListener=t}attachEmptyPacketListener(t,e){this.h.emptyPacketListeners=this.h.emptyPacketListeners||{},this.h.emptyPacketListeners[t]=e}addAudioToStream(t,e,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const o=4*t.length;this.i!==o&&(this.g&&this.h._free(this.g),this.g=this.h._malloc(o),this.i=o),this.h.HEAPF32.set(t,this.g/4),Ji(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Ji(this,e,(e=>{if(!this.h.canvas)throw Error("No OpenGL canvas configured.");e?this.h._bindTextureToStream(e):this.h._bindTextureToCanvas();const r=this.h.canvas.getContext("webgl2")||this.h.canvas.getContext("webgl");if(!r)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.h.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const[i,o]=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];!this.j||i===this.h.canvas.width&&o===this.h.canvas.height||(this.h.canvas.width=i,this.h.canvas.height=o);const[s,a]=[i,o];this.h._addBoundTextureToStream(e,s,a,n)}))}addBoolToStream(t,e,n){Ji(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Ji(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Ji(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Ji(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Ji(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Ji(this,e,(e=>{Ji(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Ji(this,e,(e=>{Ki(this,Object.keys(t),(r=>{Ki(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Ji(this,n,(n=>{Ji(this,e,(e=>{const i=this.h._malloc(t.length);this.h.HEAPU8.set(t,i),this.h._addProtoToInputStream(i,t.length,e,n,r),this.h._free(i)}))}))}addEmptyPacketToStream(t,e){Ji(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(r,e);this.h._addBoolVectorToInputStream(r,e,n)}))}addDoubleVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(r,e);this.h._addDoubleVectorToInputStream(r,e,n)}))}addFloatVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(r,e);this.h._addFloatVectorToInputStream(r,e,n)}))}addIntVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(r,e);this.h._addIntVectorToInputStream(r,e,n)}))}addUintVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(r,e);this.h._addUintVectorToInputStream(r,e,n)}))}addStringVectorToStream(t,e,n){Ji(this,e,(e=>{const r=this.h._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Ji(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Ji(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Ji(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Ji(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Ji(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Ji(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Ji(this,e,(e=>{Ji(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Ji(this,n,(n=>{Ji(this,e,(e=>{const r=this.h._malloc(t.length);this.h.HEAPU8.set(t,r),this.h._addProtoToInputSidePacket(r,t.length,e,n),this.h._free(r)}))}))}addBoolVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateBoolVector(t.length);if(!n)throw Error("Unable to allocate new bool vector on heap.");for(const e of t)this.h._addBoolVectorEntry(n,e);this.h._addBoolVectorToInputSidePacket(n,e)}))}addDoubleVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateDoubleVector(t.length);if(!n)throw Error("Unable to allocate new double vector on heap.");for(const e of t)this.h._addDoubleVectorEntry(n,e);this.h._addDoubleVectorToInputSidePacket(n,e)}))}addFloatVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateFloatVector(t.length);if(!n)throw Error("Unable to allocate new float vector on heap.");for(const e of t)this.h._addFloatVectorEntry(n,e);this.h._addFloatVectorToInputSidePacket(n,e)}))}addIntVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateIntVector(t.length);if(!n)throw Error("Unable to allocate new int vector on heap.");for(const e of t)this.h._addIntVectorEntry(n,e);this.h._addIntVectorToInputSidePacket(n,e)}))}addUintVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateUintVector(t.length);if(!n)throw Error("Unable to allocate new unsigned int vector on heap.");for(const e of t)this.h._addUintVectorEntry(n,e);this.h._addUintVectorToInputSidePacket(n,e)}))}addStringVectorToInputSidePacket(t,e){Ji(this,e,(e=>{const n=this.h._allocateStringVector(t.length);if(!n)throw Error("Unable to allocate new string vector on heap.");for(const e of t)Ji(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Xi(this,t,e),Ji(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Yi(this,t,e),Ji(this,t,(t=>{this.h._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.h._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Xi(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Ji(this,t,(t=>{this.h._attachAudioListener(t,n||!1)}))}finishProcessing(){this.h._waitUntilIdle()}closeGraph(){this.h._closeGraph(),this.h.simpleListeners=void 0,this.h.emptyPacketListeners=void 0}});var Zi=class extends Qi{};async function to(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await qi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await qi(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),await t.o(n),t}async function eo(t,e,n){return to(t,e,n)}function no(t,e){const n=ze(t.baseOptions,Bi,1)||new Bi;"string"==typeof e?(xe(n,2,qt(e)),xe(n,1)):e instanceof Uint8Array&&(xe(n,1,at(e,!1,!1)),xe(n,2)),We(t.baseOptions,0,1,n)}function ro(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(ze(t.baseOptions,Bi,1)?.g()||ze(t.baseOptions,Bi,1)?.i()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");if(function(t,e){let n=ze(t.baseOptions,Pi,3);if(!n){var r=n=new Pi;He(r,4,new ni)}"delegate"in e&&("GPU"===e.delegate?He(e=n,2,r=new Zr):He(e=n,4,r=new ni)),We(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath)return fetch(n.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${t.status})`)})).then((e=>{try{t.g.h.FS_unlink("/model.dat")}catch{}t.g.h.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),no(t,"/model.dat"),t.v()}));if(n.modelAssetBuffer instanceof Uint8Array)no(t,n.modelAssetBuffer);else if(n.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;return t}(n.modelAssetBuffer).then((e=>{no(t,e),t.v()}));return t.v(),Promise.resolve()}function io(t){try{const e=t.m.length;if(1===e)throw Error(t.m[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.m.map((t=>t.message)).join(", "))}finally{t.m=[]}}function oo(t,e){t.j=Math.max(t.j,e)}var so=class{constructor(t){this.g=t,this.m=[],this.j=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.m.push(Error(e))})),this.g.M(),this.g.setGraph(t,e),io(this)}finishProcessing(){this.g.finishProcessing(),io(this)}close(){this.g.closeGraph()}};so.prototype.close=so.prototype.close,function(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}("TaskRunner",so);var ao=class extends so{constructor(t,e){super(new Zi(t,e)),this.u={languages:[]},We(t=this.i=new Li,0,1,e=new Ni)}o(t){return We(this.i,0,2,ji(t,ze(this.i,Ii,2))),ro(this,t)}get baseOptions(){return ze(this.i,Ni,1)}set baseOptions(t){We(this.i,0,1,t)}K(t){return this.u={languages:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new pi;di(t),Qe(t,15,"classifications_out");const e=new oi;Sn(e,ki,this.i);const n=new ci;Fe(n,qt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),ui(n),Qe(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ke(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Mi(vi(t))),1!==t.length)throw Error(`Expected 1 classification head, got ${t.length}`);this.u.languages=t[0].categories.map((t=>({languageCode:t.categoryName,probability:t.score}))),oo(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{oo(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};ao.prototype.detect=ao.prototype.K,ao.prototype.setOptions=ao.prototype.o,ao.createFromModelPath=function(t,e){return eo(ao,t,{baseOptions:{modelAssetPath:e}})},ao.createFromModelBuffer=function(t,e){return eo(ao,t,{baseOptions:{modelAssetBuffer:e}})},ao.createFromOptions=function(t,e){return eo(ao,t,e)};var uo=class extends so{constructor(t,e){super(new Zi(t,e)),this.u={classifications:[]},We(t=this.i=new Li,0,1,e=new Ni)}o(t){return We(this.i,0,2,ji(t,ze(this.i,Ii,2))),ro(this,t)}get baseOptions(){return ze(this.i,Ni,1)}set baseOptions(t){We(this.i,0,1,t)}J(t){return this.u={classifications:[]},this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new pi;di(t),Qe(t,15,"classifications_out");const e=new oi;Sn(e,ki,this.i);const n=new ci;Fe(n,qt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),ui(n),Qe(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),Ke(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Mi(vi(t)),oo(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{oo(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};uo.prototype.classify=uo.prototype.J,uo.prototype.setOptions=uo.prototype.o,uo.createFromModelPath=function(t,e){return eo(uo,t,{baseOptions:{modelAssetPath:e}})},uo.createFromModelBuffer=function(t,e){return eo(uo,t,{baseOptions:{modelAssetBuffer:e}})},uo.createFromOptions=function(t,e){return eo(uo,t,e)};var co=class extends so{constructor(t,e){super(new Zi(t,e)),this.u={embeddings:[]},We(t=this.i=new Fi,0,1,e=new Ni)}o(t){var e=this.i,n=ze(this.i,Ti,2);return n=n?ve(n):new Ti,void 0!==t.l2Normalize?xe(n,1,jt(t.l2Normalize)):"l2Normalize"in t&&xe(n,1),void 0!==t.quantize?xe(n,2,jt(t.quantize)):"quantize"in t&&xe(n,2),We(e,0,2,n),ro(this,t)}get baseOptions(){return ze(this.i,Ni,1)}set baseOptions(t){We(this.i,0,1,t)}L(t){return this.g.addStringToStream(t,"text_in",this.j+1),this.finishProcessing(),this.u}v(){var t=new pi;di(t),Qe(t,15,"embeddings_out");const e=new oi;Sn(e,Vi,this.i);const n=new ci;Fe(n,qt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),ui(n),Qe(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),Ke(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Ei(t),this.u=function(t){return{embeddings:Re(t,Si).map((t=>{const e={headIndex:Xe(Gt(Ee(t,3)),0)??-1,headName:Xe(Jt(Ee(t,4)),"")??""};if(void 0!==De(t,wi,Ve(t,1)))e.floatEmbedding=Ne(ze(t,wi,Ve(t,1)),1,Vt,void 0===dt?2:5).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=ze(t,_i,Ve(t,2))?.I()?.i()??n}return e})),timestampMs:Xe(Rt(Ee(t,2)),0)}}(t),oo(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{oo(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};co.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Gi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Gi(Ci(t.quantizedEmbedding),Ci(e.quantizedEmbedding))}return t},co.prototype.embed=co.prototype.L,co.prototype.setOptions=co.prototype.o,co.createFromModelPath=function(t,e){return eo(co,t,{baseOptions:{modelAssetPath:e}})},co.createFromModelBuffer=function(t,e){return eo(co,t,{baseOptions:{modelAssetBuffer:e}})},co.createFromOptions=function(t,e){return eo(co,t,e)},exports.FilesetResolver=Wi,exports.LanguageDetector=ao,exports.TextClassifier=uo,exports.TextEmbedder=co;
|
|
2
2
|
//# sourceMappingURL=text_bundle_cjs.js.map
|