mons-rust 0.1.21 → 0.1.23
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 +1 -3
- package/mons-web.d.ts +455 -0
- package/mons-web.js +1226 -0
- package/mons-web_bg.wasm +0 -0
- package/package.json +19 -28
package/mons-web.js
ADDED
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
|
|
3
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
4
|
+
|
|
5
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
6
|
+
|
|
7
|
+
let cachedUint8Memory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8Memory0() {
|
|
10
|
+
if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
|
|
11
|
+
cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8Memory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getStringFromWasm0(ptr, len) {
|
|
17
|
+
ptr = ptr >>> 0;
|
|
18
|
+
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let WASM_VECTOR_LEN = 0;
|
|
22
|
+
|
|
23
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
24
|
+
|
|
25
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
26
|
+
? function (arg, view) {
|
|
27
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
28
|
+
}
|
|
29
|
+
: function (arg, view) {
|
|
30
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
31
|
+
view.set(buf);
|
|
32
|
+
return {
|
|
33
|
+
read: arg.length,
|
|
34
|
+
written: buf.length
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
39
|
+
|
|
40
|
+
if (realloc === undefined) {
|
|
41
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
42
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
43
|
+
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
44
|
+
WASM_VECTOR_LEN = buf.length;
|
|
45
|
+
return ptr;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let len = arg.length;
|
|
49
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
50
|
+
|
|
51
|
+
const mem = getUint8Memory0();
|
|
52
|
+
|
|
53
|
+
let offset = 0;
|
|
54
|
+
|
|
55
|
+
for (; offset < len; offset++) {
|
|
56
|
+
const code = arg.charCodeAt(offset);
|
|
57
|
+
if (code > 0x7F) break;
|
|
58
|
+
mem[ptr + offset] = code;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (offset !== len) {
|
|
62
|
+
if (offset !== 0) {
|
|
63
|
+
arg = arg.slice(offset);
|
|
64
|
+
}
|
|
65
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
66
|
+
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
67
|
+
const ret = encodeString(arg, view);
|
|
68
|
+
|
|
69
|
+
offset += ret.written;
|
|
70
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
WASM_VECTOR_LEN = offset;
|
|
74
|
+
return ptr;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let cachedInt32Memory0 = null;
|
|
78
|
+
|
|
79
|
+
function getInt32Memory0() {
|
|
80
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
81
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
82
|
+
}
|
|
83
|
+
return cachedInt32Memory0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let cachedUint32Memory0 = null;
|
|
87
|
+
|
|
88
|
+
function getUint32Memory0() {
|
|
89
|
+
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
|
|
90
|
+
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
91
|
+
}
|
|
92
|
+
return cachedUint32Memory0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const heap = new Array(128).fill(undefined);
|
|
96
|
+
|
|
97
|
+
heap.push(undefined, null, true, false);
|
|
98
|
+
|
|
99
|
+
let heap_next = heap.length;
|
|
100
|
+
|
|
101
|
+
function addHeapObject(obj) {
|
|
102
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
103
|
+
const idx = heap_next;
|
|
104
|
+
heap_next = heap[idx];
|
|
105
|
+
|
|
106
|
+
heap[idx] = obj;
|
|
107
|
+
return idx;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
111
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
112
|
+
const mem = getUint32Memory0();
|
|
113
|
+
for (let i = 0; i < array.length; i++) {
|
|
114
|
+
mem[ptr / 4 + i] = addHeapObject(array[i]);
|
|
115
|
+
}
|
|
116
|
+
WASM_VECTOR_LEN = array.length;
|
|
117
|
+
return ptr;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function isLikeNone(x) {
|
|
121
|
+
return x === undefined || x === null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function _assertClass(instance, klass) {
|
|
125
|
+
if (!(instance instanceof klass)) {
|
|
126
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
127
|
+
}
|
|
128
|
+
return instance.ptr;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function getArrayI32FromWasm0(ptr, len) {
|
|
132
|
+
ptr = ptr >>> 0;
|
|
133
|
+
return getInt32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function getObject(idx) { return heap[idx]; }
|
|
137
|
+
|
|
138
|
+
function dropObject(idx) {
|
|
139
|
+
if (idx < 132) return;
|
|
140
|
+
heap[idx] = heap_next;
|
|
141
|
+
heap_next = idx;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function takeObject(idx) {
|
|
145
|
+
const ret = getObject(idx);
|
|
146
|
+
dropObject(idx);
|
|
147
|
+
return ret;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
151
|
+
ptr = ptr >>> 0;
|
|
152
|
+
const mem = getUint32Memory0();
|
|
153
|
+
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
154
|
+
const result = [];
|
|
155
|
+
for (let i = 0; i < slice.length; i++) {
|
|
156
|
+
result.push(takeObject(slice[i]));
|
|
157
|
+
}
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* @param {string} fen_w
|
|
162
|
+
* @param {string} fen_b
|
|
163
|
+
* @param {string} flat_moves_string_w
|
|
164
|
+
* @param {string} flat_moves_string_b
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
export function winner(fen_w, fen_b, flat_moves_string_w, flat_moves_string_b) {
|
|
168
|
+
let deferred5_0;
|
|
169
|
+
let deferred5_1;
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
const ptr0 = passStringToWasm0(fen_w, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
173
|
+
const len0 = WASM_VECTOR_LEN;
|
|
174
|
+
const ptr1 = passStringToWasm0(fen_b, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
175
|
+
const len1 = WASM_VECTOR_LEN;
|
|
176
|
+
const ptr2 = passStringToWasm0(flat_moves_string_w, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
177
|
+
const len2 = WASM_VECTOR_LEN;
|
|
178
|
+
const ptr3 = passStringToWasm0(flat_moves_string_b, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
179
|
+
const len3 = WASM_VECTOR_LEN;
|
|
180
|
+
wasm.winner(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
181
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
182
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
183
|
+
deferred5_0 = r0;
|
|
184
|
+
deferred5_1 = r1;
|
|
185
|
+
return getStringFromWasm0(r0, r1);
|
|
186
|
+
} finally {
|
|
187
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
188
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
*/
|
|
194
|
+
export const Color = Object.freeze({ White:0,"0":"White",Black:1,"1":"Black", });
|
|
195
|
+
/**
|
|
196
|
+
*/
|
|
197
|
+
export const AvailableMoveKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",Action:2,"2":"Action",Potion:3,"3":"Potion", });
|
|
198
|
+
/**
|
|
199
|
+
*/
|
|
200
|
+
export const OutputModelKind = Object.freeze({ InvalidInput:0,"0":"InvalidInput",LocationsToStartFrom:1,"1":"LocationsToStartFrom",NextInputOptions:2,"2":"NextInputOptions",Events:3,"3":"Events", });
|
|
201
|
+
/**
|
|
202
|
+
*/
|
|
203
|
+
export const NextInputKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",MysticAction:2,"2":"MysticAction",DemonAction:3,"3":"DemonAction",DemonAdditionalStep:4,"4":"DemonAdditionalStep",SpiritTargetCapture:5,"5":"SpiritTargetCapture",SpiritTargetMove:6,"6":"SpiritTargetMove",SelectConsumable:7,"7":"SelectConsumable",BombAttack:8,"8":"BombAttack", });
|
|
204
|
+
/**
|
|
205
|
+
*/
|
|
206
|
+
export const ItemModelKind = Object.freeze({ Mon:0,"0":"Mon",Mana:1,"1":"Mana",MonWithMana:2,"2":"MonWithMana",MonWithConsumable:3,"3":"MonWithConsumable",Consumable:4,"4":"Consumable", });
|
|
207
|
+
/**
|
|
208
|
+
*/
|
|
209
|
+
export const SquareModelKind = Object.freeze({ Regular:0,"0":"Regular",ConsumableBase:1,"1":"ConsumableBase",SupermanaBase:2,"2":"SupermanaBase",ManaBase:3,"3":"ManaBase",ManaPool:4,"4":"ManaPool",MonBase:5,"5":"MonBase", });
|
|
210
|
+
/**
|
|
211
|
+
*/
|
|
212
|
+
export const ManaKind = Object.freeze({ Regular:0,"0":"Regular",Supermana:1,"1":"Supermana", });
|
|
213
|
+
/**
|
|
214
|
+
*/
|
|
215
|
+
export const Consumable = Object.freeze({ Potion:0,"0":"Potion",Bomb:1,"1":"Bomb",BombOrPotion:2,"2":"BombOrPotion", });
|
|
216
|
+
/**
|
|
217
|
+
*/
|
|
218
|
+
export const MonKind = Object.freeze({ Demon:0,"0":"Demon",Drainer:1,"1":"Drainer",Angel:2,"2":"Angel",Spirit:3,"3":"Spirit",Mystic:4,"4":"Mystic", });
|
|
219
|
+
/**
|
|
220
|
+
*/
|
|
221
|
+
export const EventModelKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",ManaScored:2,"2":"ManaScored",MysticAction:3,"3":"MysticAction",DemonAction:4,"4":"DemonAction",DemonAdditionalStep:5,"5":"DemonAdditionalStep",SpiritTargetMove:6,"6":"SpiritTargetMove",PickupBomb:7,"7":"PickupBomb",PickupPotion:8,"8":"PickupPotion",PickupMana:9,"9":"PickupMana",MonFainted:10,"10":"MonFainted",ManaDropped:11,"11":"ManaDropped",SupermanaBackToBase:12,"12":"SupermanaBackToBase",BombAttack:13,"13":"BombAttack",MonAwake:14,"14":"MonAwake",BombExplosion:15,"15":"BombExplosion",NextTurn:16,"16":"NextTurn",GameOver:17,"17":"GameOver", });
|
|
222
|
+
/**
|
|
223
|
+
*/
|
|
224
|
+
export const Modifier = Object.freeze({ SelectPotion:0,"0":"SelectPotion",SelectBomb:1,"1":"SelectBomb",Cancel:2,"2":"Cancel", });
|
|
225
|
+
|
|
226
|
+
const EventModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
227
|
+
? { register: () => {}, unregister: () => {} }
|
|
228
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_eventmodel_free(ptr >>> 0));
|
|
229
|
+
/**
|
|
230
|
+
*/
|
|
231
|
+
export class EventModel {
|
|
232
|
+
|
|
233
|
+
static __wrap(ptr) {
|
|
234
|
+
ptr = ptr >>> 0;
|
|
235
|
+
const obj = Object.create(EventModel.prototype);
|
|
236
|
+
obj.__wbg_ptr = ptr;
|
|
237
|
+
EventModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
238
|
+
return obj;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
__destroy_into_raw() {
|
|
242
|
+
const ptr = this.__wbg_ptr;
|
|
243
|
+
this.__wbg_ptr = 0;
|
|
244
|
+
EventModelFinalization.unregister(this);
|
|
245
|
+
return ptr;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
free() {
|
|
249
|
+
const ptr = this.__destroy_into_raw();
|
|
250
|
+
wasm.__wbg_eventmodel_free(ptr);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @returns {EventModelKind}
|
|
254
|
+
*/
|
|
255
|
+
get kind() {
|
|
256
|
+
const ret = wasm.__wbg_get_eventmodel_kind(this.__wbg_ptr);
|
|
257
|
+
return ret;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @param {EventModelKind} arg0
|
|
261
|
+
*/
|
|
262
|
+
set kind(arg0) {
|
|
263
|
+
wasm.__wbg_set_eventmodel_kind(this.__wbg_ptr, arg0);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* @returns {ItemModel | undefined}
|
|
267
|
+
*/
|
|
268
|
+
get item() {
|
|
269
|
+
const ret = wasm.__wbg_get_eventmodel_item(this.__wbg_ptr);
|
|
270
|
+
return ret === 0 ? undefined : ItemModel.__wrap(ret);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* @param {ItemModel | undefined} [arg0]
|
|
274
|
+
*/
|
|
275
|
+
set item(arg0) {
|
|
276
|
+
let ptr0 = 0;
|
|
277
|
+
if (!isLikeNone(arg0)) {
|
|
278
|
+
_assertClass(arg0, ItemModel);
|
|
279
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
280
|
+
}
|
|
281
|
+
wasm.__wbg_set_eventmodel_item(this.__wbg_ptr, ptr0);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* @returns {Mon | undefined}
|
|
285
|
+
*/
|
|
286
|
+
get mon() {
|
|
287
|
+
const ret = wasm.__wbg_get_eventmodel_mon(this.__wbg_ptr);
|
|
288
|
+
return ret === 0 ? undefined : Mon.__wrap(ret);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* @param {Mon | undefined} [arg0]
|
|
292
|
+
*/
|
|
293
|
+
set mon(arg0) {
|
|
294
|
+
let ptr0 = 0;
|
|
295
|
+
if (!isLikeNone(arg0)) {
|
|
296
|
+
_assertClass(arg0, Mon);
|
|
297
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
298
|
+
}
|
|
299
|
+
wasm.__wbg_set_eventmodel_mon(this.__wbg_ptr, ptr0);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* @returns {ManaModel | undefined}
|
|
303
|
+
*/
|
|
304
|
+
get mana() {
|
|
305
|
+
const ret = wasm.__wbg_get_eventmodel_mana(this.__wbg_ptr);
|
|
306
|
+
return ret === 0 ? undefined : ManaModel.__wrap(ret);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* @param {ManaModel | undefined} [arg0]
|
|
310
|
+
*/
|
|
311
|
+
set mana(arg0) {
|
|
312
|
+
let ptr0 = 0;
|
|
313
|
+
if (!isLikeNone(arg0)) {
|
|
314
|
+
_assertClass(arg0, ManaModel);
|
|
315
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
316
|
+
}
|
|
317
|
+
wasm.__wbg_set_eventmodel_mana(this.__wbg_ptr, ptr0);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* @returns {Location | undefined}
|
|
321
|
+
*/
|
|
322
|
+
get loc1() {
|
|
323
|
+
const ret = wasm.__wbg_get_eventmodel_loc1(this.__wbg_ptr);
|
|
324
|
+
return ret === 0 ? undefined : Location.__wrap(ret);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* @param {Location | undefined} [arg0]
|
|
328
|
+
*/
|
|
329
|
+
set loc1(arg0) {
|
|
330
|
+
let ptr0 = 0;
|
|
331
|
+
if (!isLikeNone(arg0)) {
|
|
332
|
+
_assertClass(arg0, Location);
|
|
333
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
334
|
+
}
|
|
335
|
+
wasm.__wbg_set_eventmodel_loc1(this.__wbg_ptr, ptr0);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @returns {Location | undefined}
|
|
339
|
+
*/
|
|
340
|
+
get loc2() {
|
|
341
|
+
const ret = wasm.__wbg_get_eventmodel_loc2(this.__wbg_ptr);
|
|
342
|
+
return ret === 0 ? undefined : Location.__wrap(ret);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* @param {Location | undefined} [arg0]
|
|
346
|
+
*/
|
|
347
|
+
set loc2(arg0) {
|
|
348
|
+
let ptr0 = 0;
|
|
349
|
+
if (!isLikeNone(arg0)) {
|
|
350
|
+
_assertClass(arg0, Location);
|
|
351
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
352
|
+
}
|
|
353
|
+
wasm.__wbg_set_eventmodel_loc2(this.__wbg_ptr, ptr0);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* @returns {Color | undefined}
|
|
357
|
+
*/
|
|
358
|
+
get color() {
|
|
359
|
+
const ret = wasm.__wbg_get_eventmodel_color(this.__wbg_ptr);
|
|
360
|
+
return ret === 2 ? undefined : ret;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* @param {Color | undefined} [arg0]
|
|
364
|
+
*/
|
|
365
|
+
set color(arg0) {
|
|
366
|
+
wasm.__wbg_set_eventmodel_color(this.__wbg_ptr, isLikeNone(arg0) ? 2 : arg0);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const ItemModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
371
|
+
? { register: () => {}, unregister: () => {} }
|
|
372
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_itemmodel_free(ptr >>> 0));
|
|
373
|
+
/**
|
|
374
|
+
*/
|
|
375
|
+
export class ItemModel {
|
|
376
|
+
|
|
377
|
+
static __wrap(ptr) {
|
|
378
|
+
ptr = ptr >>> 0;
|
|
379
|
+
const obj = Object.create(ItemModel.prototype);
|
|
380
|
+
obj.__wbg_ptr = ptr;
|
|
381
|
+
ItemModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
382
|
+
return obj;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
__destroy_into_raw() {
|
|
386
|
+
const ptr = this.__wbg_ptr;
|
|
387
|
+
this.__wbg_ptr = 0;
|
|
388
|
+
ItemModelFinalization.unregister(this);
|
|
389
|
+
return ptr;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
free() {
|
|
393
|
+
const ptr = this.__destroy_into_raw();
|
|
394
|
+
wasm.__wbg_itemmodel_free(ptr);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* @returns {ItemModelKind}
|
|
398
|
+
*/
|
|
399
|
+
get kind() {
|
|
400
|
+
const ret = wasm.__wbg_get_itemmodel_kind(this.__wbg_ptr);
|
|
401
|
+
return ret;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* @param {ItemModelKind} arg0
|
|
405
|
+
*/
|
|
406
|
+
set kind(arg0) {
|
|
407
|
+
wasm.__wbg_set_itemmodel_kind(this.__wbg_ptr, arg0);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* @returns {Mon | undefined}
|
|
411
|
+
*/
|
|
412
|
+
get mon() {
|
|
413
|
+
const ret = wasm.__wbg_get_itemmodel_mon(this.__wbg_ptr);
|
|
414
|
+
return ret === 0 ? undefined : Mon.__wrap(ret);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* @param {Mon | undefined} [arg0]
|
|
418
|
+
*/
|
|
419
|
+
set mon(arg0) {
|
|
420
|
+
let ptr0 = 0;
|
|
421
|
+
if (!isLikeNone(arg0)) {
|
|
422
|
+
_assertClass(arg0, Mon);
|
|
423
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
424
|
+
}
|
|
425
|
+
wasm.__wbg_set_itemmodel_mon(this.__wbg_ptr, ptr0);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* @returns {ManaModel | undefined}
|
|
429
|
+
*/
|
|
430
|
+
get mana() {
|
|
431
|
+
const ret = wasm.__wbg_get_itemmodel_mana(this.__wbg_ptr);
|
|
432
|
+
return ret === 0 ? undefined : ManaModel.__wrap(ret);
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* @param {ManaModel | undefined} [arg0]
|
|
436
|
+
*/
|
|
437
|
+
set mana(arg0) {
|
|
438
|
+
let ptr0 = 0;
|
|
439
|
+
if (!isLikeNone(arg0)) {
|
|
440
|
+
_assertClass(arg0, ManaModel);
|
|
441
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
442
|
+
}
|
|
443
|
+
wasm.__wbg_set_itemmodel_mana(this.__wbg_ptr, ptr0);
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* @returns {Consumable | undefined}
|
|
447
|
+
*/
|
|
448
|
+
get consumable() {
|
|
449
|
+
const ret = wasm.__wbg_get_itemmodel_consumable(this.__wbg_ptr);
|
|
450
|
+
return ret === 3 ? undefined : ret;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* @param {Consumable | undefined} [arg0]
|
|
454
|
+
*/
|
|
455
|
+
set consumable(arg0) {
|
|
456
|
+
wasm.__wbg_set_itemmodel_consumable(this.__wbg_ptr, isLikeNone(arg0) ? 3 : arg0);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
461
|
+
? { register: () => {}, unregister: () => {} }
|
|
462
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0));
|
|
463
|
+
/**
|
|
464
|
+
*/
|
|
465
|
+
export class Location {
|
|
466
|
+
|
|
467
|
+
static __wrap(ptr) {
|
|
468
|
+
ptr = ptr >>> 0;
|
|
469
|
+
const obj = Object.create(Location.prototype);
|
|
470
|
+
obj.__wbg_ptr = ptr;
|
|
471
|
+
LocationFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
472
|
+
return obj;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
static __unwrap(jsValue) {
|
|
476
|
+
if (!(jsValue instanceof Location)) {
|
|
477
|
+
return 0;
|
|
478
|
+
}
|
|
479
|
+
return jsValue.__destroy_into_raw();
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
__destroy_into_raw() {
|
|
483
|
+
const ptr = this.__wbg_ptr;
|
|
484
|
+
this.__wbg_ptr = 0;
|
|
485
|
+
LocationFinalization.unregister(this);
|
|
486
|
+
return ptr;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
free() {
|
|
490
|
+
const ptr = this.__destroy_into_raw();
|
|
491
|
+
wasm.__wbg_location_free(ptr);
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @returns {number}
|
|
495
|
+
*/
|
|
496
|
+
get i() {
|
|
497
|
+
const ret = wasm.__wbg_get_location_i(this.__wbg_ptr);
|
|
498
|
+
return ret;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @param {number} arg0
|
|
502
|
+
*/
|
|
503
|
+
set i(arg0) {
|
|
504
|
+
wasm.__wbg_set_location_i(this.__wbg_ptr, arg0);
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* @returns {number}
|
|
508
|
+
*/
|
|
509
|
+
get j() {
|
|
510
|
+
const ret = wasm.__wbg_get_location_j(this.__wbg_ptr);
|
|
511
|
+
return ret;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* @param {number} arg0
|
|
515
|
+
*/
|
|
516
|
+
set j(arg0) {
|
|
517
|
+
wasm.__wbg_set_location_j(this.__wbg_ptr, arg0);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* @param {number} i
|
|
521
|
+
* @param {number} j
|
|
522
|
+
*/
|
|
523
|
+
constructor(i, j) {
|
|
524
|
+
const ret = wasm.location_new(i, j);
|
|
525
|
+
this.__wbg_ptr = ret >>> 0;
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
const ManaModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
531
|
+
? { register: () => {}, unregister: () => {} }
|
|
532
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_manamodel_free(ptr >>> 0));
|
|
533
|
+
/**
|
|
534
|
+
*/
|
|
535
|
+
export class ManaModel {
|
|
536
|
+
|
|
537
|
+
static __wrap(ptr) {
|
|
538
|
+
ptr = ptr >>> 0;
|
|
539
|
+
const obj = Object.create(ManaModel.prototype);
|
|
540
|
+
obj.__wbg_ptr = ptr;
|
|
541
|
+
ManaModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
542
|
+
return obj;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
__destroy_into_raw() {
|
|
546
|
+
const ptr = this.__wbg_ptr;
|
|
547
|
+
this.__wbg_ptr = 0;
|
|
548
|
+
ManaModelFinalization.unregister(this);
|
|
549
|
+
return ptr;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
free() {
|
|
553
|
+
const ptr = this.__destroy_into_raw();
|
|
554
|
+
wasm.__wbg_manamodel_free(ptr);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* @returns {ManaKind}
|
|
558
|
+
*/
|
|
559
|
+
get kind() {
|
|
560
|
+
const ret = wasm.__wbg_get_manamodel_kind(this.__wbg_ptr);
|
|
561
|
+
return ret;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* @param {ManaKind} arg0
|
|
565
|
+
*/
|
|
566
|
+
set kind(arg0) {
|
|
567
|
+
wasm.__wbg_set_manamodel_kind(this.__wbg_ptr, arg0);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* @returns {Color}
|
|
571
|
+
*/
|
|
572
|
+
get color() {
|
|
573
|
+
const ret = wasm.__wbg_get_manamodel_color(this.__wbg_ptr);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* @param {Color} arg0
|
|
578
|
+
*/
|
|
579
|
+
set color(arg0) {
|
|
580
|
+
wasm.__wbg_set_manamodel_color(this.__wbg_ptr, arg0);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
const MonFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
585
|
+
? { register: () => {}, unregister: () => {} }
|
|
586
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_mon_free(ptr >>> 0));
|
|
587
|
+
/**
|
|
588
|
+
*/
|
|
589
|
+
export class Mon {
|
|
590
|
+
|
|
591
|
+
static __wrap(ptr) {
|
|
592
|
+
ptr = ptr >>> 0;
|
|
593
|
+
const obj = Object.create(Mon.prototype);
|
|
594
|
+
obj.__wbg_ptr = ptr;
|
|
595
|
+
MonFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
596
|
+
return obj;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
__destroy_into_raw() {
|
|
600
|
+
const ptr = this.__wbg_ptr;
|
|
601
|
+
this.__wbg_ptr = 0;
|
|
602
|
+
MonFinalization.unregister(this);
|
|
603
|
+
return ptr;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
free() {
|
|
607
|
+
const ptr = this.__destroy_into_raw();
|
|
608
|
+
wasm.__wbg_mon_free(ptr);
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* @returns {MonKind}
|
|
612
|
+
*/
|
|
613
|
+
get kind() {
|
|
614
|
+
const ret = wasm.__wbg_get_mon_kind(this.__wbg_ptr);
|
|
615
|
+
return ret;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @param {MonKind} arg0
|
|
619
|
+
*/
|
|
620
|
+
set kind(arg0) {
|
|
621
|
+
wasm.__wbg_set_mon_kind(this.__wbg_ptr, arg0);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* @returns {Color}
|
|
625
|
+
*/
|
|
626
|
+
get color() {
|
|
627
|
+
const ret = wasm.__wbg_get_mon_color(this.__wbg_ptr);
|
|
628
|
+
return ret;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* @param {Color} arg0
|
|
632
|
+
*/
|
|
633
|
+
set color(arg0) {
|
|
634
|
+
wasm.__wbg_set_mon_color(this.__wbg_ptr, arg0);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* @returns {number}
|
|
638
|
+
*/
|
|
639
|
+
get cooldown() {
|
|
640
|
+
const ret = wasm.__wbg_get_mon_cooldown(this.__wbg_ptr);
|
|
641
|
+
return ret;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* @param {number} arg0
|
|
645
|
+
*/
|
|
646
|
+
set cooldown(arg0) {
|
|
647
|
+
wasm.__wbg_set_mon_cooldown(this.__wbg_ptr, arg0);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* @param {MonKind} kind
|
|
651
|
+
* @param {Color} color
|
|
652
|
+
* @param {number} cooldown
|
|
653
|
+
* @returns {Mon}
|
|
654
|
+
*/
|
|
655
|
+
static new(kind, color, cooldown) {
|
|
656
|
+
const ret = wasm.mon_new(kind, color, cooldown);
|
|
657
|
+
return Mon.__wrap(ret);
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* @returns {boolean}
|
|
661
|
+
*/
|
|
662
|
+
is_fainted() {
|
|
663
|
+
const ret = wasm.mon_is_fainted(this.__wbg_ptr);
|
|
664
|
+
return ret !== 0;
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
*/
|
|
668
|
+
faint() {
|
|
669
|
+
wasm.mon_faint(this.__wbg_ptr);
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
*/
|
|
673
|
+
decrease_cooldown() {
|
|
674
|
+
wasm.mon_decrease_cooldown(this.__wbg_ptr);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
const MonsGameModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
679
|
+
? { register: () => {}, unregister: () => {} }
|
|
680
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_monsgamemodel_free(ptr >>> 0));
|
|
681
|
+
/**
|
|
682
|
+
*/
|
|
683
|
+
export class MonsGameModel {
|
|
684
|
+
|
|
685
|
+
static __wrap(ptr) {
|
|
686
|
+
ptr = ptr >>> 0;
|
|
687
|
+
const obj = Object.create(MonsGameModel.prototype);
|
|
688
|
+
obj.__wbg_ptr = ptr;
|
|
689
|
+
MonsGameModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
690
|
+
return obj;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
__destroy_into_raw() {
|
|
694
|
+
const ptr = this.__wbg_ptr;
|
|
695
|
+
this.__wbg_ptr = 0;
|
|
696
|
+
MonsGameModelFinalization.unregister(this);
|
|
697
|
+
return ptr;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
free() {
|
|
701
|
+
const ptr = this.__destroy_into_raw();
|
|
702
|
+
wasm.__wbg_monsgamemodel_free(ptr);
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* @returns {MonsGameModel}
|
|
706
|
+
*/
|
|
707
|
+
static new() {
|
|
708
|
+
const ret = wasm.monsgamemodel_new();
|
|
709
|
+
return MonsGameModel.__wrap(ret);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* @param {string} fen
|
|
713
|
+
* @returns {MonsGameModel | undefined}
|
|
714
|
+
*/
|
|
715
|
+
static from_fen(fen) {
|
|
716
|
+
const ptr0 = passStringToWasm0(fen, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
717
|
+
const len0 = WASM_VECTOR_LEN;
|
|
718
|
+
const ret = wasm.monsgamemodel_from_fen(ptr0, len0);
|
|
719
|
+
return ret === 0 ? undefined : MonsGameModel.__wrap(ret);
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* @returns {string}
|
|
723
|
+
*/
|
|
724
|
+
fen() {
|
|
725
|
+
let deferred1_0;
|
|
726
|
+
let deferred1_1;
|
|
727
|
+
try {
|
|
728
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
729
|
+
wasm.monsgamemodel_fen(retptr, this.__wbg_ptr);
|
|
730
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
731
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
732
|
+
deferred1_0 = r0;
|
|
733
|
+
deferred1_1 = r1;
|
|
734
|
+
return getStringFromWasm0(r0, r1);
|
|
735
|
+
} finally {
|
|
736
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
737
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* @param {(Location)[]} locations
|
|
742
|
+
* @param {Modifier | undefined} [modifier]
|
|
743
|
+
* @returns {OutputModel}
|
|
744
|
+
*/
|
|
745
|
+
process_input(locations, modifier) {
|
|
746
|
+
const ptr0 = passArrayJsValueToWasm0(locations, wasm.__wbindgen_malloc);
|
|
747
|
+
const len0 = WASM_VECTOR_LEN;
|
|
748
|
+
const ret = wasm.monsgamemodel_process_input(this.__wbg_ptr, ptr0, len0, isLikeNone(modifier) ? 3 : modifier);
|
|
749
|
+
return OutputModel.__wrap(ret);
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* @param {string} input_fen
|
|
753
|
+
* @returns {OutputModel}
|
|
754
|
+
*/
|
|
755
|
+
process_input_fen(input_fen) {
|
|
756
|
+
const ptr0 = passStringToWasm0(input_fen, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
757
|
+
const len0 = WASM_VECTOR_LEN;
|
|
758
|
+
const ret = wasm.monsgamemodel_process_input_fen(this.__wbg_ptr, ptr0, len0);
|
|
759
|
+
return OutputModel.__wrap(ret);
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* @param {Location} at
|
|
763
|
+
* @returns {ItemModel | undefined}
|
|
764
|
+
*/
|
|
765
|
+
item(at) {
|
|
766
|
+
_assertClass(at, Location);
|
|
767
|
+
var ptr0 = at.__destroy_into_raw();
|
|
768
|
+
const ret = wasm.monsgamemodel_item(this.__wbg_ptr, ptr0);
|
|
769
|
+
return ret === 0 ? undefined : ItemModel.__wrap(ret);
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* @param {Location} at
|
|
773
|
+
* @returns {SquareModel}
|
|
774
|
+
*/
|
|
775
|
+
square(at) {
|
|
776
|
+
_assertClass(at, Location);
|
|
777
|
+
var ptr0 = at.__destroy_into_raw();
|
|
778
|
+
const ret = wasm.monsgamemodel_square(this.__wbg_ptr, ptr0);
|
|
779
|
+
return SquareModel.__wrap(ret);
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* @param {string} other_fen
|
|
783
|
+
* @returns {boolean}
|
|
784
|
+
*/
|
|
785
|
+
is_later_than(other_fen) {
|
|
786
|
+
const ptr0 = passStringToWasm0(other_fen, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
787
|
+
const len0 = WASM_VECTOR_LEN;
|
|
788
|
+
const ret = wasm.monsgamemodel_is_later_than(this.__wbg_ptr, ptr0, len0);
|
|
789
|
+
return ret !== 0;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* @returns {Color}
|
|
793
|
+
*/
|
|
794
|
+
active_color() {
|
|
795
|
+
const ret = wasm.monsgamemodel_active_color(this.__wbg_ptr);
|
|
796
|
+
return ret;
|
|
797
|
+
}
|
|
798
|
+
/**
|
|
799
|
+
* @returns {Color | undefined}
|
|
800
|
+
*/
|
|
801
|
+
winner_color() {
|
|
802
|
+
const ret = wasm.monsgamemodel_winner_color(this.__wbg_ptr);
|
|
803
|
+
return ret === 2 ? undefined : ret;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* @returns {number}
|
|
807
|
+
*/
|
|
808
|
+
black_score() {
|
|
809
|
+
const ret = wasm.monsgamemodel_black_score(this.__wbg_ptr);
|
|
810
|
+
return ret;
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* @returns {number}
|
|
814
|
+
*/
|
|
815
|
+
white_score() {
|
|
816
|
+
const ret = wasm.monsgamemodel_white_score(this.__wbg_ptr);
|
|
817
|
+
return ret;
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* @returns {Int32Array}
|
|
821
|
+
*/
|
|
822
|
+
available_move_kinds() {
|
|
823
|
+
try {
|
|
824
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
825
|
+
wasm.monsgamemodel_available_move_kinds(retptr, this.__wbg_ptr);
|
|
826
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
827
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
828
|
+
var v1 = getArrayI32FromWasm0(r0, r1).slice();
|
|
829
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
830
|
+
return v1;
|
|
831
|
+
} finally {
|
|
832
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* @returns {(Location)[]}
|
|
837
|
+
*/
|
|
838
|
+
locations_with_content() {
|
|
839
|
+
try {
|
|
840
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
841
|
+
wasm.monsgamemodel_locations_with_content(retptr, this.__wbg_ptr);
|
|
842
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
843
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
844
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
845
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
846
|
+
return v1;
|
|
847
|
+
} finally {
|
|
848
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
const NextInputModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
854
|
+
? { register: () => {}, unregister: () => {} }
|
|
855
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_nextinputmodel_free(ptr >>> 0));
|
|
856
|
+
/**
|
|
857
|
+
*/
|
|
858
|
+
export class NextInputModel {
|
|
859
|
+
|
|
860
|
+
static __wrap(ptr) {
|
|
861
|
+
ptr = ptr >>> 0;
|
|
862
|
+
const obj = Object.create(NextInputModel.prototype);
|
|
863
|
+
obj.__wbg_ptr = ptr;
|
|
864
|
+
NextInputModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
865
|
+
return obj;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
__destroy_into_raw() {
|
|
869
|
+
const ptr = this.__wbg_ptr;
|
|
870
|
+
this.__wbg_ptr = 0;
|
|
871
|
+
NextInputModelFinalization.unregister(this);
|
|
872
|
+
return ptr;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
free() {
|
|
876
|
+
const ptr = this.__destroy_into_raw();
|
|
877
|
+
wasm.__wbg_nextinputmodel_free(ptr);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* @returns {Location | undefined}
|
|
881
|
+
*/
|
|
882
|
+
get location() {
|
|
883
|
+
const ret = wasm.__wbg_get_eventmodel_loc1(this.__wbg_ptr);
|
|
884
|
+
return ret === 0 ? undefined : Location.__wrap(ret);
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* @param {Location | undefined} [arg0]
|
|
888
|
+
*/
|
|
889
|
+
set location(arg0) {
|
|
890
|
+
let ptr0 = 0;
|
|
891
|
+
if (!isLikeNone(arg0)) {
|
|
892
|
+
_assertClass(arg0, Location);
|
|
893
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
894
|
+
}
|
|
895
|
+
wasm.__wbg_set_eventmodel_loc1(this.__wbg_ptr, ptr0);
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* @returns {Modifier | undefined}
|
|
899
|
+
*/
|
|
900
|
+
get modifier() {
|
|
901
|
+
const ret = wasm.__wbg_get_nextinputmodel_modifier(this.__wbg_ptr);
|
|
902
|
+
return ret === 3 ? undefined : ret;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* @param {Modifier | undefined} [arg0]
|
|
906
|
+
*/
|
|
907
|
+
set modifier(arg0) {
|
|
908
|
+
wasm.__wbg_set_nextinputmodel_modifier(this.__wbg_ptr, isLikeNone(arg0) ? 3 : arg0);
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* @returns {NextInputKind}
|
|
912
|
+
*/
|
|
913
|
+
get kind() {
|
|
914
|
+
const ret = wasm.__wbg_get_nextinputmodel_kind(this.__wbg_ptr);
|
|
915
|
+
return ret;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* @param {NextInputKind} arg0
|
|
919
|
+
*/
|
|
920
|
+
set kind(arg0) {
|
|
921
|
+
wasm.__wbg_set_nextinputmodel_kind(this.__wbg_ptr, arg0);
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* @returns {ItemModel | undefined}
|
|
925
|
+
*/
|
|
926
|
+
get actor_mon_item() {
|
|
927
|
+
const ret = wasm.__wbg_get_nextinputmodel_actor_mon_item(this.__wbg_ptr);
|
|
928
|
+
return ret === 0 ? undefined : ItemModel.__wrap(ret);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* @param {ItemModel | undefined} [arg0]
|
|
932
|
+
*/
|
|
933
|
+
set actor_mon_item(arg0) {
|
|
934
|
+
let ptr0 = 0;
|
|
935
|
+
if (!isLikeNone(arg0)) {
|
|
936
|
+
_assertClass(arg0, ItemModel);
|
|
937
|
+
ptr0 = arg0.__destroy_into_raw();
|
|
938
|
+
}
|
|
939
|
+
wasm.__wbg_set_nextinputmodel_actor_mon_item(this.__wbg_ptr, ptr0);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
const OutputModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
944
|
+
? { register: () => {}, unregister: () => {} }
|
|
945
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_outputmodel_free(ptr >>> 0));
|
|
946
|
+
/**
|
|
947
|
+
*/
|
|
948
|
+
export class OutputModel {
|
|
949
|
+
|
|
950
|
+
static __wrap(ptr) {
|
|
951
|
+
ptr = ptr >>> 0;
|
|
952
|
+
const obj = Object.create(OutputModel.prototype);
|
|
953
|
+
obj.__wbg_ptr = ptr;
|
|
954
|
+
OutputModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
955
|
+
return obj;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
__destroy_into_raw() {
|
|
959
|
+
const ptr = this.__wbg_ptr;
|
|
960
|
+
this.__wbg_ptr = 0;
|
|
961
|
+
OutputModelFinalization.unregister(this);
|
|
962
|
+
return ptr;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
free() {
|
|
966
|
+
const ptr = this.__destroy_into_raw();
|
|
967
|
+
wasm.__wbg_outputmodel_free(ptr);
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* @returns {OutputModelKind}
|
|
971
|
+
*/
|
|
972
|
+
get kind() {
|
|
973
|
+
const ret = wasm.__wbg_get_outputmodel_kind(this.__wbg_ptr);
|
|
974
|
+
return ret;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* @param {OutputModelKind} arg0
|
|
978
|
+
*/
|
|
979
|
+
set kind(arg0) {
|
|
980
|
+
wasm.__wbg_set_outputmodel_kind(this.__wbg_ptr, arg0);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* @returns {(Location)[]}
|
|
984
|
+
*/
|
|
985
|
+
locations() {
|
|
986
|
+
try {
|
|
987
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
988
|
+
wasm.outputmodel_locations(retptr, this.__wbg_ptr);
|
|
989
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
990
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
991
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
992
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
993
|
+
return v1;
|
|
994
|
+
} finally {
|
|
995
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* @returns {(NextInputModel)[]}
|
|
1000
|
+
*/
|
|
1001
|
+
next_inputs() {
|
|
1002
|
+
try {
|
|
1003
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1004
|
+
wasm.outputmodel_next_inputs(retptr, this.__wbg_ptr);
|
|
1005
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1006
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1007
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1008
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1009
|
+
return v1;
|
|
1010
|
+
} finally {
|
|
1011
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* @returns {(EventModel)[]}
|
|
1016
|
+
*/
|
|
1017
|
+
events() {
|
|
1018
|
+
try {
|
|
1019
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1020
|
+
wasm.outputmodel_events(retptr, this.__wbg_ptr);
|
|
1021
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1022
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1023
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1024
|
+
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
1025
|
+
return v1;
|
|
1026
|
+
} finally {
|
|
1027
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* @returns {string}
|
|
1032
|
+
*/
|
|
1033
|
+
input_fen() {
|
|
1034
|
+
let deferred1_0;
|
|
1035
|
+
let deferred1_1;
|
|
1036
|
+
try {
|
|
1037
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1038
|
+
wasm.outputmodel_input_fen(retptr, this.__wbg_ptr);
|
|
1039
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
1040
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
1041
|
+
deferred1_0 = r0;
|
|
1042
|
+
deferred1_1 = r1;
|
|
1043
|
+
return getStringFromWasm0(r0, r1);
|
|
1044
|
+
} finally {
|
|
1045
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1046
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
const SquareModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1052
|
+
? { register: () => {}, unregister: () => {} }
|
|
1053
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_squaremodel_free(ptr >>> 0));
|
|
1054
|
+
/**
|
|
1055
|
+
*/
|
|
1056
|
+
export class SquareModel {
|
|
1057
|
+
|
|
1058
|
+
static __wrap(ptr) {
|
|
1059
|
+
ptr = ptr >>> 0;
|
|
1060
|
+
const obj = Object.create(SquareModel.prototype);
|
|
1061
|
+
obj.__wbg_ptr = ptr;
|
|
1062
|
+
SquareModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1063
|
+
return obj;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
__destroy_into_raw() {
|
|
1067
|
+
const ptr = this.__wbg_ptr;
|
|
1068
|
+
this.__wbg_ptr = 0;
|
|
1069
|
+
SquareModelFinalization.unregister(this);
|
|
1070
|
+
return ptr;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
free() {
|
|
1074
|
+
const ptr = this.__destroy_into_raw();
|
|
1075
|
+
wasm.__wbg_squaremodel_free(ptr);
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* @returns {SquareModelKind}
|
|
1079
|
+
*/
|
|
1080
|
+
get kind() {
|
|
1081
|
+
const ret = wasm.__wbg_get_squaremodel_kind(this.__wbg_ptr);
|
|
1082
|
+
return ret;
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* @param {SquareModelKind} arg0
|
|
1086
|
+
*/
|
|
1087
|
+
set kind(arg0) {
|
|
1088
|
+
wasm.__wbg_set_squaremodel_kind(this.__wbg_ptr, arg0);
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* @returns {Color | undefined}
|
|
1092
|
+
*/
|
|
1093
|
+
get color() {
|
|
1094
|
+
const ret = wasm.__wbg_get_squaremodel_color(this.__wbg_ptr);
|
|
1095
|
+
return ret === 2 ? undefined : ret;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* @param {Color | undefined} [arg0]
|
|
1099
|
+
*/
|
|
1100
|
+
set color(arg0) {
|
|
1101
|
+
wasm.__wbg_set_squaremodel_color(this.__wbg_ptr, isLikeNone(arg0) ? 2 : arg0);
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* @returns {MonKind | undefined}
|
|
1105
|
+
*/
|
|
1106
|
+
get mon_kind() {
|
|
1107
|
+
const ret = wasm.__wbg_get_squaremodel_mon_kind(this.__wbg_ptr);
|
|
1108
|
+
return ret === 5 ? undefined : ret;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* @param {MonKind | undefined} [arg0]
|
|
1112
|
+
*/
|
|
1113
|
+
set mon_kind(arg0) {
|
|
1114
|
+
wasm.__wbg_set_squaremodel_mon_kind(this.__wbg_ptr, isLikeNone(arg0) ? 5 : arg0);
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
async function __wbg_load(module, imports) {
|
|
1119
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1120
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1121
|
+
try {
|
|
1122
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1123
|
+
|
|
1124
|
+
} catch (e) {
|
|
1125
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
1126
|
+
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);
|
|
1127
|
+
|
|
1128
|
+
} else {
|
|
1129
|
+
throw e;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
const bytes = await module.arrayBuffer();
|
|
1135
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1136
|
+
|
|
1137
|
+
} else {
|
|
1138
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1139
|
+
|
|
1140
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1141
|
+
return { instance, module };
|
|
1142
|
+
|
|
1143
|
+
} else {
|
|
1144
|
+
return instance;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function __wbg_get_imports() {
|
|
1150
|
+
const imports = {};
|
|
1151
|
+
imports.wbg = {};
|
|
1152
|
+
imports.wbg.__wbg_location_new = function(arg0) {
|
|
1153
|
+
const ret = Location.__wrap(arg0);
|
|
1154
|
+
return addHeapObject(ret);
|
|
1155
|
+
};
|
|
1156
|
+
imports.wbg.__wbg_nextinputmodel_new = function(arg0) {
|
|
1157
|
+
const ret = NextInputModel.__wrap(arg0);
|
|
1158
|
+
return addHeapObject(ret);
|
|
1159
|
+
};
|
|
1160
|
+
imports.wbg.__wbg_eventmodel_new = function(arg0) {
|
|
1161
|
+
const ret = EventModel.__wrap(arg0);
|
|
1162
|
+
return addHeapObject(ret);
|
|
1163
|
+
};
|
|
1164
|
+
imports.wbg.__wbg_location_unwrap = function(arg0) {
|
|
1165
|
+
const ret = Location.__unwrap(takeObject(arg0));
|
|
1166
|
+
return ret;
|
|
1167
|
+
};
|
|
1168
|
+
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
1169
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
return imports;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
function __wbg_init_memory(imports, maybe_memory) {
|
|
1176
|
+
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function __wbg_finalize_init(instance, module) {
|
|
1180
|
+
wasm = instance.exports;
|
|
1181
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
1182
|
+
cachedInt32Memory0 = null;
|
|
1183
|
+
cachedUint32Memory0 = null;
|
|
1184
|
+
cachedUint8Memory0 = null;
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
return wasm;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
function initSync(module) {
|
|
1191
|
+
if (wasm !== undefined) return wasm;
|
|
1192
|
+
|
|
1193
|
+
const imports = __wbg_get_imports();
|
|
1194
|
+
|
|
1195
|
+
__wbg_init_memory(imports);
|
|
1196
|
+
|
|
1197
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1198
|
+
module = new WebAssembly.Module(module);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1202
|
+
|
|
1203
|
+
return __wbg_finalize_init(instance, module);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
async function __wbg_init(input) {
|
|
1207
|
+
if (wasm !== undefined) return wasm;
|
|
1208
|
+
|
|
1209
|
+
if (typeof input === 'undefined') {
|
|
1210
|
+
input = new URL('mons-web_bg.wasm', import.meta.url);
|
|
1211
|
+
}
|
|
1212
|
+
const imports = __wbg_get_imports();
|
|
1213
|
+
|
|
1214
|
+
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
1215
|
+
input = fetch(input);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
__wbg_init_memory(imports);
|
|
1219
|
+
|
|
1220
|
+
const { instance, module } = await __wbg_load(await input, imports);
|
|
1221
|
+
|
|
1222
|
+
return __wbg_finalize_init(instance, module);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export { initSync }
|
|
1226
|
+
export default __wbg_init;
|