@sorisdk/web-audio 0.1.0
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 +98 -0
- package/dist/generated/window.d.ts +12 -0
- package/dist/generated/window.js +9 -0
- package/dist/generated/window_bg.js +364 -0
- package/dist/generated/window_bg.wasm +0 -0
- package/dist/generated/window_bg.wasm.d.ts +15 -0
- package/dist/index.d.ts +241 -0
- package/dist/index.js +1217 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @sorisdk/web-audio
|
|
2
|
+
|
|
3
|
+
Browser microphone capture and real-time matching SDK for NADA.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package owns browser-only concerns that do not belong in `@sorisdk/matcher`:
|
|
8
|
+
|
|
9
|
+
- microphone permission and `getUserMedia`
|
|
10
|
+
- Web Audio graph setup
|
|
11
|
+
- PCM chunk capture
|
|
12
|
+
- rolling fingerprint generation with `@sorisdk/afpgen`
|
|
13
|
+
- rolling query matching with `@sorisdk/matcher`
|
|
14
|
+
|
|
15
|
+
## API
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { AudioRecognizer } from "@sorisdk/web-audio";
|
|
19
|
+
|
|
20
|
+
const recognizer = new AudioRecognizer({
|
|
21
|
+
appId: "app-1",
|
|
22
|
+
ephemeralKeyEndpoint: "https://site.example.com/api/ephemeral-key"
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
recognizer.on("campaign", (event) => {
|
|
26
|
+
console.log(event.campaign);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await recognizer.start();
|
|
30
|
+
await recognizer.stop();
|
|
31
|
+
await recognizer.destroy();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
By default, `AudioRecognizer` uses the SORI API prefix `https://console.soriapi.com/api`
|
|
35
|
+
and derives:
|
|
36
|
+
|
|
37
|
+
- auth: `/auth`
|
|
38
|
+
- activity: `/activity/`
|
|
39
|
+
|
|
40
|
+
So direct ephemeral key usage can be as small as:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const recognizer = new AudioRecognizer({
|
|
44
|
+
appId: "app-1",
|
|
45
|
+
ephemeralKey: "ek-..."
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
|
|
51
|
+
- This package is browser-only.
|
|
52
|
+
- It uses `AudioWorkletNode` when available and falls back to `ScriptProcessorNode`.
|
|
53
|
+
- Matching window size and matching-quality-sensitive runtime tuning stay internal to the SDK.
|
|
54
|
+
|
|
55
|
+
## Session Utility
|
|
56
|
+
|
|
57
|
+
When you need direct control over the browser session identifier, use the built-in
|
|
58
|
+
session manager instead of handling `localStorage` yourself:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { createLocalStorageSessionManager } from "@sorisdk/web-audio";
|
|
62
|
+
|
|
63
|
+
const sessions = createLocalStorageSessionManager({
|
|
64
|
+
key: "sorisdk:web-audio:session:app-1"
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const sessionId = sessions.getSessionId();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Low-Level Auth Cache Helper
|
|
71
|
+
|
|
72
|
+
When `/api/auth` requires a `v` value, the browser package can keep the last successful
|
|
73
|
+
`version + packUrl` metadata in `localStorage` while leaving the actual audiopack bytes to
|
|
74
|
+
the browser HTTP cache:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import {
|
|
78
|
+
authenticateAndLoadAudioPack,
|
|
79
|
+
createLocalStorageAudioPackStore
|
|
80
|
+
} from "@sorisdk/web-audio";
|
|
81
|
+
|
|
82
|
+
const store = createLocalStorageAudioPackStore({
|
|
83
|
+
key: "sorisdk:matcher:app-1"
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const result = await authenticateAndLoadAudioPack({
|
|
87
|
+
loader: microphoneMatcher,
|
|
88
|
+
auth: {
|
|
89
|
+
endpoint: "https://console.example.com/api/auth",
|
|
90
|
+
appId: "app-1",
|
|
91
|
+
ephemeralKey: "ek-...",
|
|
92
|
+
sessionId: "browser-device-1"
|
|
93
|
+
},
|
|
94
|
+
store
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
console.log(result.token, result.loadedPackUrl, result.persistedVersion);
|
|
98
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmFingerprintMatchWindow {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
appendFingerprint(bytes: Uint8Array): void;
|
|
8
|
+
hasReadyQuery(): boolean;
|
|
9
|
+
constructor(sample_rate: number, afpgen_config: any | null | undefined, match_window_ms: number, match_stride_ms: number);
|
|
10
|
+
reset(): void;
|
|
11
|
+
takeReadyQuery(): any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
export class WasmFingerprintMatchWindow {
|
|
2
|
+
__destroy_into_raw() {
|
|
3
|
+
const ptr = this.__wbg_ptr;
|
|
4
|
+
this.__wbg_ptr = 0;
|
|
5
|
+
WasmFingerprintMatchWindowFinalization.unregister(this);
|
|
6
|
+
return ptr;
|
|
7
|
+
}
|
|
8
|
+
free() {
|
|
9
|
+
const ptr = this.__destroy_into_raw();
|
|
10
|
+
wasm.__wbg_wasmfingerprintmatchwindow_free(ptr, 0);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {Uint8Array} bytes
|
|
14
|
+
*/
|
|
15
|
+
appendFingerprint(bytes) {
|
|
16
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
17
|
+
const len0 = WASM_VECTOR_LEN;
|
|
18
|
+
wasm.wasmfingerprintmatchwindow_appendFingerprint(this.__wbg_ptr, ptr0, len0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
hasReadyQuery() {
|
|
24
|
+
const ret = wasm.wasmfingerprintmatchwindow_hasReadyQuery(this.__wbg_ptr);
|
|
25
|
+
return ret !== 0;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param {number} sample_rate
|
|
29
|
+
* @param {any | null | undefined} afpgen_config
|
|
30
|
+
* @param {number} match_window_ms
|
|
31
|
+
* @param {number} match_stride_ms
|
|
32
|
+
*/
|
|
33
|
+
constructor(sample_rate, afpgen_config, match_window_ms, match_stride_ms) {
|
|
34
|
+
const ret = wasm.wasmfingerprintmatchwindow_new(sample_rate, isLikeNone(afpgen_config) ? 0 : addToExternrefTable0(afpgen_config), match_window_ms, match_stride_ms);
|
|
35
|
+
if (ret[2]) {
|
|
36
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
37
|
+
}
|
|
38
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
39
|
+
WasmFingerprintMatchWindowFinalization.register(this, this.__wbg_ptr, this);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
reset() {
|
|
43
|
+
wasm.wasmfingerprintmatchwindow_reset(this.__wbg_ptr);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns {any}
|
|
47
|
+
*/
|
|
48
|
+
takeReadyQuery() {
|
|
49
|
+
const ret = wasm.wasmfingerprintmatchwindow_takeReadyQuery(this.__wbg_ptr);
|
|
50
|
+
return ret;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (Symbol.dispose) WasmFingerprintMatchWindow.prototype[Symbol.dispose] = WasmFingerprintMatchWindow.prototype.free;
|
|
54
|
+
export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
|
|
55
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
56
|
+
return ret;
|
|
57
|
+
}
|
|
58
|
+
export function __wbg_Number_a5a435bd7bbec835(arg0) {
|
|
59
|
+
const ret = Number(arg0);
|
|
60
|
+
return ret;
|
|
61
|
+
}
|
|
62
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
63
|
+
const ret = String(arg1);
|
|
64
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
|
+
const len1 = WASM_VECTOR_LEN;
|
|
66
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
67
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
68
|
+
}
|
|
69
|
+
export function __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1(arg0) {
|
|
70
|
+
const v = arg0;
|
|
71
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
72
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
73
|
+
}
|
|
74
|
+
export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
|
|
75
|
+
const ret = debugString(arg1);
|
|
76
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
77
|
+
const len1 = WASM_VECTOR_LEN;
|
|
78
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
79
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
80
|
+
}
|
|
81
|
+
export function __wbg___wbindgen_in_41dbb8413020e076(arg0, arg1) {
|
|
82
|
+
const ret = arg0 in arg1;
|
|
83
|
+
return ret;
|
|
84
|
+
}
|
|
85
|
+
export function __wbg___wbindgen_is_null_0b605fc6b167c56f(arg0) {
|
|
86
|
+
const ret = arg0 === null;
|
|
87
|
+
return ret;
|
|
88
|
+
}
|
|
89
|
+
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
90
|
+
const val = arg0;
|
|
91
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
92
|
+
return ret;
|
|
93
|
+
}
|
|
94
|
+
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
95
|
+
const ret = arg0 === undefined;
|
|
96
|
+
return ret;
|
|
97
|
+
}
|
|
98
|
+
export function __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b(arg0, arg1) {
|
|
99
|
+
const ret = arg0 == arg1;
|
|
100
|
+
return ret;
|
|
101
|
+
}
|
|
102
|
+
export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
|
|
103
|
+
const obj = arg1;
|
|
104
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
105
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
106
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
107
|
+
}
|
|
108
|
+
export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
109
|
+
const obj = arg1;
|
|
110
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
111
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
112
|
+
var len1 = WASM_VECTOR_LEN;
|
|
113
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
114
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
115
|
+
}
|
|
116
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
117
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
118
|
+
}
|
|
119
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
120
|
+
const ret = arg0[arg1];
|
|
121
|
+
return ret;
|
|
122
|
+
}
|
|
123
|
+
export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
124
|
+
let result;
|
|
125
|
+
try {
|
|
126
|
+
result = arg0 instanceof ArrayBuffer;
|
|
127
|
+
} catch (_) {
|
|
128
|
+
result = false;
|
|
129
|
+
}
|
|
130
|
+
const ret = result;
|
|
131
|
+
return ret;
|
|
132
|
+
}
|
|
133
|
+
export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
134
|
+
let result;
|
|
135
|
+
try {
|
|
136
|
+
result = arg0 instanceof Uint8Array;
|
|
137
|
+
} catch (_) {
|
|
138
|
+
result = false;
|
|
139
|
+
}
|
|
140
|
+
const ret = result;
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
|
|
144
|
+
const ret = Number.isSafeInteger(arg0);
|
|
145
|
+
return ret;
|
|
146
|
+
}
|
|
147
|
+
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
148
|
+
const ret = arg0.length;
|
|
149
|
+
return ret;
|
|
150
|
+
}
|
|
151
|
+
export function __wbg_new_5f486cdf45a04d78(arg0) {
|
|
152
|
+
const ret = new Uint8Array(arg0);
|
|
153
|
+
return ret;
|
|
154
|
+
}
|
|
155
|
+
export function __wbg_new_from_slice_22da9388ac046e50(arg0, arg1) {
|
|
156
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
157
|
+
return ret;
|
|
158
|
+
}
|
|
159
|
+
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
160
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
161
|
+
}
|
|
162
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
163
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
164
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
165
|
+
return ret;
|
|
166
|
+
}
|
|
167
|
+
export function __wbindgen_init_externref_table() {
|
|
168
|
+
const table = wasm.__wbindgen_externrefs;
|
|
169
|
+
const offset = table.grow(4);
|
|
170
|
+
table.set(0, undefined);
|
|
171
|
+
table.set(offset + 0, undefined);
|
|
172
|
+
table.set(offset + 1, null);
|
|
173
|
+
table.set(offset + 2, true);
|
|
174
|
+
table.set(offset + 3, false);
|
|
175
|
+
}
|
|
176
|
+
const WasmFingerprintMatchWindowFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
177
|
+
? { register: () => {}, unregister: () => {} }
|
|
178
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmfingerprintmatchwindow_free(ptr >>> 0, 1));
|
|
179
|
+
|
|
180
|
+
function addToExternrefTable0(obj) {
|
|
181
|
+
const idx = wasm.__externref_table_alloc();
|
|
182
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
183
|
+
return idx;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function debugString(val) {
|
|
187
|
+
// primitive types
|
|
188
|
+
const type = typeof val;
|
|
189
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
190
|
+
return `${val}`;
|
|
191
|
+
}
|
|
192
|
+
if (type == 'string') {
|
|
193
|
+
return `"${val}"`;
|
|
194
|
+
}
|
|
195
|
+
if (type == 'symbol') {
|
|
196
|
+
const description = val.description;
|
|
197
|
+
if (description == null) {
|
|
198
|
+
return 'Symbol';
|
|
199
|
+
} else {
|
|
200
|
+
return `Symbol(${description})`;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
if (type == 'function') {
|
|
204
|
+
const name = val.name;
|
|
205
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
206
|
+
return `Function(${name})`;
|
|
207
|
+
} else {
|
|
208
|
+
return 'Function';
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// objects
|
|
212
|
+
if (Array.isArray(val)) {
|
|
213
|
+
const length = val.length;
|
|
214
|
+
let debug = '[';
|
|
215
|
+
if (length > 0) {
|
|
216
|
+
debug += debugString(val[0]);
|
|
217
|
+
}
|
|
218
|
+
for(let i = 1; i < length; i++) {
|
|
219
|
+
debug += ', ' + debugString(val[i]);
|
|
220
|
+
}
|
|
221
|
+
debug += ']';
|
|
222
|
+
return debug;
|
|
223
|
+
}
|
|
224
|
+
// Test for built-in
|
|
225
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
226
|
+
let className;
|
|
227
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
228
|
+
className = builtInMatches[1];
|
|
229
|
+
} else {
|
|
230
|
+
// Failed to match the standard '[object ClassName]'
|
|
231
|
+
return toString.call(val);
|
|
232
|
+
}
|
|
233
|
+
if (className == 'Object') {
|
|
234
|
+
// we're a user defined class or Object
|
|
235
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
236
|
+
// easier than looping through ownProperties of `val`.
|
|
237
|
+
try {
|
|
238
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
239
|
+
} catch (_) {
|
|
240
|
+
return 'Object';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// errors
|
|
244
|
+
if (val instanceof Error) {
|
|
245
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
246
|
+
}
|
|
247
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
248
|
+
return className;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
252
|
+
ptr = ptr >>> 0;
|
|
253
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let cachedDataViewMemory0 = null;
|
|
257
|
+
function getDataViewMemory0() {
|
|
258
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
259
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
260
|
+
}
|
|
261
|
+
return cachedDataViewMemory0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function getStringFromWasm0(ptr, len) {
|
|
265
|
+
ptr = ptr >>> 0;
|
|
266
|
+
return decodeText(ptr, len);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
let cachedUint8ArrayMemory0 = null;
|
|
270
|
+
function getUint8ArrayMemory0() {
|
|
271
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
272
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
273
|
+
}
|
|
274
|
+
return cachedUint8ArrayMemory0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function isLikeNone(x) {
|
|
278
|
+
return x === undefined || x === null;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
282
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
283
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
284
|
+
WASM_VECTOR_LEN = arg.length;
|
|
285
|
+
return ptr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
289
|
+
if (realloc === undefined) {
|
|
290
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
291
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
292
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
293
|
+
WASM_VECTOR_LEN = buf.length;
|
|
294
|
+
return ptr;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let len = arg.length;
|
|
298
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
299
|
+
|
|
300
|
+
const mem = getUint8ArrayMemory0();
|
|
301
|
+
|
|
302
|
+
let offset = 0;
|
|
303
|
+
|
|
304
|
+
for (; offset < len; offset++) {
|
|
305
|
+
const code = arg.charCodeAt(offset);
|
|
306
|
+
if (code > 0x7F) break;
|
|
307
|
+
mem[ptr + offset] = code;
|
|
308
|
+
}
|
|
309
|
+
if (offset !== len) {
|
|
310
|
+
if (offset !== 0) {
|
|
311
|
+
arg = arg.slice(offset);
|
|
312
|
+
}
|
|
313
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
314
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
315
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
316
|
+
|
|
317
|
+
offset += ret.written;
|
|
318
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
WASM_VECTOR_LEN = offset;
|
|
322
|
+
return ptr;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function takeFromExternrefTable0(idx) {
|
|
326
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
327
|
+
wasm.__externref_table_dealloc(idx);
|
|
328
|
+
return value;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
332
|
+
cachedTextDecoder.decode();
|
|
333
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
334
|
+
let numBytesDecoded = 0;
|
|
335
|
+
function decodeText(ptr, len) {
|
|
336
|
+
numBytesDecoded += len;
|
|
337
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
338
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
339
|
+
cachedTextDecoder.decode();
|
|
340
|
+
numBytesDecoded = len;
|
|
341
|
+
}
|
|
342
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const cachedTextEncoder = new TextEncoder();
|
|
346
|
+
|
|
347
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
348
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
349
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
350
|
+
view.set(buf);
|
|
351
|
+
return {
|
|
352
|
+
read: arg.length,
|
|
353
|
+
written: buf.length
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
let WASM_VECTOR_LEN = 0;
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
let wasm;
|
|
362
|
+
export function __wbg_set_wasm(val) {
|
|
363
|
+
wasm = val;
|
|
364
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmfingerprintmatchwindow_free: (a: number, b: number) => void;
|
|
5
|
+
export const wasmfingerprintmatchwindow_appendFingerprint: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const wasmfingerprintmatchwindow_hasReadyQuery: (a: number) => number;
|
|
7
|
+
export const wasmfingerprintmatchwindow_new: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
8
|
+
export const wasmfingerprintmatchwindow_reset: (a: number) => void;
|
|
9
|
+
export const wasmfingerprintmatchwindow_takeReadyQuery: (a: number) => any;
|
|
10
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
13
|
+
export const __externref_table_alloc: () => number;
|
|
14
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
15
|
+
export const __wbindgen_start: () => void;
|