@arcgis/core 5.2.0-next.43 → 5.2.0-next.45
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0115681a3de6df0aebdf.js +1 -0
- package/assets/esri/core/workers/chunks/025caafc70ac26f0a4ed.js +1 -0
- package/assets/esri/core/workers/chunks/{9de18cea5780319302cb.js → 04a167c110fb7811169d.js} +1 -1
- package/assets/esri/core/workers/chunks/{72fe7fb03c156f26a589.js → 08e18fb12533fc76e49c.js} +1 -1
- package/assets/esri/core/workers/chunks/{60e8524d324fd14444d7.js → 0a0732ba8271d7dc985c.js} +1 -1
- package/assets/esri/core/workers/chunks/0e64e20fedfe01a1985f.js +1 -0
- package/assets/esri/core/workers/chunks/{e6b5c015205d38abe037.js → 127b111ee53e4b9184f8.js} +1 -1
- package/assets/esri/core/workers/chunks/15351354afcbf840a23d.js +29 -0
- package/assets/esri/core/workers/chunks/{2d7cfc68a38dabd8898a.js → 176c5eaaa23a479c88e0.js} +1 -1
- package/assets/esri/core/workers/chunks/1d1f5578c7d8619f7a46.js +1 -0
- package/assets/esri/core/workers/chunks/268637fd6c50264acfc3.js +1 -0
- package/assets/esri/core/workers/chunks/296fa9fb80e521c30cb1.js +1 -0
- package/assets/esri/core/workers/chunks/{d7775ed1402946e414ef.js → 2974cddb0b0f67df7d2d.js} +1 -1
- package/assets/esri/core/workers/chunks/2c0d92c0e3511775401a.js +29 -0
- package/assets/esri/core/workers/chunks/{ce2320e7b9c4ca96ff27.js → 3252da57b800356116af.js} +1 -1
- package/assets/esri/core/workers/chunks/{fd47ee8598e37fea03fe.js → 384b619854ef8a3f6e94.js} +1 -1
- package/assets/esri/core/workers/chunks/3af923abeb6e65c4468f.js +1 -0
- package/assets/esri/core/workers/chunks/{20fefb9278501781de14.js → 3f4f1595c8a77d072b04.js} +1 -1
- package/assets/esri/core/workers/chunks/4f09f208ece2ec1db727.js +1 -0
- package/assets/esri/core/workers/chunks/{f1f3fe9d2d96578f4f6b.js → 52efa4ded11c1e71f04f.js} +1 -1
- package/assets/esri/core/workers/chunks/{57a1e2b716b74f0124f7.js → 549295a5db9bf1536491.js} +1 -1
- package/assets/esri/core/workers/chunks/{284e88805184334396fe.js → 57374213084bef59b776.js} +1 -1
- package/assets/esri/core/workers/chunks/{2a8d791aef3123e6a3c4.js → 57970d43cdcc5cf57a30.js} +1 -1
- package/assets/esri/core/workers/chunks/5f9c4dad6952c4c58ebf.js +1 -0
- package/assets/esri/core/workers/chunks/706230b70a36d2e038f7.js +1 -0
- package/assets/esri/core/workers/chunks/{4063ea53cba3dd897e53.js → 728ea88e7d4733230e1f.js} +71 -72
- package/assets/esri/core/workers/chunks/{e2f45990d8459d14cb90.js → 76713b700e053f8bad29.js} +1 -1
- package/assets/esri/core/workers/chunks/{d082de5dd83bd73d209b.js → 8026cc0065f6520c4161.js} +1 -1
- package/assets/esri/core/workers/chunks/93e705c1147cc8ceca02.js +1 -0
- package/assets/esri/core/workers/chunks/a8033e606b2db1ee332d.js +1 -0
- package/assets/esri/core/workers/chunks/{7684f0c771d312e05bb4.js → ad5c2b0de6713d0a93a4.js} +58 -58
- package/assets/esri/core/workers/chunks/{9b1199104a6822ab7340.js → ae9f9e975d7a9d442fa5.js} +1 -1
- package/assets/esri/core/workers/chunks/{6f408397e2c8a2ea9805.js → aea247138617e12b699b.js} +1 -1
- package/assets/esri/core/workers/chunks/{26e7884d8639df4d994b.js → b03dcf3d55266745f3d1.js} +1 -1
- package/assets/esri/core/workers/chunks/b3cd17daf5a297b96705.js +29 -0
- package/assets/esri/core/workers/chunks/{c0637d1c9337a6ba46b0.js → b3cefc1895bfd62fc440.js} +1 -1
- package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js → bac4d4a9f3a9b7f6864d.js} +2 -2
- package/assets/esri/core/workers/chunks/{2f29f08cddd5add9388e.js → c01a121ebe571a848452.js} +1 -1
- package/assets/esri/core/workers/chunks/c3cd38ca8690286d40d7.js +1 -0
- package/assets/esri/core/workers/chunks/{c1845682cc9a5aac8703.js → c4b13124a9cfc78c42a6.js} +6 -6
- package/assets/esri/core/workers/chunks/c5e36544b2d1792e4c5f.js +1 -0
- package/assets/esri/core/workers/chunks/c6042825f61cd70d54d8.js +1 -0
- package/assets/esri/core/workers/chunks/{0646524250bb9fe82935.js → d8b67ca02cdc1e8191e3.js} +1 -1
- package/assets/esri/core/workers/chunks/db416ba3132034e20642.js +1 -0
- package/assets/esri/core/workers/chunks/{96d5fed0235558c0e348.js → e9c48630757bea465b7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{e9511627418c6864148a.js → ed988360264574cd8f6b.js} +1 -1
- package/assets/esri/core/workers/chunks/f9b2727b41943d83d4ca.js +1 -0
- package/assets/esri/core/workers/chunks/{d45e30f15142b5861111.js → fc880b275f5eaf42171e.js} +1 -1
- package/assets/esri/libs/basisu/basis_encoder.wasm +0 -0
- package/assets/esri/libs/dxtEncoder/dxt_encoder.wasm +0 -0
- package/chunks/CutFillComposition.glsl.js +2 -2
- package/chunks/CutFillReduction.glsl.js +1 -1
- package/chunks/EmissionComposite.glsl.js +2 -0
- package/chunks/FocusAreaColor.glsl.js +1 -1
- package/chunks/Fog.glsl.js +20 -20
- package/chunks/GlobalIllumination.glsl.js +25 -25
- package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
- package/chunks/GlowBlur.glsl.js +16 -18
- package/chunks/GlowComposite.glsl.js +35 -0
- package/chunks/Laserline.glsl.js +13 -13
- package/chunks/LaserlinePath.glsl.js +11 -10
- package/chunks/OITAddEmission.glsl.js +1 -1
- package/chunks/Precipitation.glsl.js +6 -6
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/chunks/ShadowHighlight.glsl.js +3 -3
- package/chunks/Viewshed.glsl.js +3 -3
- package/chunks/basis_encoder.js +1 -1
- package/chunks/dxt_encoder.js +1 -1
- package/config.js +1 -1
- package/core/screenUtils.js +1 -1
- package/core/types.d.ts +7 -0
- package/geometry/support/aaBoundingBox.js +1 -1
- package/geometry/support/frustum.js +1 -1
- package/kernel.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/environment/CloudyWeather.js +1 -1
- package/views/3d/environment/FoggyWeather.js +1 -1
- package/views/3d/environment/RainyWeather.js +1 -1
- package/views/3d/environment/SnowyWeather.js +1 -1
- package/views/3d/environment/SunnyWeather.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/intersectionHitUtils.js +2 -0
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +12 -12
- package/views/3d/webgl-engine/collections/Component/Transform.js +1 -1
- package/views/3d/webgl-engine/collections/Component/UniformComponentParameters.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +8 -0
- package/views/3d/webgl-engine/core/shaderLibrary/util/blendEmission.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaVisualization.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposite.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/glow/GlowCompositeTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/Laserline.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITAddEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendFragmentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +2 -0
- package/views/3d/webgl-engine/lib/EmissionComposite.js +2 -0
- package/views/3d/webgl-engine/lib/EmissionCompositeTechnique.js +2 -0
- package/views/3d/webgl-engine/lib/HUDIntersectorResult.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +2 -2
- package/views/3d/webgl-engine/shaders/ViewshedTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/{oitResolution.glsl.js → floatBlendScale.glsl.js} +1 -1
- package/views/SceneView.d.ts +4 -3
- package/views/SceneView.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/support/TextureCompressionWorkerHandle.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0d6afba80d2f8dcb5cf7.js +0 -1
- package/assets/esri/core/workers/chunks/1276df03201c1b855fee.js +0 -1
- package/assets/esri/core/workers/chunks/23570397304969f724b3.js +0 -1
- package/assets/esri/core/workers/chunks/34fcb776e4de1d870bbd.js +0 -30
- package/assets/esri/core/workers/chunks/474ea8c97d101e41b3f5.js +0 -1
- package/assets/esri/core/workers/chunks/7cb0681cc6a5e956cb15.js +0 -1
- package/assets/esri/core/workers/chunks/8b73694d5a97638a3a61.js +0 -1
- package/assets/esri/core/workers/chunks/8dee03779b569f233daf.js +0 -1
- package/assets/esri/core/workers/chunks/9ebc98746b1f085b82b7.js +0 -1
- package/assets/esri/core/workers/chunks/9ee3741eef73f3edb18b.js +0 -1
- package/assets/esri/core/workers/chunks/af97e19516dbbcfb5286.js +0 -1
- package/assets/esri/core/workers/chunks/b4047333265a2665aef9.js +0 -1
- package/assets/esri/core/workers/chunks/ca419858910af5505d3d.js +0 -1
- package/assets/esri/core/workers/chunks/cce83896093279c70449.js +0 -1
- package/assets/esri/core/workers/chunks/d5561dff043789494845.js +0 -1
- package/assets/esri/core/workers/chunks/dedf678490572c500a19.js +0 -30
- package/assets/esri/core/workers/chunks/e2c9393bec747f7876bb.js +0 -1
- package/assets/esri/core/workers/chunks/e94f2d6037fba042dc6e.js +0 -1
- package/assets/esri/core/workers/chunks/ec1a2e68957fae48e60b.js +0 -30
- package/assets/esri/core/workers/chunks/f5d7f69047e1b1116202.js +0 -1
- package/chunks/GlowComposition.glsl.js +0 -39
- package/views/2d/engine/webgl/MaterialManager.js +0 -2
- package/views/2d/engine/webgl/shaders/MaterialPrograms.js +0 -2
- package/views/2d/engine/webgl/shaders/sources/resolver.js +0 -2
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +0 -2
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +0 -9
- package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +0 -2
- package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +0 -2
- package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +0 -2
- package/views/webgl/ShaderCompiler.js +0 -2
- /package/assets/esri/core/workers/chunks/{89682d9d4f606f82056b.js.LICENSE.txt → bac4d4a9f3a9b7f6864d.js.LICENSE.txt} +0 -0
package/chunks/dxt_encoder.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
var r,e=(r="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,n,o=e,a=new Promise((r,e)=>{t=r,n=e}),i="object"==typeof window,s="undefined"!=typeof WorkerGlobalScope;"object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&process.type;var l,u,d=Object.assign({},o),c="./this.program",f="";function h(r){return o.locateFile?o.locateFile(r,f):f+r}(i||s)&&(s?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=f.startsWith("blob:")?"":f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(u=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=async r=>{var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)});var p=o.print||console.log.bind(console),m=o.printErr||console.error.bind(console);Object.assign(o,d),d=null,o.arguments&&o.arguments,o.thisProgram&&(c=o.thisProgram);var v,w,y,g,E,k,b,_,A,F=o.wasmBinary,P=!1;function D(){var r=v.buffer;o.HEAP8=w=new Int8Array(r),o.HEAP16=g=new Int16Array(r),o.HEAPU8=y=new Uint8Array(r),o.HEAPU16=E=new Uint16Array(r),o.HEAP32=k=new Int32Array(r),o.HEAPU32=b=new Uint32Array(r),o.HEAPF32=_=new Float32Array(r),o.HEAPF64=A=new Float64Array(r)}var S=[],T=[],C=[];function M(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)R(o.preRun.shift());rr(S)}function j(){o.noFSInit||ft.initialized||ft.init(),ft.ignorePermissions=!1,rr(T)}function x(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)N(o.postRun.shift());rr(C)}function R(r){S.unshift(r)}function $(r){T.unshift(r)}function N(r){C.unshift(r)}var z=0,O=null;function W(r){z++,o.monitorRunDependencies?.(z)}function B(r){if(z--,o.monitorRunDependencies?.(z),0==z&&O){var e=O;O=null,e()}}function U(r){o.onAbort?.(r),m(r="Aborted("+r+")"),P=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw n(e),e}var L,H,I,V="data:application/octet-stream;base64,",q=r=>r.startsWith(V);function X(){var r="dxt_encoder.wasm";return q(r)?r:h(r)}function G(r){if(r==L&&F)return new Uint8Array(F);if(u)return u(r);throw"both async and sync fetching of the wasm failed"}async function K(r){if(!F)try{var e=await l(r);return new Uint8Array(e)}catch{}return G(r)}async function J(r,e){try{var t=await K(r);return await WebAssembly.instantiate(t,e)}catch(n){m(`failed to asynchronously prepare wasm: ${n}`),U(n)}}async function Q(r,e,t){if(!r&&"function"==typeof WebAssembly.instantiateStreaming&&!q(e)&&"function"==typeof fetch)try{var n=fetch(e,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(o){m(`wasm streaming compile failed: ${o}`),m("falling back to ArrayBuffer instantiation")}return J(e,t)}function Y(){return{a:bt}}async function Z(){function r(r,e){return kt=r.exports,v=kt.G,D(),zr=kt.J,$(kt.H),B(),kt}function e(e){r(e.instance)}W();var t=Y();if(o.instantiateWasm)try{return o.instantiateWasm(t,r)}catch(i){m(`Module.instantiateWasm callback failed with error: ${i}`),n(i)}L??=X();try{var a=await Q(F,L,t);return e(a),a}catch(i){return void n(i)}}var rr=r=>{for(;r.length>0;)r.shift()(o)};o.noExitRuntime;class er{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){b[this.ptr+4>>2]=r}get_type(){return b[this.ptr+4>>2]}set_destructor(r){b[this.ptr+8>>2]=r}get_destructor(){return b[this.ptr+8>>2]}set_caught(r){r=r?1:0,w[this.ptr+12]=r}get_caught(){return 0!=w[this.ptr+12]}set_rethrown(r){r=r?1:0,w[this.ptr+13]=r}get_rethrown(){return 0!=w[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){b[this.ptr+16>>2]=r}get_adjusted_ptr(){return b[this.ptr+16>>2]}}var tr,nr,or,ar=(r,e,t)=>{throw new er(r).init(e,t),r},ir=()=>U(""),sr=(r,e,t,n,o)=>{},lr=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);tr=r},ur=r=>{for(var e="",t=r;y[t];)e+=tr[y[t++]];return e},dr={},cr={},fr={},hr=r=>{throw new nr(r)},pr=r=>{throw new or(r)},mr=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&pr("Mismatched type converter count");for(var o=0;o<r.length;++o)wr(r[o],n[o])}r.forEach(r=>fr[r]=e);var o=new Array(e.length),a=[],i=0;e.forEach((r,e)=>{cr.hasOwnProperty(r)?o[e]=cr[r]:(a.push(r),dr.hasOwnProperty(r)||(dr[r]=[]),dr[r].push(()=>{o[e]=cr[r],++i===a.length&&n(o)}))}),0===a.length&&n(o)};function vr(r,e,t={}){var n=e.name;if(r||hr(`type "${n}" must have a positive integer typeid pointer`),cr.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;hr(`Cannot register type '${n}' twice`)}if(cr[r]=e,delete fr[r],dr.hasOwnProperty(r)){var o=dr[r];delete dr[r],o.forEach(r=>r())}}function wr(r,e,t={}){return vr(r,e,t)}var yr=8,gr=(r,e,t,n)=>{wr(r,{name:e=ur(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:yr,readValueFromPointer:function(r){return this.fromWireType(y[r])},destructorFunction:null})},Er=[],kr=[],br=r=>{r>9&&0===--kr[r+1]&&(kr[r]=void 0,Er.push(r))},_r=()=>kr.length/2-5-Er.length,Ar=()=>{kr.push(0,1,void 0,1,null,1,!0,1,!1,1),o.count_emval_handles=_r},Fr={toValue:r=>(r||hr("Cannot use deleted val. handle = "+r),kr[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=Er.pop()||kr.length;return kr[e]=r,kr[e+1]=1,e}}}};function Pr(r){return this.fromWireType(b[r>>2])}var Dr={name:"emscripten::val",fromWireType:r=>{var e=Fr.toValue(r);return br(r),e},toWireType:(r,e)=>Fr.toHandle(e),argPackAdvance:yr,readValueFromPointer:Pr,destructorFunction:null},Sr=r=>wr(r,Dr),Tr=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(_[r>>2])};case 8:return function(r){return this.fromWireType(A[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Cr=(r,e,t)=>{wr(r,{name:e=ur(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:yr,readValueFromPointer:Tr(e,t),destructorFunction:null})},Mr=(r,e)=>Object.defineProperty(e,"name",{value:r}),jr=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function xr(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function Rr(r,e){if(!(r instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof r} which is not a function`);var t=Mr(r.name||"unknownFunctionName",function(){});t.prototype=r.prototype;var n=new t,o=r.apply(n,e);return o instanceof Object?o:n}function $r(r,e,t,n){for(var o=xr(r),a=r.length-2,i=[],s=["fn"],l=0;l<a;++l)i.push(`arg${l}`),s.push(`arg${l}Wired`);i=i.join(","),s=s.join(",");var u=`return function (${i}) {\n`;o&&(u+="var destructors = [];\n");var d=o?"destructors":"null",c=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(l=0;l<a;++l)u+=`var arg${l}Wired = argType${l}['toWireType'](${d}, arg${l});\n`,c.push(`argType${l}`);if(u+=(t||n?"var rv = ":"")+`invoker(${s});\n`,o)u+="runDestructors(destructors);\n";else for(l=2;l<r.length;++l){var f=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==r[l].destructorFunction&&(u+=`${f}_dtor(${f});\n`,c.push(`${f}_dtor`))}return t&&(u+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[c,u+="}\n"]}function Nr(r,e,t,n,o,a){var i=e.length;i<2&&hr("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==e[1]&&null!==t,l=xr(e),u="void"!==e[0].name,d=[r,hr,n,o,jr,e[0],e[1]],c=0;c<i-2;++c)d.push(e[c+2]);if(!l)for(c=2;c<e.length;++c)null!==e[c].destructorFunction&&d.push(e[c].destructorFunction);let[f,h]=$r(e,s,u,a);f.push(h);var p=Rr(Function,f)(...d);return Mr(r,p)}var zr,Or,Wr=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||hr(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[n.length].apply(this,n)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},Br=(r,e,t)=>{o.hasOwnProperty(r)?((void 0===t||void 0!==o[r].overloadTable&&void 0!==o[r].overloadTable[t])&&hr(`Cannot register public name '${r}' twice`),Wr(o,r,r),o[r].overloadTable.hasOwnProperty(t)&&hr(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),o[r].overloadTable[t]=e):(o[r]=e,o[r].argCount=t)},Ur=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(b[e+4*n>>2]);return t},Lr=(r,e,t)=>{o.hasOwnProperty(r)||pr("Replacing nonexistent public symbol"),void 0!==o[r].overloadTable&&void 0!==t?o[r].overloadTable[t]=e:(o[r]=e,o[r].argCount=t)},Hr=(r,e,t)=>(r=r.replace(/p/g,"i"),(0,o["dynCall_"+r])(e,...t)),Ir=[],Vr=r=>{var e=Ir[r];return e||(r>=Ir.length&&(Ir.length=r+1),Ir[r]=e=zr.get(r)),e},qr=(r,e,t=[])=>r.includes("j")?Hr(r,e,t):Vr(e)(...t),Xr=(r,e)=>(...t)=>qr(r,e,t),Gr=(r,e)=>{function t(){return r.includes("j")?Xr(r,e):Vr(e)}r=ur(r);var n=t();return"function"!=typeof n&&hr(`unknown function pointer with signature ${r}: ${e}`),n},Kr=(r,e)=>{var t=Mr(e,function(r){this.name=e,this.message=r;var t=new Error(r).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},Jr=r=>{var e=At(r),t=ur(e);return Pt(e),t},Qr=(r,e)=>{var t=[],n={};function o(r){n[r]||cr[r]||(fr[r]?fr[r].forEach(o):(t.push(r),n[r]=!0))}throw e.forEach(o),new Or(`${r}: `+t.map(Jr).join([", "]))},Yr=r=>{const e=(r=r.trim()).indexOf("(");return-1!==e?r.substr(0,e):r},Zr=(r,e,t,n,o,a,i,s)=>{var l=Ur(e,t);r=ur(r),r=Yr(r),o=Gr(n,o),Br(r,function(){Qr(`Cannot call ${r} due to unbound types`,l)},e-1),mr([],l,t=>{var n=[t[0],null].concat(t.slice(1));return Lr(r,Nr(r,n,null,o,a,i),e-1),[]})},re=(r,e,t)=>{switch(e){case 1:return t?r=>w[r]:r=>y[r];case 2:return t?r=>g[r>>1]:r=>E[r>>1];case 4:return t?r=>k[r>>2]:r=>b[r>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},ee=(r,e,t,n,o)=>{e=ur(e);var a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i}var s=e.includes("unsigned"),l=(r,e)=>{};wr(r,{name:e,fromWireType:a,toWireType:s?function(r,e){return l(e,this.name),e>>>0}:function(r,e){return l(e,this.name),e},argPackAdvance:yr,readValueFromPointer:re(e,t,0!==n),destructorFunction:null})},te=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(r){var e=b[r>>2],t=b[r+4>>2];return new n(w.buffer,t,e)}wr(r,{name:t=ur(t),fromWireType:o,argPackAdvance:yr,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},ne=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&r.charCodeAt(++i)),s<=127){if(t>=a)break;e[t++]=s}else if(s<=2047){if(t+1>=a)break;e[t++]=192|s>>6,e[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;e[t++]=224|s>>12,e[t++]=128|s>>6&63,e[t++]=128|63&s}else{if(t+3>=a)break;e[t++]=240|s>>18,e[t++]=128|s>>12&63,e[t++]=128|s>>6&63,e[t++]=128|63&s}}return e[t]=0,t-o},oe=(r,e,t)=>ne(r,y,e,t),ae=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},ie="undefined"!=typeof TextDecoder?new TextDecoder:void 0,se=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&ie)return ie.decode(r.subarray(e,o));for(var a="";e<o;){var i=r[e++];if(128&i){var s=63&r[e++];if(192!=(224&i)){var l=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|l:(7&i)<<18|s<<12|l<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var u=i-65536;a+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},le=(r,e)=>r?se(y,r,e):"",ue=(r,e)=>{wr(r,{name:e=ur(e),fromWireType(r){for(var e,t=b[r>>2],n=r+4,o=n,a=0;a<=t;++a){var i=n+a;if(a==t||0==y[i]){var s=le(o,i-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=i+1}}return Pt(r),e},toWireType(r,e){var t;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||hr("Cannot pass non-string to std::string"),t=n?ae(e):e.length;var o=Ft(4+t+1),a=o+4;if(b[o>>2]=t,n)oe(e,a,t+1);else if(n)for(var i=0;i<t;++i){var s=e.charCodeAt(i);s>255&&(Pt(a),hr("String has UTF-16 code units that do not fit in 8 bits")),y[a+i]=s}else for(i=0;i<t;++i)y[a+i]=e[i];return null!==r&&r.push(Pt,o),o},argPackAdvance:yr,readValueFromPointer:Pr,destructorFunction(r){Pt(r)}})},de="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,ce=(r,e)=>{for(var t=r,n=t>>1,o=n+e/2;!(n>=o)&&E[n];)++n;if((t=n<<1)-r>32&&de)return de.decode(y.subarray(r,t));for(var a="",i=0;!(i>=e/2);++i){var s=g[r+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},fe=(r,e,t)=>{if(t??=2147483647,t<2)return 0;for(var n=e,o=(t-=2)<2*r.length?t/2:r.length,a=0;a<o;++a){var i=r.charCodeAt(a);g[e>>1]=i,e+=2}return g[e>>1]=0,e-n},he=r=>2*r.length,pe=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var o=k[r+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},me=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,o=n+t-4,a=0;a<r.length;++a){var i=r.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),k[e>>2]=i,(e+=4)+4>o)break}return k[e>>2]=0,e-n},ve=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},we=(r,e,t)=>{var n,o,a,i;t=ur(t),2===e?(n=ce,o=fe,i=he,a=r=>E[r>>1]):4===e&&(n=pe,o=me,i=ve,a=r=>b[r>>2]),wr(r,{name:t,fromWireType:r=>{for(var t,o=b[r>>2],i=r+4,s=0;s<=o;++s){var l=r+4+s*e;if(s==o||0==a(l)){var u=n(i,l-i);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),i=l+e}}return Pt(r),t},toWireType:(r,n)=>{"string"!=typeof n&&hr(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=Ft(4+a+e);return b[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(Pt,s),s},argPackAdvance:yr,readValueFromPointer:Pr,destructorFunction(r){Pt(r)}})},ye=(r,e)=>{wr(r,{isVoid:!0,name:e=ur(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},ge=(r,e,t)=>y.copyWithin(r,e,e+t),Ee=(r,e)=>{var t=cr[r];return void 0===t&&hr(`${e} has unknown type ${Jr(r)}`),t},ke=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(b[e>>2]=Fr.toHandle(n)),o},be=(r,e,t)=>(r=Fr.toValue(r),e=Ee(e,"emval::as"),ke(e,t,r)),_e=[],Ae=(r,e,t,n)=>(r=_e[r])(null,e=Fr.toValue(e),t,n),Fe={},Pe=r=>{var e=Fe[r];return void 0===e?ur(r):e},De=(r,e,t,n,o)=>(r=_e[r])(e=Fr.toValue(e),e[t=Pe(t)],n,o),Se=()=>"object"==typeof globalThis?globalThis:Function("return this")(),Te=r=>0===r?Fr.toHandle(Se()):(r=Pe(r),Fr.toHandle(Se()[r])),Ce=r=>{var e=_e.length;return _e.push(r),e},Me=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=Ee(b[e+4*n>>2],"parameter "+n);return t},je=(r,e,t)=>{var n=Me(r,e),o=n.shift();r--;var a="return function (obj, func, destructorsRef, args) {\n",i=0,s=[];0===t&&s.push("obj");for(var l=["retType"],u=[o],d=0;d<r;++d)s.push("arg"+d),l.push("argType"+d),u.push(n[d]),a+=` var arg${d} = argType${d}.readValueFromPointer(args${i?"+"+i:""});\n`,i+=n[d].argPackAdvance;a+=` var rv = ${1===t?"new func":"func.call"}(${s.join(", ")});\n`,o.isVoid||(l.push("emval_returnValue"),u.push(ke),a+=" return emval_returnValue(retType, destructorsRef, rv);\n"),a+="};\n",l.push(a);var c=Rr(Function,l)(...u),f=`methodCaller<(${n.map(r=>r.name).join(", ")}) => ${o.name}>`;return Ce(Mr(f,c))},xe=r=>(r=Pe(r),Fr.toHandle(o[r])),Re=(r,e)=>(r=Fr.toValue(r),e=Fr.toValue(e),Fr.toHandle(r[e])),$e=r=>{r>9&&(kr[r+1]+=1)},Ne=r=>Fr.toHandle(Pe(r)),ze=r=>{var e=Fr.toValue(r);jr(e),br(r)},Oe=(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),l=i.getTimezoneOffset(),u=Math.max(s,l);b[r>>2]=60*u,k[e>>2]=Number(s!=l);var d=r=>{var e=r>=0?"-":"+",t=Math.abs(r);return`UTC${e}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},c=d(s),f=d(l);l<s?(oe(c,t,17),oe(f,n,17)):(oe(c,n,17),oe(f,t,17))},We=()=>2147483648,Be=(r,e)=>Math.ceil(r/e)*e,Ue=r=>{var e=(r-v.buffer.byteLength+65535)/65536|0;try{return v.grow(e),D(),1}catch(t){}},Le=r=>{var e=y.length;r>>>=0;var t=We();if(r>t)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);o=Math.min(o,r+100663296);var a=Math.min(t,Be(Math.max(r,o),65536));if(Ue(a))return!0}return!1},He={},Ie=()=>c||"./this.program",Ve=()=>{if(!Ve.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:Ie()};for(var e in He)void 0===He[e]?delete r[e]:r[e]=He[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);Ve.strings=t}return Ve.strings},qe=(r,e)=>{for(var t=0;t<r.length;++t)w[e++]=r.charCodeAt(t);w[e]=0},Xe=(r,e)=>{var t=0;return Ve().forEach((n,o)=>{var a=e+t;b[r+4*o>>2]=a,qe(n,a),t+=n.length+1}),0},Ge=(r,e)=>{var t=Ve();b[r>>2]=t.length;var n=0;return t.forEach(r=>n+=r.length+1),b[e>>2]=n,0},Ke={isAbs:r=>"/"===r.charAt(0),splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=Ke.isAbs(r),t="/"===r.substr(-1);return(r=Ke.normalizeArray(r.split("/").filter(r=>!!r),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=Ke.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:r=>{if("/"===r)return"/";var e=(r=(r=Ke.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?r:r.substr(e+1)},join:(...r)=>Ke.normalize(r.join("/")),join2:(r,e)=>Ke.normalize(r+"/"+e)},Je=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return r=>crypto.getRandomValues(r);U("initRandomDevice")},Qe=r=>(Qe=Je())(r),Ye={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:ft.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=Ke.isAbs(o)}return(t?"/":"")+(e=Ke.normalizeArray(e.split("/").filter(r=>!!r),!t).join("/"))||"."},relative:(r,e)=>{function t(r){for(var e=0;e<r.length&&""===r[e];e++);for(var t=r.length-1;t>=0&&""===r[t];t--);return e>t?[]:r.slice(e,t-e+1)}r=Ye.resolve(r).substr(1),e=Ye.resolve(e).substr(1);for(var n=t(r.split("/")),o=t(e.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var l=[];for(s=i;s<n.length;s++)l.push("..");return(l=l.concat(o.slice(i))).join("/")}},Ze=[];function rt(r,e,t){var n=ae(r)+1,o=new Array(n),a=ne(r,o,0,o.length);return o.length=a,o}var et=()=>{if(!Ze.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;Ze=rt(r)}return Ze.shift()},tt={ttys:[],init(){},shutdown(){},register(r,e){tt.ttys[r]={input:[],output:[],ops:e},ft.registerDevice(r,tt.stream_ops)},stream_ops:{open(r){var e=tt.ttys[r.node.rdev];if(!e)throw new ft.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new ft.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(l){throw new ft.ErrnoError(29)}if(void 0===s&&0===a)throw new ft.ErrnoError(6);if(null==s)break;a++,e[t+i]=s}return a&&(r.node.atime=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new ft.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(i){throw new ft.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char:r=>et(),put_char(r,e){null===e||10===e?(p(se(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(p(se(r.output)),r.output=[])},ioctl_tcgets:r=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(r,e,t)=>0,ioctl_tiocgwinsz:r=>[24,80]},default_tty1_ops:{put_char(r,e){null===e||10===e?(m(se(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(m(se(r.output)),r.output=[])}}},nt=r=>{U()},ot={ops_table:null,mount:r=>ot.createNode(null,"/",16895,0),createNode(r,e,t,n){if(ft.isBlkdev(t)||ft.isFIFO(t))throw new ft.ErrnoError(63);ot.ops_table||={dir:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr,lookup:ot.node_ops.lookup,mknod:ot.node_ops.mknod,rename:ot.node_ops.rename,unlink:ot.node_ops.unlink,rmdir:ot.node_ops.rmdir,readdir:ot.node_ops.readdir,symlink:ot.node_ops.symlink},stream:{llseek:ot.stream_ops.llseek}},file:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr},stream:{llseek:ot.stream_ops.llseek,read:ot.stream_ops.read,write:ot.stream_ops.write,allocate:ot.stream_ops.allocate,mmap:ot.stream_ops.mmap,msync:ot.stream_ops.msync}},link:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr,readlink:ot.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr},stream:ft.chrdev_stream_ops}};var o=ft.createNode(r,e,t,n);return ft.isDir(o.mode)?(o.node_ops=ot.ops_table.dir.node,o.stream_ops=ot.ops_table.dir.stream,o.contents={}):ft.isFile(o.mode)?(o.node_ops=ot.ops_table.file.node,o.stream_ops=ot.ops_table.file.stream,o.usedBytes=0,o.contents=null):ft.isLink(o.mode)?(o.node_ops=ot.ops_table.link.node,o.stream_ops=ot.ops_table.link.stream):ft.isChrdev(o.mode)&&(o.node_ops=ot.ops_table.chrdev.node,o.stream_ops=ot.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),r&&(r.contents[e]=o,r.atime=r.mtime=r.ctime=o.atime),o},getFileDataAsTypedArray:r=>r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0),expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1048576;e=Math.max(e,t*(t<n?2:1.125)>>>0),0!=t&&(e=Math.max(e,256));var o=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(o.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(0==e)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=ft.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,ft.isDir(r.mode)?e.size=4096:ft.isFile(r.mode)?e.size=r.usedBytes:ft.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.atime),e.mtime=new Date(r.mtime),e.ctime=new Date(r.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){for(const t of["mode","atime","mtime","ctime"])e[t]&&(r[t]=e[t]);void 0!==e.size&&ot.resizeFileStorage(r,e.size)},lookup(r,e){throw ot.doesNotExistError},mknod:(r,e,t,n)=>ot.createNode(r,e,t,n),rename(r,e,t){var n;try{n=ft.lookupNode(e,t)}catch(a){}if(n){if(ft.isDir(r.mode))for(var o in n.contents)throw new ft.ErrnoError(55);ft.hashRemoveNode(n)}delete r.parent.contents[r.name],e.contents[t]=r,r.name=t,e.ctime=e.mtime=r.parent.ctime=r.parent.mtime=Date.now()},unlink(r,e){delete r.contents[e],r.ctime=r.mtime=Date.now()},rmdir(r,e){var t=ft.lookupNode(r,e);for(var n in t.contents)throw new ft.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir:r=>[".","..",...Object.keys(r.contents)],symlink(r,e,t){var n=ot.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!ft.isLink(r.mode))throw new ft.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var i=Math.min(r.node.usedBytes-o,n);if(i>8&&a.subarray)e.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)e[t+s]=a[o+s];return i},write(r,e,t,n,o,a){if(e.buffer===w.buffer&&(a=!1),!n)return 0;var i=r.node;if(i.mtime=i.ctime=Date.now(),e.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=e.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=e.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(e.subarray(t,t+n),o),n}if(ot.expandFileStorage(i,o+n),i.contents.subarray&&e.subarray)i.contents.set(e.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=e[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(1===t?n+=r.position:2===t&&ft.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new ft.ErrnoError(28);return n},allocate(r,e,t){ot.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!ft.isFile(r.node.mode))throw new ft.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==w.buffer){if(i=!0,!(a=nt()))throw new ft.ErrnoError(48);s&&((t>0||t+e<s.length)&&(s=s.subarray?s.subarray(t,t+e):Array.prototype.slice.call(s,t,t+e)),w.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(ot.stream_ops.write(r,e,0,n,t,!1),0)}},at=async r=>{var e=await l(r);return new Uint8Array(e)},it=(r,e,t,n,o,a)=>{ft.createDataFile(r,e,t,n,o,a)},st=o.preloadPlugins||[],lt=(r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return st.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},ut=(r,e,t,n,o,a,i,s,l,u)=>{var d=e?Ye.resolve(Ke.join2(r,e)):r;function c(t){function c(t){u?.(),s||it(r,e,t,n,o,l),a?.(),B()}lt(t,d,c,()=>{i?.(),B()})||c(t)}W(),"string"==typeof t?at(t).then(c,i):c(t)},dt=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(void 0===e)throw new Error(`Unknown file open mode: ${r}`);return e},ct=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},ft={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(r){this.node=r}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.id=ft.nextInode++,this.name=e,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return ft.isDir(this.mode)}get isDevice(){return ft.isChrdev(this.mode)}},lookupPath(r,e={}){if(!r)return{path:"",node:null};e.follow_mount??=!0,Ke.isAbs(r)||(r=ft.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter(r=>!!r&&"."!==r),o=ft.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if(".."!==n[i]){a=Ke.join2(a,n[i]);try{o=ft.lookupNode(o,n[i])}catch(u){if(44===u?.errno&&s&&e.noent_okay)return{path:a};throw u}if(!ft.isMountpoint(o)||s&&!e.follow_mount||(o=o.mounted.root),ft.isLink(o.mode)&&(!s||e.follow)){if(!o.node_ops.readlink)throw new ft.ErrnoError(52);var l=o.node_ops.readlink(o);Ke.isAbs(l)||(l=Ke.dirname(a)+"/"+l),r=l+"/"+n.slice(i+1).join("/");continue r}}else a=Ke.dirname(a),o=o.parent}return{path:a,node:o}}throw new ft.ErrnoError(32)},getPath(r){for(var e;;){if(ft.isRoot(r)){var t=r.mount.mountpoint;return e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%ft.nameTable.length},hashAddNode(r){var e=ft.hashName(r.parent.id,r.name);r.name_next=ft.nameTable[e],ft.nameTable[e]=r},hashRemoveNode(r){var e=ft.hashName(r.parent.id,r.name);if(ft.nameTable[e]===r)ft.nameTable[e]=r.name_next;else for(var t=ft.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=ft.mayLookup(r);if(t)throw new ft.ErrnoError(t);for(var n=ft.hashName(r.id,e),o=ft.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return ft.lookup(r,e)},createNode(r,e,t,n){var o=new ft.FSNode(r,e,t,n);return ft.hashAddNode(o),o},destroyNode(r){ft.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>32768==(61440&r),isDir:r=>16384==(61440&r),isLink:r=>40960==(61440&r),isChrdev:r=>8192==(61440&r),isBlkdev:r=>24576==(61440&r),isFIFO:r=>4096==(61440&r),isSocket:r=>!(49152&~r),flagsToPermissionString(r){var e=["r","w","rw"][3&r];return 512&r&&(e+="w"),e},nodePermissions:(r,e)=>ft.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!ft.isDir(r.mode))return 54;var e=ft.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){if(!ft.isDir(r.mode))return 54;try{return ft.lookupNode(r,e),20}catch(t){}return ft.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=ft.lookupNode(r,e)}catch(a){return a.errno}var o=ft.nodePermissions(r,"wx");if(o)return o;if(t){if(!ft.isDir(n.mode))return 54;if(ft.isRoot(n)||ft.getPath(n)===ft.cwd())return 10}else if(ft.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?ft.isLink(r.mode)?32:ft.isDir(r.mode)&&("r"!==ft.flagsToPermissionString(e)||512&e)?31:ft.nodePermissions(r,ft.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=ft.MAX_OPEN_FDS;r++)if(!ft.streams[r])return r;throw new ft.ErrnoError(33)},getStreamChecked(r){var e=ft.getStream(r);if(!e)throw new ft.ErrnoError(8);return e},getStream:r=>ft.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new ft.FSStream,r),-1==e&&(e=ft.nextfd()),r.fd=e,ft.streams[e]=r,r),closeStream(r){ft.streams[r]=null},dupStream(r,e=-1){var t=ft.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=ft.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new ft.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){ft.devices[r]={stream_ops:e}},getDevice:r=>ft.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){"function"==typeof r&&(e=r,r=!1),ft.syncFSRequests++,ft.syncFSRequests>1&&m(`warning: ${ft.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=ft.getMounts(ft.root.mount),n=0;function o(r){return ft.syncFSRequests--,e(r)}function a(r){if(r)return a.errored?void 0:(a.errored=!0,o(r));++n>=t.length&&o(null)}t.forEach(e=>{if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)})},mount(r,e,t){var n,o="/"===t,a=!t;if(o&&ft.root)throw new ft.ErrnoError(10);if(!o&&!a){var i=ft.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,ft.isMountpoint(n))throw new ft.ErrnoError(10);if(!ft.isDir(n.mode))throw new ft.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},l=r.mount(s);return l.mount=s,s.root=l,o?ft.root=l:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),l},unmount(r){var e=ft.lookupPath(r,{follow_mount:!1});if(!ft.isMountpoint(e.node))throw new ft.ErrnoError(28);var t=e.node,n=t.mounted,o=ft.getMounts(n);Object.keys(ft.nameTable).forEach(r=>{for(var e=ft.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&ft.destroyNode(e),e=t}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(r,e)=>r.node_ops.lookup(r,e),mknod(r,e,t){var n=ft.lookupPath(r,{parent:!0}).node,o=Ke.basename(r);if(!o||"."===o||".."===o)throw new ft.ErrnoError(28);var a=ft.mayCreate(n,o);if(a)throw new ft.ErrnoError(a);if(!n.node_ops.mknod)throw new ft.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:ft.nextInode,ffree:ft.nextInode-1,fsid:42,flags:2,namelen:255},t=ft.lookupPath(r,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(e,t.node_ops.statfs(t.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,ft.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,ft.mknod(r,e,0)),mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{ft.mkdir(n,e)}catch(a){if(20!=a.errno)throw a}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,ft.mknod(r,e,t)),symlink(r,e){if(!Ye.resolve(r))throw new ft.ErrnoError(44);var t=ft.lookupPath(e,{parent:!0}).node;if(!t)throw new ft.ErrnoError(44);var n=Ke.basename(e),o=ft.mayCreate(t,n);if(o)throw new ft.ErrnoError(o);if(!t.node_ops.symlink)throw new ft.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=Ke.dirname(r),a=Ke.dirname(e),i=Ke.basename(r),s=Ke.basename(e);if(t=ft.lookupPath(r,{parent:!0}).node,n=ft.lookupPath(e,{parent:!0}).node,!t||!n)throw new ft.ErrnoError(44);if(t.mount!==n.mount)throw new ft.ErrnoError(75);var l,u=ft.lookupNode(t,i),d=Ye.relative(r,a);if("."!==d.charAt(0))throw new ft.ErrnoError(28);if("."!==(d=Ye.relative(e,o)).charAt(0))throw new ft.ErrnoError(55);try{l=ft.lookupNode(n,s)}catch(h){}if(u!==l){var c=ft.isDir(u.mode),f=ft.mayDelete(t,i,c);if(f)throw new ft.ErrnoError(f);if(f=l?ft.mayDelete(n,s,c):ft.mayCreate(n,s))throw new ft.ErrnoError(f);if(!t.node_ops.rename)throw new ft.ErrnoError(63);if(ft.isMountpoint(u)||l&&ft.isMountpoint(l))throw new ft.ErrnoError(10);if(n!==t&&(f=ft.nodePermissions(t,"w")))throw new ft.ErrnoError(f);ft.hashRemoveNode(u);try{t.node_ops.rename(u,n,s),u.parent=n}catch(h){throw h}finally{ft.hashAddNode(u)}}},rmdir(r){var e=ft.lookupPath(r,{parent:!0}).node,t=Ke.basename(r),n=ft.lookupNode(e,t),o=ft.mayDelete(e,t,!0);if(o)throw new ft.ErrnoError(o);if(!e.node_ops.rmdir)throw new ft.ErrnoError(63);if(ft.isMountpoint(n))throw new ft.ErrnoError(10);e.node_ops.rmdir(e,t),ft.destroyNode(n)},readdir(r){var e=ft.lookupPath(r,{follow:!0}).node;if(!e.node_ops.readdir)throw new ft.ErrnoError(54);return e.node_ops.readdir(e)},unlink(r){var e=ft.lookupPath(r,{parent:!0}).node;if(!e)throw new ft.ErrnoError(44);var t=Ke.basename(r),n=ft.lookupNode(e,t),o=ft.mayDelete(e,t,!1);if(o)throw new ft.ErrnoError(o);if(!e.node_ops.unlink)throw new ft.ErrnoError(63);if(ft.isMountpoint(n))throw new ft.ErrnoError(10);e.node_ops.unlink(e,t),ft.destroyNode(n)},readlink(r){var e=ft.lookupPath(r).node;if(!e)throw new ft.ErrnoError(44);if(!e.node_ops.readlink)throw new ft.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=ft.lookupPath(r,{follow:!e}).node;if(!t)throw new ft.ErrnoError(44);if(!t.node_ops.getattr)throw new ft.ErrnoError(63);return t.node_ops.getattr(t)},lstat:r=>ft.stat(r,!0),chmod(r,e,t){var n;if(!(n="string"==typeof r?ft.lookupPath(r,{follow:!t}).node:r).node_ops.setattr)throw new ft.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,ctime:Date.now()})},lchmod(r,e){ft.chmod(r,e,!0)},fchmod(r,e){var t=ft.getStreamChecked(r);ft.chmod(t.node,e)},chown(r,e,t,n){var o;if(!(o="string"==typeof r?ft.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new ft.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){ft.chown(r,e,t,!0)},fchown(r,e,t){var n=ft.getStreamChecked(r);ft.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new ft.ErrnoError(28);var t;if(!(t="string"==typeof r?ft.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new ft.ErrnoError(63);if(ft.isDir(t.mode))throw new ft.ErrnoError(31);if(!ft.isFile(t.mode))throw new ft.ErrnoError(28);var n=ft.nodePermissions(t,"w");if(n)throw new ft.ErrnoError(n);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=ft.getStreamChecked(r);if(!(2097155&t.flags))throw new ft.ErrnoError(28);ft.truncate(t.node,e)},utime(r,e,t){var n=ft.lookupPath(r,{follow:!0}).node;n.node_ops.setattr(n,{atime:e,mtime:t})},open(r,e,t=438){if(""===r)throw new ft.ErrnoError(44);var n;if(t=64&(e="string"==typeof e?dt(e):e)?4095&t|32768:0,"object"==typeof r)n=r;else{var a=ft.lookupPath(r,{follow:!(131072&e),noent_okay:!0});n=a.node,r=a.path}var i=!1;if(64&e)if(n){if(128&e)throw new ft.ErrnoError(20)}else n=ft.mknod(r,t,0),i=!0;if(!n)throw new ft.ErrnoError(44);if(ft.isChrdev(n.mode)&&(e&=-513),65536&e&&!ft.isDir(n.mode))throw new ft.ErrnoError(54);if(!i){var s=ft.mayOpen(n,e);if(s)throw new ft.ErrnoError(s)}512&e&&!i&&ft.truncate(n,0),e&=-131713;var l=ft.createStream({node:n,path:ft.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),!o.logReadFiles||1&e||r in ft.readFiles||(ft.readFiles[r]=1),l},close(r){if(ft.isClosed(r))throw new ft.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{ft.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(ft.isClosed(r))throw new ft.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new ft.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new ft.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new ft.ErrnoError(28);if(ft.isClosed(r))throw new ft.ErrnoError(8);if(1==(2097155&r.flags))throw new ft.ErrnoError(8);if(ft.isDir(r.node.mode))throw new ft.ErrnoError(31);if(!r.stream_ops.read)throw new ft.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new ft.ErrnoError(70)}else o=r.position;var i=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=i),i},write(r,e,t,n,o,a){if(n<0||o<0)throw new ft.ErrnoError(28);if(ft.isClosed(r))throw new ft.ErrnoError(8);if(!(2097155&r.flags))throw new ft.ErrnoError(8);if(ft.isDir(r.node.mode))throw new ft.ErrnoError(31);if(!r.stream_ops.write)throw new ft.ErrnoError(28);r.seekable&&1024&r.flags&&ft.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new ft.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},allocate(r,e,t){if(ft.isClosed(r))throw new ft.ErrnoError(8);if(e<0||t<=0)throw new ft.ErrnoError(28);if(!(2097155&r.flags))throw new ft.ErrnoError(8);if(!ft.isFile(r.node.mode)&&!ft.isDir(r.node.mode))throw new ft.ErrnoError(43);if(!r.stream_ops.allocate)throw new ft.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new ft.ErrnoError(2);if(1==(2097155&r.flags))throw new ft.ErrnoError(2);if(!r.stream_ops.mmap)throw new ft.ErrnoError(43);if(!e)throw new ft.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,o)},msync:(r,e,t,n,o)=>r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0,ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new ft.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=ft.open(r,e.flags),o=ft.stat(r).size,a=new Uint8Array(o);return ft.read(n,a,0,o,0),"utf8"===e.encoding?t=se(a):"binary"===e.encoding&&(t=a),ft.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=ft.open(r,t.flags,t.mode);if("string"==typeof e){var o=new Uint8Array(ae(e)+1),a=ne(e,o,0,o.length);ft.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");ft.write(n,e,0,e.byteLength,void 0,t.canOwn)}ft.close(n)},cwd:()=>ft.currentPath,chdir(r){var e=ft.lookupPath(r,{follow:!0});if(null===e.node)throw new ft.ErrnoError(44);if(!ft.isDir(e.node.mode))throw new ft.ErrnoError(54);var t=ft.nodePermissions(e.node,"x");if(t)throw new ft.ErrnoError(t);ft.currentPath=e.path},createDefaultDirectories(){ft.mkdir("/tmp"),ft.mkdir("/home"),ft.mkdir("/home/web_user")},createDefaultDevices(){ft.mkdir("/dev"),ft.registerDevice(ft.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),ft.mkdev("/dev/null",ft.makedev(1,3)),tt.register(ft.makedev(5,0),tt.default_tty_ops),tt.register(ft.makedev(6,0),tt.default_tty1_ops),ft.mkdev("/dev/tty",ft.makedev(5,0)),ft.mkdev("/dev/tty1",ft.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(e=Qe(r).byteLength),r[--e]);ft.createDevice("/dev","random",t),ft.createDevice("/dev","urandom",t),ft.mkdir("/dev/shm"),ft.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ft.mkdir("/proc");var r=ft.mkdir("/proc/self");ft.mkdir("/proc/self/fd"),ft.mount({mount(){var e=ft.createNode(r,"fd",16895,73);return e.stream_ops={llseek:ot.stream_ops.llseek},e.node_ops={lookup(r,e){var t=+e,n=ft.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(ft.streams.entries()).filter(([r,e])=>e).map(([r,e])=>r.toString())},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?ft.createDevice("/dev","stdin",r):ft.symlink("/dev/tty","/dev/stdin"),e?ft.createDevice("/dev","stdout",null,e):ft.symlink("/dev/tty","/dev/stdout"),t?ft.createDevice("/dev","stderr",null,t):ft.symlink("/dev/tty1","/dev/stderr"),ft.open("/dev/stdin",0),ft.open("/dev/stdout",1),ft.open("/dev/stderr",1)},staticInit(){ft.nameTable=new Array(4096),ft.mount(ot,{},"/"),ft.createDefaultDirectories(),ft.createDefaultDevices(),ft.createSpecialDirectories(),ft.filesystems={MEMFS:ot}},init(r,e,t){ft.initialized=!0,r??=o.stdin,e??=o.stdout,t??=o.stderr,ft.createStandardStreams(r,e,t)},quit(){ft.initialized=!1;for(var r=0;r<ft.streams.length;r++){var e=ft.streams[r];e&&ft.close(e)}},findObject(r,e){var t=ft.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=ft.lookupPath(r,{follow:!e})).path}catch(o){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=ft.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=Ke.basename(r),n=ft.lookupPath(r,{follow:!e}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(o){t.error=o.errno}return t},createPath(r,e,t,n){r="string"==typeof r?r:ft.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=Ke.join2(r,a);try{ft.mkdir(i)}catch(s){}r=i}}return i},createFile(r,e,t,n,o){var a=Ke.join2("string"==typeof r?r:ft.getPath(r),e),i=ct(n,o);return ft.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:ft.getPath(r),i=e?Ke.join2(r,e):r);var s=ct(n,o),l=ft.create(i,s);if(t){if("string"==typeof t){for(var u=new Array(t.length),d=0,c=t.length;d<c;++d)u[d]=t.charCodeAt(d);t=u}ft.chmod(l,146|s);var f=ft.open(l,577);ft.write(f,t,0,t.length,0,a),ft.close(f),ft.chmod(l,s)}},createDevice(r,e,t,n){var o=Ke.join2("string"==typeof r?r:ft.getPath(r),e),a=ct(!!t,!!n);ft.createDevice.major??=64;var i=ft.makedev(ft.createDevice.major++,0);return ft.registerDevice(i,{open(r){r.seekable=!1},close(r){n?.buffer?.length&&n(10)},read(r,e,n,o,a){for(var i=0,s=0;s<o;s++){var l;try{l=t()}catch(u){throw new ft.ErrnoError(29)}if(void 0===l&&0===i)throw new ft.ErrnoError(6);if(null==l)break;i++,e[n+s]=l}return i&&(r.node.atime=Date.now()),i},write(r,e,t,o,a){for(var i=0;i<o;i++)try{n(e[t+i])}catch(s){throw new ft.ErrnoError(29)}return o&&(r.node.mtime=r.node.ctime=Date.now()),i}}),ft.mkdev(o,a,i)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if("undefined"!=typeof XMLHttpRequest)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.");try{r.contents=u(r.url),r.usedBytes=r.contents.length}catch(e){throw new ft.ErrnoError(29)}},createLazyFile(r,e,t,n,o){class a{lengthKnown=!1;chunks=[];get(r){if(!(r>this.length-1||r<0)){var e=r%this.chunkSize,t=r/this.chunkSize|0;return this.getter(t)[e]}}setDataGetter(r){this.getter=r}cacheLength(){var r=new XMLHttpRequest;if(r.open("HEAD",t,!1),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw new Error("Couldn't load "+t+". Status: "+r.status);var e,n=Number(r.getResponseHeader("Content-length")),o=(e=r.getResponseHeader("Accept-Ranges"))&&"bytes"===e,a=(e=r.getResponseHeader("Content-Encoding"))&&"gzip"===e,i=1048576;o||(i=n);var s=(r,e)=>{if(r>e)throw new Error("invalid range ("+r+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+r+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):rt(o.responseText||"")},l=this;l.setDataGetter(r=>{var e=r*i,t=(r+1)*i-1;if(t=Math.min(t,n-1),void 0===l.chunks[r]&&(l.chunks[r]=s(e,t)),void 0===l.chunks[r])throw new Error("doXHR failed!");return l.chunks[r]}),!a&&n||(i=n=1,n=this.getter(0).length,i=n,p("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new a}}else i={isDevice:!1,url:t};var l=ft.createFile(r,e,i,n,o);i.contents?l.contents=i.contents:i.url&&(l.contents=null,l.url=i.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var u={};function d(r,e,t,n,o){var a=r.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)e[t+s]=a[o+s];else for(s=0;s<i;s++)e[t+s]=a.get(o+s);return i}return Object.keys(l.stream_ops).forEach(r=>{var e=l.stream_ops[r];u[r]=(...r)=>(ft.forceLoadFile(l),e(...r))}),u.read=(r,e,t,n,o)=>(ft.forceLoadFile(l),d(r,e,t,n,o)),u.mmap=(r,e,t,n,o)=>{ft.forceLoadFile(l);var a=nt();if(!a)throw new ft.ErrnoError(48);return d(r,w,a,e,t),{ptr:a,allocated:!0}},l.stream_ops=u,l}},ht={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(Ke.isAbs(e))return e;var n;if(n=-100===r?ft.cwd():ht.getStreamFromFD(r).path,0==e.length){if(!t)throw new ft.ErrnoError(44);return n}return n+"/"+e},doStat(r,e,t){var n=r(e);k[t>>2]=n.dev,k[t+4>>2]=n.mode,b[t+8>>2]=n.nlink,k[t+12>>2]=n.uid,k[t+16>>2]=n.gid,k[t+20>>2]=n.rdev,I=[n.size>>>0,(H=n.size,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[t+24>>2]=I[0],k[t+28>>2]=I[1],k[t+32>>2]=4096,k[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(H=Math.floor(o/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[t+40>>2]=I[0],k[t+44>>2]=I[1],b[t+48>>2]=o%1e3*1e3*1e3,I=[Math.floor(a/1e3)>>>0,(H=Math.floor(a/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[t+56>>2]=I[0],k[t+60>>2]=I[1],b[t+64>>2]=a%1e3*1e3*1e3,I=[Math.floor(i/1e3)>>>0,(H=Math.floor(i/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[t+72>>2]=I[0],k[t+76>>2]=I[1],b[t+80>>2]=i%1e3*1e3*1e3,I=[n.ino>>>0,(H=n.ino,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[t+88>>2]=I[0],k[t+92>>2]=I[1],0},doMsync(r,e,t,n,o){if(!ft.isFile(e.node.mode))throw new ft.ErrnoError(43);if(2&n)return 0;var a=y.slice(r,r+t);ft.msync(e,a,o,t,n)},getStreamFromFD:r=>ft.getStreamChecked(r),varargs:void 0,getStr:r=>le(r)};function pt(r){try{var e=ht.getStreamFromFD(r);return ft.close(e),0}catch(t){if(void 0===ft||"ErrnoError"!==t.name)throw t;return t.errno}}var mt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=b[e>>2],s=b[e+4>>2];e+=8;var l=ft.read(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function vt(r,e,t,n){try{var o=ht.getStreamFromFD(r),a=mt(o,e,t);return b[n>>2]=a,0}catch(i){if(void 0===ft||"ErrnoError"!==i.name)throw i;return i.errno}}var wt=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*e:NaN;function yt(r,e,t,n,o){var a=wt(e,t);try{if(isNaN(a))return 61;var i=ht.getStreamFromFD(r);return ft.llseek(i,a,n),I=[i.position>>>0,(H=i.position,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[o>>2]=I[0],k[o+4>>2]=I[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(s){if(void 0===ft||"ErrnoError"!==s.name)throw s;return s.errno}}var gt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=b[e>>2],s=b[e+4>>2];e+=8;var l=ft.write(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function Et(r,e,t,n){try{var o=ht.getStreamFromFD(r),a=gt(o,e,t);return b[n>>2]=a,0}catch(i){if(void 0===ft||"ErrnoError"!==i.name)throw i;return i.errno}}lr(),nr=o.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},or=o.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Ar(),Or=o.UnboundTypeError=Kr(Error,"UnboundTypeError"),ft.createPreloadedFile=ut,ft.staticInit(),ot.doesNotExistError=new ft.ErrnoError(44),ot.doesNotExistError.stack="<generic error, no stack>";var kt,bt={q:ar,w:ir,s:sr,D:gr,B:Sr,p:Cr,i:Zr,c:ee,a:te,C:ue,j:we,E:ye,A:ge,n:be,l:Ae,k:De,b:br,F:Te,g:je,m:xe,e:Re,h:$e,f:Ne,d:ze,t:Oe,z:Le,u:Xe,v:Ge,x:pt,y:vt,r:yt,o:Et};Z();var _t,At=r=>(At=kt.I)(r),Ft=r=>(Ft=kt.K)(r),Pt=r=>(Pt=kt.L)(r);function Dt(){function r(){_t||(_t=!0,o.calledRun=!0,P||(j(),t(o),o.onRuntimeInitialized?.(),x()))}z>0||(M(),z>0||(o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),r()},1)):r()))}if(o.dynCall_jiji=(r,e,t,n,a)=>(o.dynCall_jiji=kt.M)(r,e,t,n,a),o.dynCall_viijii=(r,e,t,n,a,i,s)=>(o.dynCall_viijii=kt.N)(r,e,t,n,a,i,s),o.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(o.dynCall_iiiiij=kt.O)(r,e,t,n,a,i,s),o.dynCall_iiiiijj=(r,e,t,n,a,i,s,l,u)=>(o.dynCall_iiiiijj=kt.P)(r,e,t,n,a,i,s,l,u),o.dynCall_iiiiiijj=(r,e,t,n,a,i,s,l,u,d)=>(o.dynCall_iiiiiijj=kt.Q)(r,e,t,n,a,i,s,l,u,d),O=function r(){_t||Dt(),_t||(O=r)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Dt(),a});export{e as default};
|
|
2
|
+
var r,e=(r="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,n,o=e,a=new Promise((r,e)=>{t=r,n=e}),i="object"==typeof window,s="undefined"!=typeof WorkerGlobalScope;"object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&process.type;var l,d,u=Object.assign({},o),c="./this.program",f="";function h(r){return o.locateFile?o.locateFile(r,f):f+r}(i||s)&&(s?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),r&&(f=r),f=f.startsWith("blob:")?"":f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(d=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=async r=>{var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)});var m=o.print||console.log.bind(console),p=o.printErr||console.error.bind(console);Object.assign(o,u),u=null,o.arguments&&o.arguments,o.thisProgram&&(c=o.thisProgram);var v,w,g,y,E,b,k,_,A,P=o.wasmBinary,$=!1;function D(){var r=v.buffer;o.HEAP8=w=new Int8Array(r),o.HEAP16=y=new Int16Array(r),o.HEAPU8=g=new Uint8Array(r),o.HEAPU16=E=new Uint16Array(r),o.HEAP32=b=new Int32Array(r),o.HEAPU32=k=new Uint32Array(r),o.HEAPF32=_=new Float32Array(r),o.HEAPF64=A=new Float64Array(r)}var F=[],S=[],C=[];function T(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)x(o.preRun.shift());rr(F)}function M(){o.noFSInit||ct.initialized||ct.init(),ct.ignorePermissions=!1,rr(S)}function j(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)N(o.postRun.shift());rr(C)}function x(r){F.unshift(r)}function R(r){S.unshift(r)}function N(r){C.unshift(r)}var z=0,O=null;function B(r){z++,o.monitorRunDependencies?.(z)}function U(r){if(z--,o.monitorRunDependencies?.(z),0==z&&O){var e=O;O=null,e()}}function W(r){o.onAbort?.(r),p(r="Aborted("+r+")"),$=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw n(e),e}var L,H,I,V="data:application/octet-stream;base64,",q=r=>r.startsWith(V);function X(){var r="dxt_encoder.wasm";return q(r)?r:h(r)}function G(r){if(r==L&&P)return new Uint8Array(P);if(d)return d(r);throw"both async and sync fetching of the wasm failed"}async function K(r){if(!P)try{var e=await l(r);return new Uint8Array(e)}catch{}return G(r)}async function J(r,e){try{var t=await K(r);return await WebAssembly.instantiate(t,e)}catch(n){p(`failed to asynchronously prepare wasm: ${n}`),W(n)}}async function Q(r,e,t){if(!r&&"function"==typeof WebAssembly.instantiateStreaming&&!q(e)&&"function"==typeof fetch)try{var n=fetch(e,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(o){p(`wasm streaming compile failed: ${o}`),p("falling back to ArrayBuffer instantiation")}return J(e,t)}function Y(){return{a:bt}}async function Z(){function r(r,e){return Et=r.exports,v=Et.G,D(),Rr=Et.J,R(Et.H),U(),Et}function e(e){r(e.instance)}B();var t=Y();if(o.instantiateWasm)try{return o.instantiateWasm(t,r)}catch(i){p(`Module.instantiateWasm callback failed with error: ${i}`),n(i)}L??=X();try{var a=await Q(P,L,t);return e(a),a}catch(i){return void n(i)}}var rr=r=>{for(;r.length>0;)r.shift()(o)};o.noExitRuntime;class er{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){k[this.ptr+4>>2]=r}get_type(){return k[this.ptr+4>>2]}set_destructor(r){k[this.ptr+8>>2]=r}get_destructor(){return k[this.ptr+8>>2]}set_caught(r){r=r?1:0,w[this.ptr+12]=r}get_caught(){return 0!=w[this.ptr+12]}set_rethrown(r){r=r?1:0,w[this.ptr+13]=r}get_rethrown(){return 0!=w[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){k[this.ptr+16>>2]=r}get_adjusted_ptr(){return k[this.ptr+16>>2]}}var tr,nr,or,ar=(r,e,t)=>{throw new er(r).init(e,t),r},ir=()=>W(""),sr=(r,e,t,n,o)=>{},lr=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);tr=r},dr=r=>{for(var e="",t=r;g[t];)e+=tr[g[t++]];return e},ur={},cr={},fr={},hr=r=>{throw new nr(r)},mr=r=>{throw new or(r)},pr=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&mr("Mismatched type converter count");for(var o=0;o<r.length;++o)wr(r[o],n[o])}r.forEach(r=>fr[r]=e);var o=new Array(e.length),a=[],i=0;e.forEach((r,e)=>{cr.hasOwnProperty(r)?o[e]=cr[r]:(a.push(r),ur.hasOwnProperty(r)||(ur[r]=[]),ur[r].push(()=>{o[e]=cr[r],++i===a.length&&n(o)}))}),0===a.length&&n(o)};function vr(r,e,t={}){var n=e.name;if(r||hr(`type "${n}" must have a positive integer typeid pointer`),cr.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;hr(`Cannot register type '${n}' twice`)}if(cr[r]=e,delete fr[r],ur.hasOwnProperty(r)){var o=ur[r];delete ur[r],o.forEach(r=>r())}}function wr(r,e,t={}){return vr(r,e,t)}var gr=8,yr=(r,e,t,n)=>{wr(r,{name:e=dr(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:gr,readValueFromPointer:function(r){return this.fromWireType(g[r])},destructorFunction:null})},Er=[],br=[],kr=r=>{r>9&&0===--br[r+1]&&(br[r]=void 0,Er.push(r))},_r=()=>br.length/2-5-Er.length,Ar=()=>{br.push(0,1,void 0,1,null,1,!0,1,!1,1),o.count_emval_handles=_r},Pr={toValue:r=>(r||hr("Cannot use deleted val. handle = "+r),br[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=Er.pop()||br.length;return br[e]=r,br[e+1]=1,e}}}};function $r(r){return this.fromWireType(k[r>>2])}var Dr={name:"emscripten::val",fromWireType:r=>{var e=Pr.toValue(r);return kr(r),e},toWireType:(r,e)=>Pr.toHandle(e),argPackAdvance:gr,readValueFromPointer:$r,destructorFunction:null},Fr=r=>wr(r,Dr),Sr=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(_[r>>2])};case 8:return function(r){return this.fromWireType(A[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Cr=(r,e,t)=>{wr(r,{name:e=dr(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:gr,readValueFromPointer:Sr(e,t),destructorFunction:null})},Tr=(r,e)=>Object.defineProperty(e,"name",{value:r}),Mr=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function jr(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function xr(r,e,t,n,o,a){var i=e.length;i<2&&hr("argTypes array size mismatch! Must at least get return value and 'this' types!"),e[1];var s=jr(e),l="void"!==e[0].name,d=i-2,u=new Array(d),c=[],f=[];return Tr(r,function(...r){var t;f.length=0,c.length=1,c[0]=o;for(var a=0;a<d;++a)u[a]=e[a+2].toWireType(f,r[a]),c.push(u[a]);function i(r){if(s)Mr(f);else for(var n=2;n<e.length;n++){var o=1===n?t:u[n-2];null!==e[n].destructorFunction&&e[n].destructorFunction(o)}if(l)return e[0].fromWireType(r)}return i(n(...c))})}var Rr,Nr,zr=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||hr(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[n.length].apply(this,n)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},Or=(r,e,t)=>{o.hasOwnProperty(r)?((void 0===t||void 0!==o[r].overloadTable&&void 0!==o[r].overloadTable[t])&&hr(`Cannot register public name '${r}' twice`),zr(o,r,r),o[r].overloadTable.hasOwnProperty(t)&&hr(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),o[r].overloadTable[t]=e):(o[r]=e,o[r].argCount=t)},Br=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(k[e+4*n>>2]);return t},Ur=(r,e,t)=>{o.hasOwnProperty(r)||mr("Replacing nonexistent public symbol"),void 0!==o[r].overloadTable&&void 0!==t?o[r].overloadTable[t]=e:(o[r]=e,o[r].argCount=t)},Wr=(r,e,t)=>(r=r.replace(/p/g,"i"),(0,o["dynCall_"+r])(e,...t)),Lr=[],Hr=r=>{var e=Lr[r];return e||(r>=Lr.length&&(Lr.length=r+1),Lr[r]=e=Rr.get(r)),e},Ir=(r,e,t=[])=>r.includes("j")?Wr(r,e,t):Hr(e)(...t),Vr=(r,e)=>(...t)=>Ir(r,e,t),qr=(r,e)=>{function t(){return r.includes("j")?Vr(r,e):Hr(e)}r=dr(r);var n=t();return"function"!=typeof n&&hr(`unknown function pointer with signature ${r}: ${e}`),n},Xr=(r,e)=>{var t=Tr(e,function(r){this.name=e,this.message=r;var t=new Error(r).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},Gr=r=>{var e=_t(r),t=dr(e);return Pt(e),t},Kr=(r,e)=>{var t=[],n={};function o(r){n[r]||cr[r]||(fr[r]?fr[r].forEach(o):(t.push(r),n[r]=!0))}throw e.forEach(o),new Nr(`${r}: `+t.map(Gr).join([", "]))},Jr=r=>{const e=(r=r.trim()).indexOf("(");return-1!==e?r.substr(0,e):r},Qr=(r,e,t,n,o,a,i,s)=>{var l=Br(e,t);r=dr(r),r=Jr(r),o=qr(n,o),Or(r,function(){Kr(`Cannot call ${r} due to unbound types`,l)},e-1),pr([],l,t=>{var n=[t[0],null].concat(t.slice(1));return Ur(r,xr(r,n,null,o,a),e-1),[]})},Yr=(r,e,t)=>{switch(e){case 1:return t?r=>w[r]:r=>g[r];case 2:return t?r=>y[r>>1]:r=>E[r>>1];case 4:return t?r=>b[r>>2]:r=>k[r>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Zr=(r,e,t,n,o)=>{e=dr(e);var a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i}var s=e.includes("unsigned"),l=(r,e)=>{};wr(r,{name:e,fromWireType:a,toWireType:s?function(r,e){return l(e,this.name),e>>>0}:function(r,e){return l(e,this.name),e},argPackAdvance:gr,readValueFromPointer:Yr(e,t,0!==n),destructorFunction:null})},re=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(r){var e=k[r>>2],t=k[r+4>>2];return new n(w.buffer,t,e)}wr(r,{name:t=dr(t),fromWireType:o,argPackAdvance:gr,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},ee=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&r.charCodeAt(++i)),s<=127){if(t>=a)break;e[t++]=s}else if(s<=2047){if(t+1>=a)break;e[t++]=192|s>>6,e[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;e[t++]=224|s>>12,e[t++]=128|s>>6&63,e[t++]=128|63&s}else{if(t+3>=a)break;e[t++]=240|s>>18,e[t++]=128|s>>12&63,e[t++]=128|s>>6&63,e[t++]=128|63&s}}return e[t]=0,t-o},te=(r,e,t)=>ee(r,g,e,t),ne=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},oe="undefined"!=typeof TextDecoder?new TextDecoder:void 0,ae=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&oe)return oe.decode(r.subarray(e,o));for(var a="";e<o;){var i=r[e++];if(128&i){var s=63&r[e++];if(192!=(224&i)){var l=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|l:(7&i)<<18|s<<12|l<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var d=i-65536;a+=String.fromCharCode(55296|d>>10,56320|1023&d)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ie=(r,e)=>r?ae(g,r,e):"",se=(r,e)=>{wr(r,{name:e=dr(e),fromWireType(r){for(var e,t=k[r>>2],n=r+4,o=n,a=0;a<=t;++a){var i=n+a;if(a==t||0==g[i]){var s=ie(o,i-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=i+1}}return Pt(r),e},toWireType(r,e){var t;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||hr("Cannot pass non-string to std::string"),t=n?ne(e):e.length;var o=At(4+t+1),a=o+4;if(k[o>>2]=t,n)te(e,a,t+1);else if(n)for(var i=0;i<t;++i){var s=e.charCodeAt(i);s>255&&(Pt(a),hr("String has UTF-16 code units that do not fit in 8 bits")),g[a+i]=s}else for(i=0;i<t;++i)g[a+i]=e[i];return null!==r&&r.push(Pt,o),o},argPackAdvance:gr,readValueFromPointer:$r,destructorFunction(r){Pt(r)}})},le="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,de=(r,e)=>{for(var t=r,n=t>>1,o=n+e/2;!(n>=o)&&E[n];)++n;if((t=n<<1)-r>32&&le)return le.decode(g.subarray(r,t));for(var a="",i=0;!(i>=e/2);++i){var s=y[r+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},ue=(r,e,t)=>{if(t??=2147483647,t<2)return 0;for(var n=e,o=(t-=2)<2*r.length?t/2:r.length,a=0;a<o;++a){var i=r.charCodeAt(a);y[e>>1]=i,e+=2}return y[e>>1]=0,e-n},ce=r=>2*r.length,fe=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var o=b[r+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},he=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,o=n+t-4,a=0;a<r.length;++a){var i=r.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),b[e>>2]=i,(e+=4)+4>o)break}return b[e>>2]=0,e-n},me=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},pe=(r,e,t)=>{var n,o,a,i;t=dr(t),2===e?(n=de,o=ue,i=ce,a=r=>E[r>>1]):4===e&&(n=fe,o=he,i=me,a=r=>k[r>>2]),wr(r,{name:t,fromWireType:r=>{for(var t,o=k[r>>2],i=r+4,s=0;s<=o;++s){var l=r+4+s*e;if(s==o||0==a(l)){var d=n(i,l-i);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),i=l+e}}return Pt(r),t},toWireType:(r,n)=>{"string"!=typeof n&&hr(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=At(4+a+e);return k[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(Pt,s),s},argPackAdvance:gr,readValueFromPointer:$r,destructorFunction(r){Pt(r)}})},ve=(r,e)=>{wr(r,{isVoid:!0,name:e=dr(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},we=(r,e,t)=>g.copyWithin(r,e,e+t),ge=(r,e)=>{var t=cr[r];return void 0===t&&hr(`${e} has unknown type ${Gr(r)}`),t},ye=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(k[e>>2]=Pr.toHandle(n)),o},Ee=(r,e,t)=>(r=Pr.toValue(r),e=ge(e,"emval::as"),ye(e,t,r)),be=[],ke=(r,e,t,n)=>(r=be[r])(null,e=Pr.toValue(e),t,n),_e={},Ae=r=>{var e=_e[r];return void 0===e?dr(r):e},Pe=(r,e,t,n,o)=>(r=be[r])(e=Pr.toValue(e),e[t=Ae(t)],n,o),$e=()=>{if("object"==typeof globalThis)return globalThis;function r(r){r.$$$embind_global$$$=r;var e="object"==typeof $$$embind_global$$$&&r.$$$embind_global$$$==r;return e||delete r.$$$embind_global$$$,e}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof global&&r(global)?$$$embind_global$$$=global:"object"==typeof self&&r(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},De=r=>0===r?Pr.toHandle($e()):(r=Ae(r),Pr.toHandle($e()[r])),Fe=r=>{var e=be.length;return be.push(r),e},Se=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=ge(k[e+4*n>>2],"parameter "+n);return t},Ce=Reflect.construct,Te=(r,e,t)=>{var n=Se(r,e),o=n.shift();r--;var a=new Array(r),i=(e,i,s,l)=>{for(var d=0,u=0;u<r;++u)a[u]=n[u].readValueFromPointer(l+d),d+=n[u].argPackAdvance;var c=1===t?Ce(i,a):i.apply(e,a);return ye(o,s,c)},s=`methodCaller<(${n.map(r=>r.name).join(", ")}) => ${o.name}>`;return Fe(Tr(s,i))},Me=r=>(r=Ae(r),Pr.toHandle(o[r])),je=(r,e)=>(r=Pr.toValue(r),e=Pr.toValue(e),Pr.toHandle(r[e])),xe=r=>{r>9&&(br[r+1]+=1)},Re=r=>Pr.toHandle(Ae(r)),Ne=r=>{var e=Pr.toValue(r);Mr(e),kr(r)},ze=(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),l=i.getTimezoneOffset(),d=Math.max(s,l);k[r>>2]=60*d,b[e>>2]=Number(s!=l);var u=r=>{var e=r>=0?"-":"+",t=Math.abs(r);return`UTC${e}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},c=u(s),f=u(l);l<s?(te(c,t,17),te(f,n,17)):(te(c,n,17),te(f,t,17))},Oe=()=>2147483648,Be=(r,e)=>Math.ceil(r/e)*e,Ue=r=>{var e=(r-v.buffer.byteLength+65535)/65536|0;try{return v.grow(e),D(),1}catch(t){}},We=r=>{var e=g.length;r>>>=0;var t=Oe();if(r>t)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);o=Math.min(o,r+100663296);var a=Math.min(t,Be(Math.max(r,o),65536));if(Ue(a))return!0}return!1},Le={},He=()=>c||"./this.program",Ie=()=>{if(!Ie.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:He()};for(var e in Le)void 0===Le[e]?delete r[e]:r[e]=Le[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);Ie.strings=t}return Ie.strings},Ve=(r,e)=>{for(var t=0;t<r.length;++t)w[e++]=r.charCodeAt(t);w[e]=0},qe=(r,e)=>{var t=0;return Ie().forEach((n,o)=>{var a=e+t;k[r+4*o>>2]=a,Ve(n,a),t+=n.length+1}),0},Xe=(r,e)=>{var t=Ie();k[r>>2]=t.length;var n=0;return t.forEach(r=>n+=r.length+1),k[e>>2]=n,0},Ge={isAbs:r=>"/"===r.charAt(0),splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=Ge.isAbs(r),t="/"===r.substr(-1);return(r=Ge.normalizeArray(r.split("/").filter(r=>!!r),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=Ge.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:r=>{if("/"===r)return"/";var e=(r=(r=Ge.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?r:r.substr(e+1)},join:(...r)=>Ge.normalize(r.join("/")),join2:(r,e)=>Ge.normalize(r+"/"+e)},Ke=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return r=>crypto.getRandomValues(r);W("initRandomDevice")},Je=r=>(Je=Ke())(r),Qe={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:ct.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=Ge.isAbs(o)}return(t?"/":"")+(e=Ge.normalizeArray(e.split("/").filter(r=>!!r),!t).join("/"))||"."},relative:(r,e)=>{function t(r){for(var e=0;e<r.length&&""===r[e];e++);for(var t=r.length-1;t>=0&&""===r[t];t--);return e>t?[]:r.slice(e,t-e+1)}r=Qe.resolve(r).substr(1),e=Qe.resolve(e).substr(1);for(var n=t(r.split("/")),o=t(e.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var l=[];for(s=i;s<n.length;s++)l.push("..");return(l=l.concat(o.slice(i))).join("/")}},Ye=[];function Ze(r,e,t){var n=ne(r)+1,o=new Array(n),a=ee(r,o,0,o.length);return o.length=a,o}var rt=()=>{if(!Ye.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;Ye=Ze(r)}return Ye.shift()},et={ttys:[],init(){},shutdown(){},register(r,e){et.ttys[r]={input:[],output:[],ops:e},ct.registerDevice(r,et.stream_ops)},stream_ops:{open(r){var e=et.ttys[r.node.rdev];if(!e)throw new ct.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new ct.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(l){throw new ct.ErrnoError(29)}if(void 0===s&&0===a)throw new ct.ErrnoError(6);if(null==s)break;a++,e[t+i]=s}return a&&(r.node.atime=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new ct.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(i){throw new ct.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char:r=>rt(),put_char(r,e){null===e||10===e?(m(ae(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(m(ae(r.output)),r.output=[])},ioctl_tcgets:r=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(r,e,t)=>0,ioctl_tiocgwinsz:r=>[24,80]},default_tty1_ops:{put_char(r,e){null===e||10===e?(p(ae(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(p(ae(r.output)),r.output=[])}}},tt=r=>{W()},nt={ops_table:null,mount:r=>nt.createNode(null,"/",16895,0),createNode(r,e,t,n){if(ct.isBlkdev(t)||ct.isFIFO(t))throw new ct.ErrnoError(63);nt.ops_table||={dir:{node:{getattr:nt.node_ops.getattr,setattr:nt.node_ops.setattr,lookup:nt.node_ops.lookup,mknod:nt.node_ops.mknod,rename:nt.node_ops.rename,unlink:nt.node_ops.unlink,rmdir:nt.node_ops.rmdir,readdir:nt.node_ops.readdir,symlink:nt.node_ops.symlink},stream:{llseek:nt.stream_ops.llseek}},file:{node:{getattr:nt.node_ops.getattr,setattr:nt.node_ops.setattr},stream:{llseek:nt.stream_ops.llseek,read:nt.stream_ops.read,write:nt.stream_ops.write,allocate:nt.stream_ops.allocate,mmap:nt.stream_ops.mmap,msync:nt.stream_ops.msync}},link:{node:{getattr:nt.node_ops.getattr,setattr:nt.node_ops.setattr,readlink:nt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:nt.node_ops.getattr,setattr:nt.node_ops.setattr},stream:ct.chrdev_stream_ops}};var o=ct.createNode(r,e,t,n);return ct.isDir(o.mode)?(o.node_ops=nt.ops_table.dir.node,o.stream_ops=nt.ops_table.dir.stream,o.contents={}):ct.isFile(o.mode)?(o.node_ops=nt.ops_table.file.node,o.stream_ops=nt.ops_table.file.stream,o.usedBytes=0,o.contents=null):ct.isLink(o.mode)?(o.node_ops=nt.ops_table.link.node,o.stream_ops=nt.ops_table.link.stream):ct.isChrdev(o.mode)&&(o.node_ops=nt.ops_table.chrdev.node,o.stream_ops=nt.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),r&&(r.contents[e]=o,r.atime=r.mtime=r.ctime=o.atime),o},getFileDataAsTypedArray:r=>r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0),expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1048576;e=Math.max(e,t*(t<n?2:1.125)>>>0),0!=t&&(e=Math.max(e,256));var o=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(o.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(0==e)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=ct.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,ct.isDir(r.mode)?e.size=4096:ct.isFile(r.mode)?e.size=r.usedBytes:ct.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.atime),e.mtime=new Date(r.mtime),e.ctime=new Date(r.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){for(const t of["mode","atime","mtime","ctime"])e[t]&&(r[t]=e[t]);void 0!==e.size&&nt.resizeFileStorage(r,e.size)},lookup(r,e){throw nt.doesNotExistError},mknod:(r,e,t,n)=>nt.createNode(r,e,t,n),rename(r,e,t){var n;try{n=ct.lookupNode(e,t)}catch(a){}if(n){if(ct.isDir(r.mode))for(var o in n.contents)throw new ct.ErrnoError(55);ct.hashRemoveNode(n)}delete r.parent.contents[r.name],e.contents[t]=r,r.name=t,e.ctime=e.mtime=r.parent.ctime=r.parent.mtime=Date.now()},unlink(r,e){delete r.contents[e],r.ctime=r.mtime=Date.now()},rmdir(r,e){var t=ct.lookupNode(r,e);for(var n in t.contents)throw new ct.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir:r=>[".","..",...Object.keys(r.contents)],symlink(r,e,t){var n=nt.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!ct.isLink(r.mode))throw new ct.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var i=Math.min(r.node.usedBytes-o,n);if(i>8&&a.subarray)e.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)e[t+s]=a[o+s];return i},write(r,e,t,n,o,a){if(e.buffer===w.buffer&&(a=!1),!n)return 0;var i=r.node;if(i.mtime=i.ctime=Date.now(),e.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=e.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=e.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(e.subarray(t,t+n),o),n}if(nt.expandFileStorage(i,o+n),i.contents.subarray&&e.subarray)i.contents.set(e.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=e[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(1===t?n+=r.position:2===t&&ct.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new ct.ErrnoError(28);return n},allocate(r,e,t){nt.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!ct.isFile(r.node.mode))throw new ct.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==w.buffer){if(i=!0,!(a=tt()))throw new ct.ErrnoError(48);s&&((t>0||t+e<s.length)&&(s=s.subarray?s.subarray(t,t+e):Array.prototype.slice.call(s,t,t+e)),w.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(nt.stream_ops.write(r,e,0,n,t,!1),0)}},ot=async r=>{var e=await l(r);return new Uint8Array(e)},at=(r,e,t,n,o,a)=>{ct.createDataFile(r,e,t,n,o,a)},it=o.preloadPlugins||[],st=(r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return it.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},lt=(r,e,t,n,o,a,i,s,l,d)=>{var u=e?Qe.resolve(Ge.join2(r,e)):r;function c(t){function c(t){d?.(),s||at(r,e,t,n,o,l),a?.(),U()}st(t,u,c,()=>{i?.(),U()})||c(t)}B(),"string"==typeof t?ot(t).then(c,i):c(t)},dt=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(void 0===e)throw new Error(`Unknown file open mode: ${r}`);return e},ut=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},ct={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(r){this.node=r}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.id=ct.nextInode++,this.name=e,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return ct.isDir(this.mode)}get isDevice(){return ct.isChrdev(this.mode)}},lookupPath(r,e={}){if(!r)return{path:"",node:null};e.follow_mount??=!0,Ge.isAbs(r)||(r=ct.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter(r=>!!r&&"."!==r),o=ct.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if(".."!==n[i]){a=Ge.join2(a,n[i]);try{o=ct.lookupNode(o,n[i])}catch(d){if(44===d?.errno&&s&&e.noent_okay)return{path:a};throw d}if(!ct.isMountpoint(o)||s&&!e.follow_mount||(o=o.mounted.root),ct.isLink(o.mode)&&(!s||e.follow)){if(!o.node_ops.readlink)throw new ct.ErrnoError(52);var l=o.node_ops.readlink(o);Ge.isAbs(l)||(l=Ge.dirname(a)+"/"+l),r=l+"/"+n.slice(i+1).join("/");continue r}}else a=Ge.dirname(a),o=o.parent}return{path:a,node:o}}throw new ct.ErrnoError(32)},getPath(r){for(var e;;){if(ct.isRoot(r)){var t=r.mount.mountpoint;return e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%ct.nameTable.length},hashAddNode(r){var e=ct.hashName(r.parent.id,r.name);r.name_next=ct.nameTable[e],ct.nameTable[e]=r},hashRemoveNode(r){var e=ct.hashName(r.parent.id,r.name);if(ct.nameTable[e]===r)ct.nameTable[e]=r.name_next;else for(var t=ct.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=ct.mayLookup(r);if(t)throw new ct.ErrnoError(t);for(var n=ct.hashName(r.id,e),o=ct.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return ct.lookup(r,e)},createNode(r,e,t,n){var o=new ct.FSNode(r,e,t,n);return ct.hashAddNode(o),o},destroyNode(r){ct.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>32768==(61440&r),isDir:r=>16384==(61440&r),isLink:r=>40960==(61440&r),isChrdev:r=>8192==(61440&r),isBlkdev:r=>24576==(61440&r),isFIFO:r=>4096==(61440&r),isSocket:r=>!(49152&~r),flagsToPermissionString(r){var e=["r","w","rw"][3&r];return 512&r&&(e+="w"),e},nodePermissions:(r,e)=>ct.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!ct.isDir(r.mode))return 54;var e=ct.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){if(!ct.isDir(r.mode))return 54;try{return ct.lookupNode(r,e),20}catch(t){}return ct.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=ct.lookupNode(r,e)}catch(a){return a.errno}var o=ct.nodePermissions(r,"wx");if(o)return o;if(t){if(!ct.isDir(n.mode))return 54;if(ct.isRoot(n)||ct.getPath(n)===ct.cwd())return 10}else if(ct.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?ct.isLink(r.mode)?32:ct.isDir(r.mode)&&("r"!==ct.flagsToPermissionString(e)||512&e)?31:ct.nodePermissions(r,ct.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=ct.MAX_OPEN_FDS;r++)if(!ct.streams[r])return r;throw new ct.ErrnoError(33)},getStreamChecked(r){var e=ct.getStream(r);if(!e)throw new ct.ErrnoError(8);return e},getStream:r=>ct.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new ct.FSStream,r),-1==e&&(e=ct.nextfd()),r.fd=e,ct.streams[e]=r,r),closeStream(r){ct.streams[r]=null},dupStream(r,e=-1){var t=ct.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=ct.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new ct.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){ct.devices[r]={stream_ops:e}},getDevice:r=>ct.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){"function"==typeof r&&(e=r,r=!1),ct.syncFSRequests++,ct.syncFSRequests>1&&p(`warning: ${ct.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=ct.getMounts(ct.root.mount),n=0;function o(r){return ct.syncFSRequests--,e(r)}function a(r){if(r)return a.errored?void 0:(a.errored=!0,o(r));++n>=t.length&&o(null)}t.forEach(e=>{if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)})},mount(r,e,t){var n,o="/"===t,a=!t;if(o&&ct.root)throw new ct.ErrnoError(10);if(!o&&!a){var i=ct.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,ct.isMountpoint(n))throw new ct.ErrnoError(10);if(!ct.isDir(n.mode))throw new ct.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},l=r.mount(s);return l.mount=s,s.root=l,o?ct.root=l:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),l},unmount(r){var e=ct.lookupPath(r,{follow_mount:!1});if(!ct.isMountpoint(e.node))throw new ct.ErrnoError(28);var t=e.node,n=t.mounted,o=ct.getMounts(n);Object.keys(ct.nameTable).forEach(r=>{for(var e=ct.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&ct.destroyNode(e),e=t}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(r,e)=>r.node_ops.lookup(r,e),mknod(r,e,t){var n=ct.lookupPath(r,{parent:!0}).node,o=Ge.basename(r);if(!o||"."===o||".."===o)throw new ct.ErrnoError(28);var a=ct.mayCreate(n,o);if(a)throw new ct.ErrnoError(a);if(!n.node_ops.mknod)throw new ct.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:ct.nextInode,ffree:ct.nextInode-1,fsid:42,flags:2,namelen:255},t=ct.lookupPath(r,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(e,t.node_ops.statfs(t.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,ct.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,ct.mknod(r,e,0)),mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{ct.mkdir(n,e)}catch(a){if(20!=a.errno)throw a}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,ct.mknod(r,e,t)),symlink(r,e){if(!Qe.resolve(r))throw new ct.ErrnoError(44);var t=ct.lookupPath(e,{parent:!0}).node;if(!t)throw new ct.ErrnoError(44);var n=Ge.basename(e),o=ct.mayCreate(t,n);if(o)throw new ct.ErrnoError(o);if(!t.node_ops.symlink)throw new ct.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=Ge.dirname(r),a=Ge.dirname(e),i=Ge.basename(r),s=Ge.basename(e);if(t=ct.lookupPath(r,{parent:!0}).node,n=ct.lookupPath(e,{parent:!0}).node,!t||!n)throw new ct.ErrnoError(44);if(t.mount!==n.mount)throw new ct.ErrnoError(75);var l,d=ct.lookupNode(t,i),u=Qe.relative(r,a);if("."!==u.charAt(0))throw new ct.ErrnoError(28);if("."!==(u=Qe.relative(e,o)).charAt(0))throw new ct.ErrnoError(55);try{l=ct.lookupNode(n,s)}catch(h){}if(d!==l){var c=ct.isDir(d.mode),f=ct.mayDelete(t,i,c);if(f)throw new ct.ErrnoError(f);if(f=l?ct.mayDelete(n,s,c):ct.mayCreate(n,s))throw new ct.ErrnoError(f);if(!t.node_ops.rename)throw new ct.ErrnoError(63);if(ct.isMountpoint(d)||l&&ct.isMountpoint(l))throw new ct.ErrnoError(10);if(n!==t&&(f=ct.nodePermissions(t,"w")))throw new ct.ErrnoError(f);ct.hashRemoveNode(d);try{t.node_ops.rename(d,n,s),d.parent=n}catch(h){throw h}finally{ct.hashAddNode(d)}}},rmdir(r){var e=ct.lookupPath(r,{parent:!0}).node,t=Ge.basename(r),n=ct.lookupNode(e,t),o=ct.mayDelete(e,t,!0);if(o)throw new ct.ErrnoError(o);if(!e.node_ops.rmdir)throw new ct.ErrnoError(63);if(ct.isMountpoint(n))throw new ct.ErrnoError(10);e.node_ops.rmdir(e,t),ct.destroyNode(n)},readdir(r){var e=ct.lookupPath(r,{follow:!0}).node;if(!e.node_ops.readdir)throw new ct.ErrnoError(54);return e.node_ops.readdir(e)},unlink(r){var e=ct.lookupPath(r,{parent:!0}).node;if(!e)throw new ct.ErrnoError(44);var t=Ge.basename(r),n=ct.lookupNode(e,t),o=ct.mayDelete(e,t,!1);if(o)throw new ct.ErrnoError(o);if(!e.node_ops.unlink)throw new ct.ErrnoError(63);if(ct.isMountpoint(n))throw new ct.ErrnoError(10);e.node_ops.unlink(e,t),ct.destroyNode(n)},readlink(r){var e=ct.lookupPath(r).node;if(!e)throw new ct.ErrnoError(44);if(!e.node_ops.readlink)throw new ct.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=ct.lookupPath(r,{follow:!e}).node;if(!t)throw new ct.ErrnoError(44);if(!t.node_ops.getattr)throw new ct.ErrnoError(63);return t.node_ops.getattr(t)},lstat:r=>ct.stat(r,!0),chmod(r,e,t){var n;if(!(n="string"==typeof r?ct.lookupPath(r,{follow:!t}).node:r).node_ops.setattr)throw new ct.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,ctime:Date.now()})},lchmod(r,e){ct.chmod(r,e,!0)},fchmod(r,e){var t=ct.getStreamChecked(r);ct.chmod(t.node,e)},chown(r,e,t,n){var o;if(!(o="string"==typeof r?ct.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new ct.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){ct.chown(r,e,t,!0)},fchown(r,e,t){var n=ct.getStreamChecked(r);ct.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new ct.ErrnoError(28);var t;if(!(t="string"==typeof r?ct.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new ct.ErrnoError(63);if(ct.isDir(t.mode))throw new ct.ErrnoError(31);if(!ct.isFile(t.mode))throw new ct.ErrnoError(28);var n=ct.nodePermissions(t,"w");if(n)throw new ct.ErrnoError(n);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=ct.getStreamChecked(r);if(!(2097155&t.flags))throw new ct.ErrnoError(28);ct.truncate(t.node,e)},utime(r,e,t){var n=ct.lookupPath(r,{follow:!0}).node;n.node_ops.setattr(n,{atime:e,mtime:t})},open(r,e,t=438){if(""===r)throw new ct.ErrnoError(44);var n;if(t=64&(e="string"==typeof e?dt(e):e)?4095&t|32768:0,"object"==typeof r)n=r;else{var a=ct.lookupPath(r,{follow:!(131072&e),noent_okay:!0});n=a.node,r=a.path}var i=!1;if(64&e)if(n){if(128&e)throw new ct.ErrnoError(20)}else n=ct.mknod(r,t,0),i=!0;if(!n)throw new ct.ErrnoError(44);if(ct.isChrdev(n.mode)&&(e&=-513),65536&e&&!ct.isDir(n.mode))throw new ct.ErrnoError(54);if(!i){var s=ct.mayOpen(n,e);if(s)throw new ct.ErrnoError(s)}512&e&&!i&&ct.truncate(n,0),e&=-131713;var l=ct.createStream({node:n,path:ct.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),!o.logReadFiles||1&e||r in ct.readFiles||(ct.readFiles[r]=1),l},close(r){if(ct.isClosed(r))throw new ct.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{ct.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(ct.isClosed(r))throw new ct.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new ct.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new ct.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new ct.ErrnoError(28);if(ct.isClosed(r))throw new ct.ErrnoError(8);if(1==(2097155&r.flags))throw new ct.ErrnoError(8);if(ct.isDir(r.node.mode))throw new ct.ErrnoError(31);if(!r.stream_ops.read)throw new ct.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new ct.ErrnoError(70)}else o=r.position;var i=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=i),i},write(r,e,t,n,o,a){if(n<0||o<0)throw new ct.ErrnoError(28);if(ct.isClosed(r))throw new ct.ErrnoError(8);if(!(2097155&r.flags))throw new ct.ErrnoError(8);if(ct.isDir(r.node.mode))throw new ct.ErrnoError(31);if(!r.stream_ops.write)throw new ct.ErrnoError(28);r.seekable&&1024&r.flags&&ct.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new ct.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},allocate(r,e,t){if(ct.isClosed(r))throw new ct.ErrnoError(8);if(e<0||t<=0)throw new ct.ErrnoError(28);if(!(2097155&r.flags))throw new ct.ErrnoError(8);if(!ct.isFile(r.node.mode)&&!ct.isDir(r.node.mode))throw new ct.ErrnoError(43);if(!r.stream_ops.allocate)throw new ct.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new ct.ErrnoError(2);if(1==(2097155&r.flags))throw new ct.ErrnoError(2);if(!r.stream_ops.mmap)throw new ct.ErrnoError(43);if(!e)throw new ct.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,o)},msync:(r,e,t,n,o)=>r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0,ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new ct.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=ct.open(r,e.flags),o=ct.stat(r).size,a=new Uint8Array(o);return ct.read(n,a,0,o,0),"utf8"===e.encoding?t=ae(a):"binary"===e.encoding&&(t=a),ct.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=ct.open(r,t.flags,t.mode);if("string"==typeof e){var o=new Uint8Array(ne(e)+1),a=ee(e,o,0,o.length);ct.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");ct.write(n,e,0,e.byteLength,void 0,t.canOwn)}ct.close(n)},cwd:()=>ct.currentPath,chdir(r){var e=ct.lookupPath(r,{follow:!0});if(null===e.node)throw new ct.ErrnoError(44);if(!ct.isDir(e.node.mode))throw new ct.ErrnoError(54);var t=ct.nodePermissions(e.node,"x");if(t)throw new ct.ErrnoError(t);ct.currentPath=e.path},createDefaultDirectories(){ct.mkdir("/tmp"),ct.mkdir("/home"),ct.mkdir("/home/web_user")},createDefaultDevices(){ct.mkdir("/dev"),ct.registerDevice(ct.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),ct.mkdev("/dev/null",ct.makedev(1,3)),et.register(ct.makedev(5,0),et.default_tty_ops),et.register(ct.makedev(6,0),et.default_tty1_ops),ct.mkdev("/dev/tty",ct.makedev(5,0)),ct.mkdev("/dev/tty1",ct.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(e=Je(r).byteLength),r[--e]);ct.createDevice("/dev","random",t),ct.createDevice("/dev","urandom",t),ct.mkdir("/dev/shm"),ct.mkdir("/dev/shm/tmp")},createSpecialDirectories(){ct.mkdir("/proc");var r=ct.mkdir("/proc/self");ct.mkdir("/proc/self/fd"),ct.mount({mount(){var e=ct.createNode(r,"fd",16895,73);return e.stream_ops={llseek:nt.stream_ops.llseek},e.node_ops={lookup(r,e){var t=+e,n=ct.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(ct.streams.entries()).filter(([r,e])=>e).map(([r,e])=>r.toString())},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?ct.createDevice("/dev","stdin",r):ct.symlink("/dev/tty","/dev/stdin"),e?ct.createDevice("/dev","stdout",null,e):ct.symlink("/dev/tty","/dev/stdout"),t?ct.createDevice("/dev","stderr",null,t):ct.symlink("/dev/tty1","/dev/stderr"),ct.open("/dev/stdin",0),ct.open("/dev/stdout",1),ct.open("/dev/stderr",1)},staticInit(){ct.nameTable=new Array(4096),ct.mount(nt,{},"/"),ct.createDefaultDirectories(),ct.createDefaultDevices(),ct.createSpecialDirectories(),ct.filesystems={MEMFS:nt}},init(r,e,t){ct.initialized=!0,r??=o.stdin,e??=o.stdout,t??=o.stderr,ct.createStandardStreams(r,e,t)},quit(){ct.initialized=!1;for(var r=0;r<ct.streams.length;r++){var e=ct.streams[r];e&&ct.close(e)}},findObject(r,e){var t=ct.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=ct.lookupPath(r,{follow:!e})).path}catch(o){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=ct.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=Ge.basename(r),n=ct.lookupPath(r,{follow:!e}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(o){t.error=o.errno}return t},createPath(r,e,t,n){r="string"==typeof r?r:ct.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=Ge.join2(r,a);try{ct.mkdir(i)}catch(s){}r=i}}return i},createFile(r,e,t,n,o){var a=Ge.join2("string"==typeof r?r:ct.getPath(r),e),i=ut(n,o);return ct.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:ct.getPath(r),i=e?Ge.join2(r,e):r);var s=ut(n,o),l=ct.create(i,s);if(t){if("string"==typeof t){for(var d=new Array(t.length),u=0,c=t.length;u<c;++u)d[u]=t.charCodeAt(u);t=d}ct.chmod(l,146|s);var f=ct.open(l,577);ct.write(f,t,0,t.length,0,a),ct.close(f),ct.chmod(l,s)}},createDevice(r,e,t,n){var o=Ge.join2("string"==typeof r?r:ct.getPath(r),e),a=ut(!!t,!!n);ct.createDevice.major??=64;var i=ct.makedev(ct.createDevice.major++,0);return ct.registerDevice(i,{open(r){r.seekable=!1},close(r){n?.buffer?.length&&n(10)},read(r,e,n,o,a){for(var i=0,s=0;s<o;s++){var l;try{l=t()}catch(d){throw new ct.ErrnoError(29)}if(void 0===l&&0===i)throw new ct.ErrnoError(6);if(null==l)break;i++,e[n+s]=l}return i&&(r.node.atime=Date.now()),i},write(r,e,t,o,a){for(var i=0;i<o;i++)try{n(e[t+i])}catch(s){throw new ct.ErrnoError(29)}return o&&(r.node.mtime=r.node.ctime=Date.now()),i}}),ct.mkdev(o,a,i)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if("undefined"!=typeof XMLHttpRequest)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.");try{r.contents=d(r.url),r.usedBytes=r.contents.length}catch(e){throw new ct.ErrnoError(29)}},createLazyFile(r,e,t,n,o){class a{lengthKnown=!1;chunks=[];get(r){if(!(r>this.length-1||r<0)){var e=r%this.chunkSize,t=r/this.chunkSize|0;return this.getter(t)[e]}}setDataGetter(r){this.getter=r}cacheLength(){var r=new XMLHttpRequest;if(r.open("HEAD",t,!1),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw new Error("Couldn't load "+t+". Status: "+r.status);var e,n=Number(r.getResponseHeader("Content-length")),o=(e=r.getResponseHeader("Accept-Ranges"))&&"bytes"===e,a=(e=r.getResponseHeader("Content-Encoding"))&&"gzip"===e,i=1048576;o||(i=n);var s=(r,e)=>{if(r>e)throw new Error("invalid range ("+r+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+r+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):Ze(o.responseText||"")},l=this;l.setDataGetter(r=>{var e=r*i,t=(r+1)*i-1;if(t=Math.min(t,n-1),void 0===l.chunks[r]&&(l.chunks[r]=s(e,t)),void 0===l.chunks[r])throw new Error("doXHR failed!");return l.chunks[r]}),!a&&n||(i=n=1,n=this.getter(0).length,i=n,m("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new a}}else i={isDevice:!1,url:t};var l=ct.createFile(r,e,i,n,o);i.contents?l.contents=i.contents:i.url&&(l.contents=null,l.url=i.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var d={};function u(r,e,t,n,o){var a=r.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)e[t+s]=a[o+s];else for(s=0;s<i;s++)e[t+s]=a.get(o+s);return i}return Object.keys(l.stream_ops).forEach(r=>{var e=l.stream_ops[r];d[r]=(...r)=>(ct.forceLoadFile(l),e(...r))}),d.read=(r,e,t,n,o)=>(ct.forceLoadFile(l),u(r,e,t,n,o)),d.mmap=(r,e,t,n,o)=>{ct.forceLoadFile(l);var a=tt();if(!a)throw new ct.ErrnoError(48);return u(r,w,a,e,t),{ptr:a,allocated:!0}},l.stream_ops=d,l}},ft={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(Ge.isAbs(e))return e;var n;if(n=-100===r?ct.cwd():ft.getStreamFromFD(r).path,0==e.length){if(!t)throw new ct.ErrnoError(44);return n}return n+"/"+e},doStat(r,e,t){var n=r(e);b[t>>2]=n.dev,b[t+4>>2]=n.mode,k[t+8>>2]=n.nlink,b[t+12>>2]=n.uid,b[t+16>>2]=n.gid,b[t+20>>2]=n.rdev,I=[n.size>>>0,(H=n.size,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[t+24>>2]=I[0],b[t+28>>2]=I[1],b[t+32>>2]=4096,b[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(H=Math.floor(o/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[t+40>>2]=I[0],b[t+44>>2]=I[1],k[t+48>>2]=o%1e3*1e3*1e3,I=[Math.floor(a/1e3)>>>0,(H=Math.floor(a/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[t+56>>2]=I[0],b[t+60>>2]=I[1],k[t+64>>2]=a%1e3*1e3*1e3,I=[Math.floor(i/1e3)>>>0,(H=Math.floor(i/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[t+72>>2]=I[0],b[t+76>>2]=I[1],k[t+80>>2]=i%1e3*1e3*1e3,I=[n.ino>>>0,(H=n.ino,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[t+88>>2]=I[0],b[t+92>>2]=I[1],0},doMsync(r,e,t,n,o){if(!ct.isFile(e.node.mode))throw new ct.ErrnoError(43);if(2&n)return 0;var a=g.slice(r,r+t);ct.msync(e,a,o,t,n)},getStreamFromFD:r=>ct.getStreamChecked(r),varargs:void 0,getStr:r=>ie(r)};function ht(r){try{var e=ft.getStreamFromFD(r);return ct.close(e),0}catch(t){if(void 0===ct||"ErrnoError"!==t.name)throw t;return t.errno}}var mt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=k[e>>2],s=k[e+4>>2];e+=8;var l=ct.read(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function pt(r,e,t,n){try{var o=ft.getStreamFromFD(r),a=mt(o,e,t);return k[n>>2]=a,0}catch(i){if(void 0===ct||"ErrnoError"!==i.name)throw i;return i.errno}}var vt=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*e:NaN;function wt(r,e,t,n,o){var a=vt(e,t);try{if(isNaN(a))return 61;var i=ft.getStreamFromFD(r);return ct.llseek(i,a,n),I=[i.position>>>0,(H=i.position,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],b[o>>2]=I[0],b[o+4>>2]=I[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(s){if(void 0===ct||"ErrnoError"!==s.name)throw s;return s.errno}}var gt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=k[e>>2],s=k[e+4>>2];e+=8;var l=ct.write(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function yt(r,e,t,n){try{var o=ft.getStreamFromFD(r),a=gt(o,e,t);return k[n>>2]=a,0}catch(i){if(void 0===ct||"ErrnoError"!==i.name)throw i;return i.errno}}lr(),nr=o.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},or=o.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Ar(),Nr=o.UnboundTypeError=Xr(Error,"UnboundTypeError"),ct.createPreloadedFile=lt,ct.staticInit(),nt.doesNotExistError=new ct.ErrnoError(44),nt.doesNotExistError.stack="<generic error, no stack>";var Et,bt={q:ar,w:ir,s:sr,D:yr,B:Fr,p:Cr,i:Qr,c:Zr,a:re,C:se,j:pe,E:ve,A:we,n:Ee,l:ke,k:Pe,b:kr,F:De,g:Te,m:Me,e:je,h:xe,f:Re,d:Ne,t:ze,z:We,u:qe,v:Xe,x:ht,y:pt,r:wt,o:yt};Z();var kt,_t=r=>(_t=Et.I)(r),At=r=>(At=Et.K)(r),Pt=r=>(Pt=Et.L)(r);function $t(){function r(){kt||(kt=!0,o.calledRun=!0,$||(M(),t(o),o.onRuntimeInitialized?.(),j()))}z>0||(T(),z>0||(o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),r()},1)):r()))}if(o.dynCall_jiji=(r,e,t,n,a)=>(o.dynCall_jiji=Et.M)(r,e,t,n,a),o.dynCall_viijii=(r,e,t,n,a,i,s)=>(o.dynCall_viijii=Et.N)(r,e,t,n,a,i,s),o.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(o.dynCall_iiiiij=Et.O)(r,e,t,n,a,i,s),o.dynCall_iiiiijj=(r,e,t,n,a,i,s,l,d)=>(o.dynCall_iiiiijj=Et.P)(r,e,t,n,a,i,s,l,d),o.dynCall_iiiiiijj=(r,e,t,n,a,i,s,l,d,u)=>(o.dynCall_iiiiiijj=Et.Q)(r,e,t,n,a,i,s,l,d,u),O=function r(){kt||$t(),kt||(O=r)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return $t(),a});export{e as default};
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.45";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
package/core/screenUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../geometry/Polygon.js";const n=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,r="screenUtils.toPt: input not recognized!",i=96;function e(t){return t?t/72*i:0}function u(t){return t?72*t/i:0}function o(t){if("string"==typeof t){const i=t.match(n);if(i){const n=Number(i[1]),r=i[3]&&i[3].toLowerCase(),e=t.startsWith("-"),o="px"===r?u(n):n;return e?-o:o}return console.warn(r),null}return t}function c(t=0,n=0){return{x:t,y:n}}function h(t=0,n=0,r=0,i=0){return{x:t,y:n,width:r,height:i}}function y(t){return t?c(t.x,t.y):null}function f(t=0,n=0){return[t,n]}function x(t=0,n=0){return{x:t,y:n}}function a(t=0,n=0){return m([t,n])}function s(t=0,n=0,r=0){return g([t,n,r])}function m(t){return t}function g(t){return t}function l(t){return t}function p(t,n){return n?(n.x=t[0],n.y=t[1],n):{x:t[0],y:t[1]}}function d(t,n){return n?(n[0]=t.x,n[1]=t.y,n.length>2&&(n[2]=0),n):[t.x,t.y]}function w(t,n){return t===n||null==t&&null==n||t?.x===n?.x&&t?.y===n?.y}function M(t,n){const r=t.x-n.x,i=t.y-n.y;return r*r+i*i}function b(t,n){return Math.sqrt(M(t,n))}function
|
|
2
|
+
import t from"../geometry/Polygon.js";const n=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,r="screenUtils.toPt: input not recognized!",i=96;function e(t){return t?t/72*i:0}function u(t){return t?72*t/i:0}function o(t){if("string"==typeof t){const i=t.match(n);if(i){const n=Number(i[1]),r=i[3]&&i[3].toLowerCase(),e=t.startsWith("-"),o="px"===r?u(n):n;return e?-o:o}return console.warn(r),null}return t}function c(t=0,n=0){return{x:t,y:n}}function h(t=0,n=0,r=0,i=0){return{x:t,y:n,width:r,height:i}}function y(t){return t?c(t.x,t.y):null}function f(t=0,n=0){return[t,n]}function x(t=0,n=0){return{x:t,y:n}}function a(t=0,n=0){return m([t,n])}function s(t=0,n=0,r=0){return g([t,n,r])}function m(t){return t}function g(t){return t}function l(t){return t}function p(t,n){return n?(n.x=t[0],n.y=t[1],n):{x:t[0],y:t[1]}}function d(t,n){return n?(n[0]=t.x,n[1]=t.y,n.length>2&&(n[2]=0),n):[t.x,t.y]}function w(t,n){return t===n||null==t&&null==n||t?.x===n?.x&&t?.y===n?.y}function M(t,n){const r=t.x-n.x,i=t.y-n.y;return r*r+i*i}function b(t,n){return Math.sqrt(M(t,n))}function A(t){return t&&"x"in t&&"y"in t&&"width"in t&&"height"in t}function N(t){return Array.isArray(t)}function F(t){return t&&"x"in t&&"y"in t&&!A(t)}function P(t,n){return!(t.x+t.width<n.x||n.x+n.width<t.x||t.y+t.height<n.y||n.y+n.height<t.y)}function R(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)}function j(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)}function q(n,r){const{x:i,y:e,width:u,height:o}=r,h=n.toMap(c(i,e)),y=n.toMap(c(i+u,e)),f=n.toMap(c(i+u,e+o)),x=n.toMap(c(i,e+o));return new t({rings:[[h.toArray(),y.toArray(),f.toArray(),x.toArray(),h.toArray()]],spatialReference:h.spatialReference})}function z(t,n,r){const i=Math.max(0,t.x),e=Math.max(0,t.y),u=Math.min(n,t.x+t.width)-i,o=Math.min(r,t.y+t.height)-e;return{x:i,y:e,width:Math.max(0,u),height:Math.max(0,o)}}export{m as castRenderScreenPointArray,g as castRenderScreenPointArray3,l as castScreenPointArray,z as clipRectToView,y as cloneScreenPoint,x as createRenderScreenPoint,a as createRenderScreenPointArray,s as createRenderScreenPointArray3,c as createScreenPoint,f as createScreenPointArray,h as createScreenRect,F as isScreenPoint,N as isScreenPolygon,A as isScreenRect,R as isValidScreenPoint,j as isValidScreenRect,e as pt2px,u as px2pt,b as screenDistance,p as screenPointArrayToObject,w as screenPointEqual,d as screenPointObjectToArray,P as screenRectIntersects,q as screenRectToPolygon,M as squaredScreenDistance,o as toPt};
|
package/core/types.d.ts
CHANGED
|
@@ -48,6 +48,13 @@ export interface ScreenRect {
|
|
|
48
48
|
height: number;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Polygon on the screen in DOM/CSS coordinate space.
|
|
53
|
+
*
|
|
54
|
+
* @since 5.2
|
|
55
|
+
*/
|
|
56
|
+
export type ScreenPolygon = readonly ScreenPoint[];
|
|
57
|
+
|
|
51
58
|
/**
|
|
52
59
|
* A custom log interceptor function.
|
|
53
60
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{len as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import t from"../Extent.js";import{create as r}from"./aaBoundingRect.js";import{newDoubleArray as a}from"./DoubleArray.js";function i(n){return n}function u(n=en){return i([n[0],n[1],n[2],n[3],n[4],n[5]])}function e(n,t){for(let r=0;r<6;r++)n[r]=t[r]}function m(n,t,r,a,i,e,m=u()){return m[0]=n,m[1]=t,m[2]=r,m[3]=a,m[4]=i,m[5]=e,m}function o(n,t=u()){return t[0]=n.xmin,t[1]=n.ymin,t[2]=n.hasZ?n.zmin:-1/0,t[3]=n.xmax,t[4]=n.ymax,t[5]=n.hasZ?n.zmax:1/0,t}function f(n,t=u()){return c(n,0,n.length/3,t)}function c(n,t,r,a=u()){return L(a,un),g(a,n,t,r),a}function h(n){n[0]=1/0,n[1]=1/0,n[2]=1/0,n[3]=-1/0,n[4]=-1/0,n[5]=-1/0}function M(n,t){for(let r=0;r<6;r++)if(n[r]!==t[r])return!1;return!0}function x(n){return!(n[0]<=n[3]&&n[1]<=n[4]&&n[2]<=n[5])}function l(n,t=a(24)){const[r,i,u,e,m,o]=n;return t[0]=r,t[1]=i,t[2]=u,t[3]=r,t[4]=i,t[5]=o,t[6]=r,t[7]=m,t[8]=u,t[9]=r,t[10]=m,t[11]=o,t[12]=e,t[13]=i,t[14]=u,t[15]=e,t[16]=i,t[17]=o,t[18]=e,t[19]=m,t[20]=u,t[21]=e,t[22]=m,t[23]=o,t}function s(n,r){const a=isFinite(n[2])||isFinite(n[5]);return new t(a?{xmin:n[0],xmax:n[3],ymin:n[1],ymax:n[4],zmin:n[2],zmax:n[5],spatialReference:r}:{xmin:n[0],xmax:n[3],ymin:n[1],ymax:n[4],spatialReference:r})}function N(n,t,r=u()){return r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=t[0],r[4]=t[1],r[5]=t[2],r}function I(n,t){
|
|
2
|
+
import{len as n}from"../../core/libs/gl-matrix-2/math/vec3.js";import t from"../Extent.js";import{create as r}from"./aaBoundingRect.js";import{newDoubleArray as a}from"./DoubleArray.js";function i(n){return n}function u(n=en){return i([n[0],n[1],n[2],n[3],n[4],n[5]])}function e(n,t){for(let r=0;r<6;r++)n[r]=t[r];return n}function m(n,t,r,a,i,e,m=u()){return m[0]=n,m[1]=t,m[2]=r,m[3]=a,m[4]=i,m[5]=e,m}function o(n,t=u()){return t[0]=n.xmin,t[1]=n.ymin,t[2]=n.hasZ?n.zmin:-1/0,t[3]=n.xmax,t[4]=n.ymax,t[5]=n.hasZ?n.zmax:1/0,t}function f(n,t=u()){return c(n,0,n.length/3,t)}function c(n,t,r,a=u()){return L(a,un),g(a,n,t,r),a}function h(n){n[0]=1/0,n[1]=1/0,n[2]=1/0,n[3]=-1/0,n[4]=-1/0,n[5]=-1/0}function M(n,t){for(let r=0;r<6;r++)if(n[r]!==t[r])return!1;return!0}function x(n){return!(n[0]<=n[3]&&n[1]<=n[4]&&n[2]<=n[5])}function l(n,t=a(24)){const[r,i,u,e,m,o]=n;return t[0]=r,t[1]=i,t[2]=u,t[3]=r,t[4]=i,t[5]=o,t[6]=r,t[7]=m,t[8]=u,t[9]=r,t[10]=m,t[11]=o,t[12]=e,t[13]=i,t[14]=u,t[15]=e,t[16]=i,t[17]=o,t[18]=e,t[19]=m,t[20]=u,t[21]=e,t[22]=m,t[23]=o,t}function s(n,r){const a=isFinite(n[2])||isFinite(n[5]);return new t(a?{xmin:n[0],xmax:n[3],ymin:n[1],ymax:n[4],zmin:n[2],zmax:n[5],spatialReference:r}:{xmin:n[0],xmax:n[3],ymin:n[1],ymax:n[4],spatialReference:r})}function N(n,t,r=u()){return r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=t[0],r[4]=t[1],r[5]=t[2],r}function I(n,t,r=n){r[0]=Math.min(n[0],t[0]),r[1]=Math.min(n[1],t[1]),r[2]=Math.min(n[2],t[2]),r[3]=Math.max(n[3],t[3]),r[4]=Math.max(n[4],t[4]),r[5]=Math.max(n[5],t[5])}function b(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[3]=Math.max(n[3],t[2]),n[4]=Math.max(n[4],t[3])}function y(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.min(n[2],t[2]),n[3]=Math.max(n[3],t[0]),n[4]=Math.max(n[4],t[1]),n[5]=Math.max(n[5],t[2])}function g(n,t,r=0,a=t.length/3){let i=n[0],u=n[1],e=n[2],m=n[3],o=n[4],f=n[5];for(let c=0;c<a;c++)i=Math.min(i,t[r+3*c]),u=Math.min(u,t[r+3*c+1]),e=Math.min(e,t[r+3*c+2]),m=Math.max(m,t[r+3*c]),o=Math.max(o,t[r+3*c+1]),f=Math.max(f,t[r+3*c+2]);n[0]=i,n[1]=u,n[2]=e,n[3]=m,n[4]=o,n[5]=f}function T(n,t,r,a){n[0]=Math.min(n[0],n[0]+t),n[3]=Math.max(n[3],n[3]+t),n[1]=Math.min(n[1],n[1]+r),n[4]=Math.max(n[4],n[4]+r),n[2]=Math.min(n[2],n[2]+a),n[5]=Math.max(n[5],n[5]+a)}function p(n,{xmin:t,ymin:r,zmin:a,xmax:i,ymax:u,zmax:e}){n[0]=Math.min(n[0],t),n[3]=Math.max(n[3],i),n[1]=Math.min(n[1],r),n[4]=Math.max(n[4],u),n[2]=Math.min(n[2],a??-1/0),n[5]=Math.max(n[5],e??1/0)}function E(n,t,r){const a=t.length;let i=n[0],u=n[1],e=n[2],m=n[3],o=n[4],f=n[5];if(r)for(let c=0;c<a;c++){const n=t[c];i=Math.min(i,n[0]),u=Math.min(u,n[1]),e=Math.min(e,n[2]),m=Math.max(m,n[0]),o=Math.max(o,n[1]),f=Math.max(f,n[2])}else for(let c=0;c<a;c++){const n=t[c];i=Math.min(i,n[0]),u=Math.min(u,n[1]),m=Math.max(m,n[0]),o=Math.max(o,n[1])}n[0]=i,n[1]=u,n[2]=e,n[3]=m,n[4]=o,n[5]=f}function F(n){for(let t=0;t<6;t++)if(!isFinite(n[t]))return!1;return!0}function z(n){return n[0]>=n[3]?0:n[3]-n[0]}function j(n){return n[1]>=n[4]?0:n[4]-n[1]}function V(n){return n[2]>=n[5]?0:n[5]-n[2]}function Y(n){const t=z(n),r=V(n),a=j(n);return Math.sqrt(t*t+r*r+a*a)}function _(n,t=[0,0,0]){return t[0]=n[0]+z(n)/2,t[1]=n[1]+j(n)/2,t[2]=n[2]+V(n)/2,t}function d(n,t=[0,0,0]){return t[0]=z(n),t[1]=j(n),t[2]=V(n),t}function A(n){return Math.max(z(n),V(n),j(n))}function R(n,t){return t[0]>=n[0]&&t[1]>=n[1]&&t[2]>=n[2]&&t[0]<=n[3]&&t[1]<=n[4]&&t[2]<=n[5]}function G(n,t,r){return t[0]>=n[0]-r&&t[1]>=n[1]-r&&t[2]>=n[2]-r&&t[0]<=n[3]+r&&t[1]<=n[4]+r&&t[2]<=n[5]+r}function O(n,t){return t[0]>=n[0]&&t[1]>=n[1]&&t[2]>=n[2]&&t[3]<=n[3]&&t[4]<=n[4]&&t[5]<=n[5]}function P(n,t){const{center:r,radius:a}=t;let i=0;for(let u=0;u<3;u++)i+=Math.max(Math.abs(n[u]-r[u]),Math.abs(n[u+3]-r[u]))**2;return i<=a**2}function S(n,t){return Math.max(t[0],n[0])<=Math.min(t[3],n[3])&&Math.max(t[1],n[1])<=Math.min(t[4],n[4])&&Math.max(t[2],n[2])<=Math.min(t[5],n[5])}function Z(n,t){return null==t||S(n,t)}function k(n,t,r){let a=0,i=1;for(let u=0;u<3;++u){const e=n[u],m=n[u+3],o=t[u],f=r[u],c=f<o,h=c?f:o,M=c?o:f,x=Math.max(e,h),l=Math.min(m,M);if(x>l)return!1;if(M===h)break;const s=M-h,N=(x-h)/s,I=(l-h)/s;if(a=Math.max(a,c?1-I:N),i=Math.min(i,c?1-N:I),a>i)return!1}return!0}function q(n,t){const{center:r,radius:a}=t;let i=0;for(let u=0;u<3;u++){const t=Math.max(0,n[u]-r[u],r[u]-n[u+3]);if(t>a)return!1;i+=t**2}return i<=a**2}function v(t,r,a,i){const u=1e-8;let{tMin:e,tMax:m}=i;if(!(e<m))return null;if(!(Math.abs(n(a)-1)<1e-4))return null;for(let n=0;n<3;n++){const i=a[n],o=r[n],f=t[n],c=t[n+3];if(!(f<c))return null;if(Math.abs(i)<u){if(o<f||o>c)return null;continue}const h=1/i,M=(f-o)*h,x=(c-o)*h,l=h<0?x:M,s=h<0?M:x;if(e=Math.max(e,l),m=Math.min(m,s),m<=e)return null}return{tMin:e,tMax:m}}function w(n,t){const r=t[3];let a=r,i=r;for(let u=0;u<3;u++){const r=t[u],e=r*n[u],m=r*n[u+3];a+=Math.min(e,m),i+=Math.max(e,m)}return a>0?a:i<0?i:0}function B(n,t,r,a,i=n){return i[0]=n[0]+t,i[1]=n[1]+r,i[2]=n[2]+a,i[3]=n[3]+t,i[4]=n[4]+r,i[5]=n[5]+a,i}function D(n,t,r=n){const a=n[0]+z(n)/2,i=n[1]+j(n)/2,u=n[2]+V(n)/2;return r[0]=a+(n[0]-a)*t,r[1]=i+(n[1]-i)*t,r[2]=u+(n[2]-u)*t,r[3]=a+(n[3]-a)*t,r[4]=i+(n[4]-i)*t,r[5]=u+(n[5]-u)*t,r}function C(n,t){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function H(n,t){return t[0]=n[3],t[1]=n[4],t[2]=n[5],t}function J(n,t,r=n){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r!==n&&(r[3]=n[3],r[4]=n[4],r[5]=n[5]),r}function K(n,t,r=n){return r[3]=t[0],r[4]=t[1],r[5]=t[2],r!==n&&(r[0]=n[0],r[1]=n[1],r[2]=n[2]),n}function L(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n}function Q(n){return n?L(n,un):u(un)}function U(n,t=r()){return t[0]=n[0],t[1]=n[1],t[2]=n[3],t[3]=n[4],t}function W(n,t){return n[0]=t[0],n[1]=t[1],n[2]=Number.NEGATIVE_INFINITY,n[3]=t[2],n[4]=t[3],n[5]=Number.POSITIVE_INFINITY,n}function X(n,t,r,a,i){return n[0]=t,n[1]=r,n[2]=Number.NEGATIVE_INFINITY,n[3]=a,n[4]=i,n[5]=Number.POSITIVE_INFINITY,n}function $(n){return 6===n.length}function nn(n){return 0===z(n)&&0===j(n)&&0===V(n)}function tn(n,t,r){if(null==n||null==t)return n===t;if(!$(n)||!$(t))return!1;if(r){for(let a=0;a<n.length;a++)if(!r(n[a],t[a]))return!1}else for(let a=0;a<n.length;a++)if(n[a]!==t[a])return!1;return!0}function rn(n,t,r,a,i,u){return m(n,t,r,a,i,u,on)}const an=i([-1/0,-1/0,-1/0,1/0,1/0,1/0]),un=i([1/0,1/0,1/0,-1/0,-1/0,-1/0]),en=i([0,0,0,0,0,0]),mn=i([NaN,NaN,NaN,NaN,NaN,NaN]),on=u();export{F as allFinite,_ as center,P as containedBySphere,O as contains,R as containsPoint,G as containsPointWithMargin,e as copy,u as create,j as depth,Y as diameter,Q as empty,tn as equals,M as exactEquals,I as expandWithAABB,g as expandWithBuffer,p as expandWithExtent,E as expandWithNestedArray,T as expandWithOffset,b as expandWithRect,y as expandWithVec3,f as fromBuffer,o as fromExtent,N as fromMinMax,W as fromRect,X as fromRectValues,c as fromSubBuffer,m as fromValues,H as getMax,C as getMin,V as height,S as intersects,Z as intersectsClippingArea,v as intersectsRay,k as intersectsSegment,q as intersectsSphere,$ as is,x as isEmpty,nn as isPoint,A as maximumDimension,mn as nan,un as negativeInfinity,B as offset,an as positiveInfinity,D as scale,L as set,h as setEmpty,K as setMax,J as setMin,w as signedDistanceFromPlane,d as size,l as toCorners,s as toExtent,U as toRect,z as width,rn as wrap,en as zero};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{ObjectStack as
|
|
2
|
+
import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as n}from"../../core/libs/gl-matrix-2/math/mat4.js";import{set as o}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as c}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as i}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as f,fromLineSegmentAndDirection as u,create as a}from"./clipRay.js";import{create as s,fromPoints as m,signedDistance as l,clip as p,clipInfinite as b,copy as g}from"./plane.js";import{sm4d as h,sv4d as j}from"./vectorStacks.js";function x(t){return t?[s(t[0]),s(t[1]),s(t[2]),s(t[3]),s(t[4]),s(t[5])]:[s(),s(),s(),s(),s(),s()]}function M(){return[e(),e(),e(),e(),e(),e(),e(),e()]}function v(t,r){for(let n=0;n<H;n++)g(t[n],r[n]);return t}function k(t,e,i,f=L){const u=r(h.get(),e,t);n(u,u);for(let r=0;r<I;++r){const t=c(j.get(),J[r],u);o(f[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}y(i,f)}function y(t,r){m(r[4],r[0],r[3],t[0]),m(r[1],r[5],r[6],t[1]),m(r[4],r[5],r[1],t[2]),m(r[3],r[2],r[6],t[3]),m(r[0],r[1],r[2],t[4]),m(r[5],r[4],r[7],t[5])}function S(t,r){return d(t,r.center,r.radius)}function d(t,r,n){for(let o=0;o<H;o++){const e=t[o];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=n)return!1}return!0}function w(t,r,n){return O(t,r[0],r[1],r[2],n[0],n[1],n[2])}function O(t,r,n,o,e,c,i){const f=(r+e)/2,u=(n+c)/2,a=(o+i)/2,s=(e-r)/2,m=(c-n)/2,l=(i-o)/2;for(let p=0;p<H;p++){const r=t[p];if(r[0]*f+r[1]*u+r[2]*a+r[3]-(Math.abs(r[0])*s+Math.abs(r[1])*m+Math.abs(r[2])*l)>0)return!1}return!0}function R(t,r,n){return n?z(t,r[0],r[1],r[2],r[3],r[4],r[5],n):O(t,r[0],r[1],r[2],r[3],r[4],r[5])}function q(t,r,n,o){return o?z(t,r[0],r[1],r[2],n[0],n[1],n[2],o):O(t,r[0],r[1],r[2],n[0],n[1],n[2])}function z(t,r,n,o,e,c,i,f){return F(t,(r+e)/2,(n+c)/2,(o+i)/2,(e-r)/2,(c-n)/2,(i-o)/2,f)}function A(t,r){return E(t,f(r,K.get()))}function B(t,r){for(let n=0;n<H;n++){const o=t[n];if(!b(o,r))return!1}return!0}function C(t,r,n){return E(t,u(r,n,K.get()))}function D(t,r){for(let n=0;n<H;n++){if(l(t[n],r)>0)return!1}return!0}function E(t,r){for(let n=0;n<H;n++)if(!p(t[n],r))return!1;return!0}function F(t,r,n,o,e,c,i,f){const u=f[0]*r+f[4]*n+f[8]*o+f[12],a=f[1]*r+f[5]*n+f[9]*o+f[13],s=f[2]*r+f[6]*n+f[10]*o+f[14];for(let m=0;m<H;m++){const r=t[m];if(r[0]*u+r[1]*a+r[2]*s+r[3]-(Math.abs(r[0]*f[0]+r[1]*f[1]+r[2]*f[2])*e+Math.abs(r[0]*f[4]+r[1]*f[5]+r[2]*f[6])*c+Math.abs(r[0]*f[8]+r[1]*f[9]+r[2]*f[10])*i)>0)return!1}return!0}const G={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},H=6,I=8,J=[i(-1,-1,-1,1),i(1,-1,-1,1),i(1,1,-1,1),i(-1,1,-1,1),i(-1,-1,1,1),i(1,-1,1,1),i(1,1,1,1),i(-1,1,1,1)],K=new t(a),L=M();export{y as computePlanes,v as copy,x as create,M as createPoints,k as fromMatrix,B as intersectClipRay,w as intersectsAabbFromMinMax,C as intersectsLineSegment,D as intersectsPoint,A as intersectsRay,S as intersectsSphere,d as intersectsSphereCenterRadius,R as intersectsTransformedAabb,q as intersectsTransformedAabbFromMinMax,H as numPlanes,I as numPoints,G as planePointIndices};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.45",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as i,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{distance as h}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{InternalRenderCategory as c}from"../views/3d/webgl.js";import{VoxelGraphic as m}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as f}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as p}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as g}from"../views/3d/support/RenderCoordsHelper.js";import y from"../views/3d/webgl/RenderNode.js";import{IntersectorResult as x}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let v=class extends y{constructor(e){super(e),this._havePreparedWithAllLayers=!1,this.consumes={required:[c.VOXEL]},this.produces="disabled",this._vxlPromise=null,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([i(()=>"local"===this.view.viewingMode,e=>{e?(this._dbg(1,"view switched to local view, enabling rendering"),this.produces=c.VOXEL,this.view.sceneIntersectionHelper.addIntersectionHandler(this)):(this._dbg(1,"view switched to global view, disabling rendering"),this.view.sceneIntersectionHelper.removeIntersectionHandler(this),this.produces="disabled")},a),i(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl?.set_quality(this._toWasmQuality(e))},a),i(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this.requestRender(1)}},a),i(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this.requestRender(1)})])}get _rctx(){return this.renderContext?.rctx}get _halfIntTexturesAvailable(){return!!this._rctx?.capabilities.textureNorm16}get _textureFloatLinearAvailable(){return!!this._rctx?.capabilities.textureFloatLinear}_restoreFramebuffer(){if(!this._renderTargetToRestore||!this._rctx)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){if(!this._rctx||!this._renderTargetToRestore)return 0;const s=this._renderTargetToRestore.fbo?.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl?.estimate_memory_usage(t)??0;s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._vxl&&this._layers.forEach((e,s)=>{const i=[];e.responses.forEach((t,r)=>{i.push(r),this._dbg(2,"responding for requestID:"+r+" size:"+t.size),this._vxl?.respond(s,r,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of i)a.delete(t);const n=this._vxl.get_new_requests(s),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[l],i={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+l+" url:"+s.url),t(s.url,i).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+l);let r=0;if(t.data.byteLength>0&&this._vxl){r=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,t.data.byteLength),s=new Uint8Array(t.data);for(let r=0;r<t.data.byteLength;++r)e[r]=s[r]}a.set(+l,{responseType:s.responseType,ptr:r,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(4,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl?.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl?.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl?.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._vxl?(this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t):t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl?.get_layer_current_time_id(r)??0)}),t}setEnabled(e,t){this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this.requestRender(1))})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl?.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this.requestRender(1))}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:131072,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let r=0;s.timeOffset&&(r=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const i=this._getTimeArgs(s.timeExtent);this._vxl?.set_layer_time_properties(e.wasmLayerId,i.startTime,i.endTime,i.hasTime,s.useViewTime,r),this.requestRender(1)}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl?.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl?._free(e.ptr))}}),r&&s&&this.requestRender(1),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[0],o=this._frustum.points[1],l=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,f=0;const p=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(r,m,l,o,n),f=this._addNormalToWasmBuffer(a,f,p),m=this._addTriangleToWasmBuffer(r,m,n,h,l),f=this._addNormalToWasmBuffer(a,f,p);const g=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(r,m,d,u,_),f=this._addNormalToWasmBuffer(a,f,g),m=this._addTriangleToWasmBuffer(r,m,_,c,d),f=this._addNormalToWasmBuffer(a,f,g);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(r,m,_,l,h),f=this._addNormalToWasmBuffer(a,f,y),m=this._addTriangleToWasmBuffer(r,m,h,c,_),f=this._addNormalToWasmBuffer(a,f,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(r,m,n,o,u),f=this._addNormalToWasmBuffer(a,f,x),m=this._addTriangleToWasmBuffer(r,m,u,d,n),f=this._addNormalToWasmBuffer(a,f,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(r,m,h,n,d),f=this._addNormalToWasmBuffer(a,f,v),m=this._addTriangleToWasmBuffer(r,m,d,c,h),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(r,m,l,_,u),f=this._addNormalToWasmBuffer(a,f,b),this._addTriangleToWasmBuffer(r,m,u,o,l),this._addNormalToWasmBuffer(a,f,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this.requestRender(1)}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=g.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new p(this._renderCoordsHelper)),this._captureFrustum=!0,this.requestRender(1)}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.toggle_full_volume_extent_draw(s),this.requestRender(1))})}dropQueryRenderTarget(){this._vxl?.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e,this._vxl);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}let t=-1;this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl?.remove_layer(t);const i=this.layerViewUid.indexOf(e.uid);-1!==i&&this.layerViewUid.splice(i,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){if(!this._vxl)return!1;e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:r}}_addVoxelLayer(e,t){const r=e.layer;let i=-1;const a=r.getConfiguration();if(a.length<1)return-1;const o={str:a,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(o))return-1;const l=this._getTimeArgs(r.timeExtent),h=this.view.spatialReference.isWGS84&&r.spatialReference.isWGS84?111319.49079327357:1;let d=0;if(r.timeOffset&&(d=n(r.timeOffset.value,r.timeOffset.unit,"seconds")),i=t.add_layer(r.serviceRoot,o.ptr,o.byteCount,h,h,l.startTime,l.endTime,l.hasTime,r.useViewTime,d,this._toWasmQuality(this.view.qualityProfile)),o.isReusable||t._free(o.ptr),i>=0){r.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const t=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}_prepareRender(){if(!this._vxl)return void this._initializeWasm();const e=this.bindParameters.camera.viewForward,t=this.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(t[0],t[1],t[2],e[0],e[1],e[2]);const s=this._vxl.cull();this._dbg(2,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(){this._prepareRender();const e=this.bindRenderTarget();if(!this._vxl||!this._rctx)return this.requestRender(1),e;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView,this._vxl);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return this._dbg(4,"No voxel layers but RenderNode is being asked to render!"),e;this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(this._rctx),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(1),this.bindParameters.lighting.mainLight.direction[0],this.bindParameters.lighting.mainLight.direction[1],this.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;return t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>e.needMemoryUsageUpdate=!0)),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(this.bindParameters.camera),this._captureFrustum&&(this._frustum.update(this.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(this._rctx,this._vxl),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this.requestRender(1),e}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl?._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(){if(this._vxl||this._vxlPromise||!this._rctx?.gl)return;const e=this._rctx.gl;this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderNode and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),o=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),l=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,a,n,o,l,h,d,s.startTime,s.endTime,s.hasTime,u,_),this.requestRender(1)}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, destroying render node"),this.destroy()})}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw(this._rctx);const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(this._rctx,this._vxl),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw(this._rctx);const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(this._rctx,this._vxl),l}async getOtherFieldPopupValues(e,s){if(!this._vxl)return[];for(const r of e){const e=r.gpuResult;if(!e)continue;const i=this._layers.get(e.layerId);if(!i||!i.layerView.layer.url)continue;const a=i.layerView.layer,n={responseType:"array-buffer",signal:i.abortController.signal,query:{...i.layerView.layer.customParameters,token:i.layerView.layer.apiKey}},o=e.voxelSpacePosition,l=[Math.floor(o[0]/32),Math.floor(o[1]/32),Math.floor(o[2]/32)],h=[-4&l[0],-4&l[1],-4&l[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(i.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const r of s){const e=a.variables.findIndex(e=>e.name===r);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const i=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(i,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const f=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(f.continuousValues)for(const t in f.continuousValues)r.attributes[t]=f.continuousValues[t];if(f.uniqueValues)for(const t in f.uniqueValues)r.attributes[t]=f.uniqueValues[t]}return e}_beforeDraw(e){this._renderTargetToRestore={fbo:e.boundFramebuffer,viewport:e.getViewport()},e.setPolygonOffsetFillEnabled(!1),e.setScissorTestEnabled(!1),e.setColorMask(!0,!0,!0,!0)}_afterDraw(e,t){this._renderTargetToRestore.fbo=null,e.externalTextureUnitUpdate(t.get_texture_units_bound_in_frame(),t.get_active_texture_unit()),e.externalVertexArrayObjectUpdate(),e.externalVertexBufferUpdate(),e.externalProgramUpdate()}intersectRay(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(4,i?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={},u=o.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?l[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l[e.name]=`${n.uniqueValue}`),e.description.length>0?l["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(l["Voxel.CurrentVariable"]=e.name))}if(l["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.LocalTime"]=e,l["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(l["Voxel.Depth"]=n.depth);const c=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const m=e=>{const s=new f(a,t,()=>this._createVoxelGraphic(o.layerView.layer,l,n));e.set(this.type,s,i,c)},p=e.results,g=2===e.options.store;if((null==p.min.distance||i<p.min.distance)&&m(p.min),(null==p.max.distance||i>p.max.distance)&&m(p.max),g){const t=new x(e.ray);m(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new m({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o()],v.prototype,"consumes",void 0),e([o()],v.prototype,"produces",void 0),v=e([l("esri.layers.VoxelWasmPerSceneView")],v);const b=v;export{b as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as r}from"../core/promiseUtils.js";import{watch as i,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as o,subclass as l}from"../core/accessorSupport/decorators.js";import{distance as h}from"../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{InternalRenderCategory as c}from"../views/3d/webgl.js";import{VoxelGraphic as m}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as f}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as p}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as g}from"../views/3d/support/RenderCoordsHelper.js";import y from"../views/3d/webgl/RenderNode.js";import{IntersectorResultRay as x}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let v=class extends y{constructor(e){super(e),this._havePreparedWithAllLayers=!1,this.consumes={required:[c.VOXEL]},this.produces="disabled",this._vxlPromise=null,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([i(()=>"local"===this.view.viewingMode,e=>{e?(this._dbg(1,"view switched to local view, enabling rendering"),this.produces=c.VOXEL,this.view.sceneIntersectionHelper.addIntersectionHandler(this)):(this._dbg(1,"view switched to global view, disabling rendering"),this.view.sceneIntersectionHelper.removeIntersectionHandler(this),this.produces="disabled")},a),i(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl?.set_quality(this._toWasmQuality(e))},a),i(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this.requestRender(1)}},a),i(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this.requestRender(1)})])}get _rctx(){return this.renderContext?.rctx}get _halfIntTexturesAvailable(){return!!this._rctx?.capabilities.textureNorm16}get _textureFloatLinearAvailable(){return!!this._rctx?.capabilities.textureFloatLinear}_restoreFramebuffer(){if(!this._renderTargetToRestore||!this._rctx)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){if(!this._rctx||!this._renderTargetToRestore)return 0;const s=this._renderTargetToRestore.fbo?.depthStencilTexture;return s?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(s,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const r=e;1===s?this._rctx.instanceCounter.increment(r,t):this._rctx.instanceCounter.decrement(r,t)}_setBlendState(e,t,s,r){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(r)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,r){this._rctx?this._rctx.setViewport(e,t,s,r):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl?.estimate_memory_usage(t)??0;s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._vxl&&this._layers.forEach((e,s)=>{const i=[];e.responses.forEach((t,r)=>{i.push(r),this._dbg(2,"responding for requestID:"+r+" size:"+t.size),this._vxl?.respond(s,r,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of i)a.delete(t);const n=this._vxl.get_new_requests(s),o=e.abortController.signal;for(const l in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[l],i={responseType:"array-buffer",signal:o,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+l+" url:"+s.url),t(s.url,i).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+l);let r=0;if(t.data.byteLength>0&&this._vxl){r=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,r,t.data.byteLength),s=new Uint8Array(t.data);for(let r=0;r<t.data.byteLength;++r)e[r]=s[r]}a.set(+l,{responseType:s.responseType,ptr:r,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),r(t)||(this._dbg(4,`requestID:${l} failed, error=${t.toString()}`),a.set(+l,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl?.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl?.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl?.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._vxl?(this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(r,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t):t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl?.get_layer_current_time_id(r)??0)}),t}setEnabled(e,t){this._layers.forEach((s,r)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.set_enabled(r,t),s.needMemoryUsageUpdate=!0,this.requestRender(1))})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl?.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this.requestRender(1))}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,r){const i={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:r}};return this._doMaskedUIUpdate(e,i,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,r){const i={mask:131072,analysisSlice:{point:s,normal:r,enabled:t}};return this._doMaskedUIUpdate(e,i,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let r=0;s.timeOffset&&(r=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const i=this._getTimeArgs(s.timeExtent);this._vxl?.set_layer_time_properties(e.wasmLayerId,i.startTime,i.endTime,i.hasTime,s.useViewTime,r),this.requestRender(1)}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let r=!1;return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(r=1===this._vxl?.handle_masked_ui_update(i,e.ptr,e.byteCount),e.isReusable||this._vxl?._free(e.ptr))}}),r&&s&&this.requestRender(1),r}_addTriangleToWasmBuffer(e,t,s,r,i){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),r=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),i=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,i,e),n=this._frustum.points[0],o=this._frustum.points[1],l=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,f=0;const p=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(r,m,l,o,n),f=this._addNormalToWasmBuffer(a,f,p),m=this._addTriangleToWasmBuffer(r,m,n,h,l),f=this._addNormalToWasmBuffer(a,f,p);const g=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(r,m,d,u,_),f=this._addNormalToWasmBuffer(a,f,g),m=this._addTriangleToWasmBuffer(r,m,_,c,d),f=this._addNormalToWasmBuffer(a,f,g);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(r,m,_,l,h),f=this._addNormalToWasmBuffer(a,f,y),m=this._addTriangleToWasmBuffer(r,m,h,c,_),f=this._addNormalToWasmBuffer(a,f,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(r,m,n,o,u),f=this._addNormalToWasmBuffer(a,f,x),m=this._addTriangleToWasmBuffer(r,m,u,d,n),f=this._addNormalToWasmBuffer(a,f,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(r,m,h,n,d),f=this._addNormalToWasmBuffer(a,f,v),m=this._addTriangleToWasmBuffer(r,m,d,c,h),f=this._addNormalToWasmBuffer(a,f,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(r,m,l,_,u),f=this._addNormalToWasmBuffer(a,f,b),this._addTriangleToWasmBuffer(r,m,u,o,l),this._addNormalToWasmBuffer(a,f,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,i,e,255,0,0,64),this._vxl._free(s),this._vxl._free(i),this._captureFrustum=!1,this.requestRender(1)}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=g.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new p(this._renderCoordsHelper)),this._captureFrustum=!0,this.requestRender(1)}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl?.toggle_full_volume_extent_draw(s),this.requestRender(1))})}dropQueryRenderTarget(){this._vxl?.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e,this._vxl);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}let t=-1;this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=r,s.abortController.abort(),this._vxl?.remove_layer(t);const i=this.layerViewUid.indexOf(e.uid);-1!==i&&this.layerViewUid.splice(i,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1,"No voxel layers left after removing a layer, destroying render node"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){if(!this._vxl)return!1;e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,r=!1;return null!=e&&(e.isAllTime?r=!0:(null!=e.start&&(r=!0,t=e.start.getTime()/1e3),null!=e.end&&(r=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:r}}_addVoxelLayer(e,t){const r=e.layer;let i=-1;const a=r.getConfiguration();if(a.length<1)return-1;const o={str:a,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(o))return-1;const l=this._getTimeArgs(r.timeExtent),h=this.view.spatialReference.isWGS84&&r.spatialReference.isWGS84?111319.49079327357:1;let d=0;if(r.timeOffset&&(d=n(r.timeOffset.value,r.timeOffset.unit,"seconds")),i=t.add_layer(r.serviceRoot,o.ptr,o.byteCount,h,h,l.startTime,l.endTime,l.hasTime,r.useViewTime,d,this._toWasmQuality(this.view.qualityProfile)),o.isReusable||t._free(o.ptr),i>=0){r.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const t=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:t,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let r="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let r="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(r=s.name));""!==r&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${r}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}_prepareRender(){if(!this._vxl)return void this._initializeWasm();const e=this.bindParameters.camera.viewForward,t=this.bindParameters.camera.eye;this._vxl.update_camera_pos_and_direction(t[0],t[1],t[2],e[0],e[1],e[2]);const s=this._vxl.cull();this._dbg(2,"missingResourceCount="+s),this._moreToLoad=s>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}render(){this._prepareRender();const e=this.bindRenderTarget();if(!this._vxl||!this._rctx)return this.requestRender(1),e;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView,this._vxl);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return this._dbg(4,"No voxel layers but RenderNode is being asked to render!"),e;this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(this._rctx),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(1),this.bindParameters.lighting.mainLight.direction[0],this.bindParameters.lighting.mainLight.direction[1],this.bindParameters.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;return t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>e.needMemoryUsageUpdate=!0)),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(this.bindParameters.camera),this._captureFrustum&&(this._frustum.update(this.bindParameters.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(this._rctx,this._vxl),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this.requestRender(1),e}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl?._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._vxl=null)}_initializeWasm(){if(this._vxl||this._vxlPromise||!this._rctx?.gl)return;const e=this._rctx.gl;this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderNode and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),r=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),i=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),o=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),l=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(r,i,a,n,o,l,h,d,s.startTime,s.endTime,s.hasTime,u,_),this.requestRender(1)}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, destroying render node"),this.destroy()})}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${r.toFixed(0)}]]`),null;this._beforeDraw(this._rctx);const i=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],i[0],i[1],i[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,r);if(this._afterDraw(this._rctx,this._vxl),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,r){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=Math.round(e),a=Math.round(t);if(i<0||i>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${i}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw(this._rctx);const n=s.viewForward,o=s.eye;this._vxl.update_camera_pos_and_direction(o[0],o[1],o[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let l=null;if(0===r.length)l=this._vxl.pick_object(i,a,0,0);else{const e={str:JSON.stringify({layerIds:r}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(l=this._vxl.pick_object(i,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(this._rctx,this._vxl),l}async getOtherFieldPopupValues(e,s){if(!this._vxl)return[];for(const r of e){const e=r.gpuResult;if(!e)continue;const i=this._layers.get(e.layerId);if(!i||!i.layerView.layer.url)continue;const a=i.layerView.layer,n={responseType:"array-buffer",signal:i.abortController.signal,query:{...i.layerView.layer.customParameters,token:i.layerView.layer.apiKey}},o=e.voxelSpacePosition,l=[Math.floor(o[0]/32),Math.floor(o[1]/32),Math.floor(o[2]/32)],h=[-4&l[0],-4&l[1],-4&l[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(i.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const r of s){const e=a.variables.findIndex(e=>e.name===r);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const i=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(i,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const f=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(f.continuousValues)for(const t in f.continuousValues)r.attributes[t]=f.continuousValues[t];if(f.uniqueValues)for(const t in f.uniqueValues)r.attributes[t]=f.uniqueValues[t]}return e}_beforeDraw(e){this._renderTargetToRestore={fbo:e.boundFramebuffer,viewport:e.getViewport()},e.setPolygonOffsetFillEnabled(!1),e.setScissorTestEnabled(!1),e.setColorMask(!0,!0,!0,!0)}_afterDraw(e,t){this._renderTargetToRestore.fbo=null,e.externalTextureUnitUpdate(t.get_texture_units_bound_in_frame(),t.get_active_texture_unit()),e.externalVertexArrayObjectUpdate(),e.externalVertexBufferUpdate(),e.externalProgramUpdate()}intersectRay(e,t,s,r,i){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==i||i[0]<0||i[0]>e.camera.viewport[2]||i[1]<0||i[1]>e.camera.viewport[3])return this._dbg(4,i?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${i[0].toFixed(0)}, ${i[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(i[0],i[1],e.camera,a);if(null==n||-1===n.layerId)return;const o=this._layers.get(n.layerId);if(o){const t=o.layerView.layer.uid,i=n.distanceToCamera/h(s,r),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const l={},u=o.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?l[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?l[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(l[e.name]=`${n.uniqueValue}`),e.description.length>0?l["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(l["Voxel.CurrentVariable"]=e.name))}if(l["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);l["Voxel.LocalTime"]=e,l["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(l["Voxel.Depth"]=n.depth);const c=n.faceNormal;l["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const m=e=>{const s=new f(a,t,()=>this._createVoxelGraphic(o.layerView.layer,l,n));e.set(this.type,s,i,c)},p=e.results,g=2===e.options.store;if((null==p.min.distance||i<p.min.distance)&&m(p.min),(null==p.max.distance||i>p.max.distance)&&m(p.max),g){const t=new x(e.ray);m(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new m({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}};e([o()],v.prototype,"consumes",void 0),e([o()],v.prototype,"produces",void 0),v=e([l("esri.layers.VoxelWasmPerSceneView")],v);const b=v;export{b as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.45",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://js.arcgis.com",
|
|
6
6
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.19.1",
|
|
23
|
-
"@arcgis/toolkit": "^5.2.0-next.
|
|
23
|
+
"@arcgis/toolkit": "^5.2.0-next.40",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
25
25
|
"@esri/calcite-components": "^5.1.1",
|
|
26
26
|
"@vaadin/grid": "~25.2.1",
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const d="20260711",c="87d4519097fd00d095782a10b09045ec701049f4";export{d as buildDate,c as commitHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import
|
|
2
|
+
import"../../../../core/has.js";import{destroyMaybe as e}from"../../../../core/maybe.js";import{RenderingDevice as t}from"./RenderingDevice.js";import s from"./TextureManager.js";import{TextureUploadManager as i}from"./TextureUploadManager.js";import{BlendEffect as r}from"./effects/BlendEffect.js";import{FeatureEffect as n}from"./effects/FeatureEffect.js";import o from"./effects/HighlightEffect.js";import{HittestEffect as h}from"./effects/HittestEffect.js";import{EffectManager as f}from"./effects/post-processing/EffectManager.js";import{SimpleMesh as a}from"./meshing/SimpleMesh.js";import{BitBlitTechnique as l}from"./shaderGraph/techniques/utility/BitBlitTechnique.js";import{WorldExtentClipTechnique as c}from"./shaderGraph/techniques/utility/WorldExtentClipTechnique.js";import{SizedDepthStencilFormat as d}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as p}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as b}from"../../../webgl/RenderbufferDescriptor.js";import{TextureDescriptor as g}from"../../../webgl/TextureDescriptor.js";class _{constructor(e,d){this.context=e,this._blitTechnique=new l,this._worldExtentClipTechnique=new c,this._lastWidth=null,this._lastHeight=null,this._blendEffect=new r,this._stencilBuf=null,this._prevBeforeLayerFBOStack=[],this._fboPool=[],this.effects={highlight:new o,hittest:new h,insideEffect:new n("inside"),outsideEffect:new n("outside")},this.textureManager=new s(d),this.textureUploadManager=new i(d),this._effectsManager=new f,this._quadMesh=a.fromVertexStream(e,[0,0,1,0,0,1,1,1]),this._renderingDevice=new t}dispose(){if(this.textureManager.dispose(),this.textureUploadManager.destroy(),this._blitTechnique.shutdown(),this._worldExtentClipTechnique.shutdown(),this._quadMesh=e(this._quadMesh),this._fbos){let e;for(e in this._fbos)this._fbos[e]&&this._fbos[e].dispose()}for(const e of this._fboPool)e.dispose();if(this._fboPool.length=0,this.effects){let e;for(e in this.effects)this.effects[e]&&this.effects[e].dispose()}this._effectsManager.dispose(),this._blendEffect.dispose(this.context),this._renderingDevice.dispose()}get quadMesh(){return this._quadMesh}getFbos(){if(!this._fbos)throw new Error("InternalError: Painter FBOs not initialized");return this._fbos}acquireFbo(e,t){let s;if(this._fboPool.length>0)s=this._fboPool.pop();else{const i=new g(e,t);i.samplingMode=9728,i.wrapMode=33071,s=new u(this.context,i,this._stencilBuf)}return s.width===e&&s.height===t||s.resize(e,t),s}releaseFbo(e){this._fboPool.push(e)}getSharedStencilBuffer(){return this._stencilBuf}beforeRenderPhases(e,t,s){const{context:i}=e;this._worldExtentClipTechnique.render(e,{backgroundColor:t,padding:s});const{width:r,height:n}=i.getViewport();if(this.updateFBOs(r,n),this._prevFBO=i.boundFramebuffer,i.bindFramebuffer(this.getFbos().output),i.setColorMask(!0,!0,!0,!0),null!=t){const{r:e,g:s,b:r,a:n}=t;i.setClearColor(n*e/255,n*s/255,n*r/255,n)}else i.setClearColor(0,0,0,0);i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}afterRenderPhases(e){const{context:t}=e;t.bindFramebuffer(this._prevFBO),this._blitTechnique.render(e,{texture:this.getFbos().output.colorTexture,samplingMode:9728,opacity:1,clipToVisibleRegion:!0}),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}beforeRenderLayer(e,t,s){const{context:i,blendMode:r,effects:n,drawPhase:o,requireFBO:h}=e;if(i.setClearColor(0,0,0,0),h||m(o,r,n,s)){const e=i.boundFramebuffer;this._prevBeforeLayerFBOStack.push(e);const{width:t,height:s}=i.getViewport(),r=this.acquireFbo(t,s);i.bindFramebuffer(r),i.setColorMask(!0,!0,!0,!0),i.setClearColor(0,0,0,0),i.setDepthWriteEnabled(!0),i.setClearDepth(1),i.clear(16640),i.setDepthWriteEnabled(!1)}i.setDepthWriteEnabled(!1),i.setDepthTestEnabled(!1),i.setStencilTestEnabled(!0),i.setClearStencil(t),i.setStencilWriteMask(255),i.clear(1024)}afterRenderLayer(e,t){const{context:s,blendMode:i,effects:r,requireFBO:n,drawPhase:o}=e;if(n||m(o,i,r,t)){const n=s.boundFramebuffer;if(null==n)return;null!=r&&r.length>0&&1===o&&(s.setColorMask(!0,!0,!0,!0),this._applyEffects(e,r,n)),s.bindFramebuffer(this._prevBeforeLayerFBOStack.pop()),s.setStencilTestEnabled(!1),s.setStencilWriteMask(0),s.setBlendingEnabled(!0),s.setBlendFunctionSeparate(1,771,1,771),s.setColorMask(!0,!0,!0,!0);const h=null==i||16===o||2===o||128===o?"normal":i;this._blendEffect.draw(e,n.colorTexture,9728,h,t),this.releaseFbo(n)}}blitTexture(e,t,s,i=1){this._blitTechnique.render(e,{texture:t,samplingMode:s,opacity:i}),this._renderingDevice.setPipelineStateNeedsUpdate(!0)}getPostProcessingEffects(e){return this._effectsManager.getPostProcessingEffects(e)}updateFBOs(e,t){if(e!==this._lastWidth||t!==this._lastHeight){if(this._lastWidth=e,this._lastHeight=t,this._fbos){let s;for(s in this._fbos)this._fbos[s].resize(e,t);return}const s=new g(e,t);s.samplingMode=9728,s.wrapMode=33071;const i=new b(d.DEPTH24_STENCIL8,e,t);this._stencilBuf=new p(this.context,i),this._fbos={output:new u(this.context,s,this._stencilBuf),effect0:new u(this.context,s,this._stencilBuf)}}}_applyEffects(e,t,s){const{context:i}=e,r=this._effectsManager.getPostProcessingEffects(t);for(const{postProcessingTechnique:n,effect:o}of r)i.bindFramebuffer(s),n.render(e,{layerFBO:s,effect:o});this._renderingDevice.setPipelineStateNeedsUpdate(!0)}setShader(e){return this._renderingDevice.setShader(e)}clearShaderCache(){this._renderingDevice.clearShaderCache()}getProgramCache(){return this._renderingDevice.getProgramCache()}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,s){return this._renderingDevice.submitDraw(e,t,s)}submitDrawMesh(e,t,s,i){this._renderingDevice.submitDrawMesh(e,t,s,i)}submitDrawMeshUntyped(e,t,s,i){this._renderingDevice.submitDrawMeshUntyped(e,t,s,i)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}}function m(e,t,s,i){return 4!==e&&2!==e&&16!==e&&128!==e&&(1!==i||null!=t&&"normal"!==t||null!=s&&s.length>0)}export{_ as default};
|
package/views/2d/webglDeps.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
export{BufferObject}from"../webgl/BufferObject.js";export{FramebufferObject}from"../webgl/FramebufferObject.js";export{DisposableProgram}from"../webgl/Program.js";export{ProgramCache}from"../webgl/ProgramCache.js";export{Renderbuffer}from"../webgl/Renderbuffer.js";export{
|
|
2
|
+
export{BufferObject}from"../webgl/BufferObject.js";export{FramebufferObject}from"../webgl/FramebufferObject.js";export{DisposableProgram}from"../webgl/Program.js";export{ProgramCache}from"../webgl/ProgramCache.js";export{Renderbuffer}from"../webgl/Renderbuffer.js";export{default as Texture}from"../webgl/Texture.js";export{VertexArrayObject}from"../webgl/VertexArrayObject.js";export{glslifyDefineMap}from"../webgl/programUtils.js";export{createProgram}from"../webgl/ProgramTemplate.js";
|