ms-toollib 1.2.7-node → 1.2.10
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/ms_toollib.d.ts +284 -27
- package/ms_toollib.js +2 -430
- package/ms_toollib_bg.js +1022 -0
- package/ms_toollib_bg.wasm +0 -0
- package/package.json +5 -3
package/ms_toollib.js
CHANGED
|
@@ -1,430 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let wasm;
|
|
4
|
-
const { TextDecoder, TextEncoder } = require(`util`);
|
|
5
|
-
|
|
6
|
-
const heap = new Array(32).fill(undefined);
|
|
7
|
-
|
|
8
|
-
heap.push(undefined, null, true, false);
|
|
9
|
-
|
|
10
|
-
function getObject(idx) { return heap[idx]; }
|
|
11
|
-
|
|
12
|
-
let heap_next = heap.length;
|
|
13
|
-
|
|
14
|
-
function dropObject(idx) {
|
|
15
|
-
if (idx < 36) return;
|
|
16
|
-
heap[idx] = heap_next;
|
|
17
|
-
heap_next = idx;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function takeObject(idx) {
|
|
21
|
-
const ret = getObject(idx);
|
|
22
|
-
dropObject(idx);
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function addHeapObject(obj) {
|
|
27
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
-
const idx = heap_next;
|
|
29
|
-
heap_next = heap[idx];
|
|
30
|
-
|
|
31
|
-
heap[idx] = obj;
|
|
32
|
-
return idx;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
|
-
|
|
37
|
-
cachedTextDecoder.decode();
|
|
38
|
-
|
|
39
|
-
let cachegetUint8Memory0 = null;
|
|
40
|
-
function getUint8Memory0() {
|
|
41
|
-
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
42
|
-
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
43
|
-
}
|
|
44
|
-
return cachegetUint8Memory0;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getStringFromWasm0(ptr, len) {
|
|
48
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
*/
|
|
52
|
-
module.exports.greet = function() {
|
|
53
|
-
wasm.greet();
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
let WASM_VECTOR_LEN = 0;
|
|
57
|
-
|
|
58
|
-
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
59
|
-
|
|
60
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
61
|
-
? function (arg, view) {
|
|
62
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
63
|
-
}
|
|
64
|
-
: function (arg, view) {
|
|
65
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
66
|
-
view.set(buf);
|
|
67
|
-
return {
|
|
68
|
-
read: arg.length,
|
|
69
|
-
written: buf.length
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
74
|
-
|
|
75
|
-
if (realloc === undefined) {
|
|
76
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
77
|
-
const ptr = malloc(buf.length);
|
|
78
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
79
|
-
WASM_VECTOR_LEN = buf.length;
|
|
80
|
-
return ptr;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
let len = arg.length;
|
|
84
|
-
let ptr = malloc(len);
|
|
85
|
-
|
|
86
|
-
const mem = getUint8Memory0();
|
|
87
|
-
|
|
88
|
-
let offset = 0;
|
|
89
|
-
|
|
90
|
-
for (; offset < len; offset++) {
|
|
91
|
-
const code = arg.charCodeAt(offset);
|
|
92
|
-
if (code > 0x7F) break;
|
|
93
|
-
mem[ptr + offset] = code;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (offset !== len) {
|
|
97
|
-
if (offset !== 0) {
|
|
98
|
-
arg = arg.slice(offset);
|
|
99
|
-
}
|
|
100
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
101
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
102
|
-
const ret = encodeString(arg, view);
|
|
103
|
-
|
|
104
|
-
offset += ret.written;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
WASM_VECTOR_LEN = offset;
|
|
108
|
-
return ptr;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @param {string} board_json
|
|
112
|
-
* @returns {number}
|
|
113
|
-
*/
|
|
114
|
-
module.exports.cal3BV = function(board_json) {
|
|
115
|
-
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
116
|
-
var len0 = WASM_VECTOR_LEN;
|
|
117
|
-
var ret = wasm.cal3BV(ptr0, len0);
|
|
118
|
-
return ret;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @param {string} board_json
|
|
123
|
-
* @returns {number}
|
|
124
|
-
*/
|
|
125
|
-
module.exports.cal_op = function(board_json) {
|
|
126
|
-
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
127
|
-
var len0 = WASM_VECTOR_LEN;
|
|
128
|
-
var ret = wasm.cal_op(ptr0, len0);
|
|
129
|
-
return ret;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
let cachegetInt32Memory0 = null;
|
|
133
|
-
function getInt32Memory0() {
|
|
134
|
-
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
135
|
-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
136
|
-
}
|
|
137
|
-
return cachegetInt32Memory0;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* @param {string} board_json
|
|
141
|
-
* @param {number} mine_num
|
|
142
|
-
* @returns {string}
|
|
143
|
-
*/
|
|
144
|
-
module.exports.cal_possibility_onboard = function(board_json, mine_num) {
|
|
145
|
-
try {
|
|
146
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
147
|
-
var ptr0 = passStringToWasm0(board_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
148
|
-
var len0 = WASM_VECTOR_LEN;
|
|
149
|
-
wasm.cal_possibility_onboard(retptr, ptr0, len0, mine_num);
|
|
150
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
151
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
152
|
-
return getStringFromWasm0(r0, r1);
|
|
153
|
-
} finally {
|
|
154
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
155
|
-
wasm.__wbindgen_free(r0, r1);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* @param {number} row
|
|
161
|
-
* @param {number} column
|
|
162
|
-
* @param {number} mine_num
|
|
163
|
-
* @param {number} x0
|
|
164
|
-
* @param {number} y0
|
|
165
|
-
* @returns {string}
|
|
166
|
-
*/
|
|
167
|
-
module.exports.laymine_number = function(row, column, mine_num, x0, y0) {
|
|
168
|
-
try {
|
|
169
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
170
|
-
wasm.laymine_number(retptr, row, column, mine_num, x0, y0);
|
|
171
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
172
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
173
|
-
return getStringFromWasm0(r0, r1);
|
|
174
|
-
} finally {
|
|
175
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
176
|
-
wasm.__wbindgen_free(r0, r1);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* @param {number} row
|
|
182
|
-
* @param {number} column
|
|
183
|
-
* @param {number} mine_num
|
|
184
|
-
* @param {number} x0
|
|
185
|
-
* @param {number} y0
|
|
186
|
-
* @returns {string}
|
|
187
|
-
*/
|
|
188
|
-
module.exports.laymine_op_number = function(row, column, mine_num, x0, y0) {
|
|
189
|
-
try {
|
|
190
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
191
|
-
wasm.laymine_op_number(retptr, row, column, mine_num, x0, y0);
|
|
192
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
193
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
194
|
-
return getStringFromWasm0(r0, r1);
|
|
195
|
-
} finally {
|
|
196
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
197
|
-
wasm.__wbindgen_free(r0, r1);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* @param {number} row
|
|
203
|
-
* @param {number} column
|
|
204
|
-
* @param {number} mine_num
|
|
205
|
-
* @param {number} x0
|
|
206
|
-
* @param {number} y0
|
|
207
|
-
* @param {number} min_3BV
|
|
208
|
-
* @param {number} max_3BV
|
|
209
|
-
* @param {number} max_times
|
|
210
|
-
* @param {number} method
|
|
211
|
-
* @returns {string}
|
|
212
|
-
*/
|
|
213
|
-
module.exports.laymine = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method) {
|
|
214
|
-
try {
|
|
215
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
216
|
-
wasm.laymine(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method);
|
|
217
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
218
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
219
|
-
return getStringFromWasm0(r0, r1);
|
|
220
|
-
} finally {
|
|
221
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
222
|
-
wasm.__wbindgen_free(r0, r1);
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* @param {number} row
|
|
228
|
-
* @param {number} column
|
|
229
|
-
* @param {number} mine_num
|
|
230
|
-
* @param {number} x0
|
|
231
|
-
* @param {number} y0
|
|
232
|
-
* @param {number} min_3BV
|
|
233
|
-
* @param {number} max_3BV
|
|
234
|
-
* @param {number} max_times
|
|
235
|
-
* @param {number} method
|
|
236
|
-
* @returns {string}
|
|
237
|
-
*/
|
|
238
|
-
module.exports.laymine_op = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method) {
|
|
239
|
-
try {
|
|
240
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
241
|
-
wasm.laymine_op(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, method);
|
|
242
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
243
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
244
|
-
return getStringFromWasm0(r0, r1);
|
|
245
|
-
} finally {
|
|
246
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
247
|
-
wasm.__wbindgen_free(r0, r1);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* @param {number} row
|
|
253
|
-
* @param {number} column
|
|
254
|
-
* @param {number} mine_num
|
|
255
|
-
* @param {number} x0
|
|
256
|
-
* @param {number} y0
|
|
257
|
-
* @param {number} min_3BV
|
|
258
|
-
* @param {number} max_3BV
|
|
259
|
-
* @param {number} max_times
|
|
260
|
-
* @param {number} enu_limit
|
|
261
|
-
* @returns {string}
|
|
262
|
-
*/
|
|
263
|
-
module.exports.laymine_solvable = function(row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, enu_limit) {
|
|
264
|
-
try {
|
|
265
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
266
|
-
wasm.laymine_solvable(retptr, row, column, mine_num, x0, y0, min_3BV, max_3BV, max_times, enu_limit);
|
|
267
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
268
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
269
|
-
return getStringFromWasm0(r0, r1);
|
|
270
|
-
} finally {
|
|
271
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
272
|
-
wasm.__wbindgen_free(r0, r1);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
function handleError(f, args) {
|
|
277
|
-
try {
|
|
278
|
-
return f.apply(this, args);
|
|
279
|
-
} catch (e) {
|
|
280
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
285
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
module.exports.__wbg_alert_824f87388a45faa8 = function(arg0, arg1) {
|
|
289
|
-
alert(getStringFromWasm0(arg0, arg1));
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
module.exports.__wbg_getRandomValues_98117e9a7e993920 = function() { return handleError(function (arg0, arg1) {
|
|
293
|
-
getObject(arg0).getRandomValues(getObject(arg1));
|
|
294
|
-
}, arguments) };
|
|
295
|
-
|
|
296
|
-
module.exports.__wbg_randomFillSync_64cc7d048f228ca8 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
297
|
-
getObject(arg0).randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
298
|
-
}, arguments) };
|
|
299
|
-
|
|
300
|
-
module.exports.__wbg_process_2f24d6544ea7b200 = function(arg0) {
|
|
301
|
-
var ret = getObject(arg0).process;
|
|
302
|
-
return addHeapObject(ret);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
module.exports.__wbindgen_is_object = function(arg0) {
|
|
306
|
-
const val = getObject(arg0);
|
|
307
|
-
var ret = typeof(val) === 'object' && val !== null;
|
|
308
|
-
return ret;
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
module.exports.__wbg_versions_6164651e75405d4a = function(arg0) {
|
|
312
|
-
var ret = getObject(arg0).versions;
|
|
313
|
-
return addHeapObject(ret);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
317
|
-
takeObject(arg0);
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
module.exports.__wbg_node_4b517d861cbcb3bc = function(arg0) {
|
|
321
|
-
var ret = getObject(arg0).node;
|
|
322
|
-
return addHeapObject(ret);
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
326
|
-
var ret = typeof(getObject(arg0)) === 'string';
|
|
327
|
-
return ret;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
module.exports.__wbg_crypto_98fc271021c7d2ad = function(arg0) {
|
|
331
|
-
var ret = getObject(arg0).crypto;
|
|
332
|
-
return addHeapObject(ret);
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
module.exports.__wbg_msCrypto_a2cdb043d2bfe57f = function(arg0) {
|
|
336
|
-
var ret = getObject(arg0).msCrypto;
|
|
337
|
-
return addHeapObject(ret);
|
|
338
|
-
};
|
|
339
|
-
|
|
340
|
-
module.exports.__wbg_modulerequire_3440a4bcf44437db = function() { return handleError(function (arg0, arg1) {
|
|
341
|
-
var ret = module.require(getStringFromWasm0(arg0, arg1));
|
|
342
|
-
return addHeapObject(ret);
|
|
343
|
-
}, arguments) };
|
|
344
|
-
|
|
345
|
-
module.exports.__wbg_newnoargs_be86524d73f67598 = function(arg0, arg1) {
|
|
346
|
-
var ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
347
|
-
return addHeapObject(ret);
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
module.exports.__wbg_call_888d259a5fefc347 = function() { return handleError(function (arg0, arg1) {
|
|
351
|
-
var ret = getObject(arg0).call(getObject(arg1));
|
|
352
|
-
return addHeapObject(ret);
|
|
353
|
-
}, arguments) };
|
|
354
|
-
|
|
355
|
-
module.exports.__wbg_self_c6fbdfc2918d5e58 = function() { return handleError(function () {
|
|
356
|
-
var ret = self.self;
|
|
357
|
-
return addHeapObject(ret);
|
|
358
|
-
}, arguments) };
|
|
359
|
-
|
|
360
|
-
module.exports.__wbg_window_baec038b5ab35c54 = function() { return handleError(function () {
|
|
361
|
-
var ret = window.window;
|
|
362
|
-
return addHeapObject(ret);
|
|
363
|
-
}, arguments) };
|
|
364
|
-
|
|
365
|
-
module.exports.__wbg_globalThis_3f735a5746d41fbd = function() { return handleError(function () {
|
|
366
|
-
var ret = globalThis.globalThis;
|
|
367
|
-
return addHeapObject(ret);
|
|
368
|
-
}, arguments) };
|
|
369
|
-
|
|
370
|
-
module.exports.__wbg_global_1bc0b39582740e95 = function() { return handleError(function () {
|
|
371
|
-
var ret = global.global;
|
|
372
|
-
return addHeapObject(ret);
|
|
373
|
-
}, arguments) };
|
|
374
|
-
|
|
375
|
-
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
376
|
-
var ret = getObject(arg0) === undefined;
|
|
377
|
-
return ret;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
module.exports.__wbg_buffer_397eaa4d72ee94dd = function(arg0) {
|
|
381
|
-
var ret = getObject(arg0).buffer;
|
|
382
|
-
return addHeapObject(ret);
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
module.exports.__wbg_new_a7ce447f15ff496f = function(arg0) {
|
|
386
|
-
var ret = new Uint8Array(getObject(arg0));
|
|
387
|
-
return addHeapObject(ret);
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
module.exports.__wbg_set_969ad0a60e51d320 = function(arg0, arg1, arg2) {
|
|
391
|
-
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
module.exports.__wbg_length_1eb8fc608a0d4cdb = function(arg0) {
|
|
395
|
-
var ret = getObject(arg0).length;
|
|
396
|
-
return ret;
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
module.exports.__wbg_newwithlength_929232475839a482 = function(arg0) {
|
|
400
|
-
var ret = new Uint8Array(arg0 >>> 0);
|
|
401
|
-
return addHeapObject(ret);
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
module.exports.__wbg_subarray_8b658422a224f479 = function(arg0, arg1, arg2) {
|
|
405
|
-
var ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
406
|
-
return addHeapObject(ret);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
410
|
-
var ret = getObject(arg0);
|
|
411
|
-
return addHeapObject(ret);
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
415
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
module.exports.__wbindgen_memory = function() {
|
|
419
|
-
var ret = wasm.memory;
|
|
420
|
-
return addHeapObject(ret);
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const path = require('path').join(__dirname, 'ms_toollib_bg.wasm');
|
|
424
|
-
const bytes = require('fs').readFileSync(path);
|
|
425
|
-
|
|
426
|
-
const wasmModule = new WebAssembly.Module(bytes);
|
|
427
|
-
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
428
|
-
wasm = wasmInstance.exports;
|
|
429
|
-
module.exports.__wasm = wasm;
|
|
430
|
-
|
|
1
|
+
import * as wasm from "./ms_toollib_bg.wasm";
|
|
2
|
+
export * from "./ms_toollib_bg.js";
|