alpathfinder 0.3.0 → 0.4.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/alpathfinder.d.ts CHANGED
@@ -4,33 +4,32 @@
4
4
  import type { GData, MapKey } from "typed-adventureland";
5
5
 
6
6
  export interface PathNode {
7
- map: MapKey;
8
- x: number;
9
- y: number;
10
- method: "move" | "town" | "door" | "transport" | "enter" | "leave" | "unknown";
11
- spawn?: number;
7
+ map: MapKey;
8
+ x: number;
9
+ y: number;
10
+ method: "move" | "town" | "door" | "transport" | "enter" | "leave" | "unknown";
11
+ spawn?: number;
12
12
  }
13
13
 
14
14
  export function canWalkPath(
15
- map: MapKey,
16
- x_from: number,
17
- y_from: number,
18
- x_to: number,
19
- y_to: number,
15
+ map: MapKey,
16
+ x_from: number,
17
+ y_from: number,
18
+ x_to: number,
19
+ y_to: number,
20
20
  ): boolean;
21
21
 
22
22
  export function getPath(
23
- map_from: MapKey,
24
- x_from: number,
25
- y_from: number,
26
- map_to: MapKey,
27
- x_to: number,
28
- y_to: number,
29
- /** How fast your character can walk. Setting this to a very high number can also reduce the number of town warps. */
30
- speed?: number,
23
+ map_from: MapKey,
24
+ x_from: number,
25
+ y_from: number,
26
+ map_to: MapKey,
27
+ x_to: number,
28
+ y_to: number,
29
+ /** How fast your character can walk. Setting this to a very high number can also reduce the number of town warps. */
30
+ speed?: number,
31
31
  ): PathNode[] | null;
32
32
 
33
33
  export function isWalkable(map: MapKey, x: number, y: number): boolean;
34
34
 
35
35
  export function prepare(g: GData, exclude_maps?: MapKey[]): void;
36
-
package/alpathfinder.js CHANGED
@@ -1,5 +1,9 @@
1
+ /* @ts-self-types="./alpathfinder.d.ts" */
1
2
  import * as wasm from "./alpathfinder_bg.wasm";
2
- export * from "./alpathfinder_bg.js";
3
3
  import { __wbg_set_wasm } from "./alpathfinder_bg.js";
4
+
4
5
  __wbg_set_wasm(wasm);
5
6
  wasm.__wbindgen_start();
7
+ export {
8
+ canWalkPath, clear, getPath, isWalkable, prepare
9
+ } from "./alpathfinder_bg.js";
@@ -1,203 +1,22 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
-
7
- let cachedUint8ArrayMemory0 = null;
8
-
9
- function getUint8ArrayMemory0() {
10
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
- }
13
- return cachedUint8ArrayMemory0;
14
- }
15
-
16
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
17
-
18
- cachedTextDecoder.decode();
19
-
20
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
21
- let numBytesDecoded = 0;
22
- function decodeText(ptr, len) {
23
- numBytesDecoded += len;
24
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
25
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
26
- cachedTextDecoder.decode();
27
- numBytesDecoded = len;
28
- }
29
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
30
- }
31
-
32
- function getStringFromWasm0(ptr, len) {
33
- ptr = ptr >>> 0;
34
- return decodeText(ptr, len);
35
- }
36
-
37
- function isLikeNone(x) {
38
- return x === undefined || x === null;
39
- }
40
-
41
- let cachedDataViewMemory0 = null;
42
-
43
- function getDataViewMemory0() {
44
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
45
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
46
- }
47
- return cachedDataViewMemory0;
48
- }
49
-
50
- function debugString(val) {
51
- // primitive types
52
- const type = typeof val;
53
- if (type == 'number' || type == 'boolean' || val == null) {
54
- return `${val}`;
55
- }
56
- if (type == 'string') {
57
- return `"${val}"`;
58
- }
59
- if (type == 'symbol') {
60
- const description = val.description;
61
- if (description == null) {
62
- return 'Symbol';
63
- } else {
64
- return `Symbol(${description})`;
65
- }
66
- }
67
- if (type == 'function') {
68
- const name = val.name;
69
- if (typeof name == 'string' && name.length > 0) {
70
- return `Function(${name})`;
71
- } else {
72
- return 'Function';
73
- }
74
- }
75
- // objects
76
- if (Array.isArray(val)) {
77
- const length = val.length;
78
- let debug = '[';
79
- if (length > 0) {
80
- debug += debugString(val[0]);
81
- }
82
- for(let i = 1; i < length; i++) {
83
- debug += ', ' + debugString(val[i]);
84
- }
85
- debug += ']';
86
- return debug;
87
- }
88
- // Test for built-in
89
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
90
- let className;
91
- if (builtInMatches && builtInMatches.length > 1) {
92
- className = builtInMatches[1];
93
- } else {
94
- // Failed to match the standard '[object ClassName]'
95
- return toString.call(val);
96
- }
97
- if (className == 'Object') {
98
- // we're a user defined class or Object
99
- // JSON.stringify avoids problems with cycles, and is generally much
100
- // easier than looping through ownProperties of `val`.
101
- try {
102
- return 'Object(' + JSON.stringify(val) + ')';
103
- } catch (_) {
104
- return 'Object';
105
- }
106
- }
107
- // errors
108
- if (val instanceof Error) {
109
- return `${val.name}: ${val.message}\n${val.stack}`;
110
- }
111
- // TODO we could test for more things here, like `Set`s and `Map`s.
112
- return className;
113
- }
114
-
115
- let WASM_VECTOR_LEN = 0;
116
-
117
- const cachedTextEncoder = new TextEncoder();
118
-
119
- if (!('encodeInto' in cachedTextEncoder)) {
120
- cachedTextEncoder.encodeInto = function (arg, view) {
121
- const buf = cachedTextEncoder.encode(arg);
122
- view.set(buf);
123
- return {
124
- read: arg.length,
125
- written: buf.length
126
- };
127
- }
128
- }
129
-
130
- function passStringToWasm0(arg, malloc, realloc) {
131
-
132
- if (realloc === undefined) {
133
- const buf = cachedTextEncoder.encode(arg);
134
- const ptr = malloc(buf.length, 1) >>> 0;
135
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
136
- WASM_VECTOR_LEN = buf.length;
137
- return ptr;
138
- }
139
-
140
- let len = arg.length;
141
- let ptr = malloc(len, 1) >>> 0;
142
-
143
- const mem = getUint8ArrayMemory0();
144
-
145
- let offset = 0;
146
-
147
- for (; offset < len; offset++) {
148
- const code = arg.charCodeAt(offset);
149
- if (code > 0x7F) break;
150
- mem[ptr + offset] = code;
151
- }
152
-
153
- if (offset !== len) {
154
- if (offset !== 0) {
155
- arg = arg.slice(offset);
156
- }
157
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
158
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
159
- const ret = cachedTextEncoder.encodeInto(arg, view);
160
-
161
- offset += ret.written;
162
- ptr = realloc(ptr, len, offset, 1) >>> 0;
163
- }
164
-
165
- WASM_VECTOR_LEN = offset;
166
- return ptr;
167
- }
168
-
169
- function addToExternrefTable0(obj) {
170
- const idx = wasm.__externref_table_alloc();
171
- wasm.__wbindgen_externrefs.set(idx, obj);
172
- return idx;
173
- }
174
-
175
- function handleError(f, args) {
176
- try {
177
- return f.apply(this, args);
178
- } catch (e) {
179
- const idx = addToExternrefTable0(e);
180
- wasm.__wbindgen_exn_store(idx);
181
- }
182
- }
183
-
184
- function getArrayU8FromWasm0(ptr, len) {
185
- ptr = ptr >>> 0;
186
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
187
- }
188
1
  /**
189
2
  * @param {string} map_name
190
- * @param {number} x_i
191
- * @param {number} y_i
3
+ * @param {number} x1
4
+ * @param {number} y1
5
+ * @param {number} x2
6
+ * @param {number} y2
192
7
  * @returns {boolean}
193
8
  */
194
- export function isWalkable(map_name, x_i, y_i) {
9
+ export function canWalkPath(map_name, x1, y1, x2, y2) {
195
10
  const ptr0 = passStringToWasm0(map_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
196
11
  const len0 = WASM_VECTOR_LEN;
197
- const ret = wasm.isWalkable(ptr0, len0, x_i, y_i);
12
+ const ret = wasm.canWalkPath(ptr0, len0, x1, y1, x2, y2);
198
13
  return ret !== 0;
199
14
  }
200
15
 
16
+ export function clear() {
17
+ wasm.clear();
18
+ }
19
+
201
20
  /**
202
21
  * @param {string} map_from_name
203
22
  * @param {number} x_from
@@ -213,22 +32,20 @@ export function getPath(map_from_name, x_from, y_from, map_to_name, x_to, y_to,
213
32
  const len0 = WASM_VECTOR_LEN;
214
33
  const ptr1 = passStringToWasm0(map_to_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
215
34
  const len1 = WASM_VECTOR_LEN;
216
- const ret = wasm.getPath(ptr0, len0, x_from, y_from, ptr1, len1, x_to, y_to, isLikeNone(speed) ? 0x100000001 : Math.fround(speed));
35
+ const ret = wasm.getPath(ptr0, len0, x_from, y_from, ptr1, len1, x_to, y_to, isLikeNone(speed) ? Number.MAX_SAFE_INTEGER : Math.fround(speed));
217
36
  return ret;
218
37
  }
219
38
 
220
39
  /**
221
40
  * @param {string} map_name
222
- * @param {number} x1
223
- * @param {number} y1
224
- * @param {number} x2
225
- * @param {number} y2
41
+ * @param {number} x
42
+ * @param {number} y
226
43
  * @returns {boolean}
227
44
  */
228
- export function canWalkPath(map_name, x1, y1, x2, y2) {
45
+ export function isWalkable(map_name, x, y) {
229
46
  const ptr0 = passStringToWasm0(map_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
47
  const len0 = WASM_VECTOR_LEN;
231
- const ret = wasm.canWalkPath(ptr0, len0, x1, y1, x2, y2);
48
+ const ret = wasm.isWalkable(ptr0, len0, x, y);
232
49
  return ret !== 0;
233
50
  }
234
51
 
@@ -239,125 +56,107 @@ export function canWalkPath(map_name, x1, y1, x2, y2) {
239
56
  export function prepare(g_js, exclude_maps) {
240
57
  wasm.prepare(g_js, isLikeNone(exclude_maps) ? 0 : addToExternrefTable0(exclude_maps));
241
58
  }
242
-
243
- export function __wbg_Error_e83987f665cf5504(arg0, arg1) {
59
+ export function __wbg_Error_3639a60ed15f87e7(arg0, arg1) {
244
60
  const ret = Error(getStringFromWasm0(arg0, arg1));
245
61
  return ret;
246
- };
247
-
248
- export function __wbg_Number_bb48ca12f395cd08(arg0) {
62
+ }
63
+ export function __wbg_Number_a3d737fd183f7dca(arg0) {
249
64
  const ret = Number(arg0);
250
65
  return ret;
251
- };
252
-
253
- export function __wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd(arg0, arg1) {
66
+ }
67
+ export function __wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b(arg0, arg1) {
254
68
  const v = arg1;
255
69
  const ret = typeof(v) === 'bigint' ? v : undefined;
256
70
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
257
71
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
258
- };
259
-
260
- export function __wbg___wbindgen_boolean_get_6d5a1ee65bab5f68(arg0) {
72
+ }
73
+ export function __wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b(arg0) {
261
74
  const v = arg0;
262
75
  const ret = typeof(v) === 'boolean' ? v : undefined;
263
76
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
264
- };
265
-
266
- export function __wbg___wbindgen_debug_string_df47ffb5e35e6763(arg0, arg1) {
77
+ }
78
+ export function __wbg___wbindgen_debug_string_07cb72cfcc952e2b(arg0, arg1) {
267
79
  const ret = debugString(arg1);
268
80
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
81
  const len1 = WASM_VECTOR_LEN;
270
82
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
271
83
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
272
- };
273
-
274
- export function __wbg___wbindgen_in_bb933bd9e1b3bc0f(arg0, arg1) {
84
+ }
85
+ export function __wbg___wbindgen_in_2617fa76397620d3(arg0, arg1) {
275
86
  const ret = arg0 in arg1;
276
87
  return ret;
277
- };
278
-
279
- export function __wbg___wbindgen_is_bigint_cb320707dcd35f0b(arg0) {
88
+ }
89
+ export function __wbg___wbindgen_is_bigint_d6a8167cac401b95(arg0) {
280
90
  const ret = typeof(arg0) === 'bigint';
281
91
  return ret;
282
- };
283
-
284
- export function __wbg___wbindgen_is_function_ee8a6c5833c90377(arg0) {
92
+ }
93
+ export function __wbg___wbindgen_is_function_2f0fd7ceb86e64c5(arg0) {
285
94
  const ret = typeof(arg0) === 'function';
286
95
  return ret;
287
- };
288
-
289
- export function __wbg___wbindgen_is_object_c818261d21f283a4(arg0) {
96
+ }
97
+ export function __wbg___wbindgen_is_object_5b22ff2418063a9c(arg0) {
290
98
  const val = arg0;
291
99
  const ret = typeof(val) === 'object' && val !== null;
292
100
  return ret;
293
- };
294
-
295
- export function __wbg___wbindgen_is_undefined_2d472862bd29a478(arg0) {
101
+ }
102
+ export function __wbg___wbindgen_is_undefined_244a92c34d3b6ec0(arg0) {
296
103
  const ret = arg0 === undefined;
297
104
  return ret;
298
- };
299
-
300
- export function __wbg___wbindgen_jsval_eq_6b13ab83478b1c50(arg0, arg1) {
105
+ }
106
+ export function __wbg___wbindgen_jsval_eq_403eaa3610500a25(arg0, arg1) {
301
107
  const ret = arg0 === arg1;
302
108
  return ret;
303
- };
304
-
305
- export function __wbg___wbindgen_jsval_loose_eq_b664b38a2f582147(arg0, arg1) {
109
+ }
110
+ export function __wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62(arg0, arg1) {
306
111
  const ret = arg0 == arg1;
307
112
  return ret;
308
- };
309
-
310
- export function __wbg___wbindgen_number_get_a20bf9b85341449d(arg0, arg1) {
113
+ }
114
+ export function __wbg___wbindgen_number_get_dd6d69a6079f26f1(arg0, arg1) {
311
115
  const obj = arg1;
312
116
  const ret = typeof(obj) === 'number' ? obj : undefined;
313
117
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
314
118
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
315
- };
316
-
317
- export function __wbg___wbindgen_string_get_e4f06c90489ad01b(arg0, arg1) {
119
+ }
120
+ export function __wbg___wbindgen_string_get_965592073e5d848c(arg0, arg1) {
318
121
  const obj = arg1;
319
122
  const ret = typeof(obj) === 'string' ? obj : undefined;
320
123
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
124
  var len1 = WASM_VECTOR_LEN;
322
125
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
323
126
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
324
- };
325
-
326
- export function __wbg___wbindgen_throw_b855445ff6a94295(arg0, arg1) {
127
+ }
128
+ export function __wbg___wbindgen_throw_9c75d47bf9e7731e(arg0, arg1) {
327
129
  throw new Error(getStringFromWasm0(arg0, arg1));
328
- };
329
-
330
- export function __wbg_call_e762c39fa8ea36bf() { return handleError(function (arg0, arg1) {
130
+ }
131
+ export function __wbg_call_add9e5a76382e668() { return handleError(function (arg0, arg1) {
331
132
  const ret = arg0.call(arg1);
332
133
  return ret;
333
- }, arguments) };
334
-
335
- export function __wbg_done_2042aa2670fb1db1(arg0) {
134
+ }, arguments); }
135
+ export function __wbg_done_b1afd6201ac045e0(arg0) {
336
136
  const ret = arg0.done;
337
137
  return ret;
338
- };
339
-
340
- export function __wbg_entries_e171b586f8f6bdbf(arg0) {
138
+ }
139
+ export function __wbg_entries_bb9843ba73dc70d6(arg0) {
341
140
  const ret = Object.entries(arg0);
342
141
  return ret;
343
- };
344
-
345
- export function __wbg_get_7bed016f185add81(arg0, arg1) {
142
+ }
143
+ export function __wbg_get_652f640b3b0b6e3e(arg0, arg1) {
346
144
  const ret = arg0[arg1 >>> 0];
347
145
  return ret;
348
- };
349
-
350
- export function __wbg_get_efcb449f58ec27c2() { return handleError(function (arg0, arg1) {
146
+ }
147
+ export function __wbg_get_9cfea9b7bbf12a15() { return handleError(function (arg0, arg1) {
351
148
  const ret = Reflect.get(arg0, arg1);
352
149
  return ret;
353
- }, arguments) };
354
-
355
- export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
150
+ }, arguments); }
151
+ export function __wbg_get_unchecked_be562b1421656321(arg0, arg1) {
152
+ const ret = arg0[arg1 >>> 0];
153
+ return ret;
154
+ }
155
+ export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
356
156
  const ret = arg0[arg1];
357
157
  return ret;
358
- };
359
-
360
- export function __wbg_instanceof_ArrayBuffer_70beb1189ca63b38(arg0) {
158
+ }
159
+ export function __wbg_instanceof_ArrayBuffer_eab9f28fbec23477(arg0) {
361
160
  let result;
362
161
  try {
363
162
  result = arg0 instanceof ArrayBuffer;
@@ -366,9 +165,8 @@ export function __wbg_instanceof_ArrayBuffer_70beb1189ca63b38(arg0) {
366
165
  }
367
166
  const ret = result;
368
167
  return ret;
369
- };
370
-
371
- export function __wbg_instanceof_Map_8579b5e2ab5437c7(arg0) {
168
+ }
169
+ export function __wbg_instanceof_Map_10d4edf60fcf9327(arg0) {
372
170
  let result;
373
171
  try {
374
172
  result = arg0 instanceof Map;
@@ -377,9 +175,8 @@ export function __wbg_instanceof_Map_8579b5e2ab5437c7(arg0) {
377
175
  }
378
176
  const ret = result;
379
177
  return ret;
380
- };
381
-
382
- export function __wbg_instanceof_Uint8Array_20c8e73002f7af98(arg0) {
178
+ }
179
+ export function __wbg_instanceof_Uint8Array_57d77acd50e4c44d(arg0) {
383
180
  let result;
384
181
  try {
385
182
  result = arg0 instanceof Uint8Array;
@@ -388,99 +185,80 @@ export function __wbg_instanceof_Uint8Array_20c8e73002f7af98(arg0) {
388
185
  }
389
186
  const ret = result;
390
187
  return ret;
391
- };
392
-
393
- export function __wbg_isArray_96e0af9891d0945d(arg0) {
188
+ }
189
+ export function __wbg_isArray_c6c6ef8308995bcf(arg0) {
394
190
  const ret = Array.isArray(arg0);
395
191
  return ret;
396
- };
397
-
398
- export function __wbg_isSafeInteger_d216eda7911dde36(arg0) {
192
+ }
193
+ export function __wbg_isSafeInteger_3c56c421a5b4cce4(arg0) {
399
194
  const ret = Number.isSafeInteger(arg0);
400
195
  return ret;
401
- };
402
-
403
- export function __wbg_iterator_e5822695327a3c39() {
196
+ }
197
+ export function __wbg_iterator_9d68985a1d096fc2() {
404
198
  const ret = Symbol.iterator;
405
199
  return ret;
406
- };
407
-
408
- export function __wbg_length_69bca3cb64fc8748(arg0) {
200
+ }
201
+ export function __wbg_length_0a6ce016dc1460b0(arg0) {
409
202
  const ret = arg0.length;
410
203
  return ret;
411
- };
412
-
413
- export function __wbg_length_cdd215e10d9dd507(arg0) {
204
+ }
205
+ export function __wbg_length_ba3c032602efe310(arg0) {
414
206
  const ret = arg0.length;
415
207
  return ret;
416
- };
417
-
418
- export function __wbg_new_1acc0b6eea89d040() {
208
+ }
209
+ export function __wbg_new_2fad8ca02fd00684() {
419
210
  const ret = new Object();
420
211
  return ret;
421
- };
422
-
423
- export function __wbg_new_5a79be3ab53b8aa5(arg0) {
424
- const ret = new Uint8Array(arg0);
425
- return ret;
426
- };
427
-
428
- export function __wbg_new_e17d9f43105b08be() {
212
+ }
213
+ export function __wbg_new_3baa8d9866155c79() {
429
214
  const ret = new Array();
430
215
  return ret;
431
- };
432
-
433
- export function __wbg_next_020810e0ae8ebcb0() { return handleError(function (arg0) {
434
- const ret = arg0.next();
216
+ }
217
+ export function __wbg_new_8454eee672b2ba6e(arg0) {
218
+ const ret = new Uint8Array(arg0);
435
219
  return ret;
436
- }, arguments) };
437
-
438
- export function __wbg_next_2c826fe5dfec6b6a(arg0) {
220
+ }
221
+ export function __wbg_next_261c3c48c6e309a5(arg0) {
439
222
  const ret = arg0.next;
440
223
  return ret;
441
- };
442
-
443
- export function __wbg_prototypesetcall_2a6620b6922694b2(arg0, arg1, arg2) {
224
+ }
225
+ export function __wbg_next_aacee310bcfe6461() { return handleError(function (arg0) {
226
+ const ret = arg0.next();
227
+ return ret;
228
+ }, arguments); }
229
+ export function __wbg_prototypesetcall_fd4050e806e1d519(arg0, arg1, arg2) {
444
230
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
445
- };
446
-
447
- export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
231
+ }
232
+ export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
448
233
  arg0[arg1] = arg2;
449
- };
450
-
451
- export function __wbg_set_c213c871859d6500(arg0, arg1, arg2) {
234
+ }
235
+ export function __wbg_set_f614f6a0608d1d1d(arg0, arg1, arg2) {
452
236
  arg0[arg1 >>> 0] = arg2;
453
- };
454
-
455
- export function __wbg_value_692627309814bb8c(arg0) {
237
+ }
238
+ export function __wbg_value_f852716acdeb3e82(arg0) {
456
239
  const ret = arg0.value;
457
240
  return ret;
458
- };
459
-
460
- export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
241
+ }
242
+ export function __wbindgen_cast_0000000000000001(arg0) {
243
+ // Cast intrinsic for `F64 -> Externref`.
244
+ const ret = arg0;
245
+ return ret;
246
+ }
247
+ export function __wbindgen_cast_0000000000000002(arg0) {
248
+ // Cast intrinsic for `I64 -> Externref`.
249
+ const ret = arg0;
250
+ return ret;
251
+ }
252
+ export function __wbindgen_cast_0000000000000003(arg0, arg1) {
461
253
  // Cast intrinsic for `Ref(String) -> Externref`.
462
254
  const ret = getStringFromWasm0(arg0, arg1);
463
255
  return ret;
464
- };
465
-
466
- export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
256
+ }
257
+ export function __wbindgen_cast_0000000000000004(arg0) {
467
258
  // Cast intrinsic for `U64 -> Externref`.
468
259
  const ret = BigInt.asUintN(64, arg0);
469
260
  return ret;
470
- };
471
-
472
- export function __wbindgen_cast_9ae0607507abb057(arg0) {
473
- // Cast intrinsic for `I64 -> Externref`.
474
- const ret = arg0;
475
- return ret;
476
- };
477
-
478
- export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
479
- // Cast intrinsic for `F64 -> Externref`.
480
- const ret = arg0;
481
- return ret;
482
- };
483
-
261
+ }
484
262
  export function __wbindgen_init_externref_table() {
485
263
  const table = wasm.__wbindgen_externrefs;
486
264
  const offset = table.grow(4);
@@ -489,11 +267,184 @@ export function __wbindgen_init_externref_table() {
489
267
  table.set(offset + 1, null);
490
268
  table.set(offset + 2, true);
491
269
  table.set(offset + 3, false);
492
- ;
493
- };
270
+ }
271
+ function addToExternrefTable0(obj) {
272
+ const idx = wasm.__externref_table_alloc();
273
+ wasm.__wbindgen_externrefs.set(idx, obj);
274
+ return idx;
275
+ }
494
276
 
495
- export function __wbindgen_object_is_undefined(arg0) {
496
- const ret = arg0 === undefined;
497
- return ret;
498
- };
277
+ function debugString(val) {
278
+ // primitive types
279
+ const type = typeof val;
280
+ if (type == 'number' || type == 'boolean' || val == null) {
281
+ return `${val}`;
282
+ }
283
+ if (type == 'string') {
284
+ return `"${val}"`;
285
+ }
286
+ if (type == 'symbol') {
287
+ const description = val.description;
288
+ if (description == null) {
289
+ return 'Symbol';
290
+ } else {
291
+ return `Symbol(${description})`;
292
+ }
293
+ }
294
+ if (type == 'function') {
295
+ const name = val.name;
296
+ if (typeof name == 'string' && name.length > 0) {
297
+ return `Function(${name})`;
298
+ } else {
299
+ return 'Function';
300
+ }
301
+ }
302
+ // objects
303
+ if (Array.isArray(val)) {
304
+ const length = val.length;
305
+ let debug = '[';
306
+ if (length > 0) {
307
+ debug += debugString(val[0]);
308
+ }
309
+ for(let i = 1; i < length; i++) {
310
+ debug += ', ' + debugString(val[i]);
311
+ }
312
+ debug += ']';
313
+ return debug;
314
+ }
315
+ // Test for built-in
316
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
317
+ let className;
318
+ if (builtInMatches && builtInMatches.length > 1) {
319
+ className = builtInMatches[1];
320
+ } else {
321
+ // Failed to match the standard '[object ClassName]'
322
+ return toString.call(val);
323
+ }
324
+ if (className == 'Object') {
325
+ // we're a user defined class or Object
326
+ // JSON.stringify avoids problems with cycles, and is generally much
327
+ // easier than looping through ownProperties of `val`.
328
+ try {
329
+ return 'Object(' + JSON.stringify(val) + ')';
330
+ } catch (_) {
331
+ return 'Object';
332
+ }
333
+ }
334
+ // errors
335
+ if (val instanceof Error) {
336
+ return `${val.name}: ${val.message}\n${val.stack}`;
337
+ }
338
+ // TODO we could test for more things here, like `Set`s and `Map`s.
339
+ return className;
340
+ }
341
+
342
+ function getArrayU8FromWasm0(ptr, len) {
343
+ ptr = ptr >>> 0;
344
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
345
+ }
346
+
347
+ let cachedDataViewMemory0 = null;
348
+ function getDataViewMemory0() {
349
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
350
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
351
+ }
352
+ return cachedDataViewMemory0;
353
+ }
354
+
355
+ function getStringFromWasm0(ptr, len) {
356
+ return decodeText(ptr >>> 0, len);
357
+ }
358
+
359
+ let cachedUint8ArrayMemory0 = null;
360
+ function getUint8ArrayMemory0() {
361
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
362
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
363
+ }
364
+ return cachedUint8ArrayMemory0;
365
+ }
366
+
367
+ function handleError(f, args) {
368
+ try {
369
+ return f.apply(this, args);
370
+ } catch (e) {
371
+ const idx = addToExternrefTable0(e);
372
+ wasm.__wbindgen_exn_store(idx);
373
+ }
374
+ }
375
+
376
+ function isLikeNone(x) {
377
+ return x === undefined || x === null;
378
+ }
379
+
380
+ function passStringToWasm0(arg, malloc, realloc) {
381
+ if (realloc === undefined) {
382
+ const buf = cachedTextEncoder.encode(arg);
383
+ const ptr = malloc(buf.length, 1) >>> 0;
384
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
385
+ WASM_VECTOR_LEN = buf.length;
386
+ return ptr;
387
+ }
388
+
389
+ let len = arg.length;
390
+ let ptr = malloc(len, 1) >>> 0;
391
+
392
+ const mem = getUint8ArrayMemory0();
393
+
394
+ let offset = 0;
395
+
396
+ for (; offset < len; offset++) {
397
+ const code = arg.charCodeAt(offset);
398
+ if (code > 0x7F) break;
399
+ mem[ptr + offset] = code;
400
+ }
401
+ if (offset !== len) {
402
+ if (offset !== 0) {
403
+ arg = arg.slice(offset);
404
+ }
405
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
406
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
407
+ const ret = cachedTextEncoder.encodeInto(arg, view);
408
+
409
+ offset += ret.written;
410
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
411
+ }
412
+
413
+ WASM_VECTOR_LEN = offset;
414
+ return ptr;
415
+ }
416
+
417
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
418
+ cachedTextDecoder.decode();
419
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
420
+ let numBytesDecoded = 0;
421
+ function decodeText(ptr, len) {
422
+ numBytesDecoded += len;
423
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
424
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
425
+ cachedTextDecoder.decode();
426
+ numBytesDecoded = len;
427
+ }
428
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
429
+ }
430
+
431
+ const cachedTextEncoder = new TextEncoder();
432
+
433
+ if (!('encodeInto' in cachedTextEncoder)) {
434
+ cachedTextEncoder.encodeInto = function (arg, view) {
435
+ const buf = cachedTextEncoder.encode(arg);
436
+ view.set(buf);
437
+ return {
438
+ read: arg.length,
439
+ written: buf.length
440
+ };
441
+ };
442
+ }
499
443
 
444
+ let WASM_VECTOR_LEN = 0;
445
+
446
+
447
+ let wasm;
448
+ export function __wbg_set_wasm(val) {
449
+ wasm = val;
450
+ }
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "collaborators": [
5
5
  "Kent Rasmussen <hyprkookeez@gmail.com>"
6
6
  ],
7
- "version": "0.3.0",
7
+ "version": "0.4.0",
8
8
  "files": [
9
9
  "alpathfinder_bg.wasm",
10
10
  "alpathfinder.js",
@@ -18,6 +18,6 @@
18
18
  "./snippets/*"
19
19
  ],
20
20
  "dependencies": {
21
- "typed-adventureland": "^0.0.54"
21
+ "typed-adventureland": "^0.0.55"
22
22
  }
23
- }
23
+ }