@mediapipe/tasks-audio 0.0.0-nightly-20230920
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/audio.d.ts +478 -0
- package/audio_bundle.cjs +2 -0
- package/audio_bundle.cjs.map +1 -0
- package/audio_bundle.mjs +2 -0
- package/audio_bundle.mjs.map +1 -0
- package/package.json +20 -0
- package/wasm/audio_wasm_internal.js +22 -0
- package/wasm/audio_wasm_internal.wasm +0 -0
- package/wasm/audio_wasm_nosimd_internal.js +22 -0
- package/wasm/audio_wasm_nosimd_internal.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# MediaPipe Tasks Vision Package
|
|
2
|
+
|
|
3
|
+
This package contains the audio tasks for MediaPipe.
|
|
4
|
+
|
|
5
|
+
## Audio Classifier
|
|
6
|
+
|
|
7
|
+
The MediaPipe Audio Classifier task performs classification on audio data.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
const audio = await FilesetResolver.forAudioTasks(
|
|
11
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio/wasm"
|
|
12
|
+
);
|
|
13
|
+
const audioClassifier = await AudioClassifier.createFromModelPath(audio,
|
|
14
|
+
"https://storage.googleapis.com/mediapipe-models/audio_classifier/yamnet/float32/1/yamnet.tflite
|
|
15
|
+
);
|
|
16
|
+
const classifications = audioClassifier.classify(audioData);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For more information, refer to the [Audio Classifier](https://developers.google.com/mediapipe/solutions/audio/audio_classifier/web_js) documentation.
|
|
20
|
+
|
|
21
|
+
## Audio Embedding
|
|
22
|
+
|
|
23
|
+
The MediaPipe Audio Embedding task extracts embeddings from audio data.
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
const audio = await FilesetResolver.forAudioTasks(
|
|
27
|
+
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio/wasm"
|
|
28
|
+
);
|
|
29
|
+
const audioEmbedder = await AudioEmbedder.createFromModelPath(audio,
|
|
30
|
+
"https://storage.googleapis.com/mediapipe-assets/yamnet_embedding_metadata.tflite?generation=1668295071595506"
|
|
31
|
+
);
|
|
32
|
+
const embeddings = audioEmbedder.embed(audioData);
|
|
33
|
+
```
|
package/audio.d.ts
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/** Performs audio classification. */
|
|
2
|
+
export declare class AudioClassifier extends AudioTaskRunner<AudioClassifierResult[]> {
|
|
3
|
+
/**
|
|
4
|
+
* Initializes the Wasm runtime and creates a new audio classifier from the
|
|
5
|
+
* provided options.
|
|
6
|
+
* @export
|
|
7
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
8
|
+
* Wasm binary and its loader.
|
|
9
|
+
* @param audioClassifierOptions The options for the audio classifier. Note
|
|
10
|
+
* that either a path to the model asset or a model buffer needs to be
|
|
11
|
+
* provided (via `baseOptions`).
|
|
12
|
+
*/
|
|
13
|
+
static createFromOptions(wasmFileset: WasmFileset, audioClassifierOptions: AudioClassifierOptions): Promise<AudioClassifier>;
|
|
14
|
+
/**
|
|
15
|
+
* Initializes the Wasm runtime and creates a new audio classifier based on
|
|
16
|
+
* the provided model asset buffer.
|
|
17
|
+
* @export
|
|
18
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
19
|
+
* Wasm binary and its loader.
|
|
20
|
+
* @param modelAssetBuffer A binary representation of the model.
|
|
21
|
+
*/
|
|
22
|
+
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<AudioClassifier>;
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the Wasm runtime and creates a new audio classifier based on
|
|
25
|
+
* the path to the model asset.
|
|
26
|
+
* @export
|
|
27
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
28
|
+
* Wasm binary and its loader.
|
|
29
|
+
* @param modelAssetPath The path to the model asset.
|
|
30
|
+
*/
|
|
31
|
+
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<AudioClassifier>;
|
|
32
|
+
private constructor();
|
|
33
|
+
/**
|
|
34
|
+
* Sets new options for the audio classifier.
|
|
35
|
+
*
|
|
36
|
+
* Calling `setOptions()` with a subset of options only affects those options.
|
|
37
|
+
* You can reset an option back to its default value by explicitly setting it
|
|
38
|
+
* to `undefined`.
|
|
39
|
+
*
|
|
40
|
+
* @export
|
|
41
|
+
* @param options The options for the audio classifier.
|
|
42
|
+
*/
|
|
43
|
+
setOptions(options: AudioClassifierOptions): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Performs audio classification on the provided audio clip and waits
|
|
46
|
+
* synchronously for the response.
|
|
47
|
+
*
|
|
48
|
+
* @export
|
|
49
|
+
* @param audioData An array of raw audio capture data, like from a call to
|
|
50
|
+
* `getChannelData()` on an AudioBuffer.
|
|
51
|
+
* @param sampleRate The sample rate in Hz of the provided audio data. If not
|
|
52
|
+
* set, defaults to the sample rate set via `setDefaultSampleRate()` or
|
|
53
|
+
* `48000` if no custom default was set.
|
|
54
|
+
* @return The classification result of the audio datas
|
|
55
|
+
*/
|
|
56
|
+
classify(audioData: Float32Array, sampleRate?: number): AudioClassifierResult[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Options to configure the MediaPipe Audio Classifier Task */
|
|
60
|
+
export declare interface AudioClassifierOptions extends ClassifierOptions, TaskRunnerOptions {
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Classification results of a model. */
|
|
64
|
+
export declare interface AudioClassifierResult {
|
|
65
|
+
/** The classification results for each head of the model. */
|
|
66
|
+
classifications: Classifications[];
|
|
67
|
+
/**
|
|
68
|
+
* The optional timestamp (in milliseconds) of the start of the chunk of data
|
|
69
|
+
* corresponding to these results.
|
|
70
|
+
*
|
|
71
|
+
* This is only used for classification on time series (e.g. audio
|
|
72
|
+
* classification). In these use cases, the amount of data to process might
|
|
73
|
+
* exceed the maximum size that the model can process: to solve this, the
|
|
74
|
+
* input data is split into multiple chunks starting at different timestamps.
|
|
75
|
+
*/
|
|
76
|
+
timestampMs?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Performs embedding extraction on audio. */
|
|
80
|
+
export declare class AudioEmbedder extends AudioTaskRunner<AudioEmbedderResult[]> {
|
|
81
|
+
/**
|
|
82
|
+
* Initializes the Wasm runtime and creates a new audio embedder from the
|
|
83
|
+
* provided options.
|
|
84
|
+
* @export
|
|
85
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
86
|
+
* Wasm binary and its loader.
|
|
87
|
+
* @param audioEmbedderOptions The options for the audio embedder. Note that
|
|
88
|
+
* either a path to the TFLite model or the model itself needs to be
|
|
89
|
+
* provided (via `baseOptions`).
|
|
90
|
+
*/
|
|
91
|
+
static createFromOptions(wasmFileset: WasmFileset, audioEmbedderOptions: AudioEmbedderOptions): Promise<AudioEmbedder>;
|
|
92
|
+
/**
|
|
93
|
+
* Initializes the Wasm runtime and creates a new audio embedder based on the
|
|
94
|
+
* provided model asset buffer.
|
|
95
|
+
* @export
|
|
96
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
97
|
+
* Wasm binary and its loader.
|
|
98
|
+
* @param modelAssetBuffer A binary representation of the TFLite model.
|
|
99
|
+
*/
|
|
100
|
+
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<AudioEmbedder>;
|
|
101
|
+
/**
|
|
102
|
+
* Initializes the Wasm runtime and creates a new audio embedder based on the
|
|
103
|
+
* path to the model asset.
|
|
104
|
+
* @export
|
|
105
|
+
* @param wasmFileset A configuration object that provides the location of the
|
|
106
|
+
* Wasm binary and its loader.
|
|
107
|
+
* @param modelAssetPath The path to the TFLite model.
|
|
108
|
+
*/
|
|
109
|
+
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<AudioEmbedder>;
|
|
110
|
+
private constructor();
|
|
111
|
+
/**
|
|
112
|
+
* Sets new options for the audio embedder.
|
|
113
|
+
*
|
|
114
|
+
* Calling `setOptions()` with a subset of options only affects those options.
|
|
115
|
+
* You can reset an option back to its default value by explicitly setting it
|
|
116
|
+
* to `undefined`.
|
|
117
|
+
*
|
|
118
|
+
* @export
|
|
119
|
+
* @param options The options for the audio embedder.
|
|
120
|
+
*/
|
|
121
|
+
setOptions(options: AudioEmbedderOptions): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Performs embeding extraction on the provided audio clip and waits
|
|
124
|
+
* synchronously for the response.
|
|
125
|
+
*
|
|
126
|
+
* @export
|
|
127
|
+
* @param audioData An array of raw audio capture data, like from a call to
|
|
128
|
+
* `getChannelData()` on an AudioBuffer.
|
|
129
|
+
* @param sampleRate The sample rate in Hz of the provided audio data. If not
|
|
130
|
+
* set, defaults to the sample rate set via `setDefaultSampleRate()` or
|
|
131
|
+
* `48000` if no custom default was set.
|
|
132
|
+
* @return The embedding resuls of the audio
|
|
133
|
+
*/
|
|
134
|
+
embed(audioData: Float32Array, sampleRate?: number): AudioEmbedderResult[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Options to configure the MediaPipe Audio Embedder Task */
|
|
138
|
+
export declare interface AudioEmbedderOptions extends EmbedderOptions, TaskRunnerOptions {
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Embedding results for a given embedder model. */
|
|
142
|
+
export declare interface AudioEmbedderResult {
|
|
143
|
+
/**
|
|
144
|
+
* The embedding results for each model head, i.e. one for each output tensor.
|
|
145
|
+
*/
|
|
146
|
+
embeddings: Embedding[];
|
|
147
|
+
/**
|
|
148
|
+
* The optional timestamp (in milliseconds) of the start of the chunk of
|
|
149
|
+
* data corresponding to these results.
|
|
150
|
+
*
|
|
151
|
+
* This is only used for embedding extraction on time series (e.g. audio
|
|
152
|
+
* embedding). In these use cases, the amount of data to process might
|
|
153
|
+
* exceed the maximum size that the model can process: to solve this, the
|
|
154
|
+
* input data is split into multiple chunks starting at different timestamps.
|
|
155
|
+
*/
|
|
156
|
+
timestampMs?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Base class for all MediaPipe Audio Tasks. */
|
|
160
|
+
declare abstract class AudioTaskRunner<T> extends TaskRunner {
|
|
161
|
+
/**
|
|
162
|
+
* Sets the sample rate for API calls that omit an explicit sample rate.
|
|
163
|
+
* `48000` is used as a default if this method is not called.
|
|
164
|
+
*
|
|
165
|
+
* @export
|
|
166
|
+
* @param sampleRate A sample rate (e.g. `44100`).
|
|
167
|
+
*/
|
|
168
|
+
setDefaultSampleRate(sampleRate: number): void;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
173
|
+
*
|
|
174
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
175
|
+
* you may not use this file except in compliance with the License.
|
|
176
|
+
* You may obtain a copy of the License at
|
|
177
|
+
*
|
|
178
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
179
|
+
*
|
|
180
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
181
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
182
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
|
+
* See the License for the specific language governing permissions and
|
|
184
|
+
* limitations under the License.
|
|
185
|
+
*/
|
|
186
|
+
/** Options to configure MediaPipe model loading and processing. */
|
|
187
|
+
declare interface BaseOptions_2 {
|
|
188
|
+
/**
|
|
189
|
+
* The model path to the model asset file. Only one of `modelAssetPath` or
|
|
190
|
+
* `modelAssetBuffer` can be set.
|
|
191
|
+
*/
|
|
192
|
+
modelAssetPath?: string | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* A buffer containing the model aaset. Only one of `modelAssetPath` or
|
|
195
|
+
* `modelAssetBuffer` can be set.
|
|
196
|
+
*/
|
|
197
|
+
modelAssetBuffer?: Uint8Array | undefined;
|
|
198
|
+
/** Overrides the default backend to use for the provided model. */
|
|
199
|
+
delegate?: "CPU" | "GPU" | undefined;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
204
|
+
*
|
|
205
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
206
|
+
* you may not use this file except in compliance with the License.
|
|
207
|
+
* You may obtain a copy of the License at
|
|
208
|
+
*
|
|
209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
210
|
+
*
|
|
211
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
212
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
|
+
* See the License for the specific language governing permissions and
|
|
215
|
+
* limitations under the License.
|
|
216
|
+
*/
|
|
217
|
+
/** A classification category. */
|
|
218
|
+
export declare interface Category {
|
|
219
|
+
/** The probability score of this label category. */
|
|
220
|
+
score: number;
|
|
221
|
+
/** The index of the category in the corresponding label file. */
|
|
222
|
+
index: number;
|
|
223
|
+
/**
|
|
224
|
+
* The label of this category object. Defaults to an empty string if there is
|
|
225
|
+
* no category.
|
|
226
|
+
*/
|
|
227
|
+
categoryName: string;
|
|
228
|
+
/**
|
|
229
|
+
* The display name of the label, which may be translated for different
|
|
230
|
+
* locales. For example, a label, "apple", may be translated into Spanish for
|
|
231
|
+
* display purpose, so that the `display_name` is "manzana". Defaults to an
|
|
232
|
+
* empty string if there is no display name.
|
|
233
|
+
*/
|
|
234
|
+
displayName: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Classification results for a given classifier head. */
|
|
238
|
+
export declare interface Classifications {
|
|
239
|
+
/**
|
|
240
|
+
* The array of predicted categories, usually sorted by descending scores,
|
|
241
|
+
* e.g., from high to low probability.
|
|
242
|
+
*/
|
|
243
|
+
categories: Category[];
|
|
244
|
+
/**
|
|
245
|
+
* The index of the classifier head these categories refer to. This is
|
|
246
|
+
* useful for multi-head models.
|
|
247
|
+
*/
|
|
248
|
+
headIndex: number;
|
|
249
|
+
/**
|
|
250
|
+
* The name of the classifier head, which is the corresponding tensor
|
|
251
|
+
* metadata name. Defaults to an empty string if there is no such metadata.
|
|
252
|
+
*/
|
|
253
|
+
headName: string;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
258
|
+
*
|
|
259
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
260
|
+
* you may not use this file except in compliance with the License.
|
|
261
|
+
* You may obtain a copy of the License at
|
|
262
|
+
*
|
|
263
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
264
|
+
*
|
|
265
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
266
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
267
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
|
+
* See the License for the specific language governing permissions and
|
|
269
|
+
* limitations under the License.
|
|
270
|
+
*/
|
|
271
|
+
/** Options to configure a MediaPipe Classifier Task. */
|
|
272
|
+
declare interface ClassifierOptions {
|
|
273
|
+
/**
|
|
274
|
+
* The locale to use for display names specified through the TFLite Model
|
|
275
|
+
* Metadata, if any. Defaults to English.
|
|
276
|
+
*/
|
|
277
|
+
displayNamesLocale?: string | undefined;
|
|
278
|
+
/** The maximum number of top-scored detection results to return. */
|
|
279
|
+
maxResults?: number | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Overrides the value provided in the model metadata. Results below this
|
|
282
|
+
* value are rejected.
|
|
283
|
+
*/
|
|
284
|
+
scoreThreshold?: number | undefined;
|
|
285
|
+
/**
|
|
286
|
+
* Allowlist of category names. If non-empty, detection results whose category
|
|
287
|
+
* name is not in this set will be filtered out. Duplicate or unknown category
|
|
288
|
+
* names are ignored. Mutually exclusive with `categoryDenylist`.
|
|
289
|
+
*/
|
|
290
|
+
categoryAllowlist?: string[] | undefined;
|
|
291
|
+
/**
|
|
292
|
+
* Denylist of category names. If non-empty, detection results whose category
|
|
293
|
+
* name is in this set will be filtered out. Duplicate or unknown category
|
|
294
|
+
* names are ignored. Mutually exclusive with `categoryAllowlist`.
|
|
295
|
+
*/
|
|
296
|
+
categoryDenylist?: string[] | undefined;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
301
|
+
*
|
|
302
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
303
|
+
* you may not use this file except in compliance with the License.
|
|
304
|
+
* You may obtain a copy of the License at
|
|
305
|
+
*
|
|
306
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
307
|
+
*
|
|
308
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
309
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
310
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
311
|
+
* See the License for the specific language governing permissions and
|
|
312
|
+
* limitations under the License.
|
|
313
|
+
*/
|
|
314
|
+
/** Options to configure a MediaPipe Embedder Task */
|
|
315
|
+
declare interface EmbedderOptions {
|
|
316
|
+
/**
|
|
317
|
+
* Whether to normalize the returned feature vector with L2 norm. Use this
|
|
318
|
+
* option only if the model does not already contain a native L2_NORMALIZATION
|
|
319
|
+
* TF Lite Op. In most cases, this is already the case and L2 norm is thus
|
|
320
|
+
* achieved through TF Lite inference.
|
|
321
|
+
*/
|
|
322
|
+
l2Normalize?: boolean | undefined;
|
|
323
|
+
/**
|
|
324
|
+
* Whether the returned embedding should be quantized to bytes via scalar
|
|
325
|
+
* quantization. Embeddings are implicitly assumed to be unit-norm and
|
|
326
|
+
* therefore any dimension is guaranteed to have a value in [-1.0, 1.0]. Use
|
|
327
|
+
* the l2_normalize option if this is not the case.
|
|
328
|
+
*/
|
|
329
|
+
quantize?: boolean | undefined;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
334
|
+
*
|
|
335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
336
|
+
* you may not use this file except in compliance with the License.
|
|
337
|
+
* You may obtain a copy of the License at
|
|
338
|
+
*
|
|
339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
340
|
+
*
|
|
341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
344
|
+
* See the License for the specific language governing permissions and
|
|
345
|
+
* limitations under the License.
|
|
346
|
+
*/
|
|
347
|
+
/**
|
|
348
|
+
* List of embeddings with an optional timestamp.
|
|
349
|
+
*
|
|
350
|
+
* One and only one of the two 'floatEmbedding' and 'quantizedEmbedding' will
|
|
351
|
+
* contain data, based on whether or not the embedder was configured to perform
|
|
352
|
+
* scalar quantization.
|
|
353
|
+
*/
|
|
354
|
+
export declare interface Embedding {
|
|
355
|
+
/**
|
|
356
|
+
* Floating-point embedding. Empty if the embedder was configured to perform
|
|
357
|
+
* scalar-quantization.
|
|
358
|
+
*/
|
|
359
|
+
floatEmbedding?: number[];
|
|
360
|
+
/**
|
|
361
|
+
* Scalar-quantized embedding. Empty if the embedder was not configured to
|
|
362
|
+
* perform scalar quantization.
|
|
363
|
+
*/
|
|
364
|
+
quantizedEmbedding?: Uint8Array;
|
|
365
|
+
/**
|
|
366
|
+
* The index of the classifier head these categories refer to. This is
|
|
367
|
+
* useful for multi-head models.
|
|
368
|
+
*/
|
|
369
|
+
headIndex: number;
|
|
370
|
+
/**
|
|
371
|
+
* The name of the classifier head, which is the corresponding tensor
|
|
372
|
+
* metadata name.
|
|
373
|
+
*/
|
|
374
|
+
headName: string;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Resolves the files required for the MediaPipe Task APIs.
|
|
379
|
+
*
|
|
380
|
+
* This class verifies whether SIMD is supported in the current environment and
|
|
381
|
+
* loads the SIMD files only if support is detected. The returned filesets
|
|
382
|
+
* require that the Wasm files are published without renaming. If this is not
|
|
383
|
+
* possible, you can invoke the MediaPipe Tasks APIs using a manually created
|
|
384
|
+
* `WasmFileset`.
|
|
385
|
+
*/
|
|
386
|
+
export declare class FilesetResolver {
|
|
387
|
+
/**
|
|
388
|
+
* Returns whether SIMD is supported in the current environment.
|
|
389
|
+
*
|
|
390
|
+
* If your environment requires custom locations for the MediaPipe Wasm files,
|
|
391
|
+
* you can use `isSimdSupported()` to decide whether to load the SIMD-based
|
|
392
|
+
* assets.
|
|
393
|
+
*
|
|
394
|
+
* @export
|
|
395
|
+
* @return Whether SIMD support was detected in the current environment.
|
|
396
|
+
*/
|
|
397
|
+
static isSimdSupported(): Promise<boolean>;
|
|
398
|
+
/**
|
|
399
|
+
* Creates a fileset for the MediaPipe Audio tasks.
|
|
400
|
+
*
|
|
401
|
+
* @export
|
|
402
|
+
* @param basePath An optional base path to specify the directory the Wasm
|
|
403
|
+
* files should be loaded from. If not specified, the Wasm files are
|
|
404
|
+
* loaded from the host's root directory.
|
|
405
|
+
* @return A `WasmFileset` that can be used to initialize MediaPipe Audio
|
|
406
|
+
* tasks.
|
|
407
|
+
*/
|
|
408
|
+
static forAudioTasks(basePath?: string): Promise<WasmFileset>;
|
|
409
|
+
/**
|
|
410
|
+
* Creates a fileset for the MediaPipe Text tasks.
|
|
411
|
+
*
|
|
412
|
+
* @export
|
|
413
|
+
* @param basePath An optional base path to specify the directory the Wasm
|
|
414
|
+
* files should be loaded from. If not specified, the Wasm files are
|
|
415
|
+
* loaded from the host's root directory.
|
|
416
|
+
* @return A `WasmFileset` that can be used to initialize MediaPipe Text
|
|
417
|
+
* tasks.
|
|
418
|
+
*/
|
|
419
|
+
static forTextTasks(basePath?: string): Promise<WasmFileset>;
|
|
420
|
+
/**
|
|
421
|
+
* Creates a fileset for the MediaPipe Vision tasks.
|
|
422
|
+
*
|
|
423
|
+
* @export
|
|
424
|
+
* @param basePath An optional base path to specify the directory the Wasm
|
|
425
|
+
* files should be loaded from. If not specified, the Wasm files are
|
|
426
|
+
* loaded from the host's root directory.
|
|
427
|
+
* @return A `WasmFileset` that can be used to initialize MediaPipe Vision
|
|
428
|
+
* tasks.
|
|
429
|
+
*/
|
|
430
|
+
static forVisionTasks(basePath?: string): Promise<WasmFileset>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** Base class for all MediaPipe Tasks. */
|
|
434
|
+
declare abstract class TaskRunner {
|
|
435
|
+
protected constructor();
|
|
436
|
+
/** Configures the task with custom options. */
|
|
437
|
+
abstract setOptions(options: TaskRunnerOptions): Promise<void>;
|
|
438
|
+
/**
|
|
439
|
+
* Closes and cleans up the resources held by this task.
|
|
440
|
+
* @export
|
|
441
|
+
*/
|
|
442
|
+
close(): void;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** Options to configure MediaPipe Tasks in general. */
|
|
446
|
+
declare interface TaskRunnerOptions {
|
|
447
|
+
/** Options to configure the loading of the model assets. */
|
|
448
|
+
baseOptions?: BaseOptions_2;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Copyright 2022 The MediaPipe Authors.
|
|
453
|
+
*
|
|
454
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
455
|
+
* you may not use this file except in compliance with the License.
|
|
456
|
+
* You may obtain a copy of the License at
|
|
457
|
+
*
|
|
458
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
459
|
+
*
|
|
460
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
461
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
462
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
463
|
+
* See the License for the specific language governing permissions and
|
|
464
|
+
* limitations under the License.
|
|
465
|
+
*/
|
|
466
|
+
/** An object containing the locations of the Wasm assets */
|
|
467
|
+
declare interface WasmFileset {
|
|
468
|
+
/** The path to the Wasm loader script. */
|
|
469
|
+
wasmLoaderPath: string;
|
|
470
|
+
/** The path to the Wasm binary. */
|
|
471
|
+
wasmBinaryPath: string;
|
|
472
|
+
/** The optional path to the asset loader script. */
|
|
473
|
+
assetLoaderPath?: string;
|
|
474
|
+
/** The optional path to the assets binary. */
|
|
475
|
+
assetBinaryPath?: string;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export { }
|
package/audio_bundle.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=self;function e(t){return t}function n(){throw Error("Invalid UTF8")}function r(t,e){return e=String.fromCharCode.apply(null,e),null==t?e:t+e}let i,o;const s="undefined"!=typeof TextDecoder;let a;const u="undefined"!=typeof TextEncoder;function c(t){if(u)t=(a||=new TextEncoder).encode(t);else{let n=0;const r=new Uint8Array(3*t.length);for(let i=0;i<t.length;i++){var e=t.charCodeAt(i);if(128>e)r[n++]=e;else{if(2048>e)r[n++]=e>>6|192;else{if(55296<=e&&57343>=e){if(56319>=e&&i<t.length){const o=t.charCodeAt(++i);if(56320<=o&&57343>=o){e=1024*(e-55296)+o-56320+65536,r[n++]=e>>18|240,r[n++]=e>>12&63|128,r[n++]=e>>6&63|128,r[n++]=63&e|128;continue}i--}e=65533}r[n++]=e>>12|224,r[n++]=e>>6&63|128}r[n++]=63&e|128}}t=n===r.length?r:r.subarray(0,n)}return t}var l,h;t:{for(var f=["CLOSURE_FLAGS"],d=t,g=0;g<f.length;g++)if(null==(d=d[f[g]])){h=null;break t}h=d}var p,m=h&&h[610401301];l=null!=m&&m;const v=t.navigator;function y(t){return!!l&&(!!p&&p.brands.some((({brand:e})=>e&&-1!=e.indexOf(t))))}function b(e){var n;return(n=t.navigator)&&(n=n.userAgent)||(n=""),-1!=n.indexOf(e)}function w(){return!!l&&(!!p&&0<p.brands.length)}function A(){return w()?y("Chromium"):(b("Chrome")||b("CriOS"))&&!(!w()&&b("Edge"))||b("Silk")}p=v&&v.userAgentData||null;var _=!w()&&(b("Trident")||b("MSIE"));!b("Android")||A(),A(),b("Safari")&&(A()||!w()&&b("Coast")||!w()&&b("Opera")||!w()&&b("Edge")||(w()?y("Microsoft Edge"):b("Edg/"))||w()&&y("Opera"));var S={},T=null;function E(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=T[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}P();for(var r=0;;){var i=n(-1),o=n(0),s=n(64),a=n(64);if(64===a&&-1===i)break;e(i<<2|o>>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,(function(t){r[i++]=t})),i!==n?r.subarray(0,i):r}function P(){if(!T){T={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=t.concat(e[n].split(""));S[n]=r;for(var i=0;i<r.length;i++){var o=r[i];void 0===T[o]&&(T[o]=i)}}}}var L="undefined"!=typeof Uint8Array,O=!_&&"function"==typeof btoa;function x(t){if(!O){var e;void 0===e&&(e=0),P(),e=S[e];var n=Array(Math.floor(t.length/3)),r=e[64]||"";let u=0,c=0;for(;u<t.length-2;u+=3){var i=t[u],o=t[u+1],s=t[u+2],a=e[i>>2];i=e[(3&i)<<4|o>>4],o=e[(15&o)<<2|s>>6],s=e[63&s],n[c++]=a+i+o+s}switch(a=0,s=r,t.length-u){case 2:s=e[(15&(a=t[u+1]))<<2]||r;case 1:t=t[u],n[c]=e[t>>2]+e[(3&t)<<4|a>>4]+s+r}return n.join("")}for(e="",n=0,r=t.length-10240;n<r;)e+=String.fromCharCode.apply(null,t.subarray(n,n+=10240));return e+=String.fromCharCode.apply(null,n?t.subarray(n):t),btoa(e)}const I=/[-_.]/g,j={"-":"+",_:"/",".":"="};function F(t){return j[t]||""}function U(t){if(!O)return E(t);I.test(t)&&(t=t.replace(I,F)),t=atob(t);const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function B(t){return L&&null!=t&&t instanceof Uint8Array}let k;function C(){return k||=new Uint8Array(0)}var M={};let N;function D(t){if(t!==M)throw Error("illegal external caller")}function G(){return N||=new $(null,M)}function R(t){D(M);var e=t.H;return null==(e=null==e||B(e)?e:"string"==typeof e?U(e):null)?e:t.H=e}var $=class{constructor(t,e){if(D(e),this.H=t,null!=t&&0===t.length)throw Error("ByteString should be constructed with non-empty values")}N(){const t=R(this);return t?new Uint8Array(t):C()}};function z(t,e){return Error(`Invalid wire type: ${t} (at position ${e})`)}function V(){return Error("Failed to read varint, encoding is invalid.")}function W(t,e){return Error(`Tried to read past the end of the data ${e} > ${t}`)}function H(t){return 0==t.length?G():new $(t,M)}function J(t){if("string"==typeof t)return{buffer:U(t),u:!1};if(Array.isArray(t))return{buffer:new Uint8Array(t),u:!1};if(t.constructor===Uint8Array)return{buffer:t,u:!1};if(t.constructor===ArrayBuffer)return{buffer:new Uint8Array(t),u:!1};if(t.constructor===$)return{buffer:R(t)||C(),u:!0};if(t instanceof Uint8Array)return{buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),u:!1};throw Error("Type not convertible to a Uint8Array, expected a Uint8Array, an ArrayBuffer, a base64 encoded string, a ByteString or an Array of numbers")}const K="function"==typeof Uint8Array.prototype.slice;let q,Y=0,X=0;function Q(t){const e=0>t;let n=(t=Math.abs(t))>>>0;if(t=Math.floor((t-n)/4294967296),e){const[e,r]=rt(n,t);t=r,n=e}Y=n>>>0,X=t>>>0}function Z(t){const e=q||=new DataView(new ArrayBuffer(8));e.setFloat32(0,+t,!0),X=0,Y=e.getUint32(0,!0)}function tt(t,e){return 4294967296*e+(t>>>0)}function et(t,e){const n=2147483648&e;return n&&(e=~e>>>0,0==(t=1+~t>>>0)&&(e=e+1>>>0)),t=tt(t,e),n?-t:t}function nt(t){if(16>t.length)Q(Number(t));else if("function"==typeof BigInt)t=BigInt(t),Y=Number(t&BigInt(4294967295))>>>0,X=Number(t>>BigInt(32)&BigInt(4294967295));else{const e=+("-"===t[0]);X=Y=0;const n=t.length;for(let r=e,i=(n-e)%6+e;i<=n;r=i,i+=6){const e=Number(t.slice(r,i));X*=1e6,Y=1e6*Y+e,4294967296<=Y&&(X+=Math.trunc(Y/4294967296),X>>>=0,Y>>>=0)}if(e){const[t,e]=rt(Y,X);Y=t,X=e}}}function rt(t,e){return e=~e,t?t=1+~t:e+=1,[t,e]}function it(t,e,{I:n=!1}={}){t.I=n,e&&(e=J(e),t.j=e.buffer,t.B=e.u,t.C=0,t.l=t.j.length,t.g=t.C)}function ot(t,e){if(t.g=e,e>t.l)throw W(t.l,e)}function st(t,e){let n,r=0,i=0,o=0;const s=t.j;let a=t.g;do{n=s[a++],r|=(127&n)<<o,o+=7}while(32>o&&128&n);for(32<o&&(i|=(127&n)>>4),o=3;32>o&&128&n;o+=7)n=s[a++],i|=(127&n)<<o;if(ot(t,a),128>n)return e(r>>>0,i>>>0);throw V()}function at(t){let e=0,n=t.g;const r=n+10,i=t.j;for(;n<r;){const r=i[n++];if(e|=r,0==(128&r))return ot(t,n),!!(127&e)}throw V()}function ut(t){var e=t.j;const n=t.g,r=e[n],i=e[n+1],o=e[n+2];return e=e[n+3],ot(t,t.g+4),(r<<0|i<<8|o<<16|e<<24)>>>0}function ct(t,e){if(0>e)throw Error(`Tried to read a negative byte length: ${e}`);const n=t.g,r=n+e;if(r>t.l)throw W(e,t.l-n);return t.g=r,n}function lt(t,e){if(0==e)return G();var n=ct(t,e);return t.I&&t.B?n=t.j.subarray(n,n+e):(t=t.j,n=n===(e=n+e)?C():K?t.slice(n,e):new Uint8Array(t.subarray(n,e))),H(n)}var ht=class{constructor(t,e){this.j=null,this.B=!1,this.g=this.l=this.C=0,it(this,t,e)}h(){const t=this.j;let e=this.g,n=t[e++],r=127&n;if(128&n&&(n=t[e++],r|=(127&n)<<7,128&n&&(n=t[e++],r|=(127&n)<<14,128&n&&(n=t[e++],r|=(127&n)<<21,128&n&&(n=t[e++],r|=n<<28,128&n&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++]&&128&t[e++])))))throw V();return ot(this,e),r}v(){var t=ut(this);const e=2*(t>>31)+1,n=t>>>23&255;return t&=8388607,255==n?t?NaN:1/0*e:0==n?e*Math.pow(2,-149)*t:e*Math.pow(2,n-150)*(t+Math.pow(2,23))}F(){return this.h()}},ft=[];function dt(t){var e=t.g;if(e.g==e.l)return!1;t.j=t.g.g;var n=t.g.h()>>>0;if(e=n>>>3,!(0<=(n&=7)&&5>=n))throw z(n,t.j);if(1>e)throw Error(`Invalid field number: ${e} (at position ${t.j})`);return t.l=e,t.h=n,!0}function gt(t){switch(t.h){case 0:0!=t.h?gt(t):at(t.g);break;case 1:ot(t=t.g,t.g+8);break;case 2:if(2!=t.h)gt(t);else{var e=t.g.h()>>>0;ot(t=t.g,t.g+e)}break;case 5:ot(t=t.g,t.g+4);break;case 3:for(e=t.l;;){if(!dt(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.l!=e)throw Error("Unmatched end-group tag");break}gt(t)}break;default:throw z(t.h,t.j)}}function pt(t,e,n){const r=t.g.l,i=t.g.h()>>>0,o=t.g.g+i;let s=o-r;if(0>=s&&(t.g.l=o,n(e,t,void 0,void 0,void 0),s=o-t.g.g),s)throw Error(`Message parsing ended unexpectedly. Expected to read ${i} bytes, instead read ${i-s} bytes, either the data ended unexpectedly or the message misreported its own length`);t.g.g=o,t.g.l=r}function mt(t){var e=t.g.h()>>>0,a=ct(t=t.g,e);if(t=t.j,s){var u,c=t;(u=o)||(u=o=new TextDecoder("utf-8",{fatal:!0})),t=a+e,c=0===a&&t===c.length?c:c.subarray(a,t);try{var l=u.decode(c)}catch(t){if(void 0===i){try{u.decode(new Uint8Array([128]))}catch(t){}try{u.decode(new Uint8Array([97])),i=!0}catch(t){i=!1}}throw!i&&(o=void 0),t}}else{e=(l=a)+e,a=[];let i,o=null;for(;l<e;){var h=t[l++];128>h?a.push(h):224>h?l>=e?n():(i=t[l++],194>h||128!=(192&i)?(l--,n()):a.push((31&h)<<6|63&i)):240>h?l>=e-1?n():(i=t[l++],128!=(192&i)||224===h&&160>i||237===h&&160<=i||128!=(192&(c=t[l++]))?(l--,n()):a.push((15&h)<<12|(63&i)<<6|63&c)):244>=h?l>=e-2?n():(i=t[l++],128!=(192&i)||0!=i-144+(h<<28)>>30||128!=(192&(c=t[l++]))||128!=(192&(u=t[l++]))?(l--,n()):(h=(7&h)<<18|(63&i)<<12|(63&c)<<6|63&u,h-=65536,a.push(55296+(h>>10&1023),56320+(1023&h)))):n(),8192<=a.length&&(o=r(o,a),a.length=0)}l=r(o,a)}return l}function vt(t){const e=t.g.h()>>>0;return lt(t.g,e)}function yt(t,e,n){var r=t.g.h()>>>0;for(r=t.g.g+r;t.g.g<r;)n.push(e.call(t.g))}var bt=[];function wt(t){return t?/^\d+$/.test(t)?(nt(t),new At(Y,X)):null:_t||=new At(0,0)}var At=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let _t;function St(t){return t?/^-?\d+$/.test(t)?(nt(t),new Tt(Y,X)):null:Et||=new Tt(0,0)}var Tt=class{constructor(t,e){this.h=t>>>0,this.g=e>>>0}};let Et;function Pt(t,e,n){for(;0<n||127<e;)t.g.push(127&e|128),e=(e>>>7|n<<25)>>>0,n>>>=7;t.g.push(e)}function Lt(t,e){for(;127<e;)t.g.push(127&e|128),e>>>=7;t.g.push(e)}function Ot(t,e){if(0<=e)Lt(t,e);else{for(let n=0;9>n;n++)t.g.push(127&e|128),e>>=7;t.g.push(1)}}function xt(t,e){t.g.push(e>>>0&255),t.g.push(e>>>8&255),t.g.push(e>>>16&255),t.g.push(e>>>24&255)}function It(t,e){0!==e.length&&(t.j.push(e),t.h+=e.length)}function jt(t,e,n){Lt(t.g,8*e+n)}function Ft(t,e){return jt(t,e,2),e=t.g.end(),It(t,e),e.push(t.h),e}function Ut(t,e){var n=e.pop();for(n=t.h+t.g.length()-n;127<n;)e.push(127&n|128),n>>>=7,t.h++;e.push(n),t.h++}function Bt(t,e,n){jt(t,e,2),Lt(t.g,n.length),It(t,t.g.end()),It(t,n)}class kt{constructor(t,e,n){this.g=t,this.h=e,this.j=n}}function Ct(t){return Array.prototype.slice.call(t)}const Mt="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol():void 0;var Nt=Mt?(t,e)=>{t[Mt]|=e}:(t,e)=>{void 0!==t.o?t.o|=e:Object.defineProperties(t,{o:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Dt(t){const e=Rt(t);1!=(1&e)&&(Object.isFrozen(t)&&(t=Ct(t)),zt(t,1|e))}var Gt=Mt?(t,e)=>{t[Mt]&=~e}:(t,e)=>{void 0!==t.o&&(t.o&=~e)},Rt=Mt?t=>0|t[Mt]:t=>0|t.o,$t=Mt?t=>t[Mt]:t=>t.o,zt=Mt?(t,e)=>{t[Mt]=e}:(t,e)=>{void 0!==t.o?t.o=e:Object.defineProperties(t,{o:{value:e,configurable:!0,writable:!0,enumerable:!1}})};function Vt(t){return Nt(t,1),t}function Wt(t,e){zt(e,-255&(0|t))}function Ht(t,e){zt(e,-221&(34|t))}function Jt(t){return 0===(t=t>>11&1023)?536870912:t}var Kt,qt={};function Yt(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}function Xt(t,e,n){if(null!=t)if("string"==typeof t)t=t?new $(t,M):G();else if(t.constructor!==$)if(B(t))t=n?H(t):t.length?new $(new Uint8Array(t),M):G();else{if(!e)throw Error();t=void 0}return t}const Qt=[];function Zt(t){if(2&t)throw Error()}let te,ee,ne,re,ie;function oe(t,e){(e=te?e[te]:void 0)&&(t[te]=Ct(e))}function se(t,e){t.__closure__error__context__984382||(t.__closure__error__context__984382={}),t.__closure__error__context__984382.severity=e}function ae(t){return null==t?t:"number"==typeof t||"NaN"===t||"Infinity"===t||"-Infinity"===t?Number(t):void 0}function ue(t){if(null!=t){if("boolean"!=typeof t){var e=typeof t;throw Error(`Expected boolean but got ${"object"!=e?e:t?Array.isArray(t)?"array":e:"null"}: ${t}`)}t=!!t}return t}function ce(t){return"number"==typeof t&&Number.isFinite(t)||!!t&&"string"==typeof t&&isFinite(t)}function le(t){if(null==t)return t;if("string"==typeof t){if(!t)return;t=+t}return"number"==typeof t?t:void 0}function he(t){if("string"!=typeof t)throw Error();return t}function fe(t){if(null!=t&&"string"!=typeof t)throw Error();return t}function de(t){return null==t||"string"==typeof t?t:void 0}function ge(t,e,n){var r=!1;if(null!=t&&"object"==typeof t&&!(r=Array.isArray(t))&&t.G===qt)return t;if(r){var i=r=Rt(t);return 0===i&&(i|=32&n),(i|=2&n)!==r&&zt(t,i),new e(t)}}function pe(t){switch(typeof t){case"boolean":return re||=[0,void 0,!0];case"number":return 0<t?void 0:0===t?ie||=[0,void 0]:[-t,void 0];case"string":return[0,t];case"object":return t}}function me(t,e,n){if(null==t&&(t=ne),ne=void 0,null==t){var r=96;n?(t=[n],r|=512):t=[],e&&(r=-2095105&r|(1023&e)<<11)}else{if(!Array.isArray(t))throw Error();if(64&(r=Rt(t)))return ee&&delete t[ee],t;if(r|=64,n&&(r|=512,n!==t[0]))throw Error();t:{var i=(n=t).length;if(i){const t=i-1;var o=n[t];if(Yt(o)){1024<=(i=t-(e=+!!(512&(r|=256))-1))&&(ve(n,e,o),i=1023),r=-2095105&r|(1023&i)<<11;break t}}e&&(o=+!!(512&r)-1,1024<(e=Math.max(e,i-o))&&(ve(n,o,{}),r|=256,e=1023),r=-2095105&r|(1023&e)<<11)}}return zt(t,r),t}function ve(t,e,n){const r=1023+e,i=t.length;for(let o=r;o<i;o++){const r=t[o];null!=r&&r!==n&&(n[o-e]=r)}t.length=r+1,t[r]=n}function ye(t,e,n,r,i,o){if(null!=t){if(Array.isArray(t))t=i&&0==t.length&&1&Rt(t)?void 0:o&&2&Rt(t)?t:be(t,e,n,void 0!==r,i,o);else if(Yt(t)){const s={};for(let a in t)s[a]=ye(t[a],e,n,r,i,o);t=s}else t=e(t,r);return t}}function be(t,e,n,r,i,o){const s=r||n?Rt(t):0;r=r?!!(32&s):void 0;const a=Ct(t);for(let t=0;t<a.length;t++)a[t]=ye(a[t],e,n,r,i,o);return n&&(oe(a,t),n(s,a)),a}function we(t){return t.G===qt?t.toJSON():function(t){switch(typeof t){case"number":return isFinite(t)?t:String(t);case"boolean":return t?1:0;case"object":if(t&&!Array.isArray(t)){if(B(t))return x(t);if(t instanceof $){const e=t.H;return null==e?"":"string"==typeof e?e:t.H=x(e)}}}return t}(t)}function Ae(t,e,n=Ht){if(null!=t){if(L&&t instanceof Uint8Array)return e?t:new Uint8Array(t);if(Array.isArray(t)){const r=Rt(t);return 2&r?t:!e||68&r||!(32&r||0===r)?be(t,Ae,4&r?Ht:n,!0,!1,!0):(zt(t,34|r),t)}return t.G===qt&&(e=t.m,t=2&(n=$t(e))?t:Se(t,e,n,!0)),t}}function _e(t){const e=t.m;return Se(t,e,$t(e),!1)}function Se(t,e,n,r){return t=t.constructor,ne=e=Te(e,n,r),e=new t(e),ne=void 0,e}function Te(t,e,n){const r=n||2&e?Ht:Wt,i=!!(32&e);return t=function(t,e,n){const r=Ct(t);var i=r.length;const o=256&e?r[i-1]:void 0;for(i+=o?-1:0,e=512&e?1:0;e<i;e++)r[e]=n(r[e]);if(o){e=r[e]={};for(const t in o)e[t]=n(o[t])}return oe(r,t),r}(t,e,(t=>Ae(t,i,r))),Nt(t,32|(n?2:0)),t}function Ee(t){const e=t.m,n=$t(e);return 2&n?Se(t,e,n,!1):t}function Pe(t,e){return Le(t=t.m,$t(t),e)}function Le(t,e,n,r){if(-1===n)return null;if(n>=Jt(e)){if(256&e)return t[t.length-1][n]}else{var i=t.length;if(r&&256&e&&null!=(r=t[i-1][n]))return r;if((e=n+(+!!(512&e)-1))<i)return t[e]}}function Oe(t,e,n,r){const i=t.m,o=$t(i);return Zt(o),xe(i,o,e,n,r),t}function xe(t,e,n,r,i){var o=Jt(e);if(n>=o||i){if(i=e,256&e)o=t[t.length-1];else{if(null==r)return;o=t[o+(+!!(512&e)-1)]={},i|=256}o[n]=r,i!==e&&zt(t,i)}else t[n+(+!!(512&e)-1)]=r,256&e&&(n in(t=t[t.length-1])&&delete t[n])}function Ie(t,e,n,r,i){var o=2&e;let s=Le(t,e,n,i);Array.isArray(s)||(s=Kt);const a=Rt(s);if(1&a||Vt(s),o)2&a||Nt(s,34),1&r||Object.freeze(s);else{o=!(2&r);const u=2&a;1&r||!u?o&&32&a&&!u&&Gt(s,32):(s=Vt(Ct(s)),xe(t,e,n,s,i))}return s}function je(t){t=t.m;const e=$t(t),n=Le(t,e,1),r=Xt(n,!0,!!(34&e));return null!=r&&r!==n&&xe(t,e,1,r),r}function Fe(t,e,n){t=t.m;const r=$t(t);if(Zt(r),null==n)xe(t,r,e);else{if(!(4&Rt(n))){Object.isFrozen(n)&&(n=Ct(n));for(let t=0;t<n.length;t++)n[t]=he(n[t]);zt(n,5)}xe(t,r,e,n)}}function Ue(t,e){t=t.m;const n=$t(t);Zt(n),xe(t,n,2,""===e?void 0:e)}function Be(t,e){return ke(t=t.m,$t(t),qr)===e?e:-1}function ke(t,e,n){let r=0;for(let i=0;i<n.length;i++){const o=n[i];null!=Le(t,e,o)&&(0!==r&&xe(t,e,r),r=o)}return r}function Ce(t,e,n,r){const i=$t(t);Zt(i);const o=Le(t,i,n,r);let s;if(null!=o&&o.G===qt)return(e=Ee(o))!==o&&xe(t,i,n,e,r),e.m;if(Array.isArray(o)){const t=Rt(o);s=2&t?Te(o,t,!1):o,s=me(s,e[0],e[1])}else s=me(void 0,e[0],e[1]);return s!==o&&xe(t,i,n,s,r),s}function Me(t,e,n,r){t=t.m;const i=$t(t),o=Le(t,i,n,r);return(e=ge(o,e,i))!==o&&null!=e&&xe(t,i,n,e,r),e}function Ne(t,e,n){if(null==(e=Me(t,e,n,!1)))return e;t=t.m;const r=$t(t);if(!(2&r)){const i=Ee(e);i!==e&&xe(t,r,n,e=i,!1)}return e}function De(t,e,n,r){var i=!!(2&e),o=Ie(t,e,1,1);if(o===Kt||!(4&Rt(o))){var s=o;o=!!(2&e);var a=!!(2&Rt(s));i=s,!o&&a&&(s=Ct(s));var u=e|(a?2:0);a=a||void 0;let c=0,l=0;for(;c<s.length;c++){const t=ge(s[c],n,u);void 0!==t&&(a=a||2&$t(t.m),s[l++]=t)}return l<c&&(s.length=l),u=5|(s=Rt(n=s)),s!=(a=a?-9&u:8|u)&&(Object.isFrozen(n)&&(n=Ct(n)),zt(n,a)),i!==(s=n)&&xe(t,e,1,s),(o&&2!==r||1===r)&&Object.freeze(s),s}return 3===r||(i?2===r&&(r=Rt(o),o=Ct(o),zt(o,r),xe(t,e,1,o)):(i=Object.isFrozen(o),1===r?i||Object.freeze(o):(n=-35&(r=Rt(o)),i&&(r=0,xe(t,e,1,o=Ct(o))),r!==n&&zt(o,n)))),o}function Ge(t,e){var n=t.m,r=$t(n);if(e=De(n,r,e,(t=!!(2&r))?1:2),!(t||8&Rt(e))){for(t=0;t<e.length;t++)(n=e[t])!==(r=Ee(n))&&(e[t]=r);Nt(e,8)}return e}function Re(t,e,n,r,i){return null==r&&(r=void 0),Oe(t,n,r,i)}function $e(t,e,n){var r=Ur;null==n&&(n=void 0),t=t.m;const i=$t(t);Zt(i),(r=ke(t,i,r))&&r!==e&&null!=n&&xe(t,i,r),xe(t,i,e,n)}function ze(t,e){var n=br;t=t.m;const r=$t(t);Zt(r),t=De(t,r,n,2),e=null!=e?e:new n,t.push(e),e.u()&&Gt(t,8)}function Ve(t){return t=null==(t=Pe(t,2))||ce(t)?t:void 0}function We(t){return t??0}function He(t,e,n){n=he(n),t=t.m;const r=$t(t);Zt(r),Ie(t,r,e,2).push(n)}function Je(t,e,n){e.g?e.j(t,e.g,e.h,n,!0):e.j(t,e.h,n,!0)}zt(Qt,39),Kt=Object.freeze(Qt);var Ke=class{constructor(t,e){this.m=me(t,e)}toJSON(){return qe(this,be(this.m,we,void 0,void 0,!1,!1),!0)}u(){return!!(2&Rt(this.m))}};function qe(t,e,n){var r=t.constructor.A,i=Jt($t(n?t.m:e)),o=!1;if(r){if(!n){var s;if((e=Ct(e)).length&&Yt(s=e[e.length-1]))for(o=0;o<r.length;o++)if(r[o]>=i){Object.assign(e[e.length-1]={},s);break}o=!0}var a;i=e,n=!n,t=Jt(s=$t(t.m)),s=+!!(512&s)-1;for(let e=0;e<r.length;e++){var u=r[e];if(u<t){var c=i[u+=s];null==c?i[u]=n?Kt:Vt([]):n&&c!==Kt&&Dt(c)}else{if(!a){var l=void 0;i.length&&Yt(l=i[i.length-1])?a=l:i.push(a={})}c=a[u],null==a[u]?a[u]=n?Kt:Vt([]):n&&c!==Kt&&Dt(c)}}}if(!(r=e.length))return e;let h,f;if(Yt(a=e[r-1])){t:{var d=a;l={},i=!1;for(let t in d)n=d[t],Array.isArray(n)&&n!=n&&(i=!0),null!=n?l[t]=n:i=!0;if(i){for(let t in l){d=l;break t}d=null}}d!=a&&(h=!0),r--}for(;0<r&&null==(a=e[r-1]);r--)f=!0;return h||f?(e=o?e:Array.prototype.slice.call(e,0,r),o&&(e.length=r),d&&e.push(d),e):e}function Ye(t){return{L:zn,J:t}}function Xe(t,e){if(Array.isArray(e)){var n=Rt(e);if(4&n)return e;for(var r=0,i=0;r<e.length;r++){const n=t(e[r]);null!=n&&(e[i++]=n)}return i<r&&(e.length=i),zt(e,5|n),2&n&&Object.freeze(e),e}}Ke.prototype.G=qt,Ke.prototype.toString=function(){return qe(this,this.m,!1).toString()};const Qe=Symbol();function Ze(t){let e=t[Qe];if(!e){const n=sn(t),r=vn(t),i=r.h;e=i?(t,e)=>i(t,e,r):(t,e)=>{for(;dt(e)&&4!=e.h;){var i=e.l,o=r[i];if(!o){var s=r.g;s&&(s=s[i])&&(o=r[i]=tn(s))}o&&o(e,t,i)||(i=(o=e).j,gt(o),o.K?o=void 0:(s=o.g.g-i,o.g.g=i,o=lt(o.g,s)),i=t,o&&(te||=Symbol(),(s=i[te])?s.push(o):i[te]=[o]))}for(const e in n){t[ee||=Symbol()]=n;break}},t[Qe]=e}return e}function tn(t){const e=function(t){if(t=t.J)return Ze(t)}(t),n=t.L.g;if(e){const r=vn(t.J).D;return(t,i,o)=>n(t,i,o,r,e)}return(t,e,r)=>n(t,e,r)}const en=Symbol();function nn(t,e,n,r){let i;if(r){const e=r[en];i=e?e.D:pe(r[0]),n[t]=e??r}i&&i===re?((e=n.R)||(n.R=e=[]),e.push(t)):e.j&&((e=n.T)||(n.T=e=[]),e.push(t))}function rn(t,e,n,r){nn(t,e,r)}function on(t,e,n,r,i){nn(t,e,i,n)}function sn(t){let e=t[en];return e||(e=t[en]={},an(t,e,rn,on,e))}function an(t,e,n,r,i){e.D=pe(t[0]);let o=1;if(t.length>o&&!(t[o]instanceof kt)){var s=t[o++];if(Array.isArray(s))return e.h=s[0],e.g=s[1],e;e.g=s}for(s=0;o<t.length;){var a=t[o++],u=t[o];for("number"==typeof u?(o++,s+=u):s++,u=o;u<t.length&&!(t[u]instanceof kt);)u++;if(u-=o){var c=t,l=o,h=c[l];if("function"==typeof h&&(h=h(),c[l]=h),(c=Array.isArray(h))&&!(c=gn in h||ln in h)&&(c=0<h.length)){const t=pe(l=(c=h)[0]);null!=t&&t!==l&&(c[0]=t),c=null!=t}(h=c?h:void 0)?(o++,1===u?void 0!==(a=r(s,a,h,void 0,i))&&(e[s]=a):void 0!==(a=r(s,a,h,t[o++],i))&&(e[s]=a)):void 0!==(a=n(s,a,t[o++],i))&&(e[s]=a)}else void 0!==(a=n(s,a,void 0,i))&&(e[s]=a)}return e}const un=Symbol();function cn(t){let e=t[un];if(!e){const n=dn(t);e=(t,e)=>bn(t,e,n),t[un]=e}return e}const ln=Symbol();function hn(t,e){return e.h}function fn(t,e,n){let r,i;const o=e.h;return(t,e,s)=>o(t,e,s,i||=dn(n).D,r||=cn(n))}function dn(t){let e=t[ln];return e||(e=an(t,t[ln]={},hn,fn),gn in t&&ln in t&&(t.length=0),e)}const gn=Symbol();function pn(t,e,n){const r=e.g;return n?(t,e,i)=>r(t,e,i,n):r}function mn(t,e,n,r){const i=e.g;let o,s;return(t,e,a)=>i(t,e,a,s||=vn(n).D,o||=Ze(n),r)}function vn(t){let e=t[gn];return e||(sn(t),e=an(t,t[gn]={},pn,mn),gn in t&&ln in t&&(t.length=0),e)}function yn(t,e){var n=t[e];if(n)return n;if((n=t.g)&&(n=n[e])){var r=n.J,i=n.L.h;if(r){const t=cn(r),e=dn(r).D;n=(n,r,o)=>i(n,r,o,e,t)}else n=i;return t[e]=n}}function bn(t,e,n){for(var r=$t(t),i=+!!(512&r)-1,o=t.length,s=512&r?1:0,a=o+(256&r?-1:0);s<a;s++){const r=t[s];if(null==r)continue;const o=s-i,a=yn(n,o);a&&a(e,r,o)}if(256&r){r=t[o-1];for(let t in r)i=+t,Number.isNaN(i)||null!=(o=r[t])&&(a=yn(n,i))&&a(e,o,i)}if(t=te?t[te]:void 0)for(It(e,e.g.end()),n=0;n<t.length;n++)It(e,R(t[n])||C())}function wn(t,e){return new kt(t,e,!1)}function An(t,e){return new kt(t,e,!0)}function _n(t,e,n){xe(t,$t(t),e,n)}function Sn(t,e,n){t:if(null!=e){if(ce(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&St(e),null!=e&&(jt(t,n,0),"number"==typeof e?(t=t.g,Q(e),Pt(t,Y,X)):(n=St(e),Pt(t.g,n.h,n.g))))}function Tn(t,e,n){null!=(e=le(e))&&null!=e&&(jt(t,n,0),Ot(t.g,e))}function En(t,e,n){null!=(e=null==e?e:"boolean"==typeof e||"number"==typeof e?!!e:void 0)&&(jt(t,n,0),t.g.g.push(e?1:0))}function Pn(t,e,n){null!=(e=de(e))&&Bt(t,n,c(e))}function Ln(t,e,n,r,i){null!=(e=e instanceof Ke?e.m:Array.isArray(e)?me(e,r[0],r[1]):void 0)&&(n=Ft(t,n),i(e,t),Ut(t,n))}function On(t,e,n){null!=(e=null==e||"string"==typeof e||B(e)||e instanceof $?e:void 0)&&Bt(t,n,J(e).buffer)}var xn=wn((function(t,e,n){if(1!==t.h)return!1;var r=t.g;t=ut(r);const i=ut(r);r=2*(i>>31)+1;const o=i>>>20&2047;return t=4294967296*(1048575&i)+t,_n(e,n,2047==o?t?NaN:1/0*r:0==o?r*Math.pow(2,-1074)*t:r*Math.pow(2,o-1075)*(t+4503599627370496)),!0}),(function(t,e,n){null!=(e=ae(e))&&(jt(t,n,1),t=t.g,(n=q||=new DataView(new ArrayBuffer(8))).setFloat64(0,+e,!0),Y=n.getUint32(0,!0),X=n.getUint32(4,!0),xt(t,Y),xt(t,X))})),In=wn((function(t,e,n){return 5===t.h&&(_n(e,n,t.g.v()),!0)}),(function(t,e,n){null!=(e=ae(e))&&(jt(t,n,5),t=t.g,Z(e),xt(t,Y))})),jn=An((function(t,e,n){return(5===t.h||2===t.h)&&(e=Ie(e,$t(e),n,2,!1),2==t.h?yt(t,ht.prototype.v,e):e.push(t.g.v()),!0)}),(function(t,e,n){if(null!=(e=Xe(ae,e))&&e.length){jt(t,n,2),Lt(t.g,4*e.length);for(let r=0;r<e.length;r++)n=t.g,Z(e[r]),xt(n,Y)}})),Fn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,st(t.g,et)),!0)}),Sn),Un=wn((function(t,e,n){return 0===t.h&&(_n(e,n,0===(t=st(t.g,et))?void 0:t),!0)}),Sn),Bn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,st(t.g,tt)),!0)}),(function(t,e,n){t:if(null!=e){if(ce(e)){if("string"==typeof e)break t;if("number"==typeof e)break t}e=void 0}null!=e&&("string"==typeof e&&wt(e),null!=e&&(jt(t,n,0),"number"==typeof e?(t=t.g,Q(e),Pt(t,Y,X)):(n=wt(e),Pt(t.g,n.h,n.g))))})),kn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,t.g.h()),!0)}),Tn),Cn=An((function(t,e,n){return(0===t.h||2===t.h)&&(e=Ie(e,$t(e),n,2,!1),2==t.h?yt(t,ht.prototype.h,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Xe(le,e))&&e.length){n=Ft(t,n);for(let n=0;n<e.length;n++)Ot(t.g,e[n]);Ut(t,n)}})),Mn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,0===(t=t.g.h())?void 0:t),!0)}),Tn),Nn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,at(t.g)),!0)}),En),Dn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,!1===(t=at(t.g))?void 0:t),!0)}),En),Gn=An((function(t,e,n){if(2!==t.h)return!1;t=mt(t);const r=$t(e);return Zt(r),Ie(e,r,n,2).push(t),!0}),(function(t,e,n){if(null!=(e=Xe(de,e)))for(let i=0;i<e.length;i++){var r=e[i];null!=r&&Bt(t,n,c(r))}})),Rn=wn((function(t,e,n){return 2===t.h&&(_n(e,n,""===(t=mt(t))?void 0:t),!0)}),Pn),$n=wn((function(t,e,n){return 2===t.h&&(_n(e,n,mt(t)),!0)}),Pn),zn=wn((function(t,e,n,r,i){return 2===t.h&&(pt(t,Ce(e,r,n,!0),i),!0)}),Ln),Vn=wn((function(t,e,n,r,i){return 2===t.h&&(pt(t,Ce(e,r,n),i),!0)}),Ln),Wn=An((function(t,e,n,r,i){if(2!==t.h)return!1;r=me(void 0,r[0],r[1]);const o=$t(e);Zt(o);let s=Ie(e,o,n,3);return(Object.isFrozen(s)||4&Rt(s))&&(s=Ct(s),xe(e,o,n,s)),s.push(r),pt(t,r,i),!0}),(function(t,e,n,r,i){if(Array.isArray(e))for(let o=0;o<e.length;o++)Ln(t,e[o],n,r,i)})),Hn=wn((function(t,e,n,r,i,o){if(2!==t.h)return!1;const s=$t(e);return Zt(s),(o=ke(e,s,o))&&n!==o&&xe(e,s,o),pt(t,e=Ce(e,r,n),i),!0}),Ln),Jn=wn((function(t,e,n){return 2===t.h&&(_n(e,n,vt(t)),!0)}),On),Kn=wn((function(t,e,n){return 0===t.h&&(_n(e,n,t.g.h()),!0)}),(function(t,e,n){null!=(e=le(e))&&(e=parseInt(e,10),jt(t,n,0),Ot(t.g,e))})),qn=An((function(t,e,n){return(0===t.h||2===t.h)&&(e=Ie(e,$t(e),n,2,!1),2==t.h?yt(t,ht.prototype.F,e):e.push(t.g.h()),!0)}),(function(t,e,n){if(null!=(e=Xe(le,e))&&e.length){n=Ft(t,n);for(let n=0;n<e.length;n++)Ot(t.g,e[n]);Ut(t,n)}}));class Yn{constructor(t,e){this.h=t,this.g=e,this.j=Re,this.defaultValue=void 0}}function Xn(t,e){return(n,r)=>{t:{if(bt.length){const t=bt.pop();t.s(r),it(t.g,n,r),n=t}else n=new class{constructor(t,e){if(ft.length){const n=ft.pop();it(n,t,e),t=n}else t=new ht(t,e);this.g=t,this.j=this.g.g,this.h=this.l=-1,this.s(e)}s({K:t=!1}={}){this.K=t}}(n,r);try{var i=new t;const r=i.m;Ze(e)(r,n),ee&&delete r[ee];var o=i;break t}finally{(i=n.g).j=null,i.B=!1,i.C=0,i.l=0,i.g=0,i.I=!1,n.l=-1,n.h=-1,100>bt.length&&bt.push(n)}o=void 0}return o}}var Qn,Zn=[0,Rn,wn((function(t,e,n){return 2===t.h&&(_n(e,n,(t=vt(t))===G()?void 0:t),!0)}),(function(t,e,n){if(null!=e){if(e instanceof Ke){const r=e.V;return void(r&&(e=r(e),null!=e&&Bt(t,n,J(e).buffer)))}if(Array.isArray(e))return}On(t,e,n)}))];function tr(n){if(void 0===Qn){var r=null,i=t.trustedTypes;if(i&&i.createPolicy){try{r=i.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(e){t.console&&t.console.error(e.message)}Qn=r}else Qn=r}return n=(r=Qn)?r.createScriptURL(n):n,new class{constructor(t){this.g=t}toString(){return this.g+""}}(n)}var er=[0,$n],nr=[0,kn,Kn,Nn,Nn,Cn,Kn,Kn],rr=[0,Nn,Nn],ir=class extends Ke{constructor(){super()}};ir.A=[6];var or=[0,Nn,$n,Nn,Kn,Kn,qn,$n,$n,Vn,rr,Kn],sr=[0,$n,$n,$n],ar=class extends Ke{constructor(){super()}},ur=[0],cr=[0,kn],lr=[1,2,3,4,5],hr=class extends Ke{constructor(t){super(t,2)}},fr={},dr=[-2,fr,Nn];fr[336783863]=Ye([0,$n,Nn,Nn,kn,Vn,[0,Hn,ur,lr,Hn,or,lr,Hn,sr,lr,Hn,cr,lr,Hn,nr,lr],Vn,er]);var gr=[0,Rn,Dn],pr=[0,Un,Un,Dn,Dn,Dn,Dn,Un,Cn,Rn,Mn,Un,Un,Dn,Mn,Dn,Dn,Dn,Rn],mr=[-1,{}],vr=[0,$n,Vn,2,mr],yr=[0,$n,Gn,Vn,mr],br=class extends Ke{constructor(t){super(t,500)}s(t){return Re(this,0,7,t)}};br.A=[3,4,5,6,8,13,17,1005];var wr,Ar=[-500,Rn,Rn,Gn,Gn,Gn,Gn,Vn,dr,Wn,Zn,Mn,Mn,Vn,vr,Vn,yr,Wn,gr,Rn,Vn,pr,Mn,Gn,Gn,988],_r=[0,Rn,Rn,Vn,mr],Sr=[-500,$n,$n,Vn,[-1,{}],$n,999],Tr=[-500,$n,Gn,Gn,Vn,[-2,{},Nn],Gn,998,Gn],Er=[-500,$n,Gn,Vn,mr,Gn,999],Pr=class extends Ke{constructor(){super(void 0,500)}s(t){return Re(this,0,1001,t)}};Pr.A=[1,6,7,9,10,15,16,17,14,1002],Pr.prototype.g=(wr=[-500,Wn,Ar,Wn,5,Sr,Wn,Tr,Mn,Wn,Er,Gn,Mn,Vn,vr,Vn,yr,Wn,_r,Gn,Gn,Gn,Vn,pr,Rn,Rn,Dn,Vn,980,mr,Wn,Zn],function(){const t=new class{constructor(){this.j=[],this.h=0,this.g=new class{constructor(){this.g=[]}length(){return this.g.length}end(){const t=this.g;return this.g=[],t}}}};bn(this.m,t,dn(wr)),It(t,t.g.end());const e=new Uint8Array(t.h),n=t.j,r=n.length;let i=0;for(let t=0;t<r;t++){const r=n[t];e.set(r,i),i+=r.length}return t.j=[e],e});var Lr=class extends Ke{constructor(t){super(t)}},Or=[0,kn,In,$n,$n],xr=class extends Ke{constructor(t){super(t)}g(){return Ge(this,Lr)}};xr.A=[1];var Ir=[0,Wn,Or],jr=class extends Ke{constructor(t){super(t)}};jr.A=[4,5];var Fr=class extends Ke{constructor(t){super(t)}},Ur=[1,2,3,4,5],Br=class extends Ke{constructor(t){super(t)}g(){return null!=je(this)}h(){return null!=de(Pe(this,2))}},kr=class extends Ke{constructor(t){super(t)}},Cr=[0,Vn,[0,Jn,$n,Vn,[0,kn,Fn,Fn],Vn,[0,Bn,Fn]],Nn,Vn,[0,Hn,cr,Ur,Hn,or,Ur,Hn,nr,Ur,Hn,ur,Ur,Hn,sr,Ur]],Mr=class extends Ke{constructor(t){super(t)}},Nr=new Yn(451755788,Mr);fr[451755788]=Ye([0,Vn,Cr,Vn,[0,$n,kn,In,Gn,Gn],xn]);var Dr=class extends Ke{constructor(t){super(t)}},Gr=class extends Ke{constructor(t){super(t)}},Rr=new Yn(487277289,Gr);fr[487277289]=Ye([0,Vn,Cr,Vn,[0,Nn,Nn]]);var $r=class extends Ke{constructor(t){super(t)}},zr=[0,kn,2,$n,Vn,Ir],Vr=class extends Ke{constructor(t){super(t)}};Vr.A=[1];var Wr=Xn(Vr,[0,Wn,zr,Fn]),Hr=class extends Ke{constructor(t){super(t)}};Hr.A=[1];var Jr=class extends Ke{constructor(t){super(t)}M(){const t=je(this);return null==t?G():t}},Kr=class extends Ke{constructor(t){super(t)}},qr=[1,2],Yr=[0,Hn,[0,jn],qr,Hn,[0,Jn],qr,kn,$n],Xr=class extends Ke{constructor(t){super(t)}};Xr.A=[1];var Qr=Xn(Xr,[0,Wn,Yr,Fn]);async function Zr(t){if("function"!=typeof importScripts){const e=document.createElement("script");return e.src=t.toString(),e.crossOrigin="anonymous",new Promise(((t,n)=>{e.addEventListener("load",(()=>{t()}),!1),e.addEventListener("error",(t=>{n(t)}),!1),document.body.appendChild(e)}))}importScripts(t.toString())}function ti(t,e,n){t.l||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target"),n(e=t.i.stringToNewUTF8(e)),t.i._free(e)}function ei(t,e,n){t.l||console.error("No wasm multistream support detected: ensure dependency inclusion of :gl_graph_runner_internal_multi_input target");const r=new Uint32Array(e.length);for(let n=0;n<e.length;n++)r[n]=t.i.stringToNewUTF8(e[n]);e=t.i._malloc(4*r.length),t.i.HEAPU32.set(r,e>>2),n(e);for(const e of r)t.i._free(e);t.i._free(e)}function ni(t,e,n){t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=n}function ri(t,e,n){let r=[];t.i.simpleListeners=t.i.simpleListeners||{},t.i.simpleListeners[e]=(t,e,i)=>{e?(n(r,i),r=[]):r.push(t)}}const ii=function(t){return class extends t{S(){this.i._registerModelResourcesGraphService()}}}(class{constructor(t,e){this.j=!0,this.i=t,this.g=null,this.h=0,this.l="function"==typeof this.i._addIntToInputStream,void 0!==e?this.i.canvas=e:((t="undefined"==typeof OffscreenCanvas)||(t=(t=navigator.userAgent).includes("Safari")&&!t.includes("Chrome")),t?(console.warn("OffscreenCanvas not supported and GraphRunner constructor glCanvas parameter is undefined. Creating backup canvas."),this.i.canvas=document.createElement("canvas")):this.i.canvas=new OffscreenCanvas(1,1))}async initializeGraph(t){const e=await(await fetch(t)).arrayBuffer();t=!(t.endsWith(".pbtxt")||t.endsWith(".textproto")),this.setGraph(new Uint8Array(e),t)}setGraphFromString(t){this.setGraph((new TextEncoder).encode(t),!1)}setGraph(t,e){const n=t.length,r=this.i._malloc(n);this.i.HEAPU8.set(t,r),e?this.i._changeBinaryGraph(n,r):this.i._changeTextGraph(n,r),this.i._free(r)}configureAudio(t,e,n,r,i){this.i._configureAudio||console.warn('Attempting to use configureAudio without support for input audio. Is build dep ":gl_graph_runner_audio" missing?'),ti(this,r||"input_audio",(r=>{ti(this,i=i||"audio_header",(i=>{this.i._configureAudio(r,i,t,e,n)}))}))}setAutoResizeCanvas(t){this.j=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,n){this.addAudioToStreamWithShape(t,0,0,e,n)}addAudioToStreamWithShape(t,e,n,r,i){const o=4*t.length;this.h!==o&&(this.g&&this.i._free(this.g),this.g=this.i._malloc(o),this.h=o),this.i.HEAPF32.set(t,this.g/4),ti(this,r,(t=>{this.i._addAudioToInputStream(this.g,e,n,t,i)}))}addGpuBufferToStream(t,e,n){ti(this,e,(e=>{if(!this.i.canvas)throw Error("No OpenGL canvas configured.");e?this.i._bindTextureToStream(e):this.i._bindTextureToCanvas();var r=this.i.canvas.getContext("webgl2")||this.i.canvas.getContext("webgl");if(!r)throw Error("Failed to obtain WebGL context from the provided canvas. `getContext()` should only be invoked with `webgl` or `webgl2`.");let i;this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t),this.i.gpuOriginForWebTexturesIsBottomLeft&&r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),t.videoWidth?(r=t.videoWidth,i=t.videoHeight):t.naturalWidth?(r=t.naturalWidth,i=t.naturalHeight):(r=t.width,i=t.height),!this.j||r===this.i.canvas.width&&i===this.i.canvas.height||(this.i.canvas.width=r,this.i.canvas.height=i);const[o,s]=[r,i];this.i._addBoundTextureToStream(e,o,s,n)}))}addBoolToStream(t,e,n){ti(this,e,(e=>{this.i._addBoolToInputStream(t,e,n)}))}addDoubleToStream(t,e,n){ti(this,e,(e=>{this.i._addDoubleToInputStream(t,e,n)}))}addFloatToStream(t,e,n){ti(this,e,(e=>{this.i._addFloatToInputStream(t,e,n)}))}addIntToStream(t,e,n){ti(this,e,(e=>{this.i._addIntToInputStream(t,e,n)}))}addStringToStream(t,e,n){ti(this,e,(e=>{ti(this,t,(t=>{this.i._addStringToInputStream(t,e,n)}))}))}addStringRecordToStream(t,e,n){ti(this,e,(e=>{ei(this,Object.keys(t),(r=>{ei(this,Object.values(t),(i=>{this.i._addFlatHashMapToInputStream(r,i,Object.keys(t).length,e,n)}))}))}))}addProtoToStream(t,e,n,r){ti(this,n,(n=>{ti(this,e,(e=>{const i=this.i._malloc(t.length);this.i.HEAPU8.set(t,i),this.i._addProtoToInputStream(i,t.length,e,n,r),this.i._free(i)}))}))}addEmptyPacketToStream(t,e){ti(this,t,(t=>{this.i._addEmptyPacketToInputStream(t,e)}))}addBoolToInputSidePacket(t,e){ti(this,e,(e=>{this.i._addBoolToInputSidePacket(t,e)}))}addDoubleToInputSidePacket(t,e){ti(this,e,(e=>{this.i._addDoubleToInputSidePacket(t,e)}))}addFloatToInputSidePacket(t,e){ti(this,e,(e=>{this.i._addFloatToInputSidePacket(t,e)}))}addIntToInputSidePacket(t,e){ti(this,e,(e=>{this.i._addIntToInputSidePacket(t,e)}))}addStringToInputSidePacket(t,e){ti(this,e,(e=>{ti(this,t,(t=>{this.i._addStringToInputSidePacket(t,e)}))}))}addProtoToInputSidePacket(t,e,n){ti(this,n,(n=>{ti(this,e,(e=>{const r=this.i._malloc(t.length);this.i.HEAPU8.set(t,r),this.i._addProtoToInputSidePacket(r,t.length,e,n),this.i._free(r)}))}))}attachBoolListener(t,e){ni(this,t,e),ti(this,t,(t=>{this.i._attachBoolListener(t)}))}attachBoolVectorListener(t,e){ri(this,t,e),ti(this,t,(t=>{this.i._attachBoolVectorListener(t)}))}attachIntListener(t,e){ni(this,t,e),ti(this,t,(t=>{this.i._attachIntListener(t)}))}attachIntVectorListener(t,e){ri(this,t,e),ti(this,t,(t=>{this.i._attachIntVectorListener(t)}))}attachDoubleListener(t,e){ni(this,t,e),ti(this,t,(t=>{this.i._attachDoubleListener(t)}))}attachDoubleVectorListener(t,e){ri(this,t,e),ti(this,t,(t=>{this.i._attachDoubleVectorListener(t)}))}attachFloatListener(t,e){ni(this,t,e),ti(this,t,(t=>{this.i._attachFloatListener(t)}))}attachFloatVectorListener(t,e){ri(this,t,e),ti(this,t,(t=>{this.i._attachFloatVectorListener(t)}))}attachStringListener(t,e){ni(this,t,e),ti(this,t,(t=>{this.i._attachStringListener(t)}))}attachStringVectorListener(t,e){ri(this,t,e),ti(this,t,(t=>{this.i._attachStringVectorListener(t)}))}attachProtoListener(t,e,n){ni(this,t,e),ti(this,t,(t=>{this.i._attachProtoListener(t,n||!1)}))}attachProtoVectorListener(t,e,n){ri(this,t,e),ti(this,t,(t=>{this.i._attachProtoVectorListener(t,n||!1)}))}attachAudioListener(t,e,n){this.i._attachAudioListener||console.warn('Attempting to use attachAudioListener without support for output audio. Is build dep ":gl_graph_runner_audio_out" missing?'),ni(this,t,((t,n)=>{t=new Float32Array(t.buffer,t.byteOffset,t.length/4),e(t,n)})),ti(this,t,(t=>{this.i._attachAudioListener(t,n||!1)}))}finishProcessing(){this.i._waitUntilIdle()}closeGraph(){this.i._closeGraph(),this.i.simpleListeners=void 0,this.i.emptyPacketListeners=void 0}});var oi=class extends ii{};async function si(t,e,n){return t=await(async(t,e,n,r)=>{if(e&&await Zr(e),!self.ModuleFactory)throw Error("ModuleFactory not set.");if(n&&(await Zr(n),!self.ModuleFactory))throw Error("ModuleFactory not set.");return self.Module&&r&&((e=self.Module).locateFile=r.locateFile,r.mainScriptUrlOrBlob&&(e.mainScriptUrlOrBlob=r.mainScriptUrlOrBlob)),r=await self.ModuleFactory(self.Module||r),self.ModuleFactory=self.Module=void 0,new t(r,null)})(t,e.wasmLoaderPath,e.assetLoaderPath,{locateFile(t){var n=e.wasmBinaryPath.toString();return n.includes(t)?n:(n=e.assetBinaryPath?.toString(),n?.includes(t)?n:t)}}),await t.s(n),t}async function ai(t,e,n){return si(t,e,n)}function ui(t,e){const n=Ne(t.baseOptions,Br,1)||new Br;"string"==typeof e?(Oe(n,2,fe(e)),Oe(n,1)):e instanceof Uint8Array&&(Oe(n,1,Xt(e,!1,!1)),Oe(n,2)),Re(t.baseOptions,0,1,n)}function ci(t,e){const n=e.baseOptions||{};if(e.baseOptions?.modelAssetBuffer&&e.baseOptions?.modelAssetPath)throw Error("Cannot set both baseOptions.modelAssetPath and baseOptions.modelAssetBuffer");if(!(Ne(t.baseOptions,Br,1)?.g()||Ne(t.baseOptions,Br,1)?.h()||e.baseOptions?.modelAssetBuffer||e.baseOptions?.modelAssetPath))throw Error("Either baseOptions.modelAssetPath or baseOptions.modelAssetBuffer must be set");return function(t,e){let n=Ne(t.baseOptions,Fr,3);if(!n){var r=n=new Fr;$e(r,4,new ar)}"delegate"in e&&("GPU"===e.delegate?$e(e=n,2,r=new ir):$e(e=n,4,r=new ar)),Re(t.baseOptions,0,3,n)}(t,n),n.modelAssetPath?fetch(n.modelAssetPath.toString()).then((t=>{if(t.ok)return t.arrayBuffer();throw Error(`Failed to fetch model: ${n.modelAssetPath} (${t.status})`)})).then((e=>{try{t.g.i.FS_unlink("/model.dat")}catch{}t.g.i.FS_createDataFile("/","model.dat",new Uint8Array(e),!0,!1,!1),ui(t,"/model.dat"),t.F()})):(ui(t,n.modelAssetBuffer),t.F(),Promise.resolve())}function li(t){try{const e=t.j.length;if(1===e)throw Error(t.j[0].message);if(1<e)throw Error("Encountered multiple errors: "+t.j.map((t=>t.message)).join(", "))}finally{t.j=[]}}function hi(t,e){t.v=Math.max(t.v,e)}var fi=class{constructor(t){this.g=t,this.j=[],this.v=0,this.g.setAutoRenderToScreen(!1)}setGraph(t,e){this.g.attachErrorListener(((t,e)=>{this.j.push(Error(e))})),this.g.S(),this.g.setGraph(t,e),li(this)}finishProcessing(){this.g.finishProcessing(),li(this)}close(){this.g.closeGraph()}};async function di(t,e,n){return ai(t,e,n)}fi.prototype.close=fi.prototype.close,function(e,n){e=e.split(".");var r,i=t;e[0]in i||void 0===i.execScript||i.execScript("var "+e[0]);for(;e.length&&(r=e.shift());)e.length||void 0===n?i=i[r]&&i[r]!==Object.prototype[r]?i[r]:i[r]={}:i[r]=n}("TaskRunner",fi);var gi=class extends fi{constructor(){super(...arguments),this.C=48e3}U(t){this.C=t}};function pi(t){const e={classifications:Ge(t,$r).map((t=>function(t,e=-1,n=""){return{categories:t.map((t=>{var e=le(Pe(t,1))??0??-1;const n=t.m,r=$t(n),i=Le(n,r,2),o=ae(i);return null!=o&&o!==i&&xe(n,r,2,o),{index:e,score:o??0??0,categoryName:de(Pe(t,3))??""??"",displayName:de(Pe(t,4))??""??""}})),headIndex:e,headName:n}}(Ne(t,xr,4)?.g()??[],le(Pe(t,2))??0,de(Pe(t,3))??"")))};return null!=Ve(t)&&(e.timestampMs=We(Ve(t))),e}gi.prototype.setDefaultSampleRate=gi.prototype.U;var mi=class extends gi{constructor(t,e){super(new oi(t,e)),this.l=[],this.h=new Mr,t=new kr,Re(this.h,0,1,t)}get baseOptions(){return Ne(this.h,kr,1)}set baseOptions(t){Re(this.h,0,1,t)}s(e){var n=this.h,r=Ne(this.h,jr,2);if(r=r?_e(r):new jr,void 0!==e.displayNamesLocale?Oe(r,1,fe(e.displayNamesLocale)):void 0===e.displayNamesLocale&&Oe(r,1),void 0!==e.maxResults){var i=e.maxResults;if(null!=i){if("number"!=typeof i)throw se(e=Error(),"warning"),e;if(!Number.isFinite(i)){const e=Error();se(e,"incident"),function(e){t.setTimeout((()=>{throw e}),0)}(e)}}Oe(r,2,i)}else"maxResults"in e&&Oe(r,2);if(void 0!==e.scoreThreshold){if(null!=(i=e.scoreThreshold)&&"number"!=typeof i)throw Error(`Value of float/double field must be a number, found ${typeof i}: ${i}`);Oe(r,3,i)}else"scoreThreshold"in e&&Oe(r,3);return void 0!==e.categoryAllowlist?Fe(r,4,e.categoryAllowlist):"categoryAllowlist"in e&&Oe(r,4),void 0!==e.categoryDenylist?Fe(r,5,e.categoryDenylist):"categoryDenylist"in e&&Oe(r,5),Re(n,0,2,r),ci(this,e)}O(t,e){return this.B(t,e??this.C,this.v+1)}B(t,e,n){return this.g.addDoubleToStream(e,"sample_rate",n),this.g.addAudioToStreamWithShape(t,1,t.length,"audio_in",n),this.l=[],this.finishProcessing(),[...this.l]}F(){var t=new Pr;He(t,10,"audio_in"),He(t,10,"sample_rate"),He(t,15,"timestamped_classifications");const e=new hr;Je(e,Nr,this.h);const n=new br;Ue(n,fe("mediapipe.tasks.audio.audio_classifier.AudioClassifierGraph")),He(n,3,"AUDIO:audio_in"),He(n,3,"SAMPLE_RATE:sample_rate"),He(n,4,"TIMESTAMPED_CLASSIFICATIONS:timestamped_classifications"),n.s(e),ze(t,n),this.g.attachProtoVectorListener("timestamped_classifications",((t,e)=>{!function(t,e){e.forEach((e=>{e=Wr(e),t.l.push(pi(e))}))}(this,t),hi(this,e)})),this.g.attachEmptyPacketListener("timestamped_classifications",(t=>{hi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};function vi(t){return{embeddings:Ge(t,Kr).map((t=>{const e={headIndex:le(Pe(t,3))??0??-1,headName:de(Pe(t,4))??""??""};if(void 0!==Me(t,Hr,Be(t,1))){t=Ne(t,Hr,Be(t,1)).m;var n=$t(t);const r=2&n;let i=Ie(t,n,1,1),o=Rt(i);if(!(4&o)){Object.isFrozen(i)&&(o=0,i=Ct(i),xe(t,n,1,i));let e=0,s=0;for(;e<i.length;e++){const t=ae(i[e]);null!=t&&(i[s++]=t)}s<e&&(i.length=s),o|=5,r&&(o|=34),zt(i,o),2&o&&Object.freeze(i)}!r&&(2&o||Object.isFrozen(i))&&(i=Ct(i),Nt(i,5),xe(t,n,1,i)),e.floatEmbedding=i}else n=new Uint8Array(0),e.quantizedEmbedding=Ne(t,Jr,Be(t,2))?.M()?.N()??n;return e})),timestampMs:We(Ve(t))}}mi.prototype.classify=mi.prototype.O,mi.prototype.setOptions=mi.prototype.s,mi.createFromModelPath=function(t,e){return ai(mi,t,{baseOptions:{modelAssetPath:e}})},mi.createFromModelBuffer=function(t,e){return di(mi,t,{baseOptions:{modelAssetBuffer:e}})},mi.createFromOptions=function(t,e){return di(mi,t,e)};var yi=class extends gi{constructor(t,e){super(new oi(t,e)),this.l=[],this.h=new Gr,t=new kr,Re(this.h,0,1,t)}get baseOptions(){return Ne(this.h,kr,1)}set baseOptions(t){Re(this.h,0,1,t)}s(t){var e=this.h,n=Ne(this.h,Dr,2);return n=n?_e(n):new Dr,void 0!==t.l2Normalize?Oe(n,1,ue(t.l2Normalize)):"l2Normalize"in t&&Oe(n,1),void 0!==t.quantize?Oe(n,2,ue(t.quantize)):"quantize"in t&&Oe(n,2),Re(e,0,2,n),ci(this,t)}P(t,e){return this.B(t,e??this.C,this.v+1)}B(t,e,n){return this.g.addDoubleToStream(e,"sample_rate",n),this.g.addAudioToStreamWithShape(t,1,t.length,"audio_in",n),this.l=[],this.finishProcessing(),this.l}F(){var t=new Pr;He(t,10,"audio_in"),He(t,10,"sample_rate"),He(t,15,"embeddings_out"),He(t,15,"timestamped_embeddings_out");const e=new hr;Je(e,Rr,this.h);const n=new br;Ue(n,fe("mediapipe.tasks.audio.audio_embedder.AudioEmbedderGraph")),He(n,3,"AUDIO:audio_in"),He(n,3,"SAMPLE_RATE:sample_rate"),He(n,4,"EMBEDDINGS:embeddings_out"),He(n,4,"TIMESTAMPED_EMBEDDINGS:timestamped_embeddings_out"),n.s(e),ze(t,n),this.g.attachProtoListener("embeddings_out",((t,e)=>{t=Qr(t),this.l.push(vi(t)),hi(this,e)})),this.g.attachEmptyPacketListener("embeddings_out",(t=>{hi(this,t)})),this.g.attachProtoVectorListener("timestamped_embeddings_out",((t,e)=>{for(const e of t)t=Qr(e),this.l.push(vi(t));hi(this,e)})),this.g.attachEmptyPacketListener("timestamped_embeddings_out",(t=>{hi(this,t)})),t=t.g(),this.setGraph(new Uint8Array(t),!0)}};let bi;yi.prototype.embed=yi.prototype.P,yi.prototype.setOptions=yi.prototype.s,yi.createFromModelPath=function(t,e){return di(yi,t,{baseOptions:{modelAssetPath:e}})},yi.createFromModelBuffer=function(t,e){return di(yi,t,{baseOptions:{modelAssetBuffer:e}})},yi.createFromOptions=function(t,e){return di(yi,t,e)};const wi=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 Ai(){if(void 0===bi)try{await WebAssembly.instantiate(wi),bi=!0}catch{bi=!1}return bi}async function _i(t,e){const n=await Ai()?"wasm_internal":"wasm_nosimd_internal";return void 0!==e?{wasmLoaderPath:`${e}/${t}_${n}.js`,wasmBinaryPath:`${e}/${t}_${n}.wasm`}:{wasmLoaderPath:tr(`./${encodeURIComponent(t)}_${encodeURIComponent(n)}.js`),wasmBinaryPath:tr(`./${encodeURIComponent(t)}_${encodeURIComponent(n)}.wasm`)}}var Si=class{};Si.forVisionTasks=function(t=""){return _i("vision",t)},Si.forTextTasks=function(t=""){return _i("text",t)},Si.forAudioTasks=function(t=""){return _i("audio",t)},Si.isSimdSupported=function(){return Ai()},exports.AudioClassifier=mi,exports.AudioEmbedder=yi,exports.AudioTaskRunner=gi,exports.FilesetResolver=Si;
|
|
2
|
+
//# sourceMappingURL=audio_bundle_cjs.js.map
|