nano-rspow-web 0.5.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 +55 -0
- package/nano_rspow_web.d.ts +79 -0
- package/nano_rspow_web.js +949 -0
- package/nano_rspow_web_bg.wasm +0 -0
- package/package.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# nano-rspow-web
|
|
2
|
+
|
|
3
|
+
WebGPU-accelerated Nano (XNO) Proof-of-Work generation in the browser using WebAssembly. Pre-compiled for high-performance direct web browser integrations.
|
|
4
|
+
|
|
5
|
+
Tries WebGPU first, then automatically falls back to single-threaded CPU WebAssembly if WebGPU is unavailable.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install nano-rspow-web
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import init, { generate_work, validate_work } from 'nano-rspow-web';
|
|
17
|
+
|
|
18
|
+
// Initialize the WebAssembly module
|
|
19
|
+
await init();
|
|
20
|
+
|
|
21
|
+
// Generate work
|
|
22
|
+
const hash = "718CC2121C3E641059BC1C2CFC45666C99E8AE922F7A807B7D07B62C995D79E2";
|
|
23
|
+
const threshold = "fffffff800000000";
|
|
24
|
+
|
|
25
|
+
const result = await generate_work(hash, threshold);
|
|
26
|
+
console.log("Nonce:", result.nonce); // e.g., "8587f13863c049fd"
|
|
27
|
+
console.log("Is GPU:", result.is_gpu); // true/false
|
|
28
|
+
|
|
29
|
+
// Validate work
|
|
30
|
+
const isValid = validate_work(hash, result.nonce, threshold); // true
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### `init(module_or_path)`
|
|
36
|
+
Initializes the WASM loader. Must be awaited before calling other functions.
|
|
37
|
+
|
|
38
|
+
### `generate_work(hash_hex: string, threshold_hex: string): Promise<GenerateResult>`
|
|
39
|
+
Asynchronously generates Proof of Work for a 32-byte block hash. Tries WebGPU first, falling back to CPU WebAssembly.
|
|
40
|
+
|
|
41
|
+
### `generate_work_gpu(hash_hex: string, threshold_hex: string): Promise<GenerateResult>`
|
|
42
|
+
Forces WebGPU PoW generation. Rejects if WebGPU is unavailable.
|
|
43
|
+
|
|
44
|
+
### `generate_work_cpu(hash_hex: string, threshold_hex: string): GenerateResult`
|
|
45
|
+
Synchronously generates PoW forcing single-threaded CPU WebAssembly.
|
|
46
|
+
|
|
47
|
+
### `validate_work(hash_hex: string, nonce_hex: string, threshold_hex: string): boolean`
|
|
48
|
+
Synchronously validates whether a nonce meets the difficulty threshold for the given block hash.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## See Also
|
|
53
|
+
|
|
54
|
+
- **[nano-rspow-node](https://www.npmjs.com/package/nano-rspow-node)**: High-performance pre-compiled Node.js bindings for backend servers.
|
|
55
|
+
- **[nano-rspow Workspace](https://github.com/CasualSecurityInc/nano-rspow)**: The monorepo source code containing both packages.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class GenerateResult {
|
|
5
|
+
private constructor();
|
|
6
|
+
free(): void;
|
|
7
|
+
[Symbol.dispose](): void;
|
|
8
|
+
readonly is_gpu: boolean;
|
|
9
|
+
readonly nonce: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Asynchronously generate Proof of Work for a 32-byte block hash (hex).
|
|
14
|
+
*
|
|
15
|
+
* Tries WebGPU first, then falls back to single-threaded CPU WASM.
|
|
16
|
+
*/
|
|
17
|
+
export function generate_work(hash_hex: string, threshold_hex: string): Promise<GenerateResult>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Synchronously generate Proof of Work forcing single-threaded WASM CPU execution.
|
|
21
|
+
*/
|
|
22
|
+
export function generate_work_cpu(hash_hex: string, threshold_hex: string): GenerateResult;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Asynchronously generate Proof of Work forcing WebGPU execution.
|
|
26
|
+
*/
|
|
27
|
+
export function generate_work_gpu(hash_hex: string, threshold_hex: string): Promise<GenerateResult>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Synchronously validate if a nonce meets the difficulty threshold for a given block hash.
|
|
31
|
+
*/
|
|
32
|
+
export function validate_work(hash_hex: string, nonce_hex: string, threshold_hex: string): boolean;
|
|
33
|
+
|
|
34
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
35
|
+
|
|
36
|
+
export interface InitOutput {
|
|
37
|
+
readonly memory: WebAssembly.Memory;
|
|
38
|
+
readonly __wbg_generateresult_free: (a: number, b: number) => void;
|
|
39
|
+
readonly generate_work: (a: number, b: number, c: number, d: number) => any;
|
|
40
|
+
readonly generate_work_cpu: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
41
|
+
readonly generate_work_gpu: (a: number, b: number, c: number, d: number) => any;
|
|
42
|
+
readonly generateresult_is_gpu: (a: number) => number;
|
|
43
|
+
readonly generateresult_nonce: (a: number) => [number, number];
|
|
44
|
+
readonly validate_work: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
45
|
+
readonly wasm_bindgen__convert__closures_____invoke__h494390435fc5ceaa: (a: number, b: number, c: any) => [number, number];
|
|
46
|
+
readonly wasm_bindgen__convert__closures_____invoke__h08e8530b2c1a3586: (a: number, b: number, c: any, d: any) => void;
|
|
47
|
+
readonly wasm_bindgen__convert__closures_____invoke__h01517a4dd6c2751e: (a: number, b: number, c: any) => void;
|
|
48
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
49
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
50
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
51
|
+
readonly __externref_table_alloc: () => number;
|
|
52
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
53
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
54
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
55
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
56
|
+
readonly __wbindgen_start: () => void;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
63
|
+
* a precompiled `WebAssembly.Module`.
|
|
64
|
+
*
|
|
65
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
66
|
+
*
|
|
67
|
+
* @returns {InitOutput}
|
|
68
|
+
*/
|
|
69
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
73
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
74
|
+
*
|
|
75
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Promise<InitOutput>}
|
|
78
|
+
*/
|
|
79
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,949 @@
|
|
|
1
|
+
/* @ts-self-types="./nano_rspow_web.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class GenerateResult {
|
|
4
|
+
static __wrap(ptr) {
|
|
5
|
+
const obj = Object.create(GenerateResult.prototype);
|
|
6
|
+
obj.__wbg_ptr = ptr;
|
|
7
|
+
GenerateResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
8
|
+
return obj;
|
|
9
|
+
}
|
|
10
|
+
__destroy_into_raw() {
|
|
11
|
+
const ptr = this.__wbg_ptr;
|
|
12
|
+
this.__wbg_ptr = 0;
|
|
13
|
+
GenerateResultFinalization.unregister(this);
|
|
14
|
+
return ptr;
|
|
15
|
+
}
|
|
16
|
+
free() {
|
|
17
|
+
const ptr = this.__destroy_into_raw();
|
|
18
|
+
wasm.__wbg_generateresult_free(ptr, 0);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
get is_gpu() {
|
|
24
|
+
const ret = wasm.generateresult_is_gpu(this.__wbg_ptr);
|
|
25
|
+
return ret !== 0;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @returns {string}
|
|
29
|
+
*/
|
|
30
|
+
get nonce() {
|
|
31
|
+
let deferred1_0;
|
|
32
|
+
let deferred1_1;
|
|
33
|
+
try {
|
|
34
|
+
const ret = wasm.generateresult_nonce(this.__wbg_ptr);
|
|
35
|
+
deferred1_0 = ret[0];
|
|
36
|
+
deferred1_1 = ret[1];
|
|
37
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
38
|
+
} finally {
|
|
39
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (Symbol.dispose) GenerateResult.prototype[Symbol.dispose] = GenerateResult.prototype.free;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Asynchronously generate Proof of Work for a 32-byte block hash (hex).
|
|
47
|
+
*
|
|
48
|
+
* Tries WebGPU first, then falls back to single-threaded CPU WASM.
|
|
49
|
+
* @param {string} hash_hex
|
|
50
|
+
* @param {string} threshold_hex
|
|
51
|
+
* @returns {Promise<GenerateResult>}
|
|
52
|
+
*/
|
|
53
|
+
export function generate_work(hash_hex, threshold_hex) {
|
|
54
|
+
const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
const ptr1 = passStringToWasm0(threshold_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
57
|
+
const len1 = WASM_VECTOR_LEN;
|
|
58
|
+
const ret = wasm.generate_work(ptr0, len0, ptr1, len1);
|
|
59
|
+
return ret;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Synchronously generate Proof of Work forcing single-threaded WASM CPU execution.
|
|
64
|
+
* @param {string} hash_hex
|
|
65
|
+
* @param {string} threshold_hex
|
|
66
|
+
* @returns {GenerateResult}
|
|
67
|
+
*/
|
|
68
|
+
export function generate_work_cpu(hash_hex, threshold_hex) {
|
|
69
|
+
const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
70
|
+
const len0 = WASM_VECTOR_LEN;
|
|
71
|
+
const ptr1 = passStringToWasm0(threshold_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
72
|
+
const len1 = WASM_VECTOR_LEN;
|
|
73
|
+
const ret = wasm.generate_work_cpu(ptr0, len0, ptr1, len1);
|
|
74
|
+
if (ret[2]) {
|
|
75
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
76
|
+
}
|
|
77
|
+
return GenerateResult.__wrap(ret[0]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Asynchronously generate Proof of Work forcing WebGPU execution.
|
|
82
|
+
* @param {string} hash_hex
|
|
83
|
+
* @param {string} threshold_hex
|
|
84
|
+
* @returns {Promise<GenerateResult>}
|
|
85
|
+
*/
|
|
86
|
+
export function generate_work_gpu(hash_hex, threshold_hex) {
|
|
87
|
+
const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
88
|
+
const len0 = WASM_VECTOR_LEN;
|
|
89
|
+
const ptr1 = passStringToWasm0(threshold_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
90
|
+
const len1 = WASM_VECTOR_LEN;
|
|
91
|
+
const ret = wasm.generate_work_gpu(ptr0, len0, ptr1, len1);
|
|
92
|
+
return ret;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Synchronously validate if a nonce meets the difficulty threshold for a given block hash.
|
|
97
|
+
* @param {string} hash_hex
|
|
98
|
+
* @param {string} nonce_hex
|
|
99
|
+
* @param {string} threshold_hex
|
|
100
|
+
* @returns {boolean}
|
|
101
|
+
*/
|
|
102
|
+
export function validate_work(hash_hex, nonce_hex, threshold_hex) {
|
|
103
|
+
const ptr0 = passStringToWasm0(hash_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
104
|
+
const len0 = WASM_VECTOR_LEN;
|
|
105
|
+
const ptr1 = passStringToWasm0(nonce_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
106
|
+
const len1 = WASM_VECTOR_LEN;
|
|
107
|
+
const ptr2 = passStringToWasm0(threshold_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
108
|
+
const len2 = WASM_VECTOR_LEN;
|
|
109
|
+
const ret = wasm.validate_work(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
110
|
+
if (ret[2]) {
|
|
111
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
112
|
+
}
|
|
113
|
+
return ret[0] !== 0;
|
|
114
|
+
}
|
|
115
|
+
function __wbg_get_imports() {
|
|
116
|
+
const import0 = {
|
|
117
|
+
__proto__: null,
|
|
118
|
+
__wbg_Window_65ef42d29dc8174d: function(arg0) {
|
|
119
|
+
const ret = arg0.Window;
|
|
120
|
+
return ret;
|
|
121
|
+
},
|
|
122
|
+
__wbg_WorkerGlobalScope_d272430d4a323303: function(arg0) {
|
|
123
|
+
const ret = arg0.WorkerGlobalScope;
|
|
124
|
+
return ret;
|
|
125
|
+
},
|
|
126
|
+
__wbg___wbindgen_debug_string_edece8177ad01481: function(arg0, arg1) {
|
|
127
|
+
const ret = debugString(arg1);
|
|
128
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
129
|
+
const len1 = WASM_VECTOR_LEN;
|
|
130
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
131
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
132
|
+
},
|
|
133
|
+
__wbg___wbindgen_is_function_5cd60d5cf78b4eef: function(arg0) {
|
|
134
|
+
const ret = typeof(arg0) === 'function';
|
|
135
|
+
return ret;
|
|
136
|
+
},
|
|
137
|
+
__wbg___wbindgen_is_null_2042690d351e14f0: function(arg0) {
|
|
138
|
+
const ret = arg0 === null;
|
|
139
|
+
return ret;
|
|
140
|
+
},
|
|
141
|
+
__wbg___wbindgen_is_undefined_35bb9f4c7fd651d5: function(arg0) {
|
|
142
|
+
const ret = arg0 === undefined;
|
|
143
|
+
return ret;
|
|
144
|
+
},
|
|
145
|
+
__wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
|
|
146
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
147
|
+
},
|
|
148
|
+
__wbg__wbg_cb_unref_3fa391f3fcdb55f8: function(arg0) {
|
|
149
|
+
arg0._wbg_cb_unref();
|
|
150
|
+
},
|
|
151
|
+
__wbg_beginComputePass_43b0c6751d870fcf: function(arg0, arg1) {
|
|
152
|
+
const ret = arg0.beginComputePass(arg1);
|
|
153
|
+
return ret;
|
|
154
|
+
},
|
|
155
|
+
__wbg_call_dfde26266607c996: function() { return handleError(function (arg0, arg1, arg2) {
|
|
156
|
+
const ret = arg0.call(arg1, arg2);
|
|
157
|
+
return ret;
|
|
158
|
+
}, arguments); },
|
|
159
|
+
__wbg_copyBufferToBuffer_3b119149df2dc5eb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
160
|
+
arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4);
|
|
161
|
+
}, arguments); },
|
|
162
|
+
__wbg_copyBufferToBuffer_9e5aea97d7828aa3: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
163
|
+
arg0.copyBufferToBuffer(arg1, arg2, arg3, arg4, arg5);
|
|
164
|
+
}, arguments); },
|
|
165
|
+
__wbg_createBindGroupLayout_59891d473ac8665d: function() { return handleError(function (arg0, arg1) {
|
|
166
|
+
const ret = arg0.createBindGroupLayout(arg1);
|
|
167
|
+
return ret;
|
|
168
|
+
}, arguments); },
|
|
169
|
+
__wbg_createBindGroup_4cb86ff853df5c69: function(arg0, arg1) {
|
|
170
|
+
const ret = arg0.createBindGroup(arg1);
|
|
171
|
+
return ret;
|
|
172
|
+
},
|
|
173
|
+
__wbg_createBuffer_3fa0256cba655273: function() { return handleError(function (arg0, arg1) {
|
|
174
|
+
const ret = arg0.createBuffer(arg1);
|
|
175
|
+
return ret;
|
|
176
|
+
}, arguments); },
|
|
177
|
+
__wbg_createCommandEncoder_98e3b731629054b4: function(arg0, arg1) {
|
|
178
|
+
const ret = arg0.createCommandEncoder(arg1);
|
|
179
|
+
return ret;
|
|
180
|
+
},
|
|
181
|
+
__wbg_createComputePipeline_9d101515d504e110: function(arg0, arg1) {
|
|
182
|
+
const ret = arg0.createComputePipeline(arg1);
|
|
183
|
+
return ret;
|
|
184
|
+
},
|
|
185
|
+
__wbg_createPipelineLayout_270b4fd0b4230373: function(arg0, arg1) {
|
|
186
|
+
const ret = arg0.createPipelineLayout(arg1);
|
|
187
|
+
return ret;
|
|
188
|
+
},
|
|
189
|
+
__wbg_createShaderModule_f0aa469466c7bdaa: function(arg0, arg1) {
|
|
190
|
+
const ret = arg0.createShaderModule(arg1);
|
|
191
|
+
return ret;
|
|
192
|
+
},
|
|
193
|
+
__wbg_dispatchWorkgroups_26f6198195c36ca4: function(arg0, arg1, arg2, arg3) {
|
|
194
|
+
arg0.dispatchWorkgroups(arg1 >>> 0, arg2 >>> 0, arg3 >>> 0);
|
|
195
|
+
},
|
|
196
|
+
__wbg_end_8437a975bbfe0297: function(arg0) {
|
|
197
|
+
arg0.end();
|
|
198
|
+
},
|
|
199
|
+
__wbg_finish_6c7bba424ffe1bbc: function(arg0, arg1) {
|
|
200
|
+
const ret = arg0.finish(arg1);
|
|
201
|
+
return ret;
|
|
202
|
+
},
|
|
203
|
+
__wbg_finish_c40b67ff2af88e0c: function(arg0) {
|
|
204
|
+
const ret = arg0.finish();
|
|
205
|
+
return ret;
|
|
206
|
+
},
|
|
207
|
+
__wbg_generateresult_new: function(arg0) {
|
|
208
|
+
const ret = GenerateResult.__wrap(arg0);
|
|
209
|
+
return ret;
|
|
210
|
+
},
|
|
211
|
+
__wbg_getMappedRange_59829576da3edd39: function() { return handleError(function (arg0, arg1, arg2) {
|
|
212
|
+
const ret = arg0.getMappedRange(arg1, arg2);
|
|
213
|
+
return ret;
|
|
214
|
+
}, arguments); },
|
|
215
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
216
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
217
|
+
}, arguments); },
|
|
218
|
+
__wbg_gpu_cbd27ad0589bc0b3: function(arg0) {
|
|
219
|
+
const ret = arg0.gpu;
|
|
220
|
+
return ret;
|
|
221
|
+
},
|
|
222
|
+
__wbg_instanceof_GpuAdapter_1297a3a5ce0db3ff: function(arg0) {
|
|
223
|
+
let result;
|
|
224
|
+
try {
|
|
225
|
+
result = arg0 instanceof GPUAdapter;
|
|
226
|
+
} catch (_) {
|
|
227
|
+
result = false;
|
|
228
|
+
}
|
|
229
|
+
const ret = result;
|
|
230
|
+
return ret;
|
|
231
|
+
},
|
|
232
|
+
__wbg_label_9a8583e3a20fafc7: function(arg0, arg1) {
|
|
233
|
+
const ret = arg1.label;
|
|
234
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
235
|
+
const len1 = WASM_VECTOR_LEN;
|
|
236
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
237
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
238
|
+
},
|
|
239
|
+
__wbg_length_56fcd3e2b7e0299d: function(arg0) {
|
|
240
|
+
const ret = arg0.length;
|
|
241
|
+
return ret;
|
|
242
|
+
},
|
|
243
|
+
__wbg_log_eb752234eec406d1: function(arg0) {
|
|
244
|
+
console.log(arg0);
|
|
245
|
+
},
|
|
246
|
+
__wbg_mapAsync_e3cfbd141919d03c: function(arg0, arg1, arg2, arg3) {
|
|
247
|
+
const ret = arg0.mapAsync(arg1 >>> 0, arg2, arg3);
|
|
248
|
+
return ret;
|
|
249
|
+
},
|
|
250
|
+
__wbg_navigator_3334c390f542c642: function(arg0) {
|
|
251
|
+
const ret = arg0.navigator;
|
|
252
|
+
return ret;
|
|
253
|
+
},
|
|
254
|
+
__wbg_navigator_3db7ba343e05d4d1: function(arg0) {
|
|
255
|
+
const ret = arg0.navigator;
|
|
256
|
+
return ret;
|
|
257
|
+
},
|
|
258
|
+
__wbg_new_02d162bc6cf02f60: function() {
|
|
259
|
+
const ret = new Object();
|
|
260
|
+
return ret;
|
|
261
|
+
},
|
|
262
|
+
__wbg_new_310879b66b6e95e1: function() {
|
|
263
|
+
const ret = new Array();
|
|
264
|
+
return ret;
|
|
265
|
+
},
|
|
266
|
+
__wbg_new_d8dfd33fa007511d: function(arg0, arg1) {
|
|
267
|
+
try {
|
|
268
|
+
var state0 = {a: arg0, b: arg1};
|
|
269
|
+
var cb0 = (arg0, arg1) => {
|
|
270
|
+
const a = state0.a;
|
|
271
|
+
state0.a = 0;
|
|
272
|
+
try {
|
|
273
|
+
return wasm_bindgen__convert__closures_____invoke__h08e8530b2c1a3586(a, state0.b, arg0, arg1);
|
|
274
|
+
} finally {
|
|
275
|
+
state0.a = a;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const ret = new Promise(cb0);
|
|
279
|
+
return ret;
|
|
280
|
+
} finally {
|
|
281
|
+
state0.a = 0;
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
__wbg_new_typed_c072c4ce9a2a0cdf: function(arg0, arg1) {
|
|
285
|
+
try {
|
|
286
|
+
var state0 = {a: arg0, b: arg1};
|
|
287
|
+
var cb0 = (arg0, arg1) => {
|
|
288
|
+
const a = state0.a;
|
|
289
|
+
state0.a = 0;
|
|
290
|
+
try {
|
|
291
|
+
return wasm_bindgen__convert__closures_____invoke__h08e8530b2c1a3586(a, state0.b, arg0, arg1);
|
|
292
|
+
} finally {
|
|
293
|
+
state0.a = a;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const ret = new Promise(cb0);
|
|
297
|
+
return ret;
|
|
298
|
+
} finally {
|
|
299
|
+
state0.a = 0;
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
__wbg_new_with_byte_offset_and_length_a87e79143162d67f: function(arg0, arg1, arg2) {
|
|
303
|
+
const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
|
|
304
|
+
return ret;
|
|
305
|
+
},
|
|
306
|
+
__wbg_onSubmittedWorkDone_5f36409816d68e04: function(arg0) {
|
|
307
|
+
const ret = arg0.onSubmittedWorkDone();
|
|
308
|
+
return ret;
|
|
309
|
+
},
|
|
310
|
+
__wbg_prototypesetcall_5f9bdc8d75e07276: function(arg0, arg1, arg2) {
|
|
311
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
312
|
+
},
|
|
313
|
+
__wbg_push_b77c476b01548d0a: function(arg0, arg1) {
|
|
314
|
+
const ret = arg0.push(arg1);
|
|
315
|
+
return ret;
|
|
316
|
+
},
|
|
317
|
+
__wbg_queueMicrotask_78d584b53af520f5: function(arg0) {
|
|
318
|
+
const ret = arg0.queueMicrotask;
|
|
319
|
+
return ret;
|
|
320
|
+
},
|
|
321
|
+
__wbg_queueMicrotask_b39ea83c7f01971a: function(arg0) {
|
|
322
|
+
queueMicrotask(arg0);
|
|
323
|
+
},
|
|
324
|
+
__wbg_queue_7bbf92178b06da19: function(arg0) {
|
|
325
|
+
const ret = arg0.queue;
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg_requestAdapter_0049683abd339828: function(arg0, arg1) {
|
|
329
|
+
const ret = arg0.requestAdapter(arg1);
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg_requestDevice_921f0a221b4492fa: function(arg0, arg1) {
|
|
333
|
+
const ret = arg0.requestDevice(arg1);
|
|
334
|
+
return ret;
|
|
335
|
+
},
|
|
336
|
+
__wbg_resolve_d17db9352f5a220e: function(arg0) {
|
|
337
|
+
const ret = Promise.resolve(arg0);
|
|
338
|
+
return ret;
|
|
339
|
+
},
|
|
340
|
+
__wbg_setBindGroup_0500d49bcf971ad6: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
341
|
+
arg0.setBindGroup(arg1 >>> 0, arg2, getArrayU32FromWasm0(arg3, arg4), arg5, arg6 >>> 0);
|
|
342
|
+
}, arguments); },
|
|
343
|
+
__wbg_setBindGroup_863d2daeb3c4fa01: function(arg0, arg1, arg2) {
|
|
344
|
+
arg0.setBindGroup(arg1 >>> 0, arg2);
|
|
345
|
+
},
|
|
346
|
+
__wbg_setPipeline_c6aca1c13ec27120: function(arg0, arg1) {
|
|
347
|
+
arg0.setPipeline(arg1);
|
|
348
|
+
},
|
|
349
|
+
__wbg_setTimeout_1bc1140eb7b08d02: function(arg0, arg1) {
|
|
350
|
+
const ret = setTimeout(arg0, arg1);
|
|
351
|
+
return ret;
|
|
352
|
+
},
|
|
353
|
+
__wbg_set_37221b90dcdc9a98: function(arg0, arg1, arg2) {
|
|
354
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
355
|
+
},
|
|
356
|
+
__wbg_set_a0e911be3da02782: function() { return handleError(function (arg0, arg1, arg2) {
|
|
357
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
358
|
+
return ret;
|
|
359
|
+
}, arguments); },
|
|
360
|
+
__wbg_set_access_08d6bdbda9aaa266: function(arg0, arg1) {
|
|
361
|
+
arg0.access = __wbindgen_enum_GpuStorageTextureAccess[arg1];
|
|
362
|
+
},
|
|
363
|
+
__wbg_set_beginning_of_pass_write_index_ebe753eeeade6f6c: function(arg0, arg1) {
|
|
364
|
+
arg0.beginningOfPassWriteIndex = arg1 >>> 0;
|
|
365
|
+
},
|
|
366
|
+
__wbg_set_bind_group_layouts_078241cf2822c39e: function(arg0, arg1) {
|
|
367
|
+
arg0.bindGroupLayouts = arg1;
|
|
368
|
+
},
|
|
369
|
+
__wbg_set_binding_d683cd9c1d4bcfed: function(arg0, arg1) {
|
|
370
|
+
arg0.binding = arg1 >>> 0;
|
|
371
|
+
},
|
|
372
|
+
__wbg_set_binding_e9ba14423117de0a: function(arg0, arg1) {
|
|
373
|
+
arg0.binding = arg1 >>> 0;
|
|
374
|
+
},
|
|
375
|
+
__wbg_set_buffer_598ab98a251b8f91: function(arg0, arg1) {
|
|
376
|
+
arg0.buffer = arg1;
|
|
377
|
+
},
|
|
378
|
+
__wbg_set_buffer_73d9f6fea9c41867: function(arg0, arg1) {
|
|
379
|
+
arg0.buffer = arg1;
|
|
380
|
+
},
|
|
381
|
+
__wbg_set_code_6a0d763da082dcfb: function(arg0, arg1, arg2) {
|
|
382
|
+
arg0.code = getStringFromWasm0(arg1, arg2);
|
|
383
|
+
},
|
|
384
|
+
__wbg_set_compute_5dd7704ee8a825c6: function(arg0, arg1) {
|
|
385
|
+
arg0.compute = arg1;
|
|
386
|
+
},
|
|
387
|
+
__wbg_set_end_of_pass_write_index_49de5f6017fb9a1f: function(arg0, arg1) {
|
|
388
|
+
arg0.endOfPassWriteIndex = arg1 >>> 0;
|
|
389
|
+
},
|
|
390
|
+
__wbg_set_entries_070b048e4bea0c29: function(arg0, arg1) {
|
|
391
|
+
arg0.entries = arg1;
|
|
392
|
+
},
|
|
393
|
+
__wbg_set_entries_f9b7f3d4e9faccf4: function(arg0, arg1) {
|
|
394
|
+
arg0.entries = arg1;
|
|
395
|
+
},
|
|
396
|
+
__wbg_set_entry_point_52a2481a52f9799d: function(arg0, arg1, arg2) {
|
|
397
|
+
arg0.entryPoint = getStringFromWasm0(arg1, arg2);
|
|
398
|
+
},
|
|
399
|
+
__wbg_set_external_texture_cf122b1392d58f37: function(arg0, arg1) {
|
|
400
|
+
arg0.externalTexture = arg1;
|
|
401
|
+
},
|
|
402
|
+
__wbg_set_format_27c63de9b0ec1cb3: function(arg0, arg1) {
|
|
403
|
+
arg0.format = __wbindgen_enum_GpuTextureFormat[arg1];
|
|
404
|
+
},
|
|
405
|
+
__wbg_set_has_dynamic_offset_69725fed837748fe: function(arg0, arg1) {
|
|
406
|
+
arg0.hasDynamicOffset = arg1 !== 0;
|
|
407
|
+
},
|
|
408
|
+
__wbg_set_label_2a41a6f671383447: function(arg0, arg1, arg2) {
|
|
409
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
410
|
+
},
|
|
411
|
+
__wbg_set_label_37d0faa0c9b7dee4: function(arg0, arg1, arg2) {
|
|
412
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
413
|
+
},
|
|
414
|
+
__wbg_set_label_3e306b2e8f9db666: function(arg0, arg1, arg2) {
|
|
415
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
416
|
+
},
|
|
417
|
+
__wbg_set_label_58fbc9fcc6363f16: function(arg0, arg1, arg2) {
|
|
418
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
419
|
+
},
|
|
420
|
+
__wbg_set_label_5a4dbb42c3b27bf7: function(arg0, arg1, arg2) {
|
|
421
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
422
|
+
},
|
|
423
|
+
__wbg_set_label_5c952448f9d59f36: function(arg0, arg1, arg2) {
|
|
424
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
425
|
+
},
|
|
426
|
+
__wbg_set_label_5fadf65a1f0f4714: function(arg0, arg1, arg2) {
|
|
427
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
428
|
+
},
|
|
429
|
+
__wbg_set_label_782e33de78d86641: function(arg0, arg1, arg2) {
|
|
430
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
431
|
+
},
|
|
432
|
+
__wbg_set_label_837a3b8ff99c2db3: function(arg0, arg1, arg2) {
|
|
433
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
434
|
+
},
|
|
435
|
+
__wbg_set_label_8df6673e1e141fcc: function(arg0, arg1, arg2) {
|
|
436
|
+
arg0.label = getStringFromWasm0(arg1, arg2);
|
|
437
|
+
},
|
|
438
|
+
__wbg_set_layout_cd5d951ba305620a: function(arg0, arg1) {
|
|
439
|
+
arg0.layout = arg1;
|
|
440
|
+
},
|
|
441
|
+
__wbg_set_layout_d701bf37a1e489c6: function(arg0, arg1) {
|
|
442
|
+
arg0.layout = arg1;
|
|
443
|
+
},
|
|
444
|
+
__wbg_set_mapped_at_creation_7f0aad21612f3e22: function(arg0, arg1) {
|
|
445
|
+
arg0.mappedAtCreation = arg1 !== 0;
|
|
446
|
+
},
|
|
447
|
+
__wbg_set_min_binding_size_d70e460d165d9144: function(arg0, arg1) {
|
|
448
|
+
arg0.minBindingSize = arg1;
|
|
449
|
+
},
|
|
450
|
+
__wbg_set_module_22d452288cef846d: function(arg0, arg1) {
|
|
451
|
+
arg0.module = arg1;
|
|
452
|
+
},
|
|
453
|
+
__wbg_set_multisampled_4ce4c32144215354: function(arg0, arg1) {
|
|
454
|
+
arg0.multisampled = arg1 !== 0;
|
|
455
|
+
},
|
|
456
|
+
__wbg_set_offset_e316586bb85f0bd6: function(arg0, arg1) {
|
|
457
|
+
arg0.offset = arg1;
|
|
458
|
+
},
|
|
459
|
+
__wbg_set_power_preference_7d669fb9b41f7bf2: function(arg0, arg1) {
|
|
460
|
+
arg0.powerPreference = __wbindgen_enum_GpuPowerPreference[arg1];
|
|
461
|
+
},
|
|
462
|
+
__wbg_set_query_set_604a8ae10429942b: function(arg0, arg1) {
|
|
463
|
+
arg0.querySet = arg1;
|
|
464
|
+
},
|
|
465
|
+
__wbg_set_required_features_3d00070d09235d7d: function(arg0, arg1) {
|
|
466
|
+
arg0.requiredFeatures = arg1;
|
|
467
|
+
},
|
|
468
|
+
__wbg_set_required_limits_e0de55a49a48e3dc: function(arg0, arg1) {
|
|
469
|
+
arg0.requiredLimits = arg1;
|
|
470
|
+
},
|
|
471
|
+
__wbg_set_resource_fe1f979fce4afee2: function(arg0, arg1) {
|
|
472
|
+
arg0.resource = arg1;
|
|
473
|
+
},
|
|
474
|
+
__wbg_set_sample_type_3cecbd4699e2e5fb: function(arg0, arg1) {
|
|
475
|
+
arg0.sampleType = __wbindgen_enum_GpuTextureSampleType[arg1];
|
|
476
|
+
},
|
|
477
|
+
__wbg_set_sampler_12544c21977075c1: function(arg0, arg1) {
|
|
478
|
+
arg0.sampler = arg1;
|
|
479
|
+
},
|
|
480
|
+
__wbg_set_size_0c20f73abce8f1ce: function(arg0, arg1) {
|
|
481
|
+
arg0.size = arg1;
|
|
482
|
+
},
|
|
483
|
+
__wbg_set_size_f1207de283144c72: function(arg0, arg1) {
|
|
484
|
+
arg0.size = arg1;
|
|
485
|
+
},
|
|
486
|
+
__wbg_set_storage_texture_36be4834c501acab: function(arg0, arg1) {
|
|
487
|
+
arg0.storageTexture = arg1;
|
|
488
|
+
},
|
|
489
|
+
__wbg_set_texture_738e6f6215515de3: function(arg0, arg1) {
|
|
490
|
+
arg0.texture = arg1;
|
|
491
|
+
},
|
|
492
|
+
__wbg_set_timestamp_writes_6854d9d17bf5b0b4: function(arg0, arg1) {
|
|
493
|
+
arg0.timestampWrites = arg1;
|
|
494
|
+
},
|
|
495
|
+
__wbg_set_type_17a1387b620bc902: function(arg0, arg1) {
|
|
496
|
+
arg0.type = __wbindgen_enum_GpuBufferBindingType[arg1];
|
|
497
|
+
},
|
|
498
|
+
__wbg_set_type_d4edb621ec2051e0: function(arg0, arg1) {
|
|
499
|
+
arg0.type = __wbindgen_enum_GpuSamplerBindingType[arg1];
|
|
500
|
+
},
|
|
501
|
+
__wbg_set_usage_41b7d18f3f220e6c: function(arg0, arg1) {
|
|
502
|
+
arg0.usage = arg1 >>> 0;
|
|
503
|
+
},
|
|
504
|
+
__wbg_set_view_dimension_4a840560a13b4860: function(arg0, arg1) {
|
|
505
|
+
arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
|
|
506
|
+
},
|
|
507
|
+
__wbg_set_view_dimension_9ae69db849267b1a: function(arg0, arg1) {
|
|
508
|
+
arg0.viewDimension = __wbindgen_enum_GpuTextureViewDimension[arg1];
|
|
509
|
+
},
|
|
510
|
+
__wbg_set_visibility_bbbf3d2b70571950: function(arg0, arg1) {
|
|
511
|
+
arg0.visibility = arg1 >>> 0;
|
|
512
|
+
},
|
|
513
|
+
__wbg_static_accessor_GLOBAL_THIS_02344c9b09eb08a9: function() {
|
|
514
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
515
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
516
|
+
},
|
|
517
|
+
__wbg_static_accessor_GLOBAL_ac6d4ac874d5cd54: function() {
|
|
518
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
519
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
520
|
+
},
|
|
521
|
+
__wbg_static_accessor_SELF_9b2406c23aeb2023: function() {
|
|
522
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
523
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
524
|
+
},
|
|
525
|
+
__wbg_static_accessor_WINDOW_b34d2126934e16ba: function() {
|
|
526
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
527
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
528
|
+
},
|
|
529
|
+
__wbg_submit_b3bbead76cbf7627: function(arg0, arg1) {
|
|
530
|
+
arg0.submit(arg1);
|
|
531
|
+
},
|
|
532
|
+
__wbg_then_837494e384b37459: function(arg0, arg1) {
|
|
533
|
+
const ret = arg0.then(arg1);
|
|
534
|
+
return ret;
|
|
535
|
+
},
|
|
536
|
+
__wbg_then_87e0b598b245104b: function(arg0, arg1, arg2) {
|
|
537
|
+
const ret = arg0.then(arg1, arg2);
|
|
538
|
+
return ret;
|
|
539
|
+
},
|
|
540
|
+
__wbg_then_bd927500e8905df2: function(arg0, arg1, arg2) {
|
|
541
|
+
const ret = arg0.then(arg1, arg2);
|
|
542
|
+
return ret;
|
|
543
|
+
},
|
|
544
|
+
__wbg_unmap_817a2e3248a553fb: function(arg0) {
|
|
545
|
+
arg0.unmap();
|
|
546
|
+
},
|
|
547
|
+
__wbg_writeBuffer_24a10bfd5a8a57f7: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
548
|
+
arg0.writeBuffer(arg1, arg2, getArrayU8FromWasm0(arg3, arg4), arg5, arg6);
|
|
549
|
+
}, arguments); },
|
|
550
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
551
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 100, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
552
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h494390435fc5ceaa);
|
|
553
|
+
return ret;
|
|
554
|
+
},
|
|
555
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
556
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 66, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
557
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h01517a4dd6c2751e);
|
|
558
|
+
return ret;
|
|
559
|
+
},
|
|
560
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
561
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
562
|
+
const ret = arg0;
|
|
563
|
+
return ret;
|
|
564
|
+
},
|
|
565
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
566
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
567
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
568
|
+
return ret;
|
|
569
|
+
},
|
|
570
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
571
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
572
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
573
|
+
return ret;
|
|
574
|
+
},
|
|
575
|
+
__wbindgen_init_externref_table: function() {
|
|
576
|
+
const table = wasm.__wbindgen_externrefs;
|
|
577
|
+
const offset = table.grow(4);
|
|
578
|
+
table.set(0, undefined);
|
|
579
|
+
table.set(offset + 0, undefined);
|
|
580
|
+
table.set(offset + 1, null);
|
|
581
|
+
table.set(offset + 2, true);
|
|
582
|
+
table.set(offset + 3, false);
|
|
583
|
+
},
|
|
584
|
+
};
|
|
585
|
+
return {
|
|
586
|
+
__proto__: null,
|
|
587
|
+
"./nano_rspow_web_bg.js": import0,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function wasm_bindgen__convert__closures_____invoke__h01517a4dd6c2751e(arg0, arg1, arg2) {
|
|
592
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h01517a4dd6c2751e(arg0, arg1, arg2);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function wasm_bindgen__convert__closures_____invoke__h494390435fc5ceaa(arg0, arg1, arg2) {
|
|
596
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h494390435fc5ceaa(arg0, arg1, arg2);
|
|
597
|
+
if (ret[1]) {
|
|
598
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function wasm_bindgen__convert__closures_____invoke__h08e8530b2c1a3586(arg0, arg1, arg2, arg3) {
|
|
603
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h08e8530b2c1a3586(arg0, arg1, arg2, arg3);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
const __wbindgen_enum_GpuBufferBindingType = ["uniform", "storage", "read-only-storage"];
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
const __wbindgen_enum_GpuPowerPreference = ["low-power", "high-performance"];
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
const __wbindgen_enum_GpuSamplerBindingType = ["filtering", "non-filtering", "comparison"];
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
const __wbindgen_enum_GpuStorageTextureAccess = ["write-only", "read-only", "read-write"];
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
const __wbindgen_enum_GpuTextureFormat = ["r8unorm", "r8snorm", "r8uint", "r8sint", "r16uint", "r16sint", "r16float", "rg8unorm", "rg8snorm", "rg8uint", "rg8sint", "r32uint", "r32sint", "r32float", "rg16uint", "rg16sint", "rg16float", "rgba8unorm", "rgba8unorm-srgb", "rgba8snorm", "rgba8uint", "rgba8sint", "bgra8unorm", "bgra8unorm-srgb", "rgb9e5ufloat", "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", "rg32uint", "rg32sint", "rg32float", "rgba16uint", "rgba16sint", "rgba16float", "rgba32uint", "rgba32sint", "rgba32float", "stencil8", "depth16unorm", "depth24plus", "depth24plus-stencil8", "depth32float", "depth32float-stencil8", "bc1-rgba-unorm", "bc1-rgba-unorm-srgb", "bc2-rgba-unorm", "bc2-rgba-unorm-srgb", "bc3-rgba-unorm", "bc3-rgba-unorm-srgb", "bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm", "bc6h-rgb-ufloat", "bc6h-rgb-float", "bc7-rgba-unorm", "bc7-rgba-unorm-srgb", "etc2-rgb8unorm", "etc2-rgb8unorm-srgb", "etc2-rgb8a1unorm", "etc2-rgb8a1unorm-srgb", "etc2-rgba8unorm", "etc2-rgba8unorm-srgb", "eac-r11unorm", "eac-r11snorm", "eac-rg11unorm", "eac-rg11snorm", "astc-4x4-unorm", "astc-4x4-unorm-srgb", "astc-5x4-unorm", "astc-5x4-unorm-srgb", "astc-5x5-unorm", "astc-5x5-unorm-srgb", "astc-6x5-unorm", "astc-6x5-unorm-srgb", "astc-6x6-unorm", "astc-6x6-unorm-srgb", "astc-8x5-unorm", "astc-8x5-unorm-srgb", "astc-8x6-unorm", "astc-8x6-unorm-srgb", "astc-8x8-unorm", "astc-8x8-unorm-srgb", "astc-10x5-unorm", "astc-10x5-unorm-srgb", "astc-10x6-unorm", "astc-10x6-unorm-srgb", "astc-10x8-unorm", "astc-10x8-unorm-srgb", "astc-10x10-unorm", "astc-10x10-unorm-srgb", "astc-12x10-unorm", "astc-12x10-unorm-srgb", "astc-12x12-unorm", "astc-12x12-unorm-srgb"];
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
const __wbindgen_enum_GpuTextureSampleType = ["float", "unfilterable-float", "depth", "sint", "uint"];
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
const __wbindgen_enum_GpuTextureViewDimension = ["1d", "2d", "2d-array", "cube", "cube-array", "3d"];
|
|
626
|
+
const GenerateResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
627
|
+
? { register: () => {}, unregister: () => {} }
|
|
628
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_generateresult_free(ptr, 1));
|
|
629
|
+
|
|
630
|
+
function addToExternrefTable0(obj) {
|
|
631
|
+
const idx = wasm.__externref_table_alloc();
|
|
632
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
633
|
+
return idx;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
637
|
+
? { register: () => {}, unregister: () => {} }
|
|
638
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
639
|
+
|
|
640
|
+
function debugString(val) {
|
|
641
|
+
// primitive types
|
|
642
|
+
const type = typeof val;
|
|
643
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
644
|
+
return `${val}`;
|
|
645
|
+
}
|
|
646
|
+
if (type == 'string') {
|
|
647
|
+
return `"${val}"`;
|
|
648
|
+
}
|
|
649
|
+
if (type == 'symbol') {
|
|
650
|
+
const description = val.description;
|
|
651
|
+
if (description == null) {
|
|
652
|
+
return 'Symbol';
|
|
653
|
+
} else {
|
|
654
|
+
return `Symbol(${description})`;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (type == 'function') {
|
|
658
|
+
const name = val.name;
|
|
659
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
660
|
+
return `Function(${name})`;
|
|
661
|
+
} else {
|
|
662
|
+
return 'Function';
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
// objects
|
|
666
|
+
if (Array.isArray(val)) {
|
|
667
|
+
const length = val.length;
|
|
668
|
+
let debug = '[';
|
|
669
|
+
if (length > 0) {
|
|
670
|
+
debug += debugString(val[0]);
|
|
671
|
+
}
|
|
672
|
+
for(let i = 1; i < length; i++) {
|
|
673
|
+
debug += ', ' + debugString(val[i]);
|
|
674
|
+
}
|
|
675
|
+
debug += ']';
|
|
676
|
+
return debug;
|
|
677
|
+
}
|
|
678
|
+
// Test for built-in
|
|
679
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
680
|
+
let className;
|
|
681
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
682
|
+
className = builtInMatches[1];
|
|
683
|
+
} else {
|
|
684
|
+
// Failed to match the standard '[object ClassName]'
|
|
685
|
+
return toString.call(val);
|
|
686
|
+
}
|
|
687
|
+
if (className == 'Object') {
|
|
688
|
+
// we're a user defined class or Object
|
|
689
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
690
|
+
// easier than looping through ownProperties of `val`.
|
|
691
|
+
try {
|
|
692
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
693
|
+
} catch (_) {
|
|
694
|
+
return 'Object';
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
// errors
|
|
698
|
+
if (val instanceof Error) {
|
|
699
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
700
|
+
}
|
|
701
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
702
|
+
return className;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
706
|
+
ptr = ptr >>> 0;
|
|
707
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
711
|
+
ptr = ptr >>> 0;
|
|
712
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
let cachedDataViewMemory0 = null;
|
|
716
|
+
function getDataViewMemory0() {
|
|
717
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
718
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
719
|
+
}
|
|
720
|
+
return cachedDataViewMemory0;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function getStringFromWasm0(ptr, len) {
|
|
724
|
+
return decodeText(ptr >>> 0, len);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
let cachedUint32ArrayMemory0 = null;
|
|
728
|
+
function getUint32ArrayMemory0() {
|
|
729
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
730
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
731
|
+
}
|
|
732
|
+
return cachedUint32ArrayMemory0;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
let cachedUint8ArrayMemory0 = null;
|
|
736
|
+
function getUint8ArrayMemory0() {
|
|
737
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
738
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
739
|
+
}
|
|
740
|
+
return cachedUint8ArrayMemory0;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function handleError(f, args) {
|
|
744
|
+
try {
|
|
745
|
+
return f.apply(this, args);
|
|
746
|
+
} catch (e) {
|
|
747
|
+
const idx = addToExternrefTable0(e);
|
|
748
|
+
wasm.__wbindgen_exn_store(idx);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function isLikeNone(x) {
|
|
753
|
+
return x === undefined || x === null;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
757
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
758
|
+
const real = (...args) => {
|
|
759
|
+
|
|
760
|
+
// First up with a closure we increment the internal reference
|
|
761
|
+
// count. This ensures that the Rust closure environment won't
|
|
762
|
+
// be deallocated while we're invoking it.
|
|
763
|
+
state.cnt++;
|
|
764
|
+
const a = state.a;
|
|
765
|
+
state.a = 0;
|
|
766
|
+
try {
|
|
767
|
+
return f(a, state.b, ...args);
|
|
768
|
+
} finally {
|
|
769
|
+
state.a = a;
|
|
770
|
+
real._wbg_cb_unref();
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
real._wbg_cb_unref = () => {
|
|
774
|
+
if (--state.cnt === 0) {
|
|
775
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
776
|
+
state.a = 0;
|
|
777
|
+
CLOSURE_DTORS.unregister(state);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
781
|
+
return real;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
785
|
+
if (realloc === undefined) {
|
|
786
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
787
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
788
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
789
|
+
WASM_VECTOR_LEN = buf.length;
|
|
790
|
+
return ptr;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
let len = arg.length;
|
|
794
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
795
|
+
|
|
796
|
+
const mem = getUint8ArrayMemory0();
|
|
797
|
+
|
|
798
|
+
let offset = 0;
|
|
799
|
+
|
|
800
|
+
for (; offset < len; offset++) {
|
|
801
|
+
const code = arg.charCodeAt(offset);
|
|
802
|
+
if (code > 0x7F) break;
|
|
803
|
+
mem[ptr + offset] = code;
|
|
804
|
+
}
|
|
805
|
+
if (offset !== len) {
|
|
806
|
+
if (offset !== 0) {
|
|
807
|
+
arg = arg.slice(offset);
|
|
808
|
+
}
|
|
809
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
810
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
811
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
812
|
+
|
|
813
|
+
offset += ret.written;
|
|
814
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
WASM_VECTOR_LEN = offset;
|
|
818
|
+
return ptr;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
function takeFromExternrefTable0(idx) {
|
|
822
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
823
|
+
wasm.__externref_table_dealloc(idx);
|
|
824
|
+
return value;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
828
|
+
cachedTextDecoder.decode();
|
|
829
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
830
|
+
let numBytesDecoded = 0;
|
|
831
|
+
function decodeText(ptr, len) {
|
|
832
|
+
numBytesDecoded += len;
|
|
833
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
834
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
835
|
+
cachedTextDecoder.decode();
|
|
836
|
+
numBytesDecoded = len;
|
|
837
|
+
}
|
|
838
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
const cachedTextEncoder = new TextEncoder();
|
|
842
|
+
|
|
843
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
844
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
845
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
846
|
+
view.set(buf);
|
|
847
|
+
return {
|
|
848
|
+
read: arg.length,
|
|
849
|
+
written: buf.length
|
|
850
|
+
};
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
let WASM_VECTOR_LEN = 0;
|
|
855
|
+
|
|
856
|
+
let wasmModule, wasmInstance, wasm;
|
|
857
|
+
function __wbg_finalize_init(instance, module) {
|
|
858
|
+
wasmInstance = instance;
|
|
859
|
+
wasm = instance.exports;
|
|
860
|
+
wasmModule = module;
|
|
861
|
+
cachedDataViewMemory0 = null;
|
|
862
|
+
cachedUint32ArrayMemory0 = null;
|
|
863
|
+
cachedUint8ArrayMemory0 = null;
|
|
864
|
+
wasm.__wbindgen_start();
|
|
865
|
+
return wasm;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
async function __wbg_load(module, imports) {
|
|
869
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
870
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
871
|
+
try {
|
|
872
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
873
|
+
} catch (e) {
|
|
874
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
875
|
+
|
|
876
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
877
|
+
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);
|
|
878
|
+
|
|
879
|
+
} else { throw e; }
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
const bytes = await module.arrayBuffer();
|
|
884
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
885
|
+
} else {
|
|
886
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
887
|
+
|
|
888
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
889
|
+
return { instance, module };
|
|
890
|
+
} else {
|
|
891
|
+
return instance;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function expectedResponseType(type) {
|
|
896
|
+
switch (type) {
|
|
897
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
898
|
+
}
|
|
899
|
+
return false;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function initSync(module) {
|
|
904
|
+
if (wasm !== undefined) return wasm;
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
if (module !== undefined) {
|
|
908
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
909
|
+
({module} = module)
|
|
910
|
+
} else {
|
|
911
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
const imports = __wbg_get_imports();
|
|
916
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
917
|
+
module = new WebAssembly.Module(module);
|
|
918
|
+
}
|
|
919
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
920
|
+
return __wbg_finalize_init(instance, module);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
async function __wbg_init(module_or_path) {
|
|
924
|
+
if (wasm !== undefined) return wasm;
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
if (module_or_path !== undefined) {
|
|
928
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
929
|
+
({module_or_path} = module_or_path)
|
|
930
|
+
} else {
|
|
931
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
if (module_or_path === undefined) {
|
|
936
|
+
module_or_path = new URL('nano_rspow_web_bg.wasm', import.meta.url);
|
|
937
|
+
}
|
|
938
|
+
const imports = __wbg_get_imports();
|
|
939
|
+
|
|
940
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
941
|
+
module_or_path = fetch(module_or_path);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
945
|
+
|
|
946
|
+
return __wbg_finalize_init(instance, module);
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nano-rspow-web",
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "WebGPU-accelerated Nano (XNO) Proof of Work generation in the browser using WebAssembly",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/CasualSecurityInc/nano-rspow"
|
|
8
|
+
},
|
|
9
|
+
"author": "Casual Security Inc. & Conny Brunnkvist <cbrunnkvist@gmail.com>",
|
|
10
|
+
"main": "nano_rspow_web.js",
|
|
11
|
+
"types": "nano_rspow_web.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"nano_rspow_web.js",
|
|
14
|
+
"nano_rspow_web_bg.wasm",
|
|
15
|
+
"nano_rspow_web.d.ts",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "cargo build -p nano-rspow-web --target wasm32-unknown-unknown --release && wasm-bindgen --target web --out-dir . ../target/wasm32-unknown-unknown/release/nano_rspow_web.wasm"
|
|
20
|
+
}
|
|
21
|
+
}
|