@synlexa/studio 0.0.0-stage → 0.4.4
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 +201 -0
- package/NOTICE +72 -0
- package/README.md +73 -2
- package/assets/icon-256.png +0 -0
- package/assets/icon.icns +0 -0
- package/assets/icon.ico +0 -0
- package/assets/icon.png +0 -0
- package/bin/synlexa-studio.mjs +245 -0
- package/package.json +38 -4
- package/scripts/desktop-shortcut.mjs +610 -0
- package/scripts/postinstall.mjs +13 -0
- package/wasm/synlexa_bio_core.wasm +0 -0
- package/web-dist/assets/MolStarViewport-BEGb0UZJ.js +8197 -0
- package/web-dist/assets/MolStarViewport-BYVdqMR8.css +1 -0
- package/web-dist/assets/bioCore.worker-BGMOX1WA.js +1 -0
- package/web-dist/assets/index-DR8pRGGj.css +1 -0
- package/web-dist/assets/index-OgQ3RYDT.js +845 -0
- package/web-dist/assets/node.browser-BFtyutLR.js +1 -0
- package/web-dist/assets/node.browser-BoI8HeAS.js +1 -0
- package/web-dist/assets/rdkit.worker-BvevbBxc.js +19 -0
- package/web-dist/favicon_io/android-chrome-192x192.png +0 -0
- package/web-dist/favicon_io/android-chrome-512x512.png +0 -0
- package/web-dist/favicon_io/apple-touch-icon.png +0 -0
- package/web-dist/favicon_io/favicon-16x16.png +0 -0
- package/web-dist/favicon_io/favicon-32x32.png +0 -0
- package/web-dist/favicon_io/favicon.ico +0 -0
- package/web-dist/favicon_io/site.webmanifest +1 -0
- package/web-dist/fixtures/1A3N.cif +8411 -0
- package/web-dist/fixtures/1LZ1.cif +2950 -0
- package/web-dist/fixtures/1UBQ.cif +2237 -0
- package/web-dist/fixtures/3HS4.cif +7817 -0
- package/web-dist/fixtures/3HS4.pdb +5385 -0
- package/web-dist/fixtures/AF-P00918-F1-model_v6.cif +3372 -0
- package/web-dist/fixtures/AF-P00918-F1-model_v6.pdb +2141 -0
- package/web-dist/fixtures/AF-P00918-F1-predicted_aligned_error_v6.json +1 -0
- package/web-dist/fixtures/AF-P0CG48-F1-model_v6.cif +8128 -0
- package/web-dist/fixtures/AF-P61626-F1-model_v6.cif +2075 -0
- package/web-dist/fixtures/AF-P68871-F1-model_v6.cif +2029 -0
- package/web-dist/fixtures/fixtures-manifest.json +198 -0
- package/web-dist/fixtures/pubchem-panel.json +84 -0
- package/web-dist/index.html +19 -0
- package/web-dist/synlexa-logo.png +0 -0
- package/web-dist/synlexa-s-icon.svg +12 -0
- package/web-dist/synlexa-wordmark.png +0 -0
- package/web-dist/wasm/rdkit/RDKit_minimal.wasm +0 -0
- package/web-dist/wasm/synlexa_bio_core.wasm +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as o}from"./index-OgQ3RYDT.js";function n(e){return new Proxy({},{get(i,t){if(typeof t!="symbol")throw new o(`\`${e}.${t}\` is not available in this environment; it needs a Node.js-compatible runtime`)}})}const a=n("fs"),s=n("path");export{a as fs,s as path};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as s}from"./index-OgQ3RYDT.js";import{D as B,M as R}from"./index-OgQ3RYDT.js";function e(o){throw new s(`${o} requires Node.js or a Node-compatible runtime`)}const a=3e4,u=".anthropic-memory-store";var c=(()=>{class o extends s{constructor(t,n){super(t),n!==void 0&&(this.cause=n)}}return o._errorName="SessionMemoryError",o})();class l{constructor(r,t){e("SessionMemoryStores")}get roots(){return e("SessionMemoryStores")}get readOnlyRoots(){return e("SessionMemoryStores")}download(r){return e("SessionMemoryStores")}finish(){return e("SessionMemoryStores")}syncAll(r){return e("SessionMemoryStores")}syncIfDue(){return e("SessionMemoryStores")}flushWrites(r){return e("SessionMemoryStores")}dispose(){return e("SessionMemoryStores")}}function S(o){return e("setupSkills")}function _(o,r){return e("extractSkillArchive")}function m(o){return e("betaAgentToolset20260401")}function M(o,r){return e("resolvePath")}var T=(()=>{class o extends s{constructor(t){super(`bash command timed out after ${t}ms`),this.timeoutMs=t}}return o._errorName="BashTimeoutError",o})();class h{constructor(r,t){e("BashSession")}get closed(){return e("BashSession")}exec(r,t={}){return e("BashSession")}close(){e("BashSession")}}function d(o){return e("betaBashTool")}function f(o){return e("betaReadTool")}function b(o){return e("betaWriteTool")}function y(o){return e("betaEditTool")}function p(o){return e("betaGlobTool")}function E(o){return e("betaGrepTool")}export{h as BashSession,T as BashTimeoutError,B as DEFAULT_MEMORY_SYNC_INTERVAL_MS,u as MARKER_PATH,a as MEMORY_FLUSH_TIMEOUT_MS,R as MIN_MEMORY_SYNC_INTERVAL_MS,c as SessionMemoryError,l as SessionMemoryStores,m as betaAgentToolset20260401,d as betaBashTool,y as betaEditTool,p as betaGlobTool,E as betaGrepTool,f as betaReadTool,b as betaWriteTool,_ as extractSkillArchive,M as resolvePath,S as setupSkills};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function yn(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}function gn(p){if(Object.prototype.hasOwnProperty.call(p,"__esModule"))return p;var g=p.default;if(typeof g=="function"){var _=function E(){return this instanceof E?Reflect.construct(g,arguments,this.constructor):g.apply(this,arguments)};_.prototype=g.prototype}else _={};return Object.defineProperty(_,"__esModule",{value:!0}),Object.keys(p).forEach(function(E){var P=Object.getOwnPropertyDescriptor(p,E);Object.defineProperty(_,E,P.get?P:{enumerable:!0,get:function(){return p[E]}})}),_}var de={exports:{}},wn={},bn=Object.freeze({__proto__:null,default:wn}),ot=gn(bn),it;function _n(){return it||(it=1,(function(p,g){var _=(()=>{var E=globalThis.document?.currentScript?.src;return async function(P={}){var d=P,U=!!globalThis.window,I=!!globalThis.WorkerGlobalScope,D=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer",M="./this.program";typeof __filename<"u"?E=__filename:I&&(E=self.location.href);var k="";function or(r){return d.locateFile?d.locateFile(r,k):k+r}var K,X;if(D){var er=ot;k=__dirname+"/",X=r=>{r=vr(r)?new URL(r):r;var e=er.readFileSync(r);return e},K=async(r,e=!0)=>{r=vr(r)?new URL(r):r;var t=er.readFileSync(r,e?void 0:"utf8");return t},process.argv.length>1&&(M=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else if(U||I){try{k=new URL(".",E).href}catch{}I&&(X=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),K=async r=>{if(vr(r))return new Promise((t,n)=>{var i=new XMLHttpRequest;i.open("GET",r,!0),i.responseType="arraybuffer",i.onload=()=>{if(i.status==200||i.status==0&&i.response){t(i.response);return}n(i.status)},i.onerror=n,i.send(null)});var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)}}var Z=console.log.bind(console),G=console.error.bind(console),Er=!1,vr=r=>r.startsWith("file://");function hr(){let r=fe();r==0&&(r+=4),y[r>>>2>>>0]=34821223,y[r+4>>>2>>>0]=2310721022,y[0]=1668509029}function Q(r){return"0x"+(r>>>0).toString(16).padStart(8,"0")}function mr(){if(Er)return;let r=fe();r==0&&(r+=4);const e=y[r>>>2>>>0],t=y[r+4>>>2>>>0];(e!=34821223||t!=2310721022)&&z(`Stack overflow! Stack cookie has been overwritten at ${ft(r)}, expected hex dwords ${Q(2310721022)} and ${Q(34821223)}, but received ${Q(t)} ${Q(e)}`),y[0]!=1668509029&&z("Runtime error: The application has corrupted its heap memory area (address zero)!")}var kr=!1;function Rr(){return xr.buffer}function Sr(){if(!j?.buffer?.resizable){var r=Rr();j=new Int8Array(r),lr=new Int16Array(r),x=new Uint8Array(r),Fr=new Uint16Array(r),F=new Int32Array(r),y=new Uint32Array(r),qe=new Float32Array(r),Ke=new Float64Array(r),L=new BigInt64Array(r),Ce=new BigUint64Array(r)}}function $r(){var r=d.preRun;r&&(typeof r=="function"&&(r=[r]),pe.push(...r)),he(pe)}function Nr(){kr=!0,mr(),!d.noFSInit&&!o.initialized&&o.init(),dr.Y(),o.ignorePermissions=!1,mr()}function ir(){mr();var r=d.postRun;r&&(typeof r=="function"&&(r=[r]),me.push(...r)),he(me)}function z(r){throw d.onAbort?.(r),r=`Aborted(${r})`,G(r),Er=!0,r+=". Build with -sASSERTIONS for more info.",kr&&Ze(),new WebAssembly.RuntimeError(r)}var Or;function V(){return or("RDKit_minimal.wasm")}function J(r){if(X)return X(r);throw"both async and sync fetching of the wasm failed"}async function Kr(r){try{var e=await K(r);return new Uint8Array(e)}catch{}return J(r)}async function Pr(r,e){try{var t=await Kr(r),n=await WebAssembly.instantiate(t,e);return n}catch(i){G(`failed to asynchronously prepare wasm: ${i}`),z(i)}}async function lt(r,e,t){if(!vr(e)&&!D)try{var n=fetch(e,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(n,t);return i}catch(a){G(`wasm streaming compile failed: ${a}`),G("falling back to ArrayBuffer instantiation")}return Pr(e,t)}function ut(){var r={a:hn};return r}var F,j,y,he=r=>{for(;r.length>0;)r.shift()(d)},me=[],pe=[];function ft(r){return r>>>=0,"0x"+r.toString(16).padStart(8,"0")}var Mr=()=>{var r=F[+T.varargs>>>2>>>0];return T.varargs+=4,r},pr=Mr,C={isAbs:r=>r.charAt(0)==="/",splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var i=r[n];i==="."?r.splice(n,1):i===".."?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=C.isAbs(r),t=r.slice(-1)==="/";return r=C.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=C.splitPath(r),t=e[0],n=e[1];return!t&&!n?".":(n&&(n=n.slice(0,-1)),t+n)},basename:r=>r&&r.match(/([^\/]+|\/)\/*$/)[1],join:(...r)=>C.normalize(r.join("/")),join2:(r,e)=>C.normalize(r+"/"+e)},ct=()=>{if(D){var r=ot;return e=>(r.randomFillSync(e),0)}return e=>(crypto.getRandomValues(e),0)},Xr=r=>(Xr=ct())(r),yr={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var i=n>=0?r[n]:o.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=C.isAbs(i)}return e=C.normalizeArray(e.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=yr.resolve(r).slice(1),e=yr.resolve(e).slice(1);function t(f){for(var c=0;c<f.length&&f[c]==="";c++);for(var m=f.length-1;m>=0&&f[m]==="";m--);return c>m?[]:f.slice(c,m-c+1)}for(var n=t(r.split("/")),i=t(e.split("/")),a=Math.min(n.length,i.length),s=a,l=0;l<a;l++)if(n[l]!==i[l]){s=l;break}var u=[];for(l=s;l<n.length;l++)u.push("..");return u=u.concat(i.slice(s)),u.join("/")}},ye=globalThis.TextDecoder&&new TextDecoder,ge=(r,e,t,n)=>{var i=e+t;if(n)return i;for(;r[e]&&!(e>=i);)++e;return e},gr=(r,e=0,t,n)=>{e>>>=0;var i=ge(r,e,t,n);if(i-e>16&&r.buffer&&ye)return ye.decode(r.subarray(e,i));for(var a="";e<i;){var s=r[e++];if(!(s&128)){a+=String.fromCharCode(s);continue}var l=r[e++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|l);continue}var u=r[e++]&63;if((s&240)==224?s=(s&15)<<12|l<<6|u:s=(s&7)<<18|l<<12|u<<6|r[e++]&63,s<65536)a+=String.fromCharCode(s);else{var f=s-65536;a+=String.fromCharCode(55296|f>>10,56320|f&1023)}}return a},Gr=[],Yr=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},we=(r,e,t,n)=>{if(t>>>=0,!(n>0))return 0;for(var i=t,a=t+n-1,s=0;s<r.length;++s){var l=r.codePointAt(s);if(l<=127){if(t>=a)break;e[t++>>>0]=l}else if(l<=2047){if(t+1>=a)break;e[t++>>>0]=192|l>>6,e[t++>>>0]=128|l&63}else if(l<=65535){if(t+2>=a)break;e[t++>>>0]=224|l>>12,e[t++>>>0]=128|l>>6&63,e[t++>>>0]=128|l&63}else{if(t+3>=a)break;e[t++>>>0]=240|l>>18,e[t++>>>0]=128|l>>12&63,e[t++>>>0]=128|l>>6&63,e[t++>>>0]=128|l&63,s++}}return e[t>>>0]=0,t-i},Jr=(r,e,t)=>{var n=Yr(r)+1,i=new Array(n),a=we(r,i,0,i.length);return i.length=a,i},dt=()=>{if(!Gr.length){var r=null;if(D){var e=Buffer.alloc(256),t=0;try{t=er.readSync(process.stdin.fd,e,0,256)}catch(n){if(n.toString().includes("EOF"))t=0;else throw n}t>0&&(r=e.toString("utf-8",0,t))}else globalThis.window?.prompt&&(r=window.prompt("Input: "),r!==null&&(r+=`
|
|
2
|
+
`));if(!r)return null;Gr=Jr(r)}return Gr.shift()},ar={ttys:[],init(){},shutdown(){},register(r,e){ar.ttys[r]={input:[],output:[],ops:e},o.registerDevice(r,ar.stream_ops)},stream_ops:{open(r){var e=ar.ttys[r.node.rdev];if(!e)throw new o.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,i){if(!r.tty||!r.tty.ops.get_char)throw new o.ErrnoError(60);for(var a=0,s=0;s<n;s++){var l;try{l=r.tty.ops.get_char(r.tty)}catch{throw new o.ErrnoError(29)}if(l===void 0&&!a)throw new o.ErrnoError(6);if(l==null||(a++,e[t+s]=l,l===10))break}return a&&(r.node.atime=Date.now()),a},write(r,e,t,n,i){if(!r.tty||!r.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new o.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char(r){return dt()},put_char(r,e){e===null||e===10?(Z(gr(r.output)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output?.length>0&&(Z(gr(r.output)),r.output=[])},ioctl_tcgets(r){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(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(G(gr(r.output)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output?.length>0&&(G(gr(r.output)),r.output=[])}}},x,vt=(r,e)=>x.fill(0,r,r+e),be=(r,e)=>Math.ceil(r/e)*e,_e=r=>{r=be(r,65536);var e=Je(65536,r);return e&&vt(e,r),e},w={ops_table:null,mount(r){return w.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(o.isBlkdev(t)||o.isFIFO(t))throw new o.ErrnoError(63);w.ops_table||={dir:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,lookup:w.node_ops.lookup,mknod:w.node_ops.mknod,rename:w.node_ops.rename,unlink:w.node_ops.unlink,rmdir:w.node_ops.rmdir,readdir:w.node_ops.readdir,symlink:w.node_ops.symlink},stream:{llseek:w.stream_ops.llseek}},file:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:{llseek:w.stream_ops.llseek,read:w.stream_ops.read,write:w.stream_ops.write,mmap:w.stream_ops.mmap,msync:w.stream_ops.msync}},link:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr,readlink:w.node_ops.readlink},stream:{}},chrdev:{node:{getattr:w.node_ops.getattr,setattr:w.node_ops.setattr},stream:o.chrdev_stream_ops}};var i=o.createNode(r,e,t,n);return o.isDir(i.mode)?(i.node_ops=w.ops_table.dir.node,i.stream_ops=w.ops_table.dir.stream,i.contents={}):o.isFile(i.mode)?(i.node_ops=w.ops_table.file.node,i.stream_ops=w.ops_table.file.stream,i.usedBytes=0,i.contents=w.emptyFileContents??=new Uint8Array(0)):o.isLink(i.mode)?(i.node_ops=w.ops_table.link.node,i.stream_ops=w.ops_table.link.stream):o.isChrdev(i.mode)&&(i.node_ops=w.ops_table.chrdev.node,i.stream_ops=w.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),r&&(r.contents[e]=i,r.atime=r.mtime=r.ctime=i.atime),i},getFileDataAsTypedArray(r){return r.contents.subarray(0,r.usedBytes)},expandFileStorage(r,e){var t=r.contents.length;if(!(t>=e)){e=Math.max(e,t*(t<1048576?2:1.125)>>>0),t&&(e=Math.max(e,256));var n=w.getFileDataAsTypedArray(r);r.contents=new Uint8Array(e),r.contents.set(n)}},resizeFileStorage(r,e){if(r.usedBytes!=e){var t=r.contents;r.contents=new Uint8Array(e),r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=o.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,o.isDir(r.mode)?e.size=4096:o.isFile(r.mode)?e.size=r.usedBytes:o.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.atime),e.mtime=new Date(r.mtime),e.ctime=new Date(r.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){for(const t of["mode","atime","mtime","ctime"])e[t]!=null&&(r[t]=e[t]);e.size!==void 0&&w.resizeFileStorage(r,e.size)},lookup(r,e){throw w.doesNotExistError||(w.doesNotExistError=new o.ErrnoError(44),w.doesNotExistError.stack="<generic error, no stack>"),w.doesNotExistError},mknod(r,e,t,n){return w.createNode(r,e,t,n)},rename(r,e,t){var n;try{n=o.lookupNode(e,t)}catch{}if(n&&o.isDir(r.mode))for(var i in n.contents)throw new o.ErrnoError(55);delete r.parent.contents[r.name],e.contents[t]=r,r.name=t,e.ctime=e.mtime=r.parent.ctime=r.parent.mtime=Date.now()},unlink(r,e){delete r.contents[e],r.ctime=r.mtime=Date.now()},rmdir(r,e){var t=o.lookupNode(r,e);for(var n in t.contents)throw new o.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir(r){return[".","..",...Object.keys(r.contents)]},symlink(r,e,t){var n=w.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!o.isLink(r.mode))throw new o.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,i){var a=r.node.contents;if(i>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-i,n);return e.set(a.subarray(i,i+s),t),s},write(r,e,t,n,i,a){if(e.buffer===j.buffer&&(a=!1),!n)return 0;var s=r.node;return s.mtime=s.ctime=Date.now(),a?(s.contents=e.subarray(t,t+n),s.usedBytes=n):!s.usedBytes&&!i?(s.contents=e.slice(t,t+n),s.usedBytes=n):(w.expandFileStorage(s,i+n),s.contents.set(e.subarray(t,t+n),i),s.usedBytes=Math.max(s.usedBytes,i+n)),n},llseek(r,e,t){var n=e;if(t===1?n+=r.position:t===2&&o.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},mmap(r,e,t,n,i){if(!o.isFile(r.node.mode))throw new o.ErrnoError(43);var a,s,l=r.node.contents;if(!(i&2)&&l.buffer===j.buffer)s=!1,a=l.byteOffset;else{if(s=!0,a=_e(e),!a)throw new o.ErrnoError(48);l&&((t>0||t+e<l.length)&&(l.subarray?l=l.subarray(t,t+e):l=Array.prototype.slice.call(l,t,t+e)),j.set(l,a>>>0))}return{ptr:a,allocated:s}},msync(r,e,t,n,i){return w.stream_ops.write(r,e,0,n,t,!1),0}}},ht=r=>{if(typeof r!="string")return r;var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(typeof e>"u")throw new Error(`Unknown file open mode: ${r}`);return e},Ee=r=>(typeof r=="string"&&(r=Jr(r)),r.subarray||(r=new Uint8Array(r)),r),Zr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},mt=async r=>{var e=await K(r);return new Uint8Array(e)},pt=(...r)=>o.createDataFile(...r),ke=null,yt=async()=>ke,sr=0,Se=null,gt=()=>{sr--,d.monitorRunDependencies?.(sr),sr||Se()},wt=()=>{sr||(ke=new Promise(r=>Se=r)),sr++,d.monitorRunDependencies?.(sr)},bt=[],_t=async(r,e)=>{typeof Browser<"u"&&Browser.init();for(var t of bt)if(t.canHandle(e))return t.handle(r,e);return r},$e=async(r,e,t,n,i,a,s,l)=>{var u=e?yr.resolve(C.join2(r,e)):r;wt();try{var f=t;typeof t=="string"&&(f=await mt(t)),f=await _t(f,u),l?.(),a||pt(r,e,f,n,i,s)}finally{gt()}},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:[],currentPath:"/",initialized:!1,ignorePermissions:!0,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},FSStream:class{shared={};get object(){return this.node}set object(r){this.node=r}get isRead(){return(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(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.id=o.nextInode++,this.name=e,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return o.isDir(this.mode)}get isDevice(){return o.isChrdev(this.mode)}addListener(r,e=!1){var t={cb:r,exclusive:e},n=this.listeners??=new Set;return n.add(t),{listeners:n,entry:t}}notifyListeners(r){if(this.listeners){var e;for(var t of this.listeners)t.exclusive?(e||=[]).push(t):t.cb(r);if(e){var n=(this.exclTurn||0)%e.length;this.exclTurn=n+1,e[n].cb(r)}}}},lookupPath(r,e={}){if(!r)throw new o.ErrnoError(44);e.follow_mount??=!0,C.isAbs(r)||(r=o.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter(f=>!!f),i=o.root,a="/",s=0;s<n.length;s++){var l=s===n.length-1;if(l&&e.parent)break;if(n[s]!=="."){if(n[s]===".."){if(a=C.dirname(a),o.isRoot(i)){r=a+"/"+n.slice(s+1).join("/"),t--;continue r}else i=i.parent;continue}a=C.join2(a,n[s]);try{i=o.lookupNode(i,n[s])}catch(f){if(f?.errno===44&&l&&e.noent_okay)return{path:a};throw f}if(o.isMountpoint(i)&&(!l||e.follow_mount)&&(i=i.mounted.root),o.isLink(i.mode)&&(!l||e.follow)){if(!i.node_ops.readlink)throw new o.ErrnoError(52);var u=i.node_ops.readlink(i);C.isAbs(u)||(u=C.dirname(a)+"/"+u),r=u+"/"+n.slice(s+1).join("/");continue r}}}return{path:a,node:i}}throw new o.ErrnoError(32)},getPath(r){for(var e;;){if(o.isRoot(r)){var t=r.mount.mountpoint;return e?t[t.length-1]!=="/"?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%o.nameTable.length},hashAddNode(r){var e=o.hashName(r.parent.id,r.name);r.name_next=o.nameTable[e],o.nameTable[e]=r},hashRemoveNode(r){var e=o.hashName(r.parent.id,r.name);if(o.nameTable[e]===r)o.nameTable[e]=r.name_next;else for(var t=o.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=o.mayLookup(r);if(t)throw new o.ErrnoError(t);for(var n=o.hashName(r.id,e),i=o.nameTable[n];i;i=i.name_next){var a=i.name;if(i.parent.id===r.id&&a===e)return i}return o.lookup(r,e)},createNode(r,e,t,n){var i=new o.FSNode(r,e,t,n);return o.hashAddNode(i),i},destroyNode(r){o.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return o.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!o.isDir(r.mode))return 54;var e=o.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){if(!o.isDir(r.mode))return 54;try{return o.lookupNode(r,e),20}catch{}return o.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=o.lookupNode(r,e)}catch(a){return a.errno}var i=o.nodePermissions(r,"wx");if(i)return i;if(t){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen(r,e){if(!r)return 44;if(o.isLink(r.mode))return 32;var t=o.flagsToPermissionString(e);return o.isDir(r.mode)&&(t!=="r"||e&576)?31:o.nodePermissions(r,t)},checkOpExists(r,e){if(!r)throw new o.ErrnoError(e);return r},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=o.MAX_OPEN_FDS;r++)if(!o.streams[r])return r;throw new o.ErrnoError(33)},getStreamChecked(r){var e=o.getStream(r);if(!e)throw new o.ErrnoError(8);return e},getStream:r=>o.streams[r],createStream(r,e=-1){return r=Object.assign(new o.FSStream,r),e==-1&&(e=o.nextfd()),r.fd=e,o.streams[e]=r,r},closeStream(r){o.streams[r]=null},dupStream(r,e=-1){var t=o.createStream(r,e);return t.stream_ops?.dup?.(t),t},doSetAttr(r,e,t){var n=r?.stream_ops.setattr,i=n?r:e;n??=e.node_ops.setattr,o.checkOpExists(n,63);try{n(i,t)}catch(a){throw a instanceof RangeError?new o.ErrnoError(22):a}},chrdev_stream_ops:{open(r){var e=o.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new o.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){o.devices[r]={stream_ops:e}},getDevice:r=>o.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),o.syncFSRequests++,o.syncFSRequests>1&&G(`warning: ${o.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=o.getMounts(o.root.mount),n=0;function i(l){return o.syncFSRequests--,e(l)}function a(l){if(l)return a.errored?void 0:(a.errored=!0,i(l));++n>=t.length&&i(null)}for(var s of t)s.type.syncfs?s.type.syncfs(s,r,a):a(null)},mount(r,e,t){var n=t==="/",i=!t,a;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!i){var s=o.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,o.isMountpoint(a))throw new o.ErrnoError(10);if(!o.isDir(a.mode))throw new o.ErrnoError(54)}var l={type:r,opts:e,mountpoint:t,mounts:[]},u=r.mount(l);return u.mount=l,l.root=u,n?o.root=u:a&&(a.mounted=l,a.mount&&a.mount.mounts.push(l)),u},unmount(r){var e=o.lookupPath(r,{follow_mount:!1});if(!o.isMountpoint(e.node))throw new o.ErrnoError(28);var t=e.node,n=t.mounted,i=o.getMounts(n);for(var[a,s]of Object.entries(o.nameTable))for(;s;){var l=s.name_next;i.includes(s.mount)&&o.destroyNode(s),s=l}t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=o.lookupPath(r,{parent:!0}),i=n.node,a=C.basename(r);if(!a)throw new o.ErrnoError(28);if(a==="."||a==="..")throw new o.ErrnoError(20);var s=o.mayCreate(i,a);if(s)throw new o.ErrnoError(s);if(!i.node_ops.mknod)throw new o.ErrnoError(63);return i.node_ops.mknod(i,a,e,t)},statfs(r){return o.statfsNode(o.lookupPath(r,{follow:!0}).node)},statfsStream(r){return o.statfsNode(r.node)},statfsNode(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:o.nextInode,ffree:o.nextInode-1,fsid:42,flags:2,namelen:255};return r.node_ops.statfs&&Object.assign(e,r.node_ops.statfs(r.mount.opts.root)),e},create(r,e=438){return e&=4095,e|=32768,o.mknod(r,e,0)},mkdir(r,e=511){return e&=1023,e|=16384,o.mknod(r,e,0)},mkdirTree(r,e=511){var t=r.split("/"),n="";for(var i of t)if(i){(n||C.isAbs(r))&&(n+="/"),n+=i;try{o.mkdir(n,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,o.mknod(r,e,t)},symlink(r,e){if(!yr.resolve(r))throw new o.ErrnoError(44);var t=o.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new o.ErrnoError(44);var i=C.basename(e),a=o.mayCreate(n,i);if(a)throw new o.ErrnoError(a);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,i,r)},link(r,e,t){var n=o.lookupPath(e,{parent:!0}),i=n.node;if(!i)throw new o.ErrnoError(44);var a=C.basename(e),s=o.mayCreate(i,a);if(s)throw new o.ErrnoError(s);if(!i.node_ops.link)throw new o.ErrnoError(34);return i.node_ops.link(i,a,r,t)},rename(r,e){var t=C.dirname(r),n=C.dirname(e),i=C.basename(r),a=C.basename(e),s,l,u;if(s=o.lookupPath(r,{parent:!0}),l=s.node,s=o.lookupPath(e,{parent:!0}),u=s.node,!l||!u)throw new o.ErrnoError(44);if(l.mount!==u.mount)throw new o.ErrnoError(75);var f=o.lookupNode(l,i),c=yr.relative(r,n);if(c.charAt(0)!==".")throw new o.ErrnoError(28);if(c=yr.relative(e,t),c.charAt(0)!==".")throw new o.ErrnoError(55);var m;try{m=o.lookupNode(u,a)}catch{}if(f!==m){var v=o.isDir(f.mode),h=o.mayDelete(l,i,v);if(h)throw new o.ErrnoError(h);if(h=m?o.mayDelete(u,a,v):o.mayCreate(u,a),h)throw new o.ErrnoError(h);if(!l.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(f)||m&&o.isMountpoint(m))throw new o.ErrnoError(10);if(u!==l&&(h=o.nodePermissions(l,"w"),h))throw new o.ErrnoError(h);o.hashRemoveNode(f);try{l.node_ops.rename(f,u,a),m&&o.hashRemoveNode(m),f.parent=u}catch(b){throw b}finally{o.hashAddNode(f)}}},rmdir(r){var e=o.lookupPath(r,{parent:!0}),t=e.node,n=C.basename(r),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!0);if(a)throw new o.ErrnoError(a);if(!t.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.rmdir(t,n),o.destroyNode(i)},readdir(r){var e=o.lookupPath(r,{follow:!0}),t=e.node,n=o.checkOpExists(t.node_ops.readdir,54);return n(t)},unlink(r){var e=o.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new o.ErrnoError(44);var n=C.basename(r),i=o.lookupNode(t,n),a=o.mayDelete(t,n,!1);if(a)throw new o.ErrnoError(a);if(!t.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(i))throw new o.ErrnoError(10);t.node_ops.unlink(t,n),o.destroyNode(i)},readlink(r){var e=o.lookupPath(r),t=e.node;if(!t)throw new o.ErrnoError(44);if(!t.node_ops.readlink)throw new o.ErrnoError(28);return t.node_ops.readlink(t)},stat(r,e=!1){var t=o.lookupPath(r,{follow:!e}),n=t.node,i=o.checkOpExists(n.node_ops.getattr,63);return i(n)},fstat(r){var e=o.getStreamChecked(r),t=e.node,n=e.stream_ops.getattr,i=n?e:t;return n??=t.node_ops.getattr,o.checkOpExists(n,63),n(i)},lstat(r){return o.stat(r,!0)},doChmod(r,e,t,n=!1){o.doSetAttr(r,e,{mode:t&4095|e.mode&-4096,ctime:Date.now(),dontFollow:n})},chmod(r,e,t=!1){var n;if(typeof r=="string"){var i=o.lookupPath(r,{follow:!t});n=i.node}else n=r;o.doChmod(null,n,e,t)},lchmod(r,e){o.chmod(r,e,!0)},fchmod(r,e){var t=o.getStreamChecked(r);o.doChmod(t,t.node,e,!1)},doChown(r,e,t=!1){o.doSetAttr(r,e,{timestamp:Date.now(),dontFollow:t})},chown(r,e,t,n=!1){var i;if(typeof r=="string"){var a=o.lookupPath(r,{follow:!n});i=a.node}else i=r;o.doChown(null,i,n)},lchown(r,e,t){o.chown(r,e,t,!0)},fchown(r,e,t){var n=o.getStreamChecked(r);o.doChown(n,n.node,!1)},doTruncate(r,e,t){if(o.isDir(e.mode))throw new o.ErrnoError(31);if(!o.isFile(e.mode))throw new o.ErrnoError(28);var n=o.nodePermissions(e,"w");if(n)throw new o.ErrnoError(n);o.doSetAttr(r,e,{size:t,timestamp:Date.now()})},truncate(r,e){if(e<0)throw new o.ErrnoError(28);var t;if(typeof r=="string"){var n=o.lookupPath(r,{follow:!0});t=n.node}else t=r;o.doTruncate(null,t,e)},ftruncate(r,e){var t=o.getStreamChecked(r);if(e<0||(t.flags&2097155)===0)throw new o.ErrnoError(28);o.doTruncate(t,t.node,e)},utime(r,e,t,n=!1){var i=o.lookupPath(r,{follow:!n});o.doSetAttr(null,i.node,{atime:e,mtime:t,dontFollow:n})},open(r,e,t=438){if(r==="")throw new o.ErrnoError(44);e=ht(e),e&64?t=t&4095|32768:t=0;var n,i;if(typeof r=="object")n=r;else{i=r.endsWith("/");var a=o.lookupPath(r,{follow:!(e&131072),noent_okay:!0});n=a.node,r=a.path}var s=!1;if(e&64)if(n){if(e&128)throw new o.ErrnoError(20)}else{if(i)throw new o.ErrnoError(31);n=o.mknod(r,t|511,0),s=!0}if(!n)throw new o.ErrnoError(44);if(o.isChrdev(n.mode)&&(e&=-513),e&65536&&!o.isDir(n.mode))throw new o.ErrnoError(54);if(!s){var l=o.mayOpen(n,e);if(l)throw new o.ErrnoError(l)}e&512&&!s&&o.truncate(n,0),e&=-131713;var u=o.createStream({node:n,path:o.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),s&&o.chmod(n,t&511),u},close(r){if(o.isClosed(r))throw new o.ErrnoError(8);r.getdents&&(r.getdents=null),r.node?.notifyListeners(32);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{o.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(o.isClosed(r))throw new o.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new o.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new o.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,i){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((r.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.read)throw new o.ErrnoError(28);var a=typeof i<"u";if(!a)i=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,i);return a||(r.position+=s),s},write(r,e,t,n,i,a){if(n<0||i<0)throw new o.ErrnoError(28);if(o.isClosed(r))throw new o.ErrnoError(8);if((r.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(r.node.mode))throw new o.ErrnoError(31);if(!r.stream_ops.write)throw new o.ErrnoError(28);r.seekable&&r.flags&1024&&o.llseek(r,0,2);var s=typeof i<"u";if(!s)i=r.position;else if(!r.seekable)throw new o.ErrnoError(70);var l=r.stream_ops.write(r,e,t,n,i,a);return s||(r.position+=l),l},mmap(r,e,t,n,i){if(n&2&&!(i&2)&&(r.flags&2097155)!==2)throw new o.ErrnoError(2);if((r.flags&2097155)===1)throw new o.ErrnoError(2);if(!r.stream_ops.mmap)throw new o.ErrnoError(43);if(!e)throw new o.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,i)},msync(r,e,t,n,i){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,i):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new o.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){e.flags??=0,e.encoding??="binary",e.encoding!=="utf8"&&e.encoding!=="binary"&&z(`Invalid encoding type "${e.encoding}"`);var t=o.open(r,e.flags),n=o.stat(r),i=n.size,a=new Uint8Array(i);return o.read(t,a,0,i,0),e.encoding==="utf8"&&(a=gr(a)),o.close(t),a},writeFile(r,e,t={}){t.flags??=577;var n=o.open(r,t.flags,t.mode);e=Ee(e),o.write(n,e,0,e.byteLength,void 0,t.canOwn),o.close(n)},cwd:()=>o.currentPath,chdir(r){var e=o.lookupPath(r,{follow:!0});if(e.node===null)throw new o.ErrnoError(44);if(!o.isDir(e.node.mode))throw new o.ErrnoError(54);var t=o.nodePermissions(e.node,"x");if(t)throw new o.ErrnoError(t);o.currentPath=e.path},createDefaultDirectories(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:()=>0,write:(n,i,a,s)=>s,llseek:()=>0}),o.mkdev("/dev/null",o.makedev(1,3)),ar.register(o.makedev(5,0),ar.default_tty_ops),ar.register(o.makedev(6,0),ar.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e||(Xr(r),e=r.byteLength),r[--e]);o.createDevice("/dev","random",t),o.createDevice("/dev","urandom",t),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories(){o.mkdir("/proc");var r=o.mkdir("/proc/self");o.mkdir("/proc/self/fd"),o.mount({mount(){var e=o.createNode(r,"fd",16895,73);return e.stream_ops={llseek:w.stream_ops.llseek},e.node_ops={lookup(t,n){var i=+n,a=o.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(o.streams.entries()).filter(([t,n])=>n).map(([t,n])=>t.toString())}},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?o.createDevice("/dev","stdin",r):o.symlink("/dev/tty","/dev/stdin"),e?o.createDevice("/dev","stdout",null,e):o.symlink("/dev/tty","/dev/stdout"),t?o.createDevice("/dev","stderr",null,t):o.symlink("/dev/tty1","/dev/stderr"),o.open("/dev/stdin",0),o.open("/dev/stdout",1),o.open("/dev/stderr",1)},staticInit(){o.nameTable.length=4096,o.mount(w,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories()},init(r,e,t){o.initialized=!0,r??=d.stdin,e??=d.stdout,t??=d.stderr,o.createStandardStreams(r,e,t)},quit(){o.initialized=!1;for(var r of o.streams)r&&o.close(r)},analyzePath(r,e=!1){try{var t=o.lookupPath(r,{follow:!e});r=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{t=o.lookupPath(r,{parent:!0}),n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=C.basename(r),t=o.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(i){n.error=i.errno}return n},createPath(r,e,t,n){r=typeof r=="string"?r:o.getPath(r);for(var i=e.split("/").reverse();i.length;){var a=i.pop();if(a){var s=C.join2(r,a);try{o.mkdir(s)}catch(l){if(l.errno!=20)throw l}r=s}}return s},createFile(r,e,t,n,i){var a=C.join2(typeof r=="string"?r:o.getPath(r),e),s=Zr(n,i);return o.create(a,s)},createDataFile(r,e,t,n,i,a){var s=e;r&&(r=typeof r=="string"?r:o.getPath(r),s=e?C.join2(r,e):r);var l=Zr(n,i),u=o.create(s,l);if(t){t=Ee(t),o.chmod(u,l|146);var f=o.open(u,577);o.write(f,t,0,t.length,0,a),o.close(f),o.chmod(u,l)}},createDevice(r,e,t,n){var i=C.join2(typeof r=="string"?r:o.getPath(r),e),a=Zr(!!t,!!n);o.createDevice.major??=64;var s=o.makedev(o.createDevice.major++,0);return o.registerDevice(s,{open(l){l.seekable=!1},close(l){n?.buffer?.length&&n(10)},read(l,u,f,c,m){for(var v=0,h=0;h<c;h++){var b;try{b=t()}catch{throw new o.ErrnoError(29)}if(b===void 0&&!v)throw new o.ErrnoError(6);if(b==null)break;v++,u[f+h]=b}return v&&(l.node.atime=Date.now()),v},write(l,u,f,c,m){for(var v=0;v<c;v++)try{n(u[f+v])}catch{throw new o.ErrnoError(29)}return c&&(l.node.mtime=l.node.ctime=Date.now()),v}}),o.mkdev(i,a,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(globalThis.XMLHttpRequest)z("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{r.contents=X(r.url)}catch{throw new o.ErrnoError(29)}},createLazyFile(r,e,t,n,i){class a{lengthKnown=!1;chunks=[];get(v){if(!(v>this.length-1||v<0)){var h=v%this.chunkSize,b=v/this.chunkSize|0;return this.getter(b)[h]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;v.open("HEAD",t,!1),v.send(null),v.status>=200&&v.status<300||v.status===304||z(`Couldn't load ${t}. Status: ${v.status}`);var h=Number(v.getResponseHeader("Content-length")),b,$=(b=v.getResponseHeader("Accept-Ranges"))&&b==="bytes",R=(b=v.getResponseHeader("Content-Encoding"))&&b==="gzip",O=1048576;$||(O=h);var B=(q,rr)=>{q>rr&&z(`invalid range (${q}, ${rr}) or no bytes requested!`),rr>h-1&&z(`only ${h} bytes available! programmer error!`);var N=new XMLHttpRequest;return N.open("GET",t,!1),h!==O&&N.setRequestHeader("Range",`bytes=${q}-${rr}`),N.responseType="arraybuffer",N.overrideMimeType&&N.overrideMimeType("text/plain; charset=x-user-defined"),N.send(null),N.status>=200&&N.status<300||N.status===304||z(`Couldn't load ${t}. Status: ${N.status}`),N.response!==void 0?new Uint8Array(N.response||[]):Jr(N.responseText??"")},H=this;H.setDataGetter(q=>{var rr=q*O,N=(q+1)*O-1;return N=Math.min(N,h-1),typeof H.chunks[q]>"u"&&(H.chunks[q]=B(rr,N)),typeof H.chunks[q]>"u"&&z("doXHR failed!"),H.chunks[q]}),(R||!h)&&(O=h=1,h=this.getter(0).length,O=h,Z("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=h,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(globalThis.XMLHttpRequest){I||z("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s=new a,l={isDevice:!1,contents:s}}else l={isDevice:!1,url:t};var u=o.createFile(r,e,l,n,i);l.contents?u.contents=l.contents:l.url&&(u.contents=null,u.url=l.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var f={};for(const[m,v]of Object.entries(u.stream_ops))f[m]=(...h)=>(o.forceLoadFile(u),v(...h));function c(m,v,h,b,$){var R=m.node.contents;if($>=R.length)return 0;var O=Math.min(R.length-$,b);if(R.slice)for(var B=0;B<O;B++)v[h+B]=R[$+B];else for(B=0;B<O;B++)v[h+B]=R.get($+B);return O}return f.read=(m,v,h,b,$)=>(o.forceLoadFile(u),c(m,v,h,b,$)),f.mmap=(m,v,h)=>{o.forceLoadFile(u);var b=_e(v);if(!b)throw new o.ErrnoError(48);return c(m,j,b,v,h),{ptr:b,allocated:!0}},u.stream_ops=f,u}},Pe=(r,e,t)=>(r>>>=0,r?gr(x,r,e,t):""),L,T={currentUmask:18,calculateAt(r,e,t=!1){if(C.isAbs(e))return e;var n;if(r===-100)n=o.cwd();else{var i=T.getStreamFromFD(r);n=i.path}if(e.length==0){if(!t)throw new o.ErrnoError(44);return n}return n+"/"+e},writeStat(r,e){y[r>>>2>>>0]=e.dev,y[r+4>>>2>>>0]=e.mode,y[r+8>>>2>>>0]=e.nlink,y[r+12>>>2>>>0]=e.uid,y[r+16>>>2>>>0]=e.gid,y[r+20>>>2>>>0]=e.rdev,L[r+24>>>3>>>0]=BigInt(e.size),F[r+32>>>2>>>0]=4096,F[r+36>>>2>>>0]=e.blocks;var t=e.atime.getTime(),n=e.mtime.getTime(),i=e.ctime.getTime();return L[r+40>>>3>>>0]=BigInt(Math.floor(t/1e3)),y[r+48>>>2>>>0]=t%1e3*1e3*1e3,L[r+56>>>3>>>0]=BigInt(Math.floor(n/1e3)),y[r+64>>>2>>>0]=n%1e3*1e3*1e3,L[r+72>>>3>>>0]=BigInt(Math.floor(i/1e3)),y[r+80>>>2>>>0]=i%1e3*1e3*1e3,L[r+88>>>3>>>0]=BigInt(e.ino),0},writeStatFs(r,e){y[r+4>>>2>>>0]=e.bsize,y[r+60>>>2>>>0]=e.bsize,L[r+8>>>3>>>0]=BigInt(e.blocks),L[r+16>>>3>>>0]=BigInt(e.bfree),L[r+24>>>3>>>0]=BigInt(e.bavail),L[r+32>>>3>>>0]=BigInt(e.files),L[r+40>>>3>>>0]=BigInt(e.ffree),y[r+48>>>2>>>0]=e.fsid,y[r+64>>>2>>>0]=e.flags,y[r+56>>>2>>>0]=e.namelen},doMsync(r,e,t,n,i){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);if(n&2)return 0;var a=x.subarray(r>>>0,r+t>>>0);o.msync(e,a,i,t,n)},getStreamFromFD(r){var e=o.getStreamChecked(r);return e},varargs:void 0,getStr(r){var e=Pe(r);return e}},Br=r=>r<-9007199254740992||r>9007199254740992?NaN:Number(r),lr,W=r=>{r>>>=0;for(var e="";;){var t=x[r++>>>0];if(!t)return e;e+=String.fromCharCode(t)}},wr={},ur={},Ur={};class Cr extends Error{constructor(e){super(e),this.name="BindingError"}}var S=r=>{throw new Cr(r)};function Et(r,e,t={}){var n=e.name;if(r||S(`type "${n}" must have a positive integer typeid pointer`),ur.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;S(`Cannot register type '${n}' twice`)}if(ur[r]=e,delete Ur[r],wr.hasOwnProperty(r)){var i=wr[r];delete wr[r],i.forEach(a=>a())}}function Y(r,e,t={}){return Et(r,e,t)}var Fr,Ce,Fe=(r,e,t)=>{switch(e){case 1:return t?n=>j[n>>>0]:n=>x[n>>>0];case 2:return t?n=>lr[n>>>1>>>0]:n=>Fr[n>>>1>>>0];case 4:return t?n=>F[n>>>2>>>0]:n=>y[n>>>2>>>0];case 8:return t?n=>L[n>>>3>>>0]:n=>Ce[n>>>3>>>0];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},kt=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),Qr=r=>{S((function(e){return e.$$.ptrType.registeredClass.name})(r)+" instance already deleted")},re=!1,Te=()=>{},St=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},Ae=r=>{r.count.value-=1;var e=r.count.value===0;e&&St(r)},Tr=r=>globalThis.FinalizationRegistry?(re=new FinalizationRegistry(e=>{Ae(e.$$)}),Tr=e=>{var t=e.$$,n=!!t.smartPtr;if(n){var i={$$:t};re.register(e,i,e)}return e},Te=e=>re.unregister(e),Tr(r)):(Tr=e=>e,r);function Wr(){}var ee=(r,e)=>Object.defineProperty(e,"name",{value:r}),De={},Re=(r,e,t)=>{if(r[e].overloadTable===void 0){var n=r[e];r[e]=function(...i){return r[e].overloadTable.hasOwnProperty(i.length)||S(`Function '${t}' called with an invalid number of arguments (${i.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[i.length].apply(this,i)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},Ne=(r,e,t)=>{d.hasOwnProperty(r)?((t===void 0||d[r].overloadTable!==void 0&&d[r].overloadTable[t]!==void 0)&&S(`Cannot register public name '${r}' twice`),Re(d,r,r),d[r].overloadTable.hasOwnProperty(t)&&S(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),d[r].overloadTable[t]=e):(d[r]=e,d[r].argCount=t)},$t=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var e=r.charCodeAt(0);return e>=48&&e<=57?`_${r}`:r};function Pt(r,e,t,n,i,a,s,l){this.name=r,this.constructor=e,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=s,this.downcast=l,this.pureVirtualFunctions=[]}var te=(r,e,t)=>{for(;e!==t;)e.upcast||S(`Expected null or instance of ${t.name}, got an instance of ${e.name}`),r=e.upcast(r),e=e.baseClass;return r},ne=r=>{if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r};function Ct(r,e){if(e===null)return this.isReference&&S(`null is not a valid ${this.name}`),0;e.$$||S(`Cannot pass "${ne(e)}" as a ${this.name}`),e.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=e.$$.ptrType.registeredClass,n=te(e.$$.ptr,t,this.registeredClass);return n}function Ft(r,e){var t;if(e===null)return this.isReference&&S(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,t),t):0;(!e||!e.$$)&&S(`Cannot pass "${ne(e)}" as a ${this.name}`),e.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&S(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var n=e.$$.ptrType.registeredClass;if(t=te(e.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&S("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?t=e.$$.smartPtr:S(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)t=e.$$.smartPtr;else{var i=e.clone();t=this.rawShare(t,A.toHandle(()=>i.delete())),r!==null&&r.push(this.rawDestructor,t)}break;default:S("Unsupported sharing policy")}return t}function Tt(r,e){if(e===null)return this.isReference&&S(`null is not a valid ${this.name}`),0;e.$$||S(`Cannot pass "${ne(e)}" as a ${this.name}`),e.$$.ptr||S(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&S(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var t=e.$$.ptrType.registeredClass,n=te(e.$$.ptr,t,this.registeredClass);return n}function Hr(r){return this.fromWireType(y[r>>>2>>>0])}var Oe=(r,e,t)=>{if(e===t)return r;if(t.baseClass===void 0)return null;var n=Oe(r,e,t.baseClass);return n===null?null:t.downcast(n)},At={},Dt=(r,e)=>{for(e===void 0&&S("ptr should not be undefined");r.baseClass;)e=r.upcast(e),r=r.baseClass;return e},Rt=(r,e)=>(e=Dt(r,e),At[e]);class Nt extends Error{constructor(e){super(e),this.name="InternalError"}}var Ir=r=>{throw new Nt(r)},zr=(r,e)=>{(!e.ptrType||!e.ptr)&&Ir("makeClassHandle requires ptr and ptrType");var t=!!e.smartPtrType,n=!!e.smartPtr;return t!==n&&Ir("Both smartPtrType and smartPtr must be specified"),e.count={value:1},Tr(Object.create(r,{$$:{value:e,writable:!0}}))};function Ot(r){var e=this.getPointee(r);if(!e)return this.destructor(r),null;var t=Rt(this.registeredClass,e);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=e,t.$$.smartPtr=r,t.clone();var n=t.clone();return this.destructor(r),n}function i(){return this.isSmartPointer?zr(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:r}):zr(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var a=this.registeredClass.getActualType(e),s=De[a];if(!s)return i.call(this);var l;this.isConst?l=s.constPointerType:l=s.pointerType;var u=Oe(e,this.registeredClass,l.registeredClass);return u===null?i.call(this):this.isSmartPointer?zr(l.registeredClass.instancePrototype,{ptrType:l,ptr:u,smartPtrType:this,smartPtr:r}):zr(l.registeredClass.instancePrototype,{ptrType:l,ptr:u})}function Lr(r,e,t,n,i,a,s,l,u,f,c){this.name=r,this.registeredClass=e,this.isReference=t,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=s,this.rawGetPointee=l,this.rawConstructor=u,this.rawShare=f,this.rawDestructor=c,!i&&e.baseClass===void 0?n?(this.toWireType=Ct,this.destructorFunction=null):(this.toWireType=Tt,this.destructorFunction=null):this.toWireType=Ft}var Me=(r,e,t)=>{d.hasOwnProperty(r)||Ir("Replacing nonexistent public symbol"),d[r].overloadTable!==void 0&&t!==void 0?d[r].overloadTable[t]=e:(d[r]=e,d[r].argCount=t)},Be=[],Ue=r=>{var e=Be[r];return e||(Be[r]=e=tt.get(r)),e},Mt=(r,e,t=[])=>{var n=Ue(e),i=n(...t);return(function(a){return r[0]=="p"?a>>>0:a})(i)},Bt=(r,e)=>(...t)=>Mt(r,e,t),fr=(r,e)=>{r=W(r);var t=(function(){if(r.includes("p"))return Bt(r,e);var n=Ue(e);return n})();return typeof t!="function"&&S(`unknown function pointer with signature ${r}: ${e}`),t};class Ut extends Error{}var We=r=>{var e=Ye(r),t=W(e);return nr(e),t},Vr=(r,e)=>{var t=[],n={};throw e.forEach(function i(a){if(!n[a]&&!ur[a]){if(Ur[a]){Ur[a].forEach(i);return}t.push(a),n[a]=!0}}),new Ut(`${r}: `+t.map(We).join([", "]))},cr=(r,e,t)=>{r.forEach(l=>Ur[l]=e);function n(l){var u=t(l);u.length!==r.length&&Ir("Mismatched type converter count");for(var f=0;f<r.length;++f)Y(r[f],u[f])}var i=new Array(e.length),a=[],s=0;for(let[l,u]of e.entries())ur.hasOwnProperty(u)?i[l]=ur[u]:(a.push(u),wr.hasOwnProperty(u)||(wr[u]=[]),wr[u].push(()=>{i[l]=ur[u],++s,s===a.length&&n(i)}));a.length===0&&n(i)},oe=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(y[e+n*4>>>2>>>0]);return t},He=r=>{for(;r.length;){var e=r.pop(),t=r.pop();t(e)}};function Ie(r){for(var e=1;e<r.length;++e)if(r[e]!==null&&r[e].destructorFunction===void 0)return!0;return!1}function ze(r){for(var e=1;e<r.length;++e)if(r[e]!==null&&r[e].argStackAlloc)return!0;return!1}var Wt=()=>et(),Ht=r=>rt(r);function It(r,e,t,n){var i=Ie(r),a=ze(r),s=a&&!n&&!i;a&&!s&&(i=!0);var l=r.length-2,u=[],f=["fn"];e&&f.push("thisWired");for(var c=0;c<l;++c)u.push(`arg${c}`),f.push(`arg${c}Wired`);u=u.join(),f=f.join();var m=`return function (${u}) {
|
|
3
|
+
`;i&&(m+=`var destructors = [];
|
|
4
|
+
`),s&&(m+=`var sp = stackSave();
|
|
5
|
+
try {
|
|
6
|
+
`);var v=i?"destructors":"null",h=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(s&&h.push("stackSave","stackRestore"),e&&(m+=`var thisWired = toClassParamWire(${v}, this);
|
|
7
|
+
`),c=0;c<l;++c){var b=`toArg${c}Wire`;m+=`var arg${c}Wired = ${b}(${v}, arg${c});
|
|
8
|
+
`,h.push(b)}if(m+=(t||n?"var rv = ":"")+`invoker(${f});
|
|
9
|
+
`,s&&(m+=`} finally {
|
|
10
|
+
stackRestore(sp);
|
|
11
|
+
}
|
|
12
|
+
`),i)m+=`runDestructors(destructors);
|
|
13
|
+
`;else for(c=e?1:2;c<r.length;++c){var $=c===1?"thisWired":`arg${c-2}Wired`;r[c].destructorFunction!==null&&(m+=`${$}_dtor(${$});
|
|
14
|
+
`,h.push(`${$}_dtor`))}return t&&(m+=`var ret = fromRetWire(rv);
|
|
15
|
+
return ret;
|
|
16
|
+
`),m+=`}
|
|
17
|
+
`,new Function(h,m)}function ie(r,e,t,n,i,a){var s=e.length;s<2&&S("argTypes array size mismatch! Must at least get return value and receiver (this) types!");var l=e[1]!==null&&t!==null,u=Ie(e),f=ze(e),c=f&&!a&&!u;f&&!c&&(u=!0);var m=!e[0].isVoid,v=e[0],h=e[1],b=[r,S,n,i,He,v.fromWireType.bind(v),h?.toWireType.bind(h)];c&&b.push(Wt,Ht);for(var $=2;$<s;++$){var R=e[$];b.push(R.toWireType.bind(R))}if(!u)for($=l?1:2;$<e.length;++$)e[$].destructorFunction!==null&&b.push(e[$].destructorFunction);var B=It(e,l,m,a)(...b);return ee(r,B)}var Le=r=>{r=r.trim();const e=r.indexOf("(");return e===-1?r:r.slice(0,e)},Ve=[],tr=[0,1,,1,null,1,!0,1,!1,1],je=[];function ae(r){if(r>>>=0,r>9&&--tr[r+1]===0){var e=tr[r];tr[r]=void 0;var t=je[r];t&&(je[r]=void 0,t(e)),Ve.push(r)}}var A={toValue:r=>(r||S(`Cannot use deleted val. handle = ${r}`),tr[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=Ve.pop()||tr.length;return tr[e]=r,tr[e+1]=1,e}}}},xe={name:"emscripten::val",fromWireType:r=>{var e=A.toValue(r);return ae(r),e},toWireType:(r,e)=>A.toHandle(e),readValueFromPointer:Hr,destructorFunction:null},qe,Ke,zt=(r,e)=>{switch(e){case 4:return function(t){return this.fromWireType(qe[t>>>2>>>0])};case 8:return function(t){return this.fromWireType(Ke[t>>>3>>>0])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Lt=(r,e,t)=>{const n=(i,a)=>{let s=0;return{next(){if(s>=i)return{done:!0};const l=s;return s++,{value:a(l),done:!1}},[Symbol.iterator](){return this}}};r[Symbol.iterator]||(r[Symbol.iterator]=function(){const i=this[e]();return n(i,a=>this[t](a))})},Vt=Object.assign({optional:!0},xe),br=(r,e,t)=>we(r,x,e,t),Xe=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,jt=(r,e,t)=>{var n=r>>>1,i=ge(Fr,n,e/2,t);if(i-n>16&&Xe)return Xe.decode(Fr.subarray(n>>>0,i>>>0));for(var a="",s=n;s<i;++s){var l=Fr[s>>>0];a+=String.fromCharCode(l)}return a},xt=(r,e,t=2147483647)=>{if(t<2)return 0;t-=2;for(var n=e,i=t<r.length*2?t/2:r.length,a=0;a<i;++a){var s=r.charCodeAt(a);lr[e>>>1>>>0]=s,e+=2}return lr[e>>>1>>>0]=0,e-n},qt=r=>r.length*2,Kt=(r,e,t)=>{for(var n="",i=r>>>2,a=0;!(a>=e/4);a++){var s=y[i+a>>>0];if(!s&&!t)break;n+=String.fromCodePoint(s)}return n},Xt=(r,e,t=2147483647)=>{if(e>>>=0,t<4)return 0;for(var n=e,i=n+t-4,a=0;a<r.length;++a){var s=r.codePointAt(a);if(s>65535&&a++,F[e>>>2>>>0]=s,e+=4,e+4>i)break}return F[e>>>2>>>0]=0,e-n},Gt=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.codePointAt(t);n>65535&&t++,e+=4}return e},se=[],Yt=r=>{var e=se.length;return se.push(r),e},Jt=(r,e)=>{var t=ur[r];return t===void 0&&S(`${e} has unknown type ${We(r)}`),t},Zt=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=Jt(y[e+n*4>>>2>>>0],`parameter ${n}`);return t},Qt=(r,e,t)=>{var n=[],i=r(n,t);return n.length&&(y[e>>>2>>>0]=A.toHandle(n)),i},rn={},jr=r=>{var e=rn[r];return e===void 0?W(r):e},en=r=>r%4===0&&(r%100!==0||r%400===0),tn=[0,31,60,91,121,152,182,213,244,274,305,335],nn=[0,31,59,90,120,151,181,212,243,273,304,334],on=r=>{var e=en(r.getFullYear()),t=e?tn:nn,n=t[r.getMonth()]+r.getDate()-1;return n},an=()=>performance.now(),Ge=()=>Date.now(),sn=r=>r>=0&&r<=3,ln=()=>4294901760,un=r=>{var e=xr.buffer.byteLength,t=(r-e+65535)/65536|0;try{return xr.grow(t),Sr(),1}catch{}},le={},fn=()=>M,Ar=()=>{if(!Ar.strings){var r=(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:fn()};for(var t in le)le[t]===void 0?delete e[t]:e[t]=le[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Ar.strings=n}return Ar.strings},cn=(r,e,t,n)=>{for(var i=0,a=0;a<t;a++){var s=y[e>>>2>>>0],l=y[e+4>>>2>>>0];e+=8;try{var u=o.read(r,j,s,l,n)}catch(f){if(i>0&&f instanceof o.ErrnoError&&(f.errno==6||f.errno==6))break;throw f}if(u<0)return-1;if(i+=u,u<l)break}return i},dn=(r,e,t,n)=>{if(t==1)return o.write(r,j,y[e>>>2>>>0],y[e+4>>>2>>>0],n);for(var i=0,a=0,s=e;a<t;a++,s+=8)i+=y[s+4>>>2>>>0];var l=new Uint8Array(i),u=0;for(a=0;a<t;a++,e+=8){var f=y[e>>>2>>>0],c=y[e+4>>>2>>>0];l.set(x.subarray(f>>>0,f+c>>>0),u),u+=c}return o.write(r,l,0,i,n)};o.createPreloadedFile=(r,e,t,n,i,a,s,l,u,f)=>{$e(r,e,t,n,i,l,u,f).then(a).catch(s)},o.preloadFile=$e,o.staticInit(),(()=>{let r=Wr.prototype;Object.assign(r,{isAliasOf(t){if(!(this instanceof Wr)||!(t instanceof Wr))return!1;var n=this.$$.ptrType.registeredClass,i=this.$$.ptr;t.$$=t.$$;for(var a=t.$$.ptrType.registeredClass,s=t.$$.ptr;n.baseClass;)i=n.upcast(i),n=n.baseClass;for(;a.baseClass;)s=a.upcast(s),a=a.baseClass;return n===a&&i===s},clone(){if(this.$$.ptr||Qr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=Tr(Object.create(Object.getPrototypeOf(this),{$$:{value:kt(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||Qr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),Te(this),Ae(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Qr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const e=Symbol.dispose;e&&(r[e]=r.delete)})(),Object.assign(Lr.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:Hr,fromWireType:Ot}),d.noExitRuntime&&d.noExitRuntime,d.print&&(Z=d.print),d.printErr&&(G=d.printErr),d.arguments&&d.arguments,d.thisProgram&&(M=d.thisProgram);var _r=d.preInit;if(_r)for(typeof _r=="function"&&(d.preInit=_r=[_r]);_r.length>0;)_r.shift()();var Ye,ue,nr,Je,fe,Ze,Qe,rt,et,xr,tt;function vn(r){Ye=r.Z,ue=r.$,nr=r.aa,Je=r.ba,fe=r.ca,Ze=r.da,Qe=r.ea,rt=r.fa,et=r.ga,xr=r.X,tt=r._}var hn={q:function(r,e,t){t>>>=0,T.varargs=t;try{var n=T.getStreamFromFD(r);switch(e){case 0:var i=Mr();if(i<0)return-28;for(;o.streams[i];)i++;var a;return a=o.dupStream(n,i),a.fd;case 1:case 2:return 0;case 3:return n.flags;case 4:return i=Mr(),n.flags=n.flags&-289793|i&289792,0;case 12:return i=pr(),lr[i+0>>>1>>>0]=2,0;case 13:case 14:return 0}return-28}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return-s.errno}},Q:function(r,e){e>>>=0;try{return T.writeStat(e,o.fstat(r))}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return-t.errno}},R:function(r,e,t){t>>>=0,T.varargs=t;try{var n=T.getStreamFromFD(r);switch(e){case 21509:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var i=n.tty.ops.ioctl_tcgets(n),a=pr();F[a>>>2>>>0]=i.c_iflag||0,F[a+4>>>2>>>0]=i.c_oflag||0,F[a+8>>>2>>>0]=i.c_cflag||0,F[a+12>>>2>>>0]=i.c_lflag||0;for(var s=0;s<32;s++)j[a+s+17>>>0]=i.c_cc[s]||0;return 0}return 0;case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){a=pr();var l=F[a>>>2>>>0],u=F[a+4>>>2>>>0],f=F[a+8>>>2>>>0],c=F[a+12>>>2>>>0],m=[];for(s=0;s<32;s++)m.push(j[a+s+17>>>0]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:l,c_oflag:u,c_cflag:f,c_lflag:c,c_cc:m})}return 0;case 21519:return n.tty?(a=pr(),F[a>>>2>>>0]=0,0):-59;case 21520:return n.tty?-28:-59;case 21537:case 21531:return a=pr(),o.ioctl(n,e,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var v=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=pr(),lr[a>>>1>>>0]=v[0],lr[a+2>>>1>>>0]=v[1]}return 0;case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(h){if(typeof o>"u"||h.name!=="ErrnoError")throw h;return-h.errno}},P:function(r,e,t,n){e>>>=0,t>>>=0;try{e=T.getStr(e);var i=n&256,a=n&4096;return n&=-6401,e=T.calculateAt(r,e,a),T.writeStat(t,i?o.lstat(e):o.stat(e))}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return-s.errno}},B:function(r,e,t,n){e>>>=0,n>>>=0,T.varargs=n;try{e=T.getStr(e),e=T.calculateAt(r,e);var i=n?Mr():0;return t&64&&(i&=~T.currentUmask),o.open(e,t,i).fd}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return-a.errno}},H:()=>z(""),E:function(r,e,t,n,i){r>>>=0,e>>>=0,t>>>=0,e=W(e);const a=n===0n;let s=l=>l;if(a){const l=t*8;s=u=>BigInt.asUintN(l,u),i=s(i)}Y(r,{name:e,fromWireType:s,toWireType:(l,u)=>(typeof u=="number"&&(u=BigInt(u)),u),readValueFromPointer:Fe(e,t,!a),destructorFunction:null})},V:function(r,e,t,n){r>>>=0,e>>>=0,e=W(e),Y(r,{name:e,fromWireType:function(i){return!!i},toWireType:function(i,a){return a?t:n},readValueFromPointer:function(i){return this.fromWireType(x[i>>>0])},destructorFunction:null})},l:function(r,e,t,n,i,a,s,l,u,f,c,m,v){r>>>=0,e>>>=0,t>>>=0,n>>>=0,i>>>=0,a>>>=0,s>>>=0,l>>>=0,u>>>=0,f>>>=0,c>>>=0,m>>>=0,v>>>=0,c=W(c),a=fr(i,a),l&&=fr(s,l),f&&=fr(u,f),v=fr(m,v);var h=$t(c);Ne(h,function(){Vr(`Cannot construct ${c} due to unbound types`,[n])}),cr([r,e,t],n?[n]:[],b=>{b=b[0];var $,R;n?($=b.registeredClass,R=$.instancePrototype):R=Wr.prototype;var O=ee(c,function(...ce){if(Object.getPrototypeOf(this)!==B)throw new Cr(`Use 'new' to construct ${c}`);if(H.constructor_body===void 0)throw new Cr(`${c} has no accessible constructor`);var nt=H.constructor_body[ce.length];if(nt===void 0)throw new Cr(`Tried to invoke ctor of ${c} with invalid number of parameters (${ce.length}) - expected (${Object.keys(H.constructor_body).toString()}) parameters instead!`);return nt.apply(this,ce)}),B=Object.create(R,{constructor:{value:O}});O.prototype=B;var H=new Pt(c,O,B,v,$,a,l,f);H.baseClass&&(H.baseClass.__derivedClasses??=[],H.baseClass.__derivedClasses.push(H));var q=new Lr(c,H,!0,!1,!1),rr=new Lr(c+"*",H,!1,!1,!1),N=new Lr(c+" const*",H,!1,!0,!1);return De[r]={pointerType:rr,constPointerType:N},Me(h,O),[q,rr,N]})},o:function(r,e,t,n,i,a){r>>>=0,t>>>=0,n>>>=0,i>>>=0,a>>>=0;var s=oe(e,t);i=fr(n,i),cr([],[r],l=>{l=l[0];var u=`constructor ${l.name}`;if(l.registeredClass.constructor_body===void 0&&(l.registeredClass.constructor_body=[]),l.registeredClass.constructor_body[e-1]!==void 0)throw new Cr(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${l.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return l.registeredClass.constructor_body[e-1]=()=>{Vr(`Cannot construct ${l.name} due to unbound types`,s)},cr([],s,f=>(f.splice(1,0,null),l.registeredClass.constructor_body[e-1]=ie(u,f,null,i,a),[])),[]})},a:function(r,e,t,n,i,a,s,l,u){r>>>=0,e>>>=0,n>>>=0,i>>>=0,a>>>=0,s>>>=0;var f=oe(t,n);e=W(e),e=Le(e),a=fr(i,a),cr([],[r],c=>{c=c[0];var m=`${c.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),l&&c.registeredClass.pureVirtualFunctions.push(e);function v(){Vr(`Cannot call ${m} due to unbound types`,f)}var h=c.registeredClass.instancePrototype,b=h[e];return b===void 0||b.overloadTable===void 0&&b.className!==c.name&&b.argCount===t-2?(v.argCount=t-2,v.className=c.name,h[e]=v):(Re(h,e,m),h[e].overloadTable[t-2]=v),cr([],f,$=>{var R=ie(m,$,c,a,s,u);return h[e].overloadTable===void 0?(R.argCount=t-2,h[e]=R):h[e].overloadTable[t-2]=R,[]}),[]})},T:function(r){return r>>>=0,Y(r,xe)},D:function(r,e,t){r>>>=0,e>>>=0,t>>>=0,e=W(e),Y(r,{name:e,fromWireType:n=>n,toWireType:(n,i)=>i,readValueFromPointer:zt(e,t),destructorFunction:null})},f:function(r,e,t,n,i,a,s){r>>>=0,t>>>=0,n>>>=0,i>>>=0,a>>>=0;var l=oe(e,t);r=W(r),r=Le(r),i=fr(n,i),Ne(r,function(){Vr(`Cannot call ${r} due to unbound types`,l)},e-1),cr([],l,u=>{var f=[u[0],null].concat(u.slice(1));return Me(r,ie(r,f,null,i,a,s),e-1),[]})},k:function(r,e,t,n,i){r>>>=0,e>>>=0,t>>>=0,e=W(e);const a=n===0;let s=u=>u;if(a){var l=32-8*t;s=u=>u<<l>>>l,i=s(i)}Y(r,{name:e,fromWireType:s,toWireType:(u,f)=>f,readValueFromPointer:Fe(e,t,n!==0),destructorFunction:null})},x:function(r,e,t,n){r>>>=0,e>>>=0,t>>>=0,n>>>=0,t=W(t),n=W(n),cr([],[r,e],i=>{const a=i[0];return Lt(a.registeredClass.instancePrototype,t,n),[]})},h:function(r,e,t){r>>>=0,t>>>=0;var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],i=n[e];function a(s){var l=y[s>>>2>>>0],u=y[s+4>>>2>>>0];return new i(j.buffer,u,l)}t=W(t),Y(r,{name:t,fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},y:function(r,e){r>>>=0,Y(r,Vt)},U:function(r,e){r>>>=0,e>>>=0,e=W(e),Y(r,{name:e,fromWireType(t){var n=y[t>>>2>>>0],i=t+4,a;return a=Pe(i,n,!0),nr(t),a},toWireType(t,n){n instanceof ArrayBuffer&&(n=new Uint8Array(n));var i,a=typeof n=="string";a||ArrayBuffer.isView(n)&&n.BYTES_PER_ELEMENT==1||S("Cannot pass non-string to std::string"),a?i=Yr(n):i=n.length;var s=ue(4+i+1),l=s+4;return y[s>>>2>>>0]=i,a?br(n,l,i+1):x.set(n,l>>>0),t!==null&&t.push(nr,s),s},readValueFromPointer:Hr,destructorFunction(t){nr(t)}})},s:function(r,e,t){r>>>=0,e>>>=0,t>>>=0,t=W(t);var n,i,a;e===2?(n=jt,i=xt,a=qt):(n=Kt,i=Xt,a=Gt),Y(r,{name:t,fromWireType:s=>{var l=y[s>>>2>>>0],u=n(s+4,l*e,!0);return nr(s),u},toWireType:(s,l)=>{typeof l!="string"&&S(`Cannot pass non-string to C++ string type ${t}`);var u=a(l),f=ue(4+u+e);return y[f>>>2>>>0]=u/e,i(l,f+4,u+e),s!==null&&s.push(nr,f),f},readValueFromPointer:Hr,destructorFunction(s){nr(s)}})},W:function(r,e){r>>>=0,e>>>=0,e=W(e),Y(r,{isVoid:!0,name:e,fromWireType:()=>{},toWireType:()=>{}})},d:function(r,e,t){e>>>=0;var[n,...i]=Zt(r,e),a=n.toWireType.bind(n),s=i.map(v=>v.readValueFromPointer.bind(v));r--;var l={toValue:A.toValue},u=s.map((v,h)=>{var b=`argFromPtr${h}`;return l[b]=v,`${b}(args${h?"+"+h*8:""})`}),f;switch(t){case 0:f="toValue(handle)";break;case 2:f="new (toValue(handle))";break;case 3:f="";break;case 1:l.getStringOrSymbol=jr,f="toValue(handle)[getStringOrSymbol(methodName)]";break}f+=`(${u})`,n.isVoid||(l.toReturnWire=a,l.emval_returnValue=Qt,f=`return emval_returnValue(toReturnWire, destructorsRef, ${f})`),f=`return function (handle, methodName, destructorsRef, args) {
|
|
18
|
+
${f}
|
|
19
|
+
}`;var c=new Function(Object.keys(l),f)(...Object.values(l)),m=`methodCaller<(${i.map(v=>v.name)}) => ${n.name}>`;return Yt(ee(m,c))},b:ae,u:function(r){return r>>>=0,r?(r=jr(r),A.toHandle(globalThis[r])):A.toHandle(globalThis)},t:function(r){return r>>>=0,r=jr(r),A.toHandle(d[r])},j:function(r,e){return r>>>=0,e>>>=0,r=A.toValue(r),e=A.toValue(e),A.toHandle(r[e])},g:function(r){r>>>=0,r>9&&(tr[r+1]+=1)},n:function(r,e){return r>>>=0,e>>>=0,r=A.toValue(r),e=A.toValue(e),r instanceof e},e:function(r,e,t,n,i){return r>>>=0,e>>>=0,t>>>=0,n>>>=0,i>>>=0,se[r](e,t,n,i)},v:function(){return A.toHandle([])},i:function(r){return r>>>=0,A.toHandle(jr(r))},p:function(){return A.toHandle({})},c:function(r){r>>>=0;var e=A.toValue(r);He(e),ae(r)},m:function(r,e,t){r>>>=0,e>>>=0,t>>>=0,r=A.toValue(r),e=A.toValue(e),t=A.toValue(t),r[e]=t},w:function(r){return r>>>=0,r=A.toValue(r),A.toHandle(typeof r)},K:function(r,e){r=Br(r),e>>>=0;var t=new Date(r*1e3);if(isNaN(t.getTime()))return 1;F[e>>>2>>>0]=t.getSeconds(),F[e+4>>>2>>>0]=t.getMinutes(),F[e+8>>>2>>>0]=t.getHours(),F[e+12>>>2>>>0]=t.getDate(),F[e+16>>>2>>>0]=t.getMonth(),F[e+20>>>2>>>0]=t.getFullYear()-1900,F[e+24>>>2>>>0]=t.getDay();var n=on(t)|0;F[e+28>>>2>>>0]=n,F[e+36>>>2>>>0]=-t.getTimezoneOffset()*60;var i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),l=(a!=s&&t.getTimezoneOffset()==Math.min(s,a))|0;return F[e+32>>>2>>>0]=l,0},I:function(r,e,t,n,i,a,s){r>>>=0,i=Br(i),a>>>=0,s>>>=0;try{var l=T.getStreamFromFD(n),u=o.mmap(l,r,i,e,t),f=u.ptr;return F[a>>>2>>>0]=u.allocated,y[s>>>2>>>0]=f,0}catch(c){if(typeof o>"u"||c.name!=="ErrnoError")throw c;return-c.errno}},J:function(r,e,t,n,i,a){r>>>=0,e>>>=0,a=Br(a);try{var s=T.getStreamFromFD(i);t&2&&T.doMsync(r,s,e,n,a)}catch(l){if(typeof o>"u"||l.name!=="ErrnoError")throw l;return-l.errno}},L:function(r,e,t,n){r>>>=0,e>>>=0,t>>>=0,n>>>=0;var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),l=a.getTimezoneOffset(),u=s.getTimezoneOffset(),f=Math.max(l,u);y[r>>>2>>>0]=f*60,F[e>>>2>>>0]=+(l!=u);var c=h=>{var b=h>=0?"-":"+",$=Math.abs(h),R=String(Math.floor($/60)).padStart(2,"0"),O=String($%60).padStart(2,"0");return`UTC${b}${R}${O}`},m=c(l),v=c(u);u<l?(br(m,t,17),br(v,n,17)):(br(m,n,17),br(v,t,17))},S:function(r,e,t){if(t>>>=0,!sn(r))return 28;var n;r===0?n=Ge():n=an();var i=Math.round(n*1e6);return L[t>>>3>>>0]=BigInt(i),0},C:Ge,G:function(r){r>>>=0;var e=x.length,t=ln();if(r>t)return!1;for(var n=1;n<=4;n*=2){var i=e*(1+.2/n);i=Math.min(i,r+100663296);var a=Math.min(t,be(Math.max(r,i),65536)),s=un(a);if(s)return!0}return!1},N:function(r,e){r>>>=0,e>>>=0;var t=0,n=0;for(var i of Ar()){var a=e+t;y[r+n>>>2>>>0]=a,t+=br(i,a,1/0)+1,n+=4}return 0},O:function(r,e){r>>>=0,e>>>=0;var t=Ar();y[r>>>2>>>0]=t.length;var n=0;for(var i of t)n+=Yr(i)+1;return y[e>>>2>>>0]=n,0},r:function(r){try{var e=T.getStreamFromFD(r);return o.close(e),0}catch(t){if(typeof o>"u"||t.name!=="ErrnoError")throw t;return t.errno}},z:function(r,e,t,n){e>>>=0,t>>>=0,n>>>=0;try{var i=T.getStreamFromFD(r),a=cn(i,e,t);return y[n>>>2>>>0]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}},M:function(r,e,t,n){e=Br(e),n>>>=0;try{if(isNaN(e))return 22;var i=T.getStreamFromFD(r);return o.llseek(i,e,t),L[n>>>3>>>0]=BigInt(i.position),i.getdents&&!e&&t===0&&(i.getdents=null),0}catch(a){if(typeof o>"u"||a.name!=="ErrnoError")throw a;return a.errno}},A:function(r,e,t,n){e>>>=0,t>>>=0,n>>>=0;try{var i=T.getStreamFromFD(r),a=dn(i,e,t);return y[n>>>2>>>0]=a,0}catch(s){if(typeof o>"u"||s.name!=="ErrnoError")throw s;return s.errno}},F:function(r,e){return r>>>=0,e>>>=0,Xr(x.subarray(r>>>0,r+e>>>0))}};function mn(r){r=Object.assign({},r);var e=n=>i=>n(i)>>>0,t=n=>()=>n()>>>0;return r.Z=e(r.Z),r.$=e(r.$),r.ba=(n=>(i,a)=>n(i,a)>>>0)(r.ba),r.ca=t(r.ca),r.emscripten_stack_get_base=t(r.emscripten_stack_get_base),r.emscripten_stack_get_free=t(r.emscripten_stack_get_free),r._emscripten_stack_alloc=e(r._emscripten_stack_alloc),r.ga=t(r.ga),r}function pn(){Qe(),hr()}var dr;return dr=await(async function(){function r(a){return dr=a.exports,dr=mn(dr),vn(dr),Sr(),dr}var e=ut(),t=d.instantiateWasm;if(t)return new Promise(a=>{t(e,s=>a(r(s)))});Or??=V();var n=await lt(void 0,Or,e),i=(function(a){return r(a.instance)})(n);return i})(),await(async function(){pn(),$r(),sr&&await yt();var r=d.setStatus;r&&(r("Running..."),await new Promise(e=>setTimeout(e,1)),setTimeout(r,1,"")),!Er&&(Nr(),d.onRuntimeInitialized?.(),ir())})(),d}})();p.exports=_,p.exports.default=_})(de)),de.exports}var En=_n(),kn=yn(En);const Sn=[{id:"PAINS-rhodanine",family:"PAINS",label:"Rhodanine / ene-rhodanine motif",smarts:"O=C1NC(=S)SC1"},{id:"PAINS-catechol",family:"PAINS",label:"Catechol redox motif",smarts:"Oc1c(O)cccc1"},{id:"PAINS-quinone",family:"PAINS",label:"Para/ortho-quinone redox motif",smarts:"O=C1C=CC(=O)C=C1"},{id:"PAINS-ene-one",family:"PAINS",label:"Michael acceptor (alpha,beta-unsaturated carbonyl)",smarts:"[#6]=[#6]-[C](=O)-[#6,#7,#8]"},{id:"PAINS-azo",family:"PAINS",label:"Azo / diazo chromophore",smarts:"[#6]-N=N-[#6]"},{id:"Brenk-nitro",family:"Brenk",label:"Nitro group (potential mutagenic/redox alert)",smarts:"[N+](=O)[O-]"},{id:"Brenk-aldehyde",family:"Brenk",label:"Reactive aldehyde",smarts:"[CX3H1](=O)[#6]"},{id:"Brenk-epoxide",family:"Brenk",label:"Strained epoxide / oxirane",smarts:"C1OC1"},{id:"Brenk-sulfonyl-halide",family:"Brenk",label:"Sulfonyl halide (covalent modifier)",smarts:"S(=O)(=O)[F,Cl,Br,I]"},{id:"Brenk-acyl-halide",family:"Brenk",label:"Acyl halide",smarts:"C(=O)[F,Cl,Br,I]"},{id:"Brenk-azide",family:"Brenk",label:"Azide group",smarts:"[N-]=[N+]=[N-]"},{id:"Brenk-hydrazine",family:"Brenk",label:"Hydrazine / hydrazide motif",smarts:"[NX3][NX3]"},{id:"Brenk-thiol",family:"Brenk",label:"Free thiol",smarts:"[SX2H1]"}],qr=new Uint8Array(256);for(let p=0;p<256;p++){let g=p,_=0;for(;g;)_+=g&1,g>>>=1;qr[p]=_}function $n(p,g){const _=Math.min(p.length,g.length);let E=0,P=0;for(let d=0;d<_;d++)E+=qr[p[d]&g[d]],P+=qr[p[d]|g[d]];return P===0?0:E/P}function Pn(p){let g=0;for(let _=0;_<p.length;_++)g+=qr[p[_]];return g}function Cn(p,g,_){const E=p.get_mol(g);if(!E||!E.is_valid())throw E?.delete(),new Error("RDKit could not parse molecule input.");try{return _(E)}finally{E.delete()}}function at(p){return p.replace(/fill:#FFFFFF;/gi,"fill:transparent;").replace(/stroke:#000000;/gi,"stroke:#cbd5e1;").replace(/fill:#000000;/gi,"fill:#e2e8f0;")}function st(p,g){const _=new Set,E=new Set;try{const P=p.get_substruct_matches(g)||"[]",d=JSON.parse(P),U=Array.isArray(d)?d:[d];for(const I of U){if(Array.isArray(I.atoms))for(const D of I.atoms)_.add(D);if(Array.isArray(I.bonds))for(const D of I.bonds)E.add(D)}}catch{const P=JSON.parse(p.get_substruct_match(g)||"{}");if(Array.isArray(P.atoms))for(const d of P.atoms)_.add(d);if(Array.isArray(P.bonds))for(const d of P.bonds)E.add(d)}return{atoms:Array.from(_),bonds:Array.from(E)}}function Fn(p,g,_){const E=g.trim();if(!E)throw new Error("Molecule input is empty.");const P=_?.width??340,d=_?.height??220;return Cn(p,E,U=>{const I=U.get_smiles(),D=U.get_inchi(),M=D?p.get_inchikey_for_inchi(D):"",k=JSON.parse(U.get_descriptors());let or="";const K=U.copy();if(K)try{K.set_new_coords(!0),or=K.get_molblock()}finally{K.delete()}let X=[],er=[];if(_?.highlightSmarts?.trim()){const V=p.get_qmol(_.highlightSmarts.trim());if(V&&V.is_valid())try{const J=st(U,V);X=J.atoms,er=J.bonds}finally{V.delete()}else V?.delete()}const Z=X.length>0?U.get_svg_with_highlights(JSON.stringify({width:P,height:d,atoms:X,bonds:er,highlightColour:[.22,.74,.97,.45]})):U.get_svg(P,d),G=[];for(const V of Sn){const J=p.get_qmol(V.smarts);if(!J||!J.is_valid()){J?.delete();continue}try{const Kr=U.get_substruct_match(J),Pr=JSON.parse(Kr||"{}");Array.isArray(Pr.atoms)&&Pr.atoms.length>0&&G.push({id:V.id,family:V.family,label:V.label,smarts:V.smarts,matchedAtoms:Pr.atoms})}finally{J.delete()}}const Er=U.get_morgan_fp_as_uint8array(JSON.stringify({radius:2,nBits:2048})),vr=Pn(Er),hr=Number(k.amw??0),Q=Number(k.CrippenClogP??0),mr=Number(k.lipinskiHBD??k.NumHBD??0),kr=Number(k.lipinskiHBA??k.NumHBA??0),Rr=Number(k.tpsa??0),Sr=Number(k.NumRotatableBonds??0),$r=Number(k.NumHeavyAtoms??0),Nr=Number(k.CrippenMR??0);let ir=0;hr>500&&ir++,Q>5&&ir++,mr>5&&ir++,kr>10&&ir++;const z=Sr<=10&&Rr<=140,Or=hr>=160&&hr<=480&&Q>=-.4&&Q<=5.6&&Nr>=40&&Nr<=130&&$r>=20&&$r<=70;return{engine:"rdkit-wasm",rdkitVersion:p.version(),canonicalSmiles:I,inchi:D,inchiKey:M,molblock2d:or,svg:at(Z),descriptors:{exactMass:Number(k.exactmw??0),molecularWeight:hr,tpsa:Rr,crippenLogP:Q,hbd:Number(k.NumHBD??0),hba:Number(k.NumHBA??0),rotatableBonds:Sr,heavyAtoms:$r,totalAtoms:Number(k.NumAtoms??0),heteroatoms:Number(k.NumHeteroatoms??0),rings:Number(k.NumRings??0),aromaticRings:Number(k.NumAromaticRings??0),aliphaticRings:Number(k.NumAliphaticRings??0),fractionCsp3:Number(k.FractionCSP3??0),stereoCenters:Number(k.NumAtomStereoCenters??0),labuteAsa:Number(k.labuteASA??0),lipinskiHbd:mr,lipinskiHba:kr},rules:{lipinskiViolations:ir,veberCompliant:z,ghoseCompliant:Or},alerts:G,morganFpPopcount:vr}})}function Tn(p,g,_){const E=g.trim();if(!E)return[];const P=p.get_qmol(E),d=p.get_mol(E);if((!P||!P.is_valid())&&(!d||!d.is_valid()))throw P?.delete(),d?.delete(),new Error("Query must be a valid SMILES or SMARTS pattern.");const U=d&&d.is_valid()?d.get_morgan_fp_as_uint8array(JSON.stringify({radius:2,nBits:2048})):null,I=[];try{for(const D of _){const M=p.get_mol(D.smiles);if(!M||!M.is_valid()){M?.delete();continue}try{let k=[],or=[];if(P&&P.is_valid()){const Z=st(M,P);k=Z.atoms,or=Z.bonds}const K=M.get_morgan_fp_as_uint8array(JSON.stringify({radius:2,nBits:2048})),X=U?$n(U,K):k.length>0?1:0,er=at(k.length>0?M.get_svg_with_highlights(JSON.stringify({width:180,height:110,atoms:k,bonds:or,highlightColour:[.22,.74,.97,.45]})):M.get_svg(180,110));I.push({id:D.id,name:D.name,smiles:M.get_smiles(),substructureMatch:k.length>0,tanimoto:X,svg:er})}finally{M.delete()}}}finally{P?.delete(),d?.delete()}return I.sort((D,M)=>D.substructureMatch!==M.substructureMatch?D.substructureMatch?-1:1:M.tanimoto-D.tanimoto)}let ve=null;const Dr=new Map;function An(){return ve||(ve=kn({locateFile:p=>`/wasm/rdkit/${p}`})),ve}self.onmessage=async p=>{const g=p.data;if(g.type==="cancel"){const _=Dr.get(g.channel)??0;g.minId>_&&Dr.set(g.channel,g.minId);return}Dr.set(g.channel,Math.max(Dr.get(g.channel)??0,g.id));try{const _=await An();if((Dr.get(g.channel)??0)>g.id){self.postMessage({id:g.id,cancelled:!0});return}if(g.op==="analyze"){const E=g.payload,P=Fn(_,E.input,E);self.postMessage({id:g.id,ok:!0,data:P});return}if(g.op==="search"){const E=g.payload,P=Tn(_,E.query,E.candidates);self.postMessage({id:g.id,ok:!0,data:P});return}self.postMessage({id:g.id,ok:!1,error:`Unknown RDKit worker op: ${String(g.op)}`})}catch(_){self.postMessage({id:g.id,ok:!1,error:_ instanceof Error?_.message:String(_)})}};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"Synlexa","short_name":"Synlexa","icons":[{"src":"/favicon_io/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/favicon_io/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|