From 6e27442d57a1f8e4ff530b052b2100b8f8f5d814 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 12 Apr 2026 08:41:38 +0000 Subject: [PATCH] =?UTF-8?q?Step=2017:=20streaming=20render=20=E2=80=94=20h?= =?UTF-8?q?yperscript=20enhancements,=20WASM=20builds,=20live=20server=20t?= =?UTF-8?q?ests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Streaming chunked transfer with shell-first suspense and resolve scripts. Hyperscript parser/compiler/runtime expanded for conformance. WASM static assets added to OCaml host. Playwright streaming and page-level test suites. Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/dune | 2 +- hosts/ocaml/bin/sx_server.ml | 64 +- hosts/ocaml/shared/static/wasm/sx-platform.js | 751 + .../ocaml/shared/static/wasm/sx_browser.bc.js | 60695 ++++++++++++++++ .../shared/static/wasm/sx_browser.bc.wasm.js | 1821 + lib/hyperscript/compiler.sx | 250 +- lib/hyperscript/parser.sx | 328 +- lib/hyperscript/runtime.sx | 192 +- lib/hyperscript/tokenizer.sx | 7 +- shared/static/wasm/sx-platform.js | 54 +- shared/static/wasm/sx/compiler.sx | 2 +- shared/static/wasm/sx/compiler.sxbc | 4 +- shared/static/wasm/sx/hs-compiler.sx | 250 +- shared/static/wasm/sx/hs-compiler.sxbc | 4 +- shared/static/wasm/sx/hs-parser.sx | 328 +- shared/static/wasm/sx/hs-parser.sxbc | 4 +- shared/static/wasm/sx/hs-runtime.sx | 192 +- shared/static/wasm/sx/hs-runtime.sxbc | 4 +- shared/static/wasm/sx/hs-tokenizer.sx | 7 +- shared/static/wasm/sx/hs-tokenizer.sxbc | 4 +- shared/static/wasm/sx/module-manifest.json | 6 + .../tests/test-hyperscript-conformance-dev.sx | 465 + sx/sx/streaming-demo.test.sx | 31 + test-results/.last-run.json | 7 +- .../error-context.md | 33 - .../error-context.md | 158 - .../playwright/generate-sx-conformance-dev.py | 376 + tests/playwright/page-tests.spec.js | 376 + tests/playwright/streaming.spec.js | 172 + 29 files changed, 65959 insertions(+), 628 deletions(-) create mode 100644 hosts/ocaml/shared/static/wasm/sx-platform.js create mode 100644 hosts/ocaml/shared/static/wasm/sx_browser.bc.js create mode 100644 hosts/ocaml/shared/static/wasm/sx_browser.bc.wasm.js create mode 100644 spec/tests/test-hyperscript-conformance-dev.sx create mode 100644 sx/sx/streaming-demo.test.sx delete mode 100644 test-results/tests-playwright-bytecode--5ca07-nifest-deps-not-all-modules/error-context.md delete mode 100644 test-results/tests-playwright-bytecode--8670c-s-not-re-fetch-boot-modules/error-context.md create mode 100644 tests/playwright/generate-sx-conformance-dev.py create mode 100644 tests/playwright/page-tests.spec.js diff --git a/hosts/ocaml/bin/dune b/hosts/ocaml/bin/dune index 1d28418b..e5d14411 100644 --- a/hosts/ocaml/bin/dune +++ b/hosts/ocaml/bin/dune @@ -1,6 +1,6 @@ (executables (names run_tests debug_set sx_server integration_tests) - (libraries sx unix)) + (libraries sx unix threads.posix)) (executable (name mcp_tree) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index f414d425..d8be8c1d 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -151,6 +151,9 @@ let _app_config : (string, value) Hashtbl.t option ref = ref None let _defpage_paths : string list ref = ref [] (* Streaming pages: path → page name, for pages with :stream true *) let _streaming_pages : (string, string) Hashtbl.t = Hashtbl.create 8 +(* Mutex to serialize streaming renders — OCaml threads share the runtime + lock, and concurrent CEK evaluations corrupt shared state. *) +let _stream_mutex = Mutex.create () let get_app_config key default = match !_app_config with @@ -1746,7 +1749,7 @@ let http_redirect url = let http_chunked_header ?(status=200) ?(content_type="text/html; charset=utf-8") () = let status_text = match status with | 200 -> "OK" | 404 -> "Not Found" | 500 -> "Internal Server Error" | _ -> "Unknown" in - Printf.sprintf "HTTP/1.1 %d %s\r\nContent-Type: %s\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\n\r\n" + Printf.sprintf "HTTP/1.1 %d %s\r\nContent-Type: %s\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nX-Accel-Buffering: no\r\nCache-Control: no-cache, no-transform\r\n\r\n" status status_text content_type let write_chunk fd data = @@ -1755,13 +1758,14 @@ let write_chunk fd data = let bytes = Bytes.of_string chunk in let total = Bytes.length bytes in let written = ref 0 in - (try + try while !written < total do let n = Unix.write fd bytes !written (total - !written) in written := !written + n - done - with Unix.Unix_error _ -> ()) - end + done; + true + with Unix.Unix_error _ -> false + end else true let end_chunked fd = (try ignore (Unix.write_substring fd "0\r\n\r\n" 0 5) with Unix.Unix_error _ -> ()); @@ -2004,6 +2008,10 @@ let eval_with_io expr env = (* ====================================================================== *) let http_render_page_streaming env path _headers fd page_name = + (* No send timeout for streaming — the alive check in write_chunk handles + broken pipe. Streaming clients may be slow to receive large shell chunks + while busy parsing/downloading other resources. *) + (try Unix.setsockopt_float fd Unix.SO_SNDTIMEO 30.0 with _ -> ()); let t0 = Unix.gettimeofday () in let page_def = try match env_get env ("page:" ^ page_name) with Dict d -> d | _ -> raise Not_found @@ -2102,17 +2110,18 @@ let http_render_page_streaming env path _headers fd page_name = let header = http_chunked_header () in let header_bytes = Bytes.of_string header in (try ignore (Unix.write fd header_bytes 0 (Bytes.length header_bytes)) with _ -> ()); - write_chunk fd shell_body; + let alive = ref true in + alive := write_chunk fd shell_body; (* Bootstrap resolve script — must come after shell so suspense elements exist *) - write_chunk fd _sx_streaming_bootstrap; + if !alive then alive := write_chunk fd _sx_streaming_bootstrap; let t2 = Unix.gettimeofday () in (* Phase 3: Evaluate :data, render :content, flush resolve scripts. Uses eval_with_io so :data expressions can perform IO (e.g. sleep, fetch). Each data item is resolved independently — IO in one item doesn't block others - from being flushed as they complete. *) + from being flushed as they complete. Bails out early on broken pipe. *) let resolve_count = ref 0 in - if data_ast <> Nil && content_ast <> Nil then begin + if !alive && data_ast <> Nil && content_ast <> Nil then begin (try let data_result = eval_with_io data_ast env in let t3_data = Unix.gettimeofday () in @@ -2140,6 +2149,7 @@ let http_render_page_streaming env path _headers fd page_name = Each item flushes its resolve script independently — the client sees content appear progressively as each IO completes. *) List.iter (fun (item, stream_id) -> + if !alive then (try (* IO sleep if delay specified — demonstrates async streaming *) (match item with @@ -2170,7 +2180,7 @@ let http_render_page_streaming env path _headers fd page_name = let sx_source = match content_result with | String s | SxExpr s -> s | _ -> serialize_value content_result in let resolve_script = sx_streaming_resolve_script stream_id sx_source in - write_chunk fd resolve_script; + alive := write_chunk fd resolve_script; incr resolve_count with e -> (* Error boundary: emit error fallback for this slot *) @@ -2178,7 +2188,7 @@ let http_render_page_streaming env path _headers fd page_name = Printf.eprintf "[sx-stream] resolve error for %s: %s\n%!" stream_id msg; let error_sx = Printf.sprintf "(div :class \"text-rose-600 p-4 text-sm\" \"Error: %s\")" (String.map (fun c -> if c = '"' then '\'' else c) msg) in - write_chunk fd (sx_streaming_resolve_script stream_id error_sx); + alive := write_chunk fd (sx_streaming_resolve_script stream_id error_sx); incr resolve_count) ) data_items; let t3 = Unix.gettimeofday () in @@ -2190,7 +2200,7 @@ let http_render_page_streaming env path _headers fd page_name = Printf.eprintf "[sx-stream] %s shell=%.3fs (no :data/:content)\n%!" path (t1 -. t0); (* Phase 4: Send closing tags + end chunked response *) - if shell_tail <> "" then write_chunk fd shell_tail; + if !alive && shell_tail <> "" then ignore (write_chunk fd shell_tail); end_chunked fd (* ====================================================================== *) @@ -2309,9 +2319,20 @@ let http_inject_shell_statics env static_dir sx_sxc = ) env.bindings; let raw_defs = Buffer.contents buf in (* Component-defs are inlined in . *) - let component_defs = raw_defs in + Escape . *) + let component_defs = + let len = String.length raw_defs in + let buf2 = Buffer.create (len + 64) in + for i = 0 to len - 1 do + if raw_defs.[i] = '<' && i + 1 < len && raw_defs.[i + 1] = '/' then begin + Buffer.add_string buf2 "<\\/"; + end else if raw_defs.[i] = '/' && i > 0 && raw_defs.[i - 1] = '<' then + () (* skip — already handled above *) + else + Buffer.add_char buf2 raw_defs.[i] + done; + Buffer.contents buf2 + in let component_hash = Digest.string component_defs |> Digest.to_hex in (* Compute per-file hashes for cache busting *) let wasm_hash = file_hash (static_dir ^ "/wasm/sx_browser.bc.wasm.js") in @@ -3428,11 +3449,14 @@ let http_mode port = in write_response fd response; true end else begin - (* Full page streaming: chunked transfer encoding *) - (try http_render_page_streaming env path [] fd sname - with Exit -> () (* page def not found — already handled *) - | e -> Printf.eprintf "[sx-stream] unexpected error for %s: %s\n%!" path (Printexc.to_string e); - (try Unix.close fd with _ -> ())); + (* Full page streaming: run in a thread so the accept loop + stays unblocked for concurrent requests. *) + let _t = Thread.create (fun () -> + (try http_render_page_streaming env path [] fd sname + with Exit -> () + | e -> Printf.eprintf "[sx-stream] unexpected error for %s: %s\n%!" path (Printexc.to_string e); + (try Unix.close fd with _ -> ())) + ) () in true end end else diff --git a/hosts/ocaml/shared/static/wasm/sx-platform.js b/hosts/ocaml/shared/static/wasm/sx-platform.js new file mode 100644 index 00000000..e17ef12b --- /dev/null +++ b/hosts/ocaml/shared/static/wasm/sx-platform.js @@ -0,0 +1,751 @@ +/** + * sx-platform.js — Browser platform layer for the SX WASM kernel. + * + * Registers the 8 FFI host primitives and loads web adapter .sx files. + * This is the only JS needed beyond the WASM kernel itself. + * + * Usage: + * + * + * + * Or for js_of_ocaml mode: + * + * + */ + +(function() { + "use strict"; + + function boot(K) { + + // ================================================================ + // FFI Host Primitives + // ================================================================ + + // Lazy module loading — islands/components call this to declare dependencies + K.registerNative("load-library!", function(args) { + var name = args[0]; + if (!name) return false; + return __sxLoadLibrary(name) || false; + }); + + K.registerNative("host-global", function(args) { + var name = args[0]; + if (typeof globalThis !== "undefined" && name in globalThis) return globalThis[name]; + if (typeof window !== "undefined" && name in window) return window[name]; + return null; + }); + + K.registerNative("host-get", function(args) { + var obj = args[0], prop = args[1]; + if (obj == null) return null; + var v = obj[prop]; + return v === undefined ? null : v; + }); + + K.registerNative("host-set!", function(args) { + var obj = args[0], prop = args[1], val = args[2]; + if (obj != null) obj[prop] = val; + }); + + K.registerNative("host-call", function(args) { + var obj = args[0], method = args[1]; + var callArgs = []; + for (var i = 2; i < args.length; i++) callArgs.push(args[i]); + if (obj == null) { + // Global function call + var fn = typeof globalThis !== "undefined" ? globalThis[method] : window[method]; + if (typeof fn === "function") return fn.apply(null, callArgs); + return null; + } + if (typeof obj[method] === "function") { + try { return obj[method].apply(obj, callArgs); } + catch(e) { console.error("[sx] host-call error:", e); return null; } + } + return null; + }); + + K.registerNative("host-new", function(args) { + var name = args[0]; + var cArgs = args.slice(1); + var Ctor = typeof globalThis !== "undefined" ? globalThis[name] : window[name]; + if (typeof Ctor !== "function") return null; + switch (cArgs.length) { + case 0: return new Ctor(); + case 1: return new Ctor(cArgs[0]); + case 2: return new Ctor(cArgs[0], cArgs[1]); + case 3: return new Ctor(cArgs[0], cArgs[1], cArgs[2]); + default: return new Ctor(cArgs[0], cArgs[1], cArgs[2], cArgs[3]); + } + }); + + K.registerNative("host-callback", function(args) { + var fn = args[0]; + // Native JS function (not SX-origin) — pass through + if (typeof fn === "function" && fn.__sx_handle === undefined) return fn; + // SX callable (has __sx_handle) — wrap as JS function with suspension handling + if (fn && fn.__sx_handle !== undefined) { + return function() { + var a = Array.prototype.slice.call(arguments); + var result = K.callFn(fn, a); + // Handle IO suspension chain (e.g. wait, fetch, navigate) + _driveAsync(result); + return result; + }; + } + return function() {}; + }); + + /** + * Drive an async suspension chain to completion. + * When K.callFn returns {suspended: true, request: ..., resume: fn}, + * handle the IO operation and resume the VM. + */ + function _driveAsync(result) { + if (!result || !result.suspended) return; + console.log("[sx] IO suspension:", JSON.stringify(result.request, null, 2)); + var req = result.request; + if (!req) return; + + // req is an SX list — extract items. K returns SX values. + var items = req.items || req; + var op = (items && items[0]) || req; + // Normalize: op might be a string or {name: "..."} symbol + var opName = (typeof op === "string") ? op : (op && op.name) || String(op); + + if (opName === "wait" || opName === "io-sleep") { + // (wait ms) or (io-sleep ms) — resume after timeout + var ms = (items && items[1]) || 0; + if (typeof ms !== "number") ms = parseFloat(ms) || 0; + console.log("[sx] IO wait: " + ms + "ms, resuming after timeout"); + setTimeout(function() { + try { + var resumed = result.resume(null); + console.log("[sx] IO resumed:", typeof resumed, resumed && resumed.suspended ? "suspended-again" : "done", JSON.stringify(resumed)); + _driveAsync(resumed); + } catch(e) { + console.error("[sx] IO resume error:", e); + } + }, ms); + } else if (opName === "navigate") { + // (navigate url) — browser navigation + var url = (items && items[1]) || "/"; + if (typeof url !== "string") url = String(url); + window.location.href = url; + } else { + console.warn("[sx] Unhandled IO suspension in callback:", opName, req); + } + } + + K.registerNative("host-typeof", function(args) { + var obj = args[0]; + if (obj == null) return "nil"; + if (obj instanceof Element) return "element"; + if (obj instanceof Text) return "text"; + if (obj instanceof DocumentFragment) return "fragment"; + if (obj instanceof Document) return "document"; + if (obj instanceof Event) return "event"; + if (obj instanceof Promise) return "promise"; + if (obj instanceof AbortController) return "abort-controller"; + return typeof obj; + }); + + K.registerNative("host-await", function(args) { + var promise = args[0], callback = args[1]; + if (promise && typeof promise.then === "function") { + var cb; + if (typeof callback === "function") cb = callback; + else if (callback && callback.__sx_handle !== undefined) + cb = function(v) { return K.callFn(callback, [v]); }; + else cb = function() {}; + promise.then(cb); + } + }); + + // ================================================================ + // Constants expected by .sx files + // ================================================================ + + K.eval('(define SX_VERSION "wasm-1.0")'); + K.eval('(define SX_ENGINE "ocaml-vm-wasm")'); + K.eval('(define parse sx-parse)'); + K.eval('(define serialize sx-serialize)'); + + // ================================================================ + // DOM query helpers used by boot.sx / orchestration.sx + // (These are JS-native in the transpiled bundle; here via FFI.) + // ================================================================ + + K.registerNative("query-sx-scripts", function(args) { + var root = (args[0] && args[0] !== null) ? args[0] : document; + if (typeof root.querySelectorAll !== "function") root = document; + return Array.prototype.slice.call(root.querySelectorAll('script[type="text/sx"]')); + }); + + K.registerNative("query-page-scripts", function(args) { + return Array.prototype.slice.call(document.querySelectorAll('script[type="text/sx-pages"]')); + }); + + K.registerNative("query-component-scripts", function(args) { + var root = (args[0] && args[0] !== null) ? args[0] : document; + if (typeof root.querySelectorAll !== "function") root = document; + return Array.prototype.slice.call(root.querySelectorAll('script[type="text/sx"][data-components]')); + }); + + // localStorage + K.registerNative("local-storage-get", function(args) { + try { var v = localStorage.getItem(args[0]); return v === null ? null : v; } + catch(e) { return null; } + }); + K.registerNative("local-storage-set", function(args) { + try { localStorage.setItem(args[0], args[1]); } catch(e) {} + }); + K.registerNative("local-storage-remove", function(args) { + try { localStorage.removeItem(args[0]); } catch(e) {} + }); + + // log-info/log-warn defined in browser.sx; log-error as native fallback + K.registerNative("log-error", function(args) { console.error.apply(console, ["[sx]"].concat(args)); }); + + // Cookie access (browser-side) + K.registerNative("get-cookie", function(args) { + var name = args[0]; + var match = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '=([^;]*)')); + return match ? decodeURIComponent(match[1]) : null; + }); + K.registerNative("set-cookie", function(args) { + document.cookie = args[0] + "=" + encodeURIComponent(args[1] || "") + ";path=/;max-age=31536000;SameSite=Lax"; + }); + + // IntersectionObserver — native JS to avoid bytecode callback issues + K.registerNative("observe-intersection", function(args) { + var el = args[0], callback = args[1], once = args[2], delay = args[3]; + var obs = new IntersectionObserver(function(entries) { + for (var i = 0; i < entries.length; i++) { + if (entries[i].isIntersecting) { + var d = (delay && delay !== null) ? delay : 0; + setTimeout(function() { K.callFn(callback, []); }, d); + if (once) obs.unobserve(el); + } + } + }); + obs.observe(el); + return obs; + }); + + // ================================================================ + // Load SX web libraries and adapters + // ================================================================ + + // Load order follows dependency graph: + // 1. Core spec files (parser, render, primitives already compiled into WASM kernel) + // 2. Spec modules: signals, deps, router, page-helpers + // 3. Bytecode compiler + VM (for JIT in browser) + // 4. Web libraries: dom.sx, browser.sx (built on 8 FFI primitives) + // 5. Web adapters: adapter-html, adapter-sx, adapter-dom + // 6. Web framework: engine, orchestration, boot + + var _baseUrl = ""; + + // Detect base URL and cache-bust params from current script tag. + // _cacheBust comes from the script's own ?v= query string (used for .sx source fallback). + // _sxbcCacheBust comes from data-sxbc-hash attribute — a separate content hash + // covering all .sxbc files so each file gets its own correct cache buster. + var _cacheBust = ""; + var _sxbcCacheBust = ""; + (function() { + if (typeof document !== "undefined") { + var scripts = document.getElementsByTagName("script"); + for (var i = scripts.length - 1; i >= 0; i--) { + var src = scripts[i].src || ""; + if (src.indexOf("sx-platform") !== -1) { + _baseUrl = src.substring(0, src.lastIndexOf("/") + 1); + var qi = src.indexOf("?"); + if (qi !== -1) _cacheBust = src.substring(qi); + var sxbcHash = scripts[i].getAttribute("data-sxbc-hash"); + if (sxbcHash) _sxbcCacheBust = "?v=" + sxbcHash; + break; + } + } + } + })(); + + /** + * Deserialize type-tagged JSON constant back to JS value for loadModule. + */ + function deserializeConstant(c) { + if (!c || !c.t) return null; + switch (c.t) { + case 's': return c.v; + case 'n': return c.v; + case 'b': return c.v; + case 'nil': return null; + case 'sym': return { _type: 'symbol', name: c.v }; + case 'kw': return { _type: 'keyword', name: c.v }; + case 'list': return { _type: 'list', items: (c.v || []).map(deserializeConstant) }; + case 'code': return { + _type: 'dict', + bytecode: { _type: 'list', items: c.v.bytecode }, + constants: { _type: 'list', items: (c.v.constants || []).map(deserializeConstant) }, + arity: c.v.arity || 0, + 'upvalue-count': c.v['upvalue-count'] || 0, + locals: c.v.locals || 0, + }; + case 'dict': { + var d = { _type: 'dict' }; + for (var k in c.v) d[k] = deserializeConstant(c.v[k]); + return d; + } + default: return null; + } + } + + /** + * Convert a parsed SX code form ({_type:"list", items:[symbol"code", ...]}) + * into the dict format that K.loadModule / js_to_value expects. + * Mirrors the OCaml convert_code/convert_const in sx_browser.ml. + */ + function convertCodeForm(form) { + if (!form || form._type !== "list" || !form.items || !form.items.length) return null; + var items = form.items; + if (!items[0] || items[0]._type !== "symbol" || items[0].name !== "code") return null; + + var d = { _type: "dict", arity: 0, "upvalue-count": 0 }; + for (var i = 1; i < items.length; i++) { + var item = items[i]; + if (item && item._type === "keyword" && i + 1 < items.length) { + var val = items[i + 1]; + if (item.name === "arity" || item.name === "upvalue-count") { + d[item.name] = (typeof val === "number") ? val : 0; + } else if (item.name === "bytecode" && val && val._type === "list") { + d.bytecode = val; // {_type:"list", items:[numbers...]} + } else if (item.name === "constants" && val && val._type === "list") { + d.constants = { _type: "list", items: (val.items || []).map(convertConst) }; + } + i++; // skip value + } + } + return d; + } + + function convertConst(c) { + if (!c || typeof c !== "object") return c; // number, string, boolean, null pass through + if (c._type === "list" && c.items && c.items.length > 0) { + var head = c.items[0]; + if (head && head._type === "symbol" && head.name === "code") { + return convertCodeForm(c); + } + if (head && head._type === "symbol" && head.name === "list") { + return { _type: "list", items: c.items.slice(1).map(convertConst) }; + } + } + return c; // symbols, keywords, etc. pass through + } + + /** + * Try loading a pre-compiled .sxbc bytecode module (SX text format). + * Uses K.loadModule which handles VM suspension (import requests). + * Returns true on success, null on failure (caller falls back to .sx source). + */ + function loadBytecodeFile(path) { + var sxbcPath = path.replace(/\.sx$/, '.sxbc'); + var url = _baseUrl + sxbcPath + _sxbcCacheBust; + try { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); + xhr.send(); + if (xhr.status !== 200) return null; + + // Parse the sxbc text to get the SX tree + var parsed = K.parse(xhr.responseText); + if (!parsed || !parsed.length) return null; + var sxbc = parsed[0]; // (sxbc version hash (code ...)) + if (!sxbc || sxbc._type !== "list" || !sxbc.items) return null; + + // Extract the code form — 3rd or 4th item (after sxbc, version, optional hash) + var codeForm = null; + for (var i = 1; i < sxbc.items.length; i++) { + var item = sxbc.items[i]; + if (item && item._type === "list" && item.items && item.items.length > 0 && + item.items[0] && item.items[0]._type === "symbol" && item.items[0].name === "code") { + codeForm = item; + break; + } + } + if (!codeForm) return null; + + // Convert the SX code form to a dict for loadModule + var moduleDict = convertCodeForm(codeForm); + if (!moduleDict) return null; + + // Load via K.loadModule which handles VmSuspended + var result = K.loadModule(moduleDict); + + // Handle import suspensions — fetch missing libraries on demand + while (result && result.suspended && result.op === "import") { + var req = result.request; + var libName = req && req.library; + if (libName) { + // Try to find and load the library from the manifest + var loaded = handleImportSuspension(libName); + if (!loaded) { + console.warn("[sx-platform] lazy import: library not found:", libName); + } + } + // Resume the suspended module (null = library is now in env) + result = result.resume(null); + } + + if (typeof result === 'string' && result.indexOf('Error') === 0) { + console.warn("[sx-platform] bytecode FAIL " + path + ":", result); + return null; + } + return true; + } catch(e) { + console.warn("[sx-platform] bytecode FAIL " + path + ":", e.message || e); + return null; + } + } + + /** + * Handle an import suspension by finding and loading the library. + * The library name may be an SX value (list/string) — normalize to manifest key. + */ + function handleImportSuspension(libSpec) { + // libSpec from the kernel is the library name spec, e.g. {_type:"list", items:[{name:"sx"},{name:"dom"}]} + // or a string like "sx dom" + var key; + if (typeof libSpec === "string") { + key = libSpec; + } else if (libSpec && libSpec._type === "list" && libSpec.items) { + key = libSpec.items.map(function(item) { + return (item && item.name) ? item.name : String(item); + }).join(" "); + } else if (libSpec && libSpec._type === "dict") { + // Dict with key/name fields + key = libSpec.key || libSpec.name || ""; + } else { + key = String(libSpec); + } + + if (_loadedLibs[key]) return true; // already loaded + + if (!_manifest) loadManifest(); + if (!_manifest || !_manifest[key]) { + console.warn("[sx-platform] lazy import: unknown library key '" + key + "'"); + return false; + } + + // Load the library (and its deps) on demand + return loadLibrary(key, {}); + } + + /** + * Load an .sx file synchronously via XHR (boot-time only). + * Returns the number of expressions loaded, or an error string. + */ + function loadSxFile(path) { + var url = _baseUrl + path + _cacheBust; + try { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, false); // synchronous + xhr.send(); + if (xhr.status === 200) { + var result = K.load(xhr.responseText); + if (typeof result === "string" && result.indexOf("Error") === 0) { + console.error("[sx-platform] FAIL " + path + ":", result); + return 0; + } + console.log("[sx-platform] ok " + path + " (" + result + " exprs)"); + return result; + } else { + console.error("[sx] Failed to fetch " + path + ": HTTP " + xhr.status); + return null; + } + } catch(e) { + console.error("[sx] Failed to load " + path + ":", e); + return null; + } + } + + // ================================================================ + // Manifest-driven module loader — only loads what's needed + // ================================================================ + + var _manifest = null; + var _loadedLibs = {}; + + /** + * Fetch and parse the module manifest (library deps + file paths). + */ + function loadManifest() { + if (_manifest) return _manifest; + try { + var xhr = new XMLHttpRequest(); + xhr.open("GET", _baseUrl + "sx/module-manifest.json" + _cacheBust, false); + xhr.send(); + if (xhr.status === 200) { + _manifest = JSON.parse(xhr.responseText); + return _manifest; + } + } catch(e) {} + console.warn("[sx-platform] No manifest found, falling back to full load"); + return null; + } + + /** + * Load a single library and all its dependencies (recursive). + * Cycle-safe: tracks in-progress loads to break circular deps. + * Functions in cyclic modules resolve symbols at call time via global env. + */ + function loadLibrary(name, loading) { + if (_loadedLibs[name]) return true; + if (loading[name]) return true; // cycle — skip + loading[name] = true; + + var info = _manifest[name]; + if (!info) { + console.warn("[sx-platform] Unknown library: " + name); + return false; + } + + // Resolve deps first + for (var i = 0; i < info.deps.length; i++) { + loadLibrary(info.deps[i], loading); + } + + // Mark as loaded BEFORE executing — self-imports (define-library re-exports) + // will see it as already loaded and skip rather than infinite-looping. + _loadedLibs[name] = true; + + // Load this module + var ok = loadBytecodeFile("sx/" + info.file); + if (!ok) { + var sxFile = info.file.replace(/\.sxbc$/, '.sx'); + ok = loadSxFile("sx/" + sxFile); + } + return !!ok; + } + + /** + * Load web stack using the module manifest. + * Only downloads libraries that the entry point transitively depends on. + */ + function loadWebStack() { + var manifest = loadManifest(); + if (!manifest) return loadWebStackFallback(); + + var entry = manifest["_entry"]; + if (!entry) { + console.warn("[sx-platform] No _entry in manifest, falling back"); + return loadWebStackFallback(); + } + + var loading = {}; + var t0 = performance.now(); + if (K.beginModuleLoad) K.beginModuleLoad(); + + // Load all entry point deps recursively + for (var i = 0; i < entry.deps.length; i++) { + loadLibrary(entry.deps[i], loading); + } + + // Load entry point itself (boot.sx — not a library, just defines + init) + loadBytecodeFile("sx/" + entry.file) || loadSxFile("sx/" + entry.file.replace(/\.sxbc$/, '.sx')); + + if (K.endModuleLoad) K.endModuleLoad(); + var count = Object.keys(_loadedLibs).length + 1; // +1 for entry + var dt = Math.round(performance.now() - t0); + console.log("[sx-platform] Loaded " + count + " modules in " + dt + "ms (manifest-driven)"); + } + + /** + * Fallback: load all files in hardcoded order (pre-manifest compat). + */ + function loadWebStackFallback() { + var files = [ + "sx/render.sx", "sx/core-signals.sx", "sx/signals.sx", "sx/deps.sx", + "sx/router.sx", "sx/page-helpers.sx", "sx/freeze.sx", "sx/highlight.sx", + "sx/bytecode.sx", "sx/compiler.sx", "sx/vm.sx", "sx/dom.sx", "sx/browser.sx", + "sx/adapter-html.sx", "sx/adapter-sx.sx", "sx/adapter-dom.sx", + "sx/boot-helpers.sx", "sx/hypersx.sx", "sx/harness.sx", + "sx/harness-reactive.sx", "sx/harness-web.sx", + "sx/engine.sx", "sx/orchestration.sx", + "sx/hs-tokenizer.sx", "sx/hs-parser.sx", "sx/hs-compiler.sx", + "sx/hs-runtime.sx", "sx/hs-integration.sx", + "sx/boot.sx", + ]; + if (K.beginModuleLoad) K.beginModuleLoad(); + for (var i = 0; i < files.length; i++) { + if (!loadBytecodeFile(files[i])) loadSxFile(files[i]); + } + if (K.endModuleLoad) K.endModuleLoad(); + console.log("[sx-platform] Loaded " + files.length + " files (fallback)"); + } + + /** + * Load an optional library on demand (e.g., highlight, harness). + * Can be called after boot for pages that need extra modules. + */ + globalThis.__sxLoadLibrary = function(name) { + if (!_manifest) loadManifest(); + if (!_manifest) return false; + if (_loadedLibs[name]) return true; + if (K.beginModuleLoad) K.beginModuleLoad(); + var ok = loadLibrary(name, {}); + if (K.endModuleLoad) K.endModuleLoad(); + return ok; + }; + + // ================================================================ + // Transparent lazy loading — symbol → library index + // + // When the VM hits an undefined symbol, the resolve hook checks this + // index, loads the library that exports it, and returns the value. + // The programmer just calls the function — loading is invisible. + // ================================================================ + + var _symbolIndex = null; // symbol name → library key + + function buildSymbolIndex() { + if (_symbolIndex) return _symbolIndex; + if (!_manifest) loadManifest(); + if (!_manifest) return null; + _symbolIndex = {}; + for (var key in _manifest) { + if (key.startsWith('_')) continue; + var entry = _manifest[key]; + if (entry.exports) { + for (var i = 0; i < entry.exports.length; i++) { + _symbolIndex[entry.exports[i]] = key; + } + } + } + return _symbolIndex; + } + + // Register the resolve hook — called by the VM when GLOBAL_GET fails + K.registerNative("__resolve-symbol", function(args) { + var name = args[0]; + if (!name) return null; + var idx = buildSymbolIndex(); + if (!idx || !idx[name]) return null; + var lib = idx[name]; + if (_loadedLibs[lib]) return null; // already loaded but symbol still missing — real error + // Load the library + __sxLoadLibrary(lib); + // Return null — the VM will re-lookup in globals after the hook loads the module + return null; + }); + + // ================================================================ + // Compatibility shim — expose Sx global matching current JS API + // ================================================================ + + globalThis.Sx = { + VERSION: "wasm-1.0", + parse: function(src) { return K.parse(src); }, + eval: function(src) { return K.eval(src); }, + load: function(src) { return K.load(src); }, + renderToHtml: function(expr) { return K.renderToHtml(expr); }, + callFn: function(fn, args) { return K.callFn(fn, args); }, + engine: function() { return K.engine(); }, + // Boot entry point (called by auto-init or manually) + init: function() { + if (typeof K.eval === "function") { + // Check boot-init exists + // Step through boot manually + console.log("[sx] init-css-tracking..."); + K.eval("(init-css-tracking)"); + console.log("[sx] process-page-scripts..."); + K.eval("(process-page-scripts)"); + console.log("[sx] routes after pages:", K.eval("(len _page-routes)")); + console.log("[sx] process-sx-scripts..."); + K.eval("(process-sx-scripts nil)"); + console.log("[sx] sx-hydrate-elements..."); + K.eval("(sx-hydrate-elements nil)"); + console.log("[sx] sx-hydrate-islands..."); + K.eval("(sx-hydrate-islands nil)"); + console.log("[sx] process-elements..."); + K.eval("(process-elements nil)"); + // Debug islands + console.log("[sx] ~home/stepper defined?", K.eval("(type-of ~home/stepper)")); + console.log("[sx] ~layouts/header defined?", K.eval("(type-of ~layouts/header)")); + // Island count (JS-side, avoids VM overhead) + console.log("[sx] manual island query:", document.querySelectorAll("[data-sx-island]").length); + // Try hydrating again + console.log("[sx] retry hydrate-islands..."); + K.eval("(sx-hydrate-islands nil)"); + // Check if links are boosted + var links = document.querySelectorAll("a[href]"); + var boosted = 0; + for (var i = 0; i < links.length; i++) { + if (links[i]._sxBoundboost) boosted++; + } + console.log("[sx] boosted links:", boosted, "/", links.length); + // Check island state + var islands = document.querySelectorAll("[data-sx-island]"); + console.log("[sx] islands:", islands.length); + for (var j = 0; j < islands.length; j++) { + console.log("[sx] island:", islands[j].getAttribute("data-sx-island"), + "hydrated:", !!islands[j]._sxBoundislandhydrated || !!islands[j]["_sxBound" + "island-hydrated"], + "children:", islands[j].children.length); + } + // Activate _hyperscript compat on elements with _ attribute + if (document.querySelector('[_]')) { + if (K.beginModuleLoad) K.beginModuleLoad(); + loadLibrary("hyperscript integration", {}); + if (K.endModuleLoad) K.endModuleLoad(); + K.eval("(hs-boot!)"); + } + // Register popstate handler for back/forward navigation + window.addEventListener("popstate", function(e) { + var state = e.state; + var scrollY = (state && state.scrollY) ? state.scrollY : 0; + K.eval("(handle-popstate " + scrollY + ")"); + }); + // Signal boot complete + document.documentElement.setAttribute("data-sx-ready", "true"); + console.log("[sx] boot done"); + } + } + }; + + // ================================================================ + // Auto-init: load web stack and boot on DOMContentLoaded + // ================================================================ + + if (typeof document !== "undefined") { + var _doInit = function() { + loadWebStack(); + Sx.init(); + // Enable JIT after all boot code has run. + // Lazy-load the compiler first — JIT needs it to compile functions. + setTimeout(function() { + if (K.beginModuleLoad) K.beginModuleLoad(); + loadLibrary("sx compiler", {}); + if (K.endModuleLoad) K.endModuleLoad(); + K.eval('(enable-jit!)'); + }, 0); + }; + + if (document.readyState === "loading") { + document.addEventListener("DOMContentLoaded", _doInit); + } else { + _doInit(); + } + } + + } // end boot + + // SxKernel is available synchronously (js_of_ocaml) or after async + // WASM init. Poll briefly to handle both cases. + var K = globalThis.SxKernel; + if (K) { boot(K); return; } + var tries = 0; + var poll = setInterval(function() { + K = globalThis.SxKernel; + if (K) { clearInterval(poll); boot(K); } + else if (++tries > 100) { clearInterval(poll); console.error("[sx-platform] SxKernel not found after 5s"); } + }, 50); +})(); diff --git a/hosts/ocaml/shared/static/wasm/sx_browser.bc.js b/hosts/ocaml/shared/static/wasm/sx_browser.bc.js new file mode 100644 index 00000000..d47fb96c --- /dev/null +++ b/hosts/ocaml/shared/static/wasm/sx_browser.bc.js @@ -0,0 +1,60695 @@ +// 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(),d4="caml_unix_stat_64",d3="unix_lseek",l="caml_unix_inchannel_of_filedescr",d1="caml_unix_stat",d0="caml_unix_write_bigarray",fG="caml_nativeint_format",bg="caml_int64_of_nativeint",dZ="caml_unix_closedir",bf="caml_unix_getgrnam",cz="caml_unix_truncate",cy="caml_unix_getcwd",fC="caml_unix_readlink",fD="caml_floatarray_set",bd="caml_fill_bytes",bc="unix_error_message",cw="win_inchannel_of_filedescr",bb="caml_unix_time",ct="caml_unix_write",dW="unix_lstat",fy="unix_open",dU="unix_rename",fx="caml_unix_chmod",a9="unix_access",a7="caml_unix_lseek",a8="unix_fsync",dT="caml_unix_findnext",a5="caml_weak_get_copy",h="caml_array_set",dS="caml_unix_opendir",fv="caml_unix_lookup_file",a4="caml_unix_getegid",fu="caml_unix_getgid",cp="caml_js_from_nativeint",a0="caml_unix_gmtime",a1="caml_signbit_float",fs="caml_unix_close",fr="caml_js_from_int32",fq="caml_int64_to_int",ck="caml_check_bound_gen",p="caml_format_int",dM="unix_link",cg="unix_mkdir",aX="unix_rewinddir",aY="unix_read",dI="caml_unix_unlink",aU="unix_getgid",dG="caml_unix_error_message",fm="caml_unix_findclose",aP="caml_unix_lseek_64",fk="caml_array_get_float",cc="win_outchannel_of_filedescr",dD="caml_unix_fstat",ca="caml_unix_geteuid",dB="unix_lstat_64",aN="unix_inchannel_of_filedescr",b7="unix_getpwnam",b8="unix_geteuid",aM="caml_unix_getuid",dA="caml_unix_utimes",fe="caml_unix_getpwuid",ff="unix_getpwuid",o="caml_check_bound",fd="unix_ftruncate_64",aJ="unix_isatty",b5="caml_unix_times",dy="caml_unix_exit",fc="unix_exit",aG="caml_unix_single_write",b4="caml_ephe_blit_key",dw="caml_nativeint_of_string",aF="unix_write",du="caml_unix_ftruncate_64",dv="unix_close",e$="caml_js_to_int32",k="caml_sys_getcwd",dt="caml_unix_readdir",b1="win_findclose",az="%int_mul",dr="caml_int32_format",e6="caml_weak_blit",dp="caml_unix_localtime",dq="unix_times",e5="caml_array_set_addr",dn="caml_unix_inet_addr_of_string",e4="unix_ftruncate",dm="caml_weak_check",e3="caml_unix_symlink",aw="unix_outchannel_of_filedescr",at="caml_unix_has_symlink",dj="unix_mktime",s="caml_int64_to_int32",bX="unix_fstat",eZ="caml_unix_link",as="caml_unix_fchmod",bU="unix_symlink",ar="unix_localtime",eX="unix_chdir",aq="unix_getgrgid",ao="caml_int32_compare",an="caml_unix_mkdir",eU="win_startup",eT="caml_int32_bswap",am="caml_weak_get",eR="unix_readlink",ak="caml_unix_rmdir",e="caml_array_get",aj="caml_unix_lstat_64",ai="unix_inet_addr_of_string",bN="caml_unix_gettimeofday",r="caml_unix_outchannel_of_filedescr",bK="unix_stat",dd="caml_unix_chdir",ag="unix_closedir",ah="win_cleanup",bJ="caml_nativeint_bswap",ad="caml_unix_mktime",ae="caml_ephe_get_key",af="%int_mod",bI="unix_stat_64",c$="unix_getegid",da="caml_unix_access",c9="caml_unix_isatty",ac="caml_int32_mul",c8="caml_nativeint_compare",q="caml_int64_of_int32",aa="caml_unix_fsync",eM="win_findnext",Y="caml_nativeint_mul",eL="unix_single_write",X="caml_int32_mod",n="caml_js_from_float",c4="unix_truncate_64",c3="caml_ephe_check_key",eJ="unix_opendir",bH="caml_array_set_float",eH="caml_ephe_get_key_copy",T="unix_getuid",d="caml_mul",S="caml_fill_string",g="caml_div",cY="caml_int64_of_int",eE="caml_unix_read_bigarray",R="unix_getgrnam",eC="win_findfirst",eB="caml_unix_startup",bE="caml_unix_filedescr_of_fd",eA="caml_unix_ftruncate",f="caml_mod",cX="caml_check_bound_float",bC="unix_utimes",bD="caml_unix_getgrgid",ey="caml_int64_to_nativeint",bB="unix_time",ex="unix_fstat_64",N="caml_unix_fstat_64",cU="unix_truncate",bz="unix_gmtime",by="caml_unix_cleanup",eu="unix_getcwd",et="unix_readdir",j="caml_sys_exit",J="caml_channel_descriptor",bu="unix_lseek_64",t="caml_int_compare",I="caml_array_get_addr",el="unix_chmod",em="caml_unix_lstat",ek="caml_js_to_nativeint",H="caml_int32_div",cN="caml_unix_findfirst",G="caml_unix_truncate_64",F="caml_unix_rewinddir",E="unix_has_symlink",m="caml_int_of_string",eh="caml_unix_rename",bs="win_filedescr_of_channel",D="unix_gettimeofday",eg="win_handle_fd",b="caml_unix_getpwnam",cI="caml_int32_of_string",ee="caml_nativeint_mod",x="unix_rmdir",cF="caml_unix_read",cG="unix_read_bigarray",d9="caml_floatarray_get",w="unix_unlink",bm="caml_unix_open",d7="caml_signbit",v="unix_fchmod",bk="caml_nativeint_div",d6="%int_div";c.aliases=i.caml_list_of_js_array([[0,ck,o],[0,fq,s],[0,d6,g],[0,fr,n],[0,eC,cN],[0,bk,g],[0,v,as],[0,R,b],[0,aw,r],[0,cY,q],[0,cp,n],[0,d7,a1],[0,dm,c3],[0,S,bd],[0,w,dI],[0,e4,eA],[0,d9,e],[0,e5,h],[0,T,aM],[0,cG,eE],[0,x,ak],[0,dq,b5],[0,e6,b4],[0,dr,p],[0,fv,d0],[0,bH,h],[0,az,d],[0,eJ,dS],[0,b1,fm],[0,cI,m],[0,ee,f],[0,c4,G],[0,X,f],[0,a5,eH],[0,Y,d],[0,eL,aG],[0,dv,fs],[0,a8,aa],[0,aF,ct],[0,dw,m],[0,a9,da],[0,eg,bE],[0,eM,dT],[0,D,bN],[0,bs,J],[0,fc,j],[0,c8,t],[0,ac,d],[0,dy,j],[0,E,at],[0,dU,eh],[0,aJ,c9],[0,fd,du],[0,c$,a4],[0,dW,em],[0,fy,bm],[0,H,g],[0,ff,b],[0,fe,b],[0,bI,d4],[0,ek,e$],[0,af,f],[0,bJ,eT],[0,b8,ca],[0,b7,b],[0,ah,by],[0,ag,dZ],[0,cw,l],[0,el,fx],[0,bK,d1],[0,I,e],[0,aN,l],[0,ai,dn],[0,dB,aj],[0,fD,h],[0,cy,k],[0,cc,r],[0,fk,e],[0,eR,fC],[0,am,ae],[0,bf,b],[0,bu,aP],[0,eU,eB],[0,et,dt],[0,aU,fu],[0,dG,bc],[0,ao,t],[0,eu,k],[0,bz,a0],[0,bg,q],[0,aq,b],[0,cU,cz],[0,eX,dd],[0,ar,dp],[0,fG,p],[0,ex,N],[0,bU,e3],[0,bB,bb],[0,ey,s],[0,aY,cF],[0,aX,F],[0,cg,an],[0,bD,b],[0,dM,eZ],[0,bC,dA],[0,cX,o],[0,bX,dD],[0,d3,a7],[0,dj,ad]]);c.prim_count=952;var +d2=133,bi=102,bh="Re__Hash_set",cA="Stdlib__Type",cB=114,fF="Stdlib__Buffer",dX="Js_of_ocaml__Dom_svg",dY="Stdlib__Out_channel",fE="Match_failure",be="Stdlib__Gc",fA="Re__Compile",fB="Stdlib__Unit",cx="Re__Posix_class",fz=136,cv="Jsoo_runtime__Runtime_version",cu="Stdlib__Map",ba="Sx_vm",dV="Stdlib__Parsing",a$="Stdlib__Effect",cs=108,a_="Stdlib__String",fw="Re_pcre",a6="Stdlib__BytesLabels",dR="Stdlib__Condition",cr=148,dQ="Stdlib__Filename",a3="Stdlib__In_channel",dO="Not_found",dP="Re__Fmt",cq=154,a2="CamlinternalLazy",ft="Sx_vm_ref",co="Division_by_zero",cn="Js_of_ocaml__Effect_js",cm="Re__Glob",dN="Re__Parse_buffer",aZ=117,cl=104,fp="Js_of_ocaml__",cj="Stdlib__Either",ci=109,ch="Js_of_ocaml__MutationObserver",cf="Js_of_ocaml__Json",dL="Stdlib__Callback",dK=155,aW="Stdlib__Lexing",ce="Undefined_recursive_module",dJ="Stdlib__Printf",fo=111,aV="Stdlib__Bool",dH="Stdlib__Int",fn=153,dF="Stdlib__MoreLabels",aR=127,aS=103,aT="Sx_render",dE="Sys_error",aQ=100,cd="Js_of_ocaml__Dom_events",fl="Stdlib__Digest",dC=101,cb=151,aO="Sx_compiler",b$="Js_of_ocaml__PerformanceObserver",fj="Re__View",b_="Stdlib__Queue",fi=110,b9="Stdlib__Set",fh="Stdlib__Stack",fg="Js_of_ocaml__File",dz="Stdlib__Complex",aL="Re__Dyn",aK="Jsoo_runtime__",b6="Re__Import",dx="Jsoo_runtime",fb=130,aH="Js_of_ocaml__WebSockets",aI="Stdlib__Nativeint",fa=128,aE=113,b3=146,b2="Re__Dense_map",ds="Sys_blocked_io",aD="Stdlib__Random",e_="Js_of_ocaml__ResizeObserver",e9="Sx_runtime",aC=135,b0=144,e8="Js_of_ocaml",aA=106,aB="Stdlib__Marshal",ay="Js_of_ocaml__Console",e7=140,bZ="Sx_primitives",bY="Stdlib__Ephemeron",ax="CamlinternalMod",dl="Re__Color_map",av="Js_of_ocaml__Js",au="Js_of_ocaml__Url",e2="Stdlib__Fun",e1="Stdlib__Char",dk=125,e0="Re__Category",bV=138,bW=116,eY=126,ap="Re__Ast",di="Dune__exe__Sx_browser",dh=150,eW="CamlinternalFormatBasics",dg="Stdlib__Weak",bT=105,df="Stdlib__Format",eV="Stdlib__StdLabels",de="Stdlib__Int64",eS="Re__Search",bS="Js_of_ocaml__Dom_html",al="Stdlib__ArrayLabels",bR=129,eQ="Re__Cset",bQ="Stdlib__Bigarray",bO=137,bP="Re__Core",bL=132,bM="Re__Emacs",dc="Re__Automata",db="Re__Pmark",c_="Js_of_ocaml__IntersectionObserver",ab=115,c7=131,eN=122,eO="Stdlib",eP="Stdlib__StringLabels",$="Stdlib__Atomic",_="Sx_cst",c6="Re__",Z="Stdlib__ListLabels",c5="Stdlib__Seq",eK="Js_of_ocaml__CSS",W=134,c2="Js_of_ocaml__XmlHttpRequest",eI="Re__Bit_vector",V="Stdlib__Uchar",U=152,c1="Stdlib__Arg",c0="Js_of_ocaml__Form",cZ="Stdlib__Scanf",eG=112,eF="Re__Slice",eD="Js_of_ocaml__Intl",bG=107,bF="Stdlib__Printexc",Q="Js_of_ocaml__Sys_js",ez="Js_of_ocaml__Import",P="Re",cV=147,cW="Js_of_ocaml__Geolocation",ew="Re__Perl",O="Js_of_ocaml__Worker",bA="Stdlib__Dynarray",ev="Assert_failure",M="Re__Pcre",L=141,bw=121,bx=118,bv=120,cT="Stdlib__Array",K="Js_of_ocaml__EventSource",cS="Stdlib__Obj",es="Stdlib__Hashtbl",eq="Stdlib__Domain",er="Stdlib__Option",ep=124,eo="Std_exit",en=149,cR="Re__Group",cQ="Sx_ref",bt=145,cO="Invalid_argument",cP="Stack_overflow",cM="End_of_file",cL="Js_of_ocaml__WebGL",ej="Sx_types",ei="Failure",C="Js_of_ocaml__Jstable",ef="Stdlib__Lazy",br="Stdlib__Semaphore",cK="Out_of_memory",B="Js_of_ocaml__Lib_version",A="Js_of_ocaml__Regexp",cJ="Js_of_ocaml__Dom",z="Stdlib__Bytes",bq="Stdlib__Sys",ed=143,ec="CamlinternalOO",bp="Re__Posix",cH="Stdlib__Int32",eb="Stdlib__Oo",bo=123,y="Re__Replace",d_="Re__Mark_infos",d$="Stdlib__Mutex",ea=119,bn="Stdlib__List",cE=139,bl="Sx_parser",d8="Stdlib__Float",bj=142,cD="CamlinternalFormat",u="Re__Str",d5="Js_of_ocaml__Typed_array",cC="Stdlib__Result";c.symbols=[0,[0,ce,11],[0,dE,10],[0,ds,9],[0,ft,aZ],[0,ba,bW],[0,ej,fi],[0,e9,cB],[0,aT,bx],[0,cQ,ab],[0,bZ,aE],[0,bl,eG],[0,_,fo],[0,aO,ea],[0,dg,62],[0,fB,31],[0,V,26],[0,cA,17],[0,bq,15],[0,eP,75],[0,a_,30],[0,eV,77],[0,fh,42],[0,b9,40],[0,c5,21],[0,br,47],[0,cZ,64],[0,cC,23],[0,aD,60],[0,b_,43],[0,dJ,50],[0,bF,53],[0,dV,39],[0,dY,57],[0,er,22],[0,eb,67],[0,cS,16],[0,aI,37],[0,d$,45],[0,dF,76],[0,aB,32],[0,cu,41],[0,Z,73],[0,bn,27],[0,aW,38],[0,ef,20],[0,de,36],[0,cH,35],[0,dH,28],[0,a3,56],[0,es,61],[0,be,55],[0,e2,54],[0,df,63],[0,d8,34],[0,dQ,70],[0,bY,69],[0,cj,14],[0,a$,78],[0,bA,51],[0,eq,48],[0,fl,58],[0,dR,46],[0,dz,71],[0,e1,25],[0,dL,65],[0,a6,74],[0,z,29],[0,fF,44],[0,aV,24],[0,bQ,59],[0,$,18],[0,al,72],[0,cT,33],[0,c1,52],[0,eO,13],[0,eo,dK],[0,cP,8],[0,fw,ci],[0,fj,93],[0,u,dC],[0,eF,95],[0,eS,97],[0,y,bi],[0,cx,cl],[0,bp,bG],[0,db,89],[0,ew,bT],[0,M,aA],[0,dN,99],[0,d_,88],[0,b6,85],[0,bh,87],[0,cR,94],[0,cm,aS],[0,dP,80],[0,bM,aQ],[0,aL,82],[0,b2,84],[0,eQ,86],[0,bP,98],[0,fA,96],[0,dl,91],[0,e0,83],[0,eI,81],[0,dc,90],[0,ap,92],[0,c6,79],[0,P,cs],[0,cK,7],[0,dO,6],[0,fE,5],[0,cv,bw],[0,aK,bv],[0,dx,eN],[0,c2,c7],[0,O,bL],[0,aH,d2],[0,cL,W],[0,au,fz],[0,d5,aR],[0,Q,bV],[0,e_,cE],[0,A,aC],[0,b$,e7],[0,ch,L],[0,B,bO],[0,C,bj],[0,cf,ed],[0,av,dk],[0,eD,U],[0,c_,cb],[0,ez,ep],[0,cW,dh],[0,c0,fb],[0,fg,fa],[0,K,en],[0,cn,cr],[0,dX,cV],[0,bS,bR],[0,cd,b3],[0,cJ,eY],[0,ay,bt],[0,eK,b0],[0,fp,bo],[0,e8,fn],[0,cO,4],[0,ei,3],[0,cM,2],[0,di,cq],[0,co,1],[0,ec,66],[0,ax,68],[0,a2,19],[0,eW,12],[0,cD,49],[0,ev,0]];c.sections=[0,[0,156,[0,[0,[0,[0,[0,[0,[0,0,[0,ev],0,[0,0,[0,cD],49,0,1],2],[0,eW],12,0,3],[0,a2],19,[0,[0,[0,0,[0,ax],68,0,1],[0,ec],66,0,2],[0,co],1,[0,[0,0,[0,di],cq,0,1],[0,cM],2,0,2],3],4],[0,ei],3,[0,[0,[0,0,[0,cO],4,[0,0,[0,e8],fn,0,1],2],[0,fp],bo,[0,0,[0,eK],b0,[0,0,[0,ay],bt,0,1],2],3],[0,cJ],eY,[0,[0,[0,0,[0,cd],b3,0,1],[0,bS],bR,0,2],[0,dX],cV,[0,[0,0,[0,cn],cr,[0,0,[0,K],en,0,1],2],[0,fg],fa,[0,0,[0,c0],fb,[0,0,[0,cW],dh,0,1],2],3],4],5],6],[0,ez],ep,[0,[0,[0,[0,[0,[0,0,[0,c_],cb,[0,0,[0,eD],U,0,1],2],[0,av],dk,[0,[0,0,[0,cf],ed,0,1],[0,C],bj,0,2],3],[0,B],bO,[0,[0,0,[0,ch],L,0,1],[0,b$],e7,0,2],4],[0,A],aC,[0,[0,0,[0,e_],cE,0,1],[0,Q],bV,0,2],5],[0,d5],aR,[0,[0,[0,[0,0,[0,au],fz,0,1],[0,cL],W,0,2],[0,aH],d2,0,3],[0,O],bL,[0,0,[0,c2],c7,0,1],4],6],[0,dx],eN,[0,[0,[0,0,[0,aK],bv,[0,0,[0,cv],bw,0,1],2],[0,fE],5,[0,0,[0,dO],6,0,1],3],[0,cK],7,[0,[0,0,[0,P],cs,0,1],[0,c6],79,[0,[0,0,[0,ap],92,0,1],[0,dc],90,0,2],3],4],7],8],[0,eI],81,[0,[0,[0,[0,[0,0,[0,e0],83,0,1],[0,dl],91,[0,0,[0,fA],96,[0,0,[0,bP],98,0,1],2],3],[0,eQ],86,[0,0,[0,b2],84,0,1],4],[0,aL],82,[0,[0,[0,0,[0,bM],aQ,0,1],[0,dP],80,[0,[0,[0,0,[0,cm],aS,0,1],[0,cR],94,0,2],[0,bh],87,0,3],4],[0,b6],85,[0,[0,[0,0,[0,d_],88,0,1],[0,dN],99,[0,[0,0,[0,M],aA,0,1],[0,ew],bT,0,2],3],[0,db],89,[0,[0,[0,[0,0,[0,bp],bG,0,1],[0,cx],cl,0,2],[0,y],bi,[0,0,[0,eS],97,0,1],3],[0,eF],95,[0,[0,0,[0,u],dC,0,1],[0,fj],93,[0,[0,0,[0,fw],ci,0,1],[0,cP],8,[0,0,[0,eo],dK,0,1],2],3],4],5],6],7],[0,eO],13,[0,[0,[0,[0,0,[0,c1],52,0,1],[0,cT],33,[0,0,[0,al],72,0,1],2],[0,$],18,[0,0,[0,bQ],59,0,1],3],[0,aV],24,[0,[0,[0,0,[0,fF],44,0,1],[0,z],29,[0,[0,0,[0,a6],74,0,1],[0,dL],65,0,2],3],[0,e1],25,[0,[0,0,[0,dz],71,0,1],[0,dR],46,[0,[0,0,[0,fl],58,0,1],[0,eq],48,[0,0,[0,bA],51,[0,0,[0,a$],78,0,1],2],3],4],5],6],8],9],[0,cj],14,[0,[0,[0,[0,[0,[0,0,[0,bY],69,[0,0,[0,dQ],70,0,1],2],[0,d8],34,[0,0,[0,df],63,0,1],3],[0,e2],54,[0,0,[0,be],55,[0,[0,0,[0,es],61,0,1],[0,a3],56,0,2],3],4],[0,dH],28,[0,0,[0,cH],35,[0,0,[0,de],36,0,1],2],5],[0,ef],20,[0,[0,[0,0,[0,aW],38,0,1],[0,bn],27,[0,[0,0,[0,Z],73,0,1],[0,cu],41,0,2],3],[0,aB],32,[0,[0,[0,0,[0,dF],76,0,1],[0,d$],45,0,2],[0,aI],37,0,3],4],6],[0,cS],16,[0,[0,[0,[0,[0,[0,0,[0,eb],67,0,1],[0,er],22,[0,0,[0,dY],57,0,1],2],[0,dV],39,[0,[0,0,[0,bF],53,0,1],[0,dJ],50,0,2],3],[0,b_],43,[0,[0,0,[0,aD],60,0,1],[0,cC],23,[0,[0,0,[0,cZ],64,0,1],[0,br],47,0,2],3],4],[0,c5],21,[0,[0,0,[0,b9],40,[0,0,[0,fh],42,[0,0,[0,eV],77,0,1],2],3],[0,a_],30,[0,0,[0,eP],75,0,1],4],5],[0,bq],15,[0,[0,[0,[0,0,[0,cA],17,0,1],[0,V],26,[0,0,[0,fB],31,0,1],2],[0,dg],62,[0,[0,0,[0,aO],ea,0,1],[0,_],fo,0,2],3],[0,bl],eG,[0,[0,[0,0,[0,bZ],aE,[0,0,[0,cQ],ab,[0,0,[0,aT],bx,0,1],2],3],[0,e9],cB,[0,0,[0,ej],fi,[0,0,[0,ba],bW,[0,0,[0,ft],aZ,0,1],2],3],4],[0,ds],9,[0,0,[0,dE],10,[0,0,[0,ce],11,0,1],2],5],6],7],8],10]],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",d6,"%int_lsl","%int_lsr",af,az,"%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,I,fk,"caml_array_make","caml_array_of_bytes","caml_array_of_string",h,e5,bH,"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",J,o,cX,ck,"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",b4,"caml_ephe_check_data",c3,"caml_ephe_create","caml_ephe_data_offset","caml_ephe_get_data","caml_ephe_get_data_copy",ae,eH,"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",bd,S,"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",d9,fD,"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",eT,ao,H,"caml_int32_float_of_bits",dr,X,ac,"caml_int32_neg","caml_int32_of_float","caml_int32_of_int",cI,"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",cY,q,bg,"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",fq,s,ey,"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,fr,cp,"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",e$,ek,"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",bJ,c8,bk,fG,ee,Y,"caml_nativeint_neg","caml_nativeint_of_float","caml_nativeint_of_int","caml_nativeint_of_int32",dw,"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",d7,a1,"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",da,dd,fx,by,fs,dZ,dG,dy,as,bE,fm,cN,dT,dD,N,aa,eA,du,cy,a4,ca,fu,bD,bf,b,fe,bN,aM,a0,at,l,dn,c9,eZ,dp,fv,a7,aP,em,aj,an,ad,bm,dS,r,cF,eE,dt,fC,eh,F,ak,aG,eB,d1,d4,e3,bb,b5,cz,G,dI,dA,ct,d0,"caml_unmount","caml_unpackFloat16","caml_update_dummy",e6,dm,"caml_weak_create",am,a5,"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",a9,eX,el,dv,ag,"unix_error",bc,fc,v,bX,ex,a8,e4,fd,eu,c$,b8,aU,aq,R,b7,ff,D,T,bz,E,aN,ai,aJ,dM,ar,d3,bu,dW,dB,cg,dj,fy,eJ,aw,aY,cG,et,eR,dU,aX,x,eL,bK,bI,bU,bB,dq,cU,c4,w,bC,aF,ah,bs,b1,eC,eM,eg,cw,cc,eU,"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)); + +//# 7778 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Set:[F(1)*] +(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]); + } + var + global_data = runtime.caml_get_global_data(), + Stdlib = global_data.Stdlib, + Stdlib_Seq = global_data.Stdlib__Seq, + Stdlib_List = global_data.Stdlib__List, + Assert_failure = global_data.Assert_failure, + a = [0, 0, 0, 0], + b = [0, 0, 0], + c = [0, "set.ml", 571, 18], + Stdlib_Set = + [0, + function(Ord){ + function height(param){ + if(! param) return 0; + var h = param[4]; + return h; + } + function create(l, v, r){ + if(l) var h = l[4], hl = h; else var hl = 0; + if(r) var h$0 = r[4], hr = h$0; else var hr = 0; + var a = hr <= hl ? hl + 1 | 0 : hr + 1 | 0; + return [0, l, v, r, a]; + } + function bal(l, v, r){ + if(l) var h = l[4], hl = h; else var hl = 0; + if(r) var h$0 = r[4], hr = h$0; else var hr = 0; + var cst_Set_bal = "Set.bal"; + if((hr + 2 | 0) < hl){ + if(! l) return Stdlib[1].call(null, cst_Set_bal); + var lr = l[3], lv = l[2], ll = l[1], a = height(lr); + if(a <= height(ll)) return create(ll, lv, create(lr, v, r)); + if(! lr) return Stdlib[1].call(null, cst_Set_bal); + var lrr = lr[3], lrv = lr[2], lrl = lr[1], b = create(lrr, v, r); + return create(create(ll, lv, lrl), lrv, b); + } + if((hl + 2 | 0) >= hr){ + var e = hr <= hl ? hl + 1 | 0 : hr + 1 | 0; + return [0, l, v, r, e]; + } + if(! r) return Stdlib[1].call(null, cst_Set_bal); + var rr = r[3], rv = r[2], rl = r[1], c = height(rl); + if(c <= height(rr)) return create(create(l, v, rl), rv, rr); + if(! rl) return Stdlib[1].call(null, cst_Set_bal); + var rlr = rl[3], rlv = rl[2], rll = rl[1], d = create(rlr, rv, rr); + return create(create(l, v, rll), rlv, d); + } + function add(x, t){ + if(! t) return [0, 0, x, 0, 1]; + var r = t[3], v = t[2], l = t[1], c = caml_call2(Ord[1], x, v); + if(0 === c) return t; + if(0 <= c){var rr = add(x, r); return r === rr ? t : bal(l, v, rr);} + var ll = add(x, l); + return l === ll ? t : bal(ll, v, r); + } + function singleton(x){return [0, 0, x, 0, 1];} + function add_min_element(x, param){ + if(! param) return singleton(x); + var r = param[3], v = param[2], l = param[1]; + return bal(add_min_element(x, l), v, r); + } + function add_max_element(x, param){ + if(! param) return singleton(x); + var r = param[3], v = param[2], l = param[1]; + return bal(l, v, add_max_element(x, r)); + } + function join(l, v, r){ + if(! l) return add_min_element(v, r); + if(! r) return add_max_element(v, l); + var + rh = r[4], + rr = r[3], + rv = r[2], + rl = r[1], + lh = l[4], + lr = l[3], + lv = l[2], + ll = l[1]; + return (rh + 2 | 0) < lh + ? bal(ll, lv, join(lr, v, r)) + : (lh + + 2 + | 0) + < rh + ? bal(join(l, v, rl), rv, rr) + : create(l, v, r); + } + function min_elt(param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var l = param[1]; + if(! l){var v = param[2]; return v;} + param = l; + } + } + function min_elt_opt(param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var l = param[1]; + if(! l){var v = param[2]; return [0, v];} + param = l; + } + } + function max_elt(param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + if(! param[3]){var v = param[2]; return v;} + var r = param[3]; + param = r; + } + } + function max_elt_opt(param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + if(! param[3]){var v = param[2]; return [0, v];} + var r = param[3]; + param = r; + } + } + function remove_min_elt(param){ + if(! param) return Stdlib[1].call(null, "Set.remove_min_elt"); + var l = param[1]; + if(l){ + var r = param[3], v = param[2]; + return bal(remove_min_elt(l), v, r); + } + var r$0 = param[3]; + return r$0; + } + function concat(t1, t2){ + if(! t1) return t2; + if(! t2) return t1; + var a = remove_min_elt(t2); + return join(t1, min_elt(t2), a); + } + function split(x, param){ + if(! param) return a; + var + r = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return [0, l, 1, r]; + if(0 <= c){ + var + match = split(x, r), + rr = match[3], + pres = match[2], + lr = match[1]; + return [0, join(l, v, lr), pres, rr]; + } + var + match$0 = split(x, l), + rl = match$0[3], + pres$0 = match$0[2], + ll = match$0[1]; + return [0, ll, pres$0, join(rl, v, r)]; + } + function is_empty(param){return param ? 0 : 1;} + function mem(x, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var + r = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v), + a = 0 === c ? 1 : 0; + if(a) return a; + param = 0 <= c ? r : l; + } + } + function remove(x, t){ + if(! t) return 0; + var t2 = t[3], v = t[2], t1 = t[1], c = caml_call2(Ord[1], x, v); + if(0 === c){ + if(! t1) return t2; + if(! t2) return t1; + var a = remove_min_elt(t2); + return bal(t1, min_elt(t2), a); + } + if(0 <= c){ + var rr = remove(x, t2); + return t2 === rr ? t : bal(t1, v, rr); + } + var ll = remove(x, t1); + return t1 === ll ? t : bal(ll, v, t2); + } + function union(s1, s2){ + if(! s1) return s2; + if(! s2) return s1; + var + h2 = s2[4], + r2 = s2[3], + v2 = s2[2], + l2 = s2[1], + h1 = s1[4], + r1 = s1[3], + v1 = s1[2], + l1 = s1[1]; + if(h2 <= h1){ + if(1 === h2) return add(v2, s1); + var + match = split(v1, s2), + r2$0 = match[3], + l2$0 = match[1], + a = union(r1, r2$0); + return join(union(l1, l2$0), v1, a); + } + if(1 === h1) return add(v1, s2); + var + match$0 = split(v2, s1), + r1$0 = match$0[3], + l1$0 = match$0[1], + b = union(r1$0, r2); + return join(union(l1$0, l2), v2, b); + } + function inter(s1, s2){ + if(! s1) return 0; + if(! s2) return 0; + var r1 = s1[3], v1 = s1[2], l1 = s1[1], a = split(v1, s2), l2 = a[1]; + if(a[2]){ + var r2 = a[3], b = inter(r1, r2); + return join(inter(l1, l2), v1, b); + } + var r2$0 = a[3], c = inter(r1, r2$0); + return concat(inter(l1, l2), c); + } + function split_bis(x, param){ + if(! param) return [0, 0, function(param){return 0;}]; + var + r = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return 0; + if(0 <= c){ + var match = split_bis(x, r); + if(! match) return 0; + var rr = match[2], lr = match[1]; + return [0, join(l, v, lr), rr]; + } + var match$0 = split_bis(x, l); + if(! match$0) return 0; + var rl = match$0[2], ll = match$0[1]; + return [0, ll, function(param){return join(rl(0), v, r);}]; + } + function disjoint(s1$0, s2$1){ + var s1 = s1$0, s2 = s2$1; + for(;;){ + if(s1 && s2){ + var r1 = s1[3], v1 = s1[2], l1 = s1[1]; + if(s1 === s2) return 0; + var match = split_bis(v1, s2); + if(! match) return 0; + var r2 = match[2], l2 = match[1], a = disjoint(l1, l2); + if(! a) return a; + var s2$0 = r2(0); + s1 = r1; + s2 = s2$0; + continue; + } + return 1; + } + } + function diff(s1, s2){ + if(! s1) return 0; + if(! s2) return s1; + var r1 = s1[3], v1 = s1[2], l1 = s1[1], a = split(v1, s2), l2 = a[1]; + if(a[2]){ + var r2 = a[3], b = diff(r1, r2); + return concat(diff(l1, l2), b); + } + var r2$0 = a[3], c = diff(r1, r2$0); + return join(diff(l1, l2), v1, c); + } + function cons_enum(s$0, e$1){ + var s = s$0, e = e$1; + for(;;){ + if(! s) return e; + var r = s[3], v = s[2], l = s[1], e$0 = [0, v, r, e]; + s = l; + e = e$0; + } + } + function compare(s1, s2){ + var + e2$2 = cons_enum(s2, 0), + e1$2 = cons_enum(s1, 0), + e1 = e1$2, + e2 = e2$2; + for(;;){ + if(! e1) return e2 ? -1 : 0; + if(! e2) return 1; + var + e2$0 = e2[3], + r2 = e2[2], + v2 = e2[1], + e1$0 = e1[3], + r1 = e1[2], + v1 = e1[1], + c = caml_call2(Ord[1], v1, v2); + if(0 !== c) return c; + var e2$1 = cons_enum(r2, e2$0), e1$1 = cons_enum(r1, e1$0); + e1 = e1$1; + e2 = e2$1; + } + } + function equal(s1, s2){return 0 === compare(s1, s2) ? 1 : 0;} + function subset(s1$0, s2$0){ + var s1 = s1$0, s2 = s2$0; + for(;;){ + if(! s1) return 1; + if(! s2) return 0; + var + r2 = s2[3], + v2 = s2[2], + l2 = s2[1], + r1 = s1[3], + v1 = s1[2], + l1 = s1[1], + c = caml_call2(Ord[1], v1, v2); + if(0 === c){ + var a = subset(l1, l2); + if(! a) return a; + s1 = r1; + s2 = r2; + } + else if(0 <= c){ + var b = subset([0, 0, v1, r1, 0], r2); + if(! b) return b; + s1 = l1; + } + else{ + var d = subset([0, l1, v1, 0, 0], l2); + if(! d) return d; + s1 = r1; + } + } + } + function iter(f, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var r = param[3], v = param[2], l = param[1]; + iter(f, l); + caml_call1(f, v); + param = r; + } + } + function fold(f, s$0, accu$1){ + var s = s$0, accu = accu$1; + for(;;){ + if(! s) return accu; + var + r = s[3], + v = s[2], + l = s[1], + accu$0 = caml_call2(f, v, fold(f, l, accu)); + s = r; + accu = accu$0; + } + } + function for_all(p, param$0){ + var param = param$0; + for(;;){ + if(! param) return 1; + var r = param[3], v = param[2], l = param[1], a = caml_call1(p, v); + if(a){ + var b = for_all(p, l); + if(b){param = r; continue;} + var c = b; + } + else + var c = a; + return c; + } + } + function exists(p, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var r = param[3], v = param[2], l = param[1], a = caml_call1(p, v); + if(a) + var b = a; + else{var c = exists(p, l); if(! c){param = r; continue;} var b = c;} + return b; + } + } + function filter(p, t){ + if(! t) return 0; + var + r = t[3], + v = t[2], + l = t[1], + l$0 = filter(p, l), + pv = caml_call1(p, v), + r$0 = filter(p, r); + if(! pv) return concat(l$0, r$0); + if(l === l$0 && r === r$0) return t; + return join(l$0, v, r$0); + } + function partition(p, param){ + if(! param) return b; + var + r = param[3], + v = param[2], + l = param[1], + match = partition(p, l), + lf = match[2], + lt = match[1], + pv = caml_call1(p, v), + match$0 = partition(p, r), + rf = match$0[2], + rt = match$0[1]; + if(pv){var a = concat(lf, rf); return [0, join(lt, v, rt), a];} + var c = join(lf, v, rf); + return [0, concat(lt, rt), c]; + } + function cardinal(param){ + if(! param) return 0; + var r = param[3], l = param[1], a = cardinal(r); + return (cardinal(l) + 1 | 0) + a | 0; + } + function elements_aux(accu$1, param$0){ + var accu = accu$1, param = param$0; + for(;;){ + if(! param) return accu; + var + r = param[3], + v = param[2], + l = param[1], + accu$0 = [0, v, elements_aux(accu, r)]; + accu = accu$0; + param = l; + } + } + function elements(s){return elements_aux(0, s);} + function find(x, param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var + r = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return v; + param = 0 <= c ? r : l; + } + } + function find_first(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var r$0 = param$0[3], v0$1 = param$0[2], l$0 = param$0[1]; + if(caml_call1(f, v0$1)){var v0 = v0$1, param = l$0; break;} + param$0 = r$0; + } + for(;;){ + if(! param) return v0; + var r = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){v0 = v0$0; param = l;} else param = r; + } + } + function find_first_opt(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) return 0; + var r$0 = param$0[3], v0$1 = param$0[2], l$0 = param$0[1]; + if(caml_call1(f, v0$1)){var v0 = v0$1, param = l$0; break;} + param$0 = r$0; + } + for(;;){ + if(! param) return [0, v0]; + var r = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){v0 = v0$0; param = l;} else param = r; + } + } + function find_last(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var r$0 = param$0[3], v0$1 = param$0[2], l$0 = param$0[1]; + if(caml_call1(f, v0$1)){var v0 = v0$1, param = r$0; break;} + param$0 = l$0; + } + for(;;){ + if(! param) return v0; + var r = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){v0 = v0$0; param = r;} else param = l; + } + } + function find_last_opt(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) return 0; + var r$0 = param$0[3], v0$1 = param$0[2], l$0 = param$0[1]; + if(caml_call1(f, v0$1)){var v0 = v0$1, param = r$0; break;} + param$0 = l$0; + } + for(;;){ + if(! param) return [0, v0]; + var r = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){v0 = v0$0; param = r;} else param = l; + } + } + function find_opt(x, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var + r = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return [0, v]; + param = 0 <= c ? r : l; + } + } + function try_join(l, v, r){ + a: + { + if(0 !== l){ + var b = max_elt(l); + if(0 <= caml_call2(Ord[1], b, v)) break a; + } + if(0 !== r){ + var a = min_elt(r); + if(0 <= caml_call2(Ord[1], v, a)) break a; + } + return join(l, v, r); + } + return union(l, add(v, r)); + } + function map(f, t){ + if(! t) return 0; + var + r = t[3], + v = t[2], + l = t[1], + l$0 = map(f, l), + v$0 = caml_call1(f, v), + r$0 = map(f, r); + if(l === l$0 && v === v$0 && r === r$0) return t; + return try_join(l$0, v$0, r$0); + } + function filter_map(f, t){ + if(! t) return 0; + var + r = t[3], + v = t[2], + l = t[1], + t1 = filter_map(f, l), + v$0 = caml_call1(f, v), + t2 = filter_map(f, r); + if(v$0){ + var v$1 = v$0[1]; + if(l === t1 && v === v$1 && r === t2) return t; + return try_join(t1, v$1, t2); + } + if(! t1) return t2; + if(! t2) return t1; + var a = remove_min_elt(t2); + return try_join(t1, min_elt(t2), a); + } + var empty = 0; + function of_list(l){ + if(! l) return empty; + var match = l[2], x0 = l[1]; + if(! match) return singleton(x0); + var match$0 = match[2], x1 = match[1]; + if(! match$0) return add(x1, singleton(x0)); + var match$1 = match$0[2], x2 = match$0[1]; + if(! match$1) return add(x2, add(x1, singleton(x0))); + var match$2 = match$1[2], x3 = match$1[1]; + if(! match$2) return add(x3, add(x2, add(x1, singleton(x0)))); + if(match$2[2]){ + var + l$0 = Stdlib_List[62].call(null, Ord[1], l), + sub = + function(n, l){ + if(3 >= n >>> 0) + switch(n){ + case 0: + return [0, 0, l]; + case 1: + if(l){ + var l$3 = l[2], x0 = l[1]; + return [0, [0, 0, x0, 0, 1], l$3]; + } + break; + case 2: + if(l){ + var match$1 = l[2]; + if(match$1){ + var l$4 = match$1[2], x1 = match$1[1], x0$0 = l[1]; + return [0, [0, [0, 0, x0$0, 0, 1], x1, 0, 2], l$4]; + } + } + break; + default: + if(l){ + var a = l[2]; + if(a){ + var match$2 = a[2]; + if(match$2){ + var + l$5 = match$2[2], + x2 = match$2[1], + x1$0 = a[1], + x0$1 = l[1]; + return [0, + [0, [0, 0, x0$1, 0, 1], x1$0, [0, 0, x2, 0, 1], 2], + l$5]; + } + } + } + } + var + nl = n / 2 | 0, + match = sub(nl, l), + l$0 = match[2], + left = match[1]; + if(! l$0) + throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); + var + l$1 = l$0[2], + mid = l$0[1], + match$0 = sub((n - nl | 0) - 1 | 0, l$1), + l$2 = match$0[2], + right = match$0[1]; + return [0, create(left, mid, right), l$2]; + }; + return sub(Stdlib_List[1].call(null, l$0), l$0)[1]; + } + var x4 = match$2[1]; + return add(x4, add(x3, add(x2, add(x1, singleton(x0))))); + } + function add_seq(i, m){ + return Stdlib_Seq[5].call + (null, function(s, x){return add(x, s);}, m, i); + } + function of_seq(i){return add_seq(i, empty);} + function seq_of_enum(c, param){ + if(! c) return 0; + var rest = c[3], t = c[2], x = c[1], a = cons_enum(t, rest); + return [0, x, function(b){return seq_of_enum(a, b);}]; + } + function to_seq(c){ + var a = cons_enum(c, 0); + return function(b){return seq_of_enum(a, b);}; + } + function snoc_enum(s$0, e$1){ + var s = s$0, e = e$1; + for(;;){ + if(! s) return e; + var r = s[3], v = s[2], l = s[1], e$0 = [0, v, l, e]; + s = r; + e = e$0; + } + } + function rev_seq_of_enum(c, param){ + if(! c) return 0; + var rest = c[3], t = c[2], x = c[1], a = snoc_enum(t, rest); + return [0, x, function(b){return rev_seq_of_enum(a, b);}]; + } + function to_rev_seq(c){ + var a = snoc_enum(c, 0); + return function(b){return rev_seq_of_enum(a, b);}; + } + function to_seq_from(low, s){ + a: + { + var s$0 = s, c = 0; + for(;;){ + if(! s$0){var a = c; break a;} + var + r = s$0[3], + v = s$0[2], + l = s$0[1], + n = caml_call2(Ord[1], v, low); + if(0 === n) break; + if(0 <= n){var c$0 = [0, v, r, c]; s$0 = l; c = c$0;} else s$0 = r; + } + var a = [0, v, r, c]; + } + return function(b){return seq_of_enum(a, b);}; + } + return [0, + empty, + add, + singleton, + remove, + union, + inter, + disjoint, + diff, + cardinal, + elements, + min_elt, + min_elt_opt, + max_elt, + max_elt_opt, + min_elt, + min_elt_opt, + find, + find_opt, + find_first, + find_first_opt, + find_last, + find_last_opt, + iter, + fold, + map, + filter, + filter_map, + partition, + split, + is_empty, + mem, + equal, + compare, + subset, + for_all, + exists, + elements, + of_list, + to_seq_from, + to_seq, + to_rev_seq, + add_seq, + of_seq]; + }]; + runtime.caml_register_global(12, Stdlib_Set, "Stdlib__Set"); + return; + } + (globalThis)); + +//# 8540 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Map:[F(1)*] +(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(), + Stdlib = global_data.Stdlib, + Assert_failure = global_data.Assert_failure, + Stdlib_Seq = global_data.Stdlib__Seq, + Stdlib_List = global_data.Stdlib__List, + a = [0, 0, 0, 0], + b = [0, "map.ml", 408, 10], + c = [0, 0, 0], + Stdlib_Map = + [0, + function(Ord){ + function height(param){ + if(! param) return 0; + var h = param[5]; + return h; + } + function create(l, x, d, r){ + var + hl = height(l), + hr = height(r), + a = hr <= hl ? hl + 1 | 0 : hr + 1 | 0; + return [0, l, x, d, r, a]; + } + function singleton(x, d){return [0, 0, x, d, 0, 1];} + function bal(l, x, d, r){ + if(l) var h = l[5], hl = h; else var hl = 0; + if(r) var h$0 = r[5], hr = h$0; else var hr = 0; + var cst_Map_bal = "Map.bal"; + if((hr + 2 | 0) < hl){ + if(! l) return Stdlib[1].call(null, cst_Map_bal); + var lr = l[4], ld = l[3], lv = l[2], ll = l[1], a = height(lr); + if(a <= height(ll)) return create(ll, lv, ld, create(lr, x, d, r)); + if(! lr) return Stdlib[1].call(null, cst_Map_bal); + var + lrr = lr[4], + lrd = lr[3], + lrv = lr[2], + lrl = lr[1], + b = create(lrr, x, d, r); + return create(create(ll, lv, ld, lrl), lrv, lrd, b); + } + if((hl + 2 | 0) >= hr){ + var f = hr <= hl ? hl + 1 | 0 : hr + 1 | 0; + return [0, l, x, d, r, f]; + } + if(! r) return Stdlib[1].call(null, cst_Map_bal); + var rr = r[4], rd = r[3], rv = r[2], rl = r[1], c = height(rl); + if(c <= height(rr)) return create(create(l, x, d, rl), rv, rd, rr); + if(! rl) return Stdlib[1].call(null, cst_Map_bal); + var + rlr = rl[4], + rld = rl[3], + rlv = rl[2], + rll = rl[1], + e = create(rlr, rv, rd, rr); + return create(create(l, x, d, rll), rlv, rld, e); + } + function is_empty(param){return param ? 0 : 1;} + function add(x, data, m){ + if(! m) return [0, 0, x, data, 0, 1]; + var + h = m[5], + r = m[4], + d = m[3], + v = m[2], + l = m[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return d === data ? m : [0, l, x, data, r, h]; + if(0 <= c){ + var rr = add(x, data, r); + return r === rr ? m : bal(l, v, d, rr); + } + var ll = add(x, data, l); + return l === ll ? m : bal(ll, v, d, r); + } + function find(x, param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return d; + param = 0 <= c ? r : l; + } + } + function find_first(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var + r$0 = param$0[4], + d0$1 = param$0[3], + v0$1 = param$0[2], + l$0 = param$0[1]; + if(caml_call1(f, v0$1)){ + var v0 = v0$1, d0 = d0$1, param = l$0; + break; + } + param$0 = r$0; + } + for(;;){ + if(! param) return [0, v0, d0]; + var r = param[4], d0$0 = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){ + v0 = v0$0; + d0 = d0$0; + param = l; + } + else + param = r; + } + } + function find_first_opt(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) return 0; + var + r$0 = param$0[4], + d0$1 = param$0[3], + v0$1 = param$0[2], + l$0 = param$0[1]; + if(caml_call1(f, v0$1)){ + var v0 = v0$1, d0 = d0$1, param = l$0; + break; + } + param$0 = r$0; + } + for(;;){ + if(! param) return [0, [0, v0, d0]]; + var r = param[4], d0$0 = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){ + v0 = v0$0; + d0 = d0$0; + param = l; + } + else + param = r; + } + } + function find_last(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var + r$0 = param$0[4], + d0$1 = param$0[3], + v0$1 = param$0[2], + l$0 = param$0[1]; + if(caml_call1(f, v0$1)){ + var v0 = v0$1, d0 = d0$1, param = r$0; + break; + } + param$0 = l$0; + } + for(;;){ + if(! param) return [0, v0, d0]; + var r = param[4], d0$0 = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){ + v0 = v0$0; + d0 = d0$0; + param = r; + } + else + param = l; + } + } + function find_last_opt(f, param$1){ + var param$0 = param$1; + for(;;){ + if(! param$0) return 0; + var + r$0 = param$0[4], + d0$1 = param$0[3], + v0$1 = param$0[2], + l$0 = param$0[1]; + if(caml_call1(f, v0$1)){ + var v0 = v0$1, d0 = d0$1, param = r$0; + break; + } + param$0 = l$0; + } + for(;;){ + if(! param) return [0, [0, v0, d0]]; + var r = param[4], d0$0 = param[3], v0$0 = param[2], l = param[1]; + if(caml_call1(f, v0$0)){ + v0 = v0$0; + d0 = d0$0; + param = r; + } + else + param = l; + } + } + function find_opt(x, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return [0, d]; + param = 0 <= c ? r : l; + } + } + function mem(x, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var + r = param[4], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v), + a = 0 === c ? 1 : 0; + if(a) return a; + param = 0 <= c ? r : l; + } + } + function min_binding(param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var l = param[1]; + if(! l){var d = param[3], v = param[2]; return [0, v, d];} + param = l; + } + } + function min_binding_opt(param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var l = param[1]; + if(! l){var d = param[3], v = param[2]; return [0, [0, v, d]];} + param = l; + } + } + function max_binding(param$0){ + var param = param$0; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + if(! param[4]){var d = param[3], v = param[2]; return [0, v, d];} + var r = param[4]; + param = r; + } + } + function max_binding_opt(param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + if(! param[4]){ + var d = param[3], v = param[2]; + return [0, [0, v, d]]; + } + var r = param[4]; + param = r; + } + } + function remove_min_binding(param){ + if(! param) return Stdlib[1].call(null, "Map.remove_min_elt"); + var l = param[1]; + if(l){ + var r = param[4], d = param[3], v = param[2]; + return bal(remove_min_binding(l), v, d, r); + } + var r$0 = param[4]; + return r$0; + } + function d(t1, t2){ + if(! t1) return t2; + if(! t2) return t1; + var match = min_binding(t2), d = match[2], x = match[1]; + return bal(t1, x, d, remove_min_binding(t2)); + } + function remove(x, m){ + if(! m) return 0; + var + r = m[4], + d$0 = m[3], + v = m[2], + l = m[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return d(l, r); + if(0 <= c){ + var rr = remove(x, r); + return r === rr ? m : bal(l, v, d$0, rr); + } + var ll = remove(x, l); + return l === ll ? m : bal(ll, v, d$0, r); + } + function update(x, f, m){ + if(! m){ + var match$0 = caml_call1(f, 0); + if(! match$0) return 0; + var data$0 = match$0[1]; + return [0, 0, x, data$0, 0, 1]; + } + var + h = m[5], + r = m[4], + d$0 = m[3], + v = m[2], + l = m[1], + c = caml_call2(Ord[1], x, v); + if(0 === c){ + var match = caml_call1(f, [0, d$0]); + if(! match) return d(l, r); + var data = match[1]; + return d$0 === data ? m : [0, l, x, data, r, h]; + } + if(0 <= c){ + var rr = update(x, f, r); + return r === rr ? m : bal(l, v, d$0, rr); + } + var ll = update(x, f, l); + return l === ll ? m : bal(ll, v, d$0, r); + } + function add_to_list(x, data, m){ + function add(param){ + if(! param) return [0, [0, data, 0]]; + var l = param[1]; + return [0, [0, data, l]]; + } + return update(x, add, m); + } + function iter(f, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var r = param[4], d = param[3], v = param[2], l = param[1]; + iter(f, l); + caml_call2(f, v, d); + param = r; + } + } + function map(f, param){ + if(! param) return 0; + var + h = param[5], + r = param[4], + d = param[3], + v = param[2], + l = param[1], + l$0 = map(f, l), + d$0 = caml_call1(f, d), + r$0 = map(f, r); + return [0, l$0, v, d$0, r$0, h]; + } + function mapi(f, param){ + if(! param) return 0; + var + h = param[5], + r = param[4], + d = param[3], + v = param[2], + l = param[1], + l$0 = mapi(f, l), + d$0 = caml_call2(f, v, d), + r$0 = mapi(f, r); + return [0, l$0, v, d$0, r$0, h]; + } + function fold(f, m$0, accu$1){ + var m = m$0, accu = accu$1; + for(;;){ + if(! m) return accu; + var + r = m[4], + d = m[3], + v = m[2], + l = m[1], + accu$0 = caml_call3(f, v, d, fold(f, l, accu)); + m = r; + accu = accu$0; + } + } + function for_all(p, param$0){ + var param = param$0; + for(;;){ + if(! param) return 1; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + a = caml_call2(p, v, d); + if(a){ + var b = for_all(p, l); + if(b){param = r; continue;} + var c = b; + } + else + var c = a; + return c; + } + } + function exists(p, param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + a = caml_call2(p, v, d); + if(a) + var b = a; + else{var c = exists(p, l); if(! c){param = r; continue;} var b = c;} + return b; + } + } + function add_min_binding(k, x, param){ + if(! param) return singleton(k, x); + var r = param[4], d = param[3], v = param[2], l = param[1]; + return bal(add_min_binding(k, x, l), v, d, r); + } + function add_max_binding(k, x, param){ + if(! param) return singleton(k, x); + var r = param[4], d = param[3], v = param[2], l = param[1]; + return bal(l, v, d, add_max_binding(k, x, r)); + } + function join(l, v, d, r){ + if(! l) return add_min_binding(v, d, r); + if(! r) return add_max_binding(v, d, l); + var + rh = r[5], + rr = r[4], + rd = r[3], + rv = r[2], + rl = r[1], + lh = l[5], + lr = l[4], + ld = l[3], + lv = l[2], + ll = l[1]; + return (rh + 2 | 0) < lh + ? bal(ll, lv, ld, join(lr, v, d, r)) + : (lh + + 2 + | 0) + < rh + ? bal(join(l, v, d, rl), rv, rd, rr) + : create(l, v, d, r); + } + function concat(t1, t2){ + if(! t1) return t2; + if(! t2) return t1; + var match = min_binding(t2), d = match[2], x = match[1]; + return join(t1, x, d, remove_min_binding(t2)); + } + function concat_or_join(t1, v, d, t2){ + if(! d) return concat(t1, t2); + var d$0 = d[1]; + return join(t1, v, d$0, t2); + } + function split(x, param){ + if(! param) return a; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + c = caml_call2(Ord[1], x, v); + if(0 === c) return [0, l, [0, d], r]; + if(0 <= c){ + var + match = split(x, r), + rr = match[3], + pres = match[2], + lr = match[1]; + return [0, join(l, v, d, lr), pres, rr]; + } + var + match$0 = split(x, l), + rl = match$0[3], + pres$0 = match$0[2], + ll = match$0[1]; + return [0, ll, pres$0, join(rl, v, d, r)]; + } + function merge(f, s1, s2){ + if(s1){ + var h1 = s1[5], r1 = s1[4], d1 = s1[3], v1 = s1[2], l1 = s1[1]; + if(height(s2) <= h1){ + var + match = split(v1, s2), + r2 = match[3], + d2 = match[2], + l2 = match[1], + a = merge(f, r1, r2), + c = caml_call3(f, v1, [0, d1], d2); + return concat_or_join(merge(f, l1, l2), v1, c, a); + } + } + else if(! s2) return 0; + if(! s2) + throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); + var + r2$0 = s2[4], + d2$0 = s2[3], + v2 = s2[2], + l2$0 = s2[1], + match$0 = split(v2, s1), + r1$0 = match$0[3], + d1$0 = match$0[2], + l1$0 = match$0[1], + d = merge(f, r1$0, r2$0), + e = caml_call3(f, v2, d1$0, [0, d2$0]); + return concat_or_join(merge(f, l1$0, l2$0), v2, e, d); + } + function union(f, s1, s2){ + if(s1){ + if(s2){ + var + h2 = s2[5], + r2 = s2[4], + d2 = s2[3], + v2 = s2[2], + l2 = s2[1], + h1 = s1[5], + r1 = s1[4], + d1 = s1[3], + v1 = s1[2], + l1 = s1[1]; + if(h2 <= h1){ + var + match = split(v1, s2), + r2$0 = match[3], + d2$0 = match[2], + l2$0 = match[1], + l = union(f, l1, l2$0), + r = union(f, r1, r2$0); + if(! d2$0) return join(l, v1, d1, r); + var d2$1 = d2$0[1]; + return concat_or_join(l, v1, caml_call3(f, v1, d1, d2$1), r); + } + var + match$0 = split(v2, s1), + r1$0 = match$0[3], + d1$0 = match$0[2], + l1$0 = match$0[1], + l$0 = union(f, l1$0, l2), + r$0 = union(f, r1$0, r2); + if(! d1$0) return join(l$0, v2, d2, r$0); + var d1$1 = d1$0[1]; + return concat_or_join(l$0, v2, caml_call3(f, v2, d1$1, d2), r$0); + } + var s = s1; + } + else + var s = s2; + return s; + } + function filter(p, m){ + if(! m) return 0; + var + r = m[4], + d = m[3], + v = m[2], + l = m[1], + l$0 = filter(p, l), + pvd = caml_call2(p, v, d), + r$0 = filter(p, r); + if(! pvd) return concat(l$0, r$0); + if(l === l$0 && r === r$0) return m; + return join(l$0, v, d, r$0); + } + function filter_map(f, param){ + if(! param) return 0; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + l$0 = filter_map(f, l), + fvd = caml_call2(f, v, d), + r$0 = filter_map(f, r); + if(! fvd) return concat(l$0, r$0); + var d$0 = fvd[1]; + return join(l$0, v, d$0, r$0); + } + function partition(p, param){ + if(! param) return c; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + match = partition(p, l), + lf = match[2], + lt = match[1], + pvd = caml_call2(p, v, d), + match$0 = partition(p, r), + rf = match$0[2], + rt = match$0[1]; + if(pvd){var a = concat(lf, rf); return [0, join(lt, v, d, rt), a];} + var b = join(lf, v, d, rf); + return [0, concat(lt, rt), b]; + } + function cons_enum(m$0, e$1){ + var m = m$0, e = e$1; + for(;;){ + if(! m) return e; + var r = m[4], d = m[3], v = m[2], l = m[1], e$0 = [0, v, d, r, e]; + m = l; + e = e$0; + } + } + function compare(cmp, m1, m2){ + var + e2$2 = cons_enum(m2, 0), + e1$2 = cons_enum(m1, 0), + e1 = e1$2, + e2 = e2$2; + for(;;){ + if(! e1) return e2 ? -1 : 0; + if(! e2) return 1; + var + e2$0 = e2[4], + r2 = e2[3], + d2 = e2[2], + v2 = e2[1], + e1$0 = e1[4], + r1 = e1[3], + d1 = e1[2], + v1 = e1[1], + c = caml_call2(Ord[1], v1, v2); + if(0 !== c) return c; + var c$0 = caml_call2(cmp, d1, d2); + if(0 !== c$0) return c$0; + var e2$1 = cons_enum(r2, e2$0), e1$1 = cons_enum(r1, e1$0); + e1 = e1$1; + e2 = e2$1; + } + } + function equal(cmp, m1, m2){ + var + e2$2 = cons_enum(m2, 0), + e1$2 = cons_enum(m1, 0), + e1 = e1$2, + e2 = e2$2; + for(;;){ + if(! e1) return e2 ? 0 : 1; + if(! e2) return 0; + var + e2$0 = e2[4], + r2 = e2[3], + d2 = e2[2], + v2 = e2[1], + e1$0 = e1[4], + r1 = e1[3], + d1 = e1[2], + v1 = e1[1], + a = 0 === caml_call2(Ord[1], v1, v2) ? 1 : 0; + if(a){ + var b = caml_call2(cmp, d1, d2); + if(b){ + var e2$1 = cons_enum(r2, e2$0), e1$1 = cons_enum(r1, e1$0); + e1 = e1$1; + e2 = e2$1; + continue; + } + var c = b; + } + else + var c = a; + return c; + } + } + function cardinal(param){ + if(! param) return 0; + var r = param[4], l = param[1], a = cardinal(r); + return (cardinal(l) + 1 | 0) + a | 0; + } + function bindings_aux(accu$1, param$0){ + var accu = accu$1, param = param$0; + for(;;){ + if(! param) return accu; + var + r = param[4], + d = param[3], + v = param[2], + l = param[1], + accu$0 = [0, [0, v, d], bindings_aux(accu, r)]; + accu = accu$0; + param = l; + } + } + function bindings(s){return bindings_aux(0, s);} + var empty = 0; + function of_list(bs){ + return Stdlib_List[26].call + (null, + function(m, param){ + var v = param[2], k = param[1]; + return add(k, v, m); + }, + empty, + bs); + } + function add_seq(i, m){ + return Stdlib_Seq[5].call + (null, + function(m, param){ + var v = param[2], k = param[1]; + return add(k, v, m); + }, + m, + i); + } + function of_seq(i){return add_seq(i, empty);} + function seq_of_enum(c, param){ + if(! c) return 0; + var + rest = c[4], + t = c[3], + v = c[2], + k = c[1], + a = cons_enum(t, rest); + return [0, [0, k, v], function(b){return seq_of_enum(a, b);}]; + } + function to_seq(m){ + var a = cons_enum(m, 0); + return function(b){return seq_of_enum(a, b);}; + } + function snoc_enum(s$0, e$1){ + var s = s$0, e = e$1; + for(;;){ + if(! s) return e; + var r = s[4], d = s[3], v = s[2], l = s[1], e$0 = [0, v, d, l, e]; + s = r; + e = e$0; + } + } + function rev_seq_of_enum(c, param){ + if(! c) return 0; + var + rest = c[4], + t = c[3], + v = c[2], + k = c[1], + a = snoc_enum(t, rest); + return [0, [0, k, v], function(b){return rev_seq_of_enum(a, b);}]; + } + function to_rev_seq(c){ + var a = snoc_enum(c, 0); + return function(b){return rev_seq_of_enum(a, b);}; + } + function to_seq_from(low, m){ + a: + { + var m$0 = m, c = 0; + for(;;){ + if(! m$0){var a = c; break a;} + var + r = m$0[4], + d = m$0[3], + v = m$0[2], + l = m$0[1], + n = caml_call2(Ord[1], v, low); + if(0 === n) break; + if(0 <= n){ + var c$0 = [0, v, d, r, c]; + m$0 = l; + c = c$0; + } + else + m$0 = r; + } + var a = [0, v, d, r, c]; + } + return function(b){return seq_of_enum(a, b);}; + } + return [0, + empty, + add, + add_to_list, + update, + singleton, + remove, + merge, + union, + cardinal, + bindings, + min_binding, + min_binding_opt, + max_binding, + max_binding_opt, + min_binding, + min_binding_opt, + find, + find_opt, + find_first, + find_first_opt, + find_last, + find_last_opt, + iter, + fold, + map, + mapi, + filter, + filter_map, + partition, + split, + is_empty, + mem, + equal, + compare, + for_all, + exists, + bindings, + of_list, + to_seq, + to_rev_seq, + to_seq_from, + add_seq, + of_seq]; + }]; + runtime.caml_register_global(12, Stdlib_Map, "Stdlib__Map"); + return; + } + (globalThis)); + +//# 9393 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Stack:[N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(2),F(3),F(1)*,F(2),F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + global_data = runtime.caml_get_global_data(), + Stdlib_Seq = global_data.Stdlib__Seq, + Stdlib_List = global_data.Stdlib__List, + Empty = [248, "Stdlib.Stack.Empty", runtime.caml_fresh_oo_id(0)]; + function create(param){return [0, 0, 0];} + function clear(s){s[1] = 0; s[2] = 0; return 0;} + function copy(s){return [0, s[1], s[2]];} + function push(x, s){s[1] = [0, x, s[1]]; s[2] = s[2] + 1 | 0; return 0;} + function pop(s){ + var match = s[1]; + if(! match) throw caml_maybe_attach_backtrace(Empty, 1); + var tl = match[2], hd = match[1]; + s[1] = tl; + s[2] = s[2] - 1 | 0; + return hd; + } + function pop_opt(s){ + var match = s[1]; + if(! match) return 0; + var tl = match[2], hd = match[1]; + s[1] = tl; + s[2] = s[2] - 1 | 0; + return [0, hd]; + } + function drop(s){ + var match = s[1]; + if(! match) throw caml_maybe_attach_backtrace(Empty, 1); + var tl = match[2]; + s[1] = tl; + s[2] = s[2] - 1 | 0; + return 0; + } + function top(s){ + var match = s[1]; + if(! match) throw caml_maybe_attach_backtrace(Empty, 1); + var hd = match[1]; + return hd; + } + function top_opt(s){ + var match = s[1]; + if(! match) return 0; + var hd = match[1]; + return [0, hd]; + } + function is_empty(s){return 0 === s[1] ? 1 : 0;} + function length(s){return s[2];} + function iter(f, s){return Stdlib_List[18].call(null, f, s[1]);} + function fold(f, acc, s){return Stdlib_List[26].call(null, f, acc, s[1]);} + function to_seq(s){return Stdlib_List[64].call(null, s[1]);} + function add_seq(q, i){ + return Stdlib_Seq[4].call(null, function(x){return push(x, q);}, i); + } + function of_seq(g){var s = create(0); add_seq(s, g); return s;} + runtime.caml_register_global + (3, + [0, + Empty, + create, + push, + pop, + pop_opt, + drop, + top, + top_opt, + clear, + copy, + is_empty, + length, + iter, + fold, + to_seq, + add_seq, + of_seq], + "Stdlib__Stack"); + return; + } + (globalThis)); + +//# 9480 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Queue:[N,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(3),F(2),F(1)*->F(1)*,F(2),F(1)] +(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]); + } + var + Stdlib_Seq = runtime.caml_get_global_data().Stdlib__Seq, + Empty = [248, "Stdlib.Queue.Empty", runtime.caml_fresh_oo_id(0)]; + function create(param){return [0, 0, 0, 0];} + function clear(q){q[1] = 0; q[2] = 0; q[3] = 0; return 0;} + function add(x, q){ + var cell = [0, x, 0], match = q[3]; + return match + ? (q[1] = q[1] + 1 | 0, match[2] = cell, q[3] = cell, 0) + : (q[1] = 1, q[2] = cell, q[3] = cell, 0); + } + function peek(q){ + var match = q[2]; + if(! match) throw caml_maybe_attach_backtrace(Empty, 1); + var content = match[1]; + return content; + } + function peek_opt(q){ + var match = q[2]; + if(! match) return 0; + var content = match[1]; + return [0, content]; + } + function take(q){ + var match = q[2]; + if(! match) throw caml_maybe_attach_backtrace(Empty, 1); + var content = match[1]; + if(match[2]){ + var next = match[2]; + q[1] = q[1] - 1 | 0; + q[2] = next; + return content; + } + clear(q); + return content; + } + function take_opt(q){ + var match = q[2]; + if(! match) return 0; + var content = match[1]; + if(match[2]){ + var next = match[2]; + q[1] = q[1] - 1 | 0; + q[2] = next; + return [0, content]; + } + clear(q); + return [0, content]; + } + function copy(q){ + var cell$0 = q[2], q_res = [0, q[1], 0, 0], prev = 0, cell = cell$0; + for(;;){ + if(! cell){q_res[3] = prev; return q_res;} + var content = cell[1], next = cell[2], prev$0 = [0, content, 0]; + if(prev){ + prev[2] = prev$0; + prev = prev$0; + cell = next; + } + else{q_res[2] = prev$0; prev = prev$0; cell = next;} + } + } + function is_empty(q){return 0 === q[1] ? 1 : 0;} + function length(q){return q[1];} + function iter(f, q){ + var cell$0 = q[2], cell = cell$0; + for(;;){ + if(! cell) return 0; + var content = cell[1], next = cell[2]; + caml_call1(f, content); + cell = next; + } + } + function fold(f, accu$1, q){ + var cell$0 = q[2], accu = accu$1, cell = cell$0; + for(;;){ + if(! cell) return accu; + var + content = cell[1], + next = cell[2], + accu$0 = caml_call2(f, accu, content); + accu = accu$0; + cell = next; + } + } + function transfer(q1, q2){ + var a = 0 < q1[1] ? 1 : 0; + if(! a) return a; + var match = q2[3]; + return match + ? (q2 + [1] + = q2[1] + q1[1] | 0, + match[2] = q1[2], + q2[3] = q1[3], + clear(q1)) + : (q2[1] = q1[1], q2[2] = q1[2], q2[3] = q1[3], clear(q1)); + } + function to_seq(q){ + function aux(c, param){ + if(! c) return 0; + var x = c[1], next = c[2]; + return [0, x, function(a){return aux(next, a);}]; + } + var a = q[2]; + return function(b){return aux(a, b);}; + } + function add_seq(q, i){ + return Stdlib_Seq[4].call(null, function(x){return add(x, q);}, i); + } + function of_seq(g){var q = create(0); add_seq(q, g); return q;} + runtime.caml_register_global + (2, + [0, + Empty, + create, + add, + add, + take, + take_opt, + take, + peek, + peek_opt, + peek, + clear, + copy, + is_empty, + length, + iter, + fold, + transfer, + to_seq, + add_seq, + of_seq], + "Stdlib__Queue"); + 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)); + +//# 20272 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Format:[F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(3),F(2),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(2),F(1),F(2),F(1),F(3),F(2),F(3),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),N,F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(1)*,F(3),F(2),F(3),F(2),F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(3),F(2),F(2),F(1),F(2)*,F(1),N,F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2),F(1),F(2)*,F(1),F(2)*,F(1),F(2),F(1),F(3),F(2),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(2),F(1),F(2)*,F(1),F(1),F(1),N,F(1),N,F(1),F(1),N,F(1),N,F(1),F(1),F(2),F(2),F(1),F(1)*,F(1),F(1),F(1),F(2),F(1),F(5),F(4),F(4),F(4),F(2),F(4),F(4),F(4),F(1)*->F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(3),F(2),F(3),F(2),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; + 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_Queue = global_data.Stdlib__Queue, + CamlinternalFormat = global_data.CamlinternalFormat, + Stdlib = global_data.Stdlib, + Stdlib_String = global_data.Stdlib__String, + Stdlib_Domain = global_data.Stdlib__Domain, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Seq = global_data.Stdlib__Seq, + Stdlib_Array = global_data.Stdlib__Array, + Stdlib_List = global_data.Stdlib__List, + Stdlib_Stack = global_data.Stdlib__Stack, + Stdlib_Int = global_data.Stdlib__Int, + Stdlib_Bytes = global_data.Stdlib__Bytes; + function id(x){return x;} + var + String_tag = + [248, "Stdlib.Format.String_tag", runtime.caml_fresh_oo_id(0)]; + function pp_enqueue(state, token){ + state[13] = state[13] + token[3] | 0; + return Stdlib_Queue[3].call(null, token, state[28]); + } + function pp_output_string(state, s){ + return caml_call3(state[17], s, 0, caml_ml_string_length(s)); + } + function pp_output_newline(state){return caml_call1(state[19], 0);} + function format_pp_text(state, size, text){ + state[9] = state[9] - size | 0; + pp_output_string(state, text); + state[11] = 0; + } + var cst$0 = ""; + function format_string(state, s){ + var a = s !== cst$0 ? 1 : 0; + return a ? format_pp_text(state, caml_ml_string_length(s), s) : a; + } + function break_new_line(state, param, width){ + var after = param[3], offset = param[2], before = param[1]; + format_string(state, before); + pp_output_newline(state); + state[11] = 1; + var + indent = (state[6] - width | 0) + offset | 0, + real_indent = Stdlib_Int[10].call(null, state[8], indent); + state[10] = real_indent; + state[9] = state[6] - state[10] | 0; + var n = state[10]; + caml_call1(state[21], n); + return format_string(state, after); + } + function break_same_line(state, param){ + var after = param[3], width = param[2], before = param[1]; + format_string(state, before); + state[9] = state[9] - width | 0; + caml_call1(state[20], width); + return format_string(state, after); + } + var a = [0, cst$0, 0, cst$0]; + function format_pp_token(state, size$0, param){ + if(typeof param === "number") + switch(param){ + case 0: + var match$3 = Stdlib_Stack[8].call(null, state[3]); + if(! match$3) return; + var + tabs = match$3[1][1], + add_tab = + function(n, ls){ + if(! ls) return [0, n, 0]; + var l = ls[2], x = ls[1]; + return runtime.caml_lessthan(n, x) + ? [0, n, ls] + : [0, x, add_tab(n, l)]; + }; + tabs[1] = add_tab(state[6] - state[9] | 0, tabs[1]); + return; + case 1: + Stdlib_Stack[5].call(null, state[2]); return; + case 2: + Stdlib_Stack[5].call(null, state[3]); return; + case 3: + var match$4 = Stdlib_Stack[8].call(null, state[2]); + if(! match$4) return pp_output_newline(state); + var width$0 = match$4[1][2]; + return break_new_line(state, a, width$0); + case 4: + var b = state[10] !== (state[6] - state[9] | 0) ? 1 : 0; + if(! b) return b; + var match$1 = Stdlib_Queue[6].call(null, state[28]); + if(! match$1) return; + var match$2 = match$1[1], size = match$2[1], length = match$2[3]; + state[12] = state[12] - length | 0; + state[9] = state[9] + size | 0; + return; + default: + var match$5 = Stdlib_Stack[5].call(null, state[5]); + if(! match$5) return; + var tag_name = match$5[1], marker = caml_call1(state[25], tag_name); + return pp_output_string(state, marker); + } + switch(param[0]){ + case 0: + var s = param[1]; return format_pp_text(state, size$0, s); + case 1: + var + breaks = param[2], + fits = param[1], + off = breaks[2], + before = breaks[1], + match$6 = Stdlib_Stack[8].call(null, state[2]); + if(! match$6) return; + var + match$7 = match$6[1], + width$1 = match$7[2], + box_type$0 = match$7[1]; + switch(box_type$0){ + case 3: + return state[9] < (size$0 + caml_ml_string_length(before) | 0) + ? break_new_line(state, breaks, width$1) + : break_same_line(state, fits); + case 4: + return state[11] + ? break_same_line(state, fits) + : state + [9] + < (size$0 + caml_ml_string_length(before) | 0) + ? break_new_line(state, breaks, width$1) + : ((state + [6] + - width$1 + | 0) + + off + | 0) + < state[10] + ? break_new_line(state, breaks, width$1) + : break_same_line(state, fits); + case 0: + case 5: + return break_same_line(state, fits); + default: return break_new_line(state, breaks, width$1); + } + case 2: + var + off$0 = param[2], + n = param[1], + insertion_point = state[6] - state[9] | 0, + match$8 = Stdlib_Stack[8].call(null, state[3]); + if(! match$8) return; + var tabs$0 = match$8[1][1], match$9 = tabs$0[1]; + if(match$9){ + var first = match$9[1], param$0 = tabs$0[1]; + for(;;){ + if(! param$0){var tab = first; break;} + var tail = param$0[2], head = param$0[1]; + if(insertion_point <= head){var tab = head; break;} + param$0 = tail; + } + } + else + var tab = insertion_point; + var offset = tab - insertion_point | 0; + return 0 <= offset + ? break_same_line(state, [0, cst$0, offset + n | 0, cst$0]) + : break_new_line + (state, [0, cst$0, tab + off$0 | 0, cst$0], state[6]); + case 3: + var + ty = param[2], + off$1 = param[1], + insertion_point$0 = state[6] - state[9] | 0; + if(state[8] < insertion_point$0){ + var match = Stdlib_Stack[8].call(null, state[2]); + if(match){ + var match$0 = match[1], width = match$0[2], box_type = match$0[1]; + if(state[9] < width && 3 >= box_type - 1 >>> 0) + break_new_line(state, a, width); + } + else + pp_output_newline(state); + } + var + width$2 = state[9] - off$1 | 0, + box_type$1 = 1 === ty ? 1 : state[9] < size$0 ? ty : 5; + return Stdlib_Stack[3].call(null, [0, box_type$1, width$2], state[2]); + case 4: + var tbox = param[1]; return Stdlib_Stack[3].call(null, tbox, state[3]); + default: + var + tag_name$0 = param[1], + marker$0 = caml_call1(state[24], tag_name$0); + pp_output_string(state, marker$0); + return Stdlib_Stack[3].call(null, tag_name$0, state[5]); + } + } + var pp_infinity = 1000000010; + function advance_left(state){ + for(;;){ + var match = Stdlib_Queue[9].call(null, state[28]); + if(! match) return 0; + var + match$0 = match[1], + size = match$0[1], + length = match$0[3], + token = match$0[2], + pending_count = state[13] - state[12] | 0, + b = 0 <= size ? 1 : 0, + a = b || (state[9] <= pending_count ? 1 : 0); + if(! a) return a; + Stdlib_Queue[5].call(null, state[28]); + var size$0 = 0 <= size ? size : pp_infinity; + format_pp_token(state, size$0, token); + state[12] = length + state[12] | 0; + } + } + function enqueue_advance(state, tok){ + pp_enqueue(state, tok); + return advance_left(state); + } + function enqueue_string_as(state, size, s){ + return enqueue_advance(state, [0, size, [0, s], size]); + } + var unknown = -1, b = [0, cst$0]; + function initialize_scan_stack(stack){ + Stdlib_Stack[9].call(null, stack); + return Stdlib_Stack[3].call(null, [0, -1, [0, unknown, b, 0]], stack); + } + function set_size(state, ty){ + var match = Stdlib_Stack[8].call(null, state[1]); + if(! match) return; + var + match$0 = match[1], + queue_elem = match$0[2], + left_total = match$0[1], + size = queue_elem[1]; + if(left_total < state[12]) return initialize_scan_stack(state[1]); + var match$1 = queue_elem[2]; + if(typeof match$1 !== "number") + switch(match$1[0]){ + case 3: + if(1 - ty){ + var x$0 = state[13] + size | 0; + queue_elem[1] = x$0; + Stdlib_Stack[5].call(null, state[1]); + } + return; + case 1: + case 2: + if(ty){ + var x = state[13] + size | 0; + queue_elem[1] = x; + Stdlib_Stack[5].call(null, state[1]); + } + return; + } + } + function scan_push(state, b, token){ + pp_enqueue(state, token); + if(b) set_size(state, 1); + var elem = [0, state[13], token]; + return Stdlib_Stack[3].call(null, elem, state[1]); + } + function pp_open_box_gen(state, indent, br_ty){ + state[14] = state[14] + 1 | 0; + if(state[14] < state[15]){ + var size = - state[13] | 0, elem = [0, size, [3, indent, br_ty], 0]; + return scan_push(state, 0, elem); + } + var a = state[14] === state[15] ? 1 : 0; + if(! a) return a; + var s = state[16], x = caml_ml_string_length(s); + return enqueue_string_as(state, x, s); + } + var zero = 0; + function pp_close_box(state, param){ + var a = 1 < state[14] ? 1 : 0; + if(a){ + if(state[14] < state[15]){ + pp_enqueue(state, [0, zero, 1, 0]); + set_size(state, 1); + set_size(state, 0); + } + state[14] = state[14] - 1 | 0; + var b = 0; + } + else + var b = a; + return b; + } + function pp_open_stag(state, tag_name){ + if(state[22]){ + Stdlib_Stack[3].call(null, tag_name, state[4]); + caml_call1(state[26], tag_name); + } + var a = state[23]; + if(! a) return a; + var token = [5, tag_name]; + return pp_enqueue(state, [0, zero, token, 0]); + } + function pp_close_stag(state, param){ + if(state[23]) pp_enqueue(state, [0, zero, 5, 0]); + var a = state[22]; + if(a){ + var match = Stdlib_Stack[5].call(null, state[4]); + if(match){ + var tag_name = match[1]; + return caml_call1(state[27], tag_name); + } + var b = 0; + } + else + var b = a; + return b; + } + function pp_set_print_tags(state, b){state[22] = b; return 0;} + function pp_set_mark_tags(state, b){state[23] = b; return 0;} + function pp_get_print_tags(state, param){return state[22];} + function pp_get_mark_tags(state, param){return state[23];} + function pp_set_tags(state, b){ + pp_set_print_tags(state, b); + return pp_set_mark_tags(state, b); + } + function pp_get_formatter_stag_function(state, param){ + return [0, state[24], state[25], state[26], state[27]]; + } + function pp_set_formatter_stag_function(state, param){ + var pct = param[4], pot = param[3], mct = param[2], mot = param[1]; + state[24] = mot; + state[25] = mct; + state[26] = pot; + state[27] = pct; + return 0; + } + function pp_rinit(state){ + state[12] = 1; + state[13] = 1; + Stdlib_Queue[11].call(null, state[28]); + initialize_scan_stack(state[1]); + Stdlib_Stack[9].call(null, state[2]); + Stdlib_Stack[9].call(null, state[3]); + Stdlib_Stack[9].call(null, state[4]); + Stdlib_Stack[9].call(null, state[5]); + state[10] = 0; + state[14] = 0; + state[9] = state[6]; + return pp_open_box_gen(state, 0, 3); + } + function pp_flush_queue(state, end_with_newline){ + Stdlib_Stack[13].call + (null, function(param){return pp_close_stag(state, 0);}, state[4]); + for(;;){ + if(1 >= state[14]){ + state[13] = pp_infinity; + advance_left(state); + if(end_with_newline) pp_output_newline(state); + return pp_rinit(state); + } + pp_close_box(state, 0); + } + } + function pp_print_as_size(state, size, s){ + var a = state[14] < state[15] ? 1 : 0; + return a ? enqueue_string_as(state, size, s) : a; + } + function pp_print_as(state, isize, s){ + return pp_print_as_size(state, isize, s); + } + function pp_print_string(state, s){ + var isize = caml_ml_string_length(s); + return pp_print_as_size(state, isize, s); + } + function pp_print_bytes(state, s){ + var + s$0 = Stdlib_Bytes[6].call(null, s), + isize = runtime.caml_ml_bytes_length(s); + return pp_print_as_size(state, isize, s$0); + } + function pp_print_int(state, i){ + return pp_print_string(state, Stdlib_Int[12].call(null, i)); + } + function pp_print_float(state, f){ + return pp_print_string(state, Stdlib[35].call(null, f)); + } + function pp_print_bool(state, b){ + return pp_print_string(state, Stdlib[30].call(null, b)); + } + function pp_print_char(state, c){ + var s = Stdlib_String[1].call(null, 1, c); + return pp_print_as_size(state, 1, s); + } + function pp_print_nothing(state, param){return 0;} + function pp_open_hbox(state, param){return pp_open_box_gen(state, 0, 0);} + function pp_open_vbox(state, indent){ + return pp_open_box_gen(state, indent, 1); + } + function pp_open_hvbox(state, indent){ + return pp_open_box_gen(state, indent, 2); + } + function pp_open_hovbox(state, indent){ + return pp_open_box_gen(state, indent, 3); + } + function pp_open_box(state, indent){ + return pp_open_box_gen(state, indent, 4); + } + function pp_print_newline(state, param){ + pp_flush_queue(state, 1); + return caml_call1(state[18], 0); + } + function pp_print_flush(state, param){ + pp_flush_queue(state, 0); + return caml_call1(state[18], 0); + } + function pp_force_newline(state, param){ + var a = state[14] < state[15] ? 1 : 0; + return a ? enqueue_advance(state, [0, zero, 3, 0]) : a; + } + function pp_print_if_newline(state, param){ + var a = state[14] < state[15] ? 1 : 0; + return a ? enqueue_advance(state, [0, zero, 4, 0]) : a; + } + function pp_print_custom_break(state, fits, breaks){ + var + after = fits[3], + width = fits[2], + before = fits[1], + a = state[14] < state[15] ? 1 : 0; + if(! a) return a; + var + size = - state[13] | 0, + token = [1, fits, breaks], + length = + (caml_ml_string_length(before) + width | 0) + + caml_ml_string_length(after) + | 0; + return scan_push(state, 1, [0, size, token, length]); + } + function pp_print_break(state, width, offset){ + return pp_print_custom_break + (state, [0, cst$0, width, cst$0], [0, cst$0, offset, cst$0]); + } + function pp_print_space(state, param){return pp_print_break(state, 1, 0);} + function pp_print_cut(state, param){return pp_print_break(state, 0, 0);} + function pp_open_tbox(state, param){ + state[14] = state[14] + 1 | 0; + var a = state[14] < state[15] ? 1 : 0; + if(! a) return a; + return enqueue_advance(state, [0, zero, [4, [0, [0, 0]]], 0]); + } + function pp_close_tbox(state, param){ + var b = 1 < state[14] ? 1 : 0; + if(b){ + var c = state[14] < state[15] ? 1 : 0; + if(c){ + enqueue_advance(state, [0, zero, 2, 0]); + state[14] = state[14] - 1 | 0; + var a = 0; + } + else + var a = c; + } + else + var a = b; + return a; + } + function pp_print_tbreak(state, width, offset){ + var a = state[14] < state[15] ? 1 : 0; + if(! a) return a; + var size = - state[13] | 0, elem = [0, size, [2, width, offset], width]; + return scan_push(state, 1, elem); + } + function pp_print_tab(state, param){return pp_print_tbreak(state, 0, 0);} + function pp_set_tab(state, param){ + var a = state[14] < state[15] ? 1 : 0; + if(! a) return a; + return enqueue_advance(state, [0, zero, 0, 0]); + } + function pp_set_max_boxes(state, n){ + var a = 1 < n ? 1 : 0, b = a ? (state[15] = n, 0) : a; + return b; + } + function pp_get_max_boxes(state, param){return state[15];} + function pp_over_max_boxes(state, param){return state[14] === state[15] ? 1 : 0; + } + function pp_set_ellipsis_text(state, s){state[16] = s; return 0;} + function pp_get_ellipsis_text(state, param){return state[16];} + function pp_limit(n){return n < 1000000010 ? n : 1000000009;} + function pp_set_max_indent(state, n$0){ + var b = 1 < n$0 ? 1 : 0; + if(! b) return b; + var n$1 = state[6] - n$0 | 0, a = 1 <= n$1 ? 1 : 0; + if(! a) return a; + var n = pp_limit(n$1); + state[7] = n; + state[8] = state[6] - state[7] | 0; + return pp_rinit(state); + } + function pp_get_max_indent(state, param){return state[8];} + function pp_set_margin(state, n){ + var a = 1 <= n ? 1 : 0; + if(! a) return a; + var n$0 = pp_limit(n); + state[6] = n$0; + if(state[8] <= state[6]) + var new_max_indent = state[8]; + else + var + b = Stdlib_Int[11].call(null, state[6] - state[7] | 0, state[6] / 2 | 0), + new_max_indent = Stdlib_Int[11].call(null, b, 1); + return pp_set_max_indent(state, new_max_indent); + } + var + c = [1, "margin <= max_indent"], + d = [1, "margin >= pp_infinity"], + e = [0, 0], + f = [1, "max_indent < 2"]; + function validate_geometry(param){ + var margin = param[2], max_indent = param[1]; + return 2 <= max_indent + ? margin <= max_indent ? c : 1000000010 <= margin ? d : e + : f; + } + function check_geometry(geometry){ + return 0 === validate_geometry(geometry)[0] ? 1 : 0; + } + function pp_get_margin(state, param){return state[6];} + function pp_set_full_geometry(state, param){ + var margin = param[2], max_indent = param[1]; + pp_set_margin(state, margin); + pp_set_max_indent(state, max_indent); + return 0; + } + function pp_set_geometry(state, max_indent, margin){ + var + geometry = [0, max_indent, margin], + match = validate_geometry(geometry); + if(0 === match[0]) return pp_set_full_geometry(state, geometry); + var + msg = match[1], + a = Stdlib[28].call(null, "Format.pp_set_geometry: ", msg); + throw caml_maybe_attach_backtrace([0, Stdlib[6], a], 1); + } + function pp_safe_set_geometry(state, max_indent, margin){ + var geometry = [0, max_indent, margin]; + return 0 === validate_geometry(geometry)[0] + ? pp_set_full_geometry(state, geometry) + : 0; + } + function pp_get_geometry(state, param){return [0, state[8], state[6]];} + function pp_update_geometry(state, update){ + var geometry = pp_get_geometry(state, 0); + return pp_set_full_geometry(state, caml_call1(update, geometry)); + } + function pp_set_formatter_out_functions(state, param){ + var j = param[5], i = param[4], h = param[3], g = param[2], f = param[1]; + state[17] = f; + state[18] = g; + state[19] = h; + state[20] = i; + state[21] = j; + return 0; + } + function pp_get_formatter_out_functions(state, param){ + return [0, state[17], state[18], state[19], state[20], state[21]]; + } + function pp_set_formatter_output_functi(state, f, g){state[17] = f; state[18] = g; return 0; + } + function pp_get_formatter_output_functi(state, param){return [0, state[17], state[18]]; + } + function display_newline(state, param){ + return caml_call3(state[17], "\n", 0, 1); + } + var blank_line = Stdlib_String[1].call(null, 80, 32); + function display_blanks(state, n$1){ + var n = n$1; + for(;;){ + var a = 0 < n ? 1 : 0; + if(! a) return a; + if(80 >= n) return caml_call3(state[17], blank_line, 0, n); + caml_call3(state[17], blank_line, 0, 80); + var n$0 = n - 80 | 0; + n = n$0; + } + } + function pp_set_formatter_out_channel(state, oc){ + var a = Stdlib[69]; + state[17] = function(b, c, d){return a(oc, b, c, d);}; + state[18] = function(param){return Stdlib[63].call(null, oc);}; + state[19] = function(a){return display_newline(state, a);}; + state[20] = function(a){return display_blanks(state, a);}; + state[21] = function(a){return display_blanks(state, a);}; + return 0; + } + var cst = ">"; + function default_pp_mark_open_tag(param){ + if(param[1] !== String_tag) return cst$0; + var s = param[2], a = Stdlib[28].call(null, s, cst); + return Stdlib[28].call(null, "<", a); + } + function default_pp_mark_close_tag(param){ + if(param[1] !== String_tag) return cst$0; + var s = param[2], a = Stdlib[28].call(null, s, cst); + return Stdlib[28].call(null, "<\/", a); + } + function default_pp_print_open_tag(a){return 0;} + function default_pp_print_close_tag(a){return 0;} + var g = [3, 0, 3]; + function pp_make_formatter(f, g$0, h, i, j){ + var + pp_queue = Stdlib_Queue[2].call(null, 0), + sys_tok = [0, unknown, g, 0]; + Stdlib_Queue[3].call(null, sys_tok, pp_queue); + var scan_stack = Stdlib_Stack[2].call(null, 0); + initialize_scan_stack(scan_stack); + Stdlib_Stack[3].call(null, [0, 1, sys_tok], scan_stack); + var + a = Stdlib[19], + b = Stdlib_Stack[2].call(null, 0), + c = Stdlib_Stack[2].call(null, 0), + d = Stdlib_Stack[2].call(null, 0), + pp_margin = 78; + return [0, + scan_stack, + Stdlib_Stack[2].call(null, 0), + d, + c, + b, + pp_margin, + 10, + 68, + pp_margin, + 0, + 1, + 1, + 1, + 1, + a, + ".", + f, + g$0, + h, + i, + j, + 0, + 0, + default_pp_mark_open_tag, + default_pp_mark_close_tag, + default_pp_print_open_tag, + default_pp_print_close_tag, + pp_queue]; + } + function formatter_of_out_functions(out_funs){ + return pp_make_formatter + (out_funs[1], out_funs[2], out_funs[3], out_funs[4], out_funs[5]); + } + function make_formatter(output, flush){ + var + ppf = + pp_make_formatter + (output, + flush, + function(a){return 0;}, + function(a){return 0;}, + function(a){return 0;}); + ppf[19] = function(a){return display_newline(ppf, a);}; + ppf[20] = function(a){return display_blanks(ppf, a);}; + ppf[21] = function(a){return display_blanks(ppf, a);}; + return ppf; + } + function formatter_of_out_channel(oc){ + var a = Stdlib[69]; + return make_formatter + (function(b, c, d){return a(oc, b, c, d);}, + function(param){return Stdlib[63].call(null, oc);}); + } + function formatter_of_buffer(b){ + var a = Stdlib_Buffer[18]; + return make_formatter + (function(c, d, e){return a(b, c, d, e);}, function(a){return 0;}); + } + var pp_buffer_size = 512; + function pp_make_buffer(param){ + return Stdlib_Buffer[1].call(null, pp_buffer_size); + } + var + stdbuf = pp_make_buffer(0), + std_formatter = formatter_of_out_channel(Stdlib[39]), + err_formatter = formatter_of_out_channel(Stdlib[40]), + str_formatter = formatter_of_buffer(stdbuf), + stdbuf_key = caml_call2(Stdlib_Domain[10][1], 0, pp_make_buffer); + caml_call2(Stdlib_Domain[10][3], stdbuf_key, stdbuf); + var + str_formatter_key = + caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){ + return formatter_of_buffer + (caml_call1(Stdlib_Domain[10][2], stdbuf_key)); + }); + caml_call2(Stdlib_Domain[10][3], str_formatter_key, str_formatter); + function buffered_out_string(key, str, ofs, len){ + var a = caml_call1(Stdlib_Domain[10][2], key); + return Stdlib_Buffer[18].call(null, a, str, ofs, len); + } + function buffered_out_flush(oc, key, param){ + var + buf = caml_call1(Stdlib_Domain[10][2], key), + len = Stdlib_Buffer[7].call(null, buf), + str = Stdlib_Buffer[2].call(null, buf); + Stdlib[69].call(null, oc, str, 0, len); + Stdlib[63].call(null, oc); + return Stdlib_Buffer[8].call(null, buf); + } + var + std_buf_key = + caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){return Stdlib_Buffer[1].call(null, pp_buffer_size);}), + err_buf_key = + caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){return Stdlib_Buffer[1].call(null, pp_buffer_size);}), + std_formatter_key = + caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){ + var + a = Stdlib[39], + ppf = + pp_make_formatter + (function(a, b, c){ + return buffered_out_string(std_buf_key, a, b, c); + }, + function(b){return buffered_out_flush(a, std_buf_key, b);}, + function(a){return 0;}, + function(a){return 0;}, + function(a){return 0;}); + ppf[19] = function(a){return display_newline(ppf, a);}; + ppf[20] = function(a){return display_blanks(ppf, a);}; + ppf[21] = function(a){return display_blanks(ppf, a);}; + Stdlib_Domain[6].call + (null, function(a){return pp_print_flush(ppf, a);}); + return ppf; + }); + caml_call2(Stdlib_Domain[10][3], std_formatter_key, std_formatter); + var + err_formatter_key = + caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){ + var + a = Stdlib[40], + ppf = + pp_make_formatter + (function(a, b, c){ + return buffered_out_string(err_buf_key, a, b, c); + }, + function(b){return buffered_out_flush(a, err_buf_key, b);}, + function(a){return 0;}, + function(a){return 0;}, + function(a){return 0;}); + ppf[19] = function(a){return display_newline(ppf, a);}; + ppf[20] = function(a){return display_blanks(ppf, a);}; + ppf[21] = function(a){return display_blanks(ppf, a);}; + Stdlib_Domain[6].call + (null, function(a){return pp_print_flush(ppf, a);}); + return ppf; + }); + caml_call2(Stdlib_Domain[10][3], err_formatter_key, err_formatter); + function get_std_formatter(param){ + return caml_call1(Stdlib_Domain[10][2], std_formatter_key); + } + function get_err_formatter(param){ + return caml_call1(Stdlib_Domain[10][2], err_formatter_key); + } + function get_str_formatter(param){ + return caml_call1(Stdlib_Domain[10][2], str_formatter_key); + } + function get_stdbuf(param){ + return caml_call1(Stdlib_Domain[10][2], stdbuf_key); + } + function flush_buffer_formatter(buf, ppf){ + pp_flush_queue(ppf, 0); + var s = Stdlib_Buffer[2].call(null, buf); + Stdlib_Buffer[9].call(null, buf); + return s; + } + function flush_str_formatter(param){ + var + stdbuf = caml_call1(Stdlib_Domain[10][2], stdbuf_key), + str_formatter = caml_call1(Stdlib_Domain[10][2], str_formatter_key); + return flush_buffer_formatter(stdbuf, str_formatter); + } + function make_synchronized_formatter(output, flush){ + return caml_call2 + (Stdlib_Domain[10][1], + 0, + function(param){ + var + buf = Stdlib_Buffer[1].call(null, pp_buffer_size), + a = Stdlib_Buffer[18]; + function output$0(b, c, d){return a(buf, b, c, d);} + function flush$0(param){ + var a = Stdlib_Buffer[7].call(null, buf); + caml_call3(output, Stdlib_Buffer[2].call(null, buf), 0, a); + Stdlib_Buffer[8].call(null, buf); + return caml_call1(flush, 0); + } + return make_formatter(output$0, flush$0); + }); + } + function synchronized_formatter_of_out_(oc){ + var a = Stdlib[69]; + return make_synchronized_formatter + (function(b, c, d){return a(oc, b, c, d);}, + function(param){return Stdlib[63].call(null, oc);}); + } + function make_symbolic_output_buffer(param){return [0, 0];} + function clear_symbolic_output_buffer(sob){sob[1] = 0; return 0;} + function get_symbolic_output_buffer(sob){ + return Stdlib_List[10].call(null, sob[1]); + } + function flush_symbolic_output_buffer(sob){ + var items = get_symbolic_output_buffer(sob); + clear_symbolic_output_buffer(sob); + return items; + } + function add_symbolic_output_item(sob, item){sob[1] = [0, item, sob[1]]; return 0; + } + function formatter_of_symbolic_output_b(sob){ + function f(s, i, n){ + return add_symbolic_output_item + (sob, [0, Stdlib_String[16].call(null, s, i, n)]); + } + function g(param){return add_symbolic_output_item(sob, 0);} + function h(param){return add_symbolic_output_item(sob, 1);} + function i(n){return add_symbolic_output_item(sob, [1, n]);} + function j(n){return add_symbolic_output_item(sob, [2, n]);} + return pp_make_formatter(f, g, h, i, j); + } + function open_hbox(v){ + return pp_open_hbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_vbox(v){ + return pp_open_vbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_hvbox(v){ + return pp_open_hvbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_hovbox(v){ + return pp_open_hovbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_box(v){ + return pp_open_box(caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function close_box(v){ + return pp_close_box + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_stag(v){ + return pp_open_stag + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function close_stag(v){ + return pp_close_stag + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_as(isize, w){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return pp_print_as_size(state, isize, w); + } + function print_string(v){ + return pp_print_string + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_bytes(v){ + return pp_print_bytes + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_int(v){ + return pp_print_int + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_float(v){ + return pp_print_float + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_char(v){ + return pp_print_char + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_bool(v){ + return pp_print_bool + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_break(v, w){ + return pp_print_break + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v, w); + } + function print_cut(v){ + return pp_print_cut + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_space(v){ + return pp_print_space + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function force_newline(v){ + return pp_force_newline + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_flush(v){ + return pp_print_flush + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_newline(v){ + return pp_print_newline + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_if_newline(v){ + return pp_print_if_newline + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function open_tbox(v){ + return pp_open_tbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function close_tbox(v){ + return pp_close_tbox + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_tbreak(v, w){ + return pp_print_tbreak + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v, w); + } + function set_tab(v){ + return pp_set_tab(caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function print_tab(v){ + return pp_print_tab + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_margin(v){ + return pp_set_margin + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_margin(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[6]; + } + function set_max_indent(v){ + return pp_set_max_indent + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_max_indent(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[8]; + } + function set_geometry(max_indent, margin){ + return pp_set_geometry + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), + max_indent, + margin); + } + function safe_set_geometry(max_indent, margin){ + return pp_safe_set_geometry + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), + max_indent, + margin); + } + function get_geometry(v){ + return pp_get_geometry + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function update_geometry(v){ + return pp_update_geometry + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_max_boxes(v){ + return pp_set_max_boxes + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_max_boxes(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[15]; + } + function over_max_boxes(v){ + return pp_over_max_boxes + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_ellipsis_text(v){ + return pp_set_ellipsis_text + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_ellipsis_text(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[16]; + } + function set_formatter_out_channel(v){ + return pp_set_formatter_out_channel + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_formatter_out_functions(v){ + return pp_set_formatter_out_functions + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_formatter_out_functions(v){ + return pp_get_formatter_out_functions + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_formatter_output_functions(v, w){ + return pp_set_formatter_output_functi + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v, w); + } + function get_formatter_output_functions(v){ + return pp_get_formatter_output_functi + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_formatter_stag_functions(v){ + return pp_set_formatter_stag_function + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_formatter_stag_functions(v){ + return pp_get_formatter_stag_function + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function set_print_tags(v){ + return pp_set_print_tags + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_print_tags(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[22]; + } + function set_mark_tags(v){ + return pp_set_mark_tags + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function get_mark_tags(v){ + var state = caml_call1(Stdlib_Domain[10][2], std_formatter_key); + return state[23]; + } + function set_tags(v){ + return pp_set_tags(caml_call1(Stdlib_Domain[10][2], std_formatter_key), v); + } + function pp_print_iter(opt, iter, pp_v, ppf, v){ + var pp_sep = opt ? opt[1] : pp_print_cut, is_first = [0, 1]; + function pp_v$0(v){ + if(is_first[1]) is_first[1] = 0; else caml_call2(pp_sep, ppf, 0); + return caml_call2(pp_v, ppf, v); + } + return caml_call2(iter, pp_v$0, v); + } + function pp_print_list(opt, pp_v, ppf, v){ + var pp_sep = opt ? opt[1] : pp_print_cut; + return pp_print_iter([0, pp_sep], Stdlib_List[18], pp_v, ppf, v); + } + function pp_print_array(opt, pp_v, ppf, v){ + var pp_sep = opt ? opt[1] : pp_print_cut; + return pp_print_iter([0, pp_sep], Stdlib_Array[12], pp_v, ppf, v); + } + function pp_print_seq(opt, pp_v, ppf, seq){ + var pp_sep = opt ? opt[1] : pp_print_cut; + return pp_print_iter([0, pp_sep], Stdlib_Seq[4], pp_v, ppf, seq); + } + function pp_print_text(ppf, s){ + var len = caml_ml_string_length(s), left = [0, 0], right = [0, 0]; + function flush(param){ + pp_print_string + (ppf, Stdlib_String[16].call(null, s, left[1], right[1] - left[1] | 0)); + right[1]++; + left[1] = right[1]; + return 0; + } + for(;;){ + if(right[1] === len){ + var a = left[1] !== len ? 1 : 0; + return a ? flush(0) : a; + } + var match = runtime.caml_string_get(s, right[1]); + if(10 === match){ + flush(0); + pp_force_newline(ppf, 0); + } + else if(32 === match){flush(0); pp_print_space(ppf, 0);} else right[1]++; + } + } + function pp_print_option(opt, pp_v, ppf, param){ + var none = opt ? opt[1] : function(a, param){return 0;}; + if(! param) return caml_call2(none, ppf, 0); + var v = param[1]; + return caml_call2(pp_v, ppf, v); + } + function pp_print_result(ok, error, ppf, param){ + if(0 === param[0]){var v = param[1]; return caml_call2(ok, ppf, v);} + var e = param[1]; + return caml_call2(error, ppf, e); + } + function pp_print_either(left, right, ppf, param){ + if(0 === param[0]){var l = param[1]; return caml_call2(left, ppf, l);} + var r = param[1]; + return caml_call2(right, ppf, r); + } + function compute_tag(output, tag_acc){ + var buf = Stdlib_Buffer[1].call(null, 16), ppf = formatter_of_buffer(buf); + caml_call2(output, ppf, tag_acc); + pp_print_flush(ppf, 0); + var len = Stdlib_Buffer[7].call(null, buf); + return 2 <= len + ? Stdlib_Buffer[4].call(null, buf, 1, len - 2 | 0) + : Stdlib_Buffer[2].call(null, buf); + } + function output_formatting_lit(ppf, fmting_lit){ + if(typeof fmting_lit === "number") + switch(fmting_lit){ + case 0: + return pp_close_box(ppf, 0); + case 1: + return pp_close_stag(ppf, 0); + case 2: + return pp_print_flush(ppf, 0); + case 3: + return pp_force_newline(ppf, 0); + case 4: + return pp_print_newline(ppf, 0); + case 5: + return pp_print_char(ppf, 64); + default: return pp_print_char(ppf, 37); + } + switch(fmting_lit[0]){ + case 0: + var offset = fmting_lit[3], width = fmting_lit[2]; + return pp_print_break(ppf, width, offset); + case 1: + return 0; + default: + var c = fmting_lit[1]; + pp_print_char(ppf, 64); + return pp_print_char(ppf, c); + } + } + function output_acc(ppf, acc){ + if(typeof acc === "number") return 0; + a: + { + b: + { + c: + { + switch(acc[0]){ + case 0: + var f = acc[2], p = acc[1]; + output_acc(ppf, p); + return output_formatting_lit(ppf, f); + case 1: + var match = acc[2], p$0 = acc[1]; + if(0 === match[0]){ + var acc$0 = match[1]; + output_acc(ppf, p$0); + return pp_open_stag + (ppf, [0, String_tag, compute_tag(output_acc, acc$0)]); + } + var acc$1 = match[1]; + output_acc(ppf, p$0); + var + k = compute_tag(output_acc, acc$1), + match$0 = CamlinternalFormat[20].call(null, k), + bty = match$0[2], + indent = match$0[1]; + return pp_open_box_gen(ppf, indent, bty); + case 2: + var a = acc[1]; + if(typeof a !== "number" && 0 === a[0]){ + var g = a[2]; + if(typeof g !== "number" && 1 === g[0]){ + var s$0 = acc[2], size = g[2], p$2 = a[1]; + break a; + } + } + var s = acc[2], p$1 = a; + break b; + case 3: + var b = acc[1]; + if(typeof b !== "number" && 0 === b[0]){ + var h = b[2]; + if(typeof h !== "number" && 1 === h[0]){ + var c$0 = acc[2], size$0 = h[2], p$4 = b[1]; + break c; + } + } + var c = acc[2], p$3 = b; + break; + case 4: + var d = acc[1]; + if(typeof d !== "number" && 0 === d[0]){ + var i = d[2]; + if(typeof i !== "number" && 1 === i[0]){ + var s$0 = acc[2], size = i[2], p$2 = d[1]; + break a; + } + } + var s = acc[2], p$1 = d; + break b; + case 5: + var e = acc[1]; + if(typeof e !== "number" && 0 === e[0]){ + var j = e[2]; + if(typeof j !== "number" && 1 === j[0]){ + var c$0 = acc[2], size$0 = j[2], p$4 = e[1]; + break c; + } + } + var c = acc[2], p$3 = e; + break; + case 6: + var f$0 = acc[2], p$5 = acc[1]; + output_acc(ppf, p$5); + return caml_call1(f$0, ppf); + case 7: + var p$6 = acc[1]; + output_acc(ppf, p$6); + return pp_print_flush(ppf, 0); + default: + var msg = acc[2], p$7 = acc[1]; + output_acc(ppf, p$7); + return Stdlib[1].call(null, msg); + } + output_acc(ppf, p$3); + return pp_print_char(ppf, c); + } + output_acc(ppf, p$4); + return pp_print_as_size + (ppf, size$0, Stdlib_String[1].call(null, 1, c$0)); + } + output_acc(ppf, p$1); + return pp_print_string(ppf, s); + } + output_acc(ppf, p$2); + return pp_print_as_size(ppf, size, s$0); + } + function strput_acc(ppf, acc){ + if(typeof acc === "number") return 0; + a: + { + b: + { + c: + { + switch(acc[0]){ + case 0: + var f = acc[2], p = acc[1]; + strput_acc(ppf, p); + return output_formatting_lit(ppf, f); + case 1: + var match = acc[2], p$0 = acc[1]; + if(0 === match[0]){ + var acc$0 = match[1]; + strput_acc(ppf, p$0); + return pp_open_stag + (ppf, [0, String_tag, compute_tag(strput_acc, acc$0)]); + } + var acc$1 = match[1]; + strput_acc(ppf, p$0); + var + k = compute_tag(strput_acc, acc$1), + match$0 = CamlinternalFormat[20].call(null, k), + bty = match$0[2], + indent = match$0[1]; + return pp_open_box_gen(ppf, indent, bty); + case 2: + var a = acc[1]; + if(typeof a !== "number" && 0 === a[0]){ + var g = a[2]; + if(typeof g !== "number" && 1 === g[0]){ + var s$0 = acc[2], size = g[2], p$2 = a[1]; + break a; + } + } + var s = acc[2], p$1 = a; + break b; + case 3: + var b = acc[1]; + if(typeof b !== "number" && 0 === b[0]){ + var h = b[2]; + if(typeof h !== "number" && 1 === h[0]){ + var c$0 = acc[2], size$0 = h[2], p$4 = b[1]; + break c; + } + } + var c = acc[2], p$3 = b; + break; + case 4: + var d = acc[1]; + if(typeof d !== "number" && 0 === d[0]){ + var i = d[2]; + if(typeof i !== "number" && 1 === i[0]){ + var s$0 = acc[2], size = i[2], p$2 = d[1]; + break a; + } + } + var s = acc[2], p$1 = d; + break b; + case 5: + var e = acc[1]; + if(typeof e !== "number" && 0 === e[0]){ + var j = e[2]; + if(typeof j !== "number" && 1 === j[0]){ + var c$0 = acc[2], size$0 = j[2], p$4 = e[1]; + break c; + } + } + var c = acc[2], p$3 = e; + break; + case 6: + var p$5 = acc[1]; + if(typeof p$5 !== "number" && 0 === p$5[0]){ + var match$1 = p$5[2]; + if(typeof match$1 !== "number" && 1 === match$1[0]){ + var f$1 = acc[2], size$1 = match$1[2], p$6 = p$5[1]; + strput_acc(ppf, p$6); + return pp_print_as_size(ppf, size$1, caml_call1(f$1, 0)); + } + } + var f$0 = acc[2]; + strput_acc(ppf, p$5); + return pp_print_string(ppf, caml_call1(f$0, 0)); + case 7: + var p$7 = acc[1]; + strput_acc(ppf, p$7); + return pp_print_flush(ppf, 0); + default: + var msg = acc[2], p$8 = acc[1]; + strput_acc(ppf, p$8); + return Stdlib[1].call(null, msg); + } + strput_acc(ppf, p$3); + return pp_print_char(ppf, c); + } + strput_acc(ppf, p$4); + return pp_print_as_size + (ppf, size$0, Stdlib_String[1].call(null, 1, c$0)); + } + strput_acc(ppf, p$1); + return pp_print_string(ppf, s); + } + strput_acc(ppf, p$2); + return pp_print_as_size(ppf, size, s$0); + } + function kfprintf(k, ppf, param){ + var fmt = param[1]; + return CamlinternalFormat[7].call + (null, + function(acc){output_acc(ppf, acc); return caml_call1(k, ppf);}, + 0, + fmt); + } + function ikfprintf(k, ppf, param){ + var fmt = param[1]; + return CamlinternalFormat[8].call(null, k, ppf, fmt); + } + function ifprintf(ppf, param){ + var fmt = param[1]; + return CamlinternalFormat[8].call(null, function(a){return 0;}, 0, fmt); + } + function fprintf(ppf){ + function a(a){return 0;} + return function(b){return kfprintf(a, ppf, b);}; + } + function printf(param){ + var fmt = param[1]; + return CamlinternalFormat[7].call + (null, + function(acc){ + return output_acc + (caml_call1(Stdlib_Domain[10][2], std_formatter_key), acc); + }, + 0, + fmt); + } + function eprintf(param){ + var fmt = param[1]; + return CamlinternalFormat[7].call + (null, + function(acc){ + return output_acc + (caml_call1(Stdlib_Domain[10][2], err_formatter_key), acc); + }, + 0, + fmt); + } + function kdprintf(k, param){ + var fmt = param[1]; + return CamlinternalFormat[7].call + (null, + function(acc){ + return caml_call1 + (k, function(ppf){return output_acc(ppf, acc);}); + }, + 0, + fmt); + } + function dprintf(fmt){return kdprintf(function(i){return i;}, fmt);} + function ksprintf(k, param){ + var fmt = param[1], b = pp_make_buffer(0), ppf = formatter_of_buffer(b); + function k$0(acc){ + strput_acc(ppf, acc); + return caml_call1(k, flush_buffer_formatter(b, ppf)); + } + return CamlinternalFormat[7].call(null, k$0, 0, fmt); + } + function sprintf(fmt){return ksprintf(id, fmt);} + function kasprintf(k, param){ + var fmt = param[1], b = pp_make_buffer(0), ppf = formatter_of_buffer(b); + function k$0(acc){ + output_acc(ppf, acc); + return caml_call1(k, flush_buffer_formatter(b, ppf)); + } + return CamlinternalFormat[7].call(null, k$0, 0, fmt); + } + function asprintf(fmt){return kasprintf(id, fmt);} + function flush_standard_formatters(param){ + pp_print_flush(caml_call1(Stdlib_Domain[10][2], std_formatter_key), 0); + return pp_print_flush + (caml_call1(Stdlib_Domain[10][2], err_formatter_key), 0); + } + Stdlib[100].call(null, flush_standard_formatters); + Stdlib_Domain[5].call + (null, + function(param){ + flush_standard_formatters(0); + var + fs = pp_get_formatter_out_functions(std_formatter, 0), + a = Stdlib[39]; + pp_set_formatter_out_functions + (std_formatter, + [0, + function(a, b, c){return buffered_out_string(std_buf_key, a, b, c);}, + function(b){return buffered_out_flush(a, std_buf_key, b);}, + fs[3], + fs[4], + fs[5]]); + var + fs$0 = pp_get_formatter_out_functions(err_formatter, 0), + b = Stdlib[40]; + return pp_set_formatter_out_functions + (err_formatter, + [0, + function(a, b, c){ + return buffered_out_string(err_buf_key, a, b, c); + }, + function(a){return buffered_out_flush(b, err_buf_key, a);}, + fs$0[3], + fs$0[4], + fs$0[5]]); + }); + runtime.caml_register_global + (38, + [0, + pp_open_box, + open_box, + pp_close_box, + close_box, + pp_open_hbox, + open_hbox, + pp_open_vbox, + open_vbox, + pp_open_hvbox, + open_hvbox, + pp_open_hovbox, + open_hovbox, + pp_print_string, + print_string, + pp_print_bytes, + print_bytes, + pp_print_as, + print_as, + pp_print_int, + print_int, + pp_print_float, + print_float, + pp_print_char, + print_char, + pp_print_bool, + print_bool, + pp_print_nothing, + pp_print_space, + print_space, + pp_print_cut, + print_cut, + pp_print_break, + print_break, + pp_print_custom_break, + pp_force_newline, + force_newline, + pp_print_if_newline, + print_if_newline, + pp_print_flush, + print_flush, + pp_print_newline, + print_newline, + pp_infinity, + pp_set_margin, + set_margin, + pp_get_margin, + get_margin, + pp_set_max_indent, + set_max_indent, + pp_get_max_indent, + get_max_indent, + check_geometry, + pp_set_geometry, + set_geometry, + pp_safe_set_geometry, + safe_set_geometry, + pp_update_geometry, + update_geometry, + pp_get_geometry, + get_geometry, + pp_set_max_boxes, + set_max_boxes, + pp_get_max_boxes, + get_max_boxes, + pp_over_max_boxes, + over_max_boxes, + pp_open_tbox, + open_tbox, + pp_close_tbox, + close_tbox, + pp_set_tab, + set_tab, + pp_print_tab, + print_tab, + pp_print_tbreak, + print_tbreak, + pp_set_ellipsis_text, + set_ellipsis_text, + pp_get_ellipsis_text, + get_ellipsis_text, + String_tag, + pp_open_stag, + open_stag, + pp_close_stag, + close_stag, + pp_set_tags, + set_tags, + pp_set_print_tags, + set_print_tags, + pp_set_mark_tags, + set_mark_tags, + pp_get_print_tags, + get_print_tags, + pp_get_mark_tags, + get_mark_tags, + pp_set_formatter_out_channel, + set_formatter_out_channel, + pp_set_formatter_output_functi, + set_formatter_output_functions, + pp_get_formatter_output_functi, + get_formatter_output_functions, + pp_set_formatter_out_functions, + set_formatter_out_functions, + pp_get_formatter_out_functions, + get_formatter_out_functions, + pp_set_formatter_stag_function, + set_formatter_stag_functions, + pp_get_formatter_stag_function, + get_formatter_stag_functions, + formatter_of_out_channel, + synchronized_formatter_of_out_, + std_formatter, + get_std_formatter, + err_formatter, + get_err_formatter, + formatter_of_buffer, + stdbuf, + get_stdbuf, + str_formatter, + get_str_formatter, + flush_str_formatter, + make_formatter, + make_synchronized_formatter, + formatter_of_out_functions, + make_symbolic_output_buffer, + clear_symbolic_output_buffer, + get_symbolic_output_buffer, + flush_symbolic_output_buffer, + add_symbolic_output_item, + formatter_of_symbolic_output_b, + pp_print_iter, + pp_print_list, + pp_print_array, + pp_print_seq, + pp_print_text, + pp_print_option, + pp_print_result, + pp_print_either, + fprintf, + printf, + eprintf, + sprintf, + asprintf, + dprintf, + ifprintf, + kfprintf, + kdprintf, + ikfprintf, + ksprintf, + kasprintf], + "Stdlib__Format"); + 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)); + +//# 26283 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__ListLabels:[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, + Stdlib_List = runtime.caml_get_global_data().Stdlib__List, + length = Stdlib_List[1], + compare_lengths = Stdlib_List[2], + compare_length_with = Stdlib_List[3], + is_empty = Stdlib_List[4], + cons = Stdlib_List[5], + hd = Stdlib_List[6], + tl = Stdlib_List[7], + nth = Stdlib_List[8], + nth_opt = Stdlib_List[9], + rev = Stdlib_List[10], + init = Stdlib_List[11], + append = Stdlib_List[12], + rev_append = Stdlib_List[13], + concat = Stdlib_List[14], + flatten = Stdlib_List[15], + equal = Stdlib_List[16], + compare = Stdlib_List[17], + iter = Stdlib_List[18], + iteri = Stdlib_List[19], + map = Stdlib_List[20], + mapi = Stdlib_List[21], + rev_map = Stdlib_List[22], + filter_map = Stdlib_List[23], + concat_map = Stdlib_List[24], + fold_left_map = Stdlib_List[25], + fold_left = Stdlib_List[26], + fold_right = Stdlib_List[27], + iter2 = Stdlib_List[28], + map2 = Stdlib_List[29], + rev_map2 = Stdlib_List[30], + fold_left2 = Stdlib_List[31], + fold_right2 = Stdlib_List[32], + for_all = Stdlib_List[33], + exists = Stdlib_List[34], + for_all2 = Stdlib_List[35], + exists2 = Stdlib_List[36], + mem = Stdlib_List[37], + memq = Stdlib_List[38], + find = Stdlib_List[39], + find_opt = Stdlib_List[40], + find_index = Stdlib_List[41], + find_map = Stdlib_List[42], + find_mapi = Stdlib_List[43], + filter = Stdlib_List[44], + find_all = Stdlib_List[45], + filteri = Stdlib_List[46], + partition = Stdlib_List[47], + partition_map = Stdlib_List[48], + assoc = Stdlib_List[49], + assoc_opt = Stdlib_List[50], + assq = Stdlib_List[51], + assq_opt = Stdlib_List[52], + mem_assoc = Stdlib_List[53], + mem_assq = Stdlib_List[54], + remove_assoc = Stdlib_List[55], + remove_assq = Stdlib_List[56], + split = Stdlib_List[57], + combine = Stdlib_List[58], + sort = Stdlib_List[59], + stable_sort = Stdlib_List[60], + fast_sort = Stdlib_List[61], + sort_uniq = Stdlib_List[62], + merge = Stdlib_List[63], + to_seq = Stdlib_List[64], + of_seq = Stdlib_List[65]; + runtime.caml_register_global + (1, + [0, + length, + compare_lengths, + compare_length_with, + is_empty, + cons, + hd, + tl, + nth, + nth_opt, + rev, + init, + append, + rev_append, + concat, + 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, + filter, + find_all, + filteri, + partition, + partition_map, + assoc, + assoc_opt, + assq, + assq_opt, + mem_assoc, + mem_assq, + remove_assoc, + remove_assq, + split, + combine, + sort, + stable_sort, + fast_sort, + sort_uniq, + merge, + to_seq, + of_seq], + "Stdlib__ListLabels"); + return; + } + (globalThis)); + +//# 16 "../.js/default/re/re.cma.js" +//# shape: Re__Fmt:[F(4),F(2),F(2),F(3),F(2),F(2),F(2),F(4),F(5),F(4),F(2),F(4),F(3),F(2),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]); + } + 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_Format = global_data.Stdlib__Format, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Array = global_data.Stdlib__Array, + pp_print_string = Stdlib_Format[13], + pp_print_int = Stdlib_Format[19], + pp_print_space = Stdlib_Format[28], + pp_print_list = Stdlib_Format[132], + fprintf = Stdlib_Format[139]; + function array(pp_sep, f, fmt, arr){ + return pp_print_list(pp_sep, f, fmt, Stdlib_Array[10].call(null, arr)); + } + var + cst_3 = "<3>", + cst = "@ ", + a = + [0, + [18, + [1, [0, [11, cst_3, 0], cst_3]], + [12, 40, [2, 0, [17, [0, cst, 1, 0], [15, [12, 41, [17, 0, 0]]]]]]], + "@[<3>(%s@ %a)@]"]; + function sexp(fmt, s, pp, x){return caml_call3(fprintf(fmt)(a), s, pp, x);} + var cst_S = "%S", b = [0, [3, 0, 0], cst_S]; + function bytes(fmt, t){ + var a = Stdlib_Bytes[6].call(null, t); + return caml_call1(Stdlib_Format[139].call(null, fmt)(b), a); + } + function pair(pp1, pp2, fmt, param){ + var v2 = param[2], v1 = param[1]; + caml_call2(pp1, fmt, v1); + pp_print_space(fmt, 0); + return caml_call2(pp2, fmt, v2); + } + function triple(pp1, pp2, pp3, fmt, param){ + var v3 = param[3], v2 = param[2], v1 = param[1]; + caml_call2(pp1, fmt, v1); + pp_print_space(fmt, 0); + caml_call2(pp2, fmt, v2); + pp_print_space(fmt, 0); + return caml_call2(pp3, fmt, v3); + } + var c = [0, [15, 0], "%a"]; + function opt(f, fmt, x){ + if(! x) return pp_print_string(fmt, ""); + var x$0 = x[1]; + return caml_call2(fprintf(fmt)(c), f, x$0); + } + var d = [0, [17, [0, cst, 1, 0], [4, 0, 0, 0, 0]], "@ %d"]; + function optint(fmt, param){ + if(! param) return 0; + var i = param[1]; + return caml_call1(fprintf(fmt)(d), i); + } + var e = [0, [0, 0], "%c"]; + function char(fmt, c){ + return caml_call1(Stdlib_Format[139].call(null, fmt)(e), c); + } + var bool = Stdlib_Format[25]; + function lit(s, fmt, param){return pp_print_string(fmt, s);} + function to_to_string(pp, x){ + var + b = Stdlib_Buffer[1].call(null, 16), + fmt = Stdlib_Format[116].call(null, b); + caml_call2(pp, fmt, x); + return Stdlib_Buffer[2].call(null, b); + } + var f = [0, [3, 0, 0], cst_S]; + function quoted_string(fmt, s){ + return caml_call1(Stdlib_Format[139].call(null, fmt)(f), s); + } + runtime.caml_register_global + (11, + [0, + sexp, + pp_print_string, + optint, + opt, + char, + bool, + pp_print_int, + pair, + triple, + pp_print_list, + bytes, + array, + lit, + to_to_string, + quoted_string], + "Re__Fmt"); + return; + } + (globalThis)); + +//# 133 "../.js/default/re/re.cma.js" +//# shape: Re__Bit_vector:[F(1)*,F(3),F(1),F(2),F(1),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_unsafe_get = runtime.caml_bytes_unsafe_get; + 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(), + Re_Fmt = global_data.Re__Fmt, + Stdlib_Format = global_data.Stdlib__Format, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib = global_data.Stdlib, + Stdlib_Char = global_data.Stdlib__Char; + function length(t){return t[1];} + function set(v, n, b){ + var a = n < 0, d = a || v[1] <= n; + if(d) Stdlib[1].call(null, "Bit_vector.set"); + var + i = n >>> 3 | 0, + s = v[2], + c = caml_bytes_unsafe_get(s, i), + mask = 1 << (n & 7), + x = b ? c | mask : c & Stdlib[21].call(null, mask), + s$0 = v[2]; + runtime.caml_bytes_unsafe_set(s$0, i, Stdlib_Char[1].call(null, x)); + return 0; + } + function get(v, n){ + var a = n < 0, b = a || v[1] <= n; + if(b) Stdlib[1].call(null, "Bit_vector.get"); + var i = n >>> 3 | 0, s = v[2]; + return 0 < (caml_bytes_unsafe_get(s, i) & 1 << (n & 7)) ? 1 : 0; + } + function reset_zero(t){ + return Stdlib_Bytes[10].call + (null, t[2], 0, runtime.caml_ml_bytes_length(t[2]), 0); + } + function create_zero(len){ + var + r = len & 7, + q = len >>> 3 | 0, + len$0 = 0 === r ? q : q + 1 | 0, + bits = Stdlib_Bytes[1].call(null, len$0, 0); + return [0, len, bits]; + } + var a = [0, [15, [17, 4, [15, [17, 4, 0]]]], "%a@.%a@."]; + function pp(fmt, param){ + var bits = param[2], len = param[1]; + function len$0(fmt, param){ + return Re_Fmt[1].call(null, fmt, "len", Re_Fmt[7], len); + } + function bits$0(fmt, param){ + return Re_Fmt[1].call(null, fmt, "bits", Re_Fmt[11], bits); + } + return caml_call4 + (Stdlib_Format[139].call(null, fmt)(a), len$0, 0, bits$0, 0); + } + runtime.caml_register_global + (10, [0, length, set, create_zero, get, reset_zero, pp], "Re__Bit_vector"); + return; + } + (globalThis)); + +//# 203 "../.js/default/re/re.cma.js" +//# shape: Re__Dyn:[F(2)*,F(1)*,F(1)*,F(2)*,F(1)*,F(1)*,F(1)*,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]); + } + function variant(x, y){return [5, x, y];} + function list(x){return [4, x];} + function int(x){return [0, x];} + function pair(x, y){return [1, [0, x, [0, y, 0]]];} + function record(fields){return [6, fields];} + function enum$(x){return [2, x];} + function string(s){return [3, s];} + function result(ok, err, param){ + if(0 === param[0]){ + var s = param[1], y = [0, caml_call1(ok, s), 0]; + return [5, "Ok", y]; + } + var e = param[1], y$0 = [0, caml_call1(err, e), 0]; + return [5, "Error", y$0]; + } + function option(f, param){ + if(! param) return [2, "None"]; + var s = param[1], y = [0, caml_call1(f, s), 0]; + return [5, "Some", y]; + } + runtime.caml_register_global + (4, + [0, variant, list, int, pair, record, enum$, string, result, option], + "Re__Dyn"); + return; + } + (globalThis)); + +//# 243 "../.js/default/re/re.cma.js" +//# shape: Re__Category:[F(2)*,F(1)*,N,N,N,N,N,N,N,F(1)*,F(2)*,F(2)*,F(2)*,F(2),F(1)*] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + global_data = runtime.caml_get_global_data(), + Stdlib_Format = global_data.Stdlib__Format, + Re_Dyn = global_data.Re__Dyn; + function equal(x, y){return x === y ? 1 : 0;} + var compare = runtime.caml_int_compare; + function to_int(x){return x;} + var pp = Stdlib_Format[19]; + function intersect(x, y){return 0 !== (x & y) ? 1 : 0;} + function symbol(x, y){return x | y;} + var to_dyn = Re_Dyn[3], letter = 2, not_letter = 4; + function from_char(param){ + a: + { + if(170 <= param) + if(187 <= param){ + var a = param - 192 | 0; + if(54 < a >>> 0){if(56 > a) break a;} else if(23 === a) break a; + } + else{var c = param - 171 | 0; if(14 >= c >>> 0 && 10 !== c) break a;} + else if(65 <= param){ + var b = param - 91 | 0; + if(5 < b >>> 0){if(32 <= b) break a;} else if(4 !== b) break a; + } + else{ + if(48 > param){if(10 === param) return 12; break a;} + if(58 <= param) break a; + } + return letter; + } + return not_letter; + } + runtime.caml_register_global + (2, + [0, + symbol, + from_char, + -1, + 1, + letter, + not_letter, + 8, + 16, + 32, + to_int, + equal, + compare, + intersect, + pp, + to_dyn], + "Re__Category"); + return; + } + (globalThis)); + +//# 305 "../.js/default/re/re.cma.js" +//# shape: Re__Dense_map:[F(2)->F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + Stdlib_Array = runtime.caml_get_global_data().Stdlib__Array; + function make(size, f){ + var cache = Stdlib_Array[1].call(null, size, f); + return function(i){return runtime.caml_check_bound(cache, i)[i + 1];}; + } + runtime.caml_register_global(1, [0, make], "Re__Dense_map"); + return; + } + (globalThis)); + +//# 323 "../.js/default/re/re.cma.js" +//# shape: Re__Import:[[F(2),F(2)],[F(2)*],F(2)*,N,F(2)*,F(2)*,F(2)*,F(2)*,F(2)*,[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, + global_data = runtime.caml_get_global_data(); + global_data.Stdlib__Hashtbl; + var + Stdlib_Int = global_data.Stdlib__Int, + equal = runtime.caml_equal, + compare = runtime.caml_compare; + function equal$0(b, a){return b === a ? 1 : 0;} + var symbol = Stdlib_Int[8]; + function symbol$0(x, y){return x < y ? 1 : 0;} + function symbol$1(x, y){return y < x ? 1 : 0;} + var + min = Stdlib_Int[10], + max = Stdlib_Int[11], + compare$0 = Stdlib_Int[9], + zero = Stdlib_Int[1], + one = Stdlib_Int[2], + minus_one = Stdlib_Int[3], + abs = Stdlib_Int[4], + max_int = Stdlib_Int[5], + min_int = Stdlib_Int[6], + lognot = Stdlib_Int[7], + equal$1 = Stdlib_Int[8], + compare$1 = Stdlib_Int[9], + min$0 = Stdlib_Int[10], + max$0 = Stdlib_Int[11], + to_string = Stdlib_Int[12], + seeded_hash = Stdlib_Int[13], + hash = Stdlib_Int[14]; + runtime.caml_register_global + (3, + [0, + [0, equal, compare], + [0, equal$0], + symbol, + [0, 874682015, 0], + symbol$0, + symbol$1, + min, + max, + compare$0, + [0, + zero, + one, + minus_one, + abs, + max_int, + min_int, + lognot, + equal$1, + compare$1, + min$0, + max$0, + to_string, + seeded_hash, + hash]], + "Re__Import"); + return; + } + (globalThis)); + +//# 391 "../.js/default/re/re.cma.js" +//# shape: Re__Cset:[F(2)*,F(1)*,F(1)*,F(1),F(1)*,N,F(2),F(2),F(2),F(1),F(1),F(2),F(2),N,N,F(2),F(2),F(1),N,N,N,N,N,N,F(2),F(1),N,N,N,N,N,N,N,N,N,N,N,N,F(1)*->F(1),F(1)*,F(3),F(1),F(2),N,N,F(1),F(1)*,F(3),F(1),F(2),F(1)] +(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(), + Re_Import = global_data.Re__Import, + Stdlib = global_data.Stdlib, + Assert_failure = global_data.Assert_failure, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Re_Dyn = global_data.Re__Dyn, + Re_Fmt = global_data.Re__Fmt, + Stdlib_Format = global_data.Stdlib__Format, + Stdlib_Char = global_data.Stdlib__Char, + Re_Dense_map = global_data.Re__Dense_map, + Stdlib_Map = global_data.Stdlib__Map, + equal_c = Re_Import[10][8]; + function to_int(x){return x;} + function of_int(x){return x;} + function to_char(t){return Stdlib_Char[1].call(null, t);} + function of_char(c){return c;} + function compare_pair(a, param){ + var + y = param[2], + x = param[1], + y$0 = a[2], + x$0 = a[1], + x$1 = Re_Import[10][9].call(null, x$0, x); + return 0 === x$1 ? Re_Import[10][9].call(null, y$0, y) : x$1; + } + function equal_pair(b, param){ + var + y = param[2], + x = param[1], + y$0 = b[2], + x$0 = b[1], + a = Re_Import[10][8].call(null, x$0, x); + return a ? Re_Import[10][8].call(null, y$0, y) : a; + } + function equal(x, y){ + return Stdlib_ListLabels[16].call(null, equal_pair, x, y); + } + function compare(x, y){ + return Stdlib_ListLabels[17].call(null, compare_pair, x, y); + } + function union(l$3, l$4){ + var l$0 = l$3, l = l$4; + for(;;){ + if(! l) return l$0; + if(! l$0) return l; + var + r = l[2], + a = l[1], + c2 = a[2], + c1 = a[1], + r$0 = l$0[2], + match = l$0[1], + c2$0 = match[2], + c1$0 = match[1]; + if(Re_Import[5].call(null, c2$0 + 1 | 0, c1)) + return [0, [0, c1$0, c2$0], union(r$0, l)]; + if(Re_Import[5].call(null, c2 + 1 | 0, c1$0)) + return [0, [0, c1, c2], union(l$0, r)]; + if(Re_Import[5].call(null, c2$0, c2)){ + var l$1 = [0, [0, Re_Import[7].call(null, c1$0, c1), c2], r]; + l$0 = r$0; + l = l$1; + } + else{ + var l$2 = [0, [0, Re_Import[7].call(null, c1$0, c1), c2$0], r$0]; + l$0 = l$2; + l = r; + } + } + } + function inter(l$1, l$2){ + var l$0 = l$1, l = l$2; + for(;;){ + if(! l) return 0; + if(! l$0) return 0; + var + r = l[2], + a = l[1], + c2 = a[2], + c1 = a[1], + r$0 = l$0[2], + match = l$0[1], + c2$0 = match[2], + c1$0 = match[1]; + if(Re_Import[5].call(null, c2$0, c1)) + l$0 = r$0; + else{ + if(! Re_Import[5].call(null, c2, c1$0)){ + if(Re_Import[5].call(null, c2$0, c2)){ + var b = inter(r$0, l); + return [0, [0, Re_Import[8].call(null, c1$0, c1), c2$0], b]; + } + var c = inter(l$0, r); + return [0, [0, Re_Import[8].call(null, c1$0, c1), c2], c]; + } + l = r; + } + } + } + function diff(l$1, l$2){ + var l$0 = l$1, l = l$2; + for(;;){ + if(! l) return l$0; + if(! l$0) return 0; + var + r = l[2], + a = l[1], + c2 = a[2], + c1 = a[1], + r$0 = l$0[2], + match = l$0[1], + c2$0 = match[2], + c1$0 = match[1]; + if(Re_Import[5].call(null, c2$0, c1)) + return [0, [0, c1$0, c2$0], diff(r$0, l)]; + if(Re_Import[5].call(null, c2, c1$0)) + l = r; + else{ + var + r$1 = + Re_Import[5].call(null, c2, c2$0) + ? [0, [0, c2 + 1 | 0, c2$0], r$0] + : r$0; + if(Re_Import[5].call(null, c1$0, c1)) + return [0, [0, c1$0, c1 - 1 | 0], diff(r$1, r)]; + l$0 = r$1; + l = r; + } + } + } + function single(c){return [0, [0, c, c], 0];} + var single$0 = Re_Dense_map[1].call(null, 257, single); + function csingle(i){return caml_call1(single$0, i);} + function add(c, l){return union(caml_call1(single$0, c), l);} + function offset(o, l){ + if(! l) return 0; + var r = l[2], match = l[1], c2 = match[2], c1 = match[1]; + return [0, [0, c1 + o | 0, c2 + o | 0], offset(o, r)]; + } + var empty = 0; + function union_all(ts){ + return Stdlib_ListLabels[26].call(null, union, empty, ts); + } + var cany = [0, [0, 0, 255], 0]; + function intersect_all(ts){ + return Stdlib_ListLabels[26].call(null, inter, cany, ts); + } + function mem(c, s$0){ + var s = s$0; + for(;;){ + if(! s) return 0; + var rem = s[2], match = s[1], c2 = match[2], c1 = match[1]; + if(c <= c2) return c1 <= c ? 1 : 0; + s = rem; + } + } + function hash_rec(param){ + if(! param) return 0; + var r = param[2], match = param[1], j = match[2], i = match[1]; + return (i + (13 * j | 0) | 0) + (257 * hash_rec(r) | 0) | 0; + } + function hash(l){return hash_rec(l) & 1073741823;} + var + a = [0, [4, 0, 0, 0, 0], "%d"], + b = [0, [4, 0, 0, 0, [12, 45, [4, 0, 0, 0, 0]]], "%d-%d"]; + function print_one(ch, param){ + var c2 = param[2], c1 = param[1]; + return Re_Import[10][8].call(null, c1, c2) + ? caml_call1(Stdlib_Format[139].call(null, ch)(a), c1) + : caml_call2(Stdlib_Format[139].call(null, ch)(b), c1, c2); + } + function pp(ts){ + var + a = Re_Fmt[13], + b = [0, function(b, c){return a(", ", b, c);}], + c = Re_Fmt[10]; + return function(a){return c(b, print_one, ts, a);}; + } + function to_dyn(t){ + if(t && ! t[2]){ + var match = t[1], y = match[2], x = match[1]; + if(Re_Import[10][8].call(null, x, y)) return Re_Dyn[3].call(null, x); + } + var + a = + Stdlib_ListLabels[20].call + (null, + function(param){ + var + y = param[2], + x = param[1], + a = Re_Dyn[3].call(null, y), + b = Re_Dyn[3].call(null, x); + return Re_Dyn[4].call(null, b, a); + }, + t); + return Re_Dyn[2].call(null, a); + } + function iter(t$0, f){ + var t = t$0; + for(;;){ + if(! t) return 0; + var xs = t[2], match = t[1], y = match[2], x = match[1]; + caml_call2(f, x, y); + t = xs; + } + } + function one_char(param){ + if(param && ! param[2]){ + var match = param[1], j = match[2], i = match[1]; + if(Re_Import[10][8].call(null, i, j)) return [0, i]; + } + return 0; + } + function compare$0(a, param){ + var + v = param[2], + j = param[1], + u = a[2], + i = a[1], + c = Re_Import[10][9].call(null, i, j); + return 0 === c ? compare(u, v) : c; + } + var CSetMap = Stdlib_Map[1].call(null, [0, compare$0]); + function fold_right(t, init, f){ + return Stdlib_ListLabels[27].call + (null, + function(param, acc){ + var y = param[2], x = param[1]; + return caml_call3(f, x, y, acc); + }, + t, + init); + } + function is_empty(param){return param ? 0 : 1;} + var c = [0, "lib/cset.ml", 182, 9]; + function prepend(s$0, x$0, l){ + var s = s$0; + for(;;){ + if(! s) return l; + if(! l) return 0; + var b = l[1], a = b[1]; + if(a && ! a[2]){ + var + x = b[2], + e = a[1], + d = e[2], + d$0 = e[1], + r = s[2], + match = s[1], + c$0 = match[2], + c$1 = match[1]; + if(! Re_Import[5].call(null, c$0, d$0)) break; + s = r; + continue; + } + throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); + } + var r$0 = l[2]; + if(c$1 > d$0) + return Re_Import[6].call(null, c$1, d) + ? [0, [0, [0, [0, d$0, d], 0], x], prepend(s, x$0, r$0)] + : [0, + [0, [0, [0, d$0, c$1 - 1 | 0], 0], x], + prepend(s, x$0, [0, [0, [0, [0, c$1, d], 0], x], r$0])]; + if(Re_Import[5].call(null, c$0, d)){ + var f = prepend(r, x$0, [0, [0, [0, [0, c$0 + 1 | 0, d], 0], x], r$0]); + return [0, [0, [0, [0, d$0, c$0], 0], Stdlib[37].call(null, x$0, x)], f]; + } + var g = prepend(s, x$0, r$0); + return [0, [0, [0, [0, d$0, d], 0], Stdlib[37].call(null, x$0, x)], g]; + } + function pick(param){ + if(! param) return Stdlib[1].call(null, "Re_cset.pick"); + var x = param[1][1]; + return x; + } + function cseq(c$0, c){ + return runtime.caml_lessequal(c$0, c) + ? [0, [0, c$0, c], 0] + : [0, [0, c, c$0], 0]; + } + var + d = [0, cseq(216, 222), 0], + e = [0, cseq(192, 214), d], + upper = union_all([0, cseq(65, 90), e]), + clower = offset(32, upper), + cdigit = cseq(48, 57), + ascii = cseq(0, 127); + function cadd(c, s){return add(c, s);} + var + space = add(32, cseq(9, 13)), + f = [0, cseq(65, 70), 0], + xdigit = union_all([0, cdigit, [0, cseq(97, 102), f]]), + g = union(clower, upper), + calpha = + Stdlib_ListLabels[27].call + (null, cadd, [0, 170, [0, 181, [0, 186, [0, 223, [0, 255, 0]]]]], g), + calnum = union(calpha, cdigit); + function case_insens(s){ + var a = [0, offset(-32, inter(s, clower)), 0]; + return union_all([0, s, [0, offset(32, inter(s, upper)), a]]); + } + var + cword = add(95, calnum), + notnl = diff(cany, caml_call1(single$0, 10)), + nl = caml_call1(single$0, 10); + function set(str){ + var a = runtime.caml_ml_string_length(str) - 1 | 0; + if(a < 0) + var s$0 = empty; + else{ + var s = empty, i = 0; + for(;;){ + var + i$0 = runtime.caml_string_get(str, i), + b = union(caml_call1(single$0, i$0), s), + c = i + 1 | 0; + if(a === i){var s$0 = b; break;} + s = b; + i = c; + } + } + return s$0; + } + var + blank = set("\t "), + h = [0, cseq(248, 255), 0], + i = [0, cseq(223, 246), h], + j = [0, caml_call1(single$0, 181), i], + lower = union_all([0, cseq(97, 122), j]), + k = [0, caml_call1(single$0, 186), 0], + alpha = + union_all([0, lower, [0, upper, [0, caml_call1(single$0, 170), k]]]), + alnum = union_all([0, alpha, [0, cdigit, 0]]), + wordc = union_all([0, alnum, [0, caml_call1(single$0, 95), 0]]), + l = [0, cseq(127, 159), 0], + cntrl = union_all([0, cseq(0, 31), l]), + m = [0, cseq(160, 255), 0], + graph = union_all([0, cseq(33, 126), m]), + n = [0, cseq(160, 255), 0], + print = union_all([0, cseq(32, 126), n]), + o = [0, caml_call1(single$0, 247), 0], + p = [0, caml_call1(single$0, 215), o], + q = [0, cseq(187, 191), p], + r = [0, cseq(182, 185), q], + s = [0, cseq(171, 180), r], + t = [0, cseq(160, 169), s], + u = [0, cseq(123, 126), t], + v = [0, cseq(91, 96), u], + w = [0, cseq(58, 64), v], + punct = union_all([0, cseq(33, 47), w]); + runtime.caml_register_global + (18, + [0, + equal_c, + to_int, + of_int, + to_char, + of_char, + -1, + equal, + iter, + union, + union_all, + intersect_all, + inter, + diff, + empty, + single$0, + add, + mem, + case_insens, + cdigit, + calpha, + cword, + notnl, + ascii, + nl, + cseq, + set, + blank, + space, + xdigit, + lower, + upper, + alpha, + alnum, + wordc, + cntrl, + graph, + print, + punct, + pp, + one_char, + fold_right, + hash, + compare, + CSetMap, + cany, + csingle, + is_empty, + prepend, + pick, + offset, + to_dyn], + "Re__Cset"); + return; + } + (globalThis)); + +//# 827 "../.js/default/re/re.cma.js" +//# shape: Re__Hash_set:[F(1)*,F(1),F(2),F(2),F(1),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + caml_ml_bytes_length = runtime.caml_ml_bytes_length; + 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(), + Re_Fmt = global_data.Re__Fmt, + Re_Import = global_data.Re__Import, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Stdlib_Array = global_data.Stdlib__Array, + Stdlib_Format = global_data.Stdlib__Format, + Stdlib_Option = global_data.Stdlib__Option, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Assert_failure = global_data.Assert_failure; + function length(t){return caml_ml_bytes_length(t) / 8 | 0;} + function unsafe_get(t, i){ + return runtime.caml_int64_to_int32 + (Stdlib_Bytes[70].call(null, t, i * 8 | 0)); + } + function unsafe_set(t, i, x){ + return Stdlib_Bytes[84].call + (null, t, i * 8 | 0, runtime.caml_int64_of_int32(x)); + } + function make_absent(len){ + return Stdlib_Bytes[1].call(null, len * 8 | 0, 255); + } + function init(t$0){ + if(Stdlib_Option[10].call(null, t$0[1])){ + var t = runtime.caml_create_bytes(0), a = length(t) - 1 | 0; + if(a >= 0){ + var i = 0; + for(;;){ + unsafe_set(t, i, -1); + var b = i + 1 | 0; + if(a === i) break; + i = b; + } + } + t$0[1] = Stdlib_Option[2].call(null, [0, t, 0]); + } + return Stdlib_Option[4].call(null, t$0[1]); + } + var x = make_absent(1), b = unsafe_get(x, 0), absent = -1; + if(! Re_Import[3].call(null, b, absent)) + throw caml_maybe_attach_backtrace + ([0, Assert_failure, [0, "lib/hash_set.ml", 60, 2]], 1); + function create(param){return [0, 0];} + function index_of_offset(slots, index, i){ + var i$0 = index + i[1] | 0; + return slots <= i$0 ? i$0 - slots | 0 : i$0; + } + function clear(t){ + var match = t[1]; + if(! match) return 0; + var t$0 = match[1]; + t$0[2] = 0; + var t$1 = t$0[1]; + return Stdlib_Bytes[10].call(null, t$1, 0, caml_ml_bytes_length(t$1), 255); + } + function a(t, x){ + var + hash = Re_Import[10][14].call(null, x), + slots = length(t[1]), + index = hash & (slots - 1 | 0), + inserting = 1, + i = [0, 0]; + for(;;){ + if(! inserting){t[2] = t[2] + 1 | 0; return 0;} + var idx = index_of_offset(slots, index, i), elem = unsafe_get(t[1], idx); + if(Re_Import[3].call(null, elem, absent)){unsafe_set(t[1], idx, x); inserting = 0; + } + else + i[1]++; + } + } + function add(t, x){ + var + t$0 = init(t), + slots = length(t$0[1]), + c = Re_Import[3].call(null, slots, 0); + if(c) + var b = c; + else{ + var d = Re_Import[6].call(null, t$0[2], 0); + if(d) + var + f = runtime.caml_div(slots, t$0[2]), + b = Re_Import[5].call(null, f, 2); + else + var b = d; + } + if(b){ + var + old_table = t$0[1], + slots$0 = length(old_table), + g = Re_Import[3].call(null, slots$0, 0) ? 1 : slots$0 << 1, + table = make_absent(g); + t$0[1] = table; + var e = slots$0 - 1 | 0; + if(e >= 0){ + var i = 0; + for(;;){ + var elem = unsafe_get(old_table, i); + if(elem !== -1) a(t$0, elem); + var h = i + 1 | 0; + if(e === i) break; + i = h; + } + } + } + return a(t$0, x); + } + function is_empty(t){ + var t$0 = t[1]; + if(Stdlib_Option[10].call(null, t$0)) return 1; + var t$1 = Stdlib_Option[4].call(null, t$0); + return Re_Import[3].call(null, t$1[2], 0); + } + function mem(t, x){ + var t$0 = t[1]; + if(! Stdlib_Option[10].call(null, t$0)){ + var a = Stdlib_Option[4].call(null, t$0)[2]; + if(! Re_Import[3].call(null, a, 0)){ + var + t$1 = Stdlib_Option[4].call(null, t$0), + hash = Re_Import[10][14].call(null, x), + slots = length(t$1[1]), + index = hash & (slots - 1 | 0), + found = 0, + i = [0, 0]; + for(;;){ + if(! found && Re_Import[5].call(null, i[1], slots)){ + var + idx = index_of_offset(slots, index, i), + elem = unsafe_get(t$1[1], idx); + if(Re_Import[10][8].call(null, elem, x)){found = 1; continue;} + if(Re_Import[10][8].call(null, elem, absent)){i[1] = slots; continue;} + i[1]++; + continue; + } + return found; + } + } + } + return 0; + } + var c = [0, [15, [17, 4, [15, [17, 4, 0]]]], "%a@.%a@."]; + function pp(fmt, t){ + var + match = init(t), + table = match[1], + size = match[2], + a = length(table) - 1 | 0, + init$0 = 0; + if(a < 0) + var init$2 = init$0; + else{ + var init$1 = init$0, i = 0; + for(;;){ + var + i$0 = unsafe_get(table, i), + b = Re_Import[3].call(null, i$0, absent) ? init$1 : [0, i$0, init$1], + d = i + 1 | 0; + if(a === i){var init$2 = b; break;} + init$1 = b; + i = d; + } + } + var + e = Stdlib_ListLabels[10].call(null, init$2), + table$0 = Stdlib_Array[11].call(null, e); + function table$1(fmt, param){ + var a = Re_Fmt[7], b = Re_Fmt[12]; + return Re_Fmt[1].call + (null, + fmt, + "table", + function(c, d){return b(0, a, c, d);}, + table$0); + } + function size$0(fmt, param){ + return Re_Fmt[1].call(null, fmt, "size", Re_Fmt[7], size); + } + return caml_call4 + (Stdlib_Format[139].call(null, fmt)(c), table$1, 0, size$0, 0); + } + runtime.caml_register_global + (12, [0, create, is_empty, add, mem, clear, pp], "Re__Hash_set"); + return; + } + (globalThis)); + +//# 1030 "../.js/default/re/re.cma.js" +//# shape: Re__Mark_infos:[F(1),F(2),F(2),F(2),[F(1)*,F(1)*],F(2),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_check_bound = runtime.caml_check_bound; + 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(), + Re_Import = global_data.Re__Import, + Stdlib_ListLabels = global_data.Stdlib__ListLabels; + function make(marks){ + var + len = + 1 + + + Stdlib_ListLabels[26].call + (null, + function(ma, param){ + var i = param[1]; + return Re_Import[8].call(null, ma, i); + }, + -1, + marks) + | 0, + t = runtime.caml_make_vect(len, -1); + function set(param){ + var v = param[2], i = param[1]; + caml_check_bound(t, i)[i + 1] = v; + return 0; + } + Stdlib_ListLabels[18].call(null, set, marks); + return t; + } + function test(t, i){ + if(t.length - 1 <= (2 * i | 0)) return 0; + var a = 2 * i | 0; + return -1 !== caml_check_bound(t, a)[a + 1] ? 1 : 0; + } + function is_present(t){return 0 <= t ? 1 : 0;} + function get_no_check(t){return t;} + function start_offset(t, i){ + var start_i = 2 * i | 0; + return t.length - 1 <= (start_i + 1 | 0) + ? -1 + : caml_check_bound(t, start_i)[start_i + 1]; + } + function stop_offset(t, i){ + var stop_i = (2 * i | 0) + 1 | 0; + return t.length - 1 <= stop_i + ? -1 + : caml_check_bound(t, stop_i)[stop_i + 1]; + } + function offset(t, i){ + var start_i = 2 * i | 0, stop_i = start_i + 1 | 0; + if(t.length - 1 <= stop_i) return 0; + var start = caml_check_bound(t, start_i)[start_i + 1]; + if(Re_Import[3].call(null, start, -1)) return 0; + var stop = caml_check_bound(t, stop_i)[stop_i + 1]; + return [0, [0, start, stop]]; + } + function iteri(t, f){ + var a = ((t.length - 1) / 2 | 0) - 1 | 0; + if(a >= 0){ + var i = 0; + for(;;){ + var idx = 2 * i | 0, start = caml_check_bound(t, idx)[idx + 1]; + if(-1 !== start){ + var b = idx + 1 | 0, stop = caml_check_bound(t, b)[b + 1]; + caml_call3(f, i, start, stop); + } + var c = i + 1 | 0; + if(a === i) break; + i = c; + } + } + return 0; + } + runtime.caml_register_global + (2, + [0, + make, + offset, + test, + iteri, + [0, is_present, get_no_check], + start_offset, + stop_offset], + "Re__Mark_infos"); + return; + } + (globalThis)); + +//# 1130 "../.js/default/re/re.cma.js" +//# shape: Re__Pmark:[F(2)*,F(2)*,F(1),F(2),F(1)*,N] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + global_data = runtime.caml_get_global_data(); + global_data.Stdlib__List; + var + Stdlib_Atomic = global_data.Stdlib__Atomic, + Stdlib_Format = global_data.Stdlib__Format, + Stdlib_Set = global_data.Stdlib__Set, + Re_Dyn = global_data.Re__Dyn; + function equal(x, y){return x === y ? 1 : 0;} + var compare = runtime.caml_int_compare, r = Stdlib_Atomic[1].call(null, 1); + function gen(param){return Stdlib_Atomic[7].call(null, r, 1);} + var + pp = Stdlib_Format[19], + Set = Stdlib_Set[1].call(null, [0, compare]), + empty = Set[1], + add = Set[2], + singleton = Set[3], + remove = Set[4], + union = Set[5], + inter = Set[6], + disjoint = Set[7], + diff = Set[8], + cardinal = Set[9], + elements = Set[10], + min_elt = Set[11], + min_elt_opt = Set[12], + max_elt = Set[13], + max_elt_opt = Set[14], + choose = Set[15], + choose_opt = Set[16], + find = Set[17], + find_opt = Set[18], + find_first = Set[19], + find_first_opt = Set[20], + find_last = Set[21], + find_last_opt = Set[22], + iter = Set[23], + fold = Set[24], + map = Set[25], + filter = Set[26], + filter_map = Set[27], + partition = Set[28], + split = Set[29], + is_empty = Set[30], + mem = Set[31], + equal$0 = Set[32], + compare$0 = Set[33], + subset = Set[34], + for_all = Set[35], + exists = Set[36], + to_list = Set[37], + of_list = Set[38], + to_seq_from = Set[39], + to_seq = Set[40], + to_rev_seq = Set[41], + add_seq = Set[42], + of_seq = Set[43], + to_dyn = Re_Dyn[3]; + runtime.caml_register_global + (5, + [0, + equal, + compare, + gen, + pp, + to_dyn, + [0, + empty, + add, + singleton, + remove, + union, + inter, + disjoint, + diff, + cardinal, + elements, + min_elt, + min_elt_opt, + max_elt, + max_elt_opt, + choose, + choose_opt, + find, + find_opt, + find_first, + find_first_opt, + find_last, + find_last_opt, + iter, + fold, + map, + filter, + filter_map, + partition, + split, + is_empty, + mem, + equal$0, + compare$0, + subset, + for_all, + exists, + of_list, + to_seq_from, + to_seq, + to_rev_seq, + add_seq, + of_seq, + to_list]], + "Re__Pmark"); + return; + } + (globalThis)); + +//# 1252 "../.js/default/re/re.cma.js" +//# shape: Re__Automata:[N,N,N,F(1)*,F(2),N,F(2),F(1),F(2),F(4),F(1),F(4),F(2),F(2),F(3),F(2),F(2),F(2),N,[],N,N,F(4)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + 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_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_call6(f, a0, a1, a2, a3, a4, a5){ + return (f.l >= 0 ? f.l : f.l = f.length) === 6 + ? f(a0, a1, a2, a3, a4, a5) + : runtime.caml_call_gen(f, [a0, a1, a2, a3, a4, a5]); + } + var + global_data = runtime.caml_get_global_data(), + Re_Cset = global_data.Re__Cset, + Re_Category = global_data.Re__Category, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Re_Import = global_data.Re__Import, + Re_Bit_vector = global_data.Re__Bit_vector, + Stdlib_Atomic = global_data.Stdlib__Atomic, + Stdlib_Mutex = global_data.Stdlib__Mutex, + Re_Dyn = global_data.Re__Dyn, + Stdlib_Format = global_data.Stdlib__Format, + Re_Fmt = global_data.Re__Fmt, + Re_Mark_infos = global_data.Re__Mark_infos, + Assert_failure = global_data.Assert_failure, + Stdlib = global_data.Stdlib, + Re_Pmark = global_data.Re__Pmark, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, + Re_Hash_set = global_data.Re__Hash_set; + function hash_combine(h, accu){return (accu * 65599 | 0) + h | 0;} + var equal = Re_Import[10][8], pp = Re_Fmt[7]; + function create(param){return [0, 0];} + var b = Re_Hash_set[3], c = Re_Hash_set[4]; + function to_string(param){ + return -730718166 === param + ? "long" + : 332064784 <= param ? "first" : "short"; + } + function to_dyn(t){var a = to_string(t); return Re_Dyn[6].call(null, a);} + var equal$0 = Re_Import[1][1]; + function pp$0(ch, k){ + var a = to_string(k); + return Stdlib_Format[13].call(null, ch, a); + } + function to_string$0(param){ + return 620821490 <= param ? "Non_greedy" : "Greedy"; + } + function to_dyn$0(t){ + var a = to_string$0(t); + return Re_Dyn[6].call(null, a); + } + function pp$1(fmt, t){ + var a = to_string$0(t); + return Stdlib_Format[13].call(null, fmt, a); + } + var + equal$1 = Re_Import[10][8], + compare = Re_Import[10][9], + pp$2 = Stdlib_Format[19], + to_dyn$1 = Re_Dyn[3]; + function prev(x){return x - 1 | 0;} + function next(x){return x + 1 | 0;} + function next2(x){return x + 2 | 0;} + function group_count(x){return x / 2 | 0;} + var to_dyn$2 = Re_Dyn[3]; + function to_int(x){return x;} + var pp$3 = Stdlib_Format[19], equal$2 = Re_Import[10][8]; + function wrap_sem(sem$0, sem, v){ + var name = to_string(sem); + if(sem$0){var sem$1 = sem$0[1]; if(equal$0(sem$1, sem)) return v;} + if(4 !== v[0]) return Re_Dyn[1].call(null, name, [0, v, 0]); + var v$0 = v[1]; + return Re_Dyn[1].call(null, name, v$0); + } + function d(sem, param){ + if(typeof param === "number") return 0; + switch(param[0]){ + case 0: + var cs = param[1]; return [0, [0, cs], 0]; + case 2: + var y = param[3], x = param[2], sem$0 = param[1]; + if(! equal$0(sem, sem$0)) throw Stdlib[8]; + var a = d(sem, y[2]); + return [0, x[2], a]; + default: throw Stdlib[8]; + } + } + var i = [2, "Eps"]; + function dyn_of_def(sem){ + return function(param){ + if(typeof param === "number") return i; + switch(param[0]){ + case 0: + var cset = param[1]; return Re_Cset[51].call(null, cset); + case 1: + var + alt = param[1], + a = + Stdlib_ListLabels[20].call + (null, function(a){return to_dyn$3(sem, a);}, alt); + return Re_Dyn[1].call(null, "Alt", a); + case 2: + var + y = param[3], + x = param[2], + sem$0 = param[1], + b = [0, sem$0], + to_dyn = function(a){return to_dyn$3(b, a);}, + t = y[2]; + a: + { + try{var s = d(sem$0, t);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + var match = 0; + break a; + } + var match = [0, s]; + } + var cst_Seq = "Seq"; + if(match) + var + y$0 = match[1], + e = dyn_of_def(sem), + f = Stdlib_ListLabels[20].call(null, e, y$0), + g = [0, to_dyn(x), f], + x$0 = Re_Dyn[1].call(null, cst_Seq, g); + else + var + h = [0, to_dyn(y), 0], + j = [0, to_dyn(x), h], + x$0 = Re_Dyn[1].call(null, cst_Seq, j); + return wrap_sem(sem, sem$0, x$0); + case 3: + var + t$0 = param[3], + sem$1 = param[2], + k = [0, to_dyn$3([0, sem$1], t$0), 0]; + return wrap_sem(sem, sem$1, Re_Dyn[1].call(null, "Rep", k)); + case 4: + var m = param[1], l = [0, to_dyn$1(m), 0]; + return Re_Dyn[1].call(null, "Mark", l); + case 5: + var + y$1 = param[2], + x$1 = param[1], + n = [0, to_dyn$1(y$1), 0], + o = [0, to_dyn$1(x$1), n]; + return Re_Dyn[1].call(null, "Erase", o); + case 6: + var c = param[1], p = [0, Re_Category[15].call(null, c), 0]; + return Re_Dyn[1].call(null, "Before", p); + case 7: + var c$0 = param[1], q = [0, Re_Category[15].call(null, c$0), 0]; + return Re_Dyn[1].call(null, "After", q); + default: + var m$0 = param[1], r = [0, Re_Pmark[5].call(null, m$0), 0]; + return Re_Dyn[1].call(null, "Pmark", r); + }}; + } + function to_dyn$3(sem, param){ + var def = param[2]; + return dyn_of_def(sem)(def); + } + function pp_with_sem(sem, ch, e){ + var match = e[2]; + if(typeof match === "number") return Re_Fmt[2].call(null, ch, "eps"); + switch(match[0]){ + case 0: + var l = match[1]; + return Re_Fmt[1].call(null, ch, "cst", Re_Cset[39], l); + case 1: + var + l$0 = match[1], + a = function(a, b){return pp_with_sem(sem, a, b);}, + d = Re_Fmt[10]; + return Re_Fmt[1].call + (null, ch, "alt", function(b, c){return d(0, a, b, c);}, l$0); + case 2: + var + e$0 = match[3], + e$1 = match[2], + k = match[1], + f = function(a, b){return pp_with_sem(sem, a, b);}, + g = function(a, b){return pp_with_sem(sem, a, b);}, + h = Re_Fmt[9]; + return Re_Fmt[1].call + (null, + ch, + "seq", + function(a, b){return h(pp$0, g, f, a, b);}, + [0, k, e$1, e$0]); + case 3: + var + e$2 = match[3], + k$0 = match[2], + j = [0, k$0], + m = function(a, b){return pp_with_sem(j, a, b);}, + n = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + ch, + "rep", + function(a, b){return n(pp$0, m, a, b);}, + [0, k$0, e$2]); + case 4: + var i = match[1]; return Re_Fmt[1].call(null, ch, "mark", pp$2, i); + case 5: + var e$3 = match[2], b = match[1], o = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + ch, + "erase", + function(a, b){return o(pp$2, pp$2, a, b);}, + [0, b, e$3]); + case 6: + var c = match[1]; + return Re_Fmt[1].call(null, ch, "before", Re_Category[14], c); + case 7: + var c$0 = match[1]; + return Re_Fmt[1].call(null, ch, "after", Re_Category[14], c$0); + default: + var i$0 = match[1]; + return Re_Fmt[1].call(null, ch, "pmark", Re_Pmark[4], i$0); + } + } + function pp$4(a, b){return pp_with_sem(0, a, b);} + function mk(ids, def){ids[1]++; return [0, ids[1], def];} + var a = [1, 0]; + function empty(ids){return mk(ids, a);} + function cst(ids, s){ + return Re_Cset[47].call(null, s) ? mk(ids, a) : mk(ids, [0, s]); + } + function eps(ids){return mk(ids, 0);} + function rep(ids, kind, sem, x){return mk(ids, [3, kind, sem, x]);} + function mark(ids, m){return mk(ids, [4, m]);} + function pmark(ids, i){return mk(ids, [8, i]);} + function erase(ids, m$0, m){return mk(ids, [5, m$0, m]);} + function before(ids, c){return mk(ids, [6, c]);} + function after(ids, c){return mk(ids, [7, c]);} + function alt(ids, l){ + if(! l) return mk(ids, a); + if(l[2]) return mk(ids, [1, l]); + var c = l[1]; + return c; + } + function seq(ids, kind, x, y){ + var a = x[2], match = y[2]; + if(typeof a !== "number" && 1 === a[0] && ! a[1]) return x; + if(typeof match !== "number" && 1 === match[0] && ! match[1]) return y; + if(typeof a === "number") return y; + if(typeof match === "number" && equal$0(kind, 332064784)) return x; + return mk(ids, [2, kind, x, y]); + } + function is_eps(expr){return typeof expr[2] === "number" ? 1 : 0;} + function rename(ids, x){ + var match = x[2]; + if(typeof match !== "number") + switch(match[0]){ + case 1: + var l = match[1]; + return mk + (ids, + [1, + Stdlib_ListLabels[20].call + (null, function(a){return rename(ids, a);}, l)]); + case 2: + var z = match[3], y = match[2], k = match[1], a = rename(ids, z); + return mk(ids, [2, k, rename(ids, y), a]); + case 3: + var y$0 = match[3], k$0 = match[2], g = match[1]; + return mk(ids, [3, g, k$0, rename(ids, y$0)]); + } + return mk(ids, x[2]); + } + var cst_marks = "marks"; + function to_dyn$4(param){ + var + pmarks = param[2], + marks = param[1], + a = caml_call1(Re_Pmark[6][43], pmarks), + e = Stdlib_ListLabels[20].call(null, Re_Pmark[5], a), + b = [0, [0, "pmarks", Re_Dyn[2].call(null, e)], 0], + c = + Stdlib_ListLabels[20].call + (null, + function(param){ + var + idx = param[2], + m = param[1], + a = to_dyn$2(idx), + b = to_dyn$1(m); + return Re_Dyn[4].call(null, b, a); + }, + marks), + d = [0, [0, cst_marks, Re_Dyn[2].call(null, c)], b]; + return Re_Dyn[5].call(null, d); + } + function equal$3(param, t){ + var + pmarks = param[2], + marks = param[1], + a = + Stdlib_ListLabels[16].call + (null, + function(b, param){ + var + y = param[2], + x = param[1], + y$0 = b[2], + x$0 = b[1], + a = equal$1(x$0, x); + return a ? equal$2(y$0, y) : a; + }, + marks, + t[1]); + return a ? caml_call2(Re_Pmark[6][32], pmarks, t[2]) : a; + } + var empty$0 = [0, 0, Re_Pmark[6][1]]; + function f(acc, param){ + var i = param[2], a = param[1]; + return hash_combine(a, hash_combine(i, acc)); + } + function hash(m, accu){ + var + init = hash_combine(Stdlib_Hashtbl[28].call(null, m[2]), accu), + l = m[1]; + return Stdlib_ListLabels[26].call(null, f, init, l); + } + var unknown = -1; + function marks_set_idx(idx, marks){ + if(! marks) return 0; + var rem = marks[2], match = marks[1], idx$0 = match[2], a = match[1]; + return equal$2(idx$0, unknown) + ? [0, [0, a, idx], marks_set_idx(idx, rem)] + : marks; + } + function marks_set_idx$0(marks, idx){ + var a = marks[2]; + return [0, marks_set_idx(idx, marks[1]), a]; + } + var + cst_2 = "<2>", + cst$0 = "@ ", + j = [0, [15, [12, 45, [15, 0]]], "%a-%a"], + k = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, cst_marks, [17, [0, cst$0, 1, 0], [15, [17, 0, 0]]]]], + "@[<2>marks@ %a@]"], + l = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, "pmarks ", [15, [17, 0, 0]]]], + "@[<2>pmarks %a@]"]; + function pp$5(fmt, param){ + var pmarks = param[2], marks = param[1]; + Stdlib_Format[1].call(null, fmt, 1); + if(marks){ + var + a = + function(fmt, param){ + var i = param[2], a = param[1]; + return caml_call4 + (Stdlib_Format[139].call(null, fmt)(j), pp$2, a, pp$3, i); + }, + b = Stdlib_Format[132]; + caml_call2 + (Stdlib_Format[139].call(null, fmt)(k), + function(c, d){return b(0, a, c, d);}, + marks); + } + var pmarks$0 = caml_call1(Re_Pmark[6][43], pmarks); + if(pmarks$0){ + var c = Re_Pmark[4], d = Stdlib_Format[132]; + caml_call2 + (Stdlib_Format[139].call(null, fmt)(l), + function(a, b){return d(0, c, a, b);}, + pmarks$0); + } + return Stdlib_Format[3].call(null, fmt, 0); + } + function equal_list(l1, l2){ + return Stdlib_ListLabels[16].call(null, equal$4, l1, l2); + } + function equal$4(x, y){ + switch(x[0]){ + case 0: + var e1 = x[3], l1 = x[2]; + if(0 === y[0]){ + var e2 = y[3], l2 = y[2], a = equal(e1[1], e2[1]); + return a ? equal_list(l1, l2) : a; + } + break; + case 1: + var e1$0 = x[2], marks1 = x[1]; + if(1 === y[0]){ + var e2$0 = y[2], marks2 = y[1], b = equal(e1$0[1], e2$0[1]); + return b ? equal$3(marks1, marks2) : b; + } + break; + default: + var marks1$0 = x[1]; + if(2 === y[0]){ + var marks2$0 = y[1]; + return equal$3(marks1$0, marks2$0); + } + } + return 0; + } + var letrec_function_context = []; + function hash_list(l, init){ + return Stdlib_ListLabels[26].call + (null, letrec_function_context[1], init, l); + } + function f$0(accu, x$1){ + switch(x$1[0]){ + case 0: + var e = x$1[3], l = x$1[2], a = hash_list(l, accu), x = e[1]; + return hash_combine(388635598, hash_combine(x, a)); + case 1: + var e$0 = x$1[2], marks = x$1[1], b = hash(marks, accu), x$0 = e$0[1]; + return hash_combine(726404471, hash_combine(x$0, b)); + default: + var marks$0 = x$1[1]; + return hash_combine(471882453, hash(marks$0, accu)); + } + } + var g = Re_Hash_set[5], h = Re_Hash_set[1]; + runtime.caml_update_dummy(letrec_function_context, [0, f$0]); + function e(sem, t){ + var + a = + Stdlib_ListLabels[20].call + (null, + function(param){ + switch(param[0]){ + case 0: + var + y = param[3], + x = param[2], + sem$0 = param[1], + a = [0, to_dyn$3([0, sem$0], y), 0], + b = [0, e([0, sem$0], x), a]; + return wrap_sem(sem, sem$0, Re_Dyn[1].call(null, "TSeq", b)); + case 1: + var + e$0 = param[2], + marks = param[1], + base = [0, to_dyn$3(sem, e$0), 0], + e$1 = + equal$3(empty$0, marks) ? base : [0, to_dyn$4(marks), base]; + return Re_Dyn[1].call(null, "TExp", e$1); + default: + var m = param[1], c = [0, to_dyn$4(m), 0]; + return Re_Dyn[1].call(null, "TMarks", c); + } + }, + t); + return Re_Dyn[2].call(null, a); + } + function tseq(kind, x, y, rem){ + a: + if(x){ + var a = x[1]; + if(1 === a[0] && typeof a[2][2] === "number" && ! x[2]){var marks = a[1], b = [0, [1, marks, y], 0]; break a;} + var b = [0, [0, kind, x, y], 0]; + } + else + var b = 0; + return Stdlib[37].call(null, b, rem); + } + function fold_right(t, init, f){ + if(! t) return init; + var xs = t[2], x = t[1]; + return caml_call2(f, x, fold_right(xs, init, f)); + } + function iter_marks(t, f){ + return Stdlib_ListLabels[18].call + (null, + function(e){ + if(0 === e[0]){var l = e[2]; return iter_marks(l, f);} + var marks = e[1]; + return caml_call1(f, marks); + }, + t); + } + var + cst_TExp = "(TExp", + m = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, "(TSeq", [17, [0, cst$0, 1, 0], [15, [17, [0, cst$0, 1, 0], 0]]]]], + "@[<2>(TSeq@ %a@ "], + n = [0, [17, [0, cst$0, 1, 0], [15, [12, 41, [17, 0, 0]]]], "@ %a)@]"], + o = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, + cst_TExp, + [17, + [0, cst$0, 1, 0], + [15, + [17, + [0, cst$0, 1, 0], + [12, + 40, + [15, + [12, 41, [17, [0, cst$0, 1, 0], [11, "(eps))", [17, 0, 0]]]]]]]]]]], + "@[<2>(TExp@ %a@ (%a)@ (eps))@]"], + p = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, + cst_TExp, + [17, + [0, cst$0, 1, 0], + [15, + [17, + [0, cst$0, 1, 0], + [12, + 40, + [15, + [12, 41, [17, [0, cst$0, 1, 0], [15, [12, 41, [17, 0, 0]]]]]]]]]]]], + "@[<2>(TExp@ %a@ (%a)@ %a)@]"], + q = + [0, + [18, + [1, [0, [11, cst_2, 0], cst_2]], + [11, "(TMatch", [17, [0, cst$0, 1, 0], [15, [12, 41, [17, 0, 0]]]]]], + "@[<2>(TMatch@ %a)@]"]; + function print_state_rec(ch, e, y){ + switch(e[0]){ + case 0: + var x = e[3], l = e[2], sem = e[1]; + caml_call2(Stdlib_Format[139].call(null, ch)(m), pp$0, sem); + print_state_lst(ch, l, x); + return caml_call2(Stdlib_Format[139].call(null, ch)(n), pp$4, x); + case 1: + var marks = e[1]; + if(typeof e[2][2] === "number"){ + var a = y[1]; + return caml_call4 + (Stdlib_Format[139].call(null, ch)(o), pp, a, pp$5, marks); + } + var x$0 = e[2], b = x$0[1]; + return caml_call6 + (Stdlib_Format[139].call(null, ch)(p), + pp, + b, + pp$5, + marks, + pp$4, + x$0); + default: + var marks$0 = e[1]; + return caml_call2(Stdlib_Format[139].call(null, ch)(q), pp$5, marks$0); + } + } + var + cst$1 = "()", + r = [0, [17, [0, cst$0, 1, 0], [11, "| ", 0]], "@ | "], + s = [0, [11, cst$1, 0], cst$1]; + function print_state_lst(ch, l, y){ + if(! l) return Stdlib_Format[139].call(null, ch)(s); + var rem = l[2], e = l[1]; + print_state_rec(ch, e, y); + return Stdlib_ListLabels[18].call + (null, + function(e){ + Stdlib_Format[139].call(null, ch)(r); + return print_state_rec(ch, e, y); + }, + rem); + } + var zero = 0; + function pp$6(ch, t){return print_state_lst(ch, [0, t, 0], [0, zero, 0]);} + function first_match(param$0){ + var param = param$0; + for(;;){ + if(! param) return 0; + var match = param[1]; + if(2 === match[0]){var marks = match[1]; return [0, marks];} + var r = param[2]; + param = r; + } + } + function remove_matches(t){ + return Stdlib_ListLabels[44].call + (null, function(param){return 2 === param[0] ? 0 : 1;}, t); + } + function set_idx(idx, xs){ + return Stdlib_ListLabels[20].call + (null, + function(param){ + switch(param[0]){ + case 0: + var x = param[3], l = param[2], kind = param[1]; + return [0, kind, set_idx(idx, l), x]; + case 1: + var x$0 = param[2], marks = param[1]; + return [1, marks_set_idx$0(marks, idx), x$0]; + default: + var marks$0 = param[1]; + return [2, marks_set_idx$0(marks$0, idx)]; + } + }, + xs); + } + function add_match(t, marks){return [0, [2, marks], t];} + function loop(seen, l$2, y){ + var l = l$2; + for(;;){ + if(! l) return 0; + var x = l[1]; + switch(x[0]){ + case 0: + var + r = l[2], + x$0 = x[3], + l$0 = x[2], + kind = x[1], + l$1 = loop(seen, l$0, x$0), + r$0 = loop(seen, r, y); + return tseq(kind, l$1, x$0, r$0); + case 1: + if(typeof x[2][2] === "number"){ + var r$1 = l[2]; + if(! c(seen, y[1])){ + b(seen, y[1]); + return [0, x, loop(seen, r$1, y)]; + } + l = r$1; + } + else{ + var r$2 = l[2], x$1 = x[2]; + if(! c(seen, x$1[1])){ + b(seen, x$1[1]); + return [0, x, loop(seen, r$2, y)]; + } + l = r$2; + } + break; + default: return [0, x, 0]; + } + } + } + var u = [0, [12, 91, [15, [12, 93, 0]]], "[%a]"]; + function pp$7(fmt, t){ + var + t$0 = t[3], + a = Re_Fmt[13], + b = [0, function(b, c){return a("; ", b, c);}], + c = Stdlib_Format[132]; + return caml_call2 + (Stdlib_Format[139].call(null, fmt)(u), + function(a, d){return c(b, pp$6, a, d);}, + t$0); + } + function idx(t){return t[1];} + function to_dyn$5(t){var t$0 = t[3]; return e(0, t$0);} + var empty$1 = 0, dummy = [0, unknown, Re_Category[3], empty$1, 0, -1]; + function mk$0(idx, cat, desc){ + return [0, + idx, + cat, + desc, + 0, + hash_list + (desc, + hash_combine + (idx, hash_combine(Re_Category[10].call(null, cat), 0))) + & 1073741823]; + } + function create$0(cat, expr){ + return mk$0(0, cat, [0, [1, empty$0, expr], 0]); + } + function equal$5(param, t){ + var + desc = param[3], + category = param[2], + idx = param[1], + hash = param[5], + b = Re_Import[10][8].call(null, hash, t[5]); + if(b){ + var c = equal$2(idx, t[1]); + if(c){ + var d = Re_Category[11].call(null, category, t[2]); + if(d) return equal_list(desc, t[3]); + var a = d; + } + else + var a = c; + } + else + var a = b; + return a; + } + function status_no_mutex(s){ + var match$0 = s[4]; + if(match$0){var s$0 = match$0[1]; return s$0;} + var param = s[3]; + if(param){ + var match = param[1]; + if(2 === match[0]) + var + m = match[1], + a = m[2], + st = [0, Re_Mark_infos[1].call(null, m[1]), a]; + else + var st = 1; + } + else + var st = 0; + s[4] = [0, st]; + return st; + } + function status(m, s){ + var match = s[4]; + if(match){var s$0 = match[1]; return s$0;} + Stdlib_Mutex[2].call(null, m); + var st = status_no_mutex(s); + Stdlib_Mutex[4].call(null, m); + return st; + } + function hash$0(t){return t[5];} + var Table = Stdlib_Hashtbl[26].call(null, [0, equal$5, hash$0]); + function create$1(param){ + var a = Stdlib_Atomic[1].call(null, 0), b = h(0); + return [0, Re_Bit_vector[3].call(null, 1), b, a]; + } + function index_count(w){return Stdlib_Atomic[3].call(null, w[3]);} + var eps_expr = [0, zero, 0]; + function delta_expr$0(counter, ctx, marks, x, rem){ + var c = ctx[1], match = x[2]; + if(typeof match === "number") return add_match(rem, marks); + switch(match[0]){ + case 0: + var s = match[1]; + return Re_Cset[17].call(null, c, s) + ? [0, [1, marks, eps_expr], rem] + : rem; + case 1: + var l = match[1]; + return Stdlib_ListLabels[27].call + (null, + function(a, b){return delta_expr(ctx, marks, a, b);}, + l, + rem); + case 2: + var + z = match[3], + y = match[2], + kind = match[1], + y$0 = delta_expr(ctx, marks, y, empty$1); + return counter < 50 + ? delta_seq$0(counter + 1 | 0, ctx, kind, y$0, z, rem) + : caml_trampoline_return + (delta_seq$0, [0, ctx, kind, y$0, z, rem]); + case 3: + var + y$1 = match[3], + kind$0 = match[2], + rep_kind = match[1], + y$2 = delta_expr(ctx, marks, y$1, empty$1), + match$0 = first_match(y$2); + if(match$0) + var + marks$0 = match$0[1], + marks$1 = marks$0, + y$3 = remove_matches(y$2); + else + var marks$1 = marks, y$3 = y$2; + return 620821490 <= rep_kind + ? add_match(tseq(kind$0, y$3, x, rem), marks) + : tseq(kind$0, y$3, x, add_match(rem, marks$1)); + case 4: + var i = match[1], b = marks[2]; + return add_match + (rem, + [0, + [0, + [0, i, unknown], + Stdlib_ListLabels[56].call(null, i, marks[1])], + b]); + case 5: + var + stop_inclusive = match[2], + start_inclusive = match[1], + a = marks[2]; + return add_match + (rem, + [0, + Stdlib_ListLabels[44].call + (null, + function(param){ + var + i = param[1], + a = Re_Import[5].call(null, i, start_inclusive); + return a ? a : Re_Import[6].call(null, i, stop_inclusive); + }, + marks[1]), + a]); + case 6: + var cat = match[1]; + return Re_Category[13].call(null, ctx[3], cat) + ? add_match(rem, marks) + : rem; + case 7: + var cat$0 = match[1]; + return Re_Category[13].call(null, ctx[2], cat$0) + ? add_match(rem, marks) + : rem; + default: + var i$0 = match[1], d = caml_call2(Re_Pmark[6][2], i$0, marks[2]); + return add_match(rem, [0, marks[1], d]); + } + } + function delta_expr(ctx, marks, x, rem){ + return caml_trampoline(delta_expr$0(0, ctx, marks, x, rem)); + } + var t = [0, "lib/automata.ml", 528, 14]; + function delta_seq$0(counter, ctx, kind, y$1, z, rem){ + var match = first_match(y$1); + if(! match) return tseq(kind, y$1, z, rem); + var marks = match[1]; + if(-730718166 === kind){ + var b = delta_expr(ctx, marks, z, rem); + return tseq(kind, remove_matches(y$1), z, b); + } + if(332064784 > kind){ + var a = tseq(kind, remove_matches(y$1), z, rem); + return counter < 50 + ? delta_expr$0(counter + 1 | 0, ctx, marks, z, a) + : caml_trampoline_return(delta_expr$0, [0, ctx, marks, z, a]); + } + var l = 0, param = y$1; + for(;;){ + if(! param) throw caml_maybe_attach_backtrace([0, Assert_failure, t], 1); + var x = param[1]; + if(2 === x[0]){ + var + r$0 = param[2], + y = remove_matches(r$0), + y$0 = Stdlib_ListLabels[10].call(null, l); + return tseq + (kind, y$0, z, delta_expr(ctx, marks, z, tseq(kind, y, z, rem))); + } + var r = param[2], l$0 = [0, x, l]; + l = l$0; + param = r; + } + } + function delta_seq(ctx, kind, y, z, rem){ + return caml_trampoline(delta_seq$0(0, ctx, kind, y, z, rem)); + } + function delta_desc(ctx, marks, l, rem){ + return fold_right + (l, + rem, + function(expr, acc){ + switch(expr[0]){ + case 0: + var + z = expr[3], + y = expr[2], + kind = expr[1], + y$0 = delta_desc(ctx, marks, y, empty$1); + return delta_seq(ctx, kind, y$0, z, acc); + case 1: + var e = expr[2], marks$0 = expr[1]; + return delta_expr(ctx, marks$0, e, acc); + default: return [0, expr, acc]; + } + }); + } + function delta(tbl_ref, next_cat, char, st){ + var + prev_cat = st[2], + ctx = [0, char, prev_cat, next_cat], + l = delta_desc(ctx, empty$0, st[3], empty$1), + seen = tbl_ref[2]; + g(seen); + var expr = loop(seen, l, eps_expr); + Re_Bit_vector[5].call(null, tbl_ref[1]); + var tbl = tbl_ref[1]; + iter_marks + (expr, + function(marks){ + return Stdlib_ListLabels[18].call + (null, + function(param){ + var i = param[2], a = 0 <= i ? 1 : 0; + return a ? Re_Bit_vector[2].call(null, tbl, i, 1) : a; + }, + marks[1]); + }); + var + len = Re_Bit_vector[1].call(null, tbl_ref[1]), + tbl$0 = tbl_ref[1], + idx = 0; + for(;;){ + if + (! + Re_Import[3].call(null, idx, len) + && Re_Bit_vector[4].call(null, tbl$0, idx)){ + var idx$0 = idx + 1 | 0; + idx = idx$0; + continue; + } + if(Re_Import[3].call(null, idx, len)){ + tbl_ref[1] = Re_Bit_vector[3].call(null, 2 * len | 0); + Stdlib_Atomic[4].call(null, tbl_ref[3], 2 * len | 0); + } + var expr$0 = set_idx(idx, expr); + return mk$0(idx, next_cat, expr$0); + } + } + runtime.caml_register_global + (60, + [0, + [0, compare, 0, prev, next, next2, group_count], + [0, to_dyn, pp$0], + [0, to_dyn$0, pp$1], + is_eps, + pp$4, + [0, create], + cst, + empty, + alt, + seq, + eps, + rep, + mark, + pmark, + erase, + before, + after, + rename, + [0, to_int], + [0], + [0, + pp$7, + dummy, + create$0, + idx, + status_no_mutex, + status, + to_dyn$5, + Table], + [0, create$1, index_count], + delta], + "Re__Automata"); + return; + } + (globalThis)); + +//# 2236 "../.js/default/re/re.cma.js" +//# shape: Re__Color_map:[[F(2),F(1)*],[F(2),F(2)*,F(2)],F(1),F(1),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_set = runtime.caml_bytes_set, + caml_create_bytes = runtime.caml_create_bytes, + caml_string_get = runtime.caml_string_get, + global_data = runtime.caml_get_global_data(), + Re_Cset = global_data.Re__Cset, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Bytes = global_data.Stdlib__Bytes; + function repr(t, color){ + return caml_string_get(t, Re_Cset[2].call(null, color)); + } + var length = runtime.caml_ml_string_length; + function get_char(t, c){ + return caml_string_get(t, Re_Cset[2].call(null, c)); + } + function get(t, c){ + return Re_Cset[5].call(null, runtime.caml_string_unsafe_get(t, c)); + } + function translate_colors(cm, cset){ + return Re_Cset[41].call + (null, + cset, + Re_Cset[14], + function(i, j, l){ + var + start = get_char(cm, i), + stop = get_char(cm, j), + a = Re_Cset[25].call(null, start, stop); + return Re_Cset[9].call(null, a, l); + }); + } + function make(param){return Stdlib_Bytes[1].call(null, 257, 0);} + function flatten(cm){ + var c = caml_create_bytes(256), color_repr = caml_create_bytes(256); + caml_bytes_set(c, 0, 0); + caml_bytes_set(color_repr, 0, 0); + var v = 0, i = 1; + for(;;){ + if(0 !== runtime.caml_bytes_get(cm, i)) + var v$0 = v + 1 | 0, v$1 = v$0; + else + var v$1 = v; + caml_bytes_set(c, i, Stdlib_Char[1].call(null, v$1)); + caml_bytes_set(color_repr, v$1, Stdlib_Char[1].call(null, i)); + var b = i + 1 | 0; + if(255 === i){ + var a = Stdlib_Bytes[8].call(null, color_repr, 0, v$1 + 1 | 0); + return [0, Stdlib_Bytes[44].call(null, c), a]; + } + v = v$1; + i = b; + } + } + function split(t, set){ + return Re_Cset[8].call + (null, + set, + function(i, j){ + caml_bytes_set(t, Re_Cset[2].call(null, i), 1); + return caml_bytes_set(t, Re_Cset[2].call(null, j) + 1 | 0, 1); + }); + } + runtime.caml_register_global + (3, + [0, + [0, repr, length], + [0, get_char, get, translate_colors], + make, + flatten, + split], + "Re__Color_map"); + return; + } + (globalThis)); + +//# 2318 "../.js/default/re/re.cma.js" +//# shape: Re__Ast:[N,F(2),F(1),F(2),F(1),F(2),N,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_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]); + } + var + global_data = runtime.caml_get_global_data(), + Re_Cset = global_data.Re__Cset, + Re_Dyn = global_data.Re__Dyn, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Re_Pmark = global_data.Re__Pmark, + Re_Automata = global_data.Re__Automata, + Re_Fmt = global_data.Re__Fmt, + Stdlib_Format = global_data.Stdlib__Format, + Re_Import = global_data.Re__Import, + Stdlib_Option = global_data.Stdlib__Option, + Stdlib = global_data.Stdlib, + Re_Color_map = global_data.Re__Color_map, + Stdlib_String = global_data.Stdlib__String, + Assert_failure = global_data.Assert_failure, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Char = global_data.Stdlib__Char, + Re_Dense_map = global_data.Re__Dense_map, + cst_Alternative = "Alternative", + cst_Case = "Case", + cst_No_case = "No_case"; + function dyn_of_ast(f){ + return function(param){ + switch(param[0]){ + case 0: + var xs = param[1], b = Stdlib_ListLabels[20].call(null, f, xs); + return Re_Dyn[1].call(null, cst_Alternative, b); + case 1: + var a = param[1], c = [0, caml_call1(f, a), 0]; + return Re_Dyn[1].call(null, cst_No_case, c); + default: + var a$0 = param[1], d = [0, caml_call1(f, a$0), 0]; + return Re_Dyn[1].call(null, cst_Case, d); + }}; + } + function pp_ast(f, fmt, ast){ + function var$(s, re){return Re_Fmt[1].call(null, fmt, s, f, re);} + switch(ast[0]){ + case 0: + var alt = ast[1], a = Re_Fmt[10]; + return Re_Fmt[1].call + (null, + fmt, + cst_Alternative, + function(b, c){return a(0, f, b, c);}, + alt); + case 1: + var c = ast[1]; return var$(cst_No_case, c); + default: var c$0 = ast[1]; return var$(cst_Case, c$0); + } + } + var + cst_Complement = "Complement", + cst_Difference = "Difference", + cst_Intersection = "Intersection"; + function dyn_of_cset(param){ + switch(param[0]){ + case 0: + var cset = param[1], a = [0, Re_Cset[51].call(null, cset), 0]; + return Re_Dyn[1].call(null, "Cset", a); + case 1: + var + xs = param[1], + b = Stdlib_ListLabels[20].call(null, dyn_of_cset, xs); + return Re_Dyn[1].call(null, cst_Intersection, b); + case 2: + var + xs$0 = param[1], + d = Stdlib_ListLabels[20].call(null, dyn_of_cset, xs$0); + return Re_Dyn[1].call(null, cst_Complement, d); + case 3: + var + y = param[2], + x = param[1], + e = [0, dyn_of_cset(y), 0], + f = [0, dyn_of_cset(x), e]; + return Re_Dyn[1].call(null, cst_Difference, f); + default: + var c = param[1], g = [0, dyn_of_ast(dyn_of_cset)(c), 0]; + return Re_Dyn[1].call(null, "Cast", g); + } + } + var + cst_Beg_of_line = "Beg_of_line", + cst_Beg_of_str = "Beg_of_str", + cst_Beg_of_word = "Beg_of_word", + cst_End_of_line = "End_of_line", + cst_End_of_str = "End_of_str", + cst_End_of_word = "End_of_word", + cst_Group = "Group", + cst_Last_end_of_line = "Last_end_of_line", + cst_Nest = "Nest", + cst_No_group = "No_group", + cst_Not_bound = "Not_bound", + cst_Pmark = "Pmark", + cst_Repeat = "Repeat", + cst_Sem = "Sem", + cst_Sem_greedy = "Sem_greedy", + cst_Sequence = "Sequence", + cst_Set = "Set", + cst_Start = "Start", + cst_Stop = "Stop"; + function dyn_of_gen(f){ + return function(param){ + if(typeof param === "number") + switch(param){ + case 0: + return Re_Dyn[6].call(null, cst_Beg_of_line); + case 1: + return Re_Dyn[6].call(null, cst_End_of_line); + case 2: + return Re_Dyn[6].call(null, cst_Beg_of_word); + case 3: + return Re_Dyn[6].call(null, cst_End_of_word); + case 4: + return Re_Dyn[6].call(null, cst_Not_bound); + case 5: + return Re_Dyn[6].call(null, cst_Beg_of_str); + case 6: + return Re_Dyn[6].call(null, cst_End_of_str); + case 7: + return Re_Dyn[6].call(null, cst_Last_end_of_line); + case 8: + return Re_Dyn[6].call(null, cst_Start); + default: return Re_Dyn[6].call(null, cst_Stop); + } + switch(param[0]){ + case 0: + var a = param[1], b = [0, caml_call1(f, a), 0]; + return Re_Dyn[1].call(null, cst_Set, b); + case 1: + var ast = param[1], c = [0, dyn_of_ast(dyn_of_gen(f))(ast), 0]; + return Re_Dyn[1].call(null, "Ast", c); + case 2: + var + xs = param[1], + d = dyn_of_gen(f), + e = Stdlib_ListLabels[20].call(null, d, xs); + return Re_Dyn[1].call(null, cst_Sequence, e); + case 3: + var max = param[3], min = param[2], gen = param[1]; + if(max) + var x = max[1], base = [0, Re_Dyn[3].call(null, x), 0]; + else + var base = 0; + var + g = [0, Re_Dyn[3].call(null, min), base], + h = [0, dyn_of_gen(f)(gen), g]; + return Re_Dyn[1].call(null, cst_Repeat, h); + case 4: + var t = param[2], name = param[1], args = [0, dyn_of_gen(f)(t), 0]; + if(name) + var + name$0 = name[1], + args$0 = [0, Re_Dyn[7].call(null, name$0), args]; + else + var args$0 = args; + return Re_Dyn[1].call(null, cst_Group, args$0); + case 5: + var x$0 = param[1], i = [0, dyn_of_gen(f)(x$0), 0]; + return Re_Dyn[1].call(null, cst_No_group, i); + case 6: + var x$1 = param[1], j = [0, dyn_of_gen(f)(x$1), 0]; + return Re_Dyn[1].call(null, cst_Nest, j); + case 7: + var + t$0 = param[2], + pmark = param[1], + k = [0, dyn_of_gen(f)(t$0), 0], + l = [0, Re_Pmark[5].call(null, pmark), k]; + return Re_Dyn[1].call(null, cst_Pmark, l); + case 8: + var + t$1 = param[2], + sem = param[1], + m = [0, dyn_of_gen(f)(t$1), 0], + n = [0, caml_call1(Re_Automata[2][1], sem), m]; + return Re_Dyn[1].call(null, cst_Sem, n); + default: + var + t$2 = param[2], + rep = param[1], + o = [0, dyn_of_gen(f)(t$2), 0], + p = [0, caml_call1(Re_Automata[3][1], rep), o]; + return Re_Dyn[1].call(null, cst_Sem_greedy, p); + }}; + } + var + a = [0, [15, [17, [0, "@ ", 1, 0], [4, 0, 0, 0, [15, 0]]]], "%a@ %d%a"]; + function pp_gen(pp_cset, fmt, t){ + function pp(a, b){return pp_gen(pp_cset, a, b);} + function var$(s, re){return Re_Fmt[1].call(null, fmt, s, pp, re);} + if(typeof t === "number") + switch(t){ + case 0: + return Re_Fmt[2].call(null, fmt, cst_Beg_of_line); + case 1: + return Re_Fmt[2].call(null, fmt, cst_End_of_line); + case 2: + return Re_Fmt[2].call(null, fmt, cst_Beg_of_word); + case 3: + return Re_Fmt[2].call(null, fmt, cst_End_of_word); + case 4: + return Re_Fmt[2].call(null, fmt, cst_Not_bound); + case 5: + return Re_Fmt[2].call(null, fmt, cst_Beg_of_str); + case 6: + return Re_Fmt[2].call(null, fmt, cst_End_of_str); + case 7: + return Re_Fmt[2].call(null, fmt, cst_Last_end_of_line); + case 8: + return Re_Fmt[2].call(null, fmt, cst_Start); + default: return Re_Fmt[2].call(null, fmt, cst_Stop); + } + switch(t[0]){ + case 0: + var cset = t[1]; return caml_call2(pp_cset, fmt, cset); + case 1: + var a$0 = t[1]; return pp_ast(pp, fmt, a$0); + case 2: + var rel = t[1], b = Re_Fmt[10]; + return Re_Fmt[1].call + (null, + fmt, + cst_Sequence, + function(a, c){return b(0, pp, a, c);}, + rel); + case 3: + var + stop = t[3], + start = t[2], + re = t[1], + pp$0 = + function(fmt, param){ + var b = Re_Fmt[3]; + return caml_call5 + (Stdlib_Format[139].call(null, fmt)(a), + pp, + re, + start, + b, + stop); + }; + return Re_Fmt[1].call(null, fmt, cst_Repeat, pp$0, 0); + case 4: + var match = t[1]; + if(match){ + var c = t[2], n = match[1], d = Re_Fmt[2], e = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + fmt, + "Named_group", + function(a, b){return e(d, pp, a, b);}, + [0, n, c]); + } + var c$0 = t[2]; + return var$(cst_Group, c$0); + case 5: + var c$1 = t[1]; return var$(cst_No_group, c$1); + case 6: + var c$2 = t[1]; return var$(cst_Nest, c$2); + case 7: + var r = t[2], m = t[1], f = Re_Pmark[4], g = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + fmt, + cst_Pmark, + function(a, b){return g(f, pp, a, b);}, + [0, m, r]); + case 8: + var a$1 = t[2], sem = t[1], h = Re_Automata[2][2], i = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + fmt, + cst_Sem, + function(a, b){return i(h, pp, a, b);}, + [0, sem, a$1]); + default: + var re$0 = t[2], k = t[1], j = Re_Automata[3][2], l = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + fmt, + cst_Sem_greedy, + function(a, b){return l(j, pp, a, b);}, + [0, k, re$0]); + } + } + function pp_cset(fmt, cset){ + function seq(s, rel){ + var a = Re_Fmt[10]; + return Re_Fmt[1].call + (null, fmt, s, function(b, c){return a(0, pp_cset, b, c);}, rel); + } + switch(cset[0]){ + case 0: + var s = cset[1]; + return Re_Fmt[1].call(null, fmt, cst_Set, Re_Cset[39], s); + case 1: + var c = cset[1]; return seq(cst_Intersection, c); + case 2: + var c$0 = cset[1]; return seq(cst_Complement, c$0); + case 3: + var b = cset[2], a = cset[1], d = Re_Fmt[8]; + return Re_Fmt[1].call + (null, + fmt, + cst_Difference, + function(a, b){return d(pp_cset, pp_cset, a, b);}, + [0, a, b]); + default: var s$0 = cset[1]; return pp_ast(pp_cset, fmt, s$0); + } + } + function equal(cset, x1$4, x2$4){ + a: + { + b: + { + c: + { + var x1 = x1$4, x2 = x2$4; + d: + for(;;){ + if(typeof x1 === "number") break b; + switch(x1[0]){ + case 0: + if(typeof x2 === "number") break a; + if(0 !== x2[0]) break a; + var s2 = x2[1], s1 = x1[1]; + return caml_call2(cset, s1, s2); + case 1: + break c; + case 2: + break d; + case 3: + if(typeof x2 === "number") break a; + if(3 !== x2[0]) break a; + var + j2 = x2[3], + i2 = x2[2], + x2$0 = x2[1], + j1 = x1[3], + i1 = x1[2], + x1$0 = x1[1], + c = Re_Import[10][8].call(null, i1, i2); + if(c){ + var d = Stdlib_Option[12].call(null, Re_Import[10][8], j1, j2); + if(d){x1 = x1$0; x2 = x2$0; break;} + var e = d; + } + else + var e = c; + return e; + case 4: + if(typeof x2 === "number") break a; + if(4 === x2[0]) return 0; + break a; + case 6: + if(typeof x2 === "number") break a; + if(6 !== x2[0]) break a; + var x2$1 = x2[1], x1$1 = x1[1]; + x1 = x1$1; + x2 = x2$1; + break; + case 7: + if(typeof x2 === "number") break a; + if(7 !== x2[0]) break a; + var + r2 = x2[2], + m2 = x2[1], + r1 = x1[2], + m1 = x1[1], + f = Re_Pmark[1].call(null, m1, m2); + if(! f) return f; + x1 = r1; + x2 = r2; + break; + case 8: + if(typeof x2 === "number") break a; + if(8 !== x2[0]) break a; + var + x2$2 = x2[2], + sem = x2[1], + x1$2 = x1[2], + sem$0 = x1[1], + g = Re_Import[1][1].call(null, sem$0, sem); + if(! g) return g; + x1 = x1$2; + x2 = x2$2; + break; + case 9: + if(typeof x2 === "number") break a; + if(9 !== x2[0]) break a; + var + x2$3 = x2[2], + rep = x2[1], + x1$3 = x1[2], + rep$0 = x1[1], + h = Re_Import[1][1].call(null, rep$0, rep); + if(! h) return h; + x1 = x1$3; + x2 = x2$3; + break; + default: break a; + } + } + if(typeof x2 === "number") break a; + if(2 !== x2[0]) break a; + var l2 = x2[1], l1 = x1[1]; + return Stdlib_ListLabels[16].call + (null, function(a, b){return equal(cset, a, b);}, l1, l2); + } + if(typeof x2 === "number") break a; + if(1 !== x2[0]) break a; + var + y = x2[1], + x = x1[1], + eq = function(a, b){return equal(cset, a, b);}, + b = y[1], + a = x[1]; + return Stdlib_ListLabels[16].call(null, eq, a, b); + } + switch(x1){ + case 0: + if(typeof x2 !== "number" || x2) break a; break; + case 1: + if(typeof x2 !== "number" || 1 !== x2) break a; break; + case 2: + if(typeof x2 !== "number" || 2 !== x2) break a; break; + case 3: + if(typeof x2 !== "number" || 3 !== x2) break a; break; + case 4: + if(typeof x2 !== "number" || 4 !== x2) break a; break; + case 5: + if(typeof x2 !== "number" || 5 !== x2) break a; break; + case 6: + if(typeof x2 !== "number" || 6 !== x2) break a; break; + case 7: + if(typeof x2 !== "number" || 7 !== x2) break a; break; + case 8: + if(typeof x2 !== "number" || 8 !== x2) break a; break; + default: if(typeof x2 !== "number" || 9 > x2) break a; + } + return 1; + } + return 0; + } + var to_dyn = dyn_of_gen(dyn_of_cset); + function pp(a, b){return pp_gen(pp_cset, a, b);} + function cset(cset){return [0, [0, cset]];} + function handle_case_cset(ign_case$0, param$0){ + a: + { + b: + { + var ign_case = ign_case$0, param = param$0; + c: + for(;;) + switch(param[0]){ + case 0: + var s = param[1]; return ign_case ? Re_Cset[18].call(null, s) : s; + case 1: + break a; + case 2: + break b; + case 3: + var + r = param[2], + r$0 = param[1], + e = handle_case_cset(ign_case, r), + f = Re_Cset[13].call(null, Re_Cset[45], e), + g = handle_case_cset(ign_case, r$0); + return Re_Cset[12].call(null, g, f); + default: + var match = param[1]; + switch(match[0]){ + case 0: + break c; + case 1: + var a = match[1]; ign_case = 1; param = a; break; + default: var a$0 = match[1]; ign_case = 0; param = a$0; + } + } + var + l$1 = match[1], + h = + Stdlib_ListLabels[20].call + (null, function(a){return handle_case_cset(ign_case, a);}, l$1); + return Re_Cset[10].call(null, h); + } + var + l$0 = param[1], + c = + Stdlib_ListLabels[20].call + (null, function(a){return handle_case_cset(ign_case, a);}, l$0), + d = Re_Cset[10].call(null, c); + return Re_Cset[13].call(null, Re_Cset[45], d); + } + var + l = param[1], + b = + Stdlib_ListLabels[20].call + (null, function(a){return handle_case_cset(ign_case, a);}, l); + return Re_Cset[11].call(null, b); + } + function handle_case(ign_case$0, r$9){ + a: + { + var ign_case = ign_case$0, r = r$9; + b: + for(;;){ + if(typeof r === "number") return r; + switch(r[0]){ + case 0: + var s = r[1]; return [0, handle_case_cset(ign_case, s)]; + case 1: + var match = r[1]; + switch(match[0]){ + case 0: + break a; + case 1: + var r$0 = match[1]; ign_case = 1; r = r$0; break; + default: var r$1 = match[1]; ign_case = 0; r = r$1; + } + break; + case 2: + break b; + case 3: + var j = r[3], i = r[2], r$2 = r[1]; + return [3, handle_case(ign_case, r$2), i, j]; + case 4: + var r$3 = r[2], n = r[1]; return [4, n, handle_case(ign_case, r$3)]; + case 5: + var r$4 = r[1]; return [5, handle_case(ign_case, r$4)]; + case 6: + var r$5 = r[1]; return [6, handle_case(ign_case, r$5)]; + case 7: + var r$6 = r[2], i$0 = r[1]; + return [7, i$0, handle_case(ign_case, r$6)]; + case 8: + var r$7 = r[2], k = r[1]; return [8, k, handle_case(ign_case, r$7)]; + default: + var r$8 = r[2], k$0 = r[1]; + return [9, k$0, handle_case(ign_case, r$8)]; + } + } + var l$1 = r[1]; + return [2, + Stdlib_ListLabels[20].call + (null, function(a){return handle_case(ign_case, a);}, l$1)]; + } + var + l = match[1], + l$0 = + Stdlib_ListLabels[20].call + (null, function(a){return handle_case(ign_case, a);}, l); + return [1, [0, l$0]]; + } + function seq(l){if(l && ! l[2]){var r = l[1]; return r;} return [2, l];} + var + f = + Re_Dense_map[1].call + (null, + 256, + function(i){ + var a = Stdlib_Char[1].call(null, i); + return cset(Re_Cset[46].call(null, a)); + }); + function char(c){return caml_call1(f, c);} + var any = cset(Re_Cset[45]); + function str(s){ + var b = caml_ml_string_length(s) - 1 | 0, a = 0; + if(b < 0) + var l$0 = a; + else{ + var l = a, i = b; + for(;;){ + var + c = runtime.caml_string_get(s, i), + d = [0, caml_call1(f, c), l], + e = i - 1 | 0; + if(0 === i){var l$0 = d; break;} + l = d; + i = e; + } + } + return seq(l$0); + } + function as_set_elems(elems){ + try{ + var + e = + Stdlib_ListLabels[20].call + (null, + function(param){ + if(typeof param !== "number" && 0 === param[0]){var e = param[1]; return e;} + throw Stdlib[3]; + }, + elems); + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[3]) return 0; + throw caml_maybe_attach_backtrace(exn, 0); + } + return [0, e]; + } + var empty = [1, [0, 0]]; + function alt(elems){ + if(! elems) return empty; + if(! elems[2]){var x = elems[1]; return x;} + var match = as_set_elems(elems); + if(! match) return [1, [0, elems]]; + var elems$0 = match[1]; + return [0, [4, [0, elems$0]]]; + } + var epsilon = seq(0); + function repn(r, i, j){ + var cst_Re_repn = "Re.repn"; + if(Re_Import[5].call(null, i, 0)) Stdlib[1].call(null, cst_Re_repn); + if(j){ + var j$0 = j[1]; + if(Re_Import[5].call(null, j$0, i)) + return Stdlib[1].call(null, cst_Re_repn); + if(0 === j$0){ + if(0 === i) return epsilon; + } + else if(1 === j$0 && 1 === i) return r; + } + return [3, r, i, j]; + } + function rep(r){return repn(r, 0, 0);} + function rep1(r){return repn(r, 1, 0);} + var b = [0, 1]; + function opt(r){return repn(r, 0, b);} + var bow = 2, eow = 3; + function word(r){return seq([0, bow, [0, r, [0, eow, 0]]]);} + var bos = 5, eos = 6; + function whole_string(r){return seq([0, bos, [0, r, [0, eos, 0]]]);} + function make_set(f, t){ + if(typeof t !== "number" && 0 === t[0]){ + var x = t[1]; + return [0, [4, caml_call1(f[1], x)]]; + } + return [1, caml_call1(f[1], t)]; + } + function longest(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [8, -730718166, t]; + } + function shortest(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [8, -1034406550, t]; + } + function first(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [8, 332064784, t]; + } + function greedy(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [9, -904640576, t]; + } + function non_greedy(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [9, 620821490, t]; + } + function group(name, r){return [4, name, r];} + function no_group(t){ + if(typeof t !== "number" && 0 === t[0]) return t; + return [5, t]; + } + function nest(r){return [6, r];} + function set(str){return cset(Re_Cset[26].call(null, str));} + function mark(r){ + var i = Re_Pmark[3].call(null, 0); + return [0, i, [7, i, r]]; + } + function as_set_or_error(name, elems){ + var match = as_set_elems(elems); + if(! match) return Stdlib[1].call(null, name); + var s = match[1]; + return s; + } + function inter(elems){return [0, [1, as_set_or_error("Re.inter", elems)]];} + function compl(elems){return [0, [2, as_set_or_error("Re.compl", elems)]];} + function diff(r$0, r){ + if + (typeof r$0 !== "number" + && 0 === r$0[0] && typeof r !== "number" && 0 === r[0]){ + var r$1 = r[1], r$2 = r$0[1]; + return [0, [3, r$2, r$1]]; + } + return Stdlib[1].call(null, "Re.diff"); + } + var f$0 = [0, function(r){return [2, r];}]; + function case$(t){return make_set(f$0, t);} + var f$1 = [0, function(r){return [1, r];}]; + function no_case(t){return make_set(f$1, t);} + var c = [0, "lib/ast.ml", 363, 32]; + function witness(t){ + function witness(t$0){ + var t = t$0; + a: + for(;;){ + var cst = ""; + if(typeof t === "number") return cst; + switch(t[0]){ + case 0: + var + c$0 = t[1], + a = Re_Cset[49].call(null, c$0), + d = Re_Cset[4].call(null, a); + return Stdlib_String[1].call(null, 1, d); + case 1: + var match = t[1][1]; + if(! match) + throw caml_maybe_attach_backtrace([0, Assert_failure, c], 1); + var x = match[1]; + t = x; + break; + case 2: + var xs = t[1], e = Stdlib_ListLabels[20].call(null, witness, xs); + return Stdlib_String[7].call(null, cst, e); + case 3: + break a; + case 5: + var r$0 = t[1]; t = r$0; break; + case 6: + t = t[1]; break; + default: t = t[2]; + } + } + var + from = t[2], + r = t[1], + w = witness(r), + b = + Stdlib_Buffer[1].call + (null, runtime.caml_mul(caml_ml_string_length(w), from)); + if(from >= 1){ + var i = 1; + for(;;){ + Stdlib_Buffer[16].call(null, b, w); + var f = i + 1 | 0; + if(from === i) break; + i = f; + } + } + return Stdlib_Buffer[2].call(null, b); + } + return witness(handle_case(0, t)); + } + function merge_sequences(param$0){ + a: + { + var param = param$0; + b: + for(;;){ + if(! param) return 0; + var x = param[1]; + if(typeof x === "number") break a; + switch(x[0]){ + case 1: + var match = x[1]; + if(0 !== match[0]) break a; + var r$0 = param[2], l = match[1]; + param = Stdlib[37].call(null, l, r$0); + break; + case 2: + break b; + default: break a; + } + } + var match$0 = x[1]; + if(match$0){ + var + r$1 = param[2], + y = match$0[2], + x$0 = match$0[1], + r$2 = merge_sequences(r$1); + if(r$2){ + var a = r$2[1]; + if(typeof a !== "number" && 2 === a[0]){ + var match$1 = a[1]; + if(match$1){ + var r$3 = r$2[2], y$0 = match$1[2], x$1 = match$1[1]; + if(equal(Re_Cset[7], x$0, x$1)){ + var b = [0, seq(y$0), 0]; + return [0, [2, [0, x$0, [0, [1, [0, [0, seq(y), b]]], 0]]], r$3]; + } + } + } + } + return [0, [2, [0, x$0, y]], r$2]; + } + } + var r = param[2]; + return [0, x, merge_sequences(r)]; + } + function colorize(color_map, regexp){ + var lnl = [0, 0]; + function colorize(regexp$2){ + var regexp = regexp$2; + for(;;){ + if(typeof regexp === "number") + switch(regexp){ + case 7: + lnl[1] = 1; return 0; + case 0: + case 1: + return Re_Color_map[5].call(null, color_map, Re_Cset[24]); + case 2: + case 3: + case 4: + return Re_Color_map[5].call(null, color_map, Re_Cset[21]); + default: return 0; + } + switch(regexp[0]){ + case 0: + var s = regexp[1]; return Re_Color_map[5].call(null, color_map, s); + case 1: + var l = regexp[1][1]; + return Stdlib_ListLabels[18].call(null, colorize, l); + case 2: + var l$0 = regexp[1]; + return Stdlib_ListLabels[18].call(null, colorize, l$0); + case 3: + var regexp$0 = regexp[1]; regexp = regexp$0; break; + case 4: + case 7: + regexp = regexp[2]; break; + case 5: + case 6: + regexp = regexp[1]; break; + default: var regexp$1 = regexp[2]; regexp = regexp$1; + } + } + } + colorize(regexp); + return lnl[1]; + } + function anchored(param$0){ + var param = param$0; + for(;;){ + if(typeof param === "number") + switch(param){case 5:case 8: return 1;} + else + switch(param[0]){ + case 1: + var a = param[1]; + if(0 === a[0]){ + var als = a[1]; + return Stdlib_ListLabels[33].call(null, anchored, als); + } + var r = a[1]; + param = r; + continue; + case 2: + var l = param[1]; + return Stdlib_ListLabels[34].call(null, anchored, l); + case 3: + var i = param[2], r$0 = param[1], b = Re_Import[6].call(null, i, 0); + if(! b) return b; + param = r$0; + continue; + case 0: break; + case 5: + case 6: + param = param[1]; continue; + default: param = param[2]; continue; + } + return 0; + } + } + function t_of_cset(x){return [0, x];} + runtime.caml_register_global + (81, + [0, + to_dyn, + pp, + merge_sequences, + handle_case, + anchored, + colorize, + [0, + empty, + epsilon, + str, + no_case, + case$, + diff, + compl, + repn, + inter, + char, + any, + set, + mark, + nest, + no_group, + whole_string, + 7, + longest, + greedy, + non_greedy, + 9, + 4, + group, + word, + first, + bos, + bow, + eow, + eos, + 0, + 8, + 1, + opt, + rep, + rep1, + alt, + shortest, + seq, + pp, + witness], + cset, + t_of_cset], + "Re__Ast"); + return; + } + (globalThis)); + +//# 3381 "../.js/default/re/re.cma.js" +//# shape: Re__Group:[F(5)*,F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(2),F(1),F(1),F(2),F(1)*,F(1)*,F(2),N,F(2),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_check_bound = runtime.caml_check_bound, + caml_make_vect = runtime.caml_make_vect, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace; + 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_Format = global_data.Stdlib__Format, + Stdlib_Array = global_data.Stdlib__Array, + Re_Fmt = global_data.Re__Fmt, + Stdlib_String = global_data.Stdlib__String, + Re_Mark_infos = global_data.Re__Mark_infos, + Stdlib_Option = global_data.Stdlib__Option, + Stdlib = global_data.Stdlib; + function create(s, gcount, gpos, marks, pmarks){return [0, s, marks, pmarks, gpos, gcount]; + } + function is_present(t){return 0 <= t ? 1 : 0;} + function get_no_check(t){return t;} + var absent = -1; + function start_offset(t, i){ + var i$0 = Re_Mark_infos[6].call(null, t[2], i); + if(! Re_Mark_infos[5][1].call(null, i$0)) return absent; + var a = Re_Mark_infos[5][2].call(null, i$0); + return caml_check_bound(t[4], a)[a + 1]; + } + function stop_offset(t, i){ + var i$0 = Re_Mark_infos[7].call(null, t[2], i); + if(! Re_Mark_infos[5][1].call(null, i$0)) return absent; + var a = Re_Mark_infos[5][2].call(null, i$0); + return caml_check_bound(t[4], a)[a + 1]; + } + function offset_opt(t, i){ + var a = Re_Mark_infos[2].call(null, t[2], i); + return Stdlib_Option[7].call + (null, + function(param){ + var + stop = param[2], + start = param[1], + a = caml_check_bound(t[4], stop)[stop + 1]; + return [0, caml_check_bound(t[4], start)[start + 1], a]; + }, + a); + } + function or_not_found(param){ + if(! param) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var s = param[1]; + return s; + } + function offset(t, i){return or_not_found(offset_opt(t, i));} + function pmarks(t){return t[3];} + function get(t, i){ + var a = offset_opt(t, i); + return or_not_found + (Stdlib_Option[7].call + (null, + function(param){ + var p2 = param[2], p1 = param[1]; + return Stdlib_String[16].call(null, t[1], p1, p2 - p1 | 0); + }, + a)); + } + function start_opt(subs, i){ + var a = offset_opt(subs, i); + return Stdlib_Option[7].call(null, function(a){return a[1];}, a); + } + function start(subs, i){return or_not_found(start_opt(subs, i));} + function stop_opt(subs, i){ + var a = offset_opt(subs, i); + return Stdlib_Option[7].call(null, function(a){return a[2];}, a); + } + function stop(subs, i){return or_not_found(stop_opt(subs, i));} + function test(t, i){return Re_Mark_infos[3].call(null, t[2], i);} + function get_opt(t, i){return test(t, i) ? [0, get(t, i)] : 0;} + var dummy_offset = [0, -1, -1]; + function all_offset(t){ + var res = caml_make_vect(t[5], dummy_offset); + Re_Mark_infos[4].call + (null, + t[2], + function(i, start, stop){ + var + p1 = caml_check_bound(t[4], start)[start + 1], + p2 = caml_check_bound(t[4], stop)[stop + 1]; + caml_check_bound(res, i)[i + 1] = [0, p1, p2]; + return 0; + }); + return res; + } + var cst = ""; + function all(t){ + var res = caml_make_vect(t[5], cst); + Re_Mark_infos[4].call + (null, + t[2], + function(i, start, stop){ + var + p1 = caml_check_bound(t[4], start)[start + 1], + p2 = caml_check_bound(t[4], stop)[stop + 1], + a = Stdlib_String[16].call(null, t[1], p1, p2 - p1 | 0); + caml_check_bound(res, i)[i + 1] = a; + return 0; + }); + return res; + } + var + a = + [0, + [18, + [1, [0, 0, cst]], + [12, + 40, + [2, + 0, + [11, + " (", + [4, 0, 0, 0, [12, 32, [4, 0, 0, 0, [11, "))", [17, 0, 0]]]]]]]]], + "@[(%s (%d %d))@]"]; + function pp(fmt, t){ + var + offsets = all_offset(t), + strs = all(t), + b = + Stdlib_Array[1].call + (null, + strs.length - 1, + function(i){ + var a = caml_check_bound(offsets, i)[i + 1]; + return [0, caml_check_bound(strs, i)[i + 1], a]; + }), + matches = Stdlib_Array[10].call(null, b); + function pp_match(fmt, param){ + var match = param[2], stop = match[2], start = match[1], str = param[1]; + return caml_call3 + (Stdlib_Format[139].call(null, fmt)(a), str, start, stop); + } + var c = Re_Fmt[10]; + return Re_Fmt[1].call + (null, + fmt, + "Group", + function(a, b){return c(0, pp_match, a, b);}, + matches); + } + function nb_groups(t){return t[5];} + runtime.caml_register_global + (11, + [0, + create, + get, + get_opt, + offset, + offset_opt, + start, + start_opt, + stop, + stop_opt, + all, + all_offset, + test, + pmarks, + nb_groups, + pp, + [0, is_present, get_no_check], + start_offset, + stop_offset], + "Re__Group"); + return; + } + (globalThis)); + +//# 3563 "../.js/default/re/re.cma.js" +//# shape: Re__Slice:[N] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + global_data = runtime.caml_get_global_data(), + Re_Import = global_data.Re__Import, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Assert_failure = global_data.Assert_failure, + cst_lib_slice_ml = "lib/slice.ml", + a = [0, cst_lib_slice_ml, 22, 20], + b = [0, cst_lib_slice_ml, 39, 18]; + function get_substring(slices, remains, stop){ + a: + { + if(Re_Import[3].call(null, stop, remains)) return ""; + var slices$0 = slices, remains$0 = remains; + for(;;){ + if(Re_Import[3].call(null, remains$0, 0)){var slices$2 = slices$0; break a;} + if(! slices$0) + throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); + var + slices$1 = slices$0[2], + slice = slices$0[1], + len = slice[3], + pos = slice[2], + remains$1 = remains$0 - len | 0; + if(0 > remains$1) break; + slices$0 = slices$1; + remains$0 = remains$1; + } + var + pos$0 = pos + remains$0 | 0, + len$0 = len - remains$0 | 0, + slices$2 = [0, [0, slice[1], pos$0, len$0], slices$1]; + } + var + buf = Stdlib_Buffer[1].call(null, stop - remains | 0), + remains$4 = stop - remains | 0, + slices$3 = slices$2, + remains$2 = remains$4; + for(;;){ + if(Re_Import[6].call(null, remains$2, 0)){ + if(! slices$3) + throw caml_maybe_attach_backtrace([0, Assert_failure, b], 1); + var + slices$4 = slices$3[2], + match = slices$3[1], + len$1 = match[3], + pos$1 = match[2], + s = match[1], + remains$3 = remains$2 - len$1 | 0; + if(Re_Import[6].call(null, remains$3, 0)){ + Stdlib_Buffer[18].call(null, buf, s, pos$1, len$1); + slices$3 = slices$4; + remains$2 = remains$3; + continue; + } + Stdlib_Buffer[18].call(null, buf, s, pos$1, remains$2); + } + return Stdlib_Buffer[2].call(null, buf); + } + } + function drop_rev(t$1, remains$1){ + if(Re_Import[3].call(null, remains$1, 0)) return t$1; + var + t$2 = Stdlib_ListLabels[10].call(null, t$1), + t = t$2, + remains = remains$1; + for(;;){ + if(Re_Import[3].call(null, remains, 0)) + var a = t; + else if(t){ + var t$0 = t[2], slice = t[1], len = slice[3], pos = slice[2]; + if(len <= remains){ + var remains$0 = remains - len | 0; + t = t$0; + remains = remains$0; + continue; + } + var + delta = len - remains | 0, + a = [0, [0, slice[1], pos + delta | 0, len - delta | 0], t$0]; + } + else + var a = 0; + return Stdlib_ListLabels[10].call(null, a); + } + } + runtime.caml_register_global + (7, [0, [0, get_substring, drop_rev]], "Re__Slice"); + return; + } + (globalThis)); + +//# 3663 "../.js/default/re/re.cma.js" +//# shape: Re__Compile:[N,F(6),F(6),F(4),F(1),F(1)*,F(1)*,F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_check_bound = runtime.caml_check_bound, + 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_string_get = runtime.caml_string_get, + 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]); + } + 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(), + Re_Import = global_data.Re__Import, + Stdlib_Mutex = global_data.Stdlib__Mutex, + Re_Color_map = global_data.Re__Color_map, + Re_Cset = global_data.Re__Cset, + Stdlib_Char = global_data.Stdlib__Char, + Re_Automata = global_data.Re__Automata, + Re_Category = global_data.Re__Category, + Re_Ast = global_data.Re__Ast, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Stdlib = global_data.Stdlib, + Re_Group = global_data.Re__Group, + Re_Slice = global_data.Re__Slice, + Re_Mark_infos = global_data.Re__Mark_infos, + Stdlib_Option = global_data.Stdlib__Option, + Re_Pmark = global_data.Re__Pmark, + Stdlib_Array = global_data.Stdlib__Array; + function break_idx(t){return (t + 5 | 0) * -1 | 0;} + function get_info(param){return param[1];} + function follow_transition(param, color){ + return param[(1 + Re_Cset[2].call(null, color) | 0) + 1]; + } + function set_transition(param, color, st){ + var a = 1 + Re_Cset[2].call(null, color) | 0; + caml_check_bound(param, a)[a + 1] = st; + } + var unknown = -2; + function is_unknown_transition(st, color){ + var + st$0 = follow_transition(st, color), + info = get_info(st$0), + x = info[1]; + return Re_Import[3].call(null, x, unknown); + } + var info = [0, unknown, 0, Re_Automata[21][2]]; + function pp_re(ch, re){return Re_Automata[5].call(null, ch, re[1]);} + function group_count(re){return re[10];} + function group_names(re){return re[9];} + function unsafe_set(t, idx, pos){t[1][idx + 1] = pos;} + function set(t, idx, pos$0){ + if(t[2] <= idx) + for(;;){ + t[2] = 2 * t[2] | 0; + if(t[2] > idx){ + var pos = t[1]; + t[1] = caml_make_vect(t[2], 0); + Stdlib_Array[9].call(null, pos, 0, t[1], 0, pos.length - 1); + break; + } + } + return unsafe_set(t, idx, pos$0); + } + function first(t){return caml_check_bound(t[1], 0)[1];} + var empty = [0, [0], 0]; + function make(groups, re){ + if(! groups) return empty; + var length = caml_call1(Re_Automata[22][2], re[7]) + 1 | 0; + return [0, caml_make_vect(length, 0), length]; + } + function category(re, color){ + if(Re_Cset[1].call(null, color, Re_Cset[6])) return Re_Category[4]; + if(Re_Cset[1].call(null, color, re[6])){ + var + a = Re_Category[6], + b = Re_Category[1].call(null, Re_Category[8], Re_Category[7]); + return Re_Category[1].call(null, b, a); + } + var c = Re_Color_map[1][1].call(null, re[4], color); + return Re_Category[2].call(null, c); + } + var unknown_state = [0, info]; + function find_state(re, desc){ + try{var b = caml_call2(Re_Automata[21][8][7], re[8], desc); return b;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + var match = caml_call1(Re_Automata[21][5], desc); + a: + { + if(typeof match === "number" && match){var break_state = 0; break a;} + var break_state = 1; + } + var + idx = caml_call1(Re_Automata[21][4], desc), + a = + break_state + ? -5 - caml_call1(Re_Automata[19][1], idx) | 0 + : caml_call1(Re_Automata[19][1], idx), + state = [0, a, 0, desc]; + if(break_state) + var st$0 = [0, state]; + else{ + var ncol = re[5], st = caml_make_vect(ncol + 1 | 0, unknown_state); + caml_check_bound(st, 0)[1] = state; + var st$0 = st; + } + caml_call3(Re_Automata[21][8][5], re[8], desc, st$0); + return st$0; + } + } + function delta(re, cat, color, st){ + return Re_Automata[23].call(null, re[7], cat, color, st[3]); + } + function validate(re, s, pos, st){ + var + a = caml_string_get(s, pos), + color = Re_Color_map[2][2].call(null, re[3], a); + Stdlib_Mutex[2].call(null, re[11]); + if(is_unknown_transition(st, color)){ + var + cat = category(re, color), + desc = delta(re, cat, color, get_info(st)), + st$0 = find_state(re, desc); + set_transition(st, color, st$0); + } + return Stdlib_Mutex[4].call(null, re[11]); + } + function next(colors, st, s, pos){ + return follow_transition + (st, + Re_Color_map[2][2].call + (null, colors, caml_string_unsafe_get(s, pos))); + } + function loop_no_mark(re, colors, s, pos$1, last, st0$1, st$0){ + var pos = pos$1, st0 = st0$1, st = st$0; + for(;;){ + if(! Re_Import[5].call(null, pos, last)) return st; + var st0$0 = next(colors, st, s, pos), idx = get_info(st0$0)[1]; + if(0 <= idx){ + var pos$0 = pos + 1 | 0; + pos = pos$0; + st0 = st0$0; + st = st0$0; + } + else{if(idx <= -3) return st0$0; validate(re, s, pos, st0); st = st0;} + } + } + function final(re, st, cat){ + try{var c = Stdlib_ListLabels[51].call(null, cat, st[2]); return c;} + catch(exn$1){ + var exn = caml_wrap_exception(exn$1); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + Stdlib_Mutex[2].call(null, re[11]); + try{var b = Stdlib_ListLabels[51].call(null, cat, st[2]), res$0 = b;} + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$0, 0); + var + st$0 = delta(re, cat, Re_Cset[6], st), + a = caml_call1(Re_Automata[21][5], st$0), + res = [0, caml_call1(Re_Automata[21][4], st$0), a]; + st[2] = [0, [0, cat, res], st[2]]; + var res$0 = res; + } + Stdlib_Mutex[4].call(null, re[11]); + return res$0; + } + } + function find_initial_state(re, cat){ + try{var b = Stdlib_ListLabels[51].call(null, cat, re[2]); return b;} + catch(exn$1){ + var exn = caml_wrap_exception(exn$1); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + Stdlib_Mutex[2].call(null, re[11]); + try{var a = Stdlib_ListLabels[51].call(null, cat, re[2]), res = a;} + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$0, 0); + var st = find_state(re, caml_call2(Re_Automata[21][3], cat, re[1])); + re[2] = [0, [0, cat, st], re[2]]; + var res = st; + } + Stdlib_Mutex[4].call(null, re[11]); + return res; + } + } + function get_color(re, s, pos){ + if(Re_Import[5].call(null, pos, 0)) return Re_Cset[6]; + var slen = caml_ml_string_length(s); + if(slen <= pos) return Re_Cset[6]; + if + (Re_Import[3].call(null, pos, slen - 1 | 0) + && + ! + Re_Cset[1].call(null, re[6], Re_Cset[6]) + && Stdlib_Char[6].call(null, caml_string_unsafe_get(s, pos), 10)) + return re[6]; + return Re_Color_map[2][2].call + (null, re[3], caml_string_unsafe_get(s, pos)); + } + function scan_str(re, positions, s, initial_state, last, pos$2, groups){ + if + (Re_Import[3].call(null, last, caml_ml_string_length(s)) + && + ! + Re_Cset[1].call(null, re[6], Re_Cset[6]) + && Re_Import[6].call(null, last, pos$2)){ + var a = caml_string_get(s, last - 1 | 0); + if(Stdlib_Char[6].call(null, a, 10)){ + var + last$0 = last - 1 | 0, + st$2 = scan_str(re, positions, s, initial_state, last$0, pos$2, groups), + x$0 = get_info(st$2)[1]; + if(x$0 <= -3) return st$2; + for(;;){ + var + st$0 = follow_transition(st$2, re[6]), + info = get_info(st$0), + t = info[1]; + if(0 <= t){ + if(groups){var t$0 = info[1]; set(positions, t$0, last$0);} + return st$0; + } + var x = info[1]; + if(x <= -3){ + if(groups) set(positions, break_idx(info[1]), last$0); + return st$0; + } + var color = re[6]; + Stdlib_Mutex[2].call(null, re[11]); + if(is_unknown_transition(st$2, color)){ + var + cat = category(re, color), + real_c = Re_Color_map[2][2].call(null, re[3], 10), + desc = delta(re, cat, real_c, get_info(st$2)), + st$1 = find_state(re, desc); + set_transition(st$2, color, st$1); + } + Stdlib_Mutex[4].call(null, re[11]); + } + } + } + if(! groups) + return loop_no_mark + (re, re[3], s, pos$2, last, initial_state, initial_state); + var colors = re[3], pos = pos$2, st0 = initial_state, st = initial_state; + for(;;){ + if(! Re_Import[5].call(null, pos, last)) return st; + var st0$0 = next(colors, st, s, pos), idx = get_info(st0$0)[1]; + if(0 <= idx) + if(Re_Import[5].call(null, idx, positions[2])){ + unsafe_set(positions, idx, pos); + var pos$0 = pos + 1 | 0; + pos = pos$0; + st0 = st0$0; + st = st0$0; + } + else{ + set(positions, idx, pos); + var pos$1 = pos + 1 | 0; + pos = pos$1; + st0 = st0$0; + st = st0$0; + } + else{ + if(idx <= -3){set(positions, break_idx(idx), pos); return st0$0;} + validate(re, s, pos, st0); + st = st0; + } + } + } + function final_boundary_check + (re, positions, last, slen, s, state_info, groups){ + var + a = + Re_Import[3].call(null, last, slen) + ? Re_Category[4] + : category(re, get_color(re, s, last)), + final_cat = Re_Category[1].call(null, Re_Category[9], a), + match = final(re, state_info, final_cat), + res = match[2], + idx = match[1]; + if(groups && typeof res !== "number") + set(positions, caml_call1(Re_Automata[19][1], idx), last); + return res; + } + function make_match_str(re, positions, len, groups, partial, s, pos){ + var + slen = caml_ml_string_length(s), + last = Re_Import[3].call(null, len, -1) ? slen : pos + len | 0, + a = + Re_Import[3].call(null, pos, 0) + ? Re_Category[4] + : category(re, get_color(re, s, pos - 1 | 0)), + initial_cat = Re_Category[1].call(null, Re_Category[9], a), + initial_state = find_initial_state(re, initial_cat), + st = scan_str(re, positions, s, initial_state, last, pos, groups), + state_info = get_info(st), + x = state_info[1]; + a: + if(x > -3){ + if(partial && ! groups) break a; + if(partial && groups){ + var status = caml_call2(Re_Automata[21][6], re[11], state_info[3]); + if(typeof status === "number" && status){ + var + status$0 = + final_boundary_check + (re, positions, last, slen, s, state_info, groups); + return typeof status$0 === "number" ? 1 : status$0; + } + return status; + } + return final_boundary_check + (re, positions, last, slen, s, state_info, groups); + } + return caml_call2(Re_Automata[21][6], re[11], state_info[3]); + } + function create(re){ + var + category = Re_Category[1].call(null, Re_Category[9], Re_Category[4]), + state = find_initial_state(re, category); + return [0, state, re]; + } + function feed(t, s, pos, len){ + var + last = pos + len | 0, + state = loop_no_mark(t[2], t[2][3], s, pos, last, t[1], t[1]), + info = get_info(state), + x = info[1]; + if(x <= -3){ + var match = caml_call2(Re_Automata[21][6], t[2][11], info[3]); + a: + {if(typeof match === "number" && ! match){var a = 1; break a;} var a = 0; + } + if(a) return 0; + } + return [0, [0, state, t[2]]]; + } + function finalize(t, s, pos, len){ + var + last = pos + len | 0, + state = scan_str(t[2], empty, s, t[1], last, pos, 0), + info = get_info(state), + final_cat = Re_Category[1].call(null, Re_Category[9], Re_Category[4]); + return typeof final(t[2], info, final_cat)[2] === "number" ? 0 : 1; + } + function no_match_starts_before(t){return t[5];} + function create$0(t){return [0, t, make(1, t[2]), 0, 0, 0];} + function test_mark(t, mark){ + return caml_call2(Re_Pmark[6][31], mark, t[1]); + } + function get(t, i){ + var a = Re_Mark_infos[2].call(null, t[3], i); + return Stdlib_Option[7].call + (null, + function(param){ + var + stop = param[2], + start = param[1], + a = t[5], + start$0 = caml_check_bound(t[4], start)[start + 1] - a | 0, + b = t[5], + stop$0 = caml_check_bound(t[4], stop)[stop + 1] - b | 0; + return caml_call3(Re_Slice[1][1], t[2], start$0, stop$0); + }, + a); + } + function loop(re, abs_pos, colors, positions, s, pos$2, last, st0$1, st$0){ + var pos = pos$2, st0 = st0$1, st = st$0; + for(;;){ + if(! Re_Import[5].call(null, pos, last)) return st; + var st0$0 = next(colors, st, s, pos), idx = get_info(st0$0)[1]; + if(0 <= idx) + if(Re_Import[5].call(null, idx, positions[2])){ + unsafe_set(positions, idx, abs_pos + pos | 0); + var pos$0 = pos + 1 | 0; + pos = pos$0; + st0 = st0$0; + st = st0$0; + } + else{ + set(positions, idx, abs_pos + pos | 0); + var pos$1 = pos + 1 | 0; + pos = pos$1; + st0 = st0$0; + st = st0$0; + } + else{ + if(idx <= -3){ + set(positions, break_idx(idx), abs_pos + pos | 0); + return st0$0; + } + validate(re, s, pos, st0); + st = st0; + } + } + } + function feed$0(tt, s, pos, len){ + var + abs_pos = tt[4], + slices = tt[3], + positions = tt[2], + t = tt[1], + last = pos + len | 0, + state = loop(t[2], abs_pos, t[2][3], positions, s, pos, last, t[1], t[1]), + info = get_info(state), + x = info[1]; + if(x <= -3){ + var match = caml_call2(Re_Automata[21][6], t[2][11], info[3]); + a: + {if(typeof match === "number" && ! match){var a = 1; break a;} var a = 0; + } + if(a) return 0; + } + var + t$0 = [0, state, t[2]], + slices$0 = [0, [0, s, pos, len], slices], + first_match_pos = first(positions), + slices$1 = + caml_call2(Re_Slice[1][2], slices$0, first_match_pos - tt[5] | 0), + abs_pos$0 = abs_pos + len | 0; + return [0, [0, t$0, tt[2], slices$1, abs_pos$0, first_match_pos]]; + } + function finalize$0(tt, s, pos, len){ + var + abs_pos = tt[4], + slices = tt[3], + positions = tt[2], + t = tt[1], + last = pos + len | 0, + state = loop(t[2], abs_pos, t[2][3], positions, s, pos, last, t[1], t[1]), + info = get_info(state), + s$0 = caml_call2(Re_Automata[21][6], t[2][11], info[3]); + if(typeof s$0 === "number" && s$0) + var + final_cat = Re_Category[1].call(null, Re_Category[9], Re_Category[4]), + match = final(t[2], info, final_cat), + res = match[2], + idx = match[1], + match$0 = + typeof res === "number" + ? res + : (set + (positions, + caml_call1(Re_Automata[19][1], idx), + abs_pos + last | 0), + res); + else + var match$0 = s$0; + if(typeof match$0 === "number") return 0; + var + pmarks = match$0[2], + marks = match$0[1], + first_match_position = first(positions), + slices$0 = [0, [0, s, pos, len], slices], + slices$1 = + caml_call2(Re_Slice[1][2], slices$0, first_match_position - tt[5] | 0), + slices$2 = Stdlib_ListLabels[10].call(null, slices$1), + positions$0 = positions[1]; + return [0, + [0, pmarks, slices$2, marks, positions$0, first_match_position]]; + } + function match_str_no_bounds(groups, partial, re, s, pos, len){ + var + positions = make(groups, re), + match = make_match_str(re, positions, len, groups, partial, s, pos); + if(typeof match !== "number"){ + var pmarks = match[2], marks = match[1]; + return [0, + Re_Group[1].call(null, s, re[10], positions[1], marks, pmarks)]; + } + if(! match) return 0; + var no_match_starts_before = groups ? first(positions) : 0; + return [1, no_match_starts_before]; + } + var cst_Re_exec_out_of_bounds = "Re.exec: out of bounds"; + function match_str_p(re, s, pos, len){ + var a = Re_Import[5].call(null, pos, 0); + if(a) + var b = a; + else + var + c = Re_Import[5].call(null, len, -1), + b = + c || Re_Import[6].call(null, pos + len | 0, caml_ml_string_length(s)); + if(b) Stdlib[1].call(null, cst_Re_exec_out_of_bounds); + return typeof make_match_str(re, empty, len, 0, 0, s, pos) === "number" + ? 0 + : 1; + } + function match_str(groups, partial, re, s, pos, len){ + var a = Re_Import[5].call(null, pos, 0); + if(a) + var b = a; + else + var + c = Re_Import[5].call(null, len, -1), + b = + c || Re_Import[6].call(null, pos + len | 0, caml_ml_string_length(s)); + if(b) Stdlib[1].call(null, cst_Re_exec_out_of_bounds); + return match_str_no_bounds(groups, partial, re, s, pos, len); + } + function enforce_kind(ids, kind$0, kind, cr){ + if(typeof kind$0 === "number" && 332064784 === kind$0){ + if(typeof kind === "number" && 332064784 === kind) return cr; + var a = Re_Automata[11].call(null, ids); + return Re_Automata[10].call(null, ids, kind, cr, a); + } + return cr; + } + function translate(ctx$2, ast$3){ + a: + { + b: + { + c: + { + d: + { + e: + { + var ctx = ctx$2, ast = ast$3; + f: + for(;;){ + var + colors = ctx[8], + cache = ctx[7], + names = ctx[6], + pos = ctx[5], + greedy = ctx[4], + ign_group = ctx[3], + kind = ctx[2], + ids = ctx[1]; + if(typeof ast === "number") break a; + switch(ast[0]){ + case 0: + break b; + case 1: + break c; + case 2: + var l$1 = ast[1]; return [0, trans_seq(ctx, l$1), kind]; + case 3: + break d; + case 4: + var ast$0 = ast[2], n$2 = ast[1]; + if(! ign_group) break e; + ast = ast$0; + break; + case 5: + var + ast$1 = ast[1], + ctx$0 = + [0, ctx[1], ctx[2], 1, ctx[4], ctx[5], ctx[6], ctx[7], ctx[8]]; + ctx = ctx$0; + ast = ast$1; + break; + case 6: + break f; + case 7: + var + r$2 = ast[2], + i$1 = ast[1], + match$4 = translate(ctx, r$2), + kind$4 = match$4[2], + cr$3 = match$4[1], + M = Re_Automata[14].call(null, ids, i$1); + return [0, + Re_Automata[10].call(null, ids, 332064784, M, cr$3), + kind$4]; + case 8: + var + r$3 = ast[2], + kind$5 = ast[1], + match$5 = + translate + ([0, + ctx[1], + kind$5, + ctx[3], + ctx[4], + ctx[5], + ctx[6], + ctx[7], + ctx[8]], + r$3), + kind$6 = match$5[2], + cr$4 = match$5[1]; + return [0, enforce_kind(ids, kind$5, kind$6, cr$4), kind$5]; + default: + var + ast$2 = ast[2], + greedy$0 = ast[1], + ctx$1 = + [0, + ctx[1], + ctx[2], + ctx[3], + greedy$0, + ctx[5], + ctx[6], + ctx[7], + ctx[8]]; + ctx = ctx$1; + ast = ast$2; + } + } + var + r$1 = ast[1], + b = pos[1], + match$3 = translate(ctx, r$1), + kind$3 = match$3[2], + cr$2 = match$3[1], + e = caml_call1(Re_Automata[1][3], pos[1]), + K = caml_call2(Re_Automata[1][1], e, b); + if(Re_Import[3].call(null, K, -1)) return [0, cr$2, kind$3]; + var L = Re_Automata[15].call(null, ids, b, e); + return [0, + Re_Automata[10].call(null, ids, 332064784, L, cr$2), + kind$3]; + } + var p = pos[1]; + if(n$2){ + var name = n$2[1], F = names[1]; + names[1] = [0, [0, name, caml_call1(Re_Automata[1][6], p)], F]; + } + pos[1] = caml_call1(Re_Automata[1][5], pos[1]); + var + match$2 = translate(ctx, ast$0), + kind$2 = match$2[2], + cr$1 = match$2[1], + G = caml_call1(Re_Automata[1][4], p), + H = Re_Automata[13].call(null, ids, G), + I = Re_Automata[10].call(null, ids, 332064784, cr$1, H), + J = Re_Automata[13].call(null, ids, p); + return [0, Re_Automata[10].call(null, ids, 332064784, J, I), kind$2]; + } + var + j = ast[3], + i$0 = ast[2], + r$0 = ast[1], + match$1 = translate(ctx, r$0), + kind$1 = match$1[2], + cr$0 = match$1[1]; + if(j){ + var + j$0 = j[1], + f = + 620821490 <= greedy + ? function + (rem){ + var + a = Re_Automata[18].call(null, ids, cr$0), + b = [0, Re_Automata[10].call(null, ids, kind$1, a, rem), 0], + c = [0, Re_Automata[11].call(null, ids), b]; + return Re_Automata[9].call(null, ids, c); + } + : function + (rem){ + var + a = [0, Re_Automata[11].call(null, ids), 0], + b = Re_Automata[18].call(null, ids, cr$0), + c = [0, Re_Automata[10].call(null, ids, kind$1, b, rem), a]; + return Re_Automata[9].call(null, ids, c); + }, + v$2 = Re_Automata[11].call(null, ids), + n$1 = j$0 - i$0 | 0, + n = n$1, + v = v$2; + for(;;){ + if(Re_Import[10][8].call(null, n, 0)){var rem = v, n$4 = i$0; break;} + var v$0 = f(v), n$0 = n - 1 | 0; + n = n$0; + v = v$0; + } + } + else + var + rem = Re_Automata[12].call(null, ids, greedy, kind$1, cr$0), + n$4 = i$0; + for(;;){ + if(Re_Import[10][8].call(null, n$4, 0)) return [0, rem, kind]; + var + E = Re_Automata[18].call(null, ids, cr$0), + v$3 = Re_Automata[10].call(null, ids, kind$1, E, rem), + n$3 = n$4 - 1 | 0; + rem = v$3; + n$4 = n$3; + } + } + var l$0 = ast[1][1], merged_sequences = Re_Ast[3].call(null, l$0); + if(merged_sequences && ! merged_sequences[2]){ + var + r = merged_sequences[1], + match$0 = translate(ctx, r), + kind$0 = match$0[2], + cr = match$0[1]; + return [0, enforce_kind(ids, kind, kind$0, cr), kind]; + } + var + D = + Stdlib_ListLabels[20].call + (null, + function(r){ + var match = translate(ctx, r), kind$0 = match[2], cr = match[1]; + return enforce_kind(ids, kind, kind$0, cr); + }, + merged_sequences); + return [0, Re_Automata[9].call(null, ids, D), kind]; + } + var s = ast[1], match = Re_Cset[40].call(null, s); + if(match) + var + i = match[1], + c = Re_Color_map[2][1].call(null, colors, i), + a = Re_Cset[46].call(null, c); + else{ + var v$1 = [0, Re_Cset[42].call(null, s), s]; + try{var d = caml_call2(Re_Cset[44][17], v$1, cache[1]), a = d;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + var l = Re_Color_map[2][3].call(null, colors, s); + cache[1] = caml_call3(Re_Cset[44][2], v$1, l, cache[1]); + var a = l; + } + } + return [0, Re_Automata[7].call(null, ids, a), kind]; + } + switch(ast){ + case 0: + var g = Re_Category[1].call(null, Re_Category[4], Re_Category[7]); + return [0, Re_Automata[17].call(null, ids, g), kind]; + case 1: + var h = Re_Category[1].call(null, Re_Category[4], Re_Category[7]); + return [0, Re_Automata[16].call(null, ids, h), kind]; + case 2: + var + k = Re_Automata[16].call(null, ids, Re_Category[5]), + m = Re_Category[1].call(null, Re_Category[4], Re_Category[6]), + o = Re_Automata[17].call(null, ids, m); + return [0, Re_Automata[10].call(null, ids, 332064784, o, k), kind]; + case 3: + var + q = Re_Category[1].call(null, Re_Category[4], Re_Category[6]), + t = Re_Automata[16].call(null, ids, q), + u = Re_Automata[17].call(null, ids, Re_Category[5]); + return [0, Re_Automata[10].call(null, ids, 332064784, u, t), kind]; + case 4: + var + cat = Re_Category[1].call(null, Re_Category[4], Re_Category[6]), + w = Re_Automata[16].call(null, ids, cat), + x = Re_Automata[17].call(null, ids, cat), + y = [0, Re_Automata[10].call(null, ids, 332064784, x, w), 0], + z = Re_Automata[16].call(null, ids, Re_Category[5]), + A = Re_Automata[17].call(null, ids, Re_Category[5]), + B = [0, Re_Automata[10].call(null, ids, 332064784, A, z), y]; + return [0, Re_Automata[9].call(null, ids, B), kind]; + case 5: + return [0, Re_Automata[17].call(null, ids, Re_Category[4]), kind]; + case 6: + return [0, Re_Automata[16].call(null, ids, Re_Category[4]), kind]; + case 7: + var C = Re_Category[1].call(null, Re_Category[4], Re_Category[8]); + return [0, Re_Automata[16].call(null, ids, C), kind]; + case 8: + return [0, Re_Automata[17].call(null, ids, Re_Category[9]), kind]; + default: + return [0, Re_Automata[16].call(null, ids, Re_Category[9]), kind]; + } + } + function trans_seq(ctx, param){ + var kind = ctx[2], ids = ctx[1]; + if(! param) return Re_Automata[11].call(null, ids); + var r = param[1]; + if(param[2]){ + var + rem = param[2], + match = translate(ctx, r), + kind$0 = match[2], + cr = match[1], + cr$0 = trans_seq(ctx, rem); + return Re_Automata[4].call(null, cr$0) + ? cr + : Re_Automata + [4].call + (null, cr) + ? cr$0 + : Re_Automata[10].call(null, ids, kind$0, cr, cr$0); + } + var match$0 = translate(ctx, r), kind$1 = match$0[2], cr$1 = match$0[1]; + return enforce_kind(ids, kind, kind$1, cr$1); + } + function compile(r$0){ + if(Re_Ast[5].call(null, r$0)) + var regexp$0 = caml_call2(Re_Ast[7][23], 0, r$0); + else + var + e = [0, caml_call2(Re_Ast[7][23], 0, r$0), 0], + f = caml_call1(Re_Ast[7][34], Re_Ast[7][11]), + g = [0, caml_call1(Re_Ast[7][37], f), e], + regexp$0 = caml_call1(Re_Ast[7][38], g); + var + regexp = Re_Ast[4].call(null, 0, regexp$0), + color_map = Re_Color_map[3].call(null, 0), + need_lnl = Re_Ast[6].call(null, color_map, regexp), + match = Re_Color_map[4].call(null, color_map), + color_repr = match[2], + colors = match[1], + ncolor = Re_Color_map[1][2].call(null, color_repr), + lnl = need_lnl ? Re_Cset[3].call(null, ncolor) : Re_Cset[6], + ncolor$0 = need_lnl ? ncolor + 1 | 0 : ncolor, + c = [0, Re_Cset[44][1]], + d = [0, Re_Automata[1][2]], + ctx = + [0, + caml_call1(Re_Automata[6][1], 0), + 332064784, + 0, + -904640576, + d, + [0, 0], + c, + colors], + match$0 = translate(ctx, regexp), + kind = match$0[2], + r = match$0[1], + initial = enforce_kind(ctx[1], 332064784, kind, r), + group_count = caml_call1(Re_Automata[1][6], ctx[5][1]), + group_names = Stdlib_ListLabels[10].call(null, ctx[6][1]), + a = Stdlib_Mutex[1].call(null, 0), + b = caml_call1(Re_Automata[21][8][1], 97); + return [0, + initial, + 0, + colors, + color_repr, + ncolor$0, + lnl, + caml_call1(Re_Automata[22][1], 0), + b, + group_names, + group_count, + a]; + } + runtime.caml_register_global + (18, + [0, + [0, + create, + feed, + finalize, + [0, + [0, get, test_mark], + create$0, + feed$0, + finalize$0, + no_match_starts_before]], + match_str_no_bounds, + match_str, + match_str_p, + compile, + group_count, + group_names, + pp_re], + "Re__Compile"); + return; + } + (globalThis)); + +//# 4555 "../.js/default/re/re.cma.js" +//# shape: Re__Search:[F(4)->F(1),F(4)->F(1),F(4)->F(1),F(4)->F(1),F(4)->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; + 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(), + Assert_failure = global_data.Assert_failure, + Re_Compile = global_data.Re__Compile, + Stdlib_String = global_data.Stdlib__String, + Re_Group = global_data.Re__Group, + Stdlib = global_data.Stdlib, + Stdlib_Seq = global_data.Stdlib__Seq; + function all(opt, len, re, s){ + var pos = opt ? opt[1] : 0, cst_Re_all = "Re.all"; + if(pos < 0) Stdlib[1].call(null, cst_Re_all); + if(len){ + var + l = len[1], + a = l < 0, + b = a || caml_ml_string_length(s) < (pos + l | 0); + if(b) Stdlib[1].call(null, cst_Re_all); + var limit = pos + l | 0; + } + else + var limit = caml_ml_string_length(s); + function aux(pos$2, on_match$0, param){ + var pos = pos$2, on_match = on_match$0; + for(;;){ + if(limit < pos) return 0; + var match = Re_Compile[3].call(null, 1, 0, re, s, pos, limit - pos | 0); + if(typeof match !== "number" && 0 === match[0]){ + var + substr = match[1], + a = Re_Group[17].call(null, substr, 0), + p1 = caml_call1(Re_Group[16][2], a), + b = Re_Group[18].call(null, substr, 0), + p2 = caml_call1(Re_Group[16][2], b); + if(! on_match) break; + if(p1 !== pos) break; + if(p1 !== p2) break; + var pos$0 = pos + 1 | 0; + pos = pos$0; + on_match = 0; + continue; + } + return 0; + } + var pos$1 = p1 === p2 ? p2 + 1 | 0 : p2, c = p1 !== p2 ? 1 : 0; + return [0, substr, function(a){return aux(pos$1, c, a);}]; + } + return function(a){return aux(pos, 0, a);}; + } + function matches(pos, len, re, s){ + var a = all(pos, len, re, s); + function b(sub){return Re_Group[2].call(null, sub, 0);} + var c = Stdlib_Seq[29]; + return function(d){return c(b, a, d);}; + } + var a = [0, "lib/search.ml", 56, 6]; + function split_full(opt, len, re, s){ + var pos = opt ? opt[1] : 0, cst_Re_split = "Re.split"; + if(pos < 0) Stdlib[1].call(null, cst_Re_split); + if(len){ + var + l = len[1], + b = l < 0, + c = b || caml_ml_string_length(s) < (pos + l | 0); + if(c) Stdlib[1].call(null, cst_Re_split); + var limit = pos + l | 0; + } + else + var limit = caml_ml_string_length(s); + function aux(state$0, i, pos$2, param){ + a: + { + b: + { + var old_i = i, pos$0 = pos$2; + for(;;){ + if(typeof state$0 !== "number") break; + if(limit < pos$0){ + if(old_i === limit) return 0; + throw caml_maybe_attach_backtrace([0, Assert_failure, a], 1); + } + var + match = + Re_Compile[3].call(null, 1, 0, re, s, pos$0, limit - pos$0 | 0); + if(typeof match === "number") break b; + if(0 !== match[0]) return 0; + var + substr = match[1], + b = Re_Group[17].call(null, substr, 0), + p1 = caml_call1(Re_Group[16][2], b), + c = Re_Group[18].call(null, substr, 0), + p2 = caml_call1(Re_Group[16][2], c), + pos$1 = p1 === p2 ? p2 + 1 | 0 : p2; + if(old_i !== p1) break a; + if(p1 !== p2) break a; + if(pos >= p1) break a; + old_i = p2; + pos$0 = pos$1; + } + var x = state$0[2]; + return [0, x, function(a){return aux(814535476, old_i, pos$0, a);}]; + } + if(old_i >= limit) return 0; + var text = Stdlib_String[16].call(null, s, old_i, limit - old_i | 0); + return [0, + [0, 936573133, text], + function(a){return aux(state$0, limit, pos$0, a);}]; + } + if(pos >= p1) + return [0, + [0, -363573681, substr], + function(a){return aux(state$0, p2, pos$1, a);}]; + var + text$0 = Stdlib_String[16].call(null, s, old_i, p1 - old_i | 0), + state = [0, 73271853, [0, -363573681, substr]]; + return [0, + [0, 936573133, text$0], + function(a){return aux(state, p2, pos$1, a);}]; + } + return function(a){return aux(814535476, pos, pos, a);}; + } + function split(pos, len, re, s){ + var seq = split_full(pos, len, re, s); + function filter(seq$1, param){ + var seq = seq$1; + for(;;){ + var match = caml_call1(seq, 0); + if(! match) return 0; + var match$0 = match[1], variant = match$0[1]; + if(936573133 <= variant) break; + var seq$0 = match[2]; + seq = seq$0; + } + var tl = match[2], s = match$0[2]; + return [0, s, function(a){return filter(tl, a);}]; + } + return function(a){return filter(seq, a);}; + } + function split_delim(pos, len, re, s){ + var seq = split_full(pos, len, re, s); + function filter(delim$0, seq$1, param){ + a: + { + var cst = ""; + b: + { + var delim = delim$0, seq = seq$1; + for(;;){ + var match = caml_call1(seq, 0); + if(! match) break; + var match$0 = match[1], variant = match$0[1]; + if(936573133 <= variant) break a; + var seq$0 = match[2]; + if(delim) break b; + delim = 1; + seq = seq$0; + } + return delim ? [0, cst, function(param){return 0;}] : 0; + } + return [0, cst, function(param){return filter(1, seq$0, 0);}]; + } + var tl = match[2], s = match$0[2]; + return [0, s, function(a){return filter(0, tl, a);}]; + } + return function(a){return filter(1, seq, a);}; + } + runtime.caml_register_global + (13, [0, all, matches, split_full, split, split_delim], "Re__Search"); + return; + } + (globalThis)); + +//# 4741 "../.js/default/re/re.cma.js" +//# shape: Re__Core:[N,F(1),F(1)*,F(1)*,F(4),F(4),F(4),F(4),F(4),N,F(4),F(4),F(4)->F(1),F(4),F(4),F(4)->F(1),F(4),F(4),F(4),F(4)->F(1),F(4),F(4),F(4)->F(1),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,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,F(2),F(2),N,F(2),F(2),F(1),F(1),F(2),F(2),F(1)*,N] +(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]); + } + var + global_data = runtime.caml_get_global_data(), + Re_Search = global_data.Re__Search, + Stdlib_Seq = global_data.Stdlib__Seq, + Stdlib_ListLabels = global_data.Stdlib__ListLabels, + Re_Group = global_data.Re__Group, + Re_Pmark = global_data.Re__Pmark, + Re_Compile = global_data.Re__Compile, + Stdlib = global_data.Stdlib, + Re_Cset = global_data.Re__Cset, + Re_Ast = global_data.Re__Ast, + cset = Re_Ast[8]; + function rg(c$0, c){return cset(Re_Cset[25].call(null, c$0, c));} + var + notnl = cset(Re_Cset[22]), + lower = cset(Re_Cset[30]), + upper = cset(Re_Cset[31]), + alpha = cset(Re_Cset[32]), + digit = cset(Re_Cset[19]), + alnum = cset(Re_Cset[33]), + wordc = cset(Re_Cset[34]), + ascii = cset(Re_Cset[23]), + blank = cset(Re_Cset[27]), + cntrl = cset(Re_Cset[35]), + graph = cset(Re_Cset[36]), + print = cset(Re_Cset[37]), + punct = cset(Re_Cset[38]), + space = cset(Re_Cset[28]), + xdigit = cset(Re_Cset[29]), + include = Re_Ast[7], + empty = include[1], + epsilon = include[2], + str = include[3], + no_case = include[4], + case$ = include[5], + diff = include[6], + compl = include[7], + repn = include[8], + inter = include[9], + char = include[10], + any = include[11], + set = include[12], + mark = include[13], + nest = include[14], + no_group = include[15], + whole_string = include[16], + leol = include[17], + longest = include[18], + greedy = include[19], + non_greedy = include[20], + stop = include[21], + not_boundary = include[22], + group = include[23], + word = include[24], + first = include[25], + bos = include[26], + bow = include[27], + eow = include[28], + eos = include[29], + bol = include[30], + start = include[31], + eol = include[32], + opt = include[33], + rep = include[34], + rep1 = include[35], + alt = include[36], + shortest = include[37], + seq = include[38], + pp = include[39], + witness = include[40]; + function exec_internal(a, opt, partial, groups, re, s){ + var pos = a ? a[1] : 0, len = opt ? opt[1] : -1; + return Re_Compile[3].call(null, groups, partial, re, s, pos, len); + } + function exec(pos, len, re, s){ + var match = exec_internal(pos, len, 0, 1, re, s); + if(typeof match !== "number" && 0 === match[0]){var substr = match[1]; return substr;} + throw caml_maybe_attach_backtrace(Stdlib[8], 1); + } + function exec_opt(pos, len, re, s){ + var match = exec_internal(pos, len, 0, 1, re, s); + if(typeof match !== "number" && 0 === match[0]){var substr = match[1]; return [0, substr];} + return 0; + } + function execp(a, opt, re, s){ + var pos = a ? a[1] : 0, len = opt ? opt[1] : -1; + return Re_Compile[4].call(null, re, s, pos, len); + } + function exec_partial(pos, len, re, s){ + var match = exec_internal(pos, len, 1, 0, re, s); + return typeof match === "number" + ? -1062743954 + : 0 === match[0] ? 782112175 : 939392865; + } + function exec_partial_detailed(pos, len, re, s){ + var match = exec_internal(pos, len, 1, 1, re, s); + if(typeof match === "number") return -1062743954; + if(0 === match[0]){var group = match[1]; return [0, 782112175, group];} + var no_match_starts_before = match[1]; + return [0, 939392865, no_match_starts_before]; + } + function marked(g, p){ + var a = Re_Group[13].call(null, g); + return caml_call2(Re_Pmark[6][31], p, a); + } + function mark_set(g){return Re_Group[13].call(null, g);} + var equal = Re_Pmark[1], compare = Re_Pmark[2]; + function gen_of_seq(s){ + var r = [0, s]; + return function(param){ + var match = caml_call1(r[1], 0); + if(! match) return 0; + var tl = match[2], x = match[1]; + r[1] = tl; + return [0, x];}; + } + function split_gen(pos, len, re, s){ + return gen_of_seq(Re_Search[4].call(null, pos, len, re, s)); + } + function split_full_gen(pos, len, re, s){ + return gen_of_seq(Re_Search[3].call(null, pos, len, re, s)); + } + function all_gen(pos, len, re, s){ + return gen_of_seq(Re_Search[1].call(null, pos, len, re, s)); + } + function matches_gen(pos, len, re, s){ + return gen_of_seq(Re_Search[2].call(null, pos, len, re, s)); + } + var + split_full_seq = Re_Search[3], + split_seq = Re_Search[4], + matches_seq = Re_Search[2], + all_seq = Re_Search[1], + get = Re_Group[2], + get_ofs = Re_Group[4], + get_all = Re_Group[10], + get_all_ofs = Re_Group[11], + test = Re_Group[12]; + function list_of_seq(s){ + var a = Stdlib_Seq[5].call(null, function(l, x){return [0, x, l];}, 0, s); + return Stdlib_ListLabels[10].call(null, a); + } + function all(pos, len, re, s){ + return list_of_seq(Re_Search[1].call(null, pos, len, re, s)); + } + function matches(pos, len, re, s){ + return list_of_seq(Re_Search[2].call(null, pos, len, re, s)); + } + function split_full(pos, len, re, s){ + return list_of_seq(Re_Search[3].call(null, pos, len, re, s)); + } + function split(pos, len, re, s){ + return list_of_seq(Re_Search[4].call(null, pos, len, re, s)); + } + function split_delim(pos, len, re, s){ + return list_of_seq(Re_Search[5].call(null, pos, len, re, s)); + } + var + compile = Re_Compile[5], + print_re = Re_Compile[8], + group_names = Re_Compile[7], + group_count = Re_Compile[6], + b = Re_Compile[1], + c = b[4], + a = Re_Pmark[6], + Re_Core = + [0, + [0, + Re_Group[2], + Re_Group[3], + Re_Group[4], + Re_Group[5], + Re_Group[6], + Re_Group[7], + Re_Group[8], + Re_Group[9], + Re_Group[10], + Re_Group[11], + Re_Group[12], + Re_Group[14], + Re_Group[15]], + compile, + group_count, + group_names, + exec, + exec_opt, + execp, + exec_partial, + exec_partial_detailed, + [0, + marked, + [0, + a[1], + a[2], + a[3], + a[4], + a[5], + a[6], + a[7], + a[8], + a[9], + a[10], + a[11], + a[12], + a[13], + a[14], + a[15], + a[16], + a[17], + a[18], + a[19], + a[20], + a[21], + a[22], + a[23], + a[24], + a[25], + a[26], + a[27], + a[28], + a[29], + a[30], + a[31], + a[32], + a[33], + a[34], + a[35], + a[36], + a[43], + a[37], + a[38], + a[39], + a[40], + a[41], + a[42]], + mark_set, + equal, + compare], + all, + all_gen, + all_seq, + matches, + matches_gen, + matches_seq, + split, + split_delim, + split_gen, + split_seq, + split_full, + split_full_gen, + split_full_seq, + [0, + Re_Search[1], + Re_Search[2], + Re_Search[4], + Re_Search[5], + Re_Search[3]], + str, + char, + alt, + seq, + empty, + epsilon, + rep, + rep1, + repn, + opt, + bol, + eol, + bow, + eow, + bos, + eos, + leol, + start, + stop, + word, + not_boundary, + whole_string, + longest, + shortest, + first, + greedy, + non_greedy, + group, + no_group, + nest, + mark, + set, + rg, + inter, + diff, + compl, + any, + notnl, + alnum, + wordc, + alpha, + ascii, + blank, + cntrl, + digit, + graph, + lower, + print, + punct, + space, + upper, + xdigit, + case$, + no_case, + pp, + print_re, + print_re, + witness, + get, + get_ofs, + get_all, + get_all_ofs, + test, + marked, + mark_set, + [0, b[1], b[2], b[3], [0, c[1], c[2], c[3], c[4]]]]; + runtime.caml_register_global(9, Re_Core, "Re__Core"); + return; + } + (globalThis)); + +//# 5088 "../.js/default/re/re.cma.js" +//# shape: Re__Parse_buffer:[N,F(1)*,F(1),F(1),F(1)*,F(2),F(3),F(1),F(2),F(2),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, + caml_wrap_exception = runtime.caml_wrap_exception, + Stdlib = runtime.caml_get_global_data().Stdlib, + Parse_error = + [248, "Re__Parse_buffer.Parse_error", runtime.caml_fresh_oo_id(0)]; + function create(str){return [0, str, 0];} + function unget(t){t[2] = t[2] - 1 | 0; return 0;} + function junk(t){t[2] = t[2] + 1 | 0; return 0;} + function eos(t){return t[2] === caml_ml_string_length(t[1]) ? 1 : 0;} + function test(t, c){ + var a = 1 - eos(t), b = a ? caml_string_get(t[1], t[2]) === c ? 1 : 0 : a; + return b; + } + function test2(t, c$0, c){ + var a = (t[2] + 1 | 0) < caml_ml_string_length(t[1]) ? 1 : 0; + if(a) + var + b = caml_string_get(t[1], t[2]) === c$0 ? 1 : 0, + d = b ? caml_string_get(t[1], t[2] + 1 | 0) === c ? 1 : 0 : b; + else + var d = a; + return d; + } + function accept(t, c){ + var r = test(t, c); + if(r) t[2] = t[2] + 1 | 0; + return r; + } + function get(t){ + var r = caml_string_get(t[1], t[2]); + t[2] = t[2] + 1 | 0; + return r; + } + function accept_s(t, s){ + var len = caml_ml_string_length(s); + try{ + var a = len - 1 | 0; + if(a >= 0){ + var j = 0; + for(;;){ + try{ + var b = caml_string_get(t[1], t[2] + j | 0); + if(caml_string_get(s, j) !== b) throw Stdlib[3]; + } + catch(exn){throw Stdlib[3];} + var c = j + 1 | 0; + if(a === j) break; + j = c; + } + } + t[2] = t[2] + len | 0; + return 1; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[3]) return 0; + throw caml_maybe_attach_backtrace(exn, 0); + } + } + function integer(t){ + if(eos(t)) return 0; + var d$0 = get(t); + if(9 < d$0 - 48 >>> 0){unget(t); return 0;} + var i$1 = d$0 - 48 | 0, i = i$1; + for(;;){ + if(eos(t)) return [0, i]; + var d = get(t); + if(9 < d - 48 >>> 0){unget(t); return [0, i];} + var i$0 = (10 * i | 0) + (d - 48 | 0) | 0; + if(i$0 < i) throw caml_maybe_attach_backtrace(Parse_error, 1); + i = i$0; + } + } + runtime.caml_register_global + (2, + [0, + Parse_error, + create, + junk, + unget, + eos, + test, + test2, + get, + accept, + accept_s, + integer], + "Re__Parse_buffer"); + return; + } + (globalThis)); + +//# 5941 "../.js/default/re/re.cma.js" +//# shape: Re__Replace:[F(6),F(6)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_string_get = runtime.caml_string_get; + 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(), + Re_Compile = global_data.Re__Compile, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Re_Group = global_data.Re__Group, + Stdlib = global_data.Stdlib; + function replace(a, len, opt, re, f, s){ + var + pos = a ? a[1] : 0, + all = opt ? opt[1] : 1, + cst_Re_replace = "Re.replace"; + if(pos < 0) Stdlib[1].call(null, cst_Re_replace); + if(len){ + var + l = len[1], + b = l < 0, + c = b || caml_ml_string_length(s) < (pos + l | 0); + if(c) Stdlib[1].call(null, cst_Re_replace); + var limit = pos + l | 0; + } + else + var limit = caml_ml_string_length(s); + var + buf = Stdlib_Buffer[1].call(null, caml_ml_string_length(s)), + pos$0 = pos, + on_match = 0; + for(;;){ + if(pos$0 <= limit){ + var + match = Re_Compile[3].call(null, 1, 0, re, s, pos$0, limit - pos$0 | 0); + if(typeof match === "number") + Stdlib_Buffer[18].call(null, buf, s, pos$0, limit - pos$0 | 0); + else if(0 === match[0]){ + var + substr = match[1], + d = Re_Group[17].call(null, substr, 0), + p1 = caml_call1(Re_Group[16][2], d), + e = Re_Group[18].call(null, substr, 0), + p2 = caml_call1(Re_Group[16][2], e); + if(pos$0 === p1 && p1 === p2 && on_match){ + if(p2 < limit){ + var g = caml_string_get(s, p2); + Stdlib_Buffer[12].call(null, buf, g); + } + var pos$1 = p2 + 1 | 0; + pos$0 = pos$1; + on_match = 0; + continue; + } + Stdlib_Buffer[18].call(null, buf, s, pos$0, p1 - pos$0 | 0); + var replacing = caml_call1(f, substr); + Stdlib_Buffer[16].call(null, buf, replacing); + if(all){ + var on_match$0 = p1 !== p2; + if(p1 !== p2){pos$0 = p2; on_match = on_match$0; continue;} + if(p2 < limit){ + var h = caml_string_get(s, p2); + Stdlib_Buffer[12].call(null, buf, h); + } + pos$0 = p2 + 1 | 0; + on_match = on_match$0; + continue; + } + Stdlib_Buffer[18].call(null, buf, s, p2, limit - p2 | 0); + } + } + return Stdlib_Buffer[2].call(null, buf); + } + } + function replace_string(pos, len, all, re, by, s){ + return replace(pos, len, all, re, function(param){return by;}, s); + } + runtime.caml_register_global + (6, [0, replace, replace_string], "Re__Replace"); + return; + } + (globalThis)); + +//# 6453 "../.js/default/re/re.cma.js" +//# shape: Re__Posix_class:[N,F(1),F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_list_of_js_array = runtime.caml_list_of_js_array, + 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 + global_data = runtime.caml_get_global_data(), + cst_alnum = "alnum", + cst_alpha = "alpha", + cst_ascii = "ascii", + cst_blank = "blank", + cst_cntrl = "cntrl", + cst_digit = "digit", + cst_graph = "graph", + cst_lower = "lower", + cst_print = "print", + cst_punct = "punct", + cst_space = "space", + cst_upper = "upper", + cst_word = "word", + cst_xdigit = "xdigit", + names = + caml_list_of_js_array + ([cst_alpha, + cst_alnum, + cst_ascii, + cst_blank, + cst_cntrl, + cst_digit, + cst_lower, + cst_print, + cst_space, + cst_upper, + cst_word, + cst_punct, + cst_graph, + cst_xdigit]), + Re_Parse_buffer = global_data.Re__Parse_buffer, + Stdlib_List = global_data.Stdlib__List, + Stdlib = global_data.Stdlib, + Re_Core = global_data.Re__Core; + function of_name(class$){ + var switch$ = runtime.caml_string_compare(class$, cst_lower); + if(0 <= switch$){ + if(0 >= switch$) return Re_Core[71]; + if(class$ === cst_print) return Re_Core[72]; + if(class$ === cst_punct) return Re_Core[73]; + if(class$ === cst_space) return Re_Core[74]; + if(class$ === cst_upper) return Re_Core[75]; + if(class$ === cst_word) return Re_Core[64]; + if(class$ === cst_xdigit) return Re_Core[76]; + } + else{ + if(class$ === cst_alnum) return Re_Core[63]; + if(class$ === cst_alpha) return Re_Core[65]; + if(class$ === cst_ascii) return Re_Core[66]; + if(class$ === cst_blank) return Re_Core[67]; + if(class$ === cst_cntrl) return Re_Core[68]; + if(class$ === cst_digit) return Re_Core[69]; + if(class$ === cst_graph) return Re_Core[70]; + } + var a = Stdlib[28].call(null, "Invalid pcre class: ", class$); + return Stdlib[1].call(null, a); + } + function parse(buf){ + var a = Re_Parse_buffer[9], b = Re_Parse_buffer[10]; + function accept_s(a){return b(buf, a);} + if(! a(buf, 58)) return 0; + var compl = a(buf, 94); + try{var cls = Stdlib_List[39].call(null, accept_s, names);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[8]) + throw caml_maybe_attach_backtrace(Re_Parse_buffer[1], 1); + throw caml_maybe_attach_backtrace(exn, 0); + } + if(1 - b(buf, ":]")) + throw caml_maybe_attach_backtrace(Re_Parse_buffer[1], 1); + var + posix_class = of_name(cls), + c = compl ? caml_call1(Re_Core[60], [0, posix_class, 0]) : posix_class; + return [0, c]; + } + runtime.caml_register_global + (21, [0, names, of_name, parse], "Re__Posix_class"); + return; + } + (globalThis)); + +//# 6553 "../.js/default/re/re.cma.js" +//# shape: Re__Perl:[N,N,F(2),F(2),F(1),F(2)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + caml_mul = runtime.caml_mul, + 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_List = global_data.Stdlib__List, + Re_Core = global_data.Re__Core, + Re_Parse_buffer = global_data.Re__Parse_buffer, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Re_Posix_class = global_data.Re__Posix_class, + Stdlib = global_data.Stdlib, + Parse_error = Re_Parse_buffer[1], + Not_supported = + [248, "Re__Perl.Not_supported", runtime.caml_fresh_oo_id(0)]; + function char_of_int(x){ + try{var x$0 = Stdlib[29].call(null, x); return x$0;} + catch(exn){throw caml_maybe_attach_backtrace(Parse_error, 1);} + } + var + a = [0, caml_call1(Re_Core[26], 95), 0], + word_char = [0, Re_Core[63], a], + word = [1, caml_call1(Re_Core[27], word_char)], + not_word = [1, caml_call1(Re_Core[27], word_char)], + space = [1, Re_Core[74]], + not_space = [1, caml_call1(Re_Core[60], [0, Re_Core[74], 0])], + digit = [1, Re_Core[69]], + not_digit = [1, caml_call1(Re_Core[60], [0, Re_Core[69], 0])], + char_b = [0, 8], + char_newline = [0, 10], + char_cr = [0, 13], + char_tab = [0, 9]; + function re(opt, s){ + var + opts = opt ? opt[1] : 0, + ungreedy = Stdlib_List[38].call(null, -243745063, opts), + dotall = Stdlib_List[38].call(null, -424303016, opts), + dollar_endonly = Stdlib_List[38].call(null, -712595228, opts), + multiline = Stdlib_List[38].call(null, 1071952589, opts), + buf = Re_Parse_buffer[2].call(null, s), + a = Re_Parse_buffer[9]; + function eos(param){return Re_Parse_buffer[5].call(null, buf);} + function test(c){return Re_Parse_buffer[6].call(null, buf, c);} + function get(param){return Re_Parse_buffer[8].call(null, buf);} + function greedy_mod(r){ + var gr$0 = a(buf, 63), gr = ungreedy ? 1 - gr$0 : gr$0; + return gr ? caml_call1(Re_Core[51], r) : caml_call1(Re_Core[50], r); + } + function regexp(param){ + var left = [0, branch(0), 0], left$0 = left; + for(;;){ + if(! a(buf, 124)){ + var b = Stdlib_List[10].call(null, left$0); + return caml_call1(Re_Core[27], b); + } + var left$1 = [0, branch(0), left$0]; + left$0 = left$1; + } + } + function branch(param){ + var left = 0; + for(;;){ + if(! eos(0) && ! test(124) && ! test(41)){ + var r = atom(0); + if(a(buf, 42)) + var b = greedy_mod(caml_call1(Re_Core[31], r)); + else if(a(buf, 43)) + var b = greedy_mod(caml_call1(Re_Core[32], r)); + else if(a(buf, 63)) + var b = greedy_mod(caml_call1(Re_Core[34], r)); + else if(a(buf, 123)){ + var match = Re_Parse_buffer[11].call(null, buf); + if(match){ + var + i = match[1], + j = a(buf, 44) ? Re_Parse_buffer[11].call(null, buf) : [0, i]; + if(1 - a(buf, 125)) + throw caml_maybe_attach_backtrace(Parse_error, 1); + if(j){ + var j$0 = j[1]; + if(j$0 < i) throw caml_maybe_attach_backtrace(Parse_error, 1); + } + var b = greedy_mod(caml_call3(Re_Core[33], r, i, j)); + } + else{Re_Parse_buffer[4].call(null, buf); var b = r;} + } + else + var b = r; + var left$0 = [0, b, left]; + left = left$0; + continue; + } + var c = Stdlib_List[10].call(null, left); + return caml_call1(Re_Core[28], c); + } + } + function atom(param){ + if(a(buf, 46)) return dotall ? Re_Core[61] : Re_Core[62]; + if(! a(buf, 40)){ + if(a(buf, 94)) return multiline ? Re_Core[35] : Re_Core[39]; + if(a(buf, 36)) + return multiline + ? Re_Core[36] + : dollar_endonly ? Re_Core[41] : Re_Core[40]; + if(a(buf, 91)){ + if(a(buf, 94)){var h = bracket(0); return caml_call1(Re_Core[60], h);} + var j = bracket(0); + return caml_call1(Re_Core[27], j); + } + if(! a(buf, 92)){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c = get(0); + a: + { + if(64 <= c){ + if(92 !== c && 123 !== c) break a; + } + else + if(44 <= c){if(63 > c) break a;} else if(42 > c) break a; + throw caml_maybe_attach_backtrace(Parse_error, 1); + } + return caml_call1(Re_Core[26], c); + } + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var n1 = get(0), switcher = n1 - 48 | 0; + if(74 >= switcher >>> 0) + switch(switcher){ + case 17: + return Re_Core[39]; + case 18: + return Re_Core[45]; + case 20: + return caml_call1(Re_Core[60], [0, Re_Core[69], 0]); + case 21: + throw caml_maybe_attach_backtrace(Parse_error, 1); + case 23: + return Re_Core[42]; + case 33: + var buf$0 = Stdlib_Buffer[1].call(null, 12); + for(;;) + if(a(buf, 92)){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c$0 = get(0); + if(69 === c$0){ + var q = Stdlib_Buffer[2].call(null, buf$0); + return caml_call1(Re_Core[25], q); + } + Stdlib_Buffer[12].call(null, buf$0, 92); + Stdlib_Buffer[12].call(null, buf$0, c$0); + } + else{ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var s = get(0); + Stdlib_Buffer[12].call(null, buf$0, s); + } + break; + case 35: + return caml_call1(Re_Core[60], [0, Re_Core[74], 0]); + case 39: + var l = [0, caml_call1(Re_Core[26], 95), 0]; + return caml_call1(Re_Core[60], [0, Re_Core[63], l]); + case 42: + return Re_Core[41]; + case 50: + return caml_call1 + (Re_Core[27], [0, Re_Core[37], [0, Re_Core[38], 0]]); + case 52: + return Re_Core[69]; + case 53: + return caml_call1(Re_Core[26], 27); + case 54: + return caml_call1(Re_Core[26], 12); + case 62: + return caml_call1(Re_Core[26], 10); + case 63: + if(a(buf, 123)){ + var acc$1 = 0; + for(;;){ + if(a(buf, 125)){var match$0 = [0, acc$1]; break;} + var match = maybe_octaldigit(0); + if(! match) throw caml_maybe_attach_backtrace(Parse_error, 1); + var p = match[1], acc$2 = [0, p, acc$1]; + acc$1 = acc$2; + } + } + else + var match$0 = 0; + if(! match$0) throw caml_maybe_attach_backtrace(Parse_error, 1); + var digits$1 = match$0[1], digits = digits$1, acc = 0, i = 1; + for(;;){ + if(! digits){ + var m = char_of_int(acc); + return caml_call1(Re_Core[26], m); + } + var + digits$0 = digits[2], + d = digits[1], + acc$0 = acc + caml_mul(d, i) | 0, + i$0 = caml_mul(i, i); + digits = digits$0; + acc = acc$0; + i = i$0; + } + break; + case 66: + return caml_call1(Re_Core[26], 13); + case 67: + return Re_Core[74]; + case 68: + return caml_call1(Re_Core[26], 9); + case 71: + var n = [0, caml_call1(Re_Core[26], 95), 0]; + return caml_call1(Re_Core[27], [0, Re_Core[63], n]); + case 72: + if(a(buf, 123)){ + var acc$4 = 0; + for(;;){ + if(a(buf, 125)){var match$1 = [0, acc$4]; break;} + var acc$3 = [0, hexdigit(0), acc$4]; + acc$4 = acc$3; + } + } + else + var match$1 = 0; + a: + { + if(match$1){ + var e = match$1[1]; + if(e){ + var match$2 = e[2], c1 = e[1]; + if(! match$2){var c2$0 = c1, c1$0 = 0; break a;} + if(! match$2[2]){ + var c2 = match$2[1], c2$0 = c2, c1$0 = c1; + break a; + } + } + throw caml_maybe_attach_backtrace(Parse_error, 1); + } + var + c1$1 = hexdigit(0), + c2$1 = hexdigit(0), + c2$0 = c2$1, + c1$0 = c1$1; + } + var code = (c1$0 * 16 | 0) + c2$0 | 0, o = char_of_int(code); + return caml_call1(Re_Core[26], o); + case 74: + return Re_Core[40]; + case 8: + case 9: + throw caml_maybe_attach_backtrace(Not_supported, 1); + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + var n2 = maybe_octaldigit(0), n3 = maybe_octaldigit(0); + if(n2 && n3){ + var + n3$0 = n3[1], + n2$0 = n2[1], + n1$0 = n1 - 48 | 0, + k = char_of_int(((n1$0 * 64 | 0) + (n2$0 * 8 | 0) | 0) + n3$0 | 0); + return caml_call1(Re_Core[26], k); + } + throw caml_maybe_attach_backtrace(Not_supported, 1); + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: break; + default: throw caml_maybe_attach_backtrace(Parse_error, 1); + } + return caml_call1(Re_Core[26], n1); + } + if(! a(buf, 63)){ + var r$1 = regexp(0); + if(1 - a(buf, 41)) throw caml_maybe_attach_backtrace(Parse_error, 1); + return caml_call2(Re_Core[52], 0, r$1); + } + if(a(buf, 58)){ + var r = regexp(0); + if(1 - a(buf, 41)) throw caml_maybe_attach_backtrace(Parse_error, 1); + return r; + } + if(! a(buf, 35)){ + if(! a(buf, 60)) throw caml_maybe_attach_backtrace(Parse_error, 1); + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c$1 = get(0), f = c$1 - 91 | 0; + a: + { + if(5 < f >>> 0){ + if(57 < f + 26 >>> 0) break a; + } + else if(4 !== f) break a; + var b = Stdlib_Buffer[1].call(null, 32); + Stdlib_Buffer[12].call(null, b, c$1); + for(;;){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c$2 = get(0); + b: + { + if(65 <= c$2){ + var g = c$2 - 91 | 0; + if(5 < g >>> 0){if(32 <= g) break b;} else if(4 !== g) break b; + } + else{ + if(58 <= c$2){ + if(62 !== c$2) break b; + var name = Stdlib_Buffer[2].call(null, b), r$0 = regexp(0); + if(1 - a(buf, 41)) + throw caml_maybe_attach_backtrace(Parse_error, 1); + return caml_call2(Re_Core[52], [0, name], r$0); + } + if(48 > c$2) break b; + } + Stdlib_Buffer[12].call(null, b, c$2); + continue; + } + throw caml_maybe_attach_backtrace(Parse_error, 1); + } + } + throw caml_maybe_attach_backtrace(Parse_error, 1); + } + for(;;){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + if(a(buf, 41)) return Re_Core[30]; + Re_Parse_buffer[3].call(null, buf); + } + } + function hexdigit(param){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var d = get(0); + if(65 <= d){ + if(97 <= d){ + if(103 > d) return (d - 97 | 0) + 10 | 0; + } + else if(71 > d) return (d - 65 | 0) + 10 | 0; + } + else if(9 >= d - 48 >>> 0) return d - 48 | 0; + throw caml_maybe_attach_backtrace(Parse_error, 1); + } + function maybe_octaldigit(param){ + if(eos(0)) return 0; + var d = get(0); + return 7 < d - 48 >>> 0 ? 0 : [0, d - 48 | 0]; + } + function bracket(s$2){ + var s = s$2; + for(;;){ + if(0 !== s && a(buf, 93)) return s; + var match = char(0); + if(0 === match[0]){ + var c = match[1]; + if(a(buf, 45)){ + if(a(buf, 93)){ + var b = [0, caml_call1(Re_Core[26], 45), s]; + return [0, caml_call1(Re_Core[26], c), b]; + } + var match$0 = char(0); + if(0 === match$0[0]){ + var c$0 = match$0[1]; + s = [0, Re_Core[57].call(null, c, c$0), s]; + } + else{ + var + st = match$0[1], + d = [0, caml_call1(Re_Core[26], 45), [0, st, s]]; + s = [0, caml_call1(Re_Core[26], c), d]; + } + } + else{var s$0 = [0, caml_call1(Re_Core[26], c), s]; s = s$0;} + } + else{var st$0 = match[1], s$1 = [0, st$0, s]; s = s$1;} + } + } + function char(param){ + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c = get(0); + if(91 === c){ + if(a(buf, 61)) throw caml_maybe_attach_backtrace(Not_supported, 1); + var match = Re_Posix_class[3].call(null, buf); + if(match){var set = match[1]; return [1, set];} + if(! a(buf, 46)) return [0, c]; + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c$0 = get(0); + if(1 - a(buf, 46)) throw caml_maybe_attach_backtrace(Not_supported, 1); + if(1 - a(buf, 93)) throw caml_maybe_attach_backtrace(Parse_error, 1); + return [0, c$0]; + } + if(92 !== c) return [0, c]; + if(eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var c$1 = get(0); + if(58 <= c$1){ + if(123 > c$1) + switch(c$1 - 58 | 0){ + case 10: + return not_digit; + case 25: + return not_space; + case 29: + return not_word; + case 40: + return char_b; + case 42: + return digit; + case 52: + return char_newline; + case 56: + return char_cr; + case 57: + return space; + case 58: + return char_tab; + case 61: + return word; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: break; + default: throw caml_maybe_attach_backtrace(Parse_error, 1); + } + } + else if(48 <= c$1) throw caml_maybe_attach_backtrace(Not_supported, 1); + return [0, c$1]; + } + var res = regexp(0); + if(1 - eos(0)) throw caml_maybe_attach_backtrace(Parse_error, 1); + var + r = + Stdlib_List[38].call(null, 616470068, opts) + ? caml_call1(Re_Core[28], [0, Re_Core[42], [0, res, 0]]) + : res, + r$0 = + Stdlib_List[38].call(null, 604571177, opts) + ? caml_call1(Re_Core[78], r) + : r; + return r$0; + } + var compile = Re_Core[2]; + function compile_pat(opt, s){ + var opts = opt ? opt[1] : 0; + return compile(re([0, opts], s)); + } + var b = [1, 404463778], c = [1, 434889564]; + function re_result(opts, s){ + try{var s$0 = re(opts, s);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Not_supported) return b; + if(exn === Parse_error) return c; + throw caml_maybe_attach_backtrace(exn, 0); + } + return [0, s$0]; + } + runtime.caml_register_global + (13, + [0, Parse_error, Not_supported, re, re_result, compile, compile_pat], + "Re__Perl"); + return; + } + (globalThis)); + +//# 7058 "../.js/default/re/re.cma.js" +//# shape: Re__Pcre:[N,N,F(2),F(2),F(2),F(2),F(3),F(2),F(1),F(3),F(3),F(2),F(2),F(3),F(3),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_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + 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]); + } + 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, + Re_Core = global_data.Re__Core, + Stdlib_List = global_data.Stdlib__List, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Re_Group = global_data.Re__Group, + Stdlib_String = global_data.Stdlib__String, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Array = global_data.Stdlib__Array, + Re_Perl = global_data.Re__Perl, + Parse_error = Re_Perl[1], + Not_supported = Re_Perl[2]; + function re(opt, pat){ + var + flags = opt ? opt[1] : 0, + opts = + Stdlib_List[20].call + (null, + function(param){ + return 601676297 <= param + ? 613575188 <= param ? 616470068 : 604571177 + : 426394317 <= param ? 1071952589 : -424303016; + }, + flags); + return Re_Perl[3].call(null, [0, opts], pat); + } + var a = [1, 404463778], b = [1, 434889564]; + function re_result(flags, s){ + try{var s$0 = re(flags, s);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Not_supported) return a; + if(exn === Parse_error) return b; + throw caml_maybe_attach_backtrace(exn, 0); + } + return [0, s$0]; + } + function regexp(flags, pat){ + var a = re(flags, pat); + return Re_Core[2].call(null, a); + } + function extract(rex, s){ + var a = Re_Core[5].call(null, 0, 0, rex, s); + return caml_call1(Re_Core[1][9], a); + } + function exec(rex, pos, s){return Re_Core[5].call(null, pos, 0, rex, s);} + function names(rex){ + var + a = Re_Core[4].call(null, rex), + b = Stdlib_List[20].call(null, function(a){return a[1];}, a); + return Stdlib_Array[11].call(null, b); + } + function get_named_substring_opt(rex, name, s){ + var param = Re_Core[4].call(null, rex); + for(;;){ + if(! param) return 0; + var match = param[1], rem = param[2], i = match[2], n = match[1]; + if(n === name){ + var s$0 = caml_call2(Re_Core[1][2], s, i); + if(s$0) return s$0; + param = rem; + } + else{var rem$0 = param[2]; param = rem$0;} + } + } + function get_substring_ofs(s, i){return caml_call2(Re_Core[1][3], s, i);} + function pmatch(rex, s){return Re_Core[7].call(null, 0, 0, rex, s);} + function substitute(rex, subst, str){ + var b = Stdlib_Buffer[1].call(null, 1024), pos = 0, on_match = 0; + for(;;){ + a: + if(Re_Core[7].call(null, [0, pos], 0, rex, str)){ + var + ss = Re_Core[5].call(null, [0, pos], 0, rex, str), + match = caml_call2(Re_Core[1][3], ss, 0), + fin = match[2], + start = match[1]; + if(on_match && start === pos && start === fin){ + if(pos >= caml_ml_string_length(str)) break a; + var a = caml_string_get(str, pos); + Stdlib_Buffer[12].call(null, b, a); + var pos$0 = pos + 1 | 0; + pos = pos$0; + on_match = 0; + continue; + } + var pat = caml_call2(Re_Core[1][1], ss, 0); + Stdlib_Buffer[18].call(null, b, str, pos, start - pos | 0); + var c = caml_call1(subst, pat); + Stdlib_Buffer[16].call(null, b, c); + if(start !== fin){pos = fin; on_match = 1; continue;} + if(fin < caml_ml_string_length(str)){ + var d = caml_string_get(str, fin); + Stdlib_Buffer[12].call(null, b, d); + var pos$1 = fin + 1 | 0; + pos = pos$1; + on_match = 0; + continue; + } + } + else + Stdlib_Buffer[18].call + (null, b, str, pos, caml_ml_string_length(str) - pos | 0); + return Stdlib_Buffer[2].call(null, b); + } + } + var c = [0, 0]; + function split(rex, s){ + function split(accu$1, start$1){ + var accu = accu$1, start = start$1; + for(;;){ + if(start === caml_ml_string_length(s)) return accu; + try{ + var + g = Re_Core[5].call(null, [0, start], 0, rex, s), + g$0 = + Re_Group[8].call(null, g, 0) === start + ? Re_Core[5].call(null, [0, start + 1 | 0], 0, rex, s) + : g; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[8]) + return [0, + Stdlib_String[16].call + (null, s, start, caml_ml_string_length(s) - start | 0), + accu]; + throw caml_maybe_attach_backtrace(exn, 0); + } + var + start$0 = Re_Group[8].call(null, g$0, 0), + a = Re_Group[6].call(null, g$0, 0) - start | 0, + accu$0 = [0, Stdlib_String[16].call(null, s, start, a), accu]; + accu = accu$0; + start = start$0; + } + } + try{var g = Re_Core[5].call(null, c, 0, rex, s);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[8]) return s === "" ? 0 : [0, s, 0]; + throw caml_maybe_attach_backtrace(exn, 0); + } + if(0 === Re_Group[6].call(null, g, 0)) + var a = split(0, Re_Group[8].call(null, g, 0)); + else + var + b = Re_Group[8].call(null, g, 0), + d = Re_Group[6].call(null, g, 0), + a = split([0, Stdlib_String[16].call(null, s, 0, d), 0], b); + return Stdlib_List[10].call(null, a); + } + function quote(s){ + var + len = caml_ml_string_length(s), + buf = caml_create_bytes(len << 1), + d = len - 1 | 0, + b = 0; + if(d < 0) + var pos$4 = b; + else{ + var pos = b, i = 0; + for(;;){ + var c = runtime.caml_string_unsafe_get(s, i); + a: + { + b: + { + if(91 <= c){ + var a = c - 93 | 0; + if(29 < a >>> 0){if(32 <= a) break b;} else if(1 !== a) break b; + } + else + if(47 <= c){ + if(63 !== c) break b; + } + else{ + if(36 > c) break b; + switch(c - 36 | 0){case 1:case 2:case 3:case 8:case 9: break b; + } + } + caml_bytes_unsafe_set(buf, pos, 92); + var pos$1 = pos + 1 | 0; + caml_bytes_unsafe_set(buf, pos$1, c); + var pos$2 = pos$1 + 1 | 0, pos$3 = pos$2; + break a; + } + caml_bytes_unsafe_set(buf, pos, c); + var pos$0 = pos + 1 | 0, pos$3 = pos$0; + } + var e = i + 1 | 0; + if(d === i){var pos$4 = pos$3; break;} + pos = pos$3; + i = e; + } + } + var r = caml_create_bytes(pos$4); + runtime.caml_blit_bytes(buf, 0, r, 0, pos$4); + return Stdlib_Bytes[44].call(null, r); + } + var d = [0, -1, -1]; + function full_split(opt, rex, s){ + var max = opt ? opt[1] : 0; + if(0 === caml_ml_string_length(s)) return 0; + if(1 === max) return [0, [0, s], 0]; + var + results = Re_Core[21].call(null, 0, 0, rex, s), + matches = + Stdlib_List[20].call + (null, + function(param){ + var variant = param[1]; + if(936573133 <= variant){var s = param[2]; return [0, [0, s], 0];} + var + d$0 = param[2], + matches = caml_call1(Re_Core[1][10], d$0), + delim = caml_call2(Re_Core[1][1], d$0, 0), + b = matches.length - 2 | 0, + a = 0; + if(b < 1) + var l$0 = a; + else{ + var l = a, i = 1; + for(;;){ + var + e = + runtime.caml_equal + (runtime.caml_check_bound(matches, i)[i + 1], d) + ? 0 + : [2, i, caml_call2(Re_Core[1][1], d$0, i)], + c = [0, e, l], + f = i + 1 | 0; + if(b === i){var l$0 = c; break;} + l = c; + i = f; + } + } + return [0, [1, delim], Stdlib_List[10].call(null, l$0)]; + }, + results); + return Stdlib_List[14].call(null, matches); + } + function get_substring(s, i){return caml_call2(Re_Core[1][1], s, i);} + function get_named_substring(rex, name, s){ + var match = get_named_substring_opt(rex, name, s); + if(! match) throw caml_maybe_attach_backtrace(Stdlib[8], 1); + var s$0 = match[1]; + return s$0; + } + runtime.caml_register_global + (14, + [0, + Parse_error, + Not_supported, + re, + re_result, + regexp, + extract, + exec, + get_substring, + names, + get_named_substring, + get_named_substring_opt, + get_substring_ofs, + pmatch, + substitute, + full_split, + split, + quote], + "Re__Pcre"); + return; + } + (globalThis)); + +//# 7587 "../.js/default/re/re.cma.js" +//# shape: Re:[N,F(1),F(1)*,F(1)*,F(4),F(4),F(4),F(4),F(4),N,F(4),F(4),F(4)->F(1),F(4),F(4),F(4)->F(1),F(4),F(4),F(4),F(4)->F(1),F(4),F(4),F(4)->F(1),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,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,F(2),F(2),N,F(2),F(2),F(1),F(1),F(2),F(2),F(1)*,N,F(6),F(6)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + global_data = runtime.caml_get_global_data(), + Re_Core = global_data.Re__Core, + Re_Replace = global_data.Re__Replace, + Group = Re_Core[1], + compile = Re_Core[2], + group_count = Re_Core[3], + group_names = Re_Core[4], + exec = Re_Core[5], + exec_opt = Re_Core[6], + execp = Re_Core[7], + exec_partial = Re_Core[8], + exec_partial_detailed = Re_Core[9], + Mark = Re_Core[10], + all = Re_Core[11], + all_gen = Re_Core[12], + all_seq = Re_Core[13], + matches = Re_Core[14], + matches_gen = Re_Core[15], + matches_seq = Re_Core[16], + split = Re_Core[17], + split_delim = Re_Core[18], + split_gen = Re_Core[19], + split_seq = Re_Core[20], + split_full = Re_Core[21], + split_full_gen = Re_Core[22], + split_full_seq = Re_Core[23], + Seq = Re_Core[24], + str = Re_Core[25], + char = Re_Core[26], + alt = Re_Core[27], + seq = Re_Core[28], + empty = Re_Core[29], + epsilon = Re_Core[30], + rep = Re_Core[31], + rep1 = Re_Core[32], + repn = Re_Core[33], + opt = Re_Core[34], + bol = Re_Core[35], + eol = Re_Core[36], + bow = Re_Core[37], + eow = Re_Core[38], + bos = Re_Core[39], + eos = Re_Core[40], + leol = Re_Core[41], + start = Re_Core[42], + stop = Re_Core[43], + word = Re_Core[44], + not_boundary = Re_Core[45], + whole_string = Re_Core[46], + longest = Re_Core[47], + shortest = Re_Core[48], + first = Re_Core[49], + greedy = Re_Core[50], + non_greedy = Re_Core[51], + group = Re_Core[52], + no_group = Re_Core[53], + nest = Re_Core[54], + mark = Re_Core[55], + set = Re_Core[56], + rg = Re_Core[57], + inter = Re_Core[58], + diff = Re_Core[59], + compl = Re_Core[60], + any = Re_Core[61], + notnl = Re_Core[62], + alnum = Re_Core[63], + wordc = Re_Core[64], + alpha = Re_Core[65], + ascii = Re_Core[66], + blank = Re_Core[67], + cntrl = Re_Core[68], + digit = Re_Core[69], + graph = Re_Core[70], + lower = Re_Core[71], + print = Re_Core[72], + punct = Re_Core[73], + space = Re_Core[74], + upper = Re_Core[75], + xdigit = Re_Core[76], + case$ = Re_Core[77], + no_case = Re_Core[78], + pp = Re_Core[79], + pp_re = Re_Core[80], + print_re = Re_Core[81], + witness = Re_Core[82], + get = Re_Core[83], + get_ofs = Re_Core[84], + get_all = Re_Core[85], + get_all_ofs = Re_Core[86], + test = Re_Core[87], + marked = Re_Core[88], + mark_set = Re_Core[89], + Stream = Re_Core[90], + replace = Re_Replace[1], + replace_string = Re_Replace[2]; + runtime.caml_register_global + (2, + [0, + Group, + compile, + group_count, + group_names, + exec, + exec_opt, + execp, + exec_partial, + exec_partial_detailed, + Mark, + all, + all_gen, + all_seq, + matches, + matches_gen, + matches_seq, + split, + split_delim, + split_gen, + split_seq, + split_full, + split_full_gen, + split_full_seq, + Seq, + str, + char, + alt, + seq, + empty, + epsilon, + rep, + rep1, + repn, + opt, + bol, + eol, + bow, + eow, + bos, + eos, + leol, + start, + stop, + word, + not_boundary, + whole_string, + longest, + shortest, + first, + greedy, + non_greedy, + group, + no_group, + nest, + mark, + set, + rg, + inter, + diff, + compl, + any, + notnl, + alnum, + wordc, + alpha, + ascii, + blank, + cntrl, + digit, + graph, + lower, + print, + punct, + space, + upper, + xdigit, + case$, + no_case, + pp, + pp_re, + print_re, + witness, + get, + get_ofs, + get_all, + get_all_ofs, + test, + marked, + mark_set, + Stream, + replace, + replace_string], + "Re"); + 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,N,N,N,N,N,N,F(1),F(1),N,N,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(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_List = global_data.Stdlib__List, + Stdlib_Array = global_data.Stdlib__Array, + 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, 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: + return "vm-frame"; + case 25: + return "vm-machine"; + case 26: + var r = param[1]; return r[1][1]; + case 27: + return "parameter"; + case 28: + return "vector"; + 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" && 26 === 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 [26, [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" && 26 === 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" && 26 === 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" && 26 === 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 [26, [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" && 26 === 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" && 26 === 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" && 26 === 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); + }]; + } + var m = [0, 0], n = [0, 1]; + function parameter_p(v){ + if(typeof v !== "number" && 27 === v[0]) return n; + return m; + } + function parameter_uid(v){ + if(typeof v !== "number" && 27 === v[0]){var p = v[1]; return [2, p[1]];} + throw caml_maybe_attach_backtrace + ([0, Eval_error, "parameter-uid: not a parameter"], 1); + } + function parameter_default(v){ + if(typeof v !== "number" && 27 === v[0]){var p = v[1]; return p[2];} + throw caml_maybe_attach_backtrace + ([0, Eval_error, "parameter-default: not a parameter"], 1); + } + function parameter_converter(v){ + if(typeof v !== "number" && 27 === v[0]){ + var p = v[1], match = p[3]; + if(! match) return 0; + var c = match[1]; + return c; + } + throw caml_maybe_attach_backtrace + ([0, Eval_error, "parameter-converter: not a parameter"], 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 = '>"', + o = [0, [4, 0, 0, 0, 0], "%d"], + p = [0, [8, [0, 0, 3], 0, 0, 0], cst_g], + q = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], + r = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], + s = + [0, + [11, ""], + t = + [0, + [11, ""], + u = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], + v = [0, [11, ""], + w = + [0, + [11, '""'], + x = + [0, [11, '""'], + y = [0, [11, ""], + z = [0, [11, ""], + A = + [0, + [11, + ""], + B = + [0, + [11, + ""], + C = [0, [2, 0, [12, 61, [2, 0, 0]]], "%s=%s"], + D = + [0, + [11, ""], + E = [0, [11, ""], + F = [0, [11, "#(", [2, 0, [12, 41, 0]]], "#(%s)"]; + 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 = param[1]; + return Stdlib_Float[18].call(null, n) + ? caml_call1(Stdlib_Printf[4].call(null, o), n | 0) + : caml_call1(Stdlib_Printf[4].call(null, p), n); + 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, q), 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$0 = match[1], tag = n$0; else var tag = cst_lambda; + var j = Stdlib_String[7].call(null, cst$0, l[1]); + return caml_call2(Stdlib_Printf[4].call(null, r), tag, j); + case 8: + var + c = param[1], + G = Stdlib_String[7].call(null, cst$0, c[2]), + H = c[1]; + return caml_call2(Stdlib_Printf[4].call(null, s), H, G); + case 9: + var + i = param[1], + I = Stdlib_String[7].call(null, cst$0, i[2]), + J = i[1]; + return caml_call2(Stdlib_Printf[4].call(null, t), J, I); + case 10: + var m = param[1], match$0 = m[5]; + if(match$0) + var n$1 = match$0[1], tag$0 = n$1; + else + var tag$0 = cst_macro; + var K = Stdlib_String[7].call(null, cst$0, m[1]); + return caml_call2(Stdlib_Printf[4].call(null, u), tag$0, K); + case 11: + return ""; + case 12: + return ""; + case 13: + return ""; + case 14: + var name = param[1]; + return caml_call1(Stdlib_Printf[4].call(null, v), name); + case 15: + return ""; + case 16: + var s$2 = param[1]; + return caml_call1 + (Stdlib_Printf[4].call(null, w), caml_ml_string_length(s$2)); + case 17: + return ""; + case 18: + var s$3 = param[1]; + return caml_call1 + (Stdlib_Printf[4].call(null, x), 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], L = f[1]; + return caml_call1(Stdlib_Printf[4].call(null, y), L); + case 23: + var cl = param[1], match$1 = cl[3]; + if(match$1) var n$2 = match$1[1], n$3 = n$2; else var n$3 = "anon"; + return caml_call1(Stdlib_Printf[4].call(null, z), n$3); + case 24: + var f$0 = param[1], M = f$0[3], N = f$0[2]; + return caml_call2(Stdlib_Printf[4].call(null, A), N, M); + case 25: + var m$0 = param[1], O = Stdlib_List[1].call(null, m$0[3]), P = m$0[2]; + return caml_call2(Stdlib_Printf[4].call(null, B), P, O); + case 26: + var + r$0 = param[1], + Q = + 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, C), b, a); + }, + r$0[2]), + fields = Stdlib_Array[10].call(null, Q), + R = Stdlib_String[7].call(null, cst, fields), + S = r$0[1][1]; + return caml_call2(Stdlib_Printf[4].call(null, D), S, R); + case 27: + var p$0 = param[1], T = p$0[1]; + return caml_call1(Stdlib_Printf[4].call(null, E), T); + default: + var + arr = param[1], + U = Stdlib_Array[14].call(null, inspect, arr), + elts = Stdlib_Array[10].call(null, U), + V = Stdlib_String[7].call(null, cst, elts); + return caml_call1(Stdlib_Printf[4].call(null, F), V); + } + 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 + (149, + [0, + sym_to_id, + id_to_sym, + sym_next, + intern, + unintern, + vm_call_closure_ref, + cek_call_ref, + cek_eval_lambda_ref, + Eval_error, + Parse_error, + CekPerformRequest, + convert_vm_suspension, + vm_suspension_to_dict, + rtd_table, + rtd_counter, + [0, 0], + make_env, + env_extend, + env_bind_hook, + [0, 0], + [0, 0], + symbol_resolve_hook, + 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, + parameter_p, + parameter_uid, + parameter_default, + parameter_converter, + make_dict, + dict_get, + dict_has, + dict_set, + dict_delete, + dict_keys, + dict_vals, + inspect], + "Sx_types"); + return; + } + (globalThis)); + +//# 1285 "../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[91].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[94].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)); + +//# 1486 "../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[10], "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[10], "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[10], "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[10], 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[10], 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[10], 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[10], 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[91].call(null, 0); + for(;;){ + skip_whitespace_and_comments(s); + if(at_end(s)) + throw caml_maybe_attach_backtrace + ([0, Sx_types[10], 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[94].call(null, d, key_str, v); + continue; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[10], "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[10], "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[10], 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[10], 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[10], 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[10], 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)); + +//# 2310 "../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_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_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_Array = global_data.Stdlib__Array, + Re_Pcre = global_data.Re__Pcre, + Re = global_data.Re, + 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[9], "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[9], 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[31].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[43].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[9], g], 1); + } + function as_string(v){ + if(typeof v !== "number" && 2 === v[0]){var s = v[1]; return s;} + var + a = Sx_types[43].call(null, v), + b = Stdlib[28].call(null, "Expected string, got ", a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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[43].call(null, t), + b = Stdlib[28].call(null, "Expected list, got ", a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + } + function as_bool(v){ + if(typeof v !== "number" && 0 === v[0]){var b = v[1]; return b;} + return Sx_types[53].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[98].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[9], "/: 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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "clamp: 3 args"], 1); + }); + register + ("truncate", + function(args){ + if(args && ! args[2]){ + var + a = args[1], + n = as_number(a), + b = 0. <= n ? Math.floor(n) : Math.ceil(n); + return [1, b]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "truncate: 1 arg"], 1); + }); + register + ("remainder", + 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[9], "remainder: 2 args"], 1); + }); + register + ("modulo", + function(args){ + if(args){ + var c = args[2]; + if(c && ! c[2]){ + var + b = c[1], + a = args[1], + a$0 = as_number(a), + b$0 = as_number(b), + r = a$0 % b$0, + r$0 = + r === 0. + ? r + : (0. < r ? 1 : 0) === (0. < b$0 ? 1 : 0) ? r : r + b$0; + return [1, r$0]; + } + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "modulo: 2 args"], 1); + }); + var c = [0, 0]; + register + ("exact?", + 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 c; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "exact?: 1 arg"], 1); + }); + var d = [0, 0]; + register + ("inexact?", + 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, 1 - Stdlib_Float[18].call(null, f)]; + } + if(! args[2]) return d; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "inexact?: 1 arg"], 1); + }); + register + ("exact->inexact", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 1 === a[0]){ + if(args[2]) break a; + var n = a[1]; + return [1, n]; + } + if(! args[2]) return [1, as_number(a)]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "exact->inexact: 1 arg"], 1); + }); + register + ("inexact->exact", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 1 === a[0]){ + if(args[2]) break a; + var n = a[1]; + return Stdlib_Float[18].call(null, n) + ? [1, n] + : [1, caml_round_float(n)]; + } + if(! args[2]) return [1, caml_round_float(as_number(a))]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "inexact->exact: 1 arg"], 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 26: + if(typeof b === "number") break a; + if(26 !== b[0]) break a; + var b$1 = b[1], a$1 = a[1], g = a$1[1][2] === b$1[1][2] ? 1 : 0; + if(g){ + var h = a$1[2].length - 1 === b$1[2].length - 1 ? 1 : 0; + if(h){ + var k = a$1[2].length - 2 | 0, j = 1; + if(k < 0) + var c = j; + else{ + var eq = j, i = 0; + for(;;){ + var + p = caml_check_bound(b$1[2], i)[i + 1], + eq$0 = + 1 - safe_eq(caml_check_bound(a$1[2], i)[i + 1], p) ? 0 : eq, + q = i + 1 | 0; + if(k === i){var c = eq$0; break;} + eq = eq$0; + i = q; + } + } + } + else + var c = h; + } + else + var c = g; + return c; + case 27: + if(typeof b === "number") break a; + if(27 !== b[0]) break a; + var b$2 = b[1], a$2 = a[1]; + return a$2[1] === b$2[1] ? 1 : 0; + case 28: + if(typeof b === "number") break a; + if(28 !== b[0]) break a; + var + b$3 = b[1], + a$3 = a[1], + l = a$3.length - 1 === b$3.length - 1 ? 1 : 0; + if(l){ + var n = a$3.length - 2 | 0, m = 1; + if(n < 0) + var e = m; + else{ + var eq$1 = m, i$0 = 0; + for(;;){ + var + r = caml_check_bound(b$3, i$0)[i$0 + 1], + eq$2 = + 1 - safe_eq(caml_check_bound(a$3, i$0)[i$0 + 1], r) ? 0 : eq$1, + s = i$0 + 1 | 0; + if(n === i$0){var e = eq$2; break;} + eq$1 = eq$2; + i$0 = s; + } + } + } + else + var e = l; + return e; + 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 + o = Stdlib_List[1].call(null, lb), + f = Stdlib_List[1].call(null, la) === o ? 1 : 0; + return f ? Stdlib_List[35].call(null, safe_eq, la, lb) : f; + } + } + 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[9], "=: 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[9], "!=: 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[9], "<: 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[9], ">: 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[9], "<=: 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[9], ">=: 2 args"], 1); + }); + register + ("not", + function(args){ + if(args && ! args[2]){ + var a = args[1]; + return [0, 1 - Sx_types[53].call(null, a)]; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "not: 1 arg"], 1); + }); + register + ("nil?", + function(args){ + if(args && ! args[2]){ + var a = args[1]; + return [0, Sx_types[44].call(null, a)]; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "nil?: 1 arg"], 1); + }); + var e = [0, 0], f = [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 f;} + if(! args[2]) return e; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "number?: 1 arg"], 1); + }); + var g = [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 g; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "integer?: 1 arg"], 1); + }); + var h = [0, 0], i = [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 i;} + if(! args[2]) return h; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "string?: 1 arg"], 1); + }); + var j = [0, 0], k = [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 k;} + if(! args[2]) return j; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "boolean?: 1 arg"], 1); + }); + var l = [0, 0], m = [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 m;} + if(! args[2]) return l; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "list?: 1 arg"], 1); + }); + var n = [0, 0], o = [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 o;} + if(! args[2]) return n; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "dict?: 1 arg"], 1); + }); + var p = [0, 0], q = [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 q;} + if(! args[2]) return p; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "symbol?: 1 arg"], 1); + }); + var r = [0, 0], s = [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 s;} + if(! args[2]) return r; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "keyword?: 1 arg"], 1); + }); + var t = [0, 1], u = [0, 0], v = [0, 0], w = [0, 1], x = [0, 0], y = [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 v;} + if(args[2]) break a; + return w; + 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 u; + } + return y; + } + return x; + } + if(! args[2]) return t; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "ends-with?: 2 string args"], 1); + }); + var z = [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 z; + 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 = h[1], a = x === y; + break b; + } + break; + case 1: + if(typeof target !== "number" && 1 === target[0]){ + var y$0 = target[1], x$0 = h[1], a = x$0 === y$0; + break b; + } + break; + case 2: + if(typeof target !== "number" && 2 === target[0]){ + var y$1 = target[1], x$1 = h[1], a = x$1 === y$1; + break b; + } + break; + case 3: + if(typeof target !== "number" && 3 === target[0]){ + var y$2 = target[1], x$2 = h[1], a = x$2 === y$2; + break b; + } + break; + case 4: + if(typeof target !== "number" && 4 === target[0]){ + var y$3 = target[1], x$3 = h[1], a = x$3 === 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[9], "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[9], "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[9], "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]; + if(1 === caml_ml_string_length(sep)){ + var + 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)]; + } + var + f = caml_call1(Re[25], sep), + re = Re[2].call(null, f), + g = Re[17].call(null, 0, 0, re, s); + return [5, + Stdlib_List[20].call(null, function(p){return [2, p];}, g)]; + } + } + } + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[9], "join: 2 args"], 1); + }); + var A = [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, A), 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[9], "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[9], "char-from-code: 1 arg"], 1); + }); + register + ("char-at", + 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] && ! b[2]){ + var n = c[1], s = a[1], i = n | 0; + if(0 <= i && i < caml_ml_string_length(s)){ + var d = caml_string_get(s, i); + return [2, Stdlib_String[1].call(null, 1, d)]; + } + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "char-at: string and index"], 1); + }); + register + ("char-code", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 2 === a[0] && ! args[2]){ + var s = a[1]; + if(0 < caml_ml_string_length(s)) return [1, caml_string_get(s, 0)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "char-code: 1 non-empty string arg"], 1); + }); + register + ("parse-number", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 2 === a[0] && ! args[2]){ + var s = a[1]; + try{var b = [1, runtime.caml_float_of_string(s)]; return b;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] === Stdlib[7]) return 0; + throw caml_maybe_attach_backtrace(exn, 0); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "parse-number: 1 string arg"], 1); + }); + var B = [0, 0, 0]; + register + ("regex-match", + 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 input = c[1], pattern = a[1]; + try{ + var + f = Re_Pcre[3].call(null, 0, pattern), + re = Re[2].call(null, f), + match = Re[6].call(null, 0, 0, re, input); + if(match){ + var + group = match[1], + full = caml_call2(Re[1][1], group, 0), + n = caml_call1(Re[1][12], group), + d = n - 1 | 0, + groups = [0, [0, [2, full], 0]]; + if(d >= 1){ + var i = 1; + for(;;){ + try{ + var h = [0, [2, caml_call2(Re[1][1], group, i)], 0]; + groups[1] = Stdlib[37].call(null, groups[1], h); + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[8]) + throw caml_maybe_attach_backtrace(exn, 0); + groups[1] = Stdlib[37].call(null, groups[1], B); + } + var g = i + 1 | 0; + if(d === i) break; + i = g; + } + } + var e = [5, groups[1]]; + } + else + var e = 0; + return e; + } + catch(exn){return 0;} + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "regex-match: pattern and input strings"], 1); + }); + var C = [0, 0]; + register + ("regex-match?", + 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 input = c[1], pattern = a[1]; + try{ + var + d = Re_Pcre[3].call(null, 0, pattern), + e = Re[2].call(null, d), + f = [0, Re[7].call(null, 0, 0, e, input)]; + return f; + } + catch(exn){return C;} + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "regex-match?: pattern and input strings"], 1); + }); + register + ("regex-find-all", + 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 input = c[1], pattern = a[1]; + try{ + var + d = Re_Pcre[3].call(null, 0, pattern), + re = Re[2].call(null, d), + matches = Re[11].call(null, 0, 0, re, input), + results = + Stdlib_List[20].call + (null, + function(group){ + try{var a = [2, caml_call2(Re[1][1], group, 1)]; return a;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn === Stdlib[8]) + return [2, caml_call2(Re[1][1], group, 0)]; + throw caml_maybe_attach_backtrace(exn, 0); + } + }, + matches); + return [20, [0, results]]; + } + catch(exn){return [20, [0, 0]];} + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "regex-find-all: pattern and input strings"], + 1); + }); + register + ("regex-replace", + 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]){ + var d = b[2]; + if(d){ + var e = d[1]; + if(typeof e !== "number" && 2 === e[0] && ! d[2]){ + var input = e[1], replacement = c[1], pattern = a[1]; + try{ + var + f = Re_Pcre[3].call(null, 0, pattern), + re = Re[2].call(null, f), + g = [2, Re[92].call(null, 0, 0, 0, re, replacement, input)]; + return g; + } + catch(exn){return [2, input];} + } + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "regex-replace: pattern, replacement, input strings"], + 1); + }); + register + ("regex-replace-first", + 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]){ + var d = b[2]; + if(d){ + var e = d[1]; + if(typeof e !== "number" && 2 === e[0] && ! d[2]){ + var input = e[1], replacement = c[1], pattern = a[1]; + try{ + var + g = Re_Pcre[3].call(null, 0, pattern), + re = Re[2].call(null, g), + match = Re[6].call(null, 0, 0, re, input); + if(match) + var + group = match[1], + start = caml_call2(Re[1][5], group, 0), + stop = caml_call2(Re[1][7], group, 0), + h = + Stdlib_String[16].call + (null, input, stop, caml_ml_string_length(input) - stop | 0), + i = Stdlib[28].call(null, replacement, h), + j = Stdlib_String[16].call(null, input, 0, start), + f = [2, Stdlib[28].call(null, j, i)]; + else + var f = [2, input]; + return f; + } + catch(exn){return [2, input];} + } + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "regex-replace-first: pattern, replacement, input strings"], + 1); + }); + register + ("regex-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 input = c[1], pattern = a[1]; + try{ + var + d = Re_Pcre[3].call(null, 0, pattern), + re = Re[2].call(null, d), + e = Re[17].call(null, 0, 0, re, input), + f = + [20, + [0, Stdlib_List[20].call(null, function(s){return [2, s];}, e)]]; + return f; + } + catch(exn){return [20, [0, [0, [2, input], 0]]];} + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "regex-split: pattern and input strings"], 1); + }); + register("list", function(args){return [20, [0, args]];}); + var + cst_args = " args", + cst_len = "len", + D = [0, [11, "len: ", [4, 0, 0, 0, [11, cst_args, 0]]], "len: %d args"], + E = [1, 0.], + F = [1, 1.], + G = [1, 1.], + H = [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 F;} + if(args[2]) break a; + break b; + case 1: + if(args[2]) break a; return G; + 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 H; + default: break a; + } + return [1, Stdlib_List[1].call(null, l)]; + } + if(args[2]) break a; + } + return E; + } + var + b = Stdlib_List[1].call(null, args), + c = caml_call1(Stdlib_Printf[4].call(null, D), b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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[98].call(null, x), + d = Stdlib[28].call(null, "first: expected list, got ", c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + return 0; + } + return x$0; + } + if(! args[2]) return 0; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "first: 1 list arg"], 1); + }); + var I = [5, 0], J = [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 J; + } + return [5, xs]; + } + if(! args[2]) return I; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "last: 1 list arg"], 1); + }); + var K = [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 K; + var rest = match[2]; + return [5, Stdlib_List[10].call(null, rest)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "contains?: 2 args"], 1); + }); + var L = [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 L; + 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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[9], "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[98].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[9], "unique: 1 list"], 1); + }); + register + (cst_dict, + function(args){ + var d = Sx_types[91].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[94].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[94].call(null, d, k$0, v$0); + param = rest$0; + continue; + } + break; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[92].call(null, d, k); + case 4: + if(b[2]) break a; + var k$0 = c[1]; + return Sx_types[92].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[93].call(null, d, k)]; + } + break; + case 4: + if(! a[2]){ + var k$0 = b[1]; + return [0, Sx_types[93].call(null, d, k$0)]; + } + break; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "assoc: pairs"], 1); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "dissoc: dict + keys"], 1); + }); + register + ("merge", + function(args){ + var d = Sx_types[91].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[9], "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[96].call(null, d)]; + } + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[97].call(null, d)]; + } + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[9], + "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[9], "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[94].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[94].call(null, d, k$0, v$0); + return v$0; + } + break; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[92].call(null, d, k);} + break; + case 4: + if(! a[2]){ + var k$0 = b[1]; + return Sx_types[92].call(null, d, k$0); + } + break; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[93].call(null, d, k)]; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[95].call(null, d, k); + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "dict-delete!: dict and key"], 1); + }); + register + ("type-of", + function(args){ + if(args && ! args[2]){ + var a = args[1]; + return [2, Sx_types[43].call(null, a)]; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "type-of: 1 arg"], 1); + }); + register + ("inspect", + function(args){ + if(args && ! args[2]){ + var a = args[1]; + return [2, Sx_types[98].call(null, a)]; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "inspect: 1 arg"], 1); + }); + var + cst_s = "~%s", + M = [2, ""], + N = [0, [12, 126, [2, 0, 0]], cst_s], + O = [0, [12, 126, [2, 0, 0]], cst_s], + P = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], + Q = + [0, [11, "(make-spread {", [2, 0, [11, "})", 0]]], "(make-spread {%s})"], + R = [0, [11, "#<", [2, 0, [12, 62, 0]]], "#<%s>"], + S = [0, [11, "#"], + T = [0, [11, "#(", [2, 0, [12, 41, 0]]], "#(%s)"]; + register + ("serialize", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number"){ + var cst = " "; + switch(a[0]){ + case 7: + if(args[2]) break a; return M; + case 8: + if(args[2]) break a; + var c = a[1], b = c[1]; + return [2, caml_call1(Stdlib_Printf[4].call(null, N), b)]; + case 9: + if(args[2]) break a; + var i = a[1], d = i[1]; + return [2, caml_call1(Stdlib_Printf[4].call(null, O), 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[98].call(null, v); + return caml_call2(Stdlib_Printf[4].call(null, P), k, a); + }, + pairs), + e = Stdlib_String[7].call(null, cst, dict_parts); + return [2, caml_call1(Stdlib_Printf[4].call(null, Q), e)]; + case 18: + if(args[2]) break a; var s$0 = a[1]; return [2, s$0]; + case 26: + if(args[2]) break a; + var r = a[1], f = r[1][1]; + return [2, caml_call1(Stdlib_Printf[4].call(null, R), f)]; + case 27: + if(args[2]) break a; + var p = a[1], g = p[1]; + return [2, caml_call1(Stdlib_Printf[4].call(null, S), g)]; + case 28: + if(args[2]) break a; + var + arr = a[1], + h = + Stdlib_Array[14].call + (null, function(v){return Sx_types[98].call(null, v);}, arr), + elts = Stdlib_Array[10].call(null, h), + j = Stdlib_String[7].call(null, cst, elts); + return [2, caml_call1(Stdlib_Printf[4].call(null, T), j)]; + } + } + if(! args[2]) return [2, Sx_types[98].call(null, a)]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "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[9], msg], 1); + } + if(! args[2]){ + var b = to_string(a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[9], msg], 1); + } + if(! args[2]){ + var b = to_string(a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9]) 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[9], "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[9], "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[9], b], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "use-store: expected (name)"], 1); + }); + register + ("clear-stores", + function(args){Stdlib_Hashtbl[2].call(null, store_registry); return 0;}); + var U = [0, 1], V = [0, 1], W = [5, 0], X = [5, 0]; + register + ("resource", + function(args){ + var state = Stdlib_Hashtbl[1].call(null, 0, 8); + Stdlib_Hashtbl[11].call(null, state, "loading", U); + 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, V); + Stdlib_Hashtbl[11].call(null, sig_d, cst_value, [6, state]); + Stdlib_Hashtbl[11].call(null, sig_d, "subscribers", W); + Stdlib_Hashtbl[11].call(null, sig_d, "deps", X); + 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[9], "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]; + a: + { + if(typeof a === "number"){ + if(typeof b === "number"){var identical = 1; break a;} + } + else + switch(a[0]){ + case 0: + if(typeof b !== "number" && 0 === b[0]){ + var y = b[1], x = a[1], identical = x === y ? 1 : 0; + break a; + } + break; + case 1: + if(typeof b !== "number" && 1 === b[0]){ + var y$0 = b[1], x$0 = a[1], identical = x$0 === y$0 ? 1 : 0; + break a; + } + break; + case 2: + if(typeof b !== "number" && 2 === b[0]){ + var y$1 = b[1], x$1 = a[1], identical = x$1 === y$1 ? 1 : 0; + break a; + } + break; + } + var identical = a === b ? 1 : 0; + } + return [0, identical]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "make-spread: 1 dict"], 1); + }); + var Y = [0, 0], Z = [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 Z;} + if(! args[2]) return Y; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "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[91].call(null, 0); + Stdlib_List[18].call + (null, + function(param){ + var v = param[2], k = param[1]; + return Sx_types[94].call(null, d, k, v); + }, + pairs); + return [6, d]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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 _ = [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 _;} + 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[9], "map: expected (fn list)"], 1); + }); + var $ = [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 $;} + 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[9], "map-indexed: expected (fn list)"], 1); + }); + var aa = [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 aa;} + 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[53].call(null, a); + }, + items)]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "filter: expected (fn list)"], 1); + }); + var + cst$1 = ", ", + ab = + [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[43].call(null, v);}, args), + types = Stdlib_String[7].call(null, cst$1, c), + d = Stdlib_List[1].call(null, args), + e = caml_call2(Stdlib_Printf[4].call(null, ab), types, d); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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[9], "reduce: expected (fn init list)"], 1); + }); + var ac = [0, 0], ad = [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 ac;} + 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 ad; + var rest = param[2], x = param[1], result = call_any(f, [0, x, 0]); + if(Sx_types[53].call(null, result)) return result; + param = rest; + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "some: expected (fn list)"], 1); + }); + var ae = [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 ae;} + 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[53].call(null, a); + }, + items)]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], "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[9], "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[9], "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[9], "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[9], "vm-stack-copy!: expected (src dst count)"], 1); + }); + var af = [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 af; + }); + var ag = [0, 0], ah = [0, 1]; + register + ("lambda?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 7 === a[0] && ! args[2]) return ah; + } + return ag; + }); + var ai = [0, 0], aj = [0, 1]; + register + ("island?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 9 === a[0] && ! args[2]) return aj; + } + return ai; + }); + var ak = [0, 0]; + register + ("record?", + function(args){ + if(args && ! args[2]){ + var v = args[1]; + return Sx_types[82].call(null, v); + } + return ak; + }); + 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[77].call(null, name, fields, ctor_params); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[78].call(null, uid, arg_list); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[79].call(null, v, idx); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[80].call(null, v, idx, nv); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "record-set!: expected (record index value)"], + 1); + }); + var al = [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[81].call(null, v, uid); + } + } + return al; + }); + register + ("make-record-constructor", + function(args){ + if(args && ! args[2]){ + var uid = args[1]; + return Sx_types[83].call(null, uid); + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "make-record-constructor: expected (uid)"], 1); + }); + register + ("make-record-predicate", + function(args){ + if(args && ! args[2]){ + var uid = args[1]; + return Sx_types[84].call(null, uid); + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "make-record-predicate: expected (uid)"], 1); + }); + register + ("make-record-accessor", + function(args){ + if(args && ! args[2]){ + var idx = args[1]; + return Sx_types[85].call(null, idx); + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "make-record-accessor: expected (index)"], 1); + }); + register + ("make-record-mutator", + function(args){ + if(args && ! args[2]){ + var idx = args[1]; + return Sx_types[86].call(null, idx); + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "make-record-mutator: expected (index)"], 1); + }); + register + ("make-parameter", + function(args){ + if(args){ + var match = args[2], init = args[1], cst_param = "__param_"; + if(! match){ + var uid$0 = Sx_types[16][1]; + Sx_types[16][1]++; + var b = Stdlib[33].call(null, uid$0); + return [27, [0, Stdlib[28].call(null, cst_param, b), init, 0]]; + } + if(! match[2]){ + var converter = match[1], uid = Sx_types[16][1]; + Sx_types[16][1]++; + if(typeof converter === "number" || ! (14 === converter[0])) + var converted = init; + else + var f = converter[2], converted = caml_call1(f, [0, init, 0]); + var a = Stdlib[33].call(null, uid); + return [27, + [0, + Stdlib[28].call(null, cst_param, a), + converted, + [0, converter]]]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "make-parameter: expected 1-2 args"], 1); + }); + var am = [0, 0], an = [0, 0], ao = [0, 1]; + register + ("parameter?", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 27 === a[0]){if(args[2]) break a; return ao;} + if(! args[2]) return an; + } + return am; + }); + register + ("parameter-uid", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 27 === a[0] && ! args[2]){var p = a[1]; return [2, p[1]];} + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "parameter-uid: expected parameter"], 1); + }); + register + ("parameter-default", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 27 === a[0] && ! args[2]){var p = a[1]; return p[2];} + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "parameter-default: expected parameter"], 1); + }); + register + ("parameter-converter", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 27 === a[0] && ! args[2]){ + var p = a[1], match = p[3]; + if(! match) return 0; + var c = match[1]; + return c; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "parameter-converter: expected parameter"], 1); + }); + register + ("make-vector", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 1 === a[0]){ + var match = args[2], n = a[1]; + if(! match) return [28, caml_make_vect(n | 0, 0)]; + if(! match[2]){ + var fill = match[1]; + return [28, caml_make_vect(n | 0, fill)]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "make-vector: expected (length) or (length fill)"], + 1); + }); + register + ("vector", + function(args){return [28, Stdlib_Array[11].call(null, args)];}); + var ap = [0, 0], aq = [0, 1]; + register + ("vector?", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === a[0]){if(args[2]) break a; return aq;} + if(! args[2]) return ap; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "vector?: 1 arg"], 1); + }); + register + ("vector-length", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === a[0] && ! args[2]){var arr = a[1]; return [1, arr.length - 1];} + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector-length: expected vector"], 1); + }); + register + ("vector-ref", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === 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], arr = a[1], d = n | 0; + return caml_check_bound(arr, d)[d + 1]; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector-ref: expected (vector index)"], 1); + }); + register + ("vector-set!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === 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], arr = a[1], e = n | 0; + caml_check_bound(arr, e)[e + 1] = v; + return 0; + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector-set!: expected (vector index value)"], + 1); + }); + register + ("vector->list", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === a[0] && ! args[2]){ + var arr = a[1]; + return [5, Stdlib_Array[10].call(null, arr)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector->list: expected vector"], 1); + }); + register + ("list->vector", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number") + switch(a[0]){ + case 5: + if(! args[2]){ + var l = a[1]; + return [28, Stdlib_Array[11].call(null, l)]; + } + break; + case 20: + var l$0 = a[1][1]; + if(! args[2]) return [28, Stdlib_Array[11].call(null, l$0)]; + break; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "list->vector: expected list"], 1); + }); + register + ("vector-fill!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === a[0]){ + var b = args[2]; + if(b && ! b[2]){ + var v = b[1], arr = a[1]; + Stdlib_Array[8].call(null, arr, 0, arr.length - 1, v); + return 0; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector-fill!: expected (vector value)"], 1); + }); + register + ("vector-copy", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 28 === a[0] && ! args[2]){ + var arr = a[1]; + return [28, Stdlib_Array[7].call(null, arr)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vector-copy: expected vector"], 1); + }); + var cap_stack = [0, 0]; + register + ("with-capabilities", + 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 + body = b[1], + caps = a[1], + cap_set = + Stdlib_List[23].call + (null, + function(v){ + if(typeof v !== "number" && v[0] - 2 >>> 0 < 3){var s = v[1]; return [0, s];} + return 0; + }, + caps), + prev = cap_stack[1]; + cap_stack[1] = cap_set; + if(typeof body !== "number") + switch(body[0]){ + case 7: + case 14: + case 23: + try{var result = caml_call2(Sx_types[7][1], body, 0);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + cap_stack[1] = prev; + throw caml_maybe_attach_backtrace(exn, 0); + } + cap_stack[1] = prev; + return result; + } + cap_stack[1] = prev; + return body; + } + break; + case 20: + var caps$0 = a[1][1], c = args[2]; + if(c && ! c[2]){ + var + body$0 = c[1], + cap_set$0 = + Stdlib_List[23].call + (null, + function(v){ + if(typeof v !== "number" && v[0] - 2 >>> 0 < 3){var s = v[1]; return [0, s];} + return 0; + }, + caps$0), + prev$0 = cap_stack[1]; + cap_stack[1] = cap_set$0; + if(typeof body$0 !== "number") + switch(body$0[0]){ + case 7: + case 14: + case 23: + try{var result$0 = caml_call2(Sx_types[7][1], body$0, 0);} + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + cap_stack[1] = prev$0; + throw caml_maybe_attach_backtrace(exn$0, 0); + } + cap_stack[1] = prev$0; + return result$0; + } + cap_stack[1] = prev$0; + return body$0; + } + break; + } + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "with-capabilities: expected (cap-list body-fn)"], + 1); + }); + register + ("current-capabilities", + function(args){ + return 0 === cap_stack[1] + ? 0 + : [5, + Stdlib_List[20].call + (null, function(s){return [2, s];}, cap_stack[1])]; + }); + var ar = [0, 1], as = [0, 1]; + register + ("has-capability?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && a[0] - 2 >>> 0 < 3 && ! args[2]){ + var cap = a[1]; + return 0 === cap_stack[1] + ? as + : [0, Stdlib_List[37].call(null, cap, cap_stack[1])]; + } + } + return ar; + }); + var + at = + [0, + [11, + "Capability '", + [2, + 0, + [11, "' not available. Current capabilities: [", [2, 0, [12, 93, 0]]]]], + "Capability '%s' not available. Current capabilities: [%s]"]; + register + ("require-capability!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && a[0] - 2 >>> 0 < 3 && ! args[2]){ + var cap = a[1]; + if(0 === cap_stack[1]) return 0; + if(Stdlib_List[37].call(null, cap, cap_stack[1])) return 0; + var + b = Stdlib_String[7].call(null, cst$1, cap_stack[1]), + c = caml_call2(Stdlib_Printf[4].call(null, at), cap, b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + } + return 0; + }); + register + ("capability-restricted?", + function(args){return [0, 0 !== cap_stack[1] ? 1 : 0];}); + var au = [0, 0], av = [0, 1], aw = [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 av; break; + case 4: + if(a[1] === "else" && ! args[2]) return aw; break; + } + } + return au; + }); + var ax = [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 ax; + }); + var ay = [0, 0], az = [0, 1], aA = [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 az; break; + case 9: + if(! args[2]) return aA; break; + } + } + return ay; + }); + 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 aB = [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 aB; + }); + 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 aC = [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 aC; + }); + 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[62].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[63].call(null, v, f); + } + } + return 0; + }); + var aD = [0, 0], aE = [0, 1]; + register + ("macro?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 10 === a[0] && ! args[2]) return aE; + } + return aD; + }); + 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[9], "for-each-indexed: expected (fn list)"], 1); + }); + var aF = [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 aF; + }); + 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 aG = [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 aG; + }); + 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 aH = [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 aH; + }); + 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[9], b], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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[9], 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[9], f], 1); + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "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!", + aI = + [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, aI), 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!", + aJ = + [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, aJ), 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=", + aK = + [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, aK), name, c, 0 !== stack ? 1 : 0), + b]; + } + if(! stack) return 0; + var v = stack[1]; + return v; + } + } + return 0; + }); + var + cst_context = "context", + aL = + [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 + (cst_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, aL), 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 + aM = [2, "bad args"], + aN = + [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, aN), name, c, b)]; + } + } + return aM; + }); + 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", aO = [5, 0], aP = [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 aP; + } + } + return aO; + }); + var + cst_clear_collected = "clear-collected!", + aQ = [5, 0], + aR = [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, aQ, rest]); + } + else + Stdlib_Hashtbl[11].call(null, scope_stacks, name, aR); + return 0; + } + } + return 0; + }); + register + ("provide-reactive!", + 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 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; + } + Stdlib_Hashtbl[11].call + (null, scope_stacks, name, [0, [15, [0, value, 0, 0]], stack]); + return 0; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "provide-reactive!: expected (name value)"], 1); + }); + register + ("provide-pop-reactive!", + 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, rest); + } + return 0; + } + } + return 0; + }); + var + aS = + [0, + [11, "provide-set!: '", [2, 0, [11, "' is not a reactive provide", 0]]], + "provide-set!: '%s' is not a reactive provide"]; + register + ("provide-set!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 2 === a[0]){ + var b = args[2]; + if(b && ! b[2]){ + var new_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" && 15 === match[0]){ + var sig = match[1]; + sig[1] = new_value; + Stdlib_List[18].call + (null, function(sub){return caml_call1(sub, 0);}, sig[2]); + return 0; + } + } + var c = caml_call1(Stdlib_Printf[4].call(null, aS), name); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "provide-set!: expected (name new-value)"], 1); + }); + register + ("peek", + function(args){ + if(args){ + var match = args[1]; + if(typeof match !== "number" && 2 === match[0]){ + var name = match[1]; + try{ + var a = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = a; + } + 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) return 0; + var v = stack[1]; + if(typeof v !== "number" && 15 === v[0]){var sig = v[1]; return sig[1];} + return v; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "peek: expected (name)"], 1); + }); + var tracking_active = [0, 0], tracking_deps = [0, 0]; + register + ("tracking-start!", + function(args){tracking_active[1] = 1; tracking_deps[1] = 0; return 0;}); + register + ("tracking-stop!", + function(args){ + tracking_active[1] = 0; + var deps = tracking_deps[1]; + tracking_deps[1] = 0; + return [5, deps]; + }); + register + ("tracking-active?", function(args){return [0, tracking_active[1]];}); + Stdlib_Hashtbl[10].call(null, primitives, cst_context); + register + (cst_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 a = Stdlib_Hashtbl[6].call(null, scope_stacks, name), stack = a; + } + 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){ + if(! rest) return 0; + var default_val = rest[1]; + return default_val; + } + var v = stack[1]; + if(typeof v !== "number" && 15 === v[0]){ + var sig = v[1]; + if + (tracking_active[1] + && 1 - Stdlib_List[38].call(null, [15, sig], tracking_deps[1])) + tracking_deps[1] = [0, [15, sig], tracking_deps[1]]; + return sig[1]; + } + return v; + } + } + return 0; + }); + register + ("tracking-register-scope!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 2 === a[0] && ! args[2]){ + var name = a[1]; + if(! tracking_active[1]) return 0; + 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" && 15 === match[0]){ + var sig = match[1]; + if(1 - Stdlib_List[38].call(null, [15, sig], tracking_deps[1])) + tracking_deps[1] = [0, [15, sig], tracking_deps[1]]; + return 0; + } + } + return 0; + } + } + return 0; + }); + register + ("deref", + function(args){ + a: + if(args){ + var v = args[1]; + if(typeof v !== "number" && 15 === v[0]){ + if(args[2]) break a; + var sig = v[1]; + if + (tracking_active[1] + && 1 - Stdlib_List[38].call(null, [15, sig], tracking_deps[1])) + tracking_deps[1] = [0, [15, sig], tracking_deps[1]]; + return sig[1]; + } + if(! args[2]) return v; + } + return 0; + }); + register + ("bind", + function(args){ + a: + if(args){ + var b = args[2], body_fn = args[1]; + if(b && b[2]) break a; + b: + { + if(args){ + var a = args[2]; + if(a && ! a[2]){var u = a[1], update_fn = [0, u]; break b;} + } + var update_fn = 0; + } + var + disposers = [0, 0], + run_tracked = + function(param){ + Stdlib_List[18].call + (null, function(d){return caml_call1(d, 0);}, disposers[1]); + disposers[1] = 0; + tracking_active[1] = 1; + tracking_deps[1] = 0; + var + result = caml_call2(Sx_types[7][1], body_fn, 0), + deps = tracking_deps[1]; + tracking_active[1] = 0; + tracking_deps[1] = 0; + Stdlib_List[18].call + (null, + function(dep){ + if(typeof dep !== "number" && 15 === dep[0]){ + var + sig = dep[1], + subscriber = + function(param){ + var new_result = run_tracked(0); + if(! update_fn) return 0; + var f = update_fn[1]; + caml_call2(Sx_types[7][1], f, [5, [0, new_result, 0]]); + return 0; + }; + sig[2] = [0, subscriber, sig[2]]; + disposers[1] = + [0, + function(param){ + sig[2] = + Stdlib_List[44].call + (null, + function(s){return s !== subscriber ? 1 : 0;}, + sig[2]); + return 0; + }, + disposers[1]]; + return 0; + } + return 0; + }, + deps); + return result; + }; + return run_tracked(0); + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "bind: expected (body-fn) or (body-fn update-fn)"], + 1); + }); + 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", aT = [5, 0], aU = [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 aU; + } + } + return aT; + }); + var aV = [5, 0]; + register + ("scope-emitted", + function(args){ + var match = Stdlib_Hashtbl[7].call(null, primitives, cst_emitted); + if(! match) return aV; + var fn = match[1]; + return caml_call1(fn, args); + }); + var aW = [5, 0]; + register + ("scope-collected", + function(args){ + var match = Stdlib_Hashtbl[7].call(null, primitives, cst_collected); + if(! match) return aW; + 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 + (555, + [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)); + +//# 7672 "../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(1),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,N,N,N,F(1),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_ml_string_length = runtime.caml_ml_string_length, + caml_string_compare = runtime.caml_string_compare, + 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(), + Sx_types = global_data.Sx_types, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, + Stdlib_String = global_data.Stdlib__String, + Stdlib_List = global_data.Stdlib__List, + Stdlib = global_data.Stdlib, + Sx_primitives = global_data.Sx_primitives, + Stdlib_Array = global_data.Stdlib__Array, + 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[9], 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[98].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[43].call(null, v), + b = Stdlib[28].call(null, "Expected list, got ", a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + function sx_call(f, args){ + if(typeof f !== "number") + switch(f[0]){ + case 7: + return caml_call2(Sx_types[8][1], f, args); + 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[9], + "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[98].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[98].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[9], c], 1); + } + Sx_primitives[2][1] = sx_call; + function sx_apply(f, args_list){return sx_call(f, sx_to_list(args_list));} + var cst_eval_error = "__eval_error__", b = [0, 1]; + function sx_apply_cek(f, args_list){ + if(typeof f !== "number") + switch(f[0]){ + case 14: + case 23: + try{var a = sx_apply(f, args_list); return a;} + catch(e$0){ + var e = caml_wrap_exception(e$0); + if(e[1] === Sx_types[11]) throw caml_maybe_attach_backtrace(e, 0); + var match = caml_call1(Sx_types[13][1], e); + if(match){var marker = match[1]; return marker;} + if(e[1] !== Sx_types[9]) throw caml_maybe_attach_backtrace(e, 0); + var msg = e[2], d = Stdlib_Hashtbl[1].call(null, 0, 3); + Stdlib_Hashtbl[11].call(null, d, cst_eval_error, b); + Stdlib_Hashtbl[11].call(null, d, "message", [2, msg]); + return [6, d]; + } + } + return sx_apply(f, args_list); + } + function is_eval_error(v){ + if(typeof v !== "number" && 6 === v[0]){ + var d = v[1], match = Stdlib_Hashtbl[7].call(null, d, cst_eval_error); + if(match){ + var a = match[1]; + if(typeof a !== "number" && 0 === a[0] && a[1]) return 1; + } + return 0; + } + return 0; + } + 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[43].call(null, lst), + b = Stdlib[28].call(null, "append!: expected list, got ", a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var + cst_current_item = "current-item", + cst_effect_list = "effect-list", + cst_emitted = "emitted", + cst_extra = "extra", + cst_extra2 = "extra2", + cst_first_render = "first-render", + cst_frames = "frames", + cst_has_effects = "has-effects", + cst_head_name = "head-name", + cst_ho_type = "ho-type", + cst_indexed = "indexed", + cst_ip = "ip", + cst_match_val = "match-val", + cst_phase = "phase", + cst_raw_args = "raw-args", + cst_remaining = "remaining", + cst_results = "results", + cst_scheme = "scheme", + cst_sp = "sp", + cst_stack = "stack", + cst_subscribers = "subscribers", + cst_update_fn = "update-fn", + cst_value = "value"; + function sx_dict_set_b(d, k, v){ + if(typeof d !== "number") + switch(d[0]){ + case 6: + 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; + } + break; + case 22: + if(typeof k !== "number" && 2 === k[0]){ + var + key$0 = k[1], + f = d[1], + switch$ = caml_string_compare(key$0, cst_indexed); + a: + { + b: + if(0 <= switch$){ + if(0 < switch$ && key$0 !== cst_match_val && key$0 !== cst_phase){ + if(key$0 !== cst_raw_args){ + if(key$0 === cst_remaining){f[5] = v; return v;} + if(key$0 !== cst_results){ + if(key$0 === cst_scheme) break b; + if(key$0 !== cst_subscribers){ + if(key$0 === cst_update_fn) break b; + if(key$0 !== cst_value) break a; + break b; + } + } + } + f[8] = v; + return v; + } + } + else if(key$0 !== cst_current_item){ + if(key$0 !== cst_effect_list && key$0 !== cst_emitted){ + if(key$0 === cst_extra) break b; + if(key$0 !== cst_extra2 && key$0 !== cst_first_render){ + if(key$0 === cst_has_effects) break b; + if(key$0 === cst_head_name) break b; + if(key$0 !== cst_ho_type) break a; + break b; + } + } + f[10] = v; + return v; + } + f[9] = v; + return v; + } + var + b = + Stdlib[28].call + (null, "dict-set! cek-frame: unknown field ", key$0); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + break; + case 24: + if(typeof k !== "number" && 2 === k[0]){ + var key$1 = k[1], f$0 = d[1]; + if(key$1 !== cst_ip){ + var + c = + Stdlib[28].call + (null, "dict-set! vm-frame: unknown field ", key$1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + f$0[2] = Sx_types[76].call(null, v); + return v; + } + break; + case 25: + if(typeof k !== "number" && 2 === k[0]){ + var key$2 = k[1], m = d[1]; + if(key$2 !== cst_frames){ + if(key$2 === cst_sp){m[2] = Sx_types[76].call(null, v); return v;} + if(key$2 !== cst_stack){ + var + e = + Stdlib[28].call + (null, "dict-set! vm-machine: unknown field ", key$2); + throw caml_maybe_attach_backtrace([0, Sx_types[9], e], 1); + } + if(typeof v !== "number" && 5 === v[0]) return v; + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vm: stack must be array"], 1); + } + a: + { + if(typeof v !== "number" && 5 === v[0]){ + var + l = v[1], + a = + Stdlib_List[20].call + (null, + function(x){ + if(typeof x !== "number" && 24 === x[0]){var f = x[1]; return f;} + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "vm: frames must be vm-frame list"], 1); + }, + l); + break a; + } + var a = 0; + } + m[3] = a; + return v; + } + break; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "dict-set!: expected dict and string key"], 1); + } + var + cst_body = "body", + cst_else = "else", + cst_name = "name", + cst_type = "type"; + function get_val(container, key){ + if(typeof container === "number") return 0; + a: + { + var cst_env = "env"; + 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[92].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, cst_ho_type); + if(0 <= switch$){ + if(0 >= switch$) return f[9]; + var switch$0 = caml_string_compare(k$1, cst_results); + if(0 <= switch$0){ + if(0 >= switch$0) return f[8]; + if(k$1 === cst_scheme) return f[9]; + if(k$1 === cst_subscribers) return f[8]; + if(k$1 === "then") return f[4]; + if(k$1 === cst_type) return [2, f[1]]; + if(k$1 === cst_update_fn) return f[9]; + if(k$1 === cst_value) return f[9]; + } + else{ + if(k$1 === cst_indexed) return f[9]; + if(k$1 === cst_match_val) return f[9]; + if(k$1 === cst_name) return f[3]; + if(k$1 === cst_phase) return f[9]; + if(k$1 === "prev-tracking") return f[9]; + if(k$1 === cst_raw_args) return f[8]; + if(k$1 === cst_remaining) return f[5]; + } + } + else{ + var switch$1 = caml_string_compare(k$1, "evaled"); + if(0 <= switch$1){ + if(0 >= switch$1) return f[7]; + if(k$1 === cst_extra) return f[9]; + if(k$1 === cst_extra2) return f[10]; + if(k$1 === "f") return f[6]; + if(k$1 === "file") return f[2]; + if(k$1 === cst_first_render) return f[10]; + if(k$1 === cst_has_effects) return f[9]; + if(k$1 === cst_head_name) return f[9]; + } + else{ + if(k$1 === "args") return f[7]; + if(k$1 === cst_body) return f[4]; + if(k$1 === cst_current_item) return f[9]; + if(k$1 === cst_effect_list) return f[10]; + if(k$1 === cst_else) return f[3]; + if(k$1 === cst_emitted) return f[10]; + if(k$1 === cst_env) return f[2]; + } + } + return 0; + case 23: + if(typeof key === "number") break a; + if(2 !== key[0]) break a; + var k$2 = key[1], cl = container[1]; + if(k$2 === "vm-closure-env"){ + var match$2 = cl[5]; + if(! match$2) return 0; + var e = match$2[1]; + return [19, e]; + } + if(k$2 === "vm-code"){ + var c = cl[1], match$0 = c[6]; + if(match$0) + var l$0 = match$0[1], bc = l$0; + else{ + var + g = Stdlib_Array[14].call(null, function(i){return [1, i];}, c[4]), + l$3 = Stdlib_Array[10].call(null, g); + c[6] = [0, l$3]; + var bc = l$3; + } + var match$1 = c[7]; + if(match$1) + var l$1 = match$1[1], consts = l$1; + else{ + var l$2 = Stdlib_Array[10].call(null, c[5]); + c[7] = [0, l$2]; + var consts = l$2; + } + var d$0 = Stdlib_Hashtbl[1].call(null, 0, 4); + Stdlib_Hashtbl[11].call(null, d$0, "vc-bytecode", [5, bc]); + Stdlib_Hashtbl[11].call(null, d$0, "vc-constants", [5, consts]); + Stdlib_Hashtbl[11].call(null, d$0, "vc-arity", [1, c[1]]); + Stdlib_Hashtbl[11].call(null, d$0, "vc-rest-arity", [1, c[2]]); + Stdlib_Hashtbl[11].call(null, d$0, "vc-locals", [1, c[3]]); + return [6, d$0]; + } + if(k$2 === "vm-globals") return [6, cl[4]]; + if(k$2 !== "vm-name"){ + if(k$2 !== "vm-upvalues") return 0; + var + b = Stdlib_Array[14].call(null, function(uv){return uv[1];}, cl[2]); + return [5, Stdlib_Array[10].call(null, b)]; + } + var match = cl[3]; + if(! match) return 0; + var n$0 = match[1]; + return [2, n$0]; + case 24: + if(typeof key === "number") break a; + if(2 !== key[0]) break a; + var k$3 = key[1], f$0 = container[1]; + return k$3 !== "base" + ? k$3 + !== "closure" + ? k$3 + !== cst_ip + ? k$3 !== "local-cells" ? 0 : 0 + : [1, f$0[2]] + : [23, f$0[1]] + : [1, f$0[3]]; + case 25: + if(typeof key === "number") break a; + if(2 !== key[0]) break a; + var k$4 = key[1], m = container[1]; + return k$4 !== cst_frames + ? k$4 + !== "globals" + ? k$4 !== cst_sp ? k$4 !== cst_stack ? 0 : 0 : [1, m[2]] + : [6, m[4]] + : [5, + Stdlib_List[20].call + (null, function(f){return [24, f];}, m[3])]; + 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[9], "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[9], 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[9], a], 1); + } + function inspect(v){return [2, Sx_types[98].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[43].call(null, v)];} + function unwrap_env(v){ + if(typeof v === "number") return Sx_types[17].call(null, 0); + switch(v[0]){ + case 6: + var d = v[1], e = Sx_types[17].call(null, 0); + Stdlib_Hashtbl[12].call + (null, function(k, v){Sx_types[23].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[43].call(null, v), + b = Stdlib[28].call(null, "Expected env, got ", a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + function env_has(e, name){ + var a = value_to_str(name), b = unwrap_env(e); + return [0, Sx_types[25].call(null, b, a)]; + } + function env_get(e, name){ + var a = value_to_str(name), b = unwrap_env(e); + return Sx_types[27].call(null, b, a); + } + function env_bind(e, name, v){ + var a = value_to_str(name), b = unwrap_env(e); + return Sx_types[23].call(null, b, a, v); + } + function env_set(e, name, v){ + var a = value_to_str(name), b = unwrap_env(e); + return Sx_types[29].call(null, b, a, v); + } + function make_env(param){return [19, Sx_types[17].call(null, 0)];} + function env_extend(e){ + var a = unwrap_env(e); + return [19, Sx_types[18].call(null, a)]; + } + function env_merge(a, b){ + var c = unwrap_env(b), d = unwrap_env(a); + return [19, Sx_types[30].call(null, d, c)]; + } + function set_lambda_name(l, n){ + var a = value_to_str(n); + return Sx_types[60].call(null, l, a); + } + function is_nil(v){return [0, Sx_types[44].call(null, v)];} + function is_thunk(v){return [0, Sx_types[49].call(null, v)];} + function is_lambda(v){return [0, Sx_types[45].call(null, v)];} + function is_component(v){return [0, Sx_types[46].call(null, v)];} + function is_island(v){return [0, Sx_types[47].call(null, v)];} + function is_macro(v){return [0, Sx_types[48].call(null, v)];} + function is_signal(v){return [0, Sx_types[50].call(null, v)];} + function is_callable(v){return [0, Sx_types[52].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 c = [0, 0], e = [0, 1]; + function continuation_p(v){ + if(typeof v !== "number" && 12 === v[0]) return e; + return c; + } + 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[9], "not a continuation"], 1); + } + var f = [0, 0], g = [0, 1]; + function callcc_continuation_p(v){ + if(typeof v !== "number" && 13 === v[0]) return g; + return f; + } + 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[9], "not a callcc continuation"], 1); + } + function host_error(msg){ + var a = value_to_str(msg); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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[9], "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 h = [0, 0], i = [0, 1]; + function is_else_clause(v){ + if(typeof v !== "number"){ + var cst_default = "default"; + switch(v[0]){ + case 0: + if(v[1]) return i; 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 h; + } + 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[9], "not a signal"], 1); + } + 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 j = [5, [0, [5, 0], [0, 0, [0, [0, 0], 0]]]]; + function parse_comp_params(params){return j;} + var k = [5, [0, [5, 0], [0, 0, 0]]]; + function parse_macro_params(params){return k;} + var l = [0, [5, 0], 0]; + function parse_keyword_args(raw_args, env){ + return [5, [0, [6, Stdlib_Hashtbl[1].call(null, 0, 0)], l]]; + } + var m = [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, m); + 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 n = [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, n); + Stdlib_Hashtbl[11].call(null, d, cst_name, name); + return [6, d]; + } + var o = [1, 1.]; + function sf_defhandler(args, env){ + var name = first(args), rest_args = rest(args), a = nth(rest_args, o); + 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_hit = [0, 0], jit_miss = [0, 0], jit_skip = [0, 0]; + function jit_reset_counters(param){ + jit_hit[1] = 0; + jit_miss[1] = 0; + jit_skip[1] = 0; + return 0; + } + var d = Stdlib_Hashtbl[1].call(null, 0, 1), cst_jit_skip = "__jit_skip"; + Stdlib_Hashtbl[11].call(null, d, cst_jit_skip, [0, 1]); + function is_jit_skip(v){ + if(typeof v !== "number" && 6 === v[0]){ + var d = v[1]; + return Stdlib_Hashtbl[9].call(null, d, cst_jit_skip); + } + return 0; + } + function jit_skip_p(v){return [0, is_jit_skip(v)];} + var jit_try_call_fn = [0, 0], jit_skip_sentinel = [6, d]; + function jit_try_call(f, args){ + var match = jit_try_call_fn[1]; + if(! match){jit_skip[1]++; return jit_skip_sentinel;} + 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; + } + try{ + var match$1 = caml_call2(hook, f, arg_list); + if(match$1){ + var result = match$1[1]; + jit_hit[1]++; + var result$0 = result; + } + else{jit_miss[1]++; var result$0 = jit_skip_sentinel;} + return result$0; + } + catch(exn$0){ + var + exn = caml_wrap_exception(exn$0), + match$0 = caml_call1(Sx_types[13][1], exn); + if(! match$0) throw caml_maybe_attach_backtrace(exn, 0); + var marker = match$0[1]; + jit_hit[1]++; + return marker; + } + } + } + jit_skip[1]++; + return jit_skip_sentinel; + } + runtime.caml_register_global + (210, + [0, + prim_call, + value_to_str, + sx_to_string, + sx_str, + sx_to_list, + sx_call, + sx_apply, + sx_apply_cek, + is_eval_error, + 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_hit, + jit_miss, + jit_skip, + jit_reset_counters, + jit_skip_sentinel, + is_jit_skip, + jit_skip_p, + jit_try_call], + "Sx_runtime"); + return; + } + (globalThis)); + +//# 8755 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_ref:[N,F(1),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(3)*,F(2)*,F(6)*,F(3)*,F(3)*,F(2)*,F(3)*,F(4)*,F(3),F(3),F(4)*,F(4)*,F(4)*,F(5)*,F(3)*,F(3)*,F(3)*,F(3)*,F(3)*,F(4)*,F(3)*,F(2)*,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(5)*,F(2),F(2),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(1),F(1),N,F(2),N,N,N,N,N,N,N,N,N,N,N,F(1),F(1),F(1),F(2),N,F(2),F(1),F(1),F(1),N,F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(3),F(1),F(2),F(3),F(2),F(2),F(3),N,N,F(1),N,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(3),F(3),F(1),F(1),F(1),F(1),F(3),F(3),F(3),F(5),F(2),F(2),F(2),F(3),F(3),F(3),F(2),F(3),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1),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(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 + protocol_registry = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + 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[25].call(null, state, d), c], + and = Sx_runtime[1].call(null, cst, a); + if(! Sx_types[53].call(null, and)) return and; + var b = Sx_runtime[25].call(null, state, e); + return Sx_runtime[33].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[25].call(null, state, g), f]; + return Sx_runtime[1].call(null, cst, a); + } + var h = [2, "control"]; + function cek_control(s){return Sx_runtime[25].call(null, s, h);} + var i = [2, cst_env]; + function cek_env(s){return Sx_runtime[25].call(null, s, i);} + var j = [2, cst_kont]; + function cek_kont(s){return Sx_runtime[25].call(null, s, j);} + var k = [2, cst_phase]; + function cek_phase(s){return Sx_runtime[25].call(null, s, k);} + var l = [2, cst_request]; + function cek_io_request(s){return Sx_runtime[25].call(null, s, l);} + var cst_value = "value", m = [2, cst_value]; + function cek_value(s){return Sx_runtime[25].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_define_foreign = "define-foreign"; + function make_define_foreign_frame(name, spec, env){ + return [22, [0, cst_define_foreign, env, name, 0, 0, 0, 0, 0, 0, 0]]; + } + 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[53].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, mode, name){ + return [22, [0, cst_thread, env, name, 0, remaining, 0, 0, 0, mode, 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[73].call(null, form), n], + b = Sx_runtime[1].call(null, cst, a); + if(! Sx_types[53].call(null, b)) + return eval_expr + ([5, [0, form, [0, [5, [0, p, [0, value, 0]]], 0]]], fenv); + var + c = Sx_runtime[15].call(null, form), + d = Sx_runtime[18].call(null, [5, [0, o, [0, value, 0]]], c), + e = Sx_runtime[14].call(null, form); + return eval_expr(Sx_runtime[18].call(null, e, d), fenv); + } + var + cst_append = "append", + q = [0, [2, cst_list], 0], + r = [3, cst_quote], + s = [3, cst_quote]; + function thread_insert_arg_last(form, value, fenv){ + var + a = [0, Sx_runtime[73].call(null, form), q], + b = Sx_runtime[1].call(null, cst, a); + return Sx_types[53].call(null, b) + ? eval_expr + (Sx_runtime[1].call + (null, + cst_append, + [0, form, [0, [5, [0, [5, [0, r, [0, value, 0]]], 0]], 0]]), + fenv) + : eval_expr + ([5, [0, form, [0, [5, [0, s, [0, value, 0]]], 0]]], fenv); + } + var cst_map = "map", t = [0, 0]; + function make_map_frame(f, remaining, results, env){ + return [22, [0, cst_map, env, 0, 0, remaining, f, 0, results, t, 0]]; + } + var u = [0, 1]; + function make_map_indexed_frame(f, remaining, results, env){ + return [22, [0, cst_map, env, 0, 0, remaining, f, 0, results, u, 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", v = [5, 0]; + function make_provide_frame(name, value, remaining, env){ + return [22, [0, cst_provide, env, name, 0, remaining, 0, 0, v, value, 0]]; + } + var cst_bind = "bind"; + function make_bind_frame(body, env, prev_tracking){ + return [22, [0, cst_bind, env, 0, body, 0, 0, 0, 0, prev_tracking, 0]]; + } + var cst_provide_set = "provide-set"; + function make_provide_set_frame(name, env){ + return [22, [0, cst_provide_set, env, name, 0, 0, 0, 0, 0, 0, 0]]; + } + var cst_scope_acc = "scope-acc", w = [5, 0]; + function make_scope_acc_frame(name, value, remaining, env){ + var value$0 = Sx_types[53].call(null, value) ? value : 0; + return [22, + [0, cst_scope_acc, env, name, 0, remaining, 0, 0, 0, value$0, w]]; + } + 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", + x = [5, 0], + y = [0, [2, cst_comp_trace], 0], + z = [2, cst_file], + A = [2, cst_name]; + function kont_collect_comp_trace(kont$1){ + var kont = kont$1; + for(;;){ + var a = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, a)) return x; + var + frame = Sx_runtime[14].call(null, kont), + b = [0, frame_type(frame), y], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)){ + var + e = kont_collect_comp_trace(Sx_runtime[15].call(null, kont)), + d = Stdlib_Hashtbl[1].call(null, 0, 2), + f = Sx_runtime[25].call(null, frame, z); + Stdlib_Hashtbl[11].call(null, d, cst_file, f); + var g = Sx_runtime[25].call(null, frame, A); + Stdlib_Hashtbl[11].call(null, d, cst_name, g); + return Sx_runtime[18].call(null, [6, d], e); + } + var kont$0 = Sx_runtime[15].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 cst_parameterize = "parameterize"; + function make_parameterize_frame + (remaining, current_param, results, body, env){ + return [22, + [0, + cst_parameterize, + env, + 0, + body, + remaining, + current_param, + 0, + results, + 0, + 0]]; + } + var B = [1, 1.]; + function find_matching_handler(handlers$1, condition){ + var handlers = handlers$1; + for(;;){ + var a = Sx_runtime[33].call(null, handlers); + if(Sx_types[53].call(null, a)) return 0; + var + pair = Sx_runtime[14].call(null, handlers), + pred = Sx_runtime[14].call(null, pair), + handler_fn = Sx_runtime[17].call(null, pair, B), + b = cek_call(pred, [5, [0, condition, 0]]); + if(Sx_types[53].call(null, b)) return handler_fn; + var handlers$0 = Sx_runtime[15].call(null, handlers); + handlers = handlers$0; + } + } + var cst_f = "f", C = [0, [2, cst_handler], 0], D = [2, cst_f]; + function kont_find_handler(kont$2, condition){ + var kont = kont$2; + for(;;){ + var a = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, a)) return 0; + var + frame = Sx_runtime[14].call(null, kont), + b = [0, frame_type(frame), C], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)){ + var + match = + find_matching_handler(Sx_runtime[25].call(null, frame, D), condition), + d = Sx_runtime[83].call(null, match); + if(! Sx_types[53].call(null, d)) return match; + var kont$0 = Sx_runtime[15].call(null, kont); + kont = kont$0; + } + else{var kont$1 = Sx_runtime[15].call(null, kont); kont = kont$1;} + } + } + function find_named_restart(restarts$1, name){ + var restarts = restarts$1; + for(;;){ + var a = Sx_runtime[33].call(null, restarts); + if(Sx_types[53].call(null, a)) return 0; + var + entry = Sx_runtime[14].call(null, restarts), + b = [0, Sx_runtime[14].call(null, entry), [0, name, 0]], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)) return entry; + var restarts$0 = Sx_runtime[15].call(null, restarts); + restarts = restarts$0; + } + } + var E = [0, [2, cst_restart], 0], F = [2, cst_f]; + function kont_find_restart(kont$2, name){ + var kont = kont$2; + for(;;){ + var a = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, a)) return 0; + var + frame = Sx_runtime[14].call(null, kont), + b = [0, frame_type(frame), E], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)){ + var + match = find_named_restart(Sx_runtime[25].call(null, frame, F), name), + d = Sx_runtime[83].call(null, match); + if(! Sx_types[53].call(null, d)) + return [5, + [0, match, [0, frame, [0, Sx_runtime[15].call(null, kont), 0]]]]; + var kont$0 = Sx_runtime[15].call(null, kont); + kont = kont$0; + } + else{var kont$1 = Sx_runtime[15].call(null, kont); kont = kont$1;} + } + } + var cst_type = "type", G = [2, cst_type]; + function frame_type(f){return Sx_runtime[25].call(null, f, G);} + function kont_push(frame, kont){ + return Sx_runtime[18].call(null, frame, kont); + } + function kont_top(kont){return Sx_runtime[14].call(null, kont);} + function kont_pop(kont){return Sx_runtime[15].call(null, kont);} + function kont_empty_p(kont){return Sx_runtime[33].call(null, kont);} + var + captured = [5, 0], + H = [2, "shift without enclosing reset"], + I = [0, [2, cst_reset], 0], + J = [0, [2, cst_reactive_reset], 0]; + function kont_capture_to_reset(kont){ + var k = kont, captured$0 = captured; + for(;;){ + var a = Sx_runtime[33].call(null, k); + if(Sx_types[53].call(null, a)){ + var b = Sx_runtime[2].call(null, H); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var + frame = Sx_runtime[14].call(null, k), + c = [0, frame_type(frame), I], + or = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else + var + d = [0, frame_type(frame), J], + or$0 = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, or$0)) + return [5, [0, captured$0, [0, Sx_runtime[15].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[15].call(null, k); + k = k$0; + captured$0 = captured$1; + } + } + var K = [5, 0], L = [1, 1.]; + function kont_push_provides(pairs$1, env, kont$1){ + var pairs = pairs$1, kont = kont$1; + for(;;){ + var a = Sx_runtime[33].call(null, pairs); + if(Sx_types[53].call(null, a)) return kont; + var + pair = Sx_runtime[14].call(null, pairs), + b = Sx_runtime[17].call(null, pair, L), + c = make_provide_frame(Sx_runtime[14].call(null, pair), b, K, env), + kont$0 = Sx_runtime[18].call(null, c, kont), + pairs$0 = Sx_runtime[15].call(null, pairs); + pairs = pairs$0; + kont = kont$0; + } + } + var M = [0, [2, cst_provide], 0], N = [2, cst_name]; + function kont_find_provide(kont$1, name){ + var kont = kont$1; + for(;;){ + var b = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, b)) return 0; + var + frame = Sx_runtime[14].call(null, kont), + c = [0, frame_type(frame), M], + and = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and)) + var + d = [0, Sx_runtime[25].call(null, frame, N), [0, name, 0]], + a = Sx_runtime[1].call(null, cst, d); + else + var a = and; + if(Sx_types[53].call(null, a)) return frame; + var kont$0 = Sx_runtime[15].call(null, kont); + kont = kont$0; + } + } + var O = [0, [2, cst_scope_acc], 0], P = [2, cst_name]; + function kont_find_scope_acc(kont$1, name){ + var kont = kont$1; + for(;;){ + var b = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, b)) return 0; + var + frame = Sx_runtime[14].call(null, kont), + c = [0, frame_type(frame), O], + and = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and)) + var + d = [0, Sx_runtime[25].call(null, frame, P), [0, name, 0]], + a = Sx_runtime[1].call(null, cst, d); + else + var a = and; + if(Sx_types[53].call(null, a)) return frame; + var kont$0 = Sx_runtime[15].call(null, kont); + kont = kont$0; + } + } + var Q = [0, 0], R = [0, [2, cst_reactive_reset], 0], S = [0, 1]; + function has_reactive_reset_frame_p(kont$1){ + var kont = kont$1; + for(;;){ + var a = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, a)) return Q; + var + b = [0, frame_type(Sx_runtime[14].call(null, kont)), R], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)) return S; + var kont$0 = Sx_runtime[15].call(null, kont); + kont = kont$0; + } + } + var + captured$0 = [5, 0], + T = [2, "reactive deref without enclosing reactive-reset"], + U = [0, [2, cst_reactive_reset], 0]; + function kont_capture_to_reactive_reset(kont){ + var k = kont, captured = captured$0; + for(;;){ + var a = Sx_runtime[33].call(null, k); + if(Sx_types[53].call(null, a)){ + var b = Sx_runtime[2].call(null, T); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var + frame = Sx_runtime[14].call(null, k), + c = [0, frame_type(frame), U], + d = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, d)) + return [5, + [0, captured, [0, frame, [0, Sx_runtime[15].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[15].call(null, k); + k = k$0; + captured = captured$1; + } + } + var custom_special_forms = []; + function register_special_form(name, handler){ + return Sx_runtime[11].call(null, custom_special_forms, name, handler); + } + var cst$0 = ".", cst_join = "join", V = [2, cst$0]; + function library_name_key(spec){ + var + a = Sx_runtime[5].call(null, spec), + b = + [0, + V, + [0, + [5, + Stdlib_List[20].call + (null, + function(s){ + var a = Sx_runtime[39].call(null, s); + return Sx_types[53].call(null, a) + ? Sx_types[54].call(null, s) + : [2, Sx_runtime[4].call(null, [0, s, 0])]; + }, + a)], + 0]]; + return Sx_runtime[1].call(null, cst_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", W = [2, cst_exports]; + function library_exports(spec){ + var + a = library_name_key(spec), + b = Sx_runtime[25].call(null, library_registry, a); + return Sx_runtime[25].call(null, b, W); + } + 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[11].call(null, library_registry, a, [6, d]); + } + var io_registry = []; + function io_register_b(name, spec){ + return Sx_runtime[11].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[25].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 foreign_registry = []; + function foreign_register_b(name, spec){ + return Sx_runtime[11].call(null, foreign_registry, name, spec); + } + function foreign_registered_p(name){ + return Sx_runtime[1].call + (null, cst_has_key, [0, foreign_registry, [0, name, 0]]); + } + function foreign_lookup(name){ + return Sx_runtime[25].call(null, foreign_registry, name); + } + function foreign_names(param){ + return Sx_runtime[1].call(null, cst_keys, [0, foreign_registry, 0]); + } + var result = [5, 0], X = [5, 0]; + function foreign_parse_params(param_list){ + var + a = Sx_runtime[37].call(null, param_list), + items = Sx_types[53].call(null, a) ? param_list : X; + return foreign_parse_params_loop(items, result); + } + var cst$1 = ">=", Y = [0, [1, 2.], 0], Z = [1, 1.]; + function foreign_parse_kwargs_b(spec, remaining$1){ + var remaining = remaining$1; + for(;;){ + var + b = Sx_runtime[33].call(null, remaining), + and = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and)){ + var + c = [0, Sx_runtime[24].call(null, remaining), Y], + and$0 = Sx_runtime[1].call(null, cst$1, c); + if(Sx_types[53].call(null, and$0)) + var + d = Sx_runtime[14].call(null, remaining), + a = Sx_runtime[32].call(null, d); + else + var a = and$0; + } + else + var a = and; + if(! Sx_types[53].call(null, a)) return 0; + var + v = Sx_runtime[17].call(null, remaining, Z), + e = Sx_runtime[32].call(null, v), + f = Sx_types[53].call(null, e) ? Sx_types[55].call(null, v) : v, + g = Sx_runtime[14].call(null, remaining), + h = Sx_types[55].call(null, g); + Sx_runtime[11].call(null, spec, h, f); + var + i = Sx_runtime[15].call(null, remaining), + remaining$0 = Sx_runtime[15].call(null, i); + remaining = remaining$0; + } + } + var + cst_method = "method", + cst_object = "object", + _ = [0, [2, cst$0], 0], + $ = [0, [1, 1.], 0], + aa = [2, cst$0]; + function foreign_resolve_binding(binding_str){ + var + parts = Sx_runtime[1].call(null, "split", [0, binding_str, _]), + a = [0, Sx_runtime[24].call(null, parts), $], + b = Sx_runtime[1].call(null, "<=", a); + if(Sx_types[53].call(null, b)){ + var d = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d, cst_method, binding_str); + Stdlib_Hashtbl[11].call(null, d, cst_object, 0); + return [6, d]; + } + var + method = Sx_runtime[16].call(null, parts), + c = Sx_runtime[20].call(null, parts), + e = Sx_runtime[15].call(null, c), + f = [0, aa, [0, Sx_runtime[20].call(null, e), 0]], + obj = Sx_runtime[1].call(null, cst_join, f), + d$0 = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d$0, cst_method, method); + Stdlib_Hashtbl[11].call(null, d$0, cst_object, obj); + return [6, d$0]; + } + var + cst_args_got = " args, got ", + cst_got = ", got ", + cst$2 = "<", + cst_any = "any", + cst_foreign = "foreign ", + cst_range = "range", + ab = [2, cst_args_got], + ac = [2, ": expected "], + ad = [2, cst_foreign], + ae = [1, 0.], + af = [2, cst_type], + ag = [0, [2, cst_any], 0], + ah = [2, cst_got], + ai = [2, "' expected "], + aj = [2, cst_name], + ak = [2, ": arg '"], + al = [2, cst_foreign]; + function foreign_check_args(name, params, args){ + var + b = Sx_runtime[33].call(null, params), + and = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and)) + var + c = [0, Sx_runtime[24].call(null, params), 0], + d = [0, Sx_runtime[24].call(null, args), c], + a = Sx_runtime[1].call(null, cst$2, d); + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + e = [0, ab, [0, Sx_runtime[24].call(null, args), 0]], + f = + [0, ad, [0, name, [0, ac, [0, Sx_runtime[24].call(null, params), e]]]], + g = [2, Sx_runtime[4].call(null, f)], + h = Sx_runtime[2].call(null, g); + throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); + } + var + i = [0, Sx_runtime[24].call(null, args), 0], + j = [0, Sx_runtime[24].call(null, params), i], + k = [0, ae, [0, Sx_runtime[1].call(null, "min", j), 0]], + l = Sx_runtime[1].call(null, cst_range, k), + m = Sx_runtime[5].call(null, l); + Stdlib_List[18].call + (null, + function(i){ + var + spec = Sx_runtime[17].call(null, params, i), + val = Sx_runtime[17].call(null, args, i), + expected = Sx_runtime[25].call(null, spec, af), + b = Sx_runtime[1].call(null, cst, [0, expected, ag]), + and = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and)) + var + c = value_matches_type_p(val, expected), + a = [0, 1 - Sx_types[53].call(null, c)]; + else + var a = and; + if(! Sx_types[53].call(null, a)) return 0; + var + d = + [0, + ai, + [0, expected, [0, ah, [0, Sx_runtime[73].call(null, val), 0]]]], + e = + [0, + al, + [0, name, [0, ak, [0, Sx_runtime[25].call(null, spec, aj), d]]]], + f = [2, Sx_runtime[4].call(null, e)], + g = Sx_runtime[2].call(null, f); + throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); + }, + m); + return 0; + } + var + cst_rest = "&rest", + cst_ffi_args = "__ffi-args__", + cst_async = "async", + cst_fn = "fn", + cst_foreign_dispatch = "foreign-dispatch", + cst_returns = "returns", + cst_sync = "sync", + am = [2, cst_name], + an = [0, [2, cst_returns], 0], + ao = [2, cst_returns], + ap = [0, [2, "promise"], 0], + aq = [2, cst_async], + ar = [0, [2, cst_async], 0], + as = [0, [3, cst_ffi_args], 0], + at = [3, cst_quote], + au = [3, cst_foreign_dispatch], + av = [3, cst_perform], + aw = [5, [0, [3, cst_rest], [0, [3, cst_ffi_args], 0]]], + ax = [3, cst_fn], + ay = [0, [3, cst_ffi_args], 0], + az = [3, cst_quote], + aA = [3, cst_foreign_dispatch], + aB = [5, [0, [3, cst_rest], [0, [3, cst_ffi_args], 0]]], + aC = [3, cst_fn], + aD = [2, cst_sync], + aE = [2, cst_sync]; + function foreign_build_lambda(spec){ + var + name = Sx_runtime[25].call(null, spec, am), + a = Sx_runtime[1].call(null, cst_has_key, [0, spec, an]); + if(Sx_types[53].call(null, a)) + var + r = Sx_runtime[25].call(null, spec, ao), + b = Sx_runtime[1].call(null, cst, [0, r, ap]), + mode = Sx_types[53].call(null, b) ? aq : aD; + else + var mode = aE; + var c = Sx_runtime[1].call(null, cst, [0, mode, ar]); + return Sx_types[53].call(null, c) + ? [5, + [0, + ax, + [0, + aw, + [0, + [5, + [0, + av, + [0, [5, [0, au, [0, [5, [0, at, [0, name, 0]]], as]]], 0]]], + 0]]]] + : [5, + [0, + aC, + [0, + aB, + [0, [5, [0, aA, [0, [5, [0, az, [0, name, 0]]], ay]]], 0]]]]; + } + var + cst_params = "params", + aF = [1, 1.], + aG = [2, cst_name], + aH = [2, cst_params]; + function sf_define_foreign(args, env){ + var a = Sx_runtime[14].call(null, args), b = Sx_runtime[39].call(null, a); + if(Sx_types[53].call(null, b)) + var + c = Sx_runtime[14].call(null, args), + name = Sx_types[54].call(null, c); + else + var name = Sx_runtime[14].call(null, args); + var + param_list = Sx_runtime[17].call(null, args, aF), + spec = [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + Sx_runtime[11].call(null, spec, aG, name); + var d = foreign_parse_params(param_list); + Sx_runtime[11].call(null, spec, aH, d); + var e = Sx_runtime[15].call(null, args); + foreign_parse_kwargs_b(spec, Sx_runtime[15].call(null, e)); + foreign_register_b(name, spec); + return spec; + } + function step_sf_define_foreign(args, env, kont){ + var + spec = sf_define_foreign(args, env), + a = Sx_runtime[14].call(null, args), + b = Sx_runtime[39].call(null, a); + if(Sx_types[53].call(null, b)) + var + c = Sx_runtime[14].call(null, args), + name = Sx_types[54].call(null, c); + else + var name = Sx_runtime[14].call(null, args); + var lambda_expr = foreign_build_lambda(spec); + return make_cek_state + (lambda_expr, + env, + kont_push(make_define_foreign_frame(name, spec, env), kont)); + } + var + cst_concat = "concat", + cst_host_call = "host-call", + aI = [0, [2, "'"], 0], + aJ = [2, "foreign-dispatch: unknown foreign function '"], + aK = [2, cst_params], + aL = [2, "js"], + aM = [5, 0], + aN = [0, [2, ": no binding for current platform"], 0], + aO = [2, cst_foreign], + aP = [2, cst_object], + aQ = [2, cst_method], + aR = [2, cst_host_call], + aS = [2, cst_host_call], + aT = [2, "host-global"], + aU = [2, cst_host_call], + aV = [0, [2, ": host-call not available on this platform"], 0], + aW = [2, cst_foreign]; + function foreign_dispatch(name, args){ + var spec = foreign_lookup(name), a = Sx_runtime[83].call(null, spec); + if(Sx_types[53].call(null, a)){ + var + b = [2, Sx_runtime[4].call(null, [0, aJ, [0, name, aI]])], + c = Sx_runtime[2].call(null, b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + var + params = Sx_runtime[25].call(null, spec, aK), + binding = Sx_runtime[25].call(null, spec, aL), + d = Sx_runtime[83].call(null, params), + e = Sx_types[53].call(null, d) ? aM : params; + foreign_check_args(name, e, args); + var f = Sx_runtime[83].call(null, binding); + if(Sx_types[53].call(null, f)){ + var + g = [2, Sx_runtime[4].call(null, [0, aO, [0, name, aN]])], + h = Sx_runtime[2].call(null, g); + throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); + } + var + resolved = foreign_resolve_binding(binding), + obj_name = Sx_runtime[25].call(null, resolved, aP), + method = Sx_runtime[25].call(null, resolved, aQ), + i = Sx_runtime[91].call(null, aR); + if(! Sx_types[53].call(null, i)){ + var + o = [2, Sx_runtime[4].call(null, [0, aW, [0, name, aV]])], + p = Sx_runtime[2].call(null, o); + throw caml_maybe_attach_backtrace([0, Sx_types[9], p], 1); + } + var j = Sx_runtime[83].call(null, obj_name); + if(Sx_types[53].call(null, j)){ + var + k = + Sx_runtime[1].call + (null, cst_concat, [0, [5, [0, 0, [0, method, 0]]], [0, args, 0]]), + l = Sx_runtime[92].call(null, aS); + return Sx_runtime[7].call(null, l, k); + } + var + obj = cek_call(Sx_runtime[92].call(null, aT), [5, [0, obj_name, 0]]), + m = + Sx_runtime[1].call + (null, cst_concat, [0, [5, [0, obj, [0, method, 0]]], [0, args, 0]]), + n = Sx_runtime[92].call(null, aU); + return Sx_runtime[7].call(null, n, m); + } + var + cst_as = "as", + aX = [0, [2, cst_as], 0], + aY = [0, [1, 2.], 0], + aZ = [1, 1.]; + function foreign_parse_params_loop(items$1, acc$2){ + var items = items$1, acc = acc$2; + for(;;){ + var b = Sx_runtime[33].call(null, items); + if(Sx_types[53].call(null, b)) return acc; + var + item = Sx_runtime[14].call(null, items), + rest_items = Sx_runtime[15].call(null, items), + c = Sx_runtime[33].call(null, rest_items), + and = [0, 1 - Sx_types[53].call(null, c)]; + if(Sx_types[53].call(null, and)){ + var + e = Sx_runtime[14].call(null, rest_items), + and$0 = Sx_runtime[32].call(null, e); + if(Sx_types[53].call(null, and$0)){ + var + f = Sx_runtime[14].call(null, rest_items), + g = [0, Sx_types[55].call(null, f), aX], + and$1 = Sx_runtime[1].call(null, cst, g); + if(Sx_types[53].call(null, and$1)) + var + h = [0, Sx_runtime[24].call(null, rest_items), aY], + a = Sx_runtime[1].call(null, cst$1, h); + else + var a = and$1; + } + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + d = Stdlib_Hashtbl[1].call(null, 0, 2), + t = Sx_runtime[17].call(null, rest_items, aZ), + i = Sx_runtime[32].call(null, t), + j = + Sx_types[53].call(null, i) + ? Sx_types[55].call(null, t) + : [2, Sx_runtime[4].call(null, [0, t, 0])]; + Stdlib_Hashtbl[11].call(null, d, cst_type, j); + var + k = Sx_runtime[39].call(null, item), + l = + Sx_types[53].call(null, k) + ? Sx_types[54].call(null, item) + : [2, Sx_runtime[4].call(null, [0, item, 0])]; + Stdlib_Hashtbl[11].call(null, d, cst_name, l); + var + acc$0 = + Sx_runtime[1].call + (null, cst_append, [0, acc, [0, [5, [0, [6, d], 0]], 0]]), + m = Sx_runtime[15].call(null, rest_items), + items$0 = Sx_runtime[15].call(null, m); + items = items$0; + acc = acc$0; + } + else{ + var + n = Sx_runtime[39].call(null, item), + o = + Sx_types[53].call(null, n) + ? Sx_types[54].call(null, item) + : [2, Sx_runtime[4].call(null, [0, item, 0])], + acc$1 = + Sx_runtime[1].call + (null, + cst_append, + [0, + acc, + [0, [5, [0, [22, [0, cst_any, 0, o, 0, 0, 0, 0, 0, 0, 0]], 0]], 0]]); + items = rest_items; + acc = acc$1; + } + } + } + var + cst_args = "args", + cst_op = "op", + a0 = [0, [2, "' \xe2\x80\x94 not in *io-registry*"], 0], + a1 = [2, "io: unknown operation '"], + a2 = [3, cst_perform]; + function step_sf_io(args, env, kont){ + var + name = Sx_runtime[14].call(null, args), + io_args = Sx_runtime[15].call(null, args), + a = io_registered_p(name), + b = [0, 1 - Sx_types[53].call(null, a)]; + if(Sx_types[53].call(null, b)){ + var + c = [2, Sx_runtime[4].call(null, [0, a1, [0, name, a0]])], + e = Sx_runtime[2].call(null, c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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[18].call(null, a2, [5, [0, [6, d], 0]]), env, kont); + } + var strict_ref = []; + function set_strict_b(val){strict_ref[1] = val; return 0;} + var prim_param_types_ref = []; + function set_prim_param_types_b(types){ + prim_param_types_ref[1] = types; + return 0; + } + var + cst$4 = "-", + cst$3 = "?", + 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", + a3 = [0, [2, cst_any], 0], + a4 = [0, 1], + a5 = [0, [2, cst_number], 0], + a6 = [0, [2, cst_string], 0], + a7 = [0, [2, cst_boolean], 0], + a8 = [0, [2, cst_nil], 0], + a9 = [0, [2, cst_list], 0], + a_ = [0, [2, cst_dict], 0], + a$ = [0, [2, cst_lambda], 0], + ba = [0, [2, cst_symbol], 0], + bb = [0, [2, cst_symbol], 0], + bc = [0, [2, cst_keyword], 0], + bd = [0, [2, cst_keyword], 0], + be = [0, [2, cst$3], 0], + bf = [0, [1, 1.], 0], + bg = [1, 0.], + bh = [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, a3]); + if(Sx_types[53].call(null, a)) return a4; + var b = Sx_runtime[1].call(null, cst, [0, expected_type, a5]); + if(Sx_types[53].call(null, b)) return Sx_runtime[34].call(null, val); + var c = Sx_runtime[1].call(null, cst, [0, expected_type, a6]); + if(Sx_types[53].call(null, c)) return Sx_runtime[35].call(null, val); + var d = Sx_runtime[1].call(null, cst, [0, expected_type, a7]); + if(Sx_types[53].call(null, d)) return Sx_runtime[36].call(null, val); + var e = Sx_runtime[1].call(null, cst, [0, expected_type, a8]); + if(Sx_types[53].call(null, e)) return Sx_runtime[83].call(null, val); + var f = Sx_runtime[1].call(null, cst, [0, expected_type, a9]); + if(Sx_types[53].call(null, f)) return Sx_runtime[37].call(null, val); + var g = Sx_runtime[1].call(null, cst, [0, expected_type, a_]); + if(Sx_types[53].call(null, g)) return Sx_runtime[38].call(null, val); + var h = Sx_runtime[1].call(null, cst, [0, expected_type, a$]); + if(Sx_types[53].call(null, h)) return Sx_runtime[85].call(null, val); + var i = Sx_runtime[1].call(null, cst, [0, expected_type, ba]); + if(Sx_types[53].call(null, i)){ + var j = [0, Sx_runtime[73].call(null, val), bb]; + return Sx_runtime[1].call(null, cst, j); + } + var k = Sx_runtime[1].call(null, cst, [0, expected_type, bc]); + if(Sx_types[53].call(null, k)){ + var l = [0, Sx_runtime[73].call(null, val), bd]; + return Sx_runtime[1].call(null, cst, l); + } + var + and = Sx_runtime[35].call(null, expected_type), + m = + Sx_types[53].call(null, and) + ? Sx_runtime[1].call(null, cst_ends_with, [0, expected_type, be]) + : and; + if(! Sx_types[53].call(null, m)) return bh; + var or = Sx_runtime[83].call(null, val); + if(Sx_types[53].call(null, or)) return or; + var + n = + [0, + Sx_runtime[1].call(null, "string-length", [0, expected_type, 0]), + bf], + o = + [0, + expected_type, + [0, bg, [0, Sx_runtime[1].call(null, cst$4, n), 0]]], + expected_type$0 = Sx_runtime[1].call(null, cst_slice, o); + expected_type = expected_type$0; + } + } + var + cst$6 = " (", + cst_expected = " expected ", + cst$5 = ")", + cst$7 = ">", + cst_Type_error = "Type error: ", + bi = [2, "positional"], + bj = [2, "rest-type"], + bk = [1, 1.], + bl = [1, 1.], + bm = [0, [2, cst$5], 0], + bn = [2, cst$6], + bo = [2, cst_got], + bp = [2, " for param "], + bq = [2, cst_expected], + br = [2, cst_Type_error], + bs = [1, 1.], + bt = [0, [2, cst$5], 0], + bu = [2, cst$6], + bv = [2, cst_got], + bw = [2, " for rest arg "], + bx = [2, cst_expected], + by = [2, cst_Type_error], + bz = [5, 0], + bA = [5, 0]; + function strict_check_args(name, args){ + var + and = strict_ref[1], + b = Sx_types[53].call(null, and) ? prim_param_types_ref[1] : and; + if(! Sx_types[53].call(null, b)) return 0; + var spec = Sx_runtime[25].call(null, prim_param_types_ref[1], name); + if(! Sx_types[53].call(null, spec)) return 0; + var + positional = Sx_runtime[25].call(null, spec, bi), + rest_type = Sx_runtime[25].call(null, spec, bj); + if(Sx_types[53].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[14].call(null, pair), + param = Sx_runtime[17].call(null, pair, bk), + p_name = Sx_runtime[14].call(null, param), + p_type = Sx_runtime[17].call(null, param, bl), + a = [0, idx, [0, Sx_runtime[24].call(null, args), 0]], + b = Sx_runtime[1].call(null, cst$2, a); + if(Sx_types[53].call(null, b)){ + var + val = Sx_runtime[17].call(null, args, idx), + c = value_matches_type_p(val, p_type), + d = [0, 1 - Sx_types[53].call(null, c)]; + if(Sx_types[53].call(null, d)){ + var + e = [0, bn, [0, [2, Sx_runtime[4].call(null, [0, val, 0])], bm]], + f = + [0, + br, + [0, + name, + [0, + bq, + [0, + p_type, + [0, + bp, + [0, p_name, [0, bo, [0, Sx_runtime[73].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[9], h], 1); + } + } + return 0; + }, + e); + } + if(Sx_types[53].call(null, rest_type)) + var + positional$0 = Sx_types[53].call(null, positional) ? positional : bA, + f = [0, Sx_runtime[24].call(null, positional$0), 0], + g = [0, Sx_runtime[24].call(null, args), f], + a = Sx_runtime[1].call(null, cst$7, g); + else + var a = rest_type; + if(! Sx_types[53].call(null, a)) return 0; + var + positional$1 = Sx_types[53].call(null, positional) ? positional : bz, + h = [0, args, [0, Sx_runtime[24].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[14].call(null, pair), + val = Sx_runtime[17].call(null, pair, bs), + a = value_matches_type_p(val, rest_type), + b = [0, 1 - Sx_types[53].call(null, a)]; + if(! Sx_types[53].call(null, b)) return 0; + var + c = [0, bu, [0, [2, Sx_runtime[4].call(null, [0, val, 0])], bt]], + d = + [0, + by, + [0, + name, + [0, + bx, + [0, + rest_type, + [0, + bw, + [0, idx, [0, bv, [0, Sx_runtime[73].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[9], f], 1); + }, + l); + return 0; + } + var + cst$9 = "\xce\xbb", + cst$8 = "+", + cst_index_of = "index-of", + bB = [0, [2, cst_rest], 0], + bC = [1, 0.], + bD = [0, [1, 1.], 0], + bE = [0, 1], + bF = [5, 0], + bG = [0, 0]; + function bind_lambda_params(params, args, local){ + var + rest_idx = Sx_runtime[1].call(null, cst_index_of, [0, params, bB]), + and = Sx_runtime[34].call(null, rest_idx); + if(Sx_types[53].call(null, and)) + var + b = [0, rest_idx, [0, Sx_runtime[24].call(null, params), 0]], + a = Sx_runtime[1].call(null, cst$2, b); + else + var a = and; + if(! Sx_types[53].call(null, a)) return bG; + var + positional = + Sx_runtime[1].call + (null, cst_slice, [0, params, [0, bC, [0, rest_idx, 0]]]), + c = Sx_runtime[1].call(null, cst$8, [0, rest_idx, bD]), + rest_name = Sx_runtime[17].call(null, params, c); + Sx_runtime[93].call + (null, + [14, + cst$9, + 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[24].call(null, args), 0]], + c = Sx_runtime[1].call(null, cst$2, b), + d = + Sx_types[53].call(null, c) + ? Sx_runtime[17].call(null, args, i) + : 0, + e = Sx_runtime[3].call(null, p); + return Sx_runtime[77].call(null, local, e, d); + } + } + return 0; + }], + positional); + var + d = [0, Sx_runtime[24].call(null, args), [0, rest_idx, 0]], + e = Sx_runtime[1].call(null, cst$7, d), + f = + Sx_types[53].call(null, e) + ? Sx_runtime[1].call(null, cst_slice, [0, args, [0, rest_idx, 0]]) + : bF, + g = Sx_runtime[3].call(null, rest_name); + Sx_runtime[77].call(null, local, g, f); + return bE; + } + var + cst_expects = " expects ", + cst_zip = "zip", + bH = [2, cst_args_got], + bI = [2, cst_expects], + bJ = [2, cst_lambda], + bK = [1, 1.]; + function call_lambda(f, args, caller_env){ + var + params = Sx_types[56].call(null, f), + a = Sx_types[58].call(null, f), + local = Sx_runtime[81].call(null, a, caller_env), + b = bind_lambda_params(params, args, local), + c = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, c)){ + var + d = [0, Sx_runtime[24].call(null, params), 0], + e = [0, Sx_runtime[24].call(null, args), d], + g = Sx_runtime[1].call(null, cst$7, e); + if(Sx_types[53].call(null, g)){ + var + h = [0, bH, [0, Sx_runtime[24].call(null, args), 0]], + i = [0, bI, [0, Sx_runtime[24].call(null, params), h]], + or = Sx_types[59].call(null, f), + or$0 = Sx_types[53].call(null, or) ? or : bJ, + 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[9], 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[17].call(null, pair, bK), + b = Sx_runtime[14].call(null, pair), + c = Sx_runtime[3].call(null, b); + Sx_runtime[77].call(null, local, c, a); + return 0; + }, + m); + var + n = [0, params, [0, Sx_runtime[24].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[77].call(null, local, a, 0); + return 0; + }, + p); + } + var q = Sx_types[57].call(null, f); + return Sx_types[40].call(null, q, local); + } + var cst_children = "children", bL = [1, 1.], bM = [2, cst_children]; + function call_component(comp, raw_args, env){ + var + parsed = parse_keyword_args(raw_args, env), + kwargs = Sx_runtime[14].call(null, parsed), + children = Sx_runtime[17].call(null, parsed, bL), + a = Sx_types[67].call(null, comp), + local = Sx_runtime[81].call(null, a, env), + b = Sx_types[65].call(null, comp), + c = Sx_runtime[5].call(null, b); + Stdlib_List[18].call + (null, + function(p){ + var + or = Sx_runtime[56].call(null, kwargs, p), + or$0 = Sx_types[53].call(null, or) ? or : 0, + a = Sx_runtime[3].call(null, p); + Sx_runtime[77].call(null, local, a, or$0); + return 0; + }, + c); + var d = Sx_types[68].call(null, comp); + if(Sx_types[53].call(null, d)){ + var e = Sx_runtime[3].call(null, bM); + Sx_runtime[77].call(null, local, e, children); + } + var f = Sx_types[66].call(null, comp); + return Sx_types[40].call(null, f, local); + } + var + cst_assoc = "assoc", + cst_i = "i", + cst_inc = "inc", + cst_skip = "skip", + bN = [5, 0], + bO = [1, 0.], + bP = [2, cst_i], + bQ = [0, 0], + bR = [2, cst_skip], + bS = [2, cst_i], + bT = [2, cst_skip], + bU = [2, cst_i], + bV = [0, 0], + bW = [2, cst_skip], + bX = [0, [2, cst_keyword], 0], + bY = [2, cst_i], + bZ = [0, 1], + b0 = [2, cst_skip], + b1 = [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, bP); + Stdlib_Hashtbl[11].call(null, d, b, bO); + var c = Sx_runtime[2].call(null, bR); + Stdlib_Hashtbl[11].call(null, d, c, bQ); + var children = [0, bN]; + Stdlib_List[26].call + (null, + function(state, arg){ + var + idx = Sx_runtime[25].call(null, state, bS), + skip = Sx_runtime[25].call(null, state, bT); + if(Sx_types[53].call(null, skip)){ + var + b = + [0, + state, + [0, + bW, + [0, + bV, + [0, bU, [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[73].call(null, arg), bX], + and = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and)) + var + d = [0, Sx_runtime[24].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$2, e); + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + f = Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), + g = + trampoline(eval_expr(Sx_runtime[17].call(null, raw_args, f), env)), + h = Sx_types[55].call(null, arg); + Sx_runtime[11].call(null, kwargs, h, g); + var + i = + [0, + state, + [0, + b0, + [0, + bZ, + [0, bY, [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[10].call(null, children[1], j); + var + k = + [0, + state, + [0, b1, [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$10 = "=>", + b2 = [0, [2, cst_list], 0], + b3 = [0, [1, 2.], 0], + b4 = [0, [1, 3.], 0], + b5 = [0, [2, cst_symbol], 0], + b6 = [1, 1.], + b7 = [0, [2, cst$10], 0], + b8 = [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[73].call(null, c), b2], + and = Sx_runtime[1].call(null, cst, a); + if(Sx_types[53].call(null, and)){ + var + b = [0, Sx_runtime[24].call(null, c), b3], + or = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else{ + var + d = [0, Sx_runtime[24].call(null, c), b4], + and$0 = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and$0)){ + var + e = Sx_runtime[17].call(null, c, b6), + f = [0, Sx_runtime[73].call(null, e), b5], + and$1 = Sx_runtime[1].call(null, cst, f); + if(Sx_types[53].call(null, and$1)) + var + g = Sx_runtime[17].call(null, c, b8), + h = [0, Sx_types[54].call(null, g), b7], + 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[53].call(null, or$0); + }, + a)]; + } + var + cst_else = "else", + b9 = [0, [2, cst_keyword], 0], + b_ = [0, [2, cst_else], 0], + b$ = [0, [2, cst_symbol], 0], + ca = [0, [2, cst_else], 0], + cb = [0, [2, ":else"], 0]; + function is_else_clause(test){ + var + a = [0, Sx_runtime[73].call(null, test), b9], + and = Sx_runtime[1].call(null, cst, a); + if(Sx_types[53].call(null, and)) + var + b = [0, Sx_types[55].call(null, test), b_], + or = Sx_runtime[1].call(null, cst, b); + else + var or = and; + if(Sx_types[53].call(null, or)) return or; + var + c = [0, Sx_runtime[73].call(null, test), b$], + and$0 = Sx_runtime[1].call(null, cst, c); + if(! Sx_types[53].call(null, and$0)) return and$0; + var + d = [0, Sx_types[54].call(null, test), ca], + or$0 = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, or$0)) return or$0; + var e = [0, Sx_types[54].call(null, test), cb]; + return Sx_runtime[1].call(null, cst, e); + } + var + cst$11 = "*", + cst$12 = "/", + cc = [1, 1.], + cd = [0, [1, 2.], 0], + ce = [5, 0], + cf = [5, 0], + cg = [0, [2, cst_list], 0], + ch = [0, [1, 2.], 0], + ci = [0, [2, cst_symbol], 0], + cj = [1, 1.], + ck = [0, [1, 1.], 0], + cl = [2, cst_begin], + cm = [0, [1, 2.], 0], + cn = [1, 0.], + co = [0, [2, cst_symbol], 0], + cp = [0, [1, 2.], 0], + cq = [0, [1, 2.], 0], + cr = [0, [1, 2.], 0], + cs = [0, [1, 2.], 0]; + function sf_named_let(args, env){ + var + b = Sx_runtime[14].call(null, args), + loop_name = Sx_types[54].call(null, b), + bindings = Sx_runtime[17].call(null, args, cc), + body = Sx_runtime[1].call(null, cst_slice, [0, args, cd]), + c = Sx_runtime[14].call(null, bindings), + d = [0, Sx_runtime[73].call(null, c), cg], + and = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and)) + var + e = Sx_runtime[14].call(null, bindings), + f = [0, Sx_runtime[24].call(null, e), ch], + a = Sx_runtime[1].call(null, cst, f); + else + var a = and; + var params = [0, ce], inits = [0, cf]; + if(Sx_types[53].call(null, a)){ + var g = Sx_runtime[5].call(null, bindings); + Stdlib_List[18].call + (null, + function(binding){ + var + b = Sx_runtime[14].call(null, binding), + c = [0, Sx_runtime[73].call(null, b), ci], + d = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, d)) + var + e = Sx_runtime[14].call(null, binding), + a = Sx_types[54].call(null, e); + else + var a = Sx_runtime[14].call(null, binding); + params[1] = Sx_runtime[10].call(null, params[1], a); + var f = Sx_runtime[17].call(null, binding, cj); + inits[1] = Sx_runtime[10].call(null, inits[1], f); + return 0; + }, + g); + } + else{ + var + o = [0, Sx_runtime[24].call(null, bindings), cm], + p = [0, cn, [0, Sx_runtime[1].call(null, cst$12, 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$11, [0, pair_idx, cp]), + c = Sx_runtime[17].call(null, bindings, b), + d = [0, Sx_runtime[73].call(null, c), co], + e = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, e)) + var + f = Sx_runtime[1].call(null, cst$11, [0, pair_idx, cq]), + g = Sx_runtime[17].call(null, bindings, f), + a = Sx_types[54].call(null, g); + else + var + k = Sx_runtime[1].call(null, cst$11, [0, pair_idx, cs]), + a = Sx_runtime[17].call(null, bindings, k); + params[1] = Sx_runtime[10].call(null, params[1], a); + var + h = [0, Sx_runtime[1].call(null, cst$11, [0, pair_idx, cr]), 0], + i = Sx_runtime[1].call(null, cst_inc, h), + j = Sx_runtime[17].call(null, bindings, i); + inits[1] = Sx_runtime[10].call(null, inits[1], j); + return 0; + }, + 0, + r); + } + var + h = [0, Sx_runtime[24].call(null, body), ck], + i = Sx_runtime[1].call(null, cst, h); + if(Sx_types[53].call(null, i)) + var loop_body = Sx_runtime[14].call(null, body); + else + var + n = Sx_types[41].call(null, cl), + loop_body = Sx_runtime[18].call(null, n, body); + var + loop_fn = Sx_types[36].call(null, params[1], loop_body, env), + j = Sx_runtime[3].call(null, loop_name); + Sx_runtime[82].call(null, loop_fn, j); + var + k = Sx_runtime[3].call(null, loop_name), + l = Sx_types[58].call(null, loop_fn); + Sx_runtime[77].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 + ct = [0, [1, 1.], 0], + cu = [0, [2, cst_symbol], 0], + cv = [0, [2, cst_list], 0], + cw = [0, [1, 3.], 0], + cx = [0, [2, cst_keyword], 0], + cy = [1, 1.], + cz = [0, [2, cst_as], 0], + cA = [1, 1.], + cB = [2, cst_begin]; + function sf_lambda(args, env){ + var + params_expr = Sx_runtime[14].call(null, args), + body_exprs = Sx_runtime[15].call(null, args), + a = [0, Sx_runtime[24].call(null, body_exprs), ct], + b = Sx_runtime[1].call(null, cst, a); + if(Sx_types[53].call(null, b)) + var body = Sx_runtime[14].call(null, body_exprs); + else + var + d = Sx_types[41].call(null, cB), + body = Sx_runtime[18].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[73].call(null, p), cu], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)) return Sx_types[54].call(null, p); + var + d = [0, Sx_runtime[73].call(null, p), cv], + and = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and)){ + var + e = [0, Sx_runtime[24].call(null, p), cw], + and$0 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$0)){ + var + f = Sx_runtime[17].call(null, p, cy), + g = [0, Sx_runtime[73].call(null, f), cx], + and$1 = Sx_runtime[1].call(null, cst, g); + if(Sx_types[53].call(null, and$1)) + var + h = Sx_runtime[17].call(null, p, cA), + i = [0, Sx_types[55].call(null, h), cz], + 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[53].call(null, a)) return p; + var j = Sx_runtime[14].call(null, p); + return Sx_types[54].call(null, j); + }, + c)]; + return Sx_types[36].call(null, param_names, body, env); + } + var + cst_current_file = "*current-file*", + cst_effect_annotations = "*effect-annotations*", + cst_effects = "effects", + cst$13 = "~", + cC = [1, 1.], + cD = [2, cst$13], + cE = [1, 1.], + cF = [1, 2.], + cG = [2, "auto"], + cH = [2, "affinity"], + cI = [2, cst_effects], + cJ = [0, [2, cst_list], 0], + cK = [0, [2, cst_symbol], 0], + cL = [2, cst_effect_annotations], + cM = [2, cst_effect_annotations], + cN = [2, cst_effect_annotations], + cO = [2, cst_current_file], + cP = [2, cst_current_file]; + function sf_defcomp(args, env){ + var + name_sym = Sx_runtime[14].call(null, args), + params_raw = Sx_runtime[17].call(null, args, cC), + body = Sx_runtime[16].call(null, args), + a = Sx_types[54].call(null, name_sym), + comp_name = Sx_runtime[125].call(null, a, cD), + parsed = parse_comp_params(params_raw), + params = Sx_runtime[14].call(null, parsed), + has_children = Sx_runtime[17].call(null, parsed, cE), + param_types = Sx_runtime[17].call(null, parsed, cF), + affinity = defcomp_kwarg(args, cH, cG), + comp = + Sx_types[37].call + (null, comp_name, params, has_children, body, env, affinity), + effects = defcomp_kwarg(args, cI, 0), + b = Sx_runtime[83].call(null, param_types), + and = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and)){ + var c = Sx_runtime[1].call(null, cst_keys, [0, param_types, 0]); + Sx_runtime[33].call(null, c); + } + var + d = Sx_runtime[83].call(null, effects), + e = [0, 1 - Sx_types[53].call(null, d)]; + if(Sx_types[53].call(null, e)){ + var + f = [0, Sx_runtime[73].call(null, effects), cJ], + g = Sx_runtime[1].call(null, cst, f); + if(Sx_types[53].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[73].call(null, e), cK], + b = Sx_runtime[1].call(null, cst, a); + return Sx_types[53].call(null, b) + ? Sx_types[54].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[75].call(null, env, cL), + effect_anns = + Sx_types[53].call(null, i) + ? Sx_runtime[76].call(null, env, cM) + : [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + j = Sx_types[54].call(null, name_sym); + Sx_runtime[11].call(null, effect_anns, j, effect_list); + var k = Sx_runtime[3].call(null, cN); + Sx_runtime[77].call(null, env, k, effect_anns); + } + var l = Sx_runtime[75].call(null, env, cO); + if(Sx_types[53].call(null, l)){ + var m = Sx_runtime[76].call(null, env, cP); + Sx_types[64].call(null, comp, m); + } + var + n = Sx_types[54].call(null, name_sym), + o = Sx_runtime[3].call(null, n); + Sx_runtime[77].call(null, env, o, comp); + return comp; + } + var + cQ = [0, [1, 1.], 0], + cR = [0, [1, 1.], 0], + cS = [1, 2.], + cT = [0, [2, cst_keyword], 0], + cU = [0, [1, 1.], 0], + cV = [0, [1, 1.], 0], + cW = [0, [2, cst_keyword], 0]; + function defcomp_kwarg(args, key, default$){ + var + a = [0, Sx_runtime[24].call(null, args), cQ], + end = Sx_runtime[1].call(null, cst$4, a), + result = [0, default$], + b = Sx_runtime[1].call(null, cst_range, [0, cS, [0, end, cR]]), + c = Sx_runtime[5].call(null, b); + Stdlib_List[18].call + (null, + function(i){ + var + b = Sx_runtime[17].call(null, args, i), + c = [0, Sx_runtime[73].call(null, b), cT], + and = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and)){ + var + d = Sx_runtime[17].call(null, args, i), + e = [0, Sx_types[55].call(null, d), [0, key, 0]], + and$0 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$0)) + var + f = [0, Sx_runtime[1].call(null, cst$8, [0, i, cU]), [0, end, 0]], + a = Sx_runtime[1].call(null, cst$2, f); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + g = Sx_runtime[1].call(null, cst$8, [0, i, cV]), + val = Sx_runtime[17].call(null, args, g), + h = [0, Sx_runtime[73].call(null, val), cW], + j = Sx_runtime[1].call(null, cst, h), + k = Sx_types[53].call(null, j) ? Sx_types[55].call(null, val) : val; + result[1] = k; + } + return 0; + }, + c); + return result[1]; + } + var + cX = [5, 0], + cY = [0, 0], + cZ = [0, 0], + c0 = [0, [2, cst_list], 0], + c1 = [0, [1, 3.], 0], + c2 = [0, [2, cst_symbol], 0], + c3 = [0, [2, cst_keyword], 0], + c4 = [1, 1.], + c5 = [0, [2, cst_as], 0], + c6 = [1, 1.], + c7 = [1, 2.], + c8 = [0, [2, cst_symbol], 0], + c9 = [0, [2, cst_symbol], 0], + c_ = [0, [2, "&key"], 0], + c$ = [0, 1], + da = [0, [2, cst_rest], 0], + db = [0, 1], + dc = [0, [2, "&children"], 0], + dd = [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, cX], + has_children = [0, cY], + in_key = [0, cZ]; + Stdlib_List[18].call + (null, + function(p){ + var + b = [0, Sx_runtime[73].call(null, p), c0], + and = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, and)){ + var + c = [0, Sx_runtime[24].call(null, p), c1], + and$0 = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and$0)){ + var + d = Sx_runtime[14].call(null, p), + e = [0, Sx_runtime[73].call(null, d), c2], + and$1 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$1)){ + var + f = Sx_runtime[17].call(null, p, c4), + g = [0, Sx_runtime[73].call(null, f), c3], + and$2 = Sx_runtime[1].call(null, cst, g); + if(Sx_types[53].call(null, and$2)) + var + h = Sx_runtime[17].call(null, p, c6), + i = [0, Sx_types[55].call(null, h), c5], + 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[53].call(null, a)){ + var + j = Sx_runtime[14].call(null, p), + name = Sx_types[54].call(null, j), + ptype = Sx_runtime[17].call(null, p, c7), + k = [0, Sx_runtime[73].call(null, ptype), c8], + l = Sx_runtime[1].call(null, cst, k), + type_val = + Sx_types[53].call(null, l) ? Sx_types[54].call(null, ptype) : ptype, + m = [0, 1 - Sx_types[53].call(null, has_children[1])]; + if(Sx_types[53].call(null, m)){ + params[1] = Sx_runtime[10].call(null, params[1], name); + Sx_runtime[11].call(null, param_types, name, type_val); + } + } + else{ + var + n = [0, Sx_runtime[73].call(null, p), c9], + o = Sx_runtime[1].call(null, cst, n); + if(Sx_types[53].call(null, o)){ + var + name$0 = Sx_types[54].call(null, p), + q = Sx_runtime[1].call(null, cst, [0, name$0, c_]); + if(Sx_types[53].call(null, q)) + in_key[1] = c$; + else{ + var r = Sx_runtime[1].call(null, cst, [0, name$0, da]); + if(Sx_types[53].call(null, r)) + has_children[1] = db; + else{ + var s = Sx_runtime[1].call(null, cst, [0, name$0, dc]); + if(Sx_types[53].call(null, s)) + has_children[1] = dd; + else if(! Sx_types[53].call(null, has_children[1])) + if(Sx_types[53].call(null, in_key[1])) + params[1] = Sx_runtime[10].call(null, params[1], name$0); + else + params[1] = Sx_runtime[10].call(null, params[1], name$0); + } + } + } + } + return 0; + }, + a); + return [5, [0, params[1], [0, has_children[1], [0, param_types, 0]]]]; + } + var + de = [1, 1.], + df = [0, [1, 2.], 0], + dg = [0, [1, 1.], 0], + dh = [2, cst$13], + di = [1, 1.], + dj = [2, cst_current_file], + dk = [2, cst_current_file], + dl = [2, cst_begin]; + function sf_defisland(args, env){ + var + name_sym = Sx_runtime[14].call(null, args), + params_raw = Sx_runtime[17].call(null, args, de), + body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, df]), + a = [0, Sx_runtime[24].call(null, body_exprs), dg], + b = Sx_runtime[1].call(null, cst, a); + if(Sx_types[53].call(null, b)) + var body = Sx_runtime[14].call(null, body_exprs); + else + var + h = Sx_types[41].call(null, dl), + body = Sx_runtime[18].call(null, h, body_exprs); + var + c = Sx_types[54].call(null, name_sym), + comp_name = Sx_runtime[125].call(null, c, dh), + parsed = parse_comp_params(params_raw), + params = Sx_runtime[14].call(null, parsed), + has_children = Sx_runtime[17].call(null, parsed, di), + island = + Sx_types[38].call(null, comp_name, params, has_children, body, env), + d = Sx_runtime[75].call(null, env, dj); + if(Sx_types[53].call(null, d)){ + var e = Sx_runtime[76].call(null, env, dk); + Sx_types[64].call(null, island, e); + } + var + f = Sx_types[54].call(null, name_sym), + g = Sx_runtime[3].call(null, f); + Sx_runtime[77].call(null, env, g, island); + return island; + } + var dm = [0, [1, 2.], 0], dn = [1, 1.]; + function defio_parse_kwargs_b(spec, remaining$1){ + var remaining = remaining$1; + for(;;){ + var + b = Sx_runtime[33].call(null, remaining), + and = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and)){ + var + c = [0, Sx_runtime[24].call(null, remaining), dm], + and$0 = Sx_runtime[1].call(null, cst$1, c); + if(Sx_types[53].call(null, and$0)) + var + d = Sx_runtime[14].call(null, remaining), + a = Sx_runtime[32].call(null, d); + else + var a = and$0; + } + else + var a = and; + if(! Sx_types[53].call(null, a)) return 0; + var + e = Sx_runtime[17].call(null, remaining, dn), + f = Sx_runtime[14].call(null, remaining), + g = Sx_types[55].call(null, f); + Sx_runtime[11].call(null, spec, g, e); + var + h = Sx_runtime[15].call(null, remaining), + remaining$0 = Sx_runtime[15].call(null, h); + remaining = remaining$0; + } + } + var dp = [2, cst_name]; + function sf_defio(args, env){ + var + name = Sx_runtime[14].call(null, args), + spec = [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + Sx_runtime[11].call(null, spec, dp, name); + defio_parse_kwargs_b(spec, Sx_runtime[15].call(null, args)); + io_register_b(name, spec); + return spec; + } + var dq = [1, 1.], dr = [1, 2.], ds = [1, 1.]; + function sf_defmacro(args, env){ + var + name_sym = Sx_runtime[14].call(null, args), + params_raw = Sx_runtime[17].call(null, args, dq), + body = Sx_runtime[17].call(null, args, dr), + parsed = parse_macro_params(params_raw), + params = Sx_runtime[14].call(null, parsed), + rest_param = Sx_runtime[17].call(null, parsed, ds), + a = Sx_types[54].call(null, name_sym), + mac = Sx_types[39].call(null, params, rest_param, body, env, a), + b = Sx_types[54].call(null, name_sym), + c = Sx_runtime[3].call(null, b); + Sx_runtime[77].call(null, env, c, mac); + return mac; + } + var + cst_in_rest = "in-rest", + dt = [5, 0], + du = [0, 0], + dv = [2, cst_in_rest], + dw = [0, [2, cst_symbol], 0], + dx = [0, [2, cst_rest], 0], + dy = [0, [2, cst_in_rest], [0, [0, 1], 0]], + dz = [2, cst_in_rest], + dA = [0, [2, cst_symbol], 0], + dB = [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, dv); + Stdlib_Hashtbl[11].call(null, d, b, du); + var params = [0, dt], rest_param = [0, 0]; + Stdlib_List[26].call + (null, + function(state, p){ + var + b = [0, Sx_runtime[73].call(null, p), dw], + and = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, and)) + var + c = [0, Sx_types[54].call(null, p), dx], + a = Sx_runtime[1].call(null, cst, c); + else + var a = and; + if(Sx_types[53].call(null, a)) + return Sx_runtime[1].call(null, cst_assoc, [0, state, dy]); + var d = Sx_runtime[25].call(null, state, dz); + if(Sx_types[53].call(null, d)){ + var + e = [0, Sx_runtime[73].call(null, p), dA], + f = Sx_runtime[1].call(null, cst, e), + g = Sx_types[53].call(null, f) ? Sx_types[54].call(null, p) : p; + rest_param[1] = g; + return state; + } + var + h = [0, Sx_runtime[73].call(null, p), dB], + i = Sx_runtime[1].call(null, cst, h), + j = Sx_types[53].call(null, i) ? Sx_types[54].call(null, p) : p; + params[1] = Sx_runtime[10].call(null, params[1], j); + return state; + }, + [6, d], + a); + return [5, [0, params[1], [0, rest_param[1], 0]]]; + } + var + dC = [0, [2, cst_list], 0], + dD = [5, 0], + dE = [0, [2, cst_symbol], 0], + dF = [0, [2, "unquote"], 0], + dG = [1, 1.], + dH = [5, 0], + dI = [0, [2, cst_list], 0], + dJ = [0, [1, 2.], 0], + dK = [0, [2, cst_symbol], 0], + dL = [0, [2, "splice-unquote"], 0], + dM = [1, 1.], + dN = [0, [2, cst_list], 0]; + function qq_expand(template, env){ + var + b = [0, Sx_runtime[73].call(null, template), dC], + c = Sx_runtime[1].call(null, cst, b), + d = [0, 1 - Sx_types[53].call(null, c)]; + if(Sx_types[53].call(null, d)) return template; + var e = Sx_runtime[33].call(null, template); + if(Sx_types[53].call(null, e)) return dD; + var + head = Sx_runtime[14].call(null, template), + f = [0, Sx_runtime[73].call(null, head), dE], + and = Sx_runtime[1].call(null, cst, f); + if(Sx_types[53].call(null, and)) + var + g = [0, Sx_types[54].call(null, head), dF], + a = Sx_runtime[1].call(null, cst, g); + else + var a = and; + if(Sx_types[53].call(null, a)) + return trampoline + (eval_expr(Sx_runtime[17].call(null, template, dG), env)); + var h = Sx_runtime[5].call(null, template); + return Stdlib_List[26].call + (null, + function(result, item){ + var + b = [0, Sx_runtime[73].call(null, item), dI], + and = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, and)){ + var + c = [0, Sx_runtime[24].call(null, item), dJ], + and$0 = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and$0)){ + var + d = Sx_runtime[14].call(null, item), + e = [0, Sx_runtime[73].call(null, d), dK], + and$1 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$1)) + var + f = Sx_runtime[14].call(null, item), + g = [0, Sx_types[54].call(null, f), dL], + 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[53].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[17].call(null, item, dM), env)), + h = [0, Sx_runtime[73].call(null, spliced), dN], + i = Sx_runtime[1].call(null, cst, h); + if(Sx_types[53].call(null, i)) + return Sx_runtime[1].call + (null, cst_concat, [0, result, [0, spliced, 0]]); + var j = Sx_runtime[83].call(null, spliced); + return Sx_types[53].call(null, j) + ? result + : Sx_runtime + [1].call + (null, + cst_concat, + [0, result, [0, [5, [0, spliced, 0]], 0]]); + }, + dH, + h); + } + var + cst_dec = "dec", + dO = [5, 0], + dP = [5, 0], + dQ = [0, [2, cst_list], 0], + dR = [0, [1, 2.], 0], + dS = [0, [2, cst_symbol], 0], + dT = [1, 1.], + dU = [1, 1.], + dV = [1, 0.], + dW = [0, [1, 2.], 0], + dX = [1, 0.], + dY = [0, [2, cst_symbol], 0], + dZ = [0, [1, 2.], 0], + d0 = [0, [1, 2.], 0], + d1 = [0, [1, 2.], 0], + d2 = [0, [1, 2.], 0]; + function sf_letrec(args, env){ + var + bindings = Sx_runtime[14].call(null, args), + body = Sx_runtime[15].call(null, args), + local = Sx_runtime[80].call(null, env), + b = Sx_runtime[14].call(null, bindings), + c = [0, Sx_runtime[73].call(null, b), dQ], + and = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, and)) + var + d = Sx_runtime[14].call(null, bindings), + e = [0, Sx_runtime[24].call(null, d), dR], + a = Sx_runtime[1].call(null, cst, e); + else + var a = and; + var names = [0, dO], val_exprs = [0, dP]; + if(Sx_types[53].call(null, a)){ + var f = Sx_runtime[5].call(null, bindings); + Stdlib_List[18].call + (null, + function(binding){ + var + a = Sx_runtime[14].call(null, binding), + b = [0, Sx_runtime[73].call(null, a), dS], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)) + var + d = Sx_runtime[14].call(null, binding), + vname = Sx_types[54].call(null, d); + else + var vname = Sx_runtime[14].call(null, binding); + names[1] = Sx_runtime[10].call(null, names[1], vname); + var e = Sx_runtime[17].call(null, binding, dT); + val_exprs[1] = Sx_runtime[10].call(null, val_exprs[1], e); + var f = Sx_runtime[3].call(null, vname); + Sx_runtime[77].call(null, local, f, 0); + return 0; + }, + f); + } + else{ + var + p = [0, Sx_runtime[24].call(null, bindings), dW], + q = [0, dX, [0, Sx_runtime[1].call(null, cst$12, 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$11, [0, pair_idx, dZ]), + b = Sx_runtime[17].call(null, bindings, a), + c = [0, Sx_runtime[73].call(null, b), dY], + d = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, d)) + var + e = Sx_runtime[1].call(null, cst$11, [0, pair_idx, d0]), + f = Sx_runtime[17].call(null, bindings, e), + vname = Sx_types[54].call(null, f); + else + var + j = Sx_runtime[1].call(null, cst$11, [0, pair_idx, d2]), + vname = Sx_runtime[17].call(null, bindings, j); + var + g = [0, Sx_runtime[1].call(null, cst$11, [0, pair_idx, d1]), 0], + h = Sx_runtime[1].call(null, cst_inc, g), + val_expr = Sx_runtime[17].call(null, bindings, h); + names[1] = Sx_runtime[10].call(null, names[1], vname); + val_exprs[1] = Sx_runtime[10].call(null, val_exprs[1], val_expr); + var i = Sx_runtime[3].call(null, vname); + return Sx_runtime[77].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[17].call(null, pair, dU), + b = Sx_runtime[14].call(null, pair), + c = Sx_runtime[3].call(null, b); + Sx_runtime[77].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[85].call(null, val); + if(Sx_types[53].call(null, a)){ + var b = Sx_runtime[5].call(null, names[1]); + Stdlib_List[18].call + (null, + function(n){ + var + a = Sx_runtime[76].call(null, local, n), + b = Sx_runtime[3].call(null, n), + c = Sx_types[58].call(null, val); + Sx_runtime[77].call(null, c, b, a); + return 0; + }, + b); + } + return 0; + }, + j); + var + k = [0, Sx_runtime[24].call(null, body), 0], + l = [0, body, [0, dV, [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[16].call(null, body); + return Sx_types[40].call(null, o, local); + } + function step_sf_letrec(args, env, kont){ + var thk = sf_letrec(args, env), a = Sx_types[75].call(null, thk); + return make_cek_state(Sx_types[74].call(null, thk), a, kont); + } + var d3 = [1, 1.], d4 = [1, 2.]; + function sf_dynamic_wind(args, env){ + var + before = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + body = trampoline(eval_expr(Sx_runtime[17].call(null, args, d3), env)), + after = trampoline(eval_expr(Sx_runtime[17].call(null, args, d4), env)); + return Sx_runtime[101].call(null, before, body, after, env); + } + var + d5 = [0, [1, 1.], 0], + d6 = [0, [1, 2.], 0], + d7 = [0, [2, cst_keyword], 0], + d8 = [0, [2, cst_value], 0], + d9 = [1, 1.], + d_ = [0, [1, 2.], 0]; + function sf_scope(args, env){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + rest = Sx_runtime[1].call(null, cst_slice, [0, args, d5]), + b = [0, Sx_runtime[24].call(null, rest), d6], + and = Sx_runtime[1].call(null, cst$1, b); + if(Sx_types[53].call(null, and)){ + var + c = Sx_runtime[14].call(null, rest), + d = [0, Sx_runtime[73].call(null, c), d7], + and$0 = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and$0)) + var + e = Sx_runtime[14].call(null, rest), + f = [0, Sx_types[55].call(null, e), d8], + a = Sx_runtime[1].call(null, cst, f); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) + var + g = trampoline(eval_expr(Sx_runtime[17].call(null, rest, d9), env)), + body_exprs = Sx_runtime[1].call(null, cst_slice, [0, rest, d_]), + val = g; + else + var body_exprs = rest, val = 0; + Sx_runtime[102].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[103].call(null, name); + return result[1]; + } + var d$ = [1, 1.], ea = [0, [1, 2.], 0]; + function sf_provide(args, env){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[17].call(null, args, d$), env)), + body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, ea]); + Sx_runtime[102].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[103].call(null, name); + return result[1]; + } + var + cst_sr_literals = "__sr-literals", + cst_sr_rules = "__sr-rules", + cst_syntax_rules_body = "__syntax-rules-body__", + eb = [0, [2, cst_syntax_rules_body], 0], + ec = [2, cst_sr_rules], + ed = [2, cst_sr_literals], + ee = [1, 1.], + ef = [1, 1.]; + function expand_macro(mac, raw_args, env){ + var + body = Sx_types[72].call(null, mac), + and = Sx_runtime[39].call(null, body); + if(Sx_types[53].call(null, and)) + var + b = [0, Sx_types[54].call(null, body), eb], + a = Sx_runtime[1].call(null, cst, b); + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + closure = Sx_types[73].call(null, mac), + c = Sx_runtime[76].call(null, closure, ec); + return syntax_rules_expand + (Sx_runtime[76].call(null, closure, ed), c, raw_args); + } + var + d = Sx_types[73].call(null, mac), + local = Sx_runtime[81].call(null, d, env), + e = Sx_types[70].call(null, mac), + f = Sx_runtime[5].call(null, e), + g = + [5, + Stdlib_List[21].call + (null, + function(i, p){var i$0 = [1, i]; return [5, [0, p, [0, i$0, 0]]];}, + f)], + h = Sx_runtime[5].call(null, g); + Stdlib_List[18].call + (null, + function(pair){ + var + b = [0, Sx_runtime[24].call(null, raw_args), 0], + c = [0, Sx_runtime[17].call(null, pair, ee), b], + d = Sx_runtime[1].call(null, cst$2, c); + if(Sx_types[53].call(null, d)) + var + e = Sx_runtime[17].call(null, pair, ef), + a = Sx_runtime[17].call(null, raw_args, e); + else + var a = 0; + var + f = Sx_runtime[14].call(null, pair), + g = Sx_runtime[3].call(null, f); + Sx_runtime[77].call(null, local, g, a); + return 0; + }, + h); + var i = Sx_types[71].call(null, mac); + if(Sx_types[53].call(null, i)){ + var + j = Sx_types[70].call(null, mac), + k = [0, raw_args, [0, Sx_runtime[24].call(null, j), 0]], + l = Sx_runtime[1].call(null, cst_slice, k), + m = Sx_types[71].call(null, mac), + n = Sx_runtime[3].call(null, m); + Sx_runtime[77].call(null, local, n, l); + } + return trampoline(eval_expr(Sx_types[72].call(null, mac), local)); + } + function cek_step_loop(state$0){ + var state = state$0; + for(;;){ + var + or = cek_terminal_p(state), + or$0 = Sx_types[53].call(null, or) ? or : cek_suspended_p(state); + if(Sx_types[53].call(null, or$0)) return state; + try{var b = cek_step(state); state = b;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Sx_types[11]) throw caml_maybe_attach_backtrace(exn, 0); + var request = exn[2], a = cek_kont(state); + state = make_cek_suspended(request, cek_env(state), a); + } + } + } + var + cst_IO_suspension_in_non_IO_co = "IO suspension in non-IO context", + eg = [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[53].call(null, a)) return cek_value(final); + var b = Sx_runtime[2].call(null, eg); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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 eh = [0, [2, cst_eval], 0]; + function cek_step(state){ + var a = [0, cek_phase(state), eh], b = Sx_runtime[1].call(null, cst, a); + return Sx_types[53].call(null, b) + ? step_eval(state) + : step_continue(state); + } + var + cst_starts_with = "starts-with?", + ei = [2, cst_number], + ej = [2, cst_string], + ek = [2, cst_boolean], + el = [2, cst_nil], + em = [2, cst_symbol], + en = [0, [2, cst$13], 0], + eo = [0, [2, "true"], 0], + ep = [0, 1], + eq = [0, [2, "false"], 0], + er = [0, 0], + es = [0, [2, cst_nil], 0], + et = [2, "Undefined symbol: "], + eu = [2, cst_keyword], + ev = [2, cst_dict], + ew = [5, 0], + ex = [2, cst_list], + ey = [5, 0]; + function step_eval(state){ + var + expr = cek_control(state), + env = cek_env(state), + kont = cek_kont(state), + match_val = Sx_runtime[73].call(null, expr); + if(caml_equal(match_val, ei)) return make_cek_value(expr, env, kont); + if(caml_equal(match_val, ej)) return make_cek_value(expr, env, kont); + if(caml_equal(match_val, ek)) return make_cek_value(expr, env, kont); + if(caml_equal(match_val, el)) return make_cek_value(0, env, kont); + if(! caml_equal(match_val, em)){ + if(caml_equal(match_val, eu)) + return make_cek_value(Sx_types[55].call(null, expr), env, kont); + if(caml_equal(match_val, ev)){ + var + ks = Sx_runtime[1].call(null, cst_keys, [0, expr, 0]), + h = Sx_runtime[33].call(null, ks); + if(Sx_types[53].call(null, h)) + return make_cek_value + ([6, Stdlib_Hashtbl[1].call(null, 0, 0)], env, kont); + var + first_key = Sx_runtime[14].call(null, ks), + i = Sx_runtime[15].call(null, ks), + j = Sx_runtime[5].call(null, i), + remaining_entries = [0, ew]; + Stdlib_List[18].call + (null, + function(k){ + var a = [5, [0, k, [0, Sx_runtime[25].call(null, expr, k), 0]]]; + remaining_entries[1] = + Sx_runtime[10].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[25].call(null, expr, first_key), env, k); + } + if(! caml_equal(match_val, ex)) return make_cek_value(expr, env, kont); + var l = Sx_runtime[33].call(null, expr); + return Sx_types[53].call(null, l) + ? make_cek_value(ey, env, kont) + : step_eval_list(expr, env, kont); + } + var + name = Sx_types[54].call(null, expr), + a = Sx_runtime[75].call(null, env, name); + if(Sx_types[53].call(null, a)) + var val = Sx_runtime[76].call(null, env, name); + else{ + var b = Sx_runtime[91].call(null, name); + if(Sx_types[53].call(null, b)) + var val = Sx_runtime[92].call(null, name); + else{ + var c = Sx_runtime[1].call(null, cst, [0, name, eo]); + if(Sx_types[53].call(null, c)) + var val = ep; + else{ + var d = Sx_runtime[1].call(null, cst, [0, name, eq]); + if(Sx_types[53].call(null, d)) + var val = er; + else{ + var e = Sx_runtime[1].call(null, cst, [0, name, es]); + if(! Sx_types[53].call(null, e)){ + var + f = [2, Sx_runtime[4].call(null, [0, et, [0, name, 0]])], + g = Sx_runtime[2].call(null, f); + throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); + } + var val = 0; + } + } + } + } + var and = Sx_runtime[83].call(null, val); + if(Sx_types[53].call(null, and)) + Sx_runtime[1].call(null, cst_starts_with, [0, name, en]); + return make_cek_value(val, env, kont); + } + var ez = [0, 0]; + function step_sf_raise(args, env, kont){ + var a = kont_push(make_raise_eval_frame(env, ez), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var + cst$14 = "_", + cst_guard_k = "__guard-k", + cst_guard_result = "__guard-result", + cst_call_cc = "call/cc", + cst_first = "first", + cst_handler_bind = "handler-bind", + cst_raise = "raise", + eA = [2, "__guard-reraise__"], + eB = + [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]], + eC = [3, cst_quote], + eD = [5, [0, [3, cst_first], [0, [3, cst_guard_result], 0]]], + eE = [3, cst], + eF = + [5, + [0, + [3, cst], + [0, + [5, [0, [3, "len"], [0, [3, cst_guard_result], 0]]], + [0, [1, 2.], 0]]]], + eG = [5, [0, [3, "list?"], [0, [3, cst_guard_result], 0]]], + eH = [3, cst_and], + eI = [3, cst_if], + eJ = [3, cst_begin], + eK = [3, cst_guard_k], + eL = [3, cst_quote], + eM = [3, cst_list], + eN = [3, cst_else], + eO = [3, cst_cond], + eP = [3, cst_guard_k], + eQ = [3, cst_fn], + eR = [5, [0, [0, 1], 0]], + eS = [5, [0, [3, cst$14], 0]], + eT = [3, cst_fn], + eU = [3, cst_handler_bind], + eV = [5, [0, [3, cst_guard_k], 0]], + eW = [3, cst_fn], + eX = [3, cst_call_cc], + eY = [3, cst_guard_result], + eZ = [3, cst_let]; + function step_sf_guard$0(counter, args, env, kont){ + var + var_clauses = Sx_runtime[14].call(null, args), + body = Sx_runtime[15].call(null, args), + var$ = Sx_runtime[14].call(null, var_clauses), + clauses = Sx_runtime[15].call(null, var_clauses), + sentinel = Sx_types[41].call(null, eA), + b = + [5, [0, [5, [0, eK, [0, Sx_runtime[18].call(null, eJ, body), 0]]], 0]], + c = + Sx_runtime[1].call + (null, + cst_append, + [0, + clauses, + [0, + [5, + [0, + [5, + [0, + eN, + [0, + [5, + [0, eM, [0, [5, [0, eL, [0, sentinel, 0]]], [0, var$, 0]]]], + 0]]], + 0]], + 0]]), + d = [5, [0, [5, [0, eP, [0, Sx_runtime[18].call(null, eO, c), 0]]], 0]], + e = Sx_runtime[18].call(null, [5, [0, var$, 0]], d), + f = [0, Sx_runtime[18].call(null, eQ, e), 0], + g = Sx_runtime[18].call(null, eS, eR), + h = [5, [0, [5, [0, Sx_runtime[18].call(null, eT, g), f]], 0]], + i = Sx_runtime[18].call(null, h, b), + j = [5, [0, Sx_runtime[18].call(null, eU, i), 0]], + k = Sx_runtime[18].call(null, eV, j), + l = [5, [0, Sx_runtime[18].call(null, eW, k), 0]], + a = + [5, + [0, + eZ, + [0, + [5, [0, [5, [0, eY, [0, Sx_runtime[18].call(null, eX, l), 0]]], 0]], + [0, + [5, + [0, + eI, + [0, + [5, + [0, + eH, + [0, + eG, + [0, + eF, + [0, + [5, + [0, eE, [0, eD, [0, [5, [0, eC, [0, sentinel, 0]]], 0]]]], + 0]]]]], + eB]]], + 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)); + } + function step_sf_callcc(args, env, kont){ + var a = kont_push(make_callcc_frame(env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + function step_sf_case(args, env, kont){ + var + a = + kont_push + (make_case_frame(0, Sx_runtime[15].call(null, args), env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var e0 = [1, 1.], e1 = [3, cst_begin]; + function step_sf_let_match(args, env, kont){ + var + pattern = Sx_runtime[14].call(null, args), + expr = Sx_runtime[17].call(null, args, e0), + a = Sx_runtime[15].call(null, args), + body = Sx_runtime[15].call(null, a); + return step_sf_match + ([5, + [0, + expr, + [0, + [5, [0, pattern, [0, Sx_runtime[18].call(null, e1, body), 0]]], + 0]]], + env, + kont); + } + var + cst_do_loop = "__do-loop", + cst_emitted = "emitted", + cst_every$0 = "every?", + cst_map_indexed = "map-indexed", + cst_peek = "peek", + cst_syntax_rules = "syntax-rules", + render_check = 0, + render_fn = 0, + e2 = [0, [2, cst_symbol], 0], + e3 = [5, 0], + e4 = [5, 0], + e5 = [0, [2, cst_symbol], 0], + e6 = [0, [2, cst_if], 0], + e7 = [0, [2, cst_when], 0], + e8 = [0, [2, cst_cond], 0], + e9 = [0, [2, cst_case], 0], + e_ = [0, [2, cst_and], 0], + e$ = [0, [2, cst_or], 0], + fa = [0, [2, cst_let], 0], + fb = [0, [2, "let*"], 0], + fc = [0, [2, cst_lambda], 0], + fd = [0, [2, cst_fn], 0], + fe = [0, [2, cst_define], 0], + ff = [0, [2, "defcomp"], 0], + fg = [0, [2, "defisland"], 0], + fh = [0, [2, "defmacro"], 0], + fi = [0, [2, "defio"], 0], + fj = [0, [2, cst_define_foreign], 0], + fk = [0, [2, "io"], 0], + fl = [0, [2, cst_begin], 0], + fm = [0, [2, "do"], 0], + fn = [1, 1.], + fo = [1, 1.], + fp = [0, [1, 2.], 0], + fq = [1, 2.], + fr = [3, cst_do_loop], + fs = [3, cst_begin], + ft = [3, cst_if], + fu = [1, 1.], + fv = [3, cst_do_loop], + fw = [3, cst_let], + fx = [3, cst_begin], + fy = [0, [2, "guard"], 0], + fz = [0, [2, cst_quote], 0], + fA = [0, [2, "quasiquote"], 0], + fB = [0, [2, "->"], 0], + fC = [0, [2, "->>"], 0], + fD = [0, [2, "|>"], 0], + fE = [0, [2, "as->"], 0], + fF = [0, [2, "set!"], 0], + fG = [0, [2, "letrec"], 0], + fH = [0, [2, cst_reset], 0], + fI = [0, [2, "shift"], 0], + fJ = [0, [2, cst_deref], 0], + fK = [0, [2, cst_scope], 0], + fL = [0, [2, cst_provide], 0], + fM = [0, [2, cst_peek], 0], + fN = [0, [2, "provide!"], 0], + fO = [0, [2, "context"], 0], + fP = [0, [2, cst_bind], 0], + fQ = [0, [2, "emit!"], 0], + fR = [0, [2, cst_emitted], 0], + fS = [0, [2, cst_handler_bind], 0], + fT = [0, [2, "restart-case"], 0], + fU = [0, [2, "signal-condition"], 0], + fV = [0, [2, "invoke-restart"], 0], + fW = [0, [2, "match"], 0], + fX = [0, [2, "let-match"], 0], + fY = [0, [2, cst_dynamic_wind], 0], + fZ = [0, [2, cst_map], 0], + f0 = [0, [2, cst_map_indexed], 0], + f1 = [0, [2, cst_filter], 0], + f2 = [0, [2, cst_reduce], 0], + f3 = [0, [2, cst_some], 0], + f4 = [0, [2, cst_every$0], 0], + f5 = [0, [2, cst_for_each], 0], + f6 = [0, [2, cst_raise], 0], + f7 = [0, [2, "raise-continuable"], 0], + f8 = [0, 1], + f9 = [0, [2, cst_call_cc], 0], + f_ = [0, [2, "call-with-current-continuation"], 0], + f$ = [0, [2, cst_perform], 0], + ga = [0, [2, "define-library"], 0], + gb = [0, [2, cst_import], 0], + gc = [0, [2, "define-record-type"], 0], + gd = [0, [2, "define-protocol"], 0], + ge = [0, [2, "implement"], 0], + gf = [0, [2, cst_parameterize], 0], + gg = [0, [2, cst_syntax_rules], 0], + gh = [0, [2, "define-syntax"], 0], + gi = [0, [2, cst_lambda], 0], + gj = [0, [2, cst_list], 0]; + function step_eval_list$0(counter, expr$1, env, kont){ + var expr = expr$1; + for(;;){ + var + head = Sx_runtime[14].call(null, expr), + args = Sx_runtime[15].call(null, expr), + c = [0, Sx_runtime[73].call(null, head), e2], + or = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else{ + var + aW = [0, Sx_runtime[73].call(null, head), gi], + or$1 = Sx_runtime[1].call(null, cst, aW); + if(Sx_types[53].call(null, or$1)) + var or$0 = or$1; + else + var + aX = [0, Sx_runtime[73].call(null, head), gj], + or$0 = Sx_runtime[1].call(null, cst, aX); + } + var d = [0, 1 - Sx_types[53].call(null, or$0)]; + if(Sx_types[53].call(null, d)){ + var e = Sx_runtime[33].call(null, expr); + if(Sx_types[53].call(null, e)) return make_cek_value(e3, env, kont); + var + f = + kont_push + (make_map_frame(0, Sx_runtime[15].call(null, expr), e4, env), kont); + return make_cek_state(Sx_runtime[14].call(null, expr), env, f); + } + var + g = [0, Sx_runtime[73].call(null, head), e5], + h = Sx_runtime[1].call(null, cst, g); + if(! Sx_types[53].call(null, h)) + return step_eval_call(head, args, env, kont); + var + match_val = Sx_types[54].call(null, head), + i = Sx_runtime[1].call(null, cst, [0, match_val, e6]); + if(Sx_types[53].call(null, i)) return step_sf_if(args, env, kont); + var j = Sx_runtime[1].call(null, cst, [0, match_val, e7]); + if(Sx_types[53].call(null, j)) return step_sf_when(args, env, kont); + var k = Sx_runtime[1].call(null, cst, [0, match_val, e8]); + if(Sx_types[53].call(null, k)) return step_sf_cond(args, env, kont); + var l = Sx_runtime[1].call(null, cst, [0, match_val, e9]); + if(Sx_types[53].call(null, l)) return step_sf_case(args, env, kont); + var m = Sx_runtime[1].call(null, cst, [0, match_val, e_]); + if(Sx_types[53].call(null, m)) return step_sf_and(args, env, kont); + var n = Sx_runtime[1].call(null, cst, [0, match_val, e$]); + if(Sx_types[53].call(null, n)) return step_sf_or(args, env, kont); + var o = Sx_runtime[1].call(null, cst, [0, match_val, fa]); + if(Sx_types[53].call(null, o)) return step_sf_let(args, env, kont); + var p = Sx_runtime[1].call(null, cst, [0, match_val, fb]); + if(Sx_types[53].call(null, p)) return step_sf_let(args, env, kont); + var q = Sx_runtime[1].call(null, cst, [0, match_val, fc]); + if(Sx_types[53].call(null, q)) return step_sf_lambda(args, env, kont); + var r = Sx_runtime[1].call(null, cst, [0, match_val, fd]); + if(Sx_types[53].call(null, r)) return step_sf_lambda(args, env, kont); + var s = Sx_runtime[1].call(null, cst, [0, match_val, fe]); + if(Sx_types[53].call(null, s)) return step_sf_define(args, env, kont); + var t = Sx_runtime[1].call(null, cst, [0, match_val, ff]); + if(Sx_types[53].call(null, t)) + return make_cek_value(sf_defcomp(args, env), env, kont); + var u = Sx_runtime[1].call(null, cst, [0, match_val, fg]); + if(Sx_types[53].call(null, u)) + return make_cek_value(sf_defisland(args, env), env, kont); + var v = Sx_runtime[1].call(null, cst, [0, match_val, fh]); + if(Sx_types[53].call(null, v)) + return make_cek_value(sf_defmacro(args, env), env, kont); + var w = Sx_runtime[1].call(null, cst, [0, match_val, fi]); + if(Sx_types[53].call(null, w)) + return make_cek_value(sf_defio(args, env), env, kont); + var x = Sx_runtime[1].call(null, cst, [0, match_val, fj]); + if(Sx_types[53].call(null, x)) + return step_sf_define_foreign(args, env, kont); + var y = Sx_runtime[1].call(null, cst, [0, match_val, fk]); + if(Sx_types[53].call(null, y)) return step_sf_io(args, env, kont); + var z = Sx_runtime[1].call(null, cst, [0, match_val, fl]); + if(Sx_types[53].call(null, z)) return step_sf_begin(args, env, kont); + var A = Sx_runtime[1].call(null, cst, [0, match_val, fm]); + if(! Sx_types[53].call(null, A)) break; + var + B = Sx_runtime[33].call(null, args), + and = [0, 1 - Sx_types[53].call(null, B)]; + if(Sx_types[53].call(null, and)){ + var + C = Sx_runtime[14].call(null, args), + and$0 = Sx_runtime[37].call(null, C); + if(Sx_types[53].call(null, and$0)){ + var + D = Sx_runtime[14].call(null, args), + E = Sx_runtime[33].call(null, D), + and$1 = [0, 1 - Sx_types[53].call(null, E)]; + if(Sx_types[53].call(null, and$1)) + var + F = Sx_runtime[14].call(null, args), + G = Sx_runtime[14].call(null, F), + a = Sx_runtime[37].call(null, G); + else + var a = and$1; + } + else + var a = and$0; + } + else + var a = and; + if(! Sx_types[53].call(null, a)) return step_sf_begin(args, env, kont); + var + bindings = Sx_runtime[14].call(null, args), + test_clause = Sx_runtime[17].call(null, args, fn), + H = Sx_runtime[15].call(null, args), + body = Sx_runtime[15].call(null, H), + I = Sx_runtime[5].call(null, bindings); + Stdlib_List[20].call + (null, function(b){return Sx_runtime[14].call(null, b);}, I); + var J = Sx_runtime[5].call(null, bindings); + Stdlib_List[20].call + (null, function(b){return Sx_runtime[17].call(null, b, fo);}, J); + var + K = Sx_runtime[5].call(null, bindings), + steps = + [5, + Stdlib_List[20].call + (null, + function(b){ + var + a = [0, Sx_runtime[24].call(null, b), fp], + c = Sx_runtime[1].call(null, cst$7, a); + return Sx_types[53].call(null, c) + ? Sx_runtime[17].call(null, b, fq) + : Sx_runtime[14].call(null, b); + }, + K)], + test = Sx_runtime[14].call(null, test_clause), + result = Sx_runtime[15].call(null, test_clause), + L = [0, body, [0, [5, [0, Sx_runtime[18].call(null, fr, steps), 0]], 0]], + M = Sx_runtime[1].call(null, cst_append, L), + N = [5, [0, Sx_runtime[18].call(null, fs, M), 0]], + O = Sx_runtime[33].call(null, result), + P = + Sx_types[53].call(null, O) ? 0 : Sx_runtime[18].call(null, fx, result), + Q = Sx_runtime[18].call(null, P, N), + R = Sx_runtime[18].call(null, test, Q), + S = [5, [0, Sx_runtime[18].call(null, ft, R), 0]], + T = Sx_runtime[5].call(null, bindings), + U = + [5, + Stdlib_List[20].call + (null, + function(b){ + var a = [0, Sx_runtime[17].call(null, b, fu), 0]; + return [5, [0, Sx_runtime[14].call(null, b), a]]; + }, + T)], + V = Sx_runtime[18].call(null, U, S), + W = Sx_runtime[18].call(null, fv, V), + expr$0 = Sx_runtime[18].call(null, fw, W); + expr = expr$0; + } + var X = Sx_runtime[1].call(null, cst, [0, match_val, fy]); + if(Sx_types[53].call(null, X)) + 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 Y = Sx_runtime[1].call(null, cst, [0, match_val, fz]); + if(Sx_types[53].call(null, Y)){ + var + Z = Sx_runtime[33].call(null, args), + _ = Sx_types[53].call(null, Z) ? 0 : Sx_runtime[14].call(null, args); + return make_cek_value(_, env, kont); + } + var $ = Sx_runtime[1].call(null, cst, [0, match_val, fA]); + if(Sx_types[53].call(null, $)) + return make_cek_value + (qq_expand(Sx_runtime[14].call(null, args), env), env, kont); + var aa = Sx_runtime[1].call(null, cst, [0, match_val, fB]); + if(Sx_types[53].call(null, aa)) + return step_sf_thread_first(args, env, kont); + var ab = Sx_runtime[1].call(null, cst, [0, match_val, fC]); + if(Sx_types[53].call(null, ab)) + return step_sf_thread_last(args, env, kont); + var ac = Sx_runtime[1].call(null, cst, [0, match_val, fD]); + if(Sx_types[53].call(null, ac)) + return step_sf_thread_last(args, env, kont); + var ad = Sx_runtime[1].call(null, cst, [0, match_val, fE]); + if(Sx_types[53].call(null, ad)) return step_sf_thread_as(args, env, kont); + var ae = Sx_runtime[1].call(null, cst, [0, match_val, fF]); + if(Sx_types[53].call(null, ae)) return step_sf_set_b(args, env, kont); + var af = Sx_runtime[1].call(null, cst, [0, match_val, fG]); + if(Sx_types[53].call(null, af)) return step_sf_letrec(args, env, kont); + var ag = Sx_runtime[1].call(null, cst, [0, match_val, fH]); + if(Sx_types[53].call(null, ag)) return step_sf_reset(args, env, kont); + var ah = Sx_runtime[1].call(null, cst, [0, match_val, fI]); + if(Sx_types[53].call(null, ah)) return step_sf_shift(args, env, kont); + var ai = Sx_runtime[1].call(null, cst, [0, match_val, fJ]); + if(Sx_types[53].call(null, ai)) return step_sf_deref(args, env, kont); + var aj = Sx_runtime[1].call(null, cst, [0, match_val, fK]); + if(Sx_types[53].call(null, aj)) return step_sf_scope(args, env, kont); + var ak = Sx_runtime[1].call(null, cst, [0, match_val, fL]); + if(Sx_types[53].call(null, ak)) return step_sf_provide(args, env, kont); + var al = Sx_runtime[1].call(null, cst, [0, match_val, fM]); + if(Sx_types[53].call(null, al)) return step_sf_peek(args, env, kont); + var am = Sx_runtime[1].call(null, cst, [0, match_val, fN]); + if(Sx_types[53].call(null, am)) return step_sf_provide_b(args, env, kont); + var an = Sx_runtime[1].call(null, cst, [0, match_val, fO]); + if(Sx_types[53].call(null, an)) return step_sf_context(args, env, kont); + var ao = Sx_runtime[1].call(null, cst, [0, match_val, fP]); + if(Sx_types[53].call(null, ao)) return step_sf_bind(args, env, kont); + var ap = Sx_runtime[1].call(null, cst, [0, match_val, fQ]); + if(Sx_types[53].call(null, ap)) return step_sf_emit(args, env, kont); + var aq = Sx_runtime[1].call(null, cst, [0, match_val, fR]); + if(Sx_types[53].call(null, aq)) return step_sf_emitted(args, env, kont); + var ar = Sx_runtime[1].call(null, cst, [0, match_val, fS]); + if(Sx_types[53].call(null, ar)) + return step_sf_handler_bind(args, env, kont); + var as = Sx_runtime[1].call(null, cst, [0, match_val, fT]); + if(Sx_types[53].call(null, as)) + return step_sf_restart_case(args, env, kont); + var at = Sx_runtime[1].call(null, cst, [0, match_val, fU]); + if(Sx_types[53].call(null, at)) return step_sf_signal(args, env, kont); + var au = Sx_runtime[1].call(null, cst, [0, match_val, fV]); + if(Sx_types[53].call(null, au)) + return step_sf_invoke_restart(args, env, kont); + var av = Sx_runtime[1].call(null, cst, [0, match_val, fW]); + if(Sx_types[53].call(null, av)) return step_sf_match(args, env, kont); + var aw = Sx_runtime[1].call(null, cst, [0, match_val, fX]); + if(Sx_types[53].call(null, aw)) return step_sf_let_match(args, env, kont); + var ax = Sx_runtime[1].call(null, cst, [0, match_val, fY]); + if(Sx_types[53].call(null, ax)) + return make_cek_value(sf_dynamic_wind(args, env), env, kont); + var ay = Sx_runtime[1].call(null, cst, [0, match_val, fZ]); + if(Sx_types[53].call(null, ay)) return step_ho_map(args, env, kont); + var az = Sx_runtime[1].call(null, cst, [0, match_val, f0]); + if(Sx_types[53].call(null, az)) + return step_ho_map_indexed(args, env, kont); + var aA = Sx_runtime[1].call(null, cst, [0, match_val, f1]); + if(Sx_types[53].call(null, aA)) return step_ho_filter(args, env, kont); + var aB = Sx_runtime[1].call(null, cst, [0, match_val, f2]); + if(Sx_types[53].call(null, aB)) return step_ho_reduce(args, env, kont); + var aC = Sx_runtime[1].call(null, cst, [0, match_val, f3]); + if(Sx_types[53].call(null, aC)) return step_ho_some(args, env, kont); + var aD = Sx_runtime[1].call(null, cst, [0, match_val, f4]); + if(Sx_types[53].call(null, aD)) return step_ho_every(args, env, kont); + var aE = Sx_runtime[1].call(null, cst, [0, match_val, f5]); + if(Sx_types[53].call(null, aE)) return step_ho_for_each(args, env, kont); + var aF = Sx_runtime[1].call(null, cst, [0, match_val, f6]); + if(Sx_types[53].call(null, aF)) return step_sf_raise(args, env, kont); + var aG = Sx_runtime[1].call(null, cst, [0, match_val, f7]); + if(Sx_types[53].call(null, aG)){ + var aH = kont_push(make_raise_eval_frame(env, f8), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, aH); + } + var aI = Sx_runtime[1].call(null, cst, [0, match_val, f9]); + if(Sx_types[53].call(null, aI)) return step_sf_callcc(args, env, kont); + var aJ = Sx_runtime[1].call(null, cst, [0, match_val, f_]); + if(Sx_types[53].call(null, aJ)) return step_sf_callcc(args, env, kont); + var aK = Sx_runtime[1].call(null, cst, [0, match_val, f$]); + if(Sx_types[53].call(null, aK)) return step_sf_perform(args, env, kont); + var aL = Sx_runtime[1].call(null, cst, [0, match_val, ga]); + if(Sx_types[53].call(null, aL)) + return step_sf_define_library(args, env, kont); + var aM = Sx_runtime[1].call(null, cst, [0, match_val, gb]); + if(Sx_types[53].call(null, aM)) return step_sf_import(args, env, kont); + var aN = Sx_runtime[1].call(null, cst, [0, match_val, gc]); + if(Sx_types[53].call(null, aN)) + return make_cek_value(sf_define_record_type(args, env), env, kont); + var aO = Sx_runtime[1].call(null, cst, [0, match_val, gd]); + if(Sx_types[53].call(null, aO)) + return make_cek_value(sf_define_protocol(args, env), env, kont); + var aP = Sx_runtime[1].call(null, cst, [0, match_val, ge]); + if(Sx_types[53].call(null, aP)) + return make_cek_value(sf_implement(args, env), env, kont); + var aQ = Sx_runtime[1].call(null, cst, [0, match_val, gf]); + if(Sx_types[53].call(null, aQ)) + return step_sf_parameterize(args, env, kont); + var aR = Sx_runtime[1].call(null, cst, [0, match_val, gg]); + if(Sx_types[53].call(null, aR)) + return make_cek_value(sf_syntax_rules(args, env), env, kont); + var aS = Sx_runtime[1].call(null, cst, [0, match_val, gh]); + if(Sx_types[53].call(null, aS)) return step_sf_define(args, env, kont); + var + aT = + Sx_runtime[1].call + (null, cst_has_key, [0, custom_special_forms, [0, match_val, 0]]); + if(Sx_types[53].call(null, aT)) + return make_cek_value + (cek_call + (Sx_runtime[25].call(null, custom_special_forms, match_val), + [5, [0, args, [0, env, 0]]]), + env, + kont); + var and$2 = Sx_runtime[75].call(null, env, match_val); + if(Sx_types[53].call(null, and$2)) + var + aU = Sx_runtime[76].call(null, env, match_val), + b = Sx_runtime[88].call(null, aU); + else + var b = and$2; + if(Sx_types[53].call(null, b)){ + var mac = Sx_runtime[76].call(null, env, match_val); + return make_cek_state(expand_macro(mac, args, env), env, kont); + } + var + aV = + Sx_types[53].call(null, render_check) + ? cek_call(render_check, [5, [0, expr, [0, env, 0]]]) + : render_check; + return Sx_types[53].call(null, aV) + ? 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 + gk = [5, 0], + gl = [0, [2, cst_provide], 0], + gm = [2, cst_value], + gn = [5, 0], + go = [5, 0], + gp = [2, cst_name], + gq = [2, cst_env]; + function kont_extract_provides(kont){ + var a = Sx_runtime[33].call(null, kont); + if(Sx_types[53].call(null, a)) return gk; + var + frame = Sx_runtime[14].call(null, kont), + rest_frames = kont_extract_provides(Sx_runtime[15].call(null, kont)), + b = [0, frame_type(frame), gl], + c = Sx_runtime[1].call(null, cst, b); + if(! Sx_types[53].call(null, c)) return rest_frames; + var + d = Sx_runtime[25].call(null, frame, gm), + e = Sx_runtime[25].call(null, frame, gp), + f = + [22, + [0, + cst_provide, + Sx_runtime[25].call(null, frame, gq), + e, + 0, + go, + 0, + 0, + gn, + d, + 0]]; + return Sx_runtime[18].call(null, f, rest_frames); + } + var + cst_contains = "contains?", + provide_batch_depth_ref = [], + provide_batch_queue_ref = [], + provide_subscribers_ref = [], + gr = [0, [1, 0.], 0], + gs = [5, [0, 0, 0]]; + function fire_provide_subscribers(name){ + var subs = Sx_runtime[25].call(null, provide_subscribers_ref[1], name); + if(Sx_types[53].call(null, subs)) + var + b = Sx_runtime[33].call(null, subs), + a = [0, 1 - Sx_types[53].call(null, b)]; + else + var a = subs; + if(! Sx_types[53].call(null, a)) return 0; + var + c = Sx_runtime[1].call(null, cst$7, [0, provide_batch_depth_ref[1], gr]); + if(Sx_types[53].call(null, c)){ + var d = Sx_runtime[5].call(null, subs); + Stdlib_List[18].call + (null, + function(sub){ + var + a = + Sx_runtime[1].call + (null, cst_contains, [0, provide_batch_queue_ref[1], [0, sub, 0]]), + b = [0, 1 - Sx_types[53].call(null, a)]; + if(Sx_types[53].call(null, b)) + provide_batch_queue_ref[1] = + Sx_runtime[10].call(null, provide_batch_queue_ref[1], sub); + return 0; + }, + d); + return 0; + } + var e = Sx_runtime[5].call(null, subs); + Stdlib_List[18].call(null, function(sub){cek_call(sub, gs); return 0;}, e); + return 0; + } + var gt = [0, [1, 1.], 0]; + function batch_begin_b(param){ + provide_batch_depth_ref[1] = + Sx_runtime[1].call(null, cst$8, [0, provide_batch_depth_ref[1], gt]); + return 0; + } + var + gu = [0, [1, 1.], 0], + gv = [0, [1, 0.], 0], + gw = [5, 0], + gx = [5, [0, 0, 0]]; + function batch_end_b(param){ + provide_batch_depth_ref[1] = + Sx_runtime[1].call(null, cst$4, [0, provide_batch_depth_ref[1], gu]); + var + a = Sx_runtime[1].call(null, cst, [0, provide_batch_depth_ref[1], gv]); + if(! Sx_types[53].call(null, a)) return 0; + var queue = provide_batch_queue_ref[1]; + provide_batch_queue_ref[1] = gw; + var b = Sx_runtime[5].call(null, queue); + Stdlib_List[18].call(null, function(sub){cek_call(sub, gx); return 0;}, b); + return 0; + } + var bind_tracking_ref = [], gy = [5, 0]; + function step_sf_bind(args, env, kont){ + var body = Sx_runtime[14].call(null, args), prev = bind_tracking_ref[1]; + bind_tracking_ref[1] = gy; + return make_cek_state + (body, env, kont_push(make_bind_frame(body, env, prev), kont)); + } + var gz = [5, 0]; + function step_sf_parameterize(args, env, kont){ + var + bindings = Sx_runtime[14].call(null, args), + body = Sx_runtime[15].call(null, args), + or = Sx_runtime[83].call(null, bindings), + or$0 = + Sx_types[53].call(null, or) ? or : Sx_runtime[33].call(null, bindings); + if(Sx_types[53].call(null, or$0)) return step_sf_begin(body, env, kont); + var + first_pair = Sx_runtime[14].call(null, bindings), + a = kont_push(make_parameterize_frame(bindings, 0, gz, body, env), kont); + return make_cek_state(Sx_runtime[14].call(null, first_pair), env, a); + } + var gA = [0, [2, cst$14], 0], gB = [1, 0.], gC = [1, 0.]; + function syntax_rules_match(pattern, form, literals){ + var and = Sx_runtime[39].call(null, pattern); + if(Sx_types[53].call(null, and)) + var + e = [0, Sx_types[54].call(null, pattern), gA], + a = Sx_runtime[1].call(null, cst, e); + else + var a = and; + if(Sx_types[53].call(null, a)) + return [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + var and$0 = Sx_runtime[39].call(null, pattern); + if(Sx_types[53].call(null, and$0)) + var + f = [0, literals, [0, Sx_types[54].call(null, pattern), 0]], + b = Sx_runtime[1].call(null, cst_contains, f); + else + var b = and$0; + if(Sx_types[53].call(null, b)){ + var and$1 = Sx_runtime[39].call(null, form); + if(Sx_types[53].call(null, and$1)) + var + g = [0, Sx_types[54].call(null, form), 0], + h = [0, Sx_types[54].call(null, pattern), g], + c = Sx_runtime[1].call(null, cst, h); + else + var c = and$1; + return Sx_types[53].call(null, c) + ? [6, Stdlib_Hashtbl[1].call(null, 0, 0)] + : 0; + } + var i = Sx_runtime[39].call(null, pattern); + if(Sx_types[53].call(null, i)){ + var + d = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + j = Sx_types[54].call(null, pattern); + Sx_runtime[11].call(null, d, j, form); + return d; + } + var + and$2 = Sx_runtime[37].call(null, pattern), + k = + Sx_types[53].call(null, and$2) + ? Sx_runtime[33].call(null, pattern) + : and$2; + if(Sx_types[53].call(null, k)){ + var + and$3 = Sx_runtime[37].call(null, form), + l = + Sx_types[53].call(null, and$3) + ? Sx_runtime[33].call(null, form) + : and$3; + return Sx_types[53].call(null, l) + ? [6, Stdlib_Hashtbl[1].call(null, 0, 0)] + : 0; + } + var + and$4 = Sx_runtime[37].call(null, pattern), + m = + Sx_types[53].call(null, and$4) + ? Sx_runtime[37].call(null, form) + : and$4; + if(Sx_types[53].call(null, m)) + return syntax_rules_match_list(pattern, gC, form, gB, literals); + var n = Sx_runtime[1].call(null, cst, [0, pattern, [0, form, 0]]); + return Sx_types[53].call(null, n) + ? [6, Stdlib_Hashtbl[1].call(null, 0, 0)] + : 0; + } + var + cst$15 = "...", + gD = [0, [1, 1.], 0], + gE = [0, [1, 1.], 0], + gF = [0, [2, cst$15], 0], + gG = [0, [1, 1.], 0], + gH = [0, [1, 2.], 0], + gI = [0, [1, 2.], 0], + gJ = [0, [1, 0.], 0], + gK = [0, 0, 0], + gL = [0, [1, 2.], 0], + gM = [0, [1, 1.], 0], + gN = [0, [1, 1.], 0]; + function syntax_rules_match_list(pattern, pi, form, fi, literals){ + var + plen = Sx_runtime[24].call(null, pattern), + flen = Sx_runtime[24].call(null, form), + and = Sx_runtime[1].call(null, cst$1, [0, pi, [0, plen, 0]]), + b = + Sx_types[53].call(null, and) + ? Sx_runtime[1].call(null, cst$1, [0, fi, [0, flen, 0]]) + : and; + if(Sx_types[53].call(null, b)) + return [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + var c = Sx_runtime[1].call(null, cst$1, [0, pi, [0, plen, 0]]); + if(Sx_types[53].call(null, c)) return 0; + var + d = [0, Sx_runtime[1].call(null, cst$8, [0, pi, gD]), [0, plen, 0]], + and$0 = Sx_runtime[1].call(null, cst$2, d); + if(Sx_types[53].call(null, and$0)){ + var + e = Sx_runtime[1].call(null, cst$8, [0, pi, gE]), + f = Sx_runtime[17].call(null, pattern, e), + and$1 = Sx_runtime[39].call(null, f); + if(Sx_types[53].call(null, and$1)) + var + g = Sx_runtime[1].call(null, cst$8, [0, pi, gG]), + h = Sx_runtime[17].call(null, pattern, g), + i = [0, Sx_types[54].call(null, h), gF], + a = Sx_runtime[1].call(null, cst, i); + else + var a = and$1; + } + else + var a = and$0; + if(Sx_types[53].call(null, a)){ + var + sub_pat = Sx_runtime[17].call(null, pattern, pi), + j = [0, plen, [0, Sx_runtime[1].call(null, cst$8, [0, pi, gH]), 0]]; + Sx_runtime[1].call(null, cst$4, j); + Sx_runtime[1].call(null, cst$4, [0, flen, [0, fi, 0]]); + var + k = [0, plen, [0, Sx_runtime[1].call(null, cst$8, [0, pi, gI]), 0]], + l = [0, Sx_runtime[1].call(null, cst$4, k), 0], + m = [0, Sx_runtime[1].call(null, cst$4, [0, flen, [0, fi, 0]]), l], + n_ellipsis = Sx_runtime[1].call(null, cst$4, m), + n = Sx_runtime[1].call(null, cst$2, [0, n_ellipsis, gJ]); + if(Sx_types[53].call(null, n)) return 0; + var + o = + [0, + form, + [0, + fi, + [0, Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]]; + Sx_runtime[1].call(null, cst_slice, o); + var + p = + [0, + form, + [0, + fi, + [0, Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]], + q = Sx_runtime[1].call(null, cst_slice, p), + r = Sx_runtime[5].call(null, q), + sub_bindings = + [5, + Stdlib_List[20].call + (null, + function(f){return syntax_rules_match(sub_pat, f, literals);}, + r)], + s = Sx_runtime[1].call(null, cst_contains, [0, sub_bindings, gK]); + if(Sx_types[53].call(null, s)) return 0; + var + t = Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), + rest_result = + syntax_rules_match_list + (pattern, + Sx_runtime[1].call(null, cst$8, [0, pi, gL]), + form, + t, + literals), + u = Sx_runtime[83].call(null, rest_result); + if(Sx_types[53].call(null, u)) return 0; + var + merged = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + v = Sx_runtime[5].call(null, sub_bindings); + Stdlib_List[18].call + (null, + function(b){ + var + a = Sx_runtime[1].call(null, cst_keys, [0, b, 0]), + c = Sx_runtime[5].call(null, a); + Stdlib_List[18].call + (null, + function(key){ + var + existing = Sx_runtime[56].call(null, merged, key), + a = Sx_runtime[83].call(null, existing); + if(Sx_types[53].call(null, a)){ + var c = [5, [0, Sx_runtime[25].call(null, b, key), 0]]; + Sx_runtime[11].call(null, merged, key, c); + } + else{ + var + d = + [0, + existing, + [0, [5, [0, Sx_runtime[25].call(null, b, key), 0]], 0]], + e = Sx_runtime[1].call(null, cst_append, d); + Sx_runtime[11].call(null, merged, key, e); + } + return 0; + }, + c); + return 0; + }, + v); + var + w = Sx_runtime[1].call(null, cst_keys, [0, rest_result, 0]), + x = Sx_runtime[5].call(null, w); + Stdlib_List[18].call + (null, + function(key){ + var a = Sx_runtime[25].call(null, rest_result, key); + Sx_runtime[11].call(null, merged, key, a); + return 0; + }, + x); + return merged; + } + var y = Sx_runtime[1].call(null, cst$1, [0, fi, [0, flen, 0]]); + if(Sx_types[53].call(null, y)) return 0; + var + z = Sx_runtime[17].call(null, form, fi), + sub_result = + syntax_rules_match(Sx_runtime[17].call(null, pattern, pi), z, literals), + A = Sx_runtime[83].call(null, sub_result); + if(Sx_types[53].call(null, A)) return 0; + var + B = Sx_runtime[1].call(null, cst$8, [0, fi, gM]), + rest_result$0 = + syntax_rules_match_list + (pattern, + Sx_runtime[1].call(null, cst$8, [0, pi, gN]), + form, + B, + literals), + C = Sx_runtime[83].call(null, rest_result$0); + if(Sx_types[53].call(null, C)) return 0; + var + D = Sx_runtime[1].call(null, cst_keys, [0, sub_result, 0]), + E = Sx_runtime[5].call(null, D); + Stdlib_List[18].call + (null, + function(key){ + var a = Sx_runtime[25].call(null, sub_result, key); + Sx_runtime[11].call(null, rest_result$0, key, a); + return 0; + }, + E); + return rest_result$0; + } + function syntax_rules_find_var(template, bindings){ + var and = Sx_runtime[39].call(null, template); + if(Sx_types[53].call(null, and)){ + var + b = [0, bindings, [0, Sx_types[54].call(null, template), 0]], + and$0 = Sx_runtime[1].call(null, cst_has_key, b); + if(Sx_types[53].call(null, and$0)) + var + c = Sx_types[54].call(null, template), + d = Sx_runtime[25].call(null, bindings, c), + a = Sx_runtime[37].call(null, d); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) return Sx_types[54].call(null, template); + var e = Sx_runtime[37].call(null, template); + if(! Sx_types[53].call(null, e)) return 0; + var f = Sx_runtime[5].call(null, template); + return Stdlib_List[26].call + (null, + function(found, t){ + var a = Sx_runtime[83].call(null, found); + return Sx_types[53].call(null, a) + ? syntax_rules_find_var(t, bindings) + : found; + }, + 0, + f); + } + var gO = [5, 0], gP = [5, 0]; + function syntax_rules_find_all_vars(template, bindings){ + var and = Sx_runtime[39].call(null, template); + if(Sx_types[53].call(null, and)){ + var + b = [0, bindings, [0, Sx_types[54].call(null, template), 0]], + and$0 = Sx_runtime[1].call(null, cst_has_key, b); + if(Sx_types[53].call(null, and$0)) + var + c = Sx_types[54].call(null, template), + d = Sx_runtime[25].call(null, bindings, c), + a = Sx_runtime[37].call(null, d); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) + return [5, [0, Sx_types[54].call(null, template), 0]]; + var e = Sx_runtime[37].call(null, template); + if(! Sx_types[53].call(null, e)) return gP; + var f = Sx_runtime[5].call(null, template); + return Stdlib_List[26].call + (null, + function(acc, t){ + var + a = [0, acc, [0, syntax_rules_find_all_vars(t, bindings), 0]]; + return Sx_runtime[1].call(null, cst_append, a); + }, + gO, + f); + } + var gQ = [1, 0.]; + function syntax_rules_instantiate(template, bindings){ + var and = Sx_runtime[39].call(null, template); + if(Sx_types[53].call(null, and)) + var + b = [0, bindings, [0, Sx_types[54].call(null, template), 0]], + a = Sx_runtime[1].call(null, cst_has_key, b); + else + var a = and; + if(Sx_types[53].call(null, a)){ + var c = Sx_types[54].call(null, template); + return Sx_runtime[25].call(null, bindings, c); + } + var + d = Sx_runtime[37].call(null, template), + e = [0, 1 - Sx_types[53].call(null, d)]; + if(Sx_types[53].call(null, e)) return template; + var f = Sx_runtime[33].call(null, template); + return Sx_types[53].call(null, f) + ? template + : syntax_rules_instantiate_list(template, gQ, bindings); + } + var + gR = [5, 0], + gS = [0, [1, 1.], 0], + gT = [0, [1, 1.], 0], + gU = [0, [2, cst$15], 0], + gV = [0, [1, 1.], 0], + gW = [0, [1, 2.], 0], + gX = [0, [1, 2.], 0], + gY = [0, [1, 1.], 0]; + function syntax_rules_instantiate_list(template, i$1, bindings){ + var i = i$1; + for(;;){ + var + a = [0, i, [0, Sx_runtime[24].call(null, template), 0]], + b = Sx_runtime[1].call(null, cst$1, a); + if(Sx_types[53].call(null, b)) return gR; + var + elem = Sx_runtime[17].call(null, template, i), + c = [0, Sx_runtime[24].call(null, template), 0], + d = [0, Sx_runtime[1].call(null, cst$8, [0, i, gS]), c], + and = Sx_runtime[1].call(null, cst$2, d); + if(Sx_types[53].call(null, and)){ + var + e = Sx_runtime[1].call(null, cst$8, [0, i, gT]), + f = Sx_runtime[17].call(null, template, e), + and$0 = Sx_runtime[39].call(null, f); + if(Sx_types[53].call(null, and$0)) + var + g = Sx_runtime[1].call(null, cst$8, [0, i, gV]), + h = Sx_runtime[17].call(null, template, g), + j = [0, Sx_types[54].call(null, h), gU], + has_ellipsis = Sx_runtime[1].call(null, cst, j); + else + var has_ellipsis = and$0; + } + else + var has_ellipsis = and; + if(! Sx_types[53].call(null, has_ellipsis)){ + var + p = + syntax_rules_instantiate_list + (template, Sx_runtime[1].call(null, cst$8, [0, i, gY]), bindings), + q = syntax_rules_instantiate(elem, bindings); + return Sx_runtime[18].call(null, q, p); + } + var + all_vars = syntax_rules_find_all_vars(elem, bindings), + k = Sx_runtime[33].call(null, all_vars); + if(! Sx_types[53].call(null, k)) break; + var i$0 = Sx_runtime[1].call(null, cst$8, [0, i, gW]); + i = i$0; + } + var + l = Sx_runtime[14].call(null, all_vars), + m = Sx_runtime[25].call(null, bindings, l), + count = Sx_runtime[24].call(null, m), + n = Sx_runtime[1].call(null, cst_range, [0, count, 0]), + o = Sx_runtime[5].call(null, n), + expanded = + [5, + Stdlib_List[20].call + (null, + function(idx){ + var + b = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + a = Sx_runtime[1].call(null, cst_keys, [0, bindings, 0]), + c = Sx_runtime[5].call(null, a); + Stdlib_List[18].call + (null, + function(key){ + var a = Sx_runtime[25].call(null, bindings, key); + Sx_runtime[11].call(null, b, key, a); + return 0; + }, + c); + var d = Sx_runtime[5].call(null, all_vars); + Stdlib_List[18].call + (null, + function(var_name){ + var + a = Sx_runtime[25].call(null, bindings, var_name), + c = Sx_runtime[17].call(null, a, idx); + Sx_runtime[11].call(null, b, var_name, c); + return 0; + }, + d); + return syntax_rules_instantiate(elem, b); + }, + o)], + rest_result = + syntax_rules_instantiate_list + (template, Sx_runtime[1].call(null, cst$8, [0, i, gX]), bindings); + return Sx_runtime[1].call + (null, cst_append, [0, expanded, [0, rest_result, 0]]); + } + var gZ = [2, cst$14]; + function syntax_rules_expand(literals, rules, form){ + var + a = Sx_types[41].call(null, gZ), + full_form = Sx_runtime[18].call(null, a, form); + return syntax_rules_try_rules(literals, rules, full_form); + } + var g0 = [2, "syntax-rules: no pattern matched for "], g1 = [1, 1.]; + function syntax_rules_try_rules(literals, rules$1, full_form){ + var rules = rules$1; + for(;;){ + var a = Sx_runtime[33].call(null, rules); + if(Sx_types[53].call(null, a)){ + var + b = [0, g0, [0, Sx_runtime[68].call(null, full_form), 0]], + c = [2, Sx_runtime[4].call(null, b)], + d = Sx_runtime[2].call(null, c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + var + rule = Sx_runtime[14].call(null, rules), + pattern = Sx_runtime[14].call(null, rule), + template = Sx_runtime[17].call(null, rule, g1), + bindings = syntax_rules_match(pattern, full_form, literals), + e = Sx_runtime[83].call(null, bindings), + f = [0, 1 - Sx_types[53].call(null, e)]; + if(Sx_types[53].call(null, f)) + return syntax_rules_instantiate(template, bindings); + var rules$0 = Sx_runtime[15].call(null, rules); + rules = rules$0; + } + } + var + g2 = [2, cst_sr_literals], + g3 = [2, cst_sr_rules], + g4 = [2, cst_syntax_rules], + g5 = [3, cst_syntax_rules_body], + g6 = [2, "__sr-form"], + g7 = [5, 0], + g8 = [5, 0]; + function sf_syntax_rules(args, env){ + var a = Sx_runtime[14].call(null, args), b = Sx_runtime[37].call(null, a); + if(Sx_types[53].call(null, b)) + var + c = Sx_runtime[14].call(null, args), + d = Sx_runtime[5].call(null, c), + literals = + [5, + Stdlib_List[20].call + (null, + function(s){ + var a = Sx_runtime[39].call(null, s); + return Sx_types[53].call(null, a) + ? Sx_types[54].call(null, s) + : [2, Sx_runtime[4].call(null, [0, s, 0])]; + }, + d)]; + else + var literals = g8; + var + rules = Sx_runtime[15].call(null, args), + closure = Sx_runtime[80].call(null, env), + e = Sx_runtime[3].call(null, g2); + Sx_runtime[77].call(null, closure, e, literals); + var f = Sx_runtime[3].call(null, g3); + Sx_runtime[77].call(null, closure, f, rules); + return Sx_types[39].call(null, g7, g6, g5, closure, g4); + } + var + g9 = [5, 0], + g_ = [5, 0], + g$ = [0, [2, "export"], 0], + ha = [0, [2, cst_import], 0], + hb = [0, [2, cst_begin], 0]; + function step_sf_define_library(args, env, kont){ + var + lib_spec = Sx_runtime[14].call(null, args), + decls = Sx_runtime[15].call(null, args), + lib_env = Sx_runtime[80].call(null, env), + a = Sx_runtime[5].call(null, decls), + exports = [0, g9], + body_forms = [0, g_]; + Stdlib_List[18].call + (null, + function(decl){ + var and = Sx_runtime[37].call(null, decl); + if(Sx_types[53].call(null, and)){ + var + b = Sx_runtime[33].call(null, decl), + and$0 = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and$0)) + var + c = Sx_runtime[14].call(null, decl), + a = Sx_runtime[39].call(null, c); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + d = Sx_runtime[14].call(null, decl), + kind = Sx_types[54].call(null, d), + e = Sx_runtime[1].call(null, cst, [0, kind, g$]); + if(Sx_types[53].call(null, e)){ + var + f = Sx_runtime[15].call(null, decl), + g = Sx_runtime[5].call(null, f), + h = + [0, + [5, + Stdlib_List[20].call + (null, + function(s){ + var a = Sx_runtime[39].call(null, s); + return Sx_types[53].call(null, a) + ? Sx_types[54].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, ha]); + if(Sx_types[53].call(null, i)){ + var + j = Sx_runtime[15].call(null, decl), + k = Sx_runtime[5].call(null, j); + Stdlib_List[18].call + (null, + function(import_set){ + bind_import_set(import_set, lib_env); + return 0; + }, + k); + } + else{ + var l = Sx_runtime[1].call(null, cst, [0, kind, hb]); + if(Sx_types[53].call(null, l)){ + var m = [0, Sx_runtime[15].call(null, decl), 0]; + body_forms[1] = + Sx_runtime[1].call(null, cst_append, [0, body_forms[1], m]); + } + } + } + } + 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[75].call(null, lib_env, name); + if(Sx_types[53].call(null, a)){ + var b = Sx_runtime[76].call(null, lib_env, name); + Sx_runtime[11].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", + hc = [0, [2, cst_only], 0], + hd = [1, 1.], + he = [0, [2, cst_only], 0], + hf = [0, [2, cst_prefix], 0], + hg = [1, 2.], + hh = [0, [2, cst_except], 0], + hi = [0, [2, cst_prefix], 0], + hj = [0, [2, cst_rename], 0]; + function bind_import_set(import_set, env){ + var and = Sx_runtime[37].call(null, import_set); + if(Sx_types[53].call(null, and)){ + var + b = Sx_runtime[33].call(null, import_set), + and$0 = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and$0)) + var + c = Sx_runtime[14].call(null, import_set), + a = Sx_runtime[39].call(null, c); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) + var + d = Sx_runtime[14].call(null, import_set), + head = Sx_types[54].call(null, d); + else + var head = 0; + var or = Sx_runtime[1].call(null, cst, [0, head, hc]); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else{ + var or$1 = Sx_runtime[1].call(null, cst, [0, head, hh]); + if(Sx_types[53].call(null, or$1)) + var or$0 = or$1; + else + var + or$2 = Sx_runtime[1].call(null, cst, [0, head, hi]), + or$0 = + Sx_types[53].call(null, or$2) + ? or$2 + : Sx_runtime[1].call(null, cst, [0, head, hj]); + } + var + lib_spec = + Sx_types[53].call(null, or$0) + ? Sx_runtime[17].call(null, import_set, hd) + : import_set, + exports = library_exports(lib_spec), + e = Sx_runtime[1].call(null, cst, [0, head, he]); + if(Sx_types[53].call(null, e)){ + var + f = Sx_runtime[15].call(null, import_set), + g = Sx_runtime[15].call(null, f), + h = Sx_runtime[5].call(null, g); + Stdlib_List[18].call + (null, + function(s){ + var + a = Sx_runtime[39].call(null, s), + id = + Sx_types[53].call(null, a) + ? Sx_types[54].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[53].call(null, b)){ + var + c = Sx_runtime[25].call(null, exports, id), + d = Sx_runtime[3].call(null, id); + Sx_runtime[77].call(null, env, d, c); + } + return 0; + }, + h); + return 0; + } + var i = Sx_runtime[1].call(null, cst, [0, head, hf]); + if(Sx_types[53].call(null, i)){ + var + j = [0, Sx_runtime[17].call(null, import_set, hg), 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[25].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[77].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[25].call(null, exports, key), + b = Sx_runtime[3].call(null, key); + Sx_runtime[77].call(null, env, b, a); + return 0; + }, + n); + return 0; + } + var + hk = [0, [2, cst_only], 0], + hl = [1, 1.], + hm = [2, cst_import], + hn = [0, [2, cst_except], 0], + ho = [0, [2, cst_prefix], 0], + hp = [0, [2, cst_rename], 0]; + function step_sf_import(args$0, env, kont){ + var args = args$0; + for(;;){ + var b = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, b)) return make_cek_value(0, env, kont); + var + import_set = Sx_runtime[14].call(null, args), + rest_sets = Sx_runtime[15].call(null, args), + and = Sx_runtime[37].call(null, import_set); + if(Sx_types[53].call(null, and)){ + var + c = Sx_runtime[33].call(null, import_set), + and$0 = [0, 1 - Sx_types[53].call(null, c)]; + if(Sx_types[53].call(null, and$0)) + var + e = Sx_runtime[14].call(null, import_set), + a = Sx_runtime[39].call(null, e); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) + var + f = Sx_runtime[14].call(null, import_set), + head = Sx_types[54].call(null, f); + else + var head = 0; + var or = Sx_runtime[1].call(null, cst, [0, head, hk]); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else{ + var or$1 = Sx_runtime[1].call(null, cst, [0, head, hn]); + if(Sx_types[53].call(null, or$1)) + var or$0 = or$1; + else + var + or$2 = Sx_runtime[1].call(null, cst, [0, head, ho]), + or$0 = + Sx_types[53].call(null, or$2) + ? or$2 + : Sx_runtime[1].call(null, cst, [0, head, hp]); + } + var + lib_spec = + Sx_types[53].call(null, or$0) + ? Sx_runtime[17].call(null, import_set, hl) + : import_set, + g = library_loaded_p(lib_spec); + if(! Sx_types[53].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, hm); + return make_cek_suspended([6, d], env, i); + } + bind_import_set(import_set, env); + var h = Sx_runtime[33].call(null, rest_sets); + if(Sx_types[53].call(null, h)) return make_cek_value(0, env, kont); + args = rest_sets; + } + } + var hq = [2, "perform requires an IO request argument"]; + function step_sf_perform(args, env, kont){ + var a = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, a)){ + var b = Sx_runtime[2].call(null, hq); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var c = kont_push(make_perform_frame(env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, c); + } + var + hr = [1, 1.], + hs = [1, 2.], + ht = [0, [1, 3.], 0], + hu = [0, [2, cst$2], 0], + hv = [0, [2, cst$7], 0], + hw = [0, [1, 1.], 0], + hx = [1, 1.], + hy = [1, 1.], + hz = [0, [1, 3.], 0], + hA = [1, 2.]; + function sf_define_record_type(args, env){ + var + type_sym = Sx_runtime[14].call(null, args), + ctor_spec = Sx_runtime[17].call(null, args, hr), + pred_sym = Sx_runtime[17].call(null, args, hs), + field_specs = Sx_runtime[1].call(null, cst_slice, [0, args, ht]), + raw_name = Sx_types[54].call(null, type_sym), + and = Sx_runtime[1].call(null, cst_starts_with, [0, raw_name, hu]), + a = + Sx_types[53].call(null, and) + ? Sx_runtime[1].call(null, cst_ends_with, [0, raw_name, hv]) + : and; + if(Sx_types[53].call(null, a)) + var + b = [0, Sx_runtime[24].call(null, raw_name), hw], + c = [0, raw_name, [0, hx, [0, Sx_runtime[1].call(null, cst$4, b), 0]]], + type_name = Sx_runtime[1].call(null, cst_slice, c); + else + var type_name = raw_name; + var + d = Sx_runtime[14].call(null, ctor_spec), + ctor_name = Sx_types[54].call(null, d), + e = Sx_runtime[15].call(null, ctor_spec), + f = Sx_runtime[5].call(null, e), + ctor_params = + [5, + Stdlib_List[20].call + (null, function(s){return Sx_types[54].call(null, s);}, f)], + pred_name = Sx_types[54].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[14].call(null, fs); + return Sx_types[54].call(null, a); + }, + g)], + rtd_uid = Sx_types[77].call(null, type_name, field_names, ctor_params), + h = Sx_types[83].call(null, rtd_uid), + i = Sx_runtime[3].call(null, ctor_name); + Sx_runtime[77].call(null, env, i, h); + var + j = Sx_types[84].call(null, rtd_uid), + k = Sx_runtime[3].call(null, pred_name); + Sx_runtime[77].call(null, env, k, j); + Sx_runtime[93].call + (null, + [14, + cst$9, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + fs = a[1], + idx = args[1], + b = Sx_runtime[17].call(null, fs, hy), + accessor_name = Sx_types[54].call(null, b), + c = Sx_types[85].call(null, idx), + d = Sx_runtime[3].call(null, accessor_name); + Sx_runtime[77].call(null, env, d, c); + var + e = [0, Sx_runtime[24].call(null, fs), hz], + f = Sx_runtime[1].call(null, cst$1, e); + if(! Sx_types[53].call(null, f)) return 0; + var + g = Sx_runtime[17].call(null, fs, hA), + mutator_name = Sx_types[54].call(null, g), + h = Sx_types[86].call(null, idx), + i = Sx_runtime[3].call(null, mutator_name); + return Sx_runtime[77].call(null, env, i, h); + } + } + return 0; + }], + field_specs); + return 0; + } + var + cst_protocol_registry = "*protocol-registry*", + cst_impl = "_impl", + cst_arity = "arity", + cst_get = "get", + cst_impls = "impls", + cst_methods = "methods", + hB = [2, cst_protocol_registry], + hC = [2, "satisfies?"], + hD = [3, "type-of"], + hE = [0, [2, cst_impls], 0], + hF = [3, cst_protocol_registry], + hG = [3, cst_get], + hH = [3, cst_get], + hI = [3, cst_get], + hJ = [3, cst_get], + hK = [3, cst_impl], + hL = [0, [2, ": not implemented for this type"], 0], + hM = [2, cst$0], + hN = [3, "error"], + hO = [5, [0, [3, "nil?"], [0, [3, cst_impl], 0]]], + hP = [3, cst_if], + hQ = [3, cst_impl], + hR = [3, cst_let], + hS = [3, cst_fn]; + function sf_define_protocol(args, env){ + var + a = Sx_runtime[14].call(null, args), + proto_name = Sx_types[54].call(null, a), + method_specs = Sx_runtime[15].call(null, args), + b = Sx_runtime[3].call(null, hB); + Sx_runtime[77].call(null, env, b, protocol_registry); + var c = Sx_runtime[3].call(null, hC); + Sx_runtime[77].call + (null, + env, + c, + [14, + cst$9, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var val = a[1], pname = args[1]; + return satisfies_p(pname, val); + } + } + return 0; + }]); + var + d = Stdlib_Hashtbl[1].call(null, 0, 3), + e = [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + Stdlib_Hashtbl[11].call(null, d, cst_impls, e); + var + f = Sx_runtime[5].call(null, method_specs), + g = + [5, + Stdlib_List[20].call + (null, + function(spec){ + var + d = Stdlib_Hashtbl[1].call(null, 0, 2), + a = Sx_runtime[24].call(null, spec); + Stdlib_Hashtbl[11].call(null, d, cst_arity, a); + var + b = Sx_runtime[14].call(null, spec), + c = Sx_types[54].call(null, b); + Stdlib_Hashtbl[11].call(null, d, cst_name, c); + return [6, d]; + }, + f)]; + Stdlib_Hashtbl[11].call(null, d, cst_methods, g); + Stdlib_Hashtbl[11].call(null, d, cst_name, proto_name); + Sx_runtime[11].call(null, protocol_registry, proto_name, [6, d]); + var h = Sx_runtime[5].call(null, method_specs); + Stdlib_List[18].call + (null, + function(spec){ + var + a = Sx_runtime[14].call(null, spec), + method_name = Sx_types[54].call(null, a), + params = Sx_runtime[15].call(null, spec), + self_sym = Sx_runtime[14].call(null, params), + b = [0, Sx_runtime[18].call(null, hK, params), 0], + c = + eval_expr + ([5, + [0, + hS, + [0, + params, + [0, + [5, + [0, + hR, + [0, + [5, + [0, + [5, + [0, + hQ, + [0, + [5, + [0, + hJ, + [0, + [5, + [0, + hI, + [0, + [5, + [0, hH, [0, [5, [0, hG, [0, hF, [0, proto_name, 0]]]], hE]]], + [0, [5, [0, hD, [0, self_sym, 0]]], 0]]]], + [0, method_name, 0]]]], + 0]]], + 0]], + [0, + [5, + [0, + hP, + [0, + hO, + [0, + [5, + [0, + hN, + [0, + [2, + Sx_runtime[4].call + (null, [0, proto_name, [0, hM, [0, method_name, hL]]])], + 0]]], + b]]]], + 0]]]], + 0]]]], + env), + d = Sx_runtime[3].call(null, method_name); + Sx_runtime[77].call(null, env, d, c); + return 0; + }, + h); + return 0; + } + var + hT = [1, 1.], + hU = [0, [1, 1.], 0], + hV = [1, 1.], + hW = [2, "Unknown protocol: "], + hX = [2, cst_impls], + hY = [2, cst_methods], + hZ = [2, cst_name], + h0 = [2, " in protocol "], + h1 = [2, "Unknown method "], + h2 = [2, cst_arity], + h3 = [1, 1.], + h4 = [0, [1, 1.], 0], + h5 = [3, cst_fn], + h6 = [3, cst_begin]; + function sf_implement(args, env){ + var + a = Sx_runtime[14].call(null, args), + proto_name = Sx_types[54].call(null, a), + b = Sx_runtime[17].call(null, args, hT), + raw_type_name = Sx_types[54].call(null, b), + c = [0, Sx_runtime[24].call(null, raw_type_name), hU], + d = + [0, raw_type_name, [0, hV, [0, Sx_runtime[1].call(null, cst$4, c), 0]]], + type_name = Sx_runtime[1].call(null, cst_slice, d), + e = Sx_runtime[15].call(null, args), + method_defs = Sx_runtime[15].call(null, e), + proto = Sx_runtime[25].call(null, protocol_registry, proto_name), + f = Sx_runtime[83].call(null, proto); + if(Sx_types[53].call(null, f)){ + var + g = [2, Sx_runtime[4].call(null, [0, hW, [0, proto_name, 0]])], + h = Sx_runtime[2].call(null, g); + throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); + } + var + impls = Sx_runtime[25].call(null, proto, hX), + or = Sx_runtime[25].call(null, impls, type_name), + type_impls = + Sx_types[53].call(null, or) + ? or + : [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + i = Sx_runtime[5].call(null, method_defs); + Stdlib_List[18].call + (null, + function(method_def){ + var + a = Sx_runtime[14].call(null, method_def), + mname = Sx_types[54].call(null, a), + b = Sx_runtime[25].call(null, proto, hY), + c = Sx_runtime[5].call(null, b), + d = + [5, + Stdlib_List[44].call + (null, + function(m){ + var + a = [0, Sx_runtime[25].call(null, m, hZ), [0, mname, 0]], + b = Sx_runtime[1].call(null, cst, a); + return Sx_types[53].call(null, b); + }, + c)], + proto_method = Sx_runtime[14].call(null, d), + e = Sx_runtime[83].call(null, proto_method); + if(Sx_types[53].call(null, e)){ + var + f = + [2, + Sx_runtime[4].call + (null, [0, h1, [0, mname, [0, h0, [0, proto_name, 0]]]])], + g = Sx_runtime[2].call(null, f); + throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); + } + var + arity = Sx_runtime[25].call(null, proto_method, h2), + params = + Sx_runtime[1].call + (null, cst_slice, [0, method_def, [0, h3, [0, arity, 0]]]), + h = [0, Sx_runtime[1].call(null, cst$8, [0, arity, h4]), 0], + i = [0, Sx_runtime[24].call(null, method_def), h], + j = Sx_runtime[1].call(null, cst, i); + if(Sx_types[53].call(null, j)) + var body = Sx_runtime[17].call(null, method_def, arity); + else + var + l = + Sx_runtime[1].call(null, cst_slice, [0, method_def, [0, arity, 0]]), + body = Sx_runtime[18].call(null, h6, l); + var k = eval_expr([5, [0, h5, [0, params, [0, body, 0]]]], env); + Sx_runtime[11].call(null, type_impls, mname, k); + return 0; + }, + i); + Sx_runtime[11].call(null, impls, type_name, type_impls); + return 0; + } + var h7 = [0, 0], h8 = [0, 0], h9 = [2, cst_impls]; + function satisfies_p(proto_name, value){ + var + a = Sx_types[82].call(null, value), + b = [0, 1 - Sx_types[53].call(null, a)]; + if(Sx_types[53].call(null, b)) return h7; + var + c = Sx_runtime[39].call(null, proto_name), + d = + Sx_types[53].call(null, c) + ? Sx_types[54].call(null, proto_name) + : proto_name, + proto = Sx_runtime[25].call(null, protocol_registry, d), + e = Sx_runtime[83].call(null, proto); + if(Sx_types[53].call(null, e)) return h8; + var + f = Sx_runtime[73].call(null, value), + g = Sx_runtime[25].call(null, proto, h9), + h = Sx_runtime[25].call(null, g, f), + i = Sx_runtime[83].call(null, h); + return [0, 1 - Sx_types[53].call(null, i)]; + } + var + warnings = [5, 0], + h_ = [0, [0, 1], 0], + h$ = [0, [0, 0], 0], + ia = [0, [2, cst_else], 0], + ib = [0, [0, 1], 0], + ic = [0, [0, 0], 0], + id = + [0, + [5, + [0, + [2, "match may be non-exhaustive (no wildcard or :else pattern)"], + 0]], + 0], + ie = [2, "match on boolean missing false case"], + ig = [2, "match on boolean missing true case"]; + function check_match_exhaustiveness(clauses){ + var + b = Sx_runtime[5].call(null, clauses), + patterns = + [5, + Stdlib_List[20].call + (null, function(c){return Sx_runtime[14].call(null, c);}, b)], + c = Sx_runtime[5].call(null, patterns), + has_wildcard = + [0, + Stdlib_List[34].call + (null, + function(p){ + var and = Sx_runtime[39].call(null, p); + if(Sx_types[53].call(null, and)){ + var + b = Sx_runtime[1].call(null, cst, [0, p, h_]), + and$0 = [0, 1 - Sx_types[53].call(null, b)]; + if(Sx_types[53].call(null, and$0)) + var + c = Sx_runtime[1].call(null, cst, [0, p, h$]), + a = [0, 1 - Sx_types[53].call(null, c)]; + else + var a = and$0; + } + else + var a = and; + return Sx_types[53].call(null, a); + }, + c)], + d = Sx_runtime[5].call(null, patterns), + has_else = + [0, + Stdlib_List[34].call + (null, + function(p){ + var a = Sx_runtime[1].call(null, cst, [0, p, ia]); + return Sx_types[53].call(null, a); + }, + d)], + e = Sx_runtime[5].call(null, patterns), + has_true = + [0, + Stdlib_List[34].call + (null, + function(p){ + var a = Sx_runtime[1].call(null, cst, [0, p, ib]); + return Sx_types[53].call(null, a); + }, + e)], + f = Sx_runtime[5].call(null, patterns), + has_false = + [0, + Stdlib_List[34].call + (null, + function(p){ + var a = Sx_runtime[1].call(null, cst, [0, p, ic]); + return Sx_types[53].call(null, a); + }, + f)], + and = [0, 1 - Sx_types[53].call(null, has_wildcard)], + g = + Sx_types[53].call(null, and) + ? [0, 1 - Sx_types[53].call(null, has_else)] + : and, + warnings$0 = + Sx_types[53].call(null, g) + ? Sx_runtime[1].call(null, cst_append, [0, warnings, id]) + : warnings, + and$0 = Sx_types[53].call(null, has_true) ? has_true : has_false; + if(Sx_types[53].call(null, and$0)){ + var + has_false$0 = Sx_types[53].call(null, has_true) ? has_false : has_true, + and$1 = [0, 1 - Sx_types[53].call(null, has_false$0)]; + if(Sx_types[53].call(null, and$1)) + var + and$2 = [0, 1 - Sx_types[53].call(null, has_wildcard)], + a = + Sx_types[53].call(null, and$2) + ? [0, 1 - Sx_types[53].call(null, has_else)] + : and$2; + else + var a = and$1; + } + else + var a = and$0; + if(Sx_types[53].call(null, a)) + var + h = Sx_types[53].call(null, has_true) ? ie : ig, + warnings$1 = + Sx_runtime[1].call + (null, cst_append, [0, warnings$0, [0, [5, [0, h, 0]], 0]]); + else + var warnings$1 = warnings$0; + return warnings$1; + } + var ih = [1, 1.]; + function match_find_clause(val, clauses$1, env){ + var clauses = clauses$1; + for(;;){ + var a = Sx_runtime[33].call(null, clauses); + if(Sx_types[53].call(null, a)) return 0; + var + clause = Sx_runtime[14].call(null, clauses), + pattern = Sx_runtime[14].call(null, clause), + body = Sx_runtime[17].call(null, clause, ih), + local = Sx_runtime[80].call(null, env), + b = match_pattern(pattern, val, local); + if(Sx_types[53].call(null, b)) return [5, [0, local, [0, body, 0]]]; + var clauses$0 = Sx_runtime[15].call(null, clauses); + clauses = clauses$0; + } + } + var + ii = [0, [3, cst$14], 0], + ij = [0, 1], + ik = [0, [1, 2.], 0], + il = [0, [3, cst$3], 0], + im = [1, 1.], + io = [0, [3, cst_quote], 0], + ip = [1, 1.], + iq = [0, 1], + ir = [0, [3, cst_rest], 0], + is = [0, [3, cst_rest], 0], + it = [1, 0.], + iu = [1, 0.], + iv = [1, 1.], + iw = [0, [1, 1.], 0], + ix = [0, 1], + iy = [0, 0], + iz = [1, 1.]; + function match_pattern(pattern, value, env){ + var d = Sx_runtime[1].call(null, cst, [0, pattern, ii]); + if(Sx_types[53].call(null, d)) return ij; + var and = Sx_runtime[37].call(null, pattern); + if(Sx_types[53].call(null, and)){ + var + e = [0, Sx_runtime[24].call(null, pattern), ik], + and$0 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$0)) + var + f = [0, Sx_runtime[14].call(null, pattern), il], + a = Sx_runtime[1].call(null, cst, f); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)){ + var pred = eval_expr(Sx_runtime[17].call(null, pattern, im), env); + return cek_call(pred, [5, [0, value, 0]]); + } + var and$1 = Sx_runtime[37].call(null, pattern); + if(Sx_types[53].call(null, and$1)){ + var + g = Sx_runtime[33].call(null, pattern), + and$2 = [0, 1 - Sx_types[53].call(null, g)]; + if(Sx_types[53].call(null, and$2)) + var + h = [0, Sx_runtime[14].call(null, pattern), io], + b = Sx_runtime[1].call(null, cst, h); + else + var b = and$2; + } + else + var b = and$1; + if(Sx_types[53].call(null, b)){ + var i = [0, value, [0, Sx_runtime[17].call(null, pattern, ip), 0]]; + return Sx_runtime[1].call(null, cst, i); + } + var j = Sx_runtime[39].call(null, pattern); + if(Sx_types[53].call(null, j)){ + var + k = Sx_types[54].call(null, pattern), + l = Sx_runtime[3].call(null, k); + Sx_runtime[77].call(null, env, l, value); + return iq; + } + var + and$3 = Sx_runtime[38].call(null, pattern), + m = + Sx_types[53].call(null, and$3) + ? Sx_runtime[38].call(null, value) + : and$3; + if(Sx_types[53].call(null, m)){ + var + n = Sx_runtime[1].call(null, cst_keys, [0, pattern, 0]), + o = Sx_runtime[5].call(null, n); + return [0, + Stdlib_List[33].call + (null, + function(k){ + var + a = Sx_runtime[25].call(null, value, k), + b = + match_pattern(Sx_runtime[25].call(null, pattern, k), a, env); + return Sx_types[53].call(null, b); + }, + o)]; + } + var and$4 = Sx_runtime[37].call(null, pattern); + if(Sx_types[53].call(null, and$4)) + var + and$5 = Sx_runtime[37].call(null, value), + c = + Sx_types[53].call(null, and$5) + ? Sx_runtime[1].call(null, cst_contains, [0, pattern, ir]) + : and$5; + else + var c = and$4; + if(Sx_types[53].call(null, c)){ + var + rest_idx = Sx_runtime[1].call(null, cst_index_of, [0, pattern, is]), + p = [0, Sx_runtime[24].call(null, value), [0, rest_idx, 0]], + and$6 = Sx_runtime[1].call(null, cst$1, p); + if(! Sx_types[53].call(null, and$6)) return and$6; + var + q = + [0, + Sx_runtime[1].call + (null, cst_slice, [0, value, [0, it, [0, rest_idx, 0]]]), + 0], + r = + [0, + Sx_runtime[1].call + (null, cst_slice, [0, pattern, [0, iu, [0, rest_idx, 0]]]), + q], + s = Sx_runtime[1].call(null, cst_zip, r), + t = Sx_runtime[5].call(null, s), + and$7 = + [0, + Stdlib_List[33].call + (null, + function(pair){ + var + a = Sx_runtime[17].call(null, pair, iv), + b = match_pattern(Sx_runtime[14].call(null, pair), a, env); + return Sx_types[53].call(null, b); + }, + t)]; + if(! Sx_types[53].call(null, and$7)) return and$7; + var + u = Sx_runtime[1].call(null, cst$8, [0, rest_idx, iw]), + rest_name = Sx_runtime[17].call(null, pattern, u), + v = Sx_runtime[1].call(null, cst_slice, [0, value, [0, rest_idx, 0]]), + w = Sx_types[54].call(null, rest_name), + x = Sx_runtime[3].call(null, w); + Sx_runtime[77].call(null, env, x, v); + return ix; + } + var + and$8 = Sx_runtime[37].call(null, pattern), + y = + Sx_types[53].call(null, and$8) + ? Sx_runtime[37].call(null, value) + : and$8; + if(! Sx_types[53].call(null, y)) + return Sx_runtime[1].call(null, cst, [0, pattern, [0, value, 0]]); + var + z = [0, Sx_runtime[24].call(null, value), 0], + A = [0, Sx_runtime[24].call(null, pattern), z], + B = Sx_runtime[1].call(null, cst, A), + C = [0, 1 - Sx_types[53].call(null, B)]; + if(Sx_types[53].call(null, C)) return iy; + var + pairs = Sx_runtime[1].call(null, cst_zip, [0, pattern, [0, value, 0]]), + D = Sx_runtime[5].call(null, pairs); + return [0, + Stdlib_List[33].call + (null, + function(pair){ + var + a = Sx_runtime[17].call(null, pair, iz), + b = match_pattern(Sx_runtime[14].call(null, pair), a, env); + return Sx_types[53].call(null, b); + }, + D)]; + } + var iA = [2, "match: no clause matched "], iB = [1, 1.]; + function step_sf_match(args, env, kont){ + var + val = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + clauses = Sx_runtime[15].call(null, args), + result = match_find_clause(val, clauses, env), + a = Sx_runtime[83].call(null, result); + if(Sx_types[53].call(null, a)){ + var + b = [0, iA, [0, Sx_runtime[68].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[9], d], 1); + } + var e = Sx_runtime[14].call(null, result); + return make_cek_state(Sx_runtime[17].call(null, result, iB), e, kont); + } + var iC = [1, 1.]; + function step_sf_handler_bind(args, env, kont){ + var + handler_specs = Sx_runtime[14].call(null, args), + body = Sx_runtime[15].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[17].call(null, spec, iC), env)), + 0]; + return [5, + [0, + trampoline(eval_expr(Sx_runtime[14].call(null, spec), env)), + a]]; + }, + a)], + b = Sx_runtime[33].call(null, body); + if(Sx_types[53].call(null, b)) return make_cek_value(0, env, kont); + var + c = + kont_push + (make_handler_frame(handlers, Sx_runtime[15].call(null, body), env), + kont); + return make_cek_state(Sx_runtime[14].call(null, body), env, c); + } + var iD = [1, 2.], iE = [1, 1.], iF = [5, 0]; + function step_sf_restart_case(args, env, kont){ + var + body = Sx_runtime[14].call(null, args), + restart_specs = Sx_runtime[15].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[17].call(null, spec, iD), 0], + c = [0, Sx_runtime[17].call(null, spec, iE), b], + d = Sx_runtime[14].call(null, spec), + e = Sx_runtime[39].call(null, d); + if(Sx_types[53].call(null, e)) + var + f = Sx_runtime[14].call(null, spec), + a = Sx_types[54].call(null, f); + else + var a = Sx_runtime[14].call(null, spec); + return [5, [0, a, c]]; + }, + a)]; + return make_cek_state + (body, + env, + kont_push(make_restart_frame(restarts, iF, env), kont)); + } + var iG = [2, "Unhandled condition: "]; + function step_sf_signal(args, env, kont){ + var + condition = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + handler_fn = kont_find_handler(kont, condition), + a = Sx_runtime[83].call(null, handler_fn); + if(! Sx_types[53].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, iG, [0, Sx_runtime[68].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[9], d], 1); + } + var + iH = [0, [1, 2.], 0], + iI = [1, 1.], + iJ = [2, "No restart named: "], + iK = [1, 1.], + iL = [1, 2.], + iM = [1, 1.], + iN = [1, 2.], + iO = [2, cst_env]; + function step_sf_invoke_restart(args, env, kont){ + var a = Sx_runtime[14].call(null, args), b = Sx_runtime[39].call(null, a); + if(Sx_types[53].call(null, b)) + var c = Sx_runtime[14].call(null, args), rn = Sx_types[54].call(null, c); + else + var rn = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)); + var + d = Sx_runtime[39].call(null, rn), + restart_name = + Sx_types[53].call(null, d) ? Sx_types[54].call(null, rn) : rn, + e = [0, Sx_runtime[24].call(null, args), iH], + f = Sx_runtime[1].call(null, cst$1, e), + restart_arg = + Sx_types[53].call(null, f) + ? trampoline(eval_expr(Sx_runtime[17].call(null, args, iI), env)) + : 0, + found = kont_find_restart(kont, restart_name), + g = Sx_runtime[83].call(null, found); + if(Sx_types[53].call(null, g)){ + var + h = [0, iJ, [0, Sx_runtime[68].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[9], j], 1); + } + var + entry = Sx_runtime[14].call(null, found), + restart_frame = Sx_runtime[17].call(null, found, iK), + rest_kont = Sx_runtime[17].call(null, found, iL), + params = Sx_runtime[17].call(null, entry, iM), + body = Sx_runtime[17].call(null, entry, iN), + k = Sx_runtime[25].call(null, restart_frame, iO), + restart_env = Sx_runtime[80].call(null, k), + l = Sx_runtime[33].call(null, params), + m = [0, 1 - Sx_types[53].call(null, l)]; + if(Sx_types[53].call(null, m)){ + var + n = Sx_runtime[14].call(null, params), + o = Sx_runtime[3].call(null, n); + Sx_runtime[77].call(null, restart_env, o, restart_arg); + } + return make_cek_state(body, restart_env, rest_kont); + } + var iP = [0, [1, 2.], 0], iQ = [1, 2.], iR = [1, 1.]; + function step_sf_if(args, env, kont){ + var + a = [0, Sx_runtime[24].call(null, args), iP], + b = Sx_runtime[1].call(null, cst$7, a), + c = Sx_types[53].call(null, b) ? Sx_runtime[17].call(null, args, iQ) : 0, + d = + kont_push + (make_if_frame(Sx_runtime[17].call(null, args, iR), c, env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, d); + } + function step_sf_when(args, env, kont){ + var + a = + kont_push(make_when_frame(Sx_runtime[15].call(null, args), env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var iS = [0, [1, 1.], 0]; + function step_sf_begin(args, env, kont){ + var a = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, a)) return make_cek_value(0, env, kont); + var + b = [0, Sx_runtime[24].call(null, args), iS], + c = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, c)) + return make_cek_state(Sx_runtime[14].call(null, args), env, kont); + var + d = + kont_push(make_begin_frame(Sx_runtime[15].call(null, args), env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, d); + } + var + iT = [0, [2, cst_symbol], 0], + iU = [0, [2, cst_list], 0], + iV = [0, [1, 2.], 0], + iW = [0, [2, cst_list], 0], + iX = [0, [1, 2.], 0], + iY = [0, [2, cst_symbol], 0], + iZ = [1, 1.], + i0 = [5, 0], + i1 = [0, [1, 2.], 0], + i2 = [1, 1.], + i3 = [0, [1, 2.], 0], + i4 = [0, [1, 2.], 0], + i5 = [1, 1.]; + function step_sf_let(args, env, kont){ + var + c = Sx_runtime[14].call(null, args), + d = [0, Sx_runtime[73].call(null, c), iT], + e = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, e)) + return make_cek_value(sf_named_let(args, env), env, kont); + var + bindings = Sx_runtime[14].call(null, args), + body = Sx_runtime[15].call(null, args), + local = Sx_runtime[80].call(null, env), + f = Sx_runtime[33].call(null, bindings); + if(Sx_types[53].call(null, f)) return step_sf_begin(body, local, kont); + var + g = Sx_runtime[14].call(null, bindings), + h = [0, Sx_runtime[73].call(null, g), iU], + and = Sx_runtime[1].call(null, cst, h); + if(Sx_types[53].call(null, and)) + var + i = Sx_runtime[14].call(null, bindings), + j = [0, Sx_runtime[24].call(null, i), iV], + a = Sx_runtime[1].call(null, cst, j); + else + var a = and; + if(Sx_types[53].call(null, a)) + var first_binding = Sx_runtime[14].call(null, bindings); + else + var + x = [0, Sx_runtime[17].call(null, bindings, i5), 0], + first_binding = [5, [0, Sx_runtime[14].call(null, bindings), x]]; + var + k = Sx_runtime[14].call(null, bindings), + l = [0, Sx_runtime[73].call(null, k), iW], + and$0 = Sx_runtime[1].call(null, cst, l); + if(Sx_types[53].call(null, and$0)) + var + m = Sx_runtime[14].call(null, bindings), + n = [0, Sx_runtime[24].call(null, m), iX], + b = Sx_runtime[1].call(null, cst, n); + else + var b = and$0; + if(Sx_types[53].call(null, b)) + var rest_bindings = Sx_runtime[15].call(null, bindings); + else{ + var + t = [0, Sx_runtime[24].call(null, bindings), i1], + u = [0, i2, [0, Sx_runtime[1].call(null, cst$12, t), 0]], + v = Sx_runtime[1].call(null, cst_range, u), + w = Sx_runtime[5].call(null, v), + pairs = [0, i0]; + Stdlib_List[26].call + (null, + function(acc, i){ + var + a = [0, Sx_runtime[1].call(null, cst$11, [0, i, i3]), 0], + b = Sx_runtime[1].call(null, cst_inc, a), + c = [0, Sx_runtime[17].call(null, bindings, b), 0], + d = Sx_runtime[1].call(null, cst$11, [0, i, i4]), + e = [5, [0, Sx_runtime[17].call(null, bindings, d), c]]; + pairs[1] = Sx_runtime[10].call(null, pairs[1], e); + return 0; + }, + 0, + w); + var rest_bindings = pairs[1]; + } + var + o = Sx_runtime[14].call(null, first_binding), + p = [0, Sx_runtime[73].call(null, o), iY], + q = Sx_runtime[1].call(null, cst, p); + if(Sx_types[53].call(null, q)) + var + r = Sx_runtime[14].call(null, first_binding), + vname = Sx_types[54].call(null, r); + else + var vname = Sx_runtime[14].call(null, first_binding); + var + s = kont_push(make_let_frame(vname, rest_bindings, body, local), kont); + return make_cek_state + (Sx_runtime[17].call(null, first_binding, iZ), local, s); + } + var + i6 = [0, [1, 4.], 0], + i7 = [0, [2, cst_keyword], 0], + i8 = [1, 1.], + i9 = [0, [2, cst_effects], 0], + i_ = [1, 1.], + i$ = [0, [1, 4.], 0], + ja = [0, [2, cst_keyword], 0], + jb = [1, 1.], + jc = [0, [2, cst_effects], 0], + jd = [1, 1.], + je = [1, 3.], + jf = [0, [1, 4.], 0], + jg = [0, [2, cst_keyword], 0], + jh = [1, 1.], + ji = [0, [2, cst_effects], 0], + jj = [1, 1.], + jk = [1, 2.], + jl = [1, 1.]; + function step_sf_define(args, env, kont){ + var + name_sym = Sx_runtime[14].call(null, args), + c = [0, Sx_runtime[24].call(null, args), i6], + and = Sx_runtime[1].call(null, cst$1, c); + if(Sx_types[53].call(null, and)){ + var + d = Sx_runtime[17].call(null, args, i8), + e = [0, Sx_runtime[73].call(null, d), i7], + and$0 = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, and$0)) + var + f = Sx_runtime[17].call(null, args, i_), + g = [0, Sx_types[55].call(null, f), i9], + 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[24].call(null, args), i$], + and$1 = Sx_runtime[1].call(null, cst$1, h); + if(Sx_types[53].call(null, and$1)){ + var + i = Sx_runtime[17].call(null, args, jb), + j = [0, Sx_runtime[73].call(null, i), ja], + and$2 = Sx_runtime[1].call(null, cst, j); + if(Sx_types[53].call(null, and$2)) + var + k = Sx_runtime[17].call(null, args, jd), + l = [0, Sx_types[55].call(null, k), jc], + a = Sx_runtime[1].call(null, cst, l); + else + var a = and$2; + } + else + var a = and$1; + var + val_idx = Sx_types[53].call(null, a) ? je : jl, + m = [0, Sx_runtime[24].call(null, args), jf], + and$3 = Sx_runtime[1].call(null, cst$1, m); + if(Sx_types[53].call(null, and$3)){ + var + n = Sx_runtime[17].call(null, args, jh), + o = [0, Sx_runtime[73].call(null, n), jg], + and$4 = Sx_runtime[1].call(null, cst, o); + if(Sx_types[53].call(null, and$4)) + var + p = Sx_runtime[17].call(null, args, jj), + q = [0, Sx_types[55].call(null, p), ji], + b = Sx_runtime[1].call(null, cst, q); + else + var b = and$4; + } + else + var b = and$3; + var + effect_list = + Sx_types[53].call(null, b) ? Sx_runtime[17].call(null, args, jk) : 0, + r = + kont_push + (make_define_frame + (Sx_types[54].call(null, name_sym), env, has_effects, effect_list), + kont); + return make_cek_state(Sx_runtime[17].call(null, args, val_idx), env, r); + } + var jm = [1, 1.]; + function step_sf_set_b(args, env, kont){ + var + a = Sx_runtime[14].call(null, args), + b = kont_push(make_set_frame(Sx_types[54].call(null, a), env), kont); + return make_cek_state(Sx_runtime[17].call(null, args, jm), env, b); + } + var jn = [0, 1]; + function step_sf_and(args, env, kont){ + var a = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, a)) return make_cek_value(jn, env, kont); + var + b = kont_push(make_and_frame(Sx_runtime[15].call(null, args), env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, b); + } + var jo = [0, 0]; + function step_sf_or(args, env, kont){ + var a = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, a)) return make_cek_value(jo, env, kont); + var + b = kont_push(make_or_frame(Sx_runtime[15].call(null, args), env), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, b); + } + var + jp = [1, 1.], + jq = [0, 1], + jr = [0, [1, 2.], 0], + js = [1, 1.], + jt = [0, 0]; + function step_sf_cond(args, env, kont){ + var scheme_p = cond_scheme_p(args); + if(Sx_types[53].call(null, scheme_p)){ + var a = Sx_runtime[33].call(null, args); + if(Sx_types[53].call(null, a)) return make_cek_value(0, env, kont); + var + clause = Sx_runtime[14].call(null, args), + test = Sx_runtime[14].call(null, clause), + b = is_else_clause(test); + return Sx_types[53].call(null, b) + ? make_cek_state + (Sx_runtime[17].call(null, clause, jp), env, kont) + : make_cek_state + (test, env, kont_push(make_cond_frame(args, env, jq), kont)); + } + var + c = [0, Sx_runtime[24].call(null, args), jr], + d = Sx_runtime[1].call(null, cst$2, c); + if(Sx_types[53].call(null, d)) return make_cek_value(0, env, kont); + var test$0 = Sx_runtime[14].call(null, args), e = is_else_clause(test$0); + return Sx_types[53].call(null, e) + ? make_cek_state(Sx_runtime[17].call(null, args, js), env, kont) + : make_cek_state + (test$0, env, kont_push(make_cond_frame(args, env, jt), kont)); + } + var ju = [2, cst_first]; + function step_sf_thread_first(args, env, kont){ + var + a = + kont_push + (make_thread_frame(Sx_runtime[15].call(null, args), env, ju, 0), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var cst_last = "last", jv = [2, cst_last]; + function step_sf_thread_last(args, env, kont){ + var + a = + kont_push + (make_thread_frame(Sx_runtime[15].call(null, args), env, jv, 0), kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var jw = [1, 1.], jx = [2, cst_as]; + function step_sf_thread_as(args, env, kont){ + var + init = Sx_runtime[14].call(null, args), + name = Sx_runtime[17].call(null, args, jw), + a = Sx_runtime[15].call(null, args), + forms = Sx_runtime[15].call(null, a); + return make_cek_state + (init, + env, + kont_push(make_thread_frame(forms, env, jx, name), kont)); + } + function step_sf_lambda(args, env, kont){ + return make_cek_value(sf_lambda(args, env), env, kont); + } + var + jy = [0, [1, 1.], 0], + jz = [0, [1, 2.], 0], + jA = [0, [2, cst_keyword], 0], + jB = [0, [2, cst_value], 0], + jC = [1, 1.], + jD = [0, [1, 2.], 0]; + function step_sf_scope(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + rest_args = Sx_runtime[1].call(null, cst_slice, [0, args, jy]), + b = [0, Sx_runtime[24].call(null, rest_args), jz], + and = Sx_runtime[1].call(null, cst$1, b); + if(Sx_types[53].call(null, and)){ + var + c = Sx_runtime[14].call(null, rest_args), + d = [0, Sx_runtime[73].call(null, c), jA], + and$0 = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and$0)) + var + e = Sx_runtime[14].call(null, rest_args), + f = [0, Sx_types[55].call(null, e), jB], + a = Sx_runtime[1].call(null, cst, f); + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)) + var + g = trampoline(eval_expr(Sx_runtime[17].call(null, rest_args, jC), env)), + body = Sx_runtime[1].call(null, cst_slice, [0, rest_args, jD]), + val = g; + else + var body = rest_args, val = 0; + var h = Sx_runtime[33].call(null, body); + if(Sx_types[53].call(null, h)) return make_cek_value(0, env, kont); + var + i = + kont_push + (make_scope_acc_frame(name, val, Sx_runtime[15].call(null, body), env), + kont); + return make_cek_state(Sx_runtime[14].call(null, body), env, i); + } + var jE = [1, 1.], jF = [0, [1, 2.], 0]; + function step_sf_provide(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[17].call(null, args, jE), env)), + body = Sx_runtime[1].call(null, cst_slice, [0, args, jF]); + Sx_runtime[102].call(null, name, val); + var a = Sx_runtime[33].call(null, body); + if(Sx_types[53].call(null, a)){ + Sx_runtime[103].call(null, name); + return make_cek_value(0, env, kont); + } + var + b = + kont_push + (make_provide_frame(name, val, Sx_runtime[15].call(null, body), env), + kont); + return make_cek_state(Sx_runtime[14].call(null, body), env, b); + } + var jG = [0, [1, 2.], 0], jH = [1, 1.], jI = [2, cst_value]; + function step_sf_context(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + a = [0, Sx_runtime[24].call(null, args), jG], + b = Sx_runtime[1].call(null, cst$1, a), + default_val = + Sx_types[53].call(null, b) + ? trampoline(eval_expr(Sx_runtime[17].call(null, args, jH), env)) + : 0, + frame = kont_find_provide(kont, name); + if(Sx_types[53].call(null, bind_tracking_ref[1])){ + var + c = + Sx_runtime[1].call + (null, cst_contains, [0, bind_tracking_ref[1], [0, name, 0]]), + d = [0, 1 - Sx_types[53].call(null, c)]; + if(Sx_types[53].call(null, d)) + bind_tracking_ref[1] = + Sx_runtime[10].call(null, bind_tracking_ref[1], name); + } + var + sv = Sx_runtime[104].call(null, name), + e = Sx_runtime[83].call(null, sv), + f = + Sx_types[53].call(null, e) + ? Sx_types + [53].call + (null, frame) + ? Sx_runtime[25].call(null, frame, jI) + : default_val + : sv; + return make_cek_value(f, env, kont); + } + var + jJ = [0, [1, 2.], 0], + jK = [1, 1.], + jL = [2, cst_value], + jM = [2, cst_peek], + jN = [2, cst_peek]; + function step_sf_peek(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + b = [0, Sx_runtime[24].call(null, args), jJ], + c = Sx_runtime[1].call(null, cst$1, b), + default_val = + Sx_types[53].call(null, c) + ? trampoline(eval_expr(Sx_runtime[17].call(null, args, jK), env)) + : 0, + frame = kont_find_provide(kont, name); + if(Sx_types[53].call(null, frame)) + var a = Sx_runtime[25].call(null, frame, jL); + else{ + var d = Sx_runtime[75].call(null, env, jM); + if(Sx_types[53].call(null, d)) + var + e = Sx_runtime[76].call(null, env, jN), + 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 jO = [1, 1.]; + function step_sf_provide_b(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + a = kont_push(make_provide_set_frame(name, env), kont); + return make_cek_state(Sx_runtime[17].call(null, args, jO), env, a); + } + var + cst_scope_emit = "scope-emit!", + jP = [1, 1.], + jQ = [2, cst_emitted], + jR = [2, cst_emitted], + jS = [2, cst_scope_emit], + jT = [2, cst_scope_emit]; + function step_sf_emit(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[17].call(null, args, jP), env)), + frame = kont_find_scope_acc(kont, name); + if(Sx_types[53].call(null, frame)){ + var + a = [0, Sx_runtime[25].call(null, frame, jQ), [0, [5, [0, val, 0]], 0]], + b = Sx_runtime[1].call(null, cst_append, a); + Sx_runtime[11].call(null, frame, jR, b); + return make_cek_value(0, env, kont); + } + var c = Sx_runtime[75].call(null, env, jS); + if(Sx_types[53].call(null, c)){ + var d = Sx_runtime[76].call(null, env, jT); + Sx_runtime[7].call(null, d, [5, [0, name, [0, val, 0]]]); + } + return make_cek_value(0, env, kont); + } + var + jU = [2, cst_emitted], + jV = [2, cst_emitted], + jW = [2, cst_emitted], + jX = [5, 0]; + function step_sf_emitted(args, env, kont){ + var + name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + frame = kont_find_scope_acc(kont, name); + if(Sx_types[53].call(null, frame)) + var a = Sx_runtime[25].call(null, frame, jU); + else{ + var b = Sx_runtime[75].call(null, env, jV); + if(Sx_types[53].call(null, b)) + var + c = Sx_runtime[76].call(null, env, jW), + a = Sx_runtime[7].call(null, c, [5, [0, name, 0]]); + else + var a = jX; + } + 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[14].call(null, args), env, a); + } + var jY = [1, 1.], jZ = [1, 1.]; + function step_sf_shift(args, env, kont){ + var + a = Sx_runtime[14].call(null, args), + k_name = Sx_types[54].call(null, a), + body = Sx_runtime[17].call(null, args, jY), + captured_result = kont_capture_to_reset(kont), + captured = Sx_runtime[14].call(null, captured_result), + rest_kont = Sx_runtime[17].call(null, captured_result, jZ), + k = Sx_runtime[95].call(null, captured, rest_kont), + shift_env = Sx_runtime[80].call(null, env), + b = Sx_runtime[3].call(null, k_name); + Sx_runtime[77].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[14].call(null, args), env, a); + } + var j0 = [5, 0], j1 = [5, 0]; + function cek_call(f, args){ + var + b = Sx_runtime[83].call(null, args), + a = Sx_types[53].call(null, b) ? j0 : args, + c = Sx_runtime[83].call(null, f); + if(Sx_types[53].call(null, c)) return 0; + var + or = Sx_runtime[85].call(null, f), + or$0 = Sx_types[53].call(null, or) ? or : Sx_runtime[90].call(null, f); + return Sx_types[53].call(null, or$0) + ? cek_run + (continue_with_call(f, a, Sx_runtime[79].call(null, 0), a, j1)) + : 0; + } + var + cst_update_fn = "update-fn", + j2 = [1, 1.], + j3 = [1, 2.], + j4 = [2, cst_update_fn], + j5 = [0, 0]; + function reactive_shift_deref(sig, env, kont){ + var + scan_result = kont_capture_to_reactive_reset(kont), + captured_frames = Sx_runtime[14].call(null, scan_result), + reset_frame = Sx_runtime[17].call(null, scan_result, j2), + remaining_kont = Sx_runtime[17].call(null, scan_result, j3), + update_fn = Sx_runtime[25].call(null, reset_frame, j4), + subscriber = + [14, + cst$9, + 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, j5), + 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[116].call + (null, + [14, + cst$9, + function(args){ + if(args && ! args[2]){ + var d = args[1]; + Sx_runtime[10].call(null, 0, d); + return 0; + } + return 0; + }], + [14, + cst$9, + function(args){ + return cek_run + (make_cek_value + (Sx_runtime[113].call(null, sig), env, new_kont)); + }]); + }]; + Sx_runtime[114].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[113].call(null, sig), env, initial_kont); + } + var j6 = [0, [2, cst_symbol], 0], j7 = [5, 0]; + function step_eval_call(head, args, env, kont){ + var + a = [0, Sx_runtime[73].call(null, head), j6], + b = Sx_runtime[1].call(null, cst, a), + hname = Sx_types[53].call(null, b) ? Sx_types[54].call(null, head) : 0; + return make_cek_state + (head, + env, + kont_push(make_arg_frame(0, j7, args, env, args, hname), kont)); + } + var + j8 = [0, [2, cst_map], 0], + j9 = [0, [2, cst_map_indexed], 0], + j_ = [0, [2, cst_filter], 0], + j$ = [0, [2, cst_reduce], 0], + ka = [0, [2, cst_some], 0], + kb = [0, [2, cst_every$0], 0], + kc = [0, [2, cst_for_each], 0]; + function ho_form_name_p(name){ + var or = Sx_runtime[1].call(null, cst, [0, name, j8]); + if(Sx_types[53].call(null, or)) return or; + var or$0 = Sx_runtime[1].call(null, cst, [0, name, j9]); + if(Sx_types[53].call(null, or$0)) return or$0; + var or$1 = Sx_runtime[1].call(null, cst, [0, name, j_]); + if(Sx_types[53].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[1].call(null, cst, [0, name, j$]); + if(Sx_types[53].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[1].call(null, cst, [0, name, ka]); + if(Sx_types[53].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[1].call(null, cst, [0, name, kb]); + return Sx_types[53].call(null, or$4) + ? or$4 + : Sx_runtime[1].call(null, cst, [0, name, kc]); + } + function ho_fn_p(v){ + var or = Sx_runtime[90].call(null, v); + return Sx_types[53].call(null, or) ? or : Sx_runtime[85].call(null, v); + } + var kd = [0, [2, cst_reduce], 0], ke = [1, 1.], kf = [1, 2.], kg = [1, 1.]; + function ho_swap_args(ho_type, evaled){ + var c = Sx_runtime[1].call(null, cst, [0, ho_type, kd]); + if(Sx_types[53].call(null, c)){ + var + a = Sx_runtime[14].call(null, evaled), + b = Sx_runtime[17].call(null, evaled, ke), + d = ho_fn_p(a), + and = [0, 1 - Sx_types[53].call(null, d)], + e = Sx_types[53].call(null, and) ? ho_fn_p(b) : and; + return Sx_types[53].call(null, e) + ? [5, + [0, b, [0, Sx_runtime[17].call(null, evaled, kf), [0, a, 0]]]] + : evaled; + } + var + a$0 = Sx_runtime[14].call(null, evaled), + b$0 = Sx_runtime[17].call(null, evaled, kg), + f = ho_fn_p(a$0), + and$0 = [0, 1 - Sx_types[53].call(null, f)], + g = Sx_types[53].call(null, and$0) ? ho_fn_p(b$0) : and$0; + return Sx_types[53].call(null, g) ? [5, [0, b$0, [0, a$0, 0]]] : evaled; + } + var + kh = [0, [2, cst_map], 0], + ki = [0, [1, 2.], 0], + kj = [5, 0], + kk = [5, 0], + kl = [5, 0], + km = [1, 1.], + kn = [5, 0], + ko = [5, 0], + kp = [5, 0], + kq = [0, [2, cst_map_indexed], 0], + kr = [1, 1.], + ks = [5, 0], + kt = [5, 0], + ku = [5, 0], + kv = [1, 0.], + kw = [0, [2, cst_filter], 0], + kx = [1, 1.], + ky = [5, 0], + kz = [5, 0], + kA = [5, 0], + kB = [0, [2, cst_reduce], 0], + kC = [1, 1.], + kD = [1, 2.], + kE = [5, 0], + kF = [0, [2, cst_some], 0], + kG = [1, 1.], + kH = [0, 0], + kI = [5, 0], + kJ = [0, [2, cst_every], 0], + kK = [1, 1.], + kL = [0, 1], + kM = [5, 0], + kN = [0, [2, cst_for_each], 0], + kO = [1, 1.], + kP = [5, 0], + kQ = [2, "Unknown HO type: "]; + function ho_setup_dispatch(ho_type, evaled, env, kont){ + var + ordered = ho_swap_args(ho_type, evaled), + f = Sx_runtime[14].call(null, ordered), + a = Sx_runtime[1].call(null, cst, [0, ho_type, kh]); + if(Sx_types[53].call(null, a)){ + var + b = [0, Sx_runtime[24].call(null, ordered), ki], + c = Sx_runtime[1].call(null, cst$7, b); + if(Sx_types[53].call(null, c)){ + var + colls = Sx_runtime[15].call(null, ordered), + d = Sx_runtime[5].call(null, colls), + e = + [0, + Stdlib_List[34].call + (null, + function(c){ + var a = Sx_runtime[33].call(null, c); + return Sx_types[53].call(null, a); + }, + d)]; + if(Sx_types[53].call(null, e)) return make_cek_value(kj, env, kont); + var + g = Sx_runtime[5].call(null, colls), + heads = + [5, + Stdlib_List[20].call + (null, function(c){return Sx_runtime[14].call(null, c);}, g)], + h = Sx_runtime[5].call(null, colls), + tails = + [5, + Stdlib_List[20].call + (null, function(c){return Sx_runtime[15].call(null, c);}, h)]; + return continue_with_call + (f, + heads, + env, + kl, + kont_push(make_multi_map_frame(f, tails, kk, env), kont)); + } + var + coll = Sx_runtime[17].call(null, ordered, km), + i = Sx_runtime[33].call(null, coll); + if(Sx_types[53].call(null, i)) return make_cek_value(kn, env, kont); + var + j = + kont_push + (make_map_frame(f, Sx_runtime[15].call(null, coll), ko, env), kont); + return continue_with_call + (f, [5, [0, Sx_runtime[14].call(null, coll), 0]], env, kp, j); + } + var k = Sx_runtime[1].call(null, cst, [0, ho_type, kq]); + if(Sx_types[53].call(null, k)){ + var + coll$0 = Sx_runtime[17].call(null, ordered, kr), + l = Sx_runtime[33].call(null, coll$0); + if(Sx_types[53].call(null, l)) return make_cek_value(ks, env, kont); + var + m = + kont_push + (make_map_indexed_frame + (f, Sx_runtime[15].call(null, coll$0), kt, env), + kont); + return continue_with_call + (f, + [5, [0, kv, [0, Sx_runtime[14].call(null, coll$0), 0]]], + env, + ku, + m); + } + var n = Sx_runtime[1].call(null, cst, [0, ho_type, kw]); + if(Sx_types[53].call(null, n)){ + var + coll$1 = Sx_runtime[17].call(null, ordered, kx), + o = Sx_runtime[33].call(null, coll$1); + if(Sx_types[53].call(null, o)) return make_cek_value(ky, env, kont); + var + p = Sx_runtime[14].call(null, coll$1), + q = + kont_push + (make_filter_frame(f, Sx_runtime[15].call(null, coll$1), kz, p, env), + kont); + return continue_with_call + (f, [5, [0, Sx_runtime[14].call(null, coll$1), 0]], env, kA, q); + } + var r = Sx_runtime[1].call(null, cst, [0, ho_type, kB]); + if(Sx_types[53].call(null, r)){ + var + init = Sx_runtime[17].call(null, ordered, kC), + coll$2 = Sx_runtime[17].call(null, ordered, kD), + s = Sx_runtime[33].call(null, coll$2); + if(Sx_types[53].call(null, s)) return make_cek_value(init, env, kont); + var + t = + kont_push + (make_reduce_frame(f, Sx_runtime[15].call(null, coll$2), env), kont); + return continue_with_call + (f, + [5, [0, init, [0, Sx_runtime[14].call(null, coll$2), 0]]], + env, + kE, + t); + } + var u = Sx_runtime[1].call(null, cst, [0, ho_type, kF]); + if(Sx_types[53].call(null, u)){ + var + coll$3 = Sx_runtime[17].call(null, ordered, kG), + v = Sx_runtime[33].call(null, coll$3); + if(Sx_types[53].call(null, v)) return make_cek_value(kH, env, kont); + var + w = + kont_push + (make_some_frame(f, Sx_runtime[15].call(null, coll$3), env), kont); + return continue_with_call + (f, [5, [0, Sx_runtime[14].call(null, coll$3), 0]], env, kI, w); + } + var x = Sx_runtime[1].call(null, cst, [0, ho_type, kJ]); + if(Sx_types[53].call(null, x)){ + var + coll$4 = Sx_runtime[17].call(null, ordered, kK), + y = Sx_runtime[33].call(null, coll$4); + if(Sx_types[53].call(null, y)) return make_cek_value(kL, env, kont); + var + z = + kont_push + (make_every_frame(f, Sx_runtime[15].call(null, coll$4), env), kont); + return continue_with_call + (f, [5, [0, Sx_runtime[14].call(null, coll$4), 0]], env, kM, z); + } + var A = Sx_runtime[1].call(null, cst, [0, ho_type, kN]); + if(! Sx_types[53].call(null, A)){ + var + D = [2, Sx_runtime[4].call(null, [0, kQ, [0, ho_type, 0]])], + E = Sx_runtime[2].call(null, D); + throw caml_maybe_attach_backtrace([0, Sx_types[9], E], 1); + } + var + coll$5 = Sx_runtime[17].call(null, ordered, kO), + B = Sx_runtime[33].call(null, coll$5); + if(Sx_types[53].call(null, B)) return make_cek_value(0, env, kont); + var + C = + kont_push + (make_for_each_frame(f, Sx_runtime[15].call(null, coll$5), env), kont); + return continue_with_call + (f, [5, [0, Sx_runtime[14].call(null, coll$5), 0]], env, kP, C); + } + var kR = [5, 0], kS = [2, cst_map]; + function step_ho_map(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(kS, Sx_runtime[15].call(null, args), kR, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var kT = [5, 0], kU = [2, cst_map_indexed]; + function step_ho_map_indexed(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(kU, Sx_runtime[15].call(null, args), kT, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var kV = [5, 0], kW = [2, cst_filter]; + function step_ho_filter(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(kW, Sx_runtime[15].call(null, args), kV, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var kX = [5, 0], kY = [2, cst_reduce]; + function step_ho_reduce(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(kY, Sx_runtime[15].call(null, args), kX, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var kZ = [5, 0], k0 = [2, cst_some]; + function step_ho_some(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(k0, Sx_runtime[15].call(null, args), kZ, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var k1 = [5, 0], k2 = [2, cst_every]; + function step_ho_every(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(k2, Sx_runtime[15].call(null, args), k1, env), + kont); + return make_cek_state(Sx_runtime[14].call(null, args), env, a); + } + var k3 = [5, 0], k4 = [2, cst_for_each]; + function step_ho_for_each(args, env, kont){ + var + a = + kont_push + (make_ho_setup_frame(k4, Sx_runtime[15].call(null, args), k3, env), + kont); + return make_cek_state(Sx_runtime[14].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", + cst_subscribers = "subscribers", + last_error_kont_ref = [0, 0], + k5 = [0, [2, cst_if], 0], + k6 = [2, cst_env], + k7 = [2, "then"], + k8 = [2, cst_else], + k9 = [2, cst_env], + k_ = [2, cst_else], + k$ = [0, [2, cst_when], 0], + la = [2, cst_body], + lb = [2, cst_env], + lc = [0, [1, 1.], 0], + ld = [0, [2, cst_begin], 0], + le = [2, cst_remaining], + lf = [2, cst_env], + lg = [0, [1, 1.], 0], + lh = [0, [2, cst_let], 0], + li = [2, cst_name], + lj = [2, cst_remaining], + lk = [2, cst_body], + ll = [2, cst_env], + lm = [0, [2, cst_symbol], 0], + ln = [1, 1.], + lo = [0, [2, cst_define], 0], + lp = [2, cst_name], + lq = [2, cst_env], + lr = [2, "has-effects"], + ls = [2, "effect-list"], + lt = [0, [2, cst_symbol], 0], + lu = [2, cst_effect_annotations], + lv = [2, cst_effect_annotations], + lw = [2, cst_effect_annotations], + lx = [0, [2, cst_define_foreign], 0], + ly = [2, cst_name], + lz = [2, cst_env], + lA = [0, [2, cst_set], 0], + lB = [2, cst_name], + lC = [2, cst_env], + lD = [0, [2, cst_and], 0], + lE = [2, cst_remaining], + lF = [0, [1, 1.], 0], + lG = [2, cst_env], + lH = [2, cst_env], + lI = [0, [2, cst_or], 0], + lJ = [2, cst_remaining], + lK = [0, 0], + lL = [0, [1, 1.], 0], + lM = [2, cst_env], + lN = [2, cst_env], + lO = [0, [2, cst_cond], 0], + lP = [2, cst_remaining], + lQ = [2, cst_env], + lR = [2, cst_scheme], + lS = [0, [1, 2.], 0], + lT = [0, [2, cst_symbol], 0], + lU = [1, 1.], + lV = [0, [2, cst$10], 0], + lW = [1, 1.], + lX = [1, 2.], + lY = [1, 1.], + lZ = [1, 1.], + l0 = [0, 1], + l1 = [1, 1.], + l2 = [1, 2.], + l3 = [0, [1, 2.], 0], + l4 = [1, 1.], + l5 = [0, 0], + l6 = [0, [2, cst_case], 0], + l7 = [2, cst_match_val], + l8 = [2, cst_remaining], + l9 = [2, cst_env], + l_ = [0, [2, cst_thread], 0], + l$ = [2, cst_remaining], + ma = [2, cst_env], + mb = [2, "extra"], + mc = [2, cst_name], + md = [0, [2, cst_as], 0], + me = [0, [2, cst_list], 0], + mf = [0, [2, cst_symbol], 0], + mg = [3, cst_quote], + mh = [0, [2, cst_last], 0], + mi = [0, [2, cst_arg], 0], + mj = [2, cst_f], + mk = [2, cst_evaled], + ml = [2, cst_remaining], + mm = [2, cst_env], + mn = [2, "raw-args"], + mo = [2, "head-name"], + mp = [5, 0], + mq = [5, 0], + mr = [5, 0], + ms = [0, [2, cst_dict], 0], + mt = [2, cst_remaining], + mu = [2, cst_results], + mv = [2, cst_env], + mw = [1, 0.], + mx = [1, 1.], + my = [1, 1.], + mz = [0, [2, cst_ho_setup], 0], + mA = [2, "ho-type"], + mB = [2, cst_remaining], + mC = [2, cst_evaled], + mD = [2, cst_env], + mE = [0, [2, cst_reset], 0], + mF = [0, [2, cst_deref], 0], + mG = [2, cst_env], + mH = [2, "sx-reactive"], + mI = [2, "deps"], + mJ = [2, "notify"], + mK = [0, [2, cst_reactive_reset], 0], + mL = [2, cst_update_fn], + mM = [2, "first-render"], + mN = [0, [2, cst_scope], 0], + mO = [2, cst_name], + mP = [2, cst_remaining], + mQ = [2, cst_env], + mR = [0, [2, cst_provide], 0], + mS = [2, cst_remaining], + mT = [2, cst_env], + mU = [2, cst_name], + mV = [2, cst_value], + mW = [2, cst_name], + mX = [2, cst_subscribers], + mY = [2, cst_subscribers], + mZ = [0, [2, cst_bind], 0], + m0 = [2, cst_body], + m1 = [2, cst_env], + m2 = [2, "prev-tracking"], + m3 = [5, 0], + m4 = [5, 0], + m5 = [0, [2, cst_provide_set], 0], + m6 = [2, cst_name], + m7 = [2, cst_env], + m8 = [2, cst_value], + m9 = [2, cst_value], + m_ = [0, [2, cst_scope_acc], 0], + m$ = [2, cst_remaining], + na = [2, cst_env], + nb = [2, cst_value], + nc = [2, cst_name], + nd = [2, cst_emitted], + ne = [2, cst_emitted], + nf = [0, [2, cst_map], 0], + ng = [2, cst_f], + nh = [2, cst_remaining], + ni = [2, cst_results], + nj = [2, "indexed"], + nk = [2, cst_env], + nl = [5, 0], + nm = [0, [2, cst_filter], 0], + nn = [2, cst_f], + no = [2, cst_remaining], + np = [2, cst_results], + nq = [2, "current-item"], + nr = [2, cst_env], + ns = [5, 0], + nt = [0, [2, cst_reduce], 0], + nu = [2, cst_f], + nv = [2, cst_remaining], + nw = [2, cst_env], + nx = [5, 0], + ny = [0, [2, cst_for_each], 0], + nz = [2, cst_f], + nA = [2, cst_remaining], + nB = [2, cst_env], + nC = [5, 0], + nD = [0, [2, cst_some], 0], + nE = [2, cst_f], + nF = [2, cst_remaining], + nG = [2, cst_env], + nH = [0, 0], + nI = [5, 0], + nJ = [0, [2, cst_every], 0], + nK = [2, cst_f], + nL = [2, cst_remaining], + nM = [2, cst_env], + nN = [0, 0], + nO = [0, 1], + nP = [5, 0], + nQ = [0, [2, cst_handler], 0], + nR = [2, cst_remaining], + nS = [2, cst_env], + nT = [2, cst_f], + nU = [0, [2, cst_restart], 0], + nV = [0, [2, cst_signal_return], 0], + nW = [2, "saved-kont"], + nX = [2, cst_env], + nY = [0, [2, cst_comp_trace], 0], + nZ = [0, [2, cst_cond_arrow], 0], + n0 = [2, cst_match_val], + n1 = [2, cst_env], + n2 = [0, [2, cst_raise_eval], 0], + n3 = [2, cst_env], + n4 = [2, cst_scheme], + n5 = [2, "Unhandled exception: "], + n6 = [0, [2, cst_raise_guard], 0], + n7 = [2, "exception handler returned from non-continuable raise"], + n8 = [0, [2, cst_multi_map], 0], + n9 = [2, cst_f], + n_ = [2, cst_remaining], + n$ = [2, cst_results], + oa = [2, cst_env], + ob = [5, 0], + oc = [0, [2, cst_callcc], 0], + od = [2, cst_env], + oe = [0, [2, cst_vm_resume], 0], + of = [2, cst_f], + og = [2, cst_vm_suspended], + oh = [2, cst_env], + oi = [2, cst_resume], + oj = [2, cst_env], + ok = [2, cst_request], + ol = [2, cst_env], + om = [0, [2, cst_perform], 0], + on = [2, cst_env], + oo = [0, [2, cst_import], 0], + op = [2, cst_args], + oq = [2, cst_remaining], + or = [2, cst_env], + os = [0, [2, cst_parameterize], 0], + ot = [2, cst_remaining], + ou = [2, cst_f], + ov = [2, cst_results], + ow = [2, cst_body], + ox = [2, cst_env], + oy = [1, 1.], + oz = [0, [1, 1.], 0], + oA = [3, cst_begin], + oB = [2, "Unknown frame type: "]; + function step_continue(state){ + var + converted_val = cek_value(state), + env = cek_env(state), + kont = cek_kont(state), + i = kont_empty_p(kont); + if(Sx_types[53].call(null, i)) return state; + var + frame = kont_top(kont), + rest_k = kont_pop(kont), + match_val = frame_type(frame), + j = Sx_runtime[1].call(null, cst, [0, match_val, k5]); + if(Sx_types[53].call(null, j)){ + if(Sx_types[53].call(null, converted_val)) + var + l = Sx_runtime[83].call(null, converted_val), + c = [0, 1 - Sx_types[53].call(null, l)]; + else + var c = converted_val; + if(Sx_types[53].call(null, c)){ + var m = Sx_runtime[25].call(null, frame, k6); + return make_cek_state(Sx_runtime[25].call(null, frame, k7), m, rest_k); + } + var + n = Sx_runtime[25].call(null, frame, k8), + o = Sx_runtime[83].call(null, n); + if(Sx_types[53].call(null, o)) return make_cek_value(0, env, rest_k); + var p = Sx_runtime[25].call(null, frame, k9); + return make_cek_state(Sx_runtime[25].call(null, frame, k_), p, rest_k); + } + var q = Sx_runtime[1].call(null, cst, [0, match_val, k$]); + if(Sx_types[53].call(null, q)){ + if(Sx_types[53].call(null, converted_val)) + var + r = Sx_runtime[83].call(null, converted_val), + e = [0, 1 - Sx_types[53].call(null, r)]; + else + var e = converted_val; + if(! Sx_types[53].call(null, e)) return make_cek_value(0, env, rest_k); + var + body = Sx_runtime[25].call(null, frame, la), + fenv = Sx_runtime[25].call(null, frame, lb), + s = Sx_runtime[33].call(null, body); + if(Sx_types[53].call(null, s)) return make_cek_value(0, fenv, rest_k); + var + t = [0, Sx_runtime[24].call(null, body), lc], + u = Sx_runtime[1].call(null, cst, t); + if(Sx_types[53].call(null, u)) + return make_cek_state(Sx_runtime[14].call(null, body), fenv, rest_k); + var + v = + kont_push + (make_begin_frame(Sx_runtime[15].call(null, body), fenv), rest_k); + return make_cek_state(Sx_runtime[14].call(null, body), fenv, v); + } + var w = Sx_runtime[1].call(null, cst, [0, match_val, ld]); + if(Sx_types[53].call(null, w)){ + var + remaining = Sx_runtime[25].call(null, frame, le), + fenv$0 = Sx_runtime[25].call(null, frame, lf), + x = Sx_runtime[33].call(null, remaining); + if(Sx_types[53].call(null, x)) + return make_cek_value(converted_val, fenv$0, rest_k); + var + y = [0, Sx_runtime[24].call(null, remaining), lg], + z = Sx_runtime[1].call(null, cst, y); + if(Sx_types[53].call(null, z)) + return make_cek_state + (Sx_runtime[14].call(null, remaining), fenv$0, rest_k); + var + A = + kont_push + (make_begin_frame(Sx_runtime[15].call(null, remaining), fenv$0), + rest_k); + return make_cek_state(Sx_runtime[14].call(null, remaining), fenv$0, A); + } + var B = Sx_runtime[1].call(null, cst, [0, match_val, lh]); + if(Sx_types[53].call(null, B)){ + var + name = Sx_runtime[25].call(null, frame, li), + remaining$0 = Sx_runtime[25].call(null, frame, lj), + body$0 = Sx_runtime[25].call(null, frame, lk), + local = Sx_runtime[25].call(null, frame, ll), + C = Sx_runtime[3].call(null, name); + Sx_runtime[77].call(null, local, C, converted_val); + var D = Sx_runtime[33].call(null, remaining$0); + if(Sx_types[53].call(null, D)) + return step_sf_begin(body$0, local, rest_k); + var + next_binding = Sx_runtime[14].call(null, remaining$0), + E = Sx_runtime[14].call(null, next_binding), + F = [0, Sx_runtime[73].call(null, E), lm], + G = Sx_runtime[1].call(null, cst, F); + if(Sx_types[53].call(null, G)) + var + H = Sx_runtime[14].call(null, next_binding), + vname = Sx_types[54].call(null, H); + else + var vname = Sx_runtime[14].call(null, next_binding); + var + I = + kont_push + (make_let_frame + (vname, Sx_runtime[15].call(null, remaining$0), body$0, local), + rest_k); + return make_cek_state + (Sx_runtime[17].call(null, next_binding, ln), local, I); + } + var J = Sx_runtime[1].call(null, cst, [0, match_val, lo]); + if(Sx_types[53].call(null, J)){ + var + name$0 = Sx_runtime[25].call(null, frame, lp), + fenv$1 = Sx_runtime[25].call(null, frame, lq), + has_effects = Sx_runtime[25].call(null, frame, lr), + effect_list = Sx_runtime[25].call(null, frame, ls), + and = Sx_runtime[85].call(null, converted_val); + if(Sx_types[53].call(null, and)) + var + K = Sx_types[59].call(null, converted_val), + g = Sx_runtime[83].call(null, K); + else + var g = and; + if(Sx_types[53].call(null, g)){ + var L = Sx_runtime[3].call(null, name$0); + Sx_runtime[82].call(null, converted_val, L); + } + var M = Sx_runtime[3].call(null, name$0); + Sx_runtime[77].call(null, fenv$1, M, converted_val); + if(Sx_types[53].call(null, has_effects)){ + var + N = Sx_runtime[5].call(null, effect_list), + effect_names = + [5, + Stdlib_List[20].call + (null, + function(e){ + var + a = [0, Sx_runtime[73].call(null, e), lt], + b = Sx_runtime[1].call(null, cst, a); + return Sx_types[53].call(null, b) + ? Sx_types[54].call(null, e) + : e; + }, + N)], + O = Sx_runtime[75].call(null, fenv$1, lu), + effect_anns = + Sx_types[53].call(null, O) + ? Sx_runtime[76].call(null, fenv$1, lv) + : [6, Stdlib_Hashtbl[1].call(null, 0, 0)]; + Sx_runtime[11].call(null, effect_anns, name$0, effect_names); + var P = Sx_runtime[3].call(null, lw); + Sx_runtime[77].call(null, fenv$1, P, effect_anns); + } + return make_cek_value(converted_val, fenv$1, rest_k); + } + var Q = Sx_runtime[1].call(null, cst, [0, match_val, lx]); + if(Sx_types[53].call(null, Q)){ + var + name$1 = Sx_runtime[25].call(null, frame, ly), + fenv$2 = Sx_runtime[25].call(null, frame, lz), + and$0 = Sx_runtime[85].call(null, converted_val); + if(Sx_types[53].call(null, and$0)) + var + R = Sx_types[59].call(null, converted_val), + h = Sx_runtime[83].call(null, R); + else + var h = and$0; + if(Sx_types[53].call(null, h)){ + var S = Sx_runtime[3].call(null, name$1); + Sx_runtime[82].call(null, converted_val, S); + } + var T = Sx_runtime[3].call(null, name$1); + Sx_runtime[77].call(null, fenv$2, T, converted_val); + return make_cek_value(converted_val, fenv$2, rest_k); + } + var U = Sx_runtime[1].call(null, cst, [0, match_val, lA]); + if(Sx_types[53].call(null, U)){ + var + name$2 = Sx_runtime[25].call(null, frame, lB), + fenv$3 = Sx_runtime[25].call(null, frame, lC), + V = Sx_runtime[3].call(null, name$2); + Sx_runtime[78].call(null, fenv$3, V, converted_val); + return make_cek_value(converted_val, env, rest_k); + } + var W = Sx_runtime[1].call(null, cst, [0, match_val, lD]); + if(Sx_types[53].call(null, W)){ + var X = [0, 1 - Sx_types[53].call(null, converted_val)]; + if(Sx_types[53].call(null, X)) + return make_cek_value(converted_val, env, rest_k); + var + remaining$1 = Sx_runtime[25].call(null, frame, lE), + Y = Sx_runtime[33].call(null, remaining$1); + if(Sx_types[53].call(null, Y)) + return make_cek_value(converted_val, env, rest_k); + var + Z = [0, Sx_runtime[24].call(null, remaining$1), lF], + _ = Sx_runtime[1].call(null, cst, Z); + if(Sx_types[53].call(null, _)) + var rest_k$0 = rest_k; + else + var + aa = Sx_runtime[25].call(null, frame, lH), + rest_k$0 = + kont_push + (make_and_frame(Sx_runtime[15].call(null, remaining$1), aa), rest_k); + var $ = Sx_runtime[25].call(null, frame, lG); + return make_cek_state + (Sx_runtime[14].call(null, remaining$1), $, rest_k$0); + } + var ab = Sx_runtime[1].call(null, cst, [0, match_val, lI]); + if(Sx_types[53].call(null, ab)){ + if(Sx_types[53].call(null, converted_val)) + return make_cek_value(converted_val, env, rest_k); + var + remaining$2 = Sx_runtime[25].call(null, frame, lJ), + ac = Sx_runtime[33].call(null, remaining$2); + if(Sx_types[53].call(null, ac)) return make_cek_value(lK, env, rest_k); + var + ad = [0, Sx_runtime[24].call(null, remaining$2), lL], + ae = Sx_runtime[1].call(null, cst, ad); + if(Sx_types[53].call(null, ae)) + var rest_k$1 = rest_k; + else + var + ag = Sx_runtime[25].call(null, frame, lN), + rest_k$1 = + kont_push + (make_or_frame(Sx_runtime[15].call(null, remaining$2), ag), rest_k); + var af = Sx_runtime[25].call(null, frame, lM); + return make_cek_state + (Sx_runtime[14].call(null, remaining$2), af, rest_k$1); + } + var ah = Sx_runtime[1].call(null, cst, [0, match_val, lO]); + if(Sx_types[53].call(null, ah)){ + var + remaining$3 = Sx_runtime[25].call(null, frame, lP), + fenv$4 = Sx_runtime[25].call(null, frame, lQ), + scheme_p = Sx_runtime[25].call(null, frame, lR); + if(! Sx_types[53].call(null, scheme_p)){ + if(Sx_types[53].call(null, converted_val)) + return make_cek_state + (Sx_runtime[17].call(null, remaining$3, l1), fenv$4, rest_k); + var + aq = + [0, + remaining$3, + [0, l2, [0, Sx_runtime[24].call(null, remaining$3), 0]]], + next = Sx_runtime[1].call(null, cst_slice, aq), + ar = [0, Sx_runtime[24].call(null, next), l3], + as = Sx_runtime[1].call(null, cst$2, ar); + if(Sx_types[53].call(null, as)) + return make_cek_value(0, fenv$4, rest_k); + var + next_test$0 = Sx_runtime[14].call(null, next), + at = is_else_clause(next_test$0); + return Sx_types[53].call(null, at) + ? make_cek_state + (Sx_runtime[17].call(null, next, l4), fenv$4, rest_k) + : make_cek_state + (next_test$0, + fenv$4, + kont_push(make_cond_frame(next, fenv$4, l5), rest_k)); + } + if(! Sx_types[53].call(null, converted_val)){ + var + next_clauses = Sx_runtime[15].call(null, remaining$3), + ao = Sx_runtime[33].call(null, next_clauses); + if(Sx_types[53].call(null, ao)) + return make_cek_value(0, fenv$4, rest_k); + var + next_clause = Sx_runtime[14].call(null, next_clauses), + next_test = Sx_runtime[14].call(null, next_clause), + ap = is_else_clause(next_test); + return Sx_types[53].call(null, ap) + ? make_cek_state + (Sx_runtime[17].call(null, next_clause, lZ), fenv$4, rest_k) + : make_cek_state + (next_test, + fenv$4, + kont_push(make_cond_frame(next_clauses, fenv$4, l0), rest_k)); + } + var + clause = Sx_runtime[14].call(null, remaining$3), + ai = [0, Sx_runtime[24].call(null, clause), lS], + and$1 = Sx_runtime[1].call(null, cst$7, ai); + if(Sx_types[53].call(null, and$1)){ + var + aj = Sx_runtime[17].call(null, clause, lU), + ak = [0, Sx_runtime[73].call(null, aj), lT], + and$2 = Sx_runtime[1].call(null, cst, ak); + if(Sx_types[53].call(null, and$2)) + var + al = Sx_runtime[17].call(null, clause, lW), + am = [0, Sx_types[54].call(null, al), lV], + b = Sx_runtime[1].call(null, cst, am); + else + var b = and$2; + } + else + var b = and$1; + if(! Sx_types[53].call(null, b)) + return make_cek_state + (Sx_runtime[17].call(null, clause, lY), fenv$4, rest_k); + var an = kont_push(make_cond_arrow_frame(converted_val, fenv$4), rest_k); + return make_cek_state(Sx_runtime[17].call(null, clause, lX), fenv$4, an); + } + var au = Sx_runtime[1].call(null, cst, [0, match_val, l6]); + if(Sx_types[53].call(null, au)){ + var + match_val$0 = Sx_runtime[25].call(null, frame, l7), + remaining$4 = Sx_runtime[25].call(null, frame, l8), + fenv$5 = Sx_runtime[25].call(null, frame, l9), + av = Sx_runtime[83].call(null, match_val$0); + return Sx_types[53].call(null, av) + ? sf_case_step_loop(converted_val, remaining$4, fenv$5, rest_k) + : sf_case_step_loop(match_val$0, remaining$4, fenv$5, rest_k); + } + var aw = Sx_runtime[1].call(null, cst, [0, match_val, l_]); + if(Sx_types[53].call(null, aw)){ + var + remaining$5 = Sx_runtime[25].call(null, frame, l$), + fenv$6 = Sx_runtime[25].call(null, frame, ma), + mode = Sx_runtime[25].call(null, frame, mb), + bind_name = Sx_runtime[25].call(null, frame, mc), + ax = Sx_runtime[33].call(null, remaining$5); + if(Sx_types[53].call(null, ax)) + return make_cek_value(converted_val, fenv$6, rest_k); + var + form = Sx_runtime[14].call(null, remaining$5), + rest_forms = Sx_runtime[15].call(null, remaining$5), + ay = Sx_runtime[15].call(null, remaining$5), + az = Sx_runtime[33].call(null, ay), + new_kont = + Sx_types[53].call(null, az) + ? rest_k + : kont_push + (make_thread_frame + (Sx_runtime[15].call(null, remaining$5), fenv$6, mode, bind_name), + rest_k), + aA = Sx_runtime[1].call(null, cst, [0, mode, md]); + if(Sx_types[53].call(null, aA)){ + var + new_env = Sx_runtime[80].call(null, fenv$6), + aB = Sx_types[54].call(null, bind_name), + aC = Sx_runtime[3].call(null, aB); + Sx_runtime[77].call(null, new_env, aC, converted_val); + return make_cek_state(form, new_env, new_kont); + } + var + aD = [0, Sx_runtime[73].call(null, form), me], + and$3 = Sx_runtime[1].call(null, cst, aD); + if(Sx_types[53].call(null, and$3)){ + var + aE = Sx_runtime[33].call(null, form), + and$4 = [0, 1 - Sx_types[53].call(null, aE)]; + if(Sx_types[53].call(null, and$4)){ + var + aF = Sx_runtime[14].call(null, form), + aG = [0, Sx_runtime[73].call(null, aF), mf], + and$5 = Sx_runtime[1].call(null, cst, aG); + if(Sx_types[53].call(null, and$5)) + var + aH = Sx_runtime[14].call(null, form), + a = ho_form_name_p(Sx_types[54].call(null, aH)); + else + var a = and$5; + } + else + var a = and$4; + } + else + var a = and$3; + if(Sx_types[53].call(null, a)){ + var + aI = Sx_runtime[15].call(null, form), + aJ = Sx_runtime[18].call(null, [5, [0, mg, [0, converted_val, 0]]], aI), + aK = Sx_runtime[14].call(null, form); + return make_cek_state + (Sx_runtime[18].call(null, aK, aJ), fenv$6, new_kont); + } + var aL = Sx_runtime[1].call(null, cst, [0, mode, mh]); + if(Sx_types[53].call(null, aL)){ + var + result = thread_insert_arg_last(form, converted_val, fenv$6), + aM = Sx_runtime[33].call(null, rest_forms); + return Sx_types[53].call(null, aM) + ? make_cek_value(result, fenv$6, rest_k) + : make_cek_value + (result, + fenv$6, + kont_push + (make_thread_frame(rest_forms, fenv$6, mode, bind_name), + rest_k)); + } + var + result$0 = thread_insert_arg(form, converted_val, fenv$6), + aN = Sx_runtime[33].call(null, rest_forms); + return Sx_types[53].call(null, aN) + ? make_cek_value(result$0, fenv$6, rest_k) + : make_cek_value + (result$0, + fenv$6, + kont_push + (make_thread_frame(rest_forms, fenv$6, mode, bind_name), + rest_k)); + } + var aO = Sx_runtime[1].call(null, cst, [0, match_val, mi]); + if(Sx_types[53].call(null, aO)){ + var + f = Sx_runtime[25].call(null, frame, mj), + evaled = Sx_runtime[25].call(null, frame, mk), + remaining$6 = Sx_runtime[25].call(null, frame, ml), + fenv$7 = Sx_runtime[25].call(null, frame, mm), + raw_args = Sx_runtime[25].call(null, frame, mn), + hname = Sx_runtime[25].call(null, frame, mo), + aP = Sx_runtime[83].call(null, f); + if(Sx_types[53].call(null, aP)){ + var + and$6 = strict_ref[1], + hname$0 = Sx_types[53].call(null, and$6) ? hname : and$6; + if(Sx_types[53].call(null, hname$0)) strict_check_args(hname, mp); + var aQ = Sx_runtime[33].call(null, remaining$6); + if(Sx_types[53].call(null, aQ)) + return continue_with_call(converted_val, mq, fenv$7, raw_args, rest_k); + var + aR = + kont_push + (make_arg_frame + (converted_val, + mr, + Sx_runtime[15].call(null, remaining$6), + fenv$7, + raw_args, + hname), + rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$6), fenv$7, aR); + } + var + new_evaled = + Sx_runtime[1].call + (null, cst_append, [0, evaled, [0, [5, [0, converted_val, 0]], 0]]), + aS = Sx_runtime[33].call(null, remaining$6); + if(! Sx_types[53].call(null, aS)){ + var + aT = + kont_push + (make_arg_frame + (f, + new_evaled, + Sx_runtime[15].call(null, remaining$6), + fenv$7, + raw_args, + hname), + rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$6), fenv$7, aT); + } + var + and$7 = strict_ref[1], + hname$1 = Sx_types[53].call(null, and$7) ? hname : and$7; + if(Sx_types[53].call(null, hname$1)) + strict_check_args(hname, new_evaled); + return continue_with_call(f, new_evaled, fenv$7, raw_args, rest_k); + } + var aU = Sx_runtime[1].call(null, cst, [0, match_val, ms]); + if(Sx_types[53].call(null, aU)){ + var + remaining$7 = Sx_runtime[25].call(null, frame, mt), + results = Sx_runtime[25].call(null, frame, mu), + fenv$8 = Sx_runtime[25].call(null, frame, mv), + last_result = Sx_runtime[16].call(null, results), + aV = + [0, + [5, + [0, + [5, + [0, Sx_runtime[14].call(null, last_result), [0, converted_val, 0]]], + 0]], + 0], + aW = [0, Sx_runtime[24].call(null, results), 0], + aX = + [0, results, [0, mw, [0, Sx_runtime[1].call(null, cst_dec, aW), 0]]], + aY = [0, Sx_runtime[1].call(null, cst_slice, aX), aV], + completed = Sx_runtime[1].call(null, cst_append, aY), + aZ = Sx_runtime[33].call(null, remaining$7); + if(Sx_types[53].call(null, aZ)){ + var + d = [6, Stdlib_Hashtbl[1].call(null, 0, 0)], + a0 = Sx_runtime[5].call(null, completed); + Stdlib_List[18].call + (null, + function(pair){ + var + a = Sx_runtime[17].call(null, pair, mx), + b = Sx_runtime[14].call(null, pair); + Sx_runtime[11].call(null, d, b, a); + return 0; + }, + a0); + return make_cek_value(d, fenv$8, rest_k); + } + var + next_entry = Sx_runtime[14].call(null, remaining$7), + a1 = + [0, + completed, + [0, + [5, [0, [5, [0, Sx_runtime[14].call(null, next_entry), 0]], 0]], + 0]], + a2 = Sx_runtime[1].call(null, cst_append, a1), + a3 = + kont_push + (make_dict_frame(Sx_runtime[15].call(null, remaining$7), a2, fenv$8), + rest_k); + return make_cek_state + (Sx_runtime[17].call(null, next_entry, my), fenv$8, a3); + } + var a4 = Sx_runtime[1].call(null, cst, [0, match_val, mz]); + if(Sx_types[53].call(null, a4)){ + var + ho_type = Sx_runtime[25].call(null, frame, mA), + remaining$8 = Sx_runtime[25].call(null, frame, mB), + a5 = + [0, + Sx_runtime[25].call(null, frame, mC), + [0, [5, [0, converted_val, 0]], 0]], + evaled$0 = Sx_runtime[1].call(null, cst_append, a5), + fenv$9 = Sx_runtime[25].call(null, frame, mD), + a6 = Sx_runtime[33].call(null, remaining$8); + if(Sx_types[53].call(null, a6)) + return ho_setup_dispatch(ho_type, evaled$0, fenv$9, rest_k); + var + a7 = + kont_push + (make_ho_setup_frame + (ho_type, Sx_runtime[15].call(null, remaining$8), evaled$0, fenv$9), + rest_k); + return make_cek_state(Sx_runtime[14].call(null, remaining$8), fenv$9, a7); + } + var a8 = Sx_runtime[1].call(null, cst, [0, match_val, mE]); + if(Sx_types[53].call(null, a8)) + return make_cek_value(converted_val, env, rest_k); + var a9 = Sx_runtime[1].call(null, cst, [0, match_val, mF]); + if(Sx_types[53].call(null, a9)){ + var + fenv$10 = Sx_runtime[25].call(null, frame, mG), + a_ = Sx_runtime[89].call(null, converted_val), + a$ = [0, 1 - Sx_types[53].call(null, a_)]; + if(Sx_types[53].call(null, a$)) + return make_cek_value(converted_val, fenv$10, rest_k); + var ba = has_reactive_reset_frame_p(rest_k); + if(Sx_types[53].call(null, ba)) + return reactive_shift_deref(converted_val, fenv$10, rest_k); + var ctx = Sx_runtime[71].call(null, mH, 0); + if(Sx_types[53].call(null, ctx)){ + var + dep_list = Sx_runtime[25].call(null, ctx, mI), + notify_fn = Sx_runtime[25].call(null, ctx, mJ), + bb = + Sx_runtime[1].call + (null, cst_contains, [0, dep_list, [0, converted_val, 0]]), + bc = [0, 1 - Sx_types[53].call(null, bb)]; + if(Sx_types[53].call(null, bc)){ + Sx_runtime[10].call(null, dep_list, converted_val); + Sx_runtime[114].call(null, converted_val, notify_fn); + } + } + return make_cek_value + (Sx_runtime[113].call(null, converted_val), fenv$10, rest_k); + } + var bd = Sx_runtime[1].call(null, cst, [0, match_val, mK]); + if(Sx_types[53].call(null, bd)){ + var + update_fn = Sx_runtime[25].call(null, frame, mL), + first_p = Sx_runtime[25].call(null, frame, mM), + be = + Sx_types[53].call(null, update_fn) + ? [0, 1 - Sx_types[53].call(null, first_p)] + : update_fn; + if(Sx_types[53].call(null, be)) + cek_call(update_fn, [5, [0, converted_val, 0]]); + return make_cek_value(converted_val, env, rest_k); + } + var bf = Sx_runtime[1].call(null, cst, [0, match_val, mN]); + if(Sx_types[53].call(null, bf)){ + var + name$3 = Sx_runtime[25].call(null, frame, mO), + remaining$9 = Sx_runtime[25].call(null, frame, mP), + fenv$11 = Sx_runtime[25].call(null, frame, mQ), + bg = Sx_runtime[33].call(null, remaining$9); + if(Sx_types[53].call(null, bg)){ + Sx_runtime[103].call(null, name$3); + return make_cek_value(converted_val, fenv$11, rest_k); + } + var + bh = + kont_push + (make_scope_frame + (name$3, Sx_runtime[15].call(null, remaining$9), fenv$11), + rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$9), fenv$11, bh); + } + var bi = Sx_runtime[1].call(null, cst, [0, match_val, mR]); + if(Sx_types[53].call(null, bi)){ + var + remaining$10 = Sx_runtime[25].call(null, frame, mS), + fenv$12 = Sx_runtime[25].call(null, frame, mT), + bj = Sx_runtime[33].call(null, remaining$10); + if(Sx_types[53].call(null, bj)){ + var bk = Sx_runtime[25].call(null, frame, mU); + Sx_runtime[103].call(null, bk); + return make_cek_value(converted_val, fenv$12, rest_k); + } + var + bl = Sx_runtime[15].call(null, remaining$10), + bm = Sx_runtime[25].call(null, frame, mV), + new_frame = + make_provide_frame + (Sx_runtime[25].call(null, frame, mW), bm, bl, fenv$12), + bn = Sx_runtime[25].call(null, frame, mX); + Sx_runtime[11].call(null, new_frame, mY, bn); + var bo = kont_push(new_frame, rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$10), fenv$12, bo); + } + var bp = Sx_runtime[1].call(null, cst, [0, match_val, mZ]); + if(Sx_types[53].call(null, bp)){ + var + tracked = bind_tracking_ref[1], + body$1 = Sx_runtime[25].call(null, frame, m0), + fenv$13 = Sx_runtime[25].call(null, frame, m1), + prev = Sx_runtime[25].call(null, frame, m2); + bind_tracking_ref[1] = prev; + var + subscriber = + [14, + cst$9, + function(args){ + if(args && ! args[2]) + return cek_run(make_cek_state(body$1, fenv$13, m3)); + return 0; + }], + bq = Sx_runtime[5].call(null, tracked); + Stdlib_List[18].call + (null, + function(name){ + var + existing = + Sx_runtime[25].call(null, provide_subscribers_ref[1], name), + existing$0 = Sx_types[53].call(null, existing) ? existing : m4, + a = + Sx_runtime[1].call + (null, + cst_append, + [0, existing$0, [0, [5, [0, subscriber, 0]], 0]]); + Sx_runtime[11].call(null, provide_subscribers_ref[1], name, a); + return 0; + }, + bq); + return make_cek_value(converted_val, fenv$13, rest_k); + } + var br = Sx_runtime[1].call(null, cst, [0, match_val, m5]); + if(Sx_types[53].call(null, br)){ + var + name$4 = Sx_runtime[25].call(null, frame, m6), + fenv$14 = Sx_runtime[25].call(null, frame, m7), + target = kont_find_provide(rest_k, name$4), + old_val = + Sx_types[53].call(null, target) + ? Sx_runtime[25].call(null, target, m8) + : Sx_runtime[104].call(null, name$4); + if(Sx_types[53].call(null, target)) + Sx_runtime[11].call(null, target, m9, converted_val); + Sx_runtime[103].call(null, name$4); + Sx_runtime[102].call(null, name$4, converted_val); + var + bs = Sx_runtime[1].call(null, cst, [0, old_val, [0, converted_val, 0]]), + bt = [0, 1 - Sx_types[53].call(null, bs)]; + if(Sx_types[53].call(null, bt)) fire_provide_subscribers(name$4); + return make_cek_value(converted_val, fenv$14, rest_k); + } + var bu = Sx_runtime[1].call(null, cst, [0, match_val, m_]); + if(Sx_types[53].call(null, bu)){ + var + remaining$11 = Sx_runtime[25].call(null, frame, m$), + fenv$15 = Sx_runtime[25].call(null, frame, na), + bv = Sx_runtime[33].call(null, remaining$11); + if(Sx_types[53].call(null, bv)) + return make_cek_value(converted_val, fenv$15, rest_k); + var + bw = Sx_runtime[15].call(null, remaining$11), + bx = Sx_runtime[25].call(null, frame, nb), + new_frame$0 = + make_scope_acc_frame + (Sx_runtime[25].call(null, frame, nc), bx, bw, fenv$15), + by = Sx_runtime[25].call(null, frame, nd); + Sx_runtime[11].call(null, new_frame$0, ne, by); + var bz = kont_push(new_frame$0, rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$11), fenv$15, bz); + } + var bA = Sx_runtime[1].call(null, cst, [0, match_val, nf]); + if(Sx_types[53].call(null, bA)){ + var + f$0 = Sx_runtime[25].call(null, frame, ng), + remaining$12 = Sx_runtime[25].call(null, frame, nh), + results$0 = Sx_runtime[25].call(null, frame, ni), + indexed = Sx_runtime[25].call(null, frame, nj), + fenv$16 = Sx_runtime[25].call(null, frame, nk), + new_results = + Sx_runtime[1].call + (null, + cst_append, + [0, results$0, [0, [5, [0, converted_val, 0]], 0]]), + bB = Sx_runtime[33].call(null, remaining$12); + if(Sx_types[53].call(null, bB)) + return make_cek_value(new_results, fenv$16, rest_k); + if(Sx_types[53].call(null, indexed)) + var + bC = [0, Sx_runtime[14].call(null, remaining$12), 0], + call_args = [5, [0, Sx_runtime[24].call(null, new_results), bC]]; + else + var call_args = [5, [0, Sx_runtime[14].call(null, remaining$12), 0]]; + var + next_frame = + Sx_types[53].call(null, indexed) + ? make_map_indexed_frame + (f$0, + Sx_runtime[15].call(null, remaining$12), + new_results, + fenv$16) + : make_map_frame + (f$0, + Sx_runtime[15].call(null, remaining$12), + new_results, + fenv$16); + return continue_with_call + (f$0, call_args, fenv$16, nl, kont_push(next_frame, rest_k)); + } + var bD = Sx_runtime[1].call(null, cst, [0, match_val, nm]); + if(Sx_types[53].call(null, bD)){ + var + f$1 = Sx_runtime[25].call(null, frame, nn), + remaining$13 = Sx_runtime[25].call(null, frame, no), + results$1 = Sx_runtime[25].call(null, frame, np), + current_item = Sx_runtime[25].call(null, frame, nq), + fenv$17 = Sx_runtime[25].call(null, frame, nr), + new_results$0 = + Sx_types[53].call(null, converted_val) + ? Sx_runtime + [1].call + (null, + cst_append, + [0, results$1, [0, [5, [0, current_item, 0]], 0]]) + : results$1, + bE = Sx_runtime[33].call(null, remaining$13); + if(Sx_types[53].call(null, bE)) + return make_cek_value(new_results$0, fenv$17, rest_k); + var + bF = Sx_runtime[14].call(null, remaining$13), + bG = + kont_push + (make_filter_frame + (f$1, + Sx_runtime[15].call(null, remaining$13), + new_results$0, + bF, + fenv$17), + rest_k); + return continue_with_call + (f$1, + [5, [0, Sx_runtime[14].call(null, remaining$13), 0]], + fenv$17, + ns, + bG); + } + var bH = Sx_runtime[1].call(null, cst, [0, match_val, nt]); + if(Sx_types[53].call(null, bH)){ + var + f$2 = Sx_runtime[25].call(null, frame, nu), + remaining$14 = Sx_runtime[25].call(null, frame, nv), + fenv$18 = Sx_runtime[25].call(null, frame, nw), + bI = Sx_runtime[33].call(null, remaining$14); + if(Sx_types[53].call(null, bI)) + return make_cek_value(converted_val, fenv$18, rest_k); + var + bJ = + kont_push + (make_reduce_frame + (f$2, Sx_runtime[15].call(null, remaining$14), fenv$18), + rest_k); + return continue_with_call + (f$2, + [5, + [0, + converted_val, + [0, Sx_runtime[14].call(null, remaining$14), 0]]], + fenv$18, + nx, + bJ); + } + var bK = Sx_runtime[1].call(null, cst, [0, match_val, ny]); + if(Sx_types[53].call(null, bK)){ + var + f$3 = Sx_runtime[25].call(null, frame, nz), + remaining$15 = Sx_runtime[25].call(null, frame, nA), + fenv$19 = Sx_runtime[25].call(null, frame, nB), + bL = Sx_runtime[33].call(null, remaining$15); + if(Sx_types[53].call(null, bL)) + return make_cek_value(0, fenv$19, rest_k); + var + bM = + kont_push + (make_for_each_frame + (f$3, Sx_runtime[15].call(null, remaining$15), fenv$19), + rest_k); + return continue_with_call + (f$3, + [5, [0, Sx_runtime[14].call(null, remaining$15), 0]], + fenv$19, + nC, + bM); + } + var bN = Sx_runtime[1].call(null, cst, [0, match_val, nD]); + if(Sx_types[53].call(null, bN)){ + var + f$4 = Sx_runtime[25].call(null, frame, nE), + remaining$16 = Sx_runtime[25].call(null, frame, nF), + fenv$20 = Sx_runtime[25].call(null, frame, nG); + if(Sx_types[53].call(null, converted_val)) + return make_cek_value(converted_val, fenv$20, rest_k); + var bO = Sx_runtime[33].call(null, remaining$16); + if(Sx_types[53].call(null, bO)) + return make_cek_value(nH, fenv$20, rest_k); + var + bP = + kont_push + (make_some_frame + (f$4, Sx_runtime[15].call(null, remaining$16), fenv$20), + rest_k); + return continue_with_call + (f$4, + [5, [0, Sx_runtime[14].call(null, remaining$16), 0]], + fenv$20, + nI, + bP); + } + var bQ = Sx_runtime[1].call(null, cst, [0, match_val, nJ]); + if(Sx_types[53].call(null, bQ)){ + var + f$5 = Sx_runtime[25].call(null, frame, nK), + remaining$17 = Sx_runtime[25].call(null, frame, nL), + fenv$21 = Sx_runtime[25].call(null, frame, nM), + bR = [0, 1 - Sx_types[53].call(null, converted_val)]; + if(Sx_types[53].call(null, bR)) + return make_cek_value(nN, fenv$21, rest_k); + var bS = Sx_runtime[33].call(null, remaining$17); + if(Sx_types[53].call(null, bS)) + return make_cek_value(nO, fenv$21, rest_k); + var + bT = + kont_push + (make_every_frame + (f$5, Sx_runtime[15].call(null, remaining$17), fenv$21), + rest_k); + return continue_with_call + (f$5, + [5, [0, Sx_runtime[14].call(null, remaining$17), 0]], + fenv$21, + nP, + bT); + } + var bU = Sx_runtime[1].call(null, cst, [0, match_val, nQ]); + if(Sx_types[53].call(null, bU)){ + var + remaining$18 = Sx_runtime[25].call(null, frame, nR), + fenv$22 = Sx_runtime[25].call(null, frame, nS), + bV = Sx_runtime[33].call(null, remaining$18); + if(Sx_types[53].call(null, bV)) + return make_cek_value(converted_val, fenv$22, rest_k); + var + bW = Sx_runtime[15].call(null, remaining$18), + bX = + kont_push + (make_handler_frame + (Sx_runtime[25].call(null, frame, nT), bW, fenv$22), + rest_k); + return make_cek_state + (Sx_runtime[14].call(null, remaining$18), fenv$22, bX); + } + var bY = Sx_runtime[1].call(null, cst, [0, match_val, nU]); + if(Sx_types[53].call(null, bY)) + return make_cek_value(converted_val, env, rest_k); + var bZ = Sx_runtime[1].call(null, cst, [0, match_val, nV]); + if(Sx_types[53].call(null, bZ)){ + var saved_kont = Sx_runtime[25].call(null, frame, nW); + return make_cek_value + (converted_val, Sx_runtime[25].call(null, frame, nX), saved_kont); + } + var b0 = Sx_runtime[1].call(null, cst, [0, match_val, nY]); + if(Sx_types[53].call(null, b0)) + return make_cek_value(converted_val, env, rest_k); + var b1 = Sx_runtime[1].call(null, cst, [0, match_val, nZ]); + if(Sx_types[53].call(null, b1)){ + var + test_value = Sx_runtime[25].call(null, frame, n0), + fenv$23 = Sx_runtime[25].call(null, frame, n1); + return continue_with_call + (converted_val, + [5, [0, test_value, 0]], + fenv$23, + [5, [0, test_value, 0]], + rest_k); + } + var b2 = Sx_runtime[1].call(null, cst, [0, match_val, n2]); + if(Sx_types[53].call(null, b2)){ + var + fenv$24 = Sx_runtime[25].call(null, frame, n3), + continuable_p = Sx_runtime[25].call(null, frame, n4), + handler_fn = kont_find_handler(rest_k, converted_val), + b3 = Sx_runtime[83].call(null, handler_fn); + if(Sx_types[53].call(null, b3)){ + last_error_kont_ref[1] = rest_k; + var + b4 = [0, n5, [0, Sx_runtime[68].call(null, converted_val), 0]], + b5 = [2, Sx_runtime[4].call(null, b4)]; + return Sx_runtime[100].call(null, b5); + } + var + b6 = + Sx_types[53].call(null, continuable_p) + ? kont_push(make_signal_return_frame(fenv$24, rest_k), rest_k) + : kont_push(make_raise_guard_frame(fenv$24, rest_k), rest_k); + return continue_with_call + (handler_fn, + [5, [0, converted_val, 0]], + fenv$24, + [5, [0, converted_val, 0]], + b6); + } + var b7 = Sx_runtime[1].call(null, cst, [0, match_val, n6]); + if(Sx_types[53].call(null, b7)){ + last_error_kont_ref[1] = rest_k; + return Sx_runtime[100].call(null, n7); + } + var b8 = Sx_runtime[1].call(null, cst, [0, match_val, n8]); + if(Sx_types[53].call(null, b8)){ + var + f$6 = Sx_runtime[25].call(null, frame, n9), + remaining$19 = Sx_runtime[25].call(null, frame, n_), + b9 = + [0, + Sx_runtime[25].call(null, frame, n$), + [0, [5, [0, converted_val, 0]], 0]], + new_results$1 = Sx_runtime[1].call(null, cst_append, b9), + fenv$25 = Sx_runtime[25].call(null, frame, oa), + b_ = Sx_runtime[5].call(null, remaining$19), + b$ = + [0, + Stdlib_List[34].call + (null, + function(c){ + var a = Sx_runtime[33].call(null, c); + return Sx_types[53].call(null, a); + }, + b_)]; + if(Sx_types[53].call(null, b$)) + return make_cek_value(new_results$1, fenv$25, rest_k); + var + ca = Sx_runtime[5].call(null, remaining$19), + heads = + [5, + Stdlib_List[20].call + (null, function(c){return Sx_runtime[14].call(null, c);}, ca)], + cb = Sx_runtime[5].call(null, remaining$19), + tails = + [5, + Stdlib_List[20].call + (null, function(c){return Sx_runtime[15].call(null, c);}, cb)]; + return continue_with_call + (f$6, + heads, + fenv$25, + ob, + kont_push + (make_multi_map_frame(f$6, tails, new_results$1, fenv$25), + rest_k)); + } + var cc = Sx_runtime[1].call(null, cst, [0, match_val, oc]); + if(Sx_types[53].call(null, cc)){ + var k = Sx_runtime[98].call(null, rest_k); + return continue_with_call + (converted_val, + [5, [0, k, 0]], + Sx_runtime[25].call(null, frame, od), + [5, [0, k, 0]], + rest_k); + } + var cd = Sx_runtime[1].call(null, cst, [0, match_val, oe]); + if(Sx_types[53].call(null, cd)){ + var + resume_fn = Sx_runtime[25].call(null, frame, of), + result$1 = + Sx_runtime[7].call(null, resume_fn, [5, [0, converted_val, 0]]), + and$8 = Sx_runtime[38].call(null, result$1), + ce = + Sx_types[53].call(null, and$8) + ? Sx_runtime[25].call(null, result$1, og) + : and$8; + if(! Sx_types[53].call(null, ce)) + return make_cek_value + (result$1, Sx_runtime[25].call(null, frame, ol), rest_k); + var + cf = Sx_runtime[25].call(null, frame, oh), + cg = + kont_push + (make_vm_resume_frame(Sx_runtime[25].call(null, result$1, oi), cf), + rest_k), + ch = Sx_runtime[25].call(null, frame, oj); + return make_cek_suspended + (Sx_runtime[25].call(null, result$1, ok), ch, cg); + } + var ci = Sx_runtime[1].call(null, cst, [0, match_val, om]); + if(Sx_types[53].call(null, ci)) + return make_cek_suspended + (converted_val, Sx_runtime[25].call(null, frame, on), rest_k); + var cj = Sx_runtime[1].call(null, cst, [0, match_val, oo]); + if(Sx_types[53].call(null, cj)){ + var + import_set = Sx_runtime[25].call(null, frame, op), + remaining_sets = Sx_runtime[25].call(null, frame, oq), + fenv$26 = Sx_runtime[25].call(null, frame, or); + bind_import_set(import_set, fenv$26); + var ck = Sx_runtime[33].call(null, remaining_sets); + return Sx_types[53].call(null, ck) + ? make_cek_value(0, fenv$26, rest_k) + : step_sf_import(remaining_sets, fenv$26, rest_k); + } + var cl = Sx_runtime[1].call(null, cst, [0, match_val, os]); + if(! Sx_types[53].call(null, cl)){ + last_error_kont_ref[1] = rest_k; + var + cu = [2, Sx_runtime[4].call(null, [0, oB, [0, match_val, 0]])], + cv = Sx_runtime[2].call(null, cu); + throw caml_maybe_attach_backtrace([0, Sx_types[9], cv], 1); + } + var + remaining$20 = Sx_runtime[25].call(null, frame, ot), + current_param = Sx_runtime[25].call(null, frame, ou), + results$2 = Sx_runtime[25].call(null, frame, ov), + body$2 = Sx_runtime[25].call(null, frame, ow), + fenv$27 = Sx_runtime[25].call(null, frame, ox), + cm = Sx_runtime[83].call(null, current_param); + if(Sx_types[53].call(null, cm)){ + var + cn = Sx_runtime[14].call(null, remaining$20), + val_expr = Sx_runtime[17].call(null, cn, oy); + return make_cek_state + (val_expr, + fenv$27, + kont_push + (make_parameterize_frame + (remaining$20, converted_val, results$2, body$2, fenv$27), + rest_k)); + } + var + co = + [0, + results$2, + [0, + [5, + [0, + [5, + [0, Sx_types[88].call(null, current_param), [0, converted_val, 0]]], + 0]], + 0]], + new_results$2 = Sx_runtime[1].call(null, cst_append, co), + rest_bindings = Sx_runtime[15].call(null, remaining$20), + cp = Sx_runtime[33].call(null, rest_bindings); + if(Sx_types[53].call(null, cp)){ + var + cq = [0, Sx_runtime[24].call(null, body$2), oz], + cr = Sx_runtime[1].call(null, cst, cq), + body_expr = + Sx_types[53].call(null, cr) + ? Sx_runtime[14].call(null, body$2) + : Sx_runtime[18].call(null, oA, body$2), + provide_kont = kont_push_provides(new_results$2, fenv$27, rest_k); + return make_cek_state(body_expr, fenv$27, provide_kont); + } + var + cs = + kont_push + (make_parameterize_frame + (rest_bindings, 0, new_results$2, body$2, fenv$27), + rest_k), + ct = Sx_runtime[14].call(null, rest_bindings); + return make_cek_state(Sx_runtime[14].call(null, ct), fenv$27, cs); + } + var + oC = [2, cst_value], + oD = [2, "captured"], + oE = [0, 0], + oF = [2, "message"], + oG = [2, cst_vm_suspended], + oH = [2, cst_resume], + oI = [2, cst_request], + oJ = [2, cst_args_got], + oK = [2, cst_expects], + oL = [2, cst_lambda], + oM = [1, 1.], + oN = [2, cst_vm_suspended], + oO = [2, cst_resume], + oP = [2, cst_request], + oQ = [1, 1.], + oR = [2, cst_children], + oS = [2, "Not callable: "]; + function continue_with_call(f, args, env, raw_args, kont){ + var b = Sx_types[87].call(null, f); + if(Sx_types[53].call(null, b)){ + var + uid = Sx_types[88].call(null, f), + frame = kont_find_provide(kont, uid), + c = + Sx_types[53].call(null, frame) + ? Sx_runtime[25].call(null, frame, oC) + : Sx_types[89].call(null, f); + return make_cek_value(c, env, kont); + } + var d = Sx_runtime[97].call(null, f); + if(Sx_types[53].call(null, d)){ + var + e = Sx_runtime[33].call(null, args), + arg = Sx_types[53].call(null, e) ? 0 : Sx_runtime[14].call(null, args), + captured = Sx_runtime[99].call(null, f); + return make_cek_value(arg, env, captured); + } + var g = Sx_runtime[94].call(null, f); + if(Sx_types[53].call(null, g)){ + var + h = Sx_runtime[33].call(null, args), + arg$0 = Sx_types[53].call(null, h) ? 0 : Sx_runtime[14].call(null, args), + cont_data = Sx_runtime[96].call(null, f), + captured$0 = Sx_runtime[25].call(null, cont_data, oD), + result = cek_run(make_cek_value(arg$0, env, captured$0)); + return make_cek_value(result, env, kont); + } + var and = Sx_runtime[90].call(null, f); + if(Sx_types[53].call(null, and)){ + var + i = Sx_runtime[85].call(null, f), + and$0 = [0, 1 - Sx_types[53].call(null, i)]; + if(Sx_types[53].call(null, and$0)){ + var + j = Sx_runtime[86].call(null, f), + and$1 = [0, 1 - Sx_types[53].call(null, j)]; + if(Sx_types[53].call(null, and$1)) + var + k = Sx_runtime[87].call(null, f), + a = [0, 1 - Sx_types[53].call(null, k)]; + else + var a = and$1; + } + else + var a = and$0; + } + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + result$0 = Sx_runtime[8].call(null, f, args), + l = [0, Sx_runtime[9].call(null, result$0)]; + if(Sx_types[53].call(null, l)){ + var m = kont_push(make_raise_eval_frame(env, oE), kont); + return make_cek_value(Sx_runtime[25].call(null, result$0, oF), env, m); + } + var + and$2 = Sx_runtime[38].call(null, result$0), + n = + Sx_types[53].call(null, and$2) + ? Sx_runtime[25].call(null, result$0, oG) + : and$2; + if(! Sx_types[53].call(null, n)) + return make_cek_value(result$0, env, kont); + var + o = + kont_push + (make_vm_resume_frame(Sx_runtime[25].call(null, result$0, oH), env), + kont); + return make_cek_suspended + (Sx_runtime[25].call(null, result$0, oI), env, o); + } + var p = Sx_runtime[85].call(null, f); + if(! Sx_types[53].call(null, p)){ + var + or$1 = Sx_runtime[86].call(null, f), + or$2 = + Sx_types[53].call(null, or$1) ? or$1 : Sx_runtime[87].call(null, f); + if(! Sx_types[53].call(null, or$2)){ + var + P = [0, oS, [0, Sx_runtime[68].call(null, f), 0]], + Q = [2, Sx_runtime[4].call(null, P)], + R = Sx_runtime[2].call(null, Q); + throw caml_maybe_attach_backtrace([0, Sx_types[9], R], 1); + } + var + parsed = parse_keyword_args(raw_args, env), + kwargs = Sx_runtime[14].call(null, parsed), + children = Sx_runtime[17].call(null, parsed, oQ), + I = Sx_types[67].call(null, f), + local$0 = Sx_runtime[81].call(null, I, env), + J = Sx_types[65].call(null, f), + K = Sx_runtime[5].call(null, J); + Stdlib_List[18].call + (null, + function(p){ + var + or = Sx_runtime[56].call(null, kwargs, p), + or$0 = Sx_types[53].call(null, or) ? or : 0, + a = Sx_runtime[3].call(null, p); + Sx_runtime[77].call(null, local$0, a, or$0); + return 0; + }, + K); + var L = Sx_types[68].call(null, f); + if(Sx_types[53].call(null, L)){ + var M = Sx_runtime[3].call(null, oR); + Sx_runtime[77].call(null, local$0, M, children); + } + var + N = Sx_types[62].call(null, f), + O = + kont_push(make_comp_trace_frame(Sx_types[61].call(null, f), N), kont); + return make_cek_state(Sx_types[66].call(null, f), local$0, O); + } + var + params = Sx_types[56].call(null, f), + q = Sx_types[58].call(null, f), + local = Sx_runtime[81].call(null, q, env), + r = bind_lambda_params(params, args, local), + s = [0, 1 - Sx_types[53].call(null, r)]; + if(Sx_types[53].call(null, s)){ + var + t = [0, Sx_runtime[24].call(null, params), 0], + u = [0, Sx_runtime[24].call(null, args), t], + v = Sx_runtime[1].call(null, cst$7, u); + if(Sx_types[53].call(null, v)){ + var + w = [0, oJ, [0, Sx_runtime[24].call(null, args), 0]], + x = [0, oK, [0, Sx_runtime[24].call(null, params), w]], + or = Sx_types[59].call(null, f), + or$0 = Sx_types[53].call(null, or) ? or : oL, + y = [2, Sx_runtime[4].call(null, [0, or$0, x])], + z = Sx_runtime[2].call(null, y); + throw caml_maybe_attach_backtrace([0, Sx_types[9], z], 1); + } + var + A = Sx_runtime[1].call(null, cst_zip, [0, params, [0, args, 0]]), + B = Sx_runtime[5].call(null, A); + Stdlib_List[18].call + (null, + function(pair){ + var + a = Sx_runtime[17].call(null, pair, oM), + b = Sx_runtime[14].call(null, pair), + c = Sx_runtime[3].call(null, b); + Sx_runtime[77].call(null, local, c, a); + return 0; + }, + B); + var + C = [0, params, [0, Sx_runtime[24].call(null, args), 0]], + D = Sx_runtime[1].call(null, cst_slice, C), + E = Sx_runtime[5].call(null, D); + Stdlib_List[18].call + (null, + function(p){ + var a = Sx_runtime[3].call(null, p); + Sx_runtime[77].call(null, local, a, 0); + return 0; + }, + E); + } + var + jit_result = Sx_runtime[136].call(null, f, args), + F = Sx_runtime[135].call(null, jit_result); + if(Sx_types[53].call(null, F)) + return make_cek_state(Sx_types[57].call(null, f), local, kont); + var + and$3 = Sx_runtime[38].call(null, jit_result), + G = + Sx_types[53].call(null, and$3) + ? Sx_runtime[25].call(null, jit_result, oN) + : and$3; + if(! Sx_types[53].call(null, G)) + return make_cek_value(jit_result, local, kont); + var + H = + kont_push + (make_vm_resume_frame(Sx_runtime[25].call(null, jit_result, oO), env), + kont); + return make_cek_suspended + (Sx_runtime[25].call(null, jit_result, oP), env, H); + } + var oT = [0, [1, 2.], 0], oU = [1, 1.], oV = [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[24].call(null, clauses), oT], + b = Sx_runtime[1].call(null, cst$2, a); + if(Sx_types[53].call(null, b)) return make_cek_value(0, env, kont); + var + test = Sx_runtime[14].call(null, clauses), + body = Sx_runtime[17].call(null, clauses, oU), + c = is_else_clause(test); + if(Sx_types[53].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[53].call(null, d)) return make_cek_state(body, env, kont); + var clauses$0 = Sx_runtime[1].call(null, cst_slice, [0, clauses, oV]); + clauses = clauses$0; + } + } + var oW = [5, 0]; + function eval_expr_cek(expr, env){ + return cek_run(make_cek_state(expr, env, oW)); + } + function trampoline_cek(val){ + var a = Sx_runtime[84].call(null, val); + if(! Sx_types[53].call(null, a)) return val; + var b = Sx_types[75].call(null, val); + return eval_expr_cek(Sx_types[74].call(null, val), b); + } + var oX = [5, 0]; + function eval_expr(expr, env){ + return cek_run(make_cek_state(expr, env, oX)); + } + caml_update_dummy + (custom_special_forms, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]); + caml_update_dummy(bind_tracking_ref, [0, 0]); + caml_update_dummy(provide_batch_depth_ref, [0, [1, 0.]]); + caml_update_dummy(provide_batch_queue_ref, [0, [5, 0]]); + caml_update_dummy + (provide_subscribers_ref, [0, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]]); + var provide_subscribers = []; + caml_update_dummy + (provide_subscribers, [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)]); + caml_update_dummy + (foreign_registry, [6, Stdlib_Hashtbl[1].call(null, 0, 0)]); + caml_update_dummy(strict_ref, [0, [0, 0]]); + caml_update_dummy(prim_param_types_ref, [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[9], 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[9]) 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[9], msg], 1); + } + } + var cst$16 = "", 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$3; + 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$0 = cst$16; + if(match$3){ + var match$4 = match$3[1]; + if(typeof match$4 === "number" || ! (2 === match$4[0])) + var file = cst$0; + else + var s = match$4[1], file = s; + } + else + var file = cst$0; + 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$3; + 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$16; + else if(2 === match$6[0]) + var s$1 = match$6[1], file$0 = s$1; + else + var file$0 = cst$16; + 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$16; + 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$16){ + var a = Stdlib[28].call(null, cst$13, name); + return Stdlib[28].call(null, prefix, a); + } + var + b = Stdlib[28].call(null, file, cst$5), + c = Stdlib[28].call(null, cst$6, b), + d = Stdlib[28].call(null, name, c), + e = Stdlib[28].call(null, cst$13, 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 + (1614, + [0, + trampoline_fn, + trampoline, + last_error_kont_ref, + protocol_registry, + 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_define_foreign_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, + thread_insert_arg_last, + 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_bind_frame, + make_provide_set_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, + make_parameterize_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_push_provides, + 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, + bind_tracking_ref, + 0, + provide_batch_depth_ref, + [1, 0.], + provide_batch_queue_ref, + [5, 0], + provide_subscribers_ref, + provide_subscribers, + library_registry, + library_name_key, + library_loaded_p, + library_exports, + register_library, + io_registry, + io_register_b, + io_registered_p, + io_lookup, + io_names, + foreign_registry, + foreign_register_b, + foreign_registered_p, + foreign_lookup, + foreign_names, + foreign_parse_params, + foreign_parse_kwargs_b, + foreign_resolve_binding, + foreign_check_args, + foreign_build_lambda, + sf_define_foreign, + step_sf_define_foreign, + foreign_dispatch, + foreign_parse_params_loop, + step_sf_io, + strict_ref, + [0, 0], + set_strict_b, + prim_param_types_ref, + 0, + 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_sf_callcc, + step_sf_case, + step_sf_let_match, + step_eval_list, + kont_extract_provides, + fire_provide_subscribers, + batch_begin_b, + batch_end_b, + step_sf_bind, + step_sf_parameterize, + syntax_rules_match, + syntax_rules_match_list, + syntax_rules_find_var, + syntax_rules_find_all_vars, + syntax_rules_instantiate, + syntax_rules_instantiate_list, + syntax_rules_expand, + syntax_rules_try_rules, + sf_syntax_rules, + step_sf_define_library, + bind_import_set, + step_sf_import, + step_sf_perform, + sf_define_record_type, + sf_define_protocol, + sf_implement, + satisfies_p, + check_match_exhaustiveness, + 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_thread_first, + step_sf_thread_last, + step_sf_thread_as, + step_sf_lambda, + step_sf_scope, + step_sf_provide, + step_sf_context, + step_sf_peek, + step_sf_provide_b, + 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)); + +//# 16661 "../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)*,F(2),N,N,N,N,N,F(1),F(1),N,F(3),F(1),F(6),F(3),F(3),F(2),F(3),F(1),F(2),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_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_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(), + Stdlib_List = global_data.Stdlib__List, + Stdlib = global_data.Stdlib, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, + Sx_runtime = global_data.Sx_runtime, + Sx_types = global_data.Sx_types, + Sx_primitives = global_data.Sx_primitives, + 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)]; + Sx_types[12][1] = + function(exn){ + if(exn[1] !== VmSuspended) return 0; + var request = exn[2]; + throw caml_maybe_attach_backtrace([0, Sx_types[11], request], 1); + }; + var + jit_compile_ref = [0, function(a, param){return 0;}], + jit_failed_sentinel = + [0, + [0, -1, -1, 0, [0], [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, 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][4], 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][4], a)[a + 1], + b = f[2] + 1 | 0, + hi = caml_check_bound(f[1][1][4], 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[9], 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]; + } + function parse_keyword_args(params, args){ + var + a = Stdlib_List[1].call(null, params), + param_set = Stdlib_Hashtbl[1].call(null, 0, a); + Stdlib_List[18].call + (null, + function(p){return Stdlib_Hashtbl[11].call(null, param_set, p, 1);}, + params); + var + kwargs = Stdlib_Hashtbl[1].call(null, 0, 8), + children = 0, + param = args; + for(;;){ + if(! param) return [0, kwargs, Stdlib_List[10].call(null, children)]; + var v = param[1]; + if(typeof v !== "number") + switch(v[0]){ + case 2: + case 4: + var k = v[1], match = param[2]; + if(match){ + var rest$0 = match[2], v$0 = match[1]; + if(Stdlib_Hashtbl[9].call(null, param_set, k)){ + Stdlib_Hashtbl[11].call(null, kwargs, k, v$0); + param = rest$0; + continue; + } + } + break; + } + var rest = param[2]; + children = [0, v, children]; + param = rest; + } + } + var + vm_comp_jit_count = [0, 0], + vm_comp_cek_count = [0, 0], + 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; + vm_comp_jit_count[1] = 0; + vm_comp_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, + [11, + " comp_jit=", + [4, + 0, + 0, + 0, + [11, " comp_cek=", [4, 0, 0, 0, [12, 10, [10, 0]]]]]]]]]]]], + "[vm-perf] insns=%d calls=%d cek_fallbacks=%d comp_jit=%d comp_cek=%d\n%!"]; + function vm_report_counters(param){ + var + a = vm_comp_cek_count[1], + b = vm_comp_jit_count[1], + c = vm_cek_count[1], + e = vm_call_count[1], + f = vm_insn_count[1]; + return caml_call5(Stdlib_Printf[3].call(null, d), f, e, c, b, a); + } + var e = [5, 0]; + function push_closure_frame(vm, cl, args){ + var + g = Stdlib_Hashtbl[1].call(null, 0, 4), + frame = [0, cl, 0, vm[2], g], + rest_arity = cl[1][2]; + if(0 <= rest_arity){ + var nargs = Stdlib_List[1].call(null, args); + a: + { + b: + { + var i = 0, param = args; + for(;;){ + if(! param) break; + var remaining = param[2], a = param[1]; + if(i >= rest_arity) break b; + push(vm, a); + var i$0 = i + 1 | 0; + i = i$0; + param = remaining; + } + var b = rest_arity - 1 | 0; + if(b >= i){ + var for$ = i; + for(;;){ + push(vm, 0); + var h = for$ + 1 | 0; + if(b === for$) break; + for$ = h; + } + } + push(vm, e); + break a; + } + push(vm, [5, [0, a, remaining]]); + } + var + used = rest_arity < nargs ? rest_arity + 1 | 0 : nargs + 1 | 0, + c = cl[1][3] - 1 | 0; + if(c >= used){ + var for$0 = used; + for(;;){ + push(vm, 0); + var j = for$0 + 1 | 0; + if(c === for$0) break; + for$0 = j; + } + } + } + else{ + Stdlib_List[18].call(null, function(a){return push(vm, a);}, args); + var d = Stdlib_List[1].call(null, args), f = cl[1][3] - 1 | 0; + if(f >= d){ + var for$1 = d; + for(;;){ + push(vm, 0); + var k = for$1 + 1 | 0; + if(f === for$1) break; + for$1 = k; + } + } + } + vm[3] = [0, frame, vm[3]]; + return 0; + } + var + cst_arity = "arity", + cst_bytecode = "bytecode", + cst_constants = "constants", + cst_vc_bytecode = "vc-bytecode"; + function code_from_value(v){ + if(typeof v !== "number" && 6 === v[0]){ + var + d = v[1], + find2 = + function(k1, k2){ + var r = Stdlib_Hashtbl[7].call(null, d, k1); + return r ? r : Stdlib_Hashtbl[7].call(null, d, k2); + }, + match = find2(cst_bytecode, cst_vc_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 + e = + 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, e); + break a; + } + } + var bc_list = [0]; + } + var match$0 = find2(cst_constants, "vc-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){ + a: + if(typeof entry !== "number" && 6 === entry[0]){ + var ed = entry[1]; + if + (! + Stdlib_Hashtbl[9].call(null, ed, cst_bytecode) + && ! Stdlib_Hashtbl[9].call(null, ed, cst_vc_bytecode)) + break a; + return entry; + } + return entry; + }, + entries), + match$1 = find2(cst_arity, "vc-arity"); + a: + { + if(match$1){ + var match$2 = match$1[1]; + if(typeof match$2 !== "number" && 1 === match$2[0]){var n$0 = match$2[1], arity = n$0 | 0; break a;} + } + var arity = 0; + } + var match$3 = find2("rest-arity", "vc-rest-arity"); + a: + { + if(match$3){ + var match$4 = match$3[1]; + if(typeof match$4 !== "number" && 1 === match$4[0]){var n = match$4[1], rest_arity = n | 0; break a;} + } + var rest_arity = -1; + } + var len = bc_list.length - 1, i = 0, max_local = arity - 1 | 0; + for(;;){ + if(i >= len){ + var locals = (max_local + 1 | 0) + 16 | 0; + return [0, arity, rest_arity, locals, bc_list, constants, 0, 0]; + } + var op = caml_check_bound(bc_list, i)[i + 1]; + a: + { + if(16 !== op && 17 !== op) break a; + if((i + 1 | 0) < len){ + var + c = i + 1 | 0, + slot = caml_check_bound(bc_list, c)[c + 1], + max_local$0 = max_local < slot ? slot : max_local; + i = i + 2 | 0; + max_local = max_local$0; + continue; + } + } + if(18 !== op && 19 !== op && 8 !== op && 33 !== op && 34 !== op){ + if + (1 !== op + && + 20 !== op + && + 21 !== op + && 32 !== op && 51 !== op && 52 !== op && 64 !== op && 65 !== op){i = i + 1 | 0; continue;} + i = i + 3 | 0; + continue; + } + i = i + 2 | 0; + } + } + return [0, 0, -1, 16, [0], [0], 0, 0]; + } + var + cst$2 = ": ", + cst_JIT_compiler_not_loaded = "JIT: compiler not loaded", + cst_compile = "compile", + cst_fn = "fn", + cst_quote = "quote", + f = + [0, + [11, + "[jit-comp] FAIL ", + [2, 0, [11, cst$2, [2, 0, [12, 10, [10, 0]]]]]], + "[jit-comp] FAIL %s: %s\n%!"], + g = [0, "children", 0], + h = [3, cst_fn], + i = [3, cst_quote], + j = [3, cst_compile]; + function jit_compile_comp + (name, params, has_children, body, closure, globals){ + try{ + try{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[9], cst_JIT_compiler_not_loaded], 1); + throw caml_maybe_attach_backtrace(exn, 0); + } + var + c = has_children ? g : 0, + param_names = Stdlib[37].call(null, params, c), + param_syms = + [5, + Stdlib_List[20].call(null, function(s){return [3, s];}, param_names)], + fn_expr = [5, [0, h, [0, param_syms, [0, body, 0]]]], + k = Sx_types[17].call(null, 0), + compile_env = Sx_types[18].call(null, k); + 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); + }, + globals); + var + result = + Sx_ref[231].call + (null, + [5, [0, j, [0, [5, [0, i, [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[4]; + if(4 <= bc.length - 1 && 51 === caml_check_bound(bc, 0)[1]){ + var + l = caml_check_bound(bc, 2)[3] << 8, + idx = caml_check_bound(bc, 1)[2] | l; + if(idx < outer_code[5].length - 1){ + var + inner_val = caml_check_bound(outer_code[5], idx)[idx + 1], + code = code_from_value(inner_val), + a = [0, [0, code, [0], [0, name], globals, [0, closure]]]; + break a; + } + var a = 0; + break a; + } + var a = 0; + break a; + } + } + 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, f), name, b); + return 0; + } + } + var + cst_io_suspended = "io-suspended", + cst_phase = "phase", + cst_request = "request", + k = [5, 0], + l = [2, cst_phase], + m = [2, cst_request]; + function cek_call_or_suspend(vm, f, args){ + vm_cek_count[1]++; + if(typeof args === "number") + var a = 0; + else if(5 === args[0]) + var l$0 = args[1], a = l$0; + else + var a = [0, args, 0]; + var + b = [19, Sx_types[17].call(null, 0)], + state = Sx_ref[227].call(null, f, [5, a], b, [5, a], k), + final = Sx_ref[147].call(null, state), + match = Sx_runtime[12].call(null, final, l); + 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[12].call(null, final, m), vm], 1); + } + return Sx_ref[15].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){ + var match = active_vm[1]; + if(! match) return call_closure(cl, args, cl[4]); + var vm = match[1], saved_sp = vm[2]; + push_closure_frame(vm, cl, args); + var saved_frames = Stdlib_List[7].call(null, vm[3]); + vm[3] = [0, Stdlib_List[6].call(null, vm[3]), 0]; + try{run(vm);} + catch(e$0){ + var e = caml_wrap_exception(e$0); + if(e[1] === VmSuspended){ + vm[3] = Stdlib[37].call(null, vm[3], saved_frames); + throw caml_maybe_attach_backtrace(e, 0); + } + vm[3] = saved_frames; + vm[2] = saved_sp; + throw caml_maybe_attach_backtrace(e, 0); + } + vm[3] = saved_frames; + return pop(vm); + } + 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]; + return is_jit_failed(cl) + ? push(vm, cek_call_or_suspend(vm, f, [5, args])) + : push_closure_frame(vm, cl, 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]; + return push_closure_frame(vm, cl$0, args); + case 8: + var + c = f[1], + match$1 = parse_keyword_args(c[2], args), + children = match$1[2], + kwargs = match$1[1], + match$2 = c[8]; + if(match$2) + var + cl$1 = match$2[1], + compiled = is_jit_failed(cl$1) ? 0 : [0, cl$1]; + else{ + c[8] = [0, jit_failed_sentinel]; + var result = jit_compile_comp(c[1], c[2], c[3], c[4], c[5], vm[4]); + if(result){ + var cl$3 = result[1]; + c[8] = [0, cl$3]; + var compiled = result; + } + else + var compiled = result; + } + if(! compiled){ + vm_cek_count[1]++; + vm_comp_cek_count[1]++; + return push(vm, cek_call_or_suspend(vm, f, [5, args])); + } + var cl$2 = compiled[1]; + vm_comp_jit_count[1]++; + var + call_args = + Stdlib_List[20].call + (null, + function(p){ + var match = Stdlib_Hashtbl[7].call(null, kwargs, p); + if(! match) return 0; + var v = match[1]; + return v; + }, + c[2]), + call_args$0 = + c[3] + ? Stdlib[37].call(null, call_args, [0, [5, children], 0]) + : call_args; + try{ + var d = push(vm, call_closure(cl$2, call_args$0, cl$2[4])); + return d; + } + catch(exn){ + vm_cek_count[1]++; + vm_comp_cek_count[1]++; + return push(vm, cek_call_or_suspend(vm, f, [5, args])); + } + case 9: + var + i = f[1], + match$3 = parse_keyword_args(i[2], args), + children$0 = match$3[2], + kwargs$0 = match$3[1], + match$4 = i[7]; + if(match$4) + var + cl$4 = match$4[1], + compiled$0 = is_jit_failed(cl$4) ? 0 : [0, cl$4]; + else{ + i[7] = [0, jit_failed_sentinel]; + var result$0 = jit_compile_comp(i[1], i[2], i[3], i[4], i[5], vm[4]); + if(result$0){ + var cl$6 = result$0[1]; + i[7] = [0, cl$6]; + var compiled$0 = result$0; + } + else + var compiled$0 = result$0; + } + if(! compiled$0){ + vm_cek_count[1]++; + vm_comp_cek_count[1]++; + return push(vm, cek_call_or_suspend(vm, f, [5, args])); + } + var cl$5 = compiled$0[1]; + vm_comp_jit_count[1]++; + var + call_args$1 = + Stdlib_List[20].call + (null, + function(p){ + var match = Stdlib_Hashtbl[7].call(null, kwargs$0, p); + if(! match) return 0; + var v = match[1]; + return v; + }, + i[2]), + call_args$2 = + i[3] + ? Stdlib[37].call(null, call_args$1, [0, [5, children$0], 0]) + : call_args$1; + try{ + var e = push(vm, call_closure(cl$5, call_args$2, cl$5[4])); + return e; + } + catch(exn){ + vm_cek_count[1]++; + vm_comp_cek_count[1]++; + return push(vm, cek_call_or_suspend(vm, f, [5, args])); + } + case 14: + var fn = f[2], result$1 = caml_call1(fn, args); + return push(vm, result$1); + case 23: + var cl$7 = f[1]; return push_closure_frame(vm, cl$7, 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[9], 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], + n = + [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%!"], + o = + [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)"], + p = + [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"], + q = [1, 0.], + r = + [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)"], + s = [0, 1], + t = [0, 0], + u = + [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"], + v = + [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)"], + w = + [0, [11, "Unhandled exception: ", [2, 0, 0]], "Unhandled exception: %s"], + x = + [0, + [11, + "VM: CLOSURE idx ", + [4, 0, 0, 0, [11, " >= consts ", [4, 0, 0, 0, 0]]]], + "VM: CLOSURE idx %d >= consts %d"], + y = + [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][4], + consts = frame[1][1][5]; + 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, n), 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; + vm_insn_count[1]++; + 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$0 = match$2[1], name = s$0; + var v$0 = peek(vm); + Stdlib_Hashtbl[11].call(null, vm[4], name, v$0); + var match$3 = Sx_types[20][1]; + if(! match$3) break a; + var f = match$3[1]; + caml_call2(f, name, v$0); + 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$1 = Stdlib_String[7].call(null, cst$1, X); + push(vm, [2, s$1]); + 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$0 = b$0[1], x$0 = a[1], C = [1, x$0 + y$0]; + 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$1 = b$1[1], x$1 = a$0[1], D = [1, x$1 - y$1]; + 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$2 = b$2[1], x$2 = a$1[1], E = [1, x$2 * y$2]; + 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$3 = b$3[1], x$3 = a$2[1], F = [1, x$3 / y$3]; + 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$4 = b$5[1], x$4 = a$4[1], z = [0, x$4 < y$4 ? 1 : 0]; + break b; + } + break; + case 2: + if(typeof b$5 !== "number" && 2 === b$5[0]){ + var + y$5 = b$5[1], + x$5 = a$4[1], + z = [0, runtime.caml_string_lessthan(x$5, y$5)]; + 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$6 = b$6[1], x$6 = a$5[1], A = [0, y$6 < x$6 ? 1 : 0]; + break b; + } + break; + case 2: + if(typeof b$6 !== "number" && 2 === b$6[0]){ + var + y$7 = b$6[1], + x$7 = a$5[1], + A = [0, runtime.caml_string_greaterthan(x$7, y$7)]; + 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$1 = pop(vm); + push(vm, [0, 1 - Sx_types[53].call(null, v$1)]); + break a; + case 56: + var v$2 = pop(vm); + b: + if(typeof v$2 === "number") + var c = q; + else{ + switch(v$2[0]){ + case 2: + var s$2 = v$2[1], c = [1, caml_ml_string_length(s$2)]; + break b; + case 5: + var l = v$2[1]; break; + case 6: + var d = v$2[1], c = [1, Stdlib_Hashtbl[15].call(null, d)]; + break b; + case 20: + var l = v$2[1][1]; break; + default: + var + c = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "len"), + [0, v$2, 0]); + break b; + } + var c = [1, Stdlib_List[1].call(null, l)]; + } + push(vm, c); + break a; + case 57: + var v$3 = pop(vm); + b: + { + if(typeof v$3 !== "number") + switch(v$3[0]){ + case 5: + var G = v$3[1]; if(G){var j = G[1]; break b;} break; + case 20: + var H = v$3[1][1]; if(H){var j = H[1]; break b;} break; + default: + var + j = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "first"), + [0, v$3, 0]); + break b; + } + var j = 0; + } + push(vm, j); + break a; + case 58: + var v$4 = pop(vm); + b: + if(typeof v$4 === "number") + var g = b; + else{ + switch(v$4[0]){ + case 5: + var I = v$4[1]; + if(! I){var g = b; break b;} + var xs = I[2]; + break; + case 20: + var J = v$4[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$4, 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$3 = coll[1], i = f$0 | 0; + if(0 <= i && i < caml_ml_string_length(s$3)){ + var + Z = runtime.caml_string_get(s$3, i), + h = [2, Stdlib_String[1].call(null, 1, Z)]; + break b; + } + var h = 0; + break b; + case 5: + var l$0 = coll[1]; break; + case 20: + var l$0 = 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$0, f$1 | 0), h = _; + break b; + } + catch(exn){var h = 0; break b;} + } + } + var + h = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "nth"), + [0, coll, [0, n$2, 0]]); + } + push(vm, h); + break a; + case 60: + var coll$0 = pop(vm), x$8 = pop(vm); + if(typeof coll$0 === "number") + var m = [5, [0, x$8, 0]]; + else + switch(coll$0[0]){ + case 5: + var l$1 = coll$0[1], m = [5, [0, x$8, l$1]]; break; + case 20: + var l$2 = coll$0[1][1], m = [5, [0, x$8, l$2]]; break; + default: + var + m = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "cons"), + [0, x$8, [0, coll$0, 0]]); + } + push(vm, m); + break a; + case 61: + var v$5 = pop(vm); + b: + { + if(typeof v$5 !== "number" && 1 === v$5[0]){var x$9 = v$5[1], K = [1, - x$9]; break b; + } + var + K = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], cst$0), + [0, v$5, 0]); + } + push(vm, K); + break a; + case 62: + var v$6 = pop(vm); + b: + { + if(typeof v$6 !== "number" && 1 === v$6[0]){ + var x$10 = v$6[1], L = [1, x$10 + 1.]; + break b; + } + var + L = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "inc"), + [0, v$6, 0]); + } + push(vm, L); + break a; + case 63: + var v$7 = pop(vm); + b: + { + if(typeof v$7 !== "number" && 1 === v$7[0]){ + var x$11 = v$7[1], M = [1, x$11 - 1.]; + break b; + } + var + M = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "dec"), + [0, v$7, 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, r), idx$0, consts.length - 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], $], 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, s); break a; + case 3: + push(vm, t); break a; + case 4: + pop(vm); break a; + case 5: + push(vm, peek(vm)); break a; + case 6: + var a$6 = pop(vm), b$7 = pop(vm); + push(vm, a$6); + push(vm, b$7); + 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$8 = 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, u), slot, ab, aa); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ac], 1); + } + var v$8 = caml_check_bound(vm[1], idx$1)[idx$1 + 1]; + } + push(vm, v$8); + break a; + case 16: + var + slot$0 = read_u8(frame), + v$9 = 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$9; break a;} + var N = frame[3] + slot$0 | 0; + caml_check_bound(vm[1], N)[N + 1] = v$9; + 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, v), idx$2, ad); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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$4 = match$6[1], name$0 = s$4; + var id = Sx_types[4].call(null, name$0), match$7 = frame[1][5]; + if(match$7){ + var env = match$7[1], e = env; + for(;;) + try{ + var + ag = [0, Stdlib_Hashtbl[6].call(null, e[1], id)], + found_in_env = ag; + break; + } + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0 !== Stdlib[8]) + throw caml_maybe_attach_backtrace(exn$0, 0); + var match$8 = e[2]; + if(! match$8){var found_in_env = 0; break;} + var p$0 = match$8[1]; + e = p$0; + } + } + else + var found_in_env = 0; + if(found_in_env) + var v$10 = found_in_env[1], v$11 = v$10; + else + try{ + var + aj = Stdlib_Hashtbl[6].call(null, vm[4], name$0), + v$11 = aj; + } + catch(exn){ + var exn$1 = caml_wrap_exception(exn); + if(exn$1 !== Stdlib[8]) + throw caml_maybe_attach_backtrace(exn$1, 0); + try{var ai = Sx_primitives[15].call(null, name$0), v$11 = ai;} + catch(exn){ + var ah = Stdlib[28].call(null, cst_VM_undefined, name$0); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ah], 1); + } + } + push(vm, v$11); + 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$5 = match$9[1], name$1 = s$5; + 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 ak = peek(vm); + Stdlib_Hashtbl[11].call(null, e$0[1], id$0, ak); + 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$12 = peek(vm); + Stdlib_Hashtbl[11].call(null, vm[4], name$1, v$12); + var match$12 = Sx_types[20][1]; + if(! match$12) break a; + var f$2 = match$12[1]; + caml_call2(f$2, name$1, v$12); + 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$13 = pop(vm); + if(! (1 - Sx_types[53].call(null, v$13))) break a; + frame[2] = frame[2] + offset$0 | 0; + break a; + case 33: + var offset$1 = read_i16(frame), v$14 = pop(vm); + if(! Sx_types[53].call(null, v$14)) break a; + frame[2] = frame[2] + offset$1 | 0; + break a; + case 34: + var + catch_offset = read_i16(frame), + al = vm[2], + am = Stdlib_List[1].call(null, vm[3]), + entry = [0, frame[2] + catch_offset | 0, am, al, frame]; + vm[6] = [0, entry, vm[6]]; + break a; + case 35: + var match$13 = vm[6]; + if(! match$13) break a; + var rest = match$13[2]; + vm[6] = rest; + break a; + case 36: + var exn_val = pop(vm), match$14 = vm[6]; + if(! match$14){ + var + ao = Sx_runtime[2].call(null, exn_val), + ap = caml_call1(Stdlib_Printf[4].call(null, w), ao); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ap], 1); + } + var rest$0 = match$14[2], entry$0 = match$14[1]; + vm[6] = rest$0; + for(;;){ + var an = entry$0[2]; + if(an >= Stdlib_List[1].call(null, vm[3])){ + vm[2] = entry$0[3]; + entry$0[4][2] = entry$0[1]; + push(vm, exn_val); + break a; + } + var match$15 = vm[3]; + if(match$15){var fs = match$15[2]; vm[3] = fs;} + } + break; + case 47: + var + argc = read_u8(frame), + args = + Stdlib_Array[1].call + (null, argc, function(param){return pop(vm);}), + f$3 = pop(vm), + aq = Stdlib_Array[10].call(null, args), + args_list = Stdlib_List[10].call(null, aq); + 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), + ar = Stdlib_Array[10].call(null, args$0), + args_list$0 = Stdlib_List[10].call(null, ar); + 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 + as = + caml_call2 + (Stdlib_Printf[4].call(null, x), idx$6, consts.length - 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], as], 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$16 = + Stdlib_Hashtbl[7].call(null, d$0, cst_upvalue_count); + if(match$16){ + var match$17 = match$16[1]; + if(typeof match$17 !== "number" && 1 === match$17[0]){var n$3 = match$17[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$18 = caml_check_bound(consts, idx$7)[idx$7 + 1]; + if(typeof match$18 === "number" || ! (2 === match$18[0])) + var name$2 = cst$1; + else + var s$6 = match$18[1], name$2 = s$6; + var + at = + Stdlib_List[11].call + (null, argc$1, function(param){return pop(vm);}), + args$1 = Stdlib_List[10].call(null, at), + 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 + av = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); + throw caml_maybe_attach_backtrace([0, Sx_types[9], av], 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[212].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[9]) + throw caml_maybe_attach_backtrace(exn$2, 0); + var + msg$0 = exn$2[2], + au = + caml_call3 + (Stdlib_Printf[4].call(null, y), msg$0, name$2, argc$1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], au], 1); + } + push(vm, result$1); + break a; + case 63: + var + count$0 = read_u16(frame), + aw = + Stdlib_List[11].call + (null, count$0, function(param){return pop(vm);}), + items = Stdlib_List[10].call(null, aw); + 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$15 = pop(vm), k = pop(vm); + b: + { + if(typeof k !== "number") + switch(k[0]){ + case 2: + case 4: + var s$7 = k[1], key = s$7; break b; + } + var key = Sx_runtime[2].call(null, k); + } + Stdlib_Hashtbl[11].call(null, d$1, key, v$15); + var ax = for$ + 1 | 0; + if(count$1 === for$) break; + for$ = ax; + } + } + push(vm, [6, d$1]); + break a; + } + var + U = frame[2] - 1 | 0, + V = caml_call2(Stdlib_Printf[4].call(null, p), op, U); + throw caml_maybe_attach_backtrace([0, Sx_types[9], 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, o), + msg, + saved_ip, + op, + fn_name$0, + S, + R, + bc.length - 1, + consts.length - 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], T], 1); + } + var z = [2, cst_phase], A = [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[149].call(null, cek_state, result), + match$0 = Sx_runtime[12].call(null, final, z); + 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[12].call(null, final, A), vm], 1); + } + push(vm, Sx_ref[15].call(null, final)); + } + else + push(vm, result); + run(vm); + return pop(vm); + } + var B = [0, "module"]; + function execute_module(code, globals){ + var + cl = [0, code, [0], B, globals, 0], + vm = create(globals), + frame = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], + a = code[3] - 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); + } + function execute_module_safe(code, globals){ + try{var result = execute_module(code, globals); return [0, result];} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== VmSuspended) throw caml_maybe_attach_backtrace(exn, 0); + var vm = exn[3], request = exn[2]; + return [1, [0, request, vm]]; + } + } + var + cst_jit_FAIL = "[jit] FAIL ", + jit_compiling = [0, 0], + C = + [0, + [11, cst_jit_FAIL, [2, 0, [11, cst$2, [2, 0, [12, 10, [10, 0]]]]]], + "[jit] FAIL %s: %s\n%!"], + D = [3, cst_fn], + E = [3, cst_quote], + F = [3, cst_compile], + G = + [0, + [11, + cst_jit_FAIL, + [2, 0, [11, ": compiler returned ", [2, 0, [12, 10, [10, 0]]]]]], + "[jit] FAIL %s: compiler returned %s\n%!"], + H = + [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%!"], + I = + [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%!"], + J = + [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, globals){ + var match = l[4]; + if(match) var n = match[1], fn_name = n; else var fn_name = ""; + if(jit_compiling[1]) return 0; + if + (! + Stdlib_List[37].call(null, "&key", l[1]) + && ! Stdlib_List[37].call(null, ":as", l[1])) + try{ + jit_compiling[1] = 1; + 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(exn, 0); + jit_compiling[1] = 0; + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], cst_JIT_compiler_not_loaded], 1); + } + var + param_syms = + [5, Stdlib_List[20].call(null, function(s){return [3, s];}, l[1])], + fn_expr = [5, [0, D, [0, param_syms, [0, l[2], 0]]]]; + a: + { + if(typeof compile_fn !== "number" && 7 === compile_fn[0]){ + var match$1 = compile_fn[1][5]; + if(match$1){ + var cl = match$1[1]; + if(! is_jit_failed(cl)){ + var result = call_closure(cl, [0, fn_expr, 0], globals); + break a; + } + } + } + var + c = Sx_types[17].call(null, 0), + compile_env = Sx_types[18].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); + }, + globals); + var + result = + Sx_ref[231].call + (null, + [5, [0, F, [0, [5, [0, E, [0, fn_expr, 0]]], 0]]], + [19, compile_env]); + } + jit_compiling[1] = 0; + if(0 < Stdlib_Hashtbl[15].call(null, l[3][1])){ + var + merged = Stdlib_Hashtbl[4].call(null, globals), + env$1 = l[3], + env = env$1; + for(;;){ + Stdlib_Hashtbl[12].call + (null, + function(id, v){ + var + name = Sx_types[5].call(null, id), + a = 1 - Stdlib_Hashtbl[9].call(null, merged, name); + return a ? Stdlib_Hashtbl[11].call(null, merged, name, v) : a; + }, + env[1]); + var match$0 = env[2]; + if(! match$0){var effective_globals = merged; break;} + var env$0 = match$0[1]; + env = env$0; + } + } + else + var effective_globals = globals; + a: + { + b: + if(typeof result !== "number" && 6 === result[0]){ + var d = result[1]; + if + (! + Stdlib_Hashtbl[9].call(null, d, cst_bytecode) + && ! Stdlib_Hashtbl[9].call(null, d, cst_vc_bytecode)) + break b; + var outer_code = code_from_value(result), bc = outer_code[4]; + 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[5].length - 1){ + var + inner_val = caml_check_bound(outer_code[5], 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[5].length - 1; + caml_call3(Stdlib_Printf[3].call(null, H), fn_name, idx, h); + var a = 0; + break a; + } + try{ + var + value = execute_module(outer_code, globals), + k = 0 < bc.length - 1 ? caml_check_bound(bc, 0)[1] : -1, + m = Sx_types[43].call(null, value); + caml_call3(Stdlib_Printf[3].call(null, J), 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, I), fn_name, j, i); + var a = 0; + break a; + } + } + var f = Sx_types[43].call(null, result); + caml_call2(Stdlib_Printf[3].call(null, G), fn_name, f); + var a = 0; + } + return a; + } + catch(e$0){ + var e = caml_wrap_exception(e$0); + jit_compiling[1] = 0; + var b = Stdlib_Printexc[1].call(null, e); + caml_call2(Stdlib_Printf[3].call(null, C), fn_name, b); + return 0; + } + return 0; + } + jit_compile_ref[1] = jit_compile_lambda; + Sx_types[6][1] = function(cl, args){return call_closure_reuse(cl, args);}; + var K = [0, 1]; + Sx_types[13][1] = + function(exn){ + if(exn[1] !== VmSuspended) return 0; + var + vm = exn[3], + request = exn[2], + saved_cek = vm[5], + d = Stdlib_Hashtbl[1].call(null, 0, 3); + Stdlib_Hashtbl[11].call(null, d, "__vm_suspended", K); + Stdlib_Hashtbl[11].call(null, d, cst_request, request); + Stdlib_Hashtbl[11].call + (null, + d, + "resume", + [14, + "vm-resume", + function(args){ + if(args && ! args[2]){ + var result = args[1]; + vm[5] = saved_cek; + try{var a = resume_vm(vm, result); return a;} + catch(exn2$0){ + var + exn2 = caml_wrap_exception(exn2$0), + match = caml_call1(Sx_types[13][1], exn2); + if(! match) throw caml_maybe_attach_backtrace(exn2, 0); + var marker = match[1]; + return marker; + } + } + return 0; + }]); + return [0, [6, d]]; + }; + var L = [5, 0], M = [2, cst_phase], N = [2, cst_request]; + Sx_types[8][1] = + function(f, args){ + var + a = [19, Sx_types[17].call(null, 0)], + state = Sx_ref[227].call(null, f, [5, args], a, [5, args], L), + final = Sx_ref[147].call(null, state), + match = Sx_runtime[12].call(null, final, M); + if + (typeof match !== "number" + && 2 === match[0] && match[1] === cst_io_suspended){ + var vm = create(Stdlib_Hashtbl[1].call(null, 0, 0)); + vm[5] = [0, final]; + throw caml_maybe_attach_backtrace + ([0, VmSuspended, Sx_runtime[12].call(null, final, N), vm], 1); + } + return Sx_ref[15].call(null, final); + }; + var O = [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 6: + return "SWAP"; + 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 34: + return "PUSH_HANDLER"; + case 35: + return "POP_HANDLER"; + case 36: + return "RAISE"; + 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, O), n); + } + function opcode_operand_size(param){ + a: + { + b: + { + if(36 <= 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", + S = [0, 0], + T = [0, 0], + c = [1, 0.], + a = [5, 0], + P = [3, "do"], + Q = [3, cst_quote], + R = [0, "trace"], + U = [0, 1], + V = [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[9], "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, P, exprs]]; + } + var + quoted = [5, [0, Q, [0, expr, 0]]], + K = [19, Sx_types[17].call(null, 0)], + code_val = + Sx_ref[231].call(null, [5, [0, compile_fn, [0, quoted, 0]]], K), + code = code_from_value(code_val), + cl = [0, code, [0], R, globals, 0], + vm = create(globals), + frame0 = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], + m = code[3] - 1 | 0; + if(m >= 0){ + var for$0 = 0; + for(;;){ + push(vm, 0); + var ao = for$0 + 1 | 0; + if(m === for$0) break; + for$0 = ao; + } + } + 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][4]; + if(bc.length - 1 <= frame[2]){vm[3] = 0; continue;} + var + o = frame[2], + op = caml_check_bound(bc, o)[o + 1], + L = Stdlib[16].call(null, 5, vm[2]), + stack_snap = + Stdlib_List[11].call + (null, + L, + function(i){ + var + a = (vm[2] - 1 | 0) - i | 0, + v = caml_check_bound(vm[1], a)[a + 1]; + return [2, Sx_types[98].call(null, v)]; + }), + entry = Stdlib_Hashtbl[1].call(null, 0, 4), + M = [2, opcode_name(op)]; + Stdlib_Hashtbl[11].call(null, entry, cst_opcode, M); + Stdlib_Hashtbl[11].call(null, entry, "stack", [5, stack_snap]); + var N = [1, Stdlib_List[1].call(null, vm[3])]; + Stdlib_Hashtbl[11].call(null, entry, "depth", N); + 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][5], 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 O = peek(vm); + Stdlib_Hashtbl[11].call(null, vm[4], name, O); + break; + case 16: + 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); + push(vm, [2, Stdlib_String[7].call(null, cst$1, X)]); + 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], t = [1, x$1 * y$1]; + break a; + } + var t = 0; + } + push(vm, t); + 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], u = [1, x$2 / y$2]; + break a; + } + var u = 0; + } + push(vm, u); + 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 w = S; + else + var y$3 = b$4[1], x$3 = a$5[1], w = [0, x$3 < y$3 ? 1 : 0]; + push(vm, w); + 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 z = T; + else + var y$4 = b$5[1], x$4 = a$6[1], z = [0, y$4 < x$4 ? 1 : 0]; + push(vm, z); + break; + case 39: + var v = pop(vm); + push(vm, [0, 1 - Sx_types[53].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 A = v$1[1]; if(A){var i = A[1]; break a;} break; + case 20: + var B = v$1[1][1]; if(B){var i = B[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 C = v$2[1]; + if(! C){var g = a; break a;} + var xs = C[2]; + break; + case 20: + var D = v$2[1][1]; + if(! D){var g = a; break a;} + var xs = D[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 Y = Stdlib_List[8].call(null, l$0, f | 0), j = Y; + 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], E = [5, [0, x$5, l$1]]; + break a; + } + var E = [5, [0, x$5, 0]]; + } + push(vm, E); + break; + case 45: + var v$3 = pop(vm); + a: + { + if(typeof v$3 !== "number" && 1 === v$3[0]){var x$6 = v$3[1], F = [1, - x$6]; break a; + } + var F = 0; + } + push(vm, F); + break; + case 46: + var v$4 = pop(vm); + a: + { + if(typeof v$4 !== "number" && 1 === v$4[0]){ + var x$7 = v$4[1], G = [1, x$7 + 1.]; + break a; + } + var G = 0; + } + push(vm, G); + break; + case 47: + var v$5 = pop(vm); + a: + { + if(typeof v$5 !== "number" && 1 === v$5[0]){ + var x$8 = v$5[1], H = [1, x$8 - 1.]; + break a; + } + var H = 0; + } + push(vm, H); + 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][5], idx$0)[idx$0 + 1]); + break; + case 1: + push(vm, 0); break; + case 2: + push(vm, U); break; + case 3: + push(vm, V); break; + case 4: + pop(vm); break; + case 5: + push(vm, peek(vm)); break; + case 6: + var a$7 = pop(vm), b$6 = pop(vm); + push(vm, a$7); + push(vm, b$6); + 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 + I = frame[3] + slot | 0, + v$6 = caml_check_bound(vm[1], I)[I + 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 J = frame[3] + slot$0 | 0; + caml_check_bound(vm[1], J)[J + 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), Z = peek(vm); + caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1] = Z; + break; + case 19: + var + idx$3 = read_u16(frame), + match$3 = caml_check_bound(frame[1][1][5], 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 aa = Stdlib_Hashtbl[6].call(null, vm[4], name$0), v$8 = aa; + } + 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 _ = Stdlib[28].call(null, cst_VM_undefined, name$0); + throw caml_maybe_attach_backtrace([0, Sx_types[9], _], 1); + } + } + push(vm, v$8); + break; + case 20: + var + idx$4 = read_u16(frame), + match$4 = caml_check_bound(frame[1][1][5], 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 ab = peek(vm); + Stdlib_Hashtbl[11].call(null, vm[4], name$1, ab); + 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[53].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[53].call(null, v$10)) + frame[2] = frame[2] + offset$1 | 0; + break; + case 34: + var + catch_offset = read_i16(frame), + ac = vm[6], + ad = vm[2], + ae = Stdlib_List[1].call(null, vm[3]); + vm[6] = [0, [0, frame[2] + catch_offset | 0, ae, ad, frame], ac]; + break; + case 35: + var match$5 = vm[6]; + if(match$5){var r = match$5[2]; vm[6] = r;} + break; + case 36: + var exn_val = pop(vm), match$6 = vm[6]; + if(match$6){ + var rest = match$6[2], entry$0 = match$6[1]; + vm[6] = rest; + for(;;){ + var af = entry$0[2]; + if(af >= Stdlib_List[1].call(null, vm[3])){ + vm[2] = entry$0[3]; + entry$0[4][2] = entry$0[1]; + push(vm, exn_val); + break; + } + var match$7 = vm[3]; + if(match$7){var fs = match$7[2]; vm[3] = fs;} + } + } + else + vm[3] = 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), + ag = Stdlib_Array[10].call(null, args); + vm_call(vm, f$0, Stdlib_List[10].call(null, ag)); + 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 ah = Stdlib_Array[10].call(null, args$0); + vm_call(vm, f$1, Stdlib_List[10].call(null, ah)); + 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][5], idx$5)[idx$5 + 1]; + a: + { + if(typeof code_val2 !== "number" && 6 === code_val2[0]){ + var + d = code_val2[1], + match$8 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); + if(match$8){ + var match$9 = match$8[1]; + if(typeof match$9 !== "number" && 1 === match$9[0]){var n$0 = match$9[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$10 = caml_check_bound(frame[1][1][5], idx$6)[idx$6 + 1]; + if(typeof match$10 === "number" || ! (2 === match$10[0])) + var name$2 = cst$1; + else + var s$3 = match$10[1], name$2 = s$3; + var + ai = + Stdlib_List[11].call + (null, argc$1, function(param){return pop(vm);}), + args$1 = Stdlib_List[10].call(null, ai); + try{var al = Sx_primitives[15].call(null, name$2), fn_val = al;} + catch(exn){ + try{ + var + ak = Stdlib_Hashtbl[6].call(null, vm[4], name$2), + fn_val = ak; + } + catch(exn){ + var exn$1 = caml_wrap_exception(exn); + if(exn$1 !== Stdlib[8]) + throw caml_maybe_attach_backtrace(exn$1, 0); + var + aj = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); + throw caml_maybe_attach_backtrace([0, Sx_types[9], aj], 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), + am = + Stdlib_List[11].call + (null, count$0, function(param){return pop(vm);}), + items = Stdlib_List[10].call(null, am); + 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 an = for$ + 1 | 0; + if(count$1 === for$) break; + for$ = an; + } + } + 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[4], + len = bc.length - 1, + consts = code[5], + 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[98].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[3]]); + var + j = + Stdlib_Array[14].call + (null, function(v){return [2, Sx_types[98].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 + (190, + [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, + parse_keyword_args, + vm_comp_jit_count, + vm_comp_cek_count, + vm_insn_count, + vm_call_count, + vm_cek_count, + vm_reset_counters, + vm_report_counters, + jit_compiling, + push_closure_frame, + code_from_value, + jit_compile_comp, + cek_call_or_suspend, + call_closure, + call_closure_reuse, + vm_call, + run, + resume_vm, + execute_module, + execute_module_safe, + jit_compile_lambda, + opcode_name, + opcode_operand_size, + trace_run, + disassemble], + "Sx_vm"); + return; + } + (globalThis)); + +//# 19567 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_vm_ref:[F(2),F(2),F(1),F(1)*,N,F(2),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(1)*,F(1)*,F(2)*,F(4),F(5),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(1),F(3),F(4),F(2),F(3),F(1),F(2),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(2),F(1),F(3),F(4),F(3),F(1)*,F(3),N,F(1)*,F(1)*,F(1)*,F(2),F(1)*,F(3),F(2),F(3),N,N,N,F(3),F(3),F(2),F(2),F(2),F(3),F(2),F(3),F(1),F(5),F(2),F(2),F(1),F(3),F(1),N,N,F(1)*] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + 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_Hashtbl = global_data.Stdlib__Hashtbl, + Sx_types = global_data.Sx_types, + Sx_runtime = global_data.Sx_runtime, + Stdlib_List = global_data.Stdlib__List, + Sx_vm = global_data.Sx_vm, + Sx_ref = global_data.Sx_ref, + Stdlib_Array = global_data.Stdlib__Array, + Stdlib = global_data.Stdlib, + cek_call = Sx_ref[212], + eval_expr = Sx_ref[231]; + function trampoline(v){ + if(typeof v !== "number" && 11 === v[0]){ + var env = v[2], expr = v[1]; + return Sx_ref[231].call(null, expr, [19, env]); + } + return v; + } + function to_ocaml_list(v){ + if(typeof v === "number") return 0; + if(5 !== v[0]) return [0, v, 0]; + var l = v[1]; + return l; + } + var + str = + [14, "str", function(args){return [2, Sx_runtime[4].call(null, args)];}]; + function call_primitive(name, args){ + var n = Sx_types[31].call(null, name), a = to_ocaml_list(args); + return Sx_runtime[1].call(null, n, a); + } + function unwrap_vm(v){ + if(typeof v !== "number" && 25 === v[0]){var m = v[1]; return m;} + throw caml_maybe_attach_backtrace([0, Sx_types[9], "not a vm"], 1); + } + function unwrap_frame(v){ + if(typeof v !== "number" && 24 === v[0]){var f = v[1]; return f;} + throw caml_maybe_attach_backtrace([0, Sx_types[9], "not a frame"], 1); + } + function unwrap_closure(v){ + if(typeof v !== "number" && 23 === v[0]){var c = v[1]; return c;} + throw caml_maybe_attach_backtrace([0, Sx_types[9], "not a closure"], 1); + } + function make_uv_cell(v){return [0, v];} + function uv_get(c){return c[1];} + function uv_set(c, v){c[1] = v; return 0;} + function make_upvalue_cell(v){return 0;} + function uv_get$0(param){return 0;} + function uv_set_b(a, param){return 0;} + function code_from_value(v){return Sx_vm[24].call(null, v);} + function make_vm_code(arity, locals, bytecode, constants){ + var d = Stdlib_Hashtbl[1].call(null, 0, 4); + Stdlib_Hashtbl[11].call(null, d, "arity", arity); + Stdlib_Hashtbl[11].call(null, d, "bytecode", bytecode); + Stdlib_Hashtbl[11].call(null, d, "constants", constants); + return [6, d]; + } + function make_vm_closure(code, upvalues, name, globals, closure_env){ + a: + { + if(typeof upvalues !== "number" && 5 === upvalues[0]){ + var + l = upvalues[1], + f = Stdlib_List[20].call(null, function(v){return [0, v];}, l), + uv = Stdlib_Array[11].call(null, f); + break a; + } + var uv = [0]; + } + a: + { + if(typeof closure_env !== "number" && 19 === closure_env[0]){var e = closure_env[1], b = [0, e]; break a;} + var b = 0; + } + a: + { + if(typeof globals !== "number" && 6 === globals[0]){var d = globals[1], c = d; break a;} + var c = Stdlib_Hashtbl[1].call(null, 0, 0); + } + if(typeof name === "number") + var a = 0; + else if(2 === name[0]) var s = name[1], a = [0, s]; else var a = 0; + return [23, [0, code_from_value(code), uv, a, c, b]]; + } + function make_vm_frame(closure, base){ + var cl = unwrap_closure(closure), a = Stdlib_Hashtbl[1].call(null, 0, 4); + return [24, [0, cl, 0, Sx_types[76].call(null, base), a]]; + } + function make_vm(globals){ + a: + { + if(typeof globals !== "number" && 6 === globals[0]){var d = globals[1], g = d; break a;} + var g = Stdlib_Hashtbl[1].call(null, 0, 0); + } + return [25, [0, caml_make_vect(4096, 0), 0, 0, g, 0]]; + } + function vm_push(vm_val, v){ + var m = unwrap_vm(vm_val); + if(m[1].length - 1 <= m[2]){ + var ns = caml_make_vect(m[2] * 2 | 0, 0); + Stdlib_Array[9].call(null, m[1], 0, ns, 0, m[2]); + m[1] = ns; + } + var a = m[2]; + caml_check_bound(m[1], a)[a + 1] = v; + m[2] = m[2] + 1 | 0; + return 0; + } + function vm_pop(vm_val){ + var m = unwrap_vm(vm_val); + m[2] = m[2] - 1 | 0; + var a = m[2]; + return caml_check_bound(m[1], a)[a + 1]; + } + function vm_peek(vm_val){ + var m = unwrap_vm(vm_val), a = m[2] - 1 | 0; + return caml_check_bound(m[1], a)[a + 1]; + } + function frame_read_u8(frame_val){ + var + f = unwrap_frame(frame_val), + a = f[2], + v = caml_check_bound(f[1][1][4], a)[a + 1]; + f[2] = f[2] + 1 | 0; + return [1, v]; + } + function frame_read_u16(frame_val){ + var + f = unwrap_frame(frame_val), + a = f[2], + lo = caml_check_bound(f[1][1][4], a)[a + 1], + b = f[2] + 1 | 0, + hi = caml_check_bound(f[1][1][4], b)[b + 1]; + f[2] = f[2] + 2 | 0; + return [1, lo | hi << 8]; + } + function frame_read_i16(frame_val){ + var + f = unwrap_frame(frame_val), + a = f[2], + lo = caml_check_bound(f[1][1][4], a)[a + 1], + b = f[2] + 1 | 0, + hi = caml_check_bound(f[1][1][4], b)[b + 1]; + f[2] = f[2] + 2 | 0; + var v = lo | hi << 8, c = 32768 <= v ? v - 65536 | 0 : v; + return [1, c]; + } + function frame_local_get(vm_val, frame_val, slot){ + var + m = unwrap_vm(vm_val), + f = unwrap_frame(frame_val), + a = Sx_types[76].call(null, slot), + idx = f[3] + a | 0, + b = Sx_types[76].call(null, slot), + match = Stdlib_Hashtbl[7].call(null, f[4], b); + if(! match) return caml_check_bound(m[1], idx)[idx + 1]; + var cell = match[1]; + return cell[1]; + } + function frame_local_set(vm_val, frame_val, slot, v){ + var + m = unwrap_vm(vm_val), + f = unwrap_frame(frame_val), + s = Sx_types[76].call(null, slot), + match = Stdlib_Hashtbl[7].call(null, f[4], s); + if(match){ + var cell = match[1]; + cell[1] = v; + } + else{var a = f[3] + s | 0; caml_check_bound(m[1], a)[a + 1] = v;} + return 0; + } + function frame_upvalue_get(frame_val, idx){ + var f = unwrap_frame(frame_val), a = Sx_types[76].call(null, idx); + return caml_check_bound(f[1][2], a)[a + 1][1]; + } + function frame_upvalue_set(frame_val, idx, v){ + var f = unwrap_frame(frame_val), a = Sx_types[76].call(null, idx); + caml_check_bound(f[1][2], a)[a + 1][1] = v; + return 0; + } + function frame_ip(f){var fr = unwrap_frame(f); return [1, fr[2]];} + function frame_set_ip_b(f, v){ + var fr = unwrap_frame(f); + fr[2] = Sx_types[76].call(null, v); + return 0; + } + function frame_base(f){var fr = unwrap_frame(f); return [1, fr[3]];} + function frame_closure(f){var fr = unwrap_frame(f); return [23, fr[1]];} + var + cst_vc_bytecode = "vc-bytecode", + cst_vc_constants = "vc-constants", + cst_vc_locals = "vc-locals"; + function closure_code(cl){ + var + c = unwrap_closure(cl), + d = Stdlib_Hashtbl[1].call(null, 0, 4), + a = Stdlib_Array[14].call(null, function(i){return [1, i];}, c[1][4]), + b = [5, Stdlib_Array[10].call(null, a)]; + Stdlib_Hashtbl[11].call(null, d, cst_vc_bytecode, b); + var e = [5, Stdlib_Array[10].call(null, c[1][5])]; + Stdlib_Hashtbl[11].call(null, d, cst_vc_constants, e); + Stdlib_Hashtbl[11].call(null, d, "vc-arity", [1, c[1][1]]); + Stdlib_Hashtbl[11].call(null, d, cst_vc_locals, [1, c[1][3]]); + return [6, d]; + } + function closure_upvalues(cl){ + var + c = unwrap_closure(cl), + a = Stdlib_Array[14].call(null, function(cell){return cell[1];}, c[2]); + return [5, Stdlib_Array[10].call(null, a)]; + } + function closure_env(cl){ + if(typeof cl !== "number" && 23 === cl[0]){ + var c = cl[1], match = c[5]; + if(! match) return 0; + var e = match[1]; + return [19, e]; + } + return 0; + } + var a = [2, cst_vc_bytecode]; + function code_bytecode(code){return Sx_runtime[12].call(null, code, a);} + var b = [2, cst_vc_constants]; + function code_constants(code){return Sx_runtime[12].call(null, code, b);} + var c = [2, cst_vc_locals]; + function code_locals(code){return Sx_runtime[12].call(null, code, c);} + function vm_sp(v){var m = unwrap_vm(v); return [1, m[2]];} + function vm_set_sp_b(v, s){ + var m = unwrap_vm(v); + m[2] = Sx_types[76].call(null, s); + return 0; + } + function vm_stack(v){unwrap_vm(v); return 0;} + function vm_set_stack_b(v, s){return 0;} + function vm_frames(v){ + var m = unwrap_vm(v); + return [5, Stdlib_List[20].call(null, function(f){return [24, f];}, m[3])]; + } + function vm_set_frames_b(v, fs){ + var m = unwrap_vm(v); + a: + { + if(typeof fs !== "number" && 5 === fs[0]){ + var l = fs[1], a = Stdlib_List[20].call(null, unwrap_frame, l); + break a; + } + var a = 0; + } + m[3] = a; + return 0; + } + function vm_globals_ref(v){var m = unwrap_vm(v); return [6, m[4]];} + var cst_VM_undefined = "VM undefined: "; + function vm_global_get(vm_val, frame_val, name){ + var + m = unwrap_vm(vm_val), + n = Sx_types[31].call(null, name), + f = unwrap_frame(frame_val), + match = f[1][5]; + if(match){ + var env = match[1], id = Sx_types[4].call(null, n), e = env; + for(;;){ + var match$0 = Stdlib_Hashtbl[7].call(null, e[1], id); + if(match$0){var v = match$0[1], found_in_env = [0, v]; break;} + var match$1 = e[2]; + if(! match$1){var found_in_env = 0; break;} + var p = match$1[1]; + e = p; + } + } + else + var found_in_env = 0; + if(found_in_env){var v$0 = found_in_env[1]; return v$0;} + var match$2 = Stdlib_Hashtbl[7].call(null, m[4], n); + if(match$2){var v$1 = match$2[1]; return v$1;} + try{var c = Sx_runtime[1].call(null, n, 0); return c;} + catch(exn){ + var match$3 = Sx_types[22][1]; + if(! match$3){ + var b = Stdlib[28].call(null, cst_VM_undefined, n); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var hook = match$3[1], match$4 = caml_call1(hook, n); + if(match$4){var v$2 = match$4[1]; return v$2;} + var a = Stdlib[28].call(null, cst_VM_undefined, n); + throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); + } + } + function vm_global_set(vm_val, frame_val, name, v){ + var + m = unwrap_vm(vm_val), + n = Sx_types[31].call(null, name), + f = unwrap_frame(frame_val), + match = f[1][5]; + if(match){ + var env = match[1], id = Sx_types[4].call(null, n), e = env; + for(;;){ + if(Stdlib_Hashtbl[9].call(null, e[1], id)){ + Stdlib_Hashtbl[11].call(null, e[1], id, v); + var written = 1; + break; + } + var match$0 = e[2]; + if(! match$0){var written = 0; break;} + var p = match$0[1]; + e = p; + } + } + else + var written = 0; + if(1 - written){ + Stdlib_Hashtbl[11].call(null, m[4], n, v); + var match$1 = Sx_types[20][1]; + if(match$1){var f$0 = match$1[1]; caml_call2(f$0, n, v);} + } + return 0; + } + function vm_push_frame(vm_val, closure_val, args){ + var + m = unwrap_vm(vm_val), + cl = unwrap_closure(closure_val), + d = Stdlib_Hashtbl[1].call(null, 0, 4), + f = [0, cl, 0, m[2], d], + arg_list = to_ocaml_list(args); + Stdlib_List[18].call + (null, + function(a){ + var b = m[2]; + caml_check_bound(m[1], b)[b + 1] = a; + m[2] = m[2] + 1 | 0; + return 0; + }, + arg_list); + var a = Stdlib_List[1].call(null, arg_list), b = cl[1][3] - 1 | 0; + if(b >= a){ + var for$ = a; + for(;;){ + var c = m[2]; + caml_check_bound(m[1], c)[c + 1] = 0; + m[2] = m[2] + 1 | 0; + var e = for$ + 1 | 0; + if(b === for$) break; + for$ = e; + } + } + m[3] = [0, f, m[3]]; + return 0; + } + var d = [0, 0], e = [0, 1]; + function vm_closure_p(v){ + if(typeof v !== "number" && 23 === v[0]) return e; + return d; + } + function vm_create_closure(vm_val, frame_val, code_val){ + var m = unwrap_vm(vm_val), f = unwrap_frame(frame_val); + a: + { + if(typeof code_val !== "number" && 6 === code_val[0]){ + var + d = code_val[1], + match = Stdlib_Hashtbl[7].call(null, d, "upvalue-count"); + if(match){ + var match$0 = match[1]; + if(typeof match$0 !== "number" && 1 === match$0[0]){var n = match$0[1], uv_count = n | 0; break a;} + } + var uv_count = 0; + break a; + } + var uv_count = 0; + } + var + upvalues = + Stdlib_Array[1].call + (null, + uv_count, + function(param){ + var a = f[2], is_local = caml_check_bound(f[1][1][4], a)[a + 1]; + f[2] = f[2] + 1 | 0; + var b = f[2], index = caml_check_bound(f[1][1][4], b)[b + 1]; + f[2] = f[2] + 1 | 0; + if(1 !== is_local) + return caml_check_bound(f[1][2], index)[index + 1]; + var match = Stdlib_Hashtbl[7].call(null, f[4], index); + if(match){var existing = match[1]; return existing;} + var d = f[3] + index | 0, c = [0, caml_check_bound(m[1], d)[d + 1]]; + Stdlib_Hashtbl[11].call(null, f[4], index, c); + return c; + }), + code = code_from_value(code_val); + return [23, [0, code, upvalues, 0, m[4], f[1][5]]]; + } + var + jit_failed_sentinel = + [0, + [0, -1, -1, 0, [0], [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;} + var f = [0, 0], g = [0, 1]; + function is_lambda(v){ + if(typeof v !== "number" && 7 === v[0]) return g; + return f; + } + function lambda_compiled(v){ + if(typeof v !== "number" && 7 === v[0]){ + var l = v[1], match = l[5]; + if(! match) return 0; + var c = match[1]; + return [23, c]; + } + return 0; + } + function lambda_set_compiled_b(v, c){ + if(typeof v !== "number" && 7 === v[0]){ + var l = v[1]; + if(typeof c !== "number") + switch(c[0]){ + case 2: + if(c[1] === "jit-failed"){l[5] = [0, jit_failed_sentinel]; return 0;} + break; + case 23: + var cl = c[1]; l[5] = [0, cl]; return 0; + } + l[5] = 0; + return 0; + } + return 0; + } + 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]; + } + return 0; + } + var + cst_request = "request", + h = [5, 0], + i = [2, "phase"], + j = [2, cst_request]; + function cek_call_or_suspend(vm_val, f, args){ + var + a = to_ocaml_list(args), + b = [19, Sx_types[17].call(null, 0)], + state = Sx_ref[227].call(null, f, [5, a], b, [5, a], h), + final = Sx_ref[147].call(null, state), + match = Sx_runtime[12].call(null, final, i); + if + (typeof match !== "number" + && 2 === match[0] && match[1] === "io-suspended"){ + var m = unwrap_vm(vm_val); + m[5] = [0, final]; + var + c = Sx_vm[6].call(null, m[4]), + d = Sx_runtime[12].call(null, final, j); + throw caml_maybe_attach_backtrace([0, Sx_vm[1], d, c], 1); + } + return Sx_ref[15].call(null, final); + } + function env_walk(env, name){ + if(typeof env === "number") return 0; + if(19 !== env[0]) return 0; + var + e = env[1], + a = Sx_types[31].call(null, name), + id = Sx_types[4].call(null, a), + e$0 = e; + for(;;){ + var match = Stdlib_Hashtbl[7].call(null, e$0[1], id); + if(match){var v = match[1]; return v;} + var match$0 = e$0[2]; + if(! match$0) return 0; + var p = match$0[1]; + e$0 = p; + } + } + function env_walk_set_b(env, name, value){ + if(typeof env !== "number" && 19 === env[0]){ + var + e = env[1], + b = Sx_types[31].call(null, name), + id = Sx_types[4].call(null, b), + e$0 = e; + for(;;){ + if(Stdlib_Hashtbl[9].call(null, e$0[1], id)){ + Stdlib_Hashtbl[11].call(null, e$0[1], id, value); + var a = 1; + } + else{ + var match = e$0[2]; + if(match){var p = match[1]; e$0 = p; continue;} + var a = 0; + } + return a ? 0 : 0; + } + } + return 0; + } + var + vm_run_fn = [0, function(param){return 0;}], + vm_call_fn = [0, function(b, a, param){return 0;}], + active_vm = [0, 0]; + function vm_call_closure(closure_val, args, globals){ + unwrap_closure(closure_val); + var prev_vm = active_vm[1]; + a: + { + if(typeof globals !== "number" && 6 === globals[0]){var d = globals[1], g = d; break a;} + var g = Stdlib_Hashtbl[1].call(null, 0, 0); + } + var m = [0, caml_make_vect(4096, 0), 0, 0, g, 0]; + active_vm[1] = [0, m]; + var vm_val = [25, m]; + vm_push_frame(vm_val, closure_val, args); + try{caml_call1(vm_run_fn[1], vm_val);} + 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 vm_pop(vm_val); + } + function try_jit_call(vm_val, f, args){ + var m = unwrap_vm(vm_val); + if(typeof f !== "number" && 7 === f[0]){ + var l = f[1], match = l[5]; + if(match){ + var cl = match[1]; + if(is_jit_failed(cl)) + return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); + try{ + var a = vm_push(vm_val, vm_call_closure([23, cl], args, [6, cl[4]])); + return a; + } + catch(exn){return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); + } + } + if(0 === l[4]) + return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); + l[5] = [0, jit_failed_sentinel]; + var match$0 = caml_call2(Sx_vm[2][1], l, m[4]); + if(! match$0) + return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); + var cl$0 = match$0[1]; + l[5] = [0, cl$0]; + try{ + var + b = vm_push(vm_val, vm_call_closure([23, cl$0], args, [6, cl$0[4]])); + return b; + } + catch(exn){return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args));} + } + return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); + } + function collect_n_from_stack(vm_val, n){ + var m = unwrap_vm(vm_val), count = Sx_types[76].call(null, n), a = 0; + if(count < 1) + var result$0 = a; + else{ + var result = a, for$ = 1; + for(;;){ + m[2] = m[2] - 1 | 0; + var + b = m[2], + c = [0, caml_check_bound(m[1], b)[b + 1], result], + d = for$ + 1 | 0; + if(count === for$){var result$0 = c; break;} + result = c; + for$ = d; + } + } + return [5, result$0]; + } + function collect_n_pairs(vm_val, n){ + var + m = unwrap_vm(vm_val), + count = Sx_types[76].call(null, n), + d = Stdlib_Hashtbl[1].call(null, 0, count); + if(count >= 1){ + var for$ = 1; + for(;;){ + m[2] = m[2] - 1 | 0; + var a = m[2], v = caml_check_bound(m[1], a)[a + 1]; + m[2] = m[2] - 1 | 0; + var + b = m[2], + c = caml_check_bound(m[1], b)[b + 1], + k = Sx_types[31].call(null, c); + Stdlib_Hashtbl[11].call(null, d, k, v); + var e = for$ + 1 | 0; + if(count === for$) break; + for$ = e; + } + } + return [6, d]; + } + function pad_n_nils(vm_val, n){ + var m = unwrap_vm(vm_val), count = Sx_types[76].call(null, n); + if(count >= 1){ + var for$ = 1; + for(;;){ + var a = m[2]; + caml_check_bound(m[1], a)[a + 1] = 0; + m[2] = m[2] + 1 | 0; + var b = for$ + 1 | 0; + if(count === for$) break; + for$ = b; + } + } + return 0; + } + var + cst = "=", + k = [0, [2, "component"], 0], + l = [2, "VM: not callable: "], + m = [0, [2, "island"], 0]; + function vm_call(vm, f, args){ + var a = vm_closure_p(f); + if(Sx_types[53].call(null, a)) return vm_push_frame(vm, f, args); + var b = is_lambda(f); + if(Sx_types[53].call(null, b)) return try_jit_call(vm, f, args); + var + c = [0, Sx_runtime[73].call(null, f), k], + or = Sx_runtime[1].call(null, cst, c); + if(Sx_types[53].call(null, or)) + var or$0 = or; + else + var + i = [0, Sx_runtime[73].call(null, f), m], + or$0 = Sx_runtime[1].call(null, cst, i); + if(Sx_types[53].call(null, or$0)) + return vm_push(vm, cek_call_or_suspend(vm, f, args)); + var d = Sx_runtime[90].call(null, f); + if(Sx_types[53].call(null, d)) + return vm_push(vm, Sx_runtime[7].call(null, f, args)); + var + e = [0, l, [0, Sx_runtime[73].call(null, f), 0]], + g = [2, Sx_runtime[4].call(null, e)], + h = Sx_runtime[2].call(null, g); + throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); + } + var + n = [0, [2, "for-each"], 0], + o = [0, [2, "map"], 0], + p = [0, [2, "map-indexed"], 0], + q = [0, [2, "filter"], 0], + r = [0, [2, "reduce"], 0], + s = [0, [2, "some"], 0], + t = [0, [2, "every?"], 0], + u = [2, cst_VM_undefined]; + function vm_resolve_ho_form(vm, name){ + var a = Sx_runtime[1].call(null, cst, [0, name, n]), cst$0 = "\xce\xbb"; + if(Sx_types[53].call(null, a)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + Stdlib_List[18].call + (null, + function(x){ + vm_call_external(vm, f, [5, [0, x, 0]]); + return 0; + }, + b); + return 0; + } + } + return 0; + }]; + var b = Sx_runtime[1].call(null, cst, [0, name, o]); + if(Sx_types[53].call(null, b)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + return [5, + Stdlib_List[20].call + (null, + function(x){return vm_call_external(vm, f, [5, [0, x, 0]]);}, + b)]; + } + } + return 0; + }]; + var c = Sx_runtime[1].call(null, cst, [0, name, p]); + if(Sx_types[53].call(null, c)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + return [5, + Stdlib_List[21].call + (null, + function(i, x){ + var i$0 = [1, i]; + return vm_call_external(vm, f, [5, [0, i$0, [0, x, 0]]]); + }, + b)]; + } + } + return 0; + }]; + var d = Sx_runtime[1].call(null, cst, [0, name, q]); + if(Sx_types[53].call(null, d)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + return [5, + Stdlib_List[44].call + (null, + function(x){ + var a = vm_call_external(vm, f, [5, [0, x, 0]]); + return Sx_types[53].call(null, a); + }, + b)]; + } + } + return 0; + }]; + var e = Sx_runtime[1].call(null, cst, [0, name, r]); + if(Sx_types[53].call(null, e)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a){ + var b = a[2]; + if(b && ! b[2]){ + var + coll = b[1], + init = a[1], + f = args[1], + c = Sx_runtime[5].call(null, coll); + return Stdlib_List[26].call + (null, + function(acc, x){ + return vm_call_external(vm, f, [5, [0, acc, [0, x, 0]]]); + }, + init, + c); + } + } + } + return 0; + }]; + var f = Sx_runtime[1].call(null, cst, [0, name, s]); + if(Sx_types[53].call(null, f)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + return [0, + Stdlib_List[34].call + (null, + function(x){ + var a = vm_call_external(vm, f, [5, [0, x, 0]]); + return Sx_types[53].call(null, a); + }, + b)]; + } + } + return 0; + }]; + var g = Sx_runtime[1].call(null, cst, [0, name, t]); + if(Sx_types[53].call(null, g)) + return [14, + cst$0, + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var + coll = a[1], + f = args[1], + b = Sx_runtime[5].call(null, coll); + return [0, + Stdlib_List[33].call + (null, + function(x){ + var a = vm_call_external(vm, f, [5, [0, x, 0]]); + return Sx_types[53].call(null, a); + }, + b)]; + } + } + return 0; + }]; + var + h = [2, Sx_runtime[4].call(null, [0, u, [0, name, 0]])], + i = Sx_runtime[2].call(null, h); + throw caml_maybe_attach_backtrace([0, Sx_types[9], i], 1); + } + function vm_call_external(vm, f, args){ + var a = vm_closure_p(f); + return Sx_types[53].call(null, a) + ? vm_call_closure(f, args, vm_globals_ref(vm)) + : cek_call(f, args); + } + var cst_io_request = "__io_request", v = [5, 0], w = [2, cst_io_request]; + function vm_run(vm){ + for(;;){ + var + a = vm_frames(vm), + b = Sx_runtime[33].call(null, a), + c = [0, 1 - Sx_types[53].call(null, b)]; + if(! Sx_types[53].call(null, c)) return 0; + var + d = vm_frames(vm), + frame = Sx_runtime[14].call(null, d), + e = vm_frames(vm), + rest_frames = Sx_runtime[15].call(null, e), + bc = code_bytecode(closure_code(frame_closure(frame))), + consts = code_constants(closure_code(frame_closure(frame))), + f = [0, Sx_runtime[24].call(null, bc), 0], + g = [0, frame_ip(frame), f], + h = Sx_runtime[1].call(null, ">=", g); + if(Sx_types[53].call(null, h)) return vm_set_frames_b(vm, v); + vm_step(vm, frame, rest_frames, bc, consts); + var + i = vm_globals_ref(vm), + j = Sx_runtime[25].call(null, i, w), + k = Sx_runtime[83].call(null, j); + if(! Sx_types[53].call(null, k)) return 0; + } + } + var + x = [0, [1, 1.], 0], + y = [0, [1, 2.], 0], + z = [0, [1, 3.], 0], + A = [0, 1], + B = [0, [1, 4.], 0], + C = [0, 0], + D = [0, [1, 5.], 0], + E = [0, [1, 6.], 0], + F = [0, [1, 16.], 0], + G = [0, [1, 17.], 0], + H = [0, [1, 18.], 0], + I = [0, [1, 19.], 0], + J = [0, [1, 20.], 0], + K = [0, [1, 21.], 0], + L = [0, [1, 32.], 0], + M = [0, [1, 33.], 0], + N = [0, [1, 34.], 0], + O = [0, [1, 48.], 0], + P = [0, [1, 49.], 0], + Q = [0, [1, 50.], 0], + R = [0, [1, 51.], 0], + S = [0, [1, 52.], 0], + T = [0, [1, 64.], 0], + U = [0, [1, 65.], 0], + V = [0, [1, 144.], 0], + W = [0, [1, 128.], 0], + X = [0, [1, 160.], 0], + Y = [0, [1, 161.], 0], + Z = [0, [1, 162.], 0], + _ = [0, [1, 163.], 0], + $ = [0, [1, 164.], 0], + aa = [0, [1, 165.], 0], + ab = [0, [1, 166.], 0], + ac = [0, [1, 167.], 0], + ad = [0, [1, 168.], 0], + ae = [0, [1, 169.], 0], + af = [0, [1, 170.], 0], + ag = [0, [1, 171.], 0], + ah = [0, [1, 172.], 0], + ai = [0, [1, 173.], 0], + aj = [1, 0.], + ak = [0, [1, 174.], 0], + al = [0, [1, 175.], 0], + am = [0, [1, 112.], 0], + an = [2, cst_io_request], + ao = [2, "VM: unknown opcode "]; + function vm_step(vm, frame, rest_frames, bc, consts){ + var + op = frame_read_u8(frame), + c = Sx_runtime[1].call(null, cst, [0, op, x]); + if(Sx_types[53].call(null, c)){ + var idx = frame_read_u16(frame); + return vm_push(vm, Sx_runtime[17].call(null, consts, idx)); + } + var e = Sx_runtime[1].call(null, cst, [0, op, y]); + if(Sx_types[53].call(null, e)) return vm_push(vm, 0); + var g = Sx_runtime[1].call(null, cst, [0, op, z]); + if(Sx_types[53].call(null, g)) return vm_push(vm, A); + var h = Sx_runtime[1].call(null, cst, [0, op, B]); + if(Sx_types[53].call(null, h)) return vm_push(vm, C); + var i = Sx_runtime[1].call(null, cst, [0, op, D]); + if(Sx_types[53].call(null, i)) return vm_pop(vm); + var j = Sx_runtime[1].call(null, cst, [0, op, E]); + if(Sx_types[53].call(null, j)) return vm_push(vm, vm_peek(vm)); + var k = Sx_runtime[1].call(null, cst, [0, op, F]); + if(Sx_types[53].call(null, k)){ + var slot = frame_read_u8(frame); + return vm_push(vm, frame_local_get(vm, frame, slot)); + } + var l = Sx_runtime[1].call(null, cst, [0, op, G]); + if(Sx_types[53].call(null, l)){ + var slot$0 = frame_read_u8(frame); + return frame_local_set(vm, frame, slot$0, vm_peek(vm)); + } + var m = Sx_runtime[1].call(null, cst, [0, op, H]); + if(Sx_types[53].call(null, m)){ + var idx$0 = frame_read_u8(frame); + return vm_push(vm, frame_upvalue_get(frame, idx$0)); + } + var o = Sx_runtime[1].call(null, cst, [0, op, I]); + if(Sx_types[53].call(null, o)){ + var idx$1 = frame_read_u8(frame); + return frame_upvalue_set(frame, idx$1, vm_peek(vm)); + } + var p = Sx_runtime[1].call(null, cst, [0, op, J]); + if(Sx_types[53].call(null, p)){ + var + idx$2 = frame_read_u16(frame), + name = Sx_runtime[17].call(null, consts, idx$2); + return vm_push(vm, vm_global_get(vm, frame, name)); + } + var q = Sx_runtime[1].call(null, cst, [0, op, K]); + if(Sx_types[53].call(null, q)){ + var + idx$3 = frame_read_u16(frame), + name$0 = Sx_runtime[17].call(null, consts, idx$3); + return vm_global_set(vm, frame, name$0, vm_peek(vm)); + } + var r = Sx_runtime[1].call(null, cst, [0, op, L]), cst$0 = "+"; + if(Sx_types[53].call(null, r)){ + var + offset = frame_read_i16(frame), + s = [0, frame_ip(frame), [0, offset, 0]]; + return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, s)); + } + var t = Sx_runtime[1].call(null, cst, [0, op, M]); + if(Sx_types[53].call(null, t)){ + var + offset$0 = frame_read_i16(frame), + v = vm_pop(vm), + u = [0, 1 - Sx_types[53].call(null, v)]; + if(! Sx_types[53].call(null, u)) return 0; + var w = [0, frame_ip(frame), [0, offset$0, 0]]; + return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, w)); + } + var ap = Sx_runtime[1].call(null, cst, [0, op, N]); + if(Sx_types[53].call(null, ap)){ + var offset$1 = frame_read_i16(frame), v$0 = vm_pop(vm); + if(! Sx_types[53].call(null, v$0)) return 0; + var aq = [0, frame_ip(frame), [0, offset$1, 0]]; + return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, aq)); + } + var ar = Sx_runtime[1].call(null, cst, [0, op, O]); + if(Sx_types[53].call(null, ar)){ + var + argc = frame_read_u8(frame), + args = collect_n_from_stack(vm, argc), + f = vm_pop(vm); + return vm_call(vm, f, args); + } + var as = Sx_runtime[1].call(null, cst, [0, op, P]); + if(Sx_types[53].call(null, as)){ + var + argc$0 = frame_read_u8(frame), + args$0 = collect_n_from_stack(vm, argc$0), + f$0 = vm_pop(vm); + vm_set_frames_b(vm, rest_frames); + vm_set_sp_b(vm, frame_base(frame)); + return vm_call(vm, f$0, args$0); + } + var at = Sx_runtime[1].call(null, cst, [0, op, Q]); + if(Sx_types[53].call(null, at)){ + var result = vm_pop(vm); + vm_set_frames_b(vm, rest_frames); + vm_set_sp_b(vm, frame_base(frame)); + return vm_push(vm, result); + } + var au = Sx_runtime[1].call(null, cst, [0, op, R]); + if(Sx_types[53].call(null, au)){ + var + idx$4 = frame_read_u16(frame), + code_val = Sx_runtime[17].call(null, consts, idx$4), + cl = vm_create_closure(vm, frame, code_val); + return vm_push(vm, cl); + } + var av = Sx_runtime[1].call(null, cst, [0, op, S]); + if(Sx_types[53].call(null, av)){ + var + idx$5 = frame_read_u16(frame), + argc$1 = frame_read_u8(frame), + name$1 = Sx_runtime[17].call(null, consts, idx$5), + args$1 = collect_n_from_stack(vm, argc$1); + return vm_push(vm, call_primitive(name$1, args$1)); + } + var aw = Sx_runtime[1].call(null, cst, [0, op, T]); + if(Sx_types[53].call(null, aw)){ + var + count = frame_read_u16(frame), + items = collect_n_from_stack(vm, count); + return vm_push(vm, items); + } + var ax = Sx_runtime[1].call(null, cst, [0, op, U]); + if(Sx_types[53].call(null, ax)){ + var count$0 = frame_read_u16(frame), d = collect_n_pairs(vm, count$0); + return vm_push(vm, d); + } + var ay = Sx_runtime[1].call(null, cst, [0, op, V]); + if(Sx_types[53].call(null, ay)){ + var + count$1 = frame_read_u8(frame), + parts = collect_n_from_stack(vm, count$1); + return vm_push(vm, Sx_runtime[7].call(null, str, parts)); + } + var az = Sx_runtime[1].call(null, cst, [0, op, W]); + if(Sx_types[53].call(null, az)){ + var + idx$6 = frame_read_u16(frame), + name$2 = Sx_runtime[17].call(null, consts, idx$6), + aA = vm_peek(vm), + aB = vm_globals_ref(vm); + return Sx_runtime[11].call(null, aB, name$2, aA); + } + var aC = Sx_runtime[1].call(null, cst, [0, op, X]); + if(Sx_types[53].call(null, aC)){ + var b = vm_pop(vm), a = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, cst$0, [0, a, [0, b, 0]])); + } + var aD = Sx_runtime[1].call(null, cst, [0, op, Y]), cst$1 = "-"; + if(Sx_types[53].call(null, aD)){ + var b$0 = vm_pop(vm), a$0 = vm_pop(vm); + return vm_push + (vm, Sx_runtime[1].call(null, cst$1, [0, a$0, [0, b$0, 0]])); + } + var aE = Sx_runtime[1].call(null, cst, [0, op, Z]); + if(Sx_types[53].call(null, aE)){ + var b$1 = vm_pop(vm), a$1 = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, "*", [0, a$1, [0, b$1, 0]])); + } + var aF = Sx_runtime[1].call(null, cst, [0, op, _]); + if(Sx_types[53].call(null, aF)){ + var b$2 = vm_pop(vm), a$2 = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, "/", [0, a$2, [0, b$2, 0]])); + } + var aG = Sx_runtime[1].call(null, cst, [0, op, $]); + if(Sx_types[53].call(null, aG)){ + var b$3 = vm_pop(vm), a$3 = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, cst, [0, a$3, [0, b$3, 0]])); + } + var aH = Sx_runtime[1].call(null, cst, [0, op, aa]); + if(Sx_types[53].call(null, aH)){ + var b$4 = vm_pop(vm), a$4 = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, "<", [0, a$4, [0, b$4, 0]])); + } + var aI = Sx_runtime[1].call(null, cst, [0, op, ab]); + if(Sx_types[53].call(null, aI)){ + var b$5 = vm_pop(vm), a$5 = vm_pop(vm); + return vm_push(vm, Sx_runtime[1].call(null, ">", [0, a$5, [0, b$5, 0]])); + } + var aJ = Sx_runtime[1].call(null, cst, [0, op, ac]); + if(Sx_types[53].call(null, aJ)){ + var aK = vm_pop(vm); + return vm_push(vm, [0, 1 - Sx_types[53].call(null, aK)]); + } + var aL = Sx_runtime[1].call(null, cst, [0, op, ad]); + if(Sx_types[53].call(null, aL)){ + var aM = vm_pop(vm); + return vm_push(vm, Sx_runtime[24].call(null, aM)); + } + var aN = Sx_runtime[1].call(null, cst, [0, op, ae]); + if(Sx_types[53].call(null, aN)){ + var aO = vm_pop(vm); + return vm_push(vm, Sx_runtime[14].call(null, aO)); + } + var aP = Sx_runtime[1].call(null, cst, [0, op, af]); + if(Sx_types[53].call(null, aP)){ + var aQ = vm_pop(vm); + return vm_push(vm, Sx_runtime[15].call(null, aQ)); + } + var aR = Sx_runtime[1].call(null, cst, [0, op, ag]); + if(Sx_types[53].call(null, aR)){ + var n = vm_pop(vm), coll = vm_pop(vm); + return vm_push(vm, Sx_runtime[17].call(null, coll, n)); + } + var aS = Sx_runtime[1].call(null, cst, [0, op, ah]); + if(Sx_types[53].call(null, aS)){ + var coll$0 = vm_pop(vm), x$0 = vm_pop(vm); + return vm_push(vm, Sx_runtime[18].call(null, x$0, coll$0)); + } + var aT = Sx_runtime[1].call(null, cst, [0, op, ai]); + if(Sx_types[53].call(null, aT)){ + var aU = [0, aj, [0, vm_pop(vm), 0]]; + return vm_push(vm, Sx_runtime[1].call(null, cst$1, aU)); + } + var aV = Sx_runtime[1].call(null, cst, [0, op, ak]); + if(Sx_types[53].call(null, aV)){ + var aW = [0, vm_pop(vm), 0]; + return vm_push(vm, Sx_runtime[1].call(null, "inc", aW)); + } + var aX = Sx_runtime[1].call(null, cst, [0, op, al]); + if(Sx_types[53].call(null, aX)){ + var aY = [0, vm_pop(vm), 0]; + return vm_push(vm, Sx_runtime[1].call(null, "dec", aY)); + } + var aZ = Sx_runtime[1].call(null, cst, [0, op, am]); + if(Sx_types[53].call(null, aZ)){ + var request = vm_pop(vm), a0 = vm_globals_ref(vm); + return Sx_runtime[11].call(null, a0, an, request); + } + var + a1 = [2, Sx_runtime[4].call(null, [0, ao, [0, op, 0]])], + a2 = Sx_runtime[2].call(null, a1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], a2], 1); + } + vm_run_fn[1] = vm_run; + vm_call_fn[1] = vm_call; + var cst_vm = "vm", ap = [0, 1], aq = [2, "import"]; + function check_io_suspension(globals, vm_val){ + var match = Stdlib_Hashtbl[7].call(null, globals, cst_io_request); + if(match){ + var req = match[1]; + if(Sx_types[53].call(null, req)){ + var d = Stdlib_Hashtbl[1].call(null, 0, 4); + Stdlib_Hashtbl[11].call(null, d, "suspended", ap); + Stdlib_Hashtbl[11].call(null, d, "op", aq); + Stdlib_Hashtbl[11].call(null, d, cst_request, req); + Stdlib_Hashtbl[11].call(null, d, cst_vm, vm_val); + return [0, [6, d]]; + } + } + return 0; + } + var ar = [0, "module"]; + function execute_module(code, globals){ + var + cl = [0, code, [0], ar, globals, 0], + m = [0, caml_make_vect(4096, 0), 0, 0, globals, 0], + frame = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], + a = code[3] - 1 | 0; + if(a >= 0){ + var for$ = 0; + for(;;){ + var b = m[2]; + caml_check_bound(m[1], b)[b + 1] = 0; + m[2] = m[2] + 1 | 0; + var c = for$ + 1 | 0; + if(a === for$) break; + for$ = c; + } + } + m[3] = [0, frame, 0]; + var vm_val = [25, m]; + vm_run(vm_val); + var match = check_io_suspension(globals, vm_val); + if(! match) return vm_pop(vm_val); + var suspension = match[1]; + return suspension; + } + function resume_module(suspended){ + if(typeof suspended !== "number" && 6 === suspended[0]){ + var d = suspended[1], vm_val = Stdlib_Hashtbl[6].call(null, d, cst_vm); + if(typeof vm_val !== "number" && 25 === vm_val[0]){ + var m = vm_val[1], globals = m[4]; + Stdlib_Hashtbl[11].call(null, globals, cst_io_request, 0); + vm_push(vm_val, 0); + vm_run(vm_val); + var match = check_io_suspension(globals, vm_val); + if(! match) return vm_pop(vm_val); + var suspension = match[1]; + return suspension; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "resume_module: expected VmMachine"], 1); + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "resume_module: expected suspension dict"], 1); + } + function call_closure(cl, args, globals){ + return vm_call_closure([23, cl], [5, args], [6, globals]); + } + var jit_compile_ref = Sx_vm[2]; + runtime.caml_register_global + (178, + [0, + cek_call, + eval_expr, + trampoline, + to_ocaml_list, + str, + call_primitive, + unwrap_vm, + unwrap_frame, + unwrap_closure, + make_uv_cell, + uv_get, + uv_set, + make_upvalue_cell, + uv_get$0, + uv_set_b, + make_vm_code, + make_vm_closure, + make_vm_frame, + make_vm, + vm_push, + vm_pop, + vm_peek, + frame_read_u8, + frame_read_u16, + frame_read_i16, + frame_local_get, + frame_local_set, + frame_upvalue_get, + frame_upvalue_set, + frame_ip, + frame_set_ip_b, + frame_base, + frame_closure, + closure_code, + closure_upvalues, + closure_env, + code_bytecode, + code_constants, + code_locals, + vm_sp, + vm_set_sp_b, + vm_stack, + vm_set_stack_b, + vm_frames, + vm_set_frames_b, + vm_globals_ref, + vm_global_get, + vm_global_set, + vm_push_frame, + vm_closure_p, + vm_create_closure, + jit_failed_sentinel, + is_jit_failed, + is_lambda, + lambda_compiled, + lambda_set_compiled_b, + lambda_name, + cek_call_or_suspend, + env_walk, + env_walk_set_b, + active_vm, + vm_run_fn, + vm_call_fn, + vm_call_closure, + try_jit_call, + collect_n_from_stack, + collect_n_pairs, + pad_n_nils, + vm_call, + vm_resolve_ho_form, + vm_call_external, + vm_run, + vm_step, + check_io_suspension, + execute_module, + resume_module, + call_closure, + code_from_value, + jit_compile_ref, + jit_failed_sentinel, + is_jit_failed], + "Sx_vm_ref"); + return; + } + (globalThis)); + +//# 20893 "../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_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + 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, + Sx_vm = global_data.Sx_vm, + Stdlib_Printexc = global_data.Stdlib__Printexc; + function eval_expr(expr, env){return Sx_ref[231].call(null, expr, env);} + var cond_scheme_p = Sx_ref[128], 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[212]; + function trampoline(v){ + if(typeof v !== "number" && 11 === v[0]){ + var env = v[2], expr = v[1]; + return Sx_ref[231].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[80].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[77].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[77].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[77].call(null, local, p, 0); return 0;}, + b); + } + return Sx_ref[231].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_vm[1]) throw caml_maybe_attach_backtrace(e, 0); + if(e[1] === Sx_types[9]){ + 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[31].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[53].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[31].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[53].call(null, or)) return or; + var or$0 = Sx_runtime[1].call(null, cst, [0, name, h]); + if(Sx_types[53].call(null, or$0)) return or$0; + var or$1 = Sx_runtime[1].call(null, cst, [0, name, i]); + if(Sx_types[53].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[1].call(null, cst, [0, name, j]); + if(Sx_types[53].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[1].call(null, cst, [0, name, k]); + if(Sx_types[53].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[1].call(null, cst, [0, name, l]); + if(Sx_types[53].call(null, or$4)) return or$4; + var or$5 = Sx_runtime[1].call(null, cst, [0, name, m]); + return Sx_types[53].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[25].call(null, state, s); + if(Sx_types[53].call(null, skip)){ + var + b = [0, Sx_runtime[25].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[73].call(null, arg), x], + and = Sx_runtime[1].call(null, cst, d); + if(Sx_types[53].call(null, and)) + var + e = [0, Sx_runtime[24].call(null, args), 0], + f = [0, Sx_runtime[25].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[53].call(null, a)){ + var + h = [0, Sx_runtime[25].call(null, state, z), 0], + i = Sx_runtime[1].call(null, cst_inc, h), + val = trampoline(eval_expr(Sx_runtime[17].call(null, args, i), env)), + j = Sx_types[55].call(null, arg); + Sx_runtime[11].call(null, attrs, j, val); + var + k = [0, Sx_runtime[25].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[10].call(null, children[1], arg); + var + m = [0, Sx_runtime[25].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[53].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[33].call(null, clauses); + if(Sx_types[53].call(null, a)) return 0; + var + clause = Sx_runtime[14].call(null, clauses), + test = Sx_runtime[14].call(null, clause), + body = Sx_runtime[17].call(null, clause, G), + b = Sx_runtime[112].call(null, test); + if(Sx_types[53].call(null, b)) return body; + var c = trampoline(eval_expr(test, env)); + if(Sx_types[53].call(null, c)) return body; + var clauses$0 = Sx_runtime[15].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[24].call(null, clauses), H], + b = Sx_runtime[1].call(null, cst$0, a); + if(Sx_types[53].call(null, b)) return 0; + var + test = Sx_runtime[14].call(null, clauses), + body = Sx_runtime[17].call(null, clauses, I), + c = Sx_runtime[112].call(null, test); + if(Sx_types[53].call(null, c)) return body; + var d = trampoline(eval_expr(test, env)); + if(Sx_types[53].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[80].call(null, env), + a = Sx_runtime[5].call(null, bindings); + Stdlib_List[18].call + (null, + function(pair){ + var + b = [0, Sx_runtime[73].call(null, pair), K], + and = Sx_runtime[1].call(null, cst, b); + if(Sx_types[53].call(null, and)) + var + c = [0, Sx_runtime[24].call(null, pair), L], + a = Sx_runtime[1].call(null, cst$1, c); + else + var a = and; + if(Sx_types[53].call(null, a)){ + var + d = Sx_runtime[14].call(null, pair), + e = [0, Sx_runtime[73].call(null, d), M], + f = Sx_runtime[1].call(null, cst, e); + if(Sx_types[53].call(null, f)) + var + g = Sx_runtime[14].call(null, pair), + name = Sx_types[54].call(null, g); + else + var + j = [0, Sx_runtime[14].call(null, pair), 0], + name = [2, Sx_runtime[4].call(null, j)]; + var + h = trampoline(eval_expr(Sx_runtime[17].call(null, pair, N), local)), + i = Sx_runtime[3].call(null, name); + Sx_runtime[77].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[73].call(null, expr), O], + b = Sx_runtime[1].call(null, cst, a), + or = [0, 1 - Sx_types[53].call(null, b)], + or$0 = Sx_types[53].call(null, or) ? or : Sx_runtime[33].call(null, expr); + if(Sx_types[53].call(null, or$0)) return P; + var + h = Sx_runtime[14].call(null, expr), + c = [0, Sx_runtime[73].call(null, h), Q], + d = Sx_runtime[1].call(null, cst, c), + e = [0, 1 - Sx_types[53].call(null, d)]; + if(Sx_types[53].call(null, e)) return R; + var + n = Sx_types[54].call(null, h), + or$1 = Sx_runtime[1].call(null, cst, [0, n, S]); + if(Sx_types[53].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[1].call(null, cst, [0, n, T]); + if(Sx_types[53].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[1].call(null, cst_starts_with, [0, n, U]); + if(Sx_types[53].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[1].call(null, cst_starts_with, [0, n, V]); + if(Sx_types[53].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[53].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[53].call(null, and)) return and; + var + g = [0, Sx_runtime[24].call(null, expr), Y], + and$0 = Sx_runtime[1].call(null, cst$5, g); + if(! Sx_types[53].call(null, and$0)) return and$0; + var + i = Sx_runtime[17].call(null, expr, _), + j = [0, Sx_runtime[73].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[53].call(null, c)){ + var existing = dict_get(target, aa); + if(Sx_types[53].call(null, existing)) + var + d = Sx_runtime[1].call(null, cst, [0, existing, ab]), + a = [0, 1 - Sx_types[53].call(null, d)]; + else + var a = existing; + var + e = + Sx_types[53].call(null, a) + ? [2, + Sx_runtime[4].call(null, [0, existing, [0, ac, [0, val, 0]]])] + : val; + Sx_runtime[11].call(null, target, ad, e); + } + else{ + var f = Sx_runtime[1].call(null, cst, [0, key, ae]); + if(Sx_types[53].call(null, f)){ + var existing$0 = dict_get(target, af); + if(Sx_types[53].call(null, existing$0)) + var + g = Sx_runtime[1].call(null, cst, [0, existing$0, ag]), + b = [0, 1 - Sx_types[53].call(null, g)]; + else + var b = existing$0; + var + h = + Sx_types[53].call(null, b) + ? [2, + Sx_runtime[4].call(null, [0, existing$0, [0, ah, [0, val, 0]]])] + : val; + Sx_runtime[11].call(null, target, ai, h); + } + else + Sx_runtime[11].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[73].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[53].call(null, expr) ? ao : ap; + if(caml_equal(match_val, aq)){ + var c = Sx_runtime[33].call(null, expr); + return Sx_types[53].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[55].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[70].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[75].call(null, expr), + expr$0 = Sx_types[74].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[73].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[53].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[70].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[75].call(null, val), b = Sx_types[74].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, "