geospec-engine 0.1.1-next.144 → 0.1.1-next.155

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/README.md CHANGED
@@ -38,6 +38,24 @@ BRep features and PMI, spatial/CSG analysis, and separately bounded proof querie
38
38
  Unsupported or insufficient evidence produces an explicit refusal/error rather
39
39
  than a geometric pass, including under negation.
40
40
 
41
+ Admission and retention limits default to the entry profile
42
+ (`geospec-entry-config-v1`: 64 MiB subject and resource, 128 MiB total binary,
43
+ 2 000 000 vertices, 4 000 000 triangles, 256 MiB retained analysis, 32 retained
44
+ subjects). A host may select other limits when it constructs an engine: Node
45
+ `new Engine(cacheOptions, executionPermits, limits)`, WASM
46
+ `new Engine(execution, limits)` and Python `GeoSpecEngine(limits=...)` accept
47
+ `maxSubjectBytes`, `maxResourceBytes`, `maxTotalBinaryBytes`, `maxVertices`,
48
+ `maxTriangles`, `maxMeshBytes` and `maxRetainedSubjects` (snake_case in Python).
49
+
50
+ Each limit must be a positive integer, and the subject and resource limits must
51
+ not exceed the total; anything else refuses with `invalid-request`. Native hosts
52
+ may raise limits to fit the machine and the task. The WASM default stays the
53
+ entry profile, which fits the wasm32 address space. The initialization response
54
+ reports the effective limits. Any configuration other than the entry profile
55
+ carries a `geospec-host-config-v1-…` profile id derived from its values, so a
56
+ run records which limits it used. Raised limits change no tolerance or refusal
57
+ rule.
58
+
41
59
  Use `geospec/assertion-client` for standalone JS host composition,
42
60
  `geospec/vitest` for Vitest integration, and the wheel's `geospec` facade
43
61
  and pytest plugin for Python. These clients retain canonical claims/results from
@@ -1,2 +1,2 @@
1
- async function Module(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url)}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.resizable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAP64=new BigInt64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();wasmExports["C"]();FS.ignorePermissions=false}function postRun(){}function abort(what){what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";if(runtimeInitialized){___trap()}var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("geospec_engine_native.wasm")}return new URL("geospec_engine_native.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.slice(0,-1)}return root+dir},basename:path=>path&&path.match(/([^\/]+|\/)\/*$/)[1],join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("node:crypto");return view=>(nodeCrypto.randomFillSync(view),0)}return view=>(crypto.getRandomValues(view),0)};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=MEMFS.emptyFileContents??=new Uint8Array(0)}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){return node.contents.subarray(0,node.usedBytes)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents.length;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity)newCapacity=Math.max(newCapacity,256);var oldContents=MEMFS.getFileDataAsTypedArray(node);node.contents=new Uint8Array(newCapacity);node.contents.set(oldContents)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;var oldContents=node.contents;node.contents=new Uint8Array(newSize);node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));node.usedBytes=newSize},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]!=null){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){if(!MEMFS.doesNotExistError){MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>"}throw MEMFS.doesNotExistError},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);buffer.set(contents.subarray(position,position+size),offset);return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length}else{MEMFS.expandFileStorage(node,position+length);node.contents.set(buffer.subarray(offset,offset+length),position);node.usedBytes=Math.max(node.usedBytes,position+length)}return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var FS_modeStringToFlags=str=>{if(typeof str!="string")return str;var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_fileDataToTypedArray=data=>{if(typeof data=="string"){data=intArrayFromString(data,true)}if(!data.subarray){data=new Uint8Array(data)}return data};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(...args)=>FS.createDataFile(...args);var getUniqueRunDependency=id=>id;var dependenciesPromise=null;var resolveRunDependencies=async()=>dependenciesPromise;var runDependencies=0;var dependenciesPromiseResolve=null;var removeRunDependency=id=>{runDependencies--;if(!runDependencies){dependenciesPromiseResolve()}};var addRunDependency=id=>{if(!runDependencies){dependenciesPromise=new Promise(resolve=>dependenciesPromiseResolve=resolve)}runDependencies++};var preloadPlugins=[];var FS_handledByPreloadPlugin=async(byteArray,fullname)=>{if(typeof Browser!="undefined")Browser.init();for(var plugin of preloadPlugins){if(plugin["canHandle"](fullname)){return plugin["handle"](byteArray,fullname)}}return byteArray};var FS_preloadFile=async(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);addRunDependency(dep);try{var byteArray=url;if(typeof url=="string"){byteArray=await asyncLoad(url)}byteArray=await FS_handledByPreloadPlugin(byteArray,fullname);preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}}finally{removeRunDependency(dep)}};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{FS_preloadFile(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish).then(onload).catch(onerror)};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(errno){this.errno=errno}},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}addListener(cb,exclusive=false){var entry={cb,exclusive};var listeners=this.listeners??=new Set;listeners.add(entry);return{listeners,entry}}notifyListeners(flags){if(!this.listeners)return;var excl;for(var entry of this.listeners){if(entry.exclusive)(excl||=[]).push(entry);else entry.cb(flags)}if(excl){var i=(this.exclTurn||0)%excl.length;this.exclTurn=i+1;excl[i].cb(flags)}}},lookupPath(path,opts={}){if(!path){throw new FS.ErrnoError(44)}opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]==="."){continue}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");nlinks--;continue linkloop}else{current=current.parent}continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}if(perms.includes("w")&&!(node.mode&146)){return 2}if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else if(FS.isDir(node.mode)){return 31}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}var mode=FS.flagsToPermissionString(flags);if(FS.isDir(node.mode)){if(mode!=="r"||flags&(512|64)){return 31}}return FS.nodePermissions(node,mode)},checkOpExists(op,err){if(!op){throw new FS.ErrnoError(err)}return op},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},doSetAttr(stream,node,attr){var setattr=stream?.stream_ops.setattr;var arg=setattr?stream:node;setattr??=node.node_ops.setattr;FS.checkOpExists(setattr,63);try{setattr(arg,attr)}catch(e){if(e instanceof RangeError){throw new FS.ErrnoError(22)}throw e}},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}for(var mount of mounts){if(mount.type.syncfs){mount.type.syncfs(mount,populate,done)}else{done(null)}}},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);for(var[hash,current]of Object.entries(FS.nameTable)){while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}}node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28)}if(name==="."||name===".."){throw new FS.ErrnoError(20)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node)},statfsStream(stream){return FS.statfsNode(stream.node)},statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var dir of dirs){if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},link(oldpath,newpath,flags){var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.link){throw new FS.ErrnoError(34)}return parent.node_ops.link(parent,newname,oldpath,flags)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node)},fstat(fd){var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;getattr??=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg)},lstat(path){return FS.stat(path,true)},doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow})},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChmod(null,node,mode,dontFollow)},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false)},doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow})},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChown(null,node,dontFollow)},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false)},doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()})},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}FS.doTruncate(null,node,len)},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.doTruncate(stream,stream.node,len)},utime(path,atime,mtime,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});FS.doSetAttr(null,lookup.node,{atime,mtime,dontFollow})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=FS_modeStringToFlags(flags);if(flags&64){mode=mode&4095|32768}else{mode=0}var node;var isDirPath;if(typeof path=="object"){node=path}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else if(isDirPath){throw new FS.ErrnoError(31)}else{node=FS.mknod(path,mode|511,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(created){FS.chmod(node,mode&511)}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;stream.node?.notifyListeners(32);try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags??0;opts.encoding=opts.encoding??"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){abort(`Invalid encoding type "${opts.encoding}"`)}var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){buf=UTF8ArrayToString(buf)}FS.close(stream);return buf},writeFile(path,data,opts={}){opts.flags=opts.flags??577;var stream=FS.open(path,opts.flags,opts.mode);data=FS_fileDataToTypedArray(data);FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn);FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomFill(randomBuffer);randomLeft=randomBuffer.byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){FS.initialized=true;FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;for(var stream of FS.streams){if(stream){FS.close(stream)}}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){if(e.errno!=20)throw e}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){data=FS_fileDataToTypedArray(data);FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(globalThis.XMLHttpRequest){abort("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.")}else{try{obj.contents=readBinary(obj.url)}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort(`Couldn't load ${url}. Status: ${xhr.status}`);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)abort(`invalid range (${from}, ${to}) or no bytes requested!`);if(to>datalength-1)abort(`only ${datalength} bytes available! programmer error!`);var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range",`bytes=${from}-${to}`);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort(`Couldn't load ${url}. Status: ${xhr.status}`);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText??"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")abort("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(globalThis.XMLHttpRequest){if(!ENVIRONMENT_IS_WORKER)abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};for(const[key,fn]of Object.entries(node.stream_ops)){stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}}function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var HEAPU8;var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var HEAP32;var HEAPU32;var HEAP64;var SYSCALLS={currentUmask:18,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},writeStat(buf,stat){HEAPU32[buf>>2]=stat.dev;HEAPU32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAPU32[buf+12>>2]=stat.uid;HEAPU32[buf+16>>2]=stat.gid;HEAPU32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},writeStatFs(buf,stats){HEAPU32[buf+4>>2]=stats.bsize;HEAPU32[buf+60>>2]=stats.bsize;HEAP64[buf+8>>3]=BigInt(stats.blocks);HEAP64[buf+16>>3]=BigInt(stats.bfree);HEAP64[buf+24>>3]=BigInt(stats.bavail);HEAP64[buf+32>>3]=BigInt(stats.files);HEAP64[buf+40>>3]=BigInt(stats.ffree);HEAPU32[buf+48>>2]=stats.fsid;HEAPU32[buf+64>>2]=stats.flags;HEAPU32[buf+56>>2]=stats.namelen},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.subarray(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;var HEAP16;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();var mask=289792;stream.flags=stream.flags&~mask|arg&mask;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{return SYSCALLS.writeStat(buf,FS.fstat(fd))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21537:case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.lstat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.writeStat(buf,nofollow?FS.lstat(path):FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;if(flags&64){mode&=~SYSCALLS.currentUmask}return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("");var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);if(isNaN(date.getTime())){return 1}HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;return 0}var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_get_now=()=>performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var jsStackTrace=()=>(new Error).stack.toString();var getCallstack=flags=>{var callstack=jsStackTrace();var lines=callstack.split("\n");callstack="";var firefoxRe=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)");var chromeRe=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var line of lines){var symbolName="";var file="";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts?.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=firefoxRe.exec(line);if(parts?.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}if(symbolName=="_emscripten_log"||symbolName=="_emscripten_get_callstack"){callstack="";continue}if(flags&24){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=` at ${symbolName} (${file}:${lineno}:${column})\n`}}callstack=callstack.replace(/\s+$/,"");return callstack};var _emscripten_get_callstack=(flags,str,maxbytes)=>{var callstack=getCallstack(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1};var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram;var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;try{var curr=FS.read(stream,HEAP8,ptr,len,offset)}catch(e){if(ret>0&&e instanceof FS.ErrnoError&&(e.errno==6||e.errno==6)){break}throw e}if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 22;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{if(iovcnt==1){return FS.write(stream,HEAP8,HEAPU32[iov>>2],HEAPU32[iov+4>>2],offset)}var total=0;for(var i=0,p=iov;i<iovcnt;i++,p+=8){total+=HEAPU32[p+4>>2]}var view=new Uint8Array(total);var voff=0;for(var i=0;i<iovcnt;i++,iov+=8){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];view.set(HEAPU8.subarray(ptr,ptr+len),voff);voff+=len}return FS.write(stream,view,0,total,offset)};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var _random_get=(buffer,size)=>randomFill(HEAPU8.subarray(buffer,buffer+size));FS.createPreloadedFile=FS_createPreloadedFile;FS.preloadFile=FS_preloadFile;FS.staticInit();{if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"]}function OSD_MemInfo_getModuleHeapLength(){return Module.HEAP8.length}var _geospec_engine_native_canonical_plan,_geospec_engine_native_canonicalize,_geospec_engine_native_engine_drop,_geospec_engine_native_engine_new,_geospec_engine_native_engine_new_with_execution_permits,_geospec_engine_native_evaluate_claim,_geospec_engine_native_evaluate_plan,_geospec_engine_native_exact_cluster_candidate_control,_geospec_engine_native_ingest_mesh,_geospec_engine_native_ingest_subject,_geospec_engine_native_input_alloc,_geospec_engine_native_input_free,_geospec_engine_native_observations,_geospec_engine_native_process_request,_geospec_engine_native_release_subject,_geospec_engine_native_result_code_length,_geospec_engine_native_result_code_pointer,_geospec_engine_native_result_drop,_geospec_engine_native_result_is_error,_geospec_engine_native_result_length,_geospec_engine_native_result_message_length,_geospec_engine_native_result_message_pointer,_geospec_engine_native_result_pointer,_geospec_engine_native_subject_handle,_malloc,_free,___trap,memory,__indirect_function_table,wasmMemory;function assignWasmExports(wasmExports){_geospec_engine_native_canonical_plan=Module["_geospec_engine_native_canonical_plan"]=wasmExports["D"];_geospec_engine_native_canonicalize=Module["_geospec_engine_native_canonicalize"]=wasmExports["E"];_geospec_engine_native_engine_drop=Module["_geospec_engine_native_engine_drop"]=wasmExports["F"];_geospec_engine_native_engine_new=Module["_geospec_engine_native_engine_new"]=wasmExports["G"];_geospec_engine_native_engine_new_with_execution_permits=Module["_geospec_engine_native_engine_new_with_execution_permits"]=wasmExports["H"];_geospec_engine_native_evaluate_claim=Module["_geospec_engine_native_evaluate_claim"]=wasmExports["I"];_geospec_engine_native_evaluate_plan=Module["_geospec_engine_native_evaluate_plan"]=wasmExports["J"];_geospec_engine_native_exact_cluster_candidate_control=Module["_geospec_engine_native_exact_cluster_candidate_control"]=wasmExports["K"];_geospec_engine_native_ingest_mesh=Module["_geospec_engine_native_ingest_mesh"]=wasmExports["L"];_geospec_engine_native_ingest_subject=Module["_geospec_engine_native_ingest_subject"]=wasmExports["M"];_geospec_engine_native_input_alloc=Module["_geospec_engine_native_input_alloc"]=wasmExports["N"];_geospec_engine_native_input_free=Module["_geospec_engine_native_input_free"]=wasmExports["O"];_geospec_engine_native_observations=Module["_geospec_engine_native_observations"]=wasmExports["P"];_geospec_engine_native_process_request=Module["_geospec_engine_native_process_request"]=wasmExports["Q"];_geospec_engine_native_release_subject=Module["_geospec_engine_native_release_subject"]=wasmExports["R"];_geospec_engine_native_result_code_length=Module["_geospec_engine_native_result_code_length"]=wasmExports["S"];_geospec_engine_native_result_code_pointer=Module["_geospec_engine_native_result_code_pointer"]=wasmExports["T"];_geospec_engine_native_result_drop=Module["_geospec_engine_native_result_drop"]=wasmExports["U"];_geospec_engine_native_result_is_error=Module["_geospec_engine_native_result_is_error"]=wasmExports["V"];_geospec_engine_native_result_length=Module["_geospec_engine_native_result_length"]=wasmExports["W"];_geospec_engine_native_result_message_length=Module["_geospec_engine_native_result_message_length"]=wasmExports["X"];_geospec_engine_native_result_message_pointer=Module["_geospec_engine_native_result_message_pointer"]=wasmExports["Y"];_geospec_engine_native_result_pointer=Module["_geospec_engine_native_result_pointer"]=wasmExports["Z"];_geospec_engine_native_subject_handle=Module["_geospec_engine_native_subject_handle"]=wasmExports["_"];_malloc=Module["_malloc"]=wasmExports["$"];_free=Module["_free"]=wasmExports["aa"];___trap=wasmExports["ba"];memory=wasmMemory=wasmExports["B"];__indirect_function_table=wasmExports["__indirect_function_table"]}var wasmImports={m:OSD_MemInfo_getModuleHeapLength,f:___syscall_chmod,l:___syscall_faccessat,c:___syscall_fcntl64,e:___syscall_fstat64,r:___syscall_getcwd,u:___syscall_ioctl,w:___syscall_lstat64,x:___syscall_newfstatat,d:___syscall_openat,y:___syscall_stat64,z:__abort_js,k:__localtime_js,o:__tzset_js,t:_clock_time_get,n:_emscripten_date_now,p:_emscripten_get_callstack,v:_emscripten_get_heap_max,i:_emscripten_resize_heap,g:_environ_get,h:_environ_sizes_get,A:_exit,b:_fd_close,j:_fd_read,s:_fd_seek,a:_fd_write,q:_random_get};async function run(){preRun();if(runDependencies){await resolveRunDependencies()}if(ABORT)return;initRuntime();postRun()}var wasmExports;wasmExports=await createWasm();await run();
1
+ async function Module(moduleArg={}){var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url)}var programArgs=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}programArgs=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.resizable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAP64=new BigInt64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();wasmExports["C"]();FS.ignorePermissions=false}function postRun(){}function abort(what){what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";if(runtimeInitialized){___trap()}var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("geospec_engine_native.wasm")}return new URL("geospec_engine_native.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.slice(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.slice(0,-1)}return root+dir},basename:path=>path&&path.match(/([^\/]+|\/)\/*$/)[1],join:(...paths)=>PATH.normalize(paths.join("/")),join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(ENVIRONMENT_IS_NODE){var nodeCrypto=require("node:crypto");return view=>(nodeCrypto.randomFillSync(view),0)}return view=>(crypto.getRandomValues(view),0)};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:(...args)=>{var resolvedPath="",resolvedAbsolute=false;for(var i=args.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?args[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).slice(1);to=PATH_FS.resolve(to).slice(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")}};var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.codePointAt(i);if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var intArrayFromString=(stringy,dontAddNull,length)=>{var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array};var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf,0,BUFSIZE)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}}else if(globalThis.window?.prompt){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else{}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=stream.tty.ops.get_char(stream.tty)}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.put_char){throw new FS.ErrnoError(60)}try{for(var i=0;i<length;i++){stream.tty.ops.put_char(stream.tty,buffer[offset+i])}}catch(e){throw new FS.ErrnoError(29)}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}},default_tty_ops:{get_char(tty){return FS_stdin_getChar()},put_char(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){out(UTF8ArrayToString(tty.output));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output?.length>0){err(UTF8ArrayToString(tty.output));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16895,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=MEMFS.emptyFileContents??=new Uint8Array(0)}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.atime=node.mtime=node.ctime=Date.now();if(parent){parent.contents[name]=node;parent.atime=parent.mtime=parent.ctime=node.atime}return node},getFileDataAsTypedArray(node){return node.contents.subarray(0,node.usedBytes)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents.length;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity<CAPACITY_DOUBLING_MAX?2:1.125)>>>0);if(prevCapacity)newCapacity=Math.max(newCapacity,256);var oldContents=MEMFS.getFileDataAsTypedArray(node);node.contents=new Uint8Array(newCapacity);node.contents.set(oldContents)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;var oldContents=node.contents;node.contents=new Uint8Array(newSize);node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)));node.usedBytes=newSize},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.atime);attr.mtime=new Date(node.mtime);attr.ctime=new Date(node.ctime);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){for(const key of["mode","atime","mtime","ctime"]){if(attr[key]!=null){node[key]=attr[key]}}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){if(!MEMFS.doesNotExistError){MEMFS.doesNotExistError=new FS.ErrnoError(44);MEMFS.doesNotExistError.stack="<generic error, no stack>"}throw MEMFS.doesNotExistError},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){if(FS.isDir(old_node.mode)){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}FS.hashRemoveNode(new_node)}delete old_node.parent.contents[old_node.name];new_dir.contents[new_name]=old_node;old_node.name=new_name;new_dir.ctime=new_dir.mtime=old_node.parent.ctime=old_node.parent.mtime=Date.now()},unlink(parent,name){delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.ctime=parent.mtime=Date.now()},readdir(node){return[".","..",...Object.keys(node.contents)]},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);buffer.set(contents.subarray(position,position+size),offset);return size},write(stream,buffer,offset,length,position,canOwn){if(buffer.buffer===HEAP8.buffer){canOwn=false}if(!length)return 0;var node=stream.node;node.mtime=node.ctime=Date.now();if(canOwn){node.contents=buffer.subarray(offset,offset+length);node.usedBytes=length}else if(node.usedBytes===0&&position===0){node.contents=buffer.slice(offset,offset+length);node.usedBytes=length}else{MEMFS.expandFileStorage(node,position+length);node.contents.set(buffer.subarray(offset,offset+length),position);node.usedBytes=Math.max(node.usedBytes,position+length)}return length},llseek(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){position+=stream.node.usedBytes}}if(position<0){throw new FS.ErrnoError(28)}return position},mmap(stream,length,position,prot,flags){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}var ptr;var allocated;var contents=stream.node.contents;if(!(flags&2)&&contents.buffer===HEAP8.buffer){allocated=false;ptr=contents.byteOffset}else{allocated=true;ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}if(contents){if(position>0||position+length<contents.length){if(contents.subarray){contents=contents.subarray(position,position+length)}else{contents=Array.prototype.slice.call(contents,position,position+length)}}HEAP8.set(contents,ptr)}}return{ptr,allocated}},msync(stream,buffer,offset,length,mmapFlags){MEMFS.stream_ops.write(stream,buffer,0,length,offset,false);return 0}}};var FS_modeStringToFlags=str=>{if(typeof str!="string")return str;var flagModes={r:0,"r+":2,w:512|64|1,"w+":512|64|2,a:1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_fileDataToTypedArray=data=>{if(typeof data=="string"){data=intArrayFromString(data,true)}if(!data.subarray){data=new Uint8Array(data)}return data};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var asyncLoad=async url=>{var arrayBuffer=await readAsync(url);return new Uint8Array(arrayBuffer)};var FS_createDataFile=(...args)=>FS.createDataFile(...args);var getUniqueRunDependency=id=>id;var dependenciesPromise=null;var resolveRunDependencies=async()=>dependenciesPromise;var runDependencies=0;var dependenciesPromiseResolve=null;var removeRunDependency=id=>{runDependencies--;if(!runDependencies){dependenciesPromiseResolve()}};var addRunDependency=id=>{if(!runDependencies){dependenciesPromise=new Promise(resolve=>dependenciesPromiseResolve=resolve)}runDependencies++};var preloadPlugins=[];var FS_handledByPreloadPlugin=async(byteArray,fullname)=>{if(typeof Browser!="undefined")Browser.init();for(var plugin of preloadPlugins){if(plugin["canHandle"](fullname)){return plugin["handle"](byteArray,fullname)}}return byteArray};var FS_preloadFile=async(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);addRunDependency(dep);try{var byteArray=url;if(typeof url=="string"){byteArray=await asyncLoad(url)}byteArray=await FS_handledByPreloadPlugin(byteArray,fullname);preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}}finally{removeRunDependency(dep)}};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{FS_preloadFile(parent,name,url,canRead,canWrite,dontCreateFile,canOwn,preFinish).then(onload).catch(onerror)};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(errno){this.errno=errno}},FSStream:class{shared={};get object(){return this.node}set object(val){this.node=val}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(val){this.shared.flags=val}get position(){return this.shared.position}set position(val){this.shared.position=val}},FSNode:class{node_ops={};stream_ops={};readMode=292|73;writeMode=146;mounted=null;constructor(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.rdev=rdev;this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(val){val?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(val){val?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return FS.isDir(this.mode)}get isDevice(){return FS.isChrdev(this.mode)}addListener(cb,exclusive=false){var entry={cb,exclusive};var listeners=this.listeners??=new Set;listeners.add(entry);return{listeners,entry}}notifyListeners(flags){if(!this.listeners)return;var excl;for(var entry of this.listeners){if(entry.exclusive)(excl||=[]).push(entry);else entry.cb(flags)}if(excl){var i=(this.exclTurn||0)%excl.length;this.exclTurn=i+1;excl[i].cb(flags)}}},lookupPath(path,opts={}){if(!path){throw new FS.ErrnoError(44)}opts.follow_mount??=true;if(!PATH.isAbs(path)){path=FS.cwd()+"/"+path}linkloop:for(var nlinks=0;nlinks<40;nlinks++){var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i<parts.length;i++){var islast=i===parts.length-1;if(islast&&opts.parent){break}if(parts[i]==="."){continue}if(parts[i]===".."){current_path=PATH.dirname(current_path);if(FS.isRoot(current)){path=current_path+"/"+parts.slice(i+1).join("/");nlinks--;continue linkloop}else{current=current.parent}continue}current_path=PATH.join2(current_path,parts[i]);try{current=FS.lookupNode(current,parts[i])}catch(e){if(e?.errno===44&&islast&&opts.noent_okay){return{path:current_path}}throw e}if(FS.isMountpoint(current)&&(!islast||opts.follow_mount)){current=current.mounted.root}if(FS.isLink(current.mode)&&(!islast||opts.follow)){if(!current.node_ops.readlink){throw new FS.ErrnoError(52)}var link=current.node_ops.readlink(current);if(!PATH.isAbs(link)){link=PATH.dirname(current_path)+"/"+link}path=link+"/"+parts.slice(i+1).join("/");continue linkloop}}return{path:current_path,node:current}}throw new FS.ErrnoError(32)},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i<name.length;i++){hash=(hash<<5)-hash+name.charCodeAt(i)|0}return(parentid+hash>>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}if(perms.includes("w")&&!(node.mode&146)){return 2}if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){if(!FS.isDir(dir.mode))return 54;var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){if(!FS.isDir(dir.mode)){return 54}try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else if(FS.isDir(node.mode)){return 31}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}var mode=FS.flagsToPermissionString(flags);if(FS.isDir(node.mode)){if(mode!=="r"||flags&(512|64)){return 31}}return FS.nodePermissions(node,mode)},checkOpExists(op,err){if(!op){throw new FS.ErrnoError(err)}return op},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},dupStream(origStream,fd=-1){var stream=FS.createStream(origStream,fd);stream.stream_ops?.dup?.(stream);return stream},doSetAttr(stream,node,attr){var setattr=stream?.stream_ops.setattr;var arg=setattr?stream:node;setattr??=node.node_ops.setattr;FS.checkOpExists(setattr,63);try{setattr(arg,attr)}catch(e){if(e instanceof RangeError){throw new FS.ErrnoError(22)}throw e}},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push(...m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}for(var mount of mounts){if(mount.type.syncfs){mount.type.syncfs(mount,populate,done)}else{done(null)}}},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type,opts,mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);for(var[hash,current]of Object.entries(FS.nameTable)){while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}}node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name){throw new FS.ErrnoError(28)}if(name==="."||name===".."){throw new FS.ErrnoError(20)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},statfs(path){return FS.statfsNode(FS.lookupPath(path,{follow:true}).node)},statfsStream(stream){return FS.statfsNode(stream.node)},statfsNode(node){var rtn={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:FS.nextInode,ffree:FS.nextInode-1,fsid:42,flags:2,namelen:255};if(node.node_ops.statfs){Object.assign(rtn,node.node_ops.statfs(node.mount.opts.root))}return rtn},create(path,mode=438){mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode=511){mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var dir of dirs){if(!dir)continue;if(d||PATH.isAbs(path))d+="/";d+=dir;try{FS.mkdir(d,mode)}catch(e){if(e.errno!=20)throw e}}},mkdev(path,mode,dev){if(typeof dev=="undefined"){dev=mode;mode=438}mode|=8192;return FS.mknod(path,mode,dev)},symlink(oldpath,newpath){if(!PATH_FS.resolve(oldpath)){throw new FS.ErrnoError(44)}var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.symlink){throw new FS.ErrnoError(63)}return parent.node_ops.symlink(parent,newname,oldpath)},link(oldpath,newpath,flags){var lookup=FS.lookupPath(newpath,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var newname=PATH.basename(newpath);var errCode=FS.mayCreate(parent,newname);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.link){throw new FS.ErrnoError(34)}return parent.node_ops.link(parent,newname,oldpath,flags)},rename(old_path,new_path){var old_dirname=PATH.dirname(old_path);var new_dirname=PATH.dirname(new_path);var old_name=PATH.basename(old_path);var new_name=PATH.basename(new_path);var lookup,old_dir,new_dir;lookup=FS.lookupPath(old_path,{parent:true});old_dir=lookup.node;lookup=FS.lookupPath(new_path,{parent:true});new_dir=lookup.node;if(!old_dir||!new_dir)throw new FS.ErrnoError(44);if(old_dir.mount!==new_dir.mount){throw new FS.ErrnoError(75)}var old_node=FS.lookupNode(old_dir,old_name);var relative=PATH_FS.relative(old_path,new_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(28)}relative=PATH_FS.relative(new_path,old_dirname);if(relative.charAt(0)!=="."){throw new FS.ErrnoError(55)}var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(old_node===new_node){return}var isdir=FS.isDir(old_node.mode);var errCode=FS.mayDelete(old_dir,old_name,isdir);if(errCode){throw new FS.ErrnoError(errCode)}errCode=new_node?FS.mayDelete(new_dir,new_name,isdir):FS.mayCreate(new_dir,new_name);if(errCode){throw new FS.ErrnoError(errCode)}if(!old_dir.node_ops.rename){throw new FS.ErrnoError(63)}if(FS.isMountpoint(old_node)||new_node&&FS.isMountpoint(new_node)){throw new FS.ErrnoError(10)}if(new_dir!==old_dir){errCode=FS.nodePermissions(old_dir,"w");if(errCode){throw new FS.ErrnoError(errCode)}}FS.hashRemoveNode(old_node);try{old_dir.node_ops.rename(old_node,new_dir,new_name);old_node.parent=new_dir}catch(e){throw e}finally{FS.hashAddNode(old_node)}},rmdir(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,true);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.rmdir){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.rmdir(parent,name);FS.destroyNode(node)},readdir(path){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var readdir=FS.checkOpExists(node.node_ops.readdir,54);return readdir(node)},unlink(path){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;if(!parent){throw new FS.ErrnoError(44)}var name=PATH.basename(path);var node=FS.lookupNode(parent,name);var errCode=FS.mayDelete(parent,name,false);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.unlink){throw new FS.ErrnoError(63)}if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}parent.node_ops.unlink(parent,name);FS.destroyNode(node)},readlink(path){var lookup=FS.lookupPath(path);var link=lookup.node;if(!link){throw new FS.ErrnoError(44)}if(!link.node_ops.readlink){throw new FS.ErrnoError(28)}return link.node_ops.readlink(link)},stat(path,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});var node=lookup.node;var getattr=FS.checkOpExists(node.node_ops.getattr,63);return getattr(node)},fstat(fd){var stream=FS.getStreamChecked(fd);var node=stream.node;var getattr=stream.stream_ops.getattr;var arg=getattr?stream:node;getattr??=node.node_ops.getattr;FS.checkOpExists(getattr,63);return getattr(arg)},lstat(path){return FS.stat(path,true)},doChmod(stream,node,mode,dontFollow){FS.doSetAttr(stream,node,{mode:mode&4095|node.mode&~4095,ctime:Date.now(),dontFollow})},chmod(path,mode,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChmod(null,node,mode,dontFollow)},lchmod(path,mode){FS.chmod(path,mode,true)},fchmod(fd,mode){var stream=FS.getStreamChecked(fd);FS.doChmod(stream,stream.node,mode,false)},doChown(stream,node,dontFollow){FS.doSetAttr(stream,node,{timestamp:Date.now(),dontFollow})},chown(path,uid,gid,dontFollow){var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:!dontFollow});node=lookup.node}else{node=path}FS.doChown(null,node,dontFollow)},lchown(path,uid,gid){FS.chown(path,uid,gid,true)},fchown(fd,uid,gid){var stream=FS.getStreamChecked(fd);FS.doChown(stream,stream.node,false)},doTruncate(stream,node,len){if(FS.isDir(node.mode)){throw new FS.ErrnoError(31)}if(!FS.isFile(node.mode)){throw new FS.ErrnoError(28)}var errCode=FS.nodePermissions(node,"w");if(errCode){throw new FS.ErrnoError(errCode)}FS.doSetAttr(stream,node,{size:len,timestamp:Date.now()})},truncate(path,len){if(len<0){throw new FS.ErrnoError(28)}var node;if(typeof path=="string"){var lookup=FS.lookupPath(path,{follow:true});node=lookup.node}else{node=path}FS.doTruncate(null,node,len)},ftruncate(fd,len){var stream=FS.getStreamChecked(fd);if(len<0||(stream.flags&2097155)===0){throw new FS.ErrnoError(28)}FS.doTruncate(stream,stream.node,len)},utime(path,atime,mtime,dontFollow){var lookup=FS.lookupPath(path,{follow:!dontFollow});FS.doSetAttr(null,lookup.node,{atime,mtime,dontFollow})},open(path,flags,mode=438){if(path===""){throw new FS.ErrnoError(44)}flags=FS_modeStringToFlags(flags);if(flags&64){mode=mode&4095|32768}else{mode=0}var node;var isDirPath;if(typeof path=="object"){node=path}else{isDirPath=path.endsWith("/");var lookup=FS.lookupPath(path,{follow:!(flags&131072),noent_okay:true});node=lookup.node;path=lookup.path}var created=false;if(flags&64){if(node){if(flags&128){throw new FS.ErrnoError(20)}}else if(isDirPath){throw new FS.ErrnoError(31)}else{node=FS.mknod(path,mode|511,0);created=true}}if(!node){throw new FS.ErrnoError(44)}if(FS.isChrdev(node.mode)){flags&=~512}if(flags&65536&&!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}if(!created){var errCode=FS.mayOpen(node,flags);if(errCode){throw new FS.ErrnoError(errCode)}}if(flags&512&&!created){FS.truncate(node,0)}flags&=~(128|512|131072);var stream=FS.createStream({node,path:FS.getPath(node),flags,seekable:true,position:0,stream_ops:node.stream_ops,ungotten:[],error:false});if(stream.stream_ops.open){stream.stream_ops.open(stream)}if(created){FS.chmod(node,mode&511)}return stream},close(stream){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(stream.getdents)stream.getdents=null;stream.node?.notifyListeners(32);try{if(stream.stream_ops.close){stream.stream_ops.close(stream)}}catch(e){throw e}finally{FS.closeStream(stream.fd)}stream.fd=null},isClosed(stream){return stream.fd===null},llseek(stream,offset,whence){if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if(!stream.seekable||!stream.stream_ops.llseek){throw new FS.ErrnoError(70)}if(whence!=0&&whence!=1&&whence!=2){throw new FS.ErrnoError(28)}stream.position=stream.stream_ops.llseek(stream,offset,whence);stream.ungotten=[];return stream.position},read(stream,buffer,offset,length,position){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.read){throw new FS.ErrnoError(28)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesRead=stream.stream_ops.read(stream,buffer,offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write(stream,buffer,offset,length,position,canOwn){if(length<0||position<0){throw new FS.ErrnoError(28)}if(FS.isClosed(stream)){throw new FS.ErrnoError(8)}if((stream.flags&2097155)===0){throw new FS.ErrnoError(8)}if(FS.isDir(stream.node.mode)){throw new FS.ErrnoError(31)}if(!stream.stream_ops.write){throw new FS.ErrnoError(28)}if(stream.seekable&&stream.flags&1024){FS.llseek(stream,0,2)}var seeking=typeof position!="undefined";if(!seeking){position=stream.position}else if(!stream.seekable){throw new FS.ErrnoError(70)}var bytesWritten=stream.stream_ops.write(stream,buffer,offset,length,position,canOwn);if(!seeking)stream.position+=bytesWritten;return bytesWritten},mmap(stream,length,position,prot,flags){if((prot&2)!==0&&(flags&2)===0&&(stream.flags&2097155)!==2){throw new FS.ErrnoError(2)}if((stream.flags&2097155)===1){throw new FS.ErrnoError(2)}if(!stream.stream_ops.mmap){throw new FS.ErrnoError(43)}if(!length){throw new FS.ErrnoError(28)}return stream.stream_ops.mmap(stream,length,position,prot,flags)},msync(stream,buffer,offset,length,mmapFlags){if(!stream.stream_ops.msync){return 0}return stream.stream_ops.msync(stream,buffer,offset,length,mmapFlags)},ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags??0;opts.encoding=opts.encoding??"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){abort(`Invalid encoding type "${opts.encoding}"`)}var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){buf=UTF8ArrayToString(buf)}FS.close(stream);return buf},writeFile(path,data,opts={}){opts.flags=opts.flags??577;var stream=FS.open(path,opts.flags,opts.mode);data=FS_fileDataToTypedArray(data);FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn);FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length,llseek:()=>0});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomFill(randomBuffer);randomLeft=randomBuffer.byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16895,73);node.stream_ops={llseek:MEMFS.stream_ops.llseek};node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path},id:fd+1};ret.parent=ret;return ret},readdir(){return Array.from(FS.streams.entries()).filter(([k,v])=>v).map(([k,v])=>k.toString())}};return node}},{},"/proc/self/fd")},createStandardStreams(input,output,error){if(input){FS.createDevice("/dev","stdin",input)}else{FS.symlink("/dev/tty","/dev/stdin")}if(output){FS.createDevice("/dev","stdout",null,output)}else{FS.symlink("/dev/tty","/dev/stdout")}if(error){FS.createDevice("/dev","stderr",null,error)}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},staticInit(){FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={MEMFS}},init(input,output,error){FS.initialized=true;FS.createStandardStreams(input,output,error)},quit(){FS.initialized=false;for(var stream of FS.streams){if(stream){FS.close(stream)}}},findObject(path,dontResolveLastLink){var ret=FS.analyzePath(path,dontResolveLastLink);if(!ret.exists){return null}return ret.object},analyzePath(path,dontResolveLastLink){try{var lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});path=lookup.path}catch(e){}var ret={isRoot:false,exists:false,error:0,name:null,path:null,object:null,parentExists:false,parentPath:null,parentObject:null};try{var lookup=FS.lookupPath(path,{parent:true});ret.parentExists=true;ret.parentPath=lookup.path;ret.parentObject=lookup.node;ret.name=PATH.basename(path);lookup=FS.lookupPath(path,{follow:!dontResolveLastLink});ret.exists=true;ret.path=lookup.path;ret.object=lookup.node;ret.name=lookup.node.name;ret.isRoot=lookup.path==="/"}catch(e){ret.error=e.errno}return ret},createPath(parent,path,canRead,canWrite){parent=typeof parent=="string"?parent:FS.getPath(parent);var parts=path.split("/").reverse();while(parts.length){var part=parts.pop();if(!part)continue;var current=PATH.join2(parent,part);try{FS.mkdir(current)}catch(e){if(e.errno!=20)throw e}parent=current}return current},createFile(parent,name,properties,canRead,canWrite){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(canRead,canWrite);return FS.create(path,mode)},createDataFile(parent,name,data,canRead,canWrite,canOwn){var path=name;if(parent){parent=typeof parent=="string"?parent:FS.getPath(parent);path=name?PATH.join2(parent,name):parent}var mode=FS_getMode(canRead,canWrite);var node=FS.create(path,mode);if(data){data=FS_fileDataToTypedArray(data);FS.chmod(node,mode|146);var stream=FS.open(node,577);FS.write(stream,data,0,data.length,0,canOwn);FS.close(stream);FS.chmod(node,mode)}},createDevice(parent,name,input,output){var path=PATH.join2(typeof parent=="string"?parent:FS.getPath(parent),name);var mode=FS_getMode(!!input,!!output);FS.createDevice.major??=64;var dev=FS.makedev(FS.createDevice.major++,0);FS.registerDevice(dev,{open(stream){stream.seekable=false},close(stream){if(output?.buffer?.length){output(10)}},read(stream,buffer,offset,length,pos){var bytesRead=0;for(var i=0;i<length;i++){var result;try{result=input()}catch(e){throw new FS.ErrnoError(29)}if(result===undefined&&bytesRead===0){throw new FS.ErrnoError(6)}if(result===null||result===undefined)break;bytesRead++;buffer[offset+i]=result}if(bytesRead){stream.node.atime=Date.now()}return bytesRead},write(stream,buffer,offset,length,pos){for(var i=0;i<length;i++){try{output(buffer[offset+i])}catch(e){throw new FS.ErrnoError(29)}}if(length){stream.node.mtime=stream.node.ctime=Date.now()}return i}});return FS.mkdev(path,mode,dev)},forceLoadFile(obj){if(obj.isDevice||obj.isFolder||obj.link||obj.contents)return true;if(globalThis.XMLHttpRequest){abort("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.")}else{try{obj.contents=readBinary(obj.url)}catch(e){throw new FS.ErrnoError(29)}}},createLazyFile(parent,name,url,canRead,canWrite){class LazyUint8Array{lengthKnown=false;chunks=[];get(idx){if(idx>this.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]}setDataGetter(getter){this.getter=getter}cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort(`Couldn't load ${url}. Status: ${xhr.status}`);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)abort(`invalid range (${from}, ${to}) or no bytes requested!`);if(to>datalength-1)abort(`only ${datalength} bytes available! programmer error!`);var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range",`bytes=${from}-${to}`);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))abort(`Couldn't load ${url}. Status: ${xhr.status}`);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText??"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")abort("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true}get length(){if(!this.lengthKnown){this.cacheLength()}return this._length}get chunkSize(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}if(globalThis.XMLHttpRequest){if(!ENVIRONMENT_IS_WORKER)abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var lazyArray=new LazyUint8Array;var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};for(const[key,fn]of Object.entries(node.stream_ops)){stream_ops[key]=(...args)=>{FS.forceLoadFile(node);return fn(...args)}}function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i<size;i++){buffer[offset+i]=contents[position+i]}}else{for(var i=0;i<size;i++){buffer[offset+i]=contents.get(position+i)}}return size}stream_ops.read=(stream,buffer,offset,length,position)=>{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var HEAPU8;var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var HEAP32;var HEAPU32;var HEAP64;var SYSCALLS={currentUmask:18,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return dir+"/"+path},writeStat(buf,stat){HEAPU32[buf>>2]=stat.dev;HEAPU32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAPU32[buf+12>>2]=stat.uid;HEAPU32[buf+16>>2]=stat.gid;HEAPU32[buf+20>>2]=stat.rdev;HEAP64[buf+24>>3]=BigInt(stat.size);HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();HEAP64[buf+40>>3]=BigInt(Math.floor(atime/1e3));HEAPU32[buf+48>>2]=atime%1e3*1e3*1e3;HEAP64[buf+56>>3]=BigInt(Math.floor(mtime/1e3));HEAPU32[buf+64>>2]=mtime%1e3*1e3*1e3;HEAP64[buf+72>>3]=BigInt(Math.floor(ctime/1e3));HEAPU32[buf+80>>2]=ctime%1e3*1e3*1e3;HEAP64[buf+88>>3]=BigInt(stat.ino);return 0},writeStatFs(buf,stats){HEAPU32[buf+4>>2]=stats.bsize;HEAPU32[buf+60>>2]=stats.bsize;HEAP64[buf+8>>3]=BigInt(stats.blocks);HEAP64[buf+16>>3]=BigInt(stats.bfree);HEAP64[buf+24>>3]=BigInt(stats.bavail);HEAP64[buf+32>>3]=BigInt(stats.files);HEAP64[buf+40>>3]=BigInt(stats.ffree);HEAPU32[buf+48>>2]=stats.fsid;HEAPU32[buf+64>>2]=stats.flags;HEAPU32[buf+56>>2]=stats.namelen},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.subarray(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream},varargs:undefined,getStr(ptr){var ret=UTF8ToString(ptr);return ret}};function ___syscall_chmod(path,mode){try{path=SYSCALLS.getStr(path);FS.chmod(path,mode);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_faccessat(dirfd,path,amode,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(amode&~7){return-28}var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;if(!node){return-44}var perms="";if(amode&4)perms+="r";if(amode&2)perms+="w";if(amode&1)perms+="x";if(perms&&FS.nodePermissions(node,perms)){return-2}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;var HEAP16;function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=syscallGetVarargI();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.dupStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=syscallGetVarargI();var mask=289792;stream.flags=stream.flags&~mask|arg&mask;return 0}case 12:{var arg=syscallGetVarargP();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 13:case 14:return 0}return-28}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{return SYSCALLS.writeStat(buf,FS.fstat(fd))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);function ___syscall_getcwd(buf,size){try{if(size===0)return-28;var cwd=FS.cwd();var cwdLengthInBytes=lengthBytesUTF8(cwd)+1;if(size<cwdLengthInBytes)return-68;stringToUTF8(cwd,buf,size);return cwdLengthInBytes}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_ioctl(fd,op,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(op){case 21509:{if(!stream.tty)return-59;return 0}case 21505:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcgets){var termios=stream.tty.ops.ioctl_tcgets(stream);var argp=syscallGetVarargP();HEAP32[argp>>2]=termios.c_iflag||0;HEAP32[argp+4>>2]=termios.c_oflag||0;HEAP32[argp+8>>2]=termios.c_cflag||0;HEAP32[argp+12>>2]=termios.c_lflag||0;for(var i=0;i<32;i++){HEAP8[argp+i+17]=termios.c_cc[i]||0}return 0}return 0}case 21510:case 21511:case 21512:{if(!stream.tty)return-59;return 0}case 21506:case 21507:case 21508:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tcsets){var argp=syscallGetVarargP();var c_iflag=HEAP32[argp>>2];var c_oflag=HEAP32[argp+4>>2];var c_cflag=HEAP32[argp+8>>2];var c_lflag=HEAP32[argp+12>>2];var c_cc=[];for(var i=0;i<32;i++){c_cc.push(HEAP8[argp+i+17])}return stream.tty.ops.ioctl_tcsets(stream.tty,op,{c_iflag,c_oflag,c_cflag,c_lflag,c_cc})}return 0}case 21519:{if(!stream.tty)return-59;var argp=syscallGetVarargP();HEAP32[argp>>2]=0;return 0}case 21520:{if(!stream.tty)return-59;return-28}case 21537:case 21531:{var argp=syscallGetVarargP();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-59;if(stream.tty.ops.ioctl_tiocgwinsz){var winsize=stream.tty.ops.ioctl_tiocgwinsz(stream.tty);var argp=syscallGetVarargP();HEAP16[argp>>1]=winsize[0];HEAP16[argp+2>>1]=winsize[1]}return 0}case 21524:{if(!stream.tty)return-59;return 0}case 21515:{if(!stream.tty)return-59;return 0}default:return-28}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.lstat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.writeStat(buf,nofollow?FS.lstat(path):FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?syscallGetVarargI():0;if(flags&64){mode&=~SYSCALLS.currentUmask}return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.writeStat(buf,FS.stat(path))}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var __abort_js=()=>abort("");var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>num<INT53_MIN||num>INT53_MAX?NaN:Number(num);function __localtime_js(time,tmPtr){time=bigintToI53Checked(time);var date=new Date(time*1e3);if(isNaN(date.getTime())){return 1}HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst;return 0}var __tzset_js=(timezone,daylight,std_name,dst_name)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);var extractZone=timezoneOffset=>{var sign=timezoneOffset>=0?"-":"+";var absOffset=Math.abs(timezoneOffset);var hours=String(Math.floor(absOffset/60)).padStart(2,"0");var minutes=String(absOffset%60).padStart(2,"0");return`UTC${sign}${hours}${minutes}`};var winterName=extractZone(winterOffset);var summerName=extractZone(summerOffset);if(summerOffset<winterOffset){stringToUTF8(winterName,std_name,17);stringToUTF8(summerName,dst_name,17)}else{stringToUTF8(winterName,dst_name,17);stringToUTF8(summerName,std_name,17)}};var _emscripten_get_now=()=>performance.now();var _emscripten_date_now=()=>Date.now();var nowIsMonotonic=1;var checkWasiClock=clock_id=>clock_id>=0&&clock_id<=3;function _clock_time_get(clk_id,ignored_precision,ptime){ignored_precision=bigintToI53Checked(ignored_precision);if(!checkWasiClock(clk_id)){return 28}var now;if(clk_id===0){now=_emscripten_date_now()}else if(nowIsMonotonic){now=_emscripten_get_now()}else{return 52}var nsec=Math.round(now*1e3*1e3);HEAP64[ptime>>3]=BigInt(nsec);return 0}var jsStackTrace=()=>(new Error).stack.toString();var getCallstack=flags=>{var callstack=jsStackTrace();var lines=callstack.split("\n");callstack="";var firefoxRe=new RegExp("\\s*(.*?)@(.*?):([0-9]+):([0-9]+)");var chromeRe=new RegExp("\\s*at (.*?) \\((.*):(.*):(.*)\\)");for(var line of lines){var symbolName="";var file="";var lineno=0;var column=0;var parts=chromeRe.exec(line);if(parts?.length==5){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]}else{parts=firefoxRe.exec(line);if(parts?.length>=4){symbolName=parts[1];file=parts[2];lineno=parts[3];column=parts[4]|0}else{callstack+=line+"\n";continue}}if(symbolName=="_emscripten_log"||symbolName=="_emscripten_get_callstack"){callstack="";continue}if(flags&24){if(flags&64){file=file.substring(file.replace(/\\/g,"/").lastIndexOf("/")+1)}callstack+=` at ${symbolName} (${file}:${lineno}:${column})\n`}}callstack=callstack.replace(/\s+$/,"");return callstack};var _emscripten_get_callstack=(flags,str,maxbytes)=>{var callstack=getCallstack(flags);if(!str||maxbytes<=0){return lengthBytesUTF8(callstack)+1}var bytesWrittenExcludingNull=stringToUTF8(callstack,str,maxbytes);return bytesWrittenExcludingNull+1};var getHeapMax=()=>2147483648;var _emscripten_get_heap_max=()=>getHeapMax();var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram;var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8";var env={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:lang,_:getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;var envp=0;for(var string of getEnvStrings()){var ptr=environ_buf+bufSize;HEAPU32[__environ+envp>>2]=ptr;bufSize+=stringToUTF8(string,ptr,Infinity)+1;envp+=4}return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;for(var string of strings){bufSize+=lengthBytesUTF8(string)+1}HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;try{var curr=FS.read(stream,HEAP8,ptr,len,offset)}catch(e){if(ret>0&&e instanceof FS.ErrnoError&&(e.errno==6||e.errno==6)){break}throw e}if(curr<0)return-1;ret+=curr;if(curr<len)break;if(typeof offset!="undefined"){offset+=curr}}return ret};function _fd_read(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doReadv(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);try{if(isNaN(offset))return 22;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);HEAP64[newOffset>>3]=BigInt(stream.position);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{if(iovcnt==1){return FS.write(stream,HEAP8,HEAPU32[iov>>2],HEAPU32[iov+4>>2],offset)}var total=0;for(var i=0,p=iov;i<iovcnt;i++,p+=8){total+=HEAPU32[p+4>>2]}var view=new Uint8Array(total);var voff=0;for(var i=0;i<iovcnt;i++,iov+=8){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];view.set(HEAPU8.subarray(ptr,ptr+len),voff);voff+=len}return FS.write(stream,view,0,total,offset)};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var _random_get=(buffer,size)=>randomFill(HEAPU8.subarray(buffer,buffer+size));FS.createPreloadedFile=FS_createPreloadedFile;FS.preloadFile=FS_preloadFile;FS.staticInit();{if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"]}function OSD_MemInfo_getModuleHeapLength(){return Module.HEAP8.length}var _geospec_engine_native_canonical_plan,_geospec_engine_native_canonicalize,_geospec_engine_native_engine_drop,_geospec_engine_native_engine_new,_geospec_engine_native_engine_new_with_execution_permits,_geospec_engine_native_engine_new_with_limits,_geospec_engine_native_evaluate_claim,_geospec_engine_native_evaluate_plan,_geospec_engine_native_exact_cluster_candidate_control,_geospec_engine_native_ingest_mesh,_geospec_engine_native_ingest_subject,_geospec_engine_native_input_alloc,_geospec_engine_native_input_free,_geospec_engine_native_observations,_geospec_engine_native_process_request,_geospec_engine_native_release_subject,_geospec_engine_native_result_code_length,_geospec_engine_native_result_code_pointer,_geospec_engine_native_result_drop,_geospec_engine_native_result_is_error,_geospec_engine_native_result_length,_geospec_engine_native_result_message_length,_geospec_engine_native_result_message_pointer,_geospec_engine_native_result_pointer,_geospec_engine_native_subject_handle,_malloc,_free,___trap,memory,__indirect_function_table,wasmMemory;function assignWasmExports(wasmExports){_geospec_engine_native_canonical_plan=Module["_geospec_engine_native_canonical_plan"]=wasmExports["D"];_geospec_engine_native_canonicalize=Module["_geospec_engine_native_canonicalize"]=wasmExports["E"];_geospec_engine_native_engine_drop=Module["_geospec_engine_native_engine_drop"]=wasmExports["F"];_geospec_engine_native_engine_new=Module["_geospec_engine_native_engine_new"]=wasmExports["G"];_geospec_engine_native_engine_new_with_execution_permits=Module["_geospec_engine_native_engine_new_with_execution_permits"]=wasmExports["H"];_geospec_engine_native_engine_new_with_limits=Module["_geospec_engine_native_engine_new_with_limits"]=wasmExports["I"];_geospec_engine_native_evaluate_claim=Module["_geospec_engine_native_evaluate_claim"]=wasmExports["J"];_geospec_engine_native_evaluate_plan=Module["_geospec_engine_native_evaluate_plan"]=wasmExports["K"];_geospec_engine_native_exact_cluster_candidate_control=Module["_geospec_engine_native_exact_cluster_candidate_control"]=wasmExports["L"];_geospec_engine_native_ingest_mesh=Module["_geospec_engine_native_ingest_mesh"]=wasmExports["M"];_geospec_engine_native_ingest_subject=Module["_geospec_engine_native_ingest_subject"]=wasmExports["N"];_geospec_engine_native_input_alloc=Module["_geospec_engine_native_input_alloc"]=wasmExports["O"];_geospec_engine_native_input_free=Module["_geospec_engine_native_input_free"]=wasmExports["P"];_geospec_engine_native_observations=Module["_geospec_engine_native_observations"]=wasmExports["Q"];_geospec_engine_native_process_request=Module["_geospec_engine_native_process_request"]=wasmExports["R"];_geospec_engine_native_release_subject=Module["_geospec_engine_native_release_subject"]=wasmExports["S"];_geospec_engine_native_result_code_length=Module["_geospec_engine_native_result_code_length"]=wasmExports["T"];_geospec_engine_native_result_code_pointer=Module["_geospec_engine_native_result_code_pointer"]=wasmExports["U"];_geospec_engine_native_result_drop=Module["_geospec_engine_native_result_drop"]=wasmExports["V"];_geospec_engine_native_result_is_error=Module["_geospec_engine_native_result_is_error"]=wasmExports["W"];_geospec_engine_native_result_length=Module["_geospec_engine_native_result_length"]=wasmExports["X"];_geospec_engine_native_result_message_length=Module["_geospec_engine_native_result_message_length"]=wasmExports["Y"];_geospec_engine_native_result_message_pointer=Module["_geospec_engine_native_result_message_pointer"]=wasmExports["Z"];_geospec_engine_native_result_pointer=Module["_geospec_engine_native_result_pointer"]=wasmExports["_"];_geospec_engine_native_subject_handle=Module["_geospec_engine_native_subject_handle"]=wasmExports["$"];_malloc=Module["_malloc"]=wasmExports["aa"];_free=Module["_free"]=wasmExports["ba"];___trap=wasmExports["ca"];memory=wasmMemory=wasmExports["B"];__indirect_function_table=wasmExports["__indirect_function_table"]}var wasmImports={m:OSD_MemInfo_getModuleHeapLength,f:___syscall_chmod,l:___syscall_faccessat,c:___syscall_fcntl64,e:___syscall_fstat64,r:___syscall_getcwd,u:___syscall_ioctl,w:___syscall_lstat64,x:___syscall_newfstatat,d:___syscall_openat,y:___syscall_stat64,z:__abort_js,k:__localtime_js,o:__tzset_js,t:_clock_time_get,n:_emscripten_date_now,p:_emscripten_get_callstack,v:_emscripten_get_heap_max,i:_emscripten_resize_heap,g:_environ_get,h:_environ_sizes_get,A:_exit,b:_fd_close,j:_fd_read,s:_fd_seek,a:_fd_write,q:_random_get};async function run(){preRun();if(runDependencies){await resolveRunDependencies()}if(ABORT)return;initRuntime();postRun()}var wasmExports;wasmExports=await createWasm();await run();
2
2
  ;return Module}export default Module;
@@ -38,6 +38,27 @@ type HostCacheOptions = {
38
38
  readonly root: string;
39
39
  readonly projectRoot: string;
40
40
  };
41
+ /**
42
+ * Host-selected engine limits. Each omitted limit keeps its entry-profile value; any other value is validated by
43
+ * the engine, and `initialize` then reports the effective limits under a distinct `geospec-host-*` profile id.
44
+ * @public
45
+ */
46
+ type HostEngineLimits = {
47
+ /** Largest primary geometry in bytes (entry: 64 MiB). */
48
+ readonly maxSubjectBytes?: number;
49
+ /** Largest single external resource in bytes (entry: 64 MiB). */
50
+ readonly maxResourceBytes?: number;
51
+ /** Largest primary plus resources in bytes (entry: 128 MiB). */
52
+ readonly maxTotalBinaryBytes?: number;
53
+ /** Most decoded mesh vertices (entry: 2 000 000). */
54
+ readonly maxVertices?: number;
55
+ /** Most decoded mesh triangles (entry: 4 000 000). */
56
+ readonly maxTriangles?: number;
57
+ /** Retained analysis bytes per subject (entry: 256 MiB). */
58
+ readonly maxMeshBytes?: number;
59
+ /** Most subjects one engine retains (entry: 32). */
60
+ readonly maxRetainedSubjects?: number;
61
+ };
41
62
  /** Optional authenticated overlap-cache lifecycle. @public */
42
63
  type HostCacheLifecycle = {
43
64
  flushCache(): HostBytes;
@@ -45,4 +66,4 @@ type HostCacheLifecycle = {
45
66
  cacheProducerIdentity(): HostBytes;
46
67
  };
47
68
  //#endregion
48
- export { HostBytes, HostCacheLifecycle, HostCacheOptions, HostClaimEvaluation, HostEngine, HostSubjectLifecycle, ProtocolError };
69
+ export { HostBytes, HostCacheLifecycle, HostCacheOptions, HostClaimEvaluation, HostEngine, HostEngineLimits, HostSubjectLifecycle, ProtocolError };
@@ -1 +1 @@
1
- var e=class extends Error{code;constructor(e,t,n){super(t,n),this.name=`ProtocolError`,this.code=e}};const t=e=>typeof e==`object`&&!!e,n=n=>{if(n instanceof e)return n;if(t(n)&&typeof n.code==`string`&&typeof n.message==`string`)return new e(n.code,n.message,{cause:n});throw n},r=t=>{if(!(t instanceof Uint8Array))throw new e(`invalid-request`,`Host binding returned a non-byte value.`);return Uint8Array.from(t)},i=t=>{if(t.byteLength>=8){let e=new DataView(t.buffer,t.byteOffset,8),n=8+e.getUint32(0,!0),r=n+e.getUint32(4,!0);if(r<=t.byteLength)return{canonicalPlan:t.subarray(8,n),canonicalClaim:t.subarray(n,r),canonicalResult:t.subarray(r)}}throw new e(`invalid-request`,`Host binding returned a malformed claim evaluation.`)},a=e=>{try{return e()}catch(e){throw n(e)}},o=(e,t,n)=>{if(n===0)return;let r=t===`input`?`inputCopies`:`outputCopies`,i=t===`input`?`inputBytes`:`outputBytes`,a=e[i]+BigInt(n),o=18446744073709551615n;e[r]===o||a>o?e.exact=!1:(e[r]+=1n,e[i]=a)},s=(e,t)=>{let n=JSON.parse(new TextDecoder().decode(e));if(n.schema!==`geospec-engine-observations-v1`)throw Error(`Unsupported engine observation schema.`);n.exact=n.exact&&t.exact;for(let e of[`inputCopies`,`inputBytes`,`outputCopies`,`outputBytes`])n.copies[e]=(BigInt(n.copies[e])+t[e]).toString();return new TextEncoder().encode(JSON.stringify(n))};export{e as ProtocolError,s as appendHostObservationCopies,n as asProtocolError,a as callHost,o as observeHostCopy,r as toHostBytes,i as toHostClaimEvaluation};
1
+ var e=class extends Error{code;constructor(e,t,n){super(t,n),this.name=`ProtocolError`,this.code=e}};const t=/* @__PURE__ */ new Set([`maxSubjectBytes`,`maxResourceBytes`,`maxTotalBinaryBytes`,`maxVertices`,`maxTriangles`,`maxMeshBytes`,`maxRetainedSubjects`]),n=n=>{if(typeof n!=`object`||!n||Array.isArray(n))throw new e(`invalid-request`,`Engine limits must be an object.`);let r={};for(let[i,a]of Object.entries(n)){if(!t.has(i))throw new e(`invalid-request`,`Unknown engine limit '${i}'.`);if(a!==void 0){if(typeof a!=`number`)throw new e(`invalid-request`,`Engine limit ${i} must be a positive integer.`);r[i]=a}}return r},r=e=>typeof e==`object`&&!!e,i=t=>{if(t instanceof e)return t;if(r(t)&&typeof t.code==`string`&&typeof t.message==`string`)return new e(t.code,t.message,{cause:t});throw t},a=t=>{if(!(t instanceof Uint8Array))throw new e(`invalid-request`,`Host binding returned a non-byte value.`);return Uint8Array.from(t)},o=t=>{if(t.byteLength>=8){let e=new DataView(t.buffer,t.byteOffset,8),n=8+e.getUint32(0,!0),r=n+e.getUint32(4,!0);if(r<=t.byteLength)return{canonicalPlan:t.subarray(8,n),canonicalClaim:t.subarray(n,r),canonicalResult:t.subarray(r)}}throw new e(`invalid-request`,`Host binding returned a malformed claim evaluation.`)},s=e=>{try{return e()}catch(e){throw i(e)}},c=(e,t,n)=>{if(n===0)return;let r=t===`input`?`inputCopies`:`outputCopies`,i=t===`input`?`inputBytes`:`outputBytes`,a=e[i]+BigInt(n),o=18446744073709551615n;e[r]===o||a>o?e.exact=!1:(e[r]+=1n,e[i]=a)},l=(e,t)=>{let n=JSON.parse(new TextDecoder().decode(e));if(n.schema!==`geospec-engine-observations-v1`)throw Error(`Unsupported engine observation schema.`);n.exact=n.exact&&t.exact;for(let e of[`inputCopies`,`inputBytes`,`outputCopies`,`outputBytes`])n.copies[e]=(BigInt(n.copies[e])+t[e]).toString();return new TextEncoder().encode(JSON.stringify(n))};export{e as ProtocolError,l as appendHostObservationCopies,i as asProtocolError,s as callHost,c as observeHostCopy,a as toHostBytes,o as toHostClaimEvaluation,n as toHostEngineLimits};
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { HostBytes, HostEngine, ProtocolError } from "./host-types.mjs";
1
+ import { HostBytes, HostEngine, HostEngineLimits, ProtocolError } from "./host-types.mjs";
2
2
  import { Engine, WasmInput, canonicalize, initialize } from "./wasm.mjs";
3
- export { Engine, type HostBytes, type HostEngine, ProtocolError, type WasmInput, canonicalize, initialize };
3
+ export { Engine, type HostBytes, type HostEngine, type HostEngineLimits, ProtocolError, type WasmInput, canonicalize, initialize };
@@ -1,3 +1,3 @@
1
1
  import{ProtocolError as e,appendHostObservationCopies as t,observeHostCopy as n}from"./host-types.mjs";const r=new TextDecoder(`utf-8`,{fatal:!0}),i=new TextEncoder().encode(`{"_tauNativeExactClusterCandidateV1":`);function a(e){return e.length>=i.length&&i.every((t,n)=>e[n]===t)}const o=t=>{if(!(t instanceof Uint8Array)||!(t.buffer instanceof ArrayBuffer))throw new e(`invalid-request`,`Host input must use an ordinary ArrayBuffer.`);return t},s=t=>{if(!Array.isArray(t))throw new e(`invalid-request`,`Host resources must be an array of ordinary ArrayBuffer views.`);return t.map(e=>o(e))},c=async e=>{let t=await e;if(t!==void 0)return t instanceof Uint8Array?{wasmBinary:o(t)}:t instanceof ArrayBuffer?{wasmBinary:new Uint8Array(t)}:t instanceof Response?{wasmBinary:new Uint8Array(await t.arrayBuffer())}:{locateFile:()=>t.toString()}};let l,u;const d=/* @__PURE__ */ new Map,f=t=>{if(t?.variant!==`mt`)return;if(!Number.isSafeInteger(t.permits)||t.permits<1||t.permits>4294967295)throw new e(`invalid-request`,`MT execution permits must be a positive wasm32 integer.`);let n=typeof process<`u`&&typeof process.versions.node==`string`;if(typeof SharedArrayBuffer>`u`||!n&&!globalThis.crossOriginIsolated)throw new e(`unsupported-capability`,`GeoSpec MT WASM requires a cross-origin-isolated browser worker.`);if(!t.receipt)throw new e(`unsupported-capability`,`No MT build receipt was supplied for mt-permits-${t.permits}.`);let r;try{r=new URL(t.receipt)}catch{throw new e(`invalid-request`,`MT build receipt must be an absolute URL.`)}if(n?r.protocol!==`file:`:r.origin!==location.origin)throw new e(`unsupported-capability`,`MT assets must use a local Node file or same-origin browser URL.`);return r},p=e=>typeof e==`object`&&!!e&&!Array.isArray(e),m=(t,n)=>{if(!p(t)||t.file!==n||typeof t.bytes!=`number`||!Number.isSafeInteger(t.bytes)||t.bytes<1||typeof t.sha256!=`string`||!/^[\da-f]{64}$/.test(t.sha256))throw new e(`unsupported-capability`,`MT receipt has no valid ${n} asset.`);return{file:n,bytes:t.bytes,sha256:t.sha256}},h=async t=>{if(t.protocol===`file:`){let{readFile:e}=await import(`node:fs/promises`);return Uint8Array.from(await e(t))}let n=await fetch(t);if(!n.ok)throw new e(`unsupported-capability`,`MT asset is unavailable: ${t.href}`);return new Uint8Array(await n.arrayBuffer())},g=async(t,n)=>{let{file:r}=n,i=await h(new URL(r,t)),a=Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,i)),e=>e.toString(16).padStart(2,`0`)).join(``);if(i.byteLength!==n.bytes||a!==n.sha256)throw new e(`unsupported-capability`,`MT asset does not match its build receipt: ${r}`);return i},_=async(t,n)=>{let i=JSON.parse(r.decode(await h(t)));if(!p(i)||i.schema!==`geospec-mixed-mt-assets-v1`||typeof i.permits!=`number`||!Number.isSafeInteger(i.permits)||i.permits<n)throw new e(`unsupported-capability`,`MT receipt does not describe mt-permits-${n}.`);let a=i.permits,o=m(i.glue,`geospec_engine_native.mjs`),s=m(i.wasm,`geospec_engine_native.wasm`),c=m(i.worker,`geospec_engine_native.mjs`),l=m(i.buildReceipt,`build-receipt.json`);if(c.bytes!==o.bytes||c.sha256!==o.sha256)throw new e(`unsupported-capability`,`MT receipt does not describe mt-permits-${n}.`);let u=new URL(`.`,t),d=await g(u,l),f=JSON.parse(r.decode(d));if(!p(f)||f.schema!==`geospec-mixed-build-receipt-mt-v1`||!p(f.mtSettings)||f.mtSettings.executionPermits!==a||!Array.isArray(f.artifacts)||![o,s].every(e=>f.artifacts.some(t=>p(t)&&typeof t.path==`string`&&t.path.endsWith(`/${e.file}`)&&t.bytes===e.bytes&&t.sha256===e.sha256)))throw new e(`unsupported-capability`,`MT assets do not match their qualified build receipt.`);await g(u,o);let _=await g(u,s),v=await import(
2
2
  /* @vite-ignore */
3
- new URL(o.file,u).href);if(typeof v.default!=`function`)throw new e(`unsupported-capability`,`MT module has no initializer.`);let y=await v.default({wasmBinary:_});if(typeof y._geospec_engine_native_engine_new_with_execution_permits!=`function`)throw new e(`unsupported-capability`,`MT module has no execution-permits constructor.`);if(!(y.wasmMemory?.buffer instanceof SharedArrayBuffer))throw new e(`unsupported-capability`,`MT module does not export wasmMemory; relink the MT product.`);return y},v=async(t,n)=>{let r=f(n);if(r!==void 0&&n?.variant===`mt`){if(t!==void 0)throw new e(`invalid-request`,`MT WASM bytes are selected by the build receipt.`);let i=`${n.permits}:${r.href}`,a=d.get(i);if(a===void 0){let e={promise:_(r,n.permits),module:void 0};a=e,d.set(i,e)}try{a.module=await a.promise}catch(e){throw d.get(i)===a&&d.delete(i),e}return}l??=(async()=>{let n=await import(`#mixed-wasm-binding`);if(typeof n.default!=`function`)throw new e(`invalid-request`,`Compiled GeoSpec WASM module has no initializer.`);return u=await n.default(await c(t)),u})();let i=l;try{await i}catch(e){throw l===i&&(l=void 0),e}},y=t=>{let n=f(t);if(n!==void 0&&t?.variant===`mt`){let r=d.get(`${t.permits}:${n.href}`);if(r?.module===void 0)throw new e(`invalid-request`,`Initialize the selected MT product before constructing an engine.`);return r.module}if(l===void 0)throw new e(`invalid-request`,`Call initialize() before using the GeoSpec WASM engine.`);if(u===void 0)throw new e(`invalid-request`,`Wait for initialize() before using the GeoSpec WASM engine.`);return u},b=e=>{let t=e.wasmMemory?.buffer;return t===void 0||t===e.HEAPU8.buffer?e.HEAPU8:new Uint8Array(t)},x=/* @__PURE__ */ new WeakSet,S=t=>{if(x.has(t))throw new e(`backend-failure`,`Compiled GeoSpec WASM module trapped in an earlier call and cannot be reused; load a new module.`)},C=(t,n)=>{S(t);try{return n()}catch(n){throw n instanceof WebAssembly.RuntimeError?(x.add(t),new e(`backend-failure`,`Compiled GeoSpec WASM module trapped: ${n.message}.`,{cause:n})):n}},w=(e,t,n)=>{t!==0&&!x.has(e)&&C(e,()=>e._geospec_engine_native_input_free(t,n))},T=(e,t,n)=>{try{b(e).set(n,t)}catch(r){throw w(e,t,n.byteLength),r}},E=(t,r,i)=>{let a=C(t,()=>t._geospec_engine_native_input_alloc(r.byteLength));if(r.byteLength!==0&&a===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not register input bytes.`);return T(t,a,r),i&&n(i,`input`,r.byteLength),a},D=(t,r,i)=>{let a=C(t,()=>t._geospec_engine_native_input_alloc(r.byteLength));if(r.byteLength!==0&&a===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not allocate binary input bytes.`);return T(t,a,r),i&&n(i,`input`,r.byteLength),a},O=(t,r,i)=>{let a=i.length(r)>>>0,o=i.pointer(r)>>>0;if(a===0)return/* @__PURE__ */ new Uint8Array;let s=b(t);if(o===0||o>s.byteLength||a>s.byteLength-o)throw new e(`invalid-request`,`Compiled GeoSpec WASM module returned an inconsistent byte range.`);let c=Uint8Array.from(s.subarray(o,o+a));return i.copies&&n(i.copies,`output`,a),c},k=(t,n,i)=>{if(t._geospec_engine_native_result_is_error(n)!==0){let a=O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_code_length(e),pointer:e=>t._geospec_engine_native_result_code_pointer(e)}),o=O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_message_length(e),pointer:e=>t._geospec_engine_native_result_message_pointer(e)});throw new e(r.decode(a),r.decode(o))}return O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_length(e),pointer:e=>t._geospec_engine_native_result_pointer(e)})},A=(t,n,r)=>{if(n===0)throw new e(`invalid-request`,`Compiled GeoSpec WASM module returned no result.`);try{return C(t,()=>k(t,n,r))}finally{x.has(t)||C(t,()=>t._geospec_engine_native_result_drop(n))}},j=(e,t,n)=>{S(e);let r=E(e,o(t.bytes),t.copies);try{return A(e,C(e,()=>n(r,t.bytes.byteLength)),t.copies)}finally{w(e,r,t.bytes.byteLength)}};var M=class{#e;#t={exact:!0,inputCopies:0n,inputBytes:0n,outputCopies:0n,outputBytes:0n};#n;#r;constructor(t){if(this.#e=y(t),S(this.#e),this.#r=t?.variant!==`mt`,this.#n=C(this.#e,()=>t?.variant===`mt`?this.#e._geospec_engine_native_engine_new_with_execution_permits?.(t.permits)??0:this.#e._geospec_engine_native_engine_new()),this.#n===0)throw new e(`invalid-request`,`Compiled GeoSpec WASM module could not create an engine.`)}close(){if(this.#n!==0){if(!x.has(this.#e)){let e=this.#n;C(this.#e,()=>this.#e._geospec_engine_native_engine_drop(e))}this.#n=0}}ingestMesh(e,t){let n=o(t),r=this.engine();return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>{let i=D(this.#e,n,this.#t),a=!1;try{return a=!0,C(this.#e,()=>this.#e._geospec_engine_native_ingest_mesh(r,e,t,i,n.byteLength))}finally{a||w(this.#e,i,n.byteLength)}})}ingestSubject(t,n,r){let i=o(n),a=s(r),c=this.engine();return j(this.#e,{bytes:t,copies:this.#t},(t,n)=>{let r=[],o=0,s=0,l=!1;try{r.push({pointer:D(this.#e,i,this.#t),length:i.byteLength});for(let e of a)r.push({pointer:D(this.#e,e,this.#t),length:e.byteLength});if(s=a.length*8,o=C(this.#e,()=>this.#e._geospec_engine_native_input_alloc(s)),s!==0&&o===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not allocate the resource table.`);let u=new DataView(b(this.#e).buffer);for(let t=1;t<r.length;t+=1){let n=r[t];if(n===void 0)throw new e(`invalid-request`,`Compiled GeoSpec WASM resource table is incomplete.`);let i=o+(t-1)*8;u.setUint32(i,n.pointer,!0),u.setUint32(i+4,n.length,!0)}let d=r[0];if(d===void 0)throw new e(`invalid-request`,`Compiled GeoSpec WASM primary input is missing.`);return l=!0,C(this.#e,()=>this.#e._geospec_engine_native_ingest_subject(c,t,n,d.pointer,d.length,o,a.length))}finally{if(w(this.#e,o,s),!l)for(let e of r)w(this.#e,e.pointer,e.length)}})}subjectHandle(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_subject_handle(this.engine(),e,t))}releaseSubject(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_release_subject(this.engine(),e,t))}processRequest(e){return j(this.#e,{bytes:e,copies:this.#t},(t,n)=>this.#r&&a(e)?this.#e._geospec_engine_native_exact_cluster_candidate_control(this.engine(),t,n):this.#e._geospec_engine_native_process_request(this.engine(),t,n))}canonicalPlan(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_canonical_plan(this.engine(),e,t))}evaluatePlan(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_evaluate_plan(this.engine(),e,t))}evaluateClaim(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_evaluate_claim(this.engine(),e,t))}observations(){let e=this.engine(),n=A(this.#e,C(this.#e,()=>this.#e._geospec_engine_native_observations(e)));return t(n,this.#t)}engine(){if(this.#n===0)throw new e(`invalid-request`,`GeoSpec WASM engine is closed.`);return this.#n}};const N=e=>{let t=u??[...d.values()].find(e=>e.module!==void 0)?.module??y();return j(t,{bytes:e},(e,n)=>t._geospec_engine_native_canonicalize(e,n))};export{M as MixedWasmBinding,N as canonicalizeMixedWasm,v as initializeMixedWasm};
3
+ new URL(o.file,u).href);if(typeof v.default!=`function`)throw new e(`unsupported-capability`,`MT module has no initializer.`);let y=await v.default({wasmBinary:_});if(typeof y._geospec_engine_native_engine_new_with_execution_permits!=`function`)throw new e(`unsupported-capability`,`MT module has no execution-permits constructor.`);if(!(y.wasmMemory?.buffer instanceof SharedArrayBuffer))throw new e(`unsupported-capability`,`MT module does not export wasmMemory; relink the MT product.`);return y},v=async(t,n)=>{let r=f(n);if(r!==void 0&&n?.variant===`mt`){if(t!==void 0)throw new e(`invalid-request`,`MT WASM bytes are selected by the build receipt.`);let i=`${n.permits}:${r.href}`,a=d.get(i);if(a===void 0){let e={promise:_(r,n.permits),module:void 0};a=e,d.set(i,e)}try{a.module=await a.promise}catch(e){throw d.get(i)===a&&d.delete(i),e}return}l??=(async()=>{let n=await import(`#mixed-wasm-binding`);if(typeof n.default!=`function`)throw new e(`invalid-request`,`Compiled GeoSpec WASM module has no initializer.`);return u=await n.default(await c(t)),u})();let i=l;try{await i}catch(e){throw l===i&&(l=void 0),e}},y=t=>{let n=f(t);if(n!==void 0&&t?.variant===`mt`){let r=d.get(`${t.permits}:${n.href}`);if(r?.module===void 0)throw new e(`invalid-request`,`Initialize the selected MT product before constructing an engine.`);return r.module}if(l===void 0)throw new e(`invalid-request`,`Call initialize() before using the GeoSpec WASM engine.`);if(u===void 0)throw new e(`invalid-request`,`Wait for initialize() before using the GeoSpec WASM engine.`);return u},b=e=>{let t=e.wasmMemory?.buffer;return t===void 0||t===e.HEAPU8.buffer?e.HEAPU8:new Uint8Array(t)},x=/* @__PURE__ */ new WeakSet,S=t=>{if(x.has(t))throw new e(`backend-failure`,`Compiled GeoSpec WASM module trapped in an earlier call and cannot be reused; load a new module.`)},C=(t,n)=>{S(t);try{return n()}catch(n){throw n instanceof WebAssembly.RuntimeError?(x.add(t),new e(`backend-failure`,`Compiled GeoSpec WASM module trapped: ${n.message}.`,{cause:n})):n}},w=(e,t,n)=>{t!==0&&!x.has(e)&&C(e,()=>e._geospec_engine_native_input_free(t,n))},T=(e,t,n)=>{try{b(e).set(n,t)}catch(r){throw w(e,t,n.byteLength),r}},E=(t,r,i)=>{let a=C(t,()=>t._geospec_engine_native_input_alloc(r.byteLength));if(r.byteLength!==0&&a===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not register input bytes.`);return T(t,a,r),i&&n(i,`input`,r.byteLength),a},D=(t,r,i)=>{let a=C(t,()=>t._geospec_engine_native_input_alloc(r.byteLength));if(r.byteLength!==0&&a===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not allocate binary input bytes.`);return T(t,a,r),i&&n(i,`input`,r.byteLength),a},O=(t,r,i)=>{let a=i.length(r)>>>0,o=i.pointer(r)>>>0;if(a===0)return/* @__PURE__ */ new Uint8Array;let s=b(t);if(o===0||o>s.byteLength||a>s.byteLength-o)throw new e(`invalid-request`,`Compiled GeoSpec WASM module returned an inconsistent byte range.`);let c=Uint8Array.from(s.subarray(o,o+a));return i.copies&&n(i.copies,`output`,a),c},k=(t,n,i)=>{if(t._geospec_engine_native_result_is_error(n)!==0){let a=O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_code_length(e),pointer:e=>t._geospec_engine_native_result_code_pointer(e)}),o=O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_message_length(e),pointer:e=>t._geospec_engine_native_result_message_pointer(e)});throw new e(r.decode(a),r.decode(o))}return O(t,n,{copies:i,length:e=>t._geospec_engine_native_result_length(e),pointer:e=>t._geospec_engine_native_result_pointer(e)})},A=(t,n,r)=>{if(n===0)throw new e(`invalid-request`,`Compiled GeoSpec WASM module returned no result.`);try{return C(t,()=>k(t,n,r))}finally{x.has(t)||C(t,()=>t._geospec_engine_native_result_drop(n))}},j=(e,t,n)=>{S(e);let r=E(e,o(t.bytes),t.copies);try{return A(e,C(e,()=>n(r,t.bytes.byteLength)),t.copies)}finally{w(e,r,t.bytes.byteLength)}},M=(t,n,r)=>{let i=t._geospec_engine_native_engine_new_with_limits;if(typeof i!=`function`)throw new e(`unsupported-capability`,`Compiled GeoSpec WASM module does not accept engine limits.`);let a=j(t,{bytes:new TextEncoder().encode(JSON.stringify(r))},(e,t)=>i(n,e,t));if(a.byteLength!==4)throw new e(`invalid-request`,`Compiled GeoSpec WASM module returned a malformed engine handle.`);return new DataView(a.buffer,a.byteOffset,4).getUint32(0,!0)};var N=class{#e;#t={exact:!0,inputCopies:0n,inputBytes:0n,outputCopies:0n,outputBytes:0n};#n;#r;constructor(t,n){if(this.#e=y(t),S(this.#e),this.#r=t?.variant!==`mt`,this.#n=n===void 0?C(this.#e,()=>t?.variant===`mt`?this.#e._geospec_engine_native_engine_new_with_execution_permits?.(t.permits)??0:this.#e._geospec_engine_native_engine_new()):M(this.#e,t?.variant===`mt`?t.permits:1,n),this.#n===0)throw new e(`invalid-request`,`Compiled GeoSpec WASM module could not create an engine.`)}close(){if(this.#n!==0){if(!x.has(this.#e)){let e=this.#n;C(this.#e,()=>this.#e._geospec_engine_native_engine_drop(e))}this.#n=0}}ingestMesh(e,t){let n=o(t),r=this.engine();return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>{let i=D(this.#e,n,this.#t),a=!1;try{return a=!0,C(this.#e,()=>this.#e._geospec_engine_native_ingest_mesh(r,e,t,i,n.byteLength))}finally{a||w(this.#e,i,n.byteLength)}})}ingestSubject(t,n,r){let i=o(n),a=s(r),c=this.engine();return j(this.#e,{bytes:t,copies:this.#t},(t,n)=>{let r=[],o=0,s=0,l=!1;try{r.push({pointer:D(this.#e,i,this.#t),length:i.byteLength});for(let e of a)r.push({pointer:D(this.#e,e,this.#t),length:e.byteLength});if(s=a.length*8,o=C(this.#e,()=>this.#e._geospec_engine_native_input_alloc(s)),s!==0&&o===0)throw new e(`limit-exceeded`,`Compiled GeoSpec WASM module could not allocate the resource table.`);let u=new DataView(b(this.#e).buffer);for(let t=1;t<r.length;t+=1){let n=r[t];if(n===void 0)throw new e(`invalid-request`,`Compiled GeoSpec WASM resource table is incomplete.`);let i=o+(t-1)*8;u.setUint32(i,n.pointer,!0),u.setUint32(i+4,n.length,!0)}let d=r[0];if(d===void 0)throw new e(`invalid-request`,`Compiled GeoSpec WASM primary input is missing.`);return l=!0,C(this.#e,()=>this.#e._geospec_engine_native_ingest_subject(c,t,n,d.pointer,d.length,o,a.length))}finally{if(w(this.#e,o,s),!l)for(let e of r)w(this.#e,e.pointer,e.length)}})}subjectHandle(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_subject_handle(this.engine(),e,t))}releaseSubject(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_release_subject(this.engine(),e,t))}processRequest(e){return j(this.#e,{bytes:e,copies:this.#t},(t,n)=>this.#r&&a(e)?this.#e._geospec_engine_native_exact_cluster_candidate_control(this.engine(),t,n):this.#e._geospec_engine_native_process_request(this.engine(),t,n))}canonicalPlan(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_canonical_plan(this.engine(),e,t))}evaluatePlan(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_evaluate_plan(this.engine(),e,t))}evaluateClaim(e){return j(this.#e,{bytes:e,copies:this.#t},(e,t)=>this.#e._geospec_engine_native_evaluate_claim(this.engine(),e,t))}observations(){let e=this.engine(),n=A(this.#e,C(this.#e,()=>this.#e._geospec_engine_native_observations(e)));return t(n,this.#t)}engine(){if(this.#n===0)throw new e(`invalid-request`,`GeoSpec WASM engine is closed.`);return this.#n}};const P=e=>{let t=u??[...d.values()].find(e=>e.module!==void 0)?.module??y();return j(t,{bytes:e},(e,n)=>t._geospec_engine_native_canonicalize(e,n))};export{N as MixedWasmBinding,P as canonicalizeMixedWasm,v as initializeMixedWasm};
package/dist/node.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { HostBytes, HostCacheLifecycle, HostCacheOptions, HostClaimEvaluation, HostEngine, HostSubjectLifecycle, ProtocolError } from "./host-types.mjs";
1
+ import { HostBytes, HostCacheLifecycle, HostCacheOptions, HostClaimEvaluation, HostEngine, HostEngineLimits, HostSubjectLifecycle, ProtocolError } from "./host-types.mjs";
2
2
  //#region src/node.d.ts
3
3
  /** Stateful Node N-API facade over the configured native GeoSpec engine. @public */
4
4
  declare class Engine implements HostEngine, HostSubjectLifecycle, HostCacheLifecycle {
@@ -7,8 +7,10 @@ declare class Engine implements HostEngine, HostSubjectLifecycle, HostCacheLifec
7
7
  * Create a resident-only engine or opt into authenticated filesystem cache storage.
8
8
  * @param cacheOptions - Optional authenticated cache location.
9
9
  * @param executionPermits - Caller-inclusive CPU allocation; defaults to one.
10
+ * @param limits - Optional host-selected limits; omitted limits keep the entry profile. A native host may raise
11
+ * them above the entry profile, and `initialize` reports the effective limits and their profile id.
10
12
  */
11
- constructor(cacheOptions?: HostCacheOptions, executionPermits?: number);
13
+ constructor(cacheOptions?: HostCacheOptions, executionPermits?: number, limits?: HostEngineLimits);
12
14
  /** Release the retained native engine and authenticated cache. */
13
15
  close(): void;
14
16
  /**
@@ -94,4 +96,4 @@ declare class Engine implements HostEngine, HostSubjectLifecycle, HostCacheLifec
94
96
  */
95
97
  declare const canonicalize: (input: HostBytes) => HostBytes;
96
98
  //#endregion
97
- export { Engine, type HostBytes, type HostCacheLifecycle, type HostCacheOptions, type HostClaimEvaluation, type HostEngine, type HostSubjectLifecycle, ProtocolError, canonicalize };
99
+ export { Engine, type HostBytes, type HostCacheLifecycle, type HostCacheOptions, type HostClaimEvaluation, type HostEngine, type HostEngineLimits, type HostSubjectLifecycle, ProtocolError, canonicalize };
package/dist/node.mjs CHANGED
@@ -1 +1 @@
1
- import{ProtocolError as e,appendHostObservationCopies as t,callHost as n,observeHostCopy as r,toHostBytes as i,toHostClaimEvaluation as a}from"./host-types.mjs";import{Engine as o,canonicalize as s}from"#native-binding";import{availableParallelism as c}from"node:os";const l=t=>{if(!(t instanceof Uint8Array)||!(t.buffer instanceof ArrayBuffer))throw new e(`invalid-request`,`Host input must use an ordinary ArrayBuffer.`);return Buffer.from(t.buffer,t.byteOffset,t.byteLength)};var u=class{#e;#t={exact:!0,inputCopies:0n,inputBytes:0n,outputCopies:0n,outputBytes:0n};constructor(t,n){if(n!==void 0&&(!Number.isSafeInteger(n)||n<1||n>c()))throw new e(`invalid-request`,`Execution permits must be a positive integer including the caller and within the host cap.`);this.#e=n===void 0?t===void 0?new o:new o(t):new o(t,n)}close(){let e=this.#e;this.#e=void 0,e?.close()}ingestSubject(e,t,r){return n(()=>this.output(this.inner().ingestSubject(l(e),l(t),r.map(e=>l(e)))))}ingestMesh(e,t){return n(()=>this.output(this.inner().ingestMesh(l(e),l(t))))}subjectHandle(e){return n(()=>this.output(this.inner().subjectHandle(l(e))))}releaseSubject(e){return n(()=>this.output(this.inner().releaseSubject(l(e))))}processRequest(e){return n(()=>this.output(this.inner().processRequest(l(e))))}canonicalPlan(e){return n(()=>this.output(this.inner().canonicalPlan(l(e))))}evaluatePlan(e){return n(()=>this.output(this.inner().evaluatePlan(l(e))))}evaluateClaim(e){return a(n(()=>this.output(this.inner().evaluateClaim(l(e)))))}flushCache(){return n(()=>i(this.inner().flushCache()))}clearOverlapCache(){return this.inner().clearOverlapCache()}cacheProducerIdentity(){return n(()=>i(this.inner().cacheProducerIdentity()))}observations(){return t(i(this.inner().observations()),this.#t)}output(e){let t=i(e);return r(this.#t,`output`,t.byteLength),t}inner(){if(this.#e===void 0)throw new e(`invalid-request`,`GeoSpec Node engine is closed.`);return this.#e}};const d=e=>n(()=>i(s(l(e))));export{u as Engine,e as ProtocolError,d as canonicalize};
1
+ import{ProtocolError as e,appendHostObservationCopies as t,asProtocolError as n,callHost as r,observeHostCopy as i,toHostBytes as a,toHostClaimEvaluation as o,toHostEngineLimits as s}from"./host-types.mjs";import{Engine as c,canonicalize as l}from"#native-binding";import{availableParallelism as u}from"node:os";const d=t=>{if(!(t instanceof Uint8Array)||!(t.buffer instanceof ArrayBuffer))throw new e(`invalid-request`,`Host input must use an ordinary ArrayBuffer.`);return Buffer.from(t.buffer,t.byteOffset,t.byteLength)};var f=class{#e;#t={exact:!0,inputCopies:0n,inputBytes:0n,outputCopies:0n,outputBytes:0n};constructor(t,r,i){if(r!==void 0&&(!Number.isSafeInteger(r)||r<1||r>u()))throw new e(`invalid-request`,`Execution permits must be a positive integer including the caller and within the host cap.`);if(i!==void 0){let e=s(i);try{this.#e=new c(t,r,e)}catch(e){throw n(e)}}else this.#e=r===void 0?t===void 0?new c:new c(t):new c(t,r)}close(){let e=this.#e;this.#e=void 0,e?.close()}ingestSubject(e,t,n){return r(()=>this.output(this.inner().ingestSubject(d(e),d(t),n.map(e=>d(e)))))}ingestMesh(e,t){return r(()=>this.output(this.inner().ingestMesh(d(e),d(t))))}subjectHandle(e){return r(()=>this.output(this.inner().subjectHandle(d(e))))}releaseSubject(e){return r(()=>this.output(this.inner().releaseSubject(d(e))))}processRequest(e){return r(()=>this.output(this.inner().processRequest(d(e))))}canonicalPlan(e){return r(()=>this.output(this.inner().canonicalPlan(d(e))))}evaluatePlan(e){return r(()=>this.output(this.inner().evaluatePlan(d(e))))}evaluateClaim(e){return o(r(()=>this.output(this.inner().evaluateClaim(d(e)))))}flushCache(){return r(()=>a(this.inner().flushCache()))}clearOverlapCache(){return this.inner().clearOverlapCache()}cacheProducerIdentity(){return r(()=>a(this.inner().cacheProducerIdentity()))}observations(){return t(a(this.inner().observations()),this.#t)}output(e){let t=a(e);return i(this.#t,`output`,t.byteLength),t}inner(){if(this.#e===void 0)throw new e(`invalid-request`,`GeoSpec Node engine is closed.`);return this.#e}};const p=e=>r(()=>a(l(d(e))));export{f as Engine,e as ProtocolError,p as canonicalize};
package/dist/wasm.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { HostBytes, HostClaimEvaluation, HostEngine, HostSubjectLifecycle, ProtocolError } from "./host-types.mjs";
1
+ import { HostBytes, HostClaimEvaluation, HostEngine, HostEngineLimits, HostSubjectLifecycle, ProtocolError } from "./host-types.mjs";
2
2
  import { WasmExecution as WasmExecution$1, WasmInput as WasmInput$1, WasmResources as WasmResources$1 } from "./mixed-wasm-loader.mjs";
3
3
  //#region src/wasm.d.ts
4
4
  /** Input accepted by the compiled Emscripten module. @public */
@@ -21,8 +21,10 @@ declare class Engine implements HostEngine, HostSubjectLifecycle {
21
21
  /**
22
22
  * Construct an engine from the selected initialized WASM product.
23
23
  * @param execution - Explicit ST or MT product selection.
24
+ * @param limits - Optional host-selected limits; omitted limits keep the entry profile, the WASM default, which
25
+ * fits the wasm32 address space. `initialize` reports the effective limits and their profile id.
24
26
  */
25
- constructor(execution?: WasmExecution);
27
+ constructor(execution?: WasmExecution, limits?: HostEngineLimits);
26
28
  /**
27
29
  * Read cumulative observations outside canonical geometry results.
28
30
  * @returns Owned diagnostic bytes; snapshot traffic does not count itself.
@@ -90,4 +92,4 @@ declare class Engine implements HostEngine, HostSubjectLifecycle {
90
92
  */
91
93
  declare const canonicalize: (input: HostBytes) => HostBytes;
92
94
  //#endregion
93
- export { Engine, type HostBytes, type HostClaimEvaluation, type HostEngine, type HostSubjectLifecycle, ProtocolError, WasmExecution, WasmInput, WasmResources, canonicalize, initialize };
95
+ export { Engine, type HostBytes, type HostClaimEvaluation, type HostEngine, type HostEngineLimits, type HostSubjectLifecycle, ProtocolError, WasmExecution, WasmInput, WasmResources, canonicalize, initialize };
package/dist/wasm.mjs CHANGED
@@ -1 +1 @@
1
- import{ProtocolError as e,callHost as t,toHostClaimEvaluation as n}from"./host-types.mjs";import{MixedWasmBinding as r,canonicalizeMixedWasm as i,initializeMixedWasm as a}from"./mixed-wasm-loader.mjs";const o=async(e,t)=>{await a(e,t)};var s=class{#e;constructor(e){this.#e=new r(e)}observations(){return t(()=>this.#e.observations())}close(){this.#e.close()}ingestMesh(e,n){return t(()=>this.#e.ingestMesh(e,n))}ingestSubject(e,n,r){return t(()=>this.#e.ingestSubject(e,n,r))}subjectHandle(e){return t(()=>this.#e.subjectHandle(e))}releaseSubject(e){return t(()=>this.#e.releaseSubject(e))}processRequest(e){return t(()=>this.#e.processRequest(e))}canonicalPlan(e){return t(()=>this.#e.canonicalPlan(e))}evaluatePlan(e){return t(()=>this.#e.evaluatePlan(e))}evaluateClaim(e){return n(t(()=>this.#e.evaluateClaim(e)))}};const c=e=>t(()=>i(e));export{s as Engine,e as ProtocolError,c as canonicalize,o as initialize};
1
+ import{ProtocolError as e,callHost as t,toHostClaimEvaluation as n,toHostEngineLimits as r}from"./host-types.mjs";import{MixedWasmBinding as i,canonicalizeMixedWasm as a,initializeMixedWasm as o}from"./mixed-wasm-loader.mjs";const s=async(e,t)=>{await o(e,t)};var c=class{#e;constructor(e,t){this.#e=new i(e,t===void 0?void 0:r(t))}observations(){return t(()=>this.#e.observations())}close(){this.#e.close()}ingestMesh(e,n){return t(()=>this.#e.ingestMesh(e,n))}ingestSubject(e,n,r){return t(()=>this.#e.ingestSubject(e,n,r))}subjectHandle(e){return t(()=>this.#e.subjectHandle(e))}releaseSubject(e){return t(()=>this.#e.releaseSubject(e))}processRequest(e){return t(()=>this.#e.processRequest(e))}canonicalPlan(e){return t(()=>this.#e.canonicalPlan(e))}evaluatePlan(e){return t(()=>this.#e.evaluatePlan(e))}evaluateClaim(e){return n(t(()=>this.#e.evaluateClaim(e)))}};const l=e=>t(()=>a(e));export{c as Engine,e as ProtocolError,l as canonicalize,s as initialize};
@@ -2,19 +2,19 @@
2
2
  "schema": "geospec-native-source-relink-asset-v2",
3
3
  "artifact": {
4
4
  "fileName": "geospec-engine-native-source-relink.tar.gz",
5
- "bytes": 56776581,
6
- "sha256": "a266938c56457f2b32e4699c239b8fb5c329aa75867b3b2e16f32e06e8783e88",
5
+ "bytes": 56815933,
6
+ "sha256": "91fb2269e862d7d79cf7922c6bf3b5539ee776bd6b399c9f72294d20d30a5a74",
7
7
  "format": "deterministic tar+gzip"
8
8
  },
9
9
  "delivery": {
10
10
  "required": "co-deliver adjacent to each root, platform and wheel artifact",
11
11
  "publicationStatus": "outside this local charter"
12
12
  },
13
- "sourceRevision": "312ed65d88584ed2d8d7f2ec36bbd423f6e0df3c",
13
+ "sourceRevision": "7d9ce0f27c59a3c23706bdebbbb2c718fc0a432e",
14
14
  "sourceRevisionIsReferenceOnly": true,
15
15
  "sourceTree": {
16
- "files": 545,
17
- "sha256": "e0551c09d1b0d26e81524382f7c33d82c9dd2a6f7dc47462061d5b904925da10"
16
+ "files": 551,
17
+ "sha256": "8a5c15f301d36b606e4d408c988c28bdbef8046058a1a53379e06902459aedb8"
18
18
  },
19
19
  "occtSourceArchive": {
20
20
  "path": "archives/occt.tar.gz",
@@ -28,51 +28,51 @@
28
28
  },
29
29
  "mixedProducerRecipe": {
30
30
  "path": "receipts/mixed-producer-recipe.json",
31
- "sha256": "0b98ea2dc8caa8421d209f05411b92d2d3aa49bfa5589cfd5638be0a1b3373fd",
31
+ "sha256": "57b5ceadd899ad923e16c8ed5eaff91ce6e36181bdfbbae7bf190847a5a5fd3b",
32
32
  "status": "current-mixed",
33
33
  "target": "wasm32-unknown-emscripten",
34
34
  "profile": "emscripten-6.0.5-wasm-legacy-exceptions-wasm-sjlj-st-simd128-v1-rust-c656540-panic-abort-link-O3",
35
- "sourceRevision": "312ed65d88584ed2d8d7f2ec36bbd423f6e0df3c",
35
+ "sourceRevision": "7d9ce0f27c59a3c23706bdebbbb2c718fc0a432e",
36
36
  "sourceRevisionIsReferenceOnly": true,
37
37
  "artifacts": [
38
38
  {
39
39
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.mjs",
40
- "bytes": 68007,
41
- "sha256": "ffa589580fc5c323c0525f5c451786b1968429b4f588fe16ac1d3519b10a3484",
40
+ "bytes": 68173,
41
+ "sha256": "e9a9402bb269df9cf301f339a384eecd21bce7af82028a8064e50b598c69beda",
42
42
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.mjs"
43
43
  },
44
44
  {
45
45
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.wasm",
46
- "bytes": 16402150,
47
- "sha256": "a3bb4ba03db328acb8e40178604c1e1095d91c3c4773c456ffd8be70dcefad58",
46
+ "bytes": 16558946,
47
+ "sha256": "21dc9e6720e331b850a58a1b789001987eaef7fb4a9630cfcb2c666f17dff3f3",
48
48
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.wasm"
49
49
  }
50
50
  ],
51
51
  "evidence": {
52
52
  "receipt": {
53
53
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-build-receipt.json",
54
- "sha256": "c6a91c45644e80487640a536d4296ffbeb24a0cb576c304387b0780d050ba2a2",
54
+ "sha256": "6a157d77e60dfcfa918606213cdcfd3024569d2085ae77f3f2eedf0f12ab80a3",
55
55
  "bytes": 7434
56
56
  },
57
57
  "commands": {
58
58
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-commands.json",
59
- "sha256": "68abc9ecf41312487244148a531c54d1a92ae68ff7e64a83201a51c40c087a1e",
60
- "bytes": 10378
59
+ "sha256": "c5416025f927bb6215991c34a8d6d19838713ba6d5ac024877df81754481b7d7",
60
+ "bytes": 10428
61
61
  },
62
62
  "inputs": {
63
63
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-inputs.json",
64
- "sha256": "09bac5babfc2edfe20dd5ac22019fa0b2e56e43b1c466c9de8c0205168b42ec4",
65
- "bytes": 26329968
64
+ "sha256": "e84305b358708652e84f9eb0ac5e962c4ac58a9859b7546ff4717fd5ac2b8a2d",
65
+ "bytes": 26332246
66
66
  }
67
67
  },
68
- "inputCount": 67807,
68
+ "inputCount": 67815,
69
69
  "qualification": "Current-source compile/link only; runtime and target parity require independent checks.",
70
70
  "prefixRecovery": null,
71
71
  "environmentEvidence": "Exact source-derived environment from the pinned build-mixed-wasm.mts; commands are recorded observations.",
72
72
  "prefixProducerRecipe": {
73
73
  "path": "receipts/mixed-prefix-selected-delivery.json",
74
74
  "sha256": "9752d68abf630b3133fcf7bba78ecd0c11d69ea5b6f565cfdb0cf5c1e419dc31",
75
- "prefixReceiptSha256": "e998b9d90d1b9211342eee9d09c20db1ee2c0aa89a5fa831ee26a7eeeb639593"
75
+ "prefixReceiptSha256": "602a210b28e112398b20f01307ddef0c2f22bcaa37e0baeca273199e1cf32aa9"
76
76
  }
77
77
  },
78
78
  "prefixProducingSources": [
@@ -81,7 +81,7 @@
81
81
  "prefix": "native",
82
82
  "path": "receipts/build-occt-28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50.sh",
83
83
  "sha256": "28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50",
84
- "prefixReceiptSha256": "1bf00145f12d3cbf088a3ecdc35f5522f0af0abf5bd02b505dfff5499c60ef42",
84
+ "prefixReceiptSha256": "ca244a23495419a537f6522a1fb37f5c5828cdbf931f6b88d5a160dc75d44070",
85
85
  "recovery": null,
86
86
  "currentRebuildHelper": {
87
87
  "path": "source/packages/geospec-engine/native/occt/build-occt.sh",
@@ -93,7 +93,7 @@
93
93
  "prefix": "mixed",
94
94
  "path": "receipts/build-occt-28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50.sh",
95
95
  "sha256": "28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50",
96
- "prefixReceiptSha256": "e998b9d90d1b9211342eee9d09c20db1ee2c0aa89a5fa831ee26a7eeeb639593",
96
+ "prefixReceiptSha256": "602a210b28e112398b20f01307ddef0c2f22bcaa37e0baeca273199e1cf32aa9",
97
97
  "recovery": null,
98
98
  "currentRebuildHelper": {
99
99
  "path": "source/packages/geospec-engine/native/occt/build-occt.sh",
@@ -114,7 +114,7 @@
114
114
  "headers": {
115
115
  "files": 5641,
116
116
  "bytes": 22591923,
117
- "sha256": "469c3640cded45e71975254af862325f09a19904ab3b97ce28cbb470dfb7970a"
117
+ "sha256": "39f2c3733046d05b3ad1fe430c81a9a1252ff24d4d5bd82510c90cfbf17d8e58"
118
118
  },
119
119
  "cmakeCacheSha256": "f94e84e2ba5f64cfb06e881b4ae9f1c8c6c4769b9840eb6d2d354cba4d651c2e"
120
120
  },
@@ -4,10 +4,10 @@ The complete corresponding source and relink kit is delivered as the separate
4
4
  adjacent asset `geospec-engine-native-source-relink.tar.gz`. It is intentionally excluded from the
5
5
  root npm package, platform npm package and Python wheel payloads.
6
6
 
7
- - SHA-256: `a266938c56457f2b32e4699c239b8fb5c329aa75867b3b2e16f32e06e8783e88`
8
- - Bytes: `56776581`
9
- - Source files: `545`
10
- - Source tree SHA-256: `e0551c09d1b0d26e81524382f7c33d82c9dd2a6f7dc47462061d5b904925da10`
7
+ - SHA-256: `91fb2269e862d7d79cf7922c6bf3b5539ee776bd6b399c9f72294d20d30a5a74`
8
+ - Bytes: `56815933`
9
+ - Source files: `551`
10
+ - Source tree SHA-256: `8a5c15f301d36b606e4d408c988c28bdbef8046058a1a53379e06902459aedb8`
11
11
 
12
12
  The distributor must co-deliver the exact asset adjacent to every root,
13
13
  platform and wheel artifact. No public URL or publication claim is made here.
@@ -728,8 +728,8 @@
728
728
  "source": null,
729
729
  "sourceIdentity": {
730
730
  "type": "local-source-tree",
731
- "files": 120,
732
- "sha256": "3fe0aaedd7f5e808ae21c781f6dc476102565064aefb7951c18adcf817b99888"
731
+ "files": 126,
732
+ "sha256": "1081f059707a1e34188fbe91d62d5750f96e838b5a3712044eb0a7a11668333e"
733
733
  },
734
734
  "features": [],
735
735
  "licenseFiles": [
@@ -767,7 +767,7 @@
767
767
  "sourceIdentity": {
768
768
  "type": "local-source-tree",
769
769
  "files": 7,
770
- "sha256": "0c7430b7f288a5e5a95de5a0b303398d62842211a714a00d999634241208a7ea"
770
+ "sha256": "5fe350a821becea30e8b5fd93a060bd2d60c9e61f8c5062397777d1ee35071a7"
771
771
  },
772
772
  "features": [],
773
773
  "licenseFiles": [
@@ -786,7 +786,7 @@
786
786
  "sourceIdentity": {
787
787
  "type": "local-source-tree",
788
788
  "files": 180,
789
- "sha256": "acc474d3bfd43070f45328b6c86ac3f257018d1713f60475519fab6afa6c3ae8"
789
+ "sha256": "1f89fb0cafaf0f148ab52f314f706d2d6ee329fc0023fbd496b00711214f26fb"
790
790
  },
791
791
  "features": [],
792
792
  "licenseFiles": [
@@ -2297,8 +2297,8 @@
2297
2297
  "source": null,
2298
2298
  "sourceIdentity": {
2299
2299
  "type": "local-source-tree",
2300
- "files": 120,
2301
- "sha256": "3fe0aaedd7f5e808ae21c781f6dc476102565064aefb7951c18adcf817b99888"
2300
+ "files": 126,
2301
+ "sha256": "1081f059707a1e34188fbe91d62d5750f96e838b5a3712044eb0a7a11668333e"
2302
2302
  },
2303
2303
  "features": [],
2304
2304
  "licenseFiles": [
@@ -2336,7 +2336,7 @@
2336
2336
  "sourceIdentity": {
2337
2337
  "type": "local-source-tree",
2338
2338
  "files": 3,
2339
- "sha256": "a47a45391ff46fccc8e51239f91234bb00b4bbf8dac8ae8c706702dc667f824e"
2339
+ "sha256": "452b1d1dce427d2499753cd7021c89c0d39b0967cb452d8d9e343a2847cc4b14"
2340
2340
  },
2341
2341
  "features": [],
2342
2342
  "licenseFiles": [
@@ -2355,7 +2355,7 @@
2355
2355
  "sourceIdentity": {
2356
2356
  "type": "local-source-tree",
2357
2357
  "files": 180,
2358
- "sha256": "acc474d3bfd43070f45328b6c86ac3f257018d1713f60475519fab6afa6c3ae8"
2358
+ "sha256": "1f89fb0cafaf0f148ab52f314f706d2d6ee329fc0023fbd496b00711214f26fb"
2359
2359
  },
2360
2360
  "features": [],
2361
2361
  "licenseFiles": [
@@ -4886,12 +4886,12 @@
4886
4886
  },
4887
4887
  {
4888
4888
  "path": "SOURCE-RELINK.json",
4889
- "sha256": "66065963ddf107dcdee53eec53409aab4369b422cca2991ec195d7439ac3708c",
4889
+ "sha256": "83d5e4bac51c62f9e3e52d81a4d8372c547006aa7ff91d0f41d6f54c57433d2a",
4890
4890
  "bytes": 6134
4891
4891
  },
4892
4892
  {
4893
4893
  "path": "SOURCE-RELINK.md",
4894
- "sha256": "15d58a1b31fe80c2d711e196791fdd7c0f7803e022739e3c1a2a9713d81da354",
4894
+ "sha256": "5bb9dc686e7ad7f86b4a1913d3a0b98288bc1ef69d545ed53efab83458407d70",
4895
4895
  "bytes": 1117
4896
4896
  },
4897
4897
  {
@@ -5639,19 +5639,19 @@
5639
5639
  "schema": "geospec-native-source-relink-asset-v2",
5640
5640
  "artifact": {
5641
5641
  "fileName": "geospec-engine-native-source-relink.tar.gz",
5642
- "bytes": 56776581,
5643
- "sha256": "a266938c56457f2b32e4699c239b8fb5c329aa75867b3b2e16f32e06e8783e88",
5642
+ "bytes": 56815933,
5643
+ "sha256": "91fb2269e862d7d79cf7922c6bf3b5539ee776bd6b399c9f72294d20d30a5a74",
5644
5644
  "format": "deterministic tar+gzip"
5645
5645
  },
5646
5646
  "delivery": {
5647
5647
  "required": "co-deliver adjacent to each root, platform and wheel artifact",
5648
5648
  "publicationStatus": "outside this local charter"
5649
5649
  },
5650
- "sourceRevision": "312ed65d88584ed2d8d7f2ec36bbd423f6e0df3c",
5650
+ "sourceRevision": "7d9ce0f27c59a3c23706bdebbbb2c718fc0a432e",
5651
5651
  "sourceRevisionIsReferenceOnly": true,
5652
5652
  "sourceTree": {
5653
- "files": 545,
5654
- "sha256": "e0551c09d1b0d26e81524382f7c33d82c9dd2a6f7dc47462061d5b904925da10"
5653
+ "files": 551,
5654
+ "sha256": "8a5c15f301d36b606e4d408c988c28bdbef8046058a1a53379e06902459aedb8"
5655
5655
  },
5656
5656
  "occtSourceArchive": {
5657
5657
  "path": "archives/occt.tar.gz",
@@ -5665,51 +5665,51 @@
5665
5665
  },
5666
5666
  "mixedProducerRecipe": {
5667
5667
  "path": "receipts/mixed-producer-recipe.json",
5668
- "sha256": "0b98ea2dc8caa8421d209f05411b92d2d3aa49bfa5589cfd5638be0a1b3373fd",
5668
+ "sha256": "57b5ceadd899ad923e16c8ed5eaff91ce6e36181bdfbbae7bf190847a5a5fd3b",
5669
5669
  "status": "current-mixed",
5670
5670
  "target": "wasm32-unknown-emscripten",
5671
5671
  "profile": "emscripten-6.0.5-wasm-legacy-exceptions-wasm-sjlj-st-simd128-v1-rust-c656540-panic-abort-link-O3",
5672
- "sourceRevision": "312ed65d88584ed2d8d7f2ec36bbd423f6e0df3c",
5672
+ "sourceRevision": "7d9ce0f27c59a3c23706bdebbbb2c718fc0a432e",
5673
5673
  "sourceRevisionIsReferenceOnly": true,
5674
5674
  "artifacts": [
5675
5675
  {
5676
5676
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.mjs",
5677
- "bytes": 68007,
5678
- "sha256": "ffa589580fc5c323c0525f5c451786b1968429b4f588fe16ac1d3519b10a3484",
5677
+ "bytes": 68173,
5678
+ "sha256": "e9a9402bb269df9cf301f339a384eecd21bce7af82028a8064e50b598c69beda",
5679
5679
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.mjs"
5680
5680
  },
5681
5681
  {
5682
5682
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.wasm",
5683
- "bytes": 16402150,
5684
- "sha256": "a3bb4ba03db328acb8e40178604c1e1095d91c3c4773c456ffd8be70dcefad58",
5683
+ "bytes": 16558946,
5684
+ "sha256": "21dc9e6720e331b850a58a1b789001987eaef7fb4a9630cfcb2c666f17dff3f3",
5685
5685
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.wasm"
5686
5686
  }
5687
5687
  ],
5688
5688
  "evidence": {
5689
5689
  "receipt": {
5690
5690
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-build-receipt.json",
5691
- "sha256": "c6a91c45644e80487640a536d4296ffbeb24a0cb576c304387b0780d050ba2a2",
5691
+ "sha256": "6a157d77e60dfcfa918606213cdcfd3024569d2085ae77f3f2eedf0f12ab80a3",
5692
5692
  "bytes": 7434
5693
5693
  },
5694
5694
  "commands": {
5695
5695
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-commands.json",
5696
- "sha256": "68abc9ecf41312487244148a531c54d1a92ae68ff7e64a83201a51c40c087a1e",
5697
- "bytes": 10378
5696
+ "sha256": "c5416025f927bb6215991c34a8d6d19838713ba6d5ac024877df81754481b7d7",
5697
+ "bytes": 10428
5698
5698
  },
5699
5699
  "inputs": {
5700
5700
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-inputs.json",
5701
- "sha256": "09bac5babfc2edfe20dd5ac22019fa0b2e56e43b1c466c9de8c0205168b42ec4",
5702
- "bytes": 26329968
5701
+ "sha256": "e84305b358708652e84f9eb0ac5e962c4ac58a9859b7546ff4717fd5ac2b8a2d",
5702
+ "bytes": 26332246
5703
5703
  }
5704
5704
  },
5705
- "inputCount": 67807,
5705
+ "inputCount": 67815,
5706
5706
  "qualification": "Current-source compile/link only; runtime and target parity require independent checks.",
5707
5707
  "prefixRecovery": null,
5708
5708
  "environmentEvidence": "Exact source-derived environment from the pinned build-mixed-wasm.mts; commands are recorded observations.",
5709
5709
  "prefixProducerRecipe": {
5710
5710
  "path": "receipts/mixed-prefix-selected-delivery.json",
5711
5711
  "sha256": "9752d68abf630b3133fcf7bba78ecd0c11d69ea5b6f565cfdb0cf5c1e419dc31",
5712
- "prefixReceiptSha256": "e998b9d90d1b9211342eee9d09c20db1ee2c0aa89a5fa831ee26a7eeeb639593"
5712
+ "prefixReceiptSha256": "602a210b28e112398b20f01307ddef0c2f22bcaa37e0baeca273199e1cf32aa9"
5713
5713
  }
5714
5714
  },
5715
5715
  "prefixProducingSources": [
@@ -5718,7 +5718,7 @@
5718
5718
  "prefix": "native",
5719
5719
  "path": "receipts/build-occt-28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50.sh",
5720
5720
  "sha256": "28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50",
5721
- "prefixReceiptSha256": "1bf00145f12d3cbf088a3ecdc35f5522f0af0abf5bd02b505dfff5499c60ef42",
5721
+ "prefixReceiptSha256": "ca244a23495419a537f6522a1fb37f5c5828cdbf931f6b88d5a160dc75d44070",
5722
5722
  "recovery": null,
5723
5723
  "currentRebuildHelper": {
5724
5724
  "path": "source/packages/geospec-engine/native/occt/build-occt.sh",
@@ -5730,7 +5730,7 @@
5730
5730
  "prefix": "mixed",
5731
5731
  "path": "receipts/build-occt-28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50.sh",
5732
5732
  "sha256": "28b9757e494af724cde7c38b9227cf443f66ad6f2f8344d9f9e51b85a0b55c50",
5733
- "prefixReceiptSha256": "e998b9d90d1b9211342eee9d09c20db1ee2c0aa89a5fa831ee26a7eeeb639593",
5733
+ "prefixReceiptSha256": "602a210b28e112398b20f01307ddef0c2f22bcaa37e0baeca273199e1cf32aa9",
5734
5734
  "recovery": null,
5735
5735
  "currentRebuildHelper": {
5736
5736
  "path": "source/packages/geospec-engine/native/occt/build-occt.sh",
@@ -5751,7 +5751,7 @@
5751
5751
  "headers": {
5752
5752
  "files": 5641,
5753
5753
  "bytes": 22591923,
5754
- "sha256": "469c3640cded45e71975254af862325f09a19904ab3b97ce28cbb470dfb7970a"
5754
+ "sha256": "39f2c3733046d05b3ad1fe430c81a9a1252ff24d4d5bd82510c90cfbf17d8e58"
5755
5755
  },
5756
5756
  "cmakeCacheSha256": "f94e84e2ba5f64cfb06e881b4ae9f1c8c6c4769b9840eb6d2d354cba4d651c2e"
5757
5757
  },
@@ -5762,40 +5762,40 @@
5762
5762
  "status": "current-mixed",
5763
5763
  "target": "wasm32-unknown-emscripten",
5764
5764
  "profile": "emscripten-6.0.5-wasm-legacy-exceptions-wasm-sjlj-st-simd128-v1-rust-c656540-panic-abort-link-O3",
5765
- "sourceRevision": "312ed65d88584ed2d8d7f2ec36bbd423f6e0df3c",
5765
+ "sourceRevision": "7d9ce0f27c59a3c23706bdebbbb2c718fc0a432e",
5766
5766
  "sourceRevisionIsReferenceOnly": true,
5767
5767
  "artifacts": [
5768
5768
  {
5769
5769
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.mjs",
5770
- "bytes": 68007,
5771
- "sha256": "ffa589580fc5c323c0525f5c451786b1968429b4f588fe16ac1d3519b10a3484",
5770
+ "bytes": 68173,
5771
+ "sha256": "e9a9402bb269df9cf301f339a384eecd21bce7af82028a8064e50b598c69beda",
5772
5772
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.mjs"
5773
5773
  },
5774
5774
  {
5775
5775
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/bindings/emscripten/generated/geospec_engine_native.wasm",
5776
- "bytes": 16402150,
5777
- "sha256": "a3bb4ba03db328acb8e40178604c1e1095d91c3c4773c456ffd8be70dcefad58",
5776
+ "bytes": 16558946,
5777
+ "sha256": "21dc9e6720e331b850a58a1b789001987eaef7fb4a9630cfcb2c666f17dff3f3",
5778
5778
  "distPath": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/packages/geospec-engine/dist/bindings/mixed-wasm/geospec_engine_native.wasm"
5779
5779
  }
5780
5780
  ],
5781
5781
  "evidence": {
5782
5782
  "receipt": {
5783
5783
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-build-receipt.json",
5784
- "sha256": "c6a91c45644e80487640a536d4296ffbeb24a0cb576c304387b0780d050ba2a2",
5784
+ "sha256": "6a157d77e60dfcfa918606213cdcfd3024569d2085ae77f3f2eedf0f12ab80a3",
5785
5785
  "bytes": 7434
5786
5786
  },
5787
5787
  "commands": {
5788
5788
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-commands.json",
5789
- "sha256": "68abc9ecf41312487244148a531c54d1a92ae68ff7e64a83201a51c40c087a1e",
5790
- "bytes": 10378
5789
+ "sha256": "c5416025f927bb6215991c34a8d6d19838713ba6d5ac024877df81754481b7d7",
5790
+ "bytes": 10428
5791
5791
  },
5792
5792
  "inputs": {
5793
5793
  "path": "/Users/gha-runner/Library/GitHubRunner/macos-primary/_work/geospec/geospec/out/artifacts/geospec-native-engine/ci/mixed-inputs.json",
5794
- "sha256": "09bac5babfc2edfe20dd5ac22019fa0b2e56e43b1c466c9de8c0205168b42ec4",
5795
- "bytes": 26329968
5794
+ "sha256": "e84305b358708652e84f9eb0ac5e962c4ac58a9859b7546ff4717fd5ac2b8a2d",
5795
+ "bytes": 26332246
5796
5796
  }
5797
5797
  },
5798
- "inputCount": 67807,
5798
+ "inputCount": 67815,
5799
5799
  "qualification": "Current-source compile/link only; runtime and target parity require independent checks.",
5800
5800
  "prefixRecovery": null,
5801
5801
  "environmentEvidence": "Exact source-derived environment from the pinned build-mixed-wasm.mts; commands are recorded observations.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geospec-engine",
3
- "version": "0.1.1-next.144",
3
+ "version": "0.1.1-next.155",
4
4
  "description": "Portable GeoSpec native engine",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -80,8 +80,8 @@
80
80
  ]
81
81
  },
82
82
  "optionalDependencies": {
83
- "geospec-engine-darwin-arm64": "0.1.1-next.144",
84
- "geospec-engine-linux-x64-gnu": "0.1.1-next.144"
83
+ "geospec-engine-darwin-arm64": "0.1.1-next.155",
84
+ "geospec-engine-linux-x64-gnu": "0.1.1-next.155"
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"