@sorisdk/matcher 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 +56 -0
- package/dist/assets/model.pack +0 -0
- package/dist/generated/core.d.ts +26 -0
- package/dist/generated/core.js +9 -0
- package/dist/generated/core_bg.js +517 -0
- package/dist/generated/core_bg.wasm +0 -0
- package/dist/generated/core_bg.wasm.d.ts +25 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +716 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @sorisdk/matcher
|
|
2
|
+
|
|
3
|
+
High-level browser/worker matcher session wrapper for the NADA wasm matcher runtime.
|
|
4
|
+
|
|
5
|
+
## API
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { MatcherSession, AudioFingerprintType, initMatcher } from "@sorisdk/matcher";
|
|
9
|
+
|
|
10
|
+
await initMatcher();
|
|
11
|
+
const session = new MatcherSession();
|
|
12
|
+
await session.ready();
|
|
13
|
+
|
|
14
|
+
await session.addEntry("track-1", AudioFingerprintType.Livestream, new Uint8Array([1, 2, 3]));
|
|
15
|
+
const results = await session.match(new Uint8Array([1, 2, 3]));
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Pack loading
|
|
19
|
+
|
|
20
|
+
`loadPack` accepts:
|
|
21
|
+
|
|
22
|
+
- `Uint8Array`
|
|
23
|
+
- `ArrayBuffer`
|
|
24
|
+
- `Blob`
|
|
25
|
+
- `Response`
|
|
26
|
+
- `Request`
|
|
27
|
+
- `string`
|
|
28
|
+
- `URL`
|
|
29
|
+
|
|
30
|
+
String/URL/Request sources use `fetch`.
|
|
31
|
+
|
|
32
|
+
When you call `loadPack(...)`, the matcher package first performs an internal baseline-model load
|
|
33
|
+
step, then applies your account/material pack. This internal step is hidden from callers; the
|
|
34
|
+
public flow stays `initMatcher(...)` then `session.loadPack(yourPackSource)`.
|
|
35
|
+
|
|
36
|
+
### Events
|
|
37
|
+
|
|
38
|
+
- `ready`
|
|
39
|
+
- `packloadstart`
|
|
40
|
+
- `packload`
|
|
41
|
+
- `querystart`
|
|
42
|
+
- `match`
|
|
43
|
+
- `nomatch`
|
|
44
|
+
- `error`
|
|
45
|
+
- `destroy`
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm --dir packages/matcher test
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
- This package build emits wasm-bindgen output into `dist/generated/`.
|
|
56
|
+
- The same public API works on the main thread and in Dedicated Workers.
|
|
Binary file
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmMatcherDatabase {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
addEntry(name: string, afp_type: number, buffer: Uint8Array): void;
|
|
8
|
+
addOrReplace(name: string, afp_type: number, buffer: Uint8Array): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
loadPackBytes(bytes: Uint8Array): void;
|
|
11
|
+
loadPackBytesAppend(bytes: Uint8Array): void;
|
|
12
|
+
constructor();
|
|
13
|
+
removeEntry(name: string): void;
|
|
14
|
+
readonly length: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class WasmMatcherEngine {
|
|
18
|
+
free(): void;
|
|
19
|
+
[Symbol.dispose](): void;
|
|
20
|
+
bestMatch(database: WasmMatcherDatabase, query: Uint8Array, config?: any | null): any;
|
|
21
|
+
matchQuery(database: WasmMatcherDatabase, query: Uint8Array, config?: any | null): any;
|
|
22
|
+
constructor();
|
|
23
|
+
resetDistinctMatchState(): void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function init_matcher_wasm(): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./core.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./core_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./core_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
WasmMatcherDatabase, WasmMatcherEngine, init_matcher_wasm
|
|
9
|
+
} from "./core_bg.js";
|
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
export class WasmMatcherDatabase {
|
|
2
|
+
__destroy_into_raw() {
|
|
3
|
+
const ptr = this.__wbg_ptr;
|
|
4
|
+
this.__wbg_ptr = 0;
|
|
5
|
+
WasmMatcherDatabaseFinalization.unregister(this);
|
|
6
|
+
return ptr;
|
|
7
|
+
}
|
|
8
|
+
free() {
|
|
9
|
+
const ptr = this.__destroy_into_raw();
|
|
10
|
+
wasm.__wbg_wasmmatcherdatabase_free(ptr, 0);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} name
|
|
14
|
+
* @param {number} afp_type
|
|
15
|
+
* @param {Uint8Array} buffer
|
|
16
|
+
*/
|
|
17
|
+
addEntry(name, afp_type, buffer) {
|
|
18
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
19
|
+
const len0 = WASM_VECTOR_LEN;
|
|
20
|
+
const ptr1 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
21
|
+
const len1 = WASM_VECTOR_LEN;
|
|
22
|
+
const ret = wasm.wasmmatcherdatabase_addEntry(this.__wbg_ptr, ptr0, len0, afp_type, ptr1, len1);
|
|
23
|
+
if (ret[1]) {
|
|
24
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @param {string} name
|
|
29
|
+
* @param {number} afp_type
|
|
30
|
+
* @param {Uint8Array} buffer
|
|
31
|
+
*/
|
|
32
|
+
addOrReplace(name, afp_type, buffer) {
|
|
33
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
34
|
+
const len0 = WASM_VECTOR_LEN;
|
|
35
|
+
const ptr1 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
36
|
+
const len1 = WASM_VECTOR_LEN;
|
|
37
|
+
const ret = wasm.wasmmatcherdatabase_addOrReplace(this.__wbg_ptr, ptr0, len0, afp_type, ptr1, len1);
|
|
38
|
+
if (ret[1]) {
|
|
39
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
clear() {
|
|
43
|
+
wasm.wasmmatcherdatabase_clear(this.__wbg_ptr);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns {number}
|
|
47
|
+
*/
|
|
48
|
+
get length() {
|
|
49
|
+
const ret = wasm.wasmmatcherdatabase_length(this.__wbg_ptr);
|
|
50
|
+
return ret >>> 0;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param {Uint8Array} bytes
|
|
54
|
+
*/
|
|
55
|
+
loadPackBytes(bytes) {
|
|
56
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
57
|
+
const len0 = WASM_VECTOR_LEN;
|
|
58
|
+
const ret = wasm.wasmmatcherdatabase_loadPackBytes(this.__wbg_ptr, ptr0, len0);
|
|
59
|
+
if (ret[1]) {
|
|
60
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @param {Uint8Array} bytes
|
|
65
|
+
*/
|
|
66
|
+
loadPackBytesAppend(bytes) {
|
|
67
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
68
|
+
const len0 = WASM_VECTOR_LEN;
|
|
69
|
+
const ret = wasm.wasmmatcherdatabase_loadPackBytesAppend(this.__wbg_ptr, ptr0, len0);
|
|
70
|
+
if (ret[1]) {
|
|
71
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
constructor() {
|
|
75
|
+
const ret = wasm.wasmmatcherdatabase_new();
|
|
76
|
+
this.__wbg_ptr = ret >>> 0;
|
|
77
|
+
WasmMatcherDatabaseFinalization.register(this, this.__wbg_ptr, this);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @param {string} name
|
|
82
|
+
*/
|
|
83
|
+
removeEntry(name) {
|
|
84
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
85
|
+
const len0 = WASM_VECTOR_LEN;
|
|
86
|
+
const ret = wasm.wasmmatcherdatabase_removeEntry(this.__wbg_ptr, ptr0, len0);
|
|
87
|
+
if (ret[1]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (Symbol.dispose) WasmMatcherDatabase.prototype[Symbol.dispose] = WasmMatcherDatabase.prototype.free;
|
|
93
|
+
|
|
94
|
+
export class WasmMatcherEngine {
|
|
95
|
+
__destroy_into_raw() {
|
|
96
|
+
const ptr = this.__wbg_ptr;
|
|
97
|
+
this.__wbg_ptr = 0;
|
|
98
|
+
WasmMatcherEngineFinalization.unregister(this);
|
|
99
|
+
return ptr;
|
|
100
|
+
}
|
|
101
|
+
free() {
|
|
102
|
+
const ptr = this.__destroy_into_raw();
|
|
103
|
+
wasm.__wbg_wasmmatcherengine_free(ptr, 0);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @param {WasmMatcherDatabase} database
|
|
107
|
+
* @param {Uint8Array} query
|
|
108
|
+
* @param {any | null} [config]
|
|
109
|
+
* @returns {any}
|
|
110
|
+
*/
|
|
111
|
+
bestMatch(database, query, config) {
|
|
112
|
+
_assertClass(database, WasmMatcherDatabase);
|
|
113
|
+
const ptr0 = passArray8ToWasm0(query, wasm.__wbindgen_malloc);
|
|
114
|
+
const len0 = WASM_VECTOR_LEN;
|
|
115
|
+
const ret = wasm.wasmmatcherengine_bestMatch(this.__wbg_ptr, database.__wbg_ptr, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
116
|
+
if (ret[2]) {
|
|
117
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
118
|
+
}
|
|
119
|
+
return takeFromExternrefTable0(ret[0]);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @param {WasmMatcherDatabase} database
|
|
123
|
+
* @param {Uint8Array} query
|
|
124
|
+
* @param {any | null} [config]
|
|
125
|
+
* @returns {any}
|
|
126
|
+
*/
|
|
127
|
+
matchQuery(database, query, config) {
|
|
128
|
+
_assertClass(database, WasmMatcherDatabase);
|
|
129
|
+
const ptr0 = passArray8ToWasm0(query, wasm.__wbindgen_malloc);
|
|
130
|
+
const len0 = WASM_VECTOR_LEN;
|
|
131
|
+
const ret = wasm.wasmmatcherengine_matchQuery(this.__wbg_ptr, database.__wbg_ptr, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
132
|
+
if (ret[2]) {
|
|
133
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
134
|
+
}
|
|
135
|
+
return takeFromExternrefTable0(ret[0]);
|
|
136
|
+
}
|
|
137
|
+
constructor() {
|
|
138
|
+
const ret = wasm.wasmmatcherengine_new();
|
|
139
|
+
this.__wbg_ptr = ret >>> 0;
|
|
140
|
+
WasmMatcherEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
141
|
+
return this;
|
|
142
|
+
}
|
|
143
|
+
resetDistinctMatchState() {
|
|
144
|
+
wasm.wasmmatcherengine_resetDistinctMatchState(this.__wbg_ptr);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (Symbol.dispose) WasmMatcherEngine.prototype[Symbol.dispose] = WasmMatcherEngine.prototype.free;
|
|
148
|
+
|
|
149
|
+
export function init_matcher_wasm() {
|
|
150
|
+
wasm.init_matcher_wasm();
|
|
151
|
+
}
|
|
152
|
+
export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
|
|
153
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
154
|
+
return ret;
|
|
155
|
+
}
|
|
156
|
+
export function __wbg_Number_a5a435bd7bbec835(arg0) {
|
|
157
|
+
const ret = Number(arg0);
|
|
158
|
+
return ret;
|
|
159
|
+
}
|
|
160
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
161
|
+
const ret = String(arg1);
|
|
162
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
163
|
+
const len1 = WASM_VECTOR_LEN;
|
|
164
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
165
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
166
|
+
}
|
|
167
|
+
export function __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1(arg0) {
|
|
168
|
+
const v = arg0;
|
|
169
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
170
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
171
|
+
}
|
|
172
|
+
export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
|
|
173
|
+
const ret = debugString(arg1);
|
|
174
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
175
|
+
const len1 = WASM_VECTOR_LEN;
|
|
176
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
177
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
178
|
+
}
|
|
179
|
+
export function __wbg___wbindgen_in_41dbb8413020e076(arg0, arg1) {
|
|
180
|
+
const ret = arg0 in arg1;
|
|
181
|
+
return ret;
|
|
182
|
+
}
|
|
183
|
+
export function __wbg___wbindgen_is_null_0b605fc6b167c56f(arg0) {
|
|
184
|
+
const ret = arg0 === null;
|
|
185
|
+
return ret;
|
|
186
|
+
}
|
|
187
|
+
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
188
|
+
const val = arg0;
|
|
189
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
193
|
+
const ret = arg0 === undefined;
|
|
194
|
+
return ret;
|
|
195
|
+
}
|
|
196
|
+
export function __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b(arg0, arg1) {
|
|
197
|
+
const ret = arg0 == arg1;
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
|
|
201
|
+
const obj = arg1;
|
|
202
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
203
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
204
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
205
|
+
}
|
|
206
|
+
export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
207
|
+
const obj = arg1;
|
|
208
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
209
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
210
|
+
var len1 = WASM_VECTOR_LEN;
|
|
211
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
212
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
213
|
+
}
|
|
214
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
215
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
216
|
+
}
|
|
217
|
+
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
218
|
+
let deferred0_0;
|
|
219
|
+
let deferred0_1;
|
|
220
|
+
try {
|
|
221
|
+
deferred0_0 = arg0;
|
|
222
|
+
deferred0_1 = arg1;
|
|
223
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
224
|
+
} finally {
|
|
225
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
229
|
+
const ret = arg0[arg1];
|
|
230
|
+
return ret;
|
|
231
|
+
}
|
|
232
|
+
export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
233
|
+
let result;
|
|
234
|
+
try {
|
|
235
|
+
result = arg0 instanceof ArrayBuffer;
|
|
236
|
+
} catch (_) {
|
|
237
|
+
result = false;
|
|
238
|
+
}
|
|
239
|
+
const ret = result;
|
|
240
|
+
return ret;
|
|
241
|
+
}
|
|
242
|
+
export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
243
|
+
let result;
|
|
244
|
+
try {
|
|
245
|
+
result = arg0 instanceof Uint8Array;
|
|
246
|
+
} catch (_) {
|
|
247
|
+
result = false;
|
|
248
|
+
}
|
|
249
|
+
const ret = result;
|
|
250
|
+
return ret;
|
|
251
|
+
}
|
|
252
|
+
export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
|
|
253
|
+
const ret = Number.isSafeInteger(arg0);
|
|
254
|
+
return ret;
|
|
255
|
+
}
|
|
256
|
+
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
257
|
+
const ret = arg0.length;
|
|
258
|
+
return ret;
|
|
259
|
+
}
|
|
260
|
+
export function __wbg_new_227d7c05414eb861() {
|
|
261
|
+
const ret = new Error();
|
|
262
|
+
return ret;
|
|
263
|
+
}
|
|
264
|
+
export function __wbg_new_5f486cdf45a04d78(arg0) {
|
|
265
|
+
const ret = new Uint8Array(arg0);
|
|
266
|
+
return ret;
|
|
267
|
+
}
|
|
268
|
+
export function __wbg_new_a70fbab9066b301f() {
|
|
269
|
+
const ret = new Array();
|
|
270
|
+
return ret;
|
|
271
|
+
}
|
|
272
|
+
export function __wbg_new_ab79df5bd7c26067() {
|
|
273
|
+
const ret = new Object();
|
|
274
|
+
return ret;
|
|
275
|
+
}
|
|
276
|
+
export function __wbg_now_16f0c993d5dd6c27() {
|
|
277
|
+
const ret = Date.now();
|
|
278
|
+
return ret;
|
|
279
|
+
}
|
|
280
|
+
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
281
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
282
|
+
}
|
|
283
|
+
export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
|
|
284
|
+
arg0[arg1 >>> 0] = arg2;
|
|
285
|
+
}
|
|
286
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
287
|
+
arg0[arg1] = arg2;
|
|
288
|
+
}
|
|
289
|
+
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
290
|
+
const ret = arg1.stack;
|
|
291
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
292
|
+
const len1 = WASM_VECTOR_LEN;
|
|
293
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
294
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
295
|
+
}
|
|
296
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
297
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
298
|
+
const ret = arg0;
|
|
299
|
+
return ret;
|
|
300
|
+
}
|
|
301
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
302
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
303
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
304
|
+
return ret;
|
|
305
|
+
}
|
|
306
|
+
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
307
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
308
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
309
|
+
return ret;
|
|
310
|
+
}
|
|
311
|
+
export function __wbindgen_init_externref_table() {
|
|
312
|
+
const table = wasm.__wbindgen_externrefs;
|
|
313
|
+
const offset = table.grow(4);
|
|
314
|
+
table.set(0, undefined);
|
|
315
|
+
table.set(offset + 0, undefined);
|
|
316
|
+
table.set(offset + 1, null);
|
|
317
|
+
table.set(offset + 2, true);
|
|
318
|
+
table.set(offset + 3, false);
|
|
319
|
+
}
|
|
320
|
+
const WasmMatcherDatabaseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
321
|
+
? { register: () => {}, unregister: () => {} }
|
|
322
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmatcherdatabase_free(ptr >>> 0, 1));
|
|
323
|
+
const WasmMatcherEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
324
|
+
? { register: () => {}, unregister: () => {} }
|
|
325
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmmatcherengine_free(ptr >>> 0, 1));
|
|
326
|
+
|
|
327
|
+
function addToExternrefTable0(obj) {
|
|
328
|
+
const idx = wasm.__externref_table_alloc();
|
|
329
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
330
|
+
return idx;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function _assertClass(instance, klass) {
|
|
334
|
+
if (!(instance instanceof klass)) {
|
|
335
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function debugString(val) {
|
|
340
|
+
// primitive types
|
|
341
|
+
const type = typeof val;
|
|
342
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
343
|
+
return `${val}`;
|
|
344
|
+
}
|
|
345
|
+
if (type == 'string') {
|
|
346
|
+
return `"${val}"`;
|
|
347
|
+
}
|
|
348
|
+
if (type == 'symbol') {
|
|
349
|
+
const description = val.description;
|
|
350
|
+
if (description == null) {
|
|
351
|
+
return 'Symbol';
|
|
352
|
+
} else {
|
|
353
|
+
return `Symbol(${description})`;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (type == 'function') {
|
|
357
|
+
const name = val.name;
|
|
358
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
359
|
+
return `Function(${name})`;
|
|
360
|
+
} else {
|
|
361
|
+
return 'Function';
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// objects
|
|
365
|
+
if (Array.isArray(val)) {
|
|
366
|
+
const length = val.length;
|
|
367
|
+
let debug = '[';
|
|
368
|
+
if (length > 0) {
|
|
369
|
+
debug += debugString(val[0]);
|
|
370
|
+
}
|
|
371
|
+
for(let i = 1; i < length; i++) {
|
|
372
|
+
debug += ', ' + debugString(val[i]);
|
|
373
|
+
}
|
|
374
|
+
debug += ']';
|
|
375
|
+
return debug;
|
|
376
|
+
}
|
|
377
|
+
// Test for built-in
|
|
378
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
379
|
+
let className;
|
|
380
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
381
|
+
className = builtInMatches[1];
|
|
382
|
+
} else {
|
|
383
|
+
// Failed to match the standard '[object ClassName]'
|
|
384
|
+
return toString.call(val);
|
|
385
|
+
}
|
|
386
|
+
if (className == 'Object') {
|
|
387
|
+
// we're a user defined class or Object
|
|
388
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
389
|
+
// easier than looping through ownProperties of `val`.
|
|
390
|
+
try {
|
|
391
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
392
|
+
} catch (_) {
|
|
393
|
+
return 'Object';
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
// errors
|
|
397
|
+
if (val instanceof Error) {
|
|
398
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
399
|
+
}
|
|
400
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
401
|
+
return className;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
405
|
+
ptr = ptr >>> 0;
|
|
406
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
let cachedDataViewMemory0 = null;
|
|
410
|
+
function getDataViewMemory0() {
|
|
411
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
412
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
413
|
+
}
|
|
414
|
+
return cachedDataViewMemory0;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function getStringFromWasm0(ptr, len) {
|
|
418
|
+
ptr = ptr >>> 0;
|
|
419
|
+
return decodeText(ptr, len);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
let cachedUint8ArrayMemory0 = null;
|
|
423
|
+
function getUint8ArrayMemory0() {
|
|
424
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
425
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
426
|
+
}
|
|
427
|
+
return cachedUint8ArrayMemory0;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function isLikeNone(x) {
|
|
431
|
+
return x === undefined || x === null;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
435
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
436
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
437
|
+
WASM_VECTOR_LEN = arg.length;
|
|
438
|
+
return ptr;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
442
|
+
if (realloc === undefined) {
|
|
443
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
444
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
445
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
446
|
+
WASM_VECTOR_LEN = buf.length;
|
|
447
|
+
return ptr;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
let len = arg.length;
|
|
451
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
452
|
+
|
|
453
|
+
const mem = getUint8ArrayMemory0();
|
|
454
|
+
|
|
455
|
+
let offset = 0;
|
|
456
|
+
|
|
457
|
+
for (; offset < len; offset++) {
|
|
458
|
+
const code = arg.charCodeAt(offset);
|
|
459
|
+
if (code > 0x7F) break;
|
|
460
|
+
mem[ptr + offset] = code;
|
|
461
|
+
}
|
|
462
|
+
if (offset !== len) {
|
|
463
|
+
if (offset !== 0) {
|
|
464
|
+
arg = arg.slice(offset);
|
|
465
|
+
}
|
|
466
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
467
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
468
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
469
|
+
|
|
470
|
+
offset += ret.written;
|
|
471
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
WASM_VECTOR_LEN = offset;
|
|
475
|
+
return ptr;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function takeFromExternrefTable0(idx) {
|
|
479
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
480
|
+
wasm.__externref_table_dealloc(idx);
|
|
481
|
+
return value;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
485
|
+
cachedTextDecoder.decode();
|
|
486
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
487
|
+
let numBytesDecoded = 0;
|
|
488
|
+
function decodeText(ptr, len) {
|
|
489
|
+
numBytesDecoded += len;
|
|
490
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
491
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
492
|
+
cachedTextDecoder.decode();
|
|
493
|
+
numBytesDecoded = len;
|
|
494
|
+
}
|
|
495
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const cachedTextEncoder = new TextEncoder();
|
|
499
|
+
|
|
500
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
501
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
502
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
503
|
+
view.set(buf);
|
|
504
|
+
return {
|
|
505
|
+
read: arg.length,
|
|
506
|
+
written: buf.length
|
|
507
|
+
};
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
let WASM_VECTOR_LEN = 0;
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
let wasm;
|
|
515
|
+
export function __wbg_set_wasm(val) {
|
|
516
|
+
wasm = val;
|
|
517
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmmatcherdatabase_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_wasmmatcherengine_free: (a: number, b: number) => void;
|
|
6
|
+
export const wasmmatcherdatabase_addEntry: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
7
|
+
export const wasmmatcherdatabase_addOrReplace: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
8
|
+
export const wasmmatcherdatabase_clear: (a: number) => void;
|
|
9
|
+
export const wasmmatcherdatabase_length: (a: number) => number;
|
|
10
|
+
export const wasmmatcherdatabase_loadPackBytes: (a: number, b: number, c: number) => [number, number];
|
|
11
|
+
export const wasmmatcherdatabase_loadPackBytesAppend: (a: number, b: number, c: number) => [number, number];
|
|
12
|
+
export const wasmmatcherdatabase_new: () => number;
|
|
13
|
+
export const wasmmatcherdatabase_removeEntry: (a: number, b: number, c: number) => [number, number];
|
|
14
|
+
export const wasmmatcherengine_bestMatch: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
15
|
+
export const wasmmatcherengine_matchQuery: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
16
|
+
export const wasmmatcherengine_new: () => number;
|
|
17
|
+
export const wasmmatcherengine_resetDistinctMatchState: (a: number) => void;
|
|
18
|
+
export const init_matcher_wasm: () => void;
|
|
19
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
20
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
21
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
22
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
23
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
24
|
+
export const __externref_table_alloc: () => number;
|
|
25
|
+
export const __wbindgen_start: () => void;
|