@xeokit/xeokit-sdk 2.6.69 → 2.6.71
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/xeokit-sdk.cjs.js +4332 -207
- package/dist/xeokit-sdk.es.js +4332 -208
- package/dist/xeokit-sdk.es5.js +221 -204
- package/dist/xeokit-sdk.min.cjs.js +10 -4
- package/dist/xeokit-sdk.min.es.js +11 -5
- package/dist/xeokit-sdk.min.es5.js +10 -4
- package/package.json +3 -1
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +86 -0
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -0
- package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +13 -1
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +89 -43
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +4 -3
- package/src/plugins/index.js +1 -0
- package/src/viewer/scene/math/math.js +14 -2
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +2 -19
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -19
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +2 -19
- package/types/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.d.ts +36 -0
- package/types/plugins/CxConverterIFCLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/index.d.ts +1 -0
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* xeokit-sdk v2.6.71
|
|
3
|
+
* Commit: 7443626ab66b3eab0018b1ed0ee05d3bfa9f8eae
|
|
4
|
+
* Built: 2025-03-21T09:02:29.217Z
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
/** @private */
|
|
2
8
|
class Map$1 {
|
|
3
9
|
|
|
@@ -1462,8 +1468,20 @@ const math = {
|
|
|
1462
1468
|
* @static
|
|
1463
1469
|
* @returns {Number[]}
|
|
1464
1470
|
*/
|
|
1465
|
-
mat4ToMat3(mat4, mat3) {
|
|
1466
|
-
|
|
1471
|
+
mat4ToMat3(mat4, mat3 = new FloatArrayType(9)) {
|
|
1472
|
+
mat3[0] = mat4[0];
|
|
1473
|
+
mat3[1] = mat4[1];
|
|
1474
|
+
mat3[2] = mat4[2];
|
|
1475
|
+
|
|
1476
|
+
mat3[3] = mat4[4];
|
|
1477
|
+
mat3[4] = mat4[5];
|
|
1478
|
+
mat3[5] = mat4[6];
|
|
1479
|
+
|
|
1480
|
+
mat3[6] = mat4[8];
|
|
1481
|
+
mat3[7] = mat4[9];
|
|
1482
|
+
mat3[8] = mat4[10];
|
|
1483
|
+
|
|
1484
|
+
return mat3;
|
|
1467
1485
|
},
|
|
1468
1486
|
|
|
1469
1487
|
/**
|
|
@@ -56920,6 +56938,8 @@ class TrianglesSnapInitRenderer$1 extends VBORenderer {
|
|
|
56920
56938
|
state.indicesBuf.bind();
|
|
56921
56939
|
gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);
|
|
56922
56940
|
state.indicesBuf.unbind();
|
|
56941
|
+
|
|
56942
|
+
gl.bindVertexArray(null);
|
|
56923
56943
|
}
|
|
56924
56944
|
|
|
56925
56945
|
_allocate() {
|
|
@@ -57236,6 +57256,8 @@ class TrianglesSnapRenderer$1 extends VBORenderer{
|
|
|
57236
57256
|
} else {
|
|
57237
57257
|
gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);
|
|
57238
57258
|
}
|
|
57259
|
+
|
|
57260
|
+
gl.bindVertexArray(null);
|
|
57239
57261
|
}
|
|
57240
57262
|
|
|
57241
57263
|
_allocate() {
|
|
@@ -62349,34 +62371,11 @@ class TrianglesSnapInitRenderer extends VBORenderer {
|
|
|
62349
62371
|
|
|
62350
62372
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
62351
62373
|
|
|
62352
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
62353
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
62354
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
62355
|
-
|
|
62356
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
62357
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
62358
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
62359
|
-
|
|
62360
|
-
|
|
62361
|
-
if (this._aFlags) {
|
|
62362
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
62363
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
62364
|
-
}
|
|
62365
|
-
|
|
62366
62374
|
state.indicesBuf.bind();
|
|
62367
62375
|
gl.drawElementsInstanced(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);
|
|
62368
62376
|
state.indicesBuf.unbind();
|
|
62369
62377
|
|
|
62370
|
-
|
|
62371
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);
|
|
62372
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
62373
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
62374
|
-
if (this._aFlags) {
|
|
62375
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
62376
|
-
}
|
|
62377
|
-
if (this._aOffset) {
|
|
62378
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
62379
|
-
}
|
|
62378
|
+
gl.bindVertexArray(null);
|
|
62380
62379
|
}
|
|
62381
62380
|
|
|
62382
62381
|
_allocate() {
|
|
@@ -62685,17 +62684,6 @@ class TrianglesSnapRenderer extends VBORenderer {
|
|
|
62685
62684
|
|
|
62686
62685
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
62687
62686
|
|
|
62688
|
-
|
|
62689
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
62690
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
62691
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
62692
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
62693
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
62694
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
62695
|
-
|
|
62696
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
62697
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
62698
|
-
|
|
62699
62687
|
if (frameCtx.snapMode === "edge" ) {
|
|
62700
62688
|
if (state.edgeIndicesBuf) {
|
|
62701
62689
|
state.edgeIndicesBuf.bind();
|
|
@@ -62705,14 +62693,8 @@ class TrianglesSnapRenderer extends VBORenderer {
|
|
|
62705
62693
|
} else {
|
|
62706
62694
|
gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);
|
|
62707
62695
|
}
|
|
62708
|
-
|
|
62709
|
-
gl.
|
|
62710
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
62711
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
62712
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
62713
|
-
if (this._aOffset) {
|
|
62714
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
62715
|
-
}
|
|
62696
|
+
|
|
62697
|
+
gl.bindVertexArray(null);
|
|
62716
62698
|
}
|
|
62717
62699
|
|
|
62718
62700
|
_allocate() {
|
|
@@ -64876,6 +64858,8 @@ class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
|
|
|
64876
64858
|
state.indicesBuf.bind();
|
|
64877
64859
|
gl.drawElements(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);
|
|
64878
64860
|
state.indicesBuf.unbind();
|
|
64861
|
+
|
|
64862
|
+
gl.bindVertexArray(null);
|
|
64879
64863
|
}
|
|
64880
64864
|
|
|
64881
64865
|
_allocate() {
|
|
@@ -65190,6 +65174,8 @@ class VBOBatchingLinesSnapRenderer extends VBORenderer{
|
|
|
65190
65174
|
} else {
|
|
65191
65175
|
gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);
|
|
65192
65176
|
}
|
|
65177
|
+
|
|
65178
|
+
gl.bindVertexArray(null);
|
|
65193
65179
|
}
|
|
65194
65180
|
|
|
65195
65181
|
_allocate() {
|
|
@@ -66582,34 +66568,11 @@ class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
|
|
|
66582
66568
|
|
|
66583
66569
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
66584
66570
|
|
|
66585
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
66586
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
66587
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
66588
|
-
|
|
66589
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
66590
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
66591
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
66592
|
-
|
|
66593
|
-
|
|
66594
|
-
if (this._aFlags) {
|
|
66595
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
66596
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
66597
|
-
}
|
|
66598
|
-
|
|
66599
66571
|
state.indicesBuf.bind();
|
|
66600
66572
|
gl.drawElementsInstanced(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);
|
|
66601
66573
|
state.indicesBuf.unbind();
|
|
66602
66574
|
|
|
66603
|
-
|
|
66604
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);
|
|
66605
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
66606
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
66607
|
-
if (this._aFlags) {
|
|
66608
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
66609
|
-
}
|
|
66610
|
-
if (this._aOffset) {
|
|
66611
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
66612
|
-
}
|
|
66575
|
+
gl.bindVertexArray(null);
|
|
66613
66576
|
}
|
|
66614
66577
|
|
|
66615
66578
|
_allocate() {
|
|
@@ -66907,17 +66870,6 @@ class VBOInstancingLinesSnapRenderer extends VBORenderer {
|
|
|
66907
66870
|
|
|
66908
66871
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
66909
66872
|
|
|
66910
|
-
|
|
66911
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
66912
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
66913
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
66914
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
66915
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
66916
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
66917
|
-
|
|
66918
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
66919
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
66920
|
-
|
|
66921
66873
|
if (frameCtx.snapMode === "edge") {
|
|
66922
66874
|
state.indicesBuf.bind();
|
|
66923
66875
|
gl.drawElementsInstanced(gl.LINES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0, state.numInstances);
|
|
@@ -66925,14 +66877,8 @@ class VBOInstancingLinesSnapRenderer extends VBORenderer {
|
|
|
66925
66877
|
} else {
|
|
66926
66878
|
gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);
|
|
66927
66879
|
}
|
|
66928
|
-
|
|
66929
|
-
gl.
|
|
66930
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
66931
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
66932
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
66933
|
-
if (this._aOffset) {
|
|
66934
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
66935
|
-
}
|
|
66880
|
+
|
|
66881
|
+
gl.bindVertexArray(null);
|
|
66936
66882
|
}
|
|
66937
66883
|
|
|
66938
66884
|
_allocate() {
|
|
@@ -68828,6 +68774,8 @@ class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
|
|
|
68828
68774
|
//=============================================================
|
|
68829
68775
|
|
|
68830
68776
|
gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);
|
|
68777
|
+
|
|
68778
|
+
gl.bindVertexArray(null);
|
|
68831
68779
|
}
|
|
68832
68780
|
|
|
68833
68781
|
_allocate() {
|
|
@@ -69139,6 +69087,8 @@ class VBOBatchingPointsSnapRenderer extends VBORenderer{
|
|
|
69139
69087
|
//=============================================================
|
|
69140
69088
|
|
|
69141
69089
|
gl.drawArrays(gl.POINTS, 0, state.positionsBuf.numItems);
|
|
69090
|
+
|
|
69091
|
+
gl.bindVertexArray(null);
|
|
69142
69092
|
}
|
|
69143
69093
|
|
|
69144
69094
|
_allocate() {
|
|
@@ -71329,32 +71279,9 @@ class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
|
|
|
71329
71279
|
|
|
71330
71280
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
71331
71281
|
|
|
71332
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
71333
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
71334
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
71335
|
-
|
|
71336
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
71337
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
71338
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
71339
|
-
|
|
71340
|
-
|
|
71341
|
-
if (this._aFlags) {
|
|
71342
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
71343
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
71344
|
-
}
|
|
71345
|
-
|
|
71346
71282
|
gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);
|
|
71347
71283
|
|
|
71348
|
-
|
|
71349
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);
|
|
71350
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
71351
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
71352
|
-
if (this._aFlags) {
|
|
71353
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
71354
|
-
}
|
|
71355
|
-
if (this._aOffset) {
|
|
71356
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
71357
|
-
}
|
|
71284
|
+
gl.bindVertexArray(null);
|
|
71358
71285
|
}
|
|
71359
71286
|
|
|
71360
71287
|
_allocate() {
|
|
@@ -71653,27 +71580,9 @@ class VBOInstancingPointsSnapRenderer extends VBORenderer {
|
|
|
71653
71580
|
|
|
71654
71581
|
this.setSectionPlanesStateUniforms(instancingLayer);
|
|
71655
71582
|
|
|
71656
|
-
|
|
71657
|
-
this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);
|
|
71658
|
-
this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);
|
|
71659
|
-
this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);
|
|
71660
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 1);
|
|
71661
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 1);
|
|
71662
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 1);
|
|
71663
|
-
|
|
71664
|
-
this._aFlags.bindArrayBuffer(state.flagsBuf);
|
|
71665
|
-
gl.vertexAttribDivisor(this._aFlags.location, 1);
|
|
71666
|
-
|
|
71667
71583
|
gl.drawArraysInstanced(gl.POINTS, 0, state.positionsBuf.numItems, state.numInstances);
|
|
71668
71584
|
|
|
71669
|
-
|
|
71670
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol0.location, 0);
|
|
71671
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol1.location, 0);
|
|
71672
|
-
gl.vertexAttribDivisor(this._aModelMatrixCol2.location, 0);
|
|
71673
|
-
gl.vertexAttribDivisor(this._aFlags.location, 0);
|
|
71674
|
-
if (this._aOffset) {
|
|
71675
|
-
gl.vertexAttribDivisor(this._aOffset.location, 0);
|
|
71676
|
-
}
|
|
71585
|
+
gl.bindVertexArray(null);
|
|
71677
71586
|
}
|
|
71678
71587
|
|
|
71679
71588
|
_allocate() {
|
|
@@ -112616,13 +112525,13 @@ function getTableHeader(table) {
|
|
|
112616
112525
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
112617
112526
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
112618
112527
|
const VERSION$6 = "4.3.2" ;
|
|
112619
|
-
const version = VERSION$6[0] >= '0' && VERSION$6[0] <= '9' ? `v${VERSION$6}` : '';
|
|
112528
|
+
const version$1 = VERSION$6[0] >= '0' && VERSION$6[0] <= '9' ? `v${VERSION$6}` : '';
|
|
112620
112529
|
// Make sure we set the global variable
|
|
112621
112530
|
function createLog() {
|
|
112622
112531
|
const log = new Log({ id: 'loaders.gl' });
|
|
112623
112532
|
globalThis.loaders = globalThis.loaders || {};
|
|
112624
112533
|
globalThis.loaders.log = log;
|
|
112625
|
-
globalThis.loaders.version = version;
|
|
112534
|
+
globalThis.loaders.version = version$1;
|
|
112626
112535
|
globalThis.probe = globalThis.probe || {};
|
|
112627
112536
|
globalThis.probe.loaders = log;
|
|
112628
112537
|
return log;
|
|
@@ -114175,7 +114084,7 @@ function isDataURL(url) {
|
|
|
114175
114084
|
* - Supports fetching from Node.js local file system paths
|
|
114176
114085
|
* - Respects pathPrefix and file aliases
|
|
114177
114086
|
*/
|
|
114178
|
-
async function fetchFile(urlOrData, fetchOptions) {
|
|
114087
|
+
async function fetchFile$1(urlOrData, fetchOptions) {
|
|
114179
114088
|
if (typeof urlOrData === 'string') {
|
|
114180
114089
|
const url = resolvePath(urlOrData);
|
|
114181
114090
|
// Support fetching from local file system
|
|
@@ -115005,14 +114914,14 @@ function getFetchFunction(options, context) {
|
|
|
115005
114914
|
}
|
|
115006
114915
|
// options.fetch can be an options object
|
|
115007
114916
|
if (isObject(loaderOptions.fetch)) {
|
|
115008
|
-
return (url) => fetchFile(url, loaderOptions.fetch);
|
|
114917
|
+
return (url) => fetchFile$1(url, loaderOptions.fetch);
|
|
115009
114918
|
}
|
|
115010
114919
|
// else refer to context (from parent loader) if available
|
|
115011
114920
|
if (context?.fetch) {
|
|
115012
114921
|
return context?.fetch;
|
|
115013
114922
|
}
|
|
115014
114923
|
// else return the default fetch function
|
|
115015
|
-
return fetchFile;
|
|
114924
|
+
return fetchFile$1;
|
|
115016
114925
|
}
|
|
115017
114926
|
|
|
115018
114927
|
// loaders.gl
|
|
@@ -116929,7 +116838,7 @@ function getPropertyDataString(numberOfElements, valuesDataBytes, arrayOffsets,
|
|
|
116929
116838
|
}
|
|
116930
116839
|
|
|
116931
116840
|
const EXT_MESH_FEATURES_NAME = 'EXT_mesh_features';
|
|
116932
|
-
const name$
|
|
116841
|
+
const name$b = EXT_MESH_FEATURES_NAME;
|
|
116933
116842
|
async function decode$9(gltfData, options) {
|
|
116934
116843
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
116935
116844
|
decodeExtMeshFeatures(scenegraph, options);
|
|
@@ -117104,14 +117013,14 @@ function createAccessorKey(attributes) {
|
|
|
117104
117013
|
|
|
117105
117014
|
var EXT_mesh_features = /*#__PURE__*/Object.freeze({
|
|
117106
117015
|
__proto__: null,
|
|
117107
|
-
name: name$
|
|
117016
|
+
name: name$b,
|
|
117108
117017
|
decode: decode$9,
|
|
117109
117018
|
encode: encode$5,
|
|
117110
117019
|
createExtMeshFeatures: createExtMeshFeatures
|
|
117111
117020
|
});
|
|
117112
117021
|
|
|
117113
117022
|
const EXT_STRUCTURAL_METADATA_NAME = 'EXT_structural_metadata';
|
|
117114
|
-
const name$
|
|
117023
|
+
const name$a = EXT_STRUCTURAL_METADATA_NAME;
|
|
117115
117024
|
async function decode$8(gltfData, options) {
|
|
117116
117025
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
117117
117026
|
decodeExtStructuralMetadata(scenegraph, options);
|
|
@@ -117765,7 +117674,7 @@ function createBufferView(typedArray, scenegraph) {
|
|
|
117765
117674
|
|
|
117766
117675
|
var EXT_structural_metadata = /*#__PURE__*/Object.freeze({
|
|
117767
117676
|
__proto__: null,
|
|
117768
|
-
name: name$
|
|
117677
|
+
name: name$a,
|
|
117769
117678
|
decode: decode$8,
|
|
117770
117679
|
encode: encode$4,
|
|
117771
117680
|
createExtStructuralMetadata: createExtStructuralMetadata
|
|
@@ -117773,7 +117682,7 @@ var EXT_structural_metadata = /*#__PURE__*/Object.freeze({
|
|
|
117773
117682
|
|
|
117774
117683
|
/** Extension name */
|
|
117775
117684
|
const EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';
|
|
117776
|
-
const name$
|
|
117685
|
+
const name$9 = EXT_FEATURE_METADATA_NAME;
|
|
117777
117686
|
async function decode$7(gltfData, options) {
|
|
117778
117687
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
117779
117688
|
decodeExtFeatureMetadata(scenegraph, options);
|
|
@@ -118071,7 +117980,7 @@ function processPrimitiveTextures(scenegraph, attributeName, featureTexturePrope
|
|
|
118071
117980
|
|
|
118072
117981
|
var EXT_feature_metadata = /*#__PURE__*/Object.freeze({
|
|
118073
117982
|
__proto__: null,
|
|
118074
|
-
name: name$
|
|
117983
|
+
name: name$9,
|
|
118075
117984
|
decode: decode$7
|
|
118076
117985
|
});
|
|
118077
117986
|
|
|
@@ -118889,7 +118798,7 @@ function decode$6(instance, fun, target, count, size, source, filter) {
|
|
|
118889
118798
|
|
|
118890
118799
|
/** Extension name */
|
|
118891
118800
|
const EXT_MESHOPT_COMPRESSION = 'EXT_meshopt_compression';
|
|
118892
|
-
const name$
|
|
118801
|
+
const name$8 = EXT_MESHOPT_COMPRESSION;
|
|
118893
118802
|
async function decode$5(gltfData, options) {
|
|
118894
118803
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
118895
118804
|
if (!options?.gltf?.decompressMeshes || !options.gltf?.loadBuffers) {
|
|
@@ -118919,14 +118828,14 @@ async function decodeMeshoptBufferView(scenegraph, bufferView) {
|
|
|
118919
118828
|
|
|
118920
118829
|
var EXT_meshopt_compression = /*#__PURE__*/Object.freeze({
|
|
118921
118830
|
__proto__: null,
|
|
118922
|
-
name: name$
|
|
118831
|
+
name: name$8,
|
|
118923
118832
|
decode: decode$5
|
|
118924
118833
|
});
|
|
118925
118834
|
|
|
118926
118835
|
// GLTF EXTENSION: EXT_TEXTURE_WEBP
|
|
118927
118836
|
const EXT_TEXTURE_WEBP = 'EXT_texture_webp';
|
|
118928
118837
|
/** Extension name */
|
|
118929
|
-
const name$
|
|
118838
|
+
const name$7 = EXT_TEXTURE_WEBP;
|
|
118930
118839
|
/**
|
|
118931
118840
|
* Replaces a texture source reference with the extension texture
|
|
118932
118841
|
* Done in preprocess() to prevent load of default image
|
|
@@ -118954,14 +118863,14 @@ function preprocess$3(gltfData, options) {
|
|
|
118954
118863
|
|
|
118955
118864
|
var EXT_texture_webp = /*#__PURE__*/Object.freeze({
|
|
118956
118865
|
__proto__: null,
|
|
118957
|
-
name: name$
|
|
118866
|
+
name: name$7,
|
|
118958
118867
|
preprocess: preprocess$3
|
|
118959
118868
|
});
|
|
118960
118869
|
|
|
118961
118870
|
// GLTF EXTENSION: KHR_texture_basisu
|
|
118962
118871
|
const KHR_TEXTURE_BASISU = 'KHR_texture_basisu';
|
|
118963
118872
|
/** Extension name */
|
|
118964
|
-
const name$
|
|
118873
|
+
const name$6 = KHR_TEXTURE_BASISU;
|
|
118965
118874
|
/**
|
|
118966
118875
|
* Replaces a texture source reference with the extension texture
|
|
118967
118876
|
* Done in preprocess() to prevent load of default image
|
|
@@ -118983,7 +118892,7 @@ function preprocess$2(gltfData, options) {
|
|
|
118983
118892
|
|
|
118984
118893
|
var KHR_texture_basisu = /*#__PURE__*/Object.freeze({
|
|
118985
118894
|
__proto__: null,
|
|
118986
|
-
name: name$
|
|
118895
|
+
name: name$6,
|
|
118987
118896
|
preprocess: preprocess$2
|
|
118988
118897
|
});
|
|
118989
118898
|
|
|
@@ -119709,7 +119618,7 @@ function toTypedArray(array, ArrayType, convertTypedArrays = false) {
|
|
|
119709
119618
|
// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
|
|
119710
119619
|
const KHR_DRACO_MESH_COMPRESSION = 'KHR_draco_mesh_compression';
|
|
119711
119620
|
/** Extension name */
|
|
119712
|
-
const name$
|
|
119621
|
+
const name$5 = KHR_DRACO_MESH_COMPRESSION;
|
|
119713
119622
|
function preprocess$1(gltfData, options, context) {
|
|
119714
119623
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
119715
119624
|
for (const primitive of makeMeshPrimitiveIterator(scenegraph)) {
|
|
@@ -119832,7 +119741,7 @@ function* makeMeshPrimitiveIterator(scenegraph) {
|
|
|
119832
119741
|
|
|
119833
119742
|
var KHR_draco_mesh_compression = /*#__PURE__*/Object.freeze({
|
|
119834
119743
|
__proto__: null,
|
|
119835
|
-
name: name$
|
|
119744
|
+
name: name$5,
|
|
119836
119745
|
preprocess: preprocess$1,
|
|
119837
119746
|
decode: decode$4,
|
|
119838
119747
|
encode: encode$3
|
|
@@ -121319,7 +121228,7 @@ function getIdentityMatrix() {
|
|
|
121319
121228
|
*/
|
|
121320
121229
|
/** Extension name */
|
|
121321
121230
|
const KHR_TEXTURE_TRANSFORM = 'KHR_texture_transform';
|
|
121322
|
-
const name$
|
|
121231
|
+
const name$4 = KHR_TEXTURE_TRANSFORM;
|
|
121323
121232
|
const scratchVector = new Vector3();
|
|
121324
121233
|
const scratchRotationMatrix = new Matrix3();
|
|
121325
121234
|
const scratchScaleMatrix = new Matrix3();
|
|
@@ -121528,13 +121437,13 @@ function makeTransformationMatrix(extensionData) {
|
|
|
121528
121437
|
|
|
121529
121438
|
var KHR_texture_transform = /*#__PURE__*/Object.freeze({
|
|
121530
121439
|
__proto__: null,
|
|
121531
|
-
name: name$
|
|
121440
|
+
name: name$4,
|
|
121532
121441
|
decode: decode$3
|
|
121533
121442
|
});
|
|
121534
121443
|
|
|
121535
121444
|
// GLTF EXTENSION: KHR_lights_punctual
|
|
121536
121445
|
const KHR_LIGHTS_PUNCTUAL = 'KHR_lights_punctual';
|
|
121537
|
-
const name$
|
|
121446
|
+
const name$3 = KHR_LIGHTS_PUNCTUAL;
|
|
121538
121447
|
async function decode$2(gltfData) {
|
|
121539
121448
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
121540
121449
|
const { json } = gltfScenegraph;
|
|
@@ -121586,14 +121495,14 @@ async function encode$2(gltfData) {
|
|
|
121586
121495
|
|
|
121587
121496
|
var KHR_lights_punctual = /*#__PURE__*/Object.freeze({
|
|
121588
121497
|
__proto__: null,
|
|
121589
|
-
name: name$
|
|
121498
|
+
name: name$3,
|
|
121590
121499
|
decode: decode$2,
|
|
121591
121500
|
encode: encode$2
|
|
121592
121501
|
});
|
|
121593
121502
|
|
|
121594
121503
|
// GLTF EXTENSION: KHR_materials_unlit
|
|
121595
121504
|
const KHR_MATERIALS_UNLIT = 'KHR_materials_unlit';
|
|
121596
|
-
const name$
|
|
121505
|
+
const name$2 = KHR_MATERIALS_UNLIT;
|
|
121597
121506
|
async function decode$1(gltfData) {
|
|
121598
121507
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
121599
121508
|
const { json } = gltfScenegraph;
|
|
@@ -121631,14 +121540,14 @@ function encode$1(gltfData) {
|
|
|
121631
121540
|
|
|
121632
121541
|
var KHR_materials_unlit = /*#__PURE__*/Object.freeze({
|
|
121633
121542
|
__proto__: null,
|
|
121634
|
-
name: name$
|
|
121543
|
+
name: name$2,
|
|
121635
121544
|
decode: decode$1,
|
|
121636
121545
|
encode: encode$1
|
|
121637
121546
|
});
|
|
121638
121547
|
|
|
121639
121548
|
// GLTF EXTENSION: KHR_techniques_webgl
|
|
121640
121549
|
const KHR_TECHNIQUES_WEBGL = 'KHR_techniques_webgl';
|
|
121641
|
-
const name = KHR_TECHNIQUES_WEBGL;
|
|
121550
|
+
const name$1 = KHR_TECHNIQUES_WEBGL;
|
|
121642
121551
|
async function decode(gltfData) {
|
|
121643
121552
|
const gltfScenegraph = new GLTFScenegraph(gltfData);
|
|
121644
121553
|
const { json } = gltfScenegraph;
|
|
@@ -121711,7 +121620,7 @@ function resolveValues(technique, gltfScenegraph) {
|
|
|
121711
121620
|
|
|
121712
121621
|
var KHR_techniques_webgl = /*#__PURE__*/Object.freeze({
|
|
121713
121622
|
__proto__: null,
|
|
121714
|
-
name: name,
|
|
121623
|
+
name: name$1,
|
|
121715
121624
|
decode: decode,
|
|
121716
121625
|
encode: encode
|
|
121717
121626
|
});
|
|
@@ -130918,7 +130827,8 @@ class TreeViewPlugin extends Plugin {
|
|
|
130918
130827
|
const indeterminate = this._showIndeterminate
|
|
130919
130828
|
&& parent.numVisibleEntities > 0
|
|
130920
130829
|
&& parent.numVisibleEntities < parent.numEntities;
|
|
130921
|
-
|
|
130830
|
+
parent.checked = parent.numVisibleEntities > 0;
|
|
130831
|
+
this._renderService.setCheckbox(parent.nodeId, parent.checked, indeterminate);
|
|
130922
130832
|
|
|
130923
130833
|
parent = parent.parent;
|
|
130924
130834
|
}
|
|
@@ -130993,7 +130903,6 @@ class TreeViewPlugin extends Plugin {
|
|
|
130993
130903
|
|
|
130994
130904
|
let parent = checkedNode.parent;
|
|
130995
130905
|
while (parent) {
|
|
130996
|
-
parent.checked = visible;
|
|
130997
130906
|
|
|
130998
130907
|
if (visible) {
|
|
130999
130908
|
parent.numVisibleEntities += numUpdated;
|
|
@@ -131003,7 +130912,8 @@ class TreeViewPlugin extends Plugin {
|
|
|
131003
130912
|
const indeterminate = this._showIndeterminate
|
|
131004
130913
|
&& parent.numVisibleEntities > 0
|
|
131005
130914
|
&& parent.numVisibleEntities < parent.numEntities;
|
|
131006
|
-
|
|
130915
|
+
parent.checked = parent.numVisibleEntities > 0;
|
|
130916
|
+
this._renderService.setCheckbox(parent.nodeId, parent.checked, indeterminate);
|
|
131007
130917
|
|
|
131008
130918
|
parent = parent.parent;
|
|
131009
130919
|
}
|
|
@@ -138560,7 +138470,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
138560
138470
|
this._parseModel(params.xkt, options, sceneModel, metaModel, manifestCtx);
|
|
138561
138471
|
finish();
|
|
138562
138472
|
} else if (params.manifestSrc || params.manifest) {
|
|
138563
|
-
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
138473
|
+
const baseDir = params.manifestSrc ? getBaseDirectory$1(params.manifestSrc) : "";
|
|
138564
138474
|
const loadJSONs = (metaDataFiles, done, error) => {
|
|
138565
138475
|
let i = 0;
|
|
138566
138476
|
const loadNext = () => {
|
|
@@ -138700,7 +138610,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
138700
138610
|
}
|
|
138701
138611
|
}
|
|
138702
138612
|
|
|
138703
|
-
function getBaseDirectory(filePath) {
|
|
138613
|
+
function getBaseDirectory$1(filePath) {
|
|
138704
138614
|
if (filePath.indexOf('?') > -1) {
|
|
138705
138615
|
filePath = filePath.split('?')[0];
|
|
138706
138616
|
}
|
|
@@ -142423,6 +142333,4164 @@ class WebIFCLoaderPlugin extends Plugin {
|
|
|
142423
142333
|
}
|
|
142424
142334
|
}
|
|
142425
142335
|
|
|
142336
|
+
const name = "@creooxag/cx-converter";
|
|
142337
|
+
const version = "0.0.12-alpha";
|
|
142338
|
+
const description = "";
|
|
142339
|
+
const exports$1 = {
|
|
142340
|
+
".": {
|
|
142341
|
+
types: "./dist/index.d.ts",
|
|
142342
|
+
"import": "./dist/index.mjs",
|
|
142343
|
+
require: "./dist/index.cjs"
|
|
142344
|
+
}
|
|
142345
|
+
};
|
|
142346
|
+
const main = "./dist/index.mjs";
|
|
142347
|
+
const module$1 = "./dist/index.mjs";
|
|
142348
|
+
const types = "./dist/index.d.ts";
|
|
142349
|
+
const typesVersions = {
|
|
142350
|
+
"*": {
|
|
142351
|
+
"*": [
|
|
142352
|
+
"./dist/*",
|
|
142353
|
+
"./dist/index.d.ts"
|
|
142354
|
+
]
|
|
142355
|
+
}
|
|
142356
|
+
};
|
|
142357
|
+
const files = [
|
|
142358
|
+
"dist/"
|
|
142359
|
+
];
|
|
142360
|
+
const scripts = {
|
|
142361
|
+
"clean-dist": "rm -rf ./dist",
|
|
142362
|
+
"clean-cmake": "rm -rf ./cmake-build",
|
|
142363
|
+
"build-wasm-release": "emcmake cmake -S . -B ../cmake-build -DCMAKE_BUILD_TYPE=Release && cmake --build ../cmake-build",
|
|
142364
|
+
"publish-npm": "npm publish --access public",
|
|
142365
|
+
build: "unbuild",
|
|
142366
|
+
dev: "unbuild --stub",
|
|
142367
|
+
lint: "eslint .",
|
|
142368
|
+
start: "esno examples/node/nodeExport.ts",
|
|
142369
|
+
"example-html": "http-server -c-1 -p8237 --cors"
|
|
142370
|
+
};
|
|
142371
|
+
const keywords = [
|
|
142372
|
+
];
|
|
142373
|
+
const devDependencies = {
|
|
142374
|
+
"@types/node": "^22.10.2",
|
|
142375
|
+
esno: "^4.8.0",
|
|
142376
|
+
"fast-glob": "^3.3.2",
|
|
142377
|
+
globals: "^15.8.0",
|
|
142378
|
+
"http-server": "^14.1.1",
|
|
142379
|
+
prettier: "^3.3.3",
|
|
142380
|
+
"prettier-eslint": "^16.3.0",
|
|
142381
|
+
typescript: "^5.7.2",
|
|
142382
|
+
unbuild: "^2.0.0",
|
|
142383
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
142384
|
+
"@eslint/js": "^9.20.0",
|
|
142385
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
142386
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
142387
|
+
eslint: "^9.20.1",
|
|
142388
|
+
"eslint-config-prettier": "^10.0.1",
|
|
142389
|
+
"eslint-plugin-import": "^2.31.0",
|
|
142390
|
+
"eslint-plugin-prettier": "^5.2.3"
|
|
142391
|
+
};
|
|
142392
|
+
const packageJSON = {
|
|
142393
|
+
name: name,
|
|
142394
|
+
version: version,
|
|
142395
|
+
description: description,
|
|
142396
|
+
exports: exports$1,
|
|
142397
|
+
main: main,
|
|
142398
|
+
module: module$1,
|
|
142399
|
+
types: types,
|
|
142400
|
+
typesVersions: typesVersions,
|
|
142401
|
+
files: files,
|
|
142402
|
+
scripts: scripts,
|
|
142403
|
+
keywords: keywords,
|
|
142404
|
+
devDependencies: devDependencies
|
|
142405
|
+
};
|
|
142406
|
+
|
|
142407
|
+
var __defProp$2 = Object.defineProperty;
|
|
142408
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
142409
|
+
var __publicField$2 = (obj, key, value) => {
|
|
142410
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
142411
|
+
return value;
|
|
142412
|
+
};
|
|
142413
|
+
var IfcDbWasm = (() => {
|
|
142414
|
+
var _scriptName = import.meta.url;
|
|
142415
|
+
return async function(moduleArg = {}) {
|
|
142416
|
+
var moduleRtn;
|
|
142417
|
+
var Module = moduleArg;
|
|
142418
|
+
var readyPromiseResolve, readyPromiseReject;
|
|
142419
|
+
var readyPromise = new Promise((resolve, reject) => {
|
|
142420
|
+
readyPromiseResolve = resolve;
|
|
142421
|
+
readyPromiseReject = reject;
|
|
142422
|
+
});
|
|
142423
|
+
var moduleOverrides = Object.assign({}, Module);
|
|
142424
|
+
var arguments_ = [];
|
|
142425
|
+
var thisProgram = "./this.program";
|
|
142426
|
+
var quit_ = (status, toThrow) => {
|
|
142427
|
+
throw toThrow;
|
|
142428
|
+
};
|
|
142429
|
+
var scriptDirectory = "";
|
|
142430
|
+
function locateFile(path) {
|
|
142431
|
+
if (Module["locateFile"]) {
|
|
142432
|
+
return Module["locateFile"](path, scriptDirectory);
|
|
142433
|
+
}
|
|
142434
|
+
return scriptDirectory + path;
|
|
142435
|
+
}
|
|
142436
|
+
var readAsync, readBinary;
|
|
142437
|
+
{
|
|
142438
|
+
if (typeof document != "undefined" && document.currentScript) {
|
|
142439
|
+
scriptDirectory = document.currentScript.src;
|
|
142440
|
+
}
|
|
142441
|
+
if (_scriptName) {
|
|
142442
|
+
scriptDirectory = _scriptName;
|
|
142443
|
+
}
|
|
142444
|
+
if (scriptDirectory.startsWith("blob:")) {
|
|
142445
|
+
scriptDirectory = "";
|
|
142446
|
+
} else {
|
|
142447
|
+
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
|
|
142448
|
+
}
|
|
142449
|
+
{
|
|
142450
|
+
readAsync = async (url) => {
|
|
142451
|
+
var response = await fetch(url, { credentials: "same-origin" });
|
|
142452
|
+
if (response.ok) {
|
|
142453
|
+
return response.arrayBuffer();
|
|
142454
|
+
}
|
|
142455
|
+
throw new Error(response.status + " : " + response.url);
|
|
142456
|
+
};
|
|
142457
|
+
}
|
|
142458
|
+
}
|
|
142459
|
+
var out = Module["print"] || console.log.bind(console);
|
|
142460
|
+
var err = Module["printErr"] || console.error.bind(console);
|
|
142461
|
+
Object.assign(Module, moduleOverrides);
|
|
142462
|
+
moduleOverrides = null;
|
|
142463
|
+
if (Module["arguments"])
|
|
142464
|
+
arguments_ = Module["arguments"];
|
|
142465
|
+
if (Module["thisProgram"])
|
|
142466
|
+
thisProgram = Module["thisProgram"];
|
|
142467
|
+
var wasmBinary = Module["wasmBinary"];
|
|
142468
|
+
var wasmMemory;
|
|
142469
|
+
var ABORT = false;
|
|
142470
|
+
var EXITSTATUS;
|
|
142471
|
+
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAP64, HEAPU64, HEAPF64;
|
|
142472
|
+
function updateMemoryViews() {
|
|
142473
|
+
var b = wasmMemory.buffer;
|
|
142474
|
+
Module["HEAP8"] = HEAP8 = new Int8Array(b);
|
|
142475
|
+
Module["HEAP16"] = HEAP16 = new Int16Array(b);
|
|
142476
|
+
Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
|
|
142477
|
+
Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
|
|
142478
|
+
Module["HEAP32"] = HEAP32 = new Int32Array(b);
|
|
142479
|
+
Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
|
|
142480
|
+
Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
|
|
142481
|
+
Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
|
|
142482
|
+
Module["HEAP64"] = HEAP64 = new BigInt64Array(b);
|
|
142483
|
+
Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b);
|
|
142484
|
+
}
|
|
142485
|
+
function preRun() {
|
|
142486
|
+
if (Module["preRun"]) {
|
|
142487
|
+
if (typeof Module["preRun"] == "function")
|
|
142488
|
+
Module["preRun"] = [Module["preRun"]];
|
|
142489
|
+
while (Module["preRun"].length) {
|
|
142490
|
+
addOnPreRun(Module["preRun"].shift());
|
|
142491
|
+
}
|
|
142492
|
+
}
|
|
142493
|
+
callRuntimeCallbacks(onPreRuns);
|
|
142494
|
+
}
|
|
142495
|
+
function initRuntime() {
|
|
142496
|
+
if (!Module["noFSInit"] && !FS.initialized)
|
|
142497
|
+
FS.init();
|
|
142498
|
+
wasmExports["V"]();
|
|
142499
|
+
FS.ignorePermissions = false;
|
|
142500
|
+
}
|
|
142501
|
+
function postRun() {
|
|
142502
|
+
if (Module["postRun"]) {
|
|
142503
|
+
if (typeof Module["postRun"] == "function")
|
|
142504
|
+
Module["postRun"] = [Module["postRun"]];
|
|
142505
|
+
while (Module["postRun"].length) {
|
|
142506
|
+
addOnPostRun(Module["postRun"].shift());
|
|
142507
|
+
}
|
|
142508
|
+
}
|
|
142509
|
+
callRuntimeCallbacks(onPostRuns);
|
|
142510
|
+
}
|
|
142511
|
+
var runDependencies = 0;
|
|
142512
|
+
var dependenciesFulfilled = null;
|
|
142513
|
+
function addRunDependency(id) {
|
|
142514
|
+
runDependencies++;
|
|
142515
|
+
Module["monitorRunDependencies"]?.(runDependencies);
|
|
142516
|
+
}
|
|
142517
|
+
function removeRunDependency(id) {
|
|
142518
|
+
runDependencies--;
|
|
142519
|
+
Module["monitorRunDependencies"]?.(runDependencies);
|
|
142520
|
+
if (runDependencies == 0) {
|
|
142521
|
+
if (dependenciesFulfilled) {
|
|
142522
|
+
var callback = dependenciesFulfilled;
|
|
142523
|
+
dependenciesFulfilled = null;
|
|
142524
|
+
callback();
|
|
142525
|
+
}
|
|
142526
|
+
}
|
|
142527
|
+
}
|
|
142528
|
+
function abort(what) {
|
|
142529
|
+
Module["onAbort"]?.(what);
|
|
142530
|
+
what = "Aborted(" + what + ")";
|
|
142531
|
+
err(what);
|
|
142532
|
+
ABORT = true;
|
|
142533
|
+
what += ". Build with -sASSERTIONS for more info.";
|
|
142534
|
+
var e = new WebAssembly.RuntimeError(what);
|
|
142535
|
+
readyPromiseReject(e);
|
|
142536
|
+
throw e;
|
|
142537
|
+
}
|
|
142538
|
+
var wasmBinaryFile;
|
|
142539
|
+
function findWasmBinary() {
|
|
142540
|
+
if (Module["locateFile"]) {
|
|
142541
|
+
return locateFile("ifcdb.wasm");
|
|
142542
|
+
}
|
|
142543
|
+
return new URL("ifcdb.wasm", import.meta.url).href;
|
|
142544
|
+
}
|
|
142545
|
+
function getBinarySync(file) {
|
|
142546
|
+
if (file == wasmBinaryFile && wasmBinary) {
|
|
142547
|
+
return new Uint8Array(wasmBinary);
|
|
142548
|
+
}
|
|
142549
|
+
throw "both async and sync fetching of the wasm failed";
|
|
142550
|
+
}
|
|
142551
|
+
async function getWasmBinary(binaryFile) {
|
|
142552
|
+
if (!wasmBinary) {
|
|
142553
|
+
try {
|
|
142554
|
+
var response = await readAsync(binaryFile);
|
|
142555
|
+
return new Uint8Array(response);
|
|
142556
|
+
} catch {
|
|
142557
|
+
}
|
|
142558
|
+
}
|
|
142559
|
+
return getBinarySync(binaryFile);
|
|
142560
|
+
}
|
|
142561
|
+
async function instantiateArrayBuffer(binaryFile, imports) {
|
|
142562
|
+
try {
|
|
142563
|
+
var binary = await getWasmBinary(binaryFile);
|
|
142564
|
+
var instance = await WebAssembly.instantiate(binary, imports);
|
|
142565
|
+
return instance;
|
|
142566
|
+
} catch (reason) {
|
|
142567
|
+
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
142568
|
+
abort(reason);
|
|
142569
|
+
}
|
|
142570
|
+
}
|
|
142571
|
+
async function instantiateAsync(binary, binaryFile, imports) {
|
|
142572
|
+
if (!binary && typeof WebAssembly.instantiateStreaming == "function") {
|
|
142573
|
+
try {
|
|
142574
|
+
var response = fetch(binaryFile, { credentials: "same-origin" });
|
|
142575
|
+
var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
|
|
142576
|
+
return instantiationResult;
|
|
142577
|
+
} catch (reason) {
|
|
142578
|
+
err(`wasm streaming compile failed: ${reason}`);
|
|
142579
|
+
err("falling back to ArrayBuffer instantiation");
|
|
142580
|
+
}
|
|
142581
|
+
}
|
|
142582
|
+
return instantiateArrayBuffer(binaryFile, imports);
|
|
142583
|
+
}
|
|
142584
|
+
function getWasmImports() {
|
|
142585
|
+
return { a: wasmImports };
|
|
142586
|
+
}
|
|
142587
|
+
async function createWasm() {
|
|
142588
|
+
function receiveInstance(instance, module) {
|
|
142589
|
+
wasmExports = instance.exports;
|
|
142590
|
+
wasmExports = Asyncify.instrumentWasmExports(wasmExports);
|
|
142591
|
+
wasmMemory = wasmExports["U"];
|
|
142592
|
+
updateMemoryViews();
|
|
142593
|
+
wasmExports["X"];
|
|
142594
|
+
removeRunDependency();
|
|
142595
|
+
return wasmExports;
|
|
142596
|
+
}
|
|
142597
|
+
addRunDependency();
|
|
142598
|
+
function receiveInstantiationResult(result2) {
|
|
142599
|
+
return receiveInstance(result2["instance"]);
|
|
142600
|
+
}
|
|
142601
|
+
var info = getWasmImports();
|
|
142602
|
+
if (Module["instantiateWasm"]) {
|
|
142603
|
+
return new Promise((resolve, reject) => {
|
|
142604
|
+
Module["instantiateWasm"](info, (mod, inst) => {
|
|
142605
|
+
receiveInstance(mod);
|
|
142606
|
+
resolve(mod.exports);
|
|
142607
|
+
});
|
|
142608
|
+
});
|
|
142609
|
+
}
|
|
142610
|
+
wasmBinaryFile ?? (wasmBinaryFile = findWasmBinary());
|
|
142611
|
+
try {
|
|
142612
|
+
var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
|
|
142613
|
+
var exports = receiveInstantiationResult(result);
|
|
142614
|
+
return exports;
|
|
142615
|
+
} catch (e) {
|
|
142616
|
+
readyPromiseReject(e);
|
|
142617
|
+
return Promise.reject(e);
|
|
142618
|
+
}
|
|
142619
|
+
}
|
|
142620
|
+
var ASM_CONSTS = { 191520: () => {
|
|
142621
|
+
console.error("progress callback is not set.");
|
|
142622
|
+
} };
|
|
142623
|
+
class ExitStatus {
|
|
142624
|
+
constructor(status) {
|
|
142625
|
+
__publicField$2(this, "name", "ExitStatus");
|
|
142626
|
+
this.message = `Program terminated with exit(${status})`;
|
|
142627
|
+
this.status = status;
|
|
142628
|
+
}
|
|
142629
|
+
}
|
|
142630
|
+
var callRuntimeCallbacks = (callbacks) => {
|
|
142631
|
+
while (callbacks.length > 0) {
|
|
142632
|
+
callbacks.shift()(Module);
|
|
142633
|
+
}
|
|
142634
|
+
};
|
|
142635
|
+
var onPostRuns = [];
|
|
142636
|
+
var addOnPostRun = (cb) => onPostRuns.unshift(cb);
|
|
142637
|
+
var onPreRuns = [];
|
|
142638
|
+
var addOnPreRun = (cb) => onPreRuns.unshift(cb);
|
|
142639
|
+
var noExitRuntime = Module["noExitRuntime"] || true;
|
|
142640
|
+
class ExceptionInfo {
|
|
142641
|
+
constructor(excPtr) {
|
|
142642
|
+
this.excPtr = excPtr;
|
|
142643
|
+
this.ptr = excPtr - 24;
|
|
142644
|
+
}
|
|
142645
|
+
set_type(type) {
|
|
142646
|
+
HEAPU32[this.ptr + 4 >> 2] = type;
|
|
142647
|
+
}
|
|
142648
|
+
get_type() {
|
|
142649
|
+
return HEAPU32[this.ptr + 4 >> 2];
|
|
142650
|
+
}
|
|
142651
|
+
set_destructor(destructor) {
|
|
142652
|
+
HEAPU32[this.ptr + 8 >> 2] = destructor;
|
|
142653
|
+
}
|
|
142654
|
+
get_destructor() {
|
|
142655
|
+
return HEAPU32[this.ptr + 8 >> 2];
|
|
142656
|
+
}
|
|
142657
|
+
set_caught(caught) {
|
|
142658
|
+
caught = caught ? 1 : 0;
|
|
142659
|
+
HEAP8[this.ptr + 12] = caught;
|
|
142660
|
+
}
|
|
142661
|
+
get_caught() {
|
|
142662
|
+
return HEAP8[this.ptr + 12] != 0;
|
|
142663
|
+
}
|
|
142664
|
+
set_rethrown(rethrown) {
|
|
142665
|
+
rethrown = rethrown ? 1 : 0;
|
|
142666
|
+
HEAP8[this.ptr + 13] = rethrown;
|
|
142667
|
+
}
|
|
142668
|
+
get_rethrown() {
|
|
142669
|
+
return HEAP8[this.ptr + 13] != 0;
|
|
142670
|
+
}
|
|
142671
|
+
init(type, destructor) {
|
|
142672
|
+
this.set_adjusted_ptr(0);
|
|
142673
|
+
this.set_type(type);
|
|
142674
|
+
this.set_destructor(destructor);
|
|
142675
|
+
}
|
|
142676
|
+
set_adjusted_ptr(adjustedPtr) {
|
|
142677
|
+
HEAPU32[this.ptr + 16 >> 2] = adjustedPtr;
|
|
142678
|
+
}
|
|
142679
|
+
get_adjusted_ptr() {
|
|
142680
|
+
return HEAPU32[this.ptr + 16 >> 2];
|
|
142681
|
+
}
|
|
142682
|
+
}
|
|
142683
|
+
var exceptionLast = 0;
|
|
142684
|
+
var ___cxa_throw = (ptr, type, destructor) => {
|
|
142685
|
+
var info = new ExceptionInfo(ptr);
|
|
142686
|
+
info.init(type, destructor);
|
|
142687
|
+
exceptionLast = ptr;
|
|
142688
|
+
throw exceptionLast;
|
|
142689
|
+
};
|
|
142690
|
+
var syscallGetVarargI = () => {
|
|
142691
|
+
var ret = HEAP32[+SYSCALLS.varargs >> 2];
|
|
142692
|
+
SYSCALLS.varargs += 4;
|
|
142693
|
+
return ret;
|
|
142694
|
+
};
|
|
142695
|
+
var syscallGetVarargP = syscallGetVarargI;
|
|
142696
|
+
var PATH = { isAbs: (path) => path.charAt(0) === "/", splitPath: (filename) => {
|
|
142697
|
+
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
142698
|
+
return splitPathRe.exec(filename).slice(1);
|
|
142699
|
+
}, normalizeArray: (parts, allowAboveRoot) => {
|
|
142700
|
+
var up = 0;
|
|
142701
|
+
for (var i = parts.length - 1; i >= 0; i--) {
|
|
142702
|
+
var last = parts[i];
|
|
142703
|
+
if (last === ".") {
|
|
142704
|
+
parts.splice(i, 1);
|
|
142705
|
+
} else if (last === "..") {
|
|
142706
|
+
parts.splice(i, 1);
|
|
142707
|
+
up++;
|
|
142708
|
+
} else if (up) {
|
|
142709
|
+
parts.splice(i, 1);
|
|
142710
|
+
up--;
|
|
142711
|
+
}
|
|
142712
|
+
}
|
|
142713
|
+
if (allowAboveRoot) {
|
|
142714
|
+
for (; up; up--) {
|
|
142715
|
+
parts.unshift("..");
|
|
142716
|
+
}
|
|
142717
|
+
}
|
|
142718
|
+
return parts;
|
|
142719
|
+
}, normalize: (path) => {
|
|
142720
|
+
var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/";
|
|
142721
|
+
path = PATH.normalizeArray(path.split("/").filter((p) => !!p), !isAbsolute).join("/");
|
|
142722
|
+
if (!path && !isAbsolute) {
|
|
142723
|
+
path = ".";
|
|
142724
|
+
}
|
|
142725
|
+
if (path && trailingSlash) {
|
|
142726
|
+
path += "/";
|
|
142727
|
+
}
|
|
142728
|
+
return (isAbsolute ? "/" : "") + path;
|
|
142729
|
+
}, dirname: (path) => {
|
|
142730
|
+
var result = PATH.splitPath(path), root = result[0], dir = result[1];
|
|
142731
|
+
if (!root && !dir) {
|
|
142732
|
+
return ".";
|
|
142733
|
+
}
|
|
142734
|
+
if (dir) {
|
|
142735
|
+
dir = dir.slice(0, -1);
|
|
142736
|
+
}
|
|
142737
|
+
return root + dir;
|
|
142738
|
+
}, basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1], join: (...paths) => PATH.normalize(paths.join("/")), join2: (l, r) => PATH.normalize(l + "/" + r) };
|
|
142739
|
+
var initRandomFill = () => (view) => crypto.getRandomValues(view);
|
|
142740
|
+
var randomFill = (view) => {
|
|
142741
|
+
(randomFill = initRandomFill())(view);
|
|
142742
|
+
};
|
|
142743
|
+
var PATH_FS = { resolve: (...args) => {
|
|
142744
|
+
var resolvedPath = "", resolvedAbsolute = false;
|
|
142745
|
+
for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
142746
|
+
var path = i >= 0 ? args[i] : FS.cwd();
|
|
142747
|
+
if (typeof path != "string") {
|
|
142748
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
142749
|
+
} else if (!path) {
|
|
142750
|
+
return "";
|
|
142751
|
+
}
|
|
142752
|
+
resolvedPath = path + "/" + resolvedPath;
|
|
142753
|
+
resolvedAbsolute = PATH.isAbs(path);
|
|
142754
|
+
}
|
|
142755
|
+
resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter((p) => !!p), !resolvedAbsolute).join("/");
|
|
142756
|
+
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
|
|
142757
|
+
}, relative: (from, to) => {
|
|
142758
|
+
from = PATH_FS.resolve(from).slice(1);
|
|
142759
|
+
to = PATH_FS.resolve(to).slice(1);
|
|
142760
|
+
function trim(arr) {
|
|
142761
|
+
var start = 0;
|
|
142762
|
+
for (; start < arr.length; start++) {
|
|
142763
|
+
if (arr[start] !== "")
|
|
142764
|
+
break;
|
|
142765
|
+
}
|
|
142766
|
+
var end = arr.length - 1;
|
|
142767
|
+
for (; end >= 0; end--) {
|
|
142768
|
+
if (arr[end] !== "")
|
|
142769
|
+
break;
|
|
142770
|
+
}
|
|
142771
|
+
if (start > end)
|
|
142772
|
+
return [];
|
|
142773
|
+
return arr.slice(start, end - start + 1);
|
|
142774
|
+
}
|
|
142775
|
+
var fromParts = trim(from.split("/"));
|
|
142776
|
+
var toParts = trim(to.split("/"));
|
|
142777
|
+
var length = Math.min(fromParts.length, toParts.length);
|
|
142778
|
+
var samePartsLength = length;
|
|
142779
|
+
for (var i = 0; i < length; i++) {
|
|
142780
|
+
if (fromParts[i] !== toParts[i]) {
|
|
142781
|
+
samePartsLength = i;
|
|
142782
|
+
break;
|
|
142783
|
+
}
|
|
142784
|
+
}
|
|
142785
|
+
var outputParts = [];
|
|
142786
|
+
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
142787
|
+
outputParts.push("..");
|
|
142788
|
+
}
|
|
142789
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
142790
|
+
return outputParts.join("/");
|
|
142791
|
+
} };
|
|
142792
|
+
var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder() : void 0;
|
|
142793
|
+
var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {
|
|
142794
|
+
var endIdx = idx + maxBytesToRead;
|
|
142795
|
+
var endPtr = idx;
|
|
142796
|
+
while (heapOrArray[endPtr] && !(endPtr >= endIdx))
|
|
142797
|
+
++endPtr;
|
|
142798
|
+
if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
|
|
142799
|
+
return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
|
|
142800
|
+
}
|
|
142801
|
+
var str = "";
|
|
142802
|
+
while (idx < endPtr) {
|
|
142803
|
+
var u0 = heapOrArray[idx++];
|
|
142804
|
+
if (!(u0 & 128)) {
|
|
142805
|
+
str += String.fromCharCode(u0);
|
|
142806
|
+
continue;
|
|
142807
|
+
}
|
|
142808
|
+
var u1 = heapOrArray[idx++] & 63;
|
|
142809
|
+
if ((u0 & 224) == 192) {
|
|
142810
|
+
str += String.fromCharCode((u0 & 31) << 6 | u1);
|
|
142811
|
+
continue;
|
|
142812
|
+
}
|
|
142813
|
+
var u2 = heapOrArray[idx++] & 63;
|
|
142814
|
+
if ((u0 & 240) == 224) {
|
|
142815
|
+
u0 = (u0 & 15) << 12 | u1 << 6 | u2;
|
|
142816
|
+
} else {
|
|
142817
|
+
u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
|
|
142818
|
+
}
|
|
142819
|
+
if (u0 < 65536) {
|
|
142820
|
+
str += String.fromCharCode(u0);
|
|
142821
|
+
} else {
|
|
142822
|
+
var ch = u0 - 65536;
|
|
142823
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
142824
|
+
}
|
|
142825
|
+
}
|
|
142826
|
+
return str;
|
|
142827
|
+
};
|
|
142828
|
+
var FS_stdin_getChar_buffer = [];
|
|
142829
|
+
var lengthBytesUTF8 = (str) => {
|
|
142830
|
+
var len = 0;
|
|
142831
|
+
for (var i = 0; i < str.length; ++i) {
|
|
142832
|
+
var c = str.charCodeAt(i);
|
|
142833
|
+
if (c <= 127) {
|
|
142834
|
+
len++;
|
|
142835
|
+
} else if (c <= 2047) {
|
|
142836
|
+
len += 2;
|
|
142837
|
+
} else if (c >= 55296 && c <= 57343) {
|
|
142838
|
+
len += 4;
|
|
142839
|
+
++i;
|
|
142840
|
+
} else {
|
|
142841
|
+
len += 3;
|
|
142842
|
+
}
|
|
142843
|
+
}
|
|
142844
|
+
return len;
|
|
142845
|
+
};
|
|
142846
|
+
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
142847
|
+
if (!(maxBytesToWrite > 0))
|
|
142848
|
+
return 0;
|
|
142849
|
+
var startIdx = outIdx;
|
|
142850
|
+
var endIdx = outIdx + maxBytesToWrite - 1;
|
|
142851
|
+
for (var i = 0; i < str.length; ++i) {
|
|
142852
|
+
var u = str.charCodeAt(i);
|
|
142853
|
+
if (u >= 55296 && u <= 57343) {
|
|
142854
|
+
var u1 = str.charCodeAt(++i);
|
|
142855
|
+
u = 65536 + ((u & 1023) << 10) | u1 & 1023;
|
|
142856
|
+
}
|
|
142857
|
+
if (u <= 127) {
|
|
142858
|
+
if (outIdx >= endIdx)
|
|
142859
|
+
break;
|
|
142860
|
+
heap[outIdx++] = u;
|
|
142861
|
+
} else if (u <= 2047) {
|
|
142862
|
+
if (outIdx + 1 >= endIdx)
|
|
142863
|
+
break;
|
|
142864
|
+
heap[outIdx++] = 192 | u >> 6;
|
|
142865
|
+
heap[outIdx++] = 128 | u & 63;
|
|
142866
|
+
} else if (u <= 65535) {
|
|
142867
|
+
if (outIdx + 2 >= endIdx)
|
|
142868
|
+
break;
|
|
142869
|
+
heap[outIdx++] = 224 | u >> 12;
|
|
142870
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
142871
|
+
heap[outIdx++] = 128 | u & 63;
|
|
142872
|
+
} else {
|
|
142873
|
+
if (outIdx + 3 >= endIdx)
|
|
142874
|
+
break;
|
|
142875
|
+
heap[outIdx++] = 240 | u >> 18;
|
|
142876
|
+
heap[outIdx++] = 128 | u >> 12 & 63;
|
|
142877
|
+
heap[outIdx++] = 128 | u >> 6 & 63;
|
|
142878
|
+
heap[outIdx++] = 128 | u & 63;
|
|
142879
|
+
}
|
|
142880
|
+
}
|
|
142881
|
+
heap[outIdx] = 0;
|
|
142882
|
+
return outIdx - startIdx;
|
|
142883
|
+
};
|
|
142884
|
+
var intArrayFromString = (stringy, dontAddNull, length) => {
|
|
142885
|
+
var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
|
|
142886
|
+
var u8array = new Array(len);
|
|
142887
|
+
var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
|
|
142888
|
+
if (dontAddNull)
|
|
142889
|
+
u8array.length = numBytesWritten;
|
|
142890
|
+
return u8array;
|
|
142891
|
+
};
|
|
142892
|
+
var FS_stdin_getChar = () => {
|
|
142893
|
+
if (!FS_stdin_getChar_buffer.length) {
|
|
142894
|
+
var result = null;
|
|
142895
|
+
if (typeof window != "undefined" && typeof window.prompt == "function") {
|
|
142896
|
+
result = window.prompt("Input: ");
|
|
142897
|
+
if (result !== null) {
|
|
142898
|
+
result += "\n";
|
|
142899
|
+
}
|
|
142900
|
+
}
|
|
142901
|
+
if (!result) {
|
|
142902
|
+
return null;
|
|
142903
|
+
}
|
|
142904
|
+
FS_stdin_getChar_buffer = intArrayFromString(result, true);
|
|
142905
|
+
}
|
|
142906
|
+
return FS_stdin_getChar_buffer.shift();
|
|
142907
|
+
};
|
|
142908
|
+
var TTY = { ttys: [], init() {
|
|
142909
|
+
}, shutdown() {
|
|
142910
|
+
}, register(dev, ops) {
|
|
142911
|
+
TTY.ttys[dev] = { input: [], output: [], ops };
|
|
142912
|
+
FS.registerDevice(dev, TTY.stream_ops);
|
|
142913
|
+
}, stream_ops: { open(stream) {
|
|
142914
|
+
var tty = TTY.ttys[stream.node.rdev];
|
|
142915
|
+
if (!tty) {
|
|
142916
|
+
throw new FS.ErrnoError(43);
|
|
142917
|
+
}
|
|
142918
|
+
stream.tty = tty;
|
|
142919
|
+
stream.seekable = false;
|
|
142920
|
+
}, close(stream) {
|
|
142921
|
+
stream.tty.ops.fsync(stream.tty);
|
|
142922
|
+
}, fsync(stream) {
|
|
142923
|
+
stream.tty.ops.fsync(stream.tty);
|
|
142924
|
+
}, read(stream, buffer, offset, length, pos) {
|
|
142925
|
+
if (!stream.tty || !stream.tty.ops.get_char) {
|
|
142926
|
+
throw new FS.ErrnoError(60);
|
|
142927
|
+
}
|
|
142928
|
+
var bytesRead = 0;
|
|
142929
|
+
for (var i = 0; i < length; i++) {
|
|
142930
|
+
var result;
|
|
142931
|
+
try {
|
|
142932
|
+
result = stream.tty.ops.get_char(stream.tty);
|
|
142933
|
+
} catch (e) {
|
|
142934
|
+
throw new FS.ErrnoError(29);
|
|
142935
|
+
}
|
|
142936
|
+
if (result === void 0 && bytesRead === 0) {
|
|
142937
|
+
throw new FS.ErrnoError(6);
|
|
142938
|
+
}
|
|
142939
|
+
if (result === null || result === void 0)
|
|
142940
|
+
break;
|
|
142941
|
+
bytesRead++;
|
|
142942
|
+
buffer[offset + i] = result;
|
|
142943
|
+
}
|
|
142944
|
+
if (bytesRead) {
|
|
142945
|
+
stream.node.atime = Date.now();
|
|
142946
|
+
}
|
|
142947
|
+
return bytesRead;
|
|
142948
|
+
}, write(stream, buffer, offset, length, pos) {
|
|
142949
|
+
if (!stream.tty || !stream.tty.ops.put_char) {
|
|
142950
|
+
throw new FS.ErrnoError(60);
|
|
142951
|
+
}
|
|
142952
|
+
try {
|
|
142953
|
+
for (var i = 0; i < length; i++) {
|
|
142954
|
+
stream.tty.ops.put_char(stream.tty, buffer[offset + i]);
|
|
142955
|
+
}
|
|
142956
|
+
} catch (e) {
|
|
142957
|
+
throw new FS.ErrnoError(29);
|
|
142958
|
+
}
|
|
142959
|
+
if (length) {
|
|
142960
|
+
stream.node.mtime = stream.node.ctime = Date.now();
|
|
142961
|
+
}
|
|
142962
|
+
return i;
|
|
142963
|
+
} }, default_tty_ops: { get_char(tty) {
|
|
142964
|
+
return FS_stdin_getChar();
|
|
142965
|
+
}, put_char(tty, val) {
|
|
142966
|
+
if (val === null || val === 10) {
|
|
142967
|
+
out(UTF8ArrayToString(tty.output));
|
|
142968
|
+
tty.output = [];
|
|
142969
|
+
} else {
|
|
142970
|
+
if (val != 0)
|
|
142971
|
+
tty.output.push(val);
|
|
142972
|
+
}
|
|
142973
|
+
}, fsync(tty) {
|
|
142974
|
+
if (tty.output?.length > 0) {
|
|
142975
|
+
out(UTF8ArrayToString(tty.output));
|
|
142976
|
+
tty.output = [];
|
|
142977
|
+
}
|
|
142978
|
+
}, ioctl_tcgets(tty) {
|
|
142979
|
+
return { c_iflag: 25856, c_oflag: 5, c_cflag: 191, c_lflag: 35387, c_cc: [3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] };
|
|
142980
|
+
}, ioctl_tcsets(tty, optional_actions, data) {
|
|
142981
|
+
return 0;
|
|
142982
|
+
}, ioctl_tiocgwinsz(tty) {
|
|
142983
|
+
return [24, 80];
|
|
142984
|
+
} }, default_tty1_ops: { put_char(tty, val) {
|
|
142985
|
+
if (val === null || val === 10) {
|
|
142986
|
+
err(UTF8ArrayToString(tty.output));
|
|
142987
|
+
tty.output = [];
|
|
142988
|
+
} else {
|
|
142989
|
+
if (val != 0)
|
|
142990
|
+
tty.output.push(val);
|
|
142991
|
+
}
|
|
142992
|
+
}, fsync(tty) {
|
|
142993
|
+
if (tty.output?.length > 0) {
|
|
142994
|
+
err(UTF8ArrayToString(tty.output));
|
|
142995
|
+
tty.output = [];
|
|
142996
|
+
}
|
|
142997
|
+
} } };
|
|
142998
|
+
var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
|
|
142999
|
+
var mmapAlloc = (size) => {
|
|
143000
|
+
abort();
|
|
143001
|
+
};
|
|
143002
|
+
var MEMFS = { ops_table: null, mount(mount) {
|
|
143003
|
+
return MEMFS.createNode(null, "/", 16895, 0);
|
|
143004
|
+
}, createNode(parent, name, mode, dev) {
|
|
143005
|
+
if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
|
|
143006
|
+
throw new FS.ErrnoError(63);
|
|
143007
|
+
}
|
|
143008
|
+
MEMFS.ops_table || (MEMFS.ops_table = { dir: { node: { getattr: MEMFS.node_ops.getattr, setattr: MEMFS.node_ops.setattr, lookup: MEMFS.node_ops.lookup, mknod: MEMFS.node_ops.mknod, rename: MEMFS.node_ops.rename, unlink: MEMFS.node_ops.unlink, rmdir: MEMFS.node_ops.rmdir, readdir: MEMFS.node_ops.readdir, symlink: MEMFS.node_ops.symlink }, stream: { llseek: MEMFS.stream_ops.llseek } }, file: { node: { getattr: MEMFS.node_ops.getattr, setattr: MEMFS.node_ops.setattr }, stream: { llseek: MEMFS.stream_ops.llseek, read: MEMFS.stream_ops.read, write: MEMFS.stream_ops.write, allocate: MEMFS.stream_ops.allocate, mmap: MEMFS.stream_ops.mmap, msync: MEMFS.stream_ops.msync } }, link: { node: { getattr: MEMFS.node_ops.getattr, setattr: MEMFS.node_ops.setattr, readlink: MEMFS.node_ops.readlink }, stream: {} }, chrdev: { node: { getattr: MEMFS.node_ops.getattr, setattr: MEMFS.node_ops.setattr }, stream: FS.chrdev_stream_ops } });
|
|
143009
|
+
var node = FS.createNode(parent, name, mode, dev);
|
|
143010
|
+
if (FS.isDir(node.mode)) {
|
|
143011
|
+
node.node_ops = MEMFS.ops_table.dir.node;
|
|
143012
|
+
node.stream_ops = MEMFS.ops_table.dir.stream;
|
|
143013
|
+
node.contents = {};
|
|
143014
|
+
} else if (FS.isFile(node.mode)) {
|
|
143015
|
+
node.node_ops = MEMFS.ops_table.file.node;
|
|
143016
|
+
node.stream_ops = MEMFS.ops_table.file.stream;
|
|
143017
|
+
node.usedBytes = 0;
|
|
143018
|
+
node.contents = null;
|
|
143019
|
+
} else if (FS.isLink(node.mode)) {
|
|
143020
|
+
node.node_ops = MEMFS.ops_table.link.node;
|
|
143021
|
+
node.stream_ops = MEMFS.ops_table.link.stream;
|
|
143022
|
+
} else if (FS.isChrdev(node.mode)) {
|
|
143023
|
+
node.node_ops = MEMFS.ops_table.chrdev.node;
|
|
143024
|
+
node.stream_ops = MEMFS.ops_table.chrdev.stream;
|
|
143025
|
+
}
|
|
143026
|
+
node.atime = node.mtime = node.ctime = Date.now();
|
|
143027
|
+
if (parent) {
|
|
143028
|
+
parent.contents[name] = node;
|
|
143029
|
+
parent.atime = parent.mtime = parent.ctime = node.atime;
|
|
143030
|
+
}
|
|
143031
|
+
return node;
|
|
143032
|
+
}, getFileDataAsTypedArray(node) {
|
|
143033
|
+
if (!node.contents)
|
|
143034
|
+
return new Uint8Array(0);
|
|
143035
|
+
if (node.contents.subarray)
|
|
143036
|
+
return node.contents.subarray(0, node.usedBytes);
|
|
143037
|
+
return new Uint8Array(node.contents);
|
|
143038
|
+
}, expandFileStorage(node, newCapacity) {
|
|
143039
|
+
var prevCapacity = node.contents ? node.contents.length : 0;
|
|
143040
|
+
if (prevCapacity >= newCapacity)
|
|
143041
|
+
return;
|
|
143042
|
+
var CAPACITY_DOUBLING_MAX = 1024 * 1024;
|
|
143043
|
+
newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
|
|
143044
|
+
if (prevCapacity != 0)
|
|
143045
|
+
newCapacity = Math.max(newCapacity, 256);
|
|
143046
|
+
var oldContents = node.contents;
|
|
143047
|
+
node.contents = new Uint8Array(newCapacity);
|
|
143048
|
+
if (node.usedBytes > 0)
|
|
143049
|
+
node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
|
|
143050
|
+
}, resizeFileStorage(node, newSize) {
|
|
143051
|
+
if (node.usedBytes == newSize)
|
|
143052
|
+
return;
|
|
143053
|
+
if (newSize == 0) {
|
|
143054
|
+
node.contents = null;
|
|
143055
|
+
node.usedBytes = 0;
|
|
143056
|
+
} else {
|
|
143057
|
+
var oldContents = node.contents;
|
|
143058
|
+
node.contents = new Uint8Array(newSize);
|
|
143059
|
+
if (oldContents) {
|
|
143060
|
+
node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
|
|
143061
|
+
}
|
|
143062
|
+
node.usedBytes = newSize;
|
|
143063
|
+
}
|
|
143064
|
+
}, node_ops: { getattr(node) {
|
|
143065
|
+
var attr = {};
|
|
143066
|
+
attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
|
|
143067
|
+
attr.ino = node.id;
|
|
143068
|
+
attr.mode = node.mode;
|
|
143069
|
+
attr.nlink = 1;
|
|
143070
|
+
attr.uid = 0;
|
|
143071
|
+
attr.gid = 0;
|
|
143072
|
+
attr.rdev = node.rdev;
|
|
143073
|
+
if (FS.isDir(node.mode)) {
|
|
143074
|
+
attr.size = 4096;
|
|
143075
|
+
} else if (FS.isFile(node.mode)) {
|
|
143076
|
+
attr.size = node.usedBytes;
|
|
143077
|
+
} else if (FS.isLink(node.mode)) {
|
|
143078
|
+
attr.size = node.link.length;
|
|
143079
|
+
} else {
|
|
143080
|
+
attr.size = 0;
|
|
143081
|
+
}
|
|
143082
|
+
attr.atime = new Date(node.atime);
|
|
143083
|
+
attr.mtime = new Date(node.mtime);
|
|
143084
|
+
attr.ctime = new Date(node.ctime);
|
|
143085
|
+
attr.blksize = 4096;
|
|
143086
|
+
attr.blocks = Math.ceil(attr.size / attr.blksize);
|
|
143087
|
+
return attr;
|
|
143088
|
+
}, setattr(node, attr) {
|
|
143089
|
+
for (const key of ["mode", "atime", "mtime", "ctime"]) {
|
|
143090
|
+
if (attr[key] != null) {
|
|
143091
|
+
node[key] = attr[key];
|
|
143092
|
+
}
|
|
143093
|
+
}
|
|
143094
|
+
if (attr.size !== void 0) {
|
|
143095
|
+
MEMFS.resizeFileStorage(node, attr.size);
|
|
143096
|
+
}
|
|
143097
|
+
}, lookup(parent, name) {
|
|
143098
|
+
throw MEMFS.doesNotExistError;
|
|
143099
|
+
}, mknod(parent, name, mode, dev) {
|
|
143100
|
+
return MEMFS.createNode(parent, name, mode, dev);
|
|
143101
|
+
}, rename(old_node, new_dir, new_name) {
|
|
143102
|
+
var new_node;
|
|
143103
|
+
try {
|
|
143104
|
+
new_node = FS.lookupNode(new_dir, new_name);
|
|
143105
|
+
} catch (e) {
|
|
143106
|
+
}
|
|
143107
|
+
if (new_node) {
|
|
143108
|
+
if (FS.isDir(old_node.mode)) {
|
|
143109
|
+
for (var i in new_node.contents) {
|
|
143110
|
+
throw new FS.ErrnoError(55);
|
|
143111
|
+
}
|
|
143112
|
+
}
|
|
143113
|
+
FS.hashRemoveNode(new_node);
|
|
143114
|
+
}
|
|
143115
|
+
delete old_node.parent.contents[old_node.name];
|
|
143116
|
+
new_dir.contents[new_name] = old_node;
|
|
143117
|
+
old_node.name = new_name;
|
|
143118
|
+
new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now();
|
|
143119
|
+
}, unlink(parent, name) {
|
|
143120
|
+
delete parent.contents[name];
|
|
143121
|
+
parent.ctime = parent.mtime = Date.now();
|
|
143122
|
+
}, rmdir(parent, name) {
|
|
143123
|
+
var node = FS.lookupNode(parent, name);
|
|
143124
|
+
for (var i in node.contents) {
|
|
143125
|
+
throw new FS.ErrnoError(55);
|
|
143126
|
+
}
|
|
143127
|
+
delete parent.contents[name];
|
|
143128
|
+
parent.ctime = parent.mtime = Date.now();
|
|
143129
|
+
}, readdir(node) {
|
|
143130
|
+
return [".", "..", ...Object.keys(node.contents)];
|
|
143131
|
+
}, symlink(parent, newname, oldpath) {
|
|
143132
|
+
var node = MEMFS.createNode(parent, newname, 511 | 40960, 0);
|
|
143133
|
+
node.link = oldpath;
|
|
143134
|
+
return node;
|
|
143135
|
+
}, readlink(node) {
|
|
143136
|
+
if (!FS.isLink(node.mode)) {
|
|
143137
|
+
throw new FS.ErrnoError(28);
|
|
143138
|
+
}
|
|
143139
|
+
return node.link;
|
|
143140
|
+
} }, stream_ops: { read(stream, buffer, offset, length, position) {
|
|
143141
|
+
var contents = stream.node.contents;
|
|
143142
|
+
if (position >= stream.node.usedBytes)
|
|
143143
|
+
return 0;
|
|
143144
|
+
var size = Math.min(stream.node.usedBytes - position, length);
|
|
143145
|
+
if (size > 8 && contents.subarray) {
|
|
143146
|
+
buffer.set(contents.subarray(position, position + size), offset);
|
|
143147
|
+
} else {
|
|
143148
|
+
for (var i = 0; i < size; i++)
|
|
143149
|
+
buffer[offset + i] = contents[position + i];
|
|
143150
|
+
}
|
|
143151
|
+
return size;
|
|
143152
|
+
}, write(stream, buffer, offset, length, position, canOwn) {
|
|
143153
|
+
if (buffer.buffer === HEAP8.buffer) {
|
|
143154
|
+
canOwn = false;
|
|
143155
|
+
}
|
|
143156
|
+
if (!length)
|
|
143157
|
+
return 0;
|
|
143158
|
+
var node = stream.node;
|
|
143159
|
+
node.mtime = node.ctime = Date.now();
|
|
143160
|
+
if (buffer.subarray && (!node.contents || node.contents.subarray)) {
|
|
143161
|
+
if (canOwn) {
|
|
143162
|
+
node.contents = buffer.subarray(offset, offset + length);
|
|
143163
|
+
node.usedBytes = length;
|
|
143164
|
+
return length;
|
|
143165
|
+
} else if (node.usedBytes === 0 && position === 0) {
|
|
143166
|
+
node.contents = buffer.slice(offset, offset + length);
|
|
143167
|
+
node.usedBytes = length;
|
|
143168
|
+
return length;
|
|
143169
|
+
} else if (position + length <= node.usedBytes) {
|
|
143170
|
+
node.contents.set(buffer.subarray(offset, offset + length), position);
|
|
143171
|
+
return length;
|
|
143172
|
+
}
|
|
143173
|
+
}
|
|
143174
|
+
MEMFS.expandFileStorage(node, position + length);
|
|
143175
|
+
if (node.contents.subarray && buffer.subarray) {
|
|
143176
|
+
node.contents.set(buffer.subarray(offset, offset + length), position);
|
|
143177
|
+
} else {
|
|
143178
|
+
for (var i = 0; i < length; i++) {
|
|
143179
|
+
node.contents[position + i] = buffer[offset + i];
|
|
143180
|
+
}
|
|
143181
|
+
}
|
|
143182
|
+
node.usedBytes = Math.max(node.usedBytes, position + length);
|
|
143183
|
+
return length;
|
|
143184
|
+
}, llseek(stream, offset, whence) {
|
|
143185
|
+
var position = offset;
|
|
143186
|
+
if (whence === 1) {
|
|
143187
|
+
position += stream.position;
|
|
143188
|
+
} else if (whence === 2) {
|
|
143189
|
+
if (FS.isFile(stream.node.mode)) {
|
|
143190
|
+
position += stream.node.usedBytes;
|
|
143191
|
+
}
|
|
143192
|
+
}
|
|
143193
|
+
if (position < 0) {
|
|
143194
|
+
throw new FS.ErrnoError(28);
|
|
143195
|
+
}
|
|
143196
|
+
return position;
|
|
143197
|
+
}, allocate(stream, offset, length) {
|
|
143198
|
+
MEMFS.expandFileStorage(stream.node, offset + length);
|
|
143199
|
+
stream.node.usedBytes = Math.max(stream.node.usedBytes, offset + length);
|
|
143200
|
+
}, mmap(stream, length, position, prot, flags) {
|
|
143201
|
+
if (!FS.isFile(stream.node.mode)) {
|
|
143202
|
+
throw new FS.ErrnoError(43);
|
|
143203
|
+
}
|
|
143204
|
+
var ptr;
|
|
143205
|
+
var allocated;
|
|
143206
|
+
var contents = stream.node.contents;
|
|
143207
|
+
if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) {
|
|
143208
|
+
allocated = false;
|
|
143209
|
+
ptr = contents.byteOffset;
|
|
143210
|
+
} else {
|
|
143211
|
+
allocated = true;
|
|
143212
|
+
ptr = mmapAlloc();
|
|
143213
|
+
if (!ptr) {
|
|
143214
|
+
throw new FS.ErrnoError(48);
|
|
143215
|
+
}
|
|
143216
|
+
if (contents) {
|
|
143217
|
+
if (position > 0 || position + length < contents.length) {
|
|
143218
|
+
if (contents.subarray) {
|
|
143219
|
+
contents = contents.subarray(position, position + length);
|
|
143220
|
+
} else {
|
|
143221
|
+
contents = Array.prototype.slice.call(contents, position, position + length);
|
|
143222
|
+
}
|
|
143223
|
+
}
|
|
143224
|
+
HEAP8.set(contents, ptr);
|
|
143225
|
+
}
|
|
143226
|
+
}
|
|
143227
|
+
return { ptr, allocated };
|
|
143228
|
+
}, msync(stream, buffer, offset, length, mmapFlags) {
|
|
143229
|
+
MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
|
|
143230
|
+
return 0;
|
|
143231
|
+
} } };
|
|
143232
|
+
var asyncLoad = async (url) => {
|
|
143233
|
+
var arrayBuffer = await readAsync(url);
|
|
143234
|
+
return new Uint8Array(arrayBuffer);
|
|
143235
|
+
};
|
|
143236
|
+
asyncLoad.isAsync = true;
|
|
143237
|
+
var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
|
|
143238
|
+
FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
|
|
143239
|
+
};
|
|
143240
|
+
var preloadPlugins = Module["preloadPlugins"] || [];
|
|
143241
|
+
var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => {
|
|
143242
|
+
if (typeof Browser != "undefined")
|
|
143243
|
+
Browser.init();
|
|
143244
|
+
var handled = false;
|
|
143245
|
+
preloadPlugins.forEach((plugin) => {
|
|
143246
|
+
if (handled)
|
|
143247
|
+
return;
|
|
143248
|
+
if (plugin["canHandle"](fullname)) {
|
|
143249
|
+
plugin["handle"](byteArray, fullname, finish, onerror);
|
|
143250
|
+
handled = true;
|
|
143251
|
+
}
|
|
143252
|
+
});
|
|
143253
|
+
return handled;
|
|
143254
|
+
};
|
|
143255
|
+
var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
|
|
143256
|
+
var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
|
|
143257
|
+
function processData(byteArray) {
|
|
143258
|
+
function finish(byteArray2) {
|
|
143259
|
+
preFinish?.();
|
|
143260
|
+
if (!dontCreateFile) {
|
|
143261
|
+
FS_createDataFile(parent, name, byteArray2, canRead, canWrite, canOwn);
|
|
143262
|
+
}
|
|
143263
|
+
onload?.();
|
|
143264
|
+
removeRunDependency();
|
|
143265
|
+
}
|
|
143266
|
+
if (FS_handledByPreloadPlugin(byteArray, fullname, finish, () => {
|
|
143267
|
+
onerror?.();
|
|
143268
|
+
removeRunDependency();
|
|
143269
|
+
})) {
|
|
143270
|
+
return;
|
|
143271
|
+
}
|
|
143272
|
+
finish(byteArray);
|
|
143273
|
+
}
|
|
143274
|
+
addRunDependency();
|
|
143275
|
+
if (typeof url == "string") {
|
|
143276
|
+
asyncLoad(url).then(processData, onerror);
|
|
143277
|
+
} else {
|
|
143278
|
+
processData(url);
|
|
143279
|
+
}
|
|
143280
|
+
};
|
|
143281
|
+
var FS_modeStringToFlags = (str) => {
|
|
143282
|
+
var flagModes = { r: 0, "r+": 2, w: 512 | 64 | 1, "w+": 512 | 64 | 2, a: 1024 | 64 | 1, "a+": 1024 | 64 | 2 };
|
|
143283
|
+
var flags = flagModes[str];
|
|
143284
|
+
if (typeof flags == "undefined") {
|
|
143285
|
+
throw new Error(`Unknown file open mode: ${str}`);
|
|
143286
|
+
}
|
|
143287
|
+
return flags;
|
|
143288
|
+
};
|
|
143289
|
+
var FS_getMode = (canRead, canWrite) => {
|
|
143290
|
+
var mode = 0;
|
|
143291
|
+
if (canRead)
|
|
143292
|
+
mode |= 292 | 73;
|
|
143293
|
+
if (canWrite)
|
|
143294
|
+
mode |= 146;
|
|
143295
|
+
return mode;
|
|
143296
|
+
};
|
|
143297
|
+
var FS = { root: null, mounts: [], devices: {}, streams: [], nextInode: 1, nameTable: null, currentPath: "/", initialized: false, ignorePermissions: true, ErrnoError: class {
|
|
143298
|
+
constructor(errno) {
|
|
143299
|
+
__publicField$2(this, "name", "ErrnoError");
|
|
143300
|
+
this.errno = errno;
|
|
143301
|
+
}
|
|
143302
|
+
}, filesystems: null, syncFSRequests: 0, readFiles: {}, FSStream: class {
|
|
143303
|
+
constructor() {
|
|
143304
|
+
__publicField$2(this, "shared", {});
|
|
143305
|
+
}
|
|
143306
|
+
get object() {
|
|
143307
|
+
return this.node;
|
|
143308
|
+
}
|
|
143309
|
+
set object(val) {
|
|
143310
|
+
this.node = val;
|
|
143311
|
+
}
|
|
143312
|
+
get isRead() {
|
|
143313
|
+
return (this.flags & 2097155) !== 1;
|
|
143314
|
+
}
|
|
143315
|
+
get isWrite() {
|
|
143316
|
+
return (this.flags & 2097155) !== 0;
|
|
143317
|
+
}
|
|
143318
|
+
get isAppend() {
|
|
143319
|
+
return this.flags & 1024;
|
|
143320
|
+
}
|
|
143321
|
+
get flags() {
|
|
143322
|
+
return this.shared.flags;
|
|
143323
|
+
}
|
|
143324
|
+
set flags(val) {
|
|
143325
|
+
this.shared.flags = val;
|
|
143326
|
+
}
|
|
143327
|
+
get position() {
|
|
143328
|
+
return this.shared.position;
|
|
143329
|
+
}
|
|
143330
|
+
set position(val) {
|
|
143331
|
+
this.shared.position = val;
|
|
143332
|
+
}
|
|
143333
|
+
}, FSNode: class {
|
|
143334
|
+
constructor(parent, name, mode, rdev) {
|
|
143335
|
+
__publicField$2(this, "node_ops", {});
|
|
143336
|
+
__publicField$2(this, "stream_ops", {});
|
|
143337
|
+
__publicField$2(this, "readMode", 292 | 73);
|
|
143338
|
+
__publicField$2(this, "writeMode", 146);
|
|
143339
|
+
__publicField$2(this, "mounted", null);
|
|
143340
|
+
if (!parent) {
|
|
143341
|
+
parent = this;
|
|
143342
|
+
}
|
|
143343
|
+
this.parent = parent;
|
|
143344
|
+
this.mount = parent.mount;
|
|
143345
|
+
this.id = FS.nextInode++;
|
|
143346
|
+
this.name = name;
|
|
143347
|
+
this.mode = mode;
|
|
143348
|
+
this.rdev = rdev;
|
|
143349
|
+
this.atime = this.mtime = this.ctime = Date.now();
|
|
143350
|
+
}
|
|
143351
|
+
get read() {
|
|
143352
|
+
return (this.mode & this.readMode) === this.readMode;
|
|
143353
|
+
}
|
|
143354
|
+
set read(val) {
|
|
143355
|
+
val ? this.mode |= this.readMode : this.mode &= ~this.readMode;
|
|
143356
|
+
}
|
|
143357
|
+
get write() {
|
|
143358
|
+
return (this.mode & this.writeMode) === this.writeMode;
|
|
143359
|
+
}
|
|
143360
|
+
set write(val) {
|
|
143361
|
+
val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode;
|
|
143362
|
+
}
|
|
143363
|
+
get isFolder() {
|
|
143364
|
+
return FS.isDir(this.mode);
|
|
143365
|
+
}
|
|
143366
|
+
get isDevice() {
|
|
143367
|
+
return FS.isChrdev(this.mode);
|
|
143368
|
+
}
|
|
143369
|
+
}, lookupPath(path, opts = {}) {
|
|
143370
|
+
if (!path) {
|
|
143371
|
+
throw new FS.ErrnoError(44);
|
|
143372
|
+
}
|
|
143373
|
+
opts.follow_mount ?? (opts.follow_mount = true);
|
|
143374
|
+
if (!PATH.isAbs(path)) {
|
|
143375
|
+
path = FS.cwd() + "/" + path;
|
|
143376
|
+
}
|
|
143377
|
+
linkloop:
|
|
143378
|
+
for (var nlinks = 0; nlinks < 40; nlinks++) {
|
|
143379
|
+
var parts = path.split("/").filter((p) => !!p);
|
|
143380
|
+
var current = FS.root;
|
|
143381
|
+
var current_path = "/";
|
|
143382
|
+
for (var i = 0; i < parts.length; i++) {
|
|
143383
|
+
var islast = i === parts.length - 1;
|
|
143384
|
+
if (islast && opts.parent) {
|
|
143385
|
+
break;
|
|
143386
|
+
}
|
|
143387
|
+
if (parts[i] === ".") {
|
|
143388
|
+
continue;
|
|
143389
|
+
}
|
|
143390
|
+
if (parts[i] === "..") {
|
|
143391
|
+
current_path = PATH.dirname(current_path);
|
|
143392
|
+
current = current.parent;
|
|
143393
|
+
continue;
|
|
143394
|
+
}
|
|
143395
|
+
current_path = PATH.join2(current_path, parts[i]);
|
|
143396
|
+
try {
|
|
143397
|
+
current = FS.lookupNode(current, parts[i]);
|
|
143398
|
+
} catch (e) {
|
|
143399
|
+
if (e?.errno === 44 && islast && opts.noent_okay) {
|
|
143400
|
+
return { path: current_path };
|
|
143401
|
+
}
|
|
143402
|
+
throw e;
|
|
143403
|
+
}
|
|
143404
|
+
if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) {
|
|
143405
|
+
current = current.mounted.root;
|
|
143406
|
+
}
|
|
143407
|
+
if (FS.isLink(current.mode) && (!islast || opts.follow)) {
|
|
143408
|
+
if (!current.node_ops.readlink) {
|
|
143409
|
+
throw new FS.ErrnoError(52);
|
|
143410
|
+
}
|
|
143411
|
+
var link = current.node_ops.readlink(current);
|
|
143412
|
+
if (!PATH.isAbs(link)) {
|
|
143413
|
+
link = PATH.dirname(current_path) + "/" + link;
|
|
143414
|
+
}
|
|
143415
|
+
path = link + "/" + parts.slice(i + 1).join("/");
|
|
143416
|
+
continue linkloop;
|
|
143417
|
+
}
|
|
143418
|
+
}
|
|
143419
|
+
return { path: current_path, node: current };
|
|
143420
|
+
}
|
|
143421
|
+
throw new FS.ErrnoError(32);
|
|
143422
|
+
}, getPath(node) {
|
|
143423
|
+
var path;
|
|
143424
|
+
while (true) {
|
|
143425
|
+
if (FS.isRoot(node)) {
|
|
143426
|
+
var mount = node.mount.mountpoint;
|
|
143427
|
+
if (!path)
|
|
143428
|
+
return mount;
|
|
143429
|
+
return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path;
|
|
143430
|
+
}
|
|
143431
|
+
path = path ? `${node.name}/${path}` : node.name;
|
|
143432
|
+
node = node.parent;
|
|
143433
|
+
}
|
|
143434
|
+
}, hashName(parentid, name) {
|
|
143435
|
+
var hash = 0;
|
|
143436
|
+
for (var i = 0; i < name.length; i++) {
|
|
143437
|
+
hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
|
|
143438
|
+
}
|
|
143439
|
+
return (parentid + hash >>> 0) % FS.nameTable.length;
|
|
143440
|
+
}, hashAddNode(node) {
|
|
143441
|
+
var hash = FS.hashName(node.parent.id, node.name);
|
|
143442
|
+
node.name_next = FS.nameTable[hash];
|
|
143443
|
+
FS.nameTable[hash] = node;
|
|
143444
|
+
}, hashRemoveNode(node) {
|
|
143445
|
+
var hash = FS.hashName(node.parent.id, node.name);
|
|
143446
|
+
if (FS.nameTable[hash] === node) {
|
|
143447
|
+
FS.nameTable[hash] = node.name_next;
|
|
143448
|
+
} else {
|
|
143449
|
+
var current = FS.nameTable[hash];
|
|
143450
|
+
while (current) {
|
|
143451
|
+
if (current.name_next === node) {
|
|
143452
|
+
current.name_next = node.name_next;
|
|
143453
|
+
break;
|
|
143454
|
+
}
|
|
143455
|
+
current = current.name_next;
|
|
143456
|
+
}
|
|
143457
|
+
}
|
|
143458
|
+
}, lookupNode(parent, name) {
|
|
143459
|
+
var errCode = FS.mayLookup(parent);
|
|
143460
|
+
if (errCode) {
|
|
143461
|
+
throw new FS.ErrnoError(errCode);
|
|
143462
|
+
}
|
|
143463
|
+
var hash = FS.hashName(parent.id, name);
|
|
143464
|
+
for (var node = FS.nameTable[hash]; node; node = node.name_next) {
|
|
143465
|
+
var nodeName = node.name;
|
|
143466
|
+
if (node.parent.id === parent.id && nodeName === name) {
|
|
143467
|
+
return node;
|
|
143468
|
+
}
|
|
143469
|
+
}
|
|
143470
|
+
return FS.lookup(parent, name);
|
|
143471
|
+
}, createNode(parent, name, mode, rdev) {
|
|
143472
|
+
var node = new FS.FSNode(parent, name, mode, rdev);
|
|
143473
|
+
FS.hashAddNode(node);
|
|
143474
|
+
return node;
|
|
143475
|
+
}, destroyNode(node) {
|
|
143476
|
+
FS.hashRemoveNode(node);
|
|
143477
|
+
}, isRoot(node) {
|
|
143478
|
+
return node === node.parent;
|
|
143479
|
+
}, isMountpoint(node) {
|
|
143480
|
+
return !!node.mounted;
|
|
143481
|
+
}, isFile(mode) {
|
|
143482
|
+
return (mode & 61440) === 32768;
|
|
143483
|
+
}, isDir(mode) {
|
|
143484
|
+
return (mode & 61440) === 16384;
|
|
143485
|
+
}, isLink(mode) {
|
|
143486
|
+
return (mode & 61440) === 40960;
|
|
143487
|
+
}, isChrdev(mode) {
|
|
143488
|
+
return (mode & 61440) === 8192;
|
|
143489
|
+
}, isBlkdev(mode) {
|
|
143490
|
+
return (mode & 61440) === 24576;
|
|
143491
|
+
}, isFIFO(mode) {
|
|
143492
|
+
return (mode & 61440) === 4096;
|
|
143493
|
+
}, isSocket(mode) {
|
|
143494
|
+
return (mode & 49152) === 49152;
|
|
143495
|
+
}, flagsToPermissionString(flag) {
|
|
143496
|
+
var perms = ["r", "w", "rw"][flag & 3];
|
|
143497
|
+
if (flag & 512) {
|
|
143498
|
+
perms += "w";
|
|
143499
|
+
}
|
|
143500
|
+
return perms;
|
|
143501
|
+
}, nodePermissions(node, perms) {
|
|
143502
|
+
if (FS.ignorePermissions) {
|
|
143503
|
+
return 0;
|
|
143504
|
+
}
|
|
143505
|
+
if (perms.includes("r") && !(node.mode & 292)) {
|
|
143506
|
+
return 2;
|
|
143507
|
+
} else if (perms.includes("w") && !(node.mode & 146)) {
|
|
143508
|
+
return 2;
|
|
143509
|
+
} else if (perms.includes("x") && !(node.mode & 73)) {
|
|
143510
|
+
return 2;
|
|
143511
|
+
}
|
|
143512
|
+
return 0;
|
|
143513
|
+
}, mayLookup(dir) {
|
|
143514
|
+
if (!FS.isDir(dir.mode))
|
|
143515
|
+
return 54;
|
|
143516
|
+
var errCode = FS.nodePermissions(dir, "x");
|
|
143517
|
+
if (errCode)
|
|
143518
|
+
return errCode;
|
|
143519
|
+
if (!dir.node_ops.lookup)
|
|
143520
|
+
return 2;
|
|
143521
|
+
return 0;
|
|
143522
|
+
}, mayCreate(dir, name) {
|
|
143523
|
+
if (!FS.isDir(dir.mode)) {
|
|
143524
|
+
return 54;
|
|
143525
|
+
}
|
|
143526
|
+
try {
|
|
143527
|
+
var node = FS.lookupNode(dir, name);
|
|
143528
|
+
return 20;
|
|
143529
|
+
} catch (e) {
|
|
143530
|
+
}
|
|
143531
|
+
return FS.nodePermissions(dir, "wx");
|
|
143532
|
+
}, mayDelete(dir, name, isdir) {
|
|
143533
|
+
var node;
|
|
143534
|
+
try {
|
|
143535
|
+
node = FS.lookupNode(dir, name);
|
|
143536
|
+
} catch (e) {
|
|
143537
|
+
return e.errno;
|
|
143538
|
+
}
|
|
143539
|
+
var errCode = FS.nodePermissions(dir, "wx");
|
|
143540
|
+
if (errCode) {
|
|
143541
|
+
return errCode;
|
|
143542
|
+
}
|
|
143543
|
+
if (isdir) {
|
|
143544
|
+
if (!FS.isDir(node.mode)) {
|
|
143545
|
+
return 54;
|
|
143546
|
+
}
|
|
143547
|
+
if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
|
|
143548
|
+
return 10;
|
|
143549
|
+
}
|
|
143550
|
+
} else {
|
|
143551
|
+
if (FS.isDir(node.mode)) {
|
|
143552
|
+
return 31;
|
|
143553
|
+
}
|
|
143554
|
+
}
|
|
143555
|
+
return 0;
|
|
143556
|
+
}, mayOpen(node, flags) {
|
|
143557
|
+
if (!node) {
|
|
143558
|
+
return 44;
|
|
143559
|
+
}
|
|
143560
|
+
if (FS.isLink(node.mode)) {
|
|
143561
|
+
return 32;
|
|
143562
|
+
} else if (FS.isDir(node.mode)) {
|
|
143563
|
+
if (FS.flagsToPermissionString(flags) !== "r" || flags & (512 | 64)) {
|
|
143564
|
+
return 31;
|
|
143565
|
+
}
|
|
143566
|
+
}
|
|
143567
|
+
return FS.nodePermissions(node, FS.flagsToPermissionString(flags));
|
|
143568
|
+
}, checkOpExists(op, err2) {
|
|
143569
|
+
if (!op) {
|
|
143570
|
+
throw new FS.ErrnoError(err2);
|
|
143571
|
+
}
|
|
143572
|
+
return op;
|
|
143573
|
+
}, MAX_OPEN_FDS: 4096, nextfd() {
|
|
143574
|
+
for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) {
|
|
143575
|
+
if (!FS.streams[fd]) {
|
|
143576
|
+
return fd;
|
|
143577
|
+
}
|
|
143578
|
+
}
|
|
143579
|
+
throw new FS.ErrnoError(33);
|
|
143580
|
+
}, getStreamChecked(fd) {
|
|
143581
|
+
var stream = FS.getStream(fd);
|
|
143582
|
+
if (!stream) {
|
|
143583
|
+
throw new FS.ErrnoError(8);
|
|
143584
|
+
}
|
|
143585
|
+
return stream;
|
|
143586
|
+
}, getStream: (fd) => FS.streams[fd], createStream(stream, fd = -1) {
|
|
143587
|
+
stream = Object.assign(new FS.FSStream(), stream);
|
|
143588
|
+
if (fd == -1) {
|
|
143589
|
+
fd = FS.nextfd();
|
|
143590
|
+
}
|
|
143591
|
+
stream.fd = fd;
|
|
143592
|
+
FS.streams[fd] = stream;
|
|
143593
|
+
return stream;
|
|
143594
|
+
}, closeStream(fd) {
|
|
143595
|
+
FS.streams[fd] = null;
|
|
143596
|
+
}, dupStream(origStream, fd = -1) {
|
|
143597
|
+
var stream = FS.createStream(origStream, fd);
|
|
143598
|
+
stream.stream_ops?.dup?.(stream);
|
|
143599
|
+
return stream;
|
|
143600
|
+
}, doSetAttr(stream, node, attr) {
|
|
143601
|
+
var setattr = stream?.stream_ops.setattr;
|
|
143602
|
+
var arg = setattr ? stream : node;
|
|
143603
|
+
setattr ?? (setattr = node.node_ops.setattr);
|
|
143604
|
+
FS.checkOpExists(setattr, 63);
|
|
143605
|
+
setattr(arg, attr);
|
|
143606
|
+
}, chrdev_stream_ops: { open(stream) {
|
|
143607
|
+
var device = FS.getDevice(stream.node.rdev);
|
|
143608
|
+
stream.stream_ops = device.stream_ops;
|
|
143609
|
+
stream.stream_ops.open?.(stream);
|
|
143610
|
+
}, llseek() {
|
|
143611
|
+
throw new FS.ErrnoError(70);
|
|
143612
|
+
} }, major: (dev) => dev >> 8, minor: (dev) => dev & 255, makedev: (ma, mi) => ma << 8 | mi, registerDevice(dev, ops) {
|
|
143613
|
+
FS.devices[dev] = { stream_ops: ops };
|
|
143614
|
+
}, getDevice: (dev) => FS.devices[dev], getMounts(mount) {
|
|
143615
|
+
var mounts = [];
|
|
143616
|
+
var check = [mount];
|
|
143617
|
+
while (check.length) {
|
|
143618
|
+
var m = check.pop();
|
|
143619
|
+
mounts.push(m);
|
|
143620
|
+
check.push(...m.mounts);
|
|
143621
|
+
}
|
|
143622
|
+
return mounts;
|
|
143623
|
+
}, syncfs(populate, callback) {
|
|
143624
|
+
if (typeof populate == "function") {
|
|
143625
|
+
callback = populate;
|
|
143626
|
+
populate = false;
|
|
143627
|
+
}
|
|
143628
|
+
FS.syncFSRequests++;
|
|
143629
|
+
if (FS.syncFSRequests > 1) {
|
|
143630
|
+
err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);
|
|
143631
|
+
}
|
|
143632
|
+
var mounts = FS.getMounts(FS.root.mount);
|
|
143633
|
+
var completed = 0;
|
|
143634
|
+
function doCallback(errCode) {
|
|
143635
|
+
FS.syncFSRequests--;
|
|
143636
|
+
return callback(errCode);
|
|
143637
|
+
}
|
|
143638
|
+
function done(errCode) {
|
|
143639
|
+
if (errCode) {
|
|
143640
|
+
if (!done.errored) {
|
|
143641
|
+
done.errored = true;
|
|
143642
|
+
return doCallback(errCode);
|
|
143643
|
+
}
|
|
143644
|
+
return;
|
|
143645
|
+
}
|
|
143646
|
+
if (++completed >= mounts.length) {
|
|
143647
|
+
doCallback(null);
|
|
143648
|
+
}
|
|
143649
|
+
}
|
|
143650
|
+
mounts.forEach((mount) => {
|
|
143651
|
+
if (!mount.type.syncfs) {
|
|
143652
|
+
return done(null);
|
|
143653
|
+
}
|
|
143654
|
+
mount.type.syncfs(mount, populate, done);
|
|
143655
|
+
});
|
|
143656
|
+
}, mount(type, opts, mountpoint) {
|
|
143657
|
+
var root = mountpoint === "/";
|
|
143658
|
+
var pseudo = !mountpoint;
|
|
143659
|
+
var node;
|
|
143660
|
+
if (root && FS.root) {
|
|
143661
|
+
throw new FS.ErrnoError(10);
|
|
143662
|
+
} else if (!root && !pseudo) {
|
|
143663
|
+
var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
|
|
143664
|
+
mountpoint = lookup.path;
|
|
143665
|
+
node = lookup.node;
|
|
143666
|
+
if (FS.isMountpoint(node)) {
|
|
143667
|
+
throw new FS.ErrnoError(10);
|
|
143668
|
+
}
|
|
143669
|
+
if (!FS.isDir(node.mode)) {
|
|
143670
|
+
throw new FS.ErrnoError(54);
|
|
143671
|
+
}
|
|
143672
|
+
}
|
|
143673
|
+
var mount = { type, opts, mountpoint, mounts: [] };
|
|
143674
|
+
var mountRoot = type.mount(mount);
|
|
143675
|
+
mountRoot.mount = mount;
|
|
143676
|
+
mount.root = mountRoot;
|
|
143677
|
+
if (root) {
|
|
143678
|
+
FS.root = mountRoot;
|
|
143679
|
+
} else if (node) {
|
|
143680
|
+
node.mounted = mount;
|
|
143681
|
+
if (node.mount) {
|
|
143682
|
+
node.mount.mounts.push(mount);
|
|
143683
|
+
}
|
|
143684
|
+
}
|
|
143685
|
+
return mountRoot;
|
|
143686
|
+
}, unmount(mountpoint) {
|
|
143687
|
+
var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
|
|
143688
|
+
if (!FS.isMountpoint(lookup.node)) {
|
|
143689
|
+
throw new FS.ErrnoError(28);
|
|
143690
|
+
}
|
|
143691
|
+
var node = lookup.node;
|
|
143692
|
+
var mount = node.mounted;
|
|
143693
|
+
var mounts = FS.getMounts(mount);
|
|
143694
|
+
Object.keys(FS.nameTable).forEach((hash) => {
|
|
143695
|
+
var current = FS.nameTable[hash];
|
|
143696
|
+
while (current) {
|
|
143697
|
+
var next = current.name_next;
|
|
143698
|
+
if (mounts.includes(current.mount)) {
|
|
143699
|
+
FS.destroyNode(current);
|
|
143700
|
+
}
|
|
143701
|
+
current = next;
|
|
143702
|
+
}
|
|
143703
|
+
});
|
|
143704
|
+
node.mounted = null;
|
|
143705
|
+
var idx = node.mount.mounts.indexOf(mount);
|
|
143706
|
+
node.mount.mounts.splice(idx, 1);
|
|
143707
|
+
}, lookup(parent, name) {
|
|
143708
|
+
return parent.node_ops.lookup(parent, name);
|
|
143709
|
+
}, mknod(path, mode, dev) {
|
|
143710
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
143711
|
+
var parent = lookup.node;
|
|
143712
|
+
var name = PATH.basename(path);
|
|
143713
|
+
if (!name) {
|
|
143714
|
+
throw new FS.ErrnoError(28);
|
|
143715
|
+
}
|
|
143716
|
+
if (name === "." || name === "..") {
|
|
143717
|
+
throw new FS.ErrnoError(20);
|
|
143718
|
+
}
|
|
143719
|
+
var errCode = FS.mayCreate(parent, name);
|
|
143720
|
+
if (errCode) {
|
|
143721
|
+
throw new FS.ErrnoError(errCode);
|
|
143722
|
+
}
|
|
143723
|
+
if (!parent.node_ops.mknod) {
|
|
143724
|
+
throw new FS.ErrnoError(63);
|
|
143725
|
+
}
|
|
143726
|
+
return parent.node_ops.mknod(parent, name, mode, dev);
|
|
143727
|
+
}, statfs(path) {
|
|
143728
|
+
return FS.statfsNode(FS.lookupPath(path, { follow: true }).node);
|
|
143729
|
+
}, statfsStream(stream) {
|
|
143730
|
+
return FS.statfsNode(stream.node);
|
|
143731
|
+
}, statfsNode(node) {
|
|
143732
|
+
var rtn = { bsize: 4096, frsize: 4096, blocks: 1e6, bfree: 5e5, bavail: 5e5, files: FS.nextInode, ffree: FS.nextInode - 1, fsid: 42, flags: 2, namelen: 255 };
|
|
143733
|
+
if (node.node_ops.statfs) {
|
|
143734
|
+
Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root));
|
|
143735
|
+
}
|
|
143736
|
+
return rtn;
|
|
143737
|
+
}, create(path, mode = 438) {
|
|
143738
|
+
mode &= 4095;
|
|
143739
|
+
mode |= 32768;
|
|
143740
|
+
return FS.mknod(path, mode, 0);
|
|
143741
|
+
}, mkdir(path, mode = 511) {
|
|
143742
|
+
mode &= 511 | 512;
|
|
143743
|
+
mode |= 16384;
|
|
143744
|
+
return FS.mknod(path, mode, 0);
|
|
143745
|
+
}, mkdirTree(path, mode) {
|
|
143746
|
+
var dirs = path.split("/");
|
|
143747
|
+
var d = "";
|
|
143748
|
+
for (var i = 0; i < dirs.length; ++i) {
|
|
143749
|
+
if (!dirs[i])
|
|
143750
|
+
continue;
|
|
143751
|
+
d += "/" + dirs[i];
|
|
143752
|
+
try {
|
|
143753
|
+
FS.mkdir(d, mode);
|
|
143754
|
+
} catch (e) {
|
|
143755
|
+
if (e.errno != 20)
|
|
143756
|
+
throw e;
|
|
143757
|
+
}
|
|
143758
|
+
}
|
|
143759
|
+
}, mkdev(path, mode, dev) {
|
|
143760
|
+
if (typeof dev == "undefined") {
|
|
143761
|
+
dev = mode;
|
|
143762
|
+
mode = 438;
|
|
143763
|
+
}
|
|
143764
|
+
mode |= 8192;
|
|
143765
|
+
return FS.mknod(path, mode, dev);
|
|
143766
|
+
}, symlink(oldpath, newpath) {
|
|
143767
|
+
if (!PATH_FS.resolve(oldpath)) {
|
|
143768
|
+
throw new FS.ErrnoError(44);
|
|
143769
|
+
}
|
|
143770
|
+
var lookup = FS.lookupPath(newpath, { parent: true });
|
|
143771
|
+
var parent = lookup.node;
|
|
143772
|
+
if (!parent) {
|
|
143773
|
+
throw new FS.ErrnoError(44);
|
|
143774
|
+
}
|
|
143775
|
+
var newname = PATH.basename(newpath);
|
|
143776
|
+
var errCode = FS.mayCreate(parent, newname);
|
|
143777
|
+
if (errCode) {
|
|
143778
|
+
throw new FS.ErrnoError(errCode);
|
|
143779
|
+
}
|
|
143780
|
+
if (!parent.node_ops.symlink) {
|
|
143781
|
+
throw new FS.ErrnoError(63);
|
|
143782
|
+
}
|
|
143783
|
+
return parent.node_ops.symlink(parent, newname, oldpath);
|
|
143784
|
+
}, rename(old_path, new_path) {
|
|
143785
|
+
var old_dirname = PATH.dirname(old_path);
|
|
143786
|
+
var new_dirname = PATH.dirname(new_path);
|
|
143787
|
+
var old_name = PATH.basename(old_path);
|
|
143788
|
+
var new_name = PATH.basename(new_path);
|
|
143789
|
+
var lookup, old_dir, new_dir;
|
|
143790
|
+
lookup = FS.lookupPath(old_path, { parent: true });
|
|
143791
|
+
old_dir = lookup.node;
|
|
143792
|
+
lookup = FS.lookupPath(new_path, { parent: true });
|
|
143793
|
+
new_dir = lookup.node;
|
|
143794
|
+
if (!old_dir || !new_dir)
|
|
143795
|
+
throw new FS.ErrnoError(44);
|
|
143796
|
+
if (old_dir.mount !== new_dir.mount) {
|
|
143797
|
+
throw new FS.ErrnoError(75);
|
|
143798
|
+
}
|
|
143799
|
+
var old_node = FS.lookupNode(old_dir, old_name);
|
|
143800
|
+
var relative = PATH_FS.relative(old_path, new_dirname);
|
|
143801
|
+
if (relative.charAt(0) !== ".") {
|
|
143802
|
+
throw new FS.ErrnoError(28);
|
|
143803
|
+
}
|
|
143804
|
+
relative = PATH_FS.relative(new_path, old_dirname);
|
|
143805
|
+
if (relative.charAt(0) !== ".") {
|
|
143806
|
+
throw new FS.ErrnoError(55);
|
|
143807
|
+
}
|
|
143808
|
+
var new_node;
|
|
143809
|
+
try {
|
|
143810
|
+
new_node = FS.lookupNode(new_dir, new_name);
|
|
143811
|
+
} catch (e) {
|
|
143812
|
+
}
|
|
143813
|
+
if (old_node === new_node) {
|
|
143814
|
+
return;
|
|
143815
|
+
}
|
|
143816
|
+
var isdir = FS.isDir(old_node.mode);
|
|
143817
|
+
var errCode = FS.mayDelete(old_dir, old_name, isdir);
|
|
143818
|
+
if (errCode) {
|
|
143819
|
+
throw new FS.ErrnoError(errCode);
|
|
143820
|
+
}
|
|
143821
|
+
errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
|
|
143822
|
+
if (errCode) {
|
|
143823
|
+
throw new FS.ErrnoError(errCode);
|
|
143824
|
+
}
|
|
143825
|
+
if (!old_dir.node_ops.rename) {
|
|
143826
|
+
throw new FS.ErrnoError(63);
|
|
143827
|
+
}
|
|
143828
|
+
if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
|
|
143829
|
+
throw new FS.ErrnoError(10);
|
|
143830
|
+
}
|
|
143831
|
+
if (new_dir !== old_dir) {
|
|
143832
|
+
errCode = FS.nodePermissions(old_dir, "w");
|
|
143833
|
+
if (errCode) {
|
|
143834
|
+
throw new FS.ErrnoError(errCode);
|
|
143835
|
+
}
|
|
143836
|
+
}
|
|
143837
|
+
FS.hashRemoveNode(old_node);
|
|
143838
|
+
try {
|
|
143839
|
+
old_dir.node_ops.rename(old_node, new_dir, new_name);
|
|
143840
|
+
old_node.parent = new_dir;
|
|
143841
|
+
} catch (e) {
|
|
143842
|
+
throw e;
|
|
143843
|
+
} finally {
|
|
143844
|
+
FS.hashAddNode(old_node);
|
|
143845
|
+
}
|
|
143846
|
+
}, rmdir(path) {
|
|
143847
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
143848
|
+
var parent = lookup.node;
|
|
143849
|
+
var name = PATH.basename(path);
|
|
143850
|
+
var node = FS.lookupNode(parent, name);
|
|
143851
|
+
var errCode = FS.mayDelete(parent, name, true);
|
|
143852
|
+
if (errCode) {
|
|
143853
|
+
throw new FS.ErrnoError(errCode);
|
|
143854
|
+
}
|
|
143855
|
+
if (!parent.node_ops.rmdir) {
|
|
143856
|
+
throw new FS.ErrnoError(63);
|
|
143857
|
+
}
|
|
143858
|
+
if (FS.isMountpoint(node)) {
|
|
143859
|
+
throw new FS.ErrnoError(10);
|
|
143860
|
+
}
|
|
143861
|
+
parent.node_ops.rmdir(parent, name);
|
|
143862
|
+
FS.destroyNode(node);
|
|
143863
|
+
}, readdir(path) {
|
|
143864
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
143865
|
+
var node = lookup.node;
|
|
143866
|
+
var readdir = FS.checkOpExists(node.node_ops.readdir, 54);
|
|
143867
|
+
return readdir(node);
|
|
143868
|
+
}, unlink(path) {
|
|
143869
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
143870
|
+
var parent = lookup.node;
|
|
143871
|
+
if (!parent) {
|
|
143872
|
+
throw new FS.ErrnoError(44);
|
|
143873
|
+
}
|
|
143874
|
+
var name = PATH.basename(path);
|
|
143875
|
+
var node = FS.lookupNode(parent, name);
|
|
143876
|
+
var errCode = FS.mayDelete(parent, name, false);
|
|
143877
|
+
if (errCode) {
|
|
143878
|
+
throw new FS.ErrnoError(errCode);
|
|
143879
|
+
}
|
|
143880
|
+
if (!parent.node_ops.unlink) {
|
|
143881
|
+
throw new FS.ErrnoError(63);
|
|
143882
|
+
}
|
|
143883
|
+
if (FS.isMountpoint(node)) {
|
|
143884
|
+
throw new FS.ErrnoError(10);
|
|
143885
|
+
}
|
|
143886
|
+
parent.node_ops.unlink(parent, name);
|
|
143887
|
+
FS.destroyNode(node);
|
|
143888
|
+
}, readlink(path) {
|
|
143889
|
+
var lookup = FS.lookupPath(path);
|
|
143890
|
+
var link = lookup.node;
|
|
143891
|
+
if (!link) {
|
|
143892
|
+
throw new FS.ErrnoError(44);
|
|
143893
|
+
}
|
|
143894
|
+
if (!link.node_ops.readlink) {
|
|
143895
|
+
throw new FS.ErrnoError(28);
|
|
143896
|
+
}
|
|
143897
|
+
return link.node_ops.readlink(link);
|
|
143898
|
+
}, stat(path, dontFollow) {
|
|
143899
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
143900
|
+
var node = lookup.node;
|
|
143901
|
+
var getattr = FS.checkOpExists(node.node_ops.getattr, 63);
|
|
143902
|
+
return getattr(node);
|
|
143903
|
+
}, fstat(fd) {
|
|
143904
|
+
var stream = FS.getStreamChecked(fd);
|
|
143905
|
+
var node = stream.node;
|
|
143906
|
+
var getattr = stream.stream_ops.getattr;
|
|
143907
|
+
var arg = getattr ? stream : node;
|
|
143908
|
+
getattr ?? (getattr = node.node_ops.getattr);
|
|
143909
|
+
FS.checkOpExists(getattr, 63);
|
|
143910
|
+
return getattr(arg);
|
|
143911
|
+
}, lstat(path) {
|
|
143912
|
+
return FS.stat(path, true);
|
|
143913
|
+
}, doChmod(stream, node, mode, dontFollow) {
|
|
143914
|
+
FS.doSetAttr(stream, node, { mode: mode & 4095 | node.mode & ~4095, ctime: Date.now(), dontFollow });
|
|
143915
|
+
}, chmod(path, mode, dontFollow) {
|
|
143916
|
+
var node;
|
|
143917
|
+
if (typeof path == "string") {
|
|
143918
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
143919
|
+
node = lookup.node;
|
|
143920
|
+
} else {
|
|
143921
|
+
node = path;
|
|
143922
|
+
}
|
|
143923
|
+
FS.doChmod(null, node, mode, dontFollow);
|
|
143924
|
+
}, lchmod(path, mode) {
|
|
143925
|
+
FS.chmod(path, mode, true);
|
|
143926
|
+
}, fchmod(fd, mode) {
|
|
143927
|
+
var stream = FS.getStreamChecked(fd);
|
|
143928
|
+
FS.doChmod(stream, stream.node, mode, false);
|
|
143929
|
+
}, doChown(stream, node, dontFollow) {
|
|
143930
|
+
FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow });
|
|
143931
|
+
}, chown(path, uid, gid, dontFollow) {
|
|
143932
|
+
var node;
|
|
143933
|
+
if (typeof path == "string") {
|
|
143934
|
+
var lookup = FS.lookupPath(path, { follow: !dontFollow });
|
|
143935
|
+
node = lookup.node;
|
|
143936
|
+
} else {
|
|
143937
|
+
node = path;
|
|
143938
|
+
}
|
|
143939
|
+
FS.doChown(null, node, dontFollow);
|
|
143940
|
+
}, lchown(path, uid, gid) {
|
|
143941
|
+
FS.chown(path, uid, gid, true);
|
|
143942
|
+
}, fchown(fd, uid, gid) {
|
|
143943
|
+
var stream = FS.getStreamChecked(fd);
|
|
143944
|
+
FS.doChown(stream, stream.node, false);
|
|
143945
|
+
}, doTruncate(stream, node, len) {
|
|
143946
|
+
if (FS.isDir(node.mode)) {
|
|
143947
|
+
throw new FS.ErrnoError(31);
|
|
143948
|
+
}
|
|
143949
|
+
if (!FS.isFile(node.mode)) {
|
|
143950
|
+
throw new FS.ErrnoError(28);
|
|
143951
|
+
}
|
|
143952
|
+
var errCode = FS.nodePermissions(node, "w");
|
|
143953
|
+
if (errCode) {
|
|
143954
|
+
throw new FS.ErrnoError(errCode);
|
|
143955
|
+
}
|
|
143956
|
+
FS.doSetAttr(stream, node, { size: len, timestamp: Date.now() });
|
|
143957
|
+
}, truncate(path, len) {
|
|
143958
|
+
if (len < 0) {
|
|
143959
|
+
throw new FS.ErrnoError(28);
|
|
143960
|
+
}
|
|
143961
|
+
var node;
|
|
143962
|
+
if (typeof path == "string") {
|
|
143963
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
143964
|
+
node = lookup.node;
|
|
143965
|
+
} else {
|
|
143966
|
+
node = path;
|
|
143967
|
+
}
|
|
143968
|
+
FS.doTruncate(null, node, len);
|
|
143969
|
+
}, ftruncate(fd, len) {
|
|
143970
|
+
var stream = FS.getStreamChecked(fd);
|
|
143971
|
+
if (len < 0 || (stream.flags & 2097155) === 0) {
|
|
143972
|
+
throw new FS.ErrnoError(28);
|
|
143973
|
+
}
|
|
143974
|
+
FS.doTruncate(stream, stream.node, len);
|
|
143975
|
+
}, utime(path, atime, mtime) {
|
|
143976
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
143977
|
+
var node = lookup.node;
|
|
143978
|
+
var setattr = FS.checkOpExists(node.node_ops.setattr, 63);
|
|
143979
|
+
setattr(node, { atime, mtime });
|
|
143980
|
+
}, open(path, flags, mode = 438) {
|
|
143981
|
+
if (path === "") {
|
|
143982
|
+
throw new FS.ErrnoError(44);
|
|
143983
|
+
}
|
|
143984
|
+
flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags;
|
|
143985
|
+
if (flags & 64) {
|
|
143986
|
+
mode = mode & 4095 | 32768;
|
|
143987
|
+
} else {
|
|
143988
|
+
mode = 0;
|
|
143989
|
+
}
|
|
143990
|
+
var node;
|
|
143991
|
+
var isDirPath;
|
|
143992
|
+
if (typeof path == "object") {
|
|
143993
|
+
node = path;
|
|
143994
|
+
} else {
|
|
143995
|
+
isDirPath = path.endsWith("/");
|
|
143996
|
+
var lookup = FS.lookupPath(path, { follow: !(flags & 131072), noent_okay: true });
|
|
143997
|
+
node = lookup.node;
|
|
143998
|
+
path = lookup.path;
|
|
143999
|
+
}
|
|
144000
|
+
var created = false;
|
|
144001
|
+
if (flags & 64) {
|
|
144002
|
+
if (node) {
|
|
144003
|
+
if (flags & 128) {
|
|
144004
|
+
throw new FS.ErrnoError(20);
|
|
144005
|
+
}
|
|
144006
|
+
} else if (isDirPath) {
|
|
144007
|
+
throw new FS.ErrnoError(31);
|
|
144008
|
+
} else {
|
|
144009
|
+
node = FS.mknod(path, mode | 511, 0);
|
|
144010
|
+
created = true;
|
|
144011
|
+
}
|
|
144012
|
+
}
|
|
144013
|
+
if (!node) {
|
|
144014
|
+
throw new FS.ErrnoError(44);
|
|
144015
|
+
}
|
|
144016
|
+
if (FS.isChrdev(node.mode)) {
|
|
144017
|
+
flags &= ~512;
|
|
144018
|
+
}
|
|
144019
|
+
if (flags & 65536 && !FS.isDir(node.mode)) {
|
|
144020
|
+
throw new FS.ErrnoError(54);
|
|
144021
|
+
}
|
|
144022
|
+
if (!created) {
|
|
144023
|
+
var errCode = FS.mayOpen(node, flags);
|
|
144024
|
+
if (errCode) {
|
|
144025
|
+
throw new FS.ErrnoError(errCode);
|
|
144026
|
+
}
|
|
144027
|
+
}
|
|
144028
|
+
if (flags & 512 && !created) {
|
|
144029
|
+
FS.truncate(node, 0);
|
|
144030
|
+
}
|
|
144031
|
+
flags &= ~(128 | 512 | 131072);
|
|
144032
|
+
var stream = FS.createStream({ node, path: FS.getPath(node), flags, seekable: true, position: 0, stream_ops: node.stream_ops, ungotten: [], error: false });
|
|
144033
|
+
if (stream.stream_ops.open) {
|
|
144034
|
+
stream.stream_ops.open(stream);
|
|
144035
|
+
}
|
|
144036
|
+
if (created) {
|
|
144037
|
+
FS.chmod(node, mode & 511);
|
|
144038
|
+
}
|
|
144039
|
+
if (Module["logReadFiles"] && !(flags & 1)) {
|
|
144040
|
+
if (!(path in FS.readFiles)) {
|
|
144041
|
+
FS.readFiles[path] = 1;
|
|
144042
|
+
}
|
|
144043
|
+
}
|
|
144044
|
+
return stream;
|
|
144045
|
+
}, close(stream) {
|
|
144046
|
+
if (FS.isClosed(stream)) {
|
|
144047
|
+
throw new FS.ErrnoError(8);
|
|
144048
|
+
}
|
|
144049
|
+
if (stream.getdents)
|
|
144050
|
+
stream.getdents = null;
|
|
144051
|
+
try {
|
|
144052
|
+
if (stream.stream_ops.close) {
|
|
144053
|
+
stream.stream_ops.close(stream);
|
|
144054
|
+
}
|
|
144055
|
+
} catch (e) {
|
|
144056
|
+
throw e;
|
|
144057
|
+
} finally {
|
|
144058
|
+
FS.closeStream(stream.fd);
|
|
144059
|
+
}
|
|
144060
|
+
stream.fd = null;
|
|
144061
|
+
}, isClosed(stream) {
|
|
144062
|
+
return stream.fd === null;
|
|
144063
|
+
}, llseek(stream, offset, whence) {
|
|
144064
|
+
if (FS.isClosed(stream)) {
|
|
144065
|
+
throw new FS.ErrnoError(8);
|
|
144066
|
+
}
|
|
144067
|
+
if (!stream.seekable || !stream.stream_ops.llseek) {
|
|
144068
|
+
throw new FS.ErrnoError(70);
|
|
144069
|
+
}
|
|
144070
|
+
if (whence != 0 && whence != 1 && whence != 2) {
|
|
144071
|
+
throw new FS.ErrnoError(28);
|
|
144072
|
+
}
|
|
144073
|
+
stream.position = stream.stream_ops.llseek(stream, offset, whence);
|
|
144074
|
+
stream.ungotten = [];
|
|
144075
|
+
return stream.position;
|
|
144076
|
+
}, read(stream, buffer, offset, length, position) {
|
|
144077
|
+
if (length < 0 || position < 0) {
|
|
144078
|
+
throw new FS.ErrnoError(28);
|
|
144079
|
+
}
|
|
144080
|
+
if (FS.isClosed(stream)) {
|
|
144081
|
+
throw new FS.ErrnoError(8);
|
|
144082
|
+
}
|
|
144083
|
+
if ((stream.flags & 2097155) === 1) {
|
|
144084
|
+
throw new FS.ErrnoError(8);
|
|
144085
|
+
}
|
|
144086
|
+
if (FS.isDir(stream.node.mode)) {
|
|
144087
|
+
throw new FS.ErrnoError(31);
|
|
144088
|
+
}
|
|
144089
|
+
if (!stream.stream_ops.read) {
|
|
144090
|
+
throw new FS.ErrnoError(28);
|
|
144091
|
+
}
|
|
144092
|
+
var seeking = typeof position != "undefined";
|
|
144093
|
+
if (!seeking) {
|
|
144094
|
+
position = stream.position;
|
|
144095
|
+
} else if (!stream.seekable) {
|
|
144096
|
+
throw new FS.ErrnoError(70);
|
|
144097
|
+
}
|
|
144098
|
+
var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
|
|
144099
|
+
if (!seeking)
|
|
144100
|
+
stream.position += bytesRead;
|
|
144101
|
+
return bytesRead;
|
|
144102
|
+
}, write(stream, buffer, offset, length, position, canOwn) {
|
|
144103
|
+
if (length < 0 || position < 0) {
|
|
144104
|
+
throw new FS.ErrnoError(28);
|
|
144105
|
+
}
|
|
144106
|
+
if (FS.isClosed(stream)) {
|
|
144107
|
+
throw new FS.ErrnoError(8);
|
|
144108
|
+
}
|
|
144109
|
+
if ((stream.flags & 2097155) === 0) {
|
|
144110
|
+
throw new FS.ErrnoError(8);
|
|
144111
|
+
}
|
|
144112
|
+
if (FS.isDir(stream.node.mode)) {
|
|
144113
|
+
throw new FS.ErrnoError(31);
|
|
144114
|
+
}
|
|
144115
|
+
if (!stream.stream_ops.write) {
|
|
144116
|
+
throw new FS.ErrnoError(28);
|
|
144117
|
+
}
|
|
144118
|
+
if (stream.seekable && stream.flags & 1024) {
|
|
144119
|
+
FS.llseek(stream, 0, 2);
|
|
144120
|
+
}
|
|
144121
|
+
var seeking = typeof position != "undefined";
|
|
144122
|
+
if (!seeking) {
|
|
144123
|
+
position = stream.position;
|
|
144124
|
+
} else if (!stream.seekable) {
|
|
144125
|
+
throw new FS.ErrnoError(70);
|
|
144126
|
+
}
|
|
144127
|
+
var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
|
|
144128
|
+
if (!seeking)
|
|
144129
|
+
stream.position += bytesWritten;
|
|
144130
|
+
return bytesWritten;
|
|
144131
|
+
}, allocate(stream, offset, length) {
|
|
144132
|
+
if (FS.isClosed(stream)) {
|
|
144133
|
+
throw new FS.ErrnoError(8);
|
|
144134
|
+
}
|
|
144135
|
+
if (offset < 0 || length <= 0) {
|
|
144136
|
+
throw new FS.ErrnoError(28);
|
|
144137
|
+
}
|
|
144138
|
+
if ((stream.flags & 2097155) === 0) {
|
|
144139
|
+
throw new FS.ErrnoError(8);
|
|
144140
|
+
}
|
|
144141
|
+
if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) {
|
|
144142
|
+
throw new FS.ErrnoError(43);
|
|
144143
|
+
}
|
|
144144
|
+
if (!stream.stream_ops.allocate) {
|
|
144145
|
+
throw new FS.ErrnoError(138);
|
|
144146
|
+
}
|
|
144147
|
+
stream.stream_ops.allocate(stream, offset, length);
|
|
144148
|
+
}, mmap(stream, length, position, prot, flags) {
|
|
144149
|
+
if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
|
|
144150
|
+
throw new FS.ErrnoError(2);
|
|
144151
|
+
}
|
|
144152
|
+
if ((stream.flags & 2097155) === 1) {
|
|
144153
|
+
throw new FS.ErrnoError(2);
|
|
144154
|
+
}
|
|
144155
|
+
if (!stream.stream_ops.mmap) {
|
|
144156
|
+
throw new FS.ErrnoError(43);
|
|
144157
|
+
}
|
|
144158
|
+
if (!length) {
|
|
144159
|
+
throw new FS.ErrnoError(28);
|
|
144160
|
+
}
|
|
144161
|
+
return stream.stream_ops.mmap(stream, length, position, prot, flags);
|
|
144162
|
+
}, msync(stream, buffer, offset, length, mmapFlags) {
|
|
144163
|
+
if (!stream.stream_ops.msync) {
|
|
144164
|
+
return 0;
|
|
144165
|
+
}
|
|
144166
|
+
return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
|
|
144167
|
+
}, ioctl(stream, cmd, arg) {
|
|
144168
|
+
if (!stream.stream_ops.ioctl) {
|
|
144169
|
+
throw new FS.ErrnoError(59);
|
|
144170
|
+
}
|
|
144171
|
+
return stream.stream_ops.ioctl(stream, cmd, arg);
|
|
144172
|
+
}, readFile(path, opts = {}) {
|
|
144173
|
+
opts.flags = opts.flags || 0;
|
|
144174
|
+
opts.encoding = opts.encoding || "binary";
|
|
144175
|
+
if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
|
|
144176
|
+
throw new Error(`Invalid encoding type "${opts.encoding}"`);
|
|
144177
|
+
}
|
|
144178
|
+
var ret;
|
|
144179
|
+
var stream = FS.open(path, opts.flags);
|
|
144180
|
+
var stat = FS.stat(path);
|
|
144181
|
+
var length = stat.size;
|
|
144182
|
+
var buf = new Uint8Array(length);
|
|
144183
|
+
FS.read(stream, buf, 0, length, 0);
|
|
144184
|
+
if (opts.encoding === "utf8") {
|
|
144185
|
+
ret = UTF8ArrayToString(buf);
|
|
144186
|
+
} else if (opts.encoding === "binary") {
|
|
144187
|
+
ret = buf;
|
|
144188
|
+
}
|
|
144189
|
+
FS.close(stream);
|
|
144190
|
+
return ret;
|
|
144191
|
+
}, writeFile(path, data, opts = {}) {
|
|
144192
|
+
opts.flags = opts.flags || 577;
|
|
144193
|
+
var stream = FS.open(path, opts.flags, opts.mode);
|
|
144194
|
+
if (typeof data == "string") {
|
|
144195
|
+
var buf = new Uint8Array(lengthBytesUTF8(data) + 1);
|
|
144196
|
+
var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length);
|
|
144197
|
+
FS.write(stream, buf, 0, actualNumBytes, void 0, opts.canOwn);
|
|
144198
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
144199
|
+
FS.write(stream, data, 0, data.byteLength, void 0, opts.canOwn);
|
|
144200
|
+
} else {
|
|
144201
|
+
throw new Error("Unsupported data type");
|
|
144202
|
+
}
|
|
144203
|
+
FS.close(stream);
|
|
144204
|
+
}, cwd: () => FS.currentPath, chdir(path) {
|
|
144205
|
+
var lookup = FS.lookupPath(path, { follow: true });
|
|
144206
|
+
if (lookup.node === null) {
|
|
144207
|
+
throw new FS.ErrnoError(44);
|
|
144208
|
+
}
|
|
144209
|
+
if (!FS.isDir(lookup.node.mode)) {
|
|
144210
|
+
throw new FS.ErrnoError(54);
|
|
144211
|
+
}
|
|
144212
|
+
var errCode = FS.nodePermissions(lookup.node, "x");
|
|
144213
|
+
if (errCode) {
|
|
144214
|
+
throw new FS.ErrnoError(errCode);
|
|
144215
|
+
}
|
|
144216
|
+
FS.currentPath = lookup.path;
|
|
144217
|
+
}, createDefaultDirectories() {
|
|
144218
|
+
FS.mkdir("/tmp");
|
|
144219
|
+
FS.mkdir("/home");
|
|
144220
|
+
FS.mkdir("/home/web_user");
|
|
144221
|
+
}, createDefaultDevices() {
|
|
144222
|
+
FS.mkdir("/dev");
|
|
144223
|
+
FS.registerDevice(FS.makedev(1, 3), { read: () => 0, write: (stream, buffer, offset, length, pos) => length, llseek: () => 0 });
|
|
144224
|
+
FS.mkdev("/dev/null", FS.makedev(1, 3));
|
|
144225
|
+
TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
|
|
144226
|
+
TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
|
|
144227
|
+
FS.mkdev("/dev/tty", FS.makedev(5, 0));
|
|
144228
|
+
FS.mkdev("/dev/tty1", FS.makedev(6, 0));
|
|
144229
|
+
var randomBuffer = new Uint8Array(1024), randomLeft = 0;
|
|
144230
|
+
var randomByte = () => {
|
|
144231
|
+
if (randomLeft === 0) {
|
|
144232
|
+
randomFill(randomBuffer);
|
|
144233
|
+
randomLeft = randomBuffer.byteLength;
|
|
144234
|
+
}
|
|
144235
|
+
return randomBuffer[--randomLeft];
|
|
144236
|
+
};
|
|
144237
|
+
FS.createDevice("/dev", "random", randomByte);
|
|
144238
|
+
FS.createDevice("/dev", "urandom", randomByte);
|
|
144239
|
+
FS.mkdir("/dev/shm");
|
|
144240
|
+
FS.mkdir("/dev/shm/tmp");
|
|
144241
|
+
}, createSpecialDirectories() {
|
|
144242
|
+
FS.mkdir("/proc");
|
|
144243
|
+
var proc_self = FS.mkdir("/proc/self");
|
|
144244
|
+
FS.mkdir("/proc/self/fd");
|
|
144245
|
+
FS.mount({ mount() {
|
|
144246
|
+
var node = FS.createNode(proc_self, "fd", 16895, 73);
|
|
144247
|
+
node.stream_ops = { llseek: MEMFS.stream_ops.llseek };
|
|
144248
|
+
node.node_ops = { lookup(parent, name) {
|
|
144249
|
+
var fd = +name;
|
|
144250
|
+
var stream = FS.getStreamChecked(fd);
|
|
144251
|
+
var ret = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: () => stream.path }, id: fd + 1 };
|
|
144252
|
+
ret.parent = ret;
|
|
144253
|
+
return ret;
|
|
144254
|
+
}, readdir() {
|
|
144255
|
+
return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString());
|
|
144256
|
+
} };
|
|
144257
|
+
return node;
|
|
144258
|
+
} }, {}, "/proc/self/fd");
|
|
144259
|
+
}, createStandardStreams(input, output, error) {
|
|
144260
|
+
if (input) {
|
|
144261
|
+
FS.createDevice("/dev", "stdin", input);
|
|
144262
|
+
} else {
|
|
144263
|
+
FS.symlink("/dev/tty", "/dev/stdin");
|
|
144264
|
+
}
|
|
144265
|
+
if (output) {
|
|
144266
|
+
FS.createDevice("/dev", "stdout", null, output);
|
|
144267
|
+
} else {
|
|
144268
|
+
FS.symlink("/dev/tty", "/dev/stdout");
|
|
144269
|
+
}
|
|
144270
|
+
if (error) {
|
|
144271
|
+
FS.createDevice("/dev", "stderr", null, error);
|
|
144272
|
+
} else {
|
|
144273
|
+
FS.symlink("/dev/tty1", "/dev/stderr");
|
|
144274
|
+
}
|
|
144275
|
+
FS.open("/dev/stdin", 0);
|
|
144276
|
+
FS.open("/dev/stdout", 1);
|
|
144277
|
+
FS.open("/dev/stderr", 1);
|
|
144278
|
+
}, staticInit() {
|
|
144279
|
+
FS.nameTable = new Array(4096);
|
|
144280
|
+
FS.mount(MEMFS, {}, "/");
|
|
144281
|
+
FS.createDefaultDirectories();
|
|
144282
|
+
FS.createDefaultDevices();
|
|
144283
|
+
FS.createSpecialDirectories();
|
|
144284
|
+
FS.filesystems = { MEMFS };
|
|
144285
|
+
}, init(input, output, error) {
|
|
144286
|
+
FS.initialized = true;
|
|
144287
|
+
input ?? (input = Module["stdin"]);
|
|
144288
|
+
output ?? (output = Module["stdout"]);
|
|
144289
|
+
error ?? (error = Module["stderr"]);
|
|
144290
|
+
FS.createStandardStreams(input, output, error);
|
|
144291
|
+
}, quit() {
|
|
144292
|
+
FS.initialized = false;
|
|
144293
|
+
for (var i = 0; i < FS.streams.length; i++) {
|
|
144294
|
+
var stream = FS.streams[i];
|
|
144295
|
+
if (!stream) {
|
|
144296
|
+
continue;
|
|
144297
|
+
}
|
|
144298
|
+
FS.close(stream);
|
|
144299
|
+
}
|
|
144300
|
+
}, findObject(path, dontResolveLastLink) {
|
|
144301
|
+
var ret = FS.analyzePath(path, dontResolveLastLink);
|
|
144302
|
+
if (!ret.exists) {
|
|
144303
|
+
return null;
|
|
144304
|
+
}
|
|
144305
|
+
return ret.object;
|
|
144306
|
+
}, analyzePath(path, dontResolveLastLink) {
|
|
144307
|
+
try {
|
|
144308
|
+
var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
144309
|
+
path = lookup.path;
|
|
144310
|
+
} catch (e) {
|
|
144311
|
+
}
|
|
144312
|
+
var ret = { isRoot: false, exists: false, error: 0, name: null, path: null, object: null, parentExists: false, parentPath: null, parentObject: null };
|
|
144313
|
+
try {
|
|
144314
|
+
var lookup = FS.lookupPath(path, { parent: true });
|
|
144315
|
+
ret.parentExists = true;
|
|
144316
|
+
ret.parentPath = lookup.path;
|
|
144317
|
+
ret.parentObject = lookup.node;
|
|
144318
|
+
ret.name = PATH.basename(path);
|
|
144319
|
+
lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
|
|
144320
|
+
ret.exists = true;
|
|
144321
|
+
ret.path = lookup.path;
|
|
144322
|
+
ret.object = lookup.node;
|
|
144323
|
+
ret.name = lookup.node.name;
|
|
144324
|
+
ret.isRoot = lookup.path === "/";
|
|
144325
|
+
} catch (e) {
|
|
144326
|
+
ret.error = e.errno;
|
|
144327
|
+
}
|
|
144328
|
+
return ret;
|
|
144329
|
+
}, createPath(parent, path, canRead, canWrite) {
|
|
144330
|
+
parent = typeof parent == "string" ? parent : FS.getPath(parent);
|
|
144331
|
+
var parts = path.split("/").reverse();
|
|
144332
|
+
while (parts.length) {
|
|
144333
|
+
var part = parts.pop();
|
|
144334
|
+
if (!part)
|
|
144335
|
+
continue;
|
|
144336
|
+
var current = PATH.join2(parent, part);
|
|
144337
|
+
try {
|
|
144338
|
+
FS.mkdir(current);
|
|
144339
|
+
} catch (e) {
|
|
144340
|
+
}
|
|
144341
|
+
parent = current;
|
|
144342
|
+
}
|
|
144343
|
+
return current;
|
|
144344
|
+
}, createFile(parent, name, properties, canRead, canWrite) {
|
|
144345
|
+
var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
|
|
144346
|
+
var mode = FS_getMode(canRead, canWrite);
|
|
144347
|
+
return FS.create(path, mode);
|
|
144348
|
+
}, createDataFile(parent, name, data, canRead, canWrite, canOwn) {
|
|
144349
|
+
var path = name;
|
|
144350
|
+
if (parent) {
|
|
144351
|
+
parent = typeof parent == "string" ? parent : FS.getPath(parent);
|
|
144352
|
+
path = name ? PATH.join2(parent, name) : parent;
|
|
144353
|
+
}
|
|
144354
|
+
var mode = FS_getMode(canRead, canWrite);
|
|
144355
|
+
var node = FS.create(path, mode);
|
|
144356
|
+
if (data) {
|
|
144357
|
+
if (typeof data == "string") {
|
|
144358
|
+
var arr = new Array(data.length);
|
|
144359
|
+
for (var i = 0, len = data.length; i < len; ++i)
|
|
144360
|
+
arr[i] = data.charCodeAt(i);
|
|
144361
|
+
data = arr;
|
|
144362
|
+
}
|
|
144363
|
+
FS.chmod(node, mode | 146);
|
|
144364
|
+
var stream = FS.open(node, 577);
|
|
144365
|
+
FS.write(stream, data, 0, data.length, 0, canOwn);
|
|
144366
|
+
FS.close(stream);
|
|
144367
|
+
FS.chmod(node, mode);
|
|
144368
|
+
}
|
|
144369
|
+
}, createDevice(parent, name, input, output) {
|
|
144370
|
+
var _a;
|
|
144371
|
+
var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
|
|
144372
|
+
var mode = FS_getMode(!!input, !!output);
|
|
144373
|
+
(_a = FS.createDevice).major ?? (_a.major = 64);
|
|
144374
|
+
var dev = FS.makedev(FS.createDevice.major++, 0);
|
|
144375
|
+
FS.registerDevice(dev, { open(stream) {
|
|
144376
|
+
stream.seekable = false;
|
|
144377
|
+
}, close(stream) {
|
|
144378
|
+
if (output?.buffer?.length) {
|
|
144379
|
+
output(10);
|
|
144380
|
+
}
|
|
144381
|
+
}, read(stream, buffer, offset, length, pos) {
|
|
144382
|
+
var bytesRead = 0;
|
|
144383
|
+
for (var i = 0; i < length; i++) {
|
|
144384
|
+
var result;
|
|
144385
|
+
try {
|
|
144386
|
+
result = input();
|
|
144387
|
+
} catch (e) {
|
|
144388
|
+
throw new FS.ErrnoError(29);
|
|
144389
|
+
}
|
|
144390
|
+
if (result === void 0 && bytesRead === 0) {
|
|
144391
|
+
throw new FS.ErrnoError(6);
|
|
144392
|
+
}
|
|
144393
|
+
if (result === null || result === void 0)
|
|
144394
|
+
break;
|
|
144395
|
+
bytesRead++;
|
|
144396
|
+
buffer[offset + i] = result;
|
|
144397
|
+
}
|
|
144398
|
+
if (bytesRead) {
|
|
144399
|
+
stream.node.atime = Date.now();
|
|
144400
|
+
}
|
|
144401
|
+
return bytesRead;
|
|
144402
|
+
}, write(stream, buffer, offset, length, pos) {
|
|
144403
|
+
for (var i = 0; i < length; i++) {
|
|
144404
|
+
try {
|
|
144405
|
+
output(buffer[offset + i]);
|
|
144406
|
+
} catch (e) {
|
|
144407
|
+
throw new FS.ErrnoError(29);
|
|
144408
|
+
}
|
|
144409
|
+
}
|
|
144410
|
+
if (length) {
|
|
144411
|
+
stream.node.mtime = stream.node.ctime = Date.now();
|
|
144412
|
+
}
|
|
144413
|
+
return i;
|
|
144414
|
+
} });
|
|
144415
|
+
return FS.mkdev(path, mode, dev);
|
|
144416
|
+
}, forceLoadFile(obj) {
|
|
144417
|
+
if (obj.isDevice || obj.isFolder || obj.link || obj.contents)
|
|
144418
|
+
return true;
|
|
144419
|
+
if (typeof XMLHttpRequest != "undefined") {
|
|
144420
|
+
throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
|
|
144421
|
+
} else {
|
|
144422
|
+
try {
|
|
144423
|
+
obj.contents = readBinary(obj.url);
|
|
144424
|
+
obj.usedBytes = obj.contents.length;
|
|
144425
|
+
} catch (e) {
|
|
144426
|
+
throw new FS.ErrnoError(29);
|
|
144427
|
+
}
|
|
144428
|
+
}
|
|
144429
|
+
}, createLazyFile(parent, name, url, canRead, canWrite) {
|
|
144430
|
+
class LazyUint8Array {
|
|
144431
|
+
constructor() {
|
|
144432
|
+
__publicField$2(this, "lengthKnown", false);
|
|
144433
|
+
__publicField$2(this, "chunks", []);
|
|
144434
|
+
}
|
|
144435
|
+
get(idx) {
|
|
144436
|
+
if (idx > this.length - 1 || idx < 0) {
|
|
144437
|
+
return void 0;
|
|
144438
|
+
}
|
|
144439
|
+
var chunkOffset = idx % this.chunkSize;
|
|
144440
|
+
var chunkNum = idx / this.chunkSize | 0;
|
|
144441
|
+
return this.getter(chunkNum)[chunkOffset];
|
|
144442
|
+
}
|
|
144443
|
+
setDataGetter(getter) {
|
|
144444
|
+
this.getter = getter;
|
|
144445
|
+
}
|
|
144446
|
+
cacheLength() {
|
|
144447
|
+
var xhr = new XMLHttpRequest();
|
|
144448
|
+
xhr.open("HEAD", url, false);
|
|
144449
|
+
xhr.send(null);
|
|
144450
|
+
if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304))
|
|
144451
|
+
throw new Error("Couldn't load " + url + ". Status: " + xhr.status);
|
|
144452
|
+
var datalength = Number(xhr.getResponseHeader("Content-length"));
|
|
144453
|
+
var header;
|
|
144454
|
+
var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
|
|
144455
|
+
var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
|
|
144456
|
+
var chunkSize = 1024 * 1024;
|
|
144457
|
+
if (!hasByteServing)
|
|
144458
|
+
chunkSize = datalength;
|
|
144459
|
+
var doXHR = (from, to) => {
|
|
144460
|
+
if (from > to)
|
|
144461
|
+
throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!");
|
|
144462
|
+
if (to > datalength - 1)
|
|
144463
|
+
throw new Error("only " + datalength + " bytes available! programmer error!");
|
|
144464
|
+
var xhr2 = new XMLHttpRequest();
|
|
144465
|
+
xhr2.open("GET", url, false);
|
|
144466
|
+
if (datalength !== chunkSize)
|
|
144467
|
+
xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
|
|
144468
|
+
xhr2.responseType = "arraybuffer";
|
|
144469
|
+
if (xhr2.overrideMimeType) {
|
|
144470
|
+
xhr2.overrideMimeType("text/plain; charset=x-user-defined");
|
|
144471
|
+
}
|
|
144472
|
+
xhr2.send(null);
|
|
144473
|
+
if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304))
|
|
144474
|
+
throw new Error("Couldn't load " + url + ". Status: " + xhr2.status);
|
|
144475
|
+
if (xhr2.response !== void 0) {
|
|
144476
|
+
return new Uint8Array(xhr2.response || []);
|
|
144477
|
+
}
|
|
144478
|
+
return intArrayFromString(xhr2.responseText || "", true);
|
|
144479
|
+
};
|
|
144480
|
+
var lazyArray2 = this;
|
|
144481
|
+
lazyArray2.setDataGetter((chunkNum) => {
|
|
144482
|
+
var start = chunkNum * chunkSize;
|
|
144483
|
+
var end = (chunkNum + 1) * chunkSize - 1;
|
|
144484
|
+
end = Math.min(end, datalength - 1);
|
|
144485
|
+
if (typeof lazyArray2.chunks[chunkNum] == "undefined") {
|
|
144486
|
+
lazyArray2.chunks[chunkNum] = doXHR(start, end);
|
|
144487
|
+
}
|
|
144488
|
+
if (typeof lazyArray2.chunks[chunkNum] == "undefined")
|
|
144489
|
+
throw new Error("doXHR failed!");
|
|
144490
|
+
return lazyArray2.chunks[chunkNum];
|
|
144491
|
+
});
|
|
144492
|
+
if (usesGzip || !datalength) {
|
|
144493
|
+
chunkSize = datalength = 1;
|
|
144494
|
+
datalength = this.getter(0).length;
|
|
144495
|
+
chunkSize = datalength;
|
|
144496
|
+
out("LazyFiles on gzip forces download of the whole file when length is accessed");
|
|
144497
|
+
}
|
|
144498
|
+
this._length = datalength;
|
|
144499
|
+
this._chunkSize = chunkSize;
|
|
144500
|
+
this.lengthKnown = true;
|
|
144501
|
+
}
|
|
144502
|
+
get length() {
|
|
144503
|
+
if (!this.lengthKnown) {
|
|
144504
|
+
this.cacheLength();
|
|
144505
|
+
}
|
|
144506
|
+
return this._length;
|
|
144507
|
+
}
|
|
144508
|
+
get chunkSize() {
|
|
144509
|
+
if (!this.lengthKnown) {
|
|
144510
|
+
this.cacheLength();
|
|
144511
|
+
}
|
|
144512
|
+
return this._chunkSize;
|
|
144513
|
+
}
|
|
144514
|
+
}
|
|
144515
|
+
if (typeof XMLHttpRequest != "undefined") {
|
|
144516
|
+
throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
|
|
144517
|
+
var lazyArray = new LazyUint8Array();
|
|
144518
|
+
var properties = { isDevice: false, contents: lazyArray };
|
|
144519
|
+
} else {
|
|
144520
|
+
var properties = { isDevice: false, url };
|
|
144521
|
+
}
|
|
144522
|
+
var node = FS.createFile(parent, name, properties, canRead, canWrite);
|
|
144523
|
+
if (properties.contents) {
|
|
144524
|
+
node.contents = properties.contents;
|
|
144525
|
+
} else if (properties.url) {
|
|
144526
|
+
node.contents = null;
|
|
144527
|
+
node.url = properties.url;
|
|
144528
|
+
}
|
|
144529
|
+
Object.defineProperties(node, { usedBytes: { get: function() {
|
|
144530
|
+
return this.contents.length;
|
|
144531
|
+
} } });
|
|
144532
|
+
var stream_ops = {};
|
|
144533
|
+
var keys = Object.keys(node.stream_ops);
|
|
144534
|
+
keys.forEach((key) => {
|
|
144535
|
+
var fn = node.stream_ops[key];
|
|
144536
|
+
stream_ops[key] = (...args) => {
|
|
144537
|
+
FS.forceLoadFile(node);
|
|
144538
|
+
return fn(...args);
|
|
144539
|
+
};
|
|
144540
|
+
});
|
|
144541
|
+
function writeChunks(stream, buffer, offset, length, position) {
|
|
144542
|
+
var contents = stream.node.contents;
|
|
144543
|
+
if (position >= contents.length)
|
|
144544
|
+
return 0;
|
|
144545
|
+
var size = Math.min(contents.length - position, length);
|
|
144546
|
+
if (contents.slice) {
|
|
144547
|
+
for (var i = 0; i < size; i++) {
|
|
144548
|
+
buffer[offset + i] = contents[position + i];
|
|
144549
|
+
}
|
|
144550
|
+
} else {
|
|
144551
|
+
for (var i = 0; i < size; i++) {
|
|
144552
|
+
buffer[offset + i] = contents.get(position + i);
|
|
144553
|
+
}
|
|
144554
|
+
}
|
|
144555
|
+
return size;
|
|
144556
|
+
}
|
|
144557
|
+
stream_ops.read = (stream, buffer, offset, length, position) => {
|
|
144558
|
+
FS.forceLoadFile(node);
|
|
144559
|
+
return writeChunks(stream, buffer, offset, length, position);
|
|
144560
|
+
};
|
|
144561
|
+
stream_ops.mmap = (stream, length, position, prot, flags) => {
|
|
144562
|
+
FS.forceLoadFile(node);
|
|
144563
|
+
var ptr = mmapAlloc();
|
|
144564
|
+
if (!ptr) {
|
|
144565
|
+
throw new FS.ErrnoError(48);
|
|
144566
|
+
}
|
|
144567
|
+
writeChunks(stream, HEAP8, ptr, length, position);
|
|
144568
|
+
return { ptr, allocated: true };
|
|
144569
|
+
};
|
|
144570
|
+
node.stream_ops = stream_ops;
|
|
144571
|
+
return node;
|
|
144572
|
+
} };
|
|
144573
|
+
var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
|
|
144574
|
+
var SYSCALLS = { DEFAULT_POLLMASK: 5, calculateAt(dirfd, path, allowEmpty) {
|
|
144575
|
+
if (PATH.isAbs(path)) {
|
|
144576
|
+
return path;
|
|
144577
|
+
}
|
|
144578
|
+
var dir;
|
|
144579
|
+
if (dirfd === -100) {
|
|
144580
|
+
dir = FS.cwd();
|
|
144581
|
+
} else {
|
|
144582
|
+
var dirstream = SYSCALLS.getStreamFromFD(dirfd);
|
|
144583
|
+
dir = dirstream.path;
|
|
144584
|
+
}
|
|
144585
|
+
if (path.length == 0) {
|
|
144586
|
+
if (!allowEmpty) {
|
|
144587
|
+
throw new FS.ErrnoError(44);
|
|
144588
|
+
}
|
|
144589
|
+
return dir;
|
|
144590
|
+
}
|
|
144591
|
+
return dir + "/" + path;
|
|
144592
|
+
}, writeStat(buf, stat) {
|
|
144593
|
+
HEAP32[buf >> 2] = stat.dev;
|
|
144594
|
+
HEAP32[buf + 4 >> 2] = stat.mode;
|
|
144595
|
+
HEAPU32[buf + 8 >> 2] = stat.nlink;
|
|
144596
|
+
HEAP32[buf + 12 >> 2] = stat.uid;
|
|
144597
|
+
HEAP32[buf + 16 >> 2] = stat.gid;
|
|
144598
|
+
HEAP32[buf + 20 >> 2] = stat.rdev;
|
|
144599
|
+
HEAP64[buf + 24 >> 3] = BigInt(stat.size);
|
|
144600
|
+
HEAP32[buf + 32 >> 2] = 4096;
|
|
144601
|
+
HEAP32[buf + 36 >> 2] = stat.blocks;
|
|
144602
|
+
var atime = stat.atime.getTime();
|
|
144603
|
+
var mtime = stat.mtime.getTime();
|
|
144604
|
+
var ctime = stat.ctime.getTime();
|
|
144605
|
+
HEAP64[buf + 40 >> 3] = BigInt(Math.floor(atime / 1e3));
|
|
144606
|
+
HEAPU32[buf + 48 >> 2] = atime % 1e3 * 1e3 * 1e3;
|
|
144607
|
+
HEAP64[buf + 56 >> 3] = BigInt(Math.floor(mtime / 1e3));
|
|
144608
|
+
HEAPU32[buf + 64 >> 2] = mtime % 1e3 * 1e3 * 1e3;
|
|
144609
|
+
HEAP64[buf + 72 >> 3] = BigInt(Math.floor(ctime / 1e3));
|
|
144610
|
+
HEAPU32[buf + 80 >> 2] = ctime % 1e3 * 1e3 * 1e3;
|
|
144611
|
+
HEAP64[buf + 88 >> 3] = BigInt(stat.ino);
|
|
144612
|
+
return 0;
|
|
144613
|
+
}, writeStatFs(buf, stats) {
|
|
144614
|
+
HEAP32[buf + 4 >> 2] = stats.bsize;
|
|
144615
|
+
HEAP32[buf + 40 >> 2] = stats.bsize;
|
|
144616
|
+
HEAP32[buf + 8 >> 2] = stats.blocks;
|
|
144617
|
+
HEAP32[buf + 12 >> 2] = stats.bfree;
|
|
144618
|
+
HEAP32[buf + 16 >> 2] = stats.bavail;
|
|
144619
|
+
HEAP32[buf + 20 >> 2] = stats.files;
|
|
144620
|
+
HEAP32[buf + 24 >> 2] = stats.ffree;
|
|
144621
|
+
HEAP32[buf + 28 >> 2] = stats.fsid;
|
|
144622
|
+
HEAP32[buf + 44 >> 2] = stats.flags;
|
|
144623
|
+
HEAP32[buf + 36 >> 2] = stats.namelen;
|
|
144624
|
+
}, doMsync(addr, stream, len, flags, offset) {
|
|
144625
|
+
if (!FS.isFile(stream.node.mode)) {
|
|
144626
|
+
throw new FS.ErrnoError(43);
|
|
144627
|
+
}
|
|
144628
|
+
if (flags & 2) {
|
|
144629
|
+
return 0;
|
|
144630
|
+
}
|
|
144631
|
+
var buffer = HEAPU8.slice(addr, addr + len);
|
|
144632
|
+
FS.msync(stream, buffer, offset, len, flags);
|
|
144633
|
+
}, getStreamFromFD(fd) {
|
|
144634
|
+
var stream = FS.getStreamChecked(fd);
|
|
144635
|
+
return stream;
|
|
144636
|
+
}, varargs: void 0, getStr(ptr) {
|
|
144637
|
+
var ret = UTF8ToString(ptr);
|
|
144638
|
+
return ret;
|
|
144639
|
+
} };
|
|
144640
|
+
function ___syscall_fcntl64(fd, cmd, varargs) {
|
|
144641
|
+
SYSCALLS.varargs = varargs;
|
|
144642
|
+
try {
|
|
144643
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
144644
|
+
switch (cmd) {
|
|
144645
|
+
case 0: {
|
|
144646
|
+
var arg = syscallGetVarargI();
|
|
144647
|
+
if (arg < 0) {
|
|
144648
|
+
return -28;
|
|
144649
|
+
}
|
|
144650
|
+
while (FS.streams[arg]) {
|
|
144651
|
+
arg++;
|
|
144652
|
+
}
|
|
144653
|
+
var newStream;
|
|
144654
|
+
newStream = FS.dupStream(stream, arg);
|
|
144655
|
+
return newStream.fd;
|
|
144656
|
+
}
|
|
144657
|
+
case 1:
|
|
144658
|
+
case 2:
|
|
144659
|
+
return 0;
|
|
144660
|
+
case 3:
|
|
144661
|
+
return stream.flags;
|
|
144662
|
+
case 4: {
|
|
144663
|
+
var arg = syscallGetVarargI();
|
|
144664
|
+
stream.flags |= arg;
|
|
144665
|
+
return 0;
|
|
144666
|
+
}
|
|
144667
|
+
case 12: {
|
|
144668
|
+
var arg = syscallGetVarargP();
|
|
144669
|
+
var offset = 0;
|
|
144670
|
+
HEAP16[arg + offset >> 1] = 2;
|
|
144671
|
+
return 0;
|
|
144672
|
+
}
|
|
144673
|
+
case 13:
|
|
144674
|
+
case 14:
|
|
144675
|
+
return 0;
|
|
144676
|
+
}
|
|
144677
|
+
return -28;
|
|
144678
|
+
} catch (e) {
|
|
144679
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144680
|
+
throw e;
|
|
144681
|
+
return -e.errno;
|
|
144682
|
+
}
|
|
144683
|
+
}
|
|
144684
|
+
function ___syscall_ioctl(fd, op, varargs) {
|
|
144685
|
+
SYSCALLS.varargs = varargs;
|
|
144686
|
+
try {
|
|
144687
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
144688
|
+
switch (op) {
|
|
144689
|
+
case 21509: {
|
|
144690
|
+
if (!stream.tty)
|
|
144691
|
+
return -59;
|
|
144692
|
+
return 0;
|
|
144693
|
+
}
|
|
144694
|
+
case 21505: {
|
|
144695
|
+
if (!stream.tty)
|
|
144696
|
+
return -59;
|
|
144697
|
+
if (stream.tty.ops.ioctl_tcgets) {
|
|
144698
|
+
var termios = stream.tty.ops.ioctl_tcgets(stream);
|
|
144699
|
+
var argp = syscallGetVarargP();
|
|
144700
|
+
HEAP32[argp >> 2] = termios.c_iflag || 0;
|
|
144701
|
+
HEAP32[argp + 4 >> 2] = termios.c_oflag || 0;
|
|
144702
|
+
HEAP32[argp + 8 >> 2] = termios.c_cflag || 0;
|
|
144703
|
+
HEAP32[argp + 12 >> 2] = termios.c_lflag || 0;
|
|
144704
|
+
for (var i = 0; i < 32; i++) {
|
|
144705
|
+
HEAP8[argp + i + 17] = termios.c_cc[i] || 0;
|
|
144706
|
+
}
|
|
144707
|
+
return 0;
|
|
144708
|
+
}
|
|
144709
|
+
return 0;
|
|
144710
|
+
}
|
|
144711
|
+
case 21510:
|
|
144712
|
+
case 21511:
|
|
144713
|
+
case 21512: {
|
|
144714
|
+
if (!stream.tty)
|
|
144715
|
+
return -59;
|
|
144716
|
+
return 0;
|
|
144717
|
+
}
|
|
144718
|
+
case 21506:
|
|
144719
|
+
case 21507:
|
|
144720
|
+
case 21508: {
|
|
144721
|
+
if (!stream.tty)
|
|
144722
|
+
return -59;
|
|
144723
|
+
if (stream.tty.ops.ioctl_tcsets) {
|
|
144724
|
+
var argp = syscallGetVarargP();
|
|
144725
|
+
var c_iflag = HEAP32[argp >> 2];
|
|
144726
|
+
var c_oflag = HEAP32[argp + 4 >> 2];
|
|
144727
|
+
var c_cflag = HEAP32[argp + 8 >> 2];
|
|
144728
|
+
var c_lflag = HEAP32[argp + 12 >> 2];
|
|
144729
|
+
var c_cc = [];
|
|
144730
|
+
for (var i = 0; i < 32; i++) {
|
|
144731
|
+
c_cc.push(HEAP8[argp + i + 17]);
|
|
144732
|
+
}
|
|
144733
|
+
return stream.tty.ops.ioctl_tcsets(stream.tty, op, { c_iflag, c_oflag, c_cflag, c_lflag, c_cc });
|
|
144734
|
+
}
|
|
144735
|
+
return 0;
|
|
144736
|
+
}
|
|
144737
|
+
case 21519: {
|
|
144738
|
+
if (!stream.tty)
|
|
144739
|
+
return -59;
|
|
144740
|
+
var argp = syscallGetVarargP();
|
|
144741
|
+
HEAP32[argp >> 2] = 0;
|
|
144742
|
+
return 0;
|
|
144743
|
+
}
|
|
144744
|
+
case 21520: {
|
|
144745
|
+
if (!stream.tty)
|
|
144746
|
+
return -59;
|
|
144747
|
+
return -28;
|
|
144748
|
+
}
|
|
144749
|
+
case 21531: {
|
|
144750
|
+
var argp = syscallGetVarargP();
|
|
144751
|
+
return FS.ioctl(stream, op, argp);
|
|
144752
|
+
}
|
|
144753
|
+
case 21523: {
|
|
144754
|
+
if (!stream.tty)
|
|
144755
|
+
return -59;
|
|
144756
|
+
if (stream.tty.ops.ioctl_tiocgwinsz) {
|
|
144757
|
+
var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty);
|
|
144758
|
+
var argp = syscallGetVarargP();
|
|
144759
|
+
HEAP16[argp >> 1] = winsize[0];
|
|
144760
|
+
HEAP16[argp + 2 >> 1] = winsize[1];
|
|
144761
|
+
}
|
|
144762
|
+
return 0;
|
|
144763
|
+
}
|
|
144764
|
+
case 21524: {
|
|
144765
|
+
if (!stream.tty)
|
|
144766
|
+
return -59;
|
|
144767
|
+
return 0;
|
|
144768
|
+
}
|
|
144769
|
+
case 21515: {
|
|
144770
|
+
if (!stream.tty)
|
|
144771
|
+
return -59;
|
|
144772
|
+
return 0;
|
|
144773
|
+
}
|
|
144774
|
+
default:
|
|
144775
|
+
return -28;
|
|
144776
|
+
}
|
|
144777
|
+
} catch (e) {
|
|
144778
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144779
|
+
throw e;
|
|
144780
|
+
return -e.errno;
|
|
144781
|
+
}
|
|
144782
|
+
}
|
|
144783
|
+
function ___syscall_openat(dirfd, path, flags, varargs) {
|
|
144784
|
+
SYSCALLS.varargs = varargs;
|
|
144785
|
+
try {
|
|
144786
|
+
path = SYSCALLS.getStr(path);
|
|
144787
|
+
path = SYSCALLS.calculateAt(dirfd, path);
|
|
144788
|
+
var mode = varargs ? syscallGetVarargI() : 0;
|
|
144789
|
+
return FS.open(path, flags, mode).fd;
|
|
144790
|
+
} catch (e) {
|
|
144791
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144792
|
+
throw e;
|
|
144793
|
+
return -e.errno;
|
|
144794
|
+
}
|
|
144795
|
+
}
|
|
144796
|
+
function ___syscall_renameat(olddirfd, oldpath, newdirfd, newpath) {
|
|
144797
|
+
try {
|
|
144798
|
+
oldpath = SYSCALLS.getStr(oldpath);
|
|
144799
|
+
newpath = SYSCALLS.getStr(newpath);
|
|
144800
|
+
oldpath = SYSCALLS.calculateAt(olddirfd, oldpath);
|
|
144801
|
+
newpath = SYSCALLS.calculateAt(newdirfd, newpath);
|
|
144802
|
+
FS.rename(oldpath, newpath);
|
|
144803
|
+
return 0;
|
|
144804
|
+
} catch (e) {
|
|
144805
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144806
|
+
throw e;
|
|
144807
|
+
return -e.errno;
|
|
144808
|
+
}
|
|
144809
|
+
}
|
|
144810
|
+
function ___syscall_rmdir(path) {
|
|
144811
|
+
try {
|
|
144812
|
+
path = SYSCALLS.getStr(path);
|
|
144813
|
+
FS.rmdir(path);
|
|
144814
|
+
return 0;
|
|
144815
|
+
} catch (e) {
|
|
144816
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144817
|
+
throw e;
|
|
144818
|
+
return -e.errno;
|
|
144819
|
+
}
|
|
144820
|
+
}
|
|
144821
|
+
function ___syscall_stat64(path, buf) {
|
|
144822
|
+
try {
|
|
144823
|
+
path = SYSCALLS.getStr(path);
|
|
144824
|
+
return SYSCALLS.writeStat(buf, FS.stat(path));
|
|
144825
|
+
} catch (e) {
|
|
144826
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144827
|
+
throw e;
|
|
144828
|
+
return -e.errno;
|
|
144829
|
+
}
|
|
144830
|
+
}
|
|
144831
|
+
function ___syscall_unlinkat(dirfd, path, flags) {
|
|
144832
|
+
try {
|
|
144833
|
+
path = SYSCALLS.getStr(path);
|
|
144834
|
+
path = SYSCALLS.calculateAt(dirfd, path);
|
|
144835
|
+
if (flags === 0) {
|
|
144836
|
+
FS.unlink(path);
|
|
144837
|
+
} else if (flags === 512) {
|
|
144838
|
+
FS.rmdir(path);
|
|
144839
|
+
} else {
|
|
144840
|
+
abort("Invalid flags passed to unlinkat");
|
|
144841
|
+
}
|
|
144842
|
+
return 0;
|
|
144843
|
+
} catch (e) {
|
|
144844
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
144845
|
+
throw e;
|
|
144846
|
+
return -e.errno;
|
|
144847
|
+
}
|
|
144848
|
+
}
|
|
144849
|
+
var __abort_js = () => abort("");
|
|
144850
|
+
var structRegistrations = {};
|
|
144851
|
+
var runDestructors = (destructors) => {
|
|
144852
|
+
while (destructors.length) {
|
|
144853
|
+
var ptr = destructors.pop();
|
|
144854
|
+
var del = destructors.pop();
|
|
144855
|
+
del(ptr);
|
|
144856
|
+
}
|
|
144857
|
+
};
|
|
144858
|
+
function readPointer(pointer) {
|
|
144859
|
+
return this["fromWireType"](HEAPU32[pointer >> 2]);
|
|
144860
|
+
}
|
|
144861
|
+
var awaitingDependencies = {};
|
|
144862
|
+
var registeredTypes = {};
|
|
144863
|
+
var typeDependencies = {};
|
|
144864
|
+
var InternalError;
|
|
144865
|
+
var throwInternalError = (message) => {
|
|
144866
|
+
throw new InternalError(message);
|
|
144867
|
+
};
|
|
144868
|
+
var whenDependentTypesAreResolved = (myTypes, dependentTypes, getTypeConverters) => {
|
|
144869
|
+
myTypes.forEach((type) => typeDependencies[type] = dependentTypes);
|
|
144870
|
+
function onComplete(typeConverters2) {
|
|
144871
|
+
var myTypeConverters = getTypeConverters(typeConverters2);
|
|
144872
|
+
if (myTypeConverters.length !== myTypes.length) {
|
|
144873
|
+
throwInternalError("Mismatched type converter count");
|
|
144874
|
+
}
|
|
144875
|
+
for (var i = 0; i < myTypes.length; ++i) {
|
|
144876
|
+
registerType(myTypes[i], myTypeConverters[i]);
|
|
144877
|
+
}
|
|
144878
|
+
}
|
|
144879
|
+
var typeConverters = new Array(dependentTypes.length);
|
|
144880
|
+
var unregisteredTypes = [];
|
|
144881
|
+
var registered = 0;
|
|
144882
|
+
dependentTypes.forEach((dt, i) => {
|
|
144883
|
+
if (registeredTypes.hasOwnProperty(dt)) {
|
|
144884
|
+
typeConverters[i] = registeredTypes[dt];
|
|
144885
|
+
} else {
|
|
144886
|
+
unregisteredTypes.push(dt);
|
|
144887
|
+
if (!awaitingDependencies.hasOwnProperty(dt)) {
|
|
144888
|
+
awaitingDependencies[dt] = [];
|
|
144889
|
+
}
|
|
144890
|
+
awaitingDependencies[dt].push(() => {
|
|
144891
|
+
typeConverters[i] = registeredTypes[dt];
|
|
144892
|
+
++registered;
|
|
144893
|
+
if (registered === unregisteredTypes.length) {
|
|
144894
|
+
onComplete(typeConverters);
|
|
144895
|
+
}
|
|
144896
|
+
});
|
|
144897
|
+
}
|
|
144898
|
+
});
|
|
144899
|
+
if (0 === unregisteredTypes.length) {
|
|
144900
|
+
onComplete(typeConverters);
|
|
144901
|
+
}
|
|
144902
|
+
};
|
|
144903
|
+
var __embind_finalize_value_object = (structType) => {
|
|
144904
|
+
var reg = structRegistrations[structType];
|
|
144905
|
+
delete structRegistrations[structType];
|
|
144906
|
+
var rawConstructor = reg.rawConstructor;
|
|
144907
|
+
var rawDestructor = reg.rawDestructor;
|
|
144908
|
+
var fieldRecords = reg.fields;
|
|
144909
|
+
var fieldTypes = fieldRecords.map((field) => field.getterReturnType).concat(fieldRecords.map((field) => field.setterArgumentType));
|
|
144910
|
+
whenDependentTypesAreResolved([structType], fieldTypes, (fieldTypes2) => {
|
|
144911
|
+
var fields = {};
|
|
144912
|
+
fieldRecords.forEach((field, i) => {
|
|
144913
|
+
var fieldName = field.fieldName;
|
|
144914
|
+
var getterReturnType = fieldTypes2[i];
|
|
144915
|
+
var getter = field.getter;
|
|
144916
|
+
var getterContext = field.getterContext;
|
|
144917
|
+
var setterArgumentType = fieldTypes2[i + fieldRecords.length];
|
|
144918
|
+
var setter = field.setter;
|
|
144919
|
+
var setterContext = field.setterContext;
|
|
144920
|
+
fields[fieldName] = { read: (ptr) => getterReturnType["fromWireType"](getter(getterContext, ptr)), write: (ptr, o) => {
|
|
144921
|
+
var destructors = [];
|
|
144922
|
+
setter(setterContext, ptr, setterArgumentType["toWireType"](destructors, o));
|
|
144923
|
+
runDestructors(destructors);
|
|
144924
|
+
} };
|
|
144925
|
+
});
|
|
144926
|
+
return [{ name: reg.name, fromWireType: (ptr) => {
|
|
144927
|
+
var rv = {};
|
|
144928
|
+
for (var i in fields) {
|
|
144929
|
+
rv[i] = fields[i].read(ptr);
|
|
144930
|
+
}
|
|
144931
|
+
rawDestructor(ptr);
|
|
144932
|
+
return rv;
|
|
144933
|
+
}, toWireType: (destructors, o) => {
|
|
144934
|
+
for (var fieldName in fields) {
|
|
144935
|
+
if (!(fieldName in o)) {
|
|
144936
|
+
throw new TypeError(`Missing field: "${fieldName}"`);
|
|
144937
|
+
}
|
|
144938
|
+
}
|
|
144939
|
+
var ptr = rawConstructor();
|
|
144940
|
+
for (fieldName in fields) {
|
|
144941
|
+
fields[fieldName].write(ptr, o[fieldName]);
|
|
144942
|
+
}
|
|
144943
|
+
if (destructors !== null) {
|
|
144944
|
+
destructors.push(rawDestructor, ptr);
|
|
144945
|
+
}
|
|
144946
|
+
return ptr;
|
|
144947
|
+
}, argPackAdvance: GenericWireTypeSize, readValueFromPointer: readPointer, destructorFunction: rawDestructor }];
|
|
144948
|
+
});
|
|
144949
|
+
};
|
|
144950
|
+
var embindRepr = (v) => {
|
|
144951
|
+
if (v === null) {
|
|
144952
|
+
return "null";
|
|
144953
|
+
}
|
|
144954
|
+
var t = typeof v;
|
|
144955
|
+
if (t === "object" || t === "array" || t === "function") {
|
|
144956
|
+
return v.toString();
|
|
144957
|
+
} else {
|
|
144958
|
+
return "" + v;
|
|
144959
|
+
}
|
|
144960
|
+
};
|
|
144961
|
+
var embind_init_charCodes = () => {
|
|
144962
|
+
var codes = new Array(256);
|
|
144963
|
+
for (var i = 0; i < 256; ++i) {
|
|
144964
|
+
codes[i] = String.fromCharCode(i);
|
|
144965
|
+
}
|
|
144966
|
+
embind_charCodes = codes;
|
|
144967
|
+
};
|
|
144968
|
+
var embind_charCodes;
|
|
144969
|
+
var readLatin1String = (ptr) => {
|
|
144970
|
+
var ret = "";
|
|
144971
|
+
var c = ptr;
|
|
144972
|
+
while (HEAPU8[c]) {
|
|
144973
|
+
ret += embind_charCodes[HEAPU8[c++]];
|
|
144974
|
+
}
|
|
144975
|
+
return ret;
|
|
144976
|
+
};
|
|
144977
|
+
var BindingError;
|
|
144978
|
+
var throwBindingError = (message) => {
|
|
144979
|
+
throw new BindingError(message);
|
|
144980
|
+
};
|
|
144981
|
+
function sharedRegisterType(rawType, registeredInstance, options = {}) {
|
|
144982
|
+
var name = registeredInstance.name;
|
|
144983
|
+
if (!rawType) {
|
|
144984
|
+
throwBindingError(`type "${name}" must have a positive integer typeid pointer`);
|
|
144985
|
+
}
|
|
144986
|
+
if (registeredTypes.hasOwnProperty(rawType)) {
|
|
144987
|
+
if (options.ignoreDuplicateRegistrations) {
|
|
144988
|
+
return;
|
|
144989
|
+
} else {
|
|
144990
|
+
throwBindingError(`Cannot register type '${name}' twice`);
|
|
144991
|
+
}
|
|
144992
|
+
}
|
|
144993
|
+
registeredTypes[rawType] = registeredInstance;
|
|
144994
|
+
delete typeDependencies[rawType];
|
|
144995
|
+
if (awaitingDependencies.hasOwnProperty(rawType)) {
|
|
144996
|
+
var callbacks = awaitingDependencies[rawType];
|
|
144997
|
+
delete awaitingDependencies[rawType];
|
|
144998
|
+
callbacks.forEach((cb) => cb());
|
|
144999
|
+
}
|
|
145000
|
+
}
|
|
145001
|
+
function registerType(rawType, registeredInstance, options = {}) {
|
|
145002
|
+
return sharedRegisterType(rawType, registeredInstance, options);
|
|
145003
|
+
}
|
|
145004
|
+
var integerReadValueFromPointer = (name, width, signed) => {
|
|
145005
|
+
switch (width) {
|
|
145006
|
+
case 1:
|
|
145007
|
+
return signed ? (pointer) => HEAP8[pointer] : (pointer) => HEAPU8[pointer];
|
|
145008
|
+
case 2:
|
|
145009
|
+
return signed ? (pointer) => HEAP16[pointer >> 1] : (pointer) => HEAPU16[pointer >> 1];
|
|
145010
|
+
case 4:
|
|
145011
|
+
return signed ? (pointer) => HEAP32[pointer >> 2] : (pointer) => HEAPU32[pointer >> 2];
|
|
145012
|
+
case 8:
|
|
145013
|
+
return signed ? (pointer) => HEAP64[pointer >> 3] : (pointer) => HEAPU64[pointer >> 3];
|
|
145014
|
+
default:
|
|
145015
|
+
throw new TypeError(`invalid integer width (${width}): ${name}`);
|
|
145016
|
+
}
|
|
145017
|
+
};
|
|
145018
|
+
var __embind_register_bigint = (primitiveType, name, size, minRange, maxRange) => {
|
|
145019
|
+
name = readLatin1String(name);
|
|
145020
|
+
var isUnsignedType = name.indexOf("u") != -1;
|
|
145021
|
+
registerType(primitiveType, { name, fromWireType: (value) => value, toWireType: function(destructors, value) {
|
|
145022
|
+
if (typeof value != "bigint" && typeof value != "number") {
|
|
145023
|
+
throw new TypeError(`Cannot convert "${embindRepr(value)}" to ${this.name}`);
|
|
145024
|
+
}
|
|
145025
|
+
if (typeof value == "number") {
|
|
145026
|
+
value = BigInt(value);
|
|
145027
|
+
}
|
|
145028
|
+
return value;
|
|
145029
|
+
}, argPackAdvance: GenericWireTypeSize, readValueFromPointer: integerReadValueFromPointer(name, size, !isUnsignedType), destructorFunction: null });
|
|
145030
|
+
};
|
|
145031
|
+
var GenericWireTypeSize = 8;
|
|
145032
|
+
var __embind_register_bool = (rawType, name, trueValue, falseValue) => {
|
|
145033
|
+
name = readLatin1String(name);
|
|
145034
|
+
registerType(rawType, { name, fromWireType: function(wt) {
|
|
145035
|
+
return !!wt;
|
|
145036
|
+
}, toWireType: function(destructors, o) {
|
|
145037
|
+
return o ? trueValue : falseValue;
|
|
145038
|
+
}, argPackAdvance: GenericWireTypeSize, readValueFromPointer: function(pointer) {
|
|
145039
|
+
return this["fromWireType"](HEAPU8[pointer]);
|
|
145040
|
+
}, destructorFunction: null });
|
|
145041
|
+
};
|
|
145042
|
+
var emval_freelist = [];
|
|
145043
|
+
var emval_handles = [];
|
|
145044
|
+
var __emval_decref = (handle) => {
|
|
145045
|
+
if (handle > 9 && 0 === --emval_handles[handle + 1]) {
|
|
145046
|
+
emval_handles[handle] = void 0;
|
|
145047
|
+
emval_freelist.push(handle);
|
|
145048
|
+
}
|
|
145049
|
+
};
|
|
145050
|
+
var count_emval_handles = () => emval_handles.length / 2 - 5 - emval_freelist.length;
|
|
145051
|
+
var init_emval = () => {
|
|
145052
|
+
emval_handles.push(0, 1, void 0, 1, null, 1, true, 1, false, 1);
|
|
145053
|
+
Module["count_emval_handles"] = count_emval_handles;
|
|
145054
|
+
};
|
|
145055
|
+
var Emval = { toValue: (handle) => {
|
|
145056
|
+
if (!handle) {
|
|
145057
|
+
throwBindingError("Cannot use deleted val. handle = " + handle);
|
|
145058
|
+
}
|
|
145059
|
+
return emval_handles[handle];
|
|
145060
|
+
}, toHandle: (value) => {
|
|
145061
|
+
switch (value) {
|
|
145062
|
+
case void 0:
|
|
145063
|
+
return 2;
|
|
145064
|
+
case null:
|
|
145065
|
+
return 4;
|
|
145066
|
+
case true:
|
|
145067
|
+
return 6;
|
|
145068
|
+
case false:
|
|
145069
|
+
return 8;
|
|
145070
|
+
default: {
|
|
145071
|
+
const handle = emval_freelist.pop() || emval_handles.length;
|
|
145072
|
+
emval_handles[handle] = value;
|
|
145073
|
+
emval_handles[handle + 1] = 1;
|
|
145074
|
+
return handle;
|
|
145075
|
+
}
|
|
145076
|
+
}
|
|
145077
|
+
} };
|
|
145078
|
+
var EmValType = { name: "emscripten::val", fromWireType: (handle) => {
|
|
145079
|
+
var rv = Emval.toValue(handle);
|
|
145080
|
+
__emval_decref(handle);
|
|
145081
|
+
return rv;
|
|
145082
|
+
}, toWireType: (destructors, value) => Emval.toHandle(value), argPackAdvance: GenericWireTypeSize, readValueFromPointer: readPointer, destructorFunction: null };
|
|
145083
|
+
var __embind_register_emval = (rawType) => registerType(rawType, EmValType);
|
|
145084
|
+
var floatReadValueFromPointer = (name, width) => {
|
|
145085
|
+
switch (width) {
|
|
145086
|
+
case 4:
|
|
145087
|
+
return function(pointer) {
|
|
145088
|
+
return this["fromWireType"](HEAPF32[pointer >> 2]);
|
|
145089
|
+
};
|
|
145090
|
+
case 8:
|
|
145091
|
+
return function(pointer) {
|
|
145092
|
+
return this["fromWireType"](HEAPF64[pointer >> 3]);
|
|
145093
|
+
};
|
|
145094
|
+
default:
|
|
145095
|
+
throw new TypeError(`invalid float width (${width}): ${name}`);
|
|
145096
|
+
}
|
|
145097
|
+
};
|
|
145098
|
+
var __embind_register_float = (rawType, name, size) => {
|
|
145099
|
+
name = readLatin1String(name);
|
|
145100
|
+
registerType(rawType, { name, fromWireType: (value) => value, toWireType: (destructors, value) => value, argPackAdvance: GenericWireTypeSize, readValueFromPointer: floatReadValueFromPointer(name, size), destructorFunction: null });
|
|
145101
|
+
};
|
|
145102
|
+
var createNamedFunction = (name, body) => Object.defineProperty(body, "name", { value: name });
|
|
145103
|
+
function usesDestructorStack(argTypes) {
|
|
145104
|
+
for (var i = 1; i < argTypes.length; ++i) {
|
|
145105
|
+
if (argTypes[i] !== null && argTypes[i].destructorFunction === void 0) {
|
|
145106
|
+
return true;
|
|
145107
|
+
}
|
|
145108
|
+
}
|
|
145109
|
+
return false;
|
|
145110
|
+
}
|
|
145111
|
+
function newFunc(constructor, argumentList) {
|
|
145112
|
+
if (!(constructor instanceof Function)) {
|
|
145113
|
+
throw new TypeError(`new_ called with constructor type ${typeof constructor} which is not a function`);
|
|
145114
|
+
}
|
|
145115
|
+
var dummy = createNamedFunction(constructor.name || "unknownFunctionName", function() {
|
|
145116
|
+
});
|
|
145117
|
+
dummy.prototype = constructor.prototype;
|
|
145118
|
+
var obj = new dummy();
|
|
145119
|
+
var r = constructor.apply(obj, argumentList);
|
|
145120
|
+
return r instanceof Object ? r : obj;
|
|
145121
|
+
}
|
|
145122
|
+
function createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync) {
|
|
145123
|
+
var needsDestructorStack = usesDestructorStack(argTypes);
|
|
145124
|
+
var argCount = argTypes.length - 2;
|
|
145125
|
+
var argsList = [];
|
|
145126
|
+
var argsListWired = ["fn"];
|
|
145127
|
+
if (isClassMethodFunc) {
|
|
145128
|
+
argsListWired.push("thisWired");
|
|
145129
|
+
}
|
|
145130
|
+
for (var i = 0; i < argCount; ++i) {
|
|
145131
|
+
argsList.push(`arg${i}`);
|
|
145132
|
+
argsListWired.push(`arg${i}Wired`);
|
|
145133
|
+
}
|
|
145134
|
+
argsList = argsList.join(",");
|
|
145135
|
+
argsListWired = argsListWired.join(",");
|
|
145136
|
+
var invokerFnBody = `return function (${argsList}) {
|
|
145137
|
+
`;
|
|
145138
|
+
if (needsDestructorStack) {
|
|
145139
|
+
invokerFnBody += "var destructors = [];\n";
|
|
145140
|
+
}
|
|
145141
|
+
var dtorStack = needsDestructorStack ? "destructors" : "null";
|
|
145142
|
+
var args1 = ["humanName", "throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"];
|
|
145143
|
+
if (isClassMethodFunc) {
|
|
145144
|
+
invokerFnBody += `var thisWired = classParam['toWireType'](${dtorStack}, this);
|
|
145145
|
+
`;
|
|
145146
|
+
}
|
|
145147
|
+
for (var i = 0; i < argCount; ++i) {
|
|
145148
|
+
invokerFnBody += `var arg${i}Wired = argType${i}['toWireType'](${dtorStack}, arg${i});
|
|
145149
|
+
`;
|
|
145150
|
+
args1.push(`argType${i}`);
|
|
145151
|
+
}
|
|
145152
|
+
invokerFnBody += (returns || isAsync ? "var rv = " : "") + `invoker(${argsListWired});
|
|
145153
|
+
`;
|
|
145154
|
+
var returnVal = returns ? "rv" : "";
|
|
145155
|
+
args1.push("Asyncify");
|
|
145156
|
+
invokerFnBody += `function onDone(${returnVal}) {
|
|
145157
|
+
`;
|
|
145158
|
+
if (needsDestructorStack) {
|
|
145159
|
+
invokerFnBody += "runDestructors(destructors);\n";
|
|
145160
|
+
} else {
|
|
145161
|
+
for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) {
|
|
145162
|
+
var paramName = i === 1 ? "thisWired" : "arg" + (i - 2) + "Wired";
|
|
145163
|
+
if (argTypes[i].destructorFunction !== null) {
|
|
145164
|
+
invokerFnBody += `${paramName}_dtor(${paramName});
|
|
145165
|
+
`;
|
|
145166
|
+
args1.push(`${paramName}_dtor`);
|
|
145167
|
+
}
|
|
145168
|
+
}
|
|
145169
|
+
}
|
|
145170
|
+
if (returns) {
|
|
145171
|
+
invokerFnBody += "var ret = retType['fromWireType'](rv);\nreturn ret;\n";
|
|
145172
|
+
}
|
|
145173
|
+
invokerFnBody += "}\n";
|
|
145174
|
+
invokerFnBody += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${returnVal});
|
|
145175
|
+
`;
|
|
145176
|
+
invokerFnBody += "}\n";
|
|
145177
|
+
return [args1, invokerFnBody];
|
|
145178
|
+
}
|
|
145179
|
+
var runAndAbortIfError = (func) => {
|
|
145180
|
+
try {
|
|
145181
|
+
return func();
|
|
145182
|
+
} catch (e) {
|
|
145183
|
+
abort(e);
|
|
145184
|
+
}
|
|
145185
|
+
};
|
|
145186
|
+
var handleException = (e) => {
|
|
145187
|
+
if (e instanceof ExitStatus || e == "unwind") {
|
|
145188
|
+
return EXITSTATUS;
|
|
145189
|
+
}
|
|
145190
|
+
quit_(1, e);
|
|
145191
|
+
};
|
|
145192
|
+
var runtimeKeepaliveCounter = 0;
|
|
145193
|
+
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
145194
|
+
var _proc_exit = (code) => {
|
|
145195
|
+
EXITSTATUS = code;
|
|
145196
|
+
if (!keepRuntimeAlive()) {
|
|
145197
|
+
Module["onExit"]?.(code);
|
|
145198
|
+
ABORT = true;
|
|
145199
|
+
}
|
|
145200
|
+
quit_(code, new ExitStatus(code));
|
|
145201
|
+
};
|
|
145202
|
+
var exitJS = (status, implicit) => {
|
|
145203
|
+
EXITSTATUS = status;
|
|
145204
|
+
_proc_exit(status);
|
|
145205
|
+
};
|
|
145206
|
+
var _exit = exitJS;
|
|
145207
|
+
var maybeExit = () => {
|
|
145208
|
+
if (!keepRuntimeAlive()) {
|
|
145209
|
+
try {
|
|
145210
|
+
_exit(EXITSTATUS);
|
|
145211
|
+
} catch (e) {
|
|
145212
|
+
handleException(e);
|
|
145213
|
+
}
|
|
145214
|
+
}
|
|
145215
|
+
};
|
|
145216
|
+
var callUserCallback = (func) => {
|
|
145217
|
+
if (ABORT) {
|
|
145218
|
+
return;
|
|
145219
|
+
}
|
|
145220
|
+
try {
|
|
145221
|
+
func();
|
|
145222
|
+
maybeExit();
|
|
145223
|
+
} catch (e) {
|
|
145224
|
+
handleException(e);
|
|
145225
|
+
}
|
|
145226
|
+
};
|
|
145227
|
+
var Asyncify = { instrumentWasmImports(imports) {
|
|
145228
|
+
var importPattern = /^(invoke_.*|__asyncjs__.*)$/;
|
|
145229
|
+
for (let [x, original] of Object.entries(imports)) {
|
|
145230
|
+
if (typeof original == "function") {
|
|
145231
|
+
original.isAsync || importPattern.test(x);
|
|
145232
|
+
}
|
|
145233
|
+
}
|
|
145234
|
+
}, instrumentWasmExports(exports) {
|
|
145235
|
+
var ret = {};
|
|
145236
|
+
for (let [x, original] of Object.entries(exports)) {
|
|
145237
|
+
if (typeof original == "function") {
|
|
145238
|
+
ret[x] = (...args) => {
|
|
145239
|
+
Asyncify.exportCallStack.push(x);
|
|
145240
|
+
try {
|
|
145241
|
+
return original(...args);
|
|
145242
|
+
} finally {
|
|
145243
|
+
if (!ABORT) {
|
|
145244
|
+
Asyncify.exportCallStack.pop();
|
|
145245
|
+
Asyncify.maybeStopUnwind();
|
|
145246
|
+
}
|
|
145247
|
+
}
|
|
145248
|
+
};
|
|
145249
|
+
} else {
|
|
145250
|
+
ret[x] = original;
|
|
145251
|
+
}
|
|
145252
|
+
}
|
|
145253
|
+
return ret;
|
|
145254
|
+
}, State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, state: 0, StackSize: 4096, currData: null, handleSleepReturnValue: 0, exportCallStack: [], callStackNameToId: {}, callStackIdToName: {}, callStackId: 0, asyncPromiseHandlers: null, sleepCallbacks: [], getCallStackId(funcName) {
|
|
145255
|
+
var id = Asyncify.callStackNameToId[funcName];
|
|
145256
|
+
if (id === void 0) {
|
|
145257
|
+
id = Asyncify.callStackId++;
|
|
145258
|
+
Asyncify.callStackNameToId[funcName] = id;
|
|
145259
|
+
Asyncify.callStackIdToName[id] = funcName;
|
|
145260
|
+
}
|
|
145261
|
+
return id;
|
|
145262
|
+
}, maybeStopUnwind() {
|
|
145263
|
+
if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && Asyncify.exportCallStack.length === 0) {
|
|
145264
|
+
Asyncify.state = Asyncify.State.Normal;
|
|
145265
|
+
runAndAbortIfError(_asyncify_stop_unwind);
|
|
145266
|
+
if (typeof Fibers != "undefined") {
|
|
145267
|
+
Fibers.trampoline();
|
|
145268
|
+
}
|
|
145269
|
+
}
|
|
145270
|
+
}, whenDone() {
|
|
145271
|
+
return new Promise((resolve, reject) => {
|
|
145272
|
+
Asyncify.asyncPromiseHandlers = { resolve, reject };
|
|
145273
|
+
});
|
|
145274
|
+
}, allocateData() {
|
|
145275
|
+
var ptr = _malloc(12 + Asyncify.StackSize);
|
|
145276
|
+
Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
|
|
145277
|
+
Asyncify.setDataRewindFunc(ptr);
|
|
145278
|
+
return ptr;
|
|
145279
|
+
}, setDataHeader(ptr, stack, stackSize) {
|
|
145280
|
+
HEAPU32[ptr >> 2] = stack;
|
|
145281
|
+
HEAPU32[ptr + 4 >> 2] = stack + stackSize;
|
|
145282
|
+
}, setDataRewindFunc(ptr) {
|
|
145283
|
+
var bottomOfCallStack = Asyncify.exportCallStack[0];
|
|
145284
|
+
var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
|
|
145285
|
+
HEAP32[ptr + 8 >> 2] = rewindId;
|
|
145286
|
+
}, getDataRewindFuncName(ptr) {
|
|
145287
|
+
var id = HEAP32[ptr + 8 >> 2];
|
|
145288
|
+
var name = Asyncify.callStackIdToName[id];
|
|
145289
|
+
return name;
|
|
145290
|
+
}, getDataRewindFunc(name) {
|
|
145291
|
+
var func = wasmExports[name];
|
|
145292
|
+
return func;
|
|
145293
|
+
}, doRewind(ptr) {
|
|
145294
|
+
var name = Asyncify.getDataRewindFuncName(ptr);
|
|
145295
|
+
var func = Asyncify.getDataRewindFunc(name);
|
|
145296
|
+
return func();
|
|
145297
|
+
}, handleSleep(startAsync) {
|
|
145298
|
+
if (ABORT)
|
|
145299
|
+
return;
|
|
145300
|
+
if (Asyncify.state === Asyncify.State.Normal) {
|
|
145301
|
+
var reachedCallback = false;
|
|
145302
|
+
var reachedAfterCallback = false;
|
|
145303
|
+
startAsync((handleSleepReturnValue = 0) => {
|
|
145304
|
+
if (ABORT)
|
|
145305
|
+
return;
|
|
145306
|
+
Asyncify.handleSleepReturnValue = handleSleepReturnValue;
|
|
145307
|
+
reachedCallback = true;
|
|
145308
|
+
if (!reachedAfterCallback) {
|
|
145309
|
+
return;
|
|
145310
|
+
}
|
|
145311
|
+
Asyncify.state = Asyncify.State.Rewinding;
|
|
145312
|
+
runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
|
|
145313
|
+
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
145314
|
+
MainLoop.resume();
|
|
145315
|
+
}
|
|
145316
|
+
var asyncWasmReturnValue, isError = false;
|
|
145317
|
+
try {
|
|
145318
|
+
asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData);
|
|
145319
|
+
} catch (err2) {
|
|
145320
|
+
asyncWasmReturnValue = err2;
|
|
145321
|
+
isError = true;
|
|
145322
|
+
}
|
|
145323
|
+
var handled = false;
|
|
145324
|
+
if (!Asyncify.currData) {
|
|
145325
|
+
var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers;
|
|
145326
|
+
if (asyncPromiseHandlers) {
|
|
145327
|
+
Asyncify.asyncPromiseHandlers = null;
|
|
145328
|
+
(isError ? asyncPromiseHandlers.reject : asyncPromiseHandlers.resolve)(asyncWasmReturnValue);
|
|
145329
|
+
handled = true;
|
|
145330
|
+
}
|
|
145331
|
+
}
|
|
145332
|
+
if (isError && !handled) {
|
|
145333
|
+
throw asyncWasmReturnValue;
|
|
145334
|
+
}
|
|
145335
|
+
});
|
|
145336
|
+
reachedAfterCallback = true;
|
|
145337
|
+
if (!reachedCallback) {
|
|
145338
|
+
Asyncify.state = Asyncify.State.Unwinding;
|
|
145339
|
+
Asyncify.currData = Asyncify.allocateData();
|
|
145340
|
+
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
145341
|
+
MainLoop.pause();
|
|
145342
|
+
}
|
|
145343
|
+
runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
|
|
145344
|
+
}
|
|
145345
|
+
} else if (Asyncify.state === Asyncify.State.Rewinding) {
|
|
145346
|
+
Asyncify.state = Asyncify.State.Normal;
|
|
145347
|
+
runAndAbortIfError(_asyncify_stop_rewind);
|
|
145348
|
+
_free(Asyncify.currData);
|
|
145349
|
+
Asyncify.currData = null;
|
|
145350
|
+
Asyncify.sleepCallbacks.forEach(callUserCallback);
|
|
145351
|
+
} else {
|
|
145352
|
+
abort(`invalid state: ${Asyncify.state}`);
|
|
145353
|
+
}
|
|
145354
|
+
return Asyncify.handleSleepReturnValue;
|
|
145355
|
+
}, handleAsync(startAsync) {
|
|
145356
|
+
return Asyncify.handleSleep((wakeUp) => {
|
|
145357
|
+
startAsync().then(wakeUp);
|
|
145358
|
+
});
|
|
145359
|
+
} };
|
|
145360
|
+
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, isAsync) {
|
|
145361
|
+
var argCount = argTypes.length;
|
|
145362
|
+
if (argCount < 2) {
|
|
145363
|
+
throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
145364
|
+
}
|
|
145365
|
+
var isClassMethodFunc = argTypes[1] !== null && classType !== null;
|
|
145366
|
+
var needsDestructorStack = usesDestructorStack(argTypes);
|
|
145367
|
+
var returns = argTypes[0].name !== "void";
|
|
145368
|
+
var closureArgs = [humanName, throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, argTypes[0], argTypes[1]];
|
|
145369
|
+
for (var i = 0; i < argCount - 2; ++i) {
|
|
145370
|
+
closureArgs.push(argTypes[i + 2]);
|
|
145371
|
+
}
|
|
145372
|
+
closureArgs.push(Asyncify);
|
|
145373
|
+
if (!needsDestructorStack) {
|
|
145374
|
+
for (var i = isClassMethodFunc ? 1 : 2; i < argTypes.length; ++i) {
|
|
145375
|
+
if (argTypes[i].destructorFunction !== null) {
|
|
145376
|
+
closureArgs.push(argTypes[i].destructorFunction);
|
|
145377
|
+
}
|
|
145378
|
+
}
|
|
145379
|
+
}
|
|
145380
|
+
let [args, invokerFnBody] = createJsInvoker(argTypes, isClassMethodFunc, returns, isAsync);
|
|
145381
|
+
args.push(invokerFnBody);
|
|
145382
|
+
var invokerFn = newFunc(Function, args)(...closureArgs);
|
|
145383
|
+
return createNamedFunction(humanName, invokerFn);
|
|
145384
|
+
}
|
|
145385
|
+
var ensureOverloadTable = (proto, methodName, humanName) => {
|
|
145386
|
+
if (void 0 === proto[methodName].overloadTable) {
|
|
145387
|
+
var prevFunc = proto[methodName];
|
|
145388
|
+
proto[methodName] = function(...args) {
|
|
145389
|
+
if (!proto[methodName].overloadTable.hasOwnProperty(args.length)) {
|
|
145390
|
+
throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`);
|
|
145391
|
+
}
|
|
145392
|
+
return proto[methodName].overloadTable[args.length].apply(this, args);
|
|
145393
|
+
};
|
|
145394
|
+
proto[methodName].overloadTable = [];
|
|
145395
|
+
proto[methodName].overloadTable[prevFunc.argCount] = prevFunc;
|
|
145396
|
+
}
|
|
145397
|
+
};
|
|
145398
|
+
var exposePublicSymbol = (name, value, numArguments) => {
|
|
145399
|
+
if (Module.hasOwnProperty(name)) {
|
|
145400
|
+
if (void 0 === numArguments || void 0 !== Module[name].overloadTable && void 0 !== Module[name].overloadTable[numArguments]) {
|
|
145401
|
+
throwBindingError(`Cannot register public name '${name}' twice`);
|
|
145402
|
+
}
|
|
145403
|
+
ensureOverloadTable(Module, name, name);
|
|
145404
|
+
if (Module[name].overloadTable.hasOwnProperty(numArguments)) {
|
|
145405
|
+
throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`);
|
|
145406
|
+
}
|
|
145407
|
+
Module[name].overloadTable[numArguments] = value;
|
|
145408
|
+
} else {
|
|
145409
|
+
Module[name] = value;
|
|
145410
|
+
Module[name].argCount = numArguments;
|
|
145411
|
+
}
|
|
145412
|
+
};
|
|
145413
|
+
var heap32VectorToArray = (count, firstElement) => {
|
|
145414
|
+
var array = [];
|
|
145415
|
+
for (var i = 0; i < count; i++) {
|
|
145416
|
+
array.push(HEAPU32[firstElement + i * 4 >> 2]);
|
|
145417
|
+
}
|
|
145418
|
+
return array;
|
|
145419
|
+
};
|
|
145420
|
+
var replacePublicSymbol = (name, value, numArguments) => {
|
|
145421
|
+
if (!Module.hasOwnProperty(name)) {
|
|
145422
|
+
throwInternalError("Replacing nonexistent public symbol");
|
|
145423
|
+
}
|
|
145424
|
+
if (void 0 !== Module[name].overloadTable && void 0 !== numArguments) {
|
|
145425
|
+
Module[name].overloadTable[numArguments] = value;
|
|
145426
|
+
} else {
|
|
145427
|
+
Module[name] = value;
|
|
145428
|
+
Module[name].argCount = numArguments;
|
|
145429
|
+
}
|
|
145430
|
+
};
|
|
145431
|
+
var dynCallLegacy = (sig, ptr, args) => {
|
|
145432
|
+
sig = sig.replace(/p/g, "i");
|
|
145433
|
+
var f = Module["dynCall_" + sig];
|
|
145434
|
+
return f(ptr, ...args);
|
|
145435
|
+
};
|
|
145436
|
+
var dynCall = (sig, ptr, args = []) => {
|
|
145437
|
+
var rtn = dynCallLegacy(sig, ptr, args);
|
|
145438
|
+
return rtn;
|
|
145439
|
+
};
|
|
145440
|
+
var getDynCaller = (sig, ptr) => (...args) => dynCall(sig, ptr, args);
|
|
145441
|
+
var embind__requireFunction = (signature, rawFunction) => {
|
|
145442
|
+
signature = readLatin1String(signature);
|
|
145443
|
+
function makeDynCaller() {
|
|
145444
|
+
return getDynCaller(signature, rawFunction);
|
|
145445
|
+
}
|
|
145446
|
+
var fp = makeDynCaller();
|
|
145447
|
+
if (typeof fp != "function") {
|
|
145448
|
+
throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`);
|
|
145449
|
+
}
|
|
145450
|
+
return fp;
|
|
145451
|
+
};
|
|
145452
|
+
var extendError = (baseErrorType, errorName) => {
|
|
145453
|
+
var errorClass = createNamedFunction(errorName, function(message) {
|
|
145454
|
+
this.name = errorName;
|
|
145455
|
+
this.message = message;
|
|
145456
|
+
var stack = new Error(message).stack;
|
|
145457
|
+
if (stack !== void 0) {
|
|
145458
|
+
this.stack = this.toString() + "\n" + stack.replace(/^Error(:[^\n]*)?\n/, "");
|
|
145459
|
+
}
|
|
145460
|
+
});
|
|
145461
|
+
errorClass.prototype = Object.create(baseErrorType.prototype);
|
|
145462
|
+
errorClass.prototype.constructor = errorClass;
|
|
145463
|
+
errorClass.prototype.toString = function() {
|
|
145464
|
+
if (this.message === void 0) {
|
|
145465
|
+
return this.name;
|
|
145466
|
+
} else {
|
|
145467
|
+
return `${this.name}: ${this.message}`;
|
|
145468
|
+
}
|
|
145469
|
+
};
|
|
145470
|
+
return errorClass;
|
|
145471
|
+
};
|
|
145472
|
+
var UnboundTypeError;
|
|
145473
|
+
var getTypeName = (type) => {
|
|
145474
|
+
var ptr = ___getTypeName(type);
|
|
145475
|
+
var rv = readLatin1String(ptr);
|
|
145476
|
+
_free(ptr);
|
|
145477
|
+
return rv;
|
|
145478
|
+
};
|
|
145479
|
+
var throwUnboundTypeError = (message, types) => {
|
|
145480
|
+
var unboundTypes = [];
|
|
145481
|
+
var seen = {};
|
|
145482
|
+
function visit(type) {
|
|
145483
|
+
if (seen[type]) {
|
|
145484
|
+
return;
|
|
145485
|
+
}
|
|
145486
|
+
if (registeredTypes[type]) {
|
|
145487
|
+
return;
|
|
145488
|
+
}
|
|
145489
|
+
if (typeDependencies[type]) {
|
|
145490
|
+
typeDependencies[type].forEach(visit);
|
|
145491
|
+
return;
|
|
145492
|
+
}
|
|
145493
|
+
unboundTypes.push(type);
|
|
145494
|
+
seen[type] = true;
|
|
145495
|
+
}
|
|
145496
|
+
types.forEach(visit);
|
|
145497
|
+
throw new UnboundTypeError(`${message}: ` + unboundTypes.map(getTypeName).join([", "]));
|
|
145498
|
+
};
|
|
145499
|
+
var getFunctionName = (signature) => {
|
|
145500
|
+
signature = signature.trim();
|
|
145501
|
+
const argsIndex = signature.indexOf("(");
|
|
145502
|
+
if (argsIndex === -1)
|
|
145503
|
+
return signature;
|
|
145504
|
+
return signature.slice(0, argsIndex);
|
|
145505
|
+
};
|
|
145506
|
+
var __embind_register_function = (name, argCount, rawArgTypesAddr, signature, rawInvoker, fn, isAsync, isNonnullReturn) => {
|
|
145507
|
+
var argTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
|
|
145508
|
+
name = readLatin1String(name);
|
|
145509
|
+
name = getFunctionName(name);
|
|
145510
|
+
rawInvoker = embind__requireFunction(signature, rawInvoker);
|
|
145511
|
+
exposePublicSymbol(name, function() {
|
|
145512
|
+
throwUnboundTypeError(`Cannot call ${name} due to unbound types`, argTypes);
|
|
145513
|
+
}, argCount - 1);
|
|
145514
|
+
whenDependentTypesAreResolved([], argTypes, (argTypes2) => {
|
|
145515
|
+
var invokerArgsArray = [argTypes2[0], null].concat(argTypes2.slice(1));
|
|
145516
|
+
replacePublicSymbol(name, craftInvokerFunction(name, invokerArgsArray, null, rawInvoker, fn, isAsync), argCount - 1);
|
|
145517
|
+
return [];
|
|
145518
|
+
});
|
|
145519
|
+
};
|
|
145520
|
+
var __embind_register_integer = (primitiveType, name, size, minRange, maxRange) => {
|
|
145521
|
+
name = readLatin1String(name);
|
|
145522
|
+
var fromWireType = (value) => value;
|
|
145523
|
+
if (minRange === 0) {
|
|
145524
|
+
var bitshift = 32 - 8 * size;
|
|
145525
|
+
fromWireType = (value) => value << bitshift >>> bitshift;
|
|
145526
|
+
}
|
|
145527
|
+
var isUnsignedType = name.includes("unsigned");
|
|
145528
|
+
var checkAssertions = (value, toTypeName) => {
|
|
145529
|
+
};
|
|
145530
|
+
var toWireType;
|
|
145531
|
+
if (isUnsignedType) {
|
|
145532
|
+
toWireType = function(destructors, value) {
|
|
145533
|
+
checkAssertions(value, this.name);
|
|
145534
|
+
return value >>> 0;
|
|
145535
|
+
};
|
|
145536
|
+
} else {
|
|
145537
|
+
toWireType = function(destructors, value) {
|
|
145538
|
+
checkAssertions(value, this.name);
|
|
145539
|
+
return value;
|
|
145540
|
+
};
|
|
145541
|
+
}
|
|
145542
|
+
registerType(primitiveType, { name, fromWireType, toWireType, argPackAdvance: GenericWireTypeSize, readValueFromPointer: integerReadValueFromPointer(name, size, minRange !== 0), destructorFunction: null });
|
|
145543
|
+
};
|
|
145544
|
+
var __embind_register_memory_view = (rawType, dataTypeIndex, name) => {
|
|
145545
|
+
var typeMapping = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array];
|
|
145546
|
+
var TA = typeMapping[dataTypeIndex];
|
|
145547
|
+
function decodeMemoryView(handle) {
|
|
145548
|
+
var size = HEAPU32[handle >> 2];
|
|
145549
|
+
var data = HEAPU32[handle + 4 >> 2];
|
|
145550
|
+
return new TA(HEAP8.buffer, data, size);
|
|
145551
|
+
}
|
|
145552
|
+
name = readLatin1String(name);
|
|
145553
|
+
registerType(rawType, { name, fromWireType: decodeMemoryView, argPackAdvance: GenericWireTypeSize, readValueFromPointer: decodeMemoryView }, { ignoreDuplicateRegistrations: true });
|
|
145554
|
+
};
|
|
145555
|
+
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
145556
|
+
var __embind_register_std_string = (rawType, name) => {
|
|
145557
|
+
name = readLatin1String(name);
|
|
145558
|
+
registerType(rawType, { name, fromWireType(value) {
|
|
145559
|
+
var length = HEAPU32[value >> 2];
|
|
145560
|
+
var payload = value + 4;
|
|
145561
|
+
var str;
|
|
145562
|
+
var i; {
|
|
145563
|
+
var decodeStartPtr = payload;
|
|
145564
|
+
for (var i = 0; i <= length; ++i) {
|
|
145565
|
+
var currentBytePtr = payload + i;
|
|
145566
|
+
if (i == length || HEAPU8[currentBytePtr] == 0) {
|
|
145567
|
+
var maxRead = currentBytePtr - decodeStartPtr;
|
|
145568
|
+
var stringSegment = UTF8ToString(decodeStartPtr, maxRead);
|
|
145569
|
+
if (str === void 0) {
|
|
145570
|
+
str = stringSegment;
|
|
145571
|
+
} else {
|
|
145572
|
+
str += String.fromCharCode(0);
|
|
145573
|
+
str += stringSegment;
|
|
145574
|
+
}
|
|
145575
|
+
decodeStartPtr = currentBytePtr + 1;
|
|
145576
|
+
}
|
|
145577
|
+
}
|
|
145578
|
+
}
|
|
145579
|
+
_free(value);
|
|
145580
|
+
return str;
|
|
145581
|
+
}, toWireType(destructors, value) {
|
|
145582
|
+
if (value instanceof ArrayBuffer) {
|
|
145583
|
+
value = new Uint8Array(value);
|
|
145584
|
+
}
|
|
145585
|
+
var length;
|
|
145586
|
+
var valueIsOfTypeString = typeof value == "string";
|
|
145587
|
+
if (!(valueIsOfTypeString || value instanceof Uint8Array || value instanceof Uint8ClampedArray || value instanceof Int8Array)) {
|
|
145588
|
+
throwBindingError("Cannot pass non-string to std::string");
|
|
145589
|
+
}
|
|
145590
|
+
if (valueIsOfTypeString) {
|
|
145591
|
+
length = lengthBytesUTF8(value);
|
|
145592
|
+
} else {
|
|
145593
|
+
length = value.length;
|
|
145594
|
+
}
|
|
145595
|
+
var base = _malloc(4 + length + 1);
|
|
145596
|
+
var ptr = base + 4;
|
|
145597
|
+
HEAPU32[base >> 2] = length;
|
|
145598
|
+
if (valueIsOfTypeString) {
|
|
145599
|
+
stringToUTF8(value, ptr, length + 1);
|
|
145600
|
+
} else {
|
|
145601
|
+
if (valueIsOfTypeString) {
|
|
145602
|
+
for (var i = 0; i < length; ++i) {
|
|
145603
|
+
var charCode = value.charCodeAt(i);
|
|
145604
|
+
if (charCode > 255) {
|
|
145605
|
+
_free(base);
|
|
145606
|
+
throwBindingError("String has UTF-16 code units that do not fit in 8 bits");
|
|
145607
|
+
}
|
|
145608
|
+
HEAPU8[ptr + i] = charCode;
|
|
145609
|
+
}
|
|
145610
|
+
} else {
|
|
145611
|
+
for (var i = 0; i < length; ++i) {
|
|
145612
|
+
HEAPU8[ptr + i] = value[i];
|
|
145613
|
+
}
|
|
145614
|
+
}
|
|
145615
|
+
}
|
|
145616
|
+
if (destructors !== null) {
|
|
145617
|
+
destructors.push(_free, base);
|
|
145618
|
+
}
|
|
145619
|
+
return base;
|
|
145620
|
+
}, argPackAdvance: GenericWireTypeSize, readValueFromPointer: readPointer, destructorFunction(ptr) {
|
|
145621
|
+
_free(ptr);
|
|
145622
|
+
} });
|
|
145623
|
+
};
|
|
145624
|
+
var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : void 0;
|
|
145625
|
+
var UTF16ToString = (ptr, maxBytesToRead) => {
|
|
145626
|
+
var endPtr = ptr;
|
|
145627
|
+
var idx = endPtr >> 1;
|
|
145628
|
+
var maxIdx = idx + maxBytesToRead / 2;
|
|
145629
|
+
while (!(idx >= maxIdx) && HEAPU16[idx])
|
|
145630
|
+
++idx;
|
|
145631
|
+
endPtr = idx << 1;
|
|
145632
|
+
if (endPtr - ptr > 32 && UTF16Decoder)
|
|
145633
|
+
return UTF16Decoder.decode(HEAPU8.subarray(ptr, endPtr));
|
|
145634
|
+
var str = "";
|
|
145635
|
+
for (var i = 0; !(i >= maxBytesToRead / 2); ++i) {
|
|
145636
|
+
var codeUnit = HEAP16[ptr + i * 2 >> 1];
|
|
145637
|
+
if (codeUnit == 0)
|
|
145638
|
+
break;
|
|
145639
|
+
str += String.fromCharCode(codeUnit);
|
|
145640
|
+
}
|
|
145641
|
+
return str;
|
|
145642
|
+
};
|
|
145643
|
+
var stringToUTF16 = (str, outPtr, maxBytesToWrite) => {
|
|
145644
|
+
maxBytesToWrite ?? (maxBytesToWrite = 2147483647);
|
|
145645
|
+
if (maxBytesToWrite < 2)
|
|
145646
|
+
return 0;
|
|
145647
|
+
maxBytesToWrite -= 2;
|
|
145648
|
+
var startPtr = outPtr;
|
|
145649
|
+
var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
|
|
145650
|
+
for (var i = 0; i < numCharsToWrite; ++i) {
|
|
145651
|
+
var codeUnit = str.charCodeAt(i);
|
|
145652
|
+
HEAP16[outPtr >> 1] = codeUnit;
|
|
145653
|
+
outPtr += 2;
|
|
145654
|
+
}
|
|
145655
|
+
HEAP16[outPtr >> 1] = 0;
|
|
145656
|
+
return outPtr - startPtr;
|
|
145657
|
+
};
|
|
145658
|
+
var lengthBytesUTF16 = (str) => str.length * 2;
|
|
145659
|
+
var UTF32ToString = (ptr, maxBytesToRead) => {
|
|
145660
|
+
var i = 0;
|
|
145661
|
+
var str = "";
|
|
145662
|
+
while (!(i >= maxBytesToRead / 4)) {
|
|
145663
|
+
var utf32 = HEAP32[ptr + i * 4 >> 2];
|
|
145664
|
+
if (utf32 == 0)
|
|
145665
|
+
break;
|
|
145666
|
+
++i;
|
|
145667
|
+
if (utf32 >= 65536) {
|
|
145668
|
+
var ch = utf32 - 65536;
|
|
145669
|
+
str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
|
|
145670
|
+
} else {
|
|
145671
|
+
str += String.fromCharCode(utf32);
|
|
145672
|
+
}
|
|
145673
|
+
}
|
|
145674
|
+
return str;
|
|
145675
|
+
};
|
|
145676
|
+
var stringToUTF32 = (str, outPtr, maxBytesToWrite) => {
|
|
145677
|
+
maxBytesToWrite ?? (maxBytesToWrite = 2147483647);
|
|
145678
|
+
if (maxBytesToWrite < 4)
|
|
145679
|
+
return 0;
|
|
145680
|
+
var startPtr = outPtr;
|
|
145681
|
+
var endPtr = startPtr + maxBytesToWrite - 4;
|
|
145682
|
+
for (var i = 0; i < str.length; ++i) {
|
|
145683
|
+
var codeUnit = str.charCodeAt(i);
|
|
145684
|
+
if (codeUnit >= 55296 && codeUnit <= 57343) {
|
|
145685
|
+
var trailSurrogate = str.charCodeAt(++i);
|
|
145686
|
+
codeUnit = 65536 + ((codeUnit & 1023) << 10) | trailSurrogate & 1023;
|
|
145687
|
+
}
|
|
145688
|
+
HEAP32[outPtr >> 2] = codeUnit;
|
|
145689
|
+
outPtr += 4;
|
|
145690
|
+
if (outPtr + 4 > endPtr)
|
|
145691
|
+
break;
|
|
145692
|
+
}
|
|
145693
|
+
HEAP32[outPtr >> 2] = 0;
|
|
145694
|
+
return outPtr - startPtr;
|
|
145695
|
+
};
|
|
145696
|
+
var lengthBytesUTF32 = (str) => {
|
|
145697
|
+
var len = 0;
|
|
145698
|
+
for (var i = 0; i < str.length; ++i) {
|
|
145699
|
+
var codeUnit = str.charCodeAt(i);
|
|
145700
|
+
if (codeUnit >= 55296 && codeUnit <= 57343)
|
|
145701
|
+
++i;
|
|
145702
|
+
len += 4;
|
|
145703
|
+
}
|
|
145704
|
+
return len;
|
|
145705
|
+
};
|
|
145706
|
+
var __embind_register_std_wstring = (rawType, charSize, name) => {
|
|
145707
|
+
name = readLatin1String(name);
|
|
145708
|
+
var decodeString, encodeString, readCharAt, lengthBytesUTF;
|
|
145709
|
+
if (charSize === 2) {
|
|
145710
|
+
decodeString = UTF16ToString;
|
|
145711
|
+
encodeString = stringToUTF16;
|
|
145712
|
+
lengthBytesUTF = lengthBytesUTF16;
|
|
145713
|
+
readCharAt = (pointer) => HEAPU16[pointer >> 1];
|
|
145714
|
+
} else if (charSize === 4) {
|
|
145715
|
+
decodeString = UTF32ToString;
|
|
145716
|
+
encodeString = stringToUTF32;
|
|
145717
|
+
lengthBytesUTF = lengthBytesUTF32;
|
|
145718
|
+
readCharAt = (pointer) => HEAPU32[pointer >> 2];
|
|
145719
|
+
}
|
|
145720
|
+
registerType(rawType, { name, fromWireType: (value) => {
|
|
145721
|
+
var length = HEAPU32[value >> 2];
|
|
145722
|
+
var str;
|
|
145723
|
+
var decodeStartPtr = value + 4;
|
|
145724
|
+
for (var i = 0; i <= length; ++i) {
|
|
145725
|
+
var currentBytePtr = value + 4 + i * charSize;
|
|
145726
|
+
if (i == length || readCharAt(currentBytePtr) == 0) {
|
|
145727
|
+
var maxReadBytes = currentBytePtr - decodeStartPtr;
|
|
145728
|
+
var stringSegment = decodeString(decodeStartPtr, maxReadBytes);
|
|
145729
|
+
if (str === void 0) {
|
|
145730
|
+
str = stringSegment;
|
|
145731
|
+
} else {
|
|
145732
|
+
str += String.fromCharCode(0);
|
|
145733
|
+
str += stringSegment;
|
|
145734
|
+
}
|
|
145735
|
+
decodeStartPtr = currentBytePtr + charSize;
|
|
145736
|
+
}
|
|
145737
|
+
}
|
|
145738
|
+
_free(value);
|
|
145739
|
+
return str;
|
|
145740
|
+
}, toWireType: (destructors, value) => {
|
|
145741
|
+
if (!(typeof value == "string")) {
|
|
145742
|
+
throwBindingError(`Cannot pass non-string to C++ string type ${name}`);
|
|
145743
|
+
}
|
|
145744
|
+
var length = lengthBytesUTF(value);
|
|
145745
|
+
var ptr = _malloc(4 + length + charSize);
|
|
145746
|
+
HEAPU32[ptr >> 2] = length / charSize;
|
|
145747
|
+
encodeString(value, ptr + 4, length + charSize);
|
|
145748
|
+
if (destructors !== null) {
|
|
145749
|
+
destructors.push(_free, ptr);
|
|
145750
|
+
}
|
|
145751
|
+
return ptr;
|
|
145752
|
+
}, argPackAdvance: GenericWireTypeSize, readValueFromPointer: readPointer, destructorFunction(ptr) {
|
|
145753
|
+
_free(ptr);
|
|
145754
|
+
} });
|
|
145755
|
+
};
|
|
145756
|
+
var __embind_register_value_object = (rawType, name, constructorSignature, rawConstructor, destructorSignature, rawDestructor) => {
|
|
145757
|
+
structRegistrations[rawType] = { name: readLatin1String(name), rawConstructor: embind__requireFunction(constructorSignature, rawConstructor), rawDestructor: embind__requireFunction(destructorSignature, rawDestructor), fields: [] };
|
|
145758
|
+
};
|
|
145759
|
+
var __embind_register_value_object_field = (structType, fieldName, getterReturnType, getterSignature, getter, getterContext, setterArgumentType, setterSignature, setter, setterContext) => {
|
|
145760
|
+
structRegistrations[structType].fields.push({ fieldName: readLatin1String(fieldName), getterReturnType, getter: embind__requireFunction(getterSignature, getter), getterContext, setterArgumentType, setter: embind__requireFunction(setterSignature, setter), setterContext });
|
|
145761
|
+
};
|
|
145762
|
+
var __embind_register_void = (rawType, name) => {
|
|
145763
|
+
name = readLatin1String(name);
|
|
145764
|
+
registerType(rawType, { isVoid: true, name, argPackAdvance: 0, fromWireType: () => void 0, toWireType: (destructors, o) => void 0 });
|
|
145765
|
+
};
|
|
145766
|
+
var requireRegisteredType = (rawType, humanName) => {
|
|
145767
|
+
var impl = registeredTypes[rawType];
|
|
145768
|
+
if (void 0 === impl) {
|
|
145769
|
+
throwBindingError(`${humanName} has unknown type ${getTypeName(rawType)}`);
|
|
145770
|
+
}
|
|
145771
|
+
return impl;
|
|
145772
|
+
};
|
|
145773
|
+
var emval_returnValue = (returnType, destructorsRef, handle) => {
|
|
145774
|
+
var destructors = [];
|
|
145775
|
+
var result = returnType["toWireType"](destructors, handle);
|
|
145776
|
+
if (destructors.length) {
|
|
145777
|
+
HEAPU32[destructorsRef >> 2] = Emval.toHandle(destructors);
|
|
145778
|
+
}
|
|
145779
|
+
return result;
|
|
145780
|
+
};
|
|
145781
|
+
var __emval_as = (handle, returnType, destructorsRef) => {
|
|
145782
|
+
handle = Emval.toValue(handle);
|
|
145783
|
+
returnType = requireRegisteredType(returnType, "emval::as");
|
|
145784
|
+
return emval_returnValue(returnType, destructorsRef, handle);
|
|
145785
|
+
};
|
|
145786
|
+
var emval_methodCallers = [];
|
|
145787
|
+
var __emval_call = (caller, handle, destructorsRef, args) => {
|
|
145788
|
+
caller = emval_methodCallers[caller];
|
|
145789
|
+
handle = Emval.toValue(handle);
|
|
145790
|
+
return caller(null, handle, destructorsRef, args);
|
|
145791
|
+
};
|
|
145792
|
+
var emval_symbols = {};
|
|
145793
|
+
var getStringOrSymbol = (address) => {
|
|
145794
|
+
var symbol = emval_symbols[address];
|
|
145795
|
+
if (symbol === void 0) {
|
|
145796
|
+
return readLatin1String(address);
|
|
145797
|
+
}
|
|
145798
|
+
return symbol;
|
|
145799
|
+
};
|
|
145800
|
+
var emval_get_global = () => {
|
|
145801
|
+
if (typeof globalThis == "object") {
|
|
145802
|
+
return globalThis;
|
|
145803
|
+
}
|
|
145804
|
+
return (/* @__PURE__ */ function() {
|
|
145805
|
+
return Function;
|
|
145806
|
+
}())("return this")();
|
|
145807
|
+
};
|
|
145808
|
+
var __emval_get_global = (name) => {
|
|
145809
|
+
if (name === 0) {
|
|
145810
|
+
return Emval.toHandle(emval_get_global());
|
|
145811
|
+
} else {
|
|
145812
|
+
name = getStringOrSymbol(name);
|
|
145813
|
+
return Emval.toHandle(emval_get_global()[name]);
|
|
145814
|
+
}
|
|
145815
|
+
};
|
|
145816
|
+
var emval_addMethodCaller = (caller) => {
|
|
145817
|
+
var id = emval_methodCallers.length;
|
|
145818
|
+
emval_methodCallers.push(caller);
|
|
145819
|
+
return id;
|
|
145820
|
+
};
|
|
145821
|
+
var emval_lookupTypes = (argCount, argTypes) => {
|
|
145822
|
+
var a = new Array(argCount);
|
|
145823
|
+
for (var i = 0; i < argCount; ++i) {
|
|
145824
|
+
a[i] = requireRegisteredType(HEAPU32[argTypes + i * 4 >> 2], "parameter " + i);
|
|
145825
|
+
}
|
|
145826
|
+
return a;
|
|
145827
|
+
};
|
|
145828
|
+
var __emval_get_method_caller = (argCount, argTypes, kind) => {
|
|
145829
|
+
var types = emval_lookupTypes(argCount, argTypes);
|
|
145830
|
+
var retType = types.shift();
|
|
145831
|
+
argCount--;
|
|
145832
|
+
var functionBody = `return function (obj, func, destructorsRef, args) {
|
|
145833
|
+
`;
|
|
145834
|
+
var offset = 0;
|
|
145835
|
+
var argsList = [];
|
|
145836
|
+
if (kind === 0) {
|
|
145837
|
+
argsList.push("obj");
|
|
145838
|
+
}
|
|
145839
|
+
var params = ["retType"];
|
|
145840
|
+
var args = [retType];
|
|
145841
|
+
for (var i = 0; i < argCount; ++i) {
|
|
145842
|
+
argsList.push("arg" + i);
|
|
145843
|
+
params.push("argType" + i);
|
|
145844
|
+
args.push(types[i]);
|
|
145845
|
+
functionBody += ` var arg${i} = argType${i}.readValueFromPointer(args${offset ? "+" + offset : ""});
|
|
145846
|
+
`;
|
|
145847
|
+
offset += types[i].argPackAdvance;
|
|
145848
|
+
}
|
|
145849
|
+
var invoker = kind === 1 ? "new func" : "func.call";
|
|
145850
|
+
functionBody += ` var rv = ${invoker}(${argsList.join(", ")});
|
|
145851
|
+
`;
|
|
145852
|
+
if (!retType.isVoid) {
|
|
145853
|
+
params.push("emval_returnValue");
|
|
145854
|
+
args.push(emval_returnValue);
|
|
145855
|
+
functionBody += " return emval_returnValue(retType, destructorsRef, rv);\n";
|
|
145856
|
+
}
|
|
145857
|
+
functionBody += "};\n";
|
|
145858
|
+
params.push(functionBody);
|
|
145859
|
+
var invokerFunction = newFunc(Function, params)(...args);
|
|
145860
|
+
var functionName = `methodCaller<(${types.map((t) => t.name).join(", ")}) => ${retType.name}>`;
|
|
145861
|
+
return emval_addMethodCaller(createNamedFunction(functionName, invokerFunction));
|
|
145862
|
+
};
|
|
145863
|
+
var __emval_incref = (handle) => {
|
|
145864
|
+
if (handle > 9) {
|
|
145865
|
+
emval_handles[handle + 1] += 1;
|
|
145866
|
+
}
|
|
145867
|
+
};
|
|
145868
|
+
var __emval_is_string = (handle) => {
|
|
145869
|
+
handle = Emval.toValue(handle);
|
|
145870
|
+
return typeof handle == "string";
|
|
145871
|
+
};
|
|
145872
|
+
var __emval_run_destructors = (handle) => {
|
|
145873
|
+
var destructors = Emval.toValue(handle);
|
|
145874
|
+
runDestructors(destructors);
|
|
145875
|
+
__emval_decref(handle);
|
|
145876
|
+
};
|
|
145877
|
+
var __emval_take_value = (type, arg) => {
|
|
145878
|
+
type = requireRegisteredType(type, "_emval_take_value");
|
|
145879
|
+
var v = type["readValueFromPointer"](arg);
|
|
145880
|
+
return Emval.toHandle(v);
|
|
145881
|
+
};
|
|
145882
|
+
var isLeapYear = (year) => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
145883
|
+
var MONTH_DAYS_LEAP_CUMULATIVE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
|
|
145884
|
+
var MONTH_DAYS_REGULAR_CUMULATIVE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
|
|
145885
|
+
var ydayFromDate = (date) => {
|
|
145886
|
+
var leap = isLeapYear(date.getFullYear());
|
|
145887
|
+
var monthDaysCumulative = leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE;
|
|
145888
|
+
var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1;
|
|
145889
|
+
return yday;
|
|
145890
|
+
};
|
|
145891
|
+
var INT53_MAX = 9007199254740992;
|
|
145892
|
+
var INT53_MIN = -9007199254740992;
|
|
145893
|
+
var bigintToI53Checked = (num) => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
|
|
145894
|
+
function __localtime_js(time, tmPtr) {
|
|
145895
|
+
time = bigintToI53Checked(time);
|
|
145896
|
+
var date = new Date(time * 1e3);
|
|
145897
|
+
HEAP32[tmPtr >> 2] = date.getSeconds();
|
|
145898
|
+
HEAP32[tmPtr + 4 >> 2] = date.getMinutes();
|
|
145899
|
+
HEAP32[tmPtr + 8 >> 2] = date.getHours();
|
|
145900
|
+
HEAP32[tmPtr + 12 >> 2] = date.getDate();
|
|
145901
|
+
HEAP32[tmPtr + 16 >> 2] = date.getMonth();
|
|
145902
|
+
HEAP32[tmPtr + 20 >> 2] = date.getFullYear() - 1900;
|
|
145903
|
+
HEAP32[tmPtr + 24 >> 2] = date.getDay();
|
|
145904
|
+
var yday = ydayFromDate(date) | 0;
|
|
145905
|
+
HEAP32[tmPtr + 28 >> 2] = yday;
|
|
145906
|
+
HEAP32[tmPtr + 36 >> 2] = -(date.getTimezoneOffset() * 60);
|
|
145907
|
+
var start = new Date(date.getFullYear(), 0, 1);
|
|
145908
|
+
var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
|
|
145909
|
+
var winterOffset = start.getTimezoneOffset();
|
|
145910
|
+
var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
|
|
145911
|
+
HEAP32[tmPtr + 32 >> 2] = dst;
|
|
145912
|
+
}
|
|
145913
|
+
var __mktime_js = function(tmPtr) {
|
|
145914
|
+
var ret = (() => {
|
|
145915
|
+
var date = new Date(HEAP32[tmPtr + 20 >> 2] + 1900, HEAP32[tmPtr + 16 >> 2], HEAP32[tmPtr + 12 >> 2], HEAP32[tmPtr + 8 >> 2], HEAP32[tmPtr + 4 >> 2], HEAP32[tmPtr >> 2], 0);
|
|
145916
|
+
var dst = HEAP32[tmPtr + 32 >> 2];
|
|
145917
|
+
var guessedOffset = date.getTimezoneOffset();
|
|
145918
|
+
var start = new Date(date.getFullYear(), 0, 1);
|
|
145919
|
+
var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
|
|
145920
|
+
var winterOffset = start.getTimezoneOffset();
|
|
145921
|
+
var dstOffset = Math.min(winterOffset, summerOffset);
|
|
145922
|
+
if (dst < 0) {
|
|
145923
|
+
HEAP32[tmPtr + 32 >> 2] = Number(summerOffset != winterOffset && dstOffset == guessedOffset);
|
|
145924
|
+
} else if (dst > 0 != (dstOffset == guessedOffset)) {
|
|
145925
|
+
var nonDstOffset = Math.max(winterOffset, summerOffset);
|
|
145926
|
+
var trueOffset = dst > 0 ? dstOffset : nonDstOffset;
|
|
145927
|
+
date.setTime(date.getTime() + (trueOffset - guessedOffset) * 6e4);
|
|
145928
|
+
}
|
|
145929
|
+
HEAP32[tmPtr + 24 >> 2] = date.getDay();
|
|
145930
|
+
var yday = ydayFromDate(date) | 0;
|
|
145931
|
+
HEAP32[tmPtr + 28 >> 2] = yday;
|
|
145932
|
+
HEAP32[tmPtr >> 2] = date.getSeconds();
|
|
145933
|
+
HEAP32[tmPtr + 4 >> 2] = date.getMinutes();
|
|
145934
|
+
HEAP32[tmPtr + 8 >> 2] = date.getHours();
|
|
145935
|
+
HEAP32[tmPtr + 12 >> 2] = date.getDate();
|
|
145936
|
+
HEAP32[tmPtr + 16 >> 2] = date.getMonth();
|
|
145937
|
+
HEAP32[tmPtr + 20 >> 2] = date.getYear();
|
|
145938
|
+
var timeMs = date.getTime();
|
|
145939
|
+
if (isNaN(timeMs)) {
|
|
145940
|
+
return -1;
|
|
145941
|
+
}
|
|
145942
|
+
return timeMs / 1e3;
|
|
145943
|
+
})();
|
|
145944
|
+
return BigInt(ret);
|
|
145945
|
+
};
|
|
145946
|
+
var __tzset_js = (timezone, daylight, std_name, dst_name) => {
|
|
145947
|
+
var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
145948
|
+
var winter = new Date(currentYear, 0, 1);
|
|
145949
|
+
var summer = new Date(currentYear, 6, 1);
|
|
145950
|
+
var winterOffset = winter.getTimezoneOffset();
|
|
145951
|
+
var summerOffset = summer.getTimezoneOffset();
|
|
145952
|
+
var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
|
|
145953
|
+
HEAPU32[timezone >> 2] = stdTimezoneOffset * 60;
|
|
145954
|
+
HEAP32[daylight >> 2] = Number(winterOffset != summerOffset);
|
|
145955
|
+
var extractZone = (timezoneOffset) => {
|
|
145956
|
+
var sign = timezoneOffset >= 0 ? "-" : "+";
|
|
145957
|
+
var absOffset = Math.abs(timezoneOffset);
|
|
145958
|
+
var hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
|
|
145959
|
+
var minutes = String(absOffset % 60).padStart(2, "0");
|
|
145960
|
+
return `UTC${sign}${hours}${minutes}`;
|
|
145961
|
+
};
|
|
145962
|
+
var winterName = extractZone(winterOffset);
|
|
145963
|
+
var summerName = extractZone(summerOffset);
|
|
145964
|
+
if (summerOffset < winterOffset) {
|
|
145965
|
+
stringToUTF8(winterName, std_name, 17);
|
|
145966
|
+
stringToUTF8(summerName, dst_name, 17);
|
|
145967
|
+
} else {
|
|
145968
|
+
stringToUTF8(winterName, dst_name, 17);
|
|
145969
|
+
stringToUTF8(summerName, std_name, 17);
|
|
145970
|
+
}
|
|
145971
|
+
};
|
|
145972
|
+
var _emscripten_get_now = () => performance.now();
|
|
145973
|
+
var _emscripten_date_now = () => Date.now();
|
|
145974
|
+
var checkWasiClock = (clock_id) => clock_id >= 0 && clock_id <= 3;
|
|
145975
|
+
function _clock_time_get(clk_id, ignored_precision, ptime) {
|
|
145976
|
+
if (!checkWasiClock(clk_id)) {
|
|
145977
|
+
return 28;
|
|
145978
|
+
}
|
|
145979
|
+
var now;
|
|
145980
|
+
if (clk_id === 0) {
|
|
145981
|
+
now = _emscripten_date_now();
|
|
145982
|
+
} else {
|
|
145983
|
+
now = _emscripten_get_now();
|
|
145984
|
+
}
|
|
145985
|
+
var nsec = Math.round(now * 1e3 * 1e3);
|
|
145986
|
+
HEAP64[ptime >> 3] = BigInt(nsec);
|
|
145987
|
+
return 0;
|
|
145988
|
+
}
|
|
145989
|
+
var readEmAsmArgsArray = [];
|
|
145990
|
+
var readEmAsmArgs = (sigPtr, buf) => {
|
|
145991
|
+
readEmAsmArgsArray.length = 0;
|
|
145992
|
+
var ch;
|
|
145993
|
+
while (ch = HEAPU8[sigPtr++]) {
|
|
145994
|
+
var wide = ch != 105;
|
|
145995
|
+
wide &= ch != 112;
|
|
145996
|
+
buf += wide && buf % 8 ? 4 : 0;
|
|
145997
|
+
readEmAsmArgsArray.push(ch == 112 ? HEAPU32[buf >> 2] : ch == 106 ? HEAP64[buf >> 3] : ch == 105 ? HEAP32[buf >> 2] : HEAPF64[buf >> 3]);
|
|
145998
|
+
buf += wide ? 8 : 4;
|
|
145999
|
+
}
|
|
146000
|
+
return readEmAsmArgsArray;
|
|
146001
|
+
};
|
|
146002
|
+
var runEmAsmFunction = (code, sigPtr, argbuf) => {
|
|
146003
|
+
var args = readEmAsmArgs(sigPtr, argbuf);
|
|
146004
|
+
return ASM_CONSTS[code](...args);
|
|
146005
|
+
};
|
|
146006
|
+
var _emscripten_asm_const_int = (code, sigPtr, argbuf) => runEmAsmFunction(code, sigPtr, argbuf);
|
|
146007
|
+
var getHeapMax = () => 2147483648;
|
|
146008
|
+
var _emscripten_get_heap_max = () => getHeapMax();
|
|
146009
|
+
var growMemory = (size) => {
|
|
146010
|
+
var b = wasmMemory.buffer;
|
|
146011
|
+
var pages = (size - b.byteLength + 65535) / 65536 | 0;
|
|
146012
|
+
try {
|
|
146013
|
+
wasmMemory.grow(pages);
|
|
146014
|
+
updateMemoryViews();
|
|
146015
|
+
return 1;
|
|
146016
|
+
} catch (e) {
|
|
146017
|
+
}
|
|
146018
|
+
};
|
|
146019
|
+
var _emscripten_resize_heap = (requestedSize) => {
|
|
146020
|
+
var oldSize = HEAPU8.length;
|
|
146021
|
+
requestedSize >>>= 0;
|
|
146022
|
+
var maxHeapSize = getHeapMax();
|
|
146023
|
+
if (requestedSize > maxHeapSize) {
|
|
146024
|
+
return false;
|
|
146025
|
+
}
|
|
146026
|
+
for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
|
|
146027
|
+
var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
|
|
146028
|
+
overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
|
|
146029
|
+
var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
|
|
146030
|
+
var replacement = growMemory(newSize);
|
|
146031
|
+
if (replacement) {
|
|
146032
|
+
return true;
|
|
146033
|
+
}
|
|
146034
|
+
}
|
|
146035
|
+
return false;
|
|
146036
|
+
};
|
|
146037
|
+
var safeSetTimeout = (func, timeout) => setTimeout(() => {
|
|
146038
|
+
callUserCallback(func);
|
|
146039
|
+
}, timeout);
|
|
146040
|
+
var _emscripten_sleep = (ms) => Asyncify.handleSleep((wakeUp) => safeSetTimeout(wakeUp, ms));
|
|
146041
|
+
_emscripten_sleep.isAsync = true;
|
|
146042
|
+
var ENV = {};
|
|
146043
|
+
var getExecutableName = () => thisProgram || "./this.program";
|
|
146044
|
+
var getEnvStrings = () => {
|
|
146045
|
+
if (!getEnvStrings.strings) {
|
|
146046
|
+
var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
|
|
146047
|
+
var env = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: lang, _: getExecutableName() };
|
|
146048
|
+
for (var x in ENV) {
|
|
146049
|
+
if (ENV[x] === void 0)
|
|
146050
|
+
delete env[x];
|
|
146051
|
+
else
|
|
146052
|
+
env[x] = ENV[x];
|
|
146053
|
+
}
|
|
146054
|
+
var strings = [];
|
|
146055
|
+
for (var x in env) {
|
|
146056
|
+
strings.push(`${x}=${env[x]}`);
|
|
146057
|
+
}
|
|
146058
|
+
getEnvStrings.strings = strings;
|
|
146059
|
+
}
|
|
146060
|
+
return getEnvStrings.strings;
|
|
146061
|
+
};
|
|
146062
|
+
var stringToAscii = (str, buffer) => {
|
|
146063
|
+
for (var i = 0; i < str.length; ++i) {
|
|
146064
|
+
HEAP8[buffer++] = str.charCodeAt(i);
|
|
146065
|
+
}
|
|
146066
|
+
HEAP8[buffer] = 0;
|
|
146067
|
+
};
|
|
146068
|
+
var _environ_get = (__environ, environ_buf) => {
|
|
146069
|
+
var bufSize = 0;
|
|
146070
|
+
getEnvStrings().forEach((string, i) => {
|
|
146071
|
+
var ptr = environ_buf + bufSize;
|
|
146072
|
+
HEAPU32[__environ + i * 4 >> 2] = ptr;
|
|
146073
|
+
stringToAscii(string, ptr);
|
|
146074
|
+
bufSize += string.length + 1;
|
|
146075
|
+
});
|
|
146076
|
+
return 0;
|
|
146077
|
+
};
|
|
146078
|
+
var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
|
|
146079
|
+
var strings = getEnvStrings();
|
|
146080
|
+
HEAPU32[penviron_count >> 2] = strings.length;
|
|
146081
|
+
var bufSize = 0;
|
|
146082
|
+
strings.forEach((string) => bufSize += string.length + 1);
|
|
146083
|
+
HEAPU32[penviron_buf_size >> 2] = bufSize;
|
|
146084
|
+
return 0;
|
|
146085
|
+
};
|
|
146086
|
+
function _fd_close(fd) {
|
|
146087
|
+
try {
|
|
146088
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
146089
|
+
FS.close(stream);
|
|
146090
|
+
return 0;
|
|
146091
|
+
} catch (e) {
|
|
146092
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
146093
|
+
throw e;
|
|
146094
|
+
return e.errno;
|
|
146095
|
+
}
|
|
146096
|
+
}
|
|
146097
|
+
var doReadv = (stream, iov, iovcnt, offset) => {
|
|
146098
|
+
var ret = 0;
|
|
146099
|
+
for (var i = 0; i < iovcnt; i++) {
|
|
146100
|
+
var ptr = HEAPU32[iov >> 2];
|
|
146101
|
+
var len = HEAPU32[iov + 4 >> 2];
|
|
146102
|
+
iov += 8;
|
|
146103
|
+
var curr = FS.read(stream, HEAP8, ptr, len, offset);
|
|
146104
|
+
if (curr < 0)
|
|
146105
|
+
return -1;
|
|
146106
|
+
ret += curr;
|
|
146107
|
+
if (curr < len)
|
|
146108
|
+
break;
|
|
146109
|
+
if (typeof offset != "undefined") {
|
|
146110
|
+
offset += curr;
|
|
146111
|
+
}
|
|
146112
|
+
}
|
|
146113
|
+
return ret;
|
|
146114
|
+
};
|
|
146115
|
+
function _fd_read(fd, iov, iovcnt, pnum) {
|
|
146116
|
+
try {
|
|
146117
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
146118
|
+
var num = doReadv(stream, iov, iovcnt);
|
|
146119
|
+
HEAPU32[pnum >> 2] = num;
|
|
146120
|
+
return 0;
|
|
146121
|
+
} catch (e) {
|
|
146122
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
146123
|
+
throw e;
|
|
146124
|
+
return e.errno;
|
|
146125
|
+
}
|
|
146126
|
+
}
|
|
146127
|
+
function _fd_seek(fd, offset, whence, newOffset) {
|
|
146128
|
+
offset = bigintToI53Checked(offset);
|
|
146129
|
+
try {
|
|
146130
|
+
if (isNaN(offset))
|
|
146131
|
+
return 61;
|
|
146132
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
146133
|
+
FS.llseek(stream, offset, whence);
|
|
146134
|
+
HEAP64[newOffset >> 3] = BigInt(stream.position);
|
|
146135
|
+
if (stream.getdents && offset === 0 && whence === 0)
|
|
146136
|
+
stream.getdents = null;
|
|
146137
|
+
return 0;
|
|
146138
|
+
} catch (e) {
|
|
146139
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
146140
|
+
throw e;
|
|
146141
|
+
return e.errno;
|
|
146142
|
+
}
|
|
146143
|
+
}
|
|
146144
|
+
var doWritev = (stream, iov, iovcnt, offset) => {
|
|
146145
|
+
var ret = 0;
|
|
146146
|
+
for (var i = 0; i < iovcnt; i++) {
|
|
146147
|
+
var ptr = HEAPU32[iov >> 2];
|
|
146148
|
+
var len = HEAPU32[iov + 4 >> 2];
|
|
146149
|
+
iov += 8;
|
|
146150
|
+
var curr = FS.write(stream, HEAP8, ptr, len, offset);
|
|
146151
|
+
if (curr < 0)
|
|
146152
|
+
return -1;
|
|
146153
|
+
ret += curr;
|
|
146154
|
+
if (curr < len) {
|
|
146155
|
+
break;
|
|
146156
|
+
}
|
|
146157
|
+
if (typeof offset != "undefined") {
|
|
146158
|
+
offset += curr;
|
|
146159
|
+
}
|
|
146160
|
+
}
|
|
146161
|
+
return ret;
|
|
146162
|
+
};
|
|
146163
|
+
function _fd_write(fd, iov, iovcnt, pnum) {
|
|
146164
|
+
try {
|
|
146165
|
+
var stream = SYSCALLS.getStreamFromFD(fd);
|
|
146166
|
+
var num = doWritev(stream, iov, iovcnt);
|
|
146167
|
+
HEAPU32[pnum >> 2] = num;
|
|
146168
|
+
return 0;
|
|
146169
|
+
} catch (e) {
|
|
146170
|
+
if (typeof FS == "undefined" || !(e.name === "ErrnoError"))
|
|
146171
|
+
throw e;
|
|
146172
|
+
return e.errno;
|
|
146173
|
+
}
|
|
146174
|
+
}
|
|
146175
|
+
var stackAlloc = (sz) => __emscripten_stack_alloc(sz);
|
|
146176
|
+
var stringToUTF8OnStack = (str) => {
|
|
146177
|
+
var size = lengthBytesUTF8(str) + 1;
|
|
146178
|
+
var ret = stackAlloc(size);
|
|
146179
|
+
stringToUTF8(str, ret, size);
|
|
146180
|
+
return ret;
|
|
146181
|
+
};
|
|
146182
|
+
FS.createPreloadedFile = FS_createPreloadedFile;
|
|
146183
|
+
FS.staticInit();
|
|
146184
|
+
MEMFS.doesNotExistError = new FS.ErrnoError(44);
|
|
146185
|
+
MEMFS.doesNotExistError.stack = "<generic error, no stack>";
|
|
146186
|
+
InternalError = Module["InternalError"] = class InternalError extends Error {
|
|
146187
|
+
constructor(message) {
|
|
146188
|
+
super(message);
|
|
146189
|
+
this.name = "InternalError";
|
|
146190
|
+
}
|
|
146191
|
+
};
|
|
146192
|
+
embind_init_charCodes();
|
|
146193
|
+
BindingError = Module["BindingError"] = class BindingError extends Error {
|
|
146194
|
+
constructor(message) {
|
|
146195
|
+
super(message);
|
|
146196
|
+
this.name = "BindingError";
|
|
146197
|
+
}
|
|
146198
|
+
};
|
|
146199
|
+
init_emval();
|
|
146200
|
+
UnboundTypeError = Module["UnboundTypeError"] = extendError(Error, "UnboundTypeError");
|
|
146201
|
+
var wasmImports = { a: ___cxa_throw, j: ___syscall_fcntl64, G: ___syscall_ioctl, H: ___syscall_openat, s: ___syscall_renameat, y: ___syscall_rmdir, v: ___syscall_stat64, z: ___syscall_unlinkat, t: __abort_js, L: __embind_finalize_value_object, m: __embind_register_bigint, R: __embind_register_bool, P: __embind_register_emval, l: __embind_register_float, f: __embind_register_function, c: __embind_register_integer, b: __embind_register_memory_view, Q: __embind_register_std_string, g: __embind_register_std_wstring, O: __embind_register_value_object, M: __embind_register_value_object_field, S: __embind_register_void, N: __emval_as, d: __emval_call, q: __emval_decref, F: __emval_get_global, e: __emval_get_method_caller, o: __emval_incref, T: __emval_is_string, n: __emval_run_destructors, p: __emval_take_value, A: __localtime_js, B: __mktime_js, C: __tzset_js, J: _clock_time_get, K: _emscripten_asm_const_int, I: _emscripten_date_now, r: _emscripten_get_heap_max, u: _emscripten_resize_heap, k: _emscripten_sleep, w: _environ_get, x: _environ_sizes_get, h: _fd_close, E: _fd_read, D: _fd_seek, i: _fd_write };
|
|
146202
|
+
var wasmExports = await createWasm();
|
|
146203
|
+
wasmExports["V"];
|
|
146204
|
+
var ___getTypeName = wasmExports["W"];
|
|
146205
|
+
var _malloc = wasmExports["Y"];
|
|
146206
|
+
var _free = wasmExports["Z"];
|
|
146207
|
+
var _main = Module["_main"] = wasmExports["_"];
|
|
146208
|
+
var __emscripten_stack_alloc = wasmExports["$"];
|
|
146209
|
+
Module["dynCall_vi"] = wasmExports["aa"];
|
|
146210
|
+
Module["dynCall_ii"] = wasmExports["ba"];
|
|
146211
|
+
Module["dynCall_viiii"] = wasmExports["ca"];
|
|
146212
|
+
Module["dynCall_vii"] = wasmExports["da"];
|
|
146213
|
+
Module["dynCall_iii"] = wasmExports["ea"];
|
|
146214
|
+
Module["dynCall_iijii"] = wasmExports["fa"];
|
|
146215
|
+
Module["dynCall_iiii"] = wasmExports["ga"];
|
|
146216
|
+
Module["dynCall_iiiii"] = wasmExports["ha"];
|
|
146217
|
+
Module["dynCall_iiiiiiiii"] = wasmExports["ia"];
|
|
146218
|
+
Module["dynCall_iiiiii"] = wasmExports["ja"];
|
|
146219
|
+
Module["dynCall_v"] = wasmExports["ka"];
|
|
146220
|
+
Module["dynCall_viii"] = wasmExports["la"];
|
|
146221
|
+
Module["dynCall_viiiiiii"] = wasmExports["ma"];
|
|
146222
|
+
Module["dynCall_diiii"] = wasmExports["na"];
|
|
146223
|
+
Module["dynCall_viif"] = wasmExports["oa"];
|
|
146224
|
+
Module["dynCall_i"] = wasmExports["pa"];
|
|
146225
|
+
Module["dynCall_fii"] = wasmExports["qa"];
|
|
146226
|
+
Module["dynCall_jiji"] = wasmExports["ra"];
|
|
146227
|
+
Module["dynCall_iidiiii"] = wasmExports["sa"];
|
|
146228
|
+
Module["dynCall_viijii"] = wasmExports["ta"];
|
|
146229
|
+
Module["dynCall_iiiiiii"] = wasmExports["ua"];
|
|
146230
|
+
Module["dynCall_iiiiij"] = wasmExports["va"];
|
|
146231
|
+
Module["dynCall_iiiiid"] = wasmExports["wa"];
|
|
146232
|
+
Module["dynCall_iiiiijj"] = wasmExports["xa"];
|
|
146233
|
+
Module["dynCall_iiiiiiii"] = wasmExports["ya"];
|
|
146234
|
+
Module["dynCall_iiiiiijj"] = wasmExports["za"];
|
|
146235
|
+
Module["dynCall_viiiiii"] = wasmExports["Aa"];
|
|
146236
|
+
Module["dynCall_viiiii"] = wasmExports["Ba"];
|
|
146237
|
+
var _asyncify_start_unwind = wasmExports["Ca"];
|
|
146238
|
+
var _asyncify_stop_unwind = wasmExports["Da"];
|
|
146239
|
+
var _asyncify_start_rewind = wasmExports["Ea"];
|
|
146240
|
+
var _asyncify_stop_rewind = wasmExports["Fa"];
|
|
146241
|
+
function callMain(args = []) {
|
|
146242
|
+
var entryFunction = _main;
|
|
146243
|
+
args.unshift(thisProgram);
|
|
146244
|
+
var argc = args.length;
|
|
146245
|
+
var argv = stackAlloc((argc + 1) * 4);
|
|
146246
|
+
var argv_ptr = argv;
|
|
146247
|
+
args.forEach((arg) => {
|
|
146248
|
+
HEAPU32[argv_ptr >> 2] = stringToUTF8OnStack(arg);
|
|
146249
|
+
argv_ptr += 4;
|
|
146250
|
+
});
|
|
146251
|
+
HEAPU32[argv_ptr >> 2] = 0;
|
|
146252
|
+
try {
|
|
146253
|
+
var ret = entryFunction(argc, argv);
|
|
146254
|
+
exitJS(ret, true);
|
|
146255
|
+
return ret;
|
|
146256
|
+
} catch (e) {
|
|
146257
|
+
return handleException(e);
|
|
146258
|
+
}
|
|
146259
|
+
}
|
|
146260
|
+
function run(args = arguments_) {
|
|
146261
|
+
if (runDependencies > 0) {
|
|
146262
|
+
dependenciesFulfilled = run;
|
|
146263
|
+
return;
|
|
146264
|
+
}
|
|
146265
|
+
preRun();
|
|
146266
|
+
if (runDependencies > 0) {
|
|
146267
|
+
dependenciesFulfilled = run;
|
|
146268
|
+
return;
|
|
146269
|
+
}
|
|
146270
|
+
function doRun() {
|
|
146271
|
+
Module["calledRun"] = true;
|
|
146272
|
+
if (ABORT)
|
|
146273
|
+
return;
|
|
146274
|
+
initRuntime();
|
|
146275
|
+
readyPromiseResolve(Module);
|
|
146276
|
+
Module["onRuntimeInitialized"]?.();
|
|
146277
|
+
var noInitialRun = Module["noInitialRun"] || true;
|
|
146278
|
+
if (!noInitialRun)
|
|
146279
|
+
callMain(args);
|
|
146280
|
+
postRun();
|
|
146281
|
+
}
|
|
146282
|
+
if (Module["setStatus"]) {
|
|
146283
|
+
Module["setStatus"]("Running...");
|
|
146284
|
+
setTimeout(() => {
|
|
146285
|
+
setTimeout(() => Module["setStatus"](""), 1);
|
|
146286
|
+
doRun();
|
|
146287
|
+
}, 1);
|
|
146288
|
+
} else {
|
|
146289
|
+
doRun();
|
|
146290
|
+
}
|
|
146291
|
+
}
|
|
146292
|
+
if (Module["preInit"]) {
|
|
146293
|
+
if (typeof Module["preInit"] == "function")
|
|
146294
|
+
Module["preInit"] = [Module["preInit"]];
|
|
146295
|
+
while (Module["preInit"].length > 0) {
|
|
146296
|
+
Module["preInit"].pop()();
|
|
146297
|
+
}
|
|
146298
|
+
}
|
|
146299
|
+
run();
|
|
146300
|
+
moduleRtn = readyPromise;
|
|
146301
|
+
return moduleRtn;
|
|
146302
|
+
};
|
|
146303
|
+
})();
|
|
146304
|
+
|
|
146305
|
+
var __defProp$1 = Object.defineProperty;
|
|
146306
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
146307
|
+
var __publicField$1 = (obj, key, value) => {
|
|
146308
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
146309
|
+
return value;
|
|
146310
|
+
};
|
|
146311
|
+
const cdnUrl = `https://cdn.jsdelivr.net/npm/@creooxag/cx-converter@${packageJSON.version}/dist/`;
|
|
146312
|
+
const defaultUrlPrefix = "./";
|
|
146313
|
+
const _IfcWasmConverterLoader = class _IfcWasmConverterLoader {
|
|
146314
|
+
constructor() {
|
|
146315
|
+
__publicField$1(this, "module");
|
|
146316
|
+
}
|
|
146317
|
+
static async getInstance(userUrlPrefix) {
|
|
146318
|
+
let urlPrefix = defaultUrlPrefix;
|
|
146319
|
+
if (userUrlPrefix) {
|
|
146320
|
+
urlPrefix = userUrlPrefix == "remote" ? cdnUrl : userUrlPrefix;
|
|
146321
|
+
}
|
|
146322
|
+
if (!_IfcWasmConverterLoader.instance) {
|
|
146323
|
+
_IfcWasmConverterLoader.instance = new _IfcWasmConverterLoader();
|
|
146324
|
+
var Module = {
|
|
146325
|
+
locateFile: function(path) {
|
|
146326
|
+
const fullPath = urlPrefix + path;
|
|
146327
|
+
if (path.endsWith(".wasm")) {
|
|
146328
|
+
console.log(`Loading wasm file from ${fullPath}`);
|
|
146329
|
+
return fullPath;
|
|
146330
|
+
}
|
|
146331
|
+
return path;
|
|
146332
|
+
}
|
|
146333
|
+
};
|
|
146334
|
+
try {
|
|
146335
|
+
_IfcWasmConverterLoader.instance.module = await IfcDbWasm(Module);
|
|
146336
|
+
} catch (error) {
|
|
146337
|
+
console.error("Error on wasm import:", error);
|
|
146338
|
+
}
|
|
146339
|
+
}
|
|
146340
|
+
return _IfcWasmConverterLoader.instance;
|
|
146341
|
+
}
|
|
146342
|
+
static async getModule(userUrlPrefix) {
|
|
146343
|
+
return (await _IfcWasmConverterLoader.getInstance(userUrlPrefix)).module;
|
|
146344
|
+
}
|
|
146345
|
+
};
|
|
146346
|
+
__publicField$1(_IfcWasmConverterLoader, "instance");
|
|
146347
|
+
let IfcWasmConverterLoader = _IfcWasmConverterLoader;
|
|
146348
|
+
|
|
146349
|
+
async function ifc2gltf(ifcData, params) {
|
|
146350
|
+
const inputOptionsString = params.inputOptions ? params.inputOptions : JSON.stringify(inputOptionsDefault);
|
|
146351
|
+
const loadOptions = {
|
|
146352
|
+
"maxFileSizeInMegaBytes": 1e3
|
|
146353
|
+
};
|
|
146354
|
+
let resolveCallbackGltf = void 0;
|
|
146355
|
+
let resolveCallbackMetadata = void 0;
|
|
146356
|
+
const url = params.remote ? "remote" : params.urlPath;
|
|
146357
|
+
const module = await IfcWasmConverterLoader.getModule(url);
|
|
146358
|
+
if (params.progressCallback)
|
|
146359
|
+
module.setProgressCallback(params.progressCallback);
|
|
146360
|
+
else
|
|
146361
|
+
module.setProgressCallback((progress) => {
|
|
146362
|
+
console.log(`Progress: ${progress}`);
|
|
146363
|
+
});
|
|
146364
|
+
if (params.progressTextCallback)
|
|
146365
|
+
module.setProgressTextCallback(params.progressTextCallback);
|
|
146366
|
+
else
|
|
146367
|
+
module.setProgressTextCallback((progressText) => {
|
|
146368
|
+
console.log(`Progress text: ${progressText}`);
|
|
146369
|
+
});
|
|
146370
|
+
module.setInputOptions(inputOptionsString);
|
|
146371
|
+
const promiseGltf = new Promise((resolve) => {
|
|
146372
|
+
resolveCallbackGltf = resolve;
|
|
146373
|
+
});
|
|
146374
|
+
const promiseMetadata = new Promise((resolve) => {
|
|
146375
|
+
resolveCallbackMetadata = resolve;
|
|
146376
|
+
});
|
|
146377
|
+
if (resolveCallbackGltf)
|
|
146378
|
+
module.setGltfCompleteCallback(resolveCallbackGltf);
|
|
146379
|
+
if (resolveCallbackMetadata)
|
|
146380
|
+
module.setMetaDataCompleteCallback(resolveCallbackMetadata);
|
|
146381
|
+
module.loadModel(ifcData, loadOptions);
|
|
146382
|
+
await Promise.all([promiseGltf, promiseMetadata]);
|
|
146383
|
+
const gltf = await module.getGeometry();
|
|
146384
|
+
const uint8Array = await module.getMetaData();
|
|
146385
|
+
const decoder = new TextDecoder();
|
|
146386
|
+
const metaStr = decoder.decode(uint8Array);
|
|
146387
|
+
const metaData = await JSON.parse(metaStr);
|
|
146388
|
+
return { gltf, metaData };
|
|
146389
|
+
}
|
|
146390
|
+
const inputOptionsDefault = {
|
|
146391
|
+
"inputParameters": {
|
|
146392
|
+
"exportPropertySets": "yes",
|
|
146393
|
+
"exportIfcPropertyTypes": "yes",
|
|
146394
|
+
"exportIfcValueTypes": "yes",
|
|
146395
|
+
"exportPolylines": "yes",
|
|
146396
|
+
"excludeGeometryForIfcTypes": ["IfcOpeningElement"],
|
|
146397
|
+
"excludeGUIDs": [""],
|
|
146398
|
+
"exportOnlyGUIDs": [""],
|
|
146399
|
+
"centerModelAtOrigin": "yes",
|
|
146400
|
+
"ignoreProfileRadius": "yes",
|
|
146401
|
+
"enableGltfCompression": "yes",
|
|
146402
|
+
"enableGltfQuantization": "no",
|
|
146403
|
+
"exportNormals": "no",
|
|
146404
|
+
"numPointsPerCircle": 18,
|
|
146405
|
+
"licenceKey": "",
|
|
146406
|
+
// JSON above is copied from default input config file. Changes applied here:
|
|
146407
|
+
"loadingPriorityTypes": ["IFCWALL", "IFCSLAB", "IFCWINDOW", "IFCROOF", "IFCFURNISHINGELEMENT", "IFCAIRTERMINAL"]
|
|
146408
|
+
//[ "IfcOpeningElement" ],
|
|
146409
|
+
}
|
|
146410
|
+
};
|
|
146411
|
+
|
|
146412
|
+
/**
|
|
146413
|
+
* Fetches a file from the given URL and returns its contents as text.
|
|
146414
|
+
*
|
|
146415
|
+
* @param {string} url - The URL to fetch the file from.
|
|
146416
|
+
* @returns {Promise<string>} A promise that resolves to the file contents.
|
|
146417
|
+
* @private
|
|
146418
|
+
*/
|
|
146419
|
+
async function fetchFile(url) {
|
|
146420
|
+
try {
|
|
146421
|
+
const response = await fetch(url);
|
|
146422
|
+
if (!response.ok) {
|
|
146423
|
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
|
146424
|
+
}
|
|
146425
|
+
return response.text();
|
|
146426
|
+
} catch (error) {
|
|
146427
|
+
console.error('Error fetching file:', error);
|
|
146428
|
+
}
|
|
146429
|
+
}
|
|
146430
|
+
|
|
146431
|
+
/**
|
|
146432
|
+
* {@link Viewer} plugin that uses [CxConverter](https://github.com/Creoox/cxconverter) to load BIM models directly from IFC files, using its WebAssembly buid from [npm package](https://www.npmjs.com/package/@creooxag/cx-converter).
|
|
146433
|
+
*
|
|
146434
|
+
* ## Overview
|
|
146435
|
+
* The WebAssembly build of CxConverter is still in alfa stage, so it may not work as expected. This documentation will be updated as the library and the plugin evolve. The example below shows how to use the plugin:
|
|
146436
|
+
* ````javascript
|
|
146437
|
+
* import { CxConverterIFCLoaderPlugin, Viewer } from "../../dist/xeokit-sdk.es.js";
|
|
146438
|
+
* const cxConverterIFCLoaderPlugin = new CxConverterIFCLoaderPlugin(viewer);
|
|
146439
|
+
*
|
|
146440
|
+
* const sceneModel = await cxConverterIFCLoaderPlugin.load({
|
|
146441
|
+
* src: "../../assets/models/ifc/Duplex.ifc"
|
|
146442
|
+
* });
|
|
146443
|
+
* ````
|
|
146444
|
+
See the code in action [here](https://xeokit.github.io/xeokit-sdk/examples/buildings/#cxConverterIFC_vbo_Duplex).
|
|
146445
|
+
*/
|
|
146446
|
+
|
|
146447
|
+
class CxConverterIFCLoaderPlugin extends Plugin {
|
|
146448
|
+
/**
|
|
146449
|
+
* @constructor
|
|
146450
|
+
* @param {Viewer} viewer The Viewer.
|
|
146451
|
+
* @param {Object} [cfg={}] Plugin configuration.
|
|
146452
|
+
*/
|
|
146453
|
+
constructor(viewer, cfg = {}) {
|
|
146454
|
+
super("ifcLoader", viewer, cfg);
|
|
146455
|
+
|
|
146456
|
+
/**
|
|
146457
|
+
* The GLTFLoaderPlugin used internally to load the converted GLTF.
|
|
146458
|
+
* @type {GLTFLoaderPlugin}
|
|
146459
|
+
*/
|
|
146460
|
+
this.gltfLoader = new GLTFLoaderPlugin(this.viewer);
|
|
146461
|
+
}
|
|
146462
|
+
|
|
146463
|
+
/**
|
|
146464
|
+
* Loads an IFC model from the given source.
|
|
146465
|
+
*
|
|
146466
|
+
* @param {Object} [params={}] Loading parameters.
|
|
146467
|
+
* @param {string} params.src Path to an IFC file.
|
|
146468
|
+
* @param {Function} [params.progressCallback] Callback to track loading progress.
|
|
146469
|
+
* @param {Function} [params.progressTextCallback] Callback to track loading progress with text updates.
|
|
146470
|
+
* @returns {Promise<SceneModel>} A promise that resolves to the loaded SceneModel.
|
|
146471
|
+
*/
|
|
146472
|
+
async load(params = {}) {
|
|
146473
|
+
if (!params.src) {
|
|
146474
|
+
this.error("load() param expected: src");
|
|
146475
|
+
}
|
|
146476
|
+
const data = await fetchFile(params.src);
|
|
146477
|
+
const { gltf, metaData } = await ifc2gltf(
|
|
146478
|
+
data,
|
|
146479
|
+
{
|
|
146480
|
+
remote: true,
|
|
146481
|
+
progressCallback: params.progressCallback,
|
|
146482
|
+
progressTextCallback: params.progressTextCallback
|
|
146483
|
+
}
|
|
146484
|
+
);
|
|
146485
|
+
const sceneModel = this.gltfLoader.load({
|
|
146486
|
+
id: "myModel",
|
|
146487
|
+
gltf: gltf,
|
|
146488
|
+
metaModelJSON: metaData
|
|
146489
|
+
});
|
|
146490
|
+
return sceneModel;
|
|
146491
|
+
}
|
|
146492
|
+
}
|
|
146493
|
+
|
|
142426
146494
|
/**
|
|
142427
146495
|
* Default data access strategy for {@link LASLoaderPlugin}.
|
|
142428
146496
|
*/
|
|
@@ -142485,13 +146553,23 @@ class LASDefaultDataSource {
|
|
|
142485
146553
|
if (request.status === 200) {
|
|
142486
146554
|
ok(request.response);
|
|
142487
146555
|
} else {
|
|
142488
|
-
error('
|
|
146556
|
+
error('getLAS error : ' + request.response);
|
|
142489
146557
|
}
|
|
142490
146558
|
}
|
|
142491
146559
|
};
|
|
142492
146560
|
request.send(null);
|
|
142493
146561
|
}
|
|
142494
146562
|
}
|
|
146563
|
+
|
|
146564
|
+
getManifest(manifestSrc, ok, error) {
|
|
146565
|
+
utils.loadJSON(this._cacheBusterURL(manifestSrc),
|
|
146566
|
+
(json) => {
|
|
146567
|
+
ok(json);
|
|
146568
|
+
},
|
|
146569
|
+
function (errMsg) {
|
|
146570
|
+
error(errMsg);
|
|
146571
|
+
});
|
|
146572
|
+
}
|
|
142495
146573
|
}
|
|
142496
146574
|
|
|
142497
146575
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
@@ -162521,6 +166599,8 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162521
166599
|
* @param {String} [params.id] ID to assign to the root {@link Entity#id}, unique among all components in the Viewer's {@link Scene}, generated automatically by default.
|
|
162522
166600
|
* @param {String} [params.src] Path to a LAS file, as an alternative to the ````las```` parameter.
|
|
162523
166601
|
* @param {ArrayBuffer} [params.las] The LAS file data, as an alternative to the ````src```` parameter.
|
|
166602
|
+
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
166603
|
+
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.laz```` || ````.las```` files to load as parts of the model. Use this option to load models that have been split into
|
|
162524
166604
|
* @param {Boolean} [params.loadMetadata=true] Whether to load metadata for the LAS model.
|
|
162525
166605
|
* @param {Number[]} [params.origin=[0,0,0]] The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates.
|
|
162526
166606
|
* @param {Number[]} [params.position=[0,0,0]] The model single-precision 3D position, relative to the ````origin```` parameter.
|
|
@@ -162542,7 +166622,7 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162542
166622
|
isModel: true
|
|
162543
166623
|
}));
|
|
162544
166624
|
|
|
162545
|
-
if (!params.src && !params.las) {
|
|
166625
|
+
if (!params.src && !params.las && !params.manifest && !params.manifestSrc) {
|
|
162546
166626
|
this.error("load() param expected: src or las");
|
|
162547
166627
|
return sceneModel; // Return new empty model
|
|
162548
166628
|
}
|
|
@@ -162555,18 +166635,77 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162555
166635
|
}
|
|
162556
166636
|
};
|
|
162557
166637
|
|
|
166638
|
+
const spinner = this.viewer.scene.canvas.spinner;
|
|
166639
|
+
const done = () => {
|
|
166640
|
+
sceneModel.scene.once("tick", () => {
|
|
166641
|
+
if (sceneModel.destroyed) {
|
|
166642
|
+
return;
|
|
166643
|
+
}
|
|
166644
|
+
sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
|
|
166645
|
+
sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
|
|
166646
|
+
});
|
|
166647
|
+
spinner.processes--;
|
|
166648
|
+
};
|
|
166649
|
+
const error = (errMsg) => {
|
|
166650
|
+
spinner.processes--;
|
|
166651
|
+
this.error(errMsg);
|
|
166652
|
+
sceneModel.fire("error", errMsg);
|
|
166653
|
+
};
|
|
166654
|
+
|
|
162558
166655
|
if (params.src) {
|
|
162559
166656
|
this._loadModel(params.src, params, options, sceneModel);
|
|
162560
|
-
} else {
|
|
162561
|
-
const spinner = this.viewer.scene.canvas.spinner;
|
|
166657
|
+
} else if(params.las) {
|
|
162562
166658
|
spinner.processes++;
|
|
162563
|
-
this._parseModel(params.las, params, options, sceneModel).then(
|
|
162564
|
-
|
|
162565
|
-
|
|
162566
|
-
|
|
162567
|
-
|
|
162568
|
-
|
|
162569
|
-
|
|
166659
|
+
this._parseModel(params.las, params, options, sceneModel).then(done, error);
|
|
166660
|
+
} else if (params.manifest || params.manifestSrc) {
|
|
166661
|
+
const baseDir = params.manifestSrc ? getBaseDirectory(params.manifestSrc) : "";
|
|
166662
|
+
const loadAllFiles = (lasFiles) => {
|
|
166663
|
+
let i = 0;
|
|
166664
|
+
const modelsLoaded = new Array(lasFiles.length);
|
|
166665
|
+
const loadNext = () => {
|
|
166666
|
+
if (sceneModel.destroyed) {
|
|
166667
|
+
done();
|
|
166668
|
+
} else if (i >= lasFiles.length) {
|
|
166669
|
+
return
|
|
166670
|
+
} else {
|
|
166671
|
+
modelsLoaded[i] = false;
|
|
166672
|
+
this._dataSource.getLAS(`${baseDir}${lasFiles[i]}`, (arrayBuffer) => {
|
|
166673
|
+
const modelParams = utils.apply(params, {isManifest: true, index: i});
|
|
166674
|
+
this._parseModel(arrayBuffer, modelParams, options, sceneModel).then(() => {
|
|
166675
|
+
modelsLoaded[modelParams.index] = true;
|
|
166676
|
+
let allLoaded = true;
|
|
166677
|
+
modelsLoaded.forEach((loaded) => {
|
|
166678
|
+
if(!loaded) allLoaded = false;
|
|
166679
|
+
});
|
|
166680
|
+
if(allLoaded) done();
|
|
166681
|
+
});
|
|
166682
|
+
i++;
|
|
166683
|
+
this.scheduleTask(loadNext, 200);
|
|
166684
|
+
}, error);
|
|
166685
|
+
}
|
|
166686
|
+
};
|
|
166687
|
+
loadNext();
|
|
166688
|
+
};
|
|
166689
|
+
const loadManifestData = (manifestData) => {
|
|
166690
|
+
if(sceneModel.destroyed) return;
|
|
166691
|
+
const files = manifestData.lasFiles || manifestData.lazFiles;
|
|
166692
|
+
if(!files || files.length <= 0) {
|
|
166693
|
+
this.error(`load(): Failed to load model manifest - manifest not valid`);
|
|
166694
|
+
return;
|
|
166695
|
+
}
|
|
166696
|
+
loadAllFiles(files);
|
|
166697
|
+
};
|
|
166698
|
+
if(params.manifestSrc) {
|
|
166699
|
+
this._dataSource.getManifest(params.manifestSrc, (manifestData) => {
|
|
166700
|
+
loadManifestData(manifestData);
|
|
166701
|
+
}, (errMsg) => {
|
|
166702
|
+
this.error(errMsg);
|
|
166703
|
+
sceneModel.fire("error", errMsg);
|
|
166704
|
+
});
|
|
166705
|
+
} else {
|
|
166706
|
+
const manifestData = params.manifest;
|
|
166707
|
+
loadManifestData(manifestData);
|
|
166708
|
+
}
|
|
162570
166709
|
}
|
|
162571
166710
|
|
|
162572
166711
|
return sceneModel;
|
|
@@ -162577,6 +166716,13 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162577
166716
|
spinner.processes++;
|
|
162578
166717
|
this._dataSource.getLAS(params.src, (arrayBuffer) => {
|
|
162579
166718
|
this._parseModel(arrayBuffer, params, options, sceneModel).then(() => {
|
|
166719
|
+
sceneModel.scene.once("tick", () => {
|
|
166720
|
+
if (sceneModel.destroyed) {
|
|
166721
|
+
return;
|
|
166722
|
+
}
|
|
166723
|
+
sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
|
|
166724
|
+
sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
|
|
166725
|
+
});
|
|
162580
166726
|
spinner.processes--;
|
|
162581
166727
|
}, (errMsg) => {
|
|
162582
166728
|
spinner.processes--;
|
|
@@ -162759,7 +166905,7 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162759
166905
|
const meshIds = [];
|
|
162760
166906
|
|
|
162761
166907
|
for (let i = 0, len = pointsChunks.length; i < len; i++) {
|
|
162762
|
-
const meshId =
|
|
166908
|
+
const meshId = `${params.isManifest ? 'model'+params.index : ''}pointsMesh${i}`;
|
|
162763
166909
|
meshIds.push(meshId);
|
|
162764
166910
|
sceneModel.createMesh({
|
|
162765
166911
|
id: meshId,
|
|
@@ -162768,30 +166914,6 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162768
166914
|
colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null
|
|
162769
166915
|
});
|
|
162770
166916
|
}
|
|
162771
|
-
/*
|
|
162772
|
-
const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
|
|
162773
|
-
const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
|
|
162774
|
-
const meshIds = [];
|
|
162775
|
-
|
|
162776
|
-
for (let i = 0, len = pointsChunks.length; i < len; i++) {
|
|
162777
|
-
|
|
162778
|
-
const geometryId = `geometryMesh${i}`;
|
|
162779
|
-
const meshId = `pointsMesh${i}`;
|
|
162780
|
-
meshIds.push(meshId);
|
|
162781
|
-
|
|
162782
|
-
sceneModel.createGeometry({
|
|
162783
|
-
id: geometryId,
|
|
162784
|
-
primitive: "points",
|
|
162785
|
-
positions: pointsChunks[i],
|
|
162786
|
-
colorsCompressed: (i < colorsChunks.length) ? colorsChunks[i] : null
|
|
162787
|
-
});
|
|
162788
|
-
|
|
162789
|
-
sceneModel.createMesh({
|
|
162790
|
-
id: meshId,
|
|
162791
|
-
geometryId
|
|
162792
|
-
});
|
|
162793
|
-
}
|
|
162794
|
-
*/
|
|
162795
166917
|
|
|
162796
166918
|
const pointsObjectId = params.entityId || math.createUUID();
|
|
162797
166919
|
|
|
@@ -162834,14 +166956,6 @@ class LASLoaderPlugin extends Plugin {
|
|
|
162834
166956
|
this.viewer.metaScene.createMetaModel(metaModelId, metadata, options);
|
|
162835
166957
|
}
|
|
162836
166958
|
|
|
162837
|
-
sceneModel.scene.once("tick", () => {
|
|
162838
|
-
if (sceneModel.destroyed) {
|
|
162839
|
-
return;
|
|
162840
|
-
}
|
|
162841
|
-
sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
|
|
162842
|
-
sceneModel.fire("loaded", true, false); // Don't forget the event, for late subscribers
|
|
162843
|
-
});
|
|
162844
|
-
|
|
162845
166959
|
resolve();
|
|
162846
166960
|
});
|
|
162847
166961
|
} catch (e) {
|
|
@@ -162863,6 +166977,16 @@ function chunkArray(array, chunkSize) {
|
|
|
162863
166977
|
return result;
|
|
162864
166978
|
}
|
|
162865
166979
|
|
|
166980
|
+
function getBaseDirectory(filePath) {
|
|
166981
|
+
if (filePath.indexOf('?') > -1) {
|
|
166982
|
+
filePath = filePath.split('?')[0];
|
|
166983
|
+
}
|
|
166984
|
+
|
|
166985
|
+
const pathArray = filePath.split('/');
|
|
166986
|
+
pathArray.pop(); // Remove the file name or the last segment of the path
|
|
166987
|
+
return pathArray.join('/') + '/';
|
|
166988
|
+
}
|
|
166989
|
+
|
|
162866
166990
|
/**
|
|
162867
166991
|
* Default data access strategy for {@link CityJSONLoaderPlugin}.
|
|
162868
166992
|
*/
|
|
@@ -165979,4 +170103,4 @@ class ZoneTranslateTouchControl extends ZoneTranslateControl {
|
|
|
165979
170103
|
}
|
|
165980
170104
|
}
|
|
165981
170105
|
|
|
165982
|
-
export { AlphaFormat, AmbientLight, AngleMeasurementEditMouseControl, AngleMeasurementEditTouchControl, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementEditControl, DistanceMeasurementEditMouseControl, DistanceMeasurementEditTouchControl, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, Dot3D, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, Label3D, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MeshSurfaceArea, MeshVolume, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$1 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, Wire3D, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, activateDraggableDot, activateDraggableDots, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildLineGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, isTriangleMeshSolid, load3DSGeometry, loadOBJGeometry, math, meshSurfaceArea, meshVolume, os, rtcToWorldPos, sRGBEncoding, setFrustum, stats, touchPointSelector, transformToNode, utils, worldToRTCPos, worldToRTCPositions };
|
|
170106
|
+
export { AlphaFormat, AmbientLight, AngleMeasurementEditMouseControl, AngleMeasurementEditTouchControl, AngleMeasurementsControl, AngleMeasurementsMouseControl, AngleMeasurementsPlugin, AngleMeasurementsTouchControl, AnnotationsPlugin, AxisGizmoPlugin, BCFViewpointsPlugin, Bitmap, ByteType, CameraMemento, CameraPath, CameraPathAnimation, CityJSONLoaderPlugin, ClampToEdgeWrapping, Component, CompressedMediaType, Configs, ContextMenu, CubicBezierCurve, Curve, CxConverterIFCLoaderPlugin, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DirLight, DistanceMeasurementEditControl, DistanceMeasurementEditMouseControl, DistanceMeasurementEditTouchControl, DistanceMeasurementsControl, DistanceMeasurementsMouseControl, DistanceMeasurementsPlugin, DistanceMeasurementsTouchControl, Dot3D, DotBIMDefaultDataSource, DotBIMLoaderPlugin, EdgeMaterial, EmphasisMaterial, FaceAlignedSectionPlanesPlugin, FastNavPlugin, FloatType, Fresnel, Frustum$1 as Frustum, FrustumPlane, GIFMediaType, GLTFDefaultDataSource, GLTFLoaderPlugin, HalfFloatType, ImagePlane, IntType, JPEGMediaType, KTX2TextureTranscoder, LASLoaderPlugin, Label3D, LambertMaterial, LightMap, LineSet, LinearEncoding, LinearFilter, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, Loader, LoadingManager, LocaleService, LuminanceAlphaFormat, LuminanceFormat, Map$1 as Map, Marker, MarqueePicker, MarqueePickerMouseControl, Mesh, MeshSurfaceArea, MeshVolume, MetallicMaterial, MirroredRepeatWrapping, ModelMemento, NavCubePlugin, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, Node$1 as Node, OBJLoaderPlugin, ObjectsKdTree3, ObjectsMemento, PNGMediaType, Path, PerformanceModel, PhongMaterial, PickResult, Plugin, PointLight, PointerCircle, PointerLens, QuadraticBezierCurve, Queue, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, ReadableGeometry, RedFormat, RedIntegerFormat, ReflectionMap, RepeatWrapping, STLDefaultDataSource, STLLoaderPlugin, SceneModel, SceneModelMesh, SceneModelTransform, SectionPlane, SectionPlanesPlugin, ShortType, Skybox, SkyboxesPlugin, SpecularMaterial, SplineCurve, SpriteMarker, StoreyViewsPlugin, Texture, TextureTranscoder, TreeViewPlugin, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VBOGeometry, ViewCullPlugin, Viewer, WebIFCLoaderPlugin, Wire3D, WorkerPool$1 as WorkerPool, XKTDefaultDataSource, XKTLoaderPlugin, XML3DLoaderPlugin, ZoneEditControl, ZoneEditMouseControl, ZoneEditTouchControl, ZoneTranslateControl, ZoneTranslateMouseControl, ZoneTranslateTouchControl, ZonesMouseControl, ZonesPlugin, ZonesPolysurfaceMouseControl, ZonesPolysurfaceTouchControl, ZonesTouchControl, activateDraggableDot, activateDraggableDots, buildBoxGeometry, buildBoxLinesGeometry, buildBoxLinesGeometryFromAABB, buildCylinderGeometry, buildGridGeometry, buildLineGeometry, buildPlaneGeometry, buildPolylineGeometry, buildPolylineGeometryFromCurve, buildSphereGeometry, buildTorusGeometry, buildVectorTextGeometry, createRTCViewMat, frustumIntersectsAABB3, getKTX2TextureTranscoder, getPlaneRTCPos, isTriangleMeshSolid, load3DSGeometry, loadOBJGeometry, math, meshSurfaceArea, meshVolume, os, rtcToWorldPos, sRGBEncoding, setFrustum, stats, touchPointSelector, transformToNode, utils, worldToRTCPos, worldToRTCPositions };
|