@rasmx/uid 1.0.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/LICENSE +22 -0
- package/README.md +77 -0
- package/index.d.ts +31 -0
- package/index.js +48 -0
- package/package.json +36 -0
- package/pkg/rasmx_uuid.d.ts +84 -0
- package/pkg/rasmx_uuid.js +645 -0
- package/pkg/rasmx_uuid_bg.wasm +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2026
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the “Software”), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# @rasmx/uid
|
|
2
|
+
|
|
3
|
+
Blazing fast ID generation library powered by Rust and WebAssembly. Optimized for performance and modern standards.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **UUID**: Support for versions 1, 3, 4, 5, 6, and 7.
|
|
8
|
+
- **ULID**: Lexicographically sortable identifiers with millisecond precision.
|
|
9
|
+
- **NanoID**: Secure, URL-friendly unique identifiers with custom alphabet support.
|
|
10
|
+
- **Short IDs**: Built-in Base62 encoding/decoding to shorten your UUIDs.
|
|
11
|
+
- **Metadata**: Extract timestamps directly from UUID v7 and ULID.
|
|
12
|
+
- **Bulk Generation**: Highly optimized vector-based bulk generation for UUID v7.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @rasmx/uid
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Basic Usage
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
import init, { uuid, ulid, nanoid } from '@rasmx/uid';
|
|
26
|
+
|
|
27
|
+
// Initialize the WASM module
|
|
28
|
+
await init();
|
|
29
|
+
|
|
30
|
+
// Generate IDs
|
|
31
|
+
const idV4 = await uuid.v4();
|
|
32
|
+
const idV7 = await uuid.v7();
|
|
33
|
+
const myUlid = await ulid.generate();
|
|
34
|
+
const myNanoId = await nanoid(21);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Advanced Features
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// Bulk generation (UUID v7)
|
|
41
|
+
const ids = await uuid.bulk(1000);
|
|
42
|
+
|
|
43
|
+
// Extract timestamp from ID
|
|
44
|
+
const date = await uuid.getTimestamp(idV7);
|
|
45
|
+
console.log(date.toISOString());
|
|
46
|
+
|
|
47
|
+
// Shorten UUID (Base62)
|
|
48
|
+
const short = await uuid.toShort(idV4);
|
|
49
|
+
const original = await uuid.fromShort(short);
|
|
50
|
+
|
|
51
|
+
// Deterministic UUIDs
|
|
52
|
+
const namespace = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
53
|
+
const idV5 = await uuid.v5(namespace, "example");
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API Reference
|
|
57
|
+
|
|
58
|
+
### `uuid`
|
|
59
|
+
- `v1(), v4(), v6(), v7()`: Returns `Promise<string>`
|
|
60
|
+
- `v3(ns, name), v5(ns, name)`: Returns `Promise<string>`
|
|
61
|
+
- `bulk(amount)`: Returns `Promise<string[]>`
|
|
62
|
+
- `isValid(str)`: Returns `Promise<boolean>`
|
|
63
|
+
- `toShort(uuid)`: Converts UUID to Base62 string.
|
|
64
|
+
- `fromShort(shortId)`: Converts Base62 string back to UUID.
|
|
65
|
+
- `getTimestamp(uuid)`: Extracts Date from v7.
|
|
66
|
+
|
|
67
|
+
### `ulid`
|
|
68
|
+
- `generate()`: Returns `Promise<string>`
|
|
69
|
+
- `fromTime(ms)`: Generates ULID for specific timestamp.
|
|
70
|
+
- `getTimestamp(ulid)`: Extracts Date from ULID.
|
|
71
|
+
|
|
72
|
+
### `nanoid`
|
|
73
|
+
- `nanoid(size?, alphabet?)`: Returns `Promise<string>`
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface UuidNamespace {
|
|
2
|
+
v1(): Promise<string>;
|
|
3
|
+
v3(namespace: string, name: string): Promise<string>;
|
|
4
|
+
v4(): Promise<string>;
|
|
5
|
+
v5(namespace: string, name: string): Promise<string>;
|
|
6
|
+
v6(): Promise<string>;
|
|
7
|
+
v7(): Promise<string>;
|
|
8
|
+
bulk(amount?: number): Promise<string[]>;
|
|
9
|
+
isValid(str: string): Promise<boolean>;
|
|
10
|
+
toShort(str: string): Promise<string>;
|
|
11
|
+
fromShort(short: string): Promise<string>;
|
|
12
|
+
getTimestamp(str: string): Promise<Date | null>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface UlidNamespace {
|
|
16
|
+
generate(): Promise<string>;
|
|
17
|
+
fromTime(ms: number | bigint): Promise<string>;
|
|
18
|
+
getTimestamp(str: string): Promise<Date | null>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const uuid: UuidNamespace;
|
|
22
|
+
export const ulid: UlidNamespace;
|
|
23
|
+
export const nanoid: (size?: number, alphabet?: string) => Promise<string>;
|
|
24
|
+
|
|
25
|
+
const init: () => Promise<{
|
|
26
|
+
uuid: UuidNamespace;
|
|
27
|
+
ulid: UlidNamespace;
|
|
28
|
+
nanoid: typeof nanoid;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export default init;
|
package/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import init, * as wasm from './pkg/rasmx_uuid.js';
|
|
2
|
+
|
|
3
|
+
let initialized = null;
|
|
4
|
+
|
|
5
|
+
async function ensure() {
|
|
6
|
+
if (!initialized) {
|
|
7
|
+
initialized = init();
|
|
8
|
+
}
|
|
9
|
+
return initialized;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const uuid = {
|
|
13
|
+
v1: async () => { await ensure(); return wasm.v1(); },
|
|
14
|
+
v3: async (ns, name) => { await ensure(); return wasm.v3(ns, name); },
|
|
15
|
+
v4: async () => { await ensure(); return wasm.v4(); },
|
|
16
|
+
v5: async (ns, name) => { await ensure(); return wasm.v5(ns, name); },
|
|
17
|
+
v6: async () => { await ensure(); return wasm.v6(); },
|
|
18
|
+
v7: async () => { await ensure(); return wasm.v7(); },
|
|
19
|
+
bulk: async (amount = 10) => { await ensure(); return wasm.bulk_v7(amount); },
|
|
20
|
+
isValid: async (str) => { await ensure(); return wasm.is_valid_uuid(str); },
|
|
21
|
+
toShort: async (str) => { await ensure(); return wasm.to_short_id(str); },
|
|
22
|
+
fromShort: async (short) => { await ensure(); return wasm.from_short_id(short); },
|
|
23
|
+
getTimestamp: async (str) => {
|
|
24
|
+
await ensure();
|
|
25
|
+
const ts = wasm.get_timestamp(str);
|
|
26
|
+
return ts ? new Date(Number(ts)) : null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const nanoid = async (size = 21, alphabet) => {
|
|
31
|
+
await ensure();
|
|
32
|
+
return wasm.nanoid(size, alphabet);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const ulid = {
|
|
36
|
+
generate: async () => { await ensure(); return wasm.ulid(); },
|
|
37
|
+
fromTime: async (ms) => { await ensure(); return wasm.ulid_from_time(BigInt(ms)); },
|
|
38
|
+
getTimestamp: async (str) => {
|
|
39
|
+
await ensure();
|
|
40
|
+
const ts = wasm.get_timestamp(str);
|
|
41
|
+
return ts ? new Date(Number(ts)) : null;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default async () => {
|
|
46
|
+
await ensure();
|
|
47
|
+
return { uuid, nanoid, ulid };
|
|
48
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rasmx/uid",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Blazing fast WASM ID generation library powered by Rust. Support for UUID (v1-v7), ULID, NanoID, and Base62 shortening.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"wasm",
|
|
10
|
+
"uuid",
|
|
11
|
+
"ulid",
|
|
12
|
+
"nanoid",
|
|
13
|
+
"rust",
|
|
14
|
+
"performance",
|
|
15
|
+
"id-generator",
|
|
16
|
+
"base62",
|
|
17
|
+
"v7"
|
|
18
|
+
],
|
|
19
|
+
"author": "deniis",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./index.js",
|
|
23
|
+
"types": "./index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"pkg/rasmx_uuid_bg.wasm",
|
|
26
|
+
"pkg/rasmx_uuid.js",
|
|
27
|
+
"pkg/rasmx_uuid.d.ts",
|
|
28
|
+
"index.js",
|
|
29
|
+
"index.d.ts",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build:wasm": "wasm-pack build ../../crates/rasmx_uuid --target web --release --out-dir ../../packages/uuid/pkg"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function bulk_v7(amount: number): string[];
|
|
5
|
+
|
|
6
|
+
export function from_short_id(short_id: string): string;
|
|
7
|
+
|
|
8
|
+
export function get_timestamp(uuid_or_ulid: string): bigint | undefined;
|
|
9
|
+
|
|
10
|
+
export function is_valid_uuid(uuid_str: string): boolean;
|
|
11
|
+
|
|
12
|
+
export function main(): void;
|
|
13
|
+
|
|
14
|
+
export function nanoid(size: number, alphabet?: string | null): string;
|
|
15
|
+
|
|
16
|
+
export function to_short_id(uuid_str: string): string;
|
|
17
|
+
|
|
18
|
+
export function ulid(): string;
|
|
19
|
+
|
|
20
|
+
export function ulid_from_time(ms: bigint): string;
|
|
21
|
+
|
|
22
|
+
export function v1(): string;
|
|
23
|
+
|
|
24
|
+
export function v3(namespace: string, name: string): string;
|
|
25
|
+
|
|
26
|
+
export function v4(): string;
|
|
27
|
+
|
|
28
|
+
export function v5(namespace: string, name: string): string;
|
|
29
|
+
|
|
30
|
+
export function v6(): string;
|
|
31
|
+
|
|
32
|
+
export function v7(): string;
|
|
33
|
+
|
|
34
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
35
|
+
|
|
36
|
+
export interface InitOutput {
|
|
37
|
+
readonly memory: WebAssembly.Memory;
|
|
38
|
+
readonly bulk_v7: (a: number) => [number, number];
|
|
39
|
+
readonly from_short_id: (a: number, b: number) => [number, number, number, number];
|
|
40
|
+
readonly get_timestamp: (a: number, b: number) => [number, bigint];
|
|
41
|
+
readonly is_valid_uuid: (a: number, b: number) => number;
|
|
42
|
+
readonly main: () => void;
|
|
43
|
+
readonly nanoid: (a: number, b: number, c: number) => [number, number];
|
|
44
|
+
readonly to_short_id: (a: number, b: number) => [number, number, number, number];
|
|
45
|
+
readonly ulid: () => [number, number];
|
|
46
|
+
readonly ulid_from_time: (a: bigint) => [number, number];
|
|
47
|
+
readonly v1: () => [number, number];
|
|
48
|
+
readonly v3: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
49
|
+
readonly v4: () => [number, number];
|
|
50
|
+
readonly v5: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
51
|
+
readonly v6: () => [number, number];
|
|
52
|
+
readonly v7: () => [number, number];
|
|
53
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
54
|
+
readonly __externref_table_alloc: () => number;
|
|
55
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
56
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
57
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
58
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
59
|
+
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
60
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
61
|
+
readonly __wbindgen_start: () => void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
68
|
+
* a precompiled `WebAssembly.Module`.
|
|
69
|
+
*
|
|
70
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
71
|
+
*
|
|
72
|
+
* @returns {InitOutput}
|
|
73
|
+
*/
|
|
74
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
78
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
79
|
+
*
|
|
80
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
81
|
+
*
|
|
82
|
+
* @returns {Promise<InitOutput>}
|
|
83
|
+
*/
|
|
84
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
/* @ts-self-types="./rasmx_uuid.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {number} amount
|
|
5
|
+
* @returns {string[]}
|
|
6
|
+
*/
|
|
7
|
+
export function bulk_v7(amount) {
|
|
8
|
+
const ret = wasm.bulk_v7(amount);
|
|
9
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
10
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
11
|
+
return v1;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} short_id
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
export function from_short_id(short_id) {
|
|
19
|
+
let deferred3_0;
|
|
20
|
+
let deferred3_1;
|
|
21
|
+
try {
|
|
22
|
+
const ptr0 = passStringToWasm0(short_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
23
|
+
const len0 = WASM_VECTOR_LEN;
|
|
24
|
+
const ret = wasm.from_short_id(ptr0, len0);
|
|
25
|
+
var ptr2 = ret[0];
|
|
26
|
+
var len2 = ret[1];
|
|
27
|
+
if (ret[3]) {
|
|
28
|
+
ptr2 = 0; len2 = 0;
|
|
29
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
30
|
+
}
|
|
31
|
+
deferred3_0 = ptr2;
|
|
32
|
+
deferred3_1 = len2;
|
|
33
|
+
return getStringFromWasm0(ptr2, len2);
|
|
34
|
+
} finally {
|
|
35
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} uuid_or_ulid
|
|
41
|
+
* @returns {bigint | undefined}
|
|
42
|
+
*/
|
|
43
|
+
export function get_timestamp(uuid_or_ulid) {
|
|
44
|
+
const ptr0 = passStringToWasm0(uuid_or_ulid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
45
|
+
const len0 = WASM_VECTOR_LEN;
|
|
46
|
+
const ret = wasm.get_timestamp(ptr0, len0);
|
|
47
|
+
return ret[0] === 0 ? undefined : BigInt.asUintN(64, ret[1]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {string} uuid_str
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
export function is_valid_uuid(uuid_str) {
|
|
55
|
+
const ptr0 = passStringToWasm0(uuid_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
56
|
+
const len0 = WASM_VECTOR_LEN;
|
|
57
|
+
const ret = wasm.is_valid_uuid(ptr0, len0);
|
|
58
|
+
return ret !== 0;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function main() {
|
|
62
|
+
wasm.main();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @param {number} size
|
|
67
|
+
* @param {string | null} [alphabet]
|
|
68
|
+
* @returns {string}
|
|
69
|
+
*/
|
|
70
|
+
export function nanoid(size, alphabet) {
|
|
71
|
+
let deferred2_0;
|
|
72
|
+
let deferred2_1;
|
|
73
|
+
try {
|
|
74
|
+
var ptr0 = isLikeNone(alphabet) ? 0 : passStringToWasm0(alphabet, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
75
|
+
var len0 = WASM_VECTOR_LEN;
|
|
76
|
+
const ret = wasm.nanoid(size, ptr0, len0);
|
|
77
|
+
deferred2_0 = ret[0];
|
|
78
|
+
deferred2_1 = ret[1];
|
|
79
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
80
|
+
} finally {
|
|
81
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {string} uuid_str
|
|
87
|
+
* @returns {string}
|
|
88
|
+
*/
|
|
89
|
+
export function to_short_id(uuid_str) {
|
|
90
|
+
let deferred3_0;
|
|
91
|
+
let deferred3_1;
|
|
92
|
+
try {
|
|
93
|
+
const ptr0 = passStringToWasm0(uuid_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
94
|
+
const len0 = WASM_VECTOR_LEN;
|
|
95
|
+
const ret = wasm.to_short_id(ptr0, len0);
|
|
96
|
+
var ptr2 = ret[0];
|
|
97
|
+
var len2 = ret[1];
|
|
98
|
+
if (ret[3]) {
|
|
99
|
+
ptr2 = 0; len2 = 0;
|
|
100
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
101
|
+
}
|
|
102
|
+
deferred3_0 = ptr2;
|
|
103
|
+
deferred3_1 = len2;
|
|
104
|
+
return getStringFromWasm0(ptr2, len2);
|
|
105
|
+
} finally {
|
|
106
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @returns {string}
|
|
112
|
+
*/
|
|
113
|
+
export function ulid() {
|
|
114
|
+
let deferred1_0;
|
|
115
|
+
let deferred1_1;
|
|
116
|
+
try {
|
|
117
|
+
const ret = wasm.ulid();
|
|
118
|
+
deferred1_0 = ret[0];
|
|
119
|
+
deferred1_1 = ret[1];
|
|
120
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
121
|
+
} finally {
|
|
122
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {bigint} ms
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
export function ulid_from_time(ms) {
|
|
131
|
+
let deferred1_0;
|
|
132
|
+
let deferred1_1;
|
|
133
|
+
try {
|
|
134
|
+
const ret = wasm.ulid_from_time(ms);
|
|
135
|
+
deferred1_0 = ret[0];
|
|
136
|
+
deferred1_1 = ret[1];
|
|
137
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
138
|
+
} finally {
|
|
139
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @returns {string}
|
|
145
|
+
*/
|
|
146
|
+
export function v1() {
|
|
147
|
+
let deferred1_0;
|
|
148
|
+
let deferred1_1;
|
|
149
|
+
try {
|
|
150
|
+
const ret = wasm.v1();
|
|
151
|
+
deferred1_0 = ret[0];
|
|
152
|
+
deferred1_1 = ret[1];
|
|
153
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
154
|
+
} finally {
|
|
155
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @param {string} namespace
|
|
161
|
+
* @param {string} name
|
|
162
|
+
* @returns {string}
|
|
163
|
+
*/
|
|
164
|
+
export function v3(namespace, name) {
|
|
165
|
+
let deferred4_0;
|
|
166
|
+
let deferred4_1;
|
|
167
|
+
try {
|
|
168
|
+
const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
169
|
+
const len0 = WASM_VECTOR_LEN;
|
|
170
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
171
|
+
const len1 = WASM_VECTOR_LEN;
|
|
172
|
+
const ret = wasm.v3(ptr0, len0, ptr1, len1);
|
|
173
|
+
var ptr3 = ret[0];
|
|
174
|
+
var len3 = ret[1];
|
|
175
|
+
if (ret[3]) {
|
|
176
|
+
ptr3 = 0; len3 = 0;
|
|
177
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
178
|
+
}
|
|
179
|
+
deferred4_0 = ptr3;
|
|
180
|
+
deferred4_1 = len3;
|
|
181
|
+
return getStringFromWasm0(ptr3, len3);
|
|
182
|
+
} finally {
|
|
183
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
export function v4() {
|
|
191
|
+
let deferred1_0;
|
|
192
|
+
let deferred1_1;
|
|
193
|
+
try {
|
|
194
|
+
const ret = wasm.v4();
|
|
195
|
+
deferred1_0 = ret[0];
|
|
196
|
+
deferred1_1 = ret[1];
|
|
197
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
198
|
+
} finally {
|
|
199
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @param {string} namespace
|
|
205
|
+
* @param {string} name
|
|
206
|
+
* @returns {string}
|
|
207
|
+
*/
|
|
208
|
+
export function v5(namespace, name) {
|
|
209
|
+
let deferred4_0;
|
|
210
|
+
let deferred4_1;
|
|
211
|
+
try {
|
|
212
|
+
const ptr0 = passStringToWasm0(namespace, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
213
|
+
const len0 = WASM_VECTOR_LEN;
|
|
214
|
+
const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
215
|
+
const len1 = WASM_VECTOR_LEN;
|
|
216
|
+
const ret = wasm.v5(ptr0, len0, ptr1, len1);
|
|
217
|
+
var ptr3 = ret[0];
|
|
218
|
+
var len3 = ret[1];
|
|
219
|
+
if (ret[3]) {
|
|
220
|
+
ptr3 = 0; len3 = 0;
|
|
221
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
222
|
+
}
|
|
223
|
+
deferred4_0 = ptr3;
|
|
224
|
+
deferred4_1 = len3;
|
|
225
|
+
return getStringFromWasm0(ptr3, len3);
|
|
226
|
+
} finally {
|
|
227
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @returns {string}
|
|
233
|
+
*/
|
|
234
|
+
export function v6() {
|
|
235
|
+
let deferred1_0;
|
|
236
|
+
let deferred1_1;
|
|
237
|
+
try {
|
|
238
|
+
const ret = wasm.v6();
|
|
239
|
+
deferred1_0 = ret[0];
|
|
240
|
+
deferred1_1 = ret[1];
|
|
241
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
export function v7() {
|
|
251
|
+
let deferred1_0;
|
|
252
|
+
let deferred1_1;
|
|
253
|
+
try {
|
|
254
|
+
const ret = wasm.v7();
|
|
255
|
+
deferred1_0 = ret[0];
|
|
256
|
+
deferred1_1 = ret[1];
|
|
257
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function __wbg_get_imports() {
|
|
264
|
+
const import0 = {
|
|
265
|
+
__proto__: null,
|
|
266
|
+
__wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {
|
|
267
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
268
|
+
return ret;
|
|
269
|
+
},
|
|
270
|
+
__wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
|
|
271
|
+
const ret = typeof(arg0) === 'function';
|
|
272
|
+
return ret;
|
|
273
|
+
},
|
|
274
|
+
__wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
|
|
275
|
+
const val = arg0;
|
|
276
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
277
|
+
return ret;
|
|
278
|
+
},
|
|
279
|
+
__wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
|
|
280
|
+
const ret = typeof(arg0) === 'string';
|
|
281
|
+
return ret;
|
|
282
|
+
},
|
|
283
|
+
__wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
|
|
284
|
+
const ret = arg0 === undefined;
|
|
285
|
+
return ret;
|
|
286
|
+
},
|
|
287
|
+
__wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
|
|
288
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
289
|
+
},
|
|
290
|
+
__wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
|
|
291
|
+
const ret = arg0.call(arg1);
|
|
292
|
+
return ret;
|
|
293
|
+
}, arguments); },
|
|
294
|
+
__wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
|
|
295
|
+
const ret = arg0.call(arg1, arg2);
|
|
296
|
+
return ret;
|
|
297
|
+
}, arguments); },
|
|
298
|
+
__wbg_crypto_86f2631e91b51511: function(arg0) {
|
|
299
|
+
const ret = arg0.crypto;
|
|
300
|
+
return ret;
|
|
301
|
+
},
|
|
302
|
+
__wbg_error_7534b8e9a36f1ab4: function(arg0, arg1) {
|
|
303
|
+
let deferred0_0;
|
|
304
|
+
let deferred0_1;
|
|
305
|
+
try {
|
|
306
|
+
deferred0_0 = arg0;
|
|
307
|
+
deferred0_1 = arg1;
|
|
308
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
309
|
+
} finally {
|
|
310
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
__wbg_getRandomValues_9c5c1b115e142bb8: function() { return handleError(function (arg0, arg1) {
|
|
314
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
315
|
+
}, arguments); },
|
|
316
|
+
__wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
|
|
317
|
+
arg0.getRandomValues(arg1);
|
|
318
|
+
}, arguments); },
|
|
319
|
+
__wbg_getTime_1e3cd1391c5c3995: function(arg0) {
|
|
320
|
+
const ret = arg0.getTime();
|
|
321
|
+
return ret;
|
|
322
|
+
},
|
|
323
|
+
__wbg_length_32ed9a279acd054c: function(arg0) {
|
|
324
|
+
const ret = arg0.length;
|
|
325
|
+
return ret;
|
|
326
|
+
},
|
|
327
|
+
__wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
|
|
328
|
+
const ret = arg0.msCrypto;
|
|
329
|
+
return ret;
|
|
330
|
+
},
|
|
331
|
+
__wbg_new_0_73afc35eb544e539: function() {
|
|
332
|
+
const ret = new Date();
|
|
333
|
+
return ret;
|
|
334
|
+
},
|
|
335
|
+
__wbg_new_8a6f238a6ece86ea: function() {
|
|
336
|
+
const ret = new Error();
|
|
337
|
+
return ret;
|
|
338
|
+
},
|
|
339
|
+
__wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
|
|
340
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
341
|
+
return ret;
|
|
342
|
+
},
|
|
343
|
+
__wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
|
|
344
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
345
|
+
return ret;
|
|
346
|
+
},
|
|
347
|
+
__wbg_node_e1f24f89a7336c2e: function(arg0) {
|
|
348
|
+
const ret = arg0.node;
|
|
349
|
+
return ret;
|
|
350
|
+
},
|
|
351
|
+
__wbg_now_59d5a9197dfbe39f: function() { return handleError(function () {
|
|
352
|
+
const ret = Date.now();
|
|
353
|
+
return ret;
|
|
354
|
+
}, arguments); },
|
|
355
|
+
__wbg_process_3975fd6c72f520aa: function(arg0) {
|
|
356
|
+
const ret = arg0.process;
|
|
357
|
+
return ret;
|
|
358
|
+
},
|
|
359
|
+
__wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
|
|
360
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
361
|
+
},
|
|
362
|
+
__wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
|
|
363
|
+
arg0.randomFillSync(arg1);
|
|
364
|
+
}, arguments); },
|
|
365
|
+
__wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
|
|
366
|
+
const ret = module.require;
|
|
367
|
+
return ret;
|
|
368
|
+
}, arguments); },
|
|
369
|
+
__wbg_stack_0ed75d68575b0f3c: function(arg0, arg1) {
|
|
370
|
+
const ret = arg1.stack;
|
|
371
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
372
|
+
const len1 = WASM_VECTOR_LEN;
|
|
373
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
374
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
375
|
+
},
|
|
376
|
+
__wbg_static_accessor_GLOBAL_12837167ad935116: function() {
|
|
377
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
378
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
379
|
+
},
|
|
380
|
+
__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
|
|
381
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
382
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
383
|
+
},
|
|
384
|
+
__wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
|
|
385
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
386
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
387
|
+
},
|
|
388
|
+
__wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
|
|
389
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
390
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
391
|
+
},
|
|
392
|
+
__wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
|
|
393
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
394
|
+
return ret;
|
|
395
|
+
},
|
|
396
|
+
__wbg_versions_4e31226f5e8dc909: function(arg0) {
|
|
397
|
+
const ret = arg0.versions;
|
|
398
|
+
return ret;
|
|
399
|
+
},
|
|
400
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
401
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
402
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
403
|
+
return ret;
|
|
404
|
+
},
|
|
405
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
406
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
407
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
408
|
+
return ret;
|
|
409
|
+
},
|
|
410
|
+
__wbindgen_init_externref_table: function() {
|
|
411
|
+
const table = wasm.__wbindgen_externrefs;
|
|
412
|
+
const offset = table.grow(4);
|
|
413
|
+
table.set(0, undefined);
|
|
414
|
+
table.set(offset + 0, undefined);
|
|
415
|
+
table.set(offset + 1, null);
|
|
416
|
+
table.set(offset + 2, true);
|
|
417
|
+
table.set(offset + 3, false);
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
return {
|
|
421
|
+
__proto__: null,
|
|
422
|
+
"./rasmx_uuid_bg.js": import0,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function addToExternrefTable0(obj) {
|
|
427
|
+
const idx = wasm.__externref_table_alloc();
|
|
428
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
429
|
+
return idx;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
433
|
+
ptr = ptr >>> 0;
|
|
434
|
+
const mem = getDataViewMemory0();
|
|
435
|
+
const result = [];
|
|
436
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
437
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
438
|
+
}
|
|
439
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
440
|
+
return result;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
444
|
+
ptr = ptr >>> 0;
|
|
445
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
let cachedDataViewMemory0 = null;
|
|
449
|
+
function getDataViewMemory0() {
|
|
450
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
451
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
452
|
+
}
|
|
453
|
+
return cachedDataViewMemory0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function getStringFromWasm0(ptr, len) {
|
|
457
|
+
ptr = ptr >>> 0;
|
|
458
|
+
return decodeText(ptr, len);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
let cachedUint8ArrayMemory0 = null;
|
|
462
|
+
function getUint8ArrayMemory0() {
|
|
463
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
464
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
465
|
+
}
|
|
466
|
+
return cachedUint8ArrayMemory0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function handleError(f, args) {
|
|
470
|
+
try {
|
|
471
|
+
return f.apply(this, args);
|
|
472
|
+
} catch (e) {
|
|
473
|
+
const idx = addToExternrefTable0(e);
|
|
474
|
+
wasm.__wbindgen_exn_store(idx);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function isLikeNone(x) {
|
|
479
|
+
return x === undefined || x === null;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
483
|
+
if (realloc === undefined) {
|
|
484
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
485
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
486
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
487
|
+
WASM_VECTOR_LEN = buf.length;
|
|
488
|
+
return ptr;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
let len = arg.length;
|
|
492
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
493
|
+
|
|
494
|
+
const mem = getUint8ArrayMemory0();
|
|
495
|
+
|
|
496
|
+
let offset = 0;
|
|
497
|
+
|
|
498
|
+
for (; offset < len; offset++) {
|
|
499
|
+
const code = arg.charCodeAt(offset);
|
|
500
|
+
if (code > 0x7F) break;
|
|
501
|
+
mem[ptr + offset] = code;
|
|
502
|
+
}
|
|
503
|
+
if (offset !== len) {
|
|
504
|
+
if (offset !== 0) {
|
|
505
|
+
arg = arg.slice(offset);
|
|
506
|
+
}
|
|
507
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
508
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
509
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
510
|
+
|
|
511
|
+
offset += ret.written;
|
|
512
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
WASM_VECTOR_LEN = offset;
|
|
516
|
+
return ptr;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function takeFromExternrefTable0(idx) {
|
|
520
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
521
|
+
wasm.__externref_table_dealloc(idx);
|
|
522
|
+
return value;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
526
|
+
cachedTextDecoder.decode();
|
|
527
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
528
|
+
let numBytesDecoded = 0;
|
|
529
|
+
function decodeText(ptr, len) {
|
|
530
|
+
numBytesDecoded += len;
|
|
531
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
532
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
533
|
+
cachedTextDecoder.decode();
|
|
534
|
+
numBytesDecoded = len;
|
|
535
|
+
}
|
|
536
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const cachedTextEncoder = new TextEncoder();
|
|
540
|
+
|
|
541
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
542
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
543
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
544
|
+
view.set(buf);
|
|
545
|
+
return {
|
|
546
|
+
read: arg.length,
|
|
547
|
+
written: buf.length
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
let WASM_VECTOR_LEN = 0;
|
|
553
|
+
|
|
554
|
+
let wasmModule, wasm;
|
|
555
|
+
function __wbg_finalize_init(instance, module) {
|
|
556
|
+
wasm = instance.exports;
|
|
557
|
+
wasmModule = module;
|
|
558
|
+
cachedDataViewMemory0 = null;
|
|
559
|
+
cachedUint8ArrayMemory0 = null;
|
|
560
|
+
wasm.__wbindgen_start();
|
|
561
|
+
return wasm;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function __wbg_load(module, imports) {
|
|
565
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
566
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
567
|
+
try {
|
|
568
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
569
|
+
} catch (e) {
|
|
570
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
571
|
+
|
|
572
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
573
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
574
|
+
|
|
575
|
+
} else { throw e; }
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const bytes = await module.arrayBuffer();
|
|
580
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
581
|
+
} else {
|
|
582
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
583
|
+
|
|
584
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
585
|
+
return { instance, module };
|
|
586
|
+
} else {
|
|
587
|
+
return instance;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function expectedResponseType(type) {
|
|
592
|
+
switch (type) {
|
|
593
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
594
|
+
}
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function initSync(module) {
|
|
600
|
+
if (wasm !== undefined) return wasm;
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
if (module !== undefined) {
|
|
604
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
605
|
+
({module} = module)
|
|
606
|
+
} else {
|
|
607
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const imports = __wbg_get_imports();
|
|
612
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
613
|
+
module = new WebAssembly.Module(module);
|
|
614
|
+
}
|
|
615
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
616
|
+
return __wbg_finalize_init(instance, module);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
async function __wbg_init(module_or_path) {
|
|
620
|
+
if (wasm !== undefined) return wasm;
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
if (module_or_path !== undefined) {
|
|
624
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
625
|
+
({module_or_path} = module_or_path)
|
|
626
|
+
} else {
|
|
627
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (module_or_path === undefined) {
|
|
632
|
+
module_or_path = new URL('rasmx_uuid_bg.wasm', import.meta.url);
|
|
633
|
+
}
|
|
634
|
+
const imports = __wbg_get_imports();
|
|
635
|
+
|
|
636
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
637
|
+
module_or_path = fetch(module_or_path);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
641
|
+
|
|
642
|
+
return __wbg_finalize_init(instance, module);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|