@mediapipe/tasks-audio 1.2.0 → 1.2.1-rc.20261031
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/LICENSE +218 -0
- package/NOTICE +26949 -0
- package/README.md +29 -7
- package/audio.d.ts +7 -19
- package/audio_bundle.cjs +1 -1
- package/audio_bundle.cjs.map +1 -1
- package/audio_bundle.js +1 -1
- package/audio_bundle.js.map +1 -0
- package/audio_bundle.mjs +1 -1
- package/audio_bundle.mjs.map +1 -1
- package/package.json +1 -3
- package/wasm/audio_wasm_internal.js +17 -2
- package/wasm/audio_wasm_internal.wasm +0 -0
- package/wasm/audio_wasm_module_internal.js +17 -2
- package/wasm/audio_wasm_module_internal.wasm +0 -0
- package/wasm/audio_wasm_nosimd_internal.js +0 -9044
- package/wasm/audio_wasm_nosimd_internal.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# MediaPipe Tasks
|
|
1
|
+
# MediaPipe Tasks Audio Package
|
|
2
2
|
|
|
3
3
|
This package contains the audio tasks for MediaPipe.
|
|
4
4
|
|
|
@@ -11,27 +11,49 @@ const audio = await FilesetResolver.forAudioTasks(
|
|
|
11
11
|
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio/wasm"
|
|
12
12
|
);
|
|
13
13
|
const audioClassifier = await AudioClassifier.createFromModelPath(audio,
|
|
14
|
-
"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite
|
|
14
|
+
"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite"
|
|
15
15
|
);
|
|
16
16
|
const classifications = audioClassifier.classify(audioData);
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
For more information, refer to the [Audio Classifier](https://developers.google.com/mediapipe/solutions/audio/audio_classifier/web_js) documentation.
|
|
20
20
|
|
|
21
|
-
## Audio
|
|
21
|
+
## Audio Transcriber
|
|
22
22
|
|
|
23
|
-
The MediaPipe Audio
|
|
23
|
+
The MediaPipe Audio Transcriber task transcribes speech in audio data into
|
|
24
|
+
text, either as a complete audio clip or as a continuous stream.
|
|
24
25
|
|
|
25
26
|
```
|
|
26
27
|
const audio = await FilesetResolver.forAudioTasks(
|
|
27
28
|
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio/wasm"
|
|
28
29
|
);
|
|
29
|
-
const
|
|
30
|
-
"https://
|
|
30
|
+
const audioTranscriber = await AudioTranscriber.createFromModelPath(audio,
|
|
31
|
+
"https://huggingface.co/litert-community/parakeet-tdt-0.6b-v3/resolve/main/parakeet_tdt_0.6b_v3_5s_i8_stateful.litertlm"
|
|
31
32
|
);
|
|
32
|
-
const
|
|
33
|
+
const result = await audioTranscriber.transcribe(audioSamples);
|
|
34
|
+
console.log(result.text);
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
For more information, refer to the [Audio Transcriber](https://developers.google.com/mediapipe/solutions/audio/audio_transcriber) documentation.
|
|
38
|
+
|
|
39
|
+
## Text-to-Speech
|
|
40
|
+
|
|
41
|
+
The MediaPipe Text-to-Speech task synthesizes natural-sounding speech audio
|
|
42
|
+
from text.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
const audio = await FilesetResolver.forAudioTasks(
|
|
46
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio/wasm"
|
|
47
|
+
);
|
|
48
|
+
const textToSpeech = await TextToSpeech.createFromModelPath(audio,
|
|
49
|
+
"https://huggingface.co/litert-community/Kokoro-82M/resolve/main/kokoro_int8_gpu_fp16.litertlm"
|
|
50
|
+
);
|
|
51
|
+
const result = await textToSpeech.synthesize("Hello from MediaPipe!");
|
|
52
|
+
// result.samples contains 24 kHz mono audio as a Float32Array.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For more information, refer to the [Text-to-Speech](https://developers.google.com/mediapipe/solutions/audio/text_to_speech) documentation.
|
|
56
|
+
|
|
35
57
|
### Privacy Notice
|
|
36
58
|
|
|
37
59
|
Last modified: June 5, 2026
|
package/audio.d.ts
CHANGED
|
@@ -210,8 +210,10 @@ export declare interface AudioTranscriberOptions extends TaskRunnerOptions {
|
|
|
210
210
|
cacheDir?: string;
|
|
211
211
|
/**
|
|
212
212
|
* Optional byte length of `baseOptions.modelAssetBuffer` when provided as a
|
|
213
|
-
* `ReadableStreamDefaultReader
|
|
214
|
-
*
|
|
213
|
+
* `ReadableStreamDefaultReader`.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Unused: the model is always written to the Wasm virtual
|
|
216
|
+
* filesystem, which the native AudioTranscriber requires.
|
|
215
217
|
*/
|
|
216
218
|
modelAssetSize?: number;
|
|
217
219
|
}
|
|
@@ -357,25 +359,11 @@ declare interface ClassifierOptions {
|
|
|
357
359
|
/**
|
|
358
360
|
* Resolves the files required for the MediaPipe Task APIs.
|
|
359
361
|
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* possible, you can invoke the MediaPipe Tasks APIs using a manually created
|
|
364
|
-
* `WasmFileset`.
|
|
362
|
+
* The returned filesets require that the Wasm files are published without
|
|
363
|
+
* renaming. If this is not possible, you can invoke the MediaPipe Tasks APIs
|
|
364
|
+
* using a manually created `WasmFileset`.
|
|
365
365
|
*/
|
|
366
366
|
export declare class FilesetResolver {
|
|
367
|
-
/**
|
|
368
|
-
* Returns whether SIMD is supported in the current environment.
|
|
369
|
-
*
|
|
370
|
-
* If your environment requires custom locations for the MediaPipe Wasm files,
|
|
371
|
-
* you can use `isSimdSupported()` to decide whether to load the SIMD-based
|
|
372
|
-
* assets. Note that for ES6 Modules, SIMD is assumed to be always supported.
|
|
373
|
-
*
|
|
374
|
-
* @param useModule Whether to use ES6 Modules for the Wasm files.
|
|
375
|
-
* @export
|
|
376
|
-
* @return Whether SIMD support was detected in the current environment.
|
|
377
|
-
*/
|
|
378
|
-
static isSimdSupported(useModule?: boolean): Promise<boolean>;
|
|
379
367
|
/**
|
|
380
368
|
* Creates a fileset for the MediaPipe Audio tasks.
|
|
381
369
|
*
|
package/audio_bundle.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t="undefined"!=typeof self?self:{};function e(e,r){t:{for(var i=["CLOSURE_FLAGS"],n=t,o=0;o<i.length;o++)if(null==(n=n[i[o]])){i=null;break t}i=n}return null!=(e=i&&i[e])?e:r}function r(){throw Error("Invalid UTF8")}function i(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}var n,o,a=void 0,s="undefined"!=typeof TextDecoder,u="undefined"!=typeof TextEncoder;function h(t){if(u)t=(o||=new TextEncoder).encode(t);else{let r=0,i=new Uint8Array(3*t.length);for(let n=0;n<t.length;n++){var e=t.charCodeAt(n);if(e<128)i[r++]=e;else{if(e<2048)i[r++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&n<t.length){let o=t.charCodeAt(++n);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,i[r++]=e>>18|240,i[r++]=e>>12&63|128,i[r++]=e>>6&63|128,i[r++]=63&e|128;continue}n--}e=65533}i[r++]=e>>12|224,i[r++]=e>>6&63|128}i[r++]=63&e|128}}t=r===i.length?i:i.subarray(0,r)}return t}var l=e(610401301,!1),c=e(748402147,!0);function f(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}var d,p=t.navigator;function v(t){return v[" "](t),t}d=p&&p.userAgentData||null,v[" "]=function(){};var m={},g=null;function y(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var i=new Uint8Array(r),n=0;return function(t,e){function r(e){for(;i<t.length;){let e=t.charAt(i++),r=g[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}b();for(var i=0;;){let t=r(-1),i=r(0),n=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|i>>4),64!=n&&(e(i<<4&240|n>>2),64!=o&&e(n<<6&192|o))}}(t,function(t){i[n++]=t}),n!==r?i.subarray(0,n):i}function b(){if(!g){g={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let i=t.concat(e[r].split(""));m[r]=i;for(let t=0;t<i.length;t++){let e=i[t];void 0===g[e]&&(g[e]=t)}}}}var w="undefined"!=typeof Uint8Array,S=!(!(!!l&&(!!d&&d.brands.length>0))&&(-1!=f().indexOf("Trident")||-1!=f().indexOf("MSIE")))&&"function"==typeof btoa,A=/[-_.]/g,T={"-":"+",_:"/",".":"="};function _(t){return T[t]||""}function I(t){if(!S)return y(t);t=A.test(t)?t.replace(A,_):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var E={};function j(){return x||=new P(null,E)}function B(t){U(E);var e=t.h;return null==(e=null==e||w&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?I(e):null)?e:t.h=e}var x,P=class{constructor(t,e){if(U(e),this.h=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function U(t){if(t!==E)throw Error("illegal external caller")}function L(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var O=void 0;function k(t){return L(t=Error(t),"warning"),t}function N(e,r){if(null!=e){var i=O??={},n=i[e]||0;n>=r||(i[e]=n+1,L(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}function F(){return"function"==typeof BigInt}var D="function"==typeof Symbol&&"symbol"==typeof Symbol();function V(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var M,R=V("jas",void 0,!0),G=V(void 0,"1oa"),z=V(void 0,Symbol()),C=V(void 0,"0ubs"),W=V(void 0,"0ubsb"),H=V(void 0,"0actk"),$=V("m_m","za",!0),K={ka:{value:0,configurable:!0,writable:!0,enumerable:!1}},q=Object.defineProperties,J=D?R:"ka",Y=[];function X(t,e){D||J in t||q(t,K),t[J]|=e}function Z(t,e){D||J in t||q(t,K),t[J]=e}Z(Y,7),M=Object.freeze(Y);var Q={};function tt(t,e){return void 0===e?t.h!==et&&!!(2&t.o[J]):!!(2&e)&&t.h!==et}var et={};function rt(t,e){if(null!=t)if("string"==typeof t)t=t?new P(t,E):j();else if(t.constructor!==P)if(w&&null!=t&&t instanceof Uint8Array)t=t.length?new P(new Uint8Array(t),E):j();else{if(!e)throw Error();t=void 0}return t}function it(t,e,r){var i,n=128&e?0:-1,o=t.length;(i=!!o)&&(i=null!=(i=t[o-1])&&"object"==typeof i&&i.constructor===Object);var a=o+(i?-1:0);for(e=128&e?1:0;e<a;e++)r(e-n,t[e]);if(i){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}Object.freeze({});var nt={};function ot(t){return 128&t?nt:void 0}function at(t){return t.xa=!0,t}var st=at(t=>"number"==typeof t),ut=at(t=>"string"==typeof t),ht=at(t=>"boolean"==typeof t),lt="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function ct(t){var e=t;if(ut(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(st(e)&&!Number.isSafeInteger(e))throw Error(String(e));return lt?BigInt(t):t=ht(t)?t?"1":"0":ut(t)?t.trim()||"0":String(t)}var ft=at(t=>lt?t>=pt&&t<=mt:"-"===t[0]?gt(t,dt):gt(t,vt)),dt=Number.MIN_SAFE_INTEGER.toString(),pt=lt?BigInt(Number.MIN_SAFE_INTEGER):void 0,vt=Number.MAX_SAFE_INTEGER.toString(),mt=lt?BigInt(Number.MAX_SAFE_INTEGER):void 0;function gt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let i=t[r],n=e[r];if(i>n)return!1;if(i<n)return!0}}var yt,bt="function"==typeof Uint8Array.prototype.slice,wt=0,St=0;function At(t){var e=t>>>0;wt=e,St=(t-e)/4294967296>>>0}function Tt(t){if(t<0){At(-t);let[e,r]=Ut(wt,St);wt=e>>>0,St=r>>>0}else At(t)}function _t(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:jt(t,e)}function It(t,e){return ct(F()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):jt(t,e))}function Et(t,e){return F()?ct(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):ct(xt(t,e))}function jt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else F()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+Bt(r)+Bt(t));return r}function Bt(t){return t=String(t),"0000000".slice(t.length)+t}function xt(t,e){if(2147483648&e)if(F())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,i]=Ut(t,e);t="-"+jt(r,i)}else t=jt(t,e);return t}function Pt(t){if(t.length<16)Tt(Number(t));else if(F())t=BigInt(t),wt=Number(t&BigInt(4294967295))>>>0,St=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);St=wt=0;let r=t.length;for(let i=e,n=(r-e)%6+e;n<=r;i=n,n+=6){let e=Number(t.slice(i,n));St*=1e6,(wt=1e6*wt+e)>=4294967296&&(St+=Math.trunc(wt/4294967296),St>>>=0,wt>>>=0)}if(e){let[t,e]=Ut(wt,St);wt=t,St=e}}}function Ut(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function Lt(t){return Array.prototype.slice.call(t)}var Ot="function"==typeof BigInt?BigInt.asIntN:void 0,kt="function"==typeof BigInt?BigInt.asUintN:void 0,Nt=Number.isSafeInteger,Ft=Number.isFinite,Dt=Math.trunc;function Vt(t){return null==t||"number"==typeof t?t:"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}var Mt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Rt(t){switch(typeof t){case"bigint":return!0;case"number":return Ft(t);case"string":return Mt.test(t);default:return!1}}function Gt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ft(t)?0|t:void 0}function zt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(Pt(t),xt(wt,St))}function Ct(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(Pt(t),jt(wt,St))}function Wt(t){if(t=Dt(t),!Nt(t)){Tt(t);var e=wt,r=St;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=_t(e,r))?t?-e:e:t?"-"+e:e}return t}function Ht(t){return t=Dt(t),Nt(t)?t=String(t):(Tt(t),t=xt(wt,St)),t}function $t(t){var e=Dt(Number(t));return Nt(e)?String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),zt(t))}function Kt(t){var e=Dt(Number(t));return Nt(e)?ct(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),F()?ct(Ot(64,BigInt(t))):ct(zt(t)))}function qt(t){var e=typeof t;return null==t?t:"bigint"===e?ct(Ot(64,t)):Rt(t)?"string"===e?Kt(t):ct(Nt(t)?t:Ht(t)):void 0}function Jt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(Ot(64,t));if(Rt(t)){if("string"===e)return $t(t);if("number"===e)return Wt(t)}}function Yt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(kt(64,t));if(Rt(t)){if("string"===e)return e=Dt(Number(t)),Nt(e)&&e>=0?t=String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=Ct(t)),t;if("number"===e)return function(t){return(t=Dt(t))>=0&&Nt(t)||(Tt(t),t=_t(wt,St)),t}(t)}}function Xt(t){if(null==t||"string"==typeof t||t instanceof P)return t}function Zt(t){if("string"!=typeof t)throw Error();return t}function Qt(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function te(t){return null==t||"string"==typeof t?t:void 0}function ee(t,e,r){if(null!=t&&t[$]===Q)return t;if(Array.isArray(t)){var i=0|t[J];return(r=i|32&r|2&r)!==i&&Z(t,r),new e(t)}}function re(t){return t}function ie(t){return z?t[z]:void 0}function ne(t,e){for(let r in t)!isNaN(r)&&e(t,+r,t[r])}var oe,ae,se,ue=class{};function he(t,e){e<100||N(C,1)}function le(t,e,r,i){var n=void 0!==i;i=!!i;var o,a=z;!n&&D&&a&&(o=t[a])&&ne(o,he),a=[];var s=t.length;o=4294967295;var u=!1,h=!!(64&e),l=h?128&e?0:-1:void 0;if(!(1&e)){var c=s&&t[s-1];null!=c&&"object"==typeof c&&c.constructor===Object?o=--s:c=void 0,!h||128&e||n||(u=!0,o=(oe??re)(o-l,l,t,c,void 0)+l)}e=void 0;for(var f=0;f<s;f++){let n=t[f];if(null!=n&&null!=(n=r(n,i)))if(h&&f>=o){let t=f-l;(e??={})[t]=n}else a[f]=n}if(c)for(let t in c){if(null==(s=c[t])||null==(s=r(s,i)))continue;let n;f=+t,h&&!Number.isNaN(f)&&(n=f+l)<o?a[n]=s:(e??={})[t]=s}return e&&(u?a.push(e):a[o]=e),n&&z&&(t=ie(t))&&t instanceof ue&&(a[z]=function(t){var e=new ue;return ne(t,(t,r,i)=>{e[r]=Lt(i)}),e.h=t.h,e}(t)),a}function ce(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return ft(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[J];return 0===t.length&&1&e?void 0:le(t,e,ce)}if(null!=t&&t[$]===Q)return fe(t);if(t instanceof P){if(null==(e=t.h))t="";else if("string"==typeof e)t=e;else{if(S){for(var r="",i=0,n=e.length-10240;i<n;)r+=String.fromCharCode.apply(null,e.subarray(i,i+=10240));r+=String.fromCharCode.apply(null,i?e.subarray(i):e),e=btoa(r)}else{void 0===r&&(r=0),b(),r=m[r],i=Array(Math.floor(e.length/3)),n=r[64]||"";let t=0,h=0;for(;t<e.length-2;t+=3){var o=e[t],a=e[t+1],s=e[t+2],u=r[o>>2];o=r[(3&o)<<4|a>>4],a=r[(15&a)<<2|s>>6],s=r[63&s],i[h++]=u+o+a+s}switch(u=0,s=n,e.length-t){case 2:s=r[(15&(u=e[t+1]))<<2]||n;case 1:e=e[t],i[h]=r[e>>2]+r[(3&e)<<4|u>>4]+s+n}e=i.join("")}t=t.h=e}return t}return}return t}function fe(t){return le(t=t.o,0|t[J],ce)}function de(t,e){return pe(t,e[0],e[1])}function pe(t,e,r,i=0){if(null==t){var n=32;r?(t=[r],n|=128):t=[],e&&(n=-16760833&n|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(n=0|t[J],c&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(c)throw Error("carr");N(H,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&Z(t,n|i),t;if(r&&(n|=128,r!==t[0]))throw Error("mid");t:{n|=64;var o=(r=t).length;if(o){var a=o-1;let t=r[a];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((a-=e=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var s in t)(o=+s)<a&&(r[o+e]=t[s],delete t[s]);n=-16760833&n|(1023&a)<<14;break t}}if(e){if((s=Math.max(e,o-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&s)<<14}}}return Z(t,64|n|i),t}function ve(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[J];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=ge(t,r,!1,e&&!(16&r)):(X(t,34),4&r&&Object.freeze(t))),t}return null!=t&&t[$]===Q?tt(t,r=0|(e=t.o)[J])?t:Ae(t,e,r)?me(t,e):ge(e,r):t instanceof P?t:void 0}function me(t,e,r){return t=new t.constructor(e),r&&(t.h=et),t.m=et,t}function ge(t,e,r,i){return i??=!!(34&e),t=le(t,e,ve,i),i=32,r&&(i|=2),Z(t,e=16769217&e|i),t}function ye(t){var e=t.o,r=0|e[J];return tt(t,r)?Ae(t,e,r)?me(t,e,!0):new t.constructor(ge(e,r,!1)):t}function be(t){if(t.h!==et)return!1;var e=t.o;return X(e=ge(e,0|e[J]),2048),t.o=e,t.h=void 0,t.m=void 0,!0}function we(t){if(!be(t)&&tt(t,0|t.o[J]))throw Error()}function Se(t,e){void 0===e&&(e=0|t[J]),32&e&&!(4096&e)&&Z(t,4096|e)}function Ae(t,e,r){return!!(2&r)||!(!(32&r)||4096&r)&&(Z(e,2|r),t.h=et,!0)}var Te=ct(0);function _e(t,e,r,i){if(null!==(t=Ie(t.o,e,r,i)))return t}function Ie(t,e,r,i){if(-1===e)return null;var n=e+(r?0:-1),o=t.length-1;if(!(o<1+(r?0:-1))){if(n>=o){var a=t[o];if(null!=a&&"object"==typeof a&&a.constructor===Object){r=a[e];var s=!0}else{if(n!==o)return;r=a}}else r=t[n];if(i&&null!=r){if(null==(i=i(r)))return i;if(!Object.is(i,r))return s?a[e]=i:t[n]=i,i}return r}}function Ee(t,e,r,i){we(t);var n=t.o;return je(n,0|n[J],e,r,i),t}function je(t,e,r,i,n){var o=r+(n?0:-1),a=t.length-1;if(a>=1+(n?0:-1)&&o>=a){let n=t[a];if(null!=n&&"object"==typeof n&&n.constructor===Object)return n[r]=i,e}return o<=a?(t[o]=i,e):(void 0!==i&&(r>=(a=(e??=0|t[J])>>14&1023||536870912)?null!=i&&(t[a+(n?0:-1)]={[r]:i}):t[o]=i),e)}function Be(t,e){return null!=(t=Ie(t.o,e))&&t[$]===Q||Array.isArray(t)}function xe(t,e,r,i,n,o,a,s){var u=e,h=Le(e);return h&&2===o&&(t=Lt(t),u=0,e=Ke(e,i),i=je(r,i,n,t),h=!1),h||(1===o||4===o&&(2&e||!(16&e)&&32&i)?((e|=!t.length||a&&!(4096&e)||32&i&&!(4096&e||16&e)?2:256)!==u&&Z(t,e),Object.freeze(t)):(s||(e|=16),e!==u&&Z(t,e))),2&e||!(4096&e||16&e)||Se(r,i),t}function Pe(t,e,r){return t=Ie(t,e,r),Array.isArray(t)?t:M}function Ue(t,e){return 2&e&&(t|=2),1|t}function Le(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function Oe(t){return rt(t,!0)}function ke(t,e,r){we(t);var i=0|(t=t.o)[J];if(null==r)je(t,i,e);else{var n=r===M?7:0|r[J],o=n,a=Le(n),s=a||Object.isFrozen(r);for(a||(n=0),s||(r=Lt(r),o=0,n=Ke(n,i),s=!1),n|=5,n|=(4&n?512&n?512:1024&n?1024:0:void 0)??1024,a=0;a<r.length;a++){let t=r[a],e=Zt(t);Object.is(t,e)||(s&&(r=Lt(r),o=0,n=Ke(n,i),s=!1),r[a]=e)}n!==o&&(s&&(r=Lt(r),n=Ke(n,i)),Z(r,n)),je(t,i,e,r)}}function Ne(t,e,r){if(2&e)throw Error();var i=ot(e),n=Pe(t,r,i),o=n===M?7:0|n[J],a=Ue(o,e);return(2&a||Le(a)||16&a)&&(a===o||Le(a)||Z(n,a),n=Lt(n),o=0,a=Ke(a,e),je(t,e,r,n,i)),(a&=-13)!==o&&Z(n,a),n}function Fe(t,e){var r=so;return Me(De(t=t.o),t,void 0,r)===e?e:-1}function De(t){if(D)return t[G]??(t[G]=new Map);if(G in t)return t[G];var e=new Map;return Object.defineProperty(t,G,{value:e}),e}function Ve(t,e,r,i,n){var o=De(t),a=Me(o,t,e,r,n);return a!==i&&(a&&(e=je(t,e,a,void 0,n)),o.set(r,i)),e}function Me(t,e,r,i,n){var o=t.get(i);if(null!=o)return o;o=0;for(let t=0;t<i.length;t++){let a=i[t];null!=Ie(e,a,n)&&(0!==o&&(r=je(e,r,o,void 0,n)),o=a)}return t.set(i,o),o}function Re(t,e,r){var i=0|t[J],n=ot(i),o=Ie(t,r,n);if(null!=o&&o[$]===Q){if(!tt(o))return be(o),o.o;var a=o.o}else Array.isArray(o)&&(a=o);if(a){let t=0|a[J];2&t&&(a=ge(a,t))}return(a=de(a,e))!==o&&je(t,i,r,a,n),a}function Ge(t,e,r){var i=t.o,n=0|i[J];if(e=function(t,e,r,i){var n=!1;if(null!=(i=Ie(t,i,void 0,t=>{var i=ee(t,r,e);return n=i!==t&&null!=i,i})))return n&&!tt(i)&&Se(t,e),i}(i,n,e,r),null==e)return e;if(!tt(t,n=0|i[J])){let o=ye(e);o!==e&&(be(t)&&(n=0|(i=t.o)[J]),Se(i,n=je(i,n,r,e=o)))}return e}function ze(t,e,r,i,n,o,a,s){o=o&&4!==o?1!==o&&tt(t,r)?1:o:4,a=!!a||3===o;var u=!!s&&!tt(t,r);(2===o||u)&&be(t)&&(r=0|(e=t.o)[J]);var h=(t=Pe(e,n))===M?7:0|t[J],l=Ue(h,r);if(s=!(4&l)){var c=t,f=r;let e=!!(2&l);e&&(f|=2);let n=!e,o=!0,a=0,s=0;for(;a<c.length;a++){let t=ee(c[a],i,f);if(t instanceof i){if(!e){let e=tt(t);n&&=!e,o&&=e}c[s++]=t}}s<a&&(c.length=s),l|=4,l=o?-4097&l:4096|l,l=n?8|l:-9&l}if(l!==h&&(Z(t,l),2&l&&Object.freeze(t)),u&&!(8&l||!t.length&&(1===o||4===o&&(2&l||!(16&l)&&32&r)))){for(Le(l)&&(t=Lt(t),l=Ke(l,r),r=je(e,r,n,t)),i=t,u=l,h=0;h<i.length;h++)(c=i[h])!==(l=ye(c))&&(i[h]=l);u|=8,Z(t,l=u=i.length?4096|u:-4097&u)}return xe(t,l,e,r,n,o,s,a)}function Ce(t,e){var r=t.o;return ze(t,r,0|r[J],e,1,void 0,!1,!0)}function We(t){return null==t&&(t=void 0),t}function He(t,e,r,i,n){return Ee(t,r,i=We(i),n),i&&!tt(i)&&Se(t.o),t}function $e(t,e,r,i){t:{var n=i=We(i);we(t);let o=t.o,a=0|o[J];if(null==n){let t=De(o);if(Me(t,o,a,r)!==e)break t;t.set(r,0)}else a=Ve(o,a,r,e);je(o,a,e,n)}return i&&!tt(i)&&Se(t.o),t}function Ke(t,e){return-273&(t=2&e?2|t:-3&t)}function qe(t,e,r,i){we(t);var n=t.o;t=ze(t,n,0|n[J],r,e,2,!0),i=null!=i?i:new r,t.push(i),e=r=t===M?7:0|t[J],(i=tt(i))?(r&=-9,1===t.length&&(r&=-4097)):r|=4096,r!==e&&Z(t,r),i||Se(n)}function Je(t,e,r){if(null!=r)t:{if(!Rt(r))throw k("int64");switch(typeof r){case"string":r=Kt(r);break t;case"bigint":r=ct(Ot(64,r));break t;default:r=ct(Nt(r)?r:Ht(r))}}return Ee(t,e,r)}function Ye(t,e,r){return Ee(t,e,null==r?r:function(t){if(!Rt(t))throw k("uint64");switch(typeof t){case"string":var e=Dt(Number(t));return Nt(e)&&e>=0?t=ct(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=F()?ct(kt(64,BigInt(t))):ct(Ct(t))),t;case"bigint":return ct(kt(64,t));default:return t>=0&&Nt(t)||((t=Dt(t))>=0&&Nt(t)?t=String(t):(Tt(t),t=jt(wt,St))),ct(t)}}(r))}function Xe(t,e,r){if(null!=r){if(!Ft(r))throw k("enum");r|=0}return Ee(t,e,r)}function Ze(t,e,r){we(t);var i=t.o,n=0|i[J],o=tt(t,n)?1:2;2===o&&be(t)&&(n=0|(i=t.o)[J]);var a,s=(t=Pe(i,e))===M?7:0|t[J],u=Ue(s,n);if(a=!(4&u)){let e=0,r=0;for(;e<t.length;e++){let i=te(t[e]);null!=i&&(t[r++]=i)}r<e&&(t.length=r),u=-513&u|4,u&=-1025,u&=-4097}u!==s&&(Z(t,u),2&u&&Object.freeze(t)),(t=xe(t,u,i,n,e,o,a,!0)).push(Zt(r))}var Qe=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error();this.h=e}};function tr(t,e){if("string"==typeof t)return new Qe(I(t),e);if(Array.isArray(t))return new Qe(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new Qe(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new Qe(t,!1);if(t.constructor===P)return e=B(t)||new Uint8Array(0),new Qe(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Qe(t,!1);throw Error()}function er(t,e){var r=0,i=0,n=0,o=t.j,a=t.h;do{var s=o[a++];r|=(127&s)<<n,n+=7}while(n<32&&128&s);if(n>32)for(i|=(127&s)>>4,n=3;n<32&&128&s;n+=7)i|=(127&(s=o[a++]))<<n;if(sr(t,a),!(128&s))return e(r>>>0,i>>>0);throw Error()}function rr(t){for(var e=0,r=t.h,i=r+10,n=t.j;r<i;){let i=n[r++];if(e|=i,!(128&i))return sr(t,r),!!(127&e)}throw Error()}function ir(t){var e=t.j,r=t.h,i=e[r++],n=127&i;if(128&i&&(n|=(127&(i=e[r++]))<<7,128&i&&(n|=(127&(i=e[r++]))<<14,128&i&&(n|=(127&(i=e[r++]))<<21,128&i&&(n|=(i=e[r++])<<28,128&i&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++])))))throw Error();return sr(t,r),n}function nr(t){return er(t,Et)}function or(t){var e=t.j,r=t.h,i=e[r],n=e[r+1],o=e[r+2];return e=e[r+3],sr(t,t.h+4),(i|n<<8|o<<16|e<<24)>>>0}function ar(t){return ir(t)}function sr(t,e){if(t.h=e,e>t.l)throw Error()}function ur(t,e){if(e<0)throw Error();var r=t.h;if((e=r+e)>t.l)throw Error();return t.h=e,r}function hr(t,e){if(0==e)return j();var r=ur(t,e);return t.V&&t.A?r=t.j.subarray(r,r+e):(t=t.j,r=r===(e=r+e)?new Uint8Array(0):bt?t.slice(r,e):new Uint8Array(t.subarray(r,e))),0==r.length?j():new P(r,E)}var lr=class{constructor(t,e,r,i){this.j=null,this.A=!1,this.h=this.l=this.m=0,this.init(t,e,r,i)}init(t,e,r,{V:i=!1,Z:n=!1}={}){this.V=i,this.Z=n,t&&(t=tr(t,this.Z),this.j=t.buffer,this.A=t.h,this.m=e||0,this.l=void 0!==r?this.m+r:this.j.length,this.h=this.m)}clear(){this.j=null,this.A=!1,this.h=this.l=this.m=0,this.V=!1}},cr=[],fr=0;function dr(t,e,r,i){if(Tr.length){let n=Tr.pop();return n.C(i),n.h.init(t,e,r,i),n}return new Ar(t,e,r,i)}function pr(t){t.h.clear(),t.l=-1,t.j=-1,Tr.length<100&&Tr.push(t)}function vr(t){var e=t.h;if(e.h==e.l)return!1;t.m=t.h.h;var r=ir(t.h)>>>0;if(e=r>>>3,!((r&=7)>=0&&r<=5))throw Error();if(e<1)throw Error();return t.l=e,t.j=r,!0}function mr(t){try{switch(t.j){case 0:0!=t.j?mr(t):rr(t.h);break;case 1:var e=t.h;sr(e,e.h+8);break;case 2:if(2!=t.j)mr(t);else{var r=ir(t.h)>>>0,i=t.h;sr(i,i.h+r)}break;case 5:var n=t.h;sr(n,n.h+4);break;case 3:gr();let o=t.l;try{for(;;){if(!vr(t))throw Error();if(4==t.j){if(t.l!=o)throw Error();break}mr(t)}}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{fr>0&&fr--}break;default:throw Error()}}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}}function gr(){if(fr>=100)throw new SyntaxError;fr++}function yr(t,e,r){var i=t.h.l,n=ir(t.h)>>>0,o=(n=t.h.h+n)-i;if(o<=0&&(t.h.l=n,r(e,t,void 0,void 0,void 0),o=n-t.h.h),o)throw Error();t.h.h=n,t.h.l=i}function br(t){var e=ir(t.h)>>>0,o=ur(t=t.h,e);if(t=t.j,s){var u,h=t;(u=n)||(u=n=new TextDecoder("utf-8",{fatal:!0})),e=o+e,h=0===o&&e===h.length?h:h.subarray(o,e);try{var l=u.decode(h)}catch(t){if(void 0===a){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),a=!0}catch(t){a=!1}}throw!a&&(n=void 0),t}}else{e=(l=o)+e,o=[];let n,a=null;for(;l<e;){var c=t[l++];c<128?o.push(c):c<224?l>=e?r():(n=t[l++],c<194||128!=(192&n)?(l--,r()):o.push((31&c)<<6|63&n)):c<240?l>=e-1?r():(n=t[l++],128!=(192&n)||224===c&&n<160||237===c&&n>=160||128!=(192&(u=t[l++]))?(l--,r()):o.push((15&c)<<12|(63&n)<<6|63&u)):c<=244?l>=e-2?r():(n=t[l++],128!=(192&n)||n-144+(c<<28)>>30||128!=(192&(u=t[l++]))||128!=(192&(h=t[l++]))?(l--,r()):(c=(7&c)<<18|(63&n)<<12|(63&u)<<6|63&h,c-=65536,o.push(55296+(c>>10&1023),56320+(1023&c)))):r(),o.length>=8192&&(a=i(a,o),o.length=0)}l=i(a,o)}return l}function wr(t){var e=ir(t.h)>>>0;return hr(t.h,e)}function Sr(t,e,r){var i=ir(t.h)>>>0;for(i=t.h.h+i;t.h.h<i;)r.push(e(t.h))}var Ar=class{constructor(t,e,r,i){if(cr.length){let n=cr.pop();n.init(t,e,r,i),t=n}else t=new lr(t,e,r,i);this.h=t,this.m=this.h.h,this.j=this.l=-1,this.C(i)}C({ba:t=!1}={}){this.ba=t}},Tr=[];function _r(t){return new jr(4294967295&t,Math.floor(t/4294967296))}function Ir(t){return t?/^\d+$/.test(t)?(Pt(t),new jr(wt,St)):null:Er||=new jr(0,0)}var Er,jr=class{constructor(t,e){this.j=t>>>0,this.h=e>>>0}};function Br(t){return new Vr(4294967295&t,Math.floor(t/4294967296))}function xr(t){return t?/^-?\d+$/.test(t)?(Pt(t),new Vr(wt,St)):null:Pr||=new Vr(0,0)}var Pr,Ur,Lr,Or,kr,Nr,Fr,Dr,Vr=class{constructor(t,e){this.j=t>>>0,this.h=e>>>0}};function Mr(t,e,r){return"undefined"!=typeof BigInt64Array?(Fr||(Fr=new BigInt64Array(1),Dr=new Uint32Array(Fr.buffer),Fr[0]=BigInt(1),Nr=1===Dr[0]),Fr[0]=t,new e(Dr[t=Nr?0:1],Dr[1-t])):(kr||(Ur=BigInt(Number.MIN_SAFE_INTEGER),Lr=BigInt(Number.MAX_SAFE_INTEGER),Or=BigInt(4294967295),kr=BigInt(32)),t>=Ur&&t<=Lr?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&Or),Number(t>>kr))))}function Rr(t,e,r){for(;r>0||e>127;)t.h.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.h.push(e)}function Gr(t,e){for(;e>127;)t.h.push(127&e|128),e>>>=7;t.h.push(e)}function zr(t,e){if(e>=0)Gr(t,e);else{for(let r=0;r<9;r++)t.h.push(127&e|128),e>>=7;t.h.push(1)}}function Cr(t,e){Pt(e),function(t){var e=St>>31;t(wt<<1^e,(St<<1|wt>>>31)^e)}((e,r)=>{Rr(t,e>>>0,r>>>0)})}function Wr(t,e){t.h.push(e>>>0&255),t.h.push(e>>>8&255),t.h.push(e>>>16&255),t.h.push(e>>>24&255)}var Hr=class{constructor(){this.h=[]}length(){return this.h.length}end(){var t=this.h;return this.h=[],t}};function $r(t,e){0!==e.length&&(t.l.push(e),t.j+=e.length)}function Kr(t,e,r){Gr(t.h,8*e+r)}function qr(t,e){return Kr(t,e,2),e=t.h.end(),$r(t,e),e.push(t.j),e}function Jr(t,e){var r=e.pop();for(r=t.j+t.h.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.j++;e.push(r),t.j++}function Yr(t,e,r){if(null!=r)switch(Kr(t,e,0),typeof r){case"number":t=t.h,Tt(r),Rr(t,wt,St);break;case"bigint":r=Mr(r,Vr,Br),Rr(t.h,r.j,r.h);break;default:r=xr(r),Rr(t.h,r.j,r.h)}}function Xr(t,e,r){Kr(t,e,2),Gr(t.h,r.length),$r(t,t.h.end()),$r(t,r)}var Zr=class{constructor(){this.l=[],this.j=0,this.h=new Hr}};function Qr(t){if("string"==typeof t)xr(t)}function ti(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var ei=ti(),ri=ti(),ii=ti(),ni=ti(),oi=ti(),ai=ti(),si=ti(),ui=ti(),hi=ti(),li=ti(),ci=ti(),fi=ti();var di=class{constructor(t,e){this.o=pe(t,e,void 0,2048)}toJSON(){return fe(this)}};di.prototype[$]=Q,di.prototype.toString=function(){return this.o.toString()};var pi=class{constructor(t,e,r){this.h=t,this.j=e,t=ei,this.l=!!t&&r===t||!1}};function vi(t,e){return new pi(t,e,ei)}function mi(t,e,r,i,n){null!=(e=Bi(e,i))&&(r=qr(t,r),n(e,t),Jr(t,r))}var gi,yi,bi=vi(function(t,e,r,i,n){return 2===t.j&&(yr(t,Re(e,i,r),n),!0)},mi),wi=vi(function(t,e,r,i,n){return 2===t.j&&(yr(t,Re(e,i,r),n),!0)},mi),Si=Symbol(),Ai=Symbol(),Ti=Symbol(),_i=Symbol(),Ii=Symbol();function Ei(t,e,r,i){var n=i[t];if(n)return n;(n={}).fa=i,n.R=function(t){switch(typeof t){case"boolean":return ae||=[0,void 0,!0];case"number":return t>0?void 0:0===t?se||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(i[0]);var o=i[1],a=1;o&&o.constructor===Object&&(n.W=o,"function"==typeof(o=i[++a])&&(n.ca=!0,gi??=o,yi??=i[a+1],o=i[a+=2]));for(var s={};o&&Array.isArray(o)&&o.length&&"number"==typeof o[0]&&o[0]>0;){for(var u=0;u<o.length;u++)s[o[u]]=o;o=i[++a]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=i[++a]);var h=void 0;if(o instanceof pi?t=o:(t=bi,a--),t?.l){o=i[++a],h=i;var l=a;"function"==typeof o&&(o=o(),h[l]=o),h=o}for(l=u+1,"number"==typeof(o=i[++a])&&o<0&&(l-=o,o=i[++a]);u<l;u++){let i=s[u];h?r(n,u,t,h,i):e(n,u,t,i)}}return i[t]=n}function ji(t){return Array.isArray(t)?t[0]instanceof pi?t:[wi,t]:[t,void 0]}function Bi(t,e){return t instanceof di?t.o:Array.isArray(t)?de(t,e):void 0}function xi(t,e,r,i){var n=r.h;t[e]=i?(t,e,r)=>n(t,e,r,i):n}function Pi(t,e,r,i,n){var o,a,s=r.h;t[e]=(t,e,r)=>s(t,e,r,a||=Ei(Ai,xi,Pi,i).R,o||=Ui(i),n)}function Ui(t){var e=t[Ti];if(null!=e)return e;var r=Ei(Ai,xi,Pi,t);return e=r.ca?(t,e)=>gi(t,e,r):(t,e)=>{t:{gr();try{for(;vr(e)&&4!=e.j;){let u=e.l,h=r[u];if(null==h){let t=r.W;if(t){let e=t[u];if(e){let t=Oi(e);null!=t&&(h=r[u]=t)}}}if(null==h||!h(e,t,u)){var i=e;let r=i.m;if(mr(i),i.ba)var n=void 0;else{let t=i.h.h-r;i.h.h=r,n=hr(i.h,t)}i=void 0;var o=t,a=u,s=n;s&&((i=o[z]??(o[z]=new ue))[a]??(i[a]=[])).push(s)}}let h=ie(t);h&&(h.h=r.fa[Ii]);var u=!0;break t}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{fr>0&&fr--}u=void 0}return u},t[Ti]=e,t[Ii]=Li.bind(t),e}function Li(t,e,r,i){var n=this[Ai],o=this[Ti],a=de(void 0,n.R),s=ie(t);if(s){var u=!1,h=n.W;if(h){if(n=(e,r,n)=>{if(0!==n.length)if(h[r])for(let t of n){e=dr(t);try{u=!0,o(a,e)}finally{pr(e)}}else i?.(t,r,n)},null==e)ne(s,n);else if(null!=s){let t=s[e];t&&n(s,e,t)}if(u){let i=0|t[J];if(2&i&&2048&i&&!r?.Ba)throw Error();let n=ot(i),o=(e,o)=>{if(null!=Ie(t,e,n)){if(1===r?.Aa)return;throw Error()}null!=o&&(i=je(t,i,e,o,n)),delete s[e]};null==e?it(a,0|a[J],(t,e)=>{o(t,e)}):o(e,Ie(a,e,n))}}}}function Oi(t){var e=(t=ji(t))[0].h;if(t=t[1]){let r=Ui(t),i=Ei(Ai,xi,Pi,t).R;return(t,n,o)=>e(t,n,o,i,r)}return e}function ki(t,e,r){t[e]=r.j}function Ni(t,e,r,i){var n,o,a=r.j;t[e]=(t,e,r)=>a(t,e,r,o||=Ei(Si,ki,Ni,i).R,n||=Fi(i))}function Fi(t){var e=t[_i];if(!e){let r=Ei(Si,ki,Ni,t);e=(t,e)=>Di(t,e,r),t[_i]=e}return e}function Di(t,e,r){it(t,0|t[J],(t,i)=>{if(null!=i){var n=function(t,e){var r=t[e];if(r)return r;if((r=t.W)&&(r=r[e])){var i=(r=ji(r))[0].j;if(r=r[1]){let e=Fi(r),n=Ei(Si,ki,Ni,r).R;r=t.ca?yi(n,e):(t,r,o)=>i(t,r,o,n,e)}else r=i;return t[e]=r}}(r,t);n?n(e,i,t):t<500||N(W,3)}}),(t=ie(t))&&ne(t,(t,r,i)=>{for($r(e,e.h.end()),t=0;t<i.length;t++)$r(e,B(i[t])||new Uint8Array(0))})}var Vi=ct(0);function Mi(t,e,r){if(Array.isArray(e)){var i=0|e[J];if(4&i)return e;for(var n=0,o=0;n<e.length;n++){let r=t(e[n]);null!=r&&(e[o++]=r)}return o<n&&(e.length=o),t=1|i,r&&(t=-1537&t|4),t!==i&&Z(e,t),r&&2&t&&Object.freeze(e),e}}var Ri=(t,e)=>{var r=new Zr;Di(t.o,r,Ei(Si,ki,Ni,e)),$r(r,r.h.end()),t=new Uint8Array(r.j);var i=(e=r.l).length,n=0;for(let r=0;r<i;r++){let i=e[r];t.set(i,n),n+=i.length}return r.l=[t],t};function Gi(t,e,r){return new pi(t,e,r)}function zi(t,e,r){return new pi(t,e,r)}function Ci(t,e,r){je(t,0|t[J],e,r,ot(0|t[J]))}function Wi(t,e,r){null!=(e=Jt(e))&&(Qr(e),Yr(t,r,e))}function Hi(t,e,r){null!=(e=Gt(e))&&null!=e&&(Kr(t,r,0),zr(t.h,e))}function $i(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(Kr(t,r,0),t.h.h.push(e?1:0))}function Ki(t,e,r){null!=(e=te(e))&&Xr(t,r,h(e))}function qi(t,e,r,i,n){null!=(e=Bi(e,i))&&(r=qr(t,r),n(e,t),Jr(t,r))}function Ji(t,e,r){null!=(e=Xt(e))&&Xr(t,r,tr(e,!0).buffer)}function Yi(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Ft(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(Kr(t,r,0),Gr(t.h,e))}function Xi(t,e,r){null!=(e=Gt(e))&&(e=parseInt(e,10),Kr(t,r,0),zr(t.h,e))}function Zi(t,e,r){return 0===t.j&&(Ci(e,r,nr(t.h)),!0)}function Qi(t,e,r){return(0===t.j||2===t.j)&&(e=Ne(e,0|e[J],r),2==t.j?Sr(t,ir,e):e.push(ir(t.h)),!0)}function tn(t,e,r){return 2===t.j&&(Ci(e,r,(t=wr(t))===j()?void 0:t),!0)}var en=Gi(function(t,e,r){if(1!==t.j)return!1;var i=t.h;t=or(i);var n=or(i);i=2*(n>>31)+1;var o=n>>>20&2047;return t=4294967296*(1048575&n)+t,Ci(e,r,2047==o?t?NaN:i*(1/0):0==o?5e-324*i*t:i*Math.pow(2,o-1075)*(t+4503599627370496)),!0},function(t,e,r){null!=(e=Vt(e))&&(Kr(t,r,1),t=t.h,(r=yt||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),wt=r.getUint32(0,!0),St=r.getUint32(4,!0),Wr(t,wt),Wr(t,St))},li),rn=Gi(function(t,e,r){if(5!==t.j)return!1;var i=or(t.h);t=2*(i>>31)+1;var n=i>>>23&255;return i&=8388607,Ci(e,r,255==n?i?NaN:t*(1/0):0==n?1401298464324817e-60*t*i:t*Math.pow(2,n-150)*(i+8388608)),!0},function(t,e,r){null!=(e=Vt(e))&&(Kr(t,r,5),t=t.h,(r=yt||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),St=0,Wr(t,wt=r.getUint32(0,!0)))},hi),nn=Gi(function(t,e,r){return Zi(t,e,r)},Wi,ai),on=Gi(function(t,e,r){return Zi(t,e,r)},Wi,ai),an=zi(function(t,e,r){return 0!==t.j&&2!==t.j?t=!1:(e=Ne(e,0|e[J],r),2==t.j?Sr(t,nr,e):e.push(nr(t.h)),t=!0),t},function(t,e,r){if(null!=(e=Mi(Jt,e,!1)))for(let i=0;i<e.length;i++)Yr(t,r,e[i])},ai),sn=Gi(function(t,e,r){return 0!==t.j?e=!1:(Ci(e,r,(t=nr(t.h))===Vi?void 0:t),e=!0),e},Wi,ai),un=Gi(function(t,e,r){return 0!==t.j?t=!1:(Ci(e,r,er(t.h,It)),t=!0),t},function(t,e,r){if(null!=(e=Yt(e))){if("string"==typeof e)Ir(e);if(null!=e)switch(Kr(t,r,0),typeof e){case"number":t=t.h,Tt(e),Rr(t,wt,St);break;case"bigint":r=Mr(e,jr,_r),Rr(t.h,r.j,r.h);break;default:r=Ir(e),Rr(t.h,r.j,r.h)}}},si),hn=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,ir(t.h)),!0)},Hi,ni),ln=zi(Qi,function(t,e,r){if(null!=(e=Mi(Gt,e,!0)))for(let a=0;a<e.length;a++){var i=t,n=r,o=e[a];null!=o&&(Kr(i,n,0),zr(i.h,o))}},ni),cn=zi(Qi,function(t,e,r){if(null!=(e=Mi(Gt,e,!0))&&e.length){r=qr(t,r);for(let r=0;r<e.length;r++)zr(t.h,e[r]);Jr(t,r)}},ni),fn=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,0===(t=ir(t.h))?void 0:t),!0)},Hi,ni),dn=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,rr(t.h)),!0)},$i,ri),pn=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,!1===(t=rr(t.h))?void 0:t),!0)},$i,ri),vn=zi(function(t,e,r){return 2===t.j&&(t=br(t),Ne(e,0|e[J],r).push(t),!0)},function(t,e,r){if(null!=(e=Mi(te,e,!0)))for(let a=0;a<e.length;a++){var i=t,n=r,o=e[a];null!=o&&Xr(i,n,h(o))}},ii),mn=Gi(function(t,e,r){return 2===t.j&&(Ci(e,r,""===(t=br(t))?void 0:t),!0)},Ki,ii),gn=Gi(function(t,e,r){return 2===t.j&&(Ci(e,r,br(t)),!0)},Ki,ii),yn=function(t,e,r=ei){return new pi(t,e,r)}(function(t,e,r,i,n){return 2===t.j&&(i=de(void 0,i),Ne(e,0|e[J],r).push(i),yr(t,i,n),!0)},function(t,e,r,i,n){if(Array.isArray(e)){for(let o=0;o<e.length;o++)qi(t,e[o],r,i,n);1&(t=0|e[J])||Z(e,1|t)}}),bn=vi(function(t,e,r,i,n,o){if(2!==t.j)return!1;var a=0|e[J];return Ve(e,a,o,r,ot(a)),yr(t,e=Re(e,i,r),n),!0},qi),wn=Gi(function(t,e,r){return 2===t.j&&(Ci(e,r,wr(t)),!0)},Ji,ci),Sn=zi(function(t,e,r){return 2===t.j&&(t=wr(t),Ne(e,0|e[J],r).push(t),!0)},function(t,e,r){if(null!=(e=Mi(Xt,e,!1)))for(let a=0;a<e.length;a++){var i=t,n=r,o=e[a];null!=o&&Xr(i,n,tr(o,!0).buffer)}},ci),An=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,ir(t.h)>>>0),!0)},Yi,oi),Tn=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,0===(t=ir(t.h)>>>0)?void 0:t),!0)},Yi,oi),_n=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,ir(t.h)),!0)},Xi,fi),In=Gi(function(t,e,r){return 0===t.j&&(Ci(e,r,0===(t=ir(t.h))?void 0:t),!0)},Xi,fi),En=Gi(function(t,e,r){return 0!==t.j?t=!1:(Ci(e,r,function(t){return er(t,(t,e)=>{var r=-(1&t);return Et(t=(t>>>1|e<<31)^r,e>>>1^r)})}(t.h)),t=!0),t},function(t,e,r){if(null!=(e=Jt(e))&&(Qr(e),null!=e))switch(Kr(t,r,0),typeof e){case"number":t=t.h,e=(r=e)<0,At(r=2*Math.abs(r)),r=wt;let i=St;e&&(0==r?0==i?i=r=4294967295:(i--,r=4294967295):r--),Rr(t,wt=r,St=i);break;case"bigint":t=t.h,e=e<<BigInt(1)^e>>BigInt(63),wt=Number(BigInt.asUintN(32,e)),St=Number(BigInt.asUintN(32,e>>BigInt(32))),Rr(t,wt,St);break;default:Cr(t.h,e)}},ui);function jn(t){return function(){return Ri(this,t)}}var Bn,xn=[0,wn,Sn,dn,gn],Pn=[0,mn,[0,In,[0,sn,fn],In,-1,[0,_n],In,-1],Gi(tn,Ji,ci)],Un=[0,mn,Gi(tn,function(t,e,r){if(null!=e){if(e instanceof di){let i=e.Da;return void(i?(e=i(e),null!=e&&Xr(t,r,tr(e,!0).buffer)):N(W,3))}if(Array.isArray(e))return void N(W,3)}Ji(t,e,r)},ci)],Ln=[0,1,[0,12,hn,10,dn],[0,7,[0,hn,-1]]],On=globalThis.trustedTypes;var kn=class{constructor(t){this.h=t}toString(){return this.h+""}};function Nn(t){var e;return void 0===Bn&&(Bn=function(){var t=null;if(!On)return t;try{let e=t=>t;t=On.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Bn)?e.createScriptURL(t):t,new kn(t)}function Fn(t,...e){if(0===e.length)return Nn(t[0]);var r=t[0];for(let i=0;i<e.length;i++)r+=encodeURIComponent(e[i])+t[i+1];return Nn(r)}var Dn=[0,hn,_n,dn,-1,cn,_n,-1,dn,-1],Vn=[0,_n,-1,dn],Mn=class extends di{constructor(t){super(t)}},Rn=[0,dn,gn,dn,_n,-1,zi(function(t,e,r){return(0===t.j||2===t.j)&&(e=Ne(e,0|e[J],r),2==t.j?Sr(t,ar,e):e.push(ir(t.h)),!0)},function(t,e,r){if(null!=(e=Mi(Gt,e,!0))&&e.length){r=qr(t,r);for(let r=0;r<e.length;r++)zr(t.h,e[r]);Jr(t,r)}},fi),gn,-1,[0,dn,-1],_n,dn,-1,Vn],Gn=class extends di{constructor(t){super(t)}j(){return Be(this,9)}},zn=[0,3,dn,-1,2,[0,[2],hn,bn,[0,An]],[0,_n,dn,_n,dn,_n,4,[0,dn,gn,-1,dn]],[0,[3,4],gn,-1,bn,[0,hn],bn,[0,_n,-1]],[0],gn],Cn=[0,gn,-2],Wn=class extends di{constructor(t){super(t)}},Hn=[0],$n=[0,hn,dn,1,dn,-4],Kn=class extends di{constructor(t){super(t,2)}},qn={};qn[336783863]=[0,gn,dn,-1,hn,[0,[1,2,3,4,5,6,7,8,9],bn,Hn,bn,Rn,bn,Cn,bn,$n,bn,Dn,bn,[0,gn,-2],bn,[0,gn,_n],bn,zn,bn,Vn],[0,gn],dn,[0,[1,3],[2,4],bn,[0,cn],-1,bn,[0,vn],-1,yn,[0,gn,-1]],gn];var Jn=[0,sn,-1,pn,-3,sn,cn,mn,fn,sn,-1,pn,fn,pn,-2,mn],Yn=class extends di{constructor(t){super(t,500)}C(t){return He(this,0,7,t)}},Xn=[-1,{}],Zn=[0,gn,1,Xn],Qn=[0,gn,vn,Xn],to=class extends di{constructor(t){super(t,500)}C(t){return He(this,0,1001,t)}};to.prototype.j=jn([-500,yn,[-500,mn,-1,vn,-3,[-2,qn,dn],yn,Un,fn,-1,Zn,Qn,yn,[0,mn,pn],mn,Jn,fn,vn,987,vn],4,yn,[-500,gn,-1,[-1,{}],998,gn],yn,[-500,gn,vn,-1,[-2,{},dn],997,vn,-1],fn,yn,[-500,gn,vn,Xn,998,vn],vn,fn,Zn,Qn,yn,[0,mn,-1,Xn],vn,-2,Jn,mn,-1,pn,[0,pn,Tn],978,Xn,yn,Un]);var eo,ro=class extends di{constructor(t){super(t)}},io=class extends di{constructor(t){super(t)}j(){return Ce(this,ro)}},no=[0,yn,[0,hn,rn,gn,-1]],oo=class extends di{constructor(t){super(t)}},ao=class extends di{constructor(t){super(t)}j(){return Be(this,Fe(this,2))}l(){return Ge(this,Gn,Fe(this,6))}},so=[1,2,3,4,5,6],uo=class extends di{constructor(t){super(t)}j(){return null!=_e(this,1,void 0,Oe)}l(){return null!=te(_e(this,2))}},ho=class extends di{constructor(t){super(t)}},lo=class extends di{constructor(t){super(t)}};eo=new class{constructor(){var t=Kn;this.h=lo,this.l=He,this.defaultValue=void 0,this.j=null!=t.ya?nt:void 0}register(){v(this)}},qn[451755788]=[0,[0,[0,wn,gn,[0,hn,on,-1],[0,un,on]],dn,[0,so,bn,$n,bn,Rn,bn,Dn,bn,Hn,bn,Cn,bn,zn],_n],[0,gn,hn,rn,vn,-1],en];var co,fo,po=class extends di{constructor(t){super(t)}},vo=(co=class extends di{constructor(t){super(t)}},fo=[0,yn,[0,1,hn,gn,no],on],(t,e)=>{t:{let i={Z:!0};e&&Object.assign(i,e),t=dr(t,void 0,void 0,i);try{let e=new co,i=e.o;Ui(fo)(i,t);var r=e;break t}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{pr(t)}r=void 0}return r});function mo(t){return Xe(new go,1,t)}var go=class extends di{constructor(t){super(t)}},yo=class extends di{constructor(t){super(t)}},bo=[0,_n,2,un,-2,on,yn,[0,_n,on]],wo=class extends di{constructor(t){super(t)}},So=class extends di{constructor(t){super(t)}};function Ao(t,e){return Xe(t,1,e)}function To(t,e){return Xe(t,2,e)}var _o=class extends di{constructor(t){super(t)}},Io=[3,4,5,6,7],Eo=class extends di{constructor(t){super(t)}},jo=class extends di{constructor(t){super(t)}};jo.prototype.j=jn([0,[0,_n,gn,-3,_n],[0,Io,_n,-1,bn,[0,_n,gn,un],bn,bo,bn,[0,1,bo],bn,[0,_n],bn,[0,_n,gn,un]]]);var Bo=class{constructor(){this.h="undefined"!=typeof AbortController}async send(t,e,r){var i=this.h?new AbortController:void 0,n=i&&t.Y>0?setTimeout(()=>{i.abort()},t.Y):void 0;try{let n=await fetch(t.url,{method:t.ra,headers:{...t.qa},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.Y&&i?i.signal:null});200===n.status?e?.(await n.text()):r?.(n.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400)}finally{clearTimeout(n)}}},xo=class extends di{constructor(t){super(t,37)}},Po=[-4,{},Ln,_n,Pn],Uo=[0,gn,_n,1,gn,-1,_n,1,_n,1,on],Lo=[0,_n,gn,-2],Oo=[0,gn,_n],ko=[0,gn,_n],No=[0,dn,-3],Fo=[0,_n,gn,-1,on,hn,-1,gn,-5,yn,[0,gn,-4],-1,dn,[0,dn,-3],_n];var Do=class extends di{constructor(t){super(t,19)}},Vo=function(t){return e=>Ri(e,t)}([-19,{},[0,_n,1,[0,gn,-6,on,hn,gn,-1,on],1,[0,gn,1,gn,-5],gn,-1,[0,_n,gn,-8],[0,gn,-3],[0,gn,_n,gn,-2],[0,gn,-1,_n,gn,-1,_n,gn,-1,[0,yn,[0,gn,-1],dn,gn,-5],[0,_n,dn,hn,-2]],on,[0,gn,-3,on,hn,gn,-1],[0,_n,gn,-1],[0,gn,-9],[0,gn,-6,_n,gn,1,gn,dn,_n,-1,dn,gn,-2,_n,gn,_n,gn,hn,-1],1,[0,_n],1,[0,gn,-4],1,Uo,[0,[1,2,3,4,5,6],bn,Uo,bn,Oo,bn,ko,bn,[0,_n],bn,Fo,bn,Lo],Oo,ko,Fo,[0,[0,_n,gn,-1,on,hn,-1,gn,-4,yn,[0,gn,-4],-1,1,No],[0,_n,gn,-1,on,hn,-1,gn,-4,No]],Lo,[0,gn,[0,hn,-3,_n],_n,-2,[0,hn,-1],dn],4,[0,gn,_n,gn,-1,on,_n,gn,-1,_n,hn,-1]],_n,yn,[-37,{},nn,gn,yn,[0,gn,-1],wn,1,wn,[0,vn,-1,ln,an,-1],gn,[0,hn,gn,-1],dn,hn,on,gn,-1,En,xn,nn,wn,_n,ln,on,-1,[0,_n,-1],gn,dn,gn,cn,gn,-1,en,1,en,Po,dn,[0,_n,[0,rn,hn,-2],[0,rn]],[0,_n,on]],nn,Sn,gn,-1,nn,_n,-1,[0,dn,-1,_n,dn],[0,on,-1,gn],[0,nn,dn,on],on,1,An,1,Po]),Mo=class{constructor(t){this.j=[],this.m=new Bo,this.l=t??"",this.h=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.h&&(clearInterval(this.h),this.h=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.j.length)t?.();else{var r=this.j;this.j=[],r=function(t){var e=new Do;{we(e=Xe(e,2,1786));let h=e.o,l=0|h[J];if(null==t)je(h,l,3);else{var r=t===M?7:0|t[J],i=r,n=Le(r),o=n||Object.isFrozen(t),a=!0,s=!0;for(let e=0;e<t.length;e++){var u=t[e];n||(u=tt(u),a&&=!u,s&&=u)}n||(r=a?13:5,r=s?-4097&r:4096|r),o&&r===i||(t=Lt(t),i=0,r=Ke(r,l)),r!==i&&Z(t,r),l=je(h,l,3,t),2&r||!(4096&r||16&r)||Se(h,l)}}return e}(r),r=Vo(r),this.m.send({url:"https://odml.pa.googleapis.com/v1/log",ra:"POST",Y:1e4,body:r,wa:2,qa:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.l},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.j=[],void 0!==this.h&&(clearInterval(this.h),this.h=void 0),e?.("net-send-failed",t)})}}};class Ro{constructor(){this.P=this.J=this.N=this.I=this.L=this.M=this.K=0}}function Go(t,e){var r=new jo;r=He(r,0,1,t.F),r=He(r,0,2,e),e=Ee(e=new xo,6,rt(r=r.j(),!1)),(t=t.G).error||t.j.push(e)}function zo(t,e){++t.h.K,t.j.set(e,performance.now())}function Co(t,e){++t.h.M,t.j.set(e,performance.now())}function Wo(t,e){var r={K:e.K-t.l.K,M:e.M-t.l.M,L:e.L-t.l.L,I:e.I-t.l.I,N:e.N-t.l.N,J:e.J,P:e.P},i=To(Ao(new _o,t.B),1);r=Ho(t,r),Go(t,i=$e(i,4,Io,r)),t.l=e}function Ho(t,e){var r=new yo;return t=Ye(t=Je(t=Xe(r,1,t.H),7,e.I),5,e.J),t=Ye(t,6,e.P),e.L>0&&Ye(t,4,e.N/e.L),0!==e.K&&(r=Je(r=mo(3),2,e.K),qe(t,8,go,r)),0!==e.M&&(e=Je(r=mo(4),2,e.M),qe(t,8,go,e)),t}var $o=class{constructor(t,e,r){this.D=performance.now(),this.m=performance.now(),this.j=new Map,this.A=0,this.h=new Ro,this.l=new Ro,this.G=new Mo(r),this.B=function(t){switch(t){case"AudioClassifier":return 4;case"AudioEmbedder":return 5;case"TextClassifier":return 6;case"TextEmbedder":return 7;case"GestureRecognizer":return 8;case"HandDetector":return 9;case"HandLandmarker":return 10;case"ImageClassifier":return 11;case"ImageEmbedder":return 12;case"ImageSegmenter":return 13;case"ObjectDetector":return 14;case"FaceDetector":return 15;case"FaceLandmarker":return 16;case"InteractiveSegmenter":case"InteractiveSegmenterLegacy":return 18;case"HolisticLandmarker":return 20;case"LlmInference":return 21;case"LanguageDetector":return 22;case"PoseLandmarker":return 23;case"UniversalEmbedder":return 28;case"SemanticRetriever":return 29;case"DecisionMaker":return 30;case"TextSummarizer":return 26;case"TextProofreader":return 27;case"AudioTranscriber":return 31;case"TextToSpeech":return 32;default:return 0}}(t),this.H=function(t){switch(t){case"IMAGE":return 11;case"VIDEO":return 12;case"LIVE_STREAM":return 13;case"AUDIO_CLIPS":return 14;case"AUDIO_STREAM":return 15;default:return 10}}(e),t=new Eo,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=Ee(t=Xe(t,1,e),2,Qt("")),t=Ee(t,3,Qt("")),t=Ee(t,4,Qt("1.2.0")),t=Ee(t,5,Qt("")),this.F=Xe(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}X(){var t=new So;t=Ye(t=Xe(t,1,this.H),3,performance.now()-this.D),Go(this,t=$e(To(Ao(new _o,this.B),0),3,Io,t)),this.m=performance.now()}S(t){var e=this.j.get(t);if(void 0!==e&&(this.j.delete(t),t=performance.now()-e,++this.h.L,this.h.N+=t,this.h.J=Math.max(this.h.J,t),this.A=Math.max(this.A,t),performance.now()>this.m+3e4)){for(let[r,i]of this.j.entries())t=r,i<e&&(this.h.I++,this.j.delete(t));e={...this.h,P:performance.now()-this.m},this.h.J=0,this.m=performance.now(),Wo(this,e)}}ma(){var t={...this.h,I:this.h.I+this.j.size,J:this.A,P:performance.now()-this.D};Wo(this,t);var e=new wo;e=He(e,0,2,t=Ho(this,t)),Go(this,e=$e(t=To(Ao(new _o,this.B),2),5,Io,e))}close(){var t=this.G;"function"==typeof t.close?t.close():t.flush()}};function Ko(){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 qo(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}function Jo(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function Yo(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");var i=new Uint32Array(e.length);for(let r=0;r<e.length;r++)i[r]=t.i.stringToNewUTF8(e[r]);e=t.i._malloc(4*i.length),t.i.HEAPU32.set(i,e>>2),r(e);for(let e of i)t.i._free(e);t.i._free(e)}function Xo(t,e,r){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=r}function Zo(t,e,r){var i=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,n)=>{e?(r(i,n),i=[]):i.push(t)}}var Qo=function(t){return class extends t{get aa(){return this.i}ja(){if("function"==typeof this.aa._mediapipeLoggerGetEncodedApiKey){let t=this.aa._mediapipeLoggerGetEncodedApiKey();return this.aa._decodeBase64(t)}}}}(function(t){return class extends t{pa(){this.i._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.l=!0,this.i=t,this.h=null,this.j=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:Ko()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(t){var 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){var r=t.length,i=this.i._malloc(r);this.i.HEAPU8.set(t,i),e?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(t,e,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Jo(this,i||"input_audio",i=>{Jo(this,n=n||"audio_header",n=>{this.i._configureAudio(i,n,t,e??0,r)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,r){this.addAudioToStreamWithShape(t,0,0,e,r)}addAudioToStreamWithShape(t,e,r,i,n){var o=4*t.length;this.j!==o&&(this.h&&this.i._free(this.h),this.h=this.i._malloc(o),this.j=o),this.i.HEAPF32.set(t,this.h/4),Jo(this,i,t=>{this.i._addAudioToInputStream(this.h,e,r,t,n)})}addGpuBufferToStream(t,e,r){Jo(this,e,e=>{if(!this.i.canvas)throw Error("No OpenGL canvas configured.");e?this.i._bindTextureToStream(e):this.i._bindTextureToCanvas();var i=this.i.canvas.getContext("webgl2")||this.i.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),this.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);var[n,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.l||n===this.i.canvas.width&&o===this.i.canvas.height||(this.i.canvas.width=n,this.i.canvas.height=o);var[a,s]=[n,o];this.i._addBoundTextureToStream(e,a,s,r)})}addBoolToStream(t,e,r){Jo(this,e,e=>{this.i._addBoolToInputStream(t,e,r)})}addDoubleToStream(t,e,r){Jo(this,e,e=>{this.i._addDoubleToInputStream(t,e,r)})}addFloatToStream(t,e,r){Jo(this,e,e=>{this.i._addFloatToInputStream(t,e,r)})}addIntToStream(t,e,r){Jo(this,e,e=>{this.i._addIntToInputStream(t,e,r)})}addUintToStream(t,e,r){Jo(this,e,e=>{this.i._addUintToInputStream(t,e,r)})}addStringToStream(t,e,r){Jo(this,e,e=>{Jo(this,t,t=>{this.i._addStringToInputStream(t,e,r)})})}addStringRecordToStream(t,e,r){Jo(this,e,e=>{Yo(this,Object.keys(t),i=>{Yo(this,Object.values(t),n=>{this.i._addFlatHashMapToInputStream(i,n,Object.keys(t).length,e,r)})})})}addProtoToStream(t,e,r,i){Jo(this,r,r=>{Jo(this,e,e=>{var n=this.i._malloc(t.length);this.i.HEAPU8.set(t,n),this.i._addProtoToInputStream(n,t.length,e,r,i),this.i._free(n)})})}addEmptyPacketToStream(t,e){Jo(this,t,t=>{this.i._addEmptyPacketToInputStream(t,e)})}addBoolVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateBoolVector(t.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.i._addBoolVectorEntry(i,e);this.i._addBoolVectorToInputStream(i,e,r)})}addDoubleVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateDoubleVector(t.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.i._addDoubleVectorEntry(i,e);this.i._addDoubleVectorToInputStream(i,e,r)})}addFloatVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateFloatVector(t.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.i._addFloatVectorEntry(i,e);this.i._addFloatVectorToInputStream(i,e,r)})}addIntVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateIntVector(t.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.i._addIntVectorEntry(i,e);this.i._addIntVectorToInputStream(i,e,r)})}addUintVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateUintVector(t.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.i._addUintVectorEntry(i,e);this.i._addUintVectorToInputStream(i,e,r)})}addStringVectorToStream(t,e,r){Jo(this,e,e=>{var i=this.i._allocateStringVector(t.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Jo(this,e,t=>{this.i._addStringVectorEntry(i,t)});this.i._addStringVectorToInputStream(i,e,r)})}addBoolToInputSidePacket(t,e){Jo(this,e,e=>{this.i._addBoolToInputSidePacket(t,e)})}addDoubleToInputSidePacket(t,e){Jo(this,e,e=>{this.i._addDoubleToInputSidePacket(t,e)})}addFloatToInputSidePacket(t,e){Jo(this,e,e=>{this.i._addFloatToInputSidePacket(t,e)})}addIntToInputSidePacket(t,e){Jo(this,e,e=>{this.i._addIntToInputSidePacket(t,e)})}addUintToInputSidePacket(t,e){Jo(this,e,e=>{this.i._addUintToInputSidePacket(t,e)})}addStringToInputSidePacket(t,e){Jo(this,e,e=>{Jo(this,t,t=>{this.i._addStringToInputSidePacket(t,e)})})}addProtoToInputSidePacket(t,e,r){Jo(this,r,r=>{Jo(this,e,e=>{var i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,e,r),this.i._free(i)})})}addBoolVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.i._addBoolVectorEntry(r,e);this.i._addBoolVectorToInputSidePacket(r,e)})}addDoubleVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.i._addDoubleVectorEntry(r,e);this.i._addDoubleVectorToInputSidePacket(r,e)})}addFloatVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.i._addFloatVectorEntry(r,e);this.i._addFloatVectorToInputSidePacket(r,e)})}addIntVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.i._addIntVectorEntry(r,e);this.i._addIntVectorToInputSidePacket(r,e)})}addUintVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.i._addUintVectorEntry(r,e);this.i._addUintVectorToInputSidePacket(r,e)})}addStringVectorToInputSidePacket(t,e){Jo(this,e,e=>{var r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Jo(this,e,t=>{this.i._addStringVectorEntry(r,t)});this.i._addStringVectorToInputSidePacket(r,e)})}attachBoolListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachBoolListener(t)})}attachBoolVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachBoolVectorListener(t)})}attachIntListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachIntListener(t)})}attachIntVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachIntVectorListener(t)})}attachUintListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachUintListener(t)})}attachUintVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachUintVectorListener(t)})}attachDoubleListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachDoubleListener(t)})}attachDoubleVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachDoubleVectorListener(t)})}attachFloatListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachFloatListener(t)})}attachFloatVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachFloatVectorListener(t)})}attachStringListener(t,e){Xo(this,t,e),Jo(this,t,t=>{this.i._attachStringListener(t)})}attachStringVectorListener(t,e){Zo(this,t,e),Jo(this,t,t=>{this.i._attachStringVectorListener(t)})}attachProtoListener(t,e,r){Xo(this,t,e),Jo(this,t,t=>{this.i._attachProtoListener(t,r||!1)})}attachProtoVectorListener(t,e,r){Zo(this,t,e),Jo(this,t,t=>{this.i._attachProtoVectorListener(t,r||!1)})}attachAudioListener(t,e,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Xo(this,t,(t,r)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,r)}),Jo(this,t,t=>{this.i._attachAudioListener(t,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}})),ta=class extends Qo{};async function ea(t,e,r){return t=await(async(t,e,r,i)=>{if(e&&await qo(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(r&&(await qo(r),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),ia(t,r),await t.C(r),t}async function ra(t,e,r){return ea(t,e,r)}function ia(t,e){e=e.Ca??"";var r=t.h.ja();t.j=new $o(t.T(),e,r)}function na(t,e,r){try{t.h.i.FS_unlink(`/${r}`)}catch{}t.h.i.FS_createDataFile("/",r,e,!0,!1,!1),oa(t,`/${r}`)}function oa(t,e){var r=Ge(t.baseOptions,uo,1)||new uo;"string"==typeof e?(Ee(r,2,Qt(e)),Ee(r,1)):e instanceof Uint8Array&&(Ee(r,1,rt(e,!1)),Ee(r,2)),He(t.baseOptions,0,1,r)}function aa(t,e,r=!0,i=!1){if(r){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ge(t.baseOptions,uo,1)?.j()||Ge(t.baseOptions,uo,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");!function(t,e){var r=Ge(t.baseOptions,ao,3);if(!r){var i=r=new ao,n=new Wn;$e(i,4,so,n)}"delegate"in e&&("GPU"===e.delegate?(e=r,i=new Mn,$e(e,2,so,i)):(e=r,i=new Wn,$e(e,4,so,i))),He(t.baseOptions,0,3,r)}(t,r);let n=i?"model.litertlm":"model.dat";if(r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${t.status})`)}).then(e=>{na(t,new Uint8Array(e),n),t.D()});if(r.modelAssetBuffer instanceof Uint8Array)i?na(t,r.modelAssetBuffer,n):oa(t,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(t){for(var e=[],r=0;;){let{done:i,value:n}=await t.read();if(i)break;e.push(n),r+=n.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let i of e)t.set(i,r),r+=i.length;return t}(r.modelAssetBuffer).then(e=>{i?na(t,e,n):oa(t,e),t.D()})}return t.D(),Promise.resolve()}function sa(t){try{let e=t.H.length;if(1===e)throw Error(t.H[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.H.map(t=>t.message).join(", "))}finally{t.H=[]}}var ua=class{constructor(t){this.h=t,this.H=[],this.G=0,this.h.setAutoRenderToScreen(!1)}setGraph(t,e){this.h.attachErrorListener((t,e)=>{this.H.push(Error(e))}),this.h.pa(),this.h.setGraph(t,e),this.j?.X(),sa(this)}finishProcessing(t){this.h.finishProcessing(),sa(this),this.j&&void 0!==t&&this.j.S(t)}close(){this.j?.ma(),this.j?.close(),this.h.closeGraph()}};async function ha(t,e){return ra(fa,t,e)}ua.prototype.close=ua.prototype.close;var la=class extends ua{constructor(){super(...arguments),this.A=48e3}sa(t){this.A=t}};function ca(t){var e={classifications:Ce(t,po).map(t=>function(t,e=-1,r=""){return{categories:t.map(t=>({index:Gt(_e(t,1))??0??-1,score:_e(t,2,void 0,Vt)??0??0,categoryName:te(_e(t,3))??""??"",displayName:te(_e(t,4))??""??""})),headIndex:e,headName:r}}(Ge(t,io,4)?.j()??[],Gt(_e(t,2))??0,te(_e(t,3))??""))};return null!=function(t){return null==t?t:"bigint"==typeof t?(ft(t)?t=Number(t):(t=Ot(64,t),t=ft(t)?Number(t):String(t)),t):Rt(t)?"number"==typeof t?Wt(t):$t(t):void 0}(_e(t,2,void 0,qt))&&(e.timestampMs=function(t){var e=Number(t);return Number.isSafeInteger(e)?e:String(t)}(_e(t,2,void 0,qt)??Te)),e}la.prototype.setDefaultSampleRate=la.prototype.sa;var fa=class extends la{constructor(t,e){super(new ta(t,e)),this.m=[],He(t=this.l=new lo,0,1,e=new ho)}T(){return"AudioClassifier"}get baseOptions(){return Ge(this.l,ho,1)}set baseOptions(t){He(this.l,0,1,t)}C(t){var e=this.l,r=Ge(this.l,oo,2);if(r){var i=r.o;let t=0|i[J];r=Ae(r,i,t)?me(r,i,!0):new r.constructor(ge(i,t,!1))}else r=new oo;if(void 0!==t.displayNamesLocale?Ee(r,1,Qt(t.displayNamesLocale)):void 0===t.displayNamesLocale&&Ee(r,1),void 0!==t.maxResults){if(null!=(i=t.maxResults)){if("number"!=typeof i)throw k("int32");if(!Ft(i))throw k("int32");i|=0}Ee(r,2,i)}else"maxResults"in t&&Ee(r,2);if(void 0!==t.scoreThreshold){if(null!=(i=t.scoreThreshold)&&"number"!=typeof i)throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);Ee(r,3,i)}else"scoreThreshold"in t&&Ee(r,3);return void 0!==t.categoryAllowlist?ke(r,4,t.categoryAllowlist):"categoryAllowlist"in t&&Ee(r,4),void 0!==t.categoryDenylist?ke(r,5,t.categoryDenylist):"categoryDenylist"in t&&Ee(r,5),He(e,0,2,r),aa(this,t)}ga(t,e){e=e??this.A;var r=this.G+1;if(this.j&&void 0!==r){let t=Ge(this.baseOptions,ao,3);t?.j()||t?.l()?.j()?Co(this.j,r):zo(this.j,r)}return this.h.addDoubleToStream(e,"sample_rate",r),this.h.addAudioToStreamWithShape(t,1,t.length,"audio_in",r),this.m=[],this.finishProcessing(r),[...this.m]}D(){var t=new to;Ze(t,10,"audio_in"),Ze(t,10,"sample_rate"),Ze(t,15,"timestamped_classifications");var e=new Kn;!function(t,e){var r=eo,i=t.o;z&&z in i&&(i=i[z])&&delete i[451755788],r.h?r.l(t,r.h,451755788,e,r.j):r.l(t,451755788,e,r.j)}(e,this.l);var r=new Yn;!function(t){var e=Qt("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph");we(t),je(t=t.o,0|t[J],2,""===e?void 0:e)}(r),Ze(r,3,"AUDIO:audio_in"),Ze(r,3,"SAMPLE_RATE:sample_rate"),Ze(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.C(e),qe(t,1,Yn,r),this.h.attachProtoVectorListener("timestamped_classifications",(t,e)=>{!function(t,e){e.forEach(e=>{e=vo(e),t.m.push(ca(e))})}(this,t),this.G=Math.max(this.G,e)}),this.h.attachEmptyPacketListener("timestamped_classifications",t=>{this.G=Math.max(this.G,t)}),t=t.j(),this.setGraph(new Uint8Array(t),!0)}};fa.prototype.classify=fa.prototype.ga,fa.prototype.setOptions=fa.prototype.C,fa.createFromModelPath=function(t,e){return ra(fa,t,{baseOptions:{modelAssetPath:e}})},fa.createFromModelBuffer=function(t,e){return ha(t,{baseOptions:{modelAssetBuffer:e}})},fa.createFromOptions=function(t,e){return ha(t,e)};var da=[];async function pa(t,e){var r=da.pop();if(r){ia(t=new ga(r,null),e);try{return await t.C(e),t}catch(e){throw t.close(),e}}return ra(ga,t,e)}function va(t,e){var r=t.F.then(()=>{var r=t.U++;return t.j&&(-1===t.A?zo(t.j,r):Co(t.j,r)),Promise.resolve().then(e).then(e=>(t.j?.S(r),e),e=>{throw t.j?.S(r),e})});return t.F=r.then(()=>{},()=>{}),r}function ma(t,e){if(t=t.h.i,e<64){if(!(t=t._malloc(e)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:t,v:t}}if(!(t=t._malloc(e+64)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:(t+63&-64)>>>0,v:t}}var ga=class extends ua{constructor(t,e){super(new ta(t,e)),this.baseOptions=new ho,this.A=0,this.sampleRateHz=16e3,this.enableInterimResults=!1,this.modelArchitecture=0,this.cacheDir=this.prompt="",this.B=this.m=this.l=0,this.O=!1,this.U=0,this.F=Promise.resolve()}T(){return"AudioTranscriber"}async C(t){if(0!==this.l)throw Error("AudioTranscriber does not support updating options after initialization.");if(this.A="CPU"===t.baseOptions?.delegate?-1:0,void 0!==t.sampleRateHz&&(this.sampleRateHz=t.sampleRateHz),void 0!==t.enableInterimResults&&(this.enableInterimResults=t.enableInterimResults),void 0!==t.modelArchitecture&&(this.modelArchitecture=function(t){if("number"==typeof t)return t;switch(t){case"OMNI":return 1;case"TINY_GEMMA":return 2;case"AUTO":case void 0:return 0;default:throw Error(`Unsupported model architecture: ${t}`)}}(t.modelArchitecture)),void 0!==t.prompt&&(this.prompt=t.prompt),void 0!==t.cacheDir&&(this.cacheDir=t.cacheDir),-1===this.A){this.h.i.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.h.i).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),i=r?.info,n=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${i?.vendor??""} ${i?.architecture??""} ${i?.description??""}`);if(r&&!n){for(var o of(n=[],["shader-f16","subgroups"]))r.features.has(o)&&n.push(o);o={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(o[t]=e)}let t=await r.requestDevice({requiredFeatures:n,requiredLimits:o});if(!t.adapterInfo&&i)try{Object.defineProperty(t,"adapterInfo",{value:i,writable:!0,configurable:!0})}catch{try{t.adapterInfo=i}catch{}}e.preinitializedWebGPUDevice=t}}e.preinitializedWebGPUDevice&&("object"==typeof(r="undefined"!=typeof self?self:globalThis).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}if(e=r=this.h.i,(i=!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer))&&"function"==typeof r.createAudioTranscriberFromBuffer&&"function"==typeof e._malloc){t=await async function(t,e,r,i){var n=t.h.i;if(r instanceof Uint8Array){var o=r.byteLength;if(0===o)return{u:0,v:0,size:0};let{u:e,v:i}=ma(t,o);return n.HEAPU8.set(r,e),{u:e,v:i,size:o}}if(i=i&&i>0?i:0,!r&&e){if(e=e.toString(),!(r=await fetch(e)).ok||!r.body)throw Error(`Failed to fetch asset: ${e} (${r.status})`);(e=Number(r.headers.get("content-length")||0))>0&&(i=e),r=r.body.getReader()}if(!r)return{u:0,v:0,size:0};if(i>0){let{u:e,v:a}=ma(t,i);t=0;try{for(;;){let{value:a,done:s}=await r.read();if(s)break;if(a&&a.byteLength>0){if(t+(o=Number(a.byteLength))>i)throw Error(`Stream exceeded expected content-length (${i} bytes).`);n.HEAPU8.set(a,e+t>>>0),t+=o}}}catch(t){throw n._free(a),t}return{u:e,v:a,size:t}}for(o=[],i=0;;){let{value:t,done:e}=await r.read();if(e)break;t&&t.byteLength>0&&(o.push(t),i+=Number(t.byteLength))}if(0===i)return{u:0,v:0,size:0};var{u:a,v:s}=ma(t,i);for(t=0,r=0;r<o.length;r++)(e=o[r])&&(n.HEAPU8.set(e,a+t>>>0),t+=e.byteLength,o[r]=void 0);return{u:a,v:s,size:i}}(this,t.baseOptions?.modelAssetPath,t.baseOptions?.modelAssetBuffer,t.modelAssetSize),this.m=t.u,this.B=t.v;try{this.l=await r.createAudioTranscriberFromBuffer(this.m,t.size,this.A,this.sampleRateHz,this.enableInterimResults,this.modelArchitecture,this.prompt,this.cacheDir)}catch(r){if(0!==(t=this.B||this.m)){try{e._free(t)}catch{}this.B=this.m=0}throw r}}else await aa(this,t,i,!0),this.l=await r.createAudioTranscriber("/model.litertlm",this.A,this.sampleRateHz,this.enableInterimResults,this.modelArchitecture,this.prompt,this.cacheDir);this.j?.X()}D(){}ea(t,e=!0){if(0===this.l)throw Error("AudioTranscriber is already closed.");var r=this.h.i;return va(this,()=>r.transcribeAudio(this.l,t,e))}va(t){return this.ea(t,!1)}ia(){if(0===this.l)throw Error("AudioTranscriber is already closed.");var t=this.h.i;return va(this,()=>t.finishAudioTranscriberStream(this.l))}async na(){if(0===this.l)throw Error("AudioTranscriber is already closed.");var t=this.h.i;await va(this,()=>t.prewarmAudioTranscriber(this.l))}close(){if(!this.O){this.O=!0;var t=this.h.i;if(0!==this.l){try{t.deleteAudioTranscriber(this.l)}catch{}this.l=0}var e=this.B||this.m;if(0!==e){try{t._free(e)}catch{}this.B=this.m=0}super.close(),t&&!da.includes(t)&&da.push(t)}}};ga.prototype.close=ga.prototype.close,ga.prototype.prewarm=ga.prototype.na,ga.prototype.finishStream=ga.prototype.ia,ga.prototype.transcribeStream=ga.prototype.va,ga.prototype.transcribe=ga.prototype.ea,ga.prototype.setOptions=ga.prototype.C,ga.createFromModelBuffer=function(t,e){return pa(t,{baseOptions:{modelAssetBuffer:e}})},ga.createFromModelPath=function(t,e){return pa(t,{baseOptions:{modelAssetPath:e}})},ga.createFromOptions=pa;var ya=class{constructor(t,e,r){this.h=t,this.i=e,this.l=r,this.j=!1}async da(){return this.j||0===this.h?null:this.l(()=>this.j||0===this.h?Promise.resolve(null):this.i.readNextTextToSpeechChunk(this.h))}async oa(t){if(this.j||0===this.h)throw Error("TextToSpeechStream is already closed.");await this.i.pushTextToSpeechStream(this.h,t)}async ha(){if(this.j||0===this.h)throw Error("TextToSpeechStream is already closed.");await this.i.finishTextToSpeechStreamInput(this.h)}cancel(){this.j||0===this.h||this.i.cancelTextToSpeechStream(this.h)}close(){if(!this.j&&(this.j=!0,0!==this.h)){try{this.i.deleteTextToSpeechStream(this.h)}catch{}this.h=0}}[Symbol.asyncIterator](){var t=this;return async function*(){try{for(;;){let e=await t.da();if(!e)break;yield e}}finally{t.close()}}()}};ya.prototype.close=ya.prototype.close,ya.prototype.cancel=ya.prototype.cancel,ya.prototype.finishInput=ya.prototype.ha,ya.prototype.pushText=ya.prototype.oa,ya.prototype.readNext=ya.prototype.da;var ba=[];async function wa(t,e){var r=ba.pop();if(r){ia(t=new Ta(r,null),e);try{return await t.C(e),t}catch(e){throw t.close(),e}}return ra(Ta,t,e)}function Sa(t,e){var r=t.O.then(()=>{var r=t.U++;return t.j&&(-1===t.A?zo(t.j,r):Co(t.j,r)),Promise.resolve().then(e).then(e=>(t.j?.S(r),e),e=>{throw t.j?.S(r),e})});return t.O=r.then(()=>{},()=>{}),r}function Aa(t,e){if(t=t.h.i,e<64){if(!(t=t._malloc(e)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:t,v:t}}if(!(t=t._malloc(e+64)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{u:(t+63&-64)>>>0,v:t}}var Ta=class extends ua{constructor(t,e){super(new ta(t,e)),this.baseOptions=new ho,this.A=-1,this.defaultLocale=this.defaultVoiceId="",this.speakingRate=1,this.targetBucket=0,this.cacheDirectory="",this.B=this.m=this.l=0,this.F=!1,this.U=0,this.O=Promise.resolve()}T(){return"TextToSpeech"}async C(t){if(0!==this.l)throw Error("TextToSpeech does not support updating options after initialization.");if(this.A="GPU"===t.baseOptions?.delegate?0:-1,void 0!==t.defaultVoiceId&&(this.defaultVoiceId=t.defaultVoiceId),void 0!==t.defaultLocale&&(this.defaultLocale=t.defaultLocale),void 0!==t.speakingRate&&(this.speakingRate=t.speakingRate),void 0!==t.targetBucket&&(this.targetBucket=t.targetBucket),void 0!==t.cacheDirectory&&(this.cacheDirectory=t.cacheDirectory),-1===this.A){this.h.i.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.h.i).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),i=r?.info,n=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${i?.vendor??""} ${i?.architecture??""} ${i?.description??""}`);if(r&&!n){for(var o of(n=[],["shader-f16","subgroups"]))r.features.has(o)&&n.push(o);o={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(o[t]=e)}let t=await r.requestDevice({requiredFeatures:n,requiredLimits:o});if(!t.adapterInfo&&i)try{Object.defineProperty(t,"adapterInfo",{value:i,writable:!0,configurable:!0})}catch{try{t.adapterInfo=i}catch{}}e.preinitializedWebGPUDevice=t}}e.preinitializedWebGPUDevice&&("object"==typeof(r="undefined"!=typeof self?self:globalThis).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}if(e=r=this.h.i,(i=!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer))&&"function"==typeof r.createTextToSpeechFromBuffer&&"function"==typeof e._malloc){t=await async function(t,e,r,i){var n=t.h.i;if(r instanceof Uint8Array){var o=r.byteLength;if(0===o)return{u:0,v:0,size:0};let{u:e,v:i}=Aa(t,o);return n.HEAPU8.set(r,e),{u:e,v:i,size:o}}if(i=i&&i>0?i:0,!r&&e){if(e=e.toString(),!(r=await fetch(e)).ok||!r.body)throw Error(`Failed to fetch asset: ${e} (${r.status})`);(e=Number(r.headers.get("content-length")||0))>0&&(i=e),r=r.body.getReader()}if(!r)return{u:0,v:0,size:0};if(i>0){let{u:e,v:a}=Aa(t,i);t=0;try{for(;;){let{value:a,done:s}=await r.read();if(s)break;if(a&&a.byteLength>0){if(t+(o=Number(a.byteLength))>i)throw Error(`Stream exceeded expected content-length (${i} bytes).`);n.HEAPU8.set(a,e+t>>>0),t+=o}}}catch(t){throw n._free(a),t}return{u:e,v:a,size:t}}for(o=[],i=0;;){let{value:t,done:e}=await r.read();if(e)break;t&&t.byteLength>0&&(o.push(t),i+=Number(t.byteLength))}if(0===i)return{u:0,v:0,size:0};var{u:a,v:s}=Aa(t,i);for(t=0,r=0;r<o.length;r++)(e=o[r])&&(n.HEAPU8.set(e,a+t>>>0),t+=e.byteLength,o[r]=void 0);return{u:a,v:s,size:i}}(this,t.baseOptions?.modelAssetPath,t.baseOptions?.modelAssetBuffer,t.modelAssetSize),this.m=t.u,this.B=t.v;try{this.l=await r.createTextToSpeechFromBuffer(this.m,t.size,this.A,this.defaultVoiceId,this.defaultLocale,this.speakingRate,this.targetBucket,this.cacheDirectory)}catch(r){if(0!==(t=this.B||this.m)){try{e._free(t)}catch{}this.B=this.m=0}throw r}}else await aa(this,t,i,!0),this.l=await r.createTextToSpeech("/model.litertlm",this.A,this.defaultVoiceId,this.defaultLocale,this.speakingRate,this.targetBucket,this.cacheDirectory);this.j?.X()}D(){}la(){if(0===this.l)throw Error("TextToSpeech is already closed.");var t=this.h.i;return Sa(this,()=>t.listTextToSpeechVoices(this.l))}ta(t,e){if(0===this.l)throw Error("TextToSpeech is already closed.");var r=this.h.i;return Sa(this,()=>r.synthesizeTextToSpeech(this.l,t,e?.voiceId??"",e?.locale??""))}async ua(t="",e,r=!0){if(0===this.l)throw Error("TextToSpeech is already closed.");var i=this.h.i,n=await Sa(this,()=>i.startTextToSpeechStream(this.l,t,e?.voiceId??"",e?.locale??"",r));return new ya(n,i,t=>Sa(this,t))}cancel(){this.F||0===this.l||this.h.i.cancelTextToSpeech(this.l)}close(){if(!this.F){this.F=!0;var t=this.h.i;if(0!==this.l){try{t.deleteTextToSpeech(this.l)}catch{}this.l=0}var e=this.B||this.m;if(0!==e){try{t._free(e)}catch{}this.B=this.m=0}super.close(),t&&!ba.includes(t)&&ba.push(t)}}};Ta.prototype.close=Ta.prototype.close,Ta.prototype.cancel=Ta.prototype.cancel,Ta.prototype.synthesizeStream=Ta.prototype.ua,Ta.prototype.synthesize=Ta.prototype.ta,Ta.prototype.listVoices=Ta.prototype.la,Ta.prototype.setOptions=Ta.prototype.C,Ta.createFromModelBuffer=function(t,e){return wa(t,{baseOptions:{modelAssetBuffer:e}})},Ta.createFromModelPath=function(t,e){return wa(t,{baseOptions:{modelAssetPath:e}})},Ta.createFromOptions=wa;var _a,Ia=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 Ea(t){if(t)return!0;if(void 0===_a)try{await WebAssembly.instantiate(Ia),_a=!0}catch{_a=!1}return _a}async function ja(t,e,r){return{wasmLoaderPath:`${e}/${t}_${r=`wasm${r?"_module":""}${await Ea(r)?"":"_nosimd"}_internal`}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`}}var Ba=class{};Ba.forVisionTasks=function(t,e=!1){return ja("vision",t??Fn``,e)},Ba.forLiteRtLmTextTasks=function(t,e=!1){return ja("litertlm_text",t??Fn``,e)},Ba.forTextTasks=function(t,e=!1){return ja("text",t??Fn``,e)},Ba.forRetrievalTasks=function(t,e=!1){return ja("retrieval",t??Fn``,e)},Ba.forGenAiTasks=function(t,e=!1){return ja("genai",t??Fn``,e)},Ba.forDecisionTasks=function(t,e=!1){return ja("decision",t??Fn``,e)},Ba.forAudioTasks=function(t,e=!1){return ja("audio",t??Fn``,e)},Ba.isSimdSupported=function(t=!1){return Ea(t)},exports.AudioClassifier=fa,exports.AudioTaskRunner=la,exports.AudioTranscriber=ga,exports.FilesetResolver=Ba,exports.TaskRunner=ua,exports.TextToSpeech=Ta,exports.TextToSpeechStream=ya;
|
|
1
|
+
"use strict";var t="undefined"!=typeof self?self:{};function e(){throw Error("Invalid UTF8")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}var i,n,o=void 0,s="undefined"!=typeof TextDecoder,a="undefined"!=typeof TextEncoder;function u(t){if(a)t=(n||=new TextEncoder).encode(t);else{let r=0,i=new Uint8Array(3*t.length);for(let n=0;n<t.length;n++){var e=t.charCodeAt(n);if(e<128)i[r++]=e;else{if(e<2048)i[r++]=e>>6|192;else{if(e>=55296&&e<=57343){if(e<=56319&&n<t.length){let o=t.charCodeAt(++n);if(o>=56320&&o<=57343){e=1024*(e-55296)+o-56320+65536,i[r++]=e>>18|240,i[r++]=e>>12&63|128,i[r++]=e>>6&63|128,i[r++]=63&e|128;continue}n--}e=65533}i[r++]=e>>12|224,i[r++]=e>>6&63|128}i[r++]=63&e|128}}t=r===i.length?i:i.subarray(0,r)}return t}function h(){var e=t.navigator;return e&&(e=e.userAgent)?e:""}function l(t){return l[" "](t),t}l[" "]=function(){};var c={},f=null;function d(t){var e=t.length,r=3*e/4;r%3?r=Math.floor(r):-1!="=.".indexOf(t[e-1])&&(r=-1!="=.".indexOf(t[e-2])?r-2:r-1);var i=new Uint8Array(r),n=0;return function(t,e){function r(e){for(;i<t.length;){let e=t.charAt(i++),r=f[e];if(null!=r)return r;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return e}p();for(var i=0;;){let t=r(-1),i=r(0),n=r(64),o=r(64);if(64===o&&-1===t)break;e(t<<2|i>>4),64!=n&&(e(i<<4&240|n>>2),64!=o&&e(n<<6&192|o))}}(t,function(t){i[n++]=t}),n!==r?i.subarray(0,n):i}function p(){if(!f){f={};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"];for(let r=0;r<5;r++){let i=t.concat(e[r].split(""));c[r]=i;for(let t=0;t<i.length;t++){let e=i[t];void 0===f[e]&&(f[e]=t)}}}}var v="undefined"!=typeof Uint8Array,g=!(-1!=h().indexOf("Trident")||-1!=h().indexOf("MSIE"))&&"function"==typeof btoa,m=/[-_.]/g,y={"-":"+",_:"/",".":"="};function b(t){return y[t]||""}function w(t){if(!g)return d(t);t=m.test(t)?t.replace(m,b):t,t=atob(t);var e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}var S={};function A(){return _||=new I(null,S)}function T(t){j(S);var e=t.h;return null==(e=null==e||v&&null!=e&&e instanceof Uint8Array?e:"string"==typeof e?w(e):null)?e:t.h=e}var _,I=class{constructor(t,e){if(j(e),this.h=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}};function j(t){if(t!==S)throw Error("illegal external caller")}function E(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}var x,B,P=void 0;function U(t){return E(t=Error(t),"warning"),t}function L(e,r){if(null!=e){var i=P??={},n=i[e]||0;n>=r||(i[e]=n+1,E(e=Error(),"incident"),function(e){t.setTimeout(()=>{throw e},0)}(e))}}t:{for(var O=["CLOSURE_FLAGS"],k=t,N=0;N<O.length;N++)if(null==(k=k[O[N]])){B=null;break t}B=k}var F=B&&B[748402147];function V(){return"function"==typeof BigInt}x=null==F||F;var D="function"==typeof Symbol&&"symbol"==typeof Symbol();function M(t,e,r=!1){return"function"==typeof Symbol&&"symbol"==typeof Symbol()?r&&Symbol.for&&t?Symbol.for(t):null!=t?Symbol(t):Symbol():e}var G,R=M("jas",void 0,!0),C=M(void 0,"1oa"),z=M(void 0,Symbol()),W=M(void 0,"0ubs"),H=M(void 0,"0ubsb"),$=M(void 0,"0actk"),K=M("m_m","za",!0),q={ka:{value:0,configurable:!0,writable:!0,enumerable:!1}},J=Object.defineProperties,Y=D?R:"ka",X=[];function Z(t,e){D||Y in t||J(t,q),t[Y]|=e}function Q(t,e){D||Y in t||J(t,q),t[Y]=e}function tt(t,e){return 2&e&&(t|=2),1|t}Q(X,7),G=Object.freeze(X);var et={};function rt(t,e){return void 0===e?t.h!==it&&!!(2&t.o[Y]):!!(2&e)&&t.h!==it}var it={};function nt(t,e){if(null!=t)if("string"==typeof t)t=t?new I(t,S):A();else if(!(t instanceof I))if(v&&null!=t&&t instanceof Uint8Array)t=t.length?new I(new Uint8Array(t),S):A();else{if(!e)throw Error();t=void 0}return t}function ot(t,e,r){var i,n=128&e?0:-1,o=t.length;(i=!!o)&&(i=null!=(i=t[o-1])&&"object"==typeof i&&i.constructor===Object);var s=o+(i?-1:0);for(e=128&e?1:0;e<s;e++)r(e-n,t[e]);if(i){t=t[o-1];for(let e in t)!isNaN(e)&&r(+e,t[e])}}Object.freeze({});var st={};function at(t){return 128&t?st:void 0}function ut(t){return t.xa=!0,t}var ht=ut(t=>"number"==typeof t),lt=ut(t=>"string"==typeof t),ct=ut(t=>"boolean"==typeof t),ft="function"==typeof t.BigInt&&"bigint"==typeof t.BigInt(0);function dt(t){var e=t;if(lt(e)){if(!/^\s*(?:-?[1-9]\d*|0)?\s*$/.test(e))throw Error(String(e))}else if(ht(e)&&!Number.isSafeInteger(e))throw Error(String(e));return ft?BigInt(t):t=ct(t)?t?"1":"0":lt(t)?t.trim()||"0":String(t)}var pt=ut(t=>ft?t>=gt&&t<=yt:"-"===t[0]?bt(t,vt):bt(t,mt)),vt=Number.MIN_SAFE_INTEGER.toString(),gt=ft?BigInt(Number.MIN_SAFE_INTEGER):void 0,mt=Number.MAX_SAFE_INTEGER.toString(),yt=ft?BigInt(Number.MAX_SAFE_INTEGER):void 0;function bt(t,e){if(t.length>e.length)return!1;if(t.length<e.length||t===e)return!0;for(let r=0;r<t.length;r++){let i=t[r],n=e[r];if(i>n)return!1;if(i<n)return!0}}var wt,St="function"==typeof Uint8Array.prototype.slice,At=0,Tt=0;function _t(t){var e=t>>>0;At=e,Tt=(t-e)/4294967296>>>0}function It(t){if(t<0){_t(-t);let[e,r]=Ot(At,Tt);At=e>>>0,Tt=r>>>0}else _t(t)}function jt(t,e){var r=4294967296*e+(t>>>0);return Number.isSafeInteger(r)?r:Bt(t,e)}function Et(t,e){return dt(V()?BigInt.asUintN(64,(BigInt(e>>>0)<<BigInt(32))+BigInt(t>>>0)):Bt(t,e))}function xt(t,e){return V()?dt(BigInt.asIntN(64,(BigInt.asUintN(32,BigInt(e))<<BigInt(32))+BigInt.asUintN(32,BigInt(t)))):dt(Ut(t,e))}function Bt(t,e){if(t>>>=0,(e>>>=0)<=2097151)var r=""+(4294967296*e+t);else V()?r=""+(BigInt(e)<<BigInt(32)|BigInt(t)):(t=(16777215&t)+6777216*(r=16777215&(t>>>24|e<<8))+6710656*(e=e>>16&65535),r+=8147497*e,e*=2,t>=1e7&&(r+=t/1e7>>>0,t%=1e7),r>=1e7&&(e+=r/1e7>>>0,r%=1e7),r=e+Pt(r)+Pt(t));return r}function Pt(t){return t=String(t),"0000000".slice(t.length)+t}function Ut(t,e){if(2147483648&e)if(V())t=""+(BigInt(0|e)<<BigInt(32)|BigInt(t>>>0));else{let[r,i]=Ot(t,e);t="-"+Bt(r,i)}else t=Bt(t,e);return t}function Lt(t){if(t.length<16)It(Number(t));else if(V())t=BigInt(t),At=Number(t&BigInt(4294967295))>>>0,Tt=Number(t>>BigInt(32)&BigInt(4294967295));else{let e=+("-"===t[0]);Tt=At=0;let r=t.length;for(let i=e,n=(r-e)%6+e;n<=r;i=n,n+=6){let e=Number(t.slice(i,n));Tt*=1e6,(At=1e6*At+e)>=4294967296&&(Tt+=Math.trunc(At/4294967296),Tt>>>=0,At>>>=0)}if(e){let[t,e]=Ot(At,Tt);At=t,Tt=e}}}function Ot(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function kt(t){return Array.prototype.slice.call(t)}var Nt="function"==typeof BigInt?BigInt.asIntN:void 0,Ft="function"==typeof BigInt?BigInt.asUintN:void 0,Vt=Number.isSafeInteger,Dt=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}var Rt=/^-?([1-9][0-9]*|0)(\.[0-9]+)?$/;function Ct(t){switch(typeof t){case"bigint":return!0;case"number":return Dt(t);case"string":return Rt.test(t);default:return!1}}function zt(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Dt(t)?0|t:void 0}function Wt(t){var e=t.length;return("-"===t[0]?e<20||20===e&&t<="-9223372036854775808":e<19||19===e&&t<="9223372036854775807")?t:(Lt(t),Ut(At,Tt))}function Ht(t){if("-"===t[0])var e=!1;else e=(e=t.length)<20||20===e&&t<="18446744073709551615";return e?t:(Lt(t),Bt(At,Tt))}function $t(t){if(t=Mt(t),!Vt(t)){It(t);var e=At,r=Tt;(t=2147483648&r)&&(r=~r>>>0,0==(e=1+~e>>>0)&&(r=r+1>>>0)),t="number"==typeof(e=jt(e,r))?t?-e:e:t?"-"+e:e}return t}function Kt(t){return t=Mt(t),Vt(t)?t=String(t):(It(t),t=Ut(At,Tt)),t}function qt(t){var e=Mt(Number(t));return Vt(e)?String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Wt(t))}function Jt(t){var e=Mt(Number(t));return Vt(e)?dt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),V()?dt(Nt(64,BigInt(t))):dt(Wt(t)))}function Yt(t){var e=typeof t;return null==t?t:"bigint"===e?dt(Nt(64,t)):Ct(t)?"string"===e?Jt(t):dt(Vt(t)?t:Kt(t)):void 0}function Xt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(Nt(64,t));if(Ct(t)){if("string"===e)return qt(t);if("number"===e)return $t(t)}}function Zt(t){if(null==t)return t;var e=typeof t;if("bigint"===e)return String(Ft(64,t));if(Ct(t)){if("string"===e)return function(t){var e=Mt(Number(t));return Vt(e)&&e>=0?String(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),Ht(t))}(t);if("number"===e)return function(t){return(t=Mt(t))>=0&&Vt(t)||(It(t),t=jt(At,Tt)),t}(t)}}function Qt(t){if(null==t||"string"==typeof t||t instanceof I)return t}function te(t){if("string"!=typeof t)throw Error();return t}function ee(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function re(t){return null==t||"string"==typeof t?t:void 0}function ie(t,e,r){if(null!=t&&t[K]===et)return t;if(Array.isArray(t)){var i=0|t[Y];return(r=i|32&r|2&r)!==i&&Q(t,r),new e(t)}}function ne(t){return t}function oe(t){return z?t[z]:void 0}function se(t,e){for(let r in t)!isNaN(r)&&e(t,+r,t[r])}var ae,ue,he,le=class{};function ce(t,e){e<100||L(W,1)}function fe(t,e,r,i){var n=void 0!==i;i=!!i;var o,s=z;!n&&D&&s&&(o=t[s])&&se(o,ce),s=[];var a=t.length;o=4294967295;var u=!1,h=!!(64&e),l=h?128&e?0:-1:void 0;if(!(1&e)){var c=a&&t[a-1];null!=c&&"object"==typeof c&&c.constructor===Object?o=--a:c=void 0,!h||128&e||n||(u=!0,o=(ae??ne)(o-l,l,t,c,void 0)+l)}e=void 0;for(var f=0;f<a;f++){let n=t[f];if(null!=n&&null!=(n=r(n,i)))if(h&&f>=o){let t=f-l;(e??={})[t]=n}else s[f]=n}if(c)for(let t in c){if(null==(a=c[t])||null==(a=r(a,i)))continue;let n;f=+t,h&&!Number.isNaN(f)&&(n=f+l)<o?s[n]=a:(e??={})[t]=a}return e&&(u?s.push(e):s[o]=e),n&&z&&(t=oe(t))&&t instanceof le&&(s[z]=function(t){var e=new le;return se(t,(t,r,i)=>{e[r]=kt(i)}),e.h=t.h,e}(t)),s}function de(t){switch(typeof t){case"number":return Number.isFinite(t)?t:""+t;case"bigint":return pt(t)?Number(t):""+t;case"boolean":return t?1:0;case"object":if(Array.isArray(t)){var e=0|t[Y];return 0===t.length&&1&e?void 0:fe(t,e,de)}if(null!=t&&t[K]===et)return pe(t);if(t instanceof I){if(null==(e=t.h))t="";else if("string"==typeof e)t=e;else{if(g){for(var r="",i=0,n=e.length-10240;i<n;)r+=String.fromCharCode.apply(null,e.subarray(i,i+=10240));r+=String.fromCharCode.apply(null,i?e.subarray(i):e),e=btoa(r)}else{void 0===r&&(r=0),p(),r=c[r],i=Array(Math.floor(e.length/3)),n=r[64]||"";let t=0,h=0;for(;t<e.length-2;t+=3){var o=e[t],s=e[t+1],a=e[t+2],u=r[o>>2];o=r[(3&o)<<4|s>>4],s=r[(15&s)<<2|a>>6],a=r[63&a],i[h++]=u+o+s+a}switch(u=0,a=n,e.length-t){case 2:a=r[(15&(u=e[t+1]))<<2]||n;case 1:e=e[t],i[h]=r[e>>2]+r[(3&e)<<4|u>>4]+a+n}e=i.join("")}t=t.h=e}return t}return}return t}function pe(t){return fe(t=t.o,0|t[Y],de)}function ve(t,e){return ge(t,e[0],e[1])}function ge(t,e,r,i=0){if(null==t){var n=32;r?(t=[r],n|=128):t=[],e&&(n=-16760833&n|(1023&e)<<14)}else{if(!Array.isArray(t))throw Error("narr");if(n=0|t[Y],x&&1&n)throw Error("rfarr");if(2048&n&&!(2&n)&&function(){if(x)throw Error("carr");L($,5)}(),256&n)throw Error("farr");if(64&n)return(n|i)!==n&&Q(t,n|i),t;if(r&&(n|=128,r!==t[0]))throw Error("mid");t:{n|=64;var o=(r=t).length;if(o){var s=o-1;let t=r[s];if(null!=t&&"object"==typeof t&&t.constructor===Object){if((s-=e=128&n?0:-1)>=1024)throw Error("pvtlmt");for(var a in t)(o=+a)<s&&(r[o+e]=t[a],delete t[a]);n=-16760833&n|(1023&s)<<14;break t}}if(e){if((a=Math.max(e,o-(128&n?0:-1)))>1024)throw Error("spvt");n=-16760833&n|(1023&a)<<14}}}return Q(t,64|n|i),t}function me(t,e){if("object"!=typeof t)return t;if(Array.isArray(t)){var r=0|t[Y];return 0===t.length&&1&r?t=void 0:2&r||(!e||4096&r||16&r?t=be(t,r,!1,e&&!(16&r)):(Z(t,34),4&r&&Object.freeze(t))),t}return null!=t&&t[K]===et?rt(t,r=0|(e=t.o)[Y])?t:_e(t,e,r)?ye(t,e):be(e,r):t instanceof I?t:void 0}function ye(t,e,r){return t=new t.constructor(e),r&&(t.h=it),t.m=it,t}function be(t,e,r,i){return i??=!!(34&e),t=fe(t,e,me,i),i=32,r&&(i|=2),Q(t,e=16769217&e|i),t}function we(t){var e=t.o,r=0|e[Y];return rt(t,r)?_e(t,e,r)?ye(t,e,!0):new t.constructor(be(e,r,!1)):t}function Se(t){if(t.h!==it)return!1;var e=t.o;return Z(e=be(e,0|e[Y]),2048),t.o=e,t.h=void 0,t.m=void 0,!0}function Ae(t){if(!Se(t)&&rt(t,0|t.o[Y]))throw Error()}function Te(t,e){void 0===e&&(e=0|t[Y]),32&e&&!(4096&e)&&Q(t,4096|e)}function _e(t,e,r){return!!(2&r)||!(!(32&r)||4096&r)&&(Q(e,2|r),t.h=it,!0)}var Ie=dt(0);function je(t,e,r,i){if(null!==(t=Ee(t.o,e,r,i)))return t}function Ee(t,e,r,i){if(-1===e)return null;var n=e+(r?0:-1),o=t.length-1;if(!(o<1+(r?0:-1))){if(n>=o){var s=t[o];if(null!=s&&"object"==typeof s&&s.constructor===Object){r=s[e];var a=!0}else{if(n!==o)return;r=s}}else r=t[n];if(i&&null!=r){if(null==(i=i(r)))return i;if(!Object.is(i,r))return a?s[e]=i:t[n]=i,i}return r}}function xe(t,e,r,i){Ae(t);var n=t.o;return Be(n,0|n[Y],e,r,i),t}function Be(t,e,r,i,n){var o=r+(n?0:-1),s=t.length-1;if(s>=1+(n?0:-1)&&o>=s){let n=t[s];if(null!=n&&"object"==typeof n&&n.constructor===Object)return n[r]=i,e}return o<=s?(t[o]=i,e):(void 0!==i&&(r>=(s=(e??=0|t[Y])>>14&1023||536870912)?null!=i&&(t[s+(n?0:-1)]={[r]:i}):t[o]=i),e)}function Pe(t,e){return null!=(t=Ee(t.o,e))&&t[K]===et||Array.isArray(t)}function Ue(t,e,r,i,n,o,s,a){var u=e,h=Oe(e);return h&&2===o&&(t=kt(t),u=0,e=qe(e,i),i=Be(r,i,n,t),h=!1),h||(1===o||4===o&&(2&e||!(16&e)&&32&i)?((e|=!t.length||s&&!(4096&e)||32&i&&!(4096&e||16&e)?2:256)!==u&&Q(t,e),Object.freeze(t)):(a||(e|=16),e!==u&&Q(t,e))),2&e||!(4096&e||16&e)||Te(r,i),t}function Le(t,e,r){return t=Ee(t,e,r),Array.isArray(t)?t:G}function Oe(t){return!!(2&t)&&!!(4&t)||!!(256&t)}function ke(t){return nt(t,!0)}function Ne(t,e,r){Ae(t);var i=0|(t=t.o)[Y];if(null==r)Be(t,i,e);else{var n=r===G?7:0|r[Y],o=n,s=Oe(n),a=s||Object.isFrozen(r);for(s||(n=0),a||(r=kt(r),o=0,n=qe(n,i),a=!1),n|=5,n|=(4&n?512&n?512:1024&n?1024:0:void 0)??1024,s=0;s<r.length;s++){let t=r[s],e=te(t);Object.is(t,e)||(a&&(r=kt(r),o=0,n=qe(n,i),a=!1),r[s]=e)}n!==o&&(a&&(r=kt(r),n=qe(n,i)),Q(r,n)),Be(t,i,e,r)}}function Fe(t,e,r){if(2&e)throw Error();var i=at(e),n=Le(t,r,i),o=n===G?7:0|n[Y],s=tt(o,e);return(2&s||Oe(s)||16&s)&&(s===o||Oe(s)||Q(n,s),n=kt(n),o=0,s=qe(s,e),Be(t,e,r,n,i)),(s&=-13)!==o&&Q(n,s),n}function Ve(t,e){t=t.o;var r=uo;return Ge(De(t),t,void 0,r)===e?e:-1}function De(t){if(D)return t[C]??(t[C]=new Map);if(C in t)return t[C];var e=new Map;return Object.defineProperty(t,C,{value:e}),e}function Me(t,e,r,i,n){var o=De(t),s=Ge(o,t,e,r,n);return s!==i&&(s&&(e=Be(t,e,s,void 0,n)),o.set(r,i)),e}function Ge(t,e,r,i,n){var o=t.get(i);if(null!=o)return o;o=0;for(let t=0;t<i.length;t++){let s=i[t];null!=Ee(e,s,n)&&(0!==o&&(r=Be(e,r,o,void 0,n)),o=s)}return t.set(i,o),o}function Re(t,e,r){var i=0|t[Y],n=at(i),o=Ee(t,r,n);if(null!=o&&o[K]===et){if(!rt(o))return Se(o),o.o;var s=o.o}else Array.isArray(o)&&(s=o,2&i&&Z(s,34));if(s){let t=0|s[Y];2&t&&(s=be(s,t))}return(s=ve(s,e))!==o&&Be(t,i,r,s,n),s}function Ce(t,e,r){var i=t.o,n=0|i[Y];if(e=function(t,e,r,i){var n=!1;if(null!=(i=Ee(t,i,void 0,t=>{var i=ie(t,r,e);return n=i!==t&&null!=i,i})))return n&&!rt(i)&&Te(t,e),i}(i,n,e,r),null==e)return e;if(!rt(t,n=0|i[Y])){let o=we(e);o!==e&&(Se(t)&&(n=0|(i=t.o)[Y]),Te(i,n=Be(i,n,r,e=o)))}return e}function ze(t,e,r,i,n,o,s,a){o=o&&4!==o?1!==o&&(t?rt(t,r):2&r)?1:o:4,s=!!s||3===o;var u=!!a&&!(t?rt(t,r):2&r);(2===o||u)&&t&&Se(t)&&(r=0|(e=t.o)[Y]);var h=(t=Le(e,n))===G?7:0|t[Y],l=tt(h,r);if(a=!(4&l)){var c=t,f=r;let e=!!(2&l);e&&(f|=2);let n=!e,o=!0,s=0,a=0;for(;s<c.length;s++){let t=ie(c[s],i,f);if(t instanceof i){if(!e){let e=rt(t);n&&=!e,o&&=e}c[a++]=t}}a<s&&(c.length=a),l|=4,l=o?-4097&l:4096|l,l=n?8|l:-9&l}if(l!==h&&(Q(t,l),2&l&&Object.freeze(t)),u&&!(8&l||!t.length&&(1===o||4===o&&(2&l||!(16&l)&&32&r)))){for(Oe(l)&&(t=kt(t),l=qe(l,r),r=Be(e,r,n,t)),i=t,u=l,h=0;h<i.length;h++)(c=i[h])!==(l=we(c))&&(i[h]=l);u|=8,Q(t,l=u=i.length?4096|u:-4097&u)}return Ue(t,l,e,r,n,o,a,s)}function We(t,e){var r=t.o;return ze(t,r,0|r[Y],e,1,void 0,!1,!0)}function He(t){return null==t&&(t=void 0),t}function $e(t,e,r,i,n){return xe(t,r,i=He(i),n),i&&!rt(i)&&Te(t.o),t}function Ke(t,e,r,i){t:{var n=i=He(i);Ae(t);let o=t.o,s=0|o[Y];if(null==n){let t=De(o);if(Ge(t,o,s,r)!==e)break t;t.set(r,0)}else s=Me(o,s,r,e);Be(o,s,e,n)}return i&&!rt(i)&&Te(t.o),t}function qe(t,e){return-273&(2&e?2|t:-3&t)}function Je(t,e,r,i){Ae(t);var n=t.o;t=ze(t,n,0|n[Y],r,e,2,!0),i=null!=i?i:new r,t.push(i),e=r=t===G?7:0|t[Y],(i=rt(i))?(r&=-9,1===t.length&&(r&=-4097)):r|=4096,r!==e&&Q(t,r),i||Te(n)}function Ye(t,e,r){if(null!=r)t:{if(!Ct(r))throw U("int64");switch(typeof r){case"string":r=Jt(r);break t;case"bigint":r=dt(Nt(64,r));break t;default:r=dt(Vt(r)?r:Kt(r))}}return xe(t,e,r)}function Xe(t,e,r){return xe(t,e,null==r?r:function(t){if(!Ct(t))throw U("uint64");var e=typeof t;switch(e){case"string":return e=Mt(Number(t)),Vt(e)&&e>=0?t=dt(e):(-1!==(e=t.indexOf("."))&&(t=t.substring(0,e)),t=V()?dt(Ft(64,BigInt(t))):dt(Ht(t))),t;case"bigint":return dt(Ft(64,t));default:return t>=0&&Vt(t)||((t=Mt(t))>=0&&Vt(t)?t=String(t):(It(t),t=Bt(At,Tt))),dt(t)}}(r))}function Ze(t,e,r){if(null!=r){if(!Dt(r))throw U("enum");r|=0}return xe(t,e,r)}function Qe(t,e,r){Ae(t);var i=t.o,n=0|i[Y],o=(t?rt(t,n):2&n)?1:2;2===o&&Se(t)&&(n=0|(i=t.o)[Y]);var s,a=(t=Le(i,e))===G?7:0|t[Y],u=tt(a,n);if(s=!(4&u)){let e=0,r=0;for(;e<t.length;e++){let i=re(t[e]);null!=i&&(t[r++]=i)}r<e&&(t.length=r),u=-513&u|4,u&=-1025,u&=-4097}u!==a&&(Q(t,u),2&u&&Object.freeze(t)),(t=Ue(t,u,i,n,e,o,s,!0)).push(te(r))}var tr=class{constructor(t,e,r){if(this.buffer=t,r&&!e)throw Error();this.h=e}};function er(t,e){if("string"==typeof t)return new tr(w(t),e);if(Array.isArray(t))return new tr(new Uint8Array(t),e);if(t.constructor===Uint8Array)return new tr(t,!1);if(t.constructor===ArrayBuffer)return t=new Uint8Array(t),new tr(t,!1);if(t.constructor===I)return e=T(t)||new Uint8Array(0),new tr(e,!0,t);if(t instanceof Uint8Array)return t=t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new tr(t,!1);throw Error()}function rr(t,e){var r=0,i=0,n=0,o=t.j,s=t.h;do{var a=o[s++];r|=(127&a)<<n,n+=7}while(n<32&&128&a);if(n>32)for(i|=(127&a)>>4,n=3;n<32&&128&a;n+=7)i|=(127&(a=o[s++]))<<n;if(ur(t,s),!(128&a))return e(r>>>0,i>>>0);throw Error()}function ir(t){for(var e=0,r=t.h,i=r+10,n=t.j;r<i;){let i=n[r++];if(e|=i,!(128&i))return ur(t,r),!!(127&e)}throw Error()}function nr(t){var e=t.j,r=t.h,i=e[r++],n=127&i;if(128&i&&(n|=(127&(i=e[r++]))<<7,128&i&&(n|=(127&(i=e[r++]))<<14,128&i&&(n|=(127&(i=e[r++]))<<21,128&i&&(n|=(i=e[r++])<<28,128&i&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++]&&128&e[r++])))))throw Error();return ur(t,r),n}function or(t){return rr(t,xt)}function sr(t){var e=t.j,r=t.h,i=e[r],n=e[r+1],o=e[r+2];return e=e[r+3],ur(t,t.h+4),(i|n<<8|o<<16|e<<24)>>>0}function ar(t){return nr(t)}function ur(t,e){if(t.h=e,e>t.l)throw Error()}function hr(t,e){if(e<0)throw Error();var r=t.h;if((e=r+e)>t.l)throw Error();return t.h=e,r}function lr(t,e){if(0==e)return A();var r=hr(t,e);return t.T&&t.u?r=t.j.subarray(r,r+e):(t=t.j,r=r===(e=r+e)?new Uint8Array(0):St?t.slice(r,e):new Uint8Array(t.subarray(r,e))),0==r.length?A():new I(r,S)}var cr=class{constructor(t,e,r,i){this.j=null,this.u=!1,this.h=this.l=this.m=0,this.init(t,e,r,i)}init(t,e,r,{T:i=!1,X:n=!1}={}){this.T=i,this.X=n,t&&(t=er(t,this.X),this.j=t.buffer,this.u=t.h,this.m=e||0,this.l=void 0!==r?this.m+r:this.j.length,this.h=this.m)}clear(){this.j=null,this.u=!1,this.h=this.l=this.m=0,this.T=!1}},fr=[],dr=0;function pr(t,e,r,i){if(_r.length){let n=_r.pop();return n.v(i),n.h.init(t,e,r,i),n}return new Tr(t,e,r,i)}function vr(t){t.h.clear(),t.l=-1,t.j=-1,_r.length<100&&_r.push(t)}function gr(t){var e=t.h;if(e.h==e.l)return!1;t.m=t.h.h;var r=nr(t.h)>>>0;if(e=r>>>3,!((r&=7)>=0&&r<=5))throw Error();if(e<1)throw Error();return t.l=e,t.j=r,!0}function mr(t){try{switch(t.j){case 0:0!=t.j?mr(t):ir(t.h);break;case 1:var e=t.h;ur(e,e.h+8);break;case 2:if(2!=t.j)mr(t);else{var r=nr(t.h)>>>0,i=t.h;ur(i,i.h+r)}break;case 5:var n=t.h;ur(n,n.h+4);break;case 3:yr();let o=t.l;try{for(;;){if(!gr(t))throw Error();if(4==t.j){if(t.l!=o)throw Error();break}mr(t)}}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{dr>0&&dr--}break;default:throw Error()}}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}}function yr(){if(dr>=100)throw new SyntaxError;dr++}function br(t,e,r){var i=t.h.l,n=nr(t.h)>>>0,o=(n=t.h.h+n)-i;if(o<=0&&(t.h.l=n,r(e,t,void 0,void 0,void 0),o=n-t.h.h),o)throw Error();t.h.h=n,t.h.l=i}function wr(t){var n=nr(t.h)>>>0,a=hr(t=t.h,n);if(t=t.j,s){var u,h=t;(u=i)||(u=i=new TextDecoder("utf-8",{fatal:!0})),n=a+n,h=0===a&&n===h.length?h:h.subarray(a,n);try{var l=u.decode(h)}catch(t){if(void 0===o){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),o=!0}catch(t){o=!1}}throw!o&&(i=void 0),t}}else{n=(l=a)+n,a=[];let i,o=null;for(;l<n;){var c=t[l++];c<128?a.push(c):c<224?l>=n?e():(i=t[l++],c<194||128!=(192&i)?(l--,e()):a.push((31&c)<<6|63&i)):c<240?l>=n-1?e():(i=t[l++],128!=(192&i)||224===c&&i<160||237===c&&i>=160||128!=(192&(u=t[l++]))?(l--,e()):a.push((15&c)<<12|(63&i)<<6|63&u)):c<=244?l>=n-2?e():(i=t[l++],128!=(192&i)||i-144+(c<<28)>>30||128!=(192&(u=t[l++]))||128!=(192&(h=t[l++]))?(l--,e()):(c=(7&c)<<18|(63&i)<<12|(63&u)<<6|63&h,c-=65536,a.push(55296+(c>>10&1023),56320+(1023&c)))):e(),a.length>=8192&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function Sr(t){var e=nr(t.h)>>>0;return lr(t.h,e)}function Ar(t,e,r){var i=nr(t.h)>>>0;for(i=t.h.h+i;t.h.h<i;)r.push(e(t.h))}var Tr=class{constructor(t,e,r,i){if(fr.length){let n=fr.pop();n.init(t,e,r,i),t=n}else t=new cr(t,e,r,i);this.h=t,this.m=this.h.h,this.j=this.l=-1,this.v(i)}v({aa:t=!1}={}){this.aa=t}},_r=[];function Ir(t){return new xr(4294967295&t,Math.floor(t/4294967296))}function jr(t){return t?/^\d+$/.test(t)?(Lt(t),new xr(At,Tt)):null:Er||=new xr(0,0)}var Er,xr=class{constructor(t,e){this.j=t>>>0,this.h=e>>>0}};function Br(t){return new Mr(4294967295&t,Math.floor(t/4294967296))}function Pr(t){return t?/^-?\d+$/.test(t)?(Lt(t),new Mr(At,Tt)):null:Ur||=new Mr(0,0)}var Ur,Lr,Or,kr,Nr,Fr,Vr,Dr,Mr=class{constructor(t,e){this.j=t>>>0,this.h=e>>>0}};function Gr(t,e,r){return"undefined"!=typeof BigInt64Array?(Vr||(Vr=new BigInt64Array(1),Dr=new Uint32Array(Vr.buffer),Vr[0]=BigInt(1),Fr=1===Dr[0]),Vr[0]=t,new e(Dr[t=Fr?0:1],Dr[1-t])):(Nr||(Lr=BigInt(Number.MIN_SAFE_INTEGER),Or=BigInt(Number.MAX_SAFE_INTEGER),kr=BigInt(4294967295),Nr=BigInt(32)),t>=Lr&&t<=Or?r(Number(t)):(t=BigInt.asUintN(64,t),new e(Number(t&kr),Number(t>>Nr))))}function Rr(t,e,r){for(;r>0||e>127;)t.h.push(127&e|128),e=(e>>>7|r<<25)>>>0,r>>>=7;t.h.push(e)}function Cr(t,e){for(;e>127;)t.h.push(127&e|128),e>>>=7;t.h.push(e)}function zr(t,e){if(e>=0)Cr(t,e);else{for(let r=0;r<9;r++)t.h.push(127&e|128),e>>=7;t.h.push(1)}}function Wr(t,e){Lt(e),function(t){var e=Tt>>31;t(At<<1^e,(Tt<<1|At>>>31)^e)}((e,r)=>{Rr(t,e>>>0,r>>>0)})}function Hr(t,e){t.h.push(e>>>0&255),t.h.push(e>>>8&255),t.h.push(e>>>16&255),t.h.push(e>>>24&255)}var $r=class{constructor(){this.h=[]}length(){return this.h.length}end(){var t=this.h;return this.h=[],t}};function Kr(t,e){0!==e.length&&(t.l.push(e),t.j+=e.length)}function qr(t,e,r){Cr(t.h,8*e+r)}function Jr(t,e){return qr(t,e,2),e=t.h.end(),Kr(t,e),e.push(t.j),e}function Yr(t,e){var r=e.pop();for(r=t.j+t.h.length()-r;r>127;)e.push(127&r|128),r>>>=7,t.j++;e.push(r),t.j++}function Xr(t,e,r){if(null!=r)switch(qr(t,e,0),typeof r){case"number":t=t.h,It(r),Rr(t,At,Tt);break;case"bigint":r=Gr(r,Mr,Br),Rr(t.h,r.j,r.h);break;default:r=Pr(r),Rr(t.h,r.j,r.h)}}function Zr(t,e,r){qr(t,e,2),Cr(t.h,r.length),Kr(t,t.h.end()),Kr(t,r)}var Qr=class{constructor(){this.l=[],this.j=0,this.h=new $r}};function ti(t){if("string"==typeof t)Pr(t)}function ei(){var t=class{constructor(){throw Error()}};return Object.setPrototypeOf(t,t.prototype),t}var ri=ei(),ii=ei(),ni=ei(),oi=ei(),si=ei(),ai=ei(),ui=ei(),hi=ei(),li=ei(),ci=ei(),fi=ei(),di=ei();var pi=class{constructor(t,e){this.o=ge(t,e,void 0,2048)}toJSON(){return pe(this)}};pi.prototype[K]=et,pi.prototype.toString=function(){return this.o.toString()};var vi=class{constructor(t,e,r){this.h=t,this.j=e,t=ri,this.l=!!t&&r===t||!1}};function gi(t,e){return new vi(t,e,ri)}function mi(t,e,r,i,n){null!=(e=Bi(e,i))&&(r=Jr(t,r),n(e,t),Yr(t,r))}var yi,bi,wi=gi(function(t,e,r,i,n){return 2===t.j&&(br(t,Re(e,i,r),n),!0)},mi),Si=gi(function(t,e,r,i,n){return 2===t.j&&(br(t,Re(e,i,r),n),!0)},mi),Ai=Symbol(),Ti=Symbol(),_i=Symbol(),Ii=Symbol(),ji=Symbol();function Ei(t,e,r,i){var n=i[t];if(n)return n;(n={}).fa=i,n.P=function(t){switch(typeof t){case"boolean":return ue||=[0,void 0,!0];case"number":return t>0?void 0:0===t?he||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}(i[0]);var o=i[1],s=1;o&&o.constructor===Object&&(n.U=o,"function"==typeof(o=i[++s])&&(n.ba=!0,yi??=o,bi??=i[s+1],o=i[s+=2]));for(var a={};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=i[++s]}for(u=1;void 0!==o;){let t;"number"==typeof o&&(u+=o,o=i[++s]);var h=void 0;if(o instanceof vi?t=o:(t=wi,s--),t?.l){o=i[++s],h=i;var l=s;"function"==typeof o&&(o=o(),h[l]=o),h=o}for(l=u+1,"number"==typeof(o=i[++s])&&o<0&&(l-=o,o=i[++s]);u<l;u++){let i=a[u];h?r(n,u,t,h,i):e(n,u,t,i)}}return i[t]=n}function xi(t){return Array.isArray(t)?t[0]instanceof vi?t:[Si,t]:[t,void 0]}function Bi(t,e){return t instanceof pi?t.o:Array.isArray(t)?ve(t,e):void 0}function Pi(t,e,r,i){var n=r.h;t[e]=i?(t,e,r)=>n(t,e,r,i):n}function Ui(t,e,r,i,n){var o,s,a=r.h;t[e]=(t,e,r)=>a(t,e,r,s||=Ei(Ti,Pi,Ui,i).P,o||=Li(i),n)}function Li(t){var e=t[_i];if(null!=e)return e;var r=Ei(Ti,Pi,Ui,t);return e=r.ba?(t,e)=>yi(t,e,r):(t,e)=>{t:{yr();try{for(;gr(e)&&4!=e.j;){let u=e.l,h=r[u];if(null==h){let t=r.U;if(t){let e=t[u];if(e){let t=ki(e);null!=t&&(h=r[u]=t)}}}if(null==h||!h(e,t,u)){var i=e;let r=i.m;if(mr(i),i.aa)var n=void 0;else{let t=i.h.h-r;i.h.h=r,n=lr(i.h,t)}i=void 0;var o=t,s=u,a=n;a&&((i=o[z]??(o[z]=new le))[s]??(i[s]=[])).push(a)}}let h=oe(t);h&&(h.h=r.fa[ji]);var u=!0;break t}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{dr>0&&dr--}u=void 0}return u},t[_i]=e,t[ji]=Oi.bind(t),e}function Oi(t,e,r,i){var n=this[Ti],o=this[_i],s=ve(void 0,n.P),a=oe(t);if(a){var u=!1,h=n.U;if(h){if(n=(e,r,n)=>{if(0!==n.length)if(h[r])for(let t of n){e=pr(t);try{u=!0,o(s,e)}finally{vr(e)}}else i?.(t,r,n)},null==e)se(a,n);else if(null!=a){let t=a[e];t&&n(a,e,t)}if(u){let i=0|t[Y];if(2&i&&2048&i&&!r?.Ba)throw Error();let n=at(i),o=(e,o)=>{if(null!=Ee(t,e,n)){if(1===r?.Aa)return;throw Error()}null!=o&&(i=Be(t,i,e,o,n)),delete a[e]};null==e?ot(s,0|s[Y],(t,e)=>{o(t,e)}):o(e,Ee(s,e,n))}}}}function ki(t){var e=(t=xi(t))[0].h;if(t=t[1]){let r=Li(t),i=Ei(Ti,Pi,Ui,t).P;return(t,n,o)=>e(t,n,o,i,r)}return e}function Ni(t,e,r){t[e]=r.j}function Fi(t,e,r,i){var n,o,s=r.j;t[e]=(t,e,r)=>s(t,e,r,o||=Ei(Ai,Ni,Fi,i).P,n||=Vi(i))}function Vi(t){var e=t[Ii];if(!e){let r=Ei(Ai,Ni,Fi,t);e=(t,e)=>Di(t,e,r),t[Ii]=e}return e}function Di(t,e,r){ot(t,0|t[Y],(t,i)=>{if(null!=i){var n=function(t,e){var r=t[e];if(r)return r;if((r=t.U)&&(r=r[e])){var i=(r=xi(r))[0].j;if(r=r[1]){let e=Vi(r),n=Ei(Ai,Ni,Fi,r).P;r=t.ba?bi(n,e):(t,r,o)=>i(t,r,o,n,e)}else r=i;return t[e]=r}}(r,t);n?n(e,i,t):t<500||L(H,3)}}),(t=oe(t))&&se(t,(t,r,i)=>{for(Kr(e,e.h.end()),t=0;t<i.length;t++)Kr(e,T(i[t])||new Uint8Array(0))})}var Mi=dt(0);function Gi(t,e,r){if(Array.isArray(e)){var i=0|e[Y];if(4&i)return e;for(var n=0,o=0;n<e.length;n++){let r=t(e[n]);null!=r&&(e[o++]=r)}return o<n&&(e.length=o),t=1|i,r&&(t=-1537&t|4),t!==i&&Q(e,t),r&&2&t&&Object.freeze(e),e}}var Ri=(t,e)=>{var r=new Qr;Di(t.o,r,Ei(Ai,Ni,Fi,e)),Kr(r,r.h.end()),t=new Uint8Array(r.j);var i=(e=r.l).length,n=0;for(let r=0;r<i;r++){let i=e[r];t.set(i,n),n+=i.length}return r.l=[t],t};function Ci(t,e,r){return new vi(t,e,r)}function zi(t,e,r){return new vi(t,e,r)}function Wi(t,e,r){Be(t,0|t[Y],e,r,at(0|t[Y]))}function Hi(t,e,r){null!=(e=Xt(e))&&(ti(e),Xr(t,r,e))}function $i(t,e,r){null!=(e=zt(e))&&null!=e&&(qr(t,r,0),zr(t.h,e))}function Ki(t,e,r){null!=(e=null==e||"boolean"==typeof e?e:"number"==typeof e?!!e:void 0)&&(qr(t,r,0),t.h.h.push(e?1:0))}function qi(t,e,r){null!=(e=re(e))&&Zr(t,r,u(e))}function Ji(t,e,r,i,n){null!=(e=Bi(e,i))&&(r=Jr(t,r),n(e,t),Yr(t,r))}function Yi(t,e,r){null!=(e=Qt(e))&&Zr(t,r,er(e,!0).buffer)}function Xi(t,e,r){e=function(t){if(null==t)return t;if("string"==typeof t&&t)t=+t;else if("number"!=typeof t)return;return Dt(t)?t>>>0:void 0}(e),null!=e&&null!=e&&(qr(t,r,0),Cr(t.h,e))}function Zi(t,e,r){null!=(e=zt(e))&&(e=parseInt(e,10),qr(t,r,0),zr(t.h,e))}function Qi(t,e,r){return 0===t.j&&(Wi(e,r,or(t.h)),!0)}function tn(t,e,r){return(0===t.j||2===t.j)&&(e=Fe(e,0|e[Y],r),2==t.j?Ar(t,nr,e):e.push(nr(t.h)),!0)}function en(t,e,r){return 2===t.j&&(Wi(e,r,(t=Sr(t))===A()?void 0:t),!0)}var rn=Ci(function(t,e,r){if(1!==t.j)return!1;var i=t.h;t=sr(i);var n=sr(i);i=2*(n>>31)+1;var o=n>>>20&2047;return t=4294967296*(1048575&n)+t,Wi(e,r,2047==o?t?NaN:i*(1/0):0==o?5e-324*i*t:i*Math.pow(2,o-1075)*(t+4503599627370496)),!0},function(t,e,r){null!=(e=Gt(e))&&(qr(t,r,1),t=t.h,(r=wt||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),At=r.getUint32(0,!0),Tt=r.getUint32(4,!0),Hr(t,At),Hr(t,Tt))},ci),nn=Ci(function(t,e,r){if(5!==t.j)return!1;var i=sr(t.h);t=2*(i>>31)+1;var n=i>>>23&255;return i&=8388607,Wi(e,r,255==n?i?NaN:t*(1/0):0==n?1401298464324817e-60*t*i:t*Math.pow(2,n-150)*(i+8388608)),!0},function(t,e,r){null!=(e=Gt(e))&&(qr(t,r,5),t=t.h,(r=wt||=new DataView(new ArrayBuffer(8))).setFloat32(0,+e,!0),Tt=0,Hr(t,At=r.getUint32(0,!0)))},li),on=Ci(function(t,e,r){return Qi(t,e,r)},Hi,ai),sn=Ci(function(t,e,r){return Qi(t,e,r)},Hi,ai),an=zi(function(t,e,r){return 0!==t.j&&2!==t.j?t=!1:(e=Fe(e,0|e[Y],r),2==t.j?Ar(t,or,e):e.push(or(t.h)),t=!0),t},function(t,e,r){if(null!=(e=Gi(Xt,e,!1)))for(let i=0;i<e.length;i++)Xr(t,r,e[i])},ai),un=Ci(function(t,e,r){return 0!==t.j?e=!1:(Wi(e,r,(t=or(t.h))===Mi?void 0:t),e=!0),e},Hi,ai),hn=Ci(function(t,e,r){return 0!==t.j?t=!1:(Wi(e,r,rr(t.h,Et)),t=!0),t},function(t,e,r){if(null!=(e=Zt(e))){if("string"==typeof e)jr(e);if(null!=e)switch(qr(t,r,0),typeof e){case"number":t=t.h,It(e),Rr(t,At,Tt);break;case"bigint":r=Gr(e,xr,Ir),Rr(t.h,r.j,r.h);break;default:r=jr(e),Rr(t.h,r.j,r.h)}}},ui),ln=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,nr(t.h)),!0)},$i,oi),cn=zi(tn,function(t,e,r){if(null!=(e=Gi(zt,e,!0)))for(let s=0;s<e.length;s++){var i=t,n=r,o=e[s];null!=o&&(qr(i,n,0),zr(i.h,o))}},oi),fn=zi(tn,function(t,e,r){if(null!=(e=Gi(zt,e,!0))&&e.length){r=Jr(t,r);for(let r=0;r<e.length;r++)zr(t.h,e[r]);Yr(t,r)}},oi),dn=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,0===(t=nr(t.h))?void 0:t),!0)},$i,oi),pn=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,ir(t.h)),!0)},Ki,ii),vn=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,!1===(t=ir(t.h))?void 0:t),!0)},Ki,ii),gn=zi(function(t,e,r){return 2===t.j&&(t=wr(t),Fe(e,0|e[Y],r).push(t),!0)},function(t,e,r){if(null!=(e=Gi(re,e,!0)))for(let s=0;s<e.length;s++){var i=t,n=r,o=e[s];null!=o&&Zr(i,n,u(o))}},ni),mn=Ci(function(t,e,r){return 2===t.j&&(Wi(e,r,""===(t=wr(t))?void 0:t),!0)},qi,ni),yn=Ci(function(t,e,r){return 2===t.j&&(Wi(e,r,wr(t)),!0)},qi,ni),bn=function(t,e,r=ri){return new vi(t,e,r)}(function(t,e,r,i,n){return 2===t.j&&(i=ve(void 0,i),Fe(e,0|e[Y],r).push(i),br(t,i,n),!0)},function(t,e,r,i,n){if(Array.isArray(e)){for(let o=0;o<e.length;o++)Ji(t,e[o],r,i,n);1&(t=0|e[Y])||Q(e,1|t)}}),wn=gi(function(t,e,r,i,n,o){if(2!==t.j)return!1;var s=0|e[Y];return Me(e,s,o,r,at(s)),br(t,e=Re(e,i,r),n),!0},Ji),Sn=Ci(function(t,e,r){return 2===t.j&&(Wi(e,r,Sr(t)),!0)},Yi,fi),An=zi(function(t,e,r){return 2===t.j&&(t=Sr(t),Fe(e,0|e[Y],r).push(t),!0)},function(t,e,r){if(null!=(e=Gi(Qt,e,!1)))for(let s=0;s<e.length;s++){var i=t,n=r,o=e[s];null!=o&&Zr(i,n,er(o,!0).buffer)}},fi),Tn=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,nr(t.h)>>>0),!0)},Xi,si),_n=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,0===(t=nr(t.h)>>>0)?void 0:t),!0)},Xi,si),In=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,nr(t.h)),!0)},Zi,di),jn=Ci(function(t,e,r){return 0===t.j&&(Wi(e,r,0===(t=nr(t.h))?void 0:t),!0)},Zi,di),En=Ci(function(t,e,r){return 0!==t.j?t=!1:(Wi(e,r,function(t){return rr(t,(t,e)=>{var r=-(1&t);return xt(t=(t>>>1|e<<31)^r,e>>>1^r)})}(t.h)),t=!0),t},function(t,e,r){if(null!=(e=Xt(e))&&(ti(e),null!=e))switch(qr(t,r,0),typeof e){case"number":t=t.h,e=(r=e)<0,_t(r=2*Math.abs(r)),r=At;let i=Tt;e&&(0==r?0==i?i=r=4294967295:(i--,r=4294967295):r--),Rr(t,At=r,Tt=i);break;case"bigint":t=t.h,e=e<<BigInt(1)^e>>BigInt(63),At=Number(BigInt.asUintN(32,e)),Tt=Number(BigInt.asUintN(32,e>>BigInt(32))),Rr(t,At,Tt);break;default:Wr(t.h,e)}},hi);function xn(t){return function(){return Ri(this,t)}}var Bn,Pn=[0,Sn,An,pn,yn],Un=[0,mn,[0,jn,[0,un,dn],jn,-1,[0,In],jn,-1],Ci(en,Yi,fi)],Ln=[0,mn,Ci(en,function(t,e,r){if(null!=e){if(e instanceof pi){let i=e.Da;return void(i?(e=i(e),null!=e&&Zr(t,r,er(e,!0).buffer)):L(H,3))}if(Array.isArray(e))return void L(H,3)}Yi(t,e,r)},fi)],On=[0,1,[0,12,ln,10,pn],[0,7,[0,ln,-1]]],kn=globalThis.trustedTypes;var Nn=class{constructor(t){this.h=t}toString(){return this.h+""}};function Fn(t){var e;return void 0===Bn&&(Bn=function(){var t=null;if(!kn)return t;try{let e=t=>t;t=kn.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(t){}return t}()),t=(e=Bn)?e.createScriptURL(t):t,new Nn(t)}function Vn(t,...e){if(0===e.length)return Fn(t[0]);var r=t[0];for(let i=0;i<e.length;i++)r+=encodeURIComponent(e[i])+t[i+1];return Fn(r)}var Dn=[0,ln,In,pn,-1,fn,In,-1,pn,-1],Mn=[0,In,-1,pn],Gn=class extends pi{constructor(t){super(t)}},Rn=[0,pn,yn,pn,In,-1,zi(function(t,e,r){return(0===t.j||2===t.j)&&(e=Fe(e,0|e[Y],r),2==t.j?Ar(t,ar,e):e.push(nr(t.h)),!0)},function(t,e,r){if(null!=(e=Gi(zt,e,!0))&&e.length){r=Jr(t,r);for(let r=0;r<e.length;r++)zr(t.h,e[r]);Yr(t,r)}},di),yn,-1,[0,pn,-1],In,pn,-1,Mn],Cn=class extends pi{constructor(t){super(t)}j(){return Pe(this,9)}},zn=[0,3,pn,-1,2,[0,[2],ln,wn,[0,Tn]],[0,In,pn,In,pn,In,4,[0,pn,yn,-1,pn,ln,-1,pn],In,pn,-4,In,gn,pn,gn,pn,-1,ln,pn,-3,[0,pn,ln],[0,yn,ln,-1],[0,pn],[0,pn,-1],[0,pn,ln,-1]],[0,[3,4],yn,-1,wn,[0,ln],wn,[0,In,-2]],[0],yn,pn],Wn=[0,yn,-2],Hn=class extends pi{constructor(t){super(t)}},$n=[0],Kn=[0,ln,pn,1,pn,-4],qn=class extends pi{constructor(t){super(t,2)}},Jn={};Jn[336783863]=[0,yn,pn,-1,ln,[0,[1,2,3,4,5,6,7,8,9],wn,$n,wn,Rn,wn,Wn,wn,Kn,wn,Dn,wn,[0,yn,-2],wn,[0,yn,In],wn,zn,wn,Mn],[0,yn],pn,[0,[1,3],[2,4],wn,[0,fn],-1,wn,[0,gn],-1,bn,[0,yn,-1]],yn];var Yn=[0,un,-1,vn,-3,un,fn,mn,dn,un,-1,vn,dn,vn,-2,mn],Xn=class extends pi{constructor(t){super(t,500)}v(t){return $e(this,0,7,t)}},Zn=[-1,{}],Qn=[0,yn,1,Zn],to=[0,yn,gn,Zn],eo=class extends pi{constructor(t){super(t,500)}v(t){return $e(this,0,1001,t)}};eo.prototype.j=xn([-500,bn,[-500,mn,-1,gn,-3,[-2,Jn,pn],bn,Ln,dn,-1,Qn,to,bn,[0,mn,vn],mn,Yn,dn,gn,987,gn],4,bn,[-500,yn,-1,[-1,{}],998,yn],bn,[-500,yn,gn,-1,[-2,{},pn],997,gn,-1],dn,bn,[-500,yn,gn,Zn,998,gn],gn,dn,Qn,to,bn,[0,mn,-1,Zn],gn,-2,Yn,mn,-1,vn,[0,vn,_n],978,Zn,bn,Ln]);var ro,io=class extends pi{constructor(t){super(t)}},no=class extends pi{constructor(t){super(t)}j(){return We(this,io)}},oo=[0,bn,[0,ln,nn,yn,-1]],so=class extends pi{constructor(t){super(t)}},ao=class extends pi{constructor(t){super(t)}j(){return Pe(this,Ve(this,2))}l(){return Ce(this,Cn,Ve(this,6))}},uo=[1,2,3,4,5,6],ho=class extends pi{constructor(t){super(t)}j(){return null!=je(this,1,void 0,ke)}l(){return null!=re(je(this,2))}},lo=class extends pi{constructor(t){super(t)}},co=class extends pi{constructor(t){super(t)}};ro=new class{constructor(){var t=qn;this.h=co,this.l=$e,this.defaultValue=void 0,this.j=null!=t.ya?st:void 0}register(){l(this)}},Jn[451755788]=[0,[0,[0,Sn,yn,[0,ln,sn,-1],[0,hn,sn]],pn,[0,uo,wn,Kn,wn,Rn,wn,Dn,wn,$n,wn,Wn,wn,zn],In],[0,yn,ln,nn,gn,-1],rn];var fo,po,vo=class extends pi{constructor(t){super(t)}},go=(fo=class extends pi{constructor(t){super(t)}},po=[0,bn,[0,1,ln,yn,oo],sn],(t,e)=>{t:{let i={X:!0};e&&Object.assign(i,e),t=pr(t,void 0,void 0,i);try{let e=new fo,i=e.o;Li(po)(i,t);var r=e;break t}catch(t){if(t instanceof RangeError)throw new SyntaxError;throw t}finally{vr(t)}r=void 0}return r});function mo(t){return Ze(new yo,1,t)}var yo=class extends pi{constructor(t){super(t)}},bo=class extends pi{constructor(t){super(t)}},wo=[0,In,2,hn,-2,sn,bn,[0,In,sn]],So=class extends pi{constructor(t){super(t)}},Ao=class extends pi{constructor(t){super(t)}};function To(t,e){return Ze(t,1,e)}function _o(t,e){return Ze(t,2,e)}var Io=class extends pi{constructor(t){super(t)}},jo=[3,4,5,6,7],Eo=class extends pi{constructor(t){super(t)}},xo=class extends pi{constructor(t){super(t)}};xo.prototype.j=xn([0,[0,In,yn,-3,In],[0,jo,In,-1,wn,[0,In,yn,hn],wn,wo,wn,[0,1,wo],wn,[0,In],wn,[0,In,yn,hn]]]);var Bo=class{constructor(){this.h="undefined"!=typeof AbortController}async send(t,e,r){var i=this.h?new AbortController:void 0,n=i&&t.W>0?setTimeout(()=>{i.abort()},t.W):void 0;try{let n=await fetch(t.url,{method:t.ra,headers:{...t.qa},...t.body&&{body:t.body},...t.withCredentials&&{credentials:"include"},signal:t.W&&i?i.signal:null});200===n.status?e?.(await n.text()):r?.(n.status)}catch(t){if("AbortError"===t?.name)r?.(408);else r?.(400)}finally{clearTimeout(n)}}},Po=class extends pi{constructor(t){super(t,37)}},Uo=[-4,{},On,In,Un],Lo=[0,yn,In,1,yn,-1,In,1,In,1,sn],Oo=[0,In,yn,-2],ko=[0,yn,In],No=[0,yn,In],Fo=[0,pn,-3],Vo=[0,In,yn,-1,sn,ln,-1,yn,-5,bn,[0,yn,-4],-1,pn,[0,pn,-3],In];var Do=class extends pi{constructor(t){super(t,19)}},Mo=function(t){return e=>Ri(e,t)}([-19,{},[0,In,1,[0,yn,-6,sn,ln,yn,-1,sn],1,[0,yn,1,yn,-5],yn,-1,[0,In,yn,-8],[0,yn,-3],[0,yn,In,yn,-2],[0,yn,-1,In,yn,-1,In,yn,-1,[0,bn,[0,yn,-1],pn,yn,-5],[0,In,pn,ln,-2]],sn,[0,yn,-3,sn,ln,yn,-1],[0,In,yn,-1],[0,yn,-9],[0,yn,-6,In,yn,1,yn,pn,In,-1,pn,yn,-2,In,yn,In,yn,ln,-1],1,[0,In],1,[0,yn,-4],1,Lo,[0,[1,2,3,4,5,6],wn,Lo,wn,ko,wn,No,wn,[0,In],wn,Vo,wn,Oo],ko,No,Vo,[0,[0,In,yn,-1,sn,ln,-1,yn,-4,bn,[0,yn,-4],-1,1,Fo],[0,In,yn,-1,sn,ln,-1,yn,-4,Fo]],Oo,[0,yn,[0,ln,-3,In],In,-2,[0,ln,-1],pn],4,[0,yn,In,yn,-1,sn,In,yn,-1,In,ln,-1]],In,bn,[-37,{},on,yn,bn,[0,yn,-1],Sn,1,Sn,[0,gn,-1,cn,an,-1],yn,[0,ln,yn,-1],pn,ln,sn,yn,-1,En,Pn,on,Sn,In,cn,sn,-1,[0,In,-1],yn,pn,yn,fn,yn,-1,rn,1,rn,Uo,pn,[0,In,[0,nn,ln,-2],[0,nn]],[0,In,sn]],on,An,yn,-1,on,In,-1,[0,pn,-1,In,pn],[0,sn,-1,yn],[0,on,pn,sn],sn,1,Tn,1,Uo]),Go=class{constructor(t){this.j=[],this.m=new Bo,this.l=t??"",this.h=setInterval(()=>{this.flush()},6e4)}close(){void 0!==this.h&&(clearInterval(this.h),this.h=void 0),this.flush()}flush(t,e){if(this.error)e?.("net-send-failed");else if(0===this.j.length)t?.();else{var r=this.j;this.j=[],r=function(t){var e=new Do;Ae(e=Ze(e,2,1786));var r=e.o,i=0|r[Y];if(null==t)Be(r,i,3);else{var n=t===G?7:0|t[Y],o=n,s=Oe(n),a=s||Object.isFrozen(t),u=!0,h=!0;for(let e=0;e<t.length;e++){var l=t[e];s||(l=rt(l),u&&=!l,h&&=l)}s||(n=u?13:5,n=h?-4097&n:4096|n),a&&n===o||(t=kt(t),o=0,n=qe(n,i)),n!==o&&Q(t,n),i=Be(r,i,3,t),2&n||!(4096&n||16&n)||Te(r,i)}return e}(r),r=Mo(r),this.m.send({url:"https://odml.pa.googleapis.com/v1/log",ra:"POST",W:1e4,body:r,wa:2,qa:{"Content-Type":"application/x-protobuf","x-goog-api-key":this.l},withCredentials:!1},()=>{t?.()},t=>{this.error=Error(`Logging failed with HTTP error: ${t}`),this.j=[],void 0!==this.h&&(clearInterval(this.h),this.h=void 0),e?.("net-send-failed",t)})}}};class Ro{constructor(){this.O=this.J=this.N=this.I=this.L=this.M=this.K=0}}function Co(t,e){var r=new xo;r=$e(r,0,1,t.H),r=$e(r,0,2,e),e=xe(e=new Po,6,nt(r=r.j(),!1)),(t=t.C).error||t.j.push(e)}function zo(t,e){++t.h.K,t.j.set(e,performance.now())}function Wo(t,e){++t.h.M,t.j.set(e,performance.now())}function Ho(t,e){var r={K:e.K-t.l.K,M:e.M-t.l.M,L:e.L-t.l.L,I:e.I-t.l.I,N:e.N-t.l.N,J:e.J,O:e.O},i=_o(To(new Io,t.D),1);r=$o(t,r),Co(t,i=Ke(i,4,jo,r)),t.l=e}function $o(t,e){var r=new bo;return t=Xe(t=Ye(t=Ze(r,1,t.G),7,e.I),5,e.J),t=Xe(t,6,e.O),e.L>0&&Xe(t,4,e.N/e.L),0!==e.K&&(r=Ye(r=mo(3),2,e.K),Je(t,8,yo,r)),0!==e.M&&(e=Ye(r=mo(4),2,e.M),Je(t,8,yo,e)),t}var Ko=class{constructor(t,e,r){this.F=performance.now(),this.m=performance.now(),this.j=new Map,this.u=0,this.h=new Ro,this.l=new Ro,this.C=new Go(r),this.D=function(t){switch(t){case"AudioClassifier":return 4;case"AudioEmbedder":return 5;case"TextClassifier":return 6;case"TextEmbedder":return 7;case"GestureRecognizer":return 8;case"HandDetector":return 9;case"HandLandmarker":return 10;case"ImageClassifier":return 11;case"ImageEmbedder":return 12;case"ImageSegmenter":return 13;case"ObjectDetector":return 14;case"FaceDetector":return 15;case"FaceLandmarker":return 16;case"InteractiveSegmenter":case"InteractiveSegmenterLegacy":return 18;case"HolisticLandmarker":return 20;case"LlmInference":return 21;case"LanguageDetector":return 22;case"PoseLandmarker":return 23;case"UniversalEmbedder":return 28;case"SemanticRetriever":return 29;case"DecisionMaker":return 30;case"TextSummarizer":return 26;case"TextProofreader":return 27;case"AudioTranscriber":return 31;case"TextToSpeech":return 32;default:return 0}}(t),this.G=function(t){switch(t){case"IMAGE":return 11;case"VIDEO":return 12;case"LIVE_STREAM":return 13;case"AUDIO_CLIPS":return 14;case"AUDIO_STREAM":return 15;default:return 10}}(e),t=new Eo,"undefined"==typeof navigator?e=0:(e=navigator.userAgent,e=/Android/i.test(e)?1:/iPhone|iPad|iPod/i.test(e)?2:/Windows/i.test(e)?5:/Macintosh/i.test(e)?4:/Linux/i.test(e)?3:0),t=xe(t=Ze(t,1,e),2,ee("")),t=xe(t,3,ee("")),t=xe(t,4,ee("1.2.1")),t=xe(t,5,ee("")),this.H=Ze(t,6,function(){var t=globalThis.__HOST_ENVIRONMENT__;if("string"==typeof t)switch(t){case"ANDROID":return 1;case"IOS":return 2;case"PYTHON":return 3;case"WEB":break;case"FLUTTER":return 5;case"FLUTTER_WEB":return 6;default:return 0}return 4}())}V(){var t=new Ao;t=Xe(t=Ze(t,1,this.G),3,performance.now()-this.F),Co(this,t=Ke(_o(To(new Io,this.D),0),3,jo,t)),this.m=performance.now()}R(t){var e=this.j.get(t);if(void 0!==e&&(this.j.delete(t),t=performance.now()-e,++this.h.L,this.h.N+=t,this.h.J=Math.max(this.h.J,t),this.u=Math.max(this.u,t),performance.now()>this.m+3e4)){for(let[r,i]of this.j.entries())t=r,i<e&&(this.h.I++,this.j.delete(t));e={...this.h,O:performance.now()-this.m},this.h.J=0,this.m=performance.now(),Ho(this,e)}}ma(){var t={...this.h,I:this.h.I+this.j.size,J:this.u,O:performance.now()-this.F};Ho(this,t);var e=new So;e=$e(e,0,2,t=$o(this,t)),Co(this,e=Ke(t=_o(To(new Io,this.D),2),5,jo,e))}close(){var t=this.C;"function"==typeof t.close?t.close():t.flush()}};function qo(){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 Jo(t){if("function"!=typeof importScripts){let e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise((t,r)=>{e.addEventListener("load",()=>{t()},!1),e.addEventListener("error",t=>{r(t)},!1),document.body.appendChild(e)})}try{importScripts(t.toString())}catch(e){if(!(e instanceof TypeError))throw e;{let e=self.import;e?await e(t.toString()):await import(t.toString())}}}function Yo(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),r(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function Xo(t,e,r){t.m||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");var i=new Uint32Array(e.length);for(let r=0;r<e.length;r++)i[r]=t.i.stringToNewUTF8(e[r]);e=t.i._malloc(4*i.length),t.i.HEAPU32.set(i,e>>2),r(e);for(let e of i)t.i._free(e);t.i._free(e)}function Zo(t,e,r){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=r}function Qo(t,e,r){var i=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,n)=>{e?(r(i,n),i=[]):i.push(t)}}var ts=function(t){return class extends t{get Y(){return this.i}ja(){if("function"==typeof this.Y._mediapipeLoggerGetEncodedApiKey){let t=this.Y._mediapipeLoggerGetEncodedApiKey();return this.Y._decodeBase64(t)}}}}(function(t){return class extends t{pa(){this.i._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.l=!0,this.i=t,this.h=null,this.j=0,this.m="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:qo()?this.i.canvas=new OffscreenCanvas(1,1):(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas"))}async initializeGraph(t){var 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){var r=t.length,i=this.i._malloc(r);this.i.HEAPU8.set(t,i),e?this.i._changeBinaryGraph(r,i):this.i._changeTextGraph(r,i),this.i._free(i)}configureAudio(t,e,r,i,n){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),Yo(this,i||"input_audio",i=>{Yo(this,n=n||"audio_header",n=>{this.i._configureAudio(i,n,t,e??0,r)})})}setAutoResizeCanvas(t){this.l=t}setAutoRenderToScreen(t){this.i._setAutoRenderToScreen(t)}setGpuBufferVerticalFlip(t){this.i.gpuOriginForWebTexturesIsBottomLeft=t}attachErrorListener(t){this.i.errorListener=t}attachEmptyPacketListener(t,e){this.i.emptyPacketListeners=this.i.emptyPacketListeners||{},this.i.emptyPacketListeners[t]=e}addAudioToStream(t,e,r){this.addAudioToStreamWithShape(t,0,0,e,r)}addAudioToStreamWithShape(t,e,r,i,n){var o=4*t.length;this.j!==o&&(this.h&&this.i._free(this.h),this.h=this.i._malloc(o),this.j=o),this.i.HEAPF32.set(t,this.h/4),Yo(this,i,t=>{this.i._addAudioToInputStream(this.h,e,r,t,n)})}addGpuBufferToStream(t,e,r){Yo(this,e,e=>{if(!this.i.canvas)throw Error("No OpenGL canvas configured.");e?this.i._bindTextureToStream(e):this.i._bindTextureToCanvas();var i=this.i.canvas.getContext("webgl2")||this.i.canvas.getContext("webgl");if(!i)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");this.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t),this.i.gpuOriginForWebTexturesIsBottomLeft&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1);var[n,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.l||n===this.i.canvas.width&&o===this.i.canvas.height||(this.i.canvas.width=n,this.i.canvas.height=o);var[s,a]=[n,o];this.i._addBoundTextureToStream(e,s,a,r)})}addBoolToStream(t,e,r){Yo(this,e,e=>{this.i._addBoolToInputStream(t,e,r)})}addDoubleToStream(t,e,r){Yo(this,e,e=>{this.i._addDoubleToInputStream(t,e,r)})}addFloatToStream(t,e,r){Yo(this,e,e=>{this.i._addFloatToInputStream(t,e,r)})}addIntToStream(t,e,r){Yo(this,e,e=>{this.i._addIntToInputStream(t,e,r)})}addUintToStream(t,e,r){Yo(this,e,e=>{this.i._addUintToInputStream(t,e,r)})}addStringToStream(t,e,r){Yo(this,e,e=>{Yo(this,t,t=>{this.i._addStringToInputStream(t,e,r)})})}addStringRecordToStream(t,e,r){Yo(this,e,e=>{Xo(this,Object.keys(t),i=>{Xo(this,Object.values(t),n=>{this.i._addFlatHashMapToInputStream(i,n,Object.keys(t).length,e,r)})})})}addProtoToStream(t,e,r,i){Yo(this,r,r=>{Yo(this,e,e=>{var n=this.i._malloc(t.length);this.i.HEAPU8.set(t,n),this.i._addProtoToInputStream(n,t.length,e,r,i),this.i._free(n)})})}addEmptyPacketToStream(t,e){Yo(this,t,t=>{this.i._addEmptyPacketToInputStream(t,e)})}addBoolVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateBoolVector(t.length);if(!i)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.i._addBoolVectorEntry(i,e);this.i._addBoolVectorToInputStream(i,e,r)})}addDoubleVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateDoubleVector(t.length);if(!i)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.i._addDoubleVectorEntry(i,e);this.i._addDoubleVectorToInputStream(i,e,r)})}addFloatVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateFloatVector(t.length);if(!i)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.i._addFloatVectorEntry(i,e);this.i._addFloatVectorToInputStream(i,e,r)})}addIntVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateIntVector(t.length);if(!i)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.i._addIntVectorEntry(i,e);this.i._addIntVectorToInputStream(i,e,r)})}addUintVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateUintVector(t.length);if(!i)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.i._addUintVectorEntry(i,e);this.i._addUintVectorToInputStream(i,e,r)})}addStringVectorToStream(t,e,r){Yo(this,e,e=>{var i=this.i._allocateStringVector(t.length);if(!i)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Yo(this,e,t=>{this.i._addStringVectorEntry(i,t)});this.i._addStringVectorToInputStream(i,e,r)})}addBoolToInputSidePacket(t,e){Yo(this,e,e=>{this.i._addBoolToInputSidePacket(t,e)})}addDoubleToInputSidePacket(t,e){Yo(this,e,e=>{this.i._addDoubleToInputSidePacket(t,e)})}addFloatToInputSidePacket(t,e){Yo(this,e,e=>{this.i._addFloatToInputSidePacket(t,e)})}addIntToInputSidePacket(t,e){Yo(this,e,e=>{this.i._addIntToInputSidePacket(t,e)})}addUintToInputSidePacket(t,e){Yo(this,e,e=>{this.i._addUintToInputSidePacket(t,e)})}addStringToInputSidePacket(t,e){Yo(this,e,e=>{Yo(this,t,t=>{this.i._addStringToInputSidePacket(t,e)})})}addProtoToInputSidePacket(t,e,r){Yo(this,r,r=>{Yo(this,e,e=>{var i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputSidePacket(i,t.length,e,r),this.i._free(i)})})}addBoolVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateBoolVector(t.length);if(!r)throw Error("Unable to allocate new bool vector on heap.");for(let e of t)this.i._addBoolVectorEntry(r,e);this.i._addBoolVectorToInputSidePacket(r,e)})}addDoubleVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateDoubleVector(t.length);if(!r)throw Error("Unable to allocate new double vector on heap.");for(let e of t)this.i._addDoubleVectorEntry(r,e);this.i._addDoubleVectorToInputSidePacket(r,e)})}addFloatVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateFloatVector(t.length);if(!r)throw Error("Unable to allocate new float vector on heap.");for(let e of t)this.i._addFloatVectorEntry(r,e);this.i._addFloatVectorToInputSidePacket(r,e)})}addIntVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateIntVector(t.length);if(!r)throw Error("Unable to allocate new int vector on heap.");for(let e of t)this.i._addIntVectorEntry(r,e);this.i._addIntVectorToInputSidePacket(r,e)})}addUintVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateUintVector(t.length);if(!r)throw Error("Unable to allocate new unsigned int vector on heap.");for(let e of t)this.i._addUintVectorEntry(r,e);this.i._addUintVectorToInputSidePacket(r,e)})}addStringVectorToInputSidePacket(t,e){Yo(this,e,e=>{var r=this.i._allocateStringVector(t.length);if(!r)throw Error("Unable to allocate new string vector on heap.");for(let e of t)Yo(this,e,t=>{this.i._addStringVectorEntry(r,t)});this.i._addStringVectorToInputSidePacket(r,e)})}attachBoolListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachBoolListener(t)})}attachBoolVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachBoolVectorListener(t)})}attachIntListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachIntListener(t)})}attachIntVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachIntVectorListener(t)})}attachUintListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachUintListener(t)})}attachUintVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachUintVectorListener(t)})}attachDoubleListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachDoubleListener(t)})}attachDoubleVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachDoubleVectorListener(t)})}attachFloatListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachFloatListener(t)})}attachFloatVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachFloatVectorListener(t)})}attachStringListener(t,e){Zo(this,t,e),Yo(this,t,t=>{this.i._attachStringListener(t)})}attachStringVectorListener(t,e){Qo(this,t,e),Yo(this,t,t=>{this.i._attachStringVectorListener(t)})}attachProtoListener(t,e,r){Zo(this,t,e),Yo(this,t,t=>{this.i._attachProtoListener(t,r||!1)})}attachProtoVectorListener(t,e,r){Qo(this,t,e),Yo(this,t,t=>{this.i._attachProtoVectorListener(t,r||!1)})}attachAudioListener(t,e,r){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),Zo(this,t,(t,r)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,r)}),Yo(this,t,t=>{this.i._attachAudioListener(t,r||!1)})}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}})),es=class extends ts{};async function rs(t,e,r){return t=await(async(t,e,r,i)=>{if(e&&await Jo(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(r&&(await Jo(r),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&i&&((e=self.Module).locateFile=i.locateFile,i.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=i.mainScriptUrlOrBlob)),i=await self.ModuleFactory(self.Module||i),self.ModuleFactory=self.Module=void 0,new t(i,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile:t=>t.endsWith(".wasm")?e.wasmBinaryPath.toString():e.assetBinaryPath&&t.endsWith(".data")?e.assetBinaryPath.toString():t}),ns(t,r),await t.v(r),t}async function is(t,e,r){return rs(t,e,r)}function ns(t,e){e=e.Ca??"";var r=t.h.ja();t.j=new Ko(t.S(),e,r)}function os(t,e,r){try{t.h.i.FS_unlink(`/${r}`)}catch{}t.h.i.FS_createDataFile("/",r,e,!0,!1,!1),ss(t,`/${r}`)}function ss(t,e){var r=Ce(t.baseOptions,ho,1)||new ho;"string"==typeof e?(xe(r,2,ee(e)),xe(r,1)):e instanceof Uint8Array&&(xe(r,1,nt(e,!1)),xe(r,2)),$e(t.baseOptions,0,1,r)}function as(t,e,r=!0,i=!1){if(r){let r=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ce(t.baseOptions,ho,1)?.j()||Ce(t.baseOptions,ho,1)?.l()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");!function(t,e){var r=Ce(t.baseOptions,ao,3);if(!r){var i=r=new ao,n=new Hn;Ke(i,4,uo,n)}"delegate"in e&&("GPU"===e.delegate?(e=r,i=new Gn,Ke(e,2,uo,i)):(e=r,i=new Hn,Ke(e,4,uo,i))),$e(t.baseOptions,0,3,r)}(t,r);let n=i?"model.litertlm":"model.dat";if(r.modelAssetPath)return fetch(r.modelAssetPath.toString()).then(t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${r.modelAssetPath} (${t.status})`)}).then(e=>{os(t,new Uint8Array(e),n),t.F()});if(r.modelAssetBuffer instanceof Uint8Array)i?os(t,r.modelAssetBuffer,n):ss(t,r.modelAssetBuffer);else if(r.modelAssetBuffer)return async function(t){for(var e=[],r=0;;){let{done:i,value:n}=await t.read();if(i)break;e.push(n),r+=n.length}if(0===e.length)return new Uint8Array(0);if(1===e.length)return e[0];t=new Uint8Array(r),r=0;for(let i of e)t.set(i,r),r+=i.length;return t}(r.modelAssetBuffer).then(e=>{i?os(t,e,n):ss(t,e),t.F()})}return t.F(),Promise.resolve()}function us(t){try{let e=t.G.length;if(1===e)throw Error(t.G[0].message);if(e>1)throw Error("Encountered multiple errors: "+t.G.map(t=>t.message).join(", "))}finally{t.G=[]}}var hs=class{constructor(t){this.h=t,this.G=[],this.D=0,this.h.setAutoRenderToScreen(!1)}setGraph(t,e){this.h.attachErrorListener((t,e)=>{this.G.push(Error(e))}),this.h.pa(),this.h.setGraph(t,e),this.j?.V(),us(this)}finishProcessing(t){this.h.finishProcessing(),us(this),this.j&&void 0!==t&&this.j.R(t)}close(){this.j?.ma(),this.j?.close(),this.h.closeGraph()}};async function ls(t,e){return is(ds,t,e)}hs.prototype.close=hs.prototype.close;var cs=class extends hs{constructor(){super(...arguments),this.u=48e3}sa(t){this.u=t}};function fs(t){var e={classifications:We(t,vo).map(t=>function(t,e=-1,r=""){return{categories:t.map(t=>({index:zt(je(t,1))??0??-1,score:je(t,2,void 0,Gt)??0??0,categoryName:re(je(t,3))??""??"",displayName:re(je(t,4))??""??""})),headIndex:e,headName:r}}(Ce(t,no,4)?.j()??[],zt(je(t,2))??0,re(je(t,3))??""))};return null!=function(t){return null==t?t:"bigint"==typeof t?(pt(t)?t=Number(t):(t=Nt(64,t),t=pt(t)?Number(t):String(t)),t):Ct(t)?"number"==typeof t?$t(t):qt(t):void 0}(je(t,2,void 0,Yt))&&(e.timestampMs=function(t){var e=Number(t);return Number.isSafeInteger(e)?e:String(t)}(je(t,2,void 0,Yt)??Ie)),e}cs.prototype.setDefaultSampleRate=cs.prototype.sa;var ds=class extends cs{constructor(t,e){super(new es(t,e)),this.m=[],$e(t=this.l=new co,0,1,e=new lo)}S(){return"AudioClassifier"}get baseOptions(){return Ce(this.l,lo,1)}set baseOptions(t){$e(this.l,0,1,t)}v(t){var e=this.l,r=Ce(this.l,so,2);if(r){var i=r.o;let t=0|i[Y];r=_e(r,i,t)?ye(r,i,!0):new r.constructor(be(i,t,!1))}else r=new so;if(void 0!==t.displayNamesLocale?xe(r,1,ee(t.displayNamesLocale)):void 0===t.displayNamesLocale&&xe(r,1),void 0!==t.maxResults){if(null!=(i=t.maxResults)){if("number"!=typeof i)throw U("int32");if(!Dt(i))throw U("int32");i|=0}xe(r,2,i)}else"maxResults"in t&&xe(r,2);if(void 0!==t.scoreThreshold){if(null!=(i=t.scoreThreshold)&&"number"!=typeof i)throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);xe(r,3,i)}else"scoreThreshold"in t&&xe(r,3);return void 0!==t.categoryAllowlist?Ne(r,4,t.categoryAllowlist):"categoryAllowlist"in t&&xe(r,4),void 0!==t.categoryDenylist?Ne(r,5,t.categoryDenylist):"categoryDenylist"in t&&xe(r,5),$e(e,0,2,r),as(this,t)}ga(t,e){e=e??this.u;var r=this.D+1;if(this.j&&void 0!==r){let t=Ce(this.baseOptions,ao,3);t?.j()||t?.l()?.j()?Wo(this.j,r):zo(this.j,r)}return this.h.addDoubleToStream(e,"sample_rate",r),this.h.addAudioToStreamWithShape(t,1,t.length,"audio_in",r),this.m=[],this.finishProcessing(r),[...this.m]}F(){var t=new eo;Qe(t,10,"audio_in"),Qe(t,10,"sample_rate"),Qe(t,15,"timestamped_classifications");var e=new qn;!function(t,e){var r=ro,i=t.o;z&&z in i&&(i=i[z])&&delete i[451755788],r.h?r.l(t,r.h,451755788,e,r.j):r.l(t,451755788,e,r.j)}(e,this.l);var r=new Xn;!function(t){var e=ee("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph");Ae(t),Be(t=t.o,0|t[Y],2,""===e?void 0:e)}(r),Qe(r,3,"AUDIO:audio_in"),Qe(r,3,"SAMPLE_RATE:sample_rate"),Qe(r,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),r.v(e),Je(t,1,Xn,r),this.h.attachProtoVectorListener("timestamped_classifications",(t,e)=>{!function(t,e){e.forEach(e=>{e=go(e),t.m.push(fs(e))})}(this,t),this.D=Math.max(this.D,e)}),this.h.attachEmptyPacketListener("timestamped_classifications",t=>{this.D=Math.max(this.D,t)}),t=t.j(),this.setGraph(new Uint8Array(t),!0)}};ds.prototype.classify=ds.prototype.ga,ds.prototype.setOptions=ds.prototype.v,ds.createFromModelPath=function(t,e){return is(ds,t,{baseOptions:{modelAssetPath:e}})},ds.createFromModelBuffer=function(t,e){return ls(t,{baseOptions:{modelAssetBuffer:e}})},ds.createFromOptions=function(t,e){return ls(t,e)};var ps=[];async function vs(t,e){var r=ps.pop();if(r){ns(t=new ms(r,null),e);try{return await t.v(e),t}catch(e){throw t.close(),e}}return is(ms,t,e)}function gs(t,e){var r=t.u.then(()=>{var r=t.H++;return t.j&&(-1===t.m?zo(t.j,r):Wo(t.j,r)),Promise.resolve().then(e).then(e=>(t.j?.R(r),e),e=>{throw t.j?.R(r),e})});return t.u=r.then(()=>{},()=>{}),r}var ms=class extends hs{constructor(t,e){super(new es(t,e)),this.baseOptions=new lo,this.m=0,this.sampleRateHz=16e3,this.enableInterimResults=!1,this.modelArchitecture=0,this.cacheDir=this.prompt="",this.l=0,this.C=!1,this.H=0,this.u=Promise.resolve()}S(){return"AudioTranscriber"}async v(t){if(0!==this.l)throw Error("AudioTranscriber does not support updating options after initialization.");if(this.m="CPU"===t.baseOptions?.delegate?-1:0,void 0!==t.sampleRateHz&&(this.sampleRateHz=t.sampleRateHz),void 0!==t.enableInterimResults&&(this.enableInterimResults=t.enableInterimResults),void 0!==t.modelArchitecture&&(this.modelArchitecture=function(t){if("number"==typeof t)return t;switch(t){case"OMNI":return 1;case"TINY_GEMMA":return 2;case"AUTO":case void 0:return 0;default:throw Error(`Unsupported model architecture: ${t}`)}}(t.modelArchitecture)),void 0!==t.prompt&&(this.prompt=t.prompt),void 0!==t.cacheDir&&(this.cacheDir=t.cacheDir),-1===this.m){this.h.i.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.h.i).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"});let t=r?.info;var i=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${t?.vendor??""} ${t?.architecture??""} ${t?.description??""}`);if(r&&!i){for(var n of(i=[],["shader-f16","subgroups"]))r.features.has(n)&&i.push(n);n={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(n[t]=e)}let o=await r.requestDevice({requiredFeatures:i,requiredLimits:n});if(!o.adapterInfo&&t)try{Object.defineProperty(o,"adapterInfo",{value:t,writable:!0,configurable:!0})}catch{try{o.adapterInfo=t}catch{}}e.preinitializedWebGPUDevice=o}}e.preinitializedWebGPUDevice&&("object"==typeof(r="undefined"!=typeof self?self:globalThis).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}e=this.h.i,await as(this,t,!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer),!0),this.l=await e.createAudioTranscriber("/model.litertlm",this.m,this.sampleRateHz,this.enableInterimResults,this.modelArchitecture,this.prompt,this.cacheDir),this.j?.V()}F(){}da(t,e=!0){if(0===this.l)throw Error("AudioTranscriber is already closed.");var r=this.h.i;return gs(this,()=>r.transcribeAudio(this.l,t,e))}va(t){return this.da(t,!1)}ia(){if(0===this.l)throw Error("AudioTranscriber is already closed.");var t=this.h.i;return gs(this,()=>t.finishAudioTranscriberStream(this.l))}async na(){if(0===this.l)throw Error("AudioTranscriber is already closed.");var t=this.h.i;await gs(this,()=>t.prewarmAudioTranscriber(this.l))}close(){if(!this.C){this.C=!0;var t=this.h.i;if(0!==this.l){try{t.deleteAudioTranscriber(this.l)}catch{}this.l=0}super.close(),t&&!ps.includes(t)&&ps.push(t)}}};ms.prototype.close=ms.prototype.close,ms.prototype.prewarm=ms.prototype.na,ms.prototype.finishStream=ms.prototype.ia,ms.prototype.transcribeStream=ms.prototype.va,ms.prototype.transcribe=ms.prototype.da,ms.prototype.setOptions=ms.prototype.v,ms.createFromModelBuffer=function(t,e){return vs(t,{baseOptions:{modelAssetBuffer:e}})},ms.createFromModelPath=function(t,e){return vs(t,{baseOptions:{modelAssetPath:e}})},ms.createFromOptions=vs;var ys=class{constructor(t,e,r){this.h=t,this.i=e,this.l=r,this.j=!1}async ca(){return this.j||0===this.h?null:this.l(()=>this.j||0===this.h?Promise.resolve(null):this.i.readNextTextToSpeechChunk(this.h))}async oa(t){if(this.j||0===this.h)throw Error("TextToSpeechStream is already closed.");await this.i.pushTextToSpeechStream(this.h,t)}async ha(){if(this.j||0===this.h)throw Error("TextToSpeechStream is already closed.");await this.i.finishTextToSpeechStreamInput(this.h)}cancel(){this.j||0===this.h||this.i.cancelTextToSpeechStream(this.h)}close(){if(!this.j&&(this.j=!0,0!==this.h)){try{this.i.deleteTextToSpeechStream(this.h)}catch{}this.h=0}}[Symbol.asyncIterator](){var t=this;return async function*(){try{for(;;){let e=await t.ca();if(!e)break;yield e}}finally{t.close()}}()}};ys.prototype.close=ys.prototype.close,ys.prototype.cancel=ys.prototype.cancel,ys.prototype.finishInput=ys.prototype.ha,ys.prototype.pushText=ys.prototype.oa,ys.prototype.readNext=ys.prototype.ca;var bs=[];async function ws(t,e){var r=bs.pop();if(r){ns(t=new Ts(r,null),e);try{return await t.v(e),t}catch(e){throw t.close(),e}}return is(Ts,t,e)}function Ss(t,e){var r=t.Z.then(()=>{var r=t.ea++;return t.j&&(-1===t.u?zo(t.j,r):Wo(t.j,r)),Promise.resolve().then(e).then(e=>(t.j?.R(r),e),e=>{throw t.j?.R(r),e})});return t.Z=r.then(()=>{},()=>{}),r}function As(t,e){if(t=t.h.i,e<64){if(!(t=t._malloc(e)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{A:t,B:t}}if(!(t=t._malloc(e+64)>>>0))throw Error(`Failed to allocate ${e} bytes on Wasm heap.`);return{A:(t+63&-64)>>>0,B:t}}var Ts=class extends hs{constructor(t,e){super(new es(t,e)),this.baseOptions=new lo,this.u=-1,this.defaultLocale=this.defaultVoiceId="",this.speakingRate=1,this.targetBucket=0,this.cacheDirectory="",this.C=this.m=this.l=0,this.H=!1,this.ea=0,this.Z=Promise.resolve()}S(){return"TextToSpeech"}async v(t){if(0!==this.l)throw Error("TextToSpeech does not support updating options after initialization.");if(this.u="GPU"===t.baseOptions?.delegate?0:-1,void 0!==t.defaultVoiceId&&(this.defaultVoiceId=t.defaultVoiceId),void 0!==t.defaultLocale&&(this.defaultLocale=t.defaultLocale),void 0!==t.speakingRate&&(this.speakingRate=t.speakingRate),void 0!==t.targetBucket&&(this.targetBucket=t.targetBucket),void 0!==t.cacheDirectory&&(this.cacheDirectory=t.cacheDirectory),-1===this.u){this.h.i.preinitializedWebGPUDevice=void 0;var e="undefined"!=typeof self?self:globalThis;"object"==typeof e.Module&&e.Module&&(e.Module.preinitializedWebGPUDevice=void 0)}else if("undefined"!=typeof navigator&&navigator.gpu)try{if(!(e=this.h.i).preinitializedWebGPUDevice){var r=await navigator.gpu.requestAdapter({powerPreference:"high-performance"}),i=r?.info,n=!!r?.isFallbackAdapter||/swiftshader|llvmpipe|software|lavapipe/i.test(`${i?.vendor??""} ${i?.architecture??""} ${i?.description??""}`);if(r&&!n){for(var o of(n=[],["shader-f16","subgroups"]))r.features.has(o)&&n.push(o);o={};for(let t of["maxBufferSize","maxStorageBufferBindingSize","maxStorageBuffersPerShaderStage","maxComputeWorkgroupStorageSize","maxTextureDimension2D"]){let e=r.limits[t];"number"==typeof e&&(o[t]=e)}let t=await r.requestDevice({requiredFeatures:n,requiredLimits:o});if(!t.adapterInfo&&i)try{Object.defineProperty(t,"adapterInfo",{value:i,writable:!0,configurable:!0})}catch{try{t.adapterInfo=i}catch{}}e.preinitializedWebGPUDevice=t}}e.preinitializedWebGPUDevice&&("object"==typeof(r="undefined"!=typeof self?self:globalThis).Module&&r.Module&&(r.Module.preinitializedWebGPUDevice=e.preinitializedWebGPUDevice))}catch(t){console.warn("WebGPU device initialization failed:",t)}if(e=r=this.h.i,(i=!(!t.baseOptions||!t.baseOptions.modelAssetPath&&!t.baseOptions.modelAssetBuffer))&&"function"==typeof r.createTextToSpeechFromBuffer&&"function"==typeof e._malloc){t=await async function(t,e,r,i){var n=t.h.i;if(r instanceof Uint8Array){var o=r.byteLength;if(0===o)return{A:0,B:0,size:0};let{A:e,B:i}=As(t,o);return n.HEAPU8.set(r,e),{A:e,B:i,size:o}}if(i=i&&i>0?i:0,!r&&e){if(e=e.toString(),!(r=await fetch(e)).ok||!r.body)throw Error(`Failed to fetch asset: ${e} (${r.status})`);(e=Number(r.headers.get("content-length")||0))>0&&(i=e),r=r.body.getReader()}if(!r)return{A:0,B:0,size:0};if(i>0){let{A:e,B:s}=As(t,i);t=0;try{for(;;){let{value:s,done:a}=await r.read();if(a)break;if(s&&s.byteLength>0){if(t+(o=Number(s.byteLength))>i)throw Error(`Stream exceeded expected content-length (${i} bytes).`);n.HEAPU8.set(s,e+t>>>0),t+=o}}}catch(t){throw n._free(s),t}return{A:e,B:s,size:t}}for(o=[],i=0;;){let{value:t,done:e}=await r.read();if(e)break;t&&t.byteLength>0&&(o.push(t),i+=Number(t.byteLength))}if(0===i)return{A:0,B:0,size:0};var{A:s,B:a}=As(t,i);for(t=0,r=0;r<o.length;r++)(e=o[r])&&(n.HEAPU8.set(e,s+t>>>0),t+=e.byteLength,o[r]=void 0);return{A:s,B:a,size:i}}(this,t.baseOptions?.modelAssetPath,t.baseOptions?.modelAssetBuffer,t.modelAssetSize),this.m=t.A,this.C=t.B;try{this.l=await r.createTextToSpeechFromBuffer(this.m,t.size,this.u,this.defaultVoiceId,this.defaultLocale,this.speakingRate,this.targetBucket,this.cacheDirectory)}catch(r){if(0!==(t=this.C||this.m)){try{e._free(t)}catch{}this.C=this.m=0}throw r}}else await as(this,t,i,!0),this.l=await r.createTextToSpeech("/model.litertlm",this.u,this.defaultVoiceId,this.defaultLocale,this.speakingRate,this.targetBucket,this.cacheDirectory);this.j?.V()}F(){}la(){if(0===this.l)throw Error("TextToSpeech is already closed.");var t=this.h.i;return Ss(this,()=>t.listTextToSpeechVoices(this.l))}ta(t,e){if(0===this.l)throw Error("TextToSpeech is already closed.");var r=this.h.i;return Ss(this,()=>r.synthesizeTextToSpeech(this.l,t,e?.voiceId??"",e?.locale??""))}async ua(t="",e,r=!0){if(0===this.l)throw Error("TextToSpeech is already closed.");var i=this.h.i,n=await Ss(this,()=>i.startTextToSpeechStream(this.l,t,e?.voiceId??"",e?.locale??"",r));return new ys(n,i,t=>Ss(this,t))}cancel(){this.H||0===this.l||this.h.i.cancelTextToSpeech(this.l)}close(){if(!this.H){this.H=!0;var t=this.h.i;if(0!==this.l){try{t.deleteTextToSpeech(this.l)}catch{}this.l=0}var e=this.C||this.m;if(0!==e){try{t._free(e)}catch{}this.C=this.m=0}super.close(),t&&!bs.includes(t)&&bs.push(t)}}};function _s(t,e,r){return r=`wasm${r?"_module":""}_internal`,Promise.resolve({wasmLoaderPath:`${e}/${t}_${r}.js`,wasmBinaryPath:`${e}/${t}_${r}.wasm`})}Ts.prototype.close=Ts.prototype.close,Ts.prototype.cancel=Ts.prototype.cancel,Ts.prototype.synthesizeStream=Ts.prototype.ua,Ts.prototype.synthesize=Ts.prototype.ta,Ts.prototype.listVoices=Ts.prototype.la,Ts.prototype.setOptions=Ts.prototype.v,Ts.createFromModelBuffer=function(t,e){return ws(t,{baseOptions:{modelAssetBuffer:e}})},Ts.createFromModelPath=function(t,e){return ws(t,{baseOptions:{modelAssetPath:e}})},Ts.createFromOptions=ws;var Is=class{};Is.forVisionTasks=function(t,e=!1){return _s("vision",t??Vn``,e)},Is.forLiteRtLmTextTasks=function(t,e=!1){return _s("litertlm_text",t??Vn``,e)},Is.forTextTasks=function(t,e=!1){return _s("text",t??Vn``,e)},Is.forRetrievalTasks=function(t,e=!1){return _s("retrieval",t??Vn``,e)},Is.forGenAiTasks=function(t,e=!1){return _s("genai",t??Vn``,e)},Is.forDecisionTasks=function(t,e=!1){return _s("decision",t??Vn``,e)},Is.forAudioTasks=function(t,e=!1){return _s("audio",t??Vn``,e)},exports.AudioClassifier=ds,exports.AudioTaskRunner=cs,exports.AudioTranscriber=ms,exports.FilesetResolver=Is,exports.TaskRunner=hs,exports.TextToSpeech=Ts,exports.TextToSpeechStream=ys;
|
|
2
2
|
//# sourceMappingURL=audio_bundle_cjs.js.map
|