egraph 5.0.0 → 6.0.0-alpha.1
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/dist/bundler/LICENSE +21 -0
- package/dist/bundler/README.md +161 -0
- package/dist/no-modules/LICENSE +21 -0
- package/dist/no-modules/README.md +161 -0
- package/dist/nodejs/LICENSE +21 -0
- package/dist/nodejs/README.md +161 -0
- package/dist/web/LICENSE +21 -0
- package/dist/web/README.md +161 -0
- package/package.json +1 -1
- package/dist/bundler/egraph_wasm.d.ts +0 -228
- package/dist/bundler/egraph_wasm.js +0 -2
- package/dist/bundler/egraph_wasm_bg.wasm +0 -0
- package/dist/no-modules/egraph_wasm.d.ts +0 -298
- package/dist/no-modules/egraph_wasm.js +0 -834
- package/dist/no-modules/egraph_wasm_bg.wasm +0 -0
- package/dist/nodejs/egraph_wasm.d.ts +0 -228
- package/dist/nodejs/egraph_wasm.js +0 -798
- package/dist/nodejs/egraph_wasm_bg.wasm +0 -0
- package/dist/web/egraph_wasm.d.ts +0 -298
- package/dist/web/egraph_wasm.js +0 -819
- package/dist/web/egraph_wasm_bg.wasm +0 -0
|
@@ -1,834 +0,0 @@
|
|
|
1
|
-
let wasm_bindgen;
|
|
2
|
-
(function() {
|
|
3
|
-
const __exports = {};
|
|
4
|
-
let wasm;
|
|
5
|
-
|
|
6
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
7
|
-
|
|
8
|
-
cachedTextDecoder.decode();
|
|
9
|
-
|
|
10
|
-
let cachegetUint8Memory0 = null;
|
|
11
|
-
function getUint8Memory0() {
|
|
12
|
-
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
|
13
|
-
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
-
}
|
|
15
|
-
return cachegetUint8Memory0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function getStringFromWasm0(ptr, len) {
|
|
19
|
-
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const heap = new Array(32).fill(undefined);
|
|
23
|
-
|
|
24
|
-
heap.push(undefined, null, true, false);
|
|
25
|
-
|
|
26
|
-
let heap_next = heap.length;
|
|
27
|
-
|
|
28
|
-
function addHeapObject(obj) {
|
|
29
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
30
|
-
const idx = heap_next;
|
|
31
|
-
heap_next = heap[idx];
|
|
32
|
-
|
|
33
|
-
heap[idx] = obj;
|
|
34
|
-
return idx;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getObject(idx) { return heap[idx]; }
|
|
38
|
-
|
|
39
|
-
function dropObject(idx) {
|
|
40
|
-
if (idx < 36) return;
|
|
41
|
-
heap[idx] = heap_next;
|
|
42
|
-
heap_next = idx;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function takeObject(idx) {
|
|
46
|
-
const ret = getObject(idx);
|
|
47
|
-
dropObject(idx);
|
|
48
|
-
return ret;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
let WASM_VECTOR_LEN = 0;
|
|
52
|
-
|
|
53
|
-
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
54
|
-
|
|
55
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
56
|
-
? function (arg, view) {
|
|
57
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
|
58
|
-
}
|
|
59
|
-
: function (arg, view) {
|
|
60
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
61
|
-
view.set(buf);
|
|
62
|
-
return {
|
|
63
|
-
read: arg.length,
|
|
64
|
-
written: buf.length
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
69
|
-
|
|
70
|
-
if (realloc === undefined) {
|
|
71
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
72
|
-
const ptr = malloc(buf.length);
|
|
73
|
-
getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
74
|
-
WASM_VECTOR_LEN = buf.length;
|
|
75
|
-
return ptr;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let len = arg.length;
|
|
79
|
-
let ptr = malloc(len);
|
|
80
|
-
|
|
81
|
-
const mem = getUint8Memory0();
|
|
82
|
-
|
|
83
|
-
let offset = 0;
|
|
84
|
-
|
|
85
|
-
for (; offset < len; offset++) {
|
|
86
|
-
const code = arg.charCodeAt(offset);
|
|
87
|
-
if (code > 0x7F) break;
|
|
88
|
-
mem[ptr + offset] = code;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (offset !== len) {
|
|
92
|
-
if (offset !== 0) {
|
|
93
|
-
arg = arg.slice(offset);
|
|
94
|
-
}
|
|
95
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3);
|
|
96
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
97
|
-
const ret = encodeString(arg, view);
|
|
98
|
-
|
|
99
|
-
offset += ret.written;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
WASM_VECTOR_LEN = offset;
|
|
103
|
-
return ptr;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
let cachegetInt32Memory0 = null;
|
|
107
|
-
function getInt32Memory0() {
|
|
108
|
-
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
|
109
|
-
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
110
|
-
}
|
|
111
|
-
return cachegetInt32Memory0;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function isLikeNone(x) {
|
|
115
|
-
return x === undefined || x === null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let cachegetFloat64Memory0 = null;
|
|
119
|
-
function getFloat64Memory0() {
|
|
120
|
-
if (cachegetFloat64Memory0 === null || cachegetFloat64Memory0.buffer !== wasm.memory.buffer) {
|
|
121
|
-
cachegetFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
122
|
-
}
|
|
123
|
-
return cachegetFloat64Memory0;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function debugString(val) {
|
|
127
|
-
// primitive types
|
|
128
|
-
const type = typeof val;
|
|
129
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
130
|
-
return `${val}`;
|
|
131
|
-
}
|
|
132
|
-
if (type == 'string') {
|
|
133
|
-
return `"${val}"`;
|
|
134
|
-
}
|
|
135
|
-
if (type == 'symbol') {
|
|
136
|
-
const description = val.description;
|
|
137
|
-
if (description == null) {
|
|
138
|
-
return 'Symbol';
|
|
139
|
-
} else {
|
|
140
|
-
return `Symbol(${description})`;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (type == 'function') {
|
|
144
|
-
const name = val.name;
|
|
145
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
146
|
-
return `Function(${name})`;
|
|
147
|
-
} else {
|
|
148
|
-
return 'Function';
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// objects
|
|
152
|
-
if (Array.isArray(val)) {
|
|
153
|
-
const length = val.length;
|
|
154
|
-
let debug = '[';
|
|
155
|
-
if (length > 0) {
|
|
156
|
-
debug += debugString(val[0]);
|
|
157
|
-
}
|
|
158
|
-
for(let i = 1; i < length; i++) {
|
|
159
|
-
debug += ', ' + debugString(val[i]);
|
|
160
|
-
}
|
|
161
|
-
debug += ']';
|
|
162
|
-
return debug;
|
|
163
|
-
}
|
|
164
|
-
// Test for built-in
|
|
165
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
166
|
-
let className;
|
|
167
|
-
if (builtInMatches.length > 1) {
|
|
168
|
-
className = builtInMatches[1];
|
|
169
|
-
} else {
|
|
170
|
-
// Failed to match the standard '[object ClassName]'
|
|
171
|
-
return toString.call(val);
|
|
172
|
-
}
|
|
173
|
-
if (className == 'Object') {
|
|
174
|
-
// we're a user defined class or Object
|
|
175
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
176
|
-
// easier than looping through ownProperties of `val`.
|
|
177
|
-
try {
|
|
178
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
179
|
-
} catch (_) {
|
|
180
|
-
return 'Object';
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// errors
|
|
184
|
-
if (val instanceof Error) {
|
|
185
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
186
|
-
}
|
|
187
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
188
|
-
return className;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function _assertClass(instance, klass) {
|
|
192
|
-
if (!(instance instanceof klass)) {
|
|
193
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
194
|
-
}
|
|
195
|
-
return instance.ptr;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* @param {Graph} graph
|
|
199
|
-
* @returns {any}
|
|
200
|
-
*/
|
|
201
|
-
__exports.initialPlacement = function(graph) {
|
|
202
|
-
_assertClass(graph, Graph);
|
|
203
|
-
var ret = wasm.initialPlacement(graph.ptr);
|
|
204
|
-
return takeObject(ret);
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* @param {Graph} graph
|
|
209
|
-
* @returns {Array<any>}
|
|
210
|
-
*/
|
|
211
|
-
__exports.forceConnected = function(graph) {
|
|
212
|
-
_assertClass(graph, Graph);
|
|
213
|
-
var ret = wasm.forceConnected(graph.ptr);
|
|
214
|
-
return takeObject(ret);
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @param {Graph} graph
|
|
219
|
-
* @returns {Array<any>}
|
|
220
|
-
*/
|
|
221
|
-
__exports.forceNonconnected = function(graph) {
|
|
222
|
-
_assertClass(graph, Graph);
|
|
223
|
-
var ret = wasm.forceNonconnected(graph.ptr);
|
|
224
|
-
return takeObject(ret);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
let stack_pointer = 32;
|
|
228
|
-
|
|
229
|
-
function addBorrowedObject(obj) {
|
|
230
|
-
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
231
|
-
heap[--stack_pointer] = obj;
|
|
232
|
-
return stack_pointer;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* @param {Graph} graph
|
|
236
|
-
* @param {Function} group_accessor
|
|
237
|
-
* @returns {Array<any>}
|
|
238
|
-
*/
|
|
239
|
-
__exports.forceGrouped = function(graph, group_accessor) {
|
|
240
|
-
try {
|
|
241
|
-
_assertClass(graph, Graph);
|
|
242
|
-
var ret = wasm.forceGrouped(graph.ptr, addBorrowedObject(group_accessor));
|
|
243
|
-
return takeObject(ret);
|
|
244
|
-
} finally {
|
|
245
|
-
heap[stack_pointer++] = undefined;
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
let cachegetUint32Memory0 = null;
|
|
250
|
-
function getUint32Memory0() {
|
|
251
|
-
if (cachegetUint32Memory0 === null || cachegetUint32Memory0.buffer !== wasm.memory.buffer) {
|
|
252
|
-
cachegetUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
253
|
-
}
|
|
254
|
-
return cachegetUint32Memory0;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
258
|
-
const ptr = malloc(array.length * 4);
|
|
259
|
-
const mem = getUint32Memory0();
|
|
260
|
-
for (let i = 0; i < array.length; i++) {
|
|
261
|
-
mem[ptr / 4 + i] = addHeapObject(array[i]);
|
|
262
|
-
}
|
|
263
|
-
WASM_VECTOR_LEN = array.length;
|
|
264
|
-
return ptr;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* @param {Graph} graph
|
|
268
|
-
* @param {any} coordinates
|
|
269
|
-
* @param {Function} _length
|
|
270
|
-
* @param {number} eps
|
|
271
|
-
* @param {number} width
|
|
272
|
-
* @param {number} height
|
|
273
|
-
* @returns {any}
|
|
274
|
-
*/
|
|
275
|
-
__exports.kamadaKawai = function(graph, coordinates, _length, eps, width, height) {
|
|
276
|
-
_assertClass(graph, Graph);
|
|
277
|
-
var ret = wasm.kamadaKawai(graph.ptr, addHeapObject(coordinates), addHeapObject(_length), eps, width, height);
|
|
278
|
-
return takeObject(ret);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* @param {Graph} graph
|
|
283
|
-
* @param {number} min_size
|
|
284
|
-
* @param {number} step_iteration
|
|
285
|
-
* @param {Function} _shrink_node
|
|
286
|
-
* @param {Function} _shrink_edge
|
|
287
|
-
* @param {Function} _link_distance_accessor
|
|
288
|
-
* @returns {any}
|
|
289
|
-
*/
|
|
290
|
-
__exports.fm3 = function(graph, min_size, step_iteration, _shrink_node, _shrink_edge, _link_distance_accessor) {
|
|
291
|
-
_assertClass(graph, Graph);
|
|
292
|
-
var ret = wasm.fm3(graph.ptr, min_size, step_iteration, addHeapObject(_shrink_node), addHeapObject(_shrink_edge), addHeapObject(_link_distance_accessor));
|
|
293
|
-
return takeObject(ret);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* @param {Graph} graph
|
|
298
|
-
* @param {any} coordinates
|
|
299
|
-
* @returns {any}
|
|
300
|
-
*/
|
|
301
|
-
__exports.fdeb = function(graph, coordinates) {
|
|
302
|
-
try {
|
|
303
|
-
_assertClass(graph, Graph);
|
|
304
|
-
var ret = wasm.fdeb(graph.ptr, addBorrowedObject(coordinates));
|
|
305
|
-
return takeObject(ret);
|
|
306
|
-
} finally {
|
|
307
|
-
heap[stack_pointer++] = undefined;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
function handleError(f) {
|
|
312
|
-
return function () {
|
|
313
|
-
try {
|
|
314
|
-
return f.apply(this, arguments);
|
|
315
|
-
|
|
316
|
-
} catch (e) {
|
|
317
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
*/
|
|
323
|
-
class CenterForce {
|
|
324
|
-
|
|
325
|
-
free() {
|
|
326
|
-
const ptr = this.ptr;
|
|
327
|
-
this.ptr = 0;
|
|
328
|
-
|
|
329
|
-
wasm.__wbg_centerforce_free(ptr);
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
*/
|
|
333
|
-
constructor() {
|
|
334
|
-
var ret = wasm.centerforce_new();
|
|
335
|
-
return Force.__wrap(ret);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
__exports.CenterForce = CenterForce;
|
|
339
|
-
/**
|
|
340
|
-
*/
|
|
341
|
-
class Force {
|
|
342
|
-
|
|
343
|
-
static __wrap(ptr) {
|
|
344
|
-
const obj = Object.create(Force.prototype);
|
|
345
|
-
obj.ptr = ptr;
|
|
346
|
-
|
|
347
|
-
return obj;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
free() {
|
|
351
|
-
const ptr = this.ptr;
|
|
352
|
-
this.ptr = 0;
|
|
353
|
-
|
|
354
|
-
wasm.__wbg_force_free(ptr);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
__exports.Force = Force;
|
|
358
|
-
/**
|
|
359
|
-
*/
|
|
360
|
-
class Graph {
|
|
361
|
-
|
|
362
|
-
static __wrap(ptr) {
|
|
363
|
-
const obj = Object.create(Graph.prototype);
|
|
364
|
-
obj.ptr = ptr;
|
|
365
|
-
|
|
366
|
-
return obj;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
free() {
|
|
370
|
-
const ptr = this.ptr;
|
|
371
|
-
this.ptr = 0;
|
|
372
|
-
|
|
373
|
-
wasm.__wbg_graph_free(ptr);
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
*/
|
|
377
|
-
constructor() {
|
|
378
|
-
var ret = wasm.graph_new();
|
|
379
|
-
return Graph.__wrap(ret);
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* @returns {number}
|
|
383
|
-
*/
|
|
384
|
-
nodeCount() {
|
|
385
|
-
var ret = wasm.graph_nodeCount(this.ptr);
|
|
386
|
-
return ret >>> 0;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* @returns {number}
|
|
390
|
-
*/
|
|
391
|
-
edgeCount() {
|
|
392
|
-
var ret = wasm.graph_edgeCount(this.ptr);
|
|
393
|
-
return ret >>> 0;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* @param {any} value
|
|
397
|
-
* @returns {number}
|
|
398
|
-
*/
|
|
399
|
-
addNode(value) {
|
|
400
|
-
var ret = wasm.graph_addNode(this.ptr, addHeapObject(value));
|
|
401
|
-
return ret >>> 0;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* @param {number} a
|
|
405
|
-
* @returns {any}
|
|
406
|
-
*/
|
|
407
|
-
nodeWeight(a) {
|
|
408
|
-
var ret = wasm.graph_nodeWeight(this.ptr, a);
|
|
409
|
-
return takeObject(ret);
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* @param {number} a
|
|
413
|
-
* @param {number} b
|
|
414
|
-
* @param {any} value
|
|
415
|
-
* @returns {number}
|
|
416
|
-
*/
|
|
417
|
-
addEdge(a, b, value) {
|
|
418
|
-
var ret = wasm.graph_addEdge(this.ptr, a, b, addHeapObject(value));
|
|
419
|
-
return ret >>> 0;
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* @param {number} e
|
|
423
|
-
* @returns {any}
|
|
424
|
-
*/
|
|
425
|
-
edgeWeight(e) {
|
|
426
|
-
var ret = wasm.graph_edgeWeight(this.ptr, e);
|
|
427
|
-
return takeObject(ret);
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* @param {number} e
|
|
431
|
-
* @returns {Array<any>}
|
|
432
|
-
*/
|
|
433
|
-
edgeEndpoints(e) {
|
|
434
|
-
var ret = wasm.graph_edgeEndpoints(this.ptr, e);
|
|
435
|
-
return takeObject(ret);
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* @param {number} a
|
|
439
|
-
* @returns {any}
|
|
440
|
-
*/
|
|
441
|
-
removeNode(a) {
|
|
442
|
-
var ret = wasm.graph_removeNode(this.ptr, a);
|
|
443
|
-
return takeObject(ret);
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* @param {number} e
|
|
447
|
-
* @returns {any}
|
|
448
|
-
*/
|
|
449
|
-
removeEdge(e) {
|
|
450
|
-
var ret = wasm.graph_removeEdge(this.ptr, e);
|
|
451
|
-
return takeObject(ret);
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* @param {number} a
|
|
455
|
-
* @returns {Array<any>}
|
|
456
|
-
*/
|
|
457
|
-
neighbors(a) {
|
|
458
|
-
var ret = wasm.graph_neighbors(this.ptr, a);
|
|
459
|
-
return takeObject(ret);
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* @param {number} a
|
|
463
|
-
* @param {number} dir
|
|
464
|
-
* @returns {Array<any>}
|
|
465
|
-
*/
|
|
466
|
-
neighborsDirected(a, dir) {
|
|
467
|
-
var ret = wasm.graph_neighborsDirected(this.ptr, a, dir);
|
|
468
|
-
return takeObject(ret);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* @param {number} a
|
|
472
|
-
* @returns {Array<any>}
|
|
473
|
-
*/
|
|
474
|
-
neighborsUndirected(a) {
|
|
475
|
-
var ret = wasm.graph_neighborsUndirected(this.ptr, a);
|
|
476
|
-
return takeObject(ret);
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* @param {number} a
|
|
480
|
-
* @returns {Array<any>}
|
|
481
|
-
*/
|
|
482
|
-
edges(a) {
|
|
483
|
-
var ret = wasm.graph_edges(this.ptr, a);
|
|
484
|
-
return takeObject(ret);
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* @param {number} a
|
|
488
|
-
* @param {number} b
|
|
489
|
-
* @returns {boolean}
|
|
490
|
-
*/
|
|
491
|
-
containsEdge(a, b) {
|
|
492
|
-
var ret = wasm.graph_containsEdge(this.ptr, a, b);
|
|
493
|
-
return ret !== 0;
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* @param {number} a
|
|
497
|
-
* @param {number} b
|
|
498
|
-
* @returns {number}
|
|
499
|
-
*/
|
|
500
|
-
findEdge(a, b) {
|
|
501
|
-
var ret = wasm.graph_findEdge(this.ptr, a, b);
|
|
502
|
-
return ret >>> 0;
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* @param {number} dir
|
|
506
|
-
* @returns {Array<any>}
|
|
507
|
-
*/
|
|
508
|
-
externals(dir) {
|
|
509
|
-
var ret = wasm.graph_externals(this.ptr, dir);
|
|
510
|
-
return takeObject(ret);
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* @returns {Array<any>}
|
|
514
|
-
*/
|
|
515
|
-
nodeIndices() {
|
|
516
|
-
var ret = wasm.graph_nodeIndices(this.ptr);
|
|
517
|
-
return takeObject(ret);
|
|
518
|
-
}
|
|
519
|
-
/**
|
|
520
|
-
* @returns {Array<any>}
|
|
521
|
-
*/
|
|
522
|
-
edgeIndices() {
|
|
523
|
-
var ret = wasm.graph_edgeIndices(this.ptr);
|
|
524
|
-
return takeObject(ret);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
__exports.Graph = Graph;
|
|
528
|
-
/**
|
|
529
|
-
*/
|
|
530
|
-
class LinkForce {
|
|
531
|
-
|
|
532
|
-
free() {
|
|
533
|
-
const ptr = this.ptr;
|
|
534
|
-
this.ptr = 0;
|
|
535
|
-
|
|
536
|
-
wasm.__wbg_linkforce_free(ptr);
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* @param {Graph} graph
|
|
540
|
-
*/
|
|
541
|
-
constructor(graph) {
|
|
542
|
-
_assertClass(graph, Graph);
|
|
543
|
-
var ret = wasm.linkforce_new(graph.ptr);
|
|
544
|
-
return Force.__wrap(ret);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
__exports.LinkForce = LinkForce;
|
|
548
|
-
/**
|
|
549
|
-
*/
|
|
550
|
-
class ManyBodyForce {
|
|
551
|
-
|
|
552
|
-
free() {
|
|
553
|
-
const ptr = this.ptr;
|
|
554
|
-
this.ptr = 0;
|
|
555
|
-
|
|
556
|
-
wasm.__wbg_manybodyforce_free(ptr);
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* @param {Graph} graph
|
|
560
|
-
*/
|
|
561
|
-
constructor(graph) {
|
|
562
|
-
_assertClass(graph, Graph);
|
|
563
|
-
var ret = wasm.manybodyforce_new(graph.ptr);
|
|
564
|
-
return Force.__wrap(ret);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
__exports.ManyBodyForce = ManyBodyForce;
|
|
568
|
-
/**
|
|
569
|
-
*/
|
|
570
|
-
class Simulation {
|
|
571
|
-
|
|
572
|
-
static __wrap(ptr) {
|
|
573
|
-
const obj = Object.create(Simulation.prototype);
|
|
574
|
-
obj.ptr = ptr;
|
|
575
|
-
|
|
576
|
-
return obj;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
free() {
|
|
580
|
-
const ptr = this.ptr;
|
|
581
|
-
this.ptr = 0;
|
|
582
|
-
|
|
583
|
-
wasm.__wbg_simulation_free(ptr);
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* @param {Graph} graph
|
|
587
|
-
* @param {Function} f
|
|
588
|
-
*/
|
|
589
|
-
constructor(graph, f) {
|
|
590
|
-
try {
|
|
591
|
-
_assertClass(graph, Graph);
|
|
592
|
-
var ret = wasm.simulation_new(graph.ptr, addBorrowedObject(f));
|
|
593
|
-
return Simulation.__wrap(ret);
|
|
594
|
-
} finally {
|
|
595
|
-
heap[stack_pointer++] = undefined;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* @param {any[]} js_forces
|
|
600
|
-
* @returns {any}
|
|
601
|
-
*/
|
|
602
|
-
run(js_forces) {
|
|
603
|
-
var ptr0 = passArrayJsValueToWasm0(js_forces, wasm.__wbindgen_malloc);
|
|
604
|
-
var len0 = WASM_VECTOR_LEN;
|
|
605
|
-
var ret = wasm.simulation_run(this.ptr, ptr0, len0);
|
|
606
|
-
return takeObject(ret);
|
|
607
|
-
}
|
|
608
|
-
/**
|
|
609
|
-
* @param {number} n
|
|
610
|
-
* @param {any[]} js_forces
|
|
611
|
-
* @returns {any}
|
|
612
|
-
*/
|
|
613
|
-
runStep(n, js_forces) {
|
|
614
|
-
var ptr0 = passArrayJsValueToWasm0(js_forces, wasm.__wbindgen_malloc);
|
|
615
|
-
var len0 = WASM_VECTOR_LEN;
|
|
616
|
-
var ret = wasm.simulation_runStep(this.ptr, n, ptr0, len0);
|
|
617
|
-
return takeObject(ret);
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* @returns {boolean}
|
|
621
|
-
*/
|
|
622
|
-
isFinished() {
|
|
623
|
-
var ret = wasm.simulation_isFinished(this.ptr);
|
|
624
|
-
return ret !== 0;
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* @param {number} alpha_start
|
|
628
|
-
*/
|
|
629
|
-
reset(alpha_start) {
|
|
630
|
-
wasm.simulation_reset(this.ptr, alpha_start);
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* @returns {number}
|
|
634
|
-
*/
|
|
635
|
-
get alphaStart() {
|
|
636
|
-
var ret = wasm.simulation_alpha(this.ptr);
|
|
637
|
-
return ret;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* @param {number} value
|
|
641
|
-
*/
|
|
642
|
-
set alphaStart(value) {
|
|
643
|
-
wasm.simulation_reset(this.ptr, value);
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* @returns {number}
|
|
647
|
-
*/
|
|
648
|
-
get alphaMin() {
|
|
649
|
-
var ret = wasm.simulation_alpha_min(this.ptr);
|
|
650
|
-
return ret;
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* @param {number} value
|
|
654
|
-
*/
|
|
655
|
-
set alphaMin(value) {
|
|
656
|
-
wasm.simulation_set_alpha_min(this.ptr, value);
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* @returns {number}
|
|
660
|
-
*/
|
|
661
|
-
get alphaTarget() {
|
|
662
|
-
var ret = wasm.simulation_alpha_target(this.ptr);
|
|
663
|
-
return ret;
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* @param {number} value
|
|
667
|
-
*/
|
|
668
|
-
set alphaTarget(value) {
|
|
669
|
-
wasm.simulation_set_alpha_target(this.ptr, value);
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* @returns {number}
|
|
673
|
-
*/
|
|
674
|
-
get velocityDecay() {
|
|
675
|
-
var ret = wasm.simulation_velocity_decay(this.ptr);
|
|
676
|
-
return ret;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* @param {number} value
|
|
680
|
-
*/
|
|
681
|
-
set velocityDecay(value) {
|
|
682
|
-
wasm.simulation_set_velocity_decay(this.ptr, value);
|
|
683
|
-
}
|
|
684
|
-
/**
|
|
685
|
-
* @returns {number}
|
|
686
|
-
*/
|
|
687
|
-
get iterations() {
|
|
688
|
-
var ret = wasm.simulation_iterations(this.ptr);
|
|
689
|
-
return ret >>> 0;
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* @param {number} value
|
|
693
|
-
*/
|
|
694
|
-
set iterations(value) {
|
|
695
|
-
wasm.simulation_set_iterations(this.ptr, value);
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
__exports.Simulation = Simulation;
|
|
699
|
-
|
|
700
|
-
async function load(module, imports) {
|
|
701
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
702
|
-
|
|
703
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
704
|
-
try {
|
|
705
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
706
|
-
|
|
707
|
-
} catch (e) {
|
|
708
|
-
if (module.headers.get('Content-Type') != 'application/wasm') {
|
|
709
|
-
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);
|
|
710
|
-
|
|
711
|
-
} else {
|
|
712
|
-
throw e;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
const bytes = await module.arrayBuffer();
|
|
718
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
719
|
-
|
|
720
|
-
} else {
|
|
721
|
-
|
|
722
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
723
|
-
|
|
724
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
725
|
-
return { instance, module };
|
|
726
|
-
|
|
727
|
-
} else {
|
|
728
|
-
return instance;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
async function init(input) {
|
|
734
|
-
if (typeof input === 'undefined') {
|
|
735
|
-
let src;
|
|
736
|
-
if (typeof document === 'undefined') {
|
|
737
|
-
src = location.href;
|
|
738
|
-
} else {
|
|
739
|
-
src = document.currentScript.src;
|
|
740
|
-
}
|
|
741
|
-
input = src.replace(/\.js$/, '_bg.wasm');
|
|
742
|
-
}
|
|
743
|
-
const imports = {};
|
|
744
|
-
imports.wbg = {};
|
|
745
|
-
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
746
|
-
var ret = getStringFromWasm0(arg0, arg1);
|
|
747
|
-
return addHeapObject(ret);
|
|
748
|
-
};
|
|
749
|
-
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
750
|
-
var ret = arg0;
|
|
751
|
-
return addHeapObject(ret);
|
|
752
|
-
};
|
|
753
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
754
|
-
takeObject(arg0);
|
|
755
|
-
};
|
|
756
|
-
imports.wbg.__wbindgen_json_serialize = function(arg0, arg1) {
|
|
757
|
-
const obj = getObject(arg1);
|
|
758
|
-
var ret = JSON.stringify(obj === undefined ? null : obj);
|
|
759
|
-
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
760
|
-
var len0 = WASM_VECTOR_LEN;
|
|
761
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
762
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
763
|
-
};
|
|
764
|
-
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
|
|
765
|
-
var ret = getObject(arg0);
|
|
766
|
-
return addHeapObject(ret);
|
|
767
|
-
};
|
|
768
|
-
imports.wbg.__wbindgen_json_parse = function(arg0, arg1) {
|
|
769
|
-
var ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
770
|
-
return addHeapObject(ret);
|
|
771
|
-
};
|
|
772
|
-
imports.wbg.__wbg_get_a8b9619536c590d4 = function(arg0, arg1) {
|
|
773
|
-
var ret = getObject(arg0)[arg1 >>> 0];
|
|
774
|
-
return addHeapObject(ret);
|
|
775
|
-
};
|
|
776
|
-
imports.wbg.__wbg_get_4bab9404e99a1f85 = handleError(function(arg0, arg1) {
|
|
777
|
-
var ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
778
|
-
return addHeapObject(ret);
|
|
779
|
-
});
|
|
780
|
-
imports.wbg.__wbg_new_1abc33d4f9ba3e80 = function() {
|
|
781
|
-
var ret = new Array();
|
|
782
|
-
return addHeapObject(ret);
|
|
783
|
-
};
|
|
784
|
-
imports.wbg.__wbg_push_44968dcdf4cfbb43 = function(arg0, arg1) {
|
|
785
|
-
var ret = getObject(arg0).push(getObject(arg1));
|
|
786
|
-
return ret;
|
|
787
|
-
};
|
|
788
|
-
imports.wbg.__wbg_call_7a2b5e98ac536644 = handleError(function(arg0, arg1, arg2) {
|
|
789
|
-
var ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
790
|
-
return addHeapObject(ret);
|
|
791
|
-
});
|
|
792
|
-
imports.wbg.__wbg_new_dc5b27cfd2149b8f = function() {
|
|
793
|
-
var ret = new Object();
|
|
794
|
-
return addHeapObject(ret);
|
|
795
|
-
};
|
|
796
|
-
imports.wbg.__wbg_set_3afd31f38e771338 = handleError(function(arg0, arg1, arg2) {
|
|
797
|
-
var ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
798
|
-
return ret;
|
|
799
|
-
});
|
|
800
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
801
|
-
const obj = getObject(arg1);
|
|
802
|
-
var ret = typeof(obj) === 'number' ? obj : undefined;
|
|
803
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
804
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
805
|
-
};
|
|
806
|
-
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
|
807
|
-
var ret = debugString(getObject(arg1));
|
|
808
|
-
var ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
809
|
-
var len0 = WASM_VECTOR_LEN;
|
|
810
|
-
getInt32Memory0()[arg0 / 4 + 1] = len0;
|
|
811
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
|
|
812
|
-
};
|
|
813
|
-
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
814
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
815
|
-
};
|
|
816
|
-
imports.wbg.__wbindgen_rethrow = function(arg0) {
|
|
817
|
-
throw takeObject(arg0);
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
|
|
821
|
-
input = fetch(input);
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
const { instance, module } = await load(await input, imports);
|
|
825
|
-
|
|
826
|
-
wasm = instance.exports;
|
|
827
|
-
init.__wbindgen_wasm_module = module;
|
|
828
|
-
|
|
829
|
-
return wasm;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
wasm_bindgen = Object.assign(init, __exports);
|
|
833
|
-
|
|
834
|
-
})();
|