@datagrok/eda 1.4.2 → 1.4.4
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/CHANGELOG.md +8 -0
- package/README.md +1 -0
- package/dist/_d4c0.js +279 -0
- package/dist/_d4c0.js.map +1 -0
- package/dist/node_modules_datagrok-libraries_math_src_dbscan_wasm_clustering-worker_js.js +279 -0
- package/dist/node_modules_datagrok-libraries_math_src_dbscan_wasm_clustering-worker_js.js.map +1 -0
- package/dist/node_modules_datagrok-libraries_ml_src_MCL_mcl-sparse-matrix-mult-worker_js.js +59 -0
- package/dist/node_modules_datagrok-libraries_ml_src_MCL_mcl-sparse-matrix-mult-worker_js.js.map +1 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_distance-matrix-worker_js.js +284 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_distance-matrix-worker_js.js.map +1 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_single-value-knn-worker_js.js +265 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_single-value-knn-worker_js.js.map +1 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-worker_js.js +287 -0
- package/dist/node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-worker_js.js.map +1 -0
- package/dist/package-test.js +26140 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +30337 -1
- package/dist/package.js.map +1 -1
- package/dist/src_workers_softmax-worker_ts.js +154 -0
- package/dist/src_workers_softmax-worker_ts.js.map +1 -0
- package/dist/src_workers_tsne-worker_ts.js +244 -0
- package/dist/src_workers_tsne-worker_ts.js.map +1 -0
- package/dist/src_workers_umap-worker_ts.js +252 -0
- package/dist/src_workers_umap-worker_ts.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js.js +1253 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_hierarchical-clustering_wasm_clustering-worker_js.js +942 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_hierarchical-clustering_wasm_clustering-worker_js.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f.js +1525 -0
- package/dist/vendors-node_modules_datagrok-libraries_math_src_webGPU_sparse-matrix_webGPU-sparse-matrix_js-07693f.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d.js +2244 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_MCL_mcl-worker_js-node_modules_datagrok-librar-e4203d.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-threshold-worker_js.js +286 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-threshold-worker_js.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-worker_js.js +280 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_knn-worker_js.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-threshold-worker_js.js +282 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_sparse-matrix-threshold-worker_js.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_utils_js-node_modules_datagrok-72c7b2.js +1821 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_distance-matrix_utils_js-node_modules_datagrok-72c7b2.js.map +1 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_multi-column-dimensionality-reduction_mulit-co-3800a0.js +7776 -0
- package/dist/vendors-node_modules_datagrok-libraries_ml_src_multi-column-dimensionality-reduction_mulit-co-3800a0.js.map +1 -0
- package/dist/vendors-node_modules_keckelt_tsne_lib_index_js.js +379 -0
- package/dist/vendors-node_modules_keckelt_tsne_lib_index_js.js.map +1 -0
- package/dist/vendors-node_modules_ml-matrix_matrix_mjs.js +5946 -0
- package/dist/vendors-node_modules_ml-matrix_matrix_mjs.js.map +1 -0
- package/dist/vendors-node_modules_umap-js_dist_index_js.js +2284 -0
- package/dist/vendors-node_modules_umap-js_dist_index_js.js.map +1 -0
- package/dist/wasm_EDAForWebWorker_js-wasm_callWasmForWebWorker_js.js +779 -0
- package/dist/wasm_EDAForWebWorker_js-wasm_callWasmForWebWorker_js.js.map +1 -0
- package/dist/wasm_workers_errorWorker_js.js +267 -0
- package/dist/wasm_workers_errorWorker_js.js.map +1 -0
- package/dist/wasm_workers_fitLinearRegressionParamsWithDataNormalizingWorker_js.js +267 -0
- package/dist/wasm_workers_fitLinearRegressionParamsWithDataNormalizingWorker_js.js.map +1 -0
- package/dist/wasm_workers_fitLinearRegressionParamsWorker_js.js +267 -0
- package/dist/wasm_workers_fitLinearRegressionParamsWorker_js.js.map +1 -0
- package/dist/wasm_workers_fitSoftmaxWorker_js.js +267 -0
- package/dist/wasm_workers_fitSoftmaxWorker_js.js.map +1 -0
- package/dist/wasm_workers_generateDatasetWorker_js.js +267 -0
- package/dist/wasm_workers_generateDatasetWorker_js.js.map +1 -0
- package/dist/wasm_workers_normalizeDatasetWorker_js.js +267 -0
- package/dist/wasm_workers_normalizeDatasetWorker_js.js.map +1 -0
- package/dist/wasm_workers_partialLeastSquareRegressionWorker_js.js +267 -0
- package/dist/wasm_workers_partialLeastSquareRegressionWorker_js.js.map +1 -0
- package/dist/wasm_workers_predictByLSSVMWorker_js.js +267 -0
- package/dist/wasm_workers_predictByLSSVMWorker_js.js.map +1 -0
- package/dist/wasm_workers_principalComponentAnalysisNipalsWorker_js.js +267 -0
- package/dist/wasm_workers_principalComponentAnalysisNipalsWorker_js.js.map +1 -0
- package/dist/wasm_workers_principalComponentAnalysisWorkerUpd_js.js +271 -0
- package/dist/wasm_workers_principalComponentAnalysisWorkerUpd_js.js.map +1 -0
- package/dist/wasm_workers_trainAndAnalyzeLSSVMWorker_js.js +267 -0
- package/dist/wasm_workers_trainAndAnalyzeLSSVMWorker_js.js.map +1 -0
- package/dist/wasm_workers_trainLSSVMWorker_js.js +267 -0
- package/dist/wasm_workers_trainLSSVMWorker_js.js.map +1 -0
- package/dist/wasm_workers_xgboostWorker_js.js +279 -0
- package/dist/wasm_workers_xgboostWorker_js.js.map +1 -0
- package/package.json +5 -4
- package/src/package-api.ts +259 -0
- package/src/package.g.ts +522 -0
- package/src/package.ts +907 -678
- package/test-console-output-1.log +95 -80
- package/test-record-1.mp4 +0 -0
- package/tsconfig.json +2 -2
- package/webpack.config.js +5 -0
- package/dist/111.js +0 -2
- package/dist/111.js.map +0 -1
- package/dist/128.js +0 -2
- package/dist/128.js.map +0 -1
- package/dist/153.js +0 -2
- package/dist/153.js.map +0 -1
- package/dist/23.js +0 -2
- package/dist/23.js.map +0 -1
- package/dist/234.js +0 -2
- package/dist/234.js.map +0 -1
- package/dist/242.js +0 -2
- package/dist/242.js.map +0 -1
- package/dist/260.js +0 -2
- package/dist/260.js.map +0 -1
- package/dist/33.js +0 -2
- package/dist/33.js.map +0 -1
- package/dist/348.js +0 -2
- package/dist/348.js.map +0 -1
- package/dist/377.js +0 -2
- package/dist/377.js.map +0 -1
- package/dist/412.js +0 -2
- package/dist/412.js.map +0 -1
- package/dist/415.js +0 -2
- package/dist/415.js.map +0 -1
- package/dist/501.js +0 -2
- package/dist/501.js.map +0 -1
- package/dist/531.js +0 -2
- package/dist/531.js.map +0 -1
- package/dist/583.js +0 -2
- package/dist/583.js.map +0 -1
- package/dist/589.js +0 -2
- package/dist/589.js.map +0 -1
- package/dist/603.js +0 -2
- package/dist/603.js.map +0 -1
- package/dist/656.js +0 -2
- package/dist/656.js.map +0 -1
- package/dist/682.js +0 -2
- package/dist/682.js.map +0 -1
- package/dist/705.js +0 -2
- package/dist/705.js.map +0 -1
- package/dist/727.js +0 -2
- package/dist/727.js.map +0 -1
- package/dist/731.js +0 -2
- package/dist/731.js.map +0 -1
- package/dist/738.js +0 -3
- package/dist/738.js.LICENSE.txt +0 -51
- package/dist/738.js.map +0 -1
- package/dist/763.js +0 -2
- package/dist/763.js.map +0 -1
- package/dist/778.js +0 -2
- package/dist/778.js.map +0 -1
- package/dist/783.js +0 -2
- package/dist/783.js.map +0 -1
- package/dist/793.js +0 -2
- package/dist/793.js.map +0 -1
- package/dist/801.js +0 -2
- package/dist/801.js.map +0 -1
- package/dist/810.js +0 -2
- package/dist/810.js.map +0 -1
- package/dist/860.js +0 -2
- package/dist/860.js.map +0 -1
- package/dist/907.js +0 -2
- package/dist/907.js.map +0 -1
- package/dist/950.js +0 -2
- package/dist/950.js.map +0 -1
- package/dist/980.js +0 -2
- package/dist/980.js.map +0 -1
- package/dist/990.js +0 -2
- package/dist/990.js.map +0 -1
|
@@ -0,0 +1,1253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(self["webpackChunkeda"] = self["webpackChunkeda"] || []).push([["vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js"],{
|
|
3
|
+
|
|
4
|
+
/***/ "./node_modules/@datagrok-libraries/math/src/dbscan/wasm/dbscan.js":
|
|
5
|
+
/*!*************************************************************************!*\
|
|
6
|
+
!*** ./node_modules/@datagrok-libraries/math/src/dbscan/wasm/dbscan.js ***!
|
|
7
|
+
\*************************************************************************/
|
|
8
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ dbscan: () => (/* binding */ dbscan)
|
|
13
|
+
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var _wasmDbscan_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wasmDbscan.js */ "./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.js");
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
async function dbscan(embedX, embedY, epsilon, minPts) {
|
|
18
|
+
const wasmUrl = new URL(/* asset import */ __webpack_require__(/*! ./wasmDbscan.wasm */ "./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.wasm"), __webpack_require__.b).href;
|
|
19
|
+
const wasmPath = wasmUrl.substring(0, wasmUrl.lastIndexOf('/') + 1) + 'wasmDbscan.wasm';
|
|
20
|
+
let wasmInstance;
|
|
21
|
+
try {
|
|
22
|
+
wasmInstance = await (0,_wasmDbscan_js__WEBPACK_IMPORTED_MODULE_0__.exportCppDbscanLib)({locateFile: () => wasmUrl, printErr: (_) => {}});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
try {
|
|
25
|
+
wasmInstance = await (0,_wasmDbscan_js__WEBPACK_IMPORTED_MODULE_0__.exportCppDbscanLib)({locateFile: () => wasmPath, printErr: (_) => {}});
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
console.error(e);
|
|
29
|
+
throw new Error('Unable to load wasm file for dbscan');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const getDbscanWasm =
|
|
33
|
+
wasmInstance.cwrap('dbscan', 'null', ['number', 'number', 'number', 'number', 'number', 'number']);
|
|
34
|
+
const bytesForEmbedX = Float32Array.BYTES_PER_ELEMENT * embedX.length;
|
|
35
|
+
const dataPtrX = wasmInstance._malloc(bytesForEmbedX); // allocate a memory block on the wasm heap for the embedX
|
|
36
|
+
const dataPtrY = wasmInstance._malloc(bytesForEmbedX); // allocate a memory block on the wasm heap for the embedY
|
|
37
|
+
const xHeap = new Uint8Array(wasmInstance.HEAPU8.buffer, dataPtrX, bytesForEmbedX);
|
|
38
|
+
xHeap.set(new Uint8Array(embedX.buffer)); // copy embedX to the wasm heap
|
|
39
|
+
const yHeap = new Uint8Array(wasmInstance.HEAPU8.buffer, dataPtrY, bytesForEmbedX);
|
|
40
|
+
yHeap.set(new Uint8Array(embedY.buffer)); // copy embedY to the wasm heap
|
|
41
|
+
|
|
42
|
+
const clusterPtr = wasmInstance._malloc(bytesForEmbedX);
|
|
43
|
+
const clusterHeap = new Uint8Array(wasmInstance.HEAPU8.buffer, clusterPtr, bytesForEmbedX);
|
|
44
|
+
|
|
45
|
+
getDbscanWasm(dataPtrX, dataPtrY, embedX.length, epsilon, minPts, clusterPtr);
|
|
46
|
+
const clusterResult = new Int32Array(clusterHeap.buffer, clusterHeap.byteOffset, embedX.length);
|
|
47
|
+
wasmInstance._free(xHeap.byteOffset);
|
|
48
|
+
wasmInstance._free(yHeap.byteOffset);
|
|
49
|
+
wasmInstance._free(clusterHeap.byteOffset);
|
|
50
|
+
return clusterResult;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/***/ }),
|
|
54
|
+
|
|
55
|
+
/***/ "./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.js":
|
|
56
|
+
/*!*****************************************************************************!*\
|
|
57
|
+
!*** ./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.js ***!
|
|
58
|
+
\*****************************************************************************/
|
|
59
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
60
|
+
|
|
61
|
+
__webpack_require__.r(__webpack_exports__);
|
|
62
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
63
|
+
/* harmony export */ exportCppDbscanLib: () => (/* binding */ exportCppDbscanLib)
|
|
64
|
+
/* harmony export */ });
|
|
65
|
+
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
66
|
+
|
|
67
|
+
var exportCppDbscanLib = (() => {
|
|
68
|
+
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
function(exportCppDbscanLib = {}) {
|
|
72
|
+
|
|
73
|
+
// include: shell.js
|
|
74
|
+
// The Module object: Our interface to the outside world. We import
|
|
75
|
+
// and export values on it. There are various ways Module can be used:
|
|
76
|
+
// 1. Not defined. We create it here
|
|
77
|
+
// 2. A function parameter, function(Module) { ..generated code.. }
|
|
78
|
+
// 3. pre-run appended it, var Module = {}; ..generated code..
|
|
79
|
+
// 4. External script tag defines var Module.
|
|
80
|
+
// We need to check if Module already exists (e.g. case 3 above).
|
|
81
|
+
// Substitution will be replaced with actual code on later stage of the build,
|
|
82
|
+
// this way Closure Compiler will not mangle it (e.g. case 4. above).
|
|
83
|
+
// Note that if you want to run closure, and also to use Module
|
|
84
|
+
// after the generated code, you will need to define var Module = {};
|
|
85
|
+
// before the code. Then that object will be used in the code, and you
|
|
86
|
+
// can continue to use Module afterwards as well.
|
|
87
|
+
var Module = typeof exportCppDbscanLib != 'undefined' ? exportCppDbscanLib : {};
|
|
88
|
+
|
|
89
|
+
// Set up the promise that indicates the Module is initialized
|
|
90
|
+
var readyPromiseResolve, readyPromiseReject;
|
|
91
|
+
Module['ready'] = new Promise(function(resolve, reject) {
|
|
92
|
+
readyPromiseResolve = resolve;
|
|
93
|
+
readyPromiseReject = reject;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// --pre-jses are emitted after the Module integration code, so that they can
|
|
97
|
+
// refer to Module (if they choose; they can also define Module)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
// Sometimes an existing Module object exists with properties
|
|
101
|
+
// meant to overwrite the default module functionality. Here
|
|
102
|
+
// we collect those properties and reapply _after_ we configure
|
|
103
|
+
// the current environment's defaults to avoid having to be so
|
|
104
|
+
// defensive during initialization.
|
|
105
|
+
var moduleOverrides = Object.assign({}, Module);
|
|
106
|
+
|
|
107
|
+
var arguments_ = [];
|
|
108
|
+
var thisProgram = './this.program';
|
|
109
|
+
var quit_ = (status, toThrow) => {
|
|
110
|
+
throw toThrow;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Determine the runtime environment we are in. You can customize this by
|
|
114
|
+
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
|
115
|
+
|
|
116
|
+
// Attempt to auto-detect the environment
|
|
117
|
+
var ENVIRONMENT_IS_WEB = typeof window == 'object';
|
|
118
|
+
var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function';
|
|
119
|
+
// N.b. Electron.js environment is simultaneously a NODE-environment, but
|
|
120
|
+
// also a web environment.
|
|
121
|
+
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
|
|
122
|
+
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
|
|
123
|
+
|
|
124
|
+
// `/` should be present at the end if `scriptDirectory` is not empty
|
|
125
|
+
var scriptDirectory = '';
|
|
126
|
+
function locateFile(path) {
|
|
127
|
+
if (Module['locateFile']) {
|
|
128
|
+
return Module['locateFile'](path, scriptDirectory);
|
|
129
|
+
}
|
|
130
|
+
return scriptDirectory + path;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Hooks that are implemented differently in different runtime environments.
|
|
134
|
+
var read_,
|
|
135
|
+
readAsync,
|
|
136
|
+
readBinary,
|
|
137
|
+
setWindowTitle;
|
|
138
|
+
|
|
139
|
+
// Note that this includes Node.js workers when relevant (pthreads is enabled).
|
|
140
|
+
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
141
|
+
// ENVIRONMENT_IS_NODE.
|
|
142
|
+
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
143
|
+
if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
|
|
144
|
+
scriptDirectory = self.location.href;
|
|
145
|
+
} else if (typeof document != 'undefined' && document.currentScript) { // web
|
|
146
|
+
scriptDirectory = document.currentScript.src;
|
|
147
|
+
}
|
|
148
|
+
// When MODULARIZE, this JS may be executed later, after document.currentScript
|
|
149
|
+
// is gone, so we saved it, and we use it here instead of any other info.
|
|
150
|
+
if (_scriptDir) {
|
|
151
|
+
scriptDirectory = _scriptDir;
|
|
152
|
+
}
|
|
153
|
+
// blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
|
|
154
|
+
// otherwise, slice off the final part of the url to find the script directory.
|
|
155
|
+
// if scriptDirectory does not contain a slash, lastIndexOf will return -1,
|
|
156
|
+
// and scriptDirectory will correctly be replaced with an empty string.
|
|
157
|
+
// If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
|
|
158
|
+
// they are removed because they could contain a slash.
|
|
159
|
+
if (scriptDirectory.indexOf('blob:') !== 0) {
|
|
160
|
+
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1);
|
|
161
|
+
} else {
|
|
162
|
+
scriptDirectory = '';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Differentiate the Web Worker from the Node Worker case, as reading must
|
|
166
|
+
// be done differently.
|
|
167
|
+
{
|
|
168
|
+
// include: web_or_worker_shell_read.js
|
|
169
|
+
read_ = (url) => {
|
|
170
|
+
var xhr = new XMLHttpRequest();
|
|
171
|
+
xhr.open('GET', url, false);
|
|
172
|
+
xhr.send(null);
|
|
173
|
+
return xhr.responseText;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (ENVIRONMENT_IS_WORKER) {
|
|
177
|
+
readBinary = (url) => {
|
|
178
|
+
var xhr = new XMLHttpRequest();
|
|
179
|
+
xhr.open('GET', url, false);
|
|
180
|
+
xhr.responseType = 'arraybuffer';
|
|
181
|
+
xhr.send(null);
|
|
182
|
+
return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
readAsync = (url, onload, onerror) => {
|
|
187
|
+
var xhr = new XMLHttpRequest();
|
|
188
|
+
xhr.open('GET', url, true);
|
|
189
|
+
xhr.responseType = 'arraybuffer';
|
|
190
|
+
xhr.onload = () => {
|
|
191
|
+
if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
|
|
192
|
+
onload(xhr.response);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
onerror();
|
|
196
|
+
};
|
|
197
|
+
xhr.onerror = onerror;
|
|
198
|
+
xhr.send(null);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// end include: web_or_worker_shell_read.js
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
setWindowTitle = (title) => document.title = title;
|
|
205
|
+
} else
|
|
206
|
+
{
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var out = Module['print'] || console.log.bind(console);
|
|
210
|
+
var err = Module['printErr'] || console.warn.bind(console);
|
|
211
|
+
|
|
212
|
+
// Merge back in the overrides
|
|
213
|
+
Object.assign(Module, moduleOverrides);
|
|
214
|
+
// Free the object hierarchy contained in the overrides, this lets the GC
|
|
215
|
+
// reclaim data used e.g. in memoryInitializerRequest, which is a large typed array.
|
|
216
|
+
moduleOverrides = null;
|
|
217
|
+
|
|
218
|
+
// Emit code to handle expected values on the Module object. This applies Module.x
|
|
219
|
+
// to the proper local x. This has two benefits: first, we only emit it if it is
|
|
220
|
+
// expected to arrive, and second, by using a local everywhere else that can be
|
|
221
|
+
// minified.
|
|
222
|
+
|
|
223
|
+
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
224
|
+
|
|
225
|
+
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
226
|
+
|
|
227
|
+
if (Module['quit']) quit_ = Module['quit'];
|
|
228
|
+
|
|
229
|
+
// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
// end include: shell.js
|
|
233
|
+
// include: preamble.js
|
|
234
|
+
// === Preamble library stuff ===
|
|
235
|
+
|
|
236
|
+
// Documentation for the public APIs defined in this file must be updated in:
|
|
237
|
+
// site/source/docs/api_reference/preamble.js.rst
|
|
238
|
+
// A prebuilt local version of the documentation is available at:
|
|
239
|
+
// site/build/text/docs/api_reference/preamble.js.txt
|
|
240
|
+
// You can also build docs locally as HTML or other formats in site/
|
|
241
|
+
// An online HTML version (which may be of a different version of Emscripten)
|
|
242
|
+
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
|
|
243
|
+
|
|
244
|
+
var wasmBinary;
|
|
245
|
+
if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];
|
|
246
|
+
var noExitRuntime = Module['noExitRuntime'] || true;
|
|
247
|
+
|
|
248
|
+
if (typeof WebAssembly != 'object') {
|
|
249
|
+
abort('no native wasm support detected');
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Wasm globals
|
|
253
|
+
|
|
254
|
+
var wasmMemory;
|
|
255
|
+
|
|
256
|
+
//========================================
|
|
257
|
+
// Runtime essentials
|
|
258
|
+
//========================================
|
|
259
|
+
|
|
260
|
+
// whether we are quitting the application. no code should run after this.
|
|
261
|
+
// set in exit() and abort()
|
|
262
|
+
var ABORT = false;
|
|
263
|
+
|
|
264
|
+
// set by exit() and abort(). Passed to 'onExit' handler.
|
|
265
|
+
// NOTE: This is also used as the process return code code in shell environments
|
|
266
|
+
// but only when noExitRuntime is false.
|
|
267
|
+
var EXITSTATUS;
|
|
268
|
+
|
|
269
|
+
/** @type {function(*, string=)} */
|
|
270
|
+
function assert(condition, text) {
|
|
271
|
+
if (!condition) {
|
|
272
|
+
// This build was created without ASSERTIONS defined. `assert()` should not
|
|
273
|
+
// ever be called in this configuration but in case there are callers in
|
|
274
|
+
// the wild leave this simple abort() implemenation here for now.
|
|
275
|
+
abort(text);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Memory management
|
|
280
|
+
|
|
281
|
+
var HEAP,
|
|
282
|
+
/** @type {!Int8Array} */
|
|
283
|
+
HEAP8,
|
|
284
|
+
/** @type {!Uint8Array} */
|
|
285
|
+
HEAPU8,
|
|
286
|
+
/** @type {!Int16Array} */
|
|
287
|
+
HEAP16,
|
|
288
|
+
/** @type {!Uint16Array} */
|
|
289
|
+
HEAPU16,
|
|
290
|
+
/** @type {!Int32Array} */
|
|
291
|
+
HEAP32,
|
|
292
|
+
/** @type {!Uint32Array} */
|
|
293
|
+
HEAPU32,
|
|
294
|
+
/** @type {!Float32Array} */
|
|
295
|
+
HEAPF32,
|
|
296
|
+
/** @type {!Float64Array} */
|
|
297
|
+
HEAPF64;
|
|
298
|
+
|
|
299
|
+
function updateMemoryViews() {
|
|
300
|
+
var b = wasmMemory.buffer;
|
|
301
|
+
Module['HEAP8'] = HEAP8 = new Int8Array(b);
|
|
302
|
+
Module['HEAP16'] = HEAP16 = new Int16Array(b);
|
|
303
|
+
Module['HEAP32'] = HEAP32 = new Int32Array(b);
|
|
304
|
+
Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);
|
|
305
|
+
Module['HEAPU16'] = HEAPU16 = new Uint16Array(b);
|
|
306
|
+
Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);
|
|
307
|
+
Module['HEAPF32'] = HEAPF32 = new Float32Array(b);
|
|
308
|
+
Module['HEAPF64'] = HEAPF64 = new Float64Array(b);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// include: runtime_init_table.js
|
|
312
|
+
// In regular non-RELOCATABLE mode the table is exported
|
|
313
|
+
// from the wasm module and this will be assigned once
|
|
314
|
+
// the exports are available.
|
|
315
|
+
var wasmTable;
|
|
316
|
+
|
|
317
|
+
// end include: runtime_init_table.js
|
|
318
|
+
// include: runtime_stack_check.js
|
|
319
|
+
// end include: runtime_stack_check.js
|
|
320
|
+
// include: runtime_assertions.js
|
|
321
|
+
// end include: runtime_assertions.js
|
|
322
|
+
var __ATPRERUN__ = []; // functions called before the runtime is initialized
|
|
323
|
+
var __ATINIT__ = []; // functions called during startup
|
|
324
|
+
var __ATEXIT__ = []; // functions called during shutdown
|
|
325
|
+
var __ATPOSTRUN__ = []; // functions called after the main() is called
|
|
326
|
+
|
|
327
|
+
var runtimeInitialized = false;
|
|
328
|
+
|
|
329
|
+
var runtimeKeepaliveCounter = 0;
|
|
330
|
+
|
|
331
|
+
function keepRuntimeAlive() {
|
|
332
|
+
return noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function preRun() {
|
|
336
|
+
if (Module['preRun']) {
|
|
337
|
+
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
|
|
338
|
+
while (Module['preRun'].length) {
|
|
339
|
+
addOnPreRun(Module['preRun'].shift());
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
callRuntimeCallbacks(__ATPRERUN__);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function initRuntime() {
|
|
346
|
+
runtimeInitialized = true;
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
callRuntimeCallbacks(__ATINIT__);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function postRun() {
|
|
353
|
+
|
|
354
|
+
if (Module['postRun']) {
|
|
355
|
+
if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']];
|
|
356
|
+
while (Module['postRun'].length) {
|
|
357
|
+
addOnPostRun(Module['postRun'].shift());
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
callRuntimeCallbacks(__ATPOSTRUN__);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function addOnPreRun(cb) {
|
|
365
|
+
__ATPRERUN__.unshift(cb);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function addOnInit(cb) {
|
|
369
|
+
__ATINIT__.unshift(cb);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function addOnExit(cb) {
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function addOnPostRun(cb) {
|
|
376
|
+
__ATPOSTRUN__.unshift(cb);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// include: runtime_math.js
|
|
380
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul
|
|
381
|
+
|
|
382
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround
|
|
383
|
+
|
|
384
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
|
|
385
|
+
|
|
386
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc
|
|
387
|
+
|
|
388
|
+
// end include: runtime_math.js
|
|
389
|
+
// A counter of dependencies for calling run(). If we need to
|
|
390
|
+
// do asynchronous work before running, increment this and
|
|
391
|
+
// decrement it. Incrementing must happen in a place like
|
|
392
|
+
// Module.preRun (used by emcc to add file preloading).
|
|
393
|
+
// Note that you can add dependencies in preRun, even though
|
|
394
|
+
// it happens right before run - run will be postponed until
|
|
395
|
+
// the dependencies are met.
|
|
396
|
+
var runDependencies = 0;
|
|
397
|
+
var runDependencyWatcher = null;
|
|
398
|
+
var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
|
|
399
|
+
|
|
400
|
+
function getUniqueRunDependency(id) {
|
|
401
|
+
return id;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function addRunDependency(id) {
|
|
405
|
+
runDependencies++;
|
|
406
|
+
|
|
407
|
+
if (Module['monitorRunDependencies']) {
|
|
408
|
+
Module['monitorRunDependencies'](runDependencies);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function removeRunDependency(id) {
|
|
414
|
+
runDependencies--;
|
|
415
|
+
|
|
416
|
+
if (Module['monitorRunDependencies']) {
|
|
417
|
+
Module['monitorRunDependencies'](runDependencies);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (runDependencies == 0) {
|
|
421
|
+
if (runDependencyWatcher !== null) {
|
|
422
|
+
clearInterval(runDependencyWatcher);
|
|
423
|
+
runDependencyWatcher = null;
|
|
424
|
+
}
|
|
425
|
+
if (dependenciesFulfilled) {
|
|
426
|
+
var callback = dependenciesFulfilled;
|
|
427
|
+
dependenciesFulfilled = null;
|
|
428
|
+
callback(); // can add another dependenciesFulfilled
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** @param {string|number=} what */
|
|
434
|
+
function abort(what) {
|
|
435
|
+
if (Module['onAbort']) {
|
|
436
|
+
Module['onAbort'](what);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
what = 'Aborted(' + what + ')';
|
|
440
|
+
// TODO(sbc): Should we remove printing and leave it up to whoever
|
|
441
|
+
// catches the exception?
|
|
442
|
+
err(what);
|
|
443
|
+
|
|
444
|
+
ABORT = true;
|
|
445
|
+
EXITSTATUS = 1;
|
|
446
|
+
|
|
447
|
+
what += '. Build with -sASSERTIONS for more info.';
|
|
448
|
+
|
|
449
|
+
// Use a wasm runtime error, because a JS error might be seen as a foreign
|
|
450
|
+
// exception, which means we'd run destructors on it. We need the error to
|
|
451
|
+
// simply make the program stop.
|
|
452
|
+
// FIXME This approach does not work in Wasm EH because it currently does not assume
|
|
453
|
+
// all RuntimeErrors are from traps; it decides whether a RuntimeError is from
|
|
454
|
+
// a trap or not based on a hidden field within the object. So at the moment
|
|
455
|
+
// we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
|
|
456
|
+
// allows this in the wasm spec.
|
|
457
|
+
|
|
458
|
+
// Suppress closure compiler warning here. Closure compiler's builtin extern
|
|
459
|
+
// defintion for WebAssembly.RuntimeError claims it takes no arguments even
|
|
460
|
+
// though it can.
|
|
461
|
+
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
|
|
462
|
+
/** @suppress {checkTypes} */
|
|
463
|
+
var e = new WebAssembly.RuntimeError(what);
|
|
464
|
+
|
|
465
|
+
readyPromiseReject(e);
|
|
466
|
+
// Throw the error whether or not MODULARIZE is set because abort is used
|
|
467
|
+
// in code paths apart from instantiation where an exception is expected
|
|
468
|
+
// to be thrown when abort is called.
|
|
469
|
+
throw e;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// include: memoryprofiler.js
|
|
473
|
+
// end include: memoryprofiler.js
|
|
474
|
+
// include: URIUtils.js
|
|
475
|
+
// Prefix of data URIs emitted by SINGLE_FILE and related options.
|
|
476
|
+
var dataURIPrefix = 'data:application/octet-stream;base64,';
|
|
477
|
+
|
|
478
|
+
// Indicates whether filename is a base64 data URI.
|
|
479
|
+
function isDataURI(filename) {
|
|
480
|
+
// Prefix of data URIs emitted by SINGLE_FILE and related options.
|
|
481
|
+
return filename.startsWith(dataURIPrefix);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Indicates whether filename is delivered via file protocol (as opposed to http/https)
|
|
485
|
+
function isFileURI(filename) {
|
|
486
|
+
return filename.startsWith('file://');
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// end include: URIUtils.js
|
|
490
|
+
// include: runtime_exceptions.js
|
|
491
|
+
// end include: runtime_exceptions.js
|
|
492
|
+
var wasmBinaryFile;
|
|
493
|
+
wasmBinaryFile = 'wasmDbscan.wasm';
|
|
494
|
+
if (!isDataURI(wasmBinaryFile)) {
|
|
495
|
+
wasmBinaryFile = locateFile(wasmBinaryFile);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function getBinary(file) {
|
|
499
|
+
try {
|
|
500
|
+
if (file == wasmBinaryFile && wasmBinary) {
|
|
501
|
+
return new Uint8Array(wasmBinary);
|
|
502
|
+
}
|
|
503
|
+
if (readBinary) {
|
|
504
|
+
return readBinary(file);
|
|
505
|
+
}
|
|
506
|
+
throw "both async and sync fetching of the wasm failed";
|
|
507
|
+
}
|
|
508
|
+
catch (err) {
|
|
509
|
+
abort(err);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function getBinaryPromise(binaryFile) {
|
|
514
|
+
// If we don't have the binary yet, try to load it asynchronously.
|
|
515
|
+
// Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.
|
|
516
|
+
// See https://github.com/github/fetch/pull/92#issuecomment-140665932
|
|
517
|
+
// Cordova or Electron apps are typically loaded from a file:// url.
|
|
518
|
+
// So use fetch if it is available and the url is not a file, otherwise fall back to XHR.
|
|
519
|
+
if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
|
|
520
|
+
if (typeof fetch == 'function'
|
|
521
|
+
) {
|
|
522
|
+
return fetch(binaryFile, { credentials: 'same-origin' }).then(function(response) {
|
|
523
|
+
if (!response['ok']) {
|
|
524
|
+
throw "failed to load wasm binary file at '" + binaryFile + "'";
|
|
525
|
+
}
|
|
526
|
+
return response['arrayBuffer']();
|
|
527
|
+
}).catch(function () {
|
|
528
|
+
return getBinary(binaryFile);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Otherwise, getBinary should be able to get it synchronously
|
|
534
|
+
return Promise.resolve().then(function() { return getBinary(binaryFile); });
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function instantiateArrayBuffer(binaryFile, imports, receiver) {
|
|
538
|
+
return getBinaryPromise(binaryFile).then(function(binary) {
|
|
539
|
+
return WebAssembly.instantiate(binary, imports);
|
|
540
|
+
}).then(function (instance) {
|
|
541
|
+
return instance;
|
|
542
|
+
}).then(receiver, function(reason) {
|
|
543
|
+
err('failed to asynchronously prepare wasm: ' + reason);
|
|
544
|
+
|
|
545
|
+
abort(reason);
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function instantiateAsync(binary, binaryFile, imports, callback) {
|
|
550
|
+
if (!binary &&
|
|
551
|
+
typeof WebAssembly.instantiateStreaming == 'function' &&
|
|
552
|
+
!isDataURI(binaryFile) &&
|
|
553
|
+
typeof fetch == 'function') {
|
|
554
|
+
return fetch(binaryFile, { credentials: 'same-origin' }).then(function(response) {
|
|
555
|
+
// Suppress closure warning here since the upstream definition for
|
|
556
|
+
// instantiateStreaming only allows Promise<Repsponse> rather than
|
|
557
|
+
// an actual Response.
|
|
558
|
+
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed.
|
|
559
|
+
/** @suppress {checkTypes} */
|
|
560
|
+
var result = WebAssembly.instantiateStreaming(response, imports);
|
|
561
|
+
|
|
562
|
+
return result.then(
|
|
563
|
+
callback,
|
|
564
|
+
function(reason) {
|
|
565
|
+
// We expect the most common failure cause to be a bad MIME type for the binary,
|
|
566
|
+
// in which case falling back to ArrayBuffer instantiation should work.
|
|
567
|
+
err('wasm streaming compile failed: ' + reason);
|
|
568
|
+
err('falling back to ArrayBuffer instantiation');
|
|
569
|
+
return instantiateArrayBuffer(binaryFile, imports, callback);
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
} else {
|
|
573
|
+
return instantiateArrayBuffer(binaryFile, imports, callback);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Create the wasm instance.
|
|
578
|
+
// Receives the wasm imports, returns the exports.
|
|
579
|
+
function createWasm() {
|
|
580
|
+
// prepare imports
|
|
581
|
+
var info = {
|
|
582
|
+
'env': wasmImports,
|
|
583
|
+
'wasi_snapshot_preview1': wasmImports,
|
|
584
|
+
};
|
|
585
|
+
// Load the wasm module and create an instance of using native support in the JS engine.
|
|
586
|
+
// handle a generated wasm instance, receiving its exports and
|
|
587
|
+
// performing other necessary setup
|
|
588
|
+
/** @param {WebAssembly.Module=} module*/
|
|
589
|
+
function receiveInstance(instance, module) {
|
|
590
|
+
var exports = instance.exports;
|
|
591
|
+
|
|
592
|
+
Module['asm'] = exports;
|
|
593
|
+
|
|
594
|
+
wasmMemory = Module['asm']['memory'];
|
|
595
|
+
updateMemoryViews();
|
|
596
|
+
|
|
597
|
+
wasmTable = Module['asm']['__indirect_function_table'];
|
|
598
|
+
|
|
599
|
+
addOnInit(Module['asm']['__wasm_call_ctors']);
|
|
600
|
+
|
|
601
|
+
removeRunDependency('wasm-instantiate');
|
|
602
|
+
|
|
603
|
+
return exports;
|
|
604
|
+
}
|
|
605
|
+
// wait for the pthread pool (if any)
|
|
606
|
+
addRunDependency('wasm-instantiate');
|
|
607
|
+
|
|
608
|
+
// Prefer streaming instantiation if available.
|
|
609
|
+
function receiveInstantiationResult(result) {
|
|
610
|
+
// 'result' is a ResultObject object which has both the module and instance.
|
|
611
|
+
// receiveInstance() will swap in the exports (to Module.asm) so they can be called
|
|
612
|
+
// TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.
|
|
613
|
+
// When the regression is fixed, can restore the above PTHREADS-enabled path.
|
|
614
|
+
receiveInstance(result['instance']);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
|
|
618
|
+
// to manually instantiate the Wasm module themselves. This allows pages to
|
|
619
|
+
// run the instantiation parallel to any other async startup actions they are
|
|
620
|
+
// performing.
|
|
621
|
+
// Also pthreads and wasm workers initialize the wasm instance through this
|
|
622
|
+
// path.
|
|
623
|
+
if (Module['instantiateWasm']) {
|
|
624
|
+
|
|
625
|
+
try {
|
|
626
|
+
return Module['instantiateWasm'](info, receiveInstance);
|
|
627
|
+
} catch(e) {
|
|
628
|
+
err('Module.instantiateWasm callback failed with error: ' + e);
|
|
629
|
+
// If instantiation fails, reject the module ready promise.
|
|
630
|
+
readyPromiseReject(e);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// If instantiation fails, reject the module ready promise.
|
|
635
|
+
instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);
|
|
636
|
+
return {}; // no exports yet; we'll fill them in later
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// Globals used by JS i64 conversions (see makeSetValue)
|
|
640
|
+
var tempDouble;
|
|
641
|
+
var tempI64;
|
|
642
|
+
|
|
643
|
+
// include: runtime_debug.js
|
|
644
|
+
// end include: runtime_debug.js
|
|
645
|
+
// === Body ===
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
// end include: preamble.js
|
|
649
|
+
|
|
650
|
+
/** @constructor */
|
|
651
|
+
function ExitStatus(status) {
|
|
652
|
+
this.name = 'ExitStatus';
|
|
653
|
+
this.message = 'Program terminated with exit(' + status + ')';
|
|
654
|
+
this.status = status;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
function callRuntimeCallbacks(callbacks) {
|
|
658
|
+
while (callbacks.length > 0) {
|
|
659
|
+
// Pass the module as the first argument.
|
|
660
|
+
callbacks.shift()(Module);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* @param {number} ptr
|
|
667
|
+
* @param {string} type
|
|
668
|
+
*/
|
|
669
|
+
function getValue(ptr, type = 'i8') {
|
|
670
|
+
if (type.endsWith('*')) type = '*';
|
|
671
|
+
switch (type) {
|
|
672
|
+
case 'i1': return HEAP8[((ptr)>>0)];
|
|
673
|
+
case 'i8': return HEAP8[((ptr)>>0)];
|
|
674
|
+
case 'i16': return HEAP16[((ptr)>>1)];
|
|
675
|
+
case 'i32': return HEAP32[((ptr)>>2)];
|
|
676
|
+
case 'i64': return HEAP32[((ptr)>>2)];
|
|
677
|
+
case 'float': return HEAPF32[((ptr)>>2)];
|
|
678
|
+
case 'double': return HEAPF64[((ptr)>>3)];
|
|
679
|
+
case '*': return HEAPU32[((ptr)>>2)];
|
|
680
|
+
default: abort('invalid type for getValue: ' + type);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* @param {number} ptr
|
|
687
|
+
* @param {number} value
|
|
688
|
+
* @param {string} type
|
|
689
|
+
*/
|
|
690
|
+
function setValue(ptr, value, type = 'i8') {
|
|
691
|
+
if (type.endsWith('*')) type = '*';
|
|
692
|
+
switch (type) {
|
|
693
|
+
case 'i1': HEAP8[((ptr)>>0)] = value; break;
|
|
694
|
+
case 'i8': HEAP8[((ptr)>>0)] = value; break;
|
|
695
|
+
case 'i16': HEAP16[((ptr)>>1)] = value; break;
|
|
696
|
+
case 'i32': HEAP32[((ptr)>>2)] = value; break;
|
|
697
|
+
case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? ((Math.min((+(Math.floor((tempDouble)/4294967296.0))), 4294967295.0))|0)>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)],HEAP32[((ptr)>>2)] = tempI64[0],HEAP32[(((ptr)+(4))>>2)] = tempI64[1]); break;
|
|
698
|
+
case 'float': HEAPF32[((ptr)>>2)] = value; break;
|
|
699
|
+
case 'double': HEAPF64[((ptr)>>3)] = value; break;
|
|
700
|
+
case '*': HEAPU32[((ptr)>>2)] = value; break;
|
|
701
|
+
default: abort('invalid type for setValue: ' + type);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/** @constructor */
|
|
706
|
+
function ExceptionInfo(excPtr) {
|
|
707
|
+
this.excPtr = excPtr;
|
|
708
|
+
this.ptr = excPtr - 24;
|
|
709
|
+
|
|
710
|
+
this.set_type = function(type) {
|
|
711
|
+
HEAPU32[(((this.ptr)+(4))>>2)] = type;
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
this.get_type = function() {
|
|
715
|
+
return HEAPU32[(((this.ptr)+(4))>>2)];
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
this.set_destructor = function(destructor) {
|
|
719
|
+
HEAPU32[(((this.ptr)+(8))>>2)] = destructor;
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
this.get_destructor = function() {
|
|
723
|
+
return HEAPU32[(((this.ptr)+(8))>>2)];
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
this.set_caught = function (caught) {
|
|
727
|
+
caught = caught ? 1 : 0;
|
|
728
|
+
HEAP8[(((this.ptr)+(12))>>0)] = caught;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
this.get_caught = function () {
|
|
732
|
+
return HEAP8[(((this.ptr)+(12))>>0)] != 0;
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
this.set_rethrown = function (rethrown) {
|
|
736
|
+
rethrown = rethrown ? 1 : 0;
|
|
737
|
+
HEAP8[(((this.ptr)+(13))>>0)] = rethrown;
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
this.get_rethrown = function () {
|
|
741
|
+
return HEAP8[(((this.ptr)+(13))>>0)] != 0;
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
// Initialize native structure fields. Should be called once after allocated.
|
|
745
|
+
this.init = function(type, destructor) {
|
|
746
|
+
this.set_adjusted_ptr(0);
|
|
747
|
+
this.set_type(type);
|
|
748
|
+
this.set_destructor(destructor);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
this.set_adjusted_ptr = function(adjustedPtr) {
|
|
752
|
+
HEAPU32[(((this.ptr)+(16))>>2)] = adjustedPtr;
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
this.get_adjusted_ptr = function() {
|
|
756
|
+
return HEAPU32[(((this.ptr)+(16))>>2)];
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
// Get pointer which is expected to be received by catch clause in C++ code. It may be adjusted
|
|
760
|
+
// when the pointer is casted to some of the exception object base classes (e.g. when virtual
|
|
761
|
+
// inheritance is used). When a pointer is thrown this method should return the thrown pointer
|
|
762
|
+
// itself.
|
|
763
|
+
this.get_exception_ptr = function() {
|
|
764
|
+
// Work around a fastcomp bug, this code is still included for some reason in a build without
|
|
765
|
+
// exceptions support.
|
|
766
|
+
var isPointer = ___cxa_is_pointer_type(this.get_type());
|
|
767
|
+
if (isPointer) {
|
|
768
|
+
return HEAPU32[((this.excPtr)>>2)];
|
|
769
|
+
}
|
|
770
|
+
var adjusted = this.get_adjusted_ptr();
|
|
771
|
+
if (adjusted !== 0) return adjusted;
|
|
772
|
+
return this.excPtr;
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
var exceptionLast = 0;
|
|
777
|
+
|
|
778
|
+
var uncaughtExceptionCount = 0;
|
|
779
|
+
function ___cxa_throw(ptr, type, destructor) {
|
|
780
|
+
var info = new ExceptionInfo(ptr);
|
|
781
|
+
// Initialize ExceptionInfo content after it was allocated in __cxa_allocate_exception.
|
|
782
|
+
info.init(type, destructor);
|
|
783
|
+
exceptionLast = ptr;
|
|
784
|
+
uncaughtExceptionCount++;
|
|
785
|
+
throw exceptionLast;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function _abort() {
|
|
789
|
+
abort('');
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
function _emscripten_memcpy_big(dest, src, num) {
|
|
793
|
+
HEAPU8.copyWithin(dest, src, src + num);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
function getHeapMax() {
|
|
797
|
+
// Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
|
|
798
|
+
// full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
|
|
799
|
+
// for any code that deals with heap sizes, which would require special
|
|
800
|
+
// casing all heap size related code to treat 0 specially.
|
|
801
|
+
return 2147483648;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function emscripten_realloc_buffer(size) {
|
|
805
|
+
var b = wasmMemory.buffer;
|
|
806
|
+
try {
|
|
807
|
+
// round size grow request up to wasm page size (fixed 64KB per spec)
|
|
808
|
+
wasmMemory.grow((size - b.byteLength + 65535) >>> 16); // .grow() takes a delta compared to the previous size
|
|
809
|
+
updateMemoryViews();
|
|
810
|
+
return 1 /*success*/;
|
|
811
|
+
} catch(e) {
|
|
812
|
+
}
|
|
813
|
+
// implicit 0 return to save code size (caller will cast "undefined" into 0
|
|
814
|
+
// anyhow)
|
|
815
|
+
}
|
|
816
|
+
function _emscripten_resize_heap(requestedSize) {
|
|
817
|
+
var oldSize = HEAPU8.length;
|
|
818
|
+
requestedSize = requestedSize >>> 0;
|
|
819
|
+
// With multithreaded builds, races can happen (another thread might increase the size
|
|
820
|
+
// in between), so return a failure, and let the caller retry.
|
|
821
|
+
|
|
822
|
+
// Memory resize rules:
|
|
823
|
+
// 1. Always increase heap size to at least the requested size, rounded up
|
|
824
|
+
// to next page multiple.
|
|
825
|
+
// 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
|
|
826
|
+
// geometrically: increase the heap size according to
|
|
827
|
+
// MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
|
|
828
|
+
// overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
|
|
829
|
+
// 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
|
|
830
|
+
// linearly: increase the heap size by at least
|
|
831
|
+
// MEMORY_GROWTH_LINEAR_STEP bytes.
|
|
832
|
+
// 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
|
|
833
|
+
// MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
|
|
834
|
+
// 4. If we were unable to allocate as much memory, it may be due to
|
|
835
|
+
// over-eager decision to excessively reserve due to (3) above.
|
|
836
|
+
// Hence if an allocation fails, cut down on the amount of excess
|
|
837
|
+
// growth, in an attempt to succeed to perform a smaller allocation.
|
|
838
|
+
|
|
839
|
+
// A limit is set for how much we can grow. We should not exceed that
|
|
840
|
+
// (the wasm binary specifies it, so if we tried, we'd fail anyhow).
|
|
841
|
+
var maxHeapSize = getHeapMax();
|
|
842
|
+
if (requestedSize > maxHeapSize) {
|
|
843
|
+
return false;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
let alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple;
|
|
847
|
+
|
|
848
|
+
// Loop through potential heap size increases. If we attempt a too eager
|
|
849
|
+
// reservation that fails, cut down on the attempted size and reserve a
|
|
850
|
+
// smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
|
|
851
|
+
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
|
|
852
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); // ensure geometric growth
|
|
853
|
+
// but limit overreserving (default to capping at +96MB overgrowth at most)
|
|
854
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296 );
|
|
855
|
+
|
|
856
|
+
var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
857
|
+
|
|
858
|
+
var replacement = emscripten_realloc_buffer(newSize);
|
|
859
|
+
if (replacement) {
|
|
860
|
+
|
|
861
|
+
return true;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
function getCFunc(ident) {
|
|
868
|
+
var func = Module['_' + ident]; // closure exported function
|
|
869
|
+
return func;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
function writeArrayToMemory(array, buffer) {
|
|
874
|
+
HEAP8.set(array, buffer);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function lengthBytesUTF8(str) {
|
|
878
|
+
var len = 0;
|
|
879
|
+
for (var i = 0; i < str.length; ++i) {
|
|
880
|
+
// Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
|
|
881
|
+
// unit, not a Unicode code point of the character! So decode
|
|
882
|
+
// UTF16->UTF32->UTF8.
|
|
883
|
+
// See http://unicode.org/faq/utf_bom.html#utf16-3
|
|
884
|
+
var c = str.charCodeAt(i); // possibly a lead surrogate
|
|
885
|
+
if (c <= 0x7F) {
|
|
886
|
+
len++;
|
|
887
|
+
} else if (c <= 0x7FF) {
|
|
888
|
+
len += 2;
|
|
889
|
+
} else if (c >= 0xD800 && c <= 0xDFFF) {
|
|
890
|
+
len += 4; ++i;
|
|
891
|
+
} else {
|
|
892
|
+
len += 3;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
return len;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) {
|
|
899
|
+
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
900
|
+
// undefined and false each don't write out any bytes.
|
|
901
|
+
if (!(maxBytesToWrite > 0))
|
|
902
|
+
return 0;
|
|
903
|
+
|
|
904
|
+
var startIdx = outIdx;
|
|
905
|
+
var endIdx = outIdx + maxBytesToWrite - 1; // -1 for string null terminator.
|
|
906
|
+
for (var i = 0; i < str.length; ++i) {
|
|
907
|
+
// Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
|
|
908
|
+
// unit, not a Unicode code point of the character! So decode
|
|
909
|
+
// UTF16->UTF32->UTF8.
|
|
910
|
+
// See http://unicode.org/faq/utf_bom.html#utf16-3
|
|
911
|
+
// For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
|
|
912
|
+
// and https://www.ietf.org/rfc/rfc2279.txt
|
|
913
|
+
// and https://tools.ietf.org/html/rfc3629
|
|
914
|
+
var u = str.charCodeAt(i); // possibly a lead surrogate
|
|
915
|
+
if (u >= 0xD800 && u <= 0xDFFF) {
|
|
916
|
+
var u1 = str.charCodeAt(++i);
|
|
917
|
+
u = 0x10000 + ((u & 0x3FF) << 10) | (u1 & 0x3FF);
|
|
918
|
+
}
|
|
919
|
+
if (u <= 0x7F) {
|
|
920
|
+
if (outIdx >= endIdx) break;
|
|
921
|
+
heap[outIdx++] = u;
|
|
922
|
+
} else if (u <= 0x7FF) {
|
|
923
|
+
if (outIdx + 1 >= endIdx) break;
|
|
924
|
+
heap[outIdx++] = 0xC0 | (u >> 6);
|
|
925
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
926
|
+
} else if (u <= 0xFFFF) {
|
|
927
|
+
if (outIdx + 2 >= endIdx) break;
|
|
928
|
+
heap[outIdx++] = 0xE0 | (u >> 12);
|
|
929
|
+
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
930
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
931
|
+
} else {
|
|
932
|
+
if (outIdx + 3 >= endIdx) break;
|
|
933
|
+
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
934
|
+
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
935
|
+
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
936
|
+
heap[outIdx++] = 0x80 | (u & 63);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
// Null-terminate the pointer to the buffer.
|
|
940
|
+
heap[outIdx] = 0;
|
|
941
|
+
return outIdx - startIdx;
|
|
942
|
+
}
|
|
943
|
+
function stringToUTF8(str, outPtr, maxBytesToWrite) {
|
|
944
|
+
return stringToUTF8Array(str, HEAPU8,outPtr, maxBytesToWrite);
|
|
945
|
+
}
|
|
946
|
+
function stringToUTF8OnStack(str) {
|
|
947
|
+
var size = lengthBytesUTF8(str) + 1;
|
|
948
|
+
var ret = stackAlloc(size);
|
|
949
|
+
stringToUTF8(str, ret, size);
|
|
950
|
+
return ret;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder('utf8') : undefined;
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
|
|
957
|
+
* array that contains uint8 values, returns a copy of that string as a
|
|
958
|
+
* Javascript String object.
|
|
959
|
+
* heapOrArray is either a regular array, or a JavaScript typed array view.
|
|
960
|
+
* @param {number} idx
|
|
961
|
+
* @param {number=} maxBytesToRead
|
|
962
|
+
* @return {string}
|
|
963
|
+
*/
|
|
964
|
+
function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) {
|
|
965
|
+
var endIdx = idx + maxBytesToRead;
|
|
966
|
+
var endPtr = idx;
|
|
967
|
+
// TextDecoder needs to know the byte length in advance, it doesn't stop on
|
|
968
|
+
// null terminator by itself. Also, use the length info to avoid running tiny
|
|
969
|
+
// strings through TextDecoder, since .subarray() allocates garbage.
|
|
970
|
+
// (As a tiny code save trick, compare endPtr against endIdx using a negation,
|
|
971
|
+
// so that undefined means Infinity)
|
|
972
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
|
|
973
|
+
|
|
974
|
+
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
975
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
976
|
+
}
|
|
977
|
+
var str = '';
|
|
978
|
+
// If building with TextDecoder, we have already computed the string length
|
|
979
|
+
// above, so test loop end condition against that
|
|
980
|
+
while (idx < endPtr) {
|
|
981
|
+
// For UTF8 byte structure, see:
|
|
982
|
+
// http://en.wikipedia.org/wiki/UTF-8#Description
|
|
983
|
+
// https://www.ietf.org/rfc/rfc2279.txt
|
|
984
|
+
// https://tools.ietf.org/html/rfc3629
|
|
985
|
+
var u0 = heapOrArray[idx++];
|
|
986
|
+
if (!(u0 & 0x80)) { str += String.fromCharCode(u0); continue; }
|
|
987
|
+
var u1 = heapOrArray[idx++] & 63;
|
|
988
|
+
if ((u0 & 0xE0) == 0xC0) { str += String.fromCharCode(((u0 & 31) << 6) | u1); continue; }
|
|
989
|
+
var u2 = heapOrArray[idx++] & 63;
|
|
990
|
+
if ((u0 & 0xF0) == 0xE0) {
|
|
991
|
+
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
|
|
992
|
+
} else {
|
|
993
|
+
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (u0 < 0x10000) {
|
|
997
|
+
str += String.fromCharCode(u0);
|
|
998
|
+
} else {
|
|
999
|
+
var ch = u0 - 0x10000;
|
|
1000
|
+
str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return str;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
|
|
1009
|
+
* emscripten HEAP, returns a copy of that string as a Javascript String object.
|
|
1010
|
+
*
|
|
1011
|
+
* @param {number} ptr
|
|
1012
|
+
* @param {number=} maxBytesToRead - An optional length that specifies the
|
|
1013
|
+
* maximum number of bytes to read. You can omit this parameter to scan the
|
|
1014
|
+
* string until the first byte. If maxBytesToRead is passed, and the string
|
|
1015
|
+
* at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
|
|
1016
|
+
* string will cut short at that byte index (i.e. maxBytesToRead will not
|
|
1017
|
+
* produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
|
|
1018
|
+
* frequent uses of UTF8ToString() with and without maxBytesToRead may throw
|
|
1019
|
+
* JS JIT optimizations off, so it is worth to consider consistently using one
|
|
1020
|
+
* @return {string}
|
|
1021
|
+
*/
|
|
1022
|
+
function UTF8ToString(ptr, maxBytesToRead) {
|
|
1023
|
+
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* @param {string|null=} returnType
|
|
1028
|
+
* @param {Array=} argTypes
|
|
1029
|
+
* @param {Arguments|Array=} args
|
|
1030
|
+
* @param {Object=} opts
|
|
1031
|
+
*/
|
|
1032
|
+
function ccall(ident, returnType, argTypes, args, opts) {
|
|
1033
|
+
// For fast lookup of conversion functions
|
|
1034
|
+
var toC = {
|
|
1035
|
+
'string': (str) => {
|
|
1036
|
+
var ret = 0;
|
|
1037
|
+
if (str !== null && str !== undefined && str !== 0) { // null string
|
|
1038
|
+
// at most 4 bytes per UTF-8 code point, +1 for the trailing '\0'
|
|
1039
|
+
ret = stringToUTF8OnStack(str);
|
|
1040
|
+
}
|
|
1041
|
+
return ret;
|
|
1042
|
+
},
|
|
1043
|
+
'array': (arr) => {
|
|
1044
|
+
var ret = stackAlloc(arr.length);
|
|
1045
|
+
writeArrayToMemory(arr, ret);
|
|
1046
|
+
return ret;
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
function convertReturnValue(ret) {
|
|
1051
|
+
if (returnType === 'string') {
|
|
1052
|
+
|
|
1053
|
+
return UTF8ToString(ret);
|
|
1054
|
+
}
|
|
1055
|
+
if (returnType === 'boolean') return Boolean(ret);
|
|
1056
|
+
return ret;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
var func = getCFunc(ident);
|
|
1060
|
+
var cArgs = [];
|
|
1061
|
+
var stack = 0;
|
|
1062
|
+
if (args) {
|
|
1063
|
+
for (var i = 0; i < args.length; i++) {
|
|
1064
|
+
var converter = toC[argTypes[i]];
|
|
1065
|
+
if (converter) {
|
|
1066
|
+
if (stack === 0) stack = stackSave();
|
|
1067
|
+
cArgs[i] = converter(args[i]);
|
|
1068
|
+
} else {
|
|
1069
|
+
cArgs[i] = args[i];
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
var ret = func.apply(null, cArgs);
|
|
1074
|
+
function onDone(ret) {
|
|
1075
|
+
if (stack !== 0) stackRestore(stack);
|
|
1076
|
+
return convertReturnValue(ret);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
ret = onDone(ret);
|
|
1080
|
+
return ret;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* @param {string=} returnType
|
|
1085
|
+
* @param {Array=} argTypes
|
|
1086
|
+
* @param {Object=} opts
|
|
1087
|
+
*/
|
|
1088
|
+
function cwrap(ident, returnType, argTypes, opts) {
|
|
1089
|
+
// When the function takes numbers and returns a number, we can just return
|
|
1090
|
+
// the original function
|
|
1091
|
+
var numericArgs = !argTypes || argTypes.every((type) => type === 'number' || type === 'boolean');
|
|
1092
|
+
var numericRet = returnType !== 'string';
|
|
1093
|
+
if (numericRet && numericArgs && !opts) {
|
|
1094
|
+
return getCFunc(ident);
|
|
1095
|
+
}
|
|
1096
|
+
return function() {
|
|
1097
|
+
return ccall(ident, returnType, argTypes, arguments, opts);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
var wasmImports = {
|
|
1102
|
+
"__cxa_throw": ___cxa_throw,
|
|
1103
|
+
"abort": _abort,
|
|
1104
|
+
"emscripten_memcpy_big": _emscripten_memcpy_big,
|
|
1105
|
+
"emscripten_resize_heap": _emscripten_resize_heap
|
|
1106
|
+
};
|
|
1107
|
+
var asm = createWasm();
|
|
1108
|
+
/** @type {function(...*):?} */
|
|
1109
|
+
var ___wasm_call_ctors = function() {
|
|
1110
|
+
return (___wasm_call_ctors = Module["asm"]["__wasm_call_ctors"]).apply(null, arguments);
|
|
1111
|
+
};
|
|
1112
|
+
|
|
1113
|
+
/** @type {function(...*):?} */
|
|
1114
|
+
var _dbscan = Module["_dbscan"] = function() {
|
|
1115
|
+
return (_dbscan = Module["_dbscan"] = Module["asm"]["dbscan"]).apply(null, arguments);
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
/** @type {function(...*):?} */
|
|
1119
|
+
var ___errno_location = function() {
|
|
1120
|
+
return (___errno_location = Module["asm"]["__errno_location"]).apply(null, arguments);
|
|
1121
|
+
};
|
|
1122
|
+
|
|
1123
|
+
/** @type {function(...*):?} */
|
|
1124
|
+
var _malloc = Module["_malloc"] = function() {
|
|
1125
|
+
return (_malloc = Module["_malloc"] = Module["asm"]["malloc"]).apply(null, arguments);
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
/** @type {function(...*):?} */
|
|
1129
|
+
var _free = Module["_free"] = function() {
|
|
1130
|
+
return (_free = Module["_free"] = Module["asm"]["free"]).apply(null, arguments);
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
/** @type {function(...*):?} */
|
|
1134
|
+
var stackSave = function() {
|
|
1135
|
+
return (stackSave = Module["asm"]["stackSave"]).apply(null, arguments);
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
/** @type {function(...*):?} */
|
|
1139
|
+
var stackRestore = function() {
|
|
1140
|
+
return (stackRestore = Module["asm"]["stackRestore"]).apply(null, arguments);
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
/** @type {function(...*):?} */
|
|
1144
|
+
var stackAlloc = function() {
|
|
1145
|
+
return (stackAlloc = Module["asm"]["stackAlloc"]).apply(null, arguments);
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1148
|
+
/** @type {function(...*):?} */
|
|
1149
|
+
var ___cxa_is_pointer_type = function() {
|
|
1150
|
+
return (___cxa_is_pointer_type = Module["asm"]["__cxa_is_pointer_type"]).apply(null, arguments);
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
|
|
1155
|
+
// include: postamble.js
|
|
1156
|
+
// === Auto-generated postamble setup entry stuff ===
|
|
1157
|
+
|
|
1158
|
+
Module["ccall"] = ccall;
|
|
1159
|
+
Module["cwrap"] = cwrap;
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
var calledRun;
|
|
1163
|
+
|
|
1164
|
+
dependenciesFulfilled = function runCaller() {
|
|
1165
|
+
// If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false)
|
|
1166
|
+
if (!calledRun) run();
|
|
1167
|
+
if (!calledRun) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
|
|
1168
|
+
};
|
|
1169
|
+
|
|
1170
|
+
function run() {
|
|
1171
|
+
|
|
1172
|
+
if (runDependencies > 0) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
preRun();
|
|
1177
|
+
|
|
1178
|
+
// a preRun added a dependency, run will be called later
|
|
1179
|
+
if (runDependencies > 0) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
function doRun() {
|
|
1184
|
+
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
1185
|
+
// or while the async setStatus time below was happening
|
|
1186
|
+
if (calledRun) return;
|
|
1187
|
+
calledRun = true;
|
|
1188
|
+
Module['calledRun'] = true;
|
|
1189
|
+
|
|
1190
|
+
if (ABORT) return;
|
|
1191
|
+
|
|
1192
|
+
initRuntime();
|
|
1193
|
+
|
|
1194
|
+
readyPromiseResolve(Module);
|
|
1195
|
+
if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();
|
|
1196
|
+
|
|
1197
|
+
postRun();
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (Module['setStatus']) {
|
|
1201
|
+
Module['setStatus']('Running...');
|
|
1202
|
+
setTimeout(function() {
|
|
1203
|
+
setTimeout(function() {
|
|
1204
|
+
Module['setStatus']('');
|
|
1205
|
+
}, 1);
|
|
1206
|
+
doRun();
|
|
1207
|
+
}, 1);
|
|
1208
|
+
} else
|
|
1209
|
+
{
|
|
1210
|
+
doRun();
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
if (Module['preInit']) {
|
|
1215
|
+
if (typeof Module['preInit'] == 'function') Module['preInit'] = [Module['preInit']];
|
|
1216
|
+
while (Module['preInit'].length > 0) {
|
|
1217
|
+
Module['preInit'].pop()();
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
run();
|
|
1222
|
+
|
|
1223
|
+
|
|
1224
|
+
// end include: postamble.js
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
return exportCppDbscanLib.ready
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
);
|
|
1231
|
+
})();
|
|
1232
|
+
if (typeof exports === 'object' && "object" === 'object')
|
|
1233
|
+
module.exports = exportCppDbscanLib;
|
|
1234
|
+
else if (typeof define === 'function' && __webpack_require__.amdO)
|
|
1235
|
+
define([], function() { return exportCppDbscanLib; });
|
|
1236
|
+
else if (typeof exports === 'object')
|
|
1237
|
+
exports["exportCppDbscanLib"] = exportCppDbscanLib;
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
/***/ }),
|
|
1241
|
+
|
|
1242
|
+
/***/ "./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.wasm":
|
|
1243
|
+
/*!*******************************************************************************!*\
|
|
1244
|
+
!*** ./node_modules/@datagrok-libraries/math/src/dbscan/wasm/wasmDbscan.wasm ***!
|
|
1245
|
+
\*******************************************************************************/
|
|
1246
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1247
|
+
|
|
1248
|
+
module.exports = __webpack_require__.p + "9a8fbf37666e32487835.wasm";
|
|
1249
|
+
|
|
1250
|
+
/***/ })
|
|
1251
|
+
|
|
1252
|
+
}]);
|
|
1253
|
+
//# sourceMappingURL=vendors-node_modules_datagrok-libraries_math_src_dbscan_wasm_dbscan_js.js.map
|