// Generated by js_of_ocaml //# buildInfo:effects=disabled, kind=unknown, use-js-string=true, version=6.3.2 //# 7 ".sx_browser.eobjs/jsoo/sx_browser.bc.runtime.js" (function (Object){ typeof globalThis !== "object" && (this ? get() : (Object.defineProperty (Object.prototype, "_T_", {configurable: true, get: get}), _T_)); function get(){ var global = this || self; global.globalThis = global; delete Object.prototype._T_; } } (Object)); (function(globalThis){ "use strict"; function caml_string_of_jsbytes(x){return x;} class JsStringReader{ constructor(s, i){this.s = s; this.i = i;} read8u(){return this.s.charCodeAt(this.i++);} read8s(){return this.s.charCodeAt(this.i++) << 24 >> 24;} read16u(){ var s = this.s, i = this.i; this.i = i + 2; return s.charCodeAt(i) << 8 | s.charCodeAt(i + 1); } read16s(){ var s = this.s, i = this.i; this.i = i + 2; return s.charCodeAt(i) << 24 >> 16 | s.charCodeAt(i + 1); } read32u(){ var s = this.s, i = this.i; this.i = i + 4; return (s.charCodeAt(i) << 24 | s.charCodeAt(i + 1) << 16 | s.charCodeAt(i + 2) << 8 | s.charCodeAt(i + 3)) >>> 0; } read32s(){ var s = this.s, i = this.i; this.i = i + 4; return s.charCodeAt(i) << 24 | s.charCodeAt(i + 1) << 16 | s.charCodeAt(i + 2) << 8 | s.charCodeAt(i + 3); } readstr(len){ var i = this.i; this.i = i + len; return caml_string_of_jsbytes(this.s.slice(i, i + len)); } readuint8array(len){ var b = new Uint8Array(len), s = this.s, i = this.i; for(var j = 0; j < len; j++) b[j] = s.charCodeAt(i + j); this.i = i + len; return b; } } var jsoo_text_decoder = new TextDecoder(); function caml_convert_bytes_to_array(s){ var a = new Uint8Array(s.l), b = s.c, l = b.length, i = 0; for(; i < l; i++) a[i] = b.charCodeAt(i); for(l = s.l; i < l; i++) a[i] = 0; s.c = a; s.t = 4; return a; } function caml_uint8_array_of_bytes(s){ if(s.t !== 4) caml_convert_bytes_to_array(s); return s.c; } function caml_str_repeat(n, s){return s.repeat(n);} function caml_sub_uint8_array_to_jsbytes(a, i, len){ var f = String.fromCharCode; if(i === 0 && len <= 4096 && len === a.length) return f.apply(null, a); var s = ""; for(; 0 < len; i += 1024, len -= 1024) s += f.apply(null, a.subarray(i, i + Math.min(len, 1024))); return s; } function caml_convert_string_to_bytes(s){ if(s.t === 2) s.c += caml_str_repeat(s.l - s.c.length, "\0"); else s.c = caml_sub_uint8_array_to_jsbytes(s.c, 0, s.c.length); s.t = 0; } function jsoo_is_ascii(s){ if(s.length < 24){ for(var i = 0; i < s.length; i++) if(s.charCodeAt(i) > 127) return false; return true; } else return ! /[^\x00-\x7f]/.test(s); } class MlBytes{ constructor(tag, contents, length){ this.t = tag; this.c = contents; this.l = length; } toString(){ switch(this.t){ case 9: case 8: return this.c; case 4: case 2: caml_convert_string_to_bytes(this); case 0: if(jsoo_is_ascii(this.c)) this.t = 9; else this.t = 8; return this.c; } } toUtf16(){ if(this.t === 9) return this.c; var a = caml_uint8_array_of_bytes(this); return jsoo_text_decoder.decode(a); } slice(){ var content = this.t === 4 ? this.c.slice() : this.c; return new MlBytes(this.t, content, this.l); } } function MlChanid(id){this.id = id;} var jsoo_static_env = {}; function jsoo_sys_getenv(n){ if(jsoo_static_env[n]) return jsoo_static_env[n]; var process = globalThis.process; if(process && process.env && process.env[n] !== undefined) return process.env[n]; if(globalThis.jsoo_env && typeof globalThis.jsoo_env[n] === "string") return globalThis.jsoo_env[n]; } var caml_record_backtrace_env_flag = 0; (function(){ var r = jsoo_sys_getenv("OCAMLRUNPARAM"); if(r !== undefined){ var l = r.split(","); for(var i = 0; i < l.length; i++) if(l[i] === "b"){ caml_record_backtrace_env_flag = 1; break; } else if(l[i].startsWith("b=")) caml_record_backtrace_env_flag = + l[i].slice(2); else continue; } } ()); var caml_record_backtrace_runtime_flag = caml_record_backtrace_env_flag, caml_global_data = [0]; function caml_exn_with_js_backtrace(exn, force){ if(! exn.js_error || force || exn[0] === 248) exn.js_error = new globalThis.Error("Js exception containing backtrace"); return exn; } function caml_maybe_attach_backtrace(exn, force){ return caml_record_backtrace_env_flag && caml_record_backtrace_runtime_flag ? caml_exn_with_js_backtrace(exn, force) : exn; } function caml_raise_with_arg(tag, arg){ throw caml_maybe_attach_backtrace([0, tag, arg]); } var jsoo_text_encoder = new TextEncoder(); function caml_subarray_to_jsbytes(a, i, len){ var f = String.fromCharCode; if(i === 0 && len <= 4096 && len === a.length) return f.apply(null, a); var s = ""; for(; 0 < len; i += 1024, len -= 1024) s += f.apply(null, a.slice(i, i + Math.min(len, 1024))); return s; } function caml_string_of_array(a){ return caml_string_of_jsbytes(caml_subarray_to_jsbytes(a, 0, a.length)); } function caml_string_of_jsstring(s){ if(jsoo_is_ascii(s)) return caml_string_of_jsbytes(s); var a = jsoo_text_encoder.encode(s); return caml_string_of_array(a); } function caml_raise_sys_error(msg){ caml_raise_with_arg (caml_global_data.Sys_error, caml_string_of_jsstring(msg)); } function caml_raise_with_args(tag, args){ throw caml_maybe_attach_backtrace([0, tag].concat(args)); } var unix_error = ["E2BIG", "EACCES", "EAGAIN", "EBADF", "EBUSY", "ECHILD", "EDEADLK", "EDOM", "EEXIST", "EFAULT", "EFBIG", "EINTR", "EINVAL", "EIO", "EISDIR", "EMFILE", "EMLINK", "ENAMETOOLONG", "ENFILE", "ENODEV", "ENOENT", "ENOEXEC", "ENOLCK", "ENOMEM", "ENOSPC", "ENOSYS", "ENOTDIR", "ENOTEMPTY", "ENOTTY", "ENXIO", "EPERM", "EPIPE", "ERANGE", "EROFS", "ESPIPE", "ESRCH", "EXDEV", "EWOULDBLOCK", "EINPROGRESS", "EALREADY", "ENOTSOCK", "EDESTADDRREQ", "EMSGSIZE", "EPROTOTYPE", "ENOPROTOOPT", "EPROTONOSUPPORT", "ESOCKTNOSUPPORT", "EOPNOTSUPP", "EPFNOSUPPORT", "EAFNOSUPPORT", "EADDRINUSE", "EADDRNOTAVAIL", "ENETDOWN", "ENETUNREACH", "ENETRESET", "ECONNABORTED", "ECONNRESET", "ENOBUFS", "EISCONN", "ENOTCONN", "ESHUTDOWN", "ETOOMANYREFS", "ETIMEDOUT", "ECONNREFUSED", "EHOSTDOWN", "EHOSTUNREACH", "ELOOP", "EOVERFLOW"]; function make_unix_err_args(code, syscall, path, errno){ var variant = unix_error.indexOf(code); if(variant < 0){if(errno == null) errno = - 9999; variant = [0, - errno];} var args = [variant, caml_string_of_jsstring(syscall || ""), caml_string_of_jsstring(path || "")]; return args; } var caml_named_values = {}; function caml_named_value(nm){return caml_named_values[nm];} function caml_raise_system_error(raise_unix, code, cmd, msg, path){ var unix_error = caml_named_value("Unix.Unix_error"); if(raise_unix && unix_error) caml_raise_with_args(unix_error, make_unix_err_args(code, cmd, path)); else{ var msg = code + ": " + msg + ", " + cmd; if(path !== undefined) msg += " '" + path + "'"; caml_raise_sys_error(msg); } } function caml_is_ml_bytes(s){return s instanceof MlBytes;} function caml_is_ml_string(s){ return typeof s === "string" && ! /[^\x00-\xff]/.test(s); } function caml_bytes_of_array(a){ if(! (a instanceof Uint8Array)) a = new Uint8Array(a); return new MlBytes(4, a, a.length); } function caml_bytes_of_jsbytes(s){return new MlBytes(0, s, s.length);} function caml_jsbytes_of_string(x){return x;} function caml_bytes_of_string(s){ return caml_bytes_of_jsbytes(caml_jsbytes_of_string(s)); } function caml_raise_no_such_file(name, raise_unix){ caml_raise_system_error (raise_unix, "ENOENT", "no such file or directory", name); } function caml_bytes_of_uint8_array(a){return new MlBytes(4, a, a.length);} function caml_raise_with_string(tag, msg){ caml_raise_with_arg(tag, caml_string_of_jsbytes(msg)); } function caml_invalid_argument(msg){ caml_raise_with_string(caml_global_data.Invalid_argument, msg); } function caml_create_bytes(len){ if(len < 0) caml_invalid_argument("Bytes.create"); return new MlBytes(len ? 2 : 9, "", len); } function caml_ml_bytes_length(s){return s.l;} function caml_blit_bytes(s1, i1, s2, i2, len){ if(len === 0) return 0; if(i2 === 0 && (len >= s2.l || s2.t === 2 && len >= s2.c.length)){ s2.c = s1.t === 4 ? caml_sub_uint8_array_to_jsbytes(s1.c, i1, len) : i1 === 0 && s1.c.length === len ? s1.c : s1.c.slice(i1, i1 + len); s2.t = s2.c.length === s2.l ? 0 : 2; } else if(s2.t === 2 && i2 === s2.c.length){ s2.c += s1.t === 4 ? caml_sub_uint8_array_to_jsbytes(s1.c, i1, len) : i1 === 0 && s1.c.length === len ? s1.c : s1.c.slice(i1, i1 + len); s2.t = s2.c.length === s2.l ? 0 : 2; } else{ if(s2.t !== 4) caml_convert_bytes_to_array(s2); var c1 = s1.c, c2 = s2.c; if(s1.t === 4) if(i2 <= i1) for(var i = 0; i < len; i++) c2[i2 + i] = c1[i1 + i]; else for(var i = len - 1; i >= 0; i--) c2[i2 + i] = c1[i1 + i]; else{ var l = Math.min(len, c1.length - i1); for(var i = 0; i < l; i++) c2[i2 + i] = c1.charCodeAt(i1 + i); for(; i < len; i++) c2[i2 + i] = 0; } } return 0; } function MlFile(){} class MlFakeFile extends MlFile { constructor(content){super(); this.data = content;} truncate(len){ var old = this.data, old_len = caml_ml_bytes_length(old); this.data = caml_create_bytes(len | 0); caml_blit_bytes(old, 0, this.data, 0, Math.min(len, old_len)); } length(){return caml_ml_bytes_length(this.data);} write(offset, buf, pos, len){ var clen = this.length(); if(offset + len >= clen){ var new_str = caml_create_bytes(offset + len), old_data = this.data; this.data = new_str; caml_blit_bytes(old_data, 0, this.data, 0, clen); } caml_blit_bytes (caml_bytes_of_uint8_array(buf), pos, this.data, offset, len); return len; } read(offset, buf, pos, len){ var clen = this.length(); if(offset + len >= clen) len = clen - offset; if(len > 0){ var data = caml_create_bytes(len | 0); caml_blit_bytes(this.data, offset, data, 0, len); buf.set(caml_uint8_array_of_bytes(data), pos); return len; } return 0; } } class MlFakeFd{ constructor(name, file, flags){ this.file = file; this.name = name; this.flags = flags; this.offset = 0; this.seeked = false; } err_closed(cmd, raise_unix){ caml_raise_system_error(raise_unix, "EBADF", cmd, "bad file descriptor"); } length(){ if(this.file) return this.file.length(); this.err_closed("length"); } truncate(len, raise_unix){ if(this.file){ if(! (this.flags.wronly || this.flags.rdwr)) caml_raise_system_error (raise_unix, "EINVAL", "truncate", "invalid argument"); return this.file.truncate(len); } this.err_closed("truncate", raise_unix); } write(buf, pos, len, raise_unix){ if(this.file && (this.flags.wronly || this.flags.rdwr)){ var offset = this.offset; len = this.file.write(offset, buf, pos, len); this.offset += len; return len; } this.err_closed("write", raise_unix); } read(buf, pos, len, raise_unix){ if(this.file && ! this.flags.wronly){ var offset = this.offset; len = this.file.read(offset, buf, pos, len); this.offset += len; return len; } this.err_closed("read", raise_unix); } seek(offset, whence, raise_unix){ switch(whence){ case 0: break; case 1: offset += this.offset; break; case 2: offset += this.length(); break; } if(offset < 0) caml_raise_system_error (raise_unix, "EINVAL", "lseek", "invalid argument"); this.offset = offset; this.seeked = true; return offset; } pos(){return this.offset;} close(){if(! this.file) this.err_closed("close"); this.file = undefined;} check_stream_semantics(cmd){ if(! this.file) return this.err_closed(cmd, 1); } } class MlFakeDevice{ constructor(root, f){ this.content = {}; this.root = root; this.lookupFun = f; } nm(name){return this.root + name;} create_dir_if_needed(name){ var comp = name.split("/"), res = ""; for(var i = 0; i < comp.length - 1; i++){ res += comp[i] + "/"; if(this.content[res]) continue; this.content[res] = Symbol("directory"); } } slash(name){return /\/$/.test(name) ? name : name + "/";} lookup(name){ if(! this.content[name] && this.lookupFun){ var res = this.lookupFun (caml_string_of_jsstring(this.root), caml_string_of_jsstring(name)); if(res !== 0){ this.create_dir_if_needed(name); this.content[name] = new MlFakeFile(caml_bytes_of_string(res[1])); } } } exists(name, do_not_lookup){ if(name === "") return 1; var name_slash = this.slash(name); if(this.content[name_slash]) return 1; if(! do_not_lookup) this.lookup(name); return this.content[name] ? 1 : 0; } isFile(name){return this.exists(name) && ! this.is_dir(name) ? 1 : 0;} rename_dir(oldname, newname){ if(this.exists(newname)){ if(! this.is_dir(newname)) caml_raise_sys_error (this.nm(newname) + " : file already exists and is not a directory"); if(this.readdir(newname).length > 0) caml_raise_sys_error(this.nm(newname) + " : directory not empty"); } var old_slash = this.slash(oldname), new_slash = this.slash(newname); this.create_dir_if_needed(new_slash); for(const f of this.readdir(oldname)) this.rename(old_slash + f, new_slash + f); delete this.content[old_slash]; } rename(oldname, newname){ if(! this.exists(oldname)) caml_raise_sys_error(this.nm(oldname) + " : no such file or directory"); if(this.is_dir(oldname)) this.rename_dir(oldname, newname); else{ if(this.exists(newname) && this.is_dir(newname)) caml_raise_sys_error (this.nm(newname) + " : file already exists and is a directory"); this.content[newname] = this.content[oldname]; delete this.content[oldname]; } } mkdir(name, _mode, raise_unix){ if(this.exists(name)) caml_raise_system_error (raise_unix, "EEXIST", "mkdir", "file already exists", this.nm(name)); var parent = /^(.*)\/[^/]+/.exec(name); parent = parent?.[1] || ""; if(! this.exists(parent)) caml_raise_system_error (raise_unix, "ENOENT", "mkdir", "no such file or directory", this.nm(name)); if(! this.is_dir(parent)) caml_raise_system_error (raise_unix, "ENOTDIR", "mkdir", "not a directory", this.nm(name)); this.create_dir_if_needed(this.slash(name)); } rmdir(name, raise_unix){ var name_slash = name === "" ? "" : this.slash(name); if(! this.exists(name)) caml_raise_system_error (raise_unix, "ENOENT", "rmdir", "no such file or directory", this.nm(name)); if(! this.is_dir(name)) caml_raise_system_error (raise_unix, "ENOTDIR", "rmdir", "not a directory", this.nm(name)); for(var n in this.content) if(n.startsWith(name_slash) && n !== name_slash) caml_raise_system_error (raise_unix, "ENOTEMPTY", "rmdir", "directory not empty", this.nm(name)); delete this.content[name_slash]; } readdir(name){ var name_slash = name === "" ? "" : this.slash(name); if(! this.exists(name)) caml_raise_sys_error(name + ": No such file or directory"); if(! this.is_dir(name)) caml_raise_sys_error(name + ": Not a directory"); var seen = {}, a = []; for(var n in this.content) if(n.startsWith(name_slash) && n !== name_slash){ var last = n.indexOf("/", name_slash.length); if(last < 0) last = undefined; var m = n.slice(name_slash.length, last); if(m && ! seen[m]){seen[m] = true; a.push(m);} } return a; } opendir(name, raise_unix){ var a = this.readdir(name), c = false, i = 0; return {readSync: function(){ if(c) caml_raise_system_error (raise_unix, "EBADF", "readdir", "bad file descriptor"); if(i === a.length) return null; var entry = a[i]; i++; return {name: entry}; }, closeSync: function(){ if(c) caml_raise_system_error (raise_unix, "EBADF", "readdir", "bad file descriptor"); c = true; a = []; }}; } is_dir(name){ if(name === "") return true; var name_slash = this.slash(name); return this.content[name_slash] ? 1 : 0; } unlink(name, raise_unix){ if(! this.exists(name, true)) caml_raise_system_error (raise_unix, "ENOENT", "unlink", "no such file or directory", name); delete this.content[name]; return 0; } access(name, _flags, raise_unix){ this.lookup(name); if(this.content[name]){ if(this.is_dir(name)) caml_raise_system_error (raise_unix, "EACCESS", "access", "permission denied,", this.nm(name)); } else caml_raise_no_such_file(this.nm(name), raise_unix); return 0; } open(name, f, _perms, raise_unix){ var file; this.lookup(name); if(this.content[name]){ if(this.is_dir(name)) caml_raise_system_error (raise_unix, "EISDIR", "open", "illegal operation on a directory", this.nm(name)); if(f.create && f.excl) caml_raise_system_error (raise_unix, "EEXIST", "open", "file already exists", this.nm(name)); file = this.content[name]; if(f.truncate) file.truncate(0); } else if(f.create){ this.create_dir_if_needed(name); this.content[name] = new MlFakeFile(caml_create_bytes(0)); file = this.content[name]; } else caml_raise_no_such_file(this.nm(name), raise_unix); return new MlFakeFd(this.nm(name), file, f); } truncate(name, len, raise_unix){ var file; this.lookup(name); if(this.content[name]){ if(this.is_dir(name)) caml_raise_system_error (raise_unix, "EISDIR", "open", "illegal operation on a directory", this.nm(name)); file = this.content[name]; file.truncate(len); } else caml_raise_no_such_file(this.nm(name), raise_unix); } register(name, content){ var file; if(this.content[name]) caml_raise_sys_error(this.nm(name) + " : file already exists"); if(caml_is_ml_bytes(content)) file = new MlFakeFile(content); if(caml_is_ml_string(content)) file = new MlFakeFile(caml_bytes_of_string(content)); else if(Array.isArray(content)) file = new MlFakeFile(caml_bytes_of_array(content)); else if(typeof content === "string") file = new MlFakeFile(caml_bytes_of_jsbytes(content)); else if(content.toString){ var bytes = caml_bytes_of_string(caml_string_of_jsstring(content.toString())); file = new MlFakeFile(bytes); } if(file){ this.create_dir_if_needed(name); this.content[name] = file; } else caml_raise_sys_error (this.nm(name) + " : registering file with invalid content type"); } } class MlFakeFd_out extends MlFakeFile { constructor(fd, flags){ super(caml_create_bytes(0)); this.log = function(_s){return 0;}; if(fd === 1 && typeof console.log === "function") this.log = console.log; else if(fd === 2 && typeof console.error === "function") this.log = console.error; else if(typeof console.log === "function") this.log = console.log; this.flags = flags; } length(){return 0;} truncate(_len, raise_unix){ caml_raise_system_error (raise_unix, "EINVAL", "ftruncate", "invalid argument"); } write(buf, pos, len, raise_unix){ var written = len; if(this.log){ if (len > 0 && pos >= 0 && pos + len <= buf.length && buf[pos + len - 1] === 10) len--; var src = caml_create_bytes(len); caml_blit_bytes(caml_bytes_of_uint8_array(buf), pos, src, 0, len); this.log(src.toUtf16()); return written; } caml_raise_system_error (raise_unix, "EBADF", "write", "bad file descriptor"); } read(_buf, _pos, _len, raise_unix){ caml_raise_system_error (raise_unix, "EBADF", "read", "bad file descriptor"); } seek(_len, _whence, raise_unix){ caml_raise_system_error(raise_unix, "ESPIPE", "lseek", "illegal seek"); } pos(){return - 1;} close(){this.log = undefined;} check_stream_semantics(_cmd){} } var caml_int64_offset = Math.pow(2, - 24); function caml_raise_constant(tag){throw tag;} function caml_raise_zero_divide(){ caml_raise_constant(caml_global_data.Division_by_zero); } class MlInt64{ constructor(lo, mi, hi){ this.lo = lo & 0xffffff; this.mi = mi & 0xffffff; this.hi = hi & 0xffff; this.caml_custom = "_j"; } static UNSIGNED_MAX = new MlInt64(0xffffff, 0xffffff, 0xffff); static SIGNED_MAX = new MlInt64(0xffffff, 0xffffff, 0x7fff); static SIGNED_MIN = new MlInt64(0x000000, 0x000000, 0x8000); slice(){return new MlInt64(this.lo, this.mi, this.hi);} ucompare(x){ if(this.hi > x.hi) return 1; if(this.hi < x.hi) return - 1; if(this.mi > x.mi) return 1; if(this.mi < x.mi) return - 1; if(this.lo > x.lo) return 1; if(this.lo < x.lo) return - 1; return 0; } compare(x){ var hi = this.hi << 16, xhi = x.hi << 16; if(hi > xhi) return 1; if(hi < xhi) return - 1; if(this.mi > x.mi) return 1; if(this.mi < x.mi) return - 1; if(this.lo > x.lo) return 1; if(this.lo < x.lo) return - 1; return 0; } neg(){ var lo = - this.lo, mi = - this.mi + (lo >> 24), hi = - this.hi + (mi >> 24); return new MlInt64(lo, mi, hi); } add(x){ var lo = this.lo + x.lo, mi = this.mi + x.mi + (lo >> 24), hi = this.hi + x.hi + (mi >> 24); return new MlInt64(lo, mi, hi); } sub(x){ var lo = this.lo - x.lo, mi = this.mi - x.mi + (lo >> 24), hi = this.hi - x.hi + (mi >> 24); return new MlInt64(lo, mi, hi); } mul(x){ var lo = this.lo * x.lo, mi = (lo * caml_int64_offset | 0) + this.mi * x.lo + this.lo * x.mi, hi = (mi * caml_int64_offset | 0) + this.hi * x.lo + this.mi * x.mi + this.lo * x.hi; return new MlInt64(lo, mi, hi); } isZero(){return (this.lo | this.mi | this.hi) === 0;} isNeg(){return this.hi << 16 < 0;} and(x){ return new MlInt64(this.lo & x.lo, this.mi & x.mi, this.hi & x.hi); } or(x){ return new MlInt64(this.lo | x.lo, this.mi | x.mi, this.hi | x.hi); } xor(x){ return new MlInt64(this.lo ^ x.lo, this.mi ^ x.mi, this.hi ^ x.hi); } shift_left(s){ s = s & 63; if(s === 0) return this; if(s < 24) return new MlInt64 (this.lo << s, this.mi << s | this.lo >> 24 - s, this.hi << s | this.mi >> 24 - s); if(s < 48) return new MlInt64 (0, this.lo << s - 24, this.mi << s - 24 | this.lo >> 48 - s); return new MlInt64(0, 0, this.lo << s - 48); } shift_right_unsigned(s){ s = s & 63; if(s === 0) return this; if(s < 24) return new MlInt64 (this.lo >> s | this.mi << 24 - s, this.mi >> s | this.hi << 24 - s, this.hi >> s); if(s < 48) return new MlInt64 (this.mi >> s - 24 | this.hi << 48 - s, this.hi >> s - 24, 0); return new MlInt64(this.hi >> s - 48, 0, 0); } shift_right(s){ s = s & 63; if(s === 0) return this; var h = this.hi << 16 >> 16; if(s < 24) return new MlInt64 (this.lo >> s | this.mi << 24 - s, this.mi >> s | h << 24 - s, this.hi << 16 >> s >>> 16); var sign = this.hi << 16 >> 31; if(s < 48) return new MlInt64 (this.mi >> s - 24 | this.hi << 48 - s, this.hi << 16 >> s - 24 >> 16, sign & 0xffff); return new MlInt64(this.hi << 16 >> s - 32, sign, sign); } lsl1(){ this.hi = this.hi << 1 | this.mi >> 23; this.mi = (this.mi << 1 | this.lo >> 23) & 0xffffff; this.lo = this.lo << 1 & 0xffffff; } lsr1(){ this.lo = (this.lo >>> 1 | this.mi << 23) & 0xffffff; this.mi = (this.mi >>> 1 | this.hi << 23) & 0xffffff; this.hi = this.hi >>> 1; } udivmod(x){ var offset = 0, modulus = this.slice(), divisor = x.slice(), quotient = new MlInt64(0, 0, 0); while(modulus.ucompare(divisor) > 0){offset++; divisor.lsl1();} while(offset >= 0){ offset--; quotient.lsl1(); if(modulus.ucompare(divisor) >= 0){ quotient.lo++; modulus = modulus.sub(divisor); } divisor.lsr1(); } return {quotient: quotient, modulus: modulus}; } div(y){ var x = this; if(y.isZero()) caml_raise_zero_divide(); var sign = x.hi ^ y.hi; if(x.hi & 0x8000) x = x.neg(); if(y.hi & 0x8000) y = y.neg(); var q = x.udivmod(y).quotient; if(sign & 0x8000) q = q.neg(); return q; } mod(y){ var x = this; if(y.isZero()) caml_raise_zero_divide(); var sign = x.hi; if(x.hi & 0x8000) x = x.neg(); if(y.hi & 0x8000) y = y.neg(); var r = x.udivmod(y).modulus; if(sign & 0x8000) r = r.neg(); return r; } toInt(){return this.lo | this.mi << 24;} toFloat(){ return (this.hi << 16) * Math.pow(2, 32) + this.mi * Math.pow(2, 24) + this.lo; } toArray(){ return [this.hi >> 8, this.hi & 0xff, this.mi >> 16, this.mi >> 8 & 0xff, this.mi & 0xff, this.lo >> 16, this.lo >> 8 & 0xff, this.lo & 0xff]; } lo32(){return this.lo | (this.mi & 0xff) << 24;} hi32(){return this.mi >>> 8 & 0xffff | this.hi << 16;} } class MlMutex{constructor(){this.locked = false;}} class MlNat{ constructor(x){ this.data = new Int32Array(x); this.length = this.data.length + 2; this.caml_custom = "_nat"; } } var jsoo_is_win32 = globalThis.Deno?.build?.os === "windows" || globalThis.process?.platform === "win32"; function caml_raise_nodejs_error(err, raise_unix, cmd){ var unix_error = caml_named_value("Unix.Unix_error"); if(raise_unix && unix_error){ var args = make_unix_err_args(err.code, cmd || err.syscall, err.path, err.errno); caml_raise_with_args(unix_error, args); } else caml_raise_sys_error(err.toString()); } function caml_int64_of_float(x){ if(x < 0) x = Math.ceil(x); return new MlInt64 (x & 0xffffff, Math.floor(x * caml_int64_offset) & 0xffffff, Math.floor(x * caml_int64_offset * caml_int64_offset) & 0xffff); } function ocaml_stats_from_node_stats(js_stats, large){ var file_kind; if(js_stats.isFile()) file_kind = 0; else if(js_stats.isDirectory()) file_kind = 1; else if(js_stats.isCharacterDevice()) file_kind = 2; else if(js_stats.isBlockDevice()) file_kind = 3; else if(js_stats.isSymbolicLink()) file_kind = 4; else if(js_stats.isFIFO()) file_kind = 5; else if(js_stats.isSocket()) file_kind = 6; return [0, js_stats.dev, js_stats.ino | 0, file_kind, js_stats.mode, js_stats.nlink, js_stats.uid, js_stats.gid, js_stats.rdev, large ? caml_int64_of_float(js_stats.size) : js_stats.size | 0, js_stats.atimeMs / 1000, js_stats.mtimeMs / 1000, js_stats.ctimeMs / 1000]; } function caml_ml_string_length(s){return s.length;} function caml_string_unsafe_get(s, i){return s.charCodeAt(i);} function caml_uint8_array_of_string(s){ var l = caml_ml_string_length(s), a = new Uint8Array(l), i = 0; for(; i < l; i++) a[i] = caml_string_unsafe_get(s, i); return a; } function caml_bytes_bound_error(){ caml_invalid_argument("index out of bounds"); } function caml_bytes_unsafe_set(s, i, c){ c &= 0xff; if(s.t !== 4){ if(i === s.c.length){ s.c += String.fromCharCode(c); if(i + 1 === s.l) s.t = 0; return 0; } caml_convert_bytes_to_array(s); } s.c[i] = c; return 0; } function caml_bytes_set(s, i, c){ if(i >>> 0 >= s.l) caml_bytes_bound_error(); return caml_bytes_unsafe_set(s, i, c); } class MlNodeFd extends MlFile { constructor(fd, flags){ super(); this.fs = require("node:fs"); this.fd = fd; this.flags = flags; try{ var stats = this.fs.fstatSync(fd); flags.noSeek = stats.isCharacterDevice() || stats.isFIFO() || stats.isSocket(); this.offset = this.flags.append ? stats.size : 0; } catch(err){flags.noSeek = true; this.offset = 0;} this.seeked = false; } truncate(len, raise_unix){ try{ this.fs.ftruncateSync(this.fd, len | 0); if(this.offset > len) this.offset = len; } catch(err){caml_raise_nodejs_error(err, raise_unix);} } isatty(){ var tty = require("node:tty"); return tty.isatty(this.fd) ? 1 : 0; } length(){ try{return this.fs.fstatSync(this.fd).size;} catch(err){caml_raise_sys_error(err.toString());} } write(buf, buf_offset, len, raise_unix){ try{ if(this.flags.noSeek || ! this.seeked) var written = this.fs.writeSync(this.fd, buf, buf_offset, len); else var written = this.fs.writeSync(this.fd, buf, buf_offset, len, this.offset); this.offset += written; } catch(err){caml_raise_nodejs_error(err, raise_unix);} return written; } read(a, buf_offset, len, raise_unix){ try{ if(this.flags.noSeek || ! this.seeked) var read = this.fs.readSync(this.fd, a, buf_offset, len); else var read = this.fs.readSync(this.fd, a, buf_offset, len, this.offset); this.offset += read; return read; } catch(err){caml_raise_nodejs_error(err, raise_unix);} } seek(offset, whence, raise_unix){ if(this.flags.noSeek) caml_raise_system_error(raise_unix, "ESPIPE", "lseek", "illegal seek"); switch(whence){ case 0: break; case 1: offset += this.offset; break; case 2: offset += this.length(); break; } if(offset < 0) caml_raise_system_error (raise_unix, "EINVAL", "lseek", "invalid argument"); this.offset = offset; this.seeked = true; return this.offset; } pos(){return this.offset;} stat(large){ try{ var js_stats = this.fs.fstatSync(this.fd); return ocaml_stats_from_node_stats(js_stats, large); } catch(err){caml_raise_nodejs_error(err, 1);} } chmod(perms){ try{this.fs.fchmodSync(this.fd, perms); return 0;} catch(err){caml_raise_nodejs_error(err, 1);} } sync(){ try{this.fs.fsyncSync(this.fd); return 0;} catch(err){caml_raise_nodejs_error(err, 1);} } close(raise_unix){ try{this.fs.closeSync(this.fd); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } check_stream_semantics(cmd){ try{var js_stats = this.fs.fstatSync(this.fd);} catch(err){caml_raise_nodejs_error(err, 1, cmd);} if (! (js_stats.isFile() || js_stats.isCharacterDevice() || js_stats.isFIFO() || js_stats.isSocket())) caml_raise_system_error(1, "EINVAL", cmd, "invalid argument"); } } class MlNodeDevice{ constructor(root){this.fs = require("node:fs"); this.root = root;} nm(name){return this.root + name;} exists(name){ try{return this.fs.existsSync(this.nm(name)) ? 1 : 0;} catch(err){return 0;} } isFile(name){ try{return this.fs.statSync(this.nm(name)).isFile() ? 1 : 0;} catch(err){caml_raise_sys_error(err.toString());} } mkdir(name, mode, raise_unix){ try{this.fs.mkdirSync(this.nm(name), {mode: mode}); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } rmdir(name, raise_unix){ try{this.fs.rmdirSync(this.nm(name)); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } readdir(name, raise_unix){ try{return this.fs.readdirSync(this.nm(name));} catch(err){caml_raise_nodejs_error(err, raise_unix);} } is_dir(name){ try{return this.fs.statSync(this.nm(name)).isDirectory() ? 1 : 0;} catch(err){caml_raise_sys_error(err.toString());} } unlink(name, raise_unix){ try{this.fs.unlinkSync(this.nm(name)); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } utimes(name, atime, mtime, raise_unix){ try{ if(atime === 0 && mtime === 0){ atime = new Date().getTime() / 1000; mtime = atime; } this.fs.utimesSync(this.nm(name), atime, mtime); return 0; } catch(err){caml_raise_nodejs_error(err, raise_unix);} } truncate(name, len, raise_unix){ try{this.fs.truncateSync(this.nm(name), len | 0); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } access(name, f, raise_unix){ var consts = this.fs.constants, res = 0; for(var key in f) switch(key){ case "r": res |= consts.R_OK; break; case "w": res |= consts.W_OK; break; case "x": res |= jsoo_is_win32 ? consts.R_OK : consts.X_OK; break; case "f": res |= consts.F_OK; break; } try{this.fs.accessSync(this.nm(name), res); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } open(name, f, perms, raise_unix){ var consts = this.fs.constants, res = 0; for(var key in f) switch(key){ case "rdonly": res |= consts.O_RDONLY; break; case "wronly": res |= consts.O_WRONLY; break; case "rdwr": res |= consts.O_RDWR; break; case "append": res |= consts.O_APPEND; break; case "create": res |= consts.O_CREAT; break; case "truncate": res |= consts.O_TRUNC; break; case "excl": res |= consts.O_EXCL; break; case "binary": res |= consts.O_BINARY; break; case "text": res |= consts.O_TEXT; break; case "nonblock": res |= consts.O_NONBLOCK; break; case "noctty": res |= consts.O_NOCTTY; break; case "dsync": res |= consts.O_DSYNC; break; case "sync": res |= consts.O_SYNC; break; } try{ var fd = this.fs.openSync(this.nm(name), res, perms); return new MlNodeFd(fd, f); } catch(err){caml_raise_nodejs_error(err, raise_unix);} } slash(name){return /\/$/.test(name) ? name : name + "/";} rename(o, n, raise_unix){ if(jsoo_is_win32) try{ var target = this.nm(n), source = this.nm(o), target_stats, source_stats; if ((target_stats = this.fs.statSync(target, {throwIfNoEntry: false})) && (source_stats = this.fs.statSync(source, {throwIfNoEntry: false})) && source_stats.isDirectory()) if(target_stats.isDirectory()){ if(! this.slash(target).startsWith(this.slash(source))) try{this.fs.rmdirSync(target);}catch{} } else{ var err = new Error (`ENOTDIR: not a directory, rename '${source}' -> '${target}'`); throw Object.assign (err, {errno: - 20, code: "ENOTDIR", syscall: "rename", path: target}); } this.fs.renameSync(this.nm(o), this.nm(n)); } catch(err){caml_raise_nodejs_error(err, raise_unix);} else try{this.fs.renameSync(this.nm(o), this.nm(n));} catch(err){caml_raise_nodejs_error(err, raise_unix);} } stat(name, large, raise_unix){ try{ var js_stats = this.fs.statSync(this.nm(name)); return ocaml_stats_from_node_stats(js_stats, large); } catch(err){caml_raise_nodejs_error(err, raise_unix);} } lstat(name, large, raise_unix){ try{ var js_stats = this.fs.lstatSync(this.nm(name)); return ocaml_stats_from_node_stats(js_stats, large); } catch(err){caml_raise_nodejs_error(err, raise_unix);} } chmod(name, perms, raise_unix){ try{this.fs.chmodSync(this.nm(name), perms); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } link(target, path, raise_unix){ try{this.fs.linkSync(this.nm(target), this.nm(path)); return 0;} catch(err){caml_raise_nodejs_error(err, raise_unix);} } symlink(to_dir, target, path, raise_unix){ try{ this.fs.symlinkSync (target, this.nm(path), to_dir === 0 ? null : to_dir[1] ? "dir" : "file"); return 0; } catch(err){caml_raise_nodejs_error(err, raise_unix);} } readlink(name, raise_unix){ try{ var link = this.fs.readlinkSync(this.nm(name), "utf8"); return caml_string_of_jsstring(link); } catch(err){caml_raise_nodejs_error(err, raise_unix);} } opendir(name, raise_unix){ try{return this.fs.opendirSync(this.nm(name));} catch(err){caml_raise_nodejs_error(err, raise_unix);} } } class MlObjectTable{ constructor(){this.objs = []; this.lookup = new globalThis.Map();} store(v){this.lookup.set(v, this.objs.length); this.objs.push(v);} recall(v){ var i = this.lookup.get(v); return i === undefined ? undefined : this.objs.length - i; } } var caml_packFloat16 = function(){ const INVERSE_OF_EPSILON = 1 / Number.EPSILON; function roundTiesToEven(num){ return num + INVERSE_OF_EPSILON - INVERSE_OF_EPSILON; } const FLOAT16_MIN_VALUE = 6.103515625e-5, FLOAT16_MAX_VALUE = 65504, FLOAT16_EPSILON = 0.0009765625, FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE = FLOAT16_EPSILON * FLOAT16_MIN_VALUE, FLOAT16_EPSILON_DEVIDED_BY_EPSILON = FLOAT16_EPSILON * INVERSE_OF_EPSILON; function roundToFloat16(num){ const number = + num; if(! Number.isFinite(number) || number === 0) return number; const sign = number > 0 ? 1 : - 1, absolute = Math.abs(number); if(absolute < FLOAT16_MIN_VALUE) return sign * roundTiesToEven (absolute / FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE) * FLOAT16_EPSILON_MULTIPLIED_BY_FLOAT16_MIN_VALUE; const temp = (1 + FLOAT16_EPSILON_DEVIDED_BY_EPSILON) * absolute, result = temp - (temp - absolute); if(result > FLOAT16_MAX_VALUE || Number.isNaN(result)) return sign * Number.POSITIVE_INFINITY; return sign * result; } const baseTable = new Uint16Array(512), shiftTable = new Uint8Array(512); for(let i = 0; i < 256; ++i){ const e = i - 127; if(e < - 24){ baseTable[i] = 0x0000; baseTable[i | 0x100] = 0x8000; shiftTable[i] = 24; shiftTable[i | 0x100] = 24; } else if(e < - 14){ baseTable[i] = 0x0400 >> - e - 14; baseTable[i | 0x100] = 0x0400 >> - e - 14 | 0x8000; shiftTable[i] = - e - 1; shiftTable[i | 0x100] = - e - 1; } else if(e <= 15){ baseTable[i] = e + 15 << 10; baseTable[i | 0x100] = e + 15 << 10 | 0x8000; shiftTable[i] = 13; shiftTable[i | 0x100] = 13; } else if(e < 128){ baseTable[i] = 0x7c00; baseTable[i | 0x100] = 0xfc00; shiftTable[i] = 24; shiftTable[i | 0x100] = 24; } else{ baseTable[i] = 0x7c00; baseTable[i | 0x100] = 0xfc00; shiftTable[i] = 13; shiftTable[i | 0x100] = 13; } } const buffer = new ArrayBuffer(4), floatView = new Float32Array(buffer), uint32View = new Uint32Array(buffer); return function(num){ floatView[0] = roundToFloat16(num); const f = uint32View[0], e = f >> 23 & 0x1ff; return baseTable[e] + ((f & 0x007fffff) >> shiftTable[e]);}; } (), caml_unpackFloat16 = function(){ var pow = Math.pow, EXP_MASK16 = 31, SIGNIFICAND_MASK16 = 1023, MIN_SUBNORMAL16 = pow(2, - 24), SIGNIFICAND_DENOM16 = 0.0009765625; return function(bytes){ var sign = bytes >>> 15, exponent = bytes >>> 10 & EXP_MASK16, significand = bytes & SIGNIFICAND_MASK16; if(exponent === EXP_MASK16) return significand === 0 ? sign === 0 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : Number.NaN; if(exponent === 0) return significand * (sign === 0 ? MIN_SUBNORMAL16 : - MIN_SUBNORMAL16); var r = pow(2, exponent - 15) * (sign === 0 ? 1 + significand * SIGNIFICAND_DENOM16 : - 1 - significand * SIGNIFICAND_DENOM16); return r;}; } (); function caml_int64_create_lo_hi(lo, hi){ return new MlInt64 (lo & 0xffffff, lo >>> 24 & 0xff | (hi & 0xffff) << 8, hi >>> 16 & 0xffff); } function caml_int64_hi32(v){return v.hi32();} function caml_int64_lo32(v){return v.lo32();} function caml_array_bound_error(){ caml_invalid_argument("index out of bounds"); } var caml_ba_custom_name = "_bigarr02"; class Ml_Bigarray{ constructor(kind, layout, dims, buffer){ this.kind = kind; this.layout = layout; this.dims = dims; this.data = buffer; this.caml_custom = caml_ba_custom_name; } offset(arg){ var ofs = 0; if(typeof arg === "number") arg = [arg]; if(! Array.isArray(arg)) caml_invalid_argument("bigarray.js: invalid offset"); if(this.dims.length !== arg.length) caml_invalid_argument("Bigarray.get/set: bad number of dimensions"); if(this.layout === 0) for(var i = 0; i < this.dims.length; i++){ if(arg[i] < 0 || arg[i] >= this.dims[i]) caml_array_bound_error(); ofs = ofs * this.dims[i] + arg[i]; } else for(var i = this.dims.length - 1; i >= 0; i--){ if(arg[i] < 1 || arg[i] > this.dims[i]) caml_array_bound_error(); ofs = ofs * this.dims[i] + (arg[i] - 1); } return ofs; } get(ofs){ switch(this.kind){ case 7: var l = this.data[ofs * 2 + 0], h = this.data[ofs * 2 + 1]; return caml_int64_create_lo_hi(l, h); case 10: case 11: var r = this.data[ofs * 2 + 0], i = this.data[ofs * 2 + 1]; return [254, r, i]; case 13: return caml_unpackFloat16(this.data[ofs]); default: return this.data[ofs]; } } set(ofs, v){ switch(this.kind){ case 7: this.data[ofs * 2 + 0] = caml_int64_lo32(v); this.data[ofs * 2 + 1] = caml_int64_hi32(v); break; case 10: case 11: this.data[ofs * 2 + 0] = v[1]; this.data[ofs * 2 + 1] = v[2]; break; case 13: this.data[ofs] = caml_packFloat16(v); break; default: this.data[ofs] = v; break; } return 0; } fill(v){ switch(this.kind){ case 7: var a = caml_int64_lo32(v), b = caml_int64_hi32(v); if(a === b) this.data.fill(a); else for(var i = 0; i < this.data.length; i++) this.data[i] = i % 2 === 0 ? a : b; break; case 10: case 11: var im = v[1], re = v[2]; if(im === re) this.data.fill(im); else for(var i = 0; i < this.data.length; i++) this.data[i] = i % 2 === 0 ? im : re; break; case 13: this.data.fill(caml_packFloat16(v)); break; default: this.data.fill(v); break; } } compare(b, total){ if(this.layout !== b.layout || this.kind !== b.kind){ var k1 = this.kind | this.layout << 8, k2 = b.kind | b.layout << 8; return k2 - k1; } if(this.dims.length !== b.dims.length) return b.dims.length - this.dims.length; for(var i = 0; i < this.dims.length; i++) if(this.dims[i] !== b.dims[i]) return this.dims[i] < b.dims[i] ? - 1 : 1; switch(this.kind){ case 0: case 1: case 10: case 11: var x, y; for(var i = 0; i < this.data.length; i++){ x = this.data[i]; y = b.data[i]; if(x < y) return - 1; if(x > y) return 1; if(x !== y){ if(! total) return Number.NaN; if(! Number.isNaN(x)) return 1; if(! Number.isNaN(y)) return - 1; } } break; case 7: for(var i = 0; i < this.data.length; i += 2){ if(this.data[i + 1] < b.data[i + 1]) return - 1; if(this.data[i + 1] > b.data[i + 1]) return 1; if(this.data[i] >>> 0 < b.data[i] >>> 0) return - 1; if(this.data[i] >>> 0 > b.data[i] >>> 0) return 1; } break; case 13: for(var i = 0; i < this.data.length; i++){ var aa = caml_unpackFloat16(this.data[i]), bb = caml_unpackFloat16(b.data[i]); if(aa < bb) return - 1; if(aa > bb) return 1; } break; case 2: case 3: case 4: case 5: case 6: case 8: case 9: case 12: for(var i = 0; i < this.data.length; i++){ if(this.data[i] < b.data[i]) return - 1; if(this.data[i] > b.data[i]) return 1; } break; } return 0; } } class Ml_Bigarray_c_1_1 extends Ml_Bigarray { offset(arg){ if(typeof arg !== "number") if(Array.isArray(arg) && arg.length === 1) arg = arg[0]; else caml_invalid_argument("Ml_Bigarray_c_1_1.offset"); if(arg < 0 || arg >= this.dims[0]) caml_array_bound_error(); return arg; } get(ofs){return this.data[ofs];} set(ofs, v){this.data[ofs] = v; return 0;} fill(v){this.data.fill(v); return 0;} } function caml_string_of_uint8_array(a){ return caml_sub_uint8_array_to_jsbytes(a, 0, a.length); } class UInt8ArrayReader{ constructor(s, i){this.s = s; this.i = i;} read8u(){return this.s[this.i++];} read8s(){return this.s[this.i++] << 24 >> 24;} read16u(){ var s = this.s, i = this.i; this.i = i + 2; return s[i] << 8 | s[i + 1]; } read16s(){ var s = this.s, i = this.i; this.i = i + 2; return s[i] << 24 >> 16 | s[i + 1]; } read32u(){ var s = this.s, i = this.i; this.i = i + 4; return (s[i] << 24 | s[i + 1] << 16 | s[i + 2] << 8 | s[i + 3]) >>> 0; } read32s(){ var s = this.s, i = this.i; this.i = i + 4; return s[i] << 24 | s[i + 1] << 16 | s[i + 2] << 8 | s[i + 3]; } readstr(len){ var i = this.i; this.i = i + len; return caml_string_of_uint8_array(this.s.subarray(i, i + len)); } readuint8array(len){ var i = this.i; this.i = i + len; return this.s.subarray(i, i + len); } } function incr_nat(nat, ofs, len, carry_in){ var carry = carry_in; for(var i = 0; i < len; i++){ var x = (nat.data[ofs + i] >>> 0) + carry; nat.data[ofs + i] = x | 0; if(x === x >>> 0){carry = 0; break;} else carry = 1; } return carry; } function add_nat(nat1, ofs1, len1, nat2, ofs2, len2, carry_in){ var carry = carry_in; for(var i = 0; i < len2; i++){ var x = (nat1.data[ofs1 + i] >>> 0) + (nat2.data[ofs2 + i] >>> 0) + carry; nat1.data[ofs1 + i] = x; if(x === x >>> 0) carry = 0; else carry = 1; } return incr_nat(nat1, ofs1 + len2, len1 - len2, carry); } function caml_ba_get_size(dims){ var n_dims = dims.length, size = 1; for(var i = 0; i < n_dims; i++){ if(dims[i] < 0) caml_invalid_argument("Bigarray.create: negative dimension"); size = size * dims[i]; } return size; } function caml_ba_get_size_per_element(kind){ switch(kind){case 7:case 10:case 11: return 2;default: return 1; } } function caml_ba_create_unsafe(kind, layout, dims, data){ var size_per_element = caml_ba_get_size_per_element(kind); if(caml_ba_get_size(dims) * size_per_element !== data.length) caml_invalid_argument("length doesn't match dims"); if (layout === 0 && dims.length === 1 && size_per_element === 1 && kind !== 13) return new Ml_Bigarray_c_1_1(kind, layout, dims, data); return new Ml_Bigarray(kind, layout, dims, data); } function bigstring_of_array_buffer(ab){ var ta = new Uint8Array(ab); return caml_ba_create_unsafe(12, 0, [ta.length], ta); } function bigstring_of_typed_array(ba){ var ta = new Uint8Array (ba.buffer, ba.byteOffset, ba.length * ba.BYTES_PER_ELEMENT); return caml_ba_create_unsafe(12, 0, [ta.length], ta); } function bigstring_to_array_buffer(bs){return bs.data.buffer;} function bigstring_to_typed_array(bs){return bs.data;} var blake2b = function(){ function ADD64AA(v, a, b){ const o0 = v[a] + v[b]; let o1 = v[a + 1] + v[b + 1]; if(o0 >= 0x100000000) o1++; v[a] = o0; v[a + 1] = o1; } function ADD64AC(v, a, b0, b1){ let o0 = v[a] + b0; if(b0 < 0) o0 += 0x100000000; let o1 = v[a + 1] + b1; if(o0 >= 0x100000000) o1++; v[a] = o0; v[a + 1] = o1; } function B2B_GET32(arr, i){ return arr[i] ^ arr[i + 1] << 8 ^ arr[i + 2] << 16 ^ arr[i + 3] << 24; } function B2B_G(a, b, c, d, ix, iy){ const x0 = m[ix], x1 = m[ix + 1], y0 = m[iy], y1 = m[iy + 1]; ADD64AA(v, a, b); ADD64AC(v, a, x0, x1); let xor0 = v[d] ^ v[a], xor1 = v[d + 1] ^ v[a + 1]; v[d] = xor1; v[d + 1] = xor0; ADD64AA(v, c, d); xor0 = v[b] ^ v[c]; xor1 = v[b + 1] ^ v[c + 1]; v[b] = xor0 >>> 24 ^ xor1 << 8; v[b + 1] = xor1 >>> 24 ^ xor0 << 8; ADD64AA(v, a, b); ADD64AC(v, a, y0, y1); xor0 = v[d] ^ v[a]; xor1 = v[d + 1] ^ v[a + 1]; v[d] = xor0 >>> 16 ^ xor1 << 16; v[d + 1] = xor1 >>> 16 ^ xor0 << 16; ADD64AA(v, c, d); xor0 = v[b] ^ v[c]; xor1 = v[b + 1] ^ v[c + 1]; v[b] = xor1 >>> 31 ^ xor0 << 1; v[b + 1] = xor0 >>> 31 ^ xor1 << 1; } const BLAKE2B_IV32 = new Uint32Array ([0xf3bcc908, 0x6a09e667, 0x84caa73b, 0xbb67ae85, 0xfe94f82b, 0x3c6ef372, 0x5f1d36f1, 0xa54ff53a, 0xade682d1, 0x510e527f, 0x2b3e6c1f, 0x9b05688c, 0xfb41bd6b, 0x1f83d9ab, 0x137e2179, 0x5be0cd19]), SIGMA8 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3, 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4, 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8, 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13, 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9, 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11, 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10, 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5, 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3], SIGMA82 = new Uint8Array(SIGMA8.map(function(x){return x * 2;})), v = new Uint32Array(32), m = new Uint32Array(32); function blake2bCompress(ctx, last){ let i = 0; for(i = 0; i < 16; i++){ v[i] = ctx.h[i]; v[i + 16] = BLAKE2B_IV32[i]; } v[24] = v[24] ^ ctx.t; v[25] = v[25] ^ ctx.t / 0x100000000; if(last){v[28] = ~ v[28]; v[29] = ~ v[29];} for(i = 0; i < 32; i++) m[i] = B2B_GET32(ctx.b, 4 * i); for(i = 0; i < 12; i++){ B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]); B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]); B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]); B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]); B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]); B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]); B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]); B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]); } for(i = 0; i < 16; i++) ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16]; } const parameterBlock = new Uint8Array ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); function blake2bInit(outlen, key){ if(outlen === 0 || outlen > 64) throw new Error("Illegal output length, expected 0 < length <= 64"); if(key.length > 64) throw new Error ("Illegal key, expected Uint8Array with 0 < length <= 64"); const ctx = {b: new Uint8Array(128), h: new Uint32Array(16), t: 0, c: 0, outlen: outlen}; parameterBlock.fill(0); parameterBlock[0] = outlen; parameterBlock[1] = key.length; parameterBlock[2] = 1; parameterBlock[3] = 1; for(let i = 0; i < 16; i++) ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4); if(key.length > 0){blake2bUpdate(ctx, key); ctx.c = 128;} return ctx; } function blake2bUpdate(ctx, input){ for(let i = 0; i < input.length; i++){ if(ctx.c === 128){ ctx.t += ctx.c; blake2bCompress(ctx, false); ctx.c = 0; } ctx.b[ctx.c++] = input[i]; } } function blake2bFinal(ctx){ ctx.t += ctx.c; while(ctx.c < 128) ctx.b[ctx.c++] = 0; blake2bCompress(ctx, true); const out = new Uint8Array(ctx.outlen); for(let i = 0; i < ctx.outlen; i++) out[i] = ctx.h[i >> 2] >> 8 * (i & 3); return out; } return {Init: blake2bInit, Update: blake2bUpdate, Final: blake2bFinal}; } (); function blit_nat(nat1, ofs1, nat2, ofs2, len){ for(var i = 0; i < len; i++) nat1.data[ofs1 + i] = nat2.data[ofs2 + i]; return 0; } var caml_MD5Transform = function(){ function add(x, y){return x + y | 0;} function xx(q, a, b, x, s, t){ a = add(add(a, q), add(x, t)); return add(a << s | a >>> 32 - s, b); } function ff(a, b, c, d, x, s, t){ return xx(b & c | ~ b & d, a, b, x, s, t); } function gg(a, b, c, d, x, s, t){ return xx(b & d | c & ~ d, a, b, x, s, t); } function hh(a, b, c, d, x, s, t){return xx(b ^ c ^ d, a, b, x, s, t);} function ii(a, b, c, d, x, s, t){ return xx(c ^ (b | ~ d), a, b, x, s, t); } return function(w, buffer){ var a = w[0], b = w[1], c = w[2], d = w[3]; a = ff(a, b, c, d, buffer[0], 7, 0xd76aa478); d = ff(d, a, b, c, buffer[1], 12, 0xe8c7b756); c = ff(c, d, a, b, buffer[2], 17, 0x242070db); b = ff(b, c, d, a, buffer[3], 22, 0xc1bdceee); a = ff(a, b, c, d, buffer[4], 7, 0xf57c0faf); d = ff(d, a, b, c, buffer[5], 12, 0x4787c62a); c = ff(c, d, a, b, buffer[6], 17, 0xa8304613); b = ff(b, c, d, a, buffer[7], 22, 0xfd469501); a = ff(a, b, c, d, buffer[8], 7, 0x698098d8); d = ff(d, a, b, c, buffer[9], 12, 0x8b44f7af); c = ff(c, d, a, b, buffer[10], 17, 0xffff5bb1); b = ff(b, c, d, a, buffer[11], 22, 0x895cd7be); a = ff(a, b, c, d, buffer[12], 7, 0x6b901122); d = ff(d, a, b, c, buffer[13], 12, 0xfd987193); c = ff(c, d, a, b, buffer[14], 17, 0xa679438e); b = ff(b, c, d, a, buffer[15], 22, 0x49b40821); a = gg(a, b, c, d, buffer[1], 5, 0xf61e2562); d = gg(d, a, b, c, buffer[6], 9, 0xc040b340); c = gg(c, d, a, b, buffer[11], 14, 0x265e5a51); b = gg(b, c, d, a, buffer[0], 20, 0xe9b6c7aa); a = gg(a, b, c, d, buffer[5], 5, 0xd62f105d); d = gg(d, a, b, c, buffer[10], 9, 0x02441453); c = gg(c, d, a, b, buffer[15], 14, 0xd8a1e681); b = gg(b, c, d, a, buffer[4], 20, 0xe7d3fbc8); a = gg(a, b, c, d, buffer[9], 5, 0x21e1cde6); d = gg(d, a, b, c, buffer[14], 9, 0xc33707d6); c = gg(c, d, a, b, buffer[3], 14, 0xf4d50d87); b = gg(b, c, d, a, buffer[8], 20, 0x455a14ed); a = gg(a, b, c, d, buffer[13], 5, 0xa9e3e905); d = gg(d, a, b, c, buffer[2], 9, 0xfcefa3f8); c = gg(c, d, a, b, buffer[7], 14, 0x676f02d9); b = gg(b, c, d, a, buffer[12], 20, 0x8d2a4c8a); a = hh(a, b, c, d, buffer[5], 4, 0xfffa3942); d = hh(d, a, b, c, buffer[8], 11, 0x8771f681); c = hh(c, d, a, b, buffer[11], 16, 0x6d9d6122); b = hh(b, c, d, a, buffer[14], 23, 0xfde5380c); a = hh(a, b, c, d, buffer[1], 4, 0xa4beea44); d = hh(d, a, b, c, buffer[4], 11, 0x4bdecfa9); c = hh(c, d, a, b, buffer[7], 16, 0xf6bb4b60); b = hh(b, c, d, a, buffer[10], 23, 0xbebfbc70); a = hh(a, b, c, d, buffer[13], 4, 0x289b7ec6); d = hh(d, a, b, c, buffer[0], 11, 0xeaa127fa); c = hh(c, d, a, b, buffer[3], 16, 0xd4ef3085); b = hh(b, c, d, a, buffer[6], 23, 0x04881d05); a = hh(a, b, c, d, buffer[9], 4, 0xd9d4d039); d = hh(d, a, b, c, buffer[12], 11, 0xe6db99e5); c = hh(c, d, a, b, buffer[15], 16, 0x1fa27cf8); b = hh(b, c, d, a, buffer[2], 23, 0xc4ac5665); a = ii(a, b, c, d, buffer[0], 6, 0xf4292244); d = ii(d, a, b, c, buffer[7], 10, 0x432aff97); c = ii(c, d, a, b, buffer[14], 15, 0xab9423a7); b = ii(b, c, d, a, buffer[5], 21, 0xfc93a039); a = ii(a, b, c, d, buffer[12], 6, 0x655b59c3); d = ii(d, a, b, c, buffer[3], 10, 0x8f0ccc92); c = ii(c, d, a, b, buffer[10], 15, 0xffeff47d); b = ii(b, c, d, a, buffer[1], 21, 0x85845dd1); a = ii(a, b, c, d, buffer[8], 6, 0x6fa87e4f); d = ii(d, a, b, c, buffer[15], 10, 0xfe2ce6e0); c = ii(c, d, a, b, buffer[6], 15, 0xa3014314); b = ii(b, c, d, a, buffer[13], 21, 0x4e0811a1); a = ii(a, b, c, d, buffer[4], 6, 0xf7537e82); d = ii(d, a, b, c, buffer[11], 10, 0xbd3af235); c = ii(c, d, a, b, buffer[2], 15, 0x2ad7d2bb); b = ii(b, c, d, a, buffer[9], 21, 0xeb86d391); w[0] = add(a, w[0]); w[1] = add(b, w[1]); w[2] = add(c, w[2]); w[3] = add(d, w[3]);}; } (); function caml_MD5Final(ctx){ var in_buf = ctx.len & 0x3f; ctx.b8[in_buf] = 0x80; in_buf++; if(in_buf > 56){ for(var j = in_buf; j < 64; j++) ctx.b8[j] = 0; caml_MD5Transform(ctx.w, ctx.b32); for(var j = 0; j < 56; j++) ctx.b8[j] = 0; } else for(var j = in_buf; j < 56; j++) ctx.b8[j] = 0; ctx.b32[14] = ctx.len << 3; ctx.b32[15] = ctx.len >> 29 & 0x1fffffff; caml_MD5Transform(ctx.w, ctx.b32); var t = new Uint8Array(16); for(var i = 0; i < 4; i++) for(var j = 0; j < 4; j++) t[i * 4 + j] = ctx.w[i] >> 8 * j & 0xff; return t; } function caml_MD5Init(){ var buffer = new ArrayBuffer(64), b32 = new Uint32Array(buffer), b8 = new Uint8Array(buffer); return {len: 0, w: new Uint32Array([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]), b32: b32, b8: b8}; } function caml_MD5Update(ctx, input, input_len){ var in_buf = ctx.len & 0x3f, input_pos = 0; ctx.len += input_len; if(in_buf){ var missing = 64 - in_buf; if(input_len < missing){ ctx.b8.set(input.subarray(0, input_len), in_buf); return; } ctx.b8.set(input.subarray(0, missing), in_buf); caml_MD5Transform(ctx.w, ctx.b32); input_len -= missing; input_pos += missing; } while(input_len >= 64){ ctx.b8.set(input.subarray(input_pos, input_pos + 64), 0); caml_MD5Transform(ctx.w, ctx.b32); input_len -= 64; input_pos += 64; } if(input_len) ctx.b8.set(input.subarray(input_pos, input_pos + input_len), 0); } function caml_acosh_float(x){return Math.acosh(x);} function caml_call_gen(f, args){ var n = f.l >= 0 ? f.l : f.l = f.length, argsLen = args.length, d = n - argsLen; if(d === 0) return f(...args); else if(d < 0){ var g = f(...args.slice(0, n)); if(typeof g !== "function") return g; return caml_call_gen(g, args.slice(n)); } else{ switch(d){ case 1: { var g = function(x){ var nargs = new Array(argsLen + 1); for(var i = 0; i < argsLen; i++) nargs[i] = args[i]; nargs[argsLen] = x; return f(...nargs); }; break; } case 2: { var g = function(x, y){ var nargs = new Array(argsLen + 2); for(var i = 0; i < argsLen; i++) nargs[i] = args[i]; nargs[argsLen] = x; nargs[argsLen + 1] = y; return f(...nargs); }; break; } default: var g = function(...extra_args){ if(extra_args.length === 0) extra_args = [undefined]; return caml_call_gen(f, args.concat(extra_args)); }; } g.l = d; return g; } } function caml_alloc_dummy_infix(){ return function f(x){return caml_call_gen(f.fun, [x]);}; } function caml_alloc_stack(_hv, _hx, _hf){return 0;} var caml_argv = function(){ var process = globalThis.process, main = "a.out", args = []; if(process?.argv?.length > 1){ var argv = process.argv; main = argv[1]; args = argv.slice(2); } var p = caml_string_of_jsstring(main), args2 = [0, p]; for(var i = 0; i < args.length; i++) args2.push(caml_string_of_jsstring(args[i])); return args2; } (); function caml_array_append(a1, a2){ var l1 = a1.length, l2 = a2.length, l = l1 + l2 - 1, a = new Array(l); a[0] = 0; var i = 1, j = 1; for(; i < l1; i++) a[i] = a1[i]; for(; i < l; i++, j++) a[i] = a2[j]; return a; } function caml_array_blit(a1, i1, a2, i2, len){ if(i2 <= i1) for(var j = 1; j <= len; j++) a2[i2 + j] = a1[i1 + j]; else for(var j = len; j >= 1; j--) a2[i2 + j] = a1[i1 + j]; return 0; } function caml_array_concat(l){ var a = [0]; while(l !== 0){ var b = l[1]; for(var i = 1; i < b.length; i++) a.push(b[i]); l = l[2]; } return a; } function caml_array_fill(array, ofs, len, v){ for(var i = 0; i < len; i++) array[ofs + i + 1] = v; return 0; } function caml_array_get(array, index){ if(index < 0 || index >= array.length - 1) caml_array_bound_error(); return array[index + 1]; } function caml_array_make(len, init){ if(len >>> 0 >= (0x7fffffff / 4 | 0)) caml_array_bound_error(); var len = len + 1 | 0, b = new Array(len); b[0] = 0; for(var i = 1; i < len; i++) b[i] = init; return b; } function caml_array_of_bytes(x){return caml_uint8_array_of_bytes(x);} function caml_array_of_string(x){return caml_uint8_array_of_string(x);} function caml_array_set(array, index, newval){ if(index < 0 || index >= array.length - 1) caml_array_bound_error(); array[index + 1] = newval; return 0; } function caml_array_sub(a, i, len){ var a2 = new Array(len + 1); a2[0] = 0; for(var i2 = 1, i1 = i + 1; i2 <= len; i2++, i1++) a2[i2] = a[i1]; return a2; } function caml_asinh_float(x){return Math.asinh(x);} function caml_atanh_float(x){return Math.atanh(x);} function caml_atomic_cas(ref, o, n){ if(ref[1] === o){ref[1] = n; return 1;} return 0; } function caml_atomic_exchange(ref, v){ var r = ref[1]; ref[1] = v; return r; } function caml_atomic_fetch_add(ref, i){ var old = ref[1]; ref[1] += i; return old; } function caml_atomic_load(ref){return ref[1];} function caml_atomic_make_contended(a){return [0, a];} function caml_ba_blit(src, dst){ if(dst.dims.length !== src.dims.length) caml_invalid_argument("Bigarray.blit: dimension mismatch"); for(var i = 0; i < dst.dims.length; i++) if(dst.dims[i] !== src.dims[i]) caml_invalid_argument("Bigarray.blit: dimension mismatch"); dst.data.set(src.data); return 0; } function caml_ba_change_layout(ba, layout){ if(ba.layout === layout) return ba; var new_dims = []; for(var i = 0; i < ba.dims.length; i++) new_dims[i] = ba.dims[ba.dims.length - i - 1]; return caml_ba_create_unsafe(ba.kind, layout, new_dims, ba.data); } function caml_ba_compare(a, b, total){return a.compare(b, total);} function caml_ba_create_buffer(kind, size){ var view; switch(kind){ case 0: view = Float32Array; break; case 1: view = Float64Array; break; case 2: view = Int8Array; break; case 3: view = Uint8Array; break; case 4: view = Int16Array; break; case 5: view = Uint16Array; break; case 6: view = Int32Array; break; case 7: view = Int32Array; break; case 8: view = Int32Array; break; case 9: view = Int32Array; break; case 10: view = Float32Array; break; case 11: view = Float64Array; break; case 12: view = Uint8Array; break; case 13: view = Uint16Array; break; } if(! view) caml_invalid_argument("Bigarray.create: unsupported kind"); var data = new view(size * caml_ba_get_size_per_element(kind)); return data; } function caml_js_from_array(a){return a.slice(1);} function caml_ba_create(kind, layout, dims_ml){ var dims = caml_js_from_array(dims_ml), data = caml_ba_create_buffer(kind, caml_ba_get_size(dims)); return caml_ba_create_unsafe(kind, layout, dims, data); } function caml_ba_create_from(data1, data2, _jstyp, kind, layout, dims){ if(data2 || caml_ba_get_size_per_element(kind) === 2) caml_invalid_argument ("caml_ba_create_from: use return caml_ba_create_unsafe"); return caml_ba_create_unsafe(kind, layout, dims, data1); } var jsoo_dataview = new DataView(new ArrayBuffer(8)); function caml_int32_float_of_bits(x){ jsoo_dataview.setUint32(0, x, true); return jsoo_dataview.getFloat32(0, true); } function caml_int64_of_bytes(a){ return new MlInt64 (a[7] << 0 | a[6] << 8 | a[5] << 16, a[4] << 0 | a[3] << 8 | a[2] << 16, a[1] << 0 | a[0] << 8); } function caml_int64_float_of_bits(x){ var lo = x.lo, mi = x.mi, hi = x.hi; if((hi & 0x7ff8) === 0x7ff0 && (mi | lo | hi & 0xf) !== 0) hi |= 8; jsoo_dataview.setUint32(0, lo | mi << 24, true); jsoo_dataview.setUint32(4, mi >>> 8 | hi << 16, true); return jsoo_dataview.getFloat64(0, true); } function caml_failwith(msg){ if(! caml_global_data.Failure) caml_global_data.Failure = [248, caml_string_of_jsbytes("Failure"), - 3]; caml_raise_with_string(caml_global_data.Failure, msg); } function caml_ba_deserialize(reader, sz, name){ var num_dims = reader.read32s(); if(num_dims < 0 || num_dims > 16) caml_failwith("input_value: wrong number of bigarray dimensions"); var tag = reader.read32s(), kind = tag & 0xff, layout = tag >> 8 & 1, dims = []; if(name === "_bigarr02") for(var i = 0; i < num_dims; i++){ var size_dim = reader.read16u(); if(size_dim === 0xffff){ var size_dim_hi = reader.read32u(), size_dim_lo = reader.read32u(); if(size_dim_hi !== 0) caml_failwith("input_value: bigarray dimension overflow in 32bit"); size_dim = size_dim_lo; } dims.push(size_dim); } else for(var i = 0; i < num_dims; i++) dims.push(reader.read32u()); var size = caml_ba_get_size(dims), data = caml_ba_create_buffer(kind, size), ba = caml_ba_create_unsafe(kind, layout, dims, data); switch(kind){ case 2: for(var i = 0; i < size; i++) data[i] = reader.read8s(); break; case 3: case 12: for(var i = 0; i < size; i++) data[i] = reader.read8u(); break; case 4: for(var i = 0; i < size; i++) data[i] = reader.read16s(); break; case 5: for(var i = 0; i < size; i++) data[i] = reader.read16u(); break; case 6: for(var i = 0; i < size; i++) data[i] = reader.read32s(); break; case 8: case 9: var sixty = reader.read8u(); if(sixty) caml_failwith ("input_value: cannot read bigarray with 64-bit OCaml ints"); for(var i = 0; i < size; i++) data[i] = reader.read32s(); break; case 7: var t = new Array(8); for(var i = 0; i < size; i++){ for(var j = 0; j < 8; j++) t[j] = reader.read8u(); var int64 = caml_int64_of_bytes(t); ba.set(i, int64); } break; case 1: var t = new Array(8); for(var i = 0; i < size; i++){ for(var j = 0; j < 8; j++) t[j] = reader.read8u(); var f = caml_int64_float_of_bits(caml_int64_of_bytes(t)); ba.set(i, f); } break; case 13: for(var i = 0; i < size; i++) data[i] = reader.read16u(); break; case 0: for(var i = 0; i < size; i++){ var f = caml_int32_float_of_bits(reader.read32s()); ba.set(i, f); } break; case 10: for(var i = 0; i < size; i++){ var re = caml_int32_float_of_bits(reader.read32s()), im = caml_int32_float_of_bits(reader.read32s()); ba.set(i, [254, re, im]); } break; case 11: var t = new Array(8); for(var i = 0; i < size; i++){ for(var j = 0; j < 8; j++) t[j] = reader.read8u(); var re = caml_int64_float_of_bits(caml_int64_of_bytes(t)); for(var j = 0; j < 8; j++) t[j] = reader.read8u(); var im = caml_int64_float_of_bits(caml_int64_of_bytes(t)); ba.set(i, [254, re, im]); } break; } sz[0] = (4 + num_dims) * 4; return caml_ba_create_unsafe(kind, layout, dims, data); } function caml_ba_dim(ba, i){ if(i < 0 || i >= ba.dims.length) caml_invalid_argument("Bigarray.dim"); return ba.dims[i]; } function caml_ba_dim_1(ba){return caml_ba_dim(ba, 0);} function caml_ba_dim_2(ba){return caml_ba_dim(ba, 1);} function caml_ba_dim_3(ba){return caml_ba_dim(ba, 2);} function caml_ba_fill(ba, v){ba.fill(v); return 0;} function caml_ba_kind_of_typed_array(ta){ var kind; if(ta instanceof Float32Array) kind = 0; else if(ta instanceof Float64Array) kind = 1; else if(ta instanceof Int8Array) kind = 2; else if(ta instanceof Uint8Array) kind = 3; else if(ta instanceof Uint8ClampedArray) kind = 3; else if(ta instanceof Int16Array) kind = 4; else if(ta instanceof Uint16Array) kind = 5; else if(ta instanceof Int32Array) kind = 6; else if(ta instanceof Uint32Array) kind = 6; else caml_invalid_argument("caml_ba_kind_of_typed_array: unsupported kind"); return kind; } function caml_ba_from_typed_array(ta){ var kind = caml_ba_kind_of_typed_array(ta), ta = ta instanceof Uint32Array ? new Int32Array(ta.buffer, ta.byteOffset, ta.length) : ta; return caml_ba_create_unsafe(kind, 0, [ta.length], ta); } function caml_ba_get_1(ba, i0){return ba.get(ba.offset(i0));} function caml_ba_get_2(ba, i0, i1){return ba.get(ba.offset([i0, i1]));} function caml_ba_get_3(ba, i0, i1, i2){ return ba.get(ba.offset([i0, i1, i2])); } function caml_ba_get_generic(ba, i){ var ofs = ba.offset(caml_js_from_array(i)); return ba.get(ofs); } function caml_mul(a, b){return Math.imul(a, b);} function caml_hash_mix_int(h, d){ d = caml_mul(d, 0xcc9e2d51 | 0); d = d << 15 | d >>> 32 - 15; d = caml_mul(d, 0x1b873593); h ^= d; h = h << 13 | h >>> 32 - 13; return (h + (h << 2) | 0) + (0xe6546b64 | 0) | 0; } function caml_hash_mix_float16(hash, d){ if((d & 0x7c00) === 0x7c00 && (d & 0x03ff) !== 0) d = 0x7c01; else if(d === 0x8000) d = 0; return caml_hash_mix_int(hash, d); } function caml_int32_bits_of_float(x){ jsoo_dataview.setFloat32(0, x, true); return jsoo_dataview.getUint32(0, true) | 0; } function caml_hash_mix_float32(hash, v){ var i = caml_int32_bits_of_float(v); if((i & 0x7f800000) === 0x7f800000 && (i & 0x7fffff) !== 0) i = 0x7f800001; else if(i === (0x80000000 | 0)) i = 0; hash = caml_hash_mix_int(hash, i); return hash; } function caml_int64_create_lo_mi_hi(lo, mi, hi){return new MlInt64(lo, mi, hi); } function caml_int64_bits_of_float(x){ jsoo_dataview.setFloat64(0, x, true); var lo32 = jsoo_dataview.getUint32(0, true), hi32 = jsoo_dataview.getUint32(4, true), lo = lo32 & 0xffffff, mi = lo32 >>> 24 | hi32 << 8 & 0xffffff, hi = hi32 >>> 16 & 0xffff; if((hi & 0x7ff8) === 0x7ff0 && (mi | lo | hi & 0xf) !== 0) hi |= 8; return caml_int64_create_lo_mi_hi(lo, mi, hi); } function caml_hash_mix_float(hash, v0){ var i64 = caml_int64_bits_of_float(v0), l = caml_int64_lo32(i64), h = caml_int64_hi32(i64); if((h & 0x7ff00000) === 0x7ff00000 && (l | h & 0xfffff) !== 0){h = 0x7ff00000; l = 0x00000001;} else if(h === (0x80000000 | 0) && l === 0) h = 0; hash = caml_hash_mix_int(hash, l); hash = caml_hash_mix_int(hash, h); return hash; } function caml_ba_hash(ba){ var num_elts = caml_ba_get_size(ba.dims), h = 0; switch(ba.kind){ case 2: case 3: case 12: if(num_elts > 256) num_elts = 256; var w = 0, i = 0; for(i = 0; i + 4 <= num_elts; i += 4){ w = ba.data[i + 0] & 0xff | (ba.data[i + 1] & 0xff) << 8 | (ba.data[i + 2] & 0xff) << 16 | ba.data[i + 3] << 24; h = caml_hash_mix_int(h, w); } w = 0; switch(num_elts & 3){ case 3: w = ba.data[i + 2] << 16; case 2: w |= ba.data[i + 1] << 8; case 1: w |= ba.data[i + 0]; h = caml_hash_mix_int(h, w); } break; case 4: case 5: if(num_elts > 128) num_elts = 128; var w = 0, i = 0; for(i = 0; i + 2 <= num_elts; i += 2){ w = ba.data[i + 0] & 0xffff | ba.data[i + 1] << 16; h = caml_hash_mix_int(h, w); } if((num_elts & 1) !== 0) h = caml_hash_mix_int(h, ba.data[i]); break; case 6: if(num_elts > 64) num_elts = 64; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_int(h, ba.data[i]); break; case 8: case 9: if(num_elts > 64) num_elts = 64; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_int(h, ba.data[i]); break; case 7: if(num_elts > 32) num_elts = 32; num_elts *= 2; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_int(h, ba.data[i]); break; case 10: num_elts *= 2; case 0: if(num_elts > 64) num_elts = 64; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_float32(h, ba.data[i]); break; case 11: num_elts *= 2; case 1: if(num_elts > 32) num_elts = 32; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_float(h, ba.data[i]); break; case 13: if(num_elts > 128) num_elts = 128; for(var i = 0; i < num_elts; i++) h = caml_hash_mix_float16(h, ba.data[i]); break; } return h; } function caml_ba_init(){return 0;} function caml_ba_kind(ba){return ba.kind;} function caml_ba_layout(ba){return ba.layout;} function caml_ba_map_file(_vfd, _kind, _layout, _shared, _dims, _pos){caml_failwith("caml_ba_map_file not implemented"); } function caml_ba_map_file_bytecode(argv, _argn){ return caml_ba_map_file (argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); } function caml_ba_num_dims(ba){return ba.dims.length;} function caml_ba_reshape(ba, vind){ vind = caml_js_from_array(vind); var new_dim = [], num_dims = vind.length; if(num_dims < 0 || num_dims > 16) caml_invalid_argument("Bigarray.reshape: bad number of dimensions"); var num_elts = 1; for(var i = 0; i < num_dims; i++){ new_dim[i] = vind[i]; if(new_dim[i] < 0) caml_invalid_argument("Bigarray.reshape: negative dimension"); num_elts = num_elts * new_dim[i]; } var size = caml_ba_get_size(ba.dims); if(num_elts !== size) caml_invalid_argument("Bigarray.reshape: size mismatch"); return caml_ba_create_unsafe(ba.kind, ba.layout, new_dim, ba.data); } function caml_int64_to_bytes(x){return x.toArray();} function caml_ba_serialize(writer, ba, sz){ writer.write(32, ba.dims.length); writer.write(32, ba.kind | ba.layout << 8); if(ba.caml_custom === "_bigarr02") for(var i = 0; i < ba.dims.length; i++) if(ba.dims[i] < 0xffff) writer.write(16, ba.dims[i]); else{ writer.write(16, 0xffff); writer.write(32, 0); writer.write(32, ba.dims[i]); } else for(var i = 0; i < ba.dims.length; i++) writer.write(32, ba.dims[i]); switch(ba.kind){ case 2: case 3: case 12: for(var i = 0; i < ba.data.length; i++) writer.write(8, ba.data[i]); break; case 4: case 5: for(var i = 0; i < ba.data.length; i++) writer.write(16, ba.data[i]); break; case 6: for(var i = 0; i < ba.data.length; i++) writer.write(32, ba.data[i]); break; case 8: case 9: writer.write(8, 0); for(var i = 0; i < ba.data.length; i++) writer.write(32, ba.data[i]); break; case 7: for(var i = 0; i < ba.data.length / 2; i++){ var b = caml_int64_to_bytes(ba.get(i)); for(var j = 0; j < 8; j++) writer.write(8, b[j]); } break; case 1: for(var i = 0; i < ba.data.length; i++){ var b = caml_int64_to_bytes(caml_int64_bits_of_float(ba.get(i))); for(var j = 0; j < 8; j++) writer.write(8, b[j]); } break; case 13: for(var i = 0; i < ba.data.length; i++) writer.write(16, ba.data[i]); break; case 0: for(var i = 0; i < ba.data.length; i++){ var b = caml_int32_bits_of_float(ba.get(i)); writer.write(32, b); } break; case 10: for(var i = 0; i < ba.data.length / 2; i++){ var j = ba.get(i); writer.write(32, caml_int32_bits_of_float(j[1])); writer.write(32, caml_int32_bits_of_float(j[2])); } break; case 11: for(var i = 0; i < ba.data.length / 2; i++){ var complex = ba.get(i), b = caml_int64_to_bytes(caml_int64_bits_of_float(complex[1])); for(var j = 0; j < 8; j++) writer.write(8, b[j]); var b = caml_int64_to_bytes(caml_int64_bits_of_float(complex[2])); for(var j = 0; j < 8; j++) writer.write(8, b[j]); } break; } sz[0] = (4 + ba.dims.length) * 4; sz[1] = (4 + ba.dims.length) * 8; } function caml_ba_set_1(ba, i0, v){ba.set(ba.offset(i0), v); return 0;} function caml_ba_set_2(ba, i0, i1, v){ ba.set(ba.offset([i0, i1]), v); return 0; } function caml_ba_set_3(ba, i0, i1, i2, v){ ba.set(ba.offset([i0, i1, i2]), v); return 0; } function caml_ba_set_generic(ba, i, v){ ba.set(ba.offset(caml_js_from_array(i)), v); return 0; } function caml_ba_slice(ba, vind){ vind = caml_js_from_array(vind); var num_inds = vind.length, index = [], sub_dims = [], ofs; if(num_inds > ba.dims.length) caml_invalid_argument("Bigarray.slice: too many indices"); if(ba.layout === 0){ for(var i = 0; i < num_inds; i++) index[i] = vind[i]; for(; i < ba.dims.length; i++) index[i] = 0; sub_dims = ba.dims.slice(num_inds); } else{ for(var i = 0; i < num_inds; i++) index[ba.dims.length - num_inds + i] = vind[i]; for(var i = 0; i < ba.dims.length - num_inds; i++) index[i] = 1; sub_dims = ba.dims.slice(0, ba.dims.length - num_inds); } ofs = ba.offset(index); var size = caml_ba_get_size(sub_dims), size_per_element = caml_ba_get_size_per_element(ba.kind), new_data = ba.data.subarray (ofs * size_per_element, (ofs + size) * size_per_element); return caml_ba_create_unsafe(ba.kind, ba.layout, sub_dims, new_data); } function caml_ba_sub(ba, ofs, len){ var changed_dim, mul = 1; if(ba.layout === 0){ for(var i = 1; i < ba.dims.length; i++) mul = mul * ba.dims[i]; changed_dim = 0; } else{ for(var i = 0; i < ba.dims.length - 1; i++) mul = mul * ba.dims[i]; changed_dim = ba.dims.length - 1; ofs = ofs - 1; } if(ofs < 0 || len < 0 || ofs + len > ba.dims[changed_dim]) caml_invalid_argument("Bigarray.sub: bad sub-array"); var new_dims = []; for(var i = 0; i < ba.dims.length; i++) new_dims[i] = ba.dims[i]; new_dims[changed_dim] = len; mul *= caml_ba_get_size_per_element(ba.kind); var new_data = ba.data.subarray(ofs * mul, (ofs + len) * mul); return caml_ba_create_unsafe(ba.kind, ba.layout, new_dims, new_data); } function caml_ba_to_typed_array(ba){return ba.data;} function caml_ba_uint8_get16(ba, i0){ var ofs = ba.offset(i0); if(ofs + 1 >= ba.data.length) caml_array_bound_error(); var b1 = ba.get(ofs), b2 = ba.get(ofs + 1); return b1 | b2 << 8; } function caml_ba_uint8_get32(ba, i0){ var ofs = ba.offset(i0); if(ofs + 3 >= ba.data.length) caml_array_bound_error(); var b1 = ba.get(ofs + 0), b2 = ba.get(ofs + 1), b3 = ba.get(ofs + 2), b4 = ba.get(ofs + 3); return b1 << 0 | b2 << 8 | b3 << 16 | b4 << 24; } function caml_ba_uint8_get64(ba, i0){ var ofs = ba.offset(i0); if(ofs + 7 >= ba.data.length) caml_array_bound_error(); var b1 = ba.get(ofs + 0), b2 = ba.get(ofs + 1), b3 = ba.get(ofs + 2), b4 = ba.get(ofs + 3), b5 = ba.get(ofs + 4), b6 = ba.get(ofs + 5), b7 = ba.get(ofs + 6), b8 = ba.get(ofs + 7); return caml_int64_of_bytes([b8, b7, b6, b5, b4, b3, b2, b1]); } function caml_ba_uint8_set16(ba, i0, v){ var ofs = ba.offset(i0); if(ofs + 1 >= ba.data.length) caml_array_bound_error(); ba.set(ofs + 0, v & 0xff); ba.set(ofs + 1, v >>> 8 & 0xff); return 0; } function caml_ba_uint8_set32(ba, i0, v){ var ofs = ba.offset(i0); if(ofs + 3 >= ba.data.length) caml_array_bound_error(); ba.set(ofs + 0, v & 0xff); ba.set(ofs + 1, v >>> 8 & 0xff); ba.set(ofs + 2, v >>> 16 & 0xff); ba.set(ofs + 3, v >>> 24 & 0xff); return 0; } function caml_ba_uint8_set64(ba, i0, v){ var ofs = ba.offset(i0); if(ofs + 7 >= ba.data.length) caml_array_bound_error(); var v = caml_int64_to_bytes(v); for(var i = 0; i < 8; i++) ba.set(ofs + i, v[7 - i]); return 0; } function caml_backtrace_status(_unit){ return caml_record_backtrace_runtime_flag ? 1 : 0; } function caml_bigstring_blit_ba_to_ba(ba1, pos1, ba2, pos2, len){ if(12 !== ba1.kind) caml_invalid_argument("caml_bigstring_blit_ba_to_ba: kind mismatch"); if(12 !== ba2.kind) caml_invalid_argument("caml_bigstring_blit_ba_to_ba: kind mismatch"); if(len === 0) return 0; var ofs1 = ba1.offset(pos1), ofs2 = ba2.offset(pos2); if(ofs1 + len > ba1.data.length) caml_array_bound_error(); if(ofs2 + len > ba2.data.length) caml_array_bound_error(); var slice = ba1.data.subarray(ofs1, ofs1 + len); ba2.data.set(slice, pos2); return 0; } function caml_bigstring_blit_ba_to_bytes(ba1, pos1, bytes2, pos2, len){ if(12 !== ba1.kind) caml_invalid_argument("caml_bigstring_blit_string_to_ba: kind mismatch"); if(len === 0) return 0; var ofs1 = ba1.offset(pos1); if(ofs1 + len > ba1.data.length) caml_array_bound_error(); if(pos2 + len > caml_ml_bytes_length(bytes2)) caml_array_bound_error(); var slice = ba1.data.subarray(ofs1, ofs1 + len); caml_blit_bytes(caml_bytes_of_uint8_array(slice), 0, bytes2, pos2, len); return 0; } function caml_bigstring_blit_bytes_to_ba(str1, pos1, ba2, pos2, len){ if(12 !== ba2.kind) caml_invalid_argument("caml_bigstring_blit_string_to_ba: kind mismatch"); if(len === 0) return 0; var ofs2 = ba2.offset(pos2); if(pos1 + len > caml_ml_bytes_length(str1)) caml_array_bound_error(); if(ofs2 + len > ba2.data.length) caml_array_bound_error(); var slice = caml_uint8_array_of_bytes(str1).subarray(pos1, pos1 + len); ba2.data.set(slice, ofs2); return 0; } function caml_bigstring_blit_string_to_ba(str1, pos1, ba2, pos2, len){ if(12 !== ba2.kind) caml_invalid_argument("caml_bigstring_blit_string_to_ba: kind mismatch"); if(len === 0) return 0; var ofs2 = ba2.offset(pos2); if(pos1 + len > caml_ml_string_length(str1)) caml_array_bound_error(); if(ofs2 + len > ba2.data.length) caml_array_bound_error(); var slice = caml_uint8_array_of_string(str1).subarray(pos1, pos1 + len); ba2.data.set(slice, ofs2); return 0; } function caml_bigstring_memcmp(s1, pos1, s2, pos2, len){ for(var i = 0; i < len; i++){ var a = caml_ba_get_1(s1, pos1 + i), b = caml_ba_get_1(s2, pos2 + i); if(a < b) return - 1; if(a > b) return 1; } return 0; } function caml_blake2_create(hashlen, key){ key = caml_uint8_array_of_string(key); if(key.length > 64) key.subarray(0, 64); return blake2b.Init(hashlen, key); } function caml_blake2_final(ctx, _hashlen){ var r = blake2b.Final(ctx); return caml_string_of_uint8_array(r); } function caml_blake2_update(ctx, buf, ofs, len){ var input = caml_uint8_array_of_string(buf); input = input.subarray(ofs, ofs + len); blake2b.Update(ctx, input); return 0; } function caml_blake2_string(hashlen, key, buf, ofs, len){ var ctx = caml_blake2_create(hashlen, key); caml_blake2_update(ctx, buf, ofs, len); return caml_blake2_final(ctx, hashlen); } function caml_blit_string(a, b, c, d, e){ caml_blit_bytes(caml_bytes_of_string(a), b, c, d, e); return 0; } function caml_bswap16(x){return (x & 0x00ff) << 8 | (x & 0xff00) >> 8;} var jsoo_text_decoder_buff = new ArrayBuffer(1024); function caml_jsstring_of_string(s){ if(jsoo_is_ascii(s)) return s; var a = s.length <= jsoo_text_decoder_buff.length ? new Uint8Array(jsoo_text_decoder_buff, 0, s.length) : new Uint8Array(s.length); for(var i = 0; i < s.length; i++) a[i] = s.charCodeAt(i); return jsoo_text_decoder.decode(a); } function caml_build_symbols(symb){ var r = {}, max = - 1; if(symb) for(var i = 1; i < symb.length; i++){ var idx = symb[i][2]; max = Math.max(max, idx); r[caml_jsstring_of_string(symb[i][1])] = idx; } r.next_idx = max + 1; return r; } function caml_bytes_compare(s1, s2){ s1.t & 6 && caml_convert_string_to_bytes(s1); s2.t & 6 && caml_convert_string_to_bytes(s2); return s1.c < s2.c ? - 1 : s1.c > s2.c ? 1 : 0; } function caml_bytes_equal(s1, s2){ if(s1 === s2) return 1; s1.t & 6 && caml_convert_string_to_bytes(s1); s2.t & 6 && caml_convert_string_to_bytes(s2); return s1.c === s2.c ? 1 : 0; } function caml_bytes_unsafe_get(s, i){ switch(s.t & 6){ case 0: return s.c.charCodeAt(i); case 2: if(i >= s.c.length) return 0; return s.c.charCodeAt(i); case 4: return s.c[i]; } } function caml_bytes_get(s, i){ if(i >>> 0 >= s.l) caml_bytes_bound_error(); return caml_bytes_unsafe_get(s, i); } function caml_bytes_get16(s, i){ if(i >>> 0 >= s.l - 1) caml_bytes_bound_error(); var b1 = caml_bytes_unsafe_get(s, i), b2 = caml_bytes_unsafe_get(s, i + 1); return b2 << 8 | b1; } function caml_bytes_get32(s, i){ if(i >>> 0 >= s.l - 3) caml_bytes_bound_error(); var b1 = caml_bytes_unsafe_get(s, i), b2 = caml_bytes_unsafe_get(s, i + 1), b3 = caml_bytes_unsafe_get(s, i + 2), b4 = caml_bytes_unsafe_get(s, i + 3); return b4 << 24 | b3 << 16 | b2 << 8 | b1; } function caml_bytes_get64(s, i){ if(i >>> 0 >= s.l - 7) caml_bytes_bound_error(); var a = new Array(8); for(var j = 0; j < 8; j++) a[7 - j] = caml_bytes_unsafe_get(s, i + j); return caml_int64_of_bytes(a); } function caml_bytes_lessequal(s1, s2){ s1.t & 6 && caml_convert_string_to_bytes(s1); s2.t & 6 && caml_convert_string_to_bytes(s2); return s1.c <= s2.c ? 1 : 0; } function caml_bytes_greaterequal(s1, s2){return caml_bytes_lessequal(s2, s1); } function caml_bytes_lessthan(s1, s2){ s1.t & 6 && caml_convert_string_to_bytes(s1); s2.t & 6 && caml_convert_string_to_bytes(s2); return s1.c < s2.c ? 1 : 0; } function caml_bytes_greaterthan(s1, s2){return caml_bytes_lessthan(s2, s1); } function caml_bytes_notequal(s1, s2){return 1 - caml_bytes_equal(s1, s2);} function caml_bytes_of_utf16_jsstring(s){ if(jsoo_is_ascii(s)) return new MlBytes(9, s, s.length); else{ var a = jsoo_text_encoder.encode(s); return new MlBytes(4, a, a.length); } } function caml_bytes_set16(s, i, i16){ if(i >>> 0 >= s.l - 1) caml_bytes_bound_error(); var b2 = 0xff & i16 >> 8, b1 = 0xff & i16; caml_bytes_unsafe_set(s, i + 0, b1); caml_bytes_unsafe_set(s, i + 1, b2); return 0; } function caml_bytes_set32(s, i, i32){ if(i >>> 0 >= s.l - 3) caml_bytes_bound_error(); var b4 = 0xff & i32 >> 24, b3 = 0xff & i32 >> 16, b2 = 0xff & i32 >> 8, b1 = 0xff & i32; caml_bytes_unsafe_set(s, i + 0, b1); caml_bytes_unsafe_set(s, i + 1, b2); caml_bytes_unsafe_set(s, i + 2, b3); caml_bytes_unsafe_set(s, i + 3, b4); return 0; } function caml_bytes_set64(s, i, i64){ if(i >>> 0 >= s.l - 7) caml_bytes_bound_error(); var a = caml_int64_to_bytes(i64); for(var j = 0; j < 8; j++) caml_bytes_unsafe_set(s, i + 7 - j, a[j]); return 0; } var caml_callback = caml_call_gen; function caml_cbrt_float(x){return Math.cbrt(x);} class caml_ml_channels_state{ constructor(){ this.map = new globalThis.WeakMap(); this.opened = new globalThis.Set(); } close(chanid){this.opened.delete(chanid);} get(chanid){return this.map.get(chanid);} set(chanid, val){ if(val.opened) this.opened.add(chanid); return this.map.set(chanid, val); } all(){return this.opened.values();} } var caml_ml_channels = new caml_ml_channels_state(); function caml_ml_channel_get(id){return caml_ml_channels.get(id);} function caml_channel_descriptor(chanid){ var chan = caml_ml_channel_get(chanid); return chan.fd; } function caml_check_bound(array, index){ if(index >>> 0 >= array.length - 1) caml_array_bound_error(); return array; } function caml_classify_float(x){ if(Number.isFinite(x)){ if(Math.abs(x) >= 2.2250738585072014e-308) return 0; if(x !== 0) return 1; return 2; } return Number.isNaN(x) ? 4 : 3; } function caml_is_continuation_tag(t){return t === 245 ? 1 : 0;} function caml_int32_unmarshal(reader, size){size[0] = 4; return reader.read32s(); } function caml_nativeint_unmarshal(reader, size){ switch(reader.read8u()){ case 1: size[0] = 4; return reader.read32s(); case 2: caml_failwith("input_value: native integer value too large"); break; default: caml_failwith("input_value: ill-formed native integer"); } } function caml_int64_unmarshal(reader, size){ var t = new Array(8); for(var j = 0; j < 8; j++) t[j] = reader.read8u(); size[0] = 8; return caml_int64_of_bytes(t); } function caml_int64_marshal(writer, v, sizes){ var b = caml_int64_to_bytes(v); for(var i = 0; i < 8; i++) writer.write(8, b[i]); sizes[0] = 8; sizes[1] = 8; } function caml_int64_compare(x, y, _total){return x.compare(y);} function caml_int64_hash(v){return v.lo32() ^ v.hi32();} var caml_custom_ops = {_j: {deserialize: caml_int64_unmarshal, serialize: caml_int64_marshal, fixed_length: 8, compare: caml_int64_compare, hash: caml_int64_hash}, _i: {deserialize: caml_int32_unmarshal, fixed_length: 4}, _n: {deserialize: caml_nativeint_unmarshal, fixed_length: 4}, _bigarray: {deserialize: function(reader, sz){ return caml_ba_deserialize(reader, sz, "_bigarray"); }, serialize: caml_ba_serialize, compare: caml_ba_compare, hash: caml_ba_hash}, _bigarr02: {deserialize: function(reader, sz){ return caml_ba_deserialize(reader, sz, "_bigarr02"); }, serialize: caml_ba_serialize, compare: caml_ba_compare, hash: caml_ba_hash}}; function caml_compare_val_get_custom(a){ return caml_custom_ops[a.caml_custom] && caml_custom_ops[a.caml_custom].compare; } function caml_compare_val_number_custom(num, custom, swap, total){ var comp = caml_compare_val_get_custom(custom); if(comp){ var x = swap > 0 ? comp(custom, num, total) : comp(num, custom, total); if(total && Number.isNaN(x)) return swap; if(Number.isNaN(+ x)) return + x; if((x | 0) !== 0) return x | 0; } return swap; } function caml_compare_val_tag(a){ if(typeof a === "number") return 1000; else if(caml_is_ml_bytes(a)) return 252; else if(caml_is_ml_string(a)) return 1252; else if(Array.isArray(a) && a[0] === a[0] >>> 0 && a[0] <= 255){var tag = a[0] | 0; return tag === 254 ? 0 : tag;} else if(a instanceof String) return 12520; else if(typeof a === "string") return 12520; else if(a instanceof Number) return 1000; else if(a?.caml_custom) return 1255; else if(a?.compare) return 1256; else if(typeof a === "function") return 1247; else if(typeof a === "symbol") return 1251; return 1001; } function caml_int_compare(a, b){ if(a < b) return - 1; if(a === b) return 0; return 1; } function caml_string_compare(s1, s2){ return s1 < s2 ? - 1 : s1 > s2 ? 1 : 0; } function caml_compare_val(a, b, total){ var stack = []; for(;;){ if(! (total && a === b)){ var tag_a = caml_compare_val_tag(a); if(tag_a === 250){a = a[1]; continue;} var tag_b = caml_compare_val_tag(b); if(tag_b === 250){b = b[1]; continue;} if(tag_a !== tag_b){ if(tag_a === 1000){ if(tag_b === 1255) return caml_compare_val_number_custom(a, b, - 1, total); return - 1; } if(tag_b === 1000){ if(tag_a === 1255) return caml_compare_val_number_custom(b, a, 1, total); return 1; } return tag_a < tag_b ? - 1 : 1; } switch(tag_a){ case 247: caml_invalid_argument("compare: functional value"); break; case 248: var x = caml_int_compare(a[2], b[2]) | 0; if(x !== 0) return x; break; case 249: caml_invalid_argument("compare: functional value"); break; case 250: caml_invalid_argument("equal: got Forward_tag, should not happen"); break; case 251: caml_invalid_argument("equal: abstract value"); break; case 252: if(a !== b){ var x = caml_bytes_compare(a, b) | 0; if(x !== 0) return x; } break; case 253: caml_invalid_argument("equal: got Double_tag, should not happen"); break; case 254: caml_invalid_argument ("equal: got Double_array_tag, should not happen"); break; case 255: caml_invalid_argument("equal: got Custom_tag, should not happen"); break; case 1247: caml_invalid_argument("compare: functional value"); break; case 1255: var comp = caml_compare_val_get_custom(a); if(comp !== caml_compare_val_get_custom(b)) return a.caml_custom < b.caml_custom ? - 1 : 1; if(! comp) caml_invalid_argument("compare: abstract value"); var x = comp(a, b, total); if(Number.isNaN(x)) return total ? - 1 : x; if(x !== (x | 0)) return - 1; if(x !== 0) return x | 0; break; case 1256: var x = a.compare(b, total); if(Number.isNaN(x)) return total ? - 1 : x; if(x !== (x | 0)) return - 1; if(x !== 0) return x | 0; break; case 1000: a = + a; b = + b; if(a < b) return - 1; if(a > b) return 1; if(a !== b){ if(! total) return Number.NaN; if(! Number.isNaN(a)) return 1; if(! Number.isNaN(b)) return - 1; } break; case 1001: if(a < b) return - 1; if(a > b) return 1; if(a !== b) return total ? 1 : Number.NaN; break; case 1251: if(a !== b) return total ? 1 : Number.NaN; break; case 1252: var a = caml_jsbytes_of_string(a), b = caml_jsbytes_of_string(b); if(a !== b){if(a < b) return - 1; if(a > b) return 1;} break; case 12520: var a = a.toString(), b = b.toString(); if(a !== b){if(a < b) return - 1; if(a > b) return 1;} break; default: if(caml_is_continuation_tag(tag_a)){ caml_invalid_argument("compare: continuation value"); break; } if(a.length !== b.length) return a.length < b.length ? - 1 : 1; if(a.length > 1) stack.push(a, b, 1); break; } } if(stack.length === 0) return 0; var i = stack.pop(); b = stack.pop(); a = stack.pop(); if(i + 1 < a.length) stack.push(a, b, i + 1); a = a[i]; b = b[i]; } } function caml_compare(a, b){return caml_compare_val(a, b, true);} function caml_continuation_use_noexc(cont){ var stack = cont[1]; cont[1] = 0; return stack; } function caml_continuation_use_and_update_handler_noexc (cont, hval, hexn, heff){ var stack = caml_continuation_use_noexc(cont); if(stack === 0) return stack; var last = cont[2]; last.h[1] = hval; last.h[2] = hexn; last.h[3] = heff; return stack; } function caml_convert_raw_backtrace(){return [0];} function caml_convert_raw_backtrace_slot(_rbt){ caml_failwith("caml_convert_raw_backtrace_slot"); } function caml_copysign_float(x, y){ if(y === 0) y = 1 / y; x = Math.abs(x); return y < 0 ? - x : x; } function caml_cosh_float(x){return Math.cosh(x);} function fs_node_supported(){ return globalThis.process?.versions?.node !== undefined; } function make_path_is_absolute(){ function posix(path){ if(path.charAt(0) === "/") return ["", path.slice(1)]; return; } function win32(path){ var splitDeviceRe = /^([a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)?([\\/])?([\s\S]*?)$/, result = splitDeviceRe.exec(path), device = result[1] || "", isUnc = device.length > 0 && device.charAt(1) !== ":"; if(result[2] || isUnc){ var root = result[1] || "", sep = result[2] || ""; return [root, path.slice(root.length + sep.length)]; } return; } return jsoo_is_win32 ? win32 : posix; } var path_is_absolute = make_path_is_absolute(); function caml_trailing_slash(name){ return name.slice(- 1) !== "/" ? name + "/" : name; } if(fs_node_supported() && globalThis.process && globalThis.process.cwd) var caml_current_dir = globalThis.process.cwd().replace(/\\/g, "/"); else var caml_current_dir = "/static"; caml_current_dir = caml_trailing_slash(caml_current_dir); function caml_make_path(name){ name = caml_jsstring_of_string(name); if(! path_is_absolute(name)) name = caml_current_dir + name; var comp0 = path_is_absolute(name), comp = comp0[1].split(/[/\\]/), ncomp = []; for(var i = 0; i < comp.length; i++) switch(comp[i]){ case "..": ncomp.pop(); break; case ".": break; case "": break; default: ncomp.push(comp[i]); break; } ncomp.unshift(comp0[0]); ncomp.orig = name; return ncomp; } function caml_get_root(path){ var x = path_is_absolute(path); if(! x) return; return x[0] + "/"; } var caml_root = caml_get_root(caml_current_dir) || caml_failwith("unable to compute caml_root"), jsoo_mount_point = []; if(fs_node_supported()) jsoo_mount_point.push ({path: caml_root, device: new MlNodeDevice(caml_root)}); else jsoo_mount_point.push ({path: caml_root, device: new MlFakeDevice(caml_root)}); jsoo_mount_point.push ({path: "/static/", device: new MlFakeDevice("/static/")}); function resolve_fs_device(name){ var path = caml_make_path(name), name = path.join("/"), name_slash = caml_trailing_slash(name), res; for(var i = 0; i < jsoo_mount_point.length; i++){ var m = jsoo_mount_point[i]; if (name_slash.search(m.path) === 0 && (! res || res.path.length < m.path.length)) res = {path: m.path, device: m.device, rest: name.slice(m.path.length, name.length)}; } if(! res && fs_node_supported()){ var root = caml_get_root(name); if(root?.match(/^[a-zA-Z]:\/$/)){ var m = {path: root, device: new MlNodeDevice(root)}; jsoo_mount_point.push(m); res = {path: m.path, device: m.device, rest: name.slice(m.path.length, name.length)}; } } if(res) return res; caml_raise_sys_error("no device found for " + name_slash); } function caml_create_file(name, content){ var root = resolve_fs_device(name); if(! root.device.register) caml_failwith("cannot register file"); root.device.register(root.rest, content); return 0; } function caml_create_string(_len){caml_invalid_argument("String.create");} var caml_custom_event_index = 0; function caml_custom_identifier(o){ return caml_string_of_jsstring(o.caml_custom || ""); } var zstd_decompress = function(){ var ab = ArrayBuffer, u8 = Uint8Array, u16 = Uint16Array, i16 = Int16Array, i32 = Int32Array; function slc(v, s, e){ if(u8.prototype.slice) return u8.prototype.slice.call(v, s, e); if(s == null || s < 0) s = 0; if(e == null || e > v.length) e = v.length; var n = new u8(e - s); n.set(v.subarray(s, e)); return n; } function fill(v, n, s, e){ if(u8.prototype.fill) return u8.prototype.fill.call(v, n, s, e); if(s == null || s < 0) s = 0; if(e == null || e > v.length) e = v.length; for(; s < e; ++s) v[s] = n; return v; } function cpw(v, t, s, e){ if(u8.prototype.copyWithin) return u8.prototype.copyWithin.call(v, t, s, e); if(s == null || s < 0) s = 0; if(e == null || e > v.length) e = v.length; while(s < e) v[t++] = v[s++]; } var ec = ["invalid zstd data", "window size too large (>2046MB)", "invalid block type", "FSE accuracy too high", "match distance too far back", "unexpected EOF"]; function err(ind, msg, nt){ var e = new Error(msg || ec[ind]); e.code = ind; if(! nt) throw e; return e; } function rb(d, b, n){ var i = 0, o = 0; for(; i < n; ++i) o |= d[b++] << (i << 3); return o; } function b4(d, b){ return (d[b] | d[b + 1] << 8 | d[b + 2] << 16 | d[b + 3] << 24) >>> 0; } function rzfh(dat, w){ var n3 = dat[0] | dat[1] << 8 | dat[2] << 16; if(n3 === 0x2fb528 && dat[3] === 253){ var flg = dat[4], ss = flg >> 5 & 1, cc = flg >> 2 & 1, df = flg & 3, fcf = flg >> 6; if(flg & 8) err(0); var bt = 6 - ss, db = df === 3 ? 4 : df, di = rb(dat, bt, db); bt += db; var fsb = fcf ? 1 << fcf : ss, fss = rb(dat, bt, fsb) + (fcf === 1 && 256), ws = fss; if(! ss){ var wb = 1 << 10 + (dat[5] >> 3); ws = wb + (wb >> 3) * (dat[5] & 7); } if(ws > 2145386496) err(1); var buf = new u8((w === 1 ? fss || ws : w ? 0 : ws) + 12); buf[0] = 1, buf[4] = 4, buf[8] = 8; return {b: bt + fsb, y: 0, l: 0, d: di, w: w && w !== 1 ? w : buf.subarray(12), e: ws, o: new i32(buf.buffer, 0, 3), u: fss, c: cc, m: Math.min(131072, ws)}; } else if((n3 >> 4 | dat[3] << 20) === 0x184d2a5) return b4(dat, 4) + 8; err(0); } function msb(val){ var bits = 0; for(; 1 << bits <= val; ++bits) ; return bits - 1; } function rfse(dat, bt, mal){ var tpos = (bt << 3) + 4, al = (dat[bt] & 15) + 5; if(al > mal) err(3); var sz = 1 << al, probs = sz, sym = - 1, re = - 1, i = - 1, ht = sz, buf = new ab(512 + (sz << 2)), freq = new i16(buf, 0, 256), dstate = new u16(buf, 0, 256), nstate = new u16(buf, 512, sz), bb1 = 512 + (sz << 1), syms = new u8(buf, bb1, sz), nbits = new u8(buf, bb1 + sz); while(sym < 255 && probs > 0){ var bits = msb(probs + 1), cbt = tpos >> 3, msk = (1 << bits + 1) - 1, val = (dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (tpos & 7) & msk, msk1fb = (1 << bits) - 1, msv = msk - probs - 1, sval = val & msk1fb; if(sval < msv) tpos += bits, val = sval; else{tpos += bits + 1; if(val > msk1fb) val -= msv;} freq[++sym] = --val; if(val === - 1){probs += val; syms[--ht] = sym;} else probs -= val; if(! val) do{ var rbt = tpos >> 3; re = (dat[rbt] | dat[rbt + 1] << 8) >> (tpos & 7) & 3; tpos += 2; sym += re; } while (re === 3); } if(sym > 255 || probs) err(0); var sympos = 0, sstep = (sz >> 1) + (sz >> 3) + 3, smask = sz - 1; for(var s = 0; s <= sym; ++s){ var sf = freq[s]; if(sf < 1){dstate[s] = - sf; continue;} for(i = 0; i < sf; ++i){ syms[sympos] = s; do sympos = sympos + sstep & smask;while(sympos >= ht); } } if(sympos) err(0); for(i = 0; i < sz; ++i){ var ns = dstate[syms[i]]++, nb = nbits[i] = al - msb(ns); nstate[i] = (ns << nb) - sz; } return [tpos + 7 >> 3, {b: al, s: syms, n: nbits, t: nstate}]; } function rhu(dat, bt){ var i = 0, wc = - 1, buf = new u8(292), hb = dat[bt], hw = buf.subarray(0, 256), rc = buf.subarray(256, 268), ri = new u16(buf.buffer, 268); if(hb < 128){ var _a = rfse(dat, bt + 1, 6), ebt = _a[0], fdt = _a[1]; bt += hb; var epos = ebt << 3, lb = dat[bt]; if(! lb) err(0); var st1 = 0, st2 = 0, btr1 = fdt.b, btr2 = btr1, fpos = (++bt << 3) - 8 + msb(lb); for(;;){ fpos -= btr1; if(fpos < epos) break; var cbt = fpos >> 3; st1 += (dat[cbt] | dat[cbt + 1] << 8) >> (fpos & 7) & (1 << btr1) - 1; hw[++wc] = fdt.s[st1]; fpos -= btr2; if(fpos < epos) break; cbt = fpos >> 3; st2 += (dat[cbt] | dat[cbt + 1] << 8) >> (fpos & 7) & (1 << btr2) - 1; hw[++wc] = fdt.s[st2]; btr1 = fdt.n[st1]; st1 = fdt.t[st1]; btr2 = fdt.n[st2]; st2 = fdt.t[st2]; } if(++wc > 255) err(0); } else{ wc = hb - 127; for(; i < wc; i += 2){ var byte = dat[++bt]; hw[i] = byte >> 4; hw[i + 1] = byte & 15; } ++bt; } var wes = 0; for(i = 0; i < wc; ++i){ var wt = hw[i]; if(wt > 11) err(0); wes += wt && 1 << wt - 1; } var mb = msb(wes) + 1, ts = 1 << mb, rem = ts - wes; if(rem & rem - 1) err(0); hw[wc++] = msb(rem) + 1; for(i = 0; i < wc; ++i){ var wt = hw[i]; ++rc[hw[i] = wt && mb + 1 - wt]; } var hbuf = new u8(ts << 1), syms = hbuf.subarray(0, ts), nb = hbuf.subarray(ts); ri[mb] = 0; for(i = mb; i > 0; --i){ var pv = ri[i]; fill(nb, i, pv, ri[i - 1] = pv + rc[i] * (1 << mb - i)); } if(ri[0] !== ts) err(0); for(i = 0; i < wc; ++i){ var bits = hw[i]; if(bits){ var code = ri[bits]; fill(syms, i, code, ri[bits] = code + (1 << mb - bits)); } } return [bt, {n: nb, b: mb, s: syms}]; } var dllt = rfse (new u8 ([81, 16, 99, 140, 49, 198, 24, 99, 12, 33, 196, 24, 99, 102, 102, 134, 70, 146, 4]), 0, 6) [1], dmlt = rfse (new u8 ([33, 20, 196, 24, 99, 140, 33, 132, 16, 66, 8, 33, 132, 16, 66, 8, 33, 68, 68, 68, 68, 68, 68, 68, 68, 36, 9]), 0, 6) [1], doct = rfse (new u8([32, 132, 16, 66, 102, 70, 68, 68, 68, 68, 36, 73, 2]), 0, 5) [1]; function b2bl(b, s){ var len = b.length, bl = new i32(len); for(var i = 0; i < len; ++i){bl[i] = s; s += 1 << b[i];} return bl; } var llb = new u8 (new i32 ([0, 0, 0, 0, 16843009, 50528770, 134678020, 202050057, 269422093]).buffer, 0, 36), llbl = b2bl(llb, 0), mlb = new u8 (new i32 ([0, 0, 0, 0, 0, 0, 0, 0, 16843009, 50528770, 117769220, 185207048, 252579084, 16]).buffer, 0, 53), mlbl = b2bl(mlb, 3); function dhu(dat, out, hu){ var len = dat.length, ss = out.length, lb = dat[len - 1], msk = (1 << hu.b) - 1, eb = - hu.b; if(! lb) err(0); var st = 0, btr = hu.b, pos = (len << 3) - 8 + msb(lb) - btr, i = - 1; while(pos > eb && i < ss){ var cbt = pos >> 3, val = (dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (pos & 7); st = (st << btr | val) & msk; out[++i] = hu.s[st]; pos -= btr = hu.n[st]; } if(pos !== eb || i + 1 !== ss) err(0); } function dhu4(dat, out, hu){ var bt = 6, ss = out.length, sz1 = ss + 3 >> 2, sz2 = sz1 << 1, sz3 = sz1 + sz2; dhu (dat.subarray(bt, bt += dat[0] | dat[1] << 8), out.subarray(0, sz1), hu); dhu (dat.subarray(bt, bt += dat[2] | dat[3] << 8), out.subarray(sz1, sz2), hu); dhu (dat.subarray(bt, bt += dat[4] | dat[5] << 8), out.subarray(sz2, sz3), hu); dhu(dat.subarray(bt), out.subarray(sz3), hu); } function rzb(dat, st, out){ var _a, bt = st.b, b0 = dat[bt], btype = b0 >> 1 & 3; st.l = b0 & 1; var sz = b0 >> 3 | dat[bt + 1] << 5 | dat[bt + 2] << 13, ebt = (bt += 3) + sz; if(btype === 1){ if(bt >= dat.length) return; st.b = bt + 1; if(out){fill(out, dat[bt], st.y, st.y += sz); return out;} return fill(new u8(sz), dat[bt]); } if(ebt > dat.length) return; if(btype === 0){ st.b = ebt; if(out){ out.set(dat.subarray(bt, ebt), st.y); st.y += sz; return out; } return slc(dat, bt, ebt); } if(btype === 2){ var b3 = dat[bt], lbt = b3 & 3, sf = b3 >> 2 & 3, lss = b3 >> 4, lcs = 0, s4 = 0; if(lbt < 2) if(sf & 1) lss |= dat[++bt] << 4 | (sf & 2 && dat[++bt] << 12); else lss = b3 >> 3; else{ s4 = sf; if(sf < 2) lss |= (dat[++bt] & 63) << 4, lcs = dat[bt] >> 6 | dat[++bt] << 2; else if(sf === 2) lss |= dat[++bt] << 4 | (dat[++bt] & 3) << 12, lcs = dat[bt] >> 2 | dat[++bt] << 6; else lss |= dat[++bt] << 4 | (dat[++bt] & 63) << 12, lcs = dat[bt] >> 6 | dat[++bt] << 2 | dat[++bt] << 10; } ++bt; var buf = out ? out.subarray(st.y, st.y + st.m) : new u8(st.m), spl = buf.length - lss; if(lbt === 0) buf.set(dat.subarray(bt, bt += lss), spl); else if(lbt === 1) fill(buf, dat[bt++], spl); else{ var hu = st.h; if(lbt === 2){ var hud = rhu(dat, bt); lcs += bt - (bt = hud[0]); st.h = hu = hud[1]; } else if(! hu) err(0); (s4 ? dhu4 : dhu) (dat.subarray(bt, bt += lcs), buf.subarray(spl), hu); } var ns = dat[bt++]; if(ns){ if(ns === 255) ns = (dat[bt++] | dat[bt++] << 8) + 0x7f00; else if(ns > 127) ns = ns - 128 << 8 | dat[bt++]; var scm = dat[bt++]; if(scm & 3) err(0); var dts = [dmlt, doct, dllt]; for(var i = 2; i > - 1; --i){ var md = scm >> (i << 1) + 2 & 3; if(md === 1){ var rbuf = new u8([0, 0, dat[bt++]]); dts[i] = {s: rbuf.subarray(2, 3), n: rbuf.subarray(0, 1), t: new u16(rbuf.buffer, 0, 1), b: 0}; } else if(md === 2) _a = rfse(dat, bt, 9 - (i & 1)), bt = _a[0], dts[i] = _a[1]; else if(md === 3){if(! st.t) err(0); dts[i] = st.t[i];} } var _b = st.t = dts, mlt = _b[0], oct = _b[1], llt = _b[2], lb = dat[ebt - 1]; if(! lb) err(0); var spos = (ebt << 3) - 8 + msb(lb) - llt.b, cbt = spos >> 3, oubt = 0, lst = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << llt.b) - 1; cbt = (spos -= oct.b) >> 3; var ost = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << oct.b) - 1; cbt = (spos -= mlt.b) >> 3; var mst = (dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << mlt.b) - 1; for(++ns; --ns;){ var llc = llt.s[lst], lbtr = llt.n[lst], mlc = mlt.s[mst], mbtr = mlt.n[mst], ofc = oct.s[ost], obtr = oct.n[ost]; cbt = (spos -= ofc) >> 3; var ofp = 1 << ofc, off = ofp + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16 | dat[cbt + 3] << 24) >>> (spos & 7) & ofp - 1); cbt = (spos -= mlb[mlc]) >> 3; var ml = mlbl[mlc] + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (spos & 7) & (1 << mlb[mlc]) - 1); cbt = (spos -= llb[llc]) >> 3; var ll = llbl[llc] + ((dat[cbt] | dat[cbt + 1] << 8 | dat[cbt + 2] << 16) >> (spos & 7) & (1 << llb[llc]) - 1); cbt = (spos -= lbtr) >> 3; lst = llt.t[lst] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << lbtr) - 1); cbt = (spos -= mbtr) >> 3; mst = mlt.t[mst] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << mbtr) - 1); cbt = (spos -= obtr) >> 3; ost = oct.t[ost] + ((dat[cbt] | dat[cbt + 1] << 8) >> (spos & 7) & (1 << obtr) - 1); if(off > 3){ st.o[2] = st.o[1]; st.o[1] = st.o[0]; st.o[0] = off -= 3; } else{ var idx = off - (ll !== 0); if(idx){ off = idx === 3 ? st.o[0] - 1 : st.o[idx]; if(idx > 1) st.o[2] = st.o[1]; st.o[1] = st.o[0]; st.o[0] = off; } else off = st.o[0]; } for(var i = 0; i < ll; ++i) buf[oubt + i] = buf[spl + i]; oubt += ll, spl += ll; var stin = oubt - off; if(stin < 0){ var len = - stin, bs = st.e + stin; if(len > ml) len = ml; for(var i = 0; i < len; ++i) buf[oubt + i] = st.w[bs + i]; oubt += len, ml -= len, stin = 0; } for(var i = 0; i < ml; ++i) buf[oubt + i] = buf[stin + i]; oubt += ml; } if(oubt !== spl) while(spl < buf.length) buf[oubt++] = buf[spl++]; else oubt = buf.length; if(out) st.y += oubt; else buf = slc(buf, 0, oubt); } else if(out){ st.y += lss; if(spl) for(var i = 0; i < lss; ++i) buf[i] = buf[spl + i]; } else if(spl) buf = slc(buf, spl); st.b = ebt; return buf; } err(2); } function cct(bufs, ol){ if(bufs.length === 1) return bufs[0]; var buf = new u8(ol); for(var i = 0, b = 0; i < bufs.length; ++i){ var chk = bufs[i]; buf.set(chk, b); b += chk.length; } return buf; } return function(dat, buf){ var bt = 0, bufs = [], nb = + ! buf, ol = 0; while(dat.length){ var st = rzfh(dat, nb || buf); if(typeof st === "object"){ if(nb){ buf = null; if(st.w.length === st.u){bufs.push(buf = st.w); ol += st.u;} } else{bufs.push(buf); st.e = 0;} while(! st.l){ var blk = rzb(dat, st, buf); if(! blk) err(5); if(buf) st.e = st.y; else{ bufs.push(blk); ol += blk.length; cpw(st.w, 0, blk.length); st.w.set(blk, st.w.length - blk.length); } } bt = st.b + st.c * 4; } else bt = st; dat = dat.subarray(bt); } return cct(bufs, ol);}; } (), caml_decompress_input = zstd_decompress; function caml_div(x, y){ if(y === 0) caml_raise_zero_divide(); return x / y | 0; } var caml_domain_dls = [0]; function caml_domain_dls_compare_and_set(old, n){ if(caml_domain_dls !== old) return 0; caml_domain_dls = n; return 1; } function caml_domain_dls_get(_unit){return caml_domain_dls;} function caml_domain_dls_set(a){caml_domain_dls = a;} var caml_domain_id = 0; function caml_ml_mutex_unlock(t){t.locked = false; return 0;} var caml_domain_latest_idx = 1; function caml_domain_spawn(f, term_sync){ var id = caml_domain_latest_idx++, old = caml_domain_id; caml_domain_id = id; var res = caml_callback(f, [0]); caml_domain_id = old; caml_ml_mutex_unlock(term_sync[2]); term_sync[1] = [0, [0, res]]; return id; } var caml_ephe_none = {caml_ephe_none: 0}, caml_ephe_data_offset = 2, caml_ephe_key_offset = 3; function caml_ephe_get_data(x){ var data = x[caml_ephe_data_offset]; if(data === caml_ephe_none) return 0; for(var i = caml_ephe_key_offset; i < x.length; i++){ var k = x[i]; if(globalThis.WeakRef && k instanceof globalThis.WeakRef){ var d = k.deref(); if(d === undefined){ x[i] = caml_ephe_none; x[caml_ephe_data_offset] = caml_ephe_none; return 0; } if(globalThis.WeakMap){ data = data.get(k); if(data === undefined){ x[caml_ephe_data_offset] = caml_ephe_none; return 0; } } } } return [0, data]; } function caml_ephe_unset_data(x){ x[caml_ephe_data_offset] = caml_ephe_none; return 0; } function caml_ephe_set_data(x, data){ for(var i = x.length - 1; i >= caml_ephe_key_offset; i--){ var k = x[i]; if(globalThis.WeakRef && k instanceof globalThis.WeakRef){ var d = k.deref(); if(d === undefined){x[i] = caml_ephe_none; continue;} if(globalThis.WeakMap) data = new globalThis.WeakMap().set(k, data); } } x[caml_ephe_data_offset] = data; return 0; } function caml_ephe_set_data_opt(x, data_opt){ if(data_opt === 0) caml_ephe_unset_data(x); else caml_ephe_set_data(x, data_opt[1]); return 0; } function caml_ephe_blit_data(src, dst){ var old = caml_ephe_get_data(src); caml_ephe_set_data_opt(dst, old); return 0; } function caml_ephe_blit_key(a1, i1, a2, i2, len){ var old = caml_ephe_get_data(a1); caml_array_blit (a1, caml_ephe_key_offset + i1 - 1, a2, caml_ephe_key_offset + i2 - 1, len); caml_ephe_set_data_opt(a2, old); return 0; } function caml_ephe_check_data(x){ var data = caml_ephe_get_data(x); return data === 0 ? 0 : 1; } function caml_ephe_check_key(x, i){ var weak = x[caml_ephe_key_offset + i]; if(weak === caml_ephe_none) return 0; if(globalThis.WeakRef && weak instanceof globalThis.WeakRef){ weak = weak.deref(); if(weak === undefined){ x[caml_ephe_key_offset + i] = caml_ephe_none; x[caml_ephe_data_offset] = caml_ephe_none; return 0; } } return 1; } function caml_weak_create(n){ var alen = caml_ephe_key_offset + n, x = new Array(alen); x[0] = 251; x[1] = "caml_ephe_list_head"; for(var i = 2; i < alen; i++) x[i] = caml_ephe_none; return x; } function caml_ephe_create(n){return caml_weak_create(n);} function caml_obj_dup(x){return typeof x === "number" ? x : x.slice();} function caml_ephe_get_data_copy(x){ var r = caml_ephe_get_data(x); if(r === 0) return 0; var z = r[1]; if(Array.isArray(z)) return [0, caml_obj_dup(z)]; return r; } function caml_ephe_get_key(x, i){ var weak = x[caml_ephe_key_offset + i]; if(weak === caml_ephe_none) return 0; if(globalThis.WeakRef && weak instanceof globalThis.WeakRef){ weak = weak.deref(); if(weak === undefined){ x[caml_ephe_key_offset + i] = caml_ephe_none; x[caml_ephe_data_offset] = caml_ephe_none; return 0; } } return [0, weak]; } function caml_ephe_get_key_copy(x, i){ var y = caml_ephe_get_key(x, i); if(y === 0) return y; var z = y[1]; if(Array.isArray(z)) return [0, caml_obj_dup(z)]; return y; } function caml_ephe_set_key(x, i, v){ var old = caml_ephe_get_data(x); if(globalThis.WeakRef && v instanceof Object) v = new globalThis.WeakRef(v); x[caml_ephe_key_offset + i] = v; caml_ephe_set_data_opt(x, old); return 0; } function caml_ephe_unset_key(x, i){ var old = caml_ephe_get_data(x); x[caml_ephe_key_offset + i] = caml_ephe_none; caml_ephe_set_data_opt(x, old); return 0; } function caml_equal(x, y){return + (caml_compare_val(x, y, false) === 0);} function caml_erf_float(x){ var a1 = 0.254829592, a2 = - 0.284496736, a3 = 1.421413741, a4 = - 1.453152027, a5 = 1.061405429, p = 0.3275911, sign = 1; if(x < 0) sign = - 1; x = Math.abs(x); var t = 1.0 / (1.0 + p * x), y = 1.0 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.exp(- x * x); return sign * y; } function caml_erfc_float(x){return 1 - caml_erf_float(x);} var caml_executable_name = caml_argv[1]; function caml_exp2_float(x){return Math.pow(2, x);} function caml_expm1_float(x){return Math.expm1(x);} function caml_is_special_exception(exn){ switch(exn[2]){case - 8:case - 11:case - 12: return 1;default: return 0; } } function caml_format_exception(exn){ var r = ""; if(exn[0] === 0){ r += exn[1][1]; if (exn.length === 3 && exn[2][0] === 0 && caml_is_special_exception(exn[1])) var bucket = exn[2], start = 1; else var start = 2, bucket = exn; r += "("; for(var i = start; i < bucket.length; i++){ if(i > start) r += ", "; var v = bucket[i]; if(typeof v === "number") r += v.toString(); else if(v instanceof MlBytes) r += '"' + v.toString() + '"'; else if(typeof v === "string") r += '"' + v.toString() + '"'; else r += "_"; } r += ")"; } else if(exn[0] === 248) r += exn[1]; return r; } function caml_fatal_uncaught_exception(err){ if(Array.isArray(err) && (err[0] === 0 || err[0] === 248)){ var handler = caml_named_value("Printexc.handle_uncaught_exception"); if(handler) caml_callback(handler, [err, false]); else{ var msg = caml_format_exception(err), at_exit = caml_named_value("Pervasives.do_at_exit"); if(at_exit) caml_callback(at_exit, [0]); console.error("Fatal error: exception " + msg); if(err.js_error) throw err.js_error; } } else throw err; } function caml_fill_bytes(s, i, l, c){ if(l > 0) if(i === 0 && (l >= s.l || s.t === 2 && l >= s.c.length)) if(c === 0){ s.c = ""; s.t = 2; } else{ s.c = caml_str_repeat(l, String.fromCharCode(c)); s.t = l === s.l ? 0 : 2; } else{ if(s.t !== 4) caml_convert_bytes_to_array(s); for(l += i; i < l; i++) s.c[i] = c; } return 0; } function caml_final_register(_f, _x){return 0;} var all_finalizers = new globalThis.Set(); function caml_final_register_called_without_value(cb, a){ if(globalThis.FinalizationRegistry && a instanceof Object){ var x = new globalThis.FinalizationRegistry (function(x){all_finalizers.delete(x); cb(0); return;}); x.register(a, x); all_finalizers.add(x); } return 0; } function caml_final_release(_unit){return 0;} function caml_finish_formatting(f, rawbuffer){ if(f.uppercase) rawbuffer = rawbuffer.toUpperCase(); var len = rawbuffer.length; if(f.signedconv && (f.sign < 0 || f.signstyle !== "-")) len++; if(f.alternate){if(f.base === 8) len += 1; if(f.base === 16) len += 2;} var buffer = ""; if(f.justify === "+" && f.filler === " ") for(var i = len; i < f.width; i++) buffer += " "; if(f.signedconv) if(f.sign < 0) buffer += "-"; else if(f.signstyle !== "-") buffer += f.signstyle; if(f.alternate && f.base === 8) buffer += "0"; if(f.alternate && f.base === 16) buffer += f.uppercase ? "0X" : "0x"; if(f.justify === "+" && f.filler === "0") for(var i = len; i < f.width; i++) buffer += "0"; buffer += rawbuffer; if(f.justify === "-") for(var i = len; i < f.width; i++) buffer += " "; return caml_string_of_jsbytes(buffer); } function caml_float_compare(x, y){ if(x === y) return 0; if(x < y) return - 1; if(x > y) return 1; if(! Number.isNaN(x)) return 1; if(! Number.isNaN(y)) return - 1; return 0; } function caml_float_of_bytes(a){ return caml_int64_float_of_bits(caml_int64_of_bytes(a)); } function caml_float_of_string(s){ var res, r_float = /^ *[-+]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][-+]?\d+)?$/; s = caml_jsbytes_of_string(s); res = + s; if(! Number.isNaN(res) && r_float.test(s)) return res; s = s.replace(/_/g, ""); res = + s; if(! Number.isNaN(res) && r_float.test(s) || /^[+-]?nan$/i.test(s)) return res; var m = /^ *([+-]?)0x([0-9a-f]+)\.?([0-9a-f]*)(p([+-]?[0-9]+))?$/i.exec(s); if(m){ var m3 = m[3].replace(/0+$/, ""), mantissa = Number.parseInt(m[1] + m[2] + m3, 16), exponent = (+ m[5] || 0) - 4 * m3.length; res = mantissa * Math.pow(2, exponent); return res; } if(/^\+?inf(inity)?$/i.test(s)) return Number.POSITIVE_INFINITY; if(/^-inf(inity)?$/i.test(s)) return Number.NEGATIVE_INFINITY; caml_failwith("float_of_string"); } function caml_floatarray_blit(a1, i1, a2, i2, len){return caml_array_blit(a1, i1, a2, i2, len); } function caml_floatarray_create(len){ if(len >>> 0 >= (0x7fffffff / 8 | 0)) caml_array_bound_error(); var len = len + 1 | 0, b = new Array(len); b[0] = 254; for(var i = 1; i < len; i++) b[i] = 0; return b; } function caml_fma_float(x, y, z){ var SPLIT = Math.pow(2, 27) + 1, MIN_VALUE = Math.pow(2, - 1022), EPSILON = Math.pow(2, - 52), C = 416, A = Math.pow(2, + C), B = Math.pow(2, - C); function multiply(a, b){ var at = SPLIT * a, ahi = at - (at - a), alo = a - ahi, bt = SPLIT * b, bhi = bt - (bt - b), blo = b - bhi, p = a * b, e = ahi * bhi - p + ahi * blo + alo * bhi + alo * blo; return {p: p, e: e}; } function add(a, b){ var s = a + b, v = s - a, e = a - (s - v) + (b - v); return {s: s, e: e}; } function adjust(x, y){ return x !== 0 && y !== 0 && SPLIT * x - (SPLIT * x - x) === x ? x * (1 + (x < 0 ? - 1 : + 1) * (y < 0 ? - 1 : + 1) * EPSILON) : x; } if(x === 0 || y === 0 || ! Number.isFinite(x) || ! Number.isFinite(y)) return x * y + z; if(z === 0) return x * y; if(! Number.isFinite(z)) return z; var scale = 1; while(Math.abs(x) > A){scale *= A; x *= B;} while(Math.abs(y) > A){scale *= A; y *= B;} if(scale === 1 / 0) return x * y * scale; while(Math.abs(x) < B){scale *= B; x *= A;} while(Math.abs(y) < B){scale *= B; y *= A;} if(scale === 0) return z; var xs = x, ys = y, zs = z / scale; if(Math.abs(zs) > Math.abs(xs * ys) * 4 / EPSILON) return z; if(Math.abs(zs) < Math.abs(xs * ys) * EPSILON / 4 * EPSILON / 4) zs = (z < 0 ? - 1 : + 1) * MIN_VALUE; var xy = multiply(xs, ys), s = add(xy.p, zs), u = add(xy.e, s.e), i = add(s.s, u.s), f = i.s + adjust(i.e, u.e); if(f === 0) return f; var fs = f * scale; if(Math.abs(fs) > MIN_VALUE) return fs; return fs + adjust(f - fs / scale, i.e) * scale; } function caml_parse_format(fmt){ fmt = caml_jsbytes_of_string(fmt); var len = fmt.length; if(len > 31) caml_invalid_argument("format_int: format too long"); var f = {justify: "+", signstyle: "-", filler: " ", alternate: false, base: 0, signedconv: false, width: 0, uppercase: false, sign: 1, prec: - 1, conv: "f"}; for(var i = 0; i < len; i++){ var c = fmt.charAt(i); switch(c){ case "-": f.justify = "-"; break; case "+": case " ": f.signstyle = c; break; case "0": f.filler = "0"; break; case "#": f.alternate = true; break; case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": f.width = 0; while(c = fmt.charCodeAt(i) - 48, c >= 0 && c <= 9){f.width = f.width * 10 + c; i++;} i--; break; case ".": f.prec = 0; i++; while(c = fmt.charCodeAt(i) - 48, c >= 0 && c <= 9){f.prec = f.prec * 10 + c; i++;} i--; break; case "d": case "i": f.signedconv = true; f.base = 10; break; case "u": f.base = 10; break; case "x": f.base = 16; break; case "X": f.base = 16; f.uppercase = true; break; case "o": f.base = 8; break; case "e": case "f": case "g": f.signedconv = true; f.conv = c; break; case "E": case "F": case "G": f.signedconv = true; f.uppercase = true; f.conv = c.toLowerCase(); break; } } return f; } function caml_format_float(fmt, x){ function toFixed(x, dp){ if(Math.abs(x) < 1.0) return x.toFixed(dp); else{ var e = Number.parseInt(x.toString().split("+")[1]); if(e > 20){ e -= 20; x /= Math.pow(10, e); x += caml_str_repeat(e, "0"); if(dp > 0) x = x + "." + caml_str_repeat(dp, "0"); return x; } else return x.toFixed(dp); } } var s, f = caml_parse_format(fmt), prec = f.prec < 0 ? 6 : f.prec; if(x < 0 || x === 0 && 1 / x === Number.NEGATIVE_INFINITY){f.sign = - 1; x = - x;} if(Number.isNaN(x)){ s = "nan"; f.filler = " "; } else if(! Number.isFinite(x)){s = "inf"; f.filler = " ";} else switch(f.conv){ case "e": var s = x.toExponential(prec), i = s.length; if(s.charAt(i - 3) === "e") s = s.slice(0, i - 1) + "0" + s.slice(i - 1); break; case "f": s = toFixed(x, prec); break; case "g": prec = prec ? prec : 1; s = x.toExponential(prec - 1); var j = s.indexOf("e"), exp = + s.slice(j + 1); if(exp < - 4 || x >= 1e21 || x.toFixed(0).length > prec){ var i = j - 1; while(s.charAt(i) === "0") i--; if(s.charAt(i) === ".") i--; s = s.slice(0, i + 1) + s.slice(j); i = s.length; if(s.charAt(i - 3) === "e") s = s.slice(0, i - 1) + "0" + s.slice(i - 1); break; } else{ var p = prec; if(exp < 0){ p -= exp + 1; s = x.toFixed(p); } else while(s = x.toFixed(p), s.length > prec + 1) p--; if(p){ var i = s.length - 1; while(s.charAt(i) === "0") i--; if(s.charAt(i) === ".") i--; s = s.slice(0, i + 1); } } break; } return caml_finish_formatting(f, s); } function caml_format_int(fmt, i){ if(caml_jsbytes_of_string(fmt) === "%d") return caml_string_of_jsbytes("" + i); var f = caml_parse_format(fmt); if(i < 0) if(f.signedconv){f.sign = - 1; i = - i;} else i >>>= 0; var s = i.toString(f.base); if(f.prec >= 0){ f.filler = " "; var n = f.prec - s.length; if(n > 0) s = caml_str_repeat(n, "0") + s; } return caml_finish_formatting(f, s); } var caml_oo_last_id = 0; function caml_fresh_oo_id(){return caml_oo_last_id++;} function caml_frexp_float(x){ if(x === 0 || ! Number.isFinite(x)) return [0, x, 0]; var neg = x < 0; if(neg) x = - x; var exp = Math.max(- 1023, Math.floor(Math.log2(x)) + 1); x *= Math.pow(2, - exp); while(x < 0.5){x *= 2; exp--;} while(x >= 1){x *= 0.5; exp++;} if(neg) x = - x; return [0, x, exp]; } function jsoo_create_file(name, content){ var name = caml_string_of_jsstring(name), content = caml_string_of_jsbytes(content); return caml_create_file(name, content); } function caml_fs_init(){ var tmp = globalThis.jsoo_fs_tmp; if(tmp) for(var i = 0; i < tmp.length; i++) jsoo_create_file(tmp[i].name, tmp[i].content); globalThis.jsoo_create_file = jsoo_create_file; globalThis.jsoo_fs_tmp = []; return 0; } function caml_gc_compaction(_unit){return 0;} function caml_gc_counters(_unit){return [254, 0, 0, 0];} function caml_gc_full_major(_unit){ if(typeof globalThis.gc === "function") globalThis.gc(); return 0; } function caml_gc_get(_unit){return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];} function caml_gc_major(_unit){ if(typeof globalThis.gc === "function") globalThis.gc(); return 0; } function caml_gc_major_slice(_work){return 0;} function caml_gc_minor(_unit){ if(typeof globalThis.gc === "function") globalThis.gc(true); return 0; } function caml_gc_minor_words(_unit){return 0;} function caml_gc_quick_stat(_unit){ return [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; } function caml_gc_set(_control){return 0;} function caml_gc_stat(unit){return caml_gc_quick_stat(unit);} var caml_method_cache = []; function caml_get_cached_method(obj, tag, cacheid){ var meths = obj[1], ofs = caml_method_cache[cacheid]; if(meths[ofs + 4] === tag) return meths[ofs + 3]; var li = 3, hi = meths[1] * 2 + 1, mi; while(li < hi){ mi = li + hi >> 1 | 1; if(tag < meths[mi + 1]) hi = mi - 2; else li = mi; } caml_method_cache[cacheid] = li - 3; return meths[li]; } function caml_get_continuation_callstack(){return [0];} function caml_get_current_callstack(){return [0];} function caml_get_exception_backtrace(){return 0;} function caml_get_exception_raw_backtrace(_unit){return [0];} function caml_get_global_data(_unit){return caml_global_data;} function caml_get_minor_free(_unit){return 0;} function caml_get_public_method(obj, tag){ var meths = obj[1], li = 3, hi = meths[1] * 2 + 1, mi; while(li < hi){ mi = li + hi >> 1 | 1; if(tag < meths[mi + 1]) hi = mi - 2; else li = mi; } return tag === meths[li + 1] ? meths[li] : 0; } function caml_gr_arc_aux(ctx, cx, cy, ry, rx, a1, a2){ while(a1 > a2) a2 += 360; a1 /= 180; a2 /= 180; var rot = 0, xPos, yPos, xPos_prev, yPos_prev, space = 2, num = (a2 - a1) * Math.PI * ((rx + ry) / 2) / space | 0, delta = (a2 - a1) * Math.PI / num, i = a1 * Math.PI; for(var j = 0; j <= num; j++){ xPos = cx - rx * Math.sin(i) * Math.sin(rot * Math.PI) + ry * Math.cos(i) * Math.cos(rot * Math.PI); xPos = xPos.toFixed(2); yPos = cy + ry * Math.cos(i) * Math.sin(rot * Math.PI) + rx * Math.sin(i) * Math.cos(rot * Math.PI); yPos = yPos.toFixed(2); if(j === 0) ctx.moveTo(xPos, yPos); else if(xPos_prev !== xPos || yPos_prev !== yPos) ctx.lineTo(xPos, yPos); xPos_prev = xPos; yPos_prev = yPos; i -= delta; } return 0; } var caml_gr_state; function caml_gr_state_get(){ if(caml_gr_state) return caml_gr_state; throw caml_maybe_attach_backtrace ([0, caml_named_value("Graphics.Graphic_failure"), caml_string_of_jsbytes("Not initialized")]); } function caml_gr_blit_image(im, x, y){ var s = caml_gr_state_get(), im2 = s.context.getImageData (x, s.height - im.height - y, im.width, im.height); for(var i = 0; i < im2.data.length; i += 4){ im.data[i] = im2.data[i]; im.data[i + 1] = im2.data[i + 1]; im.data[i + 2] = im2.data[i + 2]; im.data[i + 3] = im2.data[i + 3]; } return 0; } function caml_gr_clear_graph(){ var s = caml_gr_state_get(); s.context.clearRect(0, 0, s.canvas.width, s.canvas.height); return 0; } function caml_gr_close_graph(){ var s = caml_gr_state_get(); s.canvas.width = 0; s.canvas.height = 0; return 0; } function caml_gr_close_subwindow(_a){ caml_failwith("caml_gr_close_subwindow not Implemented"); } function caml_gr_create_image(x, y){ var s = caml_gr_state_get(); return s.context.createImageData(x, y); } function caml_gr_current_x(){var s = caml_gr_state_get(); return s.x;} function caml_gr_current_y(){var s = caml_gr_state_get(); return s.y;} function caml_gr_display_mode(){ caml_failwith("caml_gr_display_mode not Implemented"); } function caml_gr_doc_of_state(state){ if(state.canvas.ownerDocument) return state.canvas.ownerDocument; } function caml_gr_draw_arc(x, y, rx, ry, a1, a2){ var s = caml_gr_state_get(); s.context.beginPath(); caml_gr_arc_aux(s.context, x, s.height - y, rx, ry, a1, a2); s.context.stroke(); return 0; } function caml_gr_draw_str(str){ var s = caml_gr_state_get(), m = s.context.measureText(str), dx = m.width; s.context.fillText(str, s.x, s.height - s.y); s.x += dx | 0; return 0; } function caml_gr_draw_char(c){ caml_gr_draw_str(String.fromCharCode(c)); return 0; } function caml_gr_draw_image(im, x, y){ var s = caml_gr_state_get(); if(! im.image){ var canvas = document.createElement("canvas"); canvas.width = s.width; canvas.height = s.height; canvas.getContext("2d").putImageData(im, 0, 0); var image = new globalThis.Image(); image.onload = function(){ s.context.drawImage(image, x, s.height - im.height - y); im.image = image; }; image.src = canvas.toDataURL("image/png"); } else s.context.drawImage(im.image, x, s.height - im.height - y); return 0; } function caml_gr_draw_rect(x, y, w, h){ var s = caml_gr_state_get(); s.context.strokeRect(x, s.height - y, w, - h); return 0; } function caml_gr_draw_string(str){ caml_gr_draw_str(caml_jsstring_of_string(str)); return 0; } function caml_gr_dump_image(im){ var data = [0]; for(var i = 0; i < im.height; i++){ data[i + 1] = [0]; for(var j = 0; j < im.width; j++){ var o = i * (im.width * 4) + j * 4, r = im.data[o + 0], g = im.data[o + 1], b = im.data[o + 2]; data[i + 1][j + 1] = (r << 16) + (g << 8) + b; } } return data; } function caml_gr_fill_arc(x, y, rx, ry, a1, a2){ var s = caml_gr_state_get(); s.context.beginPath(); caml_gr_arc_aux(s.context, x, s.height - y, rx, ry, a1, a2); s.context.fill(); return 0; } function caml_gr_fill_poly(ar){ var s = caml_gr_state_get(); s.context.beginPath(); s.context.moveTo(ar[1][1], s.height - ar[1][2]); for(var i = 2; i < ar.length; i++) s.context.lineTo(ar[i][1], s.height - ar[i][2]); s.context.lineTo(ar[1][1], s.height - ar[1][2]); s.context.fill(); return 0; } function caml_gr_fill_rect(x, y, w, h){ var s = caml_gr_state_get(); s.context.fillRect(x, s.height - y, w, - h); return 0; } function caml_gr_lineto(x, y){ var s = caml_gr_state_get(); s.context.beginPath(); s.context.moveTo(s.x, s.height - s.y); s.context.lineTo(x, s.height - y); s.context.stroke(); s.x = x; s.y = y; return 0; } function caml_gr_make_image(arr){ var s = caml_gr_state_get(), h = arr.length - 1, w = arr[1].length - 1, im = s.context.createImageData(w, h); for(var i = 0; i < h; i++) for(var j = 0; j < w; j++){ var c = arr[i + 1][j + 1], o = i * (w * 4) + j * 4; if(c === - 1){ im.data[o + 0] = 0; im.data[o + 1] = 0; im.data[o + 2] = 0; im.data[o + 3] = 0; } else{ im.data[o + 0] = c >> 16 & 0xff; im.data[o + 1] = c >> 8 & 0xff; im.data[o + 2] = c >> 0 & 0xff; im.data[o + 3] = 0xff; } } return im; } function caml_gr_moveto(x, y){ var s = caml_gr_state_get(); s.x = x; s.y = y; return 0; } function caml_gr_set_window_title(name){ var s = caml_gr_state_get(); s.title = name; var jsname = caml_jsstring_of_string(name); if(s.set_title) s.set_title(jsname); return 0; } function caml_gr_set_line_width(w){ var s = caml_gr_state_get(); s.line_width = w; s.context.lineWidth = w; return 0; } function caml_gr_set_text_size(size){ var s = caml_gr_state_get(); s.text_size = size; s.context.font = s.text_size + "px " + caml_jsstring_of_string(s.font); return 0; } function caml_gr_set_font(f){ var s = caml_gr_state_get(); s.font = f; s.context.font = s.text_size + "px " + caml_jsstring_of_string(s.font); return 0; } function caml_gr_set_color(color){ var s = caml_gr_state_get(); function convert(number){ var str = "" + number.toString(16); while(str.length < 2) str = "0" + str; return str; } var r = color >> 16 & 0xff, g = color >> 8 & 0xff, b = color >> 0 & 0xff; s.color = color; var c_str = "#" + convert(r) + convert(g) + convert(b); s.context.fillStyle = c_str; s.context.strokeStyle = c_str; return 0; } function caml_gr_resize_window(w, h){ var s = caml_gr_state_get(); s.width = w; s.height = h; if(w !== s.canvas.width) s.canvas.width = w; if(h !== s.canvas.height) s.canvas.height = h; return 0; } function caml_gr_state_init(){ caml_gr_moveto(caml_gr_state.x, caml_gr_state.y); caml_gr_resize_window(caml_gr_state.width, caml_gr_state.height); caml_gr_set_line_width(caml_gr_state.line_width); caml_gr_set_text_size(caml_gr_state.text_size); caml_gr_set_font(caml_gr_state.font); caml_gr_set_color(caml_gr_state.color); caml_gr_set_window_title(caml_gr_state.title); caml_gr_state.context.textBaseline = "bottom"; } function caml_gr_state_set(ctx){ caml_gr_state = ctx; caml_gr_state_init(); return 0; } function caml_gr_state_create(canvas, w, h){ var context = canvas.getContext("2d"); return {context: context, canvas: canvas, x: 0, y: 0, width: w, height: h, line_width: 1, font: caml_string_of_jsbytes("fixed"), text_size: 26, color: 0x000000, title: caml_string_of_jsbytes("")}; } function caml_gr_open_graph(info){ var info = caml_jsstring_of_string(info); function get(name){ var res = info.match("(^|,) *" + name + " *= *([a-zA-Z0-9_]+) *(,|$)"); if(res) return res[2]; } var specs = []; if(! (info === "")) specs.push(info); var target = get("target"); if(! target) target = ""; var status = get("status"); if(! status) specs.push("status=1"); var w = get("width"); w = w ? Number.parseInt(w) : 200; specs.push("width=" + w); var h = get("height"); h = h ? Number.parseInt(h) : 200; specs.push("height=" + h); var win = globalThis.open("about:blank", target, specs.join(",")); if(! win) caml_failwith("Graphics.open_graph: cannot open the window"); var doc = win.document, canvas = doc.createElement("canvas"); canvas.width = w; canvas.height = h; var ctx = caml_gr_state_create(canvas, w, h); ctx.set_title = function(title){doc.title = title;}; caml_gr_state_set(ctx); var body = doc.body; body.style.margin = "0px"; body.appendChild(canvas); return 0; } function caml_gr_open_subwindow(_a, _b, _c, _d){ caml_failwith("caml_gr_open_subwindow not Implemented"); } function caml_gr_plot(x, y){ var s = caml_gr_state_get(), im = s.context.createImageData(1, 1), d = im.data, color = s.color; d[0] = color >> 16 & 0xff; d[1] = color >> 8 & 0xff, d[2] = color >> 0 & 0xff; d[3] = 0xff; s.x = x; s.y = y; s.context.putImageData(im, x, s.height - y); return 0; } function caml_gr_point_color(x, y){ var s = caml_gr_state_get(), im = s.context.getImageData(x, s.height - y, 1, 1), d = im.data; return (d[0] << 16) + (d[1] << 8) + d[2]; } function caml_gr_remember_mode(){ caml_failwith("caml_gr_remember_mode not Implemented"); } function caml_gr_sigio_handler(){return 0;} function caml_gr_sigio_signal(){return 0;} function caml_gr_size_x(){var s = caml_gr_state_get(); return s.width;} function caml_gr_size_y(){var s = caml_gr_state_get(); return s.height;} function caml_gr_synchronize(){ caml_failwith("caml_gr_synchronize not Implemented"); } function caml_gr_text_size(txt){ var s = caml_gr_state_get(), w = s.context.measureText(caml_jsstring_of_string(txt)).width; return [0, w, s.text_size]; } function caml_gr_wait_event(_evl){ caml_failwith ("caml_gr_wait_event not Implemented: use Graphics_js instead"); } function caml_gr_window_id(_a){ caml_failwith("caml_gr_window_id not Implemented"); } function caml_greaterequal(x, y){ return + (caml_compare_val(x, y, false) >= 0); } function caml_greaterthan(x, y){ return + (caml_compare_val(x, y, false) > 0); } function caml_hash_mix_jsbytes(h, s){ var len = s.length, i, w; for(i = 0; i + 4 <= len; i += 4){ w = s.charCodeAt(i) | s.charCodeAt(i + 1) << 8 | s.charCodeAt(i + 2) << 16 | s.charCodeAt(i + 3) << 24; h = caml_hash_mix_int(h, w); } w = 0; switch(len & 3){ case 3: w = s.charCodeAt(i + 2) << 16; case 2: w |= s.charCodeAt(i + 1) << 8; case 1: w |= s.charCodeAt(i); h = caml_hash_mix_int(h, w); } h ^= len; return h; } function caml_hash_mix_string(h, v){ return caml_hash_mix_jsbytes(h, caml_jsbytes_of_string(v)); } function caml_hash_mix_bytes_arr(h, s){ var len = s.length, i, w; for(i = 0; i + 4 <= len; i += 4){ w = s[i] | s[i + 1] << 8 | s[i + 2] << 16 | s[i + 3] << 24; h = caml_hash_mix_int(h, w); } w = 0; switch(len & 3){ case 3: w = s[i + 2] << 16; case 2: w |= s[i + 1] << 8; case 1: w |= s[i]; h = caml_hash_mix_int(h, w); } h ^= len; return h; } function caml_ml_bytes_content(s){ switch(s.t & 6){ case 2: caml_convert_string_to_bytes(s); return s.c; default: return s.c; } } function caml_hash_mix_bytes(h, v){ var content = caml_ml_bytes_content(v); return typeof content === "string" ? caml_hash_mix_jsbytes(h, content) : caml_hash_mix_bytes_arr(h, content); } function caml_hash_mix_final(h){ h ^= h >>> 16; h = caml_mul(h, 0x85ebca6b | 0); h ^= h >>> 13; h = caml_mul(h, 0xc2b2ae35 | 0); h ^= h >>> 16; return h; } function caml_hash(count, limit, seed, obj){ var queue, rd, wr, sz, num, h, v, i, len; sz = limit; if(sz < 0 || sz > 256) sz = 256; num = count; h = seed; queue = [obj]; rd = 0; wr = 1; while(rd < wr && num > 0){ v = queue[rd++]; if(v?.caml_custom){ if (caml_custom_ops[v.caml_custom] && caml_custom_ops[v.caml_custom].hash){ var hh = caml_custom_ops[v.caml_custom].hash(v); h = caml_hash_mix_int(h, hh); num--; } } else if(Array.isArray(v) && v[0] === (v[0] | 0)) switch(v[0]){ case 248: h = caml_hash_mix_int(h, v[2]); num--; break; case 250: queue[--rd] = v[1]; break; default: if(caml_is_continuation_tag(v[0])) break; var tag = v.length - 1 << 10 | v[0]; h = caml_hash_mix_int(h, tag); for(i = 1, len = v.length; i < len; i++){if(wr >= sz) break; queue[wr++] = v[i]; } break; } else if(caml_is_ml_bytes(v)){ h = caml_hash_mix_bytes(h, v); num--; } else if(caml_is_ml_string(v)){ h = caml_hash_mix_string(h, v); num--; } else if(typeof v === "string"){ h = caml_hash_mix_jsbytes(h, v); num--; } else if(v === (v | 0)){ h = caml_hash_mix_int(h, v + v + 1); num--; } else if(typeof v === "number"){h = caml_hash_mix_float(h, v); num--;} } h = caml_hash_mix_final(h); return h & 0x3fffffff; } function caml_hash_mix_bigstring(h, bs){ return caml_hash_mix_bytes_arr(h, bs.data); } function caml_hash_mix_int64(h, v){ h = caml_hash_mix_int(h, caml_int64_lo32(v)); h = caml_hash_mix_int(h, caml_int64_hi32(v)); return h; } function num_digits_nat(nat, ofs, len){ for(var i = len - 1; i >= 0; i--) if(nat.data[ofs + i] !== 0) return i + 1; return 1; } function caml_hash_nat(x){ var len = num_digits_nat(x, 0, x.data.length), h = 0; for(var i = 0; i < len; i++) h = caml_hash_mix_int(h, x.data[i]); return h; } function caml_hexstring_of_float(x, prec, style){ if(! Number.isFinite(x)){ if(Number.isNaN(x)) return caml_string_of_jsstring("nan"); return caml_string_of_jsstring(x > 0 ? "infinity" : "-infinity"); } var sign = x === 0 && 1 / x === Number.NEGATIVE_INFINITY ? 1 : x >= 0 ? 0 : 1; if(sign) x = - x; var exp = 0; if(x === 0) ; else if(x < 1) while(x < 1 && exp > - 1022){x *= 2; exp--;} else while(x >= 2){x /= 2; exp++;} var exp_sign = exp < 0 ? "" : "+", sign_str = ""; if(sign) sign_str = "-"; else switch(style){ case 43: sign_str = "+"; break; case 32: sign_str = " "; break; default: break; } if(prec >= 0 && prec < 13){ var cst = Math.pow(2, prec * 4); x = Math.round(x * cst) / cst; } var x_str = x.toString(16); if(prec >= 0){ var idx = x_str.indexOf("."); if(idx < 0) x_str += "." + caml_str_repeat(prec, "0"); else{ var size = idx + 1 + prec; if(x_str.length < size) x_str += caml_str_repeat(size - x_str.length, "0"); else x_str = x_str.slice(0, size); } } return caml_string_of_jsstring (sign_str + "0x" + x_str + "p" + exp_sign + exp.toString(10)); } function caml_hypot_float(x, y){return Math.hypot(x, y);} var caml_marshal_header_size = 16; function caml_refill(chan){ if(chan.refill != null){ var str = chan.refill(), str_a = caml_uint8_array_of_string(str); if(str_a.length === 0) chan.refill = null; else{ if(chan.buffer.length < chan.buffer_max + str_a.length){ var b = new Uint8Array(chan.buffer_max + str_a.length); b.set(chan.buffer); chan.buffer = b; } chan.buffer.set(str_a, chan.buffer_max); chan.offset += str_a.length; chan.buffer_max += str_a.length; } } else{ if(chan.fd === - 1) caml_raise_sys_error("Bad file descriptor"); var nread = chan.file.read (chan.buffer, chan.buffer_max, chan.buffer.length - chan.buffer_max, false); chan.offset += nread; chan.buffer_max += nread; } } function caml_raise_end_of_file(){ caml_raise_constant(caml_global_data.End_of_file); } function caml_marshal_data_size(s, ofs){ var r = new UInt8ArrayReader(caml_uint8_array_of_bytes(s), ofs); function readvlq(overflow){ var c = r.read8u(), n = c & 0x7f; while((c & 0x80) !== 0){ c = r.read8u(); var n7 = n << 7; if(n !== n7 >> 7) overflow[0] = true; n = n7 | c & 0x7f; } return n; } switch(r.read32u()){ case 0x8495a6be: var header_len = 20, data_len = r.read32u(); break; case 0x8495a6bd: var header_len = r.read8u() & 0x3f, overflow = [false], data_len = readvlq(overflow); if(overflow[0]) caml_failwith ("Marshal.data_size: object too large to be read back on this platform"); break; case 0x8495a6bf: caml_failwith ("Marshal.data_size: object too large to be read back on a 32-bit platform"); break; default: caml_failwith("Marshal.data_size: bad object"); break; } return header_len - caml_marshal_header_size + data_len; } function caml_set_oo_id(b){b[2] = caml_oo_last_id++; return b;} function caml_input_value_from_reader(reader){ function readvlq(overflow){ var c = reader.read8u(), n = c & 0x7f; while((c & 0x80) !== 0){ c = reader.read8u(); var n7 = n << 7; if(n !== n7 >> 7) overflow[0] = true; n = n7 | c & 0x7f; } return n; } var old_pos = reader.i, magic = reader.read32u(); switch(magic){ case 0x8495a6be: var header_len = 20, compressed = 0, data_len = reader.read32u(), uncompressed_data_len = data_len, num_objects = reader.read32u(), _size_32 = reader.read32u(), _size_64 = reader.read32u(); break; case 0x8495a6bd: var header_len = reader.read8u() & 0x3f, compressed = 1, overflow = [false], data_len = readvlq(overflow), uncompressed_data_len = readvlq(overflow), num_objects = readvlq(overflow), _size_32 = readvlq(overflow), _size_64 = readvlq(overflow); if(overflow[0]) caml_failwith ("caml_input_value_from_reader: object too large to be read back on this platform"); break; case 0x8495a6bf: caml_failwith ("caml_input_value_from_reader: object too large to be read back on a 32-bit platform"); break; default: caml_failwith("caml_input_value_from_reader: bad object"); break; } if(header_len !== reader.i - old_pos) caml_failwith("caml_input_value_from_reader: invalid header"); var stack = [], objects = [], intern_obj_table = num_objects > 0 ? [] : null, obj_counter = 0; function intern_rec(reader){ var code = reader.read8u(); if(code >= 0x40) if(code >= 0x80){ var tag = code & 0xf, size = code >> 4 & 0x7, v = [tag]; if(size === 0) return v; if(intern_obj_table) intern_obj_table[obj_counter++] = v; if(tag === 248) objects.push(v); stack.push(v, size); return v; } else return code & 0x3f; else if(code >= 0x20){ var len = code & 0x1f, v = reader.readstr(len); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; } else switch(code){ case 0x00: return reader.read8s(); case 0x01: return reader.read16s(); case 0x02: return reader.read32s(); case 0x03: caml_failwith("input_value: integer too large"); break; case 0x04: var offset = reader.read8u(); if(compressed === 0) offset = obj_counter - offset; return intern_obj_table[offset]; case 0x05: var offset = reader.read16u(); if(compressed === 0) offset = obj_counter - offset; return intern_obj_table[offset]; case 0x06: var offset = reader.read32u(); if(compressed === 0) offset = obj_counter - offset; return intern_obj_table[offset]; case 0x08: var header = reader.read32u(), tag = header & 0xff, size = header >> 10, v = [tag]; if(size === 0) return v; if(intern_obj_table) intern_obj_table[obj_counter++] = v; if(tag === 248) objects.push(v); stack.push(v, size); return v; case 0x13: caml_failwith("input_value: data block too large"); break; case 0x09: var len = reader.read8u(), v = reader.readstr(len); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; case 0x0a: var len = reader.read32u(), v = reader.readstr(len); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; case 0x0c: var t = new Array(8); for(var i = 0; i < 8; i++) t[7 - i] = reader.read8u(); var v = caml_float_of_bytes(t); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; case 0x0b: var t = new Array(8); for(var i = 0; i < 8; i++) t[i] = reader.read8u(); var v = caml_float_of_bytes(t); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; case 0x0e: var len = reader.read8u(), v = new Array(len + 1); v[0] = 254; var t = new Array(8); if(intern_obj_table) intern_obj_table[obj_counter++] = v; for(var i = 1; i <= len; i++){ for(var j = 0; j < 8; j++) t[7 - j] = reader.read8u(); v[i] = caml_float_of_bytes(t); } return v; case 0x0d: var len = reader.read8u(), v = new Array(len + 1); v[0] = 254; var t = new Array(8); if(intern_obj_table) intern_obj_table[obj_counter++] = v; for(var i = 1; i <= len; i++){ for(var j = 0; j < 8; j++) t[j] = reader.read8u(); v[i] = caml_float_of_bytes(t); } return v; case 0x07: var len = reader.read32u(), v = new Array(len + 1); v[0] = 254; if(intern_obj_table) intern_obj_table[obj_counter++] = v; var t = new Array(8); for(var i = 1; i <= len; i++){ for(var j = 0; j < 8; j++) t[7 - j] = reader.read8u(); v[i] = caml_float_of_bytes(t); } return v; case 0x0f: var len = reader.read32u(), v = new Array(len + 1); v[0] = 254; var t = new Array(8); for(var i = 1; i <= len; i++){ for(var j = 0; j < 8; j++) t[j] = reader.read8u(); v[i] = caml_float_of_bytes(t); } return v; case 0x10: case 0x11: caml_failwith("input_value: code pointer"); break; case 0x12: case 0x18: case 0x19: var c, s = ""; while((c = reader.read8u()) !== 0) s += String.fromCharCode(c); var ops = caml_custom_ops[s], expected_size; if(! ops) caml_failwith("input_value: unknown custom block identifier"); switch(code){ case 0x12: break; case 0x19: if(! ops.fixed_length) caml_failwith("input_value: expected a fixed-size custom block"); expected_size = ops.fixed_length; break; case 0x18: expected_size = reader.read32u(); reader.read32s(); reader.read32s(); break; } var size = [0], v = ops.deserialize(reader, size); if(expected_size !== undefined) if(expected_size !== size[0]) caml_failwith ("input_value: incorrect length of serialized custom block"); if(intern_obj_table) intern_obj_table[obj_counter++] = v; return v; default: caml_failwith("input_value: ill-formed message"); } } if(compressed) if(caml_decompress_input) var data = reader.readuint8array(data_len), res = new Uint8Array(uncompressed_data_len), res = caml_decompress_input(data, res), reader = new UInt8ArrayReader(res, 0); else caml_failwith("input_value: compressed object, cannot decompress"); var res = intern_rec(reader); while(stack.length > 0){ var size = stack.pop(), v = stack.pop(), d = v.length; if(d < size) stack.push(v, size); v[d] = intern_rec(reader); } while(objects.length > 0){ var x = objects.pop(); if(x[2] >= 0) caml_set_oo_id(x); } return res; } function caml_input_value_from_bytes(s, ofs){ var c = caml_ml_bytes_content(s), ofs = typeof ofs === "number" ? ofs : ofs[0], reader = c instanceof Uint8Array ? new UInt8ArrayReader(c, ofs) : new JsStringReader(c, ofs); return caml_input_value_from_reader(reader); } function caml_input_value(chanid){ var chan = caml_ml_channel_get(chanid), header = new Uint8Array(caml_marshal_header_size); function block(buffer, offset, n){ var r = 0; while(r < n){ if(chan.buffer_curr >= chan.buffer_max){ chan.buffer_curr = 0; chan.buffer_max = 0; caml_refill(chan); } if(chan.buffer_curr >= chan.buffer_max) break; buffer[offset + r] = chan.buffer[chan.buffer_curr]; chan.buffer_curr++; r++; } return r; } var r = block(header, 0, caml_marshal_header_size); if(r === 0) caml_raise_end_of_file(); else if(r < caml_marshal_header_size) caml_failwith("input_value: truncated object"); var len = caml_marshal_data_size(caml_bytes_of_uint8_array(header), 0), buf = new Uint8Array(len + caml_marshal_header_size); buf.set(header, 0); var r = block(buf, caml_marshal_header_size, len); if(r < len) caml_failwith("input_value: truncated object " + r + " " + len); var res = caml_input_value_from_bytes(caml_bytes_of_uint8_array(buf), 0); return res; } function caml_input_value_to_outside_heap(c){return caml_input_value(c);} function caml_install_signal_handler(){return 0;} function caml_int32_bswap(x){ return (x & 0x000000ff) << 24 | (x & 0x0000ff00) << 8 | (x & 0x00ff0000) >>> 8 | (x & 0xff000000) >>> 24; } function caml_int64_add(x, y){return x.add(y);} function caml_int64_and(x, y){return x.and(y);} function caml_int64_bswap(x){ var y = caml_int64_to_bytes(x); return caml_int64_of_bytes ([y[7], y[6], y[5], y[4], y[3], y[2], y[1], y[0]]); } function caml_int64_div(x, y){return x.div(y);} function caml_int64_is_zero(x){return + x.isZero();} function caml_int64_of_int32(x){ return new MlInt64(x & 0xffffff, x >> 24 & 0xffffff, x >> 31 & 0xffff); } function caml_int64_to_int32(x){return x.toInt();} function caml_int64_is_negative(x){return + x.isNeg();} function caml_int64_neg(x){return x.neg();} function caml_int64_format(fmt, x){ var f = caml_parse_format(fmt); if(f.signedconv && caml_int64_is_negative(x)){f.sign = - 1; x = caml_int64_neg(x);} var buffer = "", wbase = caml_int64_of_int32(f.base), cvtbl = "0123456789abcdef"; do{ var p = x.udivmod(wbase); x = p.quotient; buffer = cvtbl.charAt(caml_int64_to_int32(p.modulus)) + buffer; } while (! caml_int64_is_zero(x)); if(f.prec >= 0){ f.filler = " "; var n = f.prec - buffer.length; if(n > 0) buffer = caml_str_repeat(n, "0") + buffer; } return caml_finish_formatting(f, buffer); } function caml_int64_mod(x, y){return x.mod(y);} function caml_int64_mul(x, y){return x.mul(y);} function caml_int64_ult(x, y){return x.ucompare(y) < 0;} function caml_parse_sign_and_base(s){ var i = 0, len = caml_ml_string_length(s), base = 10, sign = 1, signedness = 1; if(len > 0) switch(caml_string_unsafe_get(s, i)){ case 45: i++; sign = - 1; break; case 43: i++; sign = 1; break; } if(i + 1 < len && caml_string_unsafe_get(s, i) === 48) switch(caml_string_unsafe_get(s, i + 1)){ case 120: case 88: signedness = 0; base = 16; i += 2; break; case 111: case 79: signedness = 0; base = 8; i += 2; break; case 98: case 66: signedness = 0; base = 2; i += 2; break; case 117: case 85: signedness = 0; i += 2; break; } return [i, sign, base, signedness]; } function caml_parse_digit(c){ if(c >= 48 && c <= 57) return c - 48; if(c >= 65 && c <= 90) return c - 55; if(c >= 97 && c <= 122) return c - 87; return - 1; } function caml_int64_of_string(s){ var r = caml_parse_sign_and_base(s), i = r[0], sign = r[1], base = r[2], signedness = r[3], base64 = caml_int64_of_int32(base), threshold = MlInt64.UNSIGNED_MAX.udivmod(base64).quotient, c = caml_string_unsafe_get(s, i), d = caml_parse_digit(c); if(d < 0 || d >= base) caml_failwith("Int64.of_string"); var res = caml_int64_of_int32(d); for(;;){ i++; c = caml_string_unsafe_get(s, i); if(c === 95) continue; d = caml_parse_digit(c); if(d < 0 || d >= base) break; if(caml_int64_ult(threshold, res)) caml_failwith("Int64.of_string"); d = caml_int64_of_int32(d); res = caml_int64_add(caml_int64_mul(base64, res), d); if(caml_int64_ult(res, d)) caml_failwith("Int64.of_string"); } if(i !== caml_ml_string_length(s)) caml_failwith("Int64.of_string"); if (signedness && caml_int64_ult(sign < 0 ? MlInt64.SIGNED_MIN : MlInt64.SIGNED_MAX, res)) caml_failwith("Int64.of_string"); if(sign < 0) res = caml_int64_neg(res); return res; } function caml_int64_or(x, y){return x.or(y);} function caml_int64_shift_left(x, s){return x.shift_left(s);} function caml_int64_shift_right(x, s){return x.shift_right(s);} function caml_int64_shift_right_unsigned(x, s){return x.shift_right_unsigned(s); } function caml_int64_sub(x, y){return x.sub(y);} function caml_int64_to_float(x){return x.toFloat();} function caml_int64_xor(x, y){return x.xor(y);} function caml_int_of_string(s){ var r = caml_parse_sign_and_base(s), i = r[0], sign = r[1], base = r[2], signedness = r[3], len = caml_ml_string_length(s), threshold = - 1 >>> 0, c = i < len ? caml_string_unsafe_get(s, i) : 0, d = caml_parse_digit(c); if(d < 0 || d >= base) caml_failwith("int_of_string"); var res = d; for(i++; i < len; i++){ c = caml_string_unsafe_get(s, i); if(c === 95) continue; d = caml_parse_digit(c); if(d < 0 || d >= base) break; res = base * res + d; if(res > threshold) caml_failwith("int_of_string"); } if(i !== len) caml_failwith("int_of_string"); res = sign * res; if(signedness && (res | 0) !== res) caml_failwith("int_of_string"); return res | 0; } var caml_io_buffer_size = 65536; function caml_is_js(){return 1;} function caml_is_printable(c){return + (c > 31 && c < 127);} function caml_js_call(f, o, args){ return f.apply(o, caml_js_from_array(args)); } function caml_js_delete(o, f){delete o[f]; return 0;} function caml_js_equals(x, y){return + (x == y);} function caml_js_error_of_exception(exn){ if(exn.js_error) return exn.js_error; return null; } function caml_js_error_option_of_exception(exn){ if(exn.js_error) return [0, exn.js_error]; return 0; } function caml_js_eval_string(s){ return eval?.('"use strict";' + caml_jsstring_of_string(s)); } function caml_js_expr(s){ console.error("caml_js_expr: fallback to runtime evaluation\n"); return eval?.('"use strict";(' + caml_jsstring_of_string(s) + ")"); } function caml_js_from_bool(x){return ! ! x;} function caml_js_from_float(x){return x;} function caml_js_from_string(s){return caml_jsstring_of_string(s);} function caml_js_fun_call(f, a){ switch(a.length){ case 1: return f(); case 2: return f(a[1]); case 3: return f(a[1], a[2]); case 4: return f(a[1], a[2], a[3]); case 5: return f(a[1], a[2], a[3], a[4]); case 6: return f(a[1], a[2], a[3], a[4], a[5]); case 7: return f(a[1], a[2], a[3], a[4], a[5], a[6]); case 8: return f(a[1], a[2], a[3], a[4], a[5], a[6], a[7]); } return f.apply(null, caml_js_from_array(a)); } function caml_js_function_arity(f){return f.l >= 0 ? f.l : f.l = f.length;} function caml_js_get(o, f){return o[f];} function caml_js_get_console(){ var c = console, m = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "trace", "group", "groupCollapsed", "groupEnd", "time", "timeEnd"]; function f(){} for(var i = 0; i < m.length; i++) if(! c[m[i]]) c[m[i]] = f; return c; } function caml_js_html_entities(s){ var entity = /^&#?[0-9a-zA-Z]+;$/; if(s.match(entity)){ var str, temp = document.createElement("p"); temp.innerHTML = s; str = temp.textContent || temp.innerText; temp = null; return str; } else return null; } var caml_js_regexps = {amp: /&/g, lt: />> 0) return x[0]; else if(caml_is_ml_bytes(x)) return 252; else if(caml_is_ml_string(x)) return 252; else if(x instanceof Function || typeof x === "function") return 247; else if(x?.caml_custom) return 255; else return 1000; } function caml_lazy_read_result(o){ return caml_obj_tag(o) === 250 ? o[1] : o; } function caml_obj_update_tag(b, o, n){ if(b[0] === o){b[0] = n; return 1;} return 0; } function caml_lazy_reset_to_lazy(o){ caml_obj_update_tag(o, 244, 246); return 0; } function caml_lazy_update_to_forcing(o){ return Array.isArray(o) && o[0] === o[0] >>> 0 && caml_obj_update_tag(o, 246, 244) ? 0 : 1; } function caml_lazy_update_to_forward(o){ caml_obj_update_tag(o, 244, 250); return 0; } function caml_ldexp_float(x, exp){ exp |= 0; if(exp > 1023){ exp -= 1023; x *= Math.pow(2, 1023); if(exp > 1023){exp -= 1023; x *= Math.pow(2, 1023);} } if(exp < - 1023){exp += 1023; x *= Math.pow(2, - 1023);} x *= Math.pow(2, exp); return x; } function caml_lessequal(x, y){ return + (caml_compare_val(x, y, false) <= 0); } function caml_lessthan(x, y){return + (caml_compare_val(x, y, false) < 0);} function caml_lex_array(s){ s = caml_jsbytes_of_string(s); var l = s.length / 2, a = new Array(l); for(var i = 0; i < l; i++) a[i] = (s.charCodeAt(2 * i) | s.charCodeAt(2 * i + 1) << 8) << 16 >> 16; return a; } function caml_lex_engine(tbl, start_state, lexbuf){ var lex_buffer = 2, lex_buffer_len = 3, lex_start_pos = 5, lex_curr_pos = 6, lex_last_pos = 7, lex_last_action = 8, lex_eof_reached = 9, lex_base = 1, lex_backtrk = 2, lex_default = 3, lex_trans = 4, lex_check = 5; if(! tbl.lex_default){ tbl.lex_base = caml_lex_array(tbl[lex_base]); tbl.lex_backtrk = caml_lex_array(tbl[lex_backtrk]); tbl.lex_check = caml_lex_array(tbl[lex_check]); tbl.lex_trans = caml_lex_array(tbl[lex_trans]); tbl.lex_default = caml_lex_array(tbl[lex_default]); } var c, state = start_state, buffer = lexbuf[lex_buffer]; if(state >= 0){ lexbuf[lex_last_pos] = lexbuf[lex_start_pos] = lexbuf[lex_curr_pos]; lexbuf[lex_last_action] = - 1; } else state = - state - 1; for(;;){ var base = tbl.lex_base[state]; if(base < 0) return - base - 1; var backtrk = tbl.lex_backtrk[state]; if(backtrk >= 0){ lexbuf[lex_last_pos] = lexbuf[lex_curr_pos]; lexbuf[lex_last_action] = backtrk; } if(lexbuf[lex_curr_pos] >= lexbuf[lex_buffer_len]) if(lexbuf[lex_eof_reached] === 0) return - state - 1; else c = 256; else{ c = caml_bytes_unsafe_get(buffer, lexbuf[lex_curr_pos]); lexbuf[lex_curr_pos]++; } if(tbl.lex_check[base + c] === state) state = tbl.lex_trans[base + c]; else state = tbl.lex_default[state]; if(state < 0){ lexbuf[lex_curr_pos] = lexbuf[lex_last_pos]; if(lexbuf[lex_last_action] === - 1) caml_failwith("lexing: empty token"); else return lexbuf[lex_last_action]; } else if(c === 256) lexbuf[lex_eof_reached] = 0; } } function caml_list_mount_point(){ var prev = 0; for(var i = 0; i < jsoo_mount_point.length; i++){ var old = prev; prev = [0, caml_string_of_jsstring(jsoo_mount_point[i].path), old]; } return prev; } function caml_list_of_js_array(a){ var l = 0; for(var i = a.length - 1; i >= 0; i--){var e = a[i]; l = [0, e, l];} return l; } function caml_list_to_js_array(l){ var a = []; for(; l !== 0; l = l[2]) a.push(l[1]); return a; } function caml_log10_float(x){return Math.log10(x);} function caml_log1p_float(x){return Math.log1p(x);} function caml_log2_float(x){return Math.log2(x);} var caml_lxm_M = caml_int64_of_string(caml_string_of_jsstring("0xd1342543de82ef95")), caml_lxm_daba = caml_int64_of_string(caml_string_of_jsstring("0xdaba0b6eb09322e3")); function caml_lxm_next(v){ function shift_l(x, k){return caml_int64_shift_left(x, k);} function shift_r(x, k){return caml_int64_shift_right_unsigned(x, k);} function or(a, b){return caml_int64_or(a, b);} function xor(a, b){return caml_int64_xor(a, b);} function add(a, b){return caml_int64_add(a, b);} function mul(a, b){return caml_int64_mul(a, b);} function rotl(x, k){return or(shift_l(x, k), shift_r(x, 64 - k));} function get(a, i){return caml_ba_get_1(a, i);} function set(a, i, x){return caml_ba_set_1(a, i, x);} var M = caml_lxm_M, daba = caml_lxm_daba, z, q0, q1, st = v, a = get(st, 0), s = get(st, 1), x0 = get(st, 2), x1 = get(st, 3); z = add(s, x0); z = mul(xor(z, shift_r(z, 32)), daba); z = mul(xor(z, shift_r(z, 32)), daba); z = xor(z, shift_r(z, 32)); set(st, 1, add(mul(s, M), a)); var q0 = x0, q1 = x1; q1 = xor(q1, q0); q0 = rotl(q0, 24); q0 = xor(xor(q0, q1), shift_l(q1, 16)); q1 = rotl(q1, 37); set(st, 2, q0); set(st, 3, q1); return z; } function caml_make_float_vect(len){ if(len >>> 0 >= (0x7fffffff / 8 | 0)) caml_array_bound_error(); var len = len + 1 | 0, b = new Array(len); b[0] = 254; for(var i = 1; i < len; i++) b[i] = 0; return b; } function caml_make_vect(len, init){return caml_array_make(len, init);} var caml_marshal_constants = {PREFIX_SMALL_BLOCK: 0x80, PREFIX_SMALL_INT: 0x40, PREFIX_SMALL_STRING: 0x20, CODE_INT8: 0x00, CODE_INT16: 0x01, CODE_INT32: 0x02, CODE_INT64: 0x03, CODE_SHARED8: 0x04, CODE_SHARED16: 0x05, CODE_SHARED32: 0x06, CODE_BLOCK32: 0x08, CODE_BLOCK64: 0x13, CODE_STRING8: 0x09, CODE_STRING32: 0x0a, CODE_DOUBLE_BIG: 0x0b, CODE_DOUBLE_LITTLE: 0x0c, CODE_DOUBLE_ARRAY8_BIG: 0x0d, CODE_DOUBLE_ARRAY8_LITTLE: 0x0e, CODE_DOUBLE_ARRAY32_BIG: 0x0f, CODE_DOUBLE_ARRAY32_LITTLE: 0x07, CODE_CODEPOINTER: 0x10, CODE_INFIXPOINTER: 0x11, CODE_CUSTOM: 0x12, CODE_CUSTOM_LEN: 0x18, CODE_CUSTOM_FIXED: 0x19}; function caml_maybe_print_stats(_unit){return 0;} function caml_md5_bytes(s, ofs, len){ var ctx = caml_MD5Init(), a = caml_uint8_array_of_bytes(s); caml_MD5Update(ctx, a.subarray(ofs, ofs + len), len); return caml_string_of_uint8_array(caml_MD5Final(ctx)); } function caml_ml_input_block(chanid, ba, i, l){ var chan = caml_ml_channel_get(chanid), n = l, avail = chan.buffer_max - chan.buffer_curr; if(l <= avail){ ba.set(chan.buffer.subarray(chan.buffer_curr, chan.buffer_curr + l), i); chan.buffer_curr += l; } else if(avail > 0){ ba.set (chan.buffer.subarray(chan.buffer_curr, chan.buffer_curr + avail), i); chan.buffer_curr += avail; n = avail; } else{ chan.buffer_curr = 0; chan.buffer_max = 0; caml_refill(chan); var avail = chan.buffer_max - chan.buffer_curr; if(n > avail) n = avail; ba.set(chan.buffer.subarray(chan.buffer_curr, chan.buffer_curr + n), i); chan.buffer_curr += n; } return n | 0; } function caml_md5_chan(chanid, toread){ var ctx = caml_MD5Init(), buffer = new Uint8Array(4096); if(toread < 0) while(true){ var read = caml_ml_input_block(chanid, buffer, 0, buffer.length); if(read === 0) break; caml_MD5Update(ctx, buffer.subarray(0, read), read); } else while(toread > 0){ var read = caml_ml_input_block (chanid, buffer, 0, toread > buffer.length ? buffer.length : toread); if(read === 0) caml_raise_end_of_file(); caml_MD5Update(ctx, buffer.subarray(0, read), read); toread -= read; } return caml_string_of_uint8_array(caml_MD5Final(ctx)); } function caml_md5_string(s, ofs, len){ return caml_md5_bytes(caml_bytes_of_string(s), ofs, len); } function caml_memprof_discard(_t){return 0;} function caml_memprof_start(_rate, _stack_size, _tracker){return 0;} function caml_memprof_stop(_unit){return 0;} function caml_ml_channel_redirect(captured, into){ var to_restore = caml_ml_channel_get(captured), new_ = caml_ml_channel_get(into); caml_ml_channels.set(captured, new_); return to_restore; } function caml_ml_channel_restore(captured, to_restore){caml_ml_channels.set(captured, to_restore); return 0; } function caml_ml_channel_size(chanid){ var chan = caml_ml_channel_get(chanid); return chan.file.length() | 0; } function caml_ml_channel_size_64(chanid){ var chan = caml_ml_channel_get(chanid); return caml_int64_of_float(chan.file.length()); } var caml_sys_fds = new Array(3); function caml_sys_close(fd){ var x = caml_sys_fds[fd]; if(x){x.file.close(false); delete caml_sys_fds[fd];} return 0; } function caml_ml_flush(chanid){ var chan = caml_ml_channel_get(chanid); if(! chan.opened) caml_raise_sys_error("Cannot flush a closed channel"); if(! chan.buffer || chan.buffer_curr === 0) return 0; if(chan.output) chan.output (caml_sub_uint8_array_to_jsbytes(chan.buffer, 0, chan.buffer_curr)); else for(var pos = 0; pos < chan.buffer_curr;) pos += chan.file.write(chan.buffer, pos, chan.buffer_curr - pos, false); chan.offset += chan.buffer_curr; chan.buffer_curr = 0; return 0; } function caml_ml_close_channel(chanid){ var chan = caml_ml_channel_get(chanid); if(chan.opened){ chan.opened = false; caml_ml_channels.close(chanid); caml_sys_close(chan.fd); chan.fd = - 1; chan.buffer = new Uint8Array(0); chan.buffer_curr = 0; chan.buffer_max = 0; } return 0; } function caml_ml_condition_broadcast(_t){return 0;} function caml_ml_condition_new(_unit){return {condition: 1};} function caml_ml_condition_signal(_t){return 0;} function caml_ml_condition_wait(_t, _mutext){return 0;} function caml_ml_debug_info_status(){return 0;} function caml_ml_domain_cpu_relax(_unit){return 0;} function caml_ml_domain_id(_unit){return caml_domain_id;} var caml_runtime_warnings = 0; function caml_ml_enable_runtime_warnings(bool){caml_runtime_warnings = bool; return 0; } function caml_ml_input(chanid, b, i, l){ var ba = caml_uint8_array_of_bytes(b); return caml_ml_input_block(chanid, ba, i, l); } function caml_ml_input_bigarray(chanid, b, i, l){ var ba = caml_ba_to_typed_array(b); return caml_ml_input_block(chanid, ba, i, l); } function caml_ml_input_char(chanid){ var chan = caml_ml_channel_get(chanid); if(chan.buffer_curr >= chan.buffer_max){ chan.buffer_curr = 0; chan.buffer_max = 0; caml_refill(chan); } if(chan.buffer_curr >= chan.buffer_max) caml_raise_end_of_file(); var res = chan.buffer[chan.buffer_curr]; chan.buffer_curr++; return res; } function caml_ml_input_int(chanid){ var res = 0; for(var i = 0; i < 4; i++) res = (res << 8) + caml_ml_input_char(chanid) | 0; return res | 0; } function caml_ml_input_scan_line(chanid){ var chan = caml_ml_channel_get(chanid), p = chan.buffer_curr; do if(p >= chan.buffer_max){ if(chan.buffer_curr > 0){ chan.buffer.set(chan.buffer.subarray(chan.buffer_curr), 0); p -= chan.buffer_curr; chan.buffer_max -= chan.buffer_curr; chan.buffer_curr = 0; } if(chan.buffer_max >= chan.buffer.length) return - chan.buffer_max | 0; var prev_max = chan.buffer_max; caml_refill(chan); if(prev_max === chan.buffer_max) return - chan.buffer_max | 0; } while (chan.buffer[p++] !== 10); return p - chan.buffer_curr | 0; } function caml_ml_is_binary_mode(chanid){ var chan = caml_ml_channel_get(chanid); return chan.file.flags.binary; } function caml_ml_is_buffered(chanid){ return caml_ml_channel_get(chanid).buffered ? 1 : 0; } function caml_ml_mutex_lock(t){ if(t.locked) caml_failwith("Mutex.lock: mutex already locked. Cannot wait."); else t.locked = true; return 0; } function caml_ml_mutex_new(_unit){return new MlMutex();} function caml_ml_mutex_try_lock(t){ if(! t.locked){t.locked = true; return 1;} return 0; } function caml_sys_open_for_node(fd, flags){ if(flags.altname) try{ var fs = require("node:fs"), fd2 = fs.openSync(flags.altname, "rs"); return new MlNodeFd(fd2, flags); } catch(e){} return new MlNodeFd(fd, flags); } function caml_sys_open_internal(file, idx){ var chanid; if(idx === undefined){ idx = caml_sys_fds.length; chanid = new MlChanid(idx); } else if(caml_sys_fds[idx]) chanid = caml_sys_fds[idx].chanid; else chanid = new MlChanid(idx); caml_sys_fds[idx] = {file: file, chanid: chanid}; return idx | 0; } function caml_sys_open(name, flags, perms){ var f = {}; while(flags){ switch(flags[1]){ case 0: f.rdonly = 1; break; case 1: f.wronly = 1; break; case 2: f.append = 1; f.writeonly = 1; break; case 3: f.create = 1; break; case 4: f.truncate = 1; break; case 5: f.excl = 1; break; case 6: f.binary = 1; break; case 7: f.text = 1; break; case 8: f.nonblock = 1; break; } flags = flags[2]; } var root = resolve_fs_device(name), file = root.device.open(root.rest, f, perms); return caml_sys_open_internal(file, undefined); } (function(){ var is_node = fs_node_supported(); function file(fd, flags){ return is_node ? caml_sys_open_for_node(fd, flags) : new MlFakeFd_out(fd, flags); } caml_sys_open_internal (file(0, {rdonly: 1, altname: "/dev/stdin", isCharacterDevice: true}), 0); caml_sys_open_internal (file (1, {buffered: is_node ? 1 : 2, wronly: 1, isCharacterDevice: true}), 1); caml_sys_open_internal (file (2, {buffered: is_node ? 1 : 2, wronly: 1, isCharacterDevice: true}), 2); } ()); function caml_ml_open_descriptor_in(fd){ var fd_desc = caml_sys_fds[fd]; if(fd_desc === undefined) caml_raise_sys_error("fd " + fd + " doesn't exist"); var file = fd_desc.file, chanid = fd_desc.chanid, refill = null, channel = {file: file, offset: file.pos(), fd: fd, opened: true, out: false, buffer_curr: 0, buffer_max: 0, buffer: new Uint8Array(caml_io_buffer_size), refill: refill}; caml_ml_channels.set(chanid, channel); return chanid; } function caml_ml_open_descriptor_in_with_flags(fd, _flags){return caml_ml_open_descriptor_in(fd); } function caml_ml_open_descriptor_out(fd){ var fd_desc = caml_sys_fds[fd]; if(fd_desc === undefined) caml_raise_sys_error("fd " + fd + " doesn't exist"); var file = fd_desc.file, chanid = fd_desc.chanid, buffered = file.flags.buffered !== undefined ? file.flags.buffered : 1, channel = {file: file, offset: file.pos(), fd: fd, opened: true, out: true, buffer_curr: 0, buffer: new Uint8Array(caml_io_buffer_size), buffered: buffered}; caml_ml_channels.set(chanid, channel); return chanid; } function caml_ml_open_descriptor_out_with_flags(fd, _flags){return caml_ml_open_descriptor_out(fd); } function caml_ml_out_channels_list(){ var l = 0, keys = caml_ml_channels.all(); for(var k of keys){ var chan = caml_ml_channel_get(k); if(chan.opened && chan.out) l = [0, k, l]; } return l; } function caml_ml_output_ta(chanid, buffer, offset, len){ var chan = caml_ml_channel_get(chanid); if(! chan.opened) caml_raise_sys_error("Cannot output to a closed channel"); buffer = buffer.subarray(offset, offset + len); if(chan.buffer_curr + buffer.length > chan.buffer.length){ var b = new Uint8Array(chan.buffer_curr + buffer.length); b.set(chan.buffer); chan.buffer = b; } switch(chan.buffered){ case 0: chan.buffer.set(buffer, chan.buffer_curr); chan.buffer_curr += buffer.length; caml_ml_flush(chanid); break; case 1: chan.buffer.set(buffer, chan.buffer_curr); chan.buffer_curr += buffer.length; if(chan.buffer_curr >= chan.buffer.length) caml_ml_flush(chanid); break; case 2: var id = buffer.lastIndexOf(10); if(id < 0){ chan.buffer.set(buffer, chan.buffer_curr); chan.buffer_curr += buffer.length; if(chan.buffer_curr >= chan.buffer.length) caml_ml_flush(chanid); } else{ chan.buffer.set(buffer.subarray(0, id + 1), chan.buffer_curr); chan.buffer_curr += id + 1; caml_ml_flush(chanid); chan.buffer.set(buffer.subarray(id + 1), chan.buffer_curr); chan.buffer_curr += buffer.length - id - 1; } break; } return 0; } function caml_ml_output_bytes(chanid, buffer, offset, len){ var buffer = caml_uint8_array_of_bytes(buffer); return caml_ml_output_ta(chanid, buffer, offset, len); } function caml_ml_output(chanid, buffer, offset, len){ return caml_ml_output_bytes (chanid, caml_bytes_of_string(buffer), offset, len); } function caml_ml_output_bigarray(chanid, buffer, offset, len){ var buffer = caml_ba_to_typed_array(buffer); return caml_ml_output_ta(chanid, buffer, offset, len); } function caml_ml_output_char(chanid, c){ var s = caml_string_of_jsbytes(String.fromCharCode(c)); caml_ml_output(chanid, s, 0, 1); return 0; } function caml_ml_output_int(chanid, i){ var arr = [i >> 24 & 0xff, i >> 16 & 0xff, i >> 8 & 0xff, i & 0xff]; caml_ml_output_ta(chanid, new Uint8Array(arr), 0, 4); return 0; } function caml_pos_in(chanid){ var chan = caml_ml_channel_get(chanid); return chan.offset - (chan.buffer_max - chan.buffer_curr); } function caml_ml_pos_in(chanid){return caml_pos_in(chanid) | 0;} function caml_ml_pos_in_64(chanid){ return caml_int64_of_float(caml_pos_in(chanid)); } function caml_pos_out(chanid){ var chan = caml_ml_channel_get(chanid); return chan.offset + chan.buffer_curr; } function caml_ml_pos_out(chanid){return caml_pos_out(chanid) | 0;} function caml_ml_pos_out_64(chanid){ return caml_int64_of_float(caml_pos_out(chanid)); } function caml_ml_runtime_events_are_active(){return 0;} function caml_ml_runtime_events_pause(){return 0;} function caml_ml_runtime_events_resume(){return 0;} function caml_ml_runtime_events_start(){return 0;} function caml_ml_runtime_warnings_enabled(_unit){return caml_runtime_warnings; } function caml_seek_in(chanid, pos){ var chan = caml_ml_channel_get(chanid); if(chan.refill != null) caml_raise_sys_error("Illegal seek"); if (pos >= chan.offset - chan.buffer_max && pos <= chan.offset && chan.file.flags.binary) chan.buffer_curr = chan.buffer_max - (chan.offset - pos); else{ chan.file.seek(pos, 0); chan.offset = pos; chan.buffer_curr = 0; chan.buffer_max = 0; } return 0; } function caml_ml_seek_in(chanid, pos){return caml_seek_in(chanid, pos);} function caml_ml_seek_in_64(chanid, pos){ var pos = caml_int64_to_float(pos); return caml_seek_in(chanid, pos); } function caml_seek_out(chanid, pos){ caml_ml_flush(chanid); var chan = caml_ml_channel_get(chanid); chan.file.seek(pos, 0); chan.offset = pos; return 0; } function caml_ml_seek_out(chanid, pos){return caml_seek_out(chanid, pos);} function caml_ml_seek_out_64(chanid, pos){ var pos = caml_int64_to_float(pos); return caml_seek_out(chanid, pos); } function caml_ml_set_binary_mode(chanid, mode){ var chan = caml_ml_channel_get(chanid); chan.file.flags.text = ! mode; chan.file.flags.binary = mode; return 0; } function caml_ml_set_buffered(chanid, v){ caml_ml_channel_get(chanid).buffered = v; if(! v) caml_ml_flush(chanid); return 0; } function caml_ml_set_channel_name(chanid, name){ var chan = caml_ml_channel_get(chanid); chan.name = name; return 0; } function caml_ml_set_channel_output(chanid, f){ var chan = caml_ml_channel_get(chanid); chan.output = function(s){f(s);}; return 0; } function caml_ml_set_channel_refill(chanid, f){ caml_ml_channel_get(chanid).refill = f; return 0; } function caml_mod(x, y){ if(y === 0) caml_raise_zero_divide(); return x % y; } function caml_modf_float(x){ if(Number.isFinite(x)){ var neg = 1 / x < 0; x = Math.abs(x); var i = Math.floor(x), f = x - i; if(neg){i = - i; f = - f;} return [0, f, i]; } if(Number.isNaN(x)) return [0, Number.NaN, Number.NaN]; return [0, 1 / x, x]; } function caml_mount_autoload(name, f){ var path = caml_make_path(name), name = caml_trailing_slash(path.join("/")); jsoo_mount_point.push({path: name, device: new MlFakeDevice(name, f)}); return 0; } function caml_lex_run_mem(s, i, mem, curr_pos){ for(;;){ var dst = s.charCodeAt(i); i++; if(dst === 0xff) return; var src = s.charCodeAt(i); i++; if(src === 0xff) mem[dst + 1] = curr_pos; else mem[dst + 1] = mem[src + 1]; } } function caml_lex_run_tag(s, i, mem){ for(;;){ var dst = s.charCodeAt(i); i++; if(dst === 0xff) return; var src = s.charCodeAt(i); i++; if(src === 0xff) mem[dst + 1] = - 1; else mem[dst + 1] = mem[src + 1]; } } function caml_new_lex_engine(tbl, start_state, lexbuf){ var lex_buffer = 2, lex_buffer_len = 3, lex_start_pos = 5, lex_curr_pos = 6, lex_last_pos = 7, lex_last_action = 8, lex_eof_reached = 9, lex_mem = 10, lex_base = 1, lex_backtrk = 2, lex_default = 3, lex_trans = 4, lex_check = 5, lex_base_code = 6, lex_backtrk_code = 7, lex_default_code = 8, lex_trans_code = 9, lex_check_code = 10, lex_code = 11; if(! tbl.lex_default){ tbl.lex_base = caml_lex_array(tbl[lex_base]); tbl.lex_backtrk = caml_lex_array(tbl[lex_backtrk]); tbl.lex_check = caml_lex_array(tbl[lex_check]); tbl.lex_trans = caml_lex_array(tbl[lex_trans]); tbl.lex_default = caml_lex_array(tbl[lex_default]); } if(! tbl.lex_default_code){ tbl.lex_base_code = caml_lex_array(tbl[lex_base_code]); tbl.lex_backtrk_code = caml_lex_array(tbl[lex_backtrk_code]); tbl.lex_check_code = caml_lex_array(tbl[lex_check_code]); tbl.lex_trans_code = caml_lex_array(tbl[lex_trans_code]); tbl.lex_default_code = caml_lex_array(tbl[lex_default_code]); } if(tbl.lex_code == null) tbl.lex_code = caml_jsbytes_of_string(tbl[lex_code]); var c, state = start_state, buffer = lexbuf[lex_buffer]; if(state >= 0){ lexbuf[lex_last_pos] = lexbuf[lex_start_pos] = lexbuf[lex_curr_pos]; lexbuf[lex_last_action] = - 1; } else state = - state - 1; for(;;){ var base = tbl.lex_base[state]; if(base < 0){ var pc_off = tbl.lex_base_code[state]; caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]); return - base - 1; } var backtrk = tbl.lex_backtrk[state]; if(backtrk >= 0){ var pc_off = tbl.lex_backtrk_code[state]; caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]); lexbuf[lex_last_pos] = lexbuf[lex_curr_pos]; lexbuf[lex_last_action] = backtrk; } if(lexbuf[lex_curr_pos] >= lexbuf[lex_buffer_len]) if(lexbuf[lex_eof_reached] === 0) return - state - 1; else c = 256; else{ c = caml_bytes_unsafe_get(buffer, lexbuf[lex_curr_pos]); lexbuf[lex_curr_pos]++; } var pstate = state; if(tbl.lex_check[base + c] === state) state = tbl.lex_trans[base + c]; else state = tbl.lex_default[state]; if(state < 0){ lexbuf[lex_curr_pos] = lexbuf[lex_last_pos]; if(lexbuf[lex_last_action] === - 1) caml_failwith("lexing: empty token"); else return lexbuf[lex_last_action]; } else{ var base_code = tbl.lex_base_code[pstate], pc_off; if(tbl.lex_check_code[base_code + c] === pstate) pc_off = tbl.lex_trans_code[base_code + c]; else pc_off = tbl.lex_default_code[pstate]; if(pc_off > 0) caml_lex_run_mem (tbl.lex_code, pc_off, lexbuf[lex_mem], lexbuf[lex_curr_pos]); if(c === 256) lexbuf[lex_eof_reached] = 0; } } } function caml_new_string(s){return caml_string_of_jsbytes(s);} function caml_nextafter_float(x, y){ if(Number.isNaN(x) || Number.isNaN(y)) return Number.NaN; if(x === y) return y; if(x === 0) return y < 0 ? - Math.pow(2, - 1074) : Math.pow(2, - 1074); var bits = caml_int64_bits_of_float(x), one = caml_int64_of_int32(1); if(x < y === x > 0) bits = caml_int64_add(bits, one); else bits = caml_int64_sub(bits, one); return caml_int64_float_of_bits(bits); } function caml_notequal(x, y){ return + (caml_compare_val(x, y, false) !== 0); } function caml_obj_add_offset(_v, _offset){ caml_failwith("Obj.add_offset is not supported"); } function caml_obj_block(tag, size){ var o = new Array(size + 1); o[0] = tag; for(var i = 1; i <= size; i++) o[i] = 0; return o; } function caml_obj_compare_and_swap(x, i, old, n){ if(x[i + 1] === old){x[i + 1] = n; return 1;} return 0; } function caml_obj_is_shared(_x){return 1;} function caml_obj_raw_field(o, i){return o[i + 1];} function caml_obj_reachable_words(_o){return 0;} function caml_obj_set_raw_field(o, i, v){return o[i + 1] = v;} function caml_obj_with_tag(tag, x){ var l = x.length, a = new Array(l); a[0] = tag; for(var i = 1; i < l; i++) a[i] = x[i]; return a; } function caml_ojs_new_arr(c, a){ switch(a.length){ case 0: return new c(); case 1: return new c(a[0]); case 2: return new c(a[0], a[1]); case 3: return new c(a[0], a[1], a[2]); case 4: return new c(a[0], a[1], a[2], a[3]); case 5: return new c(a[0], a[1], a[2], a[3], a[4]); case 6: return new c(a[0], a[1], a[2], a[3], a[4], a[5]); case 7: return new c(a[0], a[1], a[2], a[3], a[4], a[5], a[6]); } function F(){return c.apply(this, a);} F.prototype = c.prototype; return new F(); } function caml_oo_cache_id(){ var cacheid = caml_method_cache.length; caml_method_cache[cacheid] = 0; } var caml_output_val = function(){ class Writer{ constructor(){ this.chunk = []; this.chunk_idx = 20; this.block_len = 0; this.obj_counter = 0; this.size_32 = 0; this.size_64 = 0; } write(size, value){ for(var i = size - 8; i >= 0; i -= 8) this.chunk[this.chunk_idx++] = value >> i & 0xff; } write_at(pos, size, value){ var pos = pos; for(var i = size - 8; i >= 0; i -= 8) this.chunk[pos++] = value >> i & 0xff; } write_code(size, code, value){ this.chunk[this.chunk_idx++] = code; for(var i = size - 8; i >= 0; i -= 8) this.chunk[this.chunk_idx++] = value >> i & 0xff; } write_shared(offset){ if(offset < 1 << 8) this.write_code(8, 0x04, offset); else if(offset < 1 << 16) this.write_code(16, 0x05, offset); else this.write_code(32, 0x06, offset); } pos(){return this.chunk_idx;} finalize(){ this.block_len = this.chunk_idx - 20; this.chunk_idx = 0; this.write(32, 0x8495a6be); this.write(32, this.block_len); this.write(32, this.obj_counter); this.write(32, this.size_32); this.write(32, this.size_64); return this.chunk; } } return function(v, flags){ flags = caml_list_to_js_array(flags); var no_sharing = flags.indexOf(0) !== - 1, closures = flags.indexOf(1) !== - 1; if(closures) console.warn ("in caml_output_val: flag Marshal.Closures is not supported."); var writer = new Writer(), stack = [], intern_obj_table = no_sharing ? null : new MlObjectTable(); function memo(v){ if(no_sharing) return false; var existing_offset = intern_obj_table.recall(v); if(existing_offset){ writer.write_shared(existing_offset); return true; } else{intern_obj_table.store(v); return false;} } function extern_rec(v){ if(v.caml_custom){ if(memo(v)) return; var name = v.caml_custom, ops = caml_custom_ops[name], sz_32_64 = [0, 0]; if(! ops.serialize) caml_invalid_argument("output_value: abstract value (Custom)"); if(ops.fixed_length === undefined){ writer.write(8, 0x18); for(var i = 0; i < name.length; i++) writer.write(8, name.charCodeAt(i)); writer.write(8, 0); var header_pos = writer.pos(); for(var i = 0; i < 12; i++) writer.write(8, 0); ops.serialize(writer, v, sz_32_64); writer.write_at(header_pos, 32, sz_32_64[0]); writer.write_at(header_pos + 4, 32, 0); writer.write_at(header_pos + 8, 32, sz_32_64[1]); } else{ writer.write(8, 0x19); for(var i = 0; i < name.length; i++) writer.write(8, name.charCodeAt(i)); writer.write(8, 0); ops.serialize(writer, v, sz_32_64); if(ops.fixed_length !== sz_32_64[0]) caml_failwith ("output_value: incorrect fixed sizes specified by " + name); } writer.size_32 += 2 + (sz_32_64[0] + 3 >> 2); writer.size_64 += 2 + (sz_32_64[1] + 7 >> 3); } else if(Array.isArray(v) && v[0] === (v[0] | 0)){ if(v[0] === 251) caml_failwith("output_value: abstract value (Abstract)"); if(caml_is_continuation_tag(v[0])) caml_invalid_argument("output_value: continuation value"); if(v.length > 1 && memo(v)) return; if(v[0] < 16 && v.length - 1 < 8) writer.write(8, 0x80 + v[0] + (v.length - 1 << 4)); else writer.write_code(32, 0x08, v.length - 1 << 10 | v[0]); writer.size_32 += v.length; writer.size_64 += v.length; if(v.length > 1) stack.push(v, 1); } else if(caml_is_ml_bytes(v)){ if(! caml_is_ml_bytes(caml_string_of_jsbytes(""))) caml_failwith ("output_value: [Bytes.t] cannot safely be marshaled with [--enable use-js-string]"); if(memo(v)) return; var len = caml_ml_bytes_length(v); if(len < 0x20) writer.write(8, 0x20 + len); else if(len < 0x100) writer.write_code(8, 0x09, len); else writer.write_code(32, 0x0a, len); for(var i = 0; i < len; i++) writer.write(8, caml_bytes_unsafe_get(v, i)); writer.size_32 += 1 + ((len + 4) / 4 | 0); writer.size_64 += 1 + ((len + 8) / 8 | 0); } else if(caml_is_ml_string(v)){ if(memo(v)) return; var len = caml_ml_string_length(v); if(len < 0x20) writer.write(8, 0x20 + len); else if(len < 0x100) writer.write_code(8, 0x09, len); else writer.write_code(32, 0x0a, len); for(var i = 0; i < len; i++) writer.write(8, caml_string_unsafe_get(v, i)); writer.size_32 += 1 + ((len + 4) / 4 | 0); writer.size_64 += 1 + ((len + 8) / 8 | 0); } else if(v !== (v | 0)){ var type_of_v = typeof v; if(type_of_v !== "number") caml_failwith("output_value: abstract value (" + type_of_v + ")"); if(memo(v)) return; var t = caml_int64_to_bytes(caml_int64_bits_of_float(v)); writer.write(8, 0x0c); for(var i = 0; i < 8; i++) writer.write(8, t[7 - i]); writer.size_32 += 3; writer.size_64 += 2; } else if(v >= 0 && v < 0x40) writer.write(8, 0x40 + v); else if(v >= - (1 << 7) && v < 1 << 7) writer.write_code(8, 0x00, v); else if(v >= - (1 << 15) && v < 1 << 15) writer.write_code(16, 0x01, v); else writer.write_code(32, 0x02, v); } extern_rec(v); while(stack.length > 0){ var i = stack.pop(), v = stack.pop(); if(i + 1 < v.length) stack.push(v, i + 1); extern_rec(v[i]); } if(intern_obj_table) writer.obj_counter = intern_obj_table.objs.length; writer.finalize(); return new Uint8Array(writer.chunk);}; } (); function caml_output_value_to_string(v, flags){ return caml_string_of_uint8_array(caml_output_val(v, flags)); } function caml_output_value(chanid, v, flags){ var s = caml_output_value_to_string(v, flags); caml_ml_output(chanid, s, 0, caml_ml_string_length(s)); return 0; } function caml_output_value_to_buffer(s, ofs, len, v, flags){ var t = caml_output_val(v, flags); if(t.length > len) caml_failwith("Marshal.to_buffer: buffer overflow"); caml_blit_bytes(caml_bytes_of_uint8_array(t), 0, s, ofs, t.length); return 0; } function caml_output_value_to_bytes(v, flags){ return caml_bytes_of_uint8_array(caml_output_val(v, flags)); } var caml_parser_trace = 0; function caml_parse_engine(tables, env, cmd, arg){ var ERRCODE = 256, loop = 6, testshift = 7, shift = 8, shift_recover = 9, reduce = 10, READ_TOKEN = 0, RAISE_PARSE_ERROR = 1, GROW_STACKS_1 = 2, GROW_STACKS_2 = 3, COMPUTE_SEMANTIC_ACTION = 4, CALL_ERROR_FUNCTION = 5, env_s_stack = 1, env_v_stack = 2, env_symb_start_stack = 3, env_symb_end_stack = 4, env_stacksize = 5, env_stackbase = 6, env_curr_char = 7, env_lval = 8, env_symb_start = 9, env_symb_end = 10, env_asp = 11, env_rule_len = 12, env_rule_number = 13, env_sp = 14, env_state = 15, env_errflag = 16, tbl_transl_const = 2, tbl_transl_block = 3, tbl_lhs = 4, tbl_len = 5, tbl_defred = 6, tbl_dgoto = 7, tbl_sindex = 8, tbl_rindex = 9, tbl_gindex = 10, tbl_tablesize = 11, tbl_table = 12, tbl_check = 13, tbl_names_const = 15, tbl_names_block = 16; function log(x){ var s = caml_string_of_jsbytes(x + "\n"); caml_ml_output(caml_sys_fds[2].chanid, s, 0, caml_ml_string_length(s)); } function token_name(names, number){ var str = caml_jsstring_of_string(names); if(str[0] === "\x00") return ""; return str.split("\x00")[number]; } function print_token(state, tok){ var token, kind; if(Array.isArray(tok)){ token = token_name(tables[tbl_names_block], tok[0]); if(typeof tok[1] === "number") kind = "" + tok[1]; else if(typeof tok[1] === "string") kind = tok[1]; else if(tok[1] instanceof MlBytes) kind = caml_jsbytes_of_string(tok[1]); else kind = "_"; log("State " + state + ": read token " + token + "(" + kind + ")"); } else{ token = token_name(tables[tbl_names_const], tok); log("State " + state + ": read token " + token); } } if(! tables.dgoto){ tables.defred = caml_lex_array(tables[tbl_defred]); tables.sindex = caml_lex_array(tables[tbl_sindex]); tables.check = caml_lex_array(tables[tbl_check]); tables.rindex = caml_lex_array(tables[tbl_rindex]); tables.table = caml_lex_array(tables[tbl_table]); tables.len = caml_lex_array(tables[tbl_len]); tables.lhs = caml_lex_array(tables[tbl_lhs]); tables.gindex = caml_lex_array(tables[tbl_gindex]); tables.dgoto = caml_lex_array(tables[tbl_dgoto]); } var res = 0, n, n1, n2, state1, sp = env[env_sp], state = env[env_state], errflag = env[env_errflag]; the_loop: for(;;) switch(cmd){ case 0: state = 0; errflag = 0; case 6: n = tables.defred[state]; if(n !== 0){cmd = reduce; continue the_loop;} if(env[env_curr_char] >= 0){cmd = testshift; continue the_loop;} res = READ_TOKEN; break the_loop; case 1: if(Array.isArray(arg)){ env[env_curr_char] = tables[tbl_transl_block][arg[0] + 1]; env[env_lval] = arg[1]; } else{ env[env_curr_char] = tables[tbl_transl_const][arg + 1]; env[env_lval] = 0; } if(caml_parser_trace) print_token(state, arg); case 7: n1 = tables.sindex[state]; n2 = n1 + env[env_curr_char]; if (n1 !== 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && tables.check[n2] === env[env_curr_char]){cmd = shift; continue the_loop;} n1 = tables.rindex[state]; n2 = n1 + env[env_curr_char]; if (n1 !== 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && tables.check[n2] === env[env_curr_char]){ n = tables.table[n2]; cmd = reduce; continue the_loop; } if(errflag <= 0){res = CALL_ERROR_FUNCTION; break the_loop;} case 5: if(errflag < 3){ errflag = 3; for(;;){ state1 = env[env_s_stack][sp + 1]; n1 = tables.sindex[state1]; n2 = n1 + ERRCODE; if (n1 !== 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && tables.check[n2] === ERRCODE){ if(caml_parser_trace) log("Recovering in state " + state1); cmd = shift_recover; continue the_loop; } else{ if(caml_parser_trace) log("Discarding state " + state1); if(sp <= env[env_stackbase]){ if(caml_parser_trace) log("No more states to discard"); return RAISE_PARSE_ERROR; } sp--; } } } else{ if(env[env_curr_char] === 0) return RAISE_PARSE_ERROR; if(caml_parser_trace) log("Discarding last token read"); env[env_curr_char] = - 1; cmd = loop; continue the_loop; } case 8: env[env_curr_char] = - 1; if(errflag > 0) errflag--; case 9: if(caml_parser_trace) log("State " + state + ": shift to state " + tables.table[n2]); state = tables.table[n2]; sp++; if(sp >= env[env_stacksize]){res = GROW_STACKS_1; break the_loop;} case 2: env[env_s_stack][sp + 1] = state; env[env_v_stack][sp + 1] = env[env_lval]; env[env_symb_start_stack][sp + 1] = env[env_symb_start]; env[env_symb_end_stack][sp + 1] = env[env_symb_end]; cmd = loop; continue the_loop; case 10: if(caml_parser_trace) log("State " + state + ": reduce by rule " + n); var m = tables.len[n]; env[env_asp] = sp; env[env_rule_number] = n; env[env_rule_len] = m; sp = sp - m + 1; m = tables.lhs[n]; state1 = env[env_s_stack][sp]; n1 = tables.gindex[m]; n2 = n1 + state1; if (n1 !== 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && tables.check[n2] === state1) state = tables.table[n2]; else state = tables.dgoto[m]; if(sp >= env[env_stacksize]){res = GROW_STACKS_2; break the_loop;} case 3: res = COMPUTE_SEMANTIC_ACTION; break the_loop; case 4: env[env_s_stack][sp + 1] = state; env[env_v_stack][sp + 1] = arg; var asp = env[env_asp]; env[env_symb_end_stack][sp + 1] = env[env_symb_end_stack][asp + 1]; if(sp > asp) env[env_symb_start_stack][sp + 1] = env[env_symb_end_stack][asp + 1]; cmd = loop; continue the_loop; default: return RAISE_PARSE_ERROR; } env[env_sp] = sp; env[env_state] = state; env[env_errflag] = errflag; return res; } function caml_pure_js_expr(s){ console.error("caml_pure_js_expr: fallback to runtime evaluation\n"); return eval?.('"use strict";(' + caml_jsstring_of_string(s) + ")"); } function caml_raise_not_found(){ caml_raise_constant(caml_global_data.Not_found); } function caml_raw_backtrace_length(){return 0;} function caml_raw_backtrace_next_slot(_slot){return 0;} function caml_raw_backtrace_slot(_bt, _idx){ caml_invalid_argument ("Printexc.get_raw_backtrace_slot: index out of bounds"); } function caml_read_file_content(name){ var name = typeof name === "string" ? caml_string_of_jsstring(name) : name, root = resolve_fs_device(name); if(root.device.exists(root.rest)){ var file = root.device.open(root.rest, {rdonly: 1}), len = file.length(), buf = new Uint8Array(len); file.read(buf, 0, len, false); return caml_string_of_uint8_array(buf); } caml_raise_no_such_file(caml_jsstring_of_string(name)); } function caml_recommended_domain_count(_unit){return 1;} function caml_record_backtrace(b){ caml_record_backtrace_runtime_flag = b; return 0; } var jsoo_toplevel_reloc = undefined; function caml_register_global(n, v, name_opt){ if(name_opt){ var name = name_opt; if(jsoo_toplevel_reloc) n = caml_callback(jsoo_toplevel_reloc, [name]); else if(caml_global_data.symbols){ if(! caml_global_data.symidx) caml_global_data.symidx = caml_build_symbols(caml_global_data.symbols); var nid = caml_global_data.symidx[name]; if(nid >= 0) n = nid; else{ var n = caml_global_data.symidx.next_idx++; caml_global_data.symidx[name] = n; } } } caml_global_data[n + 1] = v; if(name_opt) caml_global_data[name_opt] = v; } function caml_register_named_value(nm, v){ caml_named_values[caml_jsbytes_of_string(nm)] = v; return 0; } function caml_restore_raw_backtrace(_exn, _bt){return 0;} function caml_round_float(x){ if(x >= 0){ var y = Math.floor(x); return x - y >= 0.5 ? y + 1 : y; } else{var y = Math.ceil(x); return y - x >= 0.5 ? y - 1 : y;} } function caml_runtime_events_create_cursor(_target){return {};} function caml_runtime_events_free_cursor(_cursor){return 0;} function caml_runtime_events_read_poll(_cursor, _callbacks, _num){return 0; } function caml_runtime_events_user_register (event_name, event_tag, event_type){ caml_custom_event_index += 1; return [0, caml_custom_event_index, event_name, event_type, event_tag]; } function caml_runtime_events_user_resolve(){return 0;} function caml_runtime_events_user_write(_event, _event_content){return 0;} function caml_runtime_parameters(_unit){return caml_string_of_jsbytes("");} function caml_runtime_variant(_unit){return caml_string_of_jsbytes("");} function caml_set_parser_trace(bool){ var oldflag = caml_parser_trace; caml_parser_trace = bool; return oldflag; } function caml_set_static_env(k, v){jsoo_static_env[k] = v; return 0;} function caml_signbit_float(x){ if(x === 0) x = 1 / x; return x < 0 ? 1 : 0; } function caml_sinh_float(x){return Math.sinh(x);} function caml_strerror(errno){ const util = require("node:util"); if(errno >= 0){ const code = unix_error[errno]; return util.getSystemErrorMap().entries().find(x=>x[1][0] === code)[1][1]; } else return util.getSystemErrorMessage(errno); } function caml_string_bound_error(){ caml_invalid_argument("index out of bounds"); } function caml_string_concat(a, b){return a + b;} function caml_string_equal(s1, s2){if(s1 === s2) return 1; return 0;} function caml_string_get(s, i){ if(i >>> 0 >= caml_ml_string_length(s)) caml_string_bound_error(); return caml_string_unsafe_get(s, i); } function caml_string_get16(s, i){ if(i >>> 0 >= caml_ml_string_length(s) - 1) caml_string_bound_error(); var b1 = caml_string_unsafe_get(s, i), b2 = caml_string_unsafe_get(s, i + 1); return b2 << 8 | b1; } function caml_string_get32(s, i){ if(i >>> 0 >= caml_ml_string_length(s) - 3) caml_string_bound_error(); var b1 = caml_string_unsafe_get(s, i), b2 = caml_string_unsafe_get(s, i + 1), b3 = caml_string_unsafe_get(s, i + 2), b4 = caml_string_unsafe_get(s, i + 3); return b4 << 24 | b3 << 16 | b2 << 8 | b1; } function caml_string_get64(s, i){ if(i >>> 0 >= caml_ml_string_length(s) - 7) caml_string_bound_error(); var a = new Array(8); for(var j = 0; j < 8; j++) a[7 - j] = caml_string_unsafe_get(s, i + j); return caml_int64_of_bytes(a); } function caml_string_lessequal(s1, s2){return s1 <= s2 ? 1 : 0;} function caml_string_greaterequal(s1, s2){return caml_string_lessequal(s2, s1); } function caml_string_lessthan(s1, s2){return s1 < s2 ? 1 : 0;} function caml_string_greaterthan(s1, s2){return caml_string_lessthan(s2, s1); } function caml_string_hash(h, v){ var h = caml_hash_mix_string(h, v), h = caml_hash_mix_final(h); return h & 0x3fffffff; } function caml_string_notequal(s1, s2){ return 1 - caml_string_equal(s1, s2); } function caml_string_of_bytes(s){ s.t & 6 && caml_convert_string_to_bytes(s); return caml_string_of_jsbytes(s.c); } function caml_string_set(_s, _i, _c){caml_failwith("caml_string_set");} function caml_sys_argv(_unit){return caml_argv;} function caml_sys_chdir(dir, raise_unix){ var root = resolve_fs_device(dir); if(root.device.is_dir(root.rest)){ if(root.rest) caml_current_dir = caml_trailing_slash(root.path + root.rest); else caml_current_dir = root.path; return 0; } else if(root.device.exists(root.rest)) caml_raise_system_error (raise_unix, "ENOTDIR", "chdir", "not a directory", caml_jsstring_of_string(dir)); else caml_raise_no_such_file(caml_jsstring_of_string(dir), raise_unix); } function caml_sys_const_backend_type(){ return [0, caml_string_of_jsbytes("js_of_ocaml")]; } function caml_sys_const_big_endian(){return 0;} function caml_sys_const_int_size(){return 32;} function caml_sys_const_max_wosize(){return 0x7fffffff / 4 | 0;} function caml_sys_const_naked_pointers_checked(_unit){return 0;} var os_type = jsoo_is_win32 ? "Win32" : "Unix"; function caml_sys_const_ostype_cygwin(){return os_type === "Cygwin" ? 1 : 0; } function caml_sys_const_ostype_unix(){return os_type === "Unix" ? 1 : 0;} function caml_sys_const_ostype_win32(){return os_type === "Win32" ? 1 : 0;} function caml_sys_const_word_size(){return 32;} function caml_sys_executable_name(_unit){return caml_executable_name;} function caml_sys_exit(code){ if(globalThis.quit) globalThis.quit(code); if(globalThis.process?.exit) globalThis.process.exit(code); caml_invalid_argument("Function 'exit' not implemented"); } function caml_sys_file_exists(name){ var root = resolve_fs_device(name); return root.device.exists(root.rest); } function caml_sys_get_argv(_unit){return [0, caml_argv[1], caml_argv];} function caml_sys_get_config(){ return [0, caml_string_of_jsbytes(os_type), 32, 0]; } function caml_sys_getcwd(){ return caml_string_of_jsstring(caml_current_dir); } function caml_sys_getenv(name){ var r = jsoo_sys_getenv(caml_jsstring_of_string(name)); if(r === undefined) caml_raise_not_found(); return caml_string_of_jsstring(r); } function caml_sys_is_directory(name){ var root = resolve_fs_device(name), a = root.device.is_dir(root.rest); return a ? 1 : 0; } function caml_sys_is_regular_file(name){ var root = resolve_fs_device(name); return root.device.isFile(root.rest); } function caml_sys_isatty(_chan){return 0;} function caml_sys_mkdir(name, perm){ var root = resolve_fs_device(name); root.device.mkdir(root.rest, perm); return 0; } function caml_sys_modify_argv(arg){caml_argv = arg; return 0;} function caml_sys_random_seed(){ if(globalThis.crypto) if(globalThis.crypto.getRandomValues){ var a = globalThis.crypto.getRandomValues(new Int32Array(4)); return [0, a[0], a[1], a[2], a[3]]; } else if(globalThis.crypto.randomBytes){ var a = new Int32Array(globalThis.crypto.randomBytes(16).buffer); return [0, a[0], a[1], a[2], a[3]]; } var now = new Date().getTime(), x = now ^ 0xffffffff * Math.random(); return [0, x]; } function caml_sys_read_directory(name){ var root = resolve_fs_device(name), a = root.device.readdir(root.rest), l = new Array(a.length + 1); l[0] = 0; for(var i = 0; i < a.length; i++) l[i + 1] = caml_string_of_jsstring(a[i]); return l; } function caml_sys_remove(name){ var root = resolve_fs_device(name); return root.device.unlink(root.rest); } function caml_sys_rename(o, n){ var o_root = resolve_fs_device(o), n_root = resolve_fs_device(n); if(o_root.device !== n_root.device) caml_failwith("caml_sys_rename: cannot move file between two filesystem"); if(! o_root.device.rename) caml_failwith("caml_sys_rename: not implemented"); o_root.device.rename(o_root.rest, n_root.rest); } function caml_sys_rmdir(name){ var root = resolve_fs_device(name); root.device.rmdir(root.rest); return 0; } function caml_sys_system_command(cmd){ var cmd = caml_jsstring_of_string(cmd); if(typeof require !== "undefined"){ var child_process = require("node:child_process"); if(child_process?.execSync) try{child_process.execSync(cmd, {stdio: "inherit"}); return 0;} catch(e){return 1;} } else return 127; } var caml_initial_time = new Date().getTime() * 0.001; function caml_sys_time(){ var now = new Date().getTime(); return now * 0.001 - caml_initial_time; } function caml_sys_time_include_children(_b){return caml_sys_time();} function caml_sys_unsafe_getenv(name){return caml_sys_getenv(name);} function caml_tanh_float(x){return Math.tanh(x);} function caml_throw_js_exception(exn){throw exn;} function caml_to_js_string(s){return caml_jsstring_of_string(s);} function caml_trampoline(res){ var c = 1; while(res?.joo_tramp){res = res.joo_tramp.apply(null, res.joo_args); c++;} return res; } function caml_trampoline_return(f, args, direct){ return {joo_tramp: f, joo_args: args, joo_direct: direct}; } function caml_trunc_float(x){return Math.trunc(x);} function caml_unix_access(name, flags){ var f = {}; while(flags){ switch(flags[1]){ case 0: f.r = 1; break; case 1: f.w = 1; break; case 2: f.x = 1; break; case 3: f.f = 1; break; } flags = flags[2]; } var root = resolve_fs_device(name); if(! root.device.access) caml_failwith("caml_unix_access: not implemented"); root.device.access(root.rest, f, true); return 0; } function caml_unix_chdir(dir){return caml_sys_chdir(dir, true);} function caml_unix_chmod(name, perms){ var root = resolve_fs_device(name); if(! root.device.chmod) caml_failwith("caml_unix_chmod: not implemented"); return root.device.chmod(root.rest, perms); } function caml_unix_cleanup(){} function caml_unix_lookup_file(fd, cmd){ var fd_desc = caml_sys_fds[fd]; if(fd_desc === undefined) caml_raise_system_error(1, "EBADF", cmd); return fd_desc.file; } function caml_unix_close(fd){ var file = caml_unix_lookup_file(fd, "close"); file.close(1); return 0; } function caml_unix_closedir(dir_handle){ try{dir_handle.pointer.closeSync();} catch(e){caml_raise_system_error(1, "EBADF", "closedir");} } function caml_unix_fchmod(fd, perms){ var file = caml_unix_lookup_file(fd, "fchmod"); if(! file.chmod) caml_failwith("caml_unix_fchmod: not implemented"); return file.chmod(perms); } function caml_unix_filedescr_of_fd(x){return x;} function caml_unix_findclose(dir_handle){return caml_unix_closedir(dir_handle); } function caml_unix_opendir(path){ var root = resolve_fs_device(path); if(! root.device.opendir) caml_failwith("caml_unix_opendir: not implemented"); var dir_handle = root.device.opendir(root.rest, true); return {pointer: dir_handle, path: path}; } function caml_unix_readdir(dir_handle){ var entry; try{entry = dir_handle.pointer.readSync();} catch(e){caml_raise_system_error(1, "EBADF", "readdir");} if(entry === null) caml_raise_end_of_file(); else return caml_string_of_jsstring(entry.name); } function caml_unix_findfirst(path){ var path_js = caml_jsstring_of_string(path); path_js = path_js.replace(/(^|[\\/])\*\.\*$/, ""); path = caml_string_of_jsstring(path_js); var dir_handle = caml_unix_opendir(path), first_entry = caml_unix_readdir(dir_handle); return [0, first_entry, dir_handle]; } function caml_unix_findnext(dir_handle){return caml_unix_readdir(dir_handle); } function caml_unix_fstat(fd){ var file = caml_unix_lookup_file(fd, "fstat"); if(! file.stat) caml_failwith("caml_unix_fstat: not implemented"); return file.stat(false); } function caml_unix_fstat_64(fd){ var file = caml_unix_lookup_file(fd, "fstat"); if(! file.stat) caml_failwith("caml_unix_fstat64: not implemented"); return file.stat(true); } function caml_unix_fsync(fd){ var file = caml_unix_lookup_file(fd, "fsync"); if(! file.sync) caml_failwith("caml_unix_fsync: not implemented"); return file.sync(); } function caml_unix_ftruncate(fd, len){ var file = caml_unix_lookup_file(fd, "ftruncate"); if(! file.truncate) caml_failwith("caml_unix_ftruncate: not implemented"); file.truncate(len, 1); return 0; } function caml_unix_ftruncate_64(fd, len){ var file = caml_unix_lookup_file(fd, "ftruncate"); if(! file.truncate) caml_failwith("caml_unix_ftruncate_64: not implemented"); file.truncate(caml_int64_to_float(len), 1); return 0; } function caml_unix_getegid(_unit){ if(globalThis.process?.getegid) return globalThis.process.getegid(); return 1; } function caml_unix_geteuid(_unit){ if(globalThis.process?.geteuid) return globalThis.process.geteuid(); return 1; } function caml_unix_getgid(_unit){ if(globalThis.process?.getgid) return globalThis.process.getgid(); return 1; } function caml_unix_getpwnam(_unit){caml_raise_not_found();} function caml_unix_gettimeofday(){return new Date().getTime() / 1000;} function caml_unix_getuid(_unit){ if(globalThis.process?.getuid) return globalThis.process.getuid(); return 1; } function caml_unix_gmtime(t){ var d = new Date(t * 1000), d_num = d.getTime(), januaryfirst = new Date(Date.UTC(d.getUTCFullYear(), 0, 1)).getTime(), doy = Math.floor((d_num - januaryfirst) / 86400000); return [0, d.getUTCSeconds(), d.getUTCMinutes(), d.getUTCHours(), d.getUTCDate(), d.getUTCMonth(), d.getUTCFullYear() - 1900, d.getUTCDay(), doy, false | 0]; } function caml_unix_has_symlink(_unit){return fs_node_supported() ? 1 : 0;} function caml_unix_inchannel_of_filedescr(fd){ var file = caml_unix_lookup_file(fd, "in_channel_of_descr"); file.check_stream_semantics("in_channel_of_descr"); return caml_ml_open_descriptor_in(fd); } function caml_unix_inet_addr_of_string(){return 0;} function caml_unix_isatty(fd){ var file = caml_unix_lookup_file(fd); if(! file.isatty) return 0; return file.isatty(); } function caml_unix_link(follow, src, dst){ var src_root = resolve_fs_device(src), dst_root = resolve_fs_device(dst); if(! src_root.device.link) caml_failwith("caml_unix_link: not implemented"); if(typeof follow !== "number") caml_raise_system_error(1, "ENOSYS", "link"); if(src_root.device !== dst_root.device) caml_raise_system_error(1, "EXDEV", "link"); return src_root.device.link(src_root.rest, dst_root.rest, true); } function caml_unix_localtime(t){ var d = new Date(t * 1000), d_num = d.getTime(), januaryfirst = new Date(d.getFullYear(), 0, 1).getTime(), doy = Math.floor((d_num - januaryfirst) / 86400000), jan = new Date(d.getFullYear(), 0, 1), jul = new Date(d.getFullYear(), 6, 1), stdTimezoneOffset = Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); return [0, d.getSeconds(), d.getMinutes(), d.getHours(), d.getDate(), d.getMonth(), d.getFullYear() - 1900, d.getDay(), doy, d.getTimezoneOffset() < stdTimezoneOffset | 0]; } function caml_unix_lseek(fd, len, whence){ var file = caml_unix_lookup_file(fd, "lseek"); return file.seek(len, whence, 1); } function caml_unix_lseek_64(fd, len, whence){ var file = caml_unix_lookup_file(fd, "lseek"); return file.seek(caml_int64_to_float(len), whence, 1); } function caml_unix_lstat(name){ var root = resolve_fs_device(name); if(! root.device.lstat) caml_failwith("caml_unix_lstat: not implemented"); return root.device.lstat(root.rest, false, true); } function caml_unix_lstat_64(name){ var root = resolve_fs_device(name); if(! root.device.lstat) caml_failwith("caml_unix_lstat_64: not implemented"); return root.device.lstat(root.rest, true, true); } function caml_unix_mkdir(name, perm){ var root = resolve_fs_device(name); if(! root.device.mkdir) caml_failwith("caml_unix_mkdir: not implemented"); return root.device.mkdir(root.rest, perm, true); } function caml_unix_mktime(tm){ var d = new Date(tm[6] + 1900, tm[5], tm[4], tm[3], tm[2], tm[1]).getTime(), t = Math.floor(d / 1000), tm2 = caml_unix_localtime(t); return [0, t, tm2]; } function caml_unix_open(name, flags, perms){ var f = {}; while(flags){ switch(flags[1]){ case 0: f.rdonly = 1; break; case 1: f.wronly = 1; break; case 2: f.rdwr = 1; break; case 3: f.nonblock = 1; break; case 4: f.append = 1; break; case 5: f.create = 1; break; case 6: f.truncate = 1; break; case 7: f.excl = 1; break; case 8: f.noctty = 1; break; case 9: f.dsync = 1; break; case 10: f.sync = 1; break; } flags = flags[2]; } var root = resolve_fs_device(name), file = root.device.open(root.rest, f, perms, true), idx = caml_sys_fds.length, chanid = new MlChanid(idx); caml_sys_fds[idx] = {file: file, chanid: chanid}; return idx | 0; } function caml_unix_outchannel_of_filedescr(fd){ var file = caml_unix_lookup_file(fd, "out_channel_of_descr"); file.check_stream_semantics("out_channel_of_descr"); return caml_ml_open_descriptor_out(fd); } function caml_unix_read(fd, buf, pos, len){ var file = caml_unix_lookup_file(fd, "read"); return file.read(caml_uint8_array_of_bytes(buf), pos, len, 1); } function caml_unix_read_bigarray(fd, buf, pos, len){ var a = caml_ba_to_typed_array(buf), file = caml_unix_lookup_file(fd, "read"); return file.read(a, pos, len, 1); } function caml_unix_readlink(name){ var root = resolve_fs_device(name); if(! root.device.readlink) caml_failwith("caml_unix_readlink: not implemented"); return root.device.readlink(root.rest, true); } function caml_unix_rename(o, n){ var o_root = resolve_fs_device(o), n_root = resolve_fs_device(n); if(o_root.device !== n_root.device) caml_raise_system_error(1, "EXDEV", "rename"); if(! o_root.device.rename) caml_failwith("caml_sys_rename: not implemented"); o_root.device.rename(o_root.rest, n_root.rest, true); } function caml_unix_rewinddir(dir_handle){ caml_unix_closedir(dir_handle); var new_dir_handle = caml_unix_opendir(dir_handle.path); dir_handle.pointer = new_dir_handle.pointer; return 0; } function caml_unix_rmdir(name){ var root = resolve_fs_device(name); if(! root.device.rmdir) caml_failwith("caml_unix_rmdir: not implemented"); return root.device.rmdir(root.rest, true); } function caml_unix_single_write(fd, buf, pos, len){ var file = caml_unix_lookup_file(fd, "write"); if(len === 0) return 0; return file.write(caml_uint8_array_of_bytes(buf), pos, len, 1); } function caml_unix_startup(){} function caml_unix_stat(name){ var root = resolve_fs_device(name); if(! root.device.stat) caml_failwith("caml_unix_stat: not implemented"); return root.device.stat(root.rest, false, true); } function caml_unix_stat_64(name){ var root = resolve_fs_device(name); if(! root.device.stat) caml_failwith("caml_unix_stat_64: not implemented"); return root.device.stat(root.rest, true, true); } function caml_unix_symlink(to_dir, src, dst){ var dst_root = resolve_fs_device(dst); if(! dst_root.device.symlink) caml_failwith("caml_unix_symlink: not implemented"); return dst_root.device.symlink (to_dir, caml_jsstring_of_string(src), dst_root.rest, true); } function caml_unix_time(){return Math.floor(caml_unix_gettimeofday());} function caml_unix_times(){ if(globalThis.process?.cpuUsage){ var t = globalThis.process.cpuUsage(); return [0, t.user / 1e6, t.system / 1e6, 0, 0]; } else if(globalThis.performance?.now) return [0, globalThis.performance.now() / 1000, 0, 0, 0]; else caml_failwith("caml_unix_times: not implemented"); } function caml_unix_truncate(name, len){ var root = resolve_fs_device(name); if(! root.device.truncate) caml_failwith("caml_unix_truncate: not implemented"); root.device.truncate(root.rest, len, true); return 0; } function caml_unix_truncate_64(name, len){ var root = resolve_fs_device(name); if(! root.device.truncate) caml_failwith("caml_unix_truncate_64: not implemented"); root.device.truncate(root.rest, caml_int64_to_float(len), true); return 0; } function caml_unix_unlink(name){ var root = resolve_fs_device(name); if(! root.device.unlink) caml_failwith("caml_unix_unlink: not implemented"); root.device.unlink(root.rest, true); return 0; } function caml_unix_utimes(name, atime, mtime){ var root = resolve_fs_device(name); if(! root.device.utimes) caml_failwith("caml_unix_utimes: not implemented"); root.device.utimes(root.rest, atime, mtime, true); return 0; } function caml_unix_write(fd, buf, pos, len){ var file = caml_unix_lookup_file(fd, "write"), a = caml_uint8_array_of_bytes(buf), written = 0; while(len > 0){ var n = file.write(a, pos, len, 1); written += n; pos += n; len -= n; } return written; } function caml_unix_write_bigarray(fd, buf, pos, len){ var a = caml_ba_to_typed_array(buf), file = caml_unix_lookup_file(fd, "write"), written = 0; while(len > 0){ var n = file.write(a, pos, len, 1); written += n; pos += n; len -= n; } return written; } function caml_unmount(name){ var path = caml_make_path(name), name = caml_trailing_slash(path.join("/")), idx = - 1; for(var i = 0; i < jsoo_mount_point.length; i++) if(jsoo_mount_point[i].path === name) idx = i; if(idx > - 1) jsoo_mount_point.splice(idx, 1); return 0; } function caml_update_dummy(x, y){ if(y.fun){x.fun = y.fun; return 0;} if(typeof y === "function"){x.fun = y; return 0;} var i = y.length; while(i--) x[i] = y[i]; return 0; } function caml_weak_set(x, i, v){ if(v === 0) caml_ephe_unset_key(x, i); else caml_ephe_set_key(x, i, v[1]); return 0; } function caml_wrap_exception(e){ { if(Array.isArray(e)) return e; var exn; if (globalThis.RangeError && e instanceof globalThis.RangeError && e.message && e.message.match(/maximum call stack/i)) exn = caml_global_data.Stack_overflow; else if (globalThis.InternalError && e instanceof globalThis.InternalError && e.message && e.message.match(/too much recursion/i)) exn = caml_global_data.Stack_overflow; else if(e instanceof globalThis.Error && caml_named_value("jsError")) exn = [0, caml_named_value("jsError"), e]; else exn = [0, caml_global_data.Failure, caml_string_of_jsstring(String(e))]; if(e instanceof globalThis.Error) exn.js_error = e; return exn; } } function caml_xdg_defaults(_unit){return 0;} function caml_xmlhttprequest_create(_unit){ if(typeof XMLHttpRequest === "undefined") caml_failwith("XMLHttpRequest is not available"); try{return new XMLHttpRequest();} catch{caml_failwith("Failed to create XMLHttpRequest");} } function caml_zstd_initialize(_unit){ caml_decompress_input = zstd_decompress; return 1; } function compare_digits_nat(nat1, ofs1, nat2, ofs2){ if(nat1.data[ofs1] > nat2.data[ofs2]) return 1; if(nat1.data[ofs1] < nat2.data[ofs2]) return - 1; return 0; } function compare_nat(nat1, ofs1, len1, nat2, ofs2, len2){ var a = num_digits_nat(nat1, ofs1, len1), b = num_digits_nat(nat2, ofs2, len2); if(a > b) return 1; if(a < b) return - 1; for(var i = len1 - 1; i >= 0; i--){ if(nat1.data[ofs1 + i] >>> 0 > nat2.data[ofs2 + i] >>> 0) return 1; if(nat1.data[ofs1 + i] >>> 0 < nat2.data[ofs2 + i] >>> 0) return - 1; } return 0; } function complement_nat(nat, ofs, len){ for(var i = 0; i < len; i++) nat.data[ofs + i] = (- 1 >>> 0) - (nat.data[ofs + i] >>> 0); } function create_nat(size){ var arr = new MlNat(size); for(var i = 0; i < size; i++) arr.data[i] = - 1; return arr; } function decr_nat(nat, ofs, len, carry_in){ var borrow = carry_in === 1 ? 0 : 1; for(var i = 0; i < len; i++){ var x = (nat.data[ofs + i] >>> 0) - borrow; nat.data[ofs + i] = x; if(x >= 0){borrow = 0; break;} else borrow = 1; } return borrow === 1 ? 0 : 1; } function deserialize_nat(reader, sz){ var len = reader.read32s(), nat = new MlNat(len); for(var i = 0; i < len; i++) nat.data[i] = reader.read32s(); sz[0] = len * 4; return nat; } function div_helper(a, b, c){ var x = a * 65536 + (b >>> 16), y = Math.floor(x / c) * 65536, z = x % c * 65536, w = z + (b & 0x0000ffff); return [y + Math.floor(w / c), w % c]; } function div_digit_nat(natq, ofsq, natr, ofsr, nat1, ofs1, len, nat2, ofs2){ var rem = nat1.data[ofs1 + len - 1] >>> 0; for(var i = len - 2; i >= 0; i--){ var x = div_helper(rem, nat1.data[ofs1 + i] >>> 0, nat2.data[ofs2] >>> 0); natq.data[ofsq + i] = x[0]; rem = x[1]; } natr.data[ofsr] = rem; return 0; } function num_leading_zero_bits_in_digit(nat, ofs){ var a = nat.data[ofs], b = 0; if(a & 0xffff0000){b += 16; a >>>= 16;} if(a & 0xff00){b += 8; a >>>= 8;} if(a & 0xf0){b += 4; a >>>= 4;} if(a & 12){b += 2; a >>>= 2;} if(a & 2){b += 1; a >>>= 1;} if(a & 1) b += 1; return 32 - b; } function shift_left_nat(nat1, ofs1, len1, nat2, ofs2, nbits){ if(nbits === 0){nat2.data[ofs2] = 0; return 0;} var wrap = 0; for(var i = 0; i < len1; i++){ var a = nat1.data[ofs1 + i] >>> 0; nat1.data[ofs1 + i] = a << nbits | wrap; wrap = a >>> 32 - nbits; } nat2.data[ofs2] = wrap; return 0; } function shift_right_nat(nat1, ofs1, len1, nat2, ofs2, nbits){ if(nbits === 0){nat2.data[ofs2] = 0; return 0;} var wrap = 0; for(var i = len1 - 1; i >= 0; i--){ var a = nat1.data[ofs1 + i] >>> 0; nat1.data[ofs1 + i] = a >>> nbits | wrap; wrap = a << 32 - nbits; } nat2.data[ofs2] = wrap; return 0; } function set_to_zero_nat(nat, ofs, len){ for(var i = 0; i < len; i++) nat.data[ofs + i] = 0; return 0; } function nat_of_array(l){return new MlNat(l);} function mult_digit_nat(nat1, ofs1, len1, nat2, ofs2, len2, nat3, ofs3){ var carry = 0, a = nat3.data[ofs3] >>> 0; for(var i = 0; i < len2; i++){ var x1 = (nat1.data[ofs1 + i] >>> 0) + (nat2.data[ofs2 + i] >>> 0) * (a & 0x0000ffff) + carry, x2 = (nat2.data[ofs2 + i] >>> 0) * (a >>> 16); carry = Math.floor(x2 / 65536); var x3 = x1 + x2 % 65536 * 65536; nat1.data[ofs1 + i] = x3; carry += Math.floor(x3 / 4294967296); } return len2 < len1 && carry ? add_nat (nat1, ofs1 + len2, len1 - len2, nat_of_array([carry]), 0, 1, 0) : carry; } function sub_nat(nat1, ofs1, len1, nat2, ofs2, len2, carry_in){ var borrow = carry_in === 1 ? 0 : 1; for(var i = 0; i < len2; i++){ var x = (nat1.data[ofs1 + i] >>> 0) - (nat2.data[ofs2 + i] >>> 0) - borrow; nat1.data[ofs1 + i] = x; if(x >= 0) borrow = 0; else borrow = 1; } return decr_nat(nat1, ofs1 + len2, len1 - len2, borrow === 1 ? 0 : 1); } function div_nat(nat1, ofs1, len1, nat2, ofs2, len2){ if(len2 === 1){ div_digit_nat(nat1, ofs1 + 1, nat1, ofs1, nat1, ofs1, len1, nat2, ofs2); return 0; } var s = num_leading_zero_bits_in_digit(nat2, ofs2 + len2 - 1); shift_left_nat(nat2, ofs2, len2, nat_of_array([0]), 0, s); shift_left_nat(nat1, ofs1, len1, nat_of_array([0]), 0, s); var d = (nat2.data[ofs2 + len2 - 1] >>> 0) + 1, a = create_nat(len2 + 1); for(var i = len1 - 1; i >= len2; i--){ var quo = d === 4294967296 ? nat1.data[ofs1 + i] >>> 0 : div_helper (nat1.data[ofs1 + i] >>> 0, nat1.data[ofs1 + i - 1] >>> 0, d) [0]; set_to_zero_nat(a, 0, len2 + 1); mult_digit_nat(a, 0, len2 + 1, nat2, ofs2, len2, nat_of_array([quo]), 0); sub_nat(nat1, ofs1 + i - len2, len2 + 1, a, 0, len2 + 1, 1); while (nat1.data[ofs1 + i] !== 0 || compare_nat(nat1, ofs1 + i - len2, len2, nat2, ofs2, len2) >= 0){ quo = quo + 1; sub_nat(nat1, ofs1 + i - len2, len2 + 1, nat2, ofs2, len2, 1); } nat1.data[ofs1 + i] = quo; } shift_right_nat(nat1, ofs1, len2, nat_of_array([0]), 0, s); shift_right_nat(nat2, ofs2, len2, nat_of_array([0]), 0, s); return 0; } function serialize_nat(writer, nat, sz){ var len = nat.data.length; writer.write(32, len); for(var i = 0; i < len; i++) writer.write(32, nat.data[i]); sz[0] = len * 4; sz[1] = len * 8; } function initialize_nat(){ caml_custom_ops._nat = {deserialize: deserialize_nat, serialize: serialize_nat, hash: caml_hash_nat}; } function is_digit_int(nat, ofs){if(nat.data[ofs] >= 0) return 1; return 0;} function is_digit_normalized(_nat, _ofs){return 1;} function is_digit_odd(nat, ofs){if(nat.data[ofs] & 1) return 1; return 0;} function is_digit_zero(nat, ofs){ if(nat.data[ofs] === 0) return 1; return 0; } function jsoo_create_file_extern(name, content){ if(globalThis.jsoo_create_file) globalThis.jsoo_create_file(name, content); else{ if(! globalThis.jsoo_fs_tmp) globalThis.jsoo_fs_tmp = []; globalThis.jsoo_fs_tmp.push({name: name, content: content}); } return 0; } function jsoo_effect_not_supported(){ caml_failwith("Effect handlers are not supported"); } function land_digit_nat(nat1, ofs1, nat2, ofs2){nat1.data[ofs1] &= nat2.data[ofs2]; return 0; } function length_nat(x){return x.data.length;} function lor_digit_nat(nat1, ofs1, nat2, ofs2){nat1.data[ofs1] |= nat2.data[ofs2]; return 0; } function lxor_digit_nat(nat1, ofs1, nat2, ofs2){nat1.data[ofs1] ^= nat2.data[ofs2]; return 0; } function mult_nat(nat1, ofs1, len1, nat2, ofs2, len2, nat3, ofs3, len3){ var carry = 0; for(var i = 0; i < len3; i++) carry += mult_digit_nat (nat1, ofs1 + i, len1 - i, nat2, ofs2, len2, nat3, ofs3 + i); return carry; } function nth_digit_nat(nat, ofs){return nat.data[ofs];} function nth_digit_nat_native(nat, ofs){return nat.data[ofs];} var re_match = function(){ var re_word_letters = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff], opcodes = {CHAR: 0, CHARNORM: 1, STRING: 2, STRINGNORM: 3, CHARCLASS: 4, BOL: 5, EOL: 6, WORDBOUNDARY: 7, BEGGROUP: 8, ENDGROUP: 9, REFGROUP: 10, ACCEPT: 11, SIMPLEOPT: 12, SIMPLESTAR: 13, SIMPLEPLUS: 14, GOTO: 15, PUSHBACK: 16, SETMARK: 17, CHECKPROGRESS: 18}; function is_word_letter(c){ return re_word_letters[c >> 3] >> (c & 7) & 1; } function in_bitset(s, i){ return caml_string_get(s, i >> 3) >> (i & 7) & 1; } function re_match_impl(re, s, pos, partial){ var prog = caml_js_from_array(re[1]), cpool = caml_js_from_array(re[2]), normtable = caml_jsbytes_of_string(re[3]), numgroups = re[4] | 0, numregisters = re[5] | 0, s = caml_uint8_array_of_string(s), pc = 0, quit = false, stack = [], groups = new Array(numgroups), re_register = new Array(numregisters); for(var i = 0; i < groups.length; i++) groups[i] = {start: - 1, end: - 1}; groups[0].start = pos; function backtrack(){ while(stack.length){ var item = stack.pop(); if(item.undo) item.undo.obj[item.undo.prop] = item.undo.value; else if(item.pos){pc = item.pos.pc; pos = item.pos.txt; return;} } quit = true; } function push(item){stack.push(item);} function accept(){ groups[0].end = pos; var result = new Array(1 + groups.length * 2); result[0] = 0; for(var i = 0; i < groups.length; i++){ var g = groups[i]; if(g.start < 0 || g.end < 0) g.start = g.end = - 1; result[2 * i + 1] = g.start; result[2 * i + 1 + 1] = g.end; } return result; } function prefix_match(){ if(partial) return accept(); else backtrack(); } while(! quit){ var op = prog[pc] & 0xff, sarg = prog[pc] >> 8, uarg = sarg & 0xff, c = s[pos], group; pc++; switch(op){ case opcodes.CHAR: if(pos === s.length){prefix_match(); break;} if(c === uarg) pos++; else backtrack(); break; case opcodes.CHARNORM: if(pos === s.length){prefix_match(); break;} if(normtable.charCodeAt(c) === uarg) pos++; else backtrack(); break; case opcodes.STRING: for (var arg = caml_jsbytes_of_string(cpool[uarg]), i = 0; i < arg.length; i++){ if(pos === s.length){prefix_match(); break;} if(c === arg.charCodeAt(i)) c = s[++pos]; else{backtrack(); break;} } break; case opcodes.STRINGNORM: for (var arg = caml_jsbytes_of_string(cpool[uarg]), i = 0; i < arg.length; i++){ if(pos === s.length){prefix_match(); break;} if(normtable.charCodeAt(c) === arg.charCodeAt(i)) c = s[++pos]; else{backtrack(); break;} } break; case opcodes.CHARCLASS: if(pos === s.length){prefix_match(); break;} if(in_bitset(cpool[uarg], c)) pos++; else backtrack(); break; case opcodes.BOL: if(pos > 0 && s[pos - 1] !== 10) backtrack(); break; case opcodes.EOL: if(pos < s.length && s[pos] !== 10) backtrack(); break; case opcodes.WORDBOUNDARY: if(pos === 0){ if(pos === s.length){prefix_match(); break;} if(is_word_letter(s[0])) break; backtrack(); } else if(pos === s.length){ if(is_word_letter(s[pos - 1])) break; backtrack(); } else{ if(is_word_letter(s[pos - 1]) !== is_word_letter(s[pos])) break; backtrack(); } break; case opcodes.BEGGROUP: group = groups[uarg]; push({undo: {obj: group, prop: "start", value: group.start}}); group.start = pos; break; case opcodes.ENDGROUP: group = groups[uarg]; push({undo: {obj: group, prop: "end", value: group.end}}); group.end = pos; break; case opcodes.REFGROUP: group = groups[uarg]; if(group.start < 0 || group.end < 0){backtrack(); break;} for(var i = group.start; i < group.end; i++){ if(pos === s.length){prefix_match(); break;} if(s[i] !== s[pos]){backtrack(); break;} pos++; } break; case opcodes.SIMPLEOPT: if(in_bitset(cpool[uarg], c)) pos++; break; case opcodes.SIMPLESTAR: while(in_bitset(cpool[uarg], c)) c = s[++pos]; break; case opcodes.SIMPLEPLUS: if(pos === s.length){prefix_match(); break;} if(in_bitset(cpool[uarg], c)) do c = s[++pos];while(in_bitset(cpool[uarg], c)); else backtrack(); break; case opcodes.ACCEPT: return accept(); case opcodes.GOTO: pc = pc + sarg; break; case opcodes.PUSHBACK: push({pos: {pc: pc + sarg, txt: pos}}); break; case opcodes.SETMARK: push ({undo: {obj: re_register, prop: uarg, value: re_register[uarg]}}); re_register[uarg] = pos; break; case opcodes.CHECKPROGRESS: if(re_register[uarg] === pos) backtrack(); break; default: throw new Error("Invalid bytecode"); } } return 0; } return re_match_impl; } (); function re_partial_match(re, s, pos){ if(pos < 0 || pos > caml_ml_string_length(s)) caml_invalid_argument("Str.partial_match"); var res = re_match(re, s, pos, 1); return res ? res : [0]; } function re_replacement_text(repl, groups, orig){ var repl = caml_jsbytes_of_string(repl), len = repl.length, orig = caml_jsbytes_of_string(orig), res = "", n = 0, cur, start, end, c; while(n < len){ cur = repl.charAt(n++); if(cur !== "\\") res += cur; else{ if(n === len) caml_failwith("Str.replace: illegal backslash sequence"); cur = repl.charAt(n++); switch(cur){ case "\\": res += cur; break; case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": c = + cur; if(c * 2 >= groups.length - 1) caml_failwith("Str.replace: reference to unmatched group"); start = caml_array_get(groups, c * 2); end = caml_array_get(groups, c * 2 + 1); if(start === - 1) caml_failwith("Str.replace: reference to unmatched group"); res += orig.slice(start, end); break; default: res += "\\" + cur; } } } return caml_string_of_jsbytes(res); } function re_search_backward(re, s, pos){ if(pos < 0 || pos > caml_ml_string_length(s)) caml_invalid_argument("Str.search_backward"); var startchars = re[6] | 0; if(startchars >= 0){ startchars = re[2][startchars + 1]; var len = caml_ml_string_length(s); do{ while (pos > 0 && pos < len && caml_string_get(startchars, caml_string_get(s, pos)) === 0) pos--; var res = re_match(re, s, pos, 0); if(res) return res; pos--; } while (pos >= 0); } else do{var res = re_match(re, s, pos, 0); if(res) return res; pos--;} while (pos >= 0); return [0]; } function re_search_forward(re, s, pos){ if(pos < 0 || pos > caml_ml_string_length(s)) caml_invalid_argument("Str.search_forward"); var startchars = re[6] | 0, len = caml_ml_string_length(s); if(startchars >= 0){ startchars = re[2][startchars + 1]; do{ while (pos < len && caml_string_get(startchars, caml_string_get(s, pos)) === 0) pos++; var res = re_match(re, s, pos, 0); if(res) return res; pos++; } while (pos <= len); } else do{var res = re_match(re, s, pos, 0); if(res) return res; pos++;} while (pos <= len); return [0]; } function re_string_match(re, s, pos){ if(pos < 0 || pos > caml_ml_string_length(s)) caml_invalid_argument("Str.string_match"); var res = re_match(re, s, pos, 0); return res ? res : [0]; } function set_digit_nat(nat, ofs, digit){nat.data[ofs] = digit; return 0;} function set_digit_nat_native(nat, ofs, digit){nat.data[ofs] = digit; return 0; } function square_nat(nat1, ofs1, len1, nat2, ofs2, len2){ var carry = 0; carry += add_nat(nat1, ofs1, len1, nat1, ofs1, len1, 0); carry += mult_nat(nat1, ofs1, len1, nat2, ofs2, len2, nat2, ofs2, len2); return carry; } function unix_error_message(err){ const errno = typeof err === "number" ? err : - err[1]; return caml_string_of_jsstring(caml_strerror(errno)); } function caml_setup_uncaught_exception_handler(){ var process = globalThis.process; if(process?.on) process.on ("uncaughtException", function(err, origin){ caml_fatal_uncaught_exception(err); process.exit(2); }); else if(globalThis.addEventListener) globalThis.addEventListener ("error", function(event){ if(event.error) caml_fatal_uncaught_exception(event.error); }); } caml_setup_uncaught_exception_handler(); globalThis.jsoo_runtime = {caml_blake2_string: caml_blake2_string, caml_blake2_update: caml_blake2_update, caml_blake2_final: caml_blake2_final, caml_blake2_create: caml_blake2_create, blake2b: blake2b, caml_runtime_events_read_poll: caml_runtime_events_read_poll, caml_runtime_events_free_cursor: caml_runtime_events_free_cursor, caml_runtime_events_create_cursor: caml_runtime_events_create_cursor, caml_ml_runtime_events_resume: caml_ml_runtime_events_resume, caml_ml_runtime_events_are_active: caml_ml_runtime_events_are_active, caml_ml_runtime_events_pause: caml_ml_runtime_events_pause, caml_ml_runtime_events_start: caml_ml_runtime_events_start, caml_runtime_events_user_resolve: caml_runtime_events_user_resolve, caml_runtime_events_user_write: caml_runtime_events_user_write, caml_runtime_events_user_register: caml_runtime_events_user_register, caml_custom_event_index: caml_custom_event_index, caml_zstd_initialize: caml_zstd_initialize, caml_decompress_input: caml_decompress_input, zstd_decompress: zstd_decompress, jsoo_effect_not_supported: jsoo_effect_not_supported, caml_ml_condition_signal: caml_ml_condition_signal, caml_ml_condition_broadcast: caml_ml_condition_broadcast, caml_ml_condition_wait: caml_ml_condition_wait, caml_ml_condition_new: caml_ml_condition_new, caml_get_continuation_callstack: caml_get_continuation_callstack, caml_continuation_use_and_update_handler_noexc: caml_continuation_use_and_update_handler_noexc, caml_continuation_use_noexc: caml_continuation_use_noexc, caml_alloc_stack: caml_alloc_stack, caml_ml_mutex_unlock: caml_ml_mutex_unlock, caml_ml_mutex_try_lock: caml_ml_mutex_try_lock, caml_ml_mutex_lock: caml_ml_mutex_lock, caml_ml_mutex_new: caml_ml_mutex_new, MlMutex: MlMutex, caml_lxm_next: caml_lxm_next, caml_lxm_daba: caml_lxm_daba, caml_lxm_M: caml_lxm_M, caml_ml_domain_cpu_relax: caml_ml_domain_cpu_relax, caml_ml_domain_id: caml_ml_domain_id, caml_domain_spawn: caml_domain_spawn, caml_domain_id: caml_domain_id, caml_recommended_domain_count: caml_recommended_domain_count, caml_atomic_make_contended: caml_atomic_make_contended, caml_atomic_exchange: caml_atomic_exchange, caml_atomic_fetch_add: caml_atomic_fetch_add, caml_atomic_cas: caml_atomic_cas, caml_atomic_load: caml_atomic_load, caml_domain_dls_get: caml_domain_dls_get, caml_domain_dls_compare_and_set: caml_domain_dls_compare_and_set, caml_domain_dls_set: caml_domain_dls_set, caml_domain_dls: caml_domain_dls, caml_ephe_check_data: caml_ephe_check_data, caml_ephe_unset_data: caml_ephe_unset_data, caml_ephe_set_data_opt: caml_ephe_set_data_opt, caml_ephe_set_data: caml_ephe_set_data, caml_ephe_get_data_copy: caml_ephe_get_data_copy, caml_ephe_get_data: caml_ephe_get_data, caml_ephe_blit_data: caml_ephe_blit_data, caml_ephe_blit_key: caml_ephe_blit_key, caml_ephe_check_key: caml_ephe_check_key, caml_ephe_get_key_copy: caml_ephe_get_key_copy, caml_ephe_get_key: caml_ephe_get_key, caml_weak_set: caml_weak_set, caml_weak_create: caml_weak_create, caml_ephe_create: caml_ephe_create, caml_ephe_unset_key: caml_ephe_unset_key, caml_ephe_set_key: caml_ephe_set_key, caml_ephe_none: caml_ephe_none, caml_ephe_data_offset: caml_ephe_data_offset, caml_ephe_key_offset: caml_ephe_key_offset, caml_raise_system_error: caml_raise_system_error, caml_unix_inet_addr_of_string: caml_unix_inet_addr_of_string, caml_unix_findclose: caml_unix_findclose, caml_unix_findnext: caml_unix_findnext, caml_unix_findfirst: caml_unix_findfirst, caml_unix_rewinddir: caml_unix_rewinddir, caml_unix_closedir: caml_unix_closedir, caml_unix_readdir: caml_unix_readdir, caml_unix_opendir: caml_unix_opendir, caml_unix_has_symlink: caml_unix_has_symlink, caml_unix_getpwnam: caml_unix_getpwnam, caml_unix_getegid: caml_unix_getegid, caml_unix_getgid: caml_unix_getgid, caml_unix_geteuid: caml_unix_geteuid, caml_unix_getuid: caml_unix_getuid, caml_unix_outchannel_of_filedescr: caml_unix_outchannel_of_filedescr, caml_unix_inchannel_of_filedescr: caml_unix_inchannel_of_filedescr, caml_unix_close: caml_unix_close, caml_unix_ftruncate_64: caml_unix_ftruncate_64, caml_unix_ftruncate: caml_unix_ftruncate, caml_unix_lseek_64: caml_unix_lseek_64, caml_unix_lseek: caml_unix_lseek, caml_unix_read_bigarray: caml_unix_read_bigarray, caml_unix_read: caml_unix_read, caml_unix_write_bigarray: caml_unix_write_bigarray, caml_unix_single_write: caml_unix_single_write, caml_unix_write: caml_unix_write, caml_unix_fsync: caml_unix_fsync, caml_unix_fchmod: caml_unix_fchmod, caml_unix_fstat_64: caml_unix_fstat_64, caml_unix_fstat: caml_unix_fstat, caml_unix_lookup_file: caml_unix_lookup_file, caml_unix_open: caml_unix_open, caml_unix_access: caml_unix_access, caml_unix_truncate_64: caml_unix_truncate_64, caml_unix_truncate: caml_unix_truncate, caml_unix_utimes: caml_unix_utimes, caml_unix_unlink: caml_unix_unlink, caml_unix_readlink: caml_unix_readlink, caml_unix_symlink: caml_unix_symlink, caml_unix_link: caml_unix_link, caml_unix_rmdir: caml_unix_rmdir, caml_unix_mkdir: caml_unix_mkdir, caml_unix_rename: caml_unix_rename, caml_unix_chmod: caml_unix_chmod, caml_unix_lstat_64: caml_unix_lstat_64, caml_unix_lstat: caml_unix_lstat, caml_unix_stat_64: caml_unix_stat_64, caml_unix_stat: caml_unix_stat, caml_unix_chdir: caml_unix_chdir, unix_error_message: unix_error_message, caml_strerror: caml_strerror, make_unix_err_args: make_unix_err_args, unix_error: unix_error, caml_unix_isatty: caml_unix_isatty, caml_unix_filedescr_of_fd: caml_unix_filedescr_of_fd, caml_unix_cleanup: caml_unix_cleanup, caml_unix_startup: caml_unix_startup, caml_unix_mktime: caml_unix_mktime, caml_unix_localtime: caml_unix_localtime, caml_unix_gmtime: caml_unix_gmtime, caml_unix_times: caml_unix_times, caml_unix_time: caml_unix_time, caml_unix_gettimeofday: caml_unix_gettimeofday, re_replacement_text: re_replacement_text, re_partial_match: re_partial_match, re_string_match: re_string_match, re_search_backward: re_search_backward, re_search_forward: re_search_forward, re_match: re_match, caml_io_buffer_size: caml_io_buffer_size, caml_sys_is_regular_file: caml_sys_is_regular_file, caml_xdg_defaults: caml_xdg_defaults, caml_sys_const_naked_pointers_checked: caml_sys_const_naked_pointers_checked, caml_ml_runtime_warnings_enabled: caml_ml_runtime_warnings_enabled, caml_ml_enable_runtime_warnings: caml_ml_enable_runtime_warnings, caml_runtime_warnings: caml_runtime_warnings, caml_install_signal_handler: caml_install_signal_handler, caml_runtime_parameters: caml_runtime_parameters, caml_runtime_variant: caml_runtime_variant, caml_sys_isatty: caml_sys_isatty, caml_sys_get_config: caml_sys_get_config, os_type: os_type, caml_sys_const_backend_type: caml_sys_const_backend_type, caml_sys_const_ostype_cygwin: caml_sys_const_ostype_cygwin, caml_sys_const_ostype_win32: caml_sys_const_ostype_win32, caml_sys_const_ostype_unix: caml_sys_const_ostype_unix, caml_sys_const_max_wosize: caml_sys_const_max_wosize, caml_sys_const_int_size: caml_sys_const_int_size, caml_sys_const_word_size: caml_sys_const_word_size, caml_sys_const_big_endian: caml_sys_const_big_endian, caml_sys_random_seed: caml_sys_random_seed, caml_sys_time_include_children: caml_sys_time_include_children, caml_sys_time: caml_sys_time, caml_sys_system_command: caml_sys_system_command, caml_sys_executable_name: caml_sys_executable_name, caml_sys_modify_argv: caml_sys_modify_argv, caml_sys_argv: caml_sys_argv, caml_sys_get_argv: caml_sys_get_argv, caml_executable_name: caml_executable_name, caml_argv: caml_argv, caml_sys_unsafe_getenv: caml_sys_unsafe_getenv, caml_sys_getenv: caml_sys_getenv, jsoo_sys_getenv: jsoo_sys_getenv, caml_set_static_env: caml_set_static_env, jsoo_static_env: jsoo_static_env, caml_fatal_uncaught_exception: caml_fatal_uncaught_exception, caml_format_exception: caml_format_exception, caml_is_special_exception: caml_is_special_exception, caml_sys_exit: caml_sys_exit, caml_raise_sys_error: caml_raise_sys_error, caml_maybe_print_stats: caml_maybe_print_stats, caml_is_printable: caml_is_printable, caml_get_global_data: caml_get_global_data, caml_register_global: caml_register_global, jsoo_toplevel_reloc: jsoo_toplevel_reloc, caml_build_symbols: caml_build_symbols, caml_global_data: caml_global_data, caml_named_value: caml_named_value, caml_register_named_value: caml_register_named_value, caml_named_values: caml_named_values, caml_call_gen: caml_call_gen, caml_set_parser_trace: caml_set_parser_trace, caml_parse_engine: caml_parse_engine, caml_parser_trace: caml_parser_trace, caml_custom_identifier: caml_custom_identifier, caml_is_continuation_tag: caml_is_continuation_tag, caml_lazy_read_result: caml_lazy_read_result, caml_lazy_reset_to_lazy: caml_lazy_reset_to_lazy, caml_lazy_update_to_forward: caml_lazy_update_to_forward, caml_lazy_update_to_forcing: caml_lazy_update_to_forcing, caml_obj_update_tag: caml_obj_update_tag, caml_obj_add_offset: caml_obj_add_offset, caml_obj_reachable_words: caml_obj_reachable_words, caml_obj_set_raw_field: caml_obj_set_raw_field, caml_obj_raw_field: caml_obj_raw_field, caml_fresh_oo_id: caml_fresh_oo_id, caml_set_oo_id: caml_set_oo_id, caml_oo_last_id: caml_oo_last_id, caml_get_public_method: caml_get_public_method, caml_get_cached_method: caml_get_cached_method, caml_oo_cache_id: caml_oo_cache_id, caml_method_cache: caml_method_cache, caml_lazy_make_forward: caml_lazy_make_forward, caml_obj_is_shared: caml_obj_is_shared, caml_obj_compare_and_swap: caml_obj_compare_and_swap, caml_obj_dup: caml_obj_dup, caml_obj_with_tag: caml_obj_with_tag, caml_obj_block: caml_obj_block, caml_obj_tag: caml_obj_tag, caml_alloc_dummy_infix: caml_alloc_dummy_infix, caml_update_dummy: caml_update_dummy, deserialize_nat: deserialize_nat, serialize_nat: serialize_nat, lxor_digit_nat: lxor_digit_nat, lor_digit_nat: lor_digit_nat, land_digit_nat: land_digit_nat, compare_nat: compare_nat, compare_digits_nat: compare_digits_nat, shift_right_nat: shift_right_nat, div_nat: div_nat, div_digit_nat: div_digit_nat, div_helper: div_helper, shift_left_nat: shift_left_nat, square_nat: square_nat, mult_nat: mult_nat, mult_digit_nat: mult_digit_nat, sub_nat: sub_nat, decr_nat: decr_nat, complement_nat: complement_nat, add_nat: add_nat, incr_nat: incr_nat, is_digit_odd: is_digit_odd, is_digit_normalized: is_digit_normalized, is_digit_zero: is_digit_zero, is_digit_int: is_digit_int, num_leading_zero_bits_in_digit: num_leading_zero_bits_in_digit, num_digits_nat: num_digits_nat, nth_digit_nat_native: nth_digit_nat_native, set_digit_nat_native: set_digit_nat_native, nth_digit_nat: nth_digit_nat, set_digit_nat: set_digit_nat, blit_nat: blit_nat, set_to_zero_nat: set_to_zero_nat, create_nat: create_nat, nat_of_array: nat_of_array, length_nat: length_nat, caml_hash_nat: caml_hash_nat, MlNat: MlNat, initialize_nat: initialize_nat, caml_new_string: caml_new_string, caml_array_of_bytes: caml_array_of_bytes, caml_array_of_string: caml_array_of_string, caml_js_to_string: caml_js_to_string, caml_to_js_string: caml_to_js_string, caml_js_from_string: caml_js_from_string, caml_js_to_byte_string: caml_js_to_byte_string, caml_is_ml_string: caml_is_ml_string, caml_ml_bytes_content: caml_ml_bytes_content, caml_is_ml_bytes: caml_is_ml_bytes, caml_bytes_of_jsbytes: caml_bytes_of_jsbytes, caml_string_of_jsstring: caml_string_of_jsstring, caml_jsstring_of_string: caml_jsstring_of_string, jsoo_text_decoder_buff: jsoo_text_decoder_buff, caml_jsbytes_of_string: caml_jsbytes_of_string, caml_string_of_jsbytes: caml_string_of_jsbytes, caml_bytes_of_string: caml_bytes_of_string, caml_string_of_bytes: caml_string_of_bytes, caml_string_lessthan: caml_string_lessthan, caml_string_lessequal: caml_string_lessequal, caml_string_equal: caml_string_equal, caml_string_compare: caml_string_compare, caml_ml_string_length: caml_ml_string_length, caml_string_unsafe_get: caml_string_unsafe_get, caml_string_concat: caml_string_concat, caml_ml_bytes_length: caml_ml_bytes_length, caml_blit_string: caml_blit_string, caml_blit_bytes: caml_blit_bytes, caml_fill_bytes: caml_fill_bytes, caml_bytes_greaterthan: caml_bytes_greaterthan, caml_string_greaterthan: caml_string_greaterthan, caml_bytes_greaterequal: caml_bytes_greaterequal, caml_string_greaterequal: caml_string_greaterequal, caml_bytes_lessthan: caml_bytes_lessthan, caml_bytes_lessequal: caml_bytes_lessequal, caml_bytes_notequal: caml_bytes_notequal, caml_string_notequal: caml_string_notequal, caml_bytes_equal: caml_bytes_equal, caml_bytes_compare: caml_bytes_compare, caml_bytes_of_uint8_array: caml_bytes_of_uint8_array, caml_bytes_of_array: caml_bytes_of_array, caml_string_of_uint8_array: caml_string_of_uint8_array, caml_string_of_array: caml_string_of_array, caml_create_bytes: caml_create_bytes, caml_create_string: caml_create_string, caml_uint8_array_of_string: caml_uint8_array_of_string, caml_uint8_array_of_bytes: caml_uint8_array_of_bytes, caml_convert_bytes_to_array: caml_convert_bytes_to_array, caml_convert_string_to_bytes: caml_convert_string_to_bytes, MlBytes: MlBytes, caml_bytes_of_utf16_jsstring: caml_bytes_of_utf16_jsstring, jsoo_text_decoder: jsoo_text_decoder, jsoo_text_encoder: jsoo_text_encoder, caml_bytes_set: caml_bytes_set, caml_bytes_set64: caml_bytes_set64, caml_bytes_set32: caml_bytes_set32, caml_bytes_set16: caml_bytes_set16, caml_string_set: caml_string_set, caml_bytes_get: caml_bytes_get, caml_bytes_get64: caml_bytes_get64, caml_string_get64: caml_string_get64, caml_bytes_get32: caml_bytes_get32, caml_string_get32: caml_string_get32, caml_bytes_get16: caml_bytes_get16, caml_string_get16: caml_string_get16, caml_string_get: caml_string_get, caml_bytes_bound_error: caml_bytes_bound_error, caml_string_bound_error: caml_string_bound_error, caml_bytes_unsafe_set: caml_bytes_unsafe_set, caml_bytes_unsafe_get: caml_bytes_unsafe_get, jsoo_is_ascii: jsoo_is_ascii, caml_sub_uint8_array_to_jsbytes: caml_sub_uint8_array_to_jsbytes, caml_subarray_to_jsbytes: caml_subarray_to_jsbytes, caml_str_repeat: caml_str_repeat, caml_md5_bytes: caml_md5_bytes, caml_MD5Final: caml_MD5Final, caml_MD5Update: caml_MD5Update, caml_MD5Init: caml_MD5Init, caml_MD5Transform: caml_MD5Transform, caml_md5_string: caml_md5_string, caml_md5_chan: caml_md5_chan, caml_output_value_to_buffer: caml_output_value_to_buffer, caml_output_value_to_bytes: caml_output_value_to_bytes, caml_output_value_to_string: caml_output_value_to_string, caml_output_val: caml_output_val, MlObjectTable: MlObjectTable, caml_marshal_data_size: caml_marshal_data_size, caml_marshal_header_size: caml_marshal_header_size, caml_input_value_from_reader: caml_input_value_from_reader, caml_custom_ops: caml_custom_ops, caml_nativeint_unmarshal: caml_nativeint_unmarshal, caml_int32_unmarshal: caml_int32_unmarshal, caml_int64_marshal: caml_int64_marshal, caml_int64_unmarshal: caml_int64_unmarshal, caml_input_value_from_bytes: caml_input_value_from_bytes, caml_float_of_bytes: caml_float_of_bytes, JsStringReader: JsStringReader, UInt8ArrayReader: UInt8ArrayReader, caml_marshal_constants: caml_marshal_constants, caml_new_lex_engine: caml_new_lex_engine, caml_lex_engine: caml_lex_engine, caml_lex_array: caml_lex_array, caml_js_error_of_exception: caml_js_error_of_exception, caml_xmlhttprequest_create: caml_xmlhttprequest_create, caml_js_get_console: caml_js_get_console, caml_js_html_entities: caml_js_html_entities, caml_js_html_escape: caml_js_html_escape, caml_js_object: caml_js_object, caml_pure_js_expr: caml_pure_js_expr, caml_js_expr: caml_js_expr, caml_js_eval_string: caml_js_eval_string, caml_js_strict_equals: caml_js_strict_equals, caml_js_equals: caml_js_equals, caml_js_function_arity: caml_js_function_arity, caml_js_wrap_meth_callback_unsafe: caml_js_wrap_meth_callback_unsafe, caml_js_wrap_meth_callback_strict: caml_js_wrap_meth_callback_strict, caml_js_wrap_meth_callback_arguments: caml_js_wrap_meth_callback_arguments, caml_js_wrap_meth_callback: caml_js_wrap_meth_callback, caml_js_wrap_callback_unsafe: caml_js_wrap_callback_unsafe, caml_js_wrap_callback_strict: caml_js_wrap_callback_strict, caml_js_wrap_callback_arguments: caml_js_wrap_callback_arguments, caml_js_wrap_callback: caml_js_wrap_callback, caml_ojs_new_arr: caml_ojs_new_arr, caml_js_new: caml_js_new, caml_js_meth_call: caml_js_meth_call, caml_js_fun_call: caml_js_fun_call, caml_js_call: caml_js_call, caml_js_var: caml_js_var, caml_list_to_js_array: caml_list_to_js_array, caml_list_of_js_array: caml_list_of_js_array, caml_js_to_array: caml_js_to_array, caml_js_from_array: caml_js_from_array, caml_js_to_int32: caml_js_to_int32, caml_js_to_float: caml_js_to_float, caml_js_from_float: caml_js_from_float, caml_js_to_bool: caml_js_to_bool, caml_js_from_bool: caml_js_from_bool, caml_throw_js_exception: caml_throw_js_exception, caml_js_error_option_of_exception: caml_js_error_option_of_exception, caml_exn_with_js_backtrace: caml_exn_with_js_backtrace, caml_maybe_attach_backtrace: caml_maybe_attach_backtrace, caml_wrap_exception: caml_wrap_exception, caml_jsoo_flags_effects: caml_jsoo_flags_effects, caml_jsoo_flags_use_js_string: caml_jsoo_flags_use_js_string, caml_is_js: caml_is_js, caml_callback: caml_callback, caml_trampoline_return: caml_trampoline_return, caml_trampoline: caml_trampoline, caml_js_typeof: caml_js_typeof, caml_js_instanceof: caml_js_instanceof, caml_js_delete: caml_js_delete, caml_js_get: caml_js_get, caml_js_set: caml_js_set, caml_js_pure_expr: caml_js_pure_expr, caml_ml_set_buffered: caml_ml_set_buffered, caml_ml_is_buffered: caml_ml_is_buffered, caml_ml_output_int: caml_ml_output_int, caml_ml_pos_out_64: caml_ml_pos_out_64, caml_ml_pos_out: caml_ml_pos_out, caml_pos_out: caml_pos_out, caml_ml_seek_out_64: caml_ml_seek_out_64, caml_ml_seek_out: caml_ml_seek_out, caml_seek_out: caml_seek_out, caml_output_value: caml_output_value, caml_ml_output_char: caml_ml_output_char, caml_ml_output: caml_ml_output, caml_ml_output_bigarray: caml_ml_output_bigarray, caml_ml_output_bytes: caml_ml_output_bytes, caml_ml_output_ta: caml_ml_output_ta, caml_ml_flush: caml_ml_flush, caml_ml_input_scan_line: caml_ml_input_scan_line, caml_ml_pos_in_64: caml_ml_pos_in_64, caml_ml_pos_in: caml_ml_pos_in, caml_pos_in: caml_pos_in, caml_ml_seek_in_64: caml_ml_seek_in_64, caml_ml_seek_in: caml_ml_seek_in, caml_seek_in: caml_seek_in, caml_ml_input_int: caml_ml_input_int, caml_ml_input_char: caml_ml_input_char, caml_input_value_to_outside_heap: caml_input_value_to_outside_heap, caml_input_value: caml_input_value, caml_ml_input_block: caml_ml_input_block, caml_ml_input_bigarray: caml_ml_input_bigarray, caml_ml_input: caml_ml_input, caml_refill: caml_refill, caml_ml_set_channel_refill: caml_ml_set_channel_refill, caml_ml_set_channel_output: caml_ml_set_channel_output, caml_ml_channel_size_64: caml_ml_channel_size_64, caml_ml_channel_size: caml_ml_channel_size, caml_ml_close_channel: caml_ml_close_channel, caml_ml_is_binary_mode: caml_ml_is_binary_mode, caml_ml_set_binary_mode: caml_ml_set_binary_mode, caml_channel_descriptor: caml_channel_descriptor, caml_ml_open_descriptor_out_with_flags: caml_ml_open_descriptor_out_with_flags, caml_ml_open_descriptor_in_with_flags: caml_ml_open_descriptor_in_with_flags, caml_ml_open_descriptor_in: caml_ml_open_descriptor_in, caml_ml_open_descriptor_out: caml_ml_open_descriptor_out, caml_ml_out_channels_list: caml_ml_out_channels_list, caml_ml_channel_restore: caml_ml_channel_restore, caml_ml_channel_redirect: caml_ml_channel_redirect, caml_ml_channel_get: caml_ml_channel_get, caml_ml_channels: caml_ml_channels, caml_ml_set_channel_name: caml_ml_set_channel_name, caml_sys_open: caml_sys_open, MlChanid: MlChanid, caml_sys_close: caml_sys_close, caml_sys_fds: caml_sys_fds, caml_int64_bswap: caml_int64_bswap, caml_int32_bswap: caml_int32_bswap, caml_bswap16: caml_bswap16, caml_mod: caml_mod, caml_div: caml_div, caml_mul: caml_mul, caml_int_of_string: caml_int_of_string, caml_parse_digit: caml_parse_digit, caml_parse_sign_and_base: caml_parse_sign_and_base, caml_format_int: caml_format_int, caml_int64_hash: caml_int64_hash, caml_int64_to_bytes: caml_int64_to_bytes, caml_int64_of_bytes: caml_int64_of_bytes, caml_int64_hi32: caml_int64_hi32, caml_int64_lo32: caml_int64_lo32, caml_int64_create_lo_hi: caml_int64_create_lo_hi, caml_int64_create_lo_mi_hi: caml_int64_create_lo_mi_hi, caml_int64_of_string: caml_int64_of_string, caml_int64_format: caml_int64_format, caml_int64_of_float: caml_int64_of_float, caml_int64_to_float: caml_int64_to_float, caml_int64_to_int32: caml_int64_to_int32, caml_int64_of_int32: caml_int64_of_int32, caml_int64_mod: caml_int64_mod, caml_int64_div: caml_int64_div, caml_int64_shift_right: caml_int64_shift_right, caml_int64_shift_right_unsigned: caml_int64_shift_right_unsigned, caml_int64_shift_left: caml_int64_shift_left, caml_int64_xor: caml_int64_xor, caml_int64_or: caml_int64_or, caml_int64_and: caml_int64_and, caml_int64_is_negative: caml_int64_is_negative, caml_int64_is_zero: caml_int64_is_zero, caml_int64_mul: caml_int64_mul, caml_int64_sub: caml_int64_sub, caml_int64_add: caml_int64_add, caml_int64_neg: caml_int64_neg, caml_int64_compare: caml_int64_compare, caml_int64_ult: caml_int64_ult, MlInt64: MlInt64, caml_int64_offset: caml_int64_offset, caml_float_of_string: caml_float_of_string, caml_format_float: caml_format_float, caml_fma_float: caml_fma_float, caml_erfc_float: caml_erfc_float, caml_erf_float: caml_erf_float, caml_cbrt_float: caml_cbrt_float, caml_round_float: caml_round_float, caml_atanh_float: caml_atanh_float, caml_tanh_float: caml_tanh_float, caml_asinh_float: caml_asinh_float, caml_sinh_float: caml_sinh_float, caml_acosh_float: caml_acosh_float, caml_cosh_float: caml_cosh_float, caml_log10_float: caml_log10_float, caml_hypot_float: caml_hypot_float, caml_log2_float: caml_log2_float, caml_log1p_float: caml_log1p_float, caml_exp2_float: caml_exp2_float, caml_expm1_float: caml_expm1_float, caml_signbit_float: caml_signbit_float, caml_copysign_float: caml_copysign_float, caml_float_compare: caml_float_compare, caml_frexp_float: caml_frexp_float, caml_ldexp_float: caml_ldexp_float, caml_modf_float: caml_modf_float, caml_classify_float: caml_classify_float, caml_int32_float_of_bits: caml_int32_float_of_bits, caml_trunc_float: caml_trunc_float, caml_nextafter_float: caml_nextafter_float, caml_int64_float_of_bits: caml_int64_float_of_bits, caml_hexstring_of_float: caml_hexstring_of_float, caml_int32_bits_of_float: caml_int32_bits_of_float, caml_int64_bits_of_float: caml_int64_bits_of_float, jsoo_dataview: jsoo_dataview, caml_string_hash: caml_string_hash, caml_hash: caml_hash, caml_hash_mix_string: caml_hash_mix_string, caml_hash_mix_bytes: caml_hash_mix_bytes, caml_hash_mix_bytes_arr: caml_hash_mix_bytes_arr, caml_hash_mix_jsbytes: caml_hash_mix_jsbytes, caml_hash_mix_int64: caml_hash_mix_int64, caml_hash_mix_float: caml_hash_mix_float, caml_hash_mix_final: caml_hash_mix_final, caml_hash_mix_int: caml_hash_mix_int, caml_gr_close_subwindow: caml_gr_close_subwindow, caml_gr_open_subwindow: caml_gr_open_subwindow, caml_gr_window_id: caml_gr_window_id, caml_gr_display_mode: caml_gr_display_mode, caml_gr_remember_mode: caml_gr_remember_mode, caml_gr_synchronize: caml_gr_synchronize, caml_gr_wait_event: caml_gr_wait_event, caml_gr_sigio_signal: caml_gr_sigio_signal, caml_gr_sigio_handler: caml_gr_sigio_handler, caml_gr_blit_image: caml_gr_blit_image, caml_gr_create_image: caml_gr_create_image, caml_gr_draw_image: caml_gr_draw_image, caml_gr_dump_image: caml_gr_dump_image, caml_gr_make_image: caml_gr_make_image, caml_gr_text_size: caml_gr_text_size, caml_gr_set_text_size: caml_gr_set_text_size, caml_gr_set_font: caml_gr_set_font, caml_gr_draw_string: caml_gr_draw_string, caml_gr_draw_char: caml_gr_draw_char, caml_gr_draw_str: caml_gr_draw_str, caml_gr_fill_arc: caml_gr_fill_arc, caml_gr_fill_poly: caml_gr_fill_poly, caml_gr_fill_rect: caml_gr_fill_rect, caml_gr_set_line_width: caml_gr_set_line_width, caml_gr_draw_arc: caml_gr_draw_arc, caml_gr_arc_aux: caml_gr_arc_aux, caml_gr_draw_rect: caml_gr_draw_rect, caml_gr_lineto: caml_gr_lineto, caml_gr_current_y: caml_gr_current_y, caml_gr_current_x: caml_gr_current_x, caml_gr_moveto: caml_gr_moveto, caml_gr_point_color: caml_gr_point_color, caml_gr_plot: caml_gr_plot, caml_gr_set_color: caml_gr_set_color, caml_gr_size_y: caml_gr_size_y, caml_gr_size_x: caml_gr_size_x, caml_gr_clear_graph: caml_gr_clear_graph, caml_gr_resize_window: caml_gr_resize_window, caml_gr_set_window_title: caml_gr_set_window_title, caml_gr_close_graph: caml_gr_close_graph, caml_gr_doc_of_state: caml_gr_doc_of_state, caml_gr_state_create: caml_gr_state_create, caml_gr_state_init: caml_gr_state_init, caml_gr_open_graph: caml_gr_open_graph, caml_gr_state_set: caml_gr_state_set, caml_gr_state_get: caml_gr_state_get, caml_gr_state: caml_gr_state, caml_get_minor_free: caml_get_minor_free, caml_gc_minor_words: caml_gc_minor_words, caml_gc_major_slice: caml_gc_major_slice, caml_memprof_discard: caml_memprof_discard, caml_memprof_stop: caml_memprof_stop, caml_memprof_start: caml_memprof_start, caml_final_release: caml_final_release, caml_final_register_called_without_value: caml_final_register_called_without_value, caml_final_register: caml_final_register, caml_gc_get: caml_gc_get, caml_gc_set: caml_gc_set, caml_gc_stat: caml_gc_stat, caml_gc_quick_stat: caml_gc_quick_stat, caml_gc_counters: caml_gc_counters, caml_gc_compaction: caml_gc_compaction, caml_gc_full_major: caml_gc_full_major, caml_gc_major: caml_gc_major, caml_gc_minor: caml_gc_minor, caml_raise_nodejs_error: caml_raise_nodejs_error, caml_sys_open_for_node: caml_sys_open_for_node, MlNodeFd: MlNodeFd, ocaml_stats_from_node_stats: ocaml_stats_from_node_stats, MlNodeDevice: MlNodeDevice, fs_node_supported: fs_node_supported, jsoo_is_win32: jsoo_is_win32, MlFakeFd: MlFakeFd, MlFakeFd_out: MlFakeFd_out, MlFakeFile: MlFakeFile, MlFakeDevice: MlFakeDevice, caml_read_file_content: caml_read_file_content, jsoo_create_file: jsoo_create_file, caml_create_file: caml_create_file, caml_fs_init: caml_fs_init, jsoo_create_file_extern: jsoo_create_file_extern, caml_ba_map_file_bytecode: caml_ba_map_file_bytecode, caml_ba_map_file: caml_ba_map_file, caml_sys_rmdir: caml_sys_rmdir, caml_sys_mkdir: caml_sys_mkdir, caml_sys_rename: caml_sys_rename, caml_sys_is_directory: caml_sys_is_directory, caml_sys_remove: caml_sys_remove, caml_sys_read_directory: caml_sys_read_directory, caml_sys_file_exists: caml_sys_file_exists, caml_raise_no_such_file: caml_raise_no_such_file, caml_sys_chdir: caml_sys_chdir, caml_sys_getcwd: caml_sys_getcwd, caml_unmount: caml_unmount, caml_mount_autoload: caml_mount_autoload, resolve_fs_device: resolve_fs_device, caml_list_mount_point: caml_list_mount_point, jsoo_mount_point: jsoo_mount_point, caml_make_path: caml_make_path, path_is_absolute: path_is_absolute, MlFile: MlFile, caml_root: caml_root, caml_get_root: caml_get_root, caml_current_dir: caml_current_dir, caml_trailing_slash: caml_trailing_slash, caml_finish_formatting: caml_finish_formatting, caml_parse_format: caml_parse_format, caml_array_bound_error: caml_array_bound_error, caml_raise_not_found: caml_raise_not_found, caml_raise_zero_divide: caml_raise_zero_divide, caml_raise_end_of_file: caml_raise_end_of_file, caml_invalid_argument: caml_invalid_argument, caml_failwith: caml_failwith, caml_raise_with_string: caml_raise_with_string, caml_raise_with_args: caml_raise_with_args, caml_raise_with_arg: caml_raise_with_arg, caml_raise_constant: caml_raise_constant, caml_lessthan: caml_lessthan, caml_lessequal: caml_lessequal, caml_greaterthan: caml_greaterthan, caml_greaterequal: caml_greaterequal, caml_notequal: caml_notequal, caml_equal: caml_equal, caml_int_compare: caml_int_compare, caml_compare: caml_compare, caml_compare_val: caml_compare_val, caml_compare_val_number_custom: caml_compare_val_number_custom, caml_compare_val_get_custom: caml_compare_val_get_custom, caml_compare_val_tag: caml_compare_val_tag, caml_bigstring_blit_ba_to_bytes: caml_bigstring_blit_ba_to_bytes, caml_bigstring_blit_bytes_to_ba: caml_bigstring_blit_bytes_to_ba, caml_bigstring_blit_string_to_ba: caml_bigstring_blit_string_to_ba, caml_bigstring_blit_ba_to_ba: caml_bigstring_blit_ba_to_ba, caml_bigstring_memcmp: caml_bigstring_memcmp, bigstring_of_typed_array: bigstring_of_typed_array, bigstring_of_array_buffer: bigstring_of_array_buffer, bigstring_to_typed_array: bigstring_to_typed_array, bigstring_to_array_buffer: bigstring_to_array_buffer, caml_hash_mix_bigstring: caml_hash_mix_bigstring, caml_ba_from_typed_array: caml_ba_from_typed_array, caml_ba_kind_of_typed_array: caml_ba_kind_of_typed_array, caml_ba_to_typed_array: caml_ba_to_typed_array, caml_hash_mix_float32: caml_hash_mix_float32, caml_hash_mix_float16: caml_hash_mix_float16, caml_ba_hash: caml_ba_hash, caml_ba_create_from: caml_ba_create_from, caml_ba_deserialize: caml_ba_deserialize, caml_ba_serialize: caml_ba_serialize, caml_ba_reshape: caml_ba_reshape, caml_ba_slice: caml_ba_slice, caml_ba_sub: caml_ba_sub, caml_ba_blit: caml_ba_blit, caml_ba_fill: caml_ba_fill, caml_ba_set_3: caml_ba_set_3, caml_ba_set_2: caml_ba_set_2, caml_ba_set_1: caml_ba_set_1, caml_ba_uint8_set64: caml_ba_uint8_set64, caml_ba_uint8_set32: caml_ba_uint8_set32, caml_ba_uint8_set16: caml_ba_uint8_set16, caml_ba_set_generic: caml_ba_set_generic, caml_ba_get_3: caml_ba_get_3, caml_ba_get_2: caml_ba_get_2, caml_ba_get_1: caml_ba_get_1, caml_ba_uint8_get64: caml_ba_uint8_get64, caml_ba_uint8_get32: caml_ba_uint8_get32, caml_ba_uint8_get16: caml_ba_uint8_get16, caml_ba_get_generic: caml_ba_get_generic, caml_ba_dim_3: caml_ba_dim_3, caml_ba_dim_2: caml_ba_dim_2, caml_ba_dim_1: caml_ba_dim_1, caml_ba_dim: caml_ba_dim, caml_ba_num_dims: caml_ba_num_dims, caml_ba_layout: caml_ba_layout, caml_ba_kind: caml_ba_kind, caml_ba_change_layout: caml_ba_change_layout, caml_ba_create: caml_ba_create, caml_ba_create_unsafe: caml_ba_create_unsafe, caml_ba_compare: caml_ba_compare, Ml_Bigarray_c_1_1: Ml_Bigarray_c_1_1, Ml_Bigarray: Ml_Bigarray, caml_ba_custom_name: caml_ba_custom_name, caml_ba_create_buffer: caml_ba_create_buffer, caml_ba_get_size_per_element: caml_ba_get_size_per_element, caml_packFloat16: caml_packFloat16, caml_unpackFloat16: caml_unpackFloat16, caml_ba_get_size: caml_ba_get_size, caml_ba_init: caml_ba_init, caml_convert_raw_backtrace_slot: caml_convert_raw_backtrace_slot, caml_get_current_callstack: caml_get_current_callstack, caml_restore_raw_backtrace: caml_restore_raw_backtrace, caml_raw_backtrace_slot: caml_raw_backtrace_slot, caml_raw_backtrace_next_slot: caml_raw_backtrace_next_slot, caml_raw_backtrace_length: caml_raw_backtrace_length, caml_convert_raw_backtrace: caml_convert_raw_backtrace, caml_record_backtrace: caml_record_backtrace, caml_get_exception_raw_backtrace: caml_get_exception_raw_backtrace, caml_get_exception_backtrace: caml_get_exception_backtrace, caml_backtrace_status: caml_backtrace_status, caml_ml_debug_info_status: caml_ml_debug_info_status, caml_record_backtrace_runtime_flag: caml_record_backtrace_runtime_flag, caml_record_backtrace_env_flag: caml_record_backtrace_env_flag, caml_floatarray_create: caml_floatarray_create, caml_make_float_vect: caml_make_float_vect, caml_make_vect: caml_make_vect, caml_array_make: caml_array_make, caml_check_bound: caml_check_bound, caml_array_fill: caml_array_fill, caml_array_get: caml_array_get, caml_array_set: caml_array_set, caml_floatarray_blit: caml_floatarray_blit, caml_array_blit: caml_array_blit, caml_array_concat: caml_array_concat, caml_array_append: caml_array_append, caml_array_sub: caml_array_sub}; caml_fs_init(); var cst_Out_of_memory = "Out_of_memory"; caml_register_global(0, [248, cst_Out_of_memory, -1], cst_Out_of_memory); var cst_Sys_error = "Sys_error"; caml_register_global(1, [248, cst_Sys_error, -2], cst_Sys_error); var cst_Failure = "Failure"; caml_register_global(2, [248, cst_Failure, -3], cst_Failure); var cst_Invalid_argument = "Invalid_argument"; caml_register_global (3, [248, cst_Invalid_argument, -4], cst_Invalid_argument); var cst_End_of_file = "End_of_file"; caml_register_global(4, [248, cst_End_of_file, -5], cst_End_of_file); var cst_Division_by_zero = "Division_by_zero"; caml_register_global (5, [248, cst_Division_by_zero, -6], cst_Division_by_zero); var cst_Not_found = "Not_found"; caml_register_global(6, [248, cst_Not_found, -7], cst_Not_found); var cst_Match_failure = "Match_failure"; caml_register_global(7, [248, cst_Match_failure, -8], cst_Match_failure); var cst_Stack_overflow = "Stack_overflow"; caml_register_global(8, [248, cst_Stack_overflow, -9], cst_Stack_overflow); var cst_Sys_blocked_io = "Sys_blocked_io"; caml_register_global(9, [248, cst_Sys_blocked_io, -10], cst_Sys_blocked_io); var cst_Assert_failure = "Assert_failure"; caml_register_global (10, [248, cst_Assert_failure, -11], cst_Assert_failure); var cst_Undefined_recursive_module = "Undefined_recursive_module"; caml_register_global (11, [248, cst_Undefined_recursive_module, -12], cst_Undefined_recursive_module); return; } (globalThis)); (function(a){"use strict";var i=a.jsoo_runtime,c=i.caml_get_global_data(),dl="caml_unix_stat_64",dk="unix_lseek",l="caml_unix_inchannel_of_filedescr",dj="caml_unix_stat",di="caml_unix_write_bigarray",eG="caml_nativeint_format",a7="caml_int64_of_nativeint",dh="caml_unix_closedir",a6="caml_unix_getgrnam",b7="caml_unix_truncate",b6="caml_unix_getcwd",eC="caml_unix_readlink",eD="caml_floatarray_set",a4="caml_fill_bytes",a3="unix_error_message",b5="win_inchannel_of_filedescr",a2="caml_unix_time",b2="caml_unix_write",de="unix_lstat",eA="unix_open",dc="unix_rename",ez="caml_unix_chmod",aY="unix_access",aW="caml_unix_lseek",aX="unix_fsync",db="caml_unix_findnext",aU="caml_weak_get_copy",h="caml_array_set",da="caml_unix_opendir",ey="caml_unix_lookup_file",aT="caml_unix_getegid",ex="caml_unix_getgid",b0="caml_js_from_nativeint",aP="caml_unix_gmtime",aQ="caml_signbit_float",ew="caml_unix_close",ev="caml_js_from_int32",eu="caml_int64_to_int",bW="caml_check_bound_gen",p="caml_format_int",c8="unix_link",bS="unix_mkdir",aM="unix_rewinddir",aN="unix_read",c5="caml_unix_unlink",aJ="unix_getgid",c3="caml_unix_error_message",er="caml_unix_findclose",aF="caml_unix_lseek_64",ep="caml_array_get_float",bO="win_outchannel_of_filedescr",c0="caml_unix_fstat",bN="caml_unix_geteuid",cY="unix_lstat_64",aD="unix_inchannel_of_filedescr",bI="unix_getpwnam",bJ="unix_geteuid",aC="caml_unix_getuid",cX="caml_unix_utimes",ek="caml_unix_getpwuid",el="unix_getpwuid",o="caml_check_bound",ej="unix_ftruncate_64",aA="unix_isatty",bH="caml_unix_times",cV="caml_unix_exit",ei="unix_exit",ax="caml_unix_single_write",bG="caml_ephe_blit_key",cT="caml_nativeint_of_string",aw="unix_write",cR="caml_unix_ftruncate_64",cS="unix_close",eh="caml_js_to_int32",k="caml_sys_getcwd",cQ="caml_unix_readdir",bF="win_findclose",ar="%int_mul",cO="caml_int32_format",ed="caml_weak_blit",cM="caml_unix_localtime",cN="unix_times",ec="caml_array_set_addr",cL="caml_unix_inet_addr_of_string",eb="unix_ftruncate",cK="caml_weak_check",ea="caml_unix_symlink",ao="unix_outchannel_of_filedescr",al="caml_unix_has_symlink",cJ="unix_mktime",s="caml_int64_to_int32",bC="unix_fstat",d9="caml_unix_link",ak="caml_unix_fchmod",bA="unix_symlink",aj="unix_localtime",d8="unix_chdir",ai="unix_getgrgid",ah="caml_int32_compare",ag="caml_unix_mkdir",d5="win_startup",d4="caml_int32_bswap",af="caml_weak_get",d3="unix_readlink",ad="caml_unix_rmdir",e="caml_array_get",ac="caml_unix_lstat_64",ab="unix_inet_addr_of_string",bw="caml_unix_gettimeofday",r="caml_unix_outchannel_of_filedescr",bv="unix_stat",cE="caml_unix_chdir",$="unix_closedir",aa="win_cleanup",bu="caml_nativeint_bswap",Y="caml_unix_mktime",Z="caml_ephe_get_key",_="%int_mod",bt="unix_stat_64",cC="unix_getegid",cD="caml_unix_access",cA="caml_unix_isatty",X="caml_int32_mul",cz="caml_nativeint_compare",q="caml_int64_of_int32",V="caml_unix_fsync",dZ="win_findnext",R="caml_nativeint_mul",dY="unix_single_write",Q="caml_int32_mod",n="caml_js_from_float",cx="unix_truncate_64",cw="caml_ephe_check_key",dW="unix_opendir",bs="caml_array_set_float",dV="caml_ephe_get_key_copy",O="unix_getuid",d="caml_mul",N="caml_fill_string",g="caml_div",cr="caml_int64_of_int",dT="caml_unix_read_bigarray",M="unix_getgrnam",dR="win_findfirst",dQ="caml_unix_startup",bp="caml_unix_filedescr_of_fd",dP="caml_unix_ftruncate",f="caml_mod",cq="caml_check_bound_float",bn="unix_utimes",bo="caml_unix_getgrgid",dN="caml_int64_to_nativeint",bm="unix_time",dM="unix_fstat_64",J="caml_unix_fstat_64",co="unix_truncate",bk="unix_gmtime",bj="caml_unix_cleanup",dK="unix_getcwd",dJ="unix_readdir",j="caml_sys_exit",H="caml_channel_descriptor",bf="unix_lseek_64",t="caml_int_compare",G="caml_array_get_addr",dD="unix_chmod",dE="caml_unix_lstat",dC="caml_js_to_nativeint",F="caml_int32_div",ci="caml_unix_findfirst",E="caml_unix_truncate_64",D="caml_unix_rewinddir",C="unix_has_symlink",m="caml_int_of_string",dz="caml_unix_rename",be="win_filedescr_of_channel",B="unix_gettimeofday",dy="win_handle_fd",b="caml_unix_getpwnam",cd="caml_int32_of_string",dw="caml_nativeint_mod",w="unix_rmdir",ca="caml_unix_read",cb="unix_read_bigarray",dr="caml_floatarray_get",v="unix_unlink",a$="caml_unix_open",dp="caml_signbit",u="unix_fchmod",a9="caml_nativeint_div",dn="%int_div";c.aliases=i.caml_list_of_js_array([[0,bW,o],[0,eu,s],[0,dn,g],[0,ev,n],[0,dR,ci],[0,a9,g],[0,u,ak],[0,M,b],[0,ao,r],[0,cr,q],[0,b0,n],[0,dp,aQ],[0,cK,cw],[0,N,a4],[0,v,c5],[0,eb,dP],[0,dr,e],[0,ec,h],[0,O,aC],[0,cb,dT],[0,w,ad],[0,cN,bH],[0,ed,bG],[0,cO,p],[0,ey,di],[0,bs,h],[0,ar,d],[0,dW,da],[0,bF,er],[0,cd,m],[0,dw,f],[0,cx,E],[0,Q,f],[0,aU,dV],[0,R,d],[0,dY,ax],[0,cS,ew],[0,aX,V],[0,aw,b2],[0,cT,m],[0,aY,cD],[0,dy,bp],[0,dZ,db],[0,B,bw],[0,be,H],[0,ei,j],[0,cz,t],[0,X,d],[0,cV,j],[0,C,al],[0,dc,dz],[0,aA,cA],[0,ej,cR],[0,cC,aT],[0,de,dE],[0,eA,a$],[0,F,g],[0,el,b],[0,ek,b],[0,bt,dl],[0,dC,eh],[0,_,f],[0,bu,d4],[0,bJ,bN],[0,bI,b],[0,aa,bj],[0,$,dh],[0,b5,l],[0,dD,ez],[0,bv,dj],[0,G,e],[0,aD,l],[0,ab,cL],[0,cY,ac],[0,eD,h],[0,b6,k],[0,bO,r],[0,ep,e],[0,d3,eC],[0,af,Z],[0,a6,b],[0,bf,aF],[0,d5,dQ],[0,dJ,cQ],[0,aJ,ex],[0,c3,a3],[0,ah,t],[0,dK,k],[0,bk,aP],[0,a7,q],[0,ai,b],[0,co,b7],[0,d8,cE],[0,aj,cM],[0,eG,p],[0,dM,J],[0,bA,ea],[0,bm,a2],[0,dN,s],[0,aN,ca],[0,aM,D],[0,bS,ag],[0,bo,b],[0,c8,d9],[0,bn,cX],[0,cq,o],[0,bC,c0],[0,dk,aW],[0,cJ,Y]]);c.prim_count=952;var a8=102,b8=114,b9="Stdlib__Type",eF="Stdlib__Buffer",df="Js_of_ocaml__Dom_svg",dg="Stdlib__Out_channel",eE="Match_failure",a5="Stdlib__Gc",eB="Stdlib__Unit",b4="Jsoo_runtime__Runtime_version",b3="Stdlib__Map",a1="Sx_vm",dd="Stdlib__Parsing",a0="Stdlib__Effect",b1=108,aZ="Stdlib__String",aV="Stdlib__BytesLabels",c$="Stdlib__Condition",c_="Stdlib__Filename",aS="Stdlib__In_channel",c9="Not_found",aR="CamlinternalLazy",bZ="Division_by_zero",bY="Js_of_ocaml__Effect_js",aO=117,bX=104,et="Js_of_ocaml__",bV="Stdlib__Either",bU=109,bT="Js_of_ocaml__MutationObserver",bR="Js_of_ocaml__Json",c7="Stdlib__Callback",aL="Stdlib__Lexing",bQ="Undefined_recursive_module",c6="Stdlib__Printf",es=111,aK="Stdlib__Bool",c4="Stdlib__Int",c2="Stdlib__MoreLabels",aH=103,aI="Sx_render",c1="Sys_error",aG=100,bP="Js_of_ocaml__Dom_events",eq="Stdlib__Digest",cZ=101,aE="Sx_compiler",bM="Js_of_ocaml__PerformanceObserver",bL="Stdlib__Queue",eo=110,bK="Stdlib__Set",en="Stdlib__Stack",em="Js_of_ocaml__File",cW="Stdlib__Complex",aB="Jsoo_runtime__",cU="Jsoo_runtime",ay="Js_of_ocaml__WebSockets",az="Stdlib__Nativeint",av=113,cP="Sys_blocked_io",au="Stdlib__Random",eg="Js_of_ocaml__ResizeObserver",ef="Sx_runtime",ee="Js_of_ocaml",as=106,at="Stdlib__Marshal",aq="Js_of_ocaml__Console",bE="Sx_primitives",bD="Stdlib__Ephemeron",ap="CamlinternalMod",an="Js_of_ocaml__Js",am="Js_of_ocaml__Url",d$="Stdlib__Fun",d_="Stdlib__Char",bB=116,cI="Dune__exe__Sx_browser",d7="CamlinternalFormatBasics",cH="Stdlib__Weak",bz=105,cG="Stdlib__Format",d6="Stdlib__StdLabels",cF="Stdlib__Int64",by="Js_of_ocaml__Dom_html",ae="Stdlib__ArrayLabels",bx="Stdlib__Bigarray",cB="Js_of_ocaml__IntersectionObserver",W=115,d0=122,d1="Stdlib",d2="Stdlib__StringLabels",U="Stdlib__Atomic",T="Sx_cst",S="Stdlib__ListLabels",cy="Stdlib__Seq",dX="Js_of_ocaml__CSS",cv="Js_of_ocaml__XmlHttpRequest",P="Stdlib__Uchar",cu="Stdlib__Arg",ct="Js_of_ocaml__Form",cs="Stdlib__Scanf",dU=112,dS="Js_of_ocaml__Intl",br=107,bq="Stdlib__Printexc",L="Js_of_ocaml__Sys_js",dO="Js_of_ocaml__Import",cp="Js_of_ocaml__Geolocation",K="Js_of_ocaml__Worker",bl="Stdlib__Dynarray",dL="Assert_failure",bh=121,bi=118,bg=120,cn="Stdlib__Array",I="Js_of_ocaml__EventSource",cm="Stdlib__Obj",dI="Stdlib__Hashtbl",dG="Stdlib__Domain",dH="Stdlib__Option",dF="Std_exit",cl="Sx_ref",cj="Invalid_argument",ck="Stack_overflow",ch="End_of_file",cg="Js_of_ocaml__WebGL",dB="Sx_types",dA="Failure",A="Js_of_ocaml__Jstable",dx="Stdlib__Lazy",bd="Stdlib__Semaphore",cf="Out_of_memory",z="Js_of_ocaml__Lib_version",y="Js_of_ocaml__Regexp",ce="Js_of_ocaml__Dom",x="Stdlib__Bytes",bc="Stdlib__Sys",dv="CamlinternalOO",cc="Stdlib__Int32",du="Stdlib__Oo",bb=123,ds=119,dt="Stdlib__Mutex",ba="Stdlib__List",a_="Sx_parser",dq="Stdlib__Float",b$="CamlinternalFormat",dm="Js_of_ocaml__Typed_array",b_="Stdlib__Result";c.symbols=[0,[0,bQ,11],[0,c1,10],[0,cP,9],[0,a1,85],[0,dB,79],[0,ef,83],[0,aI,86],[0,cl,84],[0,bE,82],[0,a_,81],[0,T,80],[0,aE,87],[0,cH,62],[0,eB,31],[0,P,26],[0,b9,17],[0,bc,15],[0,d2,75],[0,aZ,30],[0,d6,77],[0,en,42],[0,bK,40],[0,cy,21],[0,bd,47],[0,cs,64],[0,b_,23],[0,au,60],[0,bL,43],[0,c6,50],[0,bq,53],[0,dd,39],[0,dg,57],[0,dH,22],[0,du,67],[0,cm,16],[0,az,37],[0,dt,45],[0,c2,76],[0,at,32],[0,b3,41],[0,S,73],[0,ba,27],[0,aL,38],[0,dx,20],[0,cF,36],[0,cc,35],[0,c4,28],[0,aS,56],[0,dI,61],[0,a5,55],[0,d$,54],[0,cG,63],[0,dq,34],[0,c_,70],[0,bD,69],[0,bV,14],[0,a0,78],[0,bl,51],[0,dG,48],[0,eq,58],[0,c$,46],[0,cW,71],[0,d_,25],[0,c7,65],[0,aV,74],[0,x,29],[0,eF,44],[0,aK,24],[0,bx,59],[0,U,18],[0,ae,72],[0,cn,33],[0,cu,52],[0,d1,13],[0,dF,bb],[0,ck,8],[0,cf,7],[0,c9,6],[0,eE,5],[0,b4,89],[0,aB,88],[0,cU,90],[0,cv,99],[0,K,aG],[0,ay,cZ],[0,cg,a8],[0,am,bX],[0,dm,95],[0,L,as],[0,eg,br],[0,y,aH],[0,bM,b1],[0,bT,bU],[0,z,bz],[0,A,eo],[0,bR,es],[0,an,93],[0,dS,bg],[0,cB,ds],[0,dO,92],[0,cp,bi],[0,ct,98],[0,em,96],[0,I,aO],[0,bY,bB],[0,df,W],[0,by,97],[0,bP,b8],[0,ce,94],[0,aq,av],[0,dX,dU],[0,et,91],[0,ee,bh],[0,cj,4],[0,dA,3],[0,ch,2],[0,cI,d0],[0,bZ,1],[0,dv,66],[0,ap,68],[0,aR,19],[0,d7,12],[0,b$,49],[0,dL,0]];c.sections=[0,[0,124,[0,[0,[0,[0,[0,[0,[0,0,[0,dL],0,[0,0,[0,b$],49,0,1],2],[0,d7],12,0,3],[0,aR],19,[0,[0,[0,0,[0,ap],68,0,1],[0,dv],66,0,2],[0,bZ],1,[0,[0,0,[0,cI],d0,0,1],[0,ch],2,0,2],3],4],[0,dA],3,[0,[0,[0,0,[0,cj],4,[0,0,[0,ee],bh,0,1],2],[0,et],91,[0,0,[0,dX],dU,[0,0,[0,aq],av,0,1],2],3],[0,ce],94,[0,[0,[0,0,[0,bP],b8,0,1],[0,by],97,0,2],[0,df],W,[0,[0,0,[0,bY],bB,[0,0,[0,I],aO,0,1],2],[0,em],96,[0,0,[0,ct],98,[0,0,[0,cp],bi,0,1],2],3],4],5],6],[0,dO],92,[0,[0,[0,[0,[0,0,[0,cB],ds,[0,0,[0,dS],bg,0,1],2],[0,an],93,[0,[0,0,[0,bR],es,0,1],[0,A],eo,0,2],3],[0,z],bz,[0,[0,0,[0,bT],bU,0,1],[0,bM],b1,0,2],4],[0,y],aH,[0,[0,0,[0,eg],br,0,1],[0,L],as,0,2],5],[0,dm],95,[0,[0,[0,[0,[0,0,[0,am],bX,0,1],[0,cg],a8,0,2],[0,ay],cZ,0,3],[0,K],aG,[0,0,[0,cv],99,0,1],4],[0,cU],90,[0,[0,0,[0,aB],88,[0,0,[0,b4],89,0,1],2],[0,eE],5,[0,[0,0,[0,c9],6,0,1],[0,cf],7,[0,0,[0,ck],8,[0,0,[0,dF],bb,0,1],2],3],4],5],6],7],[0,d1],13,[0,[0,[0,[0,0,[0,cu],52,0,1],[0,cn],33,[0,0,[0,ae],72,0,1],2],[0,U],18,[0,0,[0,bx],59,0,1],3],[0,aK],24,[0,[0,[0,0,[0,eF],44,0,1],[0,x],29,[0,[0,0,[0,aV],74,0,1],[0,c7],65,0,2],3],[0,d_],25,[0,[0,0,[0,cW],71,0,1],[0,c$],46,[0,[0,0,[0,eq],58,0,1],[0,dG],48,[0,0,[0,bl],51,[0,0,[0,a0],78,0,1],2],3],4],5],6],8],[0,bV],14,[0,[0,[0,[0,[0,[0,0,[0,bD],69,[0,0,[0,c_],70,0,1],2],[0,dq],34,[0,0,[0,cG],63,0,1],3],[0,d$],54,[0,0,[0,a5],55,[0,[0,0,[0,dI],61,0,1],[0,aS],56,0,2],3],4],[0,c4],28,[0,0,[0,cc],35,[0,0,[0,cF],36,0,1],2],5],[0,dx],20,[0,[0,[0,0,[0,aL],38,0,1],[0,ba],27,[0,[0,0,[0,S],73,0,1],[0,b3],41,0,2],3],[0,at],32,[0,[0,[0,0,[0,c2],76,0,1],[0,dt],45,0,2],[0,az],37,0,3],4],6],[0,cm],16,[0,[0,[0,[0,[0,[0,0,[0,du],67,0,1],[0,dH],22,[0,0,[0,dg],57,0,1],2],[0,dd],39,[0,[0,0,[0,bq],53,0,1],[0,c6],50,0,2],3],[0,bL],43,[0,[0,0,[0,au],60,0,1],[0,b_],23,[0,[0,0,[0,cs],64,0,1],[0,bd],47,0,2],3],4],[0,cy],21,[0,[0,0,[0,bK],40,[0,0,[0,en],42,[0,0,[0,d6],77,0,1],2],3],[0,aZ],30,[0,0,[0,d2],75,0,1],4],5],[0,bc],15,[0,[0,[0,[0,0,[0,b9],17,0,1],[0,P],26,[0,0,[0,eB],31,0,1],2],[0,cH],62,[0,[0,0,[0,aE],87,0,1],[0,T],80,0,2],3],[0,a_],81,[0,[0,[0,0,[0,bE],82,[0,0,[0,cl],84,[0,0,[0,aI],86,0,1],2],3],[0,ef],83,[0,0,[0,dB],79,[0,0,[0,a1],85,0,1],2],4],[0,cP],9,[0,0,[0,c1],10,[0,0,[0,bQ],11,0,1],2],5],6],7],8],9]],0,i.caml_list_of_js_array(["%caml_format_int_special","%direct_int_div","%direct_int_mod","%direct_int_mul","%direct_obj_tag","%int_add","%int_and","%int_asr",dn,"%int_lsl","%int_lsr",_,ar,"%int_neg","%int_or","%int_sub","%int_xor","JsStringReader","MlBytes","MlChanid","MlFakeDevice","MlFakeFd","MlFakeFd_out","MlFakeFile","MlFile","MlInt64","MlMutex","MlNat","MlNodeDevice","MlNodeFd","MlObjectTable","Ml_Bigarray","Ml_Bigarray_c_1_1","UInt8ArrayReader","add_nat","bigstring_of_array_buffer","bigstring_of_typed_array","bigstring_to_array_buffer","bigstring_to_typed_array","blake2b","blit_nat","caml_MD5Final","caml_MD5Init","caml_MD5Transform","caml_MD5Update","caml_abs_float","caml_acos_float","caml_acosh_float","caml_add_float","caml_alloc_dummy","caml_alloc_dummy_float","caml_alloc_dummy_infix","caml_alloc_stack","caml_argv","caml_array_append","caml_array_blit","caml_array_bound_error","caml_array_concat","caml_array_fill",e,G,ep,"caml_array_make","caml_array_of_bytes","caml_array_of_string",h,ec,bs,"caml_array_sub","caml_array_unsafe_get","caml_array_unsafe_get_float","caml_array_unsafe_set","caml_array_unsafe_set_addr","caml_array_unsafe_set_float","caml_asin_float","caml_asinh_float","caml_atan2_float","caml_atan_float","caml_atanh_float","caml_atomic_cas","caml_atomic_exchange","caml_atomic_fetch_add","caml_atomic_load","caml_atomic_make_contended","caml_ba_blit","caml_ba_change_layout","caml_ba_compare","caml_ba_create","caml_ba_create_buffer","caml_ba_create_from","caml_ba_create_unsafe","caml_ba_custom_name","caml_ba_deserialize","caml_ba_dim","caml_ba_dim_1","caml_ba_dim_2","caml_ba_dim_3","caml_ba_fill","caml_ba_from_typed_array","caml_ba_get_1","caml_ba_get_2","caml_ba_get_3","caml_ba_get_generic","caml_ba_get_size","caml_ba_get_size_per_element","caml_ba_hash","caml_ba_init","caml_ba_kind","caml_ba_kind_of_typed_array","caml_ba_layout","caml_ba_map_file","caml_ba_map_file_bytecode","caml_ba_num_dims","caml_ba_reshape","caml_ba_serialize","caml_ba_set_1","caml_ba_set_2","caml_ba_set_3","caml_ba_set_generic","caml_ba_slice","caml_ba_sub","caml_ba_to_typed_array","caml_ba_uint8_get16","caml_ba_uint8_get32","caml_ba_uint8_get64","caml_ba_uint8_set16","caml_ba_uint8_set32","caml_ba_uint8_set64","caml_backtrace_status","caml_bigstring_blit_ba_to_ba","caml_bigstring_blit_ba_to_bytes","caml_bigstring_blit_bytes_to_ba","caml_bigstring_blit_string_to_ba","caml_bigstring_memcmp","caml_blake2_create","caml_blake2_final","caml_blake2_string","caml_blake2_update","caml_blit_bytes","caml_blit_string","caml_bswap16","caml_build_symbols","caml_bytes_bound_error","caml_bytes_compare","caml_bytes_equal","caml_bytes_get","caml_bytes_get16","caml_bytes_get32","caml_bytes_get64","caml_bytes_greaterequal","caml_bytes_greaterthan","caml_bytes_lessequal","caml_bytes_lessthan","caml_bytes_notequal","caml_bytes_of_array","caml_bytes_of_jsbytes","caml_bytes_of_string","caml_bytes_of_uint8_array","caml_bytes_of_utf16_jsstring","caml_bytes_set","caml_bytes_set16","caml_bytes_set32","caml_bytes_set64","caml_bytes_unsafe_get","caml_bytes_unsafe_set","caml_call_gen","caml_callback","caml_cbrt_float","caml_ceil_float",H,o,cq,bW,"caml_classify_float","caml_compare","caml_compare_val","caml_compare_val_get_custom","caml_compare_val_number_custom","caml_compare_val_tag","caml_continuation_use_and_update_handler_noexc","caml_continuation_use_noexc","caml_convert_bytes_to_array","caml_convert_raw_backtrace","caml_convert_raw_backtrace_slot","caml_convert_string_to_bytes","caml_copysign_float","caml_cos_float","caml_cosh_float","caml_create_bytes","caml_create_file","caml_create_string","caml_current_dir","caml_custom_event_index","caml_custom_identifier","caml_custom_ops","caml_decompress_input",g,"caml_div_float","caml_domain_dls","caml_domain_dls_compare_and_set","caml_domain_dls_get","caml_domain_dls_set","caml_domain_id","caml_domain_spawn","caml_ephe_blit_data",bG,"caml_ephe_check_data",cw,"caml_ephe_create","caml_ephe_data_offset","caml_ephe_get_data","caml_ephe_get_data_copy",Z,dV,"caml_ephe_key_offset","caml_ephe_none","caml_ephe_set_data","caml_ephe_set_data_opt","caml_ephe_set_key","caml_ephe_unset_data","caml_ephe_unset_key","caml_eq_float","caml_equal","caml_erf_float","caml_erfc_float","caml_executable_name","caml_exn_with_js_backtrace","caml_exp2_float","caml_exp_float","caml_expm1_float","caml_failwith","caml_fatal_uncaught_exception",a4,N,"caml_final_register","caml_final_register_called_without_value","caml_final_release","caml_finish_formatting","caml_float_compare","caml_float_of_bytes","caml_float_of_int","caml_float_of_string","caml_floatarray_blit","caml_floatarray_create",dr,eD,"caml_floatarray_unsafe_get","caml_floatarray_unsafe_set","caml_floor_float","caml_fma_float","caml_fmod_float","caml_format_exception","caml_format_float",p,"caml_fresh_oo_id","caml_frexp_float","caml_fs_init","caml_gc_compaction","caml_gc_counters","caml_gc_full_major","caml_gc_get","caml_gc_major","caml_gc_major_slice","caml_gc_minor","caml_gc_minor_words","caml_gc_quick_stat","caml_gc_set","caml_gc_stat","caml_ge_float","caml_get_cached_method","caml_get_continuation_callstack","caml_get_current_callstack","caml_get_exception_backtrace","caml_get_exception_raw_backtrace","caml_get_global_data","caml_get_minor_free","caml_get_public_method","caml_get_root","caml_global_data","caml_gr_arc_aux","caml_gr_blit_image","caml_gr_clear_graph","caml_gr_close_graph","caml_gr_close_subwindow","caml_gr_create_image","caml_gr_current_x","caml_gr_current_y","caml_gr_display_mode","caml_gr_doc_of_state","caml_gr_draw_arc","caml_gr_draw_char","caml_gr_draw_image","caml_gr_draw_rect","caml_gr_draw_str","caml_gr_draw_string","caml_gr_dump_image","caml_gr_fill_arc","caml_gr_fill_poly","caml_gr_fill_rect","caml_gr_lineto","caml_gr_make_image","caml_gr_moveto","caml_gr_open_graph","caml_gr_open_subwindow","caml_gr_plot","caml_gr_point_color","caml_gr_remember_mode","caml_gr_resize_window","caml_gr_set_color","caml_gr_set_font","caml_gr_set_line_width","caml_gr_set_text_size","caml_gr_set_window_title","caml_gr_sigio_handler","caml_gr_sigio_signal","caml_gr_size_x","caml_gr_size_y","caml_gr_state","caml_gr_state_create","caml_gr_state_get","caml_gr_state_init","caml_gr_state_set","caml_gr_synchronize","caml_gr_text_size","caml_gr_wait_event","caml_gr_window_id","caml_greaterequal","caml_greaterthan","caml_gt_float","caml_hash","caml_hash_mix_bigstring","caml_hash_mix_bytes","caml_hash_mix_bytes_arr","caml_hash_mix_final","caml_hash_mix_float","caml_hash_mix_float16","caml_hash_mix_float32","caml_hash_mix_int","caml_hash_mix_int64","caml_hash_mix_jsbytes","caml_hash_mix_string","caml_hash_nat","caml_hexstring_of_float","caml_hypot_float","caml_input_value","caml_input_value_from_bytes","caml_input_value_from_reader","caml_input_value_to_outside_heap","caml_install_signal_handler","caml_int32_add","caml_int32_and","caml_int32_bits_of_float",d4,ah,F,"caml_int32_float_of_bits",cO,Q,X,"caml_int32_neg","caml_int32_of_float","caml_int32_of_int",cd,"caml_int32_or","caml_int32_shift_left","caml_int32_shift_right","caml_int32_shift_right_unsigned","caml_int32_sub","caml_int32_to_float","caml_int32_to_int","caml_int32_unmarshal","caml_int32_xor","caml_int64_add","caml_int64_and","caml_int64_bits_of_float","caml_int64_bswap","caml_int64_compare","caml_int64_create_lo_hi","caml_int64_create_lo_mi_hi","caml_int64_div","caml_int64_float_of_bits","caml_int64_format","caml_int64_hash","caml_int64_hi32","caml_int64_is_negative","caml_int64_is_zero","caml_int64_lo32","caml_int64_marshal","caml_int64_mod","caml_int64_mul","caml_int64_neg","caml_int64_of_bytes","caml_int64_of_float",cr,q,a7,"caml_int64_of_string","caml_int64_offset","caml_int64_or","caml_int64_shift_left","caml_int64_shift_right","caml_int64_shift_right_unsigned","caml_int64_sub","caml_int64_to_bytes","caml_int64_to_float",eu,s,dN,"caml_int64_ult","caml_int64_unmarshal","caml_int64_xor",t,"caml_int_of_float",m,"caml_invalid_argument","caml_io_buffer_size","caml_is_continuation_tag","caml_is_js","caml_is_ml_bytes","caml_is_ml_string","caml_is_printable","caml_is_special_exception","caml_js_call","caml_js_delete","caml_js_equals","caml_js_error_of_exception","caml_js_error_option_of_exception","caml_js_eval_string","caml_js_expr","caml_js_from_array","caml_js_from_bool",n,ev,b0,"caml_js_from_string","caml_js_fun_call","caml_js_function_arity","caml_js_get","caml_js_get_console","caml_js_html_entities","caml_js_html_escape","caml_js_instanceof","caml_js_meth_call","caml_js_new","caml_js_object","caml_js_pure_expr","caml_js_set","caml_js_strict_equals","caml_js_to_array","caml_js_to_bool","caml_js_to_byte_string","caml_js_to_float",eh,dC,"caml_js_to_string","caml_js_typeof","caml_js_var","caml_js_wrap_callback","caml_js_wrap_callback_arguments","caml_js_wrap_callback_strict","caml_js_wrap_callback_unsafe","caml_js_wrap_meth_callback","caml_js_wrap_meth_callback_arguments","caml_js_wrap_meth_callback_strict","caml_js_wrap_meth_callback_unsafe","caml_jsbytes_of_string","caml_jsoo_flags_effects","caml_jsoo_flags_use_js_string","caml_jsstring_of_string","caml_lazy_make_forward","caml_lazy_read_result","caml_lazy_reset_to_lazy","caml_lazy_update_to_forcing","caml_lazy_update_to_forward","caml_ldexp_float","caml_le_float","caml_lessequal","caml_lessthan","caml_lex_array","caml_lex_engine","caml_list_mount_point","caml_list_of_js_array","caml_list_to_js_array","caml_log10_float","caml_log1p_float","caml_log2_float","caml_log_float","caml_lt_float","caml_lxm_M","caml_lxm_daba","caml_lxm_next","caml_make_float_vect","caml_make_path","caml_make_vect","caml_marshal_constants","caml_marshal_data_size","caml_marshal_header_size","caml_maybe_attach_backtrace","caml_maybe_print_stats","caml_md5_bytes","caml_md5_chan","caml_md5_string","caml_memprof_discard","caml_memprof_start","caml_memprof_stop","caml_method_cache","caml_ml_bytes_content","caml_ml_bytes_length","caml_ml_channel_get","caml_ml_channel_redirect","caml_ml_channel_restore","caml_ml_channel_size","caml_ml_channel_size_64","caml_ml_channels","caml_ml_close_channel","caml_ml_condition_broadcast","caml_ml_condition_new","caml_ml_condition_signal","caml_ml_condition_wait","caml_ml_debug_info_status","caml_ml_domain_cpu_relax","caml_ml_domain_id","caml_ml_enable_runtime_warnings","caml_ml_flush","caml_ml_input","caml_ml_input_bigarray","caml_ml_input_block","caml_ml_input_char","caml_ml_input_int","caml_ml_input_scan_line","caml_ml_is_binary_mode","caml_ml_is_buffered","caml_ml_mutex_lock","caml_ml_mutex_new","caml_ml_mutex_try_lock","caml_ml_mutex_unlock","caml_ml_open_descriptor_in","caml_ml_open_descriptor_in_with_flags","caml_ml_open_descriptor_out","caml_ml_open_descriptor_out_with_flags","caml_ml_out_channels_list","caml_ml_output","caml_ml_output_bigarray","caml_ml_output_bytes","caml_ml_output_char","caml_ml_output_int","caml_ml_output_ta","caml_ml_pos_in","caml_ml_pos_in_64","caml_ml_pos_out","caml_ml_pos_out_64","caml_ml_runtime_events_are_active","caml_ml_runtime_events_pause","caml_ml_runtime_events_resume","caml_ml_runtime_events_start","caml_ml_runtime_warnings_enabled","caml_ml_seek_in","caml_ml_seek_in_64","caml_ml_seek_out","caml_ml_seek_out_64","caml_ml_set_binary_mode","caml_ml_set_buffered","caml_ml_set_channel_name","caml_ml_set_channel_output","caml_ml_set_channel_refill","caml_ml_string_length",f,"caml_modf_float","caml_mount_autoload",d,"caml_mul_float","caml_named_value","caml_named_values","caml_nativeint_add","caml_nativeint_and",bu,cz,a9,eG,dw,R,"caml_nativeint_neg","caml_nativeint_of_float","caml_nativeint_of_int","caml_nativeint_of_int32",cT,"caml_nativeint_or","caml_nativeint_shift_left","caml_nativeint_shift_right","caml_nativeint_shift_right_unsigned","caml_nativeint_sub","caml_nativeint_to_float","caml_nativeint_to_int","caml_nativeint_to_int32","caml_nativeint_unmarshal","caml_nativeint_xor","caml_neg_float","caml_neq_float","caml_new_lex_engine","caml_new_string","caml_nextafter_float","caml_notequal","caml_obj_add_offset","caml_obj_block","caml_obj_compare_and_swap","caml_obj_dup","caml_obj_is_shared","caml_obj_raw_field","caml_obj_reachable_words","caml_obj_set_raw_field","caml_obj_tag","caml_obj_update_tag","caml_obj_with_tag","caml_ojs_new_arr","caml_oo_cache_id","caml_oo_last_id","caml_output_val","caml_output_value","caml_output_value_to_buffer","caml_output_value_to_bytes","caml_output_value_to_string","caml_packFloat16","caml_parse_digit","caml_parse_engine","caml_parse_format","caml_parse_sign_and_base","caml_parser_trace","caml_pos_in","caml_pos_out","caml_power_float","caml_pure_js_expr","caml_raise_constant","caml_raise_end_of_file","caml_raise_no_such_file","caml_raise_nodejs_error","caml_raise_not_found","caml_raise_sys_error","caml_raise_system_error","caml_raise_with_arg","caml_raise_with_args","caml_raise_with_string","caml_raise_zero_divide","caml_raw_backtrace_length","caml_raw_backtrace_next_slot","caml_raw_backtrace_slot","caml_read_file_content","caml_recommended_domain_count","caml_record_backtrace","caml_record_backtrace_env_flag","caml_record_backtrace_runtime_flag","caml_refill","caml_register_global","caml_register_named_value","caml_restore_raw_backtrace","caml_root","caml_round_float","caml_runtime_events_create_cursor","caml_runtime_events_free_cursor","caml_runtime_events_read_poll","caml_runtime_events_user_register","caml_runtime_events_user_resolve","caml_runtime_events_user_write","caml_runtime_parameters","caml_runtime_variant","caml_runtime_warnings","caml_seek_in","caml_seek_out","caml_set_oo_id","caml_set_parser_trace","caml_set_static_env",dp,aQ,"caml_sin_float","caml_sinh_float","caml_sqrt_float","caml_str_repeat","caml_strerror","caml_string_bound_error","caml_string_compare","caml_string_concat","caml_string_equal","caml_string_get","caml_string_get16","caml_string_get32","caml_string_get64","caml_string_greaterequal","caml_string_greaterthan","caml_string_hash","caml_string_lessequal","caml_string_lessthan","caml_string_notequal","caml_string_of_array","caml_string_of_bytes","caml_string_of_jsbytes","caml_string_of_jsstring","caml_string_of_uint8_array","caml_string_set","caml_string_unsafe_get","caml_sub_float","caml_sub_uint8_array_to_jsbytes","caml_subarray_to_jsbytes","caml_sys_argv","caml_sys_chdir","caml_sys_close","caml_sys_const_backend_type","caml_sys_const_big_endian","caml_sys_const_int_size","caml_sys_const_max_wosize","caml_sys_const_naked_pointers_checked","caml_sys_const_ostype_cygwin","caml_sys_const_ostype_unix","caml_sys_const_ostype_win32","caml_sys_const_word_size","caml_sys_executable_name",j,"caml_sys_fds","caml_sys_file_exists","caml_sys_get_argv","caml_sys_get_config",k,"caml_sys_getenv","caml_sys_is_directory","caml_sys_is_regular_file","caml_sys_isatty","caml_sys_mkdir","caml_sys_modify_argv","caml_sys_open","caml_sys_open_for_node","caml_sys_random_seed","caml_sys_read_directory","caml_sys_remove","caml_sys_rename","caml_sys_rmdir","caml_sys_system_command","caml_sys_time","caml_sys_time_include_children","caml_sys_unsafe_getenv","caml_tan_float","caml_tanh_float","caml_throw_js_exception","caml_to_js_string","caml_trailing_slash","caml_trampoline","caml_trampoline_return","caml_trunc_float","caml_uint8_array_of_bytes","caml_uint8_array_of_string",cD,cE,ez,bj,ew,dh,c3,cV,ak,bp,er,ci,db,c0,J,V,dP,cR,b6,aT,bN,ex,bo,a6,b,ek,bw,aC,aP,al,l,cL,cA,d9,cM,ey,aW,aF,dE,ac,ag,Y,a$,da,r,ca,dT,cQ,eC,dz,D,ad,ax,dQ,dj,dl,ea,a2,bH,b7,E,c5,cX,b2,di,"caml_unmount","caml_unpackFloat16","caml_update_dummy",ed,cK,"caml_weak_create",af,aU,"caml_weak_set","caml_wrap_exception","caml_xdg_defaults","caml_xmlhttprequest_create","caml_zstd_initialize","compare_digits_nat","compare_nat","complement_nat","create_nat","decr_nat","deserialize_nat","div_digit_nat","div_helper","div_nat","fs_node_supported","incr_nat","initialize_nat","is_digit_int","is_digit_normalized","is_digit_odd","is_digit_zero","jsoo_create_file","jsoo_create_file_extern","jsoo_dataview","jsoo_effect_not_supported","jsoo_is_ascii","jsoo_is_win32","jsoo_mount_point","jsoo_static_env","jsoo_sys_getenv","jsoo_text_decoder","jsoo_text_decoder_buff","jsoo_text_encoder","jsoo_toplevel_reloc","land_digit_nat","length_nat","lor_digit_nat","lxor_digit_nat","make_unix_err_args","mult_digit_nat","mult_nat","nat_of_array","nth_digit_nat","nth_digit_nat_native","num_digits_nat","num_leading_zero_bits_in_digit","ocaml_stats_from_node_stats","os_type","path_is_absolute","re_match","re_partial_match","re_replacement_text","re_search_backward","re_search_forward","re_string_match","resolve_fs_device","serialize_nat","set_digit_nat","set_digit_nat_native","set_to_zero_nat","shift_left_nat","shift_right_nat","square_nat","sub_nat",aY,d8,dD,cS,$,"unix_error",a3,ei,u,bC,dM,aX,eb,ej,dK,cC,bJ,aJ,ai,M,bI,el,B,O,bk,C,aD,ab,aA,c8,aj,dk,bf,de,cY,bS,cJ,eA,dW,ao,aN,cb,dJ,d3,dc,aM,w,dY,bv,bt,bA,bm,cN,co,cx,v,bn,aw,aa,be,bF,dR,dZ,dy,b5,bO,d5,"zstd_decompress"]),0];return}(globalThis)); //# 4 "../.js/default/stdlib/stdlib.cma.js" //# shape: CamlinternalFormatBasics:[F(2),F(1),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime; function erase_rel(param){ if(typeof param === "number") return 0; switch(param[0]){ case 0: var rest = param[1]; return [0, erase_rel(rest)]; case 1: var rest$0 = param[1]; return [1, erase_rel(rest$0)]; case 2: var rest$1 = param[1]; return [2, erase_rel(rest$1)]; case 3: var rest$2 = param[1]; return [3, erase_rel(rest$2)]; case 4: var rest$3 = param[1]; return [4, erase_rel(rest$3)]; case 5: var rest$4 = param[1]; return [5, erase_rel(rest$4)]; case 6: var rest$5 = param[1]; return [6, erase_rel(rest$5)]; case 7: var rest$6 = param[1]; return [7, erase_rel(rest$6)]; case 8: var rest$7 = param[2], ty = param[1]; return [8, ty, erase_rel(rest$7)]; case 9: var rest$8 = param[3], ty1 = param[1]; return [9, ty1, ty1, erase_rel(rest$8)]; case 10: var rest$9 = param[1]; return [10, erase_rel(rest$9)]; case 11: var rest$10 = param[1]; return [11, erase_rel(rest$10)]; case 12: var rest$11 = param[1]; return [12, erase_rel(rest$11)]; case 13: var rest$12 = param[1]; return [13, erase_rel(rest$12)]; default: var rest$13 = param[1]; return [14, erase_rel(rest$13)]; } } function concat_fmtty(fmtty1, fmtty2){ if(typeof fmtty1 === "number") return fmtty2; switch(fmtty1[0]){ case 0: var rest = fmtty1[1]; return [0, concat_fmtty(rest, fmtty2)]; case 1: var rest$0 = fmtty1[1]; return [1, concat_fmtty(rest$0, fmtty2)]; case 2: var rest$1 = fmtty1[1]; return [2, concat_fmtty(rest$1, fmtty2)]; case 3: var rest$2 = fmtty1[1]; return [3, concat_fmtty(rest$2, fmtty2)]; case 4: var rest$3 = fmtty1[1]; return [4, concat_fmtty(rest$3, fmtty2)]; case 5: var rest$4 = fmtty1[1]; return [5, concat_fmtty(rest$4, fmtty2)]; case 6: var rest$5 = fmtty1[1]; return [6, concat_fmtty(rest$5, fmtty2)]; case 7: var rest$6 = fmtty1[1]; return [7, concat_fmtty(rest$6, fmtty2)]; case 8: var rest$7 = fmtty1[2], ty = fmtty1[1]; return [8, ty, concat_fmtty(rest$7, fmtty2)]; case 9: var rest$8 = fmtty1[3], ty2 = fmtty1[2], ty1 = fmtty1[1]; return [9, ty1, ty2, concat_fmtty(rest$8, fmtty2)]; case 10: var rest$9 = fmtty1[1]; return [10, concat_fmtty(rest$9, fmtty2)]; case 11: var rest$10 = fmtty1[1]; return [11, concat_fmtty(rest$10, fmtty2)]; case 12: var rest$11 = fmtty1[1]; return [12, concat_fmtty(rest$11, fmtty2)]; case 13: var rest$12 = fmtty1[1]; return [13, concat_fmtty(rest$12, fmtty2)]; default: var rest$13 = fmtty1[1]; return [14, concat_fmtty(rest$13, fmtty2)]; } } function concat_fmt(fmt1, fmt2){ if(typeof fmt1 === "number") return fmt2; switch(fmt1[0]){ case 0: var rest = fmt1[1]; return [0, concat_fmt(rest, fmt2)]; case 1: var rest$0 = fmt1[1]; return [1, concat_fmt(rest$0, fmt2)]; case 2: var rest$1 = fmt1[2], pad = fmt1[1]; return [2, pad, concat_fmt(rest$1, fmt2)]; case 3: var rest$2 = fmt1[2], pad$0 = fmt1[1]; return [3, pad$0, concat_fmt(rest$2, fmt2)]; case 4: var rest$3 = fmt1[4], prec = fmt1[3], pad$1 = fmt1[2], iconv = fmt1[1]; return [4, iconv, pad$1, prec, concat_fmt(rest$3, fmt2)]; case 5: var rest$4 = fmt1[4], prec$0 = fmt1[3], pad$2 = fmt1[2], iconv$0 = fmt1[1]; return [5, iconv$0, pad$2, prec$0, concat_fmt(rest$4, fmt2)]; case 6: var rest$5 = fmt1[4], prec$1 = fmt1[3], pad$3 = fmt1[2], iconv$1 = fmt1[1]; return [6, iconv$1, pad$3, prec$1, concat_fmt(rest$5, fmt2)]; case 7: var rest$6 = fmt1[4], prec$2 = fmt1[3], pad$4 = fmt1[2], iconv$2 = fmt1[1]; return [7, iconv$2, pad$4, prec$2, concat_fmt(rest$6, fmt2)]; case 8: var rest$7 = fmt1[4], prec$3 = fmt1[3], pad$5 = fmt1[2], fconv = fmt1[1]; return [8, fconv, pad$5, prec$3, concat_fmt(rest$7, fmt2)]; case 9: var rest$8 = fmt1[2], pad$6 = fmt1[1]; return [9, pad$6, concat_fmt(rest$8, fmt2)]; case 10: var rest$9 = fmt1[1]; return [10, concat_fmt(rest$9, fmt2)]; case 11: var rest$10 = fmt1[2], str = fmt1[1]; return [11, str, concat_fmt(rest$10, fmt2)]; case 12: var rest$11 = fmt1[2], chr = fmt1[1]; return [12, chr, concat_fmt(rest$11, fmt2)]; case 13: var rest$12 = fmt1[3], fmtty = fmt1[2], pad$7 = fmt1[1]; return [13, pad$7, fmtty, concat_fmt(rest$12, fmt2)]; case 14: var rest$13 = fmt1[3], fmtty$0 = fmt1[2], pad$8 = fmt1[1]; return [14, pad$8, fmtty$0, concat_fmt(rest$13, fmt2)]; case 15: var rest$14 = fmt1[1]; return [15, concat_fmt(rest$14, fmt2)]; case 16: var rest$15 = fmt1[1]; return [16, concat_fmt(rest$15, fmt2)]; case 17: var rest$16 = fmt1[2], fmting_lit = fmt1[1]; return [17, fmting_lit, concat_fmt(rest$16, fmt2)]; case 18: var rest$17 = fmt1[2], fmting_gen = fmt1[1]; return [18, fmting_gen, concat_fmt(rest$17, fmt2)]; case 19: var rest$18 = fmt1[1]; return [19, concat_fmt(rest$18, fmt2)]; case 20: var rest$19 = fmt1[3], char_set = fmt1[2], width_opt = fmt1[1]; return [20, width_opt, char_set, concat_fmt(rest$19, fmt2)]; case 21: var rest$20 = fmt1[2], counter = fmt1[1]; return [21, counter, concat_fmt(rest$20, fmt2)]; case 22: var rest$21 = fmt1[1]; return [22, concat_fmt(rest$21, fmt2)]; case 23: var rest$22 = fmt1[2], ign = fmt1[1]; return [23, ign, concat_fmt(rest$22, fmt2)]; default: var rest$23 = fmt1[3], f = fmt1[2], arity = fmt1[1]; return [24, arity, f, concat_fmt(rest$23, fmt2)]; } } runtime.caml_register_global (0, [0, concat_fmtty, erase_rel, concat_fmt], "CamlinternalFormatBasics"); return; } (globalThis)); //# 179 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib:[F(1),F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,F(2),F(2),F(1)*,N,N,F(1)*,N,N,N,N,N,N,F(2)*,F(1),F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(1),F(2),N,N,N,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(1),F(1),F(2),F(2),F(2),F(4),F(4),F(2),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(3),F(1),F(1),F(4),F(4),F(2),F(1),F(1),F(1),F(2),F(1),F(1),F(1),F(1),F(2),N,F(1)*,F(2),F(1),F(1),F(1),F(4),F(1),N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_atomic_cas = runtime.caml_atomic_cas, caml_atomic_load = runtime.caml_atomic_load, caml_create_bytes = runtime.caml_create_bytes, caml_float_of_string = runtime.caml_float_of_string, caml_int_of_string = runtime.caml_int_of_string, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_bytes_length = runtime.caml_ml_bytes_length, caml_ml_channel_size = runtime.caml_ml_channel_size, caml_ml_channel_size_64 = runtime.caml_ml_channel_size_64, caml_ml_close_channel = runtime.caml_ml_close_channel, caml_ml_flush = runtime.caml_ml_flush, caml_ml_input = runtime.caml_ml_input, caml_ml_input_char = runtime.caml_ml_input_char, caml_ml_open_descriptor_in = runtime.caml_ml_open_descriptor_in, caml_ml_open_descriptor_out = runtime.caml_ml_open_descriptor_out, caml_ml_output = runtime.caml_ml_output, caml_ml_output_bytes = runtime.caml_ml_output_bytes, caml_ml_output_char = runtime.caml_ml_output_char, caml_ml_set_binary_mode = runtime.caml_ml_set_binary_mode, caml_ml_set_channel_name = runtime.caml_ml_set_channel_name, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_concat = runtime.caml_string_concat, caml_string_of_bytes = runtime.caml_string_of_bytes, caml_sys_open = runtime.caml_sys_open, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var global_data = runtime.caml_get_global_data(), CamlinternalFormatBasics = global_data.CamlinternalFormatBasics, Invalid_argument = global_data.Invalid_argument, Failure = global_data.Failure, Match_failure = global_data.Match_failure, Assert_failure = global_data.Assert_failure, Not_found = global_data.Not_found, Out_of_memory = global_data.Out_of_memory, Stack_overflow = global_data.Stack_overflow, Sys_error = global_data.Sys_error, End_of_file = global_data.End_of_file, Division_by_zero = global_data.Division_by_zero, Sys_blocked_io = global_data.Sys_blocked_io, Undefined_recursive_module = global_data.Undefined_recursive_module; function failwith(s){ throw caml_maybe_attach_backtrace([0, Failure, s], 1); } function invalid_arg(s){ throw caml_maybe_attach_backtrace([0, Invalid_argument, s], 1); } var Exit = [248, "Stdlib.Exit", runtime.caml_fresh_oo_id(0)]; function min(x, y){return runtime.caml_lessequal(x, y) ? x : y;} function max(x, y){return runtime.caml_greaterequal(x, y) ? x : y;} function abs(x){return 0 <= x ? x : - x | 0;} function lnot(x){return x ^ -1;} function char_of_int(n){ if(0 <= n && 255 >= n) return n; return invalid_arg("char_of_int"); } var cst_false = "false", cst_true = "true"; function string_of_bool(b){return b ? cst_true : cst_false;} function bool_of_string(param){ return param !== cst_false ? param !== cst_true ? invalid_arg("bool_of_string") : 1 : 0; } var a = [0, 1], b = [0, 0]; function bool_of_string_opt(param){ return param !== cst_false ? param !== cst_true ? 0 : a : b; } function string_of_int(n){return "" + n;} function int_of_string_opt(s){ try{var a = [0, caml_int_of_string(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] === Failure) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } function valid_float_lexem(s1){ var l = caml_ml_string_length(s1), i = 0; for(;;){ if(l <= i) return s1 + "."; var match = runtime.caml_string_get(s1, i); a: { if(48 <= match){if(58 <= match) break a;} else if(45 !== match) break a; var i$0 = i + 1 | 0; i = i$0; continue; } return s1; } } function string_of_float(f){ return valid_float_lexem(runtime.caml_format_float("%.12g", f)); } function float_of_string_opt(s){ try{var a = [0, caml_float_of_string(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] === Failure) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } function symbol(l1, l2){ if(! l1) return l2; var match = l1[2], h1 = l1[1]; if(! match) return [0, h1, l2]; var match$0 = match[2], h2 = match[1]; if(! match$0) return [0, h1, [0, h2, l2]]; var tl = match$0[2], h3 = match$0[1], block = [0, h3, 24029], dst = block, offset = 1, l1$0 = tl; for(;;){ if(l1$0){ var match$1 = l1$0[2], h1$0 = l1$0[1]; if(match$1){ var match$2 = match$1[2], h2$0 = match$1[1]; if(match$2){ var tl$0 = match$2[2], h3$0 = match$2[1], dst$0 = [0, h3$0, 24029]; dst[offset + 1] = [0, h1$0, [0, h2$0, dst$0]]; dst = dst$0; offset = 1; l1$0 = tl$0; continue; } dst[offset + 1] = [0, h1$0, [0, h2$0, l2]]; } else dst[offset + 1] = [0, h1$0, l2]; } else dst[offset + 1] = l2; return [0, h1, [0, h2, block]]; } } var stdin = caml_ml_open_descriptor_in(0), stdout = caml_ml_open_descriptor_out(1), stderr = caml_ml_open_descriptor_out(2); function open_out_gen(mode, perm, name){ var c = caml_ml_open_descriptor_out(caml_sys_open(name, mode, perm)); caml_ml_set_channel_name(c, name); return c; } var c = [0, 1, [0, 3, [0, 4, [0, 7, 0]]]]; function open_out(name){return open_out_gen(c, 438, name);} var d = [0, 1, [0, 3, [0, 4, [0, 6, 0]]]]; function open_out_bin(name){return open_out_gen(d, 438, name);} function flush_all(param){ var param$0 = runtime.caml_ml_out_channels_list(0); for(;;){ if(! param$0) return 0; var l = param$0[2], a = param$0[1]; try{caml_ml_flush(a); param$0 = l;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Sys_error) throw caml_maybe_attach_backtrace(exn, 0); param$0 = l; } } } function output_bytes(oc, s){ return caml_ml_output_bytes(oc, s, 0, caml_ml_bytes_length(s)); } function output_string(oc, s){ return caml_ml_output(oc, s, 0, caml_ml_string_length(s)); } function output(oc, s, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_bytes_length(s) - len | 0) >= ofs) return caml_ml_output_bytes(oc, s, ofs, len); return invalid_arg("output"); } function output_substring(oc, s, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_string_length(s) - len | 0) >= ofs) return caml_ml_output(oc, s, ofs, len); return invalid_arg("output_substring"); } function output_value(chan, v){ return runtime.caml_output_value(chan, v, 0); } function close_out(oc){ caml_ml_flush(oc); return caml_ml_close_channel(oc); } function close_out_noerr(oc){ try{caml_ml_flush(oc);}catch(exn){} try{var a = caml_ml_close_channel(oc); return a;}catch(exn){return 0;} } function open_in_gen(mode, perm, name){ var c = caml_ml_open_descriptor_in(caml_sys_open(name, mode, perm)); caml_ml_set_channel_name(c, name); return c; } var e = [0, 0, [0, 7, 0]]; function open_in(name){return open_in_gen(e, 0, name);} var f = [0, 0, [0, 6, 0]]; function open_in_bin(name){return open_in_gen(f, 0, name);} function input(ic, s, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_bytes_length(s) - len | 0) >= ofs) return caml_ml_input(ic, s, ofs, len); return invalid_arg("input"); } function unsafe_really_input(ic, s, ofs$1, len$1){ var ofs = ofs$1, len = len$1; for(;;){ if(0 >= len) return 0; var r = caml_ml_input(ic, s, ofs, len); if(0 === r) throw caml_maybe_attach_backtrace(End_of_file, 1); var len$0 = len - r | 0, ofs$0 = ofs + r | 0; ofs = ofs$0; len = len$0; } } function really_input(ic, s, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_bytes_length(s) - len | 0) >= ofs) return unsafe_really_input(ic, s, ofs, len); return invalid_arg("really_input"); } function really_input_string(ic, len){ var s = caml_create_bytes(len); really_input(ic, s, 0, len); return caml_string_of_bytes(s); } function input_line(chan){ function build_result(buf, pos$1, param$0){ var pos = pos$1, param = param$0; for(;;){ if(! param) return buf; var tl = param[2], hd = param[1], len = caml_ml_bytes_length(hd); runtime.caml_blit_bytes(hd, 0, buf, pos - len | 0, len); var pos$0 = pos - len | 0; pos = pos$0; param = tl; } } var accu = 0, len = 0; for(;;){ var n = runtime.caml_ml_input_scan_line(chan); if(0 === n){ if(! accu) throw caml_maybe_attach_backtrace(End_of_file, 1); var a = build_result(caml_create_bytes(len), len, accu); } else{ if(0 >= n){ var beg = caml_create_bytes(- n | 0); caml_ml_input(chan, beg, 0, - n | 0); var len$1 = len - n | 0, accu$0 = [0, beg, accu]; accu = accu$0; len = len$1; continue; } var res = caml_create_bytes(n - 1 | 0); caml_ml_input(chan, res, 0, n - 1 | 0); caml_ml_input_char(chan); if(accu) var len$0 = (len + n | 0) - 1 | 0, a = build_result(caml_create_bytes(len$0), len$0, [0, res, accu]); else var a = res; } return caml_string_of_bytes(a); } } function close_in_noerr(ic){ try{var a = caml_ml_close_channel(ic); return a;}catch(exn){return 0;} } function print_char(c){return caml_ml_output_char(stdout, c);} function print_string(s){return output_string(stdout, s);} function print_bytes(s){return output_bytes(stdout, s);} function print_int(i){return output_string(stdout, "" + i);} function print_float(f){return output_string(stdout, string_of_float(f));} function print_endline(s){ output_string(stdout, s); caml_ml_output_char(stdout, 10); return caml_ml_flush(stdout); } function print_newline(param){ caml_ml_output_char(stdout, 10); return caml_ml_flush(stdout); } function prerr_char(c){return caml_ml_output_char(stderr, c);} function prerr_string(s){return output_string(stderr, s);} function prerr_bytes(s){return output_bytes(stderr, s);} function prerr_int(i){return output_string(stderr, "" + i);} function prerr_float(f){return output_string(stderr, string_of_float(f));} function prerr_endline(s){ output_string(stderr, s); caml_ml_output_char(stderr, 10); return caml_ml_flush(stderr); } function prerr_newline(param){ caml_ml_output_char(stderr, 10); return caml_ml_flush(stderr); } function read_line(param){caml_ml_flush(stdout); return input_line(stdin);} function read_int(param){return caml_int_of_string(read_line(0));} function read_int_opt(param){return int_of_string_opt(read_line(0));} function read_float(param){return caml_float_of_string(read_line(0));} function read_float_opt(param){return float_of_string_opt(read_line(0));} function string_of_format(param){var str = param[2]; return str;} function symbol$0(a, param){ var str2 = param[2], fmt2 = param[1], str1 = a[2], fmt1 = a[1], s2 = "%," + str2; return [0, CamlinternalFormatBasics[3].call(null, fmt1, fmt2), str1 + s2]; } var exit_function = [0, flush_all]; function at_exit(f){ for(;;){ var old_exit = caml_atomic_load(exit_function); let f_yet_to_run = [0, 1], old_exit$0 = old_exit; var new_exit = function(param){ if(caml_atomic_cas(f_yet_to_run, 1, 0)) caml_call1(f, 0); return caml_call1(old_exit$0, 0); }, success = caml_atomic_cas(exit_function, old_exit, new_exit), a = 1 - success; if(! a) return a; } } var do_domain_local_at_exit = [0, function(param){return 0;}]; function do_at_exit(param){ caml_call1(do_domain_local_at_exit[1], 0); return caml_call1(caml_atomic_load(exit_function), 0); } function exit(retcode){ do_at_exit(0); return runtime.caml_sys_exit(retcode); } runtime.caml_register_named_value("Pervasives.do_at_exit", do_at_exit); var Stdlib = [0, invalid_arg, failwith, Exit, Match_failure, Assert_failure, Invalid_argument, Failure, Not_found, Out_of_memory, Stack_overflow, Sys_error, End_of_file, Division_by_zero, Sys_blocked_io, Undefined_recursive_module, min, max, abs, 2147483647, -2147483648, lnot, Infinity, -Infinity, NaN, 1.7976931348623157e+308, 2.2250738585072014e-308, 2.220446049250313e-16, caml_string_concat, char_of_int, string_of_bool, bool_of_string_opt, bool_of_string, string_of_int, int_of_string_opt, string_of_float, float_of_string_opt, symbol, stdin, stdout, stderr, print_char, print_string, print_bytes, print_int, print_float, print_endline, print_newline, prerr_char, prerr_string, prerr_bytes, prerr_int, prerr_float, prerr_endline, prerr_newline, read_line, read_int_opt, read_int, read_float_opt, read_float, open_out, open_out_bin, open_out_gen, caml_ml_flush, flush_all, caml_ml_output_char, output_string, output_bytes, output, output_substring, caml_ml_output_char, runtime.caml_ml_output_int, output_value, runtime.caml_ml_seek_out, runtime.caml_ml_pos_out, caml_ml_channel_size, close_out, close_out_noerr, caml_ml_set_binary_mode, open_in, open_in_bin, open_in_gen, caml_ml_input_char, input_line, input, really_input, really_input_string, caml_ml_input_char, runtime.caml_ml_input_int, runtime.caml_input_value, runtime.caml_ml_seek_in, runtime.caml_ml_pos_in, caml_ml_channel_size, caml_ml_close_channel, close_in_noerr, caml_ml_set_binary_mode, [0, runtime.caml_ml_seek_out_64, runtime.caml_ml_pos_out_64, caml_ml_channel_size_64, runtime.caml_ml_seek_in_64, runtime.caml_ml_pos_in_64, caml_ml_channel_size_64], string_of_format, symbol$0, exit, at_exit, valid_float_lexem, unsafe_really_input, do_at_exit, do_domain_local_at_exit]; runtime.caml_register_global(45, Stdlib, "Stdlib"); return; } (globalThis)); //# 743 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Sys:[N,F(1),N,N,[N],N,N,N,N,N,N,N,N,N,F(2)*,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)*,N,N,N,F(1),F(1),[F(2)*]] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_wrap_exception = runtime.caml_wrap_exception, Stdlib = runtime.caml_get_global_data().Stdlib, executable_name = runtime.caml_sys_executable_name(0), os_type = runtime.caml_sys_get_config(0)[1], unix = runtime.caml_sys_const_ostype_unix(0), win32 = runtime.caml_sys_const_ostype_win32(0), cygwin = runtime.caml_sys_const_ostype_cygwin(0), max_array_length = runtime.caml_sys_const_max_wosize(0), max_floatarray_length = max_array_length / 2 | 0, max_string_length = (4 * max_array_length | 0) - 1 | 0; function getenv_opt(s){ try{var a = [0, runtime.caml_sys_getenv(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } function set_signal(sig_num, sig_beh){return 0;} var Break = [248, "Stdlib.Sys.Break", runtime.caml_fresh_oo_id(0)]; function catch_break(on){return on ? 0 : 0;} function Make(Immediate, Non_immediate){return [0, 1];} var Stdlib_Sys = [0, executable_name, getenv_opt, [0, 0], os_type, [0, "js_of_ocaml"], unix, win32, cygwin, 32, 32, 0, max_string_length, max_array_length, max_floatarray_length, set_signal, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, Break, catch_break, "5.2.0", 0, [0, 5, 2, 0, 0], runtime.caml_ml_enable_runtime_warnings, runtime.caml_ml_runtime_warnings_enabled, [0, Make]]; runtime.caml_register_global(4, Stdlib_Sys, "Stdlib__Sys"); return; } (globalThis)); //# 833 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Obj:[F(1)*,F(2),F(3),N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,[F(1),F(1)*,F(1)*],N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_obj_tag = runtime.caml_obj_tag, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Sys = global_data.Stdlib__Sys; function is_block(a){return 1 - (typeof a === "number");} function double_field(x, i){return caml_check_bound(x, i)[i + 1];} function set_double_field(x, i, v){ caml_check_bound(x, i)[i + 1] = v; return 0; } function of_val(x){ var slot = is_block(x) ? caml_obj_tag(x) !== 248 ? 1 <= x.length - 1 ? x[1] : x : x : x, cst_Obj_extension_constructor = "Obj.extension_constructor"; a: { if(is_block(slot) && caml_obj_tag(slot) === 248){var name = slot[1]; break a;} var name = Stdlib[1].call(null, cst_Obj_extension_constructor); } return caml_obj_tag(name) === 252 ? slot : Stdlib[1].call(null, cst_Obj_extension_constructor); } function name(slot){return slot[1];} function id(slot){return slot[2];} var max_ephe_length = Stdlib_Sys[13] - 2 | 0; function create(l){ var a = 0 <= l, b = a ? l <= max_ephe_length : a; if(1 - b) Stdlib[1].call(null, "Obj.Ephemeron.create"); return runtime.caml_ephe_create(l); } function length(x){return x.length - 3 | 0;} function raise_if_invalid_offset(e, o, msg){ var a = 0 <= o, c = a ? o < length(e) : a, b = 1 - c; return b ? Stdlib[1].call(null, msg) : b; } function get_key(e, o){ raise_if_invalid_offset(e, o, "Obj.Ephemeron.get_key"); return runtime.caml_ephe_get_key(e, o); } function get_key_copy(e, o){ raise_if_invalid_offset(e, o, "Obj.Ephemeron.get_key_copy"); return runtime.caml_ephe_get_key_copy(e, o); } function set_key(e, o, x){ raise_if_invalid_offset(e, o, "Obj.Ephemeron.set_key"); return runtime.caml_ephe_set_key(e, o, x); } function unset_key(e, o){ raise_if_invalid_offset(e, o, "Obj.Ephemeron.unset_key"); return runtime.caml_ephe_unset_key(e, o); } function check_key(e, o){ raise_if_invalid_offset(e, o, "Obj.Ephemeron.check_key"); return runtime.caml_ephe_check_key(e, o); } function blit_key(e1, o1, e2, o2, l){ if (0 <= l && 0 <= o1 && (length(e1) - l | 0) >= o1 && 0 <= o2 && (length(e2) - l | 0) >= o2){ var a = 0 !== l ? 1 : 0, b = a ? runtime.caml_ephe_blit_key(e1, o1, e2, o2, l) : a; return b; } return Stdlib[1].call(null, "Obj.Ephemeron.blit_key"); } var Stdlib_Obj = [0, is_block, double_field, set_double_field, 0, 243, 244, 245, 246, 247, 248, 249, 250, 251, 251, 252, 253, 254, 255, 1000, 1001, 1002, [0, of_val, name, id], [0, create, length, get_key, get_key_copy, set_key, unset_key, check_key, blit_key, runtime.caml_ephe_get_data, runtime.caml_ephe_get_data_copy, runtime.caml_ephe_set_data, runtime.caml_ephe_unset_data, runtime.caml_ephe_check_data, runtime.caml_ephe_blit_data, max_ephe_length]]; runtime.caml_register_global(11, Stdlib_Obj, "Stdlib__Obj"); return; } (globalThis)); //# 984 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Atomic:[F(1)*,F(1),F(1),F(2),F(2),F(3),F(2),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_atomic_exchange = runtime.caml_atomic_exchange, caml_atomic_fetch_add = runtime.caml_atomic_fetch_add; function set(r, x){caml_atomic_exchange(r, x); return 0;} function incr(r){caml_atomic_fetch_add(r, 1); return 0;} function decr(r){caml_atomic_fetch_add(r, -1); return 0;} var Stdlib_Atomic = [0, function(a){return [0, a];}, runtime.caml_atomic_make_contended, runtime.caml_atomic_load, set, caml_atomic_exchange, runtime.caml_atomic_cas, caml_atomic_fetch_add, incr, decr]; runtime.caml_register_global(0, Stdlib_Atomic, "Stdlib__Atomic"); return; } (globalThis)); //# 1014 "../.js/default/stdlib/stdlib.cma.js" //# shape: CamlinternalLazy:[N,F(1),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_lazy_update_to_forward = runtime.caml_lazy_update_to_forward, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var Stdlib_Obj = runtime.caml_get_global_data().Stdlib__Obj, Undefined = [248, "CamlinternalLazy.Undefined", runtime.caml_fresh_oo_id(0)]; function force_gen_lazy_block(only_val, blk){ if(0 !== runtime.caml_lazy_update_to_forcing(blk)) throw caml_maybe_attach_backtrace(Undefined, 1); if(only_val){ var closure$0 = blk[1]; blk[1] = 0; var result$0 = caml_call1(closure$0, 0); blk[1] = result$0; caml_lazy_update_to_forward(blk); return result$0; } var closure = blk[1]; blk[1] = 0; try{ var result = caml_call1(closure, 0); blk[1] = result; caml_lazy_update_to_forward(blk); return result; } catch(e$0){ var e = caml_wrap_exception(e$0); blk[1] = function(param){throw caml_maybe_attach_backtrace(e, 0);}; runtime.caml_lazy_reset_to_lazy(blk); throw caml_maybe_attach_backtrace(e, 0); } } function force_lazy_block(blk){return force_gen_lazy_block(0, blk);} function force_gen(only_val, lzv){ var t = runtime.caml_obj_tag(lzv); if(t === Stdlib_Obj[12]) return lzv[1]; if(t === Stdlib_Obj[6]) throw caml_maybe_attach_backtrace(Undefined, 1); return t !== Stdlib_Obj[8] ? lzv : force_gen_lazy_block(only_val, lzv); } runtime.caml_register_global (2, [0, Undefined, force_lazy_block, force_gen], "CamlinternalLazy"); return; } (globalThis)); //# 1073 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Lazy:[N,F(2)*,F(1),F(1),F(2),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_obj_tag = runtime.caml_obj_tag; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var global_data = runtime.caml_get_global_data(), CamlinternalLazy = global_data.CamlinternalLazy, Stdlib_Obj = global_data.Stdlib__Obj, Undefined = CamlinternalLazy[1]; function force_val(l){return CamlinternalLazy[3].call(null, 1, l);} function from_fun(f){ var x = runtime.caml_obj_block(Stdlib_Obj[8], 1); x[1] = f; return x; } function from_val(v){ var t = caml_obj_tag(v); if (t !== Stdlib_Obj[12] && t !== Stdlib_Obj[8] && t !== Stdlib_Obj[6] && t !== Stdlib_Obj[16]) return v; return runtime.caml_lazy_make_forward(v); } function is_val(l){ var a = Stdlib_Obj[8]; return caml_obj_tag(l) !== a ? 1 : 0; } function map(f, x){ return [246, function(param){ var a = caml_obj_tag(x); a: if(250 === a) var b = x[1]; else{ if(246 !== a && 244 !== a){var b = x; break a;} var b = CamlinternalLazy[2].call(null, x); } return caml_call1(f, b); }]; } function map_val(f, x){ if(! is_val(x)) return [246, function(param){ var a = caml_obj_tag(x); a: if(250 === a) var b = x[1]; else{ if(246 !== a && 244 !== a){var b = x; break a;} var b = CamlinternalLazy[2].call(null, x); } return caml_call1(f, b); }]; var a = caml_obj_tag(x); a: if(250 === a) var b = x[1]; else{ if(246 !== a && 244 !== a){var b = x; break a;} var b = CamlinternalLazy[2].call(null, x); } return from_val(caml_call1(f, b)); } runtime.caml_register_global (2, [0, Undefined, map, is_val, from_val, map_val, from_fun, force_val], "Stdlib__Lazy"); return; } (globalThis)); //# 1154 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Seq:[F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(4),F(3),F(3),F(3),F(3),F(1)*,F(2)*,F(3)*,F(2),F(3),F(2)*,F(2),F(2),F(2)*->F(1)*,F(3),F(2)*->F(1),F(3),F(3),F(3)*->F(1)*,F(2),F(2),F(3),F(3),F(3),F(1)->F(1),N,F(1)*->F(1),F(2),F(3),F(2),F(3),F(3),F(3),F(4),F(3),F(4),F(2)*,F(3)*->F(1),F(1)*,F(1)*,F(2)*,F(2)*,F(1)*->F(1),F(1)*->F(1),F(2)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), Assert_failure = global_data.Assert_failure, Stdlib_Atomic = global_data.Stdlib__Atomic, CamlinternalLazy = global_data.CamlinternalLazy, Stdlib = global_data.Stdlib, Stdlib_Lazy = global_data.Stdlib__Lazy; function empty(param){return 0;} function return$(x, param){return [0, x, empty];} function cons(x, next, param){return [0, x, next];} function append(seq1, seq2, param){ var match = caml_call1(seq1, 0); if(! match) return caml_call1(seq2, 0); var next = match[2], x = match[1]; return [0, x, function(a){return append(next, seq2, a);}]; } function map(f, seq, param){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1]; return [0, caml_call1(f, x), function(a){return map(f, next, a);}]; } function filter_map(f, seq$0, param){ var seq = seq$0; for(;;){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1], match$0 = caml_call1(f, x); if(match$0) break; seq = next; } var y = match$0[1]; return [0, y, function(a){return filter_map(f, next, a);}]; } function filter(f, seq$0, param){ var seq = seq$0; for(;;){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1]; if(caml_call1(f, x)) break; seq = next; } return [0, x, function(a){return filter(f, next, a);}]; } function concat(seq, param){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1]; return append(x, function(a){return concat(next, a);}, 0); } function flat_map(f, seq, param){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1]; return append (caml_call1(f, x), function(a){return flat_map(f, next, a);}, 0); } function fold_left(f, acc$1, seq$0){ var acc = acc$1, seq = seq$0; for(;;){ var match = caml_call1(seq, 0); if(! match) return acc; var next = match[2], x = match[1], acc$0 = caml_call2(f, acc, x); acc = acc$0; seq = next; } } function iter(f, seq$0){ var seq = seq$0; for(;;){ var match = caml_call1(seq, 0); if(! match) return 0; var next = match[2], x = match[1]; caml_call1(f, x); seq = next; } } function unfold(f, u, param){ var match = caml_call1(f, u); if(! match) return 0; var match$0 = match[1], u$0 = match$0[2], x = match$0[1]; return [0, x, function(a){return unfold(f, u$0, a);}]; } function is_empty(xs){return caml_call1(xs, 0) ? 0 : 1;} function uncons(xs){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; return [0, [0, x, xs$0]]; } function length(xs$1){ var accu = 0, xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return accu; var xs$0 = match[2], accu$0 = accu + 1 | 0; accu = accu$0; xs = xs$0; } } function iteri(f, xs$1){ var i = 0, xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; caml_call2(f, i, x); var i$0 = i + 1 | 0; i = i$0; xs = xs$0; } } function fold_lefti(f, accu$1, xs$1){ var accu = accu$1, i = 0, xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return accu; var xs$0 = match[2], x = match[1], accu$0 = caml_call3(f, accu, i, x), i$0 = i + 1 | 0; accu = accu$0; i = i$0; xs = xs$0; } } function for_all(p, xs$1){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 1; var xs$0 = match[2], x = match[1], a = caml_call1(p, x); if(! a) return a; xs = xs$0; } } function exists(p, xs$1){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], a = caml_call1(p, x); if(a) return a; xs = xs$0; } } function find(p, xs$1){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; if(caml_call1(p, x)) return [0, x]; xs = xs$0; } } function find_index(p, xs){ var i = 0, xs$0 = xs; for(;;){ var match = caml_call1(xs$0, 0); if(! match) return 0; var xs$1 = match[2], x = match[1]; if(caml_call1(p, x)) return [0, i]; var i$0 = i + 1 | 0; i = i$0; xs$0 = xs$1; } } function find_map(f, xs$1){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], result = caml_call1(f, x); if(result) return result; xs = xs$0; } } function find_mapi(f, xs){ var i = 0, xs$0 = xs; for(;;){ var match = caml_call1(xs$0, 0); if(! match) return 0; var xs$1 = match[2], x = match[1], result = caml_call2(f, i, x); if(result) return result; var i$0 = i + 1 | 0; i = i$0; xs$0 = xs$1; } } function iter2(f, xs$1, ys$1){ var xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return 0; var ys$0 = match$0[2], y = match$0[1]; caml_call2(f, x, y); xs = xs$0; ys = ys$0; } } function fold_left2(f, accu$1, xs$1, ys$1){ var accu = accu$1, xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return accu; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return accu; var ys$0 = match$0[2], y = match$0[1], accu$0 = caml_call3(f, accu, x, y); accu = accu$0; xs = xs$0; ys = ys$0; } } function for_all2(f, xs$1, ys$1){ var xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 1; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return 1; var ys$0 = match$0[2], y = match$0[1], a = caml_call2(f, x, y); if(! a) return a; xs = xs$0; ys = ys$0; } } function exists2(f, xs$1, ys$1){ var xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return 0; var ys$0 = match$0[2], y = match$0[1], a = caml_call2(f, x, y); if(a) return a; xs = xs$0; ys = ys$0; } } function equal(eq, xs$1, ys$1){ var xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0), match$0 = caml_call1(ys, 0); if(match){ if(match$0){ var ys$0 = match$0[2], y = match$0[1], xs$0 = match[2], x = match[1], a = caml_call2(eq, x, y); if(! a) return a; xs = xs$0; ys = ys$0; continue; } } else if(! match$0) return 1; return 0; } } function compare(cmp, xs$1, ys$1){ var xs = xs$1, ys = ys$1; for(;;){ var match = caml_call1(xs, 0), match$0 = caml_call1(ys, 0); if(! match) return match$0 ? -1 : 0; var xs$0 = match[2], x = match[1]; if(! match$0) return 1; var ys$0 = match$0[2], y = match$0[1], c = caml_call2(cmp, x, y); if(0 !== c) return c; xs = xs$0; ys = ys$0; } } function init_aux(f, i, j, param){ if(i >= j) return 0; var a = i + 1 | 0; return [0, caml_call1(f, i), function(b){return init_aux(f, a, j, b);}]; } function init(n, f){ if(0 > n) return Stdlib[1].call(null, "Seq.init"); return function(a){return init_aux(f, 0, n, a);}; } function repeat(x, param){ return [0, x, function(a){return repeat(x, a);}]; } function forever(f, param){ return [0, caml_call1(f, 0), function(a){return forever(f, a);}]; } function cycle_nonempty(xs, param){ return append(xs, function(a){return cycle_nonempty(xs, a);}, 0); } function cycle(xs, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; function a(a){return cycle_nonempty(xs, a);} return [0, x, function(b){return append(xs$0, a, b);}]; } function iterate1(f, x, param){ var y = caml_call1(f, x); return [0, y, function(a){return iterate1(f, y, a);}]; } function iterate(f, x){ function next(a){return iterate1(f, x, a);} return function(param){return [0, x, next];}; } function mapi_aux(f, i, xs, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], a = i + 1 | 0; return [0, caml_call2(f, i, x), function(b){return mapi_aux(f, a, xs$0, b);}]; } function mapi(f, xs){return function(a){return mapi_aux(f, 0, xs, a);};} function tail_scan(f, s, xs, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], s$0 = caml_call2(f, s, x); return [0, s$0, function(a){return tail_scan(f, s$0, xs$0, a);}]; } function scan(f, s, xs){ function next(a){return tail_scan(f, s, xs, a);} return function(param){return [0, s, next];}; } function take_aux(n, xs){ return 0 === n ? empty : function (param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; return [0, x, take_aux(n - 1 | 0, xs$0)]; }; } function take(n, xs){ if(n < 0) Stdlib[1].call(null, "Seq.take"); return take_aux(n, xs); } function drop(n, xs){ return 0 <= n ? 0 === n ? xs : function (param){ var n$0 = n, xs$0 = xs; for(;;){ var match = caml_call1(xs$0, 0); if(! match) return 0; var xs$1 = match[2], n$1 = n$0 - 1 | 0; if(0 === n$1) return caml_call1(xs$1, 0); n$0 = n$1; xs$0 = xs$1; } } : Stdlib[1].call(null, "Seq.drop"); } function take_while(p, xs, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; return caml_call1(p, x) ? [0, x, function(a){return take_while(p, xs$0, a);}] : 0; } function drop_while(p, xs$1, param){ var xs = xs$1; for(;;){ var node = caml_call1(xs, 0); if(! node) return 0; var xs$0 = node[2], x = node[1]; if(! caml_call1(p, x)) return node; xs = xs$0; } } function group(eq, xs, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], a = caml_call1(eq, x); function b(b){return drop_while(a, xs$0, b);} var c = caml_call1(eq, x); function next(a){return take_while(c, xs$0, a);} return [0, function(param){return [0, x, next];}, function(a){return group(eq, b, a);}]; } var Forced_twice = [248, "Stdlib.Seq.Forced_twice", runtime.caml_fresh_oo_id(0)], to_lazy = Stdlib_Lazy[6]; function failure(param){ throw caml_maybe_attach_backtrace(Forced_twice, 1); } function memoize(xs){ function s$0(param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; return [0, x, memoize(xs$0)]; } var s = to_lazy(s$0); return function(param){ var a = runtime.caml_obj_tag(s); if(250 === a) return s[1]; if(246 !== a && 244 !== a) return s; return CamlinternalLazy[2].call(null, s);}; } function once(xs){ function f(param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1]; return [0, x, once(xs$0)]; } var action = Stdlib_Atomic[1].call(null, f); return function(param){ var f = Stdlib_Atomic[5].call(null, action, failure); return caml_call1(f, 0);}; } function zip(xs, ys, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return 0; var ys$0 = match$0[2], y = match$0[1]; return [0, [0, x, y], function(a){return zip(xs$0, ys$0, a);}]; } function map2(f, xs, ys, param){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(ys, 0); if(! match$0) return 0; var ys$0 = match$0[2], y = match$0[1]; return [0, caml_call2(f, x, y), function(a){return map2(f, xs$0, ys$0, a);}]; } function interleave(xs, ys, param){ var match = caml_call1(xs, 0); if(! match) return caml_call1(ys, 0); var xs$0 = match[2], x = match[1]; return [0, x, function(a){return interleave(ys, xs$0, a);}]; } function sorted_merge1(cmp, x, xs, y, ys){ return 0 < caml_call2(cmp, x, y) ? [0, y, function(param){ var match = caml_call1(ys, 0); if(! match) return [0, x, xs]; var ys$0 = match[2], y = match[1]; return sorted_merge1(cmp, x, xs, y, ys$0); }] : [0, x, function(param){ var match = caml_call1(xs, 0); if(! match) return [0, y, ys]; var xs$0 = match[2], x = match[1]; return sorted_merge1(cmp, x, xs$0, y, ys); }]; } function sorted_merge(cmp, xs, ys, param){ var match = caml_call1(xs, 0), match$0 = caml_call1(ys, 0); if(match){ if(match$0){ var ys$0 = match$0[2], y = match$0[1], xs$0 = match[2], x = match[1]; return sorted_merge1(cmp, x, xs$0, y, ys$0); } var c = match; } else{if(! match$0) return 0; var c = match$0;} return c; } function map_fst(xys, param){ var match = caml_call1(xys, 0); if(! match) return 0; var xys$0 = match[2], x = match[1][1]; return [0, x, function(a){return map_fst(xys$0, a);}]; } function map_snd(xys, param){ var match = caml_call1(xys, 0); if(! match) return 0; var xys$0 = match[2], y = match[1][2]; return [0, y, function(a){return map_snd(xys$0, a);}]; } function unzip(xys){ return [0, function(a){return map_fst(xys, a);}, function(a){return map_snd(xys, a);}]; } function filter_map_find_left_map(f, xs$1, param){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(f, x); if(0 === match$0[0]) break; xs = xs$0; } var y = match$0[1]; return [0, y, function(a){return filter_map_find_left_map(f, xs$0, a);}]; } function filter_map_find_right_map(f, xs$1, param){ var xs = xs$1; for(;;){ var match = caml_call1(xs, 0); if(! match) return 0; var xs$0 = match[2], x = match[1], match$0 = caml_call1(f, x); if(0 !== match$0[0]) break; xs = xs$0; } var z = match$0[1]; return [0, z, function(a){return filter_map_find_right_map(f, xs$0, a);}]; } function partition_map(f, xs){ return [0, function(a){return filter_map_find_left_map(f, xs, a);}, function(a){return filter_map_find_right_map(f, xs, a);}]; } function partition(p, xs){ function a(x){return 1 - caml_call1(p, x);} return [0, function(a){return filter(p, xs, a);}, function(b){return filter(a, xs, b);}]; } function peel(xss){ return unzip(function(a){return filter_map(uncons, xss, a);}); } var b = [0, "seq.ml", 616, 4]; function transpose(xss, param){ var match = peel(xss), tails = match[2], heads = match[1]; if(! is_empty(heads)) return [0, heads, function(a){return transpose(tails, a);}]; if(is_empty(tails)) return 0; throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); } function a(remainders, xss, param){ var match = caml_call1(xss, 0); if(! match) return transpose(remainders, 0); var xss$0 = match[2], xs = match[1], match$0 = caml_call1(xs, 0); if(match$0){ var xs$0 = match$0[2], x = match$0[1], match$1 = peel(remainders), tails = match$1[2], heads = match$1[1], b = function(param){return [0, xs$0, tails];}; return [0, function(param){return [0, x, heads];}, function(c){return a(b, xss$0, c);}]; } var match$2 = peel(remainders), tails$0 = match$2[2], heads$0 = match$2[1]; return [0, heads$0, function(b){return a(tails$0, xss$0, b);}]; } function map_product(f, xs, ys){ function c(x){ function a(y){return caml_call2(f, x, y);} return function(b){return map(a, ys, b);}; } function xss(a){return map(c, xs, a);} function b(b){return a(empty, xss, b);} return function(a){return concat(b, a);}; } function product(xs, ys){ return map_product(function(x, y){return [0, x, y];}, xs, ys); } function of_dispenser(it){ function c(param){ var match = caml_call1(it, 0); if(! match) return 0; var x = match[1]; return [0, x, c]; } return c; } function to_dispenser(xs){ var s = [0, xs]; return function(param){ var match = caml_call1(s[1], 0); if(! match) return 0; var xs = match[2], x = match[1]; s[1] = xs; return [0, x];}; } function ints(i, param){ var a = i + 1 | 0; return [0, i, function(b){return ints(a, b);}]; } runtime.caml_register_global (10, [0, is_empty, uncons, length, iter, fold_left, iteri, fold_lefti, for_all, exists, find, find_index, find_map, find_mapi, iter2, fold_left2, for_all2, exists2, equal, compare, empty, return$, cons, init, unfold, repeat, forever, cycle, iterate, map, mapi, filter, filter_map, scan, take, drop, take_while, drop_while, group, memoize, Forced_twice, once, transpose, append, concat, flat_map, flat_map, zip, map2, interleave, sorted_merge, product, map_product, unzip, unzip, partition_map, partition, of_dispenser, to_dispenser, ints], "Stdlib__Seq"); return; } (globalThis)); //# 1849 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Option:[N,F(1)*,F(2)*,F(1),F(2),F(1)*,F(2),F(3),F(2),F(1)*,F(1)*,F(3),F(3),F(2)*,F(1)*,F(1)*->F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib_Seq = global_data.Stdlib__Seq, Stdlib = global_data.Stdlib; function some(v){return [0, v];} function value(o, default$){ if(! o) return default$; var v = o[1]; return v; } function get(param){ if(! param) return Stdlib[1].call(null, "option is None"); var v = param[1]; return v; } function bind(o, f){ if(! o) return 0; var v = o[1]; return caml_call1(f, v); } function join(param){if(! param) return 0; var o = param[1]; return o;} function map(f, o){ if(! o) return 0; var v = o[1]; return [0, caml_call1(f, v)]; } function fold(none, some, param){ if(! param) return none; var v = param[1]; return caml_call1(some, v); } function iter(f, param){ if(! param) return 0; var v = param[1]; return caml_call1(f, v); } function is_none(param){return param ? 0 : 1;} function is_some(param){return param ? 1 : 0;} function equal(eq, o0, o1){ if(o0){ if(o1){var v1 = o1[1], v0 = o0[1]; return caml_call2(eq, v0, v1);} } else if(! o1) return 1; return 0; } function compare(cmp, o0, o1){ if(! o0) return o1 ? -1 : 0; var v0 = o0[1]; if(! o1) return 1; var v1 = o1[1]; return caml_call2(cmp, v0, v1); } function to_result(none, param){ if(! param) return [1, none]; var v = param[1]; return [0, v]; } function to_list(param){ if(! param) return 0; var v = param[1]; return [0, v, 0]; } function to_seq(param){ if(! param) return Stdlib_Seq[20]; var v = param[1], a = Stdlib_Seq[21]; return function(b){return a(v, b);}; } runtime.caml_register_global (3, [0, 0, some, value, get, bind, join, map, fold, iter, is_none, is_some, equal, compare, to_result, to_list, to_seq], "Stdlib__Option"); return; } (globalThis)); //# 2121 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Char:[F(1),F(1),F(1)*,F(1)*,F(2)*,F(2)*,F(2)*,F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_bytes_unsafe_set = runtime.caml_bytes_unsafe_set, caml_create_bytes = runtime.caml_create_bytes, caml_hash = runtime.caml_hash, caml_string_of_bytes = runtime.caml_string_of_bytes, Stdlib = runtime.caml_get_global_data().Stdlib; function chr(n){ if(0 <= n && 255 >= n) return n; return Stdlib[1].call(null, "Char.chr"); } function escaped(c){ a: { if(40 <= c){ if(92 === c) return "\\\\"; if(127 <= c) break a; } else{ if(32 > c){ if(14 <= c) break a; switch(c){ case 8: return "\\b"; case 9: return "\\t"; case 10: return "\\n"; case 13: return "\\r"; default: break a; } } if(39 <= c) return "\\'"; } var s$0 = caml_create_bytes(1); caml_bytes_unsafe_set(s$0, 0, c); return caml_string_of_bytes(s$0); } var s = caml_create_bytes(4); caml_bytes_unsafe_set(s, 0, 92); caml_bytes_unsafe_set(s, 1, 48 + (c / 100 | 0) | 0); caml_bytes_unsafe_set(s, 2, 48 + ((c / 10 | 0) % 10 | 0) | 0); caml_bytes_unsafe_set(s, 3, 48 + (c % 10 | 0) | 0); return caml_string_of_bytes(s); } function lowercase_ascii(c){return 25 < c - 65 >>> 0 ? c : c + 32 | 0;} function uppercase_ascii(c){return 25 < c - 97 >>> 0 ? c : c - 32 | 0;} function compare(c1, c2){return c1 - c2 | 0;} function equal(c1, c2){return 0 === (c1 - c2 | 0) ? 1 : 0;} function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} runtime.caml_register_global (8, [0, chr, escaped, lowercase_ascii, uppercase_ascii, compare, equal, seeded_hash, hash], "Stdlib__Char"); return; } (globalThis)); //# 2195 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Uchar:[N,N,N,N,F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(2)*,F(2)*,F(1)*,F(1)*,F(1)*,F(1)*,F(2)*,F(1)*,F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_format_int = runtime.caml_format_int, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, global_data = runtime.caml_get_global_data(), Assert_failure = global_data.Assert_failure, Stdlib = global_data.Stdlib; function succ(u){ return u === 55295 ? 57344 : u === 1114111 ? Stdlib[1].call(null, "U+10FFFF has no successor") : u + 1 | 0; } function pred(u){ return u === 57344 ? 55295 : u === 0 ? Stdlib[1].call(null, "U+0000 has no predecessor") : u - 1 | 0; } function is_valid(i){ var a = 0 <= i ? 1 : 0, b = a ? i <= 55295 ? 1 : 0 : a; if(b) var c = b; else var d = 57344 <= i ? 1 : 0, c = d ? i <= 1114111 ? 1 : 0 : d; return c; } function of_int(i){ if(is_valid(i)) return i; var a = Stdlib[28].call (null, caml_format_int("%X", i), " is not an Unicode scalar value"); return Stdlib[1].call(null, a); } function is_char(u){return u < 256 ? 1 : 0;} function of_char(c){return c;} function to_char(u){ if(255 >= u) return u; var a = Stdlib[28].call (null, caml_format_int("%04X", u), " is not a latin1 character"), b = Stdlib[28].call(null, "U+", a); return Stdlib[1].call(null, b); } function unsafe_to_char(a){return a;} function equal(b, a){return b === a ? 1 : 0;} var compare = runtime.caml_int_compare; function hash(a){return a;} function utf_decode_is_valid(d){return 1 === (d >>> 27 | 0) ? 1 : 0;} function utf_decode_length(d){return (d >>> 24 | 0) & 7;} function utf_decode_uchar(d){return d & 16777215;} function utf_decode(n, u){return (8 | n) << 24 | u;} function utf_decode_invalid(n){return n << 24 | 65533;} var cst_uchar_ml = "uchar.ml", a = [0, cst_uchar_ml, 85, 7], b = [0, cst_uchar_ml, 80, 18]; function utf_8_byte_length(u){ if(0 > u) throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); if(127 >= u) return 1; if(2047 >= u) return 2; if(65535 >= u) return 3; if(1114111 < u) throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); return 4; } var c = [0, cst_uchar_ml, 91, 7], d = [0, cst_uchar_ml, 88, 18]; function utf_16_byte_length(u){ if(0 > u) throw caml_maybe_attach_backtrace([0, Assert_failure, d], 1); if(65535 >= u) return 2; if(1114111 < u) throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); return 4; } var Stdlib_Uchar = [0, 0, 1114111, 65279, 65533, succ, pred, is_valid, of_int, function(a){return a;}, function(a){return a;}, is_char, of_char, to_char, unsafe_to_char, equal, compare, hash, utf_decode_is_valid, utf_decode_uchar, utf_decode_length, utf_decode, utf_decode_invalid, utf_8_byte_length, utf_16_byte_length]; runtime.caml_register_global(13, Stdlib_Uchar, "Stdlib__Uchar"); return; } (globalThis)); //# 2313 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__List:[F(1),F(2),F(2),F(1)*,F(2)*,F(1),F(1),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(4),F(4),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*->F(1),F(2),F(1)*->F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(3),F(1)*->F(1)*,F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_compare = runtime.caml_compare, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var Stdlib = runtime.caml_get_global_data().Stdlib; function length(l$0){ var len = 0, param = l$0; for(;;){ if(! param) return len; var l = param[2], len$0 = len + 1 | 0; len = len$0; param = l; } } function cons(a, l){return [0, a, l];} function hd(param){ if(! param) return Stdlib[2].call(null, "hd"); var a = param[1]; return a; } function tl(param){ if(! param) return Stdlib[2].call(null, "tl"); var l = param[2]; return l; } var cst_List_nth = "List.nth"; function nth(l, n){ if(0 > n) return Stdlib[1].call(null, cst_List_nth); var l$0 = l, n$0 = n; for(;;){ if(! l$0) return Stdlib[2].call(null, "nth"); var l$1 = l$0[2], a = l$0[1]; if(0 === n$0) return a; var n$1 = n$0 - 1 | 0; l$0 = l$1; n$0 = n$1; } } function nth_opt(l, n){ if(0 > n) return Stdlib[1].call(null, cst_List_nth); var l$0 = l, n$0 = n; for(;;){ if(! l$0) return 0; var l$1 = l$0[2], a = l$0[1]; if(0 === n$0) return [0, a]; var n$1 = n$0 - 1 | 0; l$0 = l$1; n$0 = n$1; } } var append = Stdlib[37]; function rev_append(l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(! l1) return l2; var l1$0 = l1[2], a = l1[1], l2$0 = [0, a, l2]; l1 = l1$0; l2 = l2$0; } } function rev(l){return rev_append(l, 0);} function init(len, f){ if(0 > len) return Stdlib[1].call(null, "List.init"); var last = len - 1 | 0; if(last < 0) return 0; var i$1 = 0; if(0 === last) return [0, caml_call1(f, i$1), 0]; var r1 = caml_call1(f, i$1), r2 = caml_call1(f, 1), block = [0, r2, 24029], dst = block, offset = 1, i = 2; for(;;){ if(last < i) dst[offset + 1] = 0; else{ if(i !== last){ var r1$0 = caml_call1(f, i), r2$0 = caml_call1(f, i + 1 | 0), dst$0 = [0, r2$0, 24029]; dst[offset + 1] = [0, r1$0, dst$0]; var i$0 = i + 2 | 0; dst = dst$0; offset = 1; i = i$0; continue; } dst[offset + 1] = [0, caml_call1(f, i), 0]; } return [0, r1, block]; } } function flatten(param){ if(! param) return 0; var r = param[2], l = param[1], a = flatten(r); return Stdlib[37].call(null, l, a); } function map(f, param){ if(! param) return 0; var match = param[2], a1 = param[1]; if(! match){var r1$0 = caml_call1(f, a1); return [0, r1$0, 0];} var l = match[2], a2 = match[1], r1 = caml_call1(f, a1), r2 = caml_call1(f, a2), block = [0, r2, 24029], dst = block, offset = 1, param$0 = l; for(;;){ if(param$0){ var match$0 = param$0[2], a1$0 = param$0[1]; if(match$0){ var l$0 = match$0[2], a2$0 = match$0[1], r1$1 = caml_call1(f, a1$0), r2$0 = caml_call1(f, a2$0), dst$0 = [0, r2$0, 24029]; dst[offset + 1] = [0, r1$1, dst$0]; dst = dst$0; offset = 1; param$0 = l$0; continue; } var r1$2 = caml_call1(f, a1$0); dst[offset + 1] = [0, r1$2, 0]; } else dst[offset + 1] = 0; return [0, r1, block]; } } function mapi(f, l$1){ if(! l$1) return 0; var match = l$1[2], a1 = l$1[1], i$1 = 0; if(! match){var r1$0 = caml_call2(f, i$1, a1); return [0, r1$0, 0];} var l = match[2], a2 = match[1], r1 = caml_call2(f, i$1, a1), r2 = caml_call2(f, 1, a2), block = [0, r2, 24029], dst = block, offset = 1, i = 2, param = l; for(;;){ if(param){ var match$0 = param[2], a1$0 = param[1]; if(match$0){ var l$0 = match$0[2], a2$0 = match$0[1], r1$1 = caml_call2(f, i, a1$0), r2$0 = caml_call2(f, i + 1 | 0, a2$0), dst$0 = [0, r2$0, 24029]; dst[offset + 1] = [0, r1$1, dst$0]; var i$0 = i + 2 | 0; dst = dst$0; offset = 1; i = i$0; param = l$0; continue; } var r1$2 = caml_call2(f, i, a1$0); dst[offset + 1] = [0, r1$2, 0]; } else dst[offset + 1] = 0; return [0, r1, block]; } } function rev_map(f, l){ var accu = 0, param = l; for(;;){ if(! param) return accu; var l$0 = param[2], a = param[1], accu$0 = [0, caml_call1(f, a), accu]; accu = accu$0; param = l$0; } } function iter(f, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1]; caml_call1(f, a); param = l; } } function iteri(f, l$0){ var i = 0, param = l$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1]; caml_call2(f, i, a); var i$0 = i + 1 | 0; i = i$0; param = l; } } function fold_left(f, accu$1, l$1){ var accu = accu$1, l = l$1; for(;;){ if(! l) return accu; var l$0 = l[2], a = l[1], accu$0 = caml_call2(f, accu, a); accu = accu$0; l = l$0; } } function fold_right(f, l, accu){ if(! l) return accu; var l$0 = l[2], a = l[1]; return caml_call2(f, a, fold_right(f, l$0, accu)); } function map2(f, l1, l2){ var cst_List_map2 = "List.map2"; if(l1){ var a = l1[2], a1 = l1[1]; if(a){ if(l2){ var match = l2[2]; if(match){ var l2$0 = match[2], b2 = match[1], b1 = l2[1], l1$0 = a[2], a2 = a[1], r1 = caml_call2(f, a1, b1), r2 = caml_call2(f, a2, b2), block = [0, r2, 24029], dst = block, offset = 1, l1$1 = l1$0, l2$1 = l2$0; for(;;){ a: { if(l1$1){ var b = l1$1[2], a1$0 = l1$1[1]; if(b){ if(l2$1){ var match$0 = l2$1[2]; if(match$0){ var l2$2 = match$0[2], b2$0 = match$0[1], b1$1 = l2$1[1], l1$2 = b[2], a2$0 = b[1], r1$1 = caml_call2(f, a1$0, b1$1), r2$0 = caml_call2(f, a2$0, b2$0), dst$0 = [0, r2$0, 24029]; dst[offset + 1] = [0, r1$1, dst$0]; dst = dst$0; offset = 1; l1$1 = l1$2; l2$1 = l2$2; continue; } } } else if(l2$1 && ! l2$1[2]){ var b1$2 = l2$1[1], r1$2 = caml_call2(f, a1$0, b1$2); dst[offset + 1] = [0, r1$2, 0]; break a; } } else if(! l2$1){dst[offset + 1] = 0; break a;} dst[offset + 1] = Stdlib[1].call(null, cst_List_map2); } return [0, r1, block]; } } } } else if(l2 && ! l2[2]){ var b1$0 = l2[1], r1$0 = caml_call2(f, a1, b1$0); return [0, r1$0, 0]; } } else if(! l2) return 0; return Stdlib[1].call(null, cst_List_map2); } function rev_map2(f, l1, l2){ var accu = 0, l1$0 = l1, l2$0 = l2; for(;;){ if(l1$0){ if(l2$0){ var l2$1 = l2$0[2], a2 = l2$0[1], l1$1 = l1$0[2], a1 = l1$0[1], accu$0 = [0, caml_call2(f, a1, a2), accu]; accu = accu$0; l1$0 = l1$1; l2$0 = l2$1; continue; } } else if(! l2$0) return accu; return Stdlib[1].call(null, "List.rev_map2"); } } function iter2(f, l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1]; caml_call2(f, a1, a2); l1 = l1$0; l2 = l2$0; continue; } } else if(! l2) return 0; return Stdlib[1].call(null, "List.iter2"); } } function fold_left2(f, accu$1, l1$1, l2$1){ var accu = accu$1, l1 = l1$1, l2 = l2$1; for(;;){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1], accu$0 = caml_call3(f, accu, a1, a2); accu = accu$0; l1 = l1$0; l2 = l2$0; continue; } } else if(! l2) return accu; return Stdlib[1].call(null, "List.fold_left2"); } } function fold_right2(f, l1, l2, accu){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1]; return caml_call3(f, a1, a2, fold_right2(f, l1$0, l2$0, accu)); } } else if(! l2) return accu; return Stdlib[1].call(null, "List.fold_right2"); } function for_all(p, param$0){ var param = param$0; for(;;){ if(! param) return 1; var l = param[2], a = param[1], b = caml_call1(p, a); if(! b) return b; param = l; } } function exists(p, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1], b = caml_call1(p, a); if(b) return b; param = l; } } function for_all2(p, l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1], a = caml_call2(p, a1, a2); if(! a) return a; l1 = l1$0; l2 = l2$0; continue; } } else if(! l2) return 1; return Stdlib[1].call(null, "List.for_all2"); } } function exists2(p, l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1], a = caml_call2(p, a1, a2); if(a) return a; l1 = l1$0; l2 = l2$0; continue; } } else if(! l2) return 0; return Stdlib[1].call(null, "List.exists2"); } } function mem(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1], b = 0 === caml_compare(a, x) ? 1 : 0; if(b) return b; param = l; } } function memq(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1], b = a === x ? 1 : 0; if(b) return b; param = l; } } function assoc(x, param$0){ var param = param$0; for(;;){ if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var l = param[2], match = param[1], b = match[2], a = match[1]; if(0 === caml_compare(a, x)) return b; param = l; } } function assoc_opt(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], match = param[1], b = match[2], a = match[1]; if(0 === caml_compare(a, x)) return [0, b]; param = l; } } function assq(x, param$0){ var param = param$0; for(;;){ if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var l = param[2], match = param[1], b = match[2], a = match[1]; if(a === x) return b; param = l; } } function assq_opt(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], match = param[1], b = match[2], a = match[1]; if(a === x) return [0, b]; param = l; } } function mem_assoc(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1][1], b = 0 === caml_compare(a, x) ? 1 : 0; if(b) return b; param = l; } } function mem_assq(x, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1][1], b = a === x ? 1 : 0; if(b) return b; param = l; } } function remove_assoc(x, param){ if(! param) return 0; var l = param[2], pair = param[1], a = pair[1]; return 0 === caml_compare(a, x) ? l : [0, pair, remove_assoc(x, l)]; } function remove_assq(x, param){ if(! param) return 0; var l = param[2], pair = param[1], a = pair[1]; return a === x ? l : [0, pair, remove_assq(x, l)]; } function find(p, param$0){ var param = param$0; for(;;){ if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var l = param[2], x = param[1]; if(caml_call1(p, x)) return x; param = l; } } function find_opt(p, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], x = param[1]; if(caml_call1(p, x)) return [0, x]; param = l; } } function find_index(p){ return function(param$0){ var i = 0, param = param$0; for(;;){ if(! param) return 0; var l = param[2], a = param[1]; if(caml_call1(p, a)) return [0, i]; var i$0 = i + 1 | 0; i = i$0; param = l; }}; } function find_map(f, param$0){ var param = param$0; for(;;){ if(! param) return 0; var l = param[2], x = param[1], result = caml_call1(f, x); if(result) return result; param = l; } } function find_mapi(f){ return function(param$0){ var i = 0, param = param$0; for(;;){ if(! param) return 0; var l = param[2], x = param[1], result = caml_call2(f, i, x); if(result) return result; var i$0 = i + 1 | 0; i = i$0; param = l; }}; } function find_all(p, param$1){ var param = param$1; for(;;){ if(! param) return 0; var l = param[2], x = param[1]; if(caml_call1(p, x)) break; param = l; } var block = [0, x, 24029], dst = block, offset = 1, param$0 = l; for(;;){ if(! param$0){dst[offset + 1] = 0; return block;} var l$0 = param$0[2], x$0 = param$0[1]; if(caml_call1(p, x$0)){ var dst$0 = [0, x$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; param$0 = l$0; } else param$0 = l$0; } } function filteri(p, l$1){ var i = 0, param = l$1; for(;;){ if(! param) return 0; var l = param[2], x = param[1], i$0 = i + 1 | 0; if(caml_call2(p, i, x)) break; i = i$0; param = l; } var block = [0, x, 24029], dst = block, offset = 1, i$1 = i$0, param$0 = l; for(;;){ if(! param$0){dst[offset + 1] = 0; return block;} var l$0 = param$0[2], x$0 = param$0[1], i$2 = i$1 + 1 | 0; if(caml_call2(p, i$1, x$0)){ var dst$0 = [0, x$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; i$1 = i$2; param$0 = l$0; } else{i$1 = i$2; param$0 = l$0;} } } function filter_map(f, param$1){ var param = param$1; for(;;){ if(! param) return 0; var l = param[2], x = param[1], match = caml_call1(f, x); if(match) break; param = l; } var v = match[1], block = [0, v, 24029], dst = block, offset = 1, param$0 = l; for(;;){ if(! param$0){dst[offset + 1] = 0; return block;} var l$0 = param$0[2], x$0 = param$0[1], match$0 = caml_call1(f, x$0); if(match$0){ var v$0 = match$0[1], dst$0 = [0, v$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; param$0 = l$0; } else param$0 = l$0; } } function concat_map(f, param$0){ var param = param$0; for(;;){ if(! param) return 0; var xs = param[2], x = param[1], ys = caml_call1(f, x); if(ys) break; param = xs; } var ys$1 = ys[2], y = ys[1], xs$1 = xs, ys$4 = ys$1, offset$0 = 1, block = [0, y, 24029], dst$1 = block; for(;;){ var dst = dst$1, offset = offset$0, ys$2 = ys$4; for(;;){ if(! ys$2){ if(xs$1){ var xs$0 = xs$1[2], x$0 = xs$1[1], ys$0 = caml_call1(f, x$0); xs$1 = xs$0; ys$4 = ys$0; offset$0 = offset; dst$1 = dst; break; } dst[offset + 1] = 0; return block; } var ys$3 = ys$2[2], y$0 = ys$2[1], dst$0 = [0, y$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; ys$2 = ys$3; } } } function fold_left_map(f, accu, l){ var accu$0 = accu, l_accu = 0, param = l; for(;;){ if(! param) return [0, accu$0, rev(l_accu)]; var l$0 = param[2], x = param[1], match = caml_call2(f, accu$0, x), x$0 = match[2], accu$1 = match[1], l_accu$0 = [0, x$0, l_accu]; accu$0 = accu$1; l_accu = l_accu$0; param = l$0; } } function partition(p, l){ var yes = 0, no = 0, param = l; for(;;){ if(! param){var a = rev(no); return [0, rev(yes), a];} var l$0 = param[2], x = param[1]; if(caml_call1(p, x)){ var yes$0 = [0, x, yes]; yes = yes$0; param = l$0; } else{var no$0 = [0, x, no]; no = no$0; param = l$0;} } } function partition_map(p, l){ var left = 0, right = 0, param = l; for(;;){ if(! param){var a = rev(right); return [0, rev(left), a];} var l$0 = param[2], x = param[1], match = caml_call1(p, x); if(0 === match[0]){ var v = match[1], left$0 = [0, v, left]; left = left$0; param = l$0; } else{ var v$0 = match[1], right$0 = [0, v$0, right]; right = right$0; param = l$0; } } } var a = [0, 0, 0]; function split(param){ if(! param) return a; var l = param[2], match = param[1], y = match[2], x = match[1], match$0 = split(l), ry = match$0[2], rx = match$0[1]; return [0, [0, x, rx], [0, y, ry]]; } function combine(l1, l2){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1]; return [0, [0, a1, a2], combine(l1$0, l2$0)]; } } else if(! l2) return 0; return Stdlib[1].call(null, "List.combine"); } function merge(cmp, l1, l2){ if(! l1) return l2; if(! l2) return l1; var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; return 0 < caml_call2(cmp, h1, h2) ? [0, h2, merge(cmp, l1, t2)] : [0, h1, merge(cmp, t1, l2)]; } function stable_sort(cmp, l){ function sort(n, l){ if(2 === n){ if(l){ var match = l[2]; if(match){ var tl = match[2], x2 = match[1], x1 = l[1], s = 0 < caml_call2(cmp, x1, x2) ? [0, x2, [0, x1, 0]] : [0, x1, [0, x2, 0]]; return [0, s, tl]; } } } else if(3 === n && l){ var a = l[2]; if(a){ var match$2 = a[2]; if(match$2){ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = a[1], x1$0 = l[1], s$0 = 0 < caml_call2(cmp, x1$0, x2$0) ? 0 < caml_call2(cmp, x1$0, x3) ? 0 < caml_call2(cmp, x2$0, x3) ? [0, x3, [0, x2$0, [0, x1$0, 0]]] : [0, x2$0, [0, x3, [0, x1$0, 0]]] : [0, x2$0, [0, x1$0, [0, x3, 0]]] : 0 < caml_call2(cmp, x2$0, x3) ? 0 < caml_call2(cmp, x1$0, x3) ? [0, x3, [0, x1$0, [0, x2$0, 0]]] : [0, x1$0, [0, x3, [0, x2$0, 0]]] : [0, x1$0, [0, x2$0, [0, x3, 0]]]; return [0, s$0, tl$1]; } } } var n1 = n >> 1, n2 = n - n1 | 0, match$0 = rev_sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], match$1 = rev_sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; if(0 < caml_call2(cmp, h1, h2)){ var accu$0 = [0, h1, accu]; l1 = t1; accu = accu$0; continue; } var accu$1 = [0, h2, accu]; l2 = t2; accu = accu$1; continue; } var b = rev_append(l1, accu); } else var b = rev_append(l2, accu); return [0, b, tl$0]; } } function rev_sort(n, l){ if(2 === n){ if(l){ var match = l[2]; if(match){ var tl = match[2], x2 = match[1], x1 = l[1], s = 0 < caml_call2(cmp, x1, x2) ? [0, x1, [0, x2, 0]] : [0, x2, [0, x1, 0]]; return [0, s, tl]; } } } else if(3 === n && l){ var a = l[2]; if(a){ var match$2 = a[2]; if(match$2){ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = a[1], x1$0 = l[1], s$0 = 0 < caml_call2(cmp, x1$0, x2$0) ? 0 < caml_call2(cmp, x2$0, x3) ? [0, x1$0, [0, x2$0, [0, x3, 0]]] : 0 < caml_call2(cmp, x1$0, x3) ? [0, x1$0, [0, x3, [0, x2$0, 0]]] : [0, x3, [0, x1$0, [0, x2$0, 0]]] : 0 < caml_call2(cmp, x1$0, x3) ? [0, x2$0, [0, x1$0, [0, x3, 0]]] : 0 < caml_call2(cmp, x2$0, x3) ? [0, x2$0, [0, x3, [0, x1$0, 0]]] : [0, x3, [0, x2$0, [0, x1$0, 0]]]; return [0, s$0, tl$1]; } } } var n1 = n >> 1, n2 = n - n1 | 0, match$0 = sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], match$1 = sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1]; if(0 < caml_call2(cmp, h1, h2)){ var accu$0 = [0, h2, accu]; l2 = t2; accu = accu$0; continue; } var accu$1 = [0, h1, accu]; l1 = t1; accu = accu$1; continue; } var b = rev_append(l1, accu); } else var b = rev_append(l2, accu); return [0, b, tl$0]; } } var len = length(l); return 2 <= len ? sort(len, l)[1] : l; } function sort_uniq(cmp, l){ function sort(n, l){ if(2 === n){ if(l){ var match = l[2]; if(match){ var tl = match[2], x2 = match[1], x1 = l[1], c$0 = caml_call2(cmp, x1, x2), s = 0 === c$0 ? [0, x1, 0] : 0 <= c$0 ? [0, x2, [0, x1, 0]] : [0, x1, [0, x2, 0]]; return [0, s, tl]; } } } else if(3 === n && l){ var a = l[2]; if(a){ var match$2 = a[2]; if(match$2){ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = a[1], x1$0 = l[1], c$1 = caml_call2(cmp, x1$0, x2$0); if(0 === c$1) var c$2 = caml_call2(cmp, x2$0, x3), s$0 = 0 === c$2 ? [0, x2$0, 0] : 0 <= c$2 ? [0, x3, [0, x2$0, 0]] : [0, x2$0, [0, x3, 0]]; else if(0 <= c$1){ var c$3 = caml_call2(cmp, x1$0, x3); if(0 === c$3) var s$0 = [0, x2$0, [0, x1$0, 0]]; else if(0 <= c$3) var c$4 = caml_call2(cmp, x2$0, x3), s$0 = 0 === c$4 ? [0, x2$0, [0, x1$0, 0]] : 0 <= c$4 ? [0, x3, [0, x2$0, [0, x1$0, 0]]] : [0, x2$0, [0, x3, [0, x1$0, 0]]]; else var s$0 = [0, x2$0, [0, x1$0, [0, x3, 0]]]; } else{ var c$5 = caml_call2(cmp, x2$0, x3); if(0 === c$5) var s$0 = [0, x1$0, [0, x2$0, 0]]; else if(0 <= c$5) var c$6 = caml_call2(cmp, x1$0, x3), s$0 = 0 === c$6 ? [0, x1$0, [0, x2$0, 0]] : 0 <= c$6 ? [0, x3, [0, x1$0, [0, x2$0, 0]]] : [0, x1$0, [0, x3, [0, x2$0, 0]]]; else var s$0 = [0, x1$0, [0, x2$0, [0, x3, 0]]]; } return [0, s$0, tl$1]; } } } var n1 = n >> 1, n2 = n - n1 | 0, match$0 = rev_sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], match$1 = rev_sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1], c = caml_call2(cmp, h1, h2); if(0 === c){ var accu$0 = [0, h1, accu]; l1 = t1; l2 = t2; accu = accu$0; continue; } if(0 < c){ var accu$1 = [0, h1, accu]; l1 = t1; accu = accu$1; continue; } var accu$2 = [0, h2, accu]; l2 = t2; accu = accu$2; continue; } var b = rev_append(l1, accu); } else var b = rev_append(l2, accu); return [0, b, tl$0]; } } function rev_sort(n, l){ if(2 === n){ if(l){ var match = l[2]; if(match){ var tl = match[2], x2 = match[1], x1 = l[1], c$0 = caml_call2(cmp, x1, x2), s = 0 === c$0 ? [0, x1, 0] : 0 < c$0 ? [0, x1, [0, x2, 0]] : [0, x2, [0, x1, 0]]; return [0, s, tl]; } } } else if(3 === n && l){ var a = l[2]; if(a){ var match$2 = a[2]; if(match$2){ var tl$1 = match$2[2], x3 = match$2[1], x2$0 = a[1], x1$0 = l[1], c$1 = caml_call2(cmp, x1$0, x2$0); if(0 === c$1) var c$2 = caml_call2(cmp, x2$0, x3), s$0 = 0 === c$2 ? [0, x2$0, 0] : 0 < c$2 ? [0, x2$0, [0, x3, 0]] : [0, x3, [0, x2$0, 0]]; else if(0 < c$1){ var c$3 = caml_call2(cmp, x2$0, x3); if(0 === c$3) var s$0 = [0, x1$0, [0, x2$0, 0]]; else if(0 < c$3) var s$0 = [0, x1$0, [0, x2$0, [0, x3, 0]]]; else var c$4 = caml_call2(cmp, x1$0, x3), s$0 = 0 === c$4 ? [0, x1$0, [0, x2$0, 0]] : 0 < c$4 ? [0, x1$0, [0, x3, [0, x2$0, 0]]] : [0, x3, [0, x1$0, [0, x2$0, 0]]]; } else{ var c$5 = caml_call2(cmp, x1$0, x3); if(0 === c$5) var s$0 = [0, x2$0, [0, x1$0, 0]]; else if(0 < c$5) var s$0 = [0, x2$0, [0, x1$0, [0, x3, 0]]]; else var c$6 = caml_call2(cmp, x2$0, x3), s$0 = 0 === c$6 ? [0, x2$0, [0, x1$0, 0]] : 0 < c$6 ? [0, x2$0, [0, x3, [0, x1$0, 0]]] : [0, x3, [0, x2$0, [0, x1$0, 0]]]; } return [0, s$0, tl$1]; } } } var n1 = n >> 1, n2 = n - n1 | 0, match$0 = sort(n1, l), l2$0 = match$0[2], s1 = match$0[1], match$1 = sort(n2, l2$0), tl$0 = match$1[2], s2 = match$1[1], l1 = s1, l2 = s2, accu = 0; for(;;){ if(l1){ if(l2){ var t2 = l2[2], h2 = l2[1], t1 = l1[2], h1 = l1[1], c = caml_call2(cmp, h1, h2); if(0 === c){ var accu$0 = [0, h1, accu]; l1 = t1; l2 = t2; accu = accu$0; continue; } if(0 <= c){ var accu$1 = [0, h2, accu]; l2 = t2; accu = accu$1; continue; } var accu$2 = [0, h1, accu]; l1 = t1; accu = accu$2; continue; } var b = rev_append(l1, accu); } else var b = rev_append(l2, accu); return [0, b, tl$0]; } } var len = length(l); return 2 <= len ? sort(len, l)[1] : l; } function compare_lengths(l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(! l1) return l2 ? -1 : 0; if(! l2) return 1; var l2$0 = l2[2], l1$0 = l1[2]; l1 = l1$0; l2 = l2$0; } } function compare_length_with(l$1, n$1){ var l = l$1, n = n$1; for(;;){ if(! l) return 0 === n ? 0 : 0 < n ? -1 : 1; var l$0 = l[2]; if(0 >= n) return 1; var n$0 = n - 1 | 0; l = l$0; n = n$0; } } function is_empty(param){return param ? 0 : 1;} function equal(eq, l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(l1){ if(l2){ var l2$0 = l2[2], a2 = l2[1], l1$0 = l1[2], a1 = l1[1], a = caml_call2(eq, a1, a2); if(! a) return a; l1 = l1$0; l2 = l2$0; continue; } } else if(! l2) return 1; return 0; } } function compare(cmp, l1$1, l2$1){ var l1 = l1$1, l2 = l2$1; for(;;){ if(! l1) return l2 ? -1 : 0; var l1$0 = l1[2], a1 = l1[1]; if(! l2) return 1; var l2$0 = l2[2], a2 = l2[1], c = caml_call2(cmp, a1, a2); if(0 !== c) return c; l1 = l1$0; l2 = l2$0; } } function to_seq(l){ function aux(l, param){ if(! l) return 0; var tail = l[2], x = l[1]; return [0, x, function(a){return aux(tail, a);}]; } return function(a){return aux(l, a);}; } function of_seq(seq){ var match = caml_call1(seq, 0); if(! match) return 0; var seq$0 = match[2], x1 = match[1], match$0 = caml_call1(seq$0, 0); if(! match$0) return [0, x1, 0]; var seq$1 = match$0[2], x2 = match$0[1], block = [0, x2, 24029], dst = block, offset = 1, seq$2 = seq$1; for(;;){ var match$1 = caml_call1(seq$2, 0); if(match$1){ var seq$3 = match$1[2], x1$0 = match$1[1], match$2 = caml_call1(seq$3, 0); if(match$2){ var seq$4 = match$2[2], x2$0 = match$2[1], dst$0 = [0, x2$0, 24029]; dst[offset + 1] = [0, x1$0, dst$0]; dst = dst$0; offset = 1; seq$2 = seq$4; continue; } dst[offset + 1] = [0, x1$0, 0]; } else dst[offset + 1] = 0; return [0, x1, block]; } } runtime.caml_register_global (17, [0, length, compare_lengths, compare_length_with, is_empty, cons, hd, tl, nth, nth_opt, rev, init, append, rev_append, flatten, flatten, equal, compare, iter, iteri, map, mapi, rev_map, filter_map, concat_map, fold_left_map, fold_left, fold_right, iter2, map2, rev_map2, fold_left2, fold_right2, for_all, exists, for_all2, exists2, mem, memq, find, find_opt, find_index, find_map, find_mapi, find_all, find_all, filteri, partition, partition_map, assoc, assoc_opt, assq, assq_opt, mem_assoc, mem_assq, remove_assoc, remove_assq, split, combine, stable_sort, stable_sort, stable_sort, sort_uniq, merge, to_seq, of_seq], "Stdlib__List"); return; } (globalThis)); //# 3660 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Int:[N,N,N,F(1)*,N,N,F(1)*,F(2)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_hash = runtime.caml_hash; function abs(x){return 0 <= x ? x : - x | 0;} function lognot(x){return x ^ -1;} function equal(b, a){return b === a ? 1 : 0;} var compare = runtime.caml_int_compare; function min(x, y){return x <= y ? x : y;} function max(x, y){return y <= x ? x : y;} function to_string(x){return "" + x;} function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} runtime.caml_register_global (1, [0, 0, 1, -1, abs, 2147483647, -2147483648, lognot, equal, compare, min, max, to_string, seeded_hash, hash], "Stdlib__Int"); return; } (globalThis)); //# 3698 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Bytes:[F(2),F(2),N,F(1),F(1),F(1),F(3),F(3),F(3),F(4),F(5),F(5),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(1),F(1),F(1),F(1),F(2)*,F(2)*,F(2),F(2),F(1),F(1)*,F(2),F(1)*->F(1),F(1)*->F(1),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_blit_bytes = runtime.caml_blit_bytes, caml_bswap16 = runtime.caml_bswap16, caml_bytes_get = runtime.caml_bytes_get, caml_bytes_get16 = runtime.caml_bytes_get16, caml_bytes_get32 = runtime.caml_bytes_get32, caml_bytes_get64 = runtime.caml_bytes_get64, caml_bytes_of_string = runtime.caml_bytes_of_string, caml_bytes_set = runtime.caml_bytes_set, caml_bytes_set16 = runtime.caml_bytes_set16, caml_bytes_set32 = runtime.caml_bytes_set32, caml_bytes_set64 = runtime.caml_bytes_set64, caml_bytes_unsafe_get = runtime.caml_bytes_unsafe_get, caml_bytes_unsafe_set = runtime.caml_bytes_unsafe_set, caml_create_bytes = runtime.caml_create_bytes, caml_fill_bytes = runtime.caml_fill_bytes, caml_int32_bswap = runtime.caml_int32_bswap, caml_int64_bswap = runtime.caml_int64_bswap, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_bytes_length = runtime.caml_ml_bytes_length, caml_string_of_bytes = runtime.caml_string_of_bytes, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var dummy = 0, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Uchar = global_data.Stdlib__Uchar, Assert_failure = global_data.Assert_failure, Stdlib_Sys = global_data.Stdlib__Sys, Stdlib_Int = global_data.Stdlib__Int, Stdlib_Seq = global_data.Stdlib__Seq, Stdlib_Char = global_data.Stdlib__Char; function make(n, c){ var s = caml_create_bytes(n); caml_fill_bytes(s, 0, n, c); return s; } function init(n, f){ var s = caml_create_bytes(n), a = n - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_bytes_unsafe_set(s, i, caml_call1(f, i)); var b = i + 1 | 0; if(a === i) break; i = b; } } return s; } var empty = caml_create_bytes(0); function copy(s){ var len = caml_ml_bytes_length(s), r = caml_create_bytes(len); caml_blit_bytes(s, 0, r, 0, len); return r; } function to_string(b){return caml_string_of_bytes(copy(b));} function of_string(s){return copy(caml_bytes_of_string(s));} function sub(s, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_bytes_length(s) - len | 0) >= ofs){ var r = caml_create_bytes(len); caml_blit_bytes(s, ofs, r, 0, len); return r; } return Stdlib[1].call(null, "String.sub / Bytes.sub"); } function sub_string(b, ofs, len){ return caml_string_of_bytes(sub(b, ofs, len)); } function symbol(a, b){ var c = a + b | 0, d = b < 0, match = c < 0; a: { if(a < 0){if(! d || match) break a;} else if(d || ! match) break a; return Stdlib[1].call(null, "Bytes.extend"); } return c; } function extend(s, left, right){ var len = symbol(symbol(caml_ml_bytes_length(s), left), right), r = caml_create_bytes(len); if(0 <= left) var dstoff = left, srcoff = 0; else var dstoff = 0, srcoff = - left | 0; var cpylen = Stdlib_Int[10].call (null, caml_ml_bytes_length(s) - srcoff | 0, len - dstoff | 0); if(0 < cpylen) caml_blit_bytes(s, srcoff, r, dstoff, cpylen); return r; } function fill(s, ofs, len, c){ if(0 <= ofs && 0 <= len && (caml_ml_bytes_length(s) - len | 0) >= ofs) return caml_fill_bytes(s, ofs, len, c); return Stdlib[1].call(null, "String.fill / Bytes.fill"); } function blit(s1, ofs1, s2, ofs2, len){ if (0 <= len && 0 <= ofs1 && (caml_ml_bytes_length(s1) - len | 0) >= ofs1 && 0 <= ofs2 && (caml_ml_bytes_length(s2) - len | 0) >= ofs2) return caml_blit_bytes(s1, ofs1, s2, ofs2, len); return Stdlib[1].call(null, "Bytes.blit"); } function blit_string(s1, ofs1, s2, ofs2, len){ if (0 <= len && 0 <= ofs1 && (runtime.caml_ml_string_length(s1) - len | 0) >= ofs1 && 0 <= ofs2 && (caml_ml_bytes_length(s2) - len | 0) >= ofs2) return runtime.caml_blit_string(s1, ofs1, s2, ofs2, len); return Stdlib[1].call(null, "String.blit / Bytes.blit_string"); } function iter(f, a){ var b = caml_ml_bytes_length(a) - 1 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call1(f, caml_bytes_unsafe_get(a, i)); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function iteri(f, a){ var b = caml_ml_bytes_length(a) - 1 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call2(f, i, caml_bytes_unsafe_get(a, i)); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function concat(sep, l){ if(! l) return empty; var seplen = caml_ml_bytes_length(sep); a: { var acc = 0, param = l, pos$1 = 0; for(;;){ if(! param){var a = acc; break a;} var hd = param[1]; if(! param[2]) break; var tl = param[2], x = (caml_ml_bytes_length(hd) + seplen | 0) + acc | 0; if(acc <= x){ acc = x; param = tl; } else{acc = Stdlib[1].call(null, "Bytes.concat"); param = tl;} } var a = caml_ml_bytes_length(hd) + acc | 0; } var dst = caml_create_bytes(a), pos = pos$1, param$0 = l; for(;;){ if(! param$0) return dst; var hd$0 = param$0[1]; if(! param$0[2]){ caml_blit_bytes(hd$0, 0, dst, pos, caml_ml_bytes_length(hd$0)); return dst; } var tl$0 = param$0[2]; caml_blit_bytes(hd$0, 0, dst, pos, caml_ml_bytes_length(hd$0)); caml_blit_bytes (sep, 0, dst, pos + caml_ml_bytes_length(hd$0) | 0, seplen); var pos$0 = (pos + caml_ml_bytes_length(hd$0) | 0) + seplen | 0; pos = pos$0; param$0 = tl$0; } } function cat(s1, s2){ var l1 = caml_ml_bytes_length(s1), l2 = caml_ml_bytes_length(s2), r = caml_create_bytes(l1 + l2 | 0); caml_blit_bytes(s1, 0, r, 0, l1); caml_blit_bytes(s2, 0, r, l1, l2); return r; } function is_space(param){ var a = param - 9 | 0; a: { if(4 < a >>> 0){if(23 !== a) break a;} else if(2 === a) break a; return 1; } return 0; } function trim(s){ var len = caml_ml_bytes_length(s), i = 0; for(;;){ if(i >= len) break; if(! is_space(caml_bytes_unsafe_get(s, i))) break; var i$0 = i + 1 | 0; i = i$0; } var j = len - 1 | 0; for(;;){ if(i <= j && is_space(caml_bytes_unsafe_get(s, j))){var j$0 = j - 1 | 0; j = j$0; continue;} return i <= j ? sub(s, i, (j - i | 0) + 1 | 0) : empty; } } function unsafe_escape(s){ var e = caml_ml_bytes_length(s) - 1 | 0, d = 0; if(e < 0) var n$0 = d; else{ var n = d, i$0 = 0; for(;;){ var match = caml_bytes_unsafe_get(s, i$0); a: { b: { c: { if(32 <= match){ var a = match - 34 | 0; if(58 < a >>> 0){ if(93 <= a) break c; } else if(56 < a - 1 >>> 0) break b; var b = 1; break a; } if(11 <= match){ if(13 === match) break b; } else if(8 <= match) break b; } var b = 4; break a; } var b = 2; } var g = n + b | 0, j = i$0 + 1 | 0; if(e === i$0){var n$0 = g; break;} n = g; i$0 = j; } } if(n$0 === caml_ml_bytes_length(s)) return s; var s$0 = caml_create_bytes(n$0), f = caml_ml_bytes_length(s) - 1 | 0; if(f >= 0){ var n$1 = 0, i = 0; for(;;){ var c = caml_bytes_unsafe_get(s, i); a: { b: { c: { if(35 <= c){ if(92 !== c){if(127 <= c) break b; break c;} } else{ if(32 > c){ if(14 <= c) break b; switch(c){ case 8: caml_bytes_unsafe_set(s$0, n$1, 92); var n$2 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$2, 98); var n$10 = n$2; break a; case 9: caml_bytes_unsafe_set(s$0, n$1, 92); var n$3 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$3, 116); var n$10 = n$3; break a; case 10: caml_bytes_unsafe_set(s$0, n$1, 92); var n$4 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$4, 110); var n$10 = n$4; break a; case 13: caml_bytes_unsafe_set(s$0, n$1, 92); var n$5 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$5, 114); var n$10 = n$5; break a; default: break b; } } if(34 > c) break c; } caml_bytes_unsafe_set(s$0, n$1, 92); var n$9 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$9, c); var n$10 = n$9; break a; } caml_bytes_unsafe_set(s$0, n$1, c); var n$10 = n$1; break a; } caml_bytes_unsafe_set(s$0, n$1, 92); var n$6 = n$1 + 1 | 0; caml_bytes_unsafe_set(s$0, n$6, 48 + (c / 100 | 0) | 0); var n$7 = n$6 + 1 | 0; caml_bytes_unsafe_set(s$0, n$7, 48 + ((c / 10 | 0) % 10 | 0) | 0); var n$8 = n$7 + 1 | 0; caml_bytes_unsafe_set(s$0, n$8, 48 + (c % 10 | 0) | 0); var n$10 = n$8; } var n$11 = n$10 + 1 | 0, h = i + 1 | 0; if(f === i) break; n$1 = n$11; i = h; } } return s$0; } function escaped(b){var b$0 = copy(b); return unsafe_escape(b$0);} function map(f, s){ var l = caml_ml_bytes_length(s); if(0 === l) return s; var r = caml_create_bytes(l), a = l - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_bytes_unsafe_set(r, i, caml_call1(f, caml_bytes_unsafe_get(s, i))); var b = i + 1 | 0; if(a === i) break; i = b; } } return r; } function mapi(f, s){ var l = caml_ml_bytes_length(s); if(0 === l) return s; var r = caml_create_bytes(l), a = l - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_bytes_unsafe_set (r, i, caml_call2(f, i, caml_bytes_unsafe_get(s, i))); var b = i + 1 | 0; if(a === i) break; i = b; } } return r; } function fold_left(f, x, a){ var b = caml_ml_bytes_length(a) - 1 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = 0; for(;;){ var c = caml_call2(f, r, caml_bytes_unsafe_get(a, i)), d = i + 1 | 0; if(b === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function fold_right(f, a, x){ var b = caml_ml_bytes_length(a) - 1 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = b; for(;;){ var c = caml_call2(f, caml_bytes_unsafe_get(a, i), r), d = i - 1 | 0; if(0 === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function exists(p, s){ var n = caml_ml_bytes_length(s), i = 0; for(;;){ if(i === n) return 0; if(caml_call1(p, caml_bytes_unsafe_get(s, i))) return 1; var i$0 = i + 1 | 0; i = i$0; } } function for_all(p, s){ var n = caml_ml_bytes_length(s), i = 0; for(;;){ if(i === n) return 1; if(! caml_call1(p, caml_bytes_unsafe_get(s, i))) return 0; var i$0 = i + 1 | 0; i = i$0; } } function uppercase_ascii(s){return map(Stdlib_Char[4], s);} function lowercase_ascii(s){return map(Stdlib_Char[3], s);} function apply1(f, s){ if(0 === caml_ml_bytes_length(s)) return s; var r = copy(s); caml_bytes_unsafe_set(r, 0, caml_call1(f, caml_bytes_unsafe_get(s, 0))); return r; } function capitalize_ascii(s){return apply1(Stdlib_Char[4], s);} function uncapitalize_ascii(s){return apply1(Stdlib_Char[3], s);} function starts_with(prefix, s){ var len_s = caml_ml_bytes_length(s), len_pre = caml_ml_bytes_length(prefix), a = len_pre <= len_s ? 1 : 0; if(! a) return a; var i = 0; for(;;){ if(i === len_pre) return 1; if(caml_bytes_unsafe_get(s, i) !== caml_bytes_unsafe_get(prefix, i)) return 0; var i$0 = i + 1 | 0; i = i$0; } } function ends_with(suffix, s){ var len_s = caml_ml_bytes_length(s), len_suf = caml_ml_bytes_length(suffix), diff = len_s - len_suf | 0, a = 0 <= diff ? 1 : 0; if(! a) return a; var i = 0; for(;;){ if(i === len_suf) return 1; if (caml_bytes_unsafe_get(s, diff + i | 0) !== caml_bytes_unsafe_get(suffix, i)) return 0; var i$0 = i + 1 | 0; i = i$0; } } function index_rec(s, lim, i$1, c){ var i = i$1; for(;;){ if(lim <= i) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(caml_bytes_unsafe_get(s, i) === c) return i; var i$0 = i + 1 | 0; i = i$0; } } function index(s, c){return index_rec(s, caml_ml_bytes_length(s), 0, c);} function index_rec_opt(s, lim, i$1, c){ var i = i$1; for(;;){ if(lim <= i) return 0; if(caml_bytes_unsafe_get(s, i) === c) return [0, i]; var i$0 = i + 1 | 0; i = i$0; } } function index_opt(s, c){ return index_rec_opt(s, caml_ml_bytes_length(s), 0, c); } function index_from(s, i, c){ var l = caml_ml_bytes_length(s); if(0 <= i && l >= i) return index_rec(s, l, i, c); return Stdlib[1].call(null, "String.index_from / Bytes.index_from"); } function index_from_opt(s, i, c){ var l = caml_ml_bytes_length(s); if(0 <= i && l >= i) return index_rec_opt(s, l, i, c); return Stdlib[1].call (null, "String.index_from_opt / Bytes.index_from_opt"); } function rindex_rec(s, i$1, c){ var i = i$1; for(;;){ if(0 > i) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(caml_bytes_unsafe_get(s, i) === c) return i; var i$0 = i - 1 | 0; i = i$0; } } function rindex(s, c){ return rindex_rec(s, caml_ml_bytes_length(s) - 1 | 0, c); } function rindex_from(s, i, c){ if(-1 <= i && caml_ml_bytes_length(s) > i) return rindex_rec(s, i, c); return Stdlib[1].call(null, "String.rindex_from / Bytes.rindex_from"); } function rindex_rec_opt(s, i$1, c){ var i = i$1; for(;;){ if(0 > i) return 0; if(caml_bytes_unsafe_get(s, i) === c) return [0, i]; var i$0 = i - 1 | 0; i = i$0; } } function rindex_opt(s, c){ return rindex_rec_opt(s, caml_ml_bytes_length(s) - 1 | 0, c); } function rindex_from_opt(s, i, c){ if(-1 <= i && caml_ml_bytes_length(s) > i) return rindex_rec_opt(s, i, c); return Stdlib[1].call (null, "String.rindex_from_opt / Bytes.rindex_from_opt"); } function contains_from(s, i, c){ var l = caml_ml_bytes_length(s); if(0 <= i && l >= i) try{index_rec(s, l, i, c); return 1;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return Stdlib[1].call(null, "String.contains_from / Bytes.contains_from"); } function contains(s, c){return contains_from(s, 0, c);} function rcontains_from(s, i, c){ if(0 <= i && caml_ml_bytes_length(s) > i) try{rindex_rec(s, i, c); return 1;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return Stdlib[1].call (null, "String.rcontains_from / Bytes.rcontains_from"); } var compare = runtime.caml_bytes_compare; function split_on_char(sep, s){ var b = caml_ml_bytes_length(s), c = caml_ml_bytes_length(s) - 1 | 0, a = 0; if(c < 0) var j$1 = b, r$1 = a; else{ var j = b, r = a, i = c; for(;;){ if(caml_bytes_unsafe_get(s, i) === sep) var j$0 = i, r$0 = [0, sub(s, i + 1 | 0, (j - i | 0) - 1 | 0), r]; else var j$0 = j, r$0 = r; var d = i - 1 | 0; if(0 === i){var j$1 = j$0, r$1 = r$0; break;} j = j$0; r = r$0; i = d; } } return [0, sub(s, 0, j$1), r$1]; } function to_seq(s){ function aux(i, param){ if(i === caml_ml_bytes_length(s)) return 0; var x = caml_bytes_get(s, i), a = i + 1 | 0; return [0, x, function(b){return aux(a, b);}]; } return function(a){return aux(0, a);}; } function to_seqi(s){ function aux(i, param){ if(i === caml_ml_bytes_length(s)) return 0; var x = caml_bytes_get(s, i), a = i + 1 | 0; return [0, [0, i, x], function(b){return aux(a, b);}]; } return function(a){return aux(0, a);}; } function of_seq(i){ var buf = [0, make(256, 0)], n = [0, 0]; Stdlib_Seq[4].call (null, function(c){ if(n[1] === caml_ml_bytes_length(buf[1])){ var new_len = Stdlib_Int[10].call (null, 2 * caml_ml_bytes_length(buf[1]) | 0, Stdlib_Sys[12]); if(caml_ml_bytes_length(buf[1]) === new_len) Stdlib[2].call(null, "Bytes.of_seq: cannot grow bytes"); var new_buf = make(new_len, 0); blit(buf[1], 0, new_buf, 0, n[1]); buf[1] = new_buf; } caml_bytes_set(buf[1], n[1], c); n[1]++; return 0; }, i); return sub(buf[1], 0, n[1]); } function unsafe_get_uint16_le(b, i){ return Stdlib_Sys[11] ? caml_bswap16(caml_bytes_get16(b, i)) : caml_bytes_get16(b, i); } function unsafe_get_uint16_be(b, i){ return Stdlib_Sys[11] ? caml_bytes_get16(b, i) : caml_bswap16(caml_bytes_get16(b, i)); } function get_int8(b, i){ var a = Stdlib_Sys[10] - 8 | 0, c = Stdlib_Sys[10] - 8 | 0; return caml_bytes_get(b, i) << c >> a; } function get_uint16_le(b, i){ return Stdlib_Sys[11] ? caml_bswap16(caml_bytes_get16(b, i)) : caml_bytes_get16(b, i); } function get_uint16_be(b, i){ return Stdlib_Sys[11] ? caml_bytes_get16(b, i) : caml_bswap16(caml_bytes_get16(b, i)); } function get_int16_ne(b, i){ var a = Stdlib_Sys[10] - 16 | 0, c = Stdlib_Sys[10] - 16 | 0; return caml_bytes_get16(b, i) << c >> a; } function get_int16_le(b, i){ var a = Stdlib_Sys[10] - 16 | 0, c = Stdlib_Sys[10] - 16 | 0; return get_uint16_le(b, i) << c >> a; } function get_int16_be(b, i){ var a = Stdlib_Sys[10] - 16 | 0, c = Stdlib_Sys[10] - 16 | 0; return get_uint16_be(b, i) << c >> a; } function get_int32_le(b, i){ return Stdlib_Sys[11] ? caml_int32_bswap(caml_bytes_get32(b, i)) : caml_bytes_get32(b, i); } function get_int32_be(b, i){ return Stdlib_Sys[11] ? caml_bytes_get32(b, i) : caml_int32_bswap(caml_bytes_get32(b, i)); } function get_int64_le(b, i){ return Stdlib_Sys[11] ? caml_int64_bswap(caml_bytes_get64(b, i)) : caml_bytes_get64(b, i); } function get_int64_be(b, i){ return Stdlib_Sys[11] ? caml_bytes_get64(b, i) : caml_int64_bswap(caml_bytes_get64(b, i)); } function unsafe_set_uint16_le(b, i, x){ if(Stdlib_Sys[11]){caml_bytes_set16(b, i, caml_bswap16(x)); return;} caml_bytes_set16(b, i, x); } function unsafe_set_uint16_be(b, i, x){ if(Stdlib_Sys[11]){caml_bytes_set16(b, i, x); return;} caml_bytes_set16(b, i, caml_bswap16(x)); } function set_int16_le(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set16(b, i, caml_bswap16(x)) : caml_bytes_set16(b, i, x); } function set_int16_be(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set16(b, i, x) : caml_bytes_set16(b, i, caml_bswap16(x)); } function set_int32_le(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set32(b, i, caml_int32_bswap(x)) : caml_bytes_set32(b, i, x); } function set_int32_be(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set32(b, i, x) : caml_bytes_set32(b, i, caml_int32_bswap(x)); } function set_int64_le(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set64(b, i, caml_int64_bswap(x)) : caml_bytes_set64(b, i, x); } function set_int64_be(b, i, x){ return Stdlib_Sys[11] ? caml_bytes_set64(b, i, x) : caml_bytes_set64(b, i, caml_int64_bswap(x)); } var dec_invalid = Stdlib_Uchar[22]; function dec_ret(n, u){ var a = Stdlib_Uchar[9].call(null, u); return Stdlib_Uchar[21].call(null, n, a); } function not_in_x80_to_xBF(b){return 2 !== (b >>> 6 | 0) ? 1 : 0;} function not_in_xA0_to_xBF(b){return 5 !== (b >>> 5 | 0) ? 1 : 0;} function not_in_x80_to_x9F(b){return 4 !== (b >>> 5 | 0) ? 1 : 0;} function not_in_x90_to_xBF(b){ var a = b < 144 ? 1 : 0, c = a || (191 < b ? 1 : 0); return c; } function not_in_x80_to_x8F(b){return 8 !== (b >>> 4 | 0) ? 1 : 0;} function utf_8_uchar_3(b0, b1, b2){ return (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63; } function utf_8_uchar_4(b0, b1, b2, b3){ return (b0 & 7) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63; } function get_utf_8_uchar(b, i){ var b0 = caml_bytes_get(b, i), max = caml_ml_bytes_length(b) - 1 | 0; a: { if(224 <= b0){ if(237 <= b0){ if(245 <= b0) break a; switch(b0 - 237 | 0){ case 0: var i$0 = i + 1 | 0; if(max < i$0) return dec_invalid(1); var b1$4 = caml_bytes_unsafe_get(b, i$0); if(not_in_x80_to_x9F(b1$4)) return dec_invalid(1); var i$1 = i$0 + 1 | 0; if(max < i$1) return dec_invalid(2); var b2$3 = caml_bytes_unsafe_get(b, i$1); return not_in_x80_to_xBF(b2$3) ? dec_invalid(2) : dec_ret(3, utf_8_uchar_3(b0, b1$4, b2$3)); case 3: var i$4 = i + 1 | 0; if(max < i$4) return dec_invalid(1); var b1$2 = caml_bytes_unsafe_get(b, i$4); if(not_in_x90_to_xBF(b1$2)) return dec_invalid(1); var i$5 = i$4 + 1 | 0; if(max < i$5) return dec_invalid(2); var b2$1 = caml_bytes_unsafe_get(b, i$5); if(not_in_x80_to_xBF(b2$1)) return dec_invalid(2); var i$6 = i$5 + 1 | 0; if(max < i$6) return dec_invalid(3); var b3$1 = caml_bytes_unsafe_get(b, i$6); return not_in_x80_to_xBF(b3$1) ? dec_invalid(3) : dec_ret(4, utf_8_uchar_4(b0, b1$2, b2$1, b3$1)); case 7: var i$10 = i + 1 | 0; if(max < i$10) return dec_invalid(1); var b1$0 = caml_bytes_unsafe_get(b, i$10); if(not_in_x80_to_x8F(b1$0)) return dec_invalid(1); var i$11 = i$10 + 1 | 0; if(max < i$11) return dec_invalid(2); var b2 = caml_bytes_unsafe_get(b, i$11); if(not_in_x80_to_xBF(b2)) return dec_invalid(2); var i$12 = i$11 + 1 | 0; if(max < i$12) return dec_invalid(3); var b3 = caml_bytes_unsafe_get(b, i$12); return not_in_x80_to_xBF(b3) ? dec_invalid(3) : dec_ret(4, utf_8_uchar_4(b0, b1$0, b2, b3)); case 1: case 2: break; default: var i$7 = i + 1 | 0; if(max < i$7) return dec_invalid(1); var b1$1 = caml_bytes_unsafe_get(b, i$7); if(not_in_x80_to_xBF(b1$1)) return dec_invalid(1); var i$8 = i$7 + 1 | 0; if(max < i$8) return dec_invalid(2); var b2$0 = caml_bytes_unsafe_get(b, i$8); if(not_in_x80_to_xBF(b2$0)) return dec_invalid(2); var i$9 = i$8 + 1 | 0; if(max < i$9) return dec_invalid(3); var b3$0 = caml_bytes_unsafe_get(b, i$9); return not_in_x80_to_xBF(b3$0) ? dec_invalid(3) : dec_ret(4, utf_8_uchar_4(b0, b1$1, b2$0, b3$0)); } } else if(225 > b0){ var i$13 = i + 1 | 0; if(max < i$13) return dec_invalid(1); var b1$5 = caml_bytes_unsafe_get(b, i$13); if(not_in_xA0_to_xBF(b1$5)) return dec_invalid(1); var i$14 = i$13 + 1 | 0; if(max < i$14) return dec_invalid(2); var b2$4 = caml_bytes_unsafe_get(b, i$14); return not_in_x80_to_xBF(b2$4) ? dec_invalid(2) : dec_ret(3, utf_8_uchar_3(b0, b1$5, b2$4)); } var i$2 = i + 1 | 0; if(max < i$2) return dec_invalid(1); var b1$3 = caml_bytes_unsafe_get(b, i$2); if(not_in_x80_to_xBF(b1$3)) return dec_invalid(1); var i$3 = i$2 + 1 | 0; if(max < i$3) return dec_invalid(2); var b2$2 = caml_bytes_unsafe_get(b, i$3); return not_in_x80_to_xBF(b2$2) ? dec_invalid(2) : dec_ret(3, utf_8_uchar_3(b0, b1$3, b2$2)); } if(128 > b0) return dec_ret(1, b0); if(194 <= b0){ var i$15 = i + 1 | 0; if(max < i$15) return dec_invalid(1); var b1 = caml_bytes_unsafe_get(b, i$15); return not_in_x80_to_xBF(b1) ? dec_invalid(1) : dec_ret(2, (b0 & 31) << 6 | b1 & 63); } } return dec_invalid(1); } var cst_bytes_ml = "bytes.ml", a = [0, cst_bytes_ml, 679, 9], b = [0, cst_bytes_ml, 654, 20]; function set_utf_8_uchar(b$0, i, u){ function set(c, b, a){caml_bytes_unsafe_set(c, b, a);} var max = caml_ml_bytes_length(b$0) - 1 | 0, u$0 = Stdlib_Uchar[10].call(null, u); if(0 > u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); if(127 >= u$0){caml_bytes_set(b$0, i, u$0); return 1;} if(2047 >= u$0){ var last$1 = i + 1 | 0; return max < last$1 ? 0 : (caml_bytes_set (b$0, i, 192 | u$0 >>> 6 | 0), set(b$0, last$1, 128 | u$0 & 63), 2); } if(65535 >= u$0){ var last$0 = i + 2 | 0; return max < last$0 ? 0 : (caml_bytes_set (b$0, i, 224 | u$0 >>> 12 | 0), set(b$0, i + 1 | 0, 128 | (u$0 >>> 6 | 0) & 63), set(b$0, last$0, 128 | u$0 & 63), 3); } if(1114111 < u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); var last = i + 3 | 0; return max < last ? 0 : (caml_bytes_set (b$0, i, 240 | u$0 >>> 18 | 0), set(b$0, i + 1 | 0, 128 | (u$0 >>> 12 | 0) & 63), set(b$0, i + 2 | 0, 128 | (u$0 >>> 6 | 0) & 63), set(b$0, last, 128 | u$0 & 63), 4); } function is_valid_utf_8(b){ var max = caml_ml_bytes_length(b) - 1 | 0, i = 0; for(;;){ if(max < i) return 1; var match = caml_bytes_unsafe_get(b, i); a: { if(224 <= match){ if(237 <= match){ if(245 <= match) break a; switch(match - 237 | 0){ case 0: var last = i + 2 | 0; if (max >= last && ! not_in_x80_to_x9F(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last))){var i$0 = last + 1 | 0; i = i$0; continue;} return 0; case 3: var last$1 = i + 3 | 0; if (max >= last$1 && ! not_in_x90_to_xBF(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, i + 2 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$1))){var i$2 = last$1 + 1 | 0; i = i$2; continue;} return 0; case 7: var last$3 = i + 3 | 0; if (max >= last$3 && ! not_in_x80_to_x8F(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, i + 2 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$3))){var i$4 = last$3 + 1 | 0; i = i$4; continue;} return 0; case 1: case 2: break; default: var last$2 = i + 3 | 0; if (max >= last$2 && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, i + 2 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$2))){var i$3 = last$2 + 1 | 0; i = i$3; continue;} return 0; } } else if(225 > match){ var last$4 = i + 2 | 0; if (max >= last$4 && ! not_in_xA0_to_xBF(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$4))){var i$5 = last$4 + 1 | 0; i = i$5; continue;} return 0; } var last$0 = i + 2 | 0; if (max >= last$0 && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, i + 1 | 0)) && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$0))){var i$1 = last$0 + 1 | 0; i = i$1; continue;} return 0; } if(128 > match){var i$7 = i + 1 | 0; i = i$7; continue;} if(194 <= match){ var last$5 = i + 1 | 0; if (max >= last$5 && ! not_in_x80_to_xBF(caml_bytes_unsafe_get(b, last$5))){var i$6 = last$5 + 1 | 0; i = i$6; continue;} return 0; } } return 0; } } var cst_index_out_of_bounds = "index out of bounds"; function get_utf_16be_uchar(b, i){ var max = caml_ml_bytes_length(b) - 1 | 0; if(0 <= i && max >= i){ if(i === max) return dec_invalid(1); var hi = unsafe_get_uint16_be(b, i); if(55296 <= hi && 57343 >= hi){ if(56319 < hi) return dec_invalid(2); var last = i + 3 | 0; if(max < last) return dec_invalid((max - i | 0) + 1 | 0); var lo = unsafe_get_uint16_be(b, i + 2 | 0); if(56320 <= lo && 57343 >= lo){ var u = ((hi & 1023) << 10 | lo & 1023) + 65536 | 0; return dec_ret(4, u); } return dec_invalid(2); } return dec_ret(2, hi); } return Stdlib[1].call(null, cst_index_out_of_bounds); } var c = [0, cst_bytes_ml, 777, 9], d = [0, cst_bytes_ml, 766, 20]; function set_utf_16be_uchar(b, i, u){ var max = caml_ml_bytes_length(b) - 1 | 0; if(0 <= i && max >= i){ var u$0 = Stdlib_Uchar[10].call(null, u); if(0 > u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, d], 1); if(65535 >= u$0){ var last$0 = i + 1 | 0; return max < last$0 ? 0 : (unsafe_set_uint16_be(b, i, u$0), 2); } if(1114111 < u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); var last = i + 3 | 0; if(max < last) return 0; var u$1 = u$0 - 65536 | 0, hi = 55296 | u$1 >>> 10 | 0, lo = 56320 | u$1 & 1023; unsafe_set_uint16_be(b, i, hi); unsafe_set_uint16_be(b, i + 2 | 0, lo); return 4; } return Stdlib[1].call(null, cst_index_out_of_bounds); } function is_valid_utf_16be(b){ var max = caml_ml_bytes_length(b) - 1 | 0, i = 0; for(;;){ if(max < i) return 1; if(i === max) return 0; var u = unsafe_get_uint16_be(b, i); if(55296 <= u && 57343 >= u){ if(56319 < u) return 0; var last = i + 3 | 0; if(max < last) return 0; var u$0 = unsafe_get_uint16_be(b, i + 2 | 0); if(56320 <= u$0 && 57343 >= u$0){ var i$1 = i + 4 | 0; i = i$1; continue; } return 0; } var i$0 = i + 2 | 0; i = i$0; } } function get_utf_16le_uchar(b, i){ var max = caml_ml_bytes_length(b) - 1 | 0; if(0 <= i && max >= i){ if(i === max) return dec_invalid(1); var hi = unsafe_get_uint16_le(b, i); if(55296 <= hi && 57343 >= hi){ if(56319 < hi) return dec_invalid(2); var last = i + 3 | 0; if(max < last) return dec_invalid((max - i | 0) + 1 | 0); var lo = unsafe_get_uint16_le(b, i + 2 | 0); if(56320 <= lo && 57343 >= lo){ var u = ((hi & 1023) << 10 | lo & 1023) + 65536 | 0; return dec_ret(4, u); } return dec_invalid(2); } return dec_ret(2, hi); } return Stdlib[1].call(null, cst_index_out_of_bounds); } var e = [0, cst_bytes_ml, 831, 9], f = [0, cst_bytes_ml, 820, 20]; function set_utf_16le_uchar(b, i, u){ var max = caml_ml_bytes_length(b) - 1 | 0; if(0 <= i && max >= i){ var u$0 = Stdlib_Uchar[10].call(null, u); if(0 > u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, f], 1); if(65535 >= u$0){ var last$0 = i + 1 | 0; return max < last$0 ? 0 : (unsafe_set_uint16_le(b, i, u$0), 2); } if(1114111 < u$0) throw caml_maybe_attach_backtrace([0, Assert_failure, e], 1); var last = i + 3 | 0; if(max < last) return 0; var u$1 = u$0 - 65536 | 0, hi = 55296 | u$1 >>> 10 | 0, lo = 56320 | u$1 & 1023; unsafe_set_uint16_le(b, i, hi); unsafe_set_uint16_le(b, i + 2 | 0, lo); return 4; } return Stdlib[1].call(null, cst_index_out_of_bounds); } function is_valid_utf_16le(b){ var max = caml_ml_bytes_length(b) - 1 | 0, i = 0; for(;;){ if(max < i) return 1; if(i === max) return 0; var u = unsafe_get_uint16_le(b, i); if(55296 <= u && 57343 >= u){ if(56319 < u) return 0; var last = i + 3 | 0; if(max < last) return 0; var u$0 = unsafe_get_uint16_le(b, i + 2 | 0); if(56320 <= u$0 && 57343 >= u$0){ var i$1 = i + 4 | 0; i = i$1; continue; } return 0; } var i$0 = i + 2 | 0; i = i$0; } } var Stdlib_Bytes = [0, make, init, empty, copy, of_string, to_string, sub, sub_string, extend, fill, blit, blit_string, concat, cat, iter, iteri, map, mapi, fold_left, fold_right, for_all, exists, trim, escaped, index, index_opt, rindex, rindex_opt, index_from, index_from_opt, rindex_from, rindex_from_opt, contains, contains_from, rcontains_from, uppercase_ascii, lowercase_ascii, capitalize_ascii, uncapitalize_ascii, compare, runtime.caml_bytes_equal, starts_with, ends_with, caml_string_of_bytes, caml_bytes_of_string, split_on_char, to_seq, to_seqi, of_seq, get_utf_8_uchar, set_utf_8_uchar, is_valid_utf_8, get_utf_16be_uchar, set_utf_16be_uchar, is_valid_utf_16be, get_utf_16le_uchar, set_utf_16le_uchar, is_valid_utf_16le, caml_bytes_get, get_int8, caml_bytes_get16, get_uint16_be, get_uint16_le, get_int16_ne, get_int16_be, get_int16_le, caml_bytes_get32, get_int32_be, get_int32_le, caml_bytes_get64, get_int64_be, get_int64_le, caml_bytes_set, caml_bytes_set, caml_bytes_set16, set_int16_be, set_int16_le, caml_bytes_set16, set_int16_be, set_int16_le, caml_bytes_set32, set_int32_be, set_int32_le, caml_bytes_set64, set_int64_be, set_int64_le, unsafe_escape]; runtime.caml_register_global(30, Stdlib_Bytes, "Stdlib__Bytes"); return; } (globalThis)); //# 4897 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__String:[F(2),F(2),N,F(1),F(1),F(5),F(2),F(2)*,F(2)*,F(2)*,F(2),F(2),F(3),F(3),F(2),F(3),F(2),F(2),F(2),F(3),F(3),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(2),F(2),F(1)*,F(1)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_blit_string = runtime.caml_blit_string, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_equal = runtime.caml_string_equal, caml_string_hash = runtime.caml_string_hash, caml_string_unsafe_get = runtime.caml_string_unsafe_get, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Bytes = global_data.Stdlib__Bytes, bts = Stdlib_Bytes[44], bos = Stdlib_Bytes[45]; function make(n, c){return bts(Stdlib_Bytes[1].call(null, n, c));} function init(n, f){return bts(Stdlib_Bytes[2].call(null, n, f));} var of_bytes = Stdlib_Bytes[6], to_bytes = Stdlib_Bytes[5]; function sub(s, ofs, len){ var a = bos(s); return bts(Stdlib_Bytes[7].call(null, a, ofs, len)); } var blit = Stdlib_Bytes[12], cst = ""; function concat(sep, l){ if(! l) return cst; var seplen = caml_ml_string_length(sep); a: { var acc = 0, param = l, pos$1 = 0; for(;;){ if(! param){var a = acc; break a;} var hd = param[1]; if(! param[2]) break; var tl = param[2], x = (caml_ml_string_length(hd) + seplen | 0) + acc | 0; if(acc <= x){ acc = x; param = tl; } else{acc = Stdlib[1].call(null, "String.concat"); param = tl;} } var a = caml_ml_string_length(hd) + acc | 0; } var dst = runtime.caml_create_bytes(a), pos = pos$1, param$0 = l; for(;;){ if(param$0){ var hd$0 = param$0[1]; if(param$0[2]){ var tl$0 = param$0[2]; caml_blit_string(hd$0, 0, dst, pos, caml_ml_string_length(hd$0)); caml_blit_string (sep, 0, dst, pos + caml_ml_string_length(hd$0) | 0, seplen); var pos$0 = (pos + caml_ml_string_length(hd$0) | 0) + seplen | 0; pos = pos$0; param$0 = tl$0; continue; } caml_blit_string(hd$0, 0, dst, pos, caml_ml_string_length(hd$0)); } return bts(dst); } } var cat = Stdlib[28]; function iter(f, s){ var a = caml_ml_string_length(s) - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_call1(f, caml_string_unsafe_get(s, i)); var b = i + 1 | 0; if(a === i) break; i = b; } } return 0; } function iteri(f, s){ var a = caml_ml_string_length(s) - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_call2(f, i, caml_string_unsafe_get(s, i)); var b = i + 1 | 0; if(a === i) break; i = b; } } return 0; } function map(f, s){ var a = bos(s); return bts(Stdlib_Bytes[17].call(null, f, a)); } function mapi(f, s){ var a = bos(s); return bts(Stdlib_Bytes[18].call(null, f, a)); } function fold_right(f, x, a){ var b = bos(x); return Stdlib_Bytes[20].call(null, f, b, a); } function fold_left(f, a, x){ var b = bos(x); return Stdlib_Bytes[19].call(null, f, a, b); } function exists(f, s){ var a = bos(s); return Stdlib_Bytes[22].call(null, f, a); } function for_all(f, s){ var a = bos(s); return Stdlib_Bytes[21].call(null, f, a); } function is_space(param){ var a = param - 9 | 0; a: { if(4 < a >>> 0){if(23 !== a) break a;} else if(2 === a) break a; return 1; } return 0; } function trim(s){ if(s === cst) return s; if (! is_space(caml_string_unsafe_get(s, 0)) && ! is_space(caml_string_unsafe_get(s, caml_ml_string_length(s) - 1 | 0))) return s; var a = bos(s); return bts(Stdlib_Bytes[23].call(null, a)); } function escaped(s){ var b = bos(s); return bts(Stdlib_Bytes[87].call(null, b)); } function index_rec(s, lim, i$1, c){ var i = i$1; for(;;){ if(lim <= i) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(caml_string_unsafe_get(s, i) === c) return i; var i$0 = i + 1 | 0; i = i$0; } } function index(s, c){return index_rec(s, caml_ml_string_length(s), 0, c);} function index_rec_opt(s, lim, i$1, c){ var i = i$1; for(;;){ if(lim <= i) return 0; if(caml_string_unsafe_get(s, i) === c) return [0, i]; var i$0 = i + 1 | 0; i = i$0; } } function index_opt(s, c){ return index_rec_opt(s, caml_ml_string_length(s), 0, c); } function index_from(s, i, c){ var l = caml_ml_string_length(s); if(0 <= i && l >= i) return index_rec(s, l, i, c); return Stdlib[1].call(null, "String.index_from / Bytes.index_from"); } function index_from_opt(s, i, c){ var l = caml_ml_string_length(s); if(0 <= i && l >= i) return index_rec_opt(s, l, i, c); return Stdlib[1].call (null, "String.index_from_opt / Bytes.index_from_opt"); } function rindex_rec(s, i$1, c){ var i = i$1; for(;;){ if(0 > i) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(caml_string_unsafe_get(s, i) === c) return i; var i$0 = i - 1 | 0; i = i$0; } } function rindex(s, c){ return rindex_rec(s, caml_ml_string_length(s) - 1 | 0, c); } function rindex_from(s, i, c){ if(-1 <= i && caml_ml_string_length(s) > i) return rindex_rec(s, i, c); return Stdlib[1].call(null, "String.rindex_from / Bytes.rindex_from"); } function rindex_rec_opt(s, i$1, c){ var i = i$1; for(;;){ if(0 > i) return 0; if(caml_string_unsafe_get(s, i) === c) return [0, i]; var i$0 = i - 1 | 0; i = i$0; } } function rindex_opt(s, c){ return rindex_rec_opt(s, caml_ml_string_length(s) - 1 | 0, c); } function rindex_from_opt(s, i, c){ if(-1 <= i && caml_ml_string_length(s) > i) return rindex_rec_opt(s, i, c); return Stdlib[1].call (null, "String.rindex_from_opt / Bytes.rindex_from_opt"); } function contains_from(s, i, c){ var l = caml_ml_string_length(s); if(0 <= i && l >= i) try{index_rec(s, l, i, c); return 1;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return Stdlib[1].call(null, "String.contains_from / Bytes.contains_from"); } function contains(s, c){return contains_from(s, 0, c);} function rcontains_from(s, i, c){ if(0 <= i && caml_ml_string_length(s) > i) try{rindex_rec(s, i, c); return 1;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return Stdlib[1].call (null, "String.rcontains_from / Bytes.rcontains_from"); } function uppercase_ascii(s){ var a = bos(s); return bts(Stdlib_Bytes[36].call(null, a)); } function lowercase_ascii(s){ var a = bos(s); return bts(Stdlib_Bytes[37].call(null, a)); } function capitalize_ascii(s){ var a = bos(s); return bts(Stdlib_Bytes[38].call(null, a)); } function uncapitalize_ascii(s){ var a = bos(s); return bts(Stdlib_Bytes[39].call(null, a)); } function starts_with(prefix, s){ var len_s = caml_ml_string_length(s), len_pre = caml_ml_string_length(prefix), a = len_pre <= len_s ? 1 : 0; if(! a) return a; var i = 0; for(;;){ if(i === len_pre) return 1; if(caml_string_unsafe_get(s, i) !== caml_string_unsafe_get(prefix, i)) return 0; var i$0 = i + 1 | 0; i = i$0; } } function ends_with(suffix, s){ var len_s = caml_ml_string_length(s), len_suf = caml_ml_string_length(suffix), diff = len_s - len_suf | 0, a = 0 <= diff ? 1 : 0; if(! a) return a; var i = 0; for(;;){ if(i === len_suf) return 1; if (caml_string_unsafe_get(s, diff + i | 0) !== caml_string_unsafe_get(suffix, i)) return 0; var i$0 = i + 1 | 0; i = i$0; } } function hash(x){return caml_string_hash(0, x);} function split_on_char(sep, s){ var b = caml_ml_string_length(s), c = caml_ml_string_length(s) - 1 | 0, a = 0; if(c < 0) var j$1 = b, r$1 = a; else{ var j = b, r = a, i = c; for(;;){ if(caml_string_unsafe_get(s, i) === sep) var j$0 = i, r$0 = [0, sub(s, i + 1 | 0, (j - i | 0) - 1 | 0), r]; else var j$0 = j, r$0 = r; var d = i - 1 | 0; if(0 === i){var j$1 = j$0, r$1 = r$0; break;} j = j$0; r = r$0; i = d; } } return [0, sub(s, 0, j$1), r$1]; } var compare = runtime.caml_string_compare; function to_seq(s){var a = bos(s); return Stdlib_Bytes[47].call(null, a);} function to_seqi(s){var a = bos(s); return Stdlib_Bytes[48].call(null, a);} function of_seq(g){return bts(Stdlib_Bytes[49].call(null, g));} function get_utf_8_uchar(s, i){ var a = bos(s); return Stdlib_Bytes[50].call(null, a, i); } function is_valid_utf_8(s){ var a = bos(s); return Stdlib_Bytes[52].call(null, a); } function get_utf_16be_uchar(s, i){ var a = bos(s); return Stdlib_Bytes[53].call(null, a, i); } function is_valid_utf_16be(s){ var a = bos(s); return Stdlib_Bytes[55].call(null, a); } function get_utf_16le_uchar(s, i){ var a = bos(s); return Stdlib_Bytes[56].call(null, a, i); } function is_valid_utf_16le(s){ var a = bos(s); return Stdlib_Bytes[58].call(null, a); } function get_int8(s, i){ var a = bos(s); return Stdlib_Bytes[60].call(null, a, i); } function get_uint16_le(s, i){ var a = bos(s); return Stdlib_Bytes[63].call(null, a, i); } function get_uint16_be(s, i){ var a = bos(s); return Stdlib_Bytes[62].call(null, a, i); } function get_int16_ne(s, i){ var a = bos(s); return Stdlib_Bytes[64].call(null, a, i); } function get_int16_le(s, i){ var a = bos(s); return Stdlib_Bytes[66].call(null, a, i); } function get_int16_be(s, i){ var a = bos(s); return Stdlib_Bytes[65].call(null, a, i); } function get_int32_le(s, i){ var a = bos(s); return Stdlib_Bytes[69].call(null, a, i); } function get_int32_be(s, i){ var a = bos(s); return Stdlib_Bytes[68].call(null, a, i); } function get_int64_le(s, i){ var a = bos(s); return Stdlib_Bytes[72].call(null, a, i); } function get_int64_be(s, i){ var a = bos(s); return Stdlib_Bytes[71].call(null, a, i); } var Stdlib_String = [0, make, init, cst, of_bytes, to_bytes, blit, concat, cat, caml_string_equal, compare, starts_with, ends_with, contains_from, rcontains_from, contains, sub, split_on_char, map, mapi, fold_left, fold_right, for_all, exists, trim, escaped, uppercase_ascii, lowercase_ascii, capitalize_ascii, uncapitalize_ascii, iter, iteri, index_from, index_from_opt, rindex_from, rindex_from_opt, index, index_opt, rindex, rindex_opt, to_seq, to_seqi, of_seq, get_utf_8_uchar, is_valid_utf_8, get_utf_16be_uchar, is_valid_utf_16be, get_utf_16le_uchar, is_valid_utf_16le, runtime.caml_string_get, get_int8, runtime.caml_string_get16, get_uint16_be, get_uint16_le, get_int16_ne, get_int16_be, get_int16_le, runtime.caml_string_get32, hash, caml_string_hash, get_int32_be, get_int32_le, runtime.caml_string_get64, get_int64_be, get_int64_le]; runtime.caml_register_global(12, Stdlib_String, "Stdlib__String"); return; } (globalThis)); //# 5423 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Array:[F(2),F(3),F(3),F(2)*,F(1)*,F(3),F(1)*,F(4),F(5),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(3),F(3),F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(1)*->F(1)*,F(1)*->F(1)*,F(1),[]] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_array_sub = runtime.caml_array_sub, caml_check_bound = runtime.caml_check_bound, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib_Seq = global_data.Stdlib__Seq, Assert_failure = global_data.Assert_failure, Stdlib = global_data.Stdlib; function init(l, f){ if(0 === l) return [0]; if(0 > l) return Stdlib[1].call(null, "Array.init"); var res = caml_make_vect(l, caml_call1(f, 0)), a = l - 1 | 0; if(a >= 1){ var i = 1; for(;;){ res[i + 1] = caml_call1(f, i); var b = i + 1 | 0; if(a === i) break; i = b; } } return res; } function make_matrix(sx, sy, init){ if(sy < 0) Stdlib[1].call(null, "Array.make_matrix"); var res = caml_make_vect(sx, [0]); if(0 < sy){ var a = sx - 1 | 0; if(a >= 0){ var x = 0; for(;;){ res[x + 1] = caml_make_vect(sy, init); var b = x + 1 | 0; if(a === x) break; x = b; } } } return res; } function init_matrix(sx, sy, f){ if(sy < 0) Stdlib[1].call(null, "Array.init_matrix"); var res = caml_make_vect(sx, [0]); if(0 < sy){ var a = sx - 1 | 0; if(a >= 0){ var x = 0; for(;;){ var row = caml_make_vect(sy, caml_call2(f, x, 0)), b = sy - 1 | 0; if(b >= 1){ var y = 1; for(;;){ row[y + 1] = caml_call2(f, x, y); var d = y + 1 | 0; if(b === y) break; y = d; } } res[x + 1] = row; var c = x + 1 | 0; if(a === x) break; x = c; } } } return res; } function copy(a){ var l = a.length - 1; return 0 === l ? [0] : caml_array_sub(a, 0, l); } function append(a1, a2){ var l1 = a1.length - 1; return 0 === l1 ? copy(a2) : 0 === a2.length - 1 ? caml_array_sub(a1, 0, l1) : runtime.caml_array_append(a1, a2); } function sub(a, ofs, len){ if(0 <= ofs && 0 <= len && (a.length - 1 - len | 0) >= ofs) return caml_array_sub(a, ofs, len); return Stdlib[1].call(null, "Array.sub"); } function fill(a, ofs, len, v){ if(0 <= ofs && 0 <= len && (a.length - 1 - len | 0) >= ofs) return runtime.caml_array_fill(a, ofs, len, v); return Stdlib[1].call(null, "Array.fill"); } function blit(a1, ofs1, a2, ofs2, len){ if (0 <= len && 0 <= ofs1 && (a1.length - 1 - len | 0) >= ofs1 && 0 <= ofs2 && (a2.length - 1 - len | 0) >= ofs2) return runtime.caml_array_blit(a1, ofs1, a2, ofs2, len); return Stdlib[1].call(null, "Array.blit"); } function iter(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function iter2(f, a, b){ if(a.length - 1 !== b.length - 1) return Stdlib[1].call (null, "Array.iter2: arrays must have the same length"); var c = a.length - 2 | 0; if(c >= 0){ var i = 0; for(;;){ caml_call2(f, a[i + 1], b[i + 1]); var d = i + 1 | 0; if(c === i) break; i = d; } } return 0; } function map(f, a){ var l = a.length - 1; if(0 === l) return [0]; var r = caml_make_vect(l, caml_call1(f, a[1])), b = l - 1 | 0; if(b >= 1){ var i = 1; for(;;){ r[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } function map_inplace(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ a[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function mapi_inplace(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ a[i + 1] = caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function map2(f, a, b){ var la = a.length - 1, lb = b.length - 1; if(la !== lb) return Stdlib[1].call (null, "Array.map2: arrays must have the same length"); if(0 === la) return [0]; var r = caml_make_vect(la, caml_call2(f, a[1], b[1])), c = la - 1 | 0; if(c >= 1){ var i = 1; for(;;){ r[i + 1] = caml_call2(f, a[i + 1], b[i + 1]); var d = i + 1 | 0; if(c === i) break; i = d; } } return r; } function iteri(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function mapi(f, a){ var l = a.length - 1; if(0 === l) return [0]; var r = caml_make_vect(l, caml_call2(f, 0, a[1])), b = l - 1 | 0; if(b >= 1){ var i = 1; for(;;){ r[i + 1] = caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } function to_list(a){ var i$1 = a.length - 2 | 0, i = i$1, res = 0; for(;;){ if(0 > i) return res; var res$0 = [0, a[i + 1], res], i$0 = i - 1 | 0; i = i$0; res = res$0; } } function list_length(accu$1, param$0){ var accu = accu$1, param = param$0; for(;;){ if(! param) return accu; var t = param[2], accu$0 = accu + 1 | 0; accu = accu$0; param = t; } } function of_list(l){ if(! l) return [0]; var tl = l[2], hd = l[1], a = caml_make_vect(list_length(0, l), hd), i = 1, param = tl; for(;;){ if(! param) return a; var tl$0 = param[2], hd$0 = param[1]; a[i + 1] = hd$0; var i$0 = i + 1 | 0; i = i$0; param = tl$0; } } function fold_left(f, x, a){ var b = a.length - 2 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = 0; for(;;){ var c = caml_call2(f, r, a[i + 1]), d = i + 1 | 0; if(b === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function fold_left_map(f, acc, input_array){ var len = input_array.length - 1; if(0 === len) return [0, acc, [0]]; var match = caml_call2(f, acc, input_array[1]), elt = match[2], acc$0 = match[1], output_array = caml_make_vect(len, elt), a = len - 1 | 0; if(a < 1) var acc$3 = acc$0; else{ var acc$2 = acc$0, i = 1; for(;;){ var match$0 = caml_call2(f, acc$2, input_array[i + 1]), elt$0 = match$0[2], acc$1 = match$0[1]; output_array[i + 1] = elt$0; var b = i + 1 | 0; if(a === i){var acc$3 = acc$1; break;} acc$2 = acc$1; i = b; } } return [0, acc$3, output_array]; } function fold_right(f, a, x){ var b = a.length - 2 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = b; for(;;){ var c = caml_call2(f, a[i + 1], r), d = i - 1 | 0; if(0 === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function exists(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(caml_call1(p, a[i + 1])) return 1; var i$0 = i + 1 | 0; i = i$0; } } function for_all(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 1; if(! caml_call1(p, a[i + 1])) return 0; var i$0 = i + 1 | 0; i = i$0; } } function for_all2(p, l1, l2){ var n1 = l1.length - 1, n2 = l2.length - 1; if(n1 !== n2) return Stdlib[1].call(null, "Array.for_all2"); var i = 0; for(;;){ if(i === n1) return 1; if(! caml_call2(p, l1[i + 1], l2[i + 1])) return 0; var i$0 = i + 1 | 0; i = i$0; } } function exists2(p, l1, l2){ var n1 = l1.length - 1, n2 = l2.length - 1; if(n1 !== n2) return Stdlib[1].call(null, "Array.exists2"); var i = 0; for(;;){ if(i === n1) return 0; if(caml_call2(p, l1[i + 1], l2[i + 1])) return 1; var i$0 = i + 1 | 0; i = i$0; } } function mem(x, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(0 === runtime.caml_compare(a[i + 1], x)) return 1; var i$0 = i + 1 | 0; i = i$0; } } function memq(x, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(x === a[i + 1]) return 1; var i$0 = i + 1 | 0; i = i$0; } } function find_opt(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var x = a[i + 1]; if(caml_call1(p, x)) return [0, x]; var i$0 = i + 1 | 0; i = i$0; } } function find_index(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(caml_call1(p, a[i + 1])) return [0, i]; var i$0 = i + 1 | 0; i = i$0; } } function find_map(f, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var r = caml_call1(f, a[i + 1]); if(r) return r; var i$0 = i + 1 | 0; i = i$0; } } function find_mapi(f, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var r = caml_call2(f, i, a[i + 1]); if(r) return r; var i$0 = i + 1 | 0; i = i$0; } } function split(x){ if(runtime.caml_equal(x, [0])) return [0, [0], [0]]; var match = x[1], b0 = match[2], a0 = match[1], n = x.length - 1, a = caml_make_vect(n, a0), b = caml_make_vect(n, b0), c = n - 1 | 0; if(c >= 1){ var i = 1; for(;;){ var match$0 = x[i + 1], bi = match$0[2], ai = match$0[1]; a[i + 1] = ai; b[i + 1] = bi; var d = i + 1 | 0; if(c === i) break; i = d; } } return [0, a, b]; } function combine(a, b){ var na = a.length - 1, nb = b.length - 1; if(na !== nb) Stdlib[1].call(null, "Array.combine"); if(0 === na) return [0]; var x = caml_make_vect(na, [0, a[1], b[1]]), c = na - 1 | 0; if(c >= 1){ var i = 1; for(;;){ x[i + 1] = [0, a[i + 1], b[i + 1]]; var d = i + 1 | 0; if(c === i) break; i = d; } } return x; } var Bottom = [248, "Stdlib.Array.Bottom", runtime.caml_fresh_oo_id(0)], a = [0, "array.ml", 369, 4]; function sort(cmp, a$0){ function maxson(l, i){ var i31 = ((i + i | 0) + i | 0) + 1 | 0; if((i31 + 2 | 0) < l){ var a = i31 + 1 | 0, d = caml_check_bound(a$0, a)[a + 1], x = caml_call2(cmp, caml_check_bound(a$0, i31)[i31 + 1], d) < 0 ? i31 + 1 | 0 : i31, b = i31 + 2 | 0, e = caml_check_bound(a$0, b)[b + 1], x$0 = caml_call2(cmp, caml_check_bound(a$0, x)[x + 1], e) < 0 ? i31 + 2 | 0 : x; return x$0; } if((i31 + 1 | 0) < l){ var c = i31 + 1 | 0, f = caml_check_bound(a$0, c)[c + 1]; if(0 > caml_call2(cmp, caml_check_bound(a$0, i31)[i31 + 1], f)) return i31 + 1 | 0; } if(i31 < l) return i31; throw caml_maybe_attach_backtrace([0, Bottom, i], 1); } var l = a$0.length - 1, b = ((l + 1 | 0) / 3 | 0) - 1 | 0; if(b >= 0){ var i$5 = b; for(;;){ var e$1 = caml_check_bound(a$0, i$5)[i$5 + 1]; try{ var i = i$5; for(;;){ var j = maxson(l, i); if(0 >= caml_call2(cmp, caml_check_bound(a$0, j)[j + 1], e$1)){caml_check_bound(a$0, i)[i + 1] = e$1; break;} var g = caml_check_bound(a$0, j)[j + 1]; caml_check_bound(a$0, i)[i + 1] = g; i = j; } } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Bottom) throw caml_maybe_attach_backtrace(exn, 0); var i$0 = exn[2]; caml_check_bound(a$0, i$0)[i$0 + 1] = e$1; } var n = i$5 - 1 | 0; if(0 === i$5) break; i$5 = n; } } var c = l - 1 | 0; if(c >= 2){ var i$4 = c; a: for(;;){ var e$0 = caml_check_bound(a$0, i$4)[i$4 + 1]; a$0[i$4 + 1] = caml_check_bound(a$0, 0)[1]; try{ var i$1 = 0; for(;;){ var j$0 = maxson(i$4, i$1), h = caml_check_bound(a$0, j$0)[j$0 + 1]; caml_check_bound(a$0, i$1)[i$1 + 1] = h; i$1 = j$0; } } catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0[1] !== Bottom) throw caml_maybe_attach_backtrace(exn$0, 0); var i$2 = exn$0[2], i$3 = i$2; for(;;){ var father = (i$3 - 1 | 0) / 3 | 0; if(i$3 === father) throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); if (0 <= caml_call2(cmp, caml_check_bound(a$0, father)[father + 1], e$0)) caml_check_bound(a$0, i$3)[i$3 + 1] = e$0; else{ var k = caml_check_bound(a$0, father)[father + 1]; caml_check_bound(a$0, i$3)[i$3 + 1] = k; if(0 < father){i$3 = father; continue;} caml_check_bound(a$0, 0)[1] = e$0; } var m = i$4 - 1 | 0; if(2 === i$4) break a; i$4 = m; break; } } } } var d = 1 < l ? 1 : 0; if(d){ var e = caml_check_bound(a$0, 1)[2]; a$0[2] = caml_check_bound(a$0, 0)[1]; a$0[1] = e; var f = 0; } else var f = d; return f; } function stable_sort(cmp, a){ function merge(src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs){ var src1r = src1ofs + src1len | 0, src2r = src2ofs + src2len | 0, s2$1 = caml_check_bound(src2, src2ofs)[src2ofs + 1], s1$1 = caml_check_bound(a, src1ofs)[src1ofs + 1], i1 = src1ofs, s1 = s1$1, i2 = src2ofs, s2 = s2$1, d = dstofs; for(;;) if(0 < caml_call2(cmp, s1, s2)){ caml_check_bound(dst, d)[d + 1] = s2; var i2$0 = i2 + 1 | 0; if(i2$0 >= src2r) return blit(a, i1, dst, d + 1 | 0, src1r - i1 | 0); var d$0 = d + 1 | 0, s2$0 = caml_check_bound(src2, i2$0)[i2$0 + 1]; i2 = i2$0; s2 = s2$0; d = d$0; } else{ caml_check_bound(dst, d)[d + 1] = s1; var i1$0 = i1 + 1 | 0; if(i1$0 >= src1r) return blit(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); var d$1 = d + 1 | 0, s1$0 = caml_check_bound(a, i1$0)[i1$0 + 1]; i1 = i1$0; s1 = s1$0; d = d$1; } } function isortto(srcofs, dst, dstofs, len){ var b = len - 1 | 0; if(b >= 0){ var i = 0; a: for(;;){ var c = srcofs + i | 0, e = caml_check_bound(a, c)[c + 1], j = (dstofs + i | 0) - 1 | 0; for(;;){ if (dstofs <= j && 0 < caml_call2(cmp, caml_check_bound(dst, j)[j + 1], e)){ var d = j + 1 | 0, g = caml_check_bound(dst, j)[j + 1]; caml_check_bound(dst, d)[d + 1] = g; var j$0 = j - 1 | 0; j = j$0; continue; } var f = j + 1 | 0; caml_check_bound(dst, f)[f + 1] = e; var h = i + 1 | 0; if(b === i) break a; i = h; break; } } } return 0; } function sortto(srcofs, dst, dstofs, len){ if(len <= 5) return isortto(srcofs, dst, dstofs, len); var l1 = len / 2 | 0, l2 = len - l1 | 0; sortto(srcofs + l1 | 0, dst, dstofs + l1 | 0, l2); sortto(srcofs, a, srcofs + l2 | 0, l1); return merge(srcofs + l2 | 0, l1, dst, dstofs + l1 | 0, l2, dst, dstofs); } var l = a.length - 1; if(l <= 5) return isortto(0, a, 0, l); var l1 = l / 2 | 0, l2 = l - l1 | 0, t = caml_make_vect(l2, caml_check_bound(a, 0)[1]); sortto(l1, t, 0, l2); sortto(0, a, l2, l1); return merge(l2, l1, t, 0, l2, a, 0); } function shuffle(rand, a){ var b = a.length - 2 | 0; if(b >= 1){ var i = b; for(;;){ var j = caml_call1(rand, i + 1 | 0), v = a[i + 1]; a[i + 1] = caml_check_bound(a, j)[j + 1]; a[j + 1] = v; var c = i - 1 | 0; if(1 === i) break; i = c; } } return 0; } function to_seq(a){ function aux(i, param){ if(i >= a.length - 1) return 0; var x = a[i + 1], b = i + 1 | 0; return [0, x, function(a){return aux(b, a);}]; } return function(a){return aux(0, a);}; } function to_seqi(a){ function aux(i, param){ if(i >= a.length - 1) return 0; var x = a[i + 1], b = i + 1 | 0; return [0, [0, i, x], function(a){return aux(b, a);}]; } return function(a){return aux(0, a);}; } function of_seq(i$2){ var l = Stdlib_Seq[5].call(null, function(acc, x){return [0, x, acc];}, 0, i$2); if(! l) return [0]; var tl = l[2], hd = l[1], len = list_length(0, l), a = caml_make_vect(len, hd), i$1 = len - 2 | 0, i = i$1, param = tl; for(;;){ if(! param) return a; var tl$0 = param[2], hd$0 = param[1]; a[i + 1] = hd$0; var i$0 = i - 1 | 0; i = i$0; param = tl$0; } } var Stdlib_Array = [0, init, make_matrix, init_matrix, append, runtime.caml_array_concat, sub, copy, fill, blit, to_list, of_list, iter, iteri, map, map_inplace, mapi, mapi_inplace, fold_left, fold_left_map, fold_right, iter2, map2, for_all, exists, for_all2, exists2, mem, memq, find_opt, find_index, find_map, find_mapi, split, combine, sort, stable_sort, stable_sort, shuffle, to_seq, to_seqi, of_seq, [0]]; runtime.caml_register_global(16, Stdlib_Array, "Stdlib__Array"); return; } (globalThis)); //# 6179 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Float:[N,N,N,F(1)*,F(1)*,N,N,N,N,N,N,N,N,N,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1),F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,F(1)*,N,N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_float_compare = runtime.caml_float_compare, caml_floatarray_blit = runtime.caml_floatarray_blit, caml_floatarray_create = runtime.caml_floatarray_create, caml_hash = runtime.caml_hash, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_nextafter_float = runtime.caml_nextafter_float, caml_signbit_float = runtime.caml_signbit_float, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib_Seq = global_data.Stdlib__Seq, Stdlib_List = global_data.Stdlib__List, Assert_failure = global_data.Assert_failure, Stdlib = global_data.Stdlib, infinity = Stdlib[22], neg_infinity = Stdlib[23], nan = Stdlib[24]; function is_finite(x){return x - x === 0. ? 1 : 0;} function is_infinite(x){return 1. / x === 0. ? 1 : 0;} function is_nan(x){return x !== x ? 1 : 0;} var max_float = Stdlib[25], min_float = Stdlib[26], epsilon = Stdlib[27], of_string_opt = Stdlib[36], to_string = Stdlib[35]; function is_integer(x){ var a = x === runtime.caml_trunc_float(x) ? 1 : 0; return a ? is_finite(x) : a; } function succ(x){return caml_nextafter_float(x, infinity);} function pred(x){return caml_nextafter_float(x, neg_infinity);} function equal(x, y){return 0 === caml_float_compare(x, y) ? 1 : 0;} function min(x, y){ a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return x !== x ? x : y; } return y !== y ? y : x; } function max(x, y){ a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return y !== y ? y : x; } return x !== x ? x : y; } function min_max(x, y){ if(x === x && y === y){ a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return [0, y, x]; } return [0, x, y]; } return [0, nan, nan]; } function min_num(x, y){ a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return y !== y ? x : y; } return x !== x ? y : x; } function max_num(x, y){ a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return x !== x ? y : x; } return y !== y ? x : y; } function min_max_num(x, y){ if(x !== x) return [0, y, y]; if(y !== y) return [0, x, x]; a: if(! (x < y)){ if(! caml_signbit_float(y) && caml_signbit_float(x)) break a; return [0, y, x]; } return [0, x, y]; } function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} function unsafe_fill(a, ofs, len, v){ var b = (ofs + len | 0) - 1 | 0; if(b >= ofs){ var i = ofs; for(;;){a[i + 1] = v; var c = i + 1 | 0; if(b === i) break; i = c;} } return 0; } function check(a, ofs, len, msg){ var c = ofs < 0 ? 1 : 0; if(c) var b = c; else{ var d = len < 0 ? 1 : 0; if(d) var b = d; else var e = (ofs + len | 0) < 0 ? 1 : 0, b = e || (a.length - 1 < (ofs + len | 0) ? 1 : 0); } return b ? Stdlib[1].call(null, msg) : b; } function make(n, v){ var result = caml_floatarray_create(n); unsafe_fill(result, 0, n, v); return result; } function init(l, f){ if(0 > l) return Stdlib[1].call(null, "Float.Array.init"); var res = caml_floatarray_create(l), a = l - 1 | 0; if(a >= 0){ var i = 0; for(;;){ res[i + 1] = caml_call1(f, i); var b = i + 1 | 0; if(a === i) break; i = b; } } return res; } function make_matrix(sx, sy, v){ if(sy < 0) Stdlib[1].call(null, "Float.Array.make_matrix"); var res = caml_make_vect(sx, caml_floatarray_create(0)); if(0 < sy){ var a = sx - 1 | 0; if(a >= 0){ var x = 0; for(;;){ res[x + 1] = make(sy, v); var b = x + 1 | 0; if(a === x) break; x = b; } } } return res; } function init_matrix(sx, sy, f){ if(sy < 0) Stdlib[1].call(null, "Float.Array.init_matrix"); var res = caml_make_vect(sx, caml_floatarray_create(0)); if(0 < sy){ var a = sx - 1 | 0; if(a >= 0){ var x = 0; for(;;){ var row = caml_floatarray_create(sy), b = sy - 1 | 0; if(b >= 0){ var y = 0; for(;;){ row[y + 1] = caml_call2(f, x, y); var d = y + 1 | 0; if(b === y) break; y = d; } } res[x + 1] = row; var c = x + 1 | 0; if(a === x) break; x = c; } } } return res; } function append(a1, a2){ var l1 = a1.length - 1, l2 = a2.length - 1, result = caml_floatarray_create(l1 + l2 | 0); caml_floatarray_blit(a1, 0, result, 0, l1); caml_floatarray_blit(a2, 0, result, l1, l2); return result; } var cst_float_ml = "float.ml", a = [0, cst_float_ml, 254, 14]; function concat(l){ var acc = 0, param = l; for(;;){ if(! param) break; var tl = param[2], hd = param[1], x = hd.length - 1 + acc | 0; if(acc <= x){ acc = x; param = tl; } else{acc = Stdlib[1].call(null, "Float.Array.concat"); param = tl;} } var result = caml_floatarray_create(acc), l$0 = l, i = 0; for(;;){ if(! l$0){ if(i === acc) return result; throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); } var tl$0 = l$0[2], hd$0 = l$0[1], hlen = hd$0.length - 1; caml_floatarray_blit(hd$0, 0, result, i, hlen); var i$0 = i + hlen | 0; l$0 = tl$0; i = i$0; } } function sub(a, ofs, len){ check(a, ofs, len, "Float.Array.sub"); var result = caml_floatarray_create(len); caml_floatarray_blit(a, ofs, result, 0, len); return result; } function copy(a){ var l = a.length - 1, result = caml_floatarray_create(l); caml_floatarray_blit(a, 0, result, 0, l); return result; } function fill(a, ofs, len, v){ check(a, ofs, len, "Float.Array.fill"); return unsafe_fill(a, ofs, len, v); } function blit(src, sofs, dst, dofs, len){ var cst_Float_array_blit = "Float.array.blit"; check(src, sofs, len, cst_Float_array_blit); check(dst, dofs, len, cst_Float_array_blit); return caml_floatarray_blit(src, sofs, dst, dofs, len); } function to_list(a){ return Stdlib_List[11].call (null, a.length - 1, function(b){return a[b + 1];}); } function of_list(l){ var result = caml_floatarray_create(Stdlib_List[1].call(null, l)), i = 0, l$0 = l; for(;;){ if(! l$0) return result; var t = l$0[2], h = l$0[1]; result[i + 1] = h; var i$0 = i + 1 | 0; i = i$0; l$0 = t; } } function iter(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function iter2(f, a, b){ if(a.length - 1 !== b.length - 1) return Stdlib[1].call (null, "Float.Array.iter2: arrays must have the same length"); var c = a.length - 2 | 0; if(c >= 0){ var i = 0; for(;;){ caml_call2(f, a[i + 1], b[i + 1]); var d = i + 1 | 0; if(c === i) break; i = d; } } return 0; } function map(f, a){ var l = a.length - 1, r = caml_floatarray_create(l), b = l - 1 | 0; if(b >= 0){ var i = 0; for(;;){ r[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } function map_inplace(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ a[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function map2(f, a, b){ var la = a.length - 1, lb = b.length - 1; if(la !== lb) return Stdlib[1].call (null, "Float.Array.map2: arrays must have the same length"); var r = caml_floatarray_create(la), c = la - 1 | 0; if(c >= 0){ var i = 0; for(;;){ r[i + 1] = caml_call2(f, a[i + 1], b[i + 1]); var d = i + 1 | 0; if(c === i) break; i = d; } } return r; } function iteri(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function mapi(f, a){ var l = a.length - 1, r = caml_floatarray_create(l), b = l - 1 | 0; if(b >= 0){ var i = 0; for(;;){ r[i + 1] = caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } function mapi_inplace(f, a){ var b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ a[i + 1] = caml_call2(f, i, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function fold_left(f, x, a){ var b = a.length - 2 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = 0; for(;;){ var c = caml_call2(f, r, a[i + 1]), d = i + 1 | 0; if(b === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function fold_right(f, a, x){ var b = a.length - 2 | 0; if(b < 0) var r$0 = x; else{ var r = x, i = b; for(;;){ var c = caml_call2(f, a[i + 1], r), d = i - 1 | 0; if(0 === i){var r$0 = c; break;} r = c; i = d; } } return r$0; } function exists(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(caml_call1(p, a[i + 1])) return 1; var i$0 = i + 1 | 0; i = i$0; } } function for_all(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 1; if(! caml_call1(p, a[i + 1])) return 0; var i$0 = i + 1 | 0; i = i$0; } } function mem(x, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(0 === caml_float_compare(a[i + 1], x)) return 1; var i$0 = i + 1 | 0; i = i$0; } } function mem_ieee(x, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(x === a[i + 1]) return 1; var i$0 = i + 1 | 0; i = i$0; } } function find_opt(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var x = a[i + 1]; if(caml_call1(p, x)) return [0, x]; var i$0 = i + 1 | 0; i = i$0; } } function find_index(p, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; if(caml_call1(p, a[i + 1])) return [0, i]; var i$0 = i + 1 | 0; i = i$0; } } function find_map(f, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var r = caml_call1(f, a[i + 1]); if(r) return r; var i$0 = i + 1 | 0; i = i$0; } } function find_mapi(f, a){ var n = a.length - 1, i = 0; for(;;){ if(i === n) return 0; var r = caml_call2(f, i, a[i + 1]); if(r) return r; var i$0 = i + 1 | 0; i = i$0; } } var Bottom = [248, "Stdlib.Float.Array.Bottom", runtime.caml_fresh_oo_id(0)], b = [0, cst_float_ml, 484, 6]; function sort(cmp, a){ function maxson(l, i){ var i31 = ((i + i | 0) + i | 0) + 1 | 0; if((i31 + 2 | 0) < l){ var b = i31 + 1 | 0, e = caml_check_bound(a, b)[b + 1], x = caml_call2(cmp, caml_check_bound(a, i31)[i31 + 1], e) < 0 ? i31 + 1 | 0 : i31, c = i31 + 2 | 0, f = caml_check_bound(a, c)[c + 1], x$0 = caml_call2(cmp, caml_check_bound(a, x)[x + 1], f) < 0 ? i31 + 2 | 0 : x; return x$0; } if((i31 + 1 | 0) < l){ var d = i31 + 1 | 0, g = caml_check_bound(a, d)[d + 1]; if(0 > caml_call2(cmp, caml_check_bound(a, i31)[i31 + 1], g)) return i31 + 1 | 0; } if(i31 < l) return i31; throw caml_maybe_attach_backtrace([0, Bottom, i], 1); } var l = a.length - 1, c = ((l + 1 | 0) / 3 | 0) - 1 | 0; if(c >= 0){ var i$5 = c; for(;;){ var e$1 = caml_check_bound(a, i$5)[i$5 + 1]; try{ var i = i$5; for(;;){ var j = maxson(l, i); if(0 >= caml_call2(cmp, caml_check_bound(a, j)[j + 1], e$1)){caml_check_bound(a, i)[i + 1] = e$1; break;} var h = caml_check_bound(a, j)[j + 1]; caml_check_bound(a, i)[i + 1] = h; i = j; } } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Bottom) throw caml_maybe_attach_backtrace(exn, 0); var i$0 = exn[2]; caml_check_bound(a, i$0)[i$0 + 1] = e$1; } var o = i$5 - 1 | 0; if(0 === i$5) break; i$5 = o; } } var d = l - 1 | 0; if(d >= 2){ var i$4 = d; a: for(;;){ var e$0 = caml_check_bound(a, i$4)[i$4 + 1]; a[i$4 + 1] = caml_check_bound(a, 0)[1]; try{ var i$1 = 0; for(;;){ var j$0 = maxson(i$4, i$1), k = caml_check_bound(a, j$0)[j$0 + 1]; caml_check_bound(a, i$1)[i$1 + 1] = k; i$1 = j$0; } } catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0[1] !== Bottom) throw caml_maybe_attach_backtrace(exn$0, 0); var i$2 = exn$0[2], i$3 = i$2; for(;;){ var father = (i$3 - 1 | 0) / 3 | 0; if(i$3 === father) throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); if(0 <= caml_call2(cmp, caml_check_bound(a, father)[father + 1], e$0)) caml_check_bound(a, i$3)[i$3 + 1] = e$0; else{ var m = caml_check_bound(a, father)[father + 1]; caml_check_bound(a, i$3)[i$3 + 1] = m; if(0 < father){i$3 = father; continue;} caml_check_bound(a, 0)[1] = e$0; } var n = i$4 - 1 | 0; if(2 === i$4) break a; i$4 = n; break; } } } } var f = 1 < l ? 1 : 0; if(f){ var e = caml_check_bound(a, 1)[2]; a[2] = caml_check_bound(a, 0)[1]; a[1] = e; var g = 0; } else var g = f; return g; } function stable_sort(cmp, a){ function merge(src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs){ var src1r = src1ofs + src1len | 0, src2r = src2ofs + src2len | 0, s2$1 = caml_check_bound(src2, src2ofs)[src2ofs + 1], s1$1 = caml_check_bound(a, src1ofs)[src1ofs + 1], i1 = src1ofs, s1 = s1$1, i2 = src2ofs, s2 = s2$1, d = dstofs; for(;;) if(0 < caml_call2(cmp, s1, s2)){ caml_check_bound(dst, d)[d + 1] = s2; var i2$0 = i2 + 1 | 0; if(i2$0 >= src2r) return blit(a, i1, dst, d + 1 | 0, src1r - i1 | 0); var d$0 = d + 1 | 0, s2$0 = caml_check_bound(src2, i2$0)[i2$0 + 1]; i2 = i2$0; s2 = s2$0; d = d$0; } else{ caml_check_bound(dst, d)[d + 1] = s1; var i1$0 = i1 + 1 | 0; if(i1$0 >= src1r) return blit(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); var d$1 = d + 1 | 0, s1$0 = caml_check_bound(a, i1$0)[i1$0 + 1]; i1 = i1$0; s1 = s1$0; d = d$1; } } function isortto(srcofs, dst, dstofs, len){ var b = len - 1 | 0; if(b >= 0){ var i = 0; a: for(;;){ var c = srcofs + i | 0, e = caml_check_bound(a, c)[c + 1], j = (dstofs + i | 0) - 1 | 0; for(;;){ if (dstofs <= j && 0 < caml_call2(cmp, caml_check_bound(dst, j)[j + 1], e)){ var d = j + 1 | 0, g = caml_check_bound(dst, j)[j + 1]; caml_check_bound(dst, d)[d + 1] = g; var j$0 = j - 1 | 0; j = j$0; continue; } var f = j + 1 | 0; caml_check_bound(dst, f)[f + 1] = e; var h = i + 1 | 0; if(b === i) break a; i = h; break; } } } return 0; } function sortto(srcofs, dst, dstofs, len){ if(len <= 5) return isortto(srcofs, dst, dstofs, len); var l1 = len / 2 | 0, l2 = len - l1 | 0; sortto(srcofs + l1 | 0, dst, dstofs + l1 | 0, l2); sortto(srcofs, a, srcofs + l2 | 0, l1); return merge(srcofs + l2 | 0, l1, dst, dstofs + l1 | 0, l2, dst, dstofs); } var l = a.length - 1; if(l <= 5) return isortto(0, a, 0, l); var l1 = l / 2 | 0, l2 = l - l1 | 0, t = caml_floatarray_create(l2); sortto(l1, t, 0, l2); sortto(0, a, l2, l1); return merge(l2, l1, t, 0, l2, a, 0); } function shuffle(rand, a){ var b = a.length - 2 | 0; if(b >= 1){ var i = b; for(;;){ var j = caml_call1(rand, i + 1 | 0), v = a[i + 1]; a[i + 1] = caml_check_bound(a, j)[j + 1]; a[j + 1] = v; var c = i - 1 | 0; if(1 === i) break; i = c; } } return 0; } function to_seq(a){ function aux(i, param){ if(i >= a.length - 1) return 0; var x = a[i + 1], b = i + 1 | 0; return [0, x, function(a){return aux(b, a);}]; } return function(a){return aux(0, a);}; } function to_seqi(a){ function aux(i, param){ if(i >= a.length - 1) return 0; var x = a[i + 1], b = i + 1 | 0; return [0, [0, i, x], function(a){return aux(b, a);}]; } return function(a){return aux(0, a);}; } function of_seq(i$2){ var l = Stdlib_Seq[5].call(null, function(acc, x){return [0, x, acc];}, 0, i$2), len = Stdlib_List[1].call(null, l), a = caml_floatarray_create(len), i$1 = len - 1 | 0, i = i$1, param = l; for(;;){ if(! param) return a; var tl = param[2], hd = param[1]; a[i + 1] = hd; var i$0 = i - 1 | 0; i = i$0; param = tl; } } function map_to_array(f, a){ var l = a.length - 1; if(0 === l) return [0]; var r = caml_make_vect(l, caml_call1(f, a[1])), b = l - 1 | 0; if(b >= 1){ var i = 1; for(;;){ r[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } function map_from_array(f, a){ var l = a.length - 1, r = caml_floatarray_create(l), b = l - 1 | 0; if(b >= 0){ var i = 0; for(;;){ r[i + 1] = caml_call1(f, a[i + 1]); var c = i + 1 | 0; if(b === i) break; i = c; } } return r; } var Stdlib_Float = [0, 0., 1., -1., succ, pred, infinity, neg_infinity, nan, NaN, nan, 3.141592653589793, max_float, min_float, epsilon, is_finite, is_infinite, is_nan, is_integer, of_string_opt, to_string, caml_float_compare, equal, min, max, min_max, min_num, max_num, min_max_num, seeded_hash, hash, [0, function(a){return a.length - 1;}, function(b, a){return caml_check_bound(b, a)[a + 1];}, function(c, a, b){caml_check_bound(c, a)[a + 1] = b; return 0;}, make, caml_floatarray_create, init, make_matrix, init_matrix, append, concat, sub, copy, fill, blit, to_list, of_list, iter, iteri, map, map_inplace, mapi, mapi_inplace, fold_left, fold_right, iter2, map2, for_all, exists, mem, mem_ieee, find_opt, find_index, find_map, find_mapi, sort, stable_sort, stable_sort, shuffle, to_seq, to_seqi, of_seq, map_to_array, map_from_array], [0, function(a){return a.length - 1;}, function(b, a){return caml_check_bound(b, a)[a + 1];}, function(c, a, b){caml_check_bound(c, a)[a + 1] = b; return 0;}, make, caml_floatarray_create, init, make_matrix, init_matrix, append, concat, sub, copy, fill, blit, to_list, of_list, iter, iteri, map, map_inplace, mapi, mapi_inplace, fold_left, fold_right, iter2, map2, for_all, exists, mem, mem_ieee, find_opt, find_index, find_map, find_mapi, sort, stable_sort, stable_sort, shuffle, to_seq, to_seqi, of_seq, map_to_array, map_from_array]]; runtime.caml_register_global(25, Stdlib_Float, "Stdlib__Float"); return; } (globalThis)); //# 7049 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Int32:[N,N,N,F(2),F(2),F(1)*,F(1)*,F(1),N,N,F(1)*,F(1),F(1),F(1)*,F(2)*,F(2)*,F(2),F(2),F(2),F(2)*,F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_greaterequal = runtime.caml_greaterequal, caml_hash = runtime.caml_hash, caml_int_compare = runtime.caml_int_compare, caml_lessequal = runtime.caml_lessequal, caml_lessthan = runtime.caml_lessthan, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_mul = runtime.caml_mul, caml_wrap_exception = runtime.caml_wrap_exception, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Sys = global_data.Stdlib__Sys, Assert_failure = global_data.Assert_failure; function succ(n){return n + 1 | 0;} function pred(n){return n - 1 | 0;} function abs(n){return caml_greaterequal(n, 0) ? n : - n | 0;} function lognot(n){return n ^ -1;} var match = Stdlib_Sys[9]; if(32 === match) var max_int = Stdlib[19], unsigned_to_int = function(n){ if(caml_greaterequal(n, 0) && caml_lessequal(n, max_int)) return [0, n]; return 0; }; else{ if(64 !== match) throw caml_maybe_attach_backtrace ([0, Assert_failure, [0, "int32.ml", 69, 6]], 1); var unsigned_to_int = function(n){return [0, n & -1];}; } function to_string(n){return runtime.caml_format_int("%d", n);} function of_string_opt(s){ try{var a = [0, runtime.caml_int_of_string(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] === Stdlib[7]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } var equal = runtime.caml_equal; function unsigned_compare(n, m){ var y = m + 2147483648 | 0, x = n + 2147483648 | 0; return caml_int_compare(x, y); } function unsigned_lt(n, m){ return caml_lessthan(n + 2147483648 | 0, m + 2147483648 | 0); } function min(x, y){return caml_lessequal(x, y) ? x : y;} function max(x, y){return caml_greaterequal(x, y) ? x : y;} var zero = 0, one = 1; function unsigned_div(n, d){ if(caml_lessthan(d, 0)) return unsigned_lt(n, d) ? zero : one; var q = runtime.caml_div(n >>> 1 | 0, d) << 1, r = n - caml_mul(q, d) | 0; return unsigned_lt(r, d) ? q : q + 1 | 0; } function unsigned_rem(n, d){ return n - caml_mul(unsigned_div(n, d), d) | 0; } function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} var Stdlib_Int32 = [0, zero, one, -1, unsigned_div, unsigned_rem, succ, pred, abs, 2147483647, -2147483648, lognot, unsigned_to_int, of_string_opt, to_string, caml_int_compare, unsigned_compare, equal, min, max, seeded_hash, hash]; runtime.caml_register_global(15, Stdlib_Int32, "Stdlib__Int32"); return; } (globalThis)); //# 7148 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Int64:[N,N,N,F(2),F(2),F(1)*,F(1)*,F(1),N,N,F(1)*,F(1),F(1),F(1)*,F(2)*,F(2)*,F(2),F(2),F(2),F(2)*,F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_greaterequal = runtime.caml_greaterequal, caml_hash = runtime.caml_hash, caml_int64_add = runtime.caml_int64_add, caml_int64_compare = runtime.caml_int64_compare, caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, caml_int64_mul = runtime.caml_int64_mul, caml_int64_sub = runtime.caml_int64_sub, caml_lessequal = runtime.caml_lessequal, caml_lessthan = runtime.caml_lessthan, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_wrap_exception = runtime.caml_wrap_exception, a = caml_int64_create_lo_mi_hi(1, 0, 0), zero = caml_int64_create_lo_mi_hi(0, 0, 0), one = caml_int64_create_lo_mi_hi(1, 0, 0), minus_one = caml_int64_create_lo_mi_hi(16777215, 16777215, 65535), min_int = caml_int64_create_lo_mi_hi(0, 0, 32768), max_int = caml_int64_create_lo_mi_hi(16777215, 16777215, 32767), Stdlib = runtime.caml_get_global_data().Stdlib, b = caml_int64_create_lo_mi_hi(1, 0, 0), c = caml_int64_create_lo_mi_hi(0, 0, 0), d = caml_int64_create_lo_mi_hi(16777215, 16777215, 65535); function succ(n){return caml_int64_add(n, a);} function pred(n){return caml_int64_sub(n, b);} function abs(n){ return caml_greaterequal(n, c) ? n : runtime.caml_int64_neg(n); } function lognot(n){return runtime.caml_int64_xor(n, d);} var max_int$0 = runtime.caml_int64_of_int32(Stdlib[19]), e = caml_int64_create_lo_mi_hi(0, 0, 0); function unsigned_to_int(n){ if(caml_greaterequal(n, e) && caml_lessequal(n, max_int$0)) return [0, runtime.caml_int64_to_int32(n)]; return 0; } function to_string(n){return runtime.caml_int64_format("%d", n);} function of_string_opt(s){ try{var a = [0, runtime.caml_int64_of_string(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] === Stdlib[7]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } function compare(x, y){return caml_int64_compare(x, y);} var equal = runtime.caml_equal; function unsigned_compare(n, m){ var y = caml_int64_sub(m, min_int), x = caml_int64_sub(n, min_int); return caml_int64_compare(x, y); } function unsigned_lt(n, m){ return caml_lessthan (caml_int64_sub(n, min_int), caml_int64_sub(m, min_int)); } function min(x, y){return caml_lessequal(x, y) ? x : y;} function max(x, y){return caml_greaterequal(x, y) ? x : y;} function unsigned_div(n, d){ if(caml_lessthan(d, zero)) return unsigned_lt(n, d) ? zero : one; var q = runtime.caml_int64_shift_left (runtime.caml_int64_div (runtime.caml_int64_shift_right_unsigned(n, 1), d), 1), r = caml_int64_sub(n, caml_int64_mul(q, d)); return unsigned_lt(r, d) ? q : caml_int64_add(q, a); } function unsigned_rem(n, d){ return caml_int64_sub(n, caml_int64_mul(unsigned_div(n, d), d)); } function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} runtime.caml_register_global (12, [0, zero, one, minus_one, unsigned_div, unsigned_rem, succ, pred, abs, max_int, min_int, lognot, unsigned_to_int, of_string_opt, to_string, compare, unsigned_compare, equal, min, max, seeded_hash, hash], "Stdlib__Int64"); return; } (globalThis)); //# 7257 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Nativeint:[N,N,N,F(2),F(2),F(1)*,F(1)*,F(1),N,N,N,F(1)*,F(1),F(1),F(1)*,F(2)*,F(2)*,F(2)*,F(2),F(2),F(2)*,F(1)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_greaterequal = runtime.caml_greaterequal, caml_hash = runtime.caml_hash, caml_int_compare = runtime.caml_int_compare, caml_lessequal = runtime.caml_lessequal, caml_lessthan = runtime.caml_lessthan, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_mul = runtime.caml_mul, caml_wrap_exception = runtime.caml_wrap_exception, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Sys = global_data.Stdlib__Sys; function succ(n){return n + 1 | 0;} function pred(n){return n - 1 | 0;} function abs(n){return caml_greaterequal(n, 0) ? n : - n | 0;} var size = Stdlib_Sys[9], min_int = 1 << (size - 1 | 0), max_int = min_int - 1 | 0; function lognot(n){return n ^ -1;} var max_int$0 = Stdlib[19]; function unsigned_to_int(n){ if(caml_greaterequal(n, 0) && caml_lessequal(n, max_int$0)) return [0, n]; return 0; } function to_string(n){return runtime.caml_format_int("%d", n);} function of_string_opt(s){ try{var a = [0, runtime.caml_int_of_string(s)]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] === Stdlib[7]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } function equal(x, y){return 0 === caml_int_compare(x, y) ? 1 : 0;} function unsigned_compare(n, m){ var y = m - min_int | 0, x = n - min_int | 0; return caml_int_compare(x, y); } function unsigned_lt(n, m){ return caml_lessthan(n - min_int | 0, m - min_int | 0); } function min(x, y){return caml_lessequal(x, y) ? x : y;} function max(x, y){return caml_greaterequal(x, y) ? x : y;} var zero = 0, one = 1; function unsigned_div(n, d){ if(caml_lessthan(d, 0)) return unsigned_lt(n, d) ? zero : one; var q = runtime.caml_div(n >>> 1 | 0, d) << 1, r = n - caml_mul(q, d) | 0; return unsigned_lt(r, d) ? q : q + 1 | 0; } function unsigned_rem(n, d){ return n - caml_mul(unsigned_div(n, d), d) | 0; } function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function hash(x){return caml_hash(10, 100, 0, x);} runtime.caml_register_global (13, [0, zero, one, -1, unsigned_div, unsigned_rem, succ, pred, abs, size, max_int, min_int, lognot, unsigned_to_int, of_string_opt, to_string, caml_int_compare, unsigned_compare, equal, min, max, seeded_hash, hash], "Stdlib__Nativeint"); return; } (globalThis)); //# 9638 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Buffer:[F(1)*,F(1),F(1),F(3),F(5),F(2),F(1)*,F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(4),F(4),F(3),F(2),F(3),F(1)*->F(1),F(1)*->F(1),F(2),F(1),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_blit_string = runtime.caml_blit_string, caml_bswap16 = runtime.caml_bswap16, caml_bytes_get = runtime.caml_bytes_get, caml_bytes_set = runtime.caml_bytes_set, caml_bytes_set16 = runtime.caml_bytes_set16, caml_bytes_set32 = runtime.caml_bytes_set32, caml_bytes_set64 = runtime.caml_bytes_set64, caml_bytes_unsafe_set = runtime.caml_bytes_unsafe_set, caml_create_bytes = runtime.caml_create_bytes, caml_int32_bswap = runtime.caml_int32_bswap, caml_int64_bswap = runtime.caml_int64_bswap, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_bytes_length = runtime.caml_ml_bytes_length, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_get = runtime.caml_string_get, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var global_data = runtime.caml_get_global_data(), Stdlib_Bytes = global_data.Stdlib__Bytes, Stdlib_Sys = global_data.Stdlib__Sys, Stdlib_Seq = global_data.Stdlib__Seq, Stdlib = global_data.Stdlib, Stdlib_String = global_data.Stdlib__String, Assert_failure = global_data.Assert_failure, dummy = 0; function create(n){ var n$0 = 1 <= n ? n : 1, n$1 = Stdlib_Sys[12] < n$0 ? Stdlib_Sys[12] : n$0, s = caml_create_bytes(n$1); return [0, [0, s, n$1], 0, s]; } function contents(b){return Stdlib_Bytes[8].call(null, b[1][1], 0, b[2]);} function to_bytes(b){return Stdlib_Bytes[7].call(null, b[1][1], 0, b[2]);} function sub(b, ofs, len){ if(0 <= ofs && 0 <= len && (b[2] - len | 0) >= ofs) return Stdlib_Bytes[8].call(null, b[1][1], ofs, len); return Stdlib[1].call(null, "Buffer.sub"); } function blit(src, srcoff, dst, dstoff, len){ if (0 <= len && 0 <= srcoff && (src[2] - len | 0) >= srcoff && 0 <= dstoff && (caml_ml_bytes_length(dst) - len | 0) >= dstoff) return Stdlib_Bytes[11].call(null, src[1][1], srcoff, dst, dstoff, len); return Stdlib[1].call(null, "Buffer.blit"); } function nth(b, ofs){ var position = b[2], match = b[1], length = match[2], buffer = match[1]; if(0 <= ofs && position > ofs && length >= position) return runtime.caml_bytes_unsafe_get(buffer, ofs); return Stdlib[1].call(null, "Buffer.nth"); } function length(b){return b[2];} function clear(b){b[2] = 0; return 0;} function reset(b){ b[2] = 0; var inner = [0, b[3], caml_ml_bytes_length(b[3])]; b[1] = inner; return 0; } function resize(b, more){ var old_pos = b[2], old_len = b[1][2], new_len = old_len; for(;;){ if(new_len >= (old_pos + more | 0)) break; new_len = 2 * new_len | 0; } var new_len$0 = Stdlib_Sys[12] < new_len ? (old_pos + more | 0) <= Stdlib_Sys[12] ? Stdlib_Sys[12] : (Stdlib[2].call(null, "Buffer.add: cannot grow buffer"), new_len) : new_len, new_buffer = caml_create_bytes(new_len$0); Stdlib_Bytes[11].call(null, b[1][1], 0, new_buffer, 0, b[2]); b[1] = [0, new_buffer, new_len$0]; } function add_char(b, c){ var pos = b[2], match = b[1], length = match[2], buffer = match[1]; if(length <= pos){ resize(b, 1); caml_bytes_set(b[1][1], b[2], c); } else caml_bytes_unsafe_set(buffer, pos, c); b[2] = pos + 1 | 0; return 0; } function add_utf_8_uchar(b, u){ for(;;){ var pos = b[2], uchar_utf_8_byte_length_max = 4; if(b[1][2] <= pos) resize(b, uchar_utf_8_byte_length_max); var n = Stdlib_Bytes[51].call(null, b[1][1], pos, u); if(0 !== n){b[2] = pos + n | 0; return 0;} resize(b, uchar_utf_8_byte_length_max); } } var uchar_utf_16_byte_length_max = 4; function add_utf_16be_uchar(b, u){ for(;;){ var pos = b[2]; if(b[1][2] <= pos) resize(b, uchar_utf_16_byte_length_max); var n = Stdlib_Bytes[54].call(null, b[1][1], pos, u); if(0 !== n){b[2] = pos + n | 0; return 0;} resize(b, uchar_utf_16_byte_length_max); } } function add_utf_16le_uchar(b, u){ for(;;){ var pos = b[2]; if(b[1][2] <= pos) resize(b, uchar_utf_16_byte_length_max); var n = Stdlib_Bytes[57].call(null, b[1][1], pos, u); if(0 !== n){b[2] = pos + n | 0; return 0;} resize(b, uchar_utf_16_byte_length_max); } } function add_substring(b, s, offset, len){ var a = offset < 0; if(a) var c = a; else var d = len < 0, c = d || (caml_ml_string_length(s) - len | 0) < offset; if(c) Stdlib[1].call(null, "Buffer.add_substring/add_subbytes"); var position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + len | 0; if(length < new_position){ resize(b, len); Stdlib_Bytes[12].call(null, s, offset, b[1][1], b[2], len); } else caml_blit_string(s, offset, buffer, position, len); b[2] = new_position; return 0; } function add_subbytes(b, s, offset, len){ return add_substring(b, Stdlib_Bytes[44].call(null, s), offset, len); } function add_string(b, s){ var len = caml_ml_string_length(s), position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + len | 0; if(length < new_position){ resize(b, len); Stdlib_Bytes[12].call(null, s, 0, b[1][1], b[2], len); } else caml_blit_string(s, 0, buffer, position, len); b[2] = new_position; return 0; } function add_bytes(b, s){ return add_string(b, Stdlib_Bytes[44].call(null, s)); } function add_buffer(b, bs){return add_subbytes(b, bs[1][1], 0, bs[2]);} function add_channel(b, ic, to_read$1){ var a = to_read$1 < 0, c = a || Stdlib_Sys[12] < to_read$1; if(c) Stdlib[1].call(null, "Buffer.add_channel"); if(b[1][2] < (b[2] + to_read$1 | 0)) resize(b, to_read$1); var ofs$1 = b[2], buf = b[1][1], already_read = 0, ofs = ofs$1, to_read = to_read$1; for(;;){ if(0 !== to_read){ var r = Stdlib[84].call(null, ic, buf, ofs, to_read); if(0 !== r){ var already_read$0 = already_read + r | 0, ofs$0 = ofs + r | 0, to_read$0 = to_read - r | 0; already_read = already_read$0; ofs = ofs$0; to_read = to_read$0; continue; } } b[2] = b[2] + already_read | 0; if(already_read < to_read$1) throw caml_maybe_attach_backtrace(Stdlib[12], 1); return 0; } } function output_buffer(oc, b){ return Stdlib[68].call(null, oc, b[1][1], 0, b[2]); } var a = [0, "buffer.ml", 220, 9]; function add_substitute(b, f, s){ var lim$1 = caml_ml_string_length(s), previous = 32, i$4 = 0; for(;;){ if(i$4 >= lim$1){ var c = 92 === previous ? 1 : 0; return c ? add_char(b, previous) : c; } var previous$0 = caml_string_get(s, i$4); if(36 === previous$0) if(92 === previous){ add_char(b, previous$0); var i$5 = i$4 + 1 | 0; previous = 32; i$4 = i$5; } else{ var start = i$4 + 1 | 0; try{ if(lim$1 <= start) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var opening = caml_string_get(s, start); a: { if(40 !== opening && 123 !== opening){ var lim$0 = caml_ml_string_length(s), i$2 = start; for(;;){ b: { if(lim$0 > i$2){ var match = caml_string_get(s, i$2); if(91 <= match){ if(97 <= match){ if(123 <= match){var stop$0 = i$2; break b;} } else if(95 !== match){var stop$0 = i$2; break b;} } else if(58 <= match){ if(65 > match){var stop$0 = i$2; break b;} } else if(48 > match){var stop$0 = i$2; break b;} var i$3 = i$2 + 1 | 0; i$2 = i$3; continue; } var stop$0 = lim$0; } if(stop$0 === start) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var val = [0, Stdlib_String[16].call(null, s, start, stop$0 - start | 0), stop$0]; break a; } } var new_start = start + 1 | 0; if(40 === opening) var closing = 41; else{ if(123 !== opening) throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); var closing = 125; } var lim = caml_ml_string_length(s), k = 0, stop = new_start; for(;;){ if(lim <= stop) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(caml_string_get(s, stop) === opening){ var i = stop + 1 | 0, k$0 = k + 1 | 0; k = k$0; stop = i; } else if(caml_string_get(s, stop) === closing){ if(0 === k){ var val = [0, Stdlib_String[16].call (null, s, new_start, (stop - start | 0) - 1 | 0), stop + 1 | 0]; break; } var i$0 = stop + 1 | 0, k$1 = k - 1 | 0; k = k$1; stop = i$0; } else{var i$1 = stop + 1 | 0; stop = i$1;} } } } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); add_char(b, 36); previous = 32; i$4 = start; continue; } var next_i = val[2], ident = val[1]; add_string(b, caml_call1(f, ident)); previous = 32; i$4 = next_i; } else{ if(92 === previous) add_char(b, previous); if(92 !== previous$0) add_char(b, previous$0); var i$6 = i$4 + 1 | 0; previous = previous$0; i$4 = i$6; } } } function truncate(b, len){ if(0 <= len && b[2] >= len){b[2] = len; return 0;} return Stdlib[1].call(null, "Buffer.truncate"); } function to_seq(b){ function aux(i, param){ if(b[2] <= i) return 0; var x = caml_bytes_get(b[1][1], i), a = i + 1 | 0; return [0, x, function(b){return aux(a, b);}]; } return function(a){return aux(0, a);}; } function to_seqi(b){ function aux(i, param){ if(b[2] <= i) return 0; var x = caml_bytes_get(b[1][1], i), a = i + 1 | 0; return [0, [0, i, x], function(b){return aux(a, b);}]; } return function(a){return aux(0, a);}; } function add_seq(b, seq){ return Stdlib_Seq[4].call(null, function(a){return add_char(b, a);}, seq); } function of_seq(i){var b = create(32); add_seq(b, i); return b;} function add_int8(b, x){ var position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + 1 | 0; if(length < new_position){ resize(b, 1); caml_bytes_set(b[1][1], b[2], x); } else caml_bytes_unsafe_set(buffer, position, x); b[2] = new_position; return 0; } function add_int16_ne(b, x){ var position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + 2 | 0; if(length < new_position){ resize(b, 2); caml_bytes_set16(b[1][1], b[2], x); } else caml_bytes_set16(buffer, position, x); b[2] = new_position; return 0; } function add_int32_ne(b, x){ var position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + 4 | 0; if(length < new_position){ resize(b, 4); caml_bytes_set32(b[1][1], b[2], x); } else caml_bytes_set32(buffer, position, x); b[2] = new_position; return 0; } function add_int64_ne(b, x){ var position = b[2], match = b[1], length = match[2], buffer = match[1], new_position = position + 8 | 0; if(length < new_position){ resize(b, 8); caml_bytes_set64(b[1][1], b[2], x); } else caml_bytes_set64(buffer, position, x); b[2] = new_position; return 0; } function add_int16_le(b, x){ var a = Stdlib_Sys[11] ? caml_bswap16(x) : x; return add_int16_ne(b, a); } function add_int16_be(b, x){ var x$0 = Stdlib_Sys[11] ? x : caml_bswap16(x); return add_int16_ne(b, x$0); } function add_int32_le(b, x){ var a = Stdlib_Sys[11] ? caml_int32_bswap(x) : x; return add_int32_ne(b, a); } function add_int32_be(b, x){ var x$0 = Stdlib_Sys[11] ? x : caml_int32_bswap(x); return add_int32_ne(b, x$0); } function add_int64_le(b, x){ var a = Stdlib_Sys[11] ? caml_int64_bswap(x) : x; return add_int64_ne(b, a); } function add_int64_be(b, x){ var x$0 = Stdlib_Sys[11] ? x : caml_int64_bswap(x); return add_int64_ne(b, x$0); } runtime.caml_register_global (14, [0, create, contents, to_bytes, sub, blit, nth, length, clear, reset, output_buffer, truncate, add_char, add_utf_8_uchar, add_utf_16le_uchar, add_utf_16be_uchar, add_string, add_bytes, add_substring, add_subbytes, add_substitute, add_buffer, add_channel, to_seq, to_seqi, add_seq, of_seq, add_int8, add_int8, add_int16_ne, add_int16_be, add_int16_le, add_int16_ne, add_int16_be, add_int16_le, add_int32_ne, add_int32_be, add_int32_le, add_int64_ne, add_int64_be, add_int64_le], "Stdlib__Buffer"); return; } (globalThis)); //# 10125 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Mutex:[F(1),F(1),F(1),F(1),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_mutex_lock = runtime.caml_ml_mutex_lock, caml_ml_mutex_unlock = runtime.caml_ml_mutex_unlock, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function protect(m, f){ caml_ml_mutex_lock(m); try{var x = caml_call1(f, 0);} catch(e$0){ var e = caml_wrap_exception(e$0); caml_ml_mutex_unlock(m); throw caml_maybe_attach_backtrace(e, 0); } caml_ml_mutex_unlock(m); return x; } var Stdlib_Mutex = [0, runtime.caml_ml_mutex_new, caml_ml_mutex_lock, runtime.caml_ml_mutex_try_lock, caml_ml_mutex_unlock, protect]; runtime.caml_register_global(0, Stdlib_Mutex, "Stdlib__Mutex"); return; } (globalThis)); //# 10165 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Condition:[F(1),F(2),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, Stdlib_Condition = [0, runtime.caml_ml_condition_new, runtime.caml_ml_condition_wait, runtime.caml_ml_condition_signal, runtime.caml_ml_condition_broadcast]; runtime.caml_register_global(0, Stdlib_Condition, "Stdlib__Condition"); return; } (globalThis)); //# 10264 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Domain:[F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_domain_dls_get = runtime.caml_domain_dls_get, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_domain_id = runtime.caml_ml_domain_id, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var dummy = 0, global_data = runtime.caml_get_global_data(), Stdlib_Condition = global_data.Stdlib__Condition, Stdlib_Mutex = global_data.Stdlib__Mutex, Stdlib_Atomic = global_data.Stdlib__Atomic, Stdlib = global_data.Stdlib, Stdlib_Array = global_data.Stdlib__Array, Stdlib_List = global_data.Stdlib__List, Assert_failure = global_data.Assert_failure; function cpu_relax(param){return runtime.caml_ml_domain_cpu_relax(0);} var none = [0, 0]; function create_dls(param){ var st = caml_make_vect(8, none); runtime.caml_domain_dls_set(st); } create_dls(0); var key_counter = Stdlib_Atomic[1].call(null, 0), parent_keys = Stdlib_Atomic[1].call(null, 0); function new_key(split_from_parent, init_orphan){ var idx = Stdlib_Atomic[7].call(null, key_counter, 1), k = [0, idx, init_orphan]; if(split_from_parent){ var split = split_from_parent[1], ki = [0, k, split]; for(;;){ var l = Stdlib_Atomic[3].call(null, parent_keys); if(! (1 - Stdlib_Atomic[6].call(null, parent_keys, l, [0, ki, l]))) break; } } return k; } function maybe_grow(idx){ for(;;){ var st = caml_domain_dls_get(0), sz = st.length - 1; if(idx < sz) return st; var new_sz = sz; for(;;){ if(idx < new_sz){ var new_st = caml_make_vect(new_sz, none); Stdlib_Array[9].call(null, st, 0, new_st, 0, sz); if(runtime.caml_domain_dls_compare_and_set(st, new_st)) return new_st; break; } var s = 2 * new_sz | 0; new_sz = s; } } } function set(param, x){ var idx = param[1], st = maybe_grow(idx); caml_check_bound(st, idx)[idx + 1] = x; return 0; } var a = [0, "domain.ml", 184, 13]; function get(param){ var init = param[2], idx = param[1], st = maybe_grow(idx), oldval = caml_check_bound(st, idx)[idx + 1]; if(oldval !== none) return oldval; var new_obj = caml_call1(init, 0), st$0 = caml_domain_dls_get(0), curval = caml_check_bound(st$0, idx)[idx + 1], b = curval === oldval ? (st$0[idx + 1] = new_obj, 1) : 0; if(b) return new_obj; var updated_obj = caml_check_bound(st$0, idx)[idx + 1]; if(updated_obj !== none) return updated_obj; throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); } function set_initial_keys(l){ return Stdlib_List[18].call (null, function(param){ var v = param[2], k = param[1]; return set(k, v); }, l); } function get_id(param){var domain = param[1]; return domain;} function self(param){return caml_ml_domain_id(0);} function is_main_domain(param){return 0 === caml_ml_domain_id(0) ? 1 : 0;} var first_domain_spawned = Stdlib_Atomic[1].call(null, 0), first_spawn_function = [0, function(param){}]; function before_first_spawn(f){ if(Stdlib_Atomic[3].call(null, first_domain_spawned)) throw caml_maybe_attach_backtrace ([0, Stdlib[6], "first domain already spawned"], 1); var old_f = first_spawn_function[1]; function new_f(param){caml_call1(old_f, 0); return caml_call1(f, 0);} first_spawn_function[1] = new_f; return 0; } var at_exit_key = new_key(0, function(param){return function(param){return 0;};}); function at_exit(f){ var old_exit = get(at_exit_key); function new_exit(param){ caml_call1(f, 0); return caml_call1(old_exit, 0); } return set(at_exit_key, new_exit); } function do_at_exit(param){ var f = get(at_exit_key); return caml_call1(f, 0); } Stdlib[104][1] = do_at_exit; function spawn(f){ if(1 - Stdlib_Atomic[3].call(null, first_domain_spawned)){ Stdlib_Atomic[4].call(null, first_domain_spawned, 1); caml_call1(first_spawn_function[1], 0); first_spawn_function[1] = function(param){return 0;}; } var a = Stdlib_Atomic[3].call(null, parent_keys), pk = Stdlib_List[20].call (null, function(param){ var split = param[2], k = param[1]; return [0, k, caml_call1(split, get(k))]; }, a), b = Stdlib_Condition[1].call(null, 0), term_sync = [0, 0, Stdlib_Mutex[1].call(null, 0), b]; function body(param){ try{create_dls(0); set_initial_keys(pk); var res = caml_call1(f, 0);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); try{do_at_exit(0);}catch(exn){} throw caml_maybe_attach_backtrace(exn, 0); } do_at_exit(0); return res; } var domain = runtime.caml_domain_spawn(body, term_sync); return [0, domain, term_sync]; } function join(param){ var term_sync = param[2]; function loop(param){ for(;;){ var match = term_sync[1]; if(match){var res = match[1]; return res;} Stdlib_Condition[2].call(null, term_sync[3], term_sync[2]); } } var match = Stdlib_Mutex[5].call(null, term_sync[2], loop); if(0 === match[0]){var x = match[1]; return x;} var ex = match[1]; throw caml_maybe_attach_backtrace(ex, 1); } var recommended_domain_count = runtime.caml_recommended_domain_count; runtime.caml_register_global (9, [0, spawn, join, get_id, self, before_first_spawn, at_exit, cpu_relax, is_main_domain, recommended_domain_count, [0, new_key, get, set]], "Stdlib__Domain"); return; } (globalThis)); //# 10461 "../.js/default/stdlib/stdlib.cma.js" //# shape: CamlinternalFormat:[F(2),F(1),F(1),F(2),F(1),F(2)*,F(3),F(3),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1),F(2),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_blit_string = runtime.caml_blit_string, caml_bytes_set = runtime.caml_bytes_set, caml_create_bytes = runtime.caml_create_bytes, caml_format_float = runtime.caml_format_float, caml_format_int = runtime.caml_format_int, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_notequal = runtime.caml_notequal, caml_string_get = runtime.caml_string_get, caml_string_unsafe_get = runtime.caml_string_unsafe_get, caml_trampoline = runtime.caml_trampoline, caml_trampoline_return = runtime.caml_trampoline_return, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } function caml_call4(f, a0, a1, a2, a3){ return (f.l >= 0 ? f.l : f.l = f.length) === 4 ? f(a0, a1, a2, a3) : runtime.caml_call_gen(f, [a0, a1, a2, a3]); } function caml_call5(f, a0, a1, a2, a3, a4){ return (f.l >= 0 ? f.l : f.l = f.length) === 5 ? f(a0, a1, a2, a3, a4) : runtime.caml_call_gen(f, [a0, a1, a2, a3, a4]); } var dummy = 0, global_data = runtime.caml_get_global_data(), Assert_failure = global_data.Assert_failure, CamlinternalFormatBasics = global_data.CamlinternalFormatBasics, Stdlib = global_data.Stdlib, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_String = global_data.Stdlib__String, Stdlib_Sys = global_data.Stdlib__Sys, Stdlib_Char = global_data.Stdlib__Char, Stdlib_Bytes = global_data.Stdlib__Bytes, Stdlib_Int = global_data.Stdlib__Int; function create_char_set(param){return Stdlib_Bytes[1].call(null, 32, 0);} function add_in_char_set(char_set, c){ var str_ind = c >>> 3 | 0, mask = 1 << (c & 7), a = runtime.caml_bytes_get(char_set, str_ind) | mask; return caml_bytes_set(char_set, str_ind, Stdlib[29].call(null, a)); } function freeze_char_set(char_set){ return Stdlib_Bytes[6].call(null, char_set); } function rev_char_set(char_set){ var char_set$0 = create_char_set(0), i = 0; for(;;){ var a = caml_string_get(char_set, i) ^ 255; caml_bytes_set(char_set$0, i, Stdlib[29].call(null, a)); var b = i + 1 | 0; if(31 === i) return Stdlib_Bytes[44].call(null, char_set$0); i = b; } } function is_in_char_set(char_set, c){ var str_ind = c >>> 3 | 0, mask = 1 << (c & 7); return 0 !== (caml_string_get(char_set, str_ind) & mask) ? 1 : 0; } function pad_of_pad_opt(pad_opt){ if(! pad_opt) return 0; var width = pad_opt[1]; return [0, 1, width]; } var a = [0, 0, 0]; function param_format_of_ignored_format(ign, fmt){ if(typeof ign === "number") switch(ign){ case 0: return [0, [0, fmt]]; case 1: return [0, [1, fmt]]; case 2: return [0, [19, fmt]]; default: return [0, [22, fmt]]; } switch(ign[0]){ case 0: var pad_opt = ign[1]; return [0, [2, pad_of_pad_opt(pad_opt), fmt]]; case 1: var pad_opt$0 = ign[1]; return [0, [3, pad_of_pad_opt(pad_opt$0), fmt]]; case 2: var pad_opt$1 = ign[2], iconv = ign[1]; return [0, [4, iconv, pad_of_pad_opt(pad_opt$1), 0, fmt]]; case 3: var pad_opt$2 = ign[2], iconv$0 = ign[1]; return [0, [5, iconv$0, pad_of_pad_opt(pad_opt$2), 0, fmt]]; case 4: var pad_opt$3 = ign[2], iconv$1 = ign[1]; return [0, [6, iconv$1, pad_of_pad_opt(pad_opt$3), 0, fmt]]; case 5: var pad_opt$4 = ign[2], iconv$2 = ign[1]; return [0, [7, iconv$2, pad_of_pad_opt(pad_opt$4), 0, fmt]]; case 6: var prec_opt = ign[2], pad_opt$5 = ign[1]; if(prec_opt) var ndec = prec_opt[1], b = [0, ndec]; else var b = 0; return [0, [8, a, pad_of_pad_opt(pad_opt$5), b, fmt]]; case 7: var pad_opt$6 = ign[1]; return [0, [9, pad_of_pad_opt(pad_opt$6), fmt]]; case 8: var fmtty = ign[2], pad_opt$7 = ign[1]; return [0, [13, pad_opt$7, fmtty, fmt]]; case 9: var fmtty$0 = ign[2], pad_opt$8 = ign[1]; return [0, [14, pad_opt$8, fmtty$0, fmt]]; case 10: var char_set = ign[2], width_opt = ign[1]; return [0, [20, width_opt, char_set, fmt]]; default: var counter = ign[1]; return [0, [21, counter, fmt]]; } } function default_float_precision(fconv){return 5 === fconv[2] ? 12 : -6;} function buffer_create(init_size){ return [0, 0, caml_create_bytes(init_size)]; } function buffer_check_size(buf, overhead){ var len = runtime.caml_ml_bytes_length(buf[2]), min_len = buf[1] + overhead | 0; if(len < min_len){ var new_len = Stdlib_Int[11].call(null, len * 2 | 0, min_len), new_str = caml_create_bytes(new_len); Stdlib_Bytes[11].call(null, buf[2], 0, new_str, 0, len); buf[2] = new_str; } } function buffer_add_char(buf, c){ buffer_check_size(buf, 1); caml_bytes_set(buf[2], buf[1], c); buf[1] = buf[1] + 1 | 0; } function buffer_add_string(buf, s){ var str_len = caml_ml_string_length(s); buffer_check_size(buf, str_len); Stdlib_String[6].call(null, s, 0, buf[2], buf[1], str_len); buf[1] = buf[1] + str_len | 0; } function buffer_contents(buf){ return Stdlib_Bytes[8].call(null, buf[2], 0, buf[1]); } function char_of_iconv(iconv){ switch(iconv){ case 6: case 7: return 120; case 8: case 9: return 88; case 10: case 11: return 111; case 12: case 15: return 117; case 0: case 1: case 2: case 13: return 100; default: return 105; } } function char_of_fconv(opt, fconv){ var cF = opt ? opt[1] : 70; switch(fconv[2]){ case 0: return 102; case 1: return 101; case 2: return 69; case 3: return 103; case 4: return 71; case 5: return cF; case 6: return 104; case 7: return 72; default: return 70; } } function bprint_char_set(buf, char_set){ function print_char(buf, i){ var c = Stdlib[29].call(null, i); return 37 === c ? (buffer_add_char(buf, 37), buffer_add_char(buf, 37)) : 64 === c ? (buffer_add_char(buf, 37), buffer_add_char(buf, 64)) : buffer_add_char(buf, c); } buffer_add_char(buf, 91); var set = is_in_char_set(char_set, 0) ? (buffer_add_char(buf, 94), rev_char_set(char_set)) : char_set; function is_alone(c){ var after = Stdlib_Char[1].call(null, c + 1 | 0), before = Stdlib_Char[1].call(null, c - 1 | 0), a = is_in_char_set(set, c); if(a) var b = is_in_char_set(set, before), e = b ? is_in_char_set(set, after) : b, d = 1 - e; else var d = a; return d; } if(is_alone(93)) buffer_add_char(buf, 93); var i = 1; a: for(;;){ b: if(i < 256){ if(! is_in_char_set(set, Stdlib[29].call(null, i))){var i$0 = i + 1 | 0; i = i$0; continue;} var switcher = Stdlib[29].call(null, i) - 45 | 0; if(48 < switcher >>> 0){ if(210 <= switcher){print_char(buf, 255); break b;} } else if(46 < switcher - 1 >>> 0){ var i$2 = i + 1 | 0; i = i$2; continue; } var i$1 = i + 1 | 0; if(! is_in_char_set(set, Stdlib[29].call(null, i$1))){ print_char(buf, i$1 - 1 | 0); var i$6 = i$1 + 1 | 0; i = i$6; continue; } var switcher$0 = Stdlib[29].call(null, i$1) - 45 | 0; if(48 < switcher$0 >>> 0){ if(210 <= switcher$0){ print_char(buf, 254); print_char(buf, 255); break b; } } else if (46 < switcher$0 - 1 >>> 0 && ! is_in_char_set(set, Stdlib[29].call(null, i$1 + 1 | 0))){ print_char(buf, i$1 - 1 | 0); var i$5 = i$1 + 1 | 0; i = i$5; continue; } if(! is_in_char_set(set, Stdlib[29].call(null, i$1 + 1 | 0))){ print_char(buf, i$1 - 1 | 0); print_char(buf, i$1); var i$4 = i$1 + 2 | 0; i = i$4; continue; } var j = i$1 + 2 | 0, i$3 = i$1 - 1 | 0, j$0 = j; for(;;){ if(256 !== j$0 && is_in_char_set(set, Stdlib[29].call(null, j$0))){var j$1 = j$0 + 1 | 0; j$0 = j$1; continue;} print_char(buf, i$3); print_char(buf, 45); print_char(buf, j$0 - 1 | 0); if(j$0 >= 256) break; var i$7 = j$0 + 1 | 0; i = i$7; continue a; } } if(is_alone(45)) buffer_add_char(buf, 45); return buffer_add_char(buf, 93); } } function bprint_padty(buf, padty){ switch(padty){ case 0: return buffer_add_char(buf, 45); case 1: return; default: return buffer_add_char(buf, 48); } } function bprint_ignored_flag(buf, ign_flag){ return ign_flag ? buffer_add_char(buf, 95) : ign_flag; } function bprint_pad_opt(buf, pad_opt){ if(! pad_opt) return; var width = pad_opt[1]; return buffer_add_string(buf, Stdlib_Int[12].call(null, width)); } function bprint_padding(buf, pad){ if(typeof pad === "number") return; if(0 === pad[0]){ var n = pad[2], padty = pad[1]; bprint_padty(buf, padty); return buffer_add_string(buf, Stdlib_Int[12].call(null, n)); } var padty$0 = pad[1]; bprint_padty(buf, padty$0); return buffer_add_char(buf, 42); } function bprint_precision(buf, prec){ if(typeof prec !== "number"){ var n = prec[1]; buffer_add_char(buf, 46); return buffer_add_string(buf, Stdlib_Int[12].call(null, n)); } if(prec) return buffer_add_string(buf, ".*"); } function bprint_iconv_flag(buf, iconv){ switch(iconv){ case 1: case 4: return buffer_add_char(buf, 43); case 2: case 5: return buffer_add_char(buf, 32); case 7: case 9: case 11: case 13: case 14: case 15: return buffer_add_char(buf, 35); default: return; } } function bprint_altint_fmt(buf, ign_flag, iconv, pad, prec, c){ buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_iconv_flag(buf, iconv); bprint_padding(buf, pad); bprint_precision(buf, prec); buffer_add_char(buf, c); return buffer_add_char(buf, char_of_iconv(iconv)); } function bprint_fconv_flag(buf, fconv){ switch(fconv[1]){ case 1: buffer_add_char(buf, 43); break; case 2: buffer_add_char(buf, 32); break; } if(8 <= fconv[2]) return buffer_add_char(buf, 35); } function string_of_formatting_lit(formatting_lit){ if(typeof formatting_lit === "number") switch(formatting_lit){ case 0: return "@]"; case 1: return "@}"; case 2: return "@?"; case 3: return "@\n"; case 4: return "@."; case 5: return "@@"; default: return "@%"; } if(2 === formatting_lit[0]){ var c = formatting_lit[1], a = Stdlib_String[1].call(null, 1, c); return Stdlib[28].call(null, "@", a); } var str = formatting_lit[1]; return str; } function bprint_char_literal(buf, chr){ return 37 === chr ? buffer_add_string(buf, "%%") : buffer_add_char(buf, chr); } function bprint_string_literal(buf, str){ var a = caml_ml_string_length(str) - 1 | 0; if(a >= 0){ var i = 0; for(;;){ bprint_char_literal(buf, caml_string_get(str, i)); var b = i + 1 | 0; if(a === i) break; i = b; } } } var cst_Li = "%Li", cst_i = "%i", cst_li = "%li", cst_ni = "%ni"; function bprint_fmtty(buf, fmtty$15){ var fmtty = fmtty$15; for(;;){ if(typeof fmtty === "number") return; switch(fmtty[0]){ case 0: var fmtty$0 = fmtty[1]; buffer_add_string(buf, "%c"); fmtty = fmtty$0; break; case 1: var fmtty$1 = fmtty[1]; buffer_add_string(buf, "%s"); fmtty = fmtty$1; break; case 2: var fmtty$2 = fmtty[1]; buffer_add_string(buf, cst_i); fmtty = fmtty$2; break; case 3: var fmtty$3 = fmtty[1]; buffer_add_string(buf, cst_li); fmtty = fmtty$3; break; case 4: var fmtty$4 = fmtty[1]; buffer_add_string(buf, cst_ni); fmtty = fmtty$4; break; case 5: var fmtty$5 = fmtty[1]; buffer_add_string(buf, cst_Li); fmtty = fmtty$5; break; case 6: var fmtty$6 = fmtty[1]; buffer_add_string(buf, "%f"); fmtty = fmtty$6; break; case 7: var fmtty$7 = fmtty[1]; buffer_add_string(buf, "%B"); fmtty = fmtty$7; break; case 8: var fmtty$8 = fmtty[2], sub_fmtty = fmtty[1]; buffer_add_string(buf, "%{"); bprint_fmtty(buf, sub_fmtty); buffer_add_string(buf, "%}"); fmtty = fmtty$8; break; case 9: var fmtty$9 = fmtty[3], sub_fmtty$0 = fmtty[1]; buffer_add_string(buf, "%("); bprint_fmtty(buf, sub_fmtty$0); buffer_add_string(buf, "%)"); fmtty = fmtty$9; break; case 10: var fmtty$10 = fmtty[1]; buffer_add_string(buf, "%a"); fmtty = fmtty$10; break; case 11: var fmtty$11 = fmtty[1]; buffer_add_string(buf, "%t"); fmtty = fmtty$11; break; case 12: var fmtty$12 = fmtty[1]; buffer_add_string(buf, "%?"); fmtty = fmtty$12; break; case 13: var fmtty$13 = fmtty[1]; buffer_add_string(buf, "%r"); fmtty = fmtty$13; break; default: var fmtty$14 = fmtty[1]; buffer_add_string(buf, "%_r"); fmtty = fmtty$14; } } } function int_of_custom_arity(param){ if(! param) return 0; var x = param[1]; return 1 + int_of_custom_arity(x) | 0; } var cst$0 = "@[", cst = "@{"; function string_of_fmt(fmt){ var buf = buffer_create(16); function fmtiter(fmt$1, ign_flag$0){ var fmt = fmt$1, ign_flag = ign_flag$0; for(;;){ if(typeof fmt === "number") return; switch(fmt[0]){ case 0: var rest = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 99); fmt = rest; ign_flag = 0; break; case 1: var rest$0 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 67); fmt = rest$0; ign_flag = 0; break; case 2: var rest$1 = fmt[2], pad = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_padding(buf, pad); buffer_add_char(buf, 115); fmt = rest$1; ign_flag = 0; break; case 3: var rest$2 = fmt[2], pad$0 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_padding(buf, pad$0); buffer_add_char(buf, 83); fmt = rest$2; ign_flag = 0; break; case 4: var rest$3 = fmt[4], prec = fmt[3], pad$1 = fmt[2], iconv = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_iconv_flag(buf, iconv); bprint_padding(buf, pad$1); bprint_precision(buf, prec); buffer_add_char(buf, char_of_iconv(iconv)); fmt = rest$3; ign_flag = 0; break; case 5: var rest$4 = fmt[4], prec$0 = fmt[3], pad$2 = fmt[2], iconv$0 = fmt[1]; bprint_altint_fmt(buf, ign_flag, iconv$0, pad$2, prec$0, 108); fmt = rest$4; ign_flag = 0; break; case 6: var rest$5 = fmt[4], prec$1 = fmt[3], pad$3 = fmt[2], iconv$1 = fmt[1]; bprint_altint_fmt(buf, ign_flag, iconv$1, pad$3, prec$1, 110); fmt = rest$5; ign_flag = 0; break; case 7: var rest$6 = fmt[4], prec$2 = fmt[3], pad$4 = fmt[2], iconv$2 = fmt[1]; bprint_altint_fmt(buf, ign_flag, iconv$2, pad$4, prec$2, 76); fmt = rest$6; ign_flag = 0; break; case 8: var rest$7 = fmt[4], prec$3 = fmt[3], pad$5 = fmt[2], fconv = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_fconv_flag(buf, fconv); bprint_padding(buf, pad$5); bprint_precision(buf, prec$3); buffer_add_char(buf, char_of_fconv(0, fconv)); fmt = rest$7; ign_flag = 0; break; case 9: var rest$8 = fmt[2], pad$6 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_padding(buf, pad$6); buffer_add_char(buf, 66); fmt = rest$8; ign_flag = 0; break; case 10: var rest$9 = fmt[1]; buffer_add_string(buf, "%!"); fmt = rest$9; break; case 11: var rest$10 = fmt[2], str = fmt[1]; bprint_string_literal(buf, str); fmt = rest$10; break; case 12: var rest$11 = fmt[2], chr = fmt[1]; bprint_char_literal(buf, chr); fmt = rest$11; break; case 13: var rest$12 = fmt[3], fmtty = fmt[2], pad_opt = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_pad_opt(buf, pad_opt); buffer_add_char(buf, 123); bprint_fmtty(buf, fmtty); buffer_add_char(buf, 37); buffer_add_char(buf, 125); fmt = rest$12; ign_flag = 0; break; case 14: var rest$13 = fmt[3], fmtty$0 = fmt[2], pad_opt$0 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_pad_opt(buf, pad_opt$0); buffer_add_char(buf, 40); bprint_fmtty(buf, fmtty$0); buffer_add_char(buf, 37); buffer_add_char(buf, 41); fmt = rest$13; ign_flag = 0; break; case 15: var rest$14 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 97); fmt = rest$14; ign_flag = 0; break; case 16: var rest$15 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 116); fmt = rest$15; ign_flag = 0; break; case 17: var rest$16 = fmt[2], fmting_lit = fmt[1]; bprint_string_literal(buf, string_of_formatting_lit(fmting_lit)); fmt = rest$16; break; case 18: var rest$17 = fmt[2], fmting_gen = fmt[1]; if(0 === fmting_gen[0]){ var str$0 = fmting_gen[1][2]; buffer_add_string(buf, cst); buffer_add_string(buf, str$0); fmt = rest$17; } else{ var str$1 = fmting_gen[1][2]; buffer_add_string(buf, cst$0); buffer_add_string(buf, str$1); fmt = rest$17; } break; case 19: var rest$18 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 114); fmt = rest$18; ign_flag = 0; break; case 20: var rest$19 = fmt[3], char_set = fmt[2], width_opt = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_pad_opt(buf, width_opt); bprint_char_set(buf, char_set); fmt = rest$19; ign_flag = 0; break; case 21: var rest$20 = fmt[2], counter = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); switch(counter){ case 0: var a = 108; break; case 1: var a = 110; break; default: var a = 78; } buffer_add_char(buf, a); fmt = rest$20; ign_flag = 0; break; case 22: var rest$21 = fmt[1]; buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); bprint_string_literal(buf, "0c"); fmt = rest$21; ign_flag = 0; break; case 23: var rest$22 = fmt[2], ign = fmt[1], fmt$0 = param_format_of_ignored_format(ign, rest$22)[1]; fmt = fmt$0; ign_flag = 1; break; default: var rest$23 = fmt[3], arity = fmt[1], b = int_of_custom_arity(arity); if(b >= 1){ var i = 1; for(;;){ buffer_add_char(buf, 37); bprint_ignored_flag(buf, ign_flag); buffer_add_char(buf, 63); var c = i + 1 | 0; if(b === i) break; i = c; } } fmt = rest$23; ign_flag = 0; } } } fmtiter(fmt, 0); return buffer_contents(buf); } function symm(param){ if(typeof param === "number") return 0; switch(param[0]){ case 0: var rest = param[1]; return [0, symm(rest)]; case 1: var rest$0 = param[1]; return [1, symm(rest$0)]; case 2: var rest$1 = param[1]; return [2, symm(rest$1)]; case 3: var rest$2 = param[1]; return [3, symm(rest$2)]; case 4: var rest$3 = param[1]; return [4, symm(rest$3)]; case 5: var rest$4 = param[1]; return [5, symm(rest$4)]; case 6: var rest$5 = param[1]; return [6, symm(rest$5)]; case 7: var rest$6 = param[1]; return [7, symm(rest$6)]; case 8: var rest$7 = param[2], ty = param[1]; return [8, ty, symm(rest$7)]; case 9: var rest$8 = param[3], ty2 = param[2], ty1 = param[1]; return [9, ty2, ty1, symm(rest$8)]; case 10: var rest$9 = param[1]; return [10, symm(rest$9)]; case 11: var rest$10 = param[1]; return [11, symm(rest$10)]; case 12: var rest$11 = param[1]; return [12, symm(rest$11)]; case 13: var rest$12 = param[1]; return [13, symm(rest$12)]; default: var rest$13 = param[1]; return [14, symm(rest$13)]; } } function fmtty_rel_det(param){ if(typeof param === "number") return [0, , function(param){}, , function(param){}]; switch(param[0]){ case 0: var rest = param[1], match = fmtty_rel_det(rest), de = match[4], af = match[2]; return [0, , function(param){af(0);}, , de]; case 1: var rest$0 = param[1], match$0 = fmtty_rel_det(rest$0), de$0 = match$0[4], af$0 = match$0[2]; return [0, , function(param){af$0(0);}, , de$0]; case 2: var rest$1 = param[1], match$1 = fmtty_rel_det(rest$1), de$1 = match$1[4], af$1 = match$1[2]; return [0, , function(param){af$1(0);}, , de$1]; case 3: var rest$2 = param[1], match$2 = fmtty_rel_det(rest$2), de$2 = match$2[4], af$2 = match$2[2]; return [0, , function(param){af$2(0);}, , de$2]; case 4: var rest$3 = param[1], match$3 = fmtty_rel_det(rest$3), de$3 = match$3[4], af$3 = match$3[2]; return [0, , function(param){af$3(0);}, , de$3]; case 5: var rest$4 = param[1], match$4 = fmtty_rel_det(rest$4), de$4 = match$4[4], af$4 = match$4[2]; return [0, , function(param){af$4(0);}, , de$4]; case 6: var rest$5 = param[1], match$5 = fmtty_rel_det(rest$5), de$5 = match$5[4], af$5 = match$5[2]; return [0, , function(param){af$5(0);}, , de$5]; case 7: var rest$6 = param[1], match$6 = fmtty_rel_det(rest$6), de$6 = match$6[4], af$6 = match$6[2]; return [0, , function(param){af$6(0);}, , de$6]; case 8: var rest$7 = param[2], match$7 = fmtty_rel_det(rest$7), de$7 = match$7[4], af$7 = match$7[2]; return [0, , function(param){af$7(0);}, , de$7]; case 9: var rest$8 = param[3], ty2 = param[2], ty1 = param[1], match$8 = fmtty_rel_det(rest$8), de$8 = match$8[4], af$8 = match$8[2], ty = trans(symm(ty1), ty2), match$9 = fmtty_rel_det(ty), jd = match$9[4], ga = match$9[2]; return [0, , function(param){ga(0); af$8(0);}, , function(param){jd(0); de$8(0);}]; case 10: var rest$9 = param[1], match$10 = fmtty_rel_det(rest$9), de$9 = match$10[4], af$9 = match$10[2]; return [0, , function(param){af$9(0);}, , de$9]; case 11: var rest$10 = param[1], match$11 = fmtty_rel_det(rest$10), de$10 = match$11[4], af$10 = match$11[2]; return [0, , function(param){af$10(0);}, , de$10]; case 12: var rest$11 = param[1], match$12 = fmtty_rel_det(rest$11), de$11 = match$12[4], af$11 = match$12[2]; return [0, , function(param){af$11(0);}, , de$11]; case 13: var rest$12 = param[1], match$13 = fmtty_rel_det(rest$12), de$12 = match$13[4], af$12 = match$13[2]; return [0, , function(param){af$12(0);}, , function(param){de$12(0);}]; default: var rest$13 = param[1], match$14 = fmtty_rel_det(rest$13), de$13 = match$14[4], af$13 = match$14[2]; return [0, , function(param){af$13(0);}, , function(param){de$13(0);}]; } } var cst_camlinternalFormat_ml = "camlinternalFormat.ml", b = [0, cst_camlinternalFormat_ml, 850, 23], c = [0, cst_camlinternalFormat_ml, 837, 26], d = [0, cst_camlinternalFormat_ml, 847, 28], e = [0, cst_camlinternalFormat_ml, 815, 21], f = [0, cst_camlinternalFormat_ml, 819, 21], g = [0, cst_camlinternalFormat_ml, 823, 19], h = [0, cst_camlinternalFormat_ml, 827, 22], i = [0, cst_camlinternalFormat_ml, 832, 30], j = [0, cst_camlinternalFormat_ml, 851, 23], k = [0, cst_camlinternalFormat_ml, 836, 26], l = [0, cst_camlinternalFormat_ml, 846, 28], m = [0, cst_camlinternalFormat_ml, 814, 21], n = [0, cst_camlinternalFormat_ml, 818, 21], o = [0, cst_camlinternalFormat_ml, 822, 19], p = [0, cst_camlinternalFormat_ml, 826, 22], q = [0, cst_camlinternalFormat_ml, 831, 30]; function trans(ty1, ty2){ a: { b: { c: { d: { e: { f: { g: { if(typeof ty1 !== "number"){ switch(ty1[0]){ case 0: var rest1 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 0: var rest2 = ty2[1]; return [0, trans(rest1, rest2)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 1: var rest1$0 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 1: var rest2$0 = ty2[1]; return [1, trans(rest1$0, rest2$0)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 2: var rest1$1 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 2: var rest2$1 = ty2[1]; return [2, trans(rest1$1, rest2$1)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 3: var rest1$2 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 3: var rest2$2 = ty2[1]; return [3, trans(rest1$2, rest2$2)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 4: var rest1$3 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 4: var rest2$3 = ty2[1]; return [4, trans(rest1$3, rest2$3)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 5: var rest1$4 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 5: var rest2$4 = ty2[1]; return [5, trans(rest1$4, rest2$4)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 6: var rest1$5 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 6: var rest2$5 = ty2[1]; return [6, trans(rest1$5, rest2$5)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 7: var rest1$6 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 7: var rest2$6 = ty2[1]; return [7, trans(rest1$6, rest2$6)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break g; } break; case 8: var rest1$7 = ty1[2], ty1$0 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 8: var rest2$7 = ty2[2], ty2$0 = ty2[1], a = trans(rest1$7, rest2$7); return [8, trans(ty1$0, ty2$0), a]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; } throw caml_maybe_attach_backtrace([0, Assert_failure, k], 1); case 9: var rest1$8 = ty1[3], ty12 = ty1[2], ty11 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 9: var rest2$8 = ty2[3], ty22 = ty2[2], ty21 = ty2[1], ty = trans(symm(ty12), ty21), match = fmtty_rel_det(ty), f4 = match[4], f2 = match[2]; f2(0); f4(0); return [9, ty11, ty22, trans(rest1$8, rest2$8)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; } throw caml_maybe_attach_backtrace([0, Assert_failure, l], 1); case 10: var rest1$9 = ty1[1]; if(typeof ty2 !== "number" && 10 === ty2[0]){ var rest2$9 = ty2[1]; return [10, trans(rest1$9, rest2$9)]; } throw caml_maybe_attach_backtrace([0, Assert_failure, m], 1); case 11: var rest1$10 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 11: var rest2$10 = ty2[1]; return [11, trans(rest1$10, rest2$10)]; case 10: break a; } throw caml_maybe_attach_backtrace([0, Assert_failure, n], 1); case 12: var rest1$11 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 12: var rest2$11 = ty2[1]; return [12, trans(rest1$11, rest2$11)]; case 10: break a; case 11: break b; } throw caml_maybe_attach_backtrace([0, Assert_failure, o], 1); case 13: var rest1$12 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 13: var rest2$12 = ty2[1]; return [13, trans(rest1$12, rest2$12)]; case 10: break a; case 11: break b; case 12: break c; } throw caml_maybe_attach_backtrace([0, Assert_failure, p], 1); default: var rest1$13 = ty1[1]; if(typeof ty2 !== "number") switch(ty2[0]){ case 14: var rest2$13 = ty2[1]; return [14, trans(rest1$13, rest2$13)]; case 10: break a; case 11: break b; case 12: break c; case 13: break d; } throw caml_maybe_attach_backtrace([0, Assert_failure, q], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, j], 1); } if(typeof ty2 === "number") return 0; switch(ty2[0]){ case 10: break a; case 11: break b; case 12: break c; case 13: break d; case 14: break e; case 8: break f; case 9: break; default: throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); } } throw caml_maybe_attach_backtrace([0, Assert_failure, d], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, i], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, h], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, g], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, f], 1); } throw caml_maybe_attach_backtrace([0, Assert_failure, e], 1); } function fmtty_of_fmt(fmtty$4){ var fmtty = fmtty$4; for(;;){ if(typeof fmtty === "number") return 0; switch(fmtty[0]){ case 4: var rest$1 = fmtty[4], prec = fmtty[3], pad$0 = fmtty[2], ty_rest = fmtty_of_fmt(rest$1), prec_ty = fmtty_of_precision_fmtty(prec, [2, ty_rest]); return fmtty_of_padding_fmtty(pad$0, prec_ty); case 5: var rest$2 = fmtty[4], prec$0 = fmtty[3], pad$1 = fmtty[2], ty_rest$0 = fmtty_of_fmt(rest$2), prec_ty$0 = fmtty_of_precision_fmtty(prec$0, [3, ty_rest$0]); return fmtty_of_padding_fmtty(pad$1, prec_ty$0); case 6: var rest$3 = fmtty[4], prec$1 = fmtty[3], pad$2 = fmtty[2], ty_rest$1 = fmtty_of_fmt(rest$3), prec_ty$1 = fmtty_of_precision_fmtty(prec$1, [4, ty_rest$1]); return fmtty_of_padding_fmtty(pad$2, prec_ty$1); case 7: var rest$4 = fmtty[4], prec$2 = fmtty[3], pad$3 = fmtty[2], ty_rest$2 = fmtty_of_fmt(rest$4), prec_ty$2 = fmtty_of_precision_fmtty(prec$2, [5, ty_rest$2]); return fmtty_of_padding_fmtty(pad$3, prec_ty$2); case 8: var rest$5 = fmtty[4], prec$3 = fmtty[3], pad$4 = fmtty[2], ty_rest$3 = fmtty_of_fmt(rest$5), prec_ty$3 = fmtty_of_precision_fmtty(prec$3, [6, ty_rest$3]); return fmtty_of_padding_fmtty(pad$4, prec_ty$3); case 9: var rest$6 = fmtty[2], pad$5 = fmtty[1]; return fmtty_of_padding_fmtty(pad$5, [7, fmtty_of_fmt(rest$6)]); case 10: var fmtty$0 = fmtty[1]; fmtty = fmtty$0; break; case 13: var rest$7 = fmtty[3], ty = fmtty[2]; return [8, ty, fmtty_of_fmt(rest$7)]; case 14: var rest$8 = fmtty[3], ty$0 = fmtty[2]; return [9, ty$0, ty$0, fmtty_of_fmt(rest$8)]; case 15: var rest$9 = fmtty[1]; return [10, fmtty_of_fmt(rest$9)]; case 16: var rest$10 = fmtty[1]; return [11, fmtty_of_fmt(rest$10)]; case 18: var rest$11 = fmtty[2], formatting_gen = fmtty[1], b = fmtty_of_fmt(rest$11); if(0 === formatting_gen[0]) var fmt = formatting_gen[1][1], a = fmtty_of_fmt(fmt); else var fmt$0 = formatting_gen[1][1], a = fmtty_of_fmt(fmt$0); return CamlinternalFormatBasics[1].call(null, a, b); case 19: var rest$12 = fmtty[1]; return [13, fmtty_of_fmt(rest$12)]; case 20: var rest$13 = fmtty[3]; return [1, fmtty_of_fmt(rest$13)]; case 21: var rest$14 = fmtty[2]; return [2, fmtty_of_fmt(rest$14)]; case 23: var fmtty$2 = fmtty[2], ign = fmtty[1]; if(typeof ign === "number"){ if(2 === ign) return [14, fmtty_of_fmt(fmtty$2)]; fmtty = fmtty$2; } else{ if(9 === ign[0]){ var fmtty$3 = ign[2], c = fmtty_of_fmt(fmtty$2); return CamlinternalFormatBasics[1].call(null, fmtty$3, c); } fmtty = fmtty$2; } break; case 24: var rest$15 = fmtty[3], arity = fmtty[1]; return fmtty_of_custom(arity, fmtty_of_fmt(rest$15)); case 2: case 3: var rest$0 = fmtty[2], pad = fmtty[1]; return fmtty_of_padding_fmtty(pad, [1, fmtty_of_fmt(rest$0)]); case 0: case 1: case 22: var rest = fmtty[1]; return [0, fmtty_of_fmt(rest)]; default: var fmtty$1 = fmtty[2]; fmtty = fmtty$1; } } } function fmtty_of_custom(arity, fmtty){ if(! arity) return fmtty; var arity$0 = arity[1]; return [12, fmtty_of_custom(arity$0, fmtty)]; } function fmtty_of_padding_fmtty(pad, fmtty){ return typeof pad === "number" ? fmtty : 0 === pad[0] ? fmtty : [2, fmtty]; } function fmtty_of_precision_fmtty(prec, fmtty){ return typeof prec === "number" ? prec ? [2, fmtty] : fmtty : fmtty; } var Type_mismatch = [248, "CamlinternalFormat.Type_mismatch", runtime.caml_fresh_oo_id(0)]; function type_padding(pad, fmtty){ if(typeof pad === "number") return [0, 0, fmtty]; if(0 === pad[0]){ var w = pad[2], padty = pad[1]; return [0, [0, padty, w], fmtty]; } if(typeof fmtty !== "number" && 2 === fmtty[0]){ var rest = fmtty[1], padty$0 = pad[1]; return [0, [1, padty$0], rest]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); } function type_padprec(pad, prec, fmtty){ var match = type_padding(pad, fmtty); if(typeof prec !== "number"){ var rest$1 = match[2], pad$2 = match[1], p = prec[1]; return [0, pad$2, [0, p], rest$1]; } if(! prec){ var rest$0 = match[2], pad$1 = match[1]; return [0, pad$1, 0, rest$0]; } var match$0 = match[2]; if(typeof match$0 !== "number" && 2 === match$0[0]){ var rest = match$0[1], pad$0 = match[1]; return [0, pad$0, 1, rest]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); } function type_format(fmt, fmtty){ var a = type_format_gen(fmt, fmtty); if(typeof a[2] !== "number") throw caml_maybe_attach_backtrace(Type_mismatch, 1); var fmt$0 = a[1]; return fmt$0; } function type_format_gen(fmt, fmtty0){ if(typeof fmt === "number") return [0, 0, fmtty0]; switch(fmt[0]){ case 0: if(typeof fmtty0 !== "number" && 0 === fmtty0[0]){ var fmtty_rest = fmtty0[1], fmt_rest = fmt[1], match = type_format_gen(fmt_rest, fmtty_rest), fmtty = match[2], fmt$0 = match[1]; return [0, [0, fmt$0], fmtty]; } break; case 1: if(typeof fmtty0 !== "number" && 0 === fmtty0[0]){ var fmtty_rest$0 = fmtty0[1], fmt_rest$0 = fmt[1], match$0 = type_format_gen(fmt_rest$0, fmtty_rest$0), fmtty$0 = match$0[2], fmt$1 = match$0[1]; return [0, [1, fmt$1], fmtty$0]; } break; case 2: var fmt_rest$1 = fmt[2], pad = fmt[1], match$1 = type_padding(pad, fmtty0), pad$0 = match$1[1], match$2 = match$1[2]; if(typeof match$2 !== "number" && 1 === match$2[0]){ var fmtty_rest$1 = match$2[1], match$3 = type_format_gen(fmt_rest$1, fmtty_rest$1), fmtty$1 = match$3[2], fmt$2 = match$3[1]; return [0, [2, pad$0, fmt$2], fmtty$1]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 3: var fmt_rest$2 = fmt[2], pad$1 = fmt[1], match$4 = type_padding(pad$1, fmtty0), pad$2 = match$4[1], match$5 = match$4[2]; if(typeof match$5 !== "number" && 1 === match$5[0]){ var fmtty_rest$2 = match$5[1], match$6 = type_format_gen(fmt_rest$2, fmtty_rest$2), fmtty$2 = match$6[2], fmt$3 = match$6[1]; return [0, [3, pad$2, fmt$3], fmtty$2]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 4: var fmt_rest$3 = fmt[4], prec = fmt[3], pad$3 = fmt[2], iconv = fmt[1], match$7 = type_padprec(pad$3, prec, fmtty0), pad$4 = match$7[1], match$8 = match$7[3]; if(typeof match$8 !== "number" && 2 === match$8[0]){ var fmtty_rest$3 = match$8[1], prec$0 = match$7[2], match$9 = type_format_gen(fmt_rest$3, fmtty_rest$3), fmtty$3 = match$9[2], fmt$4 = match$9[1]; return [0, [4, iconv, pad$4, prec$0, fmt$4], fmtty$3]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 5: var fmt_rest$4 = fmt[4], prec$1 = fmt[3], pad$5 = fmt[2], iconv$0 = fmt[1], match$10 = type_padprec(pad$5, prec$1, fmtty0), pad$6 = match$10[1], match$11 = match$10[3]; if(typeof match$11 !== "number" && 3 === match$11[0]){ var fmtty_rest$4 = match$11[1], prec$2 = match$10[2], match$12 = type_format_gen(fmt_rest$4, fmtty_rest$4), fmtty$4 = match$12[2], fmt$5 = match$12[1]; return [0, [5, iconv$0, pad$6, prec$2, fmt$5], fmtty$4]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 6: var fmt_rest$5 = fmt[4], prec$3 = fmt[3], pad$7 = fmt[2], iconv$1 = fmt[1], match$13 = type_padprec(pad$7, prec$3, fmtty0), pad$8 = match$13[1], match$14 = match$13[3]; if(typeof match$14 !== "number" && 4 === match$14[0]){ var fmtty_rest$5 = match$14[1], prec$4 = match$13[2], match$15 = type_format_gen(fmt_rest$5, fmtty_rest$5), fmtty$5 = match$15[2], fmt$6 = match$15[1]; return [0, [6, iconv$1, pad$8, prec$4, fmt$6], fmtty$5]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 7: var fmt_rest$6 = fmt[4], prec$5 = fmt[3], pad$9 = fmt[2], iconv$2 = fmt[1], match$16 = type_padprec(pad$9, prec$5, fmtty0), pad$10 = match$16[1], match$17 = match$16[3]; if(typeof match$17 !== "number" && 5 === match$17[0]){ var fmtty_rest$6 = match$17[1], prec$6 = match$16[2], match$18 = type_format_gen(fmt_rest$6, fmtty_rest$6), fmtty$6 = match$18[2], fmt$7 = match$18[1]; return [0, [7, iconv$2, pad$10, prec$6, fmt$7], fmtty$6]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 8: var fmt_rest$7 = fmt[4], prec$7 = fmt[3], pad$11 = fmt[2], fconv = fmt[1], match$19 = type_padprec(pad$11, prec$7, fmtty0), pad$12 = match$19[1], match$20 = match$19[3]; if(typeof match$20 !== "number" && 6 === match$20[0]){ var fmtty_rest$7 = match$20[1], prec$8 = match$19[2], match$21 = type_format_gen(fmt_rest$7, fmtty_rest$7), fmtty$7 = match$21[2], fmt$8 = match$21[1]; return [0, [8, fconv, pad$12, prec$8, fmt$8], fmtty$7]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 9: var fmt_rest$8 = fmt[2], pad$13 = fmt[1], match$22 = type_padding(pad$13, fmtty0), pad$14 = match$22[1], match$23 = match$22[2]; if(typeof match$23 !== "number" && 7 === match$23[0]){ var fmtty_rest$8 = match$23[1], match$24 = type_format_gen(fmt_rest$8, fmtty_rest$8), fmtty$8 = match$24[2], fmt$9 = match$24[1]; return [0, [9, pad$14, fmt$9], fmtty$8]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); case 10: var fmt_rest$9 = fmt[1], match$25 = type_format_gen(fmt_rest$9, fmtty0), fmtty$9 = match$25[2], fmt$10 = match$25[1]; return [0, [10, fmt$10], fmtty$9]; case 11: var fmt_rest$10 = fmt[2], str = fmt[1], match$26 = type_format_gen(fmt_rest$10, fmtty0), fmtty$10 = match$26[2], fmt$11 = match$26[1]; return [0, [11, str, fmt$11], fmtty$10]; case 12: var fmt_rest$11 = fmt[2], chr = fmt[1], match$27 = type_format_gen(fmt_rest$11, fmtty0), fmtty$11 = match$27[2], fmt$12 = match$27[1]; return [0, [12, chr, fmt$12], fmtty$11]; case 13: if(typeof fmtty0 !== "number" && 8 === fmtty0[0]){ var fmtty_rest$9 = fmtty0[2], sub_fmtty = fmtty0[1], fmt_rest$12 = fmt[3], sub_fmtty$0 = fmt[2], pad_opt = fmt[1]; if(caml_notequal([0, sub_fmtty$0], [0, sub_fmtty])) throw caml_maybe_attach_backtrace(Type_mismatch, 1); var match$28 = type_format_gen(fmt_rest$12, fmtty_rest$9), fmtty$12 = match$28[2], fmt$13 = match$28[1]; return [0, [13, pad_opt, sub_fmtty, fmt$13], fmtty$12]; } break; case 14: if(typeof fmtty0 !== "number" && 9 === fmtty0[0]){ var fmtty_rest$10 = fmtty0[3], sub_fmtty1 = fmtty0[1], fmt_rest$13 = fmt[3], sub_fmtty$1 = fmt[2], pad_opt$0 = fmt[1], b = [0, CamlinternalFormatBasics[2].call(null, sub_fmtty1)]; if (caml_notequal ([0, CamlinternalFormatBasics[2].call(null, sub_fmtty$1)], b)) throw caml_maybe_attach_backtrace(Type_mismatch, 1); var match$29 = type_format_gen (fmt_rest$13, CamlinternalFormatBasics[2].call(null, fmtty_rest$10)), fmtty$13 = match$29[2], fmt$14 = match$29[1]; return [0, [14, pad_opt$0, sub_fmtty1, fmt$14], fmtty$13]; } break; case 15: if(typeof fmtty0 !== "number" && 10 === fmtty0[0]){ var fmtty_rest$11 = fmtty0[1], fmt_rest$14 = fmt[1], match$30 = type_format_gen(fmt_rest$14, fmtty_rest$11), fmtty$14 = match$30[2], fmt$15 = match$30[1]; return [0, [15, fmt$15], fmtty$14]; } break; case 16: if(typeof fmtty0 !== "number" && 11 === fmtty0[0]){ var fmtty_rest$12 = fmtty0[1], fmt_rest$15 = fmt[1], match$31 = type_format_gen(fmt_rest$15, fmtty_rest$12), fmtty$15 = match$31[2], fmt$16 = match$31[1]; return [0, [16, fmt$16], fmtty$15]; } break; case 17: var fmt_rest$16 = fmt[2], formatting_lit = fmt[1], match$32 = type_format_gen(fmt_rest$16, fmtty0), fmtty$16 = match$32[2], fmt$17 = match$32[1]; return [0, [17, formatting_lit, fmt$17], fmtty$16]; case 18: var fmt_rest$17 = fmt[2], formatting_gen = fmt[1]; if(0 === formatting_gen[0]){ var match$36 = formatting_gen[1], str$0 = match$36[2], fmt1 = match$36[1], match$37 = type_format_gen(fmt1, fmtty0), fmtty2 = match$37[2], fmt2 = match$37[1], match$38 = type_format_gen(fmt_rest$17, fmtty2), fmtty3 = match$38[2], fmt3 = match$38[1]; return [0, [18, [0, [0, fmt2, str$0]], fmt3], fmtty3]; } var match$39 = formatting_gen[1], str$1 = match$39[2], fmt1$0 = match$39[1], match$40 = type_format_gen(fmt1$0, fmtty0), fmtty2$0 = match$40[2], fmt2$0 = match$40[1], match$41 = type_format_gen(fmt_rest$17, fmtty2$0), fmtty3$0 = match$41[2], fmt3$0 = match$41[1]; return [0, [18, [1, [0, fmt2$0, str$1]], fmt3$0], fmtty3$0]; case 19: if(typeof fmtty0 !== "number" && 13 === fmtty0[0]){ var fmtty_rest$13 = fmtty0[1], fmt_rest$18 = fmt[1], match$33 = type_format_gen(fmt_rest$18, fmtty_rest$13), fmtty$17 = match$33[2], fmt$18 = match$33[1]; return [0, [19, fmt$18], fmtty$17]; } break; case 20: if(typeof fmtty0 !== "number" && 1 === fmtty0[0]){ var fmtty_rest$14 = fmtty0[1], fmt_rest$19 = fmt[3], char_set = fmt[2], width_opt = fmt[1], match$34 = type_format_gen(fmt_rest$19, fmtty_rest$14), fmtty$18 = match$34[2], fmt$19 = match$34[1]; return [0, [20, width_opt, char_set, fmt$19], fmtty$18]; } break; case 21: if(typeof fmtty0 !== "number" && 2 === fmtty0[0]){ var fmtty_rest$15 = fmtty0[1], fmt_rest$20 = fmt[2], counter = fmt[1], match$35 = type_format_gen(fmt_rest$20, fmtty_rest$15), fmtty$19 = match$35[2], fmt$20 = match$35[1]; return [0, [21, counter, fmt$20], fmtty$19]; } break; case 23: var rest = fmt[2], ign = fmt[1]; if(typeof ign !== "number") switch(ign[0]){ case 8: var sub_fmtty$2 = ign[2], pad_opt$1 = ign[1]; return type_ignored_param_one ([8, pad_opt$1, sub_fmtty$2], rest, fmtty0); case 9: var sub_fmtty$3 = ign[2], pad_opt$2 = ign[1], a = type_ignored_format_substituti(sub_fmtty$3, rest, fmtty0), match$43 = a[2], fmtty$21 = match$43[2], fmt$22 = match$43[1], sub_fmtty$4 = a[1]; return [0, [23, [9, pad_opt$2, sub_fmtty$4], fmt$22], fmtty$21]; default: return type_ignored_param_one(ign, rest, fmtty0); } if(2 !== ign) return type_ignored_param_one(ign, rest, fmtty0); if(typeof fmtty0 !== "number" && 14 === fmtty0[0]){ var fmtty_rest$16 = fmtty0[1], match$42 = type_format_gen(rest, fmtty_rest$16), fmtty$20 = match$42[2], fmt$21 = match$42[1]; return [0, [23, 2, fmt$21], fmtty$20]; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); } throw caml_maybe_attach_backtrace(Type_mismatch, 1); } function type_ignored_param_one(ign, fmt, fmtty){ var match = type_format_gen(fmt, fmtty), fmtty$0 = match[2], fmt$0 = match[1]; return [0, [23, ign, fmt$0], fmtty$0]; } function type_ignored_format_substituti(sub_fmtty, fmt, fmtty){ if(typeof sub_fmtty === "number") return [0, 0, type_format_gen(fmt, fmtty)]; switch(sub_fmtty[0]){ case 0: if(typeof fmtty !== "number" && 0 === fmtty[0]){ var fmtty_rest = fmtty[1], sub_fmtty_rest = sub_fmtty[1], match = type_ignored_format_substituti(sub_fmtty_rest, fmt, fmtty_rest), fmt$0 = match[2], sub_fmtty_rest$0 = match[1]; return [0, [0, sub_fmtty_rest$0], fmt$0]; } break; case 1: if(typeof fmtty !== "number" && 1 === fmtty[0]){ var fmtty_rest$0 = fmtty[1], sub_fmtty_rest$1 = sub_fmtty[1], match$0 = type_ignored_format_substituti(sub_fmtty_rest$1, fmt, fmtty_rest$0), fmt$1 = match$0[2], sub_fmtty_rest$2 = match$0[1]; return [0, [1, sub_fmtty_rest$2], fmt$1]; } break; case 2: if(typeof fmtty !== "number" && 2 === fmtty[0]){ var fmtty_rest$1 = fmtty[1], sub_fmtty_rest$3 = sub_fmtty[1], match$1 = type_ignored_format_substituti(sub_fmtty_rest$3, fmt, fmtty_rest$1), fmt$2 = match$1[2], sub_fmtty_rest$4 = match$1[1]; return [0, [2, sub_fmtty_rest$4], fmt$2]; } break; case 3: if(typeof fmtty !== "number" && 3 === fmtty[0]){ var fmtty_rest$2 = fmtty[1], sub_fmtty_rest$5 = sub_fmtty[1], match$2 = type_ignored_format_substituti(sub_fmtty_rest$5, fmt, fmtty_rest$2), fmt$3 = match$2[2], sub_fmtty_rest$6 = match$2[1]; return [0, [3, sub_fmtty_rest$6], fmt$3]; } break; case 4: if(typeof fmtty !== "number" && 4 === fmtty[0]){ var fmtty_rest$3 = fmtty[1], sub_fmtty_rest$7 = sub_fmtty[1], match$3 = type_ignored_format_substituti(sub_fmtty_rest$7, fmt, fmtty_rest$3), fmt$4 = match$3[2], sub_fmtty_rest$8 = match$3[1]; return [0, [4, sub_fmtty_rest$8], fmt$4]; } break; case 5: if(typeof fmtty !== "number" && 5 === fmtty[0]){ var fmtty_rest$4 = fmtty[1], sub_fmtty_rest$9 = sub_fmtty[1], match$4 = type_ignored_format_substituti(sub_fmtty_rest$9, fmt, fmtty_rest$4), fmt$5 = match$4[2], sub_fmtty_rest$10 = match$4[1]; return [0, [5, sub_fmtty_rest$10], fmt$5]; } break; case 6: if(typeof fmtty !== "number" && 6 === fmtty[0]){ var fmtty_rest$5 = fmtty[1], sub_fmtty_rest$11 = sub_fmtty[1], match$5 = type_ignored_format_substituti (sub_fmtty_rest$11, fmt, fmtty_rest$5), fmt$6 = match$5[2], sub_fmtty_rest$12 = match$5[1]; return [0, [6, sub_fmtty_rest$12], fmt$6]; } break; case 7: if(typeof fmtty !== "number" && 7 === fmtty[0]){ var fmtty_rest$6 = fmtty[1], sub_fmtty_rest$13 = sub_fmtty[1], match$6 = type_ignored_format_substituti (sub_fmtty_rest$13, fmt, fmtty_rest$6), fmt$7 = match$6[2], sub_fmtty_rest$14 = match$6[1]; return [0, [7, sub_fmtty_rest$14], fmt$7]; } break; case 8: if(typeof fmtty !== "number" && 8 === fmtty[0]){ var fmtty_rest$7 = fmtty[2], sub2_fmtty = fmtty[1], sub_fmtty_rest$15 = sub_fmtty[2], sub2_fmtty$0 = sub_fmtty[1]; if(caml_notequal([0, sub2_fmtty$0], [0, sub2_fmtty])) throw caml_maybe_attach_backtrace(Type_mismatch, 1); var match$7 = type_ignored_format_substituti (sub_fmtty_rest$15, fmt, fmtty_rest$7), fmt$8 = match$7[2], sub_fmtty_rest$16 = match$7[1]; return [0, [8, sub2_fmtty, sub_fmtty_rest$16], fmt$8]; } break; case 9: if(typeof fmtty !== "number" && 9 === fmtty[0]){ var fmtty_rest$8 = fmtty[3], sub2_fmtty$1 = fmtty[2], sub1_fmtty = fmtty[1], sub_fmtty_rest$17 = sub_fmtty[3], sub2_fmtty$2 = sub_fmtty[2], sub1_fmtty$0 = sub_fmtty[1], a = [0, CamlinternalFormatBasics[2].call(null, sub1_fmtty)]; if (caml_notequal ([0, CamlinternalFormatBasics[2].call(null, sub1_fmtty$0)], a)) throw caml_maybe_attach_backtrace(Type_mismatch, 1); var b = [0, CamlinternalFormatBasics[2].call(null, sub2_fmtty$1)]; if (caml_notequal ([0, CamlinternalFormatBasics[2].call(null, sub2_fmtty$2)], b)) throw caml_maybe_attach_backtrace(Type_mismatch, 1); var sub_fmtty$0 = trans(symm(sub1_fmtty), sub2_fmtty$1), match$8 = fmtty_rel_det(sub_fmtty$0), f4 = match$8[4], f2 = match$8[2]; f2(0); f4(0); var match$9 = type_ignored_format_substituti (CamlinternalFormatBasics[2].call(null, sub_fmtty_rest$17), fmt, fmtty_rest$8), fmt$9 = match$9[2], sub_fmtty_rest$18 = match$9[1]; return [0, [9, sub1_fmtty, sub2_fmtty$1, symm(sub_fmtty_rest$18)], fmt$9]; } break; case 10: if(typeof fmtty !== "number" && 10 === fmtty[0]){ var fmtty_rest$9 = fmtty[1], sub_fmtty_rest$19 = sub_fmtty[1], match$10 = type_ignored_format_substituti (sub_fmtty_rest$19, fmt, fmtty_rest$9), fmt$10 = match$10[2], sub_fmtty_rest$20 = match$10[1]; return [0, [10, sub_fmtty_rest$20], fmt$10]; } break; case 11: if(typeof fmtty !== "number" && 11 === fmtty[0]){ var fmtty_rest$10 = fmtty[1], sub_fmtty_rest$21 = sub_fmtty[1], match$11 = type_ignored_format_substituti (sub_fmtty_rest$21, fmt, fmtty_rest$10), fmt$11 = match$11[2], sub_fmtty_rest$22 = match$11[1]; return [0, [11, sub_fmtty_rest$22], fmt$11]; } break; case 13: if(typeof fmtty !== "number" && 13 === fmtty[0]){ var fmtty_rest$11 = fmtty[1], sub_fmtty_rest$23 = sub_fmtty[1], match$12 = type_ignored_format_substituti (sub_fmtty_rest$23, fmt, fmtty_rest$11), fmt$12 = match$12[2], sub_fmtty_rest$24 = match$12[1]; return [0, [13, sub_fmtty_rest$24], fmt$12]; } break; case 14: if(typeof fmtty !== "number" && 14 === fmtty[0]){ var fmtty_rest$12 = fmtty[1], sub_fmtty_rest$25 = sub_fmtty[1], match$13 = type_ignored_format_substituti (sub_fmtty_rest$25, fmt, fmtty_rest$12), fmt$13 = match$13[2], sub_fmtty_rest$26 = match$13[1]; return [0, [14, sub_fmtty_rest$26], fmt$13]; } break; } throw caml_maybe_attach_backtrace(Type_mismatch, 1); } function recast(fmt, fmtty){ var a = symm(fmtty); return type_format(fmt, CamlinternalFormatBasics[2].call(null, a)); } function fix_padding(padty, width, str){ var len = caml_ml_string_length(str), padty$0 = 0 <= width ? padty : 0, width$0 = Stdlib[18].call(null, width); if(width$0 <= len) return str; var a = 2 === padty$0 ? 48 : 32, res = Stdlib_Bytes[1].call(null, width$0, a); switch(padty$0){ case 0: Stdlib_String[6].call(null, str, 0, res, 0, len); break; case 1: Stdlib_String[6].call(null, str, 0, res, width$0 - len | 0, len); break; default: a: if(0 < len){ if (43 !== caml_string_get(str, 0) && 45 !== caml_string_get(str, 0) && 32 !== caml_string_get(str, 0)) break a; caml_bytes_set(res, 0, caml_string_get(str, 0)); Stdlib_String[6].call (null, str, 1, res, (width$0 - len | 0) + 1 | 0, len - 1 | 0); break; } a: if(1 < len && 48 === caml_string_get(str, 0)){ if(120 !== caml_string_get(str, 1) && 88 !== caml_string_get(str, 1)) break a; caml_bytes_set(res, 1, caml_string_get(str, 1)); Stdlib_String[6].call (null, str, 2, res, (width$0 - len | 0) + 2 | 0, len - 2 | 0); break; } Stdlib_String[6].call(null, str, 0, res, width$0 - len | 0, len); } return Stdlib_Bytes[44].call(null, res); } function fix_int_precision(prec, str){ var prec$0 = Stdlib[18].call(null, prec), len = caml_ml_string_length(str), c = caml_string_get(str, 0); a: { b: { if(58 > c){ if(32 !== c){ if(43 > c) break a; switch(c - 43 | 0){ case 5: if(len >= (prec$0 + 2 | 0)) break b; if(1 >= len) break b; if (120 !== caml_string_get(str, 1) && 88 !== caml_string_get(str, 1)) break b; var res$1 = Stdlib_Bytes[1].call(null, prec$0 + 2 | 0, 48); caml_bytes_set(res$1, 1, caml_string_get(str, 1)); Stdlib_String[6].call (null, str, 2, res$1, (prec$0 - len | 0) + 4 | 0, len - 2 | 0); return Stdlib_Bytes[44].call(null, res$1); case 0: case 2: break; case 1: case 3: case 4: break a; default: break b; } } if(len >= (prec$0 + 1 | 0)) break a; var res$0 = Stdlib_Bytes[1].call(null, prec$0 + 1 | 0, 48); caml_bytes_set(res$0, 0, c); Stdlib_String[6].call (null, str, 1, res$0, (prec$0 - len | 0) + 2 | 0, len - 1 | 0); return Stdlib_Bytes[44].call(null, res$0); } if(71 <= c){if(5 < c - 97 >>> 0) break a;} else if(65 > c) break a; } if(len < prec$0){ var res = Stdlib_Bytes[1].call(null, prec$0, 48); Stdlib_String[6].call(null, str, 0, res, prec$0 - len | 0, len); return Stdlib_Bytes[44].call(null, res); } } return str; } function string_to_caml_string(str){ var str$0 = Stdlib_String[25].call(null, str), l = caml_ml_string_length(str$0), res = Stdlib_Bytes[1].call(null, l + 2 | 0, 34); caml_blit_string(str$0, 0, res, 1, l); return Stdlib_Bytes[44].call(null, res); } var r = [0, 103]; function format_of_fconv(fconv, prec){ var prec$0 = Stdlib[18].call(null, prec), symb = char_of_fconv(r, fconv), buf = buffer_create(16); buffer_add_char(buf, 37); bprint_fconv_flag(buf, fconv); buffer_add_char(buf, 46); buffer_add_string(buf, Stdlib_Int[12].call(null, prec$0)); buffer_add_char(buf, symb); return buffer_contents(buf); } function transform_int_alt(iconv, s){ if(13 > iconv) return s; var b = caml_ml_string_length(s) - 1 | 0, a = 0; if(b < 0) var n$2 = a; else{ var n = a, i$0 = 0; for(;;){ if(9 < caml_string_unsafe_get(s, i$0) - 48 >>> 0) var n$1 = n; else var n$0 = n + 1 | 0, n$1 = n$0; var g = i$0 + 1 | 0; if(b === i$0){var n$2 = n$1; break;} n = n$1; i$0 = g; } } var buf = caml_create_bytes (caml_ml_string_length(s) + ((n$2 - 1 | 0) / 3 | 0) | 0), pos = [0, 0]; function put(c){caml_bytes_set(buf, pos[1], c); pos[1]++;} var d = caml_ml_string_length(s) - 1 | 0, e = ((n$2 - 1 | 0) % 3 | 0) + 1 | 0; if(d >= 0){ var left = e, i = 0; for(;;){ var c = caml_string_unsafe_get(s, i); if(9 < c - 48 >>> 0){ put(c); var left$2 = left; } else{ var left$0 = 0 === left ? (put(95), 3) : left, left$1 = left$0 - 1 | 0; put(c); var left$2 = left$1; } var f = i + 1 | 0; if(d === i) break; left = left$2; i = f; } } return Stdlib_Bytes[44].call(null, buf); } var cst_u = "%u"; function convert_int(iconv, n){ switch(iconv){ case 1: var a = "%+d"; break; case 2: var a = "% d"; break; case 4: var a = "%+i"; break; case 5: var a = "% i"; break; case 6: var a = "%x"; break; case 7: var a = "%#x"; break; case 8: var a = "%X"; break; case 9: var a = "%#X"; break; case 10: var a = "%o"; break; case 11: var a = "%#o"; break; case 0: case 13: var a = "%d"; break; case 3: case 14: var a = cst_i; break; default: var a = cst_u; } return transform_int_alt(iconv, caml_format_int(a, n)); } function convert_int32(iconv, n){ switch(iconv){ case 1: var a = "%+ld"; break; case 2: var a = "% ld"; break; case 4: var a = "%+li"; break; case 5: var a = "% li"; break; case 6: var a = "%lx"; break; case 7: var a = "%#lx"; break; case 8: var a = "%lX"; break; case 9: var a = "%#lX"; break; case 10: var a = "%lo"; break; case 11: var a = "%#lo"; break; case 0: case 13: var a = "%ld"; break; case 3: case 14: var a = cst_li; break; default: var a = "%lu"; } return transform_int_alt(iconv, caml_format_int(a, n)); } function convert_nativeint(iconv, n){ switch(iconv){ case 1: var a = "%+nd"; break; case 2: var a = "% nd"; break; case 4: var a = "%+ni"; break; case 5: var a = "% ni"; break; case 6: var a = "%nx"; break; case 7: var a = "%#nx"; break; case 8: var a = "%nX"; break; case 9: var a = "%#nX"; break; case 10: var a = "%no"; break; case 11: var a = "%#no"; break; case 0: case 13: var a = "%nd"; break; case 3: case 14: var a = cst_ni; break; default: var a = "%nu"; } return transform_int_alt(iconv, caml_format_int(a, n)); } function convert_int64(iconv, n){ switch(iconv){ case 1: var a = "%+Ld"; break; case 2: var a = "% Ld"; break; case 4: var a = "%+Li"; break; case 5: var a = "% Li"; break; case 6: var a = "%Lx"; break; case 7: var a = "%#Lx"; break; case 8: var a = "%LX"; break; case 9: var a = "%#LX"; break; case 10: var a = "%Lo"; break; case 11: var a = "%#Lo"; break; case 0: case 13: var a = "%Ld"; break; case 3: case 14: var a = cst_Li; break; default: var a = "%Lu"; } return transform_int_alt(iconv, runtime.caml_int64_format(a, n)); } function convert_float(fconv, prec, x){ function hex(param){ switch(fconv[1]){ case 0: var sign = 45; break; case 1: var sign = 43; break; default: var sign = 32; } return runtime.caml_hexstring_of_float(x, prec, sign); } function caml_special_val(str){ var match = runtime.caml_classify_float(x); return 3 === match ? x < 0. ? "neg_infinity" : "infinity" : 4 <= match ? "nan" : str; } switch(fconv[2]){ case 5: var str = caml_format_float(format_of_fconv(fconv, prec), x), len = caml_ml_string_length(str), i = 0; for(;;){ a: { if(i !== len){ var a = caml_string_get(str, i) - 46 | 0; b: { if(23 < a >>> 0){ if(55 !== a) break b; } else if(21 >= a - 1 >>> 0) break b; var b = 1; break a; } var i$0 = i + 1 | 0; i = i$0; continue; } var b = 0; } var c = b ? str : Stdlib[28].call(null, str, "."); return caml_special_val(c); } case 6: return hex(0); case 7: var d = hex(0); return Stdlib_String[26].call(null, d); case 8: return caml_special_val(hex(0)); default: return caml_format_float(format_of_fconv(fconv, prec), x); } } function string_of_fmtty(fmtty){ var buf = buffer_create(16); bprint_fmtty(buf, fmtty); return buffer_contents(buf); } var s = [0, cst_camlinternalFormat_ml, 1558, 4]; function make_printf$0(counter, k$2, acc$4, fmt$2){ a: { b: { c: { d: { e: { f: { g: { h: { i: { j: { var k = k$2, acc = acc$4, fmt = fmt$2; k: for(;;){ if(typeof fmt === "number") return caml_call1(k, acc); switch(fmt[0]){ case 0: break a; case 1: break b; case 2: break c; case 3: var rest$2 = fmt[2], pad$0 = fmt[1]; return make_padding (k, acc, rest$2, pad$0, string_to_caml_string); case 4: var rest$3 = fmt[4], prec = fmt[3], pad$1 = fmt[2], iconv = fmt[1]; return make_int_padding_precision (k, acc, rest$3, pad$1, prec, convert_int, iconv); case 5: var rest$4 = fmt[4], prec$0 = fmt[3], pad$2 = fmt[2], iconv$0 = fmt[1]; return make_int_padding_precision (k, acc, rest$4, pad$2, prec$0, convert_int32, iconv$0); case 6: var rest$5 = fmt[4], prec$1 = fmt[3], pad$3 = fmt[2], iconv$1 = fmt[1]; return make_int_padding_precision (k, acc, rest$5, pad$3, prec$1, convert_nativeint, iconv$1); case 7: var rest$6 = fmt[4], prec$2 = fmt[3], pad$4 = fmt[2], iconv$2 = fmt[1]; return make_int_padding_precision (k, acc, rest$6, pad$4, prec$2, convert_int64, iconv$2); case 8: break d; case 9: var rest$8 = fmt[2], pad$6 = fmt[1]; return make_padding(k, acc, rest$8, pad$6, Stdlib[30]); case 10: var rest$9 = fmt[1], acc$0 = [7, acc]; acc = acc$0; fmt = rest$9; break; case 11: var rest$10 = fmt[2], str = fmt[1], acc$1 = [2, acc, str]; acc = acc$1; fmt = rest$10; break; case 12: var rest$11 = fmt[2], chr = fmt[1], acc$2 = [3, acc, chr]; acc = acc$2; fmt = rest$11; break; case 13: break e; case 14: break f; case 15: break g; case 16: break h; case 17: var rest$16 = fmt[2], fmting_lit = fmt[1], acc$3 = [0, acc, fmting_lit]; acc = acc$3; fmt = rest$16; break; case 18: var a = fmt[1]; if(0 === a[0]){ var rest$17 = fmt[2], fmt$0 = a[1][1]; let acc$0 = acc, k$1 = k, rest = rest$17; var k$0 = function(kacc){ return make_printf(k$1, [1, acc$0, [0, kacc]], rest); }; k = k$0; acc = 0; fmt = fmt$0; } else{ var rest$18 = fmt[2], fmt$1 = a[1][1]; let acc$0 = acc, k$0 = k, rest = rest$18; var k$1 = function(kacc){ return make_printf(k$0, [1, acc$0, [1, kacc]], rest); }; k = k$1; acc = 0; fmt = fmt$1; } break; case 19: throw caml_maybe_attach_backtrace([0, Assert_failure, s], 1); case 20: break i; case 21: break j; case 22: break k; case 23: var rest$22 = fmt[2], ign = fmt[1]; return counter < 50 ? make_ignored_param$0 (counter + 1 | 0, k, acc, ign, rest$22) : caml_trampoline_return (make_ignored_param$0, [0, k, acc, ign, rest$22]); default: var rest$23 = fmt[3], f = fmt[2], arity = fmt[1], b = caml_call1(f, 0); return counter < 50 ? make_custom$0(counter + 1 | 0, k, acc, rest$23, arity, b) : caml_trampoline_return (make_custom$0, [0, k, acc, rest$23, arity, b]); } } var rest$21 = fmt[1]; return function(c){ var new_acc = [5, acc, c]; return make_printf(k, new_acc, rest$21);}; } var rest$20 = fmt[2]; return function(n){ var new_acc = [4, acc, caml_format_int(cst_u, n)]; return make_printf(k, new_acc, rest$20);}; } var rest$19 = fmt[3], new_acc = [8, acc, "Printf: bad conversion %["]; return function(param){return make_printf(k, new_acc, rest$19);}; } var rest$15 = fmt[1]; return function(f){return make_printf(k, [6, acc, f], rest$15);}; } var rest$14 = fmt[1]; return function(f, x){ return make_printf (k, [6, acc, function(o){return caml_call2(f, o, x);}], rest$14);}; } var rest$13 = fmt[3], fmtty = fmt[2]; return function(param){ var fmt = param[1], a = recast(fmt, fmtty); return make_printf (k, acc, CamlinternalFormatBasics[3].call(null, a, rest$13));}; } var rest$12 = fmt[3], sub_fmtty = fmt[2], ty = string_of_fmtty(sub_fmtty); return function(str){return make_printf(k, [4, acc, ty], rest$12);}; } var rest$7 = fmt[4], prec$3 = fmt[3], pad$5 = fmt[2], fconv = fmt[1]; if(typeof pad$5 === "number"){ if(typeof prec$3 === "number") return prec$3 ? function (p, x){ var str = convert_float(fconv, p, x); return make_printf(k, [4, acc, str], rest$7); } : function (x){ var str = convert_float(fconv, default_float_precision(fconv), x); return make_printf(k, [4, acc, str], rest$7); }; var p = prec$3[1]; return function(x){ var str = convert_float(fconv, p, x); return make_printf(k, [4, acc, str], rest$7);}; } if(0 === pad$5[0]){ var w = pad$5[2], padty = pad$5[1]; if(typeof prec$3 === "number") return prec$3 ? function (p, x){ var str = fix_padding(padty, w, convert_float(fconv, p, x)); return make_printf(k, [4, acc, str], rest$7); } : function (x){ var str = convert_float(fconv, default_float_precision(fconv), x), str$0 = fix_padding(padty, w, str); return make_printf(k, [4, acc, str$0], rest$7); }; var p$0 = prec$3[1]; return function(x){ var str = fix_padding(padty, w, convert_float(fconv, p$0, x)); return make_printf(k, [4, acc, str], rest$7);}; } var padty$0 = pad$5[1]; if(typeof prec$3 === "number") return prec$3 ? function (w, p, x){ var str = fix_padding(padty$0, w, convert_float(fconv, p, x)); return make_printf(k, [4, acc, str], rest$7); } : function (w, x){ var str = convert_float(fconv, default_float_precision(fconv), x), str$0 = fix_padding(padty$0, w, str); return make_printf(k, [4, acc, str$0], rest$7); }; var p$1 = prec$3[1]; return function(w, x){ var str = fix_padding(padty$0, w, convert_float(fconv, p$1, x)); return make_printf(k, [4, acc, str], rest$7);}; } var rest$1 = fmt[2], pad = fmt[1]; return make_padding(k, acc, rest$1, pad, function(str){return str;}); } var rest$0 = fmt[1]; return function(c){ var str = Stdlib_Char[2].call(null, c), l = caml_ml_string_length(str), res = Stdlib_Bytes[1].call(null, l + 2 | 0, 39); caml_blit_string(str, 0, res, 1, l); var new_acc = [4, acc, Stdlib_Bytes[44].call(null, res)]; return make_printf(k, new_acc, rest$0);}; } var rest = fmt[1]; return function(c){ var new_acc = [5, acc, c]; return make_printf(k, new_acc, rest);}; } function make_printf(k, acc, fmt){ return caml_trampoline(make_printf$0(0, k, acc, fmt)); } var t = [0, cst_camlinternalFormat_ml, 1626, 39]; function make_ignored_param$0(counter, k, acc, ign, fmt){ if(typeof ign === "number"){ if(2 === ign) throw caml_maybe_attach_backtrace([0, Assert_failure, t], 1); return counter < 50 ? make_invalid_arg(counter + 1 | 0, k, acc, fmt) : caml_trampoline_return(make_invalid_arg, [0, k, acc, fmt]); } if(9 !== ign[0]) return counter < 50 ? make_invalid_arg(counter + 1 | 0, k, acc, fmt) : caml_trampoline_return(make_invalid_arg, [0, k, acc, fmt]); var fmtty = ign[2]; return counter < 50 ? make_from_fmtty$0(counter + 1 | 0, k, acc, fmtty, fmt) : caml_trampoline_return (make_from_fmtty$0, [0, k, acc, fmtty, fmt]); } function make_ignored_param(k, acc, ign, fmt){ return caml_trampoline(make_ignored_param$0(0, k, acc, ign, fmt)); } var u = [0, cst_camlinternalFormat_ml, 1649, 31], v = [0, cst_camlinternalFormat_ml, 1650, 31]; function make_from_fmtty$0(counter, k, acc, fmtty, fmt){ if(typeof fmtty === "number") return counter < 50 ? make_invalid_arg(counter + 1 | 0, k, acc, fmt) : caml_trampoline_return(make_invalid_arg, [0, k, acc, fmt]); switch(fmtty[0]){ case 0: var rest = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest, fmt);}; case 1: var rest$0 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$0, fmt);}; case 2: var rest$1 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$1, fmt);}; case 3: var rest$2 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$2, fmt);}; case 4: var rest$3 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$3, fmt);}; case 5: var rest$4 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$4, fmt);}; case 6: var rest$5 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$5, fmt);}; case 7: var rest$6 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$6, fmt);}; case 8: var rest$7 = fmtty[2]; return function(param){return make_from_fmtty(k, acc, rest$7, fmt);}; case 9: var rest$8 = fmtty[3], ty2 = fmtty[2], ty1 = fmtty[1], ty = trans(symm(ty1), ty2); return function(param){ return make_from_fmtty (k, acc, CamlinternalFormatBasics[1].call(null, ty, rest$8), fmt);}; case 10: var rest$9 = fmtty[1]; return function(a, param){ return make_from_fmtty(k, acc, rest$9, fmt);}; case 11: var rest$10 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$10, fmt);}; case 12: var rest$11 = fmtty[1]; return function(param){return make_from_fmtty(k, acc, rest$11, fmt);}; case 13: throw caml_maybe_attach_backtrace([0, Assert_failure, u], 1); default: throw caml_maybe_attach_backtrace([0, Assert_failure, v], 1); } } function make_from_fmtty(k, acc, fmtty, fmt){ return caml_trampoline(make_from_fmtty$0(0, k, acc, fmtty, fmt)); } function make_invalid_arg(counter, k, acc, fmt){ var a = [8, acc, "Printf: bad conversion %_"]; return counter < 50 ? make_printf$0(counter + 1 | 0, k, a, fmt) : caml_trampoline_return(make_printf$0, [0, k, a, fmt]); } function make_padding(k, acc, fmt, pad, trans){ if(typeof pad === "number") return function(x){ var new_acc = [4, acc, caml_call1(trans, x)]; return make_printf(k, new_acc, fmt);}; if(0 === pad[0]){ var width = pad[2], padty = pad[1]; return function(x){ var new_acc = [4, acc, fix_padding(padty, width, caml_call1(trans, x))]; return make_printf(k, new_acc, fmt);}; } var padty$0 = pad[1]; return function(w, x){ var new_acc = [4, acc, fix_padding(padty$0, w, caml_call1(trans, x))]; return make_printf(k, new_acc, fmt);}; } function make_int_padding_precision(k, acc, fmt, pad, prec, trans, iconv){ if(typeof pad === "number"){ if(typeof prec === "number") return prec ? function (p, x){ var str = fix_int_precision(p, caml_call2(trans, iconv, x)); return make_printf(k, [4, acc, str], fmt); } : function (x){ var str = caml_call2(trans, iconv, x); return make_printf(k, [4, acc, str], fmt); }; var p = prec[1]; return function(x){ var str = fix_int_precision(p, caml_call2(trans, iconv, x)); return make_printf(k, [4, acc, str], fmt);}; } if(0 === pad[0]){ var w = pad[2], padty = pad[1]; if(typeof prec === "number") return prec ? function (p, x){ var str = fix_padding (padty, w, fix_int_precision(p, caml_call2(trans, iconv, x))); return make_printf(k, [4, acc, str], fmt); } : function (x){ var str = fix_padding(padty, w, caml_call2(trans, iconv, x)); return make_printf(k, [4, acc, str], fmt); }; var p$0 = prec[1]; return function(x){ var str = fix_padding (padty, w, fix_int_precision(p$0, caml_call2(trans, iconv, x))); return make_printf(k, [4, acc, str], fmt);}; } var padty$0 = pad[1]; if(typeof prec === "number") return prec ? function (w, p, x){ var str = fix_padding (padty$0, w, fix_int_precision(p, caml_call2(trans, iconv, x))); return make_printf(k, [4, acc, str], fmt); } : function (w, x){ var str = fix_padding(padty$0, w, caml_call2(trans, iconv, x)); return make_printf(k, [4, acc, str], fmt); }; var p$1 = prec[1]; return function(w, x){ var str = fix_padding (padty$0, w, fix_int_precision(p$1, caml_call2(trans, iconv, x))); return make_printf(k, [4, acc, str], fmt);}; } function make_custom$0(counter, k, acc, rest, arity, f){ if(arity){ var arity$0 = arity[1]; return function(x){ return make_custom(k, acc, rest, arity$0, caml_call1(f, x));}; } var a = [4, acc, f]; return counter < 50 ? make_printf$0(counter + 1 | 0, k, a, rest) : caml_trampoline_return(make_printf$0, [0, k, a, rest]); } function make_custom(k, acc, rest, arity, f){ return caml_trampoline(make_custom$0(0, k, acc, rest, arity, f)); } var w = [0, cst_camlinternalFormat_ml, 1830, 8]; function make_iprintf$0(counter, k$2, o, fmt$2){ a: { b: { c: { d: { e: { f: { g: { h: { i: { var k = k$2, fmt = fmt$2; j: for(;;){ if(typeof fmt === "number") return caml_call1(k, o); switch(fmt[0]){ case 2: break b; case 3: break c; case 9: break e; case 10: var rest$10 = fmt[1]; fmt = rest$10; break; case 14: break g; case 15: break h; case 18: var a = fmt[1]; if(0 === a[0]){ var rest$15 = fmt[2], fmt$0 = a[1][1]; let k$1 = k, rest = rest$15; var k$0 = function(koc){return make_iprintf(k$1, koc, rest);}; k = k$0; fmt = fmt$0; } else{ var rest$16 = fmt[2], fmt$1 = a[1][1]; let k$0 = k, rest = rest$16; var k$1 = function(koc){return make_iprintf(k$0, koc, rest);}; k = k$1; fmt = fmt$1; } break; case 19: throw caml_maybe_attach_backtrace([0, Assert_failure, w], 1); case 21: break i; case 23: break j; case 24: var rest$19 = fmt[3], arity = fmt[1]; return counter < 50 ? fn_of_custom_arity$0 (counter + 1 | 0, k, o, rest$19, arity) : caml_trampoline_return (fn_of_custom_arity$0, [0, k, o, rest$19, arity]); case 13: case 20: break f; case 11: case 12: case 17: var rest$11 = fmt[2]; fmt = rest$11; break; case 0: case 1: case 16: case 22: break a; default: break d; } } var rest$18 = fmt[2], ign = fmt[1]; return make_ignored_param (function(param){return caml_call1(k, o);}, 0, ign, rest$18); } var rest$17 = fmt[2], x$15 = make_iprintf(k, o, rest$17); return function(param){return x$15;}; } var rest$14 = fmt[1], x$13 = make_iprintf(k, o, rest$14), x$14 = function(param){return x$13;}; return function(param){return x$14;}; } var rest$13 = fmt[3], fmtty = fmt[2]; return function(param){ var fmt = param[1], a = recast(fmt, fmtty); return make_iprintf (k, o, CamlinternalFormatBasics[3].call(null, a, rest$13));}; } var rest$12 = fmt[3], x$12 = make_iprintf(k, o, rest$12); return function(param){return x$12;}; } var match$1 = fmt[1]; if(typeof match$1 === "number"){ var rest$7 = fmt[2], x$8 = make_iprintf(k, o, rest$7); return function(param){return x$8;}; } if(0 === match$1[0]){ var rest$8 = fmt[2], x$9 = make_iprintf(k, o, rest$8); return function(param){return x$9;}; } var rest$9 = fmt[2], x$10 = make_iprintf(k, o, rest$9), x$11 = function(param){return x$10;}; return function(param){return x$11;}; } var rest$6 = fmt[4], prec = fmt[3], pad = fmt[2]; if(typeof pad === "number"){ if(typeof prec !== "number"){ var x$19 = make_iprintf(k, o, rest$6); return function(param){return x$19;}; } if(prec){ var x$16 = make_iprintf(k, o, rest$6), x$17 = function(param){return x$16;}; return function(param){return x$17;}; } var x$18 = make_iprintf(k, o, rest$6); return function(param){return x$18;}; } if(0 === pad[0]){ if(typeof prec !== "number"){ var x$23 = make_iprintf(k, o, rest$6); return function(param){return x$23;}; } if(prec){ var x$20 = make_iprintf(k, o, rest$6), x$21 = function(param){return x$20;}; return function(param){return x$21;}; } var x$22 = make_iprintf(k, o, rest$6); return function(param){return x$22;}; } if(typeof prec !== "number"){ var x$29 = make_iprintf(k, o, rest$6), x$30 = function(param){return x$29;}; return function(param){return x$30;}; } if(prec){ var x$24 = make_iprintf(k, o, rest$6), x$25 = function(param){return x$24;}, x$26 = function(param){return x$25;}; return function(param){return x$26;}; } var x$27 = make_iprintf(k, o, rest$6), x$28 = function(param){return x$27;}; return function(param){return x$28;}; } var match$0 = fmt[1]; if(typeof match$0 === "number"){ var rest$3 = fmt[2], x$4 = make_iprintf(k, o, rest$3); return function(param){return x$4;}; } if(0 === match$0[0]){ var rest$4 = fmt[2], x$5 = make_iprintf(k, o, rest$4); return function(param){return x$5;}; } var rest$5 = fmt[2], x$6 = make_iprintf(k, o, rest$5), x$7 = function(param){return x$6;}; return function(param){return x$7;}; } var match = fmt[1]; if(typeof match === "number"){ var rest$0 = fmt[2], x$0 = make_iprintf(k, o, rest$0); return function(param){return x$0;}; } if(0 === match[0]){ var rest$1 = fmt[2], x$1 = make_iprintf(k, o, rest$1); return function(param){return x$1;}; } var rest$2 = fmt[2], x$2 = make_iprintf(k, o, rest$2), x$3 = function(param){return x$2;}; return function(param){return x$3;}; } var rest = fmt[1], x = make_iprintf(k, o, rest); return function(param){return x;}; } function make_iprintf(k, o, fmt){ return caml_trampoline(make_iprintf$0(0, k, o, fmt)); } function fn_of_custom_arity$0(counter, k, o, fmt, param){ if(! param) return counter < 50 ? make_iprintf$0(counter + 1 | 0, k, o, fmt) : caml_trampoline_return(make_iprintf$0, [0, k, o, fmt]); var arity = param[1], x = fn_of_custom_arity(k, o, fmt, arity); return function(param){return x;}; } function fn_of_custom_arity(k, o, fmt, param){ return caml_trampoline(fn_of_custom_arity$0(0, k, o, fmt, param)); } function output_acc(o, acc$2){ var acc = acc$2; for(;;){ if(typeof acc === "number") return 0; switch(acc[0]){ case 0: var fmting_lit = acc[2], p = acc[1], s = string_of_formatting_lit(fmting_lit); output_acc(o, p); return Stdlib[66].call(null, o, s); case 1: var match = acc[2], p$0 = acc[1]; if(0 === match[0]){ var acc$0 = match[1]; output_acc(o, p$0); Stdlib[66].call(null, o, cst); acc = acc$0; } else{ var acc$1 = match[1]; output_acc(o, p$0); Stdlib[66].call(null, o, cst$0); acc = acc$1; } break; case 6: var f = acc[2], p$3 = acc[1]; output_acc(o, p$3); return caml_call1(f, o); case 7: var p$4 = acc[1]; output_acc(o, p$4); return Stdlib[63].call(null, o); case 8: var msg = acc[2], p$5 = acc[1]; output_acc(o, p$5); return Stdlib[1].call(null, msg); case 2: case 4: var s$0 = acc[2], p$1 = acc[1]; output_acc(o, p$1); return Stdlib[66].call(null, o, s$0); default: var c = acc[2], p$2 = acc[1]; output_acc(o, p$2); return Stdlib[65].call(null, o, c); } } } function bufput_acc(b, acc$3){ var acc = acc$3; for(;;){ if(typeof acc === "number") return 0; switch(acc[0]){ case 0: var fmting_lit = acc[2], p = acc[1], s = string_of_formatting_lit(fmting_lit); bufput_acc(b, p); return Stdlib_Buffer[16].call(null, b, s); case 1: var match = acc[2], p$0 = acc[1]; if(0 === match[0]){ var acc$0 = match[1]; bufput_acc(b, p$0); Stdlib_Buffer[16].call(null, b, cst); acc = acc$0; } else{ var acc$1 = match[1]; bufput_acc(b, p$0); Stdlib_Buffer[16].call(null, b, cst$0); acc = acc$1; } break; case 6: var f = acc[2], p$3 = acc[1]; bufput_acc(b, p$3); return caml_call1(f, b); case 7: var acc$2 = acc[1]; acc = acc$2; break; case 8: var msg = acc[2], p$4 = acc[1]; bufput_acc(b, p$4); return Stdlib[1].call(null, msg); case 2: case 4: var s$0 = acc[2], p$1 = acc[1]; bufput_acc(b, p$1); return Stdlib_Buffer[16].call(null, b, s$0); default: var c = acc[2], p$2 = acc[1]; bufput_acc(b, p$2); return Stdlib_Buffer[12].call(null, b, c); } } } function strput_acc(b, acc$3){ var acc = acc$3; for(;;){ if(typeof acc === "number") return 0; switch(acc[0]){ case 0: var fmting_lit = acc[2], p = acc[1], s = string_of_formatting_lit(fmting_lit); strput_acc(b, p); return Stdlib_Buffer[16].call(null, b, s); case 1: var match = acc[2], p$0 = acc[1]; if(0 === match[0]){ var acc$0 = match[1]; strput_acc(b, p$0); Stdlib_Buffer[16].call(null, b, cst); acc = acc$0; } else{ var acc$1 = match[1]; strput_acc(b, p$0); Stdlib_Buffer[16].call(null, b, cst$0); acc = acc$1; } break; case 6: var f = acc[2], p$3 = acc[1]; strput_acc(b, p$3); var a = caml_call1(f, 0); return Stdlib_Buffer[16].call(null, b, a); case 7: var acc$2 = acc[1]; acc = acc$2; break; case 8: var msg = acc[2], p$4 = acc[1]; strput_acc(b, p$4); return Stdlib[1].call(null, msg); case 2: case 4: var s$0 = acc[2], p$1 = acc[1]; strput_acc(b, p$1); return Stdlib_Buffer[16].call(null, b, s$0); default: var c = acc[2], p$2 = acc[1]; strput_acc(b, p$2); return Stdlib_Buffer[12].call(null, b, c); } } } function failwith_message(param){ var fmt = param[1], buf = Stdlib_Buffer[1].call(null, 256); function k(acc){ strput_acc(buf, acc); var a = Stdlib_Buffer[2].call(null, buf); return Stdlib[2].call(null, a); } return make_printf(k, 0, fmt); } var cst$1 = "", x = [0, 0, 4], y = [0, [11, "invalid box description ", [3, 0, 0]], "invalid box description %S"]; function open_box_of_string(str){ if(str === cst$1) return x; var len = caml_ml_string_length(str); function invalid_box(param){return caml_call1(failwith_message(y), str);} function parse_spaces(i$1){ var i = i$1; for(;;){ if(i === len) return i; var match = caml_string_get(str, i); if(9 !== match && 32 !== match) return i; var i$0 = i + 1 | 0; i = i$0; } } var wstart = parse_spaces(0), wend = wstart; for(;;){ if(wend === len) break; if(25 < caml_string_get(str, wend) - 97 >>> 0) break; var j = wend + 1 | 0; wend = j; } var box_name = Stdlib_String[16].call(null, str, wstart, wend - wstart | 0), nstart = parse_spaces(wend), nend = nstart; for(;;){ if(nend === len) break; var match = caml_string_get(str, nend); if(48 <= match){if(58 <= match) break;} else if(45 !== match) break; var j$0 = nend + 1 | 0; nend = j$0; } if(nstart === nend) var indent = 0; else try{ var a = runtime.caml_int_of_string (Stdlib_String[16].call(null, str, nstart, nend - nstart | 0)), indent = a; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); var indent = invalid_box(0); } var exp_end = parse_spaces(nend); if(exp_end !== len) invalid_box(0); a: { if(box_name !== cst$1 && box_name !== "b"){ if(box_name === "h"){var box_type = 0; break a;} if(box_name === "hov"){var box_type = 3; break a;} if(box_name === "hv"){var box_type = 2; break a;} if(box_name !== "v"){var box_type = invalid_box(0); break a;} var box_type = 1; break a; } var box_type = 4; } return [0, indent, box_type]; } function make_padding_fmt_ebb(pad, fmt){ if(typeof pad === "number") return [0, 0, fmt]; if(0 === pad[0]){var w = pad[2], s = pad[1]; return [0, [0, s, w], fmt];} var s$0 = pad[1]; return [0, [1, s$0], fmt]; } function make_padprec_fmt_ebb(pad, prec, fmt){ if(typeof prec === "number") var match = prec ? [0, 1] : [0, 0]; else var p = prec[1], match = [0, [0, p]]; var prec$0 = match[1]; if(typeof pad === "number") return [0, 0, prec$0, fmt]; if(0 === pad[0]){ var w = pad[2], s = pad[1]; return [0, [0, s, w], prec$0, fmt]; } var s$0 = pad[1]; return [0, [1, s$0], prec$0, fmt]; } var cst$2 = ", ", cst_at_character_number = ": at character number ", cst_invalid_format = "invalid format ", sub_format = [0, 0, cst$1], formatting_lit = [0, "@;", 1, 0], z = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, cst$2, [2, 0, 0]]]]]], "invalid format %S: at character number %d, %s"], A = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, ", '", [0, [11, "' without ", [2, 0, 0]]]]]]]], "invalid format %S: at character number %d, '%c' without %s"], B = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, cst$2, [2, 0, [11, " expected, read ", [1, 0]]]]]]]], "invalid format %S: at character number %d, %s expected, read %C"], C = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, ", duplicate flag ", [1, 0]]]]]], "invalid format %S: at character number %d, duplicate flag %C"], D = [0, 1, 0], E = [0, 0], F = [1, 0], G = [1, 1], H = [1, 1], I = [1, 1], J = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, ', invalid conversion "', [12, 37, [0, [12, 34, 0]]]]]]]], 'invalid format %S: at character number %d, invalid conversion "%%%c"'], K = [0, 0], L = [0, 0], M = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, ", flag ", [1, [11, " is only allowed after the '", [12, 37, [11, "', before padding and precision", 0]]]]]]]]], "invalid format %S: at character number %d, flag %C is only allowed after the '%%', before padding and precision"], N = [0, [12, 64, 0]], O = [0, "@ ", 1, 0], P = [0, "@,", 0, 0], Q = [2, 60], R = [0, [11, cst_invalid_format, [3, 0, [11, ": '", [12, 37, [11, "' alone is not accepted in character sets, use ", [12, 37, [12, 37, [11, " instead at position ", [4, 0, 0, 0, [12, 46, 0]]]]]]]]]], "invalid format %S: '%%' alone is not accepted in character sets, use %%%% instead at position %d."], S = [0, [11, cst_invalid_format, [3, 0, [11, ": integer ", [4, 0, 0, 0, [11, " is greater than the limit ", [4, 0, 0, 0, 0]]]]]], "invalid format %S: integer %d is greater than the limit %d"], T = [0, cst_camlinternalFormat_ml, 2837, 11], U = [0, [11, cst_invalid_format, [3, 0, [11, ': unclosed sub-format, expected "', [12, 37, [0, [11, '" at character number ', [4, 0, 0, 0, 0]]]]]]], 'invalid format %S: unclosed sub-format, expected "%%%c" at character number %d'], V = [0, cst_camlinternalFormat_ml, 2899, 34], W = [0, cst_camlinternalFormat_ml, 2935, 28], X = [0, cst_camlinternalFormat_ml, 2957, 11], Y = [0, [11, cst_invalid_format, [3, 0, [11, cst_at_character_number, [4, 0, 0, 0, [11, cst$2, [2, 0, [11, " is incompatible with '", [0, [11, "' in sub-format ", [3, 0, 0]]]]]]]]]], "invalid format %S: at character number %d, %s is incompatible with '%c' in sub-format %S"]; function fmt_ebb_of_string(legacy_behavior, str){ if(legacy_behavior) var flag = legacy_behavior[1], legacy_behavior$0 = flag; else var legacy_behavior$0 = 1; function invalid_format_message(str_ind, msg){ return caml_call3(failwith_message(z), str, str_ind, msg); } function invalid_format_without(str_ind, c, s){ return caml_call4(failwith_message(A), str, str_ind, c, s); } function expected_character(str_ind, expected, read){ return caml_call4(failwith_message(B), str, str_ind, expected, read); } var cst_unexpected_end_of_format = "unexpected end of format"; function parse(lit_start, end_ind){ var str_ind = lit_start; for(;;){ if(str_ind === end_ind) return add_literal(lit_start, str_ind, 0); var match = caml_string_get(str, str_ind); if(37 === match) break; if(64 === match){ var fmt_rest$0 = parse_after_at(str_ind + 1 | 0, end_ind)[1]; return add_literal(lit_start, str_ind, fmt_rest$0); } var str_ind$0 = str_ind + 1 | 0; str_ind = str_ind$0; } var str_ind$1 = str_ind + 1 | 0; if(str_ind$1 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var match$0 = 95 === caml_string_get(str, str_ind$1) ? parse_flags(str_ind, str_ind$1 + 1 | 0, end_ind, 1) : parse_flags(str_ind, str_ind$1, end_ind, 0), fmt_rest = match$0[1]; return add_literal(lit_start, str_ind, fmt_rest); } var cst_0 = "0"; function parse_flags(pct_ind, str_ind, end_ind, ign){ function set_flag(str_ind, flag){ var a = flag[1], b = a ? 1 - legacy_behavior$0 : a; if(b){ var c = caml_string_get(str, str_ind); caml_call3(failwith_message(C), str, str_ind, c); } flag[1] = 1; } var str_ind$0 = str_ind, zero = [0, 0], minus = [0, 0], plus = [0, 0], space = [0, 0], hash = [0, 0]; a: for(;;){ if(str_ind$0 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var switcher = caml_string_get(str, str_ind$0) - 32 | 0; if(16 < switcher >>> 0) break; switch(switcher){ case 0: set_flag(str_ind$0, space); var str_ind$1 = str_ind$0 + 1 | 0; str_ind$0 = str_ind$1; break; case 3: set_flag(str_ind$0, hash); var str_ind$2 = str_ind$0 + 1 | 0; str_ind$0 = str_ind$2; break; case 11: set_flag(str_ind$0, plus); var str_ind$3 = str_ind$0 + 1 | 0; str_ind$0 = str_ind$3; break; case 13: set_flag(str_ind$0, minus); var str_ind$4 = str_ind$0 + 1 | 0; str_ind$0 = str_ind$4; break; case 16: set_flag(str_ind$0, zero); var str_ind$5 = str_ind$0 + 1 | 0; str_ind$0 = str_ind$5; break; default: break a; } } var space$0 = space[1], hash$0 = hash[1], plus$0 = plus[1], minus$0 = minus[1], zero$0 = zero[1]; if(str_ind$0 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var padty = zero$0 ? minus$0 ? legacy_behavior$0 ? 0 : incompatible_flag(pct_ind, str_ind$0, 45, cst_0) : 2 : minus$0 ? 0 : 1, match = caml_string_get(str, str_ind$0); if(48 <= match){ if(58 > match){ var match$0 = parse_positive(str_ind$0, end_ind, 0), width = match$0[2], new_ind = match$0[1]; return parse_after_padding (pct_ind, new_ind, end_ind, minus$0, plus$0, hash$0, space$0, ign, [0, padty, width]); } } else if(42 === match) return parse_after_padding (pct_ind, str_ind$0 + 1 | 0, end_ind, minus$0, plus$0, hash$0, space$0, ign, [1, padty]); switch(padty){ case 0: if(1 - legacy_behavior$0) invalid_format_without(str_ind$0 - 1 | 0, 45, "padding"); return parse_after_padding (pct_ind, str_ind$0, end_ind, minus$0, plus$0, hash$0, space$0, ign, 0); case 1: return parse_after_padding (pct_ind, str_ind$0, end_ind, minus$0, plus$0, hash$0, space$0, ign, 0); default: return parse_after_padding (pct_ind, str_ind$0, end_ind, minus$0, plus$0, hash$0, space$0, ign, D); } } var cst_precision = "precision"; function parse_after_padding (pct_ind, str_ind, end_ind, minus, plus, hash, space, ign, pad){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var symb = caml_string_get(str, str_ind); if(46 !== symb) return parse_conversion (pct_ind, str_ind + 1 | 0, end_ind, plus, hash, space, ign, pad, 0, pad, symb); var str_ind$0 = str_ind + 1 | 0; if(str_ind$0 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); function parse_literal(minus, str_ind){ var match = parse_positive(str_ind, end_ind, 0), prec = match[2], new_ind = match[1]; return parse_after_precision (pct_ind, new_ind, end_ind, minus, plus, hash, space, ign, pad, [0, prec]); } var symb$0 = caml_string_get(str, str_ind$0); if(48 <= symb$0){ if(58 > symb$0) return parse_literal(minus, str_ind$0); } else if(42 <= symb$0) switch(symb$0 - 42 | 0){ case 0: return parse_after_precision (pct_ind, str_ind$0 + 1 | 0, end_ind, minus, plus, hash, space, ign, pad, 1); case 1: case 3: if(legacy_behavior$0){ var a = str_ind$0 + 1 | 0, minus$0 = minus || (45 === symb$0 ? 1 : 0); return parse_literal(minus$0, a); } break; } return legacy_behavior$0 ? parse_after_precision (pct_ind, str_ind$0, end_ind, minus, plus, hash, space, ign, pad, E) : invalid_format_without(str_ind$0 - 1 | 0, 46, cst_precision); } function parse_after_precision (pct_ind, str_ind, end_ind, minus, plus, hash, space, ign, pad, prec){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); function parse_conv(padprec){ return parse_conversion (pct_ind, str_ind + 1 | 0, end_ind, plus, hash, space, ign, pad, prec, padprec, caml_string_get(str, str_ind)); } if(typeof pad !== "number") return parse_conv(pad); if(typeof prec === "number" && ! prec) return parse_conv(0); if(minus){ if(typeof prec === "number") return parse_conv(F); var n = prec[1]; return parse_conv([0, 0, n]); } if(typeof prec === "number") return parse_conv(G); var n$0 = prec[1]; return parse_conv([0, 1, n$0]); } var cst$1 = "' '", cst$0 = "'#'", cst = "'+'"; function parse_conversion (pct_ind, str_ind, end_ind, plus, hash, space, ign, pad, prec, padprec, symb){ var plus_used = [0, 0]; function get_plus(param){plus_used[1] = 1; return plus;} var hash_used = [0, 0]; function get_hash(param){hash_used[1] = 1; return hash;} var space_used = [0, 0]; function get_space(param){space_used[1] = 1; return space;} var ign_used = [0, 0]; function get_ign(param){ign_used[1] = 1; return ign;} var pad_used = [0, 0]; function get_pad(param){pad_used[1] = 1; return pad;} var prec_used = [0, 0]; function get_prec(param){prec_used[1] = 1; return prec;} function get_padprec(param){pad_used[1] = 1; return padprec;} function get_int_pad(param){ var pad = get_pad(0), match = get_prec(0); if(typeof match === "number" && ! match) return pad; if(typeof pad === "number") return 0; if(0 !== pad[0]) return 2 <= pad[1] ? legacy_behavior$0 ? H : incompatible_flag(pct_ind, str_ind, 48, cst_precision) : pad; if(2 > pad[1]) return pad; var n = pad[2]; return legacy_behavior$0 ? [0, 1, n] : incompatible_flag(pct_ind, str_ind, 48, cst_precision); } function check_no_0(symb, pad){ if(typeof pad === "number") return pad; if(0 !== pad[0]) return 2 <= pad[1] ? legacy_behavior$0 ? I : incompatible_flag(pct_ind, str_ind, symb, cst_0) : pad; if(2 > pad[1]) return pad; var width = pad[2]; return legacy_behavior$0 ? [0, 1, width] : incompatible_flag(pct_ind, str_ind, symb, cst_0); } var cst$2 = "'*'"; function opt_of_pad(c, pad){ if(typeof pad === "number") return 0; if(0 === pad[0]) switch(pad[1]){ case 0: var width = pad[2]; return legacy_behavior$0 ? [0, width] : incompatible_flag(pct_ind, str_ind, c, "'-'"); case 1: var width$0 = pad[2]; return [0, width$0]; default: var width$1 = pad[2]; return legacy_behavior$0 ? [0, width$1] : incompatible_flag(pct_ind, str_ind, c, "'0'"); } return incompatible_flag(pct_ind, str_ind, c, cst$2); } function get_pad_opt(c){return opt_of_pad(c, get_pad(0));} function get_padprec_opt(c){return opt_of_pad(c, get_padprec(0));} a: { if(124 > symb) switch(symb){ case 33: var fmt_rest$5 = parse(str_ind, end_ind)[1], fmt_result = [0, [10, fmt_rest$5]]; break a; case 40: var sub_end = search_subformat_end(str_ind, end_ind, 41), fmt_rest$7 = parse(sub_end + 2 | 0, end_ind)[1], sub_fmt = parse(str_ind, sub_end)[1], sub_fmtty = fmtty_of_fmt(sub_fmt); if(get_ign(0)){ var ignored$2 = [9, get_pad_opt(95), sub_fmtty], fmt_result = [0, [23, ignored$2, fmt_rest$7]]; break a; } var fmt_result = [0, [14, get_pad_opt(40), sub_fmtty, fmt_rest$7]]; break a; case 44: var fmt_result = parse(str_ind, end_ind); break a; case 67: var fmt_rest$10 = parse(str_ind, end_ind)[1]; if(get_ign(0)){var fmt_result = [0, [23, 1, fmt_rest$10]]; break a;} var fmt_result = [0, [1, fmt_rest$10]]; break a; case 78: var fmt_rest$14 = parse(str_ind, end_ind)[1], counter$0 = 2; if(get_ign(0)){ var fmt_result = [0, [23, [11, counter$0], fmt_rest$14]]; break a; } var fmt_result = [0, [21, counter$0, fmt_rest$14]]; break a; case 83: var pad$6 = check_no_0(symb, get_padprec(0)), fmt_rest$15 = parse(str_ind, end_ind)[1]; if(get_ign(0)){ var ignored$6 = [1, get_padprec_opt(95)], fmt_result = [0, [23, ignored$6, fmt_rest$15]]; break a; } var match$5 = make_padding_fmt_ebb(pad$6, fmt_rest$15), fmt_rest$16 = match$5[2], pad$7 = match$5[1], fmt_result = [0, [3, pad$7, fmt_rest$16]]; break a; case 91: var match$7 = parse_char_set(str_ind, end_ind), char_set = match$7[2], next_ind = match$7[1], fmt_rest$19 = parse(next_ind, end_ind)[1]; if(get_ign(0)){ var ignored$8 = [10, get_pad_opt(95), char_set], fmt_result = [0, [23, ignored$8, fmt_rest$19]]; break a; } var fmt_result = [0, [20, get_pad_opt(91), char_set, fmt_rest$19]]; break a; case 97: var fmt_rest$20 = parse(str_ind, end_ind)[1], fmt_result = [0, [15, fmt_rest$20]]; break a; case 99: var char_format = function(fmt_rest){ return get_ign(0) ? [0, [23, 0, fmt_rest]] : [0, [0, fmt_rest]]; }, fmt_rest$21 = parse(str_ind, end_ind)[1], match$8 = get_pad_opt(99); if(! match$8){var fmt_result = char_format(fmt_rest$21); break a;} var n = match$8[1]; if(0 === n){ if(get_ign(0)){ var fmt_result = [0, [23, 3, fmt_rest$21]]; break a; } var fmt_result = [0, [22, fmt_rest$21]]; break a; } if(legacy_behavior$0){ var fmt_result = char_format(fmt_rest$21); break a; } var fmt_result = invalid_format_message (str_ind, "non-zero widths are unsupported for %c conversions"); break a; case 114: var fmt_rest$22 = parse(str_ind, end_ind)[1]; if(get_ign(0)){var fmt_result = [0, [23, 2, fmt_rest$22]]; break a;} var fmt_result = [0, [19, fmt_rest$22]]; break a; case 115: var pad$9 = check_no_0(symb, get_padprec(0)), fmt_rest$23 = parse(str_ind, end_ind)[1]; if(get_ign(0)){ var ignored$9 = [0, get_padprec_opt(95)], fmt_result = [0, [23, ignored$9, fmt_rest$23]]; break a; } var match$9 = make_padding_fmt_ebb(pad$9, fmt_rest$23), fmt_rest$24 = match$9[2], pad$10 = match$9[1], fmt_result = [0, [2, pad$10, fmt_rest$24]]; break a; case 116: var fmt_rest$25 = parse(str_ind, end_ind)[1], fmt_result = [0, [16, fmt_rest$25]]; break a; case 123: var sub_end$0 = search_subformat_end(str_ind, end_ind, 125), sub_fmt$0 = parse(str_ind, sub_end$0)[1], fmt_rest$26 = parse(sub_end$0 + 2 | 0, end_ind)[1], sub_fmtty$0 = fmtty_of_fmt(sub_fmt$0); if(get_ign(0)){ var ignored$10 = [8, get_pad_opt(95), sub_fmtty$0], fmt_result = [0, [23, ignored$10, fmt_rest$26]]; break a; } var fmt_result = [0, [13, get_pad_opt(123), sub_fmtty$0, fmt_rest$26]]; break a; case 66: case 98: var pad$3 = check_no_0(symb, get_padprec(0)), fmt_rest$8 = parse(str_ind, end_ind)[1]; if(get_ign(0)){ var ignored$3 = [7, get_padprec_opt(95)], fmt_result = [0, [23, ignored$3, fmt_rest$8]]; break a; } var match$3 = make_padding_fmt_ebb(pad$3, fmt_rest$8), fmt_rest$9 = match$3[2], pad$4 = match$3[1], fmt_result = [0, [9, pad$4, fmt_rest$9]]; break a; case 37: case 64: var fmt_rest$6 = parse(str_ind, end_ind)[1], fmt_result = [0, [12, symb, fmt_rest$6]]; break a; case 76: case 108: case 110: if(str_ind !== end_ind){ var symb$0 = caml_string_get(str, str_ind), i = symb$0 - 88 | 0; b: { if(32 >= i >>> 0) switch(i){ case 0: case 12: case 17: case 23: case 29: case 32: var h = 1; break b; } var h = 0; } if(h) break; } var fmt_rest$13 = parse(str_ind, end_ind)[1]; b: { if(108 <= symb){ if(111 > symb) switch(symb - 108 | 0){ case 0: var counter = 0; break b; case 2: var counter = 1; break b; } } else if(76 === symb){var counter = 2; break b;} throw caml_maybe_attach_backtrace([0, Assert_failure, V], 1); } if(get_ign(0)){ var ignored$5 = [11, counter], fmt_result = [0, [23, ignored$5, fmt_rest$13]]; break a; } var fmt_result = [0, [21, counter, fmt_rest$13]]; break a; case 32: case 35: case 43: case 45: case 95: var fmt_result = caml_call3(failwith_message(M), str, pct_ind, symb); break a; case 88: case 100: case 105: case 111: case 117: case 120: var A = get_space(0), B = get_hash(0), iconv$2 = compute_int_conv(pct_ind, str_ind, get_plus(0), B, A, symb), fmt_rest$17 = parse(str_ind, end_ind)[1]; if(get_ign(0)){ var ignored$7 = [2, iconv$2, get_pad_opt(95)], fmt_result = [0, [23, ignored$7, fmt_rest$17]]; break a; } var C = get_prec(0), match$6 = make_padprec_fmt_ebb(get_int_pad(0), C, fmt_rest$17), fmt_rest$18 = match$6[3], prec$4 = match$6[2], pad$8 = match$6[1], fmt_result = [0, [4, iconv$2, pad$8, prec$4, fmt_rest$18]]; break a; case 69: case 70: case 71: case 72: case 101: case 102: case 103: case 104: var space$1 = get_space(0), hash$1 = get_hash(0), plus$2 = get_plus(0), flag = plus$2 ? space$1 ? legacy_behavior$0 ? 1 : incompatible_flag(pct_ind, str_ind, 32, cst) : 1 : space$1 ? 2 : 0; b: { if(73 <= symb){ var switcher = symb - 101 | 0; if(3 >= switcher >>> 0) switch(switcher){ case 0: var kind = 1; break b; case 1: var kind = 0; break b; case 2: var kind = 3; break b; default: var kind = 6; break b; } } else if(69 <= symb) switch(symb - 69 | 0){ case 0: var kind = 2; break b; case 2: var kind = 4; break b; case 3: var kind = 7; break b; } if(hash$1){ if(70 === symb){var kind = 8; break b;} } else if(70 === symb){var kind = 5; break b;} throw caml_maybe_attach_backtrace([0, Assert_failure, X], 1); } var fconv = [0, flag, kind], fmt_rest$11 = parse(str_ind, end_ind)[1]; if(! get_ign(0)){ var z = get_prec(0), match$4 = make_padprec_fmt_ebb(get_pad(0), z, fmt_rest$11), fmt_rest$12 = match$4[3], prec$3 = match$4[2], pad$5 = match$4[1], fmt_result = [0, [8, fconv, pad$5, prec$3, fmt_rest$12]]; break a; } var match = get_prec(0); if(typeof match === "number") var g = match ? incompatible_flag(pct_ind, str_ind, 95, cst$2) : 0; else var ndec = match[1], g = [0, ndec]; var ignored$4 = [6, get_pad_opt(95), g], fmt_result = [0, [23, ignored$4, fmt_rest$11]]; break a; } if(108 <= symb){ if(111 > symb) switch(symb - 108 | 0){ case 0: var m = caml_string_get(str, str_ind), o = get_space(0), p = get_hash(0), iconv = compute_int_conv(pct_ind, str_ind + 1 | 0, get_plus(0), p, o, m), fmt_rest = parse(str_ind + 1 | 0, end_ind)[1]; if(get_ign(0)){ var ignored = [3, iconv, get_pad_opt(95)], fmt_result = [0, [23, ignored, fmt_rest]]; break a; } var q = get_prec(0), match$0 = make_padprec_fmt_ebb(get_int_pad(0), q, fmt_rest), fmt_rest$0 = match$0[3], prec$0 = match$0[2], pad$0 = match$0[1], fmt_result = [0, [5, iconv, pad$0, prec$0, fmt_rest$0]]; break a; case 2: var r = caml_string_get(str, str_ind), s = get_space(0), t = get_hash(0), iconv$0 = compute_int_conv(pct_ind, str_ind + 1 | 0, get_plus(0), t, s, r), fmt_rest$1 = parse(str_ind + 1 | 0, end_ind)[1]; if(get_ign(0)){ var ignored$0 = [4, iconv$0, get_pad_opt(95)], fmt_result = [0, [23, ignored$0, fmt_rest$1]]; break a; } var u = get_prec(0), match$1 = make_padprec_fmt_ebb(get_int_pad(0), u, fmt_rest$1), fmt_rest$2 = match$1[3], prec$1 = match$1[2], pad$1 = match$1[1], fmt_result = [0, [6, iconv$0, pad$1, prec$1, fmt_rest$2]]; break a; } } else if(76 === symb){ var v = caml_string_get(str, str_ind), w = get_space(0), x = get_hash(0), iconv$1 = compute_int_conv(pct_ind, str_ind + 1 | 0, get_plus(0), x, w, v), fmt_rest$3 = parse(str_ind + 1 | 0, end_ind)[1]; if(get_ign(0)){ var ignored$1 = [5, iconv$1, get_pad_opt(95)], fmt_result = [0, [23, ignored$1, fmt_rest$3]]; break a; } var y = get_prec(0), match$2 = make_padprec_fmt_ebb(get_int_pad(0), y, fmt_rest$3), fmt_rest$4 = match$2[3], prec$2 = match$2[2], pad$2 = match$2[1], fmt_result = [0, [7, iconv$1, pad$2, prec$2, fmt_rest$4]]; break a; } var fmt_result = caml_call3(failwith_message(J), str, str_ind - 1 | 0, symb); } if(1 - legacy_behavior$0){ var a = 1 - plus_used[1], plus$0 = a ? plus : a; if(plus$0) incompatible_flag(pct_ind, str_ind, symb, cst); var b = 1 - hash_used[1], hash$0 = b ? hash : b; if(hash$0) incompatible_flag(pct_ind, str_ind, symb, cst$0); var c = 1 - space_used[1], space$0 = c ? space : c; if(space$0) incompatible_flag(pct_ind, str_ind, symb, cst$1); var d = 1 - pad_used[1], j = d ? caml_notequal([0, pad], K) : d; if(j) incompatible_flag(pct_ind, str_ind, symb, "`padding'"); var e = 1 - prec_used[1], k = e ? caml_notequal([0, prec], L) : e; if(k){ var l = ign ? 95 : symb; incompatible_flag(pct_ind, str_ind, l, "`precision'"); } var plus$1 = ign ? plus : ign; if(plus$1) incompatible_flag(pct_ind, str_ind, 95, cst); } var f = 1 - ign_used[1], ign$0 = f ? ign : f; a: if(ign$0){ b: { if(38 <= symb){ if(44 !== symb && 64 !== symb) break b; } else if(33 !== symb && 37 > symb) break b; if(legacy_behavior$0) break a; } incompatible_flag(pct_ind, str_ind, symb, "'_'"); } return fmt_result; } function parse_after_at(str_ind, end_ind){ if(str_ind === end_ind) return N; var c = caml_string_get(str, str_ind); if(65 <= c){ if(94 <= c){ var switcher = c - 123 | 0; if(2 >= switcher >>> 0) switch(switcher){ case 0: return parse_tag(1, str_ind + 1 | 0, end_ind); case 2: var fmt_rest$0 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 1, fmt_rest$0]]; } } else if(91 <= c) switch(c - 91 | 0){ case 0: return parse_tag(0, str_ind + 1 | 0, end_ind); case 2: var fmt_rest$1 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 0, fmt_rest$1]]; } } else{ if(10 === c){ var fmt_rest$2 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 3, fmt_rest$2]]; } if(32 <= c) switch(c - 32 | 0){ case 0: var fmt_rest$3 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, O, fmt_rest$3]]; case 5: if ((str_ind + 1 | 0) < end_ind && 37 === caml_string_get(str, str_ind + 1 | 0)){ var fmt_rest$4 = parse(str_ind + 2 | 0, end_ind)[1]; return [0, [17, 6, fmt_rest$4]]; } var fmt_rest$5 = parse(str_ind, end_ind)[1]; return [0, [12, 64, fmt_rest$5]]; case 12: var fmt_rest$6 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, P, fmt_rest$6]]; case 14: var fmt_rest$7 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 4, fmt_rest$7]]; case 27: var str_ind$0 = str_ind + 1 | 0; a: try{ var b = str_ind$0 === end_ind, d = b || 60 !== caml_string_get(str, str_ind$0); if(d) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var str_ind_1 = parse_spaces(str_ind$0 + 1 | 0, end_ind), match = caml_string_get(str, str_ind_1); b: { if(48 <= match){ if(58 <= match) break b; } else if(45 !== match) break b; var match$0 = parse_integer(str_ind_1, end_ind), width = match$0[2], str_ind_2 = match$0[1], str_ind_3 = parse_spaces(str_ind_2, end_ind), switcher$0 = caml_string_get(str, str_ind_3) - 45 | 0; if(12 < switcher$0 >>> 0){ if(17 === switcher$0){ var s = Stdlib_String[16].call (null, str, str_ind$0 - 2 | 0, (str_ind_3 - str_ind$0 | 0) + 3 | 0), e = str_ind_3 + 1 | 0, formatting_lit$0 = [0, s, width, 0], next_ind = e; break a; } } else if(1 < switcher$0 - 1 >>> 0){ var match$1 = parse_integer(str_ind_3, end_ind), offset = match$1[2], str_ind_4 = match$1[1], str_ind_5 = parse_spaces(str_ind_4, end_ind); if(62 !== caml_string_get(str, str_ind_5)) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var s$0 = Stdlib_String[16].call (null, str, str_ind$0 - 2 | 0, (str_ind_5 - str_ind$0 | 0) + 3 | 0), f = str_ind_5 + 1 | 0, formatting_lit$0 = [0, s$0, width, offset], next_ind = f; break a; } throw caml_maybe_attach_backtrace(Stdlib[8], 1); } throw caml_maybe_attach_backtrace(Stdlib[8], 1); } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) var formatting_lit$0 = formatting_lit, next_ind = str_ind$0; else{ if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); var formatting_lit$0 = formatting_lit, next_ind = str_ind$0; } } var fmt_rest$10 = parse(next_ind, end_ind)[1]; return [0, [17, formatting_lit$0, fmt_rest$10]]; case 28: var str_ind$1 = str_ind + 1 | 0; try{ var str_ind_1$0 = parse_spaces(str_ind$1, end_ind), match$4 = caml_string_get(str, str_ind_1$0); a: { b: { if(48 <= match$4){ if(58 <= match$4) break b; } else if(45 !== match$4) break b; var match$5 = parse_integer(str_ind_1$0, end_ind), size = match$5[2], str_ind_2$0 = match$5[1], str_ind_3$0 = parse_spaces(str_ind_2$0, end_ind); if(62 !== caml_string_get(str, str_ind_3$0)) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var s$1 = Stdlib_String[16].call (null, str, str_ind$1 - 2 | 0, (str_ind_3$0 - str_ind$1 | 0) + 3 | 0), a = [0, [0, str_ind_3$0 + 1 | 0, [1, s$1, size]]]; break a; } var a = 0; } var match$2 = a; } catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 !== Stdlib[8] && exn$0[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn$0, 0); var match$2 = 0; } if(match$2){ var match$3 = match$2[1], formatting_lit$1 = match$3[2], next_ind$0 = match$3[1], fmt_rest$11 = parse(next_ind$0, end_ind)[1]; return [0, [17, formatting_lit$1, fmt_rest$11]]; } var fmt_rest$12 = parse(str_ind$1, end_ind)[1]; return [0, [17, Q, fmt_rest$12]]; case 31: var fmt_rest$8 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 2, fmt_rest$8]]; case 32: var fmt_rest$9 = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, 5, fmt_rest$9]]; } } var fmt_rest = parse(str_ind + 1 | 0, end_ind)[1]; return [0, [17, [2, c], fmt_rest]]; } function parse_tag(is_open_tag, str_ind, end_ind){ try{ if(str_ind === end_ind) throw caml_maybe_attach_backtrace(Stdlib[8], 1); if(60 !== caml_string_get(str, str_ind)) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var ind = Stdlib_String[32].call(null, str, str_ind + 1 | 0, 62); if(end_ind <= ind) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var sub_str = Stdlib_String[16].call (null, str, str_ind, (ind - str_ind | 0) + 1 | 0), fmt_rest$0 = parse(ind + 1 | 0, end_ind)[1], sub_fmt = parse(str_ind, ind + 1 | 0)[1], sub_format$0 = [0, sub_fmt, sub_str], formatting$0 = is_open_tag ? [0, sub_format$0] : [1, sub_format$0]; return [0, [18, formatting$0, fmt_rest$0]]; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var fmt_rest = parse(str_ind, end_ind)[1], formatting = is_open_tag ? [0, sub_format] : [1, sub_format]; return [0, [18, formatting, fmt_rest]]; } } function parse_char_set(str_ind, end_ind){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var char_set = create_char_set(0); function add_range(c$0, c){ if(c >= c$0){ var i = c$0; for(;;){ add_in_char_set(char_set, Stdlib[29].call(null, i)); var a = i + 1 | 0; if(c === i) break; i = a; } } } function fail_single_percent(str_ind){ return caml_call2(failwith_message(R), str, str_ind); } function parse_char_set_content(counter, str_ind$1, end_ind){ var str_ind = str_ind$1; for(;;){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c = caml_string_get(str, str_ind); if(45 !== c){ if(93 === c) return str_ind + 1 | 0; var a = str_ind + 1 | 0; return counter < 50 ? parse_char_set_after_char$0(counter + 1 | 0, a, end_ind, c) : caml_trampoline_return (parse_char_set_after_char$0, [0, a, end_ind, c]); } add_in_char_set(char_set, 45); var str_ind$0 = str_ind + 1 | 0; str_ind = str_ind$0; } } function parse_char_set_after_char$0(counter, str_ind$2, end_ind, c$3){ var str_ind = str_ind$2, c = c$3; for(;;){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c$0 = caml_string_get(str, str_ind); a: { if(46 <= c$0){ if(64 !== c$0){ if(93 !== c$0) break a; add_in_char_set(char_set, c); return str_ind + 1 | 0; } } else if(37 !== c$0){if(45 <= c$0) break; break a;} if(37 === c){ add_in_char_set(char_set, c$0); var a = str_ind + 1 | 0; return counter < 50 ? parse_char_set_content(counter + 1 | 0, a, end_ind) : caml_trampoline_return (parse_char_set_content, [0, a, end_ind]); } } if(37 === c) fail_single_percent(str_ind); add_in_char_set(char_set, c); var str_ind$0 = str_ind + 1 | 0; str_ind = str_ind$0; c = c$0; } var str_ind$1 = str_ind + 1 | 0; if(str_ind$1 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c$1 = caml_string_get(str, str_ind$1); if(37 === c$1){ if((str_ind$1 + 1 | 0) === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c$2 = caml_string_get(str, str_ind$1 + 1 | 0); if(37 !== c$2 && 64 !== c$2) return fail_single_percent(str_ind$1); add_range(c, c$2); var b = str_ind$1 + 2 | 0; return counter < 50 ? parse_char_set_content(counter + 1 | 0, b, end_ind) : caml_trampoline_return (parse_char_set_content, [0, b, end_ind]); } if(93 === c$1){ add_in_char_set(char_set, c); add_in_char_set(char_set, 45); return str_ind$1 + 1 | 0; } add_range(c, c$1); var d = str_ind$1 + 1 | 0; return counter < 50 ? parse_char_set_content(counter + 1 | 0, d, end_ind) : caml_trampoline_return (parse_char_set_content, [0, d, end_ind]); } function parse_char_set_after_char(str_ind, end_ind, c){ return caml_trampoline (parse_char_set_after_char$0(0, str_ind, end_ind, c)); } if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); if(94 === caml_string_get(str, str_ind)) var str_ind$0 = str_ind + 1 | 0, reverse = 1, str_ind$1 = str_ind$0; else var reverse = 0, str_ind$1 = str_ind; if(str_ind$1 === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c = caml_string_get(str, str_ind$1), next_ind = parse_char_set_after_char(str_ind$1 + 1 | 0, end_ind, c), char_set$0 = freeze_char_set(char_set), a = reverse ? rev_char_set(char_set$0) : char_set$0; return [0, next_ind, a]; } function parse_spaces(str_ind$1, end_ind){ var str_ind = str_ind$1; for(;;){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); if(32 !== caml_string_get(str, str_ind)) return str_ind; var str_ind$0 = str_ind + 1 | 0; str_ind = str_ind$0; } } function parse_positive(str_ind$1, end_ind, acc$0){ var str_ind = str_ind$1, acc = acc$0; for(;;){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c = caml_string_get(str, str_ind); if(9 < c - 48 >>> 0) return [0, str_ind, acc]; var new_acc = (acc * 10 | 0) + (c - 48 | 0) | 0; if(Stdlib_Sys[12] < new_acc){ var a = Stdlib_Sys[12]; return caml_call3(failwith_message(S), str, new_acc, a); } var str_ind$0 = str_ind + 1 | 0; str_ind = str_ind$0; acc = new_acc; } } function parse_integer(str_ind, end_ind){ if(str_ind === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var match = caml_string_get(str, str_ind); if(48 <= match){ if(58 > match) return parse_positive(str_ind, end_ind, 0); } else if(45 === match){ if((str_ind + 1 | 0) === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var c = caml_string_get(str, str_ind + 1 | 0); if(9 < c - 48 >>> 0) return expected_character(str_ind + 1 | 0, "digit", c); var match$0 = parse_positive(str_ind + 1 | 0, end_ind, 0), n = match$0[2], next_ind = match$0[1]; return [0, next_ind, - n | 0]; } throw caml_maybe_attach_backtrace([0, Assert_failure, T], 1); } function add_literal(lit_start, str_ind, fmt){ var size = str_ind - lit_start | 0; return 0 === size ? [0, fmt] : 1 === size ? [0, [12, caml_string_get(str, lit_start), fmt]] : [0, [11, Stdlib_String[16].call(null, str, lit_start, size), fmt]]; } function search_subformat_end(str_ind$7, end_ind, c){ var str_ind = str_ind$7; for(;;){ if(str_ind === end_ind) caml_call3(failwith_message(U), str, c, end_ind); if(37 === caml_string_get(str, str_ind)){ if((str_ind + 1 | 0) === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); if(caml_string_get(str, str_ind + 1 | 0) === c) return str_ind; var match = caml_string_get(str, str_ind + 1 | 0); if(95 <= match){ if(123 <= match){ if(126 > match) switch(match - 123 | 0){ case 0: var sub_end = search_subformat_end(str_ind + 2 | 0, end_ind, 125), str_ind$1 = sub_end + 2 | 0; str_ind = str_ind$1; continue; case 2: return expected_character(str_ind + 1 | 0, "character ')'", 125); } } else if(96 > match){ if((str_ind + 2 | 0) === end_ind) invalid_format_message(end_ind, cst_unexpected_end_of_format); var match$0 = caml_string_get(str, str_ind + 2 | 0); if(40 === match$0){ var sub_end$0 = search_subformat_end(str_ind + 3 | 0, end_ind, 41), str_ind$2 = sub_end$0 + 2 | 0; str_ind = str_ind$2; continue; } if(123 === match$0){ var sub_end$1 = search_subformat_end(str_ind + 3 | 0, end_ind, 125), str_ind$3 = sub_end$1 + 2 | 0; str_ind = str_ind$3; continue; } var str_ind$4 = str_ind + 3 | 0; str_ind = str_ind$4; continue; } } else{ if(40 === match){ var sub_end$2 = search_subformat_end(str_ind + 2 | 0, end_ind, 41), str_ind$5 = sub_end$2 + 2 | 0; str_ind = str_ind$5; continue; } if(41 === match) return expected_character(str_ind + 1 | 0, "character '}'", 41); } var str_ind$0 = str_ind + 2 | 0; str_ind = str_ind$0; } else{var str_ind$6 = str_ind + 1 | 0; str_ind = str_ind$6;} } } function compute_int_conv(pct_ind, str_ind, plus$0, hash$0, space$0, symb){ var plus = plus$0, hash = hash$0, space = space$0; for(;;){ a: { if(plus){ if(! hash){ if(space) break a; if(100 === symb) return 1; if(105 === symb) return 4; break a; } } else{ if(! hash){ if(space){ if(100 === symb) return 2; if(105 === symb) return 5; break a; } var switcher$1 = symb - 88 | 0; if(32 < switcher$1 >>> 0) break a; switch(switcher$1){ case 0: return 8; case 12: return 0; case 17: return 3; case 23: return 10; case 29: return 12; case 32: return 6; default: break a; } } if(! space){ var switcher$0 = symb - 88 | 0; if(32 >= switcher$0 >>> 0) switch(switcher$0){ case 0: return 9; case 12: return 13; case 17: return 14; case 23: return 11; case 29: return 15; case 32: return 7; } } } var switcher = symb - 88 | 0; if(32 >= switcher >>> 0) switch(switcher){ case 0: if(legacy_behavior$0) return 9; break; case 23: if(legacy_behavior$0) return 11; break; case 32: if(legacy_behavior$0) return 7; break; case 12: case 17: case 29: if(! legacy_behavior$0) return incompatible_flag(pct_ind, str_ind, symb, cst$0); hash = 0; continue; } } if(plus) if(space){ if(! legacy_behavior$0) return incompatible_flag(pct_ind, str_ind, 32, cst); space = 0; } else{ if(! legacy_behavior$0) return incompatible_flag(pct_ind, str_ind, symb, cst); plus = 0; } else{ if(! space) throw caml_maybe_attach_backtrace([0, Assert_failure, W], 1); if(! legacy_behavior$0) return incompatible_flag(pct_ind, str_ind, symb, cst$1); space = 0; } } } function incompatible_flag(pct_ind, str_ind, symb, option){ var subfmt = Stdlib_String[16].call(null, str, pct_ind, str_ind - pct_ind | 0); return caml_call5 (failwith_message(Y), str, pct_ind, option, symb, subfmt); } return parse(0, caml_ml_string_length(str)); } var cst_and = " and ", cst_bad_input_format_type_mism = "bad input: format type mismatch between ", cst_bad_input_format_type_mism$0 = "bad input: format type mismatch between %S and %S", Z = [0, [11, cst_bad_input_format_type_mism, [3, 0, [11, cst_and, [3, 0, 0]]]], cst_bad_input_format_type_mism$0]; function format_of_string_fmtty(str, fmtty){ var fmt = fmt_ebb_of_string(0, str)[1]; try{var b = [0, type_format(fmt, fmtty), str]; return b;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Type_mismatch) throw caml_maybe_attach_backtrace(exn, 0); var a = string_of_fmtty(fmtty); return caml_call2(failwith_message(Z), str, a); } } var _ = [0, [11, cst_bad_input_format_type_mism, [3, 0, [11, cst_and, [3, 0, 0]]]], cst_bad_input_format_type_mism$0]; function format_of_string_format(str, param){ var str$0 = param[2], fmt = param[1], fmt$0 = fmt_ebb_of_string(0, str)[1]; try{var a = [0, type_format(fmt$0, fmtty_of_fmt(fmt)), str]; return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Type_mismatch) return caml_call2(failwith_message(_), str, str$0); throw caml_maybe_attach_backtrace(exn, 0); } } runtime.caml_register_global (197, [0, is_in_char_set, rev_char_set, create_char_set, add_in_char_set, freeze_char_set, param_format_of_ignored_format, make_printf, make_iprintf, output_acc, bufput_acc, strput_acc, type_format, fmt_ebb_of_string, format_of_string_fmtty, format_of_string_format, char_of_iconv, string_of_formatting_lit, string_of_fmtty, string_of_fmt, open_box_of_string, symm, trans, recast], "CamlinternalFormat"); return; } (globalThis)); //# 15317 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Printf:[F(2),F(1),F(1),F(1),F(2),F(2),F(2),F(3),F(3),F(2),F(3),F(3),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var global_data = runtime.caml_get_global_data(), Stdlib_Buffer = global_data.Stdlib__Buffer, CamlinternalFormat = global_data.CamlinternalFormat, Stdlib = global_data.Stdlib; function kfprintf(k, o, param){ var fmt = param[1]; return CamlinternalFormat[7].call (null, function(acc){ CamlinternalFormat[9].call(null, o, acc); return caml_call1(k, o); }, 0, fmt); } function kbprintf(k, b, param){ var fmt = param[1]; return CamlinternalFormat[7].call (null, function(acc){ CamlinternalFormat[10].call(null, b, acc); return caml_call1(k, b); }, 0, fmt); } function ikfprintf(k, oc, param){ var fmt = param[1]; return CamlinternalFormat[8].call(null, k, oc, fmt); } function fprintf(oc, fmt){ return kfprintf(function(a){return 0;}, oc, fmt); } function bprintf(b, fmt){return kbprintf(function(a){return 0;}, b, fmt);} function ifprintf(oc, fmt){ return ikfprintf(function(a){return 0;}, oc, fmt); } function ibprintf(b, fmt){ return ikfprintf(function(a){return 0;}, b, fmt); } function printf(fmt){return fprintf(Stdlib[39], fmt);} function eprintf(fmt){return fprintf(Stdlib[40], fmt);} function ksprintf(k, param){ var fmt = param[1]; function k$0(acc){ var buf = Stdlib_Buffer[1].call(null, 64); CamlinternalFormat[11].call(null, buf, acc); return caml_call1(k, Stdlib_Buffer[2].call(null, buf)); } return CamlinternalFormat[7].call(null, k$0, 0, fmt); } function sprintf(fmt){return ksprintf(function(s){return s;}, fmt);} runtime.caml_register_global (3, [0, fprintf, printf, eprintf, sprintf, bprintf, ifprintf, ibprintf, kfprintf, ikfprintf, ksprintf, kbprintf, ikfprintf, ksprintf], "Stdlib__Printf"); return; } (globalThis)); //# 16793 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Printexc:[F(1),F(1),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(1),F(2),F(1),F(1),F(1),N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_get_exception_raw_backtra = runtime.caml_get_exception_raw_backtrace, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_obj_tag = runtime.caml_obj_tag, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call5(f, a0, a1, a2, a3, a4){ return (f.l >= 0 ? f.l : f.l = f.length) === 5 ? f(a0, a1, a2, a3, a4) : runtime.caml_call_gen(f, [a0, a1, a2, a3, a4]); } function caml_call7(f, a0, a1, a2, a3, a4, a5, a6){ return (f.l >= 0 ? f.l : f.l = f.length) === 7 ? f(a0, a1, a2, a3, a4, a5, a6) : runtime.caml_call_gen(f, [a0, a1, a2, a3, a4, a5, a6]); } var global_data = runtime.caml_get_global_data(), Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_Atomic = global_data.Stdlib__Atomic, Stdlib = global_data.Stdlib, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_Obj = global_data.Stdlib__Obj, printers = Stdlib_Atomic[1].call(null, 0), a = [0, [3, 0, 0], "%S"], b = [0, [4, 0, 0, 0, 0], "%d"]; function field(x, i){ var f = x[i + 1]; if(! Stdlib_Obj[1].call(null, f)) return caml_call1(Stdlib_Printf[4].call(null, b), f); var c = Stdlib_Obj[15]; if(caml_obj_tag(f) === c) return caml_call1(Stdlib_Printf[4].call(null, a), f); var d = Stdlib_Obj[16]; return caml_obj_tag(f) === d ? Stdlib[35].call(null, f) : "_"; } var cst = "", c = [0, [11, ", ", [2, 0, [2, 0, 0]]], ", %s%s"]; function other_fields(x, i){ if(x.length - 1 <= i) return cst; var a = other_fields(x, i + 1 | 0), b = field(x, i); return caml_call2(Stdlib_Printf[4].call(null, c), b, a); } function use_printers(x){ var param = Stdlib_Atomic[3].call(null, printers); for(;;){ if(! param) return 0; var tl = param[2], hd = param[1]; try{var val = caml_call1(hd, x);}catch(a){param = tl; continue;} if(val){var s = val[1]; return [0, s];} param = tl; } } var d = [0, [12, 40, [2, 0, [2, 0, [12, 41, 0]]]], "(%s%s)"], e = [0, [12, 40, [2, 0, [12, 41, 0]]], "(%s)"]; function string_of_extension_constructo(t){ if(0 === caml_obj_tag(t)){ var constructor = t[1][1], match = t.length - 1; if(2 < match >>> 0) var b = other_fields(t, 2), c = field(t, 1), a = caml_call2(Stdlib_Printf[4].call(null, d), c, b); else switch(match){ case 2: var g = field(t, 1), a = caml_call1(Stdlib_Printf[4].call(null, e), g); break; case 0: var a = cst; break; default: var a = cst; } var match$0 = [0, constructor, [0, a]]; } else var match$0 = [0, t[1], 0]; var fields_opt = match$0[2], constructor$0 = match$0[1]; if(! fields_opt) return constructor$0; var f = fields_opt[1]; return Stdlib[28].call(null, constructor$0, f); } var cst_characters = ", characters ", locfmt = [0, [11, 'File "', [2, 0, [11, '", line ', [4, 0, 0, 0, [11, cst_characters, [4, 0, 0, 0, [12, 45, [4, 0, 0, 0, [11, ": ", [2, 0, 0]]]]]]]]]], 'File "%s", line %d, characters %d-%d: %s']; function to_string_default(x){ if(x === Stdlib[9]) return "Out of memory"; if(x === Stdlib[10]) return "Stack overflow"; if(x[1] === Stdlib[4]){ var match = x[2], char = match[3], line = match[2], file = match[1]; return caml_call5 (Stdlib_Printf[4].call(null, locfmt), file, line, char, char + 5 | 0, "Pattern matching failed"); } if(x[1] === Stdlib[5]){ var match$0 = x[2], char$0 = match$0[3], line$0 = match$0[2], file$0 = match$0[1]; return caml_call5 (Stdlib_Printf[4].call(null, locfmt), file$0, line$0, char$0, char$0 + 6 | 0, "Assertion failed"); } if(x[1] !== Stdlib[15]) return string_of_extension_constructo(x); var match$1 = x[2], char$1 = match$1[3], line$1 = match$1[2], file$1 = match$1[1]; return caml_call5 (Stdlib_Printf[4].call(null, locfmt), file$1, line$1, char$1, char$1 + 6 | 0, "Undefined recursive module"); } function to_string(e){ var match = use_printers(e); if(! match) return to_string_default(e); var s = match[1]; return s; } var cst_Uncaught_exception = "Uncaught exception: ", cst_Uncaught_exception_s = "Uncaught exception: %s\n", f = [0, [11, cst_Uncaught_exception, [2, 0, [12, 10, 0]]], cst_Uncaught_exception_s]; function print(fct, arg){ try{var b = caml_call1(fct, arg); return b;} catch(x$0){ var x = caml_wrap_exception(x$0), a = to_string(x); caml_call1(Stdlib_Printf[3].call(null, f), a); Stdlib[63].call(null, Stdlib[40]); throw caml_maybe_attach_backtrace(x, 0); } } var g = [0, [11, cst_Uncaught_exception, [2, 0, [12, 10, 0]]], cst_Uncaught_exception_s]; function catch$(fct, arg){ try{var b = caml_call1(fct, arg); return b;} catch(x$0){ var x = caml_wrap_exception(x$0); Stdlib[63].call(null, Stdlib[39]); var a = to_string(x); caml_call1(Stdlib_Printf[3].call(null, g), a); return Stdlib[99].call(null, 2); } } function raw_backtrace_entries(bt){return bt;} function convert_raw_backtrace(bt){ return [0, runtime.caml_convert_raw_backtrace(bt)]; } var h = [0, [12, 32, [4, 0, 0, 0, 0]], " %d"], i = [0, [2, 0, [12, 32, [2, 0, [11, ' in file "', [2, 0, [12, 34, [2, 0, [11, ", line", [2, 0, [11, cst_characters, [4, 0, 0, 0, [12, 45, [4, 0, 0, 0, 0]]]]]]]]]]]]], '%s %s in file "%s"%s, line%s, characters %d-%d'], j = [0, [11, "s ", [4, 0, 0, 0, [12, 45, [4, 0, 0, 0, 0]]]], "s %d-%d"], k = [0, [2, 0, [11, " unknown location", 0]], "%s unknown location"]; function format_backtrace_slot(pos, slot){ function info(is_raise){ return is_raise ? 0 === pos ? "Raised at" : "Re-raised at" : 0 === pos ? "Raised by primitive operation at" : "Called from"; } if(0 !== slot[0]){ if(slot[1]) return 0; var n = info(0); return [0, caml_call1(Stdlib_Printf[4].call(null, k), n)]; } if(slot[3] === slot[6]) var a = slot[3], lines = caml_call1(Stdlib_Printf[4].call(null, h), a); else var l = slot[6], m = slot[3], lines = caml_call2(Stdlib_Printf[4].call(null, j), m, l); var b = slot[7], c = slot[4], d = slot[8] ? " (inlined)" : cst, e = slot[2], f = slot[9], g = info(slot[1]); return [0, caml_call7 (Stdlib_Printf[4].call(null, i), g, f, e, d, lines, c, b)]; } var cst_s = "%s\n", cst_Program_not_linked_with_g_ = "(Program not linked with -g, cannot print stack backtrace)\n", l = [0, [2, 0, [12, 10, 0]], cst_s], m = [0, [11, cst_Program_not_linked_with_g_, 0], cst_Program_not_linked_with_g_]; function print_raw_backtrace(outchan, raw_backtrace){ var backtrace = convert_raw_backtrace(raw_backtrace); if(! backtrace) return Stdlib_Printf[1].call(null, outchan, m); var a = backtrace[1], b = a.length - 2 | 0; if(b >= 0){ var i = 0; for(;;){ var match = format_backtrace_slot(i, caml_check_bound(a, i)[i + 1]); if(match){ var str = match[1]; caml_call1(Stdlib_Printf[1].call(null, outchan, l), str); } var c = i + 1 | 0; if(b === i) break; i = c; } } return 0; } function print_backtrace(outchan){ return print_raw_backtrace(outchan, caml_get_exception_raw_backtra(0)); } var n = [0, [2, 0, [12, 10, 0]], cst_s]; function raw_backtrace_to_string(raw_backtrace){ var backtrace = convert_raw_backtrace(raw_backtrace); if(! backtrace) return cst_Program_not_linked_with_g_; var a = backtrace[1], b = Stdlib_Buffer[1].call(null, 1024), c = a.length - 2 | 0; if(c >= 0){ var i = 0; for(;;){ var match = format_backtrace_slot(i, caml_check_bound(a, i)[i + 1]); if(match){ var str = match[1]; caml_call1(Stdlib_Printf[5].call(null, b, n), str); } var d = i + 1 | 0; if(c === i) break; i = d; } } return Stdlib_Buffer[2].call(null, b); } function backtrace_slot_is_raise(param){ return 0 === param[0] ? param[1] : param[1]; } function backtrace_slot_is_inline(param){return 0 === param[0] ? param[8] : 0; } function backtrace_slot_location(param){ return 0 === param[0] ? [0, [0, param[2], param[3], param[4], param[5], param[6], param[7]]] : 0; } function backtrace_slot_defname(param){ if(0 === param[0] && param[9] !== cst) return [0, param[9]]; return 0; } function backtrace_slots(raw_backtrace){ var match = convert_raw_backtrace(raw_backtrace); if(! match) return 0; var backtrace = match[1], i$1 = backtrace.length - 2 | 0, i = i$1; for(;;){ if(-1 === i) var b = 0; else{ var a = 0 === caml_check_bound(backtrace, i)[i + 1][0] ? 1 : 0; if(! a){var i$0 = i - 1 | 0; i = i$0; continue;} var b = a; } return b ? [0, backtrace] : 0; } } function backtrace_slots_of_raw_entry(entry){return backtrace_slots([0, entry]); } function raw_backtrace_length(bt){return bt.length - 1;} function get_backtrace(param){ return raw_backtrace_to_string(caml_get_exception_raw_backtra(0)); } function register_printer(fn){ for(;;){ var old_printers = Stdlib_Atomic[3].call(null, printers), new_printers = [0, fn, old_printers], success = Stdlib_Atomic[6].call(null, printers, old_printers, new_printers), a = 1 - success; if(! a) return a; } } function exn_slot(x){return 0 === caml_obj_tag(x) ? x[1] : x;} function exn_slot_id(x){var slot = exn_slot(x); return slot[2];} function exn_slot_name(x){var slot = exn_slot(x); return slot[1];} var errors = runtime.caml_obj_dup ([0, cst, "(Cannot print locations:\n bytecode executable program file not found)", "(Cannot print locations:\n bytecode executable program file appears to be corrupt)", "(Cannot print locations:\n bytecode executable program file has wrong magic number)", "(Cannot print locations:\n bytecode executable program file cannot be opened;\n -- too many open files. Try running with OCAMLRUNPARAM=b=2)"]), cst_Fatal_error_exception = "Fatal error: exception ", cst_Fatal_error_exception_s = "Fatal error: exception %s\n", o = [0, [11, cst_Fatal_error_exception, [2, 0, [12, 10, 0]]], cst_Fatal_error_exception_s]; function default_uncaught_exception_han(exn, raw_backtrace){ var b = to_string(exn); caml_call1(Stdlib_Printf[3].call(null, o), b); print_raw_backtrace(Stdlib[40], raw_backtrace); var status = runtime.caml_ml_debug_info_status(0); if(status < 0){ var a = Stdlib[18].call(null, status), c = caml_check_bound(errors, a)[a + 1]; Stdlib[53].call(null, c); } return Stdlib[63].call(null, Stdlib[40]); } var uncaught_exception_handler = [0, default_uncaught_exception_han]; function set_uncaught_exception_handler(fn){ uncaught_exception_handler[1] = fn; return 0; } var empty_backtrace = [0], p = [0, [11, cst_Fatal_error_exception, [2, 0, [12, 10, 0]]], cst_Fatal_error_exception_s], q = [0, [11, "Fatal error in uncaught exception handler: exception ", [2, 0, [12, 10, 0]]], "Fatal error in uncaught exception handler: exception %s\n"]; function handle_uncaught_exception(exn$1, debugger_in_use){ try{ try{ var raw_backtrace = debugger_in_use ? empty_backtrace : caml_get_exception_raw_backtra(0); try{Stdlib[103].call(null, 0);}catch(exn){} try{ var e = caml_call2(uncaught_exception_handler[1], exn$1, raw_backtrace), a = e; } catch(exn){ var exn$0 = caml_wrap_exception(exn), raw_backtrace$0 = caml_get_exception_raw_backtra(0), c = to_string(exn$1); caml_call1(Stdlib_Printf[3].call(null, p), c); print_raw_backtrace(Stdlib[40], raw_backtrace); var d = to_string(exn$0); caml_call1(Stdlib_Printf[3].call(null, q), d); print_raw_backtrace(Stdlib[40], raw_backtrace$0); var a = Stdlib[63].call(null, Stdlib[40]); } var b = a; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[9]) throw caml_maybe_attach_backtrace(exn, 0); var b = Stdlib[53].call (null, "Fatal error: out of memory in uncaught exception handler"); } return b; } catch(exn){return 0;} } runtime.caml_register_named_value ("Printexc.handle_uncaught_exception", handle_uncaught_exception); var Stdlib_Printexc = [0, to_string, to_string_default, print, catch$, print_backtrace, get_backtrace, runtime.caml_record_backtrace, runtime.caml_backtrace_status, register_printer, use_printers, raw_backtrace_entries, caml_get_exception_raw_backtra, print_raw_backtrace, raw_backtrace_to_string, default_uncaught_exception_han, set_uncaught_exception_handler, backtrace_slots, backtrace_slots_of_raw_entry, [0, backtrace_slot_is_raise, backtrace_slot_is_inline, backtrace_slot_location, backtrace_slot_defname, format_backtrace_slot], raw_backtrace_length, runtime.caml_raw_backtrace_slot, runtime.caml_convert_raw_backtrace_slot, runtime.caml_raw_backtrace_next_slot, exn_slot_id, exn_slot_name, string_of_extension_constructo]; runtime.caml_register_global(43, Stdlib_Printexc, "Stdlib__Printexc"); return; } (globalThis)); //# 17276 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Fun:[F(2)*,F(3),F(3),F(2),F(2),N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_restore_raw_backtrace = runtime.caml_restore_raw_backtrace, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib_Printexc = global_data.Stdlib__Printexc, Stdlib = global_data.Stdlib; function const$(c, param){return c;} function compose(f, g, x){return caml_call1(f, caml_call1(g, x));} function flip(f, x, y){return caml_call2(f, y, x);} function negate(p, v){return 1 - caml_call1(p, v);} var Finally_raised = [248, "Stdlib.Fun.Finally_raised", runtime.caml_fresh_oo_id(0)]; Stdlib_Printexc[9].call (null, function(param){ if(param[1] !== Finally_raised) return 0; var exn = param[2], a = Stdlib_Printexc[1].call(null, exn); return [0, Stdlib[28].call(null, "Fun.Finally_raised: ", a)]; }); var dummy = 0; function protect(finally$, work){ function finally_no_exn(param){ try{caml_call1(finally$, 0); return;} catch(e$0){ var e = caml_wrap_exception(e$0), bt = Stdlib_Printexc[12].call(null, 0), exn = [0, Finally_raised, e]; caml_restore_raw_backtrace(exn, bt); throw caml_maybe_attach_backtrace(exn, 0); } } try{var result = caml_call1(work, 0);} catch(work_exn$0){ var work_exn = caml_wrap_exception(work_exn$0), work_bt = Stdlib_Printexc[12].call(null, 0); finally_no_exn(0); caml_restore_raw_backtrace(work_exn, work_bt); throw caml_maybe_attach_backtrace(work_exn, 0); } finally_no_exn(0); return result; } runtime.caml_register_global (4, [0, const$, compose, flip, negate, protect, Finally_raised], "Stdlib__Fun"); return; } (globalThis)); //# 17540 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__In_channel:[N,F(1),F(1),F(3),F(2),F(2),F(4),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(4),F(4),F(4),F(4),F(3),N,N,N,F(2),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_ba_dim_1 = runtime.caml_ba_dim_1, caml_create_bytes = runtime.caml_create_bytes, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_bytes_length = runtime.caml_ml_bytes_length, caml_ml_input_bigarray = runtime.caml_ml_input_bigarray, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Bytes = global_data.Stdlib__Bytes, Stdlib_Sys = global_data.Stdlib__Sys, Stdlib_Fun = global_data.Stdlib__Fun, stdin = Stdlib[38], open_bin = Stdlib[80], open_text = Stdlib[79], open_gen = Stdlib[81]; function with_open(openfun, s, f){ var ic = caml_call1(openfun, s); return Stdlib_Fun[5].call (null, function(param){return Stdlib[94].call(null, ic);}, function(param){return caml_call1(f, ic);}); } function with_open_bin(s, f){return with_open(Stdlib[80], s, f);} function with_open_text(s, f){return with_open(Stdlib[79], s, f);} function with_open_gen(flags, perm, s, f){ var a = Stdlib[81]; return with_open(function(b){return a(flags, perm, b);}, s, f); } var seek = Stdlib[96][4], pos = Stdlib[96][5], length = Stdlib[96][6], close = Stdlib[93], close_noerr = Stdlib[94]; function input_char(ic){ try{var c = Stdlib[82].call(null, ic);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return [0, c]; } function input_byte(ic){ try{var n = Stdlib[87].call(null, ic);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return [0, n]; } function input_line(ic){ try{var s = Stdlib[83].call(null, ic);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return [0, s]; } var input = Stdlib[84]; function input_bigarray(ic, buf, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ba_dim_1(buf) - len | 0) >= ofs) return caml_ml_input_bigarray(ic, buf, ofs, len); return Stdlib[1].call(null, "input_bigarray"); } var a = [0, 0]; function really_input(ic, buf, pos, len){ try{Stdlib[85].call(null, ic, buf, pos, len); return a;} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } } var b = [0, 0]; function really_input_bigarray(ic, buf, ofs$1, len$1){ if(0 <= ofs$1 && 0 <= len$1 && (caml_ba_dim_1(buf) - len$1 | 0) >= ofs$1){ var ofs = ofs$1, len = len$1; for(;;){ if(0 >= len) return b; var r = caml_ml_input_bigarray(ic, buf, ofs, len); if(0 === r) return 0; var len$0 = len - r | 0, ofs$0 = ofs + r | 0; ofs = ofs$0; len = len$0; } } return Stdlib[1].call(null, "really_input_bigarray"); } function really_input_string(ic, len){ try{var s = Stdlib[86].call(null, ic, len);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } return [0, s]; } function read_upto(ic, buf, ofs, len){ var ofs$0 = ofs, len$0 = len; for(;;){ if(0 !== len$0){ var r = Stdlib[84].call(null, ic, buf, ofs$0, len$0); if(0 !== r){ var len$1 = len$0 - r | 0, ofs$1 = ofs$0 + r | 0; ofs$0 = ofs$1; len$0 = len$1; continue; } } return ofs$0 - ofs | 0; } } function ensure(buf, ofs, n){ var len = caml_ml_bytes_length(buf); if((ofs + n | 0) <= len) return buf; var new_len$0 = len; for(;;){ if(new_len$0 >= (ofs + n | 0)) break; new_len$0 = (2 * new_len$0 | 0) + 1 | 0; } var new_len = new_len$0 <= Stdlib_Sys[12] ? new_len$0 : ofs < Stdlib_Sys[12] ? Stdlib_Sys[12] : Stdlib [2].call (null, "In_channel.input_all: channel content is larger than maximum string length"), new_buf = caml_create_bytes(new_len); Stdlib_Bytes[11].call(null, buf, 0, new_buf, 0, ofs); return new_buf; } function input_all(ic){ try{ var a = Stdlib[91].call(null, ic), b = Stdlib[92].call(null, ic) - a | 0, initial_size = b; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(exn, 0); var initial_size = -1; } var chunk_size = 65536, initial_size$0 = 0 <= initial_size ? initial_size : chunk_size, initial_size$1 = initial_size$0 <= Stdlib_Sys[12] ? initial_size$0 : Stdlib_Sys[12], buf = caml_create_bytes(initial_size$1), nread = read_upto(ic, buf, 0, initial_size$1); if(nread < initial_size$1) return Stdlib_Bytes[8].call(null, buf, 0, nread); try{var c = Stdlib[82].call(null, ic);} catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 === Stdlib[12]) return Stdlib_Bytes[44].call(null, buf); throw caml_maybe_attach_backtrace(exn$0, 0); } var buf$2 = ensure(buf, nread, 65537); runtime.caml_bytes_set(buf$2, nread, c); var ofs$1 = nread + 1 | 0, buf$0 = buf$2, ofs = ofs$1; for(;;){ var buf$1 = ensure(buf$0, ofs, chunk_size), rem = caml_ml_bytes_length(buf$1) - ofs | 0, r = read_upto(ic, buf$1, ofs, rem); if(r < rem) return Stdlib_Bytes[8].call(null, buf$1, 0, ofs + r | 0); var ofs$0 = ofs + rem | 0; buf$0 = buf$1; ofs = ofs$0; } } function input_lines(ic){ try{var line = Stdlib[83].call(null, ic);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return 0; throw caml_maybe_attach_backtrace(exn, 0); } var block = [0, line, 24029], dst = block, offset = 1; for(;;){ try{var line$0 = Stdlib[83].call(null, ic);} catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 !== Stdlib[12]) throw caml_maybe_attach_backtrace(exn$0, 0); dst[offset + 1] = 0; return block; } var dst$0 = [0, line$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; } } function fold_lines(f, accu$1, ic){ var accu = accu$1; for(;;){ try{var line = Stdlib[83].call(null, ic);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[12]) return accu; throw caml_maybe_attach_backtrace(exn, 0); } var accu$0 = caml_call2(f, accu, line); accu = accu$0; } } var set_binary_mode = Stdlib[95], Stdlib_In_channel = [0, stdin, open_bin, open_text, open_gen, with_open_bin, with_open_text, with_open_gen, close, close_noerr, input_char, input_byte, input_line, really_input_string, input_all, input_lines, input, input_bigarray, really_input, really_input_bigarray, fold_lines, seek, pos, length, set_binary_mode, runtime.caml_ml_is_binary_mode, runtime.caml_sys_isatty]; runtime.caml_register_global(9, Stdlib_In_channel, "Stdlib__In_channel"); return; } (globalThis)); //# 17897 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Digest:[F(2)*,F(2)*,F(1),F(1),F(3),F(3),F(2),F(1),F(2),F(1),F(1),F(1),F(1),N,N,N,N] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_blake2_final = runtime.caml_blake2_final, caml_blake2_string = runtime.caml_blake2_string, caml_blake2_update = runtime.caml_blake2_update, caml_bytes_unsafe_set = runtime.caml_bytes_unsafe_set, caml_create_bytes = runtime.caml_create_bytes, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_md5_chan = runtime.caml_md5_chan, caml_md5_string = runtime.caml_md5_string, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_get = runtime.caml_string_get, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_In_channel = global_data.Stdlib__In_channel, Stdlib_Bytes = global_data.Stdlib__Bytes, Stdlib_Int = global_data.Stdlib__Int, Stdlib_String = global_data.Stdlib__String, Stdlib_Char = global_data.Stdlib__Char; function hex_of_string(d){ function char_hex(n){ var a = 10 <= n ? (97 + n | 0) - 10 | 0 : 48 + n | 0; return Stdlib_Char[1].call(null, a); } var len = caml_ml_string_length(d), result = caml_create_bytes(len * 2 | 0), a = len - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var x = caml_string_get(d, i); caml_bytes_unsafe_set(result, i * 2 | 0, char_hex(x >>> 4 | 0)); caml_bytes_unsafe_set(result, (i * 2 | 0) + 1 | 0, char_hex(x & 15)); var b = i + 1 | 0; if(a === i) break; i = b; } } return Stdlib_Bytes[44].call(null, result); } var cst_Digest_of_hex = "Digest.of_hex"; function string_of_hex(s){ function digit(c){ if(65 <= c){ if(97 <= c){ if(103 > c) return (c - 97 | 0) + 10 | 0; } else if(71 > c) return (c - 65 | 0) + 10 | 0; } else if(9 >= c - 48 >>> 0) return c - 48 | 0; return Stdlib[1].call(null, cst_Digest_of_hex); } return Stdlib_String[2].call (null, caml_ml_string_length(s) / 2 | 0, function(i){ var i$0 = 2 * i | 0, a = digit(caml_string_get(s, i$0 + 1 | 0)), b = (digit(caml_string_get(s, i$0)) << 4) + a | 0; return Stdlib_Char[1].call(null, b); }); } var cst_Digest_substring = "Digest.substring", cst_Digest_to_hex = "Digest.to_hex"; function BLAKE2(X){ var a = X[1] < 1, b = a || 64 < X[1]; if(b) Stdlib[1].call(null, "Digest.BLAKE2: wrong hash size"); var hash_length = X[1], compare = Stdlib_String[10], equal = Stdlib_String[9], cst = ""; function string(str){ return caml_blake2_string (hash_length, cst, str, 0, caml_ml_string_length(str)); } function bytes(b){return string(Stdlib_Bytes[44].call(null, b));} function substring(str, ofs, len){ var a = ofs < 0; if(a) var b = a; else var c = len < 0, b = c || (caml_ml_string_length(str) - len | 0) < ofs; if(b) Stdlib[1].call(null, cst_Digest_substring); return caml_blake2_string(hash_length, cst, str, ofs, len); } function subbytes(b, ofs, len){ return substring(Stdlib_Bytes[44].call(null, b), ofs, len); } function channel(ic, toread){ var buf = caml_create_bytes(4096), ctx = runtime.caml_blake2_create(hash_length, cst), buf_size = 4096; if(0 <= toread){ var toread$0 = toread; for(;;){ if(0 === toread$0) return caml_blake2_final(ctx, hash_length); var a = Stdlib_Int[10].call(null, buf_size, toread$0), n = Stdlib_In_channel[16].call(null, ic, buf, 0, a); if(0 === n) throw caml_maybe_attach_backtrace(Stdlib[12], 1); caml_blake2_update(ctx, Stdlib_Bytes[44].call(null, buf), 0, n); var toread$1 = toread$0 - n | 0; toread$0 = toread$1; } } else for(;;){ var n$0 = Stdlib_In_channel[16].call(null, ic, buf, 0, buf_size); if(0 === n$0) return caml_blake2_final(ctx, hash_length); caml_blake2_update(ctx, Stdlib_Bytes[44].call(null, buf), 0, n$0); } } function file(filename){ return Stdlib_In_channel[5].call (null, filename, function(ic){return channel(ic, -1);}); } function output(chan, digest){return Stdlib[66].call(null, chan, digest);} function input(chan){return Stdlib[86].call(null, chan, hash_length);} function to_hex(d){ if(caml_ml_string_length(d) !== hash_length) Stdlib[1].call(null, cst_Digest_to_hex); return hex_of_string(d); } function of_hex(s){ if(caml_ml_string_length(s) !== (hash_length * 2 | 0)) Stdlib[1].call(null, cst_Digest_of_hex); return string_of_hex(s); } return [0, hash_length, compare, equal, string, bytes, substring, subbytes, channel, file, output, input, to_hex, of_hex]; } var BLAKE128 = BLAKE2([0, 16]), BLAKE256 = BLAKE2([0, 32]), BLAKE512 = BLAKE2([0, 64]), compare = Stdlib_String[10], equal = Stdlib_String[9]; function string(str){ return caml_md5_string(str, 0, caml_ml_string_length(str)); } function bytes(b){return string(Stdlib_Bytes[44].call(null, b));} function substring(str, ofs, len){ if(0 <= ofs && 0 <= len && (caml_ml_string_length(str) - len | 0) >= ofs) return caml_md5_string(str, ofs, len); return Stdlib[1].call(null, cst_Digest_substring); } function subbytes(b, ofs, len){ return substring(Stdlib_Bytes[44].call(null, b), ofs, len); } function file(filename){ return Stdlib_In_channel[5].call (null, filename, function(ic){return caml_md5_chan(ic, -1);}); } function output(chan, digest){return Stdlib[66].call(null, chan, digest);} function input(chan){return Stdlib[86].call(null, chan, 16);} function to_hex(d){ if(16 !== caml_ml_string_length(d)) Stdlib[1].call(null, cst_Digest_to_hex); return hex_of_string(d); } function of_hex(s){ if(32 !== caml_ml_string_length(s)) Stdlib[1].call(null, "Digest.from_hex"); return string_of_hex(s); } runtime.caml_register_global (17, [0, compare, equal, string, bytes, substring, subbytes, caml_md5_chan, file, output, input, to_hex, of_hex, of_hex, BLAKE128, BLAKE256, BLAKE512, [0, 16, compare, equal, string, bytes, substring, subbytes, caml_md5_chan, file, output, input, to_hex, of_hex]], "Stdlib__Digest"); return; } (globalThis)); //# 18123 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Bigarray:[N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1)*,N,N,N,N,N,N,N,F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(3),F(4)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_ba_change_layout = runtime.caml_ba_change_layout, caml_ba_create = runtime.caml_ba_create, caml_ba_dim_1 = runtime.caml_ba_dim_1, caml_ba_dim_2 = runtime.caml_ba_dim_2, caml_ba_kind = runtime.caml_ba_kind, caml_ba_num_dims = runtime.caml_ba_num_dims, caml_ba_reshape = runtime.caml_ba_reshape, caml_ba_set_1 = runtime.caml_ba_set_1, caml_ba_set_2 = runtime.caml_ba_set_2, caml_ba_set_3 = runtime.caml_ba_set_3, caml_ba_set_generic = runtime.caml_ba_set_generic, caml_ba_slice = runtime.caml_ba_slice, caml_check_bound = runtime.caml_check_bound, caml_make_vect = runtime.caml_make_vect, caml_mul = runtime.caml_mul; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var dummy = 0, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Array = global_data.Stdlib__Array, Stdlib_Sys = global_data.Stdlib__Sys; function kind_size_in_bytes(param){ switch(param){ case 11: return 16; case 0: case 6: return 4; case 8: case 9: return Stdlib_Sys[9] / 8 | 0; case 1: case 7: case 10: return 8; case 2: case 3: case 12: return 1; default: return 2; } } function cloop(arr, idx, f, col, max){ if(col === idx.length - 1){ caml_ba_set_generic(arr, idx, caml_call1(f, idx)); return; } var a = caml_check_bound(max, col)[col + 1] - 1 | 0; if(a >= 0){ var j = 0; for(;;){ caml_check_bound(idx, col)[col + 1] = j; cloop(arr, idx, f, col + 1 | 0, max); var b = j + 1 | 0; if(a === j) break; j = b; } } } function floop(arr, idx, f, col, max){ if(0 > col){caml_ba_set_generic(arr, idx, caml_call1(f, idx)); return;} var a = caml_check_bound(max, col)[col + 1]; if(a >= 1){ var j = 1; for(;;){ caml_check_bound(idx, col)[col + 1] = j; floop(arr, idx, f, col - 1 | 0, max); var b = j + 1 | 0; if(a === j) break; j = b; } } } function init(kind, layout, dims, f){ var arr = caml_ba_create(kind, layout, dims), dlen = dims.length - 1; return layout ? (floop (arr, caml_make_vect(dlen, 1), f, dlen - 1 | 0, dims), arr) : (cloop(arr, caml_make_vect(dlen, 0), f, 0, dims), arr); } function dims(a){ var n = caml_ba_num_dims(a), d = caml_make_vect(n, 0), b = n - 1 | 0; if(b >= 0){ var i = 0; for(;;){ var c = runtime.caml_ba_dim(a, i); caml_check_bound(d, i)[i + 1] = c; var e = i + 1 | 0; if(b === i) break; i = e; } } return d; } function size_in_bytes(arr){ var a = dims(arr), b = Stdlib_Array[18].call(null, caml_mul, 1, a); return caml_mul(kind_size_in_bytes(caml_ba_kind(arr)), b); } function create(kind, layout){return caml_ba_create(kind, layout, [0]);} function get(arr){return runtime.caml_ba_get_generic(arr, [0]);} function set(arr){ var a = [0]; return function(b){return caml_ba_set_generic(arr, a, b);}; } function size_in_bytes$0(arr){ return kind_size_in_bytes(caml_ba_kind(arr)); } function of_value(kind, layout, v){ var a = create(kind, layout); set(a)(v); return a; } function create$0(kind, layout, dim){ return caml_ba_create(kind, layout, [0, dim]); } function size_in_bytes$1(arr){ var a = caml_ba_dim_1(arr); return caml_mul(kind_size_in_bytes(caml_ba_kind(arr)), a); } function slice(a, n){ return runtime.caml_ba_layout(a) ? caml_ba_slice(a, [0, n]) : caml_ba_slice(a, [0, n]); } function init$0(kind, layout, dim, f){ var arr = create$0(kind, layout, dim); if(layout){ if(dim >= 1){ var i$0 = 1; for(;;){ caml_ba_set_1(arr, i$0, caml_call1(f, i$0)); var c = i$0 + 1 | 0; if(dim === i$0) break; i$0 = c; } } return arr; } var a = dim - 1 | 0; if(a >= 0){ var i = 0; for(;;){ caml_ba_set_1(arr, i, caml_call1(f, i)); var b = i + 1 | 0; if(a === i) break; i = b; } } return arr; } function of_array(kind, layout, data){ var ba = create$0(kind, layout, data.length - 1), ofs = layout ? 1 : 0, a = data.length - 2 | 0; if(a >= 0){ var i = 0; for(;;){ caml_ba_set_1(ba, i + ofs | 0, caml_check_bound(data, i)[i + 1]); var b = i + 1 | 0; if(a === i) break; i = b; } } return ba; } function create$1(kind, layout, dim1, dim2){ return caml_ba_create(kind, layout, [0, dim1, dim2]); } function size_in_bytes$2(arr){ var a = caml_ba_dim_2(arr), b = caml_ba_dim_1(arr); return caml_mul(caml_mul(kind_size_in_bytes(caml_ba_kind(arr)), b), a); } function slice_left(a, n){return caml_ba_slice(a, [0, n]);} function slice_right(a, n){return caml_ba_slice(a, [0, n]);} function init$1(kind, layout, dim1, dim2, f){ var arr = create$1(kind, layout, dim1, dim2); if(layout){ if(dim2 >= 1){ var j$0 = 1; for(;;){ if(dim1 >= 1){ var i$0 = 1; for(;;){ caml_ba_set_2(arr, i$0, j$0, caml_call2(f, i$0, j$0)); var g = i$0 + 1 | 0; if(dim1 === i$0) break; i$0 = g; } } var e = j$0 + 1 | 0; if(dim2 === j$0) break; j$0 = e; } } return arr; } var a = dim1 - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var b = dim2 - 1 | 0; if(b >= 0){ var j = 0; for(;;){ caml_ba_set_2(arr, i, j, caml_call2(f, i, j)); var d = j + 1 | 0; if(b === j) break; j = d; } } var c = i + 1 | 0; if(a === i) break; i = c; } } return arr; } function of_array$0(kind, layout, data){ var dim1 = data.length - 1, dim2 = 0 === dim1 ? 0 : caml_check_bound(data, 0)[1].length - 1, ba = create$1(kind, layout, dim1, dim2), ofs = layout ? 1 : 0, a = dim1 - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var row = caml_check_bound(data, i)[i + 1]; if(row.length - 1 !== dim2) Stdlib[1].call(null, "Bigarray.Array2.of_array: non-rectangular data"); var b = dim2 - 1 | 0; if(b >= 0){ var j = 0; for(;;){ caml_ba_set_2 (ba, i + ofs | 0, j + ofs | 0, caml_check_bound(row, j)[j + 1]); var d = j + 1 | 0; if(b === j) break; j = d; } } var c = i + 1 | 0; if(a === i) break; i = c; } } return ba; } function create$2(kind, layout, dim1, dim2, dim3){ return caml_ba_create(kind, layout, [0, dim1, dim2, dim3]); } function size_in_bytes$3(arr){ var a = runtime.caml_ba_dim_3(arr), b = caml_ba_dim_2(arr), c = caml_ba_dim_1(arr); return caml_mul (caml_mul(caml_mul(kind_size_in_bytes(caml_ba_kind(arr)), c), b), a); } function slice_left_1(a, n, m){return caml_ba_slice(a, [0, n, m]);} function slice_right_1(a, n, m){return caml_ba_slice(a, [0, n, m]);} function slice_left_2(a, n){return caml_ba_slice(a, [0, n]);} function slice_right_2(a, n){return caml_ba_slice(a, [0, n]);} function init$2(kind, layout, dim1, dim2, dim3, f){ var arr = create$2(kind, layout, dim1, dim2, dim3); if(layout){ if(dim3 >= 1){ var k$0 = 1; for(;;){ if(dim2 >= 1){ var j$0 = 1; for(;;){ if(dim1 >= 1){ var i$0 = 1; for(;;){ caml_ba_set_3(arr, i$0, j$0, k$0, caml_call3(f, i$0, j$0, k$0)); var m = i$0 + 1 | 0; if(dim1 === i$0) break; i$0 = m; } } var l = j$0 + 1 | 0; if(dim2 === j$0) break; j$0 = l; } } var h = k$0 + 1 | 0; if(dim3 === k$0) break; k$0 = h; } } return arr; } var a = dim1 - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var b = dim2 - 1 | 0; if(b >= 0){ var j = 0; for(;;){ var c = dim3 - 1 | 0; if(c >= 0){ var k = 0; for(;;){ caml_ba_set_3(arr, i, j, k, caml_call3(f, i, j, k)); var g = k + 1 | 0; if(c === k) break; k = g; } } var e = j + 1 | 0; if(b === j) break; j = e; } } var d = i + 1 | 0; if(a === i) break; i = d; } } return arr; } function of_array$1(kind, layout, data){ var dim1 = data.length - 1, dim2 = 0 === dim1 ? 0 : caml_check_bound(data, 0)[1].length - 1, dim3 = 0 === dim2 ? 0 : caml_check_bound(caml_check_bound(data, 0)[1], 0)[1].length - 1, ba = create$2(kind, layout, dim1, dim2, dim3), ofs = layout ? 1 : 0, a = dim1 - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var row = caml_check_bound(data, i)[i + 1], cst_Bigarray_Array3_of_array_n = "Bigarray.Array3.of_array: non-cubic data"; if(row.length - 1 !== dim2) Stdlib[1].call(null, cst_Bigarray_Array3_of_array_n); var b = dim2 - 1 | 0; if(b >= 0){ var j = 0; for(;;){ var col = caml_check_bound(row, j)[j + 1]; if(col.length - 1 !== dim3) Stdlib[1].call(null, cst_Bigarray_Array3_of_array_n); var c = dim3 - 1 | 0; if(c >= 0){ var k = 0; for(;;){ caml_ba_set_3 (ba, i + ofs | 0, j + ofs | 0, k + ofs | 0, caml_check_bound(col, k)[k + 1]); var f = k + 1 | 0; if(c === k) break; k = f; } } var e = j + 1 | 0; if(b === j) break; j = e; } } var d = i + 1 | 0; if(a === i) break; i = d; } } return ba; } function array0_of_genarray(a){ return 0 === caml_ba_num_dims(a) ? a : Stdlib[1].call(null, "Bigarray.array0_of_genarray"); } function array1_of_genarray(a){ return 1 === caml_ba_num_dims(a) ? a : Stdlib[1].call(null, "Bigarray.array1_of_genarray"); } function array2_of_genarray(a){ return 2 === caml_ba_num_dims(a) ? a : Stdlib[1].call(null, "Bigarray.array2_of_genarray"); } function array3_of_genarray(a){ return 3 === caml_ba_num_dims(a) ? a : Stdlib[1].call(null, "Bigarray.array3_of_genarray"); } function reshape_0(a){return caml_ba_reshape(a, [0]);} function reshape_1(a, dim1){return caml_ba_reshape(a, [0, dim1]);} function reshape_2(a, dim1, dim2){ return caml_ba_reshape(a, [0, dim1, dim2]); } function reshape_3(a, dim1, dim2, dim3){ return caml_ba_reshape(a, [0, dim1, dim2, dim3]); } runtime.caml_register_global (10, [0, 13, 0, 1, 10, 11, 2, 3, 4, 5, 8, 6, 7, 9, 12, kind_size_in_bytes, 0, 1, [0, init, dims, size_in_bytes], [0, create, of_value, caml_ba_change_layout, size_in_bytes$0, get, set, of_value], [0, create$0, init$0, caml_ba_change_layout, size_in_bytes$1, slice, of_array], [0, create$1, init$1, caml_ba_change_layout, size_in_bytes$2, slice_left, slice_right, of_array$0], [0, create$2, init$2, caml_ba_change_layout, size_in_bytes$3, slice_left_1, slice_right_1, slice_left_2, slice_right_2, of_array$1], array0_of_genarray, array1_of_genarray, array2_of_genarray, array3_of_genarray, caml_ba_reshape, reshape_0, reshape_1, reshape_2, reshape_3], "Stdlib__Bigarray"); return; } (globalThis)); //# 18622 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Random:[F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(1),N,F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_ba_blit = runtime.caml_ba_blit, caml_ba_set_1 = runtime.caml_ba_set_1, caml_bytes_set = runtime.caml_bytes_set, caml_create_bytes = runtime.caml_create_bytes, caml_greaterthan = runtime.caml_greaterthan, caml_int64_add = runtime.caml_int64_add, caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, caml_int64_of_int32 = runtime.caml_int64_of_int32, caml_int64_shift_right_unsigne = runtime.caml_int64_shift_right_unsigned, caml_int64_sub = runtime.caml_int64_sub, caml_int64_to_int32 = runtime.caml_int64_to_int32, caml_lessequal = runtime.caml_lessequal, caml_lessthan = runtime.caml_lessthan, caml_lxm_next = runtime.caml_lxm_next, caml_mod = runtime.caml_mod, caml_notequal = runtime.caml_notequal, caml_sys_random_seed = runtime.caml_sys_random_seed; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), Stdlib_Domain = global_data.Stdlib__Domain, Stdlib_Sys = global_data.Stdlib__Sys, Stdlib_Int32 = global_data.Stdlib__Int32, Stdlib_Int64 = global_data.Stdlib__Int64, Stdlib = global_data.Stdlib, Stdlib_Bytes = global_data.Stdlib__Bytes, Stdlib_Digest = global_data.Stdlib__Digest, Stdlib_String = global_data.Stdlib__String, Stdlib_Bigarray = global_data.Stdlib__Bigarray, Stdlib_Nativeint = global_data.Stdlib__Nativeint, a = caml_int64_create_lo_mi_hi(1, 0, 0), b = caml_int64_create_lo_mi_hi(0, 0, 0), c = caml_int64_create_lo_mi_hi(0, 0, 0), d = caml_int64_create_lo_mi_hi(2, 0, 0), e = caml_int64_create_lo_mi_hi(1, 0, 0); function create(param){return caml_call3(Stdlib_Bigarray[20][1], 7, 0, 4);} function set(s, i1, i2, i3, i4){ caml_ba_set_1(s, 0, runtime.caml_int64_or(i1, a)); caml_ba_set_1(s, 1, i2); var i3$0 = caml_notequal(i3, b) ? i3 : e; caml_ba_set_1(s, 2, i3$0); var i4$0 = caml_notequal(i4, c) ? i4 : d; return caml_ba_set_1(s, 3, i4$0); } function mk(i1, i2, i3, i4){ var s = create(0); set(s, i1, i2, i3, i4); return s; } var serialization_prefix = "lxm1:"; function to_binary_string(s){ var buf = caml_create_bytes(37); Stdlib_Bytes[12].call(null, serialization_prefix, 0, buf, 0, 5); var i = 0; for(;;){ var a = runtime.caml_ba_get_1(s, i); Stdlib_Bytes[86].call(null, buf, 5 + (i * 8 | 0) | 0, a); var b = i + 1 | 0; if(3 === i) return Stdlib_Bytes[44].call(null, buf); i = b; } } function of_binary_string(buf){ var a = runtime.caml_ml_string_length(buf) !== 37, b = a || 1 - Stdlib_String[11].call(null, serialization_prefix, buf); if(b){ var c = Stdlib[28].call (null, "Random.State.of_binary_string: expected a format compatible with OCaml ", Stdlib_Sys[46]); Stdlib[2].call(null, c); } var i1 = Stdlib_String[64].call(null, buf, 5), i2 = Stdlib_String[64].call(null, buf, 13), i3 = Stdlib_String[64].call(null, buf, 21), i4 = Stdlib_String[64].call(null, buf, 29); return mk(i1, i2, i3, i4); } function copy(src){ var dst = create(0); caml_ba_blit(src, dst); return dst; } function reinit(s, seed){ var n = seed.length - 1, b = caml_create_bytes((n * 8 | 0) + 1 | 0), a = n - 1 | 0; if(a >= 0){ var i = 0; for(;;){ var f = caml_int64_of_int32(runtime.caml_check_bound(seed, i)[i + 1]); Stdlib_Bytes[86].call(null, b, i * 8 | 0, f); var g = i + 1 | 0; if(a === i) break; i = g; } } caml_bytes_set(b, n * 8 | 0, 1); var d1 = Stdlib_Digest[4].call(null, b); caml_bytes_set(b, n * 8 | 0, 2); var d2 = Stdlib_Digest[4].call(null, b), c = Stdlib_String[64].call(null, d2, 8), d = Stdlib_String[64].call(null, d2, 0), e = Stdlib_String[64].call(null, d1, 8); return set(s, Stdlib_String[64].call(null, d1, 0), e, d, c); } function make(seed){var s = create(0); reinit(s, seed); return s;} function make_self_init(param){return make(caml_sys_random_seed(0));} function bits(s){ return caml_int64_to_int32(caml_lxm_next(s)) & 1073741823; } function int_aux(s, n, mask){ for(;;){ var r = caml_int64_to_int32(caml_lxm_next(s)) & mask, v = caml_mod(r, n); if(((mask - n | 0) + 1 | 0) >= (r - v | 0)) return v; } } var max_int31 = 1073741823; function int(s, bound){ if(1073741823 >= bound && 0 < bound) return int_aux(s, bound, max_int31); return Stdlib[1].call(null, "Random.int"); } var max_int32 = 2147483647; function full_int(s, bound){ if(0 >= bound) return Stdlib[1].call(null, "Random.full_int"); var a = bound <= 1073741823 ? max_int31 : bound <= 2147483647 ? max_int32 : Stdlib[19]; return int_aux(s, bound, a); } function int_in_range_aux(s, min, max, mask, nbits){ var span = (max - min | 0) + 1 | 0; if(span <= mask && 0 < span) return min + int_aux(s, span, mask) | 0; for(;;){ var drop = Stdlib_Sys[10] - nbits | 0, r = caml_int64_to_int32(caml_lxm_next(s)) << drop >> drop; if(r >= min && max >= r) return r; } } function int_in_range(s, min, max){ if(max < min) Stdlib[1].call(null, "Random.int_in_range"); if(-1073741824 <= min && max <= 1073741823) return int_in_range_aux(s, min, max, max_int31, 31); if(-2147483648 <= min && max <= 2147483647) return int_in_range_aux(s, min, max, max_int32, 32); return int_in_range_aux(s, min, max, Stdlib[19], Stdlib_Sys[10]); } function bits32(s){return caml_int64_to_int32(caml_lxm_next(s));} function int32aux(s, n){ for(;;){ var r = bits32(s) >>> 1 | 0, v = caml_mod(r, n); if(! caml_greaterthan(r - v | 0, (Stdlib_Int32[9] - n | 0) + 1 | 0)) return v; } } function int32(s, bound){ return caml_lessequal(bound, 0) ? Stdlib[1].call(null, "Random.int32") : int32aux(s, bound); } function int32_in_range(s, min, max){ if(caml_greaterthan(min, max)) return Stdlib[1].call(null, "Random.int32_in_range"); var span = Stdlib_Int32[6].call(null, max - min | 0); if(! caml_lessequal(span, Stdlib_Int32[1])) return min + int32aux(s, span) | 0; for(;;){ var r = caml_int64_to_int32(caml_lxm_next(s)); if(! caml_lessthan(r, min) && ! caml_greaterthan(r, max)) return r; } } var f = caml_int64_create_lo_mi_hi(1, 0, 0), g = caml_int64_create_lo_mi_hi(0, 0, 0); function int64aux(s, n){ for(;;){ var r = caml_int64_shift_right_unsigne(caml_lxm_next(s), 1), v = runtime.caml_int64_mod(r, n); if (! caml_greaterthan (caml_int64_sub(r, v), caml_int64_add(caml_int64_sub(Stdlib_Int64[9], n), f))) return v; } } function int64(s, bound){ return caml_lessequal(bound, g) ? Stdlib[1].call(null, "Random.int64") : int64aux(s, bound); } function int64_in_range(s, min, max){ if(caml_greaterthan(min, max)) return Stdlib[1].call(null, "Random.int64_in_range"); var span = Stdlib_Int64[6].call(null, caml_int64_sub(max, min)); if(! caml_lessequal(span, Stdlib_Int64[1])) return caml_int64_add(min, int64aux(s, span)); for(;;){ var r = caml_lxm_next(s); if(! caml_lessthan(r, min) && ! caml_greaterthan(r, max)) return r; } } var j = caml_int64_create_lo_mi_hi(14371852, 15349651, 22696), k = caml_int64_create_lo_mi_hi(12230193, 11438743, 35013), l = caml_int64_create_lo_mi_hi(1424933, 15549263, 2083), m = caml_int64_create_lo_mi_hi(9492471, 4696708, 43520), h = caml_int64_create_lo_mi_hi(0, 0, 0), i = caml_int64_create_lo_mi_hi(0, 0, 0), nativebits = 32 === Stdlib_Nativeint[9] ? function(s){return bits32(s);} : function(s){return caml_int64_to_int32(caml_lxm_next(s));}, nativeint = 32 === Stdlib_Nativeint[9] ? function(s, bound){return int32(s, bound);} : function (s, bound){ return caml_int64_to_int32(int64(s, caml_int64_of_int32(bound))); }, nativeint_in_range = 32 === Stdlib_Nativeint[9] ? function(s, min, max){return int32_in_range(s, min, max);} : function (s, min, max){ return caml_int64_to_int32 (int64_in_range (s, caml_int64_of_int32(min), caml_int64_of_int32(max))); }; function float(s, bound){ for(;;){ var b = caml_lxm_next(s), n = caml_int64_shift_right_unsigne(b, 11); if(caml_notequal(n, h)) return runtime.caml_int64_to_float(n) * 1.1102230246251565e-16 * bound; } } function bool(s){return caml_lessthan(caml_lxm_next(s), i);} function split(s){ var i1 = caml_lxm_next(s), i2 = caml_lxm_next(s), i3 = caml_lxm_next(s), i4 = caml_lxm_next(s); return mk(i1, i2, i3, i4); } function mk_default(param){return mk(m, l, k, j);} var random_key = caml_call2(Stdlib_Domain[10][1], [0, split], mk_default); function bits$0(param){ return bits(caml_call1(Stdlib_Domain[10][2], random_key)); } function int$0(bound){ return int(caml_call1(Stdlib_Domain[10][2], random_key), bound); } function full_int$0(bound){ return full_int(caml_call1(Stdlib_Domain[10][2], random_key), bound); } function int_in_range$0(min, max){ return int_in_range (caml_call1(Stdlib_Domain[10][2], random_key), min, max); } function int32$0(bound){ return int32(caml_call1(Stdlib_Domain[10][2], random_key), bound); } function int32_in_range$0(min, max){ return int32_in_range (caml_call1(Stdlib_Domain[10][2], random_key), min, max); } function nativeint$0(bound){ return nativeint(caml_call1(Stdlib_Domain[10][2], random_key), bound); } function nativeint_in_range$0(min, max){ return nativeint_in_range (caml_call1(Stdlib_Domain[10][2], random_key), min, max); } function int64$0(bound){ return int64(caml_call1(Stdlib_Domain[10][2], random_key), bound); } function int64_in_range$0(min, max){ return int64_in_range (caml_call1(Stdlib_Domain[10][2], random_key), min, max); } function float$0(scale){ return float(caml_call1(Stdlib_Domain[10][2], random_key), scale); } function bool$0(param){ return bool(caml_call1(Stdlib_Domain[10][2], random_key)); } function bits32$0(param){ return bits32(caml_call1(Stdlib_Domain[10][2], random_key)); } function bits64(param){ var s = caml_call1(Stdlib_Domain[10][2], random_key); return caml_lxm_next(s); } function nativebits$0(param){ return nativebits(caml_call1(Stdlib_Domain[10][2], random_key)); } function full_init(seed){ return reinit(caml_call1(Stdlib_Domain[10][2], random_key), seed); } function init(seed){return full_init([0, seed]);} function self_init(param){return full_init(caml_sys_random_seed(0));} function split$0(param){ return split(caml_call1(Stdlib_Domain[10][2], random_key)); } function get_state(param){ return copy(caml_call1(Stdlib_Domain[10][2], random_key)); } function set_state(src){ var dst = caml_call1(Stdlib_Domain[10][2], random_key); return caml_ba_blit(src, dst); } runtime.caml_register_global (35, [0, init, full_init, self_init, bits$0, int$0, full_int$0, int_in_range$0, int32$0, int32_in_range$0, nativeint$0, nativeint_in_range$0, int64$0, int64_in_range$0, float$0, bool$0, bits32$0, bits64, nativebits$0, [0, make, make_self_init, copy, bits, int, full_int, int_in_range, int32, int32_in_range, nativeint, nativeint_in_range, int64, int64_in_range, float, bool, bits32, caml_lxm_next, nativebits, split, to_binary_string, of_binary_string], get_state, set_state, split$0], "Stdlib__Random"); return; } (globalThis)); //# 19017 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Hashtbl:[F(2),F(1),F(1),F(1),F(3),F(2),F(2),F(2),F(2),F(2),F(3),F(2),F(2),F(3),F(1)*,F(1),F(1),F(2),F(1),F(1)*->F(1),F(1)*->F(1),F(1)*->F(1),F(2),F(2),F(1),F(1)*,F(1)*,F(1)*,F(2)*,F(3)*,F(4)*] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_compare = runtime.caml_compare, caml_hash = runtime.caml_hash, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_sys_getenv = runtime.caml_sys_getenv, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), Stdlib_Sys = global_data.Stdlib__Sys, Stdlib = global_data.Stdlib, Stdlib_Atomic = global_data.Stdlib__Atomic, Stdlib_Domain = global_data.Stdlib__Domain, Stdlib_Random = global_data.Stdlib__Random, Stdlib_Seq = global_data.Stdlib__Seq, Stdlib_Int = global_data.Stdlib__Int, Stdlib_Array = global_data.Stdlib__Array; global_data.Assert_failure; var Stdlib_String = global_data.Stdlib__String; function ongoing_traversal(h){ var a = h.length - 1 < 4 ? 1 : 0, b = a || (h[4] < 0 ? 1 : 0); return b; } function flip_ongoing_traversal(h){h[4] = - h[4] | 0; return 0;} try{var c = caml_sys_getenv("OCAMLRUNPARAM"), params = c;} catch(exn$1){ var exn = caml_wrap_exception(exn$1); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); try{var b = caml_sys_getenv("CAMLRUNPARAM"), params = b;} catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$0, 0); var params = ""; } } var randomized_default = Stdlib_String[15].call(null, params, 82), randomized = Stdlib_Atomic[1].call(null, randomized_default); function randomize(param){ return Stdlib_Atomic[4].call(null, randomized, 1); } function is_randomized(param){ return Stdlib_Atomic[3].call(null, randomized); } var prng_key = caml_call2(Stdlib_Domain[10][1], 0, Stdlib_Random[19][2]); function power_2_above(x$1, n){ var x = x$1; for(;;){ if(n <= x) return x; if(Stdlib_Sys[13] < (x * 2 | 0)) return x; var x$0 = x * 2 | 0; x = x$0; } } function create(opt, initial_size){ var random = opt ? opt[1] : Stdlib_Atomic[3].call(null, randomized), s = power_2_above(16, initial_size); if(random) var a = caml_call1(Stdlib_Domain[10][2], prng_key), seed = caml_call1(Stdlib_Random[19][4], a); else var seed = 0; return [0, 0, caml_make_vect(s, 0), seed, s]; } function clear(h){ var a = 0 < h[1] ? 1 : 0; return a ? (h [1] = 0, Stdlib_Array[8].call(null, h[2], 0, h[2].length - 1, 0)) : a; } function reset(h){ var len = h[2].length - 1; if(4 <= h.length - 1 && len !== Stdlib[18].call(null, h[4])){ h[1] = 0; h[2] = caml_make_vect(Stdlib[18].call(null, h[4]), 0); return 0; } return clear(h); } function copy_bucketlist(param){ if(! param) return 0; var key = param[1], data = param[2], next = param[3], prec$1 = [0, key, data, next], prec = prec$1, param$0 = next; for(;;){ if(! param$0) return prec$1; var key$0 = param$0[1], data$0 = param$0[2], next$0 = param$0[3], prec$0 = [0, key$0, data$0, next$0]; prec[3] = prec$0; prec = prec$0; param$0 = next$0; } } function copy(h){ var a = h[4], b = h[3], c = Stdlib_Array[14].call(null, copy_bucketlist, h[2]); return [0, h[1], c, b, a]; } function length(h){return h[1];} function insert_all_buckets(indexfun, inplace, odata, ndata){ var nsize = ndata.length - 1, ndata_tail = caml_make_vect(nsize, 0), a = odata.length - 2 | 0; if(a >= 0){ var i$0 = 0; a: for(;;){ var cell$1 = caml_check_bound(odata, i$0)[i$0 + 1], cell = cell$1; for(;;){ if(! cell){var e = i$0 + 1 | 0; if(a === i$0) break a; i$0 = e; break;} var key = cell[1], data = cell[2], next = cell[3], cell$0 = inplace ? cell : [0, key, data, 0], nidx = caml_call1(indexfun, key), match = caml_check_bound(ndata_tail, nidx)[nidx + 1]; if(match) match[3] = cell$0; else caml_check_bound(ndata, nidx)[nidx + 1] = cell$0; caml_check_bound(ndata_tail, nidx)[nidx + 1] = cell$0; cell = next; } } } if(inplace){ var b = nsize - 1 | 0; if(b >= 0){ var i = 0; for(;;){ var match$0 = caml_check_bound(ndata_tail, i)[i + 1]; if(match$0) match$0[3] = 0; var d = i + 1 | 0; if(b === i) break; i = d; } } var c = 0; } else var c = inplace; return c; } function resize(indexfun, h){ var odata = h[2], osize = odata.length - 1, nsize = osize * 2 | 0, a = nsize < Stdlib_Sys[13] ? 1 : 0; if(! a) return a; var ndata = caml_make_vect(nsize, 0), inplace = 1 - ongoing_traversal(h); h[2] = ndata; return insert_all_buckets(caml_call1(indexfun, h), inplace, odata, ndata); } function iter(f, h){ var old_trav = ongoing_traversal(h); if(1 - old_trav) flip_ongoing_traversal(h); try{ var d = h[2], a = d.length - 2 | 0; if(a >= 0){ var i = 0; a: for(;;){ var param = caml_check_bound(d, i)[i + 1]; for(;;){ if(! param){var e = i + 1 | 0; if(a === i) break a; i = e; break;} var key = param[1], data = param[2], next = param[3]; caml_call2(f, key, data); param = next; } } } var b = 1 - old_trav, c = b ? flip_ongoing_traversal(h) : b; return c; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(old_trav) throw caml_maybe_attach_backtrace(exn, 0); flip_ongoing_traversal(h); throw caml_maybe_attach_backtrace(exn, 0); } } function filter_map_inplace(f, h){ var d = h[2], old_trav = ongoing_traversal(h); if(1 - old_trav) flip_ongoing_traversal(h); try{ var a = d.length - 2 | 0; if(a >= 0){ var i = 0; a: for(;;){ var slot$0 = caml_check_bound(h[2], i)[i + 1], prec = 0, slot = slot$0; for(;;){ if(! slot){ if(prec) prec[3] = 0; else caml_check_bound(h[2], i)[i + 1] = 0; var e = i + 1 | 0; if(a === i) break a; i = e; break; } var key = slot[1], data = slot[2], next = slot[3], match = caml_call2(f, key, data); if(match){ var data$0 = match[1]; if(prec) prec[3] = slot; else caml_check_bound(h[2], i)[i + 1] = slot; slot[2] = data$0; prec = slot; slot = next; } else{h[1] = h[1] - 1 | 0; slot = next;} } } } var b = 1 - old_trav, c = b ? flip_ongoing_traversal(h) : b; return c; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(old_trav) throw caml_maybe_attach_backtrace(exn, 0); flip_ongoing_traversal(h); throw caml_maybe_attach_backtrace(exn, 0); } } function fold(f, h, init){ var old_trav = ongoing_traversal(h); if(1 - old_trav) flip_ongoing_traversal(h); try{ var d = h[2], a = d.length - 2 | 0; if(a < 0) var accu$2 = init; else{ var accu$1 = init, i = 0; a: for(;;){ var b$0 = caml_check_bound(d, i)[i + 1], b = b$0, accu = accu$1; for(;;){ if(! b){ var c = i + 1 | 0; if(a !== i){accu$1 = accu; i = c; break;} var accu$2 = accu; break a; } var key = b[1], data = b[2], next = b[3], accu$0 = caml_call3(f, key, data, accu); b = next; accu = accu$0; } } } if(1 - old_trav) flip_ongoing_traversal(h); return accu$2; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(old_trav) throw caml_maybe_attach_backtrace(exn, 0); flip_ongoing_traversal(h); throw caml_maybe_attach_backtrace(exn, 0); } } function bucket_length(accu$1, param$0){ var accu = accu$1, param = param$0; for(;;){ if(! param) return accu; var next = param[3], accu$0 = accu + 1 | 0; accu = accu$0; param = next; } } function stats(h){ var mbl = Stdlib_Array[18].call (null, function(m, b){ var a = bucket_length(0, b); return Stdlib_Int[11].call(null, m, a); }, 0, h[2]), histo = caml_make_vect(mbl + 1 | 0, 0); Stdlib_Array[12].call (null, function(b){ var l = bucket_length(0, b); histo[l + 1] = caml_check_bound(histo, l)[l + 1] + 1 | 0; return 0; }, h[2]); return [0, h[1], h[2].length - 1, mbl, histo]; } function to_seq(tbl){ var tbl_data = tbl[2]; function aux(i$1, buck$1, param){ var i = i$1, buck = buck$1; for(;;){ if(buck) break; if(i === tbl_data.length - 1) return 0; var buck$0 = caml_check_bound(tbl_data, i)[i + 1], i$0 = i + 1 | 0; i = i$0; buck = buck$0; } var key = buck[1], data = buck[2], next = buck[3]; return [0, [0, key, data], function(a){return aux(i, next, a);}]; } return function(a){return aux(0, 0, a);}; } function to_seq_keys(m){ var a = to_seq(m); function b(a){return a[1];} var c = Stdlib_Seq[29]; return function(d){return c(b, a, d);}; } function to_seq_values(m){ var a = to_seq(m); function b(a){return a[2];} var c = Stdlib_Seq[29]; return function(d){return c(b, a, d);}; } function MakeSeeded(H){ function key_index(h, key){ var a = h[2].length - 2 | 0; return caml_call2(H[2], h[3], key) & a; } function add(h, key, data){ var i = key_index(h, key), bucket = [0, key, data, caml_check_bound(h[2], i)[i + 1]]; caml_check_bound(h[2], i)[i + 1] = bucket; h[1] = h[1] + 1 | 0; var a = h[2].length - 1 << 1 < h[1] ? 1 : 0; return a ? resize(key_index, h) : a; } function remove(h, key){ var i = key_index(h, key), prec$1 = caml_check_bound(h[2], i)[i + 1], prec$0 = 0, prec = prec$1; for(;;){ if(! prec) return 0; var k = prec[1], next = prec[3]; if(caml_call2(H[1], k, key)){ h[1] = h[1] - 1 | 0; return prec$0 ? (prec$0[3] = next, 0) : (caml_check_bound(h[2], i)[i + 1] = next, 0); } prec$0 = prec; prec = next; } } function find(h, key){ var a = key_index(h, key), match = caml_check_bound(h[2], a)[a + 1]; if(! match) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k1 = match[1], d1 = match[2], next1 = match[3]; if(caml_call2(H[1], key, k1)) return d1; if(! next1) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k2 = next1[1], d2 = next1[2], next2 = next1[3]; if(caml_call2(H[1], key, k2)) return d2; if(! next2) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k3 = next2[1], d3 = next2[2], next3 = next2[3]; if(caml_call2(H[1], key, k3)) return d3; var param = next3; for(;;){ if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k = param[1], data = param[2], next = param[3]; if(caml_call2(H[1], key, k)) return data; param = next; } } function find_opt(h, key){ var a = key_index(h, key), match = caml_check_bound(h[2], a)[a + 1]; if(! match) return 0; var k1 = match[1], d1 = match[2], next1 = match[3]; if(caml_call2(H[1], key, k1)) return [0, d1]; if(! next1) return 0; var k2 = next1[1], d2 = next1[2], next2 = next1[3]; if(caml_call2(H[1], key, k2)) return [0, d2]; if(! next2) return 0; var k3 = next2[1], d3 = next2[2], next3 = next2[3]; if(caml_call2(H[1], key, k3)) return [0, d3]; var param = next3; for(;;){ if(! param) return 0; var k = param[1], data = param[2], next = param[3]; if(caml_call2(H[1], key, k)) return [0, data]; param = next; } } function find_all(h, key){ var a = key_index(h, key), param = caml_check_bound(h[2], a)[a + 1]; for(;;){ if(! param) return 0; var k = param[1], d = param[2], next = param[3]; if(caml_call2(H[1], k, key)) break; param = next; } var block = [0, d, 24029], dst = block, offset = 1, param$0 = next; for(;;){ if(! param$0){dst[offset + 1] = 0; return block;} var k$0 = param$0[1], d$0 = param$0[2], next$0 = param$0[3]; if(caml_call2(H[1], k$0, key)){ var dst$0 = [0, d$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; param$0 = next$0; } else param$0 = next$0; } } function replace(h, key, data){ var i = key_index(h, key), l = caml_check_bound(h[2], i)[i + 1], param = l; for(;;){ if(param){ var k = param[1], next = param[3]; if(! caml_call2(H[1], k, key)){param = next; continue;} param[1] = key; param[2] = data; var a = 0; } else var a = 1; if(a){ caml_check_bound(h[2], i)[i + 1] = [0, key, data, l]; h[1] = h[1] + 1 | 0; var b = h[2].length - 1 << 1 < h[1] ? 1 : 0; if(b) return resize(key_index, h); var c = b; } else var c = a; return c; } } function mem(h, key){ var b = key_index(h, key), param = caml_check_bound(h[2], b)[b + 1]; for(;;){ if(! param) return 0; var k = param[1], next = param[3], a = caml_call2(H[1], k, key); if(a) return a; param = next; } } function add_seq(tbl, i){ return Stdlib_Seq[4].call (null, function(param){ var v = param[2], k = param[1]; return add(tbl, k, v); }, i); } function replace_seq(tbl, i){ return Stdlib_Seq[4].call (null, function(param){ var v = param[2], k = param[1]; return replace(tbl, k, v); }, i); } function of_seq(i){ var tbl = create(0, 16); replace_seq(tbl, i); return tbl; } return [0, create, clear, reset, copy, add, remove, find, find_opt, find_all, replace, mem, iter, filter_map_inplace, fold, length, stats, to_seq, to_seq_keys, to_seq_values, add_seq, replace_seq, of_seq]; } var a = [0, 0]; function Make(H){ var equal = H[1]; function seeded_hash(seed, x){return caml_call1(H[2], x);} var include = MakeSeeded([0, equal, seeded_hash]), b = include[1], clear = include[2], reset = include[3], copy = include[4], add = include[5], remove = include[6], find = include[7], find_opt = include[8], find_all = include[9], replace = include[10], mem = include[11], iter = include[12], filter_map_inplace = include[13], fold = include[14], length = include[15], stats = include[16], to_seq = include[17], to_seq_keys = include[18], to_seq_values = include[19], add_seq = include[20], replace_seq = include[21]; function create(sz){return caml_call2(b, a, sz);} function of_seq(i){ var tbl = caml_call2(b, a, 16); caml_call2(replace_seq, tbl, i); return tbl; } return [0, create, clear, reset, copy, add, remove, find, find_opt, find_all, replace, mem, iter, filter_map_inplace, fold, length, stats, to_seq, to_seq_keys, to_seq_values, add_seq, replace_seq, of_seq]; } function hash(x){return caml_hash(10, 100, 0, x);} function hash_param(n1, n2, x){return caml_hash(n1, n2, 0, x);} function seeded_hash(seed, x){return caml_hash(10, 100, seed, x);} function key_index(h, key){ return 4 <= h.length - 1 ? caml_hash(10, 100, h[3], key) & (h[2].length - 2 | 0) : Stdlib[1].call(null, "Hashtbl: unsupported hash table format"); } function add(h, key, data){ var i = key_index(h, key), bucket = [0, key, data, caml_check_bound(h[2], i)[i + 1]]; caml_check_bound(h[2], i)[i + 1] = bucket; h[1] = h[1] + 1 | 0; var a = h[2].length - 1 << 1 < h[1] ? 1 : 0; return a ? resize(key_index, h) : a; } function remove(h, key){ var i = key_index(h, key), prec$1 = caml_check_bound(h[2], i)[i + 1], prec$0 = 0, prec = prec$1; for(;;){ if(! prec) return 0; var k = prec[1], next = prec[3]; if(0 === caml_compare(k, key)){ h[1] = h[1] - 1 | 0; return prec$0 ? (prec$0[3] = next, 0) : (caml_check_bound(h[2], i)[i + 1] = next, 0); } prec$0 = prec; prec = next; } } function find(h, key){ var a = key_index(h, key), match = caml_check_bound(h[2], a)[a + 1]; if(! match) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k1 = match[1], d1 = match[2], next1 = match[3]; if(0 === caml_compare(key, k1)) return d1; if(! next1) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k2 = next1[1], d2 = next1[2], next2 = next1[3]; if(0 === caml_compare(key, k2)) return d2; if(! next2) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k3 = next2[1], d3 = next2[2], next3 = next2[3]; if(0 === caml_compare(key, k3)) return d3; var param = next3; for(;;){ if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); var k = param[1], data = param[2], next = param[3]; if(0 === caml_compare(key, k)) return data; param = next; } } function find_opt(h, key){ var a = key_index(h, key), match = caml_check_bound(h[2], a)[a + 1]; if(! match) return 0; var k1 = match[1], d1 = match[2], next1 = match[3]; if(0 === caml_compare(key, k1)) return [0, d1]; if(! next1) return 0; var k2 = next1[1], d2 = next1[2], next2 = next1[3]; if(0 === caml_compare(key, k2)) return [0, d2]; if(! next2) return 0; var k3 = next2[1], d3 = next2[2], next3 = next2[3]; if(0 === caml_compare(key, k3)) return [0, d3]; var param = next3; for(;;){ if(! param) return 0; var k = param[1], data = param[2], next = param[3]; if(0 === caml_compare(key, k)) return [0, data]; param = next; } } function find_all(h, key){ var a = key_index(h, key), param = caml_check_bound(h[2], a)[a + 1]; for(;;){ if(! param) return 0; var k = param[1], data = param[2], next = param[3]; if(0 === caml_compare(k, key)) break; param = next; } var block = [0, data, 24029], dst = block, offset = 1, param$0 = next; for(;;){ if(! param$0){dst[offset + 1] = 0; return block;} var k$0 = param$0[1], data$0 = param$0[2], next$0 = param$0[3]; if(0 === caml_compare(k$0, key)){ var dst$0 = [0, data$0, 24029]; dst[offset + 1] = dst$0; dst = dst$0; offset = 1; param$0 = next$0; } else param$0 = next$0; } } function replace(h, key, data){ var i = key_index(h, key), l = caml_check_bound(h[2], i)[i + 1], param = l; for(;;){ if(param){ var k = param[1], next = param[3]; if(0 !== caml_compare(k, key)){param = next; continue;} param[1] = key; param[2] = data; var a = 0; } else var a = 1; if(a){ caml_check_bound(h[2], i)[i + 1] = [0, key, data, l]; h[1] = h[1] + 1 | 0; var b = h[2].length - 1 << 1 < h[1] ? 1 : 0; if(b) return resize(key_index, h); var c = b; } else var c = a; return c; } } function mem(h, key){ var b = key_index(h, key), param = caml_check_bound(h[2], b)[b + 1]; for(;;){ if(! param) return 0; var k = param[1], next = param[3], a = 0 === caml_compare(k, key) ? 1 : 0; if(a) return a; param = next; } } function add_seq(tbl, i){ return Stdlib_Seq[4].call (null, function(param){ var v = param[2], k = param[1]; return add(tbl, k, v); }, i); } function replace_seq(tbl, i){ return Stdlib_Seq[4].call (null, function(param){ var v = param[2], k = param[1]; return replace(tbl, k, v); }, i); } function of_seq(i){ var tbl = create(0, 16); replace_seq(tbl, i); return tbl; } function rebuild(opt, h){ var random = opt ? opt[1] : Stdlib_Atomic[3].call(null, randomized), s = power_2_above(16, h[2].length - 1); if(random) var a = caml_call1(Stdlib_Domain[10][2], prng_key), seed = caml_call1(Stdlib_Random[19][4], a); else var seed = 4 <= h.length - 1 ? h[3] : 0; var b = 4 <= h.length - 1 ? h[4] : s, h$0 = [0, h[1], caml_make_vect(s, 0), seed, b]; insert_all_buckets (function(a){return key_index(h$0, a);}, 0, h[2], h$0[2]); return h$0; } runtime.caml_register_global (16, [0, create, clear, reset, copy, add, find, find_opt, find_all, mem, remove, replace, iter, filter_map_inplace, fold, length, randomize, is_randomized, rebuild, stats, to_seq, to_seq_keys, to_seq_values, add_seq, replace_seq, of_seq, Make, MakeSeeded, hash, seeded_hash, hash_param, caml_hash], "Stdlib__Hashtbl"); return; } (globalThis)); //# 23582 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Callback:[F(2),F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_register_named_value = runtime.caml_register_named_value, Stdlib_Obj = runtime.caml_get_global_data().Stdlib__Obj; function register_exception(name, exn){ var a = Stdlib_Obj[10], slot = runtime.caml_obj_tag(exn) === a ? exn : exn[1]; return caml_register_named_value(name, slot); } runtime.caml_register_global (1, [0, caml_register_named_value, register_exception], "Stdlib__Callback"); return; } (globalThis)); //# 5 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_types:[N,N,N,F(1),F(1),N,N,N,N,N,F(1),F(1),N,N,F(3),F(2),F(2),F(3),F(2),F(3),F(3),F(2),F(1),F(1),F(1)*,F(1)*,F(1),F(3),F(6),F(5),F(5),F(2),F(1),F(1),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1)*,F(2),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(3),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(2),F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_fresh_oo_id = runtime.caml_fresh_oo_id, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib = global_data.Stdlib, Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_Float = global_data.Stdlib__Float, Stdlib_String = global_data.Stdlib__String, Stdlib_Array = global_data.Stdlib__Array, Stdlib_List = global_data.Stdlib__List, sym_to_id = Stdlib_Hashtbl[1].call(null, 0, 512), id_to_sym = Stdlib_Hashtbl[1].call(null, 0, 512), sym_next = [0, 0]; function intern(s){ var match = Stdlib_Hashtbl[7].call(null, sym_to_id, s); if(match){var id = match[1]; return id;} var id$0 = sym_next[1]; sym_next[1]++; Stdlib_Hashtbl[11].call(null, sym_to_id, s, id$0); Stdlib_Hashtbl[11].call(null, id_to_sym, id$0, s); return id$0; } function unintern(id){ var match = Stdlib_Hashtbl[7].call(null, id_to_sym, id); if(match){var s = match[1]; return s;} var a = Stdlib[33].call(null, id), b = Stdlib[28].call(null, a, ">"); return Stdlib[28].call(null, ""; } } function value_to_string_list(param){ a: if(typeof param !== "number"){ switch(param[0]){ case 5: var items = param[1]; break; case 20: var items = param[1][1]; break; default: break a; } return Stdlib_List[20].call(null, value_to_string, items); } return 0; } function value_to_bool(param){ if(typeof param === "number") return 0; if(0 !== param[0]) return 1; var b = param[1]; return b; } function value_to_string_opt(param){ if(typeof param === "number") return 0; if(param[0] - 2 >>> 0 >= 2) return 0; var s = param[1]; return [0, s]; } function unwrap_env_val(param){ if(typeof param !== "number" && 19 === param[0]){var e = param[1]; return e;} throw caml_maybe_attach_backtrace ([0, Eval_error, "make_lambda: expected env for closure"], 1); } function make_lambda(params, body, closure){ a: { if(typeof params !== "number" && 5 === params[0]){ var items = params[1], ps = Stdlib_List[20].call(null, value_to_string, items); break a; } var ps = value_to_string_list(params); } return [7, [0, ps, body, unwrap_env_val(closure), 0, 0]]; } var cst_auto = "auto"; function make_component (name, params, has_children, body, closure, affinity){ var n = value_to_string(name), ps = value_to_string_list(params), hc = value_to_bool(has_children); if(typeof affinity === "number" || ! (2 === affinity[0])) var aff = cst_auto; else var s = affinity[1], aff = s; return [8, [0, n, ps, hc, body, unwrap_env_val(closure), aff, 0, 0]]; } function make_island(name, params, has_children, body, closure){ var n = value_to_string(name), ps = value_to_string_list(params), hc = value_to_bool(has_children); return [9, [0, n, ps, hc, body, unwrap_env_val(closure), 0]]; } function make_macro(params, rest_param, body, closure, name){ var ps = value_to_string_list(params), rp = value_to_string_opt(rest_param), n = value_to_string_opt(name); return [10, [0, ps, rp, body, unwrap_env_val(closure), n]]; } function make_thunk(expr, env){return [11, expr, unwrap_env_val(env)];} function make_symbol(name){return [3, value_to_string(name)];} function make_keyword(name){return [4, value_to_string(name)];} var cst_lambda = "lambda", cst_macro = "macro", cst_nil = "nil"; function type_of(param){ if(typeof param === "number") return cst_nil; var cst_continuation = "continuation", cst_dict = "dict", cst_function = "function"; switch(param[0]){ case 0: return "boolean"; case 1: return "number"; case 2: return "string"; case 3: return "symbol"; case 4: return "keyword"; case 6: return cst_dict; case 7: return cst_lambda; case 8: return "component"; case 9: return "island"; case 10: return cst_macro; case 11: return "thunk"; case 12: return cst_continuation; case 13: return cst_continuation; case 14: return cst_function; case 15: return "signal"; case 16: return "raw-html"; case 17: return "spread"; case 18: return "sx-expr"; case 19: return "env"; case 21: return cst_dict; case 22: return cst_dict; case 23: return cst_function; case 24: var r = param[1]; return r[1][1]; default: return "list"; } } function is_nil(param){return typeof param === "number" ? 1 : 0;} function is_lambda(param){ if(typeof param !== "number" && 7 === param[0]) return 1; return 0; } function is_component(param){ if(typeof param !== "number" && 8 === param[0]) return 1; return 0; } function is_island(param){ if(typeof param !== "number" && 9 === param[0]) return 1; return 0; } function is_macro(param){ if(typeof param !== "number" && 10 === param[0]) return 1; return 0; } function is_thunk(param){ if(typeof param !== "number" && 11 === param[0]) return 1; return 0; } function is_signal(param){ if(typeof param !== "number") switch(param[0]){ case 6: var d = param[1]; return Stdlib_Hashtbl[9].call(null, d, "__signal"); case 15: return 1; } return 0; } function is_record(param){ if(typeof param !== "number" && 24 === param[0]) return 1; return 0; } function is_callable(param){ if(typeof param !== "number") switch(param[0]){case 7:case 12:case 13:case 14:case 23: return 1;} return 0; } function sx_truthy(param){ a: if(typeof param !== "number"){ if(0 === param[0] && ! param[1]) break a; return 1; } return 0; } function symbol_name(v){ if(typeof v !== "number" && 3 === v[0]){var s = v[1]; return [2, s];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, "Expected symbol, got ", a)], 1); } function keyword_name(v){ if(typeof v !== "number" && 4 === v[0]){var k = v[1]; return [2, k];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, "Expected keyword, got ", a)], 1); } var cst_Expected_lambda_got = "Expected lambda, got "; function lambda_params(v){ if(typeof v !== "number" && 7 === v[0]){ var l = v[1]; return [5, Stdlib_List[20].call(null, function(s){return [2, s];}, l[1])]; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_lambda_got, a)], 1); } function lambda_body(v){ if(typeof v !== "number" && 7 === v[0]){var l = v[1]; return l[2];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_lambda_got, a)], 1); } function lambda_closure(v){ if(typeof v !== "number" && 7 === v[0]){var l = v[1]; return [19, l[3]];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_lambda_got, a)], 1); } function lambda_name(v){ if(typeof v !== "number" && 7 === v[0]){ var l = v[1], match = l[4]; if(! match) return 0; var n = match[1]; return [2, n]; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_lambda_got, a)], 1); } function set_lambda_name(l, n){ if(typeof l !== "number" && 7 === l[0]){ var l$0 = l[1]; l$0[4] = [0, n]; return 0; } throw caml_maybe_attach_backtrace ([0, Eval_error, "set-lambda-name!: not a lambda"], 1); } var cst_Expected_component_got = "Expected component, got "; function component_name(v){ if(typeof v !== "number" && v[0] - 8 >>> 0 < 2){var c = v[1]; return [2, c[1]];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_component_got, a)], 1); } function component_file(param){ if(typeof param !== "number") switch(param[0]){ case 8: var c = param[1], match = c[7]; if(! match) return 0; var f = match[1]; return [2, f]; case 9: var i = param[1], match$0 = i[6]; if(! match$0) return 0; var f$0 = match$0[1]; return [2, f$0]; } return 0; } function component_set_file(v, f){ if(typeof v !== "number") switch(v[0]){ case 8: if(typeof f !== "number" && 2 === f[0]){var s = f[1], c = v[1]; c[7] = [0, s]; } break; case 9: if(typeof f !== "number" && 2 === f[0]){ var s$0 = f[1], i = v[1]; i[6] = [0, s$0]; } break; } return 0; } function component_params(v){ if(typeof v !== "number") switch(v[0]){ case 8: var c = v[1]; return [5, Stdlib_List[20].call(null, function(s){return [2, s];}, c[2])]; case 9: var i = v[1]; return [5, Stdlib_List[20].call(null, function(s){return [2, s];}, i[2])]; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_component_got, a)], 1); } function component_body(v){ if(typeof v !== "number" && v[0] - 8 >>> 0 < 2){var c = v[1]; return c[4];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_component_got, a)], 1); } function component_closure(v){ if(typeof v !== "number" && v[0] - 8 >>> 0 < 2){var c = v[1]; return [19, c[5]];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_component_got, a)], 1); } function component_has_children(v){ if(typeof v !== "number" && v[0] - 8 >>> 0 < 2){var c = v[1]; return [0, c[3]];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_component_got, a)], 1); } var b = [2, cst_auto], c = [2, "client"]; function component_affinity(param){ if(typeof param !== "number") switch(param[0]){ case 8: var c$0 = param[1]; return [2, c$0[6]]; case 9: return c; } return b; } var cst_Expected_macro_got = "Expected macro, got "; function macro_params(v){ if(typeof v !== "number" && 10 === v[0]){ var m = v[1]; return [5, Stdlib_List[20].call(null, function(s){return [2, s];}, m[1])]; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_macro_got, a)], 1); } function macro_rest_param(v){ if(typeof v !== "number" && 10 === v[0]){ var m = v[1], match = m[2]; if(! match) return 0; var s = match[1]; return [2, s]; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_macro_got, a)], 1); } function macro_body(v){ if(typeof v !== "number" && 10 === v[0]){var m = v[1]; return m[3];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_macro_got, a)], 1); } function macro_closure(v){ if(typeof v !== "number" && 10 === v[0]){var m = v[1]; return [19, m[4]];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_macro_got, a)], 1); } var cst_Expected_thunk_got = "Expected thunk, got "; function thunk_expr(v){ if(typeof v !== "number" && 11 === v[0]){var e = v[1]; return e;} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_thunk_got, a)], 1); } function thunk_env(v){ if(typeof v !== "number" && 11 === v[0]){var e = v[2]; return [19, e];} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, cst_Expected_thunk_got, a)], 1); } function val_to_int(v){ if(typeof v !== "number" && 1 === v[0]){var n = v[1]; return n | 0;} var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, "Expected number, got ", a)], 1); } var rtd_counter = [0, 0], d = [0, [11, "make-rtd: ctor param ", [2, 0, [11, " not in fields", 0]]], "make-rtd: ctor param %s not in fields"]; function make_rtd(name, fields, ctor_params){ var uid = rtd_counter[1]; rtd_counter[1]++; a: { if(typeof fields !== "number" && 5 === fields[0]){var l$0 = fields[1], a = l$0; break a;} var a = 0; } var field_names = Stdlib_List[20].call(null, value_to_string, a); a: { if(typeof ctor_params !== "number" && 5 === ctor_params[0]){var l = ctor_params[1], b = l; break a;} var b = 0; } var ctor_names = Stdlib_List[20].call(null, value_to_string, b), field_arr = Stdlib_Array[11].call(null, field_names), c = Stdlib_List[20].call (null, function(cp){ var j = 0, param = field_names; for(;;){ if(! param) throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call1(Stdlib_Printf[4].call(null, d), cp)], 1); var f = param[1]; if(f === cp) return j; var rest = param[2], j$0 = j + 1 | 0; j = j$0; param = rest; } }, ctor_names), ctor_map = Stdlib_Array[11].call(null, c), rt = [0, value_to_string(name), uid, field_arr, ctor_map]; Stdlib_Hashtbl[5].call(null, rtd_table, uid, rt); return [1, uid]; } var cst_args_got = " args, got ", cst_s_expected_d_args_got_d = "%s: expected %d args, got %d", cst_expected = ": expected ", e = [0, [2, 0, [11, cst_expected, [4, 0, 0, 0, [11, cst_args_got, [4, 0, 0, 0, 0]]]]], cst_s_expected_d_args_got_d]; function make_record(uid_val, args_list){ var uid = val_to_int(uid_val); a: { if(typeof args_list !== "number" && 5 === args_list[0]){var l = args_list[1], ctor_args = l; break a;} var ctor_args = 0; } var match = Stdlib_Hashtbl[7].call(null, rtd_table, uid); if(! match) throw caml_maybe_attach_backtrace ([0, Eval_error, "make-record: unknown rtd"], 1); var rt = match[1], n_ctor = rt[4].length - 1, n_args = Stdlib_List[1].call(null, ctor_args); if(n_args !== n_ctor){ var a = rt[1]; throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call3(Stdlib_Printf[4].call(null, e), a, n_ctor, n_args)], 1); } var fields = caml_make_vect(rt[3].length - 1, 0); Stdlib_List[19].call (null, function(i, arg){ var a = caml_check_bound(rt[4], i)[i + 1]; caml_check_bound(fields, a)[a + 1] = arg; return 0; }, ctor_args); return [24, [0, rt, fields]]; } var cst_out_of_bounds_for = " out of bounds for ", f = [0, [11, "record-ref: index ", [4, 0, 0, 0, [11, cst_out_of_bounds_for, [2, 0, 0]]]], "record-ref: index %d out of bounds for %s"]; function record_ref(v, idx){ if(typeof v !== "number" && 24 === v[0]){ var r = v[1], i = val_to_int(idx), b = i < 0, c = b || r[2].length - 1 <= i; if(! c) return caml_check_bound(r[2], i)[i + 1]; var d = r[1][1]; throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call2(Stdlib_Printf[4].call(null, f), i, d)], 1); } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, "record-ref: not a record, got ", a)], 1); } var g = [0, [11, "record-set!: index ", [4, 0, 0, 0, [11, cst_out_of_bounds_for, [2, 0, 0]]]], "record-set!: index %d out of bounds for %s"]; function record_set_b(v, idx, new_val){ if(typeof v !== "number" && 24 === v[0]){ var r = v[1], i = val_to_int(idx), b = i < 0, c = b || r[2].length - 1 <= i; if(c){ var d = r[1][1]; throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call2(Stdlib_Printf[4].call(null, g), i, d)], 1); } caml_check_bound(r[2], i)[i + 1] = new_val; return 0; } var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call(null, "record-set!: not a record, got ", a)], 1); } var h = [0, 0]; function record_type_p(v, uid_val){ if(typeof v !== "number" && 24 === v[0]){ var r = v[1], a = val_to_int(uid_val); return [0, r[1][2] === a ? 1 : 0]; } return h; } function record_p(v){return [0, is_record(v)];} var i = [0, [2, 0, [11, cst_expected, [4, 0, 0, 0, [11, cst_args_got, [4, 0, 0, 0, 0]]]]], cst_s_expected_d_args_got_d]; function make_record_constructor(uid_val){ var uid = val_to_int(uid_val), match = Stdlib_Hashtbl[7].call(null, rtd_table, uid); if(! match) throw caml_maybe_attach_backtrace ([0, Eval_error, "make-record-constructor: unknown rtd"], 1); var rt = match[1]; return [14, rt[1], function(args){ var n_ctor = rt[4].length - 1, n_args = Stdlib_List[1].call(null, args); if(n_args !== n_ctor){ var a = rt[1]; throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call3 (Stdlib_Printf[4].call(null, i), a, n_ctor, n_args)], 1); } var fields = caml_make_vect(rt[3].length - 1, 0); Stdlib_List[19].call (null, function(i, arg){ var a = caml_check_bound(rt[4], i)[i + 1]; caml_check_bound(fields, a)[a + 1] = arg; return 0; }, args); return [24, [0, rt, fields]]; }]; } var j = [0, 0]; function make_record_predicate(uid_val){ var uid = val_to_int(uid_val); return [14, "?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 24 === a[0]){ if(args[2]) break a; var r = a[1]; return [0, r[1][2] === uid ? 1 : 0]; } if(! args[2]) return j; } throw caml_maybe_attach_backtrace ([0, Eval_error, "record predicate: expected 1 arg"], 1); }]; } var cst_out_of_bounds = " out of bounds", k = [0, [11, "record accessor: index ", [4, 0, 0, 0, [11, cst_out_of_bounds, 0]]], "record accessor: index %d out of bounds"]; function make_record_accessor(idx_val){ var idx = val_to_int(idx_val); return [14, "ref", function(args){ a: if(args){ var v = args[1]; if(typeof v !== "number" && 24 === v[0]){ if(args[2]) break a; var r = v[1], b = idx < 0, c = b || r[2].length - 1 <= idx; if(c) throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call1(Stdlib_Printf[4].call(null, k), idx)], 1); return caml_check_bound(r[2], idx)[idx + 1]; } if(! args[2]){ var a = type_of(v); throw caml_maybe_attach_backtrace ([0, Eval_error, Stdlib[28].call (null, "record accessor: not a record, got ", a)], 1); } } throw caml_maybe_attach_backtrace ([0, Eval_error, "record accessor: expected 1 arg"], 1); }]; } var l = [0, [11, "record mutator: index ", [4, 0, 0, 0, [11, cst_out_of_bounds, 0]]], "record mutator: index %d out of bounds"]; function make_record_mutator(idx_val){ var idx = val_to_int(idx_val); return [14, "set!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 24 === a[0]){ var b = args[2]; if(b && ! b[2]){ var new_val = b[1], r = a[1], c = idx < 0, d = c || r[2].length - 1 <= idx; if(d) throw caml_maybe_attach_backtrace ([0, Eval_error, caml_call1(Stdlib_Printf[4].call(null, l), idx)], 1); caml_check_bound(r[2], idx)[idx + 1] = new_val; return 0; } } } throw caml_maybe_attach_backtrace ([0, Eval_error, "record mutator: expected (record value)"], 1); }]; } function make_dict(param){return Stdlib_Hashtbl[1].call(null, 0, 8);} function dict_get(d, key){ var match = Stdlib_Hashtbl[7].call(null, d, key); if(! match) return 0; var v = match[1]; return v; } function dict_has(d, key){return Stdlib_Hashtbl[9].call(null, d, key);} function dict_set(d, key, v){ return Stdlib_Hashtbl[11].call(null, d, key, v); } function dict_delete(d, key){return Stdlib_Hashtbl[10].call(null, d, key);} function dict_keys(d){ return Stdlib_Hashtbl[14].call (null, function(k, param, acc){return [0, [2, k], acc];}, d, 0); } function dict_vals(d){ return Stdlib_Hashtbl[14].call (null, function(param, v, acc){return [0, v, acc];}, d, 0); } var cst = ")>", cst_s_s = "<%s(%s)>", cst$0 = '>"', m = [0, [4, 0, 0, 0, 0], "%d"], n = [0, [8, [0, 0, 3], 0, 0, 0], cst_g], o = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], p = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], q = [0, [11, ""], r = [0, [11, ""], s = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], t = [0, [11, ""], u = [0, [11, '""'], v = [0, [11, '""'], w = [0, [11, ""], x = [0, [11, ""], y = [0, [2, 0, [12, 61, [2, 0, 0]]], "%s=%s"], z = [0, [11, ""]; function inspect(param){ if(typeof param === "number") return cst_nil; var cst = " ", cst$0 = ", "; switch(param[0]){ case 0: return param[1] ? cst_true : cst_false; case 1: var n$0 = param[1]; return Stdlib_Float[18].call(null, n$0) ? caml_call1(Stdlib_Printf[4].call(null, m), n$0 | 0) : caml_call1(Stdlib_Printf[4].call(null, n), n$0); case 2: var s$0 = param[1], buf = Stdlib_Buffer[1].call(null, caml_ml_string_length(s$0) + 2 | 0); Stdlib_Buffer[12].call(null, buf, 34); Stdlib_String[30].call (null, function(c){ if(34 === c) return Stdlib_Buffer[16].call(null, buf, '\\"'); if(14 <= c){ if(92 === c) return Stdlib_Buffer[16].call(null, buf, "\\\\"); } else if(9 <= c) switch(c - 9 | 0){ case 0: return Stdlib_Buffer[16].call(null, buf, "\\t"); case 1: return Stdlib_Buffer[16].call(null, buf, "\\n"); case 4: return Stdlib_Buffer[16].call(null, buf, "\\r"); } return Stdlib_Buffer[12].call(null, buf, c); }, s$0); Stdlib_Buffer[12].call(null, buf, 34); return Stdlib_Buffer[2].call(null, buf); case 3: var s$1 = param[1]; return s$1; case 4: var k = param[1]; return Stdlib[28].call(null, ":", k); case 5: var items = param[1]; break; case 6: var d = param[1], pairs = Stdlib_Hashtbl[14].call (null, function(k, v, acc){ var a = inspect(v); return [0, caml_call2(Stdlib_Printf[4].call(null, o), k, a), acc]; }, d, 0), g = Stdlib_String[7].call(null, cst, pairs), h = Stdlib[28].call(null, g, "}"); return Stdlib[28].call(null, "{", h); case 7: var l = param[1], match = l[4]; if(match) var n$1 = match[1], tag = n$1; else var tag = cst_lambda; var j = Stdlib_String[7].call(null, cst$0, l[1]); return caml_call2(Stdlib_Printf[4].call(null, p), tag, j); case 8: var c = param[1], A = Stdlib_String[7].call(null, cst$0, c[2]), B = c[1]; return caml_call2(Stdlib_Printf[4].call(null, q), B, A); case 9: var i = param[1], C = Stdlib_String[7].call(null, cst$0, i[2]), D = i[1]; return caml_call2(Stdlib_Printf[4].call(null, r), D, C); case 10: var m$0 = param[1], match$0 = m$0[5]; if(match$0) var n$2 = match$0[1], tag$0 = n$2; else var tag$0 = cst_macro; var E = Stdlib_String[7].call(null, cst$0, m$0[1]); return caml_call2(Stdlib_Printf[4].call(null, s), tag$0, E); case 11: return ""; case 12: return ""; case 13: return ""; case 14: var name = param[1]; return caml_call1(Stdlib_Printf[4].call(null, t), name); case 15: return ""; case 16: var s$2 = param[1]; return caml_call1 (Stdlib_Printf[4].call(null, u), caml_ml_string_length(s$2)); case 17: return ""; case 18: var s$3 = param[1]; return caml_call1 (Stdlib_Printf[4].call(null, v), caml_ml_string_length(s$3)); case 19: return ""; case 20: var items = param[1][1]; break; case 21: return ""; case 22: var f = param[1], F = f[1]; return caml_call1(Stdlib_Printf[4].call(null, w), F); case 23: var cl = param[1], match$1 = cl[3]; if(match$1) var n$3 = match$1[1], n$4 = n$3; else var n$4 = "anon"; return caml_call1(Stdlib_Printf[4].call(null, x), n$4); default: var r$0 = param[1], G = Stdlib_Array[16].call (null, function(i, v){ var a = inspect(v), b = caml_check_bound(r$0[1][3], i)[i + 1]; return caml_call2(Stdlib_Printf[4].call(null, y), b, a); }, r$0[2]), fields = Stdlib_Array[10].call(null, G), H = Stdlib_String[7].call(null, cst, fields), I = r$0[1][1]; return caml_call2(Stdlib_Printf[4].call(null, z), I, H); } var a = Stdlib_List[20].call(null, inspect, items), b = Stdlib_String[7].call(null, cst, a), e = Stdlib[28].call(null, b, ")"); return Stdlib[28].call(null, "(", e); } runtime.caml_register_global (131, [0, sym_to_id, id_to_sym, sym_next, intern, unintern, vm_call_closure_ref, Eval_error, Parse_error, rtd_table, rtd_counter, make_env, env_extend, env_bind_hook, [0, 0], env_bind, env_has_id, env_has, env_get_id, env_get, env_set_id, env_set, env_merge, value_to_string, value_to_string_list, value_to_bool, value_to_string_opt, unwrap_env_val, make_lambda, make_component, make_island, make_macro, make_thunk, make_symbol, make_keyword, type_of, is_nil, is_lambda, is_component, is_island, is_macro, is_thunk, is_signal, is_record, is_callable, sx_truthy, symbol_name, keyword_name, lambda_params, lambda_body, lambda_closure, lambda_name, set_lambda_name, component_name, component_file, component_set_file, component_set_file, component_params, component_body, component_closure, component_has_children, component_affinity, macro_params, macro_rest_param, macro_body, macro_closure, thunk_expr, thunk_env, val_to_int, make_rtd, make_record, record_ref, record_set_b, record_type_p, record_p, make_record_constructor, make_record_predicate, make_record_accessor, make_record_mutator, make_dict, dict_get, dict_has, dict_set, dict_delete, dict_keys, dict_vals, inspect], "Sx_types"); return; } (globalThis)); //# 1178 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_cst:[F(1),F(1),F(1),F(2),F(1),F(3)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, global_data = runtime.caml_get_global_data(), Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib = global_data.Stdlib, Stdlib_List = global_data.Stdlib__List, Sx_types = global_data.Sx_types, Stdlib_String = global_data.Stdlib__String; function trivia_to_string(ts){ var buf = Stdlib_Buffer[1].call(null, 64); Stdlib_List[18].call (null, function(param){ if(0 === param[0]){ var s = param[1]; return Stdlib_Buffer[16].call(null, buf, s); } var s$0 = param[1]; return Stdlib_Buffer[16].call(null, buf, s$0); }, ts); return Stdlib_Buffer[2].call(null, buf); } function cst_to_source(node){ switch(node[0]){ case 0: var token = node[2], leading_trivia = node[1], a = trivia_to_string(leading_trivia); return Stdlib[28].call(null, a, token); case 1: var trailing_trivia = node[5], close_delim = node[4], children = node[3], open_delim = node[2], leading_trivia$0 = node[1], buf = Stdlib_Buffer[1].call(null, 256), b = trivia_to_string(leading_trivia$0); Stdlib_Buffer[16].call(null, buf, b); Stdlib_Buffer[12].call(null, buf, open_delim); Stdlib_List[18].call (null, function(c){ var a = cst_to_source(c); return Stdlib_Buffer[16].call(null, buf, a); }, children); var c = trivia_to_string(trailing_trivia); Stdlib_Buffer[16].call(null, buf, c); Stdlib_Buffer[12].call(null, buf, close_delim); return Stdlib_Buffer[2].call(null, buf); default: var trailing_trivia$0 = node[3], children$0 = node[2], leading_trivia$1 = node[1], buf$0 = Stdlib_Buffer[1].call(null, 256), d = trivia_to_string(leading_trivia$1); Stdlib_Buffer[16].call(null, buf$0, d); Stdlib_Buffer[12].call(null, buf$0, 123); Stdlib_List[18].call (null, function(c){ var a = cst_to_source(c); return Stdlib_Buffer[16].call(null, buf$0, a); }, children$0); var e = trivia_to_string(trailing_trivia$0); Stdlib_Buffer[16].call(null, buf$0, e); Stdlib_Buffer[12].call(null, buf$0, 125); return Stdlib_Buffer[2].call(null, buf$0); } } var cst = ""; function cst_to_source_file(nodes){ var a = Stdlib_List[20].call(null, cst_to_source, nodes); return Stdlib_String[7].call(null, cst, a); } function cst_file_to_source(nodes, trailing){ var a = trivia_to_string(trailing), b = cst_to_source_file(nodes); return Stdlib[28].call(null, b, a); } function cst_to_ast(param){ switch(param[0]){ case 0: var value = param[3]; return value; case 1: var children = param[3]; return [5, Stdlib_List[20].call(null, cst_to_ast, children)]; default: var children$0 = param[2], d = Sx_types[79].call(null, 0), param$0 = children$0; for(;;){ if(param$0){ var match = param$0[2]; if(match){ var rest = match[2], v = match[1], k = param$0[1], match$0 = cst_to_ast(k); if(typeof match$0 === "number" || ! (match$0[0] - 2 >>> 0 < 3)) var key_str = cst; else var k$0 = match$0[1], key_str = k$0; var a = cst_to_ast(v); Sx_types[82].call(null, d, key_str, a); param$0 = rest; continue; } } return [6, d]; } } } function apply_edit(path, new_cst_nodes, original_cst_nodes){ function go(nodes, idx_path){ if(! idx_path) return nodes; var target = idx_path[1]; if(! idx_path[2]) return Stdlib_List[21].call (null, function(i, node){ if(i !== target) return node; if(new_cst_nodes && ! new_cst_nodes[2]){ var replacement = new_cst_nodes[1], leading_trivia = node[1]; switch(replacement[0]){ case 0: return [0, leading_trivia, replacement[2], replacement[3], replacement[4]]; case 1: return [1, leading_trivia, replacement[2], replacement[3], replacement[4], replacement[5], replacement[6]]; default: return [2, leading_trivia, replacement[2], replacement[3], replacement[4]]; } } return node; }, nodes); var rest = idx_path[2]; return Stdlib_List[21].call (null, function(i, node){ if(i === target) switch(node[0]){ case 0: return node; case 1: var a = node[6], b = node[5], c = node[4], d = go(node[3], rest); return [1, node[1], node[2], d, c, b, a]; default: var e = node[4], f = node[3], g = go(node[2], rest); return [2, node[1], g, f, e]; } return node; }, nodes); } return go(original_cst_nodes, path); } runtime.caml_register_global (7, [0, trivia_to_string, cst_to_source, cst_to_source_file, cst_file_to_source, cst_to_ast, apply_edit], "Sx_cst"); return; } (globalThis)); //# 1379 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_parser:[F(1)*,F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(1),F(1),F(1),F(5),F(3),F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_get = runtime.caml_string_get; function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call4(f, a0, a1, a2, a3){ return (f.l >= 0 ? f.l : f.l = f.length) === 4 ? f(a0, a1, a2, a3) : runtime.caml_call_gen(f, [a0, a1, a2, a3]); } var global_data = runtime.caml_get_global_data(), Sx_types = global_data.Sx_types, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_String = global_data.Stdlib__String, Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_List = global_data.Stdlib__List, Sx_cst = global_data.Sx_cst, Stdlib = global_data.Stdlib, Stdlib_Uchar = global_data.Stdlib__Uchar; function make_state(src){return [0, src, caml_ml_string_length(src), 0];} function peek(s){ return s[3] < s[2] ? [0, caml_string_get(s[1], s[3])] : 0; } function advance(s){s[3] = s[3] + 1 | 0; return 0;} function at_end(s){return s[2] <= s[3] ? 1 : 0;} function skip_whitespace_and_comments(s){ a: for(;;){ if(at_end(s)) return 0; var match = caml_string_get(s[1], s[3]); b: { if(14 <= match){ if(32 !== match){ if(59 !== match) break b; for(;;){ if(s[3] < s[2] && 10 !== caml_string_get(s[1], s[3])){advance(s); continue;} if(s[3] >= s[2]) continue a; advance(s); continue a; } } } else if(11 <= match){if(13 > match) break b;} else if(9 > match) break b; advance(s); continue; } return 0; } } function is_ident_start(param){ a: { if(96 <= param){ if(123 <= param){ if(126 !== param) break a; } else if(97 > param) break a; } else{ var a = param - 33 | 0; if(57 < a >>> 0){ if(62 > a) break a; } else if(32 > a) switch(a){ case 0: case 5: case 9: case 10: case 12: case 14: case 27: case 28: case 29: case 30: break; default: break a; } } return 1; } return 0; } function is_ident_char(c){ if(is_ident_start(c)) return 1; a: { if(47 <= c){ if(10 < c - 48 >>> 0) break a; } else{ if(35 > c) break a; switch(c - 35 | 0){case 0:case 9:case 11: break;default: break a; } } return 1; } return 0; } function read_string(s){ advance(s); var buf = Stdlib_Buffer[1].call(null, 64); for(;;){ if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], "Unterminated string"], 1); var c = caml_string_get(s[1], s[3]); advance(s); if(34 === c) return Stdlib_Buffer[2].call(null, buf); if(92 === c){ if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], "Unterminated string escape"], 1); var esc = caml_string_get(s[1], s[3]); advance(s); if(92 <= esc){ if(118 > esc) switch(esc - 92 | 0){ case 0: Stdlib_Buffer[12].call(null, buf, 92); continue; case 4: Stdlib_Buffer[12].call(null, buf, 96); continue; case 18: Stdlib_Buffer[12].call(null, buf, 10); continue; case 22: Stdlib_Buffer[12].call(null, buf, 13); continue; case 24: Stdlib_Buffer[12].call(null, buf, 9); continue; case 25: if(s[2] < (s[3] + 4 | 0)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], "Incomplete \\u escape"], 1); var hex = Stdlib_String[16].call(null, s[1], s[3], 4); s[3] = s[3] + 4 | 0; var code = runtime.caml_int_of_string(Stdlib[28].call(null, "0x", hex)), ubuf = Stdlib_Buffer[1].call(null, 4), a = Stdlib_Uchar[8].call(null, code); Stdlib_Buffer[13].call(null, ubuf, a); var b = Stdlib_Buffer[2].call(null, ubuf); Stdlib_Buffer[16].call(null, buf, b); continue; } } else if(34 === esc){Stdlib_Buffer[12].call(null, buf, 34); continue;} Stdlib_Buffer[12].call(null, buf, 92); Stdlib_Buffer[12].call(null, buf, esc); } else Stdlib_Buffer[12].call(null, buf, c); } } function read_symbol(s){ var start = s[3]; for(;;){ if(s[3] < s[2] && is_ident_char(caml_string_get(s[1], s[3]))){advance(s); continue;} return Stdlib_String[16].call(null, s[1], start, s[3] - start | 0); } } function try_number(str){ var match = Stdlib[36].call(null, str); if(! match) return 0; var n = match[1]; return [0, [1, n]]; } var cst = "", cst_pos = " (pos ", cst_at_line = " at line ", cst_col = " col ", cst_Unexpected_char = "Unexpected char: ", cst_Unexpected_char_c_at_line_ = "Unexpected char: %c at line %d col %d (pos %d)", cst_Unterminated_raw_string = "Unterminated raw string", cst_false = "false", cst_nil = "nil", cst_quasiquote = "quasiquote", cst_quote = "quote", cst_splice_unquote = "splice-unquote", cst_true = "true", cst_unquote = "unquote", a = [0, [11, "Unexpected end of input at line ", [4, 0, 0, 0, [11, cst_pos, [4, 0, 0, 0, [12, 41, 0]]]]], "Unexpected end of input at line %d (pos %d)"], b = [3, cst_quasiquote], c = [0, [11, cst_Unexpected_char, [0, [11, cst_at_line, [4, 0, 0, 0, [11, cst_col, [4, 0, 0, 0, [11, cst_pos, [4, 0, 0, 0, [12, 41, 0]]]]]]]]], cst_Unexpected_char_c_at_line_], d = [0, 1], e = [0, 0], f = [3, cst_quote], g = [3, cst_quote], h = [3, cst_splice_unquote], i = [3, cst_unquote]; function read_value(s){ a: { b: { c: { d: { e: { f: for(;;){ skip_whitespace_and_comments(s); if(at_end(s)) break a; var match = caml_string_get(s[1], s[3]); if(92 <= match) break c; if(45 <= match) break d; if(34 > match) break b; switch(match - 34 | 0){ case 0: return [2, read_string(s)]; case 1: if((s[3] + 1 | 0) >= s[2]) break e; if(59 !== caml_string_get(s[1], s[3] + 1 | 0)) break e; advance(s); advance(s); read_value(s); break; case 5: advance(s); return [5, [0, g, [0, read_value(s), 0]]]; case 6: return read_list(s, 41); case 10: break f; default: break b; } } advance(s); if(s[3] < s[2] && 64 === caml_string_get(s[1], s[3])){ advance(s); return [5, [0, h, [0, read_value(s), 0]]]; } return [5, [0, i, [0, read_value(s), 0]]]; } if ((s[3] + 1 | 0) < s[2] && 39 === caml_string_get(s[1], s[3] + 1 | 0)){advance(s); advance(s); return [5, [0, f, [0, read_value(s), 0]]];} if((s[3] + 1 | 0) >= s[2]) break b; if(124 !== caml_string_get(s[1], s[3] + 1 | 0)) break b; advance(s); advance(s); var buf = Stdlib_Buffer[1].call(null, 64); for(;;){ if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_raw_string], 1); var c$0 = caml_string_get(s[1], s[3]); advance(s); if(124 === c$0) return [2, Stdlib_Buffer[2].call(null, buf)]; Stdlib_Buffer[12].call(null, buf, c$0); } } if(91 <= match) return read_list(s, 93); break b; } if(96 === match){advance(s); return [5, [0, b, [0, read_value(s), 0]]];} if(123 === match) return read_dict(s); } var token = read_symbol(s); if(token !== cst){ if(token === cst_false) return e; if(token === cst_nil) return 0; if(token === cst_true) return d; if(58 === caml_string_get(token, 0)) return [4, Stdlib_String[16].call (null, token, 1, caml_ml_string_length(token) - 1 | 0)]; var match$0 = try_number(token); if(! match$0) return [3, token]; var n = match$0[1]; return n; } var l = s[3] - 1 | 0, j = 1, k = 1; if(l < 0) var col$2 = k, line$3 = j; else{ var col = k, line$0 = j, i$0 = 0; for(;;){ if(10 === caml_string_get(s[1], i$0)) var line$1 = line$0 + 1 | 0, col$1 = 1, line$2 = line$1; else var col$0 = col + 1 | 0, col$1 = col$0, line$2 = line$0; var u = i$0 + 1 | 0; if(l === i$0){var col$2 = col$1, line$3 = line$2; break;} col = col$1; line$0 = line$2; i$0 = u; } } var q = s[3], r = caml_string_get(s[1], s[3]), t = caml_call4(Stdlib_Printf[4].call(null, c), r, line$3, col$2, q); throw caml_maybe_attach_backtrace([0, Sx_types[8], t], 1); } var line = [0, 1]; Stdlib_String[30].call (null, function(c){ var a = 10 === c ? 1 : 0, b = a ? (line[1]++, 0) : a; return b; }, s[1]); var m = s[3], o = line[1], p = caml_call2(Stdlib_Printf[4].call(null, a), o, m); throw caml_maybe_attach_backtrace([0, Sx_types[8], p], 1); } var cst_Unterminated_list = "Unterminated list"; function read_list(s, close_char){ advance(s); var items = 0; for(;;){ skip_whitespace_and_comments(s); if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_list], 1); if(caml_string_get(s[1], s[3]) === close_char){ advance(s); return [5, Stdlib_List[10].call(null, items)]; } items = [0, read_value(s), items]; } } var cst_Unterminated_dict = "Unterminated dict"; function read_dict(s){ advance(s); var d = Sx_types[79].call(null, 0); for(;;){ skip_whitespace_and_comments(s); if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_dict], 1); if(125 === caml_string_get(s[1], s[3])){advance(s); return [6, d];} var key = read_value(s); if(typeof key !== "number" && key[0] - 2 >>> 0 < 3){ var key_str = key[1], v = read_value(s); Sx_types[82].call(null, d, key_str, v); continue; } throw caml_maybe_attach_backtrace ([0, Sx_types[8], "Dict key must be keyword, string, or symbol"], 1); } } function parse_all(src){ var s = make_state(src), results = 0; for(;;){ skip_whitespace_and_comments(s); if(at_end(s)) return Stdlib_List[10].call(null, results); results = [0, read_value(s), results]; } } function parse_file(path){ var ic = Stdlib[79].call(null, path), n = Stdlib[92].call(null, ic), src = Stdlib[86].call(null, ic, n); Stdlib[93].call(null, ic); return parse_all(src); } function collect_trivia(s){ var items = 0; a: for(;;){ b: if(! at_end(s)){ var match = caml_string_get(s[1], s[3]); if(14 <= match){ if(32 !== match){ if(59 !== match) break b; var start$0 = s[3]; for(;;){ if(s[3] >= s[2]) break; if(10 === caml_string_get(s[1], s[3])) break; advance(s); } var text = Stdlib_String[16].call(null, s[1], start$0, s[3] - start$0 | 0); if(s[3] < s[2]) advance(s); var text$0 = 0 < s[3] ? s [3] <= s[2] ? 10 === caml_string_get(s[1], s[3] - 1 | 0) ? Stdlib[28].call(null, text, "\n") : text : text : text; items = [0, [1, text$0], items]; continue; } } else if(11 <= match){if(13 > match) break b;} else if(9 > match) break b; var start = s[3]; for(;;){ if(s[3] < s[2]){ var c = caml_string_get(s[1], s[3]), b = 32 === c; if(b) var a = b; else{ var d = 9 === c; if(d) var a = d; else var e = 10 === c, a = e || 13 === c; } if(a){advance(s); continue;} } items = [0, [0, Stdlib_String[16].call(null, s[1], start, s[3] - start | 0)], items]; continue a; } } return Stdlib_List[10].call(null, items); } } var j = [3, cst_quasiquote], k = [0, [11, cst_Unexpected_char, [0, [11, cst_at_line, [4, 0, 0, 0, [11, cst_col, [4, 0, 0, 0, [11, cst_pos, [4, 0, 0, 0, [12, 41, 0]]]]]]]]], cst_Unexpected_char_c_at_line_], l = [0, 1], m = [0, 0], n = [3, cst_quote], o = [3, cst_quote]; function read_cst(s){ var trivia = collect_trivia(s); if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], "Unexpected end of input"], 1); var start = s[3], match = caml_string_get(s[1], s[3]); if(92 <= match){ if(96 === match){ advance(s); var inner = read_cst(s), end_pos = s[3], token = Stdlib_String[16].call(null, s[1], start, end_pos - start | 0), value = [5, [0, j, [0, Sx_cst[5].call(null, inner), 0]]]; return [0, trivia, token, value, [0, start, end_pos]]; } if(123 === match) return read_cst_dict(s, trivia, start); } else if(45 <= match){ if(91 <= match) return read_cst_list(s, trivia, start, 91, 93); } else if(34 <= match) switch(match - 34 | 0){ case 0: var value$1 = [2, read_string(s)], end_pos$1 = s[3], token$1 = Stdlib_String[16].call(null, s[1], start, end_pos$1 - start | 0); return [0, trivia, token$1, value$1, [0, start, end_pos$1]]; case 1: if ((s[3] + 1 | 0) < s[2] && 59 === caml_string_get(s[1], s[3] + 1 | 0)){ advance(s); advance(s); read_cst(s); var next = read_cst(s), combined_trivia = Stdlib[37].call(null, trivia, next[1]); switch(next[0]){ case 0: return [0, combined_trivia, next[2], next[3], next[4]]; case 1: return [1, combined_trivia, next[2], next[3], next[4], next[5], next[6]]; default: return [2, combined_trivia, next[2], next[3], next[4]]; } } if ((s[3] + 1 | 0) < s[2] && 39 === caml_string_get(s[1], s[3] + 1 | 0)){ advance(s); advance(s); var inner$0 = read_cst(s), end_pos$2 = s[3], token$2 = Stdlib_String[16].call(null, s[1], start, end_pos$2 - start | 0), value$2 = [5, [0, n, [0, Sx_cst[5].call(null, inner$0), 0]]]; return [0, trivia, token$2, value$2, [0, start, end_pos$2]]; } if ((s[3] + 1 | 0) < s[2] && 124 === caml_string_get(s[1], s[3] + 1 | 0)){ advance(s); advance(s); var buf = Stdlib_Buffer[1].call(null, 64); for(;;){ if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_raw_string], 1); var c = caml_string_get(s[1], s[3]); advance(s); if(124 === c){ var end_pos$3 = s[3], token$3 = Stdlib_String[16].call (null, s[1], start, end_pos$3 - start | 0); return [0, trivia, token$3, [2, Stdlib_Buffer[2].call(null, buf)], [0, start, end_pos$3]]; } Stdlib_Buffer[12].call(null, buf, c); } } break; case 5: advance(s); var inner$1 = read_cst(s), end_pos$4 = s[3], token$4 = Stdlib_String[16].call(null, s[1], start, end_pos$4 - start | 0), value$3 = [5, [0, o, [0, Sx_cst[5].call(null, inner$1), 0]]]; return [0, trivia, token$4, value$3, [0, start, end_pos$4]]; case 6: return read_cst_list(s, trivia, start, 40, 41); case 10: advance(s); var e = s[3] < s[2], splice = e ? 64 === caml_string_get(s[1], s[3]) : e; if(splice) advance(s); var inner$2 = read_cst(s), end_pos$5 = s[3], token$5 = Stdlib_String[16].call(null, s[1], start, end_pos$5 - start | 0), sym$0 = splice ? cst_splice_unquote : cst_unquote, value$4 = [5, [0, [3, sym$0], [0, Sx_cst[5].call(null, inner$2), 0]]]; return [0, trivia, token$5, value$4, [0, start, end_pos$5]]; } var sym = read_symbol(s); if(sym === cst){ var d = s[3] - 1 | 0, a = 1, b = 1; if(d < 0) var col$2 = b, line$2 = a; else{ var col = b, line = a, i = 0; for(;;){ if(10 === caml_string_get(s[1], i)) var line$0 = line + 1 | 0, col$1 = 1, line$1 = line$0; else var col$0 = col + 1 | 0, col$1 = col$0, line$1 = line; var p = i + 1 | 0; if(d === i){var col$2 = col$1, line$2 = line$1; break;} col = col$1; line = line$1; i = p; } } var f = s[3], g = caml_string_get(s[1], s[3]), h = caml_call4(Stdlib_Printf[4].call(null, k), g, line$2, col$2, f); throw caml_maybe_attach_backtrace([0, Sx_types[8], h], 1); } var end_pos$0 = s[3], token$0 = Stdlib_String[16].call(null, s[1], start, end_pos$0 - start | 0); if(sym !== cst_false) if(sym !== cst_nil) if(sym !== cst_true) if(58 === caml_string_get(sym, 0)) var value$0 = [4, Stdlib_String[16].call (null, sym, 1, caml_ml_string_length(sym) - 1 | 0)]; else{ var match$0 = try_number(sym); if(match$0) var n$0 = match$0[1], value$0 = n$0; else var value$0 = [3, sym]; } else var value$0 = l; else var value$0 = 0; else var value$0 = m; return [0, trivia, token$0, value$0, [0, start, end_pos$0]]; } function read_cst_list(s, trivia, start, open_c, close_c){ advance(s); var children = 0; for(;;){ var child_trivia = collect_trivia(s); if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_list], 1); if(caml_string_get(s[1], s[3]) === close_c){ advance(s); var end_pos = s[3]; return [1, trivia, open_c, Stdlib_List[10].call(null, children), close_c, child_trivia, [0, start, end_pos]]; } var child = read_cst_inner(s); switch(child[0]){ case 0: var a = child[4], b = child[3], c = child[2], child_with_trivia = [0, Stdlib[37].call(null, child_trivia, child[1]), c, b, a]; break; case 1: var d = child[6], e = child[5], f = child[4], g = child[3], h = child[2], child_with_trivia = [1, Stdlib[37].call(null, child_trivia, child[1]), h, g, f, e, d]; break; default: var i = child[4], j = child[3], k = child[2], child_with_trivia = [2, Stdlib[37].call(null, child_trivia, child[1]), k, j, i]; } children = [0, child_with_trivia, children]; } } function read_cst_dict(s, trivia, start){ advance(s); var children = 0; for(;;){ var child_trivia = collect_trivia(s); if(at_end(s)) throw caml_maybe_attach_backtrace ([0, Sx_types[8], cst_Unterminated_dict], 1); if(125 === caml_string_get(s[1], s[3])){ advance(s); var end_pos = s[3]; return [2, trivia, Stdlib_List[10].call(null, children), child_trivia, [0, start, end_pos]]; } var child = read_cst_inner(s); switch(child[0]){ case 0: var a = child[4], b = child[3], c = child[2], child_with_trivia = [0, Stdlib[37].call(null, child_trivia, child[1]), c, b, a]; break; case 1: var d = child[6], e = child[5], f = child[4], g = child[3], h = child[2], child_with_trivia = [1, Stdlib[37].call(null, child_trivia, child[1]), h, g, f, e, d]; break; default: var i = child[4], j = child[3], k = child[2], child_with_trivia = [2, Stdlib[37].call(null, child_trivia, child[1]), k, j, i]; } children = [0, child_with_trivia, children]; } } function read_cst_inner(s){return read_cst(s);} function parse_all_cst(src){ var s = make_state(src), results = 0; for(;;){ var trivia = collect_trivia(s); if(at_end(s)) return [0, Stdlib_List[10].call(null, results), trivia]; var node = read_cst_inner(s); switch(node[0]){ case 0: var a = node[4], b = node[3], c = node[2], node_with_trivia = [0, Stdlib[37].call(null, trivia, node[1]), c, b, a]; break; case 1: var d = node[6], e = node[5], f = node[4], g = node[3], h = node[2], node_with_trivia = [1, Stdlib[37].call(null, trivia, node[1]), h, g, f, e, d]; break; default: var i = node[4], j = node[3], k = node[2], node_with_trivia = [2, Stdlib[37].call(null, trivia, node[1]), k, j, i]; } results = [0, node_with_trivia, results]; } } function parse_file_cst(path){ var ic = Stdlib[79].call(null, path), n = Stdlib[92].call(null, ic), src = Stdlib[86].call(null, ic, n); Stdlib[93].call(null, ic); return parse_all_cst(src); } runtime.caml_register_global (46, [0, make_state, peek, advance, at_end, skip_whitespace_and_comments, is_ident_start, is_ident_char, is_ident_char, read_string, read_symbol, try_number, read_value, read_list, read_dict, parse_all, parse_file, collect_trivia, read_cst, read_cst_list, read_cst_dict, read_cst_inner, parse_all_cst, parse_file_cst], "Sx_parser"); return; } (globalThis)); //# 2203 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_primitives:[N,N,N,N,N,N,N,F(1),F(1),F(1),N,F(1),F(2),F(1),F(1),N,F(1),F(1),F(1),F(1)*,F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_round_float = runtime.caml_round_float, caml_string_get = runtime.caml_string_get, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Sx_types = global_data.Sx_types, Stdlib = global_data.Stdlib, Stdlib_Float = global_data.Stdlib__Float, Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_List = global_data.Stdlib__List, Stdlib_String = global_data.Stdlib__String, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_Uchar = global_data.Stdlib__Uchar, primitives = Stdlib_Hashtbl[1].call(null, 0, 128), sx_call_fn = [0, function(a, param){ throw caml_maybe_attach_backtrace ([0, Sx_types[7], "sx_call not initialized"], 1); }], sx_trampoline_fn = [0, function(v){return v;}], scope_stacks = Stdlib_Hashtbl[1].call(null, 0, 8), scope_trace = [0, 0], scope_log = [0, 0]; function scope_trace_enable(param){ scope_trace[1] = 1; scope_log[1] = 0; return 0; } function scope_trace_disable(param){scope_trace[1] = 0; return 0;} function scope_trace_drain(param){ var log = Stdlib_List[10].call(null, scope_log[1]); scope_log[1] = 0; return log; } var request_cookies = Stdlib_Hashtbl[1].call(null, 0, 8); function scope_clear_all(param){ return Stdlib_Hashtbl[2].call(null, scope_stacks); } function register(name, fn){ return Stdlib_Hashtbl[11].call(null, primitives, name, fn); } function is_primitive(name){ return Stdlib_Hashtbl[9].call(null, primitives, name); } function get_primitive(name){ var match = Stdlib_Hashtbl[7].call(null, primitives, name); if(match){var fn = match[1]; return [14, name, fn];} var a = Stdlib[28].call(null, "Unknown primitive: ", name); throw caml_maybe_attach_backtrace([0, Sx_types[7], a], 1); } var trampoline_hook = [0, function(v){return v;}], cst = "", cst_signal = "__signal", cst_dict = "dict", cst_value = "value"; function as_number(t$1){ var t = t$1; a: for(;;){ if(typeof t === "number") return 0.; switch(t[0]){ case 0: return t[1] ? 1. : 0.; case 1: var n = t[1]; return n; case 2: var s = t[1], match = Stdlib[36].call(null, s); if(! match) return Stdlib_Float[8]; var n$0 = match[1]; return n$0; case 11: var t$0 = caml_call1(trampoline_hook[1], t); t = t$0; break; default: break a; } } if(typeof t === "number" || ! (6 === t[0])) var a = cst; else{ var d = t[1]; if(Stdlib_Hashtbl[7].call(null, d, cst_signal)){ var match$0 = Stdlib_Hashtbl[7].call(null, d, cst_value); if(match$0) var v = match$0[1], b = Sx_types[23].call(null, v); else var b = "?"; var h = Stdlib[28].call(null, b, "}"), a = Stdlib[28].call(null, "signal{value=", h); } else var a = cst_dict; } var c = Stdlib[28].call(null, ": ", a), e = Sx_types[35].call(null, t), f = Stdlib[28].call(null, e, c), g = Stdlib[28].call(null, "Expected number, got ", f); throw caml_maybe_attach_backtrace([0, Sx_types[7], g], 1); } function as_string(v){ if(typeof v !== "number" && 2 === v[0]){var s = v[1]; return s;} var a = Sx_types[35].call(null, v), b = Stdlib[28].call(null, "Expected string, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } function as_list(t$1){ var t = t$1; for(;;){ if(typeof t === "number") return 0; switch(t[0]){ case 5: var l = t[1]; return l; case 11: var t$0 = caml_call1(sx_trampoline_fn[1], t); t = t$0; break; case 20: var r = t[1]; return r[1]; default: var a = Sx_types[35].call(null, t), b = Stdlib[28].call(null, "Expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } } function as_bool(v){ if(typeof v !== "number" && 0 === v[0]){var b = v[1]; return b;} return Sx_types[45].call(null, v); } var cst_g = "%g", cst_false = "false", cst_true = "true", a = [0, [8, [0, 0, 3], 0, 0, 0], cst_g]; function to_string(t$1){ var t = t$1; for(;;){ if(typeof t === "number") return cst; switch(t[0]){ case 0: return t[1] ? cst_true : cst_false; case 1: var n = t[1]; return Stdlib_Float[18].call(null, n) ? Stdlib[33].call(null, n | 0) : caml_call1(Stdlib_Printf[4].call(null, a), n); case 11: var t$0 = caml_call1(trampoline_hook[1], t); t = t$0; break; case 2: case 3: case 4: case 16: case 18: var s = t[1]; return s; default: return Sx_types[86].call(null, t); } } } register ("+", function(args){ return [1, Stdlib_List[26].call (null, function(acc, a){return acc + as_number(a);}, 0., args)]; }); var b = [1, 0.]; register ("-", function(args){ if(! args) return b; var a = args[1]; if(! args[2]) return [1, - as_number(a)]; var rest = args[2], c = as_number(a); return [1, Stdlib_List[26].call (null, function(acc, x){return acc - as_number(x);}, c, rest)]; }); register ("*", function(args){ return [1, Stdlib_List[26].call (null, function(acc, a){return acc * as_number(a);}, 1., args)]; }); register ("/", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1], d = as_number(b); return [1, as_number(a) / d]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "/: expected 2 args"], 1); }); register ("mod", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1], d = as_number(b); return [1, as_number(a) % d]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "mod: expected 2 args"], 1); }); register ("inc", function(args){ if(args && ! args[2]){var a = args[1]; return [1, as_number(a) + 1.];} throw caml_maybe_attach_backtrace([0, Sx_types[7], "inc: 1 arg"], 1); }); register ("dec", function(args){ if(args && ! args[2]){var a = args[1]; return [1, as_number(a) - 1.];} throw caml_maybe_attach_backtrace([0, Sx_types[7], "dec: 1 arg"], 1); }); register ("abs", function(args){ if(args && ! args[2]){ var a = args[1]; return [1, Math.abs(as_number(a))]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "abs: 1 arg"], 1); }); register ("floor", function(args){ if(args && ! args[2]){ var a = args[1]; return [1, Math.floor(as_number(a))]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "floor: 1 arg"], 1); }); register ("ceil", function(args){ if(args && ! args[2]){ var a = args[1]; return [1, Math.ceil(as_number(a))]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "ceil: 1 arg"], 1); }); register ("round", function(args){ if(args){ var match = args[2], a = args[1]; if(! match) return [1, caml_round_float(as_number(a))]; if(! match[2]){ var b = match[1], n = as_number(a), places = as_number(b) | 0, factor = Math.pow(10., places); return [1, caml_round_float(n * factor) / factor]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "round: 1-2 args"], 1); }); register ("min", function(args){ if(args) return [1, Stdlib_List[26].call (null, function(acc, a){ var b = as_number(a); return Stdlib_Float[23].call(null, acc, b); }, Stdlib_Float[6], args)]; throw caml_maybe_attach_backtrace ([0, Sx_types[7], "min: at least 1 arg"], 1); }); register ("max", function(args){ if(args) return [1, Stdlib_List[26].call (null, function(acc, a){ var b = as_number(a); return Stdlib_Float[24].call(null, acc, b); }, Stdlib_Float[7], args)]; throw caml_maybe_attach_backtrace ([0, Sx_types[7], "max: at least 1 arg"], 1); }); register ("sqrt", function(args){ if(args && ! args[2]){ var a = args[1]; return [1, Math.sqrt(as_number(a))]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "sqrt: 1 arg"], 1); }); register ("pow", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1], d = as_number(b); return [1, Math.pow(as_number(a), d)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "pow: 2 args"], 1); }); register ("clamp", function(args){ if(args){ var a = args[2]; if(a){ var b = a[2]; if(b && ! b[2]){ var hi = b[1], lo = a[1], x = args[1], x$0 = as_number(x), lo$0 = as_number(lo), hi$0 = as_number(hi), c = Stdlib_Float[23].call(null, hi$0, x$0); return [1, Stdlib_Float[24].call(null, lo$0, c)]; } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "clamp: 3 args"], 1); }); register ("parse-int", function(args){ function parse_leading_int(s){ var len = caml_ml_string_length(s), a = 0 < len, neg = a ? 45 === caml_string_get(s, 0) : a; if(neg) var start = 1; else var b = 0 < len, d = b ? 43 === caml_string_get(s, 0) : b, start = d ? 1 : 0; var j = start; for(;;){ if (j < len && 48 <= caml_string_get(s, j) && 57 >= caml_string_get(s, j)){var j$0 = j + 1 | 0; j = j$0; continue;} if(start >= j) return 0; var n = runtime.caml_int_of_string (Stdlib_String[16].call(null, s, start, j - start | 0)), c = neg ? - n | 0 : n; return [0, c]; } } a: if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 1: var c = args[2], n = a[1]; if(c && c[2]) break a; return [1, n | 0]; case 2: var match = args[2], s = a[1]; if(match){ if(match[2]) break a; var default_val$0 = match[1], match$0 = parse_leading_int(s); if(! match$0) return default_val$0; var n$0 = match$0[1]; return [1, n$0]; } var match$1 = parse_leading_int(s); if(! match$1) return 0; var n$1 = match$1[1]; return [1, n$1]; } var b = args[2]; if(b && ! b[2]){var default_val = b[1]; return default_val;} } return 0; }); register ("parse-float", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 1: if(! args[2]){var n = a[1]; return [1, n];} break; case 2: if(! args[2]){ var s = a[1], match = Stdlib[36].call(null, s); if(! match) return 0; var n$0 = match[1]; return [1, n$0]; } break; } } return 0; }); var cst_host_handle = "__host_handle"; function safe_eq(a, b){ if(a === b) return 1; a: if(typeof a === "number"){ if(typeof b === "number") return 1; } else{ switch(a[0]){ case 0: if(typeof b === "number") break a; if(0 !== b[0]) break a; var y = b[1], x = a[1]; return x === y ? 1 : 0; case 1: if(typeof b === "number") break a; if(1 !== b[0]) break a; var y$0 = b[1], x$0 = a[1]; return x$0 === y$0 ? 1 : 0; case 2: if(typeof b === "number") break a; if(2 !== b[0]) break a; var y$1 = b[1], x$1 = a[1]; return x$1 === y$1 ? 1 : 0; case 3: if(typeof b === "number") break a; if(3 !== b[0]) break a; var y$2 = b[1], x$2 = a[1]; return x$2 === y$2 ? 1 : 0; case 4: if(typeof b === "number") break a; if(4 !== b[0]) break a; var y$3 = b[1], x$3 = a[1]; return x$3 === y$3 ? 1 : 0; case 5: var la = a[1]; break; case 6: if(typeof b === "number") break a; if(6 !== b[0]) break a; var b$0 = b[1], a$0 = a[1], match = Stdlib_Hashtbl[7].call(null, a$0, cst_host_handle), match$0 = Stdlib_Hashtbl[7].call(null, b$0, cst_host_handle); if(match){ var d = match[1]; if(typeof d !== "number" && 1 === d[0] && match$0){ var match$1 = match$0[1]; if(typeof match$1 !== "number" && 1 === match$1[0]){ var hb = match$1[1], ha = d[1]; return ha === hb ? 1 : 0; } } } return 0; case 20: var la = a[1][1]; break; case 24: if(typeof b === "number") break a; if(24 !== b[0]) break a; var b$1 = b[1], a$1 = a[1], f = a$1[1][2] === b$1[1][2] ? 1 : 0; if(f){ var g = a$1[2].length - 1 === b$1[2].length - 1 ? 1 : 0; if(g){ var j = a$1[2].length - 2 | 0, h = 1; if(j < 0) var c = h; else{ var eq = h, i = 0; for(;;){ var l = caml_check_bound(b$1[2], i)[i + 1], eq$0 = 1 - safe_eq(caml_check_bound(a$1[2], i)[i + 1], l) ? 0 : eq, m = i + 1 | 0; if(j === i){var c = eq$0; break;} eq = eq$0; i = m; } } } else var c = g; } else var c = f; return c; default: break a; } if(typeof b !== "number"){ switch(b[0]){ case 5: var lb = b[1]; break; case 20: var lb = b[1][1]; break; default: break a; } var k = Stdlib_List[1].call(null, lb), e = Stdlib_List[1].call(null, la) === k ? 1 : 0; return e ? Stdlib_List[35].call(null, safe_eq, la, lb) : e; } } return 0; } register ("=", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){var b = c[1], a = args[1]; return [0, safe_eq(a, b)];} } throw caml_maybe_attach_backtrace([0, Sx_types[7], "=: 2 args"], 1); }); register ("!=", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1]; return [0, 1 - safe_eq(a, b)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "!=: 2 args"], 1); }); register ("<", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var d = args[2]; if(! d) break a; var e = d[1]; if(typeof e !== "number" && 2 === e[0]){ if(d[2]) break a; var b$0 = e[1], a$0 = a[1]; return [0, runtime.caml_string_lessthan(a$0, b$0)]; } } var c = args[2]; if(c && ! c[2]){ var b = c[1], f = as_number(b); return [0, as_number(a) < f ? 1 : 0]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "<: 2 args"], 1); }); register (">", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var d = args[2]; if(! d) break a; var e = d[1]; if(typeof e !== "number" && 2 === e[0]){ if(d[2]) break a; var b$0 = e[1], a$0 = a[1]; return [0, runtime.caml_string_greaterthan(a$0, b$0)]; } } var c = args[2]; if(c && ! c[2]){ var b = c[1], f = as_number(b); return [0, f < as_number(a) ? 1 : 0]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], ">: 2 args"], 1); }); register ("<=", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var d = args[2]; if(! d) break a; var e = d[1]; if(typeof e !== "number" && 2 === e[0]){ if(d[2]) break a; var b$0 = e[1], a$0 = a[1]; return [0, runtime.caml_string_lessequal(a$0, b$0)]; } } var c = args[2]; if(c && ! c[2]){ var b = c[1], f = as_number(b); return [0, as_number(a) <= f ? 1 : 0]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "<=: 2 args"], 1); }); register (">=", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var d = args[2]; if(! d) break a; var e = d[1]; if(typeof e !== "number" && 2 === e[0]){ if(d[2]) break a; var b$0 = e[1], a$0 = a[1]; return [0, runtime.caml_string_greaterequal(a$0, b$0)]; } } var c = args[2]; if(c && ! c[2]){ var b = c[1], f = as_number(b); return [0, f <= as_number(a) ? 1 : 0]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], ">=: 2 args"], 1); }); register ("not", function(args){ if(args && ! args[2]){ var a = args[1]; return [0, 1 - Sx_types[45].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "not: 1 arg"], 1); }); register ("nil?", function(args){ if(args && ! args[2]){ var a = args[1]; return [0, Sx_types[36].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "nil?: 1 arg"], 1); }); var c = [0, 0], d = [0, 1]; register ("number?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0]){if(args[2]) break a; return d;} if(! args[2]) return c; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "number?: 1 arg"], 1); }); var e = [0, 0]; register ("integer?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0]){ if(args[2]) break a; var f = a[1]; return [0, Stdlib_Float[18].call(null, f)]; } if(! args[2]) return e; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "integer?: 1 arg"], 1); }); var f = [0, 0], g = [0, 1]; register ("string?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){if(args[2]) break a; return g;} if(! args[2]) return f; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "string?: 1 arg"], 1); }); var h = [0, 0], i = [0, 1]; register ("boolean?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 0 === a[0]){if(args[2]) break a; return i;} if(! args[2]) return h; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "boolean?: 1 arg"], 1); }); var j = [0, 0], k = [0, 1]; register ("list?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){case 5:case 20: if(args[2]) break a; return k;} if(! args[2]) return j; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "list?: 1 arg"], 1); }); var l = [0, 0], m = [0, 1]; register ("dict?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0]){if(args[2]) break a; return m;} if(! args[2]) return l; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "dict?: 1 arg"], 1); }); var n = [0, 0], o = [0, 1]; register ("symbol?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 3 === a[0]){if(args[2]) break a; return o;} if(! args[2]) return n; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "symbol?: 1 arg"], 1); }); var p = [0, 0], q = [0, 1]; register ("keyword?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 4 === a[0]){if(args[2]) break a; return q;} if(! args[2]) return p; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "keyword?: 1 arg"], 1); }); var r = [0, 1], s = [0, 0], t = [0, 0], u = [0, 1], v = [0, 0], w = [0, 1]; register ("empty?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ b: { switch(a[0]){ case 2: if(a[1] !== cst){if(args[2]) break a; return t;} if(args[2]) break a; return u; case 5: if(a[1]){if(args[2]) break a; break b;} if(args[2]) break a; break; case 6: if(args[2]) break a; var d = a[1]; return [0, 0 === Stdlib_Hashtbl[15].call(null, d) ? 1 : 0]; case 20: if(a[1][1]){if(args[2]) break a; break b;} if(args[2]) break a; break; default: if(args[2]) break a; return s; } return w; } return v; } if(! args[2]) return r; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "empty?: 1 arg"], 1); }); register ("odd?", function(args){ if(args && ! args[2]){ var a = args[1]; return [0, 0 !== ((as_number(a) | 0) % 2 | 0) ? 1 : 0]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "odd?: 1 arg"], 1); }); register ("even?", function(args){ if(args && ! args[2]){ var a = args[1]; return [0, 0 === ((as_number(a) | 0) % 2 | 0) ? 1 : 0]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "even?: 1 arg"], 1); }); register ("zero?", function(args){ if(args && ! args[2]){ var a = args[1]; return [0, as_number(a) === 0. ? 1 : 0]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "zero?: 1 arg"], 1); }); register ("str", function(args){ var a = Stdlib_List[20].call(null, to_string, args); return [2, Stdlib_String[7].call(null, cst, a)]; }); register ("upper", function(args){ if(args && ! args[2]){ var a = args[1], b = as_string(a); return [2, Stdlib_String[26].call(null, b)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "upper: 1 arg"], 1); }); register ("upcase", function(args){ if(args && ! args[2]){ var a = args[1], b = as_string(a); return [2, Stdlib_String[26].call(null, b)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "upcase: 1 arg"], 1); }); register ("lower", function(args){ if(args && ! args[2]){ var a = args[1], b = as_string(a); return [2, Stdlib_String[27].call(null, b)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "lower: 1 arg"], 1); }); register ("downcase", function(args){ if(args && ! args[2]){ var a = args[1], b = as_string(a); return [2, Stdlib_String[27].call(null, b)]; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "downcase: 1 arg"], 1); }); register ("trim", function(args){ if(args && ! args[2]){ var a = args[1], b = as_string(a); return [2, Stdlib_String[24].call(null, b)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "trim: 1 arg"], 1); }); register ("string-length", function(args){ if(args && ! args[2]){ var a = args[1]; return [1, caml_ml_string_length(as_string(a))]; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "string-length: 1 arg"], 1); }); register ("string-contains?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var needle = c[1], haystack = a[1], i = 0; for(;;){ if (caml_ml_string_length(haystack) < (i + caml_ml_string_length(needle) | 0)) var d = 0; else{ if (Stdlib_String[16].call (null, haystack, i, caml_ml_string_length(needle)) !== needle){ var i$0 = i + 1 | 0; i = i$0; continue; } var d = 1; } return [0, d]; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "string-contains?: 2 string args"], 1); }); register ("starts-with?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var prefix = c[1], s = a[1], d = caml_ml_string_length(prefix) <= caml_ml_string_length(s) ? 1 : 0, e = d ? Stdlib_String [16].call (null, s, 0, caml_ml_string_length(prefix)) === prefix ? 1 : 0 : d; return [0, e]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "starts-with?: 2 string args"], 1); }); register ("ends-with?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var suffix = c[1], s = a[1], sl = caml_ml_string_length(s), xl = caml_ml_string_length(suffix), d = xl <= sl ? 1 : 0, e = d ? Stdlib_String [16].call (null, s, sl - xl | 0, xl) === suffix ? 1 : 0 : d; return [0, e]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "ends-with?: 2 string args"], 1); }); var x = [1, -1.]; register ("index-of", function(args){ a: if(args){ var b = args[1]; if(typeof b !== "number"){ switch(b[0]){ case 2: var c = args[2]; if(! c) break a; var d = c[1]; if(typeof d === "number") break a; if(2 !== d[0]) break a; if(c[2]) break a; var needle = d[1], haystack = b[1], nl = caml_ml_string_length(needle), hl = caml_ml_string_length(haystack), i = 0; for(;;){ if(hl < (i + nl | 0)) return x; if(Stdlib_String[16].call(null, haystack, i, nl) === needle) return [1, i]; var i$0 = i + 1 | 0; i = i$0; } break; case 5: var e = args[2]; if(! e) break a; if(e[2]) break a; var target = e[1], items = b[1]; break; case 20: var f = args[2], g = b[1][1]; if(! f) break a; if(f[2]) break a; var target = f[1], items = g; break; default: break a; } var i$1 = 0, param = items; for(;;){ if(! param) return 0; var h = param[1]; b: { if(typeof h === "number"){ if(typeof target === "number"){var a = 1; break b;} } else switch(h[0]){ case 0: if(typeof target !== "number" && 0 === target[0]){ var y = target[1], x$0 = h[1], a = x$0 === y; break b; } break; case 1: if(typeof target !== "number" && 1 === target[0]){ var y$0 = target[1], x$1 = h[1], a = x$1 === y$0; break b; } break; case 2: if(typeof target !== "number" && 2 === target[0]){ var y$1 = target[1], x$2 = h[1], a = x$2 === y$1; break b; } break; case 3: if(typeof target !== "number" && 3 === target[0]){ var y$2 = target[1], x$3 = h[1], a = x$3 === y$2; break b; } break; case 4: if(typeof target !== "number" && 4 === target[0]){ var y$3 = target[1], x$4 = h[1], a = x$4 === y$3; break b; } break; } var a = h === target; } if(a) return [1, i$1]; var tl = param[2], i$2 = i$1 + 1 | 0; i$1 = i$2; param = tl; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "index-of: 2 string args or list+target"], 1); }); register ("substring", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0]){ var d = b[2]; if(d){ var e = d[1]; if(typeof e !== "number" && 1 === e[0] && ! d[2]){ var end = e[1], start = c[1], s = a[1], i = start | 0, j = end | 0, len = caml_ml_string_length(s), f = Stdlib[16].call(null, i, len), i$0 = Stdlib[17].call(null, 0, f), g = Stdlib[16].call(null, j, len), j$0 = Stdlib[17].call(null, 0, g), h = Stdlib[17].call(null, 0, j$0 - i$0 | 0); return [2, Stdlib_String[16].call(null, s, i$0, h)]; } } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "substring: 3 args"], 1); }); register ("substr", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0]){ var match = b[2], start = c[1], s = a[1]; if(! match){ var i$1 = start | 0, sl$0 = caml_ml_string_length(s), g = Stdlib[16].call(null, i$1, sl$0), i$2 = Stdlib[17].call(null, 0, g); return [2, Stdlib_String[16].call(null, s, i$2, sl$0 - i$2 | 0)]; } var d = match[1]; if(typeof d !== "number" && 1 === d[0] && ! match[2]){ var len = d[1], i = start | 0, n = len | 0, sl = caml_ml_string_length(s), e = Stdlib[16].call(null, i, sl), i$0 = Stdlib[17].call(null, 0, e), f = Stdlib[16].call(null, n, sl - i$0 | 0), n$0 = Stdlib[17].call(null, 0, f); return [2, Stdlib_String[16].call(null, s, i$0, n$0)]; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "substr: 2-3 args"], 1); }); register ("split", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var sep = c[1], s = a[1], d = caml_string_get(sep, 0), e = Stdlib_String[17].call(null, d, s); return [5, Stdlib_List[20].call(null, function(p){return [2, p];}, e)]; } } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "split: 2 args"], 1); }); register ("join", function(args){ a: if(args){ var b = args[1]; if(typeof b !== "number" && 2 === b[0]){ var c = args[2]; if(c){ var a = c[1], sep = b[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var items = a[1]; break; case 20: var items = a[1][1]; break; default: break a; } if(! c[2]){ var d = Stdlib_List[20].call(null, to_string, items); return [2, Stdlib_String[7].call(null, sep, d)]; } } } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "join: 2 args"], 1); }); var y = [0, [8, [0, 0, 3], 0, 0, 0], cst_g]; register ("replace", function(args){ function to_str(t){ if(typeof t === "number") return cst; switch(t[0]){ case 0: return t[1] ? cst_true : cst_false; case 1: var n = t[1]; return Stdlib_Float[18].call(null, n) ? Stdlib[33].call(null, n | 0) : caml_call1(Stdlib_Printf[4].call(null, y), n); case 11: var v = caml_call1(sx_trampoline_fn[1], t); if(typeof v !== "number" && 2 === v[0]){var s$0 = v[1]; return s$0;} return to_string(v); case 2: case 3: case 4: case 16: case 18: var s = t[1]; return s; default: return to_string(t); } } if(args){ var a = args[2]; if(a){ var b = a[2]; if(b && ! b[2]){ var new_s = b[1], old_s = a[1], s = args[1], s$0 = to_str(s), old_s$0 = to_str(old_s), new_s$0 = to_str(new_s), ol = caml_ml_string_length(old_s$0); if(0 === ol) return [2, s$0]; var buf = Stdlib_Buffer[1].call(null, caml_ml_string_length(s$0)), i = 0; for(;;){ if(caml_ml_string_length(s$0) <= i) return [2, Stdlib_Buffer[2].call(null, buf)]; if ((i + ol | 0) <= caml_ml_string_length(s$0) && Stdlib_String[16].call(null, s$0, i, ol) === old_s$0){ Stdlib_Buffer[16].call(null, buf, new_s$0); var i$0 = i + ol | 0; i = i$0; continue; } var c = caml_string_get(s$0, i); Stdlib_Buffer[12].call(null, buf, c); var i$1 = i + 1 | 0; i = i$1; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "replace: 3 string args"], 1); }); register ("char-from-code", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0] && ! args[2]){ var n = a[1], buf = Stdlib_Buffer[1].call(null, 4), b = Stdlib_Uchar[8].call(null, n | 0); Stdlib_Buffer[13].call(null, buf, b); return [2, Stdlib_Buffer[2].call(null, buf)]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "char-from-code: 1 arg"], 1); }); register("list", function(args){return [20, [0, args]];}); var cst_args = " args", cst_len = "len", z = [0, [11, "len: ", [4, 0, 0, 0, [11, cst_args, 0]]], "len: %d args"], A = [1, 0.], B = [1, 1.], C = [1, 1.], D = [1, 0.]; register (cst_len, function(args){ a: if(args){ var a = args[1]; b: { if(typeof a !== "number"){ switch(a[0]){ case 0: if(a[1]){if(args[2]) break a; return B;} if(args[2]) break a; break b; case 1: if(args[2]) break a; return C; case 2: if(args[2]) break a; var s = a[1]; return [1, caml_ml_string_length(s)]; case 5: if(args[2]) break a; var l = a[1]; break; case 6: if(args[2]) break a; var d = a[1]; return [1, Stdlib_Hashtbl[15].call(null, d)]; case 16: if(args[2]) break a; var s$0 = a[1]; return [1, caml_ml_string_length(s$0)]; case 17: if(args[2]) break a; var pairs = a[1]; return [1, Stdlib_List[1].call(null, pairs)]; case 18: if(args[2]) break a; var s$1 = a[1]; return [1, caml_ml_string_length(s$1)]; case 20: var e = a[1][1]; if(args[2]) break a; var l = e; break; case 3: case 4: case 7: case 8: case 9: case 10: case 11: case 14: if(args[2]) break a; return D; default: break a; } return [1, Stdlib_List[1].call(null, l)]; } if(args[2]) break a; } return A; } var b = Stdlib_List[1].call(null, args), c = caml_call1(Stdlib_Printf[4].call(null, z), b); throw caml_maybe_attach_backtrace([0, Sx_types[7], c], 1); }); register("length", Stdlib_Hashtbl[6].call(null, primitives, cst_len)); register ("first", function(args){ a: if(args){ var x = args[1]; if(typeof x !== "number"){ b: { switch(x[0]){ case 5: var a = x[1]; if(a){if(args[2]) break a; var x$0 = a[1]; break b;} if(args[2]) break a; break; case 20: var b = x[1][1]; if(b){if(args[2]) break a; var x$0 = b[1]; break b;} if(args[2]) break a; break; default: if(args[2]) break a; var c = Sx_types[86].call(null, x), d = Stdlib[28].call(null, "first: expected list, got ", c); throw caml_maybe_attach_backtrace([0, Sx_types[7], d], 1); } return 0; } return x$0; } if(! args[2]) return 0; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "first: 1 list arg"], 1); }); var E = [5, 0], F = [5, 0]; register ("rest", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ b: { switch(a[0]){ case 5: var b = a[1]; if(b){if(args[2]) break a; var xs = b[2]; break b;} if(args[2]) break a; break; case 20: var c = a[1][1]; if(c){if(args[2]) break a; var xs = c[2]; break b;} if(args[2]) break a; break; default: break a; } return F; } return [5, xs]; } if(! args[2]) return E; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "rest: 1 list arg"], 1); }); register ("last", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: if(args[2]) break a; var l = a[1]; break; case 20: var b = a[1][1]; if(args[2]) break a; var l = b; break; default: break a; } var match = Stdlib_List[10].call(null, l); if(! match) return 0; var x = match[1]; return x; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "last: 1 list arg"], 1); }); var G = [5, 0]; register ("init", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: if(args[2]) break a; var l = a[1]; break; case 20: var b = a[1][1]; if(args[2]) break a; var l = b; break; default: break a; } var match = Stdlib_List[10].call(null, l); if(! match) return G; var rest = match[2]; return [5, Stdlib_List[10].call(null, rest)]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "init: 1 list arg"], 1); }); register ("nth", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 2: var b = args[2]; if(! b) break a; var c = b[1]; if(typeof c === "number") break a; if(1 !== c[0]) break a; if(b[2]) break a; var n = c[1], s = a[1], i = n | 0; if(0 <= i && i < caml_ml_string_length(s)){ var h = caml_string_get(s, i); return [2, Stdlib_String[1].call(null, 1, h)]; } return 0; case 5: var d = args[2]; if(! d) break a; var e = d[1]; if(typeof e === "number") break a; if(1 !== e[0]) break a; if(d[2]) break a; var n$0 = e[1], l = a[1]; break; case 20: var f = args[2], k = a[1][1]; if(! f) break a; var g = f[1]; if(typeof g === "number") break a; if(1 !== g[0]) break a; if(f[2]) break a; var n$0 = g[1], l = k; break; default: break a; } try{var j = Stdlib_List[8].call(null, l, n$0 | 0); return j;} catch(exn){return 0;} } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "nth: list/string and number"], 1); }); register ("cons", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], x = args[1]; if(typeof b !== "number"){ switch(b[0]){ case 5: if(a[2]) break a; var l = b[1]; break; case 20: var c = b[1][1]; if(a[2]) break a; var l = c; break; default: break a; } return [5, [0, x, l]]; } if(! a[2]) return [5, [0, x, 0]]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "cons: value and list"], 1); }); register ("append", function(args){ a: if(args){ var v = args[1]; if(typeof v === "number"){ var d = args[2]; if(d){ var a = d[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var lb = a[1]; break; case 20: var lb = a[1][1]; break; default: break a; } if(! d[2]) return [5, lb]; } } } else{ b: { switch(v[0]){ case 5: var la$0 = v[1]; break; case 20: var la$0 = v[1][1]; break; default: break b; } var f = args[2]; if(! f) break a; var c = f[1]; if(typeof c !== "number"){ switch(c[0]){ case 5: var lb$1 = c[1]; break; case 20: var lb$1 = c[1][1]; break; default: break b; } if(f[2]) break a; return [5, Stdlib[37].call(null, la$0, lb$1)]; } c: { if(typeof v !== "number" && 20 === v[0]){var la$1 = v[1][1]; break c;} var la$1 = v[1]; } if(args[2][2]) break a; return [5, la$1]; } b: if(typeof v !== "number"){ switch(v[0]){ case 5: var la = v[1]; break; case 20: var la = v[1][1]; break; default: break b; } var g = args[2]; if(g[2]) break a; var v$0 = g[1]; return [5, Stdlib[37].call(null, la, [0, v$0, 0])]; } var e = args[2]; if(e){ var b = e[1]; if(typeof b !== "number"){ switch(b[0]){ case 5: var lb$0 = b[1]; break; case 20: var lb$0 = b[1][1]; break; default: break a; } if(! e[2]) return [5, Stdlib[37].call(null, [0, v, 0], lb$0)]; } } } } var all = Stdlib_List[24].call(null, as_list, args); return [5, all]; }); register ("append!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 5: var b = args[2]; if(b && ! b[2]){ var item = b[1], items = a[1]; return [5, Stdlib[37].call(null, items, [0, item, 0])]; } break; case 20: var c = args[2]; if(c && ! c[2]){ var item$0 = c[1], r = a[1]; r[1] = Stdlib[37].call(null, r[1], [0, item$0, 0]); return [20, r]; } break; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "append!: list and item"], 1); }); register ("reverse", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: if(args[2]) break a; var l = a[1]; break; case 20: var b = a[1][1]; if(args[2]) break a; var l = b; break; default: break a; } return [5, Stdlib_List[10].call(null, l)]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "reverse: 1 list"], 1); }); register ("flatten", function(args){ function flat(x){ a: if(typeof x !== "number"){ switch(x[0]){ case 5: var items = x[1]; break; case 20: var items = x[1][1]; break; default: break a; } return Stdlib_List[24].call(null, flat, items); } return [0, x, 0]; } a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: if(args[2]) break a; var l = a[1]; break; case 20: var b = a[1][1]; if(args[2]) break a; var l = b; break; default: break a; } return [5, Stdlib_List[24].call(null, flat, l)]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "flatten: 1 list"], 1); }); register ("concat", function(args){return [5, Stdlib_List[24].call(null, as_list, args)];}); register ("contains?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 2: var b = args[2]; if(! b) break a; var c = b[1]; if(typeof c === "number") break a; if(2 !== c[0]) break a; if(b[2]) break a; var sub = c[1], s = a[1], i = 0; for(;;){ if (caml_ml_string_length(s) < (i + caml_ml_string_length(sub) | 0)) var f = 0; else{ if (Stdlib_String[16].call(null, s, i, caml_ml_string_length(sub)) !== sub){ var i$0 = i + 1 | 0; i = i$0; continue; } var f = 1; } return [0, f]; } case 5: var d = args[2]; if(! d) break a; if(d[2]) break a; var item = d[1], l = a[1]; break; case 20: var e = args[2], g = a[1][1]; if(! e) break a; if(e[2]) break a; var item = e[1], l = g; break; default: break a; } return [0, Stdlib_List[34].call (null, function(x$4){ var d = x$4 === item ? 1 : 0; if(d) var e = d; else{ if(typeof x$4 === "number"){ if(typeof item === "number") return 1; } else switch(x$4[0]){ case 0: if(typeof item !== "number" && 0 === item[0]){ var y = item[1], x = x$4[1]; return x === y ? 1 : 0; } break; case 1: if(typeof item !== "number" && 1 === item[0]){ var y$0 = item[1], x$0 = x$4[1]; return x$0 === y$0 ? 1 : 0; } break; case 2: if(typeof item !== "number" && 2 === item[0]){ var y$1 = item[1], x$1 = x$4[1]; return x$1 === y$1 ? 1 : 0; } break; case 3: if(typeof item !== "number" && 3 === item[0]){ var y$2 = item[1], x$2 = x$4[1]; return x$2 === y$2 ? 1 : 0; } break; case 4: if(typeof item !== "number" && 4 === item[0]){ var y$3 = item[1], x$3 = x$4[1]; return x$3 === y$3 ? 1 : 0; } break; case 6: if(typeof item !== "number" && 6 === item[0]){ var b = item[1], a = x$4[1], match = Stdlib_Hashtbl[7].call(null, a, cst_host_handle), match$0 = Stdlib_Hashtbl[7].call(null, b, cst_host_handle); if(match){ var c = match[1]; if(typeof c !== "number" && 1 === c[0] && match$0){ var match$1 = match$0[1]; if(typeof match$1 !== "number" && 1 === match$1[0]){ var hb = match$1[1], ha = c[1]; return ha === hb ? 1 : 0; } } } return 0; } break; } var e = 0; } return e; }, l)]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "contains?: 2 args"], 1); }); var H = [5, 0]; register ("range", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0]){ var match = args[2], stop = a[1]; if(! match){ var n = stop | 0, h = Stdlib[17].call(null, 0, n); return [5, Stdlib_List[11].call(null, h, function(i){return [1, i];})]; } var b = match[1]; if(typeof b !== "number" && 1 === b[0]){ var match$0 = match[2], stop$0 = b[1]; if(! match$0){ var s = stop | 0, e = stop$0 | 0, len = Stdlib[17].call(null, 0, e - s | 0); return [5, Stdlib_List[11].call (null, len, function(i){return [1, s + i | 0];})]; } var c = match$0[1]; if(typeof c !== "number" && 1 === c[0] && ! match$0[2]){ var step = c[1]; if(step === 0.) return H; var d = 0; if(0. < step){ var i = stop, items = d; for(;;){ if(! (i < stop$0)){var items$1 = items; break;} var f = [0, [1, i], items]; i = i + step; items = f; } } else{ var i$0 = stop, items$0 = d; for(;;){ if(! (stop$0 < i$0)){var items$1 = items$0; break;} var g = [0, [1, i$0], items$0]; i$0 = i$0 + step; items$0 = g; } } return [5, Stdlib_List[10].call(null, items$1)]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "range: 1-3 args"], 1); }); register ("slice", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 2: var b = args[2]; if(! b) break a; var c = b[1]; if(typeof c === "number") break a; if(1 !== c[0]) break a; var match = b[2], start = c[1], s = a[1]; if(! match){ var i$0 = Stdlib[17].call(null, 0, start | 0), o = Stdlib[17].call(null, 0, caml_ml_string_length(s) - i$0 | 0); return [2, Stdlib_String[16].call(null, s, i$0, o)]; } var d = match[1]; if(typeof d === "number") break a; if(1 !== d[0]) break a; if(match[2]) break a; var end = d[1], i = Stdlib[17].call(null, 0, start | 0), j = end | 0, sl = caml_ml_string_length(s), j$0 = Stdlib[16].call(null, j, sl), m = Stdlib[17].call(null, 0, j$0 - i | 0); return [2, Stdlib_String[16].call(null, s, i, m)]; case 5: var l = a[1]; break; case 20: var l = a[1][1]; break; default: break a; } var e = args[2]; if(e){ var f = e[1]; if(typeof f !== "number" && 1 === f[0]){ if(! e[2]){ var start$1 = f[1], i$2 = Stdlib[17].call(null, 0, start$1 | 0), n = i$2, l$1 = l; for(;;){ if(l$1){ var xs = l$1[2]; if(0 < n){var n$0 = n - 1 | 0; n = n$0; l$1 = xs; continue;} } return [5, l$1]; } } b: { if(typeof a !== "number" && 20 === a[0]){var l$0 = a[1][1]; break b;} var l$0 = a[1]; } var h = args[2], k = h[2], g = k[1]; if(typeof g !== "number" && 1 === g[0] && ! k[2]){ var end$0 = g[1], start$0 = h[1][1], i$1 = Stdlib[17].call(null, 0, start$0 | 0), j$1 = end$0 | 0, len = Stdlib_List[1].call(null, l$0), j$2 = Stdlib[16].call(null, j$1, len), take_range = function(idx$1, param$0){ var idx = idx$1, param = param$0; for(;;){ if(! param) return 0; var xs = param[2], x = param[1]; if(j$2 <= idx) return 0; if(i$1 <= idx) return [0, x, take_range(idx + 1 | 0, xs)]; var idx$0 = idx + 1 | 0; idx = idx$0; param = xs; } }; return [5, take_range(0, l$0)]; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "slice: 2-3 args"], 1); }); register ("sort", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: if(args[2]) break a; var l = a[1]; break; case 20: var b = a[1][1]; if(args[2]) break a; var l = b; break; default: break a; } return [5, Stdlib_List[59].call(null, runtime.caml_compare, l)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "sort: 1 list"], 1); }); register ("zip", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1], la = as_list(a), lb = as_list(b), l1 = la, l2 = lb, acc = 0; for(;;){ if(l1 && l2){ var ys = l2[2], y = l2[1], xs = l1[2], x = l1[1], acc$0 = [0, [5, [0, x, [0, y, 0]]], acc]; l1 = xs; l2 = ys; acc = acc$0; continue; } return [5, Stdlib_List[10].call(null, acc)]; } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "zip: 2 lists"], 1); }); register ("zip-pairs", function(args){ if(args && ! args[2]){ var v = args[1], l = as_list(v), go = function(param){ if(param){ var match = param[2]; if(match){ var rest = match[2], b = match[1], a = param[1]; return [0, [5, [0, a, [0, b, 0]]], go(rest)]; } } return 0; }; return [5, go(l)]; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "zip-pairs: 1 list"], 1); }); register ("take", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var l = a[1]; break; case 20: var l = a[1][1]; break; default: break a; } var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0] && ! b[2]){ var n = c[1], take_n = function(i, param){ if(param){ var xs = param[2], x = param[1]; if(0 < i) return [0, x, take_n(i - 1 | 0, xs)]; } return 0; }; return [5, take_n(n | 0, l)]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "take: list and number"], 1); }); register ("drop", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var l = a[1]; break; case 20: var l = a[1][1]; break; default: break a; } var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0] && ! b[2]){ var n = c[1], i$1 = n | 0, i = i$1, l$0 = l; for(;;){ if(l$0){ var xs = l$0[2]; if(0 < i){var i$0 = i - 1 | 0; i = i$0; l$0 = xs; continue;} } return [5, l$0]; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "drop: list and number"], 1); }); register ("chunk-every", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var l = a[1]; break; case 20: var l = a[1][1]; break; default: break a; } var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0] && ! b[2]){ var n = c[1], size = n | 0, go = function(l){ if(! l) return 0; function take_n(i, param){ if(param){ var xs = param[2], x = param[1]; if(0 < i) return [0, x, take_n(i - 1 | 0, xs)]; } return 0; } var i = size, l$0 = l; for(;;){ if(l$0){ var xs = l$0[2]; if(0 < i){var i$0 = i - 1 | 0; i = i$0; l$0 = xs; continue;} } var a = go(l$0); return [0, [5, take_n(size, l)], a]; } }; return [5, go(l)]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "chunk-every: list and number"], 1); }); register ("unique", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var l = a[1]; break; case 20: var l = a[1][1]; break; default: break a; } if(! args[2]){ var seen = Stdlib_Hashtbl[1].call(null, 0, 16), result = Stdlib_List[44].call (null, function(x){ var key = Sx_types[86].call(null, x); return Stdlib_Hashtbl[9].call(null, seen, key) ? 0 : (Stdlib_Hashtbl[11].call(null, seen, key, 1), 1); }, l); return [5, result]; } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "unique: 1 list"], 1); }); register (cst_dict, function(args){ var d = Sx_types[79].call(null, 0), param = args; for(;;){ if(! param) return [6, d]; var a = param[1]; if(typeof a !== "number") switch(a[0]){ case 2: var match = param[2]; if(match){ var rest = match[2], v = match[1], k = a[1]; Sx_types[82].call(null, d, k, v); param = rest; continue; } break; case 4: var match$0 = param[2]; if(match$0){ var rest$0 = match$0[2], v$0 = match$0[1], k$0 = a[1]; Sx_types[82].call(null, d, k$0, v$0); param = rest$0; continue; } break; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict: pairs of key value"], 1); } }); register ("get", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number"){ b: { switch(a[0]){ case 5: var e = args[2]; if(! e) break a; var f = e[1]; if(typeof f !== "number" && 1 === f[0]){ if(e[2]) break a; var n = f[1], l = a[1]; break b; } break; case 6: var b = args[2]; if(! b) break a; var c = b[1], d = a[1]; if(typeof c !== "number") switch(c[0]){ case 2: if(b[2]) break a; var k = c[1]; return Sx_types[80].call(null, d, k); case 4: if(b[2]) break a; var k$0 = c[1]; return Sx_types[80].call(null, d, k$0); } break; case 20: var g = args[2], o = a[1][1]; if(! g) break a; var h = g[1]; if(typeof h !== "number" && 1 === h[0]){ if(g[2]) break a; var n = h[1], l = o; break b; } break; } var j = args[2]; if(! j) break a; if(j[2]) break a; return 0; } try{var m = Stdlib_List[8].call(null, l, n | 0); return m;} catch(exn){return 0;} } var i = args[2]; if(i && ! i[2]) return 0; } return 0; }); register ("has-key?", function(args){ if(args){ var c = args[1]; if(typeof c !== "number" && 6 === c[0]){ var a = args[2]; if(a){ var b = a[1], d = c[1]; if(typeof b !== "number") switch(b[0]){ case 2: if(! a[2]){ var k = b[1]; return [0, Sx_types[81].call(null, d, k)]; } break; case 4: if(! a[2]){ var k$0 = b[1]; return [0, Sx_types[81].call(null, d, k$0)]; } break; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "has-key?: dict and key"], 1); }); register ("assoc", function(args){ if(args){ var match = args[1]; if(typeof match !== "number" && 6 === match[0]){ var rest = args[2], d = match[1], d2 = Stdlib_Hashtbl[4].call(null, d), param = rest; for(;;){ if(! param) return [6, d2]; var a = param[1]; if(typeof a !== "number") switch(a[0]){ case 2: var match$0 = param[2]; if(match$0){ var rest$0 = match$0[2], v = match$0[1], k = a[1]; Stdlib_Hashtbl[11].call(null, d2, k, v); param = rest$0; continue; } break; case 4: var match$1 = param[2]; if(match$1){ var rest$1 = match$1[2], v$0 = match$1[1], k$0 = a[1]; Stdlib_Hashtbl[11].call(null, d2, k$0, v$0); param = rest$1; continue; } break; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "assoc: pairs"], 1); } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "assoc: dict + pairs"], 1); }); register ("dissoc", function(args){ if(args){ var match = args[1]; if(typeof match !== "number" && 6 === match[0]){ var keys = args[2], d = match[1], d2 = Stdlib_Hashtbl[4].call(null, d); Stdlib_List[18].call (null, function(k){ var a = to_string(k); return Stdlib_Hashtbl[10].call(null, d2, a); }, keys); return [6, d2]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dissoc: dict + keys"], 1); }); register ("merge", function(args){ var d = Sx_types[79].call(null, 0); Stdlib_List[18].call (null, function(param){ if(typeof param !== "number" && 6 === param[0]){ var src = param[1]; return Stdlib_Hashtbl[12].call (null, function(k, v){ return Stdlib_Hashtbl[11].call(null, d, k, v); }, src); } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "merge: all args must be dicts"], 1); }, args); return [6, d]; }); register ("keys", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0] && ! args[2]){ var d = a[1]; return [5, Sx_types[84].call(null, d)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "keys: 1 dict"], 1); }); register ("vals", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0] && ! args[2]){ var d = a[1]; return [5, Sx_types[85].call(null, d)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "vals: 1 dict"], 1); }); register("mutable-list", function(args){return [20, [0, 0]];}); register ("set-nth!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 5: var e = args[2]; if(e){ var f = e[2]; if(f && ! f[2]) throw caml_maybe_attach_backtrace ([0, Sx_types[7], "set-nth!: list is immutable, use ListRef"], 1); } break; case 20: var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0]){ var d = b[2]; if(d && ! d[2]){ var v = d[1], n = c[1], r = a[1], i = n | 0, l = r[1]; r[1] = Stdlib_List[21].call (null, function(j, x){return j === i ? v : x;}, l); return 0; } } } break; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "set-nth!: expected (list idx val)"], 1); }); register ("dict-set!", function(args){ if(args){ var c = args[1]; if(typeof c !== "number" && 6 === c[0]){ var a = args[2]; if(a){ var b = a[1], d = c[1]; if(typeof b !== "number") switch(b[0]){ case 2: var e = a[2]; if(e && ! e[2]){ var v = e[1], k = b[1]; Sx_types[82].call(null, d, k, v); return v; } break; case 4: var f = a[2]; if(f && ! f[2]){ var v$0 = f[1], k$0 = b[1]; Sx_types[82].call(null, d, k$0, v$0); return v$0; } break; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict-set!: dict key val"], 1); }); register ("dict-get", function(args){ if(args){ var c = args[1]; if(typeof c !== "number" && 6 === c[0]){ var a = args[2]; if(a){ var b = a[1], d = c[1]; if(typeof b !== "number") switch(b[0]){ case 2: if(! a[2]){var k = b[1]; return Sx_types[80].call(null, d, k);} break; case 4: if(! a[2]){ var k$0 = b[1]; return Sx_types[80].call(null, d, k$0); } break; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict-get: dict and key"], 1); }); register ("dict-has?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var k = c[1], d = a[1]; return [0, Sx_types[81].call(null, d, k)]; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict-has?: dict and key"], 1); }); register ("dict-delete!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 2 === c[0] && ! b[2]){ var k = c[1], d = a[1]; Sx_types[83].call(null, d, k); return 0; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict-delete!: dict and key"], 1); }); register ("type-of", function(args){ if(args && ! args[2]){ var a = args[1]; return [2, Sx_types[35].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "type-of: 1 arg"], 1); }); register ("inspect", function(args){ if(args && ! args[2]){ var a = args[1]; return [2, Sx_types[86].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "inspect: 1 arg"], 1); }); var cst_s = "~%s", I = [2, ""], J = [0, [12, 126, [2, 0, 0]], cst_s], K = [0, [12, 126, [2, 0, 0]], cst_s], L = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], M = [0, [11, "(make-spread {", [2, 0, [11, "})", 0]]], "(make-spread {%s})"], N = [0, [11, "#<", [2, 0, [12, 62, 0]]], "#<%s>"]; register ("serialize", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 7: if(args[2]) break a; return I; case 8: if(args[2]) break a; var c = a[1], b = c[1]; return [2, caml_call1(Stdlib_Printf[4].call(null, J), b)]; case 9: if(args[2]) break a; var i = a[1], d = i[1]; return [2, caml_call1(Stdlib_Printf[4].call(null, K), d)]; case 16: if(args[2]) break a; var s = a[1]; return [2, s]; case 17: if(args[2]) break a; var pairs = a[1], dict_parts = Stdlib_List[20].call (null, function(param){ var v = param[2], k = param[1], a = Sx_types[86].call(null, v); return caml_call2(Stdlib_Printf[4].call(null, L), k, a); }, pairs), e = Stdlib_String[7].call(null, " ", dict_parts); return [2, caml_call1(Stdlib_Printf[4].call(null, M), e)]; case 18: if(args[2]) break a; var s$0 = a[1]; return [2, s$0]; case 24: if(args[2]) break a; var r = a[1], f = r[1][1]; return [2, caml_call1(Stdlib_Printf[4].call(null, N), f)]; } if(! args[2]) return [2, Sx_types[86].call(null, a)]; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "serialize: 1 arg"], 1); }); register ("make-symbol", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){var s = a[1]; return [3, s];} } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-symbol: expected string"], 1); }); var cst_error = "error"; register (cst_error, function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ if(args[2]) break a; var msg = a[1]; throw caml_maybe_attach_backtrace([0, Sx_types[7], msg], 1); } if(! args[2]){ var b = to_string(a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "error: 1 arg"], 1); }); register ("host-error", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ if(args[2]) break a; var msg = a[1]; throw caml_maybe_attach_backtrace([0, Sx_types[7], msg], 1); } if(! args[2]){ var b = to_string(a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "host-error: 1 arg"], 1); }); register ("try-catch", function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var catch_fn = a[1], try_fn = args[1]; try{ var c = caml_call2(sx_call_fn[1], try_fn, 0), d = caml_call1(sx_trampoline_fn[1], c); return d; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Sx_types[7]) throw caml_maybe_attach_backtrace(exn, 0); var msg = exn[2], b = caml_call2(sx_call_fn[1], catch_fn, [0, [2, msg], 0]); return caml_call1(sx_trampoline_fn[1], b); } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "try-catch: expected (try-fn catch-fn)"], 1); }); var is_client = [0, 0]; register("client?", function(args){return [0, is_client[1]];}); var store_registry = Stdlib_Hashtbl[1].call(null, 0, 16); register ("def-store", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b && ! b[2]){ var init_fn = b[1], name = a[1]; if(1 - Stdlib_Hashtbl[9].call(null, store_registry, name)){ var c = caml_call2(sx_call_fn[1], init_fn, 0), store = caml_call1(sx_trampoline_fn[1], c); Stdlib_Hashtbl[11].call(null, store_registry, name, store); } var match = Stdlib_Hashtbl[7].call(null, store_registry, name); if(! match) return 0; var v = match[1]; return v; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "def-store: expected (name init-fn)"], 1); }); register ("use-store", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1], match = Stdlib_Hashtbl[7].call(null, store_registry, name); if(match){var v = match[1]; return v;} var b = Stdlib[28].call(null, "Store not found: ", name); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "use-store: expected (name)"], 1); }); register ("clear-stores", function(args){Stdlib_Hashtbl[2].call(null, store_registry); return 0;}); var O = [0, 1], P = [0, 1], Q = [5, 0], R = [5, 0]; register ("resource", function(args){ var state = Stdlib_Hashtbl[1].call(null, 0, 8); Stdlib_Hashtbl[11].call(null, state, "loading", O); Stdlib_Hashtbl[11].call(null, state, "data", 0); Stdlib_Hashtbl[11].call(null, state, cst_error, 0); var sig_d = Stdlib_Hashtbl[1].call(null, 0, 8); Stdlib_Hashtbl[11].call(null, sig_d, cst_signal, P); Stdlib_Hashtbl[11].call(null, sig_d, cst_value, [6, state]); Stdlib_Hashtbl[11].call(null, sig_d, "subscribers", Q); Stdlib_Hashtbl[11].call(null, sig_d, "deps", R); return [6, sig_d]; }); register ("apply", function(args){ function call(f, a){ if(typeof f !== "number" && 14 === f[0]){ var fn = f[2]; return caml_call1(fn, a); } var b = caml_call2(sx_call_fn[1], f, a); return caml_call1(sx_trampoline_fn[1], b); } a: if(args){ var b = args[2]; if(b){ var c = b[1], f = args[1]; if(typeof c === "number"){ if(! b[2]) return call(f, 0); } else{ switch(c[0]){ case 5: var a = c[1]; break; case 20: var a = c[1][1]; break; default: break a; } if(! b[2]) return call(f, a); } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "apply: function and list"], 1); }); register ("identical?", function(args){ if(args){ var c = args[2]; if(c && ! c[2]){ var b = c[1], a = args[1]; return [0, a === b ? 1 : 0]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "identical?: 2 args"], 1); }); register ("make-spread", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0] && ! args[2]){ var d = a[1], pairs = Stdlib_Hashtbl[14].call (null, function(k, v, acc){return [0, [0, k, v], acc];}, d, 0); return [17, pairs]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-spread: 1 dict"], 1); }); var S = [0, 0], T = [0, 1]; register ("spread?", function(args){ a: if(args){ var a = args[1]; if(typeof a !== "number" && 17 === a[0]){if(args[2]) break a; return T;} if(! args[2]) return S; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "spread?: 1 arg"], 1); }); register ("spread-attrs", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 17 === a[0] && ! args[2]){ var pairs = a[1], d = Sx_types[79].call(null, 0); Stdlib_List[18].call (null, function(param){ var v = param[2], k = param[1]; return Sx_types[82].call(null, d, k, v); }, pairs); return [6, d]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "spread-attrs: 1 spread"], 1); }); function call_any(f, args){ if(typeof f !== "number" && 14 === f[0]){ var fn = f[2]; return caml_call1(fn, args); } var a = caml_call2(sx_call_fn[1], f, args); return caml_call1(sx_trampoline_fn[1], a); } var U = [5, 0]; register ("map", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return U;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]) return [5, Stdlib_List[20].call (null, function(x){return call_any(f, [0, x, 0]);}, items)]; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "map: expected (fn list)"], 1); }); var V = [5, 0]; register ("map-indexed", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return V;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]) return [5, Stdlib_List[21].call (null, function(i, x){return call_any(f, [0, [1, i], [0, x, 0]]);}, items)]; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "map-indexed: expected (fn list)"], 1); }); var W = [5, 0]; register ("filter", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return W;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]) return [5, Stdlib_List[44].call (null, function(x){ var a = call_any(f, [0, x, 0]); return Sx_types[45].call(null, a); }, items)]; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "filter: expected (fn list)"], 1); }); var X = [0, [11, "for-each: expected (fn list), got (", [2, 0, [11, ") ", [4, 0, 0, 0, [11, cst_args, 0]]]]], "for-each: expected (fn list), got (%s) %d args"]; register ("for-each", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return 0;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]){ Stdlib_List[18].call (null, function(x){call_any(f, [0, x, 0]); return 0;}, items); return 0; } } } } var c = Stdlib_List[20].call (null, function(v){return Sx_types[35].call(null, v);}, args), types = Stdlib_String[7].call(null, ", ", c), d = Stdlib_List[1].call(null, args), e = caml_call2(Stdlib_Printf[4].call(null, X), types, d); throw caml_maybe_attach_backtrace([0, Sx_types[7], e], 1); }); register ("reduce", function(args){ a: if(args){ var b = args[2]; if(b){ var c = b[2]; if(c){ var a = c[1], init = b[1], f = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var items = a[1]; break; case 20: var items = a[1][1]; break; default: break a; } if(! c[2]) return Stdlib_List[26].call (null, function(acc, x){return call_any(f, [0, acc, [0, x, 0]]);}, init, items); } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "reduce: expected (fn init list)"], 1); }); var Y = [0, 0], Z = [0, 0]; register ("some", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return Y;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]){ var param = items; for(;;){ if(! param) return Z; var rest = param[2], x = param[1], result = call_any(f, [0, x, 0]); if(Sx_types[45].call(null, result)) return result; param = rest; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "some: expected (fn list)"], 1); }); var _ = [0, 1]; register ("every?", function(args){ a: if(args){ var a = args[2]; if(a){ var b = a[1], f = args[1]; if(typeof b === "number"){if(! a[2]) return _;} else{ switch(b[0]){ case 5: var items = b[1]; break; case 20: var items = b[1][1]; break; default: break a; } if(! a[2]) return [0, Stdlib_List[33].call (null, function(x){ var a = call_any(f, [0, x, 0]); return Sx_types[45].call(null, a); }, items)]; } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "every?: expected (fn list)"], 1); }); register ("make-vm-stack", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0] && ! args[2]){ var n = a[1]; return [20, [0, Stdlib_List[11].call(null, n | 0, function(param){return 0;})]]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-vm-stack: expected (size)"], 1); }); register ("vm-stack-get", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 20 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0] && ! b[2]){ var n = c[1], r = a[1]; return Stdlib_List[8].call(null, r[1], n | 0); } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "vm-stack-get: expected (stack idx)"], 1); }); register ("vm-stack-set!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 20 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 1 === c[0]){ var d = b[2]; if(d && ! d[2]){ var v = d[1], n = c[1], r = a[1], i = n | 0; r[1] = Stdlib_List[21].call (null, function(j, x){return j === i ? v : x;}, r[1]); return 0; } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "vm-stack-set!: expected (stack idx val)"], 1); }); register ("vm-stack-length", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 20 === a[0] && ! args[2]){ var r = a[1]; return [1, Stdlib_List[1].call(null, r[1])]; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "vm-stack-length: expected (stack)"], 1); }); register ("vm-stack-copy!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 20 === a[0]){ var b = args[2]; if(b){ var c = b[1]; if(typeof c !== "number" && 20 === c[0]){ var d = b[2]; if(d){ var e = d[1]; if(typeof e !== "number" && 1 === e[0] && ! d[2]){ var n = e[1], dst = c[1], src = a[1], count = n | 0, src_items = src[1]; dst[1] = Stdlib_List[21].call (null, function(i, x){ return i < count ? Stdlib_List[8].call(null, src_items, i) : x; }, dst[1]); return 0; } } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "vm-stack-copy!: expected (src dst count)"], 1); }); var $ = [0, 0]; register ("primitive?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; return [0, Stdlib_Hashtbl[9].call(null, primitives, name)]; } } return $; }); var aa = [0, 0], ab = [0, 1]; register ("lambda?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]) return ab; } return aa; }); var ac = [0, 0], ad = [0, 1]; register ("island?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 9 === a[0] && ! args[2]) return ad; } return ac; }); var ae = [0, 0]; register ("record?", function(args){ if(args && ! args[2]){ var v = args[1]; return Sx_types[74].call(null, v); } return ae; }); register ("make-rtd", function(args){ if(args){ var a = args[2]; if(a){ var b = a[2]; if(b && ! b[2]){ var ctor_params = b[1], fields = a[1], name = args[1]; return Sx_types[69].call(null, name, fields, ctor_params); } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-rtd: expected (name fields ctor-params)"], 1); }); register ("make-record", function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var arg_list = a[1], uid = args[1]; return Sx_types[70].call(null, uid, arg_list); } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-record: expected (uid args-list)"], 1); }); register ("record-ref", function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var idx = a[1], v = args[1]; return Sx_types[71].call(null, v, idx); } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "record-ref: expected (record index)"], 1); }); register ("record-set!", function(args){ if(args){ var a = args[2]; if(a){ var b = a[2]; if(b && ! b[2]){ var nv = b[1], idx = a[1], v = args[1]; return Sx_types[72].call(null, v, idx, nv); } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "record-set!: expected (record index value)"], 1); }); var af = [0, 0]; register ("record-type?", function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var uid = a[1], v = args[1]; return Sx_types[73].call(null, v, uid); } } return af; }); register ("make-record-constructor", function(args){ if(args && ! args[2]){ var uid = args[1]; return Sx_types[75].call(null, uid); } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-record-constructor: expected (uid)"], 1); }); register ("make-record-predicate", function(args){ if(args && ! args[2]){ var uid = args[1]; return Sx_types[76].call(null, uid); } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-record-predicate: expected (uid)"], 1); }); register ("make-record-accessor", function(args){ if(args && ! args[2]){ var idx = args[1]; return Sx_types[77].call(null, idx); } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-record-accessor: expected (index)"], 1); }); register ("make-record-mutator", function(args){ if(args && ! args[2]){ var idx = args[1]; return Sx_types[78].call(null, idx); } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "make-record-mutator: expected (index)"], 1); }); var ag = [0, 0], ah = [0, 1], ai = [0, 1]; register ("is-else-clause?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 0: if(a[1] && ! args[2]) return ah; break; case 4: if(a[1] === "else" && ! args[2]) return ai; break; } } return ag; }); var aj = [0, 0]; register ("cond-scheme?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 5 === a[0] && ! args[2]){ var clauses = a[1]; return [0, Stdlib_List[33].call (null, function(c){ if(typeof c !== "number" && 5 === c[0]){ var l = c[1]; return 2 === Stdlib_List[1].call(null, l) ? 1 : 0; } return 0; }, clauses)]; } } return aj; }); var ak = [0, 0], al = [0, 1], am = [0, 1]; register ("component?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]) return al; break; case 9: if(! args[2]) return am; break; } } return ak; }); register ("lambda-closure", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]){var l = a[1]; return [19, l[3]];} } return 0; }); register ("component-closure", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]){var c = a[1]; return [19, c[5]];} break; case 9: if(! args[2]){var i = a[1]; return [19, i[5]];} break; } } return 0; }); var an = [0, 0]; register ("component-has-children?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]){var c = a[1]; return [0, c[3]];} break; case 9: if(! args[2]){var i = a[1]; return [0, i[3]];} break; } } return an; }); register ("component-name", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]){var c = a[1]; return [2, c[1]];} break; case 9: if(! args[2]){var i = a[1]; return [2, i[1]];} break; } } return 0; }); var ao = [5, 0]; register ("component-params", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]){ var c = a[1]; return [5, Stdlib_List[20].call (null, function(s){return [2, s];}, c[2])]; } break; case 9: if(! args[2]){ var i = a[1]; return [5, Stdlib_List[20].call (null, function(s){return [2, s];}, i[2])]; } break; } } return ao; }); register ("component-body", function(args){ if(args){ var a = args[1]; if(typeof a !== "number") switch(a[0]){ case 8: if(! args[2]){var c = a[1]; return c[4];} break; case 9: if(! args[2]){var i = a[1]; return i[4];} break; } } return 0; }); register ("component-file", function(args){ if(args && ! args[2]){ var v = args[1]; return Sx_types[54].call(null, v); } return 0; }); register ("component-set-file!", function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var f = a[1], v = args[1]; return Sx_types[55].call(null, v, f); } } return 0; }); var ap = [0, 0], aq = [0, 1]; register ("macro?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 10 === a[0] && ! args[2]) return aq; } return ap; }); register ("for-each-indexed", function(args){ a: if(args){ var b = args[2]; if(b){ var a = b[1], f = args[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var items = a[1]; break; case 20: var items = a[1][1]; break; default: break a; } if(! b[2]){ Stdlib_List[19].call (null, function(i, x){call_any(f, [0, [1, i], [0, x, 0]]); return 0;}, items); return 0; } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "for-each-indexed: expected (fn list)"], 1); }); var ar = [5, 0]; register ("lambda-params", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]){ var l = a[1]; return [5, Stdlib_List[20].call(null, function(s){return [2, s];}, l[1])]; } } return ar; }); register ("lambda-body", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]){var l = a[1]; return l[2];} } return 0; }); var as = [0, 1]; register ("empty-dict?", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 6 === a[0] && ! args[2]){ var d = a[1]; return [0, 0 === Stdlib_Hashtbl[15].call(null, d) ? 1 : 0]; } } return as; }); register ("make-raw-html", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){var s = a[1]; return [16, s];} } return 0; }); var at = [2, cst]; register ("raw-html-content", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 16 === a[0] && ! args[2]){var s = a[1]; return [2, s];} } return at; }); var cst_VM_undefined = "VM undefined: "; register ("get-primitive", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1], match = Stdlib_Hashtbl[7].call(null, primitives, name); if(match){var fn = match[1]; return [14, name, fn];} var b = Stdlib[28].call(null, cst_VM_undefined, name); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "get-primitive: expected (name)"], 1); }); register ("call-primitive", function(args){ a: if(args){ var d = args[1]; if(typeof d !== "number" && 2 === d[0]){ var b = args[2]; if(b){ var c = b[1], name = d[1]; if(typeof c === "number"){ if(! b[2]){ var match = Stdlib_Hashtbl[7].call(null, primitives, name); if(match){var fn = match[1]; return caml_call1(fn, 0);} var e = Stdlib[28].call(null, cst_VM_undefined, name); throw caml_maybe_attach_backtrace([0, Sx_types[7], e], 1); } } else{ switch(c[0]){ case 5: var a = c[1]; break; case 20: var a = c[1][1]; break; default: break a; } if(! b[2]){ var match$0 = Stdlib_Hashtbl[7].call(null, primitives, name); if(match$0){var fn$0 = match$0[1]; return caml_call1(fn$0, a);} var f = Stdlib[28].call(null, cst_VM_undefined, name); throw caml_maybe_attach_backtrace([0, Sx_types[7], f], 1); } } } } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "call-primitive: expected (name args-list)"], 1); }); register ("get-cookie", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1], match = Stdlib_Hashtbl[7].call(null, request_cookies, name); if(! match) return 0; var v = match[1]; return [2, v]; } } return 0; }); register("set-cookie", function(args){return 0;}); var cst_depth = " depth=", cst$0 = "->", cst_scope_push = "scope-push!", au = [0, [11, "PUSH ", [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$0, [4, 0, 0, 0, 0]]]]]], "PUSH %s depth=%d->%d"]; register (cst_scope_push, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b && ! b[2]){ var value = b[1], name = a[1]; try{ var f = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = f; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(scope_trace[1]){ var c = scope_log[1], d = Stdlib_List[1].call(null, stack) + 1 | 0, e = Stdlib_List[1].call(null, stack); scope_log[1] = [0, caml_call3(Stdlib_Printf[4].call(null, au), name, e, d), c]; } Stdlib_Hashtbl[11].call(null, scope_stacks, name, [0, value, stack]); return 0; } } } return 0; }); var cst_scope_pop = "scope-pop!", av = [0, [11, "POP ", [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$0, [4, 0, 0, 0, 0]]]]]], "POP %s depth=%d->%d"]; register (cst_scope_pop, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var f = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = f; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(scope_trace[1]){ var b = scope_log[1], c = Stdlib_List[1].call(null, stack) - 1 | 0, d = Stdlib[17].call(null, 0, c), e = Stdlib_List[1].call(null, stack); scope_log[1] = [0, caml_call3(Stdlib_Printf[4].call(null, av), name, e, d), b]; } if(stack){ var rest = stack[2]; Stdlib_Hashtbl[11].call(null, scope_stacks, name, rest); } return 0; } } return 0; }); var cst_found = " found=", aw = [0, [11, "PEEK ", [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst_found, [9, 0, 0]]]]]], "PEEK %s depth=%d found=%b"]; register ("scope-peek", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var d = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = d; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(scope_trace[1]){ var b = scope_log[1], c = Stdlib_List[1].call(null, stack); scope_log[1] = [0, caml_call3 (Stdlib_Printf[4].call(null, aw), name, c, 0 !== stack ? 1 : 0), b]; } if(! stack) return 0; var v = stack[1]; return v; } } return 0; }); var ax = [0, [11, "CTX ", [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst_found, [9, 0, 0]]]]]], "CTX %s depth=%d found=%b"]; register ("context", function(args){ if(args){ var match = args[1]; if(typeof match !== "number" && 2 === match[0]){ var rest = args[2], name = match[1]; try{ var c = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = c; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(scope_trace[1]){ var a = scope_log[1], b = Stdlib_List[1].call(null, stack); scope_log[1] = [0, caml_call3 (Stdlib_Printf[4].call(null, ax), name, b, 0 !== stack ? 1 : 0), a]; } if(stack){var v = stack[1]; return v;} if(! rest) return 0; var default_val = rest[1]; return default_val; } } return 0; }); var ay = [2, "bad args"], az = [0, [11, "name=", [2, 0, [11, " stack_len=", [4, 0, 0, 0, [11, " all_keys=[", [2, 0, [12, 93, 0]]]]]]], "name=%s stack_len=%d all_keys=[%s]"]; register ("context-debug", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var d = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = d; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } var all_keys = Stdlib_Hashtbl[14].call (null, function(k, param, acc){return [0, k, acc];}, scope_stacks, 0), b = Stdlib_String[7].call(null, ",", all_keys), c = Stdlib_List[1].call(null, stack); return [2, caml_call3(Stdlib_Printf[4].call(null, az), name, c, b)]; } } return ay; }); register ("collect!", function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b && ! b[2]){ var value = b[1], name = a[1]; try{ var d = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = d; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(stack){ var match = stack[1]; if(typeof match !== "number" && 5 === match[0]){ var rest = stack[2], items = match[1]; if(1 - Stdlib_List[37].call(null, value, items)){ var c = [0, [5, Stdlib[37].call(null, items, [0, value, 0])], rest]; Stdlib_Hashtbl[11].call(null, scope_stacks, name, c); } } } else Stdlib_Hashtbl[11].call (null, scope_stacks, name, [0, [5, [0, value, 0]], 0]); return 0; } } } return 0; }); var cst_collected = "collected", aA = [5, 0], aB = [5, 0]; register (cst_collected, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var b = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = b; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(stack){ var match = stack[1]; if(typeof match !== "number" && 5 === match[0]){var items = match[1]; return [5, items];} } return aB; } } return aA; }); var cst_clear_collected = "clear-collected!", aC = [5, 0], aD = [0, [5, 0], 0]; register (cst_clear_collected, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var b = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = b; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(stack){ var rest = stack[2]; Stdlib_Hashtbl[11].call(null, scope_stacks, name, [0, aC, rest]); } else Stdlib_Hashtbl[11].call(null, scope_stacks, name, aD); return 0; } } return 0; }); var cst_scope_emit = "scope-emit!"; register (cst_scope_emit, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0]){ var b = args[2]; if(b && ! b[2]){ var value = b[1], name = a[1]; try{ var d = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = d; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(stack){ var match = stack[1]; if(typeof match === "number"){ var rest = stack[2]; Stdlib_Hashtbl[11].call (null, scope_stacks, name, [0, [5, [0, value, 0]], rest]); } else if(5 === match[0]){ var rest$0 = stack[2], items = match[1], c = [0, [5, Stdlib[37].call(null, items, [0, value, 0])], rest$0]; Stdlib_Hashtbl[11].call(null, scope_stacks, name, c); } } else Stdlib_Hashtbl[11].call (null, scope_stacks, name, [0, [5, [0, value, 0]], 0]); return 0; } } } return 0; }); register ("emit!", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_scope_emit); if(! match) return 0; var fn = match[1]; return caml_call1(fn, args); }); var cst_emitted = "emitted", aE = [5, 0], aF = [5, 0]; register (cst_emitted, function(args){ if(args){ var a = args[1]; if(typeof a !== "number" && 2 === a[0] && ! args[2]){ var name = a[1]; try{ var b = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = b; } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); var stack = 0; } if(stack){ var match = stack[1]; if(typeof match !== "number" && 5 === match[0]){var items = match[1]; return [5, items];} } return aF; } } return aE; }); var aG = [5, 0]; register ("scope-emitted", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_emitted); if(! match) return aG; var fn = match[1]; return caml_call1(fn, args); }); var aH = [5, 0]; register ("scope-collected", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_collected); if(! match) return aH; var fn = match[1]; return caml_call1(fn, args); }); register ("scope-clear-collected!", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_clear_collected); if(! match) return 0; var fn = match[1]; return caml_call1(fn, args); }); register ("provide-push!", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_scope_push); if(! match) return 0; var fn = match[1]; return caml_call1(fn, args); }); register ("provide-pop!", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_scope_pop); if(! match) return 0; var fn = match[1]; return caml_call1(fn, args); }); runtime.caml_register_global (447, [0, primitives, sx_call_fn, sx_trampoline_fn, is_client, scope_stacks, scope_trace, scope_log, scope_trace_enable, scope_trace_disable, scope_trace_drain, request_cookies, scope_clear_all, register, is_primitive, get_primitive, trampoline_hook, as_number, as_string, as_list, as_bool, to_string], "Sx_primitives"); return; } (globalThis)); //# 6423 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_runtime:[F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(3),F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(2),F(1),F(1),F(3),F(2),F(2),F(1),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(2),F(1)*,F(1)*,F(1),F(2),F(2),F(3),F(3),F(1),F(1),F(2),F(2),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(2),F(1)*,F(2),F(1),F(1)*,F(1),F(1),F(1),F(4),F(2),F(1),F(1),F(2),F(2),F(1),N,F(2),N,N,F(1)*,F(1),F(2),F(2),F(2),F(1)*,F(2)*,F(1)*,F(1)*,F(2),F(4),F(2),F(2),F(2),F(2)*,F(1)*,N,F(2)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_string_compare = runtime.caml_string_compare; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } var global_data = runtime.caml_get_global_data(), Stdlib_String = global_data.Stdlib__String, Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib_List = global_data.Stdlib__List, Stdlib = global_data.Stdlib, Sx_types = global_data.Sx_types, Sx_primitives = global_data.Sx_primitives, Stdlib_Float = global_data.Stdlib__Float, Stdlib_Printf = global_data.Stdlib__Printf; function prim_call(name, args){ var match = Stdlib_Hashtbl[7].call(null, Sx_primitives[1], name); if(match){var f = match[1]; return caml_call1(f, args);} var a = Stdlib[28].call(null, "Unknown primitive: ", name); throw caml_maybe_attach_backtrace([0, Sx_types[7], a], 1); } var cst = "", a = [0, [8, [0, 0, 3], 0, 0, 0], "%g"]; function value_to_str(v){ if(typeof v === "number") return cst; switch(v[0]){ case 0: return v[1] ? "true" : "false"; case 1: var n = v[1]; return Stdlib_Float[18].call(null, n) ? Stdlib[33].call(null, n | 0) : caml_call1(Stdlib_Printf[4].call(null, a), n); case 2: case 3: case 4: var s = v[1]; return s; default: return Sx_types[86].call(null, v); } } function sx_to_string(v){return [2, value_to_str(v)];} function sx_str(args){ var a = Stdlib_List[20].call(null, value_to_str, args); return Stdlib_String[7].call(null, cst, a); } function sx_to_list(v){ if(typeof v === "number") return 0; switch(v[0]){ case 5: var l = v[1]; return l; case 20: var r = v[1]; return r[1]; default: var a = Sx_types[35].call(null, v), b = Stdlib[28].call(null, "Expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } function sx_call(f, args){ if(typeof f !== "number") switch(f[0]){ case 7: var l = f[1], local = Sx_types[12].call(null, l[3]); Stdlib_List[28].call (null, function(p, a){Sx_types[15].call(null, local, p, a); return 0;}, l[1], args); return [11, l[2], local]; case 12: var k = f[1]; if(args) var x = args[1], x$0 = x; else var x$0 = 0; return caml_call1(k, x$0); case 13: throw caml_maybe_attach_backtrace ([0, Sx_types[7], "callcc continuations must be invoked through the CEK machine"], 1); case 14: var fn = f[2]; return caml_call1(fn, args); case 23: var cl = f[1]; return caml_call2(Sx_types[6][1], cl, args); } var nargs = Stdlib_List[1].call(null, args); if(0 === nargs) var args_preview = cst; else var d = Stdlib_List[20].call (null, function(a){ var s = Sx_types[86].call(null, a); if(40 >= caml_ml_string_length(s)) return s; var b = Stdlib_String[16].call(null, s, 0, 40); return Stdlib[28].call(null, b, ".."); }, args), s = Stdlib_String[7].call(null, ", ", d), e = Stdlib[28].call(null, s, "]"), args_preview = Stdlib[28].call(null, " with args=[", e); var a = Sx_types[86].call(null, f), b = Stdlib[28].call(null, a, args_preview), c = Stdlib[28].call(null, "Not callable: ", b); throw caml_maybe_attach_backtrace([0, Sx_types[7], c], 1); } Sx_primitives[2][1] = sx_call; function sx_apply(f, args_list){return sx_call(f, sx_to_list(args_list));} function sx_append_b(lst, item){ if(typeof lst !== "number") switch(lst[0]){ case 5: var items = lst[1]; return [5, Stdlib[37].call(null, items, [0, item, 0])]; case 20: var r = lst[1]; r[1] = Stdlib[37].call(null, r[1], [0, item, 0]); return lst; } var a = Sx_types[35].call(null, lst), b = Stdlib[28].call(null, "append!: expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } function sx_dict_set_b(d, k, v){ if(typeof d !== "number" && 6 === d[0]){ var tbl = d[1]; if(typeof k !== "number") switch(k[0]){ case 2: case 4: var key = k[1]; Stdlib_Hashtbl[11].call(null, tbl, key, v); return v; } } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "dict-set!: expected dict and string key"], 1); } var cst_body = "body", cst_else = "else", cst_name = "name", cst_type = "type", cst_value = "value"; function get_val(container, key){ if(typeof container === "number") return 0; a: { var cst_env = "env", cst_phase = "phase"; switch(container[0]){ case 5: var l = container[1]; break; case 6: var d = container[1]; if(typeof key === "number") break a; switch(key[0]){ case 2: case 4: var k = key[1]; return Sx_types[80].call(null, d, k); default: break a; } case 20: var l = container[1][1]; break; case 21: if(typeof key === "number") break a; if(2 !== key[0]) break a; var k$0 = key[1], s = container[1]; return k$0 !== "control" ? k$0 !== cst_env ? k$0 !== "kont" ? k$0 !== cst_phase ? k$0 !== cst_value ? 0 : s[5] : [2, s[4]] : s[3] : s[2] : s[1]; case 22: if(typeof key === "number") break a; if(2 !== key[0]) break a; var k$1 = key[1], f = container[1], switch$ = caml_string_compare(k$1, "head-name"); if(0 <= switch$){ if(0 >= switch$) return f[9]; var switch$0 = caml_string_compare(k$1, "remaining"); if(0 <= switch$0){ if(0 >= switch$0) return f[5]; if(k$1 === "results") return f[8]; if(k$1 === "scheme") return f[9]; if(k$1 === "then") return f[4]; if(k$1 === cst_type) return [2, f[1]]; if(k$1 === "update-fn") return f[9]; if(k$1 === cst_value) return f[9]; } else{ if(k$1 === "ho-type") return f[9]; if(k$1 === "indexed") return f[9]; if(k$1 === "match-val") return f[9]; if(k$1 === cst_name) return f[3]; if(k$1 === cst_phase) return f[9]; if(k$1 === "raw-args") return f[8]; } } else{ var switch$1 = caml_string_compare(k$1, "evaled"); if(0 <= switch$1){ if(0 >= switch$1) return f[7]; if(k$1 === "extra") return f[9]; if(k$1 === "extra2") return f[10]; if(k$1 === "f") return f[6]; if(k$1 === "file") return f[2]; if(k$1 === "first-render") return f[10]; if(k$1 === "has-effects") return f[9]; } else{ if(k$1 === "args") return f[7]; if(k$1 === cst_body) return f[4]; if(k$1 === "current-item") return f[9]; if(k$1 === "effect-list") return f[10]; if(k$1 === cst_else) return f[3]; if(k$1 === "emitted") return f[10]; if(k$1 === cst_env) return f[2]; } } return 0; default: break a; } if(typeof key !== "number" && 1 === key[0]){ var n = key[1]; try{var a = Stdlib_List[8].call(null, l, n | 0); return a;} catch(exn){return 0;} } } return 0; } Sx_primitives[13].call (null, "get", function(args){ if(args){ var a = args[2]; if(a){ var match = a[2], k = a[1], c = args[1]; if(! match) return get_val(c, k); if(! match[2]){ var default$ = match[1]; try{ var v = get_val(c, k), default$0 = 0 === v ? default$ : v; return default$0; } catch(exn){return default$;} } } } throw caml_maybe_attach_backtrace([0, Sx_types[7], "get: 2-3 args"], 1); }); function prim(name){ var match = Stdlib_Hashtbl[7].call(null, Sx_primitives[1], name); if(! match) return function(param){ var a = Stdlib[28].call(null, "Missing prim: ", name); throw caml_maybe_attach_backtrace([0, Sx_types[7], a], 1);}; var f = match[1]; return f; } function first(args){return caml_call1(prim("first"), [0, args, 0]);} function rest(args){return caml_call1(prim("rest"), [0, args, 0]);} function last(args){return caml_call1(prim("last"), [0, args, 0]);} function nth(coll, i){ return caml_call1(prim("nth"), [0, coll, [0, i, 0]]); } function cons(x, l){return caml_call1(prim("cons"), [0, x, [0, l, 0]]);} function append(a, b){ return caml_call1(prim("append"), [0, a, [0, b, 0]]); } function reverse(l){return caml_call1(prim("reverse"), [0, l, 0]);} function flatten(l){return caml_call1(prim("flatten"), [0, l, 0]);} function concat(a, b){ return caml_call1(prim("concat"), [0, a, [0, b, 0]]); } function slice(a, b){return caml_call1(prim("slice"), [0, a, [0, b, 0]]);} function len(a){return caml_call1(prim("len"), [0, a, 0]);} function get(a, b){return get_val(a, b);} function sort(a){return caml_call1(prim("sort"), [0, a, 0]);} function range(a){return caml_call1(prim("range"), [0, a, 0]);} function unique(a){return caml_call1(prim("unique"), [0, a, 0]);} function zip(a, b){return caml_call1(prim("zip"), [0, a, [0, b, 0]]);} function take(a, b){return caml_call1(prim("take"), [0, a, [0, b, 0]]);} function drop(a, b){return caml_call1(prim("drop"), [0, a, [0, b, 0]]);} function keyword_p(a){return caml_call1(prim("keyword?"), [0, a, 0]);} function empty_p(a){return caml_call1(prim("empty?"), [0, a, 0]);} function number_p(a){return caml_call1(prim("number?"), [0, a, 0]);} function string_p(a){return caml_call1(prim("string?"), [0, a, 0]);} function boolean_p(a){return caml_call1(prim("boolean?"), [0, a, 0]);} function list_p(a){return caml_call1(prim("list?"), [0, a, 0]);} function dict_p(a){return caml_call1(prim("dict?"), [0, a, 0]);} function symbol_p(a){return caml_call1(prim("symbol?"), [0, a, 0]);} function str(args){return [2, sx_str(args)];} function upper(a){return caml_call1(prim("upper"), [0, a, 0]);} function upcase(a){return caml_call1(prim("upcase"), [0, a, 0]);} function lower(a){return caml_call1(prim("lower"), [0, a, 0]);} function downcase(a){return caml_call1(prim("downcase"), [0, a, 0]);} function trim(a){return caml_call1(prim("trim"), [0, a, 0]);} function split(a, b){return caml_call1(prim("split"), [0, a, [0, b, 0]]);} function join(a, b){return caml_call1(prim("join"), [0, a, [0, b, 0]]);} function replace(a, b, c){ return caml_call1(prim("replace"), [0, a, [0, b, [0, c, 0]]]); } function substring(a, b, c){ return caml_call1(prim("substring"), [0, a, [0, b, [0, c, 0]]]); } function assoc(d, k, v){ return caml_call1(prim("assoc"), [0, d, [0, k, [0, v, 0]]]); } function dissoc(d, k){ return caml_call1(prim("dissoc"), [0, d, [0, k, 0]]); } function merge(a, b){return caml_call1(prim("merge"), [0, a, [0, b, 0]]);} function keys(a){return caml_call1(prim("keys"), [0, a, 0]);} function vals(a){return caml_call1(prim("vals"), [0, a, 0]);} function dict_set(a, b, c){ return caml_call1(prim("dict-set!"), [0, a, [0, b, [0, c, 0]]]); } function dict_get(a, b){ return caml_call1(prim("dict-get"), [0, a, [0, b, 0]]); } function dict_delete(a, b){ return caml_call1(prim("dict-delete!"), [0, a, [0, b, 0]]); } function abs(a){return caml_call1(prim("abs"), [0, a, 0]);} function sqrt(a){return caml_call1(prim("sqrt"), [0, a, 0]);} function pow(a, b){return caml_call1(prim("pow"), [0, a, [0, b, 0]]);} function floor(a){return caml_call1(prim("floor"), [0, a, 0]);} function ceil(a){return caml_call1(prim("ceil"), [0, a, 0]);} function round(a){return caml_call1(prim("round"), [0, a, 0]);} function min(a, b){return caml_call1(prim("min"), [0, a, [0, b, 0]]);} function max(a, b){return caml_call1(prim("max"), [0, a, [0, b, 0]]);} function clamp(a, b, c){ return caml_call1(prim("clamp"), [0, a, [0, b, [0, c, 0]]]); } function error(msg){ var a = value_to_str(msg); throw caml_maybe_attach_backtrace([0, Sx_types[7], a], 1); } function inspect(v){return [2, Sx_types[86].call(null, v)];} function apply(f, args){return sx_apply(f, args);} function spread_attrs(a){ return caml_call1(prim("spread-attrs"), [0, a, 0]); } function sx_context(a, b){return prim_call("context", [0, a, [0, b, 0]]);} function trampoline(v){return v;} function type_of(v){return [2, Sx_types[35].call(null, v)];} function unwrap_env(v){ if(typeof v === "number") return Sx_types[11].call(null, 0); switch(v[0]){ case 6: var d = v[1], e = Sx_types[11].call(null, 0); Stdlib_Hashtbl[12].call (null, function(k, v){Sx_types[15].call(null, e, k, v); return 0;}, d); return e; case 19: var e$0 = v[1]; return e$0; default: var a = Sx_types[35].call(null, v), b = Stdlib[28].call(null, "Expected env, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } } function env_has(e, name){ var a = value_to_str(name), b = unwrap_env(e); return [0, Sx_types[17].call(null, b, a)]; } function env_get(e, name){ var a = value_to_str(name), b = unwrap_env(e); return Sx_types[19].call(null, b, a); } function env_bind(e, name, v){ var a = value_to_str(name), b = unwrap_env(e); return Sx_types[15].call(null, b, a, v); } function env_set(e, name, v){ var a = value_to_str(name), b = unwrap_env(e); return Sx_types[21].call(null, b, a, v); } function make_env(param){return [19, Sx_types[11].call(null, 0)];} function env_extend(e){ var a = unwrap_env(e); return [19, Sx_types[12].call(null, a)]; } function env_merge(a, b){ var c = unwrap_env(b), d = unwrap_env(a); return [19, Sx_types[22].call(null, d, c)]; } function set_lambda_name(l, n){ var a = value_to_str(n); return Sx_types[52].call(null, l, a); } function is_nil(v){return [0, Sx_types[36].call(null, v)];} function is_thunk(v){return [0, Sx_types[41].call(null, v)];} function is_lambda(v){return [0, Sx_types[37].call(null, v)];} function is_component(v){return [0, Sx_types[38].call(null, v)];} function is_island(v){return [0, Sx_types[39].call(null, v)];} function is_macro(v){return [0, Sx_types[40].call(null, v)];} function is_signal(v){return [0, Sx_types[42].call(null, v)];} function is_callable(v){return [0, Sx_types[44].call(null, v)];} function is_primitive(name){ var a = value_to_str(name); return [0, Sx_primitives[14].call(null, a)]; } function get_primitive(name){ var a = value_to_str(name); return Sx_primitives[15].call(null, a); } function for_each_indexed(fn, coll){ var a = sx_to_list(coll); Stdlib_List[19].call (null, function(i, x){sx_call(fn, [0, [1, i], [0, x, 0]]); return 0;}, a); return 0; } var b = [0, 0], c = [0, 1]; function continuation_p(v){ if(typeof v !== "number" && 12 === v[0]) return c; return b; } function make_cek_continuation(captured, rest_kont){ var data = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, data, "captured", captured); Stdlib_Hashtbl[11].call(null, data, "rest-kont", rest_kont); return [12, function(v){return v;}, [0, data]]; } function continuation_data(v){ if(typeof v !== "number" && 12 === v[0]){ var match = v[2]; if(! match) return [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; var d = match[1]; return [6, d]; } throw caml_maybe_attach_backtrace ([0, Sx_types[7], "not a continuation"], 1); } var d = [0, 0], e = [0, 1]; function callcc_continuation_p(v){ if(typeof v !== "number" && 13 === v[0]) return e; return d; } function make_callcc_continuation(captured){return [13, sx_to_list(captured)]; } function callcc_continuation_data(v){ if(typeof v !== "number" && 13 === v[0]){var frames = v[1]; return [5, frames];} throw caml_maybe_attach_backtrace ([0, Sx_types[7], "not a callcc continuation"], 1); } function host_error(msg){ var a = value_to_str(msg); throw caml_maybe_attach_backtrace([0, Sx_types[7], a], 1); } function dynamic_wind_call(before, body, after, env){ sx_call(before, 0); var result = sx_call(body, 0); sx_call(after, 0); return result; } var cst_scope_push = "scope-push!"; function scope_push(name, value){ return prim_call(cst_scope_push, [0, name, [0, value, 0]]); } var cst_scope_pop = "scope-pop!"; function scope_pop(name){return prim_call(cst_scope_pop, [0, name, 0]);} function scope_peek(name){return prim_call("scope-peek", [0, name, 0]);} function scope_emit(name, value){ return prim_call("scope-emit!", [0, name, [0, value, 0]]); } function provide_push(name, value){ return prim_call(cst_scope_push, [0, name, [0, value, 0]]); } function provide_pop(name){return prim_call(cst_scope_pop, [0, name, 0]);} var custom_special_forms = [6, Stdlib_Hashtbl[1].call(null, 0, 4)]; function register_special_form(name, handler){ if(6 !== custom_special_forms[0]) throw caml_maybe_attach_backtrace ([0, Sx_types[7], "custom_special_forms not a dict"], 1); var tbl = custom_special_forms[1], a = value_to_str(name); Stdlib_Hashtbl[11].call(null, tbl, a, handler); return handler; } var f = [0, 0], g = [0, 1]; function is_else_clause(v){ if(typeof v !== "number"){ var cst_default = "default"; switch(v[0]){ case 0: if(v[1]) return g; break; case 3: var s = v[1], a = s === cst_else ? 1 : 0, b = a || (s === cst_default ? 1 : 0); return [0, b]; case 4: var k = v[1], c = k === cst_else ? 1 : 0, d = c || (k === cst_default ? 1 : 0); return [0, d]; } } return f; } function signal_value(s){ if(typeof s !== "number") switch(s[0]){ case 6: var d = s[1], match = Stdlib_Hashtbl[7].call(null, d, cst_value); if(! match) return 0; var v = match[1]; return v; case 15: var sig = s[1]; return sig[1]; } throw caml_maybe_attach_backtrace([0, Sx_types[7], "not a signal"], 1); } var cst_subscribers = "subscribers"; function signal_add_sub_b(s, f){ if(typeof s !== "number" && 6 === s[0]){ var d = s[1], match = Stdlib_Hashtbl[7].call(null, d, cst_subscribers); if(match){ var match$0 = match[1]; if(typeof match$0 !== "number") switch(match$0[0]){ case 5: var items = match$0[1], a = [20, [0, Stdlib[37].call(null, items, [0, f, 0])]]; Stdlib_Hashtbl[11].call(null, d, cst_subscribers, a); return 0; case 20: var r = match$0[1]; r[1] = Stdlib[37].call(null, r[1], [0, f, 0]); return 0; } } Stdlib_Hashtbl[11].call(null, d, cst_subscribers, [20, [0, [0, f, 0]]]); return 0; } return 0; } function signal_remove_sub_b(s, f){ if(typeof s !== "number" && 6 === s[0]){ var d = s[1], match = Stdlib_Hashtbl[7].call(null, d, cst_subscribers); if(match){ var match$0 = match[1]; if(typeof match$0 !== "number") switch(match$0[0]){ case 5: var items = match$0[1], a = [5, Stdlib_List[44].call (null, function(x){return x !== f ? 1 : 0;}, items)]; Stdlib_Hashtbl[11].call(null, d, cst_subscribers, a); return 0; case 20: var r = match$0[1]; r[1] = Stdlib_List[44].call (null, function(x){return x !== f ? 1 : 0;}, r[1]); return 0; } } return 0; } return 0; } function with_island_scope(register_fn, body_fn){ if(typeof body_fn !== "number" && 14 === body_fn[0]){var f = body_fn[2]; return caml_call1(f, 0);} return 0; } function register_in_scope(dispose_fn){return 0;} function component_set_param_types_b(comp, types){return 0;} var h = [5, [0, [5, 0], [0, 0, [0, [0, 0], 0]]]]; function parse_comp_params(params){return h;} var i = [5, [0, [5, 0], [0, 0, 0]]]; function parse_macro_params(params){return i;} var j = [0, [5, 0], 0]; function parse_keyword_args(raw_args, env){ return [5, [0, [6, Stdlib_Hashtbl[1].call(null, 0, 0)], j]]; } var k = [2, "handler"]; function make_handler_def(name, params, body, env){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d, cst_type, k); Stdlib_Hashtbl[11].call(null, d, cst_name, name); Stdlib_Hashtbl[11].call(null, d, "params", params); Stdlib_Hashtbl[11].call(null, d, cst_body, body); return [6, d]; } var l = [2, "page"]; function make_page_def(name, opts){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d, cst_type, l); Stdlib_Hashtbl[11].call(null, d, cst_name, name); return [6, d]; } var m = [1, 1.]; function sf_defhandler(args, env){ var name = first(args), rest_args = rest(args), a = nth(rest_args, m); return make_handler_def(name, first(rest_args), a, env); } function strip_prefix(s, prefix){ if (typeof s !== "number" && 2 === s[0] && typeof prefix !== "number" && 2 === prefix[0]){ var p = prefix[1], s$0 = s[1], pl = caml_ml_string_length(p); if (pl <= caml_ml_string_length(s$0) && Stdlib_String[16].call(null, s$0, 0, pl) === p) return [2, Stdlib_String[16].call (null, s$0, pl, caml_ml_string_length(s$0) - pl | 0)]; return [2, s$0]; } return s; } function debug_log(a, param){return 0;} function mutable_list(param){return [20, [0, 0]];} var jit_try_call_fn = [0, 0]; function jit_try_call(f, args){ var match = jit_try_call_fn[1]; if(! match) return 0; var hook = match[1]; if(typeof f !== "number" && 7 === f[0]){ var l = f[1]; if(0 !== l[4]){ a: { if(typeof args !== "number") switch(args[0]){ case 5: var arg_list = args[1]; break a; case 20: var arg_list = args[1][1]; break a; } var arg_list = 0; } var match$0 = caml_call2(hook, f, arg_list); if(! match$0) return 0; var result = match$0[1]; return result; } } return 0; } runtime.caml_register_global (154, [0, prim_call, value_to_str, sx_to_string, sx_str, sx_to_list, sx_call, sx_apply, sx_append_b, sx_dict_set_b, get_val, prim, first, rest, last, nth, cons, append, reverse, flatten, concat, slice, len, get, sort, range, unique, zip, take, drop, keyword_p, empty_p, number_p, string_p, boolean_p, list_p, dict_p, symbol_p, str, upper, upcase, lower, downcase, trim, split, join, replace, substring, assoc, dissoc, merge, keys, vals, dict_set, dict_get, dict_delete, abs, sqrt, pow, floor, ceil, round, min, max, clamp, error, inspect, apply, spread_attrs, sx_context, trampoline, type_of, unwrap_env, env_has, env_get, env_bind, env_set, make_env, env_extend, env_merge, set_lambda_name, is_nil, is_thunk, is_lambda, is_component, is_island, is_macro, is_signal, is_callable, is_primitive, get_primitive, for_each_indexed, continuation_p, make_cek_continuation, continuation_data, callcc_continuation_p, make_callcc_continuation, callcc_continuation_data, host_error, dynamic_wind_call, scope_push, scope_pop, scope_peek, scope_emit, provide_push, provide_pop, custom_special_forms, register_special_form, 0, 0, is_else_clause, signal_value, signal_add_sub_b, signal_remove_sub_b, with_island_scope, register_in_scope, component_set_param_types_b, parse_comp_params, parse_macro_params, parse_keyword_args, make_handler_def, make_page_def, sf_defhandler, strip_prefix, debug_log, mutable_list, jit_try_call_fn, jit_try_call], "Sx_runtime"); return; } (globalThis)); //# 7233 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_ref:[N,F(1),N,N,N,F(3)*,F(3)*,F(3),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3)*,F(2)*,F(2)*,F(4)*,F(4)*,F(2)*,F(6)*,F(3)*,F(3)*,F(2)*,F(3)*,F(2)*,F(3),F(4)*,F(4)*,F(4)*,F(5)*,F(3)*,F(3)*,F(3)*,F(3)*,F(3)*,F(4)*,F(4)*,F(1)*,F(3)*,F(2)*,F(2)*,F(4)*,F(3)*,F(1)*,F(1)*,F(4)*,F(2)*,F(1),F(3)*,F(3)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(3)*,F(2),F(2),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(1),F(1),N,F(2),N,N,N,F(1),F(1),F(1),F(2),N,F(2),F(1),F(1),F(1),F(3),N,F(1),N,F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(1),F(1),F(2),F(2),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(3),F(2),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(2),F(3),F(3),F(2),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(2),F(3),F(4),F(1),F(1)*,F(2),F(4),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1),F(5),F(4),F(2),F(1),F(2),F(1),F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_equal = runtime.caml_equal, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_trampoline = runtime.caml_trampoline, caml_trampoline_return = runtime.caml_trampoline_return, caml_update_dummy = runtime.caml_update_dummy, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } var global_data = runtime.caml_get_global_data(), Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Sx_runtime = global_data.Sx_runtime, Sx_types = global_data.Sx_types, Stdlib_List = global_data.Stdlib__List, Stdlib = global_data.Stdlib, Stdlib_String = global_data.Stdlib__String, Sx_primitives = global_data.Sx_primitives, trampoline_fn = [0, function(v){return v;}]; function trampoline(v){return caml_call1(trampoline_fn[1], v);} var strict_ref = [0, [0, 0]], strict = strict_ref[1], prim_param_types_ref = [0, 0], prim_param_types = prim_param_types_ref[1], cst_eval = "eval"; function make_cek_state(control, env, kont){ return [21, [0, control, env, kont, cst_eval, 0]]; } var cst_continue = "continue"; function make_cek_value(value, env, kont){ return [21, [0, 0, env, kont, cst_continue, value]]; } var cst_env = "env", cst_io_suspended = "io-suspended", cst_kont = "kont", cst_phase = "phase", cst_request = "request", b = [2, cst_io_suspended]; function make_cek_suspended(request, env, kont){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d, cst_env, env); Stdlib_Hashtbl[11].call(null, d, cst_kont, kont); Stdlib_Hashtbl[11].call(null, d, cst_phase, b); Stdlib_Hashtbl[11].call(null, d, cst_request, request); return [6, d]; } var cst = "=", c = [0, [2, cst_continue], 0], d = [2, cst_phase], e = [2, cst_kont]; function cek_terminal_p(state){ var a = [0, Sx_runtime[23].call(null, state, d), c], and = Sx_runtime[1].call(null, cst, a); if(! Sx_types[45].call(null, and)) return and; var b = Sx_runtime[23].call(null, state, e); return Sx_runtime[31].call(null, b); } var f = [0, [2, cst_io_suspended], 0], g = [2, cst_phase]; function cek_suspended_p(state){ var a = [0, Sx_runtime[23].call(null, state, g), f]; return Sx_runtime[1].call(null, cst, a); } var h = [2, "control"]; function cek_control(s){return Sx_runtime[23].call(null, s, h);} var i = [2, cst_env]; function cek_env(s){return Sx_runtime[23].call(null, s, i);} var j = [2, cst_kont]; function cek_kont(s){return Sx_runtime[23].call(null, s, j);} var k = [2, cst_phase]; function cek_phase(s){return Sx_runtime[23].call(null, s, k);} var l = [2, cst_request]; function cek_io_request(s){return Sx_runtime[23].call(null, s, l);} var cst_value = "value", m = [2, cst_value]; function cek_value(s){return Sx_runtime[23].call(null, s, m);} var cst_if = "if"; function make_if_frame(then_expr, else_expr, env){ return [22, [0, cst_if, env, else_expr, then_expr, 0, 0, 0, 0, 0, 0]]; } var cst_when = "when"; function make_when_frame(body_exprs, env){ return [22, [0, cst_when, env, 0, body_exprs, 0, 0, 0, 0, 0, 0]]; } var cst_begin = "begin"; function make_begin_frame(remaining, env){ return [22, [0, cst_begin, env, 0, 0, remaining, 0, 0, 0, 0, 0]]; } var cst_let = "let"; function make_let_frame(name, remaining, body, local){ return [22, [0, cst_let, local, name, body, remaining, 0, 0, 0, 0, 0]]; } var cst_define = "define"; function make_define_frame(name, env, has_effects, effect_list){ return [22, [0, cst_define, env, name, 0, 0, 0, 0, 0, has_effects, effect_list]]; } var cst_set = "set"; function make_set_frame(name, env){ return [22, [0, cst_set, env, name, 0, 0, 0, 0, 0, 0, 0]]; } var cst_arg = "arg"; function make_arg_frame(f, evaled, remaining, env, raw_args, head_name){ var head_name$0 = Sx_types[45].call(null, head_name) ? head_name : 0; return [22, [0, cst_arg, env, 0, 0, remaining, f, evaled, raw_args, head_name$0, 0]]; } function make_call_frame(f, args, env){ return [22, [0, "call", env, 0, 0, 0, f, args, 0, 0, 0]]; } var cst_cond = "cond"; function make_cond_frame(remaining, env, scheme_p){ return [22, [0, cst_cond, env, 0, 0, remaining, 0, 0, 0, scheme_p, 0]]; } var cst_cond_arrow = "cond-arrow"; function make_cond_arrow_frame(test_value, env){ return [22, [0, cst_cond_arrow, env, 0, 0, 0, 0, 0, 0, test_value, 0]]; } var cst_case = "case"; function make_case_frame(match_val, remaining, env){ return [22, [0, cst_case, env, 0, 0, remaining, 0, 0, 0, match_val, 0]]; } var cst_thread = "thread"; function make_thread_frame(remaining, env){ return [22, [0, cst_thread, env, 0, 0, remaining, 0, 0, 0, 0, 0]]; } var cst_list = "list", cst_quote = "quote", n = [0, [2, cst_list], 0], o = [3, cst_quote], p = [3, cst_quote]; function thread_insert_arg(form, value, fenv){ var a = [0, Sx_runtime[71].call(null, form), n], b = Sx_runtime[1].call(null, cst, a); if(! Sx_types[45].call(null, b)) return eval_expr ([5, [0, form, [0, [5, [0, p, [0, value, 0]]], 0]]], fenv); var c = Sx_runtime[13].call(null, form), d = Sx_runtime[16].call(null, [5, [0, o, [0, value, 0]]], c), e = Sx_runtime[12].call(null, form); return eval_expr(Sx_runtime[16].call(null, e, d), fenv); } var cst_map = "map", q = [0, 0]; function make_map_frame(f, remaining, results, env){ return [22, [0, cst_map, env, 0, 0, remaining, f, 0, results, q, 0]]; } var r = [0, 1]; function make_map_indexed_frame(f, remaining, results, env){ return [22, [0, cst_map, env, 0, 0, remaining, f, 0, results, r, 0]]; } var cst_multi_map = "multi-map"; function make_multi_map_frame(f, remaining_lists, results, env){ return [22, [0, cst_multi_map, env, 0, 0, remaining_lists, f, 0, results, 0, 0]]; } var cst_filter = "filter"; function make_filter_frame(f, remaining, results, current_item, env){ return [22, [0, cst_filter, env, 0, 0, remaining, f, 0, results, current_item, 0]]; } var cst_reduce = "reduce"; function make_reduce_frame(f, remaining, env){ return [22, [0, cst_reduce, env, 0, 0, remaining, f, 0, 0, 0, 0]]; } var cst_for_each = "for-each"; function make_for_each_frame(f, remaining, env){ return [22, [0, cst_for_each, env, 0, 0, remaining, f, 0, 0, 0, 0]]; } var cst_some = "some"; function make_some_frame(f, remaining, env){ return [22, [0, cst_some, env, 0, 0, remaining, f, 0, 0, 0, 0]]; } var cst_every = "every"; function make_every_frame(f, remaining, env){ return [22, [0, cst_every, env, 0, 0, remaining, f, 0, 0, 0, 0]]; } var cst_scope = "scope"; function make_scope_frame(name, remaining, env){ return [22, [0, cst_scope, env, name, 0, remaining, 0, 0, 0, 0, 0]]; } var cst_provide = "provide"; function make_provide_frame(name, value, remaining, env){ return [22, [0, cst_provide, env, name, 0, remaining, 0, 0, 0, value, 0]]; } var cst_scope_acc = "scope-acc", s = [5, 0]; function make_scope_acc_frame(name, value, remaining, env){ var value$0 = Sx_types[45].call(null, value) ? value : 0; return [22, [0, cst_scope_acc, env, name, 0, remaining, 0, 0, 0, value$0, s]]; } var cst_reset = "reset"; function make_reset_frame(env){ return [22, [0, cst_reset, env, 0, 0, 0, 0, 0, 0, 0, 0]]; } var cst_dict = "dict"; function make_dict_frame(remaining, results, env){ return [22, [0, cst_dict, env, 0, 0, remaining, 0, 0, results, 0, 0]]; } var cst_and = "and"; function make_and_frame(remaining, env){ return [22, [0, cst_and, env, 0, 0, remaining, 0, 0, 0, 0, 0]]; } var cst_or = "or"; function make_or_frame(remaining, env){ return [22, [0, cst_or, env, 0, 0, remaining, 0, 0, 0, 0, 0]]; } var cst_dynamic_wind = "dynamic-wind"; function make_dynamic_wind_frame(phase, body_thunk, after_thunk, env){return [22, [0, cst_dynamic_wind, env, 0, 0, 0, 0, 0, 0, phase, 0]]; } var cst_reactive_reset = "reactive-reset"; function make_reactive_reset_frame(env, update_fn, first_render_p){ return [22, [0, cst_reactive_reset, env, 0, 0, 0, 0, 0, 0, update_fn, first_render_p]]; } var cst_callcc = "callcc"; function make_callcc_frame(env){ return [22, [0, cst_callcc, env, 0, 0, 0, 0, 0, 0, 0, 0]]; } var cst_deref = "deref"; function make_deref_frame(env){ return [22, [0, cst_deref, env, 0, 0, 0, 0, 0, 0, 0, 0]]; } var cst_ho_setup = "ho-setup"; function make_ho_setup_frame(ho_type, remaining_args, evaled_args, env){ return [22, [0, cst_ho_setup, env, 0, 0, remaining_args, 0, evaled_args, 0, ho_type, 0]]; } var cst_comp_trace = "comp-trace"; function make_comp_trace_frame(name, file){ return [22, [0, cst_comp_trace, file, name, 0, 0, 0, 0, 0, 0, 0]]; } var cst_file = "file", cst_name = "name", t = [5, 0], u = [0, [2, cst_comp_trace], 0], v = [2, cst_file], w = [2, cst_name]; function kont_collect_comp_trace(kont$1){ var kont = kont$1; for(;;){ var a = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, a)) return t; var frame = Sx_runtime[12].call(null, kont), b = [0, frame_type(frame), u], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)){ var e = kont_collect_comp_trace(Sx_runtime[13].call(null, kont)), d = Stdlib_Hashtbl[1].call(null, 0, 2), f = Sx_runtime[23].call(null, frame, v); Stdlib_Hashtbl[11].call(null, d, cst_file, f); var g = Sx_runtime[23].call(null, frame, w); Stdlib_Hashtbl[11].call(null, d, cst_name, g); return Sx_runtime[16].call(null, [6, d], e); } var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } } var cst_handler = "handler"; function make_handler_frame(handlers, remaining, env){ return [22, [0, cst_handler, env, 0, 0, remaining, handlers, 0, 0, 0, 0]]; } var cst_restart = "restart"; function make_restart_frame(restarts, remaining, env){ return [22, [0, cst_restart, env, 0, 0, remaining, restarts, 0, 0, 0, 0]]; } var cst_signal_return = "signal-return"; function make_signal_return_frame(env, saved_kont){ return [22, [0, cst_signal_return, env, 0, 0, 0, saved_kont, 0, 0, 0, 0]]; } var cst_raise_eval = "raise-eval"; function make_raise_eval_frame(env, continuable_p){ return [22, [0, cst_raise_eval, env, 0, 0, 0, 0, 0, 0, continuable_p, 0]]; } var cst_raise_guard = "raise-guard"; function make_raise_guard_frame(env, saved_kont){ return [22, [0, cst_raise_guard, env, 0, 0, saved_kont, 0, 0, 0, 0, 0]]; } var cst_perform = "perform"; function make_perform_frame(env){ return [22, [0, cst_perform, env, 0, 0, 0, 0, 0, 0, 0, 0]]; } var cst_vm_resume = "vm-resume"; function make_vm_resume_frame(resume_fn, env){ return [22, [0, cst_vm_resume, env, 0, 0, 0, resume_fn, 0, 0, 0, 0]]; } var cst_import = "import"; function make_import_frame(import_set, remaining_sets, env){ return [22, [0, cst_import, env, 0, 0, remaining_sets, 0, import_set, 0, 0, 0]]; } var x = [1, 1.]; function find_matching_handler(handlers$1, condition){ var handlers = handlers$1; for(;;){ var a = Sx_runtime[31].call(null, handlers); if(Sx_types[45].call(null, a)) return 0; var pair = Sx_runtime[12].call(null, handlers), pred = Sx_runtime[12].call(null, pair), handler_fn = Sx_runtime[15].call(null, pair, x), b = cek_call(pred, [5, [0, condition, 0]]); if(Sx_types[45].call(null, b)) return handler_fn; var handlers$0 = Sx_runtime[13].call(null, handlers); handlers = handlers$0; } } var cst_f = "f", y = [0, [2, cst_handler], 0], z = [2, cst_f]; function kont_find_handler(kont$2, condition){ var kont = kont$2; for(;;){ var a = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, a)) return 0; var frame = Sx_runtime[12].call(null, kont), b = [0, frame_type(frame), y], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)){ var match = find_matching_handler(Sx_runtime[23].call(null, frame, z), condition), d = Sx_runtime[81].call(null, match); if(! Sx_types[45].call(null, d)) return match; var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } else{var kont$1 = Sx_runtime[13].call(null, kont); kont = kont$1;} } } function find_named_restart(restarts$1, name){ var restarts = restarts$1; for(;;){ var a = Sx_runtime[31].call(null, restarts); if(Sx_types[45].call(null, a)) return 0; var entry = Sx_runtime[12].call(null, restarts), b = [0, Sx_runtime[12].call(null, entry), [0, name, 0]], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)) return entry; var restarts$0 = Sx_runtime[13].call(null, restarts); restarts = restarts$0; } } var A = [0, [2, cst_restart], 0], B = [2, cst_f]; function kont_find_restart(kont$2, name){ var kont = kont$2; for(;;){ var a = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, a)) return 0; var frame = Sx_runtime[12].call(null, kont), b = [0, frame_type(frame), A], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)){ var match = find_named_restart(Sx_runtime[23].call(null, frame, B), name), d = Sx_runtime[81].call(null, match); if(! Sx_types[45].call(null, d)) return [5, [0, match, [0, frame, [0, Sx_runtime[13].call(null, kont), 0]]]]; var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } else{var kont$1 = Sx_runtime[13].call(null, kont); kont = kont$1;} } } var cst_type = "type", C = [2, cst_type]; function frame_type(f){return Sx_runtime[23].call(null, f, C);} function kont_push(frame, kont){ return Sx_runtime[16].call(null, frame, kont); } function kont_top(kont){return Sx_runtime[12].call(null, kont);} function kont_pop(kont){return Sx_runtime[13].call(null, kont);} function kont_empty_p(kont){return Sx_runtime[31].call(null, kont);} var cst_append = "append", captured = [5, 0], D = [2, "shift without enclosing reset"], E = [0, [2, cst_reset], 0], F = [0, [2, cst_reactive_reset], 0]; function kont_capture_to_reset(kont){ var k = kont, captured$0 = captured; for(;;){ var a = Sx_runtime[31].call(null, k); if(Sx_types[45].call(null, a)){ var b = Sx_runtime[2].call(null, D); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } var frame = Sx_runtime[12].call(null, k), c = [0, frame_type(frame), E], or = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, or)) var or$0 = or; else var d = [0, frame_type(frame), F], or$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, or$0)) return [5, [0, captured$0, [0, Sx_runtime[13].call(null, k), 0]]]; var captured$1 = Sx_runtime[1].call (null, cst_append, [0, captured$0, [0, [5, [0, frame, 0]], 0]]), k$0 = Sx_runtime[13].call(null, k); k = k$0; captured$0 = captured$1; } } var G = [0, [2, cst_provide], 0], H = [2, cst_name]; function kont_find_provide(kont$1, name){ var kont = kont$1; for(;;){ var b = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, b)) return 0; var frame = Sx_runtime[12].call(null, kont), c = [0, frame_type(frame), G], and = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and)) var d = [0, Sx_runtime[23].call(null, frame, H), [0, name, 0]], a = Sx_runtime[1].call(null, cst, d); else var a = and; if(Sx_types[45].call(null, a)) return frame; var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } } var I = [0, [2, cst_scope_acc], 0], J = [2, cst_name]; function kont_find_scope_acc(kont$1, name){ var kont = kont$1; for(;;){ var b = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, b)) return 0; var frame = Sx_runtime[12].call(null, kont), c = [0, frame_type(frame), I], and = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and)) var d = [0, Sx_runtime[23].call(null, frame, J), [0, name, 0]], a = Sx_runtime[1].call(null, cst, d); else var a = and; if(Sx_types[45].call(null, a)) return frame; var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } } var K = [0, 0], L = [0, [2, cst_reactive_reset], 0], M = [0, 1]; function has_reactive_reset_frame_p(kont$1){ var kont = kont$1; for(;;){ var a = Sx_runtime[31].call(null, kont); if(Sx_types[45].call(null, a)) return K; var b = [0, frame_type(Sx_runtime[12].call(null, kont)), L], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)) return M; var kont$0 = Sx_runtime[13].call(null, kont); kont = kont$0; } } var captured$0 = [5, 0], N = [2, "reactive deref without enclosing reactive-reset"], O = [0, [2, cst_reactive_reset], 0]; function kont_capture_to_reactive_reset(kont){ var k = kont, captured = captured$0; for(;;){ var a = Sx_runtime[31].call(null, k); if(Sx_types[45].call(null, a)){ var b = Sx_runtime[2].call(null, N); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } var frame = Sx_runtime[12].call(null, k), c = [0, frame_type(frame), O], d = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, d)) return [5, [0, captured, [0, frame, [0, Sx_runtime[13].call(null, k), 0]]]]; var captured$1 = Sx_runtime[1].call (null, cst_append, [0, captured, [0, [5, [0, frame, 0]], 0]]), k$0 = Sx_runtime[13].call(null, k); k = k$0; captured = captured$1; } } var custom_special_forms = []; function register_special_form(name, handler){ return Sx_runtime[9].call(null, custom_special_forms, name, handler); } var P = [2, "."]; function library_name_key(spec){ var a = Sx_runtime[5].call(null, spec), b = [0, P, [0, [5, Stdlib_List[20].call (null, function(s){ var a = Sx_runtime[37].call(null, s); return Sx_types[45].call(null, a) ? Sx_types[46].call(null, s) : [2, Sx_runtime[4].call(null, [0, s, 0])]; }, a)], 0]]; return Sx_runtime[1].call(null, "join", b); } var cst_has_key = "has-key?", library_registry = []; function library_loaded_p(spec){ var a = [0, library_registry, [0, library_name_key(spec), 0]]; return Sx_runtime[1].call(null, cst_has_key, a); } var cst_exports = "exports", Q = [2, cst_exports]; function library_exports(spec){ var a = library_name_key(spec), b = Sx_runtime[23].call(null, library_registry, a); return Sx_runtime[23].call(null, b, Q); } function register_library(spec, exports){ var d = Stdlib_Hashtbl[1].call(null, 0, 1); Stdlib_Hashtbl[11].call(null, d, cst_exports, exports); var a = library_name_key(spec); return Sx_runtime[9].call(null, library_registry, a, [6, d]); } var io_registry = []; function io_register_b(name, spec){ return Sx_runtime[9].call(null, io_registry, name, spec); } function io_registered_p(name){ return Sx_runtime[1].call (null, cst_has_key, [0, io_registry, [0, name, 0]]); } function io_lookup(name){ return Sx_runtime[23].call(null, io_registry, name); } var cst_keys = "keys"; function io_names(param){ return Sx_runtime[1].call(null, cst_keys, [0, io_registry, 0]); } var cst_args = "args", cst_op = "op", R = [0, [2, "' \xe2\x80\x94 not in *io-registry*"], 0], S = [2, "io: unknown operation '"], T = [3, cst_perform]; function step_sf_io(args, env, kont){ var name = Sx_runtime[12].call(null, args), io_args = Sx_runtime[13].call(null, args), a = io_registered_p(name), b = [0, 1 - Sx_types[45].call(null, a)]; if(Sx_types[45].call(null, b)){ var c = [2, Sx_runtime[4].call(null, [0, S, [0, name, R]])], e = Sx_runtime[2].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[7], e], 1); } var d = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d, cst_args, io_args); Stdlib_Hashtbl[11].call(null, d, cst_op, name); return make_cek_state (Sx_runtime[16].call(null, T, [5, [0, [6, d], 0]]), env, kont); } function set_strict_b(val){strict_ref[1] = val; return 0;} function set_prim_param_types_b(types){ prim_param_types_ref[1] = types; return 0; } var cst$1 = "-", cst$0 = "?", cst_boolean = "boolean", cst_ends_with = "ends-with?", cst_keyword = "keyword", cst_lambda = "lambda", cst_nil = "nil", cst_number = "number", cst_slice = "slice", cst_string = "string", cst_symbol = "symbol", U = [0, [2, "any"], 0], V = [0, 1], W = [0, [2, cst_number], 0], X = [0, [2, cst_string], 0], Y = [0, [2, cst_boolean], 0], Z = [0, [2, cst_nil], 0], _ = [0, [2, cst_list], 0], $ = [0, [2, cst_dict], 0], aa = [0, [2, cst_lambda], 0], ab = [0, [2, cst_symbol], 0], ac = [0, [2, cst_symbol], 0], ad = [0, [2, cst_keyword], 0], ae = [0, [2, cst_keyword], 0], af = [0, [2, cst$0], 0], ag = [0, [1, 1.], 0], ah = [1, 0.], ai = [0, 1]; function value_matches_type_p(val, expected_type$1){ var expected_type = expected_type$1; for(;;){ var a = Sx_runtime[1].call(null, cst, [0, expected_type, U]); if(Sx_types[45].call(null, a)) return V; var b = Sx_runtime[1].call(null, cst, [0, expected_type, W]); if(Sx_types[45].call(null, b)) return Sx_runtime[32].call(null, val); var c = Sx_runtime[1].call(null, cst, [0, expected_type, X]); if(Sx_types[45].call(null, c)) return Sx_runtime[33].call(null, val); var d = Sx_runtime[1].call(null, cst, [0, expected_type, Y]); if(Sx_types[45].call(null, d)) return Sx_runtime[34].call(null, val); var e = Sx_runtime[1].call(null, cst, [0, expected_type, Z]); if(Sx_types[45].call(null, e)) return Sx_runtime[81].call(null, val); var f = Sx_runtime[1].call(null, cst, [0, expected_type, _]); if(Sx_types[45].call(null, f)) return Sx_runtime[35].call(null, val); var g = Sx_runtime[1].call(null, cst, [0, expected_type, $]); if(Sx_types[45].call(null, g)) return Sx_runtime[36].call(null, val); var h = Sx_runtime[1].call(null, cst, [0, expected_type, aa]); if(Sx_types[45].call(null, h)) return Sx_runtime[83].call(null, val); var i = Sx_runtime[1].call(null, cst, [0, expected_type, ab]); if(Sx_types[45].call(null, i)){ var j = [0, Sx_runtime[71].call(null, val), ac]; return Sx_runtime[1].call(null, cst, j); } var k = Sx_runtime[1].call(null, cst, [0, expected_type, ad]); if(Sx_types[45].call(null, k)){ var l = [0, Sx_runtime[71].call(null, val), ae]; return Sx_runtime[1].call(null, cst, l); } var and = Sx_runtime[33].call(null, expected_type), m = Sx_types[45].call(null, and) ? Sx_runtime[1].call(null, cst_ends_with, [0, expected_type, af]) : and; if(! Sx_types[45].call(null, m)) return ai; var or = Sx_runtime[81].call(null, val); if(Sx_types[45].call(null, or)) return or; var n = [0, Sx_runtime[1].call(null, "string-length", [0, expected_type, 0]), ag], o = [0, expected_type, [0, ah, [0, Sx_runtime[1].call(null, cst$1, n), 0]]], expected_type$0 = Sx_runtime[1].call(null, cst_slice, o); expected_type = expected_type$0; } } var cst$3 = " (", cst_expected = " expected ", cst$2 = ")", cst_got = ", got ", cst$4 = "<", cst$5 = ">", cst_Type_error = "Type error: ", aj = [2, "positional"], ak = [2, "rest-type"], al = [1, 1.], am = [1, 1.], an = [0, [2, cst$2], 0], ao = [2, cst$3], ap = [2, cst_got], aq = [2, " for param "], ar = [2, cst_expected], as = [2, cst_Type_error], at = [1, 1.], au = [0, [2, cst$2], 0], av = [2, cst$3], aw = [2, cst_got], ax = [2, " for rest arg "], ay = [2, cst_expected], az = [2, cst_Type_error], aA = [5, 0], aB = [5, 0]; function strict_check_args(name, args){ var and = strict_ref[1], b = Sx_types[45].call(null, and) ? prim_param_types_ref[1] : and; if(! Sx_types[45].call(null, b)) return 0; var spec = Sx_runtime[23].call(null, prim_param_types_ref[1], name); if(! Sx_types[45].call(null, spec)) return 0; var positional = Sx_runtime[23].call(null, spec, aj), rest_type = Sx_runtime[23].call(null, spec, ak); if(Sx_types[45].call(null, positional)){ var c = Sx_runtime[5].call(null, positional), d = [5, Stdlib_List[21].call (null, function(i, p){var i$0 = [1, i]; return [5, [0, i$0, [0, p, 0]]];}, c)], e = Sx_runtime[5].call(null, d); Stdlib_List[18].call (null, function(pair){ var idx = Sx_runtime[12].call(null, pair), param = Sx_runtime[15].call(null, pair, al), p_name = Sx_runtime[12].call(null, param), p_type = Sx_runtime[15].call(null, param, am), a = [0, idx, [0, Sx_runtime[22].call(null, args), 0]], b = Sx_runtime[1].call(null, cst$4, a); if(Sx_types[45].call(null, b)){ var val = Sx_runtime[15].call(null, args, idx), c = value_matches_type_p(val, p_type), d = [0, 1 - Sx_types[45].call(null, c)]; if(Sx_types[45].call(null, d)){ var e = [0, ao, [0, [2, Sx_runtime[4].call(null, [0, val, 0])], an]], f = [0, as, [0, name, [0, ar, [0, p_type, [0, aq, [0, p_name, [0, ap, [0, Sx_runtime[71].call(null, val), e]]]]]]]], g = [2, Sx_runtime[4].call(null, f)], h = Sx_runtime[2].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[7], h], 1); } } return 0; }, e); } if(Sx_types[45].call(null, rest_type)) var positional$0 = Sx_types[45].call(null, positional) ? positional : aB, f = [0, Sx_runtime[22].call(null, positional$0), 0], g = [0, Sx_runtime[22].call(null, args), f], a = Sx_runtime[1].call(null, cst$5, g); else var a = rest_type; if(! Sx_types[45].call(null, a)) return 0; var positional$1 = Sx_types[45].call(null, positional) ? positional : aA, h = [0, args, [0, Sx_runtime[22].call(null, positional$1), 0]], i = Sx_runtime[1].call(null, cst_slice, h), j = Sx_runtime[5].call(null, i), k = [5, Stdlib_List[21].call (null, function(i, v){var i$0 = [1, i]; return [5, [0, i$0, [0, v, 0]]];}, j)], l = Sx_runtime[5].call(null, k); Stdlib_List[18].call (null, function(pair){ var idx = Sx_runtime[12].call(null, pair), val = Sx_runtime[15].call(null, pair, at), a = value_matches_type_p(val, rest_type), b = [0, 1 - Sx_types[45].call(null, a)]; if(! Sx_types[45].call(null, b)) return 0; var c = [0, av, [0, [2, Sx_runtime[4].call(null, [0, val, 0])], au]], d = [0, az, [0, name, [0, ay, [0, rest_type, [0, ax, [0, idx, [0, aw, [0, Sx_runtime[71].call(null, val), c]]]]]]]], e = [2, Sx_runtime[4].call(null, d)], f = Sx_runtime[2].call(null, e); throw caml_maybe_attach_backtrace([0, Sx_types[7], f], 1); }, l); return 0; } var cst$7 = "\xce\xbb", cst_rest = "&rest", cst$6 = "+", aC = [0, [2, cst_rest], 0], aD = [1, 0.], aE = [0, [1, 1.], 0], aF = [0, 1], aG = [5, 0], aH = [0, 0]; function bind_lambda_params(params, args, local){ var rest_idx = Sx_runtime[1].call(null, "index-of", [0, params, aC]), and = Sx_runtime[32].call(null, rest_idx); if(Sx_types[45].call(null, and)) var b = [0, rest_idx, [0, Sx_runtime[22].call(null, params), 0]], a = Sx_runtime[1].call(null, cst$4, b); else var a = and; if(! Sx_types[45].call(null, a)) return aH; var positional = Sx_runtime[1].call (null, cst_slice, [0, params, [0, aD, [0, rest_idx, 0]]]), c = Sx_runtime[1].call(null, cst$6, [0, rest_idx, aE]), rest_name = Sx_runtime[15].call(null, params, c); Sx_runtime[91].call (null, [14, cst$7, function(args$0){ if(args$0){ var a = args$0[2]; if(a && ! a[2]){ var p = a[1], i = args$0[1], b = [0, i, [0, Sx_runtime[22].call(null, args), 0]], c = Sx_runtime[1].call(null, cst$4, b), d = Sx_types[45].call(null, c) ? Sx_runtime[15].call(null, args, i) : 0, e = Sx_runtime[3].call(null, p); return Sx_runtime[75].call(null, local, e, d); } } return 0; }], positional); var d = [0, Sx_runtime[22].call(null, args), [0, rest_idx, 0]], e = Sx_runtime[1].call(null, cst$5, d), f = Sx_types[45].call(null, e) ? Sx_runtime[1].call(null, cst_slice, [0, args, [0, rest_idx, 0]]) : aG, g = Sx_runtime[3].call(null, rest_name); Sx_runtime[75].call(null, local, g, f); return aF; } var cst_args_got = " args, got ", cst_expects = " expects ", cst_zip = "zip", aI = [2, cst_args_got], aJ = [2, cst_expects], aK = [2, cst_lambda], aL = [1, 1.]; function call_lambda(f, args, caller_env){ var params = Sx_types[48].call(null, f), a = Sx_types[50].call(null, f), local = Sx_runtime[79].call(null, a, caller_env), b = bind_lambda_params(params, args, local), c = [0, 1 - Sx_types[45].call(null, b)]; if(Sx_types[45].call(null, c)){ var d = [0, Sx_runtime[22].call(null, params), 0], e = [0, Sx_runtime[22].call(null, args), d], g = Sx_runtime[1].call(null, cst$5, e); if(Sx_types[45].call(null, g)){ var h = [0, aI, [0, Sx_runtime[22].call(null, args), 0]], i = [0, aJ, [0, Sx_runtime[22].call(null, params), h]], or = Sx_types[51].call(null, f), or$0 = Sx_types[45].call(null, or) ? or : aK, j = [2, Sx_runtime[4].call(null, [0, or$0, i])], k = Sx_runtime[2].call(null, j); throw caml_maybe_attach_backtrace([0, Sx_types[7], k], 1); } var l = Sx_runtime[1].call(null, cst_zip, [0, params, [0, args, 0]]), m = Sx_runtime[5].call(null, l); Stdlib_List[18].call (null, function(pair){ var a = Sx_runtime[15].call(null, pair, aL), b = Sx_runtime[12].call(null, pair), c = Sx_runtime[3].call(null, b); Sx_runtime[75].call(null, local, c, a); return 0; }, m); var n = [0, params, [0, Sx_runtime[22].call(null, args), 0]], o = Sx_runtime[1].call(null, cst_slice, n), p = Sx_runtime[5].call(null, o); Stdlib_List[18].call (null, function(p){ var a = Sx_runtime[3].call(null, p); Sx_runtime[75].call(null, local, a, 0); return 0; }, p); } var q = Sx_types[49].call(null, f); return Sx_types[32].call(null, q, local); } var cst_children = "children", aM = [1, 1.], aN = [2, cst_children]; function call_component(comp, raw_args, env){ var parsed = parse_keyword_args(raw_args, env), kwargs = Sx_runtime[12].call(null, parsed), children = Sx_runtime[15].call(null, parsed, aM), a = Sx_types[59].call(null, comp), local = Sx_runtime[79].call(null, a, env), b = Sx_types[57].call(null, comp), c = Sx_runtime[5].call(null, b); Stdlib_List[18].call (null, function(p){ var or = Sx_runtime[54].call(null, kwargs, p), or$0 = Sx_types[45].call(null, or) ? or : 0, a = Sx_runtime[3].call(null, p); Sx_runtime[75].call(null, local, a, or$0); return 0; }, c); var d = Sx_types[60].call(null, comp); if(Sx_types[45].call(null, d)){ var e = Sx_runtime[3].call(null, aN); Sx_runtime[75].call(null, local, e, children); } var f = Sx_types[58].call(null, comp); return Sx_types[32].call(null, f, local); } var cst_assoc = "assoc", cst_i = "i", cst_inc = "inc", cst_skip = "skip", aO = [5, 0], aP = [1, 0.], aQ = [2, cst_i], aR = [0, 0], aS = [2, cst_skip], aT = [2, cst_i], aU = [2, cst_skip], aV = [2, cst_i], aW = [0, 0], aX = [2, cst_skip], aY = [0, [2, cst_keyword], 0], aZ = [2, cst_i], a0 = [0, 1], a1 = [2, cst_skip], a2 = [2, cst_i]; function parse_keyword_args(raw_args, env){ var kwargs = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], a = Sx_runtime[5].call(null, raw_args), d = Stdlib_Hashtbl[1].call(null, 0, 2), b = Sx_runtime[2].call(null, aQ); Stdlib_Hashtbl[11].call(null, d, b, aP); var c = Sx_runtime[2].call(null, aS); Stdlib_Hashtbl[11].call(null, d, c, aR); var children = [0, aO]; Stdlib_List[26].call (null, function(state, arg){ var idx = Sx_runtime[23].call(null, state, aT), skip = Sx_runtime[23].call(null, state, aU); if(Sx_types[45].call(null, skip)){ var b = [0, state, [0, aX, [0, aW, [0, aV, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]]]; return Sx_runtime[1].call(null, cst_assoc, b); } var c = [0, Sx_runtime[71].call(null, arg), aY], and = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and)) var d = [0, Sx_runtime[22].call(null, raw_args), 0], e = [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), d], a = Sx_runtime[1].call(null, cst$4, e); else var a = and; if(Sx_types[45].call(null, a)){ var f = Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), g = trampoline(eval_expr(Sx_runtime[15].call(null, raw_args, f), env)), h = Sx_types[47].call(null, arg); Sx_runtime[9].call(null, kwargs, h, g); var i = [0, state, [0, a1, [0, a0, [0, aZ, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]]]; return Sx_runtime[1].call(null, cst_assoc, i); } var j = trampoline(eval_expr(arg, env)); children[1] = Sx_runtime[8].call(null, children[1], j); var k = [0, state, [0, a2, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]; return Sx_runtime[1].call(null, cst_assoc, k); }, [6, d], a); return [5, [0, kwargs, [0, children[1], 0]]]; } var cst$8 = "=>", a3 = [0, [2, cst_list], 0], a4 = [0, [1, 2.], 0], a5 = [0, [1, 3.], 0], a6 = [0, [2, cst_symbol], 0], a7 = [1, 1.], a8 = [0, [2, cst$8], 0], a9 = [1, 1.]; function cond_scheme_p(clauses){ var a = Sx_runtime[5].call(null, clauses); return [0, Stdlib_List[33].call (null, function(c){ var a = [0, Sx_runtime[71].call(null, c), a3], and = Sx_runtime[1].call(null, cst, a); if(Sx_types[45].call(null, and)){ var b = [0, Sx_runtime[22].call(null, c), a4], or = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, or)) var or$0 = or; else{ var d = [0, Sx_runtime[22].call(null, c), a5], and$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and$0)){ var e = Sx_runtime[15].call(null, c, a7), f = [0, Sx_runtime[71].call(null, e), a6], and$1 = Sx_runtime[1].call(null, cst, f); if(Sx_types[45].call(null, and$1)) var g = Sx_runtime[15].call(null, c, a9), h = [0, Sx_types[46].call(null, g), a8], or$0 = Sx_runtime[1].call(null, cst, h); else var or$0 = and$1; } else var or$0 = and$0; } } else var or$0 = and; return Sx_types[45].call(null, or$0); }, a)]; } var cst_else = "else", a_ = [0, [2, cst_keyword], 0], a$ = [0, [2, cst_else], 0], ba = [0, [2, cst_symbol], 0], bb = [0, [2, cst_else], 0], bc = [0, [2, ":else"], 0]; function is_else_clause(test){ var a = [0, Sx_runtime[71].call(null, test), a_], and = Sx_runtime[1].call(null, cst, a); if(Sx_types[45].call(null, and)) var b = [0, Sx_types[47].call(null, test), a$], or = Sx_runtime[1].call(null, cst, b); else var or = and; if(Sx_types[45].call(null, or)) return or; var c = [0, Sx_runtime[71].call(null, test), ba], and$0 = Sx_runtime[1].call(null, cst, c); if(! Sx_types[45].call(null, and$0)) return and$0; var d = [0, Sx_types[46].call(null, test), bb], or$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, or$0)) return or$0; var e = [0, Sx_types[46].call(null, test), bc]; return Sx_runtime[1].call(null, cst, e); } var cst$9 = "*", cst$10 = "/", cst_range = "range", bd = [1, 1.], be = [0, [1, 2.], 0], bf = [5, 0], bg = [5, 0], bh = [0, [2, cst_list], 0], bi = [0, [1, 2.], 0], bj = [0, [2, cst_symbol], 0], bk = [1, 1.], bl = [0, [1, 1.], 0], bm = [2, cst_begin], bn = [0, [1, 2.], 0], bo = [1, 0.], bp = [0, [2, cst_symbol], 0], bq = [0, [1, 2.], 0], br = [0, [1, 2.], 0], bs = [0, [1, 2.], 0], bt = [0, [1, 2.], 0]; function sf_named_let(args, env){ var b = Sx_runtime[12].call(null, args), loop_name = Sx_types[46].call(null, b), bindings = Sx_runtime[15].call(null, args, bd), body = Sx_runtime[1].call(null, cst_slice, [0, args, be]), c = Sx_runtime[12].call(null, bindings), d = [0, Sx_runtime[71].call(null, c), bh], and = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and)) var e = Sx_runtime[12].call(null, bindings), f = [0, Sx_runtime[22].call(null, e), bi], a = Sx_runtime[1].call(null, cst, f); else var a = and; var params = [0, bf], inits = [0, bg]; if(Sx_types[45].call(null, a)){ var g = Sx_runtime[5].call(null, bindings); Stdlib_List[18].call (null, function(binding){ var b = Sx_runtime[12].call(null, binding), c = [0, Sx_runtime[71].call(null, b), bj], d = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, d)) var e = Sx_runtime[12].call(null, binding), a = Sx_types[46].call(null, e); else var a = Sx_runtime[12].call(null, binding); params[1] = Sx_runtime[8].call(null, params[1], a); var f = Sx_runtime[15].call(null, binding, bk); inits[1] = Sx_runtime[8].call(null, inits[1], f); return 0; }, g); } else{ var o = [0, Sx_runtime[22].call(null, bindings), bn], p = [0, bo, [0, Sx_runtime[1].call(null, cst$10, o), 0]], q = Sx_runtime[1].call(null, cst_range, p), r = Sx_runtime[5].call(null, q); Stdlib_List[26].call (null, function(acc, pair_idx){ var b = Sx_runtime[1].call(null, cst$9, [0, pair_idx, bq]), c = Sx_runtime[15].call(null, bindings, b), d = [0, Sx_runtime[71].call(null, c), bp], e = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, e)) var f = Sx_runtime[1].call(null, cst$9, [0, pair_idx, br]), g = Sx_runtime[15].call(null, bindings, f), a = Sx_types[46].call(null, g); else var k = Sx_runtime[1].call(null, cst$9, [0, pair_idx, bt]), a = Sx_runtime[15].call(null, bindings, k); params[1] = Sx_runtime[8].call(null, params[1], a); var h = [0, Sx_runtime[1].call(null, cst$9, [0, pair_idx, bs]), 0], i = Sx_runtime[1].call(null, cst_inc, h), j = Sx_runtime[15].call(null, bindings, i); inits[1] = Sx_runtime[8].call(null, inits[1], j); return 0; }, 0, r); } var h = [0, Sx_runtime[22].call(null, body), bl], i = Sx_runtime[1].call(null, cst, h); if(Sx_types[45].call(null, i)) var loop_body = Sx_runtime[12].call(null, body); else var n = Sx_types[33].call(null, bm), loop_body = Sx_runtime[16].call(null, n, body); var loop_fn = Sx_types[28].call(null, params[1], loop_body, env), j = Sx_runtime[3].call(null, loop_name); Sx_runtime[80].call(null, loop_fn, j); var k = Sx_runtime[3].call(null, loop_name), l = Sx_types[50].call(null, loop_fn); Sx_runtime[75].call(null, l, k, loop_fn); var m = Sx_runtime[5].call(null, inits[1]), init_vals = [5, Stdlib_List[20].call (null, function(e){return trampoline(eval_expr(e, env));}, m)]; return cek_call(loop_fn, init_vals); } var cst_as = "as", bu = [0, [1, 1.], 0], bv = [0, [2, cst_symbol], 0], bw = [0, [2, cst_list], 0], bx = [0, [1, 3.], 0], by = [0, [2, cst_keyword], 0], bz = [1, 1.], bA = [0, [2, cst_as], 0], bB = [1, 1.], bC = [2, cst_begin]; function sf_lambda(args, env){ var params_expr = Sx_runtime[12].call(null, args), body_exprs = Sx_runtime[13].call(null, args), a = [0, Sx_runtime[22].call(null, body_exprs), bu], b = Sx_runtime[1].call(null, cst, a); if(Sx_types[45].call(null, b)) var body = Sx_runtime[12].call(null, body_exprs); else var d = Sx_types[33].call(null, bC), body = Sx_runtime[16].call(null, d, body_exprs); var c = Sx_runtime[5].call(null, params_expr), param_names = [5, Stdlib_List[20].call (null, function(p){ var b = [0, Sx_runtime[71].call(null, p), bv], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)) return Sx_types[46].call(null, p); var d = [0, Sx_runtime[71].call(null, p), bw], and = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and)){ var e = [0, Sx_runtime[22].call(null, p), bx], and$0 = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, and$0)){ var f = Sx_runtime[15].call(null, p, bz), g = [0, Sx_runtime[71].call(null, f), by], and$1 = Sx_runtime[1].call(null, cst, g); if(Sx_types[45].call(null, and$1)) var h = Sx_runtime[15].call(null, p, bB), i = [0, Sx_types[47].call(null, h), bA], a = Sx_runtime[1].call(null, cst, i); else var a = and$1; } else var a = and$0; } else var a = and; if(! Sx_types[45].call(null, a)) return p; var j = Sx_runtime[12].call(null, p); return Sx_types[46].call(null, j); }, c)]; return Sx_types[28].call(null, param_names, body, env); } var cst_current_file = "*current-file*", cst_effect_annotations = "*effect-annotations*", cst_effects = "effects", cst$11 = "~", bD = [1, 1.], bE = [2, cst$11], bF = [1, 1.], bG = [1, 2.], bH = [2, "auto"], bI = [2, "affinity"], bJ = [2, cst_effects], bK = [0, [2, cst_list], 0], bL = [0, [2, cst_symbol], 0], bM = [2, cst_effect_annotations], bN = [2, cst_effect_annotations], bO = [2, cst_effect_annotations], bP = [2, cst_current_file], bQ = [2, cst_current_file]; function sf_defcomp(args, env){ var name_sym = Sx_runtime[12].call(null, args), params_raw = Sx_runtime[15].call(null, args, bD), body = Sx_runtime[14].call(null, args), a = Sx_types[46].call(null, name_sym), comp_name = Sx_runtime[123].call(null, a, bE), parsed = parse_comp_params(params_raw), params = Sx_runtime[12].call(null, parsed), has_children = Sx_runtime[15].call(null, parsed, bF), param_types = Sx_runtime[15].call(null, parsed, bG), affinity = defcomp_kwarg(args, bI, bH), comp = Sx_types[29].call (null, comp_name, params, has_children, body, env, affinity), effects = defcomp_kwarg(args, bJ, 0), b = Sx_runtime[81].call(null, param_types), and = [0, 1 - Sx_types[45].call(null, b)]; if(Sx_types[45].call(null, and)){ var c = Sx_runtime[1].call(null, cst_keys, [0, param_types, 0]); Sx_runtime[31].call(null, c); } var d = Sx_runtime[81].call(null, effects), e = [0, 1 - Sx_types[45].call(null, d)]; if(Sx_types[45].call(null, e)){ var f = [0, Sx_runtime[71].call(null, effects), bK], g = Sx_runtime[1].call(null, cst, f); if(Sx_types[45].call(null, g)) var h = Sx_runtime[5].call(null, effects), effect_list = [5, Stdlib_List[20].call (null, function(e){ var a = [0, Sx_runtime[71].call(null, e), bL], b = Sx_runtime[1].call(null, cst, a); return Sx_types[45].call(null, b) ? Sx_types[46].call(null, e) : [2, Sx_runtime[4].call(null, [0, e, 0])]; }, h)]; else var effect_list = [5, [0, [2, Sx_runtime[4].call(null, [0, effects, 0])], 0]]; var i = Sx_runtime[73].call(null, env, bM), effect_anns = Sx_types[45].call(null, i) ? Sx_runtime[74].call(null, env, bN) : [6, Stdlib_Hashtbl[1].call(null, 0, 0)], j = Sx_types[46].call(null, name_sym); Sx_runtime[9].call(null, effect_anns, j, effect_list); var k = Sx_runtime[3].call(null, bO); Sx_runtime[75].call(null, env, k, effect_anns); } var l = Sx_runtime[73].call(null, env, bP); if(Sx_types[45].call(null, l)){ var m = Sx_runtime[74].call(null, env, bQ); Sx_types[56].call(null, comp, m); } var n = Sx_types[46].call(null, name_sym), o = Sx_runtime[3].call(null, n); Sx_runtime[75].call(null, env, o, comp); return comp; } var bR = [0, [1, 1.], 0], bS = [0, [1, 1.], 0], bT = [1, 2.], bU = [0, [2, cst_keyword], 0], bV = [0, [1, 1.], 0], bW = [0, [1, 1.], 0], bX = [0, [2, cst_keyword], 0]; function defcomp_kwarg(args, key, default$){ var a = [0, Sx_runtime[22].call(null, args), bR], end = Sx_runtime[1].call(null, cst$1, a), result = [0, default$], b = Sx_runtime[1].call(null, cst_range, [0, bT, [0, end, bS]]), c = Sx_runtime[5].call(null, b); Stdlib_List[18].call (null, function(i){ var b = Sx_runtime[15].call(null, args, i), c = [0, Sx_runtime[71].call(null, b), bU], and = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and)){ var d = Sx_runtime[15].call(null, args, i), e = [0, Sx_types[47].call(null, d), [0, key, 0]], and$0 = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, and$0)) var f = [0, Sx_runtime[1].call(null, cst$6, [0, i, bV]), [0, end, 0]], a = Sx_runtime[1].call(null, cst$4, f); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)){ var g = Sx_runtime[1].call(null, cst$6, [0, i, bW]), val = Sx_runtime[15].call(null, args, g), h = [0, Sx_runtime[71].call(null, val), bX], j = Sx_runtime[1].call(null, cst, h), k = Sx_types[45].call(null, j) ? Sx_types[47].call(null, val) : val; result[1] = k; } return 0; }, c); return result[1]; } var bY = [5, 0], bZ = [0, 0], b0 = [0, 0], b1 = [0, [2, cst_list], 0], b2 = [0, [1, 3.], 0], b3 = [0, [2, cst_symbol], 0], b4 = [0, [2, cst_keyword], 0], b5 = [1, 1.], b6 = [0, [2, cst_as], 0], b7 = [1, 1.], b8 = [1, 2.], b9 = [0, [2, cst_symbol], 0], b_ = [0, [2, cst_symbol], 0], b$ = [0, [2, "&key"], 0], ca = [0, 1], cb = [0, [2, cst_rest], 0], cc = [0, 1], cd = [0, [2, "&children"], 0], ce = [0, 1]; function parse_comp_params(params_expr){ var param_types = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], a = Sx_runtime[5].call(null, params_expr), params = [0, bY], has_children = [0, bZ], in_key = [0, b0]; Stdlib_List[18].call (null, function(p){ var b = [0, Sx_runtime[71].call(null, p), b1], and = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, and)){ var c = [0, Sx_runtime[22].call(null, p), b2], and$0 = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and$0)){ var d = Sx_runtime[12].call(null, p), e = [0, Sx_runtime[71].call(null, d), b3], and$1 = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, and$1)){ var f = Sx_runtime[15].call(null, p, b5), g = [0, Sx_runtime[71].call(null, f), b4], and$2 = Sx_runtime[1].call(null, cst, g); if(Sx_types[45].call(null, and$2)) var h = Sx_runtime[15].call(null, p, b7), i = [0, Sx_types[47].call(null, h), b6], a = Sx_runtime[1].call(null, cst, i); else var a = and$2; } else var a = and$1; } else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)){ var j = Sx_runtime[12].call(null, p), name = Sx_types[46].call(null, j), ptype = Sx_runtime[15].call(null, p, b8), k = [0, Sx_runtime[71].call(null, ptype), b9], l = Sx_runtime[1].call(null, cst, k), type_val = Sx_types[45].call(null, l) ? Sx_types[46].call(null, ptype) : ptype, m = [0, 1 - Sx_types[45].call(null, has_children[1])]; if(Sx_types[45].call(null, m)){ params[1] = Sx_runtime[8].call(null, params[1], name); Sx_runtime[9].call(null, param_types, name, type_val); } } else{ var n = [0, Sx_runtime[71].call(null, p), b_], o = Sx_runtime[1].call(null, cst, n); if(Sx_types[45].call(null, o)){ var name$0 = Sx_types[46].call(null, p), q = Sx_runtime[1].call(null, cst, [0, name$0, b$]); if(Sx_types[45].call(null, q)) in_key[1] = ca; else{ var r = Sx_runtime[1].call(null, cst, [0, name$0, cb]); if(Sx_types[45].call(null, r)) has_children[1] = cc; else{ var s = Sx_runtime[1].call(null, cst, [0, name$0, cd]); if(Sx_types[45].call(null, s)) has_children[1] = ce; else if(! Sx_types[45].call(null, has_children[1])) if(Sx_types[45].call(null, in_key[1])) params[1] = Sx_runtime[8].call(null, params[1], name$0); else params[1] = Sx_runtime[8].call(null, params[1], name$0); } } } } return 0; }, a); return [5, [0, params[1], [0, has_children[1], [0, param_types, 0]]]]; } var cf = [1, 1.], cg = [0, [1, 2.], 0], ch = [0, [1, 1.], 0], ci = [2, cst$11], cj = [1, 1.], ck = [2, cst_current_file], cl = [2, cst_current_file], cm = [2, cst_begin]; function sf_defisland(args, env){ var name_sym = Sx_runtime[12].call(null, args), params_raw = Sx_runtime[15].call(null, args, cf), body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, cg]), a = [0, Sx_runtime[22].call(null, body_exprs), ch], b = Sx_runtime[1].call(null, cst, a); if(Sx_types[45].call(null, b)) var body = Sx_runtime[12].call(null, body_exprs); else var h = Sx_types[33].call(null, cm), body = Sx_runtime[16].call(null, h, body_exprs); var c = Sx_types[46].call(null, name_sym), comp_name = Sx_runtime[123].call(null, c, ci), parsed = parse_comp_params(params_raw), params = Sx_runtime[12].call(null, parsed), has_children = Sx_runtime[15].call(null, parsed, cj), island = Sx_types[30].call(null, comp_name, params, has_children, body, env), d = Sx_runtime[73].call(null, env, ck); if(Sx_types[45].call(null, d)){ var e = Sx_runtime[74].call(null, env, cl); Sx_types[56].call(null, island, e); } var f = Sx_types[46].call(null, name_sym), g = Sx_runtime[3].call(null, f); Sx_runtime[75].call(null, env, g, island); return island; } var cst$12 = ">=", cn = [0, [1, 2.], 0], co = [1, 1.]; function defio_parse_kwargs_b(spec, remaining$1){ var remaining = remaining$1; for(;;){ var b = Sx_runtime[31].call(null, remaining), and = [0, 1 - Sx_types[45].call(null, b)]; if(Sx_types[45].call(null, and)){ var c = [0, Sx_runtime[22].call(null, remaining), cn], and$0 = Sx_runtime[1].call(null, cst$12, c); if(Sx_types[45].call(null, and$0)) var d = Sx_runtime[12].call(null, remaining), a = Sx_runtime[30].call(null, d); else var a = and$0; } else var a = and; if(! Sx_types[45].call(null, a)) return 0; var e = Sx_runtime[15].call(null, remaining, co), f = Sx_runtime[12].call(null, remaining), g = Sx_types[47].call(null, f); Sx_runtime[9].call(null, spec, g, e); var h = Sx_runtime[13].call(null, remaining), remaining$0 = Sx_runtime[13].call(null, h); remaining = remaining$0; } } var cp = [2, cst_name]; function sf_defio(args, env){ var name = Sx_runtime[12].call(null, args), spec = [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; Sx_runtime[9].call(null, spec, cp, name); defio_parse_kwargs_b(spec, Sx_runtime[13].call(null, args)); io_register_b(name, spec); return spec; } var cq = [1, 1.], cr = [1, 2.], cs = [1, 1.]; function sf_defmacro(args, env){ var name_sym = Sx_runtime[12].call(null, args), params_raw = Sx_runtime[15].call(null, args, cq), body = Sx_runtime[15].call(null, args, cr), parsed = parse_macro_params(params_raw), params = Sx_runtime[12].call(null, parsed), rest_param = Sx_runtime[15].call(null, parsed, cs), a = Sx_types[46].call(null, name_sym), mac = Sx_types[31].call(null, params, rest_param, body, env, a), b = Sx_types[46].call(null, name_sym), c = Sx_runtime[3].call(null, b); Sx_runtime[75].call(null, env, c, mac); return mac; } var cst_in_rest = "in-rest", ct = [5, 0], cu = [0, 0], cv = [2, cst_in_rest], cw = [0, [2, cst_symbol], 0], cx = [0, [2, cst_rest], 0], cy = [0, [2, cst_in_rest], [0, [0, 1], 0]], cz = [2, cst_in_rest], cA = [0, [2, cst_symbol], 0], cB = [0, [2, cst_symbol], 0]; function parse_macro_params(params_expr){ var a = Sx_runtime[5].call(null, params_expr), d = Stdlib_Hashtbl[1].call(null, 0, 1), b = Sx_runtime[2].call(null, cv); Stdlib_Hashtbl[11].call(null, d, b, cu); var params = [0, ct], rest_param = [0, 0]; Stdlib_List[26].call (null, function(state, p){ var b = [0, Sx_runtime[71].call(null, p), cw], and = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, and)) var c = [0, Sx_types[46].call(null, p), cx], a = Sx_runtime[1].call(null, cst, c); else var a = and; if(Sx_types[45].call(null, a)) return Sx_runtime[1].call(null, cst_assoc, [0, state, cy]); var d = Sx_runtime[23].call(null, state, cz); if(Sx_types[45].call(null, d)){ var e = [0, Sx_runtime[71].call(null, p), cA], f = Sx_runtime[1].call(null, cst, e), g = Sx_types[45].call(null, f) ? Sx_types[46].call(null, p) : p; rest_param[1] = g; return state; } var h = [0, Sx_runtime[71].call(null, p), cB], i = Sx_runtime[1].call(null, cst, h), j = Sx_types[45].call(null, i) ? Sx_types[46].call(null, p) : p; params[1] = Sx_runtime[8].call(null, params[1], j); return state; }, [6, d], a); return [5, [0, params[1], [0, rest_param[1], 0]]]; } var cst_concat = "concat", cC = [0, [2, cst_list], 0], cD = [5, 0], cE = [0, [2, cst_symbol], 0], cF = [0, [2, "unquote"], 0], cG = [1, 1.], cH = [5, 0], cI = [0, [2, cst_list], 0], cJ = [0, [1, 2.], 0], cK = [0, [2, cst_symbol], 0], cL = [0, [2, "splice-unquote"], 0], cM = [1, 1.], cN = [0, [2, cst_list], 0]; function qq_expand(template, env){ var b = [0, Sx_runtime[71].call(null, template), cC], c = Sx_runtime[1].call(null, cst, b), d = [0, 1 - Sx_types[45].call(null, c)]; if(Sx_types[45].call(null, d)) return template; var e = Sx_runtime[31].call(null, template); if(Sx_types[45].call(null, e)) return cD; var head = Sx_runtime[12].call(null, template), f = [0, Sx_runtime[71].call(null, head), cE], and = Sx_runtime[1].call(null, cst, f); if(Sx_types[45].call(null, and)) var g = [0, Sx_types[46].call(null, head), cF], a = Sx_runtime[1].call(null, cst, g); else var a = and; if(Sx_types[45].call(null, a)) return trampoline (eval_expr(Sx_runtime[15].call(null, template, cG), env)); var h = Sx_runtime[5].call(null, template); return Stdlib_List[26].call (null, function(result, item){ var b = [0, Sx_runtime[71].call(null, item), cI], and = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, and)){ var c = [0, Sx_runtime[22].call(null, item), cJ], and$0 = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and$0)){ var d = Sx_runtime[12].call(null, item), e = [0, Sx_runtime[71].call(null, d), cK], and$1 = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, and$1)) var f = Sx_runtime[12].call(null, item), g = [0, Sx_types[46].call(null, f), cL], a = Sx_runtime[1].call(null, cst, g); else var a = and$1; } else var a = and$0; } else var a = and; if(! Sx_types[45].call(null, a)){ var k = [0, result, [0, [5, [0, qq_expand(item, env), 0]], 0]]; return Sx_runtime[1].call(null, cst_concat, k); } var spliced = trampoline (eval_expr(Sx_runtime[15].call(null, item, cM), env)), h = [0, Sx_runtime[71].call(null, spliced), cN], i = Sx_runtime[1].call(null, cst, h); if(Sx_types[45].call(null, i)) return Sx_runtime[1].call (null, cst_concat, [0, result, [0, spliced, 0]]); var j = Sx_runtime[81].call(null, spliced); return Sx_types[45].call(null, j) ? result : Sx_runtime [1].call (null, cst_concat, [0, result, [0, [5, [0, spliced, 0]], 0]]); }, cH, h); } var cst_dec = "dec", cO = [5, 0], cP = [5, 0], cQ = [0, [2, cst_list], 0], cR = [0, [1, 2.], 0], cS = [0, [2, cst_symbol], 0], cT = [1, 1.], cU = [1, 1.], cV = [1, 0.], cW = [0, [1, 2.], 0], cX = [1, 0.], cY = [0, [2, cst_symbol], 0], cZ = [0, [1, 2.], 0], c0 = [0, [1, 2.], 0], c1 = [0, [1, 2.], 0], c2 = [0, [1, 2.], 0]; function sf_letrec(args, env){ var bindings = Sx_runtime[12].call(null, args), body = Sx_runtime[13].call(null, args), local = Sx_runtime[78].call(null, env), b = Sx_runtime[12].call(null, bindings), c = [0, Sx_runtime[71].call(null, b), cQ], and = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, and)) var d = Sx_runtime[12].call(null, bindings), e = [0, Sx_runtime[22].call(null, d), cR], a = Sx_runtime[1].call(null, cst, e); else var a = and; var names = [0, cO], val_exprs = [0, cP]; if(Sx_types[45].call(null, a)){ var f = Sx_runtime[5].call(null, bindings); Stdlib_List[18].call (null, function(binding){ var a = Sx_runtime[12].call(null, binding), b = [0, Sx_runtime[71].call(null, a), cS], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)) var d = Sx_runtime[12].call(null, binding), vname = Sx_types[46].call(null, d); else var vname = Sx_runtime[12].call(null, binding); names[1] = Sx_runtime[8].call(null, names[1], vname); var e = Sx_runtime[15].call(null, binding, cT); val_exprs[1] = Sx_runtime[8].call(null, val_exprs[1], e); var f = Sx_runtime[3].call(null, vname); Sx_runtime[75].call(null, local, f, 0); return 0; }, f); } else{ var p = [0, Sx_runtime[22].call(null, bindings), cW], q = [0, cX, [0, Sx_runtime[1].call(null, cst$10, p), 0]], r = Sx_runtime[1].call(null, cst_range, q), s = Sx_runtime[5].call(null, r); Stdlib_List[26].call (null, function(acc, pair_idx){ var a = Sx_runtime[1].call(null, cst$9, [0, pair_idx, cZ]), b = Sx_runtime[15].call(null, bindings, a), c = [0, Sx_runtime[71].call(null, b), cY], d = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, d)) var e = Sx_runtime[1].call(null, cst$9, [0, pair_idx, c0]), f = Sx_runtime[15].call(null, bindings, e), vname = Sx_types[46].call(null, f); else var j = Sx_runtime[1].call(null, cst$9, [0, pair_idx, c2]), vname = Sx_runtime[15].call(null, bindings, j); var g = [0, Sx_runtime[1].call(null, cst$9, [0, pair_idx, c1]), 0], h = Sx_runtime[1].call(null, cst_inc, g), val_expr = Sx_runtime[15].call(null, bindings, h); names[1] = Sx_runtime[8].call(null, names[1], vname); val_exprs[1] = Sx_runtime[8].call(null, val_exprs[1], val_expr); var i = Sx_runtime[3].call(null, vname); return Sx_runtime[75].call(null, local, i, 0); }, 0, s); } var g = Sx_runtime[5].call(null, val_exprs[1]), values = [5, Stdlib_List[20].call (null, function(e){return trampoline(eval_expr(e, local));}, g)], h = Sx_runtime[1].call(null, cst_zip, [0, names[1], [0, values, 0]]), i = Sx_runtime[5].call(null, h); Stdlib_List[18].call (null, function(pair){ var a = Sx_runtime[15].call(null, pair, cU), b = Sx_runtime[12].call(null, pair), c = Sx_runtime[3].call(null, b); Sx_runtime[75].call(null, local, c, a); return 0; }, i); var j = Sx_runtime[5].call(null, values); Stdlib_List[18].call (null, function(val){ var a = Sx_runtime[83].call(null, val); if(Sx_types[45].call(null, a)){ var b = Sx_runtime[5].call(null, names[1]); Stdlib_List[18].call (null, function(n){ var a = Sx_runtime[74].call(null, local, n), b = Sx_runtime[3].call(null, n), c = Sx_types[50].call(null, val); Sx_runtime[75].call(null, c, b, a); return 0; }, b); } return 0; }, j); var k = [0, Sx_runtime[22].call(null, body), 0], l = [0, body, [0, cV, [0, Sx_runtime[1].call(null, cst_dec, k), 0]]], m = Sx_runtime[1].call(null, cst_slice, l), n = Sx_runtime[5].call(null, m); Stdlib_List[18].call (null, function(e){trampoline(eval_expr(e, local)); return 0;}, n); var o = Sx_runtime[14].call(null, body); return Sx_types[32].call(null, o, local); } function step_sf_letrec(args, env, kont){ var thk = sf_letrec(args, env), a = Sx_types[67].call(null, thk); return make_cek_state(Sx_types[66].call(null, thk), a, kont); } var c3 = [1, 1.], c4 = [1, 2.]; function sf_dynamic_wind(args, env){ var before = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), body = trampoline(eval_expr(Sx_runtime[15].call(null, args, c3), env)), after = trampoline(eval_expr(Sx_runtime[15].call(null, args, c4), env)); return Sx_runtime[99].call(null, before, body, after, env); } var c5 = [0, [1, 1.], 0], c6 = [0, [1, 2.], 0], c7 = [0, [2, cst_keyword], 0], c8 = [0, [2, cst_value], 0], c9 = [1, 1.], c_ = [0, [1, 2.], 0]; function sf_scope(args, env){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), rest = Sx_runtime[1].call(null, cst_slice, [0, args, c5]), b = [0, Sx_runtime[22].call(null, rest), c6], and = Sx_runtime[1].call(null, cst$12, b); if(Sx_types[45].call(null, and)){ var c = Sx_runtime[12].call(null, rest), d = [0, Sx_runtime[71].call(null, c), c7], and$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and$0)) var e = Sx_runtime[12].call(null, rest), f = [0, Sx_types[47].call(null, e), c8], a = Sx_runtime[1].call(null, cst, f); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)) var g = trampoline(eval_expr(Sx_runtime[15].call(null, rest, c9), env)), body_exprs = Sx_runtime[1].call(null, cst_slice, [0, rest, c_]), val = g; else var body_exprs = rest, val = 0; Sx_runtime[100].call(null, name, val); var h = Sx_runtime[5].call(null, body_exprs), result = [0, 0]; Stdlib_List[18].call (null, function(e){result[1] = trampoline(eval_expr(e, env)); return 0;}, h); Sx_runtime[101].call(null, name); return result[1]; } var c$ = [1, 1.], da = [0, [1, 2.], 0]; function sf_provide(args, env){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), val = trampoline(eval_expr(Sx_runtime[15].call(null, args, c$), env)), body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, da]); Sx_runtime[100].call(null, name, val); var a = Sx_runtime[5].call(null, body_exprs), result = [0, 0]; Stdlib_List[18].call (null, function(e){result[1] = trampoline(eval_expr(e, env)); return 0;}, a); Sx_runtime[101].call(null, name); return result[1]; } var db = [1, 1.], dc = [1, 1.]; function expand_macro(mac, raw_args, env){ var a = Sx_types[65].call(null, mac), local = Sx_runtime[79].call(null, a, env), b = Sx_types[62].call(null, mac), c = Sx_runtime[5].call(null, b), d = [5, Stdlib_List[21].call (null, function(i, p){var i$0 = [1, i]; return [5, [0, p, [0, i$0, 0]]];}, c)], e = Sx_runtime[5].call(null, d); Stdlib_List[18].call (null, function(pair){ var b = [0, Sx_runtime[22].call(null, raw_args), 0], c = [0, Sx_runtime[15].call(null, pair, db), b], d = Sx_runtime[1].call(null, cst$4, c); if(Sx_types[45].call(null, d)) var e = Sx_runtime[15].call(null, pair, dc), a = Sx_runtime[15].call(null, raw_args, e); else var a = 0; var f = Sx_runtime[12].call(null, pair), g = Sx_runtime[3].call(null, f); Sx_runtime[75].call(null, local, g, a); return 0; }, e); var f = Sx_types[63].call(null, mac); if(Sx_types[45].call(null, f)){ var g = Sx_types[62].call(null, mac), h = [0, raw_args, [0, Sx_runtime[22].call(null, g), 0]], i = Sx_runtime[1].call(null, cst_slice, h), j = Sx_types[63].call(null, mac), k = Sx_runtime[3].call(null, j); Sx_runtime[75].call(null, local, k, i); } return trampoline(eval_expr(Sx_types[64].call(null, mac), local)); } function cek_step_loop(state$1){ var state = state$1; for(;;){ var or = cek_terminal_p(state), or$0 = Sx_types[45].call(null, or) ? or : cek_suspended_p(state); if(Sx_types[45].call(null, or$0)) return state; var state$0 = cek_step(state); state = state$0; } } var cst_IO_suspension_in_non_IO_co = "IO suspension in non-IO context", dd = [2, cst_IO_suspension_in_non_IO_co]; function cek_run(state){ var final = cek_step_loop(state), a = cek_suspended_p(final); if(! Sx_types[45].call(null, a)) return cek_value(final); var b = Sx_runtime[2].call(null, dd); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } function cek_resume(suspended_state, result){ var a = cek_kont(suspended_state); return cek_step_loop(make_cek_value(result, cek_env(suspended_state), a)); } var de = [0, [2, cst_eval], 0]; function cek_step(state){ var a = [0, cek_phase(state), de], b = Sx_runtime[1].call(null, cst, a); return Sx_types[45].call(null, b) ? step_eval(state) : step_continue(state); } var cst_starts_with = "starts-with?", df = [2, cst_number], dg = [2, cst_string], dh = [2, cst_boolean], di = [2, cst_nil], dj = [2, cst_symbol], dk = [0, [2, cst$11], 0], dl = [0, [2, "true"], 0], dm = [0, 1], dn = [0, [2, "false"], 0], dp = [0, 0], dq = [0, [2, cst_nil], 0], dr = [2, "Undefined symbol: "], ds = [2, cst_keyword], dt = [2, cst_dict], du = [5, 0], dv = [2, cst_list], dw = [5, 0]; function step_eval(state){ var expr = cek_control(state), env = cek_env(state), kont = cek_kont(state), match_val = Sx_runtime[71].call(null, expr); if(caml_equal(match_val, df)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, dg)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, dh)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, di)) return make_cek_value(0, env, kont); if(! caml_equal(match_val, dj)){ if(caml_equal(match_val, ds)) return make_cek_value(Sx_types[47].call(null, expr), env, kont); if(caml_equal(match_val, dt)){ var ks = Sx_runtime[1].call(null, cst_keys, [0, expr, 0]), h = Sx_runtime[31].call(null, ks); if(Sx_types[45].call(null, h)) return make_cek_value ([6, Stdlib_Hashtbl[1].call(null, 0, 0)], env, kont); var first_key = Sx_runtime[12].call(null, ks), i = Sx_runtime[13].call(null, ks), j = Sx_runtime[5].call(null, i), remaining_entries = [0, du]; Stdlib_List[18].call (null, function(k){ var a = [5, [0, k, [0, Sx_runtime[23].call(null, expr, k), 0]]]; remaining_entries[1] = Sx_runtime[8].call(null, remaining_entries[1], a); return 0; }, j); var k = kont_push (make_dict_frame (remaining_entries[1], [5, [0, [5, [0, first_key, 0]], 0]], env), kont); return make_cek_state (Sx_runtime[23].call(null, expr, first_key), env, k); } if(! caml_equal(match_val, dv)) return make_cek_value(expr, env, kont); var l = Sx_runtime[31].call(null, expr); return Sx_types[45].call(null, l) ? make_cek_value(dw, env, kont) : step_eval_list(expr, env, kont); } var name = Sx_types[46].call(null, expr), a = Sx_runtime[73].call(null, env, name); if(Sx_types[45].call(null, a)) var val = Sx_runtime[74].call(null, env, name); else{ var b = Sx_runtime[89].call(null, name); if(Sx_types[45].call(null, b)) var val = Sx_runtime[90].call(null, name); else{ var c = Sx_runtime[1].call(null, cst, [0, name, dl]); if(Sx_types[45].call(null, c)) var val = dm; else{ var d = Sx_runtime[1].call(null, cst, [0, name, dn]); if(Sx_types[45].call(null, d)) var val = dp; else{ var e = Sx_runtime[1].call(null, cst, [0, name, dq]); if(! Sx_types[45].call(null, e)){ var f = [2, Sx_runtime[4].call(null, [0, dr, [0, name, 0]])], g = Sx_runtime[2].call(null, f); throw caml_maybe_attach_backtrace([0, Sx_types[7], g], 1); } var val = 0; } } } } var and = Sx_runtime[81].call(null, val); if(Sx_types[45].call(null, and)) Sx_runtime[1].call(null, cst_starts_with, [0, name, dk]); return make_cek_value(val, env, kont); } var dx = [0, 0]; function step_sf_raise(args, env, kont){ var a = kont_push(make_raise_eval_frame(env, dx), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var cst$13 = "_", cst_guard_k = "__guard-k", cst_guard_result = "__guard-result", cst_call_cc = "call/cc", cst_fn = "fn", cst_handler_bind = "handler-bind", cst_raise = "raise", dy = [2, "__guard-reraise__"], dz = [0, [5, [0, [3, cst_raise], [0, [5, [0, [3, "nth"], [0, [3, cst_guard_result], [0, [1, 1.], 0]]]], 0]]], [0, [3, cst_guard_result], 0]], dA = [3, cst_quote], dB = [5, [0, [3, "first"], [0, [3, cst_guard_result], 0]]], dC = [3, cst], dD = [5, [0, [3, cst], [0, [5, [0, [3, "len"], [0, [3, cst_guard_result], 0]]], [0, [1, 2.], 0]]]], dE = [5, [0, [3, "list?"], [0, [3, cst_guard_result], 0]]], dF = [3, cst_and], dG = [3, cst_if], dH = [3, cst_begin], dI = [3, cst_guard_k], dJ = [3, cst_quote], dK = [3, cst_list], dL = [3, cst_else], dM = [3, cst_cond], dN = [3, cst_guard_k], dO = [3, cst_fn], dP = [5, [0, [0, 1], 0]], dQ = [5, [0, [3, cst$13], 0]], dR = [3, cst_fn], dS = [3, cst_handler_bind], dT = [5, [0, [3, cst_guard_k], 0]], dU = [3, cst_fn], dV = [3, cst_call_cc], dW = [3, cst_guard_result], dX = [3, cst_let]; function step_sf_guard$0(counter, args, env, kont){ var var_clauses = Sx_runtime[12].call(null, args), body = Sx_runtime[13].call(null, args), var$ = Sx_runtime[12].call(null, var_clauses), clauses = Sx_runtime[13].call(null, var_clauses), sentinel = Sx_types[33].call(null, dy), b = [5, [0, [5, [0, dI, [0, Sx_runtime[16].call(null, dH, body), 0]]], 0]], c = Sx_runtime[1].call (null, cst_append, [0, clauses, [0, [5, [0, [5, [0, dL, [0, [5, [0, dK, [0, [5, [0, dJ, [0, sentinel, 0]]], [0, var$, 0]]]], 0]]], 0]], 0]]), d = [5, [0, [5, [0, dN, [0, Sx_runtime[16].call(null, dM, c), 0]]], 0]], e = Sx_runtime[16].call(null, [5, [0, var$, 0]], d), f = [0, Sx_runtime[16].call(null, dO, e), 0], g = Sx_runtime[16].call(null, dQ, dP), h = [5, [0, [5, [0, Sx_runtime[16].call(null, dR, g), f]], 0]], i = Sx_runtime[16].call(null, h, b), j = [5, [0, Sx_runtime[16].call(null, dS, i), 0]], k = Sx_runtime[16].call(null, dT, j), l = [5, [0, Sx_runtime[16].call(null, dU, k), 0]], a = [5, [0, dX, [0, [5, [0, [5, [0, dW, [0, Sx_runtime[16].call(null, dV, l), 0]]], 0]], [0, [5, [0, dG, [0, [5, [0, dF, [0, dE, [0, dD, [0, [5, [0, dC, [0, dB, [0, [5, [0, dA, [0, sentinel, 0]]], 0]]]], 0]]]]], dz]]], 0]]]]; return counter < 50 ? step_eval_list$0(counter + 1 | 0, a, env, kont) : caml_trampoline_return(step_eval_list$0, [0, a, env, kont]); } function step_sf_guard(args, env, kont){ return caml_trampoline(step_sf_guard$0(0, args, env, kont)); } var cst_do_loop = "__do-loop", cst_context = "context", cst_emitted = "emitted", cst_every$0 = "every?", cst_map_indexed = "map-indexed", render_check = 0, render_fn = 0, dY = [0, [2, cst_symbol], 0], dZ = [5, 0], d0 = [5, 0], d1 = [0, [2, cst_symbol], 0], d2 = [0, [2, cst_if], 0], d3 = [0, [2, cst_when], 0], d4 = [0, [2, cst_cond], 0], d5 = [0, [2, cst_case], 0], d6 = [0, [2, cst_and], 0], d7 = [0, [2, cst_or], 0], d8 = [0, [2, cst_let], 0], d9 = [0, [2, "let*"], 0], d_ = [0, [2, cst_lambda], 0], d$ = [0, [2, cst_fn], 0], ea = [0, [2, cst_define], 0], eb = [0, [2, "defcomp"], 0], ec = [0, [2, "defisland"], 0], ed = [0, [2, "defmacro"], 0], ee = [0, [2, "defio"], 0], ef = [0, [2, "io"], 0], eg = [0, [2, cst_begin], 0], eh = [0, [2, "do"], 0], ei = [1, 1.], ej = [1, 1.], ek = [0, [1, 2.], 0], el = [1, 2.], em = [3, cst_do_loop], en = [3, cst_begin], eo = [3, cst_if], ep = [1, 1.], eq = [3, cst_do_loop], er = [3, cst_let], es = [3, cst_begin], et = [0, [2, "guard"], 0], eu = [0, [2, cst_quote], 0], ev = [0, [2, "quasiquote"], 0], ew = [0, [2, "->"], 0], ex = [0, [2, "set!"], 0], ey = [0, [2, "letrec"], 0], ez = [0, [2, cst_reset], 0], eA = [0, [2, "shift"], 0], eB = [0, [2, cst_deref], 0], eC = [0, [2, cst_scope], 0], eD = [0, [2, cst_provide], 0], eE = [0, [2, cst_context], 0], eF = [0, [2, "emit!"], 0], eG = [0, [2, cst_emitted], 0], eH = [0, [2, cst_handler_bind], 0], eI = [0, [2, "restart-case"], 0], eJ = [0, [2, "signal-condition"], 0], eK = [0, [2, "invoke-restart"], 0], eL = [0, [2, "match"], 0], eM = [0, [2, cst_dynamic_wind], 0], eN = [0, [2, cst_map], 0], eO = [0, [2, cst_map_indexed], 0], eP = [0, [2, cst_filter], 0], eQ = [0, [2, cst_reduce], 0], eR = [0, [2, cst_some], 0], eS = [0, [2, cst_every$0], 0], eT = [0, [2, cst_for_each], 0], eU = [0, [2, cst_raise], 0], eV = [0, [2, "raise-continuable"], 0], eW = [0, 1], eX = [0, [2, cst_call_cc], 0], eY = [0, [2, "call-with-current-continuation"], 0], eZ = [0, [2, cst_perform], 0], e0 = [0, [2, "define-library"], 0], e1 = [0, [2, cst_import], 0], e2 = [0, [2, "define-record-type"], 0], e3 = [0, [2, cst_lambda], 0], e4 = [0, [2, cst_list], 0]; function step_eval_list$0(counter, expr$1, env, kont){ var expr = expr$1; for(;;){ var head = Sx_runtime[12].call(null, expr), args = Sx_runtime[13].call(null, expr), c = [0, Sx_runtime[71].call(null, head), dY], or = Sx_runtime[1].call(null, cst, c); if(Sx_types[45].call(null, or)) var or$0 = or; else{ var aJ = [0, Sx_runtime[71].call(null, head), e3], or$1 = Sx_runtime[1].call(null, cst, aJ); if(Sx_types[45].call(null, or$1)) var or$0 = or$1; else var aK = [0, Sx_runtime[71].call(null, head), e4], or$0 = Sx_runtime[1].call(null, cst, aK); } var d = [0, 1 - Sx_types[45].call(null, or$0)]; if(Sx_types[45].call(null, d)){ var e = Sx_runtime[31].call(null, expr); if(Sx_types[45].call(null, e)) return make_cek_value(dZ, env, kont); var f = kont_push (make_map_frame(0, Sx_runtime[13].call(null, expr), d0, env), kont); return make_cek_state(Sx_runtime[12].call(null, expr), env, f); } var g = [0, Sx_runtime[71].call(null, head), d1], h = Sx_runtime[1].call(null, cst, g); if(! Sx_types[45].call(null, h)) return step_eval_call(head, args, env, kont); var match_val = Sx_types[46].call(null, head), i = Sx_runtime[1].call(null, cst, [0, match_val, d2]); if(Sx_types[45].call(null, i)) return step_sf_if(args, env, kont); var j = Sx_runtime[1].call(null, cst, [0, match_val, d3]); if(Sx_types[45].call(null, j)) return step_sf_when(args, env, kont); var k = Sx_runtime[1].call(null, cst, [0, match_val, d4]); if(Sx_types[45].call(null, k)) return step_sf_cond(args, env, kont); var l = Sx_runtime[1].call(null, cst, [0, match_val, d5]); if(Sx_types[45].call(null, l)) return step_sf_case(args, env, kont); var m = Sx_runtime[1].call(null, cst, [0, match_val, d6]); if(Sx_types[45].call(null, m)) return step_sf_and(args, env, kont); var n = Sx_runtime[1].call(null, cst, [0, match_val, d7]); if(Sx_types[45].call(null, n)) return step_sf_or(args, env, kont); var o = Sx_runtime[1].call(null, cst, [0, match_val, d8]); if(Sx_types[45].call(null, o)) return step_sf_let(args, env, kont); var p = Sx_runtime[1].call(null, cst, [0, match_val, d9]); if(Sx_types[45].call(null, p)) return step_sf_let(args, env, kont); var q = Sx_runtime[1].call(null, cst, [0, match_val, d_]); if(Sx_types[45].call(null, q)) return step_sf_lambda(args, env, kont); var r = Sx_runtime[1].call(null, cst, [0, match_val, d$]); if(Sx_types[45].call(null, r)) return step_sf_lambda(args, env, kont); var s = Sx_runtime[1].call(null, cst, [0, match_val, ea]); if(Sx_types[45].call(null, s)) return step_sf_define(args, env, kont); var t = Sx_runtime[1].call(null, cst, [0, match_val, eb]); if(Sx_types[45].call(null, t)) return make_cek_value(sf_defcomp(args, env), env, kont); var u = Sx_runtime[1].call(null, cst, [0, match_val, ec]); if(Sx_types[45].call(null, u)) return make_cek_value(sf_defisland(args, env), env, kont); var v = Sx_runtime[1].call(null, cst, [0, match_val, ed]); if(Sx_types[45].call(null, v)) return make_cek_value(sf_defmacro(args, env), env, kont); var w = Sx_runtime[1].call(null, cst, [0, match_val, ee]); if(Sx_types[45].call(null, w)) return make_cek_value(sf_defio(args, env), env, kont); var x = Sx_runtime[1].call(null, cst, [0, match_val, ef]); if(Sx_types[45].call(null, x)) return step_sf_io(args, env, kont); var y = Sx_runtime[1].call(null, cst, [0, match_val, eg]); if(Sx_types[45].call(null, y)) return step_sf_begin(args, env, kont); var z = Sx_runtime[1].call(null, cst, [0, match_val, eh]); if(! Sx_types[45].call(null, z)) break; var A = Sx_runtime[31].call(null, args), and = [0, 1 - Sx_types[45].call(null, A)]; if(Sx_types[45].call(null, and)){ var B = Sx_runtime[12].call(null, args), and$0 = Sx_runtime[35].call(null, B); if(Sx_types[45].call(null, and$0)){ var C = Sx_runtime[12].call(null, args), D = Sx_runtime[31].call(null, C), and$1 = [0, 1 - Sx_types[45].call(null, D)]; if(Sx_types[45].call(null, and$1)) var E = Sx_runtime[12].call(null, args), F = Sx_runtime[12].call(null, E), a = Sx_runtime[35].call(null, F); else var a = and$1; } else var a = and$0; } else var a = and; if(! Sx_types[45].call(null, a)) return step_sf_begin(args, env, kont); var bindings = Sx_runtime[12].call(null, args), test_clause = Sx_runtime[15].call(null, args, ei), G = Sx_runtime[13].call(null, args), body = Sx_runtime[13].call(null, G), H = Sx_runtime[5].call(null, bindings); Stdlib_List[20].call (null, function(b){return Sx_runtime[12].call(null, b);}, H); var I = Sx_runtime[5].call(null, bindings); Stdlib_List[20].call (null, function(b){return Sx_runtime[15].call(null, b, ej);}, I); var J = Sx_runtime[5].call(null, bindings), steps = [5, Stdlib_List[20].call (null, function(b){ var a = [0, Sx_runtime[22].call(null, b), ek], c = Sx_runtime[1].call(null, cst$5, a); return Sx_types[45].call(null, c) ? Sx_runtime[15].call(null, b, el) : Sx_runtime[12].call(null, b); }, J)], test = Sx_runtime[12].call(null, test_clause), result = Sx_runtime[13].call(null, test_clause), K = [0, body, [0, [5, [0, Sx_runtime[16].call(null, em, steps), 0]], 0]], L = Sx_runtime[1].call(null, cst_append, K), M = [5, [0, Sx_runtime[16].call(null, en, L), 0]], N = Sx_runtime[31].call(null, result), O = Sx_types[45].call(null, N) ? 0 : Sx_runtime[16].call(null, es, result), P = Sx_runtime[16].call(null, O, M), Q = Sx_runtime[16].call(null, test, P), R = [5, [0, Sx_runtime[16].call(null, eo, Q), 0]], S = Sx_runtime[5].call(null, bindings), T = [5, Stdlib_List[20].call (null, function(b){ var a = [0, Sx_runtime[15].call(null, b, ep), 0]; return [5, [0, Sx_runtime[12].call(null, b), a]]; }, S)], U = Sx_runtime[16].call(null, T, R), V = Sx_runtime[16].call(null, eq, U), expr$0 = Sx_runtime[16].call(null, er, V); expr = expr$0; } var W = Sx_runtime[1].call(null, cst, [0, match_val, et]); if(Sx_types[45].call(null, W)) return counter < 50 ? step_sf_guard$0(counter + 1 | 0, args, env, kont) : caml_trampoline_return(step_sf_guard$0, [0, args, env, kont]); var X = Sx_runtime[1].call(null, cst, [0, match_val, eu]); if(Sx_types[45].call(null, X)){ var Y = Sx_runtime[31].call(null, args), Z = Sx_types[45].call(null, Y) ? 0 : Sx_runtime[12].call(null, args); return make_cek_value(Z, env, kont); } var _ = Sx_runtime[1].call(null, cst, [0, match_val, ev]); if(Sx_types[45].call(null, _)) return make_cek_value (qq_expand(Sx_runtime[12].call(null, args), env), env, kont); var $ = Sx_runtime[1].call(null, cst, [0, match_val, ew]); if(Sx_types[45].call(null, $)) return step_sf_thread_first(args, env, kont); var aa = Sx_runtime[1].call(null, cst, [0, match_val, ex]); if(Sx_types[45].call(null, aa)) return step_sf_set_b(args, env, kont); var ab = Sx_runtime[1].call(null, cst, [0, match_val, ey]); if(Sx_types[45].call(null, ab)) return step_sf_letrec(args, env, kont); var ac = Sx_runtime[1].call(null, cst, [0, match_val, ez]); if(Sx_types[45].call(null, ac)) return step_sf_reset(args, env, kont); var ad = Sx_runtime[1].call(null, cst, [0, match_val, eA]); if(Sx_types[45].call(null, ad)) return step_sf_shift(args, env, kont); var ae = Sx_runtime[1].call(null, cst, [0, match_val, eB]); if(Sx_types[45].call(null, ae)) return step_sf_deref(args, env, kont); var af = Sx_runtime[1].call(null, cst, [0, match_val, eC]); if(Sx_types[45].call(null, af)) return step_sf_scope(args, env, kont); var ag = Sx_runtime[1].call(null, cst, [0, match_val, eD]); if(Sx_types[45].call(null, ag)) return step_sf_provide(args, env, kont); var ah = Sx_runtime[1].call(null, cst, [0, match_val, eE]); if(Sx_types[45].call(null, ah)) return step_sf_context(args, env, kont); var ai = Sx_runtime[1].call(null, cst, [0, match_val, eF]); if(Sx_types[45].call(null, ai)) return step_sf_emit(args, env, kont); var aj = Sx_runtime[1].call(null, cst, [0, match_val, eG]); if(Sx_types[45].call(null, aj)) return step_sf_emitted(args, env, kont); var ak = Sx_runtime[1].call(null, cst, [0, match_val, eH]); if(Sx_types[45].call(null, ak)) return step_sf_handler_bind(args, env, kont); var al = Sx_runtime[1].call(null, cst, [0, match_val, eI]); if(Sx_types[45].call(null, al)) return step_sf_restart_case(args, env, kont); var am = Sx_runtime[1].call(null, cst, [0, match_val, eJ]); if(Sx_types[45].call(null, am)) return step_sf_signal(args, env, kont); var an = Sx_runtime[1].call(null, cst, [0, match_val, eK]); if(Sx_types[45].call(null, an)) return step_sf_invoke_restart(args, env, kont); var ao = Sx_runtime[1].call(null, cst, [0, match_val, eL]); if(Sx_types[45].call(null, ao)) return step_sf_match(args, env, kont); var ap = Sx_runtime[1].call(null, cst, [0, match_val, eM]); if(Sx_types[45].call(null, ap)) return make_cek_value(sf_dynamic_wind(args, env), env, kont); var aq = Sx_runtime[1].call(null, cst, [0, match_val, eN]); if(Sx_types[45].call(null, aq)) return step_ho_map(args, env, kont); var ar = Sx_runtime[1].call(null, cst, [0, match_val, eO]); if(Sx_types[45].call(null, ar)) return step_ho_map_indexed(args, env, kont); var as = Sx_runtime[1].call(null, cst, [0, match_val, eP]); if(Sx_types[45].call(null, as)) return step_ho_filter(args, env, kont); var at = Sx_runtime[1].call(null, cst, [0, match_val, eQ]); if(Sx_types[45].call(null, at)) return step_ho_reduce(args, env, kont); var au = Sx_runtime[1].call(null, cst, [0, match_val, eR]); if(Sx_types[45].call(null, au)) return step_ho_some(args, env, kont); var av = Sx_runtime[1].call(null, cst, [0, match_val, eS]); if(Sx_types[45].call(null, av)) return step_ho_every(args, env, kont); var aw = Sx_runtime[1].call(null, cst, [0, match_val, eT]); if(Sx_types[45].call(null, aw)) return step_ho_for_each(args, env, kont); var ax = Sx_runtime[1].call(null, cst, [0, match_val, eU]); if(Sx_types[45].call(null, ax)) return step_sf_raise(args, env, kont); var ay = Sx_runtime[1].call(null, cst, [0, match_val, eV]); if(Sx_types[45].call(null, ay)){ var az = kont_push(make_raise_eval_frame(env, eW), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, az); } var aA = Sx_runtime[1].call(null, cst, [0, match_val, eX]); if(Sx_types[45].call(null, aA)) return step_sf_callcc(args, env, kont); var aB = Sx_runtime[1].call(null, cst, [0, match_val, eY]); if(Sx_types[45].call(null, aB)) return step_sf_callcc(args, env, kont); var aC = Sx_runtime[1].call(null, cst, [0, match_val, eZ]); if(Sx_types[45].call(null, aC)) return step_sf_perform(args, env, kont); var aD = Sx_runtime[1].call(null, cst, [0, match_val, e0]); if(Sx_types[45].call(null, aD)) return step_sf_define_library(args, env, kont); var aE = Sx_runtime[1].call(null, cst, [0, match_val, e1]); if(Sx_types[45].call(null, aE)) return step_sf_import(args, env, kont); var aF = Sx_runtime[1].call(null, cst, [0, match_val, e2]); if(Sx_types[45].call(null, aF)) return make_cek_value(sf_define_record_type(args, env), env, kont); var aG = Sx_runtime[1].call (null, cst_has_key, [0, custom_special_forms, [0, match_val, 0]]); if(Sx_types[45].call(null, aG)) return make_cek_value (cek_call (Sx_runtime[23].call(null, custom_special_forms, match_val), [5, [0, args, [0, env, 0]]]), env, kont); var and$2 = Sx_runtime[73].call(null, env, match_val); if(Sx_types[45].call(null, and$2)) var aH = Sx_runtime[74].call(null, env, match_val), b = Sx_runtime[86].call(null, aH); else var b = and$2; if(Sx_types[45].call(null, b)){ var mac = Sx_runtime[74].call(null, env, match_val); return make_cek_state(expand_macro(mac, args, env), env, kont); } var aI = Sx_types[45].call(null, render_check) ? cek_call(render_check, [5, [0, expr, [0, env, 0]]]) : render_check; return Sx_types[45].call(null, aI) ? make_cek_value (cek_call(render_fn, [5, [0, expr, [0, env, 0]]]), env, kont) : step_eval_call(head, args, env, kont); } function step_eval_list(expr, env, kont){ return caml_trampoline(step_eval_list$0(0, expr, env, kont)); } var e5 = [5, 0], e6 = [5, 0], e7 = [0, [2, "export"], 0], e8 = [0, [2, cst_begin], 0]; function step_sf_define_library(args, env, kont){ var lib_spec = Sx_runtime[12].call(null, args), decls = Sx_runtime[13].call(null, args), lib_env = Sx_runtime[78].call(null, env), a = Sx_runtime[5].call(null, decls), exports = [0, e5], body_forms = [0, e6]; Stdlib_List[18].call (null, function(decl){ var and = Sx_runtime[35].call(null, decl); if(Sx_types[45].call(null, and)){ var b = Sx_runtime[31].call(null, decl), and$0 = [0, 1 - Sx_types[45].call(null, b)]; if(Sx_types[45].call(null, and$0)) var c = Sx_runtime[12].call(null, decl), a = Sx_runtime[37].call(null, c); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)){ var d = Sx_runtime[12].call(null, decl), kind = Sx_types[46].call(null, d), e = Sx_runtime[1].call(null, cst, [0, kind, e7]); if(Sx_types[45].call(null, e)){ var f = Sx_runtime[13].call(null, decl), g = Sx_runtime[5].call(null, f), h = [0, [5, Stdlib_List[20].call (null, function(s){ var a = Sx_runtime[37].call(null, s); return Sx_types[45].call(null, a) ? Sx_types[46].call(null, s) : [2, Sx_runtime[4].call(null, [0, s, 0])]; }, g)], 0]; exports[1] = Sx_runtime[1].call(null, cst_append, [0, exports[1], h]); } else{ var i = Sx_runtime[1].call(null, cst, [0, kind, e8]); if(Sx_types[45].call(null, i)){ var j = [0, Sx_runtime[13].call(null, decl), 0]; body_forms[1] = Sx_runtime[1].call(null, cst_append, [0, body_forms[1], j]); } } } return 0; }, a); var b = Sx_runtime[5].call(null, body_forms[1]); Stdlib_List[18].call (null, function(form){eval_expr(form, lib_env); return 0;}, b); var export_dict = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], c = Sx_runtime[5].call(null, exports[1]); Stdlib_List[18].call (null, function(name){ var a = Sx_runtime[73].call(null, lib_env, name); if(Sx_types[45].call(null, a)){ var b = Sx_runtime[74].call(null, lib_env, name); Sx_runtime[9].call(null, export_dict, name, b); } return 0; }, c); register_library(lib_spec, export_dict); return make_cek_value(0, env, kont); } var cst_except = "except", cst_only = "only", cst_prefix = "prefix", cst_rename = "rename", e9 = [0, [2, cst_only], 0], e_ = [1, 1.], e$ = [0, [2, cst_only], 0], fa = [0, [2, cst_prefix], 0], fb = [1, 2.], fc = [0, [2, cst_except], 0], fd = [0, [2, cst_prefix], 0], fe = [0, [2, cst_rename], 0]; function bind_import_set(import_set, env){ var and = Sx_runtime[35].call(null, import_set); if(Sx_types[45].call(null, and)){ var b = Sx_runtime[31].call(null, import_set), and$0 = [0, 1 - Sx_types[45].call(null, b)]; if(Sx_types[45].call(null, and$0)) var c = Sx_runtime[12].call(null, import_set), a = Sx_runtime[37].call(null, c); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)) var d = Sx_runtime[12].call(null, import_set), head = Sx_types[46].call(null, d); else var head = 0; var or = Sx_runtime[1].call(null, cst, [0, head, e9]); if(Sx_types[45].call(null, or)) var or$0 = or; else{ var or$1 = Sx_runtime[1].call(null, cst, [0, head, fc]); if(Sx_types[45].call(null, or$1)) var or$0 = or$1; else var or$2 = Sx_runtime[1].call(null, cst, [0, head, fd]), or$0 = Sx_types[45].call(null, or$2) ? or$2 : Sx_runtime[1].call(null, cst, [0, head, fe]); } var lib_spec = Sx_types[45].call(null, or$0) ? Sx_runtime[15].call(null, import_set, e_) : import_set, exports = library_exports(lib_spec), e = Sx_runtime[1].call(null, cst, [0, head, e$]); if(Sx_types[45].call(null, e)){ var f = Sx_runtime[13].call(null, import_set), g = Sx_runtime[13].call(null, f), h = Sx_runtime[5].call(null, g); Stdlib_List[18].call (null, function(s){ var a = Sx_runtime[37].call(null, s), id = Sx_types[45].call(null, a) ? Sx_types[46].call(null, s) : [2, Sx_runtime[4].call(null, [0, s, 0])], b = Sx_runtime[1].call(null, cst_has_key, [0, exports, [0, id, 0]]); if(Sx_types[45].call(null, b)){ var c = Sx_runtime[23].call(null, exports, id), d = Sx_runtime[3].call(null, id); Sx_runtime[75].call(null, env, d, c); } return 0; }, h); return 0; } var i = Sx_runtime[1].call(null, cst, [0, head, fa]); if(Sx_types[45].call(null, i)){ var j = [0, Sx_runtime[15].call(null, import_set, fb), 0], pfx = [2, Sx_runtime[4].call(null, j)], k = Sx_runtime[1].call(null, cst_keys, [0, exports, 0]), l = Sx_runtime[5].call(null, k); Stdlib_List[18].call (null, function(key){ var a = Sx_runtime[23].call(null, exports, key), b = [2, Sx_runtime[4].call(null, [0, pfx, [0, key, 0]])], c = Sx_runtime[3].call(null, b); Sx_runtime[75].call(null, env, c, a); return 0; }, l); return 0; } var m = Sx_runtime[1].call(null, cst_keys, [0, exports, 0]), n = Sx_runtime[5].call(null, m); Stdlib_List[18].call (null, function(key){ var a = Sx_runtime[23].call(null, exports, key), b = Sx_runtime[3].call(null, key); Sx_runtime[75].call(null, env, b, a); return 0; }, n); return 0; } var ff = [0, [2, cst_only], 0], fg = [1, 1.], fh = [2, cst_import], fi = [0, [2, cst_except], 0], fj = [0, [2, cst_prefix], 0], fk = [0, [2, cst_rename], 0]; function step_sf_import(args$0, env, kont){ var args = args$0; for(;;){ var b = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, b)) return make_cek_value(0, env, kont); var import_set = Sx_runtime[12].call(null, args), rest_sets = Sx_runtime[13].call(null, args), and = Sx_runtime[35].call(null, import_set); if(Sx_types[45].call(null, and)){ var c = Sx_runtime[31].call(null, import_set), and$0 = [0, 1 - Sx_types[45].call(null, c)]; if(Sx_types[45].call(null, and$0)) var e = Sx_runtime[12].call(null, import_set), a = Sx_runtime[37].call(null, e); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)) var f = Sx_runtime[12].call(null, import_set), head = Sx_types[46].call(null, f); else var head = 0; var or = Sx_runtime[1].call(null, cst, [0, head, ff]); if(Sx_types[45].call(null, or)) var or$0 = or; else{ var or$1 = Sx_runtime[1].call(null, cst, [0, head, fi]); if(Sx_types[45].call(null, or$1)) var or$0 = or$1; else var or$2 = Sx_runtime[1].call(null, cst, [0, head, fj]), or$0 = Sx_types[45].call(null, or$2) ? or$2 : Sx_runtime[1].call(null, cst, [0, head, fk]); } var lib_spec = Sx_types[45].call(null, or$0) ? Sx_runtime[15].call(null, import_set, fg) : import_set, g = library_loaded_p(lib_spec); if(! Sx_types[45].call(null, g)){ var i = kont_push(make_import_frame(import_set, rest_sets, env), kont), d = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d, "library", lib_spec); Stdlib_Hashtbl[11].call(null, d, cst_op, fh); return make_cek_suspended([6, d], env, i); } bind_import_set(import_set, env); var h = Sx_runtime[31].call(null, rest_sets); if(Sx_types[45].call(null, h)) return make_cek_value(0, env, kont); args = rest_sets; } } var fl = [2, "perform requires an IO request argument"]; function step_sf_perform(args, env, kont){ var a = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, a)){ var b = Sx_runtime[2].call(null, fl); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } var c = kont_push(make_perform_frame(env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, c); } var fm = [1, 1.], fn = [1, 2.], fo = [0, [1, 3.], 0], fp = [0, [2, cst$4], 0], fq = [0, [2, cst$5], 0], fr = [0, [1, 1.], 0], fs = [1, 1.], ft = [1, 1.], fu = [0, [1, 3.], 0], fv = [1, 2.]; function sf_define_record_type(args, env){ var type_sym = Sx_runtime[12].call(null, args), ctor_spec = Sx_runtime[15].call(null, args, fm), pred_sym = Sx_runtime[15].call(null, args, fn), field_specs = Sx_runtime[1].call(null, cst_slice, [0, args, fo]), raw_name = Sx_types[46].call(null, type_sym), and = Sx_runtime[1].call(null, cst_starts_with, [0, raw_name, fp]), a = Sx_types[45].call(null, and) ? Sx_runtime[1].call(null, cst_ends_with, [0, raw_name, fq]) : and; if(Sx_types[45].call(null, a)) var b = [0, Sx_runtime[22].call(null, raw_name), fr], c = [0, raw_name, [0, fs, [0, Sx_runtime[1].call(null, cst$1, b), 0]]], type_name = Sx_runtime[1].call(null, cst_slice, c); else var type_name = raw_name; var d = Sx_runtime[12].call(null, ctor_spec), ctor_name = Sx_types[46].call(null, d), e = Sx_runtime[13].call(null, ctor_spec), f = Sx_runtime[5].call(null, e), ctor_params = [5, Stdlib_List[20].call (null, function(s){return Sx_types[46].call(null, s);}, f)], pred_name = Sx_types[46].call(null, pred_sym), g = Sx_runtime[5].call(null, field_specs), field_names = [5, Stdlib_List[20].call (null, function(fs){ var a = Sx_runtime[12].call(null, fs); return Sx_types[46].call(null, a); }, g)], rtd_uid = Sx_types[69].call(null, type_name, field_names, ctor_params), h = Sx_types[75].call(null, rtd_uid), i = Sx_runtime[3].call(null, ctor_name); Sx_runtime[75].call(null, env, i, h); var j = Sx_types[76].call(null, rtd_uid), k = Sx_runtime[3].call(null, pred_name); Sx_runtime[75].call(null, env, k, j); Sx_runtime[91].call (null, [14, cst$7, function(args){ if(args){ var a = args[2]; if(a && ! a[2]){ var fs = a[1], idx = args[1], b = Sx_runtime[15].call(null, fs, ft), accessor_name = Sx_types[46].call(null, b), c = Sx_types[77].call(null, idx), d = Sx_runtime[3].call(null, accessor_name); Sx_runtime[75].call(null, env, d, c); var e = [0, Sx_runtime[22].call(null, fs), fu], f = Sx_runtime[1].call(null, cst$12, e); if(! Sx_types[45].call(null, f)) return 0; var g = Sx_runtime[15].call(null, fs, fv), mutator_name = Sx_types[46].call(null, g), h = Sx_types[78].call(null, idx), i = Sx_runtime[3].call(null, mutator_name); return Sx_runtime[75].call(null, env, i, h); } } return 0; }], field_specs); return 0; } function step_sf_callcc(args, env, kont){ var a = kont_push(make_callcc_frame(env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var fw = [1, 1.]; function match_find_clause(val, clauses$1, env){ var clauses = clauses$1; for(;;){ var a = Sx_runtime[31].call(null, clauses); if(Sx_types[45].call(null, a)) return 0; var clause = Sx_runtime[12].call(null, clauses), pattern = Sx_runtime[12].call(null, clause), body = Sx_runtime[15].call(null, clause, fw), local = Sx_runtime[78].call(null, env), b = match_pattern(pattern, val, local); if(Sx_types[45].call(null, b)) return [5, [0, local, [0, body, 0]]]; var clauses$0 = Sx_runtime[13].call(null, clauses); clauses = clauses$0; } } var fx = [0, [3, cst$13], 0], fy = [0, 1], fz = [0, [1, 2.], 0], fA = [0, [3, cst$0], 0], fB = [1, 1.], fC = [0, [3, cst_quote], 0], fD = [1, 1.], fE = [0, 1], fF = [0, 0], fG = [1, 1.]; function match_pattern(pattern, value, env){ var c = Sx_runtime[1].call(null, cst, [0, pattern, fx]); if(Sx_types[45].call(null, c)) return fy; var and = Sx_runtime[35].call(null, pattern); if(Sx_types[45].call(null, and)){ var d = [0, Sx_runtime[22].call(null, pattern), fz], and$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and$0)) var e = [0, Sx_runtime[12].call(null, pattern), fA], a = Sx_runtime[1].call(null, cst, e); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)){ var pred = trampoline(eval_expr(Sx_runtime[15].call(null, pattern, fB), env)); return cek_call(pred, [5, [0, value, 0]]); } var and$1 = Sx_runtime[35].call(null, pattern); if(Sx_types[45].call(null, and$1)){ var f = Sx_runtime[31].call(null, pattern), and$2 = [0, 1 - Sx_types[45].call(null, f)]; if(Sx_types[45].call(null, and$2)) var g = [0, Sx_runtime[12].call(null, pattern), fC], b = Sx_runtime[1].call(null, cst, g); else var b = and$2; } else var b = and$1; if(Sx_types[45].call(null, b)){ var h = [0, value, [0, Sx_runtime[15].call(null, pattern, fD), 0]]; return Sx_runtime[1].call(null, cst, h); } var i = Sx_runtime[37].call(null, pattern); if(Sx_types[45].call(null, i)){ var j = Sx_types[46].call(null, pattern), k = Sx_runtime[3].call(null, j); Sx_runtime[75].call(null, env, k, value); return fE; } var and$3 = Sx_runtime[35].call(null, pattern), l = Sx_types[45].call(null, and$3) ? Sx_runtime[35].call(null, value) : and$3; if(! Sx_types[45].call(null, l)) return Sx_runtime[1].call(null, cst, [0, pattern, [0, value, 0]]); var m = [0, Sx_runtime[22].call(null, value), 0], n = [0, Sx_runtime[22].call(null, pattern), m], o = Sx_runtime[1].call(null, cst, n), p = [0, 1 - Sx_types[45].call(null, o)]; if(Sx_types[45].call(null, p)) return fF; var pairs = Sx_runtime[1].call(null, cst_zip, [0, pattern, [0, value, 0]]), q = Sx_runtime[5].call(null, pairs); return [0, Stdlib_List[33].call (null, function(pair){ var a = Sx_runtime[15].call(null, pair, fG), b = match_pattern(Sx_runtime[12].call(null, pair), a, env); return Sx_types[45].call(null, b); }, q)]; } var fH = [2, "match: no clause matched "], fI = [1, 1.]; function step_sf_match(args, env, kont){ var val = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), clauses = Sx_runtime[13].call(null, args), result = match_find_clause(val, clauses, env), a = Sx_runtime[81].call(null, result); if(Sx_types[45].call(null, a)){ var b = [0, fH, [0, Sx_runtime[66].call(null, val), 0]], c = [2, Sx_runtime[4].call(null, b)], d = Sx_runtime[2].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[7], d], 1); } var e = Sx_runtime[12].call(null, result); return make_cek_state(Sx_runtime[15].call(null, result, fI), e, kont); } var fJ = [1, 1.]; function step_sf_handler_bind(args, env, kont){ var handler_specs = Sx_runtime[12].call(null, args), body = Sx_runtime[13].call(null, args), a = Sx_runtime[5].call(null, handler_specs), handlers = [5, Stdlib_List[20].call (null, function(spec){ var a = [0, trampoline(eval_expr(Sx_runtime[15].call(null, spec, fJ), env)), 0]; return [5, [0, trampoline(eval_expr(Sx_runtime[12].call(null, spec), env)), a]]; }, a)], b = Sx_runtime[31].call(null, body); if(Sx_types[45].call(null, b)) return make_cek_value(0, env, kont); var c = kont_push (make_handler_frame(handlers, Sx_runtime[13].call(null, body), env), kont); return make_cek_state(Sx_runtime[12].call(null, body), env, c); } var fK = [1, 2.], fL = [1, 1.], fM = [5, 0]; function step_sf_restart_case(args, env, kont){ var body = Sx_runtime[12].call(null, args), restart_specs = Sx_runtime[13].call(null, args), a = Sx_runtime[5].call(null, restart_specs), restarts = [5, Stdlib_List[20].call (null, function(spec){ var b = [0, Sx_runtime[15].call(null, spec, fK), 0], c = [0, Sx_runtime[15].call(null, spec, fL), b], d = Sx_runtime[12].call(null, spec), e = Sx_runtime[37].call(null, d); if(Sx_types[45].call(null, e)) var f = Sx_runtime[12].call(null, spec), a = Sx_types[46].call(null, f); else var a = Sx_runtime[12].call(null, spec); return [5, [0, a, c]]; }, a)]; return make_cek_state (body, env, kont_push(make_restart_frame(restarts, fM, env), kont)); } var fN = [2, "Unhandled condition: "]; function step_sf_signal(args, env, kont){ var condition = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), handler_fn = kont_find_handler(kont, condition), a = Sx_runtime[81].call(null, handler_fn); if(! Sx_types[45].call(null, a)) return continue_with_call (handler_fn, [5, [0, condition, 0]], env, [5, [0, condition, 0]], kont_push(make_signal_return_frame(env, kont), kont)); var b = [0, fN, [0, Sx_runtime[66].call(null, condition), 0]], c = [2, Sx_runtime[4].call(null, b)], d = Sx_runtime[2].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[7], d], 1); } var fO = [0, [1, 2.], 0], fP = [1, 1.], fQ = [2, "No restart named: "], fR = [1, 1.], fS = [1, 2.], fT = [1, 1.], fU = [1, 2.], fV = [2, cst_env]; function step_sf_invoke_restart(args, env, kont){ var a = Sx_runtime[12].call(null, args), b = Sx_runtime[37].call(null, a); if(Sx_types[45].call(null, b)) var c = Sx_runtime[12].call(null, args), rn = Sx_types[46].call(null, c); else var rn = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)); var d = Sx_runtime[37].call(null, rn), restart_name = Sx_types[45].call(null, d) ? Sx_types[46].call(null, rn) : rn, e = [0, Sx_runtime[22].call(null, args), fO], f = Sx_runtime[1].call(null, cst$12, e), restart_arg = Sx_types[45].call(null, f) ? trampoline(eval_expr(Sx_runtime[15].call(null, args, fP), env)) : 0, found = kont_find_restart(kont, restart_name), g = Sx_runtime[81].call(null, found); if(Sx_types[45].call(null, g)){ var h = [0, fQ, [0, Sx_runtime[66].call(null, restart_name), 0]], i = [2, Sx_runtime[4].call(null, h)], j = Sx_runtime[2].call(null, i); throw caml_maybe_attach_backtrace([0, Sx_types[7], j], 1); } var entry = Sx_runtime[12].call(null, found), restart_frame = Sx_runtime[15].call(null, found, fR), rest_kont = Sx_runtime[15].call(null, found, fS), params = Sx_runtime[15].call(null, entry, fT), body = Sx_runtime[15].call(null, entry, fU), k = Sx_runtime[23].call(null, restart_frame, fV), restart_env = Sx_runtime[78].call(null, k), l = Sx_runtime[31].call(null, params), m = [0, 1 - Sx_types[45].call(null, l)]; if(Sx_types[45].call(null, m)){ var n = Sx_runtime[12].call(null, params), o = Sx_runtime[3].call(null, n); Sx_runtime[75].call(null, restart_env, o, restart_arg); } return make_cek_state(body, restart_env, rest_kont); } var fW = [0, [1, 2.], 0], fX = [1, 2.], fY = [1, 1.]; function step_sf_if(args, env, kont){ var a = [0, Sx_runtime[22].call(null, args), fW], b = Sx_runtime[1].call(null, cst$5, a), c = Sx_types[45].call(null, b) ? Sx_runtime[15].call(null, args, fX) : 0, d = kont_push (make_if_frame(Sx_runtime[15].call(null, args, fY), c, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, d); } function step_sf_when(args, env, kont){ var a = kont_push(make_when_frame(Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var fZ = [0, [1, 1.], 0]; function step_sf_begin(args, env, kont){ var a = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, a)) return make_cek_value(0, env, kont); var b = [0, Sx_runtime[22].call(null, args), fZ], c = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, c)) return make_cek_state(Sx_runtime[12].call(null, args), env, kont); var d = kont_push(make_begin_frame(Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, d); } var f0 = [0, [2, cst_symbol], 0], f1 = [0, [2, cst_list], 0], f2 = [0, [1, 2.], 0], f3 = [0, [2, cst_list], 0], f4 = [0, [1, 2.], 0], f5 = [0, [2, cst_symbol], 0], f6 = [1, 1.], f7 = [5, 0], f8 = [0, [1, 2.], 0], f9 = [1, 1.], f_ = [0, [1, 2.], 0], f$ = [0, [1, 2.], 0], ga = [1, 1.]; function step_sf_let(args, env, kont){ var c = Sx_runtime[12].call(null, args), d = [0, Sx_runtime[71].call(null, c), f0], e = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, e)) return make_cek_value(sf_named_let(args, env), env, kont); var bindings = Sx_runtime[12].call(null, args), body = Sx_runtime[13].call(null, args), local = Sx_runtime[78].call(null, env), f = Sx_runtime[31].call(null, bindings); if(Sx_types[45].call(null, f)) return step_sf_begin(body, local, kont); var g = Sx_runtime[12].call(null, bindings), h = [0, Sx_runtime[71].call(null, g), f1], and = Sx_runtime[1].call(null, cst, h); if(Sx_types[45].call(null, and)) var i = Sx_runtime[12].call(null, bindings), j = [0, Sx_runtime[22].call(null, i), f2], a = Sx_runtime[1].call(null, cst, j); else var a = and; if(Sx_types[45].call(null, a)) var first_binding = Sx_runtime[12].call(null, bindings); else var x = [0, Sx_runtime[15].call(null, bindings, ga), 0], first_binding = [5, [0, Sx_runtime[12].call(null, bindings), x]]; var k = Sx_runtime[12].call(null, bindings), l = [0, Sx_runtime[71].call(null, k), f3], and$0 = Sx_runtime[1].call(null, cst, l); if(Sx_types[45].call(null, and$0)) var m = Sx_runtime[12].call(null, bindings), n = [0, Sx_runtime[22].call(null, m), f4], b = Sx_runtime[1].call(null, cst, n); else var b = and$0; if(Sx_types[45].call(null, b)) var rest_bindings = Sx_runtime[13].call(null, bindings); else{ var t = [0, Sx_runtime[22].call(null, bindings), f8], u = [0, f9, [0, Sx_runtime[1].call(null, cst$10, t), 0]], v = Sx_runtime[1].call(null, cst_range, u), w = Sx_runtime[5].call(null, v), pairs = [0, f7]; Stdlib_List[26].call (null, function(acc, i){ var a = [0, Sx_runtime[1].call(null, cst$9, [0, i, f_]), 0], b = Sx_runtime[1].call(null, cst_inc, a), c = [0, Sx_runtime[15].call(null, bindings, b), 0], d = Sx_runtime[1].call(null, cst$9, [0, i, f$]), e = [5, [0, Sx_runtime[15].call(null, bindings, d), c]]; pairs[1] = Sx_runtime[8].call(null, pairs[1], e); return 0; }, 0, w); var rest_bindings = pairs[1]; } var o = Sx_runtime[12].call(null, first_binding), p = [0, Sx_runtime[71].call(null, o), f5], q = Sx_runtime[1].call(null, cst, p); if(Sx_types[45].call(null, q)) var r = Sx_runtime[12].call(null, first_binding), vname = Sx_types[46].call(null, r); else var vname = Sx_runtime[12].call(null, first_binding); var s = kont_push(make_let_frame(vname, rest_bindings, body, local), kont); return make_cek_state (Sx_runtime[15].call(null, first_binding, f6), local, s); } var gb = [0, [1, 4.], 0], gc = [0, [2, cst_keyword], 0], gd = [1, 1.], ge = [0, [2, cst_effects], 0], gf = [1, 1.], gg = [0, [1, 4.], 0], gh = [0, [2, cst_keyword], 0], gi = [1, 1.], gj = [0, [2, cst_effects], 0], gk = [1, 1.], gl = [1, 3.], gm = [0, [1, 4.], 0], gn = [0, [2, cst_keyword], 0], go = [1, 1.], gp = [0, [2, cst_effects], 0], gq = [1, 1.], gr = [1, 2.], gs = [1, 1.]; function step_sf_define(args, env, kont){ var name_sym = Sx_runtime[12].call(null, args), c = [0, Sx_runtime[22].call(null, args), gb], and = Sx_runtime[1].call(null, cst$12, c); if(Sx_types[45].call(null, and)){ var d = Sx_runtime[15].call(null, args, gd), e = [0, Sx_runtime[71].call(null, d), gc], and$0 = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, and$0)) var f = Sx_runtime[15].call(null, args, gf), g = [0, Sx_types[47].call(null, f), ge], has_effects = Sx_runtime[1].call(null, cst, g); else var has_effects = and$0; } else var has_effects = and; var h = [0, Sx_runtime[22].call(null, args), gg], and$1 = Sx_runtime[1].call(null, cst$12, h); if(Sx_types[45].call(null, and$1)){ var i = Sx_runtime[15].call(null, args, gi), j = [0, Sx_runtime[71].call(null, i), gh], and$2 = Sx_runtime[1].call(null, cst, j); if(Sx_types[45].call(null, and$2)) var k = Sx_runtime[15].call(null, args, gk), l = [0, Sx_types[47].call(null, k), gj], a = Sx_runtime[1].call(null, cst, l); else var a = and$2; } else var a = and$1; var val_idx = Sx_types[45].call(null, a) ? gl : gs, m = [0, Sx_runtime[22].call(null, args), gm], and$3 = Sx_runtime[1].call(null, cst$12, m); if(Sx_types[45].call(null, and$3)){ var n = Sx_runtime[15].call(null, args, go), o = [0, Sx_runtime[71].call(null, n), gn], and$4 = Sx_runtime[1].call(null, cst, o); if(Sx_types[45].call(null, and$4)) var p = Sx_runtime[15].call(null, args, gq), q = [0, Sx_types[47].call(null, p), gp], b = Sx_runtime[1].call(null, cst, q); else var b = and$4; } else var b = and$3; var effect_list = Sx_types[45].call(null, b) ? Sx_runtime[15].call(null, args, gr) : 0, r = kont_push (make_define_frame (Sx_types[46].call(null, name_sym), env, has_effects, effect_list), kont); return make_cek_state(Sx_runtime[15].call(null, args, val_idx), env, r); } var gt = [1, 1.]; function step_sf_set_b(args, env, kont){ var a = Sx_runtime[12].call(null, args), b = kont_push(make_set_frame(Sx_types[46].call(null, a), env), kont); return make_cek_state(Sx_runtime[15].call(null, args, gt), env, b); } var gu = [0, 1]; function step_sf_and(args, env, kont){ var a = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, a)) return make_cek_value(gu, env, kont); var b = kont_push(make_and_frame(Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, b); } var gv = [0, 0]; function step_sf_or(args, env, kont){ var a = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, a)) return make_cek_value(gv, env, kont); var b = kont_push(make_or_frame(Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, b); } var gw = [1, 1.], gx = [0, 1], gy = [0, [1, 2.], 0], gz = [1, 1.], gA = [0, 0]; function step_sf_cond(args, env, kont){ var scheme_p = cond_scheme_p(args); if(Sx_types[45].call(null, scheme_p)){ var a = Sx_runtime[31].call(null, args); if(Sx_types[45].call(null, a)) return make_cek_value(0, env, kont); var clause = Sx_runtime[12].call(null, args), test = Sx_runtime[12].call(null, clause), b = is_else_clause(test); return Sx_types[45].call(null, b) ? make_cek_state (Sx_runtime[15].call(null, clause, gw), env, kont) : make_cek_state (test, env, kont_push(make_cond_frame(args, env, gx), kont)); } var c = [0, Sx_runtime[22].call(null, args), gy], d = Sx_runtime[1].call(null, cst$4, c); if(Sx_types[45].call(null, d)) return make_cek_value(0, env, kont); var test$0 = Sx_runtime[12].call(null, args), e = is_else_clause(test$0); return Sx_types[45].call(null, e) ? make_cek_state(Sx_runtime[15].call(null, args, gz), env, kont) : make_cek_state (test$0, env, kont_push(make_cond_frame(args, env, gA), kont)); } function step_sf_case(args, env, kont){ var a = kont_push (make_case_frame(0, Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } function step_sf_thread_first(args, env, kont){ var a = kont_push (make_thread_frame(Sx_runtime[13].call(null, args), env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } function step_sf_lambda(args, env, kont){ return make_cek_value(sf_lambda(args, env), env, kont); } var gB = [0, [1, 1.], 0], gC = [0, [1, 2.], 0], gD = [0, [2, cst_keyword], 0], gE = [0, [2, cst_value], 0], gF = [1, 1.], gG = [0, [1, 2.], 0]; function step_sf_scope(args, env, kont){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), rest_args = Sx_runtime[1].call(null, cst_slice, [0, args, gB]), b = [0, Sx_runtime[22].call(null, rest_args), gC], and = Sx_runtime[1].call(null, cst$12, b); if(Sx_types[45].call(null, and)){ var c = Sx_runtime[12].call(null, rest_args), d = [0, Sx_runtime[71].call(null, c), gD], and$0 = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and$0)) var e = Sx_runtime[12].call(null, rest_args), f = [0, Sx_types[47].call(null, e), gE], a = Sx_runtime[1].call(null, cst, f); else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)) var g = trampoline(eval_expr(Sx_runtime[15].call(null, rest_args, gF), env)), body = Sx_runtime[1].call(null, cst_slice, [0, rest_args, gG]), val = g; else var body = rest_args, val = 0; var h = Sx_runtime[31].call(null, body); if(Sx_types[45].call(null, h)) return make_cek_value(0, env, kont); var i = kont_push (make_scope_acc_frame(name, val, Sx_runtime[13].call(null, body), env), kont); return make_cek_state(Sx_runtime[12].call(null, body), env, i); } var gH = [1, 1.], gI = [0, [1, 2.], 0]; function step_sf_provide(args, env, kont){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), val = trampoline(eval_expr(Sx_runtime[15].call(null, args, gH), env)), body = Sx_runtime[1].call(null, cst_slice, [0, args, gI]), a = Sx_runtime[31].call(null, body); if(Sx_types[45].call(null, a)) return make_cek_value(0, env, kont); var b = kont_push (make_provide_frame(name, val, Sx_runtime[13].call(null, body), env), kont); return make_cek_state(Sx_runtime[12].call(null, body), env, b); } var gJ = [0, [1, 2.], 0], gK = [1, 1.], gL = [2, cst_value], gM = [2, cst_context], gN = [2, cst_context]; function step_sf_context(args, env, kont){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), b = [0, Sx_runtime[22].call(null, args), gJ], c = Sx_runtime[1].call(null, cst$12, b), default_val = Sx_types[45].call(null, c) ? trampoline(eval_expr(Sx_runtime[15].call(null, args, gK), env)) : 0, frame = kont_find_provide(kont, name); if(Sx_types[45].call(null, frame)) var a = Sx_runtime[23].call(null, frame, gL); else{ var d = Sx_runtime[73].call(null, env, gM); if(Sx_types[45].call(null, d)) var e = Sx_runtime[74].call(null, env, gN), a = Sx_runtime[7].call(null, e, [5, [0, name, [0, default_val, 0]]]); else var a = default_val; } return make_cek_value(a, env, kont); } var cst_scope_emit = "scope-emit!", gO = [1, 1.], gP = [2, cst_emitted], gQ = [2, cst_emitted], gR = [2, cst_scope_emit], gS = [2, cst_scope_emit]; function step_sf_emit(args, env, kont){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), val = trampoline(eval_expr(Sx_runtime[15].call(null, args, gO), env)), frame = kont_find_scope_acc(kont, name); if(Sx_types[45].call(null, frame)){ var a = [0, Sx_runtime[23].call(null, frame, gP), [0, [5, [0, val, 0]], 0]], b = Sx_runtime[1].call(null, cst_append, a); Sx_runtime[9].call(null, frame, gQ, b); return make_cek_value(0, env, kont); } var c = Sx_runtime[73].call(null, env, gR); if(Sx_types[45].call(null, c)){ var d = Sx_runtime[74].call(null, env, gS); Sx_runtime[7].call(null, d, [5, [0, name, [0, val, 0]]]); } return make_cek_value(0, env, kont); } var gT = [2, cst_emitted], gU = [2, cst_emitted], gV = [2, cst_emitted], gW = [5, 0]; function step_sf_emitted(args, env, kont){ var name = trampoline(eval_expr(Sx_runtime[12].call(null, args), env)), frame = kont_find_scope_acc(kont, name); if(Sx_types[45].call(null, frame)) var a = Sx_runtime[23].call(null, frame, gT); else{ var b = Sx_runtime[73].call(null, env, gU); if(Sx_types[45].call(null, b)) var c = Sx_runtime[74].call(null, env, gV), a = Sx_runtime[7].call(null, c, [5, [0, name, 0]]); else var a = gW; } return make_cek_value(a, env, kont); } function step_sf_reset(args, env, kont){ var a = kont_push(make_reset_frame(env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var gX = [1, 1.], gY = [1, 1.]; function step_sf_shift(args, env, kont){ var a = Sx_runtime[12].call(null, args), k_name = Sx_types[46].call(null, a), body = Sx_runtime[15].call(null, args, gX), captured_result = kont_capture_to_reset(kont), captured = Sx_runtime[12].call(null, captured_result), rest_kont = Sx_runtime[15].call(null, captured_result, gY), k = Sx_runtime[93].call(null, captured, rest_kont), shift_env = Sx_runtime[78].call(null, env), b = Sx_runtime[3].call(null, k_name); Sx_runtime[75].call(null, shift_env, b, k); return make_cek_state(body, shift_env, rest_kont); } function step_sf_deref(args, env, kont){ var a = kont_push(make_deref_frame(env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var gZ = [5, 0], g0 = [5, 0]; function cek_call(f, args){ var b = Sx_runtime[81].call(null, args), a = Sx_types[45].call(null, b) ? gZ : args, c = Sx_runtime[81].call(null, f); if(Sx_types[45].call(null, c)) return 0; var or = Sx_runtime[83].call(null, f), or$0 = Sx_types[45].call(null, or) ? or : Sx_runtime[88].call(null, f); return Sx_types[45].call(null, or$0) ? cek_run (continue_with_call(f, a, Sx_runtime[77].call(null, 0), a, g0)) : 0; } var cst_update_fn = "update-fn", g1 = [1, 1.], g2 = [1, 2.], g3 = [2, cst_update_fn], g4 = [0, 0]; function reactive_shift_deref(sig, env, kont){ var scan_result = kont_capture_to_reactive_reset(kont), captured_frames = Sx_runtime[12].call(null, scan_result), reset_frame = Sx_runtime[15].call(null, scan_result, g1), remaining_kont = Sx_runtime[15].call(null, scan_result, g2), update_fn = Sx_runtime[23].call(null, reset_frame, g3), subscriber = [14, cst$7, function(args){ var a = Sx_runtime[5].call(null, 0); Stdlib_List[18].call(null, function(d){cek_call(d, 0); return 0;}, a); var new_reset = make_reactive_reset_frame(env, update_fn, g4), new_kont = Sx_runtime[1].call (null, cst_concat, [0, captured_frames, [0, [5, [0, new_reset, 0]], [0, remaining_kont, 0]]]); return Sx_runtime[114].call (null, [14, cst$7, function(args){ if(args && ! args[2]){ var d = args[1]; Sx_runtime[8].call(null, 0, d); return 0; } return 0; }], [14, cst$7, function(args){ return cek_run (make_cek_value (Sx_runtime[111].call(null, sig), env, new_kont)); }]); }]; Sx_runtime[112].call(null, sig, subscriber); var initial_kont = Sx_runtime[1].call (null, cst_concat, [0, captured_frames, [0, [5, [0, reset_frame, 0]], [0, remaining_kont, 0]]]); return make_cek_value(Sx_runtime[111].call(null, sig), env, initial_kont); } var g5 = [0, [2, cst_symbol], 0], g6 = [5, 0]; function step_eval_call(head, args, env, kont){ var a = [0, Sx_runtime[71].call(null, head), g5], b = Sx_runtime[1].call(null, cst, a), hname = Sx_types[45].call(null, b) ? Sx_types[46].call(null, head) : 0; return make_cek_state (head, env, kont_push(make_arg_frame(0, g6, args, env, args, hname), kont)); } var g7 = [0, [2, cst_map], 0], g8 = [0, [2, cst_map_indexed], 0], g9 = [0, [2, cst_filter], 0], g_ = [0, [2, cst_reduce], 0], g$ = [0, [2, cst_some], 0], ha = [0, [2, cst_every$0], 0], hb = [0, [2, cst_for_each], 0]; function ho_form_name_p(name){ var or = Sx_runtime[1].call(null, cst, [0, name, g7]); if(Sx_types[45].call(null, or)) return or; var or$0 = Sx_runtime[1].call(null, cst, [0, name, g8]); if(Sx_types[45].call(null, or$0)) return or$0; var or$1 = Sx_runtime[1].call(null, cst, [0, name, g9]); if(Sx_types[45].call(null, or$1)) return or$1; var or$2 = Sx_runtime[1].call(null, cst, [0, name, g_]); if(Sx_types[45].call(null, or$2)) return or$2; var or$3 = Sx_runtime[1].call(null, cst, [0, name, g$]); if(Sx_types[45].call(null, or$3)) return or$3; var or$4 = Sx_runtime[1].call(null, cst, [0, name, ha]); return Sx_types[45].call(null, or$4) ? or$4 : Sx_runtime[1].call(null, cst, [0, name, hb]); } function ho_fn_p(v){ var or = Sx_runtime[88].call(null, v); return Sx_types[45].call(null, or) ? or : Sx_runtime[83].call(null, v); } var hc = [0, [2, cst_reduce], 0], hd = [1, 1.], he = [1, 2.], hf = [1, 1.]; function ho_swap_args(ho_type, evaled){ var c = Sx_runtime[1].call(null, cst, [0, ho_type, hc]); if(Sx_types[45].call(null, c)){ var a = Sx_runtime[12].call(null, evaled), b = Sx_runtime[15].call(null, evaled, hd), d = ho_fn_p(a), and = [0, 1 - Sx_types[45].call(null, d)], e = Sx_types[45].call(null, and) ? ho_fn_p(b) : and; return Sx_types[45].call(null, e) ? [5, [0, b, [0, Sx_runtime[15].call(null, evaled, he), [0, a, 0]]]] : evaled; } var a$0 = Sx_runtime[12].call(null, evaled), b$0 = Sx_runtime[15].call(null, evaled, hf), f = ho_fn_p(a$0), and$0 = [0, 1 - Sx_types[45].call(null, f)], g = Sx_types[45].call(null, and$0) ? ho_fn_p(b$0) : and$0; return Sx_types[45].call(null, g) ? [5, [0, b$0, [0, a$0, 0]]] : evaled; } var hg = [0, [2, cst_map], 0], hh = [0, [1, 2.], 0], hi = [5, 0], hj = [5, 0], hk = [5, 0], hl = [1, 1.], hm = [5, 0], hn = [5, 0], ho = [5, 0], hp = [0, [2, cst_map_indexed], 0], hq = [1, 1.], hr = [5, 0], hs = [5, 0], ht = [5, 0], hu = [1, 0.], hv = [0, [2, cst_filter], 0], hw = [1, 1.], hx = [5, 0], hy = [5, 0], hz = [5, 0], hA = [0, [2, cst_reduce], 0], hB = [1, 1.], hC = [1, 2.], hD = [5, 0], hE = [0, [2, cst_some], 0], hF = [1, 1.], hG = [0, 0], hH = [5, 0], hI = [0, [2, cst_every], 0], hJ = [1, 1.], hK = [0, 1], hL = [5, 0], hM = [0, [2, cst_for_each], 0], hN = [1, 1.], hO = [5, 0], hP = [2, "Unknown HO type: "]; function ho_setup_dispatch(ho_type, evaled, env, kont){ var ordered = ho_swap_args(ho_type, evaled), f = Sx_runtime[12].call(null, ordered), a = Sx_runtime[1].call(null, cst, [0, ho_type, hg]); if(Sx_types[45].call(null, a)){ var b = [0, Sx_runtime[22].call(null, ordered), hh], c = Sx_runtime[1].call(null, cst$5, b); if(Sx_types[45].call(null, c)){ var colls = Sx_runtime[13].call(null, ordered), d = Sx_runtime[5].call(null, colls), e = [0, Stdlib_List[34].call (null, function(c){ var a = Sx_runtime[31].call(null, c); return Sx_types[45].call(null, a); }, d)]; if(Sx_types[45].call(null, e)) return make_cek_value(hi, env, kont); var g = Sx_runtime[5].call(null, colls), heads = [5, Stdlib_List[20].call (null, function(c){return Sx_runtime[12].call(null, c);}, g)], h = Sx_runtime[5].call(null, colls), tails = [5, Stdlib_List[20].call (null, function(c){return Sx_runtime[13].call(null, c);}, h)]; return continue_with_call (f, heads, env, hk, kont_push(make_multi_map_frame(f, tails, hj, env), kont)); } var coll = Sx_runtime[15].call(null, ordered, hl), i = Sx_runtime[31].call(null, coll); if(Sx_types[45].call(null, i)) return make_cek_value(hm, env, kont); var j = kont_push (make_map_frame(f, Sx_runtime[13].call(null, coll), hn, env), kont); return continue_with_call (f, [5, [0, Sx_runtime[12].call(null, coll), 0]], env, ho, j); } var k = Sx_runtime[1].call(null, cst, [0, ho_type, hp]); if(Sx_types[45].call(null, k)){ var coll$0 = Sx_runtime[15].call(null, ordered, hq), l = Sx_runtime[31].call(null, coll$0); if(Sx_types[45].call(null, l)) return make_cek_value(hr, env, kont); var m = kont_push (make_map_indexed_frame (f, Sx_runtime[13].call(null, coll$0), hs, env), kont); return continue_with_call (f, [5, [0, hu, [0, Sx_runtime[12].call(null, coll$0), 0]]], env, ht, m); } var n = Sx_runtime[1].call(null, cst, [0, ho_type, hv]); if(Sx_types[45].call(null, n)){ var coll$1 = Sx_runtime[15].call(null, ordered, hw), o = Sx_runtime[31].call(null, coll$1); if(Sx_types[45].call(null, o)) return make_cek_value(hx, env, kont); var p = Sx_runtime[12].call(null, coll$1), q = kont_push (make_filter_frame(f, Sx_runtime[13].call(null, coll$1), hy, p, env), kont); return continue_with_call (f, [5, [0, Sx_runtime[12].call(null, coll$1), 0]], env, hz, q); } var r = Sx_runtime[1].call(null, cst, [0, ho_type, hA]); if(Sx_types[45].call(null, r)){ var init = Sx_runtime[15].call(null, ordered, hB), coll$2 = Sx_runtime[15].call(null, ordered, hC), s = Sx_runtime[31].call(null, coll$2); if(Sx_types[45].call(null, s)) return make_cek_value(init, env, kont); var t = kont_push (make_reduce_frame(f, Sx_runtime[13].call(null, coll$2), env), kont); return continue_with_call (f, [5, [0, init, [0, Sx_runtime[12].call(null, coll$2), 0]]], env, hD, t); } var u = Sx_runtime[1].call(null, cst, [0, ho_type, hE]); if(Sx_types[45].call(null, u)){ var coll$3 = Sx_runtime[15].call(null, ordered, hF), v = Sx_runtime[31].call(null, coll$3); if(Sx_types[45].call(null, v)) return make_cek_value(hG, env, kont); var w = kont_push (make_some_frame(f, Sx_runtime[13].call(null, coll$3), env), kont); return continue_with_call (f, [5, [0, Sx_runtime[12].call(null, coll$3), 0]], env, hH, w); } var x = Sx_runtime[1].call(null, cst, [0, ho_type, hI]); if(Sx_types[45].call(null, x)){ var coll$4 = Sx_runtime[15].call(null, ordered, hJ), y = Sx_runtime[31].call(null, coll$4); if(Sx_types[45].call(null, y)) return make_cek_value(hK, env, kont); var z = kont_push (make_every_frame(f, Sx_runtime[13].call(null, coll$4), env), kont); return continue_with_call (f, [5, [0, Sx_runtime[12].call(null, coll$4), 0]], env, hL, z); } var A = Sx_runtime[1].call(null, cst, [0, ho_type, hM]); if(! Sx_types[45].call(null, A)){ var D = [2, Sx_runtime[4].call(null, [0, hP, [0, ho_type, 0]])], E = Sx_runtime[2].call(null, D); throw caml_maybe_attach_backtrace([0, Sx_types[7], E], 1); } var coll$5 = Sx_runtime[15].call(null, ordered, hN), B = Sx_runtime[31].call(null, coll$5); if(Sx_types[45].call(null, B)) return make_cek_value(0, env, kont); var C = kont_push (make_for_each_frame(f, Sx_runtime[13].call(null, coll$5), env), kont); return continue_with_call (f, [5, [0, Sx_runtime[12].call(null, coll$5), 0]], env, hO, C); } var hQ = [5, 0], hR = [2, cst_map]; function step_ho_map(args, env, kont){ var a = kont_push (make_ho_setup_frame(hR, Sx_runtime[13].call(null, args), hQ, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var hS = [5, 0], hT = [2, cst_map_indexed]; function step_ho_map_indexed(args, env, kont){ var a = kont_push (make_ho_setup_frame(hT, Sx_runtime[13].call(null, args), hS, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var hU = [5, 0], hV = [2, cst_filter]; function step_ho_filter(args, env, kont){ var a = kont_push (make_ho_setup_frame(hV, Sx_runtime[13].call(null, args), hU, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var hW = [5, 0], hX = [2, cst_reduce]; function step_ho_reduce(args, env, kont){ var a = kont_push (make_ho_setup_frame(hX, Sx_runtime[13].call(null, args), hW, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var hY = [5, 0], hZ = [2, cst_some]; function step_ho_some(args, env, kont){ var a = kont_push (make_ho_setup_frame(hZ, Sx_runtime[13].call(null, args), hY, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var h0 = [5, 0], h1 = [2, cst_every]; function step_ho_every(args, env, kont){ var a = kont_push (make_ho_setup_frame(h1, Sx_runtime[13].call(null, args), h0, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var h2 = [5, 0], h3 = [2, cst_for_each]; function step_ho_for_each(args, env, kont){ var a = kont_push (make_ho_setup_frame(h3, Sx_runtime[13].call(null, args), h2, env), kont); return make_cek_state(Sx_runtime[12].call(null, args), env, a); } var cst_vm_suspended = "__vm_suspended", cst_body = "body", cst_evaled = "evaled", cst_match_val = "match-val", cst_remaining = "remaining", cst_results = "results", cst_resume = "resume", cst_scheme = "scheme", last_error_kont_ref = [0, 0], h4 = [0, [2, cst_if], 0], h5 = [2, cst_env], h6 = [2, "then"], h7 = [2, cst_else], h8 = [2, cst_env], h9 = [2, cst_else], h_ = [0, [2, cst_when], 0], h$ = [2, cst_body], ia = [2, cst_env], ib = [0, [1, 1.], 0], ic = [0, [2, cst_begin], 0], id = [2, cst_remaining], ie = [2, cst_env], ig = [0, [1, 1.], 0], ih = [0, [2, cst_let], 0], ii = [2, cst_name], ij = [2, cst_remaining], ik = [2, cst_body], il = [2, cst_env], im = [0, [2, cst_symbol], 0], io = [1, 1.], ip = [0, [2, cst_define], 0], iq = [2, cst_name], ir = [2, cst_env], is = [2, "has-effects"], it = [2, "effect-list"], iu = [0, [2, cst_symbol], 0], iv = [2, cst_effect_annotations], iw = [2, cst_effect_annotations], ix = [2, cst_effect_annotations], iy = [0, [2, cst_set], 0], iz = [2, cst_name], iA = [2, cst_env], iB = [0, [2, cst_and], 0], iC = [2, cst_remaining], iD = [0, [1, 1.], 0], iE = [2, cst_env], iF = [2, cst_env], iG = [0, [2, cst_or], 0], iH = [2, cst_remaining], iI = [0, 0], iJ = [0, [1, 1.], 0], iK = [2, cst_env], iL = [2, cst_env], iM = [0, [2, cst_cond], 0], iN = [2, cst_remaining], iO = [2, cst_env], iP = [2, cst_scheme], iQ = [0, [1, 2.], 0], iR = [0, [2, cst_symbol], 0], iS = [1, 1.], iT = [0, [2, cst$8], 0], iU = [1, 1.], iV = [1, 2.], iW = [1, 1.], iX = [1, 1.], iY = [0, 1], iZ = [1, 1.], i0 = [1, 2.], i1 = [0, [1, 2.], 0], i2 = [1, 1.], i3 = [0, 0], i4 = [0, [2, cst_case], 0], i5 = [2, cst_match_val], i6 = [2, cst_remaining], i7 = [2, cst_env], i8 = [0, [2, cst_thread], 0], i9 = [2, cst_remaining], i_ = [2, cst_env], i$ = [0, [2, cst_list], 0], ja = [0, [2, cst_symbol], 0], jb = [3, cst_quote], jc = [0, [2, cst_arg], 0], jd = [2, cst_f], je = [2, cst_evaled], jf = [2, cst_remaining], jg = [2, cst_env], jh = [2, "raw-args"], ji = [2, "head-name"], jj = [5, 0], jk = [5, 0], jl = [5, 0], jm = [0, [2, cst_dict], 0], jn = [2, cst_remaining], jo = [2, cst_results], jp = [2, cst_env], jq = [1, 0.], jr = [1, 1.], js = [1, 1.], jt = [0, [2, cst_ho_setup], 0], ju = [2, "ho-type"], jv = [2, cst_remaining], jw = [2, cst_evaled], jx = [2, cst_env], jy = [0, [2, cst_reset], 0], jz = [0, [2, cst_deref], 0], jA = [2, cst_env], jB = [2, "sx-reactive"], jC = [2, "deps"], jD = [2, "notify"], jE = [0, [2, cst_reactive_reset], 0], jF = [2, cst_update_fn], jG = [2, "first-render"], jH = [0, [2, cst_scope], 0], jI = [2, cst_name], jJ = [2, cst_remaining], jK = [2, cst_env], jL = [0, [2, cst_provide], 0], jM = [2, cst_remaining], jN = [2, cst_env], jO = [2, cst_value], jP = [2, cst_name], jQ = [0, [2, cst_scope_acc], 0], jR = [2, cst_remaining], jS = [2, cst_env], jT = [2, cst_value], jU = [2, cst_name], jV = [2, cst_emitted], jW = [2, cst_emitted], jX = [0, [2, cst_map], 0], jY = [2, cst_f], jZ = [2, cst_remaining], j0 = [2, cst_results], j1 = [2, "indexed"], j2 = [2, cst_env], j3 = [5, 0], j4 = [0, [2, cst_filter], 0], j5 = [2, cst_f], j6 = [2, cst_remaining], j7 = [2, cst_results], j8 = [2, "current-item"], j9 = [2, cst_env], j_ = [5, 0], j$ = [0, [2, cst_reduce], 0], ka = [2, cst_f], kb = [2, cst_remaining], kc = [2, cst_env], kd = [5, 0], ke = [0, [2, cst_for_each], 0], kf = [2, cst_f], kg = [2, cst_remaining], kh = [2, cst_env], ki = [5, 0], kj = [0, [2, cst_some], 0], kk = [2, cst_f], kl = [2, cst_remaining], km = [2, cst_env], kn = [0, 0], ko = [5, 0], kp = [0, [2, cst_every], 0], kq = [2, cst_f], kr = [2, cst_remaining], ks = [2, cst_env], kt = [0, 0], ku = [0, 1], kv = [5, 0], kw = [0, [2, cst_handler], 0], kx = [2, cst_remaining], ky = [2, cst_env], kz = [2, cst_f], kA = [0, [2, cst_restart], 0], kB = [0, [2, cst_signal_return], 0], kC = [2, "saved-kont"], kD = [2, cst_env], kE = [0, [2, cst_comp_trace], 0], kF = [0, [2, cst_cond_arrow], 0], kG = [2, cst_match_val], kH = [2, cst_env], kI = [0, [2, cst_raise_eval], 0], kJ = [2, cst_env], kK = [2, cst_scheme], kL = [2, "Unhandled exception: "], kM = [0, [2, cst_raise_guard], 0], kN = [2, "exception handler returned from non-continuable raise"], kO = [0, [2, cst_multi_map], 0], kP = [2, cst_f], kQ = [2, cst_remaining], kR = [2, cst_results], kS = [2, cst_env], kT = [5, 0], kU = [0, [2, cst_callcc], 0], kV = [2, cst_env], kW = [0, [2, cst_vm_resume], 0], kX = [2, cst_f], kY = [2, cst_vm_suspended], kZ = [2, cst_env], k0 = [2, cst_resume], k1 = [2, cst_env], k2 = [2, cst_request], k3 = [2, cst_env], k4 = [0, [2, cst_perform], 0], k5 = [2, cst_env], k6 = [0, [2, cst_import], 0], k7 = [2, cst_args], k8 = [2, cst_remaining], k9 = [2, cst_env], k_ = [2, "Unknown frame type: "]; function step_continue(state){ var condition = cek_value(state), env = cek_env(state), kont = cek_kont(state), h = kont_empty_p(kont); if(Sx_types[45].call(null, h)) return state; var frame = kont_top(kont), rest_k = kont_pop(kont), match_val = frame_type(frame), i = Sx_runtime[1].call(null, cst, [0, match_val, h4]); if(Sx_types[45].call(null, i)){ if(Sx_types[45].call(null, condition)) var j = Sx_runtime[81].call(null, condition), c = [0, 1 - Sx_types[45].call(null, j)]; else var c = condition; if(Sx_types[45].call(null, c)){ var l = Sx_runtime[23].call(null, frame, h5); return make_cek_state(Sx_runtime[23].call(null, frame, h6), l, rest_k); } var m = Sx_runtime[23].call(null, frame, h7), n = Sx_runtime[81].call(null, m); if(Sx_types[45].call(null, n)) return make_cek_value(0, env, rest_k); var o = Sx_runtime[23].call(null, frame, h8); return make_cek_state(Sx_runtime[23].call(null, frame, h9), o, rest_k); } var p = Sx_runtime[1].call(null, cst, [0, match_val, h_]); if(Sx_types[45].call(null, p)){ if(Sx_types[45].call(null, condition)) var q = Sx_runtime[81].call(null, condition), e = [0, 1 - Sx_types[45].call(null, q)]; else var e = condition; if(! Sx_types[45].call(null, e)) return make_cek_value(0, env, rest_k); var body = Sx_runtime[23].call(null, frame, h$), fenv = Sx_runtime[23].call(null, frame, ia), r = Sx_runtime[31].call(null, body); if(Sx_types[45].call(null, r)) return make_cek_value(0, fenv, rest_k); var s = [0, Sx_runtime[22].call(null, body), ib], t = Sx_runtime[1].call(null, cst, s); if(Sx_types[45].call(null, t)) return make_cek_state(Sx_runtime[12].call(null, body), fenv, rest_k); var u = kont_push (make_begin_frame(Sx_runtime[13].call(null, body), fenv), rest_k); return make_cek_state(Sx_runtime[12].call(null, body), fenv, u); } var v = Sx_runtime[1].call(null, cst, [0, match_val, ic]); if(Sx_types[45].call(null, v)){ var remaining = Sx_runtime[23].call(null, frame, id), fenv$0 = Sx_runtime[23].call(null, frame, ie), w = Sx_runtime[31].call(null, remaining); if(Sx_types[45].call(null, w)) return make_cek_value(condition, fenv$0, rest_k); var x = [0, Sx_runtime[22].call(null, remaining), ig], y = Sx_runtime[1].call(null, cst, x); if(Sx_types[45].call(null, y)) return make_cek_state (Sx_runtime[12].call(null, remaining), fenv$0, rest_k); var z = kont_push (make_begin_frame(Sx_runtime[13].call(null, remaining), fenv$0), rest_k); return make_cek_state(Sx_runtime[12].call(null, remaining), fenv$0, z); } var A = Sx_runtime[1].call(null, cst, [0, match_val, ih]); if(Sx_types[45].call(null, A)){ var name = Sx_runtime[23].call(null, frame, ii), remaining$0 = Sx_runtime[23].call(null, frame, ij), body$0 = Sx_runtime[23].call(null, frame, ik), local = Sx_runtime[23].call(null, frame, il), B = Sx_runtime[3].call(null, name); Sx_runtime[75].call(null, local, B, condition); var C = Sx_runtime[31].call(null, remaining$0); if(Sx_types[45].call(null, C)) return step_sf_begin(body$0, local, rest_k); var next_binding = Sx_runtime[12].call(null, remaining$0), D = Sx_runtime[12].call(null, next_binding), E = [0, Sx_runtime[71].call(null, D), im], F = Sx_runtime[1].call(null, cst, E); if(Sx_types[45].call(null, F)) var G = Sx_runtime[12].call(null, next_binding), vname = Sx_types[46].call(null, G); else var vname = Sx_runtime[12].call(null, next_binding); var H = kont_push (make_let_frame (vname, Sx_runtime[13].call(null, remaining$0), body$0, local), rest_k); return make_cek_state (Sx_runtime[15].call(null, next_binding, io), local, H); } var I = Sx_runtime[1].call(null, cst, [0, match_val, ip]); if(Sx_types[45].call(null, I)){ var name$0 = Sx_runtime[23].call(null, frame, iq), fenv$1 = Sx_runtime[23].call(null, frame, ir), has_effects = Sx_runtime[23].call(null, frame, is), effect_list = Sx_runtime[23].call(null, frame, it), and = Sx_runtime[83].call(null, condition); if(Sx_types[45].call(null, and)) var J = Sx_types[51].call(null, condition), g = Sx_runtime[81].call(null, J); else var g = and; if(Sx_types[45].call(null, g)){ var K = Sx_runtime[3].call(null, name$0); Sx_runtime[80].call(null, condition, K); } var L = Sx_runtime[3].call(null, name$0); Sx_runtime[75].call(null, fenv$1, L, condition); if(Sx_types[45].call(null, has_effects)){ var M = Sx_runtime[5].call(null, effect_list), effect_names = [5, Stdlib_List[20].call (null, function(e){ var a = [0, Sx_runtime[71].call(null, e), iu], b = Sx_runtime[1].call(null, cst, a); return Sx_types[45].call(null, b) ? Sx_types[46].call(null, e) : e; }, M)], N = Sx_runtime[73].call(null, fenv$1, iv), effect_anns = Sx_types[45].call(null, N) ? Sx_runtime[74].call(null, fenv$1, iw) : [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; Sx_runtime[9].call(null, effect_anns, name$0, effect_names); var O = Sx_runtime[3].call(null, ix); Sx_runtime[75].call(null, fenv$1, O, effect_anns); } return make_cek_value(condition, fenv$1, rest_k); } var P = Sx_runtime[1].call(null, cst, [0, match_val, iy]); if(Sx_types[45].call(null, P)){ var name$1 = Sx_runtime[23].call(null, frame, iz), fenv$2 = Sx_runtime[23].call(null, frame, iA), Q = Sx_runtime[3].call(null, name$1); Sx_runtime[76].call(null, fenv$2, Q, condition); return make_cek_value(condition, env, rest_k); } var R = Sx_runtime[1].call(null, cst, [0, match_val, iB]); if(Sx_types[45].call(null, R)){ var S = [0, 1 - Sx_types[45].call(null, condition)]; if(Sx_types[45].call(null, S)) return make_cek_value(condition, env, rest_k); var remaining$1 = Sx_runtime[23].call(null, frame, iC), T = Sx_runtime[31].call(null, remaining$1); if(Sx_types[45].call(null, T)) return make_cek_value(condition, env, rest_k); var U = [0, Sx_runtime[22].call(null, remaining$1), iD], V = Sx_runtime[1].call(null, cst, U); if(Sx_types[45].call(null, V)) var rest_k$0 = rest_k; else var X = Sx_runtime[23].call(null, frame, iF), rest_k$0 = kont_push (make_and_frame(Sx_runtime[13].call(null, remaining$1), X), rest_k); var W = Sx_runtime[23].call(null, frame, iE); return make_cek_state (Sx_runtime[12].call(null, remaining$1), W, rest_k$0); } var Y = Sx_runtime[1].call(null, cst, [0, match_val, iG]); if(Sx_types[45].call(null, Y)){ if(Sx_types[45].call(null, condition)) return make_cek_value(condition, env, rest_k); var remaining$2 = Sx_runtime[23].call(null, frame, iH), Z = Sx_runtime[31].call(null, remaining$2); if(Sx_types[45].call(null, Z)) return make_cek_value(iI, env, rest_k); var _ = [0, Sx_runtime[22].call(null, remaining$2), iJ], $ = Sx_runtime[1].call(null, cst, _); if(Sx_types[45].call(null, $)) var rest_k$1 = rest_k; else var ab = Sx_runtime[23].call(null, frame, iL), rest_k$1 = kont_push (make_or_frame(Sx_runtime[13].call(null, remaining$2), ab), rest_k); var aa = Sx_runtime[23].call(null, frame, iK); return make_cek_state (Sx_runtime[12].call(null, remaining$2), aa, rest_k$1); } var ac = Sx_runtime[1].call(null, cst, [0, match_val, iM]); if(Sx_types[45].call(null, ac)){ var remaining$3 = Sx_runtime[23].call(null, frame, iN), fenv$3 = Sx_runtime[23].call(null, frame, iO), scheme_p = Sx_runtime[23].call(null, frame, iP); if(! Sx_types[45].call(null, scheme_p)){ if(Sx_types[45].call(null, condition)) return make_cek_state (Sx_runtime[15].call(null, remaining$3, iZ), fenv$3, rest_k); var al = [0, remaining$3, [0, i0, [0, Sx_runtime[22].call(null, remaining$3), 0]]], next = Sx_runtime[1].call(null, cst_slice, al), am = [0, Sx_runtime[22].call(null, next), i1], an = Sx_runtime[1].call(null, cst$4, am); if(Sx_types[45].call(null, an)) return make_cek_value(0, fenv$3, rest_k); var next_test$0 = Sx_runtime[12].call(null, next), ao = is_else_clause(next_test$0); return Sx_types[45].call(null, ao) ? make_cek_state (Sx_runtime[15].call(null, next, i2), fenv$3, rest_k) : make_cek_state (next_test$0, fenv$3, kont_push(make_cond_frame(next, fenv$3, i3), rest_k)); } if(! Sx_types[45].call(null, condition)){ var next_clauses = Sx_runtime[13].call(null, remaining$3), aj = Sx_runtime[31].call(null, next_clauses); if(Sx_types[45].call(null, aj)) return make_cek_value(0, fenv$3, rest_k); var next_clause = Sx_runtime[12].call(null, next_clauses), next_test = Sx_runtime[12].call(null, next_clause), ak = is_else_clause(next_test); return Sx_types[45].call(null, ak) ? make_cek_state (Sx_runtime[15].call(null, next_clause, iX), fenv$3, rest_k) : make_cek_state (next_test, fenv$3, kont_push(make_cond_frame(next_clauses, fenv$3, iY), rest_k)); } var clause = Sx_runtime[12].call(null, remaining$3), ad = [0, Sx_runtime[22].call(null, clause), iQ], and$0 = Sx_runtime[1].call(null, cst$5, ad); if(Sx_types[45].call(null, and$0)){ var ae = Sx_runtime[15].call(null, clause, iS), af = [0, Sx_runtime[71].call(null, ae), iR], and$1 = Sx_runtime[1].call(null, cst, af); if(Sx_types[45].call(null, and$1)) var ag = Sx_runtime[15].call(null, clause, iU), ah = [0, Sx_types[46].call(null, ag), iT], b = Sx_runtime[1].call(null, cst, ah); else var b = and$1; } else var b = and$0; if(! Sx_types[45].call(null, b)) return make_cek_state (Sx_runtime[15].call(null, clause, iW), fenv$3, rest_k); var ai = kont_push(make_cond_arrow_frame(condition, fenv$3), rest_k); return make_cek_state(Sx_runtime[15].call(null, clause, iV), fenv$3, ai); } var ap = Sx_runtime[1].call(null, cst, [0, match_val, i4]); if(Sx_types[45].call(null, ap)){ var match_val$0 = Sx_runtime[23].call(null, frame, i5), remaining$4 = Sx_runtime[23].call(null, frame, i6), fenv$4 = Sx_runtime[23].call(null, frame, i7), aq = Sx_runtime[81].call(null, match_val$0); return Sx_types[45].call(null, aq) ? sf_case_step_loop(condition, remaining$4, fenv$4, rest_k) : sf_case_step_loop(match_val$0, remaining$4, fenv$4, rest_k); } var ar = Sx_runtime[1].call(null, cst, [0, match_val, i8]); if(Sx_types[45].call(null, ar)){ var remaining$5 = Sx_runtime[23].call(null, frame, i9), fenv$5 = Sx_runtime[23].call(null, frame, i_), as = Sx_runtime[31].call(null, remaining$5); if(Sx_types[45].call(null, as)) return make_cek_value(condition, fenv$5, rest_k); var form = Sx_runtime[12].call(null, remaining$5), rest_forms = Sx_runtime[13].call(null, remaining$5), at = Sx_runtime[13].call(null, remaining$5), au = Sx_runtime[31].call(null, at), new_kont = Sx_types[45].call(null, au) ? rest_k : kont_push (make_thread_frame(Sx_runtime[13].call(null, remaining$5), fenv$5), rest_k), av = [0, Sx_runtime[71].call(null, form), i$], and$2 = Sx_runtime[1].call(null, cst, av); if(Sx_types[45].call(null, and$2)){ var aw = Sx_runtime[31].call(null, form), and$3 = [0, 1 - Sx_types[45].call(null, aw)]; if(Sx_types[45].call(null, and$3)){ var ax = Sx_runtime[12].call(null, form), ay = [0, Sx_runtime[71].call(null, ax), ja], and$4 = Sx_runtime[1].call(null, cst, ay); if(Sx_types[45].call(null, and$4)) var az = Sx_runtime[12].call(null, form), a = ho_form_name_p(Sx_types[46].call(null, az)); else var a = and$4; } else var a = and$3; } else var a = and$2; if(Sx_types[45].call(null, a)){ var aA = Sx_runtime[13].call(null, form), aB = Sx_runtime[16].call(null, [5, [0, jb, [0, condition, 0]]], aA), aC = Sx_runtime[12].call(null, form); return make_cek_state (Sx_runtime[16].call(null, aC, aB), fenv$5, new_kont); } var result = thread_insert_arg(form, condition, fenv$5), aD = Sx_runtime[31].call(null, rest_forms); return Sx_types[45].call(null, aD) ? make_cek_value(result, fenv$5, rest_k) : make_cek_value (result, fenv$5, kont_push(make_thread_frame(rest_forms, fenv$5), rest_k)); } var aE = Sx_runtime[1].call(null, cst, [0, match_val, jc]); if(Sx_types[45].call(null, aE)){ var f = Sx_runtime[23].call(null, frame, jd), evaled = Sx_runtime[23].call(null, frame, je), remaining$6 = Sx_runtime[23].call(null, frame, jf), fenv$6 = Sx_runtime[23].call(null, frame, jg), raw_args = Sx_runtime[23].call(null, frame, jh), hname = Sx_runtime[23].call(null, frame, ji), aF = Sx_runtime[81].call(null, f); if(Sx_types[45].call(null, aF)){ var and$5 = strict_ref[1], hname$0 = Sx_types[45].call(null, and$5) ? hname : and$5; if(Sx_types[45].call(null, hname$0)) strict_check_args(hname, jj); var aG = Sx_runtime[31].call(null, remaining$6); if(Sx_types[45].call(null, aG)) return continue_with_call(condition, jk, fenv$6, raw_args, rest_k); var aH = kont_push (make_arg_frame (condition, jl, Sx_runtime[13].call(null, remaining$6), fenv$6, raw_args, hname), rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$6), fenv$6, aH); } var new_evaled = Sx_runtime[1].call (null, cst_append, [0, evaled, [0, [5, [0, condition, 0]], 0]]), aI = Sx_runtime[31].call(null, remaining$6); if(! Sx_types[45].call(null, aI)){ var aJ = kont_push (make_arg_frame (f, new_evaled, Sx_runtime[13].call(null, remaining$6), fenv$6, raw_args, hname), rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$6), fenv$6, aJ); } var and$6 = strict_ref[1], hname$1 = Sx_types[45].call(null, and$6) ? hname : and$6; if(Sx_types[45].call(null, hname$1)) strict_check_args(hname, new_evaled); return continue_with_call(f, new_evaled, fenv$6, raw_args, rest_k); } var aK = Sx_runtime[1].call(null, cst, [0, match_val, jm]); if(Sx_types[45].call(null, aK)){ var remaining$7 = Sx_runtime[23].call(null, frame, jn), results = Sx_runtime[23].call(null, frame, jo), fenv$7 = Sx_runtime[23].call(null, frame, jp), last_result = Sx_runtime[14].call(null, results), aL = [0, [5, [0, [5, [0, Sx_runtime[12].call(null, last_result), [0, condition, 0]]], 0]], 0], aM = [0, Sx_runtime[22].call(null, results), 0], aN = [0, results, [0, jq, [0, Sx_runtime[1].call(null, cst_dec, aM), 0]]], aO = [0, Sx_runtime[1].call(null, cst_slice, aN), aL], completed = Sx_runtime[1].call(null, cst_append, aO), aP = Sx_runtime[31].call(null, remaining$7); if(Sx_types[45].call(null, aP)){ var d = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], aQ = Sx_runtime[5].call(null, completed); Stdlib_List[18].call (null, function(pair){ var a = Sx_runtime[15].call(null, pair, jr), b = Sx_runtime[12].call(null, pair); Sx_runtime[9].call(null, d, b, a); return 0; }, aQ); return make_cek_value(d, fenv$7, rest_k); } var next_entry = Sx_runtime[12].call(null, remaining$7), aR = [0, completed, [0, [5, [0, [5, [0, Sx_runtime[12].call(null, next_entry), 0]], 0]], 0]], aS = Sx_runtime[1].call(null, cst_append, aR), aT = kont_push (make_dict_frame(Sx_runtime[13].call(null, remaining$7), aS, fenv$7), rest_k); return make_cek_state (Sx_runtime[15].call(null, next_entry, js), fenv$7, aT); } var aU = Sx_runtime[1].call(null, cst, [0, match_val, jt]); if(Sx_types[45].call(null, aU)){ var ho_type = Sx_runtime[23].call(null, frame, ju), remaining$8 = Sx_runtime[23].call(null, frame, jv), aV = [0, Sx_runtime[23].call(null, frame, jw), [0, [5, [0, condition, 0]], 0]], evaled$0 = Sx_runtime[1].call(null, cst_append, aV), fenv$8 = Sx_runtime[23].call(null, frame, jx), aW = Sx_runtime[31].call(null, remaining$8); if(Sx_types[45].call(null, aW)) return ho_setup_dispatch(ho_type, evaled$0, fenv$8, rest_k); var aX = kont_push (make_ho_setup_frame (ho_type, Sx_runtime[13].call(null, remaining$8), evaled$0, fenv$8), rest_k); return make_cek_state(Sx_runtime[12].call(null, remaining$8), fenv$8, aX); } var aY = Sx_runtime[1].call(null, cst, [0, match_val, jy]); if(Sx_types[45].call(null, aY)) return make_cek_value(condition, env, rest_k); var aZ = Sx_runtime[1].call(null, cst, [0, match_val, jz]); if(Sx_types[45].call(null, aZ)){ var fenv$9 = Sx_runtime[23].call(null, frame, jA), a0 = Sx_runtime[87].call(null, condition), a1 = [0, 1 - Sx_types[45].call(null, a0)]; if(Sx_types[45].call(null, a1)) return make_cek_value(condition, fenv$9, rest_k); var a2 = has_reactive_reset_frame_p(rest_k); if(Sx_types[45].call(null, a2)) return reactive_shift_deref(condition, fenv$9, rest_k); var ctx = Sx_runtime[69].call(null, jB, 0); if(Sx_types[45].call(null, ctx)){ var dep_list = Sx_runtime[23].call(null, ctx, jC), notify_fn = Sx_runtime[23].call(null, ctx, jD), a3 = Sx_runtime[1].call (null, "contains?", [0, dep_list, [0, condition, 0]]), a4 = [0, 1 - Sx_types[45].call(null, a3)]; if(Sx_types[45].call(null, a4)){ Sx_runtime[8].call(null, dep_list, condition); Sx_runtime[112].call(null, condition, notify_fn); } } return make_cek_value (Sx_runtime[111].call(null, condition), fenv$9, rest_k); } var a5 = Sx_runtime[1].call(null, cst, [0, match_val, jE]); if(Sx_types[45].call(null, a5)){ var update_fn = Sx_runtime[23].call(null, frame, jF), first_p = Sx_runtime[23].call(null, frame, jG), a6 = Sx_types[45].call(null, update_fn) ? [0, 1 - Sx_types[45].call(null, first_p)] : update_fn; if(Sx_types[45].call(null, a6)) cek_call(update_fn, [5, [0, condition, 0]]); return make_cek_value(condition, env, rest_k); } var a7 = Sx_runtime[1].call(null, cst, [0, match_val, jH]); if(Sx_types[45].call(null, a7)){ var name$2 = Sx_runtime[23].call(null, frame, jI), remaining$9 = Sx_runtime[23].call(null, frame, jJ), fenv$10 = Sx_runtime[23].call(null, frame, jK), a8 = Sx_runtime[31].call(null, remaining$9); if(Sx_types[45].call(null, a8)){ Sx_runtime[101].call(null, name$2); return make_cek_value(condition, fenv$10, rest_k); } var a9 = kont_push (make_scope_frame (name$2, Sx_runtime[13].call(null, remaining$9), fenv$10), rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$9), fenv$10, a9); } var a_ = Sx_runtime[1].call(null, cst, [0, match_val, jL]); if(Sx_types[45].call(null, a_)){ var remaining$10 = Sx_runtime[23].call(null, frame, jM), fenv$11 = Sx_runtime[23].call(null, frame, jN), a$ = Sx_runtime[31].call(null, remaining$10); if(Sx_types[45].call(null, a$)) return make_cek_value(condition, fenv$11, rest_k); var ba = Sx_runtime[13].call(null, remaining$10), bb = Sx_runtime[23].call(null, frame, jO), bc = kont_push (make_provide_frame (Sx_runtime[23].call(null, frame, jP), bb, ba, fenv$11), rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$10), fenv$11, bc); } var bd = Sx_runtime[1].call(null, cst, [0, match_val, jQ]); if(Sx_types[45].call(null, bd)){ var remaining$11 = Sx_runtime[23].call(null, frame, jR), fenv$12 = Sx_runtime[23].call(null, frame, jS), be = Sx_runtime[31].call(null, remaining$11); if(Sx_types[45].call(null, be)) return make_cek_value(condition, fenv$12, rest_k); var bf = Sx_runtime[13].call(null, remaining$11), bg = Sx_runtime[23].call(null, frame, jT), new_frame = make_scope_acc_frame (Sx_runtime[23].call(null, frame, jU), bg, bf, fenv$12), bh = Sx_runtime[23].call(null, frame, jV); Sx_runtime[9].call(null, new_frame, jW, bh); var bi = kont_push(new_frame, rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$11), fenv$12, bi); } var bj = Sx_runtime[1].call(null, cst, [0, match_val, jX]); if(Sx_types[45].call(null, bj)){ var f$0 = Sx_runtime[23].call(null, frame, jY), remaining$12 = Sx_runtime[23].call(null, frame, jZ), results$0 = Sx_runtime[23].call(null, frame, j0), indexed = Sx_runtime[23].call(null, frame, j1), fenv$13 = Sx_runtime[23].call(null, frame, j2), new_results = Sx_runtime[1].call (null, cst_append, [0, results$0, [0, [5, [0, condition, 0]], 0]]), bk = Sx_runtime[31].call(null, remaining$12); if(Sx_types[45].call(null, bk)) return make_cek_value(new_results, fenv$13, rest_k); if(Sx_types[45].call(null, indexed)) var bl = [0, Sx_runtime[12].call(null, remaining$12), 0], call_args = [5, [0, Sx_runtime[22].call(null, new_results), bl]]; else var call_args = [5, [0, Sx_runtime[12].call(null, remaining$12), 0]]; var next_frame = Sx_types[45].call(null, indexed) ? make_map_indexed_frame (f$0, Sx_runtime[13].call(null, remaining$12), new_results, fenv$13) : make_map_frame (f$0, Sx_runtime[13].call(null, remaining$12), new_results, fenv$13); return continue_with_call (f$0, call_args, fenv$13, j3, kont_push(next_frame, rest_k)); } var bm = Sx_runtime[1].call(null, cst, [0, match_val, j4]); if(Sx_types[45].call(null, bm)){ var f$1 = Sx_runtime[23].call(null, frame, j5), remaining$13 = Sx_runtime[23].call(null, frame, j6), results$1 = Sx_runtime[23].call(null, frame, j7), current_item = Sx_runtime[23].call(null, frame, j8), fenv$14 = Sx_runtime[23].call(null, frame, j9), new_results$0 = Sx_types[45].call(null, condition) ? Sx_runtime [1].call (null, cst_append, [0, results$1, [0, [5, [0, current_item, 0]], 0]]) : results$1, bn = Sx_runtime[31].call(null, remaining$13); if(Sx_types[45].call(null, bn)) return make_cek_value(new_results$0, fenv$14, rest_k); var bo = Sx_runtime[12].call(null, remaining$13), bp = kont_push (make_filter_frame (f$1, Sx_runtime[13].call(null, remaining$13), new_results$0, bo, fenv$14), rest_k); return continue_with_call (f$1, [5, [0, Sx_runtime[12].call(null, remaining$13), 0]], fenv$14, j_, bp); } var bq = Sx_runtime[1].call(null, cst, [0, match_val, j$]); if(Sx_types[45].call(null, bq)){ var f$2 = Sx_runtime[23].call(null, frame, ka), remaining$14 = Sx_runtime[23].call(null, frame, kb), fenv$15 = Sx_runtime[23].call(null, frame, kc), br = Sx_runtime[31].call(null, remaining$14); if(Sx_types[45].call(null, br)) return make_cek_value(condition, fenv$15, rest_k); var bs = kont_push (make_reduce_frame (f$2, Sx_runtime[13].call(null, remaining$14), fenv$15), rest_k); return continue_with_call (f$2, [5, [0, condition, [0, Sx_runtime[12].call(null, remaining$14), 0]]], fenv$15, kd, bs); } var bt = Sx_runtime[1].call(null, cst, [0, match_val, ke]); if(Sx_types[45].call(null, bt)){ var f$3 = Sx_runtime[23].call(null, frame, kf), remaining$15 = Sx_runtime[23].call(null, frame, kg), fenv$16 = Sx_runtime[23].call(null, frame, kh), bu = Sx_runtime[31].call(null, remaining$15); if(Sx_types[45].call(null, bu)) return make_cek_value(0, fenv$16, rest_k); var bv = kont_push (make_for_each_frame (f$3, Sx_runtime[13].call(null, remaining$15), fenv$16), rest_k); return continue_with_call (f$3, [5, [0, Sx_runtime[12].call(null, remaining$15), 0]], fenv$16, ki, bv); } var bw = Sx_runtime[1].call(null, cst, [0, match_val, kj]); if(Sx_types[45].call(null, bw)){ var f$4 = Sx_runtime[23].call(null, frame, kk), remaining$16 = Sx_runtime[23].call(null, frame, kl), fenv$17 = Sx_runtime[23].call(null, frame, km); if(Sx_types[45].call(null, condition)) return make_cek_value(condition, fenv$17, rest_k); var bx = Sx_runtime[31].call(null, remaining$16); if(Sx_types[45].call(null, bx)) return make_cek_value(kn, fenv$17, rest_k); var by = kont_push (make_some_frame (f$4, Sx_runtime[13].call(null, remaining$16), fenv$17), rest_k); return continue_with_call (f$4, [5, [0, Sx_runtime[12].call(null, remaining$16), 0]], fenv$17, ko, by); } var bz = Sx_runtime[1].call(null, cst, [0, match_val, kp]); if(Sx_types[45].call(null, bz)){ var f$5 = Sx_runtime[23].call(null, frame, kq), remaining$17 = Sx_runtime[23].call(null, frame, kr), fenv$18 = Sx_runtime[23].call(null, frame, ks), bA = [0, 1 - Sx_types[45].call(null, condition)]; if(Sx_types[45].call(null, bA)) return make_cek_value(kt, fenv$18, rest_k); var bB = Sx_runtime[31].call(null, remaining$17); if(Sx_types[45].call(null, bB)) return make_cek_value(ku, fenv$18, rest_k); var bC = kont_push (make_every_frame (f$5, Sx_runtime[13].call(null, remaining$17), fenv$18), rest_k); return continue_with_call (f$5, [5, [0, Sx_runtime[12].call(null, remaining$17), 0]], fenv$18, kv, bC); } var bD = Sx_runtime[1].call(null, cst, [0, match_val, kw]); if(Sx_types[45].call(null, bD)){ var remaining$18 = Sx_runtime[23].call(null, frame, kx), fenv$19 = Sx_runtime[23].call(null, frame, ky), bE = Sx_runtime[31].call(null, remaining$18); if(Sx_types[45].call(null, bE)) return make_cek_value(condition, fenv$19, rest_k); var bF = Sx_runtime[13].call(null, remaining$18), bG = kont_push (make_handler_frame (Sx_runtime[23].call(null, frame, kz), bF, fenv$19), rest_k); return make_cek_state (Sx_runtime[12].call(null, remaining$18), fenv$19, bG); } var bH = Sx_runtime[1].call(null, cst, [0, match_val, kA]); if(Sx_types[45].call(null, bH)) return make_cek_value(condition, env, rest_k); var bI = Sx_runtime[1].call(null, cst, [0, match_val, kB]); if(Sx_types[45].call(null, bI)){ var saved_kont = Sx_runtime[23].call(null, frame, kC); return make_cek_value (condition, Sx_runtime[23].call(null, frame, kD), saved_kont); } var bJ = Sx_runtime[1].call(null, cst, [0, match_val, kE]); if(Sx_types[45].call(null, bJ)) return make_cek_value(condition, env, rest_k); var bK = Sx_runtime[1].call(null, cst, [0, match_val, kF]); if(Sx_types[45].call(null, bK)){ var test_value = Sx_runtime[23].call(null, frame, kG), fenv$20 = Sx_runtime[23].call(null, frame, kH); return continue_with_call (condition, [5, [0, test_value, 0]], fenv$20, [5, [0, test_value, 0]], rest_k); } var bL = Sx_runtime[1].call(null, cst, [0, match_val, kI]); if(Sx_types[45].call(null, bL)){ var fenv$21 = Sx_runtime[23].call(null, frame, kJ), continuable_p = Sx_runtime[23].call(null, frame, kK), handler_fn = kont_find_handler(rest_k, condition), bM = Sx_runtime[81].call(null, handler_fn); if(Sx_types[45].call(null, bM)){ last_error_kont_ref[1] = rest_k; var bN = [0, kL, [0, Sx_runtime[66].call(null, condition), 0]], bO = [2, Sx_runtime[4].call(null, bN)]; return Sx_runtime[98].call(null, bO); } var bP = Sx_types[45].call(null, continuable_p) ? kont_push(make_signal_return_frame(fenv$21, rest_k), rest_k) : kont_push(make_raise_guard_frame(fenv$21, rest_k), rest_k); return continue_with_call (handler_fn, [5, [0, condition, 0]], fenv$21, [5, [0, condition, 0]], bP); } var bQ = Sx_runtime[1].call(null, cst, [0, match_val, kM]); if(Sx_types[45].call(null, bQ)){ last_error_kont_ref[1] = rest_k; return Sx_runtime[98].call(null, kN); } var bR = Sx_runtime[1].call(null, cst, [0, match_val, kO]); if(Sx_types[45].call(null, bR)){ var f$6 = Sx_runtime[23].call(null, frame, kP), remaining$19 = Sx_runtime[23].call(null, frame, kQ), bS = [0, Sx_runtime[23].call(null, frame, kR), [0, [5, [0, condition, 0]], 0]], new_results$1 = Sx_runtime[1].call(null, cst_append, bS), fenv$22 = Sx_runtime[23].call(null, frame, kS), bT = Sx_runtime[5].call(null, remaining$19), bU = [0, Stdlib_List[34].call (null, function(c){ var a = Sx_runtime[31].call(null, c); return Sx_types[45].call(null, a); }, bT)]; if(Sx_types[45].call(null, bU)) return make_cek_value(new_results$1, fenv$22, rest_k); var bV = Sx_runtime[5].call(null, remaining$19), heads = [5, Stdlib_List[20].call (null, function(c){return Sx_runtime[12].call(null, c);}, bV)], bW = Sx_runtime[5].call(null, remaining$19), tails = [5, Stdlib_List[20].call (null, function(c){return Sx_runtime[13].call(null, c);}, bW)]; return continue_with_call (f$6, heads, fenv$22, kT, kont_push (make_multi_map_frame(f$6, tails, new_results$1, fenv$22), rest_k)); } var bX = Sx_runtime[1].call(null, cst, [0, match_val, kU]); if(Sx_types[45].call(null, bX)){ var k = Sx_runtime[96].call(null, rest_k); return continue_with_call (condition, [5, [0, k, 0]], Sx_runtime[23].call(null, frame, kV), [5, [0, k, 0]], rest_k); } var bY = Sx_runtime[1].call(null, cst, [0, match_val, kW]); if(Sx_types[45].call(null, bY)){ var resume_fn = Sx_runtime[23].call(null, frame, kX), result$0 = Sx_runtime[7].call(null, resume_fn, [5, [0, condition, 0]]), and$7 = Sx_runtime[36].call(null, result$0), bZ = Sx_types[45].call(null, and$7) ? Sx_runtime[23].call(null, result$0, kY) : and$7; if(! Sx_types[45].call(null, bZ)) return make_cek_value (result$0, Sx_runtime[23].call(null, frame, k3), rest_k); var b0 = Sx_runtime[23].call(null, frame, kZ), b1 = kont_push (make_vm_resume_frame(Sx_runtime[23].call(null, result$0, k0), b0), rest_k), b2 = Sx_runtime[23].call(null, frame, k1); return make_cek_suspended (Sx_runtime[23].call(null, result$0, k2), b2, b1); } var b3 = Sx_runtime[1].call(null, cst, [0, match_val, k4]); if(Sx_types[45].call(null, b3)) return make_cek_suspended (condition, Sx_runtime[23].call(null, frame, k5), rest_k); var b4 = Sx_runtime[1].call(null, cst, [0, match_val, k6]); if(Sx_types[45].call(null, b4)){ var import_set = Sx_runtime[23].call(null, frame, k7), remaining_sets = Sx_runtime[23].call(null, frame, k8), fenv$23 = Sx_runtime[23].call(null, frame, k9); bind_import_set(import_set, fenv$23); var b5 = Sx_runtime[31].call(null, remaining_sets); return Sx_types[45].call(null, b5) ? make_cek_value(0, fenv$23, rest_k) : step_sf_import(remaining_sets, fenv$23, rest_k); } last_error_kont_ref[1] = rest_k; var b6 = [2, Sx_runtime[4].call(null, [0, k_, [0, match_val, 0]])], b7 = Sx_runtime[2].call(null, b6); throw caml_maybe_attach_backtrace([0, Sx_types[7], b7], 1); } var k$ = [2, "captured"], la = [2, cst_args_got], lb = [2, cst_expects], lc = [2, cst_lambda], ld = [1, 1.], le = [2, cst_vm_suspended], lf = [2, cst_resume], lg = [2, cst_request], lh = [1, 1.], li = [2, cst_children], lj = [2, "Not callable: "]; function continue_with_call(f, args, env, raw_args, kont){ var b = Sx_runtime[95].call(null, f); if(Sx_types[45].call(null, b)){ var c = Sx_runtime[31].call(null, args), arg = Sx_types[45].call(null, c) ? 0 : Sx_runtime[12].call(null, args), captured = Sx_runtime[97].call(null, f); return make_cek_value(arg, env, captured); } var d = Sx_runtime[92].call(null, f); if(Sx_types[45].call(null, d)){ var e = Sx_runtime[31].call(null, args), arg$0 = Sx_types[45].call(null, e) ? 0 : Sx_runtime[12].call(null, args), cont_data = Sx_runtime[94].call(null, f), captured$0 = Sx_runtime[23].call(null, cont_data, k$), result = cek_run(make_cek_value(arg$0, env, captured$0)); return make_cek_value(result, env, kont); } var and = Sx_runtime[88].call(null, f); if(Sx_types[45].call(null, and)){ var g = Sx_runtime[83].call(null, f), and$0 = [0, 1 - Sx_types[45].call(null, g)]; if(Sx_types[45].call(null, and$0)){ var h = Sx_runtime[84].call(null, f), and$1 = [0, 1 - Sx_types[45].call(null, h)]; if(Sx_types[45].call(null, and$1)) var i = Sx_runtime[85].call(null, f), a = [0, 1 - Sx_types[45].call(null, i)]; else var a = and$1; } else var a = and$0; } else var a = and; if(Sx_types[45].call(null, a)) return make_cek_value(Sx_runtime[7].call(null, f, args), env, kont); var j = Sx_runtime[83].call(null, f); if(! Sx_types[45].call(null, j)){ var or$1 = Sx_runtime[84].call(null, f), or$2 = Sx_types[45].call(null, or$1) ? or$1 : Sx_runtime[85].call(null, f); if(! Sx_types[45].call(null, or$2)){ var J = [0, lj, [0, Sx_runtime[66].call(null, f), 0]], K = [2, Sx_runtime[4].call(null, J)], L = Sx_runtime[2].call(null, K); throw caml_maybe_attach_backtrace([0, Sx_types[7], L], 1); } var parsed = parse_keyword_args(raw_args, env), kwargs = Sx_runtime[12].call(null, parsed), children = Sx_runtime[15].call(null, parsed, lh), C = Sx_types[59].call(null, f), local$0 = Sx_runtime[79].call(null, C, env), D = Sx_types[57].call(null, f), E = Sx_runtime[5].call(null, D); Stdlib_List[18].call (null, function(p){ var or = Sx_runtime[54].call(null, kwargs, p), or$0 = Sx_types[45].call(null, or) ? or : 0, a = Sx_runtime[3].call(null, p); Sx_runtime[75].call(null, local$0, a, or$0); return 0; }, E); var F = Sx_types[60].call(null, f); if(Sx_types[45].call(null, F)){ var G = Sx_runtime[3].call(null, li); Sx_runtime[75].call(null, local$0, G, children); } var H = Sx_types[54].call(null, f), I = kont_push(make_comp_trace_frame(Sx_types[53].call(null, f), H), kont); return make_cek_state(Sx_types[58].call(null, f), local$0, I); } var params = Sx_types[48].call(null, f), k = Sx_types[50].call(null, f), local = Sx_runtime[79].call(null, k, env), l = bind_lambda_params(params, args, local), m = [0, 1 - Sx_types[45].call(null, l)]; if(Sx_types[45].call(null, m)){ var n = [0, Sx_runtime[22].call(null, params), 0], o = [0, Sx_runtime[22].call(null, args), n], p = Sx_runtime[1].call(null, cst$5, o); if(Sx_types[45].call(null, p)){ var q = [0, la, [0, Sx_runtime[22].call(null, args), 0]], r = [0, lb, [0, Sx_runtime[22].call(null, params), q]], or = Sx_types[51].call(null, f), or$0 = Sx_types[45].call(null, or) ? or : lc, s = [2, Sx_runtime[4].call(null, [0, or$0, r])], t = Sx_runtime[2].call(null, s); throw caml_maybe_attach_backtrace([0, Sx_types[7], t], 1); } var u = Sx_runtime[1].call(null, cst_zip, [0, params, [0, args, 0]]), v = Sx_runtime[5].call(null, u); Stdlib_List[18].call (null, function(pair){ var a = Sx_runtime[15].call(null, pair, ld), b = Sx_runtime[12].call(null, pair), c = Sx_runtime[3].call(null, b); Sx_runtime[75].call(null, local, c, a); return 0; }, v); var w = [0, params, [0, Sx_runtime[22].call(null, args), 0]], x = Sx_runtime[1].call(null, cst_slice, w), y = Sx_runtime[5].call(null, x); Stdlib_List[18].call (null, function(p){ var a = Sx_runtime[3].call(null, p); Sx_runtime[75].call(null, local, a, 0); return 0; }, y); } var jit_result = Sx_runtime[127].call(null, f, args), z = Sx_runtime[81].call(null, jit_result); if(Sx_types[45].call(null, z)) return make_cek_state(Sx_types[49].call(null, f), local, kont); var and$2 = Sx_runtime[36].call(null, jit_result), A = Sx_types[45].call(null, and$2) ? Sx_runtime[23].call(null, jit_result, le) : and$2; if(! Sx_types[45].call(null, A)) return make_cek_value(jit_result, local, kont); var B = kont_push (make_vm_resume_frame(Sx_runtime[23].call(null, jit_result, lf), env), kont); return make_cek_suspended (Sx_runtime[23].call(null, jit_result, lg), env, B); } var lk = [0, [1, 2.], 0], ll = [1, 1.], lm = [0, [1, 2.], 0]; function sf_case_step_loop(match_val, clauses$1, env, kont){ var clauses = clauses$1; for(;;){ var a = [0, Sx_runtime[22].call(null, clauses), lk], b = Sx_runtime[1].call(null, cst$4, a); if(Sx_types[45].call(null, b)) return make_cek_value(0, env, kont); var test = Sx_runtime[12].call(null, clauses), body = Sx_runtime[15].call(null, clauses, ll), c = is_else_clause(test); if(Sx_types[45].call(null, c)) return make_cek_state(body, env, kont); var test_val = trampoline(eval_expr(test, env)), d = Sx_runtime[1].call(null, cst, [0, match_val, [0, test_val, 0]]); if(Sx_types[45].call(null, d)) return make_cek_state(body, env, kont); var clauses$0 = Sx_runtime[1].call(null, cst_slice, [0, clauses, lm]); clauses = clauses$0; } } var ln = [5, 0]; function eval_expr_cek(expr, env){ return cek_run(make_cek_state(expr, env, ln)); } function trampoline_cek(val){ var a = Sx_runtime[82].call(null, val); if(! Sx_types[45].call(null, a)) return val; var b = Sx_types[67].call(null, val); return eval_expr_cek(Sx_types[66].call(null, val), b); } var lo = [5, 0]; function eval_expr(expr, env){ return cek_run(make_cek_state(expr, env, lo)); } caml_update_dummy (custom_special_forms, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]); caml_update_dummy (library_registry, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]); caml_update_dummy(io_registry, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]); trampoline_fn[1] = function(v){ if(typeof v !== "number" && 11 === v[0]){ var env = v[2], expr = v[1]; return eval_expr(expr, [19, env]); } return v; }; Sx_primitives[3][1] = trampoline_fn[1]; function cek_run_iterative(state){ var s = [0, state]; try{ for(;;){ var match = cek_terminal_p(s[1]); a: { if(typeof match !== "number" && 0 === match[0] && match[1]){var a = 1; break a;} var a = 0; } if(! a){ var match$1 = cek_suspended_p(s[1]); a: { if(typeof match$1 !== "number" && 0 === match$1[0] && match$1[1]){var b = 1; break a;} var b = 0; } if(! b){s[1] = cek_step(s[1]); continue;} } var match$0 = cek_suspended_p(s[1]); if(typeof match$0 !== "number" && 0 === match$0[0] && match$0[1]) throw caml_maybe_attach_backtrace ([0, Sx_types[7], cst_IO_suspension_in_non_IO_co], 1); var c = cek_value(s[1]); return c; } } catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn[1] !== Sx_types[7]) throw caml_maybe_attach_backtrace(exn, 0); var msg = exn[2]; last_error_kont_ref[1] = cek_kont(s[1]); throw caml_maybe_attach_backtrace([0, Sx_types[7], msg], 1); } } var cst$14 = "", a = [5, 0]; function collect_comp_trace(kont){ var k = kont, trace = 0; for(;;){ a: { if(typeof k !== "number" && 5 === k[0] && k[1]){var c = 1; break a;} var c = 0; } if(! c) return Stdlib_List[10].call(null, trace); if(typeof k === "number" || ! (5 === k[0])) k = a; else{ var match = k[1]; if(match){ var rest = match[2], frame = match[1]; if(typeof frame === "number") var trace$0 = trace; else switch(frame[0]){ case 6: var d = frame[1], match$0 = Stdlib_Hashtbl[7].call(null, d, cst_type); a: { if(match$0){ var b = match$0[1]; if (typeof b !== "number" && 2 === b[0] && b[1] === cst_comp_trace){var e = 1; break a;} } var e = 0; } if(e){ var match$1 = Stdlib_Hashtbl[7].call(null, d, cst_name), cst = cst$0; if(match$1){ var match$2 = match$1[1]; if(typeof match$2 === "number" || ! (2 === match$2[0])) var name = cst; else var s$0 = match$2[1], name = s$0; } else var name = cst; var match$3 = Stdlib_Hashtbl[7].call(null, d, cst_file), cst$1 = cst$14; if(match$3){ var match$4 = match$3[1]; if(typeof match$4 === "number" || ! (2 === match$4[0])) var file = cst$1; else var s = match$4[1], file = s; } else var file = cst$1; var trace$0 = [0, [0, name, file], trace]; } else var trace$0 = trace; break; case 22: var f = frame[1]; if(f[1] === cst_comp_trace){ var match$5 = f[3]; if(typeof match$5 === "number" || ! (2 === match$5[0])) var name$0 = cst$0; else var s$2 = match$5[1], name$0 = s$2; var match$6 = f[2]; if(typeof match$6 === "number") var file$0 = cst$14; else if(2 === match$6[0]) var s$1 = match$6[1], file$0 = s$1; else var file$0 = cst$14; var trace$0 = [0, [0, name$0, file$0], trace]; } else var trace$0 = trace; break; default: var trace$0 = trace; } k = [5, rest]; trace = trace$0; } else k = a; } } } function format_comp_trace(trace){ if(! trace) return cst$14; var lines = Stdlib_List[21].call (null, function(i, param){ var file = param[2], name = param[1], prefix = 0 === i ? " in " : " called from "; if(file === cst$14){ var a = Stdlib[28].call(null, cst$11, name); return Stdlib[28].call(null, prefix, a); } var b = Stdlib[28].call(null, file, cst$2), c = Stdlib[28].call(null, cst$3, b), d = Stdlib[28].call(null, name, c), e = Stdlib[28].call(null, cst$11, d); return Stdlib[28].call(null, prefix, e); }, trace), cst = "\n", a = Stdlib_String[7].call(null, cst, lines); return Stdlib[28].call(null, cst, a); } function enhance_error_with_trace(msg){ var trace = collect_comp_trace(last_error_kont_ref[1]); last_error_kont_ref[1] = 0; var a = format_comp_trace(trace); return Stdlib[28].call(null, msg, a); } runtime.caml_register_global (1232, [0, trampoline_fn, trampoline, strict_ref, prim_param_types_ref, last_error_kont_ref, make_cek_state, make_cek_value, make_cek_suspended, cek_terminal_p, cek_suspended_p, cek_control, cek_env, cek_kont, cek_phase, cek_io_request, cek_value, make_if_frame, make_when_frame, make_begin_frame, make_let_frame, make_define_frame, make_set_frame, make_arg_frame, make_call_frame, make_cond_frame, make_cond_arrow_frame, make_case_frame, make_thread_frame, thread_insert_arg, make_map_frame, make_map_indexed_frame, make_multi_map_frame, make_filter_frame, make_reduce_frame, make_for_each_frame, make_some_frame, make_every_frame, make_scope_frame, make_provide_frame, make_scope_acc_frame, make_reset_frame, make_dict_frame, make_and_frame, make_or_frame, make_dynamic_wind_frame, make_reactive_reset_frame, make_callcc_frame, make_deref_frame, make_ho_setup_frame, make_comp_trace_frame, kont_collect_comp_trace, make_handler_frame, make_restart_frame, make_signal_return_frame, make_raise_eval_frame, make_raise_guard_frame, make_perform_frame, make_vm_resume_frame, make_import_frame, find_matching_handler, kont_find_handler, find_named_restart, kont_find_restart, frame_type, kont_push, kont_top, kont_pop, kont_empty_p, kont_capture_to_reset, kont_find_provide, kont_find_scope_acc, has_reactive_reset_frame_p, kont_capture_to_reactive_reset, custom_special_forms, register_special_form, render_check, render_fn, library_registry, library_name_key, library_loaded_p, library_exports, register_library, io_registry, io_register_b, io_registered_p, io_lookup, io_names, step_sf_io, strict, set_strict_b, prim_param_types, set_prim_param_types_b, value_matches_type_p, strict_check_args, bind_lambda_params, call_lambda, call_component, parse_keyword_args, cond_scheme_p, is_else_clause, sf_named_let, sf_lambda, sf_defcomp, defcomp_kwarg, parse_comp_params, sf_defisland, defio_parse_kwargs_b, sf_defio, sf_defmacro, parse_macro_params, qq_expand, sf_letrec, step_sf_letrec, sf_dynamic_wind, sf_scope, sf_provide, expand_macro, cek_step_loop, cek_run, cek_resume, cek_step, step_eval, step_sf_raise, step_sf_guard, step_eval_list, step_sf_define_library, bind_import_set, step_sf_import, step_sf_perform, sf_define_record_type, step_sf_callcc, match_find_clause, match_pattern, step_sf_match, step_sf_handler_bind, step_sf_restart_case, step_sf_signal, step_sf_invoke_restart, step_sf_if, step_sf_when, step_sf_begin, step_sf_let, step_sf_define, step_sf_set_b, step_sf_and, step_sf_or, step_sf_cond, step_sf_case, step_sf_thread_first, step_sf_lambda, step_sf_scope, step_sf_provide, step_sf_context, step_sf_emit, step_sf_emitted, step_sf_reset, step_sf_shift, step_sf_deref, cek_call, reactive_shift_deref, step_eval_call, ho_form_name_p, ho_fn_p, ho_swap_args, ho_setup_dispatch, step_ho_map, step_ho_map_indexed, step_ho_filter, step_ho_reduce, step_ho_some, step_ho_every, step_ho_for_each, step_continue, continue_with_call, sf_case_step_loop, eval_expr_cek, trampoline_cek, eval_expr, cek_run_iterative, collect_comp_trace, format_comp_trace, enhance_error_with_trace], "Sx_ref"); return; } (globalThis)); //# 13140 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_vm:[N,N,N,F(1)*,N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1),F(1)*,N,N,N,F(1),F(1),F(3),F(1),F(3),F(3),F(2),F(3),F(1),F(2),F(2),F(2),F(1),F(1)*,F(2),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, caml_equal = runtime.caml_equal, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 ? f(a0) : runtime.caml_call_gen(f, [a0]); } function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } function caml_call4(f, a0, a1, a2, a3){ return (f.l >= 0 ? f.l : f.l = f.length) === 4 ? f(a0, a1, a2, a3) : runtime.caml_call_gen(f, [a0, a1, a2, a3]); } function caml_call8(f, a0, a1, a2, a3, a4, a5, a6, a7){ return (f.l >= 0 ? f.l : f.l = f.length) === 8 ? f(a0, a1, a2, a3, a4, a5, a6, a7) : runtime.caml_call_gen(f, [a0, a1, a2, a3, a4, a5, a6, a7]); } var global_data = runtime.caml_get_global_data(), Sx_runtime = global_data.Sx_runtime, Stdlib = global_data.Stdlib, Sx_types = global_data.Sx_types, Sx_primitives = global_data.Sx_primitives, Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib_List = global_data.Stdlib__List, Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_String = global_data.Stdlib__String, Stdlib_Array = global_data.Stdlib__Array, Sx_ref = global_data.Sx_ref, Sx_parser = global_data.Sx_parser, Stdlib_Printexc = global_data.Stdlib__Printexc, VmSuspended = [248, "Sx_vm.VmSuspended", runtime.caml_fresh_oo_id(0)], jit_compile_ref = [0, function(a, param){return 0;}], jit_failed_sentinel = [0, [0, -1, 0, [0], [0]], [0], [0, "__jit_failed__"], Stdlib_Hashtbl[1].call(null, 0, 0), 0]; function is_jit_failed(cl){return -1 === cl[1][1] ? 1 : 0;} function create(globals){ return [0, caml_make_vect(4096, 0), 0, 0, globals, 0]; } function push(vm, v){ if(vm[1].length - 1 <= vm[2]){ var ns = caml_make_vect(vm[2] * 2 | 0, 0); Stdlib_Array[9].call(null, vm[1], 0, ns, 0, vm[2]); vm[1] = ns; } var a = vm[2]; caml_check_bound(vm[1], a)[a + 1] = v; vm[2] = vm[2] + 1 | 0; return 0; } function pop(vm){ vm[2] = vm[2] - 1 | 0; var a = vm[2]; return caml_check_bound(vm[1], a)[a + 1]; } function peek(vm){ var a = vm[2] - 1 | 0; return caml_check_bound(vm[1], a)[a + 1]; } function read_u8(f){ var a = f[2], v = caml_check_bound(f[1][1][3], a)[a + 1]; f[2] = f[2] + 1 | 0; return v; } function read_u16(f){ var a = f[2], lo = caml_check_bound(f[1][1][3], a)[a + 1], b = f[2] + 1 | 0, hi = caml_check_bound(f[1][1][3], b)[b + 1]; f[2] = f[2] + 2 | 0; return lo | hi << 8; } function read_i16(f){ var v = read_u16(f); return 32768 <= v ? v - 65536 | 0 : v; } function closure_to_value(cl){ var match = cl[3]; function a(args){ var a = Stdlib_List[20].call(null, Sx_runtime[2], args), b = Stdlib_String[7].call(null, ",", a), c = Stdlib[28].call(null, "VM_CLOSURE_CALL:", b); throw caml_maybe_attach_backtrace([0, Sx_types[7], c], 1); } if(match) var n = match[1], n$0 = n; else var n$0 = "anon"; return [14, Stdlib[28].call(null, "vm:", n$0), a]; } var vm_insn_count = [0, 0], vm_call_count = [0, 0], vm_cek_count = [0, 0]; function vm_reset_counters(param){ vm_insn_count[1] = 0; vm_call_count[1] = 0; vm_cek_count[1] = 0; return 0; } var d = [0, [11, "[vm-perf] insns=", [4, 0, 0, 0, [11, " calls=", [4, 0, 0, 0, [11, " cek_fallbacks=", [4, 0, 0, 0, [12, 10, [10, 0]]]]]]]], "[vm-perf] insns=%d calls=%d cek_fallbacks=%d\n%!"]; function vm_report_counters(param){ var a = vm_cek_count[1], b = vm_call_count[1], c = vm_insn_count[1]; return caml_call3(Stdlib_Printf[3].call(null, d), c, b, a); } function push_closure_frame(vm, cl, args){ var c = Stdlib_Hashtbl[1].call(null, 0, 4), frame = [0, cl, 0, vm[2], c]; Stdlib_List[18].call(null, function(a){return push(vm, a);}, args); var a = Stdlib_List[1].call(null, args), b = cl[1][2] - 1 | 0; if(b >= a){ var for$ = a; for(;;){ push(vm, 0); var d = for$ + 1 | 0; if(b === for$) break; for$ = d; } } vm[3] = [0, frame, vm[3]]; return 0; } var cst_arity = "arity", cst_bytecode = "bytecode", cst_constants = "constants"; function code_from_value(v){ if(typeof v !== "number" && 6 === v[0]){ var d = v[1], match = Stdlib_Hashtbl[7].call(null, d, cst_bytecode); a: { b: if(match){ var a = match[1]; if(typeof a !== "number"){ switch(a[0]){ case 5: var l$0 = a[1]; break; case 20: var l$0 = a[1][1]; break; default: break b; } var c = Stdlib_List[20].call (null, function(x){ if(typeof x !== "number" && 1 === x[0]){var n = x[1]; return n | 0;} return 0; }, l$0), bc_list = Stdlib_Array[11].call(null, c); break a; } } var bc_list = [0]; } var match$0 = Stdlib_Hashtbl[7].call(null, d, cst_constants); a: { b: if(match$0){ var b = match$0[1]; if(typeof b !== "number"){ switch(b[0]){ case 5: var l = b[1]; break; case 20: var l = b[1][1]; break; default: break b; } var entries = Stdlib_Array[11].call(null, l); break a; } } var entries = [0]; } var constants = Stdlib_Array[14].call (null, function(entry){ if(typeof entry !== "number" && 6 === entry[0]){ var ed = entry[1]; if(Stdlib_Hashtbl[9].call(null, ed, cst_bytecode)) return entry; } return entry; }, entries), match$1 = Stdlib_Hashtbl[7].call(null, d, cst_arity); a: { if(match$1){ var match$2 = match$1[1]; if(typeof match$2 !== "number" && 1 === match$2[0]){var n = match$2[1], arity = n | 0; break a;} } var arity = 0; } return [0, arity, arity + 16 | 0, bc_list, constants]; } return [0, 0, 16, [0], [0]]; } var cst_io_suspended = "io-suspended", cst_phase = "phase", cst_request = "request", e = [5, 0], f = [2, cst_phase], g = [2, cst_request]; function cek_call_or_suspend(vm, f$0, args){ if(typeof args === "number") var a = 0; else if(5 === args[0]) var l = args[1], a = l; else var a = [0, args, 0]; var b = [19, Sx_types[11].call(null, 0)], state = Sx_ref[174].call(null, f$0, [5, a], b, [5, a], e), final = Sx_ref[118].call(null, state), match = Sx_runtime[10].call(null, final, f); if (typeof match !== "number" && 2 === match[0] && match[1] === cst_io_suspended){ vm[5] = [0, final]; throw caml_maybe_attach_backtrace ([0, VmSuspended, Sx_runtime[10].call(null, final, g), vm], 1); } return Sx_ref[16].call(null, final); } var active_vm = [0, 0]; function call_closure(cl, args, globals){ vm_call_count[1]++; var prev_vm = active_vm[1], vm = create(globals); active_vm[1] = [0, vm]; push_closure_frame(vm, cl, args); try{run(vm);} catch(e$0){ var e = caml_wrap_exception(e$0); active_vm[1] = prev_vm; throw caml_maybe_attach_backtrace(e, 0); } active_vm[1] = prev_vm; return pop(vm); } function call_closure_reuse(cl, args){ return call_closure(cl, args, cl[4]); } function vm_call(vm, f, args){ if(typeof f !== "number") switch(f[0]){ case 7: var l = f[1], match = l[5]; if(match){ var cl = match[1]; if(is_jit_failed(cl)) return push(vm, cek_call_or_suspend(vm, f, [5, args])); try{var c = push(vm, call_closure(cl, args, cl[4])); return c;} catch(e){return push(vm, cek_call_or_suspend(vm, f, [5, args]));} } if(0 === l[4]) return push(vm, cek_call_or_suspend(vm, f, [5, args])); l[5] = [0, jit_failed_sentinel]; var match$0 = caml_call2(jit_compile_ref[1], l, vm[4]); if(! match$0) return push(vm, cek_call_or_suspend(vm, f, [5, args])); var cl$0 = match$0[1]; l[5] = [0, cl$0]; try{var d = push(vm, call_closure(cl$0, args, cl$0[4])); return d;} catch(e){return push(vm, cek_call_or_suspend(vm, f, [5, args]));} case 14: var fn = f[2], result = caml_call1(fn, args); return push(vm, result); case 23: var cl$1 = f[1]; return push_closure_frame(vm, cl$1, args); case 8: case 9: vm_cek_count[1]++; return push(vm, cek_call_or_suspend(vm, f, [5, args])); } var a = Sx_runtime[2].call(null, f), b = Stdlib[28].call(null, "VM: not callable: ", a); throw caml_maybe_attach_backtrace([0, Sx_types[7], b], 1); } var cst$1 = "", cst_base = " (base=", cst_at_ip = " at ip=", cst_sp = " sp=", cst$0 = ")\n", cst = "?", cst_VM_undefined = "VM undefined: ", cst_VM_unknown_primitive = "VM: unknown primitive ", cst_upvalue_count = "upvalue-count", b = [5, 0], h = [0, [11, "[vm] WARN: bytecode exhausted without RETURN in ", [2, 0, [11, cst_base, [4, 0, 0, 0, [11, cst_sp, [4, 0, 0, 0, [11, " frames=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]]]], "[vm] WARN: bytecode exhausted without RETURN in %s (base=%d sp=%d frames=%d)\n%!"], i = [0, [11, "VM: ", [2, 0, [11, cst_at_ip, [4, 0, 0, 0, [11, " op=", [4, 0, 0, 0, [11, " in ", [2, 0, [11, cst_base, [4, 0, 0, 0, [11, cst_sp, [4, 0, 0, 0, [11, " bc_len=", [4, 0, 0, 0, [11, " consts=", [4, 0, 0, 0, [12, 41, 0]]]]]]]]]]]]]]]]], "VM: %s at ip=%d op=%d in %s (base=%d sp=%d bc_len=%d consts=%d)"], j = [0, [11, "VM: unknown opcode ", [4, 0, 0, 0, [11, cst_at_ip, [4, 0, 0, 0, 0]]]], "VM: unknown opcode %d at ip=%d"], k = [1, 0.], l = [0, [11, "VM: CONST index ", [4, 0, 0, 0, [11, " out of bounds (pool size ", [4, 0, 0, 0, [12, 41, 0]]]]], "VM: CONST index %d out of bounds (pool size %d)"], m = [0, 1], n = [0, 0], o = [0, [11, "VM: LOCAL_GET slot=", [4, 0, 0, 0, [11, " base=", [4, 0, 0, 0, [11, cst_sp, [4, 0, 0, 0, [11, " out of bounds", 0]]]]]]], "VM: LOCAL_GET slot=%d base=%d sp=%d out of bounds"], p = [0, [11, "VM: UPVALUE_GET idx=", [4, 0, 0, 0, [11, " out of bounds (have ", [4, 0, 0, 0, [12, 41, 0]]]]], "VM: UPVALUE_GET idx=%d out of bounds (have %d)"], q = [0, [11, "VM: CLOSURE idx ", [4, 0, 0, 0, [11, " >= consts ", [4, 0, 0, 0, 0]]]], "VM: CLOSURE idx %d >= consts %d"], r = [0, [2, 0, [11, ' (in CALL_PRIM "', [2, 0, [11, '" with ', [4, 0, 0, 0, [11, " args)", 0]]]]]], '%s (in CALL_PRIM "%s" with %d args)']; function run(vm){ for(;;){ if(0 === vm[3]) return 0; var match = vm[3]; if(match){ var rest_frames = match[2], frame = match[1], bc = frame[1][1][3], consts = frame[1][1][4]; if(bc.length - 1 <= frame[2]){ var match$0 = frame[1][3]; if(match$0) var n$0 = match$0[1], fn_name = n$0; else var fn_name = cst; var O = Stdlib_List[1].call(null, rest_frames), P = vm[2], Q = frame[3]; caml_call4(Stdlib_Printf[3].call(null, h), fn_name, Q, P, O); var result = frame[3] < vm[2] ? pop(vm) : 0; vm[3] = rest_frames; vm[2] = frame[3]; if(0 !== rest_frames) push(vm, result); } else{ var saved_ip = frame[2], B = frame[2], op = caml_check_bound(bc, B)[B + 1]; frame[2] = frame[2] + 1 | 0; try{ a: { if(66 <= op){ var switcher = op - 112 | 0; if(63 >= switcher >>> 0){ var cst$0 = "-"; switch(switcher){ case 0: var request = pop(vm); throw caml_maybe_attach_backtrace ([0, VmSuspended, request, vm], 1); case 16: var idx = read_u16(frame), match$2 = caml_check_bound(consts, idx)[idx + 1]; if(typeof match$2 === "number" || ! (2 === match$2[0])) var name = cst$1; else var s = match$2[1], name = s; var v = peek(vm); Stdlib_Hashtbl[11].call(null, vm[4], name, v); var match$3 = Sx_types[14][1]; if(! match$3) break a; var f = match$3[1]; caml_call2(f, name, v); break a; case 32: var count = read_u8(frame), W = Stdlib_List[11].call (null, count, function(param){return pop(vm);}), parts = Stdlib_List[10].call(null, W), X = Stdlib_List[20].call(null, Sx_runtime[2], parts), s$0 = Stdlib_String[7].call(null, cst$1, X); push(vm, [2, s$0]); break a; case 48: var b$0 = pop(vm), a = pop(vm); b: { if (typeof a !== "number" && 1 === a[0] && typeof b$0 !== "number" && 1 === b$0[0]){var y = b$0[1], x = a[1], C = [1, x + y]; break b;} var C = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "+"), [0, a, [0, b$0, 0]]); } push(vm, C); break a; case 49: var b$1 = pop(vm), a$0 = pop(vm); b: { if (typeof a$0 !== "number" && 1 === a$0[0] && typeof b$1 !== "number" && 1 === b$1[0]){ var y$0 = b$1[1], x$0 = a$0[1], D = [1, x$0 - y$0]; break b; } var D = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], cst$0), [0, a$0, [0, b$1, 0]]); } push(vm, D); break a; case 50: var b$2 = pop(vm), a$1 = pop(vm); b: { if (typeof a$1 !== "number" && 1 === a$1[0] && typeof b$2 !== "number" && 1 === b$2[0]){ var y$1 = b$2[1], x$1 = a$1[1], E = [1, x$1 * y$1]; break b; } var E = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "*"), [0, a$1, [0, b$2, 0]]); } push(vm, E); break a; case 51: var b$3 = pop(vm), a$2 = pop(vm); b: { if (typeof a$2 !== "number" && 1 === a$2[0] && typeof b$3 !== "number" && 1 === b$3[0]){ var y$2 = b$3[1], x$2 = a$2[1], F = [1, x$2 / y$2]; break b; } var F = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "/"), [0, a$2, [0, b$3, 0]]); } push(vm, F); break a; case 52: var b$4 = pop(vm), a$3 = pop(vm), norm = function(v){ if(typeof v !== "number") switch(v[0]){ case 5: var l = v[1]; return [5, Stdlib_List[20].call(null, norm$0, l)]; case 20: var l$0 = v[1][1]; return [5, Stdlib_List[20].call(null, norm$0, l$0)]; } return v; }; let norm$0 = norm; var Y = norm(b$4); push(vm, [0, caml_equal(norm(a$3), Y)]); break a; case 53: var b$5 = pop(vm), a$4 = pop(vm); b: { if(typeof a$4 !== "number") switch(a$4[0]){ case 1: if(typeof b$5 !== "number" && 1 === b$5[0]){ var y$3 = b$5[1], x$3 = a$4[1], z = [0, x$3 < y$3 ? 1 : 0]; break b; } break; case 2: if(typeof b$5 !== "number" && 2 === b$5[0]){ var y$4 = b$5[1], x$4 = a$4[1], z = [0, runtime.caml_string_lessthan(x$4, y$4)]; break b; } break; } var z = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "<"), [0, a$4, [0, b$5, 0]]); } push(vm, z); break a; case 54: var b$6 = pop(vm), a$5 = pop(vm); b: { if(typeof a$5 !== "number") switch(a$5[0]){ case 1: if(typeof b$6 !== "number" && 1 === b$6[0]){ var y$5 = b$6[1], x$5 = a$5[1], A = [0, y$5 < x$5 ? 1 : 0]; break b; } break; case 2: if(typeof b$6 !== "number" && 2 === b$6[0]){ var y$6 = b$6[1], x$6 = a$5[1], A = [0, runtime.caml_string_greaterthan(x$6, y$6)]; break b; } break; } var A = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], ">"), [0, a$5, [0, b$6, 0]]); } push(vm, A); break a; case 55: var v$0 = pop(vm); push(vm, [0, 1 - Sx_types[45].call(null, v$0)]); break a; case 56: var v$1 = pop(vm); b: if(typeof v$1 === "number") var c = k; else{ switch(v$1[0]){ case 2: var s$1 = v$1[1], c = [1, caml_ml_string_length(s$1)]; break b; case 5: var l$0 = v$1[1]; break; case 6: var d = v$1[1], c = [1, Stdlib_Hashtbl[15].call(null, d)]; break b; case 20: var l$0 = v$1[1][1]; break; default: var c = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "len"), [0, v$1, 0]); break b; } var c = [1, Stdlib_List[1].call(null, l$0)]; } push(vm, c); break a; case 57: var v$2 = pop(vm); b: { if(typeof v$2 !== "number") switch(v$2[0]){ case 5: var G = v$2[1]; if(G){var u = G[1]; break b;} break; case 20: var H = v$2[1][1]; if(H){var u = H[1]; break b;} break; default: var u = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "first"), [0, v$2, 0]); break b; } var u = 0; } push(vm, u); break a; case 58: var v$3 = pop(vm); b: if(typeof v$3 === "number") var g = b; else{ switch(v$3[0]){ case 5: var I = v$3[1]; if(! I){var g = b; break b;} var xs = I[2]; break; case 20: var J = v$3[1][1]; if(! J){var g = b; break b;} var xs = J[2]; break; default: var g = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "rest"), [0, v$3, 0]); break b; } var g = [5, xs]; } push(vm, g); break a; case 59: var n$2 = pop(vm), coll = pop(vm); b: { c: if(typeof coll !== "number"){ switch(coll[0]){ case 2: if(typeof n$2 === "number") break c; if(1 !== n$2[0]) break c; var f$0 = n$2[1], s$2 = coll[1], i$0 = f$0 | 0; if(0 <= i$0 && i$0 < caml_ml_string_length(s$2)){ var Z = runtime.caml_string_get(s$2, i$0), t = [2, Stdlib_String[1].call(null, 1, Z)]; break b; } var t = 0; break b; case 5: var l$1 = coll[1]; break; case 20: var l$1 = coll[1][1]; break; default: break c; } if(typeof n$2 !== "number" && 1 === n$2[0]){ var f$1 = n$2[1]; try{ var _ = Stdlib_List[8].call(null, l$1, f$1 | 0), t = _; break b; } catch(exn){var t = 0; break b;} } } var t = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "nth"), [0, coll, [0, n$2, 0]]); } push(vm, t); break a; case 60: var coll$0 = pop(vm), x$7 = pop(vm); if(typeof coll$0 === "number") var w = [5, [0, x$7, 0]]; else switch(coll$0[0]){ case 5: var l$2 = coll$0[1], w = [5, [0, x$7, l$2]]; break; case 20: var l$3 = coll$0[1][1], w = [5, [0, x$7, l$3]]; break; default: var w = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "cons"), [0, x$7, [0, coll$0, 0]]); } push(vm, w); break a; case 61: var v$4 = pop(vm); b: { if(typeof v$4 !== "number" && 1 === v$4[0]){var x$8 = v$4[1], K = [1, - x$8]; break b; } var K = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], cst$0), [0, v$4, 0]); } push(vm, K); break a; case 62: var v$5 = pop(vm); b: { if(typeof v$5 !== "number" && 1 === v$5[0]){ var x$9 = v$5[1], L = [1, x$9 + 1.]; break b; } var L = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "inc"), [0, v$5, 0]); } push(vm, L); break a; case 63: var v$6 = pop(vm); b: { if(typeof v$6 !== "number" && 1 === v$6[0]){ var x$10 = v$6[1], M = [1, x$10 - 1.]; break b; } var M = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "dec"), [0, v$6, 0]); } push(vm, M); break a; } } } else if(0 < op) switch(op - 1 | 0){ case 0: var idx$0 = read_u16(frame); if(consts.length - 1 <= idx$0){ var $ = caml_call2 (Stdlib_Printf[4].call(null, l), idx$0, consts.length - 1); throw caml_maybe_attach_backtrace([0, Sx_types[7], $], 1); } push(vm, caml_check_bound(consts, idx$0)[idx$0 + 1]); break a; case 1: push(vm, 0); break a; case 2: push(vm, m); break a; case 3: push(vm, n); break a; case 4: pop(vm); break a; case 5: push(vm, peek(vm)); break a; case 15: var slot = read_u8(frame), match$4 = Stdlib_Hashtbl[7].call(null, frame[4], slot); if(match$4) var cell = match$4[1], v$7 = cell[1]; else{ var idx$1 = frame[3] + slot | 0; if(vm[2] <= idx$1){ var aa = vm[2], ab = frame[3], ac = caml_call3(Stdlib_Printf[4].call(null, o), slot, ab, aa); throw caml_maybe_attach_backtrace([0, Sx_types[7], ac], 1); } var v$7 = caml_check_bound(vm[1], idx$1)[idx$1 + 1]; } push(vm, v$7); break a; case 16: var slot$0 = read_u8(frame), v$8 = peek(vm), match$5 = Stdlib_Hashtbl[7].call(null, frame[4], slot$0); if(match$5){var cell$0 = match$5[1]; cell$0[1] = v$8; break a;} var N = frame[3] + slot$0 | 0; caml_check_bound(vm[1], N)[N + 1] = v$8; break a; case 17: var idx$2 = read_u8(frame); if(frame[1][2].length - 1 <= idx$2){ var ad = frame[1][2].length - 1, ae = caml_call2(Stdlib_Printf[4].call(null, p), idx$2, ad); throw caml_maybe_attach_backtrace([0, Sx_types[7], ae], 1); } push(vm, caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1]); break a; case 18: var idx$3 = read_u8(frame), af = peek(vm); caml_check_bound(frame[1][2], idx$3)[idx$3 + 1][1] = af; break a; case 19: var idx$4 = read_u16(frame), match$6 = caml_check_bound(consts, idx$4)[idx$4 + 1]; if(typeof match$6 === "number" || ! (2 === match$6[0])) var name$0 = cst$1; else var s$3 = match$6[1], name$0 = s$3; try{ var al = Stdlib_Hashtbl[6].call(null, vm[4], name$0), v$9 = al; } catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$0, 0); var id = Sx_types[4].call(null, name$0), match$8 = frame[1][5]; if(match$8){ var env = match$8[1], e = env; for(;;) try{ var ai = Stdlib_Hashtbl[6].call(null, e[1], id), v$9 = ai; break; } catch(exn){ var exn$1 = caml_wrap_exception(exn); if(exn$1 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$1, 0); var match$7 = e[2]; if(! match$7) try{ var ah = Sx_primitives[15].call(null, name$0), v$9 = ah; break; } catch(exn){ var ag = Stdlib[28].call(null, cst_VM_undefined, name$0); throw caml_maybe_attach_backtrace([0, Sx_types[7], ag], 1); } var p$0 = match$7[1]; e = p$0; } } else try{var ak = Sx_primitives[15].call(null, name$0), v$9 = ak;} catch(exn){ var aj = Stdlib[28].call(null, cst_VM_undefined, name$0); throw caml_maybe_attach_backtrace([0, Sx_types[7], aj], 1); } } push(vm, v$9); break a; case 20: var idx$5 = read_u16(frame), match$9 = caml_check_bound(consts, idx$5)[idx$5 + 1]; if(typeof match$9 === "number" || ! (2 === match$9[0])) var name$1 = cst$1; else var s$4 = match$9[1], name$1 = s$4; var match$10 = frame[1][5]; if(match$10){ var env$0 = match$10[1], id$0 = Sx_types[4].call(null, name$1), e$0 = env$0; for(;;){ if(Stdlib_Hashtbl[9].call(null, e$0[1], id$0)){ var am = peek(vm); Stdlib_Hashtbl[11].call(null, e$0[1], id$0, am); var written = 1; break; } var match$11 = e$0[2]; if(! match$11){var written = 0; break;} var p$1 = match$11[1]; e$0 = p$1; } } else var written = 0; if(! (1 - written)) break a; var v$10 = peek(vm); Stdlib_Hashtbl[11].call(null, vm[4], name$1, v$10); var match$12 = Sx_types[14][1]; if(! match$12) break a; var f$2 = match$12[1]; caml_call2(f$2, name$1, v$10); break a; case 31: var offset = read_i16(frame); frame[2] = frame[2] + offset | 0; break a; case 32: var offset$0 = read_i16(frame), v$11 = pop(vm); if(! (1 - Sx_types[45].call(null, v$11))) break a; frame[2] = frame[2] + offset$0 | 0; break a; case 33: var offset$1 = read_i16(frame), v$12 = pop(vm); if(! Sx_types[45].call(null, v$12)) break a; frame[2] = frame[2] + offset$1 | 0; break a; case 47: var argc = read_u8(frame), args = Stdlib_Array[1].call (null, argc, function(param){return pop(vm);}), f$3 = pop(vm), an = Stdlib_Array[10].call(null, args), args_list = Stdlib_List[10].call(null, an); vm_call(vm, f$3, args_list); break a; case 48: var argc$0 = read_u8(frame), args$0 = Stdlib_Array[1].call (null, argc$0, function(param){return pop(vm);}), f$4 = pop(vm), ao = Stdlib_Array[10].call(null, args$0), args_list$0 = Stdlib_List[10].call(null, ao); vm[3] = rest_frames; vm[2] = frame[3]; vm_call(vm, f$4, args_list$0); break a; case 49: var result$0 = pop(vm); vm[3] = rest_frames; vm[2] = frame[3]; push(vm, result$0); break a; case 50: var idx$6 = read_u16(frame); if(consts.length - 1 <= idx$6){ var ap = caml_call2 (Stdlib_Printf[4].call(null, q), idx$6, consts.length - 1); throw caml_maybe_attach_backtrace([0, Sx_types[7], ap], 1); } var code_val = caml_check_bound(consts, idx$6)[idx$6 + 1], code = code_from_value(code_val); b: { if(typeof code_val !== "number" && 6 === code_val[0]){ var d$0 = code_val[1], match$13 = Stdlib_Hashtbl[7].call(null, d$0, cst_upvalue_count); if(match$13){ var match$14 = match$13[1]; if(typeof match$14 !== "number" && 1 === match$14[0]){var n$3 = match$14[1], uv_count = n$3 | 0; break b;} } var uv_count = 0; break b; } var uv_count = 0; } let frame$0 = frame; var upvalues = Stdlib_Array[1].call (null, uv_count, function(param){ var is_local = read_u8(frame$0), index = read_u8(frame$0); if(1 !== is_local) return caml_check_bound(frame$0[1][2], index)[index + 1]; var match = Stdlib_Hashtbl[7].call(null, frame$0[4], index); if(match) var existing = match[1], cell = existing; else{ var a = frame$0[3] + index | 0, c = [0, caml_check_bound(vm[1], a)[a + 1]]; Stdlib_Hashtbl[11].call(null, frame$0[4], index, c); var cell = c; } return cell; }), cl = [0, code, upvalues, 0, vm[4], frame[1][5]]; push(vm, [23, cl]); break a; case 51: var idx$7 = read_u16(frame), argc$1 = read_u8(frame), match$15 = caml_check_bound(consts, idx$7)[idx$7 + 1]; if(typeof match$15 === "number" || ! (2 === match$15[0])) var name$2 = cst$1; else var s$5 = match$15[1], name$2 = s$5; var aq = Stdlib_List[11].call (null, argc$1, function(param){return pop(vm);}), args$1 = Stdlib_List[10].call(null, aq), args$2 = Stdlib_List[20].call (null, function(v){ if(typeof v !== "number" && 11 === v[0]) return caml_call1(Sx_primitives[3][1], v); return v; }, args$1); try{ try{var fn_val = Stdlib_Hashtbl[6].call(null, vm[4], name$2);} catch(exn){ var exn$3 = caml_wrap_exception(exn); if(exn$3 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$3, 0); var as = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); throw caml_maybe_attach_backtrace([0, Sx_types[7], as], 1); } b: { if(typeof fn_val !== "number") switch(fn_val[0]){ case 14: var fn = fn_val[2], result$1 = caml_call1(fn, args$2); break b; case 7: case 8: case 9: case 23: var result$1 = Sx_ref[159].call(null, fn_val, [5, args$2]); break b; } var result$1 = 0; } } catch(exn){ var exn$2 = caml_wrap_exception(exn); if(exn$2[1] !== Sx_types[7]) throw caml_maybe_attach_backtrace(exn$2, 0); var msg$0 = exn$2[2], ar = caml_call3 (Stdlib_Printf[4].call(null, r), msg$0, name$2, argc$1); throw caml_maybe_attach_backtrace([0, Sx_types[7], ar], 1); } push(vm, result$1); break a; case 63: var count$0 = read_u16(frame), at = Stdlib_List[11].call (null, count$0, function(param){return pop(vm);}), items = Stdlib_List[10].call(null, at); push(vm, [5, items]); break a; case 64: var count$1 = read_u16(frame), d$1 = Stdlib_Hashtbl[1].call(null, 0, count$1); if(count$1 >= 1){ var for$ = 1; for(;;){ var v$13 = pop(vm), k$0 = pop(vm); b: { if(typeof k$0 !== "number") switch(k$0[0]){ case 2: case 4: var s$6 = k$0[1], key = s$6; break b; } var key = Sx_runtime[2].call(null, k$0); } Stdlib_Hashtbl[11].call(null, d$1, key, v$13); var au = for$ + 1 | 0; if(count$1 === for$) break; for$ = au; } } push(vm, [6, d$1]); break a; } var U = frame[2] - 1 | 0, V = caml_call2(Stdlib_Printf[4].call(null, j), op, U); throw caml_maybe_attach_backtrace([0, Sx_types[7], V], 1); } } catch(exn$0){var exn = caml_wrap_exception(exn$0); break;} } } } if(exn[1] !== Stdlib[6]) throw caml_maybe_attach_backtrace(exn, 0); var msg = exn[2], match$1 = frame[1][3]; if(match$1) var n$1 = match$1[1], fn_name$0 = n$1; else var fn_name$0 = cst; var R = vm[2], S = frame[3], T = caml_call8 (Stdlib_Printf[4].call(null, i), msg, saved_ip, op, fn_name$0, S, R, bc.length - 1, consts.length - 1); throw caml_maybe_attach_backtrace([0, Sx_types[7], T], 1); } var s = [2, cst_phase], t = [2, cst_request]; function resume_vm(vm, result){ var match = vm[5]; if(match){ var cek_state = match[1]; vm[5] = 0; var final = Sx_ref[120].call(null, cek_state, result), match$0 = Sx_runtime[10].call(null, final, s); if (typeof match$0 !== "number" && 2 === match$0[0] && match$0[1] === cst_io_suspended){ vm[5] = [0, final]; throw caml_maybe_attach_backtrace ([0, VmSuspended, Sx_runtime[10].call(null, final, t), vm], 1); } push(vm, Sx_ref[16].call(null, final)); } else push(vm, result); run(vm); return pop(vm); } var u = [0, "module"]; function execute_module(code, globals){ var cl = [0, code, [0], u, globals, 0], vm = create(globals), frame = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], a = code[2] - 1 | 0; if(a >= 0){ var for$ = 0; for(;;){ push(vm, 0); var b = for$ + 1 | 0; if(a === for$) break; for$ = b; } } vm[3] = [0, frame, 0]; run(vm); return pop(vm); } var cst$2 = ": ", cst_jit_FAIL = "[jit] FAIL ", cst_compile = "compile", cst_quote = "quote", v = [0, [11, cst_jit_FAIL, [2, 0, [11, cst$2, [2, 0, [12, 10, [10, 0]]]]]], "[jit] FAIL %s: %s\n%!"], w = [3, "fn"], x = [3, cst_quote], y = [3, cst_compile], z = [0, [11, cst_jit_FAIL, [2, 0, [11, ": compiler returned ", [2, 0, [12, 10, [10, 0]]]]]], "[jit] FAIL %s: compiler returned %s\n%!"], A = [0, [11, cst_jit_FAIL, [2, 0, [11, ": closure index ", [4, 0, 0, 0, [11, " out of bounds (pool=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]], "[jit] FAIL %s: closure index %d out of bounds (pool=%d)\n%!"], B = [0, [11, "[jit] SKIP ", [2, 0, [11, ": non-closure execution failed (bc[0]=", [4, 0, 0, 0, [11, ", len=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]], "[jit] SKIP %s: non-closure execution failed (bc[0]=%d, len=%d)\n%!"], C = [0, [11, "[jit] RESOLVED ", [2, 0, [11, cst$2, [2, 0, [11, " (bc[0]=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]], "[jit] RESOLVED %s: %s (bc[0]=%d)\n%!"]; function jit_compile_lambda(l, effective_globals){ var match = l[4]; if(match) var n = match[1], fn_name = n; else var fn_name = ""; try{ try{Stdlib_Hashtbl[6].call(null, effective_globals, cst_compile);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) throw caml_maybe_attach_backtrace ([0, Sx_types[7], "JIT: compiler not loaded"], 1); throw caml_maybe_attach_backtrace(exn, 0); } var param_syms = [5, Stdlib_List[20].call(null, function(s){return [3, s];}, l[1])], fn_expr = [5, [0, w, [0, param_syms, [0, l[2], 0]]]], c = Sx_types[11].call(null, 0), compile_env = Sx_types[12].call(null, c); Stdlib_Hashtbl[12].call (null, function(k, v){ var a = Sx_types[4].call(null, k); return Stdlib_Hashtbl[11].call(null, compile_env[1], a, v); }, effective_globals); var result = Sx_ref[178].call (null, [5, [0, y, [0, [5, [0, x, [0, fn_expr, 0]]], 0]]], [19, compile_env]); a: { if(typeof result !== "number" && 6 === result[0]){ var d = result[1]; if(Stdlib_Hashtbl[9].call(null, d, cst_bytecode)){ var outer_code = code_from_value(result), bc = outer_code[3]; if(4 <= bc.length - 1 && 51 === caml_check_bound(bc, 0)[1]){ var g = caml_check_bound(bc, 2)[3] << 8, idx = caml_check_bound(bc, 1)[2] | g; if(idx < outer_code[4].length - 1){ var inner_val = caml_check_bound(outer_code[4], idx)[idx + 1], code = code_from_value(inner_val), a = [0, [0, code, [0], l[4], effective_globals, [0, l[3]]]]; break a; } var h = outer_code[4].length - 1; caml_call3(Stdlib_Printf[3].call(null, A), fn_name, idx, h); var a = 0; break a; } try{ var value = execute_module(outer_code, effective_globals), k = 0 < bc.length - 1 ? caml_check_bound(bc, 0)[1] : -1, m = Sx_types[35].call(null, value); caml_call3(Stdlib_Printf[3].call(null, C), fn_name, m, k); var a = 0; break a; } catch(exn){ var i = bc.length - 1, j = 0 < bc.length - 1 ? caml_check_bound(bc, 0)[1] : -1; caml_call3(Stdlib_Printf[3].call(null, B), fn_name, j, i); var a = 0; break a; } } } var f = Sx_types[35].call(null, result); caml_call2(Stdlib_Printf[3].call(null, z), fn_name, f); var a = 0; } return a; } catch(e$0){ var e = caml_wrap_exception(e$0), b = Stdlib_Printexc[1].call(null, e); caml_call2(Stdlib_Printf[3].call(null, v), fn_name, b); return 0; } } jit_compile_ref[1] = jit_compile_lambda; Sx_types[6][1] = function(cl, args){return call_closure(cl, args, cl[4]);}; var D = [0, [11, "UNKNOWN_", [4, 0, 0, 0, 0]], "UNKNOWN_%d"]; function opcode_name(n){ if(66 <= n){ var switcher = n - 128 | 0; if(47 >= switcher >>> 0) switch(switcher){ case 0: return "DEFINE"; case 16: return "STR_CONCAT"; case 32: return "ADD"; case 33: return "SUB"; case 34: return "MUL"; case 35: return "DIV"; case 36: return "EQ"; case 37: return "LT"; case 38: return "GT"; case 39: return "NOT"; case 40: return "LEN"; case 41: return "FIRST"; case 42: return "REST"; case 43: return "NTH"; case 44: return "CONS"; case 45: return "NEG"; case 46: return "INC"; case 47: return "DEC"; } } else if(0 < n) switch(n - 1 | 0){ case 0: return "CONST"; case 1: return "NIL"; case 2: return "TRUE"; case 3: return "FALSE"; case 4: return "POP"; case 5: return "DUP"; case 15: return "LOCAL_GET"; case 16: return "LOCAL_SET"; case 17: return "UPVALUE_GET"; case 18: return "UPVALUE_SET"; case 19: return "GLOBAL_GET"; case 20: return "GLOBAL_SET"; case 31: return "JUMP"; case 32: return "JUMP_IF_FALSE"; case 33: return "JUMP_IF_TRUE"; case 47: return "CALL"; case 48: return "TAIL_CALL"; case 49: return "RETURN"; case 50: return "CLOSURE"; case 51: return "CALL_PRIM"; case 63: return "LIST"; case 64: return "DICT"; } return caml_call1(Stdlib_Printf[4].call(null, D), n); } function opcode_operand_size(param){ a: { b: { if(35 <= param){ if(128 !== param){ if(66 <= param){if(144 === param) break b; break a;} if(48 > param) break a; switch(param - 48 | 0){ case 3: return 2; case 4: return 3; case 16: case 17: break; case 0: case 1: break b; default: break a; } } } else if(16 <= param){ if(22 <= param){if(32 <= param) return 2; break a;} if(20 > param) break b; } else if(1 !== param) break a; return 2; } return 1; } return 0; } var cst_opcode = "opcode", H = [0, 0], I = [0, 0], c = [1, 0.], a = [5, 0], E = [3, "do"], F = [3, cst_quote], G = [0, "trace"], J = [0, 1], K = [0, 0]; function trace_run(src, globals){ try{var compile_fn = Stdlib_Hashtbl[6].call(null, globals, cst_compile);} catch(exn$0){ var exn = caml_wrap_exception(exn$0); if(exn === Stdlib[8]) throw caml_maybe_attach_backtrace ([0, Sx_types[7], "trace: compiler not loaded"], 1); throw caml_maybe_attach_backtrace(exn, 0); } var exprs = Sx_parser[15].call(null, src); a: { if(exprs && ! exprs[2]){var e = exprs[1], expr = e; break a;} var expr = [5, [0, E, exprs]]; } var quoted = [5, [0, F, [0, expr, 0]]], Q = [19, Sx_types[11].call(null, 0)], code_val = Sx_ref[178].call(null, [5, [0, compile_fn, [0, quoted, 0]]], Q), code = code_from_value(code_val), cl = [0, code, [0], G, globals, 0], vm = create(globals), frame0 = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], m = code[2] - 1 | 0; if(m >= 0){ var for$0 = 0; for(;;){ push(vm, 0); var aj = for$0 + 1 | 0; if(m === for$0) break; for$0 = aj; } } vm[3] = [0, frame0, 0]; var trace = [0, 0]; try{ var steps = [0, 0]; for(;;){ if(0 !== vm[3] && steps[1] < 10000){ var match = vm[3]; if(! match) continue; var frame = match[1], bc = frame[1][1][3]; if(bc.length - 1 <= frame[2]){vm[3] = 0; continue;} var o = frame[2], op = caml_check_bound(bc, o)[o + 1], R = Stdlib[16].call(null, 5, vm[2]), stack_snap = Stdlib_List[11].call (null, R, function(i){ var a = (vm[2] - 1 | 0) - i | 0, v = caml_check_bound(vm[1], a)[a + 1]; return [2, Sx_types[86].call(null, v)]; }), entry = Stdlib_Hashtbl[1].call(null, 0, 4), S = [2, opcode_name(op)]; Stdlib_Hashtbl[11].call(null, entry, cst_opcode, S); Stdlib_Hashtbl[11].call(null, entry, "stack", [5, stack_snap]); var T = [1, Stdlib_List[1].call(null, vm[3])]; Stdlib_Hashtbl[11].call(null, entry, "depth", T); trace[1] = [0, [6, entry], trace[1]]; steps[1]++; frame[2] = frame[2] + 1 | 0; var rest_frames = Stdlib_List[7].call(null, vm[3]); try{ if(66 <= op){ var switcher = op - 128 | 0; if(47 >= switcher >>> 0) switch(switcher){ case 0: var idx = read_u16(frame), match$0 = caml_check_bound(frame[1][1][4], idx)[idx + 1]; if(typeof match$0 === "number" || ! (2 === match$0[0])) var name = cst$1; else var s = match$0[1], name = s; var U = peek(vm); Stdlib_Hashtbl[11].call(null, vm[4], name, U); break; case 16: var count = read_u8(frame), V = Stdlib_List[11].call (null, count, function(param){return pop(vm);}), parts = Stdlib_List[10].call(null, V), W = Stdlib_List[20].call(null, Sx_runtime[2], parts); push(vm, [2, Stdlib_String[7].call(null, cst$1, W)]); break; case 32: var b = pop(vm), a$0 = pop(vm); a: { if (typeof a$0 !== "number" && 1 === a$0[0] && typeof b !== "number" && 1 === b[0]){var y = b[1], x = a$0[1], p = [1, x + y]; break a;} var p = 0; } push(vm, p); break; case 33: var b$0 = pop(vm), a$1 = pop(vm); a: { if (typeof a$1 !== "number" && 1 === a$1[0] && typeof b$0 !== "number" && 1 === b$0[0]){ var y$0 = b$0[1], x$0 = a$1[1], q = [1, x$0 - y$0]; break a; } var q = 0; } push(vm, q); break; case 34: var b$1 = pop(vm), a$2 = pop(vm); a: { if (typeof a$2 !== "number" && 1 === a$2[0] && typeof b$1 !== "number" && 1 === b$1[0]){ var y$1 = b$1[1], x$1 = a$2[1], r = [1, x$1 * y$1]; break a; } var r = 0; } push(vm, r); break; case 35: var b$2 = pop(vm), a$3 = pop(vm); a: { if (typeof a$3 !== "number" && 1 === a$3[0] && typeof b$2 !== "number" && 1 === b$2[0]){ var y$2 = b$2[1], x$2 = a$3[1], t = [1, x$2 / y$2]; break a; } var t = 0; } push(vm, t); break; case 36: var b$3 = pop(vm), a$4 = pop(vm); push(vm, [0, caml_equal(a$4, b$3)]); break; case 37: var b$4 = pop(vm), a$5 = pop(vm); if (typeof a$5 === "number" || ! (1 === a$5[0] && ! (typeof b$4 === "number" || ! (1 === b$4[0])))) var u = H; else var y$3 = b$4[1], x$3 = a$5[1], u = [0, x$3 < y$3 ? 1 : 0]; push(vm, u); break; case 38: var b$5 = pop(vm), a$6 = pop(vm); if (typeof a$6 === "number" || ! (1 === a$6[0] && ! (typeof b$5 === "number" || ! (1 === b$5[0])))) var w = I; else var y$4 = b$5[1], x$4 = a$6[1], w = [0, y$4 < x$4 ? 1 : 0]; push(vm, w); break; case 39: var v = pop(vm); push(vm, [0, 1 - Sx_types[45].call(null, v)]); break; case 40: var v$0 = pop(vm); a: if(typeof v$0 === "number") var h = c; else{ switch(v$0[0]){ case 2: var s$0 = v$0[1], h = [1, caml_ml_string_length(s$0)]; break a; case 5: var l = v$0[1]; break; case 20: var l = v$0[1][1]; break; default: var h = c; break a; } var h = [1, Stdlib_List[1].call(null, l)]; } push(vm, h); break; case 41: var v$1 = pop(vm); a: { if(typeof v$1 !== "number") switch(v$1[0]){ case 5: var z = v$1[1]; if(z){var i = z[1]; break a;} break; case 20: var A = v$1[1][1]; if(A){var i = A[1]; break a;} break; } var i = 0; } push(vm, i); break; case 42: var v$2 = pop(vm); a: if(typeof v$2 === "number") var g = a; else{ switch(v$2[0]){ case 5: var B = v$2[1]; if(! B){var g = a; break a;} var xs = B[2]; break; case 20: var C = v$2[1][1]; if(! C){var g = a; break a;} var xs = C[2]; break; default: var g = a; break a; } var g = [5, xs]; } push(vm, g); break; case 43: var n = pop(vm), coll = pop(vm); a: { b: if(typeof coll !== "number"){ switch(coll[0]){ case 5: var l$0 = coll[1]; break; case 20: var l$0 = coll[1][1]; break; default: break b; } if(typeof n !== "number" && 1 === n[0]){ var f = n[1]; try{ var X = Stdlib_List[8].call(null, l$0, f | 0), j = X; break a; } catch(exn){var j = 0; break a;} } } var j = 0; } push(vm, j); break; case 44: var coll$0 = pop(vm), x$5 = pop(vm); a: { if(typeof coll$0 !== "number" && 5 === coll$0[0]){ var l$1 = coll$0[1], D = [5, [0, x$5, l$1]]; break a; } var D = [5, [0, x$5, 0]]; } push(vm, D); break; case 45: var v$3 = pop(vm); a: { if(typeof v$3 !== "number" && 1 === v$3[0]){var x$6 = v$3[1], L = [1, - x$6]; break a; } var L = 0; } push(vm, L); break; case 46: var v$4 = pop(vm); a: { if(typeof v$4 !== "number" && 1 === v$4[0]){ var x$7 = v$4[1], M = [1, x$7 + 1.]; break a; } var M = 0; } push(vm, M); break; case 47: var v$5 = pop(vm); a: { if(typeof v$5 !== "number" && 1 === v$5[0]){ var x$8 = v$5[1], N = [1, x$8 - 1.]; break a; } var N = 0; } push(vm, N); break; } } else if(0 < op) switch(op - 1 | 0){ case 0: var idx$0 = read_u16(frame); push(vm, caml_check_bound(frame[1][1][4], idx$0)[idx$0 + 1]); break; case 1: push(vm, 0); break; case 2: push(vm, J); break; case 3: push(vm, K); break; case 4: pop(vm); break; case 5: push(vm, peek(vm)); break; case 15: var slot = read_u8(frame), match$1 = Stdlib_Hashtbl[7].call(null, frame[4], slot); if(match$1) var cell = match$1[1], v$6 = cell[1]; else var O = frame[3] + slot | 0, v$6 = caml_check_bound(vm[1], O)[O + 1]; push(vm, v$6); break; case 16: var slot$0 = read_u8(frame), v$7 = peek(vm), match$2 = Stdlib_Hashtbl[7].call(null, frame[4], slot$0); if(match$2){ var cell$0 = match$2[1]; cell$0[1] = v$7; } else{ var P = frame[3] + slot$0 | 0; caml_check_bound(vm[1], P)[P + 1] = v$7; } break; case 17: var idx$1 = read_u8(frame); push(vm, caml_check_bound(frame[1][2], idx$1)[idx$1 + 1][1]); break; case 18: var idx$2 = read_u8(frame), Y = peek(vm); caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1] = Y; break; case 19: var idx$3 = read_u16(frame), match$3 = caml_check_bound(frame[1][1][4], idx$3)[idx$3 + 1]; if(typeof match$3 === "number" || ! (2 === match$3[0])) var name$0 = cst$1; else var s$1 = match$3[1], name$0 = s$1; try{var $ = Stdlib_Hashtbl[6].call(null, vm[4], name$0), v$8 = $;} catch(exn){ var exn$0 = caml_wrap_exception(exn); if(exn$0 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$0, 0); try{var _ = Sx_primitives[15].call(null, name$0), v$8 = _;} catch(exn){ var Z = Stdlib[28].call(null, cst_VM_undefined, name$0); throw caml_maybe_attach_backtrace([0, Sx_types[7], Z], 1); } } push(vm, v$8); break; case 20: var idx$4 = read_u16(frame), match$4 = caml_check_bound(frame[1][1][4], idx$4)[idx$4 + 1]; if(typeof match$4 === "number" || ! (2 === match$4[0])) var name$1 = cst$1; else var s$2 = match$4[1], name$1 = s$2; var aa = peek(vm); Stdlib_Hashtbl[11].call(null, vm[4], name$1, aa); break; case 31: var offset = read_i16(frame); frame[2] = frame[2] + offset | 0; break; case 32: var offset$0 = read_i16(frame), v$9 = pop(vm); if(1 - Sx_types[45].call(null, v$9)) frame[2] = frame[2] + offset$0 | 0; break; case 33: var offset$1 = read_i16(frame), v$10 = pop(vm); if(Sx_types[45].call(null, v$10)) frame[2] = frame[2] + offset$1 | 0; break; case 47: var argc = read_u8(frame), args = Stdlib_Array[1].call (null, argc, function(param){return pop(vm);}), f$0 = pop(vm), ab = Stdlib_Array[10].call(null, args); vm_call(vm, f$0, Stdlib_List[10].call(null, ab)); break; case 48: var argc$0 = read_u8(frame), args$0 = Stdlib_Array[1].call (null, argc$0, function(param){return pop(vm);}), f$1 = pop(vm); vm[3] = rest_frames; vm[2] = frame[3]; var ac = Stdlib_Array[10].call(null, args$0); vm_call(vm, f$1, Stdlib_List[10].call(null, ac)); break; case 49: var result = pop(vm); vm[3] = rest_frames; vm[2] = frame[3]; push(vm, result); break; case 50: var idx$5 = read_u16(frame), code_val2 = caml_check_bound(frame[1][1][4], idx$5)[idx$5 + 1]; a: { if(typeof code_val2 !== "number" && 6 === code_val2[0]){ var d = code_val2[1], match$5 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); if(match$5){ var match$6 = match$5[1]; if(typeof match$6 !== "number" && 1 === match$6[0]){var n$0 = match$6[1], uv_count = n$0 | 0; break a; } } var uv_count = 0; break a; } var uv_count = 0; } let frame$0 = frame; var upvalues = Stdlib_Array[1].call (null, uv_count, function(param){ var is_local = read_u8(frame$0), index = read_u8(frame$0); if(1 !== is_local) return caml_check_bound(frame$0[1][2], index)[index + 1]; var match = Stdlib_Hashtbl[7].call(null, frame$0[4], index); if(match) var existing = match[1], cell = existing; else{ var a = frame$0[3] + index | 0, c = [0, caml_check_bound(vm[1], a)[a + 1]]; Stdlib_Hashtbl[11].call(null, frame$0[4], index, c); var cell = c; } return cell; }), inner_code = code_from_value(code_val2), c$0 = [0, inner_code, upvalues, 0, vm[4], frame[1][5]]; push(vm, [23, c$0]); break; case 51: var idx$6 = read_u16(frame), argc$1 = read_u8(frame), match$7 = caml_check_bound(frame[1][1][4], idx$6)[idx$6 + 1]; if(typeof match$7 === "number" || ! (2 === match$7[0])) var name$2 = cst$1; else var s$3 = match$7[1], name$2 = s$3; var ad = Stdlib_List[11].call (null, argc$1, function(param){return pop(vm);}), args$1 = Stdlib_List[10].call(null, ad); try{var ag = Sx_primitives[15].call(null, name$2), fn_val = ag;} catch(exn){ try{ var af = Stdlib_Hashtbl[6].call(null, vm[4], name$2), fn_val = af; } catch(exn){ var exn$1 = caml_wrap_exception(exn); if(exn$1 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$1, 0); var ae = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); throw caml_maybe_attach_backtrace([0, Sx_types[7], ae], 1); } } if(typeof fn_val !== "number" && 14 === fn_val[0]){ var fn = fn_val[2]; push(vm, caml_call1(fn, args$1)); break; } push(vm, 0); break; case 63: var count$0 = read_u16(frame), ah = Stdlib_List[11].call (null, count$0, function(param){return pop(vm);}), items = Stdlib_List[10].call(null, ah); push(vm, [5, items]); break; case 64: var count$1 = read_u16(frame), d$0 = Stdlib_Hashtbl[1].call(null, 0, count$1); if(count$1 >= 1){ var for$ = 1; for(;;){ var v$11 = pop(vm), k = pop(vm); a: { if(typeof k !== "number") switch(k[0]){ case 2: case 4: var s$4 = k[1], key = s$4; break a; } var key = Sx_runtime[2].call(null, k); } Stdlib_Hashtbl[11].call(null, d$0, key, v$11); var ai = for$ + 1 | 0; if(count$1 === for$) break; for$ = ai; } } push(vm, [6, d$0]); break; } continue; } catch(e){vm[3] = 0; continue;} } break; } } catch(exn){} return [5, Stdlib_List[10].call(null, trace[1])]; } function disassemble(code){ var bc = code[3], len = bc.length - 1, consts = code[4], ip$3 = 0, instrs = 0; for(;;){ if(ip$3 >= len) break; var op = caml_check_bound(bc, ip$3)[ip$3 + 1], ip = ip$3 + 1 | 0, name = opcode_name(op); a: { var operands = 0; b: { if(35 <= op){ if(128 !== op){ if(66 <= op){ if(144 === op) break b; var operands$1 = operands, ip$4 = ip; break a; } if(48 > op){var operands$1 = operands, ip$4 = ip; break a;} switch(op - 48 | 0){ case 4: if((ip + 2 | 0) >= len){ var operands$1 = operands, ip$4 = ip; break a; } var lo$1 = caml_check_bound(bc, ip)[ip + 1], e = ip + 1 | 0, hi$1 = caml_check_bound(bc, e)[e + 1], idx$1 = lo$1 | hi$1 << 8, f = ip + 2 | 0, argc = caml_check_bound(bc, f)[f + 1], ip$2 = ip + 3 | 0; if(idx$1 < consts.length - 1){ var match$2 = caml_check_bound(consts, idx$1)[idx$1 + 1]; if(typeof match$2 === "number" || ! (2 === match$2[0])) var prim_name = cst; else var s = match$2[1], prim_name = s; } else var prim_name = cst; var operands$1 = [0, [1, idx$1], [0, [2, prim_name], [0, [1, argc], 0]]], ip$4 = ip$2; break a; case 0: case 1: break b; case 3: case 16: case 17: if((ip + 1 | 0) >= len){ var operands$1 = operands, ip$4 = ip; break a; } var lo$0 = caml_check_bound(bc, ip)[ip + 1], b = ip + 1 | 0, hi$0 = caml_check_bound(bc, b)[b + 1], idx$0 = lo$0 | hi$0 << 8, ip$1 = ip + 2 | 0, c = 51 === op, i = c ? idx$0 < consts.length - 1 : c, operands$0 = [0, [1, idx$0], 0]; if(! i){var operands$1 = operands$0, ip$4 = ip$1; break a;} var match = caml_check_bound(consts, idx$0)[idx$0 + 1]; c: { if(typeof match !== "number" && 6 === match[0]){ var d = match[1], match$0 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); if(match$0){ var match$1 = match$0[1]; if(typeof match$1 !== "number" && 1 === match$1[0]){var n = match$1[1], uv_count = n | 0; break c;} } var uv_count = 0; break c; } var uv_count = 0; } var operands$1 = operands$0, ip$4 = ip$1 + (uv_count * 2 | 0) | 0; break a; default: var operands$1 = operands, ip$4 = ip; break a; } } } else if(16 <= op){ if(22 <= op){ if(32 > op){var operands$1 = operands, ip$4 = ip; break a;} if((ip + 1 | 0) < len){ var lo$2 = caml_check_bound(bc, ip)[ip + 1], g = ip + 1 | 0, hi$2 = caml_check_bound(bc, g)[g + 1], raw = lo$2 | hi$2 << 8, signed = 32768 <= raw ? raw - 65536 | 0 : raw, operands$1 = [0, [1, signed], 0], ip$4 = ip + 2 | 0; break a; } var operands$1 = operands, ip$4 = ip; break a; } if(20 > op) break b; } else if(1 !== op){var operands$1 = operands, ip$4 = ip; break a;} if((ip + 1 | 0) >= len){var operands$1 = operands, ip$4 = ip; break a;} var lo = caml_check_bound(bc, ip)[ip + 1], a = ip + 1 | 0, hi = caml_check_bound(bc, a)[a + 1], idx = lo | hi << 8, ip$0 = ip + 2 | 0; if(idx < consts.length - 1) var h = caml_check_bound(consts, idx)[idx + 1], const_str = Sx_types[86].call(null, h); else var const_str = cst; var operands$1 = [0, [1, idx], [0, [2, const_str], 0]], ip$4 = ip$0; break a; } if(ip < len) var v = caml_check_bound(bc, ip)[ip + 1], operands$1 = [0, [1, v], 0], ip$4 = ip + 1 | 0; else var operands$1 = operands, ip$4 = ip; } var entry = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, entry, "offset", [1, ip$3]); Stdlib_Hashtbl[11].call(null, entry, cst_opcode, [2, name]); Stdlib_Hashtbl[11].call(null, entry, "operands", [5, operands$1]); ip$3 = ip$4; instrs = [0, [6, entry], instrs]; } var result = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, result, cst_arity, [1, code[1]]); Stdlib_Hashtbl[11].call(null, result, "num_locals", [1, code[2]]); var j = Stdlib_Array[14].call (null, function(v){return [2, Sx_types[86].call(null, v)];}, consts), k = [5, Stdlib_Array[10].call(null, j)]; Stdlib_Hashtbl[11].call(null, result, cst_constants, k); var l = [5, Stdlib_List[10].call(null, instrs)]; Stdlib_Hashtbl[11].call(null, result, cst_bytecode, l); return [6, result]; } runtime.caml_register_global (159, [0, VmSuspended, jit_compile_ref, jit_failed_sentinel, is_jit_failed, active_vm, create, push, pop, peek, read_u8, read_u16, read_i16, closure_to_value, vm_insn_count, vm_call_count, vm_cek_count, vm_reset_counters, vm_report_counters, push_closure_frame, code_from_value, cek_call_or_suspend, call_closure, call_closure_reuse, vm_call, run, resume_vm, execute_module, jit_compile_lambda, opcode_name, opcode_operand_size, trace_run, disassemble], "Sx_vm"); return; } (globalThis)); //# 15452 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_render:[F(2),F(1),F(1)*,F(1)*,F(2),F(1),F(2),F(2),F(1),F(1),F(1),F(1),F(1),N,N,N,F(2),F(2),F(3),F(2),F(1),F(3),F(2),F(1)*,N,F(1),N,N,N,N,N,N,N,N,F(1),F(1),F(1),F(1),F(1),N,F(1),N,N,F(1),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(3),F(1),F(1),F(1),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_equal = runtime.caml_equal, caml_list_of_js_array = runtime.caml_list_of_js_array, caml_ml_string_length = runtime.caml_ml_string_length, caml_trampoline = runtime.caml_trampoline, caml_trampoline_return = runtime.caml_trampoline_return, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call2(f, a0, a1){ return (f.l >= 0 ? f.l : f.l = f.length) === 2 ? f(a0, a1) : runtime.caml_call_gen(f, [a0, a1]); } function caml_call3(f, a0, a1, a2){ return (f.l >= 0 ? f.l : f.l = f.length) === 3 ? f(a0, a1, a2) : runtime.caml_call_gen(f, [a0, a1, a2]); } var global_data = runtime.caml_get_global_data(), boolean_attrs_set = caml_list_of_js_array (["async", "autofocus", "autoplay", "checked", "controls", "default", "defer", "disabled", "formnovalidate", "hidden", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "selected"]), cst_br = "br", cst_col = "col", cst_filter = "filter", cst_hr = "hr", cst_i = "i", cst_img = "img", cst_input = "input", cst_link = "link", cst_meta = "meta", cst_source = "source", cst_style = "style", cst_wbr = "wbr", html_tags_list = caml_list_of_js_array (["html", "head", "body", "title", cst_meta, cst_link, "script", cst_style, "noscript", "header", "nav", "main", "section", "article", "aside", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "hgroup", "div", "p", "blockquote", "pre", "figure", "figcaption", "address", cst_hr, "ul", "ol", "li", "dl", "dt", "dd", "menu", "details", "summary", "dialog", "a", "span", "em", "strong", "small", "b", cst_i, "u", "s", "sub", "sup", "mark", "abbr", "cite", "code", "kbd", "samp", "var", "time", cst_br, cst_wbr, "table", "thead", "tbody", "tfoot", "tr", "th", "td", "caption", "colgroup", cst_col, "form", cst_input, "textarea", "select", "option", "optgroup", "button", "label", "fieldset", "legend", "datalist", "output", cst_img, "video", "audio", cst_source, "picture", "canvas", "iframe", "svg", "path", "circle", "rect", "line", "polyline", "polygon", "ellipse", "g", "defs", "use", "text", "tspan", "clipPath", "mask", "pattern", "linearGradient", "radialGradient", "stop", cst_filter, "feGaussianBlur", "feOffset", "feBlend", "feColorMatrix", "feComposite", "feMerge", "feMergeNode", "feTurbulence", "feComponentTransfer", "feFuncR", "feFuncG", "feFuncB", "feFuncA", "feDisplacementMap", "feFlood", "feImage", "feMorphology", "feSpecularLighting", "feDiffuseLighting", "fePointLight", "feSpotLight", "feDistantLight", "animate", "animateTransform", "foreignObject", "template", "slot"]), void_elements_list = caml_list_of_js_array (["area", "base", cst_br, cst_col, "embed", cst_hr, cst_img, cst_input, cst_link, cst_meta, "param", cst_source, "track", cst_wbr]), cst_begin = "begin", cst_case = "case", cst_cond = "cond", cst_defcomp = "defcomp", cst_defeffect = "defeffect", cst_define = "define", cst_defisland = "defisland", cst_defmacro = "defmacro", cst_defstyle = "defstyle", cst_deftype = "deftype", cst_do = "do", cst_for_each = "for-each", cst_if = "if", cst_let = "let", cst_let$0 = "let*", cst_letrec = "letrec", cst_map = "map", cst_map_indexed = "map-indexed", cst_provide = "provide", cst_scope = "scope", cst_when = "when", render_html_forms = [5, caml_list_of_js_array ([[2, cst_if], [2, cst_when], [2, cst_cond], [2, cst_case], [2, cst_let], [2, cst_let$0], [2, cst_letrec], [2, cst_begin], [2, cst_do], [2, cst_define], [2, cst_defcomp], [2, cst_defmacro], [2, cst_defisland], [2, "defpage"], [2, "defhandler"], [2, "defquery"], [2, "defaction"], [2, "defrelation"], [2, cst_deftype], [2, cst_defeffect], [2, cst_defstyle], [2, cst_map], [2, cst_map_indexed], [2, cst_filter], [2, cst_for_each], [2, cst_scope], [2, cst_provide]])], Sx_runtime = global_data.Sx_runtime, Sx_types = global_data.Sx_types, Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib_List = global_data.Stdlib__List, Sx_parser = global_data.Sx_parser, Sx_ref = global_data.Sx_ref, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_String = global_data.Stdlib__String, Stdlib_Printexc = global_data.Stdlib__Printexc; function eval_expr(expr, env){return Sx_ref[178].call(null, expr, env);} var cond_scheme_p = Sx_ref[99], cst$6 = "", a = [2, cst$6]; function raw_html_content(v){ if(typeof v !== "number" && 16 === v[0]){var s = v[1]; return [2, s];} return a; } function make_raw_html(v){ if(typeof v !== "number" && 2 === v[0]){var s = v[1]; return [16, s];} return 0; } function scope_emit(v1, v2){ return Sx_runtime[1].call(null, "scope-emit!", [0, v1, [0, v2, 0]]); } function init(v){return Sx_runtime[1].call(null, "init", [0, v, 0]);} function dict_has(a, b){ return Sx_runtime[1].call(null, "dict-has?", [0, a, [0, b, 0]]); } function dict_get(a, b){ return Sx_runtime[1].call(null, "dict-get", [0, a, [0, b, 0]]); } function is_component(v){ return Sx_runtime[1].call(null, "component?", [0, v, 0]); } function is_island(v){ return Sx_runtime[1].call(null, "island?", [0, v, 0]); } function is_macro(v){return Sx_runtime[1].call(null, "macro?", [0, v, 0]);} function is_lambda(v){ return Sx_runtime[1].call(null, "lambda?", [0, v, 0]); } function is_nil(v){return Sx_runtime[1].call(null, "nil?", [0, v, 0]);} var b = [2, cst$6], render_html_lake_ref = [0, function(a, param){return b;}], c = [2, cst$6], render_html_marsh_ref = [0, function(a, param){return c;}], d = [2, cst$6], render_html_island_ref = [0, function(b, a, param){return d;}]; function render_html_lake(args, env){ return caml_call2(render_html_lake_ref[1], args, env); } function render_html_marsh(args, env){ return caml_call2(render_html_marsh_ref[1], args, env); } function render_html_island(comp, args, env){ return caml_call3(render_html_island_ref[1], comp, args, env); } var cek_call = Sx_ref[159]; function trampoline(v){ if(typeof v !== "number" && 11 === v[0]){ var env = v[2], expr = v[1]; return Sx_ref[178].call(null, expr, [19, env]); } return v; } function expand_macro(m, args_val, env){ if(typeof m !== "number" && 10 === m[0]){ var mac = m[1]; a: { if(typeof args_val !== "number") switch(args_val[0]){ case 5: var args = args_val[1]; break a; case 20: var args = args_val[1][1]; break a; } var args = 0; } var local = Sx_runtime[78].call(null, [19, mac[4]]), ps$0 = Stdlib_List[20].call(null, function(p){return [2, p];}, mac[1]); a: { var ps = ps$0, as = args; for(;;){ if(! ps){ var match = mac[2]; if(! match) break a; var rp = match[1]; Sx_runtime[75].call(null, local, [2, rp], [5, as]); break a; } var ps_rest = ps[2], p = ps[1]; if(! as) break; var as_rest = as[2], a = as[1]; Sx_runtime[75].call(null, local, p, a); ps = ps_rest; as = as_rest; } var b = Stdlib_List[10].call(null, ps); Stdlib_List[18].call (null, function(p){Sx_runtime[75].call(null, local, p, 0); return 0;}, b); } return Sx_ref[178].call(null, mac[3], local); } return 0; } function try_catch(try_fn, catch_fn){ try{var b = Sx_runtime[6].call(null, try_fn, 0); return b;} catch(e$0){ var e = caml_wrap_exception(e$0); if(e[1] === Sx_types[7]){ var msg = e[2]; return Sx_runtime[6].call(null, catch_fn, [0, [2, msg], 0]); } var a = [0, [2, Stdlib_Printexc[1].call(null, e)], 0]; return Sx_runtime[6].call(null, catch_fn, a); } } function set_render_active_b(v){return 0;} function is_boolean_attr(name){ return Stdlib_List[37].call(null, name, boolean_attrs_set); } var html_tags_val = [5, Stdlib_List[20].call(null, function(s){return [2, s];}, html_tags_list)], void_elements_val = [5, Stdlib_List[20].call (null, function(s){return [2, s];}, void_elements_list)], boolean_attrs_val = [5, Stdlib_List[20].call (null, function(s){return [2, s];}, boolean_attrs_set)], cst_amp = "&", cst_gt = ">", cst_lt = "<", cst_quot = """; function escape_html_raw(s){ var buf = Stdlib_Buffer[1].call(null, caml_ml_string_length(s)); Stdlib_String[30].call (null, function(c){ if(34 === c) return Stdlib_Buffer[16].call(null, buf, cst_quot); if(60 <= c){ if(63 > c) switch(c - 60 | 0){ case 0: return Stdlib_Buffer[16].call(null, buf, cst_lt); case 2: return Stdlib_Buffer[16].call(null, buf, cst_gt); } } else if(38 === c) return Stdlib_Buffer[16].call(null, buf, cst_amp); return Stdlib_Buffer[12].call(null, buf, c); }, s); return Stdlib_Buffer[2].call(null, buf); } function escape_html_val(v){ a: { if(typeof v !== "number" && 2 === v[0]){var s$0 = v[1], s = s$0; break a;} var s = Sx_types[23].call(null, v); } return [2, escape_html_raw(s)]; } function escape_attr_val(v){return escape_html_val(v);} var cst$8 = '="', e = [2, cst$6]; function render_attrs(attrs){ if(typeof attrs !== "number" && 6 === attrs[0]){ var d = attrs[1], buf = Stdlib_Buffer[1].call(null, 64); Stdlib_Hashtbl[12].call (null, function(k, v){ if(is_boolean_attr(k)){ var a = Sx_types[45].call(null, v); return a ? (Stdlib_Buffer [12].call (null, buf, 32), Stdlib_Buffer[16].call(null, buf, k)) : a; } var b = 0 !== v ? 1 : 0; if(! b) return b; Stdlib_Buffer[12].call(null, buf, 32); Stdlib_Buffer[16].call(null, buf, k); Stdlib_Buffer[16].call(null, buf, cst$8); var c = escape_html_raw(Sx_types[23].call(null, v)); Stdlib_Buffer[16].call(null, buf, c); return Stdlib_Buffer[12].call(null, buf, 34); }, d); return [2, Stdlib_Buffer[2].call(null, buf)]; } return e; } var f = [2, cst$6], render_to_html_ref = [0, function(expr, env){return f;}]; function scope_emitted(name){ return Sx_runtime[1].call(null, "scope-emitted", [0, name, 0]); } var cst = "=", cst_contains = "contains?", definition_form_extensions = [5, 0], g = [0, [2, cst_define], 0], h = [0, [2, cst_defcomp], 0], i = [0, [2, cst_defisland], 0], j = [0, [2, cst_defmacro], 0], k = [0, [2, cst_defstyle], 0], l = [0, [2, cst_deftype], 0], m = [0, [2, cst_defeffect], 0]; function definition_form_p(name){ var or = Sx_runtime[1].call(null, cst, [0, name, g]); if(Sx_types[45].call(null, or)) return or; var or$0 = Sx_runtime[1].call(null, cst, [0, name, h]); if(Sx_types[45].call(null, or$0)) return or$0; var or$1 = Sx_runtime[1].call(null, cst, [0, name, i]); if(Sx_types[45].call(null, or$1)) return or$1; var or$2 = Sx_runtime[1].call(null, cst, [0, name, j]); if(Sx_types[45].call(null, or$2)) return or$2; var or$3 = Sx_runtime[1].call(null, cst, [0, name, k]); if(Sx_types[45].call(null, or$3)) return or$3; var or$4 = Sx_runtime[1].call(null, cst, [0, name, l]); if(Sx_types[45].call(null, or$4)) return or$4; var or$5 = Sx_runtime[1].call(null, cst, [0, name, m]); return Sx_types[45].call(null, or$5) ? or$5 : Sx_runtime [1].call (null, cst_contains, [0, definition_form_extensions, [0, name, 0]]); } var cst$0 = "<", cst_assoc = "assoc", cst_inc = "inc", cst_keyword = "keyword", cst_skip = "skip", n = [5, 0], o = [1, 0.], p = [2, cst_i], q = [0, 0], r = [2, cst_skip], s = [2, cst_skip], t = [2, cst_i], u = [2, cst_i], v = [0, 0], w = [2, cst_skip], x = [0, [2, cst_keyword], 0], y = [2, cst_i], z = [2, cst_i], A = [2, cst_i], B = [2, cst_i], C = [0, 1], D = [2, cst_skip], E = [2, cst_i], F = [2, cst_i]; function parse_element_args(args, env){ var attrs = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], a = Sx_runtime[5].call(null, args), d = Stdlib_Hashtbl[1].call(null, 0, 2), b = Sx_runtime[2].call(null, p); Stdlib_Hashtbl[11].call(null, d, b, o); var c = Sx_runtime[2].call(null, r); Stdlib_Hashtbl[11].call(null, d, c, q); var children = [0, n]; Stdlib_List[26].call (null, function(state, arg){ var skip = Sx_runtime[23].call(null, state, s); if(Sx_types[45].call(null, skip)){ var b = [0, Sx_runtime[23].call(null, state, t), 0], c = [0, state, [0, w, [0, v, [0, u, [0, Sx_runtime[1].call(null, cst_inc, b), 0]]]]]; return Sx_runtime[1].call(null, cst_assoc, c); } var d = [0, Sx_runtime[71].call(null, arg), x], and = Sx_runtime[1].call(null, cst, d); if(Sx_types[45].call(null, and)) var e = [0, Sx_runtime[22].call(null, args), 0], f = [0, Sx_runtime[23].call(null, state, y), 0], g = [0, Sx_runtime[1].call(null, cst_inc, f), e], a = Sx_runtime[1].call(null, cst$0, g); else var a = and; if(Sx_types[45].call(null, a)){ var h = [0, Sx_runtime[23].call(null, state, z), 0], i = Sx_runtime[1].call(null, cst_inc, h), val = trampoline(eval_expr(Sx_runtime[15].call(null, args, i), env)), j = Sx_types[47].call(null, arg); Sx_runtime[9].call(null, attrs, j, val); var k = [0, Sx_runtime[23].call(null, state, A), 0], l = [0, state, [0, D, [0, C, [0, B, [0, Sx_runtime[1].call(null, cst_inc, k), 0]]]]]; return Sx_runtime[1].call(null, cst_assoc, l); } children[1] = Sx_runtime[8].call(null, children[1], arg); var m = [0, Sx_runtime[23].call(null, state, E), 0], n = [0, state, [0, F, [0, Sx_runtime[1].call(null, cst_inc, m), 0]]]; return Sx_runtime[1].call(null, cst_assoc, n); }, [6, d], a); return [5, [0, attrs, [0, children[1], 0]]]; } function eval_cond(clauses, env){ var a = cond_scheme_p(clauses); return Sx_types[45].call(null, a) ? eval_cond_scheme(clauses, env) : eval_cond_clojure(clauses, env); } var G = [1, 1.]; function eval_cond_scheme(clauses$1, env){ var clauses = clauses$1; for(;;){ var a = Sx_runtime[31].call(null, clauses); if(Sx_types[45].call(null, a)) return 0; var clause = Sx_runtime[12].call(null, clauses), test = Sx_runtime[12].call(null, clause), body = Sx_runtime[15].call(null, clause, G), b = Sx_runtime[110].call(null, test); if(Sx_types[45].call(null, b)) return body; var c = trampoline(eval_expr(test, env)); if(Sx_types[45].call(null, c)) return body; var clauses$0 = Sx_runtime[13].call(null, clauses); clauses = clauses$0; } } var cst_slice = "slice", H = [0, [1, 2.], 0], I = [1, 1.], J = [0, [1, 2.], 0]; function eval_cond_clojure(clauses$1, env){ var clauses = clauses$1; for(;;){ var a = [0, Sx_runtime[22].call(null, clauses), H], b = Sx_runtime[1].call(null, cst$0, a); if(Sx_types[45].call(null, b)) return 0; var test = Sx_runtime[12].call(null, clauses), body = Sx_runtime[15].call(null, clauses, I), c = Sx_runtime[110].call(null, test); if(Sx_types[45].call(null, c)) return body; var d = trampoline(eval_expr(test, env)); if(Sx_types[45].call(null, d)) return body; var clauses$0 = Sx_runtime[1].call(null, cst_slice, [0, clauses, J]); clauses = clauses$0; } } var cst$1 = ">=", cst_list = "list", cst_symbol = "symbol", K = [0, [2, cst_list], 0], L = [0, [1, 2.], 0], M = [0, [2, cst_symbol], 0], N = [1, 1.]; function process_bindings(bindings, env){ var local = Sx_runtime[78].call(null, env), a = Sx_runtime[5].call(null, bindings); Stdlib_List[18].call (null, function(pair){ var b = [0, Sx_runtime[71].call(null, pair), K], and = Sx_runtime[1].call(null, cst, b); if(Sx_types[45].call(null, and)) var c = [0, Sx_runtime[22].call(null, pair), L], a = Sx_runtime[1].call(null, cst$1, c); else var a = and; if(Sx_types[45].call(null, a)){ var d = Sx_runtime[12].call(null, pair), e = [0, Sx_runtime[71].call(null, d), M], f = Sx_runtime[1].call(null, cst, e); if(Sx_types[45].call(null, f)) var g = Sx_runtime[12].call(null, pair), name = Sx_types[46].call(null, g); else var j = [0, Sx_runtime[12].call(null, pair), 0], name = [2, Sx_runtime[4].call(null, j)]; var h = trampoline(eval_expr(Sx_runtime[15].call(null, pair, N), local)), i = Sx_runtime[3].call(null, name); Sx_runtime[75].call(null, local, i, h); } return 0; }, a); return local; } var cst$4 = "-", cst$2 = "<>", cst$5 = ">", cst_raw = "raw!", cst_starts_with = "starts-with?", cst$3 = "~", O = [0, [2, cst_list], 0], P = [0, 0], Q = [0, [2, cst_symbol], 0], R = [0, 0], S = [0, [2, cst$2], 0], T = [0, [2, cst_raw], 0], U = [0, [2, cst$3], 0], V = [0, [2, "html:"], 0], W = [0, [1, 0.], 0], X = [0, [2, cst$4], 0], Y = [0, [1, 1.], 0], Z = [0, [2, cst_keyword], 0], _ = [1, 1.]; function is_render_expr_p(expr){ var a = [0, Sx_runtime[71].call(null, expr), O], b = Sx_runtime[1].call(null, cst, a), or = [0, 1 - Sx_types[45].call(null, b)], or$0 = Sx_types[45].call(null, or) ? or : Sx_runtime[31].call(null, expr); if(Sx_types[45].call(null, or$0)) return P; var h = Sx_runtime[12].call(null, expr), c = [0, Sx_runtime[71].call(null, h), Q], d = Sx_runtime[1].call(null, cst, c), e = [0, 1 - Sx_types[45].call(null, d)]; if(Sx_types[45].call(null, e)) return R; var n = Sx_types[46].call(null, h), or$1 = Sx_runtime[1].call(null, cst, [0, n, S]); if(Sx_types[45].call(null, or$1)) return or$1; var or$2 = Sx_runtime[1].call(null, cst, [0, n, T]); if(Sx_types[45].call(null, or$2)) return or$2; var or$3 = Sx_runtime[1].call(null, cst_starts_with, [0, n, U]); if(Sx_types[45].call(null, or$3)) return or$3; var or$4 = Sx_runtime[1].call(null, cst_starts_with, [0, n, V]); if(Sx_types[45].call(null, or$4)) return or$4; var or$5 = Sx_runtime[1].call(null, cst_contains, [0, html_tags_val, [0, n, 0]]); if(Sx_types[45].call(null, or$5)) return or$5; var f = [0, Sx_runtime[1].call(null, "index-of", [0, n, X]), W], and = Sx_runtime[1].call(null, cst$5, f); if(! Sx_types[45].call(null, and)) return and; var g = [0, Sx_runtime[22].call(null, expr), Y], and$0 = Sx_runtime[1].call(null, cst$5, g); if(! Sx_types[45].call(null, and$0)) return and$0; var i = Sx_runtime[15].call(null, expr, _), j = [0, Sx_runtime[71].call(null, i), Z]; return Sx_runtime[1].call(null, cst, j); } var cst_class = "class", $ = [0, [2, cst_class], 0], aa = [2, cst_class], ab = [0, [2, cst$6], 0], ac = [2, " "], ad = [2, cst_class], ae = [0, [2, cst_style], 0], af = [2, cst_style], ag = [0, [2, cst$6], 0], ah = [2, ";"], ai = [2, cst_style]; function merge_spread_attrs(target, spread_dict){ var a = Sx_runtime[1].call(null, "keys", [0, spread_dict, 0]), b = Sx_runtime[5].call(null, a); Stdlib_List[18].call (null, function(key){ var val = dict_get(spread_dict, key), c = Sx_runtime[1].call(null, cst, [0, key, $]); if(Sx_types[45].call(null, c)){ var existing = dict_get(target, aa); if(Sx_types[45].call(null, existing)) var d = Sx_runtime[1].call(null, cst, [0, existing, ab]), a = [0, 1 - Sx_types[45].call(null, d)]; else var a = existing; var e = Sx_types[45].call(null, a) ? [2, Sx_runtime[4].call(null, [0, existing, [0, ac, [0, val, 0]]])] : val; Sx_runtime[9].call(null, target, ad, e); } else{ var f = Sx_runtime[1].call(null, cst, [0, key, ae]); if(Sx_types[45].call(null, f)){ var existing$0 = dict_get(target, af); if(Sx_types[45].call(null, existing$0)) var g = Sx_runtime[1].call(null, cst, [0, existing$0, ag]), b = [0, 1 - Sx_types[45].call(null, g)]; else var b = existing$0; var h = Sx_types[45].call(null, b) ? [2, Sx_runtime[4].call(null, [0, existing$0, [0, ah, [0, val, 0]]])] : val; Sx_runtime[9].call(null, target, ai, h); } else Sx_runtime[9].call(null, target, key, val); } return 0; }, b); return 0; } var cst_boolean = "boolean", cst_element_attrs = "element-attrs", cst_false = "false", cst_nil = "nil", cst_number = "number", cst_raw_html = "raw-html", cst_spread = "spread", cst_string = "string", cst_thunk = "thunk", cst_true = "true", aj = [2, cst_nil], ak = [2, cst$6], al = [2, cst_string], am = [2, cst_number], an = [2, cst_boolean], ao = [2, cst_true], ap = [2, cst_false], aq = [2, cst_list], ar = [2, cst$6], as = [2, cst_symbol], at = [2, cst_keyword], au = [2, cst_raw_html], av = [2, cst_spread], aw = [2, cst_element_attrs], ax = [2, cst$6], ay = [2, cst_thunk]; function render_to_html$0(counter, expr$1, env$1){ var expr = expr$1, env = env$1; for(;;){ var match_val = Sx_runtime[71].call(null, expr); if(caml_equal(match_val, aj)) return ak; if(caml_equal(match_val, al)) return escape_html_val(expr); if(caml_equal(match_val, am)) return [2, Sx_runtime[4].call(null, [0, expr, 0])]; if(caml_equal(match_val, an)) return Sx_types[45].call(null, expr) ? ao : ap; if(caml_equal(match_val, aq)){ var c = Sx_runtime[31].call(null, expr); return Sx_types[45].call(null, c) ? ar : counter < 50 ? render_list_to_html$0(counter + 1 | 0, expr, env) : caml_trampoline_return (render_list_to_html$0, [0, expr, env]); } if(caml_equal(match_val, as)){ var a = trampoline(eval_expr(expr, env)); return counter < 50 ? render_value_to_html$0(counter + 1 | 0, a, env) : caml_trampoline_return(render_value_to_html$0, [0, a, env]); } if(caml_equal(match_val, at)) return escape_html_val(Sx_types[47].call(null, expr)); if(caml_equal(match_val, au)) return raw_html_content(expr); if(caml_equal(match_val, av)){ scope_emit(aw, Sx_runtime[68].call(null, expr)); return ax; } if(! caml_equal(match_val, ay)){ var b = trampoline(eval_expr(expr, env)); return counter < 50 ? render_value_to_html$0(counter + 1 | 0, b, env) : caml_trampoline_return(render_value_to_html$0, [0, b, env]); } var env$0 = Sx_types[67].call(null, expr), expr$0 = Sx_types[66].call(null, expr); expr = expr$0; env = env$0; } } function render_to_html(expr, env){ return caml_trampoline(render_to_html$0(0, expr, env)); } var az = [2, cst_nil], aA = [2, cst$6], aB = [2, cst_string], aC = [2, cst_number], aD = [2, cst_boolean], aE = [2, cst_true], aF = [2, cst_false], aG = [2, cst_list], aH = [2, cst_raw_html], aI = [2, cst_spread], aJ = [2, cst_element_attrs], aK = [2, cst$6], aL = [2, cst_thunk]; function render_value_to_html$0(counter, val, env){ var match_val = Sx_runtime[71].call(null, val); if(caml_equal(match_val, az)) return aA; if(caml_equal(match_val, aB)) return escape_html_val(val); if(caml_equal(match_val, aC)) return [2, Sx_runtime[4].call(null, [0, val, 0])]; if(caml_equal(match_val, aD)) return Sx_types[45].call(null, val) ? aE : aF; if(caml_equal(match_val, aG)) return counter < 50 ? render_list_to_html$0(counter + 1 | 0, val, env) : caml_trampoline_return(render_list_to_html$0, [0, val, env]); if(caml_equal(match_val, aH)) return raw_html_content(val); if(caml_equal(match_val, aI)){ scope_emit(aJ, Sx_runtime[68].call(null, val)); return aK; } if(! caml_equal(match_val, aL)) return escape_html_val([2, Sx_runtime[4].call(null, [0, val, 0])]); var a = Sx_types[67].call(null, val), b = Sx_types[66].call(null, val); return counter < 50 ? render_to_html$0(counter + 1 | 0, b, a) : caml_trampoline_return(render_to_html$0, [0, b, a]); } function render_value_to_html(val, env){ return caml_trampoline(render_value_to_html$0(0, val, env)); } function render_html_form_p(name){ return Sx_runtime[1].call (null, cst_contains, [0, render_html_forms, [0, name, 0]]); } var cst$7 = "\xce\xbb", cst_div = "<\/div>", cst_div_class_sx_render_error_ = '
Render error: ', cst_join = "join", aM = [2, cst$6], aN = [0, [2, cst_symbol], 0], aO = [2, cst$6], aP = [0, [2, cst$2], 0], aQ = [2, cst$6], aR = [0, [2, cst_raw], 0], aS = [2, cst$6], aT = [0, [2, "lake"], 0], aU = [0, [2, "marsh"], 0], aV = [0, [2, "error-boundary"], 0], aW = [0, [1, 1.], 0], aX = [0, [2, cst_div], 0], aY = [0, [2, cst$5], [0, [2, cst_gt], 0]], aZ = [0, [2, cst$0], [0, [2, cst_lt], 0]], a0 = [0, [2, cst_div], 0], a1 = [2, cst_div_class_sx_render_error_], a2 = [0, 0, 0], a3 = [0, [2, cst_div], 0], a4 = [2, cst_div_class_sx_render_error_], a5 = [2, cst$6], a6 = [2, '
'], a7 = [0, [2, "portal"], 0], a8 = [2, cst$6], a9 = [0, [2, cst$3], 0], a_ = [0, [2, cst$3], 0], a$ = [0, [2, " -->"], 0], ba = [2, "