@needle-tools/engine 4.15.0-next.f391a30 → 4.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.needle.json +1 -1
- package/dist/{gltf-progressive-CTlvpS3A.js → gltf-progressive-Bm_6aEi4.js} +1 -1
- package/dist/{gltf-progressive-CMwJPwEt.umd.cjs → gltf-progressive-BttGBXw6.umd.cjs} +1 -1
- package/dist/{gltf-progressive-DYL3SLVb.min.js → gltf-progressive-T5WKTux5.min.js} +1 -1
- package/dist/materialx-CJyQZtjt.min.js +90 -0
- package/dist/materialx-DMs1E08Z.js +4636 -0
- package/dist/materialx-DaKKOoVk.umd.cjs +90 -0
- package/dist/{needle-engine.bundle-DsTdfmeb.min.js → needle-engine.bundle-CBq_OMnI.min.js} +122 -124
- package/dist/{needle-engine.bundle-DB4kLWO_.js → needle-engine.bundle-DGyiwNWR.js} +3226 -3232
- package/dist/{needle-engine.bundle-C1BFRZDF.umd.cjs → needle-engine.bundle-JN3eiiYc.umd.cjs} +113 -115
- package/dist/needle-engine.d.ts +52 -33
- package/dist/needle-engine.js +288 -287
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-BN-f4viE.min.js → postprocessing-06AXuvdv.min.js} +1 -1
- package/dist/{postprocessing-De9ZpJrk.js → postprocessing-CI2x8Cln.js} +1 -1
- package/dist/{postprocessing-DYmYOVm4.umd.cjs → postprocessing-CPDcA21P.umd.cjs} +1 -1
- package/dist/{three-examples-BHqRVpO_.umd.cjs → three-examples-BMmNgNCN.umd.cjs} +12 -12
- package/dist/{three-examples-C0ZCCA_K.js → three-examples-CMYCd5nH.js} +192 -182
- package/dist/{three-examples-DmTY8tGr.min.js → three-examples-CQl1fFZp.min.js} +14 -14
- package/lib/engine/api.d.ts +2 -0
- package/lib/engine/api.js +2 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/debug/debug.js +1 -1
- package/lib/engine/debug/debug.js.map +1 -1
- package/lib/engine/debug/debug_spatial_console.js +1 -1
- package/lib/engine/debug/debug_spatial_console.js.map +1 -1
- package/lib/engine/engine_accessibility.d.ts +1 -1
- package/lib/engine/engine_accessibility.js +1 -1
- package/lib/engine/engine_accessibility.js.map +1 -1
- package/lib/engine/engine_context.d.ts +1 -1
- package/lib/engine/engine_context.js +2 -2
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_create_objects.js +1 -1
- package/lib/engine/engine_create_objects.js.map +1 -1
- package/lib/engine/engine_gizmos.js +1 -1
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_license.js +2 -7
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_test_utils.d.ts +39 -0
- package/lib/engine/engine_test_utils.js +84 -0
- package/lib/engine/engine_test_utils.js.map +1 -0
- package/lib/engine/engine_utils.js +2 -2
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/export/gltf/index.js +1 -1
- package/lib/engine/export/gltf/index.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +3 -6
- package/lib/engine/webcomponents/logo-element.js +0 -18
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +7 -10
- package/lib/engine/webcomponents/needle menu/needle-menu.js +4 -14
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js +1 -10
- package/lib/engine/webcomponents/needle-engine.ar-overlay.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +0 -3
- package/lib/engine/webcomponents/needle-engine.js +0 -10
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine-components/Component.js +1 -0
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +2 -24
- package/lib/engine-components/ReflectionProbe.js +2 -28
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Skybox.js +2 -4
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/export/gltf/GltfExport.js +1 -1
- package/lib/engine-components/export/gltf/GltfExport.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +2 -2
- package/lib/engine-components/export/usdz/USDZExporter.js +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js +2 -2
- package/lib/engine-components/export/usdz/extensions/behavior/PhysicsExtension.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
- package/lib/include/three/EXT_mesh_gpu_instancing_exporter.js.map +1 -0
- package/package.json +14 -18
- package/plugins/common/buildinfo.js +10 -46
- package/plugins/common/files.js +1 -2
- package/plugins/common/license.js +69 -144
- package/plugins/common/logger.js +11 -172
- package/plugins/common/worker.js +4 -5
- package/plugins/types/userconfig.d.ts +2 -40
- package/plugins/vite/alias.js +5 -6
- package/plugins/vite/asap.js +5 -6
- package/plugins/vite/build-pipeline.js +41 -224
- package/plugins/vite/buildinfo.js +6 -66
- package/plugins/vite/copyfiles.js +12 -41
- package/plugins/vite/custom-element-data.js +16 -26
- package/plugins/vite/defines.js +5 -8
- package/plugins/vite/dependencies.js +10 -16
- package/plugins/vite/dependency-watcher.js +7 -35
- package/plugins/vite/drop-client.js +5 -7
- package/plugins/vite/drop.js +14 -16
- package/plugins/vite/editor-connection.js +16 -18
- package/plugins/vite/imports-logger.js +2 -12
- package/plugins/vite/index.js +3 -8
- package/plugins/vite/local-files.js +441 -2
- package/plugins/vite/logger.client.js +35 -45
- package/plugins/vite/logger.js +3 -6
- package/plugins/vite/meta.js +4 -18
- package/plugins/vite/needle-app.js +3 -4
- package/plugins/vite/peer.js +1 -2
- package/plugins/vite/pwa.js +17 -33
- package/plugins/vite/reload.js +2 -24
- package/src/engine/api.ts +3 -0
- package/src/engine/debug/debug.ts +1 -1
- package/src/engine/debug/debug_spatial_console.ts +1 -5
- package/src/engine/engine_accessibility.ts +1 -2
- package/src/engine/engine_context.ts +2 -2
- package/src/engine/engine_create_objects.ts +1 -1
- package/src/engine/engine_gizmos.ts +5 -9
- package/src/engine/engine_license.ts +2 -7
- package/src/engine/engine_test_utils.ts +109 -0
- package/src/engine/engine_utils.ts +2 -2
- package/src/engine/export/gltf/index.ts +1 -1
- package/src/engine/webcomponents/logo-element.ts +3 -20
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -6
- package/src/engine/webcomponents/needle menu/needle-menu.ts +11 -23
- package/src/engine/webcomponents/needle-engine.ar-overlay.ts +2 -13
- package/src/engine/webcomponents/needle-engine.ts +1 -13
- package/src/engine-components/Component.ts +2 -1
- package/src/engine-components/ReflectionProbe.ts +9 -33
- package/src/engine-components/Skybox.ts +2 -4
- package/src/engine-components/export/gltf/GltfExport.ts +1 -1
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +2 -2
- package/src/engine-components/export/usdz/USDZExporter.ts +1 -1
- package/src/engine-components/export/usdz/extensions/behavior/PhysicsExtension.ts +2 -2
- package/src/include/draco/draco_decoder.js +34 -0
- package/src/include/draco/draco_decoder.wasm +0 -0
- package/src/include/draco/draco_wasm_wrapper.js +117 -0
- package/src/include/ktx2/basis_transcoder.js +19 -0
- package/src/include/ktx2/basis_transcoder.wasm +0 -0
- package/src/include/needle/arial-msdf.json +1472 -0
- package/src/include/needle/arial.png +0 -0
- package/src/include/needle/poweredbyneedle.webp +0 -0
- package/dist/materialx-4jJLLe9Q.js +0 -4174
- package/dist/materialx-Bt9FHwco.min.js +0 -158
- package/dist/materialx-NDD0y4JY.umd.cjs +0 -158
- package/lib/engine/export/gltf/EXT_mesh_gpu_instancing_exporter.js.map +0 -1
- package/plugins/common/needle-engine-skill.md +0 -175
- package/plugins/vite/ai.js +0 -71
- package/plugins/vite/local-files-analysis.js +0 -789
- package/plugins/vite/local-files-core.js +0 -992
- package/plugins/vite/local-files-internals.js +0 -28
- package/plugins/vite/local-files-types.d.ts +0 -111
- package/plugins/vite/local-files-utils.js +0 -359
- package/plugins/vite/logging.js +0 -129
- /package/lib/{engine/export/gltf → include/three}/EXT_mesh_gpu_instancing_exporter.d.ts +0 -0
- /package/lib/{engine/export/gltf → include/three}/EXT_mesh_gpu_instancing_exporter.js +0 -0
- /package/src/{engine/export/gltf → include/three}/EXT_mesh_gpu_instancing_exporter.js +0 -0
|
@@ -0,0 +1,4636 @@
|
|
|
1
|
+
import { Texture as tI, WebGLRenderTarget as TE, RepeatWrapping as Rg, LinearFilter as aB, LinearMipMapLinearFilter as ZB, FloatType as pE, RGBAFormat as LE, PlaneGeometry as NB, OrthographicCamera as xE, ShaderMaterial as RB, Scene as jE, Mesh as Fg, EquirectangularReflectionMapping as uE, Uniform$1 as qE, LinearSRGBColorSpace as vE, Vector3 as hI, Quaternion as tE, Color as BB, Cache as XA, MirroredRepeatWrapping as nE, ClampToEdgeWrapping as zE, NearestMipMapNearestFilter as fE, NearestFilter as OE, MeshBasicMaterial as eE, PMREMGenerator$1 as rE, cloneUniforms as _E, cloneUniformsGroups as $E, GLSL3 as AG, Matrix4 as xI, Matrix3 as IG, MeshStandardMaterial as uI, DoubleSide as gG, FrontSide as BG } from "./three-Bvk2VKbF.js";
|
|
2
|
+
import "./three-examples-CMYCd5nH.js";
|
|
3
|
+
var qI = (function() {
|
|
4
|
+
var l = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0;
|
|
5
|
+
return typeof __filename < "u" && (l = l || __filename), (function(w) {
|
|
6
|
+
w = w || {};
|
|
7
|
+
var E = typeof w < "u" ? w : {}, R, H;
|
|
8
|
+
E.ready = new Promise(function(A, I) {
|
|
9
|
+
R = A, H = I;
|
|
10
|
+
}), E.expectedDataFileDownloads || (E.expectedDataFileDownloads = 0), E.expectedDataFileDownloads++, (function() {
|
|
11
|
+
var A = function(I) {
|
|
12
|
+
if (typeof window == "object")
|
|
13
|
+
window.encodeURIComponent(window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf("/")) + "/");
|
|
14
|
+
else if (typeof location < "u")
|
|
15
|
+
encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf("/")) + "/");
|
|
16
|
+
else
|
|
17
|
+
throw "using preloaded data can only be done on a web page or in a web worker";
|
|
18
|
+
var g = "../../bin/JsMaterialXGenShader.data", B = "JsMaterialXGenShader.data";
|
|
19
|
+
typeof E.locateFilePackage == "function" && !E.locateFile && (E.locateFile = E.locateFilePackage, DA("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)"));
|
|
20
|
+
var Q = E.locateFile ? E.locateFile(B, "") : B, G = I.remote_package_size;
|
|
21
|
+
function i(Y, a, k, N) {
|
|
22
|
+
var b = new XMLHttpRequest();
|
|
23
|
+
b.open("GET", Y, !0), b.responseType = "arraybuffer", b.onprogress = function(y) {
|
|
24
|
+
var X = Y, V = a;
|
|
25
|
+
if (y.total && (V = y.total), y.loaded) {
|
|
26
|
+
b.addedTotal ? E.dataFileDownloads[X].loaded = y.loaded : (b.addedTotal = !0, E.dataFileDownloads || (E.dataFileDownloads = {}), E.dataFileDownloads[X] = { loaded: y.loaded, total: V });
|
|
27
|
+
var Z = 0, J = 0, q = 0;
|
|
28
|
+
for (var p in E.dataFileDownloads) {
|
|
29
|
+
var z = E.dataFileDownloads[p];
|
|
30
|
+
Z += z.total, J += z.loaded, q++;
|
|
31
|
+
}
|
|
32
|
+
Z = Math.ceil(Z * E.expectedDataFileDownloads / q), E.setStatus && E.setStatus("Downloading data... (" + J + "/" + Z + ")");
|
|
33
|
+
} else E.dataFileDownloads || E.setStatus && E.setStatus("Downloading data...");
|
|
34
|
+
}, b.onerror = function(y) {
|
|
35
|
+
throw new Error("NetworkError for: " + Y);
|
|
36
|
+
}, b.onload = function(y) {
|
|
37
|
+
if (b.status == 200 || b.status == 304 || b.status == 206 || b.status == 0 && b.response) {
|
|
38
|
+
var X = b.response;
|
|
39
|
+
k(X);
|
|
40
|
+
} else
|
|
41
|
+
throw new Error(b.statusText + " : " + b.responseURL);
|
|
42
|
+
}, b.send(null);
|
|
43
|
+
}
|
|
44
|
+
var D = null, h = E.getPreloadedPackage ? E.getPreloadedPackage(Q, G) : null;
|
|
45
|
+
h || i(Q, G, function(Y) {
|
|
46
|
+
D ? (D(Y), D = null) : h = Y;
|
|
47
|
+
});
|
|
48
|
+
function o() {
|
|
49
|
+
function Y(y, X) {
|
|
50
|
+
if (!y) throw X + new Error().stack;
|
|
51
|
+
}
|
|
52
|
+
E.FS_createPath("/", "libraries", !0, !0), E.FS_createPath("/libraries", "lights", !0, !0), E.FS_createPath("/libraries/lights", "genmsl", !0, !0), E.FS_createPath("/libraries/lights", "genglsl", !0, !0), E.FS_createPath("/libraries", "stdlib", !0, !0), E.FS_createPath("/libraries/stdlib", "genmsl", !0, !0), E.FS_createPath("/libraries/stdlib/genmsl", "lib", !0, !0), E.FS_createPath("/libraries/stdlib", "genglsl", !0, !0), E.FS_createPath("/libraries/stdlib/genglsl", "lib", !0, !0), E.FS_createPath("/libraries/stdlib", "genosl", !0, !0), E.FS_createPath("/libraries/stdlib/genosl", "include", !0, !0), E.FS_createPath("/libraries/stdlib/genosl", "lib", !0, !0), E.FS_createPath("/libraries/stdlib", "genmdl", !0, !0), E.FS_createPath("/libraries", "targets", !0, !0), E.FS_createPath("/libraries", "pbrlib", !0, !0), E.FS_createPath("/libraries/pbrlib", "genmsl", !0, !0), E.FS_createPath("/libraries/pbrlib", "genglsl", !0, !0), E.FS_createPath("/libraries/pbrlib/genglsl", "lib", !0, !0), E.FS_createPath("/libraries/pbrlib", "genosl", !0, !0), E.FS_createPath("/libraries/pbrlib/genosl", "lib", !0, !0), E.FS_createPath("/libraries/pbrlib", "genmdl", !0, !0), E.FS_createPath("/libraries", "bxdf", !0, !0), E.FS_createPath("/libraries/bxdf", "lama", !0, !0), E.FS_createPath("/libraries/bxdf", "translation", !0, !0), E.FS_createPath("/libraries", "cmlib", !0, !0), E.FS_createPath("/libraries", "nprlib", !0, !0), E.FS_createPath("/libraries/nprlib", "genmsl", !0, !0), E.FS_createPath("/libraries/nprlib", "genglsl", !0, !0), E.FS_createPath("/libraries/nprlib", "genosl", !0, !0), E.FS_createPath("/libraries/nprlib", "genmdl", !0, !0);
|
|
53
|
+
function a(y, X, V) {
|
|
54
|
+
this.start = y, this.end = X, this.audio = V;
|
|
55
|
+
}
|
|
56
|
+
a.prototype = { requests: {}, open: function(y, X) {
|
|
57
|
+
this.name = X, this.requests[X] = this, E.addRunDependency("fp " + this.name);
|
|
58
|
+
}, send: function() {
|
|
59
|
+
}, onload: function() {
|
|
60
|
+
var y = this.byteArray.subarray(this.start, this.end);
|
|
61
|
+
this.finish(y);
|
|
62
|
+
}, finish: function(y) {
|
|
63
|
+
var X = this;
|
|
64
|
+
E.FS_createDataFile(this.name, null, y, !0, !0, !0), E.removeRunDependency("fp " + X.name), this.requests[this.name] = null;
|
|
65
|
+
} };
|
|
66
|
+
for (var k = I.files, N = 0; N < k.length; ++N)
|
|
67
|
+
new a(k[N].start, k[N].end, k[N].audio).open("GET", k[N].filename);
|
|
68
|
+
function b(y) {
|
|
69
|
+
Y(y, "Loading data file failed."), Y(y instanceof ArrayBuffer, "bad input to processPackageData");
|
|
70
|
+
var X = new Uint8Array(y);
|
|
71
|
+
a.prototype.byteArray = X;
|
|
72
|
+
for (var V = I.files, Z = 0; Z < V.length; ++Z)
|
|
73
|
+
a.prototype.requests[V[Z].filename].onload();
|
|
74
|
+
E.removeRunDependency("datafile_../../bin/JsMaterialXGenShader.data");
|
|
75
|
+
}
|
|
76
|
+
E.addRunDependency("datafile_../../bin/JsMaterialXGenShader.data"), E.preloadResults || (E.preloadResults = {}), E.preloadResults[g] = { fromCache: !1 }, h ? (b(h), h = null) : D = b;
|
|
77
|
+
}
|
|
78
|
+
E.calledRun ? o() : (E.preRun || (E.preRun = []), E.preRun.push(o));
|
|
79
|
+
};
|
|
80
|
+
A({ files: [{ filename: "/libraries/README.md", start: 0, end: 4904, audio: 0 }, { filename: "/libraries/CMakeLists.txt", start: 4904, end: 6827, audio: 0 }, { filename: "/libraries/lights/lights_defs.mtlx", start: 6827, end: 9239, audio: 0 }, { filename: "/libraries/lights/genmsl/mx_point_light.metal", start: 9239, end: 9615, audio: 0 }, { filename: "/libraries/lights/genmsl/mx_spot_light.metal", start: 9615, end: 10245, audio: 0 }, { filename: "/libraries/lights/genmsl/mx_directional_light.metal", start: 10245, end: 10432, audio: 0 }, { filename: "/libraries/lights/genmsl/lights_genmsl_impl.mtlx", start: 10432, end: 11033, audio: 0 }, { filename: "/libraries/lights/genglsl/lights_genglsl_impl.mtlx", start: 11033, end: 11637, audio: 0 }, { filename: "/libraries/lights/genglsl/mx_spot_light.glsl", start: 11637, end: 12261, audio: 0 }, { filename: "/libraries/lights/genglsl/mx_directional_light.glsl", start: 12261, end: 12442, audio: 0 }, { filename: "/libraries/lights/genglsl/mx_point_light.glsl", start: 12442, end: 12812, audio: 0 }, { filename: "/libraries/stdlib/stdlib_defs.mtlx", start: 12812, end: 290021, audio: 0 }, { filename: "/libraries/stdlib/stdlib_ng.mtlx", start: 290021, end: 611027, audio: 0 }, { filename: "/libraries/stdlib/genmsl/stdlib_genmsl_impl.mtlx", start: 611027, end: 621322, audio: 0 }, { filename: "/libraries/stdlib/genmsl/lib/mx_sampling.metal", start: 621322, end: 623725, audio: 0 }, { filename: "/libraries/stdlib/genmsl/lib/mx_matscalaroperators.metal", start: 623725, end: 624734, audio: 0 }, { filename: "/libraries/stdlib/genmsl/lib/mx_math.metal", start: 624734, end: 629023, audio: 0 }, { filename: "/libraries/stdlib/genmsl/lib/mx_texture.metal", start: 629023, end: 629761, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise3d_vector2.glsl", start: 629761, end: 629972, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_smoothstep_float.glsl", start: 629972, end: 630197, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splittb_float.glsl", start: 630197, end: 630390, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_vector3.glsl", start: 630390, end: 631209, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splittb_vector3.glsl", start: 631209, end: 631401, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_burn_color3.glsl", start: 631401, end: 631686, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_dodge_float.glsl", start: 631686, end: 631908, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_disjointover_color4.glsl", start: 631908, end: 632502, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_premult_color4.glsl", start: 632502, end: 632599, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal2d_vector2.glsl", start: 632599, end: 632869, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_normalmap.glsl", start: 632869, end: 633367, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_cellnoise3d_float.glsl", start: 633367, end: 633504, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise3d_float.glsl", start: 633504, end: 633714, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal2d_vector4.glsl", start: 633714, end: 633984, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_creatematrix_vector4_matrix44.glsl", start: 633984, end: 634268, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splitlr_vector2.glsl", start: 634268, end: 634460, audio: 0 }, { filename: "/libraries/stdlib/genglsl/stdlib_genglsl_impl.mtlx", start: 634460, end: 711835, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_transformmatrix_vector3M4.glsl", start: 711835, end: 711977, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise3d_vector3.glsl", start: 711977, end: 712185, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splitlr_vector3.glsl", start: 712185, end: 712377, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramplr_vector2.glsl", start: 712377, end: 712527, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise2d_vector2.glsl", start: 712527, end: 712738, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal3d_vector4.glsl", start: 712738, end: 713008, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_float.glsl", start: 713008, end: 713823, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramptb_vector3.glsl", start: 713823, end: 713973, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_rgbtohsv_color3.glsl", start: 713973, end: 714087, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramptb_vector2.glsl", start: 714087, end: 714237, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise2d_vector3.glsl", start: 714237, end: 714445, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix33.glsl", start: 714445, end: 714652, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_rotate_vector3.glsl", start: 714652, end: 715553, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramplr_vector3.glsl", start: 715553, end: 715703, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_hextilednormalmap.glsl", start: 715703, end: 718676, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_luminance_color3.glsl", start: 718676, end: 718790, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_hsvtorgb_color4.glsl", start: 718790, end: 718919, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise3d_vector2.glsl", start: 718919, end: 719103, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_color4.glsl", start: 719103, end: 719912, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise2d_vector3.glsl", start: 719912, end: 720096, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise3d_vector4.glsl", start: 720096, end: 720375, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_color3.glsl", start: 720375, end: 721192, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_burn_float.glsl", start: 721192, end: 721415, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_cellnoise2d_float.glsl", start: 721415, end: 721552, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise3d_float.glsl", start: 721552, end: 721736, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_vector2.glsl", start: 721736, end: 722553, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_hextiledimage.glsl", start: 722553, end: 726619, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise2d_float.glsl", start: 726619, end: 726829, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_dodge_color4.glsl", start: 726829, end: 727178, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramptb_vector4.glsl", start: 727178, end: 727328, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splittb_vector2.glsl", start: 727328, end: 727520, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splitlr_vector4.glsl", start: 727520, end: 727712, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramptb_float.glsl", start: 727712, end: 727863, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_hsvtorgb_color3.glsl", start: 727863, end: 727977, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_transformmatrix_vector2M3.glsl", start: 727977, end: 728118, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splitlr_float.glsl", start: 728118, end: 728311, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_image_vector4.glsl", start: 728311, end: 729122, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal2d_vector3.glsl", start: 729122, end: 729392, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise2d_float.glsl", start: 729392, end: 729576, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal3d_vector2.glsl", start: 729576, end: 729846, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_luminance_color4.glsl", start: 729846, end: 729977, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_rgbtohsv_color4.glsl", start: 729977, end: 730106, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_unpremult_color4.glsl", start: 730106, end: 730205, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal3d_vector3.glsl", start: 730205, end: 730475, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_aastep.glsl", start: 730475, end: 730675, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_splittb_vector4.glsl", start: 730675, end: 730867, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise2d_vector2.glsl", start: 730867, end: 731051, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramplr_float.glsl", start: 731051, end: 731202, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal3d_float.glsl", start: 731202, end: 731474, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_ramplr_vector4.glsl", start: 731474, end: 731624, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_burn_color4.glsl", start: 731624, end: 731965, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_mix_surfaceshader.glsl", start: 731965, end: 732199, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_dodge_color3.glsl", start: 732199, end: 732489, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_heighttonormal_vector3.glsl", start: 732489, end: 733442, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_fractal2d_float.glsl", start: 733442, end: 733714, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_worleynoise3d_vector3.glsl", start: 733714, end: 733898, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_creatematrix_vector3_matrix44.glsl", start: 733898, end: 734174, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_noise2d_vector4.glsl", start: 734174, end: 734449, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_rotate_vector2.glsl", start: 734449, end: 734707, audio: 0 }, { filename: "/libraries/stdlib/genglsl/mx_surface_unlit.glsl", start: 734707, end: 734999, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_sampling.glsl", start: 734999, end: 737366, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_transform_uv_vflip.glsl", start: 737366, end: 737502, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_math.glsl", start: 737502, end: 738137, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_noise.glsl", start: 738137, end: 761076, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_transform_uv.glsl", start: 761076, end: 761192, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_hextile.glsl", start: 761192, end: 765693, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_geometry.glsl", start: 765693, end: 767054, audio: 0 }, { filename: "/libraries/stdlib/genglsl/lib/mx_hsv.glsl", start: 767054, end: 770533, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise3d_vector2.osl", start: 770533, end: 770698, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_string.osl", start: 770698, end: 770854, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise3d_vector3.osl", start: 770854, end: 771038, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise3d_float.osl", start: 771038, end: 771197, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise2d_vector3.osl", start: 771197, end: 771362, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_luminance_color4.osl", start: 771362, end: 771494, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal3d_float.osl", start: 771494, end: 771725, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_frame_float.osl", start: 771725, end: 771894, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_hsvtorgb_color3.osl", start: 771894, end: 771999, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_vector4.osl", start: 771999, end: 772317, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_color3.osl", start: 772317, end: 773262, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_luminance_color3.osl", start: 773262, end: 773374, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_burn_float.osl", start: 773374, end: 773591, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_boolean.osl", start: 773591, end: 773742, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal2d_vector2.osl", start: 773742, end: 773996, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal2d_vector3.osl", start: 773996, end: 774247, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_vector2.osl", start: 774247, end: 775162, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise2d_vector2.osl", start: 775162, end: 775328, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise3d_vector3.osl", start: 775328, end: 775492, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_time_float.osl", start: 775492, end: 775670, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_rotate_vector3.osl", start: 775670, end: 776740, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_premult_color4.osl", start: 776740, end: 776842, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_surface_unlit.osl", start: 776842, end: 777256, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise2d_vector4.osl", start: 777256, end: 777461, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal2d_vector4.osl", start: 777461, end: 777715, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise2d_float.osl", start: 777715, end: 777909, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_integer.osl", start: 777909, end: 778060, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_cellnoise3d_float.osl", start: 778060, end: 778162, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_unpremult_color4.osl", start: 778162, end: 778266, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_rotate_vector2.osl", start: 778266, end: 778527, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal3d_vector3.osl", start: 778527, end: 778763, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise3d_vector4.osl", start: 778763, end: 778953, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_dodge_float.osl", start: 778953, end: 779160, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal3d_vector2.osl", start: 779160, end: 779399, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_vector3.osl", start: 779399, end: 779555, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_float.osl", start: 779555, end: 779729, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal2d_float.osl", start: 779729, end: 779975, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_color3.osl", start: 779975, end: 780128, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise3d_vector2.osl", start: 780128, end: 780318, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_dodge_color3.osl", start: 780318, end: 780576, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_rgbtohsv_color3.osl", start: 780576, end: 780681, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_worleynoise2d_float.osl", start: 780681, end: 780841, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise3d_float.osl", start: 780841, end: 781020, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_vector2.osl", start: 781020, end: 781286, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_transformmatrix_vector2M3.osl", start: 781286, end: 781472, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geompropvalue_color4.osl", start: 781472, end: 781840, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise2d_vector3.osl", start: 781840, end: 782039, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_dodge_color4.osl", start: 782039, end: 782386, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_color4.osl", start: 782386, end: 783509, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_burn_color3.osl", start: 783509, end: 783762, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_creatematrix.osl", start: 783762, end: 784667, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geomcolor_color4.osl", start: 784667, end: 784898, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_hsvtorgb_color4.osl", start: 784898, end: 785020, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_float.osl", start: 785020, end: 785883, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_burn_color4.osl", start: 785883, end: 786221, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_heighttonormal_vector3.osl", start: 786221, end: 787195, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_noise2d_vector2.osl", start: 787195, end: 787400, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_vector3.osl", start: 787400, end: 788218, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_rgbtohsv_color4.osl", start: 788218, end: 788340, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_cellnoise2d_float.osl", start: 788340, end: 788457, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geomcolor_color3.osl", start: 788457, end: 788553, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_normalmap.osl", start: 788553, end: 789465, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_disjointover_color4.osl", start: 789465, end: 790043, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_image_vector4.osl", start: 790043, end: 791086, audio: 0 }, { filename: "/libraries/stdlib/genosl/stdlib_genosl_impl.mtlx", start: 791086, end: 868641, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_mix_surfaceshader.osl", start: 868641, end: 868883, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_fractal3d_vector4.osl", start: 868883, end: 869122, audio: 0 }, { filename: "/libraries/stdlib/genosl/mx_geomcolor_float.osl", start: 869122, end: 869217, audio: 0 }, { filename: "/libraries/stdlib/genosl/include/color4.h", start: 869217, end: 875055, audio: 0 }, { filename: "/libraries/stdlib/genosl/include/vector2.h", start: 875055, end: 880721, audio: 0 }, { filename: "/libraries/stdlib/genosl/include/vector4.h", start: 880721, end: 889719, audio: 0 }, { filename: "/libraries/stdlib/genosl/include/mx_funcs.h", start: 889719, end: 911510, audio: 0 }, { filename: "/libraries/stdlib/genosl/include/matrix33.h", start: 911510, end: 914130, audio: 0 }, { filename: "/libraries/stdlib/genosl/lib/mx_transform_uv_vflip.osl", start: 914130, end: 914226, audio: 0 }, { filename: "/libraries/stdlib/genosl/lib/mx_transform_uv.osl", start: 914226, end: 914293, audio: 0 }, { filename: "/libraries/stdlib/genosl/lib/vector4_extra_ops.osl", start: 914293, end: 915167, audio: 0 }, { filename: "/libraries/stdlib/genosl/lib/mx_sampling.osl", start: 915167, end: 920626, audio: 0 }, { filename: "/libraries/stdlib/genmdl/stdlib_genmdl_impl.mtlx", start: 920626, end: 1015485, audio: 0 }, { filename: "/libraries/targets/genmsl.mtlx", start: 1015485, end: 1015955, audio: 0 }, { filename: "/libraries/targets/essl.mtlx", start: 1015955, end: 1016417, audio: 0 }, { filename: "/libraries/targets/genosl.mtlx", start: 1016417, end: 1016869, audio: 0 }, { filename: "/libraries/targets/genglsl.mtlx", start: 1016869, end: 1017322, audio: 0 }, { filename: "/libraries/targets/genmdl.mtlx", start: 1017322, end: 1017774, audio: 0 }, { filename: "/libraries/pbrlib/pbrlib_ng.mtlx", start: 1017774, end: 1018568, audio: 0 }, { filename: "/libraries/pbrlib/pbrlib_defs.mtlx", start: 1018568, end: 1042886, audio: 0 }, { filename: "/libraries/pbrlib/genmsl/pbrlib_genmsl_impl.mtlx", start: 1042886, end: 1043153, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_subsurface_bsdf.glsl", start: 1043153, end: 1044206, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_displacement_vector3.glsl", start: 1044206, end: 1044346, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_anisotropic_vdf.glsl", start: 1044346, end: 1044574, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_generalized_schlick_bsdf.glsl", start: 1044574, end: 1047743, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_multiply_edf_color3.glsl", start: 1047743, end: 1047896, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_displacement_float.glsl", start: 1047896, end: 1048041, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_chiang_hair_bsdf.glsl", start: 1048041, end: 1057049, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/pbrlib_genglsl_impl.mtlx", start: 1057049, end: 1063154, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_multiply_edf_float.glsl", start: 1063154, end: 1063307, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_burley_diffuse_bsdf.glsl", start: 1063307, end: 1064354, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_layer_bsdf.glsl", start: 1064354, end: 1064604, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_translucent_bsdf.glsl", start: 1064604, end: 1065330, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_artistic_ior.glsl", start: 1065330, end: 1065903, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_layer_vdf.glsl", start: 1065903, end: 1066135, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_multiply_bsdf_float.glsl", start: 1066135, end: 1066393, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_uniform_edf.glsl", start: 1066393, end: 1066601, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_conductor_bsdf.glsl", start: 1066601, end: 1068358, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_roughness_dual.glsl", start: 1068358, end: 1068626, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_add_edf.glsl", start: 1068626, end: 1068766, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_multiply_bsdf_color3.glsl", start: 1068766, end: 1069019, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_dielectric_bsdf.glsl", start: 1069019, end: 1071661, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_mix_bsdf.glsl", start: 1071661, end: 1071927, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_roughness_anisotropy.glsl", start: 1071927, end: 1072372, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_blackbody.glsl", start: 1072372, end: 1074108, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_add_bsdf.glsl", start: 1074108, end: 1074690, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_oren_nayar_diffuse_bsdf.glsl", start: 1074690, end: 1076065, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_sheen_bsdf.glsl", start: 1076065, end: 1078151, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_generalized_schlick_edf.glsl", start: 1078151, end: 1078663, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/mx_mix_edf.glsl", start: 1078663, end: 1078829, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_generate_prefilter_env.glsl", start: 1078829, end: 1081502, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_environment_none.glsl", start: 1081502, end: 1081737, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_environment_prefilter.glsl", start: 1081737, end: 1083141, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_generate_albedo_table.glsl", start: 1083141, end: 1083513, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_microfacet.glsl", start: 1083513, end: 1086505, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_microfacet_sheen.glsl", start: 1086505, end: 1093258, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_closure_type.glsl", start: 1093258, end: 1093675, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_transmission_opacity.glsl", start: 1093675, end: 1093846, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl", start: 1093846, end: 1101310, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_environment_fis.glsl", start: 1101310, end: 1104407, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_shadow.glsl", start: 1104407, end: 1105163, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_transmission_refract.glsl", start: 1105163, end: 1105674, audio: 0 }, { filename: "/libraries/pbrlib/genglsl/lib/mx_microfacet_specular.glsl", start: 1105674, end: 1122447, audio: 0 }, { filename: "/libraries/pbrlib/genosl/pbrlib_genosl_impl.mtlx", start: 1122447, end: 1128292, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_subsurface_bsdf.osl", start: 1128292, end: 1128620, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_anisotropic_vdf.osl", start: 1128620, end: 1128991, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_surface.osl", start: 1128991, end: 1129192, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_artistic_ior.osl", start: 1129192, end: 1129784, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_dielectric_bsdf.osl", start: 1129784, end: 1130334, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_chiang_hair_roughness.osl", start: 1130334, end: 1130691, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_roughness_dual.osl", start: 1130691, end: 1130987, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_chiang_hair_bsdf.osl", start: 1130987, end: 1131679, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_blackbody.osl", start: 1131679, end: 1133451, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_generalized_schlick_edf.osl", start: 1133451, end: 1133721, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_generalized_schlick_bsdf.osl", start: 1133721, end: 1134360, audio: 0 }, { filename: "/libraries/pbrlib/genosl/mx_roughness_anisotropy.osl", start: 1134360, end: 1134811, audio: 0 }, { filename: "/libraries/pbrlib/genosl/lib/mx_microfacet.osl", start: 1134811, end: 1136543, audio: 0 }, { filename: "/libraries/pbrlib/genmdl/pbrlib_genmdl_impl.mtlx", start: 1136543, end: 1147928, audio: 0 }, { filename: "/libraries/bxdf/disney_principled.mtlx", start: 1147928, end: 1155236, audio: 0 }, { filename: "/libraries/bxdf/usd_preview_surface.mtlx", start: 1155236, end: 1178228, audio: 0 }, { filename: "/libraries/bxdf/gltf_pbr.mtlx", start: 1178228, end: 1223121, audio: 0 }, { filename: "/libraries/bxdf/standard_surface.mtlx", start: 1223121, end: 1251204, audio: 0 }, { filename: "/libraries/bxdf/open_pbr_surface.mtlx", start: 1251204, end: 1293074, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_dielectric.mtlx", start: 1293074, end: 1303993, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_diffuse.mtlx", start: 1303993, end: 1306939, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_conductor.mtlx", start: 1306939, end: 1314939, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_iridescence.mtlx", start: 1314939, end: 1320902, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_translucent.mtlx", start: 1320902, end: 1322539, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_sss.mtlx", start: 1322539, end: 1329314, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_surface.mtlx", start: 1329314, end: 1330982, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_sheen.mtlx", start: 1330982, end: 1333105, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_add.mtlx", start: 1333105, end: 1335759, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_layer.mtlx", start: 1335759, end: 1337503, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_generalized_schlick.mtlx", start: 1337503, end: 1349357, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_emission.mtlx", start: 1349357, end: 1350106, audio: 0 }, { filename: "/libraries/bxdf/lama/lama_mix.mtlx", start: 1350106, end: 1352193, audio: 0 }, { filename: "/libraries/bxdf/translation/standard_surface_to_usd.mtlx", start: 1352193, end: 1358074, audio: 0 }, { filename: "/libraries/bxdf/translation/standard_surface_to_gltf_pbr.mtlx", start: 1358074, end: 1365969, audio: 0 }, { filename: "/libraries/bxdf/translation/standard_surface_to_open_pbr.mtlx", start: 1365969, end: 1381078, audio: 0 }, { filename: "/libraries/bxdf/translation/open_pbr_to_standard_surface.mtlx", start: 1381078, end: 1398545, audio: 0 }, { filename: "/libraries/cmlib/cmlib_defs.mtlx", start: 1398545, end: 1403391, audio: 0 }, { filename: "/libraries/cmlib/cmlib_ng.mtlx", start: 1403391, end: 1420866, audio: 0 }, { filename: "/libraries/nprlib/nprlib_ng.mtlx", start: 1420866, end: 1425715, audio: 0 }, { filename: "/libraries/nprlib/nprlib_defs.mtlx", start: 1425715, end: 1428350, audio: 0 }, { filename: "/libraries/nprlib/genmsl/nprlib_genmsl_impl.mtlx", start: 1428350, end: 1429011, audio: 0 }, { filename: "/libraries/nprlib/genglsl/nprlib_genglsl_impl.mtlx", start: 1429011, end: 1429675, audio: 0 }, { filename: "/libraries/nprlib/genosl/nprlib_genosl_impl.mtlx", start: 1429675, end: 1430373, audio: 0 }, { filename: "/libraries/nprlib/genmdl/nprlib_genmdl_impl.mtlx", start: 1430373, end: 1431135, audio: 0 }], remote_package_size: 1431135 });
|
|
81
|
+
})();
|
|
82
|
+
var M = {}, F;
|
|
83
|
+
for (F in E)
|
|
84
|
+
E.hasOwnProperty(F) && (M[F] = E[F]);
|
|
85
|
+
var x = "./this.program", U = !1, s = !1, m = !1, AA = !1;
|
|
86
|
+
U = typeof window == "object", s = typeof importScripts == "function", m = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", AA = !U && !m && !s;
|
|
87
|
+
var O = "";
|
|
88
|
+
function IA(A) {
|
|
89
|
+
return E.locateFile ? E.locateFile(A, O) : O + A;
|
|
90
|
+
}
|
|
91
|
+
var v, hA, UA, jA, rA;
|
|
92
|
+
m ? (s ? O = require("path").dirname(O) + "/" : O = __dirname + "/", v = function(I, g) {
|
|
93
|
+
return jA || (jA = require("fs")), rA || (rA = require("path")), I = rA.normalize(I), jA.readFileSync(I, g ? null : "utf8");
|
|
94
|
+
}, UA = function(I) {
|
|
95
|
+
var g = v(I, !0);
|
|
96
|
+
return g.buffer || (g = new Uint8Array(g)), eI(g.buffer), g;
|
|
97
|
+
}, process.argv.length > 1 && (x = process.argv[1].replace(/\\/g, "/")), process.argv.slice(2), process.on("uncaughtException", function(A) {
|
|
98
|
+
if (!(A instanceof mE))
|
|
99
|
+
throw A;
|
|
100
|
+
}), process.on("unhandledRejection", CA), E.inspect = function() {
|
|
101
|
+
return "[Emscripten Module object]";
|
|
102
|
+
}) : AA ? (typeof read < "u" && (v = function(I) {
|
|
103
|
+
return read(I);
|
|
104
|
+
}), UA = function(I) {
|
|
105
|
+
var g;
|
|
106
|
+
return typeof readbuffer == "function" ? new Uint8Array(readbuffer(I)) : (g = read(I, "binary"), eI(typeof g == "object"), g);
|
|
107
|
+
}, typeof scriptArgs < "u" && scriptArgs, typeof print < "u" && (typeof console > "u" && (console = {}), console.log = print, console.warn = console.error = typeof printErr < "u" ? printErr : print)) : (U || s) && (s ? O = self.location.href : typeof document < "u" && document.currentScript && (O = document.currentScript.src), l && (O = l), O.indexOf("blob:") !== 0 ? O = O.substr(0, O.lastIndexOf("/") + 1) : O = "", v = function(A) {
|
|
108
|
+
var I = new XMLHttpRequest();
|
|
109
|
+
return I.open("GET", A, !1), I.send(null), I.responseText;
|
|
110
|
+
}, s && (UA = function(A) {
|
|
111
|
+
var I = new XMLHttpRequest();
|
|
112
|
+
return I.open("GET", A, !1), I.responseType = "arraybuffer", I.send(null), new Uint8Array(I.response);
|
|
113
|
+
}), hA = function(A, I, g) {
|
|
114
|
+
var B = new XMLHttpRequest();
|
|
115
|
+
B.open("GET", A, !0), B.responseType = "arraybuffer", B.onload = function() {
|
|
116
|
+
if (B.status == 200 || B.status == 0 && B.response) {
|
|
117
|
+
I(B.response);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
g();
|
|
121
|
+
}, B.onerror = g, B.send(null);
|
|
122
|
+
});
|
|
123
|
+
var uA = E.print || console.log.bind(console), DA = E.printErr || console.warn.bind(console);
|
|
124
|
+
for (F in M)
|
|
125
|
+
M.hasOwnProperty(F) && (E[F] = M[F]);
|
|
126
|
+
M = null, E.arguments && E.arguments, E.thisProgram && (x = E.thisProgram), E.quit && E.quit;
|
|
127
|
+
function UB(A, I) {
|
|
128
|
+
return Math.ceil(A / I) * I;
|
|
129
|
+
}
|
|
130
|
+
var lg = 0, ZA = function(A) {
|
|
131
|
+
lg = A;
|
|
132
|
+
}, cB = function() {
|
|
133
|
+
return lg;
|
|
134
|
+
}, _A;
|
|
135
|
+
E.wasmBinary && (_A = E.wasmBinary), E.noExitRuntime, typeof WebAssembly != "object" && CA("no native wasm support detected");
|
|
136
|
+
var oI, Sg = !1;
|
|
137
|
+
function eI(A, I) {
|
|
138
|
+
A || CA("Assertion failed: " + I);
|
|
139
|
+
}
|
|
140
|
+
var Jg = typeof TextDecoder < "u" ? new TextDecoder("utf8") : void 0;
|
|
141
|
+
function qA(A, I, g) {
|
|
142
|
+
for (var B = I + g, Q = I; A[Q] && !(Q >= B); ) ++Q;
|
|
143
|
+
if (Q - I > 16 && A.subarray && Jg)
|
|
144
|
+
return Jg.decode(A.subarray(I, Q));
|
|
145
|
+
for (var G = ""; I < Q; ) {
|
|
146
|
+
var i = A[I++];
|
|
147
|
+
if (!(i & 128)) {
|
|
148
|
+
G += String.fromCharCode(i);
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
var D = A[I++] & 63;
|
|
152
|
+
if ((i & 224) == 192) {
|
|
153
|
+
G += String.fromCharCode((i & 31) << 6 | D);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
var h = A[I++] & 63;
|
|
157
|
+
if ((i & 240) == 224 ? i = (i & 15) << 12 | D << 6 | h : i = (i & 7) << 18 | D << 12 | h << 6 | A[I++] & 63, i < 65536)
|
|
158
|
+
G += String.fromCharCode(i);
|
|
159
|
+
else {
|
|
160
|
+
var o = i - 65536;
|
|
161
|
+
G += String.fromCharCode(55296 | o >> 10, 56320 | o & 1023);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return G;
|
|
165
|
+
}
|
|
166
|
+
function VA(A, I) {
|
|
167
|
+
return A ? qA(oA, A, I) : "";
|
|
168
|
+
}
|
|
169
|
+
function rI(A, I, g, B) {
|
|
170
|
+
if (!(B > 0)) return 0;
|
|
171
|
+
for (var Q = g, G = g + B - 1, i = 0; i < A.length; ++i) {
|
|
172
|
+
var D = A.charCodeAt(i);
|
|
173
|
+
if (D >= 55296 && D <= 57343) {
|
|
174
|
+
var h = A.charCodeAt(++i);
|
|
175
|
+
D = 65536 + ((D & 1023) << 10) | h & 1023;
|
|
176
|
+
}
|
|
177
|
+
if (D <= 127) {
|
|
178
|
+
if (g >= G) break;
|
|
179
|
+
I[g++] = D;
|
|
180
|
+
} else if (D <= 2047) {
|
|
181
|
+
if (g + 1 >= G) break;
|
|
182
|
+
I[g++] = 192 | D >> 6, I[g++] = 128 | D & 63;
|
|
183
|
+
} else if (D <= 65535) {
|
|
184
|
+
if (g + 2 >= G) break;
|
|
185
|
+
I[g++] = 224 | D >> 12, I[g++] = 128 | D >> 6 & 63, I[g++] = 128 | D & 63;
|
|
186
|
+
} else {
|
|
187
|
+
if (g + 3 >= G) break;
|
|
188
|
+
I[g++] = 240 | D >> 18, I[g++] = 128 | D >> 12 & 63, I[g++] = 128 | D >> 6 & 63, I[g++] = 128 | D & 63;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return I[g] = 0, g - Q;
|
|
192
|
+
}
|
|
193
|
+
function _I(A, I, g) {
|
|
194
|
+
return rI(A, oA, I, g);
|
|
195
|
+
}
|
|
196
|
+
function YI(A) {
|
|
197
|
+
for (var I = 0, g = 0; g < A.length; ++g) {
|
|
198
|
+
var B = A.charCodeAt(g);
|
|
199
|
+
B >= 55296 && B <= 57343 && (B = 65536 + ((B & 1023) << 10) | A.charCodeAt(++g) & 1023), B <= 127 ? ++I : B <= 2047 ? I += 2 : B <= 65535 ? I += 3 : I += 4;
|
|
200
|
+
}
|
|
201
|
+
return I;
|
|
202
|
+
}
|
|
203
|
+
var Mg = typeof TextDecoder < "u" ? new TextDecoder("utf-16le") : void 0;
|
|
204
|
+
function yB(A, I) {
|
|
205
|
+
for (var g = A, B = g >> 1, Q = B + I / 2; !(B >= Q) && $A[B]; ) ++B;
|
|
206
|
+
if (g = B << 1, g - A > 32 && Mg)
|
|
207
|
+
return Mg.decode(oA.subarray(A, g));
|
|
208
|
+
for (var G = "", i = 0; !(i >= I / 2); ++i) {
|
|
209
|
+
var D = cA[A + i * 2 >> 1];
|
|
210
|
+
if (D == 0) break;
|
|
211
|
+
G += String.fromCharCode(D);
|
|
212
|
+
}
|
|
213
|
+
return G;
|
|
214
|
+
}
|
|
215
|
+
function WB(A, I, g) {
|
|
216
|
+
if (g === void 0 && (g = 2147483647), g < 2) return 0;
|
|
217
|
+
g -= 2;
|
|
218
|
+
for (var B = I, Q = g < A.length * 2 ? g / 2 : A.length, G = 0; G < Q; ++G) {
|
|
219
|
+
var i = A.charCodeAt(G);
|
|
220
|
+
cA[I >> 1] = i, I += 2;
|
|
221
|
+
}
|
|
222
|
+
return cA[I >> 1] = 0, I - B;
|
|
223
|
+
}
|
|
224
|
+
function dB(A) {
|
|
225
|
+
return A.length * 2;
|
|
226
|
+
}
|
|
227
|
+
function HB(A, I) {
|
|
228
|
+
for (var g = 0, B = ""; !(g >= I / 4); ) {
|
|
229
|
+
var Q = S[A + g * 4 >> 2];
|
|
230
|
+
if (Q == 0) break;
|
|
231
|
+
if (++g, Q >= 65536) {
|
|
232
|
+
var G = Q - 65536;
|
|
233
|
+
B += String.fromCharCode(55296 | G >> 10, 56320 | G & 1023);
|
|
234
|
+
} else
|
|
235
|
+
B += String.fromCharCode(Q);
|
|
236
|
+
}
|
|
237
|
+
return B;
|
|
238
|
+
}
|
|
239
|
+
function sB(A, I, g) {
|
|
240
|
+
if (g === void 0 && (g = 2147483647), g < 4) return 0;
|
|
241
|
+
for (var B = I, Q = B + g - 4, G = 0; G < A.length; ++G) {
|
|
242
|
+
var i = A.charCodeAt(G);
|
|
243
|
+
if (i >= 55296 && i <= 57343) {
|
|
244
|
+
var D = A.charCodeAt(++G);
|
|
245
|
+
i = 65536 + ((i & 1023) << 10) | D & 1023;
|
|
246
|
+
}
|
|
247
|
+
if (S[I >> 2] = i, I += 4, I + 4 > Q) break;
|
|
248
|
+
}
|
|
249
|
+
return S[I >> 2] = 0, I - B;
|
|
250
|
+
}
|
|
251
|
+
function mB(A) {
|
|
252
|
+
for (var I = 0, g = 0; g < A.length; ++g) {
|
|
253
|
+
var B = A.charCodeAt(g);
|
|
254
|
+
B >= 55296 && B <= 57343 && ++g, I += 4;
|
|
255
|
+
}
|
|
256
|
+
return I;
|
|
257
|
+
}
|
|
258
|
+
function KB(A, I) {
|
|
259
|
+
GA.set(A, I);
|
|
260
|
+
}
|
|
261
|
+
function XB(A, I, g) {
|
|
262
|
+
for (var B = 0; B < A.length; ++B)
|
|
263
|
+
GA[I++ >> 0] = A.charCodeAt(B);
|
|
264
|
+
GA[I >> 0] = 0;
|
|
265
|
+
}
|
|
266
|
+
function VB(A, I) {
|
|
267
|
+
return A % I > 0 && (A += I - A % I), A;
|
|
268
|
+
}
|
|
269
|
+
var wI, GA, oA, cA, $A, S, lA, Ug, $I;
|
|
270
|
+
function cg(A) {
|
|
271
|
+
wI = A, E.HEAP8 = GA = new Int8Array(A), E.HEAP16 = cA = new Int16Array(A), E.HEAP32 = S = new Int32Array(A), E.HEAPU8 = oA = new Uint8Array(A), E.HEAPU16 = $A = new Uint16Array(A), E.HEAPU32 = lA = new Uint32Array(A), E.HEAPF32 = Ug = new Float32Array(A), E.HEAPF64 = $I = new Float64Array(A);
|
|
272
|
+
}
|
|
273
|
+
E.INITIAL_MEMORY;
|
|
274
|
+
var T, yg = [], Wg = [], dg = [];
|
|
275
|
+
function PB() {
|
|
276
|
+
if (E.preRun)
|
|
277
|
+
for (typeof E.preRun == "function" && (E.preRun = [E.preRun]); E.preRun.length; )
|
|
278
|
+
LB(E.preRun.shift());
|
|
279
|
+
Ig(yg);
|
|
280
|
+
}
|
|
281
|
+
function TB() {
|
|
282
|
+
!E.noFSInit && !C.init.initialized && C.init(), Ig(Wg);
|
|
283
|
+
}
|
|
284
|
+
function pB() {
|
|
285
|
+
if (E.postRun)
|
|
286
|
+
for (typeof E.postRun == "function" && (E.postRun = [E.postRun]); E.postRun.length; )
|
|
287
|
+
jB(E.postRun.shift());
|
|
288
|
+
Ig(dg);
|
|
289
|
+
}
|
|
290
|
+
function LB(A) {
|
|
291
|
+
yg.unshift(A);
|
|
292
|
+
}
|
|
293
|
+
function xB(A) {
|
|
294
|
+
Wg.unshift(A);
|
|
295
|
+
}
|
|
296
|
+
function jB(A) {
|
|
297
|
+
dg.unshift(A);
|
|
298
|
+
}
|
|
299
|
+
var PA = 0, AI = null;
|
|
300
|
+
function Ag(A) {
|
|
301
|
+
PA++, E.monitorRunDependencies && E.monitorRunDependencies(PA);
|
|
302
|
+
}
|
|
303
|
+
function kI(A) {
|
|
304
|
+
if (PA--, E.monitorRunDependencies && E.monitorRunDependencies(PA), PA == 0 && AI) {
|
|
305
|
+
var I = AI;
|
|
306
|
+
AI = null, I();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
E.preloadedImages = {}, E.preloadedAudios = {};
|
|
310
|
+
function CA(A) {
|
|
311
|
+
E.onAbort && E.onAbort(A), A += "", DA(A), Sg = !0, A = "abort(" + A + "). Build with -s ASSERTIONS=1 for more info.";
|
|
312
|
+
var I = new WebAssembly.RuntimeError(A);
|
|
313
|
+
throw H(I), I;
|
|
314
|
+
}
|
|
315
|
+
var uB = "data:application/octet-stream;base64,";
|
|
316
|
+
function Hg(A) {
|
|
317
|
+
return A.startsWith(uB);
|
|
318
|
+
}
|
|
319
|
+
function sg(A) {
|
|
320
|
+
return A.startsWith("file://");
|
|
321
|
+
}
|
|
322
|
+
var NA = "JsMaterialXGenShader.wasm";
|
|
323
|
+
Hg(NA) || (NA = IA(NA));
|
|
324
|
+
function mg(A) {
|
|
325
|
+
try {
|
|
326
|
+
if (A == NA && _A)
|
|
327
|
+
return new Uint8Array(_A);
|
|
328
|
+
if (UA)
|
|
329
|
+
return UA(A);
|
|
330
|
+
throw "both async and sync fetching of the wasm failed";
|
|
331
|
+
} catch (I) {
|
|
332
|
+
CA(I);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function qB() {
|
|
336
|
+
if (!_A && (U || s)) {
|
|
337
|
+
if (typeof fetch == "function" && !sg(NA))
|
|
338
|
+
return fetch(NA, { credentials: "same-origin" }).then(function(A) {
|
|
339
|
+
if (!A.ok)
|
|
340
|
+
throw "failed to load wasm binary file at '" + NA + "'";
|
|
341
|
+
return A.arrayBuffer();
|
|
342
|
+
}).catch(function() {
|
|
343
|
+
return mg(NA);
|
|
344
|
+
});
|
|
345
|
+
if (hA)
|
|
346
|
+
return new Promise(function(A, I) {
|
|
347
|
+
hA(NA, function(g) {
|
|
348
|
+
A(new Uint8Array(g));
|
|
349
|
+
}, I);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
return Promise.resolve().then(function() {
|
|
353
|
+
return mg(NA);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
function vB() {
|
|
357
|
+
var A = { a: eC };
|
|
358
|
+
function I(i, D) {
|
|
359
|
+
var h = i.exports;
|
|
360
|
+
E.asm = h, oI = E.asm.Xa, cg(oI.buffer), T = E.asm._a, xB(E.asm.Ya), kI();
|
|
361
|
+
}
|
|
362
|
+
Ag();
|
|
363
|
+
function g(i) {
|
|
364
|
+
I(i.instance);
|
|
365
|
+
}
|
|
366
|
+
function B(i) {
|
|
367
|
+
return qB().then(function(D) {
|
|
368
|
+
var h = WebAssembly.instantiate(D, A);
|
|
369
|
+
return h;
|
|
370
|
+
}).then(i, function(D) {
|
|
371
|
+
DA("failed to asynchronously prepare wasm: " + D), CA(D);
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
function Q() {
|
|
375
|
+
return !_A && typeof WebAssembly.instantiateStreaming == "function" && !Hg(NA) && !sg(NA) && typeof fetch == "function" ? fetch(NA, { credentials: "same-origin" }).then(function(i) {
|
|
376
|
+
var D = WebAssembly.instantiateStreaming(i, A);
|
|
377
|
+
return D.then(g, function(h) {
|
|
378
|
+
return DA("wasm streaming compile failed: " + h), DA("falling back to ArrayBuffer instantiation"), B(g);
|
|
379
|
+
});
|
|
380
|
+
}) : B(g);
|
|
381
|
+
}
|
|
382
|
+
if (E.instantiateWasm)
|
|
383
|
+
try {
|
|
384
|
+
var G = E.instantiateWasm(A, I);
|
|
385
|
+
return G;
|
|
386
|
+
} catch (i) {
|
|
387
|
+
return DA("Module.instantiateWasm callback failed with error: " + i), !1;
|
|
388
|
+
}
|
|
389
|
+
return Q().catch(H), {};
|
|
390
|
+
}
|
|
391
|
+
var _, wA, tB = { 218952: function() {
|
|
392
|
+
E.TreeIterator.prototype[Symbol.iterator] = function() {
|
|
393
|
+
return this;
|
|
394
|
+
};
|
|
395
|
+
}, 219036: function() {
|
|
396
|
+
E.GraphIterator.prototype[Symbol.iterator] = function() {
|
|
397
|
+
return this;
|
|
398
|
+
};
|
|
399
|
+
}, 219121: function() {
|
|
400
|
+
E.InheritanceIterator.prototype[Symbol.iterator] = function() {
|
|
401
|
+
return this;
|
|
402
|
+
};
|
|
403
|
+
} };
|
|
404
|
+
function Ig(A) {
|
|
405
|
+
for (; A.length > 0; ) {
|
|
406
|
+
var I = A.shift();
|
|
407
|
+
if (typeof I == "function") {
|
|
408
|
+
I(E);
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
var g = I.func;
|
|
412
|
+
typeof g == "number" ? I.arg === void 0 ? T.get(g)() : T.get(g)(I.arg) : g(I.arg === void 0 ? null : I.arg);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function nB(A, I, g, B) {
|
|
416
|
+
CA("Assertion failed: " + VA(A) + ", at: " + [I ? VA(I) : "unknown filename", g, B ? VA(B) : "unknown function"]);
|
|
417
|
+
}
|
|
418
|
+
var YA = { DESTRUCTOR_OFFSET: 0, REFCOUNT_OFFSET: 4, TYPE_OFFSET: 8, CAUGHT_OFFSET: 12, RETHROWN_OFFSET: 13, SIZE: 16 };
|
|
419
|
+
function zB(A) {
|
|
420
|
+
return OA(A + YA.SIZE) + YA.SIZE;
|
|
421
|
+
}
|
|
422
|
+
function vA(A) {
|
|
423
|
+
this.excPtr = A, this.ptr = A - YA.SIZE, this.set_type = function(I) {
|
|
424
|
+
S[this.ptr + YA.TYPE_OFFSET >> 2] = I;
|
|
425
|
+
}, this.get_type = function() {
|
|
426
|
+
return S[this.ptr + YA.TYPE_OFFSET >> 2];
|
|
427
|
+
}, this.set_destructor = function(I) {
|
|
428
|
+
S[this.ptr + YA.DESTRUCTOR_OFFSET >> 2] = I;
|
|
429
|
+
}, this.get_destructor = function() {
|
|
430
|
+
return S[this.ptr + YA.DESTRUCTOR_OFFSET >> 2];
|
|
431
|
+
}, this.set_refcount = function(I) {
|
|
432
|
+
S[this.ptr + YA.REFCOUNT_OFFSET >> 2] = I;
|
|
433
|
+
}, this.set_caught = function(I) {
|
|
434
|
+
I = I ? 1 : 0, GA[this.ptr + YA.CAUGHT_OFFSET >> 0] = I;
|
|
435
|
+
}, this.get_caught = function() {
|
|
436
|
+
return GA[this.ptr + YA.CAUGHT_OFFSET >> 0] != 0;
|
|
437
|
+
}, this.set_rethrown = function(I) {
|
|
438
|
+
I = I ? 1 : 0, GA[this.ptr + YA.RETHROWN_OFFSET >> 0] = I;
|
|
439
|
+
}, this.get_rethrown = function() {
|
|
440
|
+
return GA[this.ptr + YA.RETHROWN_OFFSET >> 0] != 0;
|
|
441
|
+
}, this.init = function(I, g) {
|
|
442
|
+
this.set_type(I), this.set_destructor(g), this.set_refcount(0), this.set_caught(!1), this.set_rethrown(!1);
|
|
443
|
+
}, this.add_ref = function() {
|
|
444
|
+
var I = S[this.ptr + YA.REFCOUNT_OFFSET >> 2];
|
|
445
|
+
S[this.ptr + YA.REFCOUNT_OFFSET >> 2] = I + 1;
|
|
446
|
+
}, this.release_ref = function() {
|
|
447
|
+
var I = S[this.ptr + YA.REFCOUNT_OFFSET >> 2];
|
|
448
|
+
return S[this.ptr + YA.REFCOUNT_OFFSET >> 2] = I - 1, I === 1;
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
function II(A) {
|
|
452
|
+
this.free = function() {
|
|
453
|
+
bA(this.ptr), this.ptr = 0;
|
|
454
|
+
}, this.set_base_ptr = function(I) {
|
|
455
|
+
S[this.ptr >> 2] = I;
|
|
456
|
+
}, this.get_base_ptr = function() {
|
|
457
|
+
return S[this.ptr >> 2];
|
|
458
|
+
}, this.set_adjusted_ptr = function(I) {
|
|
459
|
+
var g = 4;
|
|
460
|
+
S[this.ptr + g >> 2] = I;
|
|
461
|
+
}, this.get_adjusted_ptr = function() {
|
|
462
|
+
var I = 4;
|
|
463
|
+
return S[this.ptr + I >> 2];
|
|
464
|
+
}, this.get_exception_ptr = function() {
|
|
465
|
+
var I = rg(this.get_exception_info().get_type());
|
|
466
|
+
if (I)
|
|
467
|
+
return S[this.get_base_ptr() >> 2];
|
|
468
|
+
var g = this.get_adjusted_ptr();
|
|
469
|
+
return g !== 0 ? g : this.get_base_ptr();
|
|
470
|
+
}, this.get_exception_info = function() {
|
|
471
|
+
return new vA(this.get_base_ptr());
|
|
472
|
+
}, A === void 0 ? (this.ptr = OA(8), this.set_adjusted_ptr(0)) : this.ptr = A;
|
|
473
|
+
}
|
|
474
|
+
var aI = [];
|
|
475
|
+
function fB(A) {
|
|
476
|
+
A.add_ref();
|
|
477
|
+
}
|
|
478
|
+
var ZI = 0;
|
|
479
|
+
function OB(A) {
|
|
480
|
+
var I = new II(A), g = I.get_exception_info();
|
|
481
|
+
return g.get_caught() || (g.set_caught(!0), ZI--), g.set_rethrown(!1), aI.push(I), fB(g), I.get_exception_ptr();
|
|
482
|
+
}
|
|
483
|
+
var HA = 0;
|
|
484
|
+
function Kg(A) {
|
|
485
|
+
return bA(new vA(A).ptr);
|
|
486
|
+
}
|
|
487
|
+
function eB(A) {
|
|
488
|
+
if (A.release_ref() && !A.get_rethrown()) {
|
|
489
|
+
var I = A.get_destructor();
|
|
490
|
+
I && T.get(I)(A.excPtr), Kg(A.excPtr);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
function rB() {
|
|
494
|
+
n(0);
|
|
495
|
+
var A = aI.pop();
|
|
496
|
+
eB(A.get_exception_info()), A.free(), HA = 0;
|
|
497
|
+
}
|
|
498
|
+
function _B(A) {
|
|
499
|
+
var I = new II(A), g = I.get_base_ptr();
|
|
500
|
+
throw HA || (HA = g), I.free(), g;
|
|
501
|
+
}
|
|
502
|
+
function $B() {
|
|
503
|
+
var A = HA;
|
|
504
|
+
if (!A)
|
|
505
|
+
return ZA(0), 0;
|
|
506
|
+
var I = new vA(A), g = I.get_type(), B = new II();
|
|
507
|
+
if (B.set_base_ptr(A), !g)
|
|
508
|
+
return ZA(0), B.ptr | 0;
|
|
509
|
+
var Q = Array.prototype.slice.call(arguments), G = j(), i = XI(4);
|
|
510
|
+
S[i >> 2] = A;
|
|
511
|
+
for (var D = 0; D < Q.length; D++) {
|
|
512
|
+
var h = Q[D];
|
|
513
|
+
if (h === 0 || h === g)
|
|
514
|
+
break;
|
|
515
|
+
if (VI(h, g, i)) {
|
|
516
|
+
var o = S[i >> 2];
|
|
517
|
+
return A !== o && B.set_adjusted_ptr(o), ZA(h), B.ptr | 0;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return u(G), ZA(g), B.ptr | 0;
|
|
521
|
+
}
|
|
522
|
+
function AQ() {
|
|
523
|
+
var A = HA;
|
|
524
|
+
if (!A)
|
|
525
|
+
return ZA(0), 0;
|
|
526
|
+
var I = new vA(A), g = I.get_type(), B = new II();
|
|
527
|
+
if (B.set_base_ptr(A), !g)
|
|
528
|
+
return ZA(0), B.ptr | 0;
|
|
529
|
+
var Q = Array.prototype.slice.call(arguments), G = j(), i = XI(4);
|
|
530
|
+
S[i >> 2] = A;
|
|
531
|
+
for (var D = 0; D < Q.length; D++) {
|
|
532
|
+
var h = Q[D];
|
|
533
|
+
if (h === 0 || h === g)
|
|
534
|
+
break;
|
|
535
|
+
if (VI(h, g, i)) {
|
|
536
|
+
var o = S[i >> 2];
|
|
537
|
+
return A !== o && B.set_adjusted_ptr(o), ZA(h), B.ptr | 0;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return u(G), ZA(g), B.ptr | 0;
|
|
541
|
+
}
|
|
542
|
+
function IQ() {
|
|
543
|
+
var A = HA;
|
|
544
|
+
if (!A)
|
|
545
|
+
return ZA(0), 0;
|
|
546
|
+
var I = new vA(A), g = I.get_type(), B = new II();
|
|
547
|
+
if (B.set_base_ptr(A), !g)
|
|
548
|
+
return ZA(0), B.ptr | 0;
|
|
549
|
+
var Q = Array.prototype.slice.call(arguments), G = j(), i = XI(4);
|
|
550
|
+
S[i >> 2] = A;
|
|
551
|
+
for (var D = 0; D < Q.length; D++) {
|
|
552
|
+
var h = Q[D];
|
|
553
|
+
if (h === 0 || h === g)
|
|
554
|
+
break;
|
|
555
|
+
if (VI(h, g, i)) {
|
|
556
|
+
var o = S[i >> 2];
|
|
557
|
+
return A !== o && B.set_adjusted_ptr(o), ZA(h), B.ptr | 0;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return u(G), ZA(g), B.ptr | 0;
|
|
561
|
+
}
|
|
562
|
+
function gQ() {
|
|
563
|
+
var A = aI.pop();
|
|
564
|
+
A || CA("no exception to throw");
|
|
565
|
+
var I = A.get_exception_info(), g = A.get_base_ptr();
|
|
566
|
+
throw I.get_rethrown() ? A.free() : (aI.push(A), I.set_rethrown(!0), I.set_caught(!1), ZI++), HA = g, g;
|
|
567
|
+
}
|
|
568
|
+
function BQ(A, I, g) {
|
|
569
|
+
var B = new vA(A);
|
|
570
|
+
throw B.init(I, g), HA = A, ZI++, A;
|
|
571
|
+
}
|
|
572
|
+
function QQ() {
|
|
573
|
+
return ZI;
|
|
574
|
+
}
|
|
575
|
+
function CQ(A) {
|
|
576
|
+
return S[Og() >> 2] = A, A;
|
|
577
|
+
}
|
|
578
|
+
var r = { splitPath: function(A) {
|
|
579
|
+
var I = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
580
|
+
return I.exec(A).slice(1);
|
|
581
|
+
}, normalizeArray: function(A, I) {
|
|
582
|
+
for (var g = 0, B = A.length - 1; B >= 0; B--) {
|
|
583
|
+
var Q = A[B];
|
|
584
|
+
Q === "." ? A.splice(B, 1) : Q === ".." ? (A.splice(B, 1), g++) : g && (A.splice(B, 1), g--);
|
|
585
|
+
}
|
|
586
|
+
if (I)
|
|
587
|
+
for (; g; g--)
|
|
588
|
+
A.unshift("..");
|
|
589
|
+
return A;
|
|
590
|
+
}, normalize: function(A) {
|
|
591
|
+
var I = A.charAt(0) === "/", g = A.substr(-1) === "/";
|
|
592
|
+
return A = r.normalizeArray(A.split("/").filter(function(B) {
|
|
593
|
+
return !!B;
|
|
594
|
+
}), !I).join("/"), !A && !I && (A = "."), A && g && (A += "/"), (I ? "/" : "") + A;
|
|
595
|
+
}, dirname: function(A) {
|
|
596
|
+
var I = r.splitPath(A), g = I[0], B = I[1];
|
|
597
|
+
return !g && !B ? "." : (B && (B = B.substr(0, B.length - 1)), g + B);
|
|
598
|
+
}, basename: function(A) {
|
|
599
|
+
if (A === "/") return "/";
|
|
600
|
+
A = r.normalize(A), A = A.replace(/\/$/, "");
|
|
601
|
+
var I = A.lastIndexOf("/");
|
|
602
|
+
return I === -1 ? A : A.substr(I + 1);
|
|
603
|
+
}, extname: function(A) {
|
|
604
|
+
return r.splitPath(A)[3];
|
|
605
|
+
}, join: function() {
|
|
606
|
+
var A = Array.prototype.slice.call(arguments, 0);
|
|
607
|
+
return r.normalize(A.join("/"));
|
|
608
|
+
}, join2: function(A, I) {
|
|
609
|
+
return r.normalize(A + "/" + I);
|
|
610
|
+
} };
|
|
611
|
+
function EQ() {
|
|
612
|
+
if (typeof crypto == "object" && typeof crypto.getRandomValues == "function") {
|
|
613
|
+
var A = new Uint8Array(1);
|
|
614
|
+
return function() {
|
|
615
|
+
return crypto.getRandomValues(A), A[0];
|
|
616
|
+
};
|
|
617
|
+
} else if (m)
|
|
618
|
+
try {
|
|
619
|
+
var I = require("crypto");
|
|
620
|
+
return function() {
|
|
621
|
+
return I.randomBytes(1)[0];
|
|
622
|
+
};
|
|
623
|
+
} catch {
|
|
624
|
+
}
|
|
625
|
+
return function() {
|
|
626
|
+
CA("randomDevice");
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
var yA = { resolve: function() {
|
|
630
|
+
for (var A = "", I = !1, g = arguments.length - 1; g >= -1 && !I; g--) {
|
|
631
|
+
var B = g >= 0 ? arguments[g] : C.cwd();
|
|
632
|
+
if (typeof B != "string")
|
|
633
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
634
|
+
if (!B)
|
|
635
|
+
return "";
|
|
636
|
+
A = B + "/" + A, I = B.charAt(0) === "/";
|
|
637
|
+
}
|
|
638
|
+
return A = r.normalizeArray(A.split("/").filter(function(Q) {
|
|
639
|
+
return !!Q;
|
|
640
|
+
}), !I).join("/"), (I ? "/" : "") + A || ".";
|
|
641
|
+
}, relative: function(A, I) {
|
|
642
|
+
A = yA.resolve(A).substr(1), I = yA.resolve(I).substr(1);
|
|
643
|
+
function g(o) {
|
|
644
|
+
for (var Y = 0; Y < o.length && o[Y] === ""; Y++)
|
|
645
|
+
;
|
|
646
|
+
for (var a = o.length - 1; a >= 0 && o[a] === ""; a--)
|
|
647
|
+
;
|
|
648
|
+
return Y > a ? [] : o.slice(Y, a - Y + 1);
|
|
649
|
+
}
|
|
650
|
+
for (var B = g(A.split("/")), Q = g(I.split("/")), G = Math.min(B.length, Q.length), i = G, D = 0; D < G; D++)
|
|
651
|
+
if (B[D] !== Q[D]) {
|
|
652
|
+
i = D;
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
for (var h = [], D = i; D < B.length; D++)
|
|
656
|
+
h.push("..");
|
|
657
|
+
return h = h.concat(Q.slice(i)), h.join("/");
|
|
658
|
+
} }, TA = { ttys: [], init: function() {
|
|
659
|
+
}, shutdown: function() {
|
|
660
|
+
}, register: function(A, I) {
|
|
661
|
+
TA.ttys[A] = { input: [], output: [], ops: I }, C.registerDevice(A, TA.stream_ops);
|
|
662
|
+
}, stream_ops: { open: function(A) {
|
|
663
|
+
var I = TA.ttys[A.node.rdev];
|
|
664
|
+
if (!I)
|
|
665
|
+
throw new C.ErrnoError(43);
|
|
666
|
+
A.tty = I, A.seekable = !1;
|
|
667
|
+
}, close: function(A) {
|
|
668
|
+
A.tty.ops.flush(A.tty);
|
|
669
|
+
}, flush: function(A) {
|
|
670
|
+
A.tty.ops.flush(A.tty);
|
|
671
|
+
}, read: function(A, I, g, B, Q) {
|
|
672
|
+
if (!A.tty || !A.tty.ops.get_char)
|
|
673
|
+
throw new C.ErrnoError(60);
|
|
674
|
+
for (var G = 0, i = 0; i < B; i++) {
|
|
675
|
+
var D;
|
|
676
|
+
try {
|
|
677
|
+
D = A.tty.ops.get_char(A.tty);
|
|
678
|
+
} catch {
|
|
679
|
+
throw new C.ErrnoError(29);
|
|
680
|
+
}
|
|
681
|
+
if (D === void 0 && G === 0)
|
|
682
|
+
throw new C.ErrnoError(6);
|
|
683
|
+
if (D == null) break;
|
|
684
|
+
G++, I[g + i] = D;
|
|
685
|
+
}
|
|
686
|
+
return G && (A.node.timestamp = Date.now()), G;
|
|
687
|
+
}, write: function(A, I, g, B, Q) {
|
|
688
|
+
if (!A.tty || !A.tty.ops.put_char)
|
|
689
|
+
throw new C.ErrnoError(60);
|
|
690
|
+
try {
|
|
691
|
+
for (var G = 0; G < B; G++)
|
|
692
|
+
A.tty.ops.put_char(A.tty, I[g + G]);
|
|
693
|
+
} catch {
|
|
694
|
+
throw new C.ErrnoError(29);
|
|
695
|
+
}
|
|
696
|
+
return B && (A.node.timestamp = Date.now()), G;
|
|
697
|
+
} }, default_tty_ops: { get_char: function(A) {
|
|
698
|
+
if (!A.input.length) {
|
|
699
|
+
var I = null;
|
|
700
|
+
if (m) {
|
|
701
|
+
var g = 256, B = Buffer.alloc ? Buffer.alloc(g) : new Buffer(g), Q = 0;
|
|
702
|
+
try {
|
|
703
|
+
Q = jA.readSync(process.stdin.fd, B, 0, g, null);
|
|
704
|
+
} catch (G) {
|
|
705
|
+
if (G.toString().includes("EOF")) Q = 0;
|
|
706
|
+
else throw G;
|
|
707
|
+
}
|
|
708
|
+
Q > 0 ? I = B.slice(0, Q).toString("utf-8") : I = null;
|
|
709
|
+
} else typeof window < "u" && typeof window.prompt == "function" ? (I = window.prompt("Input: "), I !== null && (I += `
|
|
710
|
+
`)) : typeof readline == "function" && (I = readline(), I !== null && (I += `
|
|
711
|
+
`));
|
|
712
|
+
if (!I)
|
|
713
|
+
return null;
|
|
714
|
+
A.input = KI(I, !0);
|
|
715
|
+
}
|
|
716
|
+
return A.input.shift();
|
|
717
|
+
}, put_char: function(A, I) {
|
|
718
|
+
I === null || I === 10 ? (uA(qA(A.output, 0)), A.output = []) : I != 0 && A.output.push(I);
|
|
719
|
+
}, flush: function(A) {
|
|
720
|
+
A.output && A.output.length > 0 && (uA(qA(A.output, 0)), A.output = []);
|
|
721
|
+
} }, default_tty1_ops: { put_char: function(A, I) {
|
|
722
|
+
I === null || I === 10 ? (DA(qA(A.output, 0)), A.output = []) : I != 0 && A.output.push(I);
|
|
723
|
+
}, flush: function(A) {
|
|
724
|
+
A.output && A.output.length > 0 && (DA(qA(A.output, 0)), A.output = []);
|
|
725
|
+
} } };
|
|
726
|
+
function GQ(A) {
|
|
727
|
+
for (var I = UB(A, 65536), g = OA(I); A < I; ) GA[g + A++] = 0;
|
|
728
|
+
return g;
|
|
729
|
+
}
|
|
730
|
+
var P = { ops_table: null, mount: function(A) {
|
|
731
|
+
return P.createNode(null, "/", 16895, 0);
|
|
732
|
+
}, createNode: function(A, I, g, B) {
|
|
733
|
+
if (C.isBlkdev(g) || C.isFIFO(g))
|
|
734
|
+
throw new C.ErrnoError(63);
|
|
735
|
+
P.ops_table || (P.ops_table = { dir: { node: { getattr: P.node_ops.getattr, setattr: P.node_ops.setattr, lookup: P.node_ops.lookup, mknod: P.node_ops.mknod, rename: P.node_ops.rename, unlink: P.node_ops.unlink, rmdir: P.node_ops.rmdir, readdir: P.node_ops.readdir, symlink: P.node_ops.symlink }, stream: { llseek: P.stream_ops.llseek } }, file: { node: { getattr: P.node_ops.getattr, setattr: P.node_ops.setattr }, stream: { llseek: P.stream_ops.llseek, read: P.stream_ops.read, write: P.stream_ops.write, allocate: P.stream_ops.allocate, mmap: P.stream_ops.mmap, msync: P.stream_ops.msync } }, link: { node: { getattr: P.node_ops.getattr, setattr: P.node_ops.setattr, readlink: P.node_ops.readlink }, stream: {} }, chrdev: { node: { getattr: P.node_ops.getattr, setattr: P.node_ops.setattr }, stream: C.chrdev_stream_ops } });
|
|
736
|
+
var Q = C.createNode(A, I, g, B);
|
|
737
|
+
return C.isDir(Q.mode) ? (Q.node_ops = P.ops_table.dir.node, Q.stream_ops = P.ops_table.dir.stream, Q.contents = {}) : C.isFile(Q.mode) ? (Q.node_ops = P.ops_table.file.node, Q.stream_ops = P.ops_table.file.stream, Q.usedBytes = 0, Q.contents = null) : C.isLink(Q.mode) ? (Q.node_ops = P.ops_table.link.node, Q.stream_ops = P.ops_table.link.stream) : C.isChrdev(Q.mode) && (Q.node_ops = P.ops_table.chrdev.node, Q.stream_ops = P.ops_table.chrdev.stream), Q.timestamp = Date.now(), A && (A.contents[I] = Q, A.timestamp = Q.timestamp), Q;
|
|
738
|
+
}, getFileDataAsTypedArray: function(A) {
|
|
739
|
+
return A.contents ? A.contents.subarray ? A.contents.subarray(0, A.usedBytes) : new Uint8Array(A.contents) : new Uint8Array(0);
|
|
740
|
+
}, expandFileStorage: function(A, I) {
|
|
741
|
+
var g = A.contents ? A.contents.length : 0;
|
|
742
|
+
if (!(g >= I)) {
|
|
743
|
+
var B = 1024 * 1024;
|
|
744
|
+
I = Math.max(I, g * (g < B ? 2 : 1.125) >>> 0), g != 0 && (I = Math.max(I, 256));
|
|
745
|
+
var Q = A.contents;
|
|
746
|
+
A.contents = new Uint8Array(I), A.usedBytes > 0 && A.contents.set(Q.subarray(0, A.usedBytes), 0);
|
|
747
|
+
}
|
|
748
|
+
}, resizeFileStorage: function(A, I) {
|
|
749
|
+
if (A.usedBytes != I)
|
|
750
|
+
if (I == 0)
|
|
751
|
+
A.contents = null, A.usedBytes = 0;
|
|
752
|
+
else {
|
|
753
|
+
var g = A.contents;
|
|
754
|
+
A.contents = new Uint8Array(I), g && A.contents.set(g.subarray(0, Math.min(I, A.usedBytes))), A.usedBytes = I;
|
|
755
|
+
}
|
|
756
|
+
}, node_ops: { getattr: function(A) {
|
|
757
|
+
var I = {};
|
|
758
|
+
return I.dev = C.isChrdev(A.mode) ? A.id : 1, I.ino = A.id, I.mode = A.mode, I.nlink = 1, I.uid = 0, I.gid = 0, I.rdev = A.rdev, C.isDir(A.mode) ? I.size = 4096 : C.isFile(A.mode) ? I.size = A.usedBytes : C.isLink(A.mode) ? I.size = A.link.length : I.size = 0, I.atime = new Date(A.timestamp), I.mtime = new Date(A.timestamp), I.ctime = new Date(A.timestamp), I.blksize = 4096, I.blocks = Math.ceil(I.size / I.blksize), I;
|
|
759
|
+
}, setattr: function(A, I) {
|
|
760
|
+
I.mode !== void 0 && (A.mode = I.mode), I.timestamp !== void 0 && (A.timestamp = I.timestamp), I.size !== void 0 && P.resizeFileStorage(A, I.size);
|
|
761
|
+
}, lookup: function(A, I) {
|
|
762
|
+
throw C.genericErrors[44];
|
|
763
|
+
}, mknod: function(A, I, g, B) {
|
|
764
|
+
return P.createNode(A, I, g, B);
|
|
765
|
+
}, rename: function(A, I, g) {
|
|
766
|
+
if (C.isDir(A.mode)) {
|
|
767
|
+
var B;
|
|
768
|
+
try {
|
|
769
|
+
B = C.lookupNode(I, g);
|
|
770
|
+
} catch {
|
|
771
|
+
}
|
|
772
|
+
if (B)
|
|
773
|
+
for (var Q in B.contents)
|
|
774
|
+
throw new C.ErrnoError(55);
|
|
775
|
+
}
|
|
776
|
+
delete A.parent.contents[A.name], A.parent.timestamp = Date.now(), A.name = g, I.contents[g] = A, I.timestamp = A.parent.timestamp, A.parent = I;
|
|
777
|
+
}, unlink: function(A, I) {
|
|
778
|
+
delete A.contents[I], A.timestamp = Date.now();
|
|
779
|
+
}, rmdir: function(A, I) {
|
|
780
|
+
var g = C.lookupNode(A, I);
|
|
781
|
+
for (var B in g.contents)
|
|
782
|
+
throw new C.ErrnoError(55);
|
|
783
|
+
delete A.contents[I], A.timestamp = Date.now();
|
|
784
|
+
}, readdir: function(A) {
|
|
785
|
+
var I = [".", ".."];
|
|
786
|
+
for (var g in A.contents)
|
|
787
|
+
A.contents.hasOwnProperty(g) && I.push(g);
|
|
788
|
+
return I;
|
|
789
|
+
}, symlink: function(A, I, g) {
|
|
790
|
+
var B = P.createNode(A, I, 41471, 0);
|
|
791
|
+
return B.link = g, B;
|
|
792
|
+
}, readlink: function(A) {
|
|
793
|
+
if (!C.isLink(A.mode))
|
|
794
|
+
throw new C.ErrnoError(28);
|
|
795
|
+
return A.link;
|
|
796
|
+
} }, stream_ops: { read: function(A, I, g, B, Q) {
|
|
797
|
+
var G = A.node.contents;
|
|
798
|
+
if (Q >= A.node.usedBytes) return 0;
|
|
799
|
+
var i = Math.min(A.node.usedBytes - Q, B);
|
|
800
|
+
if (i > 8 && G.subarray)
|
|
801
|
+
I.set(G.subarray(Q, Q + i), g);
|
|
802
|
+
else
|
|
803
|
+
for (var D = 0; D < i; D++) I[g + D] = G[Q + D];
|
|
804
|
+
return i;
|
|
805
|
+
}, write: function(A, I, g, B, Q, G) {
|
|
806
|
+
if (I.buffer === GA.buffer && (G = !1), !B) return 0;
|
|
807
|
+
var i = A.node;
|
|
808
|
+
if (i.timestamp = Date.now(), I.subarray && (!i.contents || i.contents.subarray)) {
|
|
809
|
+
if (G)
|
|
810
|
+
return i.contents = I.subarray(g, g + B), i.usedBytes = B, B;
|
|
811
|
+
if (i.usedBytes === 0 && Q === 0)
|
|
812
|
+
return i.contents = I.slice(g, g + B), i.usedBytes = B, B;
|
|
813
|
+
if (Q + B <= i.usedBytes)
|
|
814
|
+
return i.contents.set(I.subarray(g, g + B), Q), B;
|
|
815
|
+
}
|
|
816
|
+
if (P.expandFileStorage(i, Q + B), i.contents.subarray && I.subarray)
|
|
817
|
+
i.contents.set(I.subarray(g, g + B), Q);
|
|
818
|
+
else
|
|
819
|
+
for (var D = 0; D < B; D++)
|
|
820
|
+
i.contents[Q + D] = I[g + D];
|
|
821
|
+
return i.usedBytes = Math.max(i.usedBytes, Q + B), B;
|
|
822
|
+
}, llseek: function(A, I, g) {
|
|
823
|
+
var B = I;
|
|
824
|
+
if (g === 1 ? B += A.position : g === 2 && C.isFile(A.node.mode) && (B += A.node.usedBytes), B < 0)
|
|
825
|
+
throw new C.ErrnoError(28);
|
|
826
|
+
return B;
|
|
827
|
+
}, allocate: function(A, I, g) {
|
|
828
|
+
P.expandFileStorage(A.node, I + g), A.node.usedBytes = Math.max(A.node.usedBytes, I + g);
|
|
829
|
+
}, mmap: function(A, I, g, B, Q, G) {
|
|
830
|
+
if (I !== 0)
|
|
831
|
+
throw new C.ErrnoError(28);
|
|
832
|
+
if (!C.isFile(A.node.mode))
|
|
833
|
+
throw new C.ErrnoError(43);
|
|
834
|
+
var i, D, h = A.node.contents;
|
|
835
|
+
if (!(G & 2) && h.buffer === wI)
|
|
836
|
+
D = !1, i = h.byteOffset;
|
|
837
|
+
else {
|
|
838
|
+
if ((B > 0 || B + g < h.length) && (h.subarray ? h = h.subarray(B, B + g) : h = Array.prototype.slice.call(h, B, B + g)), D = !0, i = GQ(g), !i)
|
|
839
|
+
throw new C.ErrnoError(48);
|
|
840
|
+
GA.set(h, i);
|
|
841
|
+
}
|
|
842
|
+
return { ptr: i, allocated: D };
|
|
843
|
+
}, msync: function(A, I, g, B, Q) {
|
|
844
|
+
if (!C.isFile(A.node.mode))
|
|
845
|
+
throw new C.ErrnoError(43);
|
|
846
|
+
return Q & 2 || P.stream_ops.write(A, I, 0, B, g, !1), 0;
|
|
847
|
+
} } }, C = { root: null, mounts: [], devices: {}, streams: [], nextInode: 1, nameTable: null, currentPath: "/", initialized: !1, ignorePermissions: !0, trackingDelegate: {}, tracking: { openFlags: { READ: 1, WRITE: 2 } }, ErrnoError: null, genericErrors: {}, filesystems: null, syncFSRequests: 0, lookupPath: function(A, I) {
|
|
848
|
+
if (A = yA.resolve(C.cwd(), A), I = I || {}, !A) return { path: "", node: null };
|
|
849
|
+
var g = { follow_mount: !0, recurse_count: 0 };
|
|
850
|
+
for (var B in g)
|
|
851
|
+
I[B] === void 0 && (I[B] = g[B]);
|
|
852
|
+
if (I.recurse_count > 8)
|
|
853
|
+
throw new C.ErrnoError(32);
|
|
854
|
+
for (var Q = r.normalizeArray(A.split("/").filter(function(k) {
|
|
855
|
+
return !!k;
|
|
856
|
+
}), !1), G = C.root, i = "/", D = 0; D < Q.length; D++) {
|
|
857
|
+
var h = D === Q.length - 1;
|
|
858
|
+
if (h && I.parent)
|
|
859
|
+
break;
|
|
860
|
+
if (G = C.lookupNode(G, Q[D]), i = r.join2(i, Q[D]), C.isMountpoint(G) && (!h || h && I.follow_mount) && (G = G.mounted.root), !h || I.follow)
|
|
861
|
+
for (var o = 0; C.isLink(G.mode); ) {
|
|
862
|
+
var Y = C.readlink(i);
|
|
863
|
+
i = yA.resolve(r.dirname(i), Y);
|
|
864
|
+
var a = C.lookupPath(i, { recurse_count: I.recurse_count });
|
|
865
|
+
if (G = a.node, o++ > 40)
|
|
866
|
+
throw new C.ErrnoError(32);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
return { path: i, node: G };
|
|
870
|
+
}, getPath: function(A) {
|
|
871
|
+
for (var I; ; ) {
|
|
872
|
+
if (C.isRoot(A)) {
|
|
873
|
+
var g = A.mount.mountpoint;
|
|
874
|
+
return I ? g[g.length - 1] !== "/" ? g + "/" + I : g + I : g;
|
|
875
|
+
}
|
|
876
|
+
I = I ? A.name + "/" + I : A.name, A = A.parent;
|
|
877
|
+
}
|
|
878
|
+
}, hashName: function(A, I) {
|
|
879
|
+
for (var g = 0, B = 0; B < I.length; B++)
|
|
880
|
+
g = (g << 5) - g + I.charCodeAt(B) | 0;
|
|
881
|
+
return (A + g >>> 0) % C.nameTable.length;
|
|
882
|
+
}, hashAddNode: function(A) {
|
|
883
|
+
var I = C.hashName(A.parent.id, A.name);
|
|
884
|
+
A.name_next = C.nameTable[I], C.nameTable[I] = A;
|
|
885
|
+
}, hashRemoveNode: function(A) {
|
|
886
|
+
var I = C.hashName(A.parent.id, A.name);
|
|
887
|
+
if (C.nameTable[I] === A)
|
|
888
|
+
C.nameTable[I] = A.name_next;
|
|
889
|
+
else
|
|
890
|
+
for (var g = C.nameTable[I]; g; ) {
|
|
891
|
+
if (g.name_next === A) {
|
|
892
|
+
g.name_next = A.name_next;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
g = g.name_next;
|
|
896
|
+
}
|
|
897
|
+
}, lookupNode: function(A, I) {
|
|
898
|
+
var g = C.mayLookup(A);
|
|
899
|
+
if (g)
|
|
900
|
+
throw new C.ErrnoError(g, A);
|
|
901
|
+
for (var B = C.hashName(A.id, I), Q = C.nameTable[B]; Q; Q = Q.name_next) {
|
|
902
|
+
var G = Q.name;
|
|
903
|
+
if (Q.parent.id === A.id && G === I)
|
|
904
|
+
return Q;
|
|
905
|
+
}
|
|
906
|
+
return C.lookup(A, I);
|
|
907
|
+
}, createNode: function(A, I, g, B) {
|
|
908
|
+
var Q = new C.FSNode(A, I, g, B);
|
|
909
|
+
return C.hashAddNode(Q), Q;
|
|
910
|
+
}, destroyNode: function(A) {
|
|
911
|
+
C.hashRemoveNode(A);
|
|
912
|
+
}, isRoot: function(A) {
|
|
913
|
+
return A === A.parent;
|
|
914
|
+
}, isMountpoint: function(A) {
|
|
915
|
+
return !!A.mounted;
|
|
916
|
+
}, isFile: function(A) {
|
|
917
|
+
return (A & 61440) === 32768;
|
|
918
|
+
}, isDir: function(A) {
|
|
919
|
+
return (A & 61440) === 16384;
|
|
920
|
+
}, isLink: function(A) {
|
|
921
|
+
return (A & 61440) === 40960;
|
|
922
|
+
}, isChrdev: function(A) {
|
|
923
|
+
return (A & 61440) === 8192;
|
|
924
|
+
}, isBlkdev: function(A) {
|
|
925
|
+
return (A & 61440) === 24576;
|
|
926
|
+
}, isFIFO: function(A) {
|
|
927
|
+
return (A & 61440) === 4096;
|
|
928
|
+
}, isSocket: function(A) {
|
|
929
|
+
return (A & 49152) === 49152;
|
|
930
|
+
}, flagModes: { r: 0, "r+": 2, w: 577, "w+": 578, a: 1089, "a+": 1090 }, modeStringToFlags: function(A) {
|
|
931
|
+
var I = C.flagModes[A];
|
|
932
|
+
if (typeof I > "u")
|
|
933
|
+
throw new Error("Unknown file open mode: " + A);
|
|
934
|
+
return I;
|
|
935
|
+
}, flagsToPermissionString: function(A) {
|
|
936
|
+
var I = ["r", "w", "rw"][A & 3];
|
|
937
|
+
return A & 512 && (I += "w"), I;
|
|
938
|
+
}, nodePermissions: function(A, I) {
|
|
939
|
+
return 0;
|
|
940
|
+
}, mayLookup: function(A) {
|
|
941
|
+
var I = C.nodePermissions(A, "x");
|
|
942
|
+
return I || (A.node_ops.lookup ? 0 : 2);
|
|
943
|
+
}, mayCreate: function(A, I) {
|
|
944
|
+
try {
|
|
945
|
+
var g = C.lookupNode(A, I);
|
|
946
|
+
return 20;
|
|
947
|
+
} catch {
|
|
948
|
+
}
|
|
949
|
+
return C.nodePermissions(A, "wx");
|
|
950
|
+
}, mayDelete: function(A, I, g) {
|
|
951
|
+
var B;
|
|
952
|
+
try {
|
|
953
|
+
B = C.lookupNode(A, I);
|
|
954
|
+
} catch (G) {
|
|
955
|
+
return G.errno;
|
|
956
|
+
}
|
|
957
|
+
var Q = C.nodePermissions(A, "wx");
|
|
958
|
+
if (Q)
|
|
959
|
+
return Q;
|
|
960
|
+
if (g) {
|
|
961
|
+
if (!C.isDir(B.mode))
|
|
962
|
+
return 54;
|
|
963
|
+
if (C.isRoot(B) || C.getPath(B) === C.cwd())
|
|
964
|
+
return 10;
|
|
965
|
+
} else if (C.isDir(B.mode))
|
|
966
|
+
return 31;
|
|
967
|
+
return 0;
|
|
968
|
+
}, mayOpen: function(A, I) {
|
|
969
|
+
return A ? C.isLink(A.mode) ? 32 : C.isDir(A.mode) && (C.flagsToPermissionString(I) !== "r" || I & 512) ? 31 : C.nodePermissions(A, C.flagsToPermissionString(I)) : 44;
|
|
970
|
+
}, MAX_OPEN_FDS: 4096, nextfd: function(A, I) {
|
|
971
|
+
A = A || 0, I = I || C.MAX_OPEN_FDS;
|
|
972
|
+
for (var g = A; g <= I; g++)
|
|
973
|
+
if (!C.streams[g])
|
|
974
|
+
return g;
|
|
975
|
+
throw new C.ErrnoError(33);
|
|
976
|
+
}, getStream: function(A) {
|
|
977
|
+
return C.streams[A];
|
|
978
|
+
}, createStream: function(A, I, g) {
|
|
979
|
+
C.FSStream || (C.FSStream = function() {
|
|
980
|
+
}, C.FSStream.prototype = { object: { get: function() {
|
|
981
|
+
return this.node;
|
|
982
|
+
}, set: function(i) {
|
|
983
|
+
this.node = i;
|
|
984
|
+
} }, isRead: { get: function() {
|
|
985
|
+
return (this.flags & 2097155) !== 1;
|
|
986
|
+
} }, isWrite: { get: function() {
|
|
987
|
+
return (this.flags & 2097155) !== 0;
|
|
988
|
+
} }, isAppend: { get: function() {
|
|
989
|
+
return this.flags & 1024;
|
|
990
|
+
} } });
|
|
991
|
+
var B = new C.FSStream();
|
|
992
|
+
for (var Q in A)
|
|
993
|
+
B[Q] = A[Q];
|
|
994
|
+
A = B;
|
|
995
|
+
var G = C.nextfd(I, g);
|
|
996
|
+
return A.fd = G, C.streams[G] = A, A;
|
|
997
|
+
}, closeStream: function(A) {
|
|
998
|
+
C.streams[A] = null;
|
|
999
|
+
}, chrdev_stream_ops: { open: function(A) {
|
|
1000
|
+
var I = C.getDevice(A.node.rdev);
|
|
1001
|
+
A.stream_ops = I.stream_ops, A.stream_ops.open && A.stream_ops.open(A);
|
|
1002
|
+
}, llseek: function() {
|
|
1003
|
+
throw new C.ErrnoError(70);
|
|
1004
|
+
} }, major: function(A) {
|
|
1005
|
+
return A >> 8;
|
|
1006
|
+
}, minor: function(A) {
|
|
1007
|
+
return A & 255;
|
|
1008
|
+
}, makedev: function(A, I) {
|
|
1009
|
+
return A << 8 | I;
|
|
1010
|
+
}, registerDevice: function(A, I) {
|
|
1011
|
+
C.devices[A] = { stream_ops: I };
|
|
1012
|
+
}, getDevice: function(A) {
|
|
1013
|
+
return C.devices[A];
|
|
1014
|
+
}, getMounts: function(A) {
|
|
1015
|
+
for (var I = [], g = [A]; g.length; ) {
|
|
1016
|
+
var B = g.pop();
|
|
1017
|
+
I.push(B), g.push.apply(g, B.mounts);
|
|
1018
|
+
}
|
|
1019
|
+
return I;
|
|
1020
|
+
}, syncfs: function(A, I) {
|
|
1021
|
+
typeof A == "function" && (I = A, A = !1), C.syncFSRequests++, C.syncFSRequests > 1 && DA("warning: " + C.syncFSRequests + " FS.syncfs operations in flight at once, probably just doing extra work");
|
|
1022
|
+
var g = C.getMounts(C.root.mount), B = 0;
|
|
1023
|
+
function Q(i) {
|
|
1024
|
+
return C.syncFSRequests--, I(i);
|
|
1025
|
+
}
|
|
1026
|
+
function G(i) {
|
|
1027
|
+
if (i)
|
|
1028
|
+
return G.errored ? void 0 : (G.errored = !0, Q(i));
|
|
1029
|
+
++B >= g.length && Q(null);
|
|
1030
|
+
}
|
|
1031
|
+
g.forEach(function(i) {
|
|
1032
|
+
if (!i.type.syncfs)
|
|
1033
|
+
return G(null);
|
|
1034
|
+
i.type.syncfs(i, A, G);
|
|
1035
|
+
});
|
|
1036
|
+
}, mount: function(A, I, g) {
|
|
1037
|
+
var B = g === "/", Q = !g, G;
|
|
1038
|
+
if (B && C.root)
|
|
1039
|
+
throw new C.ErrnoError(10);
|
|
1040
|
+
if (!B && !Q) {
|
|
1041
|
+
var i = C.lookupPath(g, { follow_mount: !1 });
|
|
1042
|
+
if (g = i.path, G = i.node, C.isMountpoint(G))
|
|
1043
|
+
throw new C.ErrnoError(10);
|
|
1044
|
+
if (!C.isDir(G.mode))
|
|
1045
|
+
throw new C.ErrnoError(54);
|
|
1046
|
+
}
|
|
1047
|
+
var D = { type: A, opts: I, mountpoint: g, mounts: [] }, h = A.mount(D);
|
|
1048
|
+
return h.mount = D, D.root = h, B ? C.root = h : G && (G.mounted = D, G.mount && G.mount.mounts.push(D)), h;
|
|
1049
|
+
}, unmount: function(A) {
|
|
1050
|
+
var I = C.lookupPath(A, { follow_mount: !1 });
|
|
1051
|
+
if (!C.isMountpoint(I.node))
|
|
1052
|
+
throw new C.ErrnoError(28);
|
|
1053
|
+
var g = I.node, B = g.mounted, Q = C.getMounts(B);
|
|
1054
|
+
Object.keys(C.nameTable).forEach(function(i) {
|
|
1055
|
+
for (var D = C.nameTable[i]; D; ) {
|
|
1056
|
+
var h = D.name_next;
|
|
1057
|
+
Q.includes(D.mount) && C.destroyNode(D), D = h;
|
|
1058
|
+
}
|
|
1059
|
+
}), g.mounted = null;
|
|
1060
|
+
var G = g.mount.mounts.indexOf(B);
|
|
1061
|
+
g.mount.mounts.splice(G, 1);
|
|
1062
|
+
}, lookup: function(A, I) {
|
|
1063
|
+
return A.node_ops.lookup(A, I);
|
|
1064
|
+
}, mknod: function(A, I, g) {
|
|
1065
|
+
var B = C.lookupPath(A, { parent: !0 }), Q = B.node, G = r.basename(A);
|
|
1066
|
+
if (!G || G === "." || G === "..")
|
|
1067
|
+
throw new C.ErrnoError(28);
|
|
1068
|
+
var i = C.mayCreate(Q, G);
|
|
1069
|
+
if (i)
|
|
1070
|
+
throw new C.ErrnoError(i);
|
|
1071
|
+
if (!Q.node_ops.mknod)
|
|
1072
|
+
throw new C.ErrnoError(63);
|
|
1073
|
+
return Q.node_ops.mknod(Q, G, I, g);
|
|
1074
|
+
}, create: function(A, I) {
|
|
1075
|
+
return I = I !== void 0 ? I : 438, I &= 4095, I |= 32768, C.mknod(A, I, 0);
|
|
1076
|
+
}, mkdir: function(A, I) {
|
|
1077
|
+
return I = I !== void 0 ? I : 511, I &= 1023, I |= 16384, C.mknod(A, I, 0);
|
|
1078
|
+
}, mkdirTree: function(A, I) {
|
|
1079
|
+
for (var g = A.split("/"), B = "", Q = 0; Q < g.length; ++Q)
|
|
1080
|
+
if (g[Q]) {
|
|
1081
|
+
B += "/" + g[Q];
|
|
1082
|
+
try {
|
|
1083
|
+
C.mkdir(B, I);
|
|
1084
|
+
} catch (G) {
|
|
1085
|
+
if (G.errno != 20) throw G;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
}, mkdev: function(A, I, g) {
|
|
1089
|
+
return typeof g > "u" && (g = I, I = 438), I |= 8192, C.mknod(A, I, g);
|
|
1090
|
+
}, symlink: function(A, I) {
|
|
1091
|
+
if (!yA.resolve(A))
|
|
1092
|
+
throw new C.ErrnoError(44);
|
|
1093
|
+
var g = C.lookupPath(I, { parent: !0 }), B = g.node;
|
|
1094
|
+
if (!B)
|
|
1095
|
+
throw new C.ErrnoError(44);
|
|
1096
|
+
var Q = r.basename(I), G = C.mayCreate(B, Q);
|
|
1097
|
+
if (G)
|
|
1098
|
+
throw new C.ErrnoError(G);
|
|
1099
|
+
if (!B.node_ops.symlink)
|
|
1100
|
+
throw new C.ErrnoError(63);
|
|
1101
|
+
return B.node_ops.symlink(B, Q, A);
|
|
1102
|
+
}, rename: function(A, I) {
|
|
1103
|
+
var g = r.dirname(A), B = r.dirname(I), Q = r.basename(A), G = r.basename(I), i, D, h;
|
|
1104
|
+
if (i = C.lookupPath(A, { parent: !0 }), D = i.node, i = C.lookupPath(I, { parent: !0 }), h = i.node, !D || !h) throw new C.ErrnoError(44);
|
|
1105
|
+
if (D.mount !== h.mount)
|
|
1106
|
+
throw new C.ErrnoError(75);
|
|
1107
|
+
var o = C.lookupNode(D, Q), Y = yA.relative(A, B);
|
|
1108
|
+
if (Y.charAt(0) !== ".")
|
|
1109
|
+
throw new C.ErrnoError(28);
|
|
1110
|
+
if (Y = yA.relative(I, g), Y.charAt(0) !== ".")
|
|
1111
|
+
throw new C.ErrnoError(55);
|
|
1112
|
+
var a;
|
|
1113
|
+
try {
|
|
1114
|
+
a = C.lookupNode(h, G);
|
|
1115
|
+
} catch {
|
|
1116
|
+
}
|
|
1117
|
+
if (o !== a) {
|
|
1118
|
+
var k = C.isDir(o.mode), N = C.mayDelete(D, Q, k);
|
|
1119
|
+
if (N)
|
|
1120
|
+
throw new C.ErrnoError(N);
|
|
1121
|
+
if (N = a ? C.mayDelete(h, G, k) : C.mayCreate(h, G), N)
|
|
1122
|
+
throw new C.ErrnoError(N);
|
|
1123
|
+
if (!D.node_ops.rename)
|
|
1124
|
+
throw new C.ErrnoError(63);
|
|
1125
|
+
if (C.isMountpoint(o) || a && C.isMountpoint(a))
|
|
1126
|
+
throw new C.ErrnoError(10);
|
|
1127
|
+
if (h !== D && (N = C.nodePermissions(D, "w"), N))
|
|
1128
|
+
throw new C.ErrnoError(N);
|
|
1129
|
+
try {
|
|
1130
|
+
C.trackingDelegate.willMovePath && C.trackingDelegate.willMovePath(A, I);
|
|
1131
|
+
} catch (b) {
|
|
1132
|
+
DA("FS.trackingDelegate['willMovePath']('" + A + "', '" + I + "') threw an exception: " + b.message);
|
|
1133
|
+
}
|
|
1134
|
+
C.hashRemoveNode(o);
|
|
1135
|
+
try {
|
|
1136
|
+
D.node_ops.rename(o, h, G);
|
|
1137
|
+
} catch (b) {
|
|
1138
|
+
throw b;
|
|
1139
|
+
} finally {
|
|
1140
|
+
C.hashAddNode(o);
|
|
1141
|
+
}
|
|
1142
|
+
try {
|
|
1143
|
+
C.trackingDelegate.onMovePath && C.trackingDelegate.onMovePath(A, I);
|
|
1144
|
+
} catch (b) {
|
|
1145
|
+
DA("FS.trackingDelegate['onMovePath']('" + A + "', '" + I + "') threw an exception: " + b.message);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}, rmdir: function(A) {
|
|
1149
|
+
var I = C.lookupPath(A, { parent: !0 }), g = I.node, B = r.basename(A), Q = C.lookupNode(g, B), G = C.mayDelete(g, B, !0);
|
|
1150
|
+
if (G)
|
|
1151
|
+
throw new C.ErrnoError(G);
|
|
1152
|
+
if (!g.node_ops.rmdir)
|
|
1153
|
+
throw new C.ErrnoError(63);
|
|
1154
|
+
if (C.isMountpoint(Q))
|
|
1155
|
+
throw new C.ErrnoError(10);
|
|
1156
|
+
try {
|
|
1157
|
+
C.trackingDelegate.willDeletePath && C.trackingDelegate.willDeletePath(A);
|
|
1158
|
+
} catch (i) {
|
|
1159
|
+
DA("FS.trackingDelegate['willDeletePath']('" + A + "') threw an exception: " + i.message);
|
|
1160
|
+
}
|
|
1161
|
+
g.node_ops.rmdir(g, B), C.destroyNode(Q);
|
|
1162
|
+
try {
|
|
1163
|
+
C.trackingDelegate.onDeletePath && C.trackingDelegate.onDeletePath(A);
|
|
1164
|
+
} catch (i) {
|
|
1165
|
+
DA("FS.trackingDelegate['onDeletePath']('" + A + "') threw an exception: " + i.message);
|
|
1166
|
+
}
|
|
1167
|
+
}, readdir: function(A) {
|
|
1168
|
+
var I = C.lookupPath(A, { follow: !0 }), g = I.node;
|
|
1169
|
+
if (!g.node_ops.readdir)
|
|
1170
|
+
throw new C.ErrnoError(54);
|
|
1171
|
+
return g.node_ops.readdir(g);
|
|
1172
|
+
}, unlink: function(A) {
|
|
1173
|
+
var I = C.lookupPath(A, { parent: !0 }), g = I.node, B = r.basename(A), Q = C.lookupNode(g, B), G = C.mayDelete(g, B, !1);
|
|
1174
|
+
if (G)
|
|
1175
|
+
throw new C.ErrnoError(G);
|
|
1176
|
+
if (!g.node_ops.unlink)
|
|
1177
|
+
throw new C.ErrnoError(63);
|
|
1178
|
+
if (C.isMountpoint(Q))
|
|
1179
|
+
throw new C.ErrnoError(10);
|
|
1180
|
+
try {
|
|
1181
|
+
C.trackingDelegate.willDeletePath && C.trackingDelegate.willDeletePath(A);
|
|
1182
|
+
} catch (i) {
|
|
1183
|
+
DA("FS.trackingDelegate['willDeletePath']('" + A + "') threw an exception: " + i.message);
|
|
1184
|
+
}
|
|
1185
|
+
g.node_ops.unlink(g, B), C.destroyNode(Q);
|
|
1186
|
+
try {
|
|
1187
|
+
C.trackingDelegate.onDeletePath && C.trackingDelegate.onDeletePath(A);
|
|
1188
|
+
} catch (i) {
|
|
1189
|
+
DA("FS.trackingDelegate['onDeletePath']('" + A + "') threw an exception: " + i.message);
|
|
1190
|
+
}
|
|
1191
|
+
}, readlink: function(A) {
|
|
1192
|
+
var I = C.lookupPath(A), g = I.node;
|
|
1193
|
+
if (!g)
|
|
1194
|
+
throw new C.ErrnoError(44);
|
|
1195
|
+
if (!g.node_ops.readlink)
|
|
1196
|
+
throw new C.ErrnoError(28);
|
|
1197
|
+
return yA.resolve(C.getPath(g.parent), g.node_ops.readlink(g));
|
|
1198
|
+
}, stat: function(A, I) {
|
|
1199
|
+
var g = C.lookupPath(A, { follow: !I }), B = g.node;
|
|
1200
|
+
if (!B)
|
|
1201
|
+
throw new C.ErrnoError(44);
|
|
1202
|
+
if (!B.node_ops.getattr)
|
|
1203
|
+
throw new C.ErrnoError(63);
|
|
1204
|
+
return B.node_ops.getattr(B);
|
|
1205
|
+
}, lstat: function(A) {
|
|
1206
|
+
return C.stat(A, !0);
|
|
1207
|
+
}, chmod: function(A, I, g) {
|
|
1208
|
+
var B;
|
|
1209
|
+
if (typeof A == "string") {
|
|
1210
|
+
var Q = C.lookupPath(A, { follow: !g });
|
|
1211
|
+
B = Q.node;
|
|
1212
|
+
} else
|
|
1213
|
+
B = A;
|
|
1214
|
+
if (!B.node_ops.setattr)
|
|
1215
|
+
throw new C.ErrnoError(63);
|
|
1216
|
+
B.node_ops.setattr(B, { mode: I & 4095 | B.mode & -4096, timestamp: Date.now() });
|
|
1217
|
+
}, lchmod: function(A, I) {
|
|
1218
|
+
C.chmod(A, I, !0);
|
|
1219
|
+
}, fchmod: function(A, I) {
|
|
1220
|
+
var g = C.getStream(A);
|
|
1221
|
+
if (!g)
|
|
1222
|
+
throw new C.ErrnoError(8);
|
|
1223
|
+
C.chmod(g.node, I);
|
|
1224
|
+
}, chown: function(A, I, g, B) {
|
|
1225
|
+
var Q;
|
|
1226
|
+
if (typeof A == "string") {
|
|
1227
|
+
var G = C.lookupPath(A, { follow: !B });
|
|
1228
|
+
Q = G.node;
|
|
1229
|
+
} else
|
|
1230
|
+
Q = A;
|
|
1231
|
+
if (!Q.node_ops.setattr)
|
|
1232
|
+
throw new C.ErrnoError(63);
|
|
1233
|
+
Q.node_ops.setattr(Q, { timestamp: Date.now() });
|
|
1234
|
+
}, lchown: function(A, I, g) {
|
|
1235
|
+
C.chown(A, I, g, !0);
|
|
1236
|
+
}, fchown: function(A, I, g) {
|
|
1237
|
+
var B = C.getStream(A);
|
|
1238
|
+
if (!B)
|
|
1239
|
+
throw new C.ErrnoError(8);
|
|
1240
|
+
C.chown(B.node, I, g);
|
|
1241
|
+
}, truncate: function(A, I) {
|
|
1242
|
+
if (I < 0)
|
|
1243
|
+
throw new C.ErrnoError(28);
|
|
1244
|
+
var g;
|
|
1245
|
+
if (typeof A == "string") {
|
|
1246
|
+
var B = C.lookupPath(A, { follow: !0 });
|
|
1247
|
+
g = B.node;
|
|
1248
|
+
} else
|
|
1249
|
+
g = A;
|
|
1250
|
+
if (!g.node_ops.setattr)
|
|
1251
|
+
throw new C.ErrnoError(63);
|
|
1252
|
+
if (C.isDir(g.mode))
|
|
1253
|
+
throw new C.ErrnoError(31);
|
|
1254
|
+
if (!C.isFile(g.mode))
|
|
1255
|
+
throw new C.ErrnoError(28);
|
|
1256
|
+
var Q = C.nodePermissions(g, "w");
|
|
1257
|
+
if (Q)
|
|
1258
|
+
throw new C.ErrnoError(Q);
|
|
1259
|
+
g.node_ops.setattr(g, { size: I, timestamp: Date.now() });
|
|
1260
|
+
}, ftruncate: function(A, I) {
|
|
1261
|
+
var g = C.getStream(A);
|
|
1262
|
+
if (!g)
|
|
1263
|
+
throw new C.ErrnoError(8);
|
|
1264
|
+
if ((g.flags & 2097155) === 0)
|
|
1265
|
+
throw new C.ErrnoError(28);
|
|
1266
|
+
C.truncate(g.node, I);
|
|
1267
|
+
}, utime: function(A, I, g) {
|
|
1268
|
+
var B = C.lookupPath(A, { follow: !0 }), Q = B.node;
|
|
1269
|
+
Q.node_ops.setattr(Q, { timestamp: Math.max(I, g) });
|
|
1270
|
+
}, open: function(A, I, g, B, Q) {
|
|
1271
|
+
if (A === "")
|
|
1272
|
+
throw new C.ErrnoError(44);
|
|
1273
|
+
I = typeof I == "string" ? C.modeStringToFlags(I) : I, g = typeof g > "u" ? 438 : g, I & 64 ? g = g & 4095 | 32768 : g = 0;
|
|
1274
|
+
var G;
|
|
1275
|
+
if (typeof A == "object")
|
|
1276
|
+
G = A;
|
|
1277
|
+
else {
|
|
1278
|
+
A = r.normalize(A);
|
|
1279
|
+
try {
|
|
1280
|
+
var i = C.lookupPath(A, { follow: !(I & 131072) });
|
|
1281
|
+
G = i.node;
|
|
1282
|
+
} catch {
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
var D = !1;
|
|
1286
|
+
if (I & 64)
|
|
1287
|
+
if (G) {
|
|
1288
|
+
if (I & 128)
|
|
1289
|
+
throw new C.ErrnoError(20);
|
|
1290
|
+
} else
|
|
1291
|
+
G = C.mknod(A, g, 0), D = !0;
|
|
1292
|
+
if (!G)
|
|
1293
|
+
throw new C.ErrnoError(44);
|
|
1294
|
+
if (C.isChrdev(G.mode) && (I &= -513), I & 65536 && !C.isDir(G.mode))
|
|
1295
|
+
throw new C.ErrnoError(54);
|
|
1296
|
+
if (!D) {
|
|
1297
|
+
var h = C.mayOpen(G, I);
|
|
1298
|
+
if (h)
|
|
1299
|
+
throw new C.ErrnoError(h);
|
|
1300
|
+
}
|
|
1301
|
+
I & 512 && C.truncate(G, 0), I &= -131713;
|
|
1302
|
+
var o = C.createStream({ node: G, path: C.getPath(G), flags: I, seekable: !0, position: 0, stream_ops: G.stream_ops, ungotten: [], error: !1 }, B, Q);
|
|
1303
|
+
o.stream_ops.open && o.stream_ops.open(o), E.logReadFiles && !(I & 1) && (C.readFiles || (C.readFiles = {}), A in C.readFiles || (C.readFiles[A] = 1, DA("FS.trackingDelegate error on read file: " + A)));
|
|
1304
|
+
try {
|
|
1305
|
+
if (C.trackingDelegate.onOpenFile) {
|
|
1306
|
+
var Y = 0;
|
|
1307
|
+
(I & 2097155) !== 1 && (Y |= C.tracking.openFlags.READ), (I & 2097155) !== 0 && (Y |= C.tracking.openFlags.WRITE), C.trackingDelegate.onOpenFile(A, Y);
|
|
1308
|
+
}
|
|
1309
|
+
} catch (a) {
|
|
1310
|
+
DA("FS.trackingDelegate['onOpenFile']('" + A + "', flags) threw an exception: " + a.message);
|
|
1311
|
+
}
|
|
1312
|
+
return o;
|
|
1313
|
+
}, close: function(A) {
|
|
1314
|
+
if (C.isClosed(A))
|
|
1315
|
+
throw new C.ErrnoError(8);
|
|
1316
|
+
A.getdents && (A.getdents = null);
|
|
1317
|
+
try {
|
|
1318
|
+
A.stream_ops.close && A.stream_ops.close(A);
|
|
1319
|
+
} catch (I) {
|
|
1320
|
+
throw I;
|
|
1321
|
+
} finally {
|
|
1322
|
+
C.closeStream(A.fd);
|
|
1323
|
+
}
|
|
1324
|
+
A.fd = null;
|
|
1325
|
+
}, isClosed: function(A) {
|
|
1326
|
+
return A.fd === null;
|
|
1327
|
+
}, llseek: function(A, I, g) {
|
|
1328
|
+
if (C.isClosed(A))
|
|
1329
|
+
throw new C.ErrnoError(8);
|
|
1330
|
+
if (!A.seekable || !A.stream_ops.llseek)
|
|
1331
|
+
throw new C.ErrnoError(70);
|
|
1332
|
+
if (g != 0 && g != 1 && g != 2)
|
|
1333
|
+
throw new C.ErrnoError(28);
|
|
1334
|
+
return A.position = A.stream_ops.llseek(A, I, g), A.ungotten = [], A.position;
|
|
1335
|
+
}, read: function(A, I, g, B, Q) {
|
|
1336
|
+
if (B < 0 || Q < 0)
|
|
1337
|
+
throw new C.ErrnoError(28);
|
|
1338
|
+
if (C.isClosed(A))
|
|
1339
|
+
throw new C.ErrnoError(8);
|
|
1340
|
+
if ((A.flags & 2097155) === 1)
|
|
1341
|
+
throw new C.ErrnoError(8);
|
|
1342
|
+
if (C.isDir(A.node.mode))
|
|
1343
|
+
throw new C.ErrnoError(31);
|
|
1344
|
+
if (!A.stream_ops.read)
|
|
1345
|
+
throw new C.ErrnoError(28);
|
|
1346
|
+
var G = typeof Q < "u";
|
|
1347
|
+
if (!G)
|
|
1348
|
+
Q = A.position;
|
|
1349
|
+
else if (!A.seekable)
|
|
1350
|
+
throw new C.ErrnoError(70);
|
|
1351
|
+
var i = A.stream_ops.read(A, I, g, B, Q);
|
|
1352
|
+
return G || (A.position += i), i;
|
|
1353
|
+
}, write: function(A, I, g, B, Q, G) {
|
|
1354
|
+
if (B < 0 || Q < 0)
|
|
1355
|
+
throw new C.ErrnoError(28);
|
|
1356
|
+
if (C.isClosed(A))
|
|
1357
|
+
throw new C.ErrnoError(8);
|
|
1358
|
+
if ((A.flags & 2097155) === 0)
|
|
1359
|
+
throw new C.ErrnoError(8);
|
|
1360
|
+
if (C.isDir(A.node.mode))
|
|
1361
|
+
throw new C.ErrnoError(31);
|
|
1362
|
+
if (!A.stream_ops.write)
|
|
1363
|
+
throw new C.ErrnoError(28);
|
|
1364
|
+
A.seekable && A.flags & 1024 && C.llseek(A, 0, 2);
|
|
1365
|
+
var i = typeof Q < "u";
|
|
1366
|
+
if (!i)
|
|
1367
|
+
Q = A.position;
|
|
1368
|
+
else if (!A.seekable)
|
|
1369
|
+
throw new C.ErrnoError(70);
|
|
1370
|
+
var D = A.stream_ops.write(A, I, g, B, Q, G);
|
|
1371
|
+
i || (A.position += D);
|
|
1372
|
+
try {
|
|
1373
|
+
A.path && C.trackingDelegate.onWriteToFile && C.trackingDelegate.onWriteToFile(A.path);
|
|
1374
|
+
} catch (h) {
|
|
1375
|
+
DA("FS.trackingDelegate['onWriteToFile']('" + A.path + "') threw an exception: " + h.message);
|
|
1376
|
+
}
|
|
1377
|
+
return D;
|
|
1378
|
+
}, allocate: function(A, I, g) {
|
|
1379
|
+
if (C.isClosed(A))
|
|
1380
|
+
throw new C.ErrnoError(8);
|
|
1381
|
+
if (I < 0 || g <= 0)
|
|
1382
|
+
throw new C.ErrnoError(28);
|
|
1383
|
+
if ((A.flags & 2097155) === 0)
|
|
1384
|
+
throw new C.ErrnoError(8);
|
|
1385
|
+
if (!C.isFile(A.node.mode) && !C.isDir(A.node.mode))
|
|
1386
|
+
throw new C.ErrnoError(43);
|
|
1387
|
+
if (!A.stream_ops.allocate)
|
|
1388
|
+
throw new C.ErrnoError(138);
|
|
1389
|
+
A.stream_ops.allocate(A, I, g);
|
|
1390
|
+
}, mmap: function(A, I, g, B, Q, G) {
|
|
1391
|
+
if ((Q & 2) !== 0 && (G & 2) === 0 && (A.flags & 2097155) !== 2)
|
|
1392
|
+
throw new C.ErrnoError(2);
|
|
1393
|
+
if ((A.flags & 2097155) === 1)
|
|
1394
|
+
throw new C.ErrnoError(2);
|
|
1395
|
+
if (!A.stream_ops.mmap)
|
|
1396
|
+
throw new C.ErrnoError(43);
|
|
1397
|
+
return A.stream_ops.mmap(A, I, g, B, Q, G);
|
|
1398
|
+
}, msync: function(A, I, g, B, Q) {
|
|
1399
|
+
return !A || !A.stream_ops.msync ? 0 : A.stream_ops.msync(A, I, g, B, Q);
|
|
1400
|
+
}, munmap: function(A) {
|
|
1401
|
+
return 0;
|
|
1402
|
+
}, ioctl: function(A, I, g) {
|
|
1403
|
+
if (!A.stream_ops.ioctl)
|
|
1404
|
+
throw new C.ErrnoError(59);
|
|
1405
|
+
return A.stream_ops.ioctl(A, I, g);
|
|
1406
|
+
}, readFile: function(A, I) {
|
|
1407
|
+
if (I = I || {}, I.flags = I.flags || 0, I.encoding = I.encoding || "binary", I.encoding !== "utf8" && I.encoding !== "binary")
|
|
1408
|
+
throw new Error('Invalid encoding type "' + I.encoding + '"');
|
|
1409
|
+
var g, B = C.open(A, I.flags), Q = C.stat(A), G = Q.size, i = new Uint8Array(G);
|
|
1410
|
+
return C.read(B, i, 0, G, 0), I.encoding === "utf8" ? g = qA(i, 0) : I.encoding === "binary" && (g = i), C.close(B), g;
|
|
1411
|
+
}, writeFile: function(A, I, g) {
|
|
1412
|
+
g = g || {}, g.flags = g.flags || 577;
|
|
1413
|
+
var B = C.open(A, g.flags, g.mode);
|
|
1414
|
+
if (typeof I == "string") {
|
|
1415
|
+
var Q = new Uint8Array(YI(I) + 1), G = rI(I, Q, 0, Q.length);
|
|
1416
|
+
C.write(B, Q, 0, G, void 0, g.canOwn);
|
|
1417
|
+
} else if (ArrayBuffer.isView(I))
|
|
1418
|
+
C.write(B, I, 0, I.byteLength, void 0, g.canOwn);
|
|
1419
|
+
else
|
|
1420
|
+
throw new Error("Unsupported data type");
|
|
1421
|
+
C.close(B);
|
|
1422
|
+
}, cwd: function() {
|
|
1423
|
+
return C.currentPath;
|
|
1424
|
+
}, chdir: function(A) {
|
|
1425
|
+
var I = C.lookupPath(A, { follow: !0 });
|
|
1426
|
+
if (I.node === null)
|
|
1427
|
+
throw new C.ErrnoError(44);
|
|
1428
|
+
if (!C.isDir(I.node.mode))
|
|
1429
|
+
throw new C.ErrnoError(54);
|
|
1430
|
+
var g = C.nodePermissions(I.node, "x");
|
|
1431
|
+
if (g)
|
|
1432
|
+
throw new C.ErrnoError(g);
|
|
1433
|
+
C.currentPath = I.path;
|
|
1434
|
+
}, createDefaultDirectories: function() {
|
|
1435
|
+
C.mkdir("/tmp"), C.mkdir("/home"), C.mkdir("/home/web_user");
|
|
1436
|
+
}, createDefaultDevices: function() {
|
|
1437
|
+
C.mkdir("/dev"), C.registerDevice(C.makedev(1, 3), { read: function() {
|
|
1438
|
+
return 0;
|
|
1439
|
+
}, write: function(I, g, B, Q, G) {
|
|
1440
|
+
return Q;
|
|
1441
|
+
} }), C.mkdev("/dev/null", C.makedev(1, 3)), TA.register(C.makedev(5, 0), TA.default_tty_ops), TA.register(C.makedev(6, 0), TA.default_tty1_ops), C.mkdev("/dev/tty", C.makedev(5, 0)), C.mkdev("/dev/tty1", C.makedev(6, 0));
|
|
1442
|
+
var A = EQ();
|
|
1443
|
+
C.createDevice("/dev", "random", A), C.createDevice("/dev", "urandom", A), C.mkdir("/dev/shm"), C.mkdir("/dev/shm/tmp");
|
|
1444
|
+
}, createSpecialDirectories: function() {
|
|
1445
|
+
C.mkdir("/proc");
|
|
1446
|
+
var A = C.mkdir("/proc/self");
|
|
1447
|
+
C.mkdir("/proc/self/fd"), C.mount({ mount: function() {
|
|
1448
|
+
var I = C.createNode(A, "fd", 16895, 73);
|
|
1449
|
+
return I.node_ops = { lookup: function(g, B) {
|
|
1450
|
+
var Q = +B, G = C.getStream(Q);
|
|
1451
|
+
if (!G) throw new C.ErrnoError(8);
|
|
1452
|
+
var i = { parent: null, mount: { mountpoint: "fake" }, node_ops: { readlink: function() {
|
|
1453
|
+
return G.path;
|
|
1454
|
+
} } };
|
|
1455
|
+
return i.parent = i, i;
|
|
1456
|
+
} }, I;
|
|
1457
|
+
} }, {}, "/proc/self/fd");
|
|
1458
|
+
}, createStandardStreams: function() {
|
|
1459
|
+
E.stdin ? C.createDevice("/dev", "stdin", E.stdin) : C.symlink("/dev/tty", "/dev/stdin"), E.stdout ? C.createDevice("/dev", "stdout", null, E.stdout) : C.symlink("/dev/tty", "/dev/stdout"), E.stderr ? C.createDevice("/dev", "stderr", null, E.stderr) : C.symlink("/dev/tty1", "/dev/stderr"), C.open("/dev/stdin", 0), C.open("/dev/stdout", 1), C.open("/dev/stderr", 1);
|
|
1460
|
+
}, ensureErrnoError: function() {
|
|
1461
|
+
C.ErrnoError || (C.ErrnoError = function(I, g) {
|
|
1462
|
+
this.node = g, this.setErrno = function(B) {
|
|
1463
|
+
this.errno = B;
|
|
1464
|
+
}, this.setErrno(I), this.message = "FS error";
|
|
1465
|
+
}, C.ErrnoError.prototype = new Error(), C.ErrnoError.prototype.constructor = C.ErrnoError, [44].forEach(function(A) {
|
|
1466
|
+
C.genericErrors[A] = new C.ErrnoError(A), C.genericErrors[A].stack = "<generic error, no stack>";
|
|
1467
|
+
}));
|
|
1468
|
+
}, staticInit: function() {
|
|
1469
|
+
C.ensureErrnoError(), C.nameTable = new Array(4096), C.mount(P, {}, "/"), C.createDefaultDirectories(), C.createDefaultDevices(), C.createSpecialDirectories(), C.filesystems = { MEMFS: P };
|
|
1470
|
+
}, init: function(A, I, g) {
|
|
1471
|
+
C.init.initialized = !0, C.ensureErrnoError(), E.stdin = A || E.stdin, E.stdout = I || E.stdout, E.stderr = g || E.stderr, C.createStandardStreams();
|
|
1472
|
+
}, quit: function() {
|
|
1473
|
+
C.init.initialized = !1;
|
|
1474
|
+
var A = E._fflush;
|
|
1475
|
+
A && A(0);
|
|
1476
|
+
for (var I = 0; I < C.streams.length; I++) {
|
|
1477
|
+
var g = C.streams[I];
|
|
1478
|
+
g && C.close(g);
|
|
1479
|
+
}
|
|
1480
|
+
}, getMode: function(A, I) {
|
|
1481
|
+
var g = 0;
|
|
1482
|
+
return A && (g |= 365), I && (g |= 146), g;
|
|
1483
|
+
}, findObject: function(A, I) {
|
|
1484
|
+
var g = C.analyzePath(A, I);
|
|
1485
|
+
return g.exists ? g.object : null;
|
|
1486
|
+
}, analyzePath: function(A, I) {
|
|
1487
|
+
try {
|
|
1488
|
+
var g = C.lookupPath(A, { follow: !I });
|
|
1489
|
+
A = g.path;
|
|
1490
|
+
} catch {
|
|
1491
|
+
}
|
|
1492
|
+
var B = { isRoot: !1, exists: !1, error: 0, name: null, path: null, object: null, parentExists: !1, parentPath: null, parentObject: null };
|
|
1493
|
+
try {
|
|
1494
|
+
var g = C.lookupPath(A, { parent: !0 });
|
|
1495
|
+
B.parentExists = !0, B.parentPath = g.path, B.parentObject = g.node, B.name = r.basename(A), g = C.lookupPath(A, { follow: !I }), B.exists = !0, B.path = g.path, B.object = g.node, B.name = g.node.name, B.isRoot = g.path === "/";
|
|
1496
|
+
} catch (Q) {
|
|
1497
|
+
B.error = Q.errno;
|
|
1498
|
+
}
|
|
1499
|
+
return B;
|
|
1500
|
+
}, createPath: function(A, I, g, B) {
|
|
1501
|
+
A = typeof A == "string" ? A : C.getPath(A);
|
|
1502
|
+
for (var Q = I.split("/").reverse(); Q.length; ) {
|
|
1503
|
+
var G = Q.pop();
|
|
1504
|
+
if (G) {
|
|
1505
|
+
var i = r.join2(A, G);
|
|
1506
|
+
try {
|
|
1507
|
+
C.mkdir(i);
|
|
1508
|
+
} catch {
|
|
1509
|
+
}
|
|
1510
|
+
A = i;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return i;
|
|
1514
|
+
}, createFile: function(A, I, g, B, Q) {
|
|
1515
|
+
var G = r.join2(typeof A == "string" ? A : C.getPath(A), I), i = C.getMode(B, Q);
|
|
1516
|
+
return C.create(G, i);
|
|
1517
|
+
}, createDataFile: function(A, I, g, B, Q, G) {
|
|
1518
|
+
var i = I ? r.join2(typeof A == "string" ? A : C.getPath(A), I) : A, D = C.getMode(B, Q), h = C.create(i, D);
|
|
1519
|
+
if (g) {
|
|
1520
|
+
if (typeof g == "string") {
|
|
1521
|
+
for (var o = new Array(g.length), Y = 0, a = g.length; Y < a; ++Y) o[Y] = g.charCodeAt(Y);
|
|
1522
|
+
g = o;
|
|
1523
|
+
}
|
|
1524
|
+
C.chmod(h, D | 146);
|
|
1525
|
+
var k = C.open(h, 577);
|
|
1526
|
+
C.write(k, g, 0, g.length, 0, G), C.close(k), C.chmod(h, D);
|
|
1527
|
+
}
|
|
1528
|
+
return h;
|
|
1529
|
+
}, createDevice: function(A, I, g, B) {
|
|
1530
|
+
var Q = r.join2(typeof A == "string" ? A : C.getPath(A), I), G = C.getMode(!!g, !!B);
|
|
1531
|
+
C.createDevice.major || (C.createDevice.major = 64);
|
|
1532
|
+
var i = C.makedev(C.createDevice.major++, 0);
|
|
1533
|
+
return C.registerDevice(i, { open: function(D) {
|
|
1534
|
+
D.seekable = !1;
|
|
1535
|
+
}, close: function(D) {
|
|
1536
|
+
B && B.buffer && B.buffer.length && B(10);
|
|
1537
|
+
}, read: function(D, h, o, Y, a) {
|
|
1538
|
+
for (var k = 0, N = 0; N < Y; N++) {
|
|
1539
|
+
var b;
|
|
1540
|
+
try {
|
|
1541
|
+
b = g();
|
|
1542
|
+
} catch {
|
|
1543
|
+
throw new C.ErrnoError(29);
|
|
1544
|
+
}
|
|
1545
|
+
if (b === void 0 && k === 0)
|
|
1546
|
+
throw new C.ErrnoError(6);
|
|
1547
|
+
if (b == null) break;
|
|
1548
|
+
k++, h[o + N] = b;
|
|
1549
|
+
}
|
|
1550
|
+
return k && (D.node.timestamp = Date.now()), k;
|
|
1551
|
+
}, write: function(D, h, o, Y, a) {
|
|
1552
|
+
for (var k = 0; k < Y; k++)
|
|
1553
|
+
try {
|
|
1554
|
+
B(h[o + k]);
|
|
1555
|
+
} catch {
|
|
1556
|
+
throw new C.ErrnoError(29);
|
|
1557
|
+
}
|
|
1558
|
+
return Y && (D.node.timestamp = Date.now()), k;
|
|
1559
|
+
} }), C.mkdev(Q, G, i);
|
|
1560
|
+
}, forceLoadFile: function(A) {
|
|
1561
|
+
if (A.isDevice || A.isFolder || A.link || A.contents) return !0;
|
|
1562
|
+
if (typeof XMLHttpRequest < "u")
|
|
1563
|
+
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.");
|
|
1564
|
+
if (v)
|
|
1565
|
+
try {
|
|
1566
|
+
A.contents = KI(v(A.url), !0), A.usedBytes = A.contents.length;
|
|
1567
|
+
} catch {
|
|
1568
|
+
throw new C.ErrnoError(29);
|
|
1569
|
+
}
|
|
1570
|
+
else
|
|
1571
|
+
throw new Error("Cannot load without read() or XMLHttpRequest.");
|
|
1572
|
+
}, createLazyFile: function(A, I, g, B, Q) {
|
|
1573
|
+
function G() {
|
|
1574
|
+
this.lengthKnown = !1, this.chunks = [];
|
|
1575
|
+
}
|
|
1576
|
+
if (G.prototype.get = function(k) {
|
|
1577
|
+
if (!(k > this.length - 1 || k < 0)) {
|
|
1578
|
+
var N = k % this.chunkSize, b = k / this.chunkSize | 0;
|
|
1579
|
+
return this.getter(b)[N];
|
|
1580
|
+
}
|
|
1581
|
+
}, G.prototype.setDataGetter = function(k) {
|
|
1582
|
+
this.getter = k;
|
|
1583
|
+
}, G.prototype.cacheLength = function() {
|
|
1584
|
+
var k = new XMLHttpRequest();
|
|
1585
|
+
if (k.open("HEAD", g, !1), k.send(null), !(k.status >= 200 && k.status < 300 || k.status === 304)) throw new Error("Couldn't load " + g + ". Status: " + k.status);
|
|
1586
|
+
var N = Number(k.getResponseHeader("Content-length")), b, y = (b = k.getResponseHeader("Accept-Ranges")) && b === "bytes", X = (b = k.getResponseHeader("Content-Encoding")) && b === "gzip", V = 1024 * 1024;
|
|
1587
|
+
y || (V = N);
|
|
1588
|
+
var Z = function(q, p) {
|
|
1589
|
+
if (q > p) throw new Error("invalid range (" + q + ", " + p + ") or no bytes requested!");
|
|
1590
|
+
if (p > N - 1) throw new Error("only " + N + " bytes available! programmer error!");
|
|
1591
|
+
var z = new XMLHttpRequest();
|
|
1592
|
+
if (z.open("GET", g, !1), N !== V && z.setRequestHeader("Range", "bytes=" + q + "-" + p), typeof Uint8Array < "u" && (z.responseType = "arraybuffer"), z.overrideMimeType && z.overrideMimeType("text/plain; charset=x-user-defined"), z.send(null), !(z.status >= 200 && z.status < 300 || z.status === 304)) throw new Error("Couldn't load " + g + ". Status: " + z.status);
|
|
1593
|
+
return z.response !== void 0 ? new Uint8Array(z.response || []) : KI(z.responseText || "", !0);
|
|
1594
|
+
}, J = this;
|
|
1595
|
+
J.setDataGetter(function(q) {
|
|
1596
|
+
var p = q * V, z = (q + 1) * V - 1;
|
|
1597
|
+
if (z = Math.min(z, N - 1), typeof J.chunks[q] > "u" && (J.chunks[q] = Z(p, z)), typeof J.chunks[q] > "u") throw new Error("doXHR failed!");
|
|
1598
|
+
return J.chunks[q];
|
|
1599
|
+
}), (X || !N) && (V = N = 1, N = this.getter(0).length, V = N, uA("LazyFiles on gzip forces download of the whole file when length is accessed")), this._length = N, this._chunkSize = V, this.lengthKnown = !0;
|
|
1600
|
+
}, typeof XMLHttpRequest < "u") {
|
|
1601
|
+
if (!s) throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
|
|
1602
|
+
var i = new G();
|
|
1603
|
+
Object.defineProperties(i, { length: { get: function() {
|
|
1604
|
+
return this.lengthKnown || this.cacheLength(), this._length;
|
|
1605
|
+
} }, chunkSize: { get: function() {
|
|
1606
|
+
return this.lengthKnown || this.cacheLength(), this._chunkSize;
|
|
1607
|
+
} } });
|
|
1608
|
+
var D = { isDevice: !1, contents: i };
|
|
1609
|
+
} else
|
|
1610
|
+
var D = { isDevice: !1, url: g };
|
|
1611
|
+
var h = C.createFile(A, I, D, B, Q);
|
|
1612
|
+
D.contents ? h.contents = D.contents : D.url && (h.contents = null, h.url = D.url), Object.defineProperties(h, { usedBytes: { get: function() {
|
|
1613
|
+
return this.contents.length;
|
|
1614
|
+
} } });
|
|
1615
|
+
var o = {}, Y = Object.keys(h.stream_ops);
|
|
1616
|
+
return Y.forEach(function(a) {
|
|
1617
|
+
var k = h.stream_ops[a];
|
|
1618
|
+
o[a] = function() {
|
|
1619
|
+
return C.forceLoadFile(h), k.apply(null, arguments);
|
|
1620
|
+
};
|
|
1621
|
+
}), o.read = function(k, N, b, y, X) {
|
|
1622
|
+
C.forceLoadFile(h);
|
|
1623
|
+
var V = k.node.contents;
|
|
1624
|
+
if (X >= V.length) return 0;
|
|
1625
|
+
var Z = Math.min(V.length - X, y);
|
|
1626
|
+
if (V.slice)
|
|
1627
|
+
for (var J = 0; J < Z; J++)
|
|
1628
|
+
N[b + J] = V[X + J];
|
|
1629
|
+
else
|
|
1630
|
+
for (var J = 0; J < Z; J++)
|
|
1631
|
+
N[b + J] = V.get(X + J);
|
|
1632
|
+
return Z;
|
|
1633
|
+
}, h.stream_ops = o, h;
|
|
1634
|
+
}, createPreloadedFile: function(A, I, g, B, Q, G, i, D, h, o) {
|
|
1635
|
+
Browser.init();
|
|
1636
|
+
var Y = I ? yA.resolve(r.join2(A, I)) : A;
|
|
1637
|
+
function a(k) {
|
|
1638
|
+
function N(y) {
|
|
1639
|
+
o && o(), D || C.createDataFile(A, I, y, B, Q, h), G && G(), kI();
|
|
1640
|
+
}
|
|
1641
|
+
var b = !1;
|
|
1642
|
+
E.preloadPlugins.forEach(function(y) {
|
|
1643
|
+
b || y.canHandle(Y) && (y.handle(k, Y, N, function() {
|
|
1644
|
+
i && i(), kI();
|
|
1645
|
+
}), b = !0);
|
|
1646
|
+
}), b || N(k);
|
|
1647
|
+
}
|
|
1648
|
+
Ag(), typeof g == "string" ? Browser.asyncLoad(g, function(k) {
|
|
1649
|
+
a(k);
|
|
1650
|
+
}, i) : a(g);
|
|
1651
|
+
}, indexedDB: function() {
|
|
1652
|
+
return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
1653
|
+
}, DB_NAME: function() {
|
|
1654
|
+
return "EM_FS_" + window.location.pathname;
|
|
1655
|
+
}, DB_VERSION: 20, DB_STORE_NAME: "FILE_DATA", saveFilesToDB: function(A, I, g) {
|
|
1656
|
+
I = I || function() {
|
|
1657
|
+
}, g = g || function() {
|
|
1658
|
+
};
|
|
1659
|
+
var B = C.indexedDB();
|
|
1660
|
+
try {
|
|
1661
|
+
var Q = B.open(C.DB_NAME(), C.DB_VERSION);
|
|
1662
|
+
} catch (G) {
|
|
1663
|
+
return g(G);
|
|
1664
|
+
}
|
|
1665
|
+
Q.onupgradeneeded = function() {
|
|
1666
|
+
uA("creating db");
|
|
1667
|
+
var i = Q.result;
|
|
1668
|
+
i.createObjectStore(C.DB_STORE_NAME);
|
|
1669
|
+
}, Q.onsuccess = function() {
|
|
1670
|
+
var i = Q.result, D = i.transaction([C.DB_STORE_NAME], "readwrite"), h = D.objectStore(C.DB_STORE_NAME), o = 0, Y = 0, a = A.length;
|
|
1671
|
+
function k() {
|
|
1672
|
+
Y == 0 ? I() : g();
|
|
1673
|
+
}
|
|
1674
|
+
A.forEach(function(N) {
|
|
1675
|
+
var b = h.put(C.analyzePath(N).object.contents, N);
|
|
1676
|
+
b.onsuccess = function() {
|
|
1677
|
+
o++, o + Y == a && k();
|
|
1678
|
+
}, b.onerror = function() {
|
|
1679
|
+
Y++, o + Y == a && k();
|
|
1680
|
+
};
|
|
1681
|
+
}), D.onerror = g;
|
|
1682
|
+
}, Q.onerror = g;
|
|
1683
|
+
}, loadFilesFromDB: function(A, I, g) {
|
|
1684
|
+
I = I || function() {
|
|
1685
|
+
}, g = g || function() {
|
|
1686
|
+
};
|
|
1687
|
+
var B = C.indexedDB();
|
|
1688
|
+
try {
|
|
1689
|
+
var Q = B.open(C.DB_NAME(), C.DB_VERSION);
|
|
1690
|
+
} catch (G) {
|
|
1691
|
+
return g(G);
|
|
1692
|
+
}
|
|
1693
|
+
Q.onupgradeneeded = g, Q.onsuccess = function() {
|
|
1694
|
+
var i = Q.result;
|
|
1695
|
+
try {
|
|
1696
|
+
var D = i.transaction([C.DB_STORE_NAME], "readonly");
|
|
1697
|
+
} catch (N) {
|
|
1698
|
+
g(N);
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
var h = D.objectStore(C.DB_STORE_NAME), o = 0, Y = 0, a = A.length;
|
|
1702
|
+
function k() {
|
|
1703
|
+
Y == 0 ? I() : g();
|
|
1704
|
+
}
|
|
1705
|
+
A.forEach(function(N) {
|
|
1706
|
+
var b = h.get(N);
|
|
1707
|
+
b.onsuccess = function() {
|
|
1708
|
+
C.analyzePath(N).exists && C.unlink(N), C.createDataFile(r.dirname(N), r.basename(N), b.result, !0, !0, !0), o++, o + Y == a && k();
|
|
1709
|
+
}, b.onerror = function() {
|
|
1710
|
+
Y++, o + Y == a && k();
|
|
1711
|
+
};
|
|
1712
|
+
}), D.onerror = g;
|
|
1713
|
+
}, Q.onerror = g;
|
|
1714
|
+
} }, gA = { mappings: {}, DEFAULT_POLLMASK: 5, umask: 511, calculateAt: function(A, I, g) {
|
|
1715
|
+
if (I[0] === "/")
|
|
1716
|
+
return I;
|
|
1717
|
+
var B;
|
|
1718
|
+
if (A === -100)
|
|
1719
|
+
B = C.cwd();
|
|
1720
|
+
else {
|
|
1721
|
+
var Q = C.getStream(A);
|
|
1722
|
+
if (!Q) throw new C.ErrnoError(8);
|
|
1723
|
+
B = Q.path;
|
|
1724
|
+
}
|
|
1725
|
+
if (I.length == 0) {
|
|
1726
|
+
if (!g)
|
|
1727
|
+
throw new C.ErrnoError(44);
|
|
1728
|
+
return B;
|
|
1729
|
+
}
|
|
1730
|
+
return r.join2(B, I);
|
|
1731
|
+
}, doStat: function(A, I, g) {
|
|
1732
|
+
try {
|
|
1733
|
+
var B = A(I);
|
|
1734
|
+
} catch (Q) {
|
|
1735
|
+
if (Q && Q.node && r.normalize(I) !== r.normalize(C.getPath(Q.node)))
|
|
1736
|
+
return -54;
|
|
1737
|
+
throw Q;
|
|
1738
|
+
}
|
|
1739
|
+
return S[g >> 2] = B.dev, S[g + 4 >> 2] = 0, S[g + 8 >> 2] = B.ino, S[g + 12 >> 2] = B.mode, S[g + 16 >> 2] = B.nlink, S[g + 20 >> 2] = B.uid, S[g + 24 >> 2] = B.gid, S[g + 28 >> 2] = B.rdev, S[g + 32 >> 2] = 0, wA = [B.size >>> 0, (_ = B.size, +Math.abs(_) >= 1 ? _ > 0 ? (Math.min(+Math.floor(_ / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((_ - +(~~_ >>> 0)) / 4294967296) >>> 0 : 0)], S[g + 40 >> 2] = wA[0], S[g + 44 >> 2] = wA[1], S[g + 48 >> 2] = 4096, S[g + 52 >> 2] = B.blocks, S[g + 56 >> 2] = B.atime.getTime() / 1e3 | 0, S[g + 60 >> 2] = 0, S[g + 64 >> 2] = B.mtime.getTime() / 1e3 | 0, S[g + 68 >> 2] = 0, S[g + 72 >> 2] = B.ctime.getTime() / 1e3 | 0, S[g + 76 >> 2] = 0, wA = [B.ino >>> 0, (_ = B.ino, +Math.abs(_) >= 1 ? _ > 0 ? (Math.min(+Math.floor(_ / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((_ - +(~~_ >>> 0)) / 4294967296) >>> 0 : 0)], S[g + 80 >> 2] = wA[0], S[g + 84 >> 2] = wA[1], 0;
|
|
1740
|
+
}, doMsync: function(A, I, g, B, Q) {
|
|
1741
|
+
var G = oA.slice(A, A + g);
|
|
1742
|
+
C.msync(I, G, Q, g, B);
|
|
1743
|
+
}, doMkdir: function(A, I) {
|
|
1744
|
+
return A = r.normalize(A), A[A.length - 1] === "/" && (A = A.substr(0, A.length - 1)), C.mkdir(A, I, 0), 0;
|
|
1745
|
+
}, doMknod: function(A, I, g) {
|
|
1746
|
+
switch (I & 61440) {
|
|
1747
|
+
case 32768:
|
|
1748
|
+
case 8192:
|
|
1749
|
+
case 24576:
|
|
1750
|
+
case 4096:
|
|
1751
|
+
case 49152:
|
|
1752
|
+
break;
|
|
1753
|
+
default:
|
|
1754
|
+
return -28;
|
|
1755
|
+
}
|
|
1756
|
+
return C.mknod(A, I, g), 0;
|
|
1757
|
+
}, doReadlink: function(A, I, g) {
|
|
1758
|
+
if (g <= 0) return -28;
|
|
1759
|
+
var B = C.readlink(A), Q = Math.min(g, YI(B)), G = GA[I + Q];
|
|
1760
|
+
return _I(B, I, g + 1), GA[I + Q] = G, Q;
|
|
1761
|
+
}, doAccess: function(A, I) {
|
|
1762
|
+
if (I & -8)
|
|
1763
|
+
return -28;
|
|
1764
|
+
var g, B = C.lookupPath(A, { follow: !0 });
|
|
1765
|
+
if (g = B.node, !g)
|
|
1766
|
+
return -44;
|
|
1767
|
+
var Q = "";
|
|
1768
|
+
return I & 4 && (Q += "r"), I & 2 && (Q += "w"), I & 1 && (Q += "x"), Q && C.nodePermissions(g, Q) ? -2 : 0;
|
|
1769
|
+
}, doDup: function(A, I, g) {
|
|
1770
|
+
var B = C.getStream(g);
|
|
1771
|
+
return B && C.close(B), C.open(A, I, 0, g, g).fd;
|
|
1772
|
+
}, doReadv: function(A, I, g, B) {
|
|
1773
|
+
for (var Q = 0, G = 0; G < g; G++) {
|
|
1774
|
+
var i = S[I + G * 8 >> 2], D = S[I + (G * 8 + 4) >> 2], h = C.read(A, GA, i, D, B);
|
|
1775
|
+
if (h < 0) return -1;
|
|
1776
|
+
if (Q += h, h < D) break;
|
|
1777
|
+
}
|
|
1778
|
+
return Q;
|
|
1779
|
+
}, doWritev: function(A, I, g, B) {
|
|
1780
|
+
for (var Q = 0, G = 0; G < g; G++) {
|
|
1781
|
+
var i = S[I + G * 8 >> 2], D = S[I + (G * 8 + 4) >> 2], h = C.write(A, GA, i, D, B);
|
|
1782
|
+
if (h < 0) return -1;
|
|
1783
|
+
Q += h;
|
|
1784
|
+
}
|
|
1785
|
+
return Q;
|
|
1786
|
+
}, varargs: void 0, get: function() {
|
|
1787
|
+
gA.varargs += 4;
|
|
1788
|
+
var A = S[gA.varargs - 4 >> 2];
|
|
1789
|
+
return A;
|
|
1790
|
+
}, getStr: function(A) {
|
|
1791
|
+
var I = VA(A);
|
|
1792
|
+
return I;
|
|
1793
|
+
}, getStreamFromFD: function(A) {
|
|
1794
|
+
var I = C.getStream(A);
|
|
1795
|
+
if (!I) throw new C.ErrnoError(8);
|
|
1796
|
+
return I;
|
|
1797
|
+
}, get64: function(A, I) {
|
|
1798
|
+
return A;
|
|
1799
|
+
} };
|
|
1800
|
+
function iQ(A, I, g) {
|
|
1801
|
+
gA.varargs = g;
|
|
1802
|
+
try {
|
|
1803
|
+
var B = gA.getStreamFromFD(A);
|
|
1804
|
+
switch (I) {
|
|
1805
|
+
case 0: {
|
|
1806
|
+
var Q = gA.get();
|
|
1807
|
+
if (Q < 0)
|
|
1808
|
+
return -28;
|
|
1809
|
+
var G;
|
|
1810
|
+
return G = C.open(B.path, B.flags, 0, Q), G.fd;
|
|
1811
|
+
}
|
|
1812
|
+
case 1:
|
|
1813
|
+
case 2:
|
|
1814
|
+
return 0;
|
|
1815
|
+
case 3:
|
|
1816
|
+
return B.flags;
|
|
1817
|
+
case 4: {
|
|
1818
|
+
var Q = gA.get();
|
|
1819
|
+
return B.flags |= Q, 0;
|
|
1820
|
+
}
|
|
1821
|
+
case 12: {
|
|
1822
|
+
var Q = gA.get(), i = 0;
|
|
1823
|
+
return cA[Q + i >> 1] = 2, 0;
|
|
1824
|
+
}
|
|
1825
|
+
case 13:
|
|
1826
|
+
case 14:
|
|
1827
|
+
return 0;
|
|
1828
|
+
case 16:
|
|
1829
|
+
case 8:
|
|
1830
|
+
return -28;
|
|
1831
|
+
case 9:
|
|
1832
|
+
return CQ(28), -1;
|
|
1833
|
+
default:
|
|
1834
|
+
return -28;
|
|
1835
|
+
}
|
|
1836
|
+
} catch (D) {
|
|
1837
|
+
return (typeof C > "u" || !(D instanceof C.ErrnoError)) && CA(D), -D.errno;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
function DQ(A, I, g) {
|
|
1841
|
+
try {
|
|
1842
|
+
var B = gA.getStreamFromFD(A);
|
|
1843
|
+
B.getdents || (B.getdents = C.readdir(B.path));
|
|
1844
|
+
for (var Q = 280, G = 0, i = C.llseek(B, 0, 1), D = Math.floor(i / Q); D < B.getdents.length && G + Q <= g; ) {
|
|
1845
|
+
var h, o, Y = B.getdents[D];
|
|
1846
|
+
if (Y[0] === ".")
|
|
1847
|
+
h = 1, o = 4;
|
|
1848
|
+
else {
|
|
1849
|
+
var a = C.lookupNode(B.node, Y);
|
|
1850
|
+
h = a.id, o = C.isChrdev(a.mode) ? 2 : C.isDir(a.mode) ? 4 : C.isLink(a.mode) ? 10 : 8;
|
|
1851
|
+
}
|
|
1852
|
+
wA = [h >>> 0, (_ = h, +Math.abs(_) >= 1 ? _ > 0 ? (Math.min(+Math.floor(_ / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((_ - +(~~_ >>> 0)) / 4294967296) >>> 0 : 0)], S[I + G >> 2] = wA[0], S[I + G + 4 >> 2] = wA[1], wA = [(D + 1) * Q >>> 0, (_ = (D + 1) * Q, +Math.abs(_) >= 1 ? _ > 0 ? (Math.min(+Math.floor(_ / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((_ - +(~~_ >>> 0)) / 4294967296) >>> 0 : 0)], S[I + G + 8 >> 2] = wA[0], S[I + G + 12 >> 2] = wA[1], cA[I + G + 16 >> 1] = 280, GA[I + G + 18 >> 0] = o, _I(Y, I + G + 19, 256), G += Q, D += 1;
|
|
1853
|
+
}
|
|
1854
|
+
return C.llseek(B, D * Q, 0), G;
|
|
1855
|
+
} catch (k) {
|
|
1856
|
+
return (typeof C > "u" || !(k instanceof C.ErrnoError)) && CA(k), -k.errno;
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
function hQ(A, I, g) {
|
|
1860
|
+
gA.varargs = g;
|
|
1861
|
+
try {
|
|
1862
|
+
var B = gA.getStreamFromFD(A);
|
|
1863
|
+
switch (I) {
|
|
1864
|
+
case 21509:
|
|
1865
|
+
case 21505:
|
|
1866
|
+
return B.tty ? 0 : -59;
|
|
1867
|
+
case 21510:
|
|
1868
|
+
case 21511:
|
|
1869
|
+
case 21512:
|
|
1870
|
+
case 21506:
|
|
1871
|
+
case 21507:
|
|
1872
|
+
case 21508:
|
|
1873
|
+
return B.tty ? 0 : -59;
|
|
1874
|
+
case 21519: {
|
|
1875
|
+
if (!B.tty) return -59;
|
|
1876
|
+
var Q = gA.get();
|
|
1877
|
+
return S[Q >> 2] = 0, 0;
|
|
1878
|
+
}
|
|
1879
|
+
case 21520:
|
|
1880
|
+
return B.tty ? -28 : -59;
|
|
1881
|
+
case 21531: {
|
|
1882
|
+
var Q = gA.get();
|
|
1883
|
+
return C.ioctl(B, I, Q);
|
|
1884
|
+
}
|
|
1885
|
+
case 21523:
|
|
1886
|
+
return B.tty ? 0 : -59;
|
|
1887
|
+
case 21524:
|
|
1888
|
+
return B.tty ? 0 : -59;
|
|
1889
|
+
default:
|
|
1890
|
+
CA("bad ioctl syscall " + I);
|
|
1891
|
+
}
|
|
1892
|
+
} catch (G) {
|
|
1893
|
+
return (typeof C > "u" || !(G instanceof C.ErrnoError)) && CA(G), -G.errno;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
function oQ(A, I, g) {
|
|
1897
|
+
gA.varargs = g;
|
|
1898
|
+
try {
|
|
1899
|
+
var B = gA.getStr(A), Q = g ? gA.get() : 0, G = C.open(B, I, Q);
|
|
1900
|
+
return G.fd;
|
|
1901
|
+
} catch (i) {
|
|
1902
|
+
return (typeof C > "u" || !(i instanceof C.ErrnoError)) && CA(i), -i.errno;
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
function YQ(A, I) {
|
|
1906
|
+
try {
|
|
1907
|
+
return A = gA.getStr(A), gA.doStat(C.stat, A, I);
|
|
1908
|
+
} catch (g) {
|
|
1909
|
+
return (typeof C > "u" || !(g instanceof C.ErrnoError)) && CA(g), -g.errno;
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
var NI = {};
|
|
1913
|
+
function tA(A) {
|
|
1914
|
+
for (; A.length; ) {
|
|
1915
|
+
var I = A.pop(), g = A.pop();
|
|
1916
|
+
g(I);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
function gI(A) {
|
|
1920
|
+
return this.fromWireType(lA[A >> 2]);
|
|
1921
|
+
}
|
|
1922
|
+
var nA = {}, pA = {}, RI = {}, wQ = 48, kQ = 57;
|
|
1923
|
+
function FI(A) {
|
|
1924
|
+
if (A === void 0)
|
|
1925
|
+
return "_unknown";
|
|
1926
|
+
A = A.replace(/[^a-zA-Z0-9_]/g, "$");
|
|
1927
|
+
var I = A.charCodeAt(0);
|
|
1928
|
+
return I >= wQ && I <= kQ ? "_" + A : A;
|
|
1929
|
+
}
|
|
1930
|
+
function bI(A, I) {
|
|
1931
|
+
return A = FI(A), new Function("body", "return function " + A + `() {
|
|
1932
|
+
"use strict"; return body.apply(this, arguments);
|
|
1933
|
+
};
|
|
1934
|
+
`)(I);
|
|
1935
|
+
}
|
|
1936
|
+
function gg(A, I) {
|
|
1937
|
+
var g = bI(I, function(B) {
|
|
1938
|
+
this.name = I, this.message = B;
|
|
1939
|
+
var Q = new Error(B).stack;
|
|
1940
|
+
Q !== void 0 && (this.stack = this.toString() + `
|
|
1941
|
+
` + Q.replace(/^Error(:[^\n]*)?\n/, ""));
|
|
1942
|
+
});
|
|
1943
|
+
return g.prototype = Object.create(A.prototype), g.prototype.constructor = g, g.prototype.toString = function() {
|
|
1944
|
+
return this.message === void 0 ? this.name : this.name + ": " + this.message;
|
|
1945
|
+
}, g;
|
|
1946
|
+
}
|
|
1947
|
+
var Xg = void 0;
|
|
1948
|
+
function lI(A) {
|
|
1949
|
+
throw new Xg(A);
|
|
1950
|
+
}
|
|
1951
|
+
function kA(A, I, g) {
|
|
1952
|
+
A.forEach(function(D) {
|
|
1953
|
+
RI[D] = I;
|
|
1954
|
+
});
|
|
1955
|
+
function B(D) {
|
|
1956
|
+
var h = g(D);
|
|
1957
|
+
h.length !== A.length && lI("Mismatched type converter count");
|
|
1958
|
+
for (var o = 0; o < A.length; ++o)
|
|
1959
|
+
SA(A[o], h[o]);
|
|
1960
|
+
}
|
|
1961
|
+
var Q = new Array(I.length), G = [], i = 0;
|
|
1962
|
+
I.forEach(function(D, h) {
|
|
1963
|
+
pA.hasOwnProperty(D) ? Q[h] = pA[D] : (G.push(D), nA.hasOwnProperty(D) || (nA[D] = []), nA[D].push(function() {
|
|
1964
|
+
Q[h] = pA[D], ++i, i === G.length && B(Q);
|
|
1965
|
+
}));
|
|
1966
|
+
}), G.length === 0 && B(Q);
|
|
1967
|
+
}
|
|
1968
|
+
function aQ(A) {
|
|
1969
|
+
var I = NI[A];
|
|
1970
|
+
delete NI[A];
|
|
1971
|
+
var g = I.elements, B = g.length, Q = g.map(function(D) {
|
|
1972
|
+
return D.getterReturnType;
|
|
1973
|
+
}).concat(g.map(function(D) {
|
|
1974
|
+
return D.setterArgumentType;
|
|
1975
|
+
})), G = I.rawConstructor, i = I.rawDestructor;
|
|
1976
|
+
kA([A], Q, function(D) {
|
|
1977
|
+
return g.forEach(function(h, o) {
|
|
1978
|
+
var Y = D[o], a = h.getter, k = h.getterContext, N = D[o + B], b = h.setter, y = h.setterContext;
|
|
1979
|
+
h.read = function(X) {
|
|
1980
|
+
return Y.fromWireType(a(k, X));
|
|
1981
|
+
}, h.write = function(X, V) {
|
|
1982
|
+
var Z = [];
|
|
1983
|
+
b(y, X, N.toWireType(Z, V)), tA(Z);
|
|
1984
|
+
};
|
|
1985
|
+
}), [{ name: I.name, fromWireType: function(h) {
|
|
1986
|
+
for (var o = new Array(B), Y = 0; Y < B; ++Y)
|
|
1987
|
+
o[Y] = g[Y].read(h);
|
|
1988
|
+
return i(h), o;
|
|
1989
|
+
}, toWireType: function(h, o) {
|
|
1990
|
+
if (B !== o.length)
|
|
1991
|
+
throw new TypeError("Incorrect number of tuple elements for " + I.name + ": expected=" + B + ", actual=" + o.length);
|
|
1992
|
+
for (var Y = G(), a = 0; a < B; ++a)
|
|
1993
|
+
g[a].write(Y, o[a]);
|
|
1994
|
+
return h !== null && h.push(i, Y), Y;
|
|
1995
|
+
}, argPackAdvance: 8, readValueFromPointer: gI, destructorFunction: i }];
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
function ZQ(A, I, g, B, Q) {
|
|
1999
|
+
}
|
|
2000
|
+
function SI(A) {
|
|
2001
|
+
switch (A) {
|
|
2002
|
+
case 1:
|
|
2003
|
+
return 0;
|
|
2004
|
+
case 2:
|
|
2005
|
+
return 1;
|
|
2006
|
+
case 4:
|
|
2007
|
+
return 2;
|
|
2008
|
+
case 8:
|
|
2009
|
+
return 3;
|
|
2010
|
+
default:
|
|
2011
|
+
throw new TypeError("Unknown type size: " + A);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
function NQ() {
|
|
2015
|
+
for (var A = new Array(256), I = 0; I < 256; ++I)
|
|
2016
|
+
A[I] = String.fromCharCode(I);
|
|
2017
|
+
Vg = A;
|
|
2018
|
+
}
|
|
2019
|
+
var Vg = void 0;
|
|
2020
|
+
function QA(A) {
|
|
2021
|
+
for (var I = "", g = A; oA[g]; )
|
|
2022
|
+
I += Vg[oA[g++]];
|
|
2023
|
+
return I;
|
|
2024
|
+
}
|
|
2025
|
+
var zA = void 0;
|
|
2026
|
+
function t(A) {
|
|
2027
|
+
throw new zA(A);
|
|
2028
|
+
}
|
|
2029
|
+
function SA(A, I, g) {
|
|
2030
|
+
if (g = g || {}, !("argPackAdvance" in I))
|
|
2031
|
+
throw new TypeError("registerType registeredInstance requires argPackAdvance");
|
|
2032
|
+
var B = I.name;
|
|
2033
|
+
if (A || t('type "' + B + '" must have a positive integer typeid pointer'), pA.hasOwnProperty(A)) {
|
|
2034
|
+
if (g.ignoreDuplicateRegistrations)
|
|
2035
|
+
return;
|
|
2036
|
+
t("Cannot register type '" + B + "' twice");
|
|
2037
|
+
}
|
|
2038
|
+
if (pA[A] = I, delete RI[A], nA.hasOwnProperty(A)) {
|
|
2039
|
+
var Q = nA[A];
|
|
2040
|
+
delete nA[A], Q.forEach(function(G) {
|
|
2041
|
+
G();
|
|
2042
|
+
});
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
2045
|
+
function RQ(A, I, g, B, Q) {
|
|
2046
|
+
var G = SI(g);
|
|
2047
|
+
I = QA(I), SA(A, { name: I, fromWireType: function(i) {
|
|
2048
|
+
return !!i;
|
|
2049
|
+
}, toWireType: function(i, D) {
|
|
2050
|
+
return D ? B : Q;
|
|
2051
|
+
}, argPackAdvance: 8, readValueFromPointer: function(i) {
|
|
2052
|
+
var D;
|
|
2053
|
+
if (g === 1)
|
|
2054
|
+
D = GA;
|
|
2055
|
+
else if (g === 2)
|
|
2056
|
+
D = cA;
|
|
2057
|
+
else if (g === 4)
|
|
2058
|
+
D = S;
|
|
2059
|
+
else
|
|
2060
|
+
throw new TypeError("Unknown boolean type size: " + I);
|
|
2061
|
+
return this.fromWireType(D[i >> G]);
|
|
2062
|
+
}, destructorFunction: null });
|
|
2063
|
+
}
|
|
2064
|
+
function FQ(A) {
|
|
2065
|
+
if (!(this instanceof sA) || !(A instanceof sA))
|
|
2066
|
+
return !1;
|
|
2067
|
+
for (var I = this.$$.ptrType.registeredClass, g = this.$$.ptr, B = A.$$.ptrType.registeredClass, Q = A.$$.ptr; I.baseClass; )
|
|
2068
|
+
g = I.upcast(g), I = I.baseClass;
|
|
2069
|
+
for (; B.baseClass; )
|
|
2070
|
+
Q = B.upcast(Q), B = B.baseClass;
|
|
2071
|
+
return I === B && g === Q;
|
|
2072
|
+
}
|
|
2073
|
+
function bQ(A) {
|
|
2074
|
+
return { count: A.count, deleteScheduled: A.deleteScheduled, preservePointerOnDelete: A.preservePointerOnDelete, ptr: A.ptr, ptrType: A.ptrType, smartPtr: A.smartPtr, smartPtrType: A.smartPtrType };
|
|
2075
|
+
}
|
|
2076
|
+
function Bg(A) {
|
|
2077
|
+
function I(g) {
|
|
2078
|
+
return g.$$.ptrType.registeredClass.name;
|
|
2079
|
+
}
|
|
2080
|
+
t(I(A) + " instance already deleted");
|
|
2081
|
+
}
|
|
2082
|
+
var Qg = !1;
|
|
2083
|
+
function Pg(A) {
|
|
2084
|
+
}
|
|
2085
|
+
function lQ(A) {
|
|
2086
|
+
A.smartPtr ? A.smartPtrType.rawDestructor(A.smartPtr) : A.ptrType.registeredClass.rawDestructor(A.ptr);
|
|
2087
|
+
}
|
|
2088
|
+
function Tg(A) {
|
|
2089
|
+
A.count.value -= 1;
|
|
2090
|
+
var I = A.count.value === 0;
|
|
2091
|
+
I && lQ(A);
|
|
2092
|
+
}
|
|
2093
|
+
function BI(A) {
|
|
2094
|
+
return typeof FinalizationGroup > "u" ? (BI = function(I) {
|
|
2095
|
+
return I;
|
|
2096
|
+
}, A) : (Qg = new FinalizationGroup(function(I) {
|
|
2097
|
+
for (var g = I.next(); !g.done; g = I.next()) {
|
|
2098
|
+
var B = g.value;
|
|
2099
|
+
B.ptr ? Tg(B) : console.warn("object already deleted: " + B.ptr);
|
|
2100
|
+
}
|
|
2101
|
+
}), BI = function(I) {
|
|
2102
|
+
return Qg.register(I, I.$$, I.$$), I;
|
|
2103
|
+
}, Pg = function(I) {
|
|
2104
|
+
Qg.unregister(I.$$);
|
|
2105
|
+
}, BI(A));
|
|
2106
|
+
}
|
|
2107
|
+
function SQ() {
|
|
2108
|
+
if (this.$$.ptr || Bg(this), this.$$.preservePointerOnDelete)
|
|
2109
|
+
return this.$$.count.value += 1, this;
|
|
2110
|
+
var A = BI(Object.create(Object.getPrototypeOf(this), { $$: { value: bQ(this.$$) } }));
|
|
2111
|
+
return A.$$.count.value += 1, A.$$.deleteScheduled = !1, A;
|
|
2112
|
+
}
|
|
2113
|
+
function JQ() {
|
|
2114
|
+
this.$$.ptr || Bg(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && t("Object already scheduled for deletion"), Pg(this), Tg(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0);
|
|
2115
|
+
}
|
|
2116
|
+
function MQ() {
|
|
2117
|
+
return !this.$$.ptr;
|
|
2118
|
+
}
|
|
2119
|
+
var QI = void 0, CI = [];
|
|
2120
|
+
function Cg() {
|
|
2121
|
+
for (; CI.length; ) {
|
|
2122
|
+
var A = CI.pop();
|
|
2123
|
+
A.$$.deleteScheduled = !1, A.delete();
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
function UQ() {
|
|
2127
|
+
return this.$$.ptr || Bg(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && t("Object already scheduled for deletion"), CI.push(this), CI.length === 1 && QI && QI(Cg), this.$$.deleteScheduled = !0, this;
|
|
2128
|
+
}
|
|
2129
|
+
function cQ() {
|
|
2130
|
+
sA.prototype.isAliasOf = FQ, sA.prototype.clone = SQ, sA.prototype.delete = JQ, sA.prototype.isDeleted = MQ, sA.prototype.deleteLater = UQ;
|
|
2131
|
+
}
|
|
2132
|
+
function sA() {
|
|
2133
|
+
}
|
|
2134
|
+
var pg = {};
|
|
2135
|
+
function Eg(A, I, g) {
|
|
2136
|
+
if (A[I].overloadTable === void 0) {
|
|
2137
|
+
var B = A[I];
|
|
2138
|
+
A[I] = function() {
|
|
2139
|
+
return A[I].overloadTable.hasOwnProperty(arguments.length) || t("Function '" + g + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + A[I].overloadTable + ")!"), A[I].overloadTable[arguments.length].apply(this, arguments);
|
|
2140
|
+
}, A[I].overloadTable = [], A[I].overloadTable[B.argCount] = B;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
function Gg(A, I, g) {
|
|
2144
|
+
E.hasOwnProperty(A) ? ((g === void 0 || E[A].overloadTable !== void 0 && E[A].overloadTable[g] !== void 0) && t("Cannot register public name '" + A + "' twice"), Eg(E, A, A), E.hasOwnProperty(g) && t("Cannot register multiple overloads of a function with the same number of arguments (" + g + ")!"), E[A].overloadTable[g] = I) : (E[A] = I, g !== void 0 && (E[A].numArguments = g));
|
|
2145
|
+
}
|
|
2146
|
+
function yQ(A, I, g, B, Q, G, i, D) {
|
|
2147
|
+
this.name = A, this.constructor = I, this.instancePrototype = g, this.rawDestructor = B, this.baseClass = Q, this.getActualType = G, this.upcast = i, this.downcast = D, this.pureVirtualFunctions = [];
|
|
2148
|
+
}
|
|
2149
|
+
function JI(A, I, g) {
|
|
2150
|
+
for (; I !== g; )
|
|
2151
|
+
I.upcast || t("Expected null or instance of " + g.name + ", got an instance of " + I.name), A = I.upcast(A), I = I.baseClass;
|
|
2152
|
+
return A;
|
|
2153
|
+
}
|
|
2154
|
+
function WQ(A, I) {
|
|
2155
|
+
if (I === null)
|
|
2156
|
+
return this.isReference && t("null is not a valid " + this.name), 0;
|
|
2157
|
+
I.$$ || t('Cannot pass "' + fA(I) + '" as a ' + this.name), I.$$.ptr || t("Cannot pass deleted object as a pointer of type " + this.name);
|
|
2158
|
+
var g = I.$$.ptrType.registeredClass, B = JI(I.$$.ptr, g, this.registeredClass);
|
|
2159
|
+
return B;
|
|
2160
|
+
}
|
|
2161
|
+
function dQ(A, I) {
|
|
2162
|
+
var g;
|
|
2163
|
+
if (I === null)
|
|
2164
|
+
return this.isReference && t("null is not a valid " + this.name), this.isSmartPointer ? (g = this.rawConstructor(), A !== null && A.push(this.rawDestructor, g), g) : 0;
|
|
2165
|
+
I.$$ || t('Cannot pass "' + fA(I) + '" as a ' + this.name), I.$$.ptr || t("Cannot pass deleted object as a pointer of type " + this.name), !this.isConst && I.$$.ptrType.isConst && t("Cannot convert argument of type " + (I.$$.smartPtrType ? I.$$.smartPtrType.name : I.$$.ptrType.name) + " to parameter type " + this.name);
|
|
2166
|
+
var B = I.$$.ptrType.registeredClass;
|
|
2167
|
+
if (g = JI(I.$$.ptr, B, this.registeredClass), this.isSmartPointer)
|
|
2168
|
+
switch (I.$$.smartPtr === void 0 && t("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
|
|
2169
|
+
case 0:
|
|
2170
|
+
I.$$.smartPtrType === this ? g = I.$$.smartPtr : t("Cannot convert argument of type " + (I.$$.smartPtrType ? I.$$.smartPtrType.name : I.$$.ptrType.name) + " to parameter type " + this.name);
|
|
2171
|
+
break;
|
|
2172
|
+
case 1:
|
|
2173
|
+
g = I.$$.smartPtr;
|
|
2174
|
+
break;
|
|
2175
|
+
case 2:
|
|
2176
|
+
if (I.$$.smartPtrType === this)
|
|
2177
|
+
g = I.$$.smartPtr;
|
|
2178
|
+
else {
|
|
2179
|
+
var Q = I.clone();
|
|
2180
|
+
g = this.rawShare(g, MA(function() {
|
|
2181
|
+
Q.delete();
|
|
2182
|
+
})), A !== null && A.push(this.rawDestructor, g);
|
|
2183
|
+
}
|
|
2184
|
+
break;
|
|
2185
|
+
default:
|
|
2186
|
+
t("Unsupporting sharing policy");
|
|
2187
|
+
}
|
|
2188
|
+
return g;
|
|
2189
|
+
}
|
|
2190
|
+
function HQ(A, I) {
|
|
2191
|
+
if (I === null)
|
|
2192
|
+
return this.isReference && t("null is not a valid " + this.name), 0;
|
|
2193
|
+
I.$$ || t('Cannot pass "' + fA(I) + '" as a ' + this.name), I.$$.ptr || t("Cannot pass deleted object as a pointer of type " + this.name), I.$$.ptrType.isConst && t("Cannot convert argument of type " + I.$$.ptrType.name + " to parameter type " + this.name);
|
|
2194
|
+
var g = I.$$.ptrType.registeredClass, B = JI(I.$$.ptr, g, this.registeredClass);
|
|
2195
|
+
return B;
|
|
2196
|
+
}
|
|
2197
|
+
function sQ(A) {
|
|
2198
|
+
return this.rawGetPointee && (A = this.rawGetPointee(A)), A;
|
|
2199
|
+
}
|
|
2200
|
+
function mQ(A) {
|
|
2201
|
+
this.rawDestructor && this.rawDestructor(A);
|
|
2202
|
+
}
|
|
2203
|
+
function KQ(A) {
|
|
2204
|
+
A !== null && A.delete();
|
|
2205
|
+
}
|
|
2206
|
+
function Lg(A, I, g) {
|
|
2207
|
+
if (I === g)
|
|
2208
|
+
return A;
|
|
2209
|
+
if (g.baseClass === void 0)
|
|
2210
|
+
return null;
|
|
2211
|
+
var B = Lg(A, I, g.baseClass);
|
|
2212
|
+
return B === null ? null : g.downcast(B);
|
|
2213
|
+
}
|
|
2214
|
+
function XQ() {
|
|
2215
|
+
return Object.keys(EI).length;
|
|
2216
|
+
}
|
|
2217
|
+
function VQ() {
|
|
2218
|
+
var A = [];
|
|
2219
|
+
for (var I in EI)
|
|
2220
|
+
EI.hasOwnProperty(I) && A.push(EI[I]);
|
|
2221
|
+
return A;
|
|
2222
|
+
}
|
|
2223
|
+
function PQ(A) {
|
|
2224
|
+
QI = A, CI.length && QI && QI(Cg);
|
|
2225
|
+
}
|
|
2226
|
+
function TQ() {
|
|
2227
|
+
E.getInheritedInstanceCount = XQ, E.getLiveInheritedInstances = VQ, E.flushPendingDeletes = Cg, E.setDelayFunction = PQ;
|
|
2228
|
+
}
|
|
2229
|
+
var EI = {};
|
|
2230
|
+
function pQ(A, I) {
|
|
2231
|
+
for (I === void 0 && t("ptr should not be undefined"); A.baseClass; )
|
|
2232
|
+
I = A.upcast(I), A = A.baseClass;
|
|
2233
|
+
return I;
|
|
2234
|
+
}
|
|
2235
|
+
function LQ(A, I) {
|
|
2236
|
+
return I = pQ(A, I), EI[I];
|
|
2237
|
+
}
|
|
2238
|
+
function MI(A, I) {
|
|
2239
|
+
(!I.ptrType || !I.ptr) && lI("makeClassHandle requires ptr and ptrType");
|
|
2240
|
+
var g = !!I.smartPtrType, B = !!I.smartPtr;
|
|
2241
|
+
return g !== B && lI("Both smartPtrType and smartPtr must be specified"), I.count = { value: 1 }, BI(Object.create(A, { $$: { value: I } }));
|
|
2242
|
+
}
|
|
2243
|
+
function xQ(A) {
|
|
2244
|
+
var I = this.getPointee(A);
|
|
2245
|
+
if (!I)
|
|
2246
|
+
return this.destructor(A), null;
|
|
2247
|
+
var g = LQ(this.registeredClass, I);
|
|
2248
|
+
if (g !== void 0) {
|
|
2249
|
+
if (g.$$.count.value === 0)
|
|
2250
|
+
return g.$$.ptr = I, g.$$.smartPtr = A, g.clone();
|
|
2251
|
+
var B = g.clone();
|
|
2252
|
+
return this.destructor(A), B;
|
|
2253
|
+
}
|
|
2254
|
+
function Q() {
|
|
2255
|
+
return this.isSmartPointer ? MI(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: I, smartPtrType: this, smartPtr: A }) : MI(this.registeredClass.instancePrototype, { ptrType: this, ptr: A });
|
|
2256
|
+
}
|
|
2257
|
+
var G = this.registeredClass.getActualType(I), i = pg[G];
|
|
2258
|
+
if (!i)
|
|
2259
|
+
return Q.call(this);
|
|
2260
|
+
var D;
|
|
2261
|
+
this.isConst ? D = i.constPointerType : D = i.pointerType;
|
|
2262
|
+
var h = Lg(I, this.registeredClass, D.registeredClass);
|
|
2263
|
+
return h === null ? Q.call(this) : this.isSmartPointer ? MI(D.registeredClass.instancePrototype, { ptrType: D, ptr: h, smartPtrType: this, smartPtr: A }) : MI(D.registeredClass.instancePrototype, { ptrType: D, ptr: h });
|
|
2264
|
+
}
|
|
2265
|
+
function jQ() {
|
|
2266
|
+
JA.prototype.getPointee = sQ, JA.prototype.destructor = mQ, JA.prototype.argPackAdvance = 8, JA.prototype.readValueFromPointer = gI, JA.prototype.deleteObject = KQ, JA.prototype.fromWireType = xQ;
|
|
2267
|
+
}
|
|
2268
|
+
function JA(A, I, g, B, Q, G, i, D, h, o, Y) {
|
|
2269
|
+
this.name = A, this.registeredClass = I, this.isReference = g, this.isConst = B, this.isSmartPointer = Q, this.pointeeType = G, this.sharingPolicy = i, this.rawGetPointee = D, this.rawConstructor = h, this.rawShare = o, this.rawDestructor = Y, !Q && I.baseClass === void 0 ? B ? (this.toWireType = WQ, this.destructorFunction = null) : (this.toWireType = HQ, this.destructorFunction = null) : this.toWireType = dQ;
|
|
2270
|
+
}
|
|
2271
|
+
function xg(A, I, g) {
|
|
2272
|
+
E.hasOwnProperty(A) || lI("Replacing nonexistant public symbol"), E[A].overloadTable !== void 0 && g !== void 0 ? E[A].overloadTable[g] = I : (E[A] = I, E[A].argCount = g);
|
|
2273
|
+
}
|
|
2274
|
+
function uQ(A, I, g) {
|
|
2275
|
+
var B = E["dynCall_" + A];
|
|
2276
|
+
return g && g.length ? B.apply(null, [I].concat(g)) : B.call(null, I);
|
|
2277
|
+
}
|
|
2278
|
+
function qQ(A, I, g) {
|
|
2279
|
+
return A.includes("j") ? uQ(A, I, g) : T.get(I).apply(null, g);
|
|
2280
|
+
}
|
|
2281
|
+
function vQ(A, I) {
|
|
2282
|
+
var g = [];
|
|
2283
|
+
return function() {
|
|
2284
|
+
g.length = arguments.length;
|
|
2285
|
+
for (var B = 0; B < arguments.length; B++)
|
|
2286
|
+
g[B] = arguments[B];
|
|
2287
|
+
return qQ(A, I, g);
|
|
2288
|
+
};
|
|
2289
|
+
}
|
|
2290
|
+
function EA(A, I) {
|
|
2291
|
+
A = QA(A);
|
|
2292
|
+
function g() {
|
|
2293
|
+
return A.includes("j") ? vQ(A, I) : T.get(I);
|
|
2294
|
+
}
|
|
2295
|
+
var B = g();
|
|
2296
|
+
return typeof B != "function" && t("unknown function pointer with signature " + A + ": " + I), B;
|
|
2297
|
+
}
|
|
2298
|
+
var jg = void 0;
|
|
2299
|
+
function ug(A) {
|
|
2300
|
+
var I = eg(A), g = QA(I);
|
|
2301
|
+
return bA(I), g;
|
|
2302
|
+
}
|
|
2303
|
+
function WA(A, I) {
|
|
2304
|
+
var g = [], B = {};
|
|
2305
|
+
function Q(G) {
|
|
2306
|
+
if (!B[G] && !pA[G]) {
|
|
2307
|
+
if (RI[G]) {
|
|
2308
|
+
RI[G].forEach(Q);
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
g.push(G), B[G] = !0;
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
throw I.forEach(Q), new jg(A + ": " + g.map(ug).join([", "]));
|
|
2315
|
+
}
|
|
2316
|
+
function tQ(A, I, g, B, Q, G, i, D, h, o, Y, a, k) {
|
|
2317
|
+
Y = QA(Y), G = EA(Q, G), D && (D = EA(i, D)), o && (o = EA(h, o)), k = EA(a, k);
|
|
2318
|
+
var N = FI(Y);
|
|
2319
|
+
Gg(N, function() {
|
|
2320
|
+
WA("Cannot construct " + Y + " due to unbound types", [B]);
|
|
2321
|
+
}), kA([A, I, g], B ? [B] : [], function(b) {
|
|
2322
|
+
b = b[0];
|
|
2323
|
+
var y, X;
|
|
2324
|
+
B ? (y = b.registeredClass, X = y.instancePrototype) : X = sA.prototype;
|
|
2325
|
+
var V = bI(N, function() {
|
|
2326
|
+
if (Object.getPrototypeOf(this) !== Z)
|
|
2327
|
+
throw new zA("Use 'new' to construct " + Y);
|
|
2328
|
+
if (J.constructor_body === void 0)
|
|
2329
|
+
throw new zA(Y + " has no accessible constructor");
|
|
2330
|
+
var W = J.constructor_body[arguments.length];
|
|
2331
|
+
if (W === void 0)
|
|
2332
|
+
throw new zA("Tried to invoke ctor of " + Y + " with invalid number of parameters (" + arguments.length + ") - expected (" + Object.keys(J.constructor_body).toString() + ") parameters instead!");
|
|
2333
|
+
return W.apply(this, arguments);
|
|
2334
|
+
}), Z = Object.create(X, { constructor: { value: V } });
|
|
2335
|
+
V.prototype = Z;
|
|
2336
|
+
var J = new yQ(Y, V, Z, k, y, G, D, o), q = new JA(Y, J, !0, !1, !1), p = new JA(Y + "*", J, !1, !1, !1), z = new JA(Y + " const*", J, !1, !0, !1);
|
|
2337
|
+
return pg[A] = { pointerType: p, constPointerType: z }, xg(N, V), [q, p, z];
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
function qg(A, I) {
|
|
2341
|
+
if (!(A instanceof Function))
|
|
2342
|
+
throw new TypeError("new_ called with constructor type " + typeof A + " which is not a function");
|
|
2343
|
+
var g = bI(A.name || "unknownFunctionName", function() {
|
|
2344
|
+
});
|
|
2345
|
+
g.prototype = A.prototype;
|
|
2346
|
+
var B = new g(), Q = A.apply(B, I);
|
|
2347
|
+
return Q instanceof Object ? Q : B;
|
|
2348
|
+
}
|
|
2349
|
+
function ig(A, I, g, B, Q) {
|
|
2350
|
+
var G = I.length;
|
|
2351
|
+
G < 2 && t("argTypes array size mismatch! Must at least get return value and 'this' types!");
|
|
2352
|
+
for (var i = I[1] !== null && g !== null, D = !1, h = 1; h < I.length; ++h)
|
|
2353
|
+
if (I[h] !== null && I[h].destructorFunction === void 0) {
|
|
2354
|
+
D = !0;
|
|
2355
|
+
break;
|
|
2356
|
+
}
|
|
2357
|
+
for (var o = I[0].name !== "void", Y = "", a = "", h = 0; h < G - 2; ++h)
|
|
2358
|
+
Y += (h !== 0 ? ", " : "") + "arg" + h, a += (h !== 0 ? ", " : "") + "arg" + h + "Wired";
|
|
2359
|
+
var k = "return function " + FI(A) + "(" + Y + `) {
|
|
2360
|
+
if (arguments.length !== ` + (G - 2) + `) {
|
|
2361
|
+
throwBindingError('function ` + A + " called with ' + arguments.length + ' arguments, expected " + (G - 2) + ` args!');
|
|
2362
|
+
}
|
|
2363
|
+
`;
|
|
2364
|
+
D && (k += `var destructors = [];
|
|
2365
|
+
`);
|
|
2366
|
+
var N = D ? "destructors" : "null", b = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"], y = [t, B, Q, tA, I[0], I[1]];
|
|
2367
|
+
i && (k += "var thisWired = classParam.toWireType(" + N + `, this);
|
|
2368
|
+
`);
|
|
2369
|
+
for (var h = 0; h < G - 2; ++h)
|
|
2370
|
+
k += "var arg" + h + "Wired = argType" + h + ".toWireType(" + N + ", arg" + h + "); // " + I[h + 2].name + `
|
|
2371
|
+
`, b.push("argType" + h), y.push(I[h + 2]);
|
|
2372
|
+
if (i && (a = "thisWired" + (a.length > 0 ? ", " : "") + a), k += (o ? "var rv = " : "") + "invoker(fn" + (a.length > 0 ? ", " : "") + a + `);
|
|
2373
|
+
`, D)
|
|
2374
|
+
k += `runDestructors(destructors);
|
|
2375
|
+
`;
|
|
2376
|
+
else
|
|
2377
|
+
for (var h = i ? 1 : 2; h < I.length; ++h) {
|
|
2378
|
+
var X = h === 1 ? "thisWired" : "arg" + (h - 2) + "Wired";
|
|
2379
|
+
I[h].destructorFunction !== null && (k += X + "_dtor(" + X + "); // " + I[h].name + `
|
|
2380
|
+
`, b.push(X + "_dtor"), y.push(I[h].destructorFunction));
|
|
2381
|
+
}
|
|
2382
|
+
o && (k += `var ret = retType.fromWireType(rv);
|
|
2383
|
+
return ret;
|
|
2384
|
+
`), k += `}
|
|
2385
|
+
`, b.push(k);
|
|
2386
|
+
var V = qg(Function, b).apply(null, y);
|
|
2387
|
+
return V;
|
|
2388
|
+
}
|
|
2389
|
+
function UI(A, I) {
|
|
2390
|
+
for (var g = [], B = 0; B < A; B++)
|
|
2391
|
+
g.push(S[(I >> 2) + B]);
|
|
2392
|
+
return g;
|
|
2393
|
+
}
|
|
2394
|
+
function nQ(A, I, g, B, Q, G, i) {
|
|
2395
|
+
var D = UI(g, B);
|
|
2396
|
+
I = QA(I), G = EA(Q, G), kA([], [A], function(h) {
|
|
2397
|
+
h = h[0];
|
|
2398
|
+
var o = h.name + "." + I;
|
|
2399
|
+
function Y() {
|
|
2400
|
+
WA("Cannot call " + o + " due to unbound types", D);
|
|
2401
|
+
}
|
|
2402
|
+
var a = h.registeredClass.constructor;
|
|
2403
|
+
return a[I] === void 0 ? (Y.argCount = g - 1, a[I] = Y) : (Eg(a, I, o), a[I].overloadTable[g - 1] = Y), kA([], D, function(k) {
|
|
2404
|
+
var N = [k[0], null].concat(k.slice(1)), b = ig(o, N, null, G, i);
|
|
2405
|
+
return a[I].overloadTable === void 0 ? (b.argCount = g - 1, a[I] = b) : a[I].overloadTable[g - 1] = b, [];
|
|
2406
|
+
}), [];
|
|
2407
|
+
});
|
|
2408
|
+
}
|
|
2409
|
+
function vg(A, I, g) {
|
|
2410
|
+
return A instanceof Object || t(g + ' with invalid "this": ' + A), A instanceof I.registeredClass.constructor || t(g + ' incompatible with "this" of type ' + A.constructor.name), A.$$.ptr || t("cannot call emscripten binding method " + g + " on deleted object"), JI(A.$$.ptr, A.$$.ptrType.registeredClass, I.registeredClass);
|
|
2411
|
+
}
|
|
2412
|
+
function zQ(A, I, g, B, Q, G, i, D) {
|
|
2413
|
+
I = QA(I), G = EA(Q, G), kA([], [A], function(h) {
|
|
2414
|
+
h = h[0];
|
|
2415
|
+
var o = h.name + "." + I, Y = { get: function() {
|
|
2416
|
+
WA("Cannot access " + o + " due to unbound types", [g]);
|
|
2417
|
+
}, enumerable: !0, configurable: !0 };
|
|
2418
|
+
return D ? Y.set = function() {
|
|
2419
|
+
WA("Cannot access " + o + " due to unbound types", [g]);
|
|
2420
|
+
} : Y.set = function(a) {
|
|
2421
|
+
t(o + " is a read-only property");
|
|
2422
|
+
}, Object.defineProperty(h.registeredClass.constructor, I, Y), kA([], [g], function(a) {
|
|
2423
|
+
a = a[0];
|
|
2424
|
+
var k = { get: function() {
|
|
2425
|
+
return a.fromWireType(G(B));
|
|
2426
|
+
}, enumerable: !0 };
|
|
2427
|
+
return D && (D = EA(i, D), k.set = function(N) {
|
|
2428
|
+
var b = [];
|
|
2429
|
+
D(B, a.toWireType(b, N)), tA(b);
|
|
2430
|
+
}), Object.defineProperty(h.registeredClass.constructor, I, k), [];
|
|
2431
|
+
}), [];
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2434
|
+
function fQ(A, I, g, B, Q, G) {
|
|
2435
|
+
eI(I > 0);
|
|
2436
|
+
var i = UI(I, g);
|
|
2437
|
+
Q = EA(B, Q);
|
|
2438
|
+
var D = [G], h = [];
|
|
2439
|
+
kA([], [A], function(o) {
|
|
2440
|
+
o = o[0];
|
|
2441
|
+
var Y = "constructor " + o.name;
|
|
2442
|
+
if (o.registeredClass.constructor_body === void 0 && (o.registeredClass.constructor_body = []), o.registeredClass.constructor_body[I - 1] !== void 0)
|
|
2443
|
+
throw new zA("Cannot register multiple constructors with identical number of parameters (" + (I - 1) + ") for class '" + o.name + "'! Overload resolution is currently only performed using the parameter count, not actual type info!");
|
|
2444
|
+
return o.registeredClass.constructor_body[I - 1] = function() {
|
|
2445
|
+
WA("Cannot construct " + o.name + " due to unbound types", i);
|
|
2446
|
+
}, kA([], i, function(a) {
|
|
2447
|
+
return o.registeredClass.constructor_body[I - 1] = function() {
|
|
2448
|
+
arguments.length !== I - 1 && t(Y + " called with " + arguments.length + " arguments, expected " + (I - 1)), h.length = 0, D.length = I;
|
|
2449
|
+
for (var N = 1; N < I; ++N)
|
|
2450
|
+
D[N] = a[N].toWireType(h, arguments[N - 1]);
|
|
2451
|
+
var b = Q.apply(null, D);
|
|
2452
|
+
return tA(h), a[0].fromWireType(b);
|
|
2453
|
+
}, [];
|
|
2454
|
+
}), [];
|
|
2455
|
+
});
|
|
2456
|
+
}
|
|
2457
|
+
function OQ(A, I, g, B, Q, G, i, D) {
|
|
2458
|
+
var h = UI(g, B);
|
|
2459
|
+
I = QA(I), G = EA(Q, G), kA([], [A], function(o) {
|
|
2460
|
+
o = o[0];
|
|
2461
|
+
var Y = o.name + "." + I;
|
|
2462
|
+
D && o.registeredClass.pureVirtualFunctions.push(I);
|
|
2463
|
+
function a() {
|
|
2464
|
+
WA("Cannot call " + Y + " due to unbound types", h);
|
|
2465
|
+
}
|
|
2466
|
+
var k = o.registeredClass.instancePrototype, N = k[I];
|
|
2467
|
+
return N === void 0 || N.overloadTable === void 0 && N.className !== o.name && N.argCount === g - 2 ? (a.argCount = g - 2, a.className = o.name, k[I] = a) : (Eg(k, I, Y), k[I].overloadTable[g - 2] = a), kA([], h, function(b) {
|
|
2468
|
+
var y = ig(Y, b, o, G, i);
|
|
2469
|
+
return k[I].overloadTable === void 0 ? (y.argCount = g - 2, k[I] = y) : k[I].overloadTable[g - 2] = y, [];
|
|
2470
|
+
}), [];
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
function eQ(A, I, g, B, Q, G, i, D, h, o) {
|
|
2474
|
+
I = QA(I), Q = EA(B, Q), kA([], [A], function(Y) {
|
|
2475
|
+
Y = Y[0];
|
|
2476
|
+
var a = Y.name + "." + I, k = { get: function() {
|
|
2477
|
+
WA("Cannot access " + a + " due to unbound types", [g, i]);
|
|
2478
|
+
}, enumerable: !0, configurable: !0 };
|
|
2479
|
+
return h ? k.set = function() {
|
|
2480
|
+
WA("Cannot access " + a + " due to unbound types", [g, i]);
|
|
2481
|
+
} : k.set = function(N) {
|
|
2482
|
+
t(a + " is a read-only property");
|
|
2483
|
+
}, Object.defineProperty(Y.registeredClass.instancePrototype, I, k), kA([], h ? [g, i] : [g], function(N) {
|
|
2484
|
+
var b = N[0], y = { get: function() {
|
|
2485
|
+
var V = vg(this, Y, a + " getter");
|
|
2486
|
+
return b.fromWireType(Q(G, V));
|
|
2487
|
+
}, enumerable: !0 };
|
|
2488
|
+
if (h) {
|
|
2489
|
+
h = EA(D, h);
|
|
2490
|
+
var X = N[1];
|
|
2491
|
+
y.set = function(V) {
|
|
2492
|
+
var Z = vg(this, Y, a + " setter"), J = [];
|
|
2493
|
+
h(o, Z, X.toWireType(J, V)), tA(J);
|
|
2494
|
+
};
|
|
2495
|
+
}
|
|
2496
|
+
return Object.defineProperty(Y.registeredClass.instancePrototype, I, y), [];
|
|
2497
|
+
}), [];
|
|
2498
|
+
});
|
|
2499
|
+
}
|
|
2500
|
+
function rQ(A, I, g) {
|
|
2501
|
+
A = QA(A), kA([], [I], function(B) {
|
|
2502
|
+
return B = B[0], E[A] = B.fromWireType(g), [];
|
|
2503
|
+
});
|
|
2504
|
+
}
|
|
2505
|
+
var Dg = [], RA = [{}, { value: void 0 }, { value: null }, { value: !0 }, { value: !1 }];
|
|
2506
|
+
function hg(A) {
|
|
2507
|
+
A > 4 && --RA[A].refcount === 0 && (RA[A] = void 0, Dg.push(A));
|
|
2508
|
+
}
|
|
2509
|
+
function _Q() {
|
|
2510
|
+
for (var A = 0, I = 5; I < RA.length; ++I)
|
|
2511
|
+
RA[I] !== void 0 && ++A;
|
|
2512
|
+
return A;
|
|
2513
|
+
}
|
|
2514
|
+
function $Q() {
|
|
2515
|
+
for (var A = 5; A < RA.length; ++A)
|
|
2516
|
+
if (RA[A] !== void 0)
|
|
2517
|
+
return RA[A];
|
|
2518
|
+
return null;
|
|
2519
|
+
}
|
|
2520
|
+
function AC() {
|
|
2521
|
+
E.count_emval_handles = _Q, E.get_first_emval = $Q;
|
|
2522
|
+
}
|
|
2523
|
+
function MA(A) {
|
|
2524
|
+
switch (A) {
|
|
2525
|
+
case void 0:
|
|
2526
|
+
return 1;
|
|
2527
|
+
case null:
|
|
2528
|
+
return 2;
|
|
2529
|
+
case !0:
|
|
2530
|
+
return 3;
|
|
2531
|
+
case !1:
|
|
2532
|
+
return 4;
|
|
2533
|
+
default: {
|
|
2534
|
+
var I = Dg.length ? Dg.pop() : RA.length;
|
|
2535
|
+
return RA[I] = { refcount: 1, value: A }, I;
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
function IC(A, I) {
|
|
2540
|
+
I = QA(I), SA(A, { name: I, fromWireType: function(g) {
|
|
2541
|
+
var B = RA[g].value;
|
|
2542
|
+
return hg(g), B;
|
|
2543
|
+
}, toWireType: function(g, B) {
|
|
2544
|
+
return MA(B);
|
|
2545
|
+
}, argPackAdvance: 8, readValueFromPointer: gI, destructorFunction: null });
|
|
2546
|
+
}
|
|
2547
|
+
function gC(A, I, g) {
|
|
2548
|
+
switch (I) {
|
|
2549
|
+
case 0:
|
|
2550
|
+
return function(B) {
|
|
2551
|
+
var Q = g ? GA : oA;
|
|
2552
|
+
return this.fromWireType(Q[B]);
|
|
2553
|
+
};
|
|
2554
|
+
case 1:
|
|
2555
|
+
return function(B) {
|
|
2556
|
+
var Q = g ? cA : $A;
|
|
2557
|
+
return this.fromWireType(Q[B >> 1]);
|
|
2558
|
+
};
|
|
2559
|
+
case 2:
|
|
2560
|
+
return function(B) {
|
|
2561
|
+
var Q = g ? S : lA;
|
|
2562
|
+
return this.fromWireType(Q[B >> 2]);
|
|
2563
|
+
};
|
|
2564
|
+
default:
|
|
2565
|
+
throw new TypeError("Unknown integer type: " + A);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
function BC(A, I, g, B) {
|
|
2569
|
+
var Q = SI(g);
|
|
2570
|
+
I = QA(I);
|
|
2571
|
+
function G() {
|
|
2572
|
+
}
|
|
2573
|
+
G.values = {}, SA(A, { name: I, constructor: G, fromWireType: function(i) {
|
|
2574
|
+
return this.constructor.values[i];
|
|
2575
|
+
}, toWireType: function(i, D) {
|
|
2576
|
+
return D.value;
|
|
2577
|
+
}, argPackAdvance: 8, readValueFromPointer: gC(I, Q, B), destructorFunction: null }), Gg(I, G);
|
|
2578
|
+
}
|
|
2579
|
+
function cI(A, I) {
|
|
2580
|
+
var g = pA[A];
|
|
2581
|
+
return g === void 0 && t(I + " has unknown type " + ug(A)), g;
|
|
2582
|
+
}
|
|
2583
|
+
function QC(A, I, g) {
|
|
2584
|
+
var B = cI(A, "enum");
|
|
2585
|
+
I = QA(I);
|
|
2586
|
+
var Q = B.constructor, G = Object.create(B.constructor.prototype, { value: { value: g }, constructor: { value: bI(B.name + "_" + I, function() {
|
|
2587
|
+
}) } });
|
|
2588
|
+
Q.values[g] = G, Q[I] = G;
|
|
2589
|
+
}
|
|
2590
|
+
function fA(A) {
|
|
2591
|
+
if (A === null)
|
|
2592
|
+
return "null";
|
|
2593
|
+
var I = typeof A;
|
|
2594
|
+
return I === "object" || I === "array" || I === "function" ? A.toString() : "" + A;
|
|
2595
|
+
}
|
|
2596
|
+
function CC(A, I) {
|
|
2597
|
+
switch (I) {
|
|
2598
|
+
case 2:
|
|
2599
|
+
return function(g) {
|
|
2600
|
+
return this.fromWireType(Ug[g >> 2]);
|
|
2601
|
+
};
|
|
2602
|
+
case 3:
|
|
2603
|
+
return function(g) {
|
|
2604
|
+
return this.fromWireType($I[g >> 3]);
|
|
2605
|
+
};
|
|
2606
|
+
default:
|
|
2607
|
+
throw new TypeError("Unknown float type: " + A);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
function EC(A, I, g) {
|
|
2611
|
+
var B = SI(g);
|
|
2612
|
+
I = QA(I), SA(A, { name: I, fromWireType: function(Q) {
|
|
2613
|
+
return Q;
|
|
2614
|
+
}, toWireType: function(Q, G) {
|
|
2615
|
+
if (typeof G != "number" && typeof G != "boolean")
|
|
2616
|
+
throw new TypeError('Cannot convert "' + fA(G) + '" to ' + this.name);
|
|
2617
|
+
return G;
|
|
2618
|
+
}, argPackAdvance: 8, readValueFromPointer: CC(I, B), destructorFunction: null });
|
|
2619
|
+
}
|
|
2620
|
+
function GC(A, I, g, B, Q, G) {
|
|
2621
|
+
var i = UI(I, g);
|
|
2622
|
+
A = QA(A), Q = EA(B, Q), Gg(A, function() {
|
|
2623
|
+
WA("Cannot call " + A + " due to unbound types", i);
|
|
2624
|
+
}, I - 1), kA([], i, function(D) {
|
|
2625
|
+
var h = [D[0], null].concat(D.slice(1));
|
|
2626
|
+
return xg(A, ig(A, h, null, Q, G), I - 1), [];
|
|
2627
|
+
});
|
|
2628
|
+
}
|
|
2629
|
+
function iC(A, I, g) {
|
|
2630
|
+
switch (I) {
|
|
2631
|
+
case 0:
|
|
2632
|
+
return g ? function(Q) {
|
|
2633
|
+
return GA[Q];
|
|
2634
|
+
} : function(Q) {
|
|
2635
|
+
return oA[Q];
|
|
2636
|
+
};
|
|
2637
|
+
case 1:
|
|
2638
|
+
return g ? function(Q) {
|
|
2639
|
+
return cA[Q >> 1];
|
|
2640
|
+
} : function(Q) {
|
|
2641
|
+
return $A[Q >> 1];
|
|
2642
|
+
};
|
|
2643
|
+
case 2:
|
|
2644
|
+
return g ? function(Q) {
|
|
2645
|
+
return S[Q >> 2];
|
|
2646
|
+
} : function(Q) {
|
|
2647
|
+
return lA[Q >> 2];
|
|
2648
|
+
};
|
|
2649
|
+
default:
|
|
2650
|
+
throw new TypeError("Unknown integer type: " + A);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
function DC(A, I, g, B, Q) {
|
|
2654
|
+
I = QA(I), Q === -1 && (Q = 4294967295);
|
|
2655
|
+
var G = SI(g), i = function(o) {
|
|
2656
|
+
return o;
|
|
2657
|
+
};
|
|
2658
|
+
if (B === 0) {
|
|
2659
|
+
var D = 32 - 8 * g;
|
|
2660
|
+
i = function(o) {
|
|
2661
|
+
return o << D >>> D;
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
var h = I.includes("unsigned");
|
|
2665
|
+
SA(A, { name: I, fromWireType: i, toWireType: function(o, Y) {
|
|
2666
|
+
if (typeof Y != "number" && typeof Y != "boolean")
|
|
2667
|
+
throw new TypeError('Cannot convert "' + fA(Y) + '" to ' + this.name);
|
|
2668
|
+
if (Y < B || Y > Q)
|
|
2669
|
+
throw new TypeError('Passing a number "' + fA(Y) + '" from JS side to C/C++ side to an argument of type "' + I + '", which is outside the valid range [' + B + ", " + Q + "]!");
|
|
2670
|
+
return h ? Y >>> 0 : Y | 0;
|
|
2671
|
+
}, argPackAdvance: 8, readValueFromPointer: iC(I, G, B !== 0), destructorFunction: null });
|
|
2672
|
+
}
|
|
2673
|
+
function hC(A, I, g) {
|
|
2674
|
+
var B = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array], Q = B[I];
|
|
2675
|
+
function G(i) {
|
|
2676
|
+
i = i >> 2;
|
|
2677
|
+
var D = lA, h = D[i], o = D[i + 1];
|
|
2678
|
+
return new Q(wI, o, h);
|
|
2679
|
+
}
|
|
2680
|
+
g = QA(g), SA(A, { name: g, fromWireType: G, argPackAdvance: 8, readValueFromPointer: G }, { ignoreDuplicateRegistrations: !0 });
|
|
2681
|
+
}
|
|
2682
|
+
function oC(A, I, g, B, Q, G, i, D, h, o, Y, a) {
|
|
2683
|
+
g = QA(g), G = EA(Q, G), D = EA(i, D), o = EA(h, o), a = EA(Y, a), kA([A], [I], function(k) {
|
|
2684
|
+
k = k[0];
|
|
2685
|
+
var N = new JA(g, k.registeredClass, !1, !1, !0, k, B, G, D, o, a);
|
|
2686
|
+
return [N];
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
function YC(A, I) {
|
|
2690
|
+
I = QA(I);
|
|
2691
|
+
var g = I === "std::string";
|
|
2692
|
+
SA(A, { name: I, fromWireType: function(B) {
|
|
2693
|
+
var Q = lA[B >> 2], G;
|
|
2694
|
+
if (g)
|
|
2695
|
+
for (var i = B + 4, D = 0; D <= Q; ++D) {
|
|
2696
|
+
var h = B + 4 + D;
|
|
2697
|
+
if (D == Q || oA[h] == 0) {
|
|
2698
|
+
var o = h - i, Y = VA(i, o);
|
|
2699
|
+
G === void 0 ? G = Y : (G += "\0", G += Y), i = h + 1;
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
else {
|
|
2703
|
+
for (var a = new Array(Q), D = 0; D < Q; ++D)
|
|
2704
|
+
a[D] = String.fromCharCode(oA[B + 4 + D]);
|
|
2705
|
+
G = a.join("");
|
|
2706
|
+
}
|
|
2707
|
+
return bA(B), G;
|
|
2708
|
+
}, toWireType: function(B, Q) {
|
|
2709
|
+
Q instanceof ArrayBuffer && (Q = new Uint8Array(Q));
|
|
2710
|
+
var G, i = typeof Q == "string";
|
|
2711
|
+
i || Q instanceof Uint8Array || Q instanceof Uint8ClampedArray || Q instanceof Int8Array || t("Cannot pass non-string to std::string"), g && i ? G = function() {
|
|
2712
|
+
return YI(Q);
|
|
2713
|
+
} : G = function() {
|
|
2714
|
+
return Q.length;
|
|
2715
|
+
};
|
|
2716
|
+
var D = G(), h = OA(4 + D + 1);
|
|
2717
|
+
if (lA[h >> 2] = D, g && i)
|
|
2718
|
+
_I(Q, h + 4, D + 1);
|
|
2719
|
+
else if (i)
|
|
2720
|
+
for (var o = 0; o < D; ++o) {
|
|
2721
|
+
var Y = Q.charCodeAt(o);
|
|
2722
|
+
Y > 255 && (bA(h), t("String has UTF-16 code units that do not fit in 8 bits")), oA[h + 4 + o] = Y;
|
|
2723
|
+
}
|
|
2724
|
+
else
|
|
2725
|
+
for (var o = 0; o < D; ++o)
|
|
2726
|
+
oA[h + 4 + o] = Q[o];
|
|
2727
|
+
return B !== null && B.push(bA, h), h;
|
|
2728
|
+
}, argPackAdvance: 8, readValueFromPointer: gI, destructorFunction: function(B) {
|
|
2729
|
+
bA(B);
|
|
2730
|
+
} });
|
|
2731
|
+
}
|
|
2732
|
+
function wC(A, I, g) {
|
|
2733
|
+
g = QA(g);
|
|
2734
|
+
var B, Q, G, i, D;
|
|
2735
|
+
I === 2 ? (B = yB, Q = WB, i = dB, G = function() {
|
|
2736
|
+
return $A;
|
|
2737
|
+
}, D = 1) : I === 4 && (B = HB, Q = sB, i = mB, G = function() {
|
|
2738
|
+
return lA;
|
|
2739
|
+
}, D = 2), SA(A, { name: g, fromWireType: function(h) {
|
|
2740
|
+
for (var o = lA[h >> 2], Y = G(), a, k = h + 4, N = 0; N <= o; ++N) {
|
|
2741
|
+
var b = h + 4 + N * I;
|
|
2742
|
+
if (N == o || Y[b >> D] == 0) {
|
|
2743
|
+
var y = b - k, X = B(k, y);
|
|
2744
|
+
a === void 0 ? a = X : (a += "\0", a += X), k = b + I;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
return bA(h), a;
|
|
2748
|
+
}, toWireType: function(h, o) {
|
|
2749
|
+
typeof o != "string" && t("Cannot pass non-string to C++ string type " + g);
|
|
2750
|
+
var Y = i(o), a = OA(4 + Y + I);
|
|
2751
|
+
return lA[a >> 2] = Y >> D, Q(o, a + 4, Y + I), h !== null && h.push(bA, a), a;
|
|
2752
|
+
}, argPackAdvance: 8, readValueFromPointer: gI, destructorFunction: function(h) {
|
|
2753
|
+
bA(h);
|
|
2754
|
+
} });
|
|
2755
|
+
}
|
|
2756
|
+
function kC(A, I, g, B, Q, G) {
|
|
2757
|
+
NI[A] = { name: QA(I), rawConstructor: EA(g, B), rawDestructor: EA(Q, G), elements: [] };
|
|
2758
|
+
}
|
|
2759
|
+
function aC(A, I, g, B, Q, G, i, D, h) {
|
|
2760
|
+
NI[A].elements.push({ getterReturnType: I, getter: EA(g, B), getterContext: Q, setterArgumentType: G, setter: EA(i, D), setterContext: h });
|
|
2761
|
+
}
|
|
2762
|
+
function ZC(A, I) {
|
|
2763
|
+
I = QA(I), SA(A, { isVoid: !0, name: I, argPackAdvance: 0, fromWireType: function() {
|
|
2764
|
+
}, toWireType: function(g, B) {
|
|
2765
|
+
} });
|
|
2766
|
+
}
|
|
2767
|
+
function dA(A) {
|
|
2768
|
+
return A || t("Cannot use deleted val. handle = " + A), RA[A].value;
|
|
2769
|
+
}
|
|
2770
|
+
function NC(A, I, g) {
|
|
2771
|
+
A = dA(A), I = cI(I, "emval::as");
|
|
2772
|
+
var B = [], Q = MA(B);
|
|
2773
|
+
return S[g >> 2] = Q, I.toWireType(B, A);
|
|
2774
|
+
}
|
|
2775
|
+
function tg(A, I) {
|
|
2776
|
+
for (var g = new Array(A), B = 0; B < A; ++B)
|
|
2777
|
+
g[B] = cI(S[(I >> 2) + B], "parameter " + B);
|
|
2778
|
+
return g;
|
|
2779
|
+
}
|
|
2780
|
+
function RC(A, I, g, B) {
|
|
2781
|
+
A = dA(A);
|
|
2782
|
+
for (var Q = tg(I, g), G = new Array(I), i = 0; i < I; ++i) {
|
|
2783
|
+
var D = Q[i];
|
|
2784
|
+
G[i] = D.readValueFromPointer(B), B += D.argPackAdvance;
|
|
2785
|
+
}
|
|
2786
|
+
var h = A.apply(void 0, G);
|
|
2787
|
+
return MA(h);
|
|
2788
|
+
}
|
|
2789
|
+
var FC = {};
|
|
2790
|
+
function ng(A) {
|
|
2791
|
+
var I = FC[A];
|
|
2792
|
+
return I === void 0 ? QA(A) : I;
|
|
2793
|
+
}
|
|
2794
|
+
var og = [];
|
|
2795
|
+
function bC(A, I, g, B) {
|
|
2796
|
+
A = og[A], I = dA(I), g = ng(g), A(I, g, null, B);
|
|
2797
|
+
}
|
|
2798
|
+
function lC(A) {
|
|
2799
|
+
var I = og.length;
|
|
2800
|
+
return og.push(A), I;
|
|
2801
|
+
}
|
|
2802
|
+
function SC(A, I) {
|
|
2803
|
+
for (var g = tg(A, I), B = g[0], Q = B.name + "_$" + g.slice(1).map(function(N) {
|
|
2804
|
+
return N.name;
|
|
2805
|
+
}).join("_") + "$", G = ["retType"], i = [B], D = "", h = 0; h < A - 1; ++h)
|
|
2806
|
+
D += (h !== 0 ? ", " : "") + "arg" + h, G.push("argType" + h), i.push(g[1 + h]);
|
|
2807
|
+
for (var o = FI("methodCaller_" + Q), Y = "return function " + o + `(handle, name, destructors, args) {
|
|
2808
|
+
`, a = 0, h = 0; h < A - 1; ++h)
|
|
2809
|
+
Y += " var arg" + h + " = argType" + h + ".readValueFromPointer(args" + (a ? "+" + a : "") + `);
|
|
2810
|
+
`, a += g[h + 1].argPackAdvance;
|
|
2811
|
+
Y += " var rv = handle[name](" + D + `);
|
|
2812
|
+
`;
|
|
2813
|
+
for (var h = 0; h < A - 1; ++h)
|
|
2814
|
+
g[h + 1].deleteObject && (Y += " argType" + h + ".deleteObject(arg" + h + `);
|
|
2815
|
+
`);
|
|
2816
|
+
B.isVoid || (Y += ` return retType.toWireType(destructors, rv);
|
|
2817
|
+
`), Y += `};
|
|
2818
|
+
`, G.push(Y);
|
|
2819
|
+
var k = qg(Function, G).apply(null, i);
|
|
2820
|
+
return lC(k);
|
|
2821
|
+
}
|
|
2822
|
+
function JC(A, I) {
|
|
2823
|
+
return A = dA(A), I = dA(I), MA(A[I]);
|
|
2824
|
+
}
|
|
2825
|
+
function MC(A) {
|
|
2826
|
+
A > 4 && (RA[A].refcount += 1);
|
|
2827
|
+
}
|
|
2828
|
+
function UC() {
|
|
2829
|
+
return MA([]);
|
|
2830
|
+
}
|
|
2831
|
+
function cC(A) {
|
|
2832
|
+
return MA(ng(A));
|
|
2833
|
+
}
|
|
2834
|
+
function yC() {
|
|
2835
|
+
return MA({});
|
|
2836
|
+
}
|
|
2837
|
+
function WC(A) {
|
|
2838
|
+
var I = RA[A].value;
|
|
2839
|
+
tA(I), hg(A);
|
|
2840
|
+
}
|
|
2841
|
+
function dC(A, I, g) {
|
|
2842
|
+
A = dA(A), I = dA(I), g = dA(g), A[I] = g;
|
|
2843
|
+
}
|
|
2844
|
+
function HC(A, I) {
|
|
2845
|
+
A = cI(A, "_emval_take_value");
|
|
2846
|
+
var g = A.readValueFromPointer(I);
|
|
2847
|
+
return MA(g);
|
|
2848
|
+
}
|
|
2849
|
+
function sC(A) {
|
|
2850
|
+
return A = dA(A), MA(typeof A);
|
|
2851
|
+
}
|
|
2852
|
+
function mC() {
|
|
2853
|
+
CA();
|
|
2854
|
+
}
|
|
2855
|
+
var Yg = [];
|
|
2856
|
+
function KC(A, I) {
|
|
2857
|
+
Yg.length = 0;
|
|
2858
|
+
var g;
|
|
2859
|
+
for (I >>= 2; g = oA[A++]; ) {
|
|
2860
|
+
var B = g < 105;
|
|
2861
|
+
B && I & 1 && I++, Yg.push(B ? $I[I++ >> 1] : S[I]), ++I;
|
|
2862
|
+
}
|
|
2863
|
+
return Yg;
|
|
2864
|
+
}
|
|
2865
|
+
function XC(A, I, g) {
|
|
2866
|
+
var B = KC(I, g);
|
|
2867
|
+
return tB[A].apply(null, B);
|
|
2868
|
+
}
|
|
2869
|
+
function VC(A, I, g) {
|
|
2870
|
+
oA.copyWithin(A, I, I + g);
|
|
2871
|
+
}
|
|
2872
|
+
function PC(A) {
|
|
2873
|
+
try {
|
|
2874
|
+
return oI.grow(A - wI.byteLength + 65535 >>> 16), cg(oI.buffer), 1;
|
|
2875
|
+
} catch {
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
function TC(A) {
|
|
2879
|
+
var I = oA.length;
|
|
2880
|
+
A = A >>> 0;
|
|
2881
|
+
var g = 2147483648;
|
|
2882
|
+
if (A > g)
|
|
2883
|
+
return !1;
|
|
2884
|
+
for (var B = 1; B <= 4; B *= 2) {
|
|
2885
|
+
var Q = I + 33554432 / B, G = Math.min(g, VB(Math.max(A, Q), 65536)), i = PC(G);
|
|
2886
|
+
if (i)
|
|
2887
|
+
return !0;
|
|
2888
|
+
}
|
|
2889
|
+
return !1;
|
|
2890
|
+
}
|
|
2891
|
+
var zg = {};
|
|
2892
|
+
function pC() {
|
|
2893
|
+
return x || "./this.program";
|
|
2894
|
+
}
|
|
2895
|
+
function GI() {
|
|
2896
|
+
if (!GI.strings) {
|
|
2897
|
+
var A = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8", I = { USER: "web_user", LOGNAME: "web_user", PATH: "/", PWD: "/", HOME: "/home/web_user", LANG: A, _: pC() };
|
|
2898
|
+
for (var g in zg)
|
|
2899
|
+
I[g] = zg[g];
|
|
2900
|
+
var B = [];
|
|
2901
|
+
for (var g in I)
|
|
2902
|
+
B.push(g + "=" + I[g]);
|
|
2903
|
+
GI.strings = B;
|
|
2904
|
+
}
|
|
2905
|
+
return GI.strings;
|
|
2906
|
+
}
|
|
2907
|
+
function LC(A, I) {
|
|
2908
|
+
try {
|
|
2909
|
+
var g = 0;
|
|
2910
|
+
return GI().forEach(function(B, Q) {
|
|
2911
|
+
var G = I + g;
|
|
2912
|
+
S[A + Q * 4 >> 2] = G, XB(B, G), g += B.length + 1;
|
|
2913
|
+
}), 0;
|
|
2914
|
+
} catch (B) {
|
|
2915
|
+
return (typeof C > "u" || !(B instanceof C.ErrnoError)) && CA(B), B.errno;
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
function xC(A, I) {
|
|
2919
|
+
try {
|
|
2920
|
+
var g = GI();
|
|
2921
|
+
S[A >> 2] = g.length;
|
|
2922
|
+
var B = 0;
|
|
2923
|
+
return g.forEach(function(Q) {
|
|
2924
|
+
B += Q.length + 1;
|
|
2925
|
+
}), S[I >> 2] = B, 0;
|
|
2926
|
+
} catch (Q) {
|
|
2927
|
+
return (typeof C > "u" || !(Q instanceof C.ErrnoError)) && CA(Q), Q.errno;
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
function jC(A) {
|
|
2931
|
+
try {
|
|
2932
|
+
var I = gA.getStreamFromFD(A);
|
|
2933
|
+
return C.close(I), 0;
|
|
2934
|
+
} catch (g) {
|
|
2935
|
+
return (typeof C > "u" || !(g instanceof C.ErrnoError)) && CA(g), g.errno;
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
function uC(A, I, g, B) {
|
|
2939
|
+
try {
|
|
2940
|
+
var Q = gA.getStreamFromFD(A), G = gA.doReadv(Q, I, g);
|
|
2941
|
+
return S[B >> 2] = G, 0;
|
|
2942
|
+
} catch (i) {
|
|
2943
|
+
return (typeof C > "u" || !(i instanceof C.ErrnoError)) && CA(i), i.errno;
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
function qC(A, I, g, B, Q) {
|
|
2947
|
+
try {
|
|
2948
|
+
var G = gA.getStreamFromFD(A), i = 4294967296, D = g * i + (I >>> 0), h = 9007199254740992;
|
|
2949
|
+
return D <= -h || D >= h ? -61 : (C.llseek(G, D, B), wA = [G.position >>> 0, (_ = G.position, +Math.abs(_) >= 1 ? _ > 0 ? (Math.min(+Math.floor(_ / 4294967296), 4294967295) | 0) >>> 0 : ~~+Math.ceil((_ - +(~~_ >>> 0)) / 4294967296) >>> 0 : 0)], S[Q >> 2] = wA[0], S[Q + 4 >> 2] = wA[1], G.getdents && D === 0 && B === 0 && (G.getdents = null), 0);
|
|
2950
|
+
} catch (o) {
|
|
2951
|
+
return (typeof C > "u" || !(o instanceof C.ErrnoError)) && CA(o), o.errno;
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2954
|
+
function vC(A, I, g, B) {
|
|
2955
|
+
try {
|
|
2956
|
+
var Q = gA.getStreamFromFD(A), G = gA.doWritev(Q, I, g);
|
|
2957
|
+
return S[B >> 2] = G, 0;
|
|
2958
|
+
} catch (i) {
|
|
2959
|
+
return (typeof C > "u" || !(i instanceof C.ErrnoError)) && CA(i), i.errno;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
function tC() {
|
|
2963
|
+
return cB();
|
|
2964
|
+
}
|
|
2965
|
+
function nC(A) {
|
|
2966
|
+
return A;
|
|
2967
|
+
}
|
|
2968
|
+
function zC(A) {
|
|
2969
|
+
ZA(A);
|
|
2970
|
+
}
|
|
2971
|
+
function yI(A) {
|
|
2972
|
+
return A % 4 === 0 && (A % 100 !== 0 || A % 400 === 0);
|
|
2973
|
+
}
|
|
2974
|
+
function wg(A, I) {
|
|
2975
|
+
for (var g = 0, B = 0; B <= I; g += A[B++])
|
|
2976
|
+
;
|
|
2977
|
+
return g;
|
|
2978
|
+
}
|
|
2979
|
+
var WI = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], dI = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2980
|
+
function HI(A, I) {
|
|
2981
|
+
for (var g = new Date(A.getTime()); I > 0; ) {
|
|
2982
|
+
var B = yI(g.getFullYear()), Q = g.getMonth(), G = (B ? WI : dI)[Q];
|
|
2983
|
+
if (I > G - g.getDate())
|
|
2984
|
+
I -= G - g.getDate() + 1, g.setDate(1), Q < 11 ? g.setMonth(Q + 1) : (g.setMonth(0), g.setFullYear(g.getFullYear() + 1));
|
|
2985
|
+
else
|
|
2986
|
+
return g.setDate(g.getDate() + I), g;
|
|
2987
|
+
}
|
|
2988
|
+
return g;
|
|
2989
|
+
}
|
|
2990
|
+
function fC(A, I, g, B) {
|
|
2991
|
+
var Q = S[B + 40 >> 2], G = { tm_sec: S[B >> 2], tm_min: S[B + 4 >> 2], tm_hour: S[B + 8 >> 2], tm_mday: S[B + 12 >> 2], tm_mon: S[B + 16 >> 2], tm_year: S[B + 20 >> 2], tm_wday: S[B + 24 >> 2], tm_yday: S[B + 28 >> 2], tm_isdst: S[B + 32 >> 2], tm_gmtoff: S[B + 36 >> 2], tm_zone: Q ? VA(Q) : "" }, i = VA(g), D = { "%c": "%a %b %d %H:%M:%S %Y", "%D": "%m/%d/%y", "%F": "%Y-%m-%d", "%h": "%b", "%r": "%I:%M:%S %p", "%R": "%H:%M", "%T": "%H:%M:%S", "%x": "%m/%d/%y", "%X": "%H:%M:%S", "%Ec": "%c", "%EC": "%C", "%Ex": "%m/%d/%y", "%EX": "%H:%M:%S", "%Ey": "%y", "%EY": "%Y", "%Od": "%d", "%Oe": "%e", "%OH": "%H", "%OI": "%I", "%Om": "%m", "%OM": "%M", "%OS": "%S", "%Ou": "%u", "%OU": "%U", "%OV": "%V", "%Ow": "%w", "%OW": "%W", "%Oy": "%y" };
|
|
2992
|
+
for (var h in D)
|
|
2993
|
+
i = i.replace(new RegExp(h, "g"), D[h]);
|
|
2994
|
+
var o = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Y = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
2995
|
+
function a(Z, J, q) {
|
|
2996
|
+
for (var p = typeof Z == "number" ? Z.toString() : Z || ""; p.length < J; )
|
|
2997
|
+
p = q[0] + p;
|
|
2998
|
+
return p;
|
|
2999
|
+
}
|
|
3000
|
+
function k(Z, J) {
|
|
3001
|
+
return a(Z, J, "0");
|
|
3002
|
+
}
|
|
3003
|
+
function N(Z, J) {
|
|
3004
|
+
function q(z) {
|
|
3005
|
+
return z < 0 ? -1 : z > 0 ? 1 : 0;
|
|
3006
|
+
}
|
|
3007
|
+
var p;
|
|
3008
|
+
return (p = q(Z.getFullYear() - J.getFullYear())) === 0 && (p = q(Z.getMonth() - J.getMonth())) === 0 && (p = q(Z.getDate() - J.getDate())), p;
|
|
3009
|
+
}
|
|
3010
|
+
function b(Z) {
|
|
3011
|
+
switch (Z.getDay()) {
|
|
3012
|
+
case 0:
|
|
3013
|
+
return new Date(Z.getFullYear() - 1, 11, 29);
|
|
3014
|
+
case 1:
|
|
3015
|
+
return Z;
|
|
3016
|
+
case 2:
|
|
3017
|
+
return new Date(Z.getFullYear(), 0, 3);
|
|
3018
|
+
case 3:
|
|
3019
|
+
return new Date(Z.getFullYear(), 0, 2);
|
|
3020
|
+
case 4:
|
|
3021
|
+
return new Date(Z.getFullYear(), 0, 1);
|
|
3022
|
+
case 5:
|
|
3023
|
+
return new Date(Z.getFullYear() - 1, 11, 31);
|
|
3024
|
+
case 6:
|
|
3025
|
+
return new Date(Z.getFullYear() - 1, 11, 30);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
function y(Z) {
|
|
3029
|
+
var J = HI(new Date(Z.tm_year + 1900, 0, 1), Z.tm_yday), q = new Date(J.getFullYear(), 0, 4), p = new Date(J.getFullYear() + 1, 0, 4), z = b(q), W = b(p);
|
|
3030
|
+
return N(z, J) <= 0 ? N(W, J) <= 0 ? J.getFullYear() + 1 : J.getFullYear() : J.getFullYear() - 1;
|
|
3031
|
+
}
|
|
3032
|
+
var X = { "%a": function(Z) {
|
|
3033
|
+
return o[Z.tm_wday].substring(0, 3);
|
|
3034
|
+
}, "%A": function(Z) {
|
|
3035
|
+
return o[Z.tm_wday];
|
|
3036
|
+
}, "%b": function(Z) {
|
|
3037
|
+
return Y[Z.tm_mon].substring(0, 3);
|
|
3038
|
+
}, "%B": function(Z) {
|
|
3039
|
+
return Y[Z.tm_mon];
|
|
3040
|
+
}, "%C": function(Z) {
|
|
3041
|
+
var J = Z.tm_year + 1900;
|
|
3042
|
+
return k(J / 100 | 0, 2);
|
|
3043
|
+
}, "%d": function(Z) {
|
|
3044
|
+
return k(Z.tm_mday, 2);
|
|
3045
|
+
}, "%e": function(Z) {
|
|
3046
|
+
return a(Z.tm_mday, 2, " ");
|
|
3047
|
+
}, "%g": function(Z) {
|
|
3048
|
+
return y(Z).toString().substring(2);
|
|
3049
|
+
}, "%G": function(Z) {
|
|
3050
|
+
return y(Z);
|
|
3051
|
+
}, "%H": function(Z) {
|
|
3052
|
+
return k(Z.tm_hour, 2);
|
|
3053
|
+
}, "%I": function(Z) {
|
|
3054
|
+
var J = Z.tm_hour;
|
|
3055
|
+
return J == 0 ? J = 12 : J > 12 && (J -= 12), k(J, 2);
|
|
3056
|
+
}, "%j": function(Z) {
|
|
3057
|
+
return k(Z.tm_mday + wg(yI(Z.tm_year + 1900) ? WI : dI, Z.tm_mon - 1), 3);
|
|
3058
|
+
}, "%m": function(Z) {
|
|
3059
|
+
return k(Z.tm_mon + 1, 2);
|
|
3060
|
+
}, "%M": function(Z) {
|
|
3061
|
+
return k(Z.tm_min, 2);
|
|
3062
|
+
}, "%n": function() {
|
|
3063
|
+
return `
|
|
3064
|
+
`;
|
|
3065
|
+
}, "%p": function(Z) {
|
|
3066
|
+
return Z.tm_hour >= 0 && Z.tm_hour < 12 ? "AM" : "PM";
|
|
3067
|
+
}, "%S": function(Z) {
|
|
3068
|
+
return k(Z.tm_sec, 2);
|
|
3069
|
+
}, "%t": function() {
|
|
3070
|
+
return " ";
|
|
3071
|
+
}, "%u": function(Z) {
|
|
3072
|
+
return Z.tm_wday || 7;
|
|
3073
|
+
}, "%U": function(Z) {
|
|
3074
|
+
var J = new Date(Z.tm_year + 1900, 0, 1), q = J.getDay() === 0 ? J : HI(J, 7 - J.getDay()), p = new Date(Z.tm_year + 1900, Z.tm_mon, Z.tm_mday);
|
|
3075
|
+
if (N(q, p) < 0) {
|
|
3076
|
+
var z = wg(yI(p.getFullYear()) ? WI : dI, p.getMonth() - 1) - 31, W = 31 - q.getDate(), c = W + z + p.getDate();
|
|
3077
|
+
return k(Math.ceil(c / 7), 2);
|
|
3078
|
+
}
|
|
3079
|
+
return N(q, J) === 0 ? "01" : "00";
|
|
3080
|
+
}, "%V": function(Z) {
|
|
3081
|
+
var J = new Date(Z.tm_year + 1900, 0, 4), q = new Date(Z.tm_year + 1901, 0, 4), p = b(J), z = b(q), W = HI(new Date(Z.tm_year + 1900, 0, 1), Z.tm_yday);
|
|
3082
|
+
if (N(W, p) < 0)
|
|
3083
|
+
return "53";
|
|
3084
|
+
if (N(z, W) <= 0)
|
|
3085
|
+
return "01";
|
|
3086
|
+
var c;
|
|
3087
|
+
return p.getFullYear() < Z.tm_year + 1900 ? c = Z.tm_yday + 32 - p.getDate() : c = Z.tm_yday + 1 - p.getDate(), k(Math.ceil(c / 7), 2);
|
|
3088
|
+
}, "%w": function(Z) {
|
|
3089
|
+
return Z.tm_wday;
|
|
3090
|
+
}, "%W": function(Z) {
|
|
3091
|
+
var J = new Date(Z.tm_year, 0, 1), q = J.getDay() === 1 ? J : HI(J, J.getDay() === 0 ? 1 : 7 - J.getDay() + 1), p = new Date(Z.tm_year + 1900, Z.tm_mon, Z.tm_mday);
|
|
3092
|
+
if (N(q, p) < 0) {
|
|
3093
|
+
var z = wg(yI(p.getFullYear()) ? WI : dI, p.getMonth() - 1) - 31, W = 31 - q.getDate(), c = W + z + p.getDate();
|
|
3094
|
+
return k(Math.ceil(c / 7), 2);
|
|
3095
|
+
}
|
|
3096
|
+
return N(q, J) === 0 ? "01" : "00";
|
|
3097
|
+
}, "%y": function(Z) {
|
|
3098
|
+
return (Z.tm_year + 1900).toString().substring(2);
|
|
3099
|
+
}, "%Y": function(Z) {
|
|
3100
|
+
return Z.tm_year + 1900;
|
|
3101
|
+
}, "%z": function(Z) {
|
|
3102
|
+
var J = Z.tm_gmtoff, q = J >= 0;
|
|
3103
|
+
return J = Math.abs(J) / 60, J = J / 60 * 100 + J % 60, (q ? "+" : "-") + ("0000" + J).slice(-4);
|
|
3104
|
+
}, "%Z": function(Z) {
|
|
3105
|
+
return Z.tm_zone;
|
|
3106
|
+
}, "%%": function() {
|
|
3107
|
+
return "%";
|
|
3108
|
+
} };
|
|
3109
|
+
for (var h in X)
|
|
3110
|
+
i.includes(h) && (i = i.replace(new RegExp(h, "g"), X[h](G)));
|
|
3111
|
+
var V = KI(i, !1);
|
|
3112
|
+
return V.length > I ? 0 : (KB(V, A), V.length - 1);
|
|
3113
|
+
}
|
|
3114
|
+
function OC(A, I, g, B) {
|
|
3115
|
+
return fC(A, I, g, B);
|
|
3116
|
+
}
|
|
3117
|
+
var fg = function(A, I, g, B) {
|
|
3118
|
+
A || (A = this), this.parent = A, this.mount = A.mount, this.mounted = null, this.id = C.nextInode++, this.name = I, this.mode = g, this.node_ops = {}, this.stream_ops = {}, this.rdev = B;
|
|
3119
|
+
}, sI = 365, mI = 146;
|
|
3120
|
+
Object.defineProperties(fg.prototype, { read: { get: function() {
|
|
3121
|
+
return (this.mode & sI) === sI;
|
|
3122
|
+
}, set: function(A) {
|
|
3123
|
+
A ? this.mode |= sI : this.mode &= ~sI;
|
|
3124
|
+
} }, write: { get: function() {
|
|
3125
|
+
return (this.mode & mI) === mI;
|
|
3126
|
+
}, set: function(A) {
|
|
3127
|
+
A ? this.mode |= mI : this.mode &= ~mI;
|
|
3128
|
+
} }, isFolder: { get: function() {
|
|
3129
|
+
return C.isDir(this.mode);
|
|
3130
|
+
} }, isDevice: { get: function() {
|
|
3131
|
+
return C.isChrdev(this.mode);
|
|
3132
|
+
} } }), C.FSNode = fg, C.staticInit(), E.FS_createPath = C.createPath, E.FS_createDataFile = C.createDataFile, E.FS_createPreloadedFile = C.createPreloadedFile, E.FS_createLazyFile = C.createLazyFile, E.FS_createDevice = C.createDevice, E.FS_unlink = C.unlink, Xg = E.InternalError = gg(Error, "InternalError"), NQ(), zA = E.BindingError = gg(Error, "BindingError"), cQ(), jQ(), TQ(), jg = E.UnboundTypeError = gg(Error, "UnboundTypeError"), AC();
|
|
3133
|
+
function KI(A, I, g) {
|
|
3134
|
+
var B = YI(A) + 1, Q = new Array(B), G = rI(A, Q, 0, Q.length);
|
|
3135
|
+
return I && (Q.length = G), Q;
|
|
3136
|
+
}
|
|
3137
|
+
var eC = { B: nB, o: zB, q: OB, A: rB, b: $B, h: AQ, Ka: IQ, p: Kg, fa: gQ, M: BQ, ua: QQ, e: _B, ha: iQ, Da: DQ, Ba: hQ, ja: oQ, Ca: YQ, Qa: aQ, Va: ZQ, Fa: RQ, u: tQ, y: nQ, r: zQ, z: fQ, j: OQ, H: eQ, U: rQ, Ea: IC, T: BC, S: QC, ka: EC, G: GC, O: DC, N: hC, s: oC, la: YC, ba: wC, pa: kC, $: aC, Ga: ZC, Q: NC, Ra: RC, _: bC, ia: hg, Z: SC, Pa: JC, ma: MC, Ta: UC, Oa: cC, La: yC, Na: WC, Sa: dC, C: HC, Ma: sC, wa: mC, ea: XC, ta: VC, aa: TC, xa: LC, ya: xC, X: jC, Aa: uC, Ua: qC, za: vC, a: tC, Ha: ZE, da: aE, Ja: oE, ra: yE, oa: lE, x: EE, g: rC, Ia: wE, L: YE, na: SE, Y: RE, c: IE, i: BE, v: AE, ga: WE, t: iE, K: kE, F: bE, I: UE, W: dE, l: DE, m: CE, sa: cE, P: hE, f: $C, qa: sE, d: _C, k: gE, ca: JE, n: QE, w: GE, D: FE, J: ME, R: NE, V: HE, E: nC, Wa: zC, va: OC };
|
|
3138
|
+
vB(), E.___wasm_call_ctors = function() {
|
|
3139
|
+
return (E.___wasm_call_ctors = E.asm.Ya).apply(null, arguments);
|
|
3140
|
+
};
|
|
3141
|
+
var OA = E._malloc = function() {
|
|
3142
|
+
return (OA = E._malloc = E.asm.Za).apply(null, arguments);
|
|
3143
|
+
}, Og = E.___errno_location = function() {
|
|
3144
|
+
return (Og = E.___errno_location = E.asm.$a).apply(null, arguments);
|
|
3145
|
+
}, bA = E._free = function() {
|
|
3146
|
+
return (bA = E._free = E.asm.ab).apply(null, arguments);
|
|
3147
|
+
}, eg = E.___getTypeName = function() {
|
|
3148
|
+
return (eg = E.___getTypeName = E.asm.bb).apply(null, arguments);
|
|
3149
|
+
};
|
|
3150
|
+
E.___embind_register_native_and_builtin_types = function() {
|
|
3151
|
+
return (E.___embind_register_native_and_builtin_types = E.asm.cb).apply(null, arguments);
|
|
3152
|
+
};
|
|
3153
|
+
var j = E.stackSave = function() {
|
|
3154
|
+
return (j = E.stackSave = E.asm.db).apply(null, arguments);
|
|
3155
|
+
}, u = E.stackRestore = function() {
|
|
3156
|
+
return (u = E.stackRestore = E.asm.eb).apply(null, arguments);
|
|
3157
|
+
}, XI = E.stackAlloc = function() {
|
|
3158
|
+
return (XI = E.stackAlloc = E.asm.fb).apply(null, arguments);
|
|
3159
|
+
}, n = E._setThrew = function() {
|
|
3160
|
+
return (n = E._setThrew = E.asm.gb).apply(null, arguments);
|
|
3161
|
+
}, VI = E.___cxa_can_catch = function() {
|
|
3162
|
+
return (VI = E.___cxa_can_catch = E.asm.hb).apply(null, arguments);
|
|
3163
|
+
}, rg = E.___cxa_is_pointer_type = function() {
|
|
3164
|
+
return (rg = E.___cxa_is_pointer_type = E.asm.ib).apply(null, arguments);
|
|
3165
|
+
};
|
|
3166
|
+
E.dynCall_viijii = function() {
|
|
3167
|
+
return (E.dynCall_viijii = E.asm.jb).apply(null, arguments);
|
|
3168
|
+
}, E.dynCall_jiji = function() {
|
|
3169
|
+
return (E.dynCall_jiji = E.asm.kb).apply(null, arguments);
|
|
3170
|
+
}, E.dynCall_iiiiij = function() {
|
|
3171
|
+
return (E.dynCall_iiiiij = E.asm.lb).apply(null, arguments);
|
|
3172
|
+
}, E.dynCall_iiiiijj = function() {
|
|
3173
|
+
return (E.dynCall_iiiiijj = E.asm.mb).apply(null, arguments);
|
|
3174
|
+
}, E.dynCall_iiiiiijj = function() {
|
|
3175
|
+
return (E.dynCall_iiiiiijj = E.asm.nb).apply(null, arguments);
|
|
3176
|
+
};
|
|
3177
|
+
function rC(A, I) {
|
|
3178
|
+
var g = j();
|
|
3179
|
+
try {
|
|
3180
|
+
return T.get(A)(I);
|
|
3181
|
+
} catch (B) {
|
|
3182
|
+
if (u(g), B !== B + 0 && B !== "longjmp") throw B;
|
|
3183
|
+
n(1, 0);
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
function _C(A, I, g, B) {
|
|
3187
|
+
var Q = j();
|
|
3188
|
+
try {
|
|
3189
|
+
T.get(A)(I, g, B);
|
|
3190
|
+
} catch (G) {
|
|
3191
|
+
if (u(Q), G !== G + 0 && G !== "longjmp") throw G;
|
|
3192
|
+
n(1, 0);
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
function $C(A, I, g) {
|
|
3196
|
+
var B = j();
|
|
3197
|
+
try {
|
|
3198
|
+
T.get(A)(I, g);
|
|
3199
|
+
} catch (Q) {
|
|
3200
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3201
|
+
n(1, 0);
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
function AE(A, I, g, B, Q) {
|
|
3205
|
+
var G = j();
|
|
3206
|
+
try {
|
|
3207
|
+
return T.get(A)(I, g, B, Q);
|
|
3208
|
+
} catch (i) {
|
|
3209
|
+
if (u(G), i !== i + 0 && i !== "longjmp") throw i;
|
|
3210
|
+
n(1, 0);
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
function IE(A, I, g) {
|
|
3214
|
+
var B = j();
|
|
3215
|
+
try {
|
|
3216
|
+
return T.get(A)(I, g);
|
|
3217
|
+
} catch (Q) {
|
|
3218
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3219
|
+
n(1, 0);
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
function gE(A, I, g, B, Q) {
|
|
3223
|
+
var G = j();
|
|
3224
|
+
try {
|
|
3225
|
+
T.get(A)(I, g, B, Q);
|
|
3226
|
+
} catch (i) {
|
|
3227
|
+
if (u(G), i !== i + 0 && i !== "longjmp") throw i;
|
|
3228
|
+
n(1, 0);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
function BE(A, I, g, B) {
|
|
3232
|
+
var Q = j();
|
|
3233
|
+
try {
|
|
3234
|
+
return T.get(A)(I, g, B);
|
|
3235
|
+
} catch (G) {
|
|
3236
|
+
if (u(Q), G !== G + 0 && G !== "longjmp") throw G;
|
|
3237
|
+
n(1, 0);
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
function QE(A, I, g, B, Q, G) {
|
|
3241
|
+
var i = j();
|
|
3242
|
+
try {
|
|
3243
|
+
T.get(A)(I, g, B, Q, G);
|
|
3244
|
+
} catch (D) {
|
|
3245
|
+
if (u(i), D !== D + 0 && D !== "longjmp") throw D;
|
|
3246
|
+
n(1, 0);
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
function CE(A, I) {
|
|
3250
|
+
var g = j();
|
|
3251
|
+
try {
|
|
3252
|
+
T.get(A)(I);
|
|
3253
|
+
} catch (B) {
|
|
3254
|
+
if (u(g), B !== B + 0 && B !== "longjmp") throw B;
|
|
3255
|
+
n(1, 0);
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
function EE(A) {
|
|
3259
|
+
var I = j();
|
|
3260
|
+
try {
|
|
3261
|
+
return T.get(A)();
|
|
3262
|
+
} catch (g) {
|
|
3263
|
+
if (u(I), g !== g + 0 && g !== "longjmp") throw g;
|
|
3264
|
+
n(1, 0);
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
3267
|
+
function GE(A, I, g, B, Q, G, i) {
|
|
3268
|
+
var D = j();
|
|
3269
|
+
try {
|
|
3270
|
+
T.get(A)(I, g, B, Q, G, i);
|
|
3271
|
+
} catch (h) {
|
|
3272
|
+
if (u(D), h !== h + 0 && h !== "longjmp") throw h;
|
|
3273
|
+
n(1, 0);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
function iE(A, I, g, B, Q, G) {
|
|
3277
|
+
var i = j();
|
|
3278
|
+
try {
|
|
3279
|
+
return T.get(A)(I, g, B, Q, G);
|
|
3280
|
+
} catch (D) {
|
|
3281
|
+
if (u(i), D !== D + 0 && D !== "longjmp") throw D;
|
|
3282
|
+
n(1, 0);
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
function DE(A) {
|
|
3286
|
+
var I = j();
|
|
3287
|
+
try {
|
|
3288
|
+
T.get(A)();
|
|
3289
|
+
} catch (g) {
|
|
3290
|
+
if (u(I), g !== g + 0 && g !== "longjmp") throw g;
|
|
3291
|
+
n(1, 0);
|
|
3292
|
+
}
|
|
3293
|
+
}
|
|
3294
|
+
function hE(A, I, g) {
|
|
3295
|
+
var B = j();
|
|
3296
|
+
try {
|
|
3297
|
+
T.get(A)(I, g);
|
|
3298
|
+
} catch (Q) {
|
|
3299
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3300
|
+
n(1, 0);
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
function oE(A, I, g, B, Q) {
|
|
3304
|
+
var G = j();
|
|
3305
|
+
try {
|
|
3306
|
+
return T.get(A)(I, g, B, Q);
|
|
3307
|
+
} catch (i) {
|
|
3308
|
+
if (u(G), i !== i + 0 && i !== "longjmp") throw i;
|
|
3309
|
+
n(1, 0);
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
function YE(A, I, g) {
|
|
3313
|
+
var B = j();
|
|
3314
|
+
try {
|
|
3315
|
+
return T.get(A)(I, g);
|
|
3316
|
+
} catch (Q) {
|
|
3317
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3318
|
+
n(1, 0);
|
|
3319
|
+
}
|
|
3320
|
+
}
|
|
3321
|
+
function wE(A, I, g) {
|
|
3322
|
+
var B = j();
|
|
3323
|
+
try {
|
|
3324
|
+
return T.get(A)(I, g);
|
|
3325
|
+
} catch (Q) {
|
|
3326
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3327
|
+
n(1, 0);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
function kE(A, I, g, B, Q, G, i) {
|
|
3331
|
+
var D = j();
|
|
3332
|
+
try {
|
|
3333
|
+
return T.get(A)(I, g, B, Q, G, i);
|
|
3334
|
+
} catch (h) {
|
|
3335
|
+
if (u(D), h !== h + 0 && h !== "longjmp") throw h;
|
|
3336
|
+
n(1, 0);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
function aE(A, I) {
|
|
3340
|
+
var g = j();
|
|
3341
|
+
try {
|
|
3342
|
+
return T.get(A)(I);
|
|
3343
|
+
} catch (B) {
|
|
3344
|
+
if (u(g), B !== B + 0 && B !== "longjmp") throw B;
|
|
3345
|
+
n(1, 0);
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
function ZE(A, I) {
|
|
3349
|
+
var g = j();
|
|
3350
|
+
try {
|
|
3351
|
+
return T.get(A)(I);
|
|
3352
|
+
} catch (B) {
|
|
3353
|
+
if (u(g), B !== B + 0 && B !== "longjmp") throw B;
|
|
3354
|
+
n(1, 0);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
function NE(A, I, g, B, Q, G, i, D, h, o, Y) {
|
|
3358
|
+
var a = j();
|
|
3359
|
+
try {
|
|
3360
|
+
T.get(A)(I, g, B, Q, G, i, D, h, o, Y);
|
|
3361
|
+
} catch (k) {
|
|
3362
|
+
if (u(a), k !== k + 0 && k !== "longjmp") throw k;
|
|
3363
|
+
n(1, 0);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
function RE(A, I, g, B, Q) {
|
|
3367
|
+
var G = j();
|
|
3368
|
+
try {
|
|
3369
|
+
return T.get(A)(I, g, B, Q);
|
|
3370
|
+
} catch (i) {
|
|
3371
|
+
if (u(G), i !== i + 0 && i !== "longjmp") throw i;
|
|
3372
|
+
n(1, 0);
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
function FE(A, I, g, B, Q, G, i, D) {
|
|
3376
|
+
var h = j();
|
|
3377
|
+
try {
|
|
3378
|
+
T.get(A)(I, g, B, Q, G, i, D);
|
|
3379
|
+
} catch (o) {
|
|
3380
|
+
if (u(h), o !== o + 0 && o !== "longjmp") throw o;
|
|
3381
|
+
n(1, 0);
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
function bE(A, I, g, B, Q, G, i, D) {
|
|
3385
|
+
var h = j();
|
|
3386
|
+
try {
|
|
3387
|
+
return T.get(A)(I, g, B, Q, G, i, D);
|
|
3388
|
+
} catch (o) {
|
|
3389
|
+
if (u(h), o !== o + 0 && o !== "longjmp") throw o;
|
|
3390
|
+
n(1, 0);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
function lE(A, I, g, B) {
|
|
3394
|
+
var Q = j();
|
|
3395
|
+
try {
|
|
3396
|
+
return T.get(A)(I, g, B);
|
|
3397
|
+
} catch (G) {
|
|
3398
|
+
if (u(Q), G !== G + 0 && G !== "longjmp") throw G;
|
|
3399
|
+
n(1, 0);
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
function SE(A, I, g, B) {
|
|
3403
|
+
var Q = j();
|
|
3404
|
+
try {
|
|
3405
|
+
return T.get(A)(I, g, B);
|
|
3406
|
+
} catch (G) {
|
|
3407
|
+
if (u(Q), G !== G + 0 && G !== "longjmp") throw G;
|
|
3408
|
+
n(1, 0);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
function JE(A, I, g, B, Q, G, i, D, h, o, Y) {
|
|
3412
|
+
var a = j();
|
|
3413
|
+
try {
|
|
3414
|
+
T.get(A)(I, g, B, Q, G, i, D, h, o, Y);
|
|
3415
|
+
} catch (k) {
|
|
3416
|
+
if (u(a), k !== k + 0 && k !== "longjmp") throw k;
|
|
3417
|
+
n(1, 0);
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
function ME(A, I, g, B, Q, G, i, D, h) {
|
|
3421
|
+
var o = j();
|
|
3422
|
+
try {
|
|
3423
|
+
T.get(A)(I, g, B, Q, G, i, D, h);
|
|
3424
|
+
} catch (Y) {
|
|
3425
|
+
if (u(o), Y !== Y + 0 && Y !== "longjmp") throw Y;
|
|
3426
|
+
n(1, 0);
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
function UE(A, I, g, B, Q, G, i, D, h) {
|
|
3430
|
+
var o = j();
|
|
3431
|
+
try {
|
|
3432
|
+
return T.get(A)(I, g, B, Q, G, i, D, h);
|
|
3433
|
+
} catch (Y) {
|
|
3434
|
+
if (u(o), Y !== Y + 0 && Y !== "longjmp") throw Y;
|
|
3435
|
+
n(1, 0);
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
function cE(A, I, g) {
|
|
3439
|
+
var B = j();
|
|
3440
|
+
try {
|
|
3441
|
+
T.get(A)(I, g);
|
|
3442
|
+
} catch (Q) {
|
|
3443
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3444
|
+
n(1, 0);
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
function yE(A, I, g) {
|
|
3448
|
+
var B = j();
|
|
3449
|
+
try {
|
|
3450
|
+
return T.get(A)(I, g);
|
|
3451
|
+
} catch (Q) {
|
|
3452
|
+
if (u(B), Q !== Q + 0 && Q !== "longjmp") throw Q;
|
|
3453
|
+
n(1, 0);
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
function WE(A, I, g, B, Q, G) {
|
|
3457
|
+
var i = j();
|
|
3458
|
+
try {
|
|
3459
|
+
return T.get(A)(I, g, B, Q, G);
|
|
3460
|
+
} catch (D) {
|
|
3461
|
+
if (u(i), D !== D + 0 && D !== "longjmp") throw D;
|
|
3462
|
+
n(1, 0);
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
function dE(A, I, g, B, Q, G, i, D, h, o, Y, a) {
|
|
3466
|
+
var k = j();
|
|
3467
|
+
try {
|
|
3468
|
+
return T.get(A)(I, g, B, Q, G, i, D, h, o, Y, a);
|
|
3469
|
+
} catch (N) {
|
|
3470
|
+
if (u(k), N !== N + 0 && N !== "longjmp") throw N;
|
|
3471
|
+
n(1, 0);
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
function HE(A, I, g, B, Q, G, i, D, h, o, Y, a, k, N, b, y) {
|
|
3475
|
+
var X = j();
|
|
3476
|
+
try {
|
|
3477
|
+
T.get(A)(I, g, B, Q, G, i, D, h, o, Y, a, k, N, b, y);
|
|
3478
|
+
} catch (V) {
|
|
3479
|
+
if (u(X), V !== V + 0 && V !== "longjmp") throw V;
|
|
3480
|
+
n(1, 0);
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
function sE(A, I, g, B) {
|
|
3484
|
+
var Q = j();
|
|
3485
|
+
try {
|
|
3486
|
+
T.get(A)(I, g, B);
|
|
3487
|
+
} catch (G) {
|
|
3488
|
+
if (u(Q), G !== G + 0 && G !== "longjmp") throw G;
|
|
3489
|
+
n(1, 0);
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3492
|
+
E.addRunDependency = Ag, E.removeRunDependency = kI, E.FS_createPath = C.createPath, E.FS_createDataFile = C.createDataFile, E.FS_createPreloadedFile = C.createPreloadedFile, E.FS_createLazyFile = C.createLazyFile, E.FS_createDevice = C.createDevice, E.FS_unlink = C.unlink;
|
|
3493
|
+
var PI;
|
|
3494
|
+
function mE(A) {
|
|
3495
|
+
this.name = "ExitStatus", this.message = "Program terminated with exit(" + A + ")", this.status = A;
|
|
3496
|
+
}
|
|
3497
|
+
AI = function A() {
|
|
3498
|
+
PI || kg(), PI || (AI = A);
|
|
3499
|
+
};
|
|
3500
|
+
function kg(A) {
|
|
3501
|
+
if (PA > 0 || (PB(), PA > 0))
|
|
3502
|
+
return;
|
|
3503
|
+
function I() {
|
|
3504
|
+
PI || (PI = !0, E.calledRun = !0, !Sg && (TB(), R(E), E.onRuntimeInitialized && E.onRuntimeInitialized(), pB()));
|
|
3505
|
+
}
|
|
3506
|
+
E.setStatus ? (E.setStatus("Running..."), setTimeout(function() {
|
|
3507
|
+
setTimeout(function() {
|
|
3508
|
+
E.setStatus("");
|
|
3509
|
+
}, 1), I();
|
|
3510
|
+
}, 1)) : I();
|
|
3511
|
+
}
|
|
3512
|
+
if (E.run = kg, E.preInit)
|
|
3513
|
+
for (typeof E.preInit == "function" && (E.preInit = [E.preInit]); E.preInit.length > 0; )
|
|
3514
|
+
E.preInit.pop()();
|
|
3515
|
+
kg();
|
|
3516
|
+
var _g = [];
|
|
3517
|
+
function KE(A) {
|
|
3518
|
+
_g.push(A);
|
|
3519
|
+
}
|
|
3520
|
+
return E.onRuntimeInitialized = function() {
|
|
3521
|
+
for (var A of _g)
|
|
3522
|
+
A();
|
|
3523
|
+
}, (function() {
|
|
3524
|
+
var A, I, g, B, Q = "/", G, i, D = ";", h = 0, o = 99999;
|
|
3525
|
+
function Y(W) {
|
|
3526
|
+
var c = {};
|
|
3527
|
+
return W.filter(function(d) {
|
|
3528
|
+
return c.hasOwnProperty(d) ? !1 : c[d] = !0;
|
|
3529
|
+
});
|
|
3530
|
+
}
|
|
3531
|
+
function a(W, c, d = B) {
|
|
3532
|
+
var K = c.endsWith(d), L = W.startsWith(d), BA;
|
|
3533
|
+
return K || L ? K && L ? BA = c.substring(0, c.length - 1) + W : BA = c + W : BA = c + d + W, BA;
|
|
3534
|
+
}
|
|
3535
|
+
function k(W, c) {
|
|
3536
|
+
var d = 0;
|
|
3537
|
+
function K() {
|
|
3538
|
+
var L = a(W, c[d++]);
|
|
3539
|
+
return fetch(L).then(function(BA) {
|
|
3540
|
+
if (BA.status === 200)
|
|
3541
|
+
return BA.text().then(function(iA) {
|
|
3542
|
+
var $ = new URL(BA.url), aA = $.pathname.substring(1);
|
|
3543
|
+
return aA = aA.replace(new RegExp(B, "g"), Q), { data: iA, filePath: aA, fullPath: $.origin + $.pathname };
|
|
3544
|
+
});
|
|
3545
|
+
if (d < c.length)
|
|
3546
|
+
return K();
|
|
3547
|
+
throw new Error("MaterialX file not found: " + W);
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
return K();
|
|
3551
|
+
}
|
|
3552
|
+
function N(W, c) {
|
|
3553
|
+
var d = 0;
|
|
3554
|
+
function K() {
|
|
3555
|
+
var L = a(W, c[d++]);
|
|
3556
|
+
return L = I.resolve(L), new Promise(function(BA, iA) {
|
|
3557
|
+
A.readFile(L, "utf8", function($, aA) {
|
|
3558
|
+
if ($)
|
|
3559
|
+
d < c.length ? BA(K()) : iA(new Error("MaterialX file not found: " + W));
|
|
3560
|
+
else {
|
|
3561
|
+
var mA = I.parse(L), FA = L.substring(mA.root.length), iI = B === "\\" ? "\\\\" : B;
|
|
3562
|
+
FA = FA.replace(new RegExp(iI, "g"), Q), BA({ data: aA, filePath: FA, fullPath: L });
|
|
3563
|
+
}
|
|
3564
|
+
});
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3567
|
+
return K();
|
|
3568
|
+
}
|
|
3569
|
+
function b(W) {
|
|
3570
|
+
for (var c = W.concat(D, E.getEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR)), d = ["." + B].concat(c.split(D)), K = d.length - 1; K; )
|
|
3571
|
+
d[K].trim() === "" && d.splice(K, 1), --K;
|
|
3572
|
+
return Y(d);
|
|
3573
|
+
}
|
|
3574
|
+
function y(W, c) {
|
|
3575
|
+
var d = W;
|
|
3576
|
+
typeof W == "string" && (d = W.split(D));
|
|
3577
|
+
for (var K = 0; K < d.length; ++K) {
|
|
3578
|
+
var L = d[K];
|
|
3579
|
+
if (i) {
|
|
3580
|
+
if (I.isAbsolute(L)) {
|
|
3581
|
+
var BA = I.parse(L);
|
|
3582
|
+
L = c + Q + BA.dir.substring(BA.root.length);
|
|
3583
|
+
}
|
|
3584
|
+
var iA = B === "\\" ? "\\\\" : B;
|
|
3585
|
+
L.replace(new RegExp(iA, "g"), Q);
|
|
3586
|
+
} else if (G) {
|
|
3587
|
+
var $ = document.createElement("a");
|
|
3588
|
+
$.href = L, $.origin + $.pathname + $.search + $.hash === L && (L = c + $.pathname);
|
|
3589
|
+
} else
|
|
3590
|
+
throw new Error("Unknown environment!");
|
|
3591
|
+
d[K] = L;
|
|
3592
|
+
}
|
|
3593
|
+
return typeof W == "string" ? d.join(E.PATH_LIST_SEPARATOR) : d;
|
|
3594
|
+
}
|
|
3595
|
+
function X(W, c) {
|
|
3596
|
+
var d = W.split(D);
|
|
3597
|
+
return y(d, c), d.push(p(c)), d = Y(d), d = d.join(E.PATH_LIST_SEPARATOR), d;
|
|
3598
|
+
}
|
|
3599
|
+
function V(W) {
|
|
3600
|
+
var c = /<xi:include href="(.*)"\s*\/>/g, d = W.matchAll(c), K = [];
|
|
3601
|
+
for (var L of d)
|
|
3602
|
+
K.push(L[1]);
|
|
3603
|
+
return K;
|
|
3604
|
+
}
|
|
3605
|
+
function Z(W, c) {
|
|
3606
|
+
var d;
|
|
3607
|
+
if (G)
|
|
3608
|
+
d = k(W, c);
|
|
3609
|
+
else if (i)
|
|
3610
|
+
d = N(W, c);
|
|
3611
|
+
else
|
|
3612
|
+
throw new Error("Unknown environment!");
|
|
3613
|
+
return d;
|
|
3614
|
+
}
|
|
3615
|
+
function J(W, c, d = !1) {
|
|
3616
|
+
d ? (c.files || (c.files = []), c.files.push(W)) : (c.folders || (c.folders = []), c.folders.splice(0, 0, W));
|
|
3617
|
+
}
|
|
3618
|
+
function q(W, c, d, K, L = !0) {
|
|
3619
|
+
var BA;
|
|
3620
|
+
L ? BA = W.substring(1, W.lastIndexOf(Q)).split(Q) : BA = W.substring(K.length).split(Q);
|
|
3621
|
+
for (var iA = K, $ = 1; $ < BA.length; ++$) {
|
|
3622
|
+
iA += Q + BA[$];
|
|
3623
|
+
var aA;
|
|
3624
|
+
try {
|
|
3625
|
+
var mA = C.stat(iA);
|
|
3626
|
+
aA = C.isDir(mA.mode);
|
|
3627
|
+
} catch {
|
|
3628
|
+
aA = !1;
|
|
3629
|
+
}
|
|
3630
|
+
if (!aA)
|
|
3631
|
+
try {
|
|
3632
|
+
C.mkdir(iA), J(iA, d);
|
|
3633
|
+
} catch {
|
|
3634
|
+
throw new Error("Failed to create folder in WASM FS.");
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
if (L)
|
|
3638
|
+
try {
|
|
3639
|
+
C.writeFile(W, c), J(W, d, !0);
|
|
3640
|
+
} catch {
|
|
3641
|
+
throw new Error("Failed to store file in WASM FS.");
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
function p(W) {
|
|
3645
|
+
if (i) {
|
|
3646
|
+
var c = g.cwd(), d = I.parse(c), K = W + Q + c.substring(d.root.length), L = B === "\\" ? "\\\\" : B;
|
|
3647
|
+
return K.replace(new RegExp(L, "g"), Q);
|
|
3648
|
+
} else if (G) {
|
|
3649
|
+
var c = window.location.pathname;
|
|
3650
|
+
return c = c.substring(0, c.lastIndexOf(B)), a(c, W, Q);
|
|
3651
|
+
} else
|
|
3652
|
+
throw new Error("Unknown environment!");
|
|
3653
|
+
}
|
|
3654
|
+
function z(W, c) {
|
|
3655
|
+
if (i)
|
|
3656
|
+
try {
|
|
3657
|
+
A.writeFileSync(W, c);
|
|
3658
|
+
} catch (L) {
|
|
3659
|
+
throw new Error("Failed to write file '" + W + "': " + L.message);
|
|
3660
|
+
}
|
|
3661
|
+
else if (G) {
|
|
3662
|
+
var d = W.lastIndexOf(B);
|
|
3663
|
+
W = W.substring(d > -1 ? d + 1 : 0);
|
|
3664
|
+
var K = document.createElement("a");
|
|
3665
|
+
K.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(c)), K.setAttribute("download", W), K.style.display = "none", document.body.appendChild(K), K.click(), document.body.removeChild(K);
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
KE(function() {
|
|
3669
|
+
G = typeof window == "object", i = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string", G && (B = "/"), i && (A = require("fs"), I = require("path"), g = require("process"), B = I.sep);
|
|
3670
|
+
function W(c, d, K, L, BA = [], iA = "") {
|
|
3671
|
+
var $ = "/readFromXml" + h++ % o, aA = b(K);
|
|
3672
|
+
try {
|
|
3673
|
+
C.mkdir($);
|
|
3674
|
+
} catch {
|
|
3675
|
+
throw new Error("Failed to create folder in WASM FS.");
|
|
3676
|
+
}
|
|
3677
|
+
var mA = [];
|
|
3678
|
+
(!L || L.readXIncludes) && (mA = V(d));
|
|
3679
|
+
var FA = { files: [], folders: [] }, iI = p($), DI = iI + "/ChosenToHopefullyNotClashWithAnyOtherFile123";
|
|
3680
|
+
if (iA) {
|
|
3681
|
+
var XE = B === "\\" ? "\\\\" : B;
|
|
3682
|
+
DI = iA.replace(new RegExp(XE, "g"), Q), DI = a(DI, $, Q), q(iI, null, FA, $, !1);
|
|
3683
|
+
}
|
|
3684
|
+
q(DI, d, FA, $);
|
|
3685
|
+
function $g(TI, eA, ag) {
|
|
3686
|
+
var pI = [Promise.resolve()];
|
|
3687
|
+
for (var Zg of eA) {
|
|
3688
|
+
var LA = TI.slice(), LI = ag.slice(), VE = Z(Zg, LI).then(function(KA) {
|
|
3689
|
+
if (LA.includes(KA.fullPath))
|
|
3690
|
+
throw new Error(`Cycle detected!
|
|
3691
|
+
` + LA.join(`
|
|
3692
|
+
-> `) + `
|
|
3693
|
+
-> ` + KA.fullPath);
|
|
3694
|
+
LA.push(KA.fullPath);
|
|
3695
|
+
var AB = KA.fullPath.lastIndexOf(B), IB = KA.fullPath.substring(0, AB > -1 ? AB : 0);
|
|
3696
|
+
LI.includes(IB) || LI.splice(0, 0, IB);
|
|
3697
|
+
var PE = V(KA.data), gB = a(KA.filePath, $, Q);
|
|
3698
|
+
return FA.files.includes(gB) || q(gB, KA.data, FA, $), $g(LA, PE, LI);
|
|
3699
|
+
});
|
|
3700
|
+
pI.push(VE);
|
|
3701
|
+
}
|
|
3702
|
+
return Promise.all(pI);
|
|
3703
|
+
}
|
|
3704
|
+
return $g(BA, mA, aA).then(function() {
|
|
3705
|
+
var TI = X(K, $);
|
|
3706
|
+
C.chdir(iI);
|
|
3707
|
+
try {
|
|
3708
|
+
var eA = E.getEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR);
|
|
3709
|
+
if (eA) {
|
|
3710
|
+
var ag = y(eA, $);
|
|
3711
|
+
E.setEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR, ag);
|
|
3712
|
+
}
|
|
3713
|
+
E._readFromXmlFile(c, DI, TI, L), eA && E.setEnviron(E.MATERIALX_SEARCH_PATH_ENV_VAR, eA);
|
|
3714
|
+
} catch (LA) {
|
|
3715
|
+
throw new Error("Failed to read MaterialX files from WASM FS: " + E.getExceptionMessage(LA));
|
|
3716
|
+
}
|
|
3717
|
+
try {
|
|
3718
|
+
for (var pI of FA.files)
|
|
3719
|
+
C.unlink(pI);
|
|
3720
|
+
C.chdir("/");
|
|
3721
|
+
for (var Zg of FA.folders)
|
|
3722
|
+
C.rmdir(Zg);
|
|
3723
|
+
C.rmdir($);
|
|
3724
|
+
} catch {
|
|
3725
|
+
throw new Error("Failed to delete temporary files from WASM FS.");
|
|
3726
|
+
}
|
|
3727
|
+
});
|
|
3728
|
+
}
|
|
3729
|
+
E.readFromXmlString = function(c, d, K = "", L = null) {
|
|
3730
|
+
if (arguments.length < 2 || arguments.length > 4)
|
|
3731
|
+
throw new Error("Function readFromXmlString called with an invalid number of arguments (" + arguments.length + ") - expects 2 to 4!");
|
|
3732
|
+
return W(c, d, K, L);
|
|
3733
|
+
}, E.readFromXmlFile = function(c, d, K = "", L = null) {
|
|
3734
|
+
if (arguments.length < 2 || arguments.length > 4)
|
|
3735
|
+
throw new Error("Function readFromXmlFile called with an invalid number of arguments (" + arguments.length + ") - expects 2 to 4!");
|
|
3736
|
+
var BA = b(K);
|
|
3737
|
+
return Z(d, BA).then(function(iA) {
|
|
3738
|
+
var $ = [iA.fullPath], aA = iA.fullPath.lastIndexOf(B), mA = iA.fullPath.substring(0, aA > -1 ? aA : 0);
|
|
3739
|
+
return K = K.concat(D, mA), W(c, iA.data, K, L, $, iA.filePath);
|
|
3740
|
+
});
|
|
3741
|
+
}, E.writeToXmlFile = function(c, d, K = null) {
|
|
3742
|
+
if (arguments.length < 2 || arguments.length > 3)
|
|
3743
|
+
throw new Error("Function writeToXmlFile called with an invalid number of arguments (" + arguments.length + ") - expects 2 to 3!");
|
|
3744
|
+
var L = E.writeToXmlString(c, K);
|
|
3745
|
+
z(d, L);
|
|
3746
|
+
}, E.exportToXmlFile = function(c, d, K = null) {
|
|
3747
|
+
if (arguments.length < 2 || arguments.length > 3)
|
|
3748
|
+
throw new Error("Function exportToXmlFile called with an invalid number of arguments (" + arguments.length + ") - expects 2 to 3!");
|
|
3749
|
+
var L = E.exportToXmlString(c, K);
|
|
3750
|
+
z(d, L);
|
|
3751
|
+
};
|
|
3752
|
+
});
|
|
3753
|
+
})(), w.ready;
|
|
3754
|
+
});
|
|
3755
|
+
})();
|
|
3756
|
+
typeof exports == "object" && typeof module == "object" ? module.exports = qI : typeof define == "function" && define.amd ? define([], function() {
|
|
3757
|
+
return qI;
|
|
3758
|
+
}) : typeof exports == "object" && (exports.MaterialX = qI);
|
|
3759
|
+
function FB(l) {
|
|
3760
|
+
const E = new URLSearchParams(window.location.search).get(l);
|
|
3761
|
+
return E == null || E === "0" || E === "false" ? !1 : E === "" ? !0 : E;
|
|
3762
|
+
}
|
|
3763
|
+
const f = FB("debugmaterialx"), QG = f === "update";
|
|
3764
|
+
let bB = 0;
|
|
3765
|
+
function QB() {
|
|
3766
|
+
return bB;
|
|
3767
|
+
}
|
|
3768
|
+
let lB = 0;
|
|
3769
|
+
function CB() {
|
|
3770
|
+
return lB;
|
|
3771
|
+
}
|
|
3772
|
+
const CG = window.performance || /** @type {any} */
|
|
3773
|
+
window.webkitPerformance || /** @type {any} */
|
|
3774
|
+
window.mozPerformance;
|
|
3775
|
+
function SB() {
|
|
3776
|
+
bB = CG.now() / 1e3, lB++, window.requestAnimationFrame(SB);
|
|
3777
|
+
}
|
|
3778
|
+
window.requestAnimationFrame(SB);
|
|
3779
|
+
async function EG() {
|
|
3780
|
+
return typeof requestIdleCallback < "u" ? new Promise((l) => requestIdleCallback(l)) : (console.debug("[MaterialX] Can not wait for network idle, using fallback"), new Promise((l) => setTimeout(l, 100)));
|
|
3781
|
+
}
|
|
3782
|
+
function GG() {
|
|
3783
|
+
return window.location.hostname === "localhost" || /^\d{1,3}(\.\d{1,3}){3}$/.test(window.location.hostname);
|
|
3784
|
+
}
|
|
3785
|
+
const iG = FB("debugmaterialx"), nI = new tI();
|
|
3786
|
+
nI.needsUpdate = !0;
|
|
3787
|
+
nI.image = new Image();
|
|
3788
|
+
nI.image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";
|
|
3789
|
+
function EB(l, w, E = 0, R = 1024, H = 512, M) {
|
|
3790
|
+
let F;
|
|
3791
|
+
M ? F = M : w.image ? F = w.image.height / 4 : F = 256;
|
|
3792
|
+
const x = Math.log2(F) - 2, U = F, s = 3 * Math.max(Math.pow(2, x), 112), m = new TE(R, H, {
|
|
3793
|
+
format: LE,
|
|
3794
|
+
type: pE,
|
|
3795
|
+
minFilter: ZB,
|
|
3796
|
+
magFilter: aB,
|
|
3797
|
+
generateMipmaps: !0,
|
|
3798
|
+
wrapS: Rg,
|
|
3799
|
+
anisotropy: l.capabilities.getMaxAnisotropy()
|
|
3800
|
+
}), AA = new NB(2, 2), O = new xE(-1, 1, 1, -1, 0, 1), IA = new RB({
|
|
3801
|
+
defines: {
|
|
3802
|
+
USE_ENVMAP: "",
|
|
3803
|
+
ENVMAP_TYPE_CUBE_UV: "",
|
|
3804
|
+
CUBEUV_TEXEL_WIDTH: 1 / s,
|
|
3805
|
+
CUBEUV_TEXEL_HEIGHT: 1 / U,
|
|
3806
|
+
CUBEUV_MAX_MIP: x + 0 + ".0"
|
|
3807
|
+
},
|
|
3808
|
+
uniforms: {
|
|
3809
|
+
envMap: { value: w },
|
|
3810
|
+
roughness: { value: E }
|
|
3811
|
+
},
|
|
3812
|
+
vertexShader: `
|
|
3813
|
+
varying vec2 vUv;
|
|
3814
|
+
|
|
3815
|
+
void main() {
|
|
3816
|
+
vUv = uv;
|
|
3817
|
+
gl_Position = vec4(position.xy, 0.0, 1.0);
|
|
3818
|
+
}
|
|
3819
|
+
`,
|
|
3820
|
+
fragmentShader: `
|
|
3821
|
+
uniform sampler2D envMap;
|
|
3822
|
+
uniform float roughness;
|
|
3823
|
+
varying vec2 vUv;
|
|
3824
|
+
|
|
3825
|
+
#include <common>
|
|
3826
|
+
#include <cube_uv_reflection_fragment>
|
|
3827
|
+
|
|
3828
|
+
void main() {
|
|
3829
|
+
// Convert UV coordinates to equirectangular direction
|
|
3830
|
+
vec2 uv = vUv;
|
|
3831
|
+
|
|
3832
|
+
// Map UV (0,1) to spherical coordinates
|
|
3833
|
+
// Longitude: -π to π, Latitude: 0 to π
|
|
3834
|
+
float phi = uv.x * 2.0 * PI - PI; // Longitude (-π to π)
|
|
3835
|
+
float theta = uv.y * PI; // Latitude (0 to π)
|
|
3836
|
+
// Rotate 90° around Y
|
|
3837
|
+
phi -= PI / 2.0; // Adjust to match Three.js convention
|
|
3838
|
+
|
|
3839
|
+
// Convert spherical to cartesian coordinates
|
|
3840
|
+
vec3 direction = vec3(
|
|
3841
|
+
sin(theta) * cos(phi), // x
|
|
3842
|
+
cos(theta), // y
|
|
3843
|
+
sin(theta) * sin(phi) // z
|
|
3844
|
+
);
|
|
3845
|
+
|
|
3846
|
+
// Sample the PMREM cube texture using the direction and roughness
|
|
3847
|
+
#ifdef ENVMAP_TYPE_CUBE_UV
|
|
3848
|
+
vec4 envColor = textureCubeUV(envMap, direction, roughness);
|
|
3849
|
+
#else
|
|
3850
|
+
vec4 envColor = vec4(1.0, 0.0, 1.0, 1.0); // Magenta fallback
|
|
3851
|
+
#endif
|
|
3852
|
+
|
|
3853
|
+
gl_FragColor = vec4(envColor.rgb, 1.0);
|
|
3854
|
+
}
|
|
3855
|
+
`
|
|
3856
|
+
}), v = new jE(), hA = new Fg(AA, IA);
|
|
3857
|
+
v.add(hA);
|
|
3858
|
+
const UA = l.getRenderTarget(), jA = l.autoClear, rA = l.xr.enabled, uA = l.shadowMap.enabled;
|
|
3859
|
+
m.texture.generateMipmaps = !0;
|
|
3860
|
+
try {
|
|
3861
|
+
l.xr.enabled = !1, l.shadowMap.enabled = !1, l.autoClear = !0, l.setRenderTarget(m), l.clear(), l.render(v, O);
|
|
3862
|
+
} finally {
|
|
3863
|
+
l.setRenderTarget(UA), l.autoClear = jA, l.xr.enabled = rA, l.shadowMap.enabled = uA, AA.dispose(), IA.dispose(), v.remove(hA);
|
|
3864
|
+
}
|
|
3865
|
+
return m.texture.name = "PMREM_Equirectangular_Texture_" + E.toFixed(2), m.texture.mapping = uE, iG && console.log("[MaterialX] PMREM to Equirect Render Target:", {
|
|
3866
|
+
width: m.width,
|
|
3867
|
+
height: m.height,
|
|
3868
|
+
mipmaps: m.texture.mipmaps?.length,
|
|
3869
|
+
roughness: E
|
|
3870
|
+
}), m;
|
|
3871
|
+
}
|
|
3872
|
+
const zI = "_", GB = zI + "uaddressmode", iB = zI + "vaddressmode", DB = zI + "filtertype", DG = "/";
|
|
3873
|
+
function Ng(l, w) {
|
|
3874
|
+
let E;
|
|
3875
|
+
if (l)
|
|
3876
|
+
E = [...l.data()];
|
|
3877
|
+
else {
|
|
3878
|
+
E = [];
|
|
3879
|
+
for (let R = 0; R < w; ++R)
|
|
3880
|
+
E.push(0);
|
|
3881
|
+
}
|
|
3882
|
+
return E;
|
|
3883
|
+
}
|
|
3884
|
+
function hB(l, w) {
|
|
3885
|
+
const E = new Array(w);
|
|
3886
|
+
if (l)
|
|
3887
|
+
for (let R = 0; R < l.numRows(); ++R)
|
|
3888
|
+
for (let H = 0; H < l.numColumns(); ++H)
|
|
3889
|
+
E.push(l.getItem(R, H));
|
|
3890
|
+
else
|
|
3891
|
+
for (let R = 0; R < w; ++R)
|
|
3892
|
+
E.push(0);
|
|
3893
|
+
return E;
|
|
3894
|
+
}
|
|
3895
|
+
const fI = new tI();
|
|
3896
|
+
fI.needsUpdate = !0;
|
|
3897
|
+
fI.image = new Image();
|
|
3898
|
+
fI.image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAANQTFRFr6+vGqg52AAAAAxJREFUeJxjZGBEgQAAWAAJLpjsTQAAAABJRU5ErkJggg==";
|
|
3899
|
+
const OI = new tI();
|
|
3900
|
+
OI.needsUpdate = !0;
|
|
3901
|
+
OI.image = new Image();
|
|
3902
|
+
OI.image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIBAMAAAA2IaO4AAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAABJQTFRFgYH4gIH4gYH3gIH3gIH5gID4m94ORAAAADFJREFUeJxjZBBkfMdo9P/BB0aBj/8FGB0ufghgFGT4r8wo+P8rD2Pgo3sMjIz8jAwAMLoN0ZjS5hgAAAAASUVORK5CYII=";
|
|
3903
|
+
function hG(l) {
|
|
3904
|
+
const w = XA.enabled;
|
|
3905
|
+
XA.enabled = !0;
|
|
3906
|
+
const E = XA.get(l);
|
|
3907
|
+
return XA.enabled = w, E;
|
|
3908
|
+
}
|
|
3909
|
+
function oG(l, w) {
|
|
3910
|
+
const E = XA.enabled;
|
|
3911
|
+
XA.enabled = !0, XA.add(l, w), XA.enabled = E, f && console.log("[MaterialX] Added to cache:", l, w);
|
|
3912
|
+
}
|
|
3913
|
+
function YG(l, w, E, R, H, M) {
|
|
3914
|
+
const F = new qE(
|
|
3915
|
+
/** @type {any} */
|
|
3916
|
+
null
|
|
3917
|
+
);
|
|
3918
|
+
switch (w) {
|
|
3919
|
+
case "float":
|
|
3920
|
+
case "integer":
|
|
3921
|
+
case "boolean":
|
|
3922
|
+
F.value = E;
|
|
3923
|
+
break;
|
|
3924
|
+
case "vector2":
|
|
3925
|
+
F.value = /** @type {any} */
|
|
3926
|
+
Ng(E, 2);
|
|
3927
|
+
break;
|
|
3928
|
+
case "vector3":
|
|
3929
|
+
case "color3":
|
|
3930
|
+
F.value = /** @type {any} */
|
|
3931
|
+
Ng(E, 3);
|
|
3932
|
+
break;
|
|
3933
|
+
case "vector4":
|
|
3934
|
+
case "color4":
|
|
3935
|
+
F.value = /** @type {any} */
|
|
3936
|
+
Ng(E, 4);
|
|
3937
|
+
break;
|
|
3938
|
+
case "matrix33":
|
|
3939
|
+
F.value = /** @type {any} */
|
|
3940
|
+
hB(E, 9);
|
|
3941
|
+
break;
|
|
3942
|
+
case "matrix44":
|
|
3943
|
+
F.value = /** @type {any} */
|
|
3944
|
+
hB(E, 16);
|
|
3945
|
+
break;
|
|
3946
|
+
case "filename":
|
|
3947
|
+
if (E) {
|
|
3948
|
+
let U = !0, s = M + DG + E;
|
|
3949
|
+
E.startsWith("blob:") || E.startsWith("data:") ? (s = E, U = !1) : E.startsWith("http") && (s = E, U = !0);
|
|
3950
|
+
const m = H.cacheKey?.length ? `${H.cacheKey}-${s}` : s, AA = U ? hG(m) : null;
|
|
3951
|
+
if (AA)
|
|
3952
|
+
f && console.log("[MaterialX] Use cached texture: ", m, AA), AA instanceof Promise ? AA.then((O) => {
|
|
3953
|
+
O ? F.value = O : console.warn(`[MaterialX] Failed to load texture ${R} '${s}'`);
|
|
3954
|
+
}) : F.value = AA;
|
|
3955
|
+
else {
|
|
3956
|
+
f && console.log("[MaterialX] Load texture:", s), R.toLowerCase().includes("normal") ? F.value = /** @type {any} */
|
|
3957
|
+
OI : F.value = /** @type {any} */
|
|
3958
|
+
fI;
|
|
3959
|
+
const O = F.value, IA = H.getTexture(s)?.then((v) => (v && (v = v.clone(), v.colorSpace = vE, wG(v, R, l)), v)).catch((v) => (console.error(`[MaterialX] Failed to load texture ${R} '${s}'`, v), O));
|
|
3960
|
+
U && oG(m, IA), IA?.then((v) => {
|
|
3961
|
+
v ? F.value = /** @type {any} */
|
|
3962
|
+
v : console.warn(`[MaterialX] Failed to load texture ${R} '${s}'`);
|
|
3963
|
+
});
|
|
3964
|
+
}
|
|
3965
|
+
}
|
|
3966
|
+
break;
|
|
3967
|
+
case "samplerCube":
|
|
3968
|
+
case "string":
|
|
3969
|
+
break;
|
|
3970
|
+
default:
|
|
3971
|
+
const x = w + ":" + R;
|
|
3972
|
+
oB.has(x) || (oB.set(x, !0), (f || GG()) && console.warn(`MaterialX: Unsupported uniform '${R}': ${w}`));
|
|
3973
|
+
break;
|
|
3974
|
+
}
|
|
3975
|
+
return F;
|
|
3976
|
+
}
|
|
3977
|
+
const oB = /* @__PURE__ */ new Map();
|
|
3978
|
+
function YB(l) {
|
|
3979
|
+
let w;
|
|
3980
|
+
switch (l) {
|
|
3981
|
+
case 1:
|
|
3982
|
+
w = zE;
|
|
3983
|
+
break;
|
|
3984
|
+
case 2:
|
|
3985
|
+
w = Rg;
|
|
3986
|
+
break;
|
|
3987
|
+
case 3:
|
|
3988
|
+
w = nE;
|
|
3989
|
+
break;
|
|
3990
|
+
default:
|
|
3991
|
+
w = Rg;
|
|
3992
|
+
break;
|
|
3993
|
+
}
|
|
3994
|
+
return w;
|
|
3995
|
+
}
|
|
3996
|
+
function wG(l, w, E, R = !0) {
|
|
3997
|
+
const H = w.lastIndexOf(zI), M = w.substring(0, H) || w;
|
|
3998
|
+
if (E.find(M + GB)) {
|
|
3999
|
+
const U = E.find(M + GB).getValue().getData();
|
|
4000
|
+
l.wrapS = YB(U);
|
|
4001
|
+
}
|
|
4002
|
+
if (E.find(M + iB)) {
|
|
4003
|
+
const U = E.find(M + iB).getValue().getData();
|
|
4004
|
+
l.wrapT = YB(U);
|
|
4005
|
+
}
|
|
4006
|
+
const F = E.find(M + DB) ? E.get(M + DB).value : -1;
|
|
4007
|
+
let x = R ? ZB : aB;
|
|
4008
|
+
F === 0 && (x = /** @type {any} */
|
|
4009
|
+
R ? fE : OE), l.minFilter = x;
|
|
4010
|
+
}
|
|
4011
|
+
function kG(l) {
|
|
4012
|
+
let w = new Array();
|
|
4013
|
+
for (let E of l.getNodes())
|
|
4014
|
+
E.getType() === "lightshader" && w.push(E);
|
|
4015
|
+
return w;
|
|
4016
|
+
}
|
|
4017
|
+
let xA = {};
|
|
4018
|
+
async function aG(l, w) {
|
|
4019
|
+
xA = {};
|
|
4020
|
+
const E = w.getOptions().hwMaxActiveLightSources;
|
|
4021
|
+
l.HwShaderGenerator.unbindLightShaders(w);
|
|
4022
|
+
let R = 1;
|
|
4023
|
+
const H = `<?xml version="1.0"?>
|
|
4024
|
+
<materialx version="1.39">
|
|
4025
|
+
<directional_light name="default_directional_light" type="lightshader">
|
|
4026
|
+
</directional_light>
|
|
4027
|
+
<point_light name="default_point_light" type="lightshader">
|
|
4028
|
+
</point_light>
|
|
4029
|
+
<spot_light name="default_spot_light" type="lightshader">
|
|
4030
|
+
</spot_light>
|
|
4031
|
+
<!--
|
|
4032
|
+
<area_light name="default_area_light" type="lightshader">
|
|
4033
|
+
</area_light>
|
|
4034
|
+
-->
|
|
4035
|
+
</materialx>`, M = l.createDocument();
|
|
4036
|
+
await l.readFromXmlString(M, H, "");
|
|
4037
|
+
const F = l.createDocument(), x = l.loadStandardLibraries(w);
|
|
4038
|
+
F.setDataLibrary(x), F.importLibrary(M);
|
|
4039
|
+
const U = kG(F);
|
|
4040
|
+
f && console.log("Default lights in MaterialX document", U), w.getOptions().hwMaxActiveLightSources = E;
|
|
4041
|
+
for (let s of U) {
|
|
4042
|
+
const m = s.getNodeDef();
|
|
4043
|
+
if (f && console.log("Default light node definition", m), !m) continue;
|
|
4044
|
+
const AA = m.getName();
|
|
4045
|
+
f && console.log("Registering default light", { lightName: AA, lightDef: m }), xA[AA] || (f && console.log("Bind light shader for node", { lightName: AA, lightId: R, lightDef: m }), xA[AA] = R, l.HwShaderGenerator.bindLightShader(m, R++, w));
|
|
4046
|
+
}
|
|
4047
|
+
f && console.log("Light types bound in MaterialX context", xA);
|
|
4048
|
+
}
|
|
4049
|
+
const wB = {};
|
|
4050
|
+
function ZG(l) {
|
|
4051
|
+
switch (l) {
|
|
4052
|
+
case "PointLight":
|
|
4053
|
+
return "ND_point_light";
|
|
4054
|
+
case "DirectionalLight":
|
|
4055
|
+
return "ND_directional_light";
|
|
4056
|
+
case "SpotLight":
|
|
4057
|
+
return "ND_spot_light";
|
|
4058
|
+
default:
|
|
4059
|
+
return wB[l] || (wB[l] = !0, console.warn("MaterialX: Unsupported light type: " + l)), null;
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
function NG(l, w) {
|
|
4063
|
+
const E = new Array(), R = w.getOptions().hwMaxActiveLightSources;
|
|
4064
|
+
for (let M of l) {
|
|
4065
|
+
if (!M?.isLight) continue;
|
|
4066
|
+
const F = ZG(M.type);
|
|
4067
|
+
if (!F)
|
|
4068
|
+
continue;
|
|
4069
|
+
xA[F] || f && console.error("MaterialX: Light type not registered in context. Make sure to register light types before using them.", F);
|
|
4070
|
+
const x = M.getWorldPosition(new hI()), U = M.getWorldQuaternion(new tE()), s = new hI(0, 0, -1).applyQuaternion(U), m = (
|
|
4071
|
+
/** @type {THREE.SpotLight} */
|
|
4072
|
+
M.angle
|
|
4073
|
+
), AA = m * (1 - /** @type {THREE.SpotLight} */
|
|
4074
|
+
M.penumbra), O = Math.cos(AA), IA = Math.cos(m);
|
|
4075
|
+
E.push({
|
|
4076
|
+
type: xA[F],
|
|
4077
|
+
position: x.clone(),
|
|
4078
|
+
direction: s.clone(),
|
|
4079
|
+
color: new BB().fromArray(M.color.toArray()),
|
|
4080
|
+
// Luminous efficacy for converting radiant power in watts (W) to luminous flux in lumens (lm) at a wavelength of 555 nm.
|
|
4081
|
+
// Also, three.js lights don't have PI scale baked in, but MaterialX does, so we need to divide by PI for point and spot lights.
|
|
4082
|
+
intensity: M.intensity * /** @type {THREE.PointLight} */
|
|
4083
|
+
(M.isPointLight || /** @type {THREE.SpotLight} */
|
|
4084
|
+
M.isSpotLight ? 683 / 3.1415 : 1),
|
|
4085
|
+
decay_rate: 2,
|
|
4086
|
+
// Approximations for testing – the relevant light has 61.57986...129.4445 as inner/outer spot angle
|
|
4087
|
+
inner_angle: O,
|
|
4088
|
+
outer_angle: IA
|
|
4089
|
+
});
|
|
4090
|
+
}
|
|
4091
|
+
const H = E.length;
|
|
4092
|
+
for (; E.length < R; ) {
|
|
4093
|
+
const M = {
|
|
4094
|
+
type: 0,
|
|
4095
|
+
// Default light type
|
|
4096
|
+
position: new hI(0, 0, 0),
|
|
4097
|
+
direction: new hI(0, 0, -1),
|
|
4098
|
+
color: new BB(0, 0, 0),
|
|
4099
|
+
intensity: 0,
|
|
4100
|
+
decay_rate: 2,
|
|
4101
|
+
inner_angle: 0,
|
|
4102
|
+
outer_angle: 0
|
|
4103
|
+
};
|
|
4104
|
+
E.push(M);
|
|
4105
|
+
}
|
|
4106
|
+
return QG && console.log("Registered lights in MaterialX context", xA, E), { lightData: E, lightCount: H };
|
|
4107
|
+
}
|
|
4108
|
+
function kB(l, w, E) {
|
|
4109
|
+
const R = {}, H = l.getUniformBlocks();
|
|
4110
|
+
for (const [M, F] of Object.entries(H))
|
|
4111
|
+
if (M !== "LightData" && !F.empty())
|
|
4112
|
+
for (let x = 0; x < F.size(); ++x) {
|
|
4113
|
+
const U = F.get(x), s = U.getValue()?.getData(), m = U.getVariable(), AA = U.getType().getName();
|
|
4114
|
+
R[m] = YG(F, AA, s, m, w, E), f && console.log("Adding uniform", { path: U.getPath(), type: AA, name: m, value: R[m] });
|
|
4115
|
+
}
|
|
4116
|
+
return R;
|
|
4117
|
+
}
|
|
4118
|
+
function jI(l, w) {
|
|
4119
|
+
const E = w.getUniformBlocks();
|
|
4120
|
+
for (const [R, H] of Object.entries(E))
|
|
4121
|
+
if (R !== "LightData" && !H.empty())
|
|
4122
|
+
for (let M = 0; M < H.size(); ++M) {
|
|
4123
|
+
const F = H.get(M), x = F.getVariable();
|
|
4124
|
+
let U = F.getPath().split("/").pop();
|
|
4125
|
+
switch (U) {
|
|
4126
|
+
case "_Color":
|
|
4127
|
+
U = "color";
|
|
4128
|
+
break;
|
|
4129
|
+
case "_Roughness":
|
|
4130
|
+
U = "roughness";
|
|
4131
|
+
break;
|
|
4132
|
+
case "_Metallic":
|
|
4133
|
+
U = "metalness";
|
|
4134
|
+
break;
|
|
4135
|
+
}
|
|
4136
|
+
U && (l.hasOwnProperty(U) ? f && console.warn(`[MaterialX] Uniform ${x} already exists in material as property ${U}, skipping.`) : Object.defineProperty(l, U, {
|
|
4137
|
+
get: function() {
|
|
4138
|
+
return this.uniforms?.[x].value;
|
|
4139
|
+
},
|
|
4140
|
+
set: function(s) {
|
|
4141
|
+
const m = this.uniforms;
|
|
4142
|
+
if (!m || !m[x]) {
|
|
4143
|
+
console.warn(`[MaterialX] Uniform ${x} not found in ${this.name} uniforms`);
|
|
4144
|
+
return;
|
|
4145
|
+
}
|
|
4146
|
+
this.uniforms[x].value = s, this.uniformsNeedUpdate = !0;
|
|
4147
|
+
}
|
|
4148
|
+
}));
|
|
4149
|
+
}
|
|
4150
|
+
}
|
|
4151
|
+
async function JG(l) {
|
|
4152
|
+
if (l === "immediately")
|
|
4153
|
+
return vI();
|
|
4154
|
+
if (l === "network_idle")
|
|
4155
|
+
return EG().then(vI);
|
|
4156
|
+
}
|
|
4157
|
+
const e = new class {
|
|
4158
|
+
/** @type {import("./materialx.types.js").MaterialX.MODULE | null} */
|
|
4159
|
+
materialXModule = null;
|
|
4160
|
+
/** @type {any} */
|
|
4161
|
+
materialXGenerator = null;
|
|
4162
|
+
/** @type {any} */
|
|
4163
|
+
materialXGenContext = null;
|
|
4164
|
+
/** @type {any} */
|
|
4165
|
+
materialXStdLib = null;
|
|
4166
|
+
/** @type {Promise<void> | null} */
|
|
4167
|
+
materialXInitPromise = null;
|
|
4168
|
+
}();
|
|
4169
|
+
async function vI() {
|
|
4170
|
+
return e.materialXInitPromise ? e.materialXInitPromise : e.materialXInitPromise = (async () => {
|
|
4171
|
+
if (!e.materialXModule) {
|
|
4172
|
+
f && console.log("[MaterialX] Initializing WASM module...");
|
|
4173
|
+
try {
|
|
4174
|
+
const w = "1.4.0";
|
|
4175
|
+
let E;
|
|
4176
|
+
E = [
|
|
4177
|
+
`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXCore.wasm`,
|
|
4178
|
+
`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXGenShader.wasm`,
|
|
4179
|
+
`https://cdn.needle.tools/static/materialx/${w}/JsMaterialXGenShader.data.txt`
|
|
4180
|
+
];
|
|
4181
|
+
const [R, H, M] = E, F = await qI({
|
|
4182
|
+
locateFile: (U, s) => (f && console.debug("[MaterialX] locateFile called:", { path: U, scriptDirectory: s }), U.includes("JsMaterialXCore.wasm") ? R : U.includes("JsMaterialXGenShader.wasm") ? H : U.includes("JsMaterialXGenShader.data") ? M : s + U)
|
|
4183
|
+
});
|
|
4184
|
+
f && console.log("[MaterialX] module loaded", F), e.materialXModule = /** @type {import("./materialx.types.js").MaterialX.MODULE} */
|
|
4185
|
+
F, e.materialXGenerator = F.EsslShaderGenerator.create(), e.materialXGenContext = new F.GenContext(e.materialXGenerator);
|
|
4186
|
+
const x = F.createDocument();
|
|
4187
|
+
e.materialXStdLib = F.loadStandardLibraries(e.materialXGenContext), x.setDataLibrary(e.materialXStdLib), e.materialXGenContext.getOptions().shaderInterfaceType = e.materialXModule.ShaderInterfaceType.SHADER_INTERFACE_COMPLETE, e.materialXGenContext.getOptions().hwSpecularEnvironmentMethod = e.materialXModule.HwSpecularEnvironmentMethod.SPECULAR_ENVIRONMENT_FIS, e.materialXGenContext.getOptions().hwSrgbEncodeOutput = !1, e.materialXGenContext.getOptions().hwMaxActiveLightSources = 4, await aG(e.materialXModule, e.materialXGenContext), f && console.log("[MaterialX] Generator initialized successfully");
|
|
4188
|
+
} catch (l) {
|
|
4189
|
+
throw console.error("[MaterialX] Failed to load MaterialX module:", l), l;
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
})();
|
|
4193
|
+
}
|
|
4194
|
+
class bg {
|
|
4195
|
+
/**
|
|
4196
|
+
* @param {Scene} scene
|
|
4197
|
+
* @returns {MaterialXEnvironment | null}
|
|
4198
|
+
*/
|
|
4199
|
+
static get(w) {
|
|
4200
|
+
return this.getEnvironment(w);
|
|
4201
|
+
}
|
|
4202
|
+
/** @type {WeakMap<Scene, MaterialXEnvironment>} */
|
|
4203
|
+
static _environments = /* @__PURE__ */ new Map();
|
|
4204
|
+
/**
|
|
4205
|
+
* @param {Scene} scene
|
|
4206
|
+
* @returns {MaterialXEnvironment}
|
|
4207
|
+
*/
|
|
4208
|
+
static getEnvironment(w) {
|
|
4209
|
+
if (this._environments.has(w))
|
|
4210
|
+
return (
|
|
4211
|
+
/** @type {MaterialXEnvironment} */
|
|
4212
|
+
this._environments.get(w)
|
|
4213
|
+
);
|
|
4214
|
+
const E = new bg(w);
|
|
4215
|
+
return this._environments.set(w, E), E;
|
|
4216
|
+
}
|
|
4217
|
+
/** @type {Array<Light>} */
|
|
4218
|
+
_lights = [];
|
|
4219
|
+
/** @type {import("./materialx.helper.js").LightData[] | null} */
|
|
4220
|
+
_lightData = null;
|
|
4221
|
+
/** @type {number} */
|
|
4222
|
+
_lightCount = 0;
|
|
4223
|
+
/** @type {Promise<boolean> | null} */
|
|
4224
|
+
_initializePromise = null;
|
|
4225
|
+
/** @type {boolean} */
|
|
4226
|
+
_isInitialized = !1;
|
|
4227
|
+
/** @type {number} */
|
|
4228
|
+
_lastUpdateFrame = -1;
|
|
4229
|
+
/**
|
|
4230
|
+
* @param {Scene} _scene
|
|
4231
|
+
*/
|
|
4232
|
+
constructor(w) {
|
|
4233
|
+
this._scene = w, f && console.log("[MaterialX] Environment created");
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* Initialize with Needle Engine context
|
|
4237
|
+
* @param {WebGLRenderer} renderer
|
|
4238
|
+
* @returns {Promise<boolean>}
|
|
4239
|
+
*/
|
|
4240
|
+
async initialize(w) {
|
|
4241
|
+
return this._initializePromise ? this._initializePromise : (this._initializePromise = this._initialize(w), this._initializePromise);
|
|
4242
|
+
}
|
|
4243
|
+
/**
|
|
4244
|
+
* @param {number} frame
|
|
4245
|
+
* @param {Scene} scene
|
|
4246
|
+
* @param {WebGLRenderer} renderer
|
|
4247
|
+
*/
|
|
4248
|
+
update(w, E, R) {
|
|
4249
|
+
if (!this._initializePromise) {
|
|
4250
|
+
this.initialize(R);
|
|
4251
|
+
return;
|
|
4252
|
+
}
|
|
4253
|
+
if (this._isInitialized && this._lastUpdateFrame !== w && (this._lastUpdateFrame = w, this.updateLighting(!1), f && !this._debug)) {
|
|
4254
|
+
const H = this._getTextures(E.environment);
|
|
4255
|
+
this._debug = !0;
|
|
4256
|
+
const M = new eE();
|
|
4257
|
+
M.side = 2;
|
|
4258
|
+
const F = M.clone();
|
|
4259
|
+
F.map = H.radianceTexture;
|
|
4260
|
+
const x = new NB(1, 1, 1, 1), U = new Fg(x, F), s = M.clone();
|
|
4261
|
+
s.map = H.irradianceTexture;
|
|
4262
|
+
const m = new Fg(x, s);
|
|
4263
|
+
E.add(U), E.add(m), U.name = "MaterialXRadianceCube", U.position.set(0.8, 1, 0.01), U.scale.set(1.5, 1, 1), m.name = "MaterialXIrradianceCube", m.position.set(-0.8, 1, -0.01), m.scale.set(1.5, 0.98, 1), console.log("[MaterialX] environment initialized from Needle context", { textures: H, radianceCube: U, irradianceCube: m });
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
// Reset the environment to allow re-initialization
|
|
4267
|
+
reset() {
|
|
4268
|
+
f && console.log("[MaterialX] Resetting environment"), this._initializePromise = null, this._isInitialized = !1, this._lastUpdateFrame = -1, this._lights = [], this._lightData = null, this._lightCount = 0, this._pmremGenerator?.dispose(), this._pmremGenerator = null, this._renderer = null;
|
|
4269
|
+
for (const w of this._texturesCache.values())
|
|
4270
|
+
w.radianceTexture?.dispose(), w.irradianceTexture?.dispose();
|
|
4271
|
+
this._texturesCache.clear();
|
|
4272
|
+
}
|
|
4273
|
+
get lights() {
|
|
4274
|
+
return this._lights;
|
|
4275
|
+
}
|
|
4276
|
+
get lightData() {
|
|
4277
|
+
return this._lightData;
|
|
4278
|
+
}
|
|
4279
|
+
get lightCount() {
|
|
4280
|
+
return this._lightCount || 0;
|
|
4281
|
+
}
|
|
4282
|
+
/**
|
|
4283
|
+
* @param {import("./materialx.material.js").MaterialXMaterial} material
|
|
4284
|
+
*/
|
|
4285
|
+
getTextures(w) {
|
|
4286
|
+
if (w.envMap)
|
|
4287
|
+
return this._getTextures(w.envMap);
|
|
4288
|
+
const E = this._scene.environment || this._scene.background;
|
|
4289
|
+
return E instanceof tI ? this._getTextures(E) : this._getTextures(null);
|
|
4290
|
+
}
|
|
4291
|
+
/** @type {PMREMGenerator | null} */
|
|
4292
|
+
_pmremGenerator = null;
|
|
4293
|
+
/** @type {WebGLRenderer | null} */
|
|
4294
|
+
_renderer = null;
|
|
4295
|
+
/** @type {Map<Texture | null, EnvironmentTextureSet>} */
|
|
4296
|
+
_texturesCache = /* @__PURE__ */ new Map();
|
|
4297
|
+
/**
|
|
4298
|
+
* @param {WebGLRenderer} renderer
|
|
4299
|
+
* @returns {Promise<boolean>}
|
|
4300
|
+
*/
|
|
4301
|
+
async _initialize(w) {
|
|
4302
|
+
return this._isInitialized = !1, this._pmremGenerator = new rE(w), this._renderer = w, this.updateLighting(!0), this._isInitialized = !0, !0;
|
|
4303
|
+
}
|
|
4304
|
+
/**
|
|
4305
|
+
* @param {Texture | null | undefined} texture
|
|
4306
|
+
* @returns {{radianceTexture: Texture | null, irradianceTexture: Texture | null}}
|
|
4307
|
+
*/
|
|
4308
|
+
_getTextures(w) {
|
|
4309
|
+
w || (w = nI);
|
|
4310
|
+
let E = this._texturesCache.get(w || null);
|
|
4311
|
+
if (E)
|
|
4312
|
+
return E;
|
|
4313
|
+
if (this._scene && this._pmremGenerator && this._renderer && w) {
|
|
4314
|
+
f && console.log("[MaterialX] Generating environment textures", w.name);
|
|
4315
|
+
const R = this._pmremGenerator.fromEquirectangular(w), H = EB(this._renderer, R.texture, 0, 1024, 512, R.height), M = EB(this._renderer, R.texture, 1, 32, 16, R.height);
|
|
4316
|
+
R.dispose(), E = {
|
|
4317
|
+
radianceTexture: H.texture,
|
|
4318
|
+
irradianceTexture: M.texture
|
|
4319
|
+
};
|
|
4320
|
+
} else
|
|
4321
|
+
E = {
|
|
4322
|
+
radianceTexture: null,
|
|
4323
|
+
irradianceTexture: null
|
|
4324
|
+
};
|
|
4325
|
+
return this._texturesCache.set(w || null, E), E;
|
|
4326
|
+
}
|
|
4327
|
+
/**
|
|
4328
|
+
* @param {boolean} collectLights
|
|
4329
|
+
*/
|
|
4330
|
+
updateLighting = (w = !1) => {
|
|
4331
|
+
if (this._scene) {
|
|
4332
|
+
if (w) {
|
|
4333
|
+
const E = new Array();
|
|
4334
|
+
this._scene.traverse((R) => {
|
|
4335
|
+
/** @type {Light} */
|
|
4336
|
+
R.isLight && R.visible && E.push(
|
|
4337
|
+
/** @type {Light} */
|
|
4338
|
+
R
|
|
4339
|
+
);
|
|
4340
|
+
}), this._lights = E;
|
|
4341
|
+
}
|
|
4342
|
+
if (e.materialXGenContext) {
|
|
4343
|
+
const { lightData: E, lightCount: R } = NG(this._lights, e.materialXGenContext);
|
|
4344
|
+
this._lightData = E, this._lightCount = R;
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
};
|
|
4348
|
+
}
|
|
4349
|
+
const RG = new IG();
|
|
4350
|
+
class JB extends RB {
|
|
4351
|
+
/** The original name of the shader
|
|
4352
|
+
* @type {string | null} */
|
|
4353
|
+
shaderName = null;
|
|
4354
|
+
/**
|
|
4355
|
+
* @param {MaterialXMaterial} source
|
|
4356
|
+
* @returns {this}
|
|
4357
|
+
*/
|
|
4358
|
+
copy(w) {
|
|
4359
|
+
return super.copy(w), this._context = w._context, this._shader = w._shader, this.uniforms = _E(w.uniforms), this.uniformsGroups = $E(w.uniformsGroups), this.envMapIntensity = w.envMapIntensity, this.envMap = w.envMap, jI(this, this._shader.getStage("pixel")), jI(this, this._shader.getStage("vertex")), this.needsUpdate = !0, this;
|
|
4360
|
+
}
|
|
4361
|
+
/** @type {import('./materialx.js').MaterialXContext | null} */
|
|
4362
|
+
_context = null;
|
|
4363
|
+
/** @type {any} */
|
|
4364
|
+
_shader = null;
|
|
4365
|
+
/** @type {boolean} */
|
|
4366
|
+
_needsTangents = !1;
|
|
4367
|
+
/**
|
|
4368
|
+
* @param {MaterialXMaterialInitParameters} [init]
|
|
4369
|
+
*/
|
|
4370
|
+
constructor(w) {
|
|
4371
|
+
if (!w) {
|
|
4372
|
+
super();
|
|
4373
|
+
return;
|
|
4374
|
+
}
|
|
4375
|
+
let E = w.shader.getSourceCode("vertex"), R = w.shader.getSourceCode("pixel");
|
|
4376
|
+
E = E.replace(/^#version.*$/gm, "").trim(), R = R.replace(/^#version.*$/gm, "").trim(), E = E.replace(/\bi_position\b/g, "position"), E = E.replace(/\bi_normal\b/g, "normal"), E = E.replace(/\bi_texcoord_0\b/g, "uv"), E = E.replace(/\bi_texcoord_1\b/g, "uv1"), E = E.replace(/\bi_texcoord_2\b/g, "uv2"), E = E.replace(/\bi_texcoord_3\b/g, "uv3"), E = E.replace(/\bi_tangent\b/g, "tangent"), E = E.replace(/\bi_color_0\b/g, "color");
|
|
4377
|
+
const H = w.parameters?.precision || "highp";
|
|
4378
|
+
E = E.replace(/precision mediump float;/g, `precision ${H} float;`), E = E.replace(/#define M_FLOAT_EPS 1e-8/g, H === "highp" ? "#define M_FLOAT_EPS 1e-8" : "#define M_FLOAT_EPS 1e-3"), R = R.replace(/precision mediump float;/g, `precision ${H} float;`), R = R.replace(/#define M_FLOAT_EPS 1e-8/g, H === "highp" ? "#define M_FLOAT_EPS 1e-8" : "#define M_FLOAT_EPS 1e-3"), R = R.replace(/\bi_position\b/g, "position"), R = R.replace(/\bi_normal\b/g, "normal"), R = R.replace(/\bi_texcoord_0\b/g, "uv"), R = R.replace(/\bi_texcoord_1\b/g, "uv1"), R = R.replace(/\bi_texcoord_2\b/g, "uv2"), R = R.replace(/\bi_texcoord_3\b/g, "uv3"), R = R.replace(/\bi_tangent\b/g, "tangent"), R = R.replace(/\bi_color_0\b/g, "color");
|
|
4379
|
+
const M = E.includes("in vec2 uv;"), F = E.includes("in vec2 uv1;"), x = E.includes("in vec2 uv2;"), U = E.includes("in vec2 uv3;");
|
|
4380
|
+
E = E.replace(/in\s+vec3\s+position;/g, ""), E = E.replace(/in\s+vec3\s+normal;/g, ""), E = E.replace(/in\s+vec2\s+uv;/g, ""), E = E.replace(/in\s+vec3\s+uv;/g, "");
|
|
4381
|
+
var s = E.includes("in vec3 uv1;");
|
|
4382
|
+
E = E.replace(/in\s+vec3\s+uv1;/g, "");
|
|
4383
|
+
var m = E.includes("in vec3 uv2;");
|
|
4384
|
+
E = E.replace(/in\s+vec3\s+uv2;/g, "");
|
|
4385
|
+
var AA = E.includes("in vec3 uv3;");
|
|
4386
|
+
E = E.replace(/in\s+vec3\s+uv3;/g, "");
|
|
4387
|
+
var O = E.includes("in vec4 tangent;");
|
|
4388
|
+
E = E.replace(/in\s+vec4\s+tangent;/g, "");
|
|
4389
|
+
var IA = E.includes("in vec4 color;");
|
|
4390
|
+
E = E.replace(/in\s+vec4\s+color;/g, ""), M || (E = E.replace(/texcoord_0 = uv;/g, "texcoord_0 = vec3(uv, 0.0);")), F || (E = E.replace(/texcoord_1 = uv1;/g, "texcoord_1 = vec3(uv1, 0.0);")), x || (E = E.replace(/texcoord_2 = uv2;/g, "texcoord_2 = vec3(uv2, 0.0);")), U || (E = E.replace(/texcoord_3 = uv3;/g, "texcoord_3 = vec3(uv3, 0.0);")), R = R.replace(
|
|
4391
|
+
/result\.direction\s*=\s*light\.position\s*-\s*position;/g,
|
|
4392
|
+
"result.direction = (light.position - position) * 10.0 / 1.0;"
|
|
4393
|
+
), R = R.replace(
|
|
4394
|
+
/out\s+vec4\s+out1;/,
|
|
4395
|
+
`layout(location = 0) out vec4 pc_fragColor;
|
|
4396
|
+
#define gl_FragColor pc_fragColor`
|
|
4397
|
+
), R = R.replace(/^\s*out1\s*=\s*vec4\((.*)\);/gm, `
|
|
4398
|
+
gl_FragColor = vec4($1);
|
|
4399
|
+
#include <tonemapping_fragment>
|
|
4400
|
+
#include <colorspace_fragment>`);
|
|
4401
|
+
const v = {};
|
|
4402
|
+
s && (v.USE_UV1 = ""), m && (v.USE_UV2 = ""), AA && (v.USE_UV3 = ""), O && (v.USE_TANGENT = ""), IA && (v.USE_COLOR = "");
|
|
4403
|
+
const hA = "", UA = w.parameters?.transparent ?? !1;
|
|
4404
|
+
super({
|
|
4405
|
+
name: w.name,
|
|
4406
|
+
uniforms: {},
|
|
4407
|
+
vertexShader: E,
|
|
4408
|
+
fragmentShader: R,
|
|
4409
|
+
glslVersion: AG,
|
|
4410
|
+
depthTest: !0,
|
|
4411
|
+
depthWrite: !UA,
|
|
4412
|
+
defines: v,
|
|
4413
|
+
...w.parameters
|
|
4414
|
+
// Spread any additional parameters passed to the material
|
|
4415
|
+
}), this.shaderName = w.shaderName || null, this._context = w.context, this._shader = w.shader, this._needsTangents = E.includes("in vec4 tangent;") || E.includes("in vec3 tangent;"), Object.assign(this.uniforms, {
|
|
4416
|
+
...kB(w.shader.getStage("vertex"), w.loaders, hA),
|
|
4417
|
+
...kB(w.shader.getStage("pixel"), w.loaders, hA),
|
|
4418
|
+
u_worldMatrix: { value: new xI() },
|
|
4419
|
+
u_viewProjectionMatrix: { value: new xI() },
|
|
4420
|
+
u_viewPosition: { value: new hI() },
|
|
4421
|
+
u_worldInverseTransposeMatrix: { value: new xI() },
|
|
4422
|
+
// u_shadowMatrix: { value: new Matrix4() },
|
|
4423
|
+
// u_shadowMap: { value: null, type: 't' }, // Shadow map
|
|
4424
|
+
u_envMatrix: { value: new xI() },
|
|
4425
|
+
u_envRadiance: { value: null, type: "t" },
|
|
4426
|
+
u_envRadianceMips: { value: 8, type: "i" },
|
|
4427
|
+
// TODO we need to figure out how we can set a PMREM here... doing many texture samples is prohibitively expensive
|
|
4428
|
+
u_envRadianceSamples: { value: 8, type: "i" },
|
|
4429
|
+
u_envIrradiance: { value: null, type: "t" },
|
|
4430
|
+
u_refractionEnv: { value: !0 },
|
|
4431
|
+
u_numActiveLightSources: { value: 0 },
|
|
4432
|
+
u_lightData: { value: [], needsUpdate: !1 }
|
|
4433
|
+
// Array of light data. We need to set needsUpdate to false until we actually update it
|
|
4434
|
+
}), jI(this, w.shader.getStage("pixel")), jI(this, w.shader.getStage("vertex")), (f || w.debug) && (console.group("[MaterialX]: ", this.name), console.log(`Vertex shader length: ${E.length}
|
|
4435
|
+
`, E), console.log(`Fragment shader length: ${R.length}
|
|
4436
|
+
`, R), console.groupEnd());
|
|
4437
|
+
}
|
|
4438
|
+
/** @type {boolean} */
|
|
4439
|
+
_missingTangentsWarned = !1;
|
|
4440
|
+
/**
|
|
4441
|
+
* @param {WebGLRenderer} renderer
|
|
4442
|
+
* @param {Scene} _scene
|
|
4443
|
+
* @param {Camera} camera
|
|
4444
|
+
* @param {BufferGeometry} geometry
|
|
4445
|
+
* @param {Object3D} object
|
|
4446
|
+
* @param {Group} _group
|
|
4447
|
+
*/
|
|
4448
|
+
onBeforeRender(w, E, R, H, M, F) {
|
|
4449
|
+
this._needsTangents && !H.attributes.tangent && (this._missingTangentsWarned || (this._missingTangentsWarned = !0, console.warn(`[MaterialX] Tangents are required for this material (${this.name}) but not present in the geometry.`)));
|
|
4450
|
+
const x = this._context?.getTime?.() || QB(), U = this._context?.getFrame?.() || CB(), s = bg.get(E);
|
|
4451
|
+
s && (s.update(U, E, w), this.updateEnvironmentUniforms(s)), this.updateUniforms(w, M, R, x, U);
|
|
4452
|
+
}
|
|
4453
|
+
/** @type {number} */
|
|
4454
|
+
envMapIntensity = 1;
|
|
4455
|
+
// Default intensity for environment map
|
|
4456
|
+
/** @type {Texture | null} */
|
|
4457
|
+
envMap = null;
|
|
4458
|
+
// Environment map texture, can be set externally
|
|
4459
|
+
/**
|
|
4460
|
+
* @param {WebGLRenderer} _renderer
|
|
4461
|
+
* @param {Object3D} object
|
|
4462
|
+
* @param {Camera} camera
|
|
4463
|
+
* @param {number} [time]
|
|
4464
|
+
* @param {number} [frame]
|
|
4465
|
+
*/
|
|
4466
|
+
updateUniforms = (w, E, R, H, M) => {
|
|
4467
|
+
const F = this.uniforms;
|
|
4468
|
+
F.u_worldMatrix && (F.u_worldMatrix.value.copy(E.matrixWorld), F.u_worldMatrix.needsUpdate = !0), F.u_viewPosition && (F.u_viewPosition.value.setFromMatrixPosition(R.matrixWorld), F.u_viewPosition.needsUpdate = !0), F.u_viewProjectionMatrix && (F.u_viewProjectionMatrix.value.multiplyMatrices(R.projectionMatrix, R.matrixWorldInverse), F.u_viewProjectionMatrix.needsUpdate = !0), F.u_worldInverseTransposeMatrix && (F.u_worldInverseTransposeMatrix.value.setFromMatrix3(RG.getNormalMatrix(E.matrixWorld)), F.u_worldInverseTransposeMatrix.needsUpdate = !0), F.u_time && (H === void 0 && (H = QB()), F.u_time.value = H), F.u_frame && (M === void 0 && (M = CB()), F.u_frame.value = M), this.uniformsNeedUpdate = !0;
|
|
4469
|
+
};
|
|
4470
|
+
/**
|
|
4471
|
+
* @private
|
|
4472
|
+
* @param {MaterialXEnvironment} environment
|
|
4473
|
+
*/
|
|
4474
|
+
updateEnvironmentUniforms = (w) => {
|
|
4475
|
+
const E = this.uniforms, R = w.lightData || null, H = w.lightCount || 0, M = w.getTextures(this) || null;
|
|
4476
|
+
if (E.u_numActiveLightSources && H >= 0 && (E.u_numActiveLightSources.value = H), R?.length && (E.u_lightData.value = R, "needsUpdate" in E.u_lightData && E.u_lightData.needsUpdate === !1 && (f && console.debug(`[MaterialX] LightData assigned (${this.name}, ${this.uuid})`, R), E.u_lightData.needsUpdate = void 0)), E.u_envRadiance) {
|
|
4477
|
+
const F = E.u_envRadiance.value;
|
|
4478
|
+
E.u_envRadiance.value = M.radianceTexture, F != M.radianceTexture && (E.u_envRadiance.needsUpdate = !0);
|
|
4479
|
+
}
|
|
4480
|
+
if (E.u_envRadianceMips && (E.u_envRadianceMips.value = Math.trunc(Math.log2(Math.max(M.radianceTexture?.source.data.width ?? 0, M.radianceTexture?.source.data.height ?? 0))) + 1), E.u_envIrradiance) {
|
|
4481
|
+
const F = E.u_envIrradiance.value;
|
|
4482
|
+
E.u_envIrradiance.value = M.irradianceTexture, F != M.irradianceTexture && (E.u_envIrradiance.needsUpdate = !0);
|
|
4483
|
+
}
|
|
4484
|
+
this.uniformsNeedUpdate = !0;
|
|
4485
|
+
};
|
|
4486
|
+
}
|
|
4487
|
+
class FG {
|
|
4488
|
+
/** @readonly */
|
|
4489
|
+
name = "NEEDLE_materials_mtlx";
|
|
4490
|
+
/** @type {MaterialXMaterial[]} */
|
|
4491
|
+
_generatedMaterials = [];
|
|
4492
|
+
/** @type {Promise<any> | null} */
|
|
4493
|
+
_documentReadyPromise = null;
|
|
4494
|
+
/**
|
|
4495
|
+
* @returns {MaterialX_root_extension | null}
|
|
4496
|
+
*/
|
|
4497
|
+
get materialX_root_data() {
|
|
4498
|
+
const w = this.parser.json.extensions?.[this.name];
|
|
4499
|
+
if (!w)
|
|
4500
|
+
return null;
|
|
4501
|
+
let E = null;
|
|
4502
|
+
return "documents" in w && Array.isArray(w.documents) ? E = w.documents : E = [w], E;
|
|
4503
|
+
}
|
|
4504
|
+
/** Generated materialX materials */
|
|
4505
|
+
get materials() {
|
|
4506
|
+
return this._generatedMaterials;
|
|
4507
|
+
}
|
|
4508
|
+
/**
|
|
4509
|
+
* MaterialXLoader constructor
|
|
4510
|
+
* @param {import('three/examples/jsm/loaders/GLTFLoader.js').GLTFParser} parser - The GLTFParser instance
|
|
4511
|
+
* @param {MaterialXLoaderOptions} options - The loader options
|
|
4512
|
+
* @param {import('../materialx.js').MaterialXContext} context - The context for the GLTF loading process
|
|
4513
|
+
*/
|
|
4514
|
+
constructor(w, E, R) {
|
|
4515
|
+
this.parser = w, this.options = E, this.context = R, f && console.log("MaterialXLoader created for parser"), this.materialX_root_data && vI();
|
|
4516
|
+
}
|
|
4517
|
+
/**
|
|
4518
|
+
* @param {number} materialIndex
|
|
4519
|
+
* @returns {Promise<Material> | null}
|
|
4520
|
+
*/
|
|
4521
|
+
loadMaterial(w) {
|
|
4522
|
+
return this.parser.json.materials?.[w]?.extensions?.[this.name] ? this._loadMaterialAsync(w) : null;
|
|
4523
|
+
}
|
|
4524
|
+
/**
|
|
4525
|
+
* @private
|
|
4526
|
+
* @param {number} materialIndex
|
|
4527
|
+
* @returns {Promise<Material>}
|
|
4528
|
+
*/
|
|
4529
|
+
async _loadMaterialAsync(w) {
|
|
4530
|
+
const E = this.parser.json.materials?.[w];
|
|
4531
|
+
f && console.debug("[MaterialX] extension found in material:", E.extensions?.[this.name]);
|
|
4532
|
+
const R = E.extensions?.[this.name], H = R.document || 0, M = this.materialX_root_data?.[H], F = M.mtlx || null;
|
|
4533
|
+
if (R && F) {
|
|
4534
|
+
const U = {
|
|
4535
|
+
...this.options
|
|
4536
|
+
};
|
|
4537
|
+
return U.parameters || (U.parameters = {}), U.parameters?.side === void 0 && E.doubleSided !== void 0 && (U.parameters.side = E.doubleSided ? gG : BG), MB(F, R.name, {
|
|
4538
|
+
cacheKey: this.options.cacheKey || "",
|
|
4539
|
+
getTexture: async (s) => {
|
|
4540
|
+
const m = s.split("/").pop()?.split(".").shift() || "";
|
|
4541
|
+
if (M) {
|
|
4542
|
+
const AA = M.textures || [];
|
|
4543
|
+
let O = -1;
|
|
4544
|
+
for (const IA of AA)
|
|
4545
|
+
if (IA.name === m) {
|
|
4546
|
+
const v = IA.pointer, hA = v.substring(10);
|
|
4547
|
+
if (O = parseInt(hA), isNaN(O) || O < 0) {
|
|
4548
|
+
console.error("[MaterialX] Invalid texture index in pointer:", v);
|
|
4549
|
+
return;
|
|
4550
|
+
} else
|
|
4551
|
+
f && console.log("[MaterialX] Texture index found:", O, "for", m);
|
|
4552
|
+
}
|
|
4553
|
+
if (O < 0) {
|
|
4554
|
+
console.error("[MaterialX] Texture not found in parser:", m, this.parser.json);
|
|
4555
|
+
return;
|
|
4556
|
+
}
|
|
4557
|
+
return this.parser.getDependency("texture", O);
|
|
4558
|
+
}
|
|
4559
|
+
return null;
|
|
4560
|
+
}
|
|
4561
|
+
}, U, this.context).then((s) => (s instanceof JB && this._generatedMaterials.push(s), s));
|
|
4562
|
+
}
|
|
4563
|
+
const x = new uI();
|
|
4564
|
+
return x.name = "MaterialX_Fallback", x;
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
4567
|
+
function MG(l, w, E) {
|
|
4568
|
+
l.register((R) => new FG(R, w || {}, E || {}));
|
|
4569
|
+
}
|
|
4570
|
+
async function bG(l) {
|
|
4571
|
+
if (await vI(), !e.materialXModule)
|
|
4572
|
+
throw new Error("[MaterialX] module failed to initialize");
|
|
4573
|
+
const w = e.materialXModule.createDocument();
|
|
4574
|
+
return w.setDataLibrary(e.materialXStdLib), await e.materialXModule.readFromXmlString(w, l, ""), f && console.log("[MaterialX] root document parsed successfully"), w;
|
|
4575
|
+
}
|
|
4576
|
+
async function MB(l, w, E, R, H) {
|
|
4577
|
+
try {
|
|
4578
|
+
f && console.log(`Creating MaterialX material: ${w}`);
|
|
4579
|
+
const M = await bG(l);
|
|
4580
|
+
if (!e.materialXModule || !e.materialXGenerator || !e.materialXGenContext) {
|
|
4581
|
+
console.warn("[MaterialX] WASM module not ready, returning fallback material");
|
|
4582
|
+
const IA = new uI();
|
|
4583
|
+
return IA.name = `MaterialX_Fallback_${w}`, IA;
|
|
4584
|
+
}
|
|
4585
|
+
let F = null, x = !1;
|
|
4586
|
+
f && console.log("[MaterialX] document", M);
|
|
4587
|
+
const U = M.getMaterialNodes();
|
|
4588
|
+
f && console.log(`[MaterialX] Found ${U.length} material nodes in document`, U);
|
|
4589
|
+
for (let IA = 0; IA < U.length; ++IA) {
|
|
4590
|
+
const v = U[IA];
|
|
4591
|
+
if (v) {
|
|
4592
|
+
const hA = v.getNamePath();
|
|
4593
|
+
if (f && console.log(`[MaterialX] Scan material[${IA}]: ${hA}`), U.length === 1 || hA == w || IA === w) {
|
|
4594
|
+
w = hA, F = v, x = !0, f && console.log(`[MaterialX] Use material node: '${hA}'`);
|
|
4595
|
+
break;
|
|
4596
|
+
}
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
if (!F) {
|
|
4600
|
+
U.length <= 0 ? console.warn("[MaterialX] No material nodes found in MaterialX document.") : console.warn(`[MaterialX] No renderable element found in MaterialX document (${w}) → Please provide a name or index. ${U.length} options: ${U.map((v) => v.getNamePath()).join(", ")}`);
|
|
4601
|
+
const IA = new uI();
|
|
4602
|
+
return IA.color.set(16711935), IA.name = `MaterialX_NoRenderable_${w}`, IA;
|
|
4603
|
+
}
|
|
4604
|
+
f && console.log("[MaterialX] Using renderable element for shader generation");
|
|
4605
|
+
const s = e.materialXModule.isTransparentSurface(F, e.materialXGenerator.getTarget());
|
|
4606
|
+
e.materialXGenContext.getOptions().hwTransparency = s, f && console.log("[MaterialX] Generating MaterialX shaders...");
|
|
4607
|
+
const m = F.getNamePath ? F.getNamePath() : F.getName(), AA = e.materialXGenerator.generate(m, F, e.materialXGenContext), O = new JB({
|
|
4608
|
+
name: w,
|
|
4609
|
+
shaderName: null,
|
|
4610
|
+
//shaderInfo?.originalName || shaderInfo?.name || null,
|
|
4611
|
+
shader: AA,
|
|
4612
|
+
context: H || {},
|
|
4613
|
+
parameters: {
|
|
4614
|
+
transparent: s,
|
|
4615
|
+
...R?.parameters
|
|
4616
|
+
},
|
|
4617
|
+
loaders: E
|
|
4618
|
+
});
|
|
4619
|
+
return f && console.log("[MaterialX] material created:", O.name), O;
|
|
4620
|
+
} catch (M) {
|
|
4621
|
+
console.error(`[MaterialX] Error creating MaterialX material (${w}):`, M);
|
|
4622
|
+
const F = new uI();
|
|
4623
|
+
return F.color.set(16711935), F.name = `MaterialX_Error_${w}`, F;
|
|
4624
|
+
}
|
|
4625
|
+
}
|
|
4626
|
+
const UG = {
|
|
4627
|
+
createMaterialXMaterial: MB
|
|
4628
|
+
};
|
|
4629
|
+
export {
|
|
4630
|
+
UG as Experimental_API,
|
|
4631
|
+
FG as MaterialXLoader,
|
|
4632
|
+
JB as MaterialXMaterial,
|
|
4633
|
+
JG as preloadWasm,
|
|
4634
|
+
vI as ready,
|
|
4635
|
+
MG as useNeedleMaterialX
|
|
4636
|
+
};
|