@globalfishingwatch/gdal3.js
Version:
gdal3.js is a port of Gdal applications (**gdal_translate**, **ogr2ogr**, **gdal_rasterize**, **gdalwarp**, **gdaltransform**) to Webassembly. It allows you to convert raster and vector geospatial data to various formats and coordinate systems.
1 lines • 184 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).initGdalJs=e()}(this,function(){"use strict";function e(r){if(r.__esModule)return r;var n=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(r).forEach(function(t){var e=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(n,t,e.get?e:{enumerable:!0,get:function(){return r[t]}})}),n}var xr=e(Object.freeze({__proto__:null,default:{}})),o="[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0);function r(e,t){var r,n=Object.keys(e);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(e),t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)),n}function s(n){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?r(Object(a),!0).forEach(function(t){var e,r;e=n,r=a[t=t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(a)):r(Object(a)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(a,t))})}return n}function kr(t){return(kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function M(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function k(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o=[],i=!0,s=!1;try{for(r=r.call(t);!(i=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);i=!0);}catch(t){s=!0,a=t}finally{try{i||null==r.return||r.return()}finally{if(s)throw a}}return o}}(t,e)||x(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){if(t){if("string"==typeof t)return B(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(r="Object"===r&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,e):void 0}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Ir,t={exports:{}},Br=e(Object.freeze({__proto__:null,default:{}})),U=t;function K(M){var k,I,x,B,U,K,z,u,W,Y,c=void 0!==(M=M||{})?M:{};function V(){function n(t,e){if(!t)throw e+(new Error).stack}function a(t,e,r){this.start=t,this.end=e,this.audio=r}c.FS_createPath("/","usr",!0,!0),c.FS_createPath("/usr","share",!0,!0),c.FS_createPath("/usr/share","gdal",!0,!0),c.FS_createPath("/usr/share","proj",!0,!0),a.prototype={requests:{},open:function(t,e){this.name=e,this.requests[e]=this,c.addRunDependency("fp "+this.name)},send:function(){},onload:function(){var t=this.byteArray.subarray(this.start,this.end);this.finish(t)},finish:function(t){c.FS_createDataFile(this.name,null,t,!0,!0,!0),c.removeRunDependency("fp "+this.name),this.requests[this.name]=null}};for(var t=x.files,e=0;e<t.length;++e)new a(t[e].start,t[e].end,t[e].audio||0).open("GET",t[e].filename);function r(t){n(t,"Loading data file failed."),n(t instanceof ArrayBuffer,"bad input to processPackageData");for(var t=new Uint8Array(t),e=(a.prototype.byteArray=t,x.files),r=0;r<e.length;++r)a.prototype.requests[e[r].filename].onload();c.removeRunDependency("datafile_/home/bugra/Documents/MiniProject/gdal3.js/build/package/gdal3WebAssembly.data")}c.addRunDependency("datafile_/home/bugra/Documents/MiniProject/gdal3.js/build/package/gdal3WebAssembly.data"),c.preloadResults||(c.preloadResults={}),c.preloadResults["/home/bugra/Documents/MiniProject/gdal3.js/build/package/gdal3WebAssembly.data"]={fromCache:!1},Y?(r(Y),Y=null):W=r}c.ready=new Promise(function(t,e){k=t,I=e}),c.expectedDataFileDownloads||(c.expectedDataFileDownloads=0),c.expectedDataFileDownloads++,c.ENVIRONMENT_IS_PTHREAD||(x={files:[{filename:"/usr/share/gdal/jpfgdgml_RdArea.gfs",start:0,end:1515},{filename:"/usr/share/gdal/grib2_table_4_2_0_3.csv",start:1515,end:11849},{filename:"/usr/share/gdal/plscenesconf.json",start:11849,end:47162},{filename:"/usr/share/gdal/header.dxf",start:47162,end:53734},{filename:"/usr/share/gdal/grib2_table_4_2_10_2.csv",start:53734,end:63614},{filename:"/usr/share/gdal/pci_datum.txt",start:63614,end:98719},{filename:"/usr/share/gdal/nitf_spec.xml",start:98719,end:247574},{filename:"/usr/share/gdal/grib2_table_4_2_0_6.csv",start:247574,end:259216},{filename:"/usr/share/gdal/pci_ellips.txt",start:259216,end:262682},{filename:"/usr/share/gdal/grib2_table_4_2_4_5.csv",start:262682,end:272178},{filename:"/usr/share/gdal/grib2_table_4_2_4_4.csv",start:272178,end:281867},{filename:"/usr/share/gdal/inspire_cp_CadastralBoundary.gfs",start:281867,end:283517},{filename:"/usr/share/gdal/ozi_ellips.csv",start:283517,end:284866},{filename:"/usr/share/gdal/grib2_table_4_2_4_1.csv",start:284866,end:294552},{filename:"/usr/share/gdal/grib2_table_4_2_2_0.csv",start:294552,end:306753},{filename:"/usr/share/gdal/ozi_datum.csv",start:306753,end:315235},{filename:"/usr/share/gdal/grib2_table_4_2_10_4.csv",start:315235,end:325428},{filename:"/usr/share/gdal/eedaconf.json",start:325428,end:325807},{filename:"/usr/share/gdal/grib2_table_4_2_10_3.csv",start:325807,end:335583},{filename:"/usr/share/gdal/grib2_table_4_2_local_NCEP.csv",start:335583,end:363560},{filename:"/usr/share/gdal/jpfgdgml_RvrMgtBdry.gfs",start:363560,end:364948},{filename:"/usr/share/gdal/grib2_table_4_2_20_1.csv",start:364948,end:374802},{filename:"/usr/share/gdal/jpfgdgml_BldA.gfs",start:374802,end:376303},{filename:"/usr/share/gdal/vdv452.xsd",start:376303,end:379157},{filename:"/usr/share/gdal/grib2_table_4_2_0_19.csv",start:379157,end:391031},{filename:"/usr/share/gdal/s57expectedinput.csv",start:391031,end:411916},{filename:"/usr/share/gdal/jpfgdgml_WStrA.gfs",start:411916,end:413419},{filename:"/usr/share/gdal/ruian_vf_v1.gfs",start:413419,end:480753},{filename:"/usr/share/gdal/inspire_cp_BasicPropertyUnit.gfs",start:480753,end:482493},{filename:"/usr/share/gdal/grib2_table_4_2_4_6.csv",start:482493,end:492127},{filename:"/usr/share/gdal/GDALLogoGS.svg",start:492127,end:504432},{filename:"/usr/share/gdal/s57objectclasses.csv",start:504432,end:557759},{filename:"/usr/share/gdal/GDALLogoColor.svg",start:557759,end:570064},{filename:"/usr/share/gdal/pds4_template.xml",start:570064,end:573497},{filename:"/usr/share/gdal/default.rsc",start:573497,end:1037129},{filename:"/usr/share/gdal/grib2_table_4_2_0_17.csv",start:1037129,end:1037985},{filename:"/usr/share/gdal/tms_NZTM2000.json",start:1037985,end:1043202},{filename:"/usr/share/gdal/grib2_table_4_2_20_2.csv",start:1043202,end:1052708},{filename:"/usr/share/gdal/jpfgdgml_ElevPt.gfs",start:1052708,end:1054208},{filename:"/usr/share/gdal/cubewerx_extra.wkt",start:1054208,end:1066185},{filename:"/usr/share/gdal/ecw_cs.wkt",start:1066185,end:1429902},{filename:"/usr/share/gdal/grib2_table_4_2_1_2.csv",start:1429902,end:1439700},{filename:"/usr/share/gdal/osmconf.ini",start:1439700,end:1444895},{filename:"/usr/share/gdal/grib2_subcenter.csv",start:1444895,end:1447223},{filename:"/usr/share/gdal/grib2_table_4_2_0_2.csv",start:1447223,end:1458026},{filename:"/usr/share/gdal/grib2_table_4_2_0_16.csv",start:1458026,end:1467697},{filename:"/usr/share/gdal/epsg.wkt",start:1467697,end:1467724},{filename:"/usr/share/gdal/jpfgdgml_SBBdry.gfs",start:1467724,end:1468977},{filename:"/usr/share/gdal/jpfgdgml_BldL.gfs",start:1468977,end:1470480},{filename:"/usr/share/gdal/ruian_vf_st_v1.gfs",start:1470480,end:1516452},{filename:"/usr/share/gdal/grib2_table_4_2_0_190.csv",start:1516452,end:1525959},{filename:"/usr/share/gdal/gmlasconf.xml",start:1525959,end:1533391},{filename:"/usr/share/gdal/grib2_table_4_2_0_0.csv",start:1533391,end:1543754},{filename:"/usr/share/gdal/gt_datum.csv",start:1543754,end:1559558},{filename:"/usr/share/gdal/ruian_vf_st_uvoh_v1.gfs",start:1559558,end:1562158},{filename:"/usr/share/gdal/LICENSE.TXT",start:1562158,end:1581972},{filename:"/usr/share/gdal/jpfgdgml_SBAPt.gfs",start:1581972,end:1583347},{filename:"/usr/share/gdal/ruian_vf_ob_v1.gfs",start:1583347,end:1630122},{filename:"/usr/share/gdal/jpfgdgml_WL.gfs",start:1630122,end:1631621},{filename:"/usr/share/gdal/grib2_table_4_2_2_3.csv",start:1631621,end:1642255},{filename:"/usr/share/gdal/tms_LINZAntarticaMapTileGrid.json",start:1642255,end:1646382},{filename:"/usr/share/gdal/GDALLogoBW.svg",start:1646382,end:1659404},{filename:"/usr/share/gdal/grib2_table_4_2_4_9.csv",start:1659404,end:1668940},{filename:"/usr/share/gdal/gmlasconf.xsd",start:1668940,end:1717594},{filename:"/usr/share/gdal/jpfgdgml_RdCompt.gfs",start:1717594,end:1719240},{filename:"/usr/share/gdal/grib2_process.csv",start:1719240,end:1724166},{filename:"/usr/share/gdal/stateplane.csv",start:1724166,end:1734526},{filename:"/usr/share/gdal/trailer.dxf",start:1734526,end:1736801},{filename:"/usr/share/gdal/nitf_spec.xsd",start:1736801,end:1744488},{filename:"/usr/share/gdal/grib2_table_4_2_3_6.csv",start:1744488,end:1745307},{filename:"/usr/share/gdal/bag_template.xml",start:1745307,end:1754327},{filename:"/usr/share/gdal/s57attributes.csv",start:1754327,end:1774328},{filename:"/usr/share/gdal/vdv452.xml",start:1774328,end:1800144},{filename:"/usr/share/gdal/jpfgdgml_Cntr.gfs",start:1800144,end:1801645},{filename:"/usr/share/gdal/jpfgdgml_SBArea.gfs",start:1801645,end:1803152},{filename:"/usr/share/gdal/grib2_table_4_2_10_0.csv",start:1803152,end:1814925},{filename:"/usr/share/gdal/grib2_table_4_2_4_10.csv",start:1814925,end:1824626},{filename:"/usr/share/gdal/grib2_table_4_2_0_7.csv",start:1824626,end:1835117},{filename:"/usr/share/gdal/jpfgdgml_RailCL.gfs",start:1835117,end:1836624},{filename:"/usr/share/gdal/jpfgdgml_RdEdg.gfs",start:1836624,end:1838266},{filename:"/usr/share/gdal/esri_StatePlane_extra.wkt",start:1838266,end:2170812},{filename:"/usr/share/gdal/jpfgdgml_RdSgmtA.gfs",start:2170812,end:2172456},{filename:"/usr/share/gdal/grib2_table_4_2_10_191.csv",start:2172456,end:2182090},{filename:"/usr/share/gdal/seed_2d.dgn",start:2182090,end:2191306},{filename:"/usr/share/gdal/grib2_table_4_2_local_index.csv",start:2191306,end:2191557},{filename:"/usr/share/gdal/grib2_table_4_2_2_4.csv",start:2191557,end:2202785},{filename:"/usr/share/gdal/grib2_table_4_2_0_5.csv",start:2202785,end:2212611},{filename:"/usr/share/gdal/grib2_table_4_2_1_1.csv",start:2212611,end:2222266},{filename:"/usr/share/gdal/jpfgdgml_LeveeEdge.gfs",start:2222266,end:2223652},{filename:"/usr/share/gdal/grib2_table_4_2_3_3.csv",start:2223652,end:2224436},{filename:"/usr/share/gdal/tms_MapML_CBMTILE.json",start:2224436,end:2232233},{filename:"/usr/share/gdal/grib2_table_4_2_0_20.csv",start:2232233,end:2244359},{filename:"/usr/share/gdal/netcdf_config.xsd",start:2244359,end:2251850},{filename:"/usr/share/gdal/grib2_table_4_2_10_1.csv",start:2251850,end:2261448},{filename:"/usr/share/gdal/grib2_table_4_2_0_14.csv",start:2261448,end:2270999},{filename:"/usr/share/gdal/grib2_table_4_2_4_7.csv",start:2270999,end:2280555},{filename:"/usr/share/gdal/grib2_table_4_2_local_NDFD.csv",start:2280555,end:2283214},{filename:"/usr/share/gdal/grib2_table_4_2_4_2.csv",start:2283214,end:2292874},{filename:"/usr/share/gdal/grib2_table_4_2_3_2.csv",start:2292874,end:2296707},{filename:"/usr/share/gdal/jpfgdgml_RdASL.gfs",start:2296707,end:2297958},{filename:"/usr/share/gdal/jpfgdgml_CommBdry.gfs",start:2297958,end:2299342},{filename:"/usr/share/gdal/vicar.json",start:2299342,end:2301749},{filename:"/usr/share/gdal/grib2_table_4_2_0_18.csv",start:2301749,end:2311973},{filename:"/usr/share/gdal/s57agencies.csv",start:2311973,end:2325277},{filename:"/usr/share/gdal/jpfgdgml_CommPt.gfs",start:2325277,end:2326912},{filename:"/usr/share/gdal/grib2_table_4_2_0_15.csv",start:2326912,end:2336758},{filename:"/usr/share/gdal/grib2_table_4_2_3_1.csv",start:2336758,end:2347421},{filename:"/usr/share/gdal/jpfgdgml_RdMgtBdry.gfs",start:2347421,end:2348807},{filename:"/usr/share/gdal/inspire_cp_CadastralZoning.gfs",start:2348807,end:2353619},{filename:"/usr/share/gdal/inspire_cp_CadastralParcel.gfs",start:2353619,end:2356069},{filename:"/usr/share/gdal/grib2_table_4_2_4_0.csv",start:2356069,end:2365622},{filename:"/usr/share/gdal/grib2_table_4_2_local_MRMS.csv",start:2365622,end:2381209},{filename:"/usr/share/gdal/gt_ellips.csv",start:2381209,end:2382928},{filename:"/usr/share/gdal/seed_3d.dgn",start:2382928,end:2384976},{filename:"/usr/share/gdal/tms_MapML_APSTILE.json",start:2384976,end:2391249},{filename:"/usr/share/gdal/grib2_table_4_2_20_0.csv",start:2391249,end:2400795},{filename:"/usr/share/gdal/grib2_table_4_5.csv",start:2400795,end:2410808},{filename:"/usr/share/gdal/grib2_table_4_2_3_5.csv",start:2410808,end:2411728},{filename:"/usr/share/gdal/template_tiles.mapml",start:2411728,end:2413675},{filename:"/usr/share/gdal/gml_registry.xml",start:2413675,end:2420318},{filename:"/usr/share/gdal/grib2_table_4_2_0_13.csv",start:2420318,end:2429914},{filename:"/usr/share/gdal/jpfgdgml_WA.gfs",start:2429914,end:2431411},{filename:"/usr/share/gdal/grib2_table_versions.csv",start:2431411,end:2431451},{filename:"/usr/share/gdal/jpfgdgml_Cstline.gfs",start:2431451,end:2432960},{filename:"/usr/share/gdal/grib2_table_4_2_0_1.csv",start:2432960,end:2448697},{filename:"/usr/share/gdal/grib2_table_4_2_0_191.csv",start:2448697,end:2458317},{filename:"/usr/share/gdal/jpfgdgml_GCP.gfs",start:2458317,end:2460840},{filename:"/usr/share/gdal/ogrvrt.xsd",start:2460840,end:2486589},{filename:"/usr/share/gdal/grib2_table_4_2_local_HPC.csv",start:2486589,end:2486676},{filename:"/usr/share/gdal/jpfgdgml_AdmPt.gfs",start:2486676,end:2488309},{filename:"/usr/share/gdal/jpfgdgml_AdmArea.gfs",start:2488309,end:2489949},{filename:"/usr/share/gdal/jpfgdgml_WStrL.gfs",start:2489949,end:2491454},{filename:"/usr/share/gdal/grib2_center.csv",start:2491454,end:2495625},{filename:"/usr/share/gdal/gdalvrt.xsd",start:2495625,end:2523196},{filename:"/usr/share/gdal/grib2_table_4_2_3_0.csv",start:2523196,end:2534147},{filename:"/usr/share/gdal/gdalicon.png",start:2534147,end:2536168},{filename:"/usr/share/gdal/gdalmdiminfo_output.schema.json",start:2536168,end:2541629},{filename:"/usr/share/gdal/grib2_table_4_2_2_5.csv",start:2541629,end:2551142},{filename:"/usr/share/gdal/grib2_table_4_2_4_8.csv",start:2551142,end:2560828},{filename:"/usr/share/gdal/grib2_table_4_2_0_4.csv",start:2560828,end:2571139},{filename:"/usr/share/gdal/grib2_table_4_2_4_3.csv",start:2571139,end:2580861},{filename:"/usr/share/gdal/grib2_table_4_2_1_0.csv",start:2580861,end:2591003},{filename:"/usr/share/gdal/grib2_table_4_2_3_4.csv",start:2591003,end:2592054},{filename:"/usr/share/gdal/jpfgdgml_AdmBdry.gfs",start:2592054,end:2593436},{filename:"/usr/share/gdal/grib2_table_4_2_local_Canada.csv",start:2593436,end:2593769},{filename:"/usr/share/gdal/pdfcomposition.xsd",start:2593769,end:2628103},{filename:"/usr/share/proj/proj.ini",start:2628103,end:2629153},{filename:"/usr/share/proj/ITRF2000",start:2629153,end:2631252},{filename:"/usr/share/proj/projjson.schema.json",start:2631252,end:2668530},{filename:"/usr/share/proj/nad83",start:2668530,end:2685123},{filename:"/usr/share/proj/ITRF2014",start:2685123,end:2688612},{filename:"/usr/share/proj/other.extra",start:2688612,end:2692527},{filename:"/usr/share/proj/deformation_model.schema.json",start:2692527,end:2710198},{filename:"/usr/share/proj/nad27",start:2710198,end:2729733},{filename:"/usr/share/proj/triangulation.schema.json",start:2729733,end:2738136},{filename:"/usr/share/proj/nad.lst",start:2738136,end:2744521},{filename:"/usr/share/proj/GL27",start:2744521,end:2745249},{filename:"/usr/share/proj/world",start:2745249,end:2752328},{filename:"/usr/share/proj/CH",start:2752328,end:2753425},{filename:"/usr/share/proj/ITRF2008",start:2753425,end:2759105},{filename:"/usr/share/proj/proj.db",start:2759105,end:11037121}],remote_package_size:11037121},"object"===("undefined"==typeof window?"undefined":kr(window))?window.encodeURIComponent(window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/"):"undefined"==typeof process&&"undefined"!=typeof location&&encodeURIComponent(location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"),t="gdal3WebAssembly.data","function"!=typeof c.locateFilePackage||c.locateFile||(c.locateFile=c.locateFilePackage,f("warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)")),t=c.locateFile?c.locateFile(t,""):t,e=x.remote_package_size,W=null,(Y=c.getPreloadedPackage?c.getPreloadedPackage(t,e):null)||(B=t,U=e,K=function(t){W?(W(t),W=null):Y=t},z=function(t){console.error("package error:",t)},"object"===("undefined"==typeof process?"undefined":kr(process))&&"object"===kr(process.versions)&&"string"==typeof process.versions.node?xr.readFile(B,function(t,e){t?z(t):K(e.buffer)}):((u=new XMLHttpRequest).open("GET",B,!0),u.responseType="arraybuffer",u.onprogress=function(t){var e=B,r=U;if(t.total&&(r=t.total),t.loaded){u.addedTotal?c.dataFileDownloads[e].loaded=t.loaded:(u.addedTotal=!0,c.dataFileDownloads||(c.dataFileDownloads={}),c.dataFileDownloads[e]={loaded:t.loaded,total:r});var n,a=0,o=0,i=0;for(n in c.dataFileDownloads){var s=c.dataFileDownloads[n];a+=s.total,o+=s.loaded,i++}a=Math.ceil(a*c.expectedDataFileDownloads/i),c.setStatus&&c.setStatus("Downloading data... ("+o+"/"+a+")")}else c.dataFileDownloads||c.setStatus&&c.setStatus("Downloading data...")},u.onerror=function(t){throw new Error("NetworkError for: "+B)},u.onload=function(t){if(!(200==u.status||304==u.status||206==u.status||0==u.status&&u.response))throw new Error(u.statusText+" : "+u.responseURL);var e=u.response;K(e)},u.send(null))),c.calledRun?V():(c.preRun||(c.preRun=[]),c.preRun.push(V)));var H,X,q,o,a,Q,t=Object.assign({},c),Z="./this.program",J=function(t,e){throw e},$="object"==("undefined"==typeof window?"undefined":kr(window)),l="function"==typeof importScripts,i="object"==("undefined"==typeof process?"undefined":kr(process))&&"object"==kr(process.versions)&&"string"==typeof process.versions.node,e="";function s(t){nt=t}i?(e=l?Br.dirname(e)+"/":__dirname+"/",Q=function(){a||(o=xr,a=Br)},H=function(t,e){return Q(),t=a.normalize(t),o.readFileSync(t,e?void 0:"utf8")},q=function(t){t=H(t,!0);return t=t.buffer?t:new Uint8Array(t)},X=function(t,r,n){Q(),t=a.normalize(t),o.readFile(t,function(t,e){t?n(t):r(e.buffer)})},1<process.argv.length&&(Z=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(t){if(!(t instanceof St))throw t}),process.on("unhandledRejection",function(t){throw t}),J=function(t,e){if(at)throw process.exitCode=t,e;(e=e)instanceof St||f("exiting due to exception: "+e),process.exit(t)},c.inspect=function(){return"[Emscripten Module object]"}):($||l)&&(l?e=self.location.href:"undefined"!=typeof document&&document.currentScript&&(e=document.currentScript.src),e=0!==(e=Ir?Ir:e).indexOf("blob:")?e.substr(0,e.replace(/[?#].*/,"").lastIndexOf("/")+1):"",H=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},l&&(q=function(t){var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),X=function(t,e,r){var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)});var tt,et,rt=c.print||console.log.bind(console),f=c.printErr||console.warn.bind(console),nt=(Object.assign(c,t),c.arguments,c.thisProgram&&(Z=c.thisProgram),c.quit&&(J=c.quit),0),at=(c.wasmBinary&&(tt=c.wasmBinary),c.noExitRuntime||!0),ot=("object"!=("undefined"==typeof WebAssembly?"undefined":kr(WebAssembly))&&v("no native wasm support detected"),!1);function it(t,e){t||v(e)}var st,d,p,ut,_,m,ct,lt,h,ft="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function dt(t,e,r){for(var n=e+r,a=e;t[a]&&!(n<=a);)++a;if(16<a-e&&t.buffer&&ft)return ft.decode(t.subarray(e,a));for(var o="";e<a;){var i,s,u=t[e++];128&u?(s=63&t[e++],192==(224&u)?o+=String.fromCharCode((31&u)<<6|s):(i=63&t[e++],(u=224==(240&u)?(15&u)<<12|s<<6|i:(7&u)<<18|s<<12|i<<6|63&t[e++])<65536?o+=String.fromCharCode(u):(s=u-65536,o+=String.fromCharCode(55296|s>>10,56320|1023&s)))):o+=String.fromCharCode(u)}return o}function g(t,e){return t?dt(p,t,e):""}function pt(t,e,r,n){if(!(0<n))return 0;for(var a=r,o=r+n-1,i=0;i<t.length;++i){var s=t.charCodeAt(i);if((s=55296<=s&&s<=57343?65536+((1023&s)<<10)|1023&t.charCodeAt(++i):s)<=127){if(o<=r)break;e[r++]=s}else if(s<=2047){if(o<=r+1)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(o<=r+2)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(o<=r+3)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-a}function mt(t,e,r){return pt(t,p,e,r)}function ht(t){for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:55296<=n&&n<=57343?(e+=4,++r):e+=3}return e}function yt(t){st=t,c.HEAP8=d=new Int8Array(t),c.HEAP16=ut=new Int16Array(t),c.HEAP32=_=new Int32Array(t),c.HEAPU8=p=new Uint8Array(t),c.HEAPU16=new Uint16Array(t),c.HEAPU32=m=new Uint32Array(t),c.HEAPF32=ct=new Float32Array(t),c.HEAPF64=lt=new Float64Array(t)}c.INITIAL_MEMORY;var _t=[],gt=[],Et=[];function wt(){if(c.preRun)for("function"==typeof c.preRun&&(c.preRun=[c.preRun]);c.preRun.length;)t=c.preRun.shift(),_t.unshift(t);var t;Gt(_t)}function vt(){if(c.postRun)for("function"==typeof c.postRun&&(c.postRun=[c.postRun]);c.postRun.length;)t=c.postRun.shift(),Et.unshift(t);var t;Gt(Et)}var y,E,w,r=0,bt=null;function Dt(t){r++,c.monitorRunDependencies&&c.monitorRunDependencies(r)}function At(t){var e;r--,c.monitorRunDependencies&&c.monitorRunDependencies(r),0==r&&bt&&(e=bt,bt=null,e())}function v(t){c.onAbort&&c.onAbort(t),f(t="Aborted("+t+")"),ot=!0,t+=". Build with -sASSERTIONS for more info.";t=new WebAssembly.RuntimeError(t);throw I(t),t}function Tt(t){return t.startsWith("data:application/octet-stream;base64,")}function Ct(t){return t.startsWith("file://")}function Lt(t){try{if(t==y&&tt)return new Uint8Array(tt);if(q)return q(t);throw"both async and sync fetching of the wasm failed"}catch(t){v(t)}}function St(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function Gt(t){for(;0<t.length;)t.shift()(c)}function Ot(t,e){d.set(t,e)}Tt(y="gdal3WebAssembly.wasm")||(Yt=y,y=c.locateFile?c.locateFile(Yt,e):e+Yt);var Nt=[];function C(t){var e=Nt[t];return e||(t>=Nt.length&&(Nt.length=t+1),Nt[t]=e=h.get(t)),e}var Ft=[],jt=0,b=0;function Rt(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){m[this.ptr+4>>2]=t},this.get_type=function(){return m[this.ptr+4>>2]},this.set_destructor=function(t){m[this.ptr+8>>2]=t},this.get_destructor=function(){return m[this.ptr+8>>2]},this.set_refcount=function(t){_[this.ptr>>2]=t},this.set_caught=function(t){d[this.ptr+12>>0]=t=t?1:0},this.get_caught=function(){return 0!=d[this.ptr+12>>0]},this.set_rethrown=function(t){d[this.ptr+13>>0]=t=t?1:0},this.get_rethrown=function(){return 0!=d[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var t=_[this.ptr>>2];_[this.ptr>>2]=t+1},this.release_ref=function(){var t=_[this.ptr>>2];return _[this.ptr>>2]=t-1,1===t},this.set_adjusted_ptr=function(t){m[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return m[this.ptr+16>>2]},this.get_exception_ptr=function(){if(he(this.get_type()))return m[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function Pt(t){return fe(new Rt(t).ptr)}var D={isAbs:function(t){return"/"===t.charAt(0)},splitPath:function(t){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1)},normalizeArray:function(t,e){for(var r=0,n=t.length-1;0<=n;n--){var a=t[n];"."===a?t.splice(n,1):".."===a?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:function(t){var e=D.isAbs(t),r="/"===t.substr(-1);return(t=(t=D.normalizeArray(t.split("/").filter(function(t){return!!t}),!e).join("/"))||e?t:".")&&r&&(t+="/"),(e?"/":"")+t},dirname:function(t){var t=D.splitPath(t),e=t[0],t=t[1];return e||t?e+(t=t&&t.substr(0,t.length-1)):"."},basename:function(t){if("/"===t)return"/";var e=(t=(t=D.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments,0);return D.normalize(t.join("/"))},join2:function(t,e){return D.normalize(t+"/"+e)}};function Mt(){var t;if("object"==("undefined"==typeof crypto?"undefined":kr(crypto))&&"function"==typeof crypto.getRandomValues)return t=new Uint8Array(1),function(){return crypto.getRandomValues(t),t[0]};if(i)try{var e=void 0;return function(){return e.randomBytes(1)[0]}}catch(t){}return function(){v("randomDevice")}}var A={resolve:function(){for(var t="",e=!1,r=arguments.length-1;-1<=r&&!e;r--){var n=0<=r?arguments[r]:G.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=D.isAbs(n)}return(e?"/":"")+(t=D.normalizeArray(t.split("/").filter(function(t){return!!t}),!e).join("/"))||"."},relative:function(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;0<=r&&""===t[r];r--);return r<e?[]:t.slice(e,r-e+1)}t=A.resolve(t).substr(1),e=A.resolve(e).substr(1);for(var n=r(t.split("/")),a=r(e.split("/")),o=Math.min(n.length,a.length),i=o,s=0;s<o;s++)if(n[s]!==a[s]){i=s;break}for(var u=[],s=i;s<n.length;s++)u.push("..");return(u=u.concat(a.slice(i))).join("/")}};function kt(t,e,r){r=0<r?r:ht(t)+1,r=new Array(r),t=pt(t,r,0,r.length);return e&&(r.length=t),r}var n={ttys:[],init:function(){},shutdown:function(){},register:function(t,e){n.ttys[t]={input:[],output:[],ops:e},G.registerDevice(t,n.stream_ops)},stream_ops:{open:function(t){var e=n.ttys[t.node.rdev];if(!e)throw new G.ErrnoError(43);t.tty=e,t.seekable=!1},close:function(t){t.tty.ops.flush(t.tty)},flush:function(t){t.tty.ops.flush(t.tty)},read:function(t,e,r,n,a){if(!t.tty||!t.tty.ops.get_char)throw new G.ErrnoError(60);for(var o,i=0,s=0;s<n;s++){try{o=t.tty.ops.get_char(t.tty)}catch(t){throw new G.ErrnoError(29)}if(void 0===o&&0===i)throw new G.ErrnoError(6);if(null==o)break;i++,e[r+s]=o}return i&&(t.node.timestamp=Date.now()),i},write:function(t,e,r,n,a){if(!t.tty||!t.tty.ops.put_char)throw new G.ErrnoError(60);try{for(var o=0;o<n;o++)t.tty.ops.put_char(t.tty,e[r+o])}catch(t){throw new G.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),o}},default_tty_ops:{get_char:function(t){if(!t.input.length){var e=null;if(i){var r=Buffer.alloc(256),n=0;try{n=o.readSync(process.stdin.fd,r,0,256,-1)}catch(t){if(!t.toString().includes("EOF"))throw t;n=0}e=0<n?r.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;t.input=kt(e,!0)}return t.input.shift()},put_char:function(t,e){null===e||10===e?(rt(dt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(rt(dt(t.output,0)),t.output=[])}},default_tty1_ops:{put_char:function(t,e){null===e||10===e?(f(dt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},flush:function(t){t.output&&0<t.output.length&&(f(dt(t.output,0)),t.output=[])}}};function It(t){r=t,e=65536,t=Math.ceil(r/e)*e;var e,r=de(65536,t);return r?(e=t,p.fill(0,r,r+e),r):0}var T={ops_table:null,mount:function(t){return T.createNode(null,"/",16895,0)},createNode:function(t,e,r,n){if(G.isBlkdev(r)||G.isFIFO(r))throw new G.ErrnoError(63);T.ops_table||(T.ops_table={dir:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,lookup:T.node_ops.lookup,mknod:T.node_ops.mknod,rename:T.node_ops.rename,unlink:T.node_ops.unlink,rmdir:T.node_ops.rmdir,readdir:T.node_ops.readdir,symlink:T.node_ops.symlink},stream:{llseek:T.stream_ops.llseek}},file:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:{llseek:T.stream_ops.llseek,read:T.stream_ops.read,write:T.stream_ops.write,allocate:T.stream_ops.allocate,mmap:T.stream_ops.mmap,msync:T.stream_ops.msync}},link:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr,readlink:T.node_ops.readlink},stream:{}},chrdev:{node:{getattr:T.node_ops.getattr,setattr:T.node_ops.setattr},stream:G.chrdev_stream_ops}});r=G.createNode(t,e,r,n);return G.isDir(r.mode)?(r.node_ops=T.ops_table.dir.node,r.stream_ops=T.ops_table.dir.stream,r.contents={}):G.isFile(r.mode)?(r.node_ops=T.ops_table.file.node,r.stream_ops=T.ops_table.file.stream,r.usedBytes=0,r.contents=null):G.isLink(r.mode)?(r.node_ops=T.ops_table.link.node,r.stream_ops=T.ops_table.link.stream):G.isChrdev(r.mode)&&(r.node_ops=T.ops_table.chrdev.node,r.stream_ops=T.ops_table.chrdev.stream),r.timestamp=Date.now(),t&&(t.contents[e]=r,t.timestamp=r.timestamp),r},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;e<=r||(e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256)),r=t.contents,t.contents=new Uint8Array(e),0<t.usedBytes&&t.contents.set(r.subarray(0,t.usedBytes),0))},resizeFileStorage:function(t,e){var r;t.usedBytes!=e&&(0==e?(t.contents=null,t.usedBytes=0):(r=t.contents,t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e))},node_ops:{getattr:function(t){var e={};return e.dev=G.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,G.isDir(t.mode)?e.size=4096:G.isFile(t.mode)?e.size=t.usedBytes:G.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&T.resizeFileStorage(t,e.size)},lookup:function(t,e){throw G.genericErrors[44]},mknod:function(t,e,r,n){return T.createNode(t,e,r,n)},rename:function(t,e,r){if(G.isDir(t.mode)){var n;try{n=G.lookupNode(e,r)}catch(t){}if(n)for(var a in n.contents)throw new G.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){for(var r in G.lookupNode(t,e).contents)throw new G.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e,r=[".",".."];for(e in t.contents)t.contents.hasOwnProperty(e)&&r.push(e);return r},symlink:function(t,e,r){t=T.createNode(t,e,41471,0);return t.link=r,t},readlink:function(t){if(G.isLink(t.mode))return t.link;throw new G.ErrnoError(28)}},stream_ops:{read:function(t,e,r,n,a){var o=t.node.contents;if(a>=t.node.usedBytes)return 0;var i=Math.min(t.node.usedBytes-a,n);if(8<i&&o.subarray)e.set(o.subarray(a,a+i),r);else for(var s=0;s<i;s++)e[r+s]=o[a+s];return i},write:function(t,e,r,n,a,o){if(e.buffer===d.buffer&&(o=!1),!n)return 0;var i=t.node;if(i.timestamp=Date.now(),e.subarray&&(!i.contents||i.contents.subarray)){if(o)return i.contents=e.subarray(r,r+n),i.usedBytes=n;if(0===i.usedBytes&&0===a)return i.contents=e.slice(r,r+n),i.usedBytes=n;if(a+n<=i.usedBytes)return i.contents.set(e.subarray(r,r+n),a),n}if(T.expandFileStorage(i,a+n),i.contents.subarray&&e.subarray)i.contents.set(e.subarray(r,r+n),a);else for(var s=0;s<n;s++)i.contents[a+s]=e[r+s];return i.usedBytes=Math.max(i.usedBytes,a+n),n},llseek:function(t,e,r){if(1===r?e+=t.position:2===r&&G.isFile(t.node.mode)&&(e+=t.node.usedBytes),e<0)throw new G.ErrnoError(28);return e},allocate:function(t,e,r){T.expandFileStorage(t.node,e+r),t.node.usedBytes=Math.max(t.node.usedBytes,e+r)},mmap:function(t,e,r,n,a){if(!G.isFile(t.node.mode))throw new G.ErrnoError(43);var o,i,t=t.node.contents;if(2&a||t.buffer!==st){if((0<r||r+e<t.length)&&(t=t.subarray?t.subarray(r,r+e):Array.prototype.slice.call(t,r,r+e)),i=!0,!(o=It(e)))throw new G.ErrnoError(48);d.set(t,o)}else i=!1,o=t.byteOffset;return{ptr:o,allocated:i}},msync:function(t,e,r,n,a){if(G.isFile(t.node.mode))return 2&a||T.stream_ops.write(t,e,0,n,r,!1),0;throw new G.ErrnoError(43)}}},xt={},L={isWindows:!1,staticInit:function(){L.isWindows=!!process.platform.match(/^win/);var t=process.binding("constants");t.fs&&(t=t.fs),L.flagsForNodeMap={1024:t.O_APPEND,64:t.O_CREAT,128:t.O_EXCL,256:t.O_NOCTTY,0:t.O_RDONLY,2:t.O_RDWR,4096:t.O_SYNC,512:t.O_TRUNC,1:t.O_WRONLY,131072:t.O_NOFOLLOW}},convertNodeCode:function(t){t=t.code;return xt[t]},mount:function(t){return L.createNode(null,"/",L.getMode(t.opts.root),0)},createNode:function(t,e,r,n){if(!G.isDir(r)&&!G.isFile(r)&&!G.isLink(r))throw new G.ErrnoError(28);t=G.createNode(t,e,r);return t.node_ops=L.node_ops,t.stream_ops=L.stream_ops,t},getMode:function(t){var e;try{e=o.lstatSync(t),L.isWindows&&(e.mode=e.mode|(292&e.mode)>>2)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}return e.mode},realPath:function(t){for(var e=[];t.parent!==t;)e.push(t.name),t=t.parent;return e.push(t.mount.opts.root),e.reverse(),D.join.apply(null,e)},flagsForNode:function(t){t=-2097153&t&-2049&-32769&-524289&-65537;var e,r=0;for(e in L.flagsForNodeMap)t&e&&(r|=L.flagsForNodeMap[e],t^=e);if(t)throw new G.ErrnoError(28);return r},node_ops:{getattr:function(t){var e,t=L.realPath(t);try{e=o.lstatSync(t)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}return L.isWindows&&!e.blksize&&(e.blksize=4096),L.isWindows&&!e.blocks&&(e.blocks=(e.size+e.blksize-1)/e.blksize|0),{dev:e.dev,ino:e.ino,mode:e.mode,nlink:e.nlink,uid:e.uid,gid:e.gid,rdev:e.rdev,size:e.size,atime:e.atime,mtime:e.mtime,ctime:e.ctime,blksize:e.blksize,blocks:e.blocks}},setattr:function(t,e){var r,n=L.realPath(t);try{void 0!==e.mode&&(o.chmodSync(n,e.mode),t.mode=e.mode),void 0!==e.timestamp&&(r=new Date(e.timestamp),o.utimesSync(n,r,r)),void 0!==e.size&&o.truncateSync(n,e.size)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},lookup:function(t,e){var r=D.join2(L.realPath(t),e),r=L.getMode(r);return L.createNode(t,e,r)},mknod:function(t,e,r,n){t=L.createNode(t,e,r,n),e=L.realPath(t);try{G.isDir(t.mode)?o.mkdirSync(e,t.mode):o.writeFileSync(e,"",{mode:t.mode})}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}return t},rename:function(t,e,r){var n=L.realPath(t),e=D.join2(L.realPath(e),r);try{o.renameSync(n,e)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}t.name=r},unlink:function(t,e){t=D.join2(L.realPath(t),e);try{o.unlinkSync(t)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},rmdir:function(t,e){t=D.join2(L.realPath(t),e);try{o.rmdirSync(t)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},readdir:function(t){t=L.realPath(t);try{return o.readdirSync(t)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},symlink:function(t,e,r){t=D.join2(L.realPath(t),e);try{o.symlinkSync(r,t)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},readlink:function(t){var e=L.realPath(t);try{return e=o.readlinkSync(e),a.relative(a.resolve(t.mount.opts.root),e)}catch(t){if(!t.code)throw t;if("UNKNOWN"===t.code)throw new G.ErrnoError(28);throw new G.ErrnoError(L.convertNodeCode(t))}}},stream_ops:{open:function(t){var e=L.realPath(t.node);try{G.isFile(t.node.mode)&&(t.nfd=o.openSync(e,L.flagsForNode(t.flags)))}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},close:function(t){try{G.isFile(t.node.mode)&&t.nfd&&o.closeSync(t.nfd)}catch(t){if(t.code)throw new G.ErrnoError(L.convertNodeCode(t));throw t}},read:function(t,e,r,n,a){if(0===n)return 0;try{return o.readSync(t.nfd,Buffer.from(e.buffer),r,n,a)}catch(t){throw new G.ErrnoError(L.convertNodeCode(t))}},write:function(t,e,r,n,a){try{return o.writeSync(t.nfd,Buffer.from(e.buffer),r,n,a)}catch(t){throw new G.ErrnoError(L.convertNodeCode(t))}},llseek:function(t,e,r){if(1===r)e+=t.position;else if(2===r&&G.isFile(t.node.mode))try{e+=o.fstatSync(t.nfd).size}catch(t){throw new G.ErrnoError(L.convertNodeCode(t))}if(e<0)throw new G.ErrnoError(28);return e},mmap:function(t,e,r,n,a){if(!G.isFile(t.node.mode))throw new G.ErrnoError(43);var o=It(e);return L.stream_ops.read(t,d,o,e,r),{ptr:o,allocated:!0}},msync:function(t,e,r,n,a){if(G.isFile(t.node.mode))return 2&a||L.stream_ops.write(t,e,0,n,r,!1),0;throw new G.ErrnoError(43)}}},S={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount:function(t){it(l),S.reader||(S.reader=new FileReaderSync);var o=S.createNode(null,"/",S.DIR_MODE,0),i={};function n(t){for(var e=t.split("/"),r=o,n=0;n<e.length-1;n++){var a=e.slice(0,n+1).join("/");i[a]||(i[a]=S.createNode(r,e[n],S.DIR_MODE,0)),r=i[a]}return r}function a(t){t=t.split("/");return t[t.length-1]}return Array.prototype.forEach.call(t.opts.files||[],function(t){S.createNode(n(t.name),a(t.name),S.FILE_MODE,0,t,t.lastModifiedDate)}),(t.opts.blobs||[]).forEach(function(t){S.createNode(n(t.name),a(t.name),S.FILE_MODE,0,t.data)}),(t.opts.packages||[]).forEach(function(r){r.metadata.files.forEach(function(t){var e=t.filename.substr(1);S.createNode(n(e),a(e),S.FILE_MODE,0,r.blob.slice(t.start,t.end))})}),o},createNode:function(t,e,r,n,a,o){var i=G.createNode(t,e,r);return i.mode=r,i.node_ops=S.node_ops,i.stream_ops=S.stream_ops,i.timestamp=(o||new Date).getTime(),it(S.FILE_MODE!==S.DIR_MODE),r===S.FILE_MODE?(i.size=a.size,i.contents=a):(i.size=4096,i.contents={}),t&&(t.contents[e]=i),i},node_ops:{getattr:function(t){return{dev:1,ino:t.id,mode:t.mode,nlink:1,uid:0,gid:0,rdev:void 0,size:t.size,atime:new Date(t.timestamp),mtime:new Date(t.timestamp),ctime:new Date(t.timestamp),blksize:4096,blocks:Math.ceil(t.size/4096)}},setattr:function(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp)},lookup:function(t,e){throw new G.ErrnoError(44)},mknod:function(t,e,r,n){throw new G.ErrnoError(63)},rename:function(t,e,r){throw new G.ErrnoError(63)},unlink:function(t,e){throw new G.ErrnoError(63)},rmdir:function(t,e){throw new G.ErrnoError(63)},readdir:function(t){var e,r=[".",".."];for(e in t.contents)t.contents.hasOwnProperty(e)&&r.push(e);return r},symlink:function(t,e,r){throw new G.ErrnoError(63)},readlink:function(t){throw new G.ErrnoError(63)}},stream_ops:{read:function(t,e,r,n,a){if(a>=t.node.size)return 0;t=t.node.contents.slice(a,a+n),a=S.reader.readAsArrayBuffer(t);return e.set(new Uint8Array(a),r),t.size},write:function(t,e,r,n,a){throw new G.ErrnoError(29)},llseek:function(t,e,r){if(1===r?e+=t.position:2===r&&G.isFile(t.node.mode)&&(e+=t.node.size),e<0)throw new G.ErrnoError(28);return e}}},G={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!(t=A.resolve(G.cwd(),t)))return{path:"",node:null};if(8<(e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count)throw new G.ErrnoError(32);for(var r=D.normalizeArray(t.split("/").filter(function(t){return!!t}),!1),n=G.root,a="/",o=0;o<r.length;o++){var i=o===r.length-1;if(i&&e.parent)break;if(n=G.lookupNode(n,r[o]),a=D.join2(a,r[o]),!G.isMountpoint(n)||i&&!e.follow_mount||(n=n.mounted.root),!i||e.follow)for(var s=0;G.isLink(n.mode);){var u=G.readlink(a),a=A.resolve(D.dirname(a),u),n=G.lookupPath(a,{recurse_count:e.recurse_count+1}).node;if(40<s++)throw new G.ErrnoError(32)}}return{path:a,node:n}},getPath:function(t){for(var e,r;;){if(G.isRoot(t))return r=t.mount.mountpoint,e?"/"!==r[r.length-1]?r+"/"+e:r+e:r;e=e?t.name+"/"+e:t.name,t=t.parent}},hashName:function(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%G.nameTable.length},hashAddNode:function(t){var e=G.hashName(t.parent.id,t.name);t.name_next=G.nameTable[e],G.nameTable[e]=t},hashRemoveNode:function(t){var e=G.hashName(t.parent.id,t.name);if(G.nameTable[e]===t)G.nameTable[e]=t.name_next;else for(var r=G.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode:function(t,e){var r=G.mayLookup(t);if(r)throw new G.ErrnoError(r,t);for(var r=G.hashName(t.id,e),n=G.nameTable[r];n;n=n.name_next){var a=n.name;if(n.parent.id===t.id&&a===e)return n}return G.lookup(t,e)},createNode:function(t,e,r,n){t=new G.FSNode(t,e,r,n);return G.hashAddNode(t),t},destroyNode:function(t){G.hashRemoveNode(t)},isRoot:function(t){return t===t.parent},isMountpoint:function(t){return!!t.mounted},isFile:function(t){return 32768==(61440&t)},isDir:function(t){return 16384==(61440&t)},isLink:function(t){return 40960==(61440&t)},isChrdev:function(t){return 8192==(61440&t)},isBlkdev:function(t){return 24576==(61440&t)},isFIFO:function(t){return 4096==(61440&t)},isSocket:function(t){return 49152==(49152&t)},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(t){var e=G.flagModes[t];if(void 0===e)throw new Error("Unknown file open mode: "+t);return e},flagsToPermissionString:function(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:function(t,e){return G.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2},mayLookup:function(t){var e=G.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate:function(t,e){try{G.lookupNode(t,e);return 20}catch(t){}return G.nodePermissions(t,"wx")},mayDelete:function(t,e,r){var n;try{n=G.lookupNode(t,e)}catch(t){return t.errno}e=G.nodePermissions(t,"wx");if(e)return e;if(r){if(!G.isDir(n.mode))return 54;if(G.isRoot(n)||G.getPath(n)===G.cwd())return 10}else if(G.isDir(n.mode))return 31;return 0},mayOpen:function(t,e){return t?G.isLink(t.mode)?32:G.isDir(t.mode)&&("r"!==G.flagsToPermissionString(e)||512&e)?31:G.nodePermissions(t,G.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:G.MAX_OPEN_FDS,r=t;r<=e;r++)if(!G.streams[r])return r;throw new G.ErrnoError(33)},getStream:function(t){return G.streams[t]},createStream:function(t,e,r){G.FSStream||(G.FSStream=function(){this.shared={}},G.FSStream.prototype={},Object.defineProperties(G.FSStream.prototype,{object:{get:function(){return this.node},set:function(t){this.node=t}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(t){this.shared.flags=t}},position:{get:function(){return this.shared.position},set:function(t){this.shared.position=t}}})),t=Object.assign(new G.FSStream,t);e=G.nextfd(e,r);return t.fd=e,G.streams[e]=t},closeStream:function(t){G.streams[t]=null},chrdev_stream_ops:{open:function(t){var e=G.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek:function(){throw new G.ErrnoError(70)}},major:function(t){return t>>8},minor:function(t){return 255&t},makedev:function(t,e){return t<<8|e},registerDevice:function(t,e){G.devices[t]={stream_ops:e}},getDevice:function(t){return G.devices[t]},getMounts:function(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs:function(e,r){"function"==typeof e&&(r=e,e=!1),G.syncFSRequests++,1<G.syncFSRequests&&f("warning: "+G.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var n=G.getMounts(G.root.mount),a=0;function o(t){return G.syncFSRequests--,r(t)}function i(t){if(t)return i.errored?void 0:(i.errored=!0,o(t));++a>=n.length&&o(null)}n.forEach(function(t){if(!t.type.syncfs)return i(null);t.type.syncfs(t,e,i)})},mount:function(t,e,r){var n,a="/"===r,o=!r;if(a&&G.root)throw new G.ErrnoError(10);if(!a&&!o){o=G.lookupPath(r,{follow_mount:!1});if(r=o.path,n=o.node,G.isMountpoint(n))throw new G.ErrnoError(10);if(!G.isDir(n.mode))throw new G.ErrnoError(54)}o={type:t,opts:e,mountpoint:r,mounts:[]},e=t.mount(o);return(e.mount=o).root=e,a?G.root=e:n&&(n.mounted=o,n.mount&&n.mount.mounts.push(o)),e},unmount:function(t){t=G.lookupPath(t,{follow_mount:!1});if(!G.isMountpoint(t.node))throw new G.ErrnoError(28);var t=t.node,e=t.mounted,n=G.getMounts(e),e=(Object.keys(G.nameTable).forEach(function(t){for(var e=G.nameTable[t];e;){var r=e.name_next;n.includes(e.mount)&&G.destroyNode(e),e=r}}),t.mounted=null,t.mount.mounts.indexOf(e));t.mount.mounts.splice(e,1)},lookup:function(t,e){return t.node_ops.lookup(t,e)},mknod:function(t,e,r){var n=G.lookupPath(t,{parent:!0}).node,t=D.basename(t);if(!t||"."===t||".."===t)throw new G.ErrnoError(28);var a=G.mayCreate(n,t);if(a)throw new G.ErrnoError(a);if(n.node_ops.mknod)return n.node_ops.mknod(n,t,e,r);throw new G.ErrnoError(63)},create:function(t,e){return G.mknod(t,e=(e=void 0!==e?e:438)&4095|32768,0)},mkdir:function(t,e){return G.mknod(t,e=(e=void 0!==e?e:511)&1023|16384,0)},mkdirTree:function(t,e){for(var r=t.split("/"),n="",a=0;a<r.length;++a)if(r[a]){n+="/"+r[a];try{G.mkdir(n,e)}catch(t){if(20!=t.errno)throw t}}},mkdev:function(t,e,r){return void 0===r&&(r=e,e=438),G.mknod(t,e|=8192,r)},symlink:function(t,e){if(!A.resolve(t))throw new G.ErrnoError(44);var r=G.lookupPath(e,{parent:!0}).node;if(!r)throw new G.ErrnoError(44);var e=D.basename(e),n=G.mayCreate(r,e);if(n)throw new G.ErrnoError(n);if(r.node_ops.symlink)return r.node_ops.symlink(r,e,t);throw new G.ErrnoError(63)},rename:function(t,e){var r=D.dirname(t),n=D.dirname(e),a=D.basename(t),o=D.basename(e),i=G.lookupPath(t,{parent:!0}),i=i.node,s=G.lookupPath(e,{parent:!0}).node;if(!i||!s)throw new G.ErrnoError(44);if(i.mount!==s.mount)throw new G.ErrnoError(75);var u,c=G.lookupNode(i,a),t=A.relative(t,n);if("."!==t.charAt(0))throw new G.ErrnoError(28);if("."!==(t=A.relative(e,r)).charAt(0))throw new G.ErrnoError(55);try{u=G.lookupNode(s,o)}catch(t){}if(c!==u){n=G.isDir(c.mode),e=G.mayDelete(i,a,n);if(e)throw new G.ErrnoError(e);if(e=u?G.mayDelete(s,o,n):G.mayCreate(s,o))throw new G.ErrnoError(e);if(!i.node_ops.rename)throw new G.ErrnoError(63);if(G.isMountpoint(c)||u&&G.isMountpoint(u))throw new G.ErrnoError(10);if(s!==i&&(e=G.nodePermissions(i,"w")))throw new G.ErrnoError(e);G.hashRemoveNode(c);try{i.node_ops.rename(c,s,o)}catch(t){throw t}finally{G.hashAddNode(c)}}},rmdir:function(t){var e=G.lookupPath(t,{parent:!0}).node,t=D.basename(t),r=G.lookupNode(e,t),n=G.mayDelete(e,t,!0);if(n)throw new G.ErrnoError(n);if(!e.node_ops.rmdir)throw new G.ErrnoError(63);if(G.isMountpoint(r))throw new G.ErrnoError(10);e.node_ops.rmdir(e,t),G.destroyNode(r)},readdir:function(t){t=G.lookupPath(t,{follow:!0}).node;if(t.node_ops.readdir)return t.node_ops.readdir(t);throw new G.ErrnoError(54)},unlink:function(t){var e=G.lookupPath(t,{parent:!0}).node;if(!e)throw new G.ErrnoError(44);var t=D.basename(t),r=G.lookupNode(e,t),n=G.mayDelete(e,t,!1);if(n)throw new G.ErrnoError(n);if(!e.node_ops.unlink)throw new G.ErrnoError(63);if(G.isMountpoint(r))throw new G.ErrnoError(10);e.node_ops.unlink(e,t),G.destroyNode(r)},readlink:function(t){t=G.lookupPath(t).node;if(!t)throw new G.ErrnoError(44);if(t.node_ops.readlink)return A.resolve(G.getPath(t.parent),t.node_ops.readlink(t));throw new G.ErrnoError(28)},stat:function(t,e){t=G.lookupPath(t,{follow:!e}).node;if(!t)throw new G.ErrnoError(44);if(t.node_ops.getattr)return t.node_ops.getattr(t);throw new G.ErrnoError(63)},lstat:function(t){return G.stat(t,!0)},chmod:function(t,e,r){if(!(r="string"==typeof t?G.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new G.ErrnoError(63);r.node_ops.setattr(r,{mode:4095&e|-4096&r.mode,timestamp:Date.now()})},lchmod:function(t,e){G.chmod(t,e,!0)},fchmod:function(t,e){t=G.getStream(t);if(!t)throw new G.ErrnoError(8);G.chmod(t.node,e)},chown:function(t,e,r,n){if(!(n="string"==typeof t?G.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new G.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:function(t,e,r){G.chown(t,e,r,!0)},fchown:function(t,e,r){t=G.getStream(t);if(!t)throw new G.ErrnoError(8);G.chown(t.node,e,r)},truncate:function(t,e){if(e<0)throw new G.ErrnoError(28);if(!(t="string"==typeof t?G.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new G.ErrnoError(63);if(G.isDir(t.mode))throw new G.ErrnoError(31);if(!G.isFile(t.mode))throw new G.ErrnoError(28);var r=G.nodePermissions(t,"w");if(r)throw new G.ErrnoError(r);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate:function(t,e){t=G.getStream(t);if(!t)throw new G.ErrnoError(8);if(0==(2097155&t.flags))throw new G.ErrnoError(28);G.truncate(t.node,e)},utime:function(t,e,r){t=G.lookupPath(t,{follow:!0}).node;t.node_ops.setattr(t,{timestamp:Math.m