@mediapipe/tasks-text 0.10.21-rc.20250121 → 0.10.21-rc.20250123
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/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/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(){throw Error("Invalid UTF8")}function n(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let r,i;const o="undefined"!=typeof TextDecoder;let s;const a="undefined"!=typeof TextEncoder;function u(t){if(a)t=(s||=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 c,l;t:{for(var h=["CLOSURE_FLAGS"],f=t,d=0;d<h.length;d++)if(null==(f=f[h[d]])){l=null;break t}l=f}var g,p=l&&l[610401301];c=null!=p&&p;const m=t.navigator;function y(t){return!!c&&(!!g&&g.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function b(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function v(){return!!c&&(!!g&&g.brands.length>0)}function w(){return v()?y("Chromium"):(b("Chrome")||b("CriOS"))&&!(!v()&&b("Edge"))||b("Silk")}g=m&&m.userAgentData||null;var _=!v()&&(b("Trident")||b("MSIE"));!b("Android")||w(),w(),b("Safari")&&(w()||!v()&&b("Coast")||!v()&&b("Opera")||!v()&&b("Edge")||(v()?y("Microsoft Edge"):b("Edg/"))||v()&&y("Opera"));var S={},A=null;function E(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=A[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}I();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 I(){if(!A){A={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));S[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===A[e]&&(A[e]=t)}}}}var T="undefined"!=typeof Uint8Array,x=!_&&"function"==typeof btoa;function P(t){if(!x){var e;void 0===e&&(e=0),I(),e=S[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 U=/[-_.]/g,B={"-":"+",_:"/",".":"="};function O(t){return B[t]||""}function L(t){if(!x)return E(t);U.test(t)&&(t=t.replace(U,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 N(t){return T&&null!=t&&t instanceof Uint8Array}var k={};function F(){return C||=new j(null,k)}function V(t){G(k);var e=t.g;return null==(e=null==e||N(e)?e:"string"==typeof e?L(e):null)?e:t.g=e}var j=class{i(){return new Uint8Array(V(this)||0)}constructor(t,e){if(G(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let C,M;function G(t){if(t!==k)throw Error("illegal external caller")}function D(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function $(){const t=Error("int32");return D(t,"warning"),t}var z="function"==typeof Symbol&&"symbol"==typeof Symbol(),R=new Set;function W(t,e,n=!1,r=!1){return t="function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e,n&&R.add(t),t}var H=W("jas",void 0,!0,!0),q=W(void 0,"2ex"),J=W(void 0,"1oa",!0),K=W(void 0,Symbol(),!0),X=z?(t,e)=>{t[H]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},Y=z?(t,e)=>{t[H]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},Q=z?t=>0|t[H]:t=>0|t.s,Z=z?(t,e)=>{t[H]=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))}function nt(){return"function"==typeof BigInt}function rt(t){return Array.prototype.slice.call(t)}var it,ot={},st={};function at(t){return!(!t||"object"!=typeof t||t.g!==st)}function ut(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function ct(t,e){if(null!=t)if("string"==typeof t)t=t?new j(t,k):F();else if(t.constructor!==j)if(N(t))t=t.length?new j(new Uint8Array(t),k):F();else{if(!e)throw Error();t=void 0}return t}function lt(t){return!(!Array.isArray(t)||t.length)&&!!(1&Q(t))}const ht=[];function ft(t){if(2&t)throw Error()}function dt(t){return K?t[K]:void 0}Z(ht,55),it=Object.freeze(ht);var gt=Object.freeze({}),pt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),mt=t=>pt?t>=bt&&t<=wt:"-"===t[0]?_t(t,yt):_t(t,vt);const yt=Number.MIN_SAFE_INTEGER.toString(),bt=pt?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),wt=pt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function _t(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 St="function"==typeof Uint8Array.prototype.slice;let At,Et=0,It=0;function Tt(t){const e=t>>>0;Et=e,It=(t-e)/4294967296>>>0}function xt(t){if(t<0){Tt(-t);const[e,n]=kt(Et,It);Et=e>>>0,It=n>>>0}else Tt(t)}function Pt(t){const e=At||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),It=0,Et=e.getUint32(0,!0)}function Ut(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ot(t,e)}function Bt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),"number"==typeof(t=Ut(t,e))?n?-t:t:n?"-"+t:t}function Ot(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else nt()?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 Nt(t){if(t.length<16)xt(Number(t));else if(nt())t=BigInt(t),Et=Number(t&BigInt(4294967295))>>>0,It=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);It=Et=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));It*=1e6,Et=1e6*Et+e,Et>=4294967296&&(It+=Math.trunc(Et/4294967296),It>>>=0,Et>>>=0)}if(e){const[t,e]=kt(Et,It);Et=t,It=e}}}function kt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}const Ft="function"==typeof BigInt?BigInt.asIntN:void 0,Vt="function"==typeof BigInt?BigInt.asUintN:void 0,jt=Number.isSafeInteger,Ct=Number.isFinite,Mt=Math.trunc;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 $t=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function zt(t){switch(typeof t){case"bigint":return!0;case"number":return Ct(t);case"string":return $t.test(t);default:return!1}}function Rt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?0|t:void 0}function Wt(t){if("-"===t[0])return!1;const e=t.length;return e<20||20===e&&Number(t.substring(0,6))<184467}function Ht(t){return t=Mt(t),jt(t)||(xt(t),t=Bt(Et,It)),t}function qt(t){var e=Mt(Number(t));if(jt(e))return String(e);if(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),e=t.length,!("-"===t[0]?e<20||20===e&&Number(t.substring(0,7))>-922337:e<19||19===e&&Number(t.substring(0,6))<922337))if(Nt(t),t=Et,2147483648&(e=It))if(nt())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=kt(t,e);t="-"+Ot(n,r)}else t=Ot(t,e);return t}function Jt(t){return null==t?t:"bigint"==typeof t?(mt(t)?t=Number(t):(t=Ft(64,t),t=mt(t)?Number(t):String(t)),t):zt(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(Vt(64,t));if(zt(t)){if("string"===e)return e=Mt(Number(t)),jt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Wt(t)||(Nt(t),t=Ot(Et,It))),t;if("number"===e)return(t=Mt(t))>=0&&jt(t)?t:function(t){if(t<0){xt(t);var e=Ot(Et,It);return t=Number(e),jt(t)?t:e}return Wt(e=String(t))?e:(xt(t),Ut(Et,It))}(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===ot)return t;if(Array.isArray(t)){var r=Q(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&Z(t,i),new e(t)}}function te(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=lt(t)?void 0:i&&2&Q(t)?t:ee(t,e,n,void 0!==r,i);else if(ut(t)){const o={};for(let s in t)o[s]=te(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function ee(t,e,n,r,i){const o=r||n?Q(t):0,s=r?!!(32&o):void 0;r=rt(t);for(let t=0;t<r.length;t++)r[t]=te(r[t],e,n,s,i);return n&&((t=dt(t))&&(r[K]=rt(t)),n(o,r)),r}function ne(t){return t.C===ot?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return mt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(lt(t))return}else{if(N(t))return P(t);if(t instanceof j){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=P(e)}}}return t}(t)}function re(t){return ee(t,ne,void 0,void 0,!1)}let ie,oe;function se(t,e,n){return t=ae(t,e[0],e[1],n?1:2),e!==ie&&n&&X(t,16384),t}function ae(t,e,n,r){if(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=Q(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(ut(n[t])){if((e=t-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,r-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&e)<<15}}}return Z(t,i),t}function ue(t,e,n=et){if(null!=t){if(T&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Q(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Z(t,-12293&(34|r)),t):ee(t,ue,4&r?et:n,!0,!0))}return t.C===ot&&(n=t.l,t=2&(r=Q(n))?t:new t.constructor(le(n,r,!0))),t}}function ce(t){const e=t.l;return new t.constructor(le(e,Q(e),!1))}function le(t,e,n){const r=n||2&e?et:tt,i=!!(32&e);return t=function(t,e,n){const r=rt(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(t=dt(t))&&(r[K]=rt(t)),r}(t,e,(t=>ue(t,i,r))),X(t,32|(n?2:0)),t}function he(t){const e=t.l,n=Q(e);return 2&n?new t.constructor(le(e,n,!1)):t}function fe(t,e){return de(t=t.l,Q(t),e)}function de(e,n,r,i){if(-1===r)return null;var o=r+(512&n?0:-1);const s=e.length-1;return o>=s&&256&n?e[s][r]:i&&256&n&&null!=(n=e[s][r])?(null!=e[o]&&null!=q&&((o=(e=M??={})[q]||0)>=4||(e[q]=o+1,D(e=Error(),"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e))),n):o<=s?e[o]:void 0}function ge(t,e,n){const r=t.l;let i=Q(r);return ft(i),pe(r,i,e,n),t}function pe(t,e,n,r){const i=512&e?0:-1,o=n+i;var s=t.length-1;return o>=s&&256&e?(t[s][n]=r,e):o<=s?(t[o]=r,256&e&&(n in(t=t[s])&&delete t[n]),e):(void 0!==r&&(n>=(s=e>>15&1023||536870912)?null!=r&&(t[s+i]={[n]:r},Z(t,e|=256)):t[o]=r),e)}function me(t){t=t.l;let e=Q(t);const n=de(t,e,1),r=ct(n,!0);return null!=r&&r!==n&&pe(t,e,1,r),r}function ye(t,e,n,r,i){const o=t.l,s=2&(t=Q(o))?1:r;i=!!i,r=be(o,t,e);let a=Q(r);if(!(4&a)){4&a&&(r=rt(r),a=Fe(a,t),t=pe(o,t,e,r));let i=0,s=0;for(;i<r.length;i++){const t=n(r[i]);null!=t&&(r[s++]=t)}s<i&&(r.length=s),a=ve(a,t),n=-4097&(20|a),a=n&=-8193,Z(r,a),2&a&&Object.freeze(r)}return 1===s||4===s&&32&a?we(a)||(i=a,a|=2,a!==i&&Z(r,a),Object.freeze(r)):(2===s&&we(a)&&(r=rt(r),a=Fe(a,t),a=Ve(a,t,i),Z(r,a),t=pe(o,t,e,r)),we(a)||(e=a,a=Ve(a,t,i),a!==e&&Z(r,a))),r}function be(t,e,n,r){return t=de(t,e,n,r),Array.isArray(t)?t:it}function ve(t,e){return 0===t&&(t=Fe(t,e)),1|t}function we(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function _e(t,e,n){t=t.l;let r=Q(t);if(ft(r),null==n)pe(t,r,e);else{var i=Q(n),o=i,s=we(i),a=s||Object.isFrozen(n);for(s||(i=0),a||(n=rt(n),o=0,i=Ve(i=Fe(i,r),r,!0),a=!1),i|=21,s=0;s<n.length;s++){const t=n[s],e=Xt(t);Object.is(t,e)||(a&&(n=rt(n),o=0,i=Ve(i=Fe(i,r),r,!0),a=!1),n[s]=e)}i!==o&&(a&&(n=rt(n),i=Ve(i=Fe(i,r),r,!0)),Z(n,i)),pe(t,r,e,n)}}function Se(t,e){t=t.l;let n=Q(t);ft(n),pe(t,n,2,""===e?void 0:e)}function Ae(t,e,n,r,i){ft(e);var o=!(!(64&e)&&16384&e);const s=(i=be(t,e,n,i))!==it;if(o||!s){let a=o=s?Q(i):0;(!s||2&a||we(a)||4&a&&!(32&a))&&(i=rt(i),a=Fe(a,e),e=pe(t,e,n,i)),a=-13&ve(a,e),a=Ve(r?-17&a:16|a,e,!0),a!==o&&Z(i,a)}return i}function Ee(t,e){var n=hi;return xe(Ie(t=t.l),t,Q(t),n)===e?e:-1}function Ie(t){if(z)return t[J]??(t[J]=new Map);if(J in t)return t[J];const e=new Map;return Object.defineProperty(t,J,{value:e}),e}function Te(t,e,n,r){const i=Ie(t),o=xe(i,t,e,n);return o!==r&&(o&&(e=pe(t,e,o)),i.set(n,r)),e}function xe(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!=de(e,n,o)&&(0!==i&&(n=pe(e,n,i)),i=o)}return t.set(r,i),i}function Pe(t,e,n,r){let i,o=Q(t);if(null!=(r=de(t,o,n,r))&&r.C===ot)return(e=he(r))!==r&&pe(t,o,n,e),e.l;if(Array.isArray(r)){const t=Q(r);i=2&t?se(le(r,t,!1),e,!0):64&t?r:se(i,e,!0)}else i=se(void 0,e,!0);return i!==r&&pe(t,o,n,i),i}function Ue(t,e,n,r){t=t.l;let i=Q(t);return(e=Zt(r=de(t,i,n,r),e,i))!==r&&null!=e&&pe(t,i,n,e),e}function Be(t,e,n){if(null==(e=Ue(t,e,n,!1)))return e;t=t.l;let r=Q(t);if(!(2&r)){const i=he(e);i!==e&&pe(t,r,n,e=i)}return e}function Oe(t,e,n,r,i,o){t=t.l;var s=!!(2&e);const a=s?1:r;i=!!i,o&&=!s,r=be(t,e,1);var u=Q(r);if(!(s=!!(4&u))){var c=r,l=e;const t=!!(2&(u=ve(u,e)));t&&(l|=2);let i=!t,o=!0,s=0,a=0;for(;s<c.length;s++){const e=Zt(c[s],n,l);if(e instanceof n){if(!t){const t=!!(2&Q(e.l));i&&=!t,o&&=t}c[a++]=e}}a<s&&(c.length=a),u|=4,u=o?16|u:-17&u,Z(c,u=i?8|u:-9&u),t&&Object.freeze(c)}if(o&&!(8&u||!r.length&&(1===a||4===a&&32&u))){for(we(u)&&(r=rt(r),u=Fe(u,e),e=pe(t,e,1,r)),n=r,o=u,c=0;c<n.length;c++)(u=n[c])!==(l=he(u))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,Z(n,o),u=o}return 1===a||4===a&&32&u?we(u)||(e=u,(u|=!r.length||16&u&&(!s||32&u)?2:2048)!==e&&Z(r,u),Object.freeze(r)):(2===a&&we(u)&&(r=rt(r),u=Ve(u=Fe(u,e),e,i),Z(r,u),e=pe(t,e,1,r)),we(u)||(t=u,(u=Ve(u,e,i))!==t&&Z(r,u))),r}function Le(t,e){const n=Q(t.l);return Oe(t,n,e,void 0===gt?2:4,!1,!(2&n))}function Ne(t,e,n,r){return null==r&&(r=void 0),ge(t,n,r)}function ke(t,e,n){var r=yi;null==n&&(n=void 0);t:{t=t.l;let i=Q(t);if(ft(i),null==n){const n=Ie(t);if(xe(n,t,i,r)!==e)break t;n.set(r,0)}else i=Te(t,i,r,e);pe(t,i,e,n)}}function Fe(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Ve(t,e,n){return 32&e&&n||(t&=-33),t}function je(t,e){var n=Yr;const r=Q(t.l);ft(r),t=Oe(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&Q(e.l)?Y(t,8):Y(t,16)}function Ce(t,e,n){ft(Q(t.l)),ye(t,e,Qt,2,!0).push(Xt(n))}function Me(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function Ge(){return Error("Failed to read varint, encoding is invalid.")}function De(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function $e(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===j)return{buffer:V(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 ze(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(Ke(t,a),n<128)return e(r>>>0,i>>>0);throw Ge()}function Re(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 Ke(t,n),!!(127&e)}throw Ge()}function We(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 Ge();return Ke(t,n),i}function He(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],Ke(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 qe(t){return We(t)}function Je(t,e,{D:n=!1}={}){t.D=n,e&&(e=$e(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}function Ke(t,e){if(t.g=e,e>t.j)throw De(t.j,e)}function Xe(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 De(e,t.j-n);return t.g=r,n}function Ye(t,e){if(0==e)return F();var n=Xe(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):St?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?F():new j(n,k)}var Qe=[];function Ze(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=We(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Me(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 tn(t){switch(t.i){case 0:0!=t.i?tn(t):Re(t.g);break;case 1:Ke(t=t.g,t.g+8);break;case 2:if(2!=t.i)tn(t);else{var e=We(t.g)>>>0;Ke(t=t.g,t.g+e)}break;case 5:Ke(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!Ze(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}tn(t)}break;default:throw Me(t.i,t.j)}}function en(t,e,n){const r=t.g.j,i=We(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 nn(t){var s=We(t.g)>>>0,a=Xe(t=t.g,s);if(t=t.i,o){var u,c=t;(u=i)||(u=i=new TextDecoder("utf-8",{fatal:!0})),s=a+s,c=0===a&&s===c.length?c:c.subarray(a,s);try{var l=u.decode(c)}catch(t){if(void 0===r){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),r=!0}catch(t){r=!1}}throw!r&&(i=void 0),t}}else{s=(l=a)+s,a=[];let r,i=null;for(;l<s;){var h=t[l++];h<128?a.push(h):h<224?l>=s?e():(r=t[l++],h<194||128!=(192&r)?(l--,e()):a.push((31&h)<<6|63&r)):h<240?l>=s-1?e():(r=t[l++],128!=(192&r)||224===h&&r<160||237===h&&r>=160||128!=(192&(u=t[l++]))?(l--,e()):a.push((15&h)<<12|(63&r)<<6|63&u)):h<=244?l>=s-2?e():(r=t[l++],128!=(192&r)||r-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,e()):(h=(7&h)<<18|(63&r)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):e(),a.length>=8192&&(i=n(i,a),a.length=0)}l=n(i,a)}return l}function rn(t){const e=We(t.g)>>>0;return Ye(t.g,e)}function on(t,e,n){var r=We(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var sn=[];function an(t){return t}let un;function cn(t,e,n){e.g?e.j(t,e.g,e.i,n):e.j(t,e.i,n)}var ln=class{constructor(t,e){this.l=ae(t,e)}toJSON(){const t=!un;try{return t&&(un=re),hn(this)}finally{t&&(un=void 0)}}A(){return!!(2&Q(this.l))}};function hn(t){var e=t.l;{e=(t=un(e))!==e;let c=t.length;if(c){var n=t[c-1],r=ut(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)&&(lt(r)||at(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])||lt(o)||at(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 fn(t){return t?/^\d+$/.test(t)?(Nt(t),new dn(Et,It)):null:gn||=new dn(0,0)}ln.prototype.C=ot,ln.prototype.toString=function(){try{return un=an,hn(this).toString()}finally{un=void 0}};var dn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let gn;function pn(t){return t?/^-?\d+$/.test(t)?(Nt(t),new mn(Et,It)):null:yn||=new mn(0,0)}var mn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let yn;function bn(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 wn(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 _n(t){var e=Et;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 Sn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function An(t,e,n){vn(t.g,8*e+n)}function En(t,e){return An(t,e,2),e=t.g.end(),Sn(t,e),e.push(t.i),e}function In(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 Tn(t,e,n){An(t,e,2),vn(t.g,n.length),Sn(t,t.g.end()),Sn(t,n)}function xn(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Pn=xn(),Un=xn(),Bn=xn(),On=xn(),Ln=xn(),Nn=xn(),kn=xn(),Fn=xn(),Vn=class{constructor(t,e,n){this.g=t,this.i=e,t=Pn,this.j=!!t&&n===t||!1}};function jn(t,e){return new Vn(t,e,Pn)}function Cn(t,e,n,r,i){null!=(e=Kn(e,r))&&(n=En(t,n),i(e,t),In(t,n))}const Mn=jn((function(t,e,n,r,i){return 2===t.i&&(en(t,Pe(e,r,n),i),!0)}),Cn),Gn=jn((function(t,e,n,r,i){return 2===t.i&&(en(t,Pe(e,r,n,!0),i),!0)}),Cn);var Dn=Symbol(),$n=Symbol(),zn=Symbol(),Rn=Symbol();let Wn,Hn;function qn(t,e,n,r){var i=r[t];if(i)return i;(i={}).N=r,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,Wn??=o,Hn??=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 Vn?t=o:(t=Mn,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 Jn(t){return Array.isArray(t)?t[0]instanceof Vn?t:[Gn,t]:[t,void 0]}function Kn(t,e){return t instanceof ln?t.l:Array.isArray(t)?se(t,e,!1):void 0}function Xn(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function Yn(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=qn($n,Xn,Yn,r).B,s||=Qn(r),i)}function Qn(t){let e=t[zn];if(null!=e)return e;const n=qn($n,Xn,Yn,t);return e=n.H?(t,e)=>Wn(t,e,n):(t,e)=>{const r=Q(t);for(;Ze(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=Zn(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,tn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=Ye(o.g,s)),i=t,o&&((s=i[K])?s.push(o):i[K]=[o]))}return 16384&r&&X(t,34),!0},t[zn]=e}function Zn(t){const e=(t=Jn(t))[0].g;if(t=t[1]){const n=Qn(t),r=qn($n,Xn,Yn,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function tr(t,e,n){t[e]=n.i}function er(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=qn(Dn,tr,er,r).B,i||=nr(r))}function nr(t){let e=t[Rn];if(!e){const n=qn(Dn,tr,er,t);e=(t,e)=>rr(t,e,n),t[Rn]=e}return e}function rr(t,e,n){for(var r=Q(t),i=512&r?0:-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=ir(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=ir(n,i))&&a(e,o,i)}if(t=dt(t))for(Sn(e,e.g.end()),n=0;n<t.length;n++)Sn(e,V(t[n])||new Uint8Array(0))}function ir(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=Jn(n))[0].i;if(n=n[1]){const e=nr(n),i=qn(Dn,tr,er,n).B;n=t.H?Hn(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function or(t,e){if(Array.isArray(e)){var n=Q(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 sr(t,e,n){return new Vn(t,e,n)}function ar(t,e,n){return new Vn(t,e,n)}function ur(t,e,n){pe(t,Q(t),e,n)}function cr(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(Ft(64,t));if(zt(t)){if("string"===e)return qt(t);if("number"===e)return Ht(t)}}(e),null!=e){if("string"==typeof e)pn(e);if(null!=e)switch(An(t,n,0),typeof e){case"number":t=t.g,xt(e),bn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new mn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),bn(t.g,n.i,n.g);break;default:n=pn(e),bn(t.g,n.i,n.g)}}}function lr(t,e,n){null!=(e=Rt(e))&&null!=e&&(An(t,n,0),wn(t.g,e))}function hr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(An(t,n,0),t.g.g.push(e?1:0))}function fr(t,e,n){null!=(e=Qt(e))&&Tn(t,n,u(e))}function dr(t,e,n,r,i){null!=(e=Kn(e,r))&&(n=En(t,n),i(e,t),In(t,n))}function gr(t,e,n){null!=(e=null==e||"string"==typeof e||N(e)||e instanceof j?e:void 0)&&Tn(t,n,$e(e).buffer)}var pr=sr((function(t,e,n){return 5===t.i&&(ur(e,n,He(t.g)),!0)}),(function(t,e,n){null!=(e=Gt(e))&&(An(t,n,5),t=t.g,Pt(e),_n(t))}),Nn),mr=ar((function(t,e,n){return(5===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,He,e):e.push(He(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Gt,e))&&e.length){An(t,n,2),vn(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Pt(e[r]),_n(n)}}),Nn),yr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,ze(t.g,Bt)),!0)}),cr,Ln),br=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=ze(t.g,Bt))?void 0:t),!0)}),cr,Ln),vr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,ze(t.g,Ut)),!0)}),(function(t,e,n){if(null!=(e=Kt(e))){if("string"==typeof e)fn(e);if(null!=e)switch(An(t,n,0),typeof e){case"number":t=t.g,xt(e),bn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new dn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),bn(t.g,n.i,n.g);break;default:n=fn(e),bn(t.g,n.i,n.g)}}}),xn()),wr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,We(t.g)),!0)}),lr,On),_r=ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,We,e):e.push(We(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Rt,e))&&e.length){n=En(t,n);for(let n=0;n<e.length;n++)wn(t.g,e[n]);In(t,n)}}),On),Sr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=We(t.g))?void 0:t),!0)}),lr,On),Ar=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Re(t.g)),!0)}),hr,Un),Er=sr((function(t,e,n){return 0===t.i&&(ur(e,n,!1===(t=Re(t.g))?void 0:t),!0)}),hr,Un),Ir=ar((function(t,e,n){return 2===t.i&&(t=nn(t),Ae(e,Q(e),n,!1).push(t),!0)}),(function(t,e,n){if(null!=(e=or(Qt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Tn(r,i,u(o))}}),Bn),Tr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,""===(t=nn(t))?void 0:t),!0)}),fr,Bn),xr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,nn(t)),!0)}),fr,Bn),Pr=function(t,e,n=Pn){return new Vn(t,e,n)}((function(t,e,n,r,i){return 2===t.i&&(r=se(void 0,r,!0),Ae(e,Q(e),n,!0).push(r),en(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)dr(t,e[o],n,r,i)})),Ur=jn((function(t,e,n,r,i,o){return 2===t.i&&(Te(e,Q(e),o,n),en(t,e=Pe(e,r,n),i),!0)}),dr),Br=sr((function(t,e,n){return 2===t.i&&(ur(e,n,rn(t)),!0)}),gr,kn),Or=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=We(t.g)>>>0)?void 0:t),!0)}),(function(t,e,n){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(An(t,n,0),vn(t.g,e))}),xn()),Lr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,We(t.g)),!0)}),(function(t,e,n){null!=(e=Rt(e))&&(e=parseInt(e,10),An(t,n,0),wn(t.g,e))}),Fn);class Nr{constructor(t,e){this.i=t,this.g=e,this.j=Ne,this.defaultValue=void 0}}function kr(t,e){return(n,r)=>{if(sn.length){const t=sn.pop();t.o(r),Je(t.g,n,r),n=t}else n=new class{constructor(t,e){if(Qe.length){const n=Qe.pop();Je(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,Je(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;Qn(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,sn.length<100&&sn.push(n)}return i}}var Fr=[0,Tr,sr((function(t,e,n){return 2===t.i&&(ur(e,n,(t=rn(t))===F()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof ln){const r=e.O;return void(r&&(e=r(e),null!=e&&Tn(t,n,$e(e).buffer)))}if(Array.isArray(e))return}gr(t,e,n)}),kn)];let Vr,jr=globalThis.trustedTypes;function Cr(t){void 0===Vr&&(Vr=function(){let t=null;if(!jr)return t;try{const e=t=>t;t=jr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Vr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function Mr(t,...e){if(0===e.length)return Cr(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Cr(n)}var Gr=[0,wr,Lr,Ar,-1,_r,Lr,-1],Dr=class extends ln{constructor(t){super(t)}},$r=[0,Ar,xr,Ar,Lr,-1,ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,qe,e):e.push(We(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Rt,e))&&e.length){n=En(t,n);for(let n=0;n<e.length;n++)wn(t.g,e[n]);In(t,n)}}),Fn),xr,-1,[0,Ar,-1],Lr,Ar,-1],zr=[0,xr,-2],Rr=class extends ln{constructor(t){super(t)}},Wr=[0],Hr=[0,wr,Ar,1,Ar,-3],qr=class extends ln{constructor(t){super(t,2)}},Jr={};Jr[336783863]=[0,xr,Ar,-1,wr,[0,[1,2,3,4,5,6,7],Ur,Wr,Ur,$r,Ur,zr,Ur,Hr,Ur,Gr,Ur,[0,xr,-2],Ur,[0,xr,Lr]],[0,xr],Ar,[0,[1,3],[2,4],Ur,[0,_r],-1,Ur,[0,Ir],-1,Pr,[0,xr,-1]],xr];var Kr=[0,br,-1,Er,-3,br,_r,Tr,Sr,br,-1,Er,Sr,Er,-2,Tr];function Xr(t){Ce(t,3,"TEXT:text_in")}var Yr=class extends ln{constructor(t){super(t,500)}o(t){return Ne(this,0,7,t)}},Qr=[-1,{}],Zr=[0,xr,1,Qr],ti=[0,xr,Ir,Qr];function ei(t){Ce(t,10,"text_in")}var ni,ri=class extends ln{constructor(t){super(t,500)}o(t){return Ne(this,0,1001,t)}};ri.prototype.g=(ni=[-500,Pr,[-500,Tr,-1,Ir,-3,[-2,Jr,Ar],Pr,Fr,Sr,-1,Zr,ti,Pr,[0,Tr,Er],Tr,Kr,Sr,Ir,987,Ir],4,Pr,[-500,xr,-1,[-1,{}],998,xr],Pr,[-500,xr,Ir,-1,[-2,{},Ar],997,Ir,-1],Sr,Pr,[-500,xr,Ir,Qr,998,Ir],Ir,Sr,Zr,ti,Pr,[0,Tr,-1,Qr],Ir,-2,Kr,Tr,-1,Er,[0,Er,Or],978,Qr,Pr,Fr],function(){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}}}};rr(this.l,t,qn(Dn,tr,er,ni)),Sn(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 ii=class extends ln{constructor(t){super(t)}},oi=class extends ln{constructor(t){super(t)}g(){return Le(this,ii)}},si=class extends ln{constructor(t){super(t)}},ai=kr(class extends ln{constructor(t){super(t)}},[0,Pr,[0,1,wr,xr,[0,Pr,[0,wr,pr,xr,-1]]],yr]),ui=class extends ln{constructor(t){super(t)}},ci=class extends ln{constructor(t){super(t)}I(){const t=me(this);return null==t?F():t}},li=class extends ln{constructor(t){super(t)}},hi=[1,2],fi=kr(class extends ln{constructor(t){super(t)}},[0,Pr,[0,hi,Ur,[0,mr],Ur,[0,Br],wr,xr],yr]),di=class extends ln{constructor(t){super(t)}},gi=class extends ln{constructor(t){super(t)}},pi=[0,Ar,-1],mi=class extends ln{constructor(t){super(t)}},yi=[1,2,3,4,5],bi=class extends ln{constructor(t){super(t)}g(){return null!=me(this)}i(){return null!=Qt(fe(this,2))}},vi=class extends ln{constructor(t){super(t)}},wi=[0,[0,Br,xr,[0,wr,yr,-1],[0,vr,yr]],Ar,[0,yi,Ur,Hr,Ur,$r,Ur,Gr,Ur,Wr,Ur,zr],Lr],_i=class extends ln{constructor(t){super(t)}},Si=new Nr(462704549,_i);Jr[462704549]=[0,wi,[0,xr,wr,pr,Ir,-1]];var Ai=class extends ln{constructor(t){super(t)}},Ei=new Nr(477589892,Ai);function Ii(t,e){if(e=e?ce(e):new di,void 0!==t.displayNamesLocale?ge(e,1,Yt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&ge(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw $();if(!Ct(n))throw $();n|=0}ge(e,2,n)}else"maxResults"in t&&ge(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}`);ge(e,3,n)}else"scoreThreshold"in t&&ge(e,3);return void 0!==t.categoryAllowlist?_e(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&ge(e,4),void 0!==t.categoryDenylist?_e(e,5,t.categoryDenylist):"categoryDenylist"in t&&ge(e,5),e}function Ti(t){const e={classifications:Le(t,si).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=Rt(fe(t,1))??0??-1;const n=t.l;let r=Q(n);const i=de(n,r,2),o=Gt(i);return null!=o&&o!==i&&pe(n,r,2,o),{index:e,score:o??0??0,categoryName:Qt(fe(t,3))??""??"",displayName:Qt(fe(t,4))??""??""}})),headIndex:e,headName:n}}(Be(t,oi,4)?.g()??[],Rt(fe(t,2))??0,Qt(fe(t,3))??"")))};return null!=Jt(fe(t,2))&&(e.timestampMs=Jt(fe(t,2))??0),e}function xi(t){return Array.from(t,(t=>t>127?t-256:t))}function Pi(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 Ui;Jr[477589892]=[0,wi,pi];const Bi=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 Oi(){if(void 0===Ui)try{await WebAssembly.instantiate(Bi),Ui=!0}catch{Ui=!1}return Ui}async function Li(t,e=Mr``){const n=await Oi()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Ni=class{};function ki(){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 Fi(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())}Ni.forVisionTasks=function(t){return Li("vision",t)},Ni.forTextTasks=function(t){return Li("text",t)},Ni.forGenAiExperimentalTasks=function(t){return Li("genai_experimental",t)},Ni.forGenAiTasks=function(t){return Li("genai",t)},Ni.forAudioTasks=function(t){return Li("audio",t)},Ni.isSimdSupported=function(){return Oi()};function Vi(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 ji(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 Ci(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function Mi(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 Gi=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:ki()?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?'),Vi(this,r||"input_audio",(r=>{Vi(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),Vi(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Vi(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){Vi(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Vi(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Vi(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Vi(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Vi(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Vi(this,e,(e=>{ji(this,Object.keys(t),(r=>{ji(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Vi(this,n,(n=>{Vi(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){Vi(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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)Vi(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Vi(this,n,(n=>{Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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)Vi(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Mi(this,t,e),Vi(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?'),Ci(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Vi(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 Di=class extends Gi{};async function $i(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Fi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Fi(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 zi(t,e,n){return $i(t,e,n)}function Ri(t,e){const n=Be(t.baseOptions,bi,1)||new bi;"string"==typeof e?(ge(n,2,Yt(e)),ge(n,1)):e instanceof Uint8Array&&(ge(n,1,ct(e,!1)),ge(n,2)),Ne(t.baseOptions,0,1,n)}function Wi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Be(t.baseOptions,bi,1)?.g()||Be(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=Be(t.baseOptions,mi,3);if(!n){var r=n=new mi;ke(r,4,new Rr)}"delegate"in e&&("GPU"===e.delegate?ke(e=n,2,r=new Dr):ke(e=n,4,r=new Rr)),Ne(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),Ri(t,"/model.dat"),t.v()}));if(n.modelAssetBuffer instanceof Uint8Array)Ri(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=>{Ri(t,e),t.v()}));return t.v(),Promise.resolve()}function Hi(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 qi(t,e){t.j=Math.max(t.j,e)}var Ji=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),Hi(this)}finishProcessing(){this.g.finishProcessing(),Hi(this)}close(){this.g.closeGraph()}};Ji.prototype.close=Ji.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",Ji);var Ki=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={languages:[]},Ne(t=this.i=new _i,0,1,e=new vi)}o(t){return Ne(this.i,0,2,Ii(t,Be(this.i,di,2))),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"classifications_out");const e=new qr;cn(e,Si,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),Ce(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),je(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Ti(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}))),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ki.prototype.detect=Ki.prototype.K,Ki.prototype.setOptions=Ki.prototype.o,Ki.createFromModelPath=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetPath:e}})},Ki.createFromModelBuffer=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetBuffer:e}})},Ki.createFromOptions=function(t,e){return zi(Ki,t,e)};var Xi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={classifications:[]},Ne(t=this.i=new _i,0,1,e=new vi)}o(t){return Ne(this.i,0,2,Ii(t,Be(this.i,di,2))),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"classifications_out");const e=new qr;cn(e,Si,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),Ce(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),je(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Ti(ai(t)),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xi.prototype.classify=Xi.prototype.J,Xi.prototype.setOptions=Xi.prototype.o,Xi.createFromModelPath=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetPath:e}})},Xi.createFromModelBuffer=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetBuffer:e}})},Xi.createFromOptions=function(t,e){return zi(Xi,t,e)};var Yi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={embeddings:[]},Ne(t=this.i=new Ai,0,1,e=new vi)}o(t){var e=this.i,n=Be(this.i,gi,2);return n=n?ce(n):new gi,void 0!==t.l2Normalize?ge(n,1,Dt(t.l2Normalize)):"l2Normalize"in t&&ge(n,1),void 0!==t.quantize?ge(n,2,Dt(t.quantize)):"quantize"in t&&ge(n,2),Ne(e,0,2,n),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"embeddings_out");const e=new qr;cn(e,Ei,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Xr(n),Ce(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),je(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=fi(t),this.u=function(t){return{embeddings:Le(t,li).map((t=>{const e={headIndex:Rt(fe(t,3))??0??-1,headName:Qt(fe(t,4))??""??""};if(void 0!==Ue(t,ui,Ee(t,1)))e.floatEmbedding=ye(Be(t,ui,Ee(t,1)),1,Gt,void 0===gt?2:4).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=Be(t,ci,Ee(t,2))?.I()?.i()??n}return e})),timestampMs:Jt(fe(t,2))??0}}(t),qi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Yi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Pi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Pi(xi(t.quantizedEmbedding),xi(e.quantizedEmbedding))}return t},Yi.prototype.embed=Yi.prototype.L,Yi.prototype.setOptions=Yi.prototype.o,Yi.createFromModelPath=function(t,e){return zi(Yi,t,{baseOptions:{modelAssetPath:e}})},Yi.createFromModelBuffer=function(t,e){return zi(Yi,t,{baseOptions:{modelAssetBuffer:e}})},Yi.createFromOptions=function(t,e){return zi(Yi,t,e)},exports.FilesetResolver=Ni,exports.LanguageDetector=Ki,exports.TextClassifier=Xi,exports.TextEmbedder=Yi;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof self?self:{};function e(){throw Error("Invalid UTF8")}function n(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let r,i;const o="undefined"!=typeof TextDecoder;let s;const a="undefined"!=typeof TextEncoder;function u(t){if(a)t=(s||=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 c,l;t:{for(var h=["CLOSURE_FLAGS"],f=t,d=0;d<h.length;d++)if(null==(f=f[h[d]])){l=null;break t}l=f}var g,p=l&&l[610401301];c=null!=p&&p;const m=t.navigator;function y(t){return!!c&&(!!g&&g.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function b(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function v(){return!!c&&(!!g&&g.brands.length>0)}function w(){return v()?y("Chromium"):(b("Chrome")||b("CriOS"))&&!(!v()&&b("Edge"))||b("Silk")}g=m&&m.userAgentData||null;var _=!v()&&(b("Trident")||b("MSIE"));!b("Android")||w(),w(),b("Safari")&&(w()||!v()&&b("Coast")||!v()&&b("Opera")||!v()&&b("Edge")||(v()?y("Microsoft Edge"):b("Edg/"))||v()&&y("Opera"));var S={},A=null;function E(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=A[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}I();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 I(){if(!A){A={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let n=0;n<5;n++){const r=t.concat(e[n].split(""));S[n]=r;for(let t=0;t<r.length;t++){const e=r[t];void 0===A[e]&&(A[e]=t)}}}}var T="undefined"!=typeof Uint8Array,x=!_&&"function"==typeof btoa;function P(t){if(!x){var e;void 0===e&&(e=0),I(),e=S[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 U=/[-_.]/g,B={"-":"+",_:"/",".":"="};function O(t){return B[t]||""}function L(t){if(!x)return E(t);U.test(t)&&(t=t.replace(U,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 N(t){return T&&null!=t&&t instanceof Uint8Array}var k={};function F(){return C||=new j(null,k)}function V(t){G(k);var e=t.g;return null==(e=null==e||N(e)?e:"string"==typeof e?L(e):null)?e:t.g=e}var j=class{i(){return new Uint8Array(V(this)||0)}constructor(t,e){if(G(e),this.g=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};let C,M;function G(t){if(t!==k)throw Error("illegal external caller")}function D(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function $(){const t=Error("int32");return D(t,"warning"),t}var z="function"==typeof Symbol&&"symbol"==typeof Symbol(),R=new Set;function W(t,e,n=!1,r=!1){return t="function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e,n&&R.add(t),t}var H=W("jas",void 0,!0,!0),q=W(void 0,"2ex"),J=W(void 0,"1oa",!0),K=W(void 0,Symbol(),!0),X=z?(t,e)=>{t[H]|=e}:(t,e)=>{void 0!==t.s?t.s|=e:Object.defineProperties(t,{s:{value:e,configurable:!0,writable:!0,enumerable:!1}})},Y=z?(t,e)=>{t[H]&=~e}:(t,e)=>{void 0!==t.s&&(t.s&=~e)},Q=z?t=>0|t[H]:t=>0|t.s,Z=z?(t,e)=>{t[H]=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))}function nt(){return"function"==typeof BigInt}function rt(t){return Array.prototype.slice.call(t)}var it,ot={},st={};function at(t){return!(!t||"object"!=typeof t||t.g!==st)}function ut(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function ct(t,e){if(null!=t)if("string"==typeof t)t=t?new j(t,k):F();else if(t.constructor!==j)if(N(t))t=t.length?new j(new Uint8Array(t),k):F();else{if(!e)throw Error();t=void 0}return t}function lt(t){return!(!Array.isArray(t)||t.length)&&!!(1&Q(t))}const ht=[];function ft(t){if(2&t)throw Error()}function dt(t){return K?t[K]:void 0}Z(ht,55),it=Object.freeze(ht);var gt=Object.freeze({}),pt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0),mt=t=>pt?t>=bt&&t<=wt:"-"===t[0]?_t(t,yt):_t(t,vt);const yt=Number.MIN_SAFE_INTEGER.toString(),bt=pt?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),wt=pt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function _t(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 St="function"==typeof Uint8Array.prototype.slice;let At,Et=0,It=0;function Tt(t){const e=t>>>0;Et=e,It=(t-e)/4294967296>>>0}function xt(t){if(t<0){Tt(-t);const[e,n]=kt(Et,It);Et=e>>>0,It=n>>>0}else Tt(t)}function Pt(t){const e=At||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),It=0,Et=e.getUint32(0,!0)}function Ut(t,e){const n=4294967296*e+(t>>>0);return Number.isSafeInteger(n)?n:Ot(t,e)}function Bt(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),"number"==typeof(t=Ut(t,e))?n?-t:t:n?"-"+t:t}function Ot(t,e){if(t>>>=0,(e>>>=0)<=2097151)var n=""+(4294967296*e+t);else nt()?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 Nt(t){if(t.length<16)xt(Number(t));else if(nt())t=BigInt(t),Et=Number(t&BigInt(4294967295))>>>0,It=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);It=Et=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));It*=1e6,Et=1e6*Et+e,Et>=4294967296&&(It+=Math.trunc(Et/4294967296),It>>>=0,Et>>>=0)}if(e){const[t,e]=kt(Et,It);Et=t,It=e}}}function kt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}const Ft="function"==typeof BigInt?BigInt.asIntN:void 0,Vt="function"==typeof BigInt?BigInt.asUintN:void 0,jt=Number.isSafeInteger,Ct=Number.isFinite,Mt=Math.trunc;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 $t=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function zt(t){switch(typeof t){case"bigint":return!0;case"number":return Ct(t);case"string":return $t.test(t);default:return!1}}function Rt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?0|t:void 0}function Wt(t){if("-"===t[0])return!1;const e=t.length;return e<20||20===e&&Number(t.substring(0,6))<184467}function Ht(t){return t=Mt(t),jt(t)||(xt(t),t=Bt(Et,It)),t}function qt(t){var e=Mt(Number(t));if(jt(e))return String(e);if(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),e=t.length,!("-"===t[0]?e<20||20===e&&Number(t.substring(0,7))>-922337:e<19||19===e&&Number(t.substring(0,6))<922337))if(Nt(t),t=Et,2147483648&(e=It))if(nt())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{const[n,r]=kt(t,e);t="-"+Ot(n,r)}else t=Ot(t,e);return t}function Jt(t){return null==t?t:"bigint"==typeof t?(mt(t)?t=Number(t):(t=Ft(64,t),t=mt(t)?Number(t):String(t)),t):zt(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(Vt(64,t));if(zt(t)){if("string"===e)return e=Mt(Number(t)),jt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Wt(t)||(Nt(t),t=Ot(Et,It))),t;if("number"===e)return(t=Mt(t))>=0&&jt(t)?t:function(t){if(t<0){xt(t);var e=Ot(Et,It);return t=Number(e),jt(t)?t:e}return Wt(e=String(t))?e:(xt(t),Ut(Et,It))}(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===ot)return t;if(Array.isArray(t)){var r=Q(t),i=r;return 0===i&&(i|=32&n),(i|=2&n)!==r&&Z(t,i),new e(t)}}function te(t,e,n,r,i){if(null!=t){if(Array.isArray(t))t=lt(t)?void 0:i&&2&Q(t)?t:ee(t,e,n,void 0!==r,i);else if(ut(t)){const o={};for(let s in t)o[s]=te(t[s],e,n,r,i);t=o}else t=e(t,r);return t}}function ee(t,e,n,r,i){const o=r||n?Q(t):0,s=r?!!(32&o):void 0;r=rt(t);for(let t=0;t<r.length;t++)r[t]=te(r[t],e,n,s,i);return n&&((t=dt(t))&&(r[K]=rt(t)),n(o,r)),r}function ne(t){return t.C===ot?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"bigint":return mt(t)?Number(t):String(t);case"boolean":return t?1:0;case"object":if(t)if(Array.isArray(t)){if(lt(t))return}else{if(N(t))return P(t);if(t instanceof j){const e=t.g;return null==e?"":"string"==typeof e?e:t.g=P(e)}}}return t}(t)}function re(t){return ee(t,ne,void 0,void 0,!1)}let ie,oe;function se(t,e,n){return t=ae(t,e[0],e[1],n?1:2),e!==ie&&n&&X(t,16384),t}function ae(t,e,n,r){if(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=Q(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(ut(n[t])){if((e=t-(512&(i|=256)?0:-1))>=1024)throw Error("pvtlmt");i=-33521665&i|(1023&e)<<15;break t}}if(e){if((e=Math.max(e,r-(512&i?0:-1)))>1024)throw Error("spvt");i=-33521665&i|(1023&e)<<15}}}return Z(t,i),t}function ue(t,e,n=et){if(null!=t){if(T&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){var r=Q(t);return 2&r?t:(e&&=0===r||!!(32&r)&&!(64&r||!(16&r)),e?(Z(t,-12293&(34|r)),t):ee(t,ue,4&r?et:n,!0,!0))}return t.C===ot&&(n=t.l,t=2&(r=Q(n))?t:new t.constructor(le(n,r,!0))),t}}function ce(t){const e=t.l;return new t.constructor(le(e,Q(e),!1))}function le(t,e,n){const r=n||2&e?et:tt,i=!!(32&e);return t=function(t,e,n){const r=rt(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(t=dt(t))&&(r[K]=rt(t)),r}(t,e,(t=>ue(t,i,r))),X(t,32|(n?2:0)),t}function he(t){const e=t.l,n=Q(e);return 2&n?new t.constructor(le(e,n,!1)):t}function fe(t,e){return de(t=t.l,Q(t),e)}function de(e,n,r,i){if(-1===r)return null;var o=r+(512&n?0:-1);const s=e.length-1;return o>=s&&256&n?e[s][r]:i&&256&n&&null!=(n=e[s][r])?(null!=e[o]&&null!=q&&((o=(e=M??={})[q]||0)>=4||(e[q]=o+1,D(e=Error(),"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e))),n):o<=s?e[o]:void 0}function ge(t,e,n){const r=t.l;let i=Q(r);return ft(i),pe(r,i,e,n),t}function pe(t,e,n,r){const i=512&e?0:-1,o=n+i;var s=t.length-1;return o>=s&&256&e?(t[s][n]=r,e):o<=s?(t[o]=r,256&e&&(n in(t=t[s])&&delete t[n]),e):(void 0!==r&&(n>=(s=e>>15&1023||536870912)?null!=r&&(t[s+i]={[n]:r},Z(t,e|=256)):t[o]=r),e)}function me(t){t=t.l;let e=Q(t);const n=de(t,e,1),r=ct(n,!0);return null!=r&&r!==n&&pe(t,e,1,r),r}function ye(t,e,n,r,i){const o=t.l,s=2&(t=Q(o))?1:r;i=!!i,r=be(o,t,e);let a=Q(r);if(!(4&a)){4&a&&(r=rt(r),a=Fe(a,t),t=pe(o,t,e,r));let i=0,s=0;for(;i<r.length;i++){const t=n(r[i]);null!=t&&(r[s++]=t)}s<i&&(r.length=s),a=ve(a,t),n=-4097&(20|a),a=n&=-8193,Z(r,a),2&a&&Object.freeze(r)}return 1===s||4===s&&32&a?we(a)||(i=a,a|=2,a!==i&&Z(r,a),Object.freeze(r)):(2===s&&we(a)&&(r=rt(r),a=Fe(a,t),a=Ve(a,t,i),Z(r,a),t=pe(o,t,e,r)),we(a)||(e=a,a=Ve(a,t,i),a!==e&&Z(r,a))),r}function be(t,e,n,r){return t=de(t,e,n,r),Array.isArray(t)?t:it}function ve(t,e){return 0===t&&(t=Fe(t,e)),1|t}function we(t){return!!(2&t)&&!!(4&t)||!!(2048&t)}function _e(t,e,n){t=t.l;let r=Q(t);if(ft(r),null==n)pe(t,r,e);else{var i=Q(n),o=i,s=we(i),a=s||Object.isFrozen(n);for(s||(i=0),a||(n=rt(n),o=0,i=Ve(i=Fe(i,r),r,!0),a=!1),i|=21,s=0;s<n.length;s++){const t=n[s],e=Xt(t);Object.is(t,e)||(a&&(n=rt(n),o=0,i=Ve(i=Fe(i,r),r,!0),a=!1),n[s]=e)}i!==o&&(a&&(n=rt(n),i=Ve(i=Fe(i,r),r,!0)),Z(n,i)),pe(t,r,e,n)}}function Se(t,e){t=t.l;let n=Q(t);ft(n),pe(t,n,2,""===e?void 0:e)}function Ae(t,e,n,r,i){ft(e);var o=!(!(64&e)&&16384&e);const s=(i=be(t,e,n,i))!==it;if(o||!s){let a=o=s?Q(i):0;(!s||2&a||we(a)||4&a&&!(32&a))&&(i=rt(i),a=Fe(a,e),e=pe(t,e,n,i)),a=-13&ve(a,e),a=Ve(r?-17&a:16|a,e,!0),a!==o&&Z(i,a)}return i}function Ee(t,e){var n=hi;return xe(Ie(t=t.l),t,Q(t),n)===e?e:-1}function Ie(t){if(z)return t[J]??(t[J]=new Map);if(J in t)return t[J];const e=new Map;return Object.defineProperty(t,J,{value:e}),e}function Te(t,e,n,r){const i=Ie(t),o=xe(i,t,e,n);return o!==r&&(o&&(e=pe(t,e,o)),i.set(n,r)),e}function xe(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!=de(e,n,o)&&(0!==i&&(n=pe(e,n,i)),i=o)}return t.set(r,i),i}function Pe(t,e,n,r){let i,o=Q(t);if(null!=(r=de(t,o,n,r))&&r.C===ot)return(e=he(r))!==r&&pe(t,o,n,e),e.l;if(Array.isArray(r)){const t=Q(r);i=2&t?se(le(r,t,!1),e,!0):64&t?r:se(i,e,!0)}else i=se(void 0,e,!0);return i!==r&&pe(t,o,n,i),i}function Ue(t,e,n,r){t=t.l;let i=Q(t);return(e=Zt(r=de(t,i,n,r),e,i))!==r&&null!=e&&pe(t,i,n,e),e}function Be(t,e,n){if(null==(e=Ue(t,e,n,!1)))return e;t=t.l;let r=Q(t);if(!(2&r)){const i=he(e);i!==e&&pe(t,r,n,e=i)}return e}function Oe(t,e,n,r,i,o){t=t.l;var s=!!(2&e);const a=s?1:r;i=!!i,o&&=!s,r=be(t,e,1);var u=Q(r);if(!(s=!!(4&u))){var c=r,l=e;const t=!!(2&(u=ve(u,e)));t&&(l|=2);let i=!t,o=!0,s=0,a=0;for(;s<c.length;s++){const e=Zt(c[s],n,l);if(e instanceof n){if(!t){const t=!!(2&Q(e.l));i&&=!t,o&&=t}c[a++]=e}}a<s&&(c.length=a),u|=4,u=o?16|u:-17&u,Z(c,u=i?8|u:-9&u),t&&Object.freeze(c)}if(o&&!(8&u||!r.length&&(1===a||4===a&&32&u))){for(we(u)&&(r=rt(r),u=Fe(u,e),e=pe(t,e,1,r)),n=r,o=u,c=0;c<n.length;c++)(u=n[c])!==(l=he(u))&&(n[c]=l);o|=8,o=n.length?-17&o:16|o,Z(n,o),u=o}return 1===a||4===a&&32&u?we(u)||(e=u,(u|=!r.length||16&u&&(!s||32&u)?2:2048)!==e&&Z(r,u),Object.freeze(r)):(2===a&&we(u)&&(r=rt(r),u=Ve(u=Fe(u,e),e,i),Z(r,u),e=pe(t,e,1,r)),we(u)||(t=u,(u=Ve(u,e,i))!==t&&Z(r,u))),r}function Le(t,e){const n=Q(t.l);return Oe(t,n,e,void 0===gt?2:4,!1,!(2&n))}function Ne(t,e,n,r){return null==r&&(r=void 0),ge(t,n,r)}function ke(t,e,n){var r=yi;null==n&&(n=void 0);t:{t=t.l;let i=Q(t);if(ft(i),null==n){const n=Ie(t);if(xe(n,t,i,r)!==e)break t;n.set(r,0)}else i=Te(t,i,r,e);pe(t,i,e,n)}}function Fe(t,e){return-2049&(t=32|(2&e?2|t:-3&t))}function Ve(t,e,n){return 32&e&&n||(t&=-33),t}function je(t,e){var n=Yr;const r=Q(t.l);ft(r),t=Oe(t,r,n,2,!0),e=null!=e?e:new n,t.push(e),2&Q(e.l)?Y(t,8):Y(t,16)}function Ce(t,e,n){ft(Q(t.l)),ye(t,e,Qt,2,!0).push(Xt(n))}function Me(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function Ge(){return Error("Failed to read varint, encoding is invalid.")}function De(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function $e(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===j)return{buffer:V(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 ze(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(Ke(t,a),n<128)return e(r>>>0,i>>>0);throw Ge()}function Re(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 Ke(t,n),!!(127&e)}throw Ge()}function We(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 Ge();return Ke(t,n),i}function He(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],Ke(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 qe(t){return We(t)}function Je(t,e,{D:n=!1}={}){t.D=n,e&&(e=$e(e),t.i=e.buffer,t.m=e.A,t.v=0,t.j=t.i.length,t.g=t.v)}function Ke(t,e){if(t.g=e,e>t.j)throw De(t.j,e)}function Xe(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 De(e,t.j-n);return t.g=r,n}function Ye(t,e){if(0==e)return F();var n=Xe(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):St?t.slice(n,e):new Uint8Array(t.subarray(n,e))),0==n.length?F():new j(n,k)}var Qe=[];function Ze(t){var e=t.g;if(e.g==e.j)return!1;t.j=t.g.g;var n=We(t.g)>>>0;if(e=n>>>3,!((n&=7)>=0&&n<=5))throw Me(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 tn(t){switch(t.i){case 0:0!=t.i?tn(t):Re(t.g);break;case 1:Ke(t=t.g,t.g+8);break;case 2:if(2!=t.i)tn(t);else{var e=We(t.g)>>>0;Ke(t=t.g,t.g+e)}break;case 5:Ke(t=t.g,t.g+4);break;case 3:for(e=t.m;;){if(!Ze(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.i){if(t.m!=e)throw Error("Unmatched end-group tag");break}tn(t)}break;default:throw Me(t.i,t.j)}}function en(t,e,n){const r=t.g.j,i=We(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 nn(t){var s=We(t.g)>>>0,a=Xe(t=t.g,s);if(t=t.i,o){var u,c=t;(u=i)||(u=i=new TextDecoder("utf-8",{fatal:!0})),s=a+s,c=0===a&&s===c.length?c:c.subarray(a,s);try{var l=u.decode(c)}catch(t){if(void 0===r){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),r=!0}catch(t){r=!1}}throw!r&&(i=void 0),t}}else{s=(l=a)+s,a=[];let r,i=null;for(;l<s;){var h=t[l++];h<128?a.push(h):h<224?l>=s?e():(r=t[l++],h<194||128!=(192&r)?(l--,e()):a.push((31&h)<<6|63&r)):h<240?l>=s-1?e():(r=t[l++],128!=(192&r)||224===h&&r<160||237===h&&r>=160||128!=(192&(u=t[l++]))?(l--,e()):a.push((15&h)<<12|(63&r)<<6|63&u)):h<=244?l>=s-2?e():(r=t[l++],128!=(192&r)||r-144+(h<<28)>>30!=0||128!=(192&(u=t[l++]))||128!=(192&(c=t[l++]))?(l--,e()):(h=(7&h)<<18|(63&r)<<12|(63&u)<<6|63&c,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):e(),a.length>=8192&&(i=n(i,a),a.length=0)}l=n(i,a)}return l}function rn(t){const e=We(t.g)>>>0;return Ye(t.g,e)}function on(t,e,n){var r=We(t.g)>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e(t.g))}var sn=[];function an(t){return t}let un;function cn(t,e,n){e.g?e.j(t,e.g,e.i,n):e.j(t,e.i,n)}var ln=class{constructor(t,e){this.l=ae(t,e)}toJSON(){const t=!un;try{return t&&(un=re),hn(this)}finally{t&&(un=void 0)}}A(){return!!(2&Q(this.l))}};function hn(t){var e=t.l;{e=(t=un(e))!==e;let c=t.length;if(c){var n=t[c-1],r=ut(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)&&(lt(r)||at(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])||lt(o)||at(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 fn(t){return t?/^\d+$/.test(t)?(Nt(t),new dn(Et,It)):null:gn||=new dn(0,0)}ln.prototype.C=ot,ln.prototype.toString=function(){try{return un=an,hn(this).toString()}finally{un=void 0}};var dn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let gn;function pn(t){return t?/^-?\d+$/.test(t)?(Nt(t),new mn(Et,It)):null:yn||=new mn(0,0)}var mn=class{constructor(t,e){this.i=t>>>0,this.g=e>>>0}};let yn;function bn(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 wn(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 _n(t){var e=Et;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 Sn(t,e){0!==e.length&&(t.j.push(e),t.i+=e.length)}function An(t,e,n){vn(t.g,8*e+n)}function En(t,e){return An(t,e,2),e=t.g.end(),Sn(t,e),e.push(t.i),e}function In(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 Tn(t,e,n){An(t,e,2),vn(t.g,n.length),Sn(t,t.g.end()),Sn(t,n)}function xn(){const t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var Pn=xn(),Un=xn(),Bn=xn(),On=xn(),Ln=xn(),Nn=xn(),kn=xn(),Fn=xn(),Vn=class{constructor(t,e,n){this.g=t,this.i=e,t=Pn,this.j=!!t&&n===t||!1}};function jn(t,e){return new Vn(t,e,Pn)}function Cn(t,e,n,r,i){null!=(e=Kn(e,r))&&(n=En(t,n),i(e,t),In(t,n))}const Mn=jn((function(t,e,n,r,i){return 2===t.i&&(en(t,Pe(e,r,n),i),!0)}),Cn),Gn=jn((function(t,e,n,r,i){return 2===t.i&&(en(t,Pe(e,r,n,!0),i),!0)}),Cn);var Dn=Symbol(),$n=Symbol(),zn=Symbol(),Rn=Symbol();let Wn,Hn;function qn(t,e,n,r){var i=r[t];if(i)return i;(i={}).N=r,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,Wn??=o,Hn??=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 Vn?t=o:(t=Mn,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 Jn(t){return Array.isArray(t)?t[0]instanceof Vn?t:[Gn,t]:[t,void 0]}function Kn(t,e){return t instanceof ln?t.l:Array.isArray(t)?se(t,e,!1):void 0}function Xn(t,e,n,r){const i=n.g;t[e]=r?(t,e,n)=>i(t,e,n,r):i}function Yn(t,e,n,r,i){const o=n.g;let s,a;t[e]=(t,e,n)=>o(t,e,n,a||=qn($n,Xn,Yn,r).B,s||=Qn(r),i)}function Qn(t){let e=t[zn];if(null!=e)return e;const n=qn($n,Xn,Yn,t);return e=n.H?(t,e)=>Wn(t,e,n):(t,e)=>{const r=Q(t);for(;Ze(e)&&4!=e.i;){var i=e.m,o=n[i];if(null==o){var s=n.G;s&&(s=s[i])&&(null!=(s=Zn(s))&&(o=n[i]=s))}null!=o&&o(e,t,i)||(i=(o=e).j,tn(o),o.F?o=void 0:(s=o.g.g-i,o.g.g=i,o=Ye(o.g,s)),i=t,o&&((s=i[K])?s.push(o):i[K]=[o]))}return 16384&r&&X(t,34),!0},t[zn]=e}function Zn(t){const e=(t=Jn(t))[0].g;if(t=t[1]){const n=Qn(t),r=qn($n,Xn,Yn,t).B;return(t,i,o)=>e(t,i,o,r,n)}return e}function tr(t,e,n){t[e]=n.i}function er(t,e,n,r){let i,o;const s=n.i;t[e]=(t,e,n)=>s(t,e,n,o||=qn(Dn,tr,er,r).B,i||=nr(r))}function nr(t){let e=t[Rn];if(!e){const n=qn(Dn,tr,er,t);e=(t,e)=>rr(t,e,n),t[Rn]=e}return e}function rr(t,e,n){for(var r=Q(t),i=512&r?0:-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=ir(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=ir(n,i))&&a(e,o,i)}if(t=dt(t))for(Sn(e,e.g.end()),n=0;n<t.length;n++)Sn(e,V(t[n])||new Uint8Array(0))}function ir(t,e){var n=t[e];if(n)return n;if((n=t.G)&&(n=n[e])){var r=(n=Jn(n))[0].i;if(n=n[1]){const e=nr(n),i=qn(Dn,tr,er,n).B;n=t.H?Hn(i,e):(t,n,o)=>r(t,n,o,i,e)}else n=r;return t[e]=n}}function or(t,e){if(Array.isArray(e)){var n=Q(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 sr(t,e,n){return new Vn(t,e,n)}function ar(t,e,n){return new Vn(t,e,n)}function ur(t,e,n){pe(t,Q(t),e,n)}function cr(t,e,n){if(e=function(t){if(null==t)return t;const e=typeof t;if("bigint"===e)return String(Ft(64,t));if(zt(t)){if("string"===e)return qt(t);if("number"===e)return Ht(t)}}(e),null!=e){if("string"==typeof e)pn(e);if(null!=e)switch(An(t,n,0),typeof e){case"number":t=t.g,xt(e),bn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new mn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),bn(t.g,n.i,n.g);break;default:n=pn(e),bn(t.g,n.i,n.g)}}}function lr(t,e,n){null!=(e=Rt(e))&&null!=e&&(An(t,n,0),wn(t.g,e))}function hr(t,e,n){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(An(t,n,0),t.g.g.push(e?1:0))}function fr(t,e,n){null!=(e=Qt(e))&&Tn(t,n,u(e))}function dr(t,e,n,r,i){null!=(e=Kn(e,r))&&(n=En(t,n),i(e,t),In(t,n))}function gr(t,e,n){null!=(e=null==e||"string"==typeof e||N(e)||e instanceof j?e:void 0)&&Tn(t,n,$e(e).buffer)}var pr=sr((function(t,e,n){return 5===t.i&&(ur(e,n,He(t.g)),!0)}),(function(t,e,n){null!=(e=Gt(e))&&(An(t,n,5),t=t.g,Pt(e),_n(t))}),Nn),mr=ar((function(t,e,n){return(5===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,He,e):e.push(He(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Gt,e))&&e.length){An(t,n,2),vn(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Pt(e[r]),_n(n)}}),Nn),yr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,ze(t.g,Bt)),!0)}),cr,Ln),br=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=ze(t.g,Bt))?void 0:t),!0)}),cr,Ln),vr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,ze(t.g,Ut)),!0)}),(function(t,e,n){if(null!=(e=Kt(e))){if("string"==typeof e)fn(e);if(null!=e)switch(An(t,n,0),typeof e){case"number":t=t.g,xt(e),bn(t,Et,It);break;case"bigint":n=BigInt.asUintN(64,e),n=new dn(Number(n&BigInt(4294967295)),Number(n>>BigInt(32))),bn(t.g,n.i,n.g);break;default:n=fn(e),bn(t.g,n.i,n.g)}}}),xn()),wr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,We(t.g)),!0)}),lr,On),_r=ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,We,e):e.push(We(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Rt,e))&&e.length){n=En(t,n);for(let n=0;n<e.length;n++)wn(t.g,e[n]);In(t,n)}}),On),Sr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=We(t.g))?void 0:t),!0)}),lr,On),Ar=sr((function(t,e,n){return 0===t.i&&(ur(e,n,Re(t.g)),!0)}),hr,Un),Er=sr((function(t,e,n){return 0===t.i&&(ur(e,n,!1===(t=Re(t.g))?void 0:t),!0)}),hr,Un),Ir=ar((function(t,e,n){return 2===t.i&&(t=nn(t),Ae(e,Q(e),n,!1).push(t),!0)}),(function(t,e,n){if(null!=(e=or(Qt,e)))for(let s=0;s<e.length;s++){var r=t,i=n,o=e[s];null!=o&&Tn(r,i,u(o))}}),Bn),Tr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,""===(t=nn(t))?void 0:t),!0)}),fr,Bn),xr=sr((function(t,e,n){return 2===t.i&&(ur(e,n,nn(t)),!0)}),fr,Bn),Pr=function(t,e,n=Pn){return new Vn(t,e,n)}((function(t,e,n,r,i){return 2===t.i&&(r=se(void 0,r,!0),Ae(e,Q(e),n,!0).push(r),en(t,r,i),!0)}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)dr(t,e[o],n,r,i)})),Ur=jn((function(t,e,n,r,i,o){return 2===t.i&&(Te(e,Q(e),o,n),en(t,e=Pe(e,r,n),i),!0)}),dr),Br=sr((function(t,e,n){return 2===t.i&&(ur(e,n,rn(t)),!0)}),gr,kn),Or=sr((function(t,e,n){return 0===t.i&&(ur(e,n,0===(t=We(t.g)>>>0)?void 0:t),!0)}),(function(t,e,n){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ct(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(An(t,n,0),vn(t.g,e))}),xn()),Lr=sr((function(t,e,n){return 0===t.i&&(ur(e,n,We(t.g)),!0)}),(function(t,e,n){null!=(e=Rt(e))&&(e=parseInt(e,10),An(t,n,0),wn(t.g,e))}),Fn);class Nr{constructor(t,e){this.i=t,this.g=e,this.j=Ne,this.defaultValue=void 0}}function kr(t,e){return(n,r)=>{if(sn.length){const t=sn.pop();t.o(r),Je(t.g,n,r),n=t}else n=new class{constructor(t,e){if(Qe.length){const n=Qe.pop();Je(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,Je(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;Qn(e)(o,n);var i=r}finally{n.g.clear(),n.m=-1,n.i=-1,sn.length<100&&sn.push(n)}return i}}var Fr=[0,Tr,sr((function(t,e,n){return 2===t.i&&(ur(e,n,(t=rn(t))===F()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof ln){const r=e.O;return void(r&&(e=r(e),null!=e&&Tn(t,n,$e(e).buffer)))}if(Array.isArray(e))return}gr(t,e,n)}),kn)];let Vr,jr=globalThis.trustedTypes;function Cr(t){void 0===Vr&&(Vr=function(){let t=null;if(!jr)return t;try{const e=t=>t;t=jr.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}());var e=Vr;return new class{constructor(t){this.g=t}toString(){return this.g+""}}(e?e.createScriptURL(t):t)}function Mr(t,...e){if(0===e.length)return Cr(t[0]);let n=t[0];for(let r=0;r<e.length;r++)n+=encodeURIComponent(e[r])+t[r+1];return Cr(n)}var Gr=[0,wr,Lr,Ar,-1,_r,Lr,-1],Dr=class extends ln{constructor(t){super(t)}},$r=[0,Ar,xr,Ar,Lr,-1,ar((function(t,e,n){return(0===t.i||2===t.i)&&(e=Ae(e,Q(e),n,!1,!1),2==t.i?on(t,qe,e):e.push(We(t.g)),!0)}),(function(t,e,n){if(null!=(e=or(Rt,e))&&e.length){n=En(t,n);for(let n=0;n<e.length;n++)wn(t.g,e[n]);In(t,n)}}),Fn),xr,-1,[0,Ar,-1],Lr,Ar,-1],zr=[0,xr,-2],Rr=class extends ln{constructor(t){super(t)}},Wr=[0],Hr=[0,wr,Ar,1,Ar,-3],qr=class extends ln{constructor(t){super(t,2)}},Jr={};Jr[336783863]=[0,xr,Ar,-1,wr,[0,[1,2,3,4,5,6,7,8],Ur,Wr,Ur,$r,Ur,zr,Ur,Hr,Ur,Gr,Ur,[0,xr,-2],Ur,[0,xr,Lr],Ur,[0,Lr,xr]],[0,xr],Ar,[0,[1,3],[2,4],Ur,[0,_r],-1,Ur,[0,Ir],-1,Pr,[0,xr,-1]],xr];var Kr=[0,br,-1,Er,-3,br,_r,Tr,Sr,br,-1,Er,Sr,Er,-2,Tr];function Xr(t){Ce(t,3,"TEXT:text_in")}var Yr=class extends ln{constructor(t){super(t,500)}o(t){return Ne(this,0,7,t)}},Qr=[-1,{}],Zr=[0,xr,1,Qr],ti=[0,xr,Ir,Qr];function ei(t){Ce(t,10,"text_in")}var ni,ri=class extends ln{constructor(t){super(t,500)}o(t){return Ne(this,0,1001,t)}};ri.prototype.g=(ni=[-500,Pr,[-500,Tr,-1,Ir,-3,[-2,Jr,Ar],Pr,Fr,Sr,-1,Zr,ti,Pr,[0,Tr,Er],Tr,Kr,Sr,Ir,987,Ir],4,Pr,[-500,xr,-1,[-1,{}],998,xr],Pr,[-500,xr,Ir,-1,[-2,{},Ar],997,Ir,-1],Sr,Pr,[-500,xr,Ir,Qr,998,Ir],Ir,Sr,Zr,ti,Pr,[0,Tr,-1,Qr],Ir,-2,Kr,Tr,-1,Er,[0,Er,Or],978,Qr,Pr,Fr],function(){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}}}};rr(this.l,t,qn(Dn,tr,er,ni)),Sn(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 ii=class extends ln{constructor(t){super(t)}},oi=class extends ln{constructor(t){super(t)}g(){return Le(this,ii)}},si=class extends ln{constructor(t){super(t)}},ai=kr(class extends ln{constructor(t){super(t)}},[0,Pr,[0,1,wr,xr,[0,Pr,[0,wr,pr,xr,-1]]],yr]),ui=class extends ln{constructor(t){super(t)}},ci=class extends ln{constructor(t){super(t)}I(){const t=me(this);return null==t?F():t}},li=class extends ln{constructor(t){super(t)}},hi=[1,2],fi=kr(class extends ln{constructor(t){super(t)}},[0,Pr,[0,hi,Ur,[0,mr],Ur,[0,Br],wr,xr],yr]),di=class extends ln{constructor(t){super(t)}},gi=class extends ln{constructor(t){super(t)}},pi=[0,Ar,-1],mi=class extends ln{constructor(t){super(t)}},yi=[1,2,3,4,5],bi=class extends ln{constructor(t){super(t)}g(){return null!=me(this)}i(){return null!=Qt(fe(this,2))}},vi=class extends ln{constructor(t){super(t)}},wi=[0,[0,Br,xr,[0,wr,yr,-1],[0,vr,yr]],Ar,[0,yi,Ur,Hr,Ur,$r,Ur,Gr,Ur,Wr,Ur,zr],Lr],_i=class extends ln{constructor(t){super(t)}},Si=new Nr(462704549,_i);Jr[462704549]=[0,wi,[0,xr,wr,pr,Ir,-1]];var Ai=class extends ln{constructor(t){super(t)}},Ei=new Nr(477589892,Ai);function Ii(t,e){if(e=e?ce(e):new di,void 0!==t.displayNamesLocale?ge(e,1,Yt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&ge(e,1),void 0!==t.maxResults){var n=t.maxResults;if(null!=n){if("number"!=typeof n)throw $();if(!Ct(n))throw $();n|=0}ge(e,2,n)}else"maxResults"in t&&ge(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}`);ge(e,3,n)}else"scoreThreshold"in t&&ge(e,3);return void 0!==t.categoryAllowlist?_e(e,4,t.categoryAllowlist):"categoryAllowlist"in t&&ge(e,4),void 0!==t.categoryDenylist?_e(e,5,t.categoryDenylist):"categoryDenylist"in t&&ge(e,5),e}function Ti(t){const e={classifications:Le(t,si).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=Rt(fe(t,1))??0??-1;const n=t.l;let r=Q(n);const i=de(n,r,2),o=Gt(i);return null!=o&&o!==i&&pe(n,r,2,o),{index:e,score:o??0??0,categoryName:Qt(fe(t,3))??""??"",displayName:Qt(fe(t,4))??""??""}})),headIndex:e,headName:n}}(Be(t,oi,4)?.g()??[],Rt(fe(t,2))??0,Qt(fe(t,3))??"")))};return null!=Jt(fe(t,2))&&(e.timestampMs=Jt(fe(t,2))??0),e}function xi(t){return Array.from(t,(t=>t>127?t-256:t))}function Pi(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 Ui;Jr[477589892]=[0,wi,pi];const Bi=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 Oi(){if(void 0===Ui)try{await WebAssembly.instantiate(Bi),Ui=!0}catch{Ui=!1}return Ui}async function Li(t,e=Mr``){const n=await Oi()?"wasm_internal":"wasm_nosimd_internal";return{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}}var Ni=class{};function ki(){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 Fi(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())}Ni.forVisionTasks=function(t){return Li("vision",t)},Ni.forTextTasks=function(t){return Li("text",t)},Ni.forGenAiExperimentalTasks=function(t){return Li("genai_experimental",t)},Ni.forGenAiTasks=function(t){return Li("genai",t)},Ni.forAudioTasks=function(t){return Li("audio",t)},Ni.isSimdSupported=function(){return Oi()};function Vi(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 ji(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 Ci(t,e,n){t.h.simpleListeners=t.h.simpleListeners||{},t.h.simpleListeners[e]=n}function Mi(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 Gi=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:ki()?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?'),Vi(this,r||"input_audio",(r=>{Vi(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),Vi(this,r,(t=>{this.h._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){Vi(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){Vi(this,e,(e=>{this.h._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){Vi(this,e,(e=>{this.h._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){Vi(this,e,(e=>{this.h._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){Vi(this,e,(e=>{this.h._addIntToInputStream(t,e,n)}))}addUintToStream(t,e,n){Vi(this,e,(e=>{this.h._addUintToInputStream(t,e,n)}))}addStringToStream(t,e,n){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){Vi(this,e,(e=>{ji(this,Object.keys(t),(r=>{ji(this,Object.values(t),(i=>{this.h._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){Vi(this,n,(n=>{Vi(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){Vi(this,t,(t=>{this.h._addEmptyPacketToInputStream(t,e)}))}addBoolVectorToStream(t,e,n){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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)Vi(this,e,(t=>{this.h._addStringVectorEntry(r,t)}));this.h._addStringVectorToInputStream(r,e,n)}))}addBoolToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addIntToInputSidePacket(t,e)}))}addUintToInputSidePacket(t,e){Vi(this,e,(e=>{this.h._addUintToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){Vi(this,e,(e=>{Vi(this,t,(t=>{this.h._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){Vi(this,n,(n=>{Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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){Vi(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)Vi(this,e,(t=>{this.h._addStringVectorEntry(n,t)}));this.h._addStringVectorToInputSidePacket(n,e)}))}attachBoolListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachBoolListener(t)}))}attachBoolVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachBoolVectorListener(t)}))}attachIntListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachIntListener(t)}))}attachIntVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachIntVectorListener(t)}))}attachUintListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachUintListener(t)}))}attachUintVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachUintVectorListener(t)}))}attachDoubleListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachFloatListener(t)}))}attachFloatVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachFloatVectorListener(t)}))}attachStringListener(t,e){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachStringListener(t)}))}attachStringVectorListener(t,e){Mi(this,t,e),Vi(this,t,(t=>{this.h._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){Ci(this,t,e),Vi(this,t,(t=>{this.h._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){Mi(this,t,e),Vi(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?'),Ci(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),Vi(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 Di=class extends Gi{};async function $i(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Fi(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Fi(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 zi(t,e,n){return $i(t,e,n)}function Ri(t,e){const n=Be(t.baseOptions,bi,1)||new bi;"string"==typeof e?(ge(n,2,Yt(e)),ge(n,1)):e instanceof Uint8Array&&(ge(n,1,ct(e,!1)),ge(n,2)),Ne(t.baseOptions,0,1,n)}function Wi(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Be(t.baseOptions,bi,1)?.g()||Be(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=Be(t.baseOptions,mi,3);if(!n){var r=n=new mi;ke(r,4,new Rr)}"delegate"in e&&("GPU"===e.delegate?ke(e=n,2,r=new Dr):ke(e=n,4,r=new Rr)),Ne(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),Ri(t,"/model.dat"),t.v()}));if(n.modelAssetBuffer instanceof Uint8Array)Ri(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=>{Ri(t,e),t.v()}));return t.v(),Promise.resolve()}function Hi(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 qi(t,e){t.j=Math.max(t.j,e)}var Ji=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),Hi(this)}finishProcessing(){this.g.finishProcessing(),Hi(this)}close(){this.g.closeGraph()}};Ji.prototype.close=Ji.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",Ji);var Ki=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={languages:[]},Ne(t=this.i=new _i,0,1,e=new vi)}o(t){return Ne(this.i,0,2,Ii(t,Be(this.i,di,2))),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"classifications_out");const e=new qr;cn(e,Si,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),Ce(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),je(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{if(({classifications:t}=Ti(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}))),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Ki.prototype.detect=Ki.prototype.K,Ki.prototype.setOptions=Ki.prototype.o,Ki.createFromModelPath=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetPath:e}})},Ki.createFromModelBuffer=function(t,e){return zi(Ki,t,{baseOptions:{modelAssetBuffer:e}})},Ki.createFromOptions=function(t,e){return zi(Ki,t,e)};var Xi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={classifications:[]},Ne(t=this.i=new _i,0,1,e=new vi)}o(t){return Ne(this.i,0,2,Ii(t,Be(this.i,di,2))),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"classifications_out");const e=new qr;cn(e,Si,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_classifier.TextClassifierGraph")),Xr(n),Ce(n,4,"CLASSIFICATIONS:classifications_out"),n.o(e),je(t,n),this.g.attachProtoListener("classifications_out",((t,e)=>{this.u=Ti(ai(t)),qi(this,e)})),this.g.attachEmptyPacketListener("classifications_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Xi.prototype.classify=Xi.prototype.J,Xi.prototype.setOptions=Xi.prototype.o,Xi.createFromModelPath=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetPath:e}})},Xi.createFromModelBuffer=function(t,e){return zi(Xi,t,{baseOptions:{modelAssetBuffer:e}})},Xi.createFromOptions=function(t,e){return zi(Xi,t,e)};var Yi=class extends Ji{constructor(t,e){super(new Di(t,e)),this.u={embeddings:[]},Ne(t=this.i=new Ai,0,1,e=new vi)}o(t){var e=this.i,n=Be(this.i,gi,2);return n=n?ce(n):new gi,void 0!==t.l2Normalize?ge(n,1,Dt(t.l2Normalize)):"l2Normalize"in t&&ge(n,1),void 0!==t.quantize?ge(n,2,Dt(t.quantize)):"quantize"in t&&ge(n,2),Ne(e,0,2,n),Wi(this,t)}get baseOptions(){return Be(this.i,vi,1)}set baseOptions(t){Ne(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 ri;ei(t),Ce(t,15,"embeddings_out");const e=new qr;cn(e,Ei,this.i);const n=new Yr;Se(n,Yt("mediapipe.tasks.text.text_embedder.TextEmbedderGraph")),Xr(n),Ce(n,4,"EMBEDDINGS:embeddings_out"),n.o(e),je(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=fi(t),this.u=function(t){return{embeddings:Le(t,li).map((t=>{const e={headIndex:Rt(fe(t,3))??0??-1,headName:Qt(fe(t,4))??""??""};if(void 0!==Ue(t,ui,Ee(t,1)))e.floatEmbedding=ye(Be(t,ui,Ee(t,1)),1,Gt,void 0===gt?2:4).slice();else{const n=new Uint8Array(0);e.quantizedEmbedding=Be(t,ci,Ee(t,2))?.I()?.i()??n}return e})),timestampMs:Jt(fe(t,2))??0}}(t),qi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{qi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};Yi.cosineSimilarity=function(t,e){if(t.floatEmbedding&&e.floatEmbedding)t=Pi(t.floatEmbedding,e.floatEmbedding);else{if(!t.quantizedEmbedding||!e.quantizedEmbedding)throw Error("Cannot compute cosine similarity between quantized and float embeddings.");t=Pi(xi(t.quantizedEmbedding),xi(e.quantizedEmbedding))}return t},Yi.prototype.embed=Yi.prototype.L,Yi.prototype.setOptions=Yi.prototype.o,Yi.createFromModelPath=function(t,e){return zi(Yi,t,{baseOptions:{modelAssetPath:e}})},Yi.createFromModelBuffer=function(t,e){return zi(Yi,t,{baseOptions:{modelAssetBuffer:e}})},Yi.createFromOptions=function(t,e){return zi(Yi,t,e)},exports.FilesetResolver=Ni,exports.LanguageDetector=Ki,exports.TextClassifier=Xi,exports.TextEmbedder=Yi;
|
|
2
2
|
//# sourceMappingURL=text_bundle_cjs.js.map
|