@bb-studio/ocio 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, promto-c
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are
7
+ met:
8
+
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+ * Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @bb-studio/ocio
2
+
3
+ Unofficial OpenColorIO 2.5 WebAssembly bindings for browser and Node.js.
4
+
5
+ This package is not affiliated with or endorsed by the OpenColorIO project.
6
+
7
+ The native module links against OpenColorIO C++ and runs the OCIO CPU processor path in WebAssembly. The ACES demo uses the built-in `ocio://cg-config-v4.0.0_aces-v2.0_ocio-v2.5` config.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm install @bb-studio/ocio
13
+ ```
14
+
15
+ The npm package includes the prebuilt Emscripten module:
16
+
17
+ - `dist/ocio-wasm.js`
18
+ - `dist/ocio-wasm.wasm`
19
+
20
+ ## Usage
21
+
22
+ ```js
23
+ import { ACES_CG_V4_CONFIG, createOCIO } from '@bb-studio/ocio';
24
+
25
+ const ocio = await createOCIO();
26
+ const config = ocio.createBuiltinConfig(ACES_CG_V4_CONFIG);
27
+ const display = config.getDefaultDisplay();
28
+ const view = config.getDefaultView(display, 'ACEScg');
29
+ const processor = config.createDisplayViewProcessor({
30
+ source: 'ACEScg',
31
+ display,
32
+ view
33
+ });
34
+
35
+ const rgba = new Float32Array([0.18, 0.18, 0.18, 1]);
36
+ processor.applyRGBAF32(rgba);
37
+
38
+ processor.dispose();
39
+ config.dispose();
40
+ ```
41
+
42
+ ## Custom OCIO Configs
43
+
44
+ For a custom config that does not reference external files, load the config text and create it directly:
45
+
46
+ ```js
47
+ import { createOCIO } from '@bb-studio/ocio';
48
+
49
+ const ocio = await createOCIO();
50
+ const configText = await fetch('/configs/show/config.ocio').then((response) => response.text());
51
+ const config = ocio.createConfigFromString(configText);
52
+
53
+ config.validate();
54
+ config.dispose();
55
+ ```
56
+
57
+ If the config references LUTs or other files, write those files into the wasm filesystem first and pass a working directory. Keep the same relative paths used by the OCIO config:
58
+
59
+ ```js
60
+ import { readFile } from 'node:fs/promises';
61
+ import { createOCIO } from '@bb-studio/ocio';
62
+
63
+ const ocio = await createOCIO();
64
+ const workingDir = '/show-config';
65
+
66
+ const configText = await readFile('./show/config.ocio', 'utf8');
67
+ ocio.writeFile(`${workingDir}/luts/look.cube`, await readFile('./show/luts/look.cube'));
68
+
69
+ const config = ocio.createConfigFromString(configText, { workingDir });
70
+ const processor = config.createColorSpaceProcessor('Input - Camera', 'Output - Rec.709');
71
+
72
+ const rgb = new Float32Array([0.18, 0.18, 0.18]);
73
+ processor.applyRGBF32(rgb);
74
+
75
+ processor.dispose();
76
+ config.dispose();
77
+ ```
78
+
79
+ The paths passed to `writeFile()` and `createConfigFromFile()` are virtual wasm filesystem paths, not direct host filesystem paths.
80
+
81
+ You can also write the config itself and load it by path:
82
+
83
+ ```js
84
+ ocio.writeFile(`${workingDir}/config.ocio`, configText);
85
+ const config = ocio.createConfigFromFile(`${workingDir}/config.ocio`);
86
+ ```
87
+
88
+ ## Build From Source
89
+
90
+ This checkout expects local OpenColorIO 2.5 and Emscripten checkouts. By default the build script uses:
91
+
92
+ - `ocio`
93
+ - `emsdk`
94
+
95
+ Override them if needed:
96
+
97
+ ```sh
98
+ OCIO_SOURCE_DIR=/path/to/OpenColorIO EMSDK_DIR=/path/to/emsdk npm run build:wasm
99
+ ```
100
+
101
+ The build creates:
102
+
103
+ - `dist/ocio-wasm.js`
104
+ - `dist/ocio-wasm.wasm`
105
+
106
+ ## Publish
107
+
108
+ For maintainers only:
109
+
110
+ ```sh
111
+ npm test
112
+ npm run pack:dry-run
113
+ npm publish
114
+ ```
115
+
116
+ The package is scoped and configured with `publishConfig.access` set to `public`.
117
+
118
+ ## Test
119
+
120
+ ```sh
121
+ npm test
122
+ ```
123
+
124
+ The test loads the wasm module in Node, creates the ACES v4 / ACES 2.0 built-in CG config, validates it, enumerates color spaces and displays, and applies real OCIO processors to float pixels.
125
+
126
+ ## Browser Demo
127
+
128
+ ```sh
129
+ npm run serve:demo
130
+ ```
131
+
132
+ Then open `http://localhost:4173/examples/browser/`.
133
+
134
+ The demo renders a generated HDR sample image through the OCIO display/view processor. You can choose the input color space, display, view, exposure, gain, gamma, or load your own image.
135
+
136
+ ## License
137
+
138
+ This package is licensed under the BSD-3-Clause license.
139
+
140
+ It includes WebAssembly builds of OpenColorIO, which is also licensed under BSD-3-Clause.
141
+ See [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md) for bundled third-party notices.
@@ -0,0 +1,37 @@
1
+ # Third-Party Notices
2
+
3
+ This package includes WebAssembly builds of OpenColorIO.
4
+
5
+ ## OpenColorIO
6
+
7
+ - Project: OpenColorIO
8
+ - License: BSD-3-Clause
9
+ - Website: https://opencolorio.org/
10
+ - Source: https://github.com/AcademySoftwareFoundation/OpenColorIO
11
+
12
+ Copyright Contributors to the OpenColorIO Project.
13
+
14
+ Redistribution and use in source and binary forms, with or without
15
+ modification, are permitted provided that the following conditions are
16
+ met:
17
+
18
+ * Redistributions of source code must retain the above copyright
19
+ notice, this list of conditions and the following disclaimer.
20
+ * Redistributions in binary form must reproduce the above copyright
21
+ notice, this list of conditions and the following disclaimer in the
22
+ documentation and/or other materials provided with the distribution.
23
+ * Neither the name of the copyright holder nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,2 @@
1
+ async function createOcioWasmModule(moduleArg={}){var moduleRtn;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 isFileURI=filename=>filename.startsWith("file://");class EmscriptenEH{}class EmscriptenSjLj extends EmscriptenEH{}class CppException extends EmscriptenEH{constructor(excPtr){super();this.excPtr=excPtr}}var readyPromiseResolve,readyPromiseReject;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.initialized)FS.init();TTY.init();wasmExports["Fa"]();FS.ignorePermissions=false}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}function abort(what){Module["onAbort"]?.(what);what=`Aborted(${what})`;err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("ocio-wasm.wasm")}return new URL("ocio-wasm.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,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(inst,mod)=>{resolve(receiveInstance(inst,mod))})})}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 HEAP16;var HEAP32;var HEAP64;var HEAP8;var HEAPF32;var HEAPF64;var HEAPU16;var HEAPU32;var HEAPU64;var HEAPU8;var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var exceptionCaught=[];var uncaughtExceptionCount=0;var ___cxa_begin_catch=ptr=>{var info=new ExceptionInfo(ptr);if(!info.get_caught()){info.set_caught(true);uncaughtExceptionCount--}info.set_rethrown(false);exceptionCaught.push(info);return ___cxa_get_exception_ptr(ptr)};var exceptionLast=null;var ___cxa_end_catch=()=>{_setThrew(0,0);var info=exceptionCaught.pop();___cxa_decrement_exception_refcount(info.excPtr);exceptionLast=null};class ExceptionInfo{constructor(excPtr){this.excPtr=excPtr;this.ptr=excPtr-24}set_type(type){HEAPU32[this.ptr+4>>2]=type}get_type(){return HEAPU32[this.ptr+4>>2]}set_destructor(destructor){HEAPU32[this.ptr+8>>2]=destructor}get_destructor(){return HEAPU32[this.ptr+8>>2]}set_caught(caught){caught=caught?1:0;HEAP8[this.ptr+12]=caught}get_caught(){return HEAP8[this.ptr+12]!=0}set_rethrown(rethrown){rethrown=rethrown?1:0;HEAP8[this.ptr+13]=rethrown}get_rethrown(){return HEAP8[this.ptr+13]!=0}init(type,destructor){this.set_adjusted_ptr(0);this.set_type(type);this.set_destructor(destructor)}set_adjusted_ptr(adjustedPtr){HEAPU32[this.ptr+16>>2]=adjustedPtr}get_adjusted_ptr(){return HEAPU32[this.ptr+16>>2]}}var setTempRet0=val=>__emscripten_tempret_set(val);var findMatchingCatch=args=>{var thrown=exceptionLast?.excPtr;if(!thrown){setTempRet0(0);return 0}var info=new ExceptionInfo(thrown);info.set_adjusted_ptr(thrown);var thrownType=info.get_type();if(!thrownType){setTempRet0(0);return thrown}for(var caughtType of args){if(caughtType===0||caughtType===thrownType){break}var adjusted_ptr_addr=info.ptr+16;if(___cxa_can_catch(caughtType,thrownType,adjusted_ptr_addr)){setTempRet0(caughtType);return thrown}}setTempRet0(thrownType);return thrown};var ___cxa_find_matching_catch_2=()=>findMatchingCatch([]);var ___cxa_find_matching_catch_3=arg0=>findMatchingCatch([arg0]);var ___cxa_find_matching_catch_4=(arg0,arg1)=>findMatchingCatch([arg0,arg1]);var ___cxa_find_matching_catch_5=(arg0,arg1,arg2)=>findMatchingCatch([arg0,arg1,arg2]);var ___cxa_rethrow=()=>{if(!exceptionCaught.length){abort("no exception to throw")}var info=exceptionCaught.at(-1);var ptr=info.excPtr;info.set_rethrown(true);info.set_caught(false);uncaughtExceptionCount++;___cxa_increment_exception_refcount(ptr);exceptionLast=new CppException(ptr);throw exceptionLast};var ___cxa_throw=(ptr,type,destructor)=>{var info=new ExceptionInfo(ptr);info.init(type,destructor);___cxa_increment_exception_refcount(ptr);exceptionLast=new CppException(ptr);uncaughtExceptionCount++;throw exceptionLast};var ___cxa_uncaught_exceptions=()=>uncaughtExceptionCount;var ___resumeException=ptr=>{if(!exceptionLast){exceptionLast=new CppException(ptr)}throw exceptionLast};var syscallGetVarargI=()=>{var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret};var syscallGetVarargP=syscallGetVarargI;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)}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 runDependencies=0;var dependenciesFulfilled=null;var removeRunDependency=id=>{runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}};var addRunDependency=id=>{runDependencies++;Module["monitorRunDependencies"]?.(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)}},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)},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){var lookup=FS.lookupPath(path,{follow:true});var node=lookup.node;var setattr=FS.checkOpExists(node.node_ops.setattr,63);setattr(node,{atime,mtime})},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;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;input??=Module["stdin"];output??=Module["stdout"];error??=Module["stderr"];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 UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";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.slice(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_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}}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_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);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}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);if(isNaN(date.getTime())){return-1}var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;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.getYear();return date.getTime()/1e3})();return BigInt(ret)};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 getHeapMax=()=>2147483648;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};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;var curr=FS.read(stream,HEAP8,ptr,len,offset);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)=>{var ret=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr<len){break}if(typeof offset!="undefined"){offset+=curr}}return ret};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 _llvm_eh_typeid_for=type=>type;var wasmTableMirror=[];var getWasmTableEntry=funcPtr=>{var func=wasmTableMirror[funcPtr];if(!func){wasmTableMirror[funcPtr]=func=wasmTable.get(funcPtr)}return func};FS.createPreloadedFile=FS_createPreloadedFile;FS.preloadFile=FS_preloadFile;FS.staticInit();{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["preloadPlugins"])preloadPlugins=Module["preloadPlugins"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])programArgs=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}Module["UTF8ToString"]=UTF8ToString;Module["stringToUTF8"]=stringToUTF8;Module["lengthBytesUTF8"]=lengthBytesUTF8;Module["FS"]=FS;var _ocio_get_version,_ocio_get_version_hex,_ocio_get_last_error,_ocio_clear_all_caches,_ocio_builtin_config_get_count,_ocio_builtin_config_get_name,_ocio_builtin_config_get_ui_name,_ocio_builtin_config_is_recommended,_ocio_builtin_config_get_yaml,_ocio_config_create_builtin,_ocio_config_create_from_file,_ocio_config_create_from_string,_ocio_config_release,_ocio_config_validate,_ocio_config_get_major_version,_ocio_config_get_minor_version,_ocio_config_get_num_roles,_ocio_config_get_role_name,_ocio_config_get_role_color_space,_ocio_config_get_num_color_spaces,_ocio_config_get_color_space_name,_ocio_config_get_canonical_name,_ocio_config_get_color_space_family,_ocio_config_get_color_space_encoding,_ocio_config_get_color_space_description,_ocio_config_get_color_space_is_data,_ocio_config_get_color_space_reference_space,_ocio_config_get_num_color_space_aliases,_ocio_config_get_color_space_alias,_ocio_config_get_num_color_space_categories,_ocio_config_get_color_space_category,_ocio_config_get_num_displays,_ocio_config_get_display,_ocio_config_get_default_display,_ocio_config_get_num_views,_ocio_config_get_view,_ocio_config_get_default_view,_ocio_config_get_default_view_for_color_space,_ocio_config_get_view_transform_name,_ocio_config_get_view_color_space_name,_ocio_config_get_view_looks,_ocio_config_get_view_description,_ocio_config_get_num_looks,_ocio_config_get_look_name,_ocio_config_get_num_view_transforms,_ocio_config_get_view_transform_name_by_index,_ocio_config_get_num_named_transforms,_ocio_config_get_named_transform_name,_ocio_processor_create_color_space,_ocio_processor_create_display_view,_ocio_processor_release,_ocio_processor_get_cache_id,_ocio_processor_is_noop,_ocio_processor_is_identity,_ocio_processor_apply_rgb_f32,_ocio_processor_apply_rgba_f32,_ocio_processor_apply_rgba_u8,_ocio_processor_extract_gpu_shader_info,_ocio_processor_get_gpu_shader_text,_ocio_processor_get_gpu_shader_language,_ocio_processor_get_gpu_shader_function_name,_ocio_processor_get_gpu_shader_cache_id,_ocio_processor_get_gpu_shader_uniform_buffer_size,_ocio_processor_get_gpu_shader_texture_count,_ocio_processor_get_gpu_shader_texture_name,_ocio_processor_get_gpu_shader_texture_sampler_name,_ocio_processor_get_gpu_shader_texture_width,_ocio_processor_get_gpu_shader_texture_height,_ocio_processor_get_gpu_shader_texture_depth,_ocio_processor_get_gpu_shader_texture_dimensions,_ocio_processor_get_gpu_shader_texture_channels,_ocio_processor_get_gpu_shader_texture_interpolation,_ocio_processor_get_gpu_shader_texture_value_count,_ocio_processor_get_gpu_shader_texture_values,_ocio_processor_get_gpu_shader_uniform_count,_ocio_processor_get_gpu_shader_uniform_name,_ocio_processor_get_gpu_shader_uniform_type,_ocio_processor_get_gpu_shader_uniform_buffer_offset,_ocio_processor_get_gpu_shader_uniform_value_count,_ocio_processor_get_gpu_shader_uniform_value_f64,_ocio_processor_get_gpu_shader_uniform_value_i32,_free,_malloc,_setThrew,__emscripten_tempret_set,__emscripten_stack_restore,_emscripten_stack_get_current,___cxa_decrement_exception_refcount,___cxa_increment_exception_refcount,___cxa_can_catch,___cxa_get_exception_ptr,memory,__indirect_function_table,wasmMemory,wasmTable;function assignWasmExports(wasmExports){_ocio_get_version=Module["_ocio_get_version"]=wasmExports["Ha"];_ocio_get_version_hex=Module["_ocio_get_version_hex"]=wasmExports["Ia"];_ocio_get_last_error=Module["_ocio_get_last_error"]=wasmExports["Ja"];_ocio_clear_all_caches=Module["_ocio_clear_all_caches"]=wasmExports["Ka"];_ocio_builtin_config_get_count=Module["_ocio_builtin_config_get_count"]=wasmExports["La"];_ocio_builtin_config_get_name=Module["_ocio_builtin_config_get_name"]=wasmExports["Ma"];_ocio_builtin_config_get_ui_name=Module["_ocio_builtin_config_get_ui_name"]=wasmExports["Na"];_ocio_builtin_config_is_recommended=Module["_ocio_builtin_config_is_recommended"]=wasmExports["Oa"];_ocio_builtin_config_get_yaml=Module["_ocio_builtin_config_get_yaml"]=wasmExports["Pa"];_ocio_config_create_builtin=Module["_ocio_config_create_builtin"]=wasmExports["Qa"];_ocio_config_create_from_file=Module["_ocio_config_create_from_file"]=wasmExports["Ra"];_ocio_config_create_from_string=Module["_ocio_config_create_from_string"]=wasmExports["Sa"];_ocio_config_release=Module["_ocio_config_release"]=wasmExports["Ta"];_ocio_config_validate=Module["_ocio_config_validate"]=wasmExports["Ua"];_ocio_config_get_major_version=Module["_ocio_config_get_major_version"]=wasmExports["Va"];_ocio_config_get_minor_version=Module["_ocio_config_get_minor_version"]=wasmExports["Wa"];_ocio_config_get_num_roles=Module["_ocio_config_get_num_roles"]=wasmExports["Xa"];_ocio_config_get_role_name=Module["_ocio_config_get_role_name"]=wasmExports["Ya"];_ocio_config_get_role_color_space=Module["_ocio_config_get_role_color_space"]=wasmExports["Za"];_ocio_config_get_num_color_spaces=Module["_ocio_config_get_num_color_spaces"]=wasmExports["_a"];_ocio_config_get_color_space_name=Module["_ocio_config_get_color_space_name"]=wasmExports["$a"];_ocio_config_get_canonical_name=Module["_ocio_config_get_canonical_name"]=wasmExports["ab"];_ocio_config_get_color_space_family=Module["_ocio_config_get_color_space_family"]=wasmExports["bb"];_ocio_config_get_color_space_encoding=Module["_ocio_config_get_color_space_encoding"]=wasmExports["cb"];_ocio_config_get_color_space_description=Module["_ocio_config_get_color_space_description"]=wasmExports["db"];_ocio_config_get_color_space_is_data=Module["_ocio_config_get_color_space_is_data"]=wasmExports["eb"];_ocio_config_get_color_space_reference_space=Module["_ocio_config_get_color_space_reference_space"]=wasmExports["fb"];_ocio_config_get_num_color_space_aliases=Module["_ocio_config_get_num_color_space_aliases"]=wasmExports["gb"];_ocio_config_get_color_space_alias=Module["_ocio_config_get_color_space_alias"]=wasmExports["hb"];_ocio_config_get_num_color_space_categories=Module["_ocio_config_get_num_color_space_categories"]=wasmExports["ib"];_ocio_config_get_color_space_category=Module["_ocio_config_get_color_space_category"]=wasmExports["jb"];_ocio_config_get_num_displays=Module["_ocio_config_get_num_displays"]=wasmExports["kb"];_ocio_config_get_display=Module["_ocio_config_get_display"]=wasmExports["lb"];_ocio_config_get_default_display=Module["_ocio_config_get_default_display"]=wasmExports["mb"];_ocio_config_get_num_views=Module["_ocio_config_get_num_views"]=wasmExports["nb"];_ocio_config_get_view=Module["_ocio_config_get_view"]=wasmExports["ob"];_ocio_config_get_default_view=Module["_ocio_config_get_default_view"]=wasmExports["pb"];_ocio_config_get_default_view_for_color_space=Module["_ocio_config_get_default_view_for_color_space"]=wasmExports["qb"];_ocio_config_get_view_transform_name=Module["_ocio_config_get_view_transform_name"]=wasmExports["rb"];_ocio_config_get_view_color_space_name=Module["_ocio_config_get_view_color_space_name"]=wasmExports["sb"];_ocio_config_get_view_looks=Module["_ocio_config_get_view_looks"]=wasmExports["tb"];_ocio_config_get_view_description=Module["_ocio_config_get_view_description"]=wasmExports["ub"];_ocio_config_get_num_looks=Module["_ocio_config_get_num_looks"]=wasmExports["vb"];_ocio_config_get_look_name=Module["_ocio_config_get_look_name"]=wasmExports["wb"];_ocio_config_get_num_view_transforms=Module["_ocio_config_get_num_view_transforms"]=wasmExports["xb"];_ocio_config_get_view_transform_name_by_index=Module["_ocio_config_get_view_transform_name_by_index"]=wasmExports["yb"];_ocio_config_get_num_named_transforms=Module["_ocio_config_get_num_named_transforms"]=wasmExports["zb"];_ocio_config_get_named_transform_name=Module["_ocio_config_get_named_transform_name"]=wasmExports["Ab"];_ocio_processor_create_color_space=Module["_ocio_processor_create_color_space"]=wasmExports["Bb"];_ocio_processor_create_display_view=Module["_ocio_processor_create_display_view"]=wasmExports["Cb"];_ocio_processor_release=Module["_ocio_processor_release"]=wasmExports["Db"];_ocio_processor_get_cache_id=Module["_ocio_processor_get_cache_id"]=wasmExports["Eb"];_ocio_processor_is_noop=Module["_ocio_processor_is_noop"]=wasmExports["Fb"];_ocio_processor_is_identity=Module["_ocio_processor_is_identity"]=wasmExports["Gb"];_ocio_processor_apply_rgb_f32=Module["_ocio_processor_apply_rgb_f32"]=wasmExports["Hb"];_ocio_processor_apply_rgba_f32=Module["_ocio_processor_apply_rgba_f32"]=wasmExports["Ib"];_ocio_processor_apply_rgba_u8=Module["_ocio_processor_apply_rgba_u8"]=wasmExports["Jb"];_ocio_processor_extract_gpu_shader_info=Module["_ocio_processor_extract_gpu_shader_info"]=wasmExports["Kb"];_ocio_processor_get_gpu_shader_text=Module["_ocio_processor_get_gpu_shader_text"]=wasmExports["Lb"];_ocio_processor_get_gpu_shader_language=Module["_ocio_processor_get_gpu_shader_language"]=wasmExports["Mb"];_ocio_processor_get_gpu_shader_function_name=Module["_ocio_processor_get_gpu_shader_function_name"]=wasmExports["Nb"];_ocio_processor_get_gpu_shader_cache_id=Module["_ocio_processor_get_gpu_shader_cache_id"]=wasmExports["Ob"];_ocio_processor_get_gpu_shader_uniform_buffer_size=Module["_ocio_processor_get_gpu_shader_uniform_buffer_size"]=wasmExports["Pb"];_ocio_processor_get_gpu_shader_texture_count=Module["_ocio_processor_get_gpu_shader_texture_count"]=wasmExports["Qb"];_ocio_processor_get_gpu_shader_texture_name=Module["_ocio_processor_get_gpu_shader_texture_name"]=wasmExports["Rb"];_ocio_processor_get_gpu_shader_texture_sampler_name=Module["_ocio_processor_get_gpu_shader_texture_sampler_name"]=wasmExports["Sb"];_ocio_processor_get_gpu_shader_texture_width=Module["_ocio_processor_get_gpu_shader_texture_width"]=wasmExports["Tb"];_ocio_processor_get_gpu_shader_texture_height=Module["_ocio_processor_get_gpu_shader_texture_height"]=wasmExports["Ub"];_ocio_processor_get_gpu_shader_texture_depth=Module["_ocio_processor_get_gpu_shader_texture_depth"]=wasmExports["Vb"];_ocio_processor_get_gpu_shader_texture_dimensions=Module["_ocio_processor_get_gpu_shader_texture_dimensions"]=wasmExports["Wb"];_ocio_processor_get_gpu_shader_texture_channels=Module["_ocio_processor_get_gpu_shader_texture_channels"]=wasmExports["Xb"];_ocio_processor_get_gpu_shader_texture_interpolation=Module["_ocio_processor_get_gpu_shader_texture_interpolation"]=wasmExports["Yb"];_ocio_processor_get_gpu_shader_texture_value_count=Module["_ocio_processor_get_gpu_shader_texture_value_count"]=wasmExports["Zb"];_ocio_processor_get_gpu_shader_texture_values=Module["_ocio_processor_get_gpu_shader_texture_values"]=wasmExports["_b"];_ocio_processor_get_gpu_shader_uniform_count=Module["_ocio_processor_get_gpu_shader_uniform_count"]=wasmExports["$b"];_ocio_processor_get_gpu_shader_uniform_name=Module["_ocio_processor_get_gpu_shader_uniform_name"]=wasmExports["ac"];_ocio_processor_get_gpu_shader_uniform_type=Module["_ocio_processor_get_gpu_shader_uniform_type"]=wasmExports["bc"];_ocio_processor_get_gpu_shader_uniform_buffer_offset=Module["_ocio_processor_get_gpu_shader_uniform_buffer_offset"]=wasmExports["cc"];_ocio_processor_get_gpu_shader_uniform_value_count=Module["_ocio_processor_get_gpu_shader_uniform_value_count"]=wasmExports["dc"];_ocio_processor_get_gpu_shader_uniform_value_f64=Module["_ocio_processor_get_gpu_shader_uniform_value_f64"]=wasmExports["ec"];_ocio_processor_get_gpu_shader_uniform_value_i32=Module["_ocio_processor_get_gpu_shader_uniform_value_i32"]=wasmExports["fc"];_free=Module["_free"]=wasmExports["gc"];_malloc=Module["_malloc"]=wasmExports["hc"];_setThrew=wasmExports["ic"];__emscripten_tempret_set=wasmExports["jc"];__emscripten_stack_restore=wasmExports["kc"];_emscripten_stack_get_current=wasmExports["lc"];___cxa_decrement_exception_refcount=wasmExports["mc"];___cxa_increment_exception_refcount=wasmExports["nc"];___cxa_can_catch=wasmExports["oc"];___cxa_get_exception_ptr=wasmExports["pc"];memory=wasmMemory=wasmExports["Ea"];__indirect_function_table=wasmTable=wasmExports["Ga"]}var wasmImports={m:___cxa_begin_catch,u:___cxa_end_catch,a:___cxa_find_matching_catch_2,j:___cxa_find_matching_catch_3,z:___cxa_find_matching_catch_4,q:___cxa_find_matching_catch_5,ka:___cxa_rethrow,l:___cxa_throw,na:___cxa_uncaught_exceptions,f:___resumeException,da:___syscall_fcntl64,va:___syscall_getcwd,wa:___syscall_ioctl,ea:___syscall_openat,ta:___syscall_stat64,pa:__abort_js,qa:__localtime_js,ra:__mktime_js,sa:__tzset_js,xa:_clock_time_get,fa:_emscripten_date_now,oa:_emscripten_resize_heap,ya:_environ_get,za:_environ_sizes_get,Y:_fd_close,ba:_fd_read,ua:_fd_seek,ca:_fd_write,E:invoke_di,H:invoke_dii,T:invoke_diii,Da:invoke_fi,P:invoke_fii,F:invoke_fiii,y:invoke_i,e:invoke_ii,p:invoke_iid,N:invoke_iidddd,U:invoke_iidi,Ba:invoke_iidiiii,Aa:invoke_iidiiiii,r:invoke_iif,b:invoke_iii,d:invoke_iiii,v:invoke_iiiii,la:invoke_iiiiid,t:invoke_iiiiii,A:invoke_iiiiiii,ha:invoke_iiiiiiii,Z:invoke_iiiiiiiiii,W:invoke_iiiiiiiiiiii,ma:invoke_iiiiij,_:invoke_iij,Ca:invoke_iiji,X:invoke_jiiii,h:invoke_v,k:invoke_vi,I:invoke_vid,O:invoke_viddd,Q:invoke_viddddi,K:invoke_vidi,L:invoke_vif,R:invoke_viffi,J:invoke_vifi,c:invoke_vii,w:invoke_viid,G:invoke_viiddd,M:invoke_viidddd,s:invoke_viif,B:invoke_viifff,D:invoke_viiffff,g:invoke_viii,ja:invoke_viiif,i:invoke_viiii,n:invoke_viiiii,x:invoke_viiiiii,ga:invoke_viiiiiif,C:invoke_viiiiiii,ia:invoke_viiiiiiii,$:invoke_viiiiiiiii,S:invoke_viiiiiiiiii,V:invoke_viiiiiiiiiiiiiii,aa:invoke_viijii,o:_llvm_eh_typeid_for};function invoke_i(index){var sp=stackSave();try{return getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vi(index,a1){var sp=stackSave();try{getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_v(index){var sp=stackSave();try{getWasmTableEntry(index)()}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vii(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_ii(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viii(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiii(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_di(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_diii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iif(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viddddi(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iid(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiif(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vifi(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vidi(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iij(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vid(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_fi(index,a1){var sp=stackSave();try{return getWasmTableEntry(index)(a1)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viif(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_fii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiji(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iidddd(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viifff(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viidddd(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viid(index,a1,a2,a3){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viddd(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiddd(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_vif(index,a1,a2){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiffff(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iidiiii(index,a1,a2,a3,a4,a5,a6){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iidiiiii(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iidi(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_fiii(index,a1,a2,a3){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_dii(index,a1,a2){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiif(index,a1,a2,a3,a4,a5,a6,a7){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viffi(index,a1,a2,a3,a4){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viijii(index,a1,a2,a3,a4,a5){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiij(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_iiiiid(index,a1,a2,a3,a4,a5){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_jiiii(index,a1,a2,a3,a4){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0);return 0n}}function invoke_iiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11){var sp=stackSave();try{return getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function invoke_viiiiiiiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15){var sp=stackSave();try{getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15)}catch(e){stackRestore(sp);if(!(e instanceof EmscriptenEH))throw e;_setThrew(1,0)}}function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
2
+ ;return moduleRtn}export default createOcioWasmModule;
Binary file
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@bb-studio/ocio",
3
+ "version": "0.0.1",
4
+ "description": "Real OpenColorIO 2.5 WebAssembly bindings for browser and Node.js.",
5
+ "type": "module",
6
+ "main": "./src/index.js",
7
+ "types": "./src/ocio-js.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./src/ocio-js.d.ts",
11
+ "import": "./src/index.js",
12
+ "default": "./src/index.js"
13
+ },
14
+ "./dist/ocio-wasm.js": "./dist/ocio-wasm.js",
15
+ "./dist/ocio-wasm.wasm": "./dist/ocio-wasm.wasm",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "scripts": {
19
+ "build:wasm": "bash scripts/build-wasm.sh",
20
+ "test": "node --test test/*.test.js",
21
+ "pack:dry-run": "npm pack --dry-run",
22
+ "prepublishOnly": "npm test",
23
+ "serve:demo": "node scripts/serve-demo.mjs"
24
+ },
25
+ "keywords": [
26
+ "OpenColorIO",
27
+ "OCIO",
28
+ "ACES",
29
+ "wasm",
30
+ "color-management"
31
+ ],
32
+ "license": "BSD-3-Clause",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/promto-c/ocio-js.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/promto-c/ocio-js/issues"
39
+ },
40
+ "homepage": "https://github.com/promto-c/ocio-js#readme",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "files": [
45
+ "dist/ocio-wasm.js",
46
+ "dist/ocio-wasm.wasm",
47
+ "src/index.js",
48
+ "src/ocio-js.d.ts",
49
+ "README.md",
50
+ "LICENSE",
51
+ "THIRD_PARTY_NOTICES.md"
52
+ ],
53
+ "engines": {
54
+ "node": ">=20"
55
+ }
56
+ }
package/src/index.js ADDED
@@ -0,0 +1,560 @@
1
+ export const ACES_CG_V2_CONFIG = 'ocio://cg-config-v2.2.0_aces-v1.3_ocio-v2.4';
2
+ export const ACES_STUDIO_V2_CONFIG = 'ocio://studio-config-v2.2.0_aces-v1.3_ocio-v2.4';
3
+ export const ACES_CG_V4_CONFIG = 'ocio://cg-config-v4.0.0_aces-v2.0_ocio-v2.5';
4
+ export const ACES_STUDIO_V4_CONFIG = 'ocio://studio-config-v4.0.0_aces-v2.0_ocio-v2.5';
5
+
6
+ export const TransformDirection = Object.freeze({
7
+ FORWARD: 0,
8
+ INVERSE: 1
9
+ });
10
+
11
+ export const OptimizationFlags = Object.freeze({
12
+ DEFAULT: -2147483648,
13
+ NONE: 0x00000000,
14
+ LOSSLESS: 0x089c3fc3,
15
+ VERY_GOOD: 0x0f9c3fc3,
16
+ GOOD: 0x0fdc3fc3,
17
+ DRAFT: -1
18
+ });
19
+
20
+ const DEFAULT_MODULE_PATH = '../dist/ocio-wasm.js';
21
+ const DEFAULT_GPU_SHADER_FUNCTION = 'OCIODisplay';
22
+ const DEFAULT_GPU_RESOURCE_PREFIX = 'ocio';
23
+ const GPU_UNIFORM_TYPES = Object.freeze([
24
+ 'double',
25
+ 'bool',
26
+ 'float3',
27
+ 'vector_float',
28
+ 'vector_int',
29
+ 'unknown'
30
+ ]);
31
+
32
+ function assertTypedArray(value, type, name) {
33
+ if (!(value instanceof type)) {
34
+ throw new TypeError(`${name} must be a ${type.name}`);
35
+ }
36
+ }
37
+
38
+ function toDirection(value) {
39
+ if (value === TransformDirection.INVERSE || value === 'inverse') {
40
+ return TransformDirection.INVERSE;
41
+ }
42
+ return TransformDirection.FORWARD;
43
+ }
44
+
45
+ function toOptimizationFlags(value) {
46
+ if (value === undefined || value === null || value === 'default') {
47
+ return OptimizationFlags.DEFAULT;
48
+ }
49
+ if (typeof value === 'number') {
50
+ return value;
51
+ }
52
+ const key = String(value).toUpperCase().replace(/[-\s]/g, '_');
53
+ if (Object.hasOwn(OptimizationFlags, key)) {
54
+ return OptimizationFlags[key];
55
+ }
56
+ throw new Error(`Unknown OCIO optimization mode: ${value}`);
57
+ }
58
+
59
+ function normalizeGpuLanguage(value) {
60
+ if (value === undefined || value === null || value === '' || value === 'glsl') {
61
+ return 'glsl_es_3.0';
62
+ }
63
+ const language = String(value).toLowerCase().replace(/-/g, '_');
64
+ if (language === 'webgl' || language === 'webgl1') {
65
+ return 'glsl_es_1.0';
66
+ }
67
+ if (language === 'webgl2') {
68
+ return 'glsl_es_3.0';
69
+ }
70
+ return language;
71
+ }
72
+
73
+ function toPositiveInteger(value, name) {
74
+ if (value === undefined || value === null) {
75
+ return 0;
76
+ }
77
+ const number = Number(value);
78
+ if (!Number.isFinite(number) || number <= 0) {
79
+ throw new RangeError(`${name} must be a positive finite number`);
80
+ }
81
+ return Math.floor(number);
82
+ }
83
+
84
+ export async function createOCIO(options = {}) {
85
+ const moduleFactory = options.moduleFactory ?? (await import(options.modulePath ?? DEFAULT_MODULE_PATH)).default;
86
+ const userLocateFile = options.locateFile;
87
+ const moduleOptions = {
88
+ ...options.moduleOptions,
89
+ locateFile(path, prefix) {
90
+ if (userLocateFile) {
91
+ return userLocateFile(path, prefix);
92
+ }
93
+ if (path.endsWith('.wasm')) {
94
+ return new URL(`../dist/${path}`, import.meta.url).href;
95
+ }
96
+ return prefix + path;
97
+ }
98
+ };
99
+
100
+ return new OCIO(await moduleFactory(moduleOptions));
101
+ }
102
+
103
+ export class OCIO {
104
+ constructor(module) {
105
+ this.module = module;
106
+ }
107
+
108
+ get version() {
109
+ return this._string('ocio_get_version');
110
+ }
111
+
112
+ get versionHex() {
113
+ return this.module._ocio_get_version_hex();
114
+ }
115
+
116
+ get lastError() {
117
+ return this._string('ocio_get_last_error');
118
+ }
119
+
120
+ clearAllCaches() {
121
+ this.module._ocio_clear_all_caches();
122
+ }
123
+
124
+ listBuiltinConfigs() {
125
+ const count = this.module._ocio_builtin_config_get_count();
126
+ const configs = [];
127
+ for (let index = 0; index < count; index += 1) {
128
+ configs.push({
129
+ name: this._string('ocio_builtin_config_get_name', index),
130
+ uiName: this._string('ocio_builtin_config_get_ui_name', index),
131
+ recommended: this.module._ocio_builtin_config_is_recommended(index) === 1
132
+ });
133
+ }
134
+ return configs;
135
+ }
136
+
137
+ getBuiltinConfigYaml(name) {
138
+ return this._withCString(name, (namePtr) => this._string('ocio_builtin_config_get_yaml', namePtr));
139
+ }
140
+
141
+ createBuiltinConfig(name = ACES_CG_V4_CONFIG) {
142
+ const handle = this._withCString(name, (namePtr) => this.module._ocio_config_create_builtin(namePtr));
143
+ this._assertHandle(handle, `Could not create built-in OCIO config ${name}`);
144
+ return new Config(this, handle);
145
+ }
146
+
147
+ createConfigFromFile(path) {
148
+ const handle = this._withCString(path, (pathPtr) => this.module._ocio_config_create_from_file(pathPtr));
149
+ this._assertHandle(handle, `Could not create OCIO config from ${path}`);
150
+ return new Config(this, handle);
151
+ }
152
+
153
+ createConfigFromString(text, options = {}) {
154
+ const workingDir = options.workingDir ?? '';
155
+ const handle = this._withCStrings([text, workingDir], ([textPtr, workingDirPtr]) => (
156
+ this.module._ocio_config_create_from_string(textPtr, workingDirPtr)
157
+ ));
158
+ this._assertHandle(handle, 'Could not create OCIO config from string');
159
+ return new Config(this, handle);
160
+ }
161
+
162
+ mkdirp(path) {
163
+ const parts = path.split('/').filter(Boolean);
164
+ let current = path.startsWith('/') ? '' : '.';
165
+ for (const part of parts) {
166
+ current = current === '' ? `/${part}` : `${current}/${part}`;
167
+ try {
168
+ this.module.FS.mkdir(current);
169
+ } catch (error) {
170
+ if (error?.errno !== 20) {
171
+ throw error;
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ writeFile(path, data) {
178
+ const directory = path.slice(0, path.lastIndexOf('/'));
179
+ if (directory) {
180
+ this.mkdirp(directory);
181
+ }
182
+ this.module.FS.writeFile(path, data);
183
+ }
184
+
185
+ readFile(path, options) {
186
+ return this.module.FS.readFile(path, options);
187
+ }
188
+
189
+ _assertHandle(handle, message) {
190
+ if (!handle) {
191
+ throw new Error(`${message}: ${this.lastError}`);
192
+ }
193
+ }
194
+
195
+ _assertStatus(status, message) {
196
+ if (!status) {
197
+ throw new Error(`${message}: ${this.lastError}`);
198
+ }
199
+ }
200
+
201
+ _string(functionName, ...args) {
202
+ const pointer = this.module[`_${functionName}`](...args);
203
+ return pointer ? this.module.UTF8ToString(pointer) : '';
204
+ }
205
+
206
+ _withCString(value, callback) {
207
+ const text = value == null ? '' : String(value);
208
+ const byteLength = this.module.lengthBytesUTF8(text) + 1;
209
+ const pointer = this.module._malloc(byteLength);
210
+ this.module.stringToUTF8(text, pointer, byteLength);
211
+ try {
212
+ return callback(pointer);
213
+ } finally {
214
+ this.module._free(pointer);
215
+ }
216
+ }
217
+
218
+ _withCStrings(values, callback) {
219
+ const pointers = [];
220
+ try {
221
+ for (const value of values) {
222
+ const text = value == null ? '' : String(value);
223
+ const byteLength = this.module.lengthBytesUTF8(text) + 1;
224
+ const pointer = this.module._malloc(byteLength);
225
+ this.module.stringToUTF8(text, pointer, byteLength);
226
+ pointers.push(pointer);
227
+ }
228
+ return callback(pointers);
229
+ } finally {
230
+ for (const pointer of pointers) {
231
+ this.module._free(pointer);
232
+ }
233
+ }
234
+ }
235
+ }
236
+
237
+ export class Config {
238
+ constructor(ocio, handle) {
239
+ this.ocio = ocio;
240
+ this.handle = handle;
241
+ }
242
+
243
+ get version() {
244
+ return {
245
+ major: this.ocio.module._ocio_config_get_major_version(this.handle),
246
+ minor: this.ocio.module._ocio_config_get_minor_version(this.handle)
247
+ };
248
+ }
249
+
250
+ validate() {
251
+ this.ocio._assertStatus(this.ocio.module._ocio_config_validate(this.handle), 'OCIO config validation failed');
252
+ return true;
253
+ }
254
+
255
+ dispose() {
256
+ if (this.handle) {
257
+ this.ocio.module._ocio_config_release(this.handle);
258
+ this.handle = 0;
259
+ }
260
+ }
261
+
262
+ listRoles() {
263
+ const count = this.ocio.module._ocio_config_get_num_roles(this.handle);
264
+ return Array.from({ length: count }, (_, index) => ({
265
+ name: this.ocio._string('ocio_config_get_role_name', this.handle, index),
266
+ colorSpace: this.ocio._string('ocio_config_get_role_color_space', this.handle, index)
267
+ }));
268
+ }
269
+
270
+ listColorSpaces() {
271
+ const count = this.ocio.module._ocio_config_get_num_color_spaces(this.handle);
272
+ return Array.from({ length: count }, (_, index) => {
273
+ const name = this.ocio._string('ocio_config_get_color_space_name', this.handle, index);
274
+ return this.getColorSpace(name);
275
+ });
276
+ }
277
+
278
+ getColorSpace(name) {
279
+ return this.ocio._withCString(name, (namePtr) => {
280
+ const aliasCount = this.ocio.module._ocio_config_get_num_color_space_aliases(this.handle, namePtr);
281
+ const categoryCount = this.ocio.module._ocio_config_get_num_color_space_categories(this.handle, namePtr);
282
+ return {
283
+ name,
284
+ canonicalName: this.ocio._string('ocio_config_get_canonical_name', this.handle, namePtr),
285
+ family: this.ocio._string('ocio_config_get_color_space_family', this.handle, namePtr),
286
+ encoding: this.ocio._string('ocio_config_get_color_space_encoding', this.handle, namePtr),
287
+ description: this.ocio._string('ocio_config_get_color_space_description', this.handle, namePtr),
288
+ isData: this.ocio.module._ocio_config_get_color_space_is_data(this.handle, namePtr) === 1,
289
+ referenceSpace: this.ocio.module._ocio_config_get_color_space_reference_space(this.handle, namePtr),
290
+ aliases: Array.from({ length: aliasCount }, (_, index) => (
291
+ this.ocio._string('ocio_config_get_color_space_alias', this.handle, namePtr, index)
292
+ )),
293
+ categories: Array.from({ length: categoryCount }, (_, index) => (
294
+ this.ocio._string('ocio_config_get_color_space_category', this.handle, namePtr, index)
295
+ ))
296
+ };
297
+ });
298
+ }
299
+
300
+ listDisplays() {
301
+ const count = this.ocio.module._ocio_config_get_num_displays(this.handle);
302
+ return Array.from({ length: count }, (_, index) => this.ocio._string('ocio_config_get_display', this.handle, index));
303
+ }
304
+
305
+ getDefaultDisplay() {
306
+ return this.ocio._string('ocio_config_get_default_display', this.handle);
307
+ }
308
+
309
+ listViews(display) {
310
+ return this.ocio._withCString(display, (displayPtr) => {
311
+ const count = this.ocio.module._ocio_config_get_num_views(this.handle, displayPtr);
312
+ return Array.from({ length: count }, (_, index) => {
313
+ const name = this.ocio._string('ocio_config_get_view', this.handle, displayPtr, index);
314
+ return this.getView(display, name);
315
+ });
316
+ });
317
+ }
318
+
319
+ getView(display, view) {
320
+ return this.ocio._withCStrings([display, view], ([displayPtr, viewPtr]) => ({
321
+ name: view,
322
+ transform: this.ocio._string('ocio_config_get_view_transform_name', this.handle, displayPtr, viewPtr),
323
+ colorSpace: this.ocio._string('ocio_config_get_view_color_space_name', this.handle, displayPtr, viewPtr),
324
+ looks: this.ocio._string('ocio_config_get_view_looks', this.handle, displayPtr, viewPtr),
325
+ description: this.ocio._string('ocio_config_get_view_description', this.handle, displayPtr, viewPtr)
326
+ }));
327
+ }
328
+
329
+ getDefaultView(display, colorSpace) {
330
+ if (colorSpace) {
331
+ return this.ocio._withCStrings([display, colorSpace], ([displayPtr, colorSpacePtr]) => (
332
+ this.ocio._string('ocio_config_get_default_view_for_color_space', this.handle, displayPtr, colorSpacePtr)
333
+ ));
334
+ }
335
+ return this.ocio._withCString(display, (displayPtr) => (
336
+ this.ocio._string('ocio_config_get_default_view', this.handle, displayPtr)
337
+ ));
338
+ }
339
+
340
+ listLooks() {
341
+ const count = this.ocio.module._ocio_config_get_num_looks(this.handle);
342
+ return Array.from({ length: count }, (_, index) => this.ocio._string('ocio_config_get_look_name', this.handle, index));
343
+ }
344
+
345
+ listViewTransforms() {
346
+ const count = this.ocio.module._ocio_config_get_num_view_transforms(this.handle);
347
+ return Array.from({ length: count }, (_, index) => (
348
+ this.ocio._string('ocio_config_get_view_transform_name_by_index', this.handle, index)
349
+ ));
350
+ }
351
+
352
+ listNamedTransforms() {
353
+ const count = this.ocio.module._ocio_config_get_num_named_transforms(this.handle);
354
+ return Array.from({ length: count }, (_, index) => (
355
+ this.ocio._string('ocio_config_get_named_transform_name', this.handle, index)
356
+ ));
357
+ }
358
+
359
+ createColorSpaceProcessor(source, destination, options = {}) {
360
+ const optimization = toOptimizationFlags(options.optimization);
361
+ const handle = this.ocio._withCStrings([source, destination], ([sourcePtr, destinationPtr]) => (
362
+ this.ocio.module._ocio_processor_create_color_space(this.handle, sourcePtr, destinationPtr, optimization)
363
+ ));
364
+ this.ocio._assertHandle(handle, `Could not create OCIO ColorSpace processor ${source} -> ${destination}`);
365
+ return new Processor(this.ocio, handle);
366
+ }
367
+
368
+ createDisplayViewProcessor({ source, display, view, direction = TransformDirection.FORWARD, optimization } = {}) {
369
+ const optimizationFlags = toOptimizationFlags(optimization);
370
+ const transformDirection = toDirection(direction);
371
+ const handle = this.ocio._withCStrings([source, display, view], ([sourcePtr, displayPtr, viewPtr]) => (
372
+ this.ocio.module._ocio_processor_create_display_view(
373
+ this.handle,
374
+ sourcePtr,
375
+ displayPtr,
376
+ viewPtr,
377
+ transformDirection,
378
+ optimizationFlags
379
+ )
380
+ ));
381
+ this.ocio._assertHandle(handle, `Could not create OCIO Display/View processor ${source} -> ${display}/${view}`);
382
+ return new Processor(this.ocio, handle);
383
+ }
384
+ }
385
+
386
+ export class Processor {
387
+ constructor(ocio, handle) {
388
+ this.ocio = ocio;
389
+ this.handle = handle;
390
+ }
391
+
392
+ get cacheId() {
393
+ return this.ocio._string('ocio_processor_get_cache_id', this.handle);
394
+ }
395
+
396
+ get isNoOp() {
397
+ return this.ocio.module._ocio_processor_is_noop(this.handle) === 1;
398
+ }
399
+
400
+ get isIdentity() {
401
+ return this.ocio.module._ocio_processor_is_identity(this.handle) === 1;
402
+ }
403
+
404
+ dispose() {
405
+ if (this.handle) {
406
+ this.ocio.module._ocio_processor_release(this.handle);
407
+ this.handle = 0;
408
+ }
409
+ }
410
+
411
+ applyRGBF32(rgb, options = {}) {
412
+ assertTypedArray(rgb, Float32Array, 'rgb');
413
+ if (rgb.length % 3 !== 0) {
414
+ throw new RangeError('rgb length must be divisible by 3');
415
+ }
416
+ const target = options.copy ? new Float32Array(rgb) : rgb;
417
+ return this._applyFloat32(target, 3, 'ocio_processor_apply_rgb_f32');
418
+ }
419
+
420
+ applyRGBAF32(rgba, options = {}) {
421
+ assertTypedArray(rgba, Float32Array, 'rgba');
422
+ if (rgba.length % 4 !== 0) {
423
+ throw new RangeError('rgba length must be divisible by 4');
424
+ }
425
+ const target = options.copy ? new Float32Array(rgba) : rgba;
426
+ return this._applyFloat32(target, 4, 'ocio_processor_apply_rgba_f32');
427
+ }
428
+
429
+ applyRGBA8(rgba, options = {}) {
430
+ if (!(rgba instanceof Uint8Array) && !(rgba instanceof Uint8ClampedArray)) {
431
+ throw new TypeError('rgba must be a Uint8Array or Uint8ClampedArray');
432
+ }
433
+ if (rgba.length % 4 !== 0) {
434
+ throw new RangeError('rgba length must be divisible by 4');
435
+ }
436
+
437
+ const target = options.copy ? new rgba.constructor(rgba) : rgba;
438
+ const byteLength = target.byteLength;
439
+ const pointer = this.ocio.module._malloc(byteLength);
440
+ this.ocio.module.HEAPU8.set(target, pointer);
441
+ try {
442
+ this.ocio._assertStatus(
443
+ this.ocio.module._ocio_processor_apply_rgba_u8(this.handle, pointer, target.length / 4),
444
+ 'OCIO Uint8 RGBA processing failed'
445
+ );
446
+ target.set(this.ocio.module.HEAPU8.subarray(pointer, pointer + byteLength));
447
+ return target;
448
+ } finally {
449
+ this.ocio.module._free(pointer);
450
+ }
451
+ }
452
+
453
+ getGpuShaderInfo(options = {}) {
454
+ const language = normalizeGpuLanguage(options.language);
455
+ const functionName = options.functionName ?? DEFAULT_GPU_SHADER_FUNCTION;
456
+ const resourcePrefix = options.resourcePrefix ?? DEFAULT_GPU_RESOURCE_PREFIX;
457
+ const textureMaxWidth = toPositiveInteger(options.textureMaxWidth, 'textureMaxWidth');
458
+ const allowTexture1D = options.allowTexture1D === true ? 1 : 0;
459
+
460
+ this.ocio._withCStrings([language, functionName, resourcePrefix], ([languagePtr, functionNamePtr, resourcePrefixPtr]) => {
461
+ this.ocio._assertStatus(
462
+ this.ocio.module._ocio_processor_extract_gpu_shader_info(
463
+ this.handle,
464
+ languagePtr,
465
+ functionNamePtr,
466
+ resourcePrefixPtr,
467
+ textureMaxWidth,
468
+ allowTexture1D
469
+ ),
470
+ 'OCIO GPU shader extraction failed'
471
+ );
472
+ });
473
+
474
+ return {
475
+ shaderText: this.ocio._string('ocio_processor_get_gpu_shader_text', this.handle),
476
+ functionName: this.ocio._string('ocio_processor_get_gpu_shader_function_name', this.handle),
477
+ language: this.ocio._string('ocio_processor_get_gpu_shader_language', this.handle),
478
+ cacheId: this.ocio._string('ocio_processor_get_gpu_shader_cache_id', this.handle),
479
+ uniformBufferSize: this.ocio.module._ocio_processor_get_gpu_shader_uniform_buffer_size(this.handle),
480
+ textures: this._getGpuShaderTextures(),
481
+ uniforms: this._getGpuShaderUniforms()
482
+ };
483
+ }
484
+
485
+ getGpuShaderText(options = {}) {
486
+ return this.getGpuShaderInfo(options).shaderText;
487
+ }
488
+
489
+ _applyFloat32(target, channels, functionName) {
490
+ const byteLength = target.byteLength;
491
+ const pointer = this.ocio.module._malloc(byteLength);
492
+ this.ocio.module.HEAPF32.set(target, pointer / Float32Array.BYTES_PER_ELEMENT);
493
+ try {
494
+ this.ocio._assertStatus(
495
+ this.ocio.module[`_${functionName}`](this.handle, pointer, target.length / channels),
496
+ 'OCIO Float32 processing failed'
497
+ );
498
+ target.set(this.ocio.module.HEAPF32.subarray(
499
+ pointer / Float32Array.BYTES_PER_ELEMENT,
500
+ pointer / Float32Array.BYTES_PER_ELEMENT + target.length
501
+ ));
502
+ return target;
503
+ } finally {
504
+ this.ocio.module._free(pointer);
505
+ }
506
+ }
507
+
508
+ _getGpuShaderTextures() {
509
+ const count = this.ocio.module._ocio_processor_get_gpu_shader_texture_count(this.handle);
510
+ return Array.from({ length: count }, (_, index) => {
511
+ const valueCount = this.ocio.module._ocio_processor_get_gpu_shader_texture_value_count(this.handle, index);
512
+ const valuesPointer = this.ocio.module._ocio_processor_get_gpu_shader_texture_values(this.handle, index);
513
+ if (!valuesPointer && valueCount > 0) {
514
+ throw new Error(`Could not read OCIO GPU texture values: ${this.ocio.lastError}`);
515
+ }
516
+ const valuesOffset = valuesPointer / Float32Array.BYTES_PER_ELEMENT;
517
+ return {
518
+ name: this.ocio._string('ocio_processor_get_gpu_shader_texture_name', this.handle, index),
519
+ samplerName: this.ocio._string('ocio_processor_get_gpu_shader_texture_sampler_name', this.handle, index),
520
+ width: this.ocio.module._ocio_processor_get_gpu_shader_texture_width(this.handle, index),
521
+ height: this.ocio.module._ocio_processor_get_gpu_shader_texture_height(this.handle, index),
522
+ depth: this.ocio.module._ocio_processor_get_gpu_shader_texture_depth(this.handle, index),
523
+ dimensions: this.ocio.module._ocio_processor_get_gpu_shader_texture_dimensions(this.handle, index),
524
+ channels: this.ocio.module._ocio_processor_get_gpu_shader_texture_channels(this.handle, index),
525
+ interpolation: this.ocio._string('ocio_processor_get_gpu_shader_texture_interpolation', this.handle, index),
526
+ values: new Float32Array(this.ocio.module.HEAPF32.subarray(valuesOffset, valuesOffset + valueCount))
527
+ };
528
+ });
529
+ }
530
+
531
+ _getGpuShaderUniforms() {
532
+ const count = this.ocio.module._ocio_processor_get_gpu_shader_uniform_count(this.handle);
533
+ return Array.from({ length: count }, (_, index) => {
534
+ const typeId = this.ocio.module._ocio_processor_get_gpu_shader_uniform_type(this.handle, index);
535
+ const type = GPU_UNIFORM_TYPES[typeId] ?? 'unknown';
536
+ const valueCount = this.ocio.module._ocio_processor_get_gpu_shader_uniform_value_count(this.handle, index);
537
+ let value;
538
+ if (type === 'bool') {
539
+ value = this.ocio.module._ocio_processor_get_gpu_shader_uniform_value_i32(this.handle, index, 0) !== 0;
540
+ } else if (type === 'vector_int') {
541
+ value = Array.from({ length: valueCount }, (_, valueIndex) => (
542
+ this.ocio.module._ocio_processor_get_gpu_shader_uniform_value_i32(this.handle, index, valueIndex)
543
+ ));
544
+ } else if (valueCount === 1) {
545
+ value = this.ocio.module._ocio_processor_get_gpu_shader_uniform_value_f64(this.handle, index, 0);
546
+ } else {
547
+ value = Array.from({ length: valueCount }, (_, valueIndex) => (
548
+ this.ocio.module._ocio_processor_get_gpu_shader_uniform_value_f64(this.handle, index, valueIndex)
549
+ ));
550
+ }
551
+
552
+ return {
553
+ name: this.ocio._string('ocio_processor_get_gpu_shader_uniform_name', this.handle, index),
554
+ type,
555
+ bufferOffset: this.ocio.module._ocio_processor_get_gpu_shader_uniform_buffer_offset(this.handle, index),
556
+ value
557
+ };
558
+ });
559
+ }
560
+ }
@@ -0,0 +1,162 @@
1
+ export const ACES_CG_V2_CONFIG: 'ocio://cg-config-v2.2.0_aces-v1.3_ocio-v2.4';
2
+ export const ACES_STUDIO_V2_CONFIG: 'ocio://studio-config-v2.2.0_aces-v1.3_ocio-v2.4';
3
+ export const ACES_CG_V4_CONFIG: 'ocio://cg-config-v4.0.0_aces-v2.0_ocio-v2.5';
4
+ export const ACES_STUDIO_V4_CONFIG: 'ocio://studio-config-v4.0.0_aces-v2.0_ocio-v2.5';
5
+
6
+ export const TransformDirection: Readonly<{
7
+ FORWARD: 0;
8
+ INVERSE: 1;
9
+ }>;
10
+
11
+ export const OptimizationFlags: Readonly<{
12
+ DEFAULT: number;
13
+ NONE: number;
14
+ LOSSLESS: number;
15
+ VERY_GOOD: number;
16
+ GOOD: number;
17
+ DRAFT: -1;
18
+ }>;
19
+
20
+ export interface CreateOCIOOptions {
21
+ moduleFactory?: (options?: unknown) => Promise<unknown>;
22
+ modulePath?: string;
23
+ moduleOptions?: Record<string, unknown>;
24
+ locateFile?: (path: string, prefix: string) => string;
25
+ }
26
+
27
+ export interface BuiltinConfigInfo {
28
+ name: string;
29
+ uiName: string;
30
+ recommended: boolean;
31
+ }
32
+
33
+ export interface ColorSpaceInfo {
34
+ name: string;
35
+ canonicalName: string;
36
+ family: string;
37
+ encoding: string;
38
+ description: string;
39
+ isData: boolean;
40
+ referenceSpace: number;
41
+ aliases: string[];
42
+ categories: string[];
43
+ }
44
+
45
+ export interface RoleInfo {
46
+ name: string;
47
+ colorSpace: string;
48
+ }
49
+
50
+ export interface ViewInfo {
51
+ name: string;
52
+ transform: string;
53
+ colorSpace: string;
54
+ looks: string;
55
+ description: string;
56
+ }
57
+
58
+ export interface DisplayViewProcessorOptions {
59
+ source: string;
60
+ display: string;
61
+ view: string;
62
+ direction?: 0 | 1 | 'forward' | 'inverse';
63
+ optimization?: number | 'default' | 'none' | 'lossless' | 'very-good' | 'good' | 'draft';
64
+ }
65
+
66
+ export type GpuShaderLanguage =
67
+ | 'glsl'
68
+ | 'glsl_1.2'
69
+ | 'glsl_1.3'
70
+ | 'glsl_4.0'
71
+ | 'glsl_es_1.0'
72
+ | 'glsl_es_3.0'
73
+ | 'webgl'
74
+ | 'webgl1'
75
+ | 'webgl2';
76
+
77
+ export interface GpuShaderOptions {
78
+ language?: GpuShaderLanguage;
79
+ functionName?: string;
80
+ resourcePrefix?: string;
81
+ textureMaxWidth?: number;
82
+ allowTexture1D?: boolean;
83
+ }
84
+
85
+ export interface OcioGpuTexture {
86
+ name: string;
87
+ samplerName: string;
88
+ width: number;
89
+ height: number;
90
+ depth: number;
91
+ dimensions: 1 | 2 | 3;
92
+ channels: 1 | 3;
93
+ interpolation: string;
94
+ values: Float32Array;
95
+ }
96
+
97
+ export interface OcioGpuUniform {
98
+ name: string;
99
+ type: 'double' | 'bool' | 'float3' | 'vector_float' | 'vector_int' | 'unknown';
100
+ bufferOffset: number;
101
+ value: number | boolean | number[];
102
+ }
103
+
104
+ export interface GpuShaderInfo {
105
+ shaderText: string;
106
+ functionName: string;
107
+ language: string;
108
+ cacheId: string;
109
+ uniformBufferSize: number;
110
+ textures: OcioGpuTexture[];
111
+ uniforms: OcioGpuUniform[];
112
+ }
113
+
114
+ export function createOCIO(options?: CreateOCIOOptions): Promise<OCIO>;
115
+
116
+ export class OCIO {
117
+ readonly module: unknown;
118
+ readonly version: string;
119
+ readonly versionHex: number;
120
+ readonly lastError: string;
121
+
122
+ clearAllCaches(): void;
123
+ listBuiltinConfigs(): BuiltinConfigInfo[];
124
+ getBuiltinConfigYaml(name: string): string;
125
+ createBuiltinConfig(name?: string): Config;
126
+ createConfigFromFile(path: string): Config;
127
+ createConfigFromString(text: string, options?: { workingDir?: string }): Config;
128
+ mkdirp(path: string): void;
129
+ writeFile(path: string, data: string | ArrayBufferView): void;
130
+ readFile(path: string, options?: unknown): Uint8Array | string;
131
+ }
132
+
133
+ export class Config {
134
+ readonly version: { major: number; minor: number };
135
+ validate(): true;
136
+ dispose(): void;
137
+ listRoles(): RoleInfo[];
138
+ listColorSpaces(): ColorSpaceInfo[];
139
+ getColorSpace(name: string): ColorSpaceInfo;
140
+ listDisplays(): string[];
141
+ getDefaultDisplay(): string;
142
+ listViews(display: string): ViewInfo[];
143
+ getView(display: string, view: string): ViewInfo;
144
+ getDefaultView(display: string, colorSpace?: string): string;
145
+ listLooks(): string[];
146
+ listViewTransforms(): string[];
147
+ listNamedTransforms(): string[];
148
+ createColorSpaceProcessor(source: string, destination: string, options?: { optimization?: DisplayViewProcessorOptions['optimization'] }): Processor;
149
+ createDisplayViewProcessor(options: DisplayViewProcessorOptions): Processor;
150
+ }
151
+
152
+ export class Processor {
153
+ readonly cacheId: string;
154
+ readonly isNoOp: boolean;
155
+ readonly isIdentity: boolean;
156
+ dispose(): void;
157
+ applyRGBF32(rgb: Float32Array, options?: { copy?: boolean }): Float32Array;
158
+ applyRGBAF32(rgba: Float32Array, options?: { copy?: boolean }): Float32Array;
159
+ applyRGBA8(rgba: Uint8Array | Uint8ClampedArray, options?: { copy?: boolean }): Uint8Array | Uint8ClampedArray;
160
+ getGpuShaderInfo(options?: GpuShaderOptions): GpuShaderInfo;
161
+ getGpuShaderText(options?: GpuShaderOptions): string;
162
+ }