@arcgis/core 5.1.0-next.37 → 5.1.0-next.38
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/libs/libtess/libtess-f32.wasm +0 -0
- package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0dd12d6af0cf7707109c.js +2 -0
- package/assets/esri/core/workers/chunks/{e011318fb8f8e59bc1f1.js → 1bf3e787eafec318bd2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8346c342b822487a5477.js → 2ddfd406b9044390e9f7.js} +1 -1
- package/assets/esri/core/workers/chunks/2fa86dacc8a12a6a6c43.js +1 -0
- package/assets/esri/core/workers/chunks/{6ca2064ea96bdb594f52.js → 4b0d6309abf273f1f79f.js} +1 -1
- package/assets/esri/core/workers/chunks/60e4312044fe40dfd41d.js +2 -0
- package/assets/esri/core/workers/chunks/67f95c57c1679935570b.js +1 -0
- package/assets/esri/core/workers/chunks/{ebcfc20c1d92d90bf661.js → 6afdaa6c4555c467dca7.js} +1 -1
- package/assets/esri/core/workers/chunks/{653d61aaaacb169b9418.js → 93bf908f596140ea4c61.js} +1 -1
- package/assets/esri/core/workers/chunks/{64450e280d602c5b0863.js → 9ae9e9a65cb08b12caeb.js} +13 -13
- package/assets/esri/core/workers/chunks/{fbada7f029b293d934ac.js → b014f0b2385dc82dc683.js} +2 -2
- package/assets/esri/core/workers/chunks/{98a84dc2988297bd6ab1.js → b2303b2771fcd75f298b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ed7ff651241f8adc4bf.js → b8f624f8c975728d75e2.js} +1 -1
- package/assets/esri/core/workers/chunks/bf668010f36179792592.js +1 -0
- package/assets/esri/core/workers/chunks/{b396b5186d618fad1cee.js → c0ecb68387e342dddf58.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f2d6f267d235db48767.js → cb482e20e10ab0f63617.js} +1 -1
- package/assets/esri/core/workers/chunks/d024278a1c2aa7d22be3.js +1 -0
- package/assets/esri/core/workers/chunks/{ba4e018492bd3327cd95.js → d0da3a44f33f4d8e682b.js} +1 -1
- package/assets/esri/core/workers/chunks/{c2e4cf3a277a6f40c7c2.js → d456f06d0c6a5cc02be7.js} +1 -1
- package/assets/esri/core/workers/chunks/{b5403c8b5099179dc16d.js → d82b543c96f09ded3bf9.js} +2 -2
- package/assets/esri/core/workers/chunks/{776a7179d32fe62a37e3.js → de9fea9b6f2269ee0703.js} +1 -1
- package/assets/esri/core/workers/chunks/e09f8b17cb0b92354de8.js +1 -0
- package/assets/esri/core/workers/chunks/{23cb0611abe1031c513c.js → fce30184f354fb7d11af.js} +1 -1
- package/chunks/Fog.glsl.js +2 -1
- package/chunks/GlowBlur.glsl.js +8 -8
- package/chunks/GlowComposition.glsl.js +7 -7
- package/chunks/HUDMaterial.glsl.js +4 -1
- package/chunks/OITBlend.glsl.js +10 -10
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/config.js +1 -1
- package/core/has.js +1 -1
- package/geometry/libtess.js +1 -1
- package/kernel.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/libs/lyr3d/Lyr3DModule.js +1 -1
- package/package.json +2 -2
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/RasterTile.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +2 -0
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +2 -0
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +2 -0
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +2 -0
- package/views/3d/webgl.js +1 -1
- package/assets/esri/core/workers/chunks/29ff5325e604dd0adc37.js +0 -1
- package/assets/esri/core/workers/chunks/5d87316d6f973d95745c.js +0 -1
- package/assets/esri/core/workers/chunks/9360a24ba765742f4e81.js +0 -1
- package/assets/esri/core/workers/chunks/bd278f8081be8304be8d.js +0 -1
- package/assets/esri/core/workers/chunks/d42d670edfae902c677b.js +0 -2
- package/assets/esri/core/workers/chunks/d6c2c9fedde498ad1a8c.js +0 -2
- package/assets/esri/core/workers/chunks/ecddd8c7593d3483ed09.js +0 -1
- package/views/3d/environment/EnvironmentRenderer.js +0 -2
- package/views/3d/webgl-engine/lib/CutFillColor.js +0 -2
- package/views/3d/webgl-engine/lib/CutFillDepth.js +0 -2
- /package/assets/esri/core/workers/chunks/{d6c2c9fedde498ad1a8c.js.LICENSE.txt → 0dd12d6af0cf7707109c.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d42d670edfae902c677b.js.LICENSE.txt → 60e4312044fe40dfd41d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fbada7f029b293d934ac.js.LICENSE.txt → b014f0b2385dc82dc683.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b5403c8b5099179dc16d.js.LICENSE.txt → d82b543c96f09ded3bf9.js.LICENSE.txt} +0 -0
package/chunks/lyr3DWorker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{g as r}from"./_commonjsHelpers.js";function e(r,e){for(var t=0;t<e.length;t++){const n=e[t];if("string"!=typeof n&&!Array.isArray(n))for(const e in n)if("default"!==e&&!(e in r)){const t=Object.getOwnPropertyDescriptor(n,e);t&&Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:()=>n[e]})}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var t,n={exports:{}};function o(){return t||(t=1,r=n,e="undefined"!=typeof document?document.currentScript?.src:void 0,o=async function(r={}){var t,n,o=r,a="./this.program",i=(r,e)=>{throw e},s="";function u(r){return o.locateFile?o.locateFile(r,s):s+r}try{s=new URL(".",e).href}catch{}t=async r=>{var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)};var l,d,c,f,m,h,p,v,w,y,g,E,k,_,b=console.log.bind(console),A=console.error.bind(console),F=!1,P=!1;function D(){var r=f.buffer;m=new Int8Array(r),p=new Int16Array(r),o.HEAPU8=h=new Uint8Array(r),v=new Uint16Array(r),w=new Int32Array(r),o.HEAPU32=y=new Uint32Array(r),g=new Float32Array(r),o.HEAPF64=E=new Float64Array(r),k=new BigInt64Array(r),_=new BigUint64Array(r)}function S(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)Y(o.preRun.shift());H(G)}function T(){P=!0,o.noFSInit||Ar.initialized||Ar.init(),Gt._(),Ar.ignorePermissions=!1}function x(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)X(o.postRun.shift());H(q)}var C,N=0,M=null;function R(r){N++,o.monitorRunDependencies?.(N)}function j(r){if(N--,o.monitorRunDependencies?.(N),0==N&&M){var e=M;M=null,e()}}function B(r){o.onAbort?.(r),A(r="Aborted("+r+")"),F=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw c?.(e),e}function O(){return u("lyr3DWorker.wasm")}function W(r){if(r==C&&l)return new Uint8Array(l);throw"both async and sync fetching of the wasm failed"}async function z(r){if(!l)try{var e=await t(r);return new Uint8Array(e)}catch{}return W(r)}async function $(r,e){try{var t=await z(r);return await WebAssembly.instantiate(t,e)}catch(n){A(`failed to asynchronously prepare wasm: ${n}`),B(n)}}async function I(r,e,t){if(!r&&"function"==typeof WebAssembly.instantiateStreaming)try{var n=fetch(e,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(o){A(`wasm streaming compile failed: ${o}`),A("falling back to ArrayBuffer instantiation")}return $(e,t)}function U(){return{a:Xt}}async function L(){function r(r,e){return Gt=r.exports,f=Gt.Z,D(),se=Gt.aa,qt(Gt),j(),Gt}function e(e){return r(e.instance)}R();var t=U();return o.instantiateWasm?new Promise((e,n)=>{o.instantiateWasm(t,(t,n)=>{e(r(t))})}):(C??=O(),e(await I(l,C,t)))}class V{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var H=r=>{for(;r.length>0;)r.shift()(o)},q=[],X=r=>q.push(r),G=[],Y=r=>G.push(r),K=!0,J=r=>xt(r),Q=()=>Ct();class Z{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){y[this.ptr+4>>2]=r}get_type(){return y[this.ptr+4>>2]}set_destructor(r){y[this.ptr+8>>2]=r}get_destructor(){return y[this.ptr+8>>2]}set_caught(r){r=r?1:0,m[this.ptr+12]=r}get_caught(){return 0!=m[this.ptr+12]}set_rethrown(r){r=r?1:0,m[this.ptr+13]=r}get_rethrown(){return 0!=m[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){y[this.ptr+16>>2]=r}get_adjusted_ptr(){return y[this.ptr+16>>2]}}var rr=(r,e,t)=>{throw new Z(r).init(e,t),r},er=()=>{var r=w[+Pr.varargs>>2];return Pr.varargs+=4,r},tr=er,nr={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=nr.isAbs(r),t="/"===r.slice(-1);return(r=nr.normalizeArray(r.split("/").filter(r=>!!r),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=nr.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.slice(0,-1)),t+n):"."},basename:r=>r&&r.match(/([^\/]+|\/)\/*$/)[1],join:(...r)=>nr.normalize(r.join("/")),join2:(r,e)=>nr.normalize(r+"/"+e)},or=()=>r=>crypto.getRandomValues(r),ar=r=>{(ar=or())(r)},ir={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:Ar.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=nr.isAbs(o)}return(t?"/":"")+(e=nr.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=ir.resolve(r).slice(1),e=ir.resolve(e).slice(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 u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},sr="undefined"!=typeof TextDecoder?new TextDecoder:void 0,ur=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&sr)return sr.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 u=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var l=i-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},lr=[],dr=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},cr=(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.codePointAt(i);if(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,i++}}return e[t]=0,t-o},fr=(r,e,t)=>{var n=dr(r)+1,o=new Array(n),a=cr(r,o,0,o.length);return o.length=a,o},mr=()=>{if(!lr.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;lr=fr(r)}return lr.shift()},hr={ttys:[],init(){},shutdown(){},register(r,e){hr.ttys[r]={input:[],output:[],ops:e},Ar.registerDevice(r,hr.stream_ops)},stream_ops:{open(r){var e=hr.ttys[r.node.rdev];if(!e)throw new Ar.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 Ar.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(u){throw new Ar.ErrnoError(29)}if(void 0===s&&0===a)throw new Ar.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 Ar.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(i){throw new Ar.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char:r=>mr(),put_char(r,e){null===e||10===e?(b(ur(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output?.length>0&&(b(ur(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?(A(ur(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output?.length>0&&(A(ur(r.output)),r.output=[])}}},pr=r=>{B()},vr={ops_table:null,mount:r=>vr.createNode(null,"/",16895,0),createNode(r,e,t,n){if(Ar.isBlkdev(t)||Ar.isFIFO(t))throw new Ar.ErrnoError(63);vr.ops_table||={dir:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr,lookup:vr.node_ops.lookup,mknod:vr.node_ops.mknod,rename:vr.node_ops.rename,unlink:vr.node_ops.unlink,rmdir:vr.node_ops.rmdir,readdir:vr.node_ops.readdir,symlink:vr.node_ops.symlink},stream:{llseek:vr.stream_ops.llseek}},file:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr},stream:{llseek:vr.stream_ops.llseek,read:vr.stream_ops.read,write:vr.stream_ops.write,mmap:vr.stream_ops.mmap,msync:vr.stream_ops.msync}},link:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr,readlink:vr.node_ops.readlink},stream:{}},chrdev:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr},stream:Ar.chrdev_stream_ops}};var o=Ar.createNode(r,e,t,n);return Ar.isDir(o.mode)?(o.node_ops=vr.ops_table.dir.node,o.stream_ops=vr.ops_table.dir.stream,o.contents={}):Ar.isFile(o.mode)?(o.node_ops=vr.ops_table.file.node,o.stream_ops=vr.ops_table.file.stream,o.usedBytes=0,o.contents=null):Ar.isLink(o.mode)?(o.node_ops=vr.ops_table.link.node,o.stream_ops=vr.ops_table.link.stream):Ar.isChrdev(o.mode)&&(o.node_ops=vr.ops_table.chrdev.node,o.stream_ops=vr.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=Ar.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,Ar.isDir(r.mode)?e.size=4096:Ar.isFile(r.mode)?e.size=r.usedBytes:Ar.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"])null!=e[t]&&(r[t]=e[t]);void 0!==e.size&&vr.resizeFileStorage(r,e.size)},lookup(r,e){throw vr.doesNotExistError},mknod:(r,e,t,n)=>vr.createNode(r,e,t,n),rename(r,e,t){var n;try{n=Ar.lookupNode(e,t)}catch(a){}if(n){if(Ar.isDir(r.mode))for(var o in n.contents)throw new Ar.ErrnoError(55);Ar.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=Ar.lookupNode(r,e);for(var n in t.contents)throw new Ar.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir:r=>[".","..",...Object.keys(r.contents)],symlink(r,e,t){var n=vr.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!Ar.isLink(r.mode))throw new Ar.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===m.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(vr.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&&Ar.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new Ar.ErrnoError(28);return n},mmap(r,e,t,n,o){if(!Ar.isFile(r.node.mode))throw new Ar.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==m.buffer){if(i=!0,!(a=pr()))throw new Ar.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)),m.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(vr.stream_ops.write(r,e,0,n,t,!1),0)}},wr=async r=>{var e=await t(r);return new Uint8Array(e)},yr=(...r)=>Ar.createDataFile(...r),gr=[],Er=(r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return gr.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},kr=(r,e,t,n,o,a,i,s,u,l)=>{var d=e?ir.resolve(nr.join2(r,e)):r;function c(t){function c(t){l?.(),s||yr(r,e,t,n,o,u),a?.(),j()}Er(t,d,c,()=>{i?.(),j()})||c(t)}R(),"string"==typeof t?wr(t).then(c,i):c(t)},_r=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},br=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},Ar={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},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=Ar.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 Ar.isDir(this.mode)}get isDevice(){return Ar.isChrdev(this.mode)}},lookupPath(r,e={}){if(!r)throw new Ar.ErrnoError(44);e.follow_mount??=!0,nr.isAbs(r)||(r=Ar.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter(r=>!!r),o=Ar.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if("."!==n[i])if(".."!==n[i]){a=nr.join2(a,n[i]);try{o=Ar.lookupNode(o,n[i])}catch(l){if(44===l?.errno&&s&&e.noent_okay)return{path:a};throw l}if(!Ar.isMountpoint(o)||s&&!e.follow_mount||(o=o.mounted.root),Ar.isLink(o.mode)&&(!s||e.follow)){if(!o.node_ops.readlink)throw new Ar.ErrnoError(52);var u=o.node_ops.readlink(o);nr.isAbs(u)||(u=nr.dirname(a)+"/"+u),r=u+"/"+n.slice(i+1).join("/");continue r}}else{if(a=nr.dirname(a),Ar.isRoot(o)){r=a+"/"+n.slice(i+1).join("/");continue r}o=o.parent}}return{path:a,node:o}}throw new Ar.ErrnoError(32)},getPath(r){for(var e;;){if(Ar.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)%Ar.nameTable.length},hashAddNode(r){var e=Ar.hashName(r.parent.id,r.name);r.name_next=Ar.nameTable[e],Ar.nameTable[e]=r},hashRemoveNode(r){var e=Ar.hashName(r.parent.id,r.name);if(Ar.nameTable[e]===r)Ar.nameTable[e]=r.name_next;else for(var t=Ar.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=Ar.mayLookup(r);if(t)throw new Ar.ErrnoError(t);for(var n=Ar.hashName(r.id,e),o=Ar.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return Ar.lookup(r,e)},createNode(r,e,t,n){var o=new Ar.FSNode(r,e,t,n);return Ar.hashAddNode(o),o},destroyNode(r){Ar.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)=>Ar.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!Ar.isDir(r.mode))return 54;var e=Ar.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){if(!Ar.isDir(r.mode))return 54;try{return Ar.lookupNode(r,e),20}catch(t){}return Ar.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=Ar.lookupNode(r,e)}catch(a){return a.errno}var o=Ar.nodePermissions(r,"wx");if(o)return o;if(t){if(!Ar.isDir(n.mode))return 54;if(Ar.isRoot(n)||Ar.getPath(n)===Ar.cwd())return 10}else if(Ar.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?Ar.isLink(r.mode)?32:Ar.isDir(r.mode)&&("r"!==Ar.flagsToPermissionString(e)||576&e)?31:Ar.nodePermissions(r,Ar.flagsToPermissionString(e)):44,checkOpExists(r,e){if(!r)throw new Ar.ErrnoError(e);return r},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=Ar.MAX_OPEN_FDS;r++)if(!Ar.streams[r])return r;throw new Ar.ErrnoError(33)},getStreamChecked(r){var e=Ar.getStream(r);if(!e)throw new Ar.ErrnoError(8);return e},getStream:r=>Ar.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new Ar.FSStream,r),-1==e&&(e=Ar.nextfd()),r.fd=e,Ar.streams[e]=r,r),closeStream(r){Ar.streams[r]=null},dupStream(r,e=-1){var t=Ar.createStream(r,e);return t.stream_ops?.dup?.(t),t},doSetAttr(r,e,t){var n=r?.stream_ops.setattr,o=n?r:e;n??=e.node_ops.setattr,Ar.checkOpExists(n,63),n(o,t)},chrdev_stream_ops:{open(r){var e=Ar.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new Ar.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){Ar.devices[r]={stream_ops:e}},getDevice:r=>Ar.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),Ar.syncFSRequests++,Ar.syncFSRequests>1&&A(`warning: ${Ar.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=Ar.getMounts(Ar.root.mount),n=0;function o(r){return Ar.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&&Ar.root)throw new Ar.ErrnoError(10);if(!o&&!a){var i=Ar.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,Ar.isMountpoint(n))throw new Ar.ErrnoError(10);if(!Ar.isDir(n.mode))throw new Ar.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},u=r.mount(s);return u.mount=s,s.root=u,o?Ar.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(r){var e=Ar.lookupPath(r,{follow_mount:!1});if(!Ar.isMountpoint(e.node))throw new Ar.ErrnoError(28);var t=e.node,n=t.mounted,o=Ar.getMounts(n);Object.keys(Ar.nameTable).forEach(r=>{for(var e=Ar.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&Ar.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=Ar.lookupPath(r,{parent:!0}).node,o=nr.basename(r);if(!o)throw new Ar.ErrnoError(28);if("."===o||".."===o)throw new Ar.ErrnoError(20);var a=Ar.mayCreate(n,o);if(a)throw new Ar.ErrnoError(a);if(!n.node_ops.mknod)throw new Ar.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs:r=>Ar.statfsNode(Ar.lookupPath(r,{follow:!0}).node),statfsStream:r=>Ar.statfsNode(r.node),statfsNode(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Ar.nextInode,ffree:Ar.nextInode-1,fsid:42,flags:2,namelen:255};return r.node_ops.statfs&&Object.assign(e,r.node_ops.statfs(r.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,Ar.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,Ar.mknod(r,e,0)),mkdirTree(r,e){var t=r.split("/"),n="";for(var o of t)if(o){(n||nr.isAbs(r))&&(n+="/"),n+=o;try{Ar.mkdir(n,e)}catch(a){if(20!=a.errno)throw a}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,Ar.mknod(r,e,t)),symlink(r,e){if(!ir.resolve(r))throw new Ar.ErrnoError(44);var t=Ar.lookupPath(e,{parent:!0}).node;if(!t)throw new Ar.ErrnoError(44);var n=nr.basename(e),o=Ar.mayCreate(t,n);if(o)throw new Ar.ErrnoError(o);if(!t.node_ops.symlink)throw new Ar.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=nr.dirname(r),a=nr.dirname(e),i=nr.basename(r),s=nr.basename(e);if(t=Ar.lookupPath(r,{parent:!0}).node,n=Ar.lookupPath(e,{parent:!0}).node,!t||!n)throw new Ar.ErrnoError(44);if(t.mount!==n.mount)throw new Ar.ErrnoError(75);var u,l=Ar.lookupNode(t,i),d=ir.relative(r,a);if("."!==d.charAt(0))throw new Ar.ErrnoError(28);if("."!==(d=ir.relative(e,o)).charAt(0))throw new Ar.ErrnoError(55);try{u=Ar.lookupNode(n,s)}catch(m){}if(l!==u){var c=Ar.isDir(l.mode),f=Ar.mayDelete(t,i,c);if(f)throw new Ar.ErrnoError(f);if(f=u?Ar.mayDelete(n,s,c):Ar.mayCreate(n,s))throw new Ar.ErrnoError(f);if(!t.node_ops.rename)throw new Ar.ErrnoError(63);if(Ar.isMountpoint(l)||u&&Ar.isMountpoint(u))throw new Ar.ErrnoError(10);if(n!==t&&(f=Ar.nodePermissions(t,"w")))throw new Ar.ErrnoError(f);Ar.hashRemoveNode(l);try{t.node_ops.rename(l,n,s),l.parent=n}catch(m){throw m}finally{Ar.hashAddNode(l)}}},rmdir(r){var e=Ar.lookupPath(r,{parent:!0}).node,t=nr.basename(r),n=Ar.lookupNode(e,t),o=Ar.mayDelete(e,t,!0);if(o)throw new Ar.ErrnoError(o);if(!e.node_ops.rmdir)throw new Ar.ErrnoError(63);if(Ar.isMountpoint(n))throw new Ar.ErrnoError(10);e.node_ops.rmdir(e,t),Ar.destroyNode(n)},readdir(r){var e=Ar.lookupPath(r,{follow:!0}).node;return Ar.checkOpExists(e.node_ops.readdir,54)(e)},unlink(r){var e=Ar.lookupPath(r,{parent:!0}).node;if(!e)throw new Ar.ErrnoError(44);var t=nr.basename(r),n=Ar.lookupNode(e,t),o=Ar.mayDelete(e,t,!1);if(o)throw new Ar.ErrnoError(o);if(!e.node_ops.unlink)throw new Ar.ErrnoError(63);if(Ar.isMountpoint(n))throw new Ar.ErrnoError(10);e.node_ops.unlink(e,t),Ar.destroyNode(n)},readlink(r){var e=Ar.lookupPath(r).node;if(!e)throw new Ar.ErrnoError(44);if(!e.node_ops.readlink)throw new Ar.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=Ar.lookupPath(r,{follow:!e}).node;return Ar.checkOpExists(t.node_ops.getattr,63)(t)},fstat(r){var e=Ar.getStreamChecked(r),t=e.node,n=e.stream_ops.getattr,o=n?e:t;return n??=t.node_ops.getattr,Ar.checkOpExists(n,63),n(o)},lstat:r=>Ar.stat(r,!0),doChmod(r,e,t,n){Ar.doSetAttr(r,e,{mode:4095&t|-4096&e.mode,ctime:Date.now(),dontFollow:n})},chmod(r,e,t){var n;n="string"==typeof r?Ar.lookupPath(r,{follow:!t}).node:r,Ar.doChmod(null,n,e,t)},lchmod(r,e){Ar.chmod(r,e,!0)},fchmod(r,e){var t=Ar.getStreamChecked(r);Ar.doChmod(t,t.node,e,!1)},doChown(r,e,t){Ar.doSetAttr(r,e,{timestamp:Date.now(),dontFollow:t})},chown(r,e,t,n){var o;o="string"==typeof r?Ar.lookupPath(r,{follow:!n}).node:r,Ar.doChown(null,o,n)},lchown(r,e,t){Ar.chown(r,e,t,!0)},fchown(r,e,t){var n=Ar.getStreamChecked(r);Ar.doChown(n,n.node,!1)},doTruncate(r,e,t){if(Ar.isDir(e.mode))throw new Ar.ErrnoError(31);if(!Ar.isFile(e.mode))throw new Ar.ErrnoError(28);var n=Ar.nodePermissions(e,"w");if(n)throw new Ar.ErrnoError(n);Ar.doSetAttr(r,e,{size:t,timestamp:Date.now()})},truncate(r,e){if(e<0)throw new Ar.ErrnoError(28);var t;t="string"==typeof r?Ar.lookupPath(r,{follow:!0}).node:r,Ar.doTruncate(null,t,e)},ftruncate(r,e){var t=Ar.getStreamChecked(r);if(e<0||!(2097155&t.flags))throw new Ar.ErrnoError(28);Ar.doTruncate(t,t.node,e)},utime(r,e,t){var n=Ar.lookupPath(r,{follow:!0}).node;Ar.checkOpExists(n.node_ops.setattr,63)(n,{atime:e,mtime:t})},open(r,e,t=438){if(""===r)throw new Ar.ErrnoError(44);var n,a;if(t=64&(e="string"==typeof e?_r(e):e)?4095&t|32768:0,"object"==typeof r)n=r;else{a=r.endsWith("/");var i=Ar.lookupPath(r,{follow:!(131072&e),noent_okay:!0});n=i.node,r=i.path}var s=!1;if(64&e)if(n){if(128&e)throw new Ar.ErrnoError(20)}else{if(a)throw new Ar.ErrnoError(31);n=Ar.mknod(r,511|t,0),s=!0}if(!n)throw new Ar.ErrnoError(44);if(Ar.isChrdev(n.mode)&&(e&=-513),65536&e&&!Ar.isDir(n.mode))throw new Ar.ErrnoError(54);if(!s){var u=Ar.mayOpen(n,e);if(u)throw new Ar.ErrnoError(u)}512&e&&!s&&Ar.truncate(n,0),e&=-131713;var l=Ar.createStream({node:n,path:Ar.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),s&&Ar.chmod(n,511&t),!o.logReadFiles||1&e||r in Ar.readFiles||(Ar.readFiles[r]=1),l},close(r){if(Ar.isClosed(r))throw new Ar.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{Ar.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(Ar.isClosed(r))throw new Ar.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new Ar.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new Ar.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 Ar.ErrnoError(28);if(Ar.isClosed(r))throw new Ar.ErrnoError(8);if(1==(2097155&r.flags))throw new Ar.ErrnoError(8);if(Ar.isDir(r.node.mode))throw new Ar.ErrnoError(31);if(!r.stream_ops.read)throw new Ar.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new Ar.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 Ar.ErrnoError(28);if(Ar.isClosed(r))throw new Ar.ErrnoError(8);if(!(2097155&r.flags))throw new Ar.ErrnoError(8);if(Ar.isDir(r.node.mode))throw new Ar.ErrnoError(31);if(!r.stream_ops.write)throw new Ar.ErrnoError(28);r.seekable&&1024&r.flags&&Ar.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new Ar.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new Ar.ErrnoError(2);if(1==(2097155&r.flags))throw new Ar.ErrnoError(2);if(!r.stream_ops.mmap)throw new Ar.ErrnoError(43);if(!e)throw new Ar.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 Ar.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=Ar.open(r,e.flags),n=Ar.stat(r).size,o=new Uint8Array(n);return Ar.read(t,o,0,n,0),"utf8"===e.encoding&&(o=ur(o)),Ar.close(t),o},writeFile(r,e,t={}){t.flags=t.flags||577;var n=Ar.open(r,t.flags,t.mode);if("string"==typeof e&&(e=new Uint8Array(fr(e))),!ArrayBuffer.isView(e))throw new Error("Unsupported data type");Ar.write(n,e,0,e.byteLength,void 0,t.canOwn),Ar.close(n)},cwd:()=>Ar.currentPath,chdir(r){var e=Ar.lookupPath(r,{follow:!0});if(null===e.node)throw new Ar.ErrnoError(44);if(!Ar.isDir(e.node.mode))throw new Ar.ErrnoError(54);var t=Ar.nodePermissions(e.node,"x");if(t)throw new Ar.ErrnoError(t);Ar.currentPath=e.path},createDefaultDirectories(){Ar.mkdir("/tmp"),Ar.mkdir("/home"),Ar.mkdir("/home/web_user")},createDefaultDevices(){Ar.mkdir("/dev"),Ar.registerDevice(Ar.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),Ar.mkdev("/dev/null",Ar.makedev(1,3)),hr.register(Ar.makedev(5,0),hr.default_tty_ops),hr.register(Ar.makedev(6,0),hr.default_tty1_ops),Ar.mkdev("/dev/tty",Ar.makedev(5,0)),Ar.mkdev("/dev/tty1",Ar.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(ar(r),e=r.byteLength),r[--e]);Ar.createDevice("/dev","random",t),Ar.createDevice("/dev","urandom",t),Ar.mkdir("/dev/shm"),Ar.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Ar.mkdir("/proc");var r=Ar.mkdir("/proc/self");Ar.mkdir("/proc/self/fd"),Ar.mount({mount(){var e=Ar.createNode(r,"fd",16895,73);return e.stream_ops={llseek:vr.stream_ops.llseek},e.node_ops={lookup(r,e){var t=+e,n=Ar.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(Ar.streams.entries()).filter(([r,e])=>e).map(([r,e])=>r.toString())},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?Ar.createDevice("/dev","stdin",r):Ar.symlink("/dev/tty","/dev/stdin"),e?Ar.createDevice("/dev","stdout",null,e):Ar.symlink("/dev/tty","/dev/stdout"),t?Ar.createDevice("/dev","stderr",null,t):Ar.symlink("/dev/tty1","/dev/stderr"),Ar.open("/dev/stdin",0),Ar.open("/dev/stdout",1),Ar.open("/dev/stderr",1)},staticInit(){Ar.nameTable=new Array(4096),Ar.mount(vr,{},"/"),Ar.createDefaultDirectories(),Ar.createDefaultDevices(),Ar.createSpecialDirectories(),Ar.filesystems={MEMFS:vr}},init(r,e,t){Ar.initialized=!0,r??=o.stdin,e??=o.stdout,t??=o.stderr,Ar.createStandardStreams(r,e,t)},quit(){for(var r of(Ar.initialized=!1,Ar.streams))r&&Ar.close(r)},findObject(r,e){var t=Ar.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=Ar.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=Ar.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=nr.basename(r),n=Ar.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:Ar.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=nr.join2(r,a);try{Ar.mkdir(i)}catch(s){if(20!=s.errno)throw s}r=i}}return i},createFile(r,e,t,n,o){var a=nr.join2("string"==typeof r?r:Ar.getPath(r),e),i=br(n,o);return Ar.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:Ar.getPath(r),i=e?nr.join2(r,e):r);var s=br(n,o),u=Ar.create(i,s);if(t){if("string"==typeof t){for(var l=new Array(t.length),d=0,c=t.length;d<c;++d)l[d]=t.charCodeAt(d);t=l}Ar.chmod(u,146|s);var f=Ar.open(u,577);Ar.write(f,t,0,t.length,0,a),Ar.close(f),Ar.chmod(u,s)}},createDevice(r,e,t,n){var o=nr.join2("string"==typeof r?r:Ar.getPath(r),e),a=br(!!t,!!n);Ar.createDevice.major??=64;var i=Ar.makedev(Ar.createDevice.major++,0);return Ar.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 u;try{u=t()}catch(l){throw new Ar.ErrnoError(29)}if(void 0===u&&0===i)throw new Ar.ErrnoError(6);if(null==u)break;i++,e[n+s]=u}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 Ar.ErrnoError(29)}return o&&(r.node.mtime=r.node.ctime=Date.now()),i}}),Ar.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=n(r.url),r.usedBytes=r.contents.length}catch(e){throw new Ar.ErrnoError(29)}},createLazyFile(r,e,t,n,o){if("undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a={isDevice:!1,url:t},i=Ar.createFile(r,e,a,n,o);a.contents?i.contents=a.contents:a.url&&(i.contents=null,i.url=a.url),Object.defineProperties(i,{usedBytes:{get:function(){return this.contents.length}}});var s={};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(i.stream_ops).forEach(r=>{var e=i.stream_ops[r];s[r]=(...r)=>(Ar.forceLoadFile(i),e(...r))}),s.read=(r,e,t,n,o)=>(Ar.forceLoadFile(i),u(r,e,t,n,o)),s.mmap=(r,e,t,n,o)=>{Ar.forceLoadFile(i);var a=pr();if(!a)throw new Ar.ErrnoError(48);return u(r,m,a,e,t),{ptr:a,allocated:!0}},i.stream_ops=s,i}},Fr=(r,e)=>r?ur(h,r,e):"",Pr={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(nr.isAbs(e))return e;var n;if(n=-100===r?Ar.cwd():Pr.getStreamFromFD(r).path,0==e.length){if(!t)throw new Ar.ErrnoError(44);return n}return n+"/"+e},writeStat(r,e){w[r>>2]=e.dev,w[r+4>>2]=e.mode,y[r+8>>2]=e.nlink,w[r+12>>2]=e.uid,w[r+16>>2]=e.gid,w[r+20>>2]=e.rdev,k[r+24>>3]=BigInt(e.size),w[r+32>>2]=4096,w[r+36>>2]=e.blocks;var t=e.atime.getTime(),n=e.mtime.getTime(),o=e.ctime.getTime();return k[r+40>>3]=BigInt(Math.floor(t/1e3)),y[r+48>>2]=t%1e3*1e3*1e3,k[r+56>>3]=BigInt(Math.floor(n/1e3)),y[r+64>>2]=n%1e3*1e3*1e3,k[r+72>>3]=BigInt(Math.floor(o/1e3)),y[r+80>>2]=o%1e3*1e3*1e3,k[r+88>>3]=BigInt(e.ino),0},writeStatFs(r,e){w[r+4>>2]=e.bsize,w[r+40>>2]=e.bsize,w[r+8>>2]=e.blocks,w[r+12>>2]=e.bfree,w[r+16>>2]=e.bavail,w[r+20>>2]=e.files,w[r+24>>2]=e.ffree,w[r+28>>2]=e.fsid,w[r+44>>2]=e.flags,w[r+36>>2]=e.namelen},doMsync(r,e,t,n,o){if(!Ar.isFile(e.node.mode))throw new Ar.ErrnoError(43);if(2&n)return 0;var a=h.slice(r,r+t);Ar.msync(e,a,o,t,n)},getStreamFromFD:r=>Ar.getStreamChecked(r),varargs:void 0,getStr:r=>Fr(r)};function Dr(r,e,t){Pr.varargs=t;try{var n=Pr.getStreamFromFD(r);switch(e){case 0:if((o=er())<0)return-28;for(;Ar.streams[o];)o++;return Ar.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=er();return n.flags|=o,0;case 12:return o=tr(),p[o+0>>1]=2,0}return-28}catch(a){if(void 0===Ar||"ErrnoError"!==a.name)throw a;return-a.errno}}function Sr(r,e,t){Pr.varargs=t;try{var n=Pr.getStreamFromFD(r);switch(e){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=tr();w[a>>2]=o.c_iflag||0,w[a+4>>2]=o.c_oflag||0,w[a+8>>2]=o.c_cflag||0,w[a+12>>2]=o.c_lflag||0;for(var i=0;i<32;i++)m[a+i+17]=o.c_cc[i]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){a=tr();var s=w[a>>2],u=w[a+4>>2],l=w[a+8>>2],d=w[a+12>>2],c=[];for(i=0;i<32;i++)c.push(m[a+i+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:s,c_oflag:u,c_cflag:l,c_lflag:d,c_cc:c})}return 0;case 21519:return n.tty?(a=tr(),w[a>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return a=tr(),Ar.ioctl(n,e,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var f=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=tr(),p[a>>1]=f[0],p[a+2>>1]=f[1]}return 0;default:return-28}}catch(h){if(void 0===Ar||"ErrnoError"!==h.name)throw h;return-h.errno}}function Tr(r,e,t,n){Pr.varargs=n;try{e=Pr.getStr(e),e=Pr.calculateAt(r,e);var o=n?er():0;return Ar.open(e,t,o).fd}catch(a){if(void 0===Ar||"ErrnoError"!==a.name)throw a;return-a.errno}}var xr=()=>B(""),Cr={},Nr=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function Mr(r){return this.fromWireType(y[r>>2])}var Rr={},jr={},Br={},Or=class extends Error{constructor(r){super(r),this.name="InternalError"}},Wr=r=>{throw new Or(r)},zr=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&Wr("Mismatched type converter count");for(var o=0;o<r.length;++o)Hr(r[o],n[o])}r.forEach(r=>Br[r]=e);var o=new Array(e.length),a=[],i=0;e.forEach((r,e)=>{jr.hasOwnProperty(r)?o[e]=jr[r]:(a.push(r),Rr.hasOwnProperty(r)||(Rr[r]=[]),Rr[r].push(()=>{o[e]=jr[r],++i===a.length&&n(o)}))}),0===a.length&&n(o)},$r=r=>{var e=Cr[r];delete Cr[r];var t=e.rawConstructor,n=e.rawDestructor,o=e.fields,a=o.map(r=>r.getterReturnType).concat(o.map(r=>r.setterArgumentType));zr([r],a,r=>{var a={};return o.forEach((e,t)=>{var n=e.fieldName,i=r[t],s=r[t].optional,u=e.getter,l=e.getterContext,d=r[t+o.length],c=e.setter,f=e.setterContext;a[n]={read:r=>i.fromWireType(u(l,r)),write:(r,e)=>{var t=[];c(f,r,d.toWireType(t,e)),Nr(t)},optional:s}}),[{name:e.name,fromWireType:r=>{var e={};for(var t in a)e[t]=a[t].read(r);return n(r),e},toWireType:(r,e)=>{for(var o in a)if(!(o in e)&&!a[o].optional)throw new TypeError(`Missing field: "${o}"`);var i=t();for(o in a)a[o].write(i,e[o]);return null!==r&&r.push(n,i),i},argPackAdvance:Gr,readValueFromPointer:Mr,destructorFunction:n}]})},Ir=r=>{for(var e="";;){var t=h[r++];if(!t)return e;e+=String.fromCharCode(t)}},Ur=class extends Error{constructor(r){super(r),this.name="BindingError"}},Lr=r=>{throw new Ur(r)};function Vr(r,e,t={}){var n=e.name;if(r||Lr(`type "${n}" must have a positive integer typeid pointer`),jr.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;Lr(`Cannot register type '${n}' twice`)}if(jr[r]=e,delete Br[r],Rr.hasOwnProperty(r)){var o=Rr[r];delete Rr[r],o.forEach(r=>r())}}function Hr(r,e,t={}){return Vr(r,e,t)}var qr=(r,e,t)=>{switch(e){case 1:return t?r=>m[r]:r=>h[r];case 2:return t?r=>p[r>>1]:r=>v[r>>1];case 4:return t?r=>w[r>>2]:r=>y[r>>2];case 8:return t?r=>k[r>>3]:r=>_[r>>3];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Xr=(r,e,t,n,o)=>{e=Ir(e);const a=0n===n;let i=r=>r;if(a){const r=8*t;i=e=>BigInt.asUintN(r,e),o=i(o)}Hr(r,{name:e,fromWireType:i,toWireType:(r,e)=>("number"==typeof e&&(e=BigInt(e)),e),argPackAdvance:Gr,readValueFromPointer:qr(e,t,!a),destructorFunction:null})},Gr=8,Yr=(r,e,t,n)=>{Hr(r,{name:e=Ir(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:Gr,readValueFromPointer:function(r){return this.fromWireType(h[r])},destructorFunction:null})},Kr=[],Jr=[0,1,,1,null,1,!0,1,!1,1],Qr=r=>{r>9&&0===--Jr[r+1]&&(Jr[r]=void 0,Kr.push(r))},Zr={toValue:r=>(r||Lr(`Cannot use deleted val. handle = ${r}`),Jr[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=Kr.pop()||Jr.length;return Jr[e]=r,Jr[e+1]=1,e}}}},re={name:"emscripten::val",fromWireType:r=>{var e=Zr.toValue(r);return Qr(r),e},toWireType:(r,e)=>Zr.toHandle(e),argPackAdvance:Gr,readValueFromPointer:Mr,destructorFunction:null},ee=r=>Hr(r,re),te=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(g[r>>2])};case 8:return function(r){return this.fromWireType(E[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},ne=(r,e,t)=>{Hr(r,{name:e=Ir(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:Gr,readValueFromPointer:te(e,t),destructorFunction:null})},oe=(r,e)=>Object.defineProperty(e,"name",{value:r});function ae(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function ie(r,e,t,n,o,a){var i=e.length;i<2&&Lr("argTypes array size mismatch! Must at least get return value and 'this' types!"),e[1];var s=ae(e),u="void"!==e[0].name,l=i-2,d=new Array(l),c=[],f=[];return oe(r,function(...r){var t;f.length=0,c.length=1,c[0]=o;for(var a=0;a<l;++a)d[a]=e[a+2].toWireType(f,r[a]),c.push(d[a]);function i(r){if(s)Nr(f);else for(var n=2;n<e.length;n++){var o=1===n?t:d[n-2];null!==e[n].destructorFunction&&e[n].destructorFunction(o)}if(u)return e[0].fromWireType(r)}return i(n(...c))})}var se,ue=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||Lr(`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}},le=(r,e,t)=>{o.hasOwnProperty(r)?((void 0===t||void 0!==o[r].overloadTable&&void 0!==o[r].overloadTable[t])&&Lr(`Cannot register public name '${r}' twice`),ue(o,r,r),o[r].overloadTable.hasOwnProperty(t)&&Lr(`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)},de=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(y[e+4*n>>2]);return t},ce=(r,e,t)=>{o.hasOwnProperty(r)||Wr("Replacing nonexistent public symbol"),void 0!==o[r].overloadTable&&void 0!==t?o[r].overloadTable[t]=e:(o[r]=e,o[r].argCount=t)},fe=[],me=r=>{var e=fe[r];return e||(fe[r]=e=se.get(r)),e},he=(r,e,t=!1)=>{function n(){return me(e)}r=Ir(r);var o=n();return"function"!=typeof o&&Lr(`unknown function pointer with signature ${r}: ${e}`),o};class pe extends Error{}var ve=r=>{var e=Pt(r),t=Ir(e);return St(e),t},we=(r,e)=>{var t=[],n={};function o(r){n[r]||jr[r]||(Br[r]?Br[r].forEach(o):(t.push(r),n[r]=!0))}throw e.forEach(o),new pe(`${r}: `+t.map(ve).join([", "]))},ye=r=>{const e=(r=r.trim()).indexOf("(");return-1===e?r:r.slice(0,e)},ge=(r,e,t,n,o,a,i,s)=>{var u=de(e,t);r=Ir(r),r=ye(r),o=he(n,o,i),le(r,function(){we(`Cannot call ${r} due to unbound types`,u)},e-1),zr([],u,t=>{var n=[t[0],null].concat(t.slice(1));return ce(r,ie(r,n,null,o,a),e-1),[]})},Ee=(r,e,t,n,o)=>{e=Ir(e);let a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i,o=a(o)}Hr(r,{name:e,fromWireType:a,toWireType:(r,e)=>e,argPackAdvance:Gr,readValueFromPointer:qr(e,t,0!==n),destructorFunction:null})},ke=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];function o(r){var e=y[r>>2],t=y[r+4>>2];return new n(m.buffer,t,e)}Hr(r,{name:t=Ir(t),fromWireType:o,argPackAdvance:Gr,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},_e=(r,e,t)=>cr(r,h,e,t),be=(r,e)=>{Hr(r,{name:e=Ir(e),fromWireType(r){for(var e,t=y[r>>2],n=r+4,o=n,a=0;a<=t;++a){var i=n+a;if(a==t||0==h[i]){var s=Fr(o,i-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=i+1}}return St(r),e},toWireType(r,e){var t;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||ArrayBuffer.isView(e)&&1==e.BYTES_PER_ELEMENT||Lr("Cannot pass non-string to std::string"),t=n?dr(e):e.length;var o=Dt(4+t+1),a=o+4;return y[o>>2]=t,n?_e(e,a,t+1):h.set(e,a),null!==r&&r.push(St,o),o},argPackAdvance:Gr,readValueFromPointer:Mr,destructorFunction(r){St(r)}})},Ae="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Fe=(r,e)=>{for(var t=r>>1,n=t+e/2,o=t;!(o>=n)&&v[o];)++o;if(o-t>16&&Ae)return Ae.decode(v.subarray(t,o));for(var a="",i=t;!(i>=n);++i){var s=v[i];if(0==s)break;a+=String.fromCharCode(s)}return a},Pe=(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);p[e>>1]=i,e+=2}return p[e>>1]=0,e-n},De=r=>2*r.length,Se=(r,e)=>{for(var t="",n=0;!(n>=e/4);n++){var o=w[r+4*n>>2];if(!o)break;t+=String.fromCodePoint(o)}return t},Te=(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.codePointAt(a);if(i>65535&&a++,w[e>>2]=i,(e+=4)+4>o)break}return w[e>>2]=0,e-n},xe=r=>{for(var e=0,t=0;t<r.length;++t)r.codePointAt(t)>65535&&t++,e+=4;return e},Ce=(r,e,t)=>{var n,o,a,i;t=Ir(t),2===e?(n=Fe,o=Pe,i=De,a=r=>v[r>>1]):4===e&&(n=Se,o=Te,i=xe,a=r=>y[r>>2]),Hr(r,{name:t,fromWireType:r=>{for(var t,o=y[r>>2],i=r+4,s=0;s<=o;++s){var u=r+4+s*e;if(s==o||0==a(u)){var l=n(i,u-i);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),i=u+e}}return St(r),t},toWireType:(r,n)=>{"string"!=typeof n&&Lr(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=Dt(4+a+e);return y[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(St,s),s},argPackAdvance:Gr,readValueFromPointer:Mr,destructorFunction(r){St(r)}})},Ne=(r,e,t,n,o,a)=>{Cr[r]={name:Ir(e),rawConstructor:he(t,n),rawDestructor:he(o,a),fields:[]}},Me=(r,e,t,n,o,a,i,s,u,l)=>{Cr[r].fields.push({fieldName:Ir(e),getterReturnType:t,getter:he(n,o),getterContext:a,setterArgumentType:i,setter:he(s,u),setterContext:l})},Re=(r,e)=>{Hr(r,{isVoid:!0,name:e=Ir(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},je=r=>{do{var e=y[r>>2],t=y[(r+=4)>>2],n=y[(r+=4)>>2];r+=4;var o=Fr(e);Ar.createPath("/",nr.dirname(o),!0,!0),Ar.createDataFile(o,null,m.subarray(n,n+t),!0,!0,!0)}while(y[r>>2])},Be=()=>{throw 1/0},Oe=(r,e)=>{var t=jr[r];return void 0===t&&Lr(`${e} has unknown type ${ve(r)}`),t},We=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(y[e>>2]=Zr.toHandle(n)),o},ze=(r,e,t)=>(r=Zr.toValue(r),e=Oe(e,"emval::as"),We(e,t,r)),$e={},Ie=r=>{var e=$e[r];return void 0===e?Ir(r):e},Ue=[],Le=(r,e,t,n,o)=>(r=Ue[r])(e=Zr.toValue(e),e[t=Ie(t)],n,o),Ve=()=>globalThis,He=r=>0===r?Zr.toHandle(Ve()):(r=Ie(r),Zr.toHandle(Ve()[r])),qe=r=>{var e=Ue.length;return Ue.push(r),e},Xe=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=Oe(y[e+4*n>>2],`parameter ${n}`);return t},Ge=(r,e,t)=>{var n=Xe(r,e),o=n.shift();r--;var a=new Array(r),i=(e,i,s,u)=>{for(var l=0,d=0;d<r;++d)a[d]=n[d].readValueFromPointer(u+l),l+=n[d].argPackAdvance;var c=1===t?Reflect.construct(i,a):i.apply(e,a);return We(o,s,c)},s=`methodCaller<(${n.map(r=>r.name).join(", ")}) => ${o.name}>`;return qe(oe(s,i))},Ye=(r,e)=>(r=Zr.toValue(r),e=Zr.toValue(e),Zr.toHandle(r[e])),Ke=r=>{r>9&&(Jr[r+1]+=1)},Je=()=>Zr.toHandle([]),Qe=r=>Zr.toHandle(Ie(r)),Ze=r=>{var e=Zr.toValue(r);Nr(e),Qr(r)},rt=(r,e,t)=>{r=Zr.toValue(r),e=Zr.toValue(e),t=Zr.toValue(t),r[e]=t},et=(r,e)=>{var t=(r=Oe(r,"_emval_take_value")).readValueFromPointer(e);return Zr.toHandle(t)},tt=(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),u=i.getTimezoneOffset(),l=Math.max(s,u);y[r>>2]=60*l,w[e>>2]=Number(s!=u);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(u);u<s?(_e(c,t,17),_e(f,n,17)):(_e(c,n,17),_e(f,t,17))},nt=()=>2147483648,ot=(r,e)=>Math.ceil(r/e)*e,at=r=>{var e=(r-f.buffer.byteLength+65535)/65536|0;try{return f.grow(e),D(),1}catch(t){}},it=r=>{var e=h.length;r>>>=0;var t=nt();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,ot(Math.max(r,o),65536));if(at(a))return!0}return!1},st={},ut=()=>a||"./this.program",lt=()=>{if(!lt.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:ut()};for(var e in st)void 0===st[e]?delete r[e]:r[e]=st[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);lt.strings=t}return lt.strings},dt=(r,e)=>{var t=0,n=0;for(var o of lt()){var a=e+t;y[r+n>>2]=a,t+=_e(o,a,1/0)+1,n+=4}return 0},ct=(r,e)=>{var t=lt();y[r>>2]=t.length;var n=0;for(var o of t)n+=dr(o)+1;return y[e>>2]=n,0},ft=0,mt=()=>K||ft>0,ht=r=>{mt()||(o.onExit?.(r),F=!0),i(r,new V(r))},pt=(r,e)=>{ht(r)};function vt(r){try{var e=Pr.getStreamFromFD(r);return Ar.close(e),0}catch(t){if(void 0===Ar||"ErrnoError"!==t.name)throw t;return t.errno}}var wt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=y[e>>2],s=y[e+4>>2];e+=8;var u=Ar.read(r,m,i,s,n);if(u<0)return-1;if(o+=u,u<s)break}return o};function yt(r,e,t,n){try{var o=Pr.getStreamFromFD(r),a=wt(o,e,t);return y[n>>2]=a,0}catch(i){if(void 0===Ar||"ErrnoError"!==i.name)throw i;return i.errno}}var gt=9007199254740992,Et=-9007199254740992,kt=r=>r<Et||r>gt?NaN:Number(r);function _t(r,e,t,n){e=kt(e);try{if(isNaN(e))return 61;var o=Pr.getStreamFromFD(r);return Ar.llseek(o,e,t),k[n>>3]=BigInt(o.position),o.getdents&&0===e&&0===t&&(o.getdents=null),0}catch(a){if(void 0===Ar||"ErrnoError"!==a.name)throw a;return a.errno}}var bt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=y[e>>2],s=y[e+4>>2];e+=8;var u=Ar.write(r,m,i,s,n);if(u<0)return-1;if(o+=u,u<s)break}return o};function At(r,e,t,n){try{var o=Pr.getStreamFromFD(r),a=bt(o,e,t);return y[n>>2]=a,0}catch(i){if(void 0===Ar||"ErrnoError"!==i.name)throw i;return i.errno}}var Ft,Pt,Dt,St,Tt,xt,Ct,Nt=(r,e)=>{r<128?e.push(r):e.push(r%128|128,r>>7)},Mt=r=>{for(var e={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},t={parameters:[],results:"v"==r[0]?[]:[e[r[0]]]},n=1;n<r.length;++n)t.parameters.push(e[r[n]]);return t},Rt=(r,e)=>{var t=r.slice(0,1),n=r.slice(1),o={i:127,p:127,j:126,f:125,d:124,e:111};for(var a of(e.push(96),Nt(n.length,e),n))e.push(o[a]);"v"==t?e.push(0):e.push(1,o[t])},jt=(r,e)=>{if("function"==typeof WebAssembly.Function)return new WebAssembly.Function(Mt(e),r);var t=[1];Rt(e,t);var n=[0,97,115,109,1,0,0,0,1];Nt(t.length,n),n.push(...t),n.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var o=new WebAssembly.Module(new Uint8Array(n));return new WebAssembly.Instance(o,{e:{f:r}}).exports.f},Bt=(r,e)=>{if(Ft)for(var t=r;t<r+e;t++){var n=me(t);n&&Ft.set(n,t)}},Ot=r=>(Ft||(Ft=new WeakMap,Bt(0,se.length)),Ft.get(r)||0),Wt=[],zt=()=>{if(Wt.length)return Wt.pop();try{se.grow(1)}catch(A){if(!(A instanceof RangeError))throw A;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return se.length-1},$t=(r,e)=>{se.set(r,e),fe[r]=se.get(r)},It=(r,e)=>{var t=Ot(r);if(t)return t;var n=zt();try{$t(n,r)}catch(A){if(!(A instanceof TypeError))throw A;var o=jt(r,e);$t(n,o)}return Ft.set(r,n),n},Ut=(...r)=>Ar.createPath(...r),Lt=(...r)=>Ar.unlink(...r),Vt=(...r)=>Ar.createLazyFile(...r),Ht=(...r)=>Ar.createDevice(...r);function qt(r){Pt=r.$,o._malloc=Dt=r.ba,o._free=St=r.ca,Tt=r.da,xt=r.ea,Ct=r.fa}Ar.createPreloadedFile=kr,Ar.staticInit(),vr.doesNotExistError=new Ar.ErrnoError(44),vr.doesNotExistError.stack="<generic error, no stack>",o.noExitRuntime&&(K=o.noExitRuntime),o.preloadPlugins&&(gr=o.preloadPlugins),o.print&&(b=o.print),o.printErr&&(A=o.printErr),o.wasmBinary&&(l=o.wasmBinary),o.arguments&&o.arguments,o.thisProgram&&(a=o.thisProgram),o.addRunDependency=R,o.removeRunDependency=j,o.addFunction=It,o.UTF8ToString=Fr,o.FS_createPreloadedFile=kr,o.FS_unlink=Lt,o.FS_createPath=Ut,o.FS_createDevice=Ht,o.FS_createDataFile=yr,o.FS_createLazyFile=Vt;var Xt={j:rr,w:Dr,N:Sr,O:Tr,P:xr,z:$r,y:Xr,U:Yr,S:ee,x:ne,l:ge,d:Ee,b:ke,T:be,r:Ce,A:Ne,c:Me,V:Re,R:je,G:Be,X:ze,B:Le,a:Qr,Y:He,C:Ge,n:Ye,h:Ke,D:Je,i:Qe,s:Ze,W:rt,m:et,I:tt,H:it,K:dt,L:ct,Q:pt,u:vt,M:yt,J:_t,v:At,o:Yt,k:Qt,p:rn,t:en,F:nn,q:Zt,e:Kt,E:on,f:tn,g:Jt},Gt=await L();function Yt(r,e){var t=Q();try{return me(r)(e)}catch(n){if(J(t),n!==n+0)throw n;Tt(1,0)}}function Kt(r,e){var t=Q();try{me(r)(e)}catch(n){if(J(t),n!==n+0)throw n;Tt(1,0)}}function Jt(r,e,t,n){var o=Q();try{me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function Qt(r,e,t){var n=Q();try{return me(r)(e,t)}catch(o){if(J(n),o!==o+0)throw o;Tt(1,0)}}function Zt(r){var e=Q();try{me(r)()}catch(t){if(J(e),t!==t+0)throw t;Tt(1,0)}}function rn(r,e,t,n){var o=Q();try{return me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function en(r,e,t,n,o){var a=Q();try{return me(r)(e,t,n,o)}catch(i){if(J(a),i!==i+0)throw i;Tt(1,0)}}function tn(r,e,t){var n=Q();try{me(r)(e,t)}catch(o){if(J(n),o!==o+0)throw o;Tt(1,0)}}function nn(r,e,t,n,o,a,i,s,u,l){var d=Q();try{return me(r)(e,t,n,o,a,i,s,u,l)}catch(c){if(J(d),c!==c+0)throw c;Tt(1,0)}}function on(r,e,t,n){var o=Q();try{me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function an(){function r(){o.calledRun=!0,F||(T(),d?.(o),o.onRuntimeInitialized?.(),x())}N>0?M=an:(S(),N>0?M=an:o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),r()},1)):r())}function sn(){if(o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.shift()()}return sn(),an(),P?o:new Promise((r,e)=>{d=r,c=e})},r.exports=o,r.exports.default=o),n.exports;var r,e,o}var a=o();const i=e({__proto__:null,default:r(a)},[a]);export{i as l};
|
|
2
|
+
var r=async function(r={}){var e,t,n=r,o="./this.program",a=(r,e)=>{throw e},i="",s="";function u(r){return n.locateFile?n.locateFile(r,s):s+r}try{s=new URL(".",i).href}catch{}e=async r=>{var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)};var l,d,c,f,m,h,p,v,w,y,g,E,k,_,b=console.log.bind(console),F=console.error.bind(console),A=!1,P=!1;function D(){var r=f.buffer;m=new Int8Array(r),p=new Int16Array(r),n.HEAPU8=h=new Uint8Array(r),v=new Uint16Array(r),w=new Int32Array(r),n.HEAPU32=y=new Uint32Array(r),g=new Float32Array(r),n.HEAPF64=E=new Float64Array(r),k=new BigInt64Array(r),_=new BigUint64Array(r)}function S(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)Y(n.preRun.shift());H(G)}function T(){P=!0,n.noFSInit||Fr.initialized||Fr.init(),Gt._(),Fr.ignorePermissions=!1}function C(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)X(n.postRun.shift());H(q)}var x,N=0,R=null;function M(r){N++,n.monitorRunDependencies?.(N)}function B(r){if(N--,n.monitorRunDependencies?.(N),0==N&&R){var e=R;R=null,e()}}function W(r){n.onAbort?.(r),F(r="Aborted("+r+")"),A=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw c?.(e),e}function z(){return n.locateFile?u("lyr3DWorker.wasm"):new URL("lyr3DWorker.wasm","").href}function j(r){if(r==x&&l)return new Uint8Array(l);throw"both async and sync fetching of the wasm failed"}async function O(r){if(!l)try{var t=await e(r);return new Uint8Array(t)}catch{}return j(r)}async function $(r,e){try{var t=await O(r);return await WebAssembly.instantiate(t,e)}catch(n){F(`failed to asynchronously prepare wasm: ${n}`),W(n)}}async function I(r,e,t){if(!r&&"function"==typeof WebAssembly.instantiateStreaming)try{var n=fetch(e,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(o){F(`wasm streaming compile failed: ${o}`),F("falling back to ArrayBuffer instantiation")}return $(e,t)}function U(){return{a:Xt}}async function L(){function r(r,e){return Gt=r.exports,f=Gt.Z,D(),se=Gt.aa,qt(Gt),B(),Gt}function e(e){return r(e.instance)}M();var t=U();return n.instantiateWasm?new Promise((e,o)=>{n.instantiateWasm(t,(t,n)=>{e(r(t))})}):(x??=z(),e(await I(l,x,t)))}class V{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var H=r=>{for(;r.length>0;)r.shift()(n)},q=[],X=r=>q.push(r),G=[],Y=r=>G.push(r),K=!0,J=r=>Ct(r),Q=()=>xt();class Z{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){y[this.ptr+4>>2]=r}get_type(){return y[this.ptr+4>>2]}set_destructor(r){y[this.ptr+8>>2]=r}get_destructor(){return y[this.ptr+8>>2]}set_caught(r){r=r?1:0,m[this.ptr+12]=r}get_caught(){return 0!=m[this.ptr+12]}set_rethrown(r){r=r?1:0,m[this.ptr+13]=r}get_rethrown(){return 0!=m[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){y[this.ptr+16>>2]=r}get_adjusted_ptr(){return y[this.ptr+16>>2]}}var rr=(r,e,t)=>{throw new Z(r).init(e,t),r},er=()=>{var r=w[+Pr.varargs>>2];return Pr.varargs+=4,r},tr=er,nr={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=nr.isAbs(r),t="/"===r.slice(-1);return(r=nr.normalizeArray(r.split("/").filter(r=>!!r),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=nr.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.slice(0,-1)),t+n):"."},basename:r=>r&&r.match(/([^\/]+|\/)\/*$/)[1],join:(...r)=>nr.normalize(r.join("/")),join2:(r,e)=>nr.normalize(r+"/"+e)},or=()=>r=>crypto.getRandomValues(r),ar=r=>{(ar=or())(r)},ir={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:Fr.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=nr.isAbs(o)}return(t?"/":"")+(e=nr.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=ir.resolve(r).slice(1),e=ir.resolve(e).slice(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 u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},sr="undefined"!=typeof TextDecoder?new TextDecoder:void 0,ur=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&sr)return sr.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 u=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var l=i-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},lr=[],dr=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},cr=(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.codePointAt(i);if(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,i++}}return e[t]=0,t-o},fr=(r,e,t)=>{var n=dr(r)+1,o=new Array(n),a=cr(r,o,0,o.length);return o.length=a,o},mr=()=>{if(!lr.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;lr=fr(r)}return lr.shift()},hr={ttys:[],init(){},shutdown(){},register(r,e){hr.ttys[r]={input:[],output:[],ops:e},Fr.registerDevice(r,hr.stream_ops)},stream_ops:{open(r){var e=hr.ttys[r.node.rdev];if(!e)throw new Fr.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 Fr.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(u){throw new Fr.ErrnoError(29)}if(void 0===s&&0===a)throw new Fr.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 Fr.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(i){throw new Fr.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char:r=>mr(),put_char(r,e){null===e||10===e?(b(ur(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output?.length>0&&(b(ur(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?(F(ur(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output?.length>0&&(F(ur(r.output)),r.output=[])}}},pr=r=>{W()},vr={ops_table:null,mount:r=>vr.createNode(null,"/",16895,0),createNode(r,e,t,n){if(Fr.isBlkdev(t)||Fr.isFIFO(t))throw new Fr.ErrnoError(63);vr.ops_table||={dir:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr,lookup:vr.node_ops.lookup,mknod:vr.node_ops.mknod,rename:vr.node_ops.rename,unlink:vr.node_ops.unlink,rmdir:vr.node_ops.rmdir,readdir:vr.node_ops.readdir,symlink:vr.node_ops.symlink},stream:{llseek:vr.stream_ops.llseek}},file:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr},stream:{llseek:vr.stream_ops.llseek,read:vr.stream_ops.read,write:vr.stream_ops.write,mmap:vr.stream_ops.mmap,msync:vr.stream_ops.msync}},link:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr,readlink:vr.node_ops.readlink},stream:{}},chrdev:{node:{getattr:vr.node_ops.getattr,setattr:vr.node_ops.setattr},stream:Fr.chrdev_stream_ops}};var o=Fr.createNode(r,e,t,n);return Fr.isDir(o.mode)?(o.node_ops=vr.ops_table.dir.node,o.stream_ops=vr.ops_table.dir.stream,o.contents={}):Fr.isFile(o.mode)?(o.node_ops=vr.ops_table.file.node,o.stream_ops=vr.ops_table.file.stream,o.usedBytes=0,o.contents=null):Fr.isLink(o.mode)?(o.node_ops=vr.ops_table.link.node,o.stream_ops=vr.ops_table.link.stream):Fr.isChrdev(o.mode)&&(o.node_ops=vr.ops_table.chrdev.node,o.stream_ops=vr.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=Fr.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,Fr.isDir(r.mode)?e.size=4096:Fr.isFile(r.mode)?e.size=r.usedBytes:Fr.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"])null!=e[t]&&(r[t]=e[t]);void 0!==e.size&&vr.resizeFileStorage(r,e.size)},lookup(r,e){throw vr.doesNotExistError},mknod:(r,e,t,n)=>vr.createNode(r,e,t,n),rename(r,e,t){var n;try{n=Fr.lookupNode(e,t)}catch(a){}if(n){if(Fr.isDir(r.mode))for(var o in n.contents)throw new Fr.ErrnoError(55);Fr.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=Fr.lookupNode(r,e);for(var n in t.contents)throw new Fr.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir:r=>[".","..",...Object.keys(r.contents)],symlink(r,e,t){var n=vr.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!Fr.isLink(r.mode))throw new Fr.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===m.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(vr.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&&Fr.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new Fr.ErrnoError(28);return n},mmap(r,e,t,n,o){if(!Fr.isFile(r.node.mode))throw new Fr.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==m.buffer){if(i=!0,!(a=pr()))throw new Fr.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)),m.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(vr.stream_ops.write(r,e,0,n,t,!1),0)}},wr=async r=>{var t=await e(r);return new Uint8Array(t)},yr=(...r)=>Fr.createDataFile(...r),gr=[],Er=(r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return gr.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},kr=(r,e,t,n,o,a,i,s,u,l)=>{var d=e?ir.resolve(nr.join2(r,e)):r;function c(t){function c(t){l?.(),s||yr(r,e,t,n,o,u),a?.(),B()}Er(t,d,c,()=>{i?.(),B()})||c(t)}M(),"string"==typeof t?wr(t).then(c,i):c(t)},_r=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},br=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},Fr={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},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=Fr.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 Fr.isDir(this.mode)}get isDevice(){return Fr.isChrdev(this.mode)}},lookupPath(r,e={}){if(!r)throw new Fr.ErrnoError(44);e.follow_mount??=!0,nr.isAbs(r)||(r=Fr.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter(r=>!!r),o=Fr.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if("."!==n[i])if(".."!==n[i]){a=nr.join2(a,n[i]);try{o=Fr.lookupNode(o,n[i])}catch(l){if(44===l?.errno&&s&&e.noent_okay)return{path:a};throw l}if(!Fr.isMountpoint(o)||s&&!e.follow_mount||(o=o.mounted.root),Fr.isLink(o.mode)&&(!s||e.follow)){if(!o.node_ops.readlink)throw new Fr.ErrnoError(52);var u=o.node_ops.readlink(o);nr.isAbs(u)||(u=nr.dirname(a)+"/"+u),r=u+"/"+n.slice(i+1).join("/");continue r}}else{if(a=nr.dirname(a),Fr.isRoot(o)){r=a+"/"+n.slice(i+1).join("/");continue r}o=o.parent}}return{path:a,node:o}}throw new Fr.ErrnoError(32)},getPath(r){for(var e;;){if(Fr.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)%Fr.nameTable.length},hashAddNode(r){var e=Fr.hashName(r.parent.id,r.name);r.name_next=Fr.nameTable[e],Fr.nameTable[e]=r},hashRemoveNode(r){var e=Fr.hashName(r.parent.id,r.name);if(Fr.nameTable[e]===r)Fr.nameTable[e]=r.name_next;else for(var t=Fr.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=Fr.mayLookup(r);if(t)throw new Fr.ErrnoError(t);for(var n=Fr.hashName(r.id,e),o=Fr.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return Fr.lookup(r,e)},createNode(r,e,t,n){var o=new Fr.FSNode(r,e,t,n);return Fr.hashAddNode(o),o},destroyNode(r){Fr.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)=>Fr.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!Fr.isDir(r.mode))return 54;var e=Fr.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){if(!Fr.isDir(r.mode))return 54;try{return Fr.lookupNode(r,e),20}catch(t){}return Fr.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=Fr.lookupNode(r,e)}catch(a){return a.errno}var o=Fr.nodePermissions(r,"wx");if(o)return o;if(t){if(!Fr.isDir(n.mode))return 54;if(Fr.isRoot(n)||Fr.getPath(n)===Fr.cwd())return 10}else if(Fr.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?Fr.isLink(r.mode)?32:Fr.isDir(r.mode)&&("r"!==Fr.flagsToPermissionString(e)||576&e)?31:Fr.nodePermissions(r,Fr.flagsToPermissionString(e)):44,checkOpExists(r,e){if(!r)throw new Fr.ErrnoError(e);return r},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=Fr.MAX_OPEN_FDS;r++)if(!Fr.streams[r])return r;throw new Fr.ErrnoError(33)},getStreamChecked(r){var e=Fr.getStream(r);if(!e)throw new Fr.ErrnoError(8);return e},getStream:r=>Fr.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new Fr.FSStream,r),-1==e&&(e=Fr.nextfd()),r.fd=e,Fr.streams[e]=r,r),closeStream(r){Fr.streams[r]=null},dupStream(r,e=-1){var t=Fr.createStream(r,e);return t.stream_ops?.dup?.(t),t},doSetAttr(r,e,t){var n=r?.stream_ops.setattr,o=n?r:e;n??=e.node_ops.setattr,Fr.checkOpExists(n,63),n(o,t)},chrdev_stream_ops:{open(r){var e=Fr.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new Fr.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){Fr.devices[r]={stream_ops:e}},getDevice:r=>Fr.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),Fr.syncFSRequests++,Fr.syncFSRequests>1&&F(`warning: ${Fr.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=Fr.getMounts(Fr.root.mount),n=0;function o(r){return Fr.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&&Fr.root)throw new Fr.ErrnoError(10);if(!o&&!a){var i=Fr.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,Fr.isMountpoint(n))throw new Fr.ErrnoError(10);if(!Fr.isDir(n.mode))throw new Fr.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},u=r.mount(s);return u.mount=s,s.root=u,o?Fr.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(r){var e=Fr.lookupPath(r,{follow_mount:!1});if(!Fr.isMountpoint(e.node))throw new Fr.ErrnoError(28);var t=e.node,n=t.mounted,o=Fr.getMounts(n);Object.keys(Fr.nameTable).forEach(r=>{for(var e=Fr.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&Fr.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=Fr.lookupPath(r,{parent:!0}).node,o=nr.basename(r);if(!o)throw new Fr.ErrnoError(28);if("."===o||".."===o)throw new Fr.ErrnoError(20);var a=Fr.mayCreate(n,o);if(a)throw new Fr.ErrnoError(a);if(!n.node_ops.mknod)throw new Fr.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs:r=>Fr.statfsNode(Fr.lookupPath(r,{follow:!0}).node),statfsStream:r=>Fr.statfsNode(r.node),statfsNode(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Fr.nextInode,ffree:Fr.nextInode-1,fsid:42,flags:2,namelen:255};return r.node_ops.statfs&&Object.assign(e,r.node_ops.statfs(r.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,Fr.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,Fr.mknod(r,e,0)),mkdirTree(r,e){var t=r.split("/"),n="";for(var o of t)if(o){(n||nr.isAbs(r))&&(n+="/"),n+=o;try{Fr.mkdir(n,e)}catch(a){if(20!=a.errno)throw a}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,Fr.mknod(r,e,t)),symlink(r,e){if(!ir.resolve(r))throw new Fr.ErrnoError(44);var t=Fr.lookupPath(e,{parent:!0}).node;if(!t)throw new Fr.ErrnoError(44);var n=nr.basename(e),o=Fr.mayCreate(t,n);if(o)throw new Fr.ErrnoError(o);if(!t.node_ops.symlink)throw new Fr.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=nr.dirname(r),a=nr.dirname(e),i=nr.basename(r),s=nr.basename(e);if(t=Fr.lookupPath(r,{parent:!0}).node,n=Fr.lookupPath(e,{parent:!0}).node,!t||!n)throw new Fr.ErrnoError(44);if(t.mount!==n.mount)throw new Fr.ErrnoError(75);var u,l=Fr.lookupNode(t,i),d=ir.relative(r,a);if("."!==d.charAt(0))throw new Fr.ErrnoError(28);if("."!==(d=ir.relative(e,o)).charAt(0))throw new Fr.ErrnoError(55);try{u=Fr.lookupNode(n,s)}catch(m){}if(l!==u){var c=Fr.isDir(l.mode),f=Fr.mayDelete(t,i,c);if(f)throw new Fr.ErrnoError(f);if(f=u?Fr.mayDelete(n,s,c):Fr.mayCreate(n,s))throw new Fr.ErrnoError(f);if(!t.node_ops.rename)throw new Fr.ErrnoError(63);if(Fr.isMountpoint(l)||u&&Fr.isMountpoint(u))throw new Fr.ErrnoError(10);if(n!==t&&(f=Fr.nodePermissions(t,"w")))throw new Fr.ErrnoError(f);Fr.hashRemoveNode(l);try{t.node_ops.rename(l,n,s),l.parent=n}catch(m){throw m}finally{Fr.hashAddNode(l)}}},rmdir(r){var e=Fr.lookupPath(r,{parent:!0}).node,t=nr.basename(r),n=Fr.lookupNode(e,t),o=Fr.mayDelete(e,t,!0);if(o)throw new Fr.ErrnoError(o);if(!e.node_ops.rmdir)throw new Fr.ErrnoError(63);if(Fr.isMountpoint(n))throw new Fr.ErrnoError(10);e.node_ops.rmdir(e,t),Fr.destroyNode(n)},readdir(r){var e=Fr.lookupPath(r,{follow:!0}).node;return Fr.checkOpExists(e.node_ops.readdir,54)(e)},unlink(r){var e=Fr.lookupPath(r,{parent:!0}).node;if(!e)throw new Fr.ErrnoError(44);var t=nr.basename(r),n=Fr.lookupNode(e,t),o=Fr.mayDelete(e,t,!1);if(o)throw new Fr.ErrnoError(o);if(!e.node_ops.unlink)throw new Fr.ErrnoError(63);if(Fr.isMountpoint(n))throw new Fr.ErrnoError(10);e.node_ops.unlink(e,t),Fr.destroyNode(n)},readlink(r){var e=Fr.lookupPath(r).node;if(!e)throw new Fr.ErrnoError(44);if(!e.node_ops.readlink)throw new Fr.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=Fr.lookupPath(r,{follow:!e}).node;return Fr.checkOpExists(t.node_ops.getattr,63)(t)},fstat(r){var e=Fr.getStreamChecked(r),t=e.node,n=e.stream_ops.getattr,o=n?e:t;return n??=t.node_ops.getattr,Fr.checkOpExists(n,63),n(o)},lstat:r=>Fr.stat(r,!0),doChmod(r,e,t,n){Fr.doSetAttr(r,e,{mode:4095&t|-4096&e.mode,ctime:Date.now(),dontFollow:n})},chmod(r,e,t){var n;n="string"==typeof r?Fr.lookupPath(r,{follow:!t}).node:r,Fr.doChmod(null,n,e,t)},lchmod(r,e){Fr.chmod(r,e,!0)},fchmod(r,e){var t=Fr.getStreamChecked(r);Fr.doChmod(t,t.node,e,!1)},doChown(r,e,t){Fr.doSetAttr(r,e,{timestamp:Date.now(),dontFollow:t})},chown(r,e,t,n){var o;o="string"==typeof r?Fr.lookupPath(r,{follow:!n}).node:r,Fr.doChown(null,o,n)},lchown(r,e,t){Fr.chown(r,e,t,!0)},fchown(r,e,t){var n=Fr.getStreamChecked(r);Fr.doChown(n,n.node,!1)},doTruncate(r,e,t){if(Fr.isDir(e.mode))throw new Fr.ErrnoError(31);if(!Fr.isFile(e.mode))throw new Fr.ErrnoError(28);var n=Fr.nodePermissions(e,"w");if(n)throw new Fr.ErrnoError(n);Fr.doSetAttr(r,e,{size:t,timestamp:Date.now()})},truncate(r,e){if(e<0)throw new Fr.ErrnoError(28);var t;t="string"==typeof r?Fr.lookupPath(r,{follow:!0}).node:r,Fr.doTruncate(null,t,e)},ftruncate(r,e){var t=Fr.getStreamChecked(r);if(e<0||!(2097155&t.flags))throw new Fr.ErrnoError(28);Fr.doTruncate(t,t.node,e)},utime(r,e,t){var n=Fr.lookupPath(r,{follow:!0}).node;Fr.checkOpExists(n.node_ops.setattr,63)(n,{atime:e,mtime:t})},open(r,e,t=438){if(""===r)throw new Fr.ErrnoError(44);var o,a;if(t=64&(e="string"==typeof e?_r(e):e)?4095&t|32768:0,"object"==typeof r)o=r;else{a=r.endsWith("/");var i=Fr.lookupPath(r,{follow:!(131072&e),noent_okay:!0});o=i.node,r=i.path}var s=!1;if(64&e)if(o){if(128&e)throw new Fr.ErrnoError(20)}else{if(a)throw new Fr.ErrnoError(31);o=Fr.mknod(r,511|t,0),s=!0}if(!o)throw new Fr.ErrnoError(44);if(Fr.isChrdev(o.mode)&&(e&=-513),65536&e&&!Fr.isDir(o.mode))throw new Fr.ErrnoError(54);if(!s){var u=Fr.mayOpen(o,e);if(u)throw new Fr.ErrnoError(u)}512&e&&!s&&Fr.truncate(o,0),e&=-131713;var l=Fr.createStream({node:o,path:Fr.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),s&&Fr.chmod(o,511&t),!n.logReadFiles||1&e||r in Fr.readFiles||(Fr.readFiles[r]=1),l},close(r){if(Fr.isClosed(r))throw new Fr.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{Fr.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(Fr.isClosed(r))throw new Fr.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new Fr.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new Fr.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 Fr.ErrnoError(28);if(Fr.isClosed(r))throw new Fr.ErrnoError(8);if(1==(2097155&r.flags))throw new Fr.ErrnoError(8);if(Fr.isDir(r.node.mode))throw new Fr.ErrnoError(31);if(!r.stream_ops.read)throw new Fr.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new Fr.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 Fr.ErrnoError(28);if(Fr.isClosed(r))throw new Fr.ErrnoError(8);if(!(2097155&r.flags))throw new Fr.ErrnoError(8);if(Fr.isDir(r.node.mode))throw new Fr.ErrnoError(31);if(!r.stream_ops.write)throw new Fr.ErrnoError(28);r.seekable&&1024&r.flags&&Fr.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new Fr.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new Fr.ErrnoError(2);if(1==(2097155&r.flags))throw new Fr.ErrnoError(2);if(!r.stream_ops.mmap)throw new Fr.ErrnoError(43);if(!e)throw new Fr.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 Fr.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=Fr.open(r,e.flags),n=Fr.stat(r).size,o=new Uint8Array(n);return Fr.read(t,o,0,n,0),"utf8"===e.encoding&&(o=ur(o)),Fr.close(t),o},writeFile(r,e,t={}){t.flags=t.flags||577;var n=Fr.open(r,t.flags,t.mode);if("string"==typeof e&&(e=new Uint8Array(fr(e))),!ArrayBuffer.isView(e))throw new Error("Unsupported data type");Fr.write(n,e,0,e.byteLength,void 0,t.canOwn),Fr.close(n)},cwd:()=>Fr.currentPath,chdir(r){var e=Fr.lookupPath(r,{follow:!0});if(null===e.node)throw new Fr.ErrnoError(44);if(!Fr.isDir(e.node.mode))throw new Fr.ErrnoError(54);var t=Fr.nodePermissions(e.node,"x");if(t)throw new Fr.ErrnoError(t);Fr.currentPath=e.path},createDefaultDirectories(){Fr.mkdir("/tmp"),Fr.mkdir("/home"),Fr.mkdir("/home/web_user")},createDefaultDevices(){Fr.mkdir("/dev"),Fr.registerDevice(Fr.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),Fr.mkdev("/dev/null",Fr.makedev(1,3)),hr.register(Fr.makedev(5,0),hr.default_tty_ops),hr.register(Fr.makedev(6,0),hr.default_tty1_ops),Fr.mkdev("/dev/tty",Fr.makedev(5,0)),Fr.mkdev("/dev/tty1",Fr.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(ar(r),e=r.byteLength),r[--e]);Fr.createDevice("/dev","random",t),Fr.createDevice("/dev","urandom",t),Fr.mkdir("/dev/shm"),Fr.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Fr.mkdir("/proc");var r=Fr.mkdir("/proc/self");Fr.mkdir("/proc/self/fd"),Fr.mount({mount(){var e=Fr.createNode(r,"fd",16895,73);return e.stream_ops={llseek:vr.stream_ops.llseek},e.node_ops={lookup(r,e){var t=+e,n=Fr.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(Fr.streams.entries()).filter(([r,e])=>e).map(([r,e])=>r.toString())},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?Fr.createDevice("/dev","stdin",r):Fr.symlink("/dev/tty","/dev/stdin"),e?Fr.createDevice("/dev","stdout",null,e):Fr.symlink("/dev/tty","/dev/stdout"),t?Fr.createDevice("/dev","stderr",null,t):Fr.symlink("/dev/tty1","/dev/stderr"),Fr.open("/dev/stdin",0),Fr.open("/dev/stdout",1),Fr.open("/dev/stderr",1)},staticInit(){Fr.nameTable=new Array(4096),Fr.mount(vr,{},"/"),Fr.createDefaultDirectories(),Fr.createDefaultDevices(),Fr.createSpecialDirectories(),Fr.filesystems={MEMFS:vr}},init(r,e,t){Fr.initialized=!0,r??=n.stdin,e??=n.stdout,t??=n.stderr,Fr.createStandardStreams(r,e,t)},quit(){for(var r of(Fr.initialized=!1,Fr.streams))r&&Fr.close(r)},findObject(r,e){var t=Fr.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=Fr.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=Fr.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=nr.basename(r),n=Fr.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:Fr.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=nr.join2(r,a);try{Fr.mkdir(i)}catch(s){if(20!=s.errno)throw s}r=i}}return i},createFile(r,e,t,n,o){var a=nr.join2("string"==typeof r?r:Fr.getPath(r),e),i=br(n,o);return Fr.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:Fr.getPath(r),i=e?nr.join2(r,e):r);var s=br(n,o),u=Fr.create(i,s);if(t){if("string"==typeof t){for(var l=new Array(t.length),d=0,c=t.length;d<c;++d)l[d]=t.charCodeAt(d);t=l}Fr.chmod(u,146|s);var f=Fr.open(u,577);Fr.write(f,t,0,t.length,0,a),Fr.close(f),Fr.chmod(u,s)}},createDevice(r,e,t,n){var o=nr.join2("string"==typeof r?r:Fr.getPath(r),e),a=br(!!t,!!n);Fr.createDevice.major??=64;var i=Fr.makedev(Fr.createDevice.major++,0);return Fr.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 u;try{u=t()}catch(l){throw new Fr.ErrnoError(29)}if(void 0===u&&0===i)throw new Fr.ErrnoError(6);if(null==u)break;i++,e[n+s]=u}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 Fr.ErrnoError(29)}return o&&(r.node.mtime=r.node.ctime=Date.now()),i}}),Fr.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=t(r.url),r.usedBytes=r.contents.length}catch(e){throw new Fr.ErrnoError(29)}},createLazyFile(r,e,t,n,o){if("undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a={isDevice:!1,url:t},i=Fr.createFile(r,e,a,n,o);a.contents?i.contents=a.contents:a.url&&(i.contents=null,i.url=a.url),Object.defineProperties(i,{usedBytes:{get:function(){return this.contents.length}}});var s={};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(i.stream_ops).forEach(r=>{var e=i.stream_ops[r];s[r]=(...r)=>(Fr.forceLoadFile(i),e(...r))}),s.read=(r,e,t,n,o)=>(Fr.forceLoadFile(i),u(r,e,t,n,o)),s.mmap=(r,e,t,n,o)=>{Fr.forceLoadFile(i);var a=pr();if(!a)throw new Fr.ErrnoError(48);return u(r,m,a,e,t),{ptr:a,allocated:!0}},i.stream_ops=s,i}},Ar=(r,e)=>r?ur(h,r,e):"",Pr={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(nr.isAbs(e))return e;var n;if(n=-100===r?Fr.cwd():Pr.getStreamFromFD(r).path,0==e.length){if(!t)throw new Fr.ErrnoError(44);return n}return n+"/"+e},writeStat(r,e){w[r>>2]=e.dev,w[r+4>>2]=e.mode,y[r+8>>2]=e.nlink,w[r+12>>2]=e.uid,w[r+16>>2]=e.gid,w[r+20>>2]=e.rdev,k[r+24>>3]=BigInt(e.size),w[r+32>>2]=4096,w[r+36>>2]=e.blocks;var t=e.atime.getTime(),n=e.mtime.getTime(),o=e.ctime.getTime();return k[r+40>>3]=BigInt(Math.floor(t/1e3)),y[r+48>>2]=t%1e3*1e3*1e3,k[r+56>>3]=BigInt(Math.floor(n/1e3)),y[r+64>>2]=n%1e3*1e3*1e3,k[r+72>>3]=BigInt(Math.floor(o/1e3)),y[r+80>>2]=o%1e3*1e3*1e3,k[r+88>>3]=BigInt(e.ino),0},writeStatFs(r,e){w[r+4>>2]=e.bsize,w[r+40>>2]=e.bsize,w[r+8>>2]=e.blocks,w[r+12>>2]=e.bfree,w[r+16>>2]=e.bavail,w[r+20>>2]=e.files,w[r+24>>2]=e.ffree,w[r+28>>2]=e.fsid,w[r+44>>2]=e.flags,w[r+36>>2]=e.namelen},doMsync(r,e,t,n,o){if(!Fr.isFile(e.node.mode))throw new Fr.ErrnoError(43);if(2&n)return 0;var a=h.slice(r,r+t);Fr.msync(e,a,o,t,n)},getStreamFromFD:r=>Fr.getStreamChecked(r),varargs:void 0,getStr:r=>Ar(r)};function Dr(r,e,t){Pr.varargs=t;try{var n=Pr.getStreamFromFD(r);switch(e){case 0:if((o=er())<0)return-28;for(;Fr.streams[o];)o++;return Fr.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=er();return n.flags|=o,0;case 12:return o=tr(),p[o+0>>1]=2,0}return-28}catch(a){if(void 0===Fr||"ErrnoError"!==a.name)throw a;return-a.errno}}function Sr(r,e,t){Pr.varargs=t;try{var n=Pr.getStreamFromFD(r);switch(e){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=tr();w[a>>2]=o.c_iflag||0,w[a+4>>2]=o.c_oflag||0,w[a+8>>2]=o.c_cflag||0,w[a+12>>2]=o.c_lflag||0;for(var i=0;i<32;i++)m[a+i+17]=o.c_cc[i]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){a=tr();var s=w[a>>2],u=w[a+4>>2],l=w[a+8>>2],d=w[a+12>>2],c=[];for(i=0;i<32;i++)c.push(m[a+i+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:s,c_oflag:u,c_cflag:l,c_lflag:d,c_cc:c})}return 0;case 21519:return n.tty?(a=tr(),w[a>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return a=tr(),Fr.ioctl(n,e,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var f=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=tr(),p[a>>1]=f[0],p[a+2>>1]=f[1]}return 0;default:return-28}}catch(h){if(void 0===Fr||"ErrnoError"!==h.name)throw h;return-h.errno}}function Tr(r,e,t,n){Pr.varargs=n;try{e=Pr.getStr(e),e=Pr.calculateAt(r,e);var o=n?er():0;return Fr.open(e,t,o).fd}catch(a){if(void 0===Fr||"ErrnoError"!==a.name)throw a;return-a.errno}}var Cr=()=>W(""),xr={},Nr=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function Rr(r){return this.fromWireType(y[r>>2])}var Mr={},Br={},Wr={},zr=class extends Error{constructor(r){super(r),this.name="InternalError"}},jr=r=>{throw new zr(r)},Or=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&jr("Mismatched type converter count");for(var o=0;o<r.length;++o)Hr(r[o],n[o])}r.forEach(r=>Wr[r]=e);var o=new Array(e.length),a=[],i=0;e.forEach((r,e)=>{Br.hasOwnProperty(r)?o[e]=Br[r]:(a.push(r),Mr.hasOwnProperty(r)||(Mr[r]=[]),Mr[r].push(()=>{o[e]=Br[r],++i===a.length&&n(o)}))}),0===a.length&&n(o)},$r=r=>{var e=xr[r];delete xr[r];var t=e.rawConstructor,n=e.rawDestructor,o=e.fields,a=o.map(r=>r.getterReturnType).concat(o.map(r=>r.setterArgumentType));Or([r],a,r=>{var a={};return o.forEach((e,t)=>{var n=e.fieldName,i=r[t],s=r[t].optional,u=e.getter,l=e.getterContext,d=r[t+o.length],c=e.setter,f=e.setterContext;a[n]={read:r=>i.fromWireType(u(l,r)),write:(r,e)=>{var t=[];c(f,r,d.toWireType(t,e)),Nr(t)},optional:s}}),[{name:e.name,fromWireType:r=>{var e={};for(var t in a)e[t]=a[t].read(r);return n(r),e},toWireType:(r,e)=>{for(var o in a)if(!(o in e)&&!a[o].optional)throw new TypeError(`Missing field: "${o}"`);var i=t();for(o in a)a[o].write(i,e[o]);return null!==r&&r.push(n,i),i},argPackAdvance:Gr,readValueFromPointer:Rr,destructorFunction:n}]})},Ir=r=>{for(var e="";;){var t=h[r++];if(!t)return e;e+=String.fromCharCode(t)}},Ur=class extends Error{constructor(r){super(r),this.name="BindingError"}},Lr=r=>{throw new Ur(r)};function Vr(r,e,t={}){var n=e.name;if(r||Lr(`type "${n}" must have a positive integer typeid pointer`),Br.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;Lr(`Cannot register type '${n}' twice`)}if(Br[r]=e,delete Wr[r],Mr.hasOwnProperty(r)){var o=Mr[r];delete Mr[r],o.forEach(r=>r())}}function Hr(r,e,t={}){return Vr(r,e,t)}var qr=(r,e,t)=>{switch(e){case 1:return t?r=>m[r]:r=>h[r];case 2:return t?r=>p[r>>1]:r=>v[r>>1];case 4:return t?r=>w[r>>2]:r=>y[r>>2];case 8:return t?r=>k[r>>3]:r=>_[r>>3];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Xr=(r,e,t,n,o)=>{e=Ir(e);const a=0n===n;let i=r=>r;if(a){const r=8*t;i=e=>BigInt.asUintN(r,e),o=i(o)}Hr(r,{name:e,fromWireType:i,toWireType:(r,e)=>("number"==typeof e&&(e=BigInt(e)),e),argPackAdvance:Gr,readValueFromPointer:qr(e,t,!a),destructorFunction:null})},Gr=8,Yr=(r,e,t,n)=>{Hr(r,{name:e=Ir(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:Gr,readValueFromPointer:function(r){return this.fromWireType(h[r])},destructorFunction:null})},Kr=[],Jr=[0,1,,1,null,1,!0,1,!1,1],Qr=r=>{r>9&&0===--Jr[r+1]&&(Jr[r]=void 0,Kr.push(r))},Zr={toValue:r=>(r||Lr(`Cannot use deleted val. handle = ${r}`),Jr[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=Kr.pop()||Jr.length;return Jr[e]=r,Jr[e+1]=1,e}}}},re={name:"emscripten::val",fromWireType:r=>{var e=Zr.toValue(r);return Qr(r),e},toWireType:(r,e)=>Zr.toHandle(e),argPackAdvance:Gr,readValueFromPointer:Rr,destructorFunction:null},ee=r=>Hr(r,re),te=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(g[r>>2])};case 8:return function(r){return this.fromWireType(E[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},ne=(r,e,t)=>{Hr(r,{name:e=Ir(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:Gr,readValueFromPointer:te(e,t),destructorFunction:null})},oe=(r,e)=>Object.defineProperty(e,"name",{value:r});function ae(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function ie(r,e,t,n,o,a){var i=e.length;i<2&&Lr("argTypes array size mismatch! Must at least get return value and 'this' types!"),e[1];var s=ae(e),u="void"!==e[0].name,l=i-2,d=new Array(l),c=[],f=[];return oe(r,function(...r){var t;f.length=0,c.length=1,c[0]=o;for(var a=0;a<l;++a)d[a]=e[a+2].toWireType(f,r[a]),c.push(d[a]);function i(r){if(s)Nr(f);else for(var n=2;n<e.length;n++){var o=1===n?t:d[n-2];null!==e[n].destructorFunction&&e[n].destructorFunction(o)}if(u)return e[0].fromWireType(r)}return i(n(...c))})}var se,ue=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||Lr(`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}},le=(r,e,t)=>{n.hasOwnProperty(r)?((void 0===t||void 0!==n[r].overloadTable&&void 0!==n[r].overloadTable[t])&&Lr(`Cannot register public name '${r}' twice`),ue(n,r,r),n[r].overloadTable.hasOwnProperty(t)&&Lr(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),n[r].overloadTable[t]=e):(n[r]=e,n[r].argCount=t)},de=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(y[e+4*n>>2]);return t},ce=(r,e,t)=>{n.hasOwnProperty(r)||jr("Replacing nonexistent public symbol"),void 0!==n[r].overloadTable&&void 0!==t?n[r].overloadTable[t]=e:(n[r]=e,n[r].argCount=t)},fe=[],me=r=>{var e=fe[r];return e||(fe[r]=e=se.get(r)),e},he=(r,e,t=!1)=>{function n(){return me(e)}r=Ir(r);var o=n();return"function"!=typeof o&&Lr(`unknown function pointer with signature ${r}: ${e}`),o};class pe extends Error{}var ve=r=>{var e=Pt(r),t=Ir(e);return St(e),t},we=(r,e)=>{var t=[],n={};function o(r){n[r]||Br[r]||(Wr[r]?Wr[r].forEach(o):(t.push(r),n[r]=!0))}throw e.forEach(o),new pe(`${r}: `+t.map(ve).join([", "]))},ye=r=>{const e=(r=r.trim()).indexOf("(");return-1===e?r:r.slice(0,e)},ge=(r,e,t,n,o,a,i,s)=>{var u=de(e,t);r=Ir(r),r=ye(r),o=he(n,o,i),le(r,function(){we(`Cannot call ${r} due to unbound types`,u)},e-1),Or([],u,t=>{var n=[t[0],null].concat(t.slice(1));return ce(r,ie(r,n,null,o,a),e-1),[]})},Ee=(r,e,t,n,o)=>{e=Ir(e);let a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i,o=a(o)}Hr(r,{name:e,fromWireType:a,toWireType:(r,e)=>e,argPackAdvance:Gr,readValueFromPointer:qr(e,t,0!==n),destructorFunction:null})},ke=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][e];function o(r){var e=y[r>>2],t=y[r+4>>2];return new n(m.buffer,t,e)}Hr(r,{name:t=Ir(t),fromWireType:o,argPackAdvance:Gr,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},_e=(r,e,t)=>cr(r,h,e,t),be=(r,e)=>{Hr(r,{name:e=Ir(e),fromWireType(r){for(var e,t=y[r>>2],n=r+4,o=n,a=0;a<=t;++a){var i=n+a;if(a==t||0==h[i]){var s=Ar(o,i-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=i+1}}return St(r),e},toWireType(r,e){var t;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||ArrayBuffer.isView(e)&&1==e.BYTES_PER_ELEMENT||Lr("Cannot pass non-string to std::string"),t=n?dr(e):e.length;var o=Dt(4+t+1),a=o+4;return y[o>>2]=t,n?_e(e,a,t+1):h.set(e,a),null!==r&&r.push(St,o),o},argPackAdvance:Gr,readValueFromPointer:Rr,destructorFunction(r){St(r)}})},Fe="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Ae=(r,e)=>{for(var t=r>>1,n=t+e/2,o=t;!(o>=n)&&v[o];)++o;if(o-t>16&&Fe)return Fe.decode(v.subarray(t,o));for(var a="",i=t;!(i>=n);++i){var s=v[i];if(0==s)break;a+=String.fromCharCode(s)}return a},Pe=(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);p[e>>1]=i,e+=2}return p[e>>1]=0,e-n},De=r=>2*r.length,Se=(r,e)=>{for(var t="",n=0;!(n>=e/4);n++){var o=w[r+4*n>>2];if(!o)break;t+=String.fromCodePoint(o)}return t},Te=(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.codePointAt(a);if(i>65535&&a++,w[e>>2]=i,(e+=4)+4>o)break}return w[e>>2]=0,e-n},Ce=r=>{for(var e=0,t=0;t<r.length;++t)r.codePointAt(t)>65535&&t++,e+=4;return e},xe=(r,e,t)=>{var n,o,a,i;t=Ir(t),2===e?(n=Ae,o=Pe,i=De,a=r=>v[r>>1]):4===e&&(n=Se,o=Te,i=Ce,a=r=>y[r>>2]),Hr(r,{name:t,fromWireType:r=>{for(var t,o=y[r>>2],i=r+4,s=0;s<=o;++s){var u=r+4+s*e;if(s==o||0==a(u)){var l=n(i,u-i);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),i=u+e}}return St(r),t},toWireType:(r,n)=>{"string"!=typeof n&&Lr(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=Dt(4+a+e);return y[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(St,s),s},argPackAdvance:Gr,readValueFromPointer:Rr,destructorFunction(r){St(r)}})},Ne=(r,e,t,n,o,a)=>{xr[r]={name:Ir(e),rawConstructor:he(t,n),rawDestructor:he(o,a),fields:[]}},Re=(r,e,t,n,o,a,i,s,u,l)=>{xr[r].fields.push({fieldName:Ir(e),getterReturnType:t,getter:he(n,o),getterContext:a,setterArgumentType:i,setter:he(s,u),setterContext:l})},Me=(r,e)=>{Hr(r,{isVoid:!0,name:e=Ir(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},Be=r=>{do{var e=y[r>>2],t=y[(r+=4)>>2],n=y[(r+=4)>>2];r+=4;var o=Ar(e);Fr.createPath("/",nr.dirname(o),!0,!0),Fr.createDataFile(o,null,m.subarray(n,n+t),!0,!0,!0)}while(y[r>>2])},We=()=>{throw 1/0},ze=(r,e)=>{var t=Br[r];return void 0===t&&Lr(`${e} has unknown type ${ve(r)}`),t},je=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(y[e>>2]=Zr.toHandle(n)),o},Oe=(r,e,t)=>(r=Zr.toValue(r),e=ze(e,"emval::as"),je(e,t,r)),$e={},Ie=r=>{var e=$e[r];return void 0===e?Ir(r):e},Ue=[],Le=(r,e,t,n,o)=>(r=Ue[r])(e=Zr.toValue(e),e[t=Ie(t)],n,o),Ve=()=>globalThis,He=r=>0===r?Zr.toHandle(Ve()):(r=Ie(r),Zr.toHandle(Ve()[r])),qe=r=>{var e=Ue.length;return Ue.push(r),e},Xe=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=ze(y[e+4*n>>2],`parameter ${n}`);return t},Ge=(r,e,t)=>{var n=Xe(r,e),o=n.shift();r--;var a=new Array(r),i=(e,i,s,u)=>{for(var l=0,d=0;d<r;++d)a[d]=n[d].readValueFromPointer(u+l),l+=n[d].argPackAdvance;var c=1===t?Reflect.construct(i,a):i.apply(e,a);return je(o,s,c)},s=`methodCaller<(${n.map(r=>r.name).join(", ")}) => ${o.name}>`;return qe(oe(s,i))},Ye=(r,e)=>(r=Zr.toValue(r),e=Zr.toValue(e),Zr.toHandle(r[e])),Ke=r=>{r>9&&(Jr[r+1]+=1)},Je=()=>Zr.toHandle([]),Qe=r=>Zr.toHandle(Ie(r)),Ze=r=>{var e=Zr.toValue(r);Nr(e),Qr(r)},rt=(r,e,t)=>{r=Zr.toValue(r),e=Zr.toValue(e),t=Zr.toValue(t),r[e]=t},et=(r,e)=>{var t=(r=ze(r,"_emval_take_value")).readValueFromPointer(e);return Zr.toHandle(t)},tt=(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),u=i.getTimezoneOffset(),l=Math.max(s,u);y[r>>2]=60*l,w[e>>2]=Number(s!=u);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(u);u<s?(_e(c,t,17),_e(f,n,17)):(_e(c,n,17),_e(f,t,17))},nt=()=>2147483648,ot=(r,e)=>Math.ceil(r/e)*e,at=r=>{var e=(r-f.buffer.byteLength+65535)/65536|0;try{return f.grow(e),D(),1}catch(t){}},it=r=>{var e=h.length;r>>>=0;var t=nt();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,ot(Math.max(r,o),65536));if(at(a))return!0}return!1},st={},ut=()=>o||"./this.program",lt=()=>{if(!lt.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.language||"C").replace("-","_")+".UTF-8",_:ut()};for(var e in st)void 0===st[e]?delete r[e]:r[e]=st[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);lt.strings=t}return lt.strings},dt=(r,e)=>{var t=0,n=0;for(var o of lt()){var a=e+t;y[r+n>>2]=a,t+=_e(o,a,1/0)+1,n+=4}return 0},ct=(r,e)=>{var t=lt();y[r>>2]=t.length;var n=0;for(var o of t)n+=dr(o)+1;return y[e>>2]=n,0},ft=0,mt=()=>K||ft>0,ht=r=>{mt()||(n.onExit?.(r),A=!0),a(r,new V(r))},pt=(r,e)=>{ht(r)};function vt(r){try{var e=Pr.getStreamFromFD(r);return Fr.close(e),0}catch(t){if(void 0===Fr||"ErrnoError"!==t.name)throw t;return t.errno}}var wt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=y[e>>2],s=y[e+4>>2];e+=8;var u=Fr.read(r,m,i,s,n);if(u<0)return-1;if(o+=u,u<s)break}return o};function yt(r,e,t,n){try{var o=Pr.getStreamFromFD(r),a=wt(o,e,t);return y[n>>2]=a,0}catch(i){if(void 0===Fr||"ErrnoError"!==i.name)throw i;return i.errno}}var gt=9007199254740992,Et=-9007199254740992,kt=r=>r<Et||r>gt?NaN:Number(r);function _t(r,e,t,n){e=kt(e);try{if(isNaN(e))return 61;var o=Pr.getStreamFromFD(r);return Fr.llseek(o,e,t),k[n>>3]=BigInt(o.position),o.getdents&&0===e&&0===t&&(o.getdents=null),0}catch(a){if(void 0===Fr||"ErrnoError"!==a.name)throw a;return a.errno}}var bt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=y[e>>2],s=y[e+4>>2];e+=8;var u=Fr.write(r,m,i,s,n);if(u<0)return-1;if(o+=u,u<s)break}return o};function Ft(r,e,t,n){try{var o=Pr.getStreamFromFD(r),a=bt(o,e,t);return y[n>>2]=a,0}catch(i){if(void 0===Fr||"ErrnoError"!==i.name)throw i;return i.errno}}var At,Pt,Dt,St,Tt,Ct,xt,Nt=(r,e)=>{r<128?e.push(r):e.push(r%128|128,r>>7)},Rt=r=>{for(var e={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},t={parameters:[],results:"v"==r[0]?[]:[e[r[0]]]},n=1;n<r.length;++n)t.parameters.push(e[r[n]]);return t},Mt=(r,e)=>{var t=r.slice(0,1),n=r.slice(1),o={i:127,p:127,j:126,f:125,d:124,e:111};for(var a of(e.push(96),Nt(n.length,e),n))e.push(o[a]);"v"==t?e.push(0):e.push(1,o[t])},Bt=(r,e)=>{if("function"==typeof WebAssembly.Function)return new WebAssembly.Function(Rt(e),r);var t=[1];Mt(e,t);var n=[0,97,115,109,1,0,0,0,1];Nt(t.length,n),n.push(...t),n.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var o=new WebAssembly.Module(new Uint8Array(n));return new WebAssembly.Instance(o,{e:{f:r}}).exports.f},Wt=(r,e)=>{if(At)for(var t=r;t<r+e;t++){var n=me(t);n&&At.set(n,t)}},zt=r=>(At||(At=new WeakMap,Wt(0,se.length)),At.get(r)||0),jt=[],Ot=()=>{if(jt.length)return jt.pop();try{se.grow(1)}catch(F){if(!(F instanceof RangeError))throw F;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return se.length-1},$t=(r,e)=>{se.set(r,e),fe[r]=se.get(r)},It=(r,e)=>{var t=zt(r);if(t)return t;var n=Ot();try{$t(n,r)}catch(F){if(!(F instanceof TypeError))throw F;var o=Bt(r,e);$t(n,o)}return At.set(r,n),n},Ut=(...r)=>Fr.createPath(...r),Lt=(...r)=>Fr.unlink(...r),Vt=(...r)=>Fr.createLazyFile(...r),Ht=(...r)=>Fr.createDevice(...r);function qt(r){Pt=r.$,n._malloc=Dt=r.ba,n._free=St=r.ca,Tt=r.da,Ct=r.ea,xt=r.fa}Fr.createPreloadedFile=kr,Fr.staticInit(),vr.doesNotExistError=new Fr.ErrnoError(44),vr.doesNotExistError.stack="<generic error, no stack>",n.noExitRuntime&&(K=n.noExitRuntime),n.preloadPlugins&&(gr=n.preloadPlugins),n.print&&(b=n.print),n.printErr&&(F=n.printErr),n.wasmBinary&&(l=n.wasmBinary),n.arguments&&n.arguments,n.thisProgram&&(o=n.thisProgram),n.addRunDependency=M,n.removeRunDependency=B,n.addFunction=It,n.UTF8ToString=Ar,n.FS_createPreloadedFile=kr,n.FS_unlink=Lt,n.FS_createPath=Ut,n.FS_createDevice=Ht,n.FS_createDataFile=yr,n.FS_createLazyFile=Vt;var Xt={j:rr,w:Dr,N:Sr,O:Tr,P:Cr,z:$r,y:Xr,U:Yr,S:ee,x:ne,l:ge,d:Ee,b:ke,T:be,r:xe,A:Ne,c:Re,V:Me,R:Be,G:We,X:Oe,B:Le,a:Qr,Y:He,C:Ge,n:Ye,h:Ke,D:Je,i:Qe,s:Ze,W:rt,m:et,I:tt,H:it,K:dt,L:ct,Q:pt,u:vt,M:yt,J:_t,v:Ft,o:Yt,k:Qt,p:rn,t:en,F:nn,q:Zt,e:Kt,E:on,f:tn,g:Jt},Gt=await L();function Yt(r,e){var t=Q();try{return me(r)(e)}catch(n){if(J(t),n!==n+0)throw n;Tt(1,0)}}function Kt(r,e){var t=Q();try{me(r)(e)}catch(n){if(J(t),n!==n+0)throw n;Tt(1,0)}}function Jt(r,e,t,n){var o=Q();try{me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function Qt(r,e,t){var n=Q();try{return me(r)(e,t)}catch(o){if(J(n),o!==o+0)throw o;Tt(1,0)}}function Zt(r){var e=Q();try{me(r)()}catch(t){if(J(e),t!==t+0)throw t;Tt(1,0)}}function rn(r,e,t,n){var o=Q();try{return me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function en(r,e,t,n,o){var a=Q();try{return me(r)(e,t,n,o)}catch(i){if(J(a),i!==i+0)throw i;Tt(1,0)}}function tn(r,e,t){var n=Q();try{me(r)(e,t)}catch(o){if(J(n),o!==o+0)throw o;Tt(1,0)}}function nn(r,e,t,n,o,a,i,s,u,l){var d=Q();try{return me(r)(e,t,n,o,a,i,s,u,l)}catch(c){if(J(d),c!==c+0)throw c;Tt(1,0)}}function on(r,e,t,n){var o=Q();try{me(r)(e,t,n)}catch(a){if(J(o),a!==a+0)throw a;Tt(1,0)}}function an(){function r(){n.calledRun=!0,A||(T(),d?.(n),n.onRuntimeInitialized?.(),C())}N>0?R=an:(S(),N>0?R=an:n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),r()},1)):r())}function sn(){if(n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.shift()()}return sn(),an(),P?n:new Promise((r,e)=>{d=r,c=e})};export{r as default};
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/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.1.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.1.0-next.38";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
package/core/has.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-max-page-size",8e3),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("featurelayer-pbf-true-curves",!0),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("featurelayer-relative-time-queries-enabled",!0),has.add("featurelayer-relative-time-queries-bin-window-public",1),has.add("featurelayer-relative-time-queries-bin-window-private",60),has.add("parquetlayer-full-query-feature-count",2e4),has.add("parquetlayer-hittest-max-feature-count",1),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",6),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:
|
|
2
|
+
const e=globalThis,a={...e.esriConfig?.has};function has(d){return"function"==typeof a[d]?a[d]=a[d](e):a[d]}has.add=(e,d,r,t)=>{(t||void 0===a[e])&&(a[e]=d),r&&has(e)},has.cache=a,has.add("big-integer-warning-enabled",!0),has.add("esri-deprecation-warnings",!0),has.add("esri-tests-disable-screenshots",!1),has.add("esri-tests-use-full-window",!1),has.add("esri-tests-post-to-influx",!0),has.add("esri-cim-animations-enable-status","enabled"),has.add("esri-cim-animations-spotlight",!1),has.add("esri-cim-animations-freeze-time",!1),(()=>{has.add("host-webworker",void 0!==e.WorkerGlobalScope&&self instanceof e.WorkerGlobalScope);const a="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(has.add("host-browser",a),has.add("host-node",!("object"!=typeof e.process||!e.process.versions?.node||!e.process.versions.v8)),has.add("dom",a),has("host-browser")){const e=navigator,a=e.userAgent,d=e.appVersion,r=parseFloat(d);if(has.add("wp",parseFloat(a.split("Windows Phone")[1])||void 0),has.add("msapp",parseFloat(a.split("MSAppHost/")[1])||void 0),has.add("khtml",d.includes("Konqueror")?r:void 0),has.add("edge",parseFloat(a.split("Edge/")[1])||void 0),has.add("opr",parseFloat(a.split("OPR/")[1])||void 0),has.add("webkit",!has("wp")&&!has("edge")&&parseFloat(a.split("WebKit/")[1])||void 0),has.add("chrome",!has("edge")&&!has("opr")&&parseFloat(a.split("Chrome/")[1])||void 0),has.add("android",!has("wp")&&parseFloat(a.split("Android ")[1])||void 0),has.add("safari",!d.includes("Safari")||has("wp")||has("chrome")||has("android")||has("edge")||has("opr")?void 0:parseFloat(d.split("Version/")[1])),has.add("mac",d.includes("Macintosh")),!has("wp")&&/(iPhone|iPod|iPad)/.test(a)){const e=RegExp.$1.replace(/P/,"p"),d=/OS ([\d_]+)/.test(a)?RegExp.$1:"1",r=parseFloat(d.replace(/_/,".").replaceAll("_",""));has.add(e,r),has.add("ios",r)}has("webkit")||(!a.includes("Gecko")||has("wp")||has("khtml")||has("edge")||has.add("mozilla",r),has("mozilla")&&has.add("ff",parseFloat(a.split("Firefox/")[1]||a.split("Minefield/")[1])||void 0))}})(),(()=>{if(e.navigator){const e=navigator.userAgent,a=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),d=/iPhone/i.test(e);a&&has.add("esri-mobile",a),d&&has.add("esri-iPhone",d),has.add("esri-geolocation",!!navigator.geolocation)}has.add("esri-wasm","WebAssembly"in e),has.add("esri-performance-mode-frames-between-render",20),has.add("esri-force-performance-mode",!1),has.add("esri-shared-array-buffer",()=>{const a="SharedArrayBuffer"in e,d=!1===e.crossOriginIsolated;return a&&!d}),has.add("wasm-simd",()=>{const e=[0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11];return WebAssembly.validate(new Uint8Array(e))}),has.add("esri-atomics","Atomics"in e),has.add("esri-workers","Worker"in e),has.add("web-feat:cache","caches"in e),has.add("esri-workers-arraybuffer-transfer",!has("safari")||Number(has("safari"))>=12),has.add("workers-pool-size",8),has.add("featurelayer-simplify-thresholds",[.5,.5,.5,.5]),has.add("featurelayer-simplify-payload-size-factors",[1,1,4]),has.add("featurelayer-animation-enabled",!0),has.add("featurelayer-snapshot-enabled",!0),has.add("featurelayer-snapshot-initial-tolerance",0),has.add("featurelayer-snapshot-point-min-threshold",8e4),has.add("featurelayer-snapshot-point-max-threshold",4e5),has.add("featurelayer-snapshot-multipoint-min-threshold",2e4),has.add("featurelayer-snapshot-multipoint-max-threshold",1e5),has.add("featurelayer-snapshot-polygon-min-threshold",2e3),has.add("featurelayer-snapshot-polygon-max-threshold",2e3),has.add("featurelayer-snapshot-polyline-min-threshold",2e3),has.add("featurelayer-snapshot-polyline-max-threshold",2e3),has.add("featurelayer-snapshot-max-vertex-count",25e4),has.add("featurelayer-snapshot-non-hosted-exceedslimit-enabled",!0),has.add("featurelayer-snapshot-concurrency",4),has.add("featurelayer-snapshot-allow-editable",!1),has.add("featurelayer-snapshot-coverage",.1),has.add("featurelayer-query-max-depth",4),has.add("featurelayer-query-max-page-size",8e3),has.add("featurelayer-query-pausing-enabled",!1),has.add("featurelayer-query-tile-concurrency",4),has.add("featurelayer-query-tile-max-features",6e5),has.add("featurelayer-advanced-symbols",!1),has.add("featurelayer-pbf",!0),has.add("featurelayer-pbf-statistics",!1),has.add("featurelayer-pbf-true-curves",!0),has.add("feature-layers-workers",!0),has.add("feature-polyline-generalization-factor",1),has.add("featurelayer-relative-time-queries-enabled",!0),has.add("featurelayer-relative-time-queries-bin-window-public",1),has.add("featurelayer-relative-time-queries-bin-window-private",60),has.add("parquetlayer-full-query-feature-count",2e4),has.add("parquetlayer-hittest-max-feature-count",1),has.add("parquetlayer-persistence-enabled",!1),has.add("parquetlayer-cache-enabled",!0),has.add("mapview-transitions-duration",200),has.add("mapview-essential-goto-duration",200),has.add("mapview-srswitch-adjust-rotation-scale-threshold",24e6),has.add("mapserver-pbf-version-support",10.81),has.add("mapservice-popup-identify-max-tolerance",20),has.add("request-queue-concurrency-global",50),has.add("request-queue-concurrency-hosted",16),has.add("request-queue-concurrency-non-hosted",6),has.add("curve-densification-coarse-segments",128),has.add("curve-densification-max-segments",2e3),has.add("curve-densification-min-segments",3),has.add("curve-densification-pixel-deviation",.5),has.add("view-readyState-waiting-delay",1e3),has.add("gradient-depth-bias",.01),has.add("gradient-depth-epsilon",1e-8),has.add("enable-feature:esri-compress-textures",!0),has.add("enable-feature:basemap-groundlayers",!0),has.add("enable-feature:im-shading",!0),has.add("enable-feature:im-vertex-normals",!0),!has("host-webworker")&&has("host-browser")&&(has.add("esri-csp-restrictions",()=>{try{new Function}catch{return!0}return!1}),has.add("esri-url-encodes-apostrophe",()=>{const e=window.document.createElement("a");return e.href="?'",e.href.includes("?%27")}))})();export{has as default};
|
package/geometry/libtess.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as t,__disposeResources as
|
|
2
|
+
import{__addDisposableResource as t,__disposeResources as e}from"tslib";import{getAssetUrl as r}from"../assets.js";import n from"../core/Error.js";import has from"../core/has.js";import{roundUpToNearest as s}from"../core/mathUtils.js";let i=null,o=null,l=null,a=null;const u=100903,c=4,E={vertices:new Float32Array(0),indices:new Uint32Array(0),outlineIndices:new Uint32Array(0),outlineRingLengths:new Uint32Array(0),vertexCount:0,indexCount:0,outlineIndexCount:0,outlineRingCount:0},d={vertices:new Float64Array(0),indices:new Uint32Array(0),outlineIndices:new Uint32Array(0),outlineRingLengths:new Uint32Array(0),vertexCount:0,indexCount:0,outlineIndexCount:0,outlineRingCount:0},h=2,p=2;function g(t,e){const r=t.reduce((t,e)=>t+e,0),n=t.length,i=Math.max(0,t.length-1),o=Math.max(0,r+2*i-2),l=Math.max(0,Math.ceil(r*h)),a=Math.max(0,Math.ceil(3*o*p)),u=s(a,3),c=r>0?Math.max(2,Math.ceil(.25*r)):0,E=r>0?Math.max(1,Math.ceil(c/3)):0;return{maxVertexCount:l,maxIndexCount:u,maxOutlineIndexCount:e?Math.max(0,r+n+c):0,maxOutlineRingCount:e?Math.max(0,n+E):0}}async function y(){return i??=x(),i}function f(){return null!==l}async function b(){return o??=C(),o}function w(){return null!==a}async function x(){const t=await import("../chunks/libtess-f32.js"),e=await t.default({locateFile:t=>r(`esri/core/libs/libtess/${t}`)});l=e}async function C(){const t=await import("../chunks/libtess-f64.js"),e=await t.default({locateFile:t=>r(`esri/core/libs/libtess/${t}`)});a=e}function m(r,s,i=2){const o={stack:[],error:void 0,hasError:!1};try{const e=l;if(!e)throw new n("libtess:not-loaded","libtessF32 not loaded");const a=t(o,P.from(e,r),!1),u=t(o,v.from(e,s),!1),E=c*(r.length/i),d=t(o,new P(e,E*i),!1),h=e.triangulate(a.ptr,u.ptr,u.size,i,d.ptr,E);if(has("esri-tessellation-debug")){const t=e.getError();0!==t&&console.warn("libtess:triangulation",B(t))}return{buffer:d.slice(0,h*i),vertexCount:h}}catch(a){o.error=a,o.hasError=!0}finally{e(o)}}function _(r,s,i=2,o=!0){const a={stack:[],error:void 0,hasError:!1};try{const d=l;if(!d)throw new n("libtess:not-loaded","libtessF32 not loaded");const h=t(a,P.from(d,r),!1),p=t(a,v.from(d,s),!1),y=t(a,new v(d,1),!1),f=t(a,new v(d,1),!1),b=t(a,new v(d,1),!1),w=t(a,new v(d,1),!1),{maxVertexCount:x,maxIndexCount:C,maxOutlineIndexCount:m,maxOutlineRingCount:_}=g(s,o);let I=0,R=0,T=0,A=0,L=0;{const r={stack:[],error:void 0,hasError:!1};try{const e=t(r,new P(d,x*i),!1),n=t(r,new v(d,C),!1),s=t(r,o?new v(d,m):null,!1),l=t(r,o?new v(d,_):null,!1);if(d.triangulateIndexed(h.ptr,p.ptr,p.size,i,e.ptr,x,i,n.ptr,C,y.ptr,f.ptr,s?.ptr??0,m,l?.ptr??0,_,b.ptr,w.ptr),L=d.getError(),I=M(d)[y.ptr/Int32Array.BYTES_PER_ELEMENT],R=M(d)[f.ptr/Int32Array.BYTES_PER_ELEMENT],T=M(d)[b.ptr/Int32Array.BYTES_PER_ELEMENT],A=M(d)[w.ptr/Int32Array.BYTES_PER_ELEMENT],0===L){const t=e.slice(0,I*i),r=n.slice(0,R),a=o&&s?s.slice(0,T):E.outlineIndices;return{vertices:t,indices:r,outlineIndices:a,outlineRingLengths:o&&l?l.slice(0,A):E.outlineRingLengths,vertexCount:I,indexCount:R,outlineIndexCount:o?T:0,outlineRingCount:o?A:0}}}catch(c){r.error=c,r.hasError=!0}finally{e(r)}}if(L!==u)return has("esri-tessellation-debug")&&0!==L&&console.warn("libtess:triangulation",B(L)),E;const S=t(a,new P(d,I*i),!1),N=t(a,new v(d,R),!1),Y=t(a,o?new v(d,T):null,!1),F=t(a,o?new v(d,A):null,!1);if(d.triangulateIndexed(h.ptr,p.ptr,p.size,i,S.ptr,I,i,N.ptr,R,y.ptr,f.ptr,Y?.ptr??0,o?T:0,F?.ptr??0,o?A:0,b.ptr,w.ptr),L=d.getError(),0!==L)return has("esri-tessellation-debug")&&console.warn("libtess:triangulation",B(L)),E;const k=M(d)[y.ptr/Int32Array.BYTES_PER_ELEMENT],z=M(d)[f.ptr/Int32Array.BYTES_PER_ELEMENT],U=M(d)[b.ptr/Int32Array.BYTES_PER_ELEMENT],O=M(d)[w.ptr/Int32Array.BYTES_PER_ELEMENT],j=S.slice(0,k*i),H=N.slice(0,z),V=o&&Y?Y.slice(0,U):E.outlineIndices;return{vertices:j,indices:H,outlineIndices:V,outlineRingLengths:o&&F?F.slice(0,O):E.outlineRingLengths,vertexCount:k,indexCount:z,outlineIndexCount:o?U:0,outlineRingCount:o?O:0}}catch(d){a.error=d,a.hasError=!0}finally{e(a)}}function I(r,s,i=2){const o={stack:[],error:void 0,hasError:!1};try{const e=a;if(!e)throw new n("libtess:not-loaded","libtessF64 not loaded");const l=t(o,S.from(e,r),!1),u=t(o,v.from(e,s),!1),E=c*(r.length/i),d=t(o,new S(e,E*i),!1),h=e.triangulate(l.ptr,u.ptr,u.size,i,d.ptr,E);if(has("esri-tessellation-debug")){const t=e.getError();0!==t&&console.warn("libtess:triangulation",B(t))}return{buffer:d.slice(0,h*i),vertexCount:h}}catch(l){o.error=l,o.hasError=!0}finally{e(o)}}function R(r,s,i=2,o=!0){const l={stack:[],error:void 0,hasError:!1};try{const E=a;if(!E)throw new n("libtess:not-loaded","libtessF64 not loaded");const h=t(l,S.from(E,r),!1),p=t(l,v.from(E,s),!1),y=t(l,new v(E,1),!1),f=t(l,new v(E,1),!1),b=t(l,new v(E,1),!1),w=t(l,new v(E,1),!1),{maxVertexCount:x,maxIndexCount:C,maxOutlineIndexCount:m,maxOutlineRingCount:_}=g(s,o);let I=0,R=0,T=0,A=0,L=0;{const r={stack:[],error:void 0,hasError:!1};try{const e=t(r,new S(E,x*i),!1),n=t(r,new v(E,C),!1),s=t(r,o?new v(E,m):null,!1),l=t(r,o?new v(E,_):null,!1);if(E.triangulateIndexed(h.ptr,p.ptr,p.size,i,e.ptr,x,i,n.ptr,C,y.ptr,f.ptr,s?.ptr??0,m,l?.ptr??0,_,b.ptr,w.ptr),L=E.getError(),I=M(E)[y.ptr/Int32Array.BYTES_PER_ELEMENT],R=M(E)[f.ptr/Int32Array.BYTES_PER_ELEMENT],T=M(E)[b.ptr/Int32Array.BYTES_PER_ELEMENT],A=M(E)[w.ptr/Int32Array.BYTES_PER_ELEMENT],0===L){const t=e.slice(0,I*i),r=n.slice(0,R),a=o&&s?s.slice(0,T):d.outlineIndices;return{vertices:t,indices:r,outlineIndices:a,outlineRingLengths:o&&l?l.slice(0,A):d.outlineRingLengths,vertexCount:I,indexCount:R,outlineIndexCount:o?T:0,outlineRingCount:o?A:0}}}catch(c){r.error=c,r.hasError=!0}finally{e(r)}}if(L!==u)return has("esri-tessellation-debug")&&console.warn("libtess:triangulation",B(L)),d;const P=t(l,new S(E,I*i),!1),N=t(l,new v(E,R),!1),Y=t(l,o?new v(E,T):null,!1),F=t(l,o?new v(E,A):null,!1);if(E.triangulateIndexed(h.ptr,p.ptr,p.size,i,P.ptr,I,i,N.ptr,R,y.ptr,f.ptr,Y?.ptr??0,o?T:0,F?.ptr??0,o?A:0,b.ptr,w.ptr),L=E.getError(),0!==L)return has("esri-tessellation-debug")&&console.warn("libtess:triangulation",B(L)),d;const k=M(E)[y.ptr/Int32Array.BYTES_PER_ELEMENT],z=M(E)[f.ptr/Int32Array.BYTES_PER_ELEMENT],U=M(E)[b.ptr/Int32Array.BYTES_PER_ELEMENT],O=M(E)[w.ptr/Int32Array.BYTES_PER_ELEMENT],j=P.slice(0,k*i),H=N.slice(0,z),V=o&&Y?Y.slice(0,U):d.outlineIndices;return{vertices:j,indices:H,outlineIndices:V,outlineRingLengths:o&&F?F.slice(0,O):d.outlineRingLengths,vertexCount:k,indexCount:z,outlineIndexCount:o?U:0,outlineRingCount:o?O:0}}catch(E){l.error=E,l.hasError=!0}finally{e(l)}}function T(t){return t.HEAPF64}function A(t){return t.HEAPF32}function M(t){return t.HEAP32}function L(t){const e=M(t);return new Uint32Array(e.buffer,e.byteOffset,e.length)}class P{static from(t,e){const r=new P(t,e.length);return r.set(e),r}constructor(t,e){this._libtess=t,this.size=e,this.ptr=t.allocateCoordinateArray(e)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float32Array.BYTES_PER_ELEMENT}set(t){A(this._libtess).set(t,this.ptr/this.bytesPerCoordinate)}slice(t,e){const r=this.ptr/this.bytesPerCoordinate;return A(this._libtess).slice(r+t,r+e)}}class S{static from(t,e){const r=new S(t,e.length);return r.set(e),r}constructor(t,e){this._libtess=t,this.size=e,this.ptr=t.allocateCoordinateArray(e)}destroy(){this._libtess.destroyCoordinateArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Float64Array.BYTES_PER_ELEMENT}set(t){T(this._libtess).set(t,this.ptr/this.bytesPerCoordinate)}slice(t,e){const r=this.ptr/this.bytesPerCoordinate;return T(this._libtess).slice(r+t,r+e)}}class v{static from(t,e){const r=new v(t,e.length);return r.set(e),r}constructor(t,e){this._libtess=t,this.size=e,this.ptr=t.allocateLengthsArray(e)}destroy(){this._libtess.destroyLengthsArray(this.ptr)}[Symbol.dispose](){this.destroy()}get bytesPerCoordinate(){return Int32Array.BYTES_PER_ELEMENT}set(t){M(this._libtess).set(t,this.ptr/this.bytesPerCoordinate)}slice(t,e){const r=this.ptr/this.bytesPerCoordinate;return L(this._libtess).slice(r+t,r+e)}}function B(t){switch(t){case 100903:return"Insufficient output buffer";case 100902:return"Out of memory";case 100151:return"Missing begin polygon";case 100152:return"Missing begin contour";case 100153:return"Missing end polygon";case 100154:return"Missing end countour";case 100155:return"Coordinates too large";case 100156:return"Missing combine callback";default:return`Unknown: ${t}`}}export{f as isLibtessF32Loaded,w as isLibtessF64Loaded,y as loadLibtessF32,b as loadLibtessF64,m as triangulateF32,I as triangulateF64,_ as triangulateIndexedF32,R as triangulateIndexedF64};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/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.1";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.1.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.1";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.1.0-next.38",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.1/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.produces="disabled",this.consumes={required:[c.PRE_TRANSPARENT]},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.PRE_TRANSPARENT,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(3),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.getBoundFramebufferObject(),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()}intersect(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,"produces",void 0),e([o()],v.prototype,"consumes",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{IntersectorResult as x}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let v=class extends y{constructor(e){super(e),this._havePreparedWithAllLayers=!1,this.produces="disabled",this.consumes={required:[c.PRE_TRANSPARENT]},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.PRE_TRANSPARENT,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(2),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.getBoundFramebufferObject(),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()}intersect(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,"produces",void 0),e([o()],v.prototype,"consumes",void 0),v=e([l("esri.layers.VoxelWasmPerSceneView")],v);const b=v;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{getAssetUrl as t}from"../../assets.js";function n(){return new Promise(t=>import("../../chunks/lyr3DMain.js").then(
|
|
2
|
+
import{getAssetUrl as t}from"../../assets.js";function n(){return new Promise(t=>import("../../chunks/lyr3DMain.js").then(({default:n})=>{const e=n({locateFile:i,onRuntimeInitialized:()=>t(e)})})).catch(t=>{throw t})}function e(){return new Promise(t=>import("../../chunks/lyr3DWorker.js").then(({default:n})=>{const e=n({locateFile:i,onRuntimeInitialized:()=>t(e)})})).catch(t=>{throw t})}function i(n){return t(`esri/libs/lyr3d/${n}`)}export{n as loadLyr3DMainWASM,e as loadLyr3DWorkerWASM};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.38",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@amcharts/amcharts5": "~5.16.1",
|
|
22
|
-
"@arcgis/toolkit": "^5.1.0-next.
|
|
22
|
+
"@arcgis/toolkit": "^5.1.0-next.38",
|
|
23
23
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
24
24
|
"@esri/calcite-components": "^5.0.2",
|
|
25
25
|
"@vaadin/grid": "~25.0.7",
|