UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

8 lines 1.63 MB
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e); /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ const f=Symbol(`Comlink.proxy`),p=Symbol(`Comlink.endpoint`),m=Symbol(`Comlink.releaseProxy`),h=Symbol(`Comlink.finalizer`),g=Symbol(`Comlink.thrown`),_=e=>typeof e==`object`&&!!e||typeof e==`function`,v=new Map([[`proxy`,{canHandle:e=>_(e)&&e[f],serialize(e){let{port1:t,port2:n}=new MessageChannel;return b(e,t),[n,[n]]},deserialize(e){return e.start(),C(e)}}],[`throw`,{canHandle:e=>_(e)&&g in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function y(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function b(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!y(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(P),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=P(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=N(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;b(e,n),l=M(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[g]:0}}Promise.resolve(l).catch(e=>({value:e,[g]:0})).then(n=>{let[i,s]=ne(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),S(t),h in e&&typeof e[h]==`function`&&e[h]())}).catch(e=>{let[n,r]=ne({value:TypeError(`Unserializable return value`),[g]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function x(e){return e.constructor.name===`MessagePort`}function S(e){x(e)&&e.close()}function C(e,t){return A(e,[],t)}function w(e){if(e)throw Error(`Proxy has been released and is not useable`)}function T(e){return re(e,{type:`RELEASE`}).then(()=>{S(e)})}const E=new WeakMap,D=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(E.get(e)||0)-1;E.set(e,t),t===0&&T(e)});function O(e,t){let n=(E.get(t)||0)+1;E.set(t,n),D&&D.register(e,t,e)}function k(e){D&&D.unregister(e)}function A(e,t=[],n=function(){}){let r=!1,i=new Proxy(n,{get(n,a){if(w(r),a===m)return()=>{k(i),T(e),r=!0};if(a===`then`){if(t.length===0)return{then:()=>i};let n=re(e,{type:`GET`,path:t.map(e=>e.toString())}).then(P);return n.then.bind(n)}return A(e,[...t,a])},set(n,i,a){w(r);let[o,s]=ne(a);return re(e,{type:`SET`,path:[...t,i].map(e=>e.toString()),value:o},s).then(P)},apply(n,i,a){w(r);let o=t[t.length-1];if(o===p)return re(e,{type:`ENDPOINT`}).then(P);if(o===`bind`)return A(e,t.slice(0,-1));let[s,c]=j(a);return re(e,{type:`APPLY`,path:t.map(e=>e.toString()),argumentList:s},c).then(P)},construct(n,i){w(r);let[a,o]=j(i);return re(e,{type:`CONSTRUCT`,path:t.map(e=>e.toString()),argumentList:a},o).then(P)}});return O(i,e),i}function ee(e){return Array.prototype.concat.apply([],e)}function j(e){let t=e.map(ne);return[t.map(e=>e[0]),ee(t.map(e=>e[1]))]}const te=new WeakMap;function M(e,t){return te.set(e,t),e}function N(e){return Object.assign(e,{[f]:!0})}function ne(e){for(let[t,n]of v)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},te.get(e)||[]]}function P(e){switch(e.type){case`HANDLER`:return v.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function re(e,t,n){return new Promise(r=>{let i=ie();e.addEventListener(`message`,function t(n){!n.data||!n.data.id||n.data.id!==i||(e.removeEventListener(`message`,t),r(n.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:i},t),n)})}function ie(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}var ae=(()=>{var e=import.meta.url;return(function(t={}){var n,r=t,i,a,o=new Promise((e,t)=>{i=e,a=t}),s=typeof window==`object`,c=typeof importScripts==`function`;typeof process==`object`&&typeof process.versions==`object`&&process.versions.node;var l=Object.assign({},r),u=`./this.program`,d=(e,t)=>{throw t},f=``;function p(e){return r.locateFile?r.locateFile(e,f):f+e}var m,h,g;(s||c)&&(c?f=self.location.href:typeof document<`u`&&document.currentScript&&(f=document.currentScript.src),e&&(f=e),f=f.startsWith(`blob:`)?``:f.substr(0,f.replace(/[?#].*/,``).lastIndexOf(`/`)+1),m=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.send(null),t.responseText},c&&(g=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),h=(e,t,n)=>{fetch(e,{credentials:`same-origin`}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+` : `+e.url))).then(t,n)});var _=r.print||console.log.bind(console),v=r.printErr||console.error.bind(console);Object.assign(r,l),l=null,r.arguments&&r.arguments,r.thisProgram&&(u=r.thisProgram),r.quit&&(d=r.quit);var y;r.wasmBinary&&(y=r.wasmBinary);var b,x=!1,S,C,w,T,E,D,O,k,A;function ee(){var e=b.buffer;r.HEAP8=C=new Int8Array(e),r.HEAP16=T=new Int16Array(e),r.HEAPU8=w=new Uint8Array(e),r.HEAPU16=E=new Uint16Array(e),r.HEAP32=D=new Int32Array(e),r.HEAPU32=O=new Uint32Array(e),r.HEAPF32=k=new Float32Array(e),r.HEAPF64=A=new Float64Array(e)}var j=[],te=[],M=[],N=[];function ne(){if(r.preRun)for(typeof r.preRun==`function`&&(r.preRun=[r.preRun]);r.preRun.length;)ae(r.preRun.shift());Ee(j)}function P(){!r.noFSInit&&!L.init.initialized&&L.init(),L.ignorePermissions=!1,Ge.init(),Ee(te)}function re(){Ee(M)}function ie(){if(r.postRun)for(typeof r.postRun==`function`&&(r.postRun=[r.postRun]);r.postRun.length;)se(r.postRun.shift());Ee(N)}function ae(e){j.unshift(e)}function oe(e){te.unshift(e)}function se(e){N.unshift(e)}var ce=0,le=null,ue=null;function de(e){return e}function fe(e){ce++,r.monitorRunDependencies?.(ce)}function pe(e){if(ce--,r.monitorRunDependencies?.(ce),ce==0&&(le!==null&&(clearInterval(le),le=null),ue)){var t=ue;ue=null,t()}}function me(e){r.onAbort?.(e),e=`Aborted(`+e+`)`,v(e),x=!0,S=1,e+=`. Build with -sASSERTIONS for more info.`;var t=new WebAssembly.RuntimeError(e);throw a(t),t}var he=`data:application/octet-stream;base64,`,ge=e=>e.startsWith(he);function _e(){if(r.locateFile){var e=`wa-sqlite.wasm`;return ge(e)?e:p(e)}return new URL(`/%7B%7BBASE_PATH%7D%7D/assets/wa-sqlite-DDTbX34h.wasm`,``+import.meta.url).href}var ve;function F(e){if(e==ve&&y)return new Uint8Array(y);if(g)return g(e);throw`both async and sync fetching of the wasm failed`}function ye(e){return y?Promise.resolve().then(()=>F(e)):new Promise((t,n)=>{h(e,e=>t(new Uint8Array(e)),r=>{try{t(F(e))}catch(e){n(e)}})})}function be(e,t,n){return ye(e).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{v(`failed to asynchronously prepare wasm: ${e}`),me(e)})}function xe(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming==`function`&&!ge(t)&&typeof fetch==`function`?fetch(t,{credentials:`same-origin`}).then(e=>WebAssembly.instantiateStreaming(e,n).then(r,function(e){return v(`wasm streaming compile failed: ${e}`),v(`falling back to ArrayBuffer instantiation`),be(t,n,r)})):be(t,n,r)}function Se(){return{a:ur}}function Ce(){var e=Se();function t(e,t){return z=e.exports,b=z.la,ee(),Vn=z.ef,oe(z.ma),pe(`wasm-instantiate`),z}fe(`wasm-instantiate`);function n(e){t(e.instance)}if(r.instantiateWasm)try{return r.instantiateWasm(e,t)}catch(e){v(`Module.instantiateWasm callback failed with error: ${e}`),a(e)}return ve||=_e(),xe(y,ve,e,n).catch(a),{}}var I,we;function Te(e){this.name=`ExitStatus`,this.message=`Program terminated with exit(${e})`,this.status=e}var Ee=e=>{for(;e.length>0;)e.shift()(r)};function De(e,t=`i8`){switch(t.endsWith(`*`)&&(t=`*`),t){case`i1`:return C[e];case`i8`:return C[e];case`i16`:return T[e>>1];case`i32`:return D[e>>2];case`i64`:me(`to do getValue(i64) use WASM_BIGINT`);case`float`:return k[e>>2];case`double`:return A[e>>3];case`*`:return O[e>>2];default:me(`invalid type for getValue: ${t}`)}}var Oe=r.noExitRuntime||!0;function ke(e,t,n=`i8`){switch(n.endsWith(`*`)&&(n=`*`),n){case`i1`:C[e]=t;break;case`i8`:C[e]=t;break;case`i16`:T[e>>1]=t;break;case`i32`:D[e>>2]=t;break;case`i64`:me(`to do setValue(i64) use WASM_BIGINT`);case`float`:k[e>>2]=t;break;case`double`:A[e>>3]=t;break;case`*`:O[e>>2]=t;break;default:me(`invalid type for setValue: ${n}`)}}var Ae=e=>ac(e),je=()=>sc(),Me=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0,Ne=(e,t,n)=>{for(var r=t+n,i=t;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&Me)return Me.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},Pe=(e,t)=>e?Ne(w,e,t):``,Fe=(e,t,n,r)=>{me(`Assertion failed: ${Pe(e)}, at: `+[t?Pe(t):`unknown filename`,n,r?Pe(r):`unknown function`])},Ie={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=Ie.isAbs(e),n=e.substr(-1)===`/`;return e=Ie.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=Ie.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.substr(0,r.length-1),n+r)},basename:e=>{if(e===`/`)return`/`;e=Ie.normalize(e),e=e.replace(/\/$/,``);var t=e.lastIndexOf(`/`);return t===-1?e:e.substr(t+1)},join:(...e)=>Ie.normalize(e.join(`/`)),join2:(e,t)=>Ie.normalize(e+`/`+t)},Le=()=>{if(typeof crypto==`object`&&typeof crypto.getRandomValues==`function`)return e=>crypto.getRandomValues(e);me(`initRandomDevice`)},Re=e=>(Re=Le())(e),ze={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:L.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=Ie.isAbs(i)}return t=Ie.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=ze.resolve(e).substr(1),t=ze.resolve(t).substr(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},Be=[],Ve=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},He=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343){var c=e.charCodeAt(++o);s=65536+((s&1023)<<10)|c&1023}if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63}}return t[n]=0,n-i};function Ue(e,t,n){var r=n>0?n:Ve(e)+1,i=Array(r),a=He(e,i,0,i.length);return t&&(i.length=a),i}var We=()=>{if(!Be.length){var e=null;if(typeof window<`u`&&typeof window.prompt==`function`&&(e=window.prompt(`Input: `),e!==null&&(e+=` `)),!e)return null;Be=Ue(e,!0)}return Be.shift()},Ge={ttys:[],init(){},shutdown(){},register(e,t){Ge.ttys[e]={input:[],output:[],ops:t},L.registerDevice(e,Ge.stream_ops)},stream_ops:{open(e){var t=Ge.ttys[e.node.rdev];if(!t)throw new L.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new L.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new L.ErrnoError(29)}if(s===void 0&&a===0)throw new L.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.timestamp=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new L.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new L.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(e){return We()},put_char(e,t){t===null||t===10?(_(Ne(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(_(Ne(e.output,0)),e.output=[])},ioctl_tcgets(e){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(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(v(Ne(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(v(Ne(e.output,0)),e.output=[])}}},Ke=(e,t)=>(w.fill(0,e,e+t),e),qe=(e,t)=>Math.ceil(e/t)*t,Je=e=>{e=qe(e,65536);var t=rc(65536,e);return t?Ke(t,e):0},Ye={ops_table:null,mount(e){return Ye.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(L.isBlkdev(n)||L.isFIFO(n))throw new L.ErrnoError(63);Ye.ops_table||={dir:{node:{getattr:Ye.node_ops.getattr,setattr:Ye.node_ops.setattr,lookup:Ye.node_ops.lookup,mknod:Ye.node_ops.mknod,rename:Ye.node_ops.rename,unlink:Ye.node_ops.unlink,rmdir:Ye.node_ops.rmdir,readdir:Ye.node_ops.readdir,symlink:Ye.node_ops.symlink},stream:{llseek:Ye.stream_ops.llseek}},file:{node:{getattr:Ye.node_ops.getattr,setattr:Ye.node_ops.setattr},stream:{llseek:Ye.stream_ops.llseek,read:Ye.stream_ops.read,write:Ye.stream_ops.write,allocate:Ye.stream_ops.allocate,mmap:Ye.stream_ops.mmap,msync:Ye.stream_ops.msync}},link:{node:{getattr:Ye.node_ops.getattr,setattr:Ye.node_ops.setattr,readlink:Ye.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Ye.node_ops.getattr,setattr:Ye.node_ops.setattr},stream:L.chrdev_stream_ops}};var i=L.createNode(e,t,n,r);return L.isDir(i.mode)?(i.node_ops=Ye.ops_table.dir.node,i.stream_ops=Ye.ops_table.dir.stream,i.contents={}):L.isFile(i.mode)?(i.node_ops=Ye.ops_table.file.node,i.stream_ops=Ye.ops_table.file.stream,i.usedBytes=0,i.contents=null):L.isLink(i.mode)?(i.node_ops=Ye.ops_table.link.node,i.stream_ops=Ye.ops_table.link.stream):L.isChrdev(i.mode)&&(i.node_ops=Ye.ops_table.chrdev.node,i.stream_ops=Ye.ops_table.chrdev.stream),i.timestamp=Date.now(),e&&(e.contents[t]=i,e.timestamp=i.timestamp),i},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1024*1024?2:1.125)>>>0),n!=0&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=L.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,L.isDir(e.mode)?t.size=4096:L.isFile(e.mode)?t.size=e.usedBytes:L.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&Ye.resizeFileStorage(e,t.size)},lookup(e,t){throw L.genericErrors[44]},mknod(e,t,n,r){return Ye.createNode(e,t,n,r)},rename(e,t,n){if(L.isDir(e.mode)){var r;try{r=L.lookupNode(t,n)}catch{}if(r)for(var i in r.contents)throw new L.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){for(var n in L.lookupNode(e,t).contents)throw new L.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[`.`,`..`];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=Ye.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!L.isLink(e.mode))throw new L.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);if(o>8&&a.subarray)t.set(a.subarray(i,i+o),n);else for(var s=0;s<o;s++)t[n+s]=a[i+s];return o},write(e,t,n,r,i,a){if(t.buffer===C.buffer&&(a=!1),!r)return 0;var o=e.node;if(o.timestamp=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return o.contents=t.subarray(n,n+r),o.usedBytes=r,r;if(o.usedBytes===0&&i===0)return o.contents=t.slice(n,n+r),o.usedBytes=r,r;if(i+r<=o.usedBytes)return o.contents.set(t.subarray(n,n+r),i),r}if(Ye.expandFileStorage(o,i+r),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(n,n+r),i);else for(var s=0;s<r;s++)o.contents[i+s]=t[n+s];return o.usedBytes=Math.max(o.usedBytes,i+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&L.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new L.ErrnoError(28);return r},allocate(e,t,n){Ye.expandFileStorage(e.node,t+n),e.node.usedBytes=Math.max(e.node.usedBytes,t+n)},mmap(e,t,n,r,i){if(!L.isFile(e.node.mode))throw new L.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s.buffer===C.buffer)o=!1,a=s.byteOffset;else{if((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),o=!0,a=Je(t),!a)throw new L.ErrnoError(48);C.set(s,a)}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return Ye.stream_ops.write(e,t,0,r,n,!1),0}}},Xe=(e,t,n,r)=>{var i=r?``:de(`al ${e}`);h(e,e=>{t(new Uint8Array(e)),i&&pe(i)},t=>{if(n)n();else throw`Loading data file "${e}" failed.`}),i&&fe(i)},Ze=(e,t,n,r,i,a)=>{L.createDataFile(e,t,n,r,i,a)},Qe=r.preloadPlugins||[],$e=(e,t,n,r)=>{typeof Browser<`u`&&Browser.init();var i=!1;return Qe.forEach(a=>{i||a.canHandle(t)&&(a.handle(e,t,n,r),i=!0)}),i},et=(e,t,n,r,i,a,o,s,c,l)=>{var u=t?ze.resolve(Ie.join2(e,t)):e,d=de(`cp ${u}`);function f(n){function f(n){l?.(),s||Ze(e,t,n,r,i,c),a?.(),pe(d)}$e(n,u,f,()=>{o?.(),pe(d)})||f(n)}fe(d),typeof n==`string`?Xe(n,f,o):f(n)},tt=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(t===void 0)throw Error(`Unknown file open mode: ${e}`);return t},nt=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},L={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:`/`,initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name=`ErrnoError`,this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}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(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.mounted=null,this.id=L.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return L.isDir(this.mode)}get isDevice(){return L.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=ze.resolve(e),!e)return{path:``,node:null};if(t=Object.assign({follow_mount:!0,recurse_count:0},t),t.recurse_count>8)throw new L.ErrnoError(32);for(var n=e.split(`/`).filter(e=>!!e),r=L.root,i=`/`,a=0;a<n.length;a++){var o=a===n.length-1;if(o&&t.parent)break;if(r=L.lookupNode(r,n[a]),i=Ie.join2(i,n[a]),L.isMountpoint(r)&&(!o||o&&t.follow_mount)&&(r=r.mounted.root),!o||t.follow)for(var s=0;L.isLink(r.mode);){var c=L.readlink(i);if(i=ze.resolve(Ie.dirname(i),c),r=L.lookupPath(i,{recurse_count:t.recurse_count+1}).node,s++>40)throw new L.ErrnoError(32)}}return{path:i,node:r}},getPath(e){for(var t;;){if(L.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%L.nameTable.length},hashAddNode(e){var t=L.hashName(e.parent.id,e.name);e.name_next=L.nameTable[t],L.nameTable[t]=e},hashRemoveNode(e){var t=L.hashName(e.parent.id,e.name);if(L.nameTable[t]===e)L.nameTable[t]=e.name_next;else for(var n=L.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=L.mayLookup(e);if(n)throw new L.ErrnoError(n);for(var r=L.hashName(e.id,t),i=L.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return L.lookup(e,t)},createNode(e,t,n,r){var i=new L.FSNode(e,t,n,r);return L.hashAddNode(i),i},destroyNode(e){L.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return L.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return L.isDir(e.mode)?L.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){try{return L.lookupNode(e,t),20}catch{}return L.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=L.lookupNode(e,t)}catch(e){return e.errno}var i=L.nodePermissions(e,`wx`);if(i)return i;if(n){if(!L.isDir(r.mode))return 54;if(L.isRoot(r)||L.getPath(r)===L.cwd())return 10}else if(L.isDir(r.mode))return 31;return 0},mayOpen(e,t){return e?L.isLink(e.mode)?32:L.isDir(e.mode)&&(L.flagsToPermissionString(t)!==`r`||t&512)?31:L.nodePermissions(e,L.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=L.MAX_OPEN_FDS;e++)if(!L.streams[e])return e;throw new L.ErrnoError(33)},getStreamChecked(e){var t=L.getStream(e);if(!t)throw new L.ErrnoError(8);return t},getStream:e=>L.streams[e],createStream(e,t=-1){return e=Object.assign(new L.FSStream,e),t==-1&&(t=L.nextfd()),e.fd=t,L.streams[t]=e,e},closeStream(e){L.streams[e]=null},dupStream(e,t=-1){var n=L.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){e.stream_ops=L.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new L.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){L.devices[e]={stream_ops:t}},getDevice:e=>L.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),L.syncFSRequests++,L.syncFSRequests>1&&v(`warning: ${L.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=L.getMounts(L.root.mount),r=0;function i(e){return L.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}n.forEach(t=>{if(!t.type.syncfs)return a(null);t.type.syncfs(t,e,a)})},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&L.root)throw new L.ErrnoError(10);if(!r&&!i){var o=L.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,L.isMountpoint(a))throw new L.ErrnoError(10);if(!L.isDir(a.mode))throw new L.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?L.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=L.lookupPath(e,{follow_mount:!1});if(!L.isMountpoint(t.node))throw new L.ErrnoError(28);var n=t.node,r=n.mounted,i=L.getMounts(r);Object.keys(L.nameTable).forEach(e=>{for(var t=L.nameTable[e];t;){var n=t.name_next;i.includes(t.mount)&&L.destroyNode(t),t=n}}),n.mounted=null;var a=n.mount.mounts.indexOf(r);n.mount.mounts.splice(a,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=L.lookupPath(e,{parent:!0}).node,i=Ie.basename(e);if(!i||i===`.`||i===`..`)throw new L.ErrnoError(28);var a=L.mayCreate(r,i);if(a)throw new L.ErrnoError(a);if(!r.node_ops.mknod)throw new L.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},create(e,t){return t=t===void 0?438:t,t&=4095,t|=32768,L.mknod(e,t,0)},mkdir(e,t){return t=t===void 0?511:t,t&=1023,t|=16384,L.mknod(e,t,0)},mkdirTree(e,t){for(var n=e.split(`/`),r=``,i=0;i<n.length;++i)if(n[i]){r+=`/`+n[i];try{L.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return n===void 0&&(n=t,t=438),t|=8192,L.mknod(e,t,n)},symlink(e,t){if(!ze.resolve(e))throw new L.ErrnoError(44);var n=L.lookupPath(t,{parent:!0}).node;if(!n)throw new L.ErrnoError(44);var r=Ie.basename(t),i=L.mayCreate(n,r);if(i)throw new L.ErrnoError(i);if(!n.node_ops.symlink)throw new L.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n=Ie.dirname(e),r=Ie.dirname(t),i=Ie.basename(e),a=Ie.basename(t),o=L.lookupPath(e,{parent:!0}),s=o.node,c;if(o=L.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new L.ErrnoError(44);if(s.mount!==c.mount)throw new L.ErrnoError(75);var l=L.lookupNode(s,i),u=ze.relative(e,r);if(u.charAt(0)!==`.`)throw new L.ErrnoError(28);if(u=ze.relative(t,n),u.charAt(0)!==`.`)throw new L.ErrnoError(55);var d;try{d=L.lookupNode(c,a)}catch{}if(l!==d){var f=L.isDir(l.mode),p=L.mayDelete(s,i,f);if(p||(p=d?L.mayDelete(c,a,f):L.mayCreate(c,a),p))throw new L.ErrnoError(p);if(!s.node_ops.rename)throw new L.ErrnoError(63);if(L.isMountpoint(l)||d&&L.isMountpoint(d))throw new L.ErrnoError(10);if(c!==s&&(p=L.nodePermissions(s,`w`),p))throw new L.ErrnoError(p);L.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{L.hashAddNode(l)}}},rmdir(e){var t=L.lookupPath(e,{parent:!0}).node,n=Ie.basename(e),r=L.lookupNode(t,n),i=L.mayDelete(t,n,!0);if(i)throw new L.ErrnoError(i);if(!t.node_ops.rmdir)throw new L.ErrnoError(63);if(L.isMountpoint(r))throw new L.ErrnoError(10);t.node_ops.rmdir(t,n),L.destroyNode(r)},readdir(e){var t=L.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new L.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=L.lookupPath(e,{parent:!0}).node;if(!t)throw new L.ErrnoError(44);var n=Ie.basename(e),r=L.lookupNode(t,n),i=L.mayDelete(t,n,!1);if(i)throw new L.ErrnoError(i);if(!t.node_ops.unlink)throw new L.ErrnoError(63);if(L.isMountpoint(r))throw new L.ErrnoError(10);t.node_ops.unlink(t,n),L.destroyNode(r)},readlink(e){var t=L.lookupPath(e).node;if(!t)throw new L.ErrnoError(44);if(!t.node_ops.readlink)throw new L.ErrnoError(28);return ze.resolve(L.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var n=L.lookupPath(e,{follow:!t}).node;if(!n)throw new L.ErrnoError(44);if(!n.node_ops.getattr)throw new L.ErrnoError(63);return n.node_ops.getattr(n)},lstat(e){return L.stat(e,!0)},chmod(e,t,n){var r=typeof e==`string`?L.lookupPath(e,{follow:!n}).node:e;if(!r.node_ops.setattr)throw new L.ErrnoError(63);r.node_ops.setattr(r,{mode:t&4095|r.mode&-4096,timestamp:Date.now()})},lchmod(e,t){L.chmod(e,t,!0)},fchmod(e,t){var n=L.getStreamChecked(e);L.chmod(n.node,t)},chown(e,t,n,r){var i=typeof e==`string`?L.lookupPath(e,{follow:!r}).node:e;if(!i.node_ops.setattr)throw new L.ErrnoError(63);i.node_ops.setattr(i,{timestamp:Date.now()})},lchown(e,t,n){L.chown(e,t,n,!0)},fchown(e,t,n){var r=L.getStreamChecked(e);L.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new L.ErrnoError(28);var n=typeof e==`string`?L.lookupPath(e,{follow:!0}).node:e;if(!n.node_ops.setattr)throw new L.ErrnoError(63);if(L.isDir(n.mode))throw new L.ErrnoError(31);if(!L.isFile(n.mode))throw new L.ErrnoError(28);var r=L.nodePermissions(n,`w`);if(r)throw new L.ErrnoError(r);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=L.getStreamChecked(e);if(!(n.flags&2097155))throw new L.ErrnoError(28);L.truncate(n.node,t)},utime(e,t,n){var r=L.lookupPath(e,{follow:!0}).node;r.node_ops.setattr(r,{timestamp:Math.max(t,n)})},open(e,t,n){if(e===``)throw new L.ErrnoError(44);t=typeof t==`string`?tt(t):t,t&64?(n=n===void 0?438:n,n=n&4095|32768):n=0;var i;if(typeof e==`object`)i=e;else{e=Ie.normalize(e);try{i=L.lookupPath(e,{follow:!(t&131072)}).node}catch{}}var a=!1;if(t&64)if(i){if(t&128)throw new L.ErrnoError(20)}else i=L.mknod(e,n,0),a=!0;if(!i)throw new L.ErrnoError(44);if(L.isChrdev(i.mode)&&(t&=-513),t&65536&&!L.isDir(i.mode))throw new L.ErrnoError(54);if(!a){var o=L.mayOpen(i,t);if(o)throw new L.ErrnoError(o)}t&512&&!a&&L.truncate(i,0),t&=-131713;var s=L.createStream({node:i,path:L.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),r.logReadFiles&&!(t&1)&&(L.readFiles||={},e in L.readFiles||(L.readFiles[e]=1)),s},close(e){if(L.isClosed(e))throw new L.ErrnoError(8);e.getdents&&=null;try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{L.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(L.isClosed(e))throw new L.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new L.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new L.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new L.ErrnoError(28);if(L.isClosed(e)||(e.flags&2097155)==1)throw new L.ErrnoError(8);if(L.isDir(e.node.mode))throw new L.ErrnoError(31);if(!e.stream_ops.read)throw new L.ErrnoError(28);var a=i!==void 0;if(!a)i=e.position;else if(!e.seekable)throw new L.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new L.ErrnoError(28);if(L.isClosed(e)||!(e.flags&2097155))throw new L.ErrnoError(8);if(L.isDir(e.node.mode))throw new L.ErrnoError(31);if(!e.stream_ops.write)throw new L.ErrnoError(28);e.seekable&&e.flags&1024&&L.llseek(e,0,2);var o=i!==void 0;if(!o)i=e.position;else if(!e.seekable)throw new L.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},allocate(e,t,n){if(L.isClosed(e))throw new L.ErrnoError(8);if(t<0||n<=0)throw new L.ErrnoError(28);if(!(e.flags&2097155))throw new L.ErrnoError(8);if(!L.isFile(e.node.mode)&&!L.isDir(e.node.mode))throw new L.ErrnoError(43);if(!e.stream_ops.allocate)throw new L.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new L.ErrnoError(2);if(!e.stream_ops.mmap)throw new L.ErrnoError(43);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new L.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`)throw Error(`Invalid encoding type "${t.encoding}"`);var n,r=L.open(e,t.flags),i=L.stat(e).size,a=new Uint8Array(i);return L.read(r,a,0,i,0),t.encoding===`utf8`?n=Ne(a,0):t.encoding===`binary`&&(n=a),L.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=L.open(e,n.flags,n.mode);if(typeof t==`string`){var i=new Uint8Array(Ve(t)+1),a=He(t,i,0,i.length);L.write(r,i,0,a,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))L.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw Error(`Unsupported data type`);L.close(r)},cwd:()=>L.currentPath,chdir(e){var t=L.lookupPath(e,{follow:!0});if(t.node===null)throw new L.ErrnoError(44);if(!L.isDir(t.node.mode))throw new L.ErrnoError(54);var n=L.nodePermissions(t.node,`x`);if(n)throw new L.ErrnoError(n);L.currentPath=t.path},createDefaultDirectories(){L.mkdir(`/tmp`),L.mkdir(`/home`),L.mkdir(`/home/web_user`)},createDefaultDevices(){L.mkdir(`/dev`),L.registerDevice(L.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r}),L.mkdev(`/dev/null`,L.makedev(1,3)),Ge.register(L.makedev(5,0),Ge.default_tty_ops),Ge.register(L.makedev(6,0),Ge.default_tty1_ops),L.mkdev(`/dev/tty`,L.makedev(5,0)),L.mkdev(`/dev/tty1`,L.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(t=Re(e).byteLength),e[--t]);L.createDevice(`/dev`,`random`,n),L.createDevice(`/dev`,`urandom`,n),L.mkdir(`/dev/shm`),L.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){L.mkdir(`/proc`);var e=L.mkdir(`/proc/self`);L.mkdir(`/proc/self/fd`),L.mount({mount(){var t=L.createNode(e,`fd`,16895,73);return t.node_ops={lookup(e,t){var n=+t,r=L.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path}};return i.parent=i,i}},t}},{},`/proc/self/fd`)},createStandardStreams(){r.stdin?L.createDevice(`/dev`,`stdin`,r.stdin):L.symlink(`/dev/tty`,`/dev/stdin`),r.stdout?L.createDevice(`/dev`,`stdout`,null,r.stdout):L.symlink(`/dev/tty`,`/dev/stdout`),r.stderr?L.createDevice(`/dev`,`stderr`,null,r.stderr):L.symlink(`/dev/tty1`,`/dev/stderr`),L.open(`/dev/stdin`,0),L.open(`/dev/stdout`,1),L.open(`/dev/stderr`,1)},staticInit(){[44].forEach(e=>{L.genericErrors[e]=new L.ErrnoError(e),L.genericErrors[e].stack=`<generic error, no stack>`}),L.nameTable=Array(4096),L.mount(Ye,{},`/`),L.createDefaultDirectories(),L.createDefaultDevices(),L.createSpecialDirectories(),L.filesystems={MEMFS:Ye}},init(e,t,n){L.init.initialized=!0,r.stdin=e||r.stdin,r.stdout=t||r.stdout,r.stderr=n||r.stderr,L.createStandardStreams()},quit(){L.init.initialized=!1;for(var e=0;e<L.streams.length;e++){var t=L.streams[e];t&&L.close(t)}},findObject(e,t){var n=L.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=L.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=L.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=Ie.basename(e),n=L.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:L.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=Ie.join2(e,a);try{L.mkdir(o)}catch{}e=o}}return o},createFile(e,t,n,r,i){var a=Ie.join2(typeof e==`string`?e:L.getPath(e),t),o=nt(r,i);return L.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:L.getPath(e),o=t?Ie.join2(e,t):e);var s=nt(r,i),c=L.create(o,s);if(n){if(typeof n==`string`){for(var l=Array(n.length),u=0,d=n.length;u<d;++u)l[u]=n.charCodeAt(u);n=l}L.chmod(c,s|146);var f=L.open(c,577);L.write(f,n,0,n.length,0,a),L.close(f),L.chmod(c,s)}},createDevice(e,t,n,r){var i=Ie.join2(typeof e==`string`?e:L.getPath(e),t),a=nt(!!n,!!r);L.createDevice.major||(L.createDevice.major=64);var o=L.makedev(L.createDevice.major++,0);return L.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new L.ErrnoError(29)}if(c===void 0&&o===0)throw new L.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.timestamp=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new L.ErrnoError(29)}return i&&(e.node.timestamp=Date.now()),o}}),L.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<`u`)throw Error(`Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.`);if(m)try{e.contents=Ue(m(e.url),!0),e.usedBytes=e.contents.length}catch{throw new L.ErrnoError(29)}else throw Error(`Cannot load without read() or XMLHttpRequest.`)},createLazyFile(e,t,n,r,i){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open(`HEAD`,n,!1),e.send(null),!(e.status>=200&&e.status<300||e.status===304))throw Error(`Couldn't load `+n+`. Status: `+e.status);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1024*1024;i||(o=t);var s=(e,r)=>{if(e>r)throw Error(`invalid range (`+e+`, `+r+`) or no bytes requested!`);if(r>t-1)throw Error(`only `+t+` bytes available! programmer error!`);var i=new XMLHttpRequest;if(i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+r),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),!(i.status>=200&&i.status<300||i.status===304))throw Error(`Couldn't load `+n+`. Status: `+i.status);return i.response===void 0?Ue(i.responseText||``,!0):new Uint8Array(i.response||[])},c=this;c.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;if(r=Math.min(r,t-1),c.chunks[e]===void 0&&(c.chunks[e]=s(n,r)),c.chunks[e]===void 0)throw Error(`doXHR failed!`);return c.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,_(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<`u`){if(!c)throw`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`;var o={isDevice:!1,contents:new a}}else var o={isDevice:!1,url:n};var s=L.createFile(e,t,o,r,i);o.contents?s.contents=o.contents:o.url&&(s.contents=null,s.url=o.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var l={};Object.keys(s.stream_ops).forEach(e=>{var t=s.stream_ops[e];l[e]=(...e)=>(L.forceLoadFile(s),t(...e))});function u(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return l.read=(e,t,n,r,i)=>(L.forceLoadFile(s),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{L.forceLoadFile(s);var a=Je(t);if(!a)throw new L.ErrnoError(48);return u(e,C,a,t,n),{ptr:a,allocated:!0}},s.stream_ops=l,s}},rt={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(Ie.isAbs(t))return t;var r=e===-100?L.cwd():rt.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new L.ErrnoError(44);return r}return Ie.join2(r,t)},doStat(e,t,n){var r=e(t);D[n>>2]=r.dev,D[n+4>>2]=r.mode,O[n+8>>2]=r.nlink,D[n+12>>2]=r.uid,D[n+16>>2]=r.gid,D[n+20>>2]=r.rdev,we=[r.size>>>0,(I=r.size,+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[n+24>>2]=we[0],D[n+28>>2]=we[1],D[n+32>>2]=4096,D[n+36>>2]=r.blocks;var i=r.atime.getTime(),a=r.mtime.getTime(),o=r.ctime.getTime();return we=[Math.floor(i/1e3)>>>0,(I=Math.floor(i/1e3),+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[n+40>>2]=we[0],D[n+44>>2]=we[1],O[n+48>>2]=i%1e3*1e3,we=[Math.floor(a/1e3)>>>0,(I=Math.floor(a/1e3),+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[n+56>>2]=we[0],D[n+60>>2]=we[1],O[n+64>>2]=a%1e3*1e3,we=[Math.floor(o/1e3)>>>0,(I=Math.floor(o/1e3),+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[n+72>>2]=we[0],D[n+76>>2]=we[1],O[n+80>>2]=o%1e3*1e3,we=[r.ino>>>0,(I=r.ino,+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[n+88>>2]=we[0],D[n+92>>2]=we[1],0},doMsync(e,t,n,r,i){if(!L.isFile(t.node.mode))throw new L.ErrnoError(43);if(r&2)return 0;var a=w.slice(e,e+n);L.msync(t,a,i,n,r)},getStreamFromFD(e){return L.getStreamChecked(e)},varargs:void 0,getStr(e){return Pe(e)}};function it(e,t){try{return e=rt.getStr(e),L.chmod(e,t),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function at(e,t,n,r){try{if(t=rt.getStr(t),t=rt.calculateAt(e,t),n&-8)return-28;var i=L.lookupPath(t,{follow:!0}).node;if(!i)return-44;var a=``;return n&4&&(a+=`r`),n&2&&(a+=`w`),n&1&&(a+=`x`),a&&L.nodePermissions(i,a)?-2:0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function ot(e,t){try{return L.fchmod(e,t),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function st(e,t,n){try{return L.fchown(e,t,n),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function ct(){var e=D[rt.varargs>>2];return rt.varargs+=4,e}var lt=ct;function ut(e,t,n){rt.varargs=n;try{var r=rt.getStreamFromFD(e);switch(t){case 0:var i=ct();if(i<0)return-28;for(;L.streams[i];)i++;return L.dupStream(r,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=ct();return r.flags|=i,0;case 12:var i=lt(),a=0;return T[i+a>>1]=2,0;case 13:case 14:return 0}return-28}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function dt(e,t){try{var n=rt.getStreamFromFD(e);return rt.doStat(L.stat,n.path,t)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var ft=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+t*4294967296:NaN;function pt(e,t,n){var r=ft(t,n);try{return isNaN(r)?61:(L.ftruncate(e,r),0)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var mt=(e,t,n)=>He(e,w,t,n);function ht(e,t){try{if(t===0)return-28;var n=L.cwd(),r=Ve(n)+1;return t<r?-68:(mt(n,e,t),r)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function gt(e,t){try{return e=rt.getStr(e),rt.doStat(L.lstat,e,t)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function _t(e,t,n){try{return t=rt.getStr(t),t=rt.calculateAt(e,t),t=Ie.normalize(t),t[t.length-1]===`/`&&(t=t.substr(0,t.length-1)),L.mkdir(t,n,0),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function vt(e,t,n,r){try{t=rt.getStr(t);var i=r&256,a=r&4096;return r&=-6401,t=rt.calculateAt(e,t,a),rt.doStat(i?L.lstat:L.stat,t,n)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function yt(e,t,n,r){rt.varargs=r;try{t=rt.getStr(t),t=rt.calculateAt(e,t);var i=r?ct():0;return L.open(t,n,i).fd}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function bt(e,t,n,r){try{if(t=rt.getStr(t),t=rt.calculateAt(e,t),r<=0)return-28;var i=L.readlink(t),a=Math.min(r,Ve(i)),o=C[n+a];return mt(i,n,r+1),C[n+a]=o,a}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function xt(e){try{return e=rt.getStr(e),L.rmdir(e),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function St(e,t){try{return e=rt.getStr(e),rt.doStat(L.stat,e,t)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ct(e,t,n){try{return t=rt.getStr(t),t=rt.calculateAt(e,t),n===0?L.unlink(t):n===512?L.rmdir(t):me(`Invalid flags passed to unlinkat`),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var wt=e=>O[e>>2]+D[e+4>>2]*4294967296;function Tt(e,t,n,r){try{if(t=rt.getStr(t),t=rt.calculateAt(e,t,!0),n){var i=wt(n),a=D[n+8>>2];o=i*1e3+a/(1e3*1e3),n+=16,i=wt(n),a=D[n+8>>2],s=i*1e3+a/(1e3*1e3)}else var o=Date.now(),s=o;return L.utime(t,o,s),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var Et=e=>e%4==0&&(e%100!=0||e%400==0),Dt=[0,31,60,91,121,152,182,213,244,274,305,335],Ot=[0,31,59,90,120,151,181,212,243,273,304,334],kt=e=>(Et(e.getFullYear())?Dt:Ot)[e.getMonth()]+e.getDate()-1;function At(e,t,n){var r=ft(e,t),i=new Date(r*1e3);D[n>>2]=i.getSeconds(),D[n+4>>2]=i.getMinutes(),D[n+8>>2]=i.getHours(),D[n+12>>2]=i.getDate(),D[n+16>>2]=i.getMonth(),D[n+20>>2]=i.getFullYear()-1900,D[n+24>>2]=i.getDay();var a=kt(i)|0;D[n+28>>2]=a,D[n+36>>2]=-(i.getTimezoneOffset()*60);var o=new Date(i.getFullYear(),0,1),s=new Date(i.getFullYear(),6,1).getTimezoneOffset(),c=o.getTimezoneOffset(),l=(s!=c&&i.getTimezoneOffset()==Math.min(c,s))|0;D[n+32>>2]=l}function jt(e,t,n,r,i,a,o,s){var c=ft(i,a);try{if(isNaN(c))return 61;var l=rt.getStreamFromFD(r),u=L.mmap(l,e,c,t,n),d=u.ptr;return D[o>>2]=u.allocated,O[s>>2]=d,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Mt(e,t,n,r,i,a,o){var s=ft(a,o);try{var c=rt.getStreamFromFD(i);n&2&&rt.doMsync(e,c,t,r,s)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var R=(e,t,n,r)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);O[e>>2]=l*60,D[t>>2]=Number(s!=c);var u=e=>e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:`short`}).split(` `)[1],d=u(a),f=u(o);c<s?(mt(d,n,17),mt(f,r,17)):(mt(d,r,17),mt(f,n,17))},Nt=()=>Date.now(),Pt=()=>performance.now(),Ft=()=>2147483648,It=e=>{var t=(e-b.buffer.byteLength+65535)/65536;try{return b.grow(t),ee(),1}catch{}},Lt=e=>{var t=w.length;e>>>=0;var n=Ft();if(e>n)return!1;for(var r=(e,t)=>e+(t-e%t)%t,i=1;i<=4;i*=2){var a=t*(1+.2/i);if(a=Math.min(a,e+100663296),It(Math.min(n,r(Math.max(e,a),65536))))return!0}return!1},Rt={},zt=()=>u||`./this.program`,Bt=()=>{if(!Bt.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(typeof navigator==`object`&&navigator.languages&&navigator.languages[0]||`C`).replace(`-`,`_`)+`.UTF-8`,_:zt()};for(var t in Rt)Rt[t]===void 0?delete e[t]:e[t]=Rt[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Bt.strings=n}return Bt.strings},Vt=(e,t)=>{for(var n=0;n<e.length;++n)C[t++]=e.charCodeAt(n);C[t]=0},Ht=(e,t)=>{var n=0;return Bt().forEach((r,i)=>{var a=t+n;O[e+i*4>>2]=a,Vt(r,a),n+=r.length+1}),0},Ut=(e,t)=>{var n=Bt();O[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),O[t>>2]=r,0};function Wt(e){try{var t=rt.getStreamFromFD(e);return L.close(t),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Gt(e,t){try{var n=0,r=0,i=0,a=rt.getStreamFromFD(e),o=a.tty?2:L.isDir(a.mode)?3:L.isLink(a.mode)?7:4;return C[t]=o,T[t+2>>1]=i,we=[n>>>0,(I=n,+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[t+8>>2]=we[0],D[t+12>>2]=we[1],we=[r>>>0,(I=r,+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[t+16>>2]=we[0],D[t+20>>2]=we[1],0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var Kt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=O[t>>2],s=O[t+4>>2];t+=8;var c=L.read(e,C,o,s,r);if(c<0)return-1;if(i+=c,c<s)break;r!==void 0&&(r+=c)}return i};function qt(e,t,n,r){try{var i=Kt(rt.getStreamFromFD(e),t,n);return O[r>>2]=i,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Jt(e,t,n,r,i){var a=ft(t,n);try{if(isNaN(a))return 61;var o=rt.getStreamFromFD(e);return L.llseek(o,a,r),we=[o.position>>>0,(I=o.position,+Math.abs(I)>=1?I>0?Math.floor(I/4294967296)>>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)],D[i>>2]=we[0],D[i+4>>2]=we[1],o.getdents&&a===0&&r===0&&(o.getdents=null),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Yt(e){try{var t=rt.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var Xt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=O[t>>2],s=O[t+4>>2];t+=8;var c=L.write(e,C,o,s,r);if(c<0)return-1;i+=c,r!==void 0&&(r+=c)}return i};function Zt(e,t,n,r){try{var i=Xt(rt.getStreamFromFD(e),t,n);return O[r>>2]=i,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var Qt=function(){let e=typeof Asyncify==`object`?Asyncify.handleAsync.bind(Asyncify):null;r.handleAsync=e;let t=new Map;r.setCallback=(e,n)=>t.set(e,n),r.getCallback=e=>t.get(e),r.deleteCallback=e=>t.delete(e),Qt=function(n,r,...i){let a=t.get(r),o=null,s=typeof a==`function`?a:a[o=Pe(i.shift())];if(n){if(e)return e(()=>s.apply(a,i));throw Error(`Synchronous WebAssembly cannot call async function`)}let c=s.apply(a,i);if(typeof c?.then==`function`)throw console.error(`unexpected Promise`,s),Error(`${o} unexpectedly returned a Promise`);return c}};function $t(...e){return Qt(!1,...e)}function en(...e){return Qt(!0,...e)}function tn(...e){return Qt(!1,...e)}function nn(...e){return Qt(!0,...e)}function rn(...e){return Qt(!1,...e)}function an(...e){return Qt(!0,...e)}function on(...e){return Qt(!1,...e)}function sn(...e){return Qt(!0,...e)}function cn(...e){return Qt(!1,...e)}function ln(...e){return Qt(!0,...e)}function un(...e){return Qt(!1,...e)}function dn(...e){return Qt(!0,...e)}function fn(...e){return Qt(!1,...e)}function pn(...e){return Qt(!0,...e)}function mn(...e){return Qt(!1,...e)}function hn(...e){return Qt(!0,...e)}function gn(...e){return Qt(!1,...e)}function _n(...e){return Qt(!0,...e)}function vn(...e){return Qt(!1,...e)}function yn(...e){return Qt(!0,...e)}function bn(...e){return Qt(!1,...e)}function xn(...e){return Qt(!0,...e)}function Sn(...e){return Qt(!1,...e)}function Cn(...e){return Qt(!0,...e)}function wn(...e){return Qt(!1,...e)}function Tn(...e)